wiki-plugin-livecode 0.4.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/client/livecode.js +4 -3
- package/client/livecode.js.map +3 -3
- package/package.json +13 -4
- package/pages/about-livecode-plugin +1 -1
package/client/livecode.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
(()=>{var
|
|
2
|
-
`)
|
|
3
|
-
`)
|
|
1
|
+
(()=>{var y="https://wasm.livecode.wiki/assets/wasm/shared/stack.html",v=i=>{let e=Array.isArray(i)&&i.length===3?i:["Left","Centre","Right"],t=s=>String(s).replace(/"/g,"'").replace(/[\r\n]/g," ");return['script "Triptych"',"","on preOpenStack"," buildTriptych","end preOpenStack","on startup"," buildTriptych","end startup","on openStack"," buildTriptych","end openStack","","local sBuilt","","command buildTriptych"," if sBuilt is true then exit buildTriptych"," put true into sBuilt"," repeat the number of controls of this card"," delete last control"," end repeat"," local tW, tH, p, zw"," put winWidth() into tW"," put winHeight() into tH"," set the rect of this stack to 0, 0, tW, tH",' set the backgroundColor of this card to "248,249,251"'," put 14 into p"," put trunc((tW - 4 * p) / 3) into zw",` makeColumn "col1", p, zw, tH, "${t(e[0])}", "225,235,252"`,` makeColumn "col2", p + zw + p, zw, tH, "${t(e[1])}", "255,248,232"`,` makeColumn "col3", p + 2 * (zw + p), zw, tH, "${t(e[2])}", "228,244,230"`,"end buildTriptych","","command makeColumn pName, pX, pW, pH, pLabel, pColor"," create graphic pName",' set the style of graphic pName to "roundrect"'," set the rect of graphic pName to pX, 14, pX + pW, pH - 14"," set the opaque of graphic pName to true"," set the backgroundColor of graphic pName to pColor",' set the lineColor of graphic pName to "205,210,220"',' create field (pName & "L")',' set the rect of field (pName & "L") to pX, 22, pX + pW, 48',' set the textAlign of field (pName & "L") to "center"',' set the textSize of field (pName & "L") to 15',' set the borderWidth of field (pName & "L") to 0',' set the opaque of field (pName & "L") to false',' set the lockText of field (pName & "L") to true',' put pLabel into field (pName & "L")',"end makeColumn","","function winWidth"," local w",' do "window.innerWidth" as "javascript"'," put the result into w"," if w is not a number or w < 200 then put 700 into w"," return w","end winWidth","","function winHeight"," local h",' do "window.innerHeight" as "javascript"'," put the result into h"," if h is not a number or h < 120 then put 340 into h"," return h","end winHeight"].join(`
|
|
2
|
+
`)},w=i=>{let e={stack:null,title:null,height:420,width:null,triptych:!1,columns:null,boot:"auto",fullscreen:"fixed",name:null,script:null,transparent:!1,behind:null},t=(i||"").split(`
|
|
3
|
+
`);for(let s=0;s<t.length;s++){let r=t[s].match(/^\s*script\s+"([^"]+)"/);if(r){e.script=t.slice(s).join(`
|
|
4
|
+
`),e.name||(e.name=r[1]),e.title||(e.title=r[1]);break}if(/^\s*TRIPTYCH\s*$/i.test(t[s])){e.triptych=!0;continue}if(/^\s*TRANSPARENT\s*$/i.test(t[s])){e.transparent=!0;continue}let n=t[s].trim().match(/^([A-Z]+):?\s+(.*)$/);if(!n)continue;let[,o,p]=n,a=p.trim();if(o==="STACK")e.stack=a;else if(o==="TITLE")e.title=a;else if(o==="HEIGHT")e.height=parseInt(a,10)||e.height;else if(o==="BOOT")e.boot=a.toLowerCase()==="click"?"click":"auto";else if(o==="FULLSCREEN"){let c=a.toLowerCase();e.fullscreen=["fixed","scale","resize"].includes(c)?c:"fixed"}else if(o==="NAME")e.name=a;else if(o==="WIDTH"){let c=a.toLowerCase();e.width=c==="full"||c==="page"||c==="lineup"?"full":parseInt(a,10)||null}else o==="TRIPTYCH"?(e.triptych=!0,a&&(e.columns=a.split("|").map(c=>c.trim()).filter(Boolean))):o==="COLUMNS"?e.columns=a.split("|").map(c=>c.trim()).filter(Boolean):o==="BEHIND"&&(e.behind=a)}if(e.triptych&&!e.script&&(e.script=v(e.columns),e.name||(e.name="Triptych"),e.title||(e.title="Triptych")),e.script&&!e.stack&&(e.stack=y),!e.title&&e.stack){let s=e.stack.split("/").pop()||"";e.title=(s.split("?")[0]||"").replace(/\.html?$/i,"")||"Livecode stack"}return e},f=i=>String(i).replace(/[&<>"']/g,e=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[e]),h=(i,e)=>/^https?:\/\//i.test(e)?e:`//${i.parents(".page").data("site")||window.location.host}/${e.replace(/^\//,"")}`,m=i=>{let e=i.__livecode;e&&(clearInterval(e.watch),window.removeEventListener("message",e.onMessage),document.removeEventListener("fullscreenchange",e.onFsChange),(e.mount||e.frame).remove(),e.bar.remove(),e.poster.style.display="",i.__livecode=null)},x=(i,e,t,s)=>{if(i.__livecode)return;if(s+=(s.includes("?")?"&":"?")+"fs="+t.fullscreen,t.name&&(s+="&stack="+encodeURIComponent(t.name)),t.script&&(s+="&boot=script"),t.transparent&&(s+="&bg=transparent"),t.width==="full"){let l=[...document.querySelectorAll(".page")];if(l.length>=2){let d=l.map(b=>{let u=b.getBoundingClientRect();return Math.round(u.left)+":"+Math.round(u.width)}).join(",");s+="&zones="+encodeURIComponent(d)}}let r=document.createElement("div");r.className="livecode-bar",r.style.cssText="display:flex;justify-content:space-between;align-items:center;font-size:12px;color:#666;padding:2px 4px 4px",r.innerHTML=`<span>${f(t.title)}</span><span><span class="livecode-full" style="cursor:pointer;color:#666;margin-right:12px" title="fullscreen (${f(t.fullscreen)})">⛶ full</span><span class="livecode-stop" style="cursor:pointer;color:#b5511d">■ stop</span></span>`;let n=document.createElement("iframe");n.className="livecode-frame",n.src=s,n.setAttribute("allow","fullscreen"),n.setAttribute("allowfullscreen",""),t.transparent&&n.setAttribute("allowtransparency","true"),n.style.cssText=`width:100%;height:${t.height}px;border-radius:6px;`+(t.transparent?"border:0;background:transparent":"border:1px solid #e0e0e0;background:#fff");let o=n;if(t.behind){let l=document.createElement("div");l.className="livecode-stage",l.style.cssText=`position:relative;width:100%;height:${t.height}px;border-radius:6px;overflow:hidden`;let d=document.createElement("iframe");d.className="livecode-behind",d.src=t.behind,d.setAttribute("scrolling","no"),d.style.cssText="position:absolute;inset:0;width:100%;height:100%;border:0;z-index:0",n.style.position="absolute",n.style.inset="0",n.style.width="100%",n.style.height="100%",n.style.borderRadius="0",n.style.zIndex="1",l.appendChild(d),l.appendChild(n),o=l}t.width==="full"?(o.style.width="100vw",o.style.maxWidth="100vw",requestAnimationFrame(()=>{o.style.marginLeft="0px";let l=o.getBoundingClientRect().left;o.style.marginLeft=-l+"px"}),i.style.overflow="visible"):typeof t.width=="number"&&(o.style.width=t.width+"px",o.style.maxWidth="none",i.style.overflow="visible");let p=l=>{try{n.contentWindow.postMessage({livecode:{command:l,mode:t.fullscreen}},"*")}catch{}},a=l=>{if(!i.__livecode||l.source!==n.contentWindow)return;let d=l.data&&l.data.livecode;d&&d.ready==="script"&&t.script&&n.contentWindow.postMessage({livecode:{bootScript:t.script}},"*"),i.dataset.lastMessage=JSON.stringify(l.data),window.$&&window.$(i).trigger("livecodeMessage",[l.data])};window.addEventListener("message",a);let c=()=>{i.__livecode&&(document.fullscreenElement===n?p("fullscreen"):document.fullscreenElement||p("fullscreenExit"))};document.addEventListener("fullscreenchange",c);let g=setInterval(()=>{document.body.contains(i)||m(i)},4e3);e.style.display="none",i.appendChild(r),i.appendChild(o),r.querySelector(".livecode-stop").addEventListener("click",()=>m(i)),r.querySelector(".livecode-full").addEventListener("click",()=>{n.requestFullscreen&&n.requestFullscreen()}),i.__livecode={poster:e,frame:n,mount:o,bar:r,watch:g,onMessage:a,onFsChange:c}},k=(i,e)=>{let t=w(e.text||"");if(!t.stack){i.html('<div class="livecode-widget" style="border:1px dashed #ccc;border-radius:6px;padding:12px;color:#888;font-size:13px">livecode — no STACK given. Double click to edit, e.g.<br><code>STACK https://wasm.livecode.wiki/assets/wasm/shared/stack.html?zip=hexagon.zip</code></div>');return}i.html(`<div class="livecode-widget"><div class="livecode-poster" style="cursor:pointer;border:1px solid #e0d5c5;border-radius:6px;padding:14px 16px;background:linear-gradient(135deg,#fff7ee,#ffffff)"><div style="font-weight:bold;font-size:15px">▶ ${f(t.title)}</div><div style="font-size:12px;color:#888;margin-top:4px">Livecode wasm — ${t.script?"runs this item's script with":"loads"} the ${6.4} MB engine</div></div></div>`)},L=(i,e)=>{i.on("dblclick",()=>window.wiki.textEditor(i,e));let t=w(e.text||""),s=i.find(".livecode-widget")[0],r=i.find(".livecode-poster")[0];if(!t.stack||!s||!r)return;t.behind&&(t.behind=h(i,t.behind));let n=h(i,t.stack),o=p=>{p&&p.stopPropagation(),x(s,r,t,n)};r.addEventListener("click",o),t.boot==="auto"&&o()};typeof window<"u"&&(window.plugins=window.plugins||{},window.plugins.livecode={emit:k,bind:L});})();
|
|
4
5
|
//# sourceMappingURL=livecode.js.map
|
package/client/livecode.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/client/livecode.js"],
|
|
4
|
-
"sourcesContent": ["// wiki-plugin-livecode \u2014 Livecode wasm stacks as wiki widgets.\n//\n// Item text DSL (UPPERCASE commands, per the house fedwiki-dsl convention):\n//\n// STACK wasm/Hexagon/Hexagon.html relative to the item's origin site\n// STACK https://site/assets/.../x.html or absolute\n// TITLE Hexagon poster label (default: file name)\n// HEIGHT 420 iframe height in px (default 420)\n// BOOT auto auto (default) or click\n// FULLSCREEN fixed fixed (default), scale, or resize\n// NAME MyStack stack name for the JS bridge\n//\n// Design (door two of Three Livecode Doors): a livecode item loads and\n// displays its stack by default. BOOT click opts a widget into a light\n// collapsible poster that boots on demand. Every widget runs independently;\n// a watchdog tears a frame down when its item leaves the lineup (fedwiki\n// has no plugin dispose hook \u2014 the htv pattern), and the stop control\n// collapses a running widget back to its poster.\n\nconst ENGINE_MB = 6.4\nconst SHARED_SHELL = 'https://wasm.livecode.wiki/assets/wasm/shared/stack.html'\n\nexport const parse = (text) => {\n const spec = { stack: null, title: null, height: 420, boot: 'auto', fullscreen: 'fixed', name: null, script: null }\n const lines = (text || '').split('\\n')\n for (let i = 0; i < lines.length; i++) {\n // a script-only stack begins `script \"Name\"` \u2014 everything from that\n // line on is the stack's script, booted directly by the shared shell\n const sm = lines[i].match(/^\\s*script\\s+\"([^\"]+)\"/)\n if (sm) {\n spec.script = lines.slice(i).join('\\n')\n if (!spec.name) spec.name = sm[1]\n if (!spec.title) spec.title = sm[1]\n break\n }\n const m = lines[i].trim().match(/^([A-Z]+):?\\s+(.*)$/)\n if (!m) continue\n const [, cmd, restRaw] = m\n const rest = restRaw.trim()\n if (cmd === 'STACK') spec.stack = rest\n else if (cmd === 'TITLE') spec.title = rest\n else if (cmd === 'HEIGHT') spec.height = parseInt(rest, 10) || spec.height\n else if (cmd === 'BOOT') spec.boot = rest.toLowerCase() === 'click' ? 'click' : 'auto'\n else if (cmd === 'FULLSCREEN') {\n const mode = rest.toLowerCase()\n spec.fullscreen = ['fixed', 'scale', 'resize'].includes(mode) ? mode : 'fixed'\n } else if (cmd === 'NAME') spec.name = rest\n }\n if (spec.script && !spec.stack) spec.stack = SHARED_SHELL\n if (!spec.title && spec.stack) {\n const leaf = spec.stack.split('/').pop() || ''\n spec.title = (leaf.split('?')[0] || '').replace(/\\.html?$/i, '') || 'Livecode stack'\n }\n return spec\n}\n\nconst escapeHtml = (s) =>\n String(s).replace(/[&<>\"']/g, (c) =>\n ({ '&': '&', '<': '<', '>': '>', '\"': '"', \"'\": ''' })[c])\n\nconst resolveUrl = (div, stack) => {\n if (/^https?:\\/\\//i.test(stack)) return stack\n const site = div.parents('.page').data('site') || window.location.host\n return `//${site}/${stack.replace(/^\\//, '')}`\n}\n\n// ---- per-widget lifecycle ---------------------------------------------\n\nconst stopWidget = (widget) => {\n const inst = widget.__livecode\n if (!inst) return\n clearInterval(inst.watch)\n window.removeEventListener('message', inst.onMessage)\n document.removeEventListener('fullscreenchange', inst.onFsChange)\n inst.frame.remove()\n inst.bar.remove()\n inst.poster.style.display = ''\n widget.__livecode = null\n}\n\nconst boot = (widget, poster, spec, url) => {\n if (widget.__livecode) return\n\n // arm the shell's fullscreen mode from load \u2014 deterministic, no message race\n url += (url.includes('?') ? '&' : '?') + 'fs=' + spec.fullscreen\n if (spec.name) {\n url += '&stack=' + encodeURIComponent(spec.name)\n }\n if (spec.script) {\n url += '&boot=script'\n }\n\n const bar = document.createElement('div')\n bar.className = 'livecode-bar'\n bar.style.cssText =\n 'display:flex;justify-content:space-between;align-items:center;' +\n 'font-size:12px;color:#666;padding:2px 4px 4px'\n bar.innerHTML =\n `<span>${escapeHtml(spec.title)}</span>` +\n '<span>' +\n `<span class=\"livecode-full\" style=\"cursor:pointer;color:#666;margin-right:12px\" ` +\n `title=\"fullscreen (${escapeHtml(spec.fullscreen)})\">⛶ full</span>` +\n `<span class=\"livecode-stop\" style=\"cursor:pointer;color:#b5511d\">■ stop</span>` +\n '</span>'\n\n const frame = document.createElement('iframe')\n frame.className = 'livecode-frame'\n frame.src = url\n frame.setAttribute('allow', 'fullscreen')\n frame.setAttribute('allowfullscreen', '')\n frame.style.cssText =\n `width:100%;height:${spec.height}px;border:1px solid #e0e0e0;` +\n 'border-radius:6px;background:#fff'\n\n const tell = (command) => {\n try {\n frame.contentWindow.postMessage({ livecode: { command, mode: spec.fullscreen } }, '*')\n } catch (e) { /* frame gone */ }\n }\n\n const onMessage = (event) => {\n if (!widget.__livecode || event.source !== frame.contentWindow) return\n const d = event.data && event.data.livecode\n if (d && d.ready === 'script' && spec.script) {\n frame.contentWindow.postMessage({ livecode: { bootScript: spec.script } }, '*')\n }\n widget.dataset.lastMessage = JSON.stringify(event.data)\n if (window.$) window.$(widget).trigger('livecodeMessage', [event.data])\n }\n window.addEventListener('message', onMessage)\n\n const onFsChange = () => {\n if (!widget.__livecode) return\n if (document.fullscreenElement === frame) tell('fullscreen')\n else if (!document.fullscreenElement) tell('fullscreenExit')\n }\n document.addEventListener('fullscreenchange', onFsChange)\n\n // watchdog: fedwiki never tells a plugin its item left the lineup\n const watch = setInterval(() => {\n if (!document.body.contains(widget)) stopWidget(widget)\n }, 4000)\n\n poster.style.display = 'none'\n widget.appendChild(bar)\n widget.appendChild(frame)\n bar.querySelector('.livecode-stop').addEventListener('click', () => stopWidget(widget))\n bar.querySelector('.livecode-full').addEventListener('click', () => {\n if (frame.requestFullscreen) frame.requestFullscreen()\n })\n widget.__livecode = { poster, frame, bar, watch, onMessage, onFsChange }\n}\n\n// ---- fedwiki plugin surface -------------------------------------------\n\nexport const emit = (div, item) => {\n const spec = parse(item.text || '')\n if (!spec.stack) {\n div.html(\n '<div class=\"livecode-widget\" style=\"border:1px dashed #ccc;border-radius:6px;' +\n 'padding:12px;color:#888;font-size:13px\">livecode — no STACK given. ' +\n 'Double click to edit, e.g.<br><code>STACK https://wasm.livecode.wiki/assets/wasm/shared/stack.html?zip=hexagon.zip</code></div>')\n return\n }\n div.html(\n '<div class=\"livecode-widget\">' +\n '<div class=\"livecode-poster\" style=\"cursor:pointer;border:1px solid #e0d5c5;' +\n 'border-radius:6px;padding:14px 16px;background:linear-gradient(135deg,#fff7ee,#ffffff)\">' +\n `<div style=\"font-weight:bold;font-size:15px\">▶ ${escapeHtml(spec.title)}</div>` +\n `<div style=\"font-size:12px;color:#888;margin-top:4px\">Livecode wasm — ` +\n `${spec.script ? \"runs this item's script with\" : 'loads'} the ${ENGINE_MB} MB engine</div>` +\n '</div></div>')\n}\n\nexport const bind = (div, item) => {\n div.on('dblclick', () => window.wiki.textEditor(div, item))\n const spec = parse(item.text || '')\n const widget = div.find('.livecode-widget')[0]\n const poster = div.find('.livecode-poster')[0]\n if (!spec.stack || !widget || !poster) return\n const url = resolveUrl(div, spec.stack)\n const start = (event) => {\n if (event) event.stopPropagation()\n boot(widget, poster, spec, url)\n }\n poster.addEventListener('click', start)\n if (spec.boot === 'auto') start()\n}\n\nif (typeof window !== 'undefined') {\n window.plugins = window.plugins || {}\n window.plugins['livecode'] = { emit, bind }\n}\n"],
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": ["SHARED_SHELL", "parse", "text", "spec", "lines", "i", "sm", "m", "cmd", "restRaw", "rest", "mode", "
|
|
4
|
+
"sourcesContent": ["// wiki-plugin-livecode \u2014 Livecode wasm stacks as wiki widgets.\n//\n// Item text DSL (UPPERCASE commands, per the house fedwiki-dsl convention):\n//\n// STACK wasm/Hexagon/Hexagon.html relative to the item's origin site\n// STACK https://site/assets/.../x.html or absolute\n// TITLE Hexagon poster label (default: file name)\n// HEIGHT 420 iframe height in px (default 420)\n// BOOT auto auto (default) or click\n// FULLSCREEN fixed fixed (default), scale, or resize\n// NAME MyStack stack name for the JS bridge\n// WIDTH full break out of the column: full (page\n// width) or a pixel number (default:\n// column width). The stack reads its\n// real size from window.innerWidth.\n// TRIPTYCH a | b | c turnkey mode: one engine draws three\n// labelled columns (default Left |\n// Centre | Right), sized to the window.\n// COLUMNS a | b | c the three column labels for TRIPTYCH.\n// TRANSPARENT render the stack with a transparent\n// background (opt-in ?bg=transparent on\n// the shell) so the page behind shows\n// through. The stack must leave its\n// card background empty.\n// BEHIND <url> an HTML page drawn behind the (usually\n// TRANSPARENT) stack, inside the same\n// widget \u2014 the animation composites over\n// ordinary web content. Give a full URL.\n//\n// Design (door two of Three Livecode Doors): a livecode item loads and\n// displays its stack by default. BOOT click opts a widget into a light\n// collapsible poster that boots on demand. Every widget runs independently;\n// a watchdog tears a frame down when its item leaves the lineup (fedwiki\n// has no plugin dispose hook \u2014 the htv pattern), and the stop control\n// collapses a running widget back to its poster.\n\nconst ENGINE_MB = 6.4\nconst SHARED_SHELL = 'https://wasm.livecode.wiki/assets/wasm/shared/stack.html'\n\n// TRIPTYCH mode \u2014 generate the LiveCode scaffold for one engine drawing three\n// positioned, labelled columns. It clears the donor capsule's leftover controls\n// (8 hexagon parts on the boot card), reads its real size from the browser\n// window, and lays the columns out proportionally. Authors get three columns\n// with no hand-written LiveCode; behaviour can be layered on later.\nconst triptychScript = (columns) => {\n const cols = (Array.isArray(columns) && columns.length === 3) ? columns : ['Left', 'Centre', 'Right']\n const lab = (s) => String(s).replace(/\"/g, \"'\").replace(/[\\r\\n]/g, ' ')\n return [\n 'script \"Triptych\"',\n '',\n 'on preOpenStack',\n ' buildTriptych',\n 'end preOpenStack',\n 'on startup',\n ' buildTriptych',\n 'end startup',\n 'on openStack',\n ' buildTriptych',\n 'end openStack',\n '',\n 'local sBuilt',\n '',\n 'command buildTriptych',\n ' if sBuilt is true then exit buildTriptych',\n ' put true into sBuilt',\n ' repeat the number of controls of this card',\n ' delete last control',\n ' end repeat',\n ' local tW, tH, p, zw',\n ' put winWidth() into tW',\n ' put winHeight() into tH',\n ' set the rect of this stack to 0, 0, tW, tH',\n ' set the backgroundColor of this card to \"248,249,251\"',\n ' put 14 into p',\n ' put trunc((tW - 4 * p) / 3) into zw',\n ` makeColumn \"col1\", p, zw, tH, \"${lab(cols[0])}\", \"225,235,252\"`,\n ` makeColumn \"col2\", p + zw + p, zw, tH, \"${lab(cols[1])}\", \"255,248,232\"`,\n ` makeColumn \"col3\", p + 2 * (zw + p), zw, tH, \"${lab(cols[2])}\", \"228,244,230\"`,\n 'end buildTriptych',\n '',\n 'command makeColumn pName, pX, pW, pH, pLabel, pColor',\n ' create graphic pName',\n ' set the style of graphic pName to \"roundrect\"',\n ' set the rect of graphic pName to pX, 14, pX + pW, pH - 14',\n ' set the opaque of graphic pName to true',\n ' set the backgroundColor of graphic pName to pColor',\n ' set the lineColor of graphic pName to \"205,210,220\"',\n ' create field (pName & \"L\")',\n ' set the rect of field (pName & \"L\") to pX, 22, pX + pW, 48',\n ' set the textAlign of field (pName & \"L\") to \"center\"',\n ' set the textSize of field (pName & \"L\") to 15',\n ' set the borderWidth of field (pName & \"L\") to 0',\n ' set the opaque of field (pName & \"L\") to false',\n ' set the lockText of field (pName & \"L\") to true',\n ' put pLabel into field (pName & \"L\")',\n 'end makeColumn',\n '',\n 'function winWidth',\n ' local w',\n ' do \"window.innerWidth\" as \"javascript\"',\n ' put the result into w',\n ' if w is not a number or w < 200 then put 700 into w',\n ' return w',\n 'end winWidth',\n '',\n 'function winHeight',\n ' local h',\n ' do \"window.innerHeight\" as \"javascript\"',\n ' put the result into h',\n ' if h is not a number or h < 120 then put 340 into h',\n ' return h',\n 'end winHeight'\n ].join('\\n')\n}\n\nexport const parse = (text) => {\n const spec = { stack: null, title: null, height: 420, width: null, triptych: false, columns: null, boot: 'auto', fullscreen: 'fixed', name: null, script: null, transparent: false, behind: null }\n const lines = (text || '').split('\\n')\n for (let i = 0; i < lines.length; i++) {\n // a script-only stack begins `script \"Name\"` \u2014 everything from that\n // line on is the stack's script, booted directly by the shared shell\n const sm = lines[i].match(/^\\s*script\\s+\"([^\"]+)\"/)\n if (sm) {\n spec.script = lines.slice(i).join('\\n')\n if (!spec.name) spec.name = sm[1]\n if (!spec.title) spec.title = sm[1]\n break\n }\n // a bare TRIPTYCH line (no args) turns on turnkey mode with default labels\n if (/^\\s*TRIPTYCH\\s*$/i.test(lines[i])) { spec.triptych = true; continue }\n // a bare TRANSPARENT line renders the stack with a transparent background\n // (opt-in ?bg=transparent on the shell) so anything behind shows through\n if (/^\\s*TRANSPARENT\\s*$/i.test(lines[i])) { spec.transparent = true; continue }\n const m = lines[i].trim().match(/^([A-Z]+):?\\s+(.*)$/)\n if (!m) continue\n const [, cmd, restRaw] = m\n const rest = restRaw.trim()\n if (cmd === 'STACK') spec.stack = rest\n else if (cmd === 'TITLE') spec.title = rest\n else if (cmd === 'HEIGHT') spec.height = parseInt(rest, 10) || spec.height\n else if (cmd === 'BOOT') spec.boot = rest.toLowerCase() === 'click' ? 'click' : 'auto'\n else if (cmd === 'FULLSCREEN') {\n const mode = rest.toLowerCase()\n spec.fullscreen = ['fixed', 'scale', 'resize'].includes(mode) ? mode : 'fixed'\n } else if (cmd === 'NAME') spec.name = rest\n else if (cmd === 'WIDTH') {\n const v = rest.toLowerCase()\n spec.width = (v === 'full' || v === 'page' || v === 'lineup') ? 'full' : (parseInt(rest, 10) || null)\n }\n else if (cmd === 'TRIPTYCH') {\n spec.triptych = true\n if (rest) spec.columns = rest.split('|').map((s) => s.trim()).filter(Boolean)\n }\n else if (cmd === 'COLUMNS') spec.columns = rest.split('|').map((s) => s.trim()).filter(Boolean)\n else if (cmd === 'BEHIND') spec.behind = rest\n }\n // TRIPTYCH mode generates its own script-only stack from the column labels\n if (spec.triptych && !spec.script) {\n spec.script = triptychScript(spec.columns)\n if (!spec.name) spec.name = 'Triptych'\n if (!spec.title) spec.title = 'Triptych'\n }\n if (spec.script && !spec.stack) spec.stack = SHARED_SHELL\n if (!spec.title && spec.stack) {\n const leaf = spec.stack.split('/').pop() || ''\n spec.title = (leaf.split('?')[0] || '').replace(/\\.html?$/i, '') || 'Livecode stack'\n }\n return spec\n}\n\nconst escapeHtml = (s) =>\n String(s).replace(/[&<>\"']/g, (c) =>\n ({ '&': '&', '<': '<', '>': '>', '\"': '"', \"'\": ''' })[c])\n\nconst resolveUrl = (div, stack) => {\n if (/^https?:\\/\\//i.test(stack)) return stack\n const site = div.parents('.page').data('site') || window.location.host\n return `//${site}/${stack.replace(/^\\//, '')}`\n}\n\n// ---- per-widget lifecycle ---------------------------------------------\n\nconst stopWidget = (widget) => {\n const inst = widget.__livecode\n if (!inst) return\n clearInterval(inst.watch)\n window.removeEventListener('message', inst.onMessage)\n document.removeEventListener('fullscreenchange', inst.onFsChange)\n ;(inst.mount || inst.frame).remove()\n inst.bar.remove()\n inst.poster.style.display = ''\n widget.__livecode = null\n}\n\nconst boot = (widget, poster, spec, url) => {\n if (widget.__livecode) return\n\n // arm the shell's fullscreen mode from load \u2014 deterministic, no message race\n url += (url.includes('?') ? '&' : '?') + 'fs=' + spec.fullscreen\n if (spec.name) {\n url += '&stack=' + encodeURIComponent(spec.name)\n }\n if (spec.script) {\n url += '&boot=script'\n }\n if (spec.transparent) {\n url += '&bg=transparent'\n }\n // WIDTH full pulls the iframe to the viewport's left edge, so iframe x-coords\n // equal viewport x-coords. Hand the stack the REAL lineup column geometry \u2014\n // one x:width pair per .page \u2014 so it can lay zones over the actual columns.\n if (spec.width === 'full') {\n const pages = [...document.querySelectorAll('.page')]\n if (pages.length >= 2) {\n const zones = pages.map((p) => {\n const r = p.getBoundingClientRect()\n return Math.round(r.left) + ':' + Math.round(r.width)\n }).join(',')\n url += '&zones=' + encodeURIComponent(zones)\n }\n }\n\n const bar = document.createElement('div')\n bar.className = 'livecode-bar'\n bar.style.cssText =\n 'display:flex;justify-content:space-between;align-items:center;' +\n 'font-size:12px;color:#666;padding:2px 4px 4px'\n bar.innerHTML =\n `<span>${escapeHtml(spec.title)}</span>` +\n '<span>' +\n `<span class=\"livecode-full\" style=\"cursor:pointer;color:#666;margin-right:12px\" ` +\n `title=\"fullscreen (${escapeHtml(spec.fullscreen)})\">⛶ full</span>` +\n `<span class=\"livecode-stop\" style=\"cursor:pointer;color:#b5511d\">■ stop</span>` +\n '</span>'\n\n const frame = document.createElement('iframe')\n frame.className = 'livecode-frame'\n frame.src = url\n frame.setAttribute('allow', 'fullscreen')\n frame.setAttribute('allowfullscreen', '')\n if (spec.transparent) frame.setAttribute('allowtransparency', 'true')\n frame.style.cssText =\n `width:100%;height:${spec.height}px;border-radius:6px;` +\n (spec.transparent\n ? 'border:0;background:transparent'\n : 'border:1px solid #e0e0e0;background:#fff')\n\n // BEHIND: render an HTML page behind a (usually transparent) stack, both\n // inside one positioned stage, so the livecode animation composites over\n // ordinary web content. Without BEHIND the frame mounts directly as before.\n let mount = frame\n if (spec.behind) {\n const stage = document.createElement('div')\n stage.className = 'livecode-stage'\n stage.style.cssText =\n `position:relative;width:100%;height:${spec.height}px;` +\n 'border-radius:6px;overflow:hidden'\n const back = document.createElement('iframe')\n back.className = 'livecode-behind'\n back.src = spec.behind\n back.setAttribute('scrolling', 'no')\n back.style.cssText =\n 'position:absolute;inset:0;width:100%;height:100%;border:0;z-index:0'\n frame.style.position = 'absolute'\n frame.style.inset = '0'\n frame.style.width = '100%'\n frame.style.height = '100%'\n frame.style.borderRadius = '0'\n frame.style.zIndex = '1'\n stage.appendChild(back)\n stage.appendChild(frame)\n mount = stage\n }\n\n // WIDTH: break the widget out of its fedwiki column so a triptych can span\n // the page. 'full' is the classic full-bleed (100vw pulled to the viewport\n // edge); a number widens to that many px. The stack sizes itself to the\n // resulting window.innerWidth.\n if (spec.width === 'full') {\n mount.style.width = '100vw'\n mount.style.maxWidth = '100vw'\n // pull the mount to the viewport's LEFT EDGE exactly. The classic\n // calc(50% - 50vw) only works when the parent is viewport-centred \u2014 inside\n // a fedwiki column it is not, so measure and pull by the real offset. The\n // zones param is in viewport coords, so iframe x MUST equal viewport x.\n requestAnimationFrame(() => {\n mount.style.marginLeft = '0px'\n const left = mount.getBoundingClientRect().left\n mount.style.marginLeft = (-left) + 'px'\n })\n widget.style.overflow = 'visible'\n } else if (typeof spec.width === 'number') {\n mount.style.width = spec.width + 'px'\n mount.style.maxWidth = 'none'\n widget.style.overflow = 'visible'\n }\n\n const tell = (command) => {\n try {\n frame.contentWindow.postMessage({ livecode: { command, mode: spec.fullscreen } }, '*')\n } catch (e) { /* frame gone */ }\n }\n\n const onMessage = (event) => {\n if (!widget.__livecode || event.source !== frame.contentWindow) return\n const d = event.data && event.data.livecode\n if (d && d.ready === 'script' && spec.script) {\n frame.contentWindow.postMessage({ livecode: { bootScript: spec.script } }, '*')\n }\n widget.dataset.lastMessage = JSON.stringify(event.data)\n if (window.$) window.$(widget).trigger('livecodeMessage', [event.data])\n }\n window.addEventListener('message', onMessage)\n\n const onFsChange = () => {\n if (!widget.__livecode) return\n if (document.fullscreenElement === frame) tell('fullscreen')\n else if (!document.fullscreenElement) tell('fullscreenExit')\n }\n document.addEventListener('fullscreenchange', onFsChange)\n\n // watchdog: fedwiki never tells a plugin its item left the lineup\n const watch = setInterval(() => {\n if (!document.body.contains(widget)) stopWidget(widget)\n }, 4000)\n\n poster.style.display = 'none'\n widget.appendChild(bar)\n widget.appendChild(mount)\n bar.querySelector('.livecode-stop').addEventListener('click', () => stopWidget(widget))\n bar.querySelector('.livecode-full').addEventListener('click', () => {\n if (frame.requestFullscreen) frame.requestFullscreen()\n })\n widget.__livecode = { poster, frame, mount, bar, watch, onMessage, onFsChange }\n}\n\n// ---- fedwiki plugin surface -------------------------------------------\n\nexport const emit = (div, item) => {\n const spec = parse(item.text || '')\n if (!spec.stack) {\n div.html(\n '<div class=\"livecode-widget\" style=\"border:1px dashed #ccc;border-radius:6px;' +\n 'padding:12px;color:#888;font-size:13px\">livecode — no STACK given. ' +\n 'Double click to edit, e.g.<br><code>STACK https://wasm.livecode.wiki/assets/wasm/shared/stack.html?zip=hexagon.zip</code></div>')\n return\n }\n div.html(\n '<div class=\"livecode-widget\">' +\n '<div class=\"livecode-poster\" style=\"cursor:pointer;border:1px solid #e0d5c5;' +\n 'border-radius:6px;padding:14px 16px;background:linear-gradient(135deg,#fff7ee,#ffffff)\">' +\n `<div style=\"font-weight:bold;font-size:15px\">▶ ${escapeHtml(spec.title)}</div>` +\n `<div style=\"font-size:12px;color:#888;margin-top:4px\">Livecode wasm — ` +\n `${spec.script ? \"runs this item's script with\" : 'loads'} the ${ENGINE_MB} MB engine</div>` +\n '</div></div>')\n}\n\nexport const bind = (div, item) => {\n div.on('dblclick', () => window.wiki.textEditor(div, item))\n const spec = parse(item.text || '')\n const widget = div.find('.livecode-widget')[0]\n const poster = div.find('.livecode-poster')[0]\n if (!spec.stack || !widget || !poster) return\n if (spec.behind) spec.behind = resolveUrl(div, spec.behind)\n const url = resolveUrl(div, spec.stack)\n const start = (event) => {\n if (event) event.stopPropagation()\n boot(widget, poster, spec, url)\n }\n poster.addEventListener('click', start)\n if (spec.boot === 'auto') start()\n}\n\nif (typeof window !== 'undefined') {\n window.plugins = window.plugins || {}\n window.plugins['livecode'] = { emit, bind }\n}\n"],
|
|
5
|
+
"mappings": "MAqCA,IAAMA,EAAe,2DAOfC,EAAkBC,GAAY,CAClC,IAAMC,EAAQ,MAAM,QAAQD,CAAO,GAAKA,EAAQ,SAAW,EAAKA,EAAU,CAAC,OAAQ,SAAU,OAAO,EAC9FE,EAAO,GAAM,OAAO,CAAC,EAAE,QAAQ,KAAM,GAAG,EAAE,QAAQ,UAAW,GAAG,EACtE,MAAO,CACL,o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", "cols", "lab", "parse", "text", "spec", "lines", "i", "sm", "m", "cmd", "restRaw", "rest", "mode", "v", "s", "leaf", "escapeHtml", "c", "resolveUrl", "div", "stack", "stopWidget", "widget", "inst", "boot", "poster", "url", "pages", "zones", "p", "r", "bar", "frame", "mount", "stage", "back", "left", "tell", "command", "onMessage", "event", "onFsChange", "watch", "emit", "item", "bind", "start"]
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wiki-plugin-livecode",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "Run a Livecode wasm stack as a lazy wiki widget — poster card, click to boot, one live widget at a time, clean teardown.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "client/livecode.js",
|
|
7
|
-
"files": [
|
|
7
|
+
"files": [
|
|
8
|
+
"client",
|
|
9
|
+
"pages",
|
|
10
|
+
"factory.json"
|
|
11
|
+
],
|
|
8
12
|
"scripts": {
|
|
9
13
|
"build": "node scripts/build.js",
|
|
10
14
|
"test": "node --test"
|
|
@@ -15,7 +19,12 @@
|
|
|
15
19
|
},
|
|
16
20
|
"author": "David Bovill",
|
|
17
21
|
"license": "MIT",
|
|
18
|
-
"repository": {
|
|
19
|
-
|
|
22
|
+
"repository": {
|
|
23
|
+
"type": "git",
|
|
24
|
+
"url": "git+https://github.com/Hitchhikers-Guide-to-the-Galaxy/wiki-plugin-livecode.git"
|
|
25
|
+
},
|
|
26
|
+
"bugs": {
|
|
27
|
+
"url": "https://github.com/Hitchhikers-Guide-to-the-Galaxy/wiki-plugin-livecode/issues"
|
|
28
|
+
},
|
|
20
29
|
"homepage": "https://github.com/Hitchhikers-Guide-to-the-Galaxy/wiki-plugin-livecode#readme"
|
|
21
30
|
}
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
{
|
|
15
15
|
"type": "markdown",
|
|
16
16
|
"id": "4b7e9d2c8f0a3615",
|
|
17
|
-
"text": "# Commands\nUPPERCASE first word, optional colon, one per line:\n\n- STACK — the standalone's shell page: absolute `https://...` or a path relative to the item's origin site\n- TITLE — the poster label; defaults to the shell file name\n- HEIGHT — iframe height in pixels; defaults to 420\n- BOOT — `auto` (default) loads and displays on render; `click` shows a collapsible poster instead\n- FULLSCREEN — `fixed` (default), `scale`, or `resize`; how the stack behaves when the full control is used — see [[Full Screen Wasm]]\n- NAME — the stack's name, needed only by `resize` mode for the JavaScript bridge call"
|
|
17
|
+
"text": "# Commands\nUPPERCASE first word, optional colon, one per line:\n\n- STACK — the standalone's shell page: absolute `https://...` or a path relative to the item's origin site\n- TITLE — the poster label; defaults to the shell file name\n- HEIGHT — iframe height in pixels; defaults to 420\n- BOOT — `auto` (default) loads and displays on render; `click` shows a collapsible poster instead\n- FULLSCREEN — `fixed` (default), `scale`, or `resize`; how the stack behaves when the full control is used — see [[Full Screen Wasm]]\n- NAME — the stack's name, needed only by `resize` mode for the JavaScript bridge call\n- TRANSPARENT — render the stack with a transparent background (opt-in `?bg=transparent` on the shell) so anything behind the widget shows through; the stack must leave its card background empty. See [[Transparent Fish]]\n- BEHIND — a full URL to an HTML page drawn behind a TRANSPARENT stack, inside the same widget, so the animation composites over ordinary web content"
|
|
18
18
|
},
|
|
19
19
|
{
|
|
20
20
|
"type": "markdown",
|