solely 0.5.4 → 0.5.6

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.
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),exports.default=".solely-modal,.solely-modal *,.solely-modal *:before,.solely-modal *:after,.solely-modal-mask,.solely-modal-wrap{box-sizing:border-box}.solely-modal-mask{position:fixed;top:0;left:0;right:0;bottom:0;background-color:var(--solely-mask-bg);z-index:1;pointer-events:auto;animation:solely-modal-mask-in var(--solely-transition-duration) var(--solely-transition-timing)}.solely-modal-mask.is-closing{animation:solely-modal-mask-out var(--solely-transition-duration) var(--solely-transition-timing) forwards}.solely-modal-wrap{position:fixed;top:0;left:0;right:0;bottom:0;z-index:var(--solely-z-index-modal);display:flex;align-items:center;justify-content:center;overflow:auto;outline:0;pointer-events:none}.solely-modal{position:relative;z-index:2;background-color:var(--solely-component-bg);border-radius:var(--solely-border-radius-md);box-shadow:var(--solely-shadow-lg);animation:solely-modal-container-in var(--solely-transition-duration) var(--solely-transition-timing);max-width:calc(100vw - var(--solely-spacing-xl));margin:var(--solely-spacing-md);pointer-events:auto}.solely-modal.is-closing{animation:solely-modal-container-out var(--solely-transition-duration) var(--solely-transition-timing) forwards}.solely-modal__header{padding:var(--solely-spacing-lg) var(--solely-spacing-xl);border-bottom:1px solid var(--solely-border-color-split);display:flex;align-items:center;justify-content:space-between}.solely-modal__title{margin:0;font-size:var(--solely-font-size-lg);font-weight:500;color:var(--solely-text-primary);line-height:var(--solely-line-height-lg)}.solely-modal__close{width:var(--solely-height-sm);height:var(--solely-height-sm);display:flex;align-items:center;justify-content:center;color:var(--solely-text-tertiary);cursor:pointer;transition:color var(--solely-transition-duration);font-size:var(--solely-font-size-lg);line-height:1;border:none;background:none;border-radius:var(--solely-border-radius-sm)}.solely-modal__close:hover{color:var(--solely-text-secondary);background-color:var(--solely-gray-3)}.solely-modal__close:active{color:var(--solely-text-primary)}.solely-modal__body{padding:var(--solely-spacing-xl);font-size:var(--solely-font-size-md);line-height:var(--solely-line-height-md);color:var(--solely-text-secondary)}.solely-modal__content-wrapper{display:flex;align-items:flex-start;gap:var(--solely-spacing-sm)}.solely-modal__footer{padding:var(--solely-spacing-md) var(--solely-spacing-lg);border-top:1px solid var(--solely-border-color-split);display:flex;justify-content:flex-end;gap:var(--solely-spacing-sm)}.solely-modal__icon{display:inline-flex;align-items:center;justify-content:center;width:var(--solely-height-sm);height:var(--solely-height-sm);border-radius:var(--solely-border-radius-circle);margin-right:var(--solely-spacing-sm);font-size:var(--solely-font-size-md)}.solely-modal__icon--info{background-color:var(--solely-info-light);color:var(--solely-info)}.solely-modal__icon--success{background-color:var(--solely-success-light);color:var(--solely-success)}.solely-modal__icon--warning{background-color:var(--solely-warning-light);color:var(--solely-warning)}.solely-modal__icon--error{background-color:var(--solely-error-light);color:var(--solely-error)}.solely-modal__icon--confirm{background-color:var(--solely-warning-light);color:var(--solely-warning)}.solely-modal__btn{display:inline-flex;align-items:center;justify-content:center;gap:var(--solely-spacing-xs);height:var(--solely-height-md);padding:0 var(--solely-spacing-md);font-family:var(--solely-font-family);font-size:var(--solely-font-size-md);font-weight:400;line-height:var(--solely-line-height-md);white-space:nowrap;text-align:center;text-decoration:none;vertical-align:middle;background-image:none;border:1px solid transparent;border-radius:var(--solely-border-radius-md);cursor:pointer;transition:all var(--solely-transition-duration) var(--solely-transition-timing);-webkit-user-select:none;user-select:none;touch-action:manipulation;outline:none;position:relative}.solely-modal__btn:hover:not(:disabled){opacity:.9}.solely-modal__btn:active:not(:disabled){opacity:.8}.solely-modal__btn:disabled{opacity:.4;cursor:not-allowed}.solely-modal__btn--primary{color:var(--solely-white);background-color:var(--solely-primary);border-color:var(--solely-primary)}.solely-modal__btn--default{color:var(--solely-text-primary);background-color:var(--solely-component-bg);border-color:var(--solely-border-color)}.solely-modal__btn--danger{color:var(--solely-white);background-color:var(--solely-error);border-color:var(--solely-error)}@keyframes solely-modal-mask-in{0%{opacity:0}to{opacity:1}}@keyframes solely-modal-mask-out{0%{opacity:1}to{opacity:0}}@keyframes solely-modal-container-in{0%{opacity:0;transform:scale(.8)}to{opacity:1;transform:scale(1)}}@keyframes solely-modal-container-out{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.8)}}";
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),exports.default=".solely-modal,.solely-modal *,.solely-modal *:before,.solely-modal *:after,.solely-modal-mask,.solely-modal-wrap{box-sizing:border-box}.solely-modal-mask{position:fixed;top:0;left:0;right:0;bottom:0;background-color:var(--solely-mask-bg);z-index:1;pointer-events:auto;animation:solely-modal-mask-in var(--solely-transition-duration) var(--solely-transition-timing)}.solely-modal-mask.is-closing{animation:solely-modal-mask-out var(--solely-transition-duration) var(--solely-transition-timing) forwards}.solely-modal-wrap{position:fixed;top:0;left:0;right:0;bottom:0;z-index:var(--solely-z-index-modal);display:flex;align-items:center;justify-content:center;overflow:auto;outline:0;pointer-events:none}.solely-modal{position:relative;z-index:2;background-color:var(--solely-component-bg);border-radius:var(--solely-border-radius-md);box-shadow:var(--solely-shadow-lg);animation:solely-modal-container-in var(--solely-transition-duration) var(--solely-transition-timing);max-width:calc(100vw - var(--solely-spacing-xl));margin:var(--solely-spacing-md);pointer-events:auto}.solely-modal.is-closing{animation:solely-modal-container-out var(--solely-transition-duration) var(--solely-transition-timing) forwards}.solely-modal__header{padding:var(--solely-spacing-lg) var(--solely-spacing-xl);border-bottom:1px solid var(--solely-border-color-split);display:flex;align-items:center;justify-content:space-between}.solely-modal__title{margin:0;font-size:var(--solely-font-size-lg);font-weight:500;color:var(--solely-text-primary);line-height:var(--solely-line-height-lg)}.solely-modal__close{width:var(--solely-height-sm);height:var(--solely-height-sm);display:flex;align-items:center;justify-content:center;color:var(--solely-text-tertiary);cursor:pointer;transition:color var(--solely-transition-duration);font-size:var(--solely-font-size-lg);line-height:1;border:none;background:none;border-radius:var(--solely-border-radius-sm)}.solely-modal__close:hover{color:var(--solely-text-secondary);background-color:var(--solely-gray-3)}.solely-modal__close:active{color:var(--solely-text-primary)}.solely-modal__body{padding:var(--solely-spacing-xl);font-size:var(--solely-font-size-md);line-height:var(--solely-line-height-md);color:var(--solely-text-secondary)}.solely-modal__content-wrapper{display:flex;align-items:flex-start;gap:var(--solely-spacing-sm)}.solely-modal__content{width:100%}.solely-modal__footer{padding:var(--solely-spacing-md) var(--solely-spacing-lg);border-top:1px solid var(--solely-border-color-split);display:flex;justify-content:flex-end;gap:var(--solely-spacing-sm)}.solely-modal__icon{display:inline-flex;align-items:center;justify-content:center;width:var(--solely-height-sm);height:var(--solely-height-sm);border-radius:var(--solely-border-radius-circle);margin-right:var(--solely-spacing-sm);font-size:var(--solely-font-size-md)}.solely-modal__icon--info{background-color:var(--solely-info-light);color:var(--solely-info)}.solely-modal__icon--success{background-color:var(--solely-success-light);color:var(--solely-success)}.solely-modal__icon--warning{background-color:var(--solely-warning-light);color:var(--solely-warning)}.solely-modal__icon--error{background-color:var(--solely-error-light);color:var(--solely-error)}.solely-modal__icon--confirm{background-color:var(--solely-warning-light);color:var(--solely-warning)}.solely-modal__btn{display:inline-flex;align-items:center;justify-content:center;gap:var(--solely-spacing-xs);height:var(--solely-height-md);padding:0 var(--solely-spacing-md);font-family:var(--solely-font-family);font-size:var(--solely-font-size-md);font-weight:400;line-height:var(--solely-line-height-md);white-space:nowrap;text-align:center;text-decoration:none;vertical-align:middle;background-image:none;border:1px solid transparent;border-radius:var(--solely-border-radius-md);cursor:pointer;transition:all var(--solely-transition-duration) var(--solely-transition-timing);-webkit-user-select:none;user-select:none;touch-action:manipulation;outline:none;position:relative}.solely-modal__btn:hover:not(:disabled){opacity:.9}.solely-modal__btn:active:not(:disabled){opacity:.8}.solely-modal__btn:disabled{opacity:.4;cursor:not-allowed}.solely-modal__btn--primary{color:var(--solely-white);background-color:var(--solely-primary);border-color:var(--solely-primary)}.solely-modal__btn--default{color:var(--solely-text-primary);background-color:var(--solely-component-bg);border-color:var(--solely-border-color)}.solely-modal__btn--danger{color:var(--solely-white);background-color:var(--solely-error);border-color:var(--solely-error)}@keyframes solely-modal-mask-in{0%{opacity:0}to{opacity:1}}@keyframes solely-modal-mask-out{0%{opacity:1}to{opacity:0}}@keyframes solely-modal-container-in{0%{opacity:0;transform:scale(.8)}to{opacity:1;transform:scale(1)}}@keyframes solely-modal-container-out{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.8)}}";
@@ -1 +1 @@
1
- const o=".solely-modal,.solely-modal *,.solely-modal *:before,.solely-modal *:after,.solely-modal-mask,.solely-modal-wrap{box-sizing:border-box}.solely-modal-mask{position:fixed;top:0;left:0;right:0;bottom:0;background-color:var(--solely-mask-bg);z-index:1;pointer-events:auto;animation:solely-modal-mask-in var(--solely-transition-duration) var(--solely-transition-timing)}.solely-modal-mask.is-closing{animation:solely-modal-mask-out var(--solely-transition-duration) var(--solely-transition-timing) forwards}.solely-modal-wrap{position:fixed;top:0;left:0;right:0;bottom:0;z-index:var(--solely-z-index-modal);display:flex;align-items:center;justify-content:center;overflow:auto;outline:0;pointer-events:none}.solely-modal{position:relative;z-index:2;background-color:var(--solely-component-bg);border-radius:var(--solely-border-radius-md);box-shadow:var(--solely-shadow-lg);animation:solely-modal-container-in var(--solely-transition-duration) var(--solely-transition-timing);max-width:calc(100vw - var(--solely-spacing-xl));margin:var(--solely-spacing-md);pointer-events:auto}.solely-modal.is-closing{animation:solely-modal-container-out var(--solely-transition-duration) var(--solely-transition-timing) forwards}.solely-modal__header{padding:var(--solely-spacing-lg) var(--solely-spacing-xl);border-bottom:1px solid var(--solely-border-color-split);display:flex;align-items:center;justify-content:space-between}.solely-modal__title{margin:0;font-size:var(--solely-font-size-lg);font-weight:500;color:var(--solely-text-primary);line-height:var(--solely-line-height-lg)}.solely-modal__close{width:var(--solely-height-sm);height:var(--solely-height-sm);display:flex;align-items:center;justify-content:center;color:var(--solely-text-tertiary);cursor:pointer;transition:color var(--solely-transition-duration);font-size:var(--solely-font-size-lg);line-height:1;border:none;background:none;border-radius:var(--solely-border-radius-sm)}.solely-modal__close:hover{color:var(--solely-text-secondary);background-color:var(--solely-gray-3)}.solely-modal__close:active{color:var(--solely-text-primary)}.solely-modal__body{padding:var(--solely-spacing-xl);font-size:var(--solely-font-size-md);line-height:var(--solely-line-height-md);color:var(--solely-text-secondary)}.solely-modal__content-wrapper{display:flex;align-items:flex-start;gap:var(--solely-spacing-sm)}.solely-modal__footer{padding:var(--solely-spacing-md) var(--solely-spacing-lg);border-top:1px solid var(--solely-border-color-split);display:flex;justify-content:flex-end;gap:var(--solely-spacing-sm)}.solely-modal__icon{display:inline-flex;align-items:center;justify-content:center;width:var(--solely-height-sm);height:var(--solely-height-sm);border-radius:var(--solely-border-radius-circle);margin-right:var(--solely-spacing-sm);font-size:var(--solely-font-size-md)}.solely-modal__icon--info{background-color:var(--solely-info-light);color:var(--solely-info)}.solely-modal__icon--success{background-color:var(--solely-success-light);color:var(--solely-success)}.solely-modal__icon--warning{background-color:var(--solely-warning-light);color:var(--solely-warning)}.solely-modal__icon--error{background-color:var(--solely-error-light);color:var(--solely-error)}.solely-modal__icon--confirm{background-color:var(--solely-warning-light);color:var(--solely-warning)}.solely-modal__btn{display:inline-flex;align-items:center;justify-content:center;gap:var(--solely-spacing-xs);height:var(--solely-height-md);padding:0 var(--solely-spacing-md);font-family:var(--solely-font-family);font-size:var(--solely-font-size-md);font-weight:400;line-height:var(--solely-line-height-md);white-space:nowrap;text-align:center;text-decoration:none;vertical-align:middle;background-image:none;border:1px solid transparent;border-radius:var(--solely-border-radius-md);cursor:pointer;transition:all var(--solely-transition-duration) var(--solely-transition-timing);-webkit-user-select:none;user-select:none;touch-action:manipulation;outline:none;position:relative}.solely-modal__btn:hover:not(:disabled){opacity:.9}.solely-modal__btn:active:not(:disabled){opacity:.8}.solely-modal__btn:disabled{opacity:.4;cursor:not-allowed}.solely-modal__btn--primary{color:var(--solely-white);background-color:var(--solely-primary);border-color:var(--solely-primary)}.solely-modal__btn--default{color:var(--solely-text-primary);background-color:var(--solely-component-bg);border-color:var(--solely-border-color)}.solely-modal__btn--danger{color:var(--solely-white);background-color:var(--solely-error);border-color:var(--solely-error)}@keyframes solely-modal-mask-in{0%{opacity:0}to{opacity:1}}@keyframes solely-modal-mask-out{0%{opacity:1}to{opacity:0}}@keyframes solely-modal-container-in{0%{opacity:0;transform:scale(.8)}to{opacity:1;transform:scale(1)}}@keyframes solely-modal-container-out{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.8)}}";export{o as default};
1
+ const o=".solely-modal,.solely-modal *,.solely-modal *:before,.solely-modal *:after,.solely-modal-mask,.solely-modal-wrap{box-sizing:border-box}.solely-modal-mask{position:fixed;top:0;left:0;right:0;bottom:0;background-color:var(--solely-mask-bg);z-index:1;pointer-events:auto;animation:solely-modal-mask-in var(--solely-transition-duration) var(--solely-transition-timing)}.solely-modal-mask.is-closing{animation:solely-modal-mask-out var(--solely-transition-duration) var(--solely-transition-timing) forwards}.solely-modal-wrap{position:fixed;top:0;left:0;right:0;bottom:0;z-index:var(--solely-z-index-modal);display:flex;align-items:center;justify-content:center;overflow:auto;outline:0;pointer-events:none}.solely-modal{position:relative;z-index:2;background-color:var(--solely-component-bg);border-radius:var(--solely-border-radius-md);box-shadow:var(--solely-shadow-lg);animation:solely-modal-container-in var(--solely-transition-duration) var(--solely-transition-timing);max-width:calc(100vw - var(--solely-spacing-xl));margin:var(--solely-spacing-md);pointer-events:auto}.solely-modal.is-closing{animation:solely-modal-container-out var(--solely-transition-duration) var(--solely-transition-timing) forwards}.solely-modal__header{padding:var(--solely-spacing-lg) var(--solely-spacing-xl);border-bottom:1px solid var(--solely-border-color-split);display:flex;align-items:center;justify-content:space-between}.solely-modal__title{margin:0;font-size:var(--solely-font-size-lg);font-weight:500;color:var(--solely-text-primary);line-height:var(--solely-line-height-lg)}.solely-modal__close{width:var(--solely-height-sm);height:var(--solely-height-sm);display:flex;align-items:center;justify-content:center;color:var(--solely-text-tertiary);cursor:pointer;transition:color var(--solely-transition-duration);font-size:var(--solely-font-size-lg);line-height:1;border:none;background:none;border-radius:var(--solely-border-radius-sm)}.solely-modal__close:hover{color:var(--solely-text-secondary);background-color:var(--solely-gray-3)}.solely-modal__close:active{color:var(--solely-text-primary)}.solely-modal__body{padding:var(--solely-spacing-xl);font-size:var(--solely-font-size-md);line-height:var(--solely-line-height-md);color:var(--solely-text-secondary)}.solely-modal__content-wrapper{display:flex;align-items:flex-start;gap:var(--solely-spacing-sm)}.solely-modal__content{width:100%}.solely-modal__footer{padding:var(--solely-spacing-md) var(--solely-spacing-lg);border-top:1px solid var(--solely-border-color-split);display:flex;justify-content:flex-end;gap:var(--solely-spacing-sm)}.solely-modal__icon{display:inline-flex;align-items:center;justify-content:center;width:var(--solely-height-sm);height:var(--solely-height-sm);border-radius:var(--solely-border-radius-circle);margin-right:var(--solely-spacing-sm);font-size:var(--solely-font-size-md)}.solely-modal__icon--info{background-color:var(--solely-info-light);color:var(--solely-info)}.solely-modal__icon--success{background-color:var(--solely-success-light);color:var(--solely-success)}.solely-modal__icon--warning{background-color:var(--solely-warning-light);color:var(--solely-warning)}.solely-modal__icon--error{background-color:var(--solely-error-light);color:var(--solely-error)}.solely-modal__icon--confirm{background-color:var(--solely-warning-light);color:var(--solely-warning)}.solely-modal__btn{display:inline-flex;align-items:center;justify-content:center;gap:var(--solely-spacing-xs);height:var(--solely-height-md);padding:0 var(--solely-spacing-md);font-family:var(--solely-font-family);font-size:var(--solely-font-size-md);font-weight:400;line-height:var(--solely-line-height-md);white-space:nowrap;text-align:center;text-decoration:none;vertical-align:middle;background-image:none;border:1px solid transparent;border-radius:var(--solely-border-radius-md);cursor:pointer;transition:all var(--solely-transition-duration) var(--solely-transition-timing);-webkit-user-select:none;user-select:none;touch-action:manipulation;outline:none;position:relative}.solely-modal__btn:hover:not(:disabled){opacity:.9}.solely-modal__btn:active:not(:disabled){opacity:.8}.solely-modal__btn:disabled{opacity:.4;cursor:not-allowed}.solely-modal__btn--primary{color:var(--solely-white);background-color:var(--solely-primary);border-color:var(--solely-primary)}.solely-modal__btn--default{color:var(--solely-text-primary);background-color:var(--solely-component-bg);border-color:var(--solely-border-color)}.solely-modal__btn--danger{color:var(--solely-white);background-color:var(--solely-error);border-color:var(--solely-error)}@keyframes solely-modal-mask-in{0%{opacity:0}to{opacity:1}}@keyframes solely-modal-mask-out{0%{opacity:1}to{opacity:0}}@keyframes solely-modal-container-in{0%{opacity:0;transform:scale(.8)}to{opacity:1;transform:scale(1)}}@keyframes solely-modal-container-out{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.8)}}";export{o as default};
@@ -1 +1 @@
1
- "use strict";var e=Object.defineProperty,t=(t,s,i)=>((t,s,i)=>s in t?e(t,s,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[s]=i)(t,"symbol"!=typeof s?s+"":s,i);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("../shared/env.cjs");let i=null,r=null,a=null;function n(){return i?Promise.resolve(i):(a||(a=new Promise(e=>{r=e})),a)}const h=(()=>{const e=()=>n();return Object.defineProperties(e,{then:{value:(e,t)=>n().then(e,t),writable:!1,enumerable:!1,configurable:!0},catch:{value:e=>n().catch(e),writable:!1,enumerable:!1,configurable:!0},finally:{value:e=>n().finally(e),writable:!1,enumerable:!1,configurable:!0},[Symbol.toStringTag]:{value:"Promise",writable:!1,enumerable:!1,configurable:!0}}),e})(),o=class e{constructor(e){t(this,"routes"),t(this,"base"),t(this,"mode"),t(this,"beforeEachGuard"),t(this,"afterEachGuard"),t(this,"currentRoute",null),t(this,"listeners",new Set),t(this,"componentCache",new Map),t(this,"keepAliveCache",new Map),t(this,"keepAliveKeys",[]),t(this,"navigationId",0),t(this,"maxKeepAlive"),t(this,"isStarted",!1),t(this,"handleRouteChange",null),this.routes=e.routes,this.base=e.base??"/",this.mode=e.mode||"history",this.beforeEachGuard=e.beforeEach,this.afterEachGuard=e.afterEach,this.maxKeepAlive=e.maxKeepAlive}matchRoute(e="/"){return this.matchRouteInternal(e,new Set,0)}matchRouteInternal(t,i,r){if(r>=e.MAX_REDIRECTS)return s.IS_DEV&&console.error(`[Router] Too many redirects (max ${e.MAX_REDIRECTS}), last path: ${t}`),null;const a=this.normalizePath(t);if(i.has(a))return s.IS_DEV&&console.error(`[Router] Circular redirect detected: ${a}`),null;i.add(a);const[n,h]=a.split("?"),o=n.split("/").filter(Boolean),c=this.parseQuery(h),l=this.recursiveMatch(this.routes,o);if(l){const e=l.matched[l.matched.length-1];return e.config.redirect?this.matchRouteInternal(e.config.redirect,i,r+1):{matched:l.matched,params:l.params,query:c,fullPath:a,meta:l.matched.reduce((e,t)=>({...e,...t.config.meta||{}}),{})}}return null}recursiveMatch(e,t){const s=[...e].sort((e,t)=>this.calculateScore(t.path)-this.calculateScore(e.path));for(const i of s){const e=i.path.split("/").filter(Boolean),s={};let r=!0;if(0===e.length&&0===t.length)return{matched:[{config:i,params:{}}],params:{}};for(let i=0;i<e.length;i++){const a=e[i],n=t[i];if(a.startsWith(":")){if(!n){r=!1;break}s[a.slice(1)]=n}else{if("*"===a){r=!0;break}if(a!==n){r=!1;break}}}if(r){const r=e.length,a=t.slice(r),n={config:i,params:s};if(a.length>0&&i.children){const e=this.recursiveMatch(i.children,a);if(e)return{matched:[n,...e.matched],params:{...s,...e.params}}}else if(0===a.length||e.includes("*"))return{matched:[n],params:s}}}return null}calculateScore(e="/"){const t=e.split("/").filter(Boolean);return 0===t.length?1:t.reduce((e,t)=>t.startsWith(":")?e+5:"*"===t?e+0:e+10,0)}parseQuery(e){const t={};return e?(new URLSearchParams(e).forEach((e,s)=>{t[s]=e}),t):t}normalizePath(e="/"){const t=e&&"string"==typeof e?e:"/",s=t.indexOf("?"),i=-1===s?t:t.slice(0,s),r=-1===s?"":t.slice(s+1);let a=i;return a.startsWith("/")||(a="/"+a),a.length>1&&a.endsWith("/")&&(a=a.slice(0,-1)),r?`${a}?${r}`:a}getPath(){let e;try{e="hash"===this.mode?window.location.hash.slice(1)||"/":`${window.location.pathname}${window.location.search}`}catch{e="/"}const t=this.base||"/";return"/"!==t&&e.startsWith(t)&&(e=e.slice(t.length)||"/"),this.normalizePath(e)}updateBrowserHistory(e="/",t){const s=this.normalizePath(e),i=this.base||"/";if("hash"===this.mode)t?window.location.replace(`#${s}`):window.location.hash=s;else{const e=i.endsWith("/")?i.slice(0,-1):i,r="/"===e?s:e+s;t?window.history.replaceState({path:r},"",r):window.history.pushState({path:r},"",r)}}async navigate(e="/",t=!1,s=!1){const i=++this.navigationId,r=this.normalizePath(e),a=this.currentRoute,n=this.matchRoute(r);if(!n)return{success:!1,error:`No route matched: ${r}`};if(a&&a.fullPath===n.fullPath)return{success:!0};if(this.beforeEachGuard)try{const e=await this.beforeEachGuard(n,a);if(i!==this.navigationId)return{success:!1,cancelled:!0};if(!1===e)return{success:!1,cancelled:!0};if("string"==typeof e)return this.navigate(e,t)}catch(h){return i!==this.navigationId?{success:!1,cancelled:!0}:{success:!1,error:h instanceof Error?h.message:"Guard Error"}}return i!==this.navigationId?{success:!1,cancelled:!0}:(this.currentRoute=n,s||this.updateBrowserHistory(r,t),this.notifyListeners(),this.afterEachGuard&&this.afterEachGuard(n,a),{success:!0})}resolve(e="/"){const t=this.normalizePath(e);if("hash"===this.mode)return`#${t}`;const s=this.base.endsWith("/")?this.base.slice(0,-1):this.base;return"/"===s?t:s+t}get modeType(){return this.mode}pushWithQuery(e="/",t){const s=new URLSearchParams(t).toString(),i=e.includes("?")?"&":"?";return this.push(e+(s?i+s:""))}push(e="/"){return this.navigate(e,!1)}replace(e="/"){return this.navigate(e,!0)}back(){window.history.back()}forward(){window.history.forward()}listen(e){return this.listeners.add(e),()=>this.listeners.delete(e)}notifyListeners(){this.listeners.forEach(e=>e())}setupListeners(){this.isStarted||(this.isStarted=!0,this.handleRouteChange=()=>{this.navigate(this.getPath(),!0,!0)},"hash"===this.mode?window.addEventListener("hashchange",this.handleRouteChange):window.addEventListener("popstate",this.handleRouteChange),"hash"!==this.mode||window.location.hash||(window.location.hash="/"),this.navigate(this.getPath(),!0))}destroy(){this.handleRouteChange&&("hash"===this.mode?window.removeEventListener("hashchange",this.handleRouteChange):window.removeEventListener("popstate",this.handleRouteChange),this.handleRouteChange=null),this.isStarted=!1,this.listeners.clear(),this.componentCache.clear(),this.keepAliveCache.clear(),this.keepAliveKeys=[],this.currentRoute=null,i=null}getCurrentRoute(){return this.currentRoute}getKeepAlive(e){const t=this.keepAliveCache.get(e);if(t){const t=this.keepAliveKeys.indexOf(e);-1!==t&&(this.keepAliveKeys.splice(t,1),this.keepAliveKeys.push(e))}return t}setKeepAlive(e,t){if(this.keepAliveCache.has(e)){this.keepAliveCache.set(e,t);const s=this.keepAliveKeys.indexOf(e);-1!==s&&(this.keepAliveKeys.splice(s,1),this.keepAliveKeys.push(e))}else this.keepAliveCache.set(e,t),this.keepAliveKeys.push(e),this.evictKeepAlive()}hasKeepAlive(e){return this.keepAliveCache.has(e)}evictKeepAlive(){if(this.maxKeepAlive)for(;this.keepAliveKeys.length>this.maxKeepAlive;){const e=this.keepAliveKeys.shift();e&&this.keepAliveCache.delete(e)}}cacheKey(e){return this.normalizePath(e)}prefetch(e){const t=this.matchRoute(e);if(!t)return;const s=this.cacheKey(t.fullPath),i=t.matched[t.matched.length-1];if(!(null==i?void 0:i.config.component))return;const r=i.config.component;if("function"!=typeof r)return;if(this.componentCache.has(s))return;const a=r();this.componentCache.set(s,a),a.catch(()=>{this.componentCache.delete(s)})}getComponentFromCache(e){return this.componentCache.get(this.cacheKey(e))}};t(o,"MAX_REDIRECTS",20);let c=o;exports.Router=c,exports.createRouter=function(e){return i||(i=new c(e),r&&r(i),r=null,a=null,i)},exports.getRouter=function(){return i},exports.routerReady=h;
1
+ "use strict";var e=Object.defineProperty,t=(t,s,i)=>((t,s,i)=>s in t?e(t,s,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[s]=i)(t,"symbol"!=typeof s?s+"":s,i);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("../shared/env.cjs");let i=null,r=null,a=null;function n(){return i?Promise.resolve(i):(a||(a=new Promise(e=>{r=e})),a)}const h=(()=>{const e=()=>n();return Object.defineProperties(e,{then:{value:(e,t)=>n().then(e,t),writable:!1,enumerable:!1,configurable:!0},catch:{value:e=>n().catch(e),writable:!1,enumerable:!1,configurable:!0},finally:{value:e=>n().finally(e),writable:!1,enumerable:!1,configurable:!0},[Symbol.toStringTag]:{value:"Promise",writable:!1,enumerable:!1,configurable:!0}}),e})(),o=class e{constructor(e){t(this,"routes"),t(this,"base"),t(this,"mode"),t(this,"beforeEachGuard"),t(this,"afterEachGuard"),t(this,"currentRoute",null),t(this,"listeners",new Set),t(this,"componentCache",new Map),t(this,"keepAliveCache",new Map),t(this,"keepAliveKeys",[]),t(this,"navigationId",0),t(this,"maxKeepAlive"),t(this,"isStarted",!1),t(this,"handleRouteChange",null),this.routes=e.routes,this.base=this.normalizeBase(e.base),this.mode=e.mode||"history",this.beforeEachGuard=e.beforeEach,this.afterEachGuard=e.afterEach,this.maxKeepAlive=e.maxKeepAlive}normalizeBase(e){let t=e||"/";return t.startsWith("/")||(t="/"+t),t.length>1&&t.endsWith("/")&&(t=t.slice(0,-1)),t}matchRoute(e="/"){return this.matchRouteInternal(e,new Set,0)}matchRouteInternal(t,i,r){if(r>=e.MAX_REDIRECTS)return s.IS_DEV&&console.error(`[Router] Too many redirects (max ${e.MAX_REDIRECTS}), last path: ${t}`),null;const a=this.normalizePath(t);if(i.has(a))return s.IS_DEV&&console.error(`[Router] Circular redirect detected: ${a}`),null;i.add(a);const[n,h]=a.split("?"),o=n.split("/").filter(Boolean),c=this.parseQuery(h),l=this.recursiveMatch(this.routes,o);if(l){const e=l.matched[l.matched.length-1];return e.config.redirect?this.matchRouteInternal(e.config.redirect,i,r+1):{matched:l.matched,params:l.params,query:c,fullPath:a,meta:l.matched.reduce((e,t)=>({...e,...t.config.meta||{}}),{})}}return null}recursiveMatch(e,t){const s=[...e].sort((e,t)=>this.calculateScore(t.path)-this.calculateScore(e.path));for(const i of s){const e=i.path.split("/").filter(Boolean),s={};let r=!0;if(0===e.length&&0===t.length)return{matched:[{config:i,params:{}}],params:{}};for(let i=0;i<e.length;i++){const a=e[i],n=t[i];if(a.startsWith(":")){if(!n){r=!1;break}Object.defineProperty(s,a.slice(1),{value:n,writable:!0,enumerable:!0,configurable:!0})}else{if("*"===a){r=!0;break}if(a!==n){r=!1;break}}}if(r){const r=e.length,a=t.slice(r),n={config:i,params:s};if(a.length>0&&i.children){const e=this.recursiveMatch(i.children,a);if(e)return{matched:[n,...e.matched],params:{...s,...e.params}}}else if(0===a.length||e.includes("*"))return{matched:[n],params:s}}}return null}calculateScore(e="/"){const t=e.split("/").filter(Boolean);return 0===t.length?1:t.reduce((e,t)=>t.startsWith(":")?e+5:"*"===t?e+0:e+10,0)}parseQuery(e){const t={};return e?(new URLSearchParams(e).forEach((e,s)=>{Object.defineProperty(t,s,{value:e,writable:!0,enumerable:!0,configurable:!0})}),t):t}normalizePath(e="/"){const t=e&&"string"==typeof e?e:"/",s=t.indexOf("?"),i=-1===s?t:t.slice(0,s),r=-1===s?"":t.slice(s+1);let a=i;return a.startsWith("/")||(a="/"+a),a.length>1&&a.endsWith("/")&&(a=a.slice(0,-1)),r?`${a}?${r}`:a}getPath(){let e;try{e="hash"===this.mode?window.location.hash.slice(1)||"/":`${window.location.pathname}${window.location.search}`}catch{e="/"}const t=this.base||"/";return"/"===t||e!==t&&!e.startsWith(t+"/")||(e=e.slice(t.length)||"/"),this.normalizePath(e)}updateBrowserHistory(e="/",t){const s=this.normalizePath(e),i=this.base||"/";if("hash"===this.mode)t?window.location.replace(`#${s}`):window.location.hash=s;else{const e=i.endsWith("/")?i.slice(0,-1):i,r="/"===e?s:e+s;t?window.history.replaceState({path:r},"",r):window.history.pushState({path:r},"",r)}}async navigate(e="/",t=!1,s=!1){const i=++this.navigationId,r=this.normalizePath(e),a=this.currentRoute,n=this.matchRoute(r);if(!n)return{success:!1,error:`No route matched: ${r}`};if(a&&a.fullPath===n.fullPath)return{success:!0};if(this.beforeEachGuard)try{const e=await this.beforeEachGuard(n,a);if(i!==this.navigationId)return{success:!1,cancelled:!0};if(!1===e)return{success:!1,cancelled:!0};if("string"==typeof e)return this.navigate(e,t)}catch(h){return i!==this.navigationId?{success:!1,cancelled:!0}:{success:!1,error:h instanceof Error?h.message:"Guard Error"}}return i!==this.navigationId?{success:!1,cancelled:!0}:(this.currentRoute=n,s||this.updateBrowserHistory(r,t),this.notifyListeners(),this.afterEachGuard&&this.afterEachGuard(n,a),{success:!0})}resolve(e="/"){const t=this.normalizePath(e);if("hash"===this.mode)return`#${t}`;const s=this.base.endsWith("/")?this.base.slice(0,-1):this.base;return"/"===s?t:s+t}get modeType(){return this.mode}pushWithQuery(e="/",t){const s=new URLSearchParams(t).toString(),i=e.includes("?")?"&":"?";return this.push(e+(s?i+s:""))}push(e="/"){return this.navigate(e,!1)}replace(e="/"){return this.navigate(e,!0)}back(){window.history.back()}forward(){window.history.forward()}listen(e){return this.listeners.add(e),()=>this.listeners.delete(e)}notifyListeners(){this.listeners.forEach(e=>e())}setupListeners(){this.isStarted||(this.isStarted=!0,this.handleRouteChange=()=>{this.navigate(this.getPath(),!0,!0)},"hash"===this.mode?window.addEventListener("hashchange",this.handleRouteChange):window.addEventListener("popstate",this.handleRouteChange),"hash"!==this.mode||window.location.hash||(window.location.hash="/"),this.navigate(this.getPath(),!0))}destroy(){this.handleRouteChange&&("hash"===this.mode?window.removeEventListener("hashchange",this.handleRouteChange):window.removeEventListener("popstate",this.handleRouteChange),this.handleRouteChange=null),this.isStarted=!1,this.listeners.clear(),this.componentCache.clear(),this.keepAliveCache.clear(),this.keepAliveKeys=[],this.currentRoute=null,i=null}getCurrentRoute(){return this.currentRoute}getKeepAlive(e){const t=this.keepAliveCache.get(e);if(t){const t=this.keepAliveKeys.indexOf(e);-1!==t&&(this.keepAliveKeys.splice(t,1),this.keepAliveKeys.push(e))}return t}setKeepAlive(e,t){if(this.keepAliveCache.has(e)){this.keepAliveCache.set(e,t);const s=this.keepAliveKeys.indexOf(e);-1!==s&&(this.keepAliveKeys.splice(s,1),this.keepAliveKeys.push(e))}else this.keepAliveCache.set(e,t),this.keepAliveKeys.push(e),this.evictKeepAlive()}hasKeepAlive(e){return this.keepAliveCache.has(e)}evictKeepAlive(){if(this.maxKeepAlive)for(;this.keepAliveKeys.length>this.maxKeepAlive;){const e=this.keepAliveKeys.shift();e&&this.keepAliveCache.delete(e)}}cacheKey(e){return this.normalizePath(e)}prefetch(e){const t=this.matchRoute(e);if(!t)return;const s=this.cacheKey(t.fullPath),i=t.matched[t.matched.length-1];if(!(null==i?void 0:i.config.component))return;const r=i.config.component;if("function"!=typeof r)return;if(this.componentCache.has(s))return;const a=r();this.componentCache.set(s,a),a.catch(()=>{this.componentCache.delete(s)})}getComponentFromCache(e){return this.componentCache.get(this.cacheKey(e))}};t(o,"MAX_REDIRECTS",20);let c=o;exports.Router=c,exports.createRouter=function(e){return i||(i=new c(e),r&&r(i),r=null,a=null,i)},exports.getRouter=function(){return i},exports.routerReady=h;
@@ -33,6 +33,7 @@ export declare class Router {
33
33
  private navigationId;
34
34
  private maxKeepAlive;
35
35
  constructor(options: RouterOptions);
36
+ private normalizeBase;
36
37
  private static readonly MAX_REDIRECTS;
37
38
  matchRoute(path?: string): RouteMatch | null;
38
39
  private matchRouteInternal;
@@ -1 +1 @@
1
- var e=Object.defineProperty,t=(t,s,i)=>((t,s,i)=>s in t?e(t,s,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[s]=i)(t,"symbol"!=typeof s?s+"":s,i);import{IS_DEV as s}from"../shared/env.js";let i=null,a=null,r=null;function n(){return i?Promise.resolve(i):(r||(r=new Promise(e=>{a=e})),r)}const h=(()=>{const e=()=>n();return Object.defineProperties(e,{then:{value:(e,t)=>n().then(e,t),writable:!1,enumerable:!1,configurable:!0},catch:{value:e=>n().catch(e),writable:!1,enumerable:!1,configurable:!0},finally:{value:e=>n().finally(e),writable:!1,enumerable:!1,configurable:!0},[Symbol.toStringTag]:{value:"Promise",writable:!1,enumerable:!1,configurable:!0}}),e})();function o(e){return i||(i=new u(e),a&&a(i),a=null,r=null,i)}function c(){return i}const l=class e{constructor(e){t(this,"routes"),t(this,"base"),t(this,"mode"),t(this,"beforeEachGuard"),t(this,"afterEachGuard"),t(this,"currentRoute",null),t(this,"listeners",new Set),t(this,"componentCache",new Map),t(this,"keepAliveCache",new Map),t(this,"keepAliveKeys",[]),t(this,"navigationId",0),t(this,"maxKeepAlive"),t(this,"isStarted",!1),t(this,"handleRouteChange",null),this.routes=e.routes,this.base=e.base??"/",this.mode=e.mode||"history",this.beforeEachGuard=e.beforeEach,this.afterEachGuard=e.afterEach,this.maxKeepAlive=e.maxKeepAlive}matchRoute(e="/"){return this.matchRouteInternal(e,new Set,0)}matchRouteInternal(t,i,a){if(a>=e.MAX_REDIRECTS)return s&&console.error(`[Router] Too many redirects (max ${e.MAX_REDIRECTS}), last path: ${t}`),null;const r=this.normalizePath(t);if(i.has(r))return s&&console.error(`[Router] Circular redirect detected: ${r}`),null;i.add(r);const[n,h]=r.split("?"),o=n.split("/").filter(Boolean),c=this.parseQuery(h),l=this.recursiveMatch(this.routes,o);if(l){const e=l.matched[l.matched.length-1];return e.config.redirect?this.matchRouteInternal(e.config.redirect,i,a+1):{matched:l.matched,params:l.params,query:c,fullPath:r,meta:l.matched.reduce((e,t)=>({...e,...t.config.meta||{}}),{})}}return null}recursiveMatch(e,t){const s=[...e].sort((e,t)=>this.calculateScore(t.path)-this.calculateScore(e.path));for(const i of s){const e=i.path.split("/").filter(Boolean),s={};let a=!0;if(0===e.length&&0===t.length)return{matched:[{config:i,params:{}}],params:{}};for(let i=0;i<e.length;i++){const r=e[i],n=t[i];if(r.startsWith(":")){if(!n){a=!1;break}s[r.slice(1)]=n}else{if("*"===r){a=!0;break}if(r!==n){a=!1;break}}}if(a){const a=e.length,r=t.slice(a),n={config:i,params:s};if(r.length>0&&i.children){const e=this.recursiveMatch(i.children,r);if(e)return{matched:[n,...e.matched],params:{...s,...e.params}}}else if(0===r.length||e.includes("*"))return{matched:[n],params:s}}}return null}calculateScore(e="/"){const t=e.split("/").filter(Boolean);return 0===t.length?1:t.reduce((e,t)=>t.startsWith(":")?e+5:"*"===t?e+0:e+10,0)}parseQuery(e){const t={};return e?(new URLSearchParams(e).forEach((e,s)=>{t[s]=e}),t):t}normalizePath(e="/"){const t=e&&"string"==typeof e?e:"/",s=t.indexOf("?"),i=-1===s?t:t.slice(0,s),a=-1===s?"":t.slice(s+1);let r=i;return r.startsWith("/")||(r="/"+r),r.length>1&&r.endsWith("/")&&(r=r.slice(0,-1)),a?`${r}?${a}`:r}getPath(){let e;try{e="hash"===this.mode?window.location.hash.slice(1)||"/":`${window.location.pathname}${window.location.search}`}catch{e="/"}const t=this.base||"/";return"/"!==t&&e.startsWith(t)&&(e=e.slice(t.length)||"/"),this.normalizePath(e)}updateBrowserHistory(e="/",t){const s=this.normalizePath(e),i=this.base||"/";if("hash"===this.mode)t?window.location.replace(`#${s}`):window.location.hash=s;else{const e=i.endsWith("/")?i.slice(0,-1):i,a="/"===e?s:e+s;t?window.history.replaceState({path:a},"",a):window.history.pushState({path:a},"",a)}}async navigate(e="/",t=!1,s=!1){const i=++this.navigationId,a=this.normalizePath(e),r=this.currentRoute,n=this.matchRoute(a);if(!n)return{success:!1,error:`No route matched: ${a}`};if(r&&r.fullPath===n.fullPath)return{success:!0};if(this.beforeEachGuard)try{const e=await this.beforeEachGuard(n,r);if(i!==this.navigationId)return{success:!1,cancelled:!0};if(!1===e)return{success:!1,cancelled:!0};if("string"==typeof e)return this.navigate(e,t)}catch(h){return i!==this.navigationId?{success:!1,cancelled:!0}:{success:!1,error:h instanceof Error?h.message:"Guard Error"}}return i!==this.navigationId?{success:!1,cancelled:!0}:(this.currentRoute=n,s||this.updateBrowserHistory(a,t),this.notifyListeners(),this.afterEachGuard&&this.afterEachGuard(n,r),{success:!0})}resolve(e="/"){const t=this.normalizePath(e);if("hash"===this.mode)return`#${t}`;const s=this.base.endsWith("/")?this.base.slice(0,-1):this.base;return"/"===s?t:s+t}get modeType(){return this.mode}pushWithQuery(e="/",t){const s=new URLSearchParams(t).toString(),i=e.includes("?")?"&":"?";return this.push(e+(s?i+s:""))}push(e="/"){return this.navigate(e,!1)}replace(e="/"){return this.navigate(e,!0)}back(){window.history.back()}forward(){window.history.forward()}listen(e){return this.listeners.add(e),()=>this.listeners.delete(e)}notifyListeners(){this.listeners.forEach(e=>e())}setupListeners(){this.isStarted||(this.isStarted=!0,this.handleRouteChange=()=>{this.navigate(this.getPath(),!0,!0)},"hash"===this.mode?window.addEventListener("hashchange",this.handleRouteChange):window.addEventListener("popstate",this.handleRouteChange),"hash"!==this.mode||window.location.hash||(window.location.hash="/"),this.navigate(this.getPath(),!0))}destroy(){this.handleRouteChange&&("hash"===this.mode?window.removeEventListener("hashchange",this.handleRouteChange):window.removeEventListener("popstate",this.handleRouteChange),this.handleRouteChange=null),this.isStarted=!1,this.listeners.clear(),this.componentCache.clear(),this.keepAliveCache.clear(),this.keepAliveKeys=[],this.currentRoute=null,i=null}getCurrentRoute(){return this.currentRoute}getKeepAlive(e){const t=this.keepAliveCache.get(e);if(t){const t=this.keepAliveKeys.indexOf(e);-1!==t&&(this.keepAliveKeys.splice(t,1),this.keepAliveKeys.push(e))}return t}setKeepAlive(e,t){if(this.keepAliveCache.has(e)){this.keepAliveCache.set(e,t);const s=this.keepAliveKeys.indexOf(e);-1!==s&&(this.keepAliveKeys.splice(s,1),this.keepAliveKeys.push(e))}else this.keepAliveCache.set(e,t),this.keepAliveKeys.push(e),this.evictKeepAlive()}hasKeepAlive(e){return this.keepAliveCache.has(e)}evictKeepAlive(){if(this.maxKeepAlive)for(;this.keepAliveKeys.length>this.maxKeepAlive;){const e=this.keepAliveKeys.shift();e&&this.keepAliveCache.delete(e)}}cacheKey(e){return this.normalizePath(e)}prefetch(e){const t=this.matchRoute(e);if(!t)return;const s=this.cacheKey(t.fullPath),i=t.matched[t.matched.length-1];if(!(null==i?void 0:i.config.component))return;const a=i.config.component;if("function"!=typeof a)return;if(this.componentCache.has(s))return;const r=a();this.componentCache.set(s,r),r.catch(()=>{this.componentCache.delete(s)})}getComponentFromCache(e){return this.componentCache.get(this.cacheKey(e))}};t(l,"MAX_REDIRECTS",20);let u=l;export{u as Router,o as createRouter,c as getRouter,h as routerReady};
1
+ var e=Object.defineProperty,t=(t,s,i)=>((t,s,i)=>s in t?e(t,s,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[s]=i)(t,"symbol"!=typeof s?s+"":s,i);import{IS_DEV as s}from"../shared/env.js";let i=null,a=null,r=null;function n(){return i?Promise.resolve(i):(r||(r=new Promise(e=>{a=e})),r)}const h=(()=>{const e=()=>n();return Object.defineProperties(e,{then:{value:(e,t)=>n().then(e,t),writable:!1,enumerable:!1,configurable:!0},catch:{value:e=>n().catch(e),writable:!1,enumerable:!1,configurable:!0},finally:{value:e=>n().finally(e),writable:!1,enumerable:!1,configurable:!0},[Symbol.toStringTag]:{value:"Promise",writable:!1,enumerable:!1,configurable:!0}}),e})();function o(e){return i||(i=new u(e),a&&a(i),a=null,r=null,i)}function c(){return i}const l=class e{constructor(e){t(this,"routes"),t(this,"base"),t(this,"mode"),t(this,"beforeEachGuard"),t(this,"afterEachGuard"),t(this,"currentRoute",null),t(this,"listeners",new Set),t(this,"componentCache",new Map),t(this,"keepAliveCache",new Map),t(this,"keepAliveKeys",[]),t(this,"navigationId",0),t(this,"maxKeepAlive"),t(this,"isStarted",!1),t(this,"handleRouteChange",null),this.routes=e.routes,this.base=this.normalizeBase(e.base),this.mode=e.mode||"history",this.beforeEachGuard=e.beforeEach,this.afterEachGuard=e.afterEach,this.maxKeepAlive=e.maxKeepAlive}normalizeBase(e){let t=e||"/";return t.startsWith("/")||(t="/"+t),t.length>1&&t.endsWith("/")&&(t=t.slice(0,-1)),t}matchRoute(e="/"){return this.matchRouteInternal(e,new Set,0)}matchRouteInternal(t,i,a){if(a>=e.MAX_REDIRECTS)return s&&console.error(`[Router] Too many redirects (max ${e.MAX_REDIRECTS}), last path: ${t}`),null;const r=this.normalizePath(t);if(i.has(r))return s&&console.error(`[Router] Circular redirect detected: ${r}`),null;i.add(r);const[n,h]=r.split("?"),o=n.split("/").filter(Boolean),c=this.parseQuery(h),l=this.recursiveMatch(this.routes,o);if(l){const e=l.matched[l.matched.length-1];return e.config.redirect?this.matchRouteInternal(e.config.redirect,i,a+1):{matched:l.matched,params:l.params,query:c,fullPath:r,meta:l.matched.reduce((e,t)=>({...e,...t.config.meta||{}}),{})}}return null}recursiveMatch(e,t){const s=[...e].sort((e,t)=>this.calculateScore(t.path)-this.calculateScore(e.path));for(const i of s){const e=i.path.split("/").filter(Boolean),s={};let a=!0;if(0===e.length&&0===t.length)return{matched:[{config:i,params:{}}],params:{}};for(let i=0;i<e.length;i++){const r=e[i],n=t[i];if(r.startsWith(":")){if(!n){a=!1;break}Object.defineProperty(s,r.slice(1),{value:n,writable:!0,enumerable:!0,configurable:!0})}else{if("*"===r){a=!0;break}if(r!==n){a=!1;break}}}if(a){const a=e.length,r=t.slice(a),n={config:i,params:s};if(r.length>0&&i.children){const e=this.recursiveMatch(i.children,r);if(e)return{matched:[n,...e.matched],params:{...s,...e.params}}}else if(0===r.length||e.includes("*"))return{matched:[n],params:s}}}return null}calculateScore(e="/"){const t=e.split("/").filter(Boolean);return 0===t.length?1:t.reduce((e,t)=>t.startsWith(":")?e+5:"*"===t?e+0:e+10,0)}parseQuery(e){const t={};return e?(new URLSearchParams(e).forEach((e,s)=>{Object.defineProperty(t,s,{value:e,writable:!0,enumerable:!0,configurable:!0})}),t):t}normalizePath(e="/"){const t=e&&"string"==typeof e?e:"/",s=t.indexOf("?"),i=-1===s?t:t.slice(0,s),a=-1===s?"":t.slice(s+1);let r=i;return r.startsWith("/")||(r="/"+r),r.length>1&&r.endsWith("/")&&(r=r.slice(0,-1)),a?`${r}?${a}`:r}getPath(){let e;try{e="hash"===this.mode?window.location.hash.slice(1)||"/":`${window.location.pathname}${window.location.search}`}catch{e="/"}const t=this.base||"/";return"/"===t||e!==t&&!e.startsWith(t+"/")||(e=e.slice(t.length)||"/"),this.normalizePath(e)}updateBrowserHistory(e="/",t){const s=this.normalizePath(e),i=this.base||"/";if("hash"===this.mode)t?window.location.replace(`#${s}`):window.location.hash=s;else{const e=i.endsWith("/")?i.slice(0,-1):i,a="/"===e?s:e+s;t?window.history.replaceState({path:a},"",a):window.history.pushState({path:a},"",a)}}async navigate(e="/",t=!1,s=!1){const i=++this.navigationId,a=this.normalizePath(e),r=this.currentRoute,n=this.matchRoute(a);if(!n)return{success:!1,error:`No route matched: ${a}`};if(r&&r.fullPath===n.fullPath)return{success:!0};if(this.beforeEachGuard)try{const e=await this.beforeEachGuard(n,r);if(i!==this.navigationId)return{success:!1,cancelled:!0};if(!1===e)return{success:!1,cancelled:!0};if("string"==typeof e)return this.navigate(e,t)}catch(h){return i!==this.navigationId?{success:!1,cancelled:!0}:{success:!1,error:h instanceof Error?h.message:"Guard Error"}}return i!==this.navigationId?{success:!1,cancelled:!0}:(this.currentRoute=n,s||this.updateBrowserHistory(a,t),this.notifyListeners(),this.afterEachGuard&&this.afterEachGuard(n,r),{success:!0})}resolve(e="/"){const t=this.normalizePath(e);if("hash"===this.mode)return`#${t}`;const s=this.base.endsWith("/")?this.base.slice(0,-1):this.base;return"/"===s?t:s+t}get modeType(){return this.mode}pushWithQuery(e="/",t){const s=new URLSearchParams(t).toString(),i=e.includes("?")?"&":"?";return this.push(e+(s?i+s:""))}push(e="/"){return this.navigate(e,!1)}replace(e="/"){return this.navigate(e,!0)}back(){window.history.back()}forward(){window.history.forward()}listen(e){return this.listeners.add(e),()=>this.listeners.delete(e)}notifyListeners(){this.listeners.forEach(e=>e())}setupListeners(){this.isStarted||(this.isStarted=!0,this.handleRouteChange=()=>{this.navigate(this.getPath(),!0,!0)},"hash"===this.mode?window.addEventListener("hashchange",this.handleRouteChange):window.addEventListener("popstate",this.handleRouteChange),"hash"!==this.mode||window.location.hash||(window.location.hash="/"),this.navigate(this.getPath(),!0))}destroy(){this.handleRouteChange&&("hash"===this.mode?window.removeEventListener("hashchange",this.handleRouteChange):window.removeEventListener("popstate",this.handleRouteChange),this.handleRouteChange=null),this.isStarted=!1,this.listeners.clear(),this.componentCache.clear(),this.keepAliveCache.clear(),this.keepAliveKeys=[],this.currentRoute=null,i=null}getCurrentRoute(){return this.currentRoute}getKeepAlive(e){const t=this.keepAliveCache.get(e);if(t){const t=this.keepAliveKeys.indexOf(e);-1!==t&&(this.keepAliveKeys.splice(t,1),this.keepAliveKeys.push(e))}return t}setKeepAlive(e,t){if(this.keepAliveCache.has(e)){this.keepAliveCache.set(e,t);const s=this.keepAliveKeys.indexOf(e);-1!==s&&(this.keepAliveKeys.splice(s,1),this.keepAliveKeys.push(e))}else this.keepAliveCache.set(e,t),this.keepAliveKeys.push(e),this.evictKeepAlive()}hasKeepAlive(e){return this.keepAliveCache.has(e)}evictKeepAlive(){if(this.maxKeepAlive)for(;this.keepAliveKeys.length>this.maxKeepAlive;){const e=this.keepAliveKeys.shift();e&&this.keepAliveCache.delete(e)}}cacheKey(e){return this.normalizePath(e)}prefetch(e){const t=this.matchRoute(e);if(!t)return;const s=this.cacheKey(t.fullPath),i=t.matched[t.matched.length-1];if(!(null==i?void 0:i.config.component))return;const a=i.config.component;if("function"!=typeof a)return;if(this.componentCache.has(s))return;const r=a();this.componentCache.set(s,r),r.catch(()=>{this.componentCache.delete(s)})}getComponentFromCache(e){return this.componentCache.get(this.cacheKey(e))}};t(l,"MAX_REDIRECTS",20);let u=l;export{u as Router,o as createRouter,c as getRouter,h as routerReady};
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("./core.cjs"),e=require("./router-link.html.cjs"),a=require("../runtime/component/base-element.cjs"),s=require("../runtime/component/decorators.cjs");Object.getOwnPropertyDescriptor;var r,o=t=>{throw TypeError(t)},n=(t,e,a)=>e.has(t)||o("Cannot "+a);exports.default=class extends a.default{constructor(){var t,e;super(...arguments),t=this,(e=r).has(t)?o("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,false)}set to(t){this.$data.to=t,this.updateState()}get to(){return this.$data.to}async mounted(){(await t.routerReady()).listen(()=>this.updateState()),this.updateState(),this.addEventListener("click",e=>{var a,s;e.defaultPrevented||e.ctrlKey||e.metaKey||e.shiftKey||e.altKey||0===e.button&&((null==(a=e.target.closest("a"))?void 0:a.getAttribute("target"))||(e.preventDefault(),null==(s=t.getRouter())||s.push(this.$data.to)))}),this.addEventListener("mouseenter",()=>{this.prefetchRoute()},{once:!0})}updateState(){const e=t.getRouter();if(!e)return;this.$data.href=e.resolve(this.$data.to);let a=!1;if(this.$data.active)a=!0;else{const t=e.getCurrentRoute();if(t){const e=t.fullPath;a=this.hasAttribute("exact")?e===this.$data.to:e===this.$data.to||e.startsWith(this.$data.to+"/")}}this.$data.isActive=a;const s=this.$data.activeClass||"active";this.classList.toggle(s,a)}prefetchRoute(){if(n(this,e=r,"read from private field"),e.get(this)||!this.hasAttribute("prefetch"))return;var e;const a=t.getRouter();a&&(a.prefetch(this.$data.to),((t,e)=>{n(t,e,"write to private field"),e.set(t,!0)})(this,r))}},r=new WeakMap,exports.default=((t,e)=>{for(var a,s=e,r=t.length-1;r>=0;r--)(a=t[r])&&(s=a(s)||s);return s})([s.CustomElement({tagName:"router-link",template:e.__SOLELY_IR__,styles:"\n :host {\n }\n\n a {\n text-decoration: none;\n color: inherit;\n cursor: pointer;\n }\n\n /* 内部 <a> 标签的默认高亮 */\n a.active {\n font-weight: 600;\n }\n\n /* custom 模式:消除包裹 a 标签的视觉/布局影响,由 slot 内部元素接管 */\n :host([custom]) a {\n display: contents;\n }\n ",shadowDOM:{use:!0,mode:"open"},props:["to","active","exact","label","custom","activeClass","prefetch"]})],exports.default);
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("./core.cjs"),e=require("./router-link.html.cjs"),s=require("../runtime/component/base-element.cjs"),a=require("../runtime/component/decorators.cjs");var i,n=Object.defineProperty,r=(Object.getOwnPropertyDescriptor,t=>{throw TypeError(t)}),o=(t,e,s)=>((t,e,s)=>e in t?n(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s)(t,"symbol"!=typeof e?e+"":e,s),u=(t,e,s)=>e.has(t)||r("Cannot "+s);exports.default=class extends s.default{constructor(){var e,s;super(...arguments),e=this,(s=i).has(e)?r("Cannot add the same private member more than once"):s instanceof WeakSet?s.add(e):s.set(e,false),o(this,"unsubscribe"),o(this,"mountVersion",0),o(this,"handleClick",e=>{var s,a;e.defaultPrevented||e.ctrlKey||e.metaKey||e.shiftKey||e.altKey||0===e.button&&((null==(s=e.target.closest("a"))?void 0:s.getAttribute("target"))||(e.preventDefault(),null==(a=t.getRouter())||a.push(this.$data.to)))}),o(this,"handleMouseEnter",()=>{this.prefetchRoute()})}set to(t){this.$data.to=t,this.updateState()}get to(){return this.$data.to}async mounted(){const e=++this.mountVersion,s=await t.routerReady();this.mountVersion===e&&(this.unsubscribe=s.listen(()=>this.updateState()),this.updateState(),this.addEventListener("click",this.handleClick),this.addEventListener("mouseenter",this.handleMouseEnter,{once:!0}))}unmounted(){var t;this.mountVersion++,null==(t=this.unsubscribe)||t.call(this),this.unsubscribe=void 0,this.removeEventListener("click",this.handleClick),this.removeEventListener("mouseenter",this.handleMouseEnter)}updateState(){const e=t.getRouter();if(!e)return;this.$data.href=e.resolve(this.$data.to);let s=!1;if(this.$data.active)s=!0;else{const t=e.getCurrentRoute();if(t){const e=t.fullPath;if(this.hasAttribute("exact"))s=e===this.$data.to;else{const t=e.split("?")[0],a=this.$data.to.split("?")[0];s=t===a||t.startsWith(a+"/")}}}this.$data.isActive=s;const a=this.$data.activeClass||"active";this.classList.toggle(a,s)}prefetchRoute(){if(u(this,e=i,"read from private field"),e.get(this)||!this.hasAttribute("prefetch"))return;var e;const s=t.getRouter();s&&(s.prefetch(this.$data.to),((t,e)=>{u(t,e,"write to private field"),e.set(t,!0)})(this,i))}},i=new WeakMap,exports.default=((t,e)=>{for(var s,a=e,i=t.length-1;i>=0;i--)(s=t[i])&&(a=s(a)||a);return a})([a.CustomElement({tagName:"router-link",template:e.__SOLELY_IR__,styles:"\n :host {\n }\n\n a {\n text-decoration: none;\n color: inherit;\n cursor: pointer;\n }\n\n /* 内部 <a> 标签的默认高亮 */\n a.active {\n font-weight: 600;\n }\n\n /* custom 模式:消除包裹 a 标签的视觉/布局影响,由 slot 内部元素接管 */\n :host([custom]) a {\n display: contents;\n }\n ",shadowDOM:{use:!0,mode:"open"},props:["to","active","exact","label","custom","activeClass","prefetch"]})],exports.default);
@@ -12,7 +12,12 @@ declare class RouterLink extends BaseElement<{
12
12
  #private;
13
13
  set to(value: string);
14
14
  get to(): string;
15
+ private unsubscribe?;
16
+ private mountVersion;
17
+ private readonly handleClick;
18
+ private readonly handleMouseEnter;
15
19
  mounted(): Promise<void>;
20
+ unmounted(): void;
16
21
  updateState(): void;
17
22
  private prefetchRoute;
18
23
  }
@@ -1 +1 @@
1
- import{routerReady as t,getRouter as e}from"./core.js";import{__SOLELY_IR__ as a}from"./router-link.html.js";import s from"../runtime/component/base-element.js";import{CustomElement as r}from"../runtime/component/decorators.js";Object.getOwnPropertyDescriptor;var o,n=t=>{throw TypeError(t)},i=(t,e,a)=>e.has(t)||n("Cannot "+a);let h=class extends s{constructor(){var t,e;super(...arguments),t=this,(e=o).has(t)?n("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,false)}set to(t){this.$data.to=t,this.updateState()}get to(){return this.$data.to}async mounted(){(await t()).listen(()=>this.updateState()),this.updateState(),this.addEventListener("click",t=>{var a,s;t.defaultPrevented||t.ctrlKey||t.metaKey||t.shiftKey||t.altKey||0===t.button&&((null==(a=t.target.closest("a"))?void 0:a.getAttribute("target"))||(t.preventDefault(),null==(s=e())||s.push(this.$data.to)))}),this.addEventListener("mouseenter",()=>{this.prefetchRoute()},{once:!0})}updateState(){const t=e();if(!t)return;this.$data.href=t.resolve(this.$data.to);let a=!1;if(this.$data.active)a=!0;else{const e=t.getCurrentRoute();if(e){const t=e.fullPath;a=this.hasAttribute("exact")?t===this.$data.to:t===this.$data.to||t.startsWith(this.$data.to+"/")}}this.$data.isActive=a;const s=this.$data.activeClass||"active";this.classList.toggle(s,a)}prefetchRoute(){if(i(this,t=o,"read from private field"),t.get(this)||!this.hasAttribute("prefetch"))return;var t;const a=e();a&&(a.prefetch(this.$data.to),((t,e)=>{i(t,e,"write to private field"),e.set(t,!0)})(this,o))}};o=new WeakMap,h=((t,e)=>{for(var a,s=e,r=t.length-1;r>=0;r--)(a=t[r])&&(s=a(s)||s);return s})([r({tagName:"router-link",template:a,styles:"\n :host {\n }\n\n a {\n text-decoration: none;\n color: inherit;\n cursor: pointer;\n }\n\n /* 内部 <a> 标签的默认高亮 */\n a.active {\n font-weight: 600;\n }\n\n /* custom 模式:消除包裹 a 标签的视觉/布局影响,由 slot 内部元素接管 */\n :host([custom]) a {\n display: contents;\n }\n ",shadowDOM:{use:!0,mode:"open"},props:["to","active","exact","label","custom","activeClass","prefetch"]})],h);export{h as default};
1
+ import{routerReady as t,getRouter as e}from"./core.js";import{__SOLELY_IR__ as s}from"./router-link.html.js";import i from"../runtime/component/base-element.js";import{CustomElement as n}from"../runtime/component/decorators.js";var a,r=Object.defineProperty,o=(Object.getOwnPropertyDescriptor,t=>{throw TypeError(t)}),h=(t,e,s)=>((t,e,s)=>e in t?r(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s)(t,"symbol"!=typeof e?e+"":e,s),l=(t,e,s)=>e.has(t)||o("Cannot "+s);let c=class extends i{constructor(){var t,s;super(...arguments),t=this,(s=a).has(t)?o("Cannot add the same private member more than once"):s instanceof WeakSet?s.add(t):s.set(t,false),h(this,"unsubscribe"),h(this,"mountVersion",0),h(this,"handleClick",t=>{var s,i;t.defaultPrevented||t.ctrlKey||t.metaKey||t.shiftKey||t.altKey||0===t.button&&((null==(s=t.target.closest("a"))?void 0:s.getAttribute("target"))||(t.preventDefault(),null==(i=e())||i.push(this.$data.to)))}),h(this,"handleMouseEnter",()=>{this.prefetchRoute()})}set to(t){this.$data.to=t,this.updateState()}get to(){return this.$data.to}async mounted(){const e=++this.mountVersion,s=await t();this.mountVersion===e&&(this.unsubscribe=s.listen(()=>this.updateState()),this.updateState(),this.addEventListener("click",this.handleClick),this.addEventListener("mouseenter",this.handleMouseEnter,{once:!0}))}unmounted(){var t;this.mountVersion++,null==(t=this.unsubscribe)||t.call(this),this.unsubscribe=void 0,this.removeEventListener("click",this.handleClick),this.removeEventListener("mouseenter",this.handleMouseEnter)}updateState(){const t=e();if(!t)return;this.$data.href=t.resolve(this.$data.to);let s=!1;if(this.$data.active)s=!0;else{const e=t.getCurrentRoute();if(e){const t=e.fullPath;if(this.hasAttribute("exact"))s=t===this.$data.to;else{const e=t.split("?")[0],i=this.$data.to.split("?")[0];s=e===i||e.startsWith(i+"/")}}}this.$data.isActive=s;const i=this.$data.activeClass||"active";this.classList.toggle(i,s)}prefetchRoute(){if(l(this,t=a,"read from private field"),t.get(this)||!this.hasAttribute("prefetch"))return;var t;const s=e();s&&(s.prefetch(this.$data.to),((t,e)=>{l(t,e,"write to private field"),e.set(t,!0)})(this,a))}};a=new WeakMap,c=((t,e)=>{for(var s,i=e,n=t.length-1;n>=0;n--)(s=t[n])&&(i=s(i)||i);return i})([n({tagName:"router-link",template:s,styles:"\n :host {\n }\n\n a {\n text-decoration: none;\n color: inherit;\n cursor: pointer;\n }\n\n /* 内部 <a> 标签的默认高亮 */\n a.active {\n font-weight: 600;\n }\n\n /* custom 模式:消除包裹 a 标签的视觉/布局影响,由 slot 内部元素接管 */\n :host([custom]) a {\n display: contents;\n }\n ",shadowDOM:{use:!0,mode:"open"},props:["to","active","exact","label","custom","activeClass","prefetch"]})],c);export{c as default};
@@ -1 +1 @@
1
- "use strict";var t,e,s,i,a,r,n,o,h,l,c,u,d,p,f,b,m,y,v,w,g,S,M,O,$,k,j,W,C,N,A,E=Object.defineProperty,P=t=>{throw TypeError(t)},L=(t,e,s)=>e.has(t)||P("Cannot "+s),D=(t,e,s)=>(L(t,e,"read from private field"),s?s.call(t):e.get(t)),q=(t,e,s)=>e.has(t)?P("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,s),U=(t,e,s,i)=>(L(t,e,"write to private field"),i?i.call(t,s):e.set(t,s),s),_=(t,e,s)=>(L(t,e,"access private method"),s);Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const R=require("../../shared/is-object.cjs"),T=require("../../shared/env.cjs"),x=require("../../shared/case-convert.cjs"),I=require("../reactivity/observe.cjs"),V=require("../renderer/renderIR.cjs"),H=Symbol.for("solely.manifest"),J=class extends HTMLElement{constructor(m={}){var y,w;super(),q(this,v),((t,e,s)=>{e in t?E(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s})(this,"symbol"!=typeof(w="$refs")?w+"":w,{}),q(this,t),q(this,e),q(this,s),q(this,i),q(this,a),q(this,r),q(this,n,!1),q(this,o,!1),q(this,h,!1),q(this,l,!1),q(this,c,!1),q(this,u,!1),q(this,d,!1),q(this,p,new Set),q(this,f,!1),q(this,b,!1);const S=this.constructor;U(this,t,S[H]||{tagName:"base-element"});const O=D(this,t);U(this,a,(null==(y=O.shadowDOM)?void 0:y.use)?this.attachShadow({mode:O.shadowDOM.mode||"open"}):this),_(this,v,g).call(this,m),_(this,v,M).call(this,O),queueMicrotask(()=>_(this,v,A).call(this))}static get observedAttributes(){const t=this[H];return(null==t?void 0:t.attributeMap)?Array.from(t.attributeMap.keys()):[]}get $data(){return D(this,i)}set $data(t){var e;R.isObject(t)||(t={}),t!==D(this,i)&&(null==(e=D(this,r))||e.call(this),_(this,v,g).call(this,t),_(this,v,$).call(this),_(this,v,j).call(this))}refresh(){_(this,v,j).call(this)}connectedCallback(){if(D(this,f))throw this.remove(),new Error(`[Solely] <${this.tagName.toLowerCase()}> has been disposed and cannot be reconnected.`);U(this,c,!0);const i=D(this,t);if(_(this,v,A).call(this),(i.className||i.tagName||"").split(" ").forEach(t=>t&&this.classList.add(t)),_(this,v,C).call(this),i.attributeMap&&R.isObject(this.$data)){_(this,v,$).call(this);for(const[t,e]of i.attributeMap){const s=e.name;if(this.hasAttribute(t)){const i=this.getAttribute(t),a=_(this,v,k).call(this,i,e.default,e.type);this.$data[s]=a}else"default"in e&&void 0===this.$data[s]&&(this.$data[s]=e.default,"boolean"===e.type&&!0===e.default&&this.setAttribute(t,""))}}_(this,v,w).call(this),D(this,s)&&!D(this,e)&&U(this,e,V.createRender(D(this,s),D(this,a),this)),D(this,u)&&(U(this,u,!1),_(this,v,j).call(this)),this.mounted()}disconnectedCallback(){U(this,c,!1),D(this,f)||_(this,v,N).call(this),this.unmounted()}attributeChangedCallback(e,s,i){var a;if(D(this,f)||s===i||!R.isObject(this.$data))return;if(D(this,p).has(e))return;const r=null==(a=D(this,t).attributeMap)?void 0:a.get(e);if(!r)return;const n=r.name,o=this.$data[n],l=_(this,v,k).call(this,i,r.default??o,r.type);o!==l&&(U(this,h,!0),this.$data[n]=l,this.attributeChanged(e,o,l))}emit(t,e,s){D(this,f)||this.dispatchEvent(new CustomEvent(t,{bubbles:!0,composed:!0,detail:e,...s}))}emitNative(t,e){D(this,f)||this.dispatchEvent(new Event(t,{bubbles:!0,composed:!0,...e}))}warn(t,e){if(T.IS_DEV&&t){const t=this.tagName.toLowerCase();console.warn(`[${t}] ${e}`)}}error(t,e){if(T.IS_DEV&&t){const t=this.tagName.toLowerCase();console.error(`[${t}] ${e}`)}}dispose(){var t,s;D(this,f)||(U(this,f,!0),U(this,c,!1),_(this,v,N).call(this),null==(t=D(this,e))||t.destroy(),U(this,e,void 0),null==(s=D(this,r))||s.call(this),U(this,r,void 0),this.remove())}created(){}mounted(){}beforeUpdate(){}updated(){}unmounted(){}attributeChanged(t,e,s){}beforeAttributesUpdate(){}afterAttributesUpdate(){}};t=new WeakMap,e=new WeakMap,s=new WeakMap,i=new WeakMap,a=new WeakMap,r=new WeakMap,n=new WeakMap,o=new WeakMap,h=new WeakMap,l=new WeakMap,c=new WeakMap,u=new WeakMap,d=new WeakMap,p=new WeakMap,f=new WeakMap,b=new WeakMap,m=new WeakMap,y=new WeakMap,v=new WeakSet,w=function(){const t=Object.getOwnPropertyNames(this),e=["#","_"],s=D(J,y),i=new Map;let a=Object.getPrototypeOf(this);for(;a&&a!==HTMLElement.prototype;){const t=Object.getOwnPropertyDescriptors(a);for(const[e,s]of Object.entries(t))s.set&&!i.has(e)&&i.set(e,s);a=Object.getPrototypeOf(a)}for(const r of t){if(s.has(r))continue;if(e.some(t=>r.startsWith(t)))continue;const t=Object.getOwnPropertyDescriptor(this,r);if(!t||!("value"in t))continue;const a=t.value,n=i.get(r);(null==n?void 0:n.set)&&(delete this[r],this[r]=a)}},g=function(e){const{proxy:s,dispose:a}=I.observe(e,e=>{var s;if("set"===e.type){const{key:i,newValue:a}=e,r=D(this,t),n=String(i),o=null==(s=r.propMap)?void 0:s.get(n);(null==o?void 0:o.reflect)&&_(this,v,S).call(this,o,a)}this.emit("dataChange",{...e}),_(this,v,j).call(this)});U(this,i,s),U(this,r,a)},S=function(t,e){const s=x.camelToKebab(t.name);D(this,p).add(s);try{if(null==e)return void this.removeAttribute(s);if("boolean"===t.type)e?this.setAttribute(s,""):this.removeAttribute(s);else{const t="object"==typeof e?JSON.stringify(e):String(e);this.setAttribute(s,t)}}finally{D(this,p).delete(s)}},M=function(t){t.ir&&U(this,s,t.ir)},O=function(){const e=D(this,t);if(e.attributeMap)for(const[,t]of e.attributeMap){if(!1===t.reactive)continue;let e,s=Object.getPrototypeOf(this);for(;s&&s!==HTMLElement.prototype&&(e=Object.getOwnPropertyDescriptor(s,t.name),!e);)s=Object.getPrototypeOf(s);if(!(null==e?void 0:e.get)&&!(null==e?void 0:e.set)){const e=Object.getOwnPropertyDescriptor(this,t.name);e&&"value"in e&&(this.$data[t.name]=e.value,delete this[t.name]),Object.defineProperty(this,t.name,{get:()=>this.$data[t.name],set:e=>{this.$data[t.name]=e},configurable:!0,enumerable:!0})}}},$=function(){D(this,d)||(U(this,d,!0),_(this,v,O).call(this))},k=function(t,e,s){if(null===t)return"boolean"!==s&&e;switch(s){case"boolean":return!0;case"number":{const s=Number(t);return isNaN(s)?e:s}case"object":try{return JSON.parse(t)}catch(i){return console.error(`[Solely] Failed to parse object value: "${t}", using default value.`,i),e}case"array":try{const s=JSON.parse(t);return Array.isArray(s)?s:e}catch(i){return console.error(`[Solely] Failed to parse array value: "${t}", using default value.`,i),e}default:return t}},j=function(){D(this,f)||(D(this,c)?!D(this,o)&&D(this,e)&&(U(this,o,!0),queueMicrotask(()=>{D(this,f)||(U(this,o,!1),_(this,v,W).call(this))})):U(this,u,!0))},W=function(){var t;if(!D(this,f)&&!D(this,n)&&D(this,c)){U(this,n,!0);try{D(this,h)&&this.beforeAttributesUpdate(),this.beforeUpdate(),null==(t=D(this,e))||t.update(),this.updated(),D(this,h)&&(this.afterAttributesUpdate(),U(this,h,!1))}finally{U(this,n,!1)}}},C=function(){var e;const s=D(this,t);if(!s.styles)return;const i=D(this,a);if(s.sheet&&i instanceof ShadowRoot&&"adoptedStyleSheets"in i){if(!i.adoptedStyleSheets.includes(s.sheet)){const t=Array.from(i.adoptedStyleSheets);t.push(s.sheet),i.adoptedStyleSheets=t}return void U(this,b,!0)}const r=i instanceof ShadowRoot?i:document.head,n=`solely-style-${T.SOLELY_VERSION}-${s.tagName}`,o=!(null==(e=s.shadowDOM)?void 0:e.use),h="undefined"!=typeof CSS&&CSS.escape?CSS.escape(n):n.replace(/([.#:[\]()!])/g,"\\$1");if(!r.querySelector(`#${h}`)){const t=document.createElement("style");t.id=n,t.textContent=s.styles,r.appendChild(t)}if(o){const t=D(J,m).get(n)||0;D(J,m).set(n,t+1),U(this,b,!0)}},N=function(){var e,s;if(!D(this,b))return;U(this,b,!1);const i=D(this,t);if(!(null==(e=i.shadowDOM)?void 0:e.use)&&i.styles){const t=`solely-style-${T.SOLELY_VERSION}-${i.tagName}`,e=D(J,m).get(t)||0;if(e<=1){const e=CSS.escape(t);null==(s=document.head.querySelector(`#${e}`))||s.remove(),D(J,m).delete(t)}else D(J,m).set(t,e-1)}},A=function(){D(this,l)||(U(this,l,!0),this.created())},q(J,m,new Map),q(J,y,new Set(["$data","$refs","constructor","created","mounted","beforeUpdate","updated","unmounted","attributeChanged","beforeAttributesUpdate","afterAttributesUpdate","emit","emitNative","refresh","dispose","warn","error"]));let F=J;exports.default=F;
1
+ "use strict";var t,e,s,i,a,r,n,o,h,l,c,u,d,p,f,b,m,y,v,w,S,g,M,O,$,k,j,C,W,N,A,E=Object.defineProperty,P=t=>{throw TypeError(t)},L=(t,e,s)=>e.has(t)||P("Cannot "+s),D=(t,e,s)=>(L(t,e,"read from private field"),s?s.call(t):e.get(t)),q=(t,e,s)=>e.has(t)?P("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,s),U=(t,e,s,i)=>(L(t,e,"write to private field"),i?i.call(t,s):e.set(t,s),s),_=(t,e,s)=>(L(t,e,"access private method"),s);Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const R=require("../../shared/is-object.cjs"),T=require("../../shared/env.cjs"),x=require("../../shared/case-convert.cjs"),I=require("../reactivity/observe.cjs"),V=require("../renderer/renderIR.cjs"),H=Symbol.for("solely.manifest"),J=class extends HTMLElement{constructor(m={}){var y,w;super(),q(this,v),((t,e,s)=>{e in t?E(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s})(this,"symbol"!=typeof(w="$refs")?w+"":w,{}),q(this,t),q(this,e),q(this,s),q(this,i),q(this,a),q(this,r),q(this,n,!1),q(this,o,!1),q(this,h,!1),q(this,l,!1),q(this,c,!1),q(this,u,!1),q(this,d,!1),q(this,p,new Set),q(this,f,!1),q(this,b,!1);const g=this.constructor;U(this,t,g[H]||{tagName:"base-element"});const O=D(this,t);U(this,a,(null==(y=O.shadowDOM)?void 0:y.use)?this.attachShadow({mode:O.shadowDOM.mode||"open"}):this),_(this,v,S).call(this,m),_(this,v,M).call(this,O),queueMicrotask(()=>_(this,v,A).call(this))}static get observedAttributes(){const t=this[H];return(null==t?void 0:t.attributeMap)?Array.from(t.attributeMap.keys()):[]}get $data(){return D(this,i)}set $data(t){var e;R.isObject(t)||(t={}),t!==D(this,i)&&(null==(e=D(this,r))||e.call(this),_(this,v,S).call(this,t),_(this,v,$).call(this),_(this,v,j).call(this))}refresh(){_(this,v,j).call(this)}connectedCallback(){if(D(this,f))throw this.remove(),new Error(`[Solely] <${this.tagName.toLowerCase()}> has been disposed and cannot be reconnected.`);U(this,c,!0);const i=D(this,t);if(_(this,v,A).call(this),(i.className||i.tagName||"").split(" ").forEach(t=>t&&this.classList.add(t)),_(this,v,W).call(this),i.attributeMap&&R.isObject(this.$data)){_(this,v,$).call(this);for(const[t,e]of i.attributeMap){const s=e.name;if(this.hasAttribute(t)){const i=this.getAttribute(t),a=_(this,v,k).call(this,i,e.default,e.type);this.$data[s]=a}else"default"in e&&void 0===this.$data[s]&&(this.$data[s]=e.default,"boolean"===e.type&&!0===e.default&&this.setAttribute(t,""))}}_(this,v,w).call(this),D(this,s)&&!D(this,e)&&U(this,e,V.createRender(D(this,s),D(this,a),this)),D(this,u)&&(U(this,u,!1),_(this,v,j).call(this)),this.mounted()}disconnectedCallback(){U(this,c,!1),D(this,f)||_(this,v,N).call(this),this.unmounted()}attributeChangedCallback(e,s,i){var a;if(D(this,f)||s===i||!R.isObject(this.$data))return;if(D(this,p).has(e))return;const r=null==(a=D(this,t).attributeMap)?void 0:a.get(e);if(!r)return;const n=r.name,o=this.$data[n],l=_(this,v,k).call(this,i,r.default??o,r.type);o!==l&&(U(this,h,!0),this.$data[n]=l,this.attributeChanged(e,o,l))}emit(t,e,s){D(this,f)||this.dispatchEvent(new CustomEvent(t,{bubbles:!0,composed:!0,detail:e,...s}))}emitNative(t,e){D(this,f)||this.dispatchEvent(new Event(t,{bubbles:!0,composed:!0,...e}))}warn(t,e){if(T.IS_DEV&&t){const t=this.tagName.toLowerCase();console.warn(`[${t}] ${e}`)}}error(t,e){if(T.IS_DEV&&t){const t=this.tagName.toLowerCase();console.error(`[${t}] ${e}`)}}dispose(){var t,s;D(this,f)||(U(this,f,!0),U(this,c,!1),_(this,v,N).call(this),null==(t=D(this,e))||t.destroy(),U(this,e,void 0),null==(s=D(this,r))||s.call(this),U(this,r,void 0),this.remove())}created(){}mounted(){}beforeUpdate(){}updated(){}unmounted(){}attributeChanged(t,e,s){}beforeAttributesUpdate(){}afterAttributesUpdate(){}};t=new WeakMap,e=new WeakMap,s=new WeakMap,i=new WeakMap,a=new WeakMap,r=new WeakMap,n=new WeakMap,o=new WeakMap,h=new WeakMap,l=new WeakMap,c=new WeakMap,u=new WeakMap,d=new WeakMap,p=new WeakMap,f=new WeakMap,b=new WeakMap,m=new WeakMap,y=new WeakMap,v=new WeakSet,w=function(){const t=Object.getOwnPropertyNames(this),e=["#","_"],s=D(J,y),i=new Map;let a=Object.getPrototypeOf(this);for(;a&&a!==HTMLElement.prototype;){const t=Object.getOwnPropertyDescriptors(a);for(const[e,s]of Object.entries(t))s.set&&!i.has(e)&&i.set(e,s);a=Object.getPrototypeOf(a)}for(const r of t){if(s.has(r))continue;if(e.some(t=>r.startsWith(t)))continue;const t=Object.getOwnPropertyDescriptor(this,r);if(!t||!("value"in t))continue;const a=t.value,n=i.get(r);(null==n?void 0:n.set)&&(delete this[r],this[r]=a)}},S=function(e){const{proxy:s,dispose:a}=I.observe(e,e=>{var s;if("set"===e.type){const{key:i,newValue:a}=e,r=D(this,t),n=String(i),o=null==(s=r.propMap)?void 0:s.get(n);(null==o?void 0:o.reflect)&&_(this,v,g).call(this,o,a)}this.emit("dataChange",{...e}),_(this,v,j).call(this)});U(this,i,s),U(this,r,a)},g=function(t,e){const s=x.camelToKebab(t.name);D(this,p).add(s);try{if(null==e)return void this.removeAttribute(s);if("boolean"===t.type)e?this.setAttribute(s,""):this.removeAttribute(s);else{const t="object"==typeof e?JSON.stringify(e):String(e);this.setAttribute(s,t)}}finally{D(this,p).delete(s)}},M=function(t){t.ir&&U(this,s,t.ir)},O=function(){const e=D(this,t);if(e.attributeMap)for(const[,t]of e.attributeMap){if(!1===t.reactive)continue;let e,s=Object.getPrototypeOf(this);for(;s&&s!==HTMLElement.prototype&&(e=Object.getOwnPropertyDescriptor(s,t.name),!e);)s=Object.getPrototypeOf(s);if(!(null==e?void 0:e.get)&&!(null==e?void 0:e.set)){const e=Object.getOwnPropertyDescriptor(this,t.name);e&&"value"in e&&(this.$data[t.name]=e.value,delete this[t.name]),Object.defineProperty(this,t.name,{get:()=>this.$data[t.name],set:e=>{this.$data[t.name]=e},configurable:!0,enumerable:!0})}}},$=function(){D(this,d)||(U(this,d,!0),_(this,v,O).call(this))},k=function(t,e,s){if(null===t)return"boolean"!==s&&e;switch(s){case"boolean":return!0;case"number":{const s=Number(t);return isNaN(s)?e:s}case"object":try{return JSON.parse(t)}catch(i){return console.error(`[Solely] Failed to parse object value: "${t}", using default value.`,i),e}case"array":try{const s=JSON.parse(t);return Array.isArray(s)?s:e}catch(i){return console.error(`[Solely] Failed to parse array value: "${t}", using default value.`,i),e}default:return t}},j=function(){D(this,f)||(D(this,c)?!D(this,o)&&D(this,e)&&(U(this,o,!0),queueMicrotask(()=>{D(this,f)||(U(this,o,!1),_(this,v,C).call(this))})):U(this,u,!0))},C=function(){var t;if(!D(this,f)&&!D(this,n)&&D(this,c)){U(this,n,!0);try{D(this,h)&&this.beforeAttributesUpdate(),this.beforeUpdate(),null==(t=D(this,e))||t.update(),this.updated(),D(this,h)&&(this.afterAttributesUpdate(),U(this,h,!1))}finally{U(this,n,!1)}}},W=function(){var e;const s=D(this,t);if(!s.styles)return;const i=D(this,a);if(s.sheet&&i instanceof ShadowRoot&&"adoptedStyleSheets"in i){if(!i.adoptedStyleSheets.includes(s.sheet)){const t=Array.from(i.adoptedStyleSheets);t.push(s.sheet),i.adoptedStyleSheets=t}return void U(this,b,!0)}const r=i instanceof ShadowRoot?i:document.head,n=`solely-style-${T.SOLELY_VERSION}-${s.tagName}`,o=!(null==(e=s.shadowDOM)?void 0:e.use),h="undefined"!=typeof CSS&&CSS.escape?CSS.escape(n):n.replace(/([.#:[\]()!])/g,"\\$1");if(!r.querySelector(`#${h}`)){const t=document.createElement("style");t.id=n,t.textContent=s.styles,r.appendChild(t)}if(o){const t=D(J,m).get(n)||0;D(J,m).set(n,t+1),U(this,b,!0)}},N=function(){var e,s;if(!D(this,b))return;U(this,b,!1);const i=D(this,t);if(!(null==(e=i.shadowDOM)?void 0:e.use)&&i.styles){const t=`solely-style-${T.SOLELY_VERSION}-${i.tagName}`,e=D(J,m).get(t)||0;if(e<=1){const e="undefined"!=typeof CSS&&CSS.escape?CSS.escape(t):t.replace(/([.#:[\]()!])/g,"\\$1");null==(s=document.head.querySelector(`#${e}`))||s.remove(),D(J,m).delete(t)}else D(J,m).set(t,e-1)}},A=function(){D(this,l)||(U(this,l,!0),this.created())},q(J,m,new Map),q(J,y,new Set(["$data","$refs","constructor","created","mounted","beforeUpdate","updated","unmounted","attributeChanged","beforeAttributesUpdate","afterAttributesUpdate","emit","emitNative","refresh","dispose","warn","error"]));let F=J;exports.default=F;
@@ -1 +1 @@
1
- var t,e,s,i,a,r,o,n,h,l,c,d,u,p,f,b,m,y,v,w,g,M,S,$,O,k,j,W,C,A,N,E=Object.defineProperty,P=t=>{throw TypeError(t)},U=(t,e,s)=>e.has(t)||P("Cannot "+s),D=(t,e,s)=>(U(t,e,"read from private field"),s?s.call(t):e.get(t)),L=(t,e,s)=>e.has(t)?P("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,s),q=(t,e,s,i)=>(U(t,e,"write to private field"),i?i.call(t,s):e.set(t,s),s),x=(t,e,s)=>(U(t,e,"access private method"),s);import{isObject as T}from"../../shared/is-object.js";import{SOLELY_VERSION as H,IS_DEV as J}from"../../shared/env.js";import{camelToKebab as R}from"../../shared/case-convert.js";import{observe as F}from"../reactivity/observe.js";import{createRender as I}from"../renderer/renderIR.js";const V=Symbol.for("solely.manifest"),_=class extends HTMLElement{constructor(m={}){var y,w;super(),L(this,v),((t,e,s)=>{e in t?E(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s})(this,"symbol"!=typeof(w="$refs")?w+"":w,{}),L(this,t),L(this,e),L(this,s),L(this,i),L(this,a),L(this,r),L(this,o,!1),L(this,n,!1),L(this,h,!1),L(this,l,!1),L(this,c,!1),L(this,d,!1),L(this,u,!1),L(this,p,new Set),L(this,f,!1),L(this,b,!1);const M=this.constructor;q(this,t,M[V]||{tagName:"base-element"});const $=D(this,t);q(this,a,(null==(y=$.shadowDOM)?void 0:y.use)?this.attachShadow({mode:$.shadowDOM.mode||"open"}):this),x(this,v,g).call(this,m),x(this,v,S).call(this,$),queueMicrotask(()=>x(this,v,N).call(this))}static get observedAttributes(){const t=this[V];return(null==t?void 0:t.attributeMap)?Array.from(t.attributeMap.keys()):[]}get $data(){return D(this,i)}set $data(t){var e;T(t)||(t={}),t!==D(this,i)&&(null==(e=D(this,r))||e.call(this),x(this,v,g).call(this,t),x(this,v,O).call(this),x(this,v,j).call(this))}refresh(){x(this,v,j).call(this)}connectedCallback(){if(D(this,f))throw this.remove(),new Error(`[Solely] <${this.tagName.toLowerCase()}> has been disposed and cannot be reconnected.`);q(this,c,!0);const i=D(this,t);if(x(this,v,N).call(this),(i.className||i.tagName||"").split(" ").forEach(t=>t&&this.classList.add(t)),x(this,v,C).call(this),i.attributeMap&&T(this.$data)){x(this,v,O).call(this);for(const[t,e]of i.attributeMap){const s=e.name;if(this.hasAttribute(t)){const i=this.getAttribute(t),a=x(this,v,k).call(this,i,e.default,e.type);this.$data[s]=a}else"default"in e&&void 0===this.$data[s]&&(this.$data[s]=e.default,"boolean"===e.type&&!0===e.default&&this.setAttribute(t,""))}}x(this,v,w).call(this),D(this,s)&&!D(this,e)&&q(this,e,I(D(this,s),D(this,a),this)),D(this,d)&&(q(this,d,!1),x(this,v,j).call(this)),this.mounted()}disconnectedCallback(){q(this,c,!1),D(this,f)||x(this,v,A).call(this),this.unmounted()}attributeChangedCallback(e,s,i){var a;if(D(this,f)||s===i||!T(this.$data))return;if(D(this,p).has(e))return;const r=null==(a=D(this,t).attributeMap)?void 0:a.get(e);if(!r)return;const o=r.name,n=this.$data[o],l=x(this,v,k).call(this,i,r.default??n,r.type);n!==l&&(q(this,h,!0),this.$data[o]=l,this.attributeChanged(e,n,l))}emit(t,e,s){D(this,f)||this.dispatchEvent(new CustomEvent(t,{bubbles:!0,composed:!0,detail:e,...s}))}emitNative(t,e){D(this,f)||this.dispatchEvent(new Event(t,{bubbles:!0,composed:!0,...e}))}warn(t,e){if(J&&t){const t=this.tagName.toLowerCase();console.warn(`[${t}] ${e}`)}}error(t,e){if(J&&t){const t=this.tagName.toLowerCase();console.error(`[${t}] ${e}`)}}dispose(){var t,s;D(this,f)||(q(this,f,!0),q(this,c,!1),x(this,v,A).call(this),null==(t=D(this,e))||t.destroy(),q(this,e,void 0),null==(s=D(this,r))||s.call(this),q(this,r,void 0),this.remove())}created(){}mounted(){}beforeUpdate(){}updated(){}unmounted(){}attributeChanged(t,e,s){}beforeAttributesUpdate(){}afterAttributesUpdate(){}};t=new WeakMap,e=new WeakMap,s=new WeakMap,i=new WeakMap,a=new WeakMap,r=new WeakMap,o=new WeakMap,n=new WeakMap,h=new WeakMap,l=new WeakMap,c=new WeakMap,d=new WeakMap,u=new WeakMap,p=new WeakMap,f=new WeakMap,b=new WeakMap,m=new WeakMap,y=new WeakMap,v=new WeakSet,w=function(){const t=Object.getOwnPropertyNames(this),e=["#","_"],s=D(_,y),i=new Map;let a=Object.getPrototypeOf(this);for(;a&&a!==HTMLElement.prototype;){const t=Object.getOwnPropertyDescriptors(a);for(const[e,s]of Object.entries(t))s.set&&!i.has(e)&&i.set(e,s);a=Object.getPrototypeOf(a)}for(const r of t){if(s.has(r))continue;if(e.some(t=>r.startsWith(t)))continue;const t=Object.getOwnPropertyDescriptor(this,r);if(!t||!("value"in t))continue;const a=t.value,o=i.get(r);(null==o?void 0:o.set)&&(delete this[r],this[r]=a)}},g=function(e){const{proxy:s,dispose:a}=F(e,e=>{var s;if("set"===e.type){const{key:i,newValue:a}=e,r=D(this,t),o=String(i),n=null==(s=r.propMap)?void 0:s.get(o);(null==n?void 0:n.reflect)&&x(this,v,M).call(this,n,a)}this.emit("dataChange",{...e}),x(this,v,j).call(this)});q(this,i,s),q(this,r,a)},M=function(t,e){const s=R(t.name);D(this,p).add(s);try{if(null==e)return void this.removeAttribute(s);if("boolean"===t.type)e?this.setAttribute(s,""):this.removeAttribute(s);else{const t="object"==typeof e?JSON.stringify(e):String(e);this.setAttribute(s,t)}}finally{D(this,p).delete(s)}},S=function(t){t.ir&&q(this,s,t.ir)},$=function(){const e=D(this,t);if(e.attributeMap)for(const[,t]of e.attributeMap){if(!1===t.reactive)continue;let e,s=Object.getPrototypeOf(this);for(;s&&s!==HTMLElement.prototype&&(e=Object.getOwnPropertyDescriptor(s,t.name),!e);)s=Object.getPrototypeOf(s);if(!(null==e?void 0:e.get)&&!(null==e?void 0:e.set)){const e=Object.getOwnPropertyDescriptor(this,t.name);e&&"value"in e&&(this.$data[t.name]=e.value,delete this[t.name]),Object.defineProperty(this,t.name,{get:()=>this.$data[t.name],set:e=>{this.$data[t.name]=e},configurable:!0,enumerable:!0})}}},O=function(){D(this,u)||(q(this,u,!0),x(this,v,$).call(this))},k=function(t,e,s){if(null===t)return"boolean"!==s&&e;switch(s){case"boolean":return!0;case"number":{const s=Number(t);return isNaN(s)?e:s}case"object":try{return JSON.parse(t)}catch(i){return console.error(`[Solely] Failed to parse object value: "${t}", using default value.`,i),e}case"array":try{const s=JSON.parse(t);return Array.isArray(s)?s:e}catch(i){return console.error(`[Solely] Failed to parse array value: "${t}", using default value.`,i),e}default:return t}},j=function(){D(this,f)||(D(this,c)?!D(this,n)&&D(this,e)&&(q(this,n,!0),queueMicrotask(()=>{D(this,f)||(q(this,n,!1),x(this,v,W).call(this))})):q(this,d,!0))},W=function(){var t;if(!D(this,f)&&!D(this,o)&&D(this,c)){q(this,o,!0);try{D(this,h)&&this.beforeAttributesUpdate(),this.beforeUpdate(),null==(t=D(this,e))||t.update(),this.updated(),D(this,h)&&(this.afterAttributesUpdate(),q(this,h,!1))}finally{q(this,o,!1)}}},C=function(){var e;const s=D(this,t);if(!s.styles)return;const i=D(this,a);if(s.sheet&&i instanceof ShadowRoot&&"adoptedStyleSheets"in i){if(!i.adoptedStyleSheets.includes(s.sheet)){const t=Array.from(i.adoptedStyleSheets);t.push(s.sheet),i.adoptedStyleSheets=t}return void q(this,b,!0)}const r=i instanceof ShadowRoot?i:document.head,o=`solely-style-${H}-${s.tagName}`,n=!(null==(e=s.shadowDOM)?void 0:e.use),h="undefined"!=typeof CSS&&CSS.escape?CSS.escape(o):o.replace(/([.#:[\]()!])/g,"\\$1");if(!r.querySelector(`#${h}`)){const t=document.createElement("style");t.id=o,t.textContent=s.styles,r.appendChild(t)}if(n){const t=D(_,m).get(o)||0;D(_,m).set(o,t+1),q(this,b,!0)}},A=function(){var e,s;if(!D(this,b))return;q(this,b,!1);const i=D(this,t);if(!(null==(e=i.shadowDOM)?void 0:e.use)&&i.styles){const t=`solely-style-${H}-${i.tagName}`,e=D(_,m).get(t)||0;if(e<=1){const e=CSS.escape(t);null==(s=document.head.querySelector(`#${e}`))||s.remove(),D(_,m).delete(t)}else D(_,m).set(t,e-1)}},N=function(){D(this,l)||(q(this,l,!0),this.created())},L(_,m,new Map),L(_,y,new Set(["$data","$refs","constructor","created","mounted","beforeUpdate","updated","unmounted","attributeChanged","beforeAttributesUpdate","afterAttributesUpdate","emit","emitNative","refresh","dispose","warn","error"]));let z=_;export{z as default};
1
+ var t,e,s,i,a,r,o,n,h,l,c,d,u,p,f,b,m,y,v,w,g,S,M,$,O,k,C,j,W,A,N,E=Object.defineProperty,P=t=>{throw TypeError(t)},U=(t,e,s)=>e.has(t)||P("Cannot "+s),D=(t,e,s)=>(U(t,e,"read from private field"),s?s.call(t):e.get(t)),L=(t,e,s)=>e.has(t)?P("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,s),q=(t,e,s,i)=>(U(t,e,"write to private field"),i?i.call(t,s):e.set(t,s),s),x=(t,e,s)=>(U(t,e,"access private method"),s);import{isObject as T}from"../../shared/is-object.js";import{SOLELY_VERSION as H,IS_DEV as J}from"../../shared/env.js";import{camelToKebab as R}from"../../shared/case-convert.js";import{observe as F}from"../reactivity/observe.js";import{createRender as I}from"../renderer/renderIR.js";const V=Symbol.for("solely.manifest"),_=class extends HTMLElement{constructor(m={}){var y,w;super(),L(this,v),((t,e,s)=>{e in t?E(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s})(this,"symbol"!=typeof(w="$refs")?w+"":w,{}),L(this,t),L(this,e),L(this,s),L(this,i),L(this,a),L(this,r),L(this,o,!1),L(this,n,!1),L(this,h,!1),L(this,l,!1),L(this,c,!1),L(this,d,!1),L(this,u,!1),L(this,p,new Set),L(this,f,!1),L(this,b,!1);const S=this.constructor;q(this,t,S[V]||{tagName:"base-element"});const $=D(this,t);q(this,a,(null==(y=$.shadowDOM)?void 0:y.use)?this.attachShadow({mode:$.shadowDOM.mode||"open"}):this),x(this,v,g).call(this,m),x(this,v,M).call(this,$),queueMicrotask(()=>x(this,v,N).call(this))}static get observedAttributes(){const t=this[V];return(null==t?void 0:t.attributeMap)?Array.from(t.attributeMap.keys()):[]}get $data(){return D(this,i)}set $data(t){var e;T(t)||(t={}),t!==D(this,i)&&(null==(e=D(this,r))||e.call(this),x(this,v,g).call(this,t),x(this,v,O).call(this),x(this,v,C).call(this))}refresh(){x(this,v,C).call(this)}connectedCallback(){if(D(this,f))throw this.remove(),new Error(`[Solely] <${this.tagName.toLowerCase()}> has been disposed and cannot be reconnected.`);q(this,c,!0);const i=D(this,t);if(x(this,v,N).call(this),(i.className||i.tagName||"").split(" ").forEach(t=>t&&this.classList.add(t)),x(this,v,W).call(this),i.attributeMap&&T(this.$data)){x(this,v,O).call(this);for(const[t,e]of i.attributeMap){const s=e.name;if(this.hasAttribute(t)){const i=this.getAttribute(t),a=x(this,v,k).call(this,i,e.default,e.type);this.$data[s]=a}else"default"in e&&void 0===this.$data[s]&&(this.$data[s]=e.default,"boolean"===e.type&&!0===e.default&&this.setAttribute(t,""))}}x(this,v,w).call(this),D(this,s)&&!D(this,e)&&q(this,e,I(D(this,s),D(this,a),this)),D(this,d)&&(q(this,d,!1),x(this,v,C).call(this)),this.mounted()}disconnectedCallback(){q(this,c,!1),D(this,f)||x(this,v,A).call(this),this.unmounted()}attributeChangedCallback(e,s,i){var a;if(D(this,f)||s===i||!T(this.$data))return;if(D(this,p).has(e))return;const r=null==(a=D(this,t).attributeMap)?void 0:a.get(e);if(!r)return;const o=r.name,n=this.$data[o],l=x(this,v,k).call(this,i,r.default??n,r.type);n!==l&&(q(this,h,!0),this.$data[o]=l,this.attributeChanged(e,n,l))}emit(t,e,s){D(this,f)||this.dispatchEvent(new CustomEvent(t,{bubbles:!0,composed:!0,detail:e,...s}))}emitNative(t,e){D(this,f)||this.dispatchEvent(new Event(t,{bubbles:!0,composed:!0,...e}))}warn(t,e){if(J&&t){const t=this.tagName.toLowerCase();console.warn(`[${t}] ${e}`)}}error(t,e){if(J&&t){const t=this.tagName.toLowerCase();console.error(`[${t}] ${e}`)}}dispose(){var t,s;D(this,f)||(q(this,f,!0),q(this,c,!1),x(this,v,A).call(this),null==(t=D(this,e))||t.destroy(),q(this,e,void 0),null==(s=D(this,r))||s.call(this),q(this,r,void 0),this.remove())}created(){}mounted(){}beforeUpdate(){}updated(){}unmounted(){}attributeChanged(t,e,s){}beforeAttributesUpdate(){}afterAttributesUpdate(){}};t=new WeakMap,e=new WeakMap,s=new WeakMap,i=new WeakMap,a=new WeakMap,r=new WeakMap,o=new WeakMap,n=new WeakMap,h=new WeakMap,l=new WeakMap,c=new WeakMap,d=new WeakMap,u=new WeakMap,p=new WeakMap,f=new WeakMap,b=new WeakMap,m=new WeakMap,y=new WeakMap,v=new WeakSet,w=function(){const t=Object.getOwnPropertyNames(this),e=["#","_"],s=D(_,y),i=new Map;let a=Object.getPrototypeOf(this);for(;a&&a!==HTMLElement.prototype;){const t=Object.getOwnPropertyDescriptors(a);for(const[e,s]of Object.entries(t))s.set&&!i.has(e)&&i.set(e,s);a=Object.getPrototypeOf(a)}for(const r of t){if(s.has(r))continue;if(e.some(t=>r.startsWith(t)))continue;const t=Object.getOwnPropertyDescriptor(this,r);if(!t||!("value"in t))continue;const a=t.value,o=i.get(r);(null==o?void 0:o.set)&&(delete this[r],this[r]=a)}},g=function(e){const{proxy:s,dispose:a}=F(e,e=>{var s;if("set"===e.type){const{key:i,newValue:a}=e,r=D(this,t),o=String(i),n=null==(s=r.propMap)?void 0:s.get(o);(null==n?void 0:n.reflect)&&x(this,v,S).call(this,n,a)}this.emit("dataChange",{...e}),x(this,v,C).call(this)});q(this,i,s),q(this,r,a)},S=function(t,e){const s=R(t.name);D(this,p).add(s);try{if(null==e)return void this.removeAttribute(s);if("boolean"===t.type)e?this.setAttribute(s,""):this.removeAttribute(s);else{const t="object"==typeof e?JSON.stringify(e):String(e);this.setAttribute(s,t)}}finally{D(this,p).delete(s)}},M=function(t){t.ir&&q(this,s,t.ir)},$=function(){const e=D(this,t);if(e.attributeMap)for(const[,t]of e.attributeMap){if(!1===t.reactive)continue;let e,s=Object.getPrototypeOf(this);for(;s&&s!==HTMLElement.prototype&&(e=Object.getOwnPropertyDescriptor(s,t.name),!e);)s=Object.getPrototypeOf(s);if(!(null==e?void 0:e.get)&&!(null==e?void 0:e.set)){const e=Object.getOwnPropertyDescriptor(this,t.name);e&&"value"in e&&(this.$data[t.name]=e.value,delete this[t.name]),Object.defineProperty(this,t.name,{get:()=>this.$data[t.name],set:e=>{this.$data[t.name]=e},configurable:!0,enumerable:!0})}}},O=function(){D(this,u)||(q(this,u,!0),x(this,v,$).call(this))},k=function(t,e,s){if(null===t)return"boolean"!==s&&e;switch(s){case"boolean":return!0;case"number":{const s=Number(t);return isNaN(s)?e:s}case"object":try{return JSON.parse(t)}catch(i){return console.error(`[Solely] Failed to parse object value: "${t}", using default value.`,i),e}case"array":try{const s=JSON.parse(t);return Array.isArray(s)?s:e}catch(i){return console.error(`[Solely] Failed to parse array value: "${t}", using default value.`,i),e}default:return t}},C=function(){D(this,f)||(D(this,c)?!D(this,n)&&D(this,e)&&(q(this,n,!0),queueMicrotask(()=>{D(this,f)||(q(this,n,!1),x(this,v,j).call(this))})):q(this,d,!0))},j=function(){var t;if(!D(this,f)&&!D(this,o)&&D(this,c)){q(this,o,!0);try{D(this,h)&&this.beforeAttributesUpdate(),this.beforeUpdate(),null==(t=D(this,e))||t.update(),this.updated(),D(this,h)&&(this.afterAttributesUpdate(),q(this,h,!1))}finally{q(this,o,!1)}}},W=function(){var e;const s=D(this,t);if(!s.styles)return;const i=D(this,a);if(s.sheet&&i instanceof ShadowRoot&&"adoptedStyleSheets"in i){if(!i.adoptedStyleSheets.includes(s.sheet)){const t=Array.from(i.adoptedStyleSheets);t.push(s.sheet),i.adoptedStyleSheets=t}return void q(this,b,!0)}const r=i instanceof ShadowRoot?i:document.head,o=`solely-style-${H}-${s.tagName}`,n=!(null==(e=s.shadowDOM)?void 0:e.use),h="undefined"!=typeof CSS&&CSS.escape?CSS.escape(o):o.replace(/([.#:[\]()!])/g,"\\$1");if(!r.querySelector(`#${h}`)){const t=document.createElement("style");t.id=o,t.textContent=s.styles,r.appendChild(t)}if(n){const t=D(_,m).get(o)||0;D(_,m).set(o,t+1),q(this,b,!0)}},A=function(){var e,s;if(!D(this,b))return;q(this,b,!1);const i=D(this,t);if(!(null==(e=i.shadowDOM)?void 0:e.use)&&i.styles){const t=`solely-style-${H}-${i.tagName}`,e=D(_,m).get(t)||0;if(e<=1){const e="undefined"!=typeof CSS&&CSS.escape?CSS.escape(t):t.replace(/([.#:[\]()!])/g,"\\$1");null==(s=document.head.querySelector(`#${e}`))||s.remove(),D(_,m).delete(t)}else D(_,m).set(t,e-1)}},N=function(){D(this,l)||(q(this,l,!0),this.created())},L(_,m,new Map),L(_,y,new Set(["$data","$refs","constructor","created","mounted","beforeUpdate","updated","unmounted","attributeChanged","beforeAttributesUpdate","afterAttributesUpdate","emit","emitNative","refresh","dispose","warn","error"]));let z=_;export{z as default};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../shared/is-object.cjs"),t=Symbol("solely.raw"),n=new WeakMap,r=new WeakMap,i=new WeakMap,o=new WeakMap,s=new WeakMap;function c(e,t,n){l(e,t);let r=o.get(e);r||(r=new Map,o.set(e,r)),r.set(t,n);let i=s.get(n);i||(i=[],s.set(n,i)),i.some(n=>n.parentRef.deref()===e&&n.key===t)||i.push({parentRef:new WeakRef(e),key:t})}function l(e,t){const n=o.get(e);if(!n)return;const r=n.get(t);if(!r)return;n.delete(t);const i=s.get(r);if(i){const n=i.filter(n=>{const r=n.parentRef.deref();return void 0!==r&&!(r===e&&n.key===t)});0===n.length?s.delete(r):s.set(r,n)}}function a(t,n){const r=o.get(n);if(r)for(const e of r.keys())l(n,e);for(let i=0;i<t.length;i++){const r=t[i];e.isObject(r)&&!p(r)&&c(n,String(i),w(r))}}function f(e){if(e&&"object"==typeof e){const n=e[t];if(n)return n}return e}const u=Object.prototype.toString,p=e=>{if(!e||"object"!=typeof e)return!1;const t=u.call(e);return"[object Date]"===t||"[object RegExp]"===t||"[object Map]"===t||"[object Set]"===t||e instanceof File||e instanceof Blob||e instanceof FormData||e instanceof ArrayBuffer||e instanceof Response||e instanceof Request};function y(e){return!(!e||!e[t])}const h=new Map,g=(e,t)=>{if(0===t.length)return!0;const n=e.map(String);for(let r=n.length;r>0;r--){const e=n.slice(0,r).join(".");if(t.some(t=>t.test(e)))return!0}return!1},d=(e,t)=>{if(Object.is(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!d(e[n],t[n]))return!1;return!0}if(Array.isArray(e)!==Array.isArray(t))return!1;const n=Reflect.ownKeys(e),r=Reflect.ownKeys(t);if(n.length!==r.length)return!1;for(const i of n){if(!Reflect.has(t,i))return!1;if(!d(e[i],t[i]))return!1}return!0},b=(e,t)=>{e.active&&(e.deepCompare&&"set"===t.type&&d(t.oldValue,t.newValue)||(e.throttle>0?(e.pending.push(t),e.timer||(e.timer=setTimeout(()=>{if(!e.active)return;const t=[...e.pending];e.pending=[],e.timer=null,t.length>0&&(e.onBatch?e.onBatch(t):e.callback(t[t.length-1]))},e.throttle))):e.onBatch?e.onBatch([t]):e.callback(t)))},v=(e,t)=>{const n=[{node:e,relativePath:[],visited:new Set([e])}];let i=0;for(;i<n.length;){const{node:e,relativePath:o,visited:c}=n[i++],l=r.get(e);l&&l.forEach(e=>{if(!e.active)return;let n=o;if("set"===t.type||"delete"===t.type?n=[...o,t.key]:"array-push"!==t.type&&"array-splice"!==t.type||(n=[...o,String(t.index)]),!g(n,e.filterRegexes))return;const r={...t,path:n};b(e,r)});const a=s.get(e);if(a)for(let t=a.length-1;t>=0;t--){const e=a[t],r=e.parentRef.deref();if(!r){a.splice(t,1);continue}if(c.has(r))continue;const i=new Set(c);i.add(r),n.push({node:r,relativePath:[e.key,...o],visited:i})}}},R={};["push","pop","shift","unshift","splice"].forEach(t=>{R[t]=function(...n){const r=this,o=f(r),s=i.get(r)||0;i.set(r,s+1);try{const i=o.length,s=o[t].apply(o,n);if("push"===t){const t=o.length-n.length;for(let i=0;i<n.length;i++){const n=o[t+i];e.isObject(n)&&!p(n)&&c(r,String(t+i),w(n))}v(r,{type:"array-push",index:t,values:n})}else if("pop"===t)l(r,String(i-1)),v(r,{type:"array-splice",index:i-1,deleteCount:1,insert:[]});else if(a(o,r),"unshift"===t)v(r,{type:"array-push",index:0,values:n});else if("shift"===t)v(r,{type:"array-splice",index:0,deleteCount:1,insert:[]});else if("splice"===t){const[e,t,...i]=n;v(r,{type:"array-splice",index:e,deleteCount:t,insert:i})}return s}finally{i.set(r,s)}}}),["sort","reverse","fill","copyWithin"].forEach(e=>{R[e]=function(...t){const n=this,r=f(n),o=i.get(n)||0;i.set(n,o+1);try{const i=r[e].apply(r,t);return a(r,n),v(n,{type:"array-reset",method:e}),i}finally{i.set(n,o)}}}),["indexOf","lastIndexOf","includes"].forEach(e=>{R[e]=function(t,...n){const r=f(this);let i=r[e].apply(r,[t,...n]);return-1!==i&&!1!==i||!y(t)||(i=r[e].apply(r,[f(t),...n])),i}});const j={get(n,r,i){var s;if(r===t)return n;if(Array.isArray(n)&&Object.prototype.hasOwnProperty.call(R,r))return Reflect.get(R,r,i);const l=Reflect.get(n,r,i);if("symbol"==typeof r)return l;if(e.isObject(l)&&!p(l)){const e=w(l);return(null==(s=o.get(i))?void 0:s.get(r))!==e&&c(i,r,e),e}return l},set(t,n,r,o){const s=Reflect.get(t,n,o);if(Object.is(s,r))return!0;const a=Reflect.set(t,n,r,o);return!!a&&(e.isObject(r)&&!p(r)?c(o,n,w(r)):l(o,n),0===(i.get(o)||0)&&(!Array.isArray(t)&&Array.isArray(s)&&Array.isArray(r)?v(o,{type:"array-replace",oldValue:s,newValue:r}):v(o,{type:"set",key:n,newValue:r,oldValue:s})),a)},deleteProperty(e,t){if(!Reflect.has(e,t))return!1;const r=Reflect.get(e,t),o=Reflect.deleteProperty(e,t);if(o){const o=n.get(e);o&&(l(o,t),0===(i.get(o)||0)&&v(o,{type:"delete",key:t,oldValue:r}))}return o}};function w(e){if(!Object.isExtensible(e))return e;if(p(e))return e;if(e[t])return e;const r=n.get(e);if(r)return r;const i=new Proxy(e,j);return n.set(e,i),i}exports.isProxy=y,exports.observe=function(t,n,i={}){const{throttle:o=0,onBatch:s,immediate:c=!1,deepCompare:l}=i,a={callback:n,onBatch:s,throttle:o,filterRegexes:(Array.isArray(i.filter)?i.filter:i.filter?[i.filter]:[]).map(e=>{if(""===e)return/^.*$/;const t=h.get(e);if(t)return t;let n="";for(let c=0;c<e.length;c++){const t=e[c];"*"===t&&"*"===e[c+1]?(n+="**",c++):"*"===t?n+="*":"."===t?n+=".":/[.*+?^${}()|[\]\\]/.test(t)?n+="\\"+t:n+=t}const r=n.split("."),i=[];for(let c=0;c<r.length;c++){const e=r[c];"**"===e?1===r.length?i.push(".*"):0===c?i.push("(?:[^.]+\\.)*"):i.push("(?:\\.[^.]+)*"):"*"===e?i.push("[^.]+"):i.push(e)}let o="^";for(let c=0;c<i.length;c++)if(o+=i[c],c<i.length-1){const e=i[c],t=i[c+1];if(e.endsWith("\\.)*"))continue;if(t.startsWith("(?:\\."))continue;o+="\\."}o+="$";const s=new RegExp(o);return h.set(e,s),s}),pending:[],timer:null,active:!0,deepCompare:l},u=w(t);let y=r.get(u);if(y||(y=new Set,r.set(u,y)),y.add(a),c){const n=[...y],r=(t,i,o=[],s=new WeakSet)=>{e.isObject(t)&&!s.has(t)&&(s.add(t),Reflect.ownKeys(t).forEach(c=>{const l=Reflect.get(t,c);if(e.isObject(l)&&s.has(l))return;const a=Reflect.get(i,c),f=[...o,c];n.forEach(e=>{g(f,e.filterRegexes)&&b(e,{type:"set",key:c,newValue:l,oldValue:void 0,path:f})}),e.isObject(l)&&!p(l)&&r(l,a,f,s)}))};r(f(t),u)}const d=()=>{const e=r.get(u);e&&(e.delete(a),0===e.size&&r.delete(u)),a.pending=[],a.timer&&(clearTimeout(a.timer),a.timer=null)};return{proxy:u,unobserve:()=>{a.active&&(a.active=!1,d())},resume:()=>{a.active||(a.active=!0,(()=>{let e=r.get(u);e||(e=new Set,r.set(u,e)),e.add(a)})())},dispose:()=>{if(!a.active)return a.callback=()=>{},void(a.onBatch=void 0);a.active=!1,d(),a.callback=()=>{},a.onBatch=void 0}}},exports.toProxy=function(e){return e&&"object"==typeof e&&"proxy"in e?e.proxy:e},exports.toRaw=f;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../shared/is-object.cjs"),t=Symbol("solely.raw"),n=new WeakMap,r=new WeakMap,o=new WeakMap,i=new WeakMap,s=new WeakMap;function c(e,t,n){l(e,t);let r=i.get(e);r||(r=new Map,i.set(e,r)),r.set(t,n);let o=s.get(n);o||(o=[],s.set(n,o)),o.some(n=>n.parentRef.deref()===e&&n.key===t)||o.push({parentRef:new WeakRef(e),key:t})}function l(e,t){const n=i.get(e);if(!n)return;const r=n.get(t);if(!r)return;n.delete(t);const o=s.get(r);if(o){const n=o.filter(n=>{const r=n.parentRef.deref();return void 0!==r&&!(r===e&&n.key===t)});0===n.length?s.delete(r):s.set(r,n)}}function a(t,n){const r=i.get(n);if(r)for(const e of r.keys())l(n,e);for(let o=0;o<t.length;o++){const r=t[o];e.isObject(r)&&!p(r)&&c(n,String(o),m(r))}}function f(e){if(e&&"object"==typeof e){const n=e[t];if(n)return n}return e}const u=Object.prototype.toString,p=e=>{if(!e||"object"!=typeof e)return!1;const t=u.call(e);return"[object Date]"===t||"[object RegExp]"===t||"[object Map]"===t||"[object Set]"===t||"undefined"!=typeof File&&e instanceof File||"undefined"!=typeof Blob&&e instanceof Blob||"undefined"!=typeof FormData&&e instanceof FormData||"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer||"undefined"!=typeof Response&&e instanceof Response||"undefined"!=typeof Request&&e instanceof Request};function y(e){return!(!e||!e[t])}const h=new Map,d=(e,t)=>{if(0===t.length)return!0;const n=e.map(String);for(let r=n.length;r>0;r--){const e=n.slice(0,r).join(".");if(t.some(t=>t.test(e)))return!0}return!1},g=(e,t)=>{if(Object.is(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!g(e[n],t[n]))return!1;return!0}if(Array.isArray(e)!==Array.isArray(t))return!1;const n=Reflect.ownKeys(e),r=Reflect.ownKeys(t);if(n.length!==r.length)return!1;for(const o of n){if(!Reflect.has(t,o))return!1;if(!g(e[o],t[o]))return!1}return!0},b=(e,t)=>{e.active&&(e.deepCompare&&"set"===t.type&&g(t.oldValue,t.newValue)||(e.throttle>0?(e.pending.push(t),e.timer||(e.timer=setTimeout(()=>{if(!e.active)return;const t=[...e.pending];e.pending=[],e.timer=null,t.length>0&&(e.onBatch?e.onBatch(t):e.callback(t[t.length-1]))},e.throttle))):e.onBatch?e.onBatch([t]):e.callback(t)))},v=(e,t)=>{const n=[{node:e,relativePath:[],visited:new Set([e])}];let o=0;for(;o<n.length;){const{node:e,relativePath:i,visited:c}=n[o++],l=r.get(e);l&&l.forEach(e=>{if(!e.active)return;let n=i;if("set"===t.type||"delete"===t.type?n=[...i,t.key]:"array-push"!==t.type&&"array-splice"!==t.type||(n=[...i,String(t.index)]),!d(n,e.filterRegexes))return;const r={...t,path:n};b(e,r)});const a=s.get(e);if(a)for(let t=a.length-1;t>=0;t--){const e=a[t],r=e.parentRef.deref();if(!r){a.splice(t,1);continue}if(c.has(r))continue;const o=new Set(c);o.add(r),n.push({node:r,relativePath:[e.key,...i],visited:o})}}},R={};["push","pop","shift","unshift","splice"].forEach(t=>{R[t]=function(...n){const r=this,i=f(r),s=o.get(r)||0;o.set(r,s+1);try{const o=i.length,s=i[t].apply(i,n);if("push"===t){const t=i.length-n.length;for(let o=0;o<n.length;o++){const n=i[t+o];e.isObject(n)&&!p(n)&&c(r,String(t+o),m(n))}v(r,{type:"array-push",index:t,values:n})}else if("pop"===t)l(r,String(o-1)),v(r,{type:"array-splice",index:o-1,deleteCount:1,insert:[]});else if(a(i,r),"unshift"===t)v(r,{type:"array-push",index:0,values:n});else if("shift"===t)v(r,{type:"array-splice",index:0,deleteCount:1,insert:[]});else if("splice"===t){const[e,t,...o]=n;v(r,{type:"array-splice",index:e,deleteCount:t,insert:o})}return s}finally{o.set(r,s)}}}),["sort","reverse","fill","copyWithin"].forEach(e=>{R[e]=function(...t){const n=this,r=f(n),i=o.get(n)||0;o.set(n,i+1);try{const o=r[e].apply(r,t);return a(r,n),v(n,{type:"array-reset",method:e}),o}finally{o.set(n,i)}}}),["indexOf","lastIndexOf","includes"].forEach(e=>{R[e]=function(t,...n){const r=f(this);let o=r[e].apply(r,[t,...n]);return-1!==o&&!1!==o||!y(t)||(o=r[e].apply(r,[f(t),...n])),o}});const j={get(n,r,o){var s;if(r===t)return n;if(Array.isArray(n)&&Object.prototype.hasOwnProperty.call(R,r))return Reflect.get(R,r,o);const l=Reflect.get(n,r,o);if("symbol"==typeof r)return l;if(e.isObject(l)&&!p(l)){const e=m(l);return(null==(s=i.get(o))?void 0:s.get(r))!==e&&c(o,r,e),e}return l},set(t,n,r,i){const s=Reflect.get(t,n,i),a=f(r);if(Object.is(s,a))return!0;const u=Reflect.set(t,n,a,i);return!!u&&(e.isObject(a)&&!p(a)?c(i,n,m(a)):l(i,n),0===(o.get(i)||0)&&(!Array.isArray(t)&&Array.isArray(s)&&Array.isArray(a)?v(i,{type:"array-replace",oldValue:s,newValue:a}):v(i,{type:"set",key:n,newValue:a,oldValue:s})),u)},deleteProperty(e,t){if(!Reflect.has(e,t))return!1;const r=Reflect.get(e,t),i=Reflect.deleteProperty(e,t);if(i){const i=n.get(e);i&&(l(i,t),0===(o.get(i)||0)&&v(i,{type:"delete",key:t,oldValue:r}))}return i}};function m(e){if(!Object.isExtensible(e))return e;if(p(e))return e;if(e[t])return e;const r=n.get(e);if(r)return r;const o=new Proxy(e,j);return n.set(e,o),o}exports.isProxy=y,exports.observe=function(t,n,o={}){const{throttle:i=0,onBatch:s,immediate:c=!1,deepCompare:l}=o,a={callback:n,onBatch:s,throttle:i,filterRegexes:(Array.isArray(o.filter)?o.filter:o.filter?[o.filter]:[]).map(e=>{if(""===e)return/^.*$/;const t=h.get(e);if(t)return t;let n="";for(let c=0;c<e.length;c++){const t=e[c];"*"===t&&"*"===e[c+1]?(n+="**",c++):"*"===t?n+="*":"."===t?n+=".":/[.*+?^${}()|[\]\\]/.test(t)?n+="\\"+t:n+=t}const r=n.split("."),o=[];for(let c=0;c<r.length;c++){const e=r[c];"**"===e?1===r.length?o.push(".*"):0===c?o.push("(?:[^.]+\\.)*"):o.push("(?:\\.[^.]+)*"):"*"===e?o.push("[^.]+"):o.push(e)}let i="^";for(let c=0;c<o.length;c++)if(i+=o[c],c<o.length-1){const e=o[c],t=o[c+1];if(e.endsWith("\\.)*"))continue;if(t.startsWith("(?:\\."))continue;i+="\\."}i+="$";const s=new RegExp(i);return h.set(e,s),s}),pending:[],timer:null,active:!0,deepCompare:l},u=m(t);let y=r.get(u);if(y||(y=new Set,r.set(u,y)),y.add(a),c){const n=[...y],r=(t,o,i=[],s=new WeakSet)=>{e.isObject(t)&&!s.has(t)&&(s.add(t),Reflect.ownKeys(t).forEach(c=>{const l=Reflect.get(t,c);if(e.isObject(l)&&s.has(l))return;const a=Reflect.get(o,c),f=[...i,c];n.forEach(e=>{d(f,e.filterRegexes)&&b(e,{type:"set",key:c,newValue:l,oldValue:void 0,path:f})}),e.isObject(l)&&!p(l)&&r(l,a,f,s)}))};r(f(t),u)}const g=()=>{const e=r.get(u);e&&(e.delete(a),0===e.size&&r.delete(u)),a.pending=[],a.timer&&(clearTimeout(a.timer),a.timer=null)};return{proxy:u,unobserve:()=>{a.active&&(a.active=!1,g())},resume:()=>{a.active||(a.active=!0,(()=>{let e=r.get(u);e||(e=new Set,r.set(u,e)),e.add(a)})())},dispose:()=>{if(!a.active)return a.callback=()=>{},void(a.onBatch=void 0);a.active=!1,g(),a.callback=()=>{},a.onBatch=void 0}}},exports.toProxy=function(e){return e&&"object"==typeof e&&"proxy"in e?e.proxy:e},exports.toRaw=f;
@@ -1 +1 @@
1
- import{isObject as e}from"../../shared/is-object.js";const t=Symbol("solely.raw"),n=new WeakMap,r=new WeakMap,i=new WeakMap,o=new WeakMap,s=new WeakMap;function l(e,t,n){c(e,t);let r=o.get(e);r||(r=new Map,o.set(e,r)),r.set(t,n);let i=s.get(n);i||(i=[],s.set(n,i)),i.some(n=>n.parentRef.deref()===e&&n.key===t)||i.push({parentRef:new WeakRef(e),key:t})}function c(e,t){const n=o.get(e);if(!n)return;const r=n.get(t);if(!r)return;n.delete(t);const i=s.get(r);if(i){const n=i.filter(n=>{const r=n.parentRef.deref();return void 0!==r&&!(r===e&&n.key===t)});0===n.length?s.delete(r):s.set(r,n)}}function a(t,n){const r=o.get(n);if(r)for(const e of r.keys())c(n,e);for(let i=0;i<t.length;i++){const r=t[i];e(r)&&!p(r)&&l(n,String(i),k(r))}}function f(e){if(e&&"object"==typeof e){const n=e[t];if(n)return n}return e}const u=Object.prototype.toString,p=e=>{if(!e||"object"!=typeof e)return!1;const t=u.call(e);return"[object Date]"===t||"[object RegExp]"===t||"[object Map]"===t||"[object Set]"===t||e instanceof File||e instanceof Blob||e instanceof FormData||e instanceof ArrayBuffer||e instanceof Response||e instanceof Request};function y(e){return!(!e||!e[t])}function h(e){return e&&"object"==typeof e&&"proxy"in e?e.proxy:e}const g=new Map,d=(e,t)=>{if(0===t.length)return!0;const n=e.map(String);for(let r=n.length;r>0;r--){const e=n.slice(0,r).join(".");if(t.some(t=>t.test(e)))return!0}return!1},v=(e,t)=>{if(Object.is(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!v(e[n],t[n]))return!1;return!0}if(Array.isArray(e)!==Array.isArray(t))return!1;const n=Reflect.ownKeys(e),r=Reflect.ownKeys(t);if(n.length!==r.length)return!1;for(const i of n){if(!Reflect.has(t,i))return!1;if(!v(e[i],t[i]))return!1}return!0},b=(e,t)=>{e.active&&(e.deepCompare&&"set"===t.type&&v(t.oldValue,t.newValue)||(e.throttle>0?(e.pending.push(t),e.timer||(e.timer=setTimeout(()=>{if(!e.active)return;const t=[...e.pending];e.pending=[],e.timer=null,t.length>0&&(e.onBatch?e.onBatch(t):e.callback(t[t.length-1]))},e.throttle))):e.onBatch?e.onBatch([t]):e.callback(t)))},m=(e,t)=>{const n=[{node:e,relativePath:[],visited:new Set([e])}];let i=0;for(;i<n.length;){const{node:e,relativePath:o,visited:l}=n[i++],c=r.get(e);c&&c.forEach(e=>{if(!e.active)return;let n=o;if("set"===t.type||"delete"===t.type?n=[...o,t.key]:"array-push"!==t.type&&"array-splice"!==t.type||(n=[...o,String(t.index)]),!d(n,e.filterRegexes))return;const r={...t,path:n};b(e,r)});const a=s.get(e);if(a)for(let t=a.length-1;t>=0;t--){const e=a[t],r=e.parentRef.deref();if(!r){a.splice(t,1);continue}if(l.has(r))continue;const i=new Set(l);i.add(r),n.push({node:r,relativePath:[e.key,...o],visited:i})}}},R={};["push","pop","shift","unshift","splice"].forEach(t=>{R[t]=function(...n){const r=this,o=f(r),s=i.get(r)||0;i.set(r,s+1);try{const i=o.length,s=o[t].apply(o,n);if("push"===t){const t=o.length-n.length;for(let i=0;i<n.length;i++){const n=o[t+i];e(n)&&!p(n)&&l(r,String(t+i),k(n))}m(r,{type:"array-push",index:t,values:n})}else if("pop"===t)c(r,String(i-1)),m(r,{type:"array-splice",index:i-1,deleteCount:1,insert:[]});else if(a(o,r),"unshift"===t)m(r,{type:"array-push",index:0,values:n});else if("shift"===t)m(r,{type:"array-splice",index:0,deleteCount:1,insert:[]});else if("splice"===t){const[e,t,...i]=n;m(r,{type:"array-splice",index:e,deleteCount:t,insert:i})}return s}finally{i.set(r,s)}}}),["sort","reverse","fill","copyWithin"].forEach(e=>{R[e]=function(...t){const n=this,r=f(n),o=i.get(n)||0;i.set(n,o+1);try{const i=r[e].apply(r,t);return a(r,n),m(n,{type:"array-reset",method:e}),i}finally{i.set(n,o)}}}),["indexOf","lastIndexOf","includes"].forEach(e=>{R[e]=function(t,...n){const r=f(this);let i=r[e].apply(r,[t,...n]);return-1!==i&&!1!==i||!y(t)||(i=r[e].apply(r,[f(t),...n])),i}});const w={get(n,r,i){var s;if(r===t)return n;if(Array.isArray(n)&&Object.prototype.hasOwnProperty.call(R,r))return Reflect.get(R,r,i);const c=Reflect.get(n,r,i);if("symbol"==typeof r)return c;if(e(c)&&!p(c)){const e=k(c);return(null==(s=o.get(i))?void 0:s.get(r))!==e&&l(i,r,e),e}return c},set(t,n,r,o){const s=Reflect.get(t,n,o);if(Object.is(s,r))return!0;const a=Reflect.set(t,n,r,o);return!!a&&(e(r)&&!p(r)?l(o,n,k(r)):c(o,n),0===(i.get(o)||0)&&(!Array.isArray(t)&&Array.isArray(s)&&Array.isArray(r)?m(o,{type:"array-replace",oldValue:s,newValue:r}):m(o,{type:"set",key:n,newValue:r,oldValue:s})),a)},deleteProperty(e,t){if(!Reflect.has(e,t))return!1;const r=Reflect.get(e,t),o=Reflect.deleteProperty(e,t);if(o){const o=n.get(e);o&&(c(o,t),0===(i.get(o)||0)&&m(o,{type:"delete",key:t,oldValue:r}))}return o}};function k(e){if(!Object.isExtensible(e))return e;if(p(e))return e;if(e[t])return e;const r=n.get(e);if(r)return r;const i=new Proxy(e,w);return n.set(e,i),i}function x(t,n,i={}){const{throttle:o=0,onBatch:s,immediate:l=!1,deepCompare:c}=i,a={callback:n,onBatch:s,throttle:o,filterRegexes:(Array.isArray(i.filter)?i.filter:i.filter?[i.filter]:[]).map(e=>{if(""===e)return/^.*$/;const t=g.get(e);if(t)return t;let n="";for(let l=0;l<e.length;l++){const t=e[l];"*"===t&&"*"===e[l+1]?(n+="**",l++):"*"===t?n+="*":"."===t?n+=".":/[.*+?^${}()|[\]\\]/.test(t)?n+="\\"+t:n+=t}const r=n.split("."),i=[];for(let l=0;l<r.length;l++){const e=r[l];"**"===e?1===r.length?i.push(".*"):0===l?i.push("(?:[^.]+\\.)*"):i.push("(?:\\.[^.]+)*"):"*"===e?i.push("[^.]+"):i.push(e)}let o="^";for(let l=0;l<i.length;l++)if(o+=i[l],l<i.length-1){const e=i[l],t=i[l+1];if(e.endsWith("\\.)*"))continue;if(t.startsWith("(?:\\."))continue;o+="\\."}o+="$";const s=new RegExp(o);return g.set(e,s),s}),pending:[],timer:null,active:!0,deepCompare:c},u=k(t);let y=r.get(u);if(y||(y=new Set,r.set(u,y)),y.add(a),l){const n=[...y],r=(t,i,o=[],s=new WeakSet)=>{e(t)&&!s.has(t)&&(s.add(t),Reflect.ownKeys(t).forEach(l=>{const c=Reflect.get(t,l);if(e(c)&&s.has(c))return;const a=Reflect.get(i,l),f=[...o,l];n.forEach(e=>{d(f,e.filterRegexes)&&b(e,{type:"set",key:l,newValue:c,oldValue:void 0,path:f})}),e(c)&&!p(c)&&r(c,a,f,s)}))};r(f(t),u)}const h=()=>{const e=r.get(u);e&&(e.delete(a),0===e.size&&r.delete(u)),a.pending=[],a.timer&&(clearTimeout(a.timer),a.timer=null)};return{proxy:u,unobserve:()=>{a.active&&(a.active=!1,h())},resume:()=>{a.active||(a.active=!0,(()=>{let e=r.get(u);e||(e=new Set,r.set(u,e)),e.add(a)})())},dispose:()=>{if(!a.active)return a.callback=()=>{},void(a.onBatch=void 0);a.active=!1,h(),a.callback=()=>{},a.onBatch=void 0}}}export{y as isProxy,x as observe,h as toProxy,f as toRaw};
1
+ import{isObject as e}from"../../shared/is-object.js";const t=Symbol("solely.raw"),n=new WeakMap,r=new WeakMap,o=new WeakMap,i=new WeakMap,s=new WeakMap;function l(e,t,n){a(e,t);let r=i.get(e);r||(r=new Map,i.set(e,r)),r.set(t,n);let o=s.get(n);o||(o=[],s.set(n,o)),o.some(n=>n.parentRef.deref()===e&&n.key===t)||o.push({parentRef:new WeakRef(e),key:t})}function a(e,t){const n=i.get(e);if(!n)return;const r=n.get(t);if(!r)return;n.delete(t);const o=s.get(r);if(o){const n=o.filter(n=>{const r=n.parentRef.deref();return void 0!==r&&!(r===e&&n.key===t)});0===n.length?s.delete(r):s.set(r,n)}}function c(t,n){const r=i.get(n);if(r)for(const e of r.keys())a(n,e);for(let o=0;o<t.length;o++){const r=t[o];e(r)&&!p(r)&&l(n,String(o),k(r))}}function f(e){if(e&&"object"==typeof e){const n=e[t];if(n)return n}return e}const u=Object.prototype.toString,p=e=>{if(!e||"object"!=typeof e)return!1;const t=u.call(e);return"[object Date]"===t||"[object RegExp]"===t||"[object Map]"===t||"[object Set]"===t||"undefined"!=typeof File&&e instanceof File||"undefined"!=typeof Blob&&e instanceof Blob||"undefined"!=typeof FormData&&e instanceof FormData||"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer||"undefined"!=typeof Response&&e instanceof Response||"undefined"!=typeof Request&&e instanceof Request};function y(e){return!(!e||!e[t])}function h(e){return e&&"object"==typeof e&&"proxy"in e?e.proxy:e}const d=new Map,g=(e,t)=>{if(0===t.length)return!0;const n=e.map(String);for(let r=n.length;r>0;r--){const e=n.slice(0,r).join(".");if(t.some(t=>t.test(e)))return!0}return!1},v=(e,t)=>{if(Object.is(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!v(e[n],t[n]))return!1;return!0}if(Array.isArray(e)!==Array.isArray(t))return!1;const n=Reflect.ownKeys(e),r=Reflect.ownKeys(t);if(n.length!==r.length)return!1;for(const o of n){if(!Reflect.has(t,o))return!1;if(!v(e[o],t[o]))return!1}return!0},R=(e,t)=>{e.active&&(e.deepCompare&&"set"===t.type&&v(t.oldValue,t.newValue)||(e.throttle>0?(e.pending.push(t),e.timer||(e.timer=setTimeout(()=>{if(!e.active)return;const t=[...e.pending];e.pending=[],e.timer=null,t.length>0&&(e.onBatch?e.onBatch(t):e.callback(t[t.length-1]))},e.throttle))):e.onBatch?e.onBatch([t]):e.callback(t)))},b=(e,t)=>{const n=[{node:e,relativePath:[],visited:new Set([e])}];let o=0;for(;o<n.length;){const{node:e,relativePath:i,visited:l}=n[o++],a=r.get(e);a&&a.forEach(e=>{if(!e.active)return;let n=i;if("set"===t.type||"delete"===t.type?n=[...i,t.key]:"array-push"!==t.type&&"array-splice"!==t.type||(n=[...i,String(t.index)]),!g(n,e.filterRegexes))return;const r={...t,path:n};R(e,r)});const c=s.get(e);if(c)for(let t=c.length-1;t>=0;t--){const e=c[t],r=e.parentRef.deref();if(!r){c.splice(t,1);continue}if(l.has(r))continue;const o=new Set(l);o.add(r),n.push({node:r,relativePath:[e.key,...i],visited:o})}}},m={};["push","pop","shift","unshift","splice"].forEach(t=>{m[t]=function(...n){const r=this,i=f(r),s=o.get(r)||0;o.set(r,s+1);try{const o=i.length,s=i[t].apply(i,n);if("push"===t){const t=i.length-n.length;for(let o=0;o<n.length;o++){const n=i[t+o];e(n)&&!p(n)&&l(r,String(t+o),k(n))}b(r,{type:"array-push",index:t,values:n})}else if("pop"===t)a(r,String(o-1)),b(r,{type:"array-splice",index:o-1,deleteCount:1,insert:[]});else if(c(i,r),"unshift"===t)b(r,{type:"array-push",index:0,values:n});else if("shift"===t)b(r,{type:"array-splice",index:0,deleteCount:1,insert:[]});else if("splice"===t){const[e,t,...o]=n;b(r,{type:"array-splice",index:e,deleteCount:t,insert:o})}return s}finally{o.set(r,s)}}}),["sort","reverse","fill","copyWithin"].forEach(e=>{m[e]=function(...t){const n=this,r=f(n),i=o.get(n)||0;o.set(n,i+1);try{const o=r[e].apply(r,t);return c(r,n),b(n,{type:"array-reset",method:e}),o}finally{o.set(n,i)}}}),["indexOf","lastIndexOf","includes"].forEach(e=>{m[e]=function(t,...n){const r=f(this);let o=r[e].apply(r,[t,...n]);return-1!==o&&!1!==o||!y(t)||(o=r[e].apply(r,[f(t),...n])),o}});const w={get(n,r,o){var s;if(r===t)return n;if(Array.isArray(n)&&Object.prototype.hasOwnProperty.call(m,r))return Reflect.get(m,r,o);const a=Reflect.get(n,r,o);if("symbol"==typeof r)return a;if(e(a)&&!p(a)){const e=k(a);return(null==(s=i.get(o))?void 0:s.get(r))!==e&&l(o,r,e),e}return a},set(t,n,r,i){const s=Reflect.get(t,n,i),c=f(r);if(Object.is(s,c))return!0;const u=Reflect.set(t,n,c,i);return!!u&&(e(c)&&!p(c)?l(i,n,k(c)):a(i,n),0===(o.get(i)||0)&&(!Array.isArray(t)&&Array.isArray(s)&&Array.isArray(c)?b(i,{type:"array-replace",oldValue:s,newValue:c}):b(i,{type:"set",key:n,newValue:c,oldValue:s})),u)},deleteProperty(e,t){if(!Reflect.has(e,t))return!1;const r=Reflect.get(e,t),i=Reflect.deleteProperty(e,t);if(i){const i=n.get(e);i&&(a(i,t),0===(o.get(i)||0)&&b(i,{type:"delete",key:t,oldValue:r}))}return i}};function k(e){if(!Object.isExtensible(e))return e;if(p(e))return e;if(e[t])return e;const r=n.get(e);if(r)return r;const o=new Proxy(e,w);return n.set(e,o),o}function A(t,n,o={}){const{throttle:i=0,onBatch:s,immediate:l=!1,deepCompare:a}=o,c={callback:n,onBatch:s,throttle:i,filterRegexes:(Array.isArray(o.filter)?o.filter:o.filter?[o.filter]:[]).map(e=>{if(""===e)return/^.*$/;const t=d.get(e);if(t)return t;let n="";for(let l=0;l<e.length;l++){const t=e[l];"*"===t&&"*"===e[l+1]?(n+="**",l++):"*"===t?n+="*":"."===t?n+=".":/[.*+?^${}()|[\]\\]/.test(t)?n+="\\"+t:n+=t}const r=n.split("."),o=[];for(let l=0;l<r.length;l++){const e=r[l];"**"===e?1===r.length?o.push(".*"):0===l?o.push("(?:[^.]+\\.)*"):o.push("(?:\\.[^.]+)*"):"*"===e?o.push("[^.]+"):o.push(e)}let i="^";for(let l=0;l<o.length;l++)if(i+=o[l],l<o.length-1){const e=o[l],t=o[l+1];if(e.endsWith("\\.)*"))continue;if(t.startsWith("(?:\\."))continue;i+="\\."}i+="$";const s=new RegExp(i);return d.set(e,s),s}),pending:[],timer:null,active:!0,deepCompare:a},u=k(t);let y=r.get(u);if(y||(y=new Set,r.set(u,y)),y.add(c),l){const n=[...y],r=(t,o,i=[],s=new WeakSet)=>{e(t)&&!s.has(t)&&(s.add(t),Reflect.ownKeys(t).forEach(l=>{const a=Reflect.get(t,l);if(e(a)&&s.has(a))return;const c=Reflect.get(o,l),f=[...i,l];n.forEach(e=>{g(f,e.filterRegexes)&&R(e,{type:"set",key:l,newValue:a,oldValue:void 0,path:f})}),e(a)&&!p(a)&&r(a,c,f,s)}))};r(f(t),u)}const h=()=>{const e=r.get(u);e&&(e.delete(c),0===e.size&&r.delete(u)),c.pending=[],c.timer&&(clearTimeout(c.timer),c.timer=null)};return{proxy:u,unobserve:()=>{c.active&&(c.active=!1,h())},resume:()=>{c.active||(c.active=!0,(()=>{let e=r.get(u);e||(e=new Set,r.set(u,e)),e.add(c)})())},dispose:()=>{if(!c.active)return c.callback=()=>{},void(c.onBatch=void 0);c.active=!1,h(),c.callback=()=>{},c.onBatch=void 0}}}export{y as isProxy,A as observe,h as toProxy,f as toRaw};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./observe.cjs");exports.watch=function(o,r,t={}){const s=e.toProxy(o);if(!e.isProxy(s))throw new Error("[solely] watch: source 必须是响应式代理对象或 observe 返回值,请先调用 observe()");const n=e.observe(s,r,{deepCompare:t.deepCompare,throttle:t.throttle,immediate:t.immediate});return{dispose:()=>n.dispose(),pause:()=>n.unobserve(),resume:()=>n.resume()}},exports.watchGetter=function(o,r,t,s={}){let n,i=!1;const c=[],u=()=>{if(i)return;const e=r();e!==n&&(t(e,n),n=e)};for(const p of o){const o=e.toProxy(p);if(!e.isProxy(o))throw new Error("[solely] watchGetter: sources 必须是响应式代理对象或 observe 返回值,请先调用 observe()");const r=e.observe(o,u,{deepCompare:s.deepCompare,throttle:s.throttle});c.push(r)}return s.immediate&&(n=r(),t(n,void 0)),{dispose:()=>{if(!i){i=!0;for(const e of c)e.dispose();c.length=0}},pause:()=>{for(const e of c)e.unobserve()},resume:()=>{for(const e of c)e.resume()}}};
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./observe.cjs");exports.watch=function(o,r,t={}){const s=e.toProxy(o);if(!e.isProxy(s))throw new Error("[solely] watch: source 必须是响应式代理对象或 observe 返回值,请先调用 observe()");const n=e.observe(s,r,{deepCompare:t.deepCompare,throttle:t.throttle,immediate:t.immediate});return{dispose:()=>n.dispose(),pause:()=>n.unobserve(),resume:()=>n.resume()}},exports.watchGetter=function(o,r,t,s={}){let n,i=!1;const c=[],u=()=>{if(i)return;const e=r();e!==n&&(t(e,n),n=e)};for(const p of o){const o=e.toProxy(p);if(!e.isProxy(o))throw new Error("[solely] watchGetter: sources 必须是响应式代理对象或 observe 返回值,请先调用 observe()");const r=e.observe(o,u,{deepCompare:s.deepCompare,throttle:s.throttle});c.push(r)}return s.immediate?(n=r(),t(n,void 0)):n=r(),{dispose:()=>{if(!i){i=!0;for(const e of c)e.dispose();c.length=0}},pause:()=>{for(const e of c)e.unobserve()},resume:()=>{for(const e of c)e.resume()}}};
@@ -1 +1 @@
1
- import{toProxy as e,isProxy as o,observe as r}from"./observe.js";function t(t,s,n={}){const i=e(t);if(!o(i))throw new Error("[solely] watch: source 必须是响应式代理对象或 observe 返回值,请先调用 observe()");const p=r(i,s,{deepCompare:n.deepCompare,throttle:n.throttle,immediate:n.immediate});return{dispose:()=>p.dispose(),pause:()=>p.unobserve(),resume:()=>p.resume()}}function s(t,s,n,i={}){let p,c=!1;const m=[],u=()=>{if(c)return;const e=s();e!==p&&(n(e,p),p=e)};for(const f of t){const t=e(f);if(!o(t))throw new Error("[solely] watchGetter: sources 必须是响应式代理对象或 observe 返回值,请先调用 observe()");const s=r(t,u,{deepCompare:i.deepCompare,throttle:i.throttle});m.push(s)}return i.immediate&&(p=s(),n(p,void 0)),{dispose:()=>{if(!c){c=!0;for(const e of m)e.dispose();m.length=0}},pause:()=>{for(const e of m)e.unobserve()},resume:()=>{for(const e of m)e.resume()}}}export{t as watch,s as watchGetter};
1
+ import{toProxy as e,isProxy as o,observe as r}from"./observe.js";function t(t,s,n={}){const i=e(t);if(!o(i))throw new Error("[solely] watch: source 必须是响应式代理对象或 observe 返回值,请先调用 observe()");const p=r(i,s,{deepCompare:n.deepCompare,throttle:n.throttle,immediate:n.immediate});return{dispose:()=>p.dispose(),pause:()=>p.unobserve(),resume:()=>p.resume()}}function s(t,s,n,i={}){let p,c=!1;const m=[],u=()=>{if(c)return;const e=s();e!==p&&(n(e,p),p=e)};for(const f of t){const t=e(f);if(!o(t))throw new Error("[solely] watchGetter: sources 必须是响应式代理对象或 observe 返回值,请先调用 observe()");const s=r(t,u,{deepCompare:i.deepCompare,throttle:i.throttle});m.push(s)}return i.immediate?(p=s(),n(p,void 0)):p=s(),{dispose:()=>{if(!c){c=!0;for(const e of m)e.dispose();m.length=0}},pause:()=>{for(const e of m)e.unobserve()},resume:()=>{for(const e of m)e.resume()}}}export{t as watch,s as watchGetter};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=(()=>{var o,e;if("undefined"!=typeof window){if(null==(o=window.location)?void 0:o.search.includes("debug"))return!0;const e=globalThis;if(!0===e.__DEBUG__||!0===e.__IS_DEV__)return!0}return!("undefined"==typeof window||!["localhost","127.0.0.1","0.0.0.0"].includes((null==(e=window.location)?void 0:e.hostname)||""))})(),e=!o;exports.IS_DEV=o,exports.IS_PROD=e,exports.SOLELY_VERSION="0.5.4";
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=(()=>{var o,e;if("undefined"!=typeof window){if(null==(o=window.location)?void 0:o.search.includes("debug"))return!0;const e=globalThis;if(!0===e.__DEBUG__||!0===e.__IS_DEV__)return!0}return!("undefined"==typeof window||!["localhost","127.0.0.1","0.0.0.0"].includes((null==(e=window.location)?void 0:e.hostname)||""))})(),e=!o;exports.IS_DEV=o,exports.IS_PROD=e,exports.SOLELY_VERSION="0.5.6";
@@ -1 +1 @@
1
- const n=(()=>{var n,o;if("undefined"!=typeof window){if(null==(n=window.location)?void 0:n.search.includes("debug"))return!0;const o=globalThis;if(!0===o.__DEBUG__||!0===o.__IS_DEV__)return!0}return!("undefined"==typeof window||!["localhost","127.0.0.1","0.0.0.0"].includes((null==(o=window.location)?void 0:o.hostname)||""))})(),o=!n,i="0.5.4";export{n as IS_DEV,o as IS_PROD,i as SOLELY_VERSION};
1
+ const n=(()=>{var n,o;if("undefined"!=typeof window){if(null==(n=window.location)?void 0:n.search.includes("debug"))return!0;const o=globalThis;if(!0===o.__DEBUG__||!0===o.__IS_DEV__)return!0}return!("undefined"==typeof window||!["localhost","127.0.0.1","0.0.0.0"].includes((null==(o=window.location)?void 0:o.hostname)||""))})(),o=!n,i="0.5.6";export{n as IS_DEV,o as IS_PROD,i as SOLELY_VERSION};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"}),exports.parseHashUrl=function(e=window.location){let t;t="string"==typeof e?new URL(e).hash:e.hash;const o=t.split("?");let n=o[0];const s=o[1],r={};return n=n.replace(/^#\/?/,""),s&&s.split("&").forEach(e=>{const[t,o]=e.split("=");t&&o&&(r[decodeURIComponent(t)]=decodeURIComponent(o))}),{path:n.split("/").filter(Boolean),query:r}};
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"}),exports.parseHashUrl=function(e){let t;t="string"==typeof e?new URL(e,"undefined"!=typeof window?window.location.href:"http://localhost/").hash:e?e.hash:window.location.hash;const o=t.indexOf("?");let r=-1===o?t:t.slice(0,o);const n=-1===o?"":t.slice(o+1),a={};return r=r.replace(/^#\/?/,""),n&&new URLSearchParams(n).forEach((e,t)=>{Object.defineProperty(a,t,{value:e,writable:!0,enumerable:!0,configurable:!0})}),{path:r.split("/").filter(Boolean),query:a}};
@@ -1 +1 @@
1
- function t(t=window.location){let o;o="string"==typeof t?new URL(t).hash:t.hash;const e=o.split("?");let n=e[0];const l=e[1],p={};return n=n.replace(/^#\/?/,""),l&&l.split("&").forEach(t=>{const[o,e]=t.split("=");o&&e&&(p[decodeURIComponent(o)]=decodeURIComponent(e))}),{path:n.split("/").filter(Boolean),query:p}}export{t as parseHashUrl};
1
+ function e(e){let t;t="string"==typeof e?new URL(e,"undefined"!=typeof window?window.location.href:"http://localhost/").hash:e?e.hash:window.location.hash;const n=t.indexOf("?");let o=-1===n?t:t.slice(0,n);const a=-1===n?"":t.slice(n+1),i={};return o=o.replace(/^#\/?/,""),a&&new URLSearchParams(a).forEach((e,t)=>{Object.defineProperty(i,t,{value:e,writable:!0,enumerable:!0,configurable:!0})}),{path:o.split("/").filter(Boolean),query:i}}export{e as parseHashUrl};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "solely",
3
3
  "private": false,
4
- "version": "0.5.4",
4
+ "version": "0.5.6",
5
5
  "description": "A lightweight TypeScript framework for building web components with compile-time optimizations",
6
6
  "type": "module",
7
7
  "sideEffects": [