ensojs 1.0.0-rc.12 → 1.0.0-rc.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/ensojs.es.js CHANGED
@@ -1 +1,2 @@
1
- let t=(t,e)=>`${t}: ${e}`;const e=(e,n)=>{throw new Error(`[Enso] - ${t(e,n)}`)},n=(e,n,r)=>{const s=console[e];s&&s(`[Enso] - ${t(n,r)}`)},r=e=>{"function"==typeof e&&(t=e)},s=Symbol(),o=Symbol(),i=Symbol(),c=Symbol(),a=Symbol(),u=Symbol(),h=Symbol(),d=Symbol(),l=Symbol(),p=Symbol(),f=Symbol(),m=Symbol(),g=Symbol(),b=Symbol(),y=Symbol(),w=Symbol(),E="ENSO-FRAGMENT",A="enso-node",_="enso-root",N="enso-frag",S=Object.freeze({Window:{},Document:{},eval:null,Function:null,setTimeout:null}),v=Object.freeze({parse:(t,...e)=>{let n=!1;const r=t.reduce((t,r,s)=>{const o=e[s];return!0===o&&(n=!0),t+r+(!0!==(i=o)&&!1!==i&&null!=i?o:"");var i},"");return!(!n||r)||r},...S}),O=(t={},e=v)=>Object.freeze(Object.assign(Object.create(e),t));class T{#t;#e;constructor(t,e,r){this.#t=e;try{this.#e=r.createFunc(t)}catch(s){n("error",302,`\n${s}\n${r}`),this.#e=()=>{}}}get element(){return this.#t}get action(){return this.#e}run(){try{return this.#e?.()}catch(t){return void n("error",311,`\n${t}\n${this.#e.toString()}`)}}}const $=(t,n)=>{const r=class extends t{constructor(){super(s)}};if(!n)return r;const o=typeof n;"object"!==o&&e(103,o);const i=Object.getOwnPropertyDescriptors(n);for(const e in i)Object.defineProperty(r.prototype,e,i[e]);return r},j=(t=Object)=>class extends t{#n;#r=/* @__PURE__ */new Set;#s=[];constructor(){super(),this[h]=this[h].bind(this),this[a]=this[a].bind(this)}get isComponent(){return!1}get[f](){return this.#n}set[f](t){this.#n=t}get[p](){return this.#r}get[m](){return this.#s}[u](t){this.#s.push(t)}[d](t){return this.#n[t]}[l](t,e){const n=this[d](t);n&&(n.effects.push(e),n.changed=!0)}[i](t){this.#r.add(t)}[a](t){const e=this.#n[t];if(e&&!e.changed){e.changed=!0;for(const t of e.effects)this[i](t);this[o]()}for(const n of this.#s)n[a](t)}[h](){for(const e of this.#r)e.run();this.#r.clear();for(const e of Object.values(this.#n))e.changed=!1;const t=[...this.#s];for(const e of t)e[h]()}},C=Object.freeze({mount:"lifecycle:mount",update:"lifecycle:update",unmount:"lifecycle:unmount"}),M=Object.values(C);class P extends(j(HTMLElement)){#o=!1;#i=null;#c=!1;#a;#u=/* @__PURE__ */Object.create(null);#h=O(this.expose);#d(){return this.shadowRoot??this.attachShadow({mode:this.settings.shadowMode})}constructor(t){super(),t!==s&&e(102),this.#a=new this.constructor.WatchedClass(this),this[f]=this.#a[f],this.#i=this.settings.useShadow?this.#d():this}_report(t,e,r){n(t,e,r)}get refs(){return this.#u}get component(){return this}get isAttached(){return this.#o}get watched(){return this.#a}get isComponent(){return!0}get[y](){return this.#i}get[w](){return this.#h}connectedCallback(){if(this.#o)return;this.#o=!0;const t=this.constructor.observedAttributes;for(const e of t)this.watched._defs[e].attribute.force&&this.reflectAttribute(e);this[c](this.template.process(this,this.template)),this.styles&&((t,e)=>{const n=t instanceof ShadowRoot?t:t.getRootNode();(n instanceof Document||n instanceof ShadowRoot)&&(n.adoptedStyleSheets=[...n.adoptedStyleSheets,...e])})(this[y],this.styles),this[h]()}disconnectedCallback(){this.#a._notify(C.unmount)}attributeChangedCallback(t,e,n){if(e===n)return;const r=this.watched._defs[t].attribute.toProp(n);this.watched[t]!==r&&(this.watched[t]=r)}[a](t){super[a](t),this.watched._notify(t)}[c](t){const e=Array.from(t.firstElementChild.childNodes);this[y].append(...e),this.#a._notify(C.mount)}reflectAttribute(t){const e=this.#a._defs[t],n=e.attribute.toAttr(this.watched[t]);n!==this.getAttribute(e.name)&&(null===n?this.removeAttribute(e.name):this.setAttribute(e.name,n))}[o](){this.#c||(this.#c=!0,requestAnimationFrame(this[h]))}[h](){this.#c=!1,super[h](),this.#a._notify(C.update)}}const R=t=>{const e=document.createElement("template");return e.content.appendChild("string"==typeof t?(t=>document.createRange().createContextualFragment(t))(t):t),e},x=t=>{const e=t instanceof HTMLTemplateElement?t:R(t);return e.content.querySelectorAll("script").forEach(t=>t.remove()),e},W=(t,e)=>Array.prototype.indexOf.call(t.childNodes,e),L="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict",k=(t=6)=>{let e="",n=Math.max(0,Math.trunc(t));for(;n--;)e+=L[Math.trunc(64*Math.random())];return e},F=t=>t.nodeType===Node.TEXT_NODE?t.parentElement:t;class D{#l;#p;#f;#m=/* @__PURE__ */new Map;#g=null;constructor(t,e,n){this.#l=t,this.#p=n,this.#f=e}get id(){return this.#l}get node(){return this.#f}get map(){return this.#p}setGenerator(t,e){this.#g={parser:t,data:e}}getGenerator(){return this.#g}addMutator(t,e){this.#m.has(t)||this.#m.set(t,[]),this.#m.get(t).push(e),this.markWatched()}getMutators(t){return this.#m.get(t)||[]}mutators(){return this.#m.entries()}markRoot(t=!1){this.#f?.setAttribute(_,t?this.#l:"")}unRoot(){this.#f?.removeAttribute(_)}isRoot(){return this.#f?.hasAttribute(_)}markWatched(t=!0){const e=F(this.#f);e.hasAttribute(A)||e.setAttribute(A,this.#l),t&&this.#p.add(this)}unWatch(){const t=F(this.#f);t?.removeAttribute(A)}isWatched(){return this.#f?.hasAttribute(A)}replaceNode(t){const e=this.#f;return this.#f.replaceWith(t),this.#f=t,this.markWatched(!1),e}}class z{#p=/* @__PURE__ */new Map;get size(){return this.#p.size}add(t){this.#p.has(t.id)||this.#p.set(t.id,t)}get(t){return this.#p.has(t)?this.#p.get(t):null}getByNode(t){if(!t?.hasAttribute(A))return null;const e=t.getAttribute(A);return this.#p.get(e)}getByRoot(t){if(!t?.hasAttribute(_))return null;const e=t.getAttribute(_);return this.#p.get(e)}create(t){const e=F(t).getAttribute(A);return this.#p.has(e)?this.#p.get(e):new D(k(),t,this)}createRoot(t){const e=new D(k(),t,this);return e.markRoot(!0),this.add(e),e}[Symbol.iterator](){return this.#p.values()}}const B=(t,e=1)=>{const n=t.name;if(n.startsWith("enso-")){const t=n.indexOf(":");if(t>-1)return n.slice(t+1).toLowerCase()}return n.slice(e).toLowerCase()},G=(t,e,n=null)=>{if(!t?.name)return!1;const r=t.name;return!!r.startsWith(e)||!!n&&r.startsWith(`enso-${n}:`)},V=/(?:this\.watched\.|watched:|@:)([A-Za-z_$][\w$]*)/g,q=/(?:this\.refs\.|ref:|#:)([A-Za-z_$][\w$]*)/g,H=()=>document.createElement("template"),I=(t,e,n)=>{if(!t)return null;const r=t.getAttributeNode(e)??t.getAttributeNode(n);return r&&t.removeAttribute(r.name),r?.value??null};const U=t=>t.includes(":")?U(t.split(":")[1]):t.includes("=")?U(t.split("=")[0]):t.trim(),X=t=>{const[n]=t.split(/\b(?:of|in)\b(?!.*\b(of|in)\b)/).filter(Boolean),r=(t=>{const n={"{":"}","[":"]","}":"{","]":"["},r=[{token:"",capturing:!0}];let s=!0;const o=t=>{const e=r.at(-1).capturing&&s;r.push({token:n[t],capturing:e}),s=!0},i=t=>{t!==r.pop().token&&e(411),s=!1},c={",":()=>{s=!0},"{":o,"[":o,"}":i,"]":i},a=t.split(/([{}[\],])/).map(t=>{if(t?.trim())return c[t]?c[t](t):r.at(-1).capturing?(s=!1,":"===t.trim().at(-1)&&(s=!0),U(t)):void 0}).filter(Boolean);return r.length>1&&e(411),a})(n);return r};if(!customElements.get(E.toLowerCase())){class t extends HTMLElement{}customElements.define(E.toLowerCase(),t)}class J extends(j()){#b;#y;#w;#E=null;#i=null;#h;#A=!1;constructor(t,e,n){super(),this.#b=t.component,this.#y=t,this.#h=t[w],n&&(this.#w=document.createComment(this.tag),n.replaceWith(this.#w)),t[u](this);const r=/* @__PURE__ */new Map;for(const[s,o]of Object.entries(this.#b[f]))r[s]={changed:!1,watchers:o.watchers,effects:[]};this[f]=r,this._processTemplate(e)}_processTemplate(t){t&&(this.#i=t.process(this))}_getChildren(){this.#E=Array.from(this.#i.childNodes)}get tag(){return"enso:fragment"}get component(){return this.#b}get isAttached(){return this.#A}set isAttached(t){this.#A=t}get[g](){return this.#w}get[b](){return this.#E}get[w](){return this.#h}set[w](t){this.#h=O(t,this.#y[w])}get#_(){return this.#y.isAttached}[o](){this.#b[o]()}mount(){!this.#A&&this.#_&&(this._getChildren(),this.#w.after(...this.#E),this.#A=!0,this[h]())}[h](){this.#A&&super[h]()}unmount(){this.#A&&(this.#i.append(...this.#E),this.#E=null,this.#A=!1)}_requestUpdate(){this[h]()}_getNodes(){return this[b]}_setENV(t){this[w]=t}_insertAfterAnchor(...t){this[g].after(...t)}_getChildFragments(){return this[m]}}const Z=()=>{const t=/* @__PURE__ */new Map;return{get(e,n=null){for(const r of t.values())if(r.match(e,n))return r;return null},set(e){t.set(e.type,e)},[Symbol.iterator]:()=>t.values()}},K=(()=>{const t={generator:Z(),attribute:Z(),content:Z()};return Object.freeze({register(n,r="attribute"){const s=t[r];s||e(401,r),s.set(n)},get(n,r,s=null){const o=t[n];return o||e(401,n),o.get(r,s)},markRoot(t){t.setAttribute(_,"")},getRoot:t=>t.querySelector(`[${_}]:not([${_}="COMPONENT"])`),isParsed:t=>t.hasAttribute(N),getWatched:t=>t.querySelector(`[${A}]`),preprocess(e,n){let r=!1;const s=t.generator.get(n);s&&(r=s.preprocess(e,n));for(const o of t.content)o.match(n)&&(r=o.preprocess(e,n)||r);if(n.attributes?.length){const s=[...n.attributes];for(const o of s){const s=t.attribute.get(n,o);s&&(r=s.preprocess(e,n,o)||r)}}return r},process(t,e,n){const r=t.getGenerator();r&&r.parser.process(r.data,e,n);for(const[s,o]of t.mutators())s.process(o,e,n);n.removeAttribute(A)}})})(),Q=Object.freeze({Effect:T,Action:class{#N;#S;#v;#O;constructor(t,e={},r=T){this.#S=t,this.#N=r,this.#v=e,this.#O=(t=>{const e=(t=>`with (env) {\n return (() => {\n "use strict";\n try { return ${t}; } catch(e) {\n this._report('error', 312, e); // E_EFFECT_RUNTIME\n return undefined;\n }\n })();\n }`)(t);try{return new Function("env",e)}catch(r){return n("error",301,`\n${r}\n${e}`),()=>()=>{}}})(t)}get data(){return this.#v}get code(){return this.#S}createEffect(t,e){return new this.#N(t,e,this)}createFunc(t){const{component:n,[w]:r}=t,s=this.#O.call(n,r),o=typeof s;return"function"!==o&&e(303,o),s}},compileValue:t=>`(()=>parse\`${t.replaceAll("{{","${").replaceAll("}}","}").trim()}\`)`,addBinding:(t,e,n)=>{t[l](e,n),t[i](n)},addWatcher:(t,e,n)=>{t.watched._addWatcher(e,n);const r=t.watched._getProp(e);n.call(t,e,r)},parseSource:(t,e=null)=>{const n=t.replace(V,(t,n)=>(e&&e.add(n),`this.watched.${n}`)).replace(q,(t,e)=>`this.refs.${e}`);return e&&e.add(C.mount),n},collectBindings:(t,e)=>{let n;for(;null!==(n=V.exec(t));)e.add(n[1]);e.add(C.mount)},EnsoFragment:J}),Y={generator(t){K.register(t,"generator")},attribute(t){K.register(t,"attribute")},content(t){K.register(t,"content")}};var tt,et;(function(t,e){const{Action:n,parseSource:r}=e;function s(t,e,n){const{name:r,action:s}=n;try{const n=s.createFunc(t);e.addEventListener(r.toLowerCase(),n.bind(t.component))}catch(o){console.error("[Enso] - ",o)}}t.attribute({type:"enso:event",match:(t,e)=>t.nodeType===Node.ELEMENT_NODE&&G(e,"@","evt"),preprocess(t,e,s){const o=r(s.value);return t.addMutator(this,{name:B(s),action:new n(o)}),e.removeAttribute(s.name),!0},process(t,e,n){for(const r of t)s(e,n,r)}})})(tt=Y,et=Q),function(t,e){const{addBinding:n,parseSource:r,Effect:s,Action:o,compileValue:i}=e,c=/({{(.|\n)*}})/;class a extends s{run(){const t=super.run();this.element&&t&&(this.element.textContent=t)}}t.content({type:"enso:text",match:t=>t.nodeType===Node.TEXT_NODE&&c.test(t.nodeValue),preprocess(t,e){const n=/* @__PURE__ */new Set,s=i(r(e.nodeValue,n));return t.addMutator(this,{parent:e.parentNode,index:W(e.parentNode,e),action:new o(s,{},a),binds:n}),!0},process(t,e,r){for(const s of t){const t=r.childNodes[s.index],o=s.action.createEffect(e,t);for(const r of s.binds)n(e,r,o)}}})}(tt,et),function(t,e){const{addBinding:n,parseSource:r,Effect:s,Action:o,compileValue:i}=e;class c extends s{#T;constructor(t,e,n){super(t,e,n),this.#T=n.data.name}run(){const t=super.run(),e=this.element;t?e.setAttribute(this.#T,!0===t?"":t):e.removeAttribute(this.#T)}}t.attribute({type:"enso:attr",match:(t,e)=>t.nodeType===Node.ELEMENT_NODE&&G(e,":","attr"),preprocess(t,e,n){const s=B(n),a=/* @__PURE__ */new Set,u=i(r(n.value,a));return t.addMutator(this,{name:s,action:new o(u,{name:s},c),binds:a}),e.removeAttribute(n.name),!0},process(t,e,r){for(const s of t){const t=s.action.createEffect(e,r);for(const r of s.binds)n(e,r,t)}}})}(tt,et),function(t,e){const{parseSource:n,addWatcher:r,Effect:s,Action:o}=e;class i extends s{#$;constructor(t,e,n){super(t,e,n),this.#$=n.data.name}run(){const t=super.run();void 0!==t&&(this.element[this.#$]=t)}}t.attribute({type:"enso:prop",match:(t,e)=>t.nodeType===Node.ELEMENT_NODE&&G(e,".","prop"),preprocess(t,e,r){const s=B(r),c=/* @__PURE__ */new Set,a=`(()=>${n(r.value,c).replaceAll("{{","").replaceAll("}}","").trim()})`;return t.addMutator(this,{name:s,action:new o(a,{name:s},i),binds:c}),e.removeAttribute(r.name),!0},process(t,e,n){for(const s of t){const t=s.action.createEffect(e,n);for(const n of s.binds)r(e,n,()=>t.run())}}})}(tt,et),function(t){t.generator({type:"enso:ref",match:t=>t.nodeType===Node.ELEMENT_NODE&&(t.hasAttribute("#ref")||t.hasAttribute("enso-ref")),preprocess(t,e){if(t.getGenerator())return!1;const n=I(e,"#ref","enso-ref");return t.setGenerator(this,{type:"ref",name:n}),t.markWatched(),!0},process(t,e,n){t&&"ref"===t.type&&(e.isComponent?Object.defineProperty(e.component.refs,t.name,{value:n,writable:!1,configurable:!1}):console.warn(`[Enso] #ref="${t.name}" ignored: refs are only supported on static elements (not inside *for or *if).`))}})}(tt),function(t,e){const{addBinding:n,parseSource:r,EnsoFragment:s,Action:o}=e;class i extends s{constructor(t,e,n){super(t),this._setENV(n),this._processTemplate(e)}mount(){return this.isAttached=!0,this._requestUpdate(),this._getChildren(),this._getNodes()}}class c extends s{#j;#C;constructor(t,e,n,r){super(t,null,n),this.#j=r.createEffect(t,null),this.#C=e}get tag(){return"enso:for"}run(){this.mount()}mount(){this.unmount();const t=[],e=this.#j.run();for(const n of e){const e=new i(this,this.#C,n);t.push(...e.mount())}this._insertAfterAnchor(...t),this.isAttached=!0,this._requestUpdate()}unmount(){for(const t of this._getChildFragments())t.unmount();this._getChildFragments().length=0,this.isAttached=!1}}t.generator({type:"enso:for",match:t=>t.nodeType===Node.ELEMENT_NODE&&(t.hasAttribute("*for")||t.hasAttribute("enso-for")),preprocess(t,e){if(t.getGenerator())return!1;const n=/* @__PURE__ */new Set,s=r(I(e,"*for","enso-for"),n),i=X(s),c=new o(`(function* () {\n try {\n for (const ${s}) {\n yield { ${i.join(", ")} };\n }\n } catch(e) {\n this._report(412, e);\n }\n }).bind(this);/*js*/`);return t.map.createRoot(e).setGenerator(this,{type:"for",action:c,binds:n,template:null}),!0},fragment(t,e){t.getGenerator().data.template=e},process(t,e,r){if("for"===t?.type){const s=new c(e,t.template,r,t.action);for(const r of t.binds)n(e,r,s)}}})}(tt,et),function(t,e){const{addBinding:n,parseSource:r,compileValue:s,Action:o,EnsoFragment:i}=e;class c extends i{#j;constructor(t,e,n,r){super(t,e,n),this.#j=r.createEffect(t,null)}get tag(){return"enso:if"}run(){this.#j.run()?this.mount():this.unmount()}}t.generator({type:"enso:if",match:t=>t.nodeType===Node.ELEMENT_NODE&&(t.hasAttribute("*if")||t.hasAttribute("enso-if")),preprocess(t,e){if(t.getGenerator())return!1;let n=I(e,"*if","enso-if");const i=/* @__PURE__ */new Set;n=r(n,i);const c=new o(s(n));return t.map.createRoot(e).setGenerator(this,{type:"if",action:c,binds:i,template:null}),!0},fragment(t,e){t.getGenerator().data.template=e},process(t,e,r){if("if"===t?.type){const s=new c(e,t.template,r,t.action);for(const r of t.binds)n(e,r,s)}}})}(tt,et);const nt=/{{[^]*}}/,rt=t=>(t=>t.nodeType===Node.ELEMENT_NODE&&t.hasAttribute("enso:ignore"))(t)||(t=>t.parentNode?.hasAttribute("enso:ignore-children"))(t)?NodeFilter.FILTER_REJECT:t.nodeType===Node.ELEMENT_NODE||t.nodeType===Node.TEXT_NODE&&nt.test(t.nodeValue)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_REJECT,st=NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT;class ot{#C=null;#a;constructor(t,e=new z){const n=x(t);this.#a=e,this.#C=this.#M(n),this.#P()}#M(t){if(K.isParsed(t))return t;const e=(t=>{const e=document.createElement(E);return e.append(t),e})(t.content);e.setAttribute(_,"COMPONENT"),t.content.append(e);const n=(t=>document.createTreeWalker(t,st,{acceptNode:rt}))(e);let r;for(;r=n.nextNode();){const t=this.#a.create(r);K.preprocess(t,r)}return t.setAttribute(N,""),t}#P(){const t=this.#C.content;let e;for((t=>{const e=t.querySelectorAll(`${E}:not([${_}])`);for(const n of e)n.replaceWith(...n.childNodes)})(t);e=K.getRoot(t);){const t=this.#a.getByRoot(e),n=H();t.unRoot(),t.replaceNode(n);const r=x(e);r.setAttribute(N,""),t.getGenerator()?.parser?.fragment(t,new ot(r,this.#a,!0),n)}}process(t){const e=this.#C.content.cloneNode(!0);let n;for(;n=K.getWatched(e);){const e=this.#a.getByNode(n);K.process(e,t,n)}return e}clone(){const t=this.#C.cloneNode(!0);return new ot(t,this.#a)}get watchedNodes(){return this.#a}get template(){return this.#C}}const it=(t,...e)=>"string"==typeof t?t:t.reduce((t,n,r)=>t+n+(e[r]||""),""),ct=(t,...e)=>(t=>{const e=new CSSStyleSheet;return e.replaceSync(t),e})(it(t,...e)),at=(t,...e)=>new ot(it(t,...e));const ut=/* @__PURE__ */new WeakMap,ht=/* @__PURE__ */new WeakMap,dt=(t,e)=>({get(n,r,s){const o=Reflect.get(n,r,s);return"object"==typeof o&&null!==o&&o?bt(o,e,t):o},set(n,r,s,o){const i=n[r],c=Reflect.set(n,r,s,o);return i!==s&&t(e),c},deleteProperty(n,r){const s=Object.prototype.hasOwnProperty.call(n,r),o=Reflect.deleteProperty(n,r);return s&&o&&t(e),o}}),lt=["values","entries","keys",Symbol.iterator],pt=(t,e,n)=>{const r=dt(t,e);return{...r,get(s,o,i){const c=Reflect.get(s,o,i);return"function"==typeof c&&n.has(o)?(...n)=>{const r=c.apply(s,n);return t(e),r}:((t,e)=>"function"==typeof t[e]&&lt.includes(e))(s,o)?s[o].bind(s):r.get(s,o,i)}}},ft=/* @__PURE__ */new Set(["push","pop","shift","unshift","splice","sort","reverse"]),mt=/* @__PURE__ */new Set(["add","delete","clear"]),gt=/* @__PURE__ */new Set(["set","delete","clear"]),bt=(t,e,n)=>{if("object"!=typeof t||null===t)return t;if(ut.has(t))return ut.get(t);const r=((t,e,n)=>Array.isArray(t)?pt(n,e,ft):t instanceof Set?pt(n,e,mt):t instanceof Map?pt(n,e,gt):dt(n,e))(t,e,n),s=new Proxy(t,r);return ut.set(t,s),ht.set(s,!0),s},yt=Object.freeze([Boolean,Number,String]),wt=/* @__PURE__ */new Map([[Boolean,{toProp:t=>"false"!==t&&null!==t,toAttr:t=>t?"":null}],[Number,{toProp:t=>Number(t),toAttr:t=>null!==t?String(t):null}],[String,{toProp:t=>t,toAttr:t=>t}]]);function Et(t){return"function"==typeof t?t:null===t||"object"!=typeof t?()=>t:()=>structuredClone(t)}const At=t=>Object.defineProperty(t,"_prop",{value:!0,writable:!1,configurable:!1,enumerable:!1});function _t(t=null,e=!1){return e=e&&null!==t&&"object"==typeof t,At({value:Et(t),deep:e,attribute:!1})}function Nt(t=null,n=String){const r=null!=t;r&&(n=t.constructor),(!yt.includes(n)||null!==t&&"object"==typeof t)&&e(201,n);const{toProp:s,toAttr:o}=wt.get(n);return At({value:Et(t),deep:!1,attribute:{type:n,force:r,toProp:s,toAttr:o}})}function St(t,n){return"function"!=typeof t&&e(211),Array.isArray(n)&&n.every(t=>"string"==typeof t)||e(212),n.includes(C.mount)||n.push(C.mount),At({value:void 0,deps:n,comp:t,deep:!1,attribute:!1})}function vt(t){return t.watched[$t]}function Ot(t,e){t.watched._update(e)}function Tt(t,n=[],r=!1){return"function"==typeof t&&void 0!==t.prototype?t.__watches={props:n,keep:r}:e(221),t}const $t=Symbol("enso.watched.values");function jt(t){t.startsWith("_")&&e(231)}function Ct(t,e,n){const r=e&&e._prop?e:_t(e);return r.name=t,r.watchers=n||[],r}class Mt{static define(t,n={}){const r=[],s=class extends Mt{};s.attr=[],s.defs=/* @__PURE__ */Object.create(null);for(const[o,i]of Object.entries(t)){jt(o);const t=Ct(o,i,n[o]);Object.defineProperty(s.prototype,t.name,{configurable:!0,enumerable:!0,get(){return this._getProp(t)},set(n){t.comp&&e(213,t.name),this._setProp(t,n)}}),t.comp&&r.push(t),s.defs[t.name]=t,t.attribute&&s.attr.push(t.name)}for(const e of M)s.defs[e]={name:e,value:()=>!1,attribute:!1,watchers:n[e]??[],lifecycle:!0};for(const e of r){const t=function(){this.watched._setProp(e,e.comp.call(this))};for(const n of e.deps){const e=s.defs[n];e&&e.watchers.push(t)}}return Object.freeze(s.defs),Object.freeze(s.attr),s}#b;#R=/* @__PURE__ */Object.create(null);#n=/* @__PURE__ */Object.create(null);constructor(t){this.#b=t;for(const n in this._defs){const r=this._defs[n];let s=r?.value?.();r.lifecycle||(t.hasOwnProperty(r.name)&&(s=t[r.name]),Object.defineProperty(t,r.name,{configurable:!0,enumerable:!0,get:()=>this._getProp(r),set:r.comp?()=>{e(213,r.name)}:t=>this._setProp(r,t)})),r.deep&&"object"==typeof s&&null!==s&&(s=bt(s,r.name,t[a])),this.#R[n]=s,this.#n[n]={changed:!1,watchers:r.watchers,effects:[]}}}get[f](){return this.#n}get[$t](){return structuredClone(this.#R)}get _defs(){return this.constructor.defs}_addWatcher(t,e){this.#n[t]&&this.#n[t].watchers.push(e)}_notify(t){if(this.#n[t]){const{watchers:e}=this.#n[t],n=this.#R[t];for(const r of e)r.call(this.#b,t,n)}}_getProp(t){return this.#R[t.name]}_setProp(t,e){t.deep&&"object"==typeof e&&null!==e&&(e=bt(e,t.name,this.#b[a])),this.#R[t.name]=e,this.#b[a](t.name),t.attribute&&this.#b.reflectAttribute(t.name)}_update(t){for(const e in t)t[e]!==this.#R[e]&&this._setProp(this._defs[e],t[e])}}let Pt=!1,Rt=null;const xt=(t,e)=>`${t}: ${e}`,Wt={version:"1.0.0-rc.11",component(t,{template:n,styles:r=null,expose:s={},watched:o={},script:i=null,settings:c={}}){c=((t={})=>({useShadow:!0,shadowMode:"open",...t}))(c),customElements.get(t)&&e(101,t);const a=function(t){const e=/* @__PURE__ */Object.create(null);if(!t)return e;for(const n in t){const r=t[n];if(r?.__watches){for(const t of r.__watches.props)(e[t]||=[]).push(r);r.__watches.keep||delete t[n]}}return e}(i),u=$(P,i),h=Mt.define(o,a);return r&&!Array.isArray(r)&&(r=[r]),Object.defineProperties(u,{observedAttributes:{get:()=>h.attr},WatchedClass:{get:()=>h}}),Object.defineProperties(u.prototype,{settings:{get:()=>c},template:{get:()=>n},styles:{get:()=>r},expose:{get:()=>s}}),customElements.define(t,u),function(t,e){function n(e,n){const r=e?Object.entries(e).reduce((t,[e,n])=>!0===n?`${t} ${e}`:null!=n&&!1!==n?`${t} ${e}="${n}"`:t,""):"";return null!=n?`<${t}${r}>${n}</${t}>`:`<${t}${r}></${t}>`}return n.toString=()=>`<${t}></${t}>`,n.tag=t,n.Class=e,n}(t,u)},use(t){t(Y,Q)},async enableDiagnostics(){Pt=!0,Rt||=import("./errors.es.js");const{default:t}=await Rt;Pt&&r(t)},disableDiagnostics(){Pt=!1,r(xt)}},Lt=Object.freeze(Wt);export{Lt as Enso,Nt as attr,St as computed,ct as css,Lt as default,vt as getWatched,at as html,C as lifecycle,_t as prop,Ot as setWatched,Tt as watches};
1
+ let t=(t,e)=>`${t}: ${e}`;const e=(e,n)=>{throw new Error(`[Enso] - ${t(e,n)}`)},n=(e,n,r)=>{const s=console[e];s&&s(`[Enso] - ${t(n,r)}`)},r=e=>{"function"==typeof e&&(t=e)},s=Symbol(),o=Symbol(),i=Symbol(),c=Symbol(),a=Symbol(),u=Symbol(),h=Symbol(),d=Symbol(),l=Symbol(),p=Symbol(),f=Symbol(),m=Symbol(),g=Symbol(),b=Symbol(),y=Symbol(),w=Symbol(),E="ENSO-FRAGMENT",A="enso-node",_="enso-root",N="enso-frag",S=Object.freeze({Window:{},Document:{},eval:null,Function:null,setTimeout:null}),v=Object.freeze({parse:(t,...e)=>{let n=!1;const r=t.reduce((t,r,s)=>{const o=e[s];return!0===o&&(n=!0),t+r+(!0!==(i=o)&&!1!==i&&null!=i?o:"");var i},"");return!(!n||r)||r},...S}),O=(t={},e=v)=>Object.freeze(Object.assign(Object.create(e),t));class T{#t;#e;constructor(t,e,r){this.#t=e;try{this.#e=r.createFunc(t)}catch(s){n("error",302,`\n${s}\n${r}`),this.#e=()=>{}}}get element(){return this.#t}get action(){return this.#e}run(){try{return this.#e?.()}catch(t){return void n("error",311,`\n${t}\n${this.#e.toString()}`)}}}const $=(t,n)=>{const r=class extends t{constructor(){super(s)}};if(!n)return r;const o=typeof n;"object"!==o&&e(103,o);const i=Object.getOwnPropertyDescriptors(n);for(const e in i)Object.defineProperty(r.prototype,e,i[e]);return r},j=(t=Object)=>class extends t{#n;#r=/* @__PURE__ */new Set;#s=[];constructor(){super(),this[h]=this[h].bind(this),this[a]=this[a].bind(this)}get isComponent(){return!1}get[f](){return this.#n}set[f](t){this.#n=t}get[p](){return this.#r}get[m](){return this.#s}[u](t){this.#s.push(t)}[d](t){return this.#n[t]}[l](t,e){const n=this[d](t);n&&(n.effects.push(e),n.changed=!0)}[i](t){this.#r.add(t)}[a](t){const e=this.#n[t];if(e&&!e.changed){e.changed=!0;for(const t of e.effects)this[i](t);this[o]()}for(const n of this.#s)n[a](t)}[h](){for(const e of this.#r)e.run();this.#r.clear();for(const e of Object.values(this.#n))e.changed=!1;const t=[...this.#s];for(const e of t)e[h]()}},C=Object.freeze({mount:"lifecycle:mount",update:"lifecycle:update",unmount:"lifecycle:unmount"}),M=Object.values(C);class P extends(j(HTMLElement)){#o=!1;#i=null;#c=!1;#a;#u=/* @__PURE__ */Object.create(null);#h=O(this.expose);#d(){return this.shadowRoot??this.attachShadow({mode:this.settings.shadowMode})}constructor(t){super(),t!==s&&e(102),this.#a=new this.constructor.WatchedClass(this),this[f]=this.#a[f],this.#i=this.settings.useShadow?this.#d():this}_report(t,e,r){n(t,e,r)}get refs(){return this.#u}get component(){return this}get isAttached(){return this.#o}get watched(){return this.#a}get isComponent(){return!0}get[y](){return this.#i}get[w](){return this.#h}connectedCallback(){if(this.#o)return;this.#o=!0;const t=this.constructor.observedAttributes;for(const e of t)this.watched._defs[e].attribute.force&&this.reflectAttribute(e);this[c](this.template.process(this,this.template)),this.styles&&((t,e)=>{const n=t instanceof ShadowRoot?t:t.getRootNode();(n instanceof Document||n instanceof ShadowRoot)&&(n.adoptedStyleSheets=[...n.adoptedStyleSheets,...e])})(this[y],this.styles),this[h]()}disconnectedCallback(){this.#a._notify(C.unmount)}attributeChangedCallback(t,e,n){if(e===n)return;const r=this.watched._defs[t].attribute.toProp(n);this.watched[t]!==r&&(this.watched[t]=r)}[a](t){super[a](t),this.watched._notify(t)}[c](t){const e=Array.from(t.firstElementChild.childNodes);this[y].append(...e),this.#a._notify(C.mount)}reflectAttribute(t){const e=this.#a._defs[t],n=e.attribute.toAttr(this.watched[t]);n!==this.getAttribute(e.name)&&(null===n?this.removeAttribute(e.name):this.setAttribute(e.name,n))}[o](){this.#c||(this.#c=!0,requestAnimationFrame(this[h]))}[h](){this.#c=!1,super[h](),this.#a._notify(C.update)}}const R=t=>{const e=document.createElement("template");return e.content.appendChild("string"==typeof t?(t=>document.createRange().createContextualFragment(t))(t):t),e},x=t=>{const e=t instanceof HTMLTemplateElement?t:R(t);return e.content.querySelectorAll("script").forEach(t=>t.remove()),e},W=(t,e)=>Array.prototype.indexOf.call(t.childNodes,e),L="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict",k=(t=6)=>{let e="",n=Math.max(0,Math.trunc(t));for(;n--;)e+=L[Math.trunc(64*Math.random())];return e},F=t=>t.nodeType===Node.TEXT_NODE?t.parentElement:t;class D{#l;#p;#f;#m=/* @__PURE__ */new Map;#g=null;constructor(t,e,n){this.#l=t,this.#p=n,this.#f=e}get id(){return this.#l}get node(){return this.#f}get map(){return this.#p}setGenerator(t,e){this.#g={parser:t,data:e}}getGenerator(){return this.#g}addMutator(t,e){this.#m.has(t)||this.#m.set(t,[]),this.#m.get(t).push(e),this.markWatched()}getMutators(t){return this.#m.get(t)||[]}mutators(){return this.#m.entries()}markRoot(t=!1){this.#f?.setAttribute(_,t?this.#l:"")}unRoot(){this.#f?.removeAttribute(_)}isRoot(){return this.#f?.hasAttribute(_)}markWatched(t=!0){const e=F(this.#f);e.hasAttribute(A)||e.setAttribute(A,this.#l),t&&this.#p.add(this)}unWatch(){const t=F(this.#f);t?.removeAttribute(A)}isWatched(){return this.#f?.hasAttribute(A)}replaceNode(t){const e=this.#f;return this.#f.replaceWith(t),this.#f=t,this.markWatched(!1),e}}class z{#p=/* @__PURE__ */new Map;get size(){return this.#p.size}add(t){this.#p.has(t.id)||this.#p.set(t.id,t)}get(t){return this.#p.has(t)?this.#p.get(t):null}getByNode(t){if(!t?.hasAttribute(A))return null;const e=t.getAttribute(A);return this.#p.get(e)}getByRoot(t){if(!t?.hasAttribute(_))return null;const e=t.getAttribute(_);return this.#p.get(e)}create(t){const e=F(t).getAttribute(A);return this.#p.has(e)?this.#p.get(e):new D(k(),t,this)}createRoot(t){const e=new D(k(),t,this);return e.markRoot(!0),this.add(e),e}[Symbol.iterator](){return this.#p.values()}}const B=(t,e=1)=>{const n=t.name;if(n.startsWith("enso-")){const t=n.indexOf(":");if(t>-1)return n.slice(t+1).toLowerCase()}return n.slice(e).toLowerCase()},G=(t,e,n=null)=>{if(!t?.name)return!1;const r=t.name;return!!r.startsWith(e)||!!n&&r.startsWith(`enso-${n}:`)},V=/(?:this\.watched\.|watched:|@:)([A-Za-z_$][\w$]*)/g,q=/(?:this\.refs\.|ref:|#:)([A-Za-z_$][\w$]*)/g,H=()=>document.createElement("template"),I=(t,e,n)=>{if(!t)return null;const r=t.getAttributeNode(e)??t.getAttributeNode(n);return r&&t.removeAttribute(r.name),r?.value??null};const U=t=>t.includes(":")?U(t.split(":")[1]):t.includes("=")?U(t.split("=")[0]):t.trim(),X=t=>{const[n]=t.split(/\b(?:of|in)\b(?!.*\b(of|in)\b)/).filter(Boolean),r=(t=>{const n={"{":"}","[":"]","}":"{","]":"["},r=[{token:"",capturing:!0}];let s=!0;const o=t=>{const e=r.at(-1).capturing&&s;r.push({token:n[t],capturing:e}),s=!0},i=t=>{t!==r.pop().token&&e(411),s=!1},c={",":()=>{s=!0},"{":o,"[":o,"}":i,"]":i},a=t.split(/([{}[\],])/).map(t=>{if(t?.trim())return c[t]?c[t](t):r.at(-1).capturing?(s=!1,":"===t.trim().at(-1)&&(s=!0),U(t)):void 0}).filter(Boolean);return r.length>1&&e(411),a})(n);return r};if(!customElements.get(E.toLowerCase())){class t extends HTMLElement{}customElements.define(E.toLowerCase(),t)}class J extends(j()){#b;#y;#w;#E=null;#i=null;#h;#A=!1;constructor(t,e,n){super(),this.#b=t.component,this.#y=t,this.#h=t[w],n&&(this.#w=document.createComment(this.tag),n.replaceWith(this.#w)),t[u](this);const r=/* @__PURE__ */new Map;for(const[s,o]of Object.entries(this.#b[f]))r[s]={changed:!1,watchers:o.watchers,effects:[]};this[f]=r,this._processTemplate(e)}_processTemplate(t){t&&(this.#i=t.process(this))}_getChildren(){this.#E=Array.from(this.#i.childNodes)}get tag(){return"enso:fragment"}get component(){return this.#b}get isAttached(){return this.#A}set isAttached(t){this.#A=t}get[g](){return this.#w}get[b](){return this.#E}get[w](){return this.#h}set[w](t){this.#h=O(t,this.#y[w])}get#_(){return this.#y.isAttached}[o](){this.#b[o]()}mount(){!this.#A&&this.#_&&(this._getChildren(),this.#w.after(...this.#E),this.#A=!0,this[h]())}[h](){this.#A&&super[h]()}unmount(){this.#A&&(this.#i.append(...this.#E),this.#E=null,this.#A=!1)}_requestUpdate(){this[h]()}_getNodes(){return this[b]}_setENV(t){this[w]=t}_insertAfterAnchor(...t){this[g].after(...t)}_getChildFragments(){return this[m]}}const Z=()=>{const t=/* @__PURE__ */new Map;return{get(e,n=null){for(const r of t.values())if(r.match(e,n))return r;return null},set(e){t.set(e.type,e)},[Symbol.iterator]:()=>t.values()}},K=(()=>{const t={generator:Z(),attribute:Z(),content:Z()};return Object.freeze({register(n,r="attribute"){const s=t[r];s||e(401,r),s.set(n)},get(n,r,s=null){const o=t[n];return o||e(401,n),o.get(r,s)},markRoot(t){t.setAttribute(_,"")},getRoot:t=>t.querySelector(`[${_}]:not([${_}="COMPONENT"])`),isParsed:t=>t.hasAttribute(N),getWatched:t=>t.querySelector(`[${A}]`),preprocess(e,n){let r=!1;const s=t.generator.get(n);s&&(r=s.preprocess(e,n));for(const o of t.content)o.match(n)&&(r=o.preprocess(e,n)||r);if(n.attributes?.length){const s=[...n.attributes];for(const o of s){const s=t.attribute.get(n,o);s&&(r=s.preprocess(e,n,o)||r)}}return r},process(t,e,n){const r=t.getGenerator();r&&r.parser.process(r.data,e,n);for(const[s,o]of t.mutators())s.process(o,e,n);n.removeAttribute(A)}})})(),Q=Object.freeze({Effect:T,Action:class{#N;#S;#v;#O;constructor(t,e={},r=T){this.#S=t,this.#N=r,this.#v=e,this.#O=(t=>{const e=(t=>`with (env) {\n return (() => {\n "use strict";\n try { return ${t}; } catch(e) {\n this._report('error', 312, e); // E_EFFECT_RUNTIME\n return undefined;\n }\n })();\n }`)(t);try{return new Function("env",e)}catch(r){return n("error",301,`\n${r}\n${e}`),()=>()=>{}}})(t)}get data(){return this.#v}get code(){return this.#S}createEffect(t,e){return new this.#N(t,e,this)}createFunc(t){const{component:n,[w]:r}=t,s=this.#O.call(n,r),o=typeof s;return"function"!==o&&e(303,o),s}},compileValue:t=>`(()=>parse\`${t.replaceAll("{{","${").replaceAll("}}","}").trim()}\`)`,addBinding:(t,e,n)=>{t[l](e,n),t[i](n)},addWatcher:(t,e,n)=>{t.watched._addWatcher(e,n);const r=t.watched._getProp(e);n.call(t,e,r)},parseSource:(t,e=null)=>{const n=t.replace(V,(t,n)=>(e&&e.add(n),`this.watched.${n}`)).replace(q,(t,e)=>`this.refs.${e}`);return e&&e.add(C.mount),n},collectBindings:(t,e)=>{let n;for(;null!==(n=V.exec(t));)e.add(n[1]);e.add(C.mount)},EnsoFragment:J}),Y={generator(t){K.register(t,"generator")},attribute(t){K.register(t,"attribute")},content(t){K.register(t,"content")}};var tt,et;(function(t,e){const{Action:n,parseSource:r}=e;function s(t,e,n){const{name:r,action:s}=n;try{const n=s.createFunc(t);e.addEventListener(r.toLowerCase(),n.bind(t.component))}catch(o){console.error("[Enso] - ",o)}}t.attribute({type:"enso:event",match:(t,e)=>t.nodeType===Node.ELEMENT_NODE&&G(e,"@","evt"),preprocess(t,e,s){const o=r(s.value);return t.addMutator(this,{name:B(s),action:new n(o)}),e.removeAttribute(s.name),!0},process(t,e,n){for(const r of t)s(e,n,r)}})})(tt=Y,et=Q),function(t,e){const{addBinding:n,parseSource:r,Effect:s,Action:o,compileValue:i}=e,c=/({{(.|\n)*}})/;class a extends s{run(){const t=super.run();this.element&&t&&(this.element.textContent=t)}}t.content({type:"enso:text",match:t=>t.nodeType===Node.TEXT_NODE&&c.test(t.nodeValue),preprocess(t,e){const n=/* @__PURE__ */new Set,s=i(r(e.nodeValue,n));return t.addMutator(this,{parent:e.parentNode,index:W(e.parentNode,e),action:new o(s,{},a),binds:n}),!0},process(t,e,r){for(const s of t){const t=r.childNodes[s.index],o=s.action.createEffect(e,t);for(const r of s.binds)n(e,r,o)}}})}(tt,et),function(t,e){const{addBinding:n,parseSource:r,Effect:s,Action:o,compileValue:i}=e;class c extends s{#T;constructor(t,e,n){super(t,e,n),this.#T=n.data.name}run(){const t=super.run(),e=this.element;t?e.setAttribute(this.#T,!0===t?"":t):e.removeAttribute(this.#T)}}t.attribute({type:"enso:attr",match:(t,e)=>t.nodeType===Node.ELEMENT_NODE&&G(e,":","attr"),preprocess(t,e,n){const s=B(n),a=/* @__PURE__ */new Set,u=i(r(n.value,a));return t.addMutator(this,{name:s,action:new o(u,{name:s},c),binds:a}),e.removeAttribute(n.name),!0},process(t,e,r){for(const s of t){const t=s.action.createEffect(e,r);for(const r of s.binds)n(e,r,t)}}})}(tt,et),function(t,e){const{parseSource:n,addWatcher:r,Effect:s,Action:o}=e;class i extends s{#$;constructor(t,e,n){super(t,e,n),this.#$=n.data.name}run(){const t=super.run();void 0!==t&&(this.element[this.#$]=t)}}t.attribute({type:"enso:prop",match:(t,e)=>t.nodeType===Node.ELEMENT_NODE&&G(e,".","prop"),preprocess(t,e,r){const s=B(r),c=/* @__PURE__ */new Set,a=`(()=>${n(r.value,c).replaceAll("{{","").replaceAll("}}","").trim()})`;return t.addMutator(this,{name:s,action:new o(a,{name:s},i),binds:c}),e.removeAttribute(r.name),!0},process(t,e,n){for(const s of t){const t=s.action.createEffect(e,n);for(const n of s.binds)r(e,n,()=>t.run())}}})}(tt,et),function(t){t.generator({type:"enso:ref",match:t=>t.nodeType===Node.ELEMENT_NODE&&(t.hasAttribute("#ref")||t.hasAttribute("enso-ref")),preprocess(t,e){if(t.getGenerator())return!1;const n=I(e,"#ref","enso-ref");return t.setGenerator(this,{type:"ref",name:n}),t.markWatched(),!0},process(t,e,n){t&&"ref"===t.type&&(e.isComponent?Object.defineProperty(e.component.refs,t.name,{value:n,writable:!1,configurable:!1}):console.warn(`[Enso] #ref="${t.name}" ignored: refs are only supported on static elements (not inside *for or *if).`))}})}(tt),function(t,e){const{addBinding:n,parseSource:r,EnsoFragment:s,Action:o}=e;class i extends s{constructor(t,e,n){super(t),this._setENV(n),this._processTemplate(e)}mount(){return this.isAttached=!0,this._requestUpdate(),this._getChildren(),this._getNodes()}}class c extends s{#j;#C;constructor(t,e,n,r){super(t,null,n),this.#j=r.createEffect(t,null),this.#C=e}get tag(){return"enso:for"}run(){this.mount()}mount(){this.unmount();const t=[],e=this.#j.run();for(const n of e){const e=new i(this,this.#C,n);t.push(...e.mount())}this._insertAfterAnchor(...t),this.isAttached=!0,this._requestUpdate()}unmount(){for(const t of this._getChildFragments())t.unmount();this._getChildFragments().length=0,this.isAttached=!1}}t.generator({type:"enso:for",match:t=>t.nodeType===Node.ELEMENT_NODE&&(t.hasAttribute("*for")||t.hasAttribute("enso-for")),preprocess(t,e){if(t.getGenerator())return!1;const n=/* @__PURE__ */new Set,s=r(I(e,"*for","enso-for"),n),i=X(s),c=new o(`(function* () {\n try {\n for (const ${s}) {\n yield { ${i.join(", ")} };\n }\n } catch(e) {\n this._report(412, e);\n }\n }).bind(this);/*js*/`);return t.map.createRoot(e).setGenerator(this,{type:"for",action:c,binds:n,template:null}),!0},fragment(t,e){t.getGenerator().data.template=e},process(t,e,r){if("for"===t?.type){const s=new c(e,t.template,r,t.action);for(const r of t.binds)n(e,r,s)}}})}(tt,et),function(t,e){const{addBinding:n,parseSource:r,compileValue:s,Action:o,EnsoFragment:i}=e;class c extends i{#j;constructor(t,e,n,r){super(t,e,n),this.#j=r.createEffect(t,null)}get tag(){return"enso:if"}run(){this.#j.run()?this.mount():this.unmount()}}t.generator({type:"enso:if",match:t=>t.nodeType===Node.ELEMENT_NODE&&(t.hasAttribute("*if")||t.hasAttribute("enso-if")),preprocess(t,e){if(t.getGenerator())return!1;let n=I(e,"*if","enso-if");const i=/* @__PURE__ */new Set;n=r(n,i);const c=new o(s(n));return t.map.createRoot(e).setGenerator(this,{type:"if",action:c,binds:i,template:null}),!0},fragment(t,e){t.getGenerator().data.template=e},process(t,e,r){if("if"===t?.type){const s=new c(e,t.template,r,t.action);for(const r of t.binds)n(e,r,s)}}})}(tt,et);const nt=/{{[^]*}}/,rt=t=>(t=>t.nodeType===Node.ELEMENT_NODE&&t.hasAttribute("enso:ignore"))(t)||(t=>t.parentNode?.hasAttribute("enso:ignore-children"))(t)?NodeFilter.FILTER_REJECT:t.nodeType===Node.ELEMENT_NODE||t.nodeType===Node.TEXT_NODE&&nt.test(t.nodeValue)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_REJECT,st=NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT;class ot{#C=null;#a;constructor(t,e=new z){const n=x(t);this.#a=e,this.#C=this.#M(n),this.#P()}#M(t){if(K.isParsed(t))return t;const e=(t=>{const e=document.createElement(E);return e.append(t),e})(t.content);e.setAttribute(_,"COMPONENT"),t.content.append(e);const n=(t=>document.createTreeWalker(t,st,{acceptNode:rt}))(e);let r;for(;r=n.nextNode();){const t=this.#a.create(r);K.preprocess(t,r)}return t.setAttribute(N,""),t}#P(){const t=this.#C.content;let e;for((t=>{const e=t.querySelectorAll(`${E}:not([${_}])`);for(const n of e)n.replaceWith(...n.childNodes)})(t);e=K.getRoot(t);){const t=this.#a.getByRoot(e),n=H();t.unRoot(),t.replaceNode(n);const r=x(e);r.setAttribute(N,""),t.getGenerator()?.parser?.fragment(t,new ot(r,this.#a,!0),n)}}process(t){const e=this.#C.content.cloneNode(!0);let n;for(;n=K.getWatched(e);){const e=this.#a.getByNode(n);K.process(e,t,n)}return e}clone(){const t=this.#C.cloneNode(!0);return new ot(t,this.#a)}get watchedNodes(){return this.#a}get template(){return this.#C}}const it=(t,...e)=>"string"==typeof t?t:t.reduce((t,n,r)=>t+n+(e[r]||""),""),ct=(t,...e)=>(t=>{const e=new CSSStyleSheet;return e.replaceSync(t),e})(it(t,...e)),at=(t,...e)=>new ot(it(t,...e));const ut=/* @__PURE__ */new WeakMap,ht=/* @__PURE__ */new WeakMap,dt=(t,e)=>({get(n,r,s){const o=Reflect.get(n,r,s);return"object"==typeof o&&null!==o&&o?bt(o,e,t):o},set(n,r,s,o){const i=n[r],c=Reflect.set(n,r,s,o);return i!==s&&t(e),c},deleteProperty(n,r){const s=Object.prototype.hasOwnProperty.call(n,r),o=Reflect.deleteProperty(n,r);return s&&o&&t(e),o}}),lt=["values","entries","keys",Symbol.iterator],pt=(t,e,n)=>{const r=dt(t,e);return{...r,get(s,o,i){const c=Reflect.get(s,o,i);return"function"==typeof c&&n.has(o)?(...n)=>{const r=c.apply(s,n);return t(e),r}:((t,e)=>"function"==typeof t[e]&&lt.includes(e))(s,o)?s[o].bind(s):r.get(s,o,i)}}},ft=/* @__PURE__ */new Set(["push","pop","shift","unshift","splice","sort","reverse"]),mt=/* @__PURE__ */new Set(["add","delete","clear"]),gt=/* @__PURE__ */new Set(["set","delete","clear"]),bt=(t,e,n)=>{if("object"!=typeof t||null===t)return t;if(ut.has(t))return ut.get(t);const r=((t,e,n)=>Array.isArray(t)?pt(n,e,ft):t instanceof Set?pt(n,e,mt):t instanceof Map?pt(n,e,gt):dt(n,e))(t,e,n),s=new Proxy(t,r);return ut.set(t,s),ht.set(s,!0),s},yt=Object.freeze([Boolean,Number,String]),wt=/* @__PURE__ */new Map([[Boolean,{toProp:t=>"false"!==t&&null!==t,toAttr:t=>t?"":null}],[Number,{toProp:t=>Number(t),toAttr:t=>null!==t?String(t):null}],[String,{toProp:t=>t,toAttr:t=>t}]]);function Et(t){return"function"==typeof t?t:null===t||"object"!=typeof t?()=>t:()=>structuredClone(t)}const At=t=>Object.defineProperty(t,"_prop",{value:!0,writable:!1,configurable:!1,enumerable:!1});function _t(t=null,e=!1){return e=e&&null!==t&&"object"==typeof t,At({value:Et(t),deep:e,attribute:!1})}function Nt(t=null,n=String){const r=null!=t;r&&(n=t.constructor),(!yt.includes(n)||null!==t&&"object"==typeof t)&&e(201,n);const{toProp:s,toAttr:o}=wt.get(n);return At({value:Et(t),deep:!1,attribute:{type:n,force:r,toProp:s,toAttr:o}})}function St(t,n){return"function"!=typeof t&&e(211),Array.isArray(n)&&n.every(t=>"string"==typeof t)||e(212),n.includes(C.mount)||n.push(C.mount),At({value:void 0,deps:n,comp:t,deep:!1,attribute:!1})}function vt(t){return t.watched[$t]}function Ot(t,e){t.watched._update(e)}function Tt(t,n=[],r=!1){return"function"==typeof t&&void 0!==t.prototype?t.__watches={props:n,keep:r}:e(221),t}const $t=Symbol("enso.watched.values");function jt(t){t.startsWith("_")&&e(231)}function Ct(t,e,n){const r=e&&e._prop?e:_t(e);return r.name=t,r.watchers=n||[],r}class Mt{static define(t,n={}){const r=[],s=class extends Mt{};s.attr=[],s.defs=/* @__PURE__ */Object.create(null);for(const[o,i]of Object.entries(t)){jt(o);const t=Ct(o,i,n[o]);Object.defineProperty(s.prototype,t.name,{configurable:!0,enumerable:!0,get(){return this._getProp(t)},set(n){t.comp&&e(213,t.name),this._setProp(t,n)}}),t.comp&&r.push(t),s.defs[t.name]=t,t.attribute&&s.attr.push(t.name)}for(const e of M)s.defs[e]={name:e,value:()=>!1,attribute:!1,watchers:n[e]??[],lifecycle:!0};for(const e of r){const t=function(){this.watched._setProp(e,e.comp.call(this))};for(const n of e.deps){const e=s.defs[n];e&&e.watchers.push(t)}}return Object.freeze(s.defs),Object.freeze(s.attr),s}#b;#R=/* @__PURE__ */Object.create(null);#n=/* @__PURE__ */Object.create(null);constructor(t){this.#b=t;for(const n in this._defs){const r=this._defs[n];let s=r?.value?.();r.lifecycle||(t.hasOwnProperty(r.name)&&(s=t[r.name]),Object.defineProperty(t,r.name,{configurable:!0,enumerable:!0,get:()=>this._getProp(r),set:r.comp?()=>{e(213,r.name)}:t=>this._setProp(r,t)})),r.deep&&"object"==typeof s&&null!==s&&(s=bt(s,r.name,t[a])),this.#R[n]=s,this.#n[n]={changed:!1,watchers:r.watchers,effects:[]}}}get[f](){return this.#n}get[$t](){return structuredClone(this.#R)}get _defs(){return this.constructor.defs}_addWatcher(t,e){this.#n[t]&&this.#n[t].watchers.push(e)}_notify(t){if(this.#n[t]){const{watchers:e}=this.#n[t],n=this.#R[t];for(const r of e)r.call(this.#b,t,n)}}_getProp(t){return this.#R[t.name]}_setProp(t,e){t.deep&&"object"==typeof e&&null!==e&&(e=bt(e,t.name,this.#b[a])),this.#R[t.name]=e,this.#b[a](t.name),t.attribute&&this.#b.reflectAttribute(t.name)}_update(t){for(const e in t)t[e]!==this.#R[e]&&this._setProp(this._defs[e],t[e])}}let Pt=!1,Rt=null;const xt=(t,e)=>`${t}: ${e}`,Wt={version:"1.0.0-rc.14",component(t,{template:n,styles:r=null,expose:s={},watched:o={},script:i=null,settings:c={}}){c=((t={})=>({useShadow:!0,shadowMode:"open",...t}))(c),customElements.get(t)&&e(101,t);const a=function(t){const e=/* @__PURE__ */Object.create(null);if(!t)return e;for(const n in t){const r=t[n];if(r?.__watches){for(const t of r.__watches.props)(e[t]||=[]).push(r);r.__watches.keep||delete t[n]}}return e}(i),u=$(P,i),h=Mt.define(o,a);return r&&!Array.isArray(r)&&(r=[r]),Object.defineProperties(u,{observedAttributes:{get:()=>h.attr},WatchedClass:{get:()=>h}}),Object.defineProperties(u.prototype,{settings:{get:()=>c},template:{get:()=>n},styles:{get:()=>r},expose:{get:()=>s}}),customElements.define(t,u),function(t,e){function n(e,n){const r=e?Object.entries(e).reduce((t,[e,n])=>!0===n?`${t} ${e}`:null!=n&&!1!==n?`${t} ${e}="${n}"`:t,""):"";return null!=n?`<${t}${r}>${n}</${t}>`:`<${t}${r}></${t}>`}return n.toString=()=>`<${t}></${t}>`,n.tag=t,n.Class=e,n}(t,u)},use(t){t(Y,Q)},async enableDiagnostics(){Pt=!0,Rt||=import("./errors.es.js");const{default:t}=await Rt;Pt&&r(t)},disableDiagnostics(){Pt=!1,r(xt)}},Lt=Object.freeze(Wt);export{Lt as Enso,Nt as attr,St as computed,ct as css,Lt as default,vt as getWatched,at as html,C as lifecycle,_t as prop,Ot as setWatched,Tt as watches};
2
+ //# sourceMappingURL=ensojs.es.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ensojs.es.js","sources":["../src/core/errors.js","../src/core/symbols.js","../src/core/effects.js","../src/utils/css.js","../src/core/components.js","../src/component.js","../src/utils/dom.js","../src/utils/uuid.js","../src/templates/nodedef.js","../src/templates/parsers/utils.js","../src/templates/parsers/forUtils.js","../src/core/fragment.js","../src/templates/parser.js","../src/templates/parsers/parsers.js","../src/templates/parsers/eventParser.js","../src/templates/parsers/textParser.js","../src/templates/parsers/attrParser.js","../src/templates/parsers/propParser.js","../src/templates/parsers/refParser.js","../src/templates/parsers/forParser.js","../src/templates/parsers/ifParser.js","../src/templates/template.js","../src/core/tags.js","../src/core/watcher.js","../src/core/watched.js","../src/core/api.js","../version.js","../src/enso.js"],"sourcesContent":["\n// Part of Enso\n// Licensed under the MIT License, see LICENSE file in root.\n\nlet errorResolver = (code, data) => `${code}: ${data}`; \n\nexport const ensoError = (code, data) => {\n throw new Error(`[Enso] - ${errorResolver(code, data)}`);\n};\n\nexport const ensoReport = (level, code, data) => {\n const reporter = console[level];\n if (reporter) reporter(`[Enso] - ${errorResolver(code, data)}`);\n};\n\nexport const setErrorResolver = fn => {\n if (typeof fn === 'function') errorResolver = fn;\n};\n\n\n// Component Errors\n// E_COMPONENT_DEF: 101, //\n// E_COMPONENT_SUB: 102, //\n// E_COMPONENT_OBJ: 103, //\n\n// Watched Errors\n// E_ATTR_BAD_TYPE: 201, //\n// E_COMPUTED_FN: 211, //\n// E_COMPUTED_DEPS: 212, //\n// E_COMPUTED_SET: 213, //\n// E_WATCHES_FN: 221, //\n// E_WATCHED_NAME: 231, //\n\n// Effect Errors\n// E_EFFECT_COMPILE: 301, //\n// E_EFFECT_CREATE: 302, //\n// E_EFFECT_FUNC: 303, //\n// E_EFFECT_RUNNING: 311, //\n// E_EFFECT_RUNTIME: 312, //\n\n// Parser Errors\n// E_PARSER_TYPE: 401, //\n// E_FOR_BRACKETS: 411, //\n// E_FOR_RUNTIME: 412, //\n","\n// Part of Enso\n// Licensed under the MIT License, see LICENSE file in root.\n\n// Framework internal key\nexport const ENSO_INTERNAL = Symbol();\n\n// Enso Component internal framework method Symbols\nexport const SCHEDULE_UPDATE = Symbol();\nexport const SCHEDULE_EFFECT = Symbol();\nexport const ATTACH_TEMPLATE = Symbol();\nexport const MARK_CHANGED = Symbol();\nexport const ADD_CHILD = Symbol();\nexport const UPDATE = Symbol();\n\n// Enso Component internal framework property Symbols\nexport const GET_BINDING = Symbol();\nexport const ADD_BINDING = Symbol();\nexport const TASK_LIST = Symbol();\nexport const BINDINGS = Symbol();\nexport const CHILDREN = Symbol();\nexport const ANCHOR = Symbol();\nexport const NODES = Symbol();\nexport const ROOT = Symbol();\nexport const ENV = Symbol();\n\n// Fragment root component\nexport const ENSO_FRAGMENT = 'ENSO-FRAGMENT';\n\n// Watched and root node definition attributes\nexport const ENSO_NODE = 'enso-node';\nexport const ENSO_ROOT = 'enso-root';\nexport const ENSO_PARSED = 'enso-frag';\nexport const ENSO_TEMPLATE = 'enso-temp';\n","\n// Part of Enso\n// Licensed under the MIT License, see LICENSE file in root.\n\nimport { ensoError, ensoReport } from \"./errors.js\";\nimport { ENV } from \"./symbols.js\";\n\nconst isValid = v => !(v === true || v === false || v === null || v === undefined);\nconst parse = (strings, ...values) => {\n let isBool = false;\n const str = strings.reduce((a,c,i) => {\n const value = values[i];\n if (value === true) isBool = true;\n return a + c + (isValid(value) ? value : '');\n }, '');\n return (isBool && !str) ? true : str;\n};\n\n\nconst objectMasks = Object.freeze({\n Window: {}, Document: {}, eval: null, Function: null, setTimeout: null\n});\nconst rootEnv = Object.freeze({parse, ...objectMasks});\n\n/**\n * Constructs an environment ENV object\n * @param {Object} args - (Optional) Object containing environment \n * @param {Object} baseEnv - (Optional) Base environment to extend\n * @returns {Object} - New effect environment\n */\nexport const createEffectEnv = (args = {}, baseEnv = rootEnv) => (\n Object.freeze(\n Object.assign(\n Object.create(baseEnv), args\n )\n )\n);\n\n/**\n * Formats expression code as a string litteral\n * @param {String} value - Text and JS expressions in handlebars format\n * @returns {String} - Formatted expression\n */\nexport const compileValue = value => (\n /*js*/\n `(()=>parse\\`${value\n .replaceAll('{{', '${')\n .replaceAll('}}', '}')\n .trim()}\\`)`\n);\n\n// Encapsulates effect body code in wrapper code\nconst createFunctionBody = code => (\n /*js*/\n `with (env) {\n return (() => {\n \"use strict\";\n try { return ${code}; } catch(e) {\n this._report('error', 312, e); // E_EFFECT_RUNTIME\n return undefined;\n }\n })();\n }`\n);\n\nconst createAction = code => {\n const body = createFunctionBody(code);\n try {\n return new Function('env', body);\n } catch(e) {\n ensoReport('error', 301, `\\n${e}\\n${body}`); // E_EFFECT_COMPILE\n return () => () => {/* no-op on error */};\n }\n};\n\nexport class Effect {\n #element;\n #action;\n constructor(parent, element, action) {\n this.#element = element;\n try {\n this.#action = action.createFunc(parent);\n } catch (e) {\n ensoReport('error', 302, `\\n${e}\\n${action}`); // E_EFFECT_CREATE\n this.#action = () => {};\n }\n }\n\n get element() { return this.#element; }\n get action() { return this.#action; }\n\n run() {\n try {\n return this.#action?.();\n } catch (e) {\n ensoReport('error', 311, `\\n${e}\\n${this.#action.toString()}`); // E_EFFECT_RUNNING\n return undefined;\n }\n }\n}\n\nexport class Action {\n #Effect; #code; #data; #func;\n\n constructor(code, data = {}, effect = Effect) {\n this.#code = code;\n this.#Effect = effect;\n this.#data = data;\n this.#func = createAction(code);\n }\n\n get data() { return this.#data; }\n get code() { return this.#code; }\n\n createEffect(parent, element) {\n return ( new this.#Effect(\n parent, element, this\n ));\n }\n \n createFunc(parent) {\n const { component, [ENV]: env } = parent;\n const fn = this.#func.call(component, env);\n const cType = typeof fn;\n if (cType !== 'function') {\n ensoError(303, cType); // E_EFFECT_FUNC\n }\n return fn;\n }\n}\n","\n// Part of Enso\n// Licensed under the MIT License, see LICENSE file in root.\n\nexport const createStyleSheet = css => {\n const sheet = new CSSStyleSheet();\n sheet.replaceSync(css);\n return sheet;\n};\n\nexport const attachStyleSheets = (host, sheets)=> {\n const root = host instanceof ShadowRoot ?\n host : host.getRootNode();\n\n if ( !(root instanceof Document || root instanceof ShadowRoot) ) {\n return;\n }\n\n root.adoptedStyleSheets = [ \n ...root.adoptedStyleSheets, \n ...sheets\n ];\n};\n","\n/**\n * @module components Utillity functions for component handling\n */\n\n// Part of Enso\n// Licensed under the MIT License, see LICENSE file in root.\nimport { ensoError } from \"./errors.js\";\nimport { \n MARK_CHANGED, GET_BINDING, ADD_BINDING, TASK_LIST,\n SCHEDULE_EFFECT, SCHEDULE_UPDATE, UPDATE,\n ENSO_INTERNAL, BINDINGS, CHILDREN, ADD_CHILD\n} from \"./symbols.js\";\n\n/** Creates a derived class from a base class and Object Literal mixin */\nexport const createComponent = (base, proto) => {\n const component = class extends base { constructor() { super(ENSO_INTERNAL); } };\n\n // If no custom code implementation:\n if (!proto) return component;\n\n // Check that we've been given an Object litteral\n const cType = typeof proto;\n if (cType !== 'object') ensoError(103, cType); // E_COMPONENT_OBJ\n\n // Pull the custom fields out of the object mixin and add them to the component prototype\n const descriptors = Object.getOwnPropertyDescriptors(proto);\n for (const prop in descriptors) {\n Object.defineProperty(component.prototype, prop, descriptors[prop]);\n }\n\n return component;\n};\n\n/** Defines functionality shared by Components and Fragments */\nexport const EnsoNode = (Base = Object) => {\n return class extends Base {\n #bindings; // Bindings in this node\n #taskList = new Set(); // Set of effects to be run during the next update\n #children = []; // Child nodes\n\n constructor() {\n super();\n this[UPDATE] = this[UPDATE].bind(this);\n this[MARK_CHANGED] = this[MARK_CHANGED].bind(this);\n }\n\n get isComponent() { return false; }\n\n //// Accessors - Framework internal\n get [BINDINGS]() { return this.#bindings; }\n set [BINDINGS](bindings) { this.#bindings = bindings; }\n get [TASK_LIST]() { return this.#taskList; }\n get [CHILDREN]() { return this.#children; }\n\n [ADD_CHILD](fragment) {\n this.#children.push(fragment);\n }\n\n [GET_BINDING](bind) { return this.#bindings[bind]; }\n [ADD_BINDING](bind, effect) {\n const binding = this[GET_BINDING](bind);\n if (binding) {\n binding.effects.push(effect);\n binding.changed = true;\n }\n }\n\n [SCHEDULE_EFFECT](effect) {\n this.#taskList.add(effect);\n }\n\n [MARK_CHANGED](prop) {\n const bind = this.#bindings[prop];\n if (bind && !bind.changed) {\n bind.changed = true;\n\n for (const effect of bind.effects) {\n this[SCHEDULE_EFFECT](effect);\n }\n this[SCHEDULE_UPDATE]();\n }\n\n for (const child of this.#children) {\n child[MARK_CHANGED](prop);\n }\n }\n\n [UPDATE]() {\n // run all effects in the task list\n for (const effect of this.#taskList) {\n effect.run();\n }\n this.#taskList.clear();\n\n // reset all bindings\n for (const bind of Object.values(this.#bindings)) {\n bind.changed = false;\n }\n\n // recurse into children safely\n const children = [...this.#children];\n for (const child of children) {\n child[UPDATE]();\n }\n }\n };\n};\n\n","\n/*!\n * Enso v1.0.0\n * Copyright (c) 2025 Sean Young\n * Licensed under the MIT License\n */\n\nimport { createEffectEnv } from \"./core/effects.js\";\nimport { attachStyleSheets } from \"./utils/css.js\";\nimport { EnsoNode } from \"./core/components.js\";\nimport { \n ENV, ROOT, ATTACH_TEMPLATE, BINDINGS, \n UPDATE, SCHEDULE_UPDATE, ENSO_INTERNAL,\n MARK_CHANGED,\n} from \"./core/symbols.js\";\nimport { ensoError, ensoReport } from \"./core/errors.js\";\n\n\nexport const lifecycle = Object.freeze({\n mount: 'lifecycle:mount',\n update: 'lifecycle:update',\n unmount: 'lifecycle:unmount',\n});\nexport const lifecycles = Object.values(lifecycle);\n\n/**\n * Enso Web Component base class\n * @abstract\n */\nexport default class EnsoComponent extends EnsoNode(HTMLElement) {\n //// Instance Fields\n #initialised = false;\n // Root element -> either this, or shadowroot\n #root = null;\n // Reactivity properties\n #updateScheduled = false;\n #watched;\n #refs = Object.create(null);\n #env = createEffectEnv(this.expose);\n\n //// Setup\n #getShadowDom() {\n return (this.shadowRoot ?? this.attachShadow({ mode: this.settings.shadowMode }));\n }\n\n constructor(key) {\n super();\n\n if (key !== ENSO_INTERNAL) ensoError(102); // E_COMPONENT_SUB\n\n this.#watched = new this.constructor.WatchedClass(this);\n this[BINDINGS]= this.#watched[BINDINGS];\n \n this.#root = this.settings.useShadow ? this.#getShadowDom() : this;\n }\n \n _report(level, code, data) {\n ensoReport(level, code, data);\n }\n\n //// Accessors - External\n get refs() { return this.#refs; }\n get component() { return this; }\n get isAttached() { return this.#initialised; }\n get watched() { return this.#watched; }\n\n get isComponent() { return true; }\n\n //// Accessors - Framework internal\n get [ROOT]() { return this.#root; }\n get [ENV]() { return this.#env; }\n\n //// Web Component API\n\n connectedCallback() {\n if (this.#initialised) return;\n this.#initialised = true;\n\n // Loops through all properties defined as attributes \n // and sets their initial value if they're forced.\n const attributes = this.constructor.observedAttributes;\n for (const attr of attributes) {\n if (this.watched._defs[attr].attribute.force) {\n this.reflectAttribute(attr);\n }\n }\n\n // Parse and attach template\n this[ATTACH_TEMPLATE](\n this.template.process(this, this.template)\n );\n\n if (this.styles) {\n attachStyleSheets(this[ROOT], this.styles);\n }\n\n // Initial render\n this[UPDATE]();\n }\n\n disconnectedCallback() {\n this.#watched._notify(lifecycle.unmount);\n }\n \n // adoptedCallback() {} -- Not Yet Supported\n\n attributeChangedCallback(property, oldValue, newValue) {\n if (oldValue === newValue) return;\n const val = this.watched._defs[property].attribute.toProp(newValue);\n if (this.watched[property] !== val) this.watched[property] = val;\n }\n\n //// Lifecycle\n [MARK_CHANGED](prop) {\n super[MARK_CHANGED](prop);\n \n this.watched._notify(prop);\n }\n\n [ATTACH_TEMPLATE](DOM) {\n const nodes = Array.from(DOM.firstElementChild.childNodes);\n this[ROOT].append(...nodes);\n this.#watched._notify(lifecycle.mount);\n }\n\n reflectAttribute(attribute) {\n const attr = this.#watched._defs[attribute];\n const value = attr.attribute.toAttr(this.watched[attribute]);\n \n if (value !== this.getAttribute(attr.name)) {\n if (value === null) this.removeAttribute(attr.name);\n else this.setAttribute(attr.name, value);\n }\n }\n\n [SCHEDULE_UPDATE]() {\n if (!this.#updateScheduled) {\n this.#updateScheduled = true;\n requestAnimationFrame(this[UPDATE]);\n }\n }\n\n [UPDATE]() {\n this.#updateScheduled = false;\n\n super[UPDATE]();\n\n this.#watched._notify(lifecycle.update);\n }\n}\n","\n/**\n * @module DOM Defines functions for DOM manipulation\n */\n// Part of Enso\n// Licensed under the MIT License, see LICENSE file in root.\n\n//// Templating\nexport const createFragment = html => \n document.createRange().createContextualFragment(html);\n\nconst makeTemplate = html => {\n const template = document.createElement('template');\n template.content.appendChild(\n (typeof html === \"string\") ? \n createFragment(html) : html\n );\n return template;\n}\n\nexport const createTemplate = html => {\n\n const template = (html instanceof HTMLTemplateElement) ?\n html : makeTemplate(html);\n\n // Script tags are not allowed within enso templates\n template.content.querySelectorAll('script')\n .forEach(script => script.remove());\n\n return template;\n};\n\nexport const cloneTemplate = template => \n createTemplate(template.content.cloneNode(true));\n\n//// DOM traversal\nexport const getChildIndex = (parent, node) => \n Array.prototype.indexOf.call(parent.childNodes, node);\n\nexport const createWalker = (rootNode, nodeTypes, acceptNode) => {\n const filter = (typeof acceptNode === 'function') ? { acceptNode } : null;\n return document.createTreeWalker(rootNode, nodeTypes, filter);\n};\n","/**\n * @module uuid - Defines a basic non-secure UUID generator.\n * \n * Inspired by the non-secure version of the Nanoid library.\n */\n// Part of Enso\n// Licensed under the MIT License, see LICENSE file in root.\n\nconst alphabet = 'useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict';\n\n/**\n * Generates a simple, non-secure UUID of variable length\n * @param {Number} length - Length of the UUID to generate (default 6)\n * @returns {String} - The generated UUID\n */\nexport const uuid = (length = 6) => {\n let id = '', i = Math.max(0, Math.trunc(length));\n const al = alphabet.length;\n while (i--) id += alphabet[Math.trunc(Math.random() * al)];\n return id;\n};\n\n/**\n * Provides a function that generates a series of unique IDs for a scope.\n * All IDs generated from the same function share the same random base string,\n * with only the counter incrementing.\n * @param {String} prefix - A prefix for the ID\n * @param {Number} length - Length of the unique part of the ID (default 6)\n * @returns {Function} - A function that generates a scoped ID each time it is called\n */\nexport const scopedId = (prefix = \"enso\", length = 6) => {\n const base = uuid(length);\n let counter = 1;\n return () => `${prefix}-${base}-${counter++}`;\n};\n","\n// Part of Enso\n// Licensed under the MIT License, see LICENSE file in root.\n\nimport { uuid } from \"../utils/uuid.js\";\nimport { ENSO_NODE, ENSO_ROOT } from \"../core/symbols.js\";\n\n\nconst targetNode = node => (\n (node.nodeType === Node.TEXT_NODE) ?\n node.parentElement : node\n);\n\nexport class NodeDef {\n #id;\n #map;\n #node;\n\n #mutators = new Map();\n #generator = null;\n \n constructor(id, node, map) {\n this.#id = id;\n this.#map = map;\n this.#node = node;\n }\n\n get id() { return this.#id; }\n get node() { return this.#node; }\n get map() { return this.#map; }\n\n setGenerator(parser, data) { \n this.#generator = { parser, data };\n }\n getGenerator() { return this.#generator; }\n\n addMutator(parser, data) {\n if (!this.#mutators.has(parser)) {\n this.#mutators.set(parser, []);\n }\n this.#mutators.get(parser).push(data);\n this.markWatched();\n }\n /* v8 ignore start */ // There's no real logic here to cover differently\n getMutators(parser) {\n /* v8 ignore next */\n return this.#mutators.get(parser) || [];\n }\n /* v8 ignore stop */\n mutators() {\n return this.#mutators.entries();\n }\n\n // Node manipulation\n markRoot(tag = false) {\n this.#node?.setAttribute(ENSO_ROOT, tag ? this.#id : \"\");\n }\n unRoot() {\n this.#node?.removeAttribute(ENSO_ROOT);\n }\n isRoot() {\n return this.#node?.hasAttribute(ENSO_ROOT);\n }\n\n markWatched(append = true) {\n const el = targetNode(this.#node);\n if (!el.hasAttribute(ENSO_NODE)) {\n el.setAttribute(ENSO_NODE, this.#id);\n }\n if (append) this.#map.add(this);\n }\n unWatch() {\n const el = targetNode(this.#node);\n el?.removeAttribute(ENSO_NODE);\n }\n isWatched() {\n return this.#node?.hasAttribute(ENSO_NODE);\n }\n\n replaceNode(node) {\n const original = this.#node;\n this.#node.replaceWith(node);\n this.#node = node;\n this.markWatched(false);\n return original;\n }\n}\n\nexport class NodeDefMap {\n #map = new Map();\n\n get size() { return this.#map.size; }\n\n add(nodeDef) {\n if (!this.#map.has(nodeDef.id)) {\n this.#map.set(nodeDef.id, nodeDef);\n }\n }\n\n get(id) {\n if (this.#map.has(id)) return this.#map.get(id);\n return null;\n }\n getByNode(node) {\n if (!node?.hasAttribute(ENSO_NODE)) return null;\n const id = node.getAttribute(ENSO_NODE);\n return this.#map.get(id);\n }\n getByRoot(node) {\n if (!node?.hasAttribute(ENSO_ROOT)) return null;\n const id = node.getAttribute(ENSO_ROOT);\n return this.#map.get(id);\n }\n\n create(node) {\n const el = targetNode(node);\n const index = el.getAttribute(ENSO_NODE);\n return (this.#map.has(index) ?\n this.#map.get(index) : // Node is already watched, so return it's existing def\n new NodeDef( uuid(), node, this )\n );\n }\n\n createRoot(node) {\n const def = new NodeDef( uuid(), node, this );\n def.markRoot(true);\n this.add(def);\n return def;\n }\n\n [Symbol.iterator]() {\n return this.#map.values();\n }\n}\n","\n// Part of Enso\n// Licensed under the MIT License, see LICENSE file in root.\n\nimport { ADD_BINDING, SCHEDULE_EFFECT } from \"../../core/symbols.js\";\nimport { lifecycle } from \"../../component.js\";\n\n//// ATTRIBUTES\n\nexport const getName = (attr, prefixLen = 1) => {\n const name = attr.name;\n\n if (name.startsWith('enso-')) {\n // Longform, e.g. enso-evt:click\n const idx = name.indexOf(':');\n if (idx > -1) return name.slice(idx + 1).toLowerCase();\n }\n\n // Default shorthand behaviour\n return name.slice(prefixLen).toLowerCase();\n};\n\nexport const isAttr = (attribute, prefix, type = null) => {\n if (!attribute?.name) return false;\n const name = attribute.name;\n\n // Shorthand check\n if (name.startsWith(prefix)) return true;\n\n // Longform check, e.g. enso-evt:click\n if (type) {\n return name.startsWith(`enso-${type}:`);\n }\n\n return false;\n};\n//// BINDINGS\n\n// Matches object property dependencies, i.e:\n// this.watched.property (true path), \n// watched:property (namespaced) or\n// @:property (shorthand)\nconst bindEx = /(?:this\\.watched\\.|watched:|@:)([A-Za-z_$][\\w$]*)/g;\n// Reference mapping -> this.refs.reference\n// ref:property (namespace) or\n// #:property (shorthand)\nconst refEx = /(?:this\\.refs\\.|ref:|#:)([A-Za-z_$][\\w$]*)/g;\n/**\n * Collects bindings from a source string\n * @param {string} source \n * @param {Set} set \n */\nexport const collectBindings = (source, set) => {\n let match;\n while ((match = bindEx.exec(source)) !== null) {\n set.add(match[1]);\n }\n set.add(lifecycle.mount);\n};\n\n/**\n * Collects bindings, and rewrites watched references to \n * explicit: this.watched.prop access\n * @param {string} source \n * @param {Set} set \n * @returns {string}\n */\nexport const parseSource = (source, set = null) => {\n // Collect Watched bindings\n const ret = source.replace(bindEx, (_, prop) => {\n if (set) set.add(prop);\n return `this.watched.${prop}`;\n })\n // Collect References\n .replace(refEx, (_, prop) => (`this.refs.${prop}`));\n if (set) set.add(lifecycle.mount); // All Effects need to run at mount\n return ret;\n};\n\nexport const addBinding = (parent, bind, effect) => {\n parent[ADD_BINDING](bind, effect);\n // Schedule initial render\n parent[SCHEDULE_EFFECT](effect);\n};\n\nexport const addWatcher = (parent, bind, fn) => {\n parent.watched._addWatcher(bind, fn);\n const value = parent.watched._getProp(bind);\n fn.call(parent, bind, value);\n}\n\n//// DIRECTIVES\n\nexport const createPlaceholder = () => {\n const el = document.createElement(\"template\");\n return el;\n};\n\nexport const getOperator = (node, short, long) => {\n if (!node) return null;\n\n const operator = node.getAttributeNode(short) ?? node.getAttributeNode(long);\n if (operator) {\n node.removeAttribute(operator.name);\n }\n return operator?.value ?? null;\n};\n","\n// Part of Enso\n// Licensed under the MIT License, see LICENSE file in root.\n\nimport { ensoError } from \"../../core/errors\";\n\nconst parseIdentifier = identifier => {\n if (identifier.includes(':')) {\n return parseIdentifier(identifier.split(':')[1]);\n }\n if (identifier.includes('=')) {\n return parseIdentifier(identifier.split('=')[0]);\n }\n return identifier.trim();\n};\n// Parsers the item portion of the for value to get the \n// required top level item identifiers.\nconst getIdentifiers = source => {\n const brackets = { '{':'}', '[':']', '}':'{', ']':'[' };\n const stack = [{token:'', capturing: true}];\n let allowCapture = true;\n \n const openBracket = token => {\n const capturing = stack.at(-1).capturing && allowCapture;\n stack.push({ token: brackets[token], capturing });\n allowCapture = true;\n };\n const closeBracket = token => {\n // If the closing bracket doesn't match the last opened, error\n if (token !== stack.pop().token) {\n ensoError(411); // E_FOR_BRACKETS\n }\n allowCapture = false;\n };\n const nonCapturing = {\n ',': () => { allowCapture = true; },\n '{': openBracket, '[': openBracket,\n '}': closeBracket, ']': closeBracket,\n };\n\n const identifiers = source.split(/([{}[\\],])/).map(token => {\n if (!token?.trim()) return;\n if (nonCapturing[token]) return nonCapturing[token](token);\n \n if (stack.at(-1).capturing) {\n allowCapture = false;\n if (token.trim().at(-1) === ':') allowCapture = true;\n return parseIdentifier(token);\n }\n \n }).filter(Boolean);\n // If there are still open brackets, error\n if (stack.length > 1) {\n ensoError(411); // E_FOR_BRACKETS\n }\n return identifiers;\n};\n// Parses a For Value, i.e. (item of list, member in object etc)\n// and returns the list and item identifier.\nexport const parseFor = source => {\n const [item, ] = source.split(/\\b(?:of|in)\\b(?!.*\\b(of|in)\\b)/).filter(Boolean);\n const identifiers = getIdentifiers(item);\n return identifiers;\n};\n\n// Returns a function that iterates using the for code value\nexport const createForFunction = (code, ids) => (\n /*js*/\n `(function* () {\n try {\n for (const ${ code }) {\n yield { ${ ids.join(', ')} };\n }\n } catch(e) {\n this._report(412, e);\n }\n }).bind(this);/*js*/`\n);\n","\n// Part of Enso\n// Licensed under the MIT License, see LICENSE file in root.\n\nimport { EnsoNode } from \"./components.js\";\nimport { createEffectEnv } from \"./effects.js\";\nimport { \n NODES, ENV, ADD_CHILD, CHILDREN, SCHEDULE_UPDATE,\n BINDINGS, UPDATE, ANCHOR, ENSO_FRAGMENT,\n} from \"./symbols.js\";\n\n// Fragment placeholder component\nif (!customElements.get(ENSO_FRAGMENT.toLowerCase())) {\n class EnsoFragmentElement extends HTMLElement {}\n customElements.define(ENSO_FRAGMENT.toLowerCase(), EnsoFragmentElement);\n}\n\n/**\n * Enso Fragment base class\n * \n * Represents a dynamic fragment of DOM that can be mounted and unmounted\n * based on conditions in the parent component.\n * \n * Fragments are used to implement control flow directives such as *if and *for\n */\nexport class EnsoFragment extends EnsoNode() {\n #component; // Root component\n #parent; // Parent fragment\n #anchor; // Comment node defining the fragments DOM position\n #nodes = null; // Live nodes\n #root = null; // Fragment root\n #env; // Effect environment\n\n #attached = false; // Is the fragment currently attached to the DOM?\n\n constructor(parent, template, placeholder) {\n super();\n this.#component = parent.component;\n this.#parent = parent;\n this.#env = parent[ENV];\n\n // Remove the searchable placeholder node and replace with a comment anchor\n if (placeholder) {\n this.#anchor = document.createComment(this.tag);\n placeholder.replaceWith(this.#anchor);\n }\n\n // Register with parent\n parent[ADD_CHILD](this);\n\n // Create initial binding map\n const bindings = new Map();\n for (const [prop, bind] of Object.entries(this.#component[BINDINGS])) {\n bindings[prop] = {\n changed: false, watchers: bind.watchers, effects: []\n };\n }\n this[BINDINGS] = bindings;\n\n this._processTemplate(template);\n }\n _processTemplate(template) {\n if (!template) return;\n\n this.#root = template.process(this);\n }\n _getChildren() {\n this.#nodes = Array.from(this.#root.childNodes);\n }\n\n //// Accessors - Public\n get tag() { return \"enso:fragment\"; }\n get component() { return this.#component; }\n get isAttached() { return this.#attached; }\n set isAttached(val) { this.#attached = val; }\n\n //// Accessors - Framework internal\n get [ANCHOR]() { return this.#anchor; }\n get [NODES]() { return this.#nodes; }\n get [ENV]() { return this.#env; }\n set [ENV](env) {\n this.#env = createEffectEnv(env, this.#parent[ENV]);\n }\n\n get #parentAttached() { return this.#parent.isAttached; }\n\n //// Fragment Lifecycle\n [SCHEDULE_UPDATE]() {\n this.#component[SCHEDULE_UPDATE]();\n }\n\n mount() {\n if (this.#attached || !this.#parentAttached) return;\n\n this._getChildren();\n this.#anchor.after(...this.#nodes);\n this.#attached = true;\n this[UPDATE]();\n }\n\n [UPDATE]() {\n if (!this.#attached) return;\n super[UPDATE]();\n }\n\n unmount() {\n if (!this.#attached) return;\n\n this.#root.append(...this.#nodes);\n this.#nodes = null;\n this.#attached = false;\n }\n\n // Parser API\n _requestUpdate() {\n this[UPDATE]();\n }\n\n _getNodes() {\n return this[NODES];\n }\n\n _setENV(env) {\n this[ENV] = env;\n }\n\n _insertAfterAnchor(...elements) {\n this[ANCHOR].after(...elements);\n }\n\n _getChildFragments() {\n return this[CHILDREN];\n }\n}\n","/**\n * @module parser - Template parser and processor\n */\n\n// Part of Enso\n// Licensed under the MIT License, see LICENSE file in root.\n\nimport { ENSO_NODE, ENSO_PARSED, ENSO_ROOT } from \"../core/symbols.js\";\n\nimport { registerCoreParsers } from './parsers/parsers.js';\nimport { Action, compileValue, Effect } from \"../core/effects.js\";\nimport { EnsoFragment } from \"../core/fragment.js\";\nimport { \n addBinding, addWatcher, \n parseSource, collectBindings \n} from \"./parsers/utils.js\";\nimport { ensoError } from \"../core/errors.js\";\n\n\nconst createRegistry = () => {\n const map = new Map();\n return {\n get(node, attribute = null) {\n for (const parser of map.values()) {\n if (parser.match(node, attribute)) return parser;\n }\n return null;\n }, \n set(parser) {\n map.set(parser.type, parser);\n },\n [Symbol.iterator]() {\n return map.values();\n } \n }\n};\n\nexport const parser = (() => {\n\n const parsers = {\n generator: createRegistry(),\n attribute: createRegistry(),\n content: createRegistry(),\n }\n\n return Object.freeze({\n\n /**\n * Adds a parser to the parser registry\n * @param {object} parser \n * @param {string} type \n */\n register(parser, type = \"attribute\") {\n const registry = parsers[type];\n if (!registry) ensoError(401, type); // E_PARSER_TYPE\n\n registry.set(parser);\n },\n\n get(type, node, attribute=null) {\n const registry = parsers[type];\n if (!registry) ensoError(401, type); // E_PARSER_TYPE\n \n return registry.get(node, attribute);\n },\n /**\n * Tags a node as the root of an enso template/fragment\n * @param {HTMLElement} element - Root node\n */\n markRoot(element) {\n element.setAttribute(ENSO_ROOT, \"\");\n },\n\n /**\n * Gets the first child element tagged as a root\n * @param {HTMLElement/DocumentFragment} root \n * @returns \n */\n getRoot(root) {\n return root.querySelector(`[${ENSO_ROOT}]:not([${ENSO_ROOT}=\"COMPONENT\"])`);\n },\n\n /**\n * Returns whether the nodes beneath root have been parsed already.\n * @param {HTMLElement} element - Element\n * @returns {Boolean} \n */\n isParsed(element) {\n return element.hasAttribute(ENSO_PARSED);\n },\n\n /**\n * Returns first child element tagged as watched from given root\n * @param {HTMLElement || DocumentFragment} root - Root element\n */\n getWatched(root) {\n return root.querySelector(`[${ENSO_NODE}]`);\n },\n\n /**\n * Preprocesses the given node\n * @param {Object} def - Node mutation definition\n * @param {Node} node - The current template node\n * @returns {Boolean} - True if node was processed, otherwise false\n */\n preprocess(def, node) {\n let parsed = false;\n const opParser = parsers.generator.get(node);\n if (opParser) {\n parsed = opParser.preprocess(def, node);\n }\n\n for (const parser of parsers.content) {\n if (parser.match(node)) {\n /* v8 ignore next */\n parsed = parser.preprocess(def, node) || parsed;\n }\n }\n\n if (node.attributes?.length) {\n const attributes = [...node.attributes];\n for (const attribute of attributes) {\n const parser = parsers.attribute.get(node, attribute);\n if (parser) {\n parsed = parser.preprocess(def, node, attribute) || parsed;\n }\n }\n }\n return parsed;\n },\n\n /**\n * Processes a HTML element attached to a component instance based\n * on a mutation definition.\n * @param {Object} def - Node mutation definition\n * @param {Enso} parent - Host component or fragment instance\n * @param {HTMLElement} element - Current mutated element\n */\n process(def, parent, element) {\n // Apply operator parser first\n const generator = def.getGenerator();\n if (generator) {\n generator.parser.process(generator.data, parent, element);\n }\n // Loop through all the mutators attached to this node\n for (const [parser, data] of def.mutators()) {\n // Process the live node and attach any mutation effects\n parser.process(data, parent, element);\n }\n element.removeAttribute(ENSO_NODE);\n }\n });\n})();\n\nexport const ctx = Object.freeze({\n Effect, Action, compileValue,\n addBinding, addWatcher,\n parseSource, collectBindings,\n EnsoFragment,\n});\n\nexport const register = {\n generator(plugin) {\n parser.register(plugin, 'generator');\n },\n attribute(plugin) {\n parser.register(plugin, 'attribute');\n },\n content(plugin) {\n parser.register(plugin, 'content');\n }\n};\n\nregisterCoreParsers(register, ctx);\n","\n// Part of Enso\n// Licensed under the MIT License, see LICENSE file in root.\n\nimport eventParser from './eventParser.js';\nimport textParser from './textParser.js';\nimport attrParser from './attrParser.js';\nimport propParser from './propParser.js';\nimport refParser from './refParser.js';\nimport forParser from './forParser.js';\nimport ifParser from './ifParser.js';\n\n\nexport function registerCoreParsers(register, ctx) {\n eventParser(register, ctx);\n textParser(register, ctx);\n attrParser(register, ctx);\n propParser(register, ctx);\n refParser(register, ctx);\n forParser(register, ctx);\n ifParser(register, ctx);\n}\n","\n// Part of Enso\n// Licensed under the MIT License, see LICENSE file in root.\nimport { getName, isAttr } from \"./utils.js\";\n\n\nexport default function (register, ctx) {\n const { Action, parseSource } = ctx;\n\n function attachEventListener(parent, element, event) {\n const { name, action } = event;\n\n try {\n const handler = action.createFunc(parent);\n element.addEventListener(\n name.toLowerCase(), handler.bind(parent.component)\n );\n } catch (e) {\n /* v8 ignore next */\n console.error('[Enso] - ',e);\n }\n }\n\n // Event Attribute (@<event name>) parser\n register.attribute({\n type: 'enso:event',\n\n match(node, attribute) {\n return (\n node.nodeType === Node.ELEMENT_NODE &&\n isAttr(attribute, '@', 'evt')\n );\n },\n\n preprocess(def, node, attribute) {\n const source = parseSource(attribute.value);\n def.addMutator(this, {\n name: getName(attribute),\n action: new Action(source)\n });\n node.removeAttribute(attribute.name);\n\n return true;\n },\n\n process(data, parent, element) {\n for (const event of data) {\n attachEventListener(parent, element, event);\n }\n }\n\n });\n}\n","\n// Part of Enso\n// Licensed under the MIT License, see LICENSE file in root.\nimport { getChildIndex } from \"../../utils/dom.js\";\n\n\nexport default function (register, ctx) {\n const {\n addBinding, parseSource,\n Effect, Action, compileValue\n } = ctx;\n const nodeEx = /({{(.|\\n)*}})/;\n\n class TextEffect extends Effect {\n run() {\n const content = super.run();\n /* v8 ignore next */\n if (this.element && content) {\n this.element.textContent = content;\n }\n }\n }\n\n // Textnode parser\n register.content({\n type: 'enso:text',\n\n match(node) {\n return (\n node.nodeType === Node.TEXT_NODE &&\n nodeEx.test(node.nodeValue)\n );\n },\n\n preprocess(def, node) {\n const binds = new Set();\n const source = compileValue(\n parseSource(node.nodeValue, binds)\n );\n def.addMutator(this, {\n parent: node.parentNode,\n index: getChildIndex(node.parentNode, node),\n action: new Action(source, {}, TextEffect),\n binds\n });\n\n return true;\n },\n\n process(data, parent, element) {\n for (const text of data) { \n const node = element.childNodes[text.index];\n const effect = text.action.createEffect(parent, node);\n // Attach effect to all bindings\n for (const bind of text.binds) {\n addBinding(parent, bind, effect);\n }\n }\n }\n });\n}\n","\n// Part of Enso\n// Licensed under the MIT License, see LICENSE file in root.\nimport { getName, isAttr } from \"./utils.js\";\n\n\nexport default function (register, ctx) {\n\n const {\n addBinding, parseSource, \n Effect, Action, compileValue\n } = ctx;\n\n class AttrEffect extends Effect {\n #attr;\n constructor(parent, element, action) {\n super(parent, element, action);\n this.#attr = action.data.name;\n }\n\n run() {\n const content = super.run();\n const el = this.element;\n if (content) {\n el.setAttribute(this.#attr, (content === true) ? '' : content);\n }\n else {\n el.removeAttribute(this.#attr);\n }\n }\n }\n\n // Attribute binding (:<attribute name>) parser\n register.attribute({\n type: 'enso:attr',\n\n match(node, attribute) {\n return (\n node.nodeType === Node.ELEMENT_NODE &&\n isAttr(attribute, ':', 'attr')\n );\n },\n\n preprocess(def, node, attribute) {\n const name = getName(attribute);\n const binds = new Set();\n const source = compileValue(\n parseSource(attribute.value, binds)\n );\n def.addMutator(this, {\n name, \n action: new Action(source, {name}, AttrEffect),\n binds\n });\n node.removeAttribute(attribute.name);\n\n return true;\n },\n\n process(data, parent, element) {\n for (const attr of data) { \n const effect = attr.action.createEffect(parent, element);\n // Attach effect to all bindings\n for (const bind of attr.binds) {\n addBinding(parent, bind, effect);\n }\n }\n }\n\n });\n}","\n// Part of Enso\n// Licensed under the MIT License, see LICENSE file in root.\n\nimport { getName, isAttr } from \"./utils.js\";\n\n\nexport default function (register, ctx) {\n const {\n parseSource, addWatcher,\n Effect, Action\n } = ctx;\n\n const compileValue = code => (\n /*js*/\n `(()=>${code\n .replaceAll('{{', '')\n .replaceAll('}}', '')\n .trim()})`\n );\n\n class PropEffect extends Effect {\n #prop;\n constructor(parent, element, action) {\n super(parent, element, action);\n this.#prop = action.data.name;\n }\n\n run() {\n const content = super.run();\n if (content !== undefined) {\n this.element[this.#prop] = content;\n }\n }\n }\n\n // Property binding (.:<property name>) parser\n register.attribute({\n type: 'enso:prop',\n\n match(node, attribute) {\n return (\n node.nodeType === Node.ELEMENT_NODE &&\n isAttr(attribute, '.', 'prop')\n );\n },\n\n preprocess(def, node, attribute) {\n const name = getName(attribute);\n const binds = new Set();\n const source = compileValue(\n parseSource(attribute.value, binds)\n );\n def.addMutator(this, {\n name,\n action: new Action(source, {name}, PropEffect),\n binds\n });\n node.removeAttribute(attribute.name);\n\n return true;\n },\n\n process(data, parent, element) {\n for (const prop of data) { \n const effect = prop.action.createEffect(parent, element);\n for (const bind of prop.binds) {\n addWatcher(parent, bind, ()=>effect.run());\n }\n }\n }\n });\n}\n","\n// Part of Enso\n// Licensed under the MIT License, see LICENSE file in root.\n\nimport { getOperator } from \"./utils.js\";\n\n\nexport default function (register) {\n\n // Reference Attribute (#ref) parser\n register.generator({\n type: 'enso:ref',\n\n match(node) {\n return (\n node.nodeType === Node.ELEMENT_NODE &&\n (node.hasAttribute('#ref') || \n node.hasAttribute('enso-ref'))\n );\n },\n\n preprocess(def, node) {\n if (def.getGenerator()) return false;\n\n const ref = getOperator(node, '#ref', 'enso-ref');\n def.setGenerator(this, {type: 'ref', name: ref});\n def.markWatched();\n\n return true;\n },\n\n process(data, parent, element) {\n if (!data || data.type !== 'ref') return;\n\n if (!parent.isComponent) {\n console.warn(\n `[Enso] #ref=\"${data.name}\" ignored: refs are only supported on static elements (not inside *for or *if).`\n );\n return;\n }\n\n Object.defineProperty(parent.component.refs, data.name, {\n value: element,\n writable: false,\n configurable: false,\n });\n }\n\n });\n}","\n// Part of Enso\n// Licensed under the MIT License, see LICENSE file in root.\nimport { getOperator } from \"./utils.js\";\nimport { parseFor, createForFunction } from \"./forUtils.js\";\n\n\nexport default function (register, ctx) {\n const {\n addBinding, parseSource,\n EnsoFragment, Action\n } = ctx;\n \n class ItemFragment extends EnsoFragment {\n constructor(parent, template, item) {\n super(parent);\n this._setENV(item);\n this._processTemplate(template);\n }\n mount() {\n this.isAttached = true;\n this._requestUpdate();\n this._getChildren();\n return this._getNodes();\n }\n }\n\n class ForFragment extends EnsoFragment {\n #effect;\n #template;\n constructor(parent, template, placeholder, action) {\n super(parent, null, placeholder);\n this.#effect = action.createEffect(parent, null);\n this.#template = template;\n }\n get tag() { return \"enso:for\"; }\n\n run() {\n this.mount();\n }\n\n mount() {\n // Clear children list\n this.unmount();\n // Construct new items\n const elements = [];\n const iterator = this.#effect.run();\n for (const item of iterator) {\n // Copy template to a new ItemFragment\n const child = new ItemFragment(\n this, this.#template, item\n );\n // Mount\n elements.push(...child.mount());\n }\n this._insertAfterAnchor(...elements);\n this.isAttached = true;\n this._requestUpdate();\n }\n\n unmount() {\n for (const child of this._getChildFragments()) {\n child.unmount();\n }\n this._getChildFragments().length = 0;\n this.isAttached = false;\n }\n }\n\n // *for=\"item in/of items\"\n register.generator({\n type: 'enso:for',\n\n match(node) {\n return (\n node.nodeType === Node.ELEMENT_NODE &&\n (node.hasAttribute('*for') || \n node.hasAttribute('enso-for'))\n );\n },\n\n preprocess(def, node) {\n if (def.getGenerator()) return false;\n\n const binds = new Set();\n const source = parseSource(\n getOperator(node, '*for', 'enso-for'),\n binds\n );\n const identifiers = parseFor(source);\n const action = new Action(\n createForFunction(source, identifiers),\n );\n\n // Create new nodedef for the for directive.\n const forDef = def.map.createRoot(node);\n forDef.setGenerator(this, {\n type: 'for', \n action, \n binds, \n template: null\n });\n \n return true;\n },\n\n fragment(def, template) {\n def.getGenerator().data.template = template;\n },\n \n process(data, parent, element) {\n if (data?.type === 'for') {\n const fragment = new ForFragment(\n parent, data.template, element, data.action\n );\n\n for (const bind of data.binds) {\n addBinding(parent, bind, fragment);\n }\n }\n },\n });\n}\n","\n// Part of Enso\n// Licensed under the MIT License, see LICENSE file in root.\n\nimport { getOperator } from \"./utils.js\";\n\n\nexport default function (register, ctx) {\n const {\n addBinding, parseSource,\n compileValue, Action,\n EnsoFragment\n } = ctx;\n\n class IfFragment extends EnsoFragment {\n #effect;\n constructor(parent, template, placeholder, action) {\n super(parent, template, placeholder);\n this.#effect = action.createEffect(parent, null);\n }\n\n get tag() { return \"enso:if\"; }\n\n run() {\n const show = this.#effect.run();\n if (show) {\n this.mount();\n } else {\n this.unmount();\n }\n }\n }\n\n // *if=\"{{ <expression> }}\"\n register.generator({\n type: 'enso:if',\n\n match(node) {\n return (\n node.nodeType === Node.ELEMENT_NODE &&\n (node.hasAttribute('*if') || \n node.hasAttribute('enso-if'))\n );\n },\n\n preprocess(def, node) {\n if (def.getGenerator()) return false;\n // get and ensure directive matches parser\n let directive = getOperator(node, '*if', 'enso-if');\n const binds = new Set();\n\n directive = parseSource(directive, binds);\n const action = new Action(compileValue(directive));\n\n // Create new nodedef for the if directive.\n const ifDef = def.map.createRoot(node);\n ifDef.setGenerator(this, {\n type: 'if', \n action, \n binds, \n template: null\n });\n\n return true;\n },\n\n fragment(def, template) {\n def.getGenerator().data.template = template;\n },\n\n process(data, parent, element) {\n if (data?.type === 'if') {\n const fragment = new IfFragment(\n parent, data.template, element, data.action\n );\n\n // Attach effect to all bindings\n for (const bind of data.binds) {\n addBinding(parent, bind, fragment);\n }\n }\n }\n });\n}\n","/* eslint-disable no-cond-assign */\n\n// Part of Enso\n// Licensed under the MIT License, see LICENSE file in root.\n\nimport { createTemplate } from \"../utils/dom.js\";\nimport { NodeDefMap } from \"./nodedef.js\";\nimport { parser } from \"./parser.js\";\nimport { createPlaceholder } from \"./parsers/utils.js\";\nimport { ENSO_PARSED, ENSO_FRAGMENT, ENSO_ROOT } from \"../core/symbols.js\";\n\n\n// If node is a text node with handle bars ( {{ }} ) or an element, parse it\nconst nodeEx = /{{[^]*}}/;\n\n// Explicit ignore attribute\nconst isIgnoreNode = node => (\n node.nodeType === Node.ELEMENT_NODE &&\n node.hasAttribute('enso:ignore')\n);\n// Explicit ignore children attribute\nconst isIgnoredChild = node => (\n node.parentNode?.hasAttribute('enso:ignore-children')\n);\n// Tree walker filter\nconst acceptNode = node => {\n // Ignore explicit no parse directives\n if (isIgnoreNode(node)) {\n return NodeFilter.FILTER_REJECT;\n }\n // Ignore children if specified\n if (isIgnoredChild(node)) {\n return NodeFilter.FILTER_REJECT;\n }\n // Accept all other element nodes\n if (node.nodeType === Node.ELEMENT_NODE) {\n return NodeFilter.FILTER_ACCEPT;\n }\n // Accept text nodes with template directives\n if (node.nodeType === Node.TEXT_NODE && \n nodeEx.test(node.nodeValue)) {\n return NodeFilter.FILTER_ACCEPT;\n }\n // Reject all other nodes\n return NodeFilter.FILTER_REJECT;\n};\n\nconst NODE_TYPES = NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_TEXT;\n\nconst getWalker = rootNode => \n document.createTreeWalker(rootNode, NODE_TYPES, { acceptNode });\n\n\nconst extractLooseFragments = root => {\n const loose = root.querySelectorAll(\n `${ENSO_FRAGMENT}:not([${ENSO_ROOT}])`\n );\n\n for (const node of loose)\n node.replaceWith(...node.childNodes);\n};\n\nconst wrapFragment = (root) => {\n const frag = document.createElement(ENSO_FRAGMENT);\n frag.append(root);\n return frag;\n};\n\n\nexport default class EnsoTemplate {\n #template = null; // The underlying HTML template\n #watched; // The nodes that are referenced or mutated\n\n constructor(html, watched = new NodeDefMap()) {\n const template = createTemplate(html);\n this.#watched = watched;\n\n this.#template = this.#parse(template);\n this.#fragment();\n }\n\n #parse(template) {\n if (parser.isParsed(template)) return template;\n\n const rootNode = wrapFragment(template.content);\n rootNode.setAttribute(ENSO_ROOT, \"COMPONENT\");\n template.content.append(rootNode);\n const walker = getWalker(rootNode);\n \n let node;\n while (node = walker.nextNode()) {\n const def = this.#watched.create(node);\n parser.preprocess(def, node);\n }\n template.setAttribute(ENSO_PARSED, \"\");\n\n return template;\n }\n\n #fragment() {\n const rootNode = this.#template.content;\n // Ensure there's no orphand enso-fragments\n extractLooseFragments(rootNode);\n // Iterate over sub roots, pull them out and place them \n // into new templates and attach to placeholder nodes.\n let root;\n while (root = parser.getRoot(rootNode)) {\n // Get node watch parameters and replace with placeholder\n const def = this.#watched.getByRoot(root);\n const placeholder = createPlaceholder();\n def.unRoot();\n def.replaceNode( placeholder );\n\n // Construct and append the template.\n const template = createTemplate(root);\n\n template.setAttribute(ENSO_PARSED, \"\");\n def.getGenerator()?.parser?.fragment(\n def, new EnsoTemplate(template, this.#watched, true),\n placeholder\n );\n }\n }\n\n process(parent) {\n // Parse and attach template\n const DOM = this.#template.content.cloneNode(true);\n // Loop through the elements and process any watched nodes\n let element;\n while (element = parser.getWatched(DOM)) {\n const def = this.#watched.getByNode(element);\n parser.process( def, parent, element );\n }\n\n return DOM;\n }\n\n clone() {\n const template = this.#template.cloneNode(true);\n return new EnsoTemplate(template, this.#watched);\n }\n\n get watchedNodes() { return this.#watched; }\n get template() { return this.#template; }\n}\n","\n// Part of Enso\n// Licensed under the MIT License, see LICENSE file in root.\n\nimport EnsoTemplate from \"../templates/template.js\";\nimport { createStyleSheet } from \"../utils/css.js\";\n\n\nconst combine = (strings, ...values) => {\n // Used as a parser function\n if (typeof strings === \"string\") return strings;\n // Used as a template tag\n return strings.reduce((a,c,i) => a + c + (values[i] || ''), '');\n};\n\n/**\n * Parses a template string and returns an Enso stylesheet\n * @returns {CSSStyleSheet}\n */\nexport const css = (strings, ...values) => (\n createStyleSheet(combine(strings, ...values))\n);\n \n/**\n * Parses a template string and returns an Enso HTML template\n * @returns {EnsoTemplate}\n */\nexport const html = (strings, ...values) => (\n new EnsoTemplate(combine(strings, ...values))\n);\n\n/**\n * Internal: Create a callable component tag wrapper.\n *\n * Supports:\n * ${Comp} → <tag></tag>\n * ${Comp(attrs)} → <tag attr=\"...\"></tag>\n * ${Comp(null, children)} → <tag>children</tag>\n * ${Comp(attrs, 'children')} → <tag attr=\"...\">children</tag>\n * \n * @param {string} tag - custom element name\n * @param {class} ComponentClass - the actual component constructor\n * @param {object|null} attrs - optional attributes to include\n * @returns {function} - callable template tag function + metadata\n */\nexport function createComponentTag(tag, ComponentClass) {\n function Comp(attrs, children) {\n const attrStr = attrs\n ? Object.entries(attrs).reduce((s, [k, v]) => {\n if (v === true) return `${s} ${k}`;\n if (v != null && v !== false) return `${s} ${k}=\"${v}\"`;\n return s;\n }, \"\")\n : \"\";\n\n return children != null\n ? `<${tag}${attrStr}>${children}</${tag}>`\n : `<${tag}${attrStr}></${tag}>`;\n }\n\n Comp.toString = () => `<${tag}></${tag}>`;\n Comp.tag = tag;\n Comp.Class = ComponentClass;\n\n return Comp;\n}\n","\n// Part of Enso\n// Licensed under the MIT License, see LICENSE file in root.\n\nconst proxies = new WeakMap();\nconst reactives = new WeakMap();\n\nconst baseWatcher = (onChange, name) => ({\n get(target, prop, receiver) {\n const value = Reflect.get(target, prop, receiver);\n\n if (typeof value === 'object' && value !== null &&(value)) {\n return watch(value, name, onChange);\n }\n return value;\n },\n\n set(target, prop, value, receiver) {\n const oldValue = target[prop];\n const result = Reflect.set(target, prop, value, receiver);\n\n if (oldValue !== value) {\n onChange(name);\n }\n\n return result;\n },\n\n deleteProperty(target, prop) {\n const hadKey = Object.prototype.hasOwnProperty.call(target, prop);\n const result = Reflect.deleteProperty(target, prop);\n\n if (hadKey && result) {\n onChange(name);\n }\n\n return result;\n },\n});\n\nconst iterators = ['values','entries','keys', Symbol.iterator];\nconst isIterator = (target, prop) => (\n typeof target[prop] === 'function' && \n iterators.includes(prop)\n);\n\nconst mutatorWatcher = (onChange, name, trapMethods) => {\n const base = baseWatcher(onChange, name);\n \n return {\n ...base,\n get(target, prop, receiver) {\n const value = Reflect.get(target, prop, receiver);\n if (typeof value === 'function' && trapMethods.has(prop)) {\n return (...args) => {\n const result = value.apply(target, args);\n onChange(name);\n return result;\n };\n }\n\n // For iteration methods (values, entries, keys, Symbol.iterator), \n // return the original function bound to target\n if (isIterator(target, prop)) {\n return target[prop].bind(target);\n }\n\n return base.get(target, prop, receiver);\n }\n };\n};\n\nconst arrayMethods = new Set(['push','pop','shift','unshift','splice','sort','reverse']);\nconst setMethods = new Set(['add','delete','clear']);\nconst mapMethods = new Set(['set','delete','clear']);\n\nconst getWatcher = (target, name, onChange) => {\n if (Array.isArray(target)) return mutatorWatcher(\n onChange, name, arrayMethods\n );\n if (target instanceof Set) return mutatorWatcher(\n onChange, name, setMethods\n );\n if (target instanceof Map) return mutatorWatcher(\n onChange, name, mapMethods\n );\n return baseWatcher(onChange, name);\n};\n\nexport const watch = (target, name, onChange) => {\n if (typeof target !== 'object' || target === null) return target;\n \n if (proxies.has(target)) return proxies.get(target);\n \n const watcher = getWatcher(target, name, onChange);\n const proxy = new Proxy(target, watcher);\n proxies.set(target, proxy);\n reactives.set(proxy, true);\n return proxy;\n};\n\nexport const isReactive = (value) => (\n reactives.has(value)\n);\n","\n// Part of Enso\n// Licensed under the MIT License, see LICENSE file in root.\n\nimport { watch } from \"./watcher.js\";\nimport { lifecycle, lifecycles } from \"../component.js\";\nimport { BINDINGS, MARK_CHANGED } from \"./symbols.js\";\nimport { ensoError } from \"./errors.js\";\n\n\nexport const attributeTypes = Object.freeze([\n Boolean, Number, String\n]);\n\nconst converters = new Map([\n [Boolean, {\n toProp(val) { return (val !== 'false' && val !== null); },\n toAttr(val) { return val ? '' : null; }\n }],\n [Number, {\n toProp(val) { return Number(val); },\n toAttr(val) { return val !== null ? String(val) : null; }\n }],\n [String, {\n toProp(val) { return val; },\n toAttr(val) { return val; }\n }]\n]);\n\nfunction createFactory(value) {\n if (typeof value === 'function') return value;\n\n if (value === null || typeof value !== 'object') {\n return () => value;\n }\n\n return () => structuredClone(value);\n}\n\n//// USER FACING\n\nconst descripter = (desc) => Object.defineProperty(desc, '_prop', {\n value: true, writable: false, configurable: false, enumerable: false\n});\n\n/**\n * Create a watched property descriptor.\n *\n * - If `deep` is true AND `value` is a non-null object, deep reactivity is enabled.\n * - Primitive values always produce shallow descriptors.\n *\n * @param {*} value - Initial property value.\n * @param {boolean} [deep=false] - Whether to enable deep reactivity if the value is an object.\n * @returns {object} - A property descriptor object consumed by the watched system.\n */\nexport function prop(value = null, deep=false) {\n deep = deep && (value !== null && typeof value === 'object');\n return descripter({\n value: createFactory(value), deep, attribute: false\n });\n};\n\n/**\n * Create a watched attribute descriptor (string/number/boolean).\n *\n * - Automatically detects type from the default value if provided.\n * - Rejects object values and unsupported constructors.\n *\n * @param {string|number|boolean|null} value - Default attribute value. If non-null, determines the attribute type unless explicitly overridden.\n * @param {Function} [type=String] - Constructor representing the expected attribute type (String, Number, Boolean).\n * @throws {Error} - If value is an object, or type is not in the allowed attributeTypes list.\n * @returns {object} - A descriptor object defining attribute parsing, serialisation, and reactivity.\n */\nexport function attr(value = null, type = String) {\n const force = (value !== null && value !== undefined);\n\n if (force) {\n type = value.constructor;\n }\n\n if (!attributeTypes.includes(type) || (value !== null && typeof value === 'object')) {\n ensoError(201, type); // E_ATTR_BAD_TYPE\n }\n\n const { toProp, toAttr } = converters.get(type);\n return descripter({\n value: createFactory(value), deep: false, attribute: {\n type, force, toProp, toAttr\n }\n });\n};\n\n/**\n * Creates a computed watched property descriptor.\n * - Reruns the given function and saves the return value whenever\n * watched properties in deps change.\n * \n * @param {Function} fn - Function to recalculate computed value.\n * @param {Array<String>} deps - Array of string watched property names.\n * @returns - A descriptor object defining the computed property.\n */\nexport function computed(fn, deps) {\n if (typeof fn !== 'function') {\n ensoError(211); // E_COMPUTED_FN\n }\n if (!Array.isArray(deps) || !deps.every(d => typeof d === 'string')) {\n ensoError(212); // E_COMPUTED_DEPS\n }\n if (!deps.includes(lifecycle.mount)) {\n deps.push(lifecycle.mount);\n }\n return descripter({\n value: undefined,\n deps,\n comp: fn, \n deep: false, \n attribute: false, \n });\n};\n\n/**\n * Get all watched values for a given component.\n * \n * @param {EnsoComponent} component - The component to retrieve watched values from.\n * @returns {Object<string, any>} An object literal containing all watched properties.\n */\nexport function getWatched(component) {\n return component.watched[VALUES];\n}\n\n/**\n * Set multiple watched values on a component, and triggers updates for changes.\n *\n * @param {EnsoComponent} component - The component whose watched values are being updated.\n * @param {Object<string, any>} values - Object containing key/value pairs to update.\n */\nexport function setWatched(component, values) {\n component.watched._update(values);\n}\n\n/**\n * Tags a script method to be notified when watched properties change\n * @param {Function} fn - The function to call\n * @param {[String]} props - List of watched properties to watch\n * @returns {Function} The watcher function\n */\nexport function watches(fn, props = [], keep=false) {\n if (typeof fn === 'function' && fn.prototype !== undefined) {\n fn.__watches = { props, keep };\n } else {\n ensoError(221); // E_WATCHES_FN\n }\n return fn;\n}\n\nconst VALUES = Symbol('enso.watched.values');\n\n/**\n * Scans through the given script and collects any methods\n * that should be called when properties change.\n * @param {Object} script - The component's script object\n * @returns {Object} - Property keys with watching methods.\n */\nexport function parseScript(script) {\n const watchers = Object.create(null);\n if (!script) return watchers;\n\n for (const key in script) {\n const fn = script[key];\n if (fn?.__watches) {\n for (const prop of fn.__watches.props) {\n (watchers[prop] ||= []).push(fn);\n }\n if (!fn.__watches.keep) delete script[key];\n }\n }\n return watchers;\n}\n\nfunction validateName(name) {\n if (name.startsWith('_'))\n ensoError(231); // E_WATCHED_NAME\n}\n\nfunction createPropDesc(name, d, w) {\n const p = d && d._prop ? d : prop(d);\n p.name = name;\n p.watchers = w || [];\n return p;\n}\n\nexport class Watched {\n\n // Builds a subclass of Watched tailored to the properties passed\n static define(properties, watchers={}) {\n const computed = [];\n const cls = class extends Watched {};\n cls.attr = [];\n cls.defs = Object.create(null);\n\n // For each watched property\n for (const [name, property] of Object.entries(properties)) {\n validateName(name);\n // Construct property description\n const prop = createPropDesc(name, property, watchers[name]);\n Object.defineProperty(cls.prototype, prop.name, {\n configurable: true,\n enumerable: true,\n get() {\n return this._getProp(prop);\n },\n set(val) {\n if (prop.comp) ensoError(213, prop.name); // E_COMPUTED_SET\n this._setProp(prop, val);\n }\n });\n\n // If computed - flag for adding to watchers.\n if (prop.comp) computed.push(prop);\n\n // Insert definitions and observed attributes\n cls.defs[prop.name] = prop;\n if (prop.attribute) cls.attr.push(prop.name);\n }\n for (const lifecycle of lifecycles) {\n cls.defs[lifecycle] = { \n name: lifecycle, \n value: () => false,\n attribute: false,\n watchers: watchers[lifecycle] ?? [],\n lifecycle: true,\n };\n }\n for (const comp of computed) {\n const reCompute = function() { \n this.watched._setProp(comp, comp.comp.call(this));\n }\n for (const dep of comp.deps) {\n const def = cls.defs[dep];\n if (def) {\n def.watchers.push(reCompute);\n }\n }\n }\n Object.freeze(cls.defs);\n Object.freeze(cls.attr);\n return cls;\n }\n\n #component; // Component owner\n #values = Object.create(null); // Holds the actual property values\n #bindings = Object.create(null);// Bindings for the watched properties\n\n constructor(component) {\n this.#component = component;\n // Property and binding setup\n for (const defName in this._defs) {\n const prop = this._defs[defName];\n let value = prop?.value?.();\n // Add accessors to component instance, and upgrade values if needed\n if (!prop.lifecycle) {\n if (component.hasOwnProperty(prop.name)) {\n value = component[prop.name];\n }\n Object.defineProperty(component, prop.name, {\n configurable: true,\n enumerable: true,\n get: () => this._getProp(prop),\n set: (prop.comp)\n ? ()=>{ ensoError(213, prop.name); } // E_COMPUTED_SET\n : v => this._setProp(prop, v),\n });\n }\n\n // Wrap value in proxy if deep reactivity requested\n if (prop.deep && typeof value === 'object' && value !== null) {\n value = watch(value, prop.name, component[MARK_CHANGED]);\n }\n // Add to values map\n this.#values[defName] = value;\n // Create binding\n this.#bindings[defName] = {\n changed: false, // Has value changed?\n watchers: prop.watchers, // List of functions to notify of changes\n effects: [], // List of effects to schedule on change\n };\n }\n }\n\n get [BINDINGS]() { return this.#bindings; }\n get [VALUES]() { return structuredClone(this.#values); }\n get _defs() { return this.constructor.defs; }\n\n _addWatcher(prop, fn) {\n if (this.#bindings[prop]) {\n this.#bindings[prop].watchers.push(fn);\n }\n }\n\n _notify(prop) {\n if (this.#bindings[prop]) {\n const { watchers } = this.#bindings[prop];\n const value = this.#values[prop];\n\n for (const watcher of watchers) {\n watcher.call(\n this.#component, prop, value\n );\n }\n }\n }\n\n _getProp(prop) {\n return this.#values[prop.name];\n }\n\n _setProp(prop, value) {\n if (prop.deep && typeof value === 'object' && value !== null) {\n value = watch(value, prop.name, this.#component[MARK_CHANGED]);\n }\n\n this.#values[prop.name] = value;\n this.#component[MARK_CHANGED](prop.name);\n\n if (prop.attribute) this.#component.reflectAttribute(prop.name);\n }\n\n _update(values) {\n for (const val in values) {\n if (values[val] !== this.#values[val]) {\n this._setProp(this._defs[val], values[val]);\n }\n }\n }\n}\n","\n// Part of Enso\n// Licensed under the MIT License, see LICENSE file in root.\n\nimport EnsoComponent from \"../component.js\";\nimport { createComponent } from \"./components.js\";\nimport { createComponentTag } from \"./tags.js\";\nimport { parseScript } from \"./watched.js\";\nimport { Watched } from \"./watched.js\";\nimport { VERSION } from \"../../version.js\";\n\nimport { setErrorResolver, ensoError } from \"./errors.js\";\n\nimport { register, ctx } from \"../templates/parser.js\";\n\nconst defaultSettings = (overrides = {}) => ({\n useShadow: true,\n shadowMode: \"open\",\n\n ...overrides\n});\n\nlet diagnosticsEnabled = false;\nlet resolverPromise = null;\nconst errorString = (code, data) => `${code}: ${data}`;\n\nexport const API = {\n version: VERSION,\n\n /**\n * Defines a new Enso component and registers it in the browser as a custom element.\n * @param {String} tag - DOM tag name for this component\n * @param {Object} props - Component properties\n * @param {EnsoTemplate} props.template - Template defining component HTML\n * @param {EnsoStylesheet|[]} [props.styles] - (Optional) Adoptable Style sheet(s)\n * @param {Object} [props.expose] - (optional) Objects to expose to template expressions\n * @param {Object} [props.watched] - (optional) This component's watched properties\n * @param {Object} [props.script] - (Optional) Custom component code implementation\n * @param {EnsoSettings} [props.settings] - (Optional) Settings object\n * @returns {Function Object} - A tag function for use in component templates\n * \n * @example\n * const MyCounter = Enso.component('my-counter', {\n * watched: { count: 0 },\n * template: html`<button @click=\"this.increment\">{{ watched:count }}</button>`,\n * script: {\n * increment() { this.count++; }\n * }\n * });\n * @static\n */\n component(tag, {\n template,\n styles=null, \n expose={},\n watched={},\n script=null,\n settings={}\n }) { settings = defaultSettings(settings);\n\n if (customElements.get(tag)) ensoError(101, tag); // E_COMPONENT_DEF\n\n const watchers = parseScript(script);\n const component = createComponent(EnsoComponent, script);\n\n // Create observed and watched properties\n const WatchedClass = Watched.define(watched, watchers);\n \n if (styles && !Array.isArray(styles)) styles = [styles];\n // Static properties\n Object.defineProperties(component, {\n 'observedAttributes': { get() { return WatchedClass.attr; } },\n 'WatchedClass': { get() { return WatchedClass; } }\n });\n\n // Type properties\n Object.defineProperties(component.prototype, {\n 'settings': { get() { return settings; } },\n 'template': { get() { return template; } },\n 'styles': { get() { return styles; } },\n 'expose': { get() { return expose; } },\n });\n\n // Define the custom element\n customElements.define(tag, component);\n return createComponentTag(tag, component);\n },\n\n /**\n * Adds a custom template parser.\n * @param {(register, ctx)=>void} plugin - Custom parser registration function\n */\n use(plugin) {\n plugin(register, ctx);\n },\n\n async enableDiagnostics() {\n diagnosticsEnabled = true;\n\n // Cache the import so it only happens once\n resolverPromise ||= import('../errors/index.js');\n\n const { default: resolver } = await resolverPromise;\n\n // Guard against disable happening while loading\n if (diagnosticsEnabled) {\n setErrorResolver(resolver);\n }\n },\n\n disableDiagnostics() {\n diagnosticsEnabled = false;\n setErrorResolver(errorString); // minimal fallback\n }\n};\n","/* eslint-disable no-undef */\n\nexport const VERSION = typeof __VERSION__ === \"undefined\"\n ? \"dev\" : __VERSION__;","\n/*!\n * Enso v1.0.0\n * Copyright (c) 2025 Sean Young\n * Licensed under the MIT License\n */\n\n// Enso Internal\nimport { API } from \"./core/api.js\";\n\n//// EXPORTS\nexport const Enso = Object.freeze(API);\n\n// Template tags\nexport { css, html } from './core/tags.js';\n// Lifecycle identifies\nexport { lifecycle } from './component.js';\n// Watched properties\nexport { \n prop, attr, computed,\n watches, getWatched, setWatched \n} from './core/watched.js';\n\n// Component creator and global settings - Retained for compatibility\nexport default Enso;\n"],"names":["errorResolver","code","data","ensoError","Error","ensoReport","level","reporter","console","setErrorResolver","fn","ENSO_INTERNAL","Symbol","SCHEDULE_UPDATE","SCHEDULE_EFFECT","ATTACH_TEMPLATE","MARK_CHANGED","ADD_CHILD","UPDATE","GET_BINDING","ADD_BINDING","TASK_LIST","BINDINGS","CHILDREN","ANCHOR","NODES","ROOT","ENV","ENSO_FRAGMENT","ENSO_NODE","ENSO_ROOT","ENSO_PARSED","objectMasks","Object","freeze","Window","Document","eval","Function","setTimeout","rootEnv","parse","strings","values","isBool","str","reduce","a","c","i","value","v","createEffectEnv","args","baseEnv","assign","create","Effect","element","action","constructor","parent","this","createFunc","e","run","toString","createComponent","base","proto","component","super","cType","descriptors","getOwnPropertyDescriptors","prop","defineProperty","prototype","EnsoNode","Base","bindings","taskList","Set","children","bind","isComponent","fragment","push","effect","binding","effects","changed","add","child","clear","lifecycle","mount","update","unmount","lifecycles","EnsoComponent","HTMLElement","initialised","root","updateScheduled","watched","refs","env","expose","getShadowDom","shadowRoot","attachShadow","mode","settings","shadowMode","key","WatchedClass","useShadow","_report","isAttached","connectedCallback","attributes","observedAttributes","attr","_defs","attribute","force","reflectAttribute","template","process","styles","host","sheets","ShadowRoot","getRootNode","adoptedStyleSheets","attachStyleSheets","disconnectedCallback","_notify","attributeChangedCallback","property","oldValue","newValue","val","toProp","DOM","nodes","Array","from","firstElementChild","childNodes","append","toAttr","getAttribute","name","removeAttribute","setAttribute","requestAnimationFrame","makeTemplate","html","document","createElement","content","appendChild","createRange","createContextualFragment","createFragment","createTemplate","HTMLTemplateElement","querySelectorAll","forEach","script","remove","getChildIndex","node","indexOf","call","alphabet","uuid","length","id","Math","max","trunc","random","targetNode","nodeType","Node","TEXT_NODE","parentElement","NodeDef","map","mutators","Map","generator","setGenerator","parser","getGenerator","addMutator","has","set","get","markWatched","getMutators","entries","markRoot","tag","unRoot","isRoot","hasAttribute","el","unWatch","isWatched","replaceNode","original","replaceWith","NodeDefMap","size","nodeDef","getByNode","getByRoot","index","createRoot","def","iterator","getName","prefixLen","startsWith","idx","slice","toLowerCase","isAttr","prefix","type","bindEx","refEx","createPlaceholder","getOperator","short","long","operator","getAttributeNode","parseIdentifier","identifier","includes","split","trim","parseFor","source","item","filter","Boolean","identifiers","brackets","stack","token","capturing","allowCapture","openBracket","at","closeBracket","pop","nonCapturing","getIdentifiers","customElements","EnsoFragmentElement","define","EnsoFragment","anchor","attached","placeholder","createComment","watchers","_processTemplate","_getChildren","parentAttached","after","_requestUpdate","_getNodes","_setENV","_insertAfterAnchor","elements","_getChildFragments","createRegistry","match","parsers","register","registry","getRoot","querySelector","isParsed","getWatched","preprocess","parsed","opParser","ctx","Action","func","body","createFunctionBody","createAction","createEffect","compileValue","replaceAll","addBinding","addWatcher","_addWatcher","_getProp","parseSource","ret","replace","_","collectBindings","exec","plugin","attachEventListener","event","handler","addEventListener","error","ELEMENT_NODE","eventParser","nodeEx","TextEffect","textContent","test","nodeValue","binds","parentNode","text","textParser","AttrEffect","attrParser","PropEffect","propParser","ref","writable","configurable","warn","refParser","ItemFragment","ForFragment","join","forParser","IfFragment","directive","ifParser","acceptNode","isIgnoreNode","isIgnoredChild","NodeFilter","FILTER_REJECT","FILTER_ACCEPT","NODE_TYPES","SHOW_ELEMENT","SHOW_TEXT","EnsoTemplate","rootNode","frag","wrapFragment","walker","createTreeWalker","getWalker","nextNode","loose","extractLooseFragments","cloneNode","clone","watchedNodes","combine","css","sheet","CSSStyleSheet","replaceSync","createStyleSheet","proxies","WeakMap","reactives","baseWatcher","onChange","target","receiver","Reflect","watch","result","deleteProperty","hadKey","hasOwnProperty","iterators","mutatorWatcher","trapMethods","apply","isIterator","arrayMethods","setMethods","mapMethods","watcher","isArray","getWatcher","proxy","Proxy","attributeTypes","Number","String","converters","createFactory","structuredClone","descripter","desc","enumerable","deep","computed","deps","every","d","comp","VALUES","setWatched","_update","watches","props","keep","__watches","validateName","createPropDesc","w","p","_prop","Watched","properties","cls","defs","_setProp","reCompute","dep","defName","diagnosticsEnabled","resolverPromise","errorString","API","version","overrides","defaultSettings","parseScript","defineProperties","ComponentClass","Comp","attrs","attrStr","s","k","Class","createComponentTag","use","enableDiagnostics","import","default","resolver","disableDiagnostics","Enso"],"mappings":"AAIA,IAAIA,EAAgB,CAACC,EAAMC,IAAS,GAAGD,MAASC,IAEzC,MAAMC,EAAY,CAACF,EAAMC,KAC5B,MAAM,IAAIE,MAAM,YAAYJ,EAAcC,EAAMC,OAGvCG,EAAa,CAACC,EAAOL,EAAMC,KACpC,MAAMK,EAAWC,QAAQF,GACrBC,GAAUA,EAAS,YAAYP,EAAcC,EAAMC,OAG9CO,EAAmBC,IACV,mBAAPA,IAAmBV,EAAgBU,ICXrCC,EAAgBC,SAGhBC,EAAkBD,SAClBE,EAAkBF,SAClBG,EAAkBH,SAClBI,EAAeJ,SACfK,EAAYL,SACZM,EAASN,SAGTO,EAAcP,SACdQ,EAAcR,SACdS,EAAYT,SACZU,EAAWV,SACXW,EAAWX,SACXY,EAASZ,SACTa,EAAQb,SACRc,EAAOd,SACPe,EAAMf,SAGNgB,EAAgB,gBAGhBC,EAAY,YACZC,EAAY,YACZC,EAAc,YCbrBC,EAAcC,OAAOC,OAAO,CAC9BC,OAAQ,CAAA,EAAIC,SAAU,CAAA,EAAIC,KAAM,KAAMC,SAAU,KAAMC,WAAY,OAEhEC,EAAUP,OAAOC,OAAO,CAACO,MAdjB,CAACC,KAAYC,KACvB,IAAIC,GAAS,EACb,MAAMC,EAAMH,EAAQI,OAAO,CAACC,EAAEC,EAAEC,KAC5B,MAAMC,EAAQP,EAAOM,GAErB,OADc,IAAVC,IAAgBN,GAAS,GACtBG,EAAIC,IANU,OAMGE,KANW,IAANC,GAAhB,MAA+BA,EAMXD,EAAQ,IANjC,OAOT,IACH,SAAQN,GAAWC,IAAcA,MAOIb,IAQ5BoB,EAAkB,CAACC,EAAO,CAAA,EAAIC,EAAUd,IACjDP,OAAOC,OACHD,OAAOsB,OACHtB,OAAOuB,OAAOF,GA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C,QAASC,SAAmBpB,GAGhCD,IACA3a,EAAiBgc,EAEzB,EAEA,kBAAAC,GACItB,IAAqB,EACrB3a,EAAiB6a,GACrB,GEtGSqB,GAAO1a,OAAOC,OAAOqZ"}
package/dist/errors.es.js CHANGED
@@ -1 +1,2 @@
1
1
  const e={101:e=>`Component "${e}" is already defined. Did you load the component twice?`,102:()=>"Direct subclassing of Enso is not supported. Use Enso.component() instead.",103:e=>`Component expected object litteral but got "${e}"`,201:e=>`Unsupported attribute type: "${e}"`,211:()=>"computed() expects a function",212:()=>"computed() expects an array of dependency names",213:e=>`Tried to set value of computed property: "${e}"`,221:()=>"Watches can only be applied to functions.",231:()=>"Watched property names must not start with '_'.",301:e=>`Error in effect: ${e}`,302:e=>`Error instantiating effect: ${e}`,303:e=>`Expected function but got "${e}"`,311:e=>`Error running effect: ${e}`,312:e=>`Runtime error in effect: ${e}`,401:e=>`Unknown parser type "${e}"`,411:()=>"Mismatched brackets",412:e=>`Runtime error in for loop: ${e}`},t=(t,n)=>{const o=e[t];return o?o(n):`${t}: ${n}`};export{t as default};
2
+ //# sourceMappingURL=errors.es.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.es.js","sources":["../src/errors/en.js","../src/errors/index.js"],"sourcesContent":["\nexport default {\n // Component Errors\n '101': tag => (\n `Component \"${tag}\" is already defined. Did you load the component twice?`\n ),\n\n '102': () => (\n `Direct subclassing of Enso is not supported. Use Enso.component() instead.`\n ),\n\n '103': cType => (\n `Component expected object litteral but got \"${ cType }\"`\n ),\n\n // Watched Errors\n '201': cType => (\n `Unsupported attribute type: \"${cType}\"`\n ),\n\n '211': () => (\n \"computed() expects a function\"\n ),\n\n '212': () => (\n \"computed() expects an array of dependency names\"\n ),\n\n '213': prop => (\n `Tried to set value of computed property: \"${prop}\"`\n ),\n\n '221': () => (\n \"Watches can only be applied to functions.\"\n ),\n\n '231': () => (\n \"Watched property names must not start with '_'.\"\n ),\n\n // Effect Errors\n '301': err => (\n `Error in effect: ${err}`\n ),\n\n '302': err => (\n `Error instantiating effect: ${err}`\n ),\n\n '303': cType => (\n `Expected function but got \"${cType}\"`\n ),\n\n '311': err => (\n `Error running effect: ${err}`\n ),\n\n '312': err => (\n `Runtime error in effect: ${err}`\n ),\n\n // Parsers\n '401': cType => (\n `Unknown parser type \"${cType}\"`\n ),\n\n '411': () => (\n 'Mismatched brackets'\n ),\n\n '412': err => (\n `Runtime error in for loop: ${err}`\n ),\n}\n","\nimport en from './en';\n\nexport default (code, data) => {\n const text = en[code];\n if (!text) return `${code}: ${data}`\n \n return text(data);\n}\n"],"names":["en","tag","cType","prop","err","index","code","data","text"],"mappings":"AACA,MAAAA,EAAe,CAEX,IAAOC,GACH,cAAcA,2DAGlB,IAAO,IACH,6EAGJ,IAAOC,GACH,+CAAgDA,KAIpD,IAAOA,GACH,gCAAgCA,KAGpC,IAAO,IACH,gCAGJ,IAAO,IACH,kDAGJ,IAAOC,GACH,6CAA6CA,KAGjD,IAAO,IACH,4CAGJ,IAAO,IACH,kDAIJ,IAAOC,GACH,oBAAoBA,IAGxB,IAAOA,GACH,+BAA+BA,IAGnC,IAAOF,GACH,8BAA8BA,KAGlC,IAAOE,GACH,yBAAyBA,IAG7B,IAAOA,GACH,4BAA4BA,IAIhC,IAAOF,GACH,wBAAwBA,KAG5B,IAAO,IACH,sBAGJ,IAAOE,GACH,8BAA8BA,KCpEtCC,EAAe,CAACC,EAAMC,KAClB,MAAMC,EAAOR,EAAGM,GAChB,OAAKE,EAEEA,EAAKD,GAFM,GAAGD,MAASC"}
@@ -1 +1,2 @@
1
1
  const t=(...t)=>t.filter(t=>t).join(" "),e=t=>Object.entries(t).map(([t,i])=>(t=t.replace(/(?:\B)[A-Z]/g,t=>`-${t}`).toLowerCase(),i?"object"==typeof i?`${t} {${e(i)}}\n`:`${t}:${i};`:null)).join("");class i{static isRange(t){return t instanceof i}constructor(t,e=void 0,i=void 0){if(void 0===e&&(e=t,t=0),void 0===i&&(i=t<e?1:-1),Object.defineProperties(this,{_start:{value:t,enumerable:!0,writable:!1},_stop:{value:e,enumerable:!0,writable:!1},_step:{value:i,enumerable:!0,writable:!1}}),this._normaliser=1e10,!Number.isFinite(t)||!Number.isFinite(e)||!Number.isFinite(i))throw new TypeError("Invalid range parameters")}get size(){const t=s(this._start,this),e=s(this._stop,this),i=s(this._step,this);if(0===i)return 0;const r=e-t;return i>0&&r<=0||i<0&&r>=0?0:Math.max(0,Math.ceil(r/i))}get maxStep(){const t=this.size;if(0!==t)return this.step(t-1)}*[Symbol.iterator](){const t=s(this._start,this),e=s(this._step,this);let i=t;for(let r=0;r<this.size;r++)yield n(i,this),i+=e}step(t){if(!Number.isInteger(t)||t<0||t>=this.size)throw new Error("Invalid index");return o(t,this)}indexOf(t){return this.inRange(t)?a(t,this):-1}inRange(t){const e=Math.min(this._start,this._stop),i=Math.max(this._start,this._stop);if(t<e||t>=i)return!1;return(s(t,this)-s(this._start,this))%s(this._step,this)===0}wrap(t){const e=Math.min(this._start,this._stop),i=this._stop-this._start,r=((t-e)%i+i)%i+e;return h(Math.min(r,this.maxStep),this)}clamp(t){const e=Math.min(this._start,this._stop),i=this.maxStep;return h(Math.min(Math.max(t,e),i),this)}}function r(t,e,r){return new i(t,e,r)}function s(t,e){return Math.round(t*e._normaliser)}function n(t,e){return t/e._normaliser}function a(t,e){return(s(t,e)-s(e._start,e))/s(e._step,e)}function o(t,e){return n(s(e._start,e)+s(e._step,e)*t,e)}function h(t,e){return o(Math.round(a(t,e)),e)}const u=(t,e)=>{if("function"==typeof t)return t(e);if("string"==typeof t&&"string"==typeof e)return new URL(e,t).href;throw new TypeError("load: invalid usage. Expected load(baseUrl, file) or load(resolverFn, file)")};async function l(t){const e=await fetch(t);if(!e.ok)throw new Error(`Failed to load resource: ${t} (${e.status} ${e.statusText})`);return e.text()}async function f(t,...e){return Promise.all(e.map(async e=>{if("string"==typeof e){return l(u(t,e))}if(e&&"object"==typeof e&&"string"==typeof e.file){const i=u(t,e.file),r=await l(i);return"function"==typeof e.as?e.as(r):r}throw new TypeError("load: Invalid file. Must be a string or { file: string, as: function }")}))}export{i as Range,t as classList,e as cssObj,f as load,r as range};
2
+ //# sourceMappingURL=helpers.es.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpers.es.js","sources":["../src/helpers/css.js","../src/helpers/range.js","../src/helpers/load.js"],"sourcesContent":["\n/**\n * @module helpers - Defines helper functions for use in html templates\n */\n// Part of Enso\n// Licensed under the MIT License, see LICENSE file in root.\n\n// Converts camelCase names to dash-case\nconst camelToDash = str => (\n str.replace(/(?:\\B)[A-Z]/g, match => `-${match}`)\n .toLowerCase()\n);\n\n/**\n * Generates a class list string for use in the DOM class attribute from \n * the passed arguments.\n * @param { ...any } classes - Arguments that can resolve to css class names\n * @returns { String } class list\n */\nexport const classList = (...classes) => (\n classes.filter(v => v).join(' ')\n);\n\n/**\n * Generates a css string from a style object\n * @param { Object } css - Style object\n * @returns { String } string of css rulesets\n */\nexport const cssObj = css => (\n Object.entries(css).map(([key, value])=> {\n\n key = camelToDash(key);\n\n if (value) {\n return (typeof value === 'object') ?\n `${key} {${cssObj(value)}}\\n` : // Nested object -> selector\n `${key}:${value};`; // Property : value\n }\n return null; // If value is falsy\n\n }).join('')\n);\n","\n/**\n * A Python-like numeric range.\n *\n * Behaves like Python's `range()`:\n * - `range(stop)` → 0..stop-1\n * - `range(start, stop)` → start..stop-1\n * - `range(start, stop, step)` → arithmetic progression\n *\n * Supports floats with safe stepping via normalisation.\n * Stop is always exclusive.\n */\nexport class Range {\n static isRange(obj) {\n return obj instanceof Range;\n }\n\n constructor(start, stop = undefined, step = undefined) {\n if (stop === undefined) {\n stop = start;\n start = 0;\n }\n\n if (step === undefined) {\n step = start < stop ? 1 : -1;\n }\n\n Object.defineProperties(this, {\n _start: { value: start, enumerable: true, writable: false },\n _stop: { value: stop, enumerable: true, writable: false },\n _step: { value: step, enumerable: true, writable: false }\n });\n\n this._normaliser = 1e10;\n\n if (!Number.isFinite(start) || !Number.isFinite(stop) || !Number.isFinite(step)) {\n throw new TypeError(\"Invalid range parameters\");\n }\n }\n\n get size() {\n const normStart = normalise(this._start, this);\n const normStop = normalise(this._stop, this);\n const normStep = normalise(this._step, this);\n\n if (normStep === 0) return 0;\n\n const diff = normStop - normStart;\n\n if (normStep > 0 && diff <= 0) return 0;\n if (normStep < 0 && diff >= 0) return 0;\n\n return Math.max(0, Math.ceil(diff / normStep));\n }\n\n get maxStep() {\n const size = this.size;\n if (size === 0) return undefined;\n return this.step(size - 1);\n }\n\n *[Symbol.iterator]() {\n const normStart = normalise(this._start, this);\n const normStep = normalise(this._step, this);\n let count = normStart;\n\n for (let i = 0; i < this.size; i++) {\n yield deNormalise(count, this);\n count += normStep;\n }\n }\n\n step(index) {\n if (!Number.isInteger(index) || index < 0 || index >= this.size) {\n throw new Error('Invalid index');\n }\n return indexToStep(index, this);\n }\n\n indexOf(value) {\n if (!this.inRange(value)) return -1;\n return stepToIndex(value, this);\n }\n\n inRange(value) {\n const min = Math.min(this._start, this._stop);\n const max = Math.max(this._start, this._stop);\n if (value < min || value >= max) return false;\n\n const normValue = normalise(value, this);\n const normStart = normalise(this._start, this);\n const normStep = normalise(this._step, this);\n\n return (normValue - normStart) % normStep === 0;\n }\n\n wrap(value) {\n const min = Math.min(this._start, this._stop);\n const rawRange = this._stop - this._start;\n const wrapped = (((value - min) % rawRange) + rawRange) % rawRange + min;\n\n // Snap into valid step *and snap down to maxStep if needed*\n return makeValidStep(\n Math.min(wrapped, this.maxStep),\n this\n );\n }\n\n clamp(value) {\n const min = Math.min(this._start, this._stop);\n const max = this.maxStep; // last valid step\n const clamped = Math.min(Math.max(value, min), max);\n return makeValidStep(clamped, this);\n }\n}\n\n/**\n * Create a Python-style range.\n *\n * @param {number} start - Start value or stop if only one argument.\n * @param {number} [stop] - Exclusive stop value.\n * @param {number} [step] - Step interval (default: 1 or -1 based on direction).\n * @returns {Range}\n */\nexport function range(start, stop, step) {\n return new Range(start, stop, step);\n}\n\n/* Helper functions */\nfunction normalise(value, rng) {\n return Math.round(value * rng._normaliser);\n}\n\nfunction deNormalise(value, rng) {\n return value / rng._normaliser;\n}\n\nfunction stepToIndex(value, rng) {\n return (normalise(value, rng) - normalise(rng._start, rng)) / normalise(rng._step, rng);\n}\n\nfunction indexToStep(index, rng) {\n return deNormalise(normalise(rng._start, rng) + (normalise(rng._step, rng) * index), rng);\n}\n\nfunction makeValidStep(value, rng) {\n return indexToStep(Math.round(stepToIndex(value, rng)), rng); \n}\n","\n/**\n * @module load\n * Loader utilities for fetching external resources relative to a calling module.\n *\n * Usage:\n * // Single load\n * const [cssText] = await load(import.meta.url, \"./style.css\");\n * // Multiple loads\n * const [styles, template] = await load(\n * import.meta.url,\n * { file: \"./style.css\", as: css },\n * { file: \"./template.html\", as: html }\n * );\n */\n\nconst getUrl = (base, file) => {\n // Resolver mode\n if (typeof base === \"function\") {\n return base(file);\n }\n // Base URL mode\n if (typeof base === \"string\" && typeof file === \"string\") {\n return new URL(file, base).href;\n }\n throw new TypeError(\"load: invalid usage. Expected load(baseUrl, file) or load(resolverFn, file)\");\n};\n\nasync function loadFile(url) {\n const res = await fetch(url);\n if (!res.ok) {\n throw new Error(`Failed to load resource: ${url} (${res.status} ${res.statusText})`);\n }\n return res.text();\n}\n\n/**\n * Load one of more files in parallel.\n *\n * Each file can be:\n * - A string → file path → raw text returned.\n * - An object → {file, as} → transformed text returned.\n *\n * @param {string|Function} baseUrl - Calling module URL\n * @param {...(string|{file:string,as?:Function})} files - Strings or typed load descriptors\n * @returns {Promise<Array<any[]>>} - Loaded text or transformed values, in order\n */\nexport async function load(base, ...files) {\n return Promise.all(files.map(async file => {\n // string, assume file path\n if (typeof file === \"string\") {\n const url = getUrl(base, file);\n return loadFile(url);\n }\n // Object: decoder\n if (file && typeof file === \"object\" && \n typeof file.file === \"string\") {\n\n const url = getUrl(base, file.file);\n const text = await loadFile(url);\n return typeof file.as === \"function\"\n ? file.as(text)\n : text; // fallback to raw text\n }\n throw new TypeError(\n \"load: Invalid file. Must be a string or { file: string, as: function }\"\n );\n }));\n}\n"],"names":["classList","classes","filter","v","join","cssObj","css","Object","entries","map","key","value","replace","match","toLowerCase","Range","isRange","obj","constructor","start","stop","step","defineProperties","this","_start","enumerable","writable","_stop","_step","_normaliser","Number","isFinite","TypeError","size","normStart","normalise","normStop","normStep","diff","Math","max","ceil","maxStep","Symbol","iterator","count","i","deNormalise","index","isInteger","Error","indexToStep","indexOf","inRange","stepToIndex","min","wrap","rawRange","wrapped","makeValidStep","clamp","range","rng","round","getUrl","base","file","URL","href","async","loadFile","url","res","fetch","ok","status","statusText","text","load","files","Promise","all","as"],"mappings":"AAQA,MAWaA,EAAY,IAAIC,IACzBA,EAAQC,OAAOC,GAAKA,GAAGC,KAAK,KAQnBC,EAASC,GAClBC,OAAOC,QAAQF,GAAKG,IAAI,EAAEC,EAAKC,MAE3BD,EAAkBA,EAtBlBE,QAAQ,kBAAyB,IAAIC,KACpCC,cAuBGH,EACyB,iBAAVA,EACX,GAAGD,MAAQL,EAAOM,QAAM,GACrBD,KAAOC,KAEX,OAERP,KAAK,IC5BL,MAAMW,EACT,cAAOC,CAAQC,GACX,OAAOA,aAAeF,CAC1B,CAEA,WAAAG,CAAYC,EAAOC,OAAO,EAAWC,OAAO,GAkBxC,QAjBa,IAATD,IACAA,EAAOD,EACPA,EAAQ,QAGC,IAATE,IACAA,EAAOF,EAAQC,EAAO,GAAI,GAG9Bb,OAAOe,iBAAiBC,KAAM,CAC1BC,OAAQ,CAAEb,MAAOQ,EAAOM,YAAY,EAAMC,UAAU,GACpDC,MAAQ,CAAEhB,MAAOS,EAAMK,YAAY,EAAMC,UAAU,GACnDE,MAAQ,CAAEjB,MAAOU,EAAMI,YAAY,EAAMC,UAAU,KAGvDH,KAAKM,YAAc,MAEdC,OAAOC,SAASZ,KAAWW,OAAOC,SAASX,KAAUU,OAAOC,SAASV,GACtE,MAAM,IAAIW,UAAU,2BAE5B,CAEA,QAAIC,GACA,MAAMC,EA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AQC,EAAIG,UAAUH,EAAII,eAE1E,OAAOJ,EAAIK,MACf,CAaOR,eAAeS,EAAKb,KAASc,GAChC,OAAOC,QAAQC,IAAIF,EAAMtE,IAAI4D,MAAMH,IAE/B,GAAoB,iBAATA,EAAmB,CAE1B,OAAOI,EADKN,EAAOC,EAAMC,GAE7B,CAEA,GAAIA,GAAwB,iBAATA,GACM,iBAAdA,EAAKA,KAAmB,CAE/B,MAAMK,EAAMP,EAAOC,EAAMC,EAAKA,MACxBW,QAAaP,EAASC,GAC5B,MAA0B,mBAAZL,EAAKgB,GACbhB,EAAKgB,GAAGL,GACRA,CACV,CACA,MAAM,IAAI7C,UACN,4EAGZ"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ensojs",
3
- "version": "1.0.0-rc.12",
3
+ "version": "1.0.0-rc.14",
4
4
  "type": "module",
5
5
  "description": "A lightweight Web Component framework focused on clarity, reactivity, and minimal boilerplate.",
6
6
  "author": "Sean Young <seanyoung247@gmail.com>",