hyperscript.org
Advanced tools
Comparing version 0.8.4-beta.0 to 0.8.4-beta.1
@@ -1,2 +0,2 @@ | ||
window._hyperscript.addFeature("eventsource",function(e,n,t){if(t.matchToken("eventsource")){var r,o=!1,u=e.requireElement("dotOrColonPath",t).evaluate().split("."),i=u.pop();t.matchToken("from")&&(r=e.requireElement("stringLike",t)),t.matchToken("with")&&t.matchToken("credentials")&&(o=!0);for(var c={eventSource:null,listeners:[],retryCount:0,open:function(e){if(null==e){if(null==c.eventSource||null==c.eventSource.url)throw"no url defined for EventSource.";e=c.eventSource.url}if(null!=c.eventSource)if(e!=c.eventSource.url)c.eventSource.close();else if(c.eventSource.readyState!=EventSource.CLOSED)return;c.eventSource=new EventSource(e,{withCredentials:o}),c.eventSource.addEventListener("open",function(e){c.retryCount=0}),c.eventSource.addEventListener("error",function(e){if(c.eventSource.readyState==EventSource.CLOSED){c.retryCount=Math.min(7,c.retryCount+1);var n=Math.random()*(2^c.retryCount)*500;window.setTimeout(c.open,n)}});for(var n=0;n<c.listeners.length;n++){var t=c.listeners[n];c.eventSource.addEventListener(t.type,t.handler,t.options)}},close:function(){null!=c.eventSource&&c.eventSource.close(),c.retryCount=0},addEventListener:function(e,n,t){c.listeners.push({type:e,handler:n,options:t}),null!=c.eventSource&&c.eventSource.addEventListener(e,n,t)}},a={name:i,object:c,install:function(e){n.assignToNamespace(e,u,i,c)}};t.matchToken("on");){var l=e.requireElement("stringLike",t,"Expected event name").evaluate(),s="";t.matchToken("as")&&(s=e.requireElement("stringLike",t,"Expected encoding type").evaluate());var v=e.requireElement("commandList",t);f(v),t.requireToken("end"),c.listeners.push({type:l,handler:d(s,v)})}return t.requireToken("end"),null!=r&&c.open(r.evaluate()),a;function d(e,t){return function(r){var o=function(e,n){return"json"==n?JSON.parse(e):e}(r.data,e),u=n.makeContext(c,a,c);u.event=r,u.result=o,t.execute(u)}}function f(e){if(e.next)return f(e.next);e.next={type:"implicitReturn",op:function(e){return n.HALT},execute:function(e){}}}}}); | ||
var e=e=>{e.addFeature("eventsource",function(e,n,t){if(t.matchToken("eventsource")){var r,o=!1,u=e.requireElement("dotOrColonPath",t).evaluate().split("."),i=u.pop();t.matchToken("from")&&(r=e.requireElement("stringLike",t)),t.matchToken("with")&&t.matchToken("credentials")&&(o=!0);for(var a={eventSource:null,listeners:[],retryCount:0,open:function(e){if(null==e){if(null==a.eventSource||null==a.eventSource.url)throw"no url defined for EventSource.";e=a.eventSource.url}if(null!=a.eventSource)if(e!=a.eventSource.url)a.eventSource.close();else if(a.eventSource.readyState!=EventSource.CLOSED)return;a.eventSource=new EventSource(e,{withCredentials:o}),a.eventSource.addEventListener("open",function(e){a.retryCount=0}),a.eventSource.addEventListener("error",function(e){if(a.eventSource.readyState==EventSource.CLOSED){a.retryCount=Math.min(7,a.retryCount+1);var n=Math.random()*(2^a.retryCount)*500;window.setTimeout(a.open,n)}});for(var n=0;n<a.listeners.length;n++){var t=a.listeners[n];a.eventSource.addEventListener(t.type,t.handler,t.options)}},close:function(){null!=a.eventSource&&a.eventSource.close(),a.retryCount=0},addEventListener:function(e,n,t){a.listeners.push({type:e,handler:n,options:t}),null!=a.eventSource&&a.eventSource.addEventListener(e,n,t)}},c={name:i,object:a,install:function(e){n.assignToNamespace(e,u,i,a)}};t.matchToken("on");){var l=e.requireElement("stringLike",t,"Expected event name").evaluate(),v="";t.matchToken("as")&&(v=e.requireElement("stringLike",t,"Expected encoding type").evaluate());var s=e.requireElement("commandList",t);f(s),t.requireToken("end"),a.listeners.push({type:l,handler:d(v,s)})}return t.requireToken("end"),null!=r&&a.open(r.evaluate()),c;function d(e,t){return function(r){var o=function(e,n){return"json"==n?JSON.parse(e):e}(r.data,e),u=n.makeContext(a,c,a);u.event=r,u.result=o,t.execute(u)}}function f(e){if(e.next)return f(e.next);e.next={type:"implicitReturn",op:function(e){return n.HALT},execute:function(e){}}}}})};export{e as default}; | ||
//# sourceMappingURL=eventsource.modern.js.map |
@@ -1,2 +0,2 @@ | ||
(t=>{function n(n,e,o){this.ctx=n,this.runtime=e,this.cmd=o,this._hyperscript=t,this.bus=new EventTarget}t.addCommand("breakpoint",function(t,e,o){var i;if(o.matchToken("breakpoint"))return{op:function(t){globalThis.hdb=i=new n(t,e,this);try{return i.break(t)}catch(t){console.error(t,t.stack)}}}}),n.prototype.break=function(t){return console.log("=== HDB///_hyperscript/debugger ==="),this.ui(),new Promise((n,e)=>{this.bus.addEventListener("continue",()=>{if(this.ctx!==t){for(var e in t)delete t[e];Object.assign(t,this.ctx)}delete window.hdb,n(this.runtime.findNext(this.cmd,this.ctx))},{once:!0})})},n.prototype.continueExec=function(){this.bus.dispatchEvent(new Event("continue"))},n.prototype.stepOver=function(){if(!this.cmd)return this.continueExec();var t=this.cmd&&"breakpointCommand"===this.cmd.type?this.runtime.findNext(this.cmd,this.ctx):this.runtime.unifiedEval(this.cmd,this.ctx);return"implicitReturn"===t.type?this.stepOut():t&&t.then instanceof Function?t.then(t=>{this.cmd=t,this.bus.dispatchEvent(new Event("step")),this.logCommand()}):void(t.halt_flag?this.bus.dispatchEvent(new Event("continue")):(this.cmd=t,this.bus.dispatchEvent(new Event("step")),this.logCommand()))},n.prototype.stepOut=function(){if(!this.ctx.meta.caller)return this.continueExec();var t=this.ctx.meta.callingCommand,n=this.ctx.me;this.ctx=this.ctx.meta.caller,console.log("[hdb] stepping out into "+this.ctx.meta.feature.displayName),this.ctx.me instanceof Element&&this.ctx.me!==n&&console.log("[hdb] me: ",this.ctx.me),this.cmd=this.runtime.findNext(t,this.ctx),this.cmd=this.runtime.findNext(this.cmd,this.ctx),this.logCommand(),this.bus.dispatchEvent(new Event("step"))},n.prototype.skipTo=function(t){this.cmd=t,this.bus.dispatchEvent(new Event("skip"))},n.prototype.rewrite=function(n,e){const o=n.parent;let i=o.start;for(;i.next!==n;)i=i.next;const s=n.next,r=t.internals.lexer.tokenize(e),a=t.internals.parser.requireElement("command",r);console.log(a),a.startToken=n.startToken,a.endToken=n.endToken,a.programSource=n.programSource,a.sourceFor=function(){return e},i.next=a,a.next=s,a.parent=o,this.bus.dispatchEvent(new Event("step"))},n.prototype.logCommand=function(){var t=this.cmd.sourceFor instanceof Function?this.cmd.sourceFor():"-- "+this.cmd.type;console.log("[hdb] current command: "+t)},n.prototype.ui=function(){var n=document.createElement("div"),e=n.attachShadow({mode:"open"});n.style.cssText="all: initial",e.innerHTML='\n<div class="hdb" _="\n\ton load trigger update \n\ton step from hdb.bus trigger update\n\ton skip from hdb.bus trigger update\n\ton continue from hdb.bus log \'done\' then remove me.getRootNode().host">\n\n\t<script type="text/hyperscript">\n\n\tdef escapeHTML(unsafe)\n\t\tjs(unsafe) return unsafe\n\t\t\t.replace(/&/g, "&")\n\t\t\t.replace(/</g, "<")\n\t\t\t.replace(/>/g, ">")\n\t\t\t.replace(/\\x22/g, """)\n\t\t\t.replace(/\\x27/g, "'") end\n\t\treturn it\n\tend\n\n\tdef highlightDebugCode\n\t\tset rv to []\n\t\tset hdb.uiCommandMap to []\n\t\tset cmd to hdb.cmd.parent.start\n\t\tappend escapeHTML(hdb.cmd.programSource.substring(0, cmd.startToken.start)) to rv\n\t\trepeat until cmd.halt_flag or cmd.type is \'implicitReturn\'\n\t\t\tpush(cmd) on hdb.uiCommandMap\n\t\t\tset cmdNo to hdb.uiCommandMap\'s length-1\n\t\t\tif global HYPERSCRIPT_HDB_EXPERIMENTAL\n\t\t\t\tappend `<button class="skip" data-cmd="${cmdNo}">skip</button>` to rv\n\t\t\t\tappend `<button class="rewrite" data-cmd="${cmdNo}">rewrite</button>` to rv\n\t\t\tend\n\t\t\tset src to escapeHTML(cmd.sourceFor())\n\t\t\tif cmd is hdb.cmd\n\t\t\t\tappend \'<u class="current"><span data-cmd="\' + cmdNo + \'">\' + src + \'</span></u>\' to rv\n\t\t\telse\n\t\t\t\tappend \'<span data-cmd="\' + cmdNo + \'">\' + src + \'</span>\' to rv\n\t\t\tend\n\t\t\tappend escapeHTML(hdb.cmd.programSource.substring(cmd.endToken.end, cmd.next.startToken.start)) to rv\n\t\t\tset cmd to cmd.next\n\t\tend\n\t\treturn rv.join(\'\')\n\t\t-- set start to hdb.cmd.startToken.start\n\tend\n\n\tdef truncate(str, len)\n\t\tif str.length <= len return str end\n\t\treturn str.substr(0, len) + \'…\'\n\n\tdef prettyPrint(obj)\n\t\tif obj is null return \'null\' end\n\t\tif Element.prototype.isPrototypeOf(obj)\n\t\t\tset rv to \'<<span class="token tagname">\' +\n\t\t\t\tobj.tagName.toLowerCase() + "</span>"\n\t\t\tfor attr in Array.from(obj.attributes)\n\t\t\t\tif attr.specified\n\t\t\t\t\tset rv to rv +\n\t\t\t\t\t\t\' <span class="token attr">\' + attr.nodeName +\n\t\t\t\t\t\t\'</span>=<span class="token string">"\' + truncate(attr.textContent, 10) +\n\t\t\t\t\t\t\'"</span>\'\n\t\t\t\tend\n\t\t\tend\n\t\t\tset rv to rv + \'>\'\n\t\t\treturn rv\n\t\telse if obj.call\n\t\t\tif obj.hyperfunc\n\t\t\t\tget "def " + obj.hypername + \' ...\'\n\t\t\telse\n\t\t\t\tget "function "+obj.name+"(...) {...}"\n\t\t\tend\n\t\telse if obj.toString\n\t\t\tcall obj.toString()\n\t\tend\n\t\treturn escapeHTML((it or \'undefined\').trim())\n\tend\n\t<\/script>\n\n\t<header _="\n\ton pointerdown(clientX, clientY)\n\t\thalt the event\n\t\tcall event.stopPropagation()\n\t\tget first .hdb\n\t\tmeasure its x, y\n\t\tset xoff to clientX - x\n\t\tset yoff to clientY - y\n\t\trepeat until event pointerup from document\n\t\t\twait for pointermove or pointerup from document\n\t\t\tadd {\n\t\t\t\tleft: ${its clientX - xoff}px;\n\t\t\t\ttop: ${its clientY - yoff}px;\n\t\t\t} to .hdb\n\t\tend\n\t">\n\t\t<h2 class="titlebar">HDB</h2>\n\t\t<ul role="toolbar" class="toolbar" _="on pointerdown halt">\n\t\t\t<li><button _="on click call hdb.continueExec()">\n\t\t\t\t⏵ Continue\n\t\t\t</button>\n\t\t\t<li><button _="on click call hdb.stepOver()">\n\t\t\t\t↷ Step Over\n\t\t\t</button>\n\t\t</ul>\n\t</header>\n\n\t<section class="sec-code">\n\n\t\t<div class="code-container">\n\t\t\t<pre class="code language-hyperscript" _="\n\t\t\t\ton update from .hdb if hdb.cmd.programSource\n\t\t\t \tput highlightDebugCode() into me\n\t\t\t \tif Prism\n\t\t\t \t\tcall Prism.highlightAllUnder(me)\n\t\t\t \tend\n\t\t\t go to bottom of .current in me\n\t\t\t\tend\n\n\t\t\t\ton click\n\t\t\t\t\tif target matches .skip\n\t\t\t\t\t\tget (target\'s @data-cmd) as Int\n\t\t\t\t\t\tcall hdb.skipTo(hdb.uiCommandMap[result])\n\t\t\t\t\tend\n\t\t\t\t\tif target matches .rewrite\n\t\t\t\t\t\tset cmdNo to (target\'s @data-cmd) as Int\n\t\t\t\t\t\tset span to the first <span[data-cmd=\'${cmdNo}\'] />\n\t\t\t\t\t\tput `<form class=rewrite><input id=cmd></form>` into the span\n\t\t\t\t\tend\n\t\t\t\tend\n\n\t\t\t\ton submit\n\t\t\t\t\thalt the event\n\t\t\t\t\tget (closest @data-cmd to target) as Int\n\t\t\t\t\tlog \'cmd no\', it\n\t\t\t\t\tcall hdb.rewrite(hdb.uiCommandMap[result], #cmd\'s value)\n\t\t\t\tend\n\t\t\t"><code></code></pre>\n\t\t</div>\n\t</section>\n\n\t<section class="sec-console" _="\n\t\t-- Print context at startup\n\t\tinit repeat for var in Object.keys(hdb.ctx) if var is not \'meta\'\n\t\t\tsend hdbUI:consoleEntry(input: var, output: hdb.ctx[var]) to #console">\n\n\t\t<ul id="console" role="list" _="\n\t\t\ton hdbUI:consoleEntry(input, output)\n\t\t\t\tif no hdb.consoleHistory set hdb.consoleHistory to [] end\n\t\t\t\tpush(input) on hdb.consoleHistory\n\t\t\t\tset node to #tmpl-console-entry.content.cloneNode(true)\n\t\t\t\tput the node at end of me\n\t\t\t\tset entry to my lastElementChild\n\t\t\t\tgo to bottom of the entry\n\t\t\t\tput escapeHTML(input) into .input in the entry\n\t\t\t\tif no output\n\t\t\t\t\tcall _hyperscript.internals.runtime.parse(input)\n\t\t\t\t\tif its execute is not undefined then call its execute(hdb.ctx)\n\t\t\t\t\telse call its evaluate(hdb.ctx)\n\t\t\t\t\tend\n\t\t\t\t\tset output to it\n\t\t\t\tend\n\t\t\t\tput prettyPrint(output) as Fragment into .output in the entry\n\t\t\t">\n\t\t\t<template id="tmpl-console-entry">\n\t\t\t\t<li class="console-entry">\n\t\t\t\t\t<kbd><code class="input"></code></kbd>\n\t\t\t\t\t<samp class="output"></samp>\n\t\t\t\t</li>\n\t\t\t</template>\n\t\t</ul>\n\n\t\t<form id="console-form" data-hist="0" _="on submit\n\t\t\t\tsend hdbUI:consoleEntry(input: #console-input\'s value) to #console\n\t\t\t\tset #console-input\'s value to \'\'\n\t\t\t\tset @data-hist to 0\n\t\t\t\tset element oldContent to null\n\t\t\t\thalt\n\t\t\ton keydown[key is \'ArrowUp\' or key is \'ArrowDown\']\n\t\t\t\tif no hdb.consoleHistory or exit end\n\t\t\t\tif element oldContent is null set element oldContent to #console-input.value end\n\t\t\t\tif event.key is \'ArrowUp\' and hdb.consoleHistory.length > -@data-hist\n\t\t\t\t\tdecrement @data-hist\n\t\t\t\telse if event.key is \'ArrowDown\' and @data-hist < 0\n\t\t\t\t\tincrement @data-hist\n\t\t\t\tend end\n\t\t\t\tset #console-input.value to hdb.consoleHistory[hdb.consoleHistory.length + @data-hist as Int]\n\t\t\t\t\tor oldContent\n\t\t\t\thalt default\n\t\t\ton input if @data-hist is \'0\' set element oldContent to #console-input.value">\n\t\t\t<input id="console-input" placeholder="Enter an expression…"\n\t\t\t\tautocomplete="off">\n\t\t</form>\n\t</section>\n\n\t<style>\n\t.hdb {\n\t\tborder: 1px solid #888;\n\t\tborder-radius: .3em;\n\t\tbox-shadow: 0 .2em .3em #0008;\n\t\tposition: fixed;\n\t\ttop: .5em; right: .5em;\n\t\twidth: min(40ch, calc(100% - 1em));\n\t\tmax-height: calc(100% - 1em);\n\t\tbackground-color: white;\n\t\tfont-family: sans-serif;\n\t\topacity: .9;\n\t\tz-index: 2147483647;\n\t\tcolor: black;\n\t\tdisplay: flex;\n\t\tflex-flow: column;\n\t}\n\n\t* {\n\t\tbox-sizing: border-box;\n\t}\n\n\theader {\n\t\tdisplay: flex;\n\t\tjustify-content: space-between;\n\t\talign-items: center;\n\t\tpadding: .4em;\n\t}\n\n\t.titlebar {\n\t\tmargin: 0;\n\t\tfont-size: 1em;\n\t\ttouch-action: none;\n\t}\n\n\t.toolbar {\n\t\tdisplay: flex;\n\t\tgap: .35em;\n\n\t\tlist-style: none;\n\t\tpadding-left: 0;\n\t\tmargin: 0;\n\t}\n\n\t.toolbar a, .toolbar button {\n\t\tbackground: #2183ff;\n\t\tborder: 1px solid #3465a4;\n\t\tbox-shadow: 0 1px #b3c6ff inset, 0 .06em .06em #000;\n\t\tborder-radius: .2em;\n\t\tfont: inherit;\n\t\tpadding: .2em .3em;\n\t\tcolor: white;\n\t\ttext-shadow: 0 1px black;\n\t\tfont-weight: bold;\n\t}\n\n\t.toolbar a:hover .toolbar a:focus, .toolbar button:hover, .toolbar button:focus {\n\t\tbackground: #94c8ff;\n\t}\n\n\t.toolbar a:active, .toolbar button:active {\n\t\tbackground: #3465a4;\n\t}\n\n\t.sec-code {\n\t\tborder-radius: .3em;\n\t\toverflow: hidden;\n\t\tbox-shadow: 0 1px white inset, 0 .06em .06em #0008;\n\t\tbackground: #bdf;\n\t\tmargin: 0 .4em;\n\t\tborder: 1px solid #3465a4;\n\t}\n\n\t.hdb h3 {\n\t\tmargin: 0;\n\t\tfont-size: 1em;\n\t\tpadding: .2em .4em 0 .4em;\n\t}\n\n\t.code-container {\n\t\tdisplay: grid;\n\t\tline-height: 1.2em;\n\t\theight: calc(12 * 1.2em);\n\t\tborder-radius: 0 0 .2em .2em;\n\t\toverflow: auto;\n\t\tscrollbar-width: thin;\n\t\tscrollbar-color: #0003 transparent;\n\t}\n\n\t.code, #console, #console-input {\n\t\tfont-family: Consolas, "Andale Mono WT", "Andale Mono", "Lucida Console", "Lucida Sans Typewriter", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Liberation Mono", "Nimbus Mono L", Monaco, "Courier New", Courier, monospace;\n\t}\n\n\t.code {\n\t\twidth: 0;\n\t\tmargin: 0;\n\t\tpadding-left: 1ch;\n\t\ttab-size: 2;\n\t\t-moz-tab-size: 2;\n\t\t-o-tab-size: 2;\n\t}\n\n\t.current {\n\t\tfont-weight: bold;\n\t\tbackground: #abf;\n\t}\n\n\t#console {\n\t\toverflow-y: scroll;\n\t\tscrollbar-width: thin;\n\t\tscrollbar-color: #afc2db transparent;\n\t\theight: calc(12 * 1.2em);\n\t\tlist-style: none;\n\t\tpadding-left: 0;\n\t\tmargin: 0 .4em .4em .4em;\n\t\tposition: relative;\n\t\tword-wrap: break-word;\n\t}\n\n\t#console>*+* {\n\t\tmargin-top: .5em;\n\t}\n\n\t.console-entry>* {\n\t\tdisplay: block;\n\t}\n\n\t.console-entry .input { color: #3465a4; }\n\t.console-entry .output { color: #333; }\n\n\t.console-entry .input:before { content: \'>> \' }\n\t.console-entry .output:before { content: \'<- \' }\n\n\t#console-form {\n\t\tmargin: 0 .4em .4em .4em;\n\t}\n\n\t#console-input {\n\t\twidth: 100%;\n\t\tfont-size: inherit;\n\t}\n\n\t.token.tagname { font-weight: bold; }\n\t.token.attr, .token.builtin, .token.italic { font-style: italic; }\n\t.token.string { opacity: .8; }\n\t.token.keyword { color: #3465a4; }\n\t.token.bold, .token.punctuation, .token.operator { font-weight: bold; }\n\t</style>\n\t</div>\n\t',document.body.appendChild(n),t.processNode(e.querySelector(".hdb"))}})(window._hyperscript); | ||
var t=t=>{function n(n,e,o){this.ctx=n,this.runtime=e,this.cmd=o,this._hyperscript=t,this.bus=new EventTarget}t.addCommand("breakpoint",function(t,e,o){var i;if(o.matchToken("breakpoint"))return{op:function(t){globalThis.hdb=i=new n(t,e,this);try{return i.break(t)}catch(t){console.error(t,t.stack)}}}}),n.prototype.break=function(t){return console.log("=== HDB///_hyperscript/debugger ==="),this.ui(),new Promise((n,e)=>{this.bus.addEventListener("continue",()=>{if(this.ctx!==t){for(var e in t)delete t[e];Object.assign(t,this.ctx)}delete window.hdb,n(this.runtime.findNext(this.cmd,this.ctx))},{once:!0})})},n.prototype.continueExec=function(){this.bus.dispatchEvent(new Event("continue"))},n.prototype.stepOver=function(){if(!this.cmd)return this.continueExec();var t=this.cmd&&"breakpointCommand"===this.cmd.type?this.runtime.findNext(this.cmd,this.ctx):this.runtime.unifiedEval(this.cmd,this.ctx);return"implicitReturn"===t.type?this.stepOut():t&&t.then instanceof Function?t.then(t=>{this.cmd=t,this.bus.dispatchEvent(new Event("step")),this.logCommand()}):void(t.halt_flag?this.bus.dispatchEvent(new Event("continue")):(this.cmd=t,this.bus.dispatchEvent(new Event("step")),this.logCommand()))},n.prototype.stepOut=function(){if(!this.ctx.meta.caller)return this.continueExec();var t=this.ctx.meta.callingCommand,n=this.ctx.me;this.ctx=this.ctx.meta.caller,console.log("[hdb] stepping out into "+this.ctx.meta.feature.displayName),this.ctx.me instanceof Element&&this.ctx.me!==n&&console.log("[hdb] me: ",this.ctx.me),this.cmd=this.runtime.findNext(t,this.ctx),this.cmd=this.runtime.findNext(this.cmd,this.ctx),this.logCommand(),this.bus.dispatchEvent(new Event("step"))},n.prototype.skipTo=function(t){this.cmd=t,this.bus.dispatchEvent(new Event("skip"))},n.prototype.rewrite=function(n,e){const o=n.parent;let i=o.start;for(;i.next!==n;)i=i.next;const s=n.next,r=t.internals.lexer.tokenize(e),a=t.internals.parser.requireElement("command",r);console.log(a),a.startToken=n.startToken,a.endToken=n.endToken,a.programSource=n.programSource,a.sourceFor=function(){return e},i.next=a,a.next=s,a.parent=o,this.bus.dispatchEvent(new Event("step"))},n.prototype.logCommand=function(){var t=this.cmd.sourceFor instanceof Function?this.cmd.sourceFor():"-- "+this.cmd.type;console.log("[hdb] current command: "+t)},n.prototype.ui=function(){var n=document.createElement("div"),e=n.attachShadow({mode:"open"});n.style.cssText="all: initial",e.innerHTML='\n<div class="hdb" _="\n\ton load trigger update \n\ton step from hdb.bus trigger update\n\ton skip from hdb.bus trigger update\n\ton continue from hdb.bus log \'done\' then remove me.getRootNode().host">\n\n\t<script type="text/hyperscript">\n\n\tdef escapeHTML(unsafe)\n\t\tjs(unsafe) return unsafe\n\t\t\t.replace(/&/g, "&")\n\t\t\t.replace(/</g, "<")\n\t\t\t.replace(/>/g, ">")\n\t\t\t.replace(/\\x22/g, """)\n\t\t\t.replace(/\\x27/g, "'") end\n\t\treturn it\n\tend\n\n\tdef highlightDebugCode\n\t\tset rv to []\n\t\tset hdb.uiCommandMap to []\n\t\tset cmd to hdb.cmd.parent.start\n\t\tappend escapeHTML(hdb.cmd.programSource.substring(0, cmd.startToken.start)) to rv\n\t\trepeat until cmd.halt_flag or cmd.type is \'implicitReturn\'\n\t\t\tpush(cmd) on hdb.uiCommandMap\n\t\t\tset cmdNo to hdb.uiCommandMap\'s length-1\n\t\t\tif global HYPERSCRIPT_HDB_EXPERIMENTAL\n\t\t\t\tappend `<button class="skip" data-cmd="${cmdNo}">skip</button>` to rv\n\t\t\t\tappend `<button class="rewrite" data-cmd="${cmdNo}">rewrite</button>` to rv\n\t\t\tend\n\t\t\tset src to escapeHTML(cmd.sourceFor())\n\t\t\tif cmd is hdb.cmd\n\t\t\t\tappend \'<u class="current"><span data-cmd="\' + cmdNo + \'">\' + src + \'</span></u>\' to rv\n\t\t\telse\n\t\t\t\tappend \'<span data-cmd="\' + cmdNo + \'">\' + src + \'</span>\' to rv\n\t\t\tend\n\t\t\tappend escapeHTML(hdb.cmd.programSource.substring(cmd.endToken.end, cmd.next.startToken.start)) to rv\n\t\t\tset cmd to cmd.next\n\t\tend\n\t\treturn rv.join(\'\')\n\t\t-- set start to hdb.cmd.startToken.start\n\tend\n\n\tdef truncate(str, len)\n\t\tif str.length <= len return str end\n\t\treturn str.substr(0, len) + \'…\'\n\n\tdef prettyPrint(obj)\n\t\tif obj is null return \'null\' end\n\t\tif Element.prototype.isPrototypeOf(obj)\n\t\t\tset rv to \'<<span class="token tagname">\' +\n\t\t\t\tobj.tagName.toLowerCase() + "</span>"\n\t\t\tfor attr in Array.from(obj.attributes)\n\t\t\t\tif attr.specified\n\t\t\t\t\tset rv to rv +\n\t\t\t\t\t\t\' <span class="token attr">\' + attr.nodeName +\n\t\t\t\t\t\t\'</span>=<span class="token string">"\' + truncate(attr.textContent, 10) +\n\t\t\t\t\t\t\'"</span>\'\n\t\t\t\tend\n\t\t\tend\n\t\t\tset rv to rv + \'>\'\n\t\t\treturn rv\n\t\telse if obj.call\n\t\t\tif obj.hyperfunc\n\t\t\t\tget "def " + obj.hypername + \' ...\'\n\t\t\telse\n\t\t\t\tget "function "+obj.name+"(...) {...}"\n\t\t\tend\n\t\telse if obj.toString\n\t\t\tcall obj.toString()\n\t\tend\n\t\treturn escapeHTML((it or \'undefined\').trim())\n\tend\n\t<\/script>\n\n\t<header _="\n\ton pointerdown(clientX, clientY)\n\t\thalt the event\n\t\tcall event.stopPropagation()\n\t\tget first .hdb\n\t\tmeasure its x, y\n\t\tset xoff to clientX - x\n\t\tset yoff to clientY - y\n\t\trepeat until event pointerup from document\n\t\t\twait for pointermove or pointerup from document\n\t\t\tadd {\n\t\t\t\tleft: ${its clientX - xoff}px;\n\t\t\t\ttop: ${its clientY - yoff}px;\n\t\t\t} to .hdb\n\t\tend\n\t">\n\t\t<h2 class="titlebar">HDB</h2>\n\t\t<ul role="toolbar" class="toolbar" _="on pointerdown halt">\n\t\t\t<li><button _="on click call hdb.continueExec()">\n\t\t\t\t⏵ Continue\n\t\t\t</button>\n\t\t\t<li><button _="on click call hdb.stepOver()">\n\t\t\t\t↷ Step Over\n\t\t\t</button>\n\t\t</ul>\n\t</header>\n\n\t<section class="sec-code">\n\n\t\t<div class="code-container">\n\t\t\t<pre class="code language-hyperscript" _="\n\t\t\t\ton update from .hdb if hdb.cmd.programSource\n\t\t\t \tput highlightDebugCode() into me\n\t\t\t \tif Prism\n\t\t\t \t\tcall Prism.highlightAllUnder(me)\n\t\t\t \tend\n\t\t\t go to bottom of .current in me\n\t\t\t\tend\n\n\t\t\t\ton click\n\t\t\t\t\tif target matches .skip\n\t\t\t\t\t\tget (target\'s @data-cmd) as Int\n\t\t\t\t\t\tcall hdb.skipTo(hdb.uiCommandMap[result])\n\t\t\t\t\tend\n\t\t\t\t\tif target matches .rewrite\n\t\t\t\t\t\tset cmdNo to (target\'s @data-cmd) as Int\n\t\t\t\t\t\tset span to the first <span[data-cmd=\'${cmdNo}\'] />\n\t\t\t\t\t\tput `<form class=rewrite><input id=cmd></form>` into the span\n\t\t\t\t\tend\n\t\t\t\tend\n\n\t\t\t\ton submit\n\t\t\t\t\thalt the event\n\t\t\t\t\tget (closest @data-cmd to target) as Int\n\t\t\t\t\tlog \'cmd no\', it\n\t\t\t\t\tcall hdb.rewrite(hdb.uiCommandMap[result], #cmd\'s value)\n\t\t\t\tend\n\t\t\t"><code></code></pre>\n\t\t</div>\n\t</section>\n\n\t<section class="sec-console" _="\n\t\t-- Print context at startup\n\t\tinit repeat for var in Object.keys(hdb.ctx) if var is not \'meta\'\n\t\t\tsend hdbUI:consoleEntry(input: var, output: hdb.ctx[var]) to #console">\n\n\t\t<ul id="console" role="list" _="\n\t\t\ton hdbUI:consoleEntry(input, output)\n\t\t\t\tif no hdb.consoleHistory set hdb.consoleHistory to [] end\n\t\t\t\tpush(input) on hdb.consoleHistory\n\t\t\t\tset node to #tmpl-console-entry.content.cloneNode(true)\n\t\t\t\tput the node at end of me\n\t\t\t\tset entry to my lastElementChild\n\t\t\t\tgo to bottom of the entry\n\t\t\t\tput escapeHTML(input) into .input in the entry\n\t\t\t\tif no output\n\t\t\t\t\tcall _hyperscript.internals.runtime.parse(input)\n\t\t\t\t\tif its execute is not undefined then call its execute(hdb.ctx)\n\t\t\t\t\telse call its evaluate(hdb.ctx)\n\t\t\t\t\tend\n\t\t\t\t\tset output to it\n\t\t\t\tend\n\t\t\t\tput prettyPrint(output) as Fragment into .output in the entry\n\t\t\t">\n\t\t\t<template id="tmpl-console-entry">\n\t\t\t\t<li class="console-entry">\n\t\t\t\t\t<kbd><code class="input"></code></kbd>\n\t\t\t\t\t<samp class="output"></samp>\n\t\t\t\t</li>\n\t\t\t</template>\n\t\t</ul>\n\n\t\t<form id="console-form" data-hist="0" _="on submit\n\t\t\t\tsend hdbUI:consoleEntry(input: #console-input\'s value) to #console\n\t\t\t\tset #console-input\'s value to \'\'\n\t\t\t\tset @data-hist to 0\n\t\t\t\tset element oldContent to null\n\t\t\t\thalt\n\t\t\ton keydown[key is \'ArrowUp\' or key is \'ArrowDown\']\n\t\t\t\tif no hdb.consoleHistory or exit end\n\t\t\t\tif element oldContent is null set element oldContent to #console-input.value end\n\t\t\t\tif event.key is \'ArrowUp\' and hdb.consoleHistory.length > -@data-hist\n\t\t\t\t\tdecrement @data-hist\n\t\t\t\telse if event.key is \'ArrowDown\' and @data-hist < 0\n\t\t\t\t\tincrement @data-hist\n\t\t\t\tend end\n\t\t\t\tset #console-input.value to hdb.consoleHistory[hdb.consoleHistory.length + @data-hist as Int]\n\t\t\t\t\tor oldContent\n\t\t\t\thalt default\n\t\t\ton input if @data-hist is \'0\' set element oldContent to #console-input.value">\n\t\t\t<input id="console-input" placeholder="Enter an expression…"\n\t\t\t\tautocomplete="off">\n\t\t</form>\n\t</section>\n\n\t<style>\n\t.hdb {\n\t\tborder: 1px solid #888;\n\t\tborder-radius: .3em;\n\t\tbox-shadow: 0 .2em .3em #0008;\n\t\tposition: fixed;\n\t\ttop: .5em; right: .5em;\n\t\twidth: min(40ch, calc(100% - 1em));\n\t\tmax-height: calc(100% - 1em);\n\t\tbackground-color: white;\n\t\tfont-family: sans-serif;\n\t\topacity: .9;\n\t\tz-index: 2147483647;\n\t\tcolor: black;\n\t\tdisplay: flex;\n\t\tflex-flow: column;\n\t}\n\n\t* {\n\t\tbox-sizing: border-box;\n\t}\n\n\theader {\n\t\tdisplay: flex;\n\t\tjustify-content: space-between;\n\t\talign-items: center;\n\t\tpadding: .4em;\n\t}\n\n\t.titlebar {\n\t\tmargin: 0;\n\t\tfont-size: 1em;\n\t\ttouch-action: none;\n\t}\n\n\t.toolbar {\n\t\tdisplay: flex;\n\t\tgap: .35em;\n\n\t\tlist-style: none;\n\t\tpadding-left: 0;\n\t\tmargin: 0;\n\t}\n\n\t.toolbar a, .toolbar button {\n\t\tbackground: #2183ff;\n\t\tborder: 1px solid #3465a4;\n\t\tbox-shadow: 0 1px #b3c6ff inset, 0 .06em .06em #000;\n\t\tborder-radius: .2em;\n\t\tfont: inherit;\n\t\tpadding: .2em .3em;\n\t\tcolor: white;\n\t\ttext-shadow: 0 1px black;\n\t\tfont-weight: bold;\n\t}\n\n\t.toolbar a:hover .toolbar a:focus, .toolbar button:hover, .toolbar button:focus {\n\t\tbackground: #94c8ff;\n\t}\n\n\t.toolbar a:active, .toolbar button:active {\n\t\tbackground: #3465a4;\n\t}\n\n\t.sec-code {\n\t\tborder-radius: .3em;\n\t\toverflow: hidden;\n\t\tbox-shadow: 0 1px white inset, 0 .06em .06em #0008;\n\t\tbackground: #bdf;\n\t\tmargin: 0 .4em;\n\t\tborder: 1px solid #3465a4;\n\t}\n\n\t.hdb h3 {\n\t\tmargin: 0;\n\t\tfont-size: 1em;\n\t\tpadding: .2em .4em 0 .4em;\n\t}\n\n\t.code-container {\n\t\tdisplay: grid;\n\t\tline-height: 1.2em;\n\t\theight: calc(12 * 1.2em);\n\t\tborder-radius: 0 0 .2em .2em;\n\t\toverflow: auto;\n\t\tscrollbar-width: thin;\n\t\tscrollbar-color: #0003 transparent;\n\t}\n\n\t.code, #console, #console-input {\n\t\tfont-family: Consolas, "Andale Mono WT", "Andale Mono", "Lucida Console", "Lucida Sans Typewriter", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Liberation Mono", "Nimbus Mono L", Monaco, "Courier New", Courier, monospace;\n\t}\n\n\t.code {\n\t\twidth: 0;\n\t\tmargin: 0;\n\t\tpadding-left: 1ch;\n\t\ttab-size: 2;\n\t\t-moz-tab-size: 2;\n\t\t-o-tab-size: 2;\n\t}\n\n\t.current {\n\t\tfont-weight: bold;\n\t\tbackground: #abf;\n\t}\n\n\t#console {\n\t\toverflow-y: scroll;\n\t\tscrollbar-width: thin;\n\t\tscrollbar-color: #afc2db transparent;\n\t\theight: calc(12 * 1.2em);\n\t\tlist-style: none;\n\t\tpadding-left: 0;\n\t\tmargin: 0 .4em .4em .4em;\n\t\tposition: relative;\n\t\tword-wrap: break-word;\n\t}\n\n\t#console>*+* {\n\t\tmargin-top: .5em;\n\t}\n\n\t.console-entry>* {\n\t\tdisplay: block;\n\t}\n\n\t.console-entry .input { color: #3465a4; }\n\t.console-entry .output { color: #333; }\n\n\t.console-entry .input:before { content: \'>> \' }\n\t.console-entry .output:before { content: \'<- \' }\n\n\t#console-form {\n\t\tmargin: 0 .4em .4em .4em;\n\t}\n\n\t#console-input {\n\t\twidth: 100%;\n\t\tfont-size: inherit;\n\t}\n\n\t.token.tagname { font-weight: bold; }\n\t.token.attr, .token.builtin, .token.italic { font-style: italic; }\n\t.token.string { opacity: .8; }\n\t.token.keyword { color: #3465a4; }\n\t.token.bold, .token.punctuation, .token.operator { font-weight: bold; }\n\t</style>\n\t</div>\n\t',document.body.appendChild(n),t.processNode(e.querySelector(".hdb"))}};export{t as default}; | ||
//# sourceMappingURL=hdb.modern.js.map |
@@ -1,2 +0,2 @@ | ||
function e(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=16*Math.random()|0;return("x"==e?t:3&t|8).toString(16)})}function t(e){return new WebSocket(e.evaluate())}var n,r;n=window._hyperscript,r=["then","catch","length","asyncWrapper","toJSON"],n.addFeature("socket",function(n,i,o){if(o.matchToken("socket")){var a=n.requireElement("dotOrColonPath",o).evaluate().split("."),u=a.pop(),s={},c=n.requireElement("stringLike",o),x=1e4;if(o.matchToken("with")&&(o.requireToken("timeout"),x=n.requireElement("timeExpression",o).evaluate()),o.matchToken("on")){if(o.requireToken("message"),o.matchToken("as")){o.requireToken("json");var f=!0}for(var l=n.requireElement("commandList",o),m={type:"implicitReturn",op:function(e){return i.HALT},execute:function(e){}},d=l;d.next;)d=d.next;d.next=m}var v=t(c),p=function n(i){return new Proxy({},{get:function(o,a){return r.indexOf(a)>=0?null:"noTimeout"===a?n(-1):"timeout"===a?function(e){return n(parseInt(e))}:function(){for(var n=e(),r=[],o=0;o<arguments.length;o++)r.push(arguments[o]);var u={iid:n,function:a,args:r};(v=v||t(c)).send(JSON.stringify(u));var x=new Promise(function(e,t){s[n]={resolve:e,reject:t}});return i>=0&&setTimeout(function(){s[n]&&s[n].reject("Timed out"),delete s[n]},i),x}}})}(x),h={raw:v,dispatchEvent:function(e){var t=e.detail;delete t.sentBy,delete t._namedArgList_,v.send(JSON.stringify(function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);return e}({type:e.type},t)))},rpc:p},g={name:u,socket:h,install:function(e){i.assignToNamespace(e,a,u,h)}};return v.onmessage=function(e){var t=e.data;try{var n=JSON.parse(t)}catch(e){}if(n&&n.iid&&(n.throw?s[n.iid].reject(n.throw):s[n.iid].resolve(n.return),delete s[n.iid]),l){var r=i.makeContext(h,g,h);if(f){if(!n)throw"Received non-JSON message from socket: "+t;r.message=n,r.result=n}else r.message=t,r.result=t;l.execute(r)}},v.addEventListener("close",function(e){v=null}),g}}); | ||
function e(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=16*Math.random()|0;return("x"==e?t:3&t|8).toString(16)})}function t(e){return new WebSocket(e.evaluate())}var n=n=>{var r=["then","catch","length","asyncWrapper","toJSON"];n.addFeature("socket",function(n,i,o){if(o.matchToken("socket")){var a=n.requireElement("dotOrColonPath",o).evaluate().split("."),u=a.pop(),s={},c=n.requireElement("stringLike",o),x=1e4;if(o.matchToken("with")&&(o.requireToken("timeout"),x=n.requireElement("timeExpression",o).evaluate()),o.matchToken("on")){if(o.requireToken("message"),o.matchToken("as")){o.requireToken("json");var f=!0}for(var l=n.requireElement("commandList",o),m={type:"implicitReturn",op:function(e){return i.HALT},execute:function(e){}},d=l;d.next;)d=d.next;d.next=m}var v=t(c),p=function n(i){return new Proxy({},{get:function(o,a){return r.indexOf(a)>=0?null:"noTimeout"===a?n(-1):"timeout"===a?function(e){return n(parseInt(e))}:function(){for(var n=e(),r=[],o=0;o<arguments.length;o++)r.push(arguments[o]);var u={iid:n,function:a,args:r};(v=v||t(c)).send(JSON.stringify(u));var x=new Promise(function(e,t){s[n]={resolve:e,reject:t}});return i>=0&&setTimeout(function(){s[n]&&s[n].reject("Timed out"),delete s[n]},i),x}}})}(x),h={raw:v,dispatchEvent:function(e){var t=e.detail;delete t.sentBy,delete t._namedArgList_,v.send(JSON.stringify(function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);return e}({type:e.type},t)))},rpc:p},g={name:u,socket:h,install:function(e){i.assignToNamespace(e,a,u,h)}};return v.onmessage=function(e){var t=e.data;try{var n=JSON.parse(t)}catch(e){}if(n&&n.iid&&(n.throw?s[n.iid].reject(n.throw):s[n.iid].resolve(n.return),delete s[n.iid]),l){var r=i.makeContext(h,g,h);if(f){if(!n)throw"Received non-JSON message from socket: "+t;r.message=n,r.result=n}else r.message=t,r.result=t;l.execute(r)}},v.addEventListener("close",function(e){v=null}),g}})};export{n as default}; | ||
//# sourceMappingURL=socket.modern.js.map |
@@ -1,2 +0,2 @@ | ||
function e(e){return e.replace(/(?:^|\n)([^@]*)@?/gm,function(e,n){return"\ncall __ht_template_result.push(`"+(" "+n).replace(/([^\\])\$\{/g,"$1$${escape html ").substring(1)+"`)\n"})}var n;(n=window._hyperscript).addCommand("render",function(r,t,a){if(a.matchToken("render")){var i=r.requireElement("expression",a),o={};return a.matchToken("with")&&(o=r.parseElement("namedArgumentList",a)),{args:[i,o],op:function(r,a,o){if(!(a instanceof Element))throw new Error(i.sourceFor()+" is not an element");return console.log(e(a.innerHTML)),r.result=function(e,r){var t=[];return n.evaluate(e,Object.assign({__ht_template_result:t},r)),t.join("")}(e(a.innerHTML),o),t.findNext(this,r)}}}}),n.addLeafExpression("escape",function(e,n,r){if(r.matchToken("escape")){var t=r.matchTokenType("IDENTIFIER").value,a=r.matchToken("unescaped");return{args:[e.requireElement("expression",r)],op:function(e,n){if(a)return n;if(void 0===n)return"";if("html"===t)return String(n).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/\x22/g,""").replace(/\x27/g,"'");throw new Error("Unknown escape: "+t)},evaluate:function(e){return n.unifiedEval(this,e)}}}}); | ||
function e(e){return e.replace(/(?:^|\n)([^@]*)@?/gm,function(e,n){return"\ncall __ht_template_result.push(`"+(" "+n).replace(/([^\\])\$\{/g,"$1$${escape html ").substring(1)+"`)\n"})}var n=n=>{n.addCommand("render",function(r,t,a){if(a.matchToken("render")){var i=r.requireElement("expression",a),o={};return a.matchToken("with")&&(o=r.parseElement("namedArgumentList",a)),{args:[i,o],op:function(r,a,o){if(!(a instanceof Element))throw new Error(i.sourceFor()+" is not an element");return console.log(e(a.innerHTML)),r.result=function(e,r){var t=[];return n.evaluate(e,Object.assign({__ht_template_result:t},r)),t.join("")}(e(a.innerHTML),o),t.findNext(this,r)}}}}),n.addLeafExpression("escape",function(e,n,r){if(r.matchToken("escape")){var t=r.matchTokenType("IDENTIFIER").value,a=r.matchToken("unescaped");return{args:[e.requireElement("expression",r)],op:function(e,n){if(a)return n;if(void 0===n)return"";if("html"===t)return String(n).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/\x22/g,""").replace(/\x27/g,"'");throw new Error("Unknown escape: "+t)},evaluate:function(e){return n.unifiedEval(this,e)}}}})};export{n as default}; | ||
//# sourceMappingURL=template.modern.js.map |
@@ -1,2 +0,2 @@ | ||
var e,t,r,a,n;e=window._hyperscript,t=0,r="("+function(e){e.onmessage=function(t){switch(t.data.type){case"init":e.importScripts(t.data._hyperscript),e.importScripts.apply(e,t.data.extraScripts);const s=e._hyperscript;var r=s.internals.lexer.makeTokensObject(t.data.tokens,[],t.data.source),a=s.internals.parser.parseElement("hyperscript",r);a.apply(e,e),postMessage({type:"didInit"});break;case"call":try{var n=e._hyperscript.internals.runtime.getHyperscriptFeatures(e)[t.data.function].apply(e,t.data.args);Promise.resolve(n).then(function(e){postMessage({type:"resolve",id:t.data.id,value:e})}).catch(function(e){postMessage({type:"reject",id:t.data.id,error:e.toString()})})}catch(e){postMessage({type:"reject",id:t.data.id,error:e.toString()})}}}}.toString()+")(self)",a=new Blob([r],{type:"text/javascript"}),n=URL.createObjectURL(a),e.addFeature("worker",function(e,r,a){if(a.matchToken("worker")){var s=e.requireElement("dotOrColonPath",a).evaluate().split("."),o=s.pop(),i=[];if(a.matchOpToken("("))if(a.matchOpToken(")"));else{do{var c=a.requireTokenType("STRING").value,p=new URL(c,location.href).href;i.push(p)}while(a.matchOpToken(","));a.requireOpToken(")")}var d=[],u=a.consumed.length,l=a.consumed.length;do{var h=e.parseAnyOf(["defFeature","jsFeature"],a);if(!h)break;if("defFeature"===h.type)d.push(h.name),l=a.consumed.length;else if(a.hasMore())continue}while(a.matchToken("end")&&a.hasMore());var f=a.consumed.slice(u,l+1),m=new Worker(n);m.postMessage({type:"init",_hyperscript:r.hyperscriptUrl,extraScripts:i,tokens:f,source:a.source});var y=new Promise(function(e,t){m.addEventListener("message",function(t){"didInit"===t.data.type&&e()},{once:!0})}),v={};return d.forEach(function(e){console.log(e),v[e]=function(){var r=arguments;return new Promise(function(a,n){var s=t++;m.addEventListener("message",function e(t){t.data.id===s&&(m.removeEventListener("message",e),"resolve"===t.data.type?a(t.data.value):n(t.data.error))}),y.then(function(){m.postMessage({type:"call",function:e,args:Array.from(r),id:s})})})}}),{name:o,worker:m,install:function(e){r.assignToNamespace(e,s,o,v)}}}}); | ||
var e=e=>{var t=0,r="("+function(e){e.onmessage=function(t){switch(t.data.type){case"init":e.importScripts(t.data._hyperscript),e.importScripts.apply(e,t.data.extraScripts);const s=e._hyperscript;var r=s.internals.lexer.makeTokensObject(t.data.tokens,[],t.data.source),a=s.internals.parser.parseElement("hyperscript",r);a.apply(e,e),postMessage({type:"didInit"});break;case"call":try{var n=e._hyperscript.internals.runtime.getHyperscriptFeatures(e)[t.data.function].apply(e,t.data.args);Promise.resolve(n).then(function(e){postMessage({type:"resolve",id:t.data.id,value:e})}).catch(function(e){postMessage({type:"reject",id:t.data.id,error:e.toString()})})}catch(e){postMessage({type:"reject",id:t.data.id,error:e.toString()})}}}}.toString()+")(self)",a=new Blob([r],{type:"text/javascript"}),n=URL.createObjectURL(a);e.addFeature("worker",function(e,r,a){if(a.matchToken("worker")){var s=e.requireElement("dotOrColonPath",a).evaluate().split("."),o=s.pop(),i=[];if(a.matchOpToken("("))if(a.matchOpToken(")"));else{do{var c=a.requireTokenType("STRING").value,p=new URL(c,location.href).href;i.push(p)}while(a.matchOpToken(","));a.requireOpToken(")")}var d=[],u=a.consumed.length,l=a.consumed.length;do{var f=e.parseAnyOf(["defFeature","jsFeature"],a);if(!f)break;if("defFeature"===f.type)d.push(f.name),l=a.consumed.length;else if(a.hasMore())continue}while(a.matchToken("end")&&a.hasMore());var h=a.consumed.slice(u,l+1),m=new Worker(n);m.postMessage({type:"init",_hyperscript:r.hyperscriptUrl,extraScripts:i,tokens:h,source:a.source});var y=new Promise(function(e,t){m.addEventListener("message",function(t){"didInit"===t.data.type&&e()},{once:!0})}),v={};return d.forEach(function(e){console.log(e),v[e]=function(){var r=arguments;return new Promise(function(a,n){var s=t++;m.addEventListener("message",function e(t){t.data.id===s&&(m.removeEventListener("message",e),"resolve"===t.data.type?a(t.data.value):n(t.data.error))}),y.then(function(){m.postMessage({type:"call",function:e,args:Array.from(r),id:s})})})}}),{name:o,worker:m,install:function(e){r.assignToNamespace(e,s,o,v)}}}})};export{e as default}; | ||
//# sourceMappingURL=worker.modern.js.map |
@@ -8,3 +8,3 @@ { | ||
], | ||
"version": "0.8.4-beta.0", | ||
"version": "0.8.4-beta.1", | ||
"homepage": "https://hyperscript.org/", | ||
@@ -18,8 +18,33 @@ "bugs": { | ||
"README.md", | ||
"dist/*.js" | ||
"dist/*" | ||
], | ||
"main": "dist/_hyperscript_web.min.js", | ||
"exports": "./dist/_hyperscript_web.modern.js", | ||
"exports": { | ||
".": { | ||
"import": "./dist/_hyperscript_web.modern.js", | ||
"umd": "./dist/_hyperscript_web.min.js" | ||
}, | ||
"./worker": { | ||
"import": "./dist/worker.modern.js", | ||
"umd": "./dist/worker.min.js" | ||
}, | ||
"./socket": { | ||
"import": "./dist/socket.modern.js", | ||
"umd": "./dist/socket.min.js" | ||
}, | ||
"./eventsource": { | ||
"import": "./dist/eventsource.modern.js", | ||
"umd": "./dist/eventsource.min.js" | ||
}, | ||
"./hdb": { | ||
"import": "./dist/hdb.modern.js", | ||
"umd": "./dist/eventsource.min.js" | ||
}, | ||
"./template": { | ||
"import": "./dist/hdb.modern.js", | ||
"umd": "./dist/eventsource.min.js" | ||
} | ||
}, | ||
"module": "./dist/_hyperscript_web.esm.js", | ||
"unpkg": "dist/_hyperscript.min.js", | ||
"unpkg": "dist/_hyperscript_web.min.js", | ||
"bin": { | ||
@@ -34,4 +59,6 @@ "_hyperscript": "src/bin/node-hyperscript.js" | ||
"copy": "cp -r src/* dist/", | ||
"bundle-dev": "microbundle src/web/_hyperscript_w9y.js -o dist/_hyperscript_w9y.js --name=_hyperscript -f umd", | ||
"bundle-all": "microbundle src/web/* -o dist --name=_hyperscript -f modern,esm,umd" | ||
"bundle-module-plugins": "microbundle src/lib/plugin/*.js -f modern", | ||
"bundle-umd-plugins": "microbundle src/web/plugin/*.js -f umd", | ||
"bundle-hyperscript": "microbundle src/web/*.js -f modern,umd", | ||
"bundle-all": "npm run bundle-hyperscript && npm run bundle-module-plugins && npm run bundle-umd-plugins" | ||
}, | ||
@@ -38,0 +65,0 @@ "repository": { |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
2029108
51
8897
14
7