@webqit/oohtml 5.0.5 → 5.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bindings-api.js +1719 -1
- package/dist/bindings-api.js.map +1 -1
- package/dist/context-api.js +1602 -1
- package/dist/context-api.js.map +1 -1
- package/dist/data-binding.js +1634 -22
- package/dist/data-binding.js.map +2 -2
- package/dist/html-imports.js +2172 -1
- package/dist/html-imports.js.map +1 -1
- package/dist/main.js +12649 -45
- package/dist/main.js.map +2 -2
- package/dist/main.lite.js +5829 -37
- package/dist/main.lite.js.map +2 -2
- package/dist/namespaced-html.js +1977 -1
- package/dist/namespaced-html.js.map +1 -1
- package/dist/scoped-css.js +1816 -5
- package/dist/scoped-css.js.map +1 -1
- package/dist/scoped-js.js +1516 -1
- package/dist/scoped-js.js.map +1 -1
- package/package.json +5 -4
- package/src/data-binding/index.js +13 -5
- package/test/bindings-api.test.js +2 -2
package/dist/data-binding.js
CHANGED
|
@@ -1,39 +1,1651 @@
|
|
|
1
|
-
function $e(...n){let e,r={runtimeParams:Je,transformerParams:Qe,parserParams:ze};for(;e=n.shift();){let{runtimeParams:t={},transformerParams:{globalsNoObserve:i=[],globalsOnlyPathsExcept:o=[],...s}={},parserParams:l={}}=e;r={runtimeParams:{...r.runtimeParams,...t},transformerParams:{...r.transformerParams,globalsNoObserve:[...r.transformerParams.globalsNoObserve,...i],globalsOnlyPathsExcept:[...r.transformerParams.globalsOnlyPathsExcept,...o],...s},parserParams:{...r.parserParams,...l}},n.devMode}return r}var ze={ecmaVersion:"latest",allowReturnOutsideFunction:!0,allowAwaitOutsideFunction:!1,allowSuperOutsideMethod:!1,preserveParens:!1,locations:!0},Qe={globalsNoObserve:["arguments","debugger"],globalsOnlyPathsExcept:[],originalSource:!0,locations:!0,compact:2},Je={apiVersion:3};function Oe(n){return(n=n.trim())&&n.startsWith("(")&&n.endsWith(")")}function ne(n,e,r,t=!0){r=(Array.isArray(r)?r:[r]).map(s=>(s+"").replace("(",t?"(.//":"(./")).join("|");let i=[],o;try{let s=n.document.evaluate(r,e,null,n.XPathResult.ANY_TYPE);for(;o=s.iterateNext();)i.push(o)}catch{}return i}function Ae(n,e,r){r=(Array.isArray(r)?r:[r]).map(t=>(t+"").replace("(","(self::")).join("|");try{return n.document.evaluate(`${r}`,e,null,n.XPathResult.BOOLEAN_TYPE).booleanValue}catch{}}function Q(n,e,r,t=!1,i=null){let o=i?.get(e)?.get(r);if(typeof o<"u")return o;let s=f=>(i?.has(e)||i?.set(e,new WeakMap),i?.get(e)?.set(r,f),f),l=e.getRootNode(),a=r.getRootNode();return l===a?s(e.contains(r)):t&&a instanceof n.ShadowRoot?s(Q(n,e,a.host,t,i)):s(!1)}function Se(n,e="|"){return[...n].reduce(([r,t,i,o],s)=>!r&&t===0&&(Array.isArray(e)?e:[e]).includes(s)?[r,t,[""].concat(i)]:(!r&&["(","[","{"].includes(s)&&!i[0].endsWith("\\")&&t++,!r&&[")","]","}"].includes(s)&&!i[0].endsWith("\\")&&t--,['"',"'","`"].includes(s)&&!i[0].endsWith("\\")&&(r=r===s?null:r||s),i[0]+=s,[r,t,i]),[null,0,[""]])[2].reverse()}function v(n){return!Array.isArray(n)&&typeof n=="object"&&n}function g(n){return Array.isArray(n)}function V(n){return typeof n=="function"}function J(n){return n===null||n===""}function D(n){return arguments.length&&(n===void 0||typeof n>"u")}function S(n){return Array.isArray(n)||typeof n=="object"&&n||V(n)}function ue(n){return J(n)||D(n)||n===!1||n===0||S(n)&&!Object.keys(n).length}function b(n){return V(n)||n&&{}.toString.call(n)==="[object function]"}function Y(n){return n instanceof Number||typeof n=="number"}function P(n){return Y(n)||n!==!0&&n!==!1&&n!==null&&n!==""&&!isNaN(n*1)}function G(n){return n instanceof String||typeof n=="string"&&n!==null}function me(n){return!G(n)&&!D(n.length)}function ie(n,...e){return e.forEach(r=>{n.indexOf(r)<0&&n.push(r)}),n}function de(t,e){e=e||Object.prototype,e=e&&!g(e)?[e]:e;for(var r=[],t=t;t&&(!e||e.indexOf(t)<0)&&t.name!=="default";)r.push(t),t=t?Object.getPrototypeOf(t):null;return r}function pe(n,e){var r=[];return de(n,e).forEach(t=>{ie(r,...Object.getOwnPropertyNames(t))}),r}function k(n,e,r=!1,t=!1,i=!1){var o=0,s=n.shift();if((P(s)||s===!0||s===!1)&&(o=s,s=n.shift()),!n.length)throw new Error("_merge() requires two or more array/objects.");return n.forEach((l,a)=>{!S(l)&&!b(l)||(r?pe(l):Object.keys(l)).forEach(f=>{if(!!e(f,s,l,a)){var c=s[f],m=l[f];if((g(c)&&g(m)||v(c)&&v(m))&&(o===!0||o>0))s[f]=g(c)&&g(m)?[]:{},k([P(o)?o-1:o,s[f],c,m],e,r,t,i);else if(g(s)&&g(l))t?s[f]=m:s.push(m);else try{i?Object.defineProperty(s,f,Object.getOwnPropertyDescriptor(l,f)):s[f]=l[f]}catch{}}})}),s}function Z(...n){return k(n,(e,r,t)=>!0,!1,!1,!1)}function C(n,...e){if(!n||!["object","function"].includes(typeof n))throw new Error("Argument #1 must be of type object");let r=n[Symbol.for("wq")];if(r||(r=new oe,Object.defineProperty(n,Symbol.for("wq"),{value:r,enumerable:!1,configurable:!1,writable:!1})),!e.length)return r;let t,i;for(;t=e.shift();)(i=r)&&!(r=r.get(t))&&(r=new oe,i.set(t,r));return r}var oe=class extends Map{};function E(n,e=!0){return g(n)?n:!e&&v(n)?[n]:n!==!1&&n!==0&&ue(n)?[]:me(n)?Array.prototype.slice.call(n):v(n)?Object.values(n):[n]}function K(n,e,r={},t={}){e=E(e).slice();for(var i=n;!D(i)&&!J(i)&&e.length;){var o=e.shift();if(!(r.get?r.get(i,o):S(i)?o in i:i[o])){t.exists=!1;return}i=r.get?r.get(i,o):i[o]}return t.exists=!0,i}function ge(n,e,r,t={},i={}){let o=(c,m,u)=>i.set?i.set(c,m,u):(P(e[l])&&g(c)?c.push(u):c[m]=u,!0);e=E(e);for(var s=n,l=0;l<e.length;l++)if(l<e.length-1){if(!s||!S(s)&&!b(s))return!1;var a=K(s,e[l],i);if(!S(a)){if(i.buildTree===!1)return!1;a=b(i.buildTree)?i.buildTree(l):P(e[l+1])?[]:{};var f=o(s,e[l],a);if(!f)return!1}s=a}else return o(s,e[l],r)}var ee=class{constructor(e,r=!1){Object.defineProperty(this,"window",{value:e}),Object.defineProperty(this,"readCallbacks",{value:new Set}),Object.defineProperty(this,"writeCallbacks",{value:new Set}),Object.defineProperty(this,"_synthesis",{value:0,writable:!0}),!r&&this.window.requestAnimationFrame?this._loop():this._synthesis++}get synthesis(){return this._synthesis}async synthesizeWhile(e){this._synthesis++,this._fulfill();let r=await e();return this._synthesis--,r}_fulfill(){for(let e of this.readCallbacks)e(),this.readCallbacks.delete(e);for(let e of this.writeCallbacks)e(),this.writeCallbacks.delete(e)}_loop(){this.window.requestAnimationFrame(()=>{this._fulfill(),this._loop()})}onread(e,r=!1){if(r)return new Promise(t=>{this.synthesis?t(e()):this.readCallbacks.add(()=>{t(e())})});this.synthesis?Promise.resolve().then(e):this.readCallbacks.add(e)}onwrite(e,r=!1){if(r)return new Promise(t=>{this.synthesis?t(e()):this.writeCallbacks.add(()=>{t(e())})});this.synthesis?Promise.resolve().then(e):this.writeCallbacks.add(e)}cycle(e,r,t){this.onread(()=>{let i=e(t),o=s=>{s!==void 0&&this.onwrite(()=>{let l=r(s,t),a=f=>{f!==void 0&&this.cycle(e,r,f)};l instanceof Promise?l.then(a):a(l)})};i instanceof Promise?i.then(o):o(i)})}};var T=class{constructor(e){this.content=e,this.type=typeof e=="string"?"selector":"instance",this.kind=this.type==="instance"?null:Oe(e)?"xpath":"css",this.kind==="xpath"&&(this.isXpathAttr=Se(e.trim().slice(1,-1),"@").length>1)}toString(){return this.content}};var U=class{constructor(e,r,t){this.context=e,this.namespace=r,this.window=e.defaultView||e.ownerDocument?.defaultView||t,this.document=this.window.document,this.webqit=this.window.webqit,Object.defineProperty(this,"#",{value:{}})}resolveArgs(e){if(b(e[0])?e=[[],...e]:v(e[0])&&!(e[0]instanceof T)&&e.length===1?e=[[],void 0,e[0]]:v(e[1])&&e.length===2?e=[E(e[0],!1),void 0,e[1]]:e[0]=E(e[0],!1),e[0].filter(r=>typeof r!="string"&&!(r instanceof T)&&!(r instanceof this.window.Node)).length)throw new Error("Argument #2 must be either a string or a Node object, or a list of those.");return e[0]=e[0].map(r=>r instanceof T?r:new T(r)),e}registry(...e){return C(this.window,"realdom",this.namespace,...e)}createSignalGenerator(){return{generate(){return this.lastController?.abort(),this.lastController=new AbortController,{signal:this.lastController.signal}},disconnect(){this.lastController?.abort()}}}forEachMatchingContext(e,r,t){let{window:i}=this,o=new Set,s=new WeakMap;for(let[l,a]of this.registry(e)){let f=[].concat(r).filter(m=>Q(i,l.context,m.target,l.params.subtree==="cross-roots",s));if(!f.length)continue;let c=[l,Array.isArray(r)?f:f[0]];a?o.add(c):t.call(i,...c)}for(let l of o)t.call(i,...l);o.clear()}disconnectables(e,...r){let t={disconnect(){r.forEach(i=>i&&b(i.disconnect)&&i.disconnect()||b(i)&&i()||v(i)&&(i.disconnected=!0))}};return e&&e.addEventListener("abort",()=>t.disconnect()),t}};var B=class extends U{type="attr";constructor(e,...r){super(e,"attr",...r)}get(e,r=void 0,t={}){let i=typeof e=="string"||e instanceof T;[e=[],r=void 0,t={}]=this.resolveArgs(arguments);let{context:o}=this,s=ke(o,e);if(!r)return s;let l=t.lifecycleSignals&&this.createSignalGenerator();if(i)for(let a of s){let f=l?l.generate():{};r(a,f,o)}else{let a=l?.generate()||{};r(s,a,o)}if(t.live){l&&(t={...t,signalGenerator:l});let a=this.observe(i?e[0]:e,r,{newValue:!0,...t});return this.disconnectables(t.signal,a)}}observe(e,r,t={}){let i=typeof e=="string"||e instanceof T;if([e=[],r,t={}]=this.resolveArgs(arguments),["sync","intercept"].includes(t.timing))return this.observeSync(i?e[0]:e,r,t);if(t.timing&&t.timing!=="async")throw new Error(`Timing option "${t.timing}" invalid.`);let{context:o,window:s,webqit:l}=this;t.eventDetails&&!l.realdom.attrInterceptionHooks?.intercepting&&Me.call(s,"intercept",()=>{});let a=new s.MutationObserver(u=>{u=He(u).map(p=>Le.call(s,p)),Ne.call(s,m,u,o)}),f={attributes:!0,attributeOldValue:t.oldValue,subtree:t.subtree&&!0};e.length&&(f.attributeFilter=e.map(u=>u+"")),a.observe(o,f);let c=t.signalGenerator||t.lifecycleSignals&&this.createSignalGenerator(),m={context:o,spec:e,callback:r,params:t,atomics:new Map,originalFilterIsString:i,signalGenerator:c,disconnectable:a};return this.disconnectables(t.signal,a,c)}observeSync(e,r,t={}){let i=typeof e=="string"||e instanceof T;[e,r,t={}]=this.resolveArgs(arguments);let{context:o,window:s}=this;if(t.timing&&!["sync","intercept"].includes(t.timing))throw new Error(`Timing option "${t.timing}" invalid.`);let l=t.timing==="intercept"?"intercept":"sync";this.registry(l).size||Me.call(s,l,u=>{this.forEachMatchingContext(l,u,Ne)});let a={disconnect(){m.delete(c)}},f=t.signalGenerator||t.lifecycleSignals&&this.createSignalGenerator(),c={context:o,spec:e,callback:r,params:t,atomics:new Map,originalFilterIsString:i,signalGenerator:f,disconnectable:a},m=this.registry(l);return m.set(c,!!c.params.deferred),this.disconnectables(t.signal,a,f)}};function He(n){return n.reduce((e,r,t)=>e[t-1]?.attributeName===r.attributeName||C(r.target,"realdom","internalAttrInteractions").get(r.attributeName)?e:e.concat(r),[])}function Ne(n,e){let{context:r,spec:t,callback:i,params:o,atomics:s,originalFilterIsString:l,signalGenerator:a}=n;if(o.subtree||(e=e.filter(u=>u.target===r)),!e.length)return;let f=t.map(u=>u+"");if(o.atomic&&!s.size?e=ke(r,t,e):o.timing!=="async"&&t.length&&(e=e.filter(u=>f.includes(u.name))),!e.length)return;o.newValue===null&&o.oldValue===null&&o.eventDetails||(e=e.map(u=>{let p;return o.eventDetails||({event:p,...u}=u),!o.oldValue&&"oldValue"in u&&({oldValue:p,...u}=u),!o.newValue&&"value"in u?{value:p,...u}=u:o.newValue&&typeof u.value>"u"&&(u={...u,value:le(u.target,u.name,()=>u.target.getAttribute(u.name))}),u})),o.atomic&&(e.forEach(u=>s.set(u.name,u)),e=Array.from(s.entries()).map(([,u])=>u));let c=l?e[0]:e,m=a?a.generate():{};i(c,m,r)}function le(n,e,r){let t=C(n,"realdom","internalAttrInteractions").get(e);C(n,"realdom","internalAttrInteractions").set(e,!0);let i=r();return C(n,"realdom","internalAttrInteractions").set(e,t),i}function ke(n,e,r=[]){let t={event:null,type:"attribute"};return e.length?e.map(o=>(o=o+"",r.find(s=>s.name===o)||{target:n,name:o,value:le(n,o,()=>n.getAttribute(o)),...t})):Array.from(n.attributes).map(o=>r.find(s=>s.name===o.nodeName)||{target:n,name:o.nodeName,value:le(n,o.nodeName,()=>o.nodeValue),...t})}function Le({target:n,attributeName:e,value:r,oldValue:t}){let s=(this.webqit.realdom.attrInterceptionRecords?.get(n)||{})[e]?.[0]||"mutation";return{target:n,name:e,value:r,oldValue:t,type:"observation",event:s}}function Me(n,e){let r=this,{webqit:t,document:i,Element:o}=r;t.realdom.attrInterceptionHooks||Object.defineProperty(t.realdom,"attrInterceptionHooks",{value:new Map}),t.realdom.attrInterceptionHooks.has(n)||t.realdom.attrInterceptionHooks.set(n,new Set),t.realdom.attrInterceptionHooks.get(n).add(e);let s=()=>t.realdom.attrInterceptionHooks.get(n).delete(e);if(t.realdom.attrInterceptionHooks?.intercepting)return s;console.warn("Attr mutation APIs are now being intercepted."),t.realdom.attrInterceptionHooks.intercepting=!0,Object.defineProperty(t.realdom,"attrInterceptionRecords",{value:new Map});let l=(c,m)=>{t.realdom.attrInterceptionRecords.has(c.target)||t.realdom.attrInterceptionRecords.set(c.target,{});let u=t.realdom.attrInterceptionRecords.get(c.target);if(u[c.name]=u[c.name]||[],u[c.name].unshift(c.event),C(c.target,"realdom","internalAttrInteractions").get(c.name))return m();t.realdom.attrInterceptionHooks.get("intercept")?.forEach(_=>_([c]));let p=m();return t.realdom.attrInterceptionHooks.get("sync")?.forEach(_=>_([c])),p};new r.MutationObserver(c=>{c=c.filter(m=>!(r.webqit.realdom.attrInterceptionRecords?.get(m.target)||{})[m.attributeName]?.shift()),c=He(c).map(m=>Le.call(r,m)),c.length&&(t.realdom.attrInterceptionHooks.get("intercept")?.forEach(m=>m(c)),t.realdom.attrInterceptionHooks.get("sync")?.forEach(m=>m(c)))}).observe(i,{attributes:!0,subtree:!0,attributeOldValue:!0});let f=Object.create(null);return["setAttribute","removeAttribute","toggleAttribute"].forEach(c=>{f[c]=o.prototype[c],o.prototype[c]=function(...m){let u,p=le(this,m[0],()=>this.getAttribute(m[0]));["setAttribute","toggleAttribute"].includes(c)&&(u=m[1]),c==="toggleAttribute"&&u===void 0&&(u=p===null);let _={target:this,name:m[0],value:u,oldValue:p,type:"interception",event:[this,c]};return l(_,()=>f[c].call(this,...m))}}),s}var te=class extends U{constructor(e,...r){super(e,"tree",...r)}attr(e,r=void 0,t={}){let{context:i,window:o}=this;return new B(i,o).get(...arguments)}query(e,r=void 0,t={}){[e,r=void 0,t={}]=this.resolveArgs(arguments);let{context:i}=this,o=new Map,s=f=>(o.has(f)||o.set(f,{target:f,entrants:[],exits:[],type:"query",event:null}),o.get(f));if(!t.generation||t.generation==="entrants"){if(!e.length)[...i.children].forEach(f=>s(i).entrants.push(f));else if(e.every(f=>f.type==="selector")){let[f,c]=e.reduce(([u,p],_)=>_.kind==="xpath"?[u,p.concat(_)]:[u.concat(_),p],[[],[]]),m=[];t.subtree?(f.length&&m.push(...i.querySelectorAll(f.join(","))),c.length&&m.push(...ne(this.window,i,c))):(f.length&&m.push(...[...i.children].filter(u=>u.matches(f))),c.length&&m.push(...ne(this.window,i,c,!1))),m.forEach(u=>s(u.parentNode||i).entrants.push(u))}}if(!r)return o;let l={disconnected:!1},a=r&&t.lifecycleSignals&&this.createSignalGenerator();for(let[,f]of o){if(l.disconnected)break;let c=a?.generate()||{};r(f,c,i)}if(t.live){a&&(t={...t,signalGenerator:a});let f=this.observe(e,r,t);return this.disconnectables(t.signal,l,f)}return this.disconnectables(t.signal,l,a)}children(e,r=void 0,t={}){return[e,r=void 0,t={}]=this.resolveArgs(arguments),this.query(e,r,{...t,subtree:!1})}subtree(e,r=void 0,t={}){return[e,r=void 0,t={}]=this.resolveArgs(arguments),this.query(e,r,{...t,subtree:!0})}observe(e,r,t={}){if([e,r,t={}]=this.resolveArgs(arguments),["sync","intercept"].includes(t.timing))return this.observeSync(e,r,t);if(t.timing&&t.timing!=="async")throw new Error(`Timing option "${t.timing}" invalid.`);let{context:i,window:o,webqit:s,document:l}=this;t.eventDetails&&(s.realdom.domInterceptionRecordsAlwaysOn=!0),(l.readyState==="loading"||s.realdom.domInterceptionRecordsAlwaysOn)&&!s.realdom.domInterceptionHooks?.intercepting&&Fe.call(o,"sync",()=>{});let a=new o.MutationObserver(m=>m.forEach(u=>{ye.call(o,c,De.call(o,u),i)}));a.observe(i,{childList:!0,subtree:t.subtree&&!0});let f=t.signalGenerator||t.lifecycleSignals&&this.createSignalGenerator(),c={context:i,spec:e,callback:r,params:t,signalGenerator:f,disconnectable:a};if(t.staticSensitivity){let m=je.call(o,c);return this.disconnectables(t.signal,a,f,m)}return this.disconnectables(t.signal,a,f)}observeSync(e,r,t={}){[e,r,t={}]=this.resolveArgs(arguments);let{context:i,window:o}=this;if(t.timing&&!["sync","intercept"].includes(t.timing))throw new Error(`Timing option "${t.timing}" invalid.`);let s=t.timing==="intercept"?"intercept":"sync";this.registry(s).size||Fe.call(o,s,u=>{this.forEachMatchingContext(s,u,ye)});let l=new o.MutationObserver(u=>u.forEach(p=>{Array.isArray((p=De.call(o,p)).event)||ye.call(o,c,p,i)}));l.observe(i,{childList:!0,subtree:t.subtree&&!0});let a={disconnect(){m.delete(c),l.disconnect()}},f=t.signalGenerator||t.lifecycleSignals&&this.createSignalGenerator(),c={context:i,spec:e,callback:r,params:t,signalGenerator:f,disconnectable:a},m=this.registry(s);if(m.set(c,!!c.params.deferred),t.staticSensitivity){let u=je.call(o,c);return this.disconnectables(t.signal,a,f,u)}return this.disconnectables(t.signal,a,f)}track(e,r,t={}){return t={subtree:!0,...t},this.observe(e,i=>{i.entrants.length&&r(!0,Array.isArray(e)?i.entrants:i.entrants[0]),i.exits.length&&r(!1,Array.isArray(e)?i.exits:i.exits[0])},t)}};function je(n){let e=this,{context:r,spec:t,callback:i,params:o,signalGenerator:s}=n,l=t.filter(p=>p.kind==="css"),a=p=>p.match(/\.([\w-]+)/g)?.length?["class"]:[],f=p=>p.match(/#([\w-]+)/g)?.length?["id"]:[],c=p=>[...p.matchAll(/\[([^\=\]]+)(\=[^\]]+)?\]/g)].map(_=>_[1]).concat(a(p)).concat(f(p));if(!(n.$attrs=Array.from(new Set(l.filter(p=>(p+"").includes("[")).reduce((p,_)=>p.concat(c(_+"")),[])))).length)return;let m=new Set,u=new Set;return m.push=p=>(u.delete(p),m.add(p)),u.push=p=>(m.delete(p),u.add(p)),n.$deliveryCache={entrants:m,exits:u},new B(r,e).observe(n.$attrs,p=>{let _=new Map,x=y=>(_.has(y)||_.set(y,{target:y,entrants:[],exits:[],type:"static",event:null}),_.get(y)),H=new WeakMap,d=y=>(H.has(y)||H.set(y,l.some($=>y.matches($+""))),H.get(y));for(let y of p)["entrants","exits"].forEach($=>{o.generation&&$!==o.generation||n.$deliveryCache[$].has(y.target)||($==="entrants"?!d(y.target):d(y.target))||(n.$deliveryCache[$].push(y.target),x(y.target)[$].push(y.target),x(y.target).event=y.event)});for(let[,y]of _){let $=s?.generate()||{};i(y,$,r)}},{subtree:o.subtree,timing:o.timing,eventDetails:o.eventDetails})}function ye(n,e){let{context:r,spec:t,callback:i,params:o,signalGenerator:s,$deliveryCache:l}=n,a={...e,entrants:[],exits:[]};if(o.eventDetails||delete a.event,["entrants","exits"].forEach(c=>{if(!(o.generation&&c!==o.generation)&&(t.length?a[c]=mt.call(this,t,o.subtree==="cross-roots",e[c],e.event!=="parse"):a[c]=[...e[c]],!!l))for(let m of a[c])l[c].push(m)}),!a.entrants.length&&!a.exits.length)return;let f=s?.generate()||{};i(a,f,r)}function mt(n,e,r,t){r=Array.isArray(r)?r:[...r];let i=(o,s)=>{if(s.type==="selector"){let l=s.isXpathAttr?[]:o.filter(a=>s.kind==="xpath"?Ae(this,a,s+""):a.matches&&a.matches(s+""));if((t||s.isXpathAttr)&&(l=o.reduce((a,f)=>s.kind==="xpath"?[...a,...ne(this,f,s,t)]:f.querySelectorAll?[...a,...f.querySelectorAll(s+"")]:a,l)),l.length)return l}else if(o.includes(s.content)||t&&o.some(l=>Q(this,l,s.content,e)))return[s.content]};return r.$$searchCache||(r.$$searchCache=new Map),n.reduce((o,s)=>{let l;return r.$$searchCache.has(s.content)?l=r.$$searchCache.get(s.content):(l=i(r,s)||[],s.type==="instance"&&r.$$searchCache.set(s.content,l)),o.concat(l)},[])}function De({target:n,addedNodes:e,removedNodes:r}){let t=this,i;return i=E(e).reduce((o,s)=>o||t.webqit.realdom.domInterceptionRecords?.get(s),null),i=E(r).reduce((o,s)=>o||t.webqit.realdom.domInterceptionRecords?.get(s),i),i=i||t.document.readyState==="loading"&&"parse"||"mutation",{target:n,entrants:e,exits:r,type:"observation",event:i}}function Fe(n,e){let r=this,{webqit:t,document:i,Node:o,CharacterData:s,Element:l,HTMLElement:a,HTMLTemplateElement:f,DocumentFragment:c}=r;t.realdom.domInterceptionHooks||Object.defineProperty(t.realdom,"domInterceptionHooks",{value:new Map}),t.realdom.domInterceptionNoRecurse||Object.defineProperty(t.realdom,"domInterceptionNoRecurse",{value:new Map}),t.realdom.domInterceptionHooks.has(n)||t.realdom.domInterceptionHooks.set(n,new Set),t.realdom.domInterceptionHooks.get(n).add(e);let m=()=>t.realdom.domInterceptionHooks.get(n).delete(e);if(t.realdom.domInterceptionHooks?.intercepting)return m;console.warn("DOM mutation APIs are now being intercepted."),t.realdom.domInterceptionHooks.intercepting=!0,Object.defineProperty(t.realdom,"domInterceptionRecords",{value:new Map});let u=(d,y,$)=>{t.realdom.domInterceptionNoRecurse.set(d,y);let h=$();return t.realdom.domInterceptionNoRecurse.delete(d),h},p=(d,y)=>{d.entrants.concat(d.exits).forEach(h=>{clearTimeout(t.realdom.domInterceptionRecords.get(h)?.timeout),t.realdom.domInterceptionRecords.set(h,d.event);let w=setTimeout(()=>{t.realdom.domInterceptionRecords.delete(h)},0);Object.defineProperty(d.event,"timeout",{value:w,configurable:!0})}),t.realdom.domInterceptionHooks.get("intercept")?.forEach(h=>h(d));let $=y();return t.realdom.domInterceptionHooks.get("sync")?.forEach(h=>h(d)),$},_={ShadowRoot:["innerHTML","setHTMLUnsafe"],DocumentFragment:["replaceChildren","append","prepend"],Document:["replaceChildren","append","prepend"],HTMLElement:["outerText","innerText"],Element:["append","prepend","before","after","insertAdjacentElement","insertAdjacentHTML","remove","replaceChildren","replaceWith","setHTMLUnsafe","innerHTML","outerHTML"],CharacterData:["before","after","remove","replaceWith"],Node:["insertBefore","replaceChild","removeChild","appendChild","textContent","nodeValue"]},x={ShadowRoot:Object.create(null),DocumentFragment:Object.create(null),Document:Object.create(null),HTMLElement:Object.create(null),Element:Object.create(null),CharacterData:Object.create(null),Node:Object.create(null)};return new Set(Object.values(_).reduce((d,y)=>d.concat(y),[])).forEach(d=>{Object.keys(_).forEach(h=>{if(!_[h].includes(d))return;let w=Object.getOwnPropertyDescriptor(r[h].prototype,d);!w||(Object.defineProperty(r[h].prototype,d,"value"in w?{...w,value:y}:{...w,set:$}),x[h][d]=w)});function y(...h){let w=Object.keys(x).find(M=>this instanceof r[M]&&d in x[M]),I=x[w],q=()=>I[d].value.call(this,...h);if(t.realdom.domInterceptionNoRecurse.get(this)===d)return q();let A=[],O=[],N=this;["insertBefore"].includes(d)?O=[h[0]]:["insertAdjacentElement","insertAdjacentHTML"].includes(d)?(O=[h[1]],["beforebegin","afterend"].includes(h[0])&&(N=this.parentNode)):["setHTMLUnsafe","replaceChildren"].includes(d)?(A=[...this.childNodes],O=d==="replaceChildren"?[...h]:[h[0]]):["replaceWith","remove"].includes(d)?(A=[this],O=d==="replaceWith"?[...h]:[],N=this.parentNode):["replaceChild"].includes(d)?(A=[h[1]],O=[h[0]]):["removeChild"].includes(d)?A=[...h]:(O=[...h],["before","after"].includes(d)&&(N=this.parentNode));let re=d;if(["insertAdjacentHTML","setHTMLUnsafe"].includes(d)){let M=this.nodeName;if(d==="insertAdjacentHTML"&&["beforebegin","afterend"].includes(h[0])){if(!this.parentNode)return I[d].value.call(this,...h);M=this.parentNode.nodeName}let F=i.createElement(M.includes("-")?"div":M);I.setHTMLUnsafe.value.call(F,O[0],d==="setHTMLUnsafe"?h[1]:{}),O=[...F.childNodes],d==="insertAdjacentHTML"?(re="insertAdjacentElement",h[1]=new c,u(h[1],"append",()=>h[1].append(...F.childNodes))):(re="replaceChildren",h=[...F.childNodes])}return N?p({target:N,entrants:O,exits:A,type:"interception",event:[this,d]},()=>I[re].value.call(this,...h)):q()}function $(h){let w=Object.keys(x).find(R=>this instanceof r[R]&&d in x[R]),I=x[w],q=()=>I[d].set.call(this,h);if(this instanceof HTMLScriptElement||t.realdom.domInterceptionNoRecurse.get(this)===d)return q();let A=[],O=[],N=this;if(["outerHTML","outerText"].includes(d)?(A=[this],N=this.parentNode):this instanceof f?(N=this.content,A=[...this.content.childNodes]):A=[...this.childNodes],["outerHTML","innerHTML"].includes(d)){let R=this.nodeName;if(d==="outerHTML"){if(!this.parentNode)return q();R=this.parentNode.nodeName}let M=i.createElement(R.includes("-")?"div":R);if(u(M,d,()=>M[d]=h),O=this instanceof f?[...M.content.childNodes]:[...M.childNodes],this instanceof f&&this.hasAttribute("src")||this instanceof ShadowRoot){let F=W=>W.reduce((L,j)=>j instanceof HTMLScriptElement?L.concat(j):j instanceof f?L.concat(F([j.content])):(L=L.concat(F([...j.querySelectorAll?.("template")||[]].map(Xe=>Xe.content))),L.concat(...j.querySelectorAll?.("script")||[])),[]);for(let W of F(O)){if(this instanceof ShadowRoot){W.setAttribute("data-handling","manual");continue}let L=i.createElement("script");[...W.attributes].forEach(j=>L.setAttribute(j.name,j.value)),L.textContent=W.textContent,u(W,"replaceWith",()=>W.replaceWith(L))}}d==="outerHTML"?(h=new c,u(h,"append",()=>h.append(...O)),q=()=>u(this,"replaceWith",()=>l.prototype.replaceWith.call(this,h))):this instanceof f?q=()=>u(this.content,"replaceChildren",()=>this.content.replaceChildren(...O)):q=()=>u(this,"replaceChildren",()=>l.prototype.replaceChildren.call(this,...O))}return p({target:N,entrants:O,exits:A,type:"interception",event:[this,d]},q)}}),m}function Be(){dt.call(this),pt.call(this),ht.call(this)}function dt(){let n=this;n.CSS||(n.CSS={}),n.CSS.escape||(n.CSS.escape=e=>e.replace(/([\:@\~\$\&])/g,"\\$1"))}function pt(){let n=this;"isConnected"in n.Node.prototype||Object.defineProperty(n.Node.prototype,"isConnected",{get:function(){return!this.ownerDocument||!(this.ownerDocument.compareDocumentPosition(this)&this.DOCUMENT_POSITION_DISCONNECTED)}})}function ht(){let n=this;n.Element.prototype.matches||(n.Element.prototype.matches=n.Element.prototype.matchesSelector||n.Element.prototype.mozMatchesSelector||n.Element.prototype.msMatchesSelector||n.Element.prototype.oMatchesSelector||n.Element.prototype.webkitMatchesSelector||function(e){for(var r=(this.document||this.ownerDocument).querySelectorAll(e),t=r.length;--t>=0&&r.item(t)!==this;);return t>-1})}function Re(){let n=this;if(n.webqit||(n.webqit={}),n.webqit.realdom)return n.webqit.realdom;n.webqit.realdom={},Be.call(n),n.webqit.realdom.meta=(...r)=>gt.call(n,...r),n.webqit.realdom.ready=(...r)=>we.call(n,...r),n.webqit.realdom.realtime=(r,t="dom")=>{if(t==="dom")return new te(r,n);if(t==="attr")return new B(r,n)};let e=new ee(n);return n.webqit.realdom.schedule=(r,...t)=>e[`on${r}`](...t),n.webqit.realdom.synthesizeWhile=(...r)=>e.synthesizeWhile(...r),n.webqit.realdom}function we(...n){let e="interactive",r;G(n[0])?(e=n[0],b(n[1])&&(r=n[1])):b(n[0])&&(r=n[0]);let t={interactive:["interactive","complete"],complete:["complete"]};if(!t[e])throw new Error(`Invalid ready-state timing: ${e}.`);let i=this;if(!r)return i.webqit.realdom.readyStatePromises||(i.webqit.realdom.readyStatePromises={interactive:new Promise(o=>we.call(this,"interactive",o)),complete:new Promise(o=>we.call(this,"complete",o))}),i.webqit.realdom.readyStatePromises[e];if(t[e].includes(i.document.readyState))return r(i);i.webqit.realdom.readyStateCallbacks||(i.webqit.realdom.readyStateCallbacks={interactive:[],complete:[]},i.document.addEventListener("readystatechange",()=>{let o=i.document.readyState;for(let s of i.webqit.realdom.readyStateCallbacks[o].splice(0))s(i)},!1)),i.webqit.realdom.readyStateCallbacks[e].push(r)}function gt(n){let e=this,r={},t;return(t=e.document.querySelector(`meta[name="${n}"]`))&&(r=(t.content||"").split(";").filter(i=>i).reduce((i,o)=>{let s=o.split("=").map(l=>l.trim());return ge(i,s[0].split("."),s[1]==="true"?!0:s[1]==="false"?!1:P(s[1])?parseInt(s[1]):s[1]),i},{})),{get name(){return n},get content(){return t.content},json(){return JSON.parse(JSON.stringify(r))}}}function ae(n,e){return typeof n!="string"?n:n.replace(/\w\S*/g,function(r){return r.charAt(0).toUpperCase()+(typeof e!==void 0&&e?r.substr(1).toLowerCase():r.substr(1))})}var X=(n,...e)=>C(n,"oohtml",...e),wt={};function Ue(n,e,r){let t=this,i=Re.call(t);wt.window=t,t.webqitConfig||(t.webqitConfig=i.meta("webqit").json()),t.webqit||(t.webqit={}),t.webqit.oohtml||(t.webqit.oohtml={}),t.webqit.oohtml.configs||(t.webqit.oohtml.configs={});let o=n.toUpperCase().replace("-","_");if(!t.webqit.oohtml.configs[o]){t.webqit.oohtml.configs[o]={};let s=t.webqit.oohtml.configs[o];Z(2,s,r,e,i.meta(n).json()),t.webqitConfig.prefix&&Object.keys(s).forEach(l=>{Object.keys(s[l]).forEach(a=>{l==="api"&&typeof s[l][a]=="string"?s[l][a]=`${t.webqitConfig.prefix}${ae(s[l][a])}`:["attr","elements"].includes(l)&&s[l][a]?.startsWith("data-")===!1&&(s[l][a]=`${t.webqitConfig.prefix}-${s[l][a]}`)})})}return{config:t.webqit.oohtml.configs[o],realdom:i,window:t}}function fe(n,e){return[...n].reduce(([r,t,i],o)=>!r&&t===0&&(Array.isArray(e)?e:[e]).includes(o)?[r,t,[""].concat(i)]:(!r&&["(","[","{"].includes(o)&&!i[0].endsWith("\\")&&t++,!r&&[")","]","}"].includes(o)&&!i[0].endsWith("\\")&&t--,['"',"'","`"].includes(o)&&!i[0].endsWith("\\")&&(r=r===o?null:r||o),i[0]+=o,[r,t,i]),[null,0,[""]])[2].reverse()}function ve(n={}){let{config:e,window:r}=Ue.call(this,"data-binding",n,{attr:{render:"render",itemIndex:"data-key"},tokens:{nodeType:"processing-instruction",tagStart:"?{",tagEnd:"}?",stateStart:"; [=",stateEnd:"]"},advanced:$e({runtimeParams:{spec:{handler:i=>{}}}})});({CONTEXT_API:e.CONTEXT_API,BINDINGS_API:e.BINDINGS_API,HTML_IMPORTS:e.HTML_IMPORTS}=r.webqit.oohtml.configs),e.attrSelector=`[${r.CSS.escape(e.attr.render)}]`;let t=(i,o)=>{let s=`starts-with(., "${i}")`,l=`substring(., string-length(.) - string-length("${o}") + 1) = "${o}"`;return`${s} and ${l}`};e.discreteBindingsSelector=`comment()[${t(e.tokens.tagStart,e.tokens.tagEnd)}]`,xt.call(r,e)}function xt(n){let e=this,{webqit:{realdom:r}}=e;r.realtime(e.document).query(n.attrSelector,t=>{Ve.call(this,...t.exits),Ot.call(e,n,...t.entrants),queueMicrotask(()=>{})},{id:"data-binding:attr",live:!0,subtree:"cross-roots",timing:"sync",eventDetails:!0,staticSensitivity:!0}),r.realtime(e.document).query(`(${n.discreteBindingsSelector})`,t=>{Ve.call(this,...t.exits),vt.call(e,n,...t.entrants),queueMicrotask(()=>{})},{id:"data-binding:descrete",live:!0,subtree:"cross-roots",timing:"sync"})}function Ge(n,e){let{webqit:{realdom:r,Observer:t,DOMBindingsContext:i}}=this;if(X(e).has("data-binding"))return X(e).get("data-binding");let o=Object.create(null),s=new AbortController;o.$exec__=(a,f,...c)=>{(()=>{try{a[f](...c)}catch(u){throw new Error(`Error executing "${f}()": ${u.message} at ${u.cause}`)}})()},o.$assign__=(a,f,c)=>{(()=>{try{a[f]=c}catch(u){throw new Error(`Error executing "${f} = ${c}": ${u.message} at ${u.cause}`)}})()},t.intercept(o,{get:(a,f,c)=>{if(!(a.key in o)){let m={...i.createRequest(a.key),live:!0,signal:s.signal};e[n.CONTEXT_API.api.contexts].request(m,u=>{t.set(o,a.key,u)})}return c(o[a.key]??(a.key in globalThis?globalThis[a.key]:void 0))},has:(a,f,c)=>c(!0)});let l={scope:o,abortController:s,bindings:new Map};return X(e).set("data-binding",l),l}function Ve(...n){for(let e of n){let r=e.nodeName==="#text"?e.parentNode:e,{bindings:t,abortController:i}=X(r).get("data-binding")||{};if(!t?.has(e))return;t.get(e).liveProgramHandle.abort(),t.get(e).signals?.forEach(o=>o.abort()),t.delete(e),t.size||(i.abort(),X(r).delete("data-binding"))}}function bt(n,e){let r=n.tokens.tagStart.split("").map(f=>`\\${f}`).join(""),t=n.tokens.tagEnd.split("").map(f=>`\\${f}`).join(""),i=n.tokens.stateStart.split("").map(f=>f===" "?"(?:\\s+)?":`\\${f}`).join(""),o=n.tokens.stateEnd.split("").map(f=>`\\${f}`).join(""),s=`^${r}(.*?)(?:${i}(\\d+)${o}(?:\\s+)?)?${t}$`,[,l,a]=e.match(new RegExp(s));return{raw:e,expr:l,span:parseInt(a??0)}}async function vt(n,...e){let r=this,t=e.reduce((i,o)=>{if(o.isBound)return i;let s=bt(n,o.nodeValue),l=o;if(s.span){if(l=o.nextSibling,l?.nodeName!=="#text"||l.nodeValue.length<s.span)return i;l.nodeValue.length>s.span&&l.splitText(s.span)}else l=o.ownerDocument.createTextNode(""),o.after(l);l.isBound=!0;let a=o;return r.webqit.env!=="server"&&(a.remove(),a=null),i.concat({textNode:l,template:s,anchorNode:a})},[]);for(let{textNode:i,template:o,anchorNode:s}of t){let l=$t.call(r,n,o.expr),{scope:a,bindings:f}=Ge.call(this,n,i.parentNode);Object.defineProperty(i,"$oohtml_internal_databinding_anchorNode",{value:s,configurable:!0});try{f.set(i,{liveProgramHandle:await(await l.bind(i,a)).execute()})}catch(c){console.log(c)}}}var xe=new Map;function $t(n,e){if(xe.has(e))return xe.get(e);let r=`let content = ((${e}) ?? '') + '';`;r+="$assign__(this, 'nodeValue', content);",r+=`if ( this.$oohtml_internal_databinding_anchorNode ) { $assign__(this.$oohtml_internal_databinding_anchorNode, 'nodeValue', "${n.tokens.tagStart}${z(e)}${n.tokens.stateStart}" + content.length + "${n.tokens.stateEnd} ${n.tokens.tagEnd}"); }`;let{webqit:{LiveScript:t,AsyncLiveScript:i}}=this,{parserParams:o,compilerParams:s,runtimeParams:l}=n.advanced,a=new(t||i)(r,{parserParams:o,compilerParams:s,runtimeParams:l});return xe.set(e,a),a}async function Ot(n,...e){for(let r of e){let t=At.call(this,n,r.getAttribute(n.attr.render)),{scope:i,bindings:o}=Ge.call(this,n,r),s=[];Object.defineProperty(r,"$oohtml_internal_databinding_signals",{value:s,configurable:!0});try{o.set(r,{signals:s,liveProgramHandle:await(await t.bind(r,i)).execute()})}catch(l){console.log(l)}}}var be=new Map;function At(n,e){if(be.has(e))return be.get(e);let r={},t=-1,i=fe(e,";").map(m=>{let[u,p]=fe(m,":").map(y=>y.trim()),_=u[0],x=u.slice(1).trim(),H=`(${p})`,d=`(${H} ?? '')`;if(_==="&")return x.startsWith("--")?`$exec__(this.style, 'setProperty', "${z(x)}", ${d});`:`$assign__(this.style, "${z(x)}", ${d});`;if(_==="%")return`$exec__(this.classList, 'toggle', "${z(x)}", !!${H});`;if(_==="~")return x.startsWith("?")?`$exec__(this, 'toggleAttribute', "${z(x.substring(1).trim())}", !!${H});`:`$exec__(this, 'setAttribute', "${z(x)}", ${d});`;if(_==="#"){if(r[x])throw new Error(`Duplicate binding: ${u}.`);if(r[x]=!0,x==="text")return`$assign__(this, 'textContent', ${d});`;if(x==="html")return`$assign__(this, 'innerHTML', ${d});`;if(x==="items"){let[y,$]=fe(p,"/");if(!$)throw new Error(`Invalid ${_}items spec: ${m}; no import specifier.`);let[h,w,I,q]=y.trim().match(/(.*?[\)\s+])(of|in)([\(\{\[\s+].*)/i)||[];if(!h)throw new Error(`Invalid ${_}items spec: ${m}.`);if(w.startsWith("(")?w=w.trim().slice(1,-1).split(",").map(N=>N.trim()):w=[w],w.length>(I==="in"?3:2))throw new Error(`Invalid ${_}items spec: ${m}.`);let A=I==="in"?w[2]:w[1]||"$index__";return`
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
// node_modules/@webqit/use-live/src/params.js
|
|
2
|
+
function resolveParams(...extensions) {
|
|
3
|
+
let extension, params = { runtimeParams, transformerParams, parserParams };
|
|
4
|
+
while (extension = extensions.shift()) {
|
|
5
|
+
const {
|
|
6
|
+
runtimeParams: _runtimeParams = {},
|
|
7
|
+
transformerParams: { globalsNoObserve: _globalsNoObserve = [], globalsOnlyPathsExcept: _globalsOnlyPathsExcept = [], ..._transformerParams } = {},
|
|
8
|
+
parserParams: _parserParams = {}
|
|
9
|
+
} = extension;
|
|
10
|
+
params = {
|
|
11
|
+
runtimeParams: { ...params.runtimeParams, ..._runtimeParams },
|
|
12
|
+
transformerParams: { ...params.transformerParams, globalsNoObserve: [...params.transformerParams.globalsNoObserve, ..._globalsNoObserve], globalsOnlyPathsExcept: [...params.transformerParams.globalsOnlyPathsExcept, ..._globalsOnlyPathsExcept], ..._transformerParams },
|
|
13
|
+
parserParams: { ...params.parserParams, ..._parserParams }
|
|
14
|
+
};
|
|
15
|
+
if (extensions.devMode) {
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
return params;
|
|
19
|
+
}
|
|
20
|
+
var parserParams = {
|
|
21
|
+
ecmaVersion: "latest",
|
|
22
|
+
allowReturnOutsideFunction: true,
|
|
23
|
+
allowAwaitOutsideFunction: false,
|
|
24
|
+
allowSuperOutsideMethod: false,
|
|
25
|
+
preserveParens: false,
|
|
26
|
+
locations: true
|
|
27
|
+
};
|
|
28
|
+
var transformerParams = {
|
|
29
|
+
globalsNoObserve: ["arguments", "debugger"],
|
|
30
|
+
globalsOnlyPathsExcept: [],
|
|
31
|
+
originalSource: true,
|
|
32
|
+
locations: true,
|
|
33
|
+
compact: 2
|
|
34
|
+
};
|
|
35
|
+
var runtimeParams = {
|
|
36
|
+
apiVersion: 3
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
// node_modules/@webqit/realdom/src/realtime/Util.js
|
|
40
|
+
function isXpath(expr) {
|
|
41
|
+
return (expr = expr.trim()) && expr.startsWith("(") && expr.endsWith(")");
|
|
42
|
+
}
|
|
43
|
+
function xpathQuery(window2, context, expr, subtree = true) {
|
|
44
|
+
expr = (Array.isArray(expr) ? expr : [expr]).map((x) => (x + "").replace("(", subtree ? "(.//" : "(./")).join("|");
|
|
45
|
+
let nodes = [], node;
|
|
46
|
+
try {
|
|
47
|
+
const result = window2.document.evaluate(expr, context, null, window2.XPathResult.ANY_TYPE);
|
|
48
|
+
while (node = result.iterateNext())
|
|
49
|
+
nodes.push(node);
|
|
50
|
+
} catch (e) {
|
|
51
|
+
}
|
|
52
|
+
return nodes;
|
|
53
|
+
}
|
|
54
|
+
function xpathMatch(window2, node, expr) {
|
|
55
|
+
expr = (Array.isArray(expr) ? expr : [expr]).map((x) => (x + "").replace("(", "(self::")).join("|");
|
|
56
|
+
try {
|
|
57
|
+
return window2.document.evaluate(`${expr}`, node, null, window2.XPathResult.BOOLEAN_TYPE).booleanValue;
|
|
58
|
+
} catch (e) {
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
function containsNode(window2, a, b, crossRoots = false, testCache = null) {
|
|
62
|
+
const prevTest = testCache?.get(a)?.get(b);
|
|
63
|
+
if (typeof prevTest !== "undefined")
|
|
64
|
+
return prevTest;
|
|
65
|
+
const response = (val) => {
|
|
66
|
+
if (!testCache?.has(a))
|
|
67
|
+
testCache?.set(a, /* @__PURE__ */ new WeakMap());
|
|
68
|
+
testCache?.get(a)?.set(b, val);
|
|
69
|
+
return val;
|
|
70
|
+
};
|
|
71
|
+
const rootNodeA = a.getRootNode();
|
|
72
|
+
const rootNodeB = b.getRootNode();
|
|
73
|
+
if (rootNodeA === rootNodeB)
|
|
74
|
+
return response(a.contains(b));
|
|
75
|
+
if (crossRoots && rootNodeB instanceof window2.ShadowRoot)
|
|
76
|
+
return response(containsNode(window2, a, rootNodeB.host, crossRoots, testCache));
|
|
77
|
+
return response(false);
|
|
78
|
+
}
|
|
79
|
+
function splitOuter(str, delim = "|") {
|
|
80
|
+
return [...str].reduce(([quote, depth, splits, skip], x) => {
|
|
81
|
+
if (!quote && depth === 0 && (Array.isArray(delim) ? delim : [delim]).includes(x)) {
|
|
82
|
+
return [quote, depth, [""].concat(splits)];
|
|
83
|
+
}
|
|
84
|
+
if (!quote && ["(", "[", "{"].includes(x) && !splits[0].endsWith("\\"))
|
|
85
|
+
depth++;
|
|
86
|
+
if (!quote && [")", "]", "}"].includes(x) && !splits[0].endsWith("\\"))
|
|
87
|
+
depth--;
|
|
88
|
+
if (['"', "'", "`"].includes(x) && !splits[0].endsWith("\\")) {
|
|
89
|
+
quote = quote === x ? null : quote || x;
|
|
90
|
+
}
|
|
91
|
+
splits[0] += x;
|
|
92
|
+
return [quote, depth, splits];
|
|
93
|
+
}, [null, 0, [""]])[2].reverse();
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// node_modules/@webqit/util/js/isObject.js
|
|
97
|
+
function isObject_default(val) {
|
|
98
|
+
return !Array.isArray(val) && typeof val === "object" && val;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// node_modules/@webqit/util/js/isArray.js
|
|
102
|
+
function isArray_default(val) {
|
|
103
|
+
return Array.isArray(val);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
// node_modules/@webqit/util/js/isTypeFunction.js
|
|
107
|
+
function isTypeFunction_default(val) {
|
|
108
|
+
return typeof val === "function";
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// node_modules/@webqit/util/js/isNull.js
|
|
112
|
+
function isNull_default(val) {
|
|
113
|
+
return val === null || val === "";
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// node_modules/@webqit/util/js/isUndefined.js
|
|
117
|
+
function isUndefined_default(val) {
|
|
118
|
+
return arguments.length && (val === void 0 || typeof val === "undefined");
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
// node_modules/@webqit/util/js/isTypeObject.js
|
|
122
|
+
function isTypeObject_default(val) {
|
|
123
|
+
return Array.isArray(val) || typeof val === "object" && val || isTypeFunction_default(val);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
// node_modules/@webqit/util/js/isEmpty.js
|
|
127
|
+
function isEmpty_default(val) {
|
|
128
|
+
return isNull_default(val) || isUndefined_default(val) || val === false || val === 0 || isTypeObject_default(val) && !Object.keys(val).length;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// node_modules/@webqit/util/js/isFunction.js
|
|
132
|
+
function isFunction_default(val) {
|
|
133
|
+
return isTypeFunction_default(val) || val && {}.toString.call(val) === "[object function]";
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
// node_modules/@webqit/util/js/isNumber.js
|
|
137
|
+
function isNumber_default(val) {
|
|
138
|
+
return val instanceof Number || typeof val === "number";
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
// node_modules/@webqit/util/js/isNumeric.js
|
|
142
|
+
function isNumeric_default(val) {
|
|
143
|
+
return isNumber_default(val) || val !== true && val !== false && val !== null && val !== "" && !isNaN(val * 1);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
// node_modules/@webqit/util/js/isString.js
|
|
147
|
+
function isString_default(val) {
|
|
148
|
+
return val instanceof String || typeof val === "string" && val !== null;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
// node_modules/@webqit/util/js/isTypeArray.js
|
|
152
|
+
function isTypeArray_default(val) {
|
|
153
|
+
return !isString_default(val) && !isUndefined_default(val.length);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
// node_modules/@webqit/util/arr/pushUnique.js
|
|
157
|
+
function pushUnique_default(arr, ...items) {
|
|
158
|
+
items.forEach((itm) => {
|
|
159
|
+
if (arr.indexOf(itm) < 0) {
|
|
160
|
+
arr.push(itm);
|
|
161
|
+
}
|
|
162
|
+
});
|
|
163
|
+
return arr;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
// node_modules/@webqit/util/obj/getPrototypeChain.js
|
|
167
|
+
function getPrototypeChain_default(obj, until) {
|
|
168
|
+
until = until || Object.prototype;
|
|
169
|
+
until = until && !isArray_default(until) ? [until] : until;
|
|
170
|
+
var prototypalChain = [];
|
|
171
|
+
var obj = obj;
|
|
172
|
+
while (obj && (!until || until.indexOf(obj) < 0) && obj.name !== "default") {
|
|
173
|
+
prototypalChain.push(obj);
|
|
174
|
+
obj = obj ? Object.getPrototypeOf(obj) : null;
|
|
175
|
+
}
|
|
176
|
+
return prototypalChain;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
// node_modules/@webqit/util/obj/getAllPropertyNames.js
|
|
180
|
+
function getAllPropertyNames_default(obj, until) {
|
|
181
|
+
var keysAll = [];
|
|
182
|
+
getPrototypeChain_default(obj, until).forEach((obj2) => {
|
|
183
|
+
pushUnique_default(keysAll, ...Object.getOwnPropertyNames(obj2));
|
|
184
|
+
});
|
|
185
|
+
return keysAll;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
// node_modules/@webqit/util/obj/mergeCallback.js
|
|
189
|
+
function mergeCallback(objs, callback, deepProps = false, isReplace = false, withSymbols = false) {
|
|
190
|
+
var depth = 0;
|
|
191
|
+
var obj1 = objs.shift();
|
|
192
|
+
if (isNumeric_default(obj1) || obj1 === true || obj1 === false) {
|
|
193
|
+
depth = obj1;
|
|
194
|
+
obj1 = objs.shift();
|
|
195
|
+
}
|
|
196
|
+
if (!objs.length) {
|
|
197
|
+
throw new Error("_merge() requires two or more array/objects.");
|
|
198
|
+
}
|
|
199
|
+
objs.forEach((obj2, i) => {
|
|
200
|
+
if (!isTypeObject_default(obj2) && !isFunction_default(obj2)) {
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
203
|
+
(deepProps ? getAllPropertyNames_default(obj2) : Object.keys(obj2)).forEach((key) => {
|
|
204
|
+
if (!callback(key, obj1, obj2, i)) {
|
|
205
|
+
return;
|
|
206
|
+
}
|
|
207
|
+
var valAtObj1 = obj1[key];
|
|
208
|
+
var valAtObj2 = obj2[key];
|
|
209
|
+
if ((isArray_default(valAtObj1) && isArray_default(valAtObj2) || isObject_default(valAtObj1) && isObject_default(valAtObj2)) && (depth === true || depth > 0)) {
|
|
210
|
+
obj1[key] = isArray_default(valAtObj1) && isArray_default(valAtObj2) ? [] : {};
|
|
211
|
+
mergeCallback([isNumeric_default(depth) ? depth - 1 : depth, obj1[key], valAtObj1, valAtObj2], callback, deepProps, isReplace, withSymbols);
|
|
212
|
+
} else {
|
|
213
|
+
if (isArray_default(obj1) && isArray_default(obj2)) {
|
|
214
|
+
if (isReplace) {
|
|
215
|
+
obj1[key] = valAtObj2;
|
|
216
|
+
} else {
|
|
217
|
+
obj1.push(valAtObj2);
|
|
218
|
+
}
|
|
219
|
+
} else {
|
|
220
|
+
try {
|
|
221
|
+
if (withSymbols) {
|
|
222
|
+
Object.defineProperty(obj1, key, Object.getOwnPropertyDescriptor(obj2, key));
|
|
223
|
+
} else {
|
|
224
|
+
obj1[key] = obj2[key];
|
|
225
|
+
}
|
|
226
|
+
} catch (e) {
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
});
|
|
231
|
+
});
|
|
232
|
+
return obj1;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
// node_modules/@webqit/util/obj/merge.js
|
|
236
|
+
function merge_default(...objs) {
|
|
237
|
+
return mergeCallback(objs, (k, obj1, obj2) => {
|
|
238
|
+
return true;
|
|
239
|
+
}, false, false, false);
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
// node_modules/@webqit/util/js/wq.js
|
|
243
|
+
function wq(obj, ...namespaces) {
|
|
244
|
+
if (!obj || !["object", "function"].includes(typeof obj)) {
|
|
245
|
+
throw new Error(`Argument #1 must be of type object`);
|
|
246
|
+
}
|
|
247
|
+
let wq2 = obj[Symbol.for("wq")];
|
|
248
|
+
if (!wq2) {
|
|
249
|
+
wq2 = new WQInternals();
|
|
250
|
+
Object.defineProperty(obj, Symbol.for("wq"), {
|
|
251
|
+
value: wq2,
|
|
252
|
+
enumerable: false,
|
|
253
|
+
configurable: false,
|
|
254
|
+
writable: false
|
|
255
|
+
});
|
|
256
|
+
}
|
|
257
|
+
if (!namespaces.length) {
|
|
258
|
+
return wq2;
|
|
259
|
+
}
|
|
260
|
+
let _ns, _wq2;
|
|
261
|
+
while (_ns = namespaces.shift()) {
|
|
262
|
+
if ((_wq2 = wq2) && !(wq2 = wq2.get(_ns))) {
|
|
263
|
+
wq2 = new WQInternals();
|
|
264
|
+
_wq2.set(_ns, wq2);
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
return wq2;
|
|
268
|
+
}
|
|
269
|
+
var WQInternals = class extends Map {
|
|
270
|
+
};
|
|
271
|
+
|
|
272
|
+
// node_modules/@webqit/util/arr/from.js
|
|
273
|
+
function from_default(val, castObject = true) {
|
|
274
|
+
if (isArray_default(val)) {
|
|
275
|
+
return val;
|
|
276
|
+
}
|
|
277
|
+
;
|
|
278
|
+
if (!castObject && isObject_default(val)) {
|
|
279
|
+
return [val];
|
|
280
|
+
}
|
|
281
|
+
;
|
|
282
|
+
if (val !== false && val !== 0 && isEmpty_default(val)) {
|
|
283
|
+
return [];
|
|
284
|
+
}
|
|
285
|
+
;
|
|
286
|
+
if (isTypeArray_default(val)) {
|
|
287
|
+
return Array.prototype.slice.call(val);
|
|
288
|
+
}
|
|
289
|
+
;
|
|
290
|
+
if (isObject_default(val)) {
|
|
291
|
+
return Object.values(val);
|
|
292
|
+
}
|
|
293
|
+
;
|
|
294
|
+
return [val];
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
// node_modules/@webqit/util/obj/get.js
|
|
298
|
+
function get_default(ctxt, path, trap = {}, reciever = {}) {
|
|
299
|
+
path = from_default(path).slice();
|
|
300
|
+
var _ctxt = ctxt;
|
|
301
|
+
while (!isUndefined_default(_ctxt) && !isNull_default(_ctxt) && path.length) {
|
|
302
|
+
var _key = path.shift();
|
|
303
|
+
if (!(trap.get ? trap.get(_ctxt, _key) : isTypeObject_default(_ctxt) ? _key in _ctxt : _ctxt[_key])) {
|
|
304
|
+
reciever.exists = false;
|
|
305
|
+
return;
|
|
306
|
+
}
|
|
307
|
+
_ctxt = trap.get ? trap.get(_ctxt, _key) : _ctxt[_key];
|
|
308
|
+
}
|
|
309
|
+
reciever.exists = true;
|
|
310
|
+
return _ctxt;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
// node_modules/@webqit/util/obj/set.js
|
|
314
|
+
function set_default(obj, path, val, buildTree = {}, trap = {}) {
|
|
315
|
+
const _set = (target2, key, val2) => {
|
|
316
|
+
if (trap.set) {
|
|
317
|
+
return trap.set(target2, key, val2);
|
|
318
|
+
} else {
|
|
319
|
+
if (isNumeric_default(path[i]) && isArray_default(target2)) {
|
|
320
|
+
target2.push(val2);
|
|
321
|
+
} else {
|
|
322
|
+
target2[key] = val2;
|
|
323
|
+
}
|
|
324
|
+
return true;
|
|
325
|
+
}
|
|
326
|
+
};
|
|
327
|
+
path = from_default(path);
|
|
328
|
+
var target = obj;
|
|
329
|
+
for (var i = 0; i < path.length; i++) {
|
|
330
|
+
if (i < path.length - 1) {
|
|
331
|
+
if (!target || !isTypeObject_default(target) && !isFunction_default(target)) {
|
|
332
|
+
return false;
|
|
333
|
+
}
|
|
334
|
+
var branch = get_default(target, path[i], trap);
|
|
335
|
+
if (!isTypeObject_default(branch)) {
|
|
336
|
+
if (trap.buildTree === false) {
|
|
337
|
+
return false;
|
|
338
|
+
}
|
|
339
|
+
branch = isFunction_default(trap.buildTree) ? trap.buildTree(i) : isNumeric_default(path[i + 1]) ? [] : {};
|
|
340
|
+
var branchSuccess = _set(target, path[i], branch);
|
|
341
|
+
if (!branchSuccess) {
|
|
342
|
+
return false;
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
target = branch;
|
|
346
|
+
} else {
|
|
347
|
+
return _set(target, path[i], val);
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
// node_modules/@webqit/realdom/src/Scheduler.js
|
|
353
|
+
var Scheduler = class {
|
|
354
|
+
constructor(window2, synthesis = false) {
|
|
355
|
+
Object.defineProperty(this, "window", { value: window2 });
|
|
356
|
+
Object.defineProperty(this, "readCallbacks", { value: /* @__PURE__ */ new Set() });
|
|
357
|
+
Object.defineProperty(this, "writeCallbacks", { value: /* @__PURE__ */ new Set() });
|
|
358
|
+
Object.defineProperty(this, "_synthesis", { value: 0, writable: true });
|
|
359
|
+
if (!synthesis && this.window.requestAnimationFrame) {
|
|
360
|
+
this._loop();
|
|
361
|
+
} else {
|
|
362
|
+
this._synthesis++;
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
get synthesis() {
|
|
366
|
+
return this._synthesis;
|
|
367
|
+
}
|
|
368
|
+
async synthesizeWhile(callback) {
|
|
369
|
+
this._synthesis++;
|
|
370
|
+
this._fulfill();
|
|
371
|
+
const returnValue = await callback();
|
|
372
|
+
this._synthesis--;
|
|
373
|
+
return returnValue;
|
|
374
|
+
}
|
|
375
|
+
_fulfill() {
|
|
376
|
+
for (const callback of this.readCallbacks) {
|
|
377
|
+
callback();
|
|
378
|
+
this.readCallbacks.delete(callback);
|
|
379
|
+
}
|
|
380
|
+
for (const callback of this.writeCallbacks) {
|
|
381
|
+
callback();
|
|
382
|
+
this.writeCallbacks.delete(callback);
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
_loop() {
|
|
386
|
+
this.window.requestAnimationFrame(() => {
|
|
387
|
+
this._fulfill();
|
|
388
|
+
this._loop();
|
|
389
|
+
});
|
|
390
|
+
}
|
|
391
|
+
onread(callback, withPromise = false) {
|
|
392
|
+
if (withPromise) {
|
|
393
|
+
return new Promise((resolve) => {
|
|
394
|
+
if (this.synthesis) {
|
|
395
|
+
resolve(callback());
|
|
396
|
+
} else {
|
|
397
|
+
this.readCallbacks.add(() => {
|
|
398
|
+
resolve(callback());
|
|
399
|
+
});
|
|
400
|
+
}
|
|
401
|
+
});
|
|
402
|
+
}
|
|
403
|
+
if (this.synthesis) {
|
|
404
|
+
Promise.resolve().then(callback);
|
|
405
|
+
} else {
|
|
406
|
+
this.readCallbacks.add(callback);
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
onwrite(callback, withPromise = false) {
|
|
410
|
+
if (withPromise) {
|
|
411
|
+
return new Promise((resolve) => {
|
|
412
|
+
if (this.synthesis) {
|
|
413
|
+
resolve(callback());
|
|
414
|
+
} else {
|
|
415
|
+
this.writeCallbacks.add(() => {
|
|
416
|
+
resolve(callback());
|
|
417
|
+
});
|
|
418
|
+
}
|
|
419
|
+
});
|
|
420
|
+
}
|
|
421
|
+
if (this.synthesis) {
|
|
422
|
+
Promise.resolve().then(callback);
|
|
423
|
+
} else {
|
|
424
|
+
this.writeCallbacks.add(callback);
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
cycle(onread, onwrite, prevTransaction) {
|
|
428
|
+
this.onread(() => {
|
|
429
|
+
const readReturn = onread(prevTransaction);
|
|
430
|
+
const callWrite = (readReturn2) => {
|
|
431
|
+
if (readReturn2 === void 0)
|
|
432
|
+
return;
|
|
433
|
+
this.onwrite(() => {
|
|
434
|
+
const writeReturn = onwrite(readReturn2, prevTransaction);
|
|
435
|
+
const repeatTransaction = (writeReturn2) => {
|
|
436
|
+
if (writeReturn2 === void 0)
|
|
437
|
+
return;
|
|
438
|
+
this.cycle(onread, onwrite, writeReturn2);
|
|
439
|
+
};
|
|
440
|
+
if (writeReturn instanceof Promise) {
|
|
441
|
+
writeReturn.then(repeatTransaction);
|
|
442
|
+
} else {
|
|
443
|
+
repeatTransaction(writeReturn);
|
|
444
|
+
}
|
|
445
|
+
});
|
|
446
|
+
};
|
|
447
|
+
if (readReturn instanceof Promise) {
|
|
448
|
+
readReturn.then(callWrite);
|
|
449
|
+
} else {
|
|
450
|
+
callWrite(readReturn);
|
|
451
|
+
}
|
|
452
|
+
});
|
|
453
|
+
}
|
|
454
|
+
};
|
|
455
|
+
|
|
456
|
+
// node_modules/@webqit/realdom/src/realtime/DOMSpec.js
|
|
457
|
+
var DOMSpec = class {
|
|
458
|
+
constructor(content) {
|
|
459
|
+
this.content = content;
|
|
460
|
+
this.type = typeof content === "string" ? "selector" : "instance";
|
|
461
|
+
this.kind = this.type === "instance" ? null : isXpath(content) ? "xpath" : "css";
|
|
462
|
+
if (this.kind === "xpath") {
|
|
463
|
+
this.isXpathAttr = splitOuter(content.trim().slice(1, -1), "@").length > 1;
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
toString() {
|
|
467
|
+
return this.content;
|
|
468
|
+
}
|
|
469
|
+
};
|
|
470
|
+
|
|
471
|
+
// node_modules/@webqit/realdom/src/realtime/Realtime.js
|
|
472
|
+
var Realtime = class {
|
|
473
|
+
constructor(context, namespace, window2) {
|
|
474
|
+
this.context = context;
|
|
475
|
+
this.namespace = namespace;
|
|
476
|
+
this.window = context.defaultView || context.ownerDocument?.defaultView || window2;
|
|
477
|
+
this.document = this.window.document;
|
|
478
|
+
this.webqit = this.window.webqit;
|
|
479
|
+
Object.defineProperty(this, "#", { value: {} });
|
|
480
|
+
}
|
|
481
|
+
resolveArgs(args) {
|
|
482
|
+
if (isFunction_default(args[0])) {
|
|
483
|
+
args = [[], ...args];
|
|
484
|
+
} else if (isObject_default(args[0]) && !(args[0] instanceof DOMSpec) && args.length === 1) {
|
|
485
|
+
args = [[], void 0, args[0]];
|
|
486
|
+
} else if (isObject_default(args[1]) && args.length === 2) {
|
|
487
|
+
args = [from_default(args[0], false), void 0, args[1]];
|
|
488
|
+
} else {
|
|
489
|
+
args[0] = from_default(args[0], false);
|
|
490
|
+
}
|
|
491
|
+
if (args[0].filter((x) => typeof x !== "string" && !(x instanceof DOMSpec) && !(x instanceof this.window.Node)).length) {
|
|
492
|
+
throw new Error(`Argument #2 must be either a string or a Node object, or a list of those.`);
|
|
493
|
+
}
|
|
494
|
+
args[0] = args[0].map((s) => s instanceof DOMSpec ? s : new DOMSpec(s));
|
|
495
|
+
return args;
|
|
496
|
+
}
|
|
497
|
+
registry(...args) {
|
|
498
|
+
return wq(this.window, "realdom", this.namespace, ...args);
|
|
499
|
+
}
|
|
500
|
+
createSignalGenerator() {
|
|
501
|
+
return {
|
|
502
|
+
generate() {
|
|
503
|
+
this.lastController?.abort();
|
|
504
|
+
this.lastController = new AbortController();
|
|
505
|
+
const flags = { signal: this.lastController.signal };
|
|
506
|
+
return flags;
|
|
507
|
+
},
|
|
508
|
+
disconnect() {
|
|
509
|
+
this.lastController?.abort();
|
|
510
|
+
}
|
|
511
|
+
};
|
|
512
|
+
}
|
|
513
|
+
forEachMatchingContext(interceptionTiming, record_s, callback) {
|
|
514
|
+
const { window: window2 } = this, deferreds = /* @__PURE__ */ new Set(), testCache = /* @__PURE__ */ new WeakMap();
|
|
515
|
+
for (const [registration, deferred] of this.registry(interceptionTiming)) {
|
|
516
|
+
let $records = [].concat(record_s).filter((record) => containsNode(window2, registration.context, record.target, registration.params.subtree === "cross-roots", testCache));
|
|
517
|
+
if (!$records.length)
|
|
518
|
+
continue;
|
|
519
|
+
const args = [registration, Array.isArray(record_s) ? $records : $records[0]];
|
|
520
|
+
if (deferred)
|
|
521
|
+
deferreds.add(args);
|
|
522
|
+
else
|
|
523
|
+
callback.call(window2, ...args);
|
|
524
|
+
}
|
|
525
|
+
for (const args of deferreds)
|
|
526
|
+
callback.call(window2, ...args);
|
|
527
|
+
deferreds.clear();
|
|
528
|
+
}
|
|
529
|
+
disconnectables(signal, ...objects) {
|
|
530
|
+
const disconnectable = { disconnect() {
|
|
531
|
+
objects.forEach((d) => d && isFunction_default(d.disconnect) && d.disconnect() || isFunction_default(d) && d() || isObject_default(d) && (d.disconnected = true));
|
|
532
|
+
} };
|
|
533
|
+
if (signal)
|
|
534
|
+
signal.addEventListener("abort", () => disconnectable.disconnect());
|
|
535
|
+
return disconnectable;
|
|
536
|
+
}
|
|
537
|
+
};
|
|
538
|
+
|
|
539
|
+
// node_modules/@webqit/realdom/src/realtime/AttrRealtime.js
|
|
540
|
+
var AttrRealtime = class extends Realtime {
|
|
541
|
+
type = "attr";
|
|
542
|
+
constructor(context, ...args) {
|
|
543
|
+
super(context, "attr", ...args);
|
|
544
|
+
}
|
|
545
|
+
get(spec, callback = void 0, params = {}) {
|
|
546
|
+
const originalFilterIsString = typeof spec === "string" || spec instanceof DOMSpec;
|
|
547
|
+
[spec = [], callback = void 0, params = {}] = this.resolveArgs(arguments);
|
|
548
|
+
const { context } = this;
|
|
549
|
+
const records = attrIntersection(context, spec);
|
|
550
|
+
if (!callback)
|
|
551
|
+
return records;
|
|
552
|
+
const signalGenerator = params.lifecycleSignals && this.createSignalGenerator();
|
|
553
|
+
if (!originalFilterIsString) {
|
|
554
|
+
const flags = signalGenerator?.generate() || {};
|
|
555
|
+
callback(records, flags, context);
|
|
556
|
+
} else {
|
|
557
|
+
for (const record of records) {
|
|
558
|
+
const flags = signalGenerator ? signalGenerator.generate() : {};
|
|
559
|
+
callback(record, flags, context);
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
if (params.live) {
|
|
563
|
+
if (signalGenerator) {
|
|
564
|
+
params = { ...params, signalGenerator };
|
|
565
|
+
}
|
|
566
|
+
const disconnectable_live = this.observe(originalFilterIsString ? spec[0] : spec, callback, { newValue: true, ...params });
|
|
567
|
+
return this.disconnectables(params.signal, disconnectable_live);
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
observe(spec, callback, params = {}) {
|
|
571
|
+
const originalFilterIsString = typeof spec === "string" || spec instanceof DOMSpec;
|
|
572
|
+
[spec = [], callback, params = {}] = this.resolveArgs(arguments);
|
|
573
|
+
if (["sync", "intercept"].includes(params.timing))
|
|
574
|
+
return this.observeSync(originalFilterIsString ? spec[0] : spec, callback, params);
|
|
575
|
+
if (params.timing && params.timing !== "async")
|
|
576
|
+
throw new Error(`Timing option "${params.timing}" invalid.`);
|
|
577
|
+
const { context, window: window2, webqit } = this;
|
|
578
|
+
if (params.eventDetails && !webqit.realdom.attrInterceptionHooks?.intercepting) {
|
|
579
|
+
attrInterception.call(window2, "intercept", () => {
|
|
580
|
+
});
|
|
581
|
+
}
|
|
582
|
+
const disconnectable = new window2.MutationObserver((records) => {
|
|
583
|
+
records = dedupAndIgnoreInternals(records).map((rcd) => withAttrEventDetails.call(window2, rcd));
|
|
584
|
+
dispatch.call(window2, registration, records, context);
|
|
585
|
+
});
|
|
586
|
+
const $params = { attributes: true, attributeOldValue: params.oldValue, subtree: params.subtree && true };
|
|
587
|
+
if (spec.length) {
|
|
588
|
+
$params.attributeFilter = spec.map((a) => a + "");
|
|
589
|
+
}
|
|
590
|
+
disconnectable.observe(context, $params);
|
|
591
|
+
const signalGenerator = params.signalGenerator || params.lifecycleSignals && this.createSignalGenerator();
|
|
592
|
+
const registration = { context, spec, callback, params, atomics: /* @__PURE__ */ new Map(), originalFilterIsString, signalGenerator, disconnectable };
|
|
593
|
+
return this.disconnectables(params.signal, disconnectable, signalGenerator);
|
|
594
|
+
}
|
|
595
|
+
observeSync(spec, callback, params = {}) {
|
|
596
|
+
const originalFilterIsString = typeof spec === "string" || spec instanceof DOMSpec;
|
|
597
|
+
[spec, callback, params = {}] = this.resolveArgs(arguments);
|
|
598
|
+
const { context, window: window2 } = this;
|
|
599
|
+
if (params.timing && !["sync", "intercept"].includes(params.timing))
|
|
600
|
+
throw new Error(`Timing option "${params.timing}" invalid.`);
|
|
601
|
+
const interceptionTiming = params.timing === "intercept" ? "intercept" : "sync";
|
|
602
|
+
if (!this.registry(interceptionTiming).size) {
|
|
603
|
+
attrInterception.call(window2, interceptionTiming, (records) => {
|
|
604
|
+
this.forEachMatchingContext(interceptionTiming, records, dispatch);
|
|
605
|
+
});
|
|
606
|
+
}
|
|
607
|
+
const disconnectable = { disconnect() {
|
|
608
|
+
registry.delete(registration);
|
|
609
|
+
} };
|
|
610
|
+
const signalGenerator = params.signalGenerator || params.lifecycleSignals && this.createSignalGenerator();
|
|
611
|
+
const registration = { context, spec, callback, params, atomics: /* @__PURE__ */ new Map(), originalFilterIsString, signalGenerator, disconnectable };
|
|
612
|
+
const registry = this.registry(interceptionTiming);
|
|
613
|
+
registry.set(registration, !!registration.params.deferred);
|
|
614
|
+
return this.disconnectables(params.signal, disconnectable, signalGenerator);
|
|
615
|
+
}
|
|
616
|
+
};
|
|
617
|
+
function dedupAndIgnoreInternals(records) {
|
|
618
|
+
return records.reduce((rcds, rcd, i) => {
|
|
619
|
+
if (rcds[i - 1]?.attributeName === rcd.attributeName)
|
|
620
|
+
return rcds;
|
|
621
|
+
if (wq(rcd.target, "realdom", "internalAttrInteractions").get(rcd.attributeName))
|
|
622
|
+
return rcds;
|
|
623
|
+
return rcds.concat(rcd);
|
|
624
|
+
}, []);
|
|
625
|
+
}
|
|
626
|
+
function dispatch(registration, records) {
|
|
627
|
+
const { context, spec, callback, params, atomics, originalFilterIsString, signalGenerator } = registration;
|
|
628
|
+
if (!params.subtree) {
|
|
629
|
+
records = records.filter((r) => {
|
|
630
|
+
return r.target === context;
|
|
631
|
+
});
|
|
632
|
+
}
|
|
633
|
+
if (!records.length)
|
|
634
|
+
return;
|
|
635
|
+
const $spec = spec.map((a) => a + "");
|
|
636
|
+
if (params.atomic && !atomics.size) {
|
|
637
|
+
records = attrIntersection(context, spec, records);
|
|
638
|
+
} else if (params.timing !== "async" && spec.length) {
|
|
639
|
+
records = records.filter((r) => $spec.includes(r.name));
|
|
640
|
+
}
|
|
641
|
+
if (!records.length)
|
|
642
|
+
return;
|
|
643
|
+
if (!(params.newValue === null && params.oldValue === null && params.eventDetails)) {
|
|
644
|
+
records = records.map((rcd) => {
|
|
645
|
+
let exclusion;
|
|
646
|
+
if (!params.eventDetails) {
|
|
647
|
+
({ event: exclusion, ...rcd } = rcd);
|
|
648
|
+
}
|
|
649
|
+
if (!params.oldValue && "oldValue" in rcd) {
|
|
650
|
+
({ oldValue: exclusion, ...rcd } = rcd);
|
|
651
|
+
}
|
|
652
|
+
if (!params.newValue && "value" in rcd) {
|
|
653
|
+
({ value: exclusion, ...rcd } = rcd);
|
|
654
|
+
} else if (params.newValue && typeof rcd.value === "undefined") {
|
|
655
|
+
rcd = { ...rcd, value: internalAttrInteraction(rcd.target, rcd.name, () => rcd.target.getAttribute(rcd.name)) };
|
|
656
|
+
}
|
|
657
|
+
return rcd;
|
|
658
|
+
});
|
|
659
|
+
}
|
|
660
|
+
if (params.atomic) {
|
|
661
|
+
records.forEach((record) => atomics.set(record.name, record));
|
|
662
|
+
records = Array.from(atomics.entries()).map(([, value]) => value);
|
|
663
|
+
}
|
|
664
|
+
const record_s = originalFilterIsString ? records[0] : records;
|
|
665
|
+
const flags = signalGenerator ? signalGenerator.generate() : {};
|
|
666
|
+
callback(record_s, flags, context);
|
|
667
|
+
}
|
|
668
|
+
function internalAttrInteraction(node, attrName, callback) {
|
|
669
|
+
const savedAttrLocking = wq(node, "realdom", "internalAttrInteractions").get(attrName);
|
|
670
|
+
wq(node, "realdom", "internalAttrInteractions").set(attrName, true);
|
|
671
|
+
const value = callback();
|
|
672
|
+
wq(node, "realdom", "internalAttrInteractions").set(attrName, savedAttrLocking);
|
|
673
|
+
return value;
|
|
674
|
+
}
|
|
675
|
+
function attrIntersection(context, spec, records = []) {
|
|
676
|
+
const _type = { event: null, type: "attribute" };
|
|
677
|
+
if (spec.length) {
|
|
678
|
+
return spec.map((attrName) => {
|
|
679
|
+
attrName = attrName + "";
|
|
680
|
+
return records.find((r) => r.name === attrName) || { target: context, name: attrName, value: internalAttrInteraction(context, attrName, () => context.getAttribute(attrName)), ..._type };
|
|
681
|
+
});
|
|
682
|
+
}
|
|
683
|
+
const attrs = Array.from(context.attributes);
|
|
684
|
+
return attrs.map((attr) => {
|
|
685
|
+
return records.find((r) => r.name === attr.nodeName) || { target: context, name: attr.nodeName, value: internalAttrInteraction(context, attr.nodeName, () => attr.nodeValue), ..._type };
|
|
686
|
+
});
|
|
687
|
+
}
|
|
688
|
+
function withAttrEventDetails({ target, attributeName, value, oldValue }) {
|
|
689
|
+
const window2 = this, registry = window2.webqit.realdom.attrInterceptionRecords?.get(target) || {};
|
|
690
|
+
const event = registry[attributeName]?.[0] || "mutation";
|
|
691
|
+
const record = { target, name: attributeName, value, oldValue, type: "observation", event };
|
|
692
|
+
return record;
|
|
693
|
+
}
|
|
694
|
+
function attrInterception(timing, callback) {
|
|
695
|
+
const window2 = this;
|
|
696
|
+
const { webqit, document, Element } = window2;
|
|
697
|
+
if (!webqit.realdom.attrInterceptionHooks) {
|
|
698
|
+
Object.defineProperty(webqit.realdom, "attrInterceptionHooks", { value: /* @__PURE__ */ new Map() });
|
|
699
|
+
}
|
|
700
|
+
if (!webqit.realdom.attrInterceptionHooks.has(timing)) {
|
|
701
|
+
webqit.realdom.attrInterceptionHooks.set(timing, /* @__PURE__ */ new Set());
|
|
702
|
+
}
|
|
703
|
+
webqit.realdom.attrInterceptionHooks.get(timing).add(callback);
|
|
704
|
+
const rm = () => webqit.realdom.attrInterceptionHooks.get(timing).delete(callback);
|
|
705
|
+
if (webqit.realdom.attrInterceptionHooks?.intercepting)
|
|
706
|
+
return rm;
|
|
707
|
+
console.warn(`Attr mutation APIs are now being intercepted.`);
|
|
708
|
+
webqit.realdom.attrInterceptionHooks.intercepting = true;
|
|
709
|
+
Object.defineProperty(webqit.realdom, "attrInterceptionRecords", { value: /* @__PURE__ */ new Map() });
|
|
710
|
+
const attrIntercept = (record, defaultAction) => {
|
|
711
|
+
if (!webqit.realdom.attrInterceptionRecords.has(record.target)) {
|
|
712
|
+
webqit.realdom.attrInterceptionRecords.set(record.target, {});
|
|
713
|
+
}
|
|
714
|
+
const registry = webqit.realdom.attrInterceptionRecords.get(record.target);
|
|
715
|
+
registry[record.name] = registry[record.name] || [];
|
|
716
|
+
registry[record.name].unshift(record.event);
|
|
717
|
+
if (wq(record.target, "realdom", "internalAttrInteractions").get(record.name))
|
|
718
|
+
return defaultAction();
|
|
719
|
+
webqit.realdom.attrInterceptionHooks.get("intercept")?.forEach((callback2) => callback2([record]));
|
|
720
|
+
const returnValue = defaultAction();
|
|
721
|
+
webqit.realdom.attrInterceptionHooks.get("sync")?.forEach((callback2) => callback2([record]));
|
|
722
|
+
return returnValue;
|
|
723
|
+
};
|
|
724
|
+
const mo = new window2.MutationObserver((records) => {
|
|
725
|
+
records = records.filter((rcd) => {
|
|
726
|
+
const registry = window2.webqit.realdom.attrInterceptionRecords?.get(rcd.target) || {};
|
|
727
|
+
return !registry[rcd.attributeName]?.shift();
|
|
728
|
+
});
|
|
729
|
+
records = dedupAndIgnoreInternals(records).map((rcd) => withAttrEventDetails.call(window2, rcd));
|
|
730
|
+
if (!records.length)
|
|
731
|
+
return;
|
|
732
|
+
webqit.realdom.attrInterceptionHooks.get("intercept")?.forEach((callback2) => callback2(records));
|
|
733
|
+
webqit.realdom.attrInterceptionHooks.get("sync")?.forEach((callback2) => callback2(records));
|
|
734
|
+
});
|
|
735
|
+
mo.observe(document, { attributes: true, subtree: true, attributeOldValue: true });
|
|
736
|
+
const originalApis = /* @__PURE__ */ Object.create(null);
|
|
737
|
+
["setAttribute", "removeAttribute", "toggleAttribute"].forEach((apiName) => {
|
|
738
|
+
originalApis[apiName] = Element.prototype[apiName];
|
|
739
|
+
Element.prototype[apiName] = function(...args) {
|
|
740
|
+
let value, oldValue = internalAttrInteraction(this, args[0], () => this.getAttribute(args[0]));
|
|
741
|
+
if (["setAttribute", "toggleAttribute"].includes(apiName)) {
|
|
742
|
+
value = args[1];
|
|
743
|
+
}
|
|
744
|
+
if (apiName === "toggleAttribute" && value === void 0) {
|
|
745
|
+
value = oldValue === null ? true : false;
|
|
746
|
+
}
|
|
747
|
+
const record = { target: this, name: args[0], value, oldValue, type: "interception", event: [this, apiName] };
|
|
748
|
+
const exec = () => originalApis[apiName].call(this, ...args);
|
|
749
|
+
return attrIntercept(record, exec);
|
|
750
|
+
};
|
|
751
|
+
});
|
|
752
|
+
return rm;
|
|
753
|
+
}
|
|
754
|
+
|
|
755
|
+
// node_modules/@webqit/realdom/src/realtime/DOMRealtime.js
|
|
756
|
+
var DOMRealtime = class extends Realtime {
|
|
757
|
+
constructor(context, ...args) {
|
|
758
|
+
super(context, "tree", ...args);
|
|
759
|
+
}
|
|
760
|
+
attr(filter, callback = void 0, params = {}) {
|
|
761
|
+
const { context, window: window2 } = this;
|
|
762
|
+
return new AttrRealtime(context, window2).get(...arguments);
|
|
763
|
+
}
|
|
764
|
+
query(spec, callback = void 0, params = {}) {
|
|
765
|
+
[spec, callback = void 0, params = {}] = this.resolveArgs(arguments);
|
|
766
|
+
const { context } = this;
|
|
767
|
+
const records = /* @__PURE__ */ new Map(), getRecord = (target) => {
|
|
768
|
+
if (!records.has(target)) {
|
|
769
|
+
records.set(target, { target, entrants: [], exits: [], type: "query", event: null });
|
|
770
|
+
}
|
|
771
|
+
return records.get(target);
|
|
772
|
+
};
|
|
773
|
+
if (!params.generation || params.generation === "entrants") {
|
|
774
|
+
if (!spec.length) {
|
|
775
|
+
[...context.children].forEach((node) => getRecord(context).entrants.push(node));
|
|
776
|
+
} else if (spec.every((s) => s.type === "selector")) {
|
|
777
|
+
const [cssSelectors, xpathQueries] = spec.reduce(([css, xpath], s) => {
|
|
778
|
+
return s.kind === "xpath" ? [css, xpath.concat(s)] : [css.concat(s), xpath];
|
|
779
|
+
}, [[], []]);
|
|
780
|
+
const matches = [];
|
|
781
|
+
if (params.subtree) {
|
|
782
|
+
if (cssSelectors.length) {
|
|
783
|
+
matches.push(...context.querySelectorAll(cssSelectors.join(",")));
|
|
784
|
+
}
|
|
785
|
+
if (xpathQueries.length) {
|
|
786
|
+
matches.push(...xpathQuery(this.window, context, xpathQueries));
|
|
787
|
+
}
|
|
788
|
+
} else {
|
|
789
|
+
if (cssSelectors.length) {
|
|
790
|
+
matches.push(...[...context.children].filter((node) => node.matches(cssSelectors)));
|
|
791
|
+
}
|
|
792
|
+
if (xpathQueries.length) {
|
|
793
|
+
matches.push(...xpathQuery(this.window, context, xpathQueries, false));
|
|
794
|
+
}
|
|
795
|
+
}
|
|
796
|
+
matches.forEach((node) => getRecord(node.parentNode || context).entrants.push(node));
|
|
797
|
+
}
|
|
798
|
+
}
|
|
799
|
+
if (!callback)
|
|
800
|
+
return records;
|
|
801
|
+
const disconnectable = { disconnected: false };
|
|
802
|
+
const signalGenerator = callback && params.lifecycleSignals && this.createSignalGenerator();
|
|
803
|
+
for (const [, record] of records) {
|
|
804
|
+
if (disconnectable.disconnected)
|
|
805
|
+
break;
|
|
806
|
+
const flags = signalGenerator?.generate() || {};
|
|
807
|
+
callback(record, flags, context);
|
|
808
|
+
}
|
|
809
|
+
if (params.live) {
|
|
810
|
+
if (signalGenerator) {
|
|
811
|
+
params = { ...params, signalGenerator };
|
|
812
|
+
}
|
|
813
|
+
const disconnectable_live = this.observe(spec, callback, params);
|
|
814
|
+
return this.disconnectables(params.signal, disconnectable, disconnectable_live);
|
|
815
|
+
}
|
|
816
|
+
return this.disconnectables(params.signal, disconnectable, signalGenerator);
|
|
817
|
+
}
|
|
818
|
+
children(spec, callback = void 0, params = {}) {
|
|
819
|
+
[spec, callback = void 0, params = {}] = this.resolveArgs(arguments);
|
|
820
|
+
return this.query(spec, callback, { ...params, subtree: false });
|
|
821
|
+
}
|
|
822
|
+
subtree(spec, callback = void 0, params = {}) {
|
|
823
|
+
[spec, callback = void 0, params = {}] = this.resolveArgs(arguments);
|
|
824
|
+
return this.query(spec, callback, { ...params, subtree: true });
|
|
825
|
+
}
|
|
826
|
+
observe(spec, callback, params = {}) {
|
|
827
|
+
[spec, callback, params = {}] = this.resolveArgs(arguments);
|
|
828
|
+
if (["sync", "intercept"].includes(params.timing))
|
|
829
|
+
return this.observeSync(spec, callback, params);
|
|
830
|
+
if (params.timing && params.timing !== "async")
|
|
831
|
+
throw new Error(`Timing option "${params.timing}" invalid.`);
|
|
832
|
+
const { context, window: window2, webqit, document } = this;
|
|
833
|
+
if (params.eventDetails) {
|
|
834
|
+
webqit.realdom.domInterceptionRecordsAlwaysOn = true;
|
|
835
|
+
}
|
|
836
|
+
if ((document.readyState === "loading" || webqit.realdom.domInterceptionRecordsAlwaysOn) && !webqit.realdom.domInterceptionHooks?.intercepting) {
|
|
837
|
+
domInterception.call(window2, "sync", () => {
|
|
838
|
+
});
|
|
839
|
+
}
|
|
840
|
+
const disconnectable = new window2.MutationObserver((records) => records.forEach((record) => {
|
|
841
|
+
dispatch2.call(window2, registration, withEventDetails.call(window2, record), context);
|
|
842
|
+
}));
|
|
843
|
+
disconnectable.observe(context, { childList: true, subtree: params.subtree && true });
|
|
844
|
+
const signalGenerator = params.signalGenerator || params.lifecycleSignals && this.createSignalGenerator();
|
|
845
|
+
const registration = { context, spec, callback, params, signalGenerator, disconnectable };
|
|
846
|
+
if (params.staticSensitivity) {
|
|
847
|
+
const disconnectable_attr = staticSensitivity.call(window2, registration);
|
|
848
|
+
return this.disconnectables(params.signal, disconnectable, signalGenerator, disconnectable_attr);
|
|
849
|
+
}
|
|
850
|
+
return this.disconnectables(params.signal, disconnectable, signalGenerator);
|
|
851
|
+
}
|
|
852
|
+
observeSync(spec, callback, params = {}) {
|
|
853
|
+
[spec, callback, params = {}] = this.resolveArgs(arguments);
|
|
854
|
+
const { context, window: window2 } = this;
|
|
855
|
+
if (params.timing && !["sync", "intercept"].includes(params.timing))
|
|
856
|
+
throw new Error(`Timing option "${params.timing}" invalid.`);
|
|
857
|
+
const interceptionTiming = params.timing === "intercept" ? "intercept" : "sync";
|
|
858
|
+
if (!this.registry(interceptionTiming).size) {
|
|
859
|
+
domInterception.call(window2, interceptionTiming, (record) => {
|
|
860
|
+
this.forEachMatchingContext(interceptionTiming, record, dispatch2);
|
|
861
|
+
});
|
|
862
|
+
}
|
|
863
|
+
const mo = new window2.MutationObserver((records) => records.forEach((record) => {
|
|
864
|
+
if (Array.isArray((record = withEventDetails.call(window2, record)).event))
|
|
865
|
+
return;
|
|
866
|
+
dispatch2.call(window2, registration, record, context);
|
|
867
|
+
}));
|
|
868
|
+
mo.observe(context, { childList: true, subtree: params.subtree && true });
|
|
869
|
+
const disconnectable = { disconnect() {
|
|
870
|
+
registry.delete(registration);
|
|
871
|
+
mo.disconnect();
|
|
872
|
+
} };
|
|
873
|
+
const signalGenerator = params.signalGenerator || params.lifecycleSignals && this.createSignalGenerator();
|
|
874
|
+
const registration = { context, spec, callback, params, signalGenerator, disconnectable };
|
|
875
|
+
const registry = this.registry(interceptionTiming);
|
|
876
|
+
registry.set(registration, !!registration.params.deferred);
|
|
877
|
+
if (params.staticSensitivity) {
|
|
878
|
+
const disconnectable_attr = staticSensitivity.call(window2, registration);
|
|
879
|
+
return this.disconnectables(params.signal, disconnectable, signalGenerator, disconnectable_attr);
|
|
880
|
+
}
|
|
881
|
+
return this.disconnectables(params.signal, disconnectable, signalGenerator);
|
|
882
|
+
}
|
|
883
|
+
track(elements, callback, params = {}) {
|
|
884
|
+
params = { subtree: true, ...params };
|
|
885
|
+
return this.observe(elements, (record) => {
|
|
886
|
+
if (record.entrants.length)
|
|
887
|
+
callback(true, Array.isArray(elements) ? record.entrants : record.entrants[0]);
|
|
888
|
+
if (record.exits.length)
|
|
889
|
+
callback(false, Array.isArray(elements) ? record.exits : record.exits[0]);
|
|
890
|
+
}, params);
|
|
891
|
+
}
|
|
892
|
+
};
|
|
893
|
+
function staticSensitivity(registration) {
|
|
894
|
+
const window2 = this;
|
|
895
|
+
const { context, spec, callback, params, signalGenerator } = registration;
|
|
896
|
+
const cssSelectors = spec.filter((s) => s.kind === "css");
|
|
897
|
+
const parseDot = (selector) => selector.match(/\.([\w-]+)/g)?.length ? ["class"] : [];
|
|
898
|
+
const parseHash = (selector) => selector.match(/#([\w-]+)/g)?.length ? ["id"] : [];
|
|
899
|
+
const parse = (selector) => [...selector.matchAll(/\[([^\=\]]+)(\=[^\]]+)?\]/g)].map((x) => x[1]).concat(parseDot(selector)).concat(parseHash(selector));
|
|
900
|
+
if (!(registration.$attrs = Array.from(new Set(cssSelectors.filter((s) => (s + "").includes("[")).reduce((attrs, selector) => attrs.concat(parse(selector + "")), [])))).length)
|
|
901
|
+
return;
|
|
902
|
+
const entrants = /* @__PURE__ */ new Set(), exits = /* @__PURE__ */ new Set();
|
|
903
|
+
entrants.push = (val) => (exits.delete(val), entrants.add(val));
|
|
904
|
+
exits.push = (val) => (entrants.delete(val), exits.add(val));
|
|
905
|
+
registration.$deliveryCache = { entrants, exits };
|
|
906
|
+
return new AttrRealtime(context, window2).observe(registration.$attrs, (_records) => {
|
|
907
|
+
const records = /* @__PURE__ */ new Map(), getRecord = (target) => {
|
|
908
|
+
if (!records.has(target)) {
|
|
909
|
+
records.set(target, { target, entrants: [], exits: [], type: "static", event: null });
|
|
910
|
+
}
|
|
911
|
+
return records.get(target);
|
|
912
|
+
};
|
|
913
|
+
const matchesCache = /* @__PURE__ */ new WeakMap();
|
|
914
|
+
const matches = (node) => {
|
|
915
|
+
if (!matchesCache.has(node)) {
|
|
916
|
+
matchesCache.set(node, cssSelectors.some((s) => node.matches(s + "")));
|
|
917
|
+
}
|
|
918
|
+
return matchesCache.get(node);
|
|
919
|
+
};
|
|
920
|
+
for (const _record of _records) {
|
|
921
|
+
["entrants", "exits"].forEach((generation) => {
|
|
922
|
+
if (params.generation && generation !== params.generation)
|
|
923
|
+
return;
|
|
924
|
+
if (registration.$deliveryCache[generation].has(_record.target) || (generation === "entrants" ? !matches(_record.target) : matches(_record.target)))
|
|
925
|
+
return;
|
|
926
|
+
registration.$deliveryCache[generation].push(_record.target);
|
|
927
|
+
getRecord(_record.target)[generation].push(_record.target);
|
|
928
|
+
getRecord(_record.target).event = _record.event;
|
|
929
|
+
});
|
|
930
|
+
}
|
|
931
|
+
for (const [, record] of records) {
|
|
932
|
+
const flags = signalGenerator?.generate() || {};
|
|
933
|
+
callback(record, flags, context);
|
|
934
|
+
}
|
|
935
|
+
}, { subtree: params.subtree, timing: params.timing, eventDetails: params.eventDetails });
|
|
936
|
+
}
|
|
937
|
+
function dispatch2(registration, _record) {
|
|
938
|
+
const { context, spec, callback, params, signalGenerator, $deliveryCache } = registration;
|
|
939
|
+
const record = { ..._record, entrants: [], exits: [] };
|
|
940
|
+
if (!params.eventDetails) {
|
|
941
|
+
delete record.event;
|
|
942
|
+
}
|
|
943
|
+
["entrants", "exits"].forEach((generation) => {
|
|
944
|
+
if (params.generation && generation !== params.generation)
|
|
945
|
+
return;
|
|
946
|
+
if (spec.length) {
|
|
947
|
+
record[generation] = nodesIntersection.call(this, spec, params.subtree === "cross-roots", _record[generation], _record.event !== "parse");
|
|
948
|
+
} else {
|
|
949
|
+
record[generation] = [..._record[generation]];
|
|
950
|
+
}
|
|
951
|
+
if (!$deliveryCache)
|
|
952
|
+
return;
|
|
953
|
+
for (const node of record[generation]) {
|
|
954
|
+
$deliveryCache[generation].push(node);
|
|
955
|
+
}
|
|
956
|
+
});
|
|
957
|
+
if (!record.entrants.length && !record.exits.length)
|
|
958
|
+
return;
|
|
959
|
+
const flags = signalGenerator?.generate() || {};
|
|
960
|
+
callback(record, flags, context);
|
|
961
|
+
}
|
|
962
|
+
function nodesIntersection(spec, crossRoots, sources, deepIntersect) {
|
|
963
|
+
sources = Array.isArray(sources) ? sources : [...sources];
|
|
964
|
+
const match = (sources2, s) => {
|
|
965
|
+
if (s.type === "selector") {
|
|
966
|
+
let matches = s.isXpathAttr ? [] : sources2.filter((source) => s.kind === "xpath" ? xpathMatch(this, source, s + "") : source.matches && source.matches(s + ""));
|
|
967
|
+
if (deepIntersect || s.isXpathAttr) {
|
|
968
|
+
matches = sources2.reduce((collection, source) => {
|
|
969
|
+
if (s.kind === "xpath") {
|
|
970
|
+
return [...collection, ...xpathQuery(this, source, s, deepIntersect)];
|
|
971
|
+
}
|
|
972
|
+
return source.querySelectorAll ? [...collection, ...source.querySelectorAll(s + "")] : collection;
|
|
973
|
+
}, matches);
|
|
974
|
+
}
|
|
975
|
+
if (matches.length)
|
|
976
|
+
return matches;
|
|
977
|
+
} else {
|
|
978
|
+
if (sources2.includes(s.content) || deepIntersect && sources2.some((source) => containsNode(this, source, s.content, crossRoots))) {
|
|
979
|
+
return [s.content];
|
|
980
|
+
}
|
|
981
|
+
}
|
|
982
|
+
};
|
|
983
|
+
if (!sources.$$searchCache) {
|
|
984
|
+
sources.$$searchCache = /* @__PURE__ */ new Map();
|
|
985
|
+
}
|
|
986
|
+
return spec.reduce((matches, s) => {
|
|
987
|
+
let _matches;
|
|
988
|
+
if (sources.$$searchCache.has(s.content)) {
|
|
989
|
+
_matches = sources.$$searchCache.get(s.content);
|
|
990
|
+
} else {
|
|
991
|
+
_matches = match(sources, s) || [];
|
|
992
|
+
if (s.type === "instance") {
|
|
993
|
+
sources.$$searchCache.set(s.content, _matches);
|
|
994
|
+
}
|
|
995
|
+
}
|
|
996
|
+
return matches.concat(_matches);
|
|
997
|
+
}, []);
|
|
998
|
+
}
|
|
999
|
+
function withEventDetails({ target, addedNodes, removedNodes }) {
|
|
1000
|
+
let window2 = this, event;
|
|
1001
|
+
event = from_default(addedNodes).reduce((prev, node) => prev || window2.webqit.realdom.domInterceptionRecords?.get(node), null);
|
|
1002
|
+
event = from_default(removedNodes).reduce((prev, node) => prev || window2.webqit.realdom.domInterceptionRecords?.get(node), event);
|
|
1003
|
+
event = event || window2.document.readyState === "loading" && "parse" || "mutation";
|
|
1004
|
+
return { target, entrants: addedNodes, exits: removedNodes, type: "observation", event };
|
|
1005
|
+
}
|
|
1006
|
+
function domInterception(timing, callback) {
|
|
1007
|
+
const window2 = this;
|
|
1008
|
+
const { webqit, document, Node, CharacterData, Element, HTMLElement, HTMLTemplateElement, DocumentFragment } = window2;
|
|
1009
|
+
if (!webqit.realdom.domInterceptionHooks) {
|
|
1010
|
+
Object.defineProperty(webqit.realdom, "domInterceptionHooks", { value: /* @__PURE__ */ new Map() });
|
|
1011
|
+
}
|
|
1012
|
+
if (!webqit.realdom.domInterceptionNoRecurse) {
|
|
1013
|
+
Object.defineProperty(webqit.realdom, "domInterceptionNoRecurse", { value: /* @__PURE__ */ new Map() });
|
|
1014
|
+
}
|
|
1015
|
+
if (!webqit.realdom.domInterceptionHooks.has(timing)) {
|
|
1016
|
+
webqit.realdom.domInterceptionHooks.set(timing, /* @__PURE__ */ new Set());
|
|
1017
|
+
}
|
|
1018
|
+
webqit.realdom.domInterceptionHooks.get(timing).add(callback);
|
|
1019
|
+
const rm = () => webqit.realdom.domInterceptionHooks.get(timing).delete(callback);
|
|
1020
|
+
if (webqit.realdom.domInterceptionHooks?.intercepting)
|
|
1021
|
+
return rm;
|
|
1022
|
+
console.warn(`DOM mutation APIs are now being intercepted.`);
|
|
1023
|
+
webqit.realdom.domInterceptionHooks.intercepting = true;
|
|
1024
|
+
Object.defineProperty(webqit.realdom, "domInterceptionRecords", { value: /* @__PURE__ */ new Map() });
|
|
1025
|
+
const noRecurse = (node, method, callback2) => {
|
|
1026
|
+
webqit.realdom.domInterceptionNoRecurse.set(node, method);
|
|
1027
|
+
const returnValue = callback2();
|
|
1028
|
+
webqit.realdom.domInterceptionNoRecurse.delete(node);
|
|
1029
|
+
return returnValue;
|
|
1030
|
+
};
|
|
1031
|
+
const intercept = (record, defaultAction) => {
|
|
1032
|
+
record.entrants.concat(record.exits).forEach((node) => {
|
|
1033
|
+
clearTimeout(webqit.realdom.domInterceptionRecords.get(node)?.timeout);
|
|
1034
|
+
webqit.realdom.domInterceptionRecords.set(node, record.event);
|
|
1035
|
+
const timeout = setTimeout(() => {
|
|
1036
|
+
webqit.realdom.domInterceptionRecords.delete(node);
|
|
1037
|
+
}, 0);
|
|
1038
|
+
Object.defineProperty(record.event, "timeout", { value: timeout, configurable: true });
|
|
1039
|
+
});
|
|
1040
|
+
webqit.realdom.domInterceptionHooks.get("intercept")?.forEach((callback2) => callback2(record));
|
|
1041
|
+
const returnValue = defaultAction();
|
|
1042
|
+
webqit.realdom.domInterceptionHooks.get("sync")?.forEach((callback2) => callback2(record));
|
|
1043
|
+
return returnValue;
|
|
1044
|
+
};
|
|
1045
|
+
const _apiNames = {
|
|
1046
|
+
ShadowRoot: ["innerHTML", "setHTMLUnsafe"],
|
|
1047
|
+
DocumentFragment: ["replaceChildren", "append", "prepend"],
|
|
1048
|
+
Document: ["replaceChildren", "append", "prepend"],
|
|
1049
|
+
HTMLElement: ["outerText", "innerText"],
|
|
1050
|
+
Element: ["append", "prepend", "before", "after", "insertAdjacentElement", "insertAdjacentHTML", "remove", "replaceChildren", "replaceWith", "setHTMLUnsafe", "innerHTML", "outerHTML"],
|
|
1051
|
+
CharacterData: ["before", "after", "remove", "replaceWith"],
|
|
1052
|
+
Node: ["insertBefore", "replaceChild", "removeChild", "appendChild", "textContent", "nodeValue"]
|
|
1053
|
+
};
|
|
1054
|
+
const _apiOriginals = {
|
|
1055
|
+
ShadowRoot: /* @__PURE__ */ Object.create(null),
|
|
1056
|
+
DocumentFragment: /* @__PURE__ */ Object.create(null),
|
|
1057
|
+
Document: /* @__PURE__ */ Object.create(null),
|
|
1058
|
+
HTMLElement: /* @__PURE__ */ Object.create(null),
|
|
1059
|
+
Element: /* @__PURE__ */ Object.create(null),
|
|
1060
|
+
CharacterData: /* @__PURE__ */ Object.create(null),
|
|
1061
|
+
Node: /* @__PURE__ */ Object.create(null)
|
|
1062
|
+
};
|
|
1063
|
+
const _apiNamesUnique = new Set(Object.values(_apiNames).reduce((all, apis) => all.concat(apis), []));
|
|
1064
|
+
_apiNamesUnique.forEach((apiName) => {
|
|
1065
|
+
Object.keys(_apiNames).forEach((DOMClassName) => {
|
|
1066
|
+
if (!_apiNames[DOMClassName].includes(apiName))
|
|
1067
|
+
return;
|
|
1068
|
+
const _apiOriginal = Object.getOwnPropertyDescriptor(window2[DOMClassName].prototype, apiName);
|
|
1069
|
+
if (!_apiOriginal)
|
|
1070
|
+
return;
|
|
1071
|
+
Object.defineProperty(window2[DOMClassName].prototype, apiName, "value" in _apiOriginal ? { ..._apiOriginal, value: method } : { ..._apiOriginal, set: setter });
|
|
1072
|
+
_apiOriginals[DOMClassName][apiName] = _apiOriginal;
|
|
1073
|
+
});
|
|
1074
|
+
function method(...args) {
|
|
1075
|
+
const DOMClassName = Object.keys(_apiOriginals).find((name) => this instanceof window2[name] && apiName in _apiOriginals[name]);
|
|
1076
|
+
const $apiOriginals = _apiOriginals[DOMClassName];
|
|
1077
|
+
let exec = () => $apiOriginals[apiName].value.call(this, ...args);
|
|
1078
|
+
if (webqit.realdom.domInterceptionNoRecurse.get(this) === apiName)
|
|
1079
|
+
return exec();
|
|
1080
|
+
let exits = [], entrants = [], target = this;
|
|
1081
|
+
if (["insertBefore"].includes(apiName)) {
|
|
1082
|
+
entrants = [args[0]];
|
|
1083
|
+
} else if (["insertAdjacentElement", "insertAdjacentHTML"].includes(apiName)) {
|
|
1084
|
+
entrants = [args[1]];
|
|
1085
|
+
if (["beforebegin", "afterend"].includes(args[0])) {
|
|
1086
|
+
target = this.parentNode;
|
|
1087
|
+
}
|
|
1088
|
+
} else if (["setHTMLUnsafe", "replaceChildren"].includes(apiName)) {
|
|
1089
|
+
exits = [...this.childNodes];
|
|
1090
|
+
entrants = apiName === "replaceChildren" ? [...args] : [args[0]];
|
|
1091
|
+
} else if (["replaceWith", "remove"].includes(apiName)) {
|
|
1092
|
+
exits = [this];
|
|
1093
|
+
entrants = apiName === "replaceWith" ? [...args] : [];
|
|
1094
|
+
target = this.parentNode;
|
|
1095
|
+
} else if (["replaceChild"].includes(apiName)) {
|
|
1096
|
+
exits = [args[1]];
|
|
1097
|
+
entrants = [args[0]];
|
|
1098
|
+
} else if (["removeChild"].includes(apiName)) {
|
|
1099
|
+
exits = [...args];
|
|
1100
|
+
} else {
|
|
1101
|
+
entrants = [...args];
|
|
1102
|
+
if (["before", "after"].includes(apiName)) {
|
|
1103
|
+
target = this.parentNode;
|
|
1104
|
+
}
|
|
1105
|
+
}
|
|
1106
|
+
let apiNameFinal = apiName;
|
|
1107
|
+
if (["insertAdjacentHTML", "setHTMLUnsafe"].includes(apiName)) {
|
|
1108
|
+
let tempNodeName = this.nodeName;
|
|
1109
|
+
if (apiName === "insertAdjacentHTML" && ["beforebegin", "afterend"].includes(args[0])) {
|
|
1110
|
+
if (!this.parentNode)
|
|
1111
|
+
return $apiOriginals[apiName].value.call(this, ...args);
|
|
1112
|
+
tempNodeName = this.parentNode.nodeName;
|
|
1113
|
+
}
|
|
1114
|
+
const temp = document.createElement(tempNodeName.includes("-") ? "div" : tempNodeName);
|
|
1115
|
+
$apiOriginals.setHTMLUnsafe.value.call(temp, entrants[0], apiName === "setHTMLUnsafe" ? args[1] : {});
|
|
1116
|
+
entrants = [...temp.childNodes];
|
|
1117
|
+
if (apiName === "insertAdjacentHTML") {
|
|
1118
|
+
apiNameFinal = "insertAdjacentElement";
|
|
1119
|
+
args[1] = new DocumentFragment();
|
|
1120
|
+
noRecurse(args[1], "append", () => args[1].append(...temp.childNodes));
|
|
1121
|
+
} else {
|
|
1122
|
+
apiNameFinal = "replaceChildren";
|
|
1123
|
+
args = [...temp.childNodes];
|
|
1124
|
+
}
|
|
1125
|
+
}
|
|
1126
|
+
if (!target)
|
|
1127
|
+
return exec();
|
|
1128
|
+
const record = { target, entrants, exits, type: "interception", event: [this, apiName] };
|
|
1129
|
+
return intercept(record, () => {
|
|
1130
|
+
return $apiOriginals[apiNameFinal].value.call(this, ...args);
|
|
1131
|
+
});
|
|
1132
|
+
}
|
|
1133
|
+
function setter(value) {
|
|
1134
|
+
const DOMClassName = Object.keys(_apiOriginals).find((name) => this instanceof window2[name] && apiName in _apiOriginals[name]);
|
|
1135
|
+
const $apiOriginals = _apiOriginals[DOMClassName];
|
|
1136
|
+
let exec = () => $apiOriginals[apiName].set.call(this, value);
|
|
1137
|
+
if (this instanceof HTMLScriptElement || webqit.realdom.domInterceptionNoRecurse.get(this) === apiName)
|
|
1138
|
+
return exec();
|
|
1139
|
+
let exits = [], entrants = [], target = this;
|
|
1140
|
+
if (["outerHTML", "outerText"].includes(apiName)) {
|
|
1141
|
+
exits = [this];
|
|
1142
|
+
target = this.parentNode;
|
|
1143
|
+
} else {
|
|
1144
|
+
if (this instanceof HTMLTemplateElement) {
|
|
1145
|
+
target = this.content;
|
|
1146
|
+
exits = [...this.content.childNodes];
|
|
1147
|
+
} else {
|
|
1148
|
+
exits = [...this.childNodes];
|
|
1149
|
+
}
|
|
1150
|
+
}
|
|
1151
|
+
if (["outerHTML", "innerHTML"].includes(apiName)) {
|
|
1152
|
+
let tempNodeName = this.nodeName;
|
|
1153
|
+
if (apiName === "outerHTML") {
|
|
1154
|
+
if (!this.parentNode)
|
|
1155
|
+
return exec();
|
|
1156
|
+
tempNodeName = this.parentNode.nodeName;
|
|
1157
|
+
}
|
|
1158
|
+
const temp = document.createElement(tempNodeName.includes("-") ? "div" : tempNodeName);
|
|
1159
|
+
noRecurse(temp, apiName, () => temp[apiName] = value);
|
|
1160
|
+
entrants = this instanceof HTMLTemplateElement ? [...temp.content.childNodes] : [...temp.childNodes];
|
|
1161
|
+
if (this instanceof HTMLTemplateElement && this.hasAttribute("src") || this instanceof ShadowRoot) {
|
|
1162
|
+
const getScripts = (nodes) => nodes.reduce((scripts, el) => {
|
|
1163
|
+
if (el instanceof HTMLScriptElement)
|
|
1164
|
+
return scripts.concat(el);
|
|
1165
|
+
if (el instanceof HTMLTemplateElement)
|
|
1166
|
+
return scripts.concat(getScripts([el.content]));
|
|
1167
|
+
scripts = scripts.concat(getScripts([...el.querySelectorAll?.("template") || []].map((t) => t.content)));
|
|
1168
|
+
return scripts.concat(...el.querySelectorAll?.("script") || []);
|
|
1169
|
+
}, []);
|
|
1170
|
+
for (const script of getScripts(entrants)) {
|
|
1171
|
+
if (this instanceof ShadowRoot) {
|
|
1172
|
+
script.setAttribute("data-handling", "manual");
|
|
1173
|
+
continue;
|
|
1174
|
+
}
|
|
1175
|
+
const $script = document.createElement("script");
|
|
1176
|
+
[...script.attributes].forEach((attr) => $script.setAttribute(attr.name, attr.value));
|
|
1177
|
+
$script.textContent = script.textContent;
|
|
1178
|
+
noRecurse(script, "replaceWith", () => script.replaceWith($script));
|
|
1179
|
+
}
|
|
1180
|
+
}
|
|
1181
|
+
if (apiName === "outerHTML") {
|
|
1182
|
+
value = new DocumentFragment();
|
|
1183
|
+
noRecurse(value, "append", () => value.append(...entrants));
|
|
1184
|
+
exec = () => noRecurse(this, "replaceWith", () => Element.prototype.replaceWith.call(this, value));
|
|
1185
|
+
} else {
|
|
1186
|
+
if (this instanceof HTMLTemplateElement) {
|
|
1187
|
+
exec = () => noRecurse(this.content, "replaceChildren", () => this.content.replaceChildren(...entrants));
|
|
1188
|
+
} else {
|
|
1189
|
+
exec = () => noRecurse(this, "replaceChildren", () => Element.prototype.replaceChildren.call(this, ...entrants));
|
|
1190
|
+
}
|
|
1191
|
+
}
|
|
1192
|
+
}
|
|
1193
|
+
const record = { target, entrants, exits, type: "interception", event: [this, apiName] };
|
|
1194
|
+
return intercept(record, exec);
|
|
1195
|
+
}
|
|
1196
|
+
});
|
|
1197
|
+
return rm;
|
|
1198
|
+
}
|
|
1199
|
+
|
|
1200
|
+
// node_modules/@webqit/realdom/src/polyfills.js
|
|
1201
|
+
function polyfills_default() {
|
|
1202
|
+
CSS_escape.call(this);
|
|
1203
|
+
Node_isConnected.call(this);
|
|
1204
|
+
Element_matches.call(this);
|
|
1205
|
+
}
|
|
1206
|
+
function CSS_escape() {
|
|
1207
|
+
const window2 = this;
|
|
1208
|
+
if (!window2.CSS) {
|
|
1209
|
+
window2.CSS = {};
|
|
1210
|
+
}
|
|
1211
|
+
if (!window2.CSS.escape) {
|
|
1212
|
+
window2.CSS.escape = (str) => str.replace(/([\:@\~\$\&])/g, "\\$1");
|
|
1213
|
+
}
|
|
1214
|
+
}
|
|
1215
|
+
function Node_isConnected() {
|
|
1216
|
+
const window2 = this;
|
|
1217
|
+
if (!("isConnected" in window2.Node.prototype)) {
|
|
1218
|
+
Object.defineProperty(window2.Node.prototype, "isConnected", { get: function() {
|
|
1219
|
+
return !this.ownerDocument || !(this.ownerDocument.compareDocumentPosition(this) & this.DOCUMENT_POSITION_DISCONNECTED);
|
|
1220
|
+
} });
|
|
1221
|
+
}
|
|
1222
|
+
}
|
|
1223
|
+
function Element_matches() {
|
|
1224
|
+
const window2 = this;
|
|
1225
|
+
if (!window2.Element.prototype.matches) {
|
|
1226
|
+
window2.Element.prototype.matches = window2.Element.prototype.matchesSelector || window2.Element.prototype.mozMatchesSelector || window2.Element.prototype.msMatchesSelector || window2.Element.prototype.oMatchesSelector || window2.Element.prototype.webkitMatchesSelector || function(s) {
|
|
1227
|
+
var matches = (this.document || this.ownerDocument).querySelectorAll(s), i = matches.length;
|
|
1228
|
+
while (--i >= 0 && matches.item(i) !== this) {
|
|
1229
|
+
}
|
|
1230
|
+
return i > -1;
|
|
1231
|
+
};
|
|
1232
|
+
}
|
|
1233
|
+
}
|
|
1234
|
+
|
|
1235
|
+
// node_modules/@webqit/realdom/src/index.js
|
|
1236
|
+
function src_default() {
|
|
1237
|
+
const window2 = this;
|
|
1238
|
+
if (!window2.webqit)
|
|
1239
|
+
window2.webqit = {};
|
|
1240
|
+
if (window2.webqit.realdom)
|
|
1241
|
+
return window2.webqit.realdom;
|
|
1242
|
+
window2.webqit.realdom = {};
|
|
1243
|
+
polyfills_default.call(window2);
|
|
1244
|
+
window2.webqit.realdom.meta = (...args) => meta.call(window2, ...args);
|
|
1245
|
+
window2.webqit.realdom.ready = (...args) => ready.call(window2, ...args);
|
|
1246
|
+
window2.webqit.realdom.realtime = (context, namespace = "dom") => {
|
|
1247
|
+
if (namespace === "dom")
|
|
1248
|
+
return new DOMRealtime(context, window2);
|
|
1249
|
+
if (namespace === "attr")
|
|
1250
|
+
return new AttrRealtime(context, window2);
|
|
1251
|
+
};
|
|
1252
|
+
const scheduler = new Scheduler(window2);
|
|
1253
|
+
window2.webqit.realdom.schedule = (type, ...args) => {
|
|
1254
|
+
return scheduler[`on${type}`](...args);
|
|
1255
|
+
};
|
|
1256
|
+
window2.webqit.realdom.synthesizeWhile = (...args) => {
|
|
1257
|
+
return scheduler.synthesizeWhile(...args);
|
|
1258
|
+
};
|
|
1259
|
+
return window2.webqit.realdom;
|
|
1260
|
+
}
|
|
1261
|
+
function ready(...args) {
|
|
1262
|
+
let timing = "interactive", callback;
|
|
1263
|
+
if (isString_default(args[0])) {
|
|
1264
|
+
timing = args[0];
|
|
1265
|
+
if (isFunction_default(args[1])) {
|
|
1266
|
+
callback = args[1];
|
|
1267
|
+
}
|
|
1268
|
+
} else if (isFunction_default(args[0])) {
|
|
1269
|
+
callback = args[0];
|
|
1270
|
+
}
|
|
1271
|
+
const timings = { interactive: ["interactive", "complete"], complete: ["complete"] };
|
|
1272
|
+
if (!timings[timing])
|
|
1273
|
+
throw new Error(`Invalid ready-state timing: ${timing}.`);
|
|
1274
|
+
const window2 = this;
|
|
1275
|
+
if (!callback) {
|
|
1276
|
+
if (!window2.webqit.realdom.readyStatePromises) {
|
|
1277
|
+
window2.webqit.realdom.readyStatePromises = {
|
|
1278
|
+
interactive: new Promise((res) => ready.call(this, "interactive", res)),
|
|
1279
|
+
complete: new Promise((res) => ready.call(this, "complete", res))
|
|
1280
|
+
};
|
|
1281
|
+
}
|
|
1282
|
+
return window2.webqit.realdom.readyStatePromises[timing];
|
|
1283
|
+
}
|
|
1284
|
+
if (timings[timing].includes(window2.document.readyState))
|
|
1285
|
+
return callback(window2);
|
|
1286
|
+
if (!window2.webqit.realdom.readyStateCallbacks) {
|
|
1287
|
+
window2.webqit.realdom.readyStateCallbacks = { interactive: [], complete: [] };
|
|
1288
|
+
window2.document.addEventListener("readystatechange", () => {
|
|
1289
|
+
const state = window2.document.readyState;
|
|
1290
|
+
for (const callback2 of window2.webqit.realdom.readyStateCallbacks[state].splice(0)) {
|
|
1291
|
+
callback2(window2);
|
|
1292
|
+
}
|
|
1293
|
+
}, false);
|
|
1294
|
+
}
|
|
1295
|
+
window2.webqit.realdom.readyStateCallbacks[timing].push(callback);
|
|
1296
|
+
}
|
|
1297
|
+
function meta(name) {
|
|
1298
|
+
const window2 = this;
|
|
1299
|
+
let _content = {}, _el;
|
|
1300
|
+
if (_el = window2.document.querySelector(`meta[name="${name}"]`)) {
|
|
1301
|
+
_content = (_el.content || "").split(";").filter((v) => v).reduce((_metaVars, directive) => {
|
|
1302
|
+
const directiveSplit = directive.split("=").map((d) => d.trim());
|
|
1303
|
+
set_default(_metaVars, directiveSplit[0].split("."), directiveSplit[1] === "true" ? true : directiveSplit[1] === "false" ? false : isNumeric_default(directiveSplit[1]) ? parseInt(directiveSplit[1]) : directiveSplit[1]);
|
|
1304
|
+
return _metaVars;
|
|
1305
|
+
}, {});
|
|
1306
|
+
}
|
|
1307
|
+
return { get name() {
|
|
1308
|
+
return name;
|
|
1309
|
+
}, get content() {
|
|
1310
|
+
return _el.content;
|
|
1311
|
+
}, json() {
|
|
1312
|
+
return JSON.parse(JSON.stringify(_content));
|
|
1313
|
+
} };
|
|
1314
|
+
}
|
|
1315
|
+
|
|
1316
|
+
// node_modules/@webqit/util/str/toTitle.js
|
|
1317
|
+
function toTitle_default(str, strict) {
|
|
1318
|
+
if (typeof str !== "string") {
|
|
1319
|
+
return str;
|
|
1320
|
+
}
|
|
1321
|
+
return str.replace(/\w\S*/g, function(txt) {
|
|
1322
|
+
return txt.charAt(0).toUpperCase() + (typeof strict !== void 0 && strict ? txt.substr(1).toLowerCase() : txt.substr(1));
|
|
1323
|
+
});
|
|
1324
|
+
}
|
|
1325
|
+
|
|
1326
|
+
// src/util.js
|
|
1327
|
+
var _wq = (target, ...args) => wq(target, "oohtml", ...args);
|
|
1328
|
+
var env = {};
|
|
1329
|
+
function _init(name, $config, $defaults) {
|
|
1330
|
+
const window2 = this, realdom = src_default.call(window2);
|
|
1331
|
+
env.window = window2;
|
|
1332
|
+
if (!window2.webqitConfig) {
|
|
1333
|
+
window2.webqitConfig = realdom.meta("webqit").json();
|
|
1334
|
+
}
|
|
1335
|
+
window2.webqit || (window2.webqit = {});
|
|
1336
|
+
window2.webqit.oohtml || (window2.webqit.oohtml = {});
|
|
1337
|
+
window2.webqit.oohtml.configs || (window2.webqit.oohtml.configs = {});
|
|
1338
|
+
const configKey = name.toUpperCase().replace("-", "_");
|
|
1339
|
+
if (!window2.webqit.oohtml.configs[configKey]) {
|
|
1340
|
+
window2.webqit.oohtml.configs[configKey] = {};
|
|
1341
|
+
const config = window2.webqit.oohtml.configs[configKey];
|
|
1342
|
+
merge_default(2, config, $defaults, $config, realdom.meta(name).json());
|
|
1343
|
+
if (window2.webqitConfig.prefix) {
|
|
1344
|
+
Object.keys(config).forEach((main) => {
|
|
1345
|
+
Object.keys(config[main]).forEach((key) => {
|
|
1346
|
+
if (main === "api" && typeof config[main][key] === "string") {
|
|
1347
|
+
config[main][key] = `${window2.webqitConfig.prefix}${toTitle_default(config[main][key])}`;
|
|
1348
|
+
} else if (["attr", "elements"].includes(main) && config[main][key]?.startsWith("data-") === false) {
|
|
1349
|
+
config[main][key] = `${window2.webqitConfig.prefix}-${config[main][key]}`;
|
|
1350
|
+
}
|
|
1351
|
+
});
|
|
1352
|
+
});
|
|
1353
|
+
}
|
|
1354
|
+
}
|
|
1355
|
+
return { config: window2.webqit.oohtml.configs[configKey], realdom, window: window2 };
|
|
1356
|
+
}
|
|
1357
|
+
function _splitOuter(str, delim) {
|
|
1358
|
+
return [...str].reduce(([quote, depth, splits], x) => {
|
|
1359
|
+
if (!quote && depth === 0 && (Array.isArray(delim) ? delim : [delim]).includes(x)) {
|
|
1360
|
+
return [quote, depth, [""].concat(splits)];
|
|
1361
|
+
}
|
|
1362
|
+
if (!quote && ["(", "[", "{"].includes(x) && !splits[0].endsWith("\\"))
|
|
1363
|
+
depth++;
|
|
1364
|
+
if (!quote && [")", "]", "}"].includes(x) && !splits[0].endsWith("\\"))
|
|
1365
|
+
depth--;
|
|
1366
|
+
if (['"', "'", "`"].includes(x) && !splits[0].endsWith("\\")) {
|
|
1367
|
+
quote = quote === x ? null : quote || x;
|
|
1368
|
+
}
|
|
1369
|
+
splits[0] += x;
|
|
1370
|
+
return [quote, depth, splits];
|
|
1371
|
+
}, [null, 0, [""]])[2].reverse();
|
|
1372
|
+
}
|
|
1373
|
+
|
|
1374
|
+
// src/data-binding/index.js
|
|
1375
|
+
function init($config = {}) {
|
|
1376
|
+
const { config, window: window2 } = _init.call(this, "data-binding", $config, {
|
|
1377
|
+
attr: { render: "render", itemIndex: "data-key" },
|
|
1378
|
+
tokens: { nodeType: "processing-instruction", tagStart: "?{", tagEnd: "}?", stateStart: "; [=", stateEnd: "]" },
|
|
1379
|
+
advanced: resolveParams({ runtimeParams: { spec: { handler: (e) => {
|
|
1380
|
+
} } } })
|
|
1381
|
+
});
|
|
1382
|
+
({ CONTEXT_API: config.CONTEXT_API, BINDINGS_API: config.BINDINGS_API, HTML_IMPORTS: config.HTML_IMPORTS } = window2.webqit.oohtml.configs);
|
|
1383
|
+
config.attrSelector = `[${window2.CSS.escape(config.attr.render)}]`;
|
|
1384
|
+
const discreteBindingsMatch = (start, end) => {
|
|
1385
|
+
const starting = `starts-with(., "${start}")`;
|
|
1386
|
+
const ending = `substring(., string-length(.) - string-length("${end}") + 1) = "${end}"`;
|
|
1387
|
+
return `${starting} and ${ending}`;
|
|
1388
|
+
};
|
|
1389
|
+
config.discreteBindingsSelector = `comment()[${discreteBindingsMatch(config.tokens.tagStart, config.tokens.tagEnd)}]`;
|
|
1390
|
+
realtime.call(window2, config);
|
|
1391
|
+
}
|
|
1392
|
+
function realtime(config) {
|
|
1393
|
+
const window2 = this, { webqit: { realdom } } = window2;
|
|
1394
|
+
realdom.realtime(window2.document).query(config.attrSelector, (record) => {
|
|
1395
|
+
record.exits.forEach((e) => {
|
|
1396
|
+
if (!e.isConnected && e.getAttribute(config.attr.render)?.includes("@@disconnected")) {
|
|
1397
|
+
e.dispatchEvent(new Event("@disconnected"));
|
|
1398
|
+
}
|
|
1399
|
+
});
|
|
1400
|
+
cleanup.call(this, ...record.exits);
|
|
1401
|
+
mountInlineBindings.call(window2, config, ...record.entrants);
|
|
1402
|
+
queueMicrotask(() => {
|
|
1403
|
+
});
|
|
1404
|
+
}, { id: "data-binding:attr", live: true, subtree: "cross-roots", timing: "sync", eventDetails: true, staticSensitivity: true });
|
|
1405
|
+
realdom.realtime(window2.document).query(`(${config.discreteBindingsSelector})`, (record) => {
|
|
1406
|
+
cleanup.call(this, ...record.exits);
|
|
1407
|
+
mountDiscreteBindings.call(window2, config, ...record.entrants);
|
|
1408
|
+
queueMicrotask(() => {
|
|
1409
|
+
});
|
|
1410
|
+
}, { id: "data-binding:descrete", live: true, subtree: "cross-roots", timing: "sync" });
|
|
1411
|
+
}
|
|
1412
|
+
function createDynamicScope(config, root) {
|
|
1413
|
+
const { webqit: { realdom, Observer, DOMBindingsContext } } = this;
|
|
1414
|
+
if (_wq(root).has("data-binding"))
|
|
1415
|
+
return _wq(root).get("data-binding");
|
|
1416
|
+
const scope = /* @__PURE__ */ Object.create(null), abortController = new AbortController();
|
|
1417
|
+
scope["$exec__"] = (target, prop, ...args) => {
|
|
1418
|
+
const exec = () => {
|
|
1419
|
+
try {
|
|
1420
|
+
target[prop](...args);
|
|
1421
|
+
} catch (e) {
|
|
1422
|
+
throw new Error(`Error executing "${prop}()": ${e.message} at ${e.cause}`);
|
|
1423
|
+
}
|
|
1424
|
+
};
|
|
1425
|
+
exec();
|
|
1426
|
+
};
|
|
1427
|
+
scope["$assign__"] = (target, prop, val) => {
|
|
1428
|
+
const exec = () => {
|
|
1429
|
+
try {
|
|
1430
|
+
target[prop] = val;
|
|
1431
|
+
} catch (e) {
|
|
1432
|
+
throw new Error(`Error executing "${prop} = ${val}": ${e.message} at ${e.cause}`);
|
|
1433
|
+
}
|
|
1434
|
+
};
|
|
1435
|
+
exec();
|
|
1436
|
+
};
|
|
1437
|
+
Observer.intercept(scope, {
|
|
1438
|
+
get: (e, recieved, next) => {
|
|
1439
|
+
if (!(e.key in scope)) {
|
|
1440
|
+
const request = { ...DOMBindingsContext.createRequest(e.key), live: true, signal: abortController.signal };
|
|
1441
|
+
root[config.CONTEXT_API.api.contexts].request(request, (value) => {
|
|
1442
|
+
Observer.set(scope, e.key, value);
|
|
1443
|
+
});
|
|
1444
|
+
}
|
|
1445
|
+
return next(scope[e.key] ?? (e.key in globalThis ? globalThis[e.key] : void 0));
|
|
1446
|
+
},
|
|
1447
|
+
has: (e, recieved, next) => {
|
|
1448
|
+
return next(true);
|
|
1449
|
+
}
|
|
1450
|
+
});
|
|
1451
|
+
const instance = { scope, abortController, bindings: /* @__PURE__ */ new Map() };
|
|
1452
|
+
_wq(root).set("data-binding", instance);
|
|
1453
|
+
return instance;
|
|
1454
|
+
}
|
|
1455
|
+
function cleanup(...entries) {
|
|
1456
|
+
for (const node of entries) {
|
|
1457
|
+
const root = node.nodeName === "#text" ? node.parentNode : node;
|
|
1458
|
+
const { bindings, abortController } = _wq(root).get("data-binding") || {};
|
|
1459
|
+
if (!bindings?.has(node))
|
|
1460
|
+
return;
|
|
1461
|
+
bindings.get(node).liveProgramHandle.abort();
|
|
1462
|
+
bindings.get(node).signals?.forEach((s) => s.abort());
|
|
1463
|
+
bindings.delete(node);
|
|
1464
|
+
if (!bindings.size) {
|
|
1465
|
+
abortController.abort();
|
|
1466
|
+
_wq(root).delete("data-binding");
|
|
1467
|
+
}
|
|
1468
|
+
}
|
|
1469
|
+
}
|
|
1470
|
+
function patternMatch(config, str) {
|
|
1471
|
+
const tagStart = config.tokens.tagStart.split("").map((x) => `\\${x}`).join("");
|
|
1472
|
+
const tagEnd = config.tokens.tagEnd.split("").map((x) => `\\${x}`).join("");
|
|
1473
|
+
const stateStart = config.tokens.stateStart.split("").map((x) => x === " " ? `(?:\\s+)?` : `\\${x}`).join("");
|
|
1474
|
+
const stateEnd = config.tokens.stateEnd.split("").map((x) => `\\${x}`).join("");
|
|
1475
|
+
const pattern = `^${tagStart}(.*?)(?:${stateStart}(\\d+)${stateEnd}(?:\\s+)?)?${tagEnd}$`;
|
|
1476
|
+
const [, expr, span] = str.match(new RegExp(pattern));
|
|
1477
|
+
return { raw: str, expr, span: parseInt(span ?? 0) };
|
|
1478
|
+
}
|
|
1479
|
+
async function mountDiscreteBindings(config, ...entries) {
|
|
1480
|
+
const window2 = this;
|
|
1481
|
+
const instances = entries.reduce((instances2, node) => {
|
|
1482
|
+
if (node.isBound)
|
|
1483
|
+
return instances2;
|
|
1484
|
+
const template = patternMatch(config, node.nodeValue);
|
|
1485
|
+
let textNode = node;
|
|
1486
|
+
if (template.span) {
|
|
1487
|
+
textNode = node.nextSibling;
|
|
1488
|
+
if (textNode?.nodeName !== "#text" || textNode.nodeValue.length < template.span)
|
|
1489
|
+
return instances2;
|
|
1490
|
+
if (textNode.nodeValue.length > template.span) {
|
|
1491
|
+
textNode.splitText(template.span);
|
|
1492
|
+
}
|
|
1493
|
+
} else {
|
|
1494
|
+
textNode = node.ownerDocument.createTextNode("");
|
|
1495
|
+
node.after(textNode);
|
|
1496
|
+
}
|
|
1497
|
+
textNode.isBound = true;
|
|
1498
|
+
let anchorNode = node;
|
|
1499
|
+
if (window2.webqit.env !== "server") {
|
|
1500
|
+
anchorNode.remove();
|
|
1501
|
+
anchorNode = null;
|
|
1502
|
+
}
|
|
1503
|
+
return instances2.concat({ textNode, template, anchorNode });
|
|
1504
|
+
}, []);
|
|
1505
|
+
for (const { textNode, template, anchorNode } of instances) {
|
|
1506
|
+
const compiled = compileDiscreteBindings.call(window2, config, template.expr);
|
|
1507
|
+
const { scope, bindings } = createDynamicScope.call(this, config, textNode.parentNode);
|
|
1508
|
+
Object.defineProperty(textNode, "$oohtml_internal_databinding_anchorNode", { value: anchorNode, configurable: true });
|
|
1509
|
+
try {
|
|
1510
|
+
bindings.set(textNode, { liveProgramHandle: await (await compiled.bind(textNode, scope)).execute() });
|
|
1511
|
+
} catch (e) {
|
|
1512
|
+
console.log(e);
|
|
1513
|
+
}
|
|
1514
|
+
}
|
|
1515
|
+
}
|
|
1516
|
+
var discreteParseCache = /* @__PURE__ */ new Map();
|
|
1517
|
+
function compileDiscreteBindings(config, str) {
|
|
1518
|
+
if (discreteParseCache.has(str))
|
|
1519
|
+
return discreteParseCache.get(str);
|
|
1520
|
+
let source = `let content = ((${str}) ?? '') + '';`;
|
|
1521
|
+
source += `$assign__(this, 'nodeValue', content);`;
|
|
1522
|
+
source += `if ( this.$oohtml_internal_databinding_anchorNode ) { $assign__(this.$oohtml_internal_databinding_anchorNode, 'nodeValue', "${config.tokens.tagStart}${escDouble(str)}${config.tokens.stateStart}" + content.length + "${config.tokens.stateEnd} ${config.tokens.tagEnd}"); }`;
|
|
1523
|
+
const { webqit: { LiveScript, AsyncLiveScript } } = this;
|
|
1524
|
+
const { parserParams: parserParams2, compilerParams, runtimeParams: runtimeParams2 } = config.advanced;
|
|
1525
|
+
const compiled = new (LiveScript || AsyncLiveScript)(source, { parserParams: parserParams2, compilerParams, runtimeParams: runtimeParams2 });
|
|
1526
|
+
discreteParseCache.set(str, compiled);
|
|
1527
|
+
return compiled;
|
|
1528
|
+
}
|
|
1529
|
+
async function mountInlineBindings(config, ...entries) {
|
|
1530
|
+
for (const node of entries) {
|
|
1531
|
+
const compiled = compileInlineBindings.call(this, config, node.getAttribute(config.attr.render));
|
|
1532
|
+
const { scope, bindings } = createDynamicScope.call(this, config, node);
|
|
1533
|
+
const signals = [];
|
|
1534
|
+
Object.defineProperty(node, "$oohtml_internal_databinding_signals", { value: signals, configurable: true });
|
|
1535
|
+
try {
|
|
1536
|
+
bindings.set(node, { signals, liveProgramHandle: await (await compiled.bind(node, scope)).execute() });
|
|
1537
|
+
} catch (e) {
|
|
1538
|
+
console.log(e);
|
|
1539
|
+
}
|
|
1540
|
+
}
|
|
1541
|
+
}
|
|
1542
|
+
var inlineParseCache = /* @__PURE__ */ new Map();
|
|
1543
|
+
function compileInlineBindings(config, str) {
|
|
1544
|
+
if (inlineParseCache.has(str))
|
|
1545
|
+
return inlineParseCache.get(str);
|
|
1546
|
+
const validation = {};
|
|
1547
|
+
let $event_i = -1;
|
|
1548
|
+
const source = _splitOuter(str, ";").map((str2) => {
|
|
1549
|
+
const [left, right] = _splitOuter(str2, ":").map((x) => x.trim());
|
|
1550
|
+
const directive = left[0], param = left.slice(1).trim();
|
|
1551
|
+
const arg = `(${right})`, $arg = `(${arg} ?? '')`;
|
|
1552
|
+
if (directive === "$") {
|
|
1553
|
+
return `$exec__(this, '${param}', ${arg});`;
|
|
1554
|
+
}
|
|
1555
|
+
if (directive === "&") {
|
|
1556
|
+
if (param.startsWith("--"))
|
|
1557
|
+
return `$exec__(this.style, 'setProperty', "${escDouble(param)}", ${$arg});`;
|
|
1558
|
+
return `$assign__(this.style, "${escDouble(param)}", ${$arg});`;
|
|
1559
|
+
}
|
|
1560
|
+
if (directive === "%")
|
|
1561
|
+
return `$exec__(this.classList, 'toggle', "${escDouble(param)}", !!${arg});`;
|
|
1562
|
+
if (directive === "~") {
|
|
1563
|
+
if (param.startsWith("?"))
|
|
1564
|
+
return `$exec__(this, 'toggleAttribute', "${escDouble(param.substring(1).trim())}", !!${arg});`;
|
|
1565
|
+
return `$exec__(this, 'setAttribute', "${escDouble(param)}", ${$arg});`;
|
|
1566
|
+
}
|
|
1567
|
+
if (directive === "#") {
|
|
1568
|
+
if (validation[param])
|
|
1569
|
+
throw new Error(`Duplicate binding: ${left}.`);
|
|
1570
|
+
validation[param] = true;
|
|
1571
|
+
if (param === "text")
|
|
1572
|
+
return `$assign__(this, 'textContent', ${$arg});`;
|
|
1573
|
+
if (param === "html")
|
|
1574
|
+
return `$assign__(this, 'innerHTML', ${$arg});`;
|
|
1575
|
+
if (param === "items") {
|
|
1576
|
+
const [iterationSpec, importSpec] = _splitOuter(right, "/");
|
|
1577
|
+
if (!importSpec)
|
|
1578
|
+
throw new Error(`Invalid ${directive}items spec: ${str2}; no import specifier.`);
|
|
1579
|
+
let [raw, production, kind, iteratee] = iterationSpec.trim().match(/(.*?[\)\s+])(of|in)([\(\{\[\s+].*)/i) || [];
|
|
1580
|
+
if (!raw)
|
|
1581
|
+
throw new Error(`Invalid ${directive}items spec: ${str2}.`);
|
|
1582
|
+
if (production.startsWith("(")) {
|
|
1583
|
+
production = production.trim().slice(1, -1).split(",").map((x) => x.trim());
|
|
1584
|
+
} else {
|
|
1585
|
+
production = [production];
|
|
1586
|
+
}
|
|
1587
|
+
if (production.length > (kind === "in" ? 3 : 2))
|
|
1588
|
+
throw new Error(`Invalid ${directive}items spec: ${str2}.`);
|
|
1589
|
+
const indices = kind === "in" ? production[2] : production[1] || "$index__";
|
|
1590
|
+
const src = `
|
|
1591
|
+
let $iteratee__ = ${iteratee};
|
|
1592
|
+
let $import__ = this.${config.HTML_IMPORTS.api.import}( ${importSpec.trim()}, true );
|
|
4
1593
|
this.$oohtml_internal_databinding_signals?.push( $import__ );
|
|
5
1594
|
if ( $import__.value && $iteratee__ ) {
|
|
6
1595
|
let $existing__ = new Map;
|
|
7
|
-
[ ...this.children ].filter( el => el.matches( '[${
|
|
8
|
-
$existing__.set( x.getAttribute( '${
|
|
1596
|
+
[ ...this.children ].filter( el => el.matches( '[${config.attr.itemIndex}]' ) ).forEach( x => {
|
|
1597
|
+
$existing__.set( x.getAttribute( '${config.attr.itemIndex}' ), x );
|
|
9
1598
|
} );
|
|
10
|
-
${
|
|
11
|
-
for ( let ${
|
|
12
|
-
${
|
|
13
|
-
${
|
|
14
|
-
let $itemBinding__ = { ${
|
|
1599
|
+
${indices ? `let ${indices} = -1;` : ""}
|
|
1600
|
+
for ( let ${production[0]} ${kind} $iteratee__ ) {
|
|
1601
|
+
${indices ? `${indices} ++;` : ""}
|
|
1602
|
+
${kind === "in" && production[1] ? `let /*value*/${production[1]} = $iteratee__[ ${production[0]} ];` : ""}
|
|
1603
|
+
let $itemBinding__ = { ${production.join(", ")} };
|
|
15
1604
|
|
|
16
|
-
const $key___ = ( ${
|
|
1605
|
+
const $key___ = ( ${kind === "in" ? production[0] : indices} ) + '';
|
|
17
1606
|
let $itemNode__ = $existing__.get( $key___ );
|
|
18
1607
|
if ( $itemNode__ ) {
|
|
19
1608
|
$existing__.delete( $key___ );
|
|
20
|
-
$exec__($itemNode__, '${
|
|
1609
|
+
$exec__($itemNode__, '${config.BINDINGS_API.api.bind}', $itemBinding__ );
|
|
21
1610
|
} else {
|
|
22
1611
|
$itemNode__ = ( Array.isArray( $import__.value ) ? $import__.value[ 0 ] : ( $import__.value instanceof window.HTMLTemplateElement ? $import__.value.content.firstElementChild : $import__.value ) ).cloneNode( true );
|
|
23
|
-
$itemNode__.setAttribute( "${
|
|
24
|
-
$exec__($itemNode__, '${
|
|
1612
|
+
$itemNode__.setAttribute( "${config.attr.itemIndex}", $key___ );
|
|
1613
|
+
$exec__($itemNode__, '${config.BINDINGS_API.api.bind}', $itemBinding__ );
|
|
25
1614
|
$exec__(this, 'appendChild', $itemNode__ );
|
|
26
1615
|
}
|
|
27
1616
|
|
|
28
|
-
if ( ${
|
|
1617
|
+
if ( ${kind === "in" ? `!( ${production[0]} in $iteratee__ )` : `typeof ${production[0]} === 'undefined'`} ) { $itemNode__.remove(); }
|
|
29
1618
|
}
|
|
30
1619
|
$existing__.forEach( x => x.remove() );
|
|
31
1620
|
$existing__.clear();
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
1621
|
+
}`;
|
|
1622
|
+
return src;
|
|
1623
|
+
}
|
|
1624
|
+
}
|
|
1625
|
+
if (directive === "@") {
|
|
1626
|
+
if (param === "@connected") {
|
|
1627
|
+
return `${arg};`;
|
|
1628
|
+
}
|
|
1629
|
+
$event_i++;
|
|
1630
|
+
return `
|
|
1631
|
+
const handler${$event_i} = event => ${right.startsWith("{") ? right : arg};
|
|
1632
|
+
this.addEventListener( '${param}', handler${$event_i}${param === "@disconnected" ? ", { once: true }" : ""} );
|
|
1633
|
+
const abort${$event_i} = () => this.removeEventListener( '${param}', handler${$event_i} );
|
|
1634
|
+
this.$oohtml_internal_databinding_signals?.push( { abort: abort${$event_i} } );
|
|
1635
|
+
`;
|
|
1636
|
+
}
|
|
1637
|
+
if (str2.trim())
|
|
1638
|
+
throw new Error(`Invalid binding: ${str2}.`);
|
|
1639
|
+
}).join(`
|
|
1640
|
+
`);
|
|
1641
|
+
const { webqit: { LiveScript, AsyncLiveScript } } = this;
|
|
1642
|
+
const { parserParams: parserParams2, compilerParams, runtimeParams: runtimeParams2 } = config.advanced;
|
|
1643
|
+
const compiled = new (LiveScript || AsyncLiveScript)(source, { parserParams: parserParams2, compilerParams, runtimeParams: runtimeParams2 });
|
|
1644
|
+
inlineParseCache.set(str, compiled);
|
|
1645
|
+
return compiled;
|
|
1646
|
+
}
|
|
1647
|
+
var escDouble = (str) => str.replace(/"/g, '\\"');
|
|
1648
|
+
|
|
1649
|
+
// src/data-binding/targets.browser.js
|
|
1650
|
+
init.call(window);
|
|
39
1651
|
//# sourceMappingURL=data-binding.js.map
|