diff --git a/README.md b/README.md index db6f0ee..fa6dbab 100644 --- a/README.md +++ b/README.md @@ -463,4 +463,17 @@ Finds first closest Fez node. Fez('#icon-1').setColor('red') ``` +* ### this.reactiveStore({}) + Creates reactive store that updates this.html() on change. You can pass another reactivity function. + + Used in default TODO example. + + ```js + this.reactiveStore({}, (o, k, v)=>{ + window.requestAnimationFrame(()=>{ + console.log(`key "${k}" changed to ${v}`) + this.html()) + }) + }) + ``` diff --git a/demo/fez/todo.html b/demo/fez/todo.html index 29c626e..76be3b6 100644 --- a/demo/fez/todo.html +++ b/demo/fez/todo.html @@ -1,3 +1,3 @@ -Todo app demo, ToDo MVC candidate (React, Vue, Angular) +Todo app demo, features reactiveStore, fez-use, runtime scss. ToDo MVC candidate (React, Vue, Angular) diff --git a/demo/fez/todo.js b/demo/fez/todo.js index d3f6552..5c8b3a5 100644 --- a/demo/fez/todo.js +++ b/demo/fez/todo.js @@ -1,11 +1,12 @@ Fez('ui-todo', class extends FezBase { + // if you define static html, it will be converted tu function(fast), and you will be able to refresh state with this.html() static html = `

Tasks

- {{#if !@tasks[0]}} + {{#if !@data.tasks[0]}}

No tasks found

{{/if}} - {{#for task, index in @tasks}} - {{#if task.animate}} + {{#for task, index in @data.tasks}} + {{#if task.animate}}

{{else}}

@@ -31,51 +32,66 @@ Fez('ui-todo', class extends FezBase { ⋅

-
{{ JSON.stringify(this.tasks, null, 2) }}
+
{{ JSON.stringify(this.data.tasks, null, 2) }}
` toggleComplete(index) { - const task = this.tasks[index] + const task = this.data.tasks[index] task.done = !task.done - this.html() } clearCompleted() { - this.tasks = this.tasks.filter((t) => !t.done) - this.html() + this.data.tasks = this.data.tasks.filter((t) => !t.done) } removeTask(index) { - this.tasks = this.tasks.filter((_, i) => i !== index); - this.html() + this.data.tasks = this.data.tasks.filter((_, i) => i !== index); } setName(index, name) { - this.tasks[index].name = name - this.html() // refresh full component on every key stroke. done for render speed demo purposes + this.data.tasks[index].name = name } addTask() { + // no need to force update template, this is automatic because we are using reactiveStore() this.counter ||= 0 - this.tasks.push({name: `new task ${++this.counter}`, done: false, animate: true}) - this.html() + this.data.tasks.push({ + name: `new task ${++this.counter}`, + done: false, + animate: true + }) } animate(node) { + // same as in svelte, uf you define fez-use="methodName", method will be called when node is added to dom. + // in this case, we animate show new node $(node) .css('display', 'block') .animate({height: '33px', opacity: 1}, 200, () => { - delete this.tasks[this.tasks.length-1].animate + delete this.data.tasks[this.data.tasks.length-1].animate $(node).css('height', 'auto') - this.html() }) } connect() { - this.tasks = [ + // creates reactive store, that calls this.html() state refresh after every data set + // you can pass function as argument to change default reactive behaviour + this.data = this.reactiveStore({}) + + this.data.tasks = [ {name: 'First task', done: false}, {name: 'Second task', done: false}, {name: 'Third task', done: true }, ] + + for (const i in [1,2,3,4,5]) { + this.data.i = i + } + + window.requestAnimationFrame(()=>{ + for (const i in [1,2,3,4,5]) { + this.data.i = i + } + }) } }) diff --git a/dist/fez.js b/dist/fez.js index a7fa11a..c20827d 100644 --- a/dist/fez.js +++ b/dist/fez.js @@ -1,4 +1,4 @@ -(()=>{function q(l,e){let s=/(\r\n|\r|\n)/g,f=/{{\s*(.+?)\s*}}/g,p=/^each\s+(.*)\s+as\s+(.*)$/,h=/^if\s+(.*)$/,c=/^else if\s+(.*)$/;function o(A){let S=T=>T.replaceAll("@","this."),L=` +(()=>{function N(l,e){let i=/(\r\n|\r|\n)/g,a=/{{\s*(.+?)\s*}}/g,p=/^each\s+(.*)\s+as\s+(.*)$/,d=/^if\s+(.*)$/,u=/^else if\s+(.*)$/;function o(A){let S=T=>T.replaceAll("@","this."),L=` let _strings = [], _sequence = [], _values = []; function htmlEscape(text) { @@ -13,18 +13,18 @@ } } - _sequence.push('${A.trim().replace(s,"\\n").replace(f,(T,v)=>{if(v=v.replace(/^[#:]/,""),v.startsWith("each")||v.startsWith("for")){let _=v.split(/\s+/);if(_.shift()==="for"){let N=_.pop();_.pop(),v=`each ${N} as ${_.join(" ")}`}let j=p.exec(v);if(j)return j[1]=S(j[1]),`'); - (!Array.isArray(${j[1]}) ? Array.from(Object.entries(${j[1]} || []), ([key, value]) => [key, value]) : ${j[1]}).forEach((${j[2]}) => { _sequence.push('`}else if(v.startsWith("if")){let _=h.exec(v);if(_)return _[1]=S(_[1]),`'); - if (${_[1]}) { _sequence.push('`}else if(v.startsWith("else if")){let _=c.exec(v);if(_)return _[1]=S(_[1]),`'); - } else if (${_[1]}) { _sequence.push('`}else{if(v==="else")return`'); - } else { _sequence.push('`;if(v==="/each"||v==="/for")return`'); - }); _sequence.push('`;if(v==="/if")return`'); - } _sequence.push('`}let I=v.split(/^\@html\s+/);return I[1]?v=S(I[1]):v=`htmlEscape(${S(v)})`,`'); + _sequence.push('${A.trim().replace(i,"\\n").replace(a,(T,y)=>{if(y=y.replace(/^[#:]/,""),y.startsWith("each")||y.startsWith("for")){let _=y.split(/\s+/);if(_.shift()==="for"){let q=_.pop();_.pop(),y=`each ${q} as ${_.join(" ")}`}let R=p.exec(y);if(R)return R[1]=S(R[1]),`'); + (!Array.isArray(${R[1]}) ? Array.from(Object.entries(${R[1]} || []), ([key, value]) => [key, value]) : ${R[1]}).forEach((${R[2]}) => { _sequence.push('`}else if(y.startsWith("if")){let _=d.exec(y);if(_)return _[1]=S(_[1]),`'); + if (${_[1]}) { _sequence.push('`}else if(y.startsWith("else if")){let _=u.exec(y);if(_)return _[1]=S(_[1]),`'); + } else if (${_[1]}) { _sequence.push('`}else{if(y==="else")return`'); + } else { _sequence.push('`;if(y==="/each"||y==="/for")return`'); + }); _sequence.push('`;if(y==="/if")return`'); + } _sequence.push('`}let I=y.split(/^\@html\s+/);return I[1]?y=S(I[1]):y=`htmlEscape(${S(y)})`,`'); _strings.push(_sequence.join('')); _sequence = []; - _values.push(${v}); + _values.push(${y}); _sequence.push('`})}'); _strings.push(_sequence.join('')); return [_strings, _values]; - `;return new Function("_data",L)}function m(A){let S=o(A);return()=>{let[L,T]=S.bind(e)();return L.reduce((v,I,_)=>v+T[_-1]+I)}}function g(A){let S=new Set(["area","base","br","col","embed","hr","img","input","link","meta","source","track","wbr"]);return A.replace(/<([a-z-]+)\b([^>]*)\/>/g,(L,T,v)=>S.has(T)?L:`<${T}${v}>`)}return l=g(l),m(l)}var Y=function(){"use strict";let l=new Set,e={morphStyle:"outerHTML",callbacks:{beforeNodeAdded:T,afterNodeAdded:T,beforeNodeMorphed:T,afterNodeMorphed:T,beforeNodeRemoved:T,afterNodeRemoved:T,beforeAttributeUpdated:T},head:{style:"merge",shouldPreserve:function(t){return t.getAttribute("im-preserve")==="true"},shouldReAppend:function(t){return t.getAttribute("im-re-append")==="true"},shouldRemove:T,afterHeadMorphed:T}};function s(t,r,i={}){t instanceof Document&&(t=t.documentElement),typeof r=="string"&&(r=re(r));let a=ie(r),u=I(t,a,i);return f(t,a,u)}function f(t,r,i){if(i.head.block){let a=t.querySelector("head"),u=r.querySelector("head");if(a&&u){let d=S(u,a,i);Promise.all(d).then(function(){f(t,r,Object.assign(i,{head:{block:!1,ignore:!0}}))});return}}if(i.morphStyle==="innerHTML")return c(r,t,i),t.children;if(i.morphStyle==="outerHTML"||i.morphStyle==null){let a=se(r,t,i),u=a?.previousSibling,d=a?.nextSibling,b=h(t,a,i);return a?ne(u,b,d):[]}else throw"Do not understand how to morph style "+i.morphStyle}function p(t,r){return r.ignoreActiveValue&&t===document.activeElement&&t!==document.body}function h(t,r,i){if(!(i.ignoreActive&&t===document.activeElement))return r==null?i.callbacks.beforeNodeRemoved(t)===!1?t:(t.remove(),i.callbacks.afterNodeRemoved(t),null):j(t,r)?(i.callbacks.beforeNodeMorphed(t,r)===!1||(t instanceof HTMLHeadElement&&i.head.ignore||(t instanceof HTMLHeadElement&&i.head.style!=="morph"?S(r,t,i):(m(r,t,i),p(t,i)||c(r,t,i))),i.callbacks.afterNodeMorphed(t,r)),t):i.callbacks.beforeNodeRemoved(t)===!1||i.callbacks.beforeNodeAdded(r)===!1?t:(t.parentElement.replaceChild(r,t),i.callbacks.afterNodeAdded(r),i.callbacks.afterNodeRemoved(t),r)}function c(t,r,i){let a=t.firstChild,u=r.firstChild,d;for(;a;){if(d=a,a=d.nextSibling,u==null){if(i.callbacks.beforeNodeAdded(d)===!1)return;r.appendChild(d),i.callbacks.afterNodeAdded(d),w(i,d);continue}if(_(d,u,i)){h(u,d,i),u=u.nextSibling,w(i,d);continue}let b=ee(t,r,d,u,i);if(b){u=N(u,b,i),h(b,d,i),w(i,d);continue}let M=te(t,r,d,u,i);if(M){u=N(u,M,i),h(M,d,i),w(i,d);continue}if(i.callbacks.beforeNodeAdded(d)===!1)return;r.insertBefore(d,u),i.callbacks.afterNodeAdded(d),w(i,d)}for(;u!==null;){let b=u;u=u.nextSibling,U(b,i)}}function o(t,r,i,a){return t==="value"&&a.ignoreActiveValue&&r===document.activeElement?!0:a.callbacks.beforeAttributeUpdated(t,r,i)===!1}function m(t,r,i){let a=t.nodeType;if(a===1){let u=t.attributes,d=r.attributes;for(let b of u)o(b.name,r,"update",i)||r.getAttribute(b.name)!==b.value&&r.setAttribute(b.name,b.value);for(let b=d.length-1;0<=b;b--){let M=d[b];o(M.name,r,"remove",i)||t.hasAttribute(M.name)||r.removeAttribute(M.name)}}(a===8||a===3)&&r.nodeValue!==t.nodeValue&&(r.nodeValue=t.nodeValue),p(r,i)||A(t,r,i)}function g(t,r,i,a){if(t[i]!==r[i]){let u=o(i,r,"update",a);u||(r[i]=t[i]),t[i]?u||r.setAttribute(i,t[i]):o(i,r,"remove",a)||r.removeAttribute(i)}}function A(t,r,i){if(t instanceof HTMLInputElement&&r instanceof HTMLInputElement&&t.type!=="file"){let a=t.value,u=r.value;g(t,r,"checked",i),g(t,r,"disabled",i),t.hasAttribute("value")?a!==u&&(o("value",r,"update",i)||(r.setAttribute("value",a),r.value=a)):o("value",r,"remove",i)||(r.value="",r.removeAttribute("value"))}else if(t instanceof HTMLOptionElement)g(t,r,"selected",i);else if(t instanceof HTMLTextAreaElement&&r instanceof HTMLTextAreaElement){let a=t.value,u=r.value;if(o("value",r,"update",i))return;a!==u&&(r.value=a),r.firstChild&&r.firstChild.nodeValue!==a&&(r.firstChild.nodeValue=a)}}function S(t,r,i){let a=[],u=[],d=[],b=[],M=i.head.style,z=new Map;for(let E of t.children)z.set(E.outerHTML,E);for(let E of r.children){let C=z.has(E.outerHTML),F=i.head.shouldReAppend(E),P=i.head.shouldPreserve(E);C||P?F?u.push(E):(z.delete(E.outerHTML),d.push(E)):M==="append"?F&&(u.push(E),b.push(E)):i.head.shouldRemove(E)!==!1&&u.push(E)}b.push(...z.values());let X=[];for(let E of b){let C=document.createRange().createContextualFragment(E.outerHTML).firstChild;if(i.callbacks.beforeNodeAdded(C)!==!1){if(C.href||C.src){let F=null,P=new Promise(function(ue){F=ue});C.addEventListener("load",function(){F()}),X.push(P)}r.appendChild(C),i.callbacks.afterNodeAdded(C),a.push(C)}}for(let E of u)i.callbacks.beforeNodeRemoved(E)!==!1&&(r.removeChild(E),i.callbacks.afterNodeRemoved(E));return i.head.afterHeadMorphed(r,{added:a,kept:d,removed:u}),X}function L(){}function T(){}function v(t){let r={};return Object.assign(r,e),Object.assign(r,t),r.callbacks={},Object.assign(r.callbacks,e.callbacks),Object.assign(r.callbacks,t.callbacks),r.head={},Object.assign(r.head,e.head),Object.assign(r.head,t.head),r}function I(t,r,i){return i=v(i),{target:t,newContent:r,config:i,morphStyle:i.morphStyle,ignoreActive:i.ignoreActive,ignoreActiveValue:i.ignoreActiveValue,idMap:fe(t,r),deadIds:new Set,callbacks:i.callbacks,head:i.head}}function _(t,r,i){return t==null||r==null?!1:t.nodeType===r.nodeType&&t.tagName===r.tagName?t.id!==""&&t.id===r.id?!0:k(i,t,r)>0:!1}function j(t,r){return t==null||r==null?!1:t.nodeType===r.nodeType&&t.tagName===r.tagName}function N(t,r,i){for(;t!==r;){let a=t;t=t.nextSibling,U(a,i)}return w(i,r),r.nextSibling}function ee(t,r,i,a,u){let d=k(u,i,r),b=null;if(d>0){let M=a,z=0;for(;M!=null;){if(_(i,M,u))return M;if(z+=k(u,M,t),z>d)return null;M=M.nextSibling}}return b}function te(t,r,i,a,u){let d=a,b=i.nextSibling,M=0;for(;d!=null;){if(k(u,d,t)>0)return null;if(j(i,d))return d;if(j(b,d)&&(M++,b=b.nextSibling,M>=2))return null;d=d.nextSibling}return d}function re(t){let r=new DOMParser,i=t.replace(/]*>|>)([\s\S]*?)<\/svg>/gim,"");if(i.match(/<\/html>/)||i.match(/<\/head>/)||i.match(/<\/body>/)){let a=r.parseFromString(t,"text/html");if(i.match(/<\/html>/))return a.generatedByIdiomorph=!0,a;{let u=a.firstChild;return u?(u.generatedByIdiomorph=!0,u):null}}else{let u=r.parseFromString("","text/html").body.querySelector("template").content;return u.generatedByIdiomorph=!0,u}}function ie(t){if(t==null)return document.createElement("div");if(t.generatedByIdiomorph)return t;if(t instanceof Node){let r=document.createElement("div");return r.append(t),r}else{let r=document.createElement("div");for(let i of[...t])r.append(i);return r}}function ne(t,r,i){let a=[],u=[];for(;t!=null;)a.push(t),t=t.previousSibling;for(;a.length>0;){let d=a.pop();u.push(d),r.parentElement.insertBefore(d,r)}for(u.push(r);i!=null;)a.push(i),u.push(i),i=i.nextSibling;for(;a.length>0;)r.parentElement.insertBefore(a.pop(),r.nextSibling);return u}function se(t,r,i){let a;a=t.firstChild;let u=a,d=0;for(;a;){let b=le(a,r,i);b>d&&(u=a,d=b),a=a.nextSibling}return u}function le(t,r,i){return j(t,r)?.5+k(i,t,r):0}function U(t,r){w(r,t),r.callbacks.beforeNodeRemoved(t)!==!1&&(t.remove(),r.callbacks.afterNodeRemoved(t))}function oe(t,r){return!t.deadIds.has(r)}function ae(t,r,i){return(t.idMap.get(i)||l).has(r)}function w(t,r){let i=t.idMap.get(r)||l;for(let a of i)t.deadIds.add(a)}function k(t,r,i){let a=t.idMap.get(r)||l,u=0;for(let d of a)oe(t,d)&&ae(t,d,i)&&++u;return u}function G(t,r){let i=t.parentElement,a=t.querySelectorAll("[id]");for(let u of a){let d=u;for(;d!==i&&d!=null;){let b=r.get(d);b==null&&(b=new Set,r.set(d,b)),b.add(u.id),d=d.parentElement}}}function fe(t,r){let i=new Map;return G(t,i),G(r,i),i}return{morph:s,defaults:e}}();var ce={data:""},J=l=>typeof window=="object"?((l?l.querySelector("#_goober"):window._goober)||Object.assign((l||document.head).appendChild(document.createElement("style")),{innerHTML:" ",id:"_goober"})).firstChild:l||ce,de=l=>{let e=J(l),s=e.data;return e.data="",s},he=/(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g,pe=/\/\*[^]*?\*\/| +/g,Z=/\n+/g,R=(l,e)=>{let s="",f="",p="";for(let h in l){let c=l[h];h[0]=="@"?h[1]=="i"?s=h+" "+c+";":f+=h[1]=="f"?R(c,h):h+"{"+R(c,h[1]=="k"?"":e)+"}":typeof c=="object"?f+=R(c,e?e.replace(/([^,])+/g,o=>h.replace(/(^:.*)|([^,])+/g,m=>/&/.test(m)?m.replace(/&/g,o):o?o+" "+m:m)):h):c!=null&&(h=/^--/.test(h)?h:h.replace(/[A-Z]/g,"-$&").toLowerCase(),p+=R.p?R.p(h,c):h+":"+c+";")}return s+(e&&p?e+"{"+p+"}":p)+f},H={},K=l=>{if(typeof l=="object"){let e="";for(let s in l)e+=s+K(l[s]);return e}return l},me=(l,e,s,f,p)=>{let h=K(l),c=H[h]||(H[h]=(m=>{let g=0,A=11;for(;g>>0;return"go"+A})(h));if(!H[c]){let m=h!==l?l:(g=>{let A,S,L=[{}];for(;A=he.exec(g.replace(pe,""));)A[4]?L.shift():A[3]?(S=A[3].replace(Z," ").trim(),L.unshift(L[0][S]=L[0][S]||{})):L[0][A[1]]=A[2].replace(Z," ").trim();return L[0]})(l);H[c]=R(p?{["@keyframes "+c]:m}:m,s?"":"."+c)}let o=s&&H.g?H.g:null;return s&&(H.g=H[c]),((m,g,A,S)=>{S?g.data=g.data.replace(S,m):g.data.indexOf(m)===-1&&(g.data=A?m+g.data:g.data+m)})(H[c],e,f,o),c},be=(l,e,s)=>l.reduce((f,p,h)=>{let c=e[h];if(c&&c.call){let o=c(s),m=o&&o.props&&o.props.className||/^go/.test(o)&&o;c=m?"."+m:o&&typeof o=="object"?o.props?"":R(o,""):o===!1?"":o}return f+p+(c??"")},"");function B(l){let e=this||{},s=l.call?l(e.p):l;return me(s.unshift?s.raw?be(s,[].slice.call(arguments,1),e.p):s.reduce((f,p)=>Object.assign(f,p&&p.call?p(e.p):p),{}):s,J(e.target),e.g,e.o,e.k)}var Q,V,D,ge=B.bind({g:1}),ve=B.bind({k:1});function ye(l,e,s,f){R.p=e,Q=l,V=s,D=f}function Ae(l,e){let s=this||{};return function(){let f=arguments;function p(h,c){let o=Object.assign({},h),m=o.className||p.className;s.p=Object.assign({theme:V&&V()},o),s.o=/ *go\d+/.test(m),o.className=B.apply(s,f)+(m?" "+m:""),e&&(o.ref=c);let g=l;return l[0]&&(g=o.as||l,delete o.as),D&&g[0]&&D(o),Q(g,o)}return e?e(p):p}}var x={css:B,extractCss:de,glob:ge,keyframes:ve,setup:ye,styled:Ae};function W(l,e={},s){if(typeof e=="string"&&([e,s]=[s,e],e||={}),e instanceof Node&&(s=e,e={}),Array.isArray(l)&&(s=l,l="div"),(typeof e!="object"||Array.isArray(e))&&(s=e,e={}),l.includes(".")){let p=l.split(".");l=p.shift()||"div";let h=p.join(" ");e.class?e.class+=` ${h}`:e.class=h}let f=document.createElement(l);for(let[p,h]of Object.entries(e))if(typeof h=="function")f[p]=h.bind(this);else{let c=String(h).replaceAll("$$.",this.fezHtmlRoot);f.setAttribute(p,c)}if(s)if(Array.isArray(s))for(let p of s)f.appendChild(p);else s instanceof Node?f.appendChild(s):f.innerHTML=String(s);return f}var O=class{static __objects=[];static find(e,s){return y.find(e,s)}static fnv1(e){var s,f,p,h,c,o;for(s=2166136261,f=16777619,p=s,h=c=0,o=e.length-1;0<=o?c<=o:c>=o;h=0<=o?++c:--c)p^=e.charCodeAt(h),p*=f;return p.toString(36).replaceAll("-","")}static getProps(e){let s={};for(let f of e.attributes)s[f.name]=f.value;return s}static formData(e){let s=new FormData(e.closest("form")),f={};return s.forEach((p,h)=>{f[h]=p}),f}static fastBind(){return!1}constructor(){this.__int={}}n=W;get fezHtmlRoot(){return`Fez.find(this, "${this.fezName}").`}get isAttached(){return this.root?.parentNode?!0:(Object.keys(this.__int).forEach(e=>{clearInterval(this.__int[e])}),this.root.fez=null,this.root=null,!1)}prop(e){let s=this.oldRoot[e]||this.props[e];return typeof s=="function"&&(s=s.bind(this.root)),s}copy(){for(let e of Array.from(arguments)){let s=this.props[e];if(s!==void 0){if(e=="class"){let f=this.root.getAttribute(e,s);f&&(s=[f,s].join(" "))}typeof s=="string"?this.root.setAttribute(e,s):this.root[e]=s}}}slot(e,s){s||=document.createElement("template");let f=s.nodeName=="SLOT";for(;e.firstChild;)f?s.parentNode.insertBefore(e.lastChild,s.nextSibling):s.appendChild(e.firstChild);return f?s.parentNode.removeChild(s):e.innerHTML="",s}style(){console.error("call Fez static style")}connect(){console.error('Fez is missing "connect" method.',this.root)}parseHtml(e,s){if(typeof e=="object"&&(e=e[0]),e=e.replaceAll("$$.",this.fezHtmlRoot.replaceAll('"',""")),e.includes("{{"))try{e=q(e,this)()}catch(f){console.error(`Fez stache template error in "${this.fezName}"`,f)}return e}html(e,s){e||(e=this.class.html),typeof s>"u"&&(s=e,e=this.root),typeof e=="string"&&(e=this.find(e));let f=document.createElement("div");typeof s=="function"&&(s=s()),Array.isArray(s)?s[0]instanceof Node?s.forEach(c=>{f.appendChild(c)}):s=s.join(""):typeof s=="string"?f.innerHTML=this.parseHtml(s):f.appendChild(s);let p=f.querySelector("slot");p&&this.slot(e,p),y.morphdom(e,f);let h=(c,o)=>{e.querySelectorAll(`*[${c}]`).forEach(m=>{let g=m.getAttribute(c);m.removeAttribute(c),g&&o.bind(this)(g,m)})};h("fez-this",(c,o)=>{this[c]=o}),h("fez-use",(c,o)=>{let m=this[c];typeof m=="function"?m(o):console.error(`Fez error: "${c}" is not a function in ${this.fezName}`)}),h("fez-class",c=>{let o=c.split(/\s+/),m=o.pop();o.forEach(g=>n.classList.add(g)),m&&setTimeout(()=>{n.classList.add(m)},1e3)})}setInterval(e,s,f){return typeof e=="number"&&([s,e]=[e,s]),f||=this.class.fnv1(String(e)),clearInterval(this.__int[f]),this.__int[f]=setInterval(()=>{this.isAttached&&e()},s),this.__int[f]}css(e,s){let f=y.css(e);return s&&this.root.classList.add(f),f}find(e){return this.root.querySelector(e)}val(e,s){let f=this.find(".time");["INPUT","TEXTAREA","SELECT"].includes(f.nodeName)?f.value=s:f.innerHTML=new Date}formData(e){return this.class.formData(e||this.root)}attr(e,s){return typeof s>"u"?this.root.getAttribute(e):(this.root.setAttribute(e,s),s)}childNodes(e){let s=Array.from(this.root.querySelectorAll(":scope > *"));if(e)s.forEach(e);else return s}subscribe(e,s){y._subs||={},y._subs[e]||=[],y._subs[e]=y._subs[e].filter(f=>f[0].isAttached),y._subs[e].push([this,s])}fezRegister(){this.class.css&&(typeof this.class.css=="function"&&(this.class.css=this.class.css(this)),this.class.css.includes(":")&&(this.class.css=y.css(this.class.css)),this.root.classList.add(this.class.css)),this.fezRegisterBindMethods()}fezRegisterBindMethods(){Object.getOwnPropertyNames(Object.getPrototypeOf(this)).filter(s=>s!=="constructor"&&typeof this[s]=="function").forEach(s=>this[s]=this[s].bind(this))}};setInterval(()=>{O.__objects=O.__objects.filter(l=>l.isAttached)},1e4);var Ee=new MutationObserver((l,e)=>{for(let s of l)if(s.type==="attributes"){let f=s.target.fez,p=s.attributeName,h=s.target.getAttribute(p);f.props[p]=h,f.onPropsChange(p,h)}}),y=(l,e)=>{function s(){let p=this.parentNode;if(p){let h=typeof e.nodeName=="function"?e.nodeName(this):e.nodeName,c=document.createElement(h||"div");c.classList.add("fez"),c.classList.add(`fez-${l}`),p.replaceChild(c,this);let o=new e;o.oldRoot=this,o.fezName=l,o.root=c,o.props=e.getProps(this),o.class=e,o.slot(this,c),c.fez=o,window.$&&(o.$root=$(c)),o.props.id&&c.setAttribute("id",o.props.id),o.fezRegister(),o.connect(o.props),e.__objects.push(o),e.html&&(typeof e.html=="function"&&(e.html=e.html(this)),e.html=q(e.html,o),o.html()),o.onPropsChange&&Ee.observe(c,{attributes:!0})}}function f(p){return typeof e.fastBind=="function"?e.fastBind(p):e.fastBind}if(!l)return O;if(typeof e!="function")return y.find(l,e);customElements.define(l,class extends HTMLElement{connectedCallback(){this.firstChild||f(this)?(y.info(`fast bind: ${l}`),s.bind(this)()):(y.info(`slow bind: ${l}`),window.requestAnimationFrame(()=>{s.bind(this)()}))}})};y.find=(l,e)=>{typeof l=="string"&&(l=document.body.querySelector(l)),typeof l.val=="function"&&(l=l[0]);let s=e?`.fez-${e}`:".fez";return l.closest(s).fez};y.globalCss=l=>{let e=y.css(l);return document.addEventListener("DOMContentLoaded",()=>{document.body.classList.add(e)}),e};y.css=l=>x.css(l);y.info=l=>{window.DEBUG&&console.log(`Fez: ${l}`)};y.morphdom=(l,e,s={})=>{s.childrenOnly===void 0&&(s.childrenOnly=!0),Y.morph(l,e,{morphStyle:"innerHTML"})};y.htmlEscape=l=>l.replaceAll("'","'").replaceAll('"',""").replaceAll("<","<").replaceAll(">",">");y.publish=(l,...e)=>{y._subs[l]||=[],y._subs[l].forEach(s=>{s[1].bind(s[0])(...e)})};window.Fez=y;window.FezBase=O;})(); + `;return new Function("_data",L)}function m(A){let S=o(A);return()=>{let[L,T]=S.bind(e)();return L.reduce((y,I,_)=>y+T[_-1]+I)}}function g(A){let S=new Set(["area","base","br","col","embed","hr","img","input","link","meta","source","track","wbr"]);return A.replace(/<([a-z-]+)\b([^>]*)\/>/g,(L,T,y)=>S.has(T)?L:`<${T}${y}>`)}return l=g(l),m(l)}var Y=function(){"use strict";let l=new Set,e={morphStyle:"outerHTML",callbacks:{beforeNodeAdded:T,afterNodeAdded:T,beforeNodeMorphed:T,afterNodeMorphed:T,beforeNodeRemoved:T,afterNodeRemoved:T,beforeAttributeUpdated:T},head:{style:"merge",shouldPreserve:function(t){return t.getAttribute("im-preserve")==="true"},shouldReAppend:function(t){return t.getAttribute("im-re-append")==="true"},shouldRemove:T,afterHeadMorphed:T}};function i(t,r,s={}){t instanceof Document&&(t=t.documentElement),typeof r=="string"&&(r=re(r));let f=ie(r),c=I(t,f,s);return a(t,f,c)}function a(t,r,s){if(s.head.block){let f=t.querySelector("head"),c=r.querySelector("head");if(f&&c){let h=S(c,f,s);Promise.all(h).then(function(){a(t,r,Object.assign(s,{head:{block:!1,ignore:!0}}))});return}}if(s.morphStyle==="innerHTML")return u(r,t,s),t.children;if(s.morphStyle==="outerHTML"||s.morphStyle==null){let f=se(r,t,s),c=f?.previousSibling,h=f?.nextSibling,b=d(t,f,s);return f?ne(c,b,h):[]}else throw"Do not understand how to morph style "+s.morphStyle}function p(t,r){return r.ignoreActiveValue&&t===document.activeElement&&t!==document.body}function d(t,r,s){if(!(s.ignoreActive&&t===document.activeElement))return r==null?s.callbacks.beforeNodeRemoved(t)===!1?t:(t.remove(),s.callbacks.afterNodeRemoved(t),null):R(t,r)?(s.callbacks.beforeNodeMorphed(t,r)===!1||(t instanceof HTMLHeadElement&&s.head.ignore||(t instanceof HTMLHeadElement&&s.head.style!=="morph"?S(r,t,s):(m(r,t,s),p(t,s)||u(r,t,s))),s.callbacks.afterNodeMorphed(t,r)),t):s.callbacks.beforeNodeRemoved(t)===!1||s.callbacks.beforeNodeAdded(r)===!1?t:(t.parentElement.replaceChild(r,t),s.callbacks.afterNodeAdded(r),s.callbacks.afterNodeRemoved(t),r)}function u(t,r,s){let f=t.firstChild,c=r.firstChild,h;for(;f;){if(h=f,f=h.nextSibling,c==null){if(s.callbacks.beforeNodeAdded(h)===!1)return;r.appendChild(h),s.callbacks.afterNodeAdded(h),H(s,h);continue}if(_(h,c,s)){d(c,h,s),c=c.nextSibling,H(s,h);continue}let b=ee(t,r,h,c,s);if(b){c=q(c,b,s),d(b,h,s),H(s,h);continue}let M=te(t,r,h,c,s);if(M){c=q(c,M,s),d(M,h,s),H(s,h);continue}if(s.callbacks.beforeNodeAdded(h)===!1)return;r.insertBefore(h,c),s.callbacks.afterNodeAdded(h),H(s,h)}for(;c!==null;){let b=c;c=c.nextSibling,U(b,s)}}function o(t,r,s,f){return t==="value"&&f.ignoreActiveValue&&r===document.activeElement?!0:f.callbacks.beforeAttributeUpdated(t,r,s)===!1}function m(t,r,s){let f=t.nodeType;if(f===1){let c=t.attributes,h=r.attributes;for(let b of c)o(b.name,r,"update",s)||r.getAttribute(b.name)!==b.value&&r.setAttribute(b.name,b.value);for(let b=h.length-1;0<=b;b--){let M=h[b];o(M.name,r,"remove",s)||t.hasAttribute(M.name)||r.removeAttribute(M.name)}}(f===8||f===3)&&r.nodeValue!==t.nodeValue&&(r.nodeValue=t.nodeValue),p(r,s)||A(t,r,s)}function g(t,r,s,f){if(t[s]!==r[s]){let c=o(s,r,"update",f);c||(r[s]=t[s]),t[s]?c||r.setAttribute(s,t[s]):o(s,r,"remove",f)||r.removeAttribute(s)}}function A(t,r,s){if(t instanceof HTMLInputElement&&r instanceof HTMLInputElement&&t.type!=="file"){let f=t.value,c=r.value;g(t,r,"checked",s),g(t,r,"disabled",s),t.hasAttribute("value")?f!==c&&(o("value",r,"update",s)||(r.setAttribute("value",f),r.value=f)):o("value",r,"remove",s)||(r.value="",r.removeAttribute("value"))}else if(t instanceof HTMLOptionElement)g(t,r,"selected",s);else if(t instanceof HTMLTextAreaElement&&r instanceof HTMLTextAreaElement){let f=t.value,c=r.value;if(o("value",r,"update",s))return;f!==c&&(r.value=f),r.firstChild&&r.firstChild.nodeValue!==f&&(r.firstChild.nodeValue=f)}}function S(t,r,s){let f=[],c=[],h=[],b=[],M=s.head.style,z=new Map;for(let E of t.children)z.set(E.outerHTML,E);for(let E of r.children){let w=z.has(E.outerHTML),F=s.head.shouldReAppend(E),B=s.head.shouldPreserve(E);w||B?F?c.push(E):(z.delete(E.outerHTML),h.push(E)):M==="append"?F&&(c.push(E),b.push(E)):s.head.shouldRemove(E)!==!1&&c.push(E)}b.push(...z.values());let X=[];for(let E of b){let w=document.createRange().createContextualFragment(E.outerHTML).firstChild;if(s.callbacks.beforeNodeAdded(w)!==!1){if(w.href||w.src){let F=null,B=new Promise(function(ue){F=ue});w.addEventListener("load",function(){F()}),X.push(B)}r.appendChild(w),s.callbacks.afterNodeAdded(w),f.push(w)}}for(let E of c)s.callbacks.beforeNodeRemoved(E)!==!1&&(r.removeChild(E),s.callbacks.afterNodeRemoved(E));return s.head.afterHeadMorphed(r,{added:f,kept:h,removed:c}),X}function L(){}function T(){}function y(t){let r={};return Object.assign(r,e),Object.assign(r,t),r.callbacks={},Object.assign(r.callbacks,e.callbacks),Object.assign(r.callbacks,t.callbacks),r.head={},Object.assign(r.head,e.head),Object.assign(r.head,t.head),r}function I(t,r,s){return s=y(s),{target:t,newContent:r,config:s,morphStyle:s.morphStyle,ignoreActive:s.ignoreActive,ignoreActiveValue:s.ignoreActiveValue,idMap:fe(t,r),deadIds:new Set,callbacks:s.callbacks,head:s.head}}function _(t,r,s){return t==null||r==null?!1:t.nodeType===r.nodeType&&t.tagName===r.tagName?t.id!==""&&t.id===r.id?!0:k(s,t,r)>0:!1}function R(t,r){return t==null||r==null?!1:t.nodeType===r.nodeType&&t.tagName===r.tagName}function q(t,r,s){for(;t!==r;){let f=t;t=t.nextSibling,U(f,s)}return H(s,r),r.nextSibling}function ee(t,r,s,f,c){let h=k(c,s,r),b=null;if(h>0){let M=f,z=0;for(;M!=null;){if(_(s,M,c))return M;if(z+=k(c,M,t),z>h)return null;M=M.nextSibling}}return b}function te(t,r,s,f,c){let h=f,b=s.nextSibling,M=0;for(;h!=null;){if(k(c,h,t)>0)return null;if(R(s,h))return h;if(R(b,h)&&(M++,b=b.nextSibling,M>=2))return null;h=h.nextSibling}return h}function re(t){let r=new DOMParser,s=t.replace(/]*>|>)([\s\S]*?)<\/svg>/gim,"");if(s.match(/<\/html>/)||s.match(/<\/head>/)||s.match(/<\/body>/)){let f=r.parseFromString(t,"text/html");if(s.match(/<\/html>/))return f.generatedByIdiomorph=!0,f;{let c=f.firstChild;return c?(c.generatedByIdiomorph=!0,c):null}}else{let c=r.parseFromString("","text/html").body.querySelector("template").content;return c.generatedByIdiomorph=!0,c}}function ie(t){if(t==null)return document.createElement("div");if(t.generatedByIdiomorph)return t;if(t instanceof Node){let r=document.createElement("div");return r.append(t),r}else{let r=document.createElement("div");for(let s of[...t])r.append(s);return r}}function ne(t,r,s){let f=[],c=[];for(;t!=null;)f.push(t),t=t.previousSibling;for(;f.length>0;){let h=f.pop();c.push(h),r.parentElement.insertBefore(h,r)}for(c.push(r);s!=null;)f.push(s),c.push(s),s=s.nextSibling;for(;f.length>0;)r.parentElement.insertBefore(f.pop(),r.nextSibling);return c}function se(t,r,s){let f;f=t.firstChild;let c=f,h=0;for(;f;){let b=le(f,r,s);b>h&&(c=f,h=b),f=f.nextSibling}return c}function le(t,r,s){return R(t,r)?.5+k(s,t,r):0}function U(t,r){H(r,t),r.callbacks.beforeNodeRemoved(t)!==!1&&(t.remove(),r.callbacks.afterNodeRemoved(t))}function oe(t,r){return!t.deadIds.has(r)}function ae(t,r,s){return(t.idMap.get(s)||l).has(r)}function H(t,r){let s=t.idMap.get(r)||l;for(let f of s)t.deadIds.add(f)}function k(t,r,s){let f=t.idMap.get(r)||l,c=0;for(let h of f)oe(t,h)&&ae(t,h,s)&&++c;return c}function G(t,r){let s=t.parentElement,f=t.querySelectorAll("[id]");for(let c of f){let h=c;for(;h!==s&&h!=null;){let b=r.get(h);b==null&&(b=new Set,r.set(h,b)),b.add(c.id),h=h.parentElement}}}function fe(t,r){let s=new Map;return G(t,s),G(r,s),s}return{morph:i,defaults:e}}();var ce={data:""},J=l=>typeof window=="object"?((l?l.querySelector("#_goober"):window._goober)||Object.assign((l||document.head).appendChild(document.createElement("style")),{innerHTML:" ",id:"_goober"})).firstChild:l||ce,de=l=>{let e=J(l),i=e.data;return e.data="",i},he=/(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g,pe=/\/\*[^]*?\*\/| +/g,Z=/\n+/g,C=(l,e)=>{let i="",a="",p="";for(let d in l){let u=l[d];d[0]=="@"?d[1]=="i"?i=d+" "+u+";":a+=d[1]=="f"?C(u,d):d+"{"+C(u,d[1]=="k"?"":e)+"}":typeof u=="object"?a+=C(u,e?e.replace(/([^,])+/g,o=>d.replace(/(^:.*)|([^,])+/g,m=>/&/.test(m)?m.replace(/&/g,o):o?o+" "+m:m)):d):u!=null&&(d=/^--/.test(d)?d:d.replace(/[A-Z]/g,"-$&").toLowerCase(),p+=C.p?C.p(d,u):d+":"+u+";")}return i+(e&&p?e+"{"+p+"}":p)+a},j={},K=l=>{if(typeof l=="object"){let e="";for(let i in l)e+=i+K(l[i]);return e}return l},me=(l,e,i,a,p)=>{let d=K(l),u=j[d]||(j[d]=(m=>{let g=0,A=11;for(;g>>0;return"go"+A})(d));if(!j[u]){let m=d!==l?l:(g=>{let A,S,L=[{}];for(;A=he.exec(g.replace(pe,""));)A[4]?L.shift():A[3]?(S=A[3].replace(Z," ").trim(),L.unshift(L[0][S]=L[0][S]||{})):L[0][A[1]]=A[2].replace(Z," ").trim();return L[0]})(l);j[u]=C(p?{["@keyframes "+u]:m}:m,i?"":"."+u)}let o=i&&j.g?j.g:null;return i&&(j.g=j[u]),((m,g,A,S)=>{S?g.data=g.data.replace(S,m):g.data.indexOf(m)===-1&&(g.data=A?m+g.data:g.data+m)})(j[u],e,a,o),u},be=(l,e,i)=>l.reduce((a,p,d)=>{let u=e[d];if(u&&u.call){let o=u(i),m=o&&o.props&&o.props.className||/^go/.test(o)&&o;u=m?"."+m:o&&typeof o=="object"?o.props?"":C(o,""):o===!1?"":o}return a+p+(u??"")},"");function P(l){let e=this||{},i=l.call?l(e.p):l;return me(i.unshift?i.raw?be(i,[].slice.call(arguments,1),e.p):i.reduce((a,p)=>Object.assign(a,p&&p.call?p(e.p):p),{}):i,J(e.target),e.g,e.o,e.k)}var Q,V,D,ge=P.bind({g:1}),ye=P.bind({k:1});function ve(l,e,i,a){C.p=e,Q=l,V=i,D=a}function Ae(l,e){let i=this||{};return function(){let a=arguments;function p(d,u){let o=Object.assign({},d),m=o.className||p.className;i.p=Object.assign({theme:V&&V()},o),i.o=/ *go\d+/.test(m),o.className=P.apply(i,a)+(m?" "+m:""),e&&(o.ref=u);let g=l;return l[0]&&(g=o.as||l,delete o.as),D&&g[0]&&D(o),Q(g,o)}return e?e(p):p}}var x={css:P,extractCss:de,glob:ge,keyframes:ye,setup:ve,styled:Ae};function W(l,e={},i){if(typeof e=="string"&&([e,i]=[i,e],e||={}),e instanceof Node&&(i=e,e={}),Array.isArray(l)&&(i=l,l="div"),(typeof e!="object"||Array.isArray(e))&&(i=e,e={}),l.includes(".")){let p=l.split(".");l=p.shift()||"div";let d=p.join(" ");e.class?e.class+=` ${d}`:e.class=d}let a=document.createElement(l);for(let[p,d]of Object.entries(e))if(typeof d=="function")a[p]=d.bind(this);else{let u=String(d).replaceAll("$$.",this.fezHtmlRoot);a.setAttribute(p,u)}if(i)if(Array.isArray(i))for(let p of i)a.appendChild(p);else i instanceof Node?a.appendChild(i):a.innerHTML=String(i);return a}var O=class{static __objects=[];static find(e,i){return v.find(e,i)}static fnv1(e){var i,a,p,d,u,o;for(i=2166136261,a=16777619,p=i,d=u=0,o=e.length-1;0<=o?u<=o:u>=o;d=0<=o?++u:--u)p^=e.charCodeAt(d),p*=a;return p.toString(36).replaceAll("-","")}static getProps(e){let i={};for(let a of e.attributes)i[a.name]=a.value;return i}static formData(e){let i=new FormData(e.closest("form")),a={};return i.forEach((p,d)=>{a[d]=p}),a}static fastBind(){return!1}constructor(){this.__int={}}n=W;get fezHtmlRoot(){return`Fez.find(this, "${this.fezName}").`}get isAttached(){return this.root?.parentNode?!0:(Object.keys(this.__int).forEach(e=>{clearInterval(this.__int[e])}),this.root.fez=null,this.root=null,!1)}prop(e){let i=this.oldRoot[e]||this.props[e];return typeof i=="function"&&(i=i.bind(this.root)),i}copy(){for(let e of Array.from(arguments)){let i=this.props[e];if(i!==void 0){if(e=="class"){let a=this.root.getAttribute(e,i);a&&(i=[a,i].join(" "))}typeof i=="string"?this.root.setAttribute(e,i):this.root[e]=i}}}slot(e,i){i||=document.createElement("template");let a=i.nodeName=="SLOT";for(;e.firstChild;)a?i.parentNode.insertBefore(e.lastChild,i.nextSibling):i.appendChild(e.firstChild);return a?i.parentNode.removeChild(i):e.innerHTML="",i}style(){console.error("call Fez static style")}connect(){console.error('Fez is missing "connect" method.',this.root)}parseHtml(e,i){if(typeof e=="object"&&(e=e[0]),e=e.replaceAll("$$.",this.fezHtmlRoot.replaceAll('"',""")),e.includes("{{"))try{e=N(e,this)()}catch(a){console.error(`Fez stache template error in "${this.fezName}"`,a)}return e}html(e,i){e||(e=this.class.html),typeof i>"u"&&(i=e,e=this.root),typeof e=="string"&&(e=this.find(e));let a=document.createElement("div");typeof i=="function"&&(i=i()),Array.isArray(i)?i[0]instanceof Node?i.forEach(u=>{a.appendChild(u)}):i=i.join(""):typeof i=="string"?a.innerHTML=this.parseHtml(i):a.appendChild(i);let p=a.querySelector("slot");p&&this.slot(e,p),v.morphdom(e,a);let d=(u,o)=>{e.querySelectorAll(`*[${u}]`).forEach(m=>{let g=m.getAttribute(u);m.removeAttribute(u),g&&o.bind(this)(g,m)})};d("fez-this",(u,o)=>{this[u]=o}),d("fez-use",(u,o)=>{let m=this[u];typeof m=="function"?m(o):console.error(`Fez error: "${u}" is not a function in ${this.fezName}`)}),d("fez-class",u=>{let o=u.split(/\s+/),m=o.pop();o.forEach(g=>n.classList.add(g)),m&&setTimeout(()=>{n.classList.add(m)},1e3)})}setInterval(e,i,a){return typeof e=="number"&&([i,e]=[e,i]),a||=this.class.fnv1(String(e)),clearInterval(this.__int[a]),this.__int[a]=setInterval(()=>{this.isAttached&&e()},i),this.__int[a]}css(e,i){let a=v.css(e);return i&&this.root.classList.add(a),a}find(e){return this.root.querySelector(e)}val(e,i){let a=this.find(".time");["INPUT","TEXTAREA","SELECT"].includes(a.nodeName)?a.value=i:a.innerHTML=new Date}formData(e){return this.class.formData(e||this.root)}attr(e,i){return typeof i>"u"?this.root.getAttribute(e):(this.root.setAttribute(e,i),i)}childNodes(e){let i=Array.from(this.root.querySelectorAll(":scope > *"));if(e)i.forEach(e);else return i}subscribe(e,i){v._subs||={},v._subs[e]||=[],v._subs[e]=v._subs[e].filter(a=>a[0].isAttached),v._subs[e].push([this,i])}fezRegister(){this.class.css&&(typeof this.class.css=="function"&&(this.class.css=this.class.css(this)),this.class.css.includes(":")&&(this.class.css=v.css(this.class.css)),this.root.classList.add(this.class.css)),this.fezRegisterBindMethods()}fezRegisterBindMethods(){Object.getOwnPropertyNames(Object.getPrototypeOf(this)).filter(i=>i!=="constructor"&&typeof this[i]=="function").forEach(i=>this[i]=this[i].bind(this))}reactiveStore(e,i){i||=(p,d,u)=>{window.requestAnimationFrame(()=>{v.info("reactive render"),this.html()},0)},i.bind(this);function a(p,d){return typeof p!="object"||p===null?p:new Proxy(p,{set(u,o,m,g){typeof m=="object"&&m!==null&&(m=a(m,d));let A=Reflect.set(u,o,m,g);return d(u,o,m),A},get(u,o,m){let g=Reflect.get(u,o,m);return typeof g=="object"&&g!==null?a(g,d):g}})}return a(e,i)}};setInterval(()=>{O.__objects=O.__objects.filter(l=>l.isAttached)},1e4);var Ee=new MutationObserver((l,e)=>{for(let i of l)if(i.type==="attributes"){let a=i.target.fez,p=i.attributeName,d=i.target.getAttribute(p);a.props[p]=d,a.onPropsChange(p,d)}}),v=(l,e)=>{function i(){let p=this.parentNode;if(p){let d=typeof e.nodeName=="function"?e.nodeName(this):e.nodeName,u=document.createElement(d||"div");u.classList.add("fez"),u.classList.add(`fez-${l}`),p.replaceChild(u,this);let o=new e;o.oldRoot=this,o.fezName=l,o.root=u,o.props=e.getProps(this),o.class=e,o.slot(this,u),u.fez=o,window.$&&(o.$root=$(u)),o.props.id&&u.setAttribute("id",o.props.id),o.fezRegister(),o.connect(o.props),e.__objects.push(o),e.html&&(typeof e.html=="function"&&(e.html=e.html(this)),e.html=N(e.html,o),o.html()),o.onPropsChange&&Ee.observe(u,{attributes:!0})}}function a(p){return typeof e.fastBind=="function"?e.fastBind(p):e.fastBind}if(!l)return O;if(typeof e!="function")return v.find(l,e);customElements.define(l,class extends HTMLElement{connectedCallback(){this.firstChild||a(this)?(v.info(`fast bind: ${l}`),i.bind(this)()):(v.info(`slow bind: ${l}`),window.requestAnimationFrame(()=>{i.bind(this)()}))}})};v.find=(l,e)=>{typeof l=="string"&&(l=document.body.querySelector(l)),typeof l.val=="function"&&(l=l[0]);let i=e?`.fez-${e}`:".fez";return l.closest(i).fez};v.globalCss=l=>{let e=v.css(l);return document.addEventListener("DOMContentLoaded",()=>{document.body.classList.add(e)}),e};v.css=l=>x.css(l);v.info=l=>{window.DEBUG&&console.log(`Fez: ${l}`)};v.morphdom=(l,e,i={})=>{i.childrenOnly===void 0&&(i.childrenOnly=!0),Y.morph(l,e,{morphStyle:"innerHTML"})};v.htmlEscape=l=>l.replaceAll("'","'").replaceAll('"',""").replaceAll("<","<").replaceAll(">",">");v.publish=(l,...e)=>{v._subs[l]||=[],v._subs[l].forEach(i=>{i[1].bind(i[0])(...e)})};window.Fez=v;window.FezBase=O;})(); //# sourceMappingURL=fez.js.map diff --git a/dist/fez.js.map b/dist/fez.js.map index f1f4b27..1f26f94 100644 --- a/dist/fez.js.map +++ b/dist/fez.js.map @@ -1,7 +1,7 @@ { "version": 3, "sources": ["../src/lib/stache.js", "../src/lib/idiomorph.js", "../src/lib/gobber.js", "../src/lib/n.js", "../src/fez.js"], - "sourcesContent": ["// https://github.com/ryanmorr/stache\nexport default function renderStache(tpl, context) {\n const NEW_LINES_RE = /(\\r\\n|\\r|\\n)/g;\n const TEMPLATE_RE = /{{\\s*(.+?)\\s*}}/g;\n const EACH_RE = /^each\\s+(.*)\\s+as\\s+(.*)$/;\n const IF_RE = /^if\\s+(.*)$/;\n const ELSE_IF_RE = /^else if\\s+(.*)$/;\n\n function stache(source) {\n const monkey = (t) => t.replaceAll('@', 'this.')\n\n let func = `\n let _strings = [], _sequence = [], _values = [];\n\n function htmlEscape(text) {\n if (typeof text === 'string') {\n return text\n .replaceAll(\"'\", ''')\n .replaceAll('\"', '"')\n .replaceAll('<', '<')\n .replaceAll('>', '>')\n } else {\n return text\n }\n }\n\n _sequence.push('${\n source.trim().replace(NEW_LINES_RE, '\\\\n').replace(TEMPLATE_RE, (all, code) => {\n // {{#if -> {{#if\n code = code.replace(/^[#:]/, '')\n\n if (code.startsWith('each') || code.startsWith('for')) {\n // support fro #for\n const parts = code.split(/\\s+/)\n if (parts.shift() === 'for') {\n const list = parts.pop()\n parts.pop()\n code = `each ${list} as ${parts.join(' ')}`\n }\n\n let loop = EACH_RE.exec(code);\n if (loop) {\n loop[1] = monkey(loop[1])\n return `');\\n (!Array.isArray(${loop[1]}) ? Array.from(Object.entries(${loop[1]} || []), ([key, value]) => [key, value]) : ${loop[1]}).forEach((${loop[2]}) => { _sequence.push('`\n }\n } else if (code.startsWith('if')) {\n let conditional = (IF_RE).exec(code);\n if (conditional) {\n conditional[1] = monkey(conditional[1])\n return `');\\n if (${conditional[1]}) { _sequence.push('`\n }\n } else if (code.startsWith('else if')) {\n let conditionalElse = (ELSE_IF_RE).exec(code);\n if (conditionalElse) {\n conditionalElse[1] = monkey(conditionalElse[1])\n return `');\\n } else if (${conditionalElse[1]}) { _sequence.push('`\n }\n } else if (code === 'else') {\n return `');\\n } else { _sequence.push('` // eslint-disable-line quotes\n } else if (code === '/each' || code === '/for') {\n return `');\\n }); _sequence.push('` // eslint-disable-line quotes\n } else if (code === '/if') {\n return `');\\n } _sequence.push('` // eslint-disable-line quotes\n }\n\n // support for @html -> {{@html raw}} -> same as in svelte\n const codeParts = code.split(/^\\@html\\s+/)\n if (codeParts[1]) {\n code = monkey(codeParts[1])\n } else {\n code = `htmlEscape(${monkey(code)})`\n }\n\n return `');\\n _strings.push(_sequence.join(''));\\n _sequence = [];\\n _values.push(${code});\\n _sequence.push('`;\n })\n }');\n _strings.push(_sequence.join(''));\n return [_strings, _values];\n `\n\n return new Function('_data', func);\n }\n\n function createTemplate(source) {\n const tpl = stache(source);\n return () => {\n const [strings, values] = tpl.bind(context)();\n return strings.reduce((acc, str, i) => acc + (values[i - 1]) + str);\n };\n }\n\n function closeCustomTags(html) {\n const selfClosingTags = new Set([\n 'area', 'base', 'br', 'col', 'embed', 'hr', 'img', 'input', 'link', 'meta', 'source', 'track', 'wbr'\n ])\n\n return html.replace(/<([a-z-]+)\\b([^>]*)\\/>/g, (match, tagName, attributes) => {\n return selfClosingTags.has(tagName) ? match : `<${tagName}${attributes}>`\n })\n }\n\n tpl = closeCustomTags(tpl)\n return createTemplate(tpl)\n}\n", "// base IIFE to define idiomorph\nvar Idiomorph = (function () {\n 'use strict';\n\n //=============================================================================\n // AND NOW IT BEGINS...\n //=============================================================================\n let EMPTY_SET = new Set();\n\n // default configuration values, updatable by users now\n let defaults = {\n morphStyle: \"outerHTML\",\n callbacks : {\n beforeNodeAdded: noOp,\n afterNodeAdded: noOp,\n beforeNodeMorphed: noOp,\n afterNodeMorphed: noOp,\n beforeNodeRemoved: noOp,\n afterNodeRemoved: noOp,\n beforeAttributeUpdated: noOp,\n\n },\n head: {\n style: 'merge',\n shouldPreserve: function (elt) {\n return elt.getAttribute(\"im-preserve\") === \"true\";\n },\n shouldReAppend: function (elt) {\n return elt.getAttribute(\"im-re-append\") === \"true\";\n },\n shouldRemove: noOp,\n afterHeadMorphed: noOp,\n }\n };\n\n //=============================================================================\n // Core Morphing Algorithm - morph, morphNormalizedContent, morphOldNodeTo, morphChildren\n //=============================================================================\n function morph(oldNode, newContent, config = {}) {\n\n if (oldNode instanceof Document) {\n oldNode = oldNode.documentElement;\n }\n\n if (typeof newContent === 'string') {\n newContent = parseContent(newContent);\n }\n\n let normalizedContent = normalizeContent(newContent);\n\n let ctx = createMorphContext(oldNode, normalizedContent, config);\n\n return morphNormalizedContent(oldNode, normalizedContent, ctx);\n }\n\n function morphNormalizedContent(oldNode, normalizedNewContent, ctx) {\n if (ctx.head.block) {\n let oldHead = oldNode.querySelector('head');\n let newHead = normalizedNewContent.querySelector('head');\n if (oldHead && newHead) {\n let promises = handleHeadElement(newHead, oldHead, ctx);\n // when head promises resolve, call morph again, ignoring the head tag\n Promise.all(promises).then(function () {\n morphNormalizedContent(oldNode, normalizedNewContent, Object.assign(ctx, {\n head: {\n block: false,\n ignore: true\n }\n }));\n });\n return;\n }\n }\n\n if (ctx.morphStyle === \"innerHTML\") {\n\n // innerHTML, so we are only updating the children\n morphChildren(normalizedNewContent, oldNode, ctx);\n return oldNode.children;\n\n } else if (ctx.morphStyle === \"outerHTML\" || ctx.morphStyle == null) {\n // otherwise find the best element match in the new content, morph that, and merge its siblings\n // into either side of the best match\n let bestMatch = findBestNodeMatch(normalizedNewContent, oldNode, ctx);\n\n // stash the siblings that will need to be inserted on either side of the best match\n let previousSibling = bestMatch?.previousSibling;\n let nextSibling = bestMatch?.nextSibling;\n\n // morph it\n let morphedNode = morphOldNodeTo(oldNode, bestMatch, ctx);\n\n if (bestMatch) {\n // if there was a best match, merge the siblings in too and return the\n // whole bunch\n return insertSiblings(previousSibling, morphedNode, nextSibling);\n } else {\n // otherwise nothing was added to the DOM\n return []\n }\n } else {\n throw \"Do not understand how to morph style \" + ctx.morphStyle;\n }\n }\n\n\n /**\n * @param possibleActiveElement\n * @param ctx\n * @returns {boolean}\n */\n function ignoreValueOfActiveElement(possibleActiveElement, ctx) {\n return ctx.ignoreActiveValue && possibleActiveElement === document.activeElement && possibleActiveElement !== document.body;\n }\n\n /**\n * @param oldNode root node to merge content into\n * @param newContent new content to merge\n * @param ctx the merge context\n * @returns {Element} the element that ended up in the DOM\n */\n function morphOldNodeTo(oldNode, newContent, ctx) {\n if (ctx.ignoreActive && oldNode === document.activeElement) {\n // don't morph focused element\n } else if (newContent == null) {\n if (ctx.callbacks.beforeNodeRemoved(oldNode) === false) return oldNode;\n\n oldNode.remove();\n ctx.callbacks.afterNodeRemoved(oldNode);\n return null;\n } else if (!isSoftMatch(oldNode, newContent)) {\n if (ctx.callbacks.beforeNodeRemoved(oldNode) === false) return oldNode;\n if (ctx.callbacks.beforeNodeAdded(newContent) === false) return oldNode;\n\n oldNode.parentElement.replaceChild(newContent, oldNode);\n ctx.callbacks.afterNodeAdded(newContent);\n ctx.callbacks.afterNodeRemoved(oldNode);\n return newContent;\n } else {\n if (ctx.callbacks.beforeNodeMorphed(oldNode, newContent) === false) return oldNode;\n\n if (oldNode instanceof HTMLHeadElement && ctx.head.ignore) {\n // ignore the head element\n } else if (oldNode instanceof HTMLHeadElement && ctx.head.style !== \"morph\") {\n handleHeadElement(newContent, oldNode, ctx);\n } else {\n syncNodeFrom(newContent, oldNode, ctx);\n if (!ignoreValueOfActiveElement(oldNode, ctx)) {\n morphChildren(newContent, oldNode, ctx);\n }\n }\n ctx.callbacks.afterNodeMorphed(oldNode, newContent);\n return oldNode;\n }\n }\n\n /**\n * This is the core algorithm for matching up children. The idea is to use id sets to try to match up\n * nodes as faithfully as possible. We greedily match, which allows us to keep the algorithm fast, but\n * by using id sets, we are able to better match up with content deeper in the DOM.\n *\n * Basic algorithm is, for each node in the new content:\n *\n * - if we have reached the end of the old parent, append the new content\n * - if the new content has an id set match with the current insertion point, morph\n * - search for an id set match\n * - if id set match found, morph\n * - otherwise search for a \"soft\" match\n * - if a soft match is found, morph\n * - otherwise, prepend the new node before the current insertion point\n *\n * The two search algorithms terminate if competing node matches appear to outweigh what can be achieved\n * with the current node. See findIdSetMatch() and findSoftMatch() for details.\n *\n * @param {Element} newParent the parent element of the new content\n * @param {Element } oldParent the old content that we are merging the new content into\n * @param ctx the merge context\n */\n function morphChildren(newParent, oldParent, ctx) {\n\n let nextNewChild = newParent.firstChild;\n let insertionPoint = oldParent.firstChild;\n let newChild;\n\n // run through all the new content\n while (nextNewChild) {\n\n newChild = nextNewChild;\n nextNewChild = newChild.nextSibling;\n\n // if we are at the end of the exiting parent's children, just append\n if (insertionPoint == null) {\n if (ctx.callbacks.beforeNodeAdded(newChild) === false) return;\n\n oldParent.appendChild(newChild);\n ctx.callbacks.afterNodeAdded(newChild);\n removeIdsFromConsideration(ctx, newChild);\n continue;\n }\n\n // if the current node has an id set match then morph\n if (isIdSetMatch(newChild, insertionPoint, ctx)) {\n morphOldNodeTo(insertionPoint, newChild, ctx);\n insertionPoint = insertionPoint.nextSibling;\n removeIdsFromConsideration(ctx, newChild);\n continue;\n }\n\n // otherwise search forward in the existing old children for an id set match\n let idSetMatch = findIdSetMatch(newParent, oldParent, newChild, insertionPoint, ctx);\n\n // if we found a potential match, remove the nodes until that point and morph\n if (idSetMatch) {\n insertionPoint = removeNodesBetween(insertionPoint, idSetMatch, ctx);\n morphOldNodeTo(idSetMatch, newChild, ctx);\n removeIdsFromConsideration(ctx, newChild);\n continue;\n }\n\n // no id set match found, so scan forward for a soft match for the current node\n let softMatch = findSoftMatch(newParent, oldParent, newChild, insertionPoint, ctx);\n\n // if we found a soft match for the current node, morph\n if (softMatch) {\n insertionPoint = removeNodesBetween(insertionPoint, softMatch, ctx);\n morphOldNodeTo(softMatch, newChild, ctx);\n removeIdsFromConsideration(ctx, newChild);\n continue;\n }\n\n // abandon all hope of morphing, just insert the new child before the insertion point\n // and move on\n if (ctx.callbacks.beforeNodeAdded(newChild) === false) return;\n\n oldParent.insertBefore(newChild, insertionPoint);\n ctx.callbacks.afterNodeAdded(newChild);\n removeIdsFromConsideration(ctx, newChild);\n }\n\n // remove any remaining old nodes that didn't match up with new content\n while (insertionPoint !== null) {\n\n let tempNode = insertionPoint;\n insertionPoint = insertionPoint.nextSibling;\n removeNode(tempNode, ctx);\n }\n }\n\n //=============================================================================\n // Attribute Syncing Code\n //=============================================================================\n\n /**\n * @param attr {String} the attribute to be mutated\n * @param to {Element} the element that is going to be updated\n * @param updateType {(\"update\"|\"remove\")}\n * @param ctx the merge context\n * @returns {boolean} true if the attribute should be ignored, false otherwise\n */\n function ignoreAttribute(attr, to, updateType, ctx) {\n if(attr === 'value' && ctx.ignoreActiveValue && to === document.activeElement){\n return true;\n }\n return ctx.callbacks.beforeAttributeUpdated(attr, to, updateType) === false;\n }\n\n /**\n * syncs a given node with another node, copying over all attributes and\n * inner element state from the 'from' node to the 'to' node\n *\n * @param {Element} from the element to copy attributes & state from\n * @param {Element} to the element to copy attributes & state to\n * @param ctx the merge context\n */\n function syncNodeFrom(from, to, ctx) {\n let type = from.nodeType\n\n // if is an element type, sync the attributes from the\n // new node into the new node\n if (type === 1 /* element type */) {\n const fromAttributes = from.attributes;\n const toAttributes = to.attributes;\n for (const fromAttribute of fromAttributes) {\n if (ignoreAttribute(fromAttribute.name, to, 'update', ctx)) {\n continue;\n }\n if (to.getAttribute(fromAttribute.name) !== fromAttribute.value) {\n to.setAttribute(fromAttribute.name, fromAttribute.value);\n }\n }\n // iterate backwards to avoid skipping over items when a delete occurs\n for (let i = toAttributes.length - 1; 0 <= i; i--) {\n const toAttribute = toAttributes[i];\n if (ignoreAttribute(toAttribute.name, to, 'remove', ctx)) {\n continue;\n }\n if (!from.hasAttribute(toAttribute.name)) {\n to.removeAttribute(toAttribute.name);\n }\n }\n }\n\n // sync text nodes\n if (type === 8 /* comment */ || type === 3 /* text */) {\n if (to.nodeValue !== from.nodeValue) {\n to.nodeValue = from.nodeValue;\n }\n }\n\n if (!ignoreValueOfActiveElement(to, ctx)) {\n // sync input values\n syncInputValue(from, to, ctx);\n }\n }\n\n /**\n * @param from {Element} element to sync the value from\n * @param to {Element} element to sync the value to\n * @param attributeName {String} the attribute name\n * @param ctx the merge context\n */\n function syncBooleanAttribute(from, to, attributeName, ctx) {\n if (from[attributeName] !== to[attributeName]) {\n let ignoreUpdate = ignoreAttribute(attributeName, to, 'update', ctx);\n if (!ignoreUpdate) {\n to[attributeName] = from[attributeName];\n }\n if (from[attributeName]) {\n if (!ignoreUpdate) {\n to.setAttribute(attributeName, from[attributeName]);\n }\n } else {\n if (!ignoreAttribute(attributeName, to, 'remove', ctx)) {\n to.removeAttribute(attributeName);\n }\n }\n }\n }\n\n /**\n * NB: many bothans died to bring us information:\n *\n * https://github.com/patrick-steele-idem/morphdom/blob/master/src/specialElHandlers.js\n * https://github.com/choojs/nanomorph/blob/master/lib/morph.jsL113\n *\n * @param from {Element} the element to sync the input value from\n * @param to {Element} the element to sync the input value to\n * @param ctx the merge context\n */\n function syncInputValue(from, to, ctx) {\n if (from instanceof HTMLInputElement &&\n to instanceof HTMLInputElement &&\n from.type !== 'file') {\n\n let fromValue = from.value;\n let toValue = to.value;\n\n // sync boolean attributes\n syncBooleanAttribute(from, to, 'checked', ctx);\n syncBooleanAttribute(from, to, 'disabled', ctx);\n\n if (!from.hasAttribute('value')) {\n if (!ignoreAttribute('value', to, 'remove', ctx)) {\n to.value = '';\n to.removeAttribute('value');\n }\n } else if (fromValue !== toValue) {\n if (!ignoreAttribute('value', to, 'update', ctx)) {\n to.setAttribute('value', fromValue);\n to.value = fromValue;\n }\n }\n } else if (from instanceof HTMLOptionElement) {\n syncBooleanAttribute(from, to, 'selected', ctx)\n } else if (from instanceof HTMLTextAreaElement && to instanceof HTMLTextAreaElement) {\n let fromValue = from.value;\n let toValue = to.value;\n if (ignoreAttribute('value', to, 'update', ctx)) {\n return;\n }\n if (fromValue !== toValue) {\n to.value = fromValue;\n }\n if (to.firstChild && to.firstChild.nodeValue !== fromValue) {\n to.firstChild.nodeValue = fromValue\n }\n }\n }\n\n //=============================================================================\n // the HEAD tag can be handled specially, either w/ a 'merge' or 'append' style\n //=============================================================================\n function handleHeadElement(newHeadTag, currentHead, ctx) {\n\n let added = []\n let removed = []\n let preserved = []\n let nodesToAppend = []\n\n let headMergeStyle = ctx.head.style;\n\n // put all new head elements into a Map, by their outerHTML\n let srcToNewHeadNodes = new Map();\n for (const newHeadChild of newHeadTag.children) {\n srcToNewHeadNodes.set(newHeadChild.outerHTML, newHeadChild);\n }\n\n // for each elt in the current head\n for (const currentHeadElt of currentHead.children) {\n\n // If the current head element is in the map\n let inNewContent = srcToNewHeadNodes.has(currentHeadElt.outerHTML);\n let isReAppended = ctx.head.shouldReAppend(currentHeadElt);\n let isPreserved = ctx.head.shouldPreserve(currentHeadElt);\n if (inNewContent || isPreserved) {\n if (isReAppended) {\n // remove the current version and let the new version replace it and re-execute\n removed.push(currentHeadElt);\n } else {\n // this element already exists and should not be re-appended, so remove it from\n // the new content map, preserving it in the DOM\n srcToNewHeadNodes.delete(currentHeadElt.outerHTML);\n preserved.push(currentHeadElt);\n }\n } else {\n if (headMergeStyle === \"append\") {\n // we are appending and this existing element is not new content\n // so if and only if it is marked for re-append do we do anything\n if (isReAppended) {\n removed.push(currentHeadElt);\n nodesToAppend.push(currentHeadElt);\n }\n } else {\n // if this is a merge, we remove this content since it is not in the new head\n if (ctx.head.shouldRemove(currentHeadElt) !== false) {\n removed.push(currentHeadElt);\n }\n }\n }\n }\n\n // Push the remaining new head elements in the Map into the\n // nodes to append to the head tag\n nodesToAppend.push(...srcToNewHeadNodes.values());\n log(\"to append: \", nodesToAppend);\n\n let promises = [];\n for (const newNode of nodesToAppend) {\n log(\"adding: \", newNode);\n let newElt = document.createRange().createContextualFragment(newNode.outerHTML).firstChild;\n log(newElt);\n if (ctx.callbacks.beforeNodeAdded(newElt) !== false) {\n if (newElt.href || newElt.src) {\n let resolve = null;\n let promise = new Promise(function (_resolve) {\n resolve = _resolve;\n });\n newElt.addEventListener('load', function () {\n resolve();\n });\n promises.push(promise);\n }\n currentHead.appendChild(newElt);\n ctx.callbacks.afterNodeAdded(newElt);\n added.push(newElt);\n }\n }\n\n // remove all removed elements, after we have appended the new elements to avoid\n // additional network requests for things like style sheets\n for (const removedElement of removed) {\n if (ctx.callbacks.beforeNodeRemoved(removedElement) !== false) {\n currentHead.removeChild(removedElement);\n ctx.callbacks.afterNodeRemoved(removedElement);\n }\n }\n\n ctx.head.afterHeadMorphed(currentHead, {added: added, kept: preserved, removed: removed});\n return promises;\n }\n\n //=============================================================================\n // Misc\n //=============================================================================\n\n function log() {\n //console.log(arguments);\n }\n\n function noOp() {\n }\n\n /*\n Deep merges the config object and the Idiomoroph.defaults object to\n produce a final configuration object\n */\n function mergeDefaults(config) {\n let finalConfig = {};\n // copy top level stuff into final config\n Object.assign(finalConfig, defaults);\n Object.assign(finalConfig, config);\n\n // copy callbacks into final config (do this to deep merge the callbacks)\n finalConfig.callbacks = {};\n Object.assign(finalConfig.callbacks, defaults.callbacks);\n Object.assign(finalConfig.callbacks, config.callbacks);\n\n // copy head config into final config (do this to deep merge the head)\n finalConfig.head = {};\n Object.assign(finalConfig.head, defaults.head);\n Object.assign(finalConfig.head, config.head);\n return finalConfig;\n }\n\n function createMorphContext(oldNode, newContent, config) {\n config = mergeDefaults(config);\n return {\n target: oldNode,\n newContent: newContent,\n config: config,\n morphStyle: config.morphStyle,\n ignoreActive: config.ignoreActive,\n ignoreActiveValue: config.ignoreActiveValue,\n idMap: createIdMap(oldNode, newContent),\n deadIds: new Set(),\n callbacks: config.callbacks,\n head: config.head\n }\n }\n\n function isIdSetMatch(node1, node2, ctx) {\n if (node1 == null || node2 == null) {\n return false;\n }\n if (node1.nodeType === node2.nodeType && node1.tagName === node2.tagName) {\n if (node1.id !== \"\" && node1.id === node2.id) {\n return true;\n } else {\n return getIdIntersectionCount(ctx, node1, node2) > 0;\n }\n }\n return false;\n }\n\n function isSoftMatch(node1, node2) {\n if (node1 == null || node2 == null) {\n return false;\n }\n return node1.nodeType === node2.nodeType && node1.tagName === node2.tagName\n }\n\n function removeNodesBetween(startInclusive, endExclusive, ctx) {\n while (startInclusive !== endExclusive) {\n let tempNode = startInclusive;\n startInclusive = startInclusive.nextSibling;\n removeNode(tempNode, ctx);\n }\n removeIdsFromConsideration(ctx, endExclusive);\n return endExclusive.nextSibling;\n }\n\n //=============================================================================\n // Scans forward from the insertionPoint in the old parent looking for a potential id match\n // for the newChild. We stop if we find a potential id match for the new child OR\n // if the number of potential id matches we are discarding is greater than the\n // potential id matches for the new child\n //=============================================================================\n function findIdSetMatch(newContent, oldParent, newChild, insertionPoint, ctx) {\n\n // max id matches we are willing to discard in our search\n let newChildPotentialIdCount = getIdIntersectionCount(ctx, newChild, oldParent);\n\n let potentialMatch = null;\n\n // only search forward if there is a possibility of an id match\n if (newChildPotentialIdCount > 0) {\n let potentialMatch = insertionPoint;\n // if there is a possibility of an id match, scan forward\n // keep track of the potential id match count we are discarding (the\n // newChildPotentialIdCount must be greater than this to make it likely\n // worth it)\n let otherMatchCount = 0;\n while (potentialMatch != null) {\n\n // If we have an id match, return the current potential match\n if (isIdSetMatch(newChild, potentialMatch, ctx)) {\n return potentialMatch;\n }\n\n // computer the other potential matches of this new content\n otherMatchCount += getIdIntersectionCount(ctx, potentialMatch, newContent);\n if (otherMatchCount > newChildPotentialIdCount) {\n // if we have more potential id matches in _other_ content, we\n // do not have a good candidate for an id match, so return null\n return null;\n }\n\n // advanced to the next old content child\n potentialMatch = potentialMatch.nextSibling;\n }\n }\n return potentialMatch;\n }\n\n //=============================================================================\n // Scans forward from the insertionPoint in the old parent looking for a potential soft match\n // for the newChild. We stop if we find a potential soft match for the new child OR\n // if we find a potential id match in the old parents children OR if we find two\n // potential soft matches for the next two pieces of new content\n //=============================================================================\n function findSoftMatch(newContent, oldParent, newChild, insertionPoint, ctx) {\n\n let potentialSoftMatch = insertionPoint;\n let nextSibling = newChild.nextSibling;\n let siblingSoftMatchCount = 0;\n\n while (potentialSoftMatch != null) {\n\n if (getIdIntersectionCount(ctx, potentialSoftMatch, newContent) > 0) {\n // the current potential soft match has a potential id set match with the remaining new\n // content so bail out of looking\n return null;\n }\n\n // if we have a soft match with the current node, return it\n if (isSoftMatch(newChild, potentialSoftMatch)) {\n return potentialSoftMatch;\n }\n\n if (isSoftMatch(nextSibling, potentialSoftMatch)) {\n // the next new node has a soft match with this node, so\n // increment the count of future soft matches\n siblingSoftMatchCount++;\n nextSibling = nextSibling.nextSibling;\n\n // If there are two future soft matches, bail to allow the siblings to soft match\n // so that we don't consume future soft matches for the sake of the current node\n if (siblingSoftMatchCount >= 2) {\n return null;\n }\n }\n\n // advanced to the next old content child\n potentialSoftMatch = potentialSoftMatch.nextSibling;\n }\n\n return potentialSoftMatch;\n }\n\n function parseContent(newContent) {\n let parser = new DOMParser();\n\n // remove svgs to avoid false-positive matches on head, etc.\n let contentWithSvgsRemoved = newContent.replace(/]*>|>)([\\s\\S]*?)<\\/svg>/gim, '');\n\n // if the newContent contains a html, head or body tag, we can simply parse it w/o wrapping\n if (contentWithSvgsRemoved.match(/<\\/html>/) || contentWithSvgsRemoved.match(/<\\/head>/) || contentWithSvgsRemoved.match(/<\\/body>/)) {\n let content = parser.parseFromString(newContent, \"text/html\");\n // if it is a full HTML document, return the document itself as the parent container\n if (contentWithSvgsRemoved.match(/<\\/html>/)) {\n content.generatedByIdiomorph = true;\n return content;\n } else {\n // otherwise return the html element as the parent container\n let htmlElement = content.firstChild;\n if (htmlElement) {\n htmlElement.generatedByIdiomorph = true;\n return htmlElement;\n } else {\n return null;\n }\n }\n } else {\n // if it is partial HTML, wrap it in a template tag to provide a parent element and also to help\n // deal with touchy tags like tr, tbody, etc.\n let responseDoc = parser.parseFromString(\"\", \"text/html\");\n let content = responseDoc.body.querySelector('template').content;\n content.generatedByIdiomorph = true;\n return content\n }\n }\n\n function normalizeContent(newContent) {\n if (newContent == null) {\n // noinspection UnnecessaryLocalVariableJS\n const dummyParent = document.createElement('div');\n return dummyParent;\n } else if (newContent.generatedByIdiomorph) {\n // the template tag created by idiomorph parsing can serve as a dummy parent\n return newContent;\n } else if (newContent instanceof Node) {\n // a single node is added as a child to a dummy parent\n const dummyParent = document.createElement('div');\n dummyParent.append(newContent);\n return dummyParent;\n } else {\n // all nodes in the array or HTMLElement collection are consolidated under\n // a single dummy parent element\n const dummyParent = document.createElement('div');\n for (const elt of [...newContent]) {\n dummyParent.append(elt);\n }\n return dummyParent;\n }\n }\n\n function insertSiblings(previousSibling, morphedNode, nextSibling) {\n let stack = []\n let added = []\n while (previousSibling != null) {\n stack.push(previousSibling);\n previousSibling = previousSibling.previousSibling;\n }\n while (stack.length > 0) {\n let node = stack.pop();\n added.push(node); // push added preceding siblings on in order and insert\n morphedNode.parentElement.insertBefore(node, morphedNode);\n }\n added.push(morphedNode);\n while (nextSibling != null) {\n stack.push(nextSibling);\n added.push(nextSibling); // here we are going in order, so push on as we scan, rather than add\n nextSibling = nextSibling.nextSibling;\n }\n while (stack.length > 0) {\n morphedNode.parentElement.insertBefore(stack.pop(), morphedNode.nextSibling);\n }\n return added;\n }\n\n function findBestNodeMatch(newContent, oldNode, ctx) {\n let currentElement;\n currentElement = newContent.firstChild;\n let bestElement = currentElement;\n let score = 0;\n while (currentElement) {\n let newScore = scoreElement(currentElement, oldNode, ctx);\n if (newScore > score) {\n bestElement = currentElement;\n score = newScore;\n }\n currentElement = currentElement.nextSibling;\n }\n return bestElement;\n }\n\n function scoreElement(node1, node2, ctx) {\n if (isSoftMatch(node1, node2)) {\n return .5 + getIdIntersectionCount(ctx, node1, node2);\n }\n return 0;\n }\n\n function removeNode(tempNode, ctx) {\n removeIdsFromConsideration(ctx, tempNode)\n if (ctx.callbacks.beforeNodeRemoved(tempNode) === false) return;\n\n tempNode.remove();\n ctx.callbacks.afterNodeRemoved(tempNode);\n }\n\n //=============================================================================\n // ID Set Functions\n //=============================================================================\n\n function isIdInConsideration(ctx, id) {\n return !ctx.deadIds.has(id);\n }\n\n function idIsWithinNode(ctx, id, targetNode) {\n let idSet = ctx.idMap.get(targetNode) || EMPTY_SET;\n return idSet.has(id);\n }\n\n function removeIdsFromConsideration(ctx, node) {\n let idSet = ctx.idMap.get(node) || EMPTY_SET;\n for (const id of idSet) {\n ctx.deadIds.add(id);\n }\n }\n\n function getIdIntersectionCount(ctx, node1, node2) {\n let sourceSet = ctx.idMap.get(node1) || EMPTY_SET;\n let matchCount = 0;\n for (const id of sourceSet) {\n // a potential match is an id in the source and potentialIdsSet, but\n // that has not already been merged into the DOM\n if (isIdInConsideration(ctx, id) && idIsWithinNode(ctx, id, node2)) {\n ++matchCount;\n }\n }\n return matchCount;\n }\n\n /**\n * A bottom up algorithm that finds all elements with ids inside of the node\n * argument and populates id sets for those nodes and all their parents, generating\n * a set of ids contained within all nodes for the entire hierarchy in the DOM\n *\n * @param node {Element}\n * @param {Map>} idMap\n */\n function populateIdMapForNode(node, idMap) {\n let nodeParent = node.parentElement;\n // find all elements with an id property\n let idElements = node.querySelectorAll('[id]');\n for (const elt of idElements) {\n let current = elt;\n // walk up the parent hierarchy of that element, adding the id\n // of element to the parent's id set\n while (current !== nodeParent && current != null) {\n let idSet = idMap.get(current);\n // if the id set doesn't exist, create it and insert it in the map\n if (idSet == null) {\n idSet = new Set();\n idMap.set(current, idSet);\n }\n idSet.add(elt.id);\n current = current.parentElement;\n }\n }\n }\n\n /**\n * This function computes a map of nodes to all ids contained within that node (inclusive of the\n * node). This map can be used to ask if two nodes have intersecting sets of ids, which allows\n * for a looser definition of \"matching\" than tradition id matching, and allows child nodes\n * to contribute to a parent nodes matching.\n *\n * @param {Element} oldContent the old content that will be morphed\n * @param {Element} newContent the new content to morph to\n * @returns {Map>} a map of nodes to id sets for the\n */\n function createIdMap(oldContent, newContent) {\n let idMap = new Map();\n populateIdMapForNode(oldContent, idMap);\n populateIdMapForNode(newContent, idMap);\n return idMap;\n }\n\n //=============================================================================\n // This is what ends up becoming the Idiomorph global object\n //=============================================================================\n return {\n morph,\n defaults\n }\n })();\n\nexport {Idiomorph};\n", "/**\n * Skipped minification because the original files appears to be already minified.\n * Original file: /npm/goober@2.1.14/dist/goober.modern.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\nlet e={data:\"\"},t=t=>\"object\"==typeof window?((t?t.querySelector(\"#_goober\"):window._goober)||Object.assign((t||document.head).appendChild(document.createElement(\"style\")),{innerHTML:\" \",id:\"_goober\"})).firstChild:t||e,a=e=>{let a=t(e),r=a.data;return a.data=\"\",r},r=/(?:([\\u0080-\\uFFFF\\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\\s*)/g,l=/\\/\\*[^]*?\\*\\/| +/g,s=/\\n+/g,n=(e,t)=>{let a=\"\",r=\"\",l=\"\";for(let s in e){let o=e[s];\"@\"==s[0]?\"i\"==s[1]?a=s+\" \"+o+\";\":r+=\"f\"==s[1]?n(o,s):s+\"{\"+n(o,\"k\"==s[1]?\"\":t)+\"}\":\"object\"==typeof o?r+=n(o,t?t.replace(/([^,])+/g,(e=>s.replace(/(^:.*)|([^,])+/g,(t=>/&/.test(t)?t.replace(/&/g,e):e?e+\" \"+t:t)))):s):null!=o&&(s=/^--/.test(s)?s:s.replace(/[A-Z]/g,\"-$&\").toLowerCase(),l+=n.p?n.p(s,o):s+\":\"+o+\";\")}return a+(t&&l?t+\"{\"+l+\"}\":l)+r},o={},c=e=>{if(\"object\"==typeof e){let t=\"\";for(let a in e)t+=a+c(e[a]);return t}return e},i=(e,t,a,i,p)=>{let u=c(e),d=o[u]||(o[u]=(e=>{let t=0,a=11;for(;t>>0;return\"go\"+a})(u));if(!o[d]){let t=u!==e?e:(e=>{let t,a,n=[{}];for(;t=r.exec(e.replace(l,\"\"));)t[4]?n.shift():t[3]?(a=t[3].replace(s,\" \").trim(),n.unshift(n[0][a]=n[0][a]||{})):n[0][t[1]]=t[2].replace(s,\" \").trim();return n[0]})(e);o[d]=n(p?{[\"@keyframes \"+d]:t}:t,a?\"\":\".\"+d)}let f=a&&o.g?o.g:null;return a&&(o.g=o[d]),((e,t,a,r)=>{r?t.data=t.data.replace(r,e):-1===t.data.indexOf(e)&&(t.data=a?e+t.data:t.data+e)})(o[d],t,i,f),d},p=(e,t,a)=>e.reduce(((e,r,l)=>{let s=t[l];if(s&&s.call){let e=s(a),t=e&&e.props&&e.props.className||/^go/.test(e)&&e;s=t?\".\"+t:e&&\"object\"==typeof e?e.props?\"\":n(e,\"\"):!1===e?\"\":e}return e+r+(null==s?\"\":s)}),\"\");function u(e){let a=this||{},r=e.call?e(a.p):e;return i(r.unshift?r.raw?p(r,[].slice.call(arguments,1),a.p):r.reduce(((e,t)=>Object.assign(e,t&&t.call?t(a.p):t)),{}):r,t(a.target),a.g,a.o,a.k)}let d,f,g,b=u.bind({g:1}),m=u.bind({k:1});function h(e,t,a,r){n.p=t,d=e,f=a,g=r}function y(e,t){let a=this||{};return function(){let r=arguments;function l(s,n){let o=Object.assign({},s),c=o.className||l.className;a.p=Object.assign({theme:f&&f()},o),a.o=/ *go\\d+/.test(c),o.className=u.apply(a,r)+(c?\" \"+c:\"\"),t&&(o.ref=n);let i=e;return e[0]&&(i=o.as||e,delete o.as),g&&i[0]&&g(o),d(i,o)}return t?t(l):l}}\nexport default { css:u, extractCss: a, glob: b, keyframes: m, setup: h, styled: y }\n", "// Exposes node building method, that gets node name, attrs and body.\n// n('span', {id: id}), n('.foo', {id: id}, body), n('.foo', {id: id}, [...])\n// * you can switch places for attrs and body, and body can be list of nodes\n// * n('.foo.bar') -> n('div', { class: 'foo bar' })\n//\n// copyright @dux, 2024\n// Licence MIT\n\nexport default function n(name, attrs = {}, data) {\n if (typeof attrs === 'string') {\n [attrs, data] = [data, attrs]\n attrs ||= {}\n }\n\n if (attrs instanceof Node) {\n data = attrs\n attrs = {}\n }\n\n if (Array.isArray(name)) {\n data = name\n name = 'div'\n }\n\n if (typeof attrs !== 'object' || Array.isArray(attrs)) {\n data = attrs\n attrs = {}\n }\n\n if (name.includes('.')) {\n const parts = name.split('.')\n name = parts.shift() || 'div'\n const c = parts.join(' ');\n if (attrs.class) {\n attrs.class += ` ${c}`;\n } else {\n attrs.class = c\n }\n }\n\n const node = document.createElement(name);\n\n for (const [k, v] of Object.entries(attrs)) {\n if (typeof v === 'function') {\n node[k] = v.bind(this)\n } else {\n const value = String(v).replaceAll('$$.', this.fezHtmlRoot);\n node.setAttribute(k, value)\n }\n }\n\n if (data) {\n if (Array.isArray(data)) {\n for (const n of data) {\n node.appendChild(n)\n }\n } else if (data instanceof Node) {\n node.appendChild(data)\n } else {\n node.innerHTML = String(data)\n }\n }\n\n return node\n}\n", "// templating\nimport renderStache from './lib/stache'\n\n// morph dom from one state to another\nimport { Idiomorph } from './lib/idiomorph'\n\n// runtime scss\nimport Gobber from './lib/gobber'\n\n// HTML node builder\nimport parseNode from './lib/n'\n\nclass FezBase {\n static __objects = []\n\n static find(node, name) {\n return Fez.find(node, name)\n }\n\n // get unique id from string\n static fnv1(str) {\n var FNV_OFFSET_BASIS, FNV_PRIME, hash, i, j, ref;\n FNV_OFFSET_BASIS = 2166136261;\n FNV_PRIME = 16777619;\n hash = FNV_OFFSET_BASIS;\n for (i = j = 0, ref = str.length - 1; (0 <= ref ? j <= ref : j >= ref); i = 0 <= ref ? ++j : --j) {\n hash ^= str.charCodeAt(i);\n hash *= FNV_PRIME;\n }\n return hash.toString(36).replaceAll('-', '');\n }\n\n // get node attributes as object\n static getProps(node) {\n const attrs = {}\n for (const attr of node.attributes) {\n attrs[attr.name] = attr.value\n }\n return attrs\n }\n\n static formData(node) {\n const formData = new FormData(node.closest('form'))\n const formObject = {}\n formData.forEach((value, key) => {\n formObject[key] = value\n });\n return formObject\n }\n\n static fastBind() {\n // return true to bind without requestAnimationFrame\n // you can do this if you are sure you are not expecting innerHTML data\n return false\n }\n\n // instance methods\n\n constructor() {\n this.__int = {}\n }\n\n n = parseNode\n\n // string selector for use in HTML nodes\n get fezHtmlRoot() {\n return `Fez.find(this, \"${this.fezName}\").`\n }\n\n // checks if node is attached and clears all if not\n get isAttached() {\n if (this.root?.parentNode) {\n return true\n } else {\n Object.keys(this.__int).forEach((key)=> {\n clearInterval(this.__int[key])\n })\n this.root.fez = null\n this.root = null\n return false\n }\n }\n\n // get single node property\n prop(name) {\n let v = this.oldRoot[name] || this.props[name]\n if (typeof v == 'function') {\n // if @prop('onclick'), we want \"this\" to point to this.root (dom node)\n v = v.bind(this.root)\n }\n return v\n }\n\n // copy attributes to root node\n copy() {\n for (const name of Array.from(arguments)) {\n let value = this.props[name]\n\n if (value !== undefined) {\n if (name == 'class') {\n const klass = this.root.getAttribute(name, value)\n\n if (klass) {\n value = [klass, value].join(' ')\n }\n }\n\n if (typeof value == 'string') {\n this.root.setAttribute(name, value)\n } else {\n this.root[name] = value\n }\n }\n }\n }\n\n // copy child nodes, natively to preserve bound events\n // if node name is SLOT insert adjacent and remove SLOT, else as a child nodes\n slot(source, target) {\n target ||= document.createElement('template')\n const isSlot = target.nodeName == 'SLOT'\n\n while (source.firstChild) {\n if (isSlot) {\n target.parentNode.insertBefore(source.lastChild, target.nextSibling);\n } else {\n target.appendChild(source.firstChild)\n }\n }\n\n if (isSlot) {\n target.parentNode.removeChild(target)\n } else {\n source.innerHTML = ''\n }\n\n return target\n }\n\n style() { console.error('call Fez static style') }\n\n connect() {\n console.error('Fez is missing \"connect\" method.', this.root)\n }\n\n parseHtml(text, context) {\n if (typeof text == 'object') {\n text = text[0]\n }\n\n text = text.replaceAll('$$.', this.fezHtmlRoot.replaceAll('\"', '"'))\n\n if (text.includes('{{')) {\n try {\n const func = renderStache(text, this)\n text = func()// .replace(/\\n\\s*\\n/g, \"\\n\")\n } catch(error) {\n console.error(`Fez stache template error in \"${this.fezName}\"`, error)\n }\n }\n\n return text\n }\n\n // inject htmlString as innerHTML and replace $$. with local pointer\n // $$. will point to current fez instance\n // will be replaced with current root\n // this.html('...loading')\n // this.html('.images', '...loading')\n html(target, body) {\n if (!target) {\n target = this.class.html\n }\n\n if (typeof body == 'undefined') {\n body = target\n target = this.root\n }\n\n if (typeof target == 'string') {\n target = this.find(target)\n }\n\n const newNode = document.createElement('div')\n\n if (typeof body === 'function') {\n // this.class.html will be converted to function, and all sequential calls will use function call\n // this feature is not available on this.html(...)\n body = body()\n }\n\n if (Array.isArray(body)) {\n if (body[0] instanceof Node) {\n body.forEach((n)=>{\n newNode.appendChild(n)\n })\n } else {\n body = body.join('')\n }\n } else if (typeof body === 'string') {\n newNode.innerHTML = this.parseHtml(body)\n } else {\n newNode.appendChild(body)\n }\n\n const slot = newNode.querySelector('slot')\n if (slot) {\n this.slot(target, slot)\n }\n\n // old way, just replace\n // target.innerHTML = ''\n // this.slot(newNode, target)\n\n Fez.morphdom(target, newNode)\n\n const fetchAttr = (name, func) => {\n target.querySelectorAll(`*[${name}]`).forEach((n)=>{\n let value = n.getAttribute(name)\n n.removeAttribute(name)\n if (value) {\n func.bind(this)(value, n)\n }\n })\n }\n\n fetchAttr('fez-this', (value, n) => {\n this[value] = n\n })\n\n fetchAttr('fez-use', (value, n) => {\n const target = this[value]\n if (typeof target == 'function') {\n target(n)\n } else {\n console.error(`Fez error: \"${value}\" is not a function in ${this.fezName}`)\n }\n })\n\n fetchAttr('fez-class', (value) => {\n let classes = value.split(/\\s+/)\n let lastClass = classes.pop()\n classes.forEach((c)=> n.classList.add(c) )\n if (lastClass) {\n setTimeout(()=>{\n n.classList.add(lastClass)\n }, 1000)\n }\n })\n }\n\n // run only if node is attached, clear otherwise\n setInterval(func, tick, name) {\n if (typeof func == 'number') {\n [tick, func] = [func, tick]\n }\n\n name ||= this.class.fnv1(String(func))\n\n clearInterval(this.__int[name])\n\n this.__int[name] = setInterval(() => {\n if (this.isAttached) {\n func()\n }\n }, tick)\n\n return this.__int[name]\n }\n\n // add css class for scss styled text\n css(text, isGlobal) {\n const className = Fez.css(text)\n\n if (isGlobal) {\n this.root.classList.add(className)\n }\n\n return className\n }\n\n find(selector) {\n return this.root.querySelector(selector)\n }\n\n val(selector, data) {\n const node = this.find('.time')\n\n if (['INPUT', 'TEXTAREA', 'SELECT'].includes(node.nodeName)) {\n node.value = data\n } else {\n node.innerHTML = new Date()\n }\n }\n\n formData(node) {\n return this.class.formData(node || this.root)\n }\n\n // get or set attribute\n attr(name, value) {\n if (typeof value === 'undefined') {\n return this.root.getAttribute(name)\n } else {\n this.root.setAttribute(name, value)\n return value\n }\n }\n\n // get root node child nodes as array\n childNodes(func) {\n const list = Array.from(this.root.querySelectorAll(\":scope > *\"))\n\n if (func) {\n list.forEach(func)\n } else {\n return list\n }\n }\n\n subscribe(channel, func) {\n Fez._subs ||= {}\n Fez._subs[channel] ||= []\n Fez._subs[channel] = Fez._subs[channel].filter((el) => el[0].isAttached)\n Fez._subs[channel].push([this, func])\n }\n\n fezRegister() {\n if (this.class.css) {\n if (typeof this.class.css == 'function') {\n this.class.css = this.class.css(this)\n }\n\n if (this.class.css.includes(':')) {\n this.class.css = Fez.css(this.class.css)\n }\n this.root.classList.add(this.class.css)\n }\n\n this.fezRegisterBindMethods()\n }\n\n // bind all instance method to this, to avoid calling with .bind(this)\n fezRegisterBindMethods() {\n const methods = Object.getOwnPropertyNames(Object.getPrototypeOf(this))\n .filter(method => method !== 'constructor' && typeof this[method] === 'function')\n\n methods.forEach(method => this[method] = this[method].bind(this))\n }\n}\n\n// clear all unnatached nodes\nsetInterval(() => {\n FezBase.__objects = FezBase.__objects.filter(\n (el) => el.isAttached\n )\n}, 10_000)\n\n//\n\nconst observer = new MutationObserver((mutationsList, _) => {\n for (const mutation of mutationsList) {\n if (mutation.type === 'attributes') {\n const fez = mutation.target.fez\n const name = mutation.attributeName\n const value = mutation.target.getAttribute(name)\n fez.props[name] = value\n fez.onPropsChange(name, value)\n // console.log(`The [${name}] attribute was modified to [${value}].`);\n }\n }\n});\n\nconst Fez = (name, klass) => {\n function connect() {\n const parentNode = this.parentNode\n if (parentNode) {\n const nodeName = typeof klass.nodeName == 'function' ? klass.nodeName(this) : klass.nodeName\n const newNode = document.createElement(nodeName || 'div')\n\n newNode.classList.add('fez')\n newNode.classList.add(`fez-${name}`)\n\n parentNode.replaceChild(newNode, this);\n\n const object = new klass()\n object.oldRoot = this\n object.fezName = name\n object.root = newNode\n object.props = klass.getProps(this)\n object.class = klass\n\n // copy child nodes, natively to preserve bound events\n object.slot(this, newNode)\n\n newNode.fez = object\n\n if (window.$) {\n object.$root = $(newNode)\n }\n\n if (object.props.id) {\n newNode.setAttribute('id', object.props.id)\n }\n\n object.fezRegister()\n object.connect(object.props)\n klass.__objects.push(object)\n\n if (klass.html) {\n if (typeof klass.html == 'function') {\n klass.html = klass.html(this)\n }\n klass.html = renderStache(klass.html, object)\n object.html()\n }\n\n if (object.onPropsChange) {\n observer.observe(newNode, {attributes:true})\n }\n }\n }\n\n function forceFastRender(n) {\n return typeof klass.fastBind === 'function' ? klass.fastBind(n) : klass.fastBind\n }\n\n if (!name) {\n return FezBase\n }\n\n if (typeof klass != 'function') {\n return Fez.find(name, klass)\n }\n\n customElements.define(name, class extends HTMLElement {\n connectedCallback() {\n // when we render nested fez components, and under Svelte, sometimes node innerHTML is empty, but it should not be\n // in that case, we need to wait for another tick to get content\n // this solution looks like it is not efficient, because it slow renders fez components that do not have and are not intended to have body, but by testing this looks like it is not effecting render performance\n // if you want to force fast render, add static fastBind = true or check\n if (this.firstChild || forceFastRender(this)) {\n Fez.info(`fast bind: ${name}`)\n connect.bind(this)()\n } else {\n Fez.info(`slow bind: ${name}`)\n window.requestAnimationFrame(()=>{\n connect.bind(this)()\n })\n }\n }\n })\n}\n\nFez.find = (node, name) => {\n if (typeof node == 'string') {\n node = document.body.querySelector(node)\n }\n\n if (typeof node.val == 'function') {\n node = node[0]\n }\n\n const klass = name ? `.fez-${name}` : '.fez'\n\n return node.closest(klass).fez\n}\n\nFez.globalCss = (text) => {\n const cssClass = Fez.css(text)\n document.addEventListener(\"DOMContentLoaded\", () => {\n document.body.classList.add(cssClass)\n })\n return cssClass\n}\n\nFez.css = (text) => {\n return Gobber.css(text)\n}\n\nFez.info = (text) => {\n if (window.DEBUG) {\n console.log(`Fez: ${text}`)\n }\n}\n\nFez.morphdom = (target, newNode, opts = {}) => {\n if (opts.childrenOnly === undefined) {\n opts.childrenOnly = true\n }\n\n // Morphdom(target, newNode, opts)\n Idiomorph.morph(target, newNode, { morphStyle: 'innerHTML'})\n}\n\nFez.htmlEscape = (text) => {\n return text\n .replaceAll(\"'\", ''')\n .replaceAll('\"', '"')\n .replaceAll('<', '<')\n .replaceAll('>', '>')\n}\n\nFez.publish = (channel, ...args) => {\n Fez._subs[channel] ||= []\n Fez._subs[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AAS,iBAAiB,mBAAoB,IAAM,CAClD,SAAS,KAAK,UAAU,IAAI+B,CAAQ,CACtC,CAAC,EACMA,CACT,EAEAnD,EAAI,IAAOoB,GACFgC,EAAO,IAAIhC,CAAI,EAGxBpB,EAAI,KAAQoB,GAAS,CACf,OAAO,OACT,QAAQ,IAAI,QAAQA,CAAI,EAAE,CAE9B,EAEApB,EAAI,SAAW,CAACkB,EAAQO,EAAS4B,EAAO,CAAC,IAAM,CACzCA,EAAK,eAAiB,SACxBA,EAAK,aAAe,IAItBC,EAAU,MAAMpC,EAAQO,EAAS,CAAE,WAAY,WAAW,CAAC,CAC7D,EAEAzB,EAAI,WAAcoB,GACTA,EACJ,WAAW,IAAK,QAAQ,EACxB,WAAW,IAAK,QAAQ,EACxB,WAAW,IAAK,MAAM,EACtB,WAAW,IAAK,MAAM,EAG3BpB,EAAI,QAAU,CAACsC,KAAYiB,IAAS,CAClCvD,EAAI,MAAMsC,CAAO,IAAM,CAAC,EACxBtC,EAAI,MAAMsC,CAAO,EAAE,QAASC,GAAO,CACjCA,EAAG,CAAC,EAAE,KAAKA,EAAG,CAAC,CAAC,EAAE,GAAGgB,CAAI,CAC3B,CAAC,CACH,EAEA,OAAO,IAAMvD,EACb,OAAO,QAAUH", - "names": ["renderStache", "tpl", "context", "NEW_LINES_RE", "TEMPLATE_RE", "EACH_RE", "IF_RE", "ELSE_IF_RE", "stache", "source", "monkey", "t", "func", "all", "code", "parts", "list", "loop", "conditional", "conditionalElse", "codeParts", "createTemplate", "strings", "values", "acc", "str", "i", "closeCustomTags", "html", "selfClosingTags", "match", "tagName", "attributes", "Idiomorph", "EMPTY_SET", "defaults", "noOp", "elt", "morph", "oldNode", "newContent", "config", "parseContent", "normalizedContent", "normalizeContent", "ctx", "createMorphContext", "morphNormalizedContent", "normalizedNewContent", "oldHead", "newHead", "promises", "handleHeadElement", "morphChildren", "bestMatch", "findBestNodeMatch", "previousSibling", "nextSibling", "morphedNode", "morphOldNodeTo", "insertSiblings", "ignoreValueOfActiveElement", "possibleActiveElement", "isSoftMatch", "syncNodeFrom", "newParent", "oldParent", "nextNewChild", "insertionPoint", "newChild", "removeIdsFromConsideration", "isIdSetMatch", "idSetMatch", "findIdSetMatch", "removeNodesBetween", "softMatch", "findSoftMatch", "tempNode", "removeNode", "ignoreAttribute", "attr", "to", "updateType", "from", "type", "fromAttributes", "toAttributes", "fromAttribute", "i", "toAttribute", "syncInputValue", "syncBooleanAttribute", "attributeName", "ignoreUpdate", "fromValue", "toValue", "newHeadTag", "currentHead", "added", "removed", "preserved", "nodesToAppend", "headMergeStyle", "srcToNewHeadNodes", "newHeadChild", "currentHeadElt", "inNewContent", "isReAppended", "isPreserved", "newNode", "newElt", "resolve", "promise", "_resolve", "removedElement", "log", "mergeDefaults", "finalConfig", "createIdMap", "node1", "node2", "getIdIntersectionCount", "startInclusive", "endExclusive", "newChildPotentialIdCount", "potentialMatch", "otherMatchCount", "potentialSoftMatch", "siblingSoftMatchCount", "parser", "contentWithSvgsRemoved", "content", "htmlElement", "dummyParent", "stack", "node", "currentElement", "bestElement", "score", "newScore", "scoreElement", "isIdInConsideration", "id", "idIsWithinNode", "targetNode", "idSet", "sourceSet", "matchCount", "populateIdMapForNode", "idMap", "nodeParent", "idElements", "current", "oldContent", "e", "t", "a", "r", "l", "s", "n", "o", "c", "i", "u", "d", "f", "p", "g", "b", "m", "h", "y", "gobber_default", "n", "name", "attrs", "data", "parts", "c", "node", "k", "v", "value", "FezBase", "node", "name", "Fez", "str", "FNV_OFFSET_BASIS", "FNV_PRIME", "hash", "i", "j", "ref", "attrs", "attr", "formData", "formObject", "value", "key", "n", "v", "klass", "source", "target", "isSlot", "text", "context", "renderStache", "error", "body", "newNode", "slot", "fetchAttr", "func", "classes", "lastClass", "c", "tick", "isGlobal", "className", "selector", "data", "list", "channel", "el", "method", "observer", "mutationsList", "_", "mutation", "fez", "connect", "parentNode", "nodeName", "object", "forceFastRender", "cssClass", "gobber_default", "opts", "Idiomorph", "args"] + "sourcesContent": ["// https://github.com/ryanmorr/stache\nexport default function renderStache(tpl, context) {\n const NEW_LINES_RE = /(\\r\\n|\\r|\\n)/g;\n const TEMPLATE_RE = /{{\\s*(.+?)\\s*}}/g;\n const EACH_RE = /^each\\s+(.*)\\s+as\\s+(.*)$/;\n const IF_RE = /^if\\s+(.*)$/;\n const ELSE_IF_RE = /^else if\\s+(.*)$/;\n\n function stache(source) {\n const monkey = (t) => t.replaceAll('@', 'this.')\n\n let func = `\n let _strings = [], _sequence = [], _values = [];\n\n function htmlEscape(text) {\n if (typeof text === 'string') {\n return text\n .replaceAll(\"'\", ''')\n .replaceAll('\"', '"')\n .replaceAll('<', '<')\n .replaceAll('>', '>')\n } else {\n return text\n }\n }\n\n _sequence.push('${\n source.trim().replace(NEW_LINES_RE, '\\\\n').replace(TEMPLATE_RE, (all, code) => {\n // {{#if -> {{#if\n code = code.replace(/^[#:]/, '')\n\n if (code.startsWith('each') || code.startsWith('for')) {\n // support fro #for\n const parts = code.split(/\\s+/)\n if (parts.shift() === 'for') {\n const list = parts.pop()\n parts.pop()\n code = `each ${list} as ${parts.join(' ')}`\n }\n\n let loop = EACH_RE.exec(code);\n if (loop) {\n loop[1] = monkey(loop[1])\n return `');\\n (!Array.isArray(${loop[1]}) ? Array.from(Object.entries(${loop[1]} || []), ([key, value]) => [key, value]) : ${loop[1]}).forEach((${loop[2]}) => { _sequence.push('`\n }\n } else if (code.startsWith('if')) {\n let conditional = (IF_RE).exec(code);\n if (conditional) {\n conditional[1] = monkey(conditional[1])\n return `');\\n if (${conditional[1]}) { _sequence.push('`\n }\n } else if (code.startsWith('else if')) {\n let conditionalElse = (ELSE_IF_RE).exec(code);\n if (conditionalElse) {\n conditionalElse[1] = monkey(conditionalElse[1])\n return `');\\n } else if (${conditionalElse[1]}) { _sequence.push('`\n }\n } else if (code === 'else') {\n return `');\\n } else { _sequence.push('` // eslint-disable-line quotes\n } else if (code === '/each' || code === '/for') {\n return `');\\n }); _sequence.push('` // eslint-disable-line quotes\n } else if (code === '/if') {\n return `');\\n } _sequence.push('` // eslint-disable-line quotes\n }\n\n // support for @html -> {{@html raw}} -> same as in svelte\n const codeParts = code.split(/^\\@html\\s+/)\n if (codeParts[1]) {\n code = monkey(codeParts[1])\n } else {\n code = `htmlEscape(${monkey(code)})`\n }\n\n return `');\\n _strings.push(_sequence.join(''));\\n _sequence = [];\\n _values.push(${code});\\n _sequence.push('`;\n })\n }');\n _strings.push(_sequence.join(''));\n return [_strings, _values];\n `\n\n return new Function('_data', func);\n }\n\n function createTemplate(source) {\n const tpl = stache(source);\n return () => {\n const [strings, values] = tpl.bind(context)();\n return strings.reduce((acc, str, i) => acc + (values[i - 1]) + str);\n };\n }\n\n function closeCustomTags(html) {\n const selfClosingTags = new Set([\n 'area', 'base', 'br', 'col', 'embed', 'hr', 'img', 'input', 'link', 'meta', 'source', 'track', 'wbr'\n ])\n\n return html.replace(/<([a-z-]+)\\b([^>]*)\\/>/g, (match, tagName, attributes) => {\n return selfClosingTags.has(tagName) ? match : `<${tagName}${attributes}>`\n })\n }\n\n tpl = closeCustomTags(tpl)\n return createTemplate(tpl)\n}\n", "// base IIFE to define idiomorph\nvar Idiomorph = (function () {\n 'use strict';\n\n //=============================================================================\n // AND NOW IT BEGINS...\n //=============================================================================\n let EMPTY_SET = new Set();\n\n // default configuration values, updatable by users now\n let defaults = {\n morphStyle: \"outerHTML\",\n callbacks : {\n beforeNodeAdded: noOp,\n afterNodeAdded: noOp,\n beforeNodeMorphed: noOp,\n afterNodeMorphed: noOp,\n beforeNodeRemoved: noOp,\n afterNodeRemoved: noOp,\n beforeAttributeUpdated: noOp,\n\n },\n head: {\n style: 'merge',\n shouldPreserve: function (elt) {\n return elt.getAttribute(\"im-preserve\") === \"true\";\n },\n shouldReAppend: function (elt) {\n return elt.getAttribute(\"im-re-append\") === \"true\";\n },\n shouldRemove: noOp,\n afterHeadMorphed: noOp,\n }\n };\n\n //=============================================================================\n // Core Morphing Algorithm - morph, morphNormalizedContent, morphOldNodeTo, morphChildren\n //=============================================================================\n function morph(oldNode, newContent, config = {}) {\n\n if (oldNode instanceof Document) {\n oldNode = oldNode.documentElement;\n }\n\n if (typeof newContent === 'string') {\n newContent = parseContent(newContent);\n }\n\n let normalizedContent = normalizeContent(newContent);\n\n let ctx = createMorphContext(oldNode, normalizedContent, config);\n\n return morphNormalizedContent(oldNode, normalizedContent, ctx);\n }\n\n function morphNormalizedContent(oldNode, normalizedNewContent, ctx) {\n if (ctx.head.block) {\n let oldHead = oldNode.querySelector('head');\n let newHead = normalizedNewContent.querySelector('head');\n if (oldHead && newHead) {\n let promises = handleHeadElement(newHead, oldHead, ctx);\n // when head promises resolve, call morph again, ignoring the head tag\n Promise.all(promises).then(function () {\n morphNormalizedContent(oldNode, normalizedNewContent, Object.assign(ctx, {\n head: {\n block: false,\n ignore: true\n }\n }));\n });\n return;\n }\n }\n\n if (ctx.morphStyle === \"innerHTML\") {\n\n // innerHTML, so we are only updating the children\n morphChildren(normalizedNewContent, oldNode, ctx);\n return oldNode.children;\n\n } else if (ctx.morphStyle === \"outerHTML\" || ctx.morphStyle == null) {\n // otherwise find the best element match in the new content, morph that, and merge its siblings\n // into either side of the best match\n let bestMatch = findBestNodeMatch(normalizedNewContent, oldNode, ctx);\n\n // stash the siblings that will need to be inserted on either side of the best match\n let previousSibling = bestMatch?.previousSibling;\n let nextSibling = bestMatch?.nextSibling;\n\n // morph it\n let morphedNode = morphOldNodeTo(oldNode, bestMatch, ctx);\n\n if (bestMatch) {\n // if there was a best match, merge the siblings in too and return the\n // whole bunch\n return insertSiblings(previousSibling, morphedNode, nextSibling);\n } else {\n // otherwise nothing was added to the DOM\n return []\n }\n } else {\n throw \"Do not understand how to morph style \" + ctx.morphStyle;\n }\n }\n\n\n /**\n * @param possibleActiveElement\n * @param ctx\n * @returns {boolean}\n */\n function ignoreValueOfActiveElement(possibleActiveElement, ctx) {\n return ctx.ignoreActiveValue && possibleActiveElement === document.activeElement && possibleActiveElement !== document.body;\n }\n\n /**\n * @param oldNode root node to merge content into\n * @param newContent new content to merge\n * @param ctx the merge context\n * @returns {Element} the element that ended up in the DOM\n */\n function morphOldNodeTo(oldNode, newContent, ctx) {\n if (ctx.ignoreActive && oldNode === document.activeElement) {\n // don't morph focused element\n } else if (newContent == null) {\n if (ctx.callbacks.beforeNodeRemoved(oldNode) === false) return oldNode;\n\n oldNode.remove();\n ctx.callbacks.afterNodeRemoved(oldNode);\n return null;\n } else if (!isSoftMatch(oldNode, newContent)) {\n if (ctx.callbacks.beforeNodeRemoved(oldNode) === false) return oldNode;\n if (ctx.callbacks.beforeNodeAdded(newContent) === false) return oldNode;\n\n oldNode.parentElement.replaceChild(newContent, oldNode);\n ctx.callbacks.afterNodeAdded(newContent);\n ctx.callbacks.afterNodeRemoved(oldNode);\n return newContent;\n } else {\n if (ctx.callbacks.beforeNodeMorphed(oldNode, newContent) === false) return oldNode;\n\n if (oldNode instanceof HTMLHeadElement && ctx.head.ignore) {\n // ignore the head element\n } else if (oldNode instanceof HTMLHeadElement && ctx.head.style !== \"morph\") {\n handleHeadElement(newContent, oldNode, ctx);\n } else {\n syncNodeFrom(newContent, oldNode, ctx);\n if (!ignoreValueOfActiveElement(oldNode, ctx)) {\n morphChildren(newContent, oldNode, ctx);\n }\n }\n ctx.callbacks.afterNodeMorphed(oldNode, newContent);\n return oldNode;\n }\n }\n\n /**\n * This is the core algorithm for matching up children. The idea is to use id sets to try to match up\n * nodes as faithfully as possible. We greedily match, which allows us to keep the algorithm fast, but\n * by using id sets, we are able to better match up with content deeper in the DOM.\n *\n * Basic algorithm is, for each node in the new content:\n *\n * - if we have reached the end of the old parent, append the new content\n * - if the new content has an id set match with the current insertion point, morph\n * - search for an id set match\n * - if id set match found, morph\n * - otherwise search for a \"soft\" match\n * - if a soft match is found, morph\n * - otherwise, prepend the new node before the current insertion point\n *\n * The two search algorithms terminate if competing node matches appear to outweigh what can be achieved\n * with the current node. See findIdSetMatch() and findSoftMatch() for details.\n *\n * @param {Element} newParent the parent element of the new content\n * @param {Element } oldParent the old content that we are merging the new content into\n * @param ctx the merge context\n */\n function morphChildren(newParent, oldParent, ctx) {\n\n let nextNewChild = newParent.firstChild;\n let insertionPoint = oldParent.firstChild;\n let newChild;\n\n // run through all the new content\n while (nextNewChild) {\n\n newChild = nextNewChild;\n nextNewChild = newChild.nextSibling;\n\n // if we are at the end of the exiting parent's children, just append\n if (insertionPoint == null) {\n if (ctx.callbacks.beforeNodeAdded(newChild) === false) return;\n\n oldParent.appendChild(newChild);\n ctx.callbacks.afterNodeAdded(newChild);\n removeIdsFromConsideration(ctx, newChild);\n continue;\n }\n\n // if the current node has an id set match then morph\n if (isIdSetMatch(newChild, insertionPoint, ctx)) {\n morphOldNodeTo(insertionPoint, newChild, ctx);\n insertionPoint = insertionPoint.nextSibling;\n removeIdsFromConsideration(ctx, newChild);\n continue;\n }\n\n // otherwise search forward in the existing old children for an id set match\n let idSetMatch = findIdSetMatch(newParent, oldParent, newChild, insertionPoint, ctx);\n\n // if we found a potential match, remove the nodes until that point and morph\n if (idSetMatch) {\n insertionPoint = removeNodesBetween(insertionPoint, idSetMatch, ctx);\n morphOldNodeTo(idSetMatch, newChild, ctx);\n removeIdsFromConsideration(ctx, newChild);\n continue;\n }\n\n // no id set match found, so scan forward for a soft match for the current node\n let softMatch = findSoftMatch(newParent, oldParent, newChild, insertionPoint, ctx);\n\n // if we found a soft match for the current node, morph\n if (softMatch) {\n insertionPoint = removeNodesBetween(insertionPoint, softMatch, ctx);\n morphOldNodeTo(softMatch, newChild, ctx);\n removeIdsFromConsideration(ctx, newChild);\n continue;\n }\n\n // abandon all hope of morphing, just insert the new child before the insertion point\n // and move on\n if (ctx.callbacks.beforeNodeAdded(newChild) === false) return;\n\n oldParent.insertBefore(newChild, insertionPoint);\n ctx.callbacks.afterNodeAdded(newChild);\n removeIdsFromConsideration(ctx, newChild);\n }\n\n // remove any remaining old nodes that didn't match up with new content\n while (insertionPoint !== null) {\n\n let tempNode = insertionPoint;\n insertionPoint = insertionPoint.nextSibling;\n removeNode(tempNode, ctx);\n }\n }\n\n //=============================================================================\n // Attribute Syncing Code\n //=============================================================================\n\n /**\n * @param attr {String} the attribute to be mutated\n * @param to {Element} the element that is going to be updated\n * @param updateType {(\"update\"|\"remove\")}\n * @param ctx the merge context\n * @returns {boolean} true if the attribute should be ignored, false otherwise\n */\n function ignoreAttribute(attr, to, updateType, ctx) {\n if(attr === 'value' && ctx.ignoreActiveValue && to === document.activeElement){\n return true;\n }\n return ctx.callbacks.beforeAttributeUpdated(attr, to, updateType) === false;\n }\n\n /**\n * syncs a given node with another node, copying over all attributes and\n * inner element state from the 'from' node to the 'to' node\n *\n * @param {Element} from the element to copy attributes & state from\n * @param {Element} to the element to copy attributes & state to\n * @param ctx the merge context\n */\n function syncNodeFrom(from, to, ctx) {\n let type = from.nodeType\n\n // if is an element type, sync the attributes from the\n // new node into the new node\n if (type === 1 /* element type */) {\n const fromAttributes = from.attributes;\n const toAttributes = to.attributes;\n for (const fromAttribute of fromAttributes) {\n if (ignoreAttribute(fromAttribute.name, to, 'update', ctx)) {\n continue;\n }\n if (to.getAttribute(fromAttribute.name) !== fromAttribute.value) {\n to.setAttribute(fromAttribute.name, fromAttribute.value);\n }\n }\n // iterate backwards to avoid skipping over items when a delete occurs\n for (let i = toAttributes.length - 1; 0 <= i; i--) {\n const toAttribute = toAttributes[i];\n if (ignoreAttribute(toAttribute.name, to, 'remove', ctx)) {\n continue;\n }\n if (!from.hasAttribute(toAttribute.name)) {\n to.removeAttribute(toAttribute.name);\n }\n }\n }\n\n // sync text nodes\n if (type === 8 /* comment */ || type === 3 /* text */) {\n if (to.nodeValue !== from.nodeValue) {\n to.nodeValue = from.nodeValue;\n }\n }\n\n if (!ignoreValueOfActiveElement(to, ctx)) {\n // sync input values\n syncInputValue(from, to, ctx);\n }\n }\n\n /**\n * @param from {Element} element to sync the value from\n * @param to {Element} element to sync the value to\n * @param attributeName {String} the attribute name\n * @param ctx the merge context\n */\n function syncBooleanAttribute(from, to, attributeName, ctx) {\n if (from[attributeName] !== to[attributeName]) {\n let ignoreUpdate = ignoreAttribute(attributeName, to, 'update', ctx);\n if (!ignoreUpdate) {\n to[attributeName] = from[attributeName];\n }\n if (from[attributeName]) {\n if (!ignoreUpdate) {\n to.setAttribute(attributeName, from[attributeName]);\n }\n } else {\n if (!ignoreAttribute(attributeName, to, 'remove', ctx)) {\n to.removeAttribute(attributeName);\n }\n }\n }\n }\n\n /**\n * NB: many bothans died to bring us information:\n *\n * https://github.com/patrick-steele-idem/morphdom/blob/master/src/specialElHandlers.js\n * https://github.com/choojs/nanomorph/blob/master/lib/morph.jsL113\n *\n * @param from {Element} the element to sync the input value from\n * @param to {Element} the element to sync the input value to\n * @param ctx the merge context\n */\n function syncInputValue(from, to, ctx) {\n if (from instanceof HTMLInputElement &&\n to instanceof HTMLInputElement &&\n from.type !== 'file') {\n\n let fromValue = from.value;\n let toValue = to.value;\n\n // sync boolean attributes\n syncBooleanAttribute(from, to, 'checked', ctx);\n syncBooleanAttribute(from, to, 'disabled', ctx);\n\n if (!from.hasAttribute('value')) {\n if (!ignoreAttribute('value', to, 'remove', ctx)) {\n to.value = '';\n to.removeAttribute('value');\n }\n } else if (fromValue !== toValue) {\n if (!ignoreAttribute('value', to, 'update', ctx)) {\n to.setAttribute('value', fromValue);\n to.value = fromValue;\n }\n }\n } else if (from instanceof HTMLOptionElement) {\n syncBooleanAttribute(from, to, 'selected', ctx)\n } else if (from instanceof HTMLTextAreaElement && to instanceof HTMLTextAreaElement) {\n let fromValue = from.value;\n let toValue = to.value;\n if (ignoreAttribute('value', to, 'update', ctx)) {\n return;\n }\n if (fromValue !== toValue) {\n to.value = fromValue;\n }\n if (to.firstChild && to.firstChild.nodeValue !== fromValue) {\n to.firstChild.nodeValue = fromValue\n }\n }\n }\n\n //=============================================================================\n // the HEAD tag can be handled specially, either w/ a 'merge' or 'append' style\n //=============================================================================\n function handleHeadElement(newHeadTag, currentHead, ctx) {\n\n let added = []\n let removed = []\n let preserved = []\n let nodesToAppend = []\n\n let headMergeStyle = ctx.head.style;\n\n // put all new head elements into a Map, by their outerHTML\n let srcToNewHeadNodes = new Map();\n for (const newHeadChild of newHeadTag.children) {\n srcToNewHeadNodes.set(newHeadChild.outerHTML, newHeadChild);\n }\n\n // for each elt in the current head\n for (const currentHeadElt of currentHead.children) {\n\n // If the current head element is in the map\n let inNewContent = srcToNewHeadNodes.has(currentHeadElt.outerHTML);\n let isReAppended = ctx.head.shouldReAppend(currentHeadElt);\n let isPreserved = ctx.head.shouldPreserve(currentHeadElt);\n if (inNewContent || isPreserved) {\n if (isReAppended) {\n // remove the current version and let the new version replace it and re-execute\n removed.push(currentHeadElt);\n } else {\n // this element already exists and should not be re-appended, so remove it from\n // the new content map, preserving it in the DOM\n srcToNewHeadNodes.delete(currentHeadElt.outerHTML);\n preserved.push(currentHeadElt);\n }\n } else {\n if (headMergeStyle === \"append\") {\n // we are appending and this existing element is not new content\n // so if and only if it is marked for re-append do we do anything\n if (isReAppended) {\n removed.push(currentHeadElt);\n nodesToAppend.push(currentHeadElt);\n }\n } else {\n // if this is a merge, we remove this content since it is not in the new head\n if (ctx.head.shouldRemove(currentHeadElt) !== false) {\n removed.push(currentHeadElt);\n }\n }\n }\n }\n\n // Push the remaining new head elements in the Map into the\n // nodes to append to the head tag\n nodesToAppend.push(...srcToNewHeadNodes.values());\n log(\"to append: \", nodesToAppend);\n\n let promises = [];\n for (const newNode of nodesToAppend) {\n log(\"adding: \", newNode);\n let newElt = document.createRange().createContextualFragment(newNode.outerHTML).firstChild;\n log(newElt);\n if (ctx.callbacks.beforeNodeAdded(newElt) !== false) {\n if (newElt.href || newElt.src) {\n let resolve = null;\n let promise = new Promise(function (_resolve) {\n resolve = _resolve;\n });\n newElt.addEventListener('load', function () {\n resolve();\n });\n promises.push(promise);\n }\n currentHead.appendChild(newElt);\n ctx.callbacks.afterNodeAdded(newElt);\n added.push(newElt);\n }\n }\n\n // remove all removed elements, after we have appended the new elements to avoid\n // additional network requests for things like style sheets\n for (const removedElement of removed) {\n if (ctx.callbacks.beforeNodeRemoved(removedElement) !== false) {\n currentHead.removeChild(removedElement);\n ctx.callbacks.afterNodeRemoved(removedElement);\n }\n }\n\n ctx.head.afterHeadMorphed(currentHead, {added: added, kept: preserved, removed: removed});\n return promises;\n }\n\n //=============================================================================\n // Misc\n //=============================================================================\n\n function log() {\n //console.log(arguments);\n }\n\n function noOp() {\n }\n\n /*\n Deep merges the config object and the Idiomoroph.defaults object to\n produce a final configuration object\n */\n function mergeDefaults(config) {\n let finalConfig = {};\n // copy top level stuff into final config\n Object.assign(finalConfig, defaults);\n Object.assign(finalConfig, config);\n\n // copy callbacks into final config (do this to deep merge the callbacks)\n finalConfig.callbacks = {};\n Object.assign(finalConfig.callbacks, defaults.callbacks);\n Object.assign(finalConfig.callbacks, config.callbacks);\n\n // copy head config into final config (do this to deep merge the head)\n finalConfig.head = {};\n Object.assign(finalConfig.head, defaults.head);\n Object.assign(finalConfig.head, config.head);\n return finalConfig;\n }\n\n function createMorphContext(oldNode, newContent, config) {\n config = mergeDefaults(config);\n return {\n target: oldNode,\n newContent: newContent,\n config: config,\n morphStyle: config.morphStyle,\n ignoreActive: config.ignoreActive,\n ignoreActiveValue: config.ignoreActiveValue,\n idMap: createIdMap(oldNode, newContent),\n deadIds: new Set(),\n callbacks: config.callbacks,\n head: config.head\n }\n }\n\n function isIdSetMatch(node1, node2, ctx) {\n if (node1 == null || node2 == null) {\n return false;\n }\n if (node1.nodeType === node2.nodeType && node1.tagName === node2.tagName) {\n if (node1.id !== \"\" && node1.id === node2.id) {\n return true;\n } else {\n return getIdIntersectionCount(ctx, node1, node2) > 0;\n }\n }\n return false;\n }\n\n function isSoftMatch(node1, node2) {\n if (node1 == null || node2 == null) {\n return false;\n }\n return node1.nodeType === node2.nodeType && node1.tagName === node2.tagName\n }\n\n function removeNodesBetween(startInclusive, endExclusive, ctx) {\n while (startInclusive !== endExclusive) {\n let tempNode = startInclusive;\n startInclusive = startInclusive.nextSibling;\n removeNode(tempNode, ctx);\n }\n removeIdsFromConsideration(ctx, endExclusive);\n return endExclusive.nextSibling;\n }\n\n //=============================================================================\n // Scans forward from the insertionPoint in the old parent looking for a potential id match\n // for the newChild. We stop if we find a potential id match for the new child OR\n // if the number of potential id matches we are discarding is greater than the\n // potential id matches for the new child\n //=============================================================================\n function findIdSetMatch(newContent, oldParent, newChild, insertionPoint, ctx) {\n\n // max id matches we are willing to discard in our search\n let newChildPotentialIdCount = getIdIntersectionCount(ctx, newChild, oldParent);\n\n let potentialMatch = null;\n\n // only search forward if there is a possibility of an id match\n if (newChildPotentialIdCount > 0) {\n let potentialMatch = insertionPoint;\n // if there is a possibility of an id match, scan forward\n // keep track of the potential id match count we are discarding (the\n // newChildPotentialIdCount must be greater than this to make it likely\n // worth it)\n let otherMatchCount = 0;\n while (potentialMatch != null) {\n\n // If we have an id match, return the current potential match\n if (isIdSetMatch(newChild, potentialMatch, ctx)) {\n return potentialMatch;\n }\n\n // computer the other potential matches of this new content\n otherMatchCount += getIdIntersectionCount(ctx, potentialMatch, newContent);\n if (otherMatchCount > newChildPotentialIdCount) {\n // if we have more potential id matches in _other_ content, we\n // do not have a good candidate for an id match, so return null\n return null;\n }\n\n // advanced to the next old content child\n potentialMatch = potentialMatch.nextSibling;\n }\n }\n return potentialMatch;\n }\n\n //=============================================================================\n // Scans forward from the insertionPoint in the old parent looking for a potential soft match\n // for the newChild. We stop if we find a potential soft match for the new child OR\n // if we find a potential id match in the old parents children OR if we find two\n // potential soft matches for the next two pieces of new content\n //=============================================================================\n function findSoftMatch(newContent, oldParent, newChild, insertionPoint, ctx) {\n\n let potentialSoftMatch = insertionPoint;\n let nextSibling = newChild.nextSibling;\n let siblingSoftMatchCount = 0;\n\n while (potentialSoftMatch != null) {\n\n if (getIdIntersectionCount(ctx, potentialSoftMatch, newContent) > 0) {\n // the current potential soft match has a potential id set match with the remaining new\n // content so bail out of looking\n return null;\n }\n\n // if we have a soft match with the current node, return it\n if (isSoftMatch(newChild, potentialSoftMatch)) {\n return potentialSoftMatch;\n }\n\n if (isSoftMatch(nextSibling, potentialSoftMatch)) {\n // the next new node has a soft match with this node, so\n // increment the count of future soft matches\n siblingSoftMatchCount++;\n nextSibling = nextSibling.nextSibling;\n\n // If there are two future soft matches, bail to allow the siblings to soft match\n // so that we don't consume future soft matches for the sake of the current node\n if (siblingSoftMatchCount >= 2) {\n return null;\n }\n }\n\n // advanced to the next old content child\n potentialSoftMatch = potentialSoftMatch.nextSibling;\n }\n\n return potentialSoftMatch;\n }\n\n function parseContent(newContent) {\n let parser = new DOMParser();\n\n // remove svgs to avoid false-positive matches on head, etc.\n let contentWithSvgsRemoved = newContent.replace(/]*>|>)([\\s\\S]*?)<\\/svg>/gim, '');\n\n // if the newContent contains a html, head or body tag, we can simply parse it w/o wrapping\n if (contentWithSvgsRemoved.match(/<\\/html>/) || contentWithSvgsRemoved.match(/<\\/head>/) || contentWithSvgsRemoved.match(/<\\/body>/)) {\n let content = parser.parseFromString(newContent, \"text/html\");\n // if it is a full HTML document, return the document itself as the parent container\n if (contentWithSvgsRemoved.match(/<\\/html>/)) {\n content.generatedByIdiomorph = true;\n return content;\n } else {\n // otherwise return the html element as the parent container\n let htmlElement = content.firstChild;\n if (htmlElement) {\n htmlElement.generatedByIdiomorph = true;\n return htmlElement;\n } else {\n return null;\n }\n }\n } else {\n // if it is partial HTML, wrap it in a template tag to provide a parent element and also to help\n // deal with touchy tags like tr, tbody, etc.\n let responseDoc = parser.parseFromString(\"\", \"text/html\");\n let content = responseDoc.body.querySelector('template').content;\n content.generatedByIdiomorph = true;\n return content\n }\n }\n\n function normalizeContent(newContent) {\n if (newContent == null) {\n // noinspection UnnecessaryLocalVariableJS\n const dummyParent = document.createElement('div');\n return dummyParent;\n } else if (newContent.generatedByIdiomorph) {\n // the template tag created by idiomorph parsing can serve as a dummy parent\n return newContent;\n } else if (newContent instanceof Node) {\n // a single node is added as a child to a dummy parent\n const dummyParent = document.createElement('div');\n dummyParent.append(newContent);\n return dummyParent;\n } else {\n // all nodes in the array or HTMLElement collection are consolidated under\n // a single dummy parent element\n const dummyParent = document.createElement('div');\n for (const elt of [...newContent]) {\n dummyParent.append(elt);\n }\n return dummyParent;\n }\n }\n\n function insertSiblings(previousSibling, morphedNode, nextSibling) {\n let stack = []\n let added = []\n while (previousSibling != null) {\n stack.push(previousSibling);\n previousSibling = previousSibling.previousSibling;\n }\n while (stack.length > 0) {\n let node = stack.pop();\n added.push(node); // push added preceding siblings on in order and insert\n morphedNode.parentElement.insertBefore(node, morphedNode);\n }\n added.push(morphedNode);\n while (nextSibling != null) {\n stack.push(nextSibling);\n added.push(nextSibling); // here we are going in order, so push on as we scan, rather than add\n nextSibling = nextSibling.nextSibling;\n }\n while (stack.length > 0) {\n morphedNode.parentElement.insertBefore(stack.pop(), morphedNode.nextSibling);\n }\n return added;\n }\n\n function findBestNodeMatch(newContent, oldNode, ctx) {\n let currentElement;\n currentElement = newContent.firstChild;\n let bestElement = currentElement;\n let score = 0;\n while (currentElement) {\n let newScore = scoreElement(currentElement, oldNode, ctx);\n if (newScore > score) {\n bestElement = currentElement;\n score = newScore;\n }\n currentElement = currentElement.nextSibling;\n }\n return bestElement;\n }\n\n function scoreElement(node1, node2, ctx) {\n if (isSoftMatch(node1, node2)) {\n return .5 + getIdIntersectionCount(ctx, node1, node2);\n }\n return 0;\n }\n\n function removeNode(tempNode, ctx) {\n removeIdsFromConsideration(ctx, tempNode)\n if (ctx.callbacks.beforeNodeRemoved(tempNode) === false) return;\n\n tempNode.remove();\n ctx.callbacks.afterNodeRemoved(tempNode);\n }\n\n //=============================================================================\n // ID Set Functions\n //=============================================================================\n\n function isIdInConsideration(ctx, id) {\n return !ctx.deadIds.has(id);\n }\n\n function idIsWithinNode(ctx, id, targetNode) {\n let idSet = ctx.idMap.get(targetNode) || EMPTY_SET;\n return idSet.has(id);\n }\n\n function removeIdsFromConsideration(ctx, node) {\n let idSet = ctx.idMap.get(node) || EMPTY_SET;\n for (const id of idSet) {\n ctx.deadIds.add(id);\n }\n }\n\n function getIdIntersectionCount(ctx, node1, node2) {\n let sourceSet = ctx.idMap.get(node1) || EMPTY_SET;\n let matchCount = 0;\n for (const id of sourceSet) {\n // a potential match is an id in the source and potentialIdsSet, but\n // that has not already been merged into the DOM\n if (isIdInConsideration(ctx, id) && idIsWithinNode(ctx, id, node2)) {\n ++matchCount;\n }\n }\n return matchCount;\n }\n\n /**\n * A bottom up algorithm that finds all elements with ids inside of the node\n * argument and populates id sets for those nodes and all their parents, generating\n * a set of ids contained within all nodes for the entire hierarchy in the DOM\n *\n * @param node {Element}\n * @param {Map>} idMap\n */\n function populateIdMapForNode(node, idMap) {\n let nodeParent = node.parentElement;\n // find all elements with an id property\n let idElements = node.querySelectorAll('[id]');\n for (const elt of idElements) {\n let current = elt;\n // walk up the parent hierarchy of that element, adding the id\n // of element to the parent's id set\n while (current !== nodeParent && current != null) {\n let idSet = idMap.get(current);\n // if the id set doesn't exist, create it and insert it in the map\n if (idSet == null) {\n idSet = new Set();\n idMap.set(current, idSet);\n }\n idSet.add(elt.id);\n current = current.parentElement;\n }\n }\n }\n\n /**\n * This function computes a map of nodes to all ids contained within that node (inclusive of the\n * node). This map can be used to ask if two nodes have intersecting sets of ids, which allows\n * for a looser definition of \"matching\" than tradition id matching, and allows child nodes\n * to contribute to a parent nodes matching.\n *\n * @param {Element} oldContent the old content that will be morphed\n * @param {Element} newContent the new content to morph to\n * @returns {Map>} a map of nodes to id sets for the\n */\n function createIdMap(oldContent, newContent) {\n let idMap = new Map();\n populateIdMapForNode(oldContent, idMap);\n populateIdMapForNode(newContent, idMap);\n return idMap;\n }\n\n //=============================================================================\n // This is what ends up becoming the Idiomorph global object\n //=============================================================================\n return {\n morph,\n defaults\n }\n })();\n\nexport {Idiomorph};\n", "/**\n * Skipped minification because the original files appears to be already minified.\n * Original file: /npm/goober@2.1.14/dist/goober.modern.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\nlet e={data:\"\"},t=t=>\"object\"==typeof window?((t?t.querySelector(\"#_goober\"):window._goober)||Object.assign((t||document.head).appendChild(document.createElement(\"style\")),{innerHTML:\" \",id:\"_goober\"})).firstChild:t||e,a=e=>{let a=t(e),r=a.data;return a.data=\"\",r},r=/(?:([\\u0080-\\uFFFF\\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\\s*)/g,l=/\\/\\*[^]*?\\*\\/| +/g,s=/\\n+/g,n=(e,t)=>{let a=\"\",r=\"\",l=\"\";for(let s in e){let o=e[s];\"@\"==s[0]?\"i\"==s[1]?a=s+\" \"+o+\";\":r+=\"f\"==s[1]?n(o,s):s+\"{\"+n(o,\"k\"==s[1]?\"\":t)+\"}\":\"object\"==typeof o?r+=n(o,t?t.replace(/([^,])+/g,(e=>s.replace(/(^:.*)|([^,])+/g,(t=>/&/.test(t)?t.replace(/&/g,e):e?e+\" \"+t:t)))):s):null!=o&&(s=/^--/.test(s)?s:s.replace(/[A-Z]/g,\"-$&\").toLowerCase(),l+=n.p?n.p(s,o):s+\":\"+o+\";\")}return a+(t&&l?t+\"{\"+l+\"}\":l)+r},o={},c=e=>{if(\"object\"==typeof e){let t=\"\";for(let a in e)t+=a+c(e[a]);return t}return e},i=(e,t,a,i,p)=>{let u=c(e),d=o[u]||(o[u]=(e=>{let t=0,a=11;for(;t>>0;return\"go\"+a})(u));if(!o[d]){let t=u!==e?e:(e=>{let t,a,n=[{}];for(;t=r.exec(e.replace(l,\"\"));)t[4]?n.shift():t[3]?(a=t[3].replace(s,\" \").trim(),n.unshift(n[0][a]=n[0][a]||{})):n[0][t[1]]=t[2].replace(s,\" \").trim();return n[0]})(e);o[d]=n(p?{[\"@keyframes \"+d]:t}:t,a?\"\":\".\"+d)}let f=a&&o.g?o.g:null;return a&&(o.g=o[d]),((e,t,a,r)=>{r?t.data=t.data.replace(r,e):-1===t.data.indexOf(e)&&(t.data=a?e+t.data:t.data+e)})(o[d],t,i,f),d},p=(e,t,a)=>e.reduce(((e,r,l)=>{let s=t[l];if(s&&s.call){let e=s(a),t=e&&e.props&&e.props.className||/^go/.test(e)&&e;s=t?\".\"+t:e&&\"object\"==typeof e?e.props?\"\":n(e,\"\"):!1===e?\"\":e}return e+r+(null==s?\"\":s)}),\"\");function u(e){let a=this||{},r=e.call?e(a.p):e;return i(r.unshift?r.raw?p(r,[].slice.call(arguments,1),a.p):r.reduce(((e,t)=>Object.assign(e,t&&t.call?t(a.p):t)),{}):r,t(a.target),a.g,a.o,a.k)}let d,f,g,b=u.bind({g:1}),m=u.bind({k:1});function h(e,t,a,r){n.p=t,d=e,f=a,g=r}function y(e,t){let a=this||{};return function(){let r=arguments;function l(s,n){let o=Object.assign({},s),c=o.className||l.className;a.p=Object.assign({theme:f&&f()},o),a.o=/ *go\\d+/.test(c),o.className=u.apply(a,r)+(c?\" \"+c:\"\"),t&&(o.ref=n);let i=e;return e[0]&&(i=o.as||e,delete o.as),g&&i[0]&&g(o),d(i,o)}return t?t(l):l}}\nexport default { css:u, extractCss: a, glob: b, keyframes: m, setup: h, styled: y }\n", "// Exposes node building method, that gets node name, attrs and body.\n// n('span', {id: id}), n('.foo', {id: id}, body), n('.foo', {id: id}, [...])\n// * you can switch places for attrs and body, and body can be list of nodes\n// * n('.foo.bar') -> n('div', { class: 'foo bar' })\n//\n// copyright @dux, 2024\n// Licence MIT\n\nexport default function n(name, attrs = {}, data) {\n if (typeof attrs === 'string') {\n [attrs, data] = [data, attrs]\n attrs ||= {}\n }\n\n if (attrs instanceof Node) {\n data = attrs\n attrs = {}\n }\n\n if (Array.isArray(name)) {\n data = name\n name = 'div'\n }\n\n if (typeof attrs !== 'object' || Array.isArray(attrs)) {\n data = attrs\n attrs = {}\n }\n\n if (name.includes('.')) {\n const parts = name.split('.')\n name = parts.shift() || 'div'\n const c = parts.join(' ');\n if (attrs.class) {\n attrs.class += ` ${c}`;\n } else {\n attrs.class = c\n }\n }\n\n const node = document.createElement(name);\n\n for (const [k, v] of Object.entries(attrs)) {\n if (typeof v === 'function') {\n node[k] = v.bind(this)\n } else {\n const value = String(v).replaceAll('$$.', this.fezHtmlRoot);\n node.setAttribute(k, value)\n }\n }\n\n if (data) {\n if (Array.isArray(data)) {\n for (const n of data) {\n node.appendChild(n)\n }\n } else if (data instanceof Node) {\n node.appendChild(data)\n } else {\n node.innerHTML = String(data)\n }\n }\n\n return node\n}\n", "// templating\nimport renderStache from './lib/stache'\n\n// morph dom from one state to another\nimport { Idiomorph } from './lib/idiomorph'\n\n// runtime scss\nimport Gobber from './lib/gobber'\n\n// HTML node builder\nimport parseNode from './lib/n'\n\nclass FezBase {\n static __objects = []\n\n static find(node, name) {\n return Fez.find(node, name)\n }\n\n // get unique id from string\n static fnv1(str) {\n var FNV_OFFSET_BASIS, FNV_PRIME, hash, i, j, ref;\n FNV_OFFSET_BASIS = 2166136261;\n FNV_PRIME = 16777619;\n hash = FNV_OFFSET_BASIS;\n for (i = j = 0, ref = str.length - 1; (0 <= ref ? j <= ref : j >= ref); i = 0 <= ref ? ++j : --j) {\n hash ^= str.charCodeAt(i);\n hash *= FNV_PRIME;\n }\n return hash.toString(36).replaceAll('-', '');\n }\n\n // get node attributes as object\n static getProps(node) {\n const attrs = {}\n for (const attr of node.attributes) {\n attrs[attr.name] = attr.value\n }\n return attrs\n }\n\n static formData(node) {\n const formData = new FormData(node.closest('form'))\n const formObject = {}\n formData.forEach((value, key) => {\n formObject[key] = value\n });\n return formObject\n }\n\n static fastBind() {\n // return true to bind without requestAnimationFrame\n // you can do this if you are sure you are not expecting innerHTML data\n return false\n }\n\n // instance methods\n\n constructor() {\n this.__int = {}\n }\n\n n = parseNode\n\n // string selector for use in HTML nodes\n get fezHtmlRoot() {\n return `Fez.find(this, \"${this.fezName}\").`\n }\n\n // checks if node is attached and clears all if not\n get isAttached() {\n if (this.root?.parentNode) {\n return true\n } else {\n Object.keys(this.__int).forEach((key)=> {\n clearInterval(this.__int[key])\n })\n this.root.fez = null\n this.root = null\n return false\n }\n }\n\n // get single node property\n prop(name) {\n let v = this.oldRoot[name] || this.props[name]\n if (typeof v == 'function') {\n // if @prop('onclick'), we want \"this\" to point to this.root (dom node)\n v = v.bind(this.root)\n }\n return v\n }\n\n // copy attributes to root node\n copy() {\n for (const name of Array.from(arguments)) {\n let value = this.props[name]\n\n if (value !== undefined) {\n if (name == 'class') {\n const klass = this.root.getAttribute(name, value)\n\n if (klass) {\n value = [klass, value].join(' ')\n }\n }\n\n if (typeof value == 'string') {\n this.root.setAttribute(name, value)\n } else {\n this.root[name] = value\n }\n }\n }\n }\n\n // copy child nodes, natively to preserve bound events\n // if node name is SLOT insert adjacent and remove SLOT, else as a child nodes\n slot(source, target) {\n target ||= document.createElement('template')\n const isSlot = target.nodeName == 'SLOT'\n\n while (source.firstChild) {\n if (isSlot) {\n target.parentNode.insertBefore(source.lastChild, target.nextSibling);\n } else {\n target.appendChild(source.firstChild)\n }\n }\n\n if (isSlot) {\n target.parentNode.removeChild(target)\n } else {\n source.innerHTML = ''\n }\n\n return target\n }\n\n style() { console.error('call Fez static style') }\n\n connect() {\n console.error('Fez is missing \"connect\" method.', this.root)\n }\n\n parseHtml(text, context) {\n if (typeof text == 'object') {\n text = text[0]\n }\n\n text = text.replaceAll('$$.', this.fezHtmlRoot.replaceAll('\"', '"'))\n\n if (text.includes('{{')) {\n try {\n const func = renderStache(text, this)\n text = func()// .replace(/\\n\\s*\\n/g, \"\\n\")\n } catch(error) {\n console.error(`Fez stache template error in \"${this.fezName}\"`, error)\n }\n }\n\n return text\n }\n\n // inject htmlString as innerHTML and replace $$. with local pointer\n // $$. will point to current fez instance\n // will be replaced with current root\n // this.html('...loading')\n // this.html('.images', '...loading')\n html(target, body) {\n if (!target) {\n target = this.class.html\n }\n\n if (typeof body == 'undefined') {\n body = target\n target = this.root\n }\n\n if (typeof target == 'string') {\n target = this.find(target)\n }\n\n const newNode = document.createElement('div')\n\n if (typeof body === 'function') {\n // this.class.html will be converted to function, and all sequential calls will use function call\n // this feature is not available on this.html(...)\n body = body()\n }\n\n if (Array.isArray(body)) {\n if (body[0] instanceof Node) {\n body.forEach((n)=>{\n newNode.appendChild(n)\n })\n } else {\n body = body.join('')\n }\n } else if (typeof body === 'string') {\n newNode.innerHTML = this.parseHtml(body)\n } else {\n newNode.appendChild(body)\n }\n\n const slot = newNode.querySelector('slot')\n if (slot) {\n this.slot(target, slot)\n }\n\n // old way, just replace\n // target.innerHTML = ''\n // this.slot(newNode, target)\n\n Fez.morphdom(target, newNode)\n\n const fetchAttr = (name, func) => {\n target.querySelectorAll(`*[${name}]`).forEach((n)=>{\n let value = n.getAttribute(name)\n n.removeAttribute(name)\n if (value) {\n func.bind(this)(value, n)\n }\n })\n }\n\n fetchAttr('fez-this', (value, n) => {\n this[value] = n\n })\n\n fetchAttr('fez-use', (value, n) => {\n const target = this[value]\n if (typeof target == 'function') {\n target(n)\n } else {\n console.error(`Fez error: \"${value}\" is not a function in ${this.fezName}`)\n }\n })\n\n fetchAttr('fez-class', (value) => {\n let classes = value.split(/\\s+/)\n let lastClass = classes.pop()\n classes.forEach((c)=> n.classList.add(c) )\n if (lastClass) {\n setTimeout(()=>{\n n.classList.add(lastClass)\n }, 1000)\n }\n })\n }\n\n // run only if node is attached, clear otherwise\n setInterval(func, tick, name) {\n if (typeof func == 'number') {\n [tick, func] = [func, tick]\n }\n\n name ||= this.class.fnv1(String(func))\n\n clearInterval(this.__int[name])\n\n this.__int[name] = setInterval(() => {\n if (this.isAttached) {\n func()\n }\n }, tick)\n\n return this.__int[name]\n }\n\n // add css class for scss styled text\n css(text, isGlobal) {\n const className = Fez.css(text)\n\n if (isGlobal) {\n this.root.classList.add(className)\n }\n\n return className\n }\n\n find(selector) {\n return this.root.querySelector(selector)\n }\n\n val(selector, data) {\n const node = this.find('.time')\n\n if (['INPUT', 'TEXTAREA', 'SELECT'].includes(node.nodeName)) {\n node.value = data\n } else {\n node.innerHTML = new Date()\n }\n }\n\n formData(node) {\n return this.class.formData(node || this.root)\n }\n\n // get or set attribute\n attr(name, value) {\n if (typeof value === 'undefined') {\n return this.root.getAttribute(name)\n } else {\n this.root.setAttribute(name, value)\n return value\n }\n }\n\n // get root node child nodes as array\n childNodes(func) {\n const list = Array.from(this.root.querySelectorAll(\":scope > *\"))\n\n if (func) {\n list.forEach(func)\n } else {\n return list\n }\n }\n\n subscribe(channel, func) {\n Fez._subs ||= {}\n Fez._subs[channel] ||= []\n Fez._subs[channel] = Fez._subs[channel].filter((el) => el[0].isAttached)\n Fez._subs[channel].push([this, func])\n }\n\n fezRegister() {\n if (this.class.css) {\n if (typeof this.class.css == 'function') {\n this.class.css = this.class.css(this)\n }\n\n if (this.class.css.includes(':')) {\n this.class.css = Fez.css(this.class.css)\n }\n this.root.classList.add(this.class.css)\n }\n\n this.fezRegisterBindMethods()\n }\n\n // bind all instance method to this, to avoid calling with .bind(this)\n fezRegisterBindMethods() {\n const methods = Object.getOwnPropertyNames(Object.getPrototypeOf(this))\n .filter(method => method !== 'constructor' && typeof this[method] === 'function')\n\n methods.forEach(method => this[method] = this[method].bind(this))\n }\n\n reactiveStore(obj, handler) {\n handler ||= (o, k, v) => {\n window.requestAnimationFrame(()=>{\n Fez.info('reactive render')\n this.html()\n },0)\n }\n\n handler.bind(this)\n\n // licence ? -> generated by ChatGPT 2024\n function createReactive(obj, handler) {\n if (typeof obj !== 'object' || obj === null) {\n return obj;\n }\n\n return new Proxy(obj, {\n set(target, property, value, receiver) {\n if (typeof value === 'object' && value !== null) {\n value = createReactive(value, handler)\n }\n const result = Reflect.set(target, property, value, receiver)\n handler(target, property, value)\n return result\n },\n get(target, property, receiver) {\n const value = Reflect.get(target, property, receiver)\n if (typeof value === 'object' && value !== null) {\n return createReactive(value, handler)\n }\n return value\n }\n });\n }\n\n return createReactive(obj, handler);\n }\n\n}\n\n// clear all unnatached nodes\nsetInterval(() => {\n FezBase.__objects = FezBase.__objects.filter(\n (el) => el.isAttached\n )\n}, 10_000)\n\n//\n\nconst observer = new MutationObserver((mutationsList, _) => {\n for (const mutation of mutationsList) {\n if (mutation.type === 'attributes') {\n const fez = mutation.target.fez\n const name = mutation.attributeName\n const value = mutation.target.getAttribute(name)\n fez.props[name] = value\n fez.onPropsChange(name, value)\n // console.log(`The [${name}] attribute was modified to [${value}].`);\n }\n }\n});\n\nconst Fez = (name, klass) => {\n function connect() {\n const parentNode = this.parentNode\n if (parentNode) {\n const nodeName = typeof klass.nodeName == 'function' ? klass.nodeName(this) : klass.nodeName\n const newNode = document.createElement(nodeName || 'div')\n\n newNode.classList.add('fez')\n newNode.classList.add(`fez-${name}`)\n\n parentNode.replaceChild(newNode, this);\n\n const object = new klass()\n object.oldRoot = this\n object.fezName = name\n object.root = newNode\n object.props = klass.getProps(this)\n object.class = klass\n\n // copy child nodes, natively to preserve bound events\n object.slot(this, newNode)\n\n newNode.fez = object\n\n if (window.$) {\n object.$root = $(newNode)\n }\n\n if (object.props.id) {\n newNode.setAttribute('id', object.props.id)\n }\n\n object.fezRegister()\n object.connect(object.props)\n klass.__objects.push(object)\n\n if (klass.html) {\n if (typeof klass.html == 'function') {\n klass.html = klass.html(this)\n }\n klass.html = renderStache(klass.html, object)\n object.html()\n }\n\n if (object.onPropsChange) {\n observer.observe(newNode, {attributes:true})\n }\n }\n }\n\n function forceFastRender(n) {\n return typeof klass.fastBind === 'function' ? klass.fastBind(n) : klass.fastBind\n }\n\n if (!name) {\n return FezBase\n }\n\n if (typeof klass != 'function') {\n return Fez.find(name, klass)\n }\n\n customElements.define(name, class extends HTMLElement {\n connectedCallback() {\n // when we render nested fez components, and under Svelte, sometimes node innerHTML is empty, but it should not be\n // in that case, we need to wait for another tick to get content\n // this solution looks like it is not efficient, because it slow renders fez components that do not have and are not intended to have body, but by testing this looks like it is not effecting render performance\n // if you want to force fast render, add static fastBind = true or check\n if (this.firstChild || forceFastRender(this)) {\n Fez.info(`fast bind: ${name}`)\n connect.bind(this)()\n } else {\n Fez.info(`slow bind: ${name}`)\n window.requestAnimationFrame(()=>{\n connect.bind(this)()\n })\n }\n }\n })\n}\n\nFez.find = (node, name) => {\n if (typeof node == 'string') {\n node = document.body.querySelector(node)\n }\n\n if (typeof node.val == 'function') {\n node = node[0]\n }\n\n const klass = name ? `.fez-${name}` : '.fez'\n\n return node.closest(klass).fez\n}\n\nFez.globalCss = (text) => {\n const cssClass = Fez.css(text)\n document.addEventListener(\"DOMContentLoaded\", () => {\n document.body.classList.add(cssClass)\n })\n return cssClass\n}\n\nFez.css = (text) => {\n return Gobber.css(text)\n}\n\nFez.info = (text) => {\n if (window.DEBUG) {\n console.log(`Fez: ${text}`)\n }\n}\n\nFez.morphdom = (target, newNode, opts = {}) => {\n if (opts.childrenOnly === undefined) {\n opts.childrenOnly = true\n }\n\n // Morphdom(target, newNode, opts)\n Idiomorph.morph(target, newNode, { morphStyle: 'innerHTML'})\n}\n\nFez.htmlEscape = (text) => {\n return text\n .replaceAll(\"'\", ''')\n .replaceAll('\"', '"')\n .replaceAll('<', '<')\n .replaceAll('>', '>')\n}\n\nFez.publish = (channel, ...args) => {\n Fez._subs[channel] ||= []\n Fez._subs[channel].forEach((el) => {\n el[1].bind(el[0])(...args)\n })\n}\n\nwindow.Fez = Fez\nwindow.FezBase = FezBase\n"], + "mappings": "MACe,SAARA,EAA8BC,EAAKC,EAAS,CACjD,IAAMC,EAAe,gBACfC,EAAc,mBACdC,EAAU,4BACVC,EAAQ,cACRC,EAAa,mBAEnB,SAASC,EAAOC,EAAQ,CACtB,IAAMC,EAAUC,GAAMA,EAAE,WAAW,IAAK,OAAO,EAE3CC,EAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,wBAgBPH,EAAO,KAAK,EAAE,QAAQN,EAAc,KAAK,EAAE,QAAQC,EAAa,CAACS,EAAKC,IAAS,CAI7E,GAFAA,EAAOA,EAAK,QAAQ,QAAS,EAAE,EAE3BA,EAAK,WAAW,MAAM,GA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AAK,cAAcA,CAAI,GAGrC,OAAOA,EAAK,KAAO,aACrBA,EAAOA,EAAK,CAAC,GAGf,IAAMkB,EAAQjB,EAAO,QAAQA,CAAI,GAAK,OAEtC,OAAOD,EAAK,QAAQkB,CAAK,EAAE,GAC7B,EAEAhB,EAAI,UAAaoB,GAAS,CACxB,IAAMuC,EAAW3D,EAAI,IAAIoB,CAAI,EAC7B,gBAAS,iBAAiB,mBAAoB,IAAM,CAClD,SAAS,KAAK,UAAU,IAAIuC,CAAQ,CACtC,CAAC,EACMA,CACT,EAEA3D,EAAI,IAAOoB,GACFwC,EAAO,IAAIxC,CAAI,EAGxBpB,EAAI,KAAQoB,GAAS,CACf,OAAO,OACT,QAAQ,IAAI,QAAQA,CAAI,EAAE,CAE9B,EAEApB,EAAI,SAAW,CAACkB,EAAQO,EAASoC,EAAO,CAAC,IAAM,CACzCA,EAAK,eAAiB,SACxBA,EAAK,aAAe,IAItBC,EAAU,MAAM5C,EAAQO,EAAS,CAAE,WAAY,WAAW,CAAC,CAC7D,EAEAzB,EAAI,WAAcoB,GACTA,EACJ,WAAW,IAAK,QAAQ,EACxB,WAAW,IAAK,QAAQ,EACxB,WAAW,IAAK,MAAM,EACtB,WAAW,IAAK,MAAM,EAG3BpB,EAAI,QAAU,CAACsC,KAAYyB,IAAS,CAClC/D,EAAI,MAAMsC,CAAO,IAAM,CAAC,EACxBtC,EAAI,MAAMsC,CAAO,EAAE,QAASC,GAAO,CACjCA,EAAG,CAAC,EAAE,KAAKA,EAAG,CAAC,CAAC,EAAE,GAAGwB,CAAI,CAC3B,CAAC,CACH,EAEA,OAAO,IAAM/D,EACb,OAAO,QAAUH", + "names": ["renderStache", "tpl", "context", "NEW_LINES_RE", "TEMPLATE_RE", "EACH_RE", "IF_RE", "ELSE_IF_RE", "stache", "source", "monkey", "t", "func", "all", "code", "parts", "list", "loop", "conditional", "conditionalElse", "codeParts", "createTemplate", "strings", "values", "acc", "str", "i", "closeCustomTags", "html", "selfClosingTags", "match", "tagName", "attributes", "Idiomorph", "EMPTY_SET", "defaults", "noOp", "elt", "morph", "oldNode", "newContent", "config", "parseContent", "normalizedContent", "normalizeContent", "ctx", "createMorphContext", "morphNormalizedContent", "normalizedNewContent", "oldHead", "newHead", "promises", "handleHeadElement", "morphChildren", "bestMatch", "findBestNodeMatch", "previousSibling", "nextSibling", "morphedNode", "morphOldNodeTo", "insertSiblings", "ignoreValueOfActiveElement", "possibleActiveElement", "isSoftMatch", "syncNodeFrom", "newParent", "oldParent", "nextNewChild", "insertionPoint", "newChild", "removeIdsFromConsideration", "isIdSetMatch", "idSetMatch", "findIdSetMatch", "removeNodesBetween", "softMatch", "findSoftMatch", "tempNode", "removeNode", "ignoreAttribute", "attr", "to", "updateType", "from", "type", "fromAttributes", "toAttributes", "fromAttribute", "i", "toAttribute", "syncInputValue", "syncBooleanAttribute", "attributeName", "ignoreUpdate", "fromValue", "toValue", "newHeadTag", "currentHead", "added", "removed", "preserved", "nodesToAppend", "headMergeStyle", "srcToNewHeadNodes", "newHeadChild", "currentHeadElt", "inNewContent", "isReAppended", "isPreserved", "newNode", "newElt", "resolve", "promise", "_resolve", "removedElement", "log", "mergeDefaults", "finalConfig", "createIdMap", "node1", "node2", "getIdIntersectionCount", "startInclusive", "endExclusive", "newChildPotentialIdCount", "potentialMatch", "otherMatchCount", "potentialSoftMatch", "siblingSoftMatchCount", "parser", "contentWithSvgsRemoved", "content", "htmlElement", "dummyParent", "stack", "node", "currentElement", "bestElement", "score", "newScore", "scoreElement", "isIdInConsideration", "id", "idIsWithinNode", "targetNode", "idSet", "sourceSet", "matchCount", "populateIdMapForNode", "idMap", "nodeParent", "idElements", "current", "oldContent", "e", "t", "a", "r", "l", "s", "n", "o", "c", "i", "u", "d", "f", "p", "g", "b", "m", "h", "y", "gobber_default", "n", "name", "attrs", "data", "parts", "c", "node", "k", "v", "value", "FezBase", "node", "name", "Fez", "str", "FNV_OFFSET_BASIS", "FNV_PRIME", "hash", "i", "j", "ref", "attrs", "attr", "formData", "formObject", "value", "key", "n", "v", "klass", "source", "target", "isSlot", "text", "context", "renderStache", "error", "body", "newNode", "slot", "fetchAttr", "func", "classes", "lastClass", "c", "tick", "isGlobal", "className", "selector", "data", "list", "channel", "el", "method", "obj", "handler", "o", "k", "createReactive", "property", "receiver", "result", "observer", "mutationsList", "_", "mutation", "fez", "connect", "parentNode", "nodeName", "object", "forceFastRender", "cssClass", "gobber_default", "opts", "Idiomorph", "args"] } diff --git a/index.html b/index.html index 27cd3a5..ee428c0 100644 --- a/index.html +++ b/index.html @@ -28,7 +28,7 @@

ui-todo ⋅ - Todo app demo, ToDo MVC candidate (React, Vue, Angular) + Todo app demo, features reactiveStore, fez-use, runtime scss. ToDo MVC candidate (React, Vue, Angular)

@@ -38,13 +38,14 @@


 Fez('ui-todo', class extends FezBase {
+  // if you define static html, it will be converted tu function(fast), and you will be able to refresh state with this.html()
   static html = `
     <h3>Tasks</h3>
-    {{#if !@tasks[0]}}
+    {{#if !@data.tasks[0]}}
       <p>No tasks found</p>
     {{/if}}
-    {{#for task, index in @tasks}}
-      {{#if task.animate}}
+    {{#for task, index in @data.tasks}}
+      {{#if task.animate}} <!-- this is fine because this is string templating -->
         <p fez-use="animate" style="display: none; height: 0px; opacity: 0;">
       {{else}}
         <p>
@@ -70,52 +71,67 @@ 

⋅ <button onclick="$$.clearCompleted()">clear completed</button> </p> - <pre class="code">{{ JSON.stringify(this.tasks, null, 2) }}</pre> + <pre class="code">{{ JSON.stringify(this.data.tasks, null, 2) }}</pre> ` toggleComplete(index) { - const task = this.tasks[index] + const task = this.data.tasks[index] task.done = !task.done - this.html() } clearCompleted() { - this.tasks = this.tasks.filter((t) => !t.done) - this.html() + this.data.tasks = this.data.tasks.filter((t) => !t.done) } removeTask(index) { - this.tasks = this.tasks.filter((_, i) => i !== index); - this.html() + this.data.tasks = this.data.tasks.filter((_, i) => i !== index); } setName(index, name) { - this.tasks[index].name = name - this.html() // refresh full component on every key stroke. done for render speed demo purposes + this.data.tasks[index].name = name } addTask() { + // no need to force update template, this is automatic because we are using reactiveStore() this.counter ||= 0 - this.tasks.push({name: `new task ${++this.counter}`, done: false, animate: true}) - this.html() + this.data.tasks.push({ + name: `new task ${++this.counter}`, + done: false, + animate: true + }) } animate(node) { + // same as in svelte, uf you define fez-use="methodName", method will be called when node is added to dom. + // in this case, we animate show new node $(node) .css('display', 'block') .animate({height: '33px', opacity: 1}, 200, () => { - delete this.tasks[this.tasks.length-1].animate + delete this.data.tasks[this.data.tasks.length-1].animate $(node).css('height', 'auto') - this.html() }) } connect() { - this.tasks = [ + // creates reactive store, that calls this.html() state refresh after every data set + // you can pass function as argument to change default reactive behaviour + this.data = this.reactiveStore({}) + + this.data.tasks = [ {name: 'First task', done: false}, {name: 'Second task', done: false}, {name: 'Third task', done: true }, ] + + for (const i in [1,2,3,4,5]) { + this.data.i = i + } + + window.requestAnimationFrame(()=>{ + for (const i in [1,2,3,4,5]) { + this.data.i = i + } + }) } }) diff --git a/src/fez.js b/src/fez.js index 6158f31..f870479 100644 --- a/src/fez.js +++ b/src/fez.js @@ -347,6 +347,45 @@ class FezBase { methods.forEach(method => this[method] = this[method].bind(this)) } + + reactiveStore(obj, handler) { + handler ||= (o, k, v) => { + window.requestAnimationFrame(()=>{ + Fez.info('reactive render') + this.html() + },0) + } + + handler.bind(this) + + // licence ? -> generated by ChatGPT 2024 + function createReactive(obj, handler) { + if (typeof obj !== 'object' || obj === null) { + return obj; + } + + return new Proxy(obj, { + set(target, property, value, receiver) { + if (typeof value === 'object' && value !== null) { + value = createReactive(value, handler) + } + const result = Reflect.set(target, property, value, receiver) + handler(target, property, value) + return result + }, + get(target, property, receiver) { + const value = Reflect.get(target, property, receiver) + if (typeof value === 'object' && value !== null) { + return createReactive(value, handler) + } + return value + } + }); + } + + return createReactive(obj, handler); + } + } // clear all unnatached nodes