@webqit/subscript
Advanced tools
Comparing version 2.1.37 to 2.1.38
@@ -192,5 +192,5 @@ (()=>{function J(v,e=!1){let t=v.split(/\n/g);if(t.length>1){for(;!t[0].trim().length;)t.shift();let i=t[e?1:0].split(/[^\s]/)[0].length;if(i)return t.map((n,r)=>{let s=n.substring(0,i);return s.trim().length?s.trim()==="}"&&r===t.length-1?"}":n:n.substring(i)}).join(` | ||
${b} | ||
}`,m.graph.originalSourceModified=!0}return e&&Object.defineProperty(m.callee,"name",{configurable:!0,value:e}),m},h=this.prototype.createFunction(o,r);return q(h,"locations",$(t,m=>({locations:m.locations}))),h}};function ee(...v){if(typeof window!="object")throw new Error("No window in context.");let e=ce(typeof v[v.length-1]=="object"?v.pop():{}),t=J(v.pop()||""),i=v,n=r=>V.createFunction(void 0,r,i,e.runtimeParams,this,t);if(window.wq?.SubscriptCompiler&&!e.runtimeParams.async){let{parse:r,compile:s}=window.wq.SubscriptCompiler,o=r(t,e.parserParams);return n(s(o,e.compilerParams))}if(!window.wq?.SubscriptCompilerWorker){let o=` | ||
}`,m.graph.originalSourceModified=!0}return e&&Object.defineProperty(m.callee,"name",{configurable:!0,value:e}),m},h=this.prototype.createFunction(o,r);return q(h,"locations",$(t,m=>({locations:m.locations}))),h}};function ee(...v){if(typeof window!="object")throw new Error("No window in context.");let e=ce(typeof v[v.length-1]=="object"?v.pop():{}),t=J(v.pop()||""),i=v,n=r=>V.createFunction(void 0,r,i,e.runtimeParams,this,t);if(window.webqit?.SubscriptCompiler&&!e.runtimeParams.async){let{parse:r,compile:s}=window.webqit.SubscriptCompiler,o=r(t,e.parserParams);return n(s(o,e.compilerParams))}if(!window.webqit?.SubscriptCompilerWorker){let o=` | ||
importScripts( '${document.querySelector('meta[name="subscript-compiler-url"]')?.content||"https://unpkg.com/@webqit/subscript/dist/compiler.js"}' ); | ||
const { parse, compile } = self.wq.SubscriptCompiler; | ||
const { parse, compile } = self.webqit.SubscriptCompiler; | ||
self.onmessage = e => { | ||
@@ -202,3 +202,3 @@ const { source, params } = e.data; | ||
e.ports[ 0 ]?.postMessage( compilation ); | ||
};`;window.wq=window.wq||{},window.wq.SubscriptCompilerWorker=new Worker(`data:text/javascript;base64,${btoa(o)}`)}return n(new Promise(r=>{let s=new MessageChannel;wq.SubscriptCompilerWorker.postMessage({source:t,params:e},[s.port2]),s.port1.onmessage=o=>r(o.data)}))}Object.defineProperty(ee,"inspect",{value:q});var te=class extends R(HTMLElement){connectedCallback(){this.autoMode=this.getAttribute("auto-mode"),this.visualizerElement=document.createElement("cfunctions-visualizer"),this.controlsElement=document.createElement("div"),this.controlsElement.classList.add("controls-element"),this.buttons={},["edit","play"].forEach(e=>{let t=e.substring(0,1).toUpperCase()+e.substring(1);this.buttons[e]=this.controlsElement.appendChild(document.createElement("button")),this.buttons[e].classList.add(e),this.buttons[e].setAttribute("title",t);let i=this.buttons[e].appendChild(document.createElement("i"));(this.getAttribute(`data-${e}-icon`)||`bi bi-${e==="edit"?"pencil":e}`).split(" ").map(s=>s.trim()).forEach(s=>i.classList.add(s)),this.buttons[e].appendChild(document.createElement("span")).append(" ",t),this.buttons[e].addEventListener("click",s=>{this.active&&this.active.classList.remove("active"),this.active=this.buttons[e],this.active.classList.add("active")})}),this.buttons.edit.addEventListener("click",e=>this.switchEditable(!0)),this.buttons.play.addEventListener("click",e=>this.switchEditable(!1)),this.shadowRoot.append(this.controlsElement,this.visualizerElement),super.connectedCallback(),setTimeout(()=>{this.visualizerElement.innerHTML=this.innerHTML,setTimeout(()=>{this.loadConsole(),this.autoMode&&this.buttons[this.autoMode].dispatchEvent(new MouseEvent("click"))},0)},0)}loadConsole(){this.fn=ee(this.visualizerElement.source,{devMode:!0}),this.visualizerElement.visualize(this.fn,!1)}switchEditable(e){this.visualizerElement.editable=e,e?this.fn&&(this.fn.dispose(),this.fn=null):(this.fn||this.loadConsole(),this.fn())}get css(){return["https://cdn.jsdelivr.net/npm/bootstrap-icons@1.5.0/font/bootstrap-icons.css",` | ||
};`;window.webqit=window.webqit||{},window.webqit.SubscriptCompilerWorker=new Worker(`data:text/javascript;base64,${btoa(o)}`)}return n(new Promise(r=>{let s=new MessageChannel;webqit.SubscriptCompilerWorker.postMessage({source:t,params:e},[s.port2]),s.port1.onmessage=o=>r(o.data)}))}Object.defineProperty(ee,"inspect",{value:q});var te=class extends R(HTMLElement){connectedCallback(){this.autoMode=this.getAttribute("auto-mode"),this.visualizerElement=document.createElement("cfunctions-visualizer"),this.controlsElement=document.createElement("div"),this.controlsElement.classList.add("controls-element"),this.buttons={},["edit","play"].forEach(e=>{let t=e.substring(0,1).toUpperCase()+e.substring(1);this.buttons[e]=this.controlsElement.appendChild(document.createElement("button")),this.buttons[e].classList.add(e),this.buttons[e].setAttribute("title",t);let i=this.buttons[e].appendChild(document.createElement("i"));(this.getAttribute(`data-${e}-icon`)||`bi bi-${e==="edit"?"pencil":e}`).split(" ").map(s=>s.trim()).forEach(s=>i.classList.add(s)),this.buttons[e].appendChild(document.createElement("span")).append(" ",t),this.buttons[e].addEventListener("click",s=>{this.active&&this.active.classList.remove("active"),this.active=this.buttons[e],this.active.classList.add("active")})}),this.buttons.edit.addEventListener("click",e=>this.switchEditable(!0)),this.buttons.play.addEventListener("click",e=>this.switchEditable(!1)),this.shadowRoot.append(this.controlsElement,this.visualizerElement),super.connectedCallback(),setTimeout(()=>{this.visualizerElement.innerHTML=this.innerHTML,setTimeout(()=>{this.loadConsole(),this.autoMode&&this.buttons[this.autoMode].dispatchEvent(new MouseEvent("click"))},0)},0)}loadConsole(){this.fn=ee(this.visualizerElement.source,{devMode:!0}),this.visualizerElement.visualize(this.fn,!1)}switchEditable(e){this.visualizerElement.editable=e,e?this.fn&&(this.fn.dispose(),this.fn=null):(this.fn||this.loadConsole(),this.fn())}get css(){return["https://cdn.jsdelivr.net/npm/bootstrap-icons@1.5.0/font/bootstrap-icons.css",` | ||
* { | ||
@@ -205,0 +205,0 @@ -webkit-box-sizing: border-box; |
@@ -5,5 +5,5 @@ (()=>{function v(...f){let t={runtimeParams:A,compilerParams:I,parserParams:E},e;for(;e=f.shift();){let{runtimeParams:r={},compilerParams:{globalsNoObserve:i=[],globalsOnlyPathsExcept:n=[],...s}={},parserParams:o={}}=e;t={runtimeParams:{...t.runtimeParams,...r},compilerParams:{...t.compilerParams,globalsNoObserve:[...t.compilerParams.globalsNoObserve,...i],globalsOnlyPathsExcept:[...t.compilerParams.globalsOnlyPathsExcept,...n],...s},parserParams:{...t.parserParams,...o}},f.devMode}return t}var E={ecmaVersion:"2020",allowReturnOutsideFunction:!0,allowAwaitOutsideFunction:!0,allowSuperOutsideMethod:!0,preserveParens:!1,locations:!1},I={globalsNoObserve:["globalThis","arguments","console","debugger"],globalsOnlyPathsExcept:[],originalSource:!0,locations:!0,compact:2},A={apiVersion:1};function O(f,t=!1){let e=f.split(/\n/g);if(e.length>1){for(;!e[0].trim().length;)e.shift();let r=e[t?1:0].split(/[^\s]/)[0].length;if(r)return e.map((i,n)=>{let s=i.substring(0,r);return s.trim().length?s.trim()==="}"&&n===e.length-1?"}":i:i.substring(r)}).join(` | ||
${c} | ||
}`,h.graph.originalSourceModified=!0}return t&&Object.defineProperty(h.callee,"name",{configurable:!0,value:t}),h},u=this.prototype.createFunction(o,n);return x(u,"locations",g(e,h=>({locations:h.locations}))),u}};function P(...f){if(typeof window!="object")throw new Error("No window in context.");let t=v(typeof f[f.length-1]=="object"?f.pop():{}),e=O(f.pop()||""),r=f,i=n=>F.createFunction(void 0,n,r,t.runtimeParams,this,e);if(window.wq?.SubscriptCompiler&&!t.runtimeParams.async){let{parse:n,compile:s}=window.wq.SubscriptCompiler,o=n(e,t.parserParams);return i(s(o,t.compilerParams))}if(!window.wq?.SubscriptCompilerWorker){let o=` | ||
}`,h.graph.originalSourceModified=!0}return t&&Object.defineProperty(h.callee,"name",{configurable:!0,value:t}),h},u=this.prototype.createFunction(o,n);return x(u,"locations",g(e,h=>({locations:h.locations}))),u}};function P(...f){if(typeof window!="object")throw new Error("No window in context.");let t=v(typeof f[f.length-1]=="object"?f.pop():{}),e=O(f.pop()||""),r=f,i=n=>F.createFunction(void 0,n,r,t.runtimeParams,this,e);if(window.webqit?.SubscriptCompiler&&!t.runtimeParams.async){let{parse:n,compile:s}=window.webqit.SubscriptCompiler,o=n(e,t.parserParams);return i(s(o,t.compilerParams))}if(!window.webqit?.SubscriptCompilerWorker){let o=` | ||
importScripts( '${document.querySelector('meta[name="subscript-compiler-url"]')?.content||"https://unpkg.com/@webqit/subscript/dist/compiler.js"}' ); | ||
const { parse, compile } = self.wq.SubscriptCompiler; | ||
const { parse, compile } = self.webqit.SubscriptCompiler; | ||
self.onmessage = e => { | ||
@@ -15,3 +15,3 @@ const { source, params } = e.data; | ||
e.ports[ 0 ]?.postMessage( compilation ); | ||
};`;window.wq=window.wq||{},window.wq.SubscriptCompilerWorker=new Worker(`data:text/javascript;base64,${btoa(o)}`)}return i(new Promise(n=>{let s=new MessageChannel;wq.SubscriptCompilerWorker.postMessage({source:e,params:t},[s.port2]),s.port1.onmessage=o=>n(o.data)}))}Object.defineProperty(P,"inspect",{value:x});self.wq||(self.wq={});self.wq.SubscriptFunction=P;})(); | ||
};`;window.webqit=window.webqit||{},window.webqit.SubscriptCompilerWorker=new Worker(`data:text/javascript;base64,${btoa(o)}`)}return i(new Promise(n=>{let s=new MessageChannel;webqit.SubscriptCompilerWorker.postMessage({source:e,params:t},[s.port2]),s.port1.onmessage=o=>n(o.data)}))}Object.defineProperty(P,"inspect",{value:x});self.webqit||(self.webqit={});self.webqit.SubscriptFunction=P;})(); | ||
//# sourceMappingURL=lite.js.map |
@@ -5,5 +5,5 @@ (()=>{function $(...p){let e={runtimeParams:k,compilerParams:I,parserParams:A},t;for(;t=p.shift();){let{runtimeParams:i={},compilerParams:{globalsNoObserve:s=[],globalsOnlyPathsExcept:r=[],...n}={},parserParams:o={}}=t;e={runtimeParams:{...e.runtimeParams,...i},compilerParams:{...e.compilerParams,globalsNoObserve:[...e.compilerParams.globalsNoObserve,...s],globalsOnlyPathsExcept:[...e.compilerParams.globalsOnlyPathsExcept,...r],...n},parserParams:{...e.parserParams,...o}},p.devMode}return e}var A={ecmaVersion:"2020",allowReturnOutsideFunction:!0,allowAwaitOutsideFunction:!0,allowSuperOutsideMethod:!0,preserveParens:!1,locations:!1},I={globalsNoObserve:["globalThis","arguments","console","debugger"],globalsOnlyPathsExcept:[],originalSource:!0,locations:!0,compact:2},k={apiVersion:1};function O(p,e=!1){let t=p.split(/\n/g);if(t.length>1){for(;!t[0].trim().length;)t.shift();let i=t[e?1:0].split(/[^\s]/)[0].length;if(i)return t.map((s,r)=>{let n=s.substring(0,i);return n.trim().length?n.trim()==="}"&&r===t.length-1?"}":s:s.substring(i)}).join(` | ||
${c} | ||
}`,h.graph.originalSourceModified=!0}return e&&Object.defineProperty(h.callee,"name",{configurable:!0,value:e}),h},u=this.prototype.createFunction(o,r);return C(u,"locations",m(t,h=>({locations:h.locations}))),u}};function S(...p){if(typeof window!="object")throw new Error("No window in context.");let e=$(typeof p[p.length-1]=="object"?p.pop():{}),t=O(p.pop()||""),i=p,s=r=>E.createFunction(void 0,r,i,e.runtimeParams,this,t);if(window.wq?.SubscriptCompiler&&!e.runtimeParams.async){let{parse:r,compile:n}=window.wq.SubscriptCompiler,o=r(t,e.parserParams);return s(n(o,e.compilerParams))}if(!window.wq?.SubscriptCompilerWorker){let o=` | ||
}`,h.graph.originalSourceModified=!0}return e&&Object.defineProperty(h.callee,"name",{configurable:!0,value:e}),h},u=this.prototype.createFunction(o,r);return C(u,"locations",m(t,h=>({locations:h.locations}))),u}};function S(...p){if(typeof window!="object")throw new Error("No window in context.");let e=$(typeof p[p.length-1]=="object"?p.pop():{}),t=O(p.pop()||""),i=p,s=r=>E.createFunction(void 0,r,i,e.runtimeParams,this,t);if(window.webqit?.SubscriptCompiler&&!e.runtimeParams.async){let{parse:r,compile:n}=window.webqit.SubscriptCompiler,o=r(t,e.parserParams);return s(n(o,e.compilerParams))}if(!window.webqit?.SubscriptCompilerWorker){let o=` | ||
importScripts( '${document.querySelector('meta[name="subscript-compiler-url"]')?.content||"https://unpkg.com/@webqit/subscript/dist/compiler.js"}' ); | ||
const { parse, compile } = self.wq.SubscriptCompiler; | ||
const { parse, compile } = self.webqit.SubscriptCompiler; | ||
self.onmessage = e => { | ||
@@ -15,3 +15,3 @@ const { source, params } = e.data; | ||
e.ports[ 0 ]?.postMessage( compilation ); | ||
};`;window.wq=window.wq||{},window.wq.SubscriptCompilerWorker=new Worker(`data:text/javascript;base64,${btoa(o)}`)}return s(new Promise(r=>{let n=new MessageChannel;wq.SubscriptCompilerWorker.postMessage({source:t,params:e},[n.port2]),n.port1.onmessage=o=>r(o.data)}))}Object.defineProperty(S,"inspect",{value:C});var j=p=>class extends p{constructor(){super(),this.attachShadow({mode:"open"})}connectedCallback(){[].concat(this.css).forEach(t=>{if(t.includes("{")&&t.includes(":")&&t.includes(";")){let i=this.shadowRoot.appendChild(document.createElement("style"));i.textContent=t}else{let i=this.shadowRoot.appendChild(document.createElement("link"));i.setAttribute("rel","stylesheet"),i.setAttribute("href",t)}})}get css(){return[]}};var F=class extends j(HTMLElement){connectedCallback(){this.autoMode=this.getAttribute("auto-mode"),this.visualizerElement=document.createElement("cfunctions-visualizer"),this.controlsElement=document.createElement("div"),this.controlsElement.classList.add("controls-element"),this.buttons={},["edit","play"].forEach(e=>{let t=e.substring(0,1).toUpperCase()+e.substring(1);this.buttons[e]=this.controlsElement.appendChild(document.createElement("button")),this.buttons[e].classList.add(e),this.buttons[e].setAttribute("title",t);let i=this.buttons[e].appendChild(document.createElement("i"));(this.getAttribute(`data-${e}-icon`)||`bi bi-${e==="edit"?"pencil":e}`).split(" ").map(n=>n.trim()).forEach(n=>i.classList.add(n)),this.buttons[e].appendChild(document.createElement("span")).append(" ",t),this.buttons[e].addEventListener("click",n=>{this.active&&this.active.classList.remove("active"),this.active=this.buttons[e],this.active.classList.add("active")})}),this.buttons.edit.addEventListener("click",e=>this.switchEditable(!0)),this.buttons.play.addEventListener("click",e=>this.switchEditable(!1)),this.shadowRoot.append(this.controlsElement,this.visualizerElement),super.connectedCallback(),setTimeout(()=>{this.visualizerElement.innerHTML=this.innerHTML,setTimeout(()=>{this.loadConsole(),this.autoMode&&this.buttons[this.autoMode].dispatchEvent(new MouseEvent("click"))},0)},0)}loadConsole(){this.fn=S(this.visualizerElement.source,{devMode:!0}),this.visualizerElement.visualize(this.fn,!1)}switchEditable(e){this.visualizerElement.editable=e,e?this.fn&&(this.fn.dispose(),this.fn=null):(this.fn||this.loadConsole(),this.fn())}get css(){return["https://cdn.jsdelivr.net/npm/bootstrap-icons@1.5.0/font/bootstrap-icons.css",` | ||
};`;window.webqit=window.webqit||{},window.webqit.SubscriptCompilerWorker=new Worker(`data:text/javascript;base64,${btoa(o)}`)}return s(new Promise(r=>{let n=new MessageChannel;webqit.SubscriptCompilerWorker.postMessage({source:t,params:e},[n.port2]),n.port1.onmessage=o=>r(o.data)}))}Object.defineProperty(S,"inspect",{value:C});var j=p=>class extends p{constructor(){super(),this.attachShadow({mode:"open"})}connectedCallback(){[].concat(this.css).forEach(t=>{if(t.includes("{")&&t.includes(":")&&t.includes(";")){let i=this.shadowRoot.appendChild(document.createElement("style"));i.textContent=t}else{let i=this.shadowRoot.appendChild(document.createElement("link"));i.setAttribute("rel","stylesheet"),i.setAttribute("href",t)}})}get css(){return[]}};var F=class extends j(HTMLElement){connectedCallback(){this.autoMode=this.getAttribute("auto-mode"),this.visualizerElement=document.createElement("cfunctions-visualizer"),this.controlsElement=document.createElement("div"),this.controlsElement.classList.add("controls-element"),this.buttons={},["edit","play"].forEach(e=>{let t=e.substring(0,1).toUpperCase()+e.substring(1);this.buttons[e]=this.controlsElement.appendChild(document.createElement("button")),this.buttons[e].classList.add(e),this.buttons[e].setAttribute("title",t);let i=this.buttons[e].appendChild(document.createElement("i"));(this.getAttribute(`data-${e}-icon`)||`bi bi-${e==="edit"?"pencil":e}`).split(" ").map(n=>n.trim()).forEach(n=>i.classList.add(n)),this.buttons[e].appendChild(document.createElement("span")).append(" ",t),this.buttons[e].addEventListener("click",n=>{this.active&&this.active.classList.remove("active"),this.active=this.buttons[e],this.active.classList.add("active")})}),this.buttons.edit.addEventListener("click",e=>this.switchEditable(!0)),this.buttons.play.addEventListener("click",e=>this.switchEditable(!1)),this.shadowRoot.append(this.controlsElement,this.visualizerElement),super.connectedCallback(),setTimeout(()=>{this.visualizerElement.innerHTML=this.innerHTML,setTimeout(()=>{this.loadConsole(),this.autoMode&&this.buttons[this.autoMode].dispatchEvent(new MouseEvent("click"))},0)},0)}loadConsole(){this.fn=S(this.visualizerElement.source,{devMode:!0}),this.visualizerElement.visualize(this.fn,!1)}switchEditable(e){this.visualizerElement.editable=e,e?this.fn&&(this.fn.dispose(),this.fn=null):(this.fn||this.loadConsole(),this.fn())}get css(){return["https://cdn.jsdelivr.net/npm/bootstrap-icons@1.5.0/font/bootstrap-icons.css",` | ||
* { | ||
@@ -18,0 +18,0 @@ -webkit-box-sizing: border-box; |
@@ -11,3 +11,3 @@ { | ||
"homepage": "https://webqit.io/tooling/subscript", | ||
"version": "2.1.37", | ||
"version": "2.1.38", | ||
"license": "MIT", | ||
@@ -14,0 +14,0 @@ "repository": { |
@@ -22,4 +22,4 @@ | ||
// SubscriptCompiler has been loaded sync? | ||
if ( window.wq?.SubscriptCompiler && !params.runtimeParams.async ) { | ||
const { parse, compile } = window.wq.SubscriptCompiler; | ||
if ( window.webqit?.SubscriptCompiler && !params.runtimeParams.async ) { | ||
const { parse, compile } = window.webqit.SubscriptCompiler; | ||
const ast = parse( source, params.parserParams ); | ||
@@ -29,3 +29,3 @@ return createFunction( compile( ast, params.compilerParams ) ); | ||
// Load and run SubscriptCompiler async - in the background? | ||
if ( !window.wq?.SubscriptCompilerWorker ) { | ||
if ( !window.webqit?.SubscriptCompilerWorker ) { | ||
const customUrl = document.querySelector( 'meta[name="subscript-compiler-url"]' ); | ||
@@ -35,3 +35,3 @@ const compilerUrl = customUrl?.content || `https://unpkg.com/@webqit/subscript/dist/compiler.js`; | ||
importScripts( '${ compilerUrl }' ); | ||
const { parse, compile } = self.wq.SubscriptCompiler; | ||
const { parse, compile } = self.webqit.SubscriptCompiler; | ||
self.onmessage = e => { | ||
@@ -44,8 +44,8 @@ const { source, params } = e.data; | ||
};`; | ||
window.wq = window.wq || {}; | ||
window.wq.SubscriptCompilerWorker = new Worker( `data:text/javascript;base64,${ btoa( workerScriptText ) }` ); | ||
window.webqit = window.webqit || {}; | ||
window.webqit.SubscriptCompilerWorker = new Worker( `data:text/javascript;base64,${ btoa( workerScriptText ) }` ); | ||
} | ||
return createFunction( new Promise( res => { | ||
let messageChannel = new MessageChannel; | ||
wq.SubscriptCompilerWorker.postMessage( { source, params }, [ messageChannel.port2 ] ); | ||
webqit.SubscriptCompilerWorker.postMessage( { source, params }, [ messageChannel.port2 ] ); | ||
messageChannel.port1.onmessage = e => res( e.data ); | ||
@@ -52,0 +52,0 @@ } ) ); |
@@ -8,3 +8,3 @@ | ||
// As globals | ||
if ( !self.wq ) { self.wq = {}; } | ||
self.wq.SubscriptCompiler = { parse, compile, serialize }; | ||
if ( !self.webqit ) { self.webqit = {}; } | ||
self.webqit.SubscriptCompiler = { parse, compile, serialize }; |
@@ -8,3 +8,3 @@ | ||
// As globals | ||
if ( !self.wq ) { self.wq = {}; } | ||
self.wq.SubscriptFunction = SubscriptFunction; | ||
if ( !self.webqit ) { self.webqit = {}; } | ||
self.webqit.SubscriptFunction = SubscriptFunction; |
@@ -8,3 +8,3 @@ | ||
// As globals | ||
if ( !self.wq ) { self.wq = {}; } | ||
self.wq.SubscriptFunction = SubscriptFunctionLite; | ||
if ( !self.webqit ) { self.webqit = {}; } | ||
self.webqit.SubscriptFunction = SubscriptFunctionLite; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
3174461
7909