@base-framework/base 3.9.10 → 4.0.0
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/base.js +1 -2
- package/dist/chunks/{chunk-TFVBKZUB.js → chunk-2ML3HANA.js} +1 -2
- package/dist/chunks/chunk-66EA7DZY.js +1 -0
- package/dist/chunks/chunk-G32YTH3D.js +1 -0
- package/dist/chunks/chunk-MNKLSGJQ.js +0 -1
- package/dist/chunks/{chunk-KRDITJSA.js → chunk-NGPNK5SD.js} +1 -2
- package/dist/chunks/chunk-PM3QNZ7G.js +1 -0
- package/dist/chunks/chunk-R5DHGQZV.js +0 -1
- package/dist/chunks/chunk-W37VRHGC.js +0 -1
- package/dist/chunks/chunk-ZII2WFZO.js +1 -0
- package/dist/modules/ajax.js +1 -2
- package/dist/modules/component.js +1 -2
- package/dist/modules/data.js +1 -2
- package/dist/modules/date.js +0 -1
- package/dist/modules/html.js +1 -2
- package/dist/modules/router.js +1 -2
- package/dist/modules/state.js +1 -2
- package/dist/types/base.d.ts +2 -1
- package/dist/types/entries/component.d.ts +3 -0
- package/dist/types/entries/data.d.ts +1 -0
- package/dist/types/entries/router.d.ts +2 -0
- package/dist/types/modules/component/unit.d.ts +12 -2
- package/dist/types/modules/data/types/model/model.d.ts +15 -1
- package/dist/types/modules/layout/directives/core/default-directives.d.ts +1 -1
- package/dist/types/modules/state/state.d.ts +1 -1
- package/package.json +10 -6
- package/dist/chunks/chunk-6VPBF5VF.js +0 -2
- package/dist/chunks/chunk-AO5L25YQ.js +0 -2
- package/dist/chunks/chunk-CNIJE66G.js +0 -2
- package/dist/chunks/chunk-DWOYCZYJ.js +0 -2
- package/dist/chunks/chunk-E3C6NOMV.js +0 -2
- package/dist/chunks/chunk-FXJIFTW5.js +0 -2
- package/dist/chunks/chunk-GNJZ6CEA.js +0 -2
- package/dist/chunks/chunk-ILT4B3VY.js +0 -2
- package/dist/chunks/chunk-KNBYBDOP.js +0 -2
- package/dist/chunks/chunk-QXTQMPCM.js +0 -2
- package/dist/chunks/chunk-T3WI7GCT.js +0 -2
- package/dist/chunks/chunk-TDLN57VY.js +0 -2
- package/dist/chunks/chunk-VRFEYZE5.js +0 -2
- package/dist/meta.json +0 -1
|
@@ -1,2 +1 @@
|
|
|
1
|
-
import{b as k,c as x}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-KRDITJSA.js.map
|
|
1
|
+
import{b as k,c as x}from"./chunk-ZII2WFZO.js";import{a as b}from"./chunk-R5DHGQZV.js";var a=class{constructor(e=1e3){this.cache=new Map,this.maxSize=e,this.evictCount=e>=8?e>>3:1}get(e){let t=this.cache.get(e);if(t!==void 0)return t.used=!0,t.value}has(e){return this.cache.has(e)}set(e,t){let s=this.cache,n=s.get(e);if(n!==void 0){n.value=t,n.used=!0;return}s.set(e,{value:t,used:!1}),s.size>this.maxSize&&this.evict()}evict(){let e=this.cache,t=this.maxSize-this.evictCount+1;for(let s=0;s<2&&e.size>t;s++){let n=e.keys(),r=e.size;for(;r-- >0&&e.size>t;){let o=n.next().value,h=e.get(o);if(h!==void 0&&h.used){h.used=!1;continue}e.delete(o)}}}delete(e){this.cache.delete(e)}clear(){this.cache.clear()}};var g=new WeakMap,y=new WeakMap;function D(i){if(!i||typeof i!="object")return i;let e=y.get(i);return e!==void 0?e:i}var _=new WeakMap;function C(i,e,t,s){let n=g.get(i);n||(n=new Map,g.set(i,n));let r=n.get(t);if(r)return r;let o=new Proxy(i,v(e,t,s));return n.set(t,o),y.set(o,i),o}function M(i){i&&typeof i=="object"&&g.delete(i)}function S(i,e){let t=e.charCodeAt(0),s=t>=48&&t<=57;return i===""?s?"["+e+"]":e:s?i+"["+e+"]":i+"."+e}function v(i,e="",t=""){return{get(s,n,r){let o=s[n];if(e===""&&n in s){if(typeof o=="function"){let c=_.get(s);c||(c=new Map,_.set(s,c));let u=c.get(n);if(u)return u;let m=o.bind(s);return c.set(n,m),m}return o}if(o=(s[t]||s)[n],o!==null&&typeof o=="object"){let c=S(e,n);return C(o,i,c,t)}return o},set(s,n,r,o){if(e===""&&n in s)return s[n]=r,!0;let c=(s[t]||s)[n],u=S(e,n);return i.set(u,r),c!==r&&c!==null&&typeof c=="object"&&M(c),!0}}}var w=(i,e="stage")=>{let t=new Proxy(i,v(i,"",e));return y.set(t,i),t};var f=class{static resume(e,t){if(!e)return null;let s=localStorage.getItem(e);if(s===null)return t!==void 0?t:void 0;try{let n=JSON.parse(s);return n===null&&t!==void 0?t:n}catch(n){return console.warn('[LocalData] Failed to parse stored value for key "'+e+'". Removing corrupted entry.',n),localStorage.removeItem(e),t!==void 0?t:void 0}}static store(e,t){if(!e||!t)return!1;try{let s=JSON.stringify(t);return localStorage.setItem(e,s),!0}catch(s){return console.error('[LocalData] Failed to store data for key "'+e+'".',s),!1}}static remove(e){return e?(localStorage.removeItem(e),!0):!1}};var E=(i={})=>{let e={};if(!b.isObject(i))return e;let t=Object.keys(i);for(let s=0,n=t.length;s<n;s++){let r=t[s],o=i[r];typeof o!="function"&&(e[r]=o)}return e};var P=0,L=new a(2e3),d={CHANGE:"change",DELETE:"delete"},p=(i,e)=>{let t=L.get(i);return t||(t={change:`${i}:change`,delete:`${i}:delete`},L.set(i,t)),e==="change"?t.change:t.delete},l=class{constructor(e={}){this.dirty=!1,this._retainState=!1,this._refreshState=!1,this.links=new Map,this._init(),this.setup(),this.dataTypeId="bd",this.eventSub=new k;let t=E(e);this.set(t);let s=w(this);return this._proxy=s,s}retainState(){return this._retainState=!0,this._proxy||this}refreshState(){return this._refreshState=!0,this._proxy||this}setup(){this.stage={}}_init(){let e=++P;this._dataNumber=e,this._id=`dt-${e}`,this._dataId=`${this._id}:`}onFlush(e){this.eventSub.onFlush(e)}flushPending(){this.eventSub.flush()}getDataId(){return String(this._id)}remove(){this.unlink(),this.eventSub.reset()}on(e,t){let s=p(e,d.CHANGE);return this.eventSub.on(s,t)}off(e,t){let s=p(e,d.CHANGE);this.eventSub.off(s,t)}_setAttr(e,t,s=this,n=!1){let r=this.stage[e];t!==r&&(this.stage[e]=t,this._publish(e,t,s,d.CHANGE))}publishLocalEvent(e,t,s,n){let r=p(e,n);this.eventSub.publish(r,t,s)}_publish(e,t,s,n){this.publishLocalEvent(e,t,s,n),s=s||this,x.publish(this._dataId+e,t,s)}set(e,t,s){if(typeof e!="object")return this._setAttr(e,t,s),this;let n=Object.keys(e);for(let r=0;r<n.length;r++){let o=n[r],h=e[o];typeof h!="function"&&this._setAttr(o,h,t,s)}return this}_silentSet(e){let t=this.stage,s=Object.keys(e);for(let n=0,r=s.length;n<r;n++){let o=s[n];t[o]=e[o]}}getModelData(){return this.stage}_deleteAttr(e,t,s=this){delete e[t],this.publishLocalEvent(t,null,s,d.DELETE)}toggle(e){return typeof e>"u"?this:(this.set(e,!this.get(e)),this)}increment(e,t=null){if(typeof e>"u")return this;t=t!==null&&typeof t=="number"?t:1;let s=this.get(e);return this.set(e,s+t),this}decrement(e,t=null){if(typeof e>"u")return this;t=t!==null&&typeof t=="number"?t:1;let s=this.get(e);return this.set(e,s-t),this}concat(e,t){if(typeof e>"u")return this;let s=this.get(e);return this.set(e,s+t),this}ifNull(e,t){return this.get(e)===null&&this.set(e,t),this}setKey(e,t){return this.key=t!=null?e+":v"+t:e,this}resume(e){let t=f.resume(String(this.key),e);return t?(this.set(t),this):this}store(){let e=this.get();return f.store(String(this.key),e)}delete(e){return typeof e=="string"?(this._deleteAttr(this.stage,e),this):(this.setup(),this)}_getAttr(e,t){return e[t]}get(e){return typeof e<"u"?this._getAttr(this.stage,e):this.getModelData()}link(e,t,s){if(arguments.length===1&&e.isData===!0&&(t=e.get()),typeof t!="object")return this.remoteLink(e,t,s);let n=[];return Object.entries(t).forEach(([r])=>{n.push(this.remoteLink(e,r))}),n}remoteLink(e,t,s){let n=s||t,r=e.get(t);typeof r<"u"&&this.get(t)!==r&&this.set(t,r);let o=e.on(t,(c,u)=>{if(u===this)return!1;this.set(n,c,e)}),h=this.on(n,(c,u)=>{if(u===e)return!1;e.set(t,c,this)});return this.addLink(o,e,t,h),e.addLink(h,this,n,o),o}addLink(e,t,s,n){this.links.set(e,{data:t,attr:s,pair:n})}unlink(e){if(e){this.removeLink(e);return}let t=this.links;t.size!==0&&(t.forEach((s,n)=>{this.removeLink(n,!1)}),t.clear())}removeLink(e,t=!0){let s=this.links.get(e);if(s){let n=s.data;s.attr&&n.off(s.attr,e);let r=s.pair,o=r&&n.links;if(o){let h=o.get(r);h&&(o.delete(r),h.attr&&this.off(h.attr,r))}}t!==!1&&this.links.delete(e)}};l.prototype.isData=!0;var A=class extends l{};export{a,D as b,w as c,E as d,d as e,l as f,A as g};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as D,b as Q,c as P}from"./chunk-2ML3HANA.js";import{a as _}from"./chunk-W37VRHGC.js";import{b as g}from"./chunk-G32YTH3D.js";import{a as B}from"./chunk-NGPNK5SD.js";import{c as F}from"./chunk-ZII2WFZO.js";import{b as U,c as m}from"./chunk-R5DHGQZV.js";var S={items:new Map,add(s,t){return this.items.set(s,t),this},get(s){return this.items.get(s)??null}};var kt=(...s)=>{for(let t=0,e=s.length;t<e;t++){let r=s[t];if(r)for(let n in r)Object.prototype.hasOwnProperty.call(r,n)&&S.add(n,r[n])}return S};U.addType("components",s=>{if(!s)return;let t=s.component;!t||!t.isUnit||(t.persistToken&&t.parent&&t.parent.removePersistedChild(t.persistToken),t.rendered===!0&&(t.prepareDestroy(),t.cleanUpAfterDestroy()))});var st=0,w=class{constructor(t,e,r){this.isUnit=!0,this.data=null,this.persist=null,this.nest=null,this.state=null,this.panel=null,this.parent=null,this.unitType=null,this._classId,this.id="",this.cached=[],this.init();let n,i;if(t==null)n={},i=[];else{let o=typeof t;o==="string"||o==="number"?(n={},i=[{tag:"text",textContent:t}]):Array.isArray(t)?(n={},i=t):(n=t||{},i=typeof e=="string"?[{tag:"text",textContent:e}]:e)}this.setupProps(n),this.children=i||[],this.persistedChildren={},this.persistedCount=0,this.onCreated(),this.rendered=!1,this.container=null}init(){this.id="cp-"+st++,this.unitType=this._classId||this.constructor.name.toLowerCase()}declareProps(){}addPersistedChild(t){let e=t.key,r=t.cache,n;r!=null&&e!=null?n="pk:"+r+":"+e:r!=null?n="pk:"+r:e!=null?n="pk:"+e:n="pc"+this.persistedCount++;let i=this.persistedChildren[n];return i&&t.unitType===i.unitType&&t.resumeScope(i),t.persistToken=n,this.persistedChildren[n]=t,n}removePersistedChild(t){this.rendered&&(!t||!this.persistedChildren[t]||delete this.persistedChildren[t])}setupProps(t){if(this.declareProps(),!(!t||typeof t!="object"))for(let e in t)Object.prototype.hasOwnProperty.call(t,e)&&(this[e]=t[e],e==="data"&&(this._externalData=!0))}getChildScope(){return this}getParentContext(){return this.parent?this.parent.getContext():null}setupContext(){if(this._contextResumed)return;let t=this.getParentContext(),e=this.setContext(t);if(e){this.context=e;return}this.context=t,this.setupAddingContext()}setupAddingContext(){let t=this.context,e=this.addContext(t);if(!e)return;let r=e[0];r&&(this.addingContext=!0,this.contextBranchName=r,this.addContextBranch(r,e[1]))}addContextBranch(t,e){this.context??(this.context={}),this.context[t]=e}setContext(t){return null}addContext(t){return null}removeContext(){this.addingContext&&this.removeContextBranch(this.contextBranchName)}removeContextBranch(t){t&&delete this.context[t]}getContext(){return this.context}onCreated(){}render(){return{}}_cacheRoot(t){return t&&(t.id||(t.id=this.getId()),t.cache="panel",t)}_createLayout(){return this.render()}prepareLayout(){let t=this._createLayout();return this._cacheRoot(t)}afterBuild(){U.add(this.panel,"components",{component:this}),this.rendered=!0,this.afterLayout()}afterLayout(){this.afterSetup()}if(t,e){return t?e||t:null}map(t,e){let r=[];if(!t||t.length<1)return r;for(let n=0,i=t.length;n<i;n++){let o=e(t[n],n);r.push(o)}return r}removeAll(t){return P.removeAll(t)}getId(t){let e=this.id;return typeof t=="string"&&(e+="-"+t),e}cacheEle(t,e){e&&(this[e]=t,this.cached.push(e))}initialize(){this.setupContext(),this.beforeSetup()}beforeSetup(){}afterSetup(){}setup(t){this.setContainer(t),this.initialize()}setContainer(t){this.container=t}_remove(){this.prepareDestroy();let t=this.panel;t&&P.removeElement(t),this.cleanUpAfterDestroy()}cleanUpAfterDestroy(){this.panel=null,this.container=null;let t=this.cached;for(let e=0,r=t.length;e<r;e++)this[t[e]]=null;this.cached=[],this.persist!==!0&&(this.persistedChildren={},this.persistToken=null)}prepareDestroy(){this.persistedCount=0,this.rendered=!1;try{this.beforeDestroy()}catch(t){console.error("Error in beforeDestroy:",t)}this.removeContext(),this.data&&this.persist!==!0&&typeof this.data.unlink=="function"&&this.data.unlink()}beforeDestroy(){}destroy(){this._remove()}};var v=class{static resume(t,e){if(t._externalData){this._resumeExternal(t,e);return}this._resumeOwned(t,e)}static refresh(t){let e=t.setData();e&&t.data&&t.data.set(e.stage),this.refreshContext(t)}static refreshContext(t){let e=t.context;if(!e||!e.data)return;let r=t.getParentContext();if(!r||!r.data)return;let n=r.data.stage,i=e.data.stage,o=null;for(let a in n){if(!Object.prototype.hasOwnProperty.call(n,a))continue;let l=n[a];l!==i[a]&&(o===null&&(o={}),o[a]=l)}o!==null&&(typeof e.data._silentSet=="function"?e.data._silentSet(o):e.data.set(o))}static _resumeExternal(t,e){let r=t.setData();if(!r){t.data=e;return}if(e&&e.stage){let n=e._retainState||r._retainState,i=!n&&(e._refreshState||r._refreshState),o=this._buildExternalUpdates(e.stage,r.stage,n,i);_.isEmpty(o)||r._silentSet(o)}typeof r.flushPending=="function"&&r.flushPending(),t.data=r}static _buildExternalUpdates(t,e,r,n){let i={};for(let o in t){if(!Object.prototype.hasOwnProperty.call(t,o))continue;if(n){Object.prototype.hasOwnProperty.call(e,o)||(i[o]=t[o]);continue}let a=t[o];!r&&a==null||a!==e[o]&&(i[o]=a)}return i}static _resumeOwned(t,e){if(!t.data){t.data=e;return}if(e&&e._retainState){t.data=e;return}if(e&&e.stage){let r=e._refreshState||t.data._refreshState,n=this._buildOwnedUpdates(e.stage,t.data.stage,r);_.isEmpty(n)||t.data._silentSet(n)}t.data&&typeof t.data.flushPending=="function"&&t.data.flushPending()}static _buildOwnedUpdates(t,e,r){let n={};for(let i in t){if(!Object.prototype.hasOwnProperty.call(t,i))continue;if(r){Object.prototype.hasOwnProperty.call(e,i)||(n[i]=t[i]);continue}let o=t[i];o!=null&&o!==e[i]&&(n[i]=o)}return n}};var R=class{constructor(){this.events=[]}addEvents(t){let e=t.length;if(!(e<1))for(let r=0;r<e;r++){let n=t[r];this.on(n[0],n[1],n[2],n[3])}}on(t,e,r,n){m.on(t,e,r,n),this.events.push({event:t,obj:e,callBack:r,capture:n})}off(t,e,r,n){m.off(t,e,r,n);let i,o=this.events;for(let a=0,l=o.length;a<l;a++)if(i=o[a],i.event===t&&i.obj===e&&i.callBack===r&&i.capture===n){o.splice(a,1);break}}set(){let t=this.events;for(let e=0,r=t.length;e<r;e++){let n=t[e];m.on(n.event,n.obj,n.callBack,n.capture)}}unset(){let t=this.events;for(let e=0,r=t.length;e<r;e++){let n=t[e];m.off(n.event,n.obj,n.callBack,n.capture)}}reset(){this.unset(),this.events=[]}};var O=class{constructor(t,e){this.remoteStates=[],this.callBackStates=[];let r=this.convertStates(e);this.addStatesToTarget(t,r)}addStates(t,e){let r=this.convertStates(e);this.addStatesToTarget(t,r)}createState(t,e,r,n){return{action:t,state:e,callBack:r,targetId:n,token:null,callBackToken:null}}convertStates(t){let e=[];for(let r in t){if(!Object.prototype.hasOwnProperty.call(t,r))continue;if(r==="remotes"){this.setupRemoteStates(t[r],e);continue}let n=null,i=null,o=t[r];o&&typeof o=="object"&&(i=o.callBack,n=o.id||o.targetId,o=o.state),e.push(this.createState(r,o,i,n))}return e}setupRemoteStates(t,e){for(let r=0,n=t.length;r<n;r++){let i=t[r];if(i)for(let o in i){if(!Object.prototype.hasOwnProperty.call(i,o)||o==="id")continue;let a=null,l=i[o],c=l!==null?l:void 0;c&&typeof c=="object"&&(a=c.callBack,c=c.state),e.push(this.createState(o,c,a,i.id))}}}removeRemoteStates(t){let e=this.remoteStates;e&&this.removeActions(t,e)}removeLocalStates(t){let e=this.callBackStates;if(e)for(let r=0,n=e.length;r<n;r++){let i=e[r];i.callBackToken&&(t.off(i.action,i.callBackToken),i.callBackToken=null)}}removeActions(t,e){if(!(e.length<1))for(let r=0,n=e.length;r<n;r++){let i=e[r];i.token&&this.unbindRemoteState(t,i.token),i.targetId&&g.remove(i.targetId,i.action,i.token)}}restore(t){g.restore(t.id,t);let e=this.callBackStates;if(e)for(let n=0,i=e.length;n<i;n++){let o=e[n];o.callBackToken=t.on(o.action,o.callBack)}let r=this.remoteStates;if(r)for(let n=0,i=r.length;n<i;n++){let o=r[n];o.token=this.bindRemoteState(t,o.action,o.targetId)}}bindRemoteState(t,e,r){let n=g.getTarget(r);return t.link(n,e)}unbindRemoteState(t,e){t.unlink(e)}addStatesToTarget(t,e){let r=this.remoteStates;for(let n=0,i=e.length;n<i;n++){let o=e[n],a=this.addAction(t,o);o.targetId&&(o.token=a,r.push(o))}}addAction(t,e){let r,n=e.action,i=e.targetId;i&&(r=this.bindRemoteState(t,n,i)),typeof e.state<"u"&&t.addAction(n,e.state);let o=e.callBack;return typeof o=="function"&&(e.callBackToken=t.on(n,o),this.callBackStates.push(e)),r||null}};var k=class extends w{constructor(t,e,r){super(t,e,r),this.isComponent=!0,this.stateResumed=!1,this.stateTargetId=null,this._externalData=this._externalData??!1,this._setupData()}setData(){return null}_setupData(){if(this.data)return;let t=this.setData();t&&(this.data=t)}resumeScope(t){if(this._resumeData(t.data),this.state=t.state,this.stateHelper=t.stateHelper,this.persistedChildren=t.persistedChildren,t.context){let e=t.context.data;e&&e._refreshState===!0&&e._retainState!==!0||(this.context=t.context,this._contextResumed=!0)}this.id=t.id,this._refreshContextData()}_resumeData(t){v.resume(this,t)}_refreshData(){v.refresh(this)}_refreshContextData(){v.refreshContext(this)}initialize(){this.setupContext(),this.addStates(),this.beforeSetup()}afterLayout(){this.addEvents(),this.afterSetup()}setupStateTarget(t){let e=t||this.stateTargetId||this.id;this.state=g.attach(String(e))}setupStates(){return{}}addStates(){var r;let t=this.state;if(t){this.stateResumed=!0,(r=this.stateHelper)==null||r.restore(t);return}let e=this.setupStates();_.isEmpty(e)||this.setStateHelper(e)}setStateHelper(t={}){this.state||(this.setupStateTarget(),this.stateHelper=new O(this.state??{},t))}addState(t){!this.stateHelper||this.stateResumed===!0||this.stateHelper.addStates(this.state,t)}removeStates(){let t=this.state;if(!t)return;let e=this.stateHelper;e&&(e.removeRemoteStates(t),e.removeLocalStates(t)),g.detach(String(t.id)),this.stateResumed=!1}onFlush(t){var r;let e=this.data??((r=this==null?void 0:this.context)==null?void 0:r.data)??null;e&&e.onFlush(t)}setEventHelper(){this.events||(this.events=new R)}setupEvents(){return[]}addEvents(){let t=this.setupEvents();t.length<1||(this.setEventHelper(),this.events&&this.events.addEvents(t))}removeEvents(){let t=this.events;t&&t.reset()}prepareDestroy(){this.persistedCount=0,this.rendered=!1;try{this.beforeDestroy()}catch(t){console.error("Error in beforeDestroy:",t)}this.removeEvents(),this.removeStates(),this.removeContext(),this.data&&this.persist!==!0&&this.data.unlink()}};var X={created:"onCreated",setStates:"setupStates",state:"setupStates",events:"setupEvents",before:"beforeSetup",render:"render",after:"afterSetup",destroy:"beforeDestroy"},Y=(s,t)=>typeof s!="function"&&t==="setupStates"?()=>s:s;var z=(s,t)=>{if(!s)return t;let e=Object.keys(s);for(let r=0,n=e.length;r<n;r++){let i=e[r],o=s[i],a=X[i]||i;t[a]=Y(o,a)}return t},it=s=>z(s,{}),ot=0,Z=(s,t)=>{class e extends s{}return Object.assign(e.prototype,t),e.prototype._classId="jot"+ot++,e},H=(s,t=k)=>{s||(s={});let e,r=typeof s;return r==="object"&&s.render?(e=it(s),Z(t,e)):(e={render:r==="function"?s:()=>s},Z(t,e))};var J=s=>s.data?s.data:s.context&&s.context.data?s.context.data:s.state?s.state:null;var d=class extends P{static create(t,e,r,n){let i=document.createElement(t);return this.addAttributes(i,e,n),r.appendChild(i),i}static addAttributes(t,e,r){if(!(!e||e.length<1))for(let n=0,i=e.length;n<i;n++){let o=e[n];this.addAttr(t,o.key,o.value,r)}}static addAttr(t,e,r,n){if(r===""||!e||e==="children")return;if(e==="innerHTML"){t.innerHTML=r;return}if(typeof r==="function"){if(e=Q(e),r.originalCallback)m.add(e,t,r,!1,!0,r.originalCallback);else{let a=r,l=function(c){a.call(this,c,n)};m.add(e,t,l,!1,!0,a)}return}if(e.charCodeAt(4)===45){t.setAttribute(e,r);return}let o=D(e);t[o]=r}static addContent(t,e){e&&(e.textContent!==null?t.textContent=e.textContent:e.innerHTML&&(t.innerHTML=e.innerHTML))}static append(t,e){t.appendChild(e)}};var $=/(\[\[(.*?(?:\[\d+\])?)\]\])/g,j=new B(1e3),V={isWatching(s){if(Array.isArray(s)){let t=s[0];return typeof t=="string"&&t.includes("[[")}return this.hasParams(s)},hasParams(s){return typeof s=="string"&&s.includes("[[")},_getWatcherProps(s){let t=j.get(s);if(t!==void 0)return t;let e=s.match($),r=e?e.map(n=>n.slice(2,-2)):null;return j.set(s,r),r},updateAttr(s,t,e){switch(t){case"text":case"textContent":s.textContent=e;break;case"disabled":s.disabled=!e;break;case"checked":s.checked=!!e;break;case"required":s.required=!!e;break;case"src":if(s.tagName==="IMG"){s.src=e&&(e.indexOf(".")!==-1||e.indexOf("blob:")!==-1)?e:"";break}s.src=e;break;default:d.addAttr(s,t,e);break}},replaceParams(s,t,e=!1){let r=0;return s.replace($,function(n,i,o){let a=e?t[r]:t;r++;let l=a.get(o);return l??""})},_getWatcherCallBack(s,t,e,r,n){let i=this._getWatcherProps(e);if(i&&i.length===1&&e.length===i[0].length+4){let o=i[0],a=n?t[0]:t;return()=>{let l=a.get(o);this.updateAttr(s,r,l!=null?String(l):"")}}return()=>{let o=this.replaceParams(e,t,n);this.updateAttr(s,r,o)}},getValue(s,t){let e=s.value;return Array.isArray(e)===!1?[e,J(t)]:(e.length<2&&e.push(J(t)),e)},getPropValues(s,t,e){let r=[];for(let n=0,i=t.length;n<i;n++){let a=(e?s[n]:s).get(t[n])??"";r.push(a)}return r},getCallBack(s,t,e,r,n,i){let o=s.attr||"textContent",a=s.callBack;if(typeof a=="function"){let l=i||this._getWatcherProps(r)||[],c=l.length>1;return(h,u)=>{h=c!==!0?h:this.getPropValues(e,l,n);let E=a(h,t,u);typeof E<"u"&&this.updateAttr(t,o,E)}}return this._getWatcherCallBack(t,e,r,o,n)},addDataWatcher(s,t,e){var c;let r=this.getValue(t,e),n=r[1]??(e==null?void 0:e.data)??((c=e==null?void 0:e.context)==null?void 0:c.data)??(e==null?void 0:e.state)??null;if(!n)return;let i=r[0],o=Array.isArray(n),a=this._getWatcherProps(i);if(!a)return;let l=this.getCallBack(t,s,n,i,o,a);if(!o)a.length>1?F.watchMany(s,n,a,l):this.addWatcher(s,n,a[0],l);else for(let h=0,u=a.length;h<u;h++)this.addWatcher(s,n[h],a[h],l)},getWatcherSettings(s,t=null){if(typeof s=="string")return{attr:t,value:s};if(Array.isArray(s)){let e=s[s.length-1];e&&typeof e=="object"&&(e=t!==null?t:null);let r=s[1]&&typeof s[1]=="object"?[s[0],s[1]]:[s[0]];return typeof e=="function"?{attr:t,value:r,callBack:e}:{attr:e||"textContent",value:r}}return s},setup(s,t,e){t&&this.addDataWatcher(s,this.getWatcherSettings(t),e)},addWatcher(s,t,e,r){F.watch(s,t,e,r)}};var q=(s,t)=>({attr:s,directive:t});var f=(s,t)=>({key:s,value:t});var tt=(s,t,e,r)=>({tag:s,attr:t,directives:e,children:r});var et=null,at=()=>et||(et=S.get("watch")),b=class{static getTag(t){return t.tag||"div"}static setupChildren(t){t.nest&&(t.children=t.nest,delete t.nest)}static setElementContent(t,e,r,n){return t==="text"?(n.push({tag:"text",textContent:e}),!0):t==="html"||t==="innerHTML"?(r.push(f("innerHTML",e)),!0):!1}static setTextAsWatcher(t,e,r){t.push(q(f(e,V.getWatcherSettings(r,D(e))),at()))}static setButtonType(t,e,r){if(t==="button"){let n=e.type||"button";r.push(f("type",n))}}static parse(t,e){let r=[],n=[],i=t.tag||"div";i==="button"&&r.push(f("type",t.type||"button"));let o=[],a,l;for(let c in t){if(!Object.prototype.hasOwnProperty.call(t,c)||c==="tag"||(a=t[c],a==null))continue;if(c==="children"||c==="nest"){if(Array.isArray(a))for(let u=0;u<a.length;u++)o.push(a[u]);else o.push(a);continue}if((l=S.get(c))!==null){n.push(q(f(c,a),l));continue}let h=typeof a;if(h==="object"){if(V.isWatching(a)){this.setTextAsWatcher(n,c,a);continue}o.push(a);continue}if(h==="function"){let u=a,E=function(nt){u.call(this,nt,e)};E.originalCallback=u,r.push(f(c,E));continue}if(h==="string"&&a.includes("[[")){this.setTextAsWatcher(n,c,a);continue}if(c==="text"){o.push({tag:"text",textContent:a});continue}if(c==="html"||c==="innerHTML"){r.push(f("innerHTML",a));continue}r.push(f(c,a))}return tt(i,r,n,o)}};var T=class{build(t,e,r){}setupComponent(t,e,r){let n=r==null?void 0:r.getChildScope();t.parent=n,n&&n.persist===!0&&t.persist!==!1&&(t.persist=!0,t.parent.addPersistedChild(t)),t.cache&&n&&(n[t.cache]=t),t.setup(e)}buildComponent(t){let e=t.prepareLayout(),r=this.build(e,t.container,t);return t.afterBuild(),t.component&&typeof t.onCreated=="function"&&t.onCreated(t),r}createComponent(t,e,r){return this.setupComponent(t,e,r),this.buildComponent(t),t}setDirectives(t,e,r){}removeNode(t){}removeAll(t){}};var ct=s=>{for(let e in s)if(e!=="tag"&&e!=="textContent")return!1;let t=s.textContent;return typeof t=="string"?t.indexOf("[[")===-1:typeof t!="object"},I=class extends T{build(t,e,r){let n=d.createDocFragment();if(Array.isArray(t))for(let i=0,o=t.length;i<o;i++)this.buildElement(t[i],n,r);else this.buildElement(t,n,r);return e&&typeof e=="object"&&e.appendChild(n),n}buildElement(t,e,r){if(t){if(t.isUnit===!0){this.createComponent(t,e,r);return}this.createElement(t,e,r)}}createElement(t,e,r){if(t.tag==="text"&&ct(t)){let c=t.textContent;d.createText(c??"",e);return}let n=r==null?void 0:r.getChildScope();if(t.data||t.state){this.createTempComponent(t,e,n);return}let i=b.parse(t,n),o=this.createNode(i,e,n);this.cache(o,t.cache,r);let a=i.children;for(let c=0,h=a.length;c<h;c++){let u=a[c];u!==null&&this.buildElement(u,o,r)}let l=i.directives;l.length&&this.setDirectives(o,l,n)}createTempComponent(t,e,r){let n={cache:t.cache,key:t.key,persist:t.persist,_externalData:!0,setData:()=>t.data,...z(t.methods||{},{}),render(){return{...t,data:null,state:null,methods:null,key:null,persist:null}}};t.state&&(n.setupStateTarget=function(o){this.state=t.state});let i=new k(n);this.createComponent(i,e,r)}setDirectives(t,e,r){for(let n=0,i=e.length;n<i;n++)this.handleDirective(t,e[n],r)}handleDirective(t,e,r){e.directive(t,e.attr.value,r)}cache(t,e,r){r&&e&&r.cacheEle(t,e)}createNode(t,e,r){let n=t.tag;if(n==="text"){let i=t.attr[0],o=i?i.value:"";return d.createText(o,e)}else if(n==="comment"){let i=t.attr[0],o=i?i.value:"";return d.createComment(o,e)}return d.create(n,t.attr,e,r)}removeNode(t){d.removeElement(t)}removeAll(t){d.removeAll(t)}};var lt=new Set(["area","base","br","col","embed","hr","img","input","link","meta","source"]),ht=/[&<>"]/,G=s=>{let t=typeof s=="string"?s:String(s);return ht.test(t)?t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,"""):t},A=class{static create(t,e=[],r=""){let n="",i="";for(let o=0,a=e.length;o<a;o++){let l=e[o],c=l.key,h=l.value;if(c==="text"||c==="textContent"){n+=G(h);continue}if(c==="html"||c==="innerHTML"){n+=h;continue}if(typeof h=="function")continue;let u=c+'="'+G(h)+'"';i?i+=" "+u:i=u}return lt.has(t)?"<"+t+" "+i+" />":"<"+t+" "+i+">"+n+r+"</"+t+">"}static createText(t){return G(t)}static createComment(t){return"<!-- "+t+" -->"}};var L=class extends T{build(t,e,r){if(Array.isArray(t)){let n="";for(let i=0,o=t.length;i<o;i++)n+=this.buildElement(t[i],r);return n}return this.buildElement(t,r)}createComponent(t,e,r){return this.setupComponent(t,e,r),this.buildComponent(t)}buildElement(t,e){return t?t.isUnit===!0?this.createComponent(t,{},e):this.createElement(t,e):""}createElement(t,e){let r=b.parse(t,e),n=r.children,i="";for(let o=0,a=n.length;o<a;o++){let l=n[o];l!==null&&(i+=this.buildElement(l,e))}return this.createNode(r,i)}createNode(t,e){let r=t.tag;if(r==="text"){let n=t.attr[0],i=n?n.value:"";return A.createText(i)}else if(r==="comment"){let n=t.attr[0],i=n?n.value:"";return A.createComment(i)}return A.create(r,t.attr,e)}removeAll(t){}};var M=class{static browserIsSupported(){return typeof window<"u"&&typeof document=="object"}static setup(){return this.browserIsSupported()?new I:new L}};var x=M.setup(),ut=s=>typeof s=="object"&&s.isUnit===!0,dt=s=>{let t=H(s);return t?new t:null},p=class{static render(t,e,r){return!t||(ut(t)||(t=dt(t)),!t)?null:x.createComponent(t,e,r)}static build(t,e,r){return x.build(t,e,r)}static rebuild(t,e,r){return x.removeAll(e),this.build(t,e,r)}static setDirectives(t,e,r){x.setDirectives(t,e,r)}static createNode(t,e,r){return x.createNode(t,e,r)}static removeNode(t){x.removeNode(t)}static removeAll(t){x.removeAll(t)}};var K=[],ft=s=>K.indexOf(s)!==-1,pt=s=>({tag:"script",src:s.src,async:!1,load(t){K.push(s.src);let e=s.load;e&&e()}}),mt=s=>({tag:"link",rel:"stylesheet",type:"text/css",href:s.src,load(t){K.push(s.src);let e=s.load;e&&e()}}),W=class{constructor(t){this.percent=0,this.loaded=0,this.total=0,this.callBack=t||null}add(t){this.total++;let e,r=this.update.bind(this);t.indexOf(".css")!==-1?e=mt({load:r,src:t}):e=pt({load:r,src:t}),p.build(e,document.head)}addFiles(t){t&&t.forEach(e=>{ft(e)||this.add(e)})}update(){if(this.updateProgress()<100)return;let e=this.callBack;e&&e()}updateProgress(){return++this.loaded,this.percent=Math.floor(this.loaded/this.total*100)}};var gt=s=>{var t;return s?typeof((t=s==null?void 0:s.prototype)==null?void 0:t.constructor)=="function":!1},y=class{static process(t,e){let r=t.default;return r?e.callback?e.callback(r):(gt(r)?r=new r:r=r(),r.isUnit===!0&&(r.route=e.route,e.persist&&(r.persist=!0)),r):null}static render(t,e,r){let n=p.build(t,null,r),i=n.firstChild||(t==null?void 0:t.panel);return e.after(n),i}};var N=class{static load(t,e,r){return t.then(n=>(e&&e(n),n)).catch(n=>{console.error("Error loading module:",n),r&&r(n)})}};var xt=s=>({tag:"comment",textContent:"import placeholder",onCreated:s.onCreated}),C=new B(100),yt=s=>{if(C.has(s)){let r=C.get(s);return r&&typeof r.then!="function"?Promise.resolve(r):r}let t=typeof s,e;if(t==="string")e=import(s);else if(t==="function")e=s();else return s;return e.then(r=>{C.set(s,r)}).catch(()=>{C.delete(s)}),C.set(s,e),e},Ct=s=>{if(!C.has(s))return null;let t=C.get(s);return t&&typeof t.then=="function"?null:t||null},rt=H({declareProps(){this.loaded=!1,this.errorRoot=null,this.generation=0},render(){return xt({onCreated:s=>{if(this.src){if(this.layout){this.layoutRoot=y.render(this.layout,this.panel,this.parent);return}if(this.depends){new W(()=>{this.loadAndRender(s)}).addFiles(this.depends);return}this.loadAndRender(s)}}})},loadAndRender(s){let t=this.generation,e=Ct(this.src);if(e){this.renderModule(s,e);return}N.load(yt(this.src),r=>{t===this.generation&&this.renderModule(s,r)},r=>{t===this.generation&&(this.loaded=!1,this.renderError(s,r))})},renderError(s,t){let e=()=>this.retry(s),r=this.fallback,n=typeof r=="function"?r(t,e):r||{class:"base-import-error",children:[{tag:"span",text:"Failed to load content."},{tag:"button",type:"button",text:"Retry",click:e}]};n&&(this.errorRoot=y.render(n,s,this.parent))},retry(s){this.removeErrorLayout(),this.loadAndRender(s)},removeErrorLayout(){this.errorRoot&&(p.removeNode(this.errorRoot),this.errorRoot=null)},renderModule(s,t){this.loaded=!0;let e=this.layout||y.process(t,{callback:this.callback,route:this.route,persist:this.persist});this.layout=e,this.layoutRoot=y.render(e,s,this.parent)},shouldUpdate(s){return this.updateLayout===!0?!0:this.updateLayout=s&&s.isUnit&&typeof s.update=="function"},updateModuleLayout(s){let t=this.layout;this.shouldUpdate(t)&&t&&t.update(s)},update(s){this.loaded===!0&&this.updateModuleLayout(s)},destroy(){this.generation++,this.removeErrorLayout(),this.layoutRoot&&(p.removeNode(this.layoutRoot),this.persist!==!0&&(this.layoutRoot=null,this.layout=null,this.loaded=!1,this.updateLayout=!1))}});var Ue=s=>{let t=typeof s;return(t==="string"||t==="function"||s instanceof Promise)&&(s={src:s}),new rt(s)};export{S as a,kt as b,w as c,k as d,X as e,Y as f,H as g,J as h,d as i,V as j,b as k,p as l,Ue as m};
|
|
@@ -1,2 +1 @@
|
|
|
1
1
|
var y=class{static getType(t){let e=typeof t;return e!=="object"?e:Array.isArray(t)?"array":"object"}static isUndefined(t){return typeof t>"u"}static isObject(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}static isFunction(t){return typeof t=="function"}static isString(t){return typeof t=="string"}static isArray(t){return Array.isArray(t)}};var o={types:{},add(r,t){this.types[r]=t},get(r){return this.types[r]||!1},remove(r){delete this.types[r]}};var l=class{constructor(){this.types=new Map}add(t,e){let s=this.types.get(t);s||(s=[],this.types.set(t,s)),s.push(e)}get(t){return this.types.get(t)||!1}has(t){return this.types.has(t)}removeType(t){let e=this.types.get(t);if(!e||!e.length)return;let s,i=o.get(t);if(i){for(let n=0,f=e.length;n<f;n++)s=e[n],s&&(e[n]=null,typeof i=="function"&&i(s));this.types.delete(t)}}remove(t){if(t){this.removeType(t);return}let e=this.types.keys();for(let s of e)s&&this.removeType(s);this.types.clear()}};var c=new WeakMap,a=class{static trackers=new Map;static trackingCount=0;static addType(t,e){o.add(t,e)}static removeType(t){o.remove(t)}static getTrackingId(t){if(!t||typeof t!="object")return"";let e=c.get(t);return e||(e="dt"+this.trackingCount++,c.set(t,e)),e}static add(t,e,s){let i=this.getTrackingId(t);this.find(i).add(e,s)}static get(t,e){let s=c.get(t),i=this.trackers.get(s);return i?e?i.get(e):i:!1}static has(t,e){let s=this.getTrackingId(t);if(!s)return!1;let i=this.trackers.get(s);return i&&e?i.has(e):!1}static find(t){let e=this.trackers.get(t);return e||(e=new l,this.trackers.set(t,e)),e}static isEmpty(t){return!t||typeof t!="object"?!0:t.size===0}static remove(t,e){let s=c.get(t);if(!s)return;let i=this.trackers.get(s);if(i){if(!e){i.remove(),this.trackers.delete(s),c.delete(t);return}i.remove(e),this.isEmpty(i.types)&&(this.trackers.delete(s),c.delete(t))}}};var g={getEvents(r){return typeof r!="object"||r===null?[]:a.get(r,"events")},create(r,t,e,s=!1,i=!1,n=null){return{event:r,obj:t,fn:e,capture:s,swapped:i,originalFn:n}},on(r,t,e,s){if(Array.isArray(r))for(let i=0,n=r.length;i<n;i++)this.add(r[i],t,e,s);else this.add(r,t,e,s);return this},off(r,t,e,s){if(Array.isArray(r))for(let i=0,n=r.length;i<n;i++)this.remove(r[i],t,e,s);else this.remove(r,t,e,s);return this},add(r,t,e,s=!1,i=!1,n=null){if(typeof t!="object"||t===null)return this;let f=this.create(r,t,e,s,i,n);return a.add(t,"events",f),t.addEventListener(r,e,s),this},remove(r,t,e,s=!1){let i=this.getEvent(r,t,e,s);return i===!1?this:(typeof i=="object"&&this.removeEvent(i),this)},removeEvent(r){return typeof r=="object"&&r.obj.removeEventListener(r.event,r.fn,r.capture),this},getEvent(r,t,e,s){if(typeof t!="object")return!1;let i=this.getEvents(t);if(!i||i.length<1)return!1;let n=this.create(r,t,e,s);return this.search(n,i)},search(r,t){let e,s=this.isSwappable(r.event);for(let i=0,n=t.length;i<n;i++)if(e=t[i],!(e.event!==r.event||e.obj!==r.obj)&&(e.fn===r.fn||s===!0&&e.originalFn===r.fn))return e;return!1},removeEvents(r){return typeof r!="object"||r===null?this:(a.remove(r,"events"),this)},swap:new Set(["DOMMouseScroll","wheel","mousewheel","mousemove","popstate"]),addSwapped(r){this.swap.add(r)},isSwappable(r){return this.swap.has(r)}};a.addType("events",r=>{g.removeEvent(r)});var d=class{static limit(t,e=1e6){return typeof t!="string"?"":t.substring(0,e)}static parseQueryString(t,e,s=!0){typeof t!="string"&&(t=window.location.search),t=this.limit(t);let i={},n=/([^?=&]+)(=([^&]*))?/g;return t.replace(n,function(f,u,m,h){let p=h===void 0?"":h;if(e!==!1)try{i[u]=decodeURIComponent(p)}catch{i[u]=p}else i[u]=p}),i}static camelCase(t){t=this.limit(t);let e=/(-|\s|_)+\w{1}/g;return t.replace(e,s=>s[1].toUpperCase())}static uncamelCase(t,e="-"){t=this.limit(t);let s=/([A-Z]{1,})/g;return t.replace(s,i=>e+i.toLowerCase()).toLowerCase()}static titleCase(t){if(!t)return"";t=this.limit(t);let e=/\w\S*/;return t.replace(e,s=>s.charAt(0).toUpperCase()+s.substring(1).toLowerCase())}};export{y as a,a as b,g as c,d};
|
|
2
|
-
//# sourceMappingURL=chunk-R5DHGQZV.js.map
|
|
@@ -1,2 +1 @@
|
|
|
1
1
|
var f=Object.prototype.toString,n=Object.prototype.hasOwnProperty,a={create(t){return Object.create(t||null)},extendObject(t,e){if(!t||typeof t!="object"||!e||typeof e!="object")return!1;for(let r in t)n.call(t,r)&&!n.call(e,r)&&(e[r]=t[r]);return e},clone(t){if(!t||typeof t!="object")return{};try{return structuredClone(t)}catch{return JSON.parse(JSON.stringify(t))}},getClassObject(t){return typeof t=="function"?t.prototype:t},extendClass(t,e){let r=this.getClassObject(t),c=this.getClassObject(e);if(typeof r!="object"||typeof c!="object")return!1;let s=Object.create(r);for(let o in c)s[o]=c[o];return s},hasOwnProp(t,e){return n.call(t,e)},isPlainObject(t){return!!t&&f.call(t)==="[object Object]"},isEmpty(t){if(!t||typeof t!="object"||Array.isArray(t))return!0;if(t instanceof Map||t instanceof Set)return t.size===0;for(let e in t)if(n.call(t,e))return!1;return!0}};export{a};
|
|
2
|
-
//# sourceMappingURL=chunk-W37VRHGC.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as k,c as v,d as g}from"./chunk-R5DHGQZV.js";var M=class{constructor(){this.connections=new Map}add(t,e,s){let i=this.getOrCreate(t),n=i.get(e);return n?Array.isArray(n)?n.push(s):i.set(e,[n,s]):i.set(e,s),s}get(t,e){var i;let s=(i=this.connections.get(t))==null?void 0:i.get(e);return s?Array.isArray(s)?s[s.length-1]||!1:s:!1}getOrCreate(t){let e=this.connections.get(t);return e||(e=new Map,this.connections.set(t,e)),e}remove(t,e){let s=this.connections.get(t);if(s)if(e)this.unsubscribe(s.get(e)),s.delete(e),s.size===0&&this.connections.delete(t);else{for(let i of s.values())this.unsubscribe(i);this.connections.delete(t)}}unsubscribe(t){var e;if(t)if(Array.isArray(t))for(let s=0,i=t.length;s<i;s++)(e=t[s])==null||e.unsubscribe();else t.unsubscribe()}};var p=class{constructor(){this.msg=null,this.token=null}setToken(t){this.token=t}};var w=class extends p{constructor(t){super(),this.data=t}subscribe(t,e){if(!this.data||typeof this.data.on!="function"){console.warn('OneWaySource: Cannot subscribe - data source is null or does not have an "on" method. Make sure your component has data, state, or context.data initialized.',t,this.data);return}this.msg=t,this.token=this.data.on(t,e)}subscribeMany(t,e){if(!this.data||typeof this.data.on!="function"){console.warn('OneWaySource: Cannot subscribeMany - data source is null or does not have an "on" method.',t,this.data);return}let s=t.length,i=new Array(s);for(let n=0;n<s;n++){let u=t[n];i[n]={msg:u,token:this.data.on(u,e)}}this.subscriptions=i}unsubscribe(){if(this.data){let t=this.subscriptions;if(t){for(let e=0,s=t.length;e<s;e++)this.data.off(t[e].msg,t[e].token);this.subscriptions=null}else this.msg&&this.token&&this.data.off(this.msg,this.token)}this.data=null,this.msg=null,this.token=null}};var b=class{unsubscribe(){}};var y=class extends b{constructor(){super(),this.source=null}addSource(t){return this.source=new w(t)}unsubscribe(){this.source.unsubscribe(),this.source=null}};var m=class extends p{constructor(t){super(),this.pubSub=t}subscribe(t){this.msg=t;let e=this.callBack.bind(this);this.token=this.pubSub.on(t,e)}unsubscribe(){this.pubSub&&this.msg&&this.token&&this.pubSub.off(this.msg,this.token),this.pubSub=null,this.msg=null,this.token=null}callBack(){}};var C=class extends m{constructor(t,e,s){super(s),this.data=t,this.prop=e}set(t){this.data.set(this.prop,t)}get(){return this.data.get(this.prop)}callBack(t,e){this.data!==e&&this.data.set(this.prop,t,e)}unsubscribe(){super.unsubscribe(),this.data=null,this.prop=null}};var x=class{static getById(t){return typeof t!="string"?!1:document.getElementById(t)||!1}static getByName(t){if(typeof t!="string")return!1;let e=document.getElementsByName(t);return e?Array.from(e):!1}static getBySelector(t,e){if(typeof t!="string")return!1;if(e=e||!1,e===!0)return document.querySelector(t)||!1;let s=document.querySelectorAll(t);return s?s.length===1?s[0]:Array.from(s):!1}static html(t,e){return!t||typeof t!="object"?!1:typeof e<"u"?(t.innerHTML=e,this):t.innerHTML}static setCss(t,e,s){return!t||typeof t!="object"||typeof e>"u"?this:(e=g.uncamelCase(e),t.style[e]=s,this)}static getCss(t,e){if(!t||typeof e>"u")return!1;e=g.uncamelCase(e);let s=t.style[e];if(s!=="")return s;let i=null,n=t.currentStyle;if(n&&(i=n[e]))return i;let u=window.getComputedStyle(t,null);return u?u[e]:s}static css(t,e,s){return typeof s<"u"?(this.setCss(t,e,s),this):this.getCss(t,e)}static removeAttr(t,e){return typeof t=="object"&&t!==null&&t.removeAttribute(e),this}static setAttr(t,e,s){t.setAttribute(e,s)}static getAttr(t,e){return t.getAttribute(e)}static attr(t,e,s){return!t||typeof t!="object"?!1:typeof s<"u"?(this.setAttr(t,e,s),this):this.getAttr(t,e)}static _checkDataPrefix(t){return typeof t!="string"||(t=g.uncamelCase(t),t.substring(0,5)!=="data-"&&(t="data-"+t)),t}static removeDataPrefix(t){return typeof t=="string"&&t.substring(0,5)==="data-"&&(t=t.substring(5)),t}static setData(t,e,s){e=this.removeDataPrefix(e),e=g.camelCase(e),t.dataset[e]=s}static getData(t,e){return e=g.camelCase(this.removeDataPrefix(e)),t.dataset[e]}static data(t,e,s){return!t||typeof t!="object"?!1:typeof s<"u"?(this.setData(t,e,s),this):this.getData(t,e)}static find(t,e){return!t||typeof e!="string"?[]:t.querySelectorAll(e)}static show(t){if(!t||typeof t!="object")return this;let e=this.data(t,"style-display"),s=typeof e=="string"?e:"";return this.css(t,"display",s),this}static hide(t){if(!t||typeof t!="object")return this;let e=this.css(t,"display");return e!=="none"&&e&&this.data(t,"style-display",e),this.css(t,"display","none"),this}static toggle(t){return!t||typeof t!="object"?this:(this.css(t,"display")!=="none"?this.hide(t):this.show(t),this)}static getSize(t){return!t||typeof t!="object"?!1:{width:this.getWidth(t),height:this.getHeight(t)}}static getWidth(t){return typeof t=="object"&&t!==null?t.offsetWidth:!1}static getHeight(t){return typeof t=="object"&&t!==null?t.offsetHeight:!1}static getScrollPosition(t){let e=0,s=0;switch(typeof t){case"undefined":t=document.documentElement,e=t.scrollLeft,s=t.scrollTop;break;case"object":e=t.scrollLeft,s=t.scrollTop;break}return!t||typeof t!="object"?!1:{left:e-(t.clientLeft||0),top:s-(t.clientTop||0)}}static getScrollTop(t){return this.getScrollPosition(t).top}static getScrollLeft(t){return this.getScrollPosition(t).left}static getWindowSize(){let t=window,e=document,s=e.documentElement,i=e.getElementsByTagName("body")[0],n=t.innerWidth||s.clientWidth||i.clientWidth,u=t.innerHeight||s.clientHeight||i.clientHeight;return{width:n,height:u}}static getDocumentSize(){let t=document,e=t.body,s=t.documentElement,i=Math.max(e.scrollHeight,e.offsetHeight,s.clientHeight,s.scrollHeight,s.offsetHeight);return{width:Math.max(e.scrollWidth,e.offsetWidth,s.clientWidth,s.scrollWidth,s.offsetWidth),height:i}}static getDocumentHeight(){return this.getDocumentSize().height}static position(t,e=1){let s={x:0,y:0};if(!t||typeof t!="object")return s;let i=0;for(;t&&(e===0||i<e);)i++,s.x+=t.offsetLeft+t.clientLeft,s.y+=t.offsetTop+t.clientTop,t=t.offsetParent;return s}static addClass(t,e){if(!t||typeof t!="object"||e==="")return this;if(typeof e=="string"){let s=e.split(" ");for(let i=0,n=s.length;i<n;i++)t.classList.add(s[i])}return this}static removeClass(t,e){return!t||typeof t!="object"||e===""?this:(typeof e>"u"?t.className="":t.classList.remove(e),this)}static hasClass(t,e){return!t||typeof t!="object"||e===""?!1:t.classList.contains(e)}static toggleClass(t,e){return!t||typeof t!="object"?this:(t.classList.toggle(e),this)}};var P=r=>{let t="textContent";if(!r||typeof r!="object")return t;let e=r.tagName.toLowerCase();if(e==="input"||e==="textarea"||e==="select"){let s=r.type;if(!s)return t="value",t;switch(s){case"checkbox":t="checked";break;case"file":t="files";break;default:t="value"}}return t};var W=(r,t,e)=>{x.setAttr(r,t,e)},L=(r,t,e)=>{r.checked=r.value==e},z=(r,t,e)=>{e=e==1,Q(r,t,e)},Q=(r,t,e)=>{r[t]=e},T=(r,t)=>x.getAttr(r,t),_=(r,t)=>r[t],I=class extends m{constructor(t,e,s,i){super(i),this.element=t,this.attr=this.getAttrBind(e),this.addSetMethod(t,this.attr),this.filter=typeof s=="string"?this.setupFilter(s):s}addSetMethod(t,e){if(e.charAt(4)==="-")return this.setValue=W,this.getValue=T,this;this.getValue=_;let s=t.type;if(s)switch(s){case"checkbox":return this.setValue=z,this;case"radio":return this.setValue=L,this}return this.setValue=Q,this}getAttrBind(t){return t||P(this.element)}setupFilter(t){let e=/\[\[[^\]]+\]\]/;return s=>t.replace(e,()=>s)}set(t){let e=this.element;return!e||typeof e!="object"?this:(this.filter&&(t=this.filter(t)),this.setValue(e,this.attr,t),this)}get(){let t=this.element;return!t||typeof t!="object"?"":this.getValue(t,this.attr)}callBack(t,e){return e!==this.element&&this.set(t),this}unsubscribe(){super.unsubscribe(),this.element={},this.attr="",this.filter=null,this.setValue=null,this.getValue=null}};var B=class extends b{constructor(t){super(),this.element=null,this.data=null,this.pubSub=t}addElement(t,e,s){return this.element=new I(t,e,s,this.pubSub)}addData(t,e){return this.data=new C(t,e,this.pubSub)}unsubscribeSource(t){return t&&t.unsubscribe(),this}unsubscribe(){return this.unsubscribeSource(this.element),this.unsubscribeSource(this.data),this.element=null,this.data=null,this}};var O=0,A=class{constructor(t=!1){this.callBacks=new Map,this.prefixIndex=t?new Map:null,this.updateQueue=new Map,this.flushScheduled=!1,this.isFlushing=!1,this.flushIterations=0,this.maxFlushIterations=2e3,this.batchingEnabled=!0,this.debugMode=!1,this.flushCompleteResolvers=[],this.flushCallbacks=[],this.deliveringMessage=null,this.reentrantMessages=null,this.suppressQueue=!1}get(t){return this.callBacks.has(t)||this.callBacks.set(t,new Map),this.callBacks.get(t)}reset(){var t;this.callBacks.clear(),(t=this.prefixIndex)==null||t.clear(),this.updateQueue.clear(),this.flushScheduled=!1,this.isFlushing=!1,this.flushIterations=0,this.reentrantMessages=null}on(t,e){let s=++O,i=this.callBacks.get(t);return i||(i=new Map,this.callBacks.set(t,i),this.prefixIndex&&this._indexMessage(t)),i.set(s,e),s}_indexMessage(t){let e=t.indexOf(":");if(e===-1)return;let s=t.substring(0,e+1),i=this.prefixIndex.get(s);i||(i=new Set,this.prefixIndex.set(s,i)),i.add(t)}_unindexMessage(t){let e=t.indexOf(":");if(e===-1)return;let s=t.substring(0,e+1),i=this.prefixIndex.get(s);i&&(i.delete(t),i.size===0&&this.prefixIndex.delete(s))}getPrefixMessages(t){return this.prefixIndex&&this.prefixIndex.get(t)||null}getMessages(){return this.callBacks.keys()}off(t,e){let s=this.callBacks.get(t);s&&(s.delete(e),s.size===0&&(this.callBacks.delete(t),this.prefixIndex&&this._unindexMessage(t)))}remove(t){this.callBacks.delete(t),this.prefixIndex&&this._unindexMessage(t)}publish(t,e,s){if(!this.batchingEnabled){this.publishImmediate(t,e,s);return}this.suppressQueue||(t===this.deliveringMessage&&(this.reentrantMessages??(this.reentrantMessages=new Set)).add(t),this.callBacks.has(t)&&(this.updateQueue.set(t,[e,s]),this.debugMode&&console.log("[DataPubSub] Queued update:",t,e),this.scheduleFlush()))}scheduleFlush(){this.isFlushing||this.flushScheduled||(this.flushScheduled=!0,queueMicrotask(()=>{this.flush()}))}flush(){if(this.updateQueue.size===0){this.flushScheduled=!1,this.isFlushing=!1,this.flushIterations=0,this._resolveFlushComplete();return}if(this.isFlushing||(this.flushIterations=0,this.reentrantMessages=null),this.isFlushing=!0,this.flushScheduled=!1,this.flushIterations++,this.flushIterations>this.maxFlushIterations){console.error("[DataPubSub] Infinite loop detected! Flush iterations exceeded",this.maxFlushIterations,"- Breaking to prevent memory exhaustion."),console.error("[DataPubSub] Queue size:",this.updateQueue.size),console.error("[DataPubSub] Queued messages:",Array.from(this.updateQueue.keys())),this._breakCascade(),this.flushScheduled=!1,this.isFlushing=!1,this._resolveFlushComplete(),this.flushIterations=0;return}this.debugMode&&console.log("[DataPubSub] Flushing",this.updateQueue.size,"updates (iteration",this.flushIterations+")");let t=this.updateQueue;this.updateQueue=new Map;try{for(let[e,s]of t)this.publishImmediate(e,s[0],s[1])}finally{this.debugMode&&console.log("[DataPubSub] Flush complete (iteration",this.flushIterations+")"),this.updateQueue.size>0?(this.debugMode&&console.log("[DataPubSub] New updates queued during flush, re-flushing..."),this.flush()):(this.isFlushing=!1,this.flushIterations=0,this._resolveFlushComplete())}}_breakCascade(){let t=this.updateQueue;this.updateQueue=new Map;let e=this.reentrantMessages;this.suppressQueue=!0;try{for(let[s,i]of t)e&&e.has(s)||this.publishImmediate(s,i[0],i[1])}finally{this.suppressQueue=!1,this.reentrantMessages=null,this.updateQueue.clear()}}_resolveFlushComplete(){if(this.flushCompleteResolvers.length>0){let t=this.flushCompleteResolvers;this.flushCompleteResolvers=[];let e=t.length;for(let s=0;s<e;s++)t[s]()}if(this.flushCallbacks.length>0){let t=this.flushCallbacks;this.flushCallbacks=[];let e=t.length;for(let s=0;s<e;s++)t[s]()}}nextFlush(){return new Promise(t=>{this.flushCompleteResolvers.push(t),!this.flushScheduled&&!this.isFlushing&&queueMicrotask(()=>t())})}onFlush(t){if(typeof t!="function"){console.warn("[DataPubSub] onFlush requires a function callback");return}this.flushCallbacks.push(t),!this.flushScheduled&&!this.isFlushing&&queueMicrotask(()=>{if(this.flushCallbacks.length>0){let e=this.flushCallbacks;this.flushCallbacks=[];let s=e.length;for(let i=0;i<s;i++)e[i]()}})}flushSync(){this.flush()}publishImmediate(t,e,s){let i=this.callBacks.get(t);if(!i)return;let n=this.deliveringMessage;this.deliveringMessage=t;for(let u of i.values())if(u)try{u(e,s)}catch(h){console.error('[DataPubSub] Subscriber error for "'+t+'":',h)}this.deliveringMessage=n}};var D=class{constructor(){this.version="1.0.1",this.attr="bindId",this.blockedKeys=new Set([20,37,38,39,40]),this.connections=new M,this.pubSub=new A(!0),this.idCount=0,this.setup()}setup(){this.setupEvents()}bind(t,e,s,i){let n=s,u=null,h=s.indexOf(":");h!==-1&&(u=s.substring(0,h),n=s.substring(h+1));let c=u??"",f=this.setupConnection(t,e,n,c,i),o=f.element,l=e.get(n);return typeof l<"u"?o.set(l):(l=o.get(),l!==""&&f.data.set(l)),this}setupConnection(t,e,s,i,n){let u=this.getBindId(t),h=new B(this.pubSub);h.addData(e,s).subscribe(u);let o=`${e.getDataId()}:${s}`;return h.addElement(t,i,n).subscribe(o),this.addConnection(u,"bind",h),h}addConnection(t,e,s){return this.connections.add(t,e,s),this}setBindId(t){let e="db-"+this.idCount++;return t[this.attr]=e,e}getBindId(t){return t[this.attr]||this.setBindId(t)}unbind(t){let e=t[this.attr];return e&&this.connections.remove(e),this}watch(t,e,s,i){if(k.isObject(t)===!1)return this;let n=new y,u=e.get(s),h=!0,c=d=>{h&&(h=!1,d===u&&(d===null||typeof d!="object"))||i(d)};n.addSource(e).subscribe(s,c);let o=this.getBindId(t),l=e.getDataId()+":"+s;return this.addConnection(o,l,n),i(u),this}watchMany(t,e,s,i){if(k.isObject(t)===!1)return this;let n=s?s.length:0;if(n===0)return this;if(n===1)return this.watch(t,e,s[0],i);let u=new y,h=u.addSource(e),c=new Array(n),f=new Array(n);for(let a=0;a<n;a++)c[a]=e.get(s[a]),f[a]=!0;let o=new Array(n);for(let a=0;a<n;a++){let F=a,E=c[a];o[a]=S=>{f[F]&&(f[F]=!1,S===E&&(S===null||typeof S!="object"))||i(S)}}if(typeof e.on!="function")return console.warn('DataBinder.watchMany: data source has no "on" method.',e),this;let l=new Array(n);for(let a=0;a<n;a++)l[a]={msg:s[a],token:e.on(s[a],o[a])};h.subscriptions=l;let d=this.getBindId(t),H=e.getDataId()+":"+s.join(",");return this.addConnection(d,H,u),i(c[0]),this}unwatch(t,e,s){if(k.isObject(t)===!1)return this;let i=t[this.attr];if(i){let n=e.getDataId()+":"+s;this.connections.remove(i,n)}return this}publish(t,e,s){return this.pubSub.publish(t,e,s),this}getPrefixMessages(t){return this.pubSub.getPrefixMessages(t)}isDataBound(t){if(!t)return null;let e=t[this.attr];return e||null}isBlocked(t){return t.type!=="keyup"?!1:this.blockedKeys.has(t.keyCode)}bindHandler(t){if(this.isBlocked(t))return!0;let e=t.target||t.srcElement,s=this.isDataBound(e);if(s!==null){let i=this.connections.get(s,"bind");if(i){let n=i.element.get();this.pubSub.publish(s,n,e)}}t.stopPropagation()}setupEvents(){this.changeHandler=this.bindHandler.bind(this),this.addEvents()}addEvents(){typeof document<"u"&&v.on(["change","paste","input"],document,this.changeHandler,!1)}removeEvents(){typeof document<"u"&&v.off(["change","paste","input"],document,this.changeHandler,!1)}},mt=new D;export{P as a,A as b,mt as c};
|
package/dist/modules/ajax.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
import{
|
|
2
|
-
//# sourceMappingURL=ajax.js.map
|
|
1
|
+
import{a as y}from"../chunks/chunk-MNKLSGJQ.js";import{a as u}from"../chunks/chunk-W37VRHGC.js";import{a as d,b as x,c as i,d as b}from"../chunks/chunk-R5DHGQZV.js";var l=class{static toArray(t){return Array.from(t)}static inArray(t,e,s){return Array.isArray(t)?t.indexOf(e,s):-1}};var f=class{constructor(){this.errors=[],this.dataTracker=x}augment(t){if(!d.isObject(t))return this;let e=this.constructor.prototype;for(let s in t)Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s]);return this}override(t,e,s,o){return(t[e]=s).apply(t,l.toArray(o))}getLastError(){let t=this.errors;return t.length?t.pop():!1}addError(t){this.errors.push(t)}getProperty(t,e,s){if(d.isObject(t)===!1)return"";let o=t[e];return typeof o<"u"?o:typeof s<"u"?s:""}createCallBack(t,e,s=[],o=!1){return typeof e!="function"?!1:(...r)=>(o===!0&&(s=s.concat(r)),e.apply(t,s))}bind(t,e){return e.bind(t)}};f.prototype.extend=(function(){return f.prototype})();var p=new f;var a={url:"",responseType:"json",method:"POST",fixedParams:"",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},beforeSend:[],async:!0,crossDomain:!1,withCredentials:!1,completed:null,failed:null,aborted:null,progress:null};var m=()=>{p.augment({xhrSettings:a,addFixedParams(n){this.xhrSettings.fixedParams=n},beforeSend(n){this.xhrSettings.beforeSend.push(n)},ajaxSettings(n){typeof n=="object"&&(this.xhrSettings=u.extendClass(p.xhrSettings,n))},resetAjaxSettings(){this.xhrSettings=a}})};var c=class{constructor(t){this.settings=null,this.xhr=null,this.setup(t)}setup(t){this.getXhrSettings(t);let e=this.xhr=this.createXHR(),{method:s,url:o,async:r}=this.settings;e.open(s,o,r),this.setupHeaders(),this.addXhrEvents(),this.beforeSend(),e.send(this.getParams())}beforeSend(){let t=a.beforeSend;if(t.length<1)return;let e=this.xhr,s=this.settings;for(var o=0,r=t.length;o<r;o++){var h=t[o];h&&h(e,s)}}objectToString(t){let e=[];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.push(encodeURIComponent(s)+"="+encodeURIComponent(t[s]));return e.join("&")}setupParams(t,e=null){let s=typeof t;if(!e)return!(t instanceof FormData)&&s==="object"&&(t=this.objectToString(t)),t;let o=typeof e;if(s==="string")return o!=="string"&&(e=this.objectToString(e)),t+=(t===""?"?":"&")+e,t;if(o==="string"&&(e=b.parseQueryString(e,!1)),t instanceof FormData)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.append(r,e[r]);else s==="object"&&(t=Object.assign({},e,t),t=this.objectToString(t));return t}getParams(){let t=this.settings,e=t.fixedParams,s=t.params;return s?s=this.setupParams(s,e):e&&(s=this.setupParams(e)),s}getXhrSettings(t){let e=this.settings={...p.xhrSettings};if(t.length>=2&&typeof t[0]!="object")for(var s=0,o=t.length;s<o;s++){var r=t[s];switch(s){case 0:e.url=r;break;case 1:e.params=r;break;case 2:e.completed=r,e.failed=r;break;case 3:e.responseType=r||"json";break;case 4:e.method=r?r.toUpperCase():"POST";break;case 5:e.async=typeof r<"u"?r:!0;break}}else e=this.settings=u.extendClass(this.settings,t[0]),typeof e.completed=="function"&&(typeof e.failed!="function"&&(e.failed=e.completed),typeof e.aborted!="function"&&(e.aborted=e.failed))}createXHR(){let t=this.settings,e=new XMLHttpRequest;return e.responseType=t.responseType,t.withCredentials===!0&&(e.withCredentials=!0),e}setupHeaders(){var o;let t=this.settings;if(!t||typeof t.headers!="object")return;let e=t.headers;for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&((o=this.xhr)==null||o.setRequestHeader(s,e[s]))}update(t,e){let s=this.xhr,o=()=>{i.removeEvents(s==null?void 0:s.upload),i.removeEvents(s)},r=this.settings;if(!r)return!1;switch(e||t.type){case"load":{if(((s==null?void 0:s.status)??0)>=400){typeof r.failed=="function"&&r.failed(!1,this.xhr),o();break}if(typeof r.completed=="function"){let S=this.getResponseData();r.completed(S,this.xhr)}o();break}case"error":typeof r.failed=="function"&&r.failed(!1,this.xhr),o();break;case"progress":typeof r.progress=="function"&&r.progress(t);break;case"abort":typeof r.aborted=="function"&&r.aborted(!1,this.xhr),o();break}}getResponseData(){let t=this.xhr;if(!t)return null;let e=t.responseType;return!e||e==="text"?t.responseText:t.response}addXhrEvents(){if(!this.settings)return;let e=this.xhr;if(!e)return;let s=this.update.bind(this);i.on(["load","error","abort"],e,s),i.on("progress",e.upload,s)}};m();var g=(...n)=>new c(n).xhr;y(g);export{g as Ajax,c as XhrRequest};
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
import{a
|
|
2
|
-
//# sourceMappingURL=component.js.map
|
|
1
|
+
import{a as gt,b,c as St,d as k,e as W,f as B,g as At,h as u,i as M,j as x,k as O,l as p,m as Dt}from"../chunks/chunk-PM3QNZ7G.js";import{c as w}from"../chunks/chunk-2ML3HANA.js";import"../chunks/chunk-W37VRHGC.js";import"../chunks/chunk-G32YTH3D.js";import"../chunks/chunk-NGPNK5SD.js";import{a as H,c as l}from"../chunks/chunk-ZII2WFZO.js";import{b as f,c as S}from"../chunks/chunk-R5DHGQZV.js";var A=new WeakMap,vt=()=>typeof globalThis.matchMedia=="function"&&globalThis.matchMedia("(prefers-reduced-motion: reduce)").matches,Ct=t=>{let o=A.get(t);o&&(A.delete(t),S.off("animationend",t,o.onEnd),o.timeoutId&&clearTimeout(o.timeoutId),t&&o.className&&t.classList.remove(o.className))},j=(t,o,r=null)=>{if(!t)return;Ct(t);let e=null,n=!1,i=()=>{n||(n=!0,A.delete(t),e&&(clearTimeout(e),e=null),S.off("animationend",t,s),t&&o&&t.classList.remove(o),r&&r())},s=c=>{c.target===t&&i()};if(!o||vt()){i();return}S.on("animationend",t,s),requestAnimationFrame(()=>{if(!t||n){i();return}t.classList.add(o);try{let c=window.getComputedStyle(t),d=parseFloat(c.animationDuration)*1e3||1e3,a=parseFloat(c.animationDelay)*1e3||0;e=setTimeout(i,d+a+100)}catch{e=setTimeout(i,1e3)}A.set(t,{complete:i,className:o,timeoutId:e,onEnd:s})})},L=(t,o,r)=>{j(t,o)},U=(t,o,r)=>{let e=()=>{t&&t.remove&&t.remove()};bt(t,()=>j(t,o,e),r)};f.addType("manual-destroy",t=>{if(!t)return!1;t.callBack(t.ele,t.parent)});var bt=(t,o,r)=>{f.add(t,"manual-destroy",{ele:t,callBack:o,parent:r})};var g=(t,o,r,e)=>{if(Array.isArray(r[0])){r.forEach(n=>{n&&g(t,o,n,e)});return}kt(t,o,r,e)},kt=(t,o,r,e)=>{let n,i;if(r.length<3?[n,i]=r:[o,n,i]=r,!o||!n)return;if(typeof o.on!="function"){console.warn('Watcher directive: Data source does not have an "on" method. Make sure your component has data, state, or context.data initialized before using watchers like onSet, watch, or [[prop]] syntax.',t,o);return}let s=Pt(t,n,i,e);l.watch(t,o,n,s)},Pt=(t,o,r,e)=>typeof r=="object"?n=>{Et(t,r,n)}:n=>{It(t,r,o,n,e)},R=new WeakSet,Tt=(t,o,r)=>{!t||!t.isUnit&&!t.isComponent||R.has(r)||R.add(r)},It=(t,o,r,e,n)=>{let i=o(e,t,n);switch(typeof i){case"object":if(i===null)break;Tt(i,r,t),p.rebuild(i,t,n);break;case"string":let s=H(t);if(s!=="textContent"){t.setAttribute(s,i);break}w.addHtml(t,i);break}},Et=(t,o,r)=>{let e=Object.keys(o);for(let n=0,i=e.length;n<i;n++){let s=e[n];s&&(o[s]===r?t.classList.add(s):t.classList.remove(s))}};var h=(t,o,r)=>{let e=u(r);g(t,e,o,r)};var _=(t,o,r)=>{o&&t.setAttribute("role",o)},Ht=t=>(o,r)=>{let e=o?"true":"false";r.setAttribute(t,e)},F=(t,o,r)=>{if(!o)return;let e=o.role;e&&(t.setAttribute("role",e),o.role=null);let n=Object.keys(o);for(let i=0,s=n.length;i<s;i++){let c=n[i],d=o[c];if(d===null)continue;let a="aria-"+c;if(Array.isArray(d)){let m=d.slice();m.push(Ht(a)),h(t,m,r)}else t.setAttribute(a,d)}};var V=(t,o,r)=>{if(!o)return;let e=O.parse(o,r);M.addAttributes(t,e.attr,r),p.setDirectives(t,e.directives,r)};f.addType("context",t=>{if(!t)return!1;t.parent.removeContextBranch(t.branch)});var P=t=>t?t.getContext():null,q=(t,o,r)=>{if(typeof o!="function")return;let e=P(r),n=o(e);V(t,n,r)},z=(t,o,r)=>{if(typeof o!="function")return;let e=P(r);o(e)},J=(t,o,r)=>{if(typeof o!="function"||!r)return;let e=P(r),n=o(e);if(!n)return;let i=n[0];i&&(r.addContextBranch(i,n[1]),wt(t,i,r))},wt=(t,o,r)=>{f.add(t,"context",{branch:o,parent:r})};var N=(t,o,r)=>{};var G=(t,o,r)=>{if(!r)return;let e=r._layout?r._layout:r.render();console.log("Debug: ","ele: ",t),console.log("Data: ",o),console.log("Layout: ",e),console.log("parent: ",r)};var K=(t,o,r)=>{},Q=(t,o,r)=>{if(!o||!r)return;let e=o(r,t);e&&p.build(e,t,r)},X=(t,o,r)=>{if(!o||!r)return;let e=r.getId(o);t.id=e},Y=(t,o,r)=>{if(!o||!r)return;let e=o(r.data,t);e&&p.build(e,t,r)},Z=(t,o,r)=>{if(!o||!r)return;let e=o(r.state,t);e&&p.build(e,t,r)},$=(t,o,r)=>{if(!o||!r)return;let e=r.state,n=o(e);if(!r.state){r.setStateHelper(n);return}r.addState(n)},tt=(t,o,r)=>{if(!(!o||!r)){if(r.events||r.setEventHelper(),o[2]){let e=o[2];o[2]=n=>{e(n,r)}}r.events.on(o[0],o[1],o[2],o[3])}};var ot=(t,o,r)=>{o(t,r)};f.addType("destroyed",t=>{if(!t)return!1;t.callBack(t.ele,t.parent)});var rt=(t,o,r)=>{Wt(t,o,r)},Wt=(t,o,r)=>{f.add(t,"destroyed",{ele:t,callBack:o,parent:r})};var et=(t,o,r)=>{};var T={cache:K,onCreated:ot,onDestroyed:rt,data:N,state:et,animateIn:L,animateOut:U,useParent:Q,useData:Y,useState:Z,getId:X,addState:$,addEvent:tt,useContext:z,addContext:J,context:q,role:_,aria:F,debug:G};var nt=(t,o,r)=>{let e,n,i;if(typeof o=="string"){if(e=u(r),!e)return;n=o}else if(Array.isArray(o))if(typeof o[0]!="object"){let s=u(r);if(!s)return;e=s,n=o[0],i=o[1]}else[e,n,i]=o;l.bind(t,e,n,i)};var D=(t,o,r)=>{g(t,r.state,o,r)};var it=t=>(o,r)=>{let[e,n,i="active"]=t,s=o===n?i:"";r.dataset[e]=s},st=(t,o,r)=>{if(!o)return;let e=o.length-1,n=o[e],i=o.slice(0,e);i.push(it(n)),h(t,i,r)},ct=(t,o,r)=>{if(!o)return;let e=o.length-1,n=o[e],i=o.slice(0,e);i.push(it(n)),D(t,i,r)};var at=t=>{for(let o=0,r=t.length;o<r;o++){let e=t[o];e&&e.remove()}t.length=0};f.addType("forScopes",t=>{if(!t)return!1;at(t.scopes)});var pt=(t,o,r)=>{let e,n,i,s;if(typeof o[0]=="string"||o.length<3){let m=u(r);if(!m)return;e=m,[n,i,s]=o}else[e,n,i,s]=o;let c=s===!0,d=n+"[",a=c?{scopes:[]}:null;a&&f.add(t,"forScopes",a),l.watch(t,e,n,m=>{if(p.removeAll(t),a&&at(a.scopes),!m||m.length<1)return;let v=[];for(let y=0,yt=m.length;y<yt;y++){let C=c?e.scope(d+y+"]"):null;C&&a&&a.scopes.push(C);let E=i(m[y],y,C,v);E!==null&&v.push(E)}return p.build(v,t,r)})};var ft=(t,o,r)=>{let e=o[0];if(!e||e.length<1)return;let n=o[1],i=[];for(let s=0,c=e.length;s<c;s++){let d=e[s];if(!d)continue;let a=n(d,s);a!==null&&i.push(a)}p.build(i,t,r)};var dt=(t,o,r)=>{if(o)if(Array.isArray(o)&&typeof o[0]!="string")for(let e=0,n=o.length;e<n;e++)x.setup(t,o[e],r);else x.setup(t,o,r)};var I={bind:nt,onSet:h,onState:D,watch:dt,map:ft,for:pt,dataSet:st,dataStateSet:ct};var Bt=t=>typeof t!="string"?t:mt(t),mt=t=>[{tag:"text",textContent:t}],ut=()=>({props:{},children:[]}),lt=t=>({props:{},children:mt(t)}),xt=t=>({props:{},children:t}),ht=t=>({props:t[0]||{},children:Bt(t[1])});var Mt=t=>({props:{watch:t},children:[]}),Ot=t=>{if(t.length===0)return ut();let o=t[0],r=typeof o;if(r==="string"||r==="number")return lt(o);if(Array.isArray(o))return x.isWatching(o)?Mt(o):xt(o);let e=t[1]??t[0]??[];return e&&Array.isArray(e)&&x.isWatching(e)&&(t[0]=Array.isArray(t[0])?{}:t[0],t[0].watch=e,t[1]=[]),ht(t)},jt=t=>(...o)=>{let{props:r,children:e}=Ot(o);return t(r,e)};var Lt=(t,o)=>{let r=Object.keys(t);for(let e=0,n=r.length;e<n;e++){let i=r[e],s=t[i],c=W[i]||i;o.prototype[c]=B(s,c)}return o},Ut=0,Rt=t=>{let o=class extends t{};return o.prototype._classId="pod"+Ut++,o},_t=(t,o=k)=>{if(!t)return null;let r=Rt(o),e={},n=t(e);return Lt(e,r),r.prototype.render=n,r};b(T,I);export{jt as Atom,p as Builder,k as Component,gt as Directives,Dt as Import,At as Jot,_t as Pod,St as Unit,T as coreDirectives,I as reactiveDirectives,b as registerDirectives};
|
package/dist/modules/data.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
import{
|
|
2
|
-
//# sourceMappingURL=data.js.map
|
|
1
|
+
import{a as A,b as x}from"../chunks/chunk-MNKLSGJQ.js";import{a as h}from"../chunks/chunk-66EA7DZY.js";import{a as T}from"../chunks/chunk-W37VRHGC.js";import{d as U,g as R}from"../chunks/chunk-NGPNK5SD.js";import"../chunks/chunk-ZII2WFZO.js";import{a as D,d as b}from"../chunks/chunk-R5DHGQZV.js";var N={"\n":"\\n","\r":"\\n"," ":"\\t"},P=(o,e)=>{typeof o!="string"&&(o=String(o));let t=e?/[\n\r\t]/g:/\t/g;return o.replace(t,r=>N[r])},v=(o,e)=>{if(typeof o!="string")return o;o=P(o,e),o=encodeURIComponent(o);let t=/%22/g;return o.replace(t,'"')},j=(o,e)=>{let t=typeof o;if(t==="undefined")return o;if(t!=="object")return o=v(o),o;let r=Array.isArray(o)?[...o]:{...o};return Object.keys(r).forEach(n=>{let s=r[n];s!==null&&(r[n]=typeof s=="string"?j(s,e):v(s,e))}),r};function E(o){if(typeof o>"u"||o.length<1)return!1;try{return JSON.parse(o)}catch(e){return console.warn("[Encode] Failed to parse JSON.",e),!1}}function O(o){return typeof o<"u"?JSON.stringify(o):null}var y=class{static prepareJsonUrl(e,t=!1){let r=typeof e=="object"?T.clone(e):e,n=j(r,t);return O(n)}static json={encode:O,decode:E};static xmlParse(e){return typeof e>"u"?!1:new DOMParser().parseFromString(e,"text/xml")}};var q=/\[\[(.*?(?:\[\d+\])?)\]\]/g,m=class{constructor(e){this.model=e,this.objectType=this.objectType||"item",this.url="",this.validateCallBack=null,this.init()}init(){let e=this.model;e&&e.url&&(this.url=e.url)}isValid(){let e=this.validate();if(e!==!1){let t=this.validateCallBack;typeof t=="function"&&t(e)}return e}validate(){return!0}getDefaultParams(){return""}setupParams(e){let t=this.getDefaultParams();return e=this.addParams(e,t),e}objectToString(e){let t=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.push(r+"="+e[r]);return t.join("&")}addParams(e,t){if(e=e||{},typeof e=="string"&&(e=b.parseQueryString(e,!1)),!t)return this._isFormData(e)?e:this.objectToString(e);if(typeof t=="string"&&(t=b.parseQueryString(t,!1)),this._isFormData(e))for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.append(r,t[r]);else e=Object.assign(e,t),e=this.objectToString(e);return e}get(e,t){let r=this.model.get("id"),n="id="+r,s=r?`/${r}`:"",i=this.model;return this._get(s,n,e,t,c=>{if(c){let u=this.getObject(c);u&&i.set(u)}})}getObject(e){return e[this.objectType]||e||!1}setupObjectData(){let e=this.model.get();return this.objectType+"="+y.prepareJsonUrl(e)}setup(e,t){if(!this.isValid())return;let r=this.setupObjectData(),n=this.model.id,s=n!=null?`/${n}`:"";return this._put(s,r,e,t)}add(e,t){if(!this.isValid())return;let r=this.setupObjectData(),n=this.model.id,s=n!=null?`/${n}`:"";return this._post(s,r,e,t)}update(e,t){if(!this.isValid())return;let r=this.setupObjectData(),n=this.model.id,s=n!=null?`/${n}`:"";return this._patch(s,r,e,t)}delete(e,t){let r=this.model.get("id"),n=typeof r<"u"?"id="+r:this.setupObjectData(),s=r!=null?`/${r}`:"";return this._delete(s,n,e,t)}getAllParams(e,t,r,n){let s=this.model.get();e=isNaN(Number(e))?0:e,t=isNaN(Number(t))?50:t;let i=s.search||"",c=d=>{try{return JSON.stringify(d)}catch(p){return console.error("[ModelService] Failed to serialize request param.",p),""}},u=s.filter||"";typeof u=="object"&&(u=c(u));let l=s.dates||"";typeof l=="object"&&(l=c(l));let f=s.orderBy||"";typeof f=="object"&&(f=c(f));let a=s.groupBy||"";return Array.isArray(a)&&(a=c(a)),"&filter="+encodeURIComponent(u)+"&offset="+e+"&limit="+t+"&dates="+encodeURIComponent(l)+"&orderBy="+encodeURIComponent(f)+"&groupBy="+encodeURIComponent(a)+"&search="+encodeURIComponent(i)+"&lastCursor="+(typeof r<"u"&&r!==null?encodeURIComponent(r):"")+"&since="+(typeof n<"u"&&n!==null?encodeURIComponent(n):"")}all(e,t,r,n,s=null,i=null){let c=this.getAllParams(r,n,s,i);return this._get("",c,e,t)}getUrl(e){let t=this.url;if(!e)return this.replaceUrl(t);e[0]==="/"&&(e=e.substring(1));let r=e[0]==="?"?t+e:t+"/"+e;return this.replaceUrl(r)}setupRequest(e,t,r,n,s){let i={url:this.getUrl(e),method:t,params:r,completed:(u,l)=>{typeof s=="function"&&s(u),this.getResponse(u,n,l)}};return this._isFormData(r)&&(i.headers={}),x(i)}setupEventSource(e,t,r,n,s=!0){let i=null,c,u=!1,l=!1,f=()=>{c&&(clearTimeout(c),c=void 0)},a=()=>{if(u||!s||l)return;f(),c=setTimeout(()=>{c=void 0,d()},3e3)},d=()=>{if(u||l)return;if(i){try{i.close()}catch{}i=null}l=!0;let p=this.getUrl(e),C=t?"?"+t:"";i=new EventSource(p+C,{withCredentials:!0}),i.onopen=()=>{l=!1,f(),n&&n()},i.onerror=()=>{l=!1,i&&i.readyState===EventSource.CLOSED&&(i=null,a())},i.onmessage=S=>{try{let _=JSON.parse(S.data);r&&r(_)}catch{}}};return d(),{get source(){return i},close:()=>{if(u=!0,l=!1,f(),i){try{i.close()}catch{}i=null}}}}replaceUrl(e){if(typeof e=="string"&&e.includes("[[")){let t=this.model;e=e.replace(q,(r,n)=>{let s=t.get(n);return s??""})}return e.endsWith("/")&&(e=e.substring(0,e.length-1)),e}_isFormData(e){return e instanceof FormData}request(e,t,r,n){return this._request("","POST",e,t,r,n)}_get(e,t,r,n,s){return t=this.setupParams(t),t=this.addParams(t,r),e=e||"",t&&(e+="?"+t),this.setupRequest(e,"GET","",n,s)}_post(e,t,r,n,s){return this._request(e,"POST",t,r,n,s)}_put(e,t,r,n,s){return this._request(e,"PUT",t,r,n,s)}_patch(e,t,r,n,s){return this._request(e,"PATCH",t,r,n,s)}_delete(e,t,r,n,s){return this._request(e,"DELETE",t,r,n,s)}_request(e,t,r,n,s,i){return r=this.setupParams(r),r=this.addParams(r,n),this.setupRequest(e,t,r,s,i)}getResponse(e,t,r){typeof t=="function"&&t(e,r)}static extend(e){if(!e)return{};let t=this;class r extends t{constructor(s){super(s)}}return Object.assign(r.prototype,e),r}};var I=o=>{let e={};if(!D.isObject(o)||!o.defaults)return e;let{defaults:t}=o;return Object.keys(t).forEach(r=>{let n=t[r];typeof n!="function"&&(e[r]=n)}),delete o.defaults,e},w=o=>{if(!o||typeof o.xhr!="object")return{};let e={...o.xhr};return delete o.xhr,e},F=0,g=class extends h{constructor(e){let t=super(e);return this.initialize(),t}setup(){this.attributes={},this.stage={},this.url=this.url||"",this.xhr=this.xhr||{}}initialize(){}get service(){return m}set service(e){Object.defineProperty(this,"service",{value:e,writable:!0,configurable:!0})}static extend(e={}){let t=this,r=w(e),n=t.prototype.service.extend(r),s=I(e);class i extends t{constructor(u){let l={...s,...U(u)};super(l),this.xhr=new n(this)}dataTypeId=`bm${F++}`}return Object.assign(i.prototype,e),Object.defineProperty(i.prototype,"service",{value:n,writable:!0,configurable:!0}),i}};export{h as Data,g as Model,R as SimpleData,A as setModelRequestHandler};
|
package/dist/modules/date.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
1
|
var h={monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],getDayName(e=new Date().getDay(),t=!1){if(typeof Intl<"u"){let n=new Date(2004,0,4+e);return new Intl.DateTimeFormat(void 0,{weekday:t?"short":"long"}).format(n)}let a=this.dayNames;if(e>a.length)return null;let r=a[e];return t?r.substring(0,3):r},convertJsMonth(e){return this.padNumber(e+1)},convertDate(e,t=!1){e=e?e.replace(/\s/,"T"):"";let a=new Date(e);if(typeof Intl<"u"){let n={weekday:"long",month:"short",day:"2-digit"};return t&&(n.year="numeric"),new Intl.DateTimeFormat(void 0,n).format(a)}let r=t===!0?" "+a.getFullYear():"";return this.getDayName(a.getDay())+", "+this.getMonthName(a.getMonth(),!0)+" "+this.padNumber(a.getDate())+r},padNumber(e){return e<=9?"0"+e:String(e)},createDate(e){return e?(typeof e=="string"&&e.indexOf("-")>-1&&(e=e.replace(/\s/,"T"),e=e.indexOf(":")>-1?e:e+"T00:00:00"),new Date(e)):new Date},format(e,t){let a=this.createDate(t);return e!=="sql"&&typeof Intl<"u"?new Intl.DateTimeFormat(void 0,{year:"numeric",month:"2-digit",day:"2-digit"}).format(a):this.renderDate(a.getFullYear(),a.getMonth()+1,a.getDate(),e)},formatTime(e,t){let a=this.createDate(e);if(t!==24&&typeof Intl<"u")return new Intl.DateTimeFormat(void 0,{hour:"numeric",minute:"2-digit",hour12:!0}).format(a);let r=t===24?"sql":"standard";return this.renderTime(a.getHours(),a.getMinutes(),a.getSeconds(),r)},getMeridian(e){return e=Number(e),e>=12?"PM":"AM"},convert24To12(e){return e=Number(e),e>12&&(e=e-12),e},convert12To24(e,t){return e=Number(e),t.toLowerCase()==="pm"&&(e=e+12),e},renderDate(e,t,a,r="sql"){return t=Number(t),a=Number(a),r==="sql"?`${e}-${this.padNumber(t)}-${this.padNumber(a)}`:`${this.padNumber(t)}/${this.padNumber(a)}/${e}`},renderTime(e,t,a=0,r="sql"){if(r==="sql")return`${this.padNumber(e)}:${this.padNumber(t)}:${this.padNumber(a)}`;let n=this.getMeridian(e);return e=this.convert24To12(e),`${e}:${this.padNumber(t)} ${n}`},leapYear(e){return e%400===0||e%100!==0&&e%4===0},getMonthName(e=new Date().getMonth(),t=!1){if(typeof Intl<"u"){let n=new Date(2e3,e,1);return new Intl.DateTimeFormat(void 0,{month:t?"short":"long"}).format(n)}let a=this.monthNames;if(e>a.length)return"";let r=a[e];return r?t?r.substring(0,3):r:""},getMonthLength(e,t){let a=new Date;return e=typeof e<"u"?e:a.getMonth(),t=typeof t<"u"?t:a.getFullYear(),this.getMonthsLength(t)[e]},getMonthsLength(e=new Date().getFullYear()){return this.leapYear(e)===!0?[31,29,31,30,31,30,31,31,30,31,30,31]:[31,28,31,30,31,30,31,31,30,31,30,31]},getLocalDate(e,t="America/Denver"){let a=new Date(e);if(Number.isNaN(a.getMonth())===!0){let s=/[- :]/,o=e.split(s);a=new Date(o[0],o[1]-1,o[2],o[3],o[4],o[5])}let r=new Date(Date.parse(a.toLocaleString("en-US",{timeZone:t}))),n=a.getTime()-r.getTime();return new Date(a.getTime()+n)},getLocalTime(e,t=!1,a=!1,r="America/Denver"){if(!e)return"";let n=this.getLocalDate(e,r);if(!t&&typeof Intl<"u"){let u={hour:"numeric",minute:"2-digit",second:"2-digit",hour12:!0};return a===!1&&(u.year="numeric",u.month="2-digit",u.day="2-digit"),new Intl.DateTimeFormat(void 0,u).format(n)}let s=n.getMonth()+1,o=t===!0?"sql":"standard",f="";return a===!1&&(f+=this.renderDate(n.getFullYear(),s,n.getDate(),o)+" "),f+this.renderTime(n.getHours(),n.getMinutes(),n.getSeconds(),o)},getDiffFromNow(e,t=!1){e=e.replace(/\s/,"T");let a=new Date(e),r=new Date;return t===!0&&r.setHours(0,0,0,0),r.getTime()-a.getTime()},getAge(e){let t=this.getDiffFromNow(e),a,r;switch(!0){case t<864e5:a="1 day";break;case t<6048e5:r=this.toDays(t),a=r+" days";break;case t<12096e5:a="1 week";break;case t<2592e6:r=this.toDays(t);var n=Math.floor(r/7);a=n+" weeks";break;case t<5184e6:a="1 month";break;case t<31104e6:var s=this.toMonths(t);a=s+" months";break;default:var o=this.toYears(t);a=o}return String(a)},getTimeFrame(e){let t=this.getDiffFromNow(e);return this.convertToEstimate(t)},convertToEstimate(e){let t="",a,r,n,s,o,f,u;if(e<=0)switch(!0){case e<-63072e6:n=this.toYears(Math.abs(e)),t="in "+n+" y";break;case e<-31536e6:t="in 1y";break;case e<-5184e6:s=this.toMonths(Math.abs(e)),t="in "+s+"mo";break;case e<-2592e6:t="in 1mo";break;case e<-12096e5:a=this.toDays(Math.abs(e)),r=Math.floor(a/7),t="in "+r+"w";break;case e<-6048e5:t="in 1w";break;case e<-1728e5:a=this.toDays(Math.abs(e)),t="in "+a+"d";break;case e<-864e5:t="tomorrow";break;case e<-72e5:o=this.toHours(Math.abs(e)),t="in "+o+" h";break;case e<=-36e5:t="in 1h";break;case e<-12e4:f=this.toMinutes(Math.abs(e)),t="in "+f+"m";break;case e<-6e4:t="in 1m";break;case e<-2e3:u=this.toSeconds(Math.abs(e)),t="in "+u+"s";break;case e<-1:t="in 1s";break;default:t="now"}else switch(!0){case e<1e3:t="1s ago";break;case e<6e4:u=this.toSeconds(e),t=u+"s ago";break;case e<12e4:t="1m ago";break;case e<36e5:f=this.toMinutes(e),t=f+"m ago";break;case e<72e5:t="1h ago";break;case e<864e5:o=this.toHours(e),t=o+"h ago";break;case e<1728e5:t="yesterday";break;case e<6048e5:a=this.toDays(e),t=a+"d ago";break;case e<12096e5:t="1w ago";break;case e<2592e6:a=this.toDays(e),r=Math.floor(a/7),t=r+"w ago";break;case e<5184e6:t="1mo ago";break;case e<31536e6:s=this.toMonths(e),t=s+"mo ago";break;case e<63072e6:t="1y ago";break;default:n=this.toYears(e),t=n+"y ago"}return t},toYears(e){return typeof e!="number"?0:Math.floor(e/31558464e3)},toMonths(e){return typeof e=="number"?Math.floor(e/2592e6):0},toDays(e){return typeof e!="number"?0:Math.floor(e/864e5*1)},toHours(e){return typeof e!="number"?0:Math.floor(e%864e5/36e5*1)},toMinutes(e){return typeof e!="number"?0:Math.floor(e%864e5%36e5/6e4*1)},toSeconds(e){return typeof e!="number"?0:Math.floor(e%864e5%36e5%6e4/1e3*1)},getDifference(e,t){let a=new Date(e),r=new Date(t),n=r.getTime()-a.getTime();return{years:this.toYears(n),days:this.toDays(n),hours:this.toHours(n),minutes:this.toMinutes(n),seconds:this.toSeconds(n)}}};export{h as DateTime};
|
|
2
|
-
//# sourceMappingURL=date.js.map
|
package/dist/modules/html.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
import{
|
|
2
|
-
//# sourceMappingURL=html.js.map
|
|
1
|
+
import{c as m}from"../chunks/chunk-2ML3HANA.js";import"../chunks/chunk-ZII2WFZO.js";import"../chunks/chunk-R5DHGQZV.js";export{m as Html};
|
package/dist/modules/router.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
import{i as r,j as o,k as t}from"../chunks/chunk-KNBYBDOP.js";import"../chunks/chunk-AO5L25YQ.js";import"../chunks/chunk-FXJIFTW5.js";import"../chunks/chunk-ILT4B3VY.js";import"../chunks/chunk-E3C6NOMV.js";import"../chunks/chunk-R5DHGQZV.js";export{r as NavLink,o as Router,t as router};
|
|
2
|
-
//# sourceMappingURL=router.js.map
|
|
1
|
+
import{a as H}from"../chunks/chunk-66EA7DZY.js";import{b as C,d as y,g as M,l as D,m as F}from"../chunks/chunk-PM3QNZ7G.js";import"../chunks/chunk-2ML3HANA.js";import"../chunks/chunk-W37VRHGC.js";import"../chunks/chunk-G32YTH3D.js";import{c as G,f as L}from"../chunks/chunk-NGPNK5SD.js";import"../chunks/chunk-ZII2WFZO.js";import{b as m,c as h}from"../chunks/chunk-R5DHGQZV.js";var B=null,j=r=>{B=r},g=()=>(B===null&&console.error('No router has been registered. Import the router from "@base-framework/base" or "@base-framework/base/router" before using the route or switch directives.'),B);m.addType("routes",r=>{if(!r)return!1;let t=r.route;if(t){let e=g();e&&e.removeRoute(t)}});var Q=(r,t,e)=>{if(t)if(Array.isArray(t))for(let s=0,i=t.length;s<i;s++){let o=t[s];o&&W(r,o,e)}else W(r,t,e)},W=(r,t,e)=>{let s=g();if(!s)return;t.container=r,t.parent=e;let i=s.add(t);st(r,i)},st=(r,t)=>{m.add(r,"routes",{route:t})};m.addType("switch",r=>{if(!r)return!1;let t=g();if(!t)return!1;t.removeSwitch(r.id)});var N=(r,t,e)=>{let s=g();if(!s)return;for(let o=0,a=t.length;o<a;o++){let n=t[o];n&&(n.container=r,n.parent=e)}let i=s.addSwitch(t);rt(r,i)},rt=(r,t)=>{m.add(r,"switch",{id:t})};var U={route:Q,switch:N};var it=0,w=class{constructor(t){this.router=t,this.locationId="base-app-router-"+it++,this.callBack=this.check.bind(this)}setup(){return this.addEvent(),this}check(t){}getScrollPosition(){return{x:window.scrollX,y:window.scrollY}}scrollTo(t){window.scrollTo(t.x,t.y)}addEvent(){return this}};var $=typeof navigator<"u"&&/iPad|iPhone|iPod/.test(navigator.userAgent||"")&&!window.MSStream,_=()=>{$&&requestAnimationFrame(()=>requestAnimationFrame(()=>{let r=window.scrollX,t=window.scrollY;window.scrollTo(0,t+1),document.documentElement.offsetHeight,window.scrollTo(r,t)}))},S=class extends w{addEvent(){return h.on("popstate",window,this.callBack),$&&(this.pageShowCallBack=this.onPageShow.bind(this),h.on("pageshow",window,this.pageShowCallBack)),this}removeEvent(){return h.off("popstate",window,this.callBack),this.pageShowCallBack&&h.off("pageshow",window,this.pageShowCallBack),this}onPageShow(t){t.persisted&&_()}check(t){let e=t.state;if(!e||e.location!==this.locationId)return!1;t.preventDefault(),t.stopPropagation(),this.router.checkActiveRoutes(e.uri);let s=e.scrollPosition;s&&this.scrollTo(s),_()}createState(t,e={}){let s=this.getScrollPosition();return e=e===null?{}:e,{location:this.locationId,...e,scrollPosition:s,uri:t}}addState(t,e,s=!1){let i=window.history,o=i.state;if(o&&o.uri===t)return this;!s&&o&&o.location===this.locationId&&(o.scrollPosition=this.getScrollPosition(),i.replaceState(o,"",window.location.href));let a=this.createState(t,e);return s||(a.scrollPosition={x:0,y:0}),i[s===!1?"pushState":"replaceState"](a,null,t),this}};var k={removeSlashes(r){return typeof r!="string"?"":(r[0]==="/"&&(r=r.substring(1)),r[r.length-1]==="/"&&(r=r.substring(0,r.length-1)),r)},getHashUri(r){if(typeof r!="string")return"";let t=r.indexOf("#");return t===-1?"":r.substring(t+1)}};var P=class extends w{addEvent(){return h.on("hashchange",window,this.callBack),this}removeEvent(){return h.off("hashchange",window,this.callBack),this}check(t){this.router.checkActiveRoutes(k.getHashUri(t.newURL))}addState(t,e,s){return window.location.hash=t,this}};var R=class{static browserIsSupported(){return typeof window=="object"&&"history"in window&&"pushState"in window.history}static setup(t){return this.browserIsSupported()?new S(t).setup():new P(t).setup()}};var A=class extends y{getChildScope(){return this.parent}},Y=r=>M(r,A);var T=class{constructor(t,e){this.route=t,this.template=e.component,this.component=null,this.hasTemplate=!1,this.setup=!1,this.container=e.container,this.persist=e.persist,this.parent=e.parent}focus(t){this.setup===!1&&(this.route&&typeof this.route.flushPending=="function"&&this.route.flushPending(),this.create()),this.update(t)}setupTemplate(){let e=typeof this.template;e==="function"?this.initializeComponent():e==="object"&&this.initializeTemplateObject(),this.hasTemplate=!0}initializeComponent(){this.template=this.template(),this.initializeTemplateObject()}transferSettings(t){this.persist=this.persist&&t.persist!==!1,Object.assign(t,{route:this.route,persist:this.persist}),this.component=t}initializeTemplateObject(){let t=this.template;if(!t)return;t.isUnit||(this.template=new(Y(t)));let e=this.template;this.transferSettings(e)}create(){if(this.setupTemplate(),!this.hasTemplate)return;this.setup=!0;let t=this.component;D.render(t,this.container,this.parent)}remove(){if(this.setup!==!0)return;this.setup=!1;let t=this.component;t&&(typeof t.destroy=="function"&&t.destroy(),this.component=null)}update(t){let e=this.component;e&&typeof e.update=="function"&&e.update(t)}};var K=r=>{if(!r.length)return null;let t={};for(let e=0,s=r.length;e<s;e++)t[r[e]]=null;return t},z=r=>{let t=[];if(!r)return t;let e=/[*?]/g;r=r.replace(e,"");let s=/:(.[^./?&($]+)\?*/g,i=r.match(s);if(i===null)return t;for(let o=0,a=i.length;o<a;o++){let n=i[o];n&&t.push(n.replace(":",""))}return t};var ot=/(\/):[^/(]*?\?/g,nt=/\//g,at=/(\?\/+\*?)/g,ct=/(:[^/?&($]+)/g,lt=/(\*)/g,ht=r=>r.replace(ot,t=>t.replace(nt,"(?:$|/)")),ut=r=>(r=r.replace(at,"?/*"),r.replace(ct,t=>t.indexOf(".")<0?"([^/|?]+)":"([^/|?]+.*)")),pt=r=>r.replace(lt,".*"),ft=(r,t)=>r+=t[t.length-1]==="*"?"":"$",V=r=>{if(!r)return"";let t=r;return t=ht(t),t=ut(t),t=pt(t),t=ft(t,r),t};var dt=0,X=(r,t="")=>{let e=r||"",s=typeof t=="string"&&t?t:e,i=null,o=[],a=s.match(/#\{([^}]+)\}/);a&&a[1]&&(i=a[1].trim(),s=s.replace(a[0],""),e=e.replace(a[0],""));let n=s.indexOf("?");if(n>-1){let l=s.substring(n+1);if(l.indexOf("=")>-1){let f=l.split("&");for(let u=0,O=f.length;u<O;u++){let q=f[u];if(!q)continue;let[tt,et=""]=q.split("="),E=(tt||"").trim();E&&o.push({key:E,value:(et||"").trim()})}s=s.substring(0,n);let d=e.indexOf("?");d>-1&&(e=e.substring(0,d))}}let c=i!==null||o.length>0;return c&&!s&&(e="*"),{uriPath:e,requiredHash:i,requiredQuery:o,hasConditions:c}},mt=r=>{if(!r)return"";let t=r.indexOf("?"),e=r.indexOf("#"),s=r.length;return t>-1&&(s=t),e>-1&&e<s&&(s=e),r.substring(0,s)},gt=r=>{if(!r)return"";let t=r.indexOf("#");return t===-1?"":r.substring(t+1)},wt=r=>{if(!r)return"";let t=r.indexOf("?");if(t===-1)return"";let e=r.indexOf("#",t);return e===-1?r.substring(t+1):r.substring(t+1,e)},x=class extends L{constructor(t,e){let s=t.baseUri,o=X(s,t.rawUri).uriPath,a=z(o),n=K(a),c=super(n);return this.uri=s,this.matchUri=o,this.paramKeys=a,this.titleCallBack=e,this.setupRoute(t),this.set("active",!1),c}setup(){this.stage={},this.routeId=null,this.uri=null,this.rawUri=null,this.matchUri="",this.uriQuery=/$^/,this.controller=null,this.paramKeys=[],this.requiredHash=null,this.requiredQuery=[],this.hasConditions=!1,this.titleCallBack=()=>{},this.path=null,this.referralPath=null,this.params=null,this.callBack=null,this.title=null,this.preventScroll=!1,this.scrollTo=null}setupRoute(t){this.routeId=t.id||"bs-rte-"+dt++,this.rawUri=t.rawUri||null,this.path=null,this.referralPath=null;let e=X(this.uri,this.rawUri||"");this.matchUri=e.uriPath,this.requiredHash=e.requiredHash,this.requiredQuery=e.requiredQuery,this.hasConditions=e.hasConditions;let s=V(this.matchUri);this.uriQuery=new RegExp("^"+s),this.params=null,this.setupComponentHelper(t),this.callBack=t.callBack,this.title=t.title,this.preventScroll=t.preventScroll||!1,this.scrollTo=t.scrollTo||null}setTitle(t){this.title=t,this.titleCallBack(this,t)}deactivate(){this.set("active",!1);let t=this.controller;t&&t.remove()}getLayout(t){if(t.component)return t.component;let e=t.import;return e?F(e):null}setupComponentHelper(t){let e=this.getLayout(t);if(!e)return;let{container:s,persist:i,parent:o}=t,a={component:e,container:s,persist:i,parent:o},n=G(this);this.controller=new T(n,a)}resumeRoute(t){let e=this.controller;e&&(e.container=t)}setPath(t,e){this.path=t,this.referralPath=e}select(){this.set("active",!0);let t=this.stage,e=this.callBack;typeof e=="function"&&e(t);let s=this.controller;s&&s.focus(t);let i=this.path;if(!i)return;let o=i.split("#")[1];o&&this.scrollToId(o)}scrollToId(t){if(!t)return;let e=document.getElementById(t);e&&e.scrollIntoView(!0)}match(t){let e=!1,s=mt(t),i=this.uriQuery||/$^/,o=s.match(i);return o===null?(this.resetParams(),e):Array.isArray(o)?this.matchConditions(t)?(this.setParams(o,1),e=o,e):(this.resetParams(),!1):e}matchConditions(t){if(!this.hasConditions)return!0;if(this.requiredHash!==null&>(t)!==this.requiredHash)return!1;let e=this.requiredQuery||[];if(e.length>0){let s=wt(t);if(!s)return!1;let i=new URLSearchParams(s);for(let o=0,a=e.length;o<a;o++){let n=e[o];if(!i.has(n.key)||i.get(n.key)!==n.value)return!1}}return!0}resetParams(){this.stage={}}setParams(t,e=0){if(!Array.isArray(t))return;let s=this.paramKeys;if(!s)return;let i={};for(let o=0,a=s.length;o<a;o++){let n=s[o];typeof n<"u"&&(i[n]=t[o+e])}this.set(i)}getParams(){return this.stage}};var yt=r=>{let t=/\w\S*/;return r.replace(t,e=>e.charAt(0).toUpperCase()+e.substring(1).toLowerCase())},St=r=>r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),kt=(r,t)=>{if(r.indexOf(":")===-1)return r;let e=t.stage;for(let s in e)if(Object.prototype.hasOwnProperty.call(e,s)){let i=new RegExp(":"+St(s),"gi");r=r.replace(i,()=>e[s])}return r},Pt=(r,t)=>t&&(typeof t=="function"&&(t=t(r.stage)),t=kt(t,r),yt(t)),Rt=(r,t)=>(t!==""&&(r+=" - "+t),r),J=(r,t,e)=>t&&(t=Pt(r,t),Rt(t,e));var Z=(r,t)=>({attr:r,value:t}),Tt=(r,t)=>{if(!t.startsWith(r))return!1;let e=t[r.length];return e===void 0||e==="/"||e==="#"||e==="."||e==="?"},I=class extends y{beforeSetup(){this.selectedClass=this.activeClass||"active"}render(){let t=this.href,e=this.text,s=this.setupWatchers(t,e);return{tag:"a",class:this.class||this.className||null,onState:["selected",{[this.selectedClass]:!0}],href:this.getString(t),text:this.getString(e),nest:this.nest||this.children,dataStateSet:this.dataSet,"data-replace":this.replace?"true":null,watch:s}}getLinkPath(){var t;return((t=this==null?void 0:this.panel)==null?void 0:t.pathname)||null}getString(t){let e=typeof t;return e!=="object"&&e!=="undefined"?t:null}setupWatchers(t,e){let s=this.exact===!0,i=v.data,o=[];t&&typeof t=="object"&&o.push(Z("href",t)),e&&typeof e=="object"&&o.push(Z("text",e));let a=null,n="",c="";return o.push({value:["[[path]]",i],callBack:(p,l)=>{if(typeof l.pathname>"u")return;let f=l.getAttribute("href");if(f!==a){a=f;let u=l.pathname+l.search+l.hash;n=u,c=l.hash||l.search?u:l.pathname}let d=s?p===n:Tt(c,p);this.update(d)}}),o}setupStates(){return{selected:!1}}update(t){this.state&&(this.state.selected=t)}};var xt=()=>typeof window<"u"?window.location:{},b=class{constructor(){this.version="1.0.2",this.baseURI="/",this.title="",this.lastPath=null,this.path=null,this.lastMatchedRoute=null,this.lastScrollGroup=null,this.currentGroupId=null,this.scrollWaitToken=0,this.history=null,this.callBackLink=null,this.location=xt(),this.routes=[],this.switches=new Map,this.switchCount=0,this.data=new H({path:""})}setupHistory(){this.history=R.setup(this)}createRoute(t){let e=t.uri||"*";return t.rawUri=e,t.baseUri=this.createURI(e),new x(t,this.updateTitle.bind(this))}add(t){if(typeof t!="object"){let s=arguments;t={uri:s[0],component:s[1],callBack:s[2],title:s[3],id:s[4],container:s[5]}}let e=this.createRoute(t);return this.addRoute(e),e}addRoute(t){this.routes.push(t),this.checkRoute(t,this.getPath())}resume(t,e){t.resumeRoute(e),this.addRoute(t)}getBasePath(){if(!this.basePath){let t=this.baseURI||"";t[t.length-1]!=="/"&&(t+="/"),this.basePath=t}return this.basePath}createURI(t){let e=this.getBasePath(),s=k.removeSlashes(t);return s=s.replace(/^(?:\.\/)+/,""),s==="."&&(s=""),e+s}getRoute(t){let e=this.routes,s=e.length;if(s>0)for(let i=0;i<s;i++){let o=e[i];if(o.uri===t)return o}return null}getRouteById(t){let e=this.routes,s=e.length;if(s>0)for(let i=0;i<s;i++){let o=e[i];if(o.routeId===t)return o}return!1}removeRoute(t){let e=this.routes,s=e.indexOf(t);s>-1&&e.splice(s,1),this.lastMatchedRoute===t&&(this.lastMatchedRoute=null),t&&typeof t.deactivate=="function"&&t.deactivate()}addSwitch(t){let e=this.switchCount++,s=this.getSwitchGroup(e);for(let i=0,o=t.length;i<o;i++){let a=t[i];if(!a)continue;let n=this.createRoute(a);s.push(n)}return this.checkGroupForRegistration(e,s),e}resumeSwitch(t,e){let s=this.switchCount++,i=this.getSwitchGroup(s);for(let o=0,a=t.length;o<a;o++){let c=t[o].component.route;c.resumeRoute(e),i.push(c)}return this.checkGroupForRegistration(s,i),s}checkGroupForRegistration(t,e){let s=this.scrollIntent,i=this.currentGroupId;this.scrollIntent=null,this.currentGroupId=t,this.checkGroup(e,this.getPath()),this.currentGroupId=i;let o=this.scrollIntent;o&&o.type==="target"&&o.groupId!==null&&o.groupId!==void 0&&(this.lastScrollGroup=o.groupId),this.scrollIntent=s}getSwitchGroup(t){let e=this.switches.get(t);if(e)return e;let s=[];return this.switches.set(t,s),s}removeSwitch(t){this.switches.delete(t)}remove(t){t=this.createURI(t);let e=this.getRoute(t);return e&&this.removeRoute(e),this}setup(t,e){this.baseURI=t||"/",this.updateBaseTag(this.baseURI),this.title=typeof e<"u"?e:"",this.setupHistory(),this.data.path=this.getPath(),this.callBackLink=this.checkLink.bind(this),h.on("click",document,this.callBackLink);let s=this.getEndPoint();return this.navigate(s,null,!0),this}updateBaseTag(t){let e=document.getElementsByTagName("base");e.length&&(e[0].href=t)}getParentLink(t){return t.closest("a")}checkLink(t){if(t.ctrlKey===!0)return!0;let e=t.target.closest("a");if(!e||e.target==="_blank"||e.dataset.cancelRoute)return!0;let s=e.getAttribute("href");if(s!==null){let i=this.baseURI,o=i!=="/"?s.replace(i,""):s,a=e.dataset.replace==="true";return this.navigate(o,null,a),t.preventDefault(),t.stopPropagation(),!1}}reset(){let t=this.routes;for(let e=0,s=t.length;e<s;e++){let i=t[e];i&&typeof i.deactivate=="function"&&i.deactivate()}return this.routes=[],this.switches=new Map,this.switchCount=0,this.lastMatchedRoute=null,this}activate(){return this.checkActiveRoutes(),this}navigate(t,e,s){return t=this.createURI(t),this.history.addState(t,e,s),this.updatePath(),this.activate(),this}updatePath(){let t=this.getPath();this.data.path=t}updateTitle(t){if(!t||!t.title)return this;let e=t.title;return document.title=J(t,e,this.title),this}checkActiveRoutes(t){if(this.lastPath=this.path,t=t||this.getPath(),this.path=t,this.updatePath(),this.scrollIntent=null,this.scrollWaitToken++,this.lastMatchedRoute&&this.check(this.lastMatchedRoute,t))this.select(this.lastMatchedRoute);else{let e=this.routes,s=e.length;for(let i=0;i<s;i++){let o=e[i];typeof o>"u"||this.checkRoute(o,t)}}this.checkSwitches(t),this.applyScrollIntent()}checkSwitches(t){let e=this.switches;for(let[s,i]of e.entries())this.currentGroupId=s,this.checkGroup(i,t);this.currentGroupId=null}checkGroup(t,e){let s=t.length;if(!s)return;let i=null;for(let n=0;n<s;n++)if(t[n].get("active")){i=t[n];break}let o=!1;i&&(o=i.match(e)!==!1);let a;for(let n=0;n<s;n++){let c=t[n];if(typeof c>"u")continue;(c===i?o:c.match(e))!==!1&&a===void 0&&c.controller&&(a=c)}if(!a){i&&i!==t[0]&&i.deactivate(),this.select(t[0],!0);return}this.select(a),i&&i!==a&&i.deactivate();for(let n=0;n<s;n++){let c=t[n];c&&c!==a&&c!==i&&c.deactivate()}}checkRoute(t,e){let s=this.check(t,e);return s!==!1?(this.select(t),this.lastMatchedRoute=t):t.deactivate(),s}check(t,e){return t?(e=e||this.getPath(),t.match(e)!==!1):!1}select(t,e){t&&(t.setPath(this.path,this.lastPath),t.select(),this.updateTitle(t),e!==!0&&(t.scrollTo?this.scrollIntent={type:"target",selector:t.scrollTo,groupId:this.currentGroupId}:t.preventScroll!==!0&&!this.scrollIntent&&(this.scrollIntent={type:"top"})))}applyScrollIntent(){let t=this.scrollIntent;if(this.scrollIntent=null,!t)return;if(t.type==="top"){this.lastScrollGroup=null,this.checkToScroll(),this.reassertScrollTop();return}if(t.type!=="target")return;let e=t.groupId!==null&&t.groupId!==void 0,s=e&&this.lastScrollGroup===t.groupId;s||(typeof window<"u"&&window.scrollTo(0,0),this.reassertScrollTop()),this.lastScrollGroup=e?t.groupId:null,s&&this.scrollToTarget(t.selector)}reassertScrollTop(){if(typeof window>"u"||typeof requestAnimationFrame>"u")return;let t=++this.scrollWaitToken;requestAnimationFrame(()=>{t===this.scrollWaitToken&&(window.scrollY>0||window.pageYOffset>0)&&window.scrollTo(0,0)})}scrollToTarget(t){if(typeof t!="string"||typeof document>"u")return;let e=n=>{let c=window.getComputedStyle(n),p=c.position==="sticky",l;if(p){let u=n.style.position;n.style.position="static",l=n.getBoundingClientRect().top+window.scrollY,n.style.position=u}else l=n.getBoundingClientRect().top+window.scrollY;let f=p&&parseFloat(c.top)||0,d=l-f;window.scrollY>d&&window.scrollTo(0,d)};if(typeof requestAnimationFrame>"u"){let n=document.querySelector(t);n&&e(n);return}let s=++this.scrollWaitToken,i=30,o=0,a=()=>{if(s!==this.scrollWaitToken)return;let n=document.querySelector(t);if(n){e(n);return}++o<i&&requestAnimationFrame(a)};requestAnimationFrame(a)}checkToScroll(){this.shouldScrollToTop()&&window.scrollTo(0,0)}cleanPath(t){return t?t.split("?")[0].split("#")[0]:"/"}shouldScrollToTop(){let t=this.cleanPath(this.getPath()),s=this.cleanPath(this.lastPath).split("/"),i=t.split("/");if(s.length!==i.length)return!0;let o=s[s.length-1],a=i[i.length-1];return o!==a}getEndPoint(){return this.getPath().replace(this.baseURI,"")||"/"}destroy(){typeof this.callBackLink=="function"&&h.off("click",document,this.callBackLink);let t=this.history;t&&typeof t.removeEvent=="function"&&t.removeEvent()}getPath(){let t=this.location,e=this.path=t.pathname;return this.history.type==="hash"?t.hash.replace("#",""):e+t.search+t.hash}},v=new b;j(v);C(U);export{I as NavLink,b as Router,C as registerDirectives,v as router,U as routerDirectives};
|
package/dist/modules/state.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
import{a as r,b as t}from"../chunks/chunk-
|
|
2
|
-
//# sourceMappingURL=state.js.map
|
|
1
|
+
import{a as r,b as t}from"../chunks/chunk-G32YTH3D.js";import"../chunks/chunk-NGPNK5SD.js";import"../chunks/chunk-ZII2WFZO.js";import"../chunks/chunk-R5DHGQZV.js";export{r as State,t as Store};
|
package/dist/types/base.d.ts
CHANGED
|
@@ -24,6 +24,7 @@ import { Model } from './modules/data/data.js';
|
|
|
24
24
|
import { NavLink } from './modules/router/router.js';
|
|
25
25
|
import { Objects } from './shared/objects.js';
|
|
26
26
|
import { Pod } from './modules/component/pod.js';
|
|
27
|
+
import { registerDirectives } from './modules/layout/directives/directive-registry.js';
|
|
27
28
|
import { router } from './modules/router/router.js';
|
|
28
29
|
import { SimpleData } from './modules/data/data.js';
|
|
29
30
|
import { State } from './modules/state/state.js';
|
|
@@ -31,4 +32,4 @@ import { StateTracker as Store } from './modules/state/state-tracker.js';
|
|
|
31
32
|
import { Strings } from './shared/strings.js';
|
|
32
33
|
import { Types } from './shared/types.js';
|
|
33
34
|
import { Unit } from './modules/component/unit.js';
|
|
34
|
-
export { Ajax, Arrays, Atom, base, Builder, Component, Data, dataBinder, DataTracker, DateTime, Directives, Dom, Encode, EventMethods as Events, Html, Import, Jot, Model, NavLink, Objects, Pod, router, SimpleData, State, Store, Strings, Types, Unit };
|
|
35
|
+
export { Ajax, Arrays, Atom, base, Builder, Component, Data, dataBinder, DataTracker, DateTime, Directives, Dom, Encode, EventMethods as Events, Html, Import, Jot, Model, NavLink, Objects, Pod, registerDirectives, router, SimpleData, State, Store, Strings, Types, Unit };
|
|
@@ -5,4 +5,7 @@ export { Pod } from "../modules/component/pod.js";
|
|
|
5
5
|
export { Unit } from "../modules/component/unit.js";
|
|
6
6
|
export { Import } from "../modules/import/import.js";
|
|
7
7
|
export { Builder } from "../modules/layout/builder.js";
|
|
8
|
+
export { coreDirectives } from "../modules/layout/directives/core/core-directives.js";
|
|
9
|
+
export { reactiveDirectives } from "../modules/layout/directives/core/reactive-directives.js";
|
|
10
|
+
export { registerDirectives } from "../modules/layout/directives/directive-registry.js";
|
|
8
11
|
export { Directives } from "../modules/layout/directives/directives.js";
|
|
@@ -362,5 +362,15 @@ export class Unit {
|
|
|
362
362
|
*/
|
|
363
363
|
destroy(): void;
|
|
364
364
|
}
|
|
365
|
-
|
|
366
|
-
|
|
365
|
+
/**
|
|
366
|
+
* `Data` and `StateTarget` are only named in the type annotations below.
|
|
367
|
+
* Importing them for real would make the data barrel (and through it the
|
|
368
|
+
* model service) and the state module reachable from every unit.
|
|
369
|
+
*/
|
|
370
|
+
export type Data = import("../data/types/deep-data/deep-data.js").Data;
|
|
371
|
+
/**
|
|
372
|
+
* `Data` and `StateTarget` are only named in the type annotations below.
|
|
373
|
+
* Importing them for real would make the data barrel (and through it the
|
|
374
|
+
* model service) and the state module reachable from every unit.
|
|
375
|
+
*/
|
|
376
|
+
export type StateTarget = import("../state/state-target.js").StateTarget;
|
|
@@ -37,7 +37,21 @@ export class Model extends Data {
|
|
|
37
37
|
* @returns {void}
|
|
38
38
|
*/
|
|
39
39
|
protected initialize(): void;
|
|
40
|
-
service: typeof ModelService;
|
|
40
|
+
set service(value: typeof ModelService);
|
|
41
|
+
/**
|
|
42
|
+
* The service class this model talks to its remote endpoint through.
|
|
43
|
+
*
|
|
44
|
+
* This is an accessor pair rather than a `Model.prototype.service`
|
|
45
|
+
* assignment below the class body because a top level property
|
|
46
|
+
* mutation is a side effect no bundler can prove is safe to drop, and
|
|
47
|
+
* it pinned `ModelService`, and the whole `Model` class with it, into
|
|
48
|
+
* every bundle that touched the data entry even when the consumer
|
|
49
|
+
* never used a model. The setter keeps plain assignment working, both
|
|
50
|
+
* for `extend` and for anyone shadowing the service on an instance.
|
|
51
|
+
*
|
|
52
|
+
* @type {typeof ModelService}
|
|
53
|
+
*/
|
|
54
|
+
get service(): typeof ModelService;
|
|
41
55
|
}
|
|
42
56
|
/**
|
|
43
57
|
* Represents a Model subclass constructor returned by {@link Model.extend}.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export function registerDefaultDirectives(): object;
|
package/package.json
CHANGED
|
@@ -1,23 +1,26 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@base-framework/base",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0",
|
|
4
4
|
"description": "This is a javascript framework.",
|
|
5
5
|
"main": "./dist/base.js",
|
|
6
6
|
"module": "./dist/base.js",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"sideEffects": [
|
|
9
|
-
"**/default-directives.js",
|
|
10
9
|
"./dist/base.js",
|
|
11
|
-
"./dist/modules
|
|
12
|
-
"./dist/
|
|
10
|
+
"./dist/modules/ajax.js",
|
|
11
|
+
"./dist/modules/component.js",
|
|
12
|
+
"./dist/modules/router.js"
|
|
13
13
|
],
|
|
14
14
|
"scripts": {
|
|
15
15
|
"build": "node ./esbuild.js && tsc",
|
|
16
|
-
"
|
|
16
|
+
"release:guard": "node ./scripts/publish-guard.js",
|
|
17
|
+
"prepublishOnly": "node ./scripts/publish-guard.js && npm run build",
|
|
17
18
|
"test": "vitest",
|
|
18
19
|
"test:run": "vitest run",
|
|
19
20
|
"size": "node ./scripts/size-report.js",
|
|
20
21
|
"size:check": "node ./scripts/size-report.js --check",
|
|
22
|
+
"cache:check": "node ./scripts/chunk-stability.js",
|
|
23
|
+
"sideeffects:check": "node ./scripts/side-effects-check.js",
|
|
21
24
|
"bench": "node --expose-gc ./scripts/bench.js"
|
|
22
25
|
},
|
|
23
26
|
"keywords": [
|
|
@@ -47,7 +50,8 @@
|
|
|
47
50
|
"readme.md",
|
|
48
51
|
"dist",
|
|
49
52
|
"copilot.md",
|
|
50
|
-
"!dist/**/*.map"
|
|
53
|
+
"!dist/**/*.map",
|
|
54
|
+
"!dist/meta.json"
|
|
51
55
|
],
|
|
52
56
|
"exports": {
|
|
53
57
|
"./package.json": "./package.json",
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{b as k}from"./chunk-AO5L25YQ.js";import{a as pt,b as mt,c as gt,d as yt,e as C,f as y,g as A}from"./chunk-FXJIFTW5.js";import{a as L,b as ut}from"./chunk-ILT4B3VY.js";import{a as dt,c as I,d as ft,f as M}from"./chunk-E3C6NOMV.js";import{b as f,c as p}from"./chunk-R5DHGQZV.js";var q={items:new Map,add(s,t){return this.items.set(s,t),this},get(s){return this.items.get(s)??null}};f.addType("components",s=>{if(!s)return;let t=s.component;!t||!t.isUnit||(t.persistToken&&t.parent&&t.parent.removePersistedChild(t.persistToken),t.rendered===!0&&(t.prepareDestroy(),t.cleanUpAfterDestroy()))});var me=0,W=class{constructor(t,e,r){this.isUnit=!0,this.data=null,this.persist=null,this.nest=null,this.state=null,this.panel=null,this.parent=null,this.unitType=null,this._classId,this.id="",this.cached=[],this.init();let n,i;if(t==null)n={},i=[];else{let o=typeof t;o==="string"||o==="number"?(n={},i=[{tag:"text",textContent:t}]):Array.isArray(t)?(n={},i=t):(n=t||{},i=typeof e=="string"?[{tag:"text",textContent:e}]:e)}this.setupProps(n),this.children=i||[],this.persistedChildren={},this.persistedCount=0,this.onCreated(),this.rendered=!1,this.container=null}init(){this.id="cp-"+me++,this.unitType=this._classId||this.constructor.name.toLowerCase()}declareProps(){}addPersistedChild(t){let e=t.key,r=t.cache,n;r!=null&&e!=null?n="pk:"+r+":"+e:r!=null?n="pk:"+r:e!=null?n="pk:"+e:n="pc"+this.persistedCount++;let i=this.persistedChildren[n];return i&&t.unitType===i.unitType&&t.resumeScope(i),t.persistToken=n,this.persistedChildren[n]=t,n}removePersistedChild(t){this.rendered&&(!t||!this.persistedChildren[t]||delete this.persistedChildren[t])}setupProps(t){if(this.declareProps(),!(!t||typeof t!="object"))for(let e in t)Object.prototype.hasOwnProperty.call(t,e)&&(this[e]=t[e],e==="data"&&(this._externalData=!0))}getChildScope(){return this}getParentContext(){return this.parent?this.parent.getContext():null}setupContext(){if(this._contextResumed)return;let t=this.getParentContext(),e=this.setContext(t);if(e){this.context=e;return}this.context=t,this.setupAddingContext()}setupAddingContext(){let t=this.context,e=this.addContext(t);if(!e)return;let r=e[0];r&&(this.addingContext=!0,this.contextBranchName=r,this.addContextBranch(r,e[1]))}addContextBranch(t,e){this.context??={},this.context[t]=e}setContext(t){return null}addContext(t){return null}removeContext(){this.addingContext&&this.removeContextBranch(this.contextBranchName)}removeContextBranch(t){t&&delete this.context[t]}getContext(){return this.context}onCreated(){}render(){return{}}_cacheRoot(t){return t&&(t.id||(t.id=this.getId()),t.cache="panel",t)}_createLayout(){return this.render()}prepareLayout(){let t=this._createLayout();return this._cacheRoot(t)}afterBuild(){f.add(this.panel,"components",{component:this}),this.rendered=!0,this.afterLayout()}afterLayout(){this.afterSetup()}if(t,e){return t?e||t:null}map(t,e){let r=[];if(!t||t.length<1)return r;for(let n=0,i=t.length;n<i;n++){let o=e(t[n],n);r.push(o)}return r}removeAll(t){return M.removeAll(t)}getId(t){let e=this.id;return typeof t=="string"&&(e+="-"+t),e}cacheEle(t,e){e&&(this[e]=t,this.cached.push(e))}initialize(){this.setupContext(),this.beforeSetup()}beforeSetup(){}afterSetup(){}setup(t){this.setContainer(t),this.initialize()}setContainer(t){this.container=t}_remove(){this.prepareDestroy();let t=this.panel;t&&M.removeElement(t),this.cleanUpAfterDestroy()}cleanUpAfterDestroy(){this.panel=null,this.container=null;let t=this.cached;for(let e=0,r=t.length;e<r;e++)this[t[e]]=null;this.cached=[],this.persist!==!0&&(this.persistedChildren={},this.persistToken=null)}prepareDestroy(){this.persistedCount=0,this.rendered=!1;try{this.beforeDestroy()}catch(t){console.error("Error in beforeDestroy:",t)}this.removeContext(),this.data&&this.persist!==!0&&typeof this.data.unlink=="function"&&this.data.unlink()}beforeDestroy(){}destroy(){this._remove()}};var E=class{static resume(t,e){if(t._externalData){this._resumeExternal(t,e);return}this._resumeOwned(t,e)}static refresh(t){let e=t.setData();e&&t.data&&t.data.set(e.stage),this.refreshContext(t)}static refreshContext(t){let e=t.context;if(!e||!e.data)return;let r=t.getParentContext();if(!r||!r.data)return;let n=r.data.stage,i=e.data.stage,o=null;for(let a in n){if(!Object.prototype.hasOwnProperty.call(n,a))continue;let l=n[a];l!==i[a]&&(o===null&&(o={}),o[a]=l)}o!==null&&(typeof e.data._silentSet=="function"?e.data._silentSet(o):e.data.set(o))}static _resumeExternal(t,e){let r=t.setData();if(!r){t.data=e;return}if(e&&e.stage){let n=e._retainState||r._retainState,i=!n&&(e._refreshState||r._refreshState),o=this._buildExternalUpdates(e.stage,r.stage,n,i);L.isEmpty(o)||r._silentSet(o)}typeof r.flushPending=="function"&&r.flushPending(),t.data=r}static _buildExternalUpdates(t,e,r,n){let i={};for(let o in t){if(!Object.prototype.hasOwnProperty.call(t,o))continue;if(n){Object.prototype.hasOwnProperty.call(e,o)||(i[o]=t[o]);continue}let a=t[o];!r&&a==null||a!==e[o]&&(i[o]=a)}return i}static _resumeOwned(t,e){if(!t.data){t.data=e;return}if(e&&e._retainState){t.data=e;return}if(e&&e.stage){let r=e._refreshState||t.data._refreshState,n=this._buildOwnedUpdates(e.stage,t.data.stage,r);L.isEmpty(n)||t.data._silentSet(n)}t.data&&typeof t.data.flushPending=="function"&&t.data.flushPending()}static _buildOwnedUpdates(t,e,r){let n={};for(let i in t){if(!Object.prototype.hasOwnProperty.call(t,i))continue;if(r){Object.prototype.hasOwnProperty.call(e,i)||(n[i]=t[i]);continue}let o=t[i];o!=null&&o!==e[i]&&(n[i]=o)}return n}};var N=class{constructor(){this.events=[]}addEvents(t){let e=t.length;if(!(e<1))for(let r=0;r<e;r++){let n=t[r];this.on(n[0],n[1],n[2],n[3])}}on(t,e,r,n){p.on(t,e,r,n),this.events.push({event:t,obj:e,callBack:r,capture:n})}off(t,e,r,n){p.off(t,e,r,n);let i,o=this.events;for(let a=0,l=o.length;a<l;a++)if(i=o[a],i.event===t&&i.obj===e&&i.callBack===r&&i.capture===n){o.splice(a,1);break}}set(){let t=this.events;for(let e=0,r=t.length;e<r;e++){let n=t[e];p.on(n.event,n.obj,n.callBack,n.capture)}}unset(){let t=this.events;for(let e=0,r=t.length;e<r;e++){let n=t[e];p.off(n.event,n.obj,n.callBack,n.capture)}}reset(){this.unset(),this.events=[]}};var F=class{constructor(t,e){this.remoteStates=[],this.callBackStates=[];let r=this.convertStates(e);this.addStatesToTarget(t,r)}addStates(t,e){let r=this.convertStates(e);this.addStatesToTarget(t,r)}createState(t,e,r,n){return{action:t,state:e,callBack:r,targetId:n,token:null,callBackToken:null}}convertStates(t){let e=[];for(let r in t){if(!Object.prototype.hasOwnProperty.call(t,r))continue;if(r==="remotes"){this.setupRemoteStates(t[r],e);continue}let n=null,i=null,o=t[r];o&&typeof o=="object"&&(i=o.callBack,n=o.id||o.targetId,o=o.state),e.push(this.createState(r,o,i,n))}return e}setupRemoteStates(t,e){for(let r=0,n=t.length;r<n;r++){let i=t[r];if(i)for(let o in i){if(!Object.prototype.hasOwnProperty.call(i,o)||o==="id")continue;let a=null,l=i[o],c=l!==null?l:void 0;c&&typeof c=="object"&&(a=c.callBack,c=c.state),e.push(this.createState(o,c,a,i.id))}}}removeRemoteStates(t){let e=this.remoteStates;e&&this.removeActions(t,e)}removeLocalStates(t){let e=this.callBackStates;if(e)for(let r=0,n=e.length;r<n;r++){let i=e[r];i.callBackToken&&(t.off(i.action,i.callBackToken),i.callBackToken=null)}}removeActions(t,e){if(!(e.length<1))for(let r=0,n=e.length;r<n;r++){let i=e[r];i.token&&this.unbindRemoteState(t,i.token),i.targetId&&k.remove(i.targetId,i.action,i.token)}}restore(t){k.restore(t.id,t);let e=this.callBackStates;if(e)for(let n=0,i=e.length;n<i;n++){let o=e[n];o.callBackToken=t.on(o.action,o.callBack)}let r=this.remoteStates;if(r)for(let n=0,i=r.length;n<i;n++){let o=r[n];o.token=this.bindRemoteState(t,o.action,o.targetId)}}bindRemoteState(t,e,r){let n=k.getTarget(r);return t.link(n,e)}unbindRemoteState(t,e){t.unlink(e)}addStatesToTarget(t,e){let r=this.remoteStates;for(let n=0,i=e.length;n<i;n++){let o=e[n],a=this.addAction(t,o);o.targetId&&(o.token=a,r.push(o))}}addAction(t,e){let r,n=e.action,i=e.targetId;i&&(r=this.bindRemoteState(t,n,i)),typeof e.state<"u"&&t.addAction(n,e.state);let o=e.callBack;return typeof o=="function"&&(e.callBackToken=t.on(n,o),this.callBackStates.push(e)),r||null}};var x=class extends W{constructor(t,e,r){super(t,e,r),this.isComponent=!0,this.stateResumed=!1,this.stateTargetId=null,this._externalData=this._externalData??!1,this._setupData()}setData(){return null}_setupData(){if(this.data)return;let t=this.setData();t&&(this.data=t)}resumeScope(t){if(this._resumeData(t.data),this.state=t.state,this.stateHelper=t.stateHelper,this.persistedChildren=t.persistedChildren,t.context){let e=t.context.data;e&&e._refreshState===!0&&e._retainState!==!0||(this.context=t.context,this._contextResumed=!0)}this.id=t.id,this._refreshContextData()}_resumeData(t){E.resume(this,t)}_refreshData(){E.refresh(this)}_refreshContextData(){E.refreshContext(this)}initialize(){this.setupContext(),this.addStates(),this.beforeSetup()}afterLayout(){this.addEvents(),this.afterSetup()}setupStateTarget(t){let e=t||this.stateTargetId||this.id;this.state=k.attach(String(e))}setupStates(){return{}}addStates(){let t=this.state;if(t){this.stateResumed=!0,this.stateHelper?.restore(t);return}let e=this.setupStates();L.isEmpty(e)||this.setStateHelper(e)}setStateHelper(t={}){this.state||(this.setupStateTarget(),this.stateHelper=new F(this.state??{},t))}addState(t){!this.stateHelper||this.stateResumed===!0||this.stateHelper.addStates(this.state,t)}removeStates(){let t=this.state;if(!t)return;let e=this.stateHelper;e&&(e.removeRemoteStates(t),e.removeLocalStates(t)),k.detach(String(t.id)),this.stateResumed=!1}onFlush(t){let e=this.data??this?.context?.data??null;e&&e.onFlush(t)}setEventHelper(){this.events||(this.events=new N)}setupEvents(){return[]}addEvents(){let t=this.setupEvents();t.length<1||(this.setEventHelper(),this.events&&this.events.addEvents(t))}removeEvents(){let t=this.events;t&&t.reset()}prepareDestroy(){this.persistedCount=0,this.rendered=!1;try{this.beforeDestroy()}catch(t){console.error("Error in beforeDestroy:",t)}this.removeEvents(),this.removeStates(),this.removeContext(),this.data&&this.persist!==!0&&this.data.unlink()}};var xt={created:"onCreated",setStates:"setupStates",state:"setupStates",events:"setupEvents",before:"beforeSetup",render:"render",after:"afterSetup",destroy:"beforeDestroy"},St=(s,t)=>typeof s!="function"&&t==="setupStates"?()=>s:s;var rt=(s,t)=>{if(!s)return t;let e=Object.keys(s);for(let r=0,n=e.length;r<n;r++){let i=e[r],o=s[i],a=xt[i]||i;t[a]=St(o,a)}return t},ge=s=>rt(s,{}),ye=0,vt=(s,t)=>{class e extends s{}return Object.assign(e.prototype,t),e.prototype._classId="jot"+ye++,e},B=(s,t=x)=>{s||(s={});let e,r=typeof s;return r==="object"&&s.render?(e=ge(s),vt(t,e)):(e={render:r==="function"?s:()=>s},vt(t,e))};var st=(s,t)=>({attr:s,directive:t});var S=(s,t)=>({key:s,value:t});var wt=(s,t,e,r)=>({tag:s,attr:t,directives:e,children:r});var Ct=null,xe=()=>Ct||(Ct=q.get("watch")),v=class{static getTag(t){return t.tag||"div"}static setupChildren(t){t.nest&&(t.children=t.nest,delete t.nest)}static setElementContent(t,e,r,n){return t==="text"?(n.push({tag:"text",textContent:e}),!0):t==="html"||t==="innerHTML"?(r.push(S("innerHTML",e)),!0):!1}static setTextAsWatcher(t,e,r){t.push(st(S(e,A.getWatcherSettings(r,ft(e))),xe()))}static setButtonType(t,e,r){if(t==="button"){let n=e.type||"button";r.push(S("type",n))}}static parse(t,e){let r=[],n=[],i=t.tag||"div";i==="button"&&r.push(S("type",t.type||"button"));let o=[],a,l;for(let c in t){if(!Object.prototype.hasOwnProperty.call(t,c)||c==="tag"||(a=t[c],a==null))continue;if(c==="children"||c==="nest"){if(Array.isArray(a))for(let d=0;d<a.length;d++)o.push(a[d]);else o.push(a);continue}if((l=q.get(c))!==null){n.push(st(S(c,a),l));continue}let h=typeof a;if(h==="object"){if(A.isWatching(a)){this.setTextAsWatcher(n,c,a);continue}o.push(a);continue}if(h==="function"){let d=a,m=function(g){d.call(this,g,e)};m.originalCallback=d,r.push(S(c,m));continue}if(h==="string"&&a.includes("[[")){this.setTextAsWatcher(n,c,a);continue}if(c==="text"){o.push({tag:"text",textContent:a});continue}if(c==="html"||c==="innerHTML"){r.push(S("innerHTML",a));continue}r.push(S(c,a))}return wt(i,r,n,o)}};var D=class{build(t,e,r){}setupComponent(t,e,r){let n=r?.getChildScope();t.parent=n,n&&n.persist===!0&&t.persist!==!1&&(t.persist=!0,t.parent.addPersistedChild(t)),t.cache&&n&&(n[t.cache]=t),t.setup(e)}buildComponent(t){let e=t.prepareLayout(),r=this.build(e,t.container,t);return t.afterBuild(),t.component&&typeof t.onCreated=="function"&&t.onCreated(t),r}createComponent(t,e,r){return this.setupComponent(t,e,r),this.buildComponent(t),t}setDirectives(t,e,r){}removeNode(t){}removeAll(t){}};var Se=s=>{for(let e in s)if(e!=="tag"&&e!=="textContent")return!1;let t=s.textContent;return typeof t=="string"?t.indexOf("[[")===-1:typeof t!="object"},Q=class extends D{build(t,e,r){let n=y.createDocFragment();if(Array.isArray(t))for(let i=0,o=t.length;i<o;i++)this.buildElement(t[i],n,r);else this.buildElement(t,n,r);return e&&typeof e=="object"&&e.appendChild(n),n}buildElement(t,e,r){if(t){if(t.isUnit===!0){this.createComponent(t,e,r);return}this.createElement(t,e,r)}}createElement(t,e,r){if(t.tag==="text"&&Se(t)){let c=t.textContent;y.createText(c??"",e);return}let n=r?.getChildScope();if(t.data||t.state){this.createTempComponent(t,e,n);return}let i=v.parse(t,n),o=this.createNode(i,e,n);this.cache(o,t.cache,r);let a=i.children;for(let c=0,h=a.length;c<h;c++){let d=a[c];d!==null&&this.buildElement(d,o,r)}let l=i.directives;l.length&&this.setDirectives(o,l,n)}createTempComponent(t,e,r){let n={cache:t.cache,key:t.key,persist:t.persist,_externalData:!0,setData:()=>t.data,...rt(t.methods||{},{}),render(){return{...t,data:null,state:null,methods:null,key:null,persist:null}}};t.state&&(n.setupStateTarget=function(o){this.state=t.state});let i=new x(n);this.createComponent(i,e,r)}setDirectives(t,e,r){for(let n=0,i=e.length;n<i;n++)this.handleDirective(t,e[n],r)}handleDirective(t,e,r){e.directive(t,e.attr.value,r)}cache(t,e,r){r&&e&&r.cacheEle(t,e)}createNode(t,e,r){let n=t.tag;if(n==="text"){let i=t.attr[0],o=i?i.value:"";return y.createText(o,e)}else if(n==="comment"){let i=t.attr[0],o=i?i.value:"";return y.createComment(o,e)}return y.create(n,t.attr,e,r)}removeNode(t){y.removeElement(t)}removeAll(t){y.removeAll(t)}};var ve=new Set(["area","base","br","col","embed","hr","img","input","link","meta","source"]),we=/[&<>"]/,nt=s=>{let t=typeof s=="string"?s:String(s);return we.test(t)?t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,"""):t},O=class{static create(t,e=[],r=""){let n="",i="";for(let o=0,a=e.length;o<a;o++){let l=e[o],c=l.key,h=l.value;if(c==="text"||c==="textContent"){n+=nt(h);continue}if(c==="html"||c==="innerHTML"){n+=h;continue}if(typeof h=="function")continue;let d=c+'="'+nt(h)+'"';i?i+=" "+d:i=d}return ve.has(t)?"<"+t+" "+i+" />":"<"+t+" "+i+">"+n+r+"</"+t+">"}static createText(t){return nt(t)}static createComment(t){return"<!-- "+t+" -->"}};var z=class extends D{build(t,e,r){if(Array.isArray(t)){let n="";for(let i=0,o=t.length;i<o;i++)n+=this.buildElement(t[i],r);return n}return this.buildElement(t,r)}createComponent(t,e,r){return this.setupComponent(t,e,r),this.buildComponent(t)}buildElement(t,e){return t?t.isUnit===!0?this.createComponent(t,{},e):this.createElement(t,e):""}createElement(t,e){let r=v.parse(t,e),n=r.children,i="";for(let o=0,a=n.length;o<a;o++){let l=n[o];l!==null&&(i+=this.buildElement(l,e))}return this.createNode(r,i)}createNode(t,e){let r=t.tag;if(r==="text"){let n=t.attr[0],i=n?n.value:"";return O.createText(i)}else if(r==="comment"){let n=t.attr[0],i=n?n.value:"";return O.createComment(i)}return O.create(r,t.attr,e)}removeAll(t){}};var j=class{static browserIsSupported(){return typeof window<"u"&&typeof document=="object"}static setup(){return this.browserIsSupported()?new Q:new z}};var T=j.setup(),Ce=s=>typeof s=="object"&&s.isUnit===!0,ke=s=>{let t=B(s);return t?new t:null},u=class{static render(t,e,r){return!t||(Ce(t)||(t=ke(t)),!t)?null:T.createComponent(t,e,r)}static build(t,e,r){return T.build(t,e,r)}static rebuild(t,e,r){return T.removeAll(e),this.build(t,e,r)}static setDirectives(t,e,r){T.setDirectives(t,e,r)}static createNode(t,e,r){return T.createNode(t,e,r)}static removeNode(t){T.removeNode(t)}static removeAll(t){T.removeAll(t)}};ut.augment({buildLayout(s,t,e){u.build(s,t,e)}});var it=[],Te=s=>it.indexOf(s)!==-1,be=s=>({tag:"script",src:s.src,async:!1,load(t){it.push(s.src);let e=s.load;e&&e()}}),Pe=s=>({tag:"link",rel:"stylesheet",type:"text/css",href:s.src,load(t){it.push(s.src);let e=s.load;e&&e()}}),$=class{constructor(t){this.percent=0,this.loaded=0,this.total=0,this.callBack=t||null}add(t){this.total++;let e,r=this.update.bind(this);t.indexOf(".css")!==-1?e=Pe({load:r,src:t}):e=be({load:r,src:t}),u.build(e,document.head)}addFiles(t){t&&t.forEach(e=>{Te(e)||this.add(e)})}update(){if(this.updateProgress()<100)return;let e=this.callBack;e&&e()}updateProgress(){return++this.loaded,this.percent=Math.floor(this.loaded/this.total*100)}};var Re=s=>s?typeof s?.prototype?.constructor=="function":!1,b=class{static process(t,e){let r=t.default;return r?e.callback?e.callback(r):(Re(r)?r=new r:r=r(),r.isUnit===!0&&(r.route=e.route,e.persist&&(r.persist=!0)),r):null}static render(t,e,r){let n=u.build(t,null,r),i=n.firstChild||t?.panel;return e.after(n),i}};var Y=class{static load(t,e,r){return t.then(n=>(e&&e(n),n)).catch(n=>{console.error("Error loading module:",n),r&&r(n)})}};var Ie=s=>({tag:"comment",textContent:"import placeholder",onCreated:s.onCreated}),P=new pt(100),Ae=s=>{if(P.has(s)){let r=P.get(s);return r&&typeof r.then!="function"?Promise.resolve(r):r}let t=typeof s,e;if(t==="string")e=import(s);else if(t==="function")e=s();else return s;return e.then(r=>{P.set(s,r)}).catch(()=>{P.delete(s)}),P.set(s,e),e},Ee=s=>{if(!P.has(s))return null;let t=P.get(s);return t&&typeof t.then=="function"?null:t||null},kt=B({declareProps(){this.loaded=!1,this.errorRoot=null,this.generation=0},render(){return Ie({onCreated:s=>{if(this.src){if(this.layout){this.layoutRoot=b.render(this.layout,this.panel,this.parent);return}if(this.depends){new $(()=>{this.loadAndRender(s)}).addFiles(this.depends);return}this.loadAndRender(s)}}})},loadAndRender(s){let t=this.generation,e=Ee(this.src);if(e){this.renderModule(s,e);return}Y.load(Ae(this.src),r=>{t===this.generation&&this.renderModule(s,r)},r=>{t===this.generation&&(this.loaded=!1,this.renderError(s,r))})},renderError(s,t){let e=()=>this.retry(s),r=this.fallback,n=typeof r=="function"?r(t,e):r||{class:"base-import-error",children:[{tag:"span",text:"Failed to load content."},{tag:"button",type:"button",text:"Retry",click:e}]};n&&(this.errorRoot=b.render(n,s,this.parent))},retry(s){this.removeErrorLayout(),this.loadAndRender(s)},removeErrorLayout(){this.errorRoot&&(u.removeNode(this.errorRoot),this.errorRoot=null)},renderModule(s,t){this.loaded=!0;let e=this.layout||b.process(t,{callback:this.callback,route:this.route,persist:this.persist});this.layout=e,this.layoutRoot=b.render(e,s,this.parent)},shouldUpdate(s){return this.updateLayout===!0?!0:this.updateLayout=s&&s.isUnit&&typeof s.update=="function"},updateModuleLayout(s){let t=this.layout;this.shouldUpdate(t)&&t&&t.update(s)},update(s){this.loaded===!0&&this.updateModuleLayout(s)},destroy(){this.generation++,this.removeErrorLayout(),this.layoutRoot&&(u.removeNode(this.layoutRoot),this.persist!==!0&&(this.layoutRoot=null,this.layout=null,this.loaded=!1,this.updateLayout=!1))}});var Tt=s=>{let t=typeof s;return(t==="string"||t==="function"||s instanceof Promise)&&(s={src:s}),new kt(s)};var Be=0,_=class{constructor(t){this.router=t,this.locationId="base-app-router-"+Be++,this.callBack=this.check.bind(this)}setup(){return this.addEvent(),this}check(t){}getScrollPosition(){return{x:window.scrollX,y:window.scrollY}}scrollTo(t){window.scrollTo(t.x,t.y)}addEvent(){return this}};var Pt=typeof navigator<"u"&&/iPad|iPhone|iPod/.test(navigator.userAgent||"")&&!window.MSStream,bt=()=>{Pt&&requestAnimationFrame(()=>requestAnimationFrame(()=>{let s=window.scrollX,t=window.scrollY;window.scrollTo(0,t+1),document.documentElement.offsetHeight,window.scrollTo(s,t)}))},J=class extends _{addEvent(){return p.on("popstate",window,this.callBack),Pt&&(this.pageShowCallBack=this.onPageShow.bind(this),p.on("pageshow",window,this.pageShowCallBack)),this}removeEvent(){return p.off("popstate",window,this.callBack),this.pageShowCallBack&&p.off("pageshow",window,this.pageShowCallBack),this}onPageShow(t){t.persisted&&bt()}check(t){let e=t.state;if(!e||e.location!==this.locationId)return!1;t.preventDefault(),t.stopPropagation(),this.router.checkActiveRoutes(e.uri);let r=e.scrollPosition;r&&this.scrollTo(r),bt()}createState(t,e={}){let r=this.getScrollPosition();return e=e===null?{}:e,{location:this.locationId,...e,scrollPosition:r,uri:t}}addState(t,e,r=!1){let n=window.history,i=n.state;if(i&&i.uri===t)return this;!r&&i&&i.location===this.locationId&&(i.scrollPosition=this.getScrollPosition(),n.replaceState(i,"",window.location.href));let o=this.createState(t,e);return r||(o.scrollPosition={x:0,y:0}),n[r===!1?"pushState":"replaceState"](o,null,t),this}};var K={removeSlashes(s){return typeof s!="string"?"":(s[0]==="/"&&(s=s.substring(1)),s[s.length-1]==="/"&&(s=s.substring(0,s.length-1)),s)},getHashUri(s){if(typeof s!="string")return"";let t=s.indexOf("#");return t===-1?"":s.substring(t+1)}};var V=class extends _{addEvent(){return p.on("hashchange",window,this.callBack),this}removeEvent(){return p.off("hashchange",window,this.callBack),this}check(t){this.router.checkActiveRoutes(K.getHashUri(t.newURL))}addState(t,e,r){return window.location.hash=t,this}};var X=class{static browserIsSupported(){return typeof window=="object"&&"history"in window&&"pushState"in window.history}static setup(t){return this.browserIsSupported()?new J(t).setup():new V(t).setup()}};var ot=class extends x{getChildScope(){return this.parent}},Rt=s=>B(s,ot);var Z=class{constructor(t,e){this.route=t,this.template=e.component,this.component=null,this.hasTemplate=!1,this.setup=!1,this.container=e.container,this.persist=e.persist,this.parent=e.parent}focus(t){this.setup===!1&&(this.route&&typeof this.route.flushPending=="function"&&this.route.flushPending(),this.create()),this.update(t)}setupTemplate(){let e=typeof this.template;e==="function"?this.initializeComponent():e==="object"&&this.initializeTemplateObject(),this.hasTemplate=!0}initializeComponent(){this.template=this.template(),this.initializeTemplateObject()}transferSettings(t){this.persist=this.persist&&t.persist!==!1,Object.assign(t,{route:this.route,persist:this.persist}),this.component=t}initializeTemplateObject(){let t=this.template;if(!t)return;t.isUnit||(this.template=new(Rt(t)));let e=this.template;this.transferSettings(e)}create(){if(this.setupTemplate(),!this.hasTemplate)return;this.setup=!0;let t=this.component;u.render(t,this.container,this.parent)}remove(){if(this.setup!==!0)return;this.setup=!1;let t=this.component;t&&(typeof t.destroy=="function"&&t.destroy(),this.component=null)}update(t){let e=this.component;e&&typeof e.update=="function"&&e.update(t)}};var It=s=>{if(!s.length)return null;let t={};for(let e=0,r=s.length;e<r;e++)t[s[e]]=null;return t},At=s=>{let t=[];if(!s)return t;let e=/[*?]/g;s=s.replace(e,"");let r=/:(.[^./?&($]+)\?*/g,n=s.match(r);if(n===null)return t;for(let i=0,o=n.length;i<o;i++){let a=n[i];a&&t.push(a.replace(":",""))}return t};var De=/(\/):[^/(]*?\?/g,Oe=/\//g,_e=/(\?\/+\*?)/g,Ue=/(:[^/?&($]+)/g,He=/(\*)/g,Le=s=>s.replace(De,t=>t.replace(Oe,"(?:$|/)")),Me=s=>(s=s.replace(_e,"?/*"),s.replace(Ue,t=>t.indexOf(".")<0?"([^/|?]+)":"([^/|?]+.*)")),qe=s=>s.replace(He,".*"),Ge=(s,t)=>s+=t[t.length-1]==="*"?"":"$",Et=s=>{if(!s)return"";let t=s;return t=Le(t),t=Me(t),t=qe(t),t=Ge(t,s),t};var We=0,Bt=(s,t="")=>{let e=s||"",r=typeof t=="string"&&t?t:e,n=null,i=[],o=r.match(/#\{([^}]+)\}/);o&&o[1]&&(n=o[1].trim(),r=r.replace(o[0],""),e=e.replace(o[0],""));let a=r.indexOf("?");if(a>-1){let h=r.substring(a+1);if(h.indexOf("=")>-1){let d=h.split("&");for(let g=0,R=d.length;g<R;g++){let H=d[g];if(!H)continue;let[fe,pe=""]=H.split("="),ht=(fe||"").trim();ht&&i.push({key:ht,value:(pe||"").trim()})}r=r.substring(0,a);let m=e.indexOf("?");m>-1&&(e=e.substring(0,m))}}let l=n!==null||i.length>0;return l&&!r&&(e="*"),{uriPath:e,requiredHash:n,requiredQuery:i,hasConditions:l}},Ne=s=>{if(!s)return"";let t=s.indexOf("?"),e=s.indexOf("#"),r=s.length;return t>-1&&(r=t),e>-1&&e<r&&(r=e),s.substring(0,r)},Fe=s=>{if(!s)return"";let t=s.indexOf("#");return t===-1?"":s.substring(t+1)},Qe=s=>{if(!s)return"";let t=s.indexOf("?");if(t===-1)return"";let e=s.indexOf("#",t);return e===-1?s.substring(t+1):s.substring(t+1,e)},tt=class extends gt{constructor(t,e){let r=t.baseUri,i=Bt(r,t.rawUri).uriPath,o=At(i),a=It(o),l=super(a);return this.uri=r,this.matchUri=i,this.paramKeys=o,this.titleCallBack=e,this.setupRoute(t),this.set("active",!1),l}setup(){this.stage={},this.routeId=null,this.uri=null,this.rawUri=null,this.matchUri="",this.uriQuery=/$^/,this.controller=null,this.paramKeys=[],this.requiredHash=null,this.requiredQuery=[],this.hasConditions=!1,this.titleCallBack=()=>{},this.path=null,this.referralPath=null,this.params=null,this.callBack=null,this.title=null,this.preventScroll=!1,this.scrollTo=null}setupRoute(t){this.routeId=t.id||"bs-rte-"+We++,this.rawUri=t.rawUri||null,this.path=null,this.referralPath=null;let e=Bt(this.uri,this.rawUri||"");this.matchUri=e.uriPath,this.requiredHash=e.requiredHash,this.requiredQuery=e.requiredQuery,this.hasConditions=e.hasConditions;let r=Et(this.matchUri);this.uriQuery=new RegExp("^"+r),this.params=null,this.setupComponentHelper(t),this.callBack=t.callBack,this.title=t.title,this.preventScroll=t.preventScroll||!1,this.scrollTo=t.scrollTo||null}setTitle(t){this.title=t,this.titleCallBack(this,t)}deactivate(){this.set("active",!1);let t=this.controller;t&&t.remove()}getLayout(t){if(t.component)return t.component;let e=t.import;return e?Tt(e):null}setupComponentHelper(t){let e=this.getLayout(t);if(!e)return;let{container:r,persist:n,parent:i}=t,o={component:e,container:r,persist:n,parent:i},a=mt(this);this.controller=new Z(a,o)}resumeRoute(t){let e=this.controller;e&&(e.container=t)}setPath(t,e){this.path=t,this.referralPath=e}select(){this.set("active",!0);let t=this.stage,e=this.callBack;typeof e=="function"&&e(t);let r=this.controller;r&&r.focus(t);let n=this.path;if(!n)return;let i=n.split("#")[1];i&&this.scrollToId(i)}scrollToId(t){if(!t)return;let e=document.getElementById(t);e&&e.scrollIntoView(!0)}match(t){let e=!1,r=Ne(t),n=this.uriQuery||/$^/,i=r.match(n);return i===null?(this.resetParams(),e):Array.isArray(i)?this.matchConditions(t)?(this.setParams(i,1),e=i,e):(this.resetParams(),!1):e}matchConditions(t){if(!this.hasConditions)return!0;if(this.requiredHash!==null&&Fe(t)!==this.requiredHash)return!1;let e=this.requiredQuery||[];if(e.length>0){let r=Qe(t);if(!r)return!1;let n=new URLSearchParams(r);for(let i=0,o=e.length;i<o;i++){let a=e[i];if(!n.has(a.key)||n.get(a.key)!==a.value)return!1}}return!0}resetParams(){this.stage={}}setParams(t,e=0){if(!Array.isArray(t))return;let r=this.paramKeys;if(!r)return;let n={};for(let i=0,o=r.length;i<o;i++){let a=r[i];typeof a<"u"&&(n[a]=t[i+e])}this.set(n)}getParams(){return this.stage}};var ze=s=>{let t=/\w\S*/;return s.replace(t,e=>e.charAt(0).toUpperCase()+e.substring(1).toLowerCase())},je=s=>s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),$e=(s,t)=>{if(s.indexOf(":")===-1)return s;let e=t.stage;for(let r in e)if(Object.prototype.hasOwnProperty.call(e,r)){let n=new RegExp(":"+je(r),"gi");s=s.replace(n,()=>e[r])}return s},Ye=(s,t)=>t&&(typeof t=="function"&&(t=t(s.stage)),t=$e(t,s),ze(t)),Je=(s,t)=>(t!==""&&(s+=" - "+t),s),Dt=(s,t,e)=>t&&(t=Ye(s,t),Je(t,e));var Ke=()=>typeof window<"u"?window.location:{},at=class{constructor(){this.version="1.0.2",this.baseURI="/",this.title="",this.lastPath=null,this.path=null,this.lastMatchedRoute=null,this.lastScrollGroup=null,this.currentGroupId=null,this.scrollWaitToken=0,this.history=null,this.callBackLink=null,this.location=Ke(),this.routes=[],this.switches=new Map,this.switchCount=0,this.data=new yt({path:""})}setupHistory(){this.history=X.setup(this)}createRoute(t){let e=t.uri||"*";return t.rawUri=e,t.baseUri=this.createURI(e),new tt(t,this.updateTitle.bind(this))}add(t){if(typeof t!="object"){let r=arguments;t={uri:r[0],component:r[1],callBack:r[2],title:r[3],id:r[4],container:r[5]}}let e=this.createRoute(t);return this.addRoute(e),e}addRoute(t){this.routes.push(t),this.checkRoute(t,this.getPath())}resume(t,e){t.resumeRoute(e),this.addRoute(t)}getBasePath(){if(!this.basePath){let t=this.baseURI||"";t[t.length-1]!=="/"&&(t+="/"),this.basePath=t}return this.basePath}createURI(t){let e=this.getBasePath(),r=K.removeSlashes(t);return r=r.replace(/^(?:\.\/)+/,""),r==="."&&(r=""),e+r}getRoute(t){let e=this.routes,r=e.length;if(r>0)for(let n=0;n<r;n++){let i=e[n];if(i.uri===t)return i}return null}getRouteById(t){let e=this.routes,r=e.length;if(r>0)for(let n=0;n<r;n++){let i=e[n];if(i.routeId===t)return i}return!1}removeRoute(t){let e=this.routes,r=e.indexOf(t);r>-1&&e.splice(r,1),this.lastMatchedRoute===t&&(this.lastMatchedRoute=null),t&&typeof t.deactivate=="function"&&t.deactivate()}addSwitch(t){let e=this.switchCount++,r=this.getSwitchGroup(e);for(let n=0,i=t.length;n<i;n++){let o=t[n];if(!o)continue;let a=this.createRoute(o);r.push(a)}return this.checkGroupForRegistration(e,r),e}resumeSwitch(t,e){let r=this.switchCount++,n=this.getSwitchGroup(r);for(let i=0,o=t.length;i<o;i++){let l=t[i].component.route;l.resumeRoute(e),n.push(l)}return this.checkGroupForRegistration(r,n),r}checkGroupForRegistration(t,e){let r=this.scrollIntent,n=this.currentGroupId;this.scrollIntent=null,this.currentGroupId=t,this.checkGroup(e,this.getPath()),this.currentGroupId=n;let i=this.scrollIntent;i&&i.type==="target"&&i.groupId!==null&&i.groupId!==void 0&&(this.lastScrollGroup=i.groupId),this.scrollIntent=r}getSwitchGroup(t){let e=this.switches.get(t);if(e)return e;let r=[];return this.switches.set(t,r),r}removeSwitch(t){this.switches.delete(t)}remove(t){t=this.createURI(t);let e=this.getRoute(t);return e&&this.removeRoute(e),this}setup(t,e){this.baseURI=t||"/",this.updateBaseTag(this.baseURI),this.title=typeof e<"u"?e:"",this.setupHistory(),this.data.path=this.getPath(),this.callBackLink=this.checkLink.bind(this),p.on("click",document,this.callBackLink);let r=this.getEndPoint();return this.navigate(r,null,!0),this}updateBaseTag(t){let e=document.getElementsByTagName("base");e.length&&(e[0].href=t)}getParentLink(t){return t.closest("a")}checkLink(t){if(t.ctrlKey===!0)return!0;let e=t.target.closest("a");if(!e||e.target==="_blank"||e.dataset.cancelRoute)return!0;let r=e.getAttribute("href");if(r!==null){let n=this.baseURI,i=n!=="/"?r.replace(n,""):r,o=e.dataset.replace==="true";return this.navigate(i,null,o),t.preventDefault(),t.stopPropagation(),!1}}reset(){let t=this.routes;for(let e=0,r=t.length;e<r;e++){let n=t[e];n&&typeof n.deactivate=="function"&&n.deactivate()}return this.routes=[],this.switches=new Map,this.switchCount=0,this.lastMatchedRoute=null,this}activate(){return this.checkActiveRoutes(),this}navigate(t,e,r){return t=this.createURI(t),this.history.addState(t,e,r),this.updatePath(),this.activate(),this}updatePath(){let t=this.getPath();this.data.path=t}updateTitle(t){if(!t||!t.title)return this;let e=t.title;return document.title=Dt(t,e,this.title),this}checkActiveRoutes(t){if(this.lastPath=this.path,t=t||this.getPath(),this.path=t,this.updatePath(),this.scrollIntent=null,this.scrollWaitToken++,this.lastMatchedRoute&&this.check(this.lastMatchedRoute,t))this.select(this.lastMatchedRoute);else{let e=this.routes,r=e.length;for(let n=0;n<r;n++){let i=e[n];typeof i>"u"||this.checkRoute(i,t)}}this.checkSwitches(t),this.applyScrollIntent()}checkSwitches(t){let e=this.switches;for(let[r,n]of e.entries())this.currentGroupId=r,this.checkGroup(n,t);this.currentGroupId=null}checkGroup(t,e){let r=t.length;if(!r)return;let n=null;for(let a=0;a<r;a++)if(t[a].get("active")){n=t[a];break}let i=!1;n&&(i=n.match(e)!==!1);let o;for(let a=0;a<r;a++){let l=t[a];if(typeof l>"u")continue;(l===n?i:l.match(e))!==!1&&o===void 0&&l.controller&&(o=l)}if(!o){n&&n!==t[0]&&n.deactivate(),this.select(t[0],!0);return}this.select(o),n&&n!==o&&n.deactivate();for(let a=0;a<r;a++){let l=t[a];l&&l!==o&&l!==n&&l.deactivate()}}checkRoute(t,e){let r=this.check(t,e);return r!==!1?(this.select(t),this.lastMatchedRoute=t):t.deactivate(),r}check(t,e){return t?(e=e||this.getPath(),t.match(e)!==!1):!1}select(t,e){t&&(t.setPath(this.path,this.lastPath),t.select(),this.updateTitle(t),e!==!0&&(t.scrollTo?this.scrollIntent={type:"target",selector:t.scrollTo,groupId:this.currentGroupId}:t.preventScroll!==!0&&!this.scrollIntent&&(this.scrollIntent={type:"top"})))}applyScrollIntent(){let t=this.scrollIntent;if(this.scrollIntent=null,!t)return;if(t.type==="top"){this.lastScrollGroup=null,this.checkToScroll(),this.reassertScrollTop();return}if(t.type!=="target")return;let e=t.groupId!==null&&t.groupId!==void 0,r=e&&this.lastScrollGroup===t.groupId;r||(typeof window<"u"&&window.scrollTo(0,0),this.reassertScrollTop()),this.lastScrollGroup=e?t.groupId:null,r&&this.scrollToTarget(t.selector)}reassertScrollTop(){if(typeof window>"u"||typeof requestAnimationFrame>"u")return;let t=++this.scrollWaitToken;requestAnimationFrame(()=>{t===this.scrollWaitToken&&(window.scrollY>0||window.pageYOffset>0)&&window.scrollTo(0,0)})}scrollToTarget(t){if(typeof t!="string"||typeof document>"u")return;let e=a=>{let l=window.getComputedStyle(a),c=l.position==="sticky",h;if(c){let g=a.style.position;a.style.position="static",h=a.getBoundingClientRect().top+window.scrollY,a.style.position=g}else h=a.getBoundingClientRect().top+window.scrollY;let d=c&&parseFloat(l.top)||0,m=h-d;window.scrollY>m&&window.scrollTo(0,m)};if(typeof requestAnimationFrame>"u"){let a=document.querySelector(t);a&&e(a);return}let r=++this.scrollWaitToken,n=30,i=0,o=()=>{if(r!==this.scrollWaitToken)return;let a=document.querySelector(t);if(a){e(a);return}++i<n&&requestAnimationFrame(o)};requestAnimationFrame(o)}checkToScroll(){this.shouldScrollToTop()&&window.scrollTo(0,0)}cleanPath(t){return t?t.split("?")[0].split("#")[0]:"/"}shouldScrollToTop(){let t=this.cleanPath(this.getPath()),r=this.cleanPath(this.lastPath).split("/"),n=t.split("/");if(r.length!==n.length)return!0;let i=r[r.length-1],o=n[n.length-1];return i!==o}getEndPoint(){return this.getPath().replace(this.baseURI,"")||"/"}destroy(){typeof this.callBackLink=="function"&&p.off("click",document,this.callBackLink);let t=this.history;t&&typeof t.removeEvent=="function"&&t.removeEvent()}getPath(){let t=this.location,e=this.path=t.pathname;return this.history.type==="hash"?t.hash.replace("#",""):e+t.search+t.hash}},w=new at;var Ot=(s,t)=>({attr:s,value:t}),Ve=(s,t)=>{if(!t.startsWith(s))return!1;let e=t[s.length];return e===void 0||e==="/"||e==="#"||e==="."||e==="?"},ct=class extends x{beforeSetup(){this.selectedClass=this.activeClass||"active"}render(){let t=this.href,e=this.text,r=this.setupWatchers(t,e);return{tag:"a",class:this.class||this.className||null,onState:["selected",{[this.selectedClass]:!0}],href:this.getString(t),text:this.getString(e),nest:this.nest||this.children,dataStateSet:this.dataSet,"data-replace":this.replace?"true":null,watch:r}}getLinkPath(){return this?.panel?.pathname||null}getString(t){let e=typeof t;return e!=="object"&&e!=="undefined"?t:null}setupWatchers(t,e){let r=this.exact===!0,n=w.data,i=[];t&&typeof t=="object"&&i.push(Ot("href",t)),e&&typeof e=="object"&&i.push(Ot("text",e));let o=null,a="",l="";return i.push({value:["[[path]]",n],callBack:(c,h)=>{if(typeof h.pathname>"u")return;let d=h.getAttribute("href");if(d!==o){o=d;let g=h.pathname+h.search+h.hash;a=g,l=h.hash||h.search?g:h.pathname}let m=r?c===a:Ve(l,c);this.update(m)}}),i}setupStates(){return{selected:!1}}update(t){this.state&&(this.state.selected=t)}};var _t=(s,t,e=null)=>{if(!s)return;let r=null,n=!1,i=()=>{n||(n=!0,r&&(clearTimeout(r),r=null),p.off("animationend",s,o),s&&s.classList.remove(t),e&&e())},o=a=>{a.target===s&&i()};p.on("animationend",s,o),requestAnimationFrame(()=>{if(!s){i();return}s.classList.add(t);try{let a=window.getComputedStyle(s),l=parseFloat(a.animationDuration)*1e3||1e3,c=parseFloat(a.animationDelay)*1e3||0;r=setTimeout(i,l+c+100)}catch{r=setTimeout(i,1e3)}})},Ut=(s,t,e)=>{_t(s,t)},Ht=(s,t,e)=>{let r=()=>{s&&s.remove&&s.remove()};Xe(s,()=>_t(s,t,r),e)};f.addType("manual-destroy",s=>{if(!s)return!1;s.callBack(s.ele,s.parent)});var Xe=(s,t,e)=>{f.add(s,"manual-destroy",{ele:s,callBack:t,parent:e})};var G=(s,t,e,r)=>{if(Array.isArray(e[0])){e.forEach(n=>{n&&G(s,t,n,r)});return}Ze(s,t,e,r)},Ze=(s,t,e,r)=>{let n,i;if(e.length<3?[n,i]=e:[t,n,i]=e,!t||!n)return;if(typeof t.on!="function"){console.warn('Watcher directive: Data source does not have an "on" method. Make sure your component has data, state, or context.data initialized before using watchers like onSet, watch, or [[prop]] syntax.',s,t);return}let o=tr(s,n,i,r);I.watch(s,t,n,o)},tr=(s,t,e,r)=>typeof e=="object"?n=>{sr(s,e,n)}:n=>{rr(s,e,t,n,r)},Lt=new WeakSet,er=(s,t,e)=>{!s||!s.isUnit&&!s.isComponent||Lt.has(e)||Lt.add(e)},rr=(s,t,e,r,n)=>{let i=t(r,s,n);switch(typeof i){case"object":if(i===null)break;er(i,e,s),u.rebuild(i,s,n);break;case"string":let o=dt(s);if(o!=="textContent"){s.setAttribute(o,i);break}M.addHtml(s,i);break}},sr=(s,t,e)=>{let r=Object.keys(t);for(let n=0,i=r.length;n<i;n++){let o=r[n];o&&(t[o]===e?s.classList.add(o):s.classList.remove(o))}};var U=(s,t,e)=>{let r=C(e);G(s,r,t,e)};var Mt=(s,t,e)=>{t&&s.setAttribute("role",t)},nr=s=>(t,e)=>{let r=t?"true":"false";e.setAttribute(s,r)},qt=(s,t,e)=>{if(!t)return;let r=t.role;r&&(s.setAttribute("role",r),t.role=null);let n=Object.keys(t);for(let i=0,o=n.length;i<o;i++){let a=n[i],l=t[a];if(l===null)continue;let c="aria-"+a;if(Array.isArray(l)){let h=l.slice();h.push(nr(c)),U(s,h,e)}else s.setAttribute(c,l)}};var Gt=(s,t,e)=>{if(!t)return;let r=v.parse(t,e);y.addAttributes(s,r.attr,e),u.setDirectives(s,r.directives,e)};f.addType("context",s=>{if(!s)return!1;s.parent.removeContextBranch(s.branch)});var lt=s=>s?s.getContext():null,Wt=(s,t,e)=>{if(typeof t!="function")return;let r=lt(e),n=t(r);Gt(s,n,e)},Nt=(s,t,e)=>{if(typeof t!="function")return;let r=lt(e);t(r)},Ft=(s,t,e)=>{if(typeof t!="function"||!e)return;let r=lt(e),n=t(r);if(!n)return;let i=n[0];i&&(e.addContextBranch(i,n[1]),ir(s,i,e))},ir=(s,t,e)=>{f.add(s,"context",{branch:t,parent:e})};var Qt=(s,t,e)=>{};var zt=(s,t,e)=>{if(!e)return;let r=e._layout?e._layout:e.render();console.log("Debug: ","ele: ",s),console.log("Data: ",t),console.log("Layout: ",r),console.log("parent: ",e)};var jt=(s,t,e)=>{},$t=(s,t,e)=>{if(!t||!e)return;let r=t(e,s);r&&u.build(r,s,e)},Yt=(s,t,e)=>{if(!t||!e)return;let r=e.getId(t);s.id=r},Jt=(s,t,e)=>{if(!t||!e)return;let r=t(e.data,s);r&&u.build(r,s,e)},Kt=(s,t,e)=>{if(!t||!e)return;let r=t(e.state,s);r&&u.build(r,s,e)},Vt=(s,t,e)=>{if(!t||!e)return;let r=e.state,n=t(r);if(!e.state){e.setStateHelper(n);return}e.addState(n)},Xt=(s,t,e)=>{if(!(!t||!e)){if(e.events||e.setEventHelper(),t[2]){let r=t[2];t[2]=n=>{r(n,e)}}e.events.on(t[0],t[1],t[2],t[3])}};var Zt=(s,t,e)=>{let r,n,i;if(typeof t=="string"){if(r=C(e),!r)return;n=t}else if(Array.isArray(t))if(typeof t[0]!="object"){let o=C(e);if(!o)return;r=o,n=t[0],i=t[1]}else[r,n,i]=t;I.bind(s,r,n,i)};var et=(s,t,e)=>{G(s,e.state,t,e)};var te=s=>(t,e)=>{let[r,n,i="active"]=s,o=t===n?i:"";e.dataset[r]=o},ee=(s,t,e)=>{if(!t)return;let r=t.length-1,n=t[r],i=t.slice(0,r);i.push(te(n)),U(s,i,e)},re=(s,t,e)=>{if(!t)return;let r=t.length-1,n=t[r],i=t.slice(0,r);i.push(te(n)),et(s,i,e)};var se=s=>{for(let t=0,e=s.length;t<e;t++){let r=s[t];r&&r.remove()}s.length=0};f.addType("forScopes",s=>{if(!s)return!1;se(s.scopes)});var ne=(s,t,e)=>{let r,n,i,o;if(typeof t[0]=="string"||t.length<3){let h=C(e);if(!h)return;r=h,[n,i,o]=t}else[r,n,i,o]=t;let a=o!==!1,l=n+"[",c=a?{scopes:[]}:null;c&&f.add(s,"forScopes",c),I.watch(s,r,n,h=>{if(u.removeAll(s),c&&se(c.scopes),!h||h.length<1)return;let d=[];for(let m=0,g=h.length;m<g;m++){let R=a?r.scope(l+m+"]"):null;R&&c&&c.scopes.push(R);let H=i(h[m],m,R,d);H!==null&&d.push(H)}return u.build(d,s,e)})};var ie=(s,t,e)=>{let r=t[0];if(!r||r.length<1)return;let n=t[1],i=[];for(let o=0,a=r.length;o<a;o++){let l=r[o];if(!l)continue;let c=n(l,o);c!==null&&i.push(c)}u.build(i,s,e)};var oe=(s,t,e)=>{t(s,e)};f.addType("destroyed",s=>{if(!s)return!1;s.callBack(s.ele,s.parent)});var ae=(s,t,e)=>{or(s,t,e)},or=(s,t,e)=>{f.add(s,"destroyed",{ele:s,callBack:t,parent:e})};var ce=(s,t,e)=>{if(t)if(Array.isArray(t)&&typeof t[0]!="string")for(let r=0,n=t.length;r<n;r++)A.setup(s,t[r],e);else A.setup(s,t,e)};f.addType("routes",s=>{if(!s)return!1;let t=s.route;t&&w.removeRoute(t)});var he=(s,t,e)=>{if(t)if(Array.isArray(t))for(let r=0,n=t.length;r<n;r++){let i=t[r];i&&le(s,i,e)}else le(s,t,e)},le=(s,t,e)=>{t.container=s,t.parent=e;let r=w.add(t);ar(s,r)},ar=(s,t)=>{f.add(s,"routes",{route:t})};var ue=(s,t,e)=>{};f.addType("switch",s=>{if(!s)return!1;let t=s.id;w.removeSwitch(t)});var de=(s,t,e)=>{let r=t[0];for(let i=0,o=t.length;i<o;i++){let a=t[i];a&&(a.container=s,a.parent=e)}let n=w.addSwitch(t);cr(s,n)},cr=(s,t)=>{f.add(s,"switch",{id:t})};q.add("cache",jt).add("onCreated",oe).add("onDestroyed",ae).add("bind",Zt).add("data",Qt).add("state",ue).add("onSet",U).add("onState",et).add("animateIn",Ut).add("animateOut",Ht).add("watch",ce).add("useParent",$t).add("useData",Jt).add("useState",Kt).add("getId",Yt).add("addState",Vt).add("addEvent",Xt).add("map",ie).add("for",ne).add("useContext",Nt).add("addContext",Ft).add("context",Wt).add("role",Mt).add("aria",qt).add("route",he).add("debug",zt).add("dataSet",ee).add("dataStateSet",re).add("switch",de);export{q as a,W as b,x as c,xt as d,St as e,B as f,u as g,Tt as h,ct as i,at as j,w as k};
|
|
2
|
-
//# sourceMappingURL=chunk-6VPBF5VF.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{i as g}from"./chunk-FXJIFTW5.js";var i=class extends g{setup(){this.stage={}}addAction(t,e){return typeof e<"u"&&this.set(t,e),this}getState(t){return this.get(t)}removeAction(t,e){if(e)return this.off(t,e),this;let s=this.stage;return typeof s[t]<"u"&&delete s[t],this}};var n=class extends i{constructor(t){super(),this.id=t}setup(){this.stage={},this.id=""}};var h=class{static targets=new Map;static ownerCounts=new Map;static restore(t,e){this.targets.set(t,e),this.addOwner(t)}static getTarget(t){return this.targets.has(t)||this.targets.set(t,new n(t)),this.targets.get(t)}static attach(t){let e=this.getTarget(t);return this.addOwner(t),e}static addOwner(t){this.ownerCounts.set(t,(this.ownerCounts.get(t)||0)+1)}static detach(t){let e=this.ownerCounts.get(t);if(e===void 0)return;if(e>1){this.ownerCounts.set(t,e-1);return}this.ownerCounts.delete(t);let s=this.targets.get(t);s&&(s.remove(),this.targets.delete(t))}static getActionState(t,e){return this.getTarget(t).get(e)}static add(t,e,s){let r=this.getTarget(t);return e&&r.addAction(e,s),r}static addAction(t,e,s){return this.add(t,e,s)}static removeAction(t,e,s){if(s){this.off(t,e,s);return}let r=this.getTarget(t);r&&e&&r.removeAction(e)}static on(t,e,s){let r=this.getTarget(t);return e?r.on(e,s):null}static off(t,e,s){this.remove(t,e,s)}static remove(t,e,s){let r=this.targets,o=r.get(t);if(o){if(e){o.off(e,s);return}this.targets.delete(t),this.ownerCounts.delete(t)}}static set(t,e,s){this.getTarget(t).set(e,s)}};export{i as a,h as b};
|
|
2
|
-
//# sourceMappingURL=chunk-AO5L25YQ.js.map
|