all repos — h3 @ 87dcca29e11f502f6be5570d92ad97c1ebefbec8

A tiny, extremely minimalist JavaScript microframework.

Merge remote-tracking branch 'origin/dev'
h3rald h3rald@h3rald.com
Sun, 05 Jul 2020 21:19:31 +0000
commit

87dcca29e11f502f6be5570d92ad97c1ebefbec8

parent

4abfb6df52da5bd2caf43e2f3522d7d144cc3c3e

M README.mdREADME.md

@@ -11,7 +11,7 @@ **H3** is a microframework to build client-side single-page applications (SPAs) in modern JavaScript.

H3 is also: -- **tiny**, under [800 sloc](https://github.com/h3rald/h3/blob/master/h3.js). +- **tiny**, less than 4KB minified gzipped. - **modern**, in the sense that it runs only in modern browsers (latest versions of Chrome, Firefox, Edge & similar). - **easy** to learn, its API is comprised of only six methods and two properties.

@@ -19,7 +19,9 @@ ### I'm sold! Where can I get it?

Here, look, it's just one file: -<a href="https://raw.githubusercontent.com/h3rald/h3/v0.8.0/h3.js" target="_blank" class="button primary">Download v0.8.0 (Humble Human)</a> +<a href="https://raw.githubusercontent.com/h3rald/h3/v0.9.0/h3.js" target="_blank" class="button primary">Download v0.9.0 (Impeccable Iconian)</a> + +<small>Or get the minified version [here](https://raw.githubusercontent.com/h3rald/h3/v0.9.0/h3.min.js).</small> Yes there is also a [NPM package](https://www.npmjs.com/package/@h3rald/h3) if you want to use it with WebPack and similar, but let me repeat: _it's just one file_.

@@ -40,7 +42,7 @@ Have a look at the code of a [simple todo list](https://github.com/h3rald/h3/tree/master/docs/example) ([demo](https://h3.js.org/example/index.html)) with several components, a store and some routing.

### No, I meant a real web application... -OK, have a look at [litepad.h3rald.com](https://litepad.h3rald.com) &mdash; it's a powerful notepad application that demonstrates how to create custom controls, route components, forms, and integrate third-party tools. The code is of course [on GitHub](https://github.com/h3rald/litepad) +OK, have a look at [litepad.h3rald.com](https://litepad.h3rald.com) &mdash; it's a powerful notepad application that demonstrates how to create custom controls, route components, forms, and integrate third-party tools. The code is of course [on GitHub](https://github.com/h3rald/litepad). ### Can I use it then, no strings attached?
M __tests__/vnode.js__tests__/vnode.js

@@ -75,6 +75,32 @@ vnode1.redraw({ node, vnode });

expect(node.checked).toEqual(false); }); + it("should handle non-string attributes as properties and not create attributes", () => { + const v = h3("div", { + test: true, + obj: { a: 1, b: 2 }, + arr: [1, 2, 3], + num: 2.3, + str: "test", + s: "", + title: "testing!", + value: false, + }); + const n = v.render(); + expect(n.test).toEqual(true); + expect(n.obj).toEqual({ a: 1, b: 2 }); + expect(n.arr).toEqual([1, 2, 3]); + expect(n.num).toEqual(2.3); + expect(n.str).toEqual("test"); + expect(n.getAttribute("str")).toEqual("test"); + expect(n.s).toEqual(""); + expect(n.getAttribute("s")).toEqual(null); + expect(n.title).toEqual("testing!"); + expect(n.getAttribute("title")).toEqual("testing!"); + expect(n.value).toEqual(undefined); + expect(n.getAttribute("value")).toEqual(null); + }); + it("should provide a render method able to render element nodes with a value", () => { const vnode = h3("input", { value: "test" }); const createElement = jest.spyOn(document, "createElement");
M docs/H3_DeveloperGuide.htmdocs/H3_DeveloperGuide.htm

@@ -7326,7 +7326,7 @@

<p>H3 is also:</p> <ul> -<li><strong>tiny</strong>, under <a href="https://github.com/h3rald/h3/blob/master/h3.js">800 sloc</a>.</li> +<li><strong>tiny</strong>, less than 4KB minified gzipped.</li> <li><strong>modern</strong>, in the sense that it runs only in modern browsers (latest versions of Chrome, Firefox, Edge &amp; similar).</li> <li><strong>easy</strong> to learn, its API is comprised of only six methods and two properties.</li> </ul>

@@ -7337,7 +7337,9 @@ <h3>I&rsquo;m sold! Where can I get it?<a href="#document-top" title="Go to top"></a></h3>

<p>Here, look, it&rsquo;s just one file:</p> -<p><a href="https://raw.githubusercontent.com/h3rald/h3/v0.8.0/h3.js" target="_blank" class="button primary">Download v0.8.0 (Humble Human)</a></p> +<p><a href="https://raw.githubusercontent.com/h3rald/h3/v0.9.0/h3.js" target="_blank" class="button primary">Download v0.9.0 (Impeccable Iconian)</a></p> + +<p><small>Or get the minified version <a href="https://raw.githubusercontent.com/h3rald/h3/v0.9.0/h3.min.js">here</a>.</small></p> <p>Yes there is also a <a href="https://www.npmjs.com/package/@h3rald/h3">NPM package</a> if you want to use it with WebPack and similar, but let me repeat: <em>it&rsquo;s just one file</em>.</p>

@@ -7360,7 +7362,7 @@

<a name="No,-I-meant-a-real-web-application..."></a> <h3>No, I meant a real web application&hellip;<a href="#document-top" title="Go to top"></a></h3> -<p>OK, have a look at <a href="https://litepad.h3rald.com">litepad.h3rald.com</a> &mdash; it&rsquo;s a powerful notepad application that demonstrates how to create custom controls, route components, forms, and integrate third-party tools. The code is of course <a href="https://github.com/h3rald/litepad">on GitHub</a></p> +<p>OK, have a look at <a href="https://litepad.h3rald.com">litepad.h3rald.com</a> &mdash; it&rsquo;s a powerful notepad application that demonstrates how to create custom controls, route components, forms, and integrate third-party tools. The code is of course <a href="https://github.com/h3rald/litepad">on GitHub</a>.</p> <a name="Can-I-use-it-then,-no-strings-attached?"></a> <h3>Can I use it then, no strings attached?<a href="#document-top" title="Go to top"></a></h3>

@@ -7702,8 +7704,8 @@ h3("a.logo.col-sm-1", { href: "#/" }, [

h3("img", { alt: "H3", src: "images/h3.svg" }), ]), h3("div.version.col-sm.col-md", [ - h3("div.version-number", "v0.8.0"), - h3("div.version-label", "“Humble Human“"), + h3("div.version-number", "v0.9.0"), + h3("div.version-label", "“Impeccable Iconian“"), ]), h3("label.drawer-toggle.button.col-sm-last", { for: "drawer-control" }), ]);

@@ -8056,7 +8058,7 @@ </ul>

</div> <div id="footer"> - <p><span class="copy"></span> Fabio Cevasco &ndash; June 10, 2020</p> + <p><span class="copy"></span> Fabio Cevasco &ndash; July 5, 2020</p> <p><span>Powered by</span> <a href="https://h3rald.com/hastyscribe"><span class="hastyscribe"></span></a></p> </div> </div>
M docs/css/style.cssdocs/css/style.css

@@ -95,3 +95,7 @@

h4 { font-size: 16px; } + +a.button { + margin: 0; +}
M docs/example/assets/js/h3.jsdocs/example/assets/js/h3.js

@@ -1,9 +1,9 @@

/** - * H3 v0.8.0 "Humble Human" + * H3 v0.9.0 "Impeccable Iconian" * Copyright 2020 Fabio Cevasco <h3rald@h3rald.com> - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * + * @license MIT + * For the full license, see: https://github.com/h3rald/h3/blob/master/LICENSE */ const checkProperties = (obj1, obj2) => { for (const key in obj1) {

@@ -59,7 +59,7 @@ }

return checkProperties(obj1, obj2); // && checkProperties(obj2, obj1); }; -const selectorRegex = /^([a-z][a-z0-9:_=-]*)(#[a-z0-9:_=-]+)?(\.[^ ]+)*$/i; +const selectorRegex = /^([a-z][a-z0-9:_=-]*)?(#[a-z0-9:_=-]+)?(\.[^ ]+)*$/i; let $onrenderCallbacks = [];

@@ -264,15 +264,15 @@ if (this.id) {

node.id = this.id; } Object.keys(this.attributes).forEach((attr) => { - // Standard attributes (unless falsy) - if (this.attributes[attr]) { + // Set attributes (only if non-empty strings) + if (this.attributes[attr] && typeof this.attributes[attr] === "string") { const a = document.createAttribute(attr); a.value = this.attributes[attr]; node.setAttributeNode(a); } - // Handle boolean attributes - if (this.attributes[attr] === false) { - node[attr] = false; + // Set properties + if (typeof this.attributes[attr] !== "string" || !node[attr]) { + node[attr] = this.attributes[attr]; } }); // Event Listeners

@@ -663,13 +663,13 @@ }

const vnode = newRouteComponent(newRouteComponent.state); const node = vnode.render(); this.element.appendChild(node); + this.setRedraw(vnode, newRouteComponent.state); + redrawing = false; vnode.$onrender && vnode.$onrender(node); $onrenderCallbacks.forEach((cbk) => cbk()); $onrenderCallbacks = []; - this.setRedraw(vnode, newRouteComponent.state); window.scrollTo(0, 0); this.store.dispatch("$redraw"); - redrawing = false; }; window.addEventListener("hashchange", processPath); await processPath();
M docs/js/app.jsdocs/js/app.js

@@ -44,8 +44,8 @@ h3("a.logo.col-sm-1", { href: "#/" }, [

h3("img", { alt: "H3", src: "images/h3.svg" }), ]), h3("div.version.col-sm.col-md", [ - h3("div.version-number", "v0.8.0"), - h3("div.version-label", "“Humble Human“"), + h3("div.version-number", "v0.9.0"), + h3("div.version-label", "“Impeccable Iconian“"), ]), h3("label.drawer-toggle.button.col-sm-last", { for: "drawer-control" }), ]);
M docs/js/h3.jsdocs/js/h3.js

@@ -1,9 +1,9 @@

/** - * H3 v0.8.0 "Humble Human" + * H3 v0.9.0 "Impeccable Iconian" * Copyright 2020 Fabio Cevasco <h3rald@h3rald.com> - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * + * @license MIT + * For the full license, see: https://github.com/h3rald/h3/blob/master/LICENSE */ const checkProperties = (obj1, obj2) => { for (const key in obj1) {

@@ -59,7 +59,7 @@ }

return checkProperties(obj1, obj2); // && checkProperties(obj2, obj1); }; -const selectorRegex = /^([a-z][a-z0-9:_=-]*)(#[a-z0-9:_=-]+)?(\.[^ ]+)*$/i; +const selectorRegex = /^([a-z][a-z0-9:_=-]*)?(#[a-z0-9:_=-]+)?(\.[^ ]+)*$/i; let $onrenderCallbacks = [];

@@ -264,15 +264,15 @@ if (this.id) {

node.id = this.id; } Object.keys(this.attributes).forEach((attr) => { - // Standard attributes (unless falsy) - if (this.attributes[attr]) { + // Set attributes (only if non-empty strings) + if (this.attributes[attr] && typeof this.attributes[attr] === "string") { const a = document.createAttribute(attr); a.value = this.attributes[attr]; node.setAttributeNode(a); } - // Handle boolean attributes - if (this.attributes[attr] === false) { - node[attr] = false; + // Set properties + if (typeof this.attributes[attr] !== "string" || !node[attr]) { + node[attr] = this.attributes[attr]; } }); // Event Listeners

@@ -663,13 +663,13 @@ }

const vnode = newRouteComponent(newRouteComponent.state); const node = vnode.render(); this.element.appendChild(node); + this.setRedraw(vnode, newRouteComponent.state); + redrawing = false; vnode.$onrender && vnode.$onrender(node); $onrenderCallbacks.forEach((cbk) => cbk()); $onrenderCallbacks = []; - this.setRedraw(vnode, newRouteComponent.state); window.scrollTo(0, 0); this.store.dispatch("$redraw"); - redrawing = false; }; window.addEventListener("hashchange", processPath); await processPath();
M docs/md/overview.mddocs/md/overview.md

@@ -4,7 +4,7 @@ **H3** is a microframework to build client-side single-page applications (SPAs) in modern JavaScript.

H3 is also: -- **tiny**, under [800 sloc](https://github.com/h3rald/h3/blob/master/h3.js). +- **tiny**, less than 4KB minified gzipped. - **modern**, in the sense that it runs only in modern browsers (latest versions of Chrome, Firefox, Edge & similar). - **easy** to learn, its API is comprised of only six methods and two properties.

@@ -12,7 +12,9 @@ ### I'm sold! Where can I get it?

Here, look, it's just one file: -<a href="https://raw.githubusercontent.com/h3rald/h3/v0.8.0/h3.js" target="_blank" class="button primary">Download v0.8.0 (Humble Human)</a> +<a href="https://raw.githubusercontent.com/h3rald/h3/v0.9.0/h3.js" target="_blank" class="button primary">Download v0.9.0 (Impeccable Iconian)</a> + +<small>Or get the minified version [here](https://raw.githubusercontent.com/h3rald/h3/v0.9.0/h3.min.js).</small> Yes there is also a [NPM package](https://www.npmjs.com/package/@h3rald/h3) if you want to use it with WebPack and similar, but let me repeat: _it's just one file_.

@@ -33,7 +35,7 @@ Have a look at the code of a [simple todo list](https://github.com/h3rald/h3/tree/master/docs/example) ([demo](https://h3.js.org/example/index.html)) with several components, a store and some routing.

### No, I meant a real web application... -OK, have a look at [litepad.h3rald.com](https://litepad.h3rald.com) &mdash; it's a powerful notepad application that demonstrates how to create custom controls, route components, forms, and integrate third-party tools. The code is of course [on GitHub](https://github.com/h3rald/litepad) +OK, have a look at [litepad.h3rald.com](https://litepad.h3rald.com) &mdash; it's a powerful notepad application that demonstrates how to create custom controls, route components, forms, and integrate third-party tools. The code is of course [on GitHub](https://github.com/h3rald/litepad). ### Can I use it then, no strings attached?
M docs/md/tutorial.mddocs/md/tutorial.md

@@ -118,8 +118,8 @@ h3("a.logo.col-sm-1", { href: "#/" }, [

h3("img", { alt: "H3", src: "images/h3.svg" }), ]), h3("div.version.col-sm.col-md", [ - h3("div.version-number", "v0.8.0"), - h3("div.version-label", "“Humble Human“"), + h3("div.version-number", "v0.9.0"), + h3("div.version-label", "“Impeccable Iconian“"), ]), h3("label.drawer-toggle.button.col-sm-last", { for: "drawer-control" }), ]);
M h3.jsh3.js

@@ -1,9 +1,9 @@

/** - * H3 v0.8.0 "Humble Human" + * H3 v0.9.0 "Impeccable Iconian" * Copyright 2020 Fabio Cevasco <h3rald@h3rald.com> - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * + * @license MIT + * For the full license, see: https://github.com/h3rald/h3/blob/master/LICENSE */ const checkProperties = (obj1, obj2) => { for (const key in obj1) {

@@ -59,7 +59,7 @@ }

return checkProperties(obj1, obj2); // && checkProperties(obj2, obj1); }; -const selectorRegex = /^([a-z][a-z0-9:_=-]*)(#[a-z0-9:_=-]+)?(\.[^ ]+)*$/i; +const selectorRegex = /^([a-z][a-z0-9:_=-]*)?(#[a-z0-9:_=-]+)?(\.[^ ]+)*$/i; let $onrenderCallbacks = [];

@@ -264,15 +264,15 @@ if (this.id) {

node.id = this.id; } Object.keys(this.attributes).forEach((attr) => { - // Standard attributes (unless falsy) - if (this.attributes[attr]) { + // Set attributes (only if non-empty strings) + if (this.attributes[attr] && typeof this.attributes[attr] === "string") { const a = document.createAttribute(attr); a.value = this.attributes[attr]; node.setAttributeNode(a); } - // Handle boolean attributes - if (this.attributes[attr] === false) { - node[attr] = false; + // Set properties + if (typeof this.attributes[attr] !== "string" || !node[attr]) { + node[attr] = this.attributes[attr]; } }); // Event Listeners

@@ -663,13 +663,13 @@ }

const vnode = newRouteComponent(newRouteComponent.state); const node = vnode.render(); this.element.appendChild(node); + this.setRedraw(vnode, newRouteComponent.state); + redrawing = false; vnode.$onrender && vnode.$onrender(node); $onrenderCallbacks.forEach((cbk) => cbk()); $onrenderCallbacks = []; - this.setRedraw(vnode, newRouteComponent.state); window.scrollTo(0, 0); this.store.dispatch("$redraw"); - redrawing = false; }; window.addEventListener("hashchange", processPath); await processPath();
A h3.js.map

@@ -0,0 +1,1 @@

+{"version":3,"sources":["0"],"names":["checkProperties","obj1","obj2","key","equal","undefined","constructor","toString","String","Number","Boolean","includes","Array","length","i","selectorRegex","$onrenderCallbacks","VNode","[object Object]","args","this","type","attributes","data","id","$html","$onrender","style","value","children","classList","eventListeners","Error","vnode","processSelector","from","processVNodeObject","selector","isArray","Function","processChildren","processProperties","props","a","b","attrs","Object","keys","filter","startsWith","forEach","slice","match","classes","split","arg","map","c","document","createTextNode","node","createElement","attr","createAttribute","setAttributeNode","event","addEventListener","cssText","add","dataset","cnode","render","appendChild","push","innerHTML","newvnode","oldvnode","renderedNode","parentNode","replaceChild","mapChildren","oldNodesFound","newNodesFound","oldIndex","found","index","newIndex","splice","remove","setAttribute","removeAttribute","removeEventListener","childMap","resultMap","count","breakFor","redraw","childNodes","insertBefore","removeChild","vtarget","Store","events","state","dispatch","cb","Route","path","def","query","parts","params","p","name","decodeURIComponent","Router","element","routes","store","location","window","route","processPath","async","oldRoute","fragment","newURL","hash","replace","rawQuery","pathParts","routeParts","rP","pP","oldRouteComponent","teardown","newRouteComponent","setup","redrawing","firstChild","setRedraw","cbk","scrollTo","encodeURIComponent","join","h3","router","init","config","modules","preStart","postStart","/","body","Element","Promise","resolve","then","start","navigateTo","defineProperty","get","on","setRedrawing"],"mappings":";;;;;;;AAOA,MAAMA,gBAAkB,CAACC,EAAMC,KAC7B,IAAK,MAAMC,KAAOF,EAAM,CACtB,KAAME,KAAOD,GACX,OAAO,EAET,IAAKE,MAAMH,EAAKE,GAAMD,EAAKC,IACzB,OAAO,EAGX,OAAO,GAGHC,MAAQ,CAACH,EAAMC,KACnB,GACY,OAATD,GAA0B,OAATC,QACRG,IAATJ,QAA+BI,IAATH,EAEvB,OAAO,EAET,QACYG,IAATJ,QAA+BI,IAATH,QACbG,IAATJ,QAA+BI,IAATH,GACb,OAATD,GAA0B,OAATC,GACR,OAATD,GAA0B,OAATC,EAElB,OAAO,EAET,GAAID,EAAKK,cAAgBJ,EAAKI,YAC5B,OAAO,EAET,GAAoB,mBAATL,GACLA,EAAKM,aAAeL,EAAKK,WAC3B,OAAO,EAGX,GAAI,CAACC,OAAQC,OAAQC,SAASC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IAAItF,MACR,4EAGJ,OAAOsF,MAAMf,SAIjB0C,GAAGiB,GAAK,CAACjG,EAAOwC,KACd,IAAKa,MACH,MAAM,IAAItF,MACR,mEAGJ,OAAOsF,MAAM4C,GAAGjG,EAAOwC,IAGzBwC,GAAGzC,SAAW,CAACvC,EAAO1C,KACpB,IAAK+F,MACH,MAAM,IAAItF,MACR,wEAGJ,OAAOsF,MAAMd,SAASvC,EAAO1C,IAG/B0H,GAAGjD,OAAUmE,IACX,IAAKjB,SAAWA,OAAOlD,OACrB,MAAM,IAAIhE,MACR,6DAGA0G,YAGJA,WAAY,EACZQ,OAAOlD,SACP0C,UAAYyB,IAAgB,mBAGflB","file":"h3.js"}
A h3.min.js

@@ -0,0 +1,9 @@

+/** + * H3 v0.9.0 "Impeccable Iconian" + * Copyright 2020 Fabio Cevasco <h3rald@h3rald.com> + * + * @license MIT + * For the full license, see: https://github.com/h3rald/h3/blob/master/LICENSE + */ +const checkProperties=(e,t)=>{for(const r in e){if(!(r in t))return!1;if(!equal(e[r],t[r]))return!1}return!0},equal=(e,t)=>{if(null===e&&null===t||void 0===e&&void 0===t)return!0;if(void 0===e&&void 0!==t||void 0!==e&&void 0===t||null===e&&null!==t||null!==e&&null===t)return!1;if(e.constructor!==t.constructor)return!1;if("function"==typeof e&&e.toString()!==t.toString())return!1;if([String,Number,Boolean].includes(e.constructor))return e===t;if(e.constructor===Array){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(!equal(e[r],t[r]))return!1;return!0}return checkProperties(e,t)},selectorRegex=/^([a-z][a-z0-9:_=-]*)?(#[a-z0-9:_=-]+)?(\.[^ ]+)*$/i;let $onrenderCallbacks=[];class VNode{constructor(...e){if(this.type=void 0,this.attributes={},this.data={},this.id=void 0,this.$html=void 0,this.$onrender=void 0,this.style=void 0,this.value=void 0,this.children=[],this.classList=[],this.eventListeners={},0===e.length)throw new Error("[VNode] No arguments passed to VNode constructor.");if(1===e.length){let t=e[0];if("string"==typeof t)this.processSelector(t);else{if("function"!=typeof t&&("object"!=typeof t||null===t))throw new Error("[VNode] Invalid first argument passed to VNode constructor.");"#text"===t.type?(this.type="#text",this.value=t.value):this.from(this.processVNodeObject(t))}}else if(2===e.length){let[t,r]=e;if("string"!=typeof t)throw new Error("[VNode] Invalid first argument passed to VNode constructor.");if(this.processSelector(t),"string"==typeof r)return void(this.children=[new VNode({type:"#text",value:r})]);if("function"!=typeof r&&("object"!=typeof r||null===r))throw new Error("[VNode] The second argument of a VNode constructor must be an object, an array or a string.");Array.isArray(r)||r instanceof Function||r instanceof VNode?this.processChildren(r):this.processProperties(r)}else{if(3!==e.length)throw new Error("[VNode] Too many arguments passed to VNode constructor.");{let[t,r,s]=e;if("string"!=typeof t)throw new Error("[VNode] Invalid first argument passed to VNode constructor.");if(this.processSelector(t),"object"!=typeof r||null===r)throw new Error("[VNode] Invalid second argument passed to VNode constructor.");this.processProperties(r),this.processChildren(s)}}}from(e){this.value=e.value,this.type=e.type,this.id=e.id,this.$html=e.$html,this.$onrender=e.$onrender,this.style=e.style,this.data=e.data,this.value=e.value,this.eventListeners=e.eventListeners,this.children=e.children,this.attributes=e.attributes,this.classList=e.classList}equal(e,t){return equal(e,void 0===t?this:t)}processProperties(e){this.id=this.id||e.id,this.$html=e.$html,this.$onrender=e.$onrender,this.style=e.style,this.value=e.value,this.data=e.data||{},this.classList=e.classList&&e.classList.length>0?e.classList:this.classList,this.attributes=e,Object.keys(e).filter(t=>t.startsWith("on")&&e[t]).forEach(t=>{if("function"!=typeof e[t])throw new Error(`[VNode] Event handler specified for ${t} event is not a function.`);this.eventListeners[t.slice(2)]=e[t],delete this.attributes[t]}),delete this.attributes.value,delete this.attributes.$html,delete this.attributes.$onrender,delete this.attributes.id,delete this.attributes.data,delete this.attributes.style,delete this.attributes.classList}processSelector(e){if(!e.match(selectorRegex))throw new Error("[VNode] Invalid selector: "+e);const[,t,r,s]=e.match(selectorRegex);this.type=t,r&&(this.id=r.slice(1)),this.classList=s&&s.split(".").slice(1)||[]}processVNodeObject(e){if(e instanceof VNode)return e;if(e instanceof Function){let t=e();if("string"==typeof t&&(t=new VNode({type:"#text",value:t})),!(t instanceof VNode))throw new Error("[VNode] Function argument does not return a VNode");return t}throw new Error("[VNode] Invalid first argument provided to VNode constructor.")}processChildren(e){const t=Array.isArray(e)?e:[e];this.children=t.map(e=>{if("string"==typeof e)return new VNode({type:"#text",value:e});if("function"==typeof e||"object"==typeof e&&null!==e)return this.processVNodeObject(e);if(e)throw new Error("[VNode] Specified child is not a VNode: "+e)}).filter(e=>e)}render(){if("#text"===this.type)return document.createTextNode(this.value);const e=document.createElement(this.type);return this.id&&(e.id=this.id),Object.keys(this.attributes).forEach(t=>{if(this.attributes[t]&&"string"==typeof this.attributes[t]){const r=document.createAttribute(t);r.value=this.attributes[t],e.setAttributeNode(r)}"string"==typeof this.attributes[t]&&e[t]||(e[t]=this.attributes[t])}),Object.keys(this.eventListeners).forEach(t=>{e.addEventListener(t,this.eventListeners[t])}),this.value&&(e.value=this.value),this.style&&(e.style.cssText=this.style),this.classList.forEach(t=>{e.classList.add(t)}),Object.keys(this.data).forEach(t=>{e.dataset[t]=this.data[t]}),this.children.forEach(t=>{const r=t.render();e.appendChild(r),t.$onrender&&$onrenderCallbacks.push(()=>t.$onrender(r))}),this.$html&&(e.innerHTML=this.$html),e}redraw(e){let{node:t,vnode:r}=e;const s=r,i=this;if(i.constructor!==s.constructor||i.type!==s.type||i.type===s.type&&"#text"===i.type&&i!==s){const e=s.render();return t.parentNode.replaceChild(e,t),s.$onrender&&s.$onrender(e),void i.from(s)}function n(e,t){let r=[],s=0,i=0;for(let n=0;n<e.children.length;n++){let o=-1;for(let a=0;a<t.children.length;a++)if(equal(e.children[n],t.children[a])&&!r.includes(a)){o=a,i++,s++;break}r.push(o)}if(i===s&&t.children.length===e.children.length)return r;if(i===t.children.length)for(let e=0;e<r.length;e++)-1===r[e]&&(r[e]=-3);if(s===e.children.length)for(let e=0;e<t.children.length;e++)r.includes(e)||r.splice(e,0,-2);if(t.children.length<e.children.length)for(let e=0;e<r.length;e++)-1!==r[e]||t.children[e]||(r[e]=-3);return r}i.id!==s.id&&(t.id=s.id||"",i.id=s.id),i.value!==s.value&&(t.value=s.value||"",i.value=s.value),equal(i.classList,s.classList)||(i.classList.forEach(e=>{s.classList.includes(e)||t.classList.remove(e)}),s.classList.forEach(e=>{i.classList.includes(e)||t.classList.add(e)}),i.classList=s.classList),i.style!==s.style&&(t.style.cssText=s.style||"",i.style=s.style),equal(i.data,s.data)||(Object.keys(i.data).forEach(e=>{s.data[e]?s.data[e]!==i.data[e]&&(t.dataset[e]=s.data[e]):delete t.dataset[e]}),Object.keys(s.data).forEach(e=>{i.data[e]||(t.dataset[e]=s.data[e])}),i.data=s.data),equal(i.attributes,s.attributes)||(Object.keys(i.attributes).forEach(e=>{!1===s.attributes[e]&&(t[e]=!1),s.attributes[e]?s.attributes[e]&&s.attributes[e]!==i.attributes[e]&&t.setAttribute(e,s.attributes[e]):t.removeAttribute(e)}),Object.keys(s.attributes).forEach(e=>{!i.attributes[e]&&s.attributes[e]&&t.setAttribute(e,s.attributes[e])}),i.attributes=s.attributes),equal(i.eventListeners,s.eventListeners)||(Object.keys(i.eventListeners).forEach(e=>{s.eventListeners[e]?equal(s.eventListeners[e],i.eventListeners[e])||(t.removeEventListener(e,i.eventListeners[e]),t.addEventListener(e,s.eventListeners[e])):t.removeEventListener(e,i.eventListeners[e])}),Object.keys(s.eventListeners).forEach(e=>{i.eventListeners[e]||t.addEventListener(e,s.eventListeners[e])}),i.eventListeners=s.eventListeners);let o=n(i,s),a=[...Array(o.filter(e=>-3!==e).length).keys()];for(;!equal(o,a);){let e=-1;for(let r of o){e++;let n=!1;if(r!==e){switch(r){case-1:i.children[e].redraw({node:t.childNodes[e],vnode:s.children[e]});break;case-2:i.children.splice(e,0,s.children[e]);const o=s.children[e].render();t.insertBefore(o,t.childNodes[e]),s.children[e].$onrender&&s.children[e].$onrender(o),n=!0;break;case-3:i.children.splice(e,1),t.removeChild(t.childNodes[e]),n=!0;break;default:const a=i.children.splice(r,1)[0];i.children.splice(e,0,a),t.insertBefore(t.childNodes[r],t.childNodes[e]),n=!0}if(n)break}}o=n(i,s),a=[...Array(o.length).keys()]}equal(i.$onrender,s.$onrender)||(i.$onrender=s.$onrender),i.$html!==s.$html&&(t.innerHTML=s.$html,i.$html=s.$html,i.$onrender&&i.$onrender(t))}}class Store{constructor(){this.events={},this.state={}}dispatch(e,t){if("$log"!==e&&this.dispatch("$log",{event:e,data:t}),this.events[e]){this.events[e].forEach(e=>{this.state={...this.state,...e(this.state,t)}})}}on(e,t){return(this.events[e]||(this.events[e]=[])).push(t),()=>{this.events[e]=this.events[e].filter(e=>e!==t)}}}class Route{constructor({path:e,def:t,query:r,parts:s}){if(this.path=e,this.def=t,this.query=r,this.parts=s,this.params={},this.query){this.query.split("&").forEach(e=>{const[t,r]=e.split("=");this.params[decodeURIComponent(t)]=decodeURIComponent(r)})}}}class Router{constructor({element:e,routes:t,store:r,location:s}){if(this.element=e,this.redraw=null,this.store=r,this.location=s||window.location,!t||0===Object.keys(t).length)throw new Error("[Router] No routes defined.");Object.keys(t);this.routes=t}setRedraw(e,t){this.redraw=()=>{e.redraw({node:this.element.childNodes[0],vnode:this.routes[this.route.def](t)}),this.store.dispatch("$redraw")}}async start(){const e=async e=>{const t=this.route,r=e&&e.newURL&&e.newURL.match(/(#.+)$/)&&e.newURL.match(/(#.+)$/)[1]||this.location.hash,s=r.replace(/\?.+$/,"").slice(1),i=r.match(/\?(.+)$/),n=i&&i[1]?i[1]:"",o=s.split("/").slice(1);let a={};for(let e of Object.keys(this.routes)){let t=e.split("/").slice(1),r=!0,i=0;for(a={};r&&t[i];){const e=t[i],s=o[i];e.startsWith(":")&&s?a[e.slice(1)]=s:r=e===s,i++}if(r){this.route=new Route({query:n,path:s,def:e,parts:a});break}}if(!this.route)throw new Error(`[Router] No route matches '${r}'`);if(t){const e=this.routes[t.def];e.state=e.teardown&&await e.teardown(e.state)}const l=this.routes[this.route.def];for(l.state={},l.setup&&await l.setup(l.state),redrawing=!0,this.store.dispatch("$navigation",this.route);this.element.firstChild;)this.element.removeChild(this.element.firstChild);const h=l(l.state),d=h.render();this.element.appendChild(d),this.setRedraw(h,l.state),redrawing=!1,h.$onrender&&h.$onrender(d),$onrenderCallbacks.forEach(e=>e()),$onrenderCallbacks=[],window.scrollTo(0,0),this.store.dispatch("$redraw")};window.addEventListener("hashchange",e),await e()}navigateTo(e,t){let r=Object.keys(t||{}).map(e=>`${encodeURIComponent(e)}=${encodeURIComponent(t[e])}`).join("&");r=r?"?"+r:"",this.location.hash=`#${e}${r}`}}const h3=(...e)=>new VNode(...e);let store=null,router=null,redrawing=!1;h3.init=e=>{let{element:t,routes:r,modules:s,preStart:i,postStart:n,location:o}=e;if(!r){if("function"!=typeof e)throw new Error("[h3.init] The specified argument is not a valid configuration object or component function");r={"/":e}}if(t=t||document.body,!(t&&t instanceof Element))throw new Error("[h3.init] Invalid element specified.");return store=new Store,(s||[]).forEach(e=>{e(store)}),store.dispatch("$init"),router=new Router({element:t,routes:r,store:store,location:o}),Promise.resolve(i&&i()).then(()=>router.start()).then(()=>n&&n())},h3.navigateTo=(e,t)=>{if(!router)throw new Error("[h3.navigateTo] No application initialized, unable to navigate.");return router.navigateTo(e,t)},Object.defineProperty(h3,"route",{get:()=>{if(!router)throw new Error("[h3.route] No application initialized, unable to retrieve current route.");return router.route}}),Object.defineProperty(h3,"state",{get:()=>{if(!store)throw new Error("[h3.state] No application initialized, unable to retrieve current state.");return store.state}}),h3.on=(e,t)=>{if(!store)throw new Error("[h3.on] No application initialized, unable to listen to events.");return store.on(e,t)},h3.dispatch=(e,t)=>{if(!store)throw new Error("[h3.dispatch] No application initialized, unable to dispatch events.");return store.dispatch(e,t)},h3.redraw=e=>{if(!router||!router.redraw)throw new Error("[h3.redraw] No application initialized, unable to redraw.");redrawing||(redrawing=!0,router.redraw(),redrawing=e||!1)};export default h3; +//# sourceMappingURL=h3.js.map
M package-lock.jsonpackage-lock.json

@@ -1,6 +1,6 @@

{ - "name": "h3js", - "version": "0.1.0", + "name": "@h3rald/h3", + "version": "0.9.0", "lockfileVersion": 1, "requires": true, "dependencies": {

@@ -1896,6 +1896,12 @@ "dev": true,

"requires": { "delayed-stream": "~1.0.0" } + }, + "commander": { + "version": "2.20.3", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", + "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", + "dev": true }, "component-emitter": { "version": "1.3.0",

@@ -5124,6 +5130,17 @@ "dev": true,

"requires": { "ansi-escapes": "^4.2.1", "supports-hyperlinks": "^2.0.0" + } + }, + "terser": { + "version": "4.8.0", + "resolved": "https://registry.npmjs.org/terser/-/terser-4.8.0.tgz", + "integrity": "sha512-EAPipTNeWsb/3wLPeup1tVPaXfIaU68xMnVdPafIL1TV05OhASArYyIfFvnvJCNrR2NIOvDVNNTFRa+Re2MWyw==", + "dev": true, + "requires": { + "commander": "^2.20.0", + "source-map": "~0.6.1", + "source-map-support": "~0.5.12" } }, "test-exclude": {
M package.jsonpackage.json

@@ -1,7 +1,7 @@

{ "name": "@h3rald/h3", - "version": "0.8.0", - "versionName": "Humble Human", + "version": "0.9.0", + "versionName": "Impeccable Iconian", "description": "A tiny, extremely minimalist JavaScript microframework.", "main": "h3.js", "scripts": {

@@ -38,6 +38,7 @@ "devDependencies": {

"@babel/plugin-transform-modules-commonjs": "^7.9.0", "@babel/preset-env": "^7.9.5", "coveralls": "^3.0.11", - "jest": "^25.3.0" + "jest": "^25.3.0", + "terser": "^4.8.0" } }
M scripts/release.jsscripts/release.js

@@ -1,5 +1,6 @@

const fs = require("fs"); const path = require("path"); +const terser = require("terser"); const readme = "./README.md"; const overview = "./docs/md/overview.md";

@@ -7,22 +8,36 @@ const app = "./docs/js/app.js";

const tutorial = "./docs/md/tutorial.md"; const package = "./package.json"; const h3 = "./h3.js"; +const h3min = "./h3.min.js"; +const h3map = "./h3.js.map"; const pkg = JSON.parse(fs.readFileSync(package, "utf8")); // Update h3.js -const h3Data = fs.readFileSync(h3, "utf8"); +let h3Data = fs.readFileSync(h3, "utf8"); const notice = h3Data.match(/\/\*\*((.|\n|\r)+?)\*\//gm)[0]; const newNotice = notice .replace(/v\d+\.\d+\.\d+/, `v${pkg.version}`) .replace(/\"[^"]+\"/, `"${pkg.versionName}"`) .replace(/Copyright \d+/, `Copyright ${new Date().getFullYear()}`); -fs.writeFileSync(h3, h3Data.replace(notice, newNotice)); - +h3Data = h3Data.replace(notice, newNotice); +fs.writeFileSync(h3, h3Data); +const minified = terser.minify(h3Data, { + sourceMap: { filename: "h3.js", url: "h3.js.map" }, +}); +fs.writeFileSync( + h3min, + minified.code +); +fs.writeFileSync( + h3map, + minified.map +); // Update README.md let readmeData = fs.readFileSync(readme, "utf8"); +readmeData = readmeData.replace(/v\d+\.\d+\.\d+/, `v${pkg.version}`); readmeData = readmeData.replace(/v\d+\.\d+\.\d+/, `v${pkg.version}`); readmeData = readmeData.replace( /Download v\d+\.\d+\.\d+ \([^)]+\)/,