ouider 0.1.0 → 0.1.1
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/dom/dom.cjs +2 -2
- package/dist/dom/dom.cjs.map +1 -1
- package/dist/dom/dom.js +2 -2
- package/dist/dom/dom.js.map +1 -1
- package/dist/index.cjs +44 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -1
- package/dist/index.d.ts +7 -1
- package/dist/index.js +44 -7
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -676,6 +676,7 @@ interface Route {
|
|
|
676
676
|
name: string;
|
|
677
677
|
component?: OComponentType<any, any>;
|
|
678
678
|
redirectTo?: string;
|
|
679
|
+
transition?: 'fade' | 'slide';
|
|
679
680
|
}
|
|
680
681
|
declare function useRouter(): Router | undefined;
|
|
681
682
|
declare function createRouter(routes: Routes): Router;
|
|
@@ -713,6 +714,8 @@ declare class Router implements Plugin<any> {
|
|
|
713
714
|
private keepAlive;
|
|
714
715
|
private keepAliveLimit;
|
|
715
716
|
private pendingNav;
|
|
717
|
+
private lastDirection;
|
|
718
|
+
private historyIndex;
|
|
716
719
|
constructor(routes: Routes);
|
|
717
720
|
install(app: App): void;
|
|
718
721
|
resolve(url: string): MatchedRoute | null;
|
|
@@ -725,8 +728,11 @@ declare class Router implements Plugin<any> {
|
|
|
725
728
|
pop(): void;
|
|
726
729
|
private beforeRouteGoing;
|
|
727
730
|
private afterRouteGoing;
|
|
728
|
-
bind(component: ORouter): Promise<(
|
|
731
|
+
bind(component: ORouter): Promise<() => void>;
|
|
729
732
|
unbind(): void;
|
|
733
|
+
private runTransitionPush;
|
|
734
|
+
private runTransitionPop;
|
|
735
|
+
private getNavMode;
|
|
730
736
|
beforeEach(fn: RouteGaurdFunction): (() => void);
|
|
731
737
|
afterEach(fn: RouteGaurdFunction): (() => void);
|
|
732
738
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -676,6 +676,7 @@ interface Route {
|
|
|
676
676
|
name: string;
|
|
677
677
|
component?: OComponentType<any, any>;
|
|
678
678
|
redirectTo?: string;
|
|
679
|
+
transition?: 'fade' | 'slide';
|
|
679
680
|
}
|
|
680
681
|
declare function useRouter(): Router | undefined;
|
|
681
682
|
declare function createRouter(routes: Routes): Router;
|
|
@@ -713,6 +714,8 @@ declare class Router implements Plugin<any> {
|
|
|
713
714
|
private keepAlive;
|
|
714
715
|
private keepAliveLimit;
|
|
715
716
|
private pendingNav;
|
|
717
|
+
private lastDirection;
|
|
718
|
+
private historyIndex;
|
|
716
719
|
constructor(routes: Routes);
|
|
717
720
|
install(app: App): void;
|
|
718
721
|
resolve(url: string): MatchedRoute | null;
|
|
@@ -725,8 +728,11 @@ declare class Router implements Plugin<any> {
|
|
|
725
728
|
pop(): void;
|
|
726
729
|
private beforeRouteGoing;
|
|
727
730
|
private afterRouteGoing;
|
|
728
|
-
bind(component: ORouter): Promise<(
|
|
731
|
+
bind(component: ORouter): Promise<() => void>;
|
|
729
732
|
unbind(): void;
|
|
733
|
+
private runTransitionPush;
|
|
734
|
+
private runTransitionPop;
|
|
735
|
+
private getNavMode;
|
|
730
736
|
beforeEach(fn: RouteGaurdFunction): (() => void);
|
|
731
737
|
afterEach(fn: RouteGaurdFunction): (() => void);
|
|
732
738
|
}
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import jt from'route-parser';var Ct=Object.defineProperty;var kt=Object.getOwnPropertySymbols;var Ut=Object.prototype.hasOwnProperty,Vt=Object.prototype.propertyIsEnumerable;var rt=(c,e,s)=>e in c?Ct(c,e,{enumerable:true,configurable:true,writable:true,value:s}):c[e]=s,X=(c,e)=>{for(var s in e||(e={}))Ut.call(e,s)&&rt(c,s,e[s]);if(kt)for(var s of kt(e))Vt.call(e,s)&&rt(c,s,e[s]);return c};var w=(c,e)=>Ct(c,"name",{value:e,configurable:true});var f=(c,e,s)=>rt(c,typeof e!="symbol"?e+"":e,s);var at=class at{constructor(){f(this,"components",new Map);}register(e,s){console.log(`[OUID] - Registering component: ${e}`);let n=e.toLocaleLowerCase();this.components.has(n)||this.components.set(n,s);}unregister(e){let s=e.toLocaleLowerCase();this.components.delete(s);}get(e){return this.components.get(e.toLocaleLowerCase())}has(e){return this.components.has(e)}getAll(){return Array.from(this.components.entries())}};w(at,"ComponentsRegistry");var G=at,H=new G;var ot=class ot{constructor(e){f(this,"events");this.events=e;}emit(e,...s){let n=this.events[e];n&&n(...s);}};w(ot,"Emits");var Z=ot;var ct=class ct{constructor(e){f(this,"value");this.value=e;}};w(ct,"Stated");var K=ct;function Et(c){return typeof c=="object"&&!Array.isArray(c)&&"value"in c&&c instanceof K}w(Et,"isStated");function Bt(c,e){let s=w((n,i=new Map)=>{if(i.has(n))return i.get(n);let o=new Proxy(n,{set:w((u,p,m)=>{let E=u[p];return typeof m=="object"?u[p]=s(m):u[p]=m,e.didChange(p,E,m),true},"set"),get:w((u,p)=>Reflect.get(u,p),"get")});i.set(n,o);for(let u=n;u;u=Object.getPrototypeOf(u))Object.keys(u).forEach(p=>{let m=n[p];typeof m=="object"&&(n[p]=s(m,i));});return o},"proxify");if(typeof c=="function")throw new Error("Can't create reactive element over a function");return typeof c!="object"&&typeof c!="symbol"?new Proxy(new K(c),{set:w((n,i,o)=>{if(i!=="value")throw new Error(`Undefined property ${String(i)} access`);let u=n[i];return n[i]=o,e.didChange(i,u,o),true},"set"),get:w((n,i)=>{if(i!=="value")throw new Error(`Undefined property ${String(i)} access`);return n[i]},"get")}):new K(s(c))}w(Bt,"stated");var ht=class ht{constructor(e){f(this,"THRESHOLD_TIME",20);f(this,"debounceTime",new Date().getTime());f(this,"state");f(this,"listeners",[]);f(this,"timer",null);this.state=new Proxy(e,{set:w((s,n,i)=>{let o=s[n];return s[n]=i,this.didChange(n,o,i),true},"set"),get:w((s,n)=>s[n],"get")});}wrap(e){return Bt(e,this)}has(e){return e in this.state}setValue(e,s){this.state[e]=s;}getValue(e){return this.state[e]}get value(){return this.state}dispatchChanges(e,s,n){for(let i of this.listeners)i(e,s,n);}async didChange(e,s,n){let i=Date.now();i-this.debounceTime<=this.THRESHOLD_TIME&&this.timer&&await OUID.clearTimeout(this.timer),this.debounceTime=i,this.timer=await OUID.setTimeout(()=>{this.dispatchChanges(e,s,n);},this.THRESHOLD_TIME);}watch(e){return this.listeners.push(e),this.listeners.length-1}unwatch(e){if(typeof e=="number"){this.listeners.splice(e,1);return}this.listeners.splice(this.listeners.indexOf(e),1);}};w(ht,"State");var tt=ht;var Ht=0;function xt(c){return function(e){var i;let s=(i=class extends e{constructor(){super(...arguments);f(this,"template",c.template);f(this,"css",c.css);f(this,"tag",c.tag);f(this,"use",c.use);f(this,"hostClasses",c.hostClasses);f(this,"hash","component-"+Ht+"-"+c.tag);}},w(i,"WithDecoration"),i),n=s;return n.tag=c.tag,s}}w(xt,"Component");var st=class st{constructor(e,s=[]){f(this,"node");f(this,"children");this.node=e,this.children=s;}attachTo(e){if(typeof this.node=="string"){e.innerHTML=this.node;return}let s=this.node;for(let n of this.children)n.attachTo(s);e.appendChild(s);}static of(e,s=[]){return new st(e,s)}addChild(e){return this.children.push(e),this}};w(st,"RenderNode");var q=st,J=class J{constructor(e,s){f(this,"data");f(this,"css");this.data=e,this.css=s;}toString(){let e=this.css?this.css+`
|
|
2
2
|
`:"";for(let s in this.data){let n=this.data[s];typeof n=="string"?e+=`${s} { ${n} }
|
|
3
3
|
`:n instanceof J&&(e+=`${s} {
|
|
4
4
|
${n.toString()}}
|
|
5
5
|
`);}return e}static of(e,...s){return new J(e,s.join(`
|
|
6
|
-
`))}};f(J,"StyleData");var tt=J;function ot(o,e,s){return new o(e,s)}f(ot,"createComponent");var ct=class ct{constructor(e={},s={}){p(this,"state");p(this,"parent");p(this,"emits");p(this,"props");p(this,"provides",new Map);this.state=new Z(this),this.props=e,this.emits=new X(s);}onActivated(){}onDeactivated(){}onMounted(){}willMount(){}willUnmount(){}provide(e,s){this.provides.set(e,s);}inject(e){let s=this;for(;s;){if(s.provides.has(e))return s.provides.get(e);s=s.parent;}}decorateHostElement(e){return Promise.resolve()}};f(ct,"OComponent");var W=ct;function z(o){let e=Date.now();return `${(1e3+Math.floor(Math.random()*9e3)+o.length).toString(16)}-${e.toString(16)}`}f(z,"generateUIID");(function(o){var b,v,k,S,E,A,T,D,B,_,M,H;let e=(b=class{constructor(){p(this,"actions",[]);}async exec(){await this.commit();}add(l){return this.actions.push(l),this}async commit(){let l=this.actions;this.actions=[],await Promise.all(l.map(async t=>await t()));}},f(b,"BatchActions"),b);o.BatchActions=e;let s=(v=class{constructor(l){p(this,"node");p(this,"operations",[]);this.node=l;}async exec(){let l=this.operations;this.operations=[];let t=l.map(i=>typeof i=="object"?this.node[i.fn].apply(this.node,i.args):Promise.resolve(i()));try{await Promise.all(t);}catch{console.error("Error while batch updates");}}append(l,...t){return this.operations.push({fn:l,args:t}),this}add(l){return this.operations.push(l),this}addEventListener(l,t,i,a){return this.append("addEventListener",l,t,{options:i,policy:a})}setProperty(l,t){return this.append("setAttribute",l,t)}dettachEventListener(l){return this.append("dettachEventListener",l)}invoke(l,...t){return this.append("invoke",l,...t)}dispatchEvent(l,t,i){return this.append("dispatchEvent",l,t,i)}addClass(...l){return this.append("addClass",...l)}removeClass(...l){return this.append("removeClass",...l)}setAttribute(l,t){return this.append("setAttribute",l,t)}removeAttribute(l){return this.append("removeAttribute",l)}appendChild(l){return this.append("appendChild",l)}removeChild(l){return this.append("removeChild",l)}remove(){return this.append("remove")}removeAndRelease(){return this.append("removeAndRelease")}release(){return this.append("release")}innerHTML(l){return this.append("setHTML",l)}replaceChildNode(l,t){return this.append("replaceChildNode",l,t)}replaceWith(l){return this.append("replaceWith",l)}after(l){return this.append("after",l)}setInnerText(l){return this.append("setInnerText",l)}setContentText(l){return this.append("setContentText",l)}insertBefore(l,t){return this.append("insertBefore",l,t)}setInputValue(l){return this.append("setInputValue",l)}setStyle(l,t){return this.append("setStyle",l,t)}},f(v,"BatchUpdates"),v);o.BatchUpdates=s;let n=(k=class{constructor(l,t){p(this,"uid");p(this,"tag");this.uid=l,this.tag=t;}async release(){await y.call("releaseNode",this.uid);}async addEventListener(l,t,i){return y.addEventListener(this,l,t,{options:i?.options,policy:i?.policy})}async dettachEventListener(l){await y.dettachEventListener(l);}async invoke(l,...t){return await y.call("invokeObjectMethod",this.uid,l,...t)}async invokeAndHold(l,...t){let i=await y.call("invokeObjectMethodAndHold",this.uid,l,...t);return i&&new k(i.uid,i.tag)}async getProperty(l){return await y.call("getObjectProperty",this.uid,l)}async setProperty(l,t){await y.call("setObjectProperty",this.uid,l,t);}async dispatchEvent(l,t,i){await y.call("dispatchEvent",this.uid,l,t,i);}updates(){return new s(this)}batches(){return new s(this)}get ref(){return {__ref__:this.uid}}},f(k,"OObject"),k);o.OObject=n;let r=(S=class extends n{constructor(t){super(t.uid,t.tag);p(this,"textContent");p(this,"type","Unknown");p(this,"attributes");p(this,"children");p(this,"classes");p(this,"style");for(let i in t)this[i]=t[i];this.attributes??(this.attributes=[]),this.classes??(this.classes=[]),this.style??(this.style="");}},f(S,"ONode"),S);o.ONode=r;let c=(E=class extends r{constructor(t){super(t);p(this,"_hydrated",false);}async addClass(...t){await y.call("addClass",this.uid,...t);}async removeClass(...t){await y.call("removeClass",this.uid,...t);}async setAttribute(t,i){let a=await y.call("setAttribute",this.uid,t,i);a&&(this.attributes=a);}async removeAttribute(t){let i=await y.call("removeAttribute",this.uid,t);i&&(this.attributes=i);}async appendChild(t){await y.call("appendChild",this.uid,t.uid);}set innerHTML(t){this.setHTML(t);}async cloneNode(t){let i=await y.call("cloneNode",this.uid,t);return i?new E(i):null}async remove(){await y.call("removeNode",this.uid);}async removeAndRelease(){await this.remove(),await this.release();}async removeChild(t){await y.call("removeChild",this.uid,t.uid);}async replaceChildNode(t,i){await y.call("replaceChildNode",this.uid,t.uid,i.uid);}async replaceWith(t){await y.call("replaceWith",this.uid,t.uid);}async after(t){await y.call("insertAfter",this.uid,t.uid);}async setHTML(t){await y.call("setInnerHTML",this.uid,t);}async HTML(){return await y.call("getInnerHTML",this.uid)??""}async setInnerText(t){await y.call("setInnerText",this.uid,t);}async setContentText(t){await y.call("setContentText",this.uid,t);}async getContentText(){return await y.call("getContentText",this.uid)??""}async content(){try{return await y.call("getInnerText",this.uid)??""}catch(t){return console.error(t),""}}async childNodes(){return (await y.call("childNodes",this.uid))?.map(t=>new E(t))??[]}hasAttribute(t){return !!this.attributes.find(i=>i.name===t)}async getAttribute(t){return await y.call("getAttribte",this.uid,t)??""}attribute(t){return this.attributes.find(i=>i.name===t)?.value??null}async nextSibling(){let t=await y.call("nextSibling",this.uid);return t?new E(t):null}async getAttributeNames(){return await y.call("getAttributeNames",this.uid)??[]}async parentNode(){let t=await y.call("parentNode",this.uid);return t?new E(t):null}async insertBefore(t,i){await y.call("insertBefore",this.uid,i.uid,t.uid);}async setInputValue(t){await y.call("setInputValue",this.uid,t);}async inputValue(){return await y.call("inputValue",this.uid)??""}get hydrated(){return this._hydrated}hydrate(){this._hydrated=true,this.addClass("hydrated");}async query(t,i){return await y.query(t,i,this.uid)}async queryAll(t,i){return await y.queryAll(t,i,this.uid)}async setStyle(t,i){await y.call("setStyle",this.uid,t,i);}},f(E,"OElement"),E);o.OElement=c;let u=(A=class extends n{constructor(l){super(l.uid,l.tag);}addColorStop(l,t){return this.invoke("addColorStop",l,t),this}},f(A,"CanvasGradient"),A);o.CanvasGradient=u;let w=(T=class extends n{constructor(t){super(t.uid,t.tag);p(this,"batch",new s(this));}static async new(t){let i=typeof t<"u"?await y.newObject("DOMMatrix",t):await y.newObject("DOMMatrix");return i?new T(i):null}invertSelf(){return this.batch.invoke("invertSelf"),this}multiplySelf(t){return this.batch.invoke("multiplySelf",...t?[t.ref]:[]),this}premultiplySelf(t){return this.batch.invoke("premultiplySelf",...t?[t.ref]:[]),this}rotateAxisAngleSelf(t,i,a,h){let d=[];return t&&d.push(t),i&&d.push(i),a&&d.push(a),h&&d.push(h),this.batch.invoke("rotateAxisAngleSelf",...d),this}rotateFromVectorSelf(t,i){let a=[];return t&&a.push(t),i&&a.push(i),this.batch.invoke("rotateFromVectorSelf",...a),this}rotateSelf(t,i,a){let h=[];return t&&h.push(t),i&&h.push(i),a&&h.push(a),this.batch.invoke("rotateFromVectorSelf",...h),this}scale3dSelf(t,i,a,h){let d=[];return t&&d.push(t),i&&d.push(i),a&&d.push(a),h&&d.push(h),this.batch.invoke("scale3dSelf",...d),this}scaleSelf(t,i,a,h,d,C){let P=[];return t&&P.push(t),i&&P.push(i),a&&P.push(a),h&&P.push(h),d&&P.push(d),C&&P.push(C),this.batch.invoke("scaleSelf",...P),this}setMatrixValue(t){return this.invoke("setMatrixValue",t),this}skewXSelf(t){return this.batch.invoke("skewXSelf",t),this}skewYSelf(t){return this.batch.invoke("skewYSelf",t),this}translateSelf(t,i,a){return this.batch.invoke("translateSelf",t,i,...a?[a]:[]),this}async commit(){await this.batch.exec();}async is2D(){return await this.invoke("is2D")??false}async isIdentity(){return await this.invoke("isIdentity")??false}async flipX(){let t=await this.invokeAndHold("flipX");return t?new T(t):null}async flipY(){let t=await this.invokeAndHold("flipY");return t?new T(t):null}async inverse(){let t=await this.invokeAndHold("inverse");return t?new T(t):null}async multiply(t){let i=await this.invokeAndHold("multiply",...t?[t.ref]:[]);return i?new T(i):null}async rotate(t,i,a){let h=[];t&&h.push(t),i&&h.push(i),a&&h.push(a);let d=await this.invokeAndHold("rotate",...h);return d?new T(d):null}async rotateAxisAngle(t,i,a,h){let d=[];t&&d.push(t),i&&d.push(i),a&&d.push(a),h&&d.push(h);let C=await this.invokeAndHold("rotateAxisAngle",...d);return C?new T(C):null}async rotateFromVector(t,i){let a=[];t&&a.push(t),i&&a.push(i);let h=await this.invokeAndHold("rotateFromVector",...a);return h?new T(h):null}async scale(t,i,a,h,d,C){let P=[];t&&P.push(t),i&&P.push(i),a&&P.push(a),h&&P.push(h),d&&P.push(d),C&&P.push(C);let R=await this.invokeAndHold("scale",...P);return R?new T(R):null}async scale3d(t,i,a,h){let d=[];t&&d.push(t),i&&d.push(i),a&&d.push(a),h&&d.push(h);let C=await this.invokeAndHold("scale",...d);return C?new T(C):null}async skewX(t){let i=[];t&&i.push(t);let a=await this.invokeAndHold("skewX",...i);return a?new T(a):null}async skewY(t){let i=[];t&&i.push(t);let a=await this.invokeAndHold("skewY",...i);return a?new T(a):null}toJSON(){return this.invoke("toJSON")}async toString(){return this.invoke("toString")}async translate(t,i,a){let h=[];t&&h.push(t),i&&h.push(i),a&&h.push(a);let d=await this.invokeAndHold("translate",...h);return d?new T(d):null}},f(T,"DOMMatrix"),T);o.DOMMatrix=w;let m=(D=class extends n{constructor(l){super(l.uid,l.tag);}setTransform(l){this.invoke("setTransform",l.ref);}},f(D,"CanvasPattern"),D);o.CanvasPattern=m;let O=(B=class extends n{constructor(t){super(t,"unknown");p(this,"batch",new s(this));}arc(t,i,a,h,d,C=false){return this.batch.invoke("arc",t,i,a,h,d,C),this}arcTo(t,i,a,h,d){return this.batch.invoke("arcTo",t,i,a,h,d),this}bezierCurveTo(t,i,a,h,d,C){return this.batch.invoke("bezierCurveTo",t,i,a,h,d,C),this}clearRect(t,i,a,h){return this.batch.invoke("clearRect",t,i,a,h),this}clip(t,i){let a=[];return typeof t=="string"?a.push(t):t instanceof g&&(t.commit(),a.push(t.ref)),typeof i=="string"&&a.push(i),this.batch.invoke("clip",...a),this}beginPath(){return this.batch.invoke("beginPath"),this}closePath(){return this.batch.invoke("closePath"),this}async createConicGradient(t,i,a){let h=await this.invokeAndHold("createConicGradient",t,i,a);return h?new u(h):null}async createLinearGradient(t,i,a,h){let d=await this.invokeAndHold("createLinearGradient",t,i,a,h);return d?new u(d):null}async createPattern(t,i=""){let a=await this.invokeAndHold("createPattern",t.ref,i);return a?new m(a):null}async createRadialGradient(t,i,a,h,d,C){let P=await this.invokeAndHold("createRadialGradient",t,i,a,h,d,C);return P?new u(P):null}drawImage(t,i,a,h,d,C,P,R,Lt){let q=[t.ref];return typeof C>"u"?(q.push(i,a),h&&q.push(h),d&&q.push(d),this.batch.invoke("drawImage",...q),this):(q.push(i,a,h,d,C,P,R,Lt),this.batch.invoke("drawImage",...q),this)}ellipse(t,i,a,h,d,C,P,R=false){return this.batch.invoke("ellipse",t,i,a,h,d,C,P,R),this}fill(t,i){let a=[];return t&&a.push(typeof t=="string"?t:(t.commit(),t.ref)),i&&a.push(i),this.batch.invoke("fill",...a),this}fillRect(t,i,a,h){return this.batch.invoke("fillRect",t,i,a,h),this}fillText(t,i,a,h){return this.batch.invoke("fillText",t,i,a,...h?[h]:[]),this}getImageData(t,i,a,h,d){return this.invokeAndHold("getImageData",t,i,a,h,...d?[d]:[])}getLineDash(){return this.invoke("getLineDash")}async getTransform(){let t=await this.invokeAndHold("getTransform");return t?new w(t):null}async isContextLost(){return await this.invoke("isContextLost")}async isPointInPath(t,i,a,h){let d=[];return typeof t=="number"?(d.push(t,i),a&&d.push(a)):(t.commit(),d.push(t.ref,i,a,h??"nonzero")),await this.invoke("isPointInPath",...d)??false}async isPointInStroke(t,i,a){let h=[];return typeof t=="number"?h.push(t,i):(t.commit(),h.push(t.ref,i,a)),await this.invoke("isPointInStroke",...h)??false}lineTo(t,i){return this.batch.invoke("lineTo",t,i),this}async measureText(t){return await this.invoke("measureText",t)??0}moveTo(t,i){return this.batch.invoke("moveTo",t,i),this}putImageData(t,i,a,h,d,C,P){let R=[t.ref,i,a];return h&&R.push(h),d&&R.push(d),C&&R.push(C),P&&R.push(P),this.batch.invoke("putImageData",...R),this}quadraticCurveTo(t,i,a,h){return this.batch.invoke("quadraticCurveTo",t,i,a,h),this}rect(t,i,a,h){return this.batch.invoke("rect",t,i,a,h),this}reset(){this.invoke("reset");}resetTransform(){this.invoke("resetTransform");}restore(){return this.invoke("restore")}rotate(t){return this.batch.invoke("rotate",t),this}roundRect(t,i,a,h,d){return this.batch.invoke("roundRect",t,i,a,h,d),this}save(){return this.invoke("save")}scale(t,i){return this.batch.invoke("scale",t,i),this}setLineDash(t){return this.invoke("setLineDash",t)}async setTransform(t,i,a,h,d,C){typeof t=="number"?await this.invoke("setTransform",t,i,a,h,d,C):await this.invoke("setTransform",t.ref);}stroke(t){return this.batch.invoke("stroke",...t?[(t.commit(),t.ref)]:[]),this}strokeRect(t,i,a,h){return this.batch.invoke("strokeRect",t,i,a,h),this}strokeText(t,i,a,h){return this.batch.invoke("strokeText",t,i,a,...h?[h]:[]),this}transform(t,i,a,h,d,C){return this.batch.invoke("transform",t,i,a,h,d,C),this}translate(t,i){return this.batch.invoke("translate",t,i),this}set fillStyle(t){this.setFillStyle(t);}async setFillStyle(t){return await this.setProperty("fillStyle",typeof t=="string"?t:t instanceof n?t.ref:t),this}set filter(t){this.setFilter(t);}async setFilter(t){return await this.setProperty("filter",t),this}set font(t){this.setFont(t);}async setFont(t){return await this.setProperty("font",t),this}set fontKerning(t){this.setFontKerning(t);}async setFontKerning(t){return await this.setProperty("fontKerning",t),this}set fontStretch(t){this.setFontStretch(t);}async setFontStretch(t){return await this.setProperty("fontStretch",t),this}set fontVariantCaps(t){this.setFontVariantCaps(t);}async setFontVariantCaps(t){return await this.setProperty("fontVariantCaps",t),this}set globalAlpha(t){this.setGlobalAlpha(t);}async setGlobalAlpha(t){return await this.setProperty("globalAlpha",t),this}set globalCompositeOperation(t){this.setGlobalCompositeOperation(t);}async setGlobalCompositeOperation(t){return await this.setProperty("globalCompositeOperation",t),this}set imageSmoothingEnabled(t){this.setImageSmoothingEnabled(t);}async setImageSmoothingEnabled(t){return await this.setProperty("imageSmoothingEnabled",t),this}set imageSmoothingQuality(t){this.setImageSmoothingQuality(t);}async setImageSmoothingQuality(t){return await this.setProperty("imageSmoothingQuality",t),this}set letterSpacing(t){this.setLetterSpacing(t);}async setLetterSpacing(t){return await this.setProperty("letterSpacing",t),this}set lineCap(t){this.setLineCap(t);}async setLineCap(t){return await this.setProperty("lineCap",t),this}set lineDashOffset(t){this.setLineDashOffset(t);}async setLineDashOffset(t){return await this.setProperty("lineDashOffset",t),this}set lineJoin(t){this.setLineJoin(t);}async setLineJoin(t){return await this.setProperty("lineJoin",t),this}set lineWidth(t){this.setLineWidth(t);}async setLineWidth(t){return await this.setProperty("lineWidth",t),this}set miterLimit(t){this.setMiterLimit(t);}async setMiterLimit(t){return await this.setProperty("miterLimit",t),this}set shadowBlur(t){this.setShadowBlur(t);}async setShadowBlur(t){return await this.setProperty("shadowBlur",t),this}set shadowColor(t){this.setShadowColor(t);}async setShadowColor(t){return await this.setProperty("shadowColor",t),this}set shadowOffsetX(t){this.setShadowOffsetX(t);}async setShadowOffsetX(t){return await this.setProperty("shadowOffsetX",t),this}set shadowOffsetY(t){this.setShadowOffsetY(t);}async setShadowOffsetY(t){return await this.setProperty("shadowOffsetY",t),this}set strokeStyle(t){this.setStrokeStyle(t);}async setStrokeStyle(t){return await this.setProperty("strokeStyle",typeof t=="string"?t:t instanceof n?t.ref:t),this}set textAlign(t){this.setTextAlign(t);}async setTextAlign(t){return await this.setProperty("textAlign",t),this}set textBaseline(t){this.setTextBaseline(t);}async setTextBaseline(t){return await this.setProperty("textBaseline",t),this}set wordSpacing(t){this.setWordSpacing(t);}async setWordSpacing(t){return await this.setProperty("wordSpacing",t),this}set textRendering(t){this.setTextRendering(t);}async setTextRendering(t){return await this.setProperty("textRendering",t),this}async commit(){await this.batch.exec();}},f(B,"Canvas2DContext"),B);o.Canvas2DContext=O;let L=(_=class extends n{constructor(l){super(l.uid,l.tag);}static async new(l,t){let i=[];l&&i.push(l),t&&i.push(t);let a=await y.newObject("Image",...i);return a?new _(a):null}async width(){return await this.getProperty("width")??0}async height(){return await this.getProperty("height")??0}async naturalWidth(){return await this.getProperty("naturalWidth")??0}async naturalHeight(){return await this.getProperty("naturalHeight")??0}async src(){return await this.getProperty("src")}async currentSrc(){return await this.getProperty("currentSrc")}async setSrc(l){await this.setProperty("src",l);}},f(_,"Image"),_);o.Image=L;let g=(M=class extends n{constructor(t){super(t.uid,t.tag);p(this,"batch",new s(this));}static async create(){let t=await y.newObject("Path2D");return t?new M(t):null}addPath(t){return this.batch.invoke("addPath",t.ref),this}arc(t,i,a,h,d,C=false){return this.batch.invoke("arc",t,i,a,h,d,C),this}arcTo(t,i,a,h,d){return this.batch.invoke("arcTo",t,i,a,h,d),this}bezierCurveTo(t,i,a,h,d,C){return this.batch.invoke("bezierCurveTo",t,i,a,h,d,C),this}quadraticCurveTo(t,i,a,h){return this.batch.invoke("quadraticCurveTo",t,i,a,h),this}closePath(){return this.batch.invoke("closePath"),this}ellipse(t,i,a,h,d,C,P,R=false){return this.batch.invoke("ellipse",t,i,a,h,d,C,P,R),this}moveTo(t,i){return this.batch.invoke("moveTo",t,i),this}lineTo(t,i){return this.batch.invoke("lineTo",t,i),this}rect(t,i,a,h){return this.batch.invoke("rect",t,i,a,h),this}roundRect(t,i,a,h,d){return this.batch.invoke("roundRect",t,i,a,h,d),this}async commit(){await this.batch.exec();}},f(M,"CanvasPath2D"),M);o.CanvasPath2D=g;let x=(H=class extends c{constructor(l){super(l);}async width(){return this.getProperty("width")}async height(){return this.getProperty("height")}async setWidth(l){this.setProperty("width",l);}async setHeight(l){this.setProperty("height",l);}async getContext(l){let t=await this.invokeAndHold("getContext",l);return t&&new O(t.uid)}static async of(l,t,i){let a=await y.query(l,t);return a?new H(a):null}},f(H,"CanvasElement"),H);o.CanvasElement=x;})(I||(I={}));var lt=class lt{constructor(){p(this,"callbacks",new Map);p(this,"DOM_EVENT_LISTENERS",new Map);p(this,"timers",new Map);p(this,"_config");p(this,"listeners",new Map);this.subscribe("__ouid_native_event_success__",(e,s)=>{let n=this.callbacks.get(e);if(n)return this.callbacks.delete(e),n.success(...JSON.parse(s))}),this.subscribe("__ouid_native_event_error__",(e,s)=>{let n=this.callbacks.get(e);if(n)return this.callbacks.delete(e),console.log("Error:",s),n.error(...JSON.parse(s))}),this.subscribe("__ouid_web_event__",(e,s)=>{let n=this.DOM_EVENT_LISTENERS.get(e);if(n){let c=JSON.parse(s)[1];return c&&(c.target=c?.target?new I.OElement(c.target):null,c.currentTarget=c?.currentTarget?new I.OElement(c.currentTarget):null,c.relatedTarget=c?.relatedTarget?new I.OElement(c.relatedTarget):null),n(c)}});}config(e){return this._config=e,this}invoke(e,...s){let n=z(e);return new Promise((r,c)=>{this.callbacks.set(n,{success:r,error:c});try{if(!WebOUID)throw new Error("NativeOUID bridge not available");WebOUID.invoke(n,e,JSON.stringify(s));}catch(u){console.error(u),this.callbacks.delete(n);}})}registerComponent(e,s){U.register(e,s);}unregisterComponent(e,s){U.unregister(e);}async call(e,...s){try{return (await this.invoke(`_ouid_${e}`,...s)).data}catch(n){return console.error(n),null}}emit(e,s){WebOUID?.invoke("event",e,JSON.stringify(s));}subscribe(e,s){this.listeners.has(e)||(this.listeners.set(e,[]),globalThis[e]=(n,r)=>{this.listeners.get(e)?.forEach(c=>c(n,r));}),this.listeners.get(e).push(s);}async query(e,s,n){let r=await this.call("query",e,s,n);return r?new I.OElement(r):null}async queryAll(e,s,n){let r=await this.call("queryAll",e,s,n);return r?r.map(c=>new I.OElement(c)):[]}async createElement(e,s={}){let n=await this.call("createElement",e,s);return n?new I.OElement(n):null}async createComment(e){let s=await this.call("createComment",e);return s?new I.OElement(s):null}async addEventListener(e,s,n,r){let c=z(s+(typeof e=="string"?e:e.tag));return this.DOM_EVENT_LISTENERS.set(c,n),await y.call("attachEventListener",typeof e=="string"?e:e.uid,c,s,r?.options,r?.policy),c}async dettachEventListener(e){this.DOM_EVENT_LISTENERS.delete(e),await y.call("dettachEventListener",e);}async injectComponentStyles(e){let s=await y.call("injectComponentStyles",e);return s?new I.OElement(s):null}async rejectComponentStyles(e){await y.call("rejectComponentStyles",e.uid);}async getOObject(e){let s=await y.call("getOObject",e);return s?new I.OObject(s.uid,s.tag):null}async acquireObject(e){let s=await y.call("acquireObject",e);return s?new I.OObject(s.uid,s.tag):null}async setTimeout(e,s){let n=z("setTimeout"+s);this.DOM_EVENT_LISTENERS.set(n,()=>{e();let c=this.timers.get(r);c&&(this.timers.delete(r),this.DOM_EVENT_LISTENERS.delete(c));});let r=await y.call("setTimeout",n,s)??-1;return r>=0&&this.timers.set(r,n),r}async clearTimeout(e){let s=this.timers.get(e);s&&(this.timers.delete(e),this.DOM_EVENT_LISTENERS.delete(s),await y.call("clearTimeout",e));}async setInterval(e,s){let n=z("setInterval"+s);this.DOM_EVENT_LISTENERS.set(n,e);let r=await y.call("setInterval",n,s)??-1;return r>=0&&this.timers.set(r,n),r}async clearInterval(e){let s=this.timers.get(e);s&&(this.timers.delete(e),this.DOM_EVENT_LISTENERS.delete(s),await y.call("clearInterval",e));}async fetch(e,s,n="json"){return await y.call("fetch",e,s,n)}async alert(e){await y.call("alert",e);}async prompt(e){await y.call("prompt",e);}async newObject(e,...s){return y.call("newObject",e,...s)}};f(lt,"OUIDBridge");var ht=lt,y=new Proxy(new ht,{get:f((o,e)=>e in o?o[e]:async(...s)=>await o.call(e,...s),"get")});globalThis.OUID=y;var I;function Nt(o){return o.replace(/-([a-z])/g,(e,s)=>s.toUpperCase())}f(Nt,"toCamelCase");function _t(o){return o.replace(/(?!^)([A-Z])/g,(e,s)=>`-${s.toLowerCase()}`)}f(_t,"toSnakeCase");function N(o){return vt(o)?o.value:o}f(N,"normaliseValue");var Mt=typeof globalThis.queueMicrotask=="function",V=f(o=>o?Mt?queueMicrotask(o):Promise.resolve().then(o):Promise.resolve(),"deferMicro"),ue=f(()=>new Promise(o=>setTimeout(o,0)),"deferMacro");function Ht(o){return typeof o=="function"&&!("prototype"in o)}f(Ht,"isLazyLoader");var bt=new Map,kt=new Map,Ct=new WeakMap;function xt(o){if(!o||typeof o!="object"&&typeof o!="function")return {};let e=Ct.get(o);if(e)return e;let s=Object.create(null);for(let n=o;n&&n!==Object.prototype;n=Object.getPrototypeOf(n))for(let r of Object.getOwnPropertyNames(n)){if(r==="constructor"||r.startsWith("__")||r.endsWith("__")||r in s)continue;let c=Object.getOwnPropertyDescriptor(n,r);if(!c)continue;let u=c.value??(c.get?c.get.call(o):void 0);s[r]=typeof u=="function"?u.bind(o):u;}return Ct.set(o,s),s}f(xt,"getMethodsView");function Et(o,e){let s=bt.get(o);return s||(s=new Function("s","with (s) { return ("+o+"); }"),bt.set(o,s)),s(e)}f(Et,"evalInScope");function Ut(o){let e=kt.get(o);if(e)return e;let s=[],n=0;for(;n<o.length;){let r=o.indexOf("{{",n);if(r<0){s.push({t:o.slice(n)});break}r>n&&s.push({t:o.slice(n,r)});let c=o.indexOf("}}",r+2),u=c>=0?o.slice(r+2,c).trim():o.slice(r+2).trim();s.push({e:u}),n=c>=0?c+2:o.length;}return e=f(r=>{let c="";for(let u of s)if(u.t!==void 0)c+=u.t;else if(u.e!==void 0){let w=N(Et(u.e,r));c+=w==null?"":String(w);}return c},"fn"),kt.set(o,e),e}f(Ut,"compileInterpolated");var j=class j{constructor(e,s,n,...r){p(this,"app");p(this,"component");p(this,"parentContext");p(this,"bindings",[]);p(this,"directives",[]);p(this,"mountedComponents",new WeakMap);p(this,"componentsRegistry",new G);p(this,"updatingDirectives",false);p(this,"updatingBindings",false);p(this,"_stack",[]);p(this,"flatStack",Object.create(null));p(this,"hydradationActions",new I.BatchActions);this.app=e,this.component=s,this.parentContext=n;for(let c of r)this.push(c);}get hostElement(){return this.component._hostElement}get stack(){return this._stack}set stack(e){this.flatStack=Object.create(null),this._stack=[];for(let s of e)this.push(s);}getMountedComponent(e){return this.mountedComponents.get(e)}bind(e){this.bindings.push(e);}directive(e){this.directives.push(e);}evaluateExpression(e){return this.resolve(e)}resolve(e,s=true,...n){if(!e)return;let r=this.component.state?.value??{},c=xt(r),u=new Proxy(Object.create(null),{get:f((w,m)=>{for(let O=n.length-1;O>=0;O--)if(m in n[O])return n[O][m];return m in this.flatStack?this.flatStack[m]:m in c?c[m]:r[m]},"get"),has:f((w,m)=>n.some(O=>m in O)||m in this.flatStack||m in c||m in r,"has")});try{return Et(e,u)}catch{return}}updateValue(e,s){let n=e.split(/[\.\[]/)[0];n in this.component?this.resolve(`${e}=__o_model_value__`,true,{__o_model_value__:s}):this.resolve(`${e}=__o_model_value__`,true,{__o_model_value__:s}),this.component.state.didChange(n,void 0,s);}push(e){this._stack.unshift(e),Object.assign(this.flatStack,e);}pop(){let e=this._stack.shift();if(e)for(let s of Object.keys(e))delete this.flatStack[s];}resolveTag(e){let s=this;for(;;){if(s.componentsRegistry.has(e))return s.componentsRegistry.get(e);if(s=s?.parentContext??null,!s)break}return U.get(e)}async updateBindings(e){if(this.updatingBindings)return;let s=!e;e=e??new I.BatchActions,this.updatingBindings=true;for(let n of this.bindings)this.updateBinding(n,e);this.updatingBindings=false,s&&await e.commit();}updateBinding(e,s){if(e.type==="model"){e.node.setProperty("value",N(e.context.resolve(e.key)));return}if(e.type==="interpolation"){s.add(async()=>{let n=e.templateFn({...this.flatStack,...xt(this.component.state?.value??{}),...this.component.state?.value??{}});await e.node.setContentText(n);});return}if(e.type==="attribute"){let n=e.key,r=N(this.resolve(e.template));n==="class"?s.add(()=>this.expandClass(e.node,r)):n==="style"?this.expandStyle(e.node,r):typeof r!="object"&&typeof r!="function"&&typeof r!="symbol"&&typeof r<"u"&&s.add(()=>e.node.setAttribute(n,r.toString()));return}if(e.type==="prop"&&e.context.component){let n=N(this.resolve(e.template));try{e.context.component.props[e.key]=n,e.context.updateBindings(),e.context.updateDirectives();}catch(r){console.error(r);}return}}async updateDirectives(e){if(this.updatingDirectives)return;let s=!e;this.updatingDirectives=true,e=e??new I.BatchActions;for(let n of this.directives){if(n.type==="if"){if(!N(n.context.evaluateExpression(n.expr))){if(n.active===false)continue;n.active=false,n.renderedNode&&(n.destroy?(this.unmountComponent(n.renderedNode),await n.renderedNode.removeAndRelease()):await n.renderedNode.addClass("oui-hidden"));continue}if(n.active===true)continue;n.active=true;let c=n.renderedNode;if(!c||n.destroy){let u=await n.node.cloneNode(true);n.renderedNode=u,await n.context.render(u),await n.placeholder.after(u),await n.context.hydradationActions.commit();}else await c.removeClass("oui-hidden");}if(n.type==="for"){let r=n.children??new Map,c=new Map,u=f((b,v)=>n.key?N(n.context.resolve(n.key,true,{[n.item]:b})):v,"keyFn"),w=N(n.context.resolve(n.list))||[],m=new I.BatchActions,O=32,L=0,g=[],x=n.placeholder;for(let b=0;b<w.length;b++){let v=w[b],k=u(v,b),S=r.get(k),E,A,T=x;S?(E=S.node,A=S.ctx,A.stack=[{[n.item]:v},...n.context.stack],m.add(async()=>{let D=await x.nextSibling();E.uid!==D?.uid&&m.add(()=>T.after(E));}),await Promise.all([A.updateBindings(e),A.updateDirectives(e)])):(A=new j(this.app,this.component,this),A.hydradationActions=this.hydradationActions,A.stack=[{[n.item]:v},...n.context.stack],E=await n.node.cloneNode(true),m.add(async()=>{await T.after(E);}),g.push(async()=>{await A.render(E),await A.updateDirectives(e);})),x=E,c.set(k,{node:E,ctx:A}),++L>=O&&(L=0,await m.commit(),await V());}for(let[b,v]of r.entries())c.has(b)||(this.unmountComponent(v.node),m.add(()=>v.node.removeAndRelease()));if(await m.commit(),g.length)for(let v=0;v<g.length;v+=12){let k=g.slice(v,v+12).map(S=>S());await Promise.all(k),await V();}n.children=c;}}s&&await e.commit(),await this.hydradationActions.commit(),this.updatingDirectives=false;}async render(e,s){if(e.hydrated||s?.skipSlotted&&e.hasAttribute("slotted"))return;switch(e.type){case "Text":this.handleTextNode(e);break;case "Element":await this.handleElementNode(e,s);break;}let n=new I.BatchActions;await Promise.all([this.updateBindings(n),this.updateDirectives(n)]),n.commit(),this.hydradationActions.add(()=>e.hydrate());}async expandClass(e,s){let n;typeof s=="object"?Array.isArray(s)?n=s:n=Object.keys(s).filter(r=>s[r]):n=s.toString().split(/\s+/),n.length>0&&await e.addClass(...n);}expandStyle(e,s){let n=s;typeof s=="object"&&!Array.isArray(s)&&(n=Object.keys(s).filter(r=>s[r]).map(r=>`${_t(r)}: ${s[r]}`).join(";")),n&&e.setAttribute("style",n);}expandStandardAttributes(e){let s=e.updates();[...e.attributes].filter(n=>n.name.startsWith(":")).forEach(n=>{let r=n.name.substring(1);this.bind({type:"attribute",node:e,key:r,context:this,template:n.value.trim()}),s.removeAttribute(n.name);}),s.exec();}async handleElementNode(e,s){let n=await e.parentNode(),r=null,c=e.hasAttribute("o-if")?"o-if":e.hasAttribute("o-show")?"o-show":null;if(c){let v=await e.getAttribute(c),k=await OUID.createComment(c+":"+v),S=c==="o-if";await n.insertBefore(k,e),await e.updates().removeAttribute(c).remove().exec(),this.directive({type:"if",expr:v,node:e,placeholder:k,context:this,active:void 0,destroy:S}),r="if";return}if(e.hasAttribute("o-for")){if(r==="if")throw new Error("Can't have o-if and o-for on the same component");let v=await e.getAttribute("o-for"),[k,S]=v.split(" of ").map(T=>T.trim()),E=await OUID.createComment("for:"+v),A=e.attribute(":key")??"";await n?.insertBefore(E,e),await e.updates().removeAttribute("o-for").removeAttribute(":key").remove().exec(),this.directive({type:"for",item:k,list:S,node:e,placeholder:E,context:this,key:A}),r="for";return}let u=e.tag.toLowerCase(),w=this.resolveTag(u),m=e.updates();[...e.attributes].forEach(async v=>{if(v.name==="o-model"){let k=v.value.trim();m.setInputValue(N(this.resolve(k))).addEventListener("input",async E=>{let A=await E.target.getProperty("value");this.updateValue(k,A);}),this.bind({node:e,key:k,type:"model",context:this}),m.removeAttribute(v.name);}});let O={},L={},{props:g,events:x}=this.componentAttributes(e,this);if(O=g,L=x,this.expandStandardAttributes(e),Object.keys(L).forEach(async v=>{let k=L[v];w||m.addEventListener(v,S=>{typeof k=="function"&&k.apply(this.component,[S]);}),m.removeAttribute("@"+v);}),await m.exec(),w){await this.mountComponent(e,w,this,O,L);return}let b=await e.childNodes();s?.skipSlotted&&(b=b.filter(v=>!v.hasAttribute("slotted")));for(let v of b)await this.render(v,s);}handleTextNode(e){let s=e.textContent??"";s.includes("{{")&&this.bind({type:"interpolation",node:e,key:"__template__",templateFn:Ut(s),context:this});}componentAttributes(e,s){let n={},r={},c=["import","interface","module","o-model","o-if","o-for"];return [...e.attributes].filter(u=>!c.includes(u.name)).forEach(u=>{let w=u.name;if(w.startsWith("@")){let L=s?.resolve(u.value,true);if(typeof L!="function")throw new Error("Event handler can only be function");w=w.substring(1),r[w]=L;return}let m=null,O=u.value;w.startsWith(":")&&(m=u.value,w=w.substring(1),O=N(s?.resolve(u.value))),w=Nt(w),n[w]={name:w,value:O,expr:m};}),{props:n,events:r}}async mountComponent(e,s,n,r={},c={}){if(this.mountedComponents.has(e))return this.mountedComponents.get(e);let u=new j(this.app,{},this),w={};for(let g of Object.keys(r)){let x=r[g];x.expr&&this.bind({type:"prop",node:e,key:g,context:u,template:x.expr}),w[g]=x.value;}let m=await Vt(s,w,c);u.component=m,u.stack=[],this.mountedComponents.set(e,m);{let g=e.updates();for(let b of Object.keys(r))r[b].expr||g.setAttribute(b,r[b].value);let x=m.hostClasses??[];x&&(x=typeof x=="string"?[x]:x),x.push("o-component-host"),e.tag.toLowerCase()!=="div"&&x.push("c-"+e.tag.toLowerCase()),g.addClass(...x),await g.exec();}V(async()=>{try{await m.decorateHostElement(e);}catch{}});{let g=m.use??{};for(let x of Object.keys(g))u.componentsRegistry.register(x,g[x]);}if(m.willMount(),!s.cssInstance){let g=m.style?m.style()?.toString():m.css;g&&(s.cssInstance??(s.cssInstance=await OUID.injectComponentStyles(g)));}V(()=>{let g=s.cssInstance;if(g){let x=j.STYLE_REF.get(g)??0;j.STYLE_REF.set(g,x+1),m.cssInstance=g;}});let O=await e.childNodes();if(m.render){let g=await m.render(u);g&&g.attachTo(e);}else await e.setHTML(m.template.trim());let L=await e.queryAll("slot");L&&L.length&&await Promise.all(L.filter(g=>!g.classes?.includes("hydrated")).map(async g=>{let x=g.attribute("name"),b=O.filter(k=>x?k.type==="Element"&&k.attribute("slot")===x:k.type!=="Element"||!k.hasAttribute("slot"));if(!b.length)return;let v=new I.BatchActions;for(let k of b)v.add(()=>k.setAttribute("slotted","true")),v.add(()=>g.appendChild(k));await v.commit(),await Promise.all(b.map(k=>this.render(k)));})),m._hostElement=e,m.parent=n?.component??void 0,m.provide(j.PROVIDE_TOKEN,this);{let g=await e.childNodes(),x=6,b=0;for(;b<g.length;){let v=g.slice(b,b+x);await Promise.all(v.map(k=>u.render(k,{skipSlotted:true}))),b+=x;}await u.hydradationActions.commit();}return V(()=>{try{m.onMounted();}catch{}e.hydrate();}),m.state.watch(()=>{let g=new I.BatchActions;u.updateBindings(g),u.updateDirectives(g),g.commit();}),m}async unmountComponent(e){let s=this.mountedComponents.get(e);if(s){let r=s.cssInstance;if(r){let c=j.STYLE_REF.get(r)??1;c===1?(await OUID.rejectComponentStyles(r),j.STYLE_REF.delete(r)):j.STYLE_REF.set(r,c-1);}s.willUnmount(),s._hostElement=null,s.cssInstance=null;}let n=await e.queryAll("*")??[];for(let r of n)await this.unmountComponent(r);this.mountedComponents.delete(e);}};f(j,"RenderContext"),p(j,"PROVIDE_TOKEN","RENDER_CONTEXT"),p(j,"STYLE_REF",new WeakMap);var $=j;async function de(o,e,s=[],n){let r=e??{},c=await OUID.createElement(o,Object.keys(r).reduce((u,w)=>(u[w]=r[w],u),{}));return Object.keys(n??{}).forEach(u=>{c?.addEventListener(u,w=>{let m=n[u];typeof m=="function"&&m(w);});}),new F(c,s)}f(de,"node");function Vt(o,e,s){return Ht(o)?o().then(n=>ot(n.default,e,s)):ot(o,e,s)}f(Vt,"o");function Bt(o){return typeof o=="function"}f(Bt,"isProvideFunction");var Q=class Q{constructor(e,s){p(this,"root");p(this,"options");p(this,"providers",new Map);this.root=e,this.options=s,Q.currentApp=this;}provide(e,s){if(this.providers.has(e)){console.warn(`[OUID] - Provider ${e} already exists`);return}this.providers.set(e,Bt(s)?{provide:s}:{value:s});}inject(e){return this.providers.get(e)?.value}use(e,s){return e.install(this,s),this}async mount(e){if(!globalThis.__OUI_PUR_JS_CONTEXT__)return;this.options?.css&&await OUID.injectComponentStyles(this.options.css),await OUID.injectComponentStyles(`
|
|
6
|
+
`))}};w(J,"StyleData");var et=J;function ut(c,e,s){return new c(e,s)}w(ut,"createComponent");var lt=class lt{constructor(e={},s={}){f(this,"state");f(this,"parent");f(this,"emits");f(this,"props");f(this,"provides",new Map);this.state=new tt(this),this.props=e,this.emits=new Z(s);}onActivated(){}onDeactivated(){}onMounted(){}willMount(){}willUnmount(){}provide(e,s){this.provides.set(e,s);}inject(e){let s=this;for(;s;){if(s.provides.has(e))return s.provides.get(e);s=s.parent;}}decorateHostElement(e){return Promise.resolve()}};w(lt,"OComponent");var W=lt;function z(c){let e=Date.now();return `${(1e3+Math.floor(Math.random()*9e3)+c.length).toString(16)}-${e.toString(16)}`}w(z,"generateUIID");function dt(c){return new Promise(e=>setTimeout(e,c))}w(dt,"delay");(function(c){var I,T,g,y,b,k,C,A,j,L,N,U;let e=(I=class{constructor(){f(this,"actions",[]);}async exec(){await this.commit();}add(h){return this.actions.push(h),this}async commit(){let h=this.actions;this.actions=[],await Promise.all(h.map(async t=>await t()));}},w(I,"BatchActions"),I);c.BatchActions=e;let s=(T=class{constructor(h){f(this,"node");f(this,"operations",[]);this.node=h;}async exec(){let h=this.operations;this.operations=[];let t=h.map(r=>typeof r=="object"?this.node[r.fn].apply(this.node,r.args):Promise.resolve(r()));try{await Promise.all(t);}catch(r){console.error("Error while batch updates");}}append(h,...t){return this.operations.push({fn:h,args:t}),this}add(h){return this.operations.push(h),this}addEventListener(h,t,r,a){return this.append("addEventListener",h,t,{options:r,policy:a})}setProperty(h,t){return this.append("setAttribute",h,t)}dettachEventListener(h){return this.append("dettachEventListener",h)}invoke(h,...t){return this.append("invoke",h,...t)}dispatchEvent(h,t,r){return this.append("dispatchEvent",h,t,r)}addClass(...h){return this.append("addClass",...h)}removeClass(...h){return this.append("removeClass",...h)}setAttribute(h,t){return this.append("setAttribute",h,t)}removeAttribute(h){return this.append("removeAttribute",h)}appendChild(h){return this.append("appendChild",h)}removeChild(h){return this.append("removeChild",h)}remove(){return this.append("remove")}removeAndRelease(){return this.append("removeAndRelease")}release(){return this.append("release")}innerHTML(h){return this.append("setHTML",h)}replaceChildNode(h,t){return this.append("replaceChildNode",h,t)}replaceWith(h){return this.append("replaceWith",h)}after(h){return this.append("after",h)}setInnerText(h){return this.append("setInnerText",h)}setContentText(h){return this.append("setContentText",h)}insertBefore(h,t){return this.append("insertBefore",h,t)}setInputValue(h){return this.append("setInputValue",h)}setStyle(h,t){return this.append("setStyle",h,t)}},w(T,"BatchUpdates"),T);c.BatchUpdates=s;let n=(g=class{constructor(h,t){f(this,"uid");f(this,"tag");this.uid=h,this.tag=t;}async release(){await v.call("releaseNode",this.uid);}async addEventListener(h,t,r){return v.addEventListener(this,h,t,{options:r==null?void 0:r.options,policy:r==null?void 0:r.policy})}async dettachEventListener(h){await v.dettachEventListener(h);}async invoke(h,...t){return await v.call("invokeObjectMethod",this.uid,h,...t)}async invokeAndHold(h,...t){let r=await v.call("invokeObjectMethodAndHold",this.uid,h,...t);return r&&new g(r.uid,r.tag)}async getProperty(h){return await v.call("getObjectProperty",this.uid,h)}async setProperty(h,t){await v.call("setObjectProperty",this.uid,h,t);}async dispatchEvent(h,t,r){await v.call("dispatchEvent",this.uid,h,t,r);}updates(){return new s(this)}batches(){return new s(this)}get ref(){return {__ref__:this.uid}}},w(g,"OObject"),g);c.OObject=n;let i=(y=class extends n{constructor(t){super(t.uid,t.tag);f(this,"textContent");f(this,"type","Unknown");f(this,"attributes");f(this,"children");f(this,"classes");f(this,"style");for(let d in t)this[d]=t[d];(this.attributes)!=null||(this.attributes=[]),(this.classes)!=null||(this.classes=[]),(this.style)!=null||(this.style="");}},w(y,"ONode"),y);c.ONode=i;let o=(b=class extends i{constructor(t){super(t);f(this,"_hydrated",false);}async addClass(...t){await v.call("addClass",this.uid,...t);}async removeClass(...t){await v.call("removeClass",this.uid,...t);}async setAttribute(t,r){let a=await v.call("setAttribute",this.uid,t,r);a&&(this.attributes=a);}async removeAttribute(t){let r=await v.call("removeAttribute",this.uid,t);r&&(this.attributes=r);}async appendChild(t){await v.call("appendChild",this.uid,t.uid);}set innerHTML(t){this.setHTML(t);}async cloneNode(t){let r=await v.call("cloneNode",this.uid,t);return r?new b(r):null}async remove(){await v.call("removeNode",this.uid);}async removeAndRelease(){await this.remove(),await this.release();}async removeChild(t){await v.call("removeChild",this.uid,t.uid);}async replaceChildNode(t,r){await v.call("replaceChildNode",this.uid,t.uid,r.uid);}async replaceWith(t){await v.call("replaceWith",this.uid,t.uid);}async after(t){await v.call("insertAfter",this.uid,t.uid);}async setHTML(t){await v.call("setInnerHTML",this.uid,t);}async HTML(){var t;return (t=await v.call("getInnerHTML",this.uid))!=null?t:""}async setInnerText(t){await v.call("setInnerText",this.uid,t);}async setContentText(t){await v.call("setContentText",this.uid,t);}async getContentText(){var t;return (t=await v.call("getContentText",this.uid))!=null?t:""}async content(){var t;try{return (t=await v.call("getInnerText",this.uid))!=null?t:""}catch(r){return console.error(r),""}}async childNodes(){var t,r;return (r=(t=await v.call("childNodes",this.uid))==null?void 0:t.map(a=>new b(a)))!=null?r:[]}hasAttribute(t){return !!this.attributes.find(r=>r.name===t)}async getAttribute(t){var r;return (r=await v.call("getAttribte",this.uid,t))!=null?r:""}attribute(t){var r,a;return (a=(r=this.attributes.find(l=>l.name===t))==null?void 0:r.value)!=null?a:null}async nextSibling(){let t=await v.call("nextSibling",this.uid);return t?new b(t):null}async getAttributeNames(){var t;return (t=await v.call("getAttributeNames",this.uid))!=null?t:[]}async parentNode(){let t=await v.call("parentNode",this.uid);return t?new b(t):null}async insertBefore(t,r){await v.call("insertBefore",this.uid,r.uid,t.uid);}async setInputValue(t){await v.call("setInputValue",this.uid,t);}async inputValue(){var t;return (t=await v.call("inputValue",this.uid))!=null?t:""}get hydrated(){return this._hydrated}hydrate(){this._hydrated=true,this.addClass("hydrated");}async query(t,r){return await v.query(t,r,this.uid)}async queryAll(t,r){return await v.queryAll(t,r,this.uid)}async setStyle(t,r){await v.call("setStyle",this.uid,t,r);}},w(b,"OElement"),b);c.OElement=o;let u=(k=class extends n{constructor(h){super(h.uid,h.tag);}addColorStop(h,t){return this.invoke("addColorStop",h,t),this}},w(k,"CanvasGradient"),k);c.CanvasGradient=u;let p=(C=class extends n{constructor(t){super(t.uid,t.tag);f(this,"batch",new s(this));}static async new(t){let r=typeof t!="undefined"?await v.newObject("DOMMatrix",t):await v.newObject("DOMMatrix");return r?new C(r):null}invertSelf(){return this.batch.invoke("invertSelf"),this}multiplySelf(t){return this.batch.invoke("multiplySelf",...t?[t.ref]:[]),this}premultiplySelf(t){return this.batch.invoke("premultiplySelf",...t?[t.ref]:[]),this}rotateAxisAngleSelf(t,r,a,l){let d=[];return t&&d.push(t),r&&d.push(r),a&&d.push(a),l&&d.push(l),this.batch.invoke("rotateAxisAngleSelf",...d),this}rotateFromVectorSelf(t,r){let a=[];return t&&a.push(t),r&&a.push(r),this.batch.invoke("rotateFromVectorSelf",...a),this}rotateSelf(t,r,a){let l=[];return t&&l.push(t),r&&l.push(r),a&&l.push(a),this.batch.invoke("rotateFromVectorSelf",...l),this}scale3dSelf(t,r,a,l){let d=[];return t&&d.push(t),r&&d.push(r),a&&d.push(a),l&&d.push(l),this.batch.invoke("scale3dSelf",...d),this}scaleSelf(t,r,a,l,d,x){let O=[];return t&&O.push(t),r&&O.push(r),a&&O.push(a),l&&O.push(l),d&&O.push(d),x&&O.push(x),this.batch.invoke("scaleSelf",...O),this}setMatrixValue(t){return this.invoke("setMatrixValue",t),this}skewXSelf(t){return this.batch.invoke("skewXSelf",t),this}skewYSelf(t){return this.batch.invoke("skewYSelf",t),this}translateSelf(t,r,a){return this.batch.invoke("translateSelf",t,r,...a?[a]:[]),this}async commit(){await this.batch.exec();}async is2D(){var t;return (t=await this.invoke("is2D"))!=null?t:false}async isIdentity(){var t;return (t=await this.invoke("isIdentity"))!=null?t:false}async flipX(){let t=await this.invokeAndHold("flipX");return t?new C(t):null}async flipY(){let t=await this.invokeAndHold("flipY");return t?new C(t):null}async inverse(){let t=await this.invokeAndHold("inverse");return t?new C(t):null}async multiply(t){let r=await this.invokeAndHold("multiply",...t?[t.ref]:[]);return r?new C(r):null}async rotate(t,r,a){let l=[];t&&l.push(t),r&&l.push(r),a&&l.push(a);let d=await this.invokeAndHold("rotate",...l);return d?new C(d):null}async rotateAxisAngle(t,r,a,l){let d=[];t&&d.push(t),r&&d.push(r),a&&d.push(a),l&&d.push(l);let x=await this.invokeAndHold("rotateAxisAngle",...d);return x?new C(x):null}async rotateFromVector(t,r){let a=[];t&&a.push(t),r&&a.push(r);let l=await this.invokeAndHold("rotateFromVector",...a);return l?new C(l):null}async scale(t,r,a,l,d,x){let O=[];t&&O.push(t),r&&O.push(r),a&&O.push(a),l&&O.push(l),d&&O.push(d),x&&O.push(x);let _=await this.invokeAndHold("scale",...O);return _?new C(_):null}async scale3d(t,r,a,l){let d=[];t&&d.push(t),r&&d.push(r),a&&d.push(a),l&&d.push(l);let x=await this.invokeAndHold("scale",...d);return x?new C(x):null}async skewX(t){let r=[];t&&r.push(t);let a=await this.invokeAndHold("skewX",...r);return a?new C(a):null}async skewY(t){let r=[];t&&r.push(t);let a=await this.invokeAndHold("skewY",...r);return a?new C(a):null}toJSON(){return this.invoke("toJSON")}async toString(){return this.invoke("toString")}async translate(t,r,a){let l=[];t&&l.push(t),r&&l.push(r),a&&l.push(a);let d=await this.invokeAndHold("translate",...l);return d?new C(d):null}},w(C,"DOMMatrix"),C);c.DOMMatrix=p;let m=(A=class extends n{constructor(h){super(h.uid,h.tag);}setTransform(h){this.invoke("setTransform",h.ref);}},w(A,"CanvasPattern"),A);c.CanvasPattern=m;let E=(j=class extends n{constructor(t){super(t,"unknown");f(this,"batch",new s(this));}arc(t,r,a,l,d,x=false){return this.batch.invoke("arc",t,r,a,l,d,x),this}arcTo(t,r,a,l,d){return this.batch.invoke("arcTo",t,r,a,l,d),this}bezierCurveTo(t,r,a,l,d,x){return this.batch.invoke("bezierCurveTo",t,r,a,l,d,x),this}clearRect(t,r,a,l){return this.batch.invoke("clearRect",t,r,a,l),this}clip(t,r){let a=[];return typeof t=="string"?a.push(t):t instanceof P&&(t.commit(),a.push(t.ref)),typeof r=="string"&&a.push(r),this.batch.invoke("clip",...a),this}beginPath(){return this.batch.invoke("beginPath"),this}closePath(){return this.batch.invoke("closePath"),this}async createConicGradient(t,r,a){let l=await this.invokeAndHold("createConicGradient",t,r,a);return l?new u(l):null}async createLinearGradient(t,r,a,l){let d=await this.invokeAndHold("createLinearGradient",t,r,a,l);return d?new u(d):null}async createPattern(t,r=""){let a=await this.invokeAndHold("createPattern",t.ref,r);return a?new m(a):null}async createRadialGradient(t,r,a,l,d,x){let O=await this.invokeAndHold("createRadialGradient",t,r,a,l,d,x);return O?new u(O):null}drawImage(t,r,a,l,d,x,O,_,Mt){let F=[t.ref];return typeof x=="undefined"?(F.push(r,a),l&&F.push(l),d&&F.push(d),this.batch.invoke("drawImage",...F),this):(F.push(r,a,l,d,x,O,_,Mt),this.batch.invoke("drawImage",...F),this)}ellipse(t,r,a,l,d,x,O,_=false){return this.batch.invoke("ellipse",t,r,a,l,d,x,O,_),this}fill(t,r){let a=[];return t&&a.push(typeof t=="string"?t:(t.commit(),t.ref)),r&&a.push(r),this.batch.invoke("fill",...a),this}fillRect(t,r,a,l){return this.batch.invoke("fillRect",t,r,a,l),this}fillText(t,r,a,l){return this.batch.invoke("fillText",t,r,a,...l?[l]:[]),this}getImageData(t,r,a,l,d){return this.invokeAndHold("getImageData",t,r,a,l,...d?[d]:[])}getLineDash(){return this.invoke("getLineDash")}async getTransform(){let t=await this.invokeAndHold("getTransform");return t?new p(t):null}async isContextLost(){return await this.invoke("isContextLost")}async isPointInPath(t,r,a,l){var x;let d=[];return typeof t=="number"?(d.push(t,r),a&&d.push(a)):(t.commit(),d.push(t.ref,r,a,l!=null?l:"nonzero")),(x=await this.invoke("isPointInPath",...d))!=null?x:false}async isPointInStroke(t,r,a){var d;let l=[];return typeof t=="number"?l.push(t,r):(t.commit(),l.push(t.ref,r,a)),(d=await this.invoke("isPointInStroke",...l))!=null?d:false}lineTo(t,r){return this.batch.invoke("lineTo",t,r),this}async measureText(t){var r;return (r=await this.invoke("measureText",t))!=null?r:0}moveTo(t,r){return this.batch.invoke("moveTo",t,r),this}putImageData(t,r,a,l,d,x,O){let _=[t.ref,r,a];return l&&_.push(l),d&&_.push(d),x&&_.push(x),O&&_.push(O),this.batch.invoke("putImageData",..._),this}quadraticCurveTo(t,r,a,l){return this.batch.invoke("quadraticCurveTo",t,r,a,l),this}rect(t,r,a,l){return this.batch.invoke("rect",t,r,a,l),this}reset(){this.invoke("reset");}resetTransform(){this.invoke("resetTransform");}restore(){return this.invoke("restore")}rotate(t){return this.batch.invoke("rotate",t),this}roundRect(t,r,a,l,d){return this.batch.invoke("roundRect",t,r,a,l,d),this}save(){return this.invoke("save")}scale(t,r){return this.batch.invoke("scale",t,r),this}setLineDash(t){return this.invoke("setLineDash",t)}async setTransform(t,r,a,l,d,x){typeof t=="number"?await this.invoke("setTransform",t,r,a,l,d,x):await this.invoke("setTransform",t.ref);}stroke(t){return this.batch.invoke("stroke",...t?[(t.commit(),t.ref)]:[]),this}strokeRect(t,r,a,l){return this.batch.invoke("strokeRect",t,r,a,l),this}strokeText(t,r,a,l){return this.batch.invoke("strokeText",t,r,a,...l?[l]:[]),this}transform(t,r,a,l,d,x){return this.batch.invoke("transform",t,r,a,l,d,x),this}translate(t,r){return this.batch.invoke("translate",t,r),this}set fillStyle(t){this.setFillStyle(t);}async setFillStyle(t){return await this.setProperty("fillStyle",typeof t=="string"?t:t instanceof n?t.ref:t),this}set filter(t){this.setFilter(t);}async setFilter(t){return await this.setProperty("filter",t),this}set font(t){this.setFont(t);}async setFont(t){return await this.setProperty("font",t),this}set fontKerning(t){this.setFontKerning(t);}async setFontKerning(t){return await this.setProperty("fontKerning",t),this}set fontStretch(t){this.setFontStretch(t);}async setFontStretch(t){return await this.setProperty("fontStretch",t),this}set fontVariantCaps(t){this.setFontVariantCaps(t);}async setFontVariantCaps(t){return await this.setProperty("fontVariantCaps",t),this}set globalAlpha(t){this.setGlobalAlpha(t);}async setGlobalAlpha(t){return await this.setProperty("globalAlpha",t),this}set globalCompositeOperation(t){this.setGlobalCompositeOperation(t);}async setGlobalCompositeOperation(t){return await this.setProperty("globalCompositeOperation",t),this}set imageSmoothingEnabled(t){this.setImageSmoothingEnabled(t);}async setImageSmoothingEnabled(t){return await this.setProperty("imageSmoothingEnabled",t),this}set imageSmoothingQuality(t){this.setImageSmoothingQuality(t);}async setImageSmoothingQuality(t){return await this.setProperty("imageSmoothingQuality",t),this}set letterSpacing(t){this.setLetterSpacing(t);}async setLetterSpacing(t){return await this.setProperty("letterSpacing",t),this}set lineCap(t){this.setLineCap(t);}async setLineCap(t){return await this.setProperty("lineCap",t),this}set lineDashOffset(t){this.setLineDashOffset(t);}async setLineDashOffset(t){return await this.setProperty("lineDashOffset",t),this}set lineJoin(t){this.setLineJoin(t);}async setLineJoin(t){return await this.setProperty("lineJoin",t),this}set lineWidth(t){this.setLineWidth(t);}async setLineWidth(t){return await this.setProperty("lineWidth",t),this}set miterLimit(t){this.setMiterLimit(t);}async setMiterLimit(t){return await this.setProperty("miterLimit",t),this}set shadowBlur(t){this.setShadowBlur(t);}async setShadowBlur(t){return await this.setProperty("shadowBlur",t),this}set shadowColor(t){this.setShadowColor(t);}async setShadowColor(t){return await this.setProperty("shadowColor",t),this}set shadowOffsetX(t){this.setShadowOffsetX(t);}async setShadowOffsetX(t){return await this.setProperty("shadowOffsetX",t),this}set shadowOffsetY(t){this.setShadowOffsetY(t);}async setShadowOffsetY(t){return await this.setProperty("shadowOffsetY",t),this}set strokeStyle(t){this.setStrokeStyle(t);}async setStrokeStyle(t){return await this.setProperty("strokeStyle",typeof t=="string"?t:t instanceof n?t.ref:t),this}set textAlign(t){this.setTextAlign(t);}async setTextAlign(t){return await this.setProperty("textAlign",t),this}set textBaseline(t){this.setTextBaseline(t);}async setTextBaseline(t){return await this.setProperty("textBaseline",t),this}set wordSpacing(t){this.setWordSpacing(t);}async setWordSpacing(t){return await this.setProperty("wordSpacing",t),this}set textRendering(t){this.setTextRendering(t);}async setTextRendering(t){return await this.setProperty("textRendering",t),this}async commit(){await this.batch.exec();}},w(j,"Canvas2DContext"),j);c.Canvas2DContext=E;let S=(L=class extends n{constructor(h){super(h.uid,h.tag);}static async new(h,t){let r=[];h&&r.push(h),t&&r.push(t);let a=await v.newObject("Image",...r);return a?new L(a):null}async width(){var h;return (h=await this.getProperty("width"))!=null?h:0}async height(){var h;return (h=await this.getProperty("height"))!=null?h:0}async naturalWidth(){var h;return (h=await this.getProperty("naturalWidth"))!=null?h:0}async naturalHeight(){var h;return (h=await this.getProperty("naturalHeight"))!=null?h:0}async src(){return await this.getProperty("src")}async currentSrc(){return await this.getProperty("currentSrc")}async setSrc(h){await this.setProperty("src",h);}},w(L,"Image"),L);c.Image=S;let P=(N=class extends n{constructor(t){super(t.uid,t.tag);f(this,"batch",new s(this));}static async create(){let t=await v.newObject("Path2D");return t?new N(t):null}addPath(t){return this.batch.invoke("addPath",t.ref),this}arc(t,r,a,l,d,x=false){return this.batch.invoke("arc",t,r,a,l,d,x),this}arcTo(t,r,a,l,d){return this.batch.invoke("arcTo",t,r,a,l,d),this}bezierCurveTo(t,r,a,l,d,x){return this.batch.invoke("bezierCurveTo",t,r,a,l,d,x),this}quadraticCurveTo(t,r,a,l){return this.batch.invoke("quadraticCurveTo",t,r,a,l),this}closePath(){return this.batch.invoke("closePath"),this}ellipse(t,r,a,l,d,x,O,_=false){return this.batch.invoke("ellipse",t,r,a,l,d,x,O,_),this}moveTo(t,r){return this.batch.invoke("moveTo",t,r),this}lineTo(t,r){return this.batch.invoke("lineTo",t,r),this}rect(t,r,a,l){return this.batch.invoke("rect",t,r,a,l),this}roundRect(t,r,a,l,d){return this.batch.invoke("roundRect",t,r,a,l,d),this}async commit(){await this.batch.exec();}},w(N,"CanvasPath2D"),N);c.CanvasPath2D=P;let R=(U=class extends o{constructor(h){super(h);}async width(){return this.getProperty("width")}async height(){return this.getProperty("height")}async setWidth(h){this.setProperty("width",h);}async setHeight(h){this.setProperty("height",h);}async getContext(h){let t=await this.invokeAndHold("getContext",h);return t&&new E(t.uid)}static async of(h,t,r){let a=await v.query(h,t);return a?new U(a):null}},w(U,"CanvasElement"),U);c.CanvasElement=R;})(D||(D={}));var ft=class ft{constructor(){f(this,"callbacks",new Map);f(this,"DOM_EVENT_LISTENERS",new Map);f(this,"timers",new Map);f(this,"_config");f(this,"listeners",new Map);this.subscribe("__ouid_native_event_success__",(e,s)=>{let n=this.callbacks.get(e);if(n)return this.callbacks.delete(e),n.success(...JSON.parse(s))}),this.subscribe("__ouid_native_event_error__",(e,s)=>{let n=this.callbacks.get(e);if(n)return this.callbacks.delete(e),console.log("Error:",s),n.error(...JSON.parse(s))}),this.subscribe("__ouid_web_event__",(e,s)=>{let n=this.DOM_EVENT_LISTENERS.get(e);if(n){let o=JSON.parse(s)[1];return o&&(o.target=o!=null&&o.target?new D.OElement(o.target):null,o.currentTarget=o!=null&&o.currentTarget?new D.OElement(o.currentTarget):null,o.relatedTarget=o!=null&&o.relatedTarget?new D.OElement(o.relatedTarget):null),n(o)}});}config(e){return this._config=e,this}invoke(e,...s){let n=z(e);return new Promise((i,o)=>{this.callbacks.set(n,{success:i,error:o});try{if(!WebOUID)throw new Error("NativeOUID bridge not available");WebOUID.invoke(n,e,JSON.stringify(s));}catch(u){console.error(u),this.callbacks.delete(n);}})}registerComponent(e,s){H.register(e,s);}unregisterComponent(e,s){H.unregister(e);}async call(e,...s){try{return (await this.invoke(`_ouid_${e}`,...s)).data}catch(n){return console.error(n),null}}emit(e,s){WebOUID==null||WebOUID.invoke("event",e,JSON.stringify(s));}subscribe(e,s){this.listeners.has(e)||(this.listeners.set(e,[]),globalThis[e]=(n,i)=>{var o;(o=this.listeners.get(e))==null||o.forEach(u=>u(n,i));}),this.listeners.get(e).push(s);}async query(e,s,n){let i=await this.call("query",e,s,n);return i?new D.OElement(i):null}async queryAll(e,s,n){let i=await this.call("queryAll",e,s,n);return i?i.map(o=>new D.OElement(o)):[]}async createElement(e,s={}){let n=await this.call("createElement",e,s);return n?new D.OElement(n):null}async createComment(e){let s=await this.call("createComment",e);return s?new D.OElement(s):null}async addEventListener(e,s,n,i){let o=z(s+(typeof e=="string"?e:e.tag));return this.DOM_EVENT_LISTENERS.set(o,n),await v.call("attachEventListener",typeof e=="string"?e:e.uid,o,s,i==null?void 0:i.options,i==null?void 0:i.policy),o}async dettachEventListener(e){this.DOM_EVENT_LISTENERS.delete(e),await v.call("dettachEventListener",e);}async injectComponentStyles(e){let s=await v.call("injectComponentStyles",e);return s?new D.OElement(s):null}async rejectComponentStyles(e){await v.call("rejectComponentStyles",e.uid);}async getOObject(e){let s=await v.call("getOObject",e);return s?new D.OObject(s.uid,s.tag):null}async acquireObject(e){let s=await v.call("acquireObject",e);return s?new D.OObject(s.uid,s.tag):null}async setTimeout(e,s){var o;let n=z("setTimeout"+s);this.DOM_EVENT_LISTENERS.set(n,()=>{e();let u=this.timers.get(i);u&&(this.timers.delete(i),this.DOM_EVENT_LISTENERS.delete(u));});let i=(o=await v.call("setTimeout",n,s))!=null?o:-1;return i>=0&&this.timers.set(i,n),i}async clearTimeout(e){let s=this.timers.get(e);s&&(this.timers.delete(e),this.DOM_EVENT_LISTENERS.delete(s),await v.call("clearTimeout",e));}async setInterval(e,s){var o;let n=z("setInterval"+s);this.DOM_EVENT_LISTENERS.set(n,e);let i=(o=await v.call("setInterval",n,s))!=null?o:-1;return i>=0&&this.timers.set(i,n),i}async clearInterval(e){let s=this.timers.get(e);s&&(this.timers.delete(e),this.DOM_EVENT_LISTENERS.delete(s),await v.call("clearInterval",e));}async fetch(e,s,n="json"){return await v.call("fetch",e,s,n)}async alert(e){await v.call("alert",e);}async prompt(e){await v.call("prompt",e);}async newObject(e,...s){return v.call("newObject",e,...s)}};w(ft,"OUIDBridge");var pt=ft,v=new Proxy(new pt,{get:w((c,e)=>e in c?c[e]:async(...s)=>await c.call(e,...s),"get")});globalThis.OUID=v;var D;function Ft(c){return c.replace(/-([a-z])/g,(e,s)=>s.toUpperCase())}w(Ft,"toCamelCase");function qt(c){return c.replace(/(?!^)([A-Z])/g,(e,s)=>`-${s.toLowerCase()}`)}w(qt,"toSnakeCase");function V(c){return Et(c)?c.value:c}w(V,"normaliseValue");var Wt=typeof globalThis.queueMicrotask=="function",B=w(c=>c?Wt?queueMicrotask(c):Promise.resolve().then(c):Promise.resolve(),"deferMicro"),Pt=w(()=>new Promise(c=>setTimeout(c,0)),"deferMacro");function $t(c){return typeof c=="function"&&!("prototype"in c)}w($t,"isLazyLoader");var St=new Map,Ot=new Map,Tt=new WeakMap;function At(c){var n;if(!c||typeof c!="object"&&typeof c!="function")return {};let e=Tt.get(c);if(e)return e;let s=Object.create(null);for(let i=c;i&&i!==Object.prototype;i=Object.getPrototypeOf(i))for(let o of Object.getOwnPropertyNames(i)){if(o==="constructor"||o.startsWith("__")||o.endsWith("__")||o in s)continue;let u=Object.getOwnPropertyDescriptor(i,o);if(!u)continue;let p=(n=u.value)!=null?n:u.get?u.get.call(c):void 0;s[o]=typeof p=="function"?p.bind(c):p;}return Tt.set(c,s),s}w(At,"getMethodsView");function It(c,e){let s=St.get(c);return s||(s=new Function("s","with (s) { return ("+c+"); }"),St.set(c,s)),s(e)}w(It,"evalInScope");function Gt(c){let e=Ot.get(c);if(e)return e;let s=[],n=0;for(;n<c.length;){let i=c.indexOf("{{",n);if(i<0){s.push({t:c.slice(n)});break}i>n&&s.push({t:c.slice(n,i)});let o=c.indexOf("}}",i+2),u=o>=0?c.slice(i+2,o).trim():c.slice(i+2).trim();s.push({e:u}),n=o>=0?o+2:c.length;}return e=w(i=>{let o="";for(let u of s)if(u.t!==void 0)o+=u.t;else if(u.e!==void 0){let p=V(It(u.e,i));o+=p==null?"":String(p);}return o},"fn"),Ot.set(c,e),e}w(Gt,"compileInterpolated");var M=class M{constructor(e,s,n,...i){f(this,"app");f(this,"component");f(this,"parentContext");f(this,"bindings",[]);f(this,"directives",[]);f(this,"mountedComponents",new Map);f(this,"componentsRegistry",new G);f(this,"updatingDirectives",false);f(this,"updatingBindings",false);f(this,"_stack",[]);f(this,"flatStack",Object.create(null));f(this,"hydradationActions",new D.BatchActions);this.app=e,this.component=s,this.parentContext=n;for(let o of i)this.push(o);}get hostElement(){return this.component._hostElement}get stack(){return this._stack}set stack(e){this.flatStack=Object.create(null),this._stack=[];for(let s of e)this.push(s);}getMountedComponent(e){return this.mountedComponents.get(e.uid)}bind(e){this.bindings.push(e);}directive(e){this.directives.push(e);}evaluateExpression(e){return this.resolve(e)}resolve(e,s=true,...n){var p,m;if(!e)return;let i=(m=(p=this.component.state)==null?void 0:p.value)!=null?m:{},o=At(i),u=new Proxy(Object.create(null),{get:w((E,S)=>{for(let P=n.length-1;P>=0;P--)if(S in n[P])return n[P][S];return S in this.flatStack?this.flatStack[S]:S in o?o[S]:i[S]},"get"),has:w((E,S)=>n.some(P=>S in P)||S in this.flatStack||S in o||S in i,"has")});try{return It(e,u)}catch(E){return}}updateValue(e,s){let n=e.split(/[\.\[]/)[0];n in this.component?this.resolve(`${e}=__o_model_value__`,true,{__o_model_value__:s}):this.resolve(`${e}=__o_model_value__`,true,{__o_model_value__:s}),this.component.state.didChange(n,void 0,s);}push(e){this._stack.unshift(e),Object.assign(this.flatStack,e);}pop(){let e=this._stack.shift();if(e)for(let s of Object.keys(e))delete this.flatStack[s];}resolveTag(e){var n;let s=this;for(;;){if(s.componentsRegistry.has(e))return s.componentsRegistry.get(e);if(s=(n=s==null?void 0:s.parentContext)!=null?n:null,!s)break}return H.get(e)}async updateBindings(e){if(this.updatingBindings)return;let s=!e;e=e!=null?e:new D.BatchActions,this.updatingBindings=true;for(let n of this.bindings)this.updateBinding(n,e);this.updatingBindings=false,s&&await e.commit();}updateBinding(e,s){if(e.type==="model"){e.node.setProperty("value",V(e.context.resolve(e.key)));return}if(e.type==="interpolation"){s.add(async()=>{var i,o,u,p;let n=e.templateFn(X(X(X({},this.flatStack),At((o=(i=this.component.state)==null?void 0:i.value)!=null?o:{})),(p=(u=this.component.state)==null?void 0:u.value)!=null?p:{}));await e.node.setContentText(n);});return}if(e.type==="attribute"){let n=e.key,i=V(this.resolve(e.template));n==="class"?s.add(()=>this.expandClass(e.node,i)):n==="style"?this.expandStyle(e.node,i):typeof i!="object"&&typeof i!="function"&&typeof i!="symbol"&&typeof i!="undefined"&&s.add(()=>e.node.setAttribute(n,i.toString()));return}if(e.type==="prop"&&e.context.component){let n=V(this.resolve(e.template));try{e.context.component.props[e.key]=n,e.context.updateBindings(),e.context.updateDirectives();}catch(i){console.error(i);}return}}async updateDirectives(e){var n;if(this.updatingDirectives)return;let s=!e;this.updatingDirectives=true,e=e!=null?e:new D.BatchActions;for(let i of this.directives){if(i.type==="if"){if(!V(i.context.evaluateExpression(i.expr))){if(i.active===false)continue;i.active=false,i.renderedNode&&(i.destroy?(this.unmountComponent(i.renderedNode),await i.renderedNode.removeAndRelease()):await i.renderedNode.addClass("oui-hidden"));continue}if(i.active===true)continue;i.active=true;let u=i.renderedNode;if(!u||i.destroy){let p=await i.node.cloneNode(true);i.renderedNode=p,await i.context.render(p),await i.placeholder.after(p),await i.context.hydradationActions.commit();}else await u.removeClass("oui-hidden");}if(i.type==="for"){let o=(n=i.children)!=null?n:new Map,u=new Map,p=w((T,g)=>i.key?V(i.context.resolve(i.key,true,{[i.item]:T})):g,"keyFn"),m=V(i.context.resolve(i.list))||[],E=new D.BatchActions,S=32,P=0,R=[],I=i.placeholder;for(let T=0;T<m.length;T++){let g=m[T],y=p(g,T),b=o.get(y),k,C,A=I;b?(k=b.node,C=b.ctx,C.stack=[{[i.item]:g},...i.context.stack],E.add(async()=>{let j=await I.nextSibling();k.uid!==(j==null?void 0:j.uid)&&E.add(()=>A.after(k));}),await Promise.all([C.updateBindings(e),C.updateDirectives(e)])):(C=new M(this.app,this.component,this),C.hydradationActions=this.hydradationActions,C.stack=[{[i.item]:g},...i.context.stack],k=await i.node.cloneNode(true),E.add(async()=>{await A.after(k);}),R.push(async()=>{await C.render(k),await C.updateDirectives(e);})),I=k,u.set(y,{node:k,ctx:C}),++P>=S&&(P=0,await E.commit(),await B());}for(let[T,g]of o.entries())u.has(T)||(this.unmountComponent(g.node),E.add(()=>g.node.removeAndRelease()));if(await E.commit(),R.length)for(let g=0;g<R.length;g+=12){let y=R.slice(g,g+12).map(b=>b());await Promise.all(y),await B();}i.children=u;}}s&&await e.commit(),await this.hydradationActions.commit(),this.updatingDirectives=false;}async render(e,s){if(e.hydrated||s!=null&&s.skipSlotted&&e.hasAttribute("slotted"))return;switch(e.type){case "Text":this.handleTextNode(e);break;case "Element":await this.handleElementNode(e,s);break;}let n=new D.BatchActions;await Promise.all([this.updateBindings(n),this.updateDirectives(n)]),n.commit(),this.hydradationActions.add(()=>e.hydrate());}async expandClass(e,s){let n;typeof s=="object"?Array.isArray(s)?n=s:n=Object.keys(s).filter(i=>s[i]):n=s.toString().split(/\s+/),n.length>0&&await e.addClass(...n);}expandStyle(e,s){let n=s;typeof s=="object"&&!Array.isArray(s)&&(n=Object.keys(s).filter(i=>s[i]).map(i=>`${qt(i)}: ${s[i]}`).join(";")),n&&e.setAttribute("style",n);}expandStandardAttributes(e){let s=e.updates();[...e.attributes].filter(n=>n.name.startsWith(":")).forEach(n=>{let i=n.name.substring(1);this.bind({type:"attribute",node:e,key:i,context:this,template:n.value.trim()}),s.removeAttribute(n.name);}),s.exec();}async handleElementNode(e,s){var T;let n=await e.parentNode(),i=null,o=e.hasAttribute("o-if")?"o-if":e.hasAttribute("o-show")?"o-show":null;if(o){let g=await e.getAttribute(o),y=await OUID.createComment(o+":"+g),b=o==="o-if";await n.insertBefore(y,e),await e.updates().removeAttribute(o).remove().exec(),this.directive({type:"if",expr:g,node:e,placeholder:y,context:this,active:void 0,destroy:b}),i="if";return}if(e.hasAttribute("o-for")){if(i==="if")throw new Error("Can't have o-if and o-for on the same component");let g=await e.getAttribute("o-for"),[y,b]=g.split(" of ").map(A=>A.trim()),k=await OUID.createComment("for:"+g),C=(T=e.attribute(":key"))!=null?T:"";await(n==null?void 0:n.insertBefore(k,e)),await e.updates().removeAttribute("o-for").removeAttribute(":key").remove().exec(),this.directive({type:"for",item:y,list:b,node:e,placeholder:k,context:this,key:C}),i="for";return}let u=e.tag.toLowerCase(),p=this.resolveTag(u),m=e.updates();[...e.attributes].forEach(async g=>{if(g.name==="o-model"){let y=g.value.trim();m.setInputValue(V(this.resolve(y))).addEventListener("input",async k=>{let C=await k.target.getProperty("value");this.updateValue(y,C);}),this.bind({node:e,key:y,type:"model",context:this}),m.removeAttribute(g.name);}});let E={},S={},{props:P,events:R}=this.componentAttributes(e,this);if(E=P,S=R,this.expandStandardAttributes(e),Object.keys(S).forEach(async g=>{let y=S[g];p||m.addEventListener(g,b=>{typeof y=="function"&&y.apply(this.component,[b]);}),m.removeAttribute("@"+g);}),await m.exec(),p){await this.mountComponent(e,p,this,E,S);return}let I=await e.childNodes();s!=null&&s.skipSlotted&&(I=I.filter(g=>!g.hasAttribute("slotted")));for(let g of I)await this.render(g,s);}handleTextNode(e){var n;let s=(n=e.textContent)!=null?n:"";s.includes("{{")&&this.bind({type:"interpolation",node:e,key:"__template__",templateFn:Gt(s),context:this});}componentAttributes(e,s){let n={},i={},o=["import","interface","module","o-model","o-if","o-for"];return [...e.attributes].filter(u=>!o.includes(u.name)).forEach(u=>{let p=u.name;if(p.startsWith("@")){let S=s==null?void 0:s.resolve(u.value,true);if(typeof S!="function")throw new Error("Event handler can only be function");p=p.substring(1),i[p]=S;return}let m=null,E=u.value;p.startsWith(":")&&(m=u.value,p=p.substring(1),E=V(s==null?void 0:s.resolve(u.value))),p=Ft(p),n[p]={name:p,value:E,expr:m};}),{props:n,events:i}}async mountComponent(e,s,n,i={},o={}){var P,R,I,g;if(this.mountedComponents.has(e.uid))return this.mountedComponents.get(e.uid);let u=new M(this.app,{},this),p={};for(let y of Object.keys(i)){let b=i[y];b.expr&&this.bind({type:"prop",node:e,key:y,context:u,template:b.expr}),p[y]=b.value;}let m=await Kt(s,p,o);u.component=m,u.stack=[],this.mountedComponents.set(e.uid,m);{let y=e.updates();for(let k of Object.keys(i))i[k].expr||y.setAttribute(k,i[k].value);let b=(P=m.hostClasses)!=null?P:[];b&&(b=typeof b=="string"?[b]:b),b.push("o-component-host"),e.tag.toLowerCase()!=="div"&&b.push("c-"+e.tag.toLowerCase()),y.addClass(...b),await y.exec();}B(async()=>{try{await m.decorateHostElement(e);}catch(y){}});{let y=(R=m.use)!=null?R:{};for(let b of Object.keys(y))u.componentsRegistry.register(b,y[b]);}if(m.willMount(),!s.cssInstance){let y=m.style?(I=m.style())==null?void 0:I.toString():m.css;y&&((s.cssInstance)!=null||(s.cssInstance=await OUID.injectComponentStyles(y)));}B(()=>{var b;let y=s.cssInstance;if(y){let k=(b=M.STYLE_REF.get(y))!=null?b:0;M.STYLE_REF.set(y,k+1),m.cssInstance=y;}});let E=await e.childNodes();if(m.render){let y=await m.render(u);y&&y.attachTo(e);}else await e.setHTML(m.template.trim());let S=await e.queryAll("slot");S&&S.length&&await Promise.all(S.filter(y=>{var b;return !((b=y.classes)!=null&&b.includes("hydrated"))}).map(async y=>{let b=y.attribute("name"),k=E.filter(A=>b?A.type==="Element"&&A.attribute("slot")===b:A.type!=="Element"||!A.hasAttribute("slot"));if(!k.length)return;let C=new D.BatchActions;for(let A of k)C.add(()=>A.setAttribute("slotted","true")),C.add(()=>y.appendChild(A));await C.commit(),await Promise.all(k.map(A=>this.render(A)));})),m._hostElement=e,m.parent=(g=n==null?void 0:n.component)!=null?g:void 0,m.provide(M.PROVIDE_TOKEN,this);{let y=await e.childNodes(),b=6,k=0;for(;k<y.length;){let C=y.slice(k,k+b);await Promise.all(C.map(A=>u.render(A,{skipSlotted:true}))),k+=b;}await u.hydradationActions.commit();}return B(()=>{try{m.onMounted();}catch(y){}e.hydrate();}),m.state.watch(()=>{let y=new D.BatchActions;u.updateBindings(y),u.updateDirectives(y),y.commit();}),m}async unmountComponent(e){var i,o;let s=this.mountedComponents.get(e.uid);if(s){let u=s.cssInstance;if(u){let p=(i=M.STYLE_REF.get(u))!=null?i:1;p===1?(await OUID.rejectComponentStyles(u),M.STYLE_REF.delete(u)):M.STYLE_REF.set(u,p-1);}s.willUnmount(),s._hostElement=null,s.cssInstance=null;}let n=(o=await e.queryAll("*"))!=null?o:[];for(let u of n)await this.unmountComponent(u);this.mountedComponents.delete(e.uid);}};w(M,"RenderContext"),f(M,"PROVIDE_TOKEN","RENDER_CONTEXT"),f(M,"STYLE_REF",new WeakMap);var $=M;async function ge(c,e,s=[],n){let i=e!=null?e:{},o=await OUID.createElement(c,Object.keys(i).reduce((u,p)=>(u[p]=i[p],u),{}));return Object.keys(n!=null?n:{}).forEach(u=>{o==null||o.addEventListener(u,p=>{let m=n[u];typeof m=="function"&&m(p);});}),new q(o,s)}w(ge,"node");function Kt(c,e,s){return $t(c)?c().then(n=>ut(n.default,e,s)):ut(c,e,s)}w(Kt,"o");function Jt(c){return typeof c=="function"}w(Jt,"isProvideFunction");var Q=class Q{constructor(e,s){f(this,"root");f(this,"options");f(this,"providers",new Map);this.root=e,this.options=s,Q.currentApp=this;}provide(e,s){if(this.providers.has(e)){console.warn(`[OUID] - Provider ${e} already exists`);return}this.providers.set(e,Jt(s)?{provide:s}:{value:s});}inject(e){var s;return (s=this.providers.get(e))==null?void 0:s.value}use(e,s){return e.install(this,s),this}async mount(e){var i;if(!globalThis.__OUI_PUR_JS_CONTEXT__)return;(i=this.options)!=null&&i.css&&await OUID.injectComponentStyles(this.options.css),await OUID.injectComponentStyles(`
|
|
7
7
|
* {
|
|
8
8
|
${e} * {
|
|
9
9
|
visibility: hidden;
|
|
@@ -14,18 +14,55 @@ ${n.toString()}}
|
|
|
14
14
|
.oui-hidden {
|
|
15
15
|
display: none !important;
|
|
16
16
|
}
|
|
17
|
-
`);let s=await OUID.query(e);if(!s)throw new Error("No selector found for "+e);let n=new $(this,{},null);n.mountComponent(s,this.root,null).then(()=>{n.updateBindings(),n.updateDirectives();});}};
|
|
17
|
+
`);let s=await OUID.query(e);if(!s)throw new Error("No selector found for "+e);let n=new $(this,{},null);n.mountComponent(s,this.root,null).then(()=>{n.updateBindings(),n.updateDirectives();});}};w(Q,"App"),f(Q,"currentApp",null);var nt=Q;function Ee(c,e){var s;(s=nt.currentApp)==null||s.provide(c,e);}w(Ee,"provide");function Dt(c){var e,s;return (s=(e=nt.currentApp)==null?void 0:e.inject(c))!=null?s:void 0}w(Dt,"inject");function zt(c,e,s,n){var i=arguments.length,o=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,s):n,u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(c,e,s,n);else for(var p=c.length-1;p>=0;p--)(u=c[p])&&(o=(i<3?u(o):i>3?u(e,s,o):u(e,s))||o);return i>3&&o&&Object.defineProperty(e,s,o),o}w(zt,"_ts_decorate");var vt=class vt extends W{constructor(){super(...arguments);f(this,"router");}willMount(){}onMounted(){var s;this.router=Qt(),(s=this.router)==null||s.bind(this).then(n=>{n==null||n();});}willUnmount(){var s;(s=this.router)==null||s.unbind();}};w(vt,"ORouter");var Y=vt;Y=zt([xt({tag:"o-router",template:`
|
|
18
18
|
<div id="router-view"></div>
|
|
19
19
|
`,css:`
|
|
20
20
|
#router-view {
|
|
21
|
-
|
|
21
|
+
position: relative;
|
|
22
|
+
min-height: 100vh;
|
|
23
|
+
width: 100%;
|
|
24
|
+
overflow: hidden;
|
|
22
25
|
}
|
|
23
|
-
|
|
24
|
-
|
|
26
|
+
|
|
27
|
+
.route-view {
|
|
28
|
+
position: absolute;
|
|
29
|
+
inset: 0;
|
|
30
|
+
width: 100%;
|
|
31
|
+
height: 100%;
|
|
32
|
+
will-change: transform, opacity;
|
|
33
|
+
background: var(--o-background, #FEFEFE)
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.route-hidden {
|
|
37
|
+
display: none;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/* shared transition */
|
|
41
|
+
.route-transitioning {
|
|
42
|
+
transition: transform 0.25s ease-out;
|
|
43
|
+
z-index: 999
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/* PUSH: new page comes from right */
|
|
47
|
+
.route-push-start {
|
|
48
|
+
transform: translateX(100%);
|
|
49
|
+
}
|
|
50
|
+
.route-push-end {
|
|
51
|
+
transform: translateX(0%);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/* POP: current page goes to right, revealing underneath */
|
|
55
|
+
.route-pop-start {
|
|
56
|
+
transform: translateX(0%);
|
|
57
|
+
}
|
|
58
|
+
.route-pop-end {
|
|
59
|
+
transform: translateX(100%);
|
|
60
|
+
}
|
|
61
|
+
`})],Y);var Nt="OROUTER_TOKEN",wt="ACTIVE_ROUTE",Lt=250;function Qt(){return Dt(Nt)}w(Qt,"useRouter");function De(c){return new yt(c)}w(De,"createRouter");function Rt(c,e){let s=new jt(c.path).reverse(e);return s===false?"":s}w(Rt,"generatePath");function Yt(c){c&&(c.__isActive=true,typeof c.onActivated=="function"&&c.onActivated());}w(Yt,"activate");function mt(c){c&&(c.__isActive=false,typeof c.onDeactivated=="function"&&c.onDeactivated());}w(mt,"deactivate");var gt=class gt{constructor(e){f(this,"routes");f(this,"windowObject",null);f(this,"guards",[]);f(this,"eventRegistration",null);f(this,"compiled");f(this,"outletEl",null);f(this,"keepAlive",new Map);f(this,"keepAliveLimit",3);f(this,"pendingNav",null);f(this,"lastDirection","none");f(this,"historyIndex",0);this.routes=e,this.compiled=e.map(s=>({route:s,parser:new jt(s.path)}));}install(e){e.provide(Nt,this),OUID.registerComponent("o-router",Y);}resolve(e){let[s,n=""]=e.split("?"),i=n?n.split("&").reduce((o,u)=>{let[p,m=""]=u.split("=");return p&&(o[p]=decodeURIComponent(m)),o},{}):{};for(let o of this.compiled){let u=o.parser.match(s);if(u)return {route:o.route,params:u,query:i}}return null}push(e){var n,i;if(!e.path&&!e.name){console.warn("[OUID-Router]: no path or name provided to push");return}this.lastDirection="forward";let s=w((o,u=true)=>{var m,E;this.historyIndex++;let p={navIndex:this.historyIndex};(m=this.windowObject)==null||m.invoke("history.pushState",p,"",o),u&&((E=this.windowObject)==null||E.dispatchEvent("popstate","PopStateEvent",{state:p}));},"dispatchPushEvent");if(e.name){let o=this.routes.find(p=>p.name===e.name);if(!o){console.warn("[OUID-Router]: No matched route name found");return}let u=Rt(o,(n=e.params)!=null?n:{});s(u);return}if(e.absolute&&e.path&&s(e.path,false),e.path){let o=this.routes.find(u=>u.path===e.path);if(o){let u=Rt(o,(i=e.params)!=null?i:{});s(u);return}}}pop(){var e,s;this.lastDirection="back",(e=this.windowObject)==null||e.invoke("history.back"),(s=this.windowObject)==null||s.dispatchEvent("popstate","PopStateEvent",{state:{}});}async beforeRouteGoing(e,s){for(let n of this.guards.filter(i=>i.type==="before")){let i=await n.fn(e,s);if(i)return i}}async afterRouteGoing(e,s){for(let n of this.guards.filter(i=>i.type==="after")){let i=await n.fn(e,s);if(i)return i}}async bind(e){this.windowObject=await OUID.acquireObject("window");let s=w(async()=>{var A,j;this.windowObject||(this.windowObject=await OUID.acquireObject("window"));let p=await this.windowObject.getProperty("location.pathname"),m=this.resolve(p);if(!m){console.warn(`[Router] No route found for: ${p}`);return}let E=e.inject($.PROVIDE_TOKEN);this.outletEl||(this.outletEl=await E.hostElement.query("#router-view"));let S=this.outletEl;if(!S)return;let P=await this.beforeRouteGoing({url:p,path:p,name:m.route.name},e.inject(wt));if(P){typeof P=="object"&&"name"in P&&this.push({name:P.name,params:P.params});return}e.provide(wt,{params:m.params,query:m.query});let R=m.route.name,I=this.keepAlive.get(R),T=await S.childNodes(),g=(A=T[T.length-1])!=null?A:null,y=g&&(j=E.getMountedComponent(g))!=null?j:null,b=this.getNavMode(),k,C;if(I){k=I.host,C=I.inst;let L=S.updates();T.some(N=>N.uid===k.uid)?L.add(()=>S.appendChild(k)):L.add(()=>S.appendChild(k)),L.add(()=>k.removeClass("route-hidden")),await L.exec(),await Promise.all([I.ctx.updateBindings(),I.ctx.updateDirectives()]);}else {let L=await OUID.createElement("div",{class:"route-view route-hidden"});await S.appendChild(L);let N=await E.mountComponent(L,m.route.component,E);if(k=L,C=N,this.keepAlive.set(R,{host:L,ctx:E,inst:N}),this.keepAlive.size>this.keepAliveLimit){let U=this.keepAlive.keys().next().value;if(U){let it=this.keepAlive.get(U);mt(it.inst),await E.unmountComponent(it.host),await it.host.removeAndRelease(),this.keepAlive.delete(U);}}}b==="push"?(console.log("Push animation: "+g!==null,g),await this.runTransitionPush(S,g,k)):b==="pop"&&g&&await this.runTransitionPop(S,g,k),g&&y&&g.uid!==k.uid&&([...this.keepAlive.values()].some(N=>N.host.uid===g.uid)?mt(y):(mt(y),await E.unmountComponent(g),await g.removeAndRelease())),Yt(C),await this.afterRouteGoing({url:p,path:p,name:m.route.name},e.inject(wt)),await B();},"handler"),n=w(async p=>this.pendingNav?this.pendingNav:(this.pendingNav=(async()=>{try{let m=(p==null?void 0:p.state)||await this.windowObject.getProperty("history.state"),E=0;m&&typeof m.navIndex=="number"&&(E=m.navIndex),E>this.historyIndex?this.lastDirection="forward":E<this.historyIndex?this.lastDirection="back":this.lastDirection="none",this.historyIndex=E,await s();}finally{this.pendingNav=null;}})(),this.pendingNav),"run"),i=await this.windowObject.getProperty("location.pathname"),o=await this.windowObject.getProperty("history.state");(!o||typeof o.navIndex!="number")&&await this.windowObject.invoke("history.replaceState",{navIndex:this.historyIndex},"",i);let u=await this.windowObject.addEventListener("popstate",n);return this.eventRegistration=u,s}unbind(){var e;this.eventRegistration&&((e=this.windowObject)==null||e.dettachEventListener(this.eventRegistration));}async runTransitionPush(e,s,n){if(!s){await n.updates().removeClass("route-hidden","route-transitioning","route-push-start").addClass("route-view","route-push-end").exec();return}let i=n.updates();i.addClass("route-view"),s&&i.add(()=>s.addClass("route-view")),i.removeClass("route-hidden","route-push-end","route-pop-end").addClass("route-push-start"),await i.exec(),await Pt();let o=n.updates();o.addClass("route-transitioning").removeClass("route-push-start").addClass("route-push-end"),await o.exec(),await dt(Lt+40);let u=n.updates();u.removeClass("route-transitioning","route-push-start"),u.add(()=>s==null?void 0:s.addClass("route-hidden")),await u.exec();}async runTransitionPop(e,s,n){let i=s.updates();i.addClass("route-view"),i.add(()=>n.updates().addClass("route-view").removeClass("route-hidden").exec()),i.addClass("route-pop-start").removeClass("route-push-end","route-pop-end"),await i.exec(),await B();let o=s.updates();o.addClass("route-transitioning"),o.removeClass("route-pop-start").addClass("route-pop-end"),await o.exec(),await dt(Lt+40);let u=s.updates();u.addClass("route-hidden").removeClass("route-transitioning","route-pop-start"),await u.exec();}getNavMode(){return this.lastDirection==="back"?"pop":"push"}beforeEach(e){let s={fn:e,type:"before"};return this.guards.push(s),()=>{this.guards.splice(this.guards.indexOf(s));}}afterEach(e){let s={fn:e,type:"after"};return this.guards.push(s),()=>{this.guards.splice(this.guards.indexOf(s));}}};w(gt,"Router");var yt=gt;var bt=class bt extends W{render(e){return q.of('<i class="o-icon"><slot></slot></i>')}style(){return et.of({i:`
|
|
25
62
|
display: inline-block;
|
|
26
63
|
width: 1em;
|
|
27
64
|
height: 1em;
|
|
28
65
|
vertical-align: -0.15em;
|
|
29
66
|
overflow: hidden;
|
|
30
|
-
`})}};
|
|
67
|
+
`})}};w(bt,"OIcon");var _t=bt;function Ue(){return H.getAll().reduce((e,[s,n])=>(e[s]=n,e),{})}w(Ue,"components");export{wt as ACTIVE_ROUTE_TOKEN,nt as App,xt as Component,Z as Emits,W as OComponent,D as ODOM,_t as OIcon,Y as ORouter,v as OUID,pt as OUIDBridge,Nt as ROUTER_INJECTION_TOKEN,$ as RenderContext,q as RenderNode,yt as Router,tt as State,K as Stated,et as StyleData,Ue as components,ut as createComponent,De as createRouter,Pt as deferMacro,B as deferMicro,Dt as inject,Et as isStated,ge as node,Kt as o,Ee as provide,Bt as stated,Qt as useRouter};//# sourceMappingURL=index.js.map
|
|
31
68
|
//# sourceMappingURL=index.js.map
|