21 lines
1003 B
JavaScript
21 lines
1003 B
JavaScript
// Shared cross-origin app embed: a Void header bar + a full-height iframe.
|
|
// Reuses the Terminal tab's themed classes (.term-bar/.term-frame/.ghost).
|
|
// The embedded app lives at its own HTTPS origin, so visiting that origin
|
|
// directly shows no Void chrome — there is no "back to Void" affordance here.
|
|
import { el, mount } from '../dom.js';
|
|
|
|
export function embedView({ title, sub, src, allow }) {
|
|
return async function render(main) {
|
|
const frame = el('iframe', { src, class: 'term-frame', title, ...(allow ? { allow } : {}) });
|
|
mount(main,
|
|
el('div', { class: 'term-bar' },
|
|
el('span', { class: 'term-title' }, '◆ ' + title),
|
|
sub ? el('span', { class: 'muted', style: { fontSize: '11px' } }, sub) : null,
|
|
el('a', { class: 'ghost', style: { marginLeft: 'auto' }, href: src, target: '_blank', rel: 'noopener' }, '↗ Open'),
|
|
el('button', { class: 'ghost', onclick: () => { frame.src = frame.src; } }, '⟳ Reload')
|
|
),
|
|
frame
|
|
);
|
|
};
|
|
}
|