/** * The built-in starter HTML. The "+ New box" menu no longer reads TEMPLATES * directly: it lists saved components, and TEMPLATES is what the Components * panel's "Import built-ins" turns into components (stores/components.js), so * they can be edited and deleted like any other. Changing an entry here only * reaches a site whose admin imports it again (after deleting the old one). * The helpers at the bottom are still used directly, by dropped uploads and * the starter layouts. * * Each runs inside the sandboxed iframe (see HtmlBox.vue), so scripts work but * can only reach APIs that allow cross-origin requests from an opaque origin — * i.e. that answer with `Access-Control-Allow-Origin: *` and need no key. * Open-Meteo is one. * * The site's colour and font tokens are already defined in the frame * (frameStyles.js), so templates use var(--color-…) freely. */ const CLOCK = `
`; const WEATHER = `

London

…
`; const imageHtml = (src) => ` `; const EMPTY = `

New box

Edit me.

`; // A sticky note for reminders to self. Unframed, since the note is its own // frame; the menu entry makes it adminOnly. const NOTE = `

TODO

`; const HEADING = `

Title

subtitle

`; const TEXT = `

Heading

A paragraph about it. Bold, italic and links all work.

“A quote you like.”
`; // Links. An HTML box is its own document in a sandboxed frame, so a link // must name where it opens: target="_top" replaces the site page (a full // load, not a router navigation — fine for leaving the page), and // target="_blank" a new tab. Without a target it would load inside the box. const LINK_STYLE = ``; const linkHtml = (links) => `${LINK_STYLE} `; // A scrolling grid of images. "Insert upload" in the editor adds more. const galleryHtml = (srcs) => `
${srcs.map((src) => ` `).join("\n")}
`; const videoHtml = (src) => ` `; /** * Built-in starters; `label` becomes the component's name and `size` ([w, h] * in canvas px) its default size. `adminOnly` sets a new box's flag, which can * be changed afterwards in the editor. */ export const TEMPLATES = [ { label: "Note (admin only)", title: "Note", html: NOTE, size: [260, 200], framed: false, adminOnly: true }, { label: "Heading", title: "Heading", html: HEADING, size: [600, 140], framed: false }, { label: "Text", title: "Text", html: TEXT, size: [400, 260] }, { label: "Link", title: "Link", html: linkHtml([{ name: "CV", href: "/cv" }]), size: [120, 60], framed: false }, { label: "Link row", title: "Links", html: linkHtml([ { name: "CV", href: "/cv" }, { name: "GitHub", href: "https://github.com/SteveThePug" }, ]), size: [400, 70], framed: false, }, { label: "Image / GIF", title: "Image", html: imageHtml("/img/memes/fire-woman.gif"), size: [240, 240], framed: false }, { label: "Image gallery", title: "Gallery", html: galleryHtml(["/img/memes/fire-woman.gif", "/img/memes/epic.jpeg"]), size: [460, 320] }, { label: "Video", title: "Video", html: videoHtml("/img/demoman/1760582395316219.webm"), size: [400, 260], framed: false }, { label: "Clock", title: "Clock", html: CLOCK, size: [240, 120] }, { label: "Weather", title: "Weather", html: WEATHER, size: [240, 170] }, { label: "Empty HTML", title: "HTML", html: EMPTY, size: [300, 200] }, ]; export { imageHtml, galleryHtml, videoHtml, linkHtml };