feat(views): cross-origin embed factory + Timelapse/AI Usage views
This commit is contained in:
21
public/views/embed.js
Normal file
21
public/views/embed.js
Normal file
@@ -0,0 +1,21 @@
|
||||
// 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) {
|
||||
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: () => {
|
||||
const f = document.getElementById('embed-frame'); if (f) f.src = f.src;
|
||||
} }, '⟳ Reload')
|
||||
),
|
||||
el('iframe', { id: 'embed-frame', src, class: 'term-frame', ...(allow ? { allow } : {}) })
|
||||
);
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user