all repos — h3 @ bf85a2101d1d9ed083a15ad2113836eea5490cfe

A tiny, extremely minimalist JavaScript microframework.

Renamed attributes to props.
h3rald h3rald@h3rald.com
Sun, 12 Jul 2020 11:36:28 +0200
commit

bf85a2101d1d9ed083a15ad2113836eea5490cfe

parent

d1fc233ec18eca627142e5a4985afa3369b1ca0d

7 files changed, 121 insertions(+), 118 deletions(-)

jump to
M __tests__/h3.js__tests__/h3.js

@@ -27,7 +27,7 @@ it("should support the creation of empty virtual node elements", () => {

expect(h3("div")).toEqual({ type: "div", children: [], - attributes: {}, + props: {}, classList: [], data: {}, eventListeners: {},

@@ -94,7 +94,7 @@ children: [

{ type: "#text", children: [], - attributes: {}, + props: {}, classList: [], data: {}, eventListeners: {},

@@ -104,7 +104,7 @@ style: undefined,

value: "test", }, ], - attributes: {}, + props: {}, classList: [], data: {}, eventListeners: {},

@@ -124,7 +124,7 @@ const b = h3("div", { classList: ["a", "b", "c"] });

expect(a).toEqual({ type: "div", children: [], - attributes: {}, + props: {}, classList: ["a", "b", "c"], data: {}, eventListeners: {},

@@ -137,13 +137,13 @@ });

expect(a).toEqual(b); }); - it("should support the creation of virtual node elements with attributes and classes", () => { + it("should support the creation of virtual node elements with props and classes", () => { expect(h3("div.test1.test2", { id: "test" })).toEqual({ type: "div", children: [], classList: ["test1", "test2"], data: {}, - attributes: {}, + props: {}, eventListeners: {}, id: "test", $html: undefined,

@@ -158,7 +158,7 @@ expect(h3("div.test", ["a", "b"])).toEqual({

type: "div", children: [ { - attributes: {}, + props: {}, children: [], classList: [], data: {},

@@ -170,7 +170,7 @@ type: "#text",

value: "a", }, { - attributes: {}, + props: {}, children: [], classList: [], data: {},

@@ -182,7 +182,7 @@ type: "#text",

value: "b", }, ], - attributes: {}, + props: {}, classList: ["test"], data: {}, eventListeners: {},

@@ -193,14 +193,14 @@ value: undefined,

}); }); - it("should support the creation of virtual node elements with text children, attributes, and classes", () => { + it("should support the creation of virtual node elements with text children, props, and classes", () => { expect( h3("div.test", { title: "Test...", id: "test" }, ["a", "b"]) ).toEqual({ type: "div", children: [ { - attributes: {}, + props: {}, children: [], classList: [], data: {},

@@ -212,7 +212,7 @@ type: "#text",

value: "a", }, { - attributes: {}, + props: {}, children: [], classList: [], data: {},

@@ -230,12 +230,12 @@ id: "test",

$html: undefined, style: undefined, value: undefined, - attributes: { title: "Test..." }, + props: { title: "Test..." }, classList: ["test"], }); }); - it("should support the creation of virtual node elements with attributes", () => { + it("should support the creation of virtual node elements with props", () => { expect(h3("input", { type: "text", value: "AAA" })).toEqual({ type: "input", children: [],

@@ -245,7 +245,7 @@ id: undefined,

$html: undefined, style: undefined, value: "AAA", - attributes: { type: "text" }, + props: { type: "text" }, classList: [], }); });

@@ -263,7 +263,7 @@ id: undefined,

$html: undefined, style: undefined, value: undefined, - attributes: {}, + props: {}, classList: [], }); expect(() => h3("span", { onclick: "something" })).toThrowError(

@@ -275,11 +275,11 @@ it("should support the creation of virtual node elements with element children and classes", () => {

expect( h3("div.test", ["a", h3("span", ["test1"]), () => h3("span", ["test2"])]) ).toEqual({ - attributes: {}, + props: {}, type: "div", children: [ { - attributes: {}, + props: {}, children: [], classList: [], data: {},

@@ -294,7 +294,7 @@ {

type: "span", children: [ { - attributes: {}, + props: {}, children: [], classList: [], data: {},

@@ -306,7 +306,7 @@ type: "#text",

value: "test1", }, ], - attributes: {}, + props: {}, classList: [], data: {}, eventListeners: {},

@@ -319,7 +319,7 @@ {

type: "span", children: [ { - attributes: {}, + props: {}, children: [], classList: [], data: {},

@@ -331,7 +331,7 @@ type: "#text",

value: "test2", }, ], - attributes: {}, + props: {}, classList: [], data: {}, eventListeners: {},
M __tests__/vnode.js__tests__/vnode.js

@@ -11,7 +11,7 @@ $html: "",

data: { a: "1", b: "2" }, eventListeners: { click: fn }, children: [], - attributes: { title: "test" }, + props: { title: "test" }, classList: ["a1", "a2"], style: "padding: 2px", };

@@ -44,7 +44,7 @@ expect(createElement).toHaveBeenCalledWith("br");

expect(node.constructor).toEqual(HTMLBRElement); }); - it("should provide a render method able to render element nodes with attributes and classes", () => { + it("should provide a render method able to render element nodes with props and classes", () => { const createElement = jest.spyOn(document, "createElement"); const vnode = h3("span.test1.test2", { title: "test", falsy: false }); const node = vnode.render();

@@ -66,7 +66,7 @@ expect(node.childNodes[1].constructor).toEqual(HTMLLIElement);

expect(node.childNodes[0].childNodes[0].data).toEqual("test1"); }); - it("should handle boolean attributes when redrawing", () => { + it("should handle boolean props when redrawing", () => { const vnode1 = h3("input", { type: "checkbox", checked: true }); const node = vnode1.render(); expect(node.checked).toEqual(true);

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

expect(node.checked).toEqual(false); }); - it("should handle non-string attributes as properties and not create attributes", () => { + it("should handle non-string props as properties and not create props", () => { const v = h3("div", { test: true, obj: { a: 1, b: 2 },

@@ -128,7 +128,7 @@ expect(node.constructor).toEqual(HTMLButtonElement);

expect(addEventListener).toHaveBeenCalledWith("click", handler); }); - it("it should provide a render method able to render elements with special attributes", () => { + it("it should provide a render method able to render elements with special props", () => { const vnode = h3("div", { id: "test", style: "margin: auto;",

@@ -209,7 +209,7 @@ expect(node.childNodes[1].classList[0]).toEqual("test1");

expect(node.childNodes[2].classList[0]).toEqual("test"); }); - it("should provide a redraw method that is able to update different attributes", () => { + it("should provide a redraw method that is able to update different props", () => { const oldvnode = h3("span", { title: "a", something: "b" }); const newvnode = h3("span", { title: "b", id: "bbb" }); const node = oldvnode.render();

@@ -288,7 +288,7 @@ expect(node.childNodes[0].getAttribute("id")).toEqual("aaa");

expect(node.childNodes[1].getAttribute("id")).toEqual("ccc"); }); - it("should provide a redraw method able to detect specific changes to style, data, value, attributes, $onrender and eventListeners", () => { + it("should provide a redraw method able to detect specific changes to style, data, value, props, $onrender and eventListeners", () => { const fn = () => false; const oldvnode = h3("input", { style: "margin: auto;",
M docs/example/assets/js/h3.jsdocs/example/assets/js/h3.js

@@ -63,9 +63,10 @@ let $onrenderCallbacks = [];

// Virtual Node Implementation with HyperScript-like syntax class VNode { + constructor(...args) { this.type = undefined; - this.attributes = {}; + this.props = {}; this.data = {}; this.id = undefined; this.$html = undefined;

@@ -173,7 +174,7 @@ this.data = data.data;

this.value = data.value; this.eventListeners = data.eventListeners; this.children = data.children; - this.attributes = data.attributes; + this.props = data.props; this.classList = data.classList; }

@@ -192,7 +193,7 @@ this.classList =

attrs.classList && attrs.classList.length > 0 ? attrs.classList : this.classList; - this.attributes = attrs; + this.props = attrs; Object.keys(attrs) .filter((a) => a.startsWith("on") && attrs[a]) .forEach((key) => {

@@ -202,15 +203,15 @@ `[VNode] Event handler specified for ${key} event is not a function.`

); } this.eventListeners[key.slice(2)] = attrs[key]; - delete this.attributes[key]; + delete this.props[key]; }); - 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; + delete this.props.value; + delete this.props.$html; + delete this.props.$onrender; + delete this.props.id; + delete this.props.data; + delete this.props.style; + delete this.props.classList; } processSelector(selector) {

@@ -270,16 +271,16 @@ const node = document.createElement(this.type);

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

@@ -377,27 +378,27 @@ }

}); oldvnode.data = newvnode.data; } - // Attributes - if (!equal(oldvnode.attributes, newvnode.attributes)) { - Object.keys(oldvnode.attributes).forEach((a) => { - if (newvnode.attributes[a] === false) { + // props + if (!equal(oldvnode.props, newvnode.props)) { + Object.keys(oldvnode.props).forEach((a) => { + if (newvnode.props[a] === false) { node[a] = false; } - if (!newvnode.attributes[a]) { + if (!newvnode.props[a]) { node.removeAttribute(a); } else if ( - newvnode.attributes[a] && - newvnode.attributes[a] !== oldvnode.attributes[a] + newvnode.props[a] && + newvnode.props[a] !== oldvnode.props[a] ) { - node.setAttribute(a, newvnode.attributes[a]); + node.setAttribute(a, newvnode.props[a]); } }); - Object.keys(newvnode.attributes).forEach((a) => { - if (!oldvnode.attributes[a] && newvnode.attributes[a]) { - node.setAttribute(a, newvnode.attributes[a]); + Object.keys(newvnode.props).forEach((a) => { + if (!oldvnode.props[a] && newvnode.props[a]) { + node.setAttribute(a, newvnode.props[a]); } }); - oldvnode.attributes = newvnode.attributes; + oldvnode.props = newvnode.props; } // Event listeners if (!equal(oldvnode.eventListeners, newvnode.eventListeners)) {
M docs/js/h3.jsdocs/js/h3.js

@@ -63,9 +63,10 @@ let $onrenderCallbacks = [];

// Virtual Node Implementation with HyperScript-like syntax class VNode { + constructor(...args) { this.type = undefined; - this.attributes = {}; + this.props = {}; this.data = {}; this.id = undefined; this.$html = undefined;

@@ -173,7 +174,7 @@ this.data = data.data;

this.value = data.value; this.eventListeners = data.eventListeners; this.children = data.children; - this.attributes = data.attributes; + this.props = data.props; this.classList = data.classList; }

@@ -192,7 +193,7 @@ this.classList =

attrs.classList && attrs.classList.length > 0 ? attrs.classList : this.classList; - this.attributes = attrs; + this.props = attrs; Object.keys(attrs) .filter((a) => a.startsWith("on") && attrs[a]) .forEach((key) => {

@@ -202,15 +203,15 @@ `[VNode] Event handler specified for ${key} event is not a function.`

); } this.eventListeners[key.slice(2)] = attrs[key]; - delete this.attributes[key]; + delete this.props[key]; }); - 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; + delete this.props.value; + delete this.props.$html; + delete this.props.$onrender; + delete this.props.id; + delete this.props.data; + delete this.props.style; + delete this.props.classList; } processSelector(selector) {

@@ -270,16 +271,16 @@ const node = document.createElement(this.type);

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

@@ -377,27 +378,27 @@ }

}); oldvnode.data = newvnode.data; } - // Attributes - if (!equal(oldvnode.attributes, newvnode.attributes)) { - Object.keys(oldvnode.attributes).forEach((a) => { - if (newvnode.attributes[a] === false) { + // props + if (!equal(oldvnode.props, newvnode.props)) { + Object.keys(oldvnode.props).forEach((a) => { + if (newvnode.props[a] === false) { node[a] = false; } - if (!newvnode.attributes[a]) { + if (!newvnode.props[a]) { node.removeAttribute(a); } else if ( - newvnode.attributes[a] && - newvnode.attributes[a] !== oldvnode.attributes[a] + newvnode.props[a] && + newvnode.props[a] !== oldvnode.props[a] ) { - node.setAttribute(a, newvnode.attributes[a]); + node.setAttribute(a, newvnode.props[a]); } }); - Object.keys(newvnode.attributes).forEach((a) => { - if (!oldvnode.attributes[a] && newvnode.attributes[a]) { - node.setAttribute(a, newvnode.attributes[a]); + Object.keys(newvnode.props).forEach((a) => { + if (!oldvnode.props[a] && newvnode.props[a]) { + node.setAttribute(a, newvnode.props[a]); } }); - oldvnode.attributes = newvnode.attributes; + oldvnode.props = newvnode.props; } // Event listeners if (!equal(oldvnode.eventListeners, newvnode.eventListeners)) {
M h3.jsh3.js

@@ -63,9 +63,10 @@ let $onrenderCallbacks = [];

// Virtual Node Implementation with HyperScript-like syntax class VNode { + constructor(...args) { this.type = undefined; - this.attributes = {}; + this.props = {}; this.data = {}; this.id = undefined; this.$html = undefined;

@@ -173,7 +174,7 @@ this.data = data.data;

this.value = data.value; this.eventListeners = data.eventListeners; this.children = data.children; - this.attributes = data.attributes; + this.props = data.props; this.classList = data.classList; }

@@ -192,7 +193,7 @@ this.classList =

attrs.classList && attrs.classList.length > 0 ? attrs.classList : this.classList; - this.attributes = attrs; + this.props = attrs; Object.keys(attrs) .filter((a) => a.startsWith("on") && attrs[a]) .forEach((key) => {

@@ -202,15 +203,15 @@ `[VNode] Event handler specified for ${key} event is not a function.`

); } this.eventListeners[key.slice(2)] = attrs[key]; - delete this.attributes[key]; + delete this.props[key]; }); - 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; + delete this.props.value; + delete this.props.$html; + delete this.props.$onrender; + delete this.props.id; + delete this.props.data; + delete this.props.style; + delete this.props.classList; } processSelector(selector) {

@@ -270,16 +271,16 @@ const node = document.createElement(this.type);

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

@@ -377,27 +378,27 @@ }

}); oldvnode.data = newvnode.data; } - // Attributes - if (!equal(oldvnode.attributes, newvnode.attributes)) { - Object.keys(oldvnode.attributes).forEach((a) => { - if (newvnode.attributes[a] === false) { + // props + if (!equal(oldvnode.props, newvnode.props)) { + Object.keys(oldvnode.props).forEach((a) => { + if (newvnode.props[a] === false) { node[a] = false; } - if (!newvnode.attributes[a]) { + if (!newvnode.props[a]) { node.removeAttribute(a); } else if ( - newvnode.attributes[a] && - newvnode.attributes[a] !== oldvnode.attributes[a] + newvnode.props[a] && + newvnode.props[a] !== oldvnode.props[a] ) { - node.setAttribute(a, newvnode.attributes[a]); + node.setAttribute(a, newvnode.props[a]); } }); - Object.keys(newvnode.attributes).forEach((a) => { - if (!oldvnode.attributes[a] && newvnode.attributes[a]) { - node.setAttribute(a, newvnode.attributes[a]); + Object.keys(newvnode.props).forEach((a) => { + if (!oldvnode.props[a] && newvnode.props[a]) { + node.setAttribute(a, newvnode.props[a]); } }); - oldvnode.attributes = newvnode.attributes; + oldvnode.props = newvnode.props; } // Event listeners if (!equal(oldvnode.eventListeners, newvnode.eventListeners)) {
M h3.js.maph3.js.map

@@ -1,1 +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","slice","concat","a","b","attrs","Object","keys","filter","startsWith","forEach","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,SAASV,EAAKK,aAC1C,OAAOL,IAASC,EAElB,GAAID,EAAKK,cAAgBM,MAAO,CAC9B,GAAIX,EAAKY,SAAWX,EAAKW,OACvB,OAAO,EAET,IAAK,IAAIC,EAAI,EAAGA,EAAIb,EAAKY,OAAQC,IAC/B,IAAKV,MAAMH,EAAKa,GAAIZ,EAAKY,IACvB,OAAO,EAGX,OAAO,EAET,OAAOd,gBAAgBC,EAAMC,IAGzBa,cAAgB,sDAEtB,IAAIC,mBAAqB,GAGzB,MAAMC,MACJC,eAAeC,GAYb,GAXAC,KAAKC,UAAOhB,EACZe,KAAKE,WAAa,GAClBF,KAAKG,KAAO,GACZH,KAAKI,QAAKnB,EACVe,KAAKK,WAAQpB,EACbe,KAAKM,eAAYrB,EACjBe,KAAKO,WAAQtB,EACbe,KAAKQ,WAAQvB,EACbe,KAAKS,SAAW,GAChBT,KAAKU,UAAY,GACjBV,KAAKW,eAAiB,GACF,IAAhBZ,EAAKN,OACP,MAAM,IAAImB,MAAM,qDAElB,GAAoB,IAAhBb,EAAKN,O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,MAAM,IAAIrH,MACR,8FAGJsF,EAAS,CAAEmC,IAAKJ,GAGlB,GADAhC,EAAUA,GAAW1D,SAAS+F,OACxBrC,GAAWA,aAAmBsC,SAClC,MAAM,IAAI3H,MAAM,wCAUlB,OAPAuF,MAAQ,IAAIjB,OACXgD,GAAW,IAAIlG,QAAStC,IACvBA,EAAEyG,SAEJA,MAAMd,SAAS,SAEf0C,OAAS,IAAI/B,OAAO,CAAEC,QAAAA,EAASC,OAAAA,EAAQC,MAAAA,MAAOC,SAAAA,IACvCoC,QAAQC,QAAQN,GAAYA,KAChCO,KAAK,IAAMX,OAAOY,SAClBD,KAAK,IAAMN,GAAaA,MAG7BN,GAAGc,WAAa,CAACpD,EAAMI,KACrB,IAAKmC,OACH,MAAM,IAAInH,MACR,mEAGJ,OAAOmH,OAAOa,WAAWpD,EAAMI,IAGjChE,OAAOiH,eAAef,GAAI,QAAS,CACjCgB,IAAK,KACH,IAAKf,OACH,MAAM,IAAInH,MACR,4EAGJ,OAAOmH,OAAOzB,SAIlB1E,OAAOiH,eAAef,GAAI,QAAS,CACjCgB,IAAK,KACH,IAAK3C,MACH,MAAM,IAAIvF,MACR,4EAGJ,OAAOuF,MAAMf,SAIjB0C,GAAGiB,GAAK,CAACjG,EAAOwC,KACd,IAAKa,MACH,MAAM,IAAIvF,MACR,mEAGJ,OAAOuF,MAAM4C,GAAGjG,EAAOwC,IAGzBwC,GAAGzC,SAAW,CAACvC,EAAO3C,KACpB,IAAKgG,MACH,MAAM,IAAIvF,MACR,wEAGJ,OAAOuF,MAAMd,SAASvC,EAAO3C,IAG/B2H,GAAGjD,OAAUmE,IACX,IAAKjB,SAAWA,OAAOlD,OACrB,MAAM,IAAIjE,MACR,6DAGA2G,YAGJA,WAAY,EACZQ,OAAOlD,SACP0C,UAAYyB,IAAgB,mBAGflB","file":"h3.js"}+{"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","props","data","id","$html","$onrender","style","value","children","classList","eventListeners","Error","vnode","processSelector","from","processVNodeObject","selector","isArray","Function","processChildren","processProperties","slice","concat","a","b","attrs","Object","keys","filter","startsWith","forEach","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,SA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AAK,KACH,IAAKf,OACH,MAAM,IAAIlH,MACR,4EAGJ,OAAOkH,OAAOzB,SAIlB1E,OAAOiH,eAAef,GAAI,QAAS,CACjCgB,IAAK,KACH,IAAK3C,MACH,MAAM,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"}
M h3.min.jsh3.min.js

@@ -5,5 +5,5 @@ *

* @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{let[t,r,s]=e;if(e.length>3&&(s=e.slice(2)),s=Array.isArray(s)?s:[s],"string"!=typeof t)throw new Error("[VNode] Invalid first argument passed to VNode constructor.");if(this.processSelector(t),r instanceof Function||r instanceof VNode||"string"==typeof r)s=[r].concat(s);else{if("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)||0===e.length)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; +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.props={},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{let[t,r,s]=e;if(e.length>3&&(s=e.slice(2)),s=Array.isArray(s)?s:[s],"string"!=typeof t)throw new Error("[VNode] Invalid first argument passed to VNode constructor.");if(this.processSelector(t),r instanceof Function||r instanceof VNode||"string"==typeof r)s=[r].concat(s);else{if("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.props=e.props,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.props=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.props[t]}),delete this.props.value,delete this.props.$html,delete this.props.$onrender,delete this.props.id,delete this.props.data,delete this.props.style,delete this.props.classList}processSelector(e){if(!e.match(selectorRegex)||0===e.length)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.props).forEach(t=>{if(this.props[t]&&"string"==typeof this.props[t]){const r=document.createAttribute(t);r.value=this.props[t],e.setAttributeNode(r)}"string"==typeof this.props[t]&&e[t]||(e[t]=this.props[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 o(e,t){let r=[],s=0,i=0;for(let o=0;o<e.children.length;o++){let n=-1;for(let a=0;a<t.children.length;a++)if(equal(e.children[o],t.children[a])&&!r.includes(a)){n=a,i++,s++;break}r.push(n)}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.props,s.props)||(Object.keys(i.props).forEach(e=>{!1===s.props[e]&&(t[e]=!1),s.props[e]?s.props[e]&&s.props[e]!==i.props[e]&&t.setAttribute(e,s.props[e]):t.removeAttribute(e)}),Object.keys(s.props).forEach(e=>{!i.props[e]&&s.props[e]&&t.setAttribute(e,s.props[e])}),i.props=s.props),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 n=o(i,s),a=[...Array(n.filter(e=>-3!==e).length).keys()];for(;!equal(n,a);){let e=-1;for(let r of n){e++;let o=!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 n=s.children[e].render();t.insertBefore(n,t.childNodes[e]),s.children[e].$onrender&&s.children[e].$onrender(n),o=!0;break;case-3:i.children.splice(e,1),t.removeChild(t.childNodes[e]),o=!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]),o=!0}if(o)break}}n=o(i,s),a=[...Array(n.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(/\?(.+)$/),o=i&&i[1]?i[1]:"",n=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=n[i];e.startsWith(":")&&s?a[e.slice(1)]=s:r=e===s,i++}if(r){this.route=new Route({query:o,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:o,location:n}=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:n}),Promise.resolve(i&&i()).then(()=>router.start()).then(()=>o&&o())},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