™
Playground
Showcase
Download
Contact me
Playground
Showcase
Download
LinkedIn
engine globals (same contract as the playground) -- function mapToGlobals(env) { return { nodes: Array.isArray(env.nodes) ? env.nodes : [], edges: Array.isArray(env.edges) ? env.edges : [], COLUMNS: Array.isArray(env.columns) ? env.columns : [], HCOLUMNS: Array.isArray(env.hcolumns) ? env.hcolumns : [], BANDS: Array.isArray(env.bands) ? env.bands : [], CANVASES: Array.isArray(env.canvases) ? env.canvases : [], STATUS_LEGEND: (env.statusLegend && typeof env.statusLegend === "object") ? env.statusLegend : {} }; } function jsonForScript(obj) { return JSON.stringify(obj) .replace(/"]/g, function (c) { return { "&": "&", "<": "<", ">": ">", '"': """ }[c]; }); } // forExport=true keeps the engine's full chrome (its Export button, the // self-check attestation) — those belong to the standalone product file. // The showcase PREVIEW hides them: export lives in the sidebar, and a // fresh timestamp reads as clutter on a curated example. function assemble(env, forExport) { var payload = jsonForScript(mapToGlobals(env)); var meta = env.meta || {}; var title = meta.title ? String(meta.title) : "Untitled diagram"; var sub = meta.subtitle ? String(meta.subtitle) : ""; var out = ENGINE .replace("/*__ARCGRAM_PAYLOAD_SLOT__*/", function () { return "__ARCGRAM_PAYLOAD = " + payload + ";"; }) .replace("__ARCGRAM_TABTITLE_SLOT__", function () { return esc("Arcgram — " + title); }) .replace("__ARCGRAM_TITLE_SLOT__", function () { return esc(title); }) .replace("__ARCGRAM_SUB_SLOT__", function () { return esc(sub); }); if (Array.isArray(env.bugmarks) && env.bugmarks.length) { var marks = jsonForScript(env.bugmarks); var inject = "