solely 0.3.1 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/compiler/ir/buildIR.cjs +1 -1
- package/dist/compiler/ir/buildIR.js +1 -1
- package/dist/compiler/parser/parser.cjs +1 -1
- package/dist/compiler/parser/parser.js +1 -1
- package/dist/components/commands/drawer/index.cjs +1 -0
- package/dist/components/commands/drawer/index.d.ts +10 -0
- package/dist/components/commands/drawer/index.js +1 -0
- package/dist/components/commands/drawer/style.css.cjs +1 -0
- package/dist/components/commands/drawer/style.css.js +1 -0
- package/dist/components/commands/drawer/types.d.ts +48 -0
- package/dist/components/commands/index.cjs +1 -0
- package/dist/components/commands/index.d.ts +15 -0
- package/dist/components/commands/index.js +1 -0
- package/dist/components/commands/message/index.cjs +1 -0
- package/dist/components/commands/message/index.d.ts +20 -0
- package/dist/components/commands/message/index.js +1 -0
- package/dist/components/commands/message/style.css.cjs +1 -0
- package/dist/components/commands/message/style.css.js +1 -0
- package/dist/components/commands/message/types.d.ts +39 -0
- package/dist/components/commands/modal/index.cjs +1 -0
- package/dist/components/commands/modal/index.d.ts +20 -0
- package/dist/components/commands/modal/index.js +1 -0
- package/dist/components/commands/modal/style.css.cjs +1 -0
- package/dist/components/commands/modal/style.css.js +1 -0
- package/dist/components/commands/modal/types.d.ts +70 -0
- package/dist/components/commands/popconfirm/index.cjs +1 -0
- package/dist/components/commands/popconfirm/index.d.ts +14 -0
- package/dist/components/commands/popconfirm/index.js +1 -0
- package/dist/components/commands/popconfirm/style.css.cjs +1 -0
- package/dist/components/commands/popconfirm/style.css.js +1 -0
- package/dist/components/commands/popconfirm/types.d.ts +46 -0
- package/dist/components/commands/tooltip/index.cjs +1 -0
- package/dist/components/commands/tooltip/index.d.ts +14 -0
- package/dist/components/commands/tooltip/index.js +1 -0
- package/dist/components/commands/tooltip/style.css.cjs +1 -0
- package/dist/components/commands/tooltip/style.css.js +1 -0
- package/dist/components/commands/tooltip/types.d.ts +43 -0
- package/dist/components/commands/utils.cjs +1 -0
- package/dist/components/commands/utils.d.ts +40 -0
- package/dist/components/commands/utils.js +1 -0
- package/dist/components/elements/alert/index.cjs +1 -0
- package/dist/components/elements/alert/index.d.ts +28 -0
- package/dist/components/elements/alert/index.html.cjs +1 -0
- package/dist/components/elements/alert/index.html.js +1 -0
- package/dist/components/elements/alert/index.js +1 -0
- package/dist/components/elements/alert/style.css.cjs +1 -0
- package/dist/components/elements/alert/style.css.js +1 -0
- package/dist/components/elements/alert/types.d.ts +18 -0
- package/dist/components/elements/backtop/index.cjs +1 -0
- package/dist/components/elements/backtop/index.d.ts +43 -0
- package/dist/components/elements/backtop/index.html.cjs +1 -0
- package/dist/components/elements/backtop/index.html.js +1 -0
- package/dist/components/elements/backtop/index.js +1 -0
- package/dist/components/elements/backtop/style.css.cjs +1 -0
- package/dist/components/elements/backtop/style.css.js +1 -0
- package/dist/components/elements/backtop/types.d.ts +9 -0
- package/dist/components/elements/badge/index.cjs +1 -0
- package/dist/components/elements/badge/index.d.ts +34 -0
- package/dist/components/elements/badge/index.html.cjs +1 -0
- package/dist/components/elements/badge/index.html.js +1 -0
- package/dist/components/elements/badge/index.js +1 -0
- package/dist/components/elements/badge/style.css.cjs +1 -0
- package/dist/components/elements/badge/style.css.js +1 -0
- package/dist/components/elements/badge/types.d.ts +22 -0
- package/dist/components/elements/breadcrumb/index.cjs +1 -0
- package/dist/components/elements/breadcrumb/index.d.ts +14 -0
- package/dist/components/elements/breadcrumb/index.html.cjs +1 -0
- package/dist/components/elements/breadcrumb/index.html.js +1 -0
- package/dist/components/elements/breadcrumb/index.js +1 -0
- package/dist/components/elements/breadcrumb/style.css.cjs +1 -0
- package/dist/components/elements/breadcrumb/style.css.js +1 -0
- package/dist/components/elements/breadcrumb/types.d.ts +15 -0
- package/dist/components/elements/button/index.cjs +1 -0
- package/dist/components/elements/button/index.d.ts +56 -0
- package/dist/components/elements/button/index.html.cjs +1 -0
- package/dist/components/elements/button/index.html.js +1 -0
- package/dist/components/elements/button/index.js +1 -0
- package/dist/components/elements/button/style.css.cjs +1 -0
- package/dist/components/elements/button/style.css.js +1 -0
- package/dist/components/elements/button/types.d.ts +42 -0
- package/dist/components/elements/card/index.cjs +1 -0
- package/dist/components/elements/card/index.d.ts +26 -0
- package/dist/components/elements/card/index.html.cjs +1 -0
- package/dist/components/elements/card/index.html.js +1 -0
- package/dist/components/elements/card/index.js +1 -0
- package/dist/components/elements/card/style.css.cjs +1 -0
- package/dist/components/elements/card/style.css.js +1 -0
- package/dist/components/elements/card/types.d.ts +28 -0
- package/dist/components/elements/checkbox/index.cjs +1 -0
- package/dist/components/elements/checkbox/index.d.ts +62 -0
- package/dist/components/elements/checkbox/index.html.cjs +1 -0
- package/dist/components/elements/checkbox/index.html.js +1 -0
- package/dist/components/elements/checkbox/index.js +1 -0
- package/dist/components/elements/checkbox/style.css.cjs +1 -0
- package/dist/components/elements/checkbox/style.css.js +1 -0
- package/dist/components/elements/checkbox/types.d.ts +30 -0
- package/dist/components/elements/coordinate-input/index.cjs +1 -0
- package/dist/components/elements/coordinate-input/index.d.ts +155 -0
- package/dist/components/elements/coordinate-input/index.html.cjs +1 -0
- package/dist/components/elements/coordinate-input/index.html.js +1 -0
- package/dist/components/elements/coordinate-input/index.js +1 -0
- package/dist/components/elements/coordinate-input/style.css.cjs +1 -0
- package/dist/components/elements/coordinate-input/style.css.js +1 -0
- package/dist/components/elements/coordinate-input/types.d.ts +112 -0
- package/dist/components/elements/divider/index.cjs +1 -0
- package/dist/components/elements/divider/index.d.ts +13 -0
- package/dist/components/elements/divider/index.html.cjs +1 -0
- package/dist/components/elements/divider/index.html.js +1 -0
- package/dist/components/elements/divider/index.js +1 -0
- package/dist/components/elements/divider/style.css.cjs +1 -0
- package/dist/components/elements/divider/style.css.js +1 -0
- package/dist/components/elements/divider/types.d.ts +15 -0
- package/dist/components/elements/empty/index.cjs +1 -0
- package/dist/components/elements/empty/index.d.ts +10 -0
- package/dist/components/elements/empty/index.html.cjs +1 -0
- package/dist/components/elements/empty/index.html.js +1 -0
- package/dist/components/elements/empty/index.js +1 -0
- package/dist/components/elements/empty/style.css.cjs +1 -0
- package/dist/components/elements/empty/style.css.js +1 -0
- package/dist/components/elements/empty/types.d.ts +9 -0
- package/dist/components/elements/fab/index.cjs +1 -0
- package/dist/components/elements/fab/index.d.ts +50 -0
- package/dist/components/elements/fab/index.html.cjs +1 -0
- package/dist/components/elements/fab/index.html.js +1 -0
- package/dist/components/elements/fab/index.js +1 -0
- package/dist/components/elements/fab/style.css.cjs +1 -0
- package/dist/components/elements/fab/style.css.js +1 -0
- package/dist/components/elements/fab/types.d.ts +52 -0
- package/dist/components/elements/index.cjs +1 -0
- package/dist/components/elements/index.d.ts +57 -0
- package/dist/components/elements/index.js +1 -0
- package/dist/components/elements/input/index.cjs +1 -0
- package/dist/components/elements/input/index.d.ts +109 -0
- package/dist/components/elements/input/index.html.cjs +1 -0
- package/dist/components/elements/input/index.html.js +1 -0
- package/dist/components/elements/input/index.js +1 -0
- package/dist/components/elements/input/style.css.cjs +1 -0
- package/dist/components/elements/input/style.css.js +1 -0
- package/dist/components/elements/input/types.d.ts +66 -0
- package/dist/components/elements/pagination/index.cjs +1 -0
- package/dist/components/elements/pagination/index.d.ts +80 -0
- package/dist/components/elements/pagination/index.html.cjs +1 -0
- package/dist/components/elements/pagination/index.html.js +1 -0
- package/dist/components/elements/pagination/index.js +1 -0
- package/dist/components/elements/pagination/style.css.cjs +1 -0
- package/dist/components/elements/pagination/style.css.js +1 -0
- package/dist/components/elements/pagination/types.d.ts +28 -0
- package/dist/components/elements/progress/index.cjs +1 -0
- package/dist/components/elements/progress/index.d.ts +42 -0
- package/dist/components/elements/progress/index.html.cjs +1 -0
- package/dist/components/elements/progress/index.html.js +1 -0
- package/dist/components/elements/progress/index.js +1 -0
- package/dist/components/elements/progress/style.css.cjs +1 -0
- package/dist/components/elements/progress/style.css.js +1 -0
- package/dist/components/elements/progress/types.d.ts +21 -0
- package/dist/components/elements/radio/index.cjs +1 -0
- package/dist/components/elements/radio/index.d.ts +42 -0
- package/dist/components/elements/radio/index.html.cjs +1 -0
- package/dist/components/elements/radio/index.html.js +1 -0
- package/dist/components/elements/radio/index.js +1 -0
- package/dist/components/elements/radio/style.css.cjs +1 -0
- package/dist/components/elements/radio/style.css.js +1 -0
- package/dist/components/elements/radio/types.d.ts +29 -0
- package/dist/components/elements/rate/index.cjs +1 -0
- package/dist/components/elements/rate/index.d.ts +47 -0
- package/dist/components/elements/rate/index.html.cjs +1 -0
- package/dist/components/elements/rate/index.html.js +1 -0
- package/dist/components/elements/rate/index.js +1 -0
- package/dist/components/elements/rate/style.css.cjs +1 -0
- package/dist/components/elements/rate/style.css.js +1 -0
- package/dist/components/elements/rate/types.d.ts +19 -0
- package/dist/components/elements/select/index.cjs +1 -0
- package/dist/components/elements/select/index.d.ts +74 -0
- package/dist/components/elements/select/index.html.cjs +1 -0
- package/dist/components/elements/select/index.html.js +1 -0
- package/dist/components/elements/select/index.js +1 -0
- package/dist/components/elements/select/style.css.cjs +1 -0
- package/dist/components/elements/select/style.css.js +1 -0
- package/dist/components/elements/select/types.d.ts +30 -0
- package/dist/components/elements/skeleton/index.cjs +1 -0
- package/dist/components/elements/skeleton/index.d.ts +26 -0
- package/dist/components/elements/skeleton/index.html.cjs +1 -0
- package/dist/components/elements/skeleton/index.html.js +1 -0
- package/dist/components/elements/skeleton/index.js +1 -0
- package/dist/components/elements/skeleton/style.css.cjs +1 -0
- package/dist/components/elements/skeleton/style.css.js +1 -0
- package/dist/components/elements/skeleton/types.d.ts +23 -0
- package/dist/components/elements/slider/index.cjs +1 -0
- package/dist/components/elements/slider/index.d.ts +76 -0
- package/dist/components/elements/slider/index.html.cjs +1 -0
- package/dist/components/elements/slider/index.html.js +1 -0
- package/dist/components/elements/slider/index.js +1 -0
- package/dist/components/elements/slider/style.css.cjs +1 -0
- package/dist/components/elements/slider/style.css.js +1 -0
- package/dist/components/elements/slider/types.d.ts +25 -0
- package/dist/components/elements/steps/index.cjs +1 -0
- package/dist/components/elements/steps/index.d.ts +31 -0
- package/dist/components/elements/steps/index.html.cjs +1 -0
- package/dist/components/elements/steps/index.html.js +1 -0
- package/dist/components/elements/steps/index.js +1 -0
- package/dist/components/elements/steps/style.css.cjs +1 -0
- package/dist/components/elements/steps/style.css.js +1 -0
- package/dist/components/elements/steps/types.d.ts +18 -0
- package/dist/components/elements/switch/index.cjs +1 -0
- package/dist/components/elements/switch/index.d.ts +62 -0
- package/dist/components/elements/switch/index.html.cjs +1 -0
- package/dist/components/elements/switch/index.html.js +1 -0
- package/dist/components/elements/switch/index.js +1 -0
- package/dist/components/elements/switch/style.css.cjs +1 -0
- package/dist/components/elements/switch/style.css.js +1 -0
- package/dist/components/elements/switch/types.d.ts +28 -0
- package/dist/components/elements/table/index.cjs +1 -0
- package/dist/components/elements/table/index.d.ts +46 -0
- package/dist/components/elements/table/index.html.cjs +1 -0
- package/dist/components/elements/table/index.html.js +1 -0
- package/dist/components/elements/table/index.js +1 -0
- package/dist/components/elements/table/style.css.cjs +1 -0
- package/dist/components/elements/table/style.css.js +1 -0
- package/dist/components/elements/table/types.d.ts +38 -0
- package/dist/components/elements/tabs/index.cjs +1 -0
- package/dist/components/elements/tabs/index.d.ts +54 -0
- package/dist/components/elements/tabs/index.html.cjs +1 -0
- package/dist/components/elements/tabs/index.html.js +1 -0
- package/dist/components/elements/tabs/index.js +1 -0
- package/dist/components/elements/tabs/style.css.cjs +1 -0
- package/dist/components/elements/tabs/style.css.js +1 -0
- package/dist/components/elements/tabs/types.d.ts +30 -0
- package/dist/components/elements/tag/index.cjs +1 -0
- package/dist/components/elements/tag/index.d.ts +22 -0
- package/dist/components/elements/tag/index.html.cjs +1 -0
- package/dist/components/elements/tag/index.html.js +1 -0
- package/dist/components/elements/tag/index.js +1 -0
- package/dist/components/elements/tag/style.css.cjs +1 -0
- package/dist/components/elements/tag/style.css.js +1 -0
- package/dist/components/elements/tag/types.d.ts +21 -0
- package/dist/components/elements/timeline/index.cjs +1 -0
- package/dist/components/elements/timeline/index.d.ts +25 -0
- package/dist/components/elements/timeline/index.html.cjs +1 -0
- package/dist/components/elements/timeline/index.html.js +1 -0
- package/dist/components/elements/timeline/index.js +1 -0
- package/dist/components/elements/timeline/style.css.cjs +1 -0
- package/dist/components/elements/timeline/style.css.js +1 -0
- package/dist/components/elements/timeline/types.d.ts +23 -0
- package/dist/components/elements/tree/index.cjs +1 -0
- package/dist/components/elements/tree/index.d.ts +127 -0
- package/dist/components/elements/tree/index.html.cjs +1 -0
- package/dist/components/elements/tree/index.html.js +1 -0
- package/dist/components/elements/tree/index.js +1 -0
- package/dist/components/elements/tree/style.css.cjs +1 -0
- package/dist/components/elements/tree/style.css.js +1 -0
- package/dist/components/elements/tree/types.d.ts +47 -0
- package/dist/components/elements/upload/index.cjs +1 -0
- package/dist/components/elements/upload/index.d.ts +74 -0
- package/dist/components/elements/upload/index.html.cjs +1 -0
- package/dist/components/elements/upload/index.html.js +1 -0
- package/dist/components/elements/upload/index.js +1 -0
- package/dist/components/elements/upload/style.css.cjs +1 -0
- package/dist/components/elements/upload/style.css.js +1 -0
- package/dist/components/elements/upload/types.d.ts +48 -0
- package/dist/components/elements/utils/helpers.cjs +1 -0
- package/dist/components/elements/utils/helpers.d.ts +24 -0
- package/dist/components/elements/utils/helpers.js +1 -0
- package/dist/components/index.cjs +1 -0
- package/dist/components/index.d.ts +21 -0
- package/dist/components/index.js +1 -0
- package/dist/components/theme/index.cjs +1 -0
- package/dist/components/theme/index.d.ts +45 -0
- package/dist/components/theme/index.js +1 -0
- package/dist/components/theme/variables.css +274 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/plugin.cjs +1 -1
- package/dist/plugins/solely-vite-plugin.cjs +1 -1
- package/dist/plugins/solely-vite-plugin.js +1 -1
- package/dist/router/core.cjs +1 -1
- package/dist/router/core.js +1 -1
- package/dist/router/router-link.cjs +1 -1
- package/dist/router/router-link.js +1 -1
- package/dist/router/router-view.cjs +1 -1
- package/dist/router/router-view.js +1 -1
- package/dist/runtime/component/base-element.cjs +1 -1
- package/dist/runtime/component/base-element.d.ts +12 -0
- package/dist/runtime/component/base-element.js +1 -1
- package/dist/runtime/component/decorators.cjs +1 -1
- package/dist/runtime/component/decorators.js +1 -1
- package/dist/runtime/index.cjs +1 -1
- package/dist/runtime/index.js +1 -1
- package/dist/runtime/reactivity/observe.cjs +1 -1
- package/dist/runtime/reactivity/observe.js +1 -1
- package/dist/runtime/renderer/html-decode.cjs +1 -1
- package/dist/runtime/renderer/html-decode.js +1 -1
- package/dist/runtime/renderer/renderIR.cjs +1 -1
- package/dist/runtime/renderer/renderIR.js +1 -1
- package/dist/shared/env.cjs +1 -1
- package/dist/shared/env.js +1 -1
- package/dist/shared/event-listeners.cjs +1 -1
- package/dist/shared/gen-function.cjs +1 -1
- package/dist/shared/gen-function.js +1 -1
- package/dist/shared/index.cjs +1 -1
- package/dist/shared/is-object.js +1 -1
- package/dist/shared/templateError.cjs +1 -1
- package/dist/shared/templateError.js +1 -1
- package/dist/shared/url.cjs +1 -1
- package/dist/shared/url.js +1 -1
- package/dist/types/index.cjs +1 -1
- package/dist/types/lifecycle.cjs +1 -1
- package/package.json +43 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var t,e,s,i,n,o,
|
|
1
|
+
"use strict";var t,e,s,i,a,n,o,r,h,l,c,u,d,p,f,b,m,y,v,w,g,M,S,$,k=Object.defineProperty,O=t=>{throw TypeError(t)},j=(t,e,s)=>e.has(t)||O("Cannot "+s),C=(t,e,s)=>(j(t,e,"read from private field"),s?s.call(t):e.get(t)),A=(t,e,s)=>e.has(t)?O("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,s),W=(t,e,s,i)=>(j(t,e,"write to private field"),i?i.call(t,s):e.set(t,s),s),N=(t,e,s)=>(j(t,e,"access private method"),s);Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const E=require("../../shared/is-object.cjs"),D=require("../../shared/env.cjs"),P=require("../reactivity/observe.cjs"),U=require("../renderer/renderIR.cjs"),q=Symbol.for("solely.manifest"),I=class m extends HTMLElement{constructor(d={}){var f,m;super(),A(this,p),((t,e,s)=>{e in t?k(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s})(this,"symbol"!=typeof(m="$refs")?m+"":m,{}),A(this,t),A(this,e),A(this,s),A(this,i),A(this,a),A(this,n),A(this,o,!1),A(this,r,!1),A(this,h,!1),A(this,l,!1),A(this,c,!1),A(this,u,!1);const v=this.constructor;W(this,t,v[q]||{tagName:"base-element"});const w=C(this,t);W(this,a,(null==(f=w.shadowDOM)?void 0:f.use)?this.attachShadow({mode:w.shadowDOM.mode||"open"}):this),N(this,p,b).call(this,d),N(this,p,y).call(this,w),queueMicrotask(()=>N(this,p,$).call(this))}static get observedAttributes(){const t=this[q];return(null==t?void 0:t.attributeMap)?Array.from(t.attributeMap.keys()):[]}get $data(){return C(this,i)}set $data(t){var e;E.isObject(t)||(t={}),t!==C(this,i)&&(null==(e=C(this,n))||e.call(this),N(this,p,b).call(this,t),N(this,p,g).call(this))}refresh(){N(this,p,g).call(this)}connectedCallback(){var i;W(this,c,!0);const n=C(this,t);if(N(this,p,$).call(this),(n.className||n.tagName||"").split(" ").forEach(t=>t&&this.classList.add(t)),N(this,p,S).call(this),n.attributeMap&&E.isObject(this.$data)){N(this,p,v).call(this);for(const[t,e]of n.attributeMap){const s=e.name;if(this.hasAttribute(t)){const i=this.getAttribute(t),a=N(this,p,w).call(this,i,e.default,e.type);this.$data[s]=a}else"default"in e&&(this.$data[s]=e.default,"boolean"===e.type&&!0===e.default&&this.setAttribute(t,""))}}N(this,p,f).call(this),C(this,s)&&!C(this,e)&&W(this,e,U.createRender(C(this,s),C(this,a),this)),C(this,u)&&(W(this,u,!1),N(this,p,g).call(this)),this.mounted(),null==(i=this.onInit)||i.call(this)}disconnectedCallback(){var e,s;W(this,c,!1);const i=C(this,t);if(!(null==(e=i.shadowDOM)?void 0:e.use)&&i.styles){const t=`solely-style-${i.tagName}`,e=C(m,d).get(t)||0;e<=1?(null==(s=document.head.querySelector(`#${t}`))||s.remove(),C(m,d).delete(t)):C(m,d).set(t,e-1)}this.unmounted()}attributeChangedCallback(e,s,i){var a;if(s===i||!E.isObject(this.$data))return;const n=null==(a=C(this,t).attributeMap)?void 0:a.get(e);if(!n)return;const o=n.name,r=this.$data[o],l=N(this,p,w).call(this,i,n.default??r,n.type);this.$data[o]=l,W(this,h,!0),this.attributeChanged(e,r,l)}emit(t,e,s){this.dispatchEvent(new CustomEvent(t,{bubbles:!0,composed:!0,detail:e,...s}))}emitNative(t,e){this.dispatchEvent(new Event(t,{bubbles:!0,composed:!0,...e}))}warn(t,e){if(D.IS_DEV&&t){const t=this.tagName.toLowerCase();console.warn(`[${t}] ${e}`)}}error(t,e){if(D.IS_DEV&&t){const t=this.tagName.toLowerCase();console.error(`[${t}] ${e}`)}}onInit(){}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,n=new WeakMap,o=new WeakMap,r=new WeakMap,h=new WeakMap,l=new WeakMap,c=new WeakMap,u=new WeakMap,d=new WeakMap,p=new WeakSet,f=function(){const t=Object.getOwnPropertyNames(this),e=["#","_"],s=new Set(["$data","$refs","constructor","onInit","created","mounted","beforeUpdate","updated","unmounted","attributeChanged","beforeAttributesUpdate","afterAttributesUpdate","emit","refresh"]);for(const i of t){if(s.has(i))continue;if(e.some(t=>i.startsWith(t)))continue;const t=Object.getOwnPropertyDescriptor(this,i);if(!t||!("value"in t))continue;const a=t.value;let n,o=this;for(;o&&(n=Object.getOwnPropertyDescriptor(o,i),!(null==n?void 0:n.set));)o=Object.getPrototypeOf(o);(null==n?void 0:n.set)&&(delete this[i],this[i]=a)}},b=function(e){const{proxy:s,dispose:a}=P.observe(e,e=>{var s;if("set"===e.type){const{key:i,newValue:a}=e,n=C(this,t),o=String(i),r=null==(s=n.propMap)?void 0:s.get(o);(null==r?void 0:r.reflect)&&N(this,p,m).call(this,r,a)}this.emit("dataChange",{...e}),N(this,p,g).call(this)});W(this,i,s),W(this,n,a)},m=function(t,e){const s=t.name.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase();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)}},y=function(t){t.ir&&W(this,s,t.ir)},v=function(){const e=C(this,t);if(e.attributeMap)for(const[t,s]of e.attributeMap){if(!1===s.reactive)continue;const t=Object.getOwnPropertyDescriptor(this.constructor.prototype,s.name);if(!(null==t?void 0:t.get)&&!(null==t?void 0:t.set)){const t=Object.getOwnPropertyDescriptor(this,s.name);t&&"value"in t&&(this.$data[s.name]=t.value,delete this[s.name]),Object.defineProperty(this,s.name,{get:()=>this.$data[s.name],set:t=>{this.$data[s.name]=t},configurable:!0,enumerable:!0})}}},w=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=t.replace(/'/g,'"'),i=JSON.parse(s);return Array.isArray(i)?i:e}catch(i){return console.error(`[Solely] Failed to parse array value: "${t}", using default value.`,i),e}default:return t}},g=function(){C(this,c)?!C(this,r)&&C(this,e)&&(W(this,r,!0),queueMicrotask(()=>{W(this,r,!1),N(this,p,M).call(this)})):W(this,u,!0)},M=function(){if(!C(this,o)&&C(this,c)){W(this,o,!0);try{C(this,h)&&this.beforeAttributesUpdate(),this.beforeUpdate(),C(this,e).update(),this.updated(),C(this,h)&&(this.afterAttributesUpdate(),W(this,h,!1))}finally{W(this,o,!1)}}},S=function(){var e;const s=C(this,t);if(!s.styles)return;const i=C(this,a);if(s.sheet&&i instanceof ShadowRoot&&"adoptedStyleSheets"in i)return void(i.adoptedStyleSheets.includes(s.sheet)||(i.adoptedStyleSheets=[...i.adoptedStyleSheets,s.sheet]));const n=i instanceof ShadowRoot?i:document.head,o=`solely-style-${s.tagName}`,r=!(null==(e=s.shadowDOM)?void 0:e.use);if(!n.querySelector(`#${o}`)){const t=document.createElement("style");t.id=o,t.textContent=s.styles,n.appendChild(t)}if(r){const t=C(I,d).get(o)||0;C(I,d).set(o,t+1)}},$=function(){C(this,l)||(W(this,l,!0),this.created())},A(I,d,new Map),(()=>{if(D.IS_DEV&&"undefined"!=typeof customElements){const t=customElements.define,e=new WeakSet;customElements.define=function(s,i,a){if(I.isPrototypeOf(i)&&!e.has(i)){e.add(i);const t=i.prototype,a=["connectedCallback","disconnectedCallback","attributeChangedCallback"];for(const e of a)t[e]!==I.prototype[e]&&console.error(`[${s}] 禁止重写 ${e}(),请使用框架钩子`)}return t.call(this,s,i,a)}}})();let _=I;exports.default=_;
|
|
@@ -19,6 +19,18 @@ declare class BaseElement<TData extends object = Record<string, unknown>, TRefs
|
|
|
19
19
|
attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
|
|
20
20
|
emit(eventName: string, detail?: unknown, options?: Partial<CustomEventInit>): void;
|
|
21
21
|
emitNative(eventName: string, options?: EventInit): void;
|
|
22
|
+
/**
|
|
23
|
+
* 在开发模式下输出警告信息
|
|
24
|
+
* @param condition - 是否输出警告的条件
|
|
25
|
+
* @param message - 警告信息
|
|
26
|
+
*/
|
|
27
|
+
protected warn(condition: boolean, message: string): void;
|
|
28
|
+
/**
|
|
29
|
+
* 在开发模式下输出错误信息
|
|
30
|
+
* @param condition - 是否输出错误的条件
|
|
31
|
+
* @param message - 错误信息
|
|
32
|
+
*/
|
|
33
|
+
protected error(condition: boolean, message: string): void;
|
|
22
34
|
onInit(): void | Promise<void>;
|
|
23
35
|
created(): void;
|
|
24
36
|
mounted(): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var t,e,s,i,
|
|
1
|
+
var t,e,s,i,a,o,n,r,h,l,c,u,d,p,f,b,m,y,v,w,g,M,$,k,S=Object.defineProperty,O=t=>{throw TypeError(t)},C=(t,e,s)=>e.has(t)||O("Cannot "+s),A=(t,e,s)=>(C(t,e,"read from private field"),s?s.call(t):e.get(t)),W=(t,e,s)=>e.has(t)?O("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,s),j=(t,e,s,i)=>(C(t,e,"write to private field"),i?i.call(t,s):e.set(t,s),s),N=(t,e,s)=>(C(t,e,"access private method"),s);import{isObject as E}from"../../shared/is-object.js";import{IS_DEV as P}from"../../shared/env.js";import{observe as U}from"../reactivity/observe.js";import{createRender as D}from"../renderer/renderIR.js";const L=Symbol.for("solely.manifest"),q=class m extends HTMLElement{constructor(d={}){var f,m;super(),W(this,p),((t,e,s)=>{e in t?S(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s})(this,"symbol"!=typeof(m="$refs")?m+"":m,{}),W(this,t),W(this,e),W(this,s),W(this,i),W(this,a),W(this,o),W(this,n,!1),W(this,r,!1),W(this,h,!1),W(this,l,!1),W(this,c,!1),W(this,u,!1);const v=this.constructor;j(this,t,v[L]||{tagName:"base-element"});const w=A(this,t);j(this,a,(null==(f=w.shadowDOM)?void 0:f.use)?this.attachShadow({mode:w.shadowDOM.mode||"open"}):this),N(this,p,b).call(this,d),N(this,p,y).call(this,w),queueMicrotask(()=>N(this,p,k).call(this))}static get observedAttributes(){const t=this[L];return(null==t?void 0:t.attributeMap)?Array.from(t.attributeMap.keys()):[]}get $data(){return A(this,i)}set $data(t){var e;E(t)||(t={}),t!==A(this,i)&&(null==(e=A(this,o))||e.call(this),N(this,p,b).call(this,t),N(this,p,g).call(this))}refresh(){N(this,p,g).call(this)}connectedCallback(){var i;j(this,c,!0);const o=A(this,t);if(N(this,p,k).call(this),(o.className||o.tagName||"").split(" ").forEach(t=>t&&this.classList.add(t)),N(this,p,$).call(this),o.attributeMap&&E(this.$data)){N(this,p,v).call(this);for(const[t,e]of o.attributeMap){const s=e.name;if(this.hasAttribute(t)){const i=this.getAttribute(t),a=N(this,p,w).call(this,i,e.default,e.type);this.$data[s]=a}else"default"in e&&(this.$data[s]=e.default,"boolean"===e.type&&!0===e.default&&this.setAttribute(t,""))}}N(this,p,f).call(this),A(this,s)&&!A(this,e)&&j(this,e,D(A(this,s),A(this,a),this)),A(this,u)&&(j(this,u,!1),N(this,p,g).call(this)),this.mounted(),null==(i=this.onInit)||i.call(this)}disconnectedCallback(){var e,s;j(this,c,!1);const i=A(this,t);if(!(null==(e=i.shadowDOM)?void 0:e.use)&&i.styles){const t=`solely-style-${i.tagName}`,e=A(m,d).get(t)||0;e<=1?(null==(s=document.head.querySelector(`#${t}`))||s.remove(),A(m,d).delete(t)):A(m,d).set(t,e-1)}this.unmounted()}attributeChangedCallback(e,s,i){var a;if(s===i||!E(this.$data))return;const o=null==(a=A(this,t).attributeMap)?void 0:a.get(e);if(!o)return;const n=o.name,r=this.$data[n],l=N(this,p,w).call(this,i,o.default??r,o.type);this.$data[n]=l,j(this,h,!0),this.attributeChanged(e,r,l)}emit(t,e,s){this.dispatchEvent(new CustomEvent(t,{bubbles:!0,composed:!0,detail:e,...s}))}emitNative(t,e){this.dispatchEvent(new Event(t,{bubbles:!0,composed:!0,...e}))}warn(t,e){if(P&&t){const t=this.tagName.toLowerCase();console.warn(`[${t}] ${e}`)}}error(t,e){if(P&&t){const t=this.tagName.toLowerCase();console.error(`[${t}] ${e}`)}}onInit(){}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,o=new WeakMap,n=new WeakMap,r=new WeakMap,h=new WeakMap,l=new WeakMap,c=new WeakMap,u=new WeakMap,d=new WeakMap,p=new WeakSet,f=function(){const t=Object.getOwnPropertyNames(this),e=["#","_"],s=new Set(["$data","$refs","constructor","onInit","created","mounted","beforeUpdate","updated","unmounted","attributeChanged","beforeAttributesUpdate","afterAttributesUpdate","emit","refresh"]);for(const i of t){if(s.has(i))continue;if(e.some(t=>i.startsWith(t)))continue;const t=Object.getOwnPropertyDescriptor(this,i);if(!t||!("value"in t))continue;const a=t.value;let o,n=this;for(;n&&(o=Object.getOwnPropertyDescriptor(n,i),!(null==o?void 0:o.set));)n=Object.getPrototypeOf(n);(null==o?void 0:o.set)&&(delete this[i],this[i]=a)}},b=function(e){const{proxy:s,dispose:a}=U(e,e=>{var s;if("set"===e.type){const{key:i,newValue:a}=e,o=A(this,t),n=String(i),r=null==(s=o.propMap)?void 0:s.get(n);(null==r?void 0:r.reflect)&&N(this,p,m).call(this,r,a)}this.emit("dataChange",{...e}),N(this,p,g).call(this)});j(this,i,s),j(this,o,a)},m=function(t,e){const s=t.name.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase();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)}},y=function(t){t.ir&&j(this,s,t.ir)},v=function(){const e=A(this,t);if(e.attributeMap)for(const[t,s]of e.attributeMap){if(!1===s.reactive)continue;const t=Object.getOwnPropertyDescriptor(this.constructor.prototype,s.name);if(!(null==t?void 0:t.get)&&!(null==t?void 0:t.set)){const t=Object.getOwnPropertyDescriptor(this,s.name);t&&"value"in t&&(this.$data[s.name]=t.value,delete this[s.name]),Object.defineProperty(this,s.name,{get:()=>this.$data[s.name],set:t=>{this.$data[s.name]=t},configurable:!0,enumerable:!0})}}},w=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=t.replace(/'/g,'"'),i=JSON.parse(s);return Array.isArray(i)?i:e}catch(i){return console.error(`[Solely] Failed to parse array value: "${t}", using default value.`,i),e}default:return t}},g=function(){A(this,c)?!A(this,r)&&A(this,e)&&(j(this,r,!0),queueMicrotask(()=>{j(this,r,!1),N(this,p,M).call(this)})):j(this,u,!0)},M=function(){if(!A(this,n)&&A(this,c)){j(this,n,!0);try{A(this,h)&&this.beforeAttributesUpdate(),this.beforeUpdate(),A(this,e).update(),this.updated(),A(this,h)&&(this.afterAttributesUpdate(),j(this,h,!1))}finally{j(this,n,!1)}}},$=function(){var e;const s=A(this,t);if(!s.styles)return;const i=A(this,a);if(s.sheet&&i instanceof ShadowRoot&&"adoptedStyleSheets"in i)return void(i.adoptedStyleSheets.includes(s.sheet)||(i.adoptedStyleSheets=[...i.adoptedStyleSheets,s.sheet]));const o=i instanceof ShadowRoot?i:document.head,n=`solely-style-${s.tagName}`,r=!(null==(e=s.shadowDOM)?void 0:e.use);if(!o.querySelector(`#${n}`)){const t=document.createElement("style");t.id=n,t.textContent=s.styles,o.appendChild(t)}if(r){const t=A(q,d).get(n)||0;A(q,d).set(n,t+1)}},k=function(){A(this,l)||(j(this,l,!0),this.created())},W(q,d,new Map),(()=>{if(P&&"undefined"!=typeof customElements){const t=customElements.define,e=new WeakSet;customElements.define=function(s,i,a){if(q.isPrototypeOf(i)&&!e.has(i)){e.add(i);const t=i.prototype,a=["connectedCallback","disconnectedCallback","attributeChangedCallback"];for(const e of a)t[e]!==q.prototype[e]&&console.error(`[${s}] 禁止重写 ${e}(),请使用框架钩子`)}return t.call(this,s,i,a)}}})();let x=q;export{x as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../shared/env.cjs"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../shared/env.cjs"),t=require("../../compiler/parser/parser.cjs"),r=require("../../compiler/ir/buildIR.cjs"),n=Symbol.for("solely.manifest");exports.CustomElement=o=>{const s=o,l="undefined"!=typeof window&&"undefined"!=typeof customElements;return o=>{const{tagName:a}=s;if(l&&!(o.prototype instanceof HTMLElement)&&o!==HTMLElement)throw new TypeError(`[Solely] CustomElement decorator can only be applied to classes extending HTMLElement.\nReceived: ${o.name||"anonymous class"}`);if(l&&customElements.get(a))return e.IS_DEV&&console.warn(`[Solely] 标签名称 "${a}" 已经被注册,跳过重复定义。`),o[n]=s,o;if("string"!=typeof s.template||s.ir){if(s.template&&!s.ir)if("object"==typeof s.template&&null!==s.template){const t=s.template;"root"===t.t&&Array.isArray(t.fns)&&Array.isArray(t.n)?(s.ir=t,e.IS_DEV&&console.info(`[Solely] Using precompiled IR for <${a}> | Nodes: ${t.n.length} | Fns: ${t.fns.length}`)):console.error(`[Manifest Error] <${a}>: 提供的 template 不是有效的 IRRoot 对象。\n期望: { t: "root", fns: [], n: [] }\n实际: ${JSON.stringify(Object.keys(t))}`)}else console.error(`[Manifest Error] <${a}>: template 类型无效。\n期望: string 或 IRRoot 对象\n实际: ${typeof s.template}`)}else if(s.template.trim())try{const e=t.parseHtml(s.template);s.ir=r.buildIR(e,{source:s.template,filename:a})}catch(c){const t=c instanceof Error?c:new Error(String(c));console.error(`[Compiler Error] <${a}>: 模板编译失败\n错误: ${t.message}\n模板长度: ${s.template.length} 字符`,e.IS_DEV?t.stack:"")}else e.IS_DEV&&console.warn(`[Solely] <${a}>: 模板为空字符串`);if(l&&s.styles&&!s.sheet&&"CSSStyleSheet"in window)try{const e=new CSSStyleSheet;"function"==typeof e.replaceSync&&(e.replaceSync(s.styles),s.sheet=e)}catch(c){e.IS_DEV&&console.warn(`[Style Warning] <${a}>: CSSStyleSheet 不可用,将使用 style 标签回退方案`)}if(s.props&&!s.attributeMap){const e=new Map,t=new Map;s.props.forEach(r=>{const n="string"==typeof r?{name:r}:r,o=n.name.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z])([A-Z][a-z])/g,"$1-$2").toLowerCase(),s=n.name,l={...n,name:s};e.set(o,l),t.set(s,l)}),s.attributeMap=e,s.propMap=t}class i extends o{}return i[n]=s,l&&customElements.define(a,i),i}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{IS_DEV as e}from"../../shared/env.js";import{parseHtml as
|
|
1
|
+
import{IS_DEV as e}from"../../shared/env.js";import{parseHtml as t}from"../../compiler/parser/parser.js";import{buildIR as n}from"../../compiler/ir/buildIR.js";const o=Symbol.for("solely.manifest"),r=r=>{const s=r,l="undefined"!=typeof window&&"undefined"!=typeof customElements;return r=>{const{tagName:a}=s;if(l&&!(r.prototype instanceof HTMLElement)&&r!==HTMLElement)throw new TypeError(`[Solely] CustomElement decorator can only be applied to classes extending HTMLElement.\nReceived: ${r.name||"anonymous class"}`);if(l&&customElements.get(a))return e&&console.warn(`[Solely] 标签名称 "${a}" 已经被注册,跳过重复定义。`),r[o]=s,r;if("string"!=typeof s.template||s.ir){if(s.template&&!s.ir)if("object"==typeof s.template&&null!==s.template){const t=s.template;"root"===t.t&&Array.isArray(t.fns)&&Array.isArray(t.n)?(s.ir=t,e&&console.info(`[Solely] Using precompiled IR for <${a}> | Nodes: ${t.n.length} | Fns: ${t.fns.length}`)):console.error(`[Manifest Error] <${a}>: 提供的 template 不是有效的 IRRoot 对象。\n期望: { t: "root", fns: [], n: [] }\n实际: ${JSON.stringify(Object.keys(t))}`)}else console.error(`[Manifest Error] <${a}>: template 类型无效。\n期望: string 或 IRRoot 对象\n实际: ${typeof s.template}`)}else if(s.template.trim())try{const e=t(s.template);s.ir=n(e,{source:s.template,filename:a})}catch(p){const t=p instanceof Error?p:new Error(String(p));console.error(`[Compiler Error] <${a}>: 模板编译失败\n错误: ${t.message}\n模板长度: ${s.template.length} 字符`,e?t.stack:"")}else e&&console.warn(`[Solely] <${a}>: 模板为空字符串`);if(l&&s.styles&&!s.sheet&&"CSSStyleSheet"in window)try{const e=new CSSStyleSheet;"function"==typeof e.replaceSync&&(e.replaceSync(s.styles),s.sheet=e)}catch(p){e&&console.warn(`[Style Warning] <${a}>: CSSStyleSheet 不可用,将使用 style 标签回退方案`)}if(s.props&&!s.attributeMap){const e=new Map,t=new Map;s.props.forEach(n=>{const o="string"==typeof n?{name:n}:n,r=o.name.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z])([A-Z][a-z])/g,"$1-$2").toLowerCase(),s=o.name,l={...o,name:s};e.set(r,l),t.set(s,l)}),s.attributeMap=e,s.propMap=t}class i extends r{}return i[o]=s,l&&customElements.define(a,i),i}};export{r as CustomElement};
|
package/dist/runtime/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./component/base-element.cjs"),r=require("./renderer/html-decode.cjs"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./component/base-element.cjs"),r=require("./renderer/html-decode.cjs"),t=require("./component/decorators.cjs"),o=require("./renderer/renderIR.cjs"),s=require("./reactivity/observe.cjs");exports.BaseElement=e.default,exports.htmlDecode=r.default,exports.CustomElement=t.CustomElement,exports.IRRenderer=o.IRRenderer,exports.createRender=o.createRender,exports.isProxy=s.isProxy,exports.observe=s.observe,exports.toRaw=s.toRaw;
|
package/dist/runtime/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{default as e}from"./component/base-element.js";import{default as r}from"./renderer/html-decode.js";import{
|
|
1
|
+
import{default as e}from"./component/base-element.js";import{default as r}from"./renderer/html-decode.js";import{CustomElement as o}from"./component/decorators.js";import{IRRenderer as t,createRender as m}from"./renderer/renderIR.js";import{isProxy as s,observe as a,toRaw as d}from"./reactivity/observe.js";export{e as BaseElement,o as CustomElement,t as IRRenderer,m as createRender,r as htmlDecode,s as isProxy,a as observe,d as toRaw};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../shared/is-object.cjs"),t=Symbol("solely.raw"),r=new WeakMap,n=new WeakMap,
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../shared/is-object.cjs"),t=Symbol("solely.raw"),r=new WeakMap,n=new WeakMap,i=new WeakMap,s=new WeakMap,l=new WeakMap;function a(e){if(e&&"object"==typeof e){const r=e[t];if(r)return r}return e}const o=e=>!(!e||"object"!=typeof e)&&(e instanceof File||e instanceof Blob||e instanceof FormData||e instanceof ArrayBuffer||e instanceof Response||e instanceof Request);function c(e){return!(!e||!e[t])}const u=(e,t,r=new WeakMap)=>{if(e===t)return!0;if(null==e||null==t)return e===t;if("object"!=typeof e||"object"!=typeof t)return e===t;if(Array.isArray(e)!==Array.isArray(t))return!1;if(r.has(e))return r.get(e)===t;if(r.set(e,t),Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!u(e[n],t[n],r))return!1;return!0}const n=Reflect.ownKeys(e);if(n.length!==Reflect.ownKeys(t).length)return!1;for(const i of n){if(!Reflect.has(t,i))return!1;const n=e[i],s=t[i];if(!u(n,s,r))return!1}return!0},f=e=>{const t=[];let r=e;for(;r;){const e=i.get(r);if(!e||null==e.key)break;t.unshift(e.key),r=e.parent}return t},p=(e,t)=>{if(0===t.length)return!0;const r=e.map(String).join(".");return t.some(e=>e.test(r))},y=(e,t)=>{const n=f(e);let s=e;for(;s;){const e=r.get(s);e&&e.forEach(e=>{var r;if(!e.active)return;const i=s?f(s):[],l=[...i,...n.slice(i.length)];if(!p(l,e.filterRegexes))return;const a={...t,path:l};e.throttle>0?(e.pending.push(a),e.timer||(e.timer=setTimeout(()=>{var t;if(!e.active)return;const r=[...e.pending];e.pending=[],e.timer=null,r.length>0&&(null==(t=e.onBatch)||t.call(e,r),r.forEach(t=>e.callback(t)))},e.throttle))):(null==(r=e.onBatch)||r.call(e,[a]),e.callback(a))});const l=i.get(s);s=(null==l?void 0:l.parent)||null}};exports.isProxy=c,exports.observe=function(f,p,h={}){const{throttle:d=0,onBatch:g,immediate:m=!1,deepCompare:b=!1}=h,w={callback:p,onBatch:g,throttle:d,filterRegexes:(Array.isArray(h.filter)?h.filter:h.filter?[h.filter]:[]).map(e=>{if(""===e)return/^.*$/;const t=e.replace(/\./g,"\\.").replace(/\*\*/g,"(.+)").replace(/\*/g,"[^.]+").replace(/\[\d+\]/g,"\\[\\d+\\]");return new RegExp(`^${t}$`)}),pending:[],timer:null,active:!0},A=(r,f,p)=>{if(!Object.isExtensible(r))return r;if(o(r))return r;if(r[t])return r;const h=n.get(r);if(h)return h;const d=new Proxy(r,{get(r,n,i){if(n===t)return r;if(Array.isArray(r)){const e=s.get(d);if(e&&Object.prototype.hasOwnProperty.call(e,n))return Reflect.get(e,n,i)}const l=Reflect.get(r,n,i);return"symbol"==typeof n?l:e.isObject(l)&&!o(l)?A(l,d,n):l},set(e,t,r,n){const i=e[t];if(b?u(i,r):i===r)return!0;const s=Reflect.set(e,t,r,n);return 0===(l.get(d)||0)&&(Array.isArray(i)&&Array.isArray(r)?y(d,{type:"array-replace",oldValue:i,newValue:r}):y(d,{type:"set",key:t,newValue:r,oldValue:i})),s},deleteProperty(e,t){if(!Reflect.has(e,t))return!1;const r=e[t],n=Reflect.deleteProperty(e,t),i=l.get(d)||0;return n&&0===i&&y(d,{type:"delete",key:t,oldValue:r}),n}});return n.set(r,d),i.set(d,{parent:f,key:p}),Array.isArray(r)&&s.set(d,((e,t)=>{const r={};return["push","pop","shift","unshift","splice"].forEach(n=>{r[n]=function(...r){if(!t)return;const i=l.get(t)||0;l.set(t,i+1);const s=e[n].apply(e,r);if(l.set(t,i),"push"===n)y(t,{type:"array-push",index:e.length-r.length,values:r});else if("unshift"===n)y(t,{type:"array-push",index:0,values:r});else if("pop"===n)y(t,{type:"array-splice",index:e.length,deleteCount:1,insert:[]});else if("shift"===n)y(t,{type:"array-splice",index:0,deleteCount:1,insert:[]});else if("splice"===n){const[e,n,...i]=r;y(t,{type:"array-splice",index:e,deleteCount:n,insert:i})}return s}}),["sort","reverse","fill","copyWithin"].forEach(n=>{r[n]=function(...r){if(!t)return;const i=l.get(t)||0;l.set(t,i+1);const s=e[n].apply(e,r);return l.set(t,i),y(t,{type:"array-reset",method:n}),s}}),["indexOf","lastIndexOf","includes"].forEach(t=>{r[t]=function(r,...n){let i=e[t].apply(e,[r,...n]);return-1!==i&&!1!==i||!c(r)||(i=e[t].apply(e,[a(r),...n])),i}}),r})(r,d)),d},k=A(f,null,null);let v=r.get(k);if(v||(v=new Set,r.set(k,v)),v.add(w),m){const t=(r,n,i=new WeakSet)=>{e.isObject(r)&&!i.has(r)&&(i.add(r),Reflect.ownKeys(r).forEach(s=>{const l=r[s];e.isObject(l)&&i.has(l)||(y(n,{type:"set",key:s,newValue:l,oldValue:void 0}),e.isObject(l)&&t(l,A(l,n,s),i))}))};t(f,k)}return{proxy:k,unobserve:()=>{w.active=!1,w.pending=[],w.timer&&(clearTimeout(w.timer),w.timer=null);const e=r.get(k);e&&e.delete(w)},resume:()=>{if(w.active)return;w.active=!0;let e=r.get(k);e||(e=new Set,r.set(k,e)),e.has(w)||e.add(w)},dispose:()=>{w.active=!1,w.pending=[],w.timer&&(clearTimeout(w.timer),w.timer=null);const e=r.get(k);e&&e.delete(w),w.callback=()=>{},w.onBatch=void 0}}},exports.toRaw=a;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{isObject as e}from"../../shared/is-object.js";const t=Symbol("solely.raw"),r=new WeakMap,n=new WeakMap,
|
|
1
|
+
import{isObject as e}from"../../shared/is-object.js";const t=Symbol("solely.raw"),r=new WeakMap,n=new WeakMap,l=new WeakMap,a=new WeakMap,i=new WeakMap;function s(e){if(e&&"object"==typeof e){const r=e[t];if(r)return r}return e}const o=e=>!(!e||"object"!=typeof e)&&(e instanceof File||e instanceof Blob||e instanceof FormData||e instanceof ArrayBuffer||e instanceof Response||e instanceof Request);function c(e){return!(!e||!e[t])}const f=(e,t,r=new WeakMap)=>{if(e===t)return!0;if(null==e||null==t)return e===t;if("object"!=typeof e||"object"!=typeof t)return e===t;if(Array.isArray(e)!==Array.isArray(t))return!1;if(r.has(e))return r.get(e)===t;if(r.set(e,t),Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!f(e[n],t[n],r))return!1;return!0}const n=Reflect.ownKeys(e);if(n.length!==Reflect.ownKeys(t).length)return!1;for(const l of n){if(!Reflect.has(t,l))return!1;const n=e[l],a=t[l];if(!f(n,a,r))return!1}return!0},u=e=>{const t=[];let r=e;for(;r;){const e=l.get(r);if(!e||null==e.key)break;t.unshift(e.key),r=e.parent}return t},p=(e,t)=>{if(0===t.length)return!0;const r=e.map(String).join(".");return t.some(e=>e.test(r))},y=(e,t)=>{const n=u(e);let a=e;for(;a;){const e=r.get(a);e&&e.forEach(e=>{var r;if(!e.active)return;const l=a?u(a):[],i=[...l,...n.slice(l.length)];if(!p(i,e.filterRegexes))return;const s={...t,path:i};e.throttle>0?(e.pending.push(s),e.timer||(e.timer=setTimeout(()=>{var t;if(!e.active)return;const r=[...e.pending];e.pending=[],e.timer=null,r.length>0&&(null==(t=e.onBatch)||t.call(e,r),r.forEach(t=>e.callback(t)))},e.throttle))):(null==(r=e.onBatch)||r.call(e,[s]),e.callback(s))});const i=l.get(a);a=(null==i?void 0:i.parent)||null}};function h(u,p,h={}){const{throttle:d=0,onBatch:g,immediate:m=!1,deepCompare:w=!1}=h,A={callback:p,onBatch:g,throttle:d,filterRegexes:(Array.isArray(h.filter)?h.filter:h.filter?[h.filter]:[]).map(e=>{if(""===e)return/^.*$/;const t=e.replace(/\./g,"\\.").replace(/\*\*/g,"(.+)").replace(/\*/g,"[^.]+").replace(/\[\d+\]/g,"\\[\\d+\\]");return new RegExp(`^${t}$`)}),pending:[],timer:null,active:!0},k=(r,u,p)=>{if(!Object.isExtensible(r))return r;if(o(r))return r;if(r[t])return r;const h=n.get(r);if(h)return h;const d=new Proxy(r,{get(r,n,l){if(n===t)return r;if(Array.isArray(r)){const e=a.get(d);if(e&&Object.prototype.hasOwnProperty.call(e,n))return Reflect.get(e,n,l)}const i=Reflect.get(r,n,l);return"symbol"==typeof n?i:e(i)&&!o(i)?k(i,d,n):i},set(e,t,r,n){const l=e[t];if(w?f(l,r):l===r)return!0;const a=Reflect.set(e,t,r,n);return 0===(i.get(d)||0)&&(Array.isArray(l)&&Array.isArray(r)?y(d,{type:"array-replace",oldValue:l,newValue:r}):y(d,{type:"set",key:t,newValue:r,oldValue:l})),a},deleteProperty(e,t){if(!Reflect.has(e,t))return!1;const r=e[t],n=Reflect.deleteProperty(e,t),l=i.get(d)||0;return n&&0===l&&y(d,{type:"delete",key:t,oldValue:r}),n}});return n.set(r,d),l.set(d,{parent:u,key:p}),Array.isArray(r)&&a.set(d,((e,t)=>{const r={};return["push","pop","shift","unshift","splice"].forEach(n=>{r[n]=function(...r){if(!t)return;const l=i.get(t)||0;i.set(t,l+1);const a=e[n].apply(e,r);if(i.set(t,l),"push"===n)y(t,{type:"array-push",index:e.length-r.length,values:r});else if("unshift"===n)y(t,{type:"array-push",index:0,values:r});else if("pop"===n)y(t,{type:"array-splice",index:e.length,deleteCount:1,insert:[]});else if("shift"===n)y(t,{type:"array-splice",index:0,deleteCount:1,insert:[]});else if("splice"===n){const[e,n,...l]=r;y(t,{type:"array-splice",index:e,deleteCount:n,insert:l})}return a}}),["sort","reverse","fill","copyWithin"].forEach(n=>{r[n]=function(...r){if(!t)return;const l=i.get(t)||0;i.set(t,l+1);const a=e[n].apply(e,r);return i.set(t,l),y(t,{type:"array-reset",method:n}),a}}),["indexOf","lastIndexOf","includes"].forEach(t=>{r[t]=function(r,...n){let l=e[t].apply(e,[r,...n]);return-1!==l&&!1!==l||!c(r)||(l=e[t].apply(e,[s(r),...n])),l}}),r})(r,d)),d},b=k(u,null,null);let v=r.get(b);if(v||(v=new Set,r.set(b,v)),v.add(A),m){const t=(r,n,l=new WeakSet)=>{e(r)&&!l.has(r)&&(l.add(r),Reflect.ownKeys(r).forEach(a=>{const i=r[a];e(i)&&l.has(i)||(y(n,{type:"set",key:a,newValue:i,oldValue:void 0}),e(i)&&t(i,k(i,n,a),l))}))};t(u,b)}return{proxy:b,unobserve:()=>{A.active=!1,A.pending=[],A.timer&&(clearTimeout(A.timer),A.timer=null);const e=r.get(b);e&&e.delete(A)},resume:()=>{if(A.active)return;A.active=!0;let e=r.get(b);e||(e=new Set,r.set(b,e)),e.has(A)||e.add(A)},dispose:()=>{A.active=!1,A.pending=[],A.timer&&(clearTimeout(A.timer),A.timer=null);const e=r.get(b);e&&e.delete(A),A.callback=()=>{},A.onBatch=void 0}}}export{c as isProxy,h as observe,s as toRaw};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=(()=>{const e={amp:"&",lt:"<",gt:">",quot:'"',apos:"'",nbsp:" ",copy:"©",reg:"®",trade:"™",hellip:"…",middot:"·",euro:"€"},t={128:8364,130:8218,131:402,132:8222,133:8230,134:8224,135:8225,136:710,137:8240,138:352,139:8249,140:338,142:381,145:8216,146:8217,147:8220,148:8221,149:8226,150:8211,151:8212,152:732,153:8482,154:353,155:8250,156:339,158:382,159:376},r=/&(?:#([xX][0-9a-fA-F]+|\d+)|([a-zA-Z0-9]+));/g;return function(o){return o&&"string"==typeof o&&o.includes("&")?o.replace(r,(r,o,n)=>{if(n)return e[n.toLowerCase()]||r;if(o){const e="x"===o[0]||"X"===o[0];let n=parseInt(e?o.slice(1):o,e?16:10);return isNaN(n)?r:(n>=128&&n<=159&&(n=t[n]||n),0===n||n>=55296&&n<=57343||n>1114111?"�":String.fromCodePoint(n))}return r}):o}})();exports.default=e;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const t=(()=>{const t={amp:"&",lt:"<",gt:">",quot:'"',apos:"'",nbsp:" ",copy:"©",reg:"®",trade:"™",hellip:"…",middot:"·",euro:"€"},
|
|
1
|
+
const t=(()=>{const t={amp:"&",lt:"<",gt:">",quot:'"',apos:"'",nbsp:" ",copy:"©",reg:"®",trade:"™",hellip:"…",middot:"·",euro:"€"},e={128:8364,130:8218,131:402,132:8222,133:8230,134:8224,135:8225,136:710,137:8240,138:352,139:8249,140:338,142:381,145:8216,146:8217,147:8220,148:8221,149:8226,150:8211,151:8212,152:732,153:8482,154:353,155:8250,156:339,158:382,159:376},r=/&(?:#([xX][0-9a-fA-F]+|\d+)|([a-zA-Z0-9]+));/g;return function(n){return n&&"string"==typeof n&&n.includes("&")?n.replace(r,(r,n,o)=>{if(o)return t[o.toLowerCase()]||r;if(n){const t="x"===n[0]||"X"===n[0];let o=parseInt(t?n.slice(1):n,t?16:10);return isNaN(o)?r:(o>=128&&o<=159&&(o=e[o]||o),0===o||o>=55296&&o<=57343||o>1114111?"�":String.fromCodePoint(o))}return r}):n}})();export{t as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var e=Object.defineProperty,t=(t,r,o)=>((t,r,o)=>r in t?e(t,r,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[r]=o)(t,"symbol"!=typeof r?r+"":r,o);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../../types/ast.cjs"),o=require("../../shared/templateError.cjs"),s=require("../../shared/env.cjs"),n=require("./html-decode.cjs"),i=Symbol("solely.irCtx"),a=Symbol("solely.irEvents"),c=Symbol("solely.prevClassObj"),l=Symbol("solely.prevStyleObj"),d={xml:"http://www.w3.org/XML/1998/namespace",xlink:"http://www.w3.org/1999/xlink",xmlns:"http://www.w3.org/2000/xmlns/"},h={readonly:"readOnly",for:"htmlFor",tabindex:"tabIndex",contenteditable:"contentEditable",maxlength:"maxLength"},u=new Set(["data-","aria-","role","form"]),m=new Set(["value","selectedIndex"]);function f(e,t){var r;const o=null==(r=t.a)?void 0:r.find(e=>"class"===e.k&&!e.d);(null==o?void 0:o.v)&&e.setAttribute("class",o.v)}function p(e,t){var r;if(!e.style)return;const o=null==(r=t.a)?void 0:r.find(e=>"style"===e.k&&!e.d),s=o?v(o.v):{};for(const n in s){const t=s[n];n.startsWith("--")?e.style.setProperty(n,t):e.style[n]=t}}const y=e=>!(!e||0===e.length||/\s/.test(e)&&(s.IS_DEV&&console.warn(`[Solely] Invalid class name "${e}" contains whitespace, will be ignored`),1));function v(e){const t={},r=[[e]];for(;r.length;){const[e,o]=r.pop()||[];if(e){if("string"==typeof e){const r=/([^:;]+)\s*:\s*([^;]*\(.*?\)[^;]*|[^;]+)/g;let o;for(;null!==(o=r.exec(e));){const e=o[1].trim(),r=o[2].trim();e&&r&&(t[e]=r)}continue}if(Array.isArray(e))for(let t=e.length-1;t>=0;t--)r.push([e[t]]);else if("object"==typeof e)for(const s in e){const n=e[s];if(null==n)continue;const i=o?`${o}-${s}`:s;"object"!=typeof n||Array.isArray(n)?t[i]=String(n):r.push([n,i])}}}return t}function b(e,t,r){const o=null==r?"":String(r),s=t.indexOf(":");if(s>0){const r=t.slice(0,s),n=d[r];if(n)return void(e.getAttributeNS(n,t)!==o&&e.setAttributeNS(n,t,o))}e.getAttribute(t)!==o&&e.setAttribute(t,o)}function S(e,t,r){const o=h[t]||t;if(t.startsWith("data-")||t.startsWith("aria-")||u.has(t))return void b(e,t,r);const s=e,n=s.tagName;if(null!=r){if("src"===o||"href"===o){const t=String(r);if(s[o]===t||e.getAttribute(o)===t)return}if("value"!==o||"INPUT"!==n&&"TEXTAREA"!==n||s.value!==r)if("boolean"!=typeof r)(e instanceof SVGElement||void 0!==s.ownerSVGElement)&&!h[t]?b(e,t,r):s[o]!==r&&(s[o]=r);else{if(s[o]===r)return;s[o]=r}}else if("boolean"==typeof s[o])!1!==s[o]&&(s[o]=!1);else{const r=s[o];""!==r&&void 0!==r&&(s[o]=""),e.hasAttribute(t)&&e.removeAttribute(t)}}class g{constructor(e,r,o={}){t(this,"nodeMap",new Map),t(this,"marker",!1),t(this,"staticSubtreeCache",new Map),this.ir=e,this.container=r,this.scope=o}evalIR(e,t,r){var s;const n=this.ir.fns[e-1];try{return n?n.apply(this.scope,t):""}catch(i){return o.showTemplateError(i.message||i.toString(),(null==(s=this.ir.m)?void 0:s.src)||"",r,this.scope.tagName),""}}createElement(e,t){const r=e.g??"";return t instanceof SVGElement||"svg"===r?document.createElementNS("http://www.w3.org/2000/svg",r):document.createElement(r)}createText(e,t){const r=e.d?this.evalIR(e.f??-1,[t],e.__m):n.default(e.x||"");return document.createTextNode(r)}createComment(e,t){const r=e.d?this.evalIR(e.f??-1,[t],e.__m):e.x||"";return document.createComment(r)}applyAttrs(e,t,r,o=!1){const s=[],n=e;let d;n[i]||(n[i]={loops:null}),n[i].loops=r,n[a]||(n[a]=Object.create(null));let h,u=!1,f=!1;for(const c of t){const{k:t,f:l,d:p,v:y}=c;if(":class"===t){d=this.evalIR(l??-1,[r],c.__m),u=!0;continue}if(":style"===t){h=this.evalIR(l??-1,[r],c.__m),f=!0;continue}if("class"===t||"style"===t)continue;const v=t[0];if("@"===v){const r=t.slice(1),s=c.r??"user";let d=n[a][r];if(d||(d=n[a][r]={model:[],user:[]},e.addEventListener(r,e=>{for(const t of d.model)t(e);for(const t of d.user)t(e)})),!o){const e=e=>this.evalIR(l??-1,[e,n[i].loops],c.__m);d[s].push(e)}continue}if("mounted"===t){o||requestAnimationFrame(()=>this.evalIR(l??-1,[e,r],c.__m));continue}if("updated"===t){o&&requestAnimationFrame(()=>this.evalIR(l??-1,[e,r],c.__m));continue}if("ref"===t&&y){this.scope.$refs=this.scope.$refs||{},this.scope.$refs[y]=e;continue}const g=p?this.evalIR(l??-1,[r],c.__m):y??"";if(":"===v){const r=t.slice(1);"SELECT"===e.tagName&&m.has(r)?s.push(()=>S(e,r,g)):S(e,r,g)}else o||b(e,t,String(g))}return u&&((e,t)=>{const r=e,o=r[c],s=function(e){const t={},r=[e];for(;r.length;){const e=r.pop();if(e)if("string"==typeof e){const r=e.split(" ");for(let e=0;e<r.length;e++){const o=r[e].trim();o&&(t[o]=!0)}}else if(Array.isArray(e))for(let t=e.length-1;t>=0;t--)r.push(e[t]);else if("object"==typeof e)for(const r in e)e[r]&&(t[r]=!0)}return t}(t),n={};for(const a in s)y(a)&&(n[a]=s[a]);if(!o){for(const t in n)e.classList.add(t);return void(r[c]=n)}let i=!1;for(const a in o)n[a]||(e.classList.remove(a),i=!0);for(const a in n)o[a]||(e.classList.add(a),i=!0);i&&(r[c]=n)})(e,d),f&&((e,t)=>{const r=e,o=v(t),s=r[l];if(!s){for(const t in o){const r=o[t];t.startsWith("--")?e.style.setProperty(t,r):e.style[t]=r}return void(r[l]=o)}let n=!1;for(const i in s)i in o||(i.startsWith("--")?e.style.removeProperty(i):e.style[i]="",n=!0);for(const i in o){const t=o[i];t!==s[i]&&(i.startsWith("--")?e.style.setProperty(i,t):e.style[i]=t,n=!0)}n&&(r[l]=o)})(e,h),s}updateNode(e,t,r){const o=t.d?this.evalIR(t.f??-1,[r],t.__m):t.x||"";t.d&&e.textContent!==o&&(e.textContent=o)}createStaticSubtree(e,t,o){var s;switch(e.t){case r.ASTType.Element:{const r=this.createElement(e,t);f(r,e),p(r,e);const n=this.applyAttrs(r,e.a??[],o);return null==(s=e.c)||s.forEach(e=>{const t=this.createStaticSubtree(e,r,o);r.appendChild(t)}),n.forEach(e=>e()),r}case r.ASTType.Text:return this.createText(e,o);case r.ASTType.Comment:return this.createComment(e,o);default:return document.createComment("unknown")}}handleStaticSubtree(e,t,r,o){const s=this.staticSubtreeCache.get(t);if(s){const e=s.cloneNode(!0);return r.appendChild(e),e}const n=this.createStaticSubtree(e,r,o);return r.appendChild(n),this.staticSubtreeCache.set(t,n.cloneNode(!0)),n}irToNode(e,t,o,s,n){var i,a,c,l,d,h,u;const m=o+"-"+t,y=this.nodeMap.get(m);let v;if(1!==e.s)if(y){v=y.node,y.marker=this.marker;let t=[];e.d&&(e.t===r.ASTType.Element?t=this.applyAttrs(v,e.a??[],n,!0):this.updateNode(v,e,n)),null==(i=e.c)||i.forEach((e,t)=>{this.irToNode(e,t,m,v,n)}),t.forEach(e=>e())}else switch(e.t){case r.ASTType.Element:v=this.createElement(e,s),f(v,e),p(v,e);const t=this.applyAttrs(v,e.a??[],n);s.appendChild(v),this.nodeMap.set(m,{irNode:e,node:v,loops:n,marker:this.marker}),null==(a=e.c)||a.forEach((e,t)=>{this.irToNode(e,t,m,v,n)}),t.forEach(e=>e());break;case r.ASTType.Text:v=this.createText(e,n),s.appendChild(v),this.nodeMap.set(m,{irNode:e,node:v,loops:n,marker:this.marker});break;case r.ASTType.Comment:v=this.createComment(e,n),s.appendChild(v),this.nodeMap.set(m,{irNode:e,node:v,loops:n,marker:this.marker});break;case r.ASTType.For:{const t=`${m}-end`;let o=null==(c=this.nodeMap.get(t))?void 0:c.node;o?this.nodeMap.get(t).marker=this.marker:(o=document.createComment(`for:${m}`),s.appendChild(o),this.nodeMap.set(t,{irNode:{t:r.ASTType.Comment},node:o,loops:n,marker:this.marker}));const i=this.evalIR(e.f??-1,[n],e.__m)||[],a=document.createDocumentFragment();i.forEach((t,r)=>{var o;const s=[...n,{itmVal:t,idxVal:r}];null==(o=e.c)||o.forEach((e,t)=>{this.irToNode(e,t,`${m}-for-${r}`,a,s)})}),null==(l=o.parentNode)||l.insertBefore(a,o);break}case r.ASTType.Conditional:{const t=`${m}-end`;let r=null==(d=this.nodeMap.get(t))?void 0:d.node;r?this.nodeMap.get(t).marker=this.marker:(r=document.createComment(`if:${m}`),s.appendChild(r),this.nodeMap.set(t,{irNode:{},node:r,loops:n,marker:this.marker}));for(let o=0;o<(e.b||[]).length;o++){const t=null==(h=e.b)?void 0:h[o];if(null===t.f||this.evalIR(t.f,[n],t.__m)){const e=document.createDocumentFragment();t.c.forEach((t,r)=>{this.irToNode(t,r,`${m}-if-${o}`,e,n)}),null==(u=r.parentNode)||u.insertBefore(e,r);break}}break}}else y?(y.marker=this.marker,v=y.node):(v=this.handleStaticSubtree(e,m,s,n),this.nodeMap.set(m,{irNode:e,node:v,loops:n,marker:this.marker}))}cleanupOldNodes(){for(const[e,t]of this.nodeMap.entries())if(t.marker!==this.marker){const{irNode:r,node:o,loops:s}=t;if(r.a){const e=r.a.find(e=>"unmounted"===e.k);e&&requestAnimationFrame(()=>{this.evalIR(e.f??-1,[o,s],e.__m)});const t=r.a.find(e=>"ref"===e.k);t&&t.v&&delete this.scope.$refs[t.v]}null==o||o.remove(),this.nodeMap.delete(e)}}mount(){this.marker=!this.marker,this.ir.n.forEach((e,t)=>{this.irToNode(e,t,"root",this.container,[])}),this.cleanupOldNodes()}update(){this.marker=!this.marker,this.ir.n.forEach((e,t)=>{this.irToNode(e,t,"root",this.container,[])}),this.cleanupOldNodes()}destroy(){this.container.innerHTML="",this.nodeMap.clear(),this.staticSubtreeCache.clear()}}exports.IRRenderer=g,exports.createRender=(e,t,r={})=>{const o=new g(e,t,r);return o.mount(),{update:()=>o.update(),destroy:()=>o.destroy()}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var e=Object.defineProperty,t=(t,o,n)=>((t,o,n)=>o in t?e(t,o,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[o]=n)(t,"symbol"!=typeof o?o+"":o,n);import{ASTType as o}from"../../types/ast.js";import{showTemplateError as n}from"../../shared/templateError.js";import{IS_DEV as s}from"../../shared/env.js";import r from"./html-decode.js";const i=Symbol("solely.irCtx"),a=Symbol("solely.irEvents"),c=Symbol("solely.prevClassObj"),l=Symbol("solely.prevStyleObj"),d={xml:"http://www.w3.org/XML/1998/namespace",xlink:"http://www.w3.org/1999/xlink",xmlns:"http://www.w3.org/2000/xmlns/"},h={readonly:"readOnly",for:"htmlFor",tabindex:"tabIndex",contenteditable:"contentEditable",maxlength:"maxLength"},m=new Set(["data-","aria-","role","form"]),f=new Set(["value","selectedIndex"]);function u(e,t){var o;const n=null==(o=t.a)?void 0:o.find(e=>"class"===e.k&&!e.d);(null==n?void 0:n.v)&&e.setAttribute("class",n.v)}function p(e,t){var o;if(!e.style)return;const n=null==(o=t.a)?void 0:o.find(e=>"style"===e.k&&!e.d),s=n?y(n.v):{};for(const r in s){const t=s[r];r.startsWith("--")?e.style.setProperty(r,t):e.style[r]=t}}const v=e=>!(!e||0===e.length||/\s/.test(e)&&(s&&console.warn(`[Solely] Invalid class name "${e}" contains whitespace, will be ignored`),1));function y(e){const t={},o=[[e]];for(;o.length;){const[e,n]=o.pop()||[];if(e){if("string"==typeof e){const o=/([^:;]+)\s*:\s*([^;]*\(.*?\)[^;]*|[^;]+)/g;let n;for(;null!==(n=o.exec(e));){const e=n[1].trim(),o=n[2].trim();e&&o&&(t[e]=o)}continue}if(Array.isArray(e))for(let t=e.length-1;t>=0;t--)o.push([e[t]]);else if("object"==typeof e)for(const s in e){const r=e[s];if(null==r)continue;const i=n?`${n}-${s}`:s;"object"!=typeof r||Array.isArray(r)?t[i]=String(r):o.push([r,i])}}}return t}function b(e,t,o){const n=null==o?"":String(o),s=t.indexOf(":");if(s>0){const o=t.slice(0,s),r=d[o];if(r)return void(e.getAttributeNS(r,t)!==n&&e.setAttributeNS(r,t,n))}e.getAttribute(t)!==n&&e.setAttribute(t,n)}function g(e,t,o){const n=h[t]||t;if(t.startsWith("data-")||t.startsWith("aria-")||m.has(t))return void b(e,t,o);const s=e,r=s.tagName;if(null!=o){if("src"===n||"href"===n){const t=String(o);if(s[n]===t||e.getAttribute(n)===t)return}if("value"!==n||"INPUT"!==r&&"TEXTAREA"!==r||s.value!==o)if("boolean"!=typeof o)(e instanceof SVGElement||void 0!==s.ownerSVGElement)&&!h[t]?b(e,t,o):s[n]!==o&&(s[n]=o);else{if(s[n]===o)return;s[n]=o}}else if("boolean"==typeof s[n])!1!==s[n]&&(s[n]=!1);else{const o=s[n];""!==o&&void 0!==o&&(s[n]=""),e.hasAttribute(t)&&e.removeAttribute(t)}}class k{constructor(e,o,n={}){t(this,"nodeMap",new Map),t(this,"marker",!1),t(this,"staticSubtreeCache",new Map),this.ir=e,this.container=o,this.scope=n}evalIR(e,t,o){var s;const r=this.ir.fns[e-1];try{return r?r.apply(this.scope,t):""}catch(i){return n(i.message||i.toString(),(null==(s=this.ir.m)?void 0:s.src)||"",o,this.scope.tagName),""}}createElement(e,t){const o=e.g??"";return t instanceof SVGElement||"svg"===o?document.createElementNS("http://www.w3.org/2000/svg",o):document.createElement(o)}createText(e,t){const o=e.d?this.evalIR(e.f??-1,[t],e.__m):r(e.x||"");return document.createTextNode(o)}createComment(e,t){const o=e.d?this.evalIR(e.f??-1,[t],e.__m):e.x||"";return document.createComment(o)}applyAttrs(e,t,o,n=!1){const s=[],r=e;let d;r[i]||(r[i]={loops:null}),r[i].loops=o,r[a]||(r[a]=Object.create(null));let h,m=!1,u=!1;for(const c of t){const{k:t,f:l,d:p,v:v}=c;if(":class"===t){d=this.evalIR(l??-1,[o],c.__m),m=!0;continue}if(":style"===t){h=this.evalIR(l??-1,[o],c.__m),u=!0;continue}if("class"===t||"style"===t)continue;const y=t[0];if("@"===y){const o=t.slice(1),s=c.r??"user";let d=r[a][o];if(d||(d=r[a][o]={model:[],user:[]},e.addEventListener(o,e=>{for(const t of d.model)t(e);for(const t of d.user)t(e)})),!n){const e=e=>this.evalIR(l??-1,[e,r[i].loops],c.__m);d[s].push(e)}continue}if("mounted"===t){n||requestAnimationFrame(()=>this.evalIR(l??-1,[e,o],c.__m));continue}if("updated"===t){n&&requestAnimationFrame(()=>this.evalIR(l??-1,[e,o],c.__m));continue}if("ref"===t&&v){this.scope.$refs=this.scope.$refs||{},this.scope.$refs[v]=e;continue}const k=p?this.evalIR(l??-1,[o],c.__m):v??"";if(":"===y){const o=t.slice(1);"SELECT"===e.tagName&&f.has(o)?s.push(()=>g(e,o,k)):g(e,o,k)}else n||b(e,t,String(k))}return m&&((e,t)=>{const o=e,n=o[c],s=function(e){const t={},o=[e];for(;o.length;){const e=o.pop();if(e)if("string"==typeof e){const o=e.split(" ");for(let e=0;e<o.length;e++){const n=o[e].trim();n&&(t[n]=!0)}}else if(Array.isArray(e))for(let t=e.length-1;t>=0;t--)o.push(e[t]);else if("object"==typeof e)for(const o in e)e[o]&&(t[o]=!0)}return t}(t),r={};for(const a in s)v(a)&&(r[a]=s[a]);if(!n){for(const t in r)e.classList.add(t);return void(o[c]=r)}let i=!1;for(const a in n)r[a]||(e.classList.remove(a),i=!0);for(const a in r)n[a]||(e.classList.add(a),i=!0);i&&(o[c]=r)})(e,d),u&&((e,t)=>{const o=e,n=y(t),s=o[l];if(!s){for(const t in n){const o=n[t];t.startsWith("--")?e.style.setProperty(t,o):e.style[t]=o}return void(o[l]=n)}let r=!1;for(const i in s)i in n||(i.startsWith("--")?e.style.removeProperty(i):e.style[i]="",r=!0);for(const i in n){const t=n[i];t!==s[i]&&(i.startsWith("--")?e.style.setProperty(i,t):e.style[i]=t,r=!0)}r&&(o[l]=n)})(e,h),s}updateNode(e,t,o){const n=t.d?this.evalIR(t.f??-1,[o],t.__m):t.x||"";t.d&&e.textContent!==n&&(e.textContent=n)}createStaticSubtree(e,t,n){var s;switch(e.t){case o.Element:{const o=this.createElement(e,t);u(o,e),p(o,e);const r=this.applyAttrs(o,e.a??[],n);return null==(s=e.c)||s.forEach(e=>{const t=this.createStaticSubtree(e,o,n);o.appendChild(t)}),r.forEach(e=>e()),o}case o.Text:return this.createText(e,n);case o.Comment:return this.createComment(e,n);default:return document.createComment("unknown")}}handleStaticSubtree(e,t,o,n){const s=this.staticSubtreeCache.get(t);if(s){const e=s.cloneNode(!0);return o.appendChild(e),e}const r=this.createStaticSubtree(e,o,n);return o.appendChild(r),this.staticSubtreeCache.set(t,r.cloneNode(!0)),r}irToNode(e,t,n,s,r){var i,a,c,l,d,h,m;const f=n+"-"+t,v=this.nodeMap.get(f);let y;if(1!==e.s)if(v){y=v.node,v.marker=this.marker;let t=[];e.d&&(e.t===o.Element?t=this.applyAttrs(y,e.a??[],r,!0):this.updateNode(y,e,r)),null==(i=e.c)||i.forEach((e,t)=>{this.irToNode(e,t,f,y,r)}),t.forEach(e=>e())}else switch(e.t){case o.Element:y=this.createElement(e,s),u(y,e),p(y,e);const t=this.applyAttrs(y,e.a??[],r);s.appendChild(y),this.nodeMap.set(f,{irNode:e,node:y,loops:r,marker:this.marker}),null==(a=e.c)||a.forEach((e,t)=>{this.irToNode(e,t,f,y,r)}),t.forEach(e=>e());break;case o.Text:y=this.createText(e,r),s.appendChild(y),this.nodeMap.set(f,{irNode:e,node:y,loops:r,marker:this.marker});break;case o.Comment:y=this.createComment(e,r),s.appendChild(y),this.nodeMap.set(f,{irNode:e,node:y,loops:r,marker:this.marker});break;case o.For:{const t=`${f}-end`;let n=null==(c=this.nodeMap.get(t))?void 0:c.node;n?this.nodeMap.get(t).marker=this.marker:(n=document.createComment(`for:${f}`),s.appendChild(n),this.nodeMap.set(t,{irNode:{t:o.Comment},node:n,loops:r,marker:this.marker}));const i=this.evalIR(e.f??-1,[r],e.__m)||[],a=document.createDocumentFragment();i.forEach((t,o)=>{var n;const s=[...r,{itmVal:t,idxVal:o}];null==(n=e.c)||n.forEach((e,t)=>{this.irToNode(e,t,`${f}-for-${o}`,a,s)})}),null==(l=n.parentNode)||l.insertBefore(a,n);break}case o.Conditional:{const t=`${f}-end`;let o=null==(d=this.nodeMap.get(t))?void 0:d.node;o?this.nodeMap.get(t).marker=this.marker:(o=document.createComment(`if:${f}`),s.appendChild(o),this.nodeMap.set(t,{irNode:{},node:o,loops:r,marker:this.marker}));for(let n=0;n<(e.b||[]).length;n++){const t=null==(h=e.b)?void 0:h[n];if(null===t.f||this.evalIR(t.f,[r],t.__m)){const e=document.createDocumentFragment();t.c.forEach((t,o)=>{this.irToNode(t,o,`${f}-if-${n}`,e,r)}),null==(m=o.parentNode)||m.insertBefore(e,o);break}}break}}else v?(v.marker=this.marker,y=v.node):(y=this.handleStaticSubtree(e,f,s,r),this.nodeMap.set(f,{irNode:e,node:y,loops:r,marker:this.marker}))}cleanupOldNodes(){for(const[e,t]of this.nodeMap.entries())if(t.marker!==this.marker){const{irNode:o,node:n,loops:s}=t;if(o.a){const e=o.a.find(e=>"unmounted"===e.k);e&&requestAnimationFrame(()=>{this.evalIR(e.f??-1,[n,s],e.__m)});const t=o.a.find(e=>"ref"===e.k);t&&t.v&&delete this.scope.$refs[t.v]}null==n||n.remove(),this.nodeMap.delete(e)}}mount(){this.marker=!this.marker,this.ir.n.forEach((e,t)=>{this.irToNode(e,t,"root",this.container,[])}),this.cleanupOldNodes()}update(){this.marker=!this.marker,this.ir.n.forEach((e,t)=>{this.irToNode(e,t,"root",this.container,[])}),this.cleanupOldNodes()}destroy(){this.container.innerHTML="",this.nodeMap.clear(),this.staticSubtreeCache.clear()}}const S=(e,t,o={})=>{const n=new k(e,t,o);return n.mount(),{update:()=>n.update(),destroy:()=>n.destroy()}};export{k as IRRenderer,S as createRender};
|
package/dist/shared/env.cjs
CHANGED
|
@@ -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.
|
|
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;
|
package/dist/shared/env.js
CHANGED
|
@@ -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.
|
|
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;export{n as IS_DEV,o as IS_PROD};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=new Set(["onabort","onautocomplete","onautocompleteerror","onblur","oncancel","oncanplay","oncanplaythrough","onchange","onclick","onclose","oncontextmenu","oncuechange","ondblclick","ondrag","ondragend","ondragenter","ondragexit","ondragleave","ondragover","ondragstart","ondrop","ondurationchange","onemptied","onended","onerror","onfocus","oninput","oninvalid","onkeydown","onkeypress","onkeyup","onload","onloadeddata","onloadedmetadata","onloadstart","onmousedown","onmouseenter","onmouseleave","onmousemove","onmouseout","onmouseover","onmouseup","onwheel","onpause","onplay","onplaying","onprogress","onratechange","onreset","onresize","onscroll","onseeked","onseeking","onselect","onshow","onstalled","onsubmit","onsuspend","ontimeupdate","ontoggle","onvolumechange","onwaiting"]);exports.default=o;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./functions.cjs"),r=/\{\{\{\s*[\s\S]*?\s*\}\}\}/,n=/\{\{\s*([\s\S]*?)\s*\}\}/g;exports.genFunction=function(t,o,s){if(!(null==t?void 0:t.trim()))return()=>"";const{processed:i,error:l}=function(e,t){if(!(null==e?void 0:e.trim()))return{processed:""};if(r.test(e))return{processed:e,error:"Illegal interpolation syntax: use {{ }} instead of {{{ }}}"};if("template"===t)try{return{processed:e.replace(n,(e,r)=>`\${${r.trim()}}`)}}catch(o){return{processed:e,error:`Template parse error: ${o instanceof Error?o.message:String(o)}`}}return{processed:e}}(t,o);if(l)return function(){throw new Error(`[Compile Error] ${l} Original: ${t}`)};try{const r=function(e,r){switch(r){case"template":return`return \`${e}\`;`;case"expression":return`return (${e});`;case"handler":case"lifecycle":return(n=e).endsWith(";")?n:n+";";default:return"return undefined;"}var n}(i,o),{loopValues:n,loopIndices:t}=function(e){return e.length?{loopValues:`var [${e.map(e=>e.i).join(", ")}] = loops.map(l => l.itmVal);`,loopIndices:`var [${e.map(e=>e.x).join(", ")}] = loops.map(l => l.idxVal);`}:{loopValues:"",loopIndices:""}}(s),l=function(e,r,n,t){const o="lifecycle"===e?["el","loops"]:"handler"===e?["event","loops"]:["loops"],s=`\n const { $data } = this;\n ${"handler"===e?"const { value, checked } = event?.target || {};":""}\n ${n}\n ${t}\n ${r}\n `.replace(/^\s+|\s+$/gm,"");return o.push(s),o}(o,r,n,t);return e.createFunction(l)}catch(c){const e=c instanceof Error?c.message:String(c);return function(){throw new Error(`[Parse Error] ${e} Original: ${t}`)}}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createFunction as r}from"./functions.js";const e=/\{\{\{\s*[\s\S]*?\s*\}\}\}/,n=/\{\{\s*([\s\S]*?)\s*\}\}/g;function
|
|
1
|
+
import{createFunction as r}from"./functions.js";const e=/\{\{\{\s*[\s\S]*?\s*\}\}\}/,n=/\{\{\s*([\s\S]*?)\s*\}\}/g;function t(t,o,s){if(!(null==t?void 0:t.trim()))return()=>"";const{processed:l,error:i}=function(r,t){if(!(null==r?void 0:r.trim()))return{processed:""};if(e.test(r))return{processed:r,error:"Illegal interpolation syntax: use {{ }} instead of {{{ }}}"};if("template"===t)try{return{processed:r.replace(n,(r,e)=>`\${${e.trim()}}`)}}catch(o){return{processed:r,error:`Template parse error: ${o instanceof Error?o.message:String(o)}`}}return{processed:r}}(t,o);if(i)return function(){throw new Error(`[Compile Error] ${i} Original: ${t}`)};try{const e=function(r,e){switch(e){case"template":return`return \`${r}\`;`;case"expression":return`return (${r});`;case"handler":case"lifecycle":return(n=r).endsWith(";")?n:n+";";default:return"return undefined;"}var n}(l,o),{loopValues:n,loopIndices:t}=function(r){return r.length?{loopValues:`var [${r.map(r=>r.i).join(", ")}] = loops.map(l => l.itmVal);`,loopIndices:`var [${r.map(r=>r.x).join(", ")}] = loops.map(l => l.idxVal);`}:{loopValues:"",loopIndices:""}}(s),i=function(r,e,n,t){const o="lifecycle"===r?["el","loops"]:"handler"===r?["event","loops"]:["loops"],s=`\n const { $data } = this;\n ${"handler"===r?"const { value, checked } = event?.target || {};":""}\n ${n}\n ${t}\n ${e}\n `.replace(/^\s+|\s+$/gm,"");return o.push(s),o}(o,e,n,t);return r(i)}catch(a){const r=a instanceof Error?a.message:String(a);return function(){throw new Error(`[Parse Error] ${r} Original: ${t}`)}}}export{t as genFunction};
|
package/dist/shared/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./templateError.cjs"),r=require("./gen-function.cjs"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./templateError.cjs"),r=require("./gen-function.cjs"),t=require("./functions.cjs"),s=require("./event-listeners.cjs"),o=require("./is-object.cjs"),n=require("./url.cjs"),c=require("./env.cjs");exports.showTemplateError=e.showTemplateError,exports.genFunction=r.genFunction,exports.createFunction=t.createFunction,exports.listeners=s.default,exports.isObject=o.isObject,exports.parseHashUrl=n.parseHashUrl,exports.IS_DEV=c.IS_DEV,exports.IS_PROD=c.IS_PROD;
|
package/dist/shared/is-object.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const t=t=>{if(null===t)return!1;if("object"!=typeof t)return!1;const e=Object.prototype.toString.call(t);return!["[object Function]","[object Date]","[object RegExp]","[object Map]","[object Set]","[object WeakMap]","[object WeakSet]"].includes(e)};export{t as isObject};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o="#858585",n="#3c1e1e",
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o="#858585",n="#3c1e1e",e="#f8f8f2",t="#ff6b6b",l="#ff6b6b",c="#ffffff",r="#a0a0a0",i="#5ddcff";function s(o){let n=0;for(let e=0;e<o.length;){const t=o.codePointAt(e)??0;"\t"!==o[e]?(n+=t>=9472&&t<=9599||t>255?2:1,e+=t>65535?2:1):(n+=4,e++)}return n}function f(o,n={}){const{lineIndex:e=0,totalLines:t=1}=n,l=Math.max(1,Math.floor(o));return(t<=1||0===e?"^":"~").repeat(l)}exports.showTemplateError=function(a,d="",p,$="component"){var g;const h=`%cTemplate Error%c in <${$}> → ${(null==a?void 0:a.message)??String(a)}`,u=[`color:${c};background:${l};padding:4px 10px;border-radius:6px;font-weight:bold;`,`color:${t};font-weight:bold;`];if(!d||!(null==p?void 0:p.loc)||p.loc.length<2)return console.error(h,...u),void((null==p?void 0:p.expr)&&console.info(`Expression: ${p.expr.trim()}`));const m=p.loc;let x=m[0]||0,b=m[1]||0;x|=0,b|=0,x<1&&(x=1),b<1&&(b=1);const v=d.split("\n");if(x>v.length)return void console.error(`[Template Error] 行号 ${x} 超出范围`);const E=x-1,M=Math.max(0,E-3),S=Math.min(v.length-1,E+3),w=String(S+1).length,T=(null==(g=p.expr)?void 0:g.trim())??"",y=T?T.split("\n"):[],L=T?Math.max(...y.map(s)):0,k=y.length>1,C=`color:${o};`,I=`color:${t};font-weight:bold;`,P=`color:${o};`,j=`color:${e};background:${n};padding:0 4px;`,A=`color:${o};`,O=`color:${t};font-weight:bold;padding:0 4px;`;console.groupCollapsed(`${h} %c(Line:${x}, Col:${b})`,...u,`color:${o};font-weight:normal;`);for(let o=M;o<=S;o++){const n=v[o],e=String(o+1).padStart(w," ");if(o!==E){console.info(`%c${e} │%c ${n}`,C,P);continue}const t=s(n.slice(0,Math.max(0,b-1))),l=" ".repeat(w+3),c=e.padEnd(w," ");if(console.info(`%c${c} │%c ${n}`,I,j),k)for(let o=0;o<y.length;o++){const n=y[o],e=E+o;let c=0;if(0===o)c=t;else if(e<v.length){const o=v[e],n=o.search(/\S/);c=s(-1===n?o:o.slice(0,n))}const r=f(Math.max(1,s(n.trim())),{lineIndex:o,totalLines:y.length}),i=l+" ".repeat(c);if(0===o)console.info(`%c${i}%c${r}`,A,O);else if(e<v.length){const o=String(e+1).padEnd(w," "),n=v[e];console.info(`%c${o} │%c ${n}`,I,j),console.info(`%c${i}%c${r}`,A,O)}}else{const o=l+" ".repeat(t),n=f(L||1);console.info(`%c${o}%c${n}`,A,O)}}T&&console.info(`%cExpression:%c ${T}`,`color:${r};font-weight:bold;`,`color:${i};font-family:monospace;`),console.groupEnd()};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const o="#858585",n="#3c1e1e",
|
|
1
|
+
const o="#858585",n="#3c1e1e",e="#f8f8f2",t="#ff6b6b",l="#ff6b6b",c="#ffffff",r="#a0a0a0",i="#5ddcff";function f(o){let n=0;for(let e=0;e<o.length;){const t=o.codePointAt(e)??0;"\t"!==o[e]?(n+=t>=9472&&t<=9599||t>255?2:1,e+=t>65535?2:1):(n+=4,e++)}return n}function s(o,n={}){const{lineIndex:e=0,totalLines:t=1}=n,l=Math.max(1,Math.floor(o));return(t<=1||0===e?"^":"~").repeat(l)}function a(a,d="",$,p="component"){var g;const h=`%cTemplate Error%c in <${p}> → ${(null==a?void 0:a.message)??String(a)}`,x=[`color:${c};background:${l};padding:4px 10px;border-radius:6px;font-weight:bold;`,`color:${t};font-weight:bold;`];if(!d||!(null==$?void 0:$.loc)||$.loc.length<2)return console.error(h,...x),void((null==$?void 0:$.expr)&&console.info(`Expression: ${$.expr.trim()}`));const m=$.loc;let u=m[0]||0,b=m[1]||0;u|=0,b|=0,u<1&&(u=1),b<1&&(b=1);const v=d.split("\n");if(u>v.length)return void console.error(`[Template Error] 行号 ${u} 超出范围`);const E=u-1,M=Math.max(0,E-3),w=Math.min(v.length-1,E+3),S=String(w+1).length,L=(null==(g=$.expr)?void 0:g.trim())??"",k=L?L.split("\n"):[],C=L?Math.max(...k.map(f)):0,I=k.length>1,T=`color:${o};`,y=`color:${t};font-weight:bold;`,A=`color:${o};`,P=`color:${e};background:${n};padding:0 4px;`,j=`color:${o};`,q=`color:${t};font-weight:bold;padding:0 4px;`;console.groupCollapsed(`${h} %c(Line:${u}, Col:${b})`,...x,`color:${o};font-weight:normal;`);for(let o=M;o<=w;o++){const n=v[o],e=String(o+1).padStart(S," ");if(o!==E){console.info(`%c${e} │%c ${n}`,T,A);continue}const t=f(n.slice(0,Math.max(0,b-1))),l=" ".repeat(S+3),c=e.padEnd(S," ");if(console.info(`%c${c} │%c ${n}`,y,P),I)for(let o=0;o<k.length;o++){const n=k[o],e=E+o;let c=0;if(0===o)c=t;else if(e<v.length){const o=v[e],n=o.search(/\S/);c=f(-1===n?o:o.slice(0,n))}const r=s(Math.max(1,f(n.trim())),{lineIndex:o,totalLines:k.length}),i=l+" ".repeat(c);if(0===o)console.info(`%c${i}%c${r}`,j,q);else if(e<v.length){const o=String(e+1).padEnd(S," "),n=v[e];console.info(`%c${o} │%c ${n}`,y,P),console.info(`%c${i}%c${r}`,j,q)}}else{const o=l+" ".repeat(t),n=s(C||1);console.info(`%c${o}%c${n}`,j,q)}}L&&console.info(`%cExpression:%c ${L}`,`color:${r};font-weight:bold;`,`color:${i};font-family:monospace;`),console.groupEnd()}export{a as showTemplateError};
|
package/dist/shared/url.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"}),exports.parseHashUrl=function(e=window.location){let
|
|
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}};
|
package/dist/shared/url.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
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};
|
package/dist/types/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./ast.cjs"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./ast.cjs"),t=require("./lifecycle.cjs");exports.ASTType=e.ASTType,exports.LIFECYCLE_ATTRS_MAP=t.LIFECYCLE_ATTRS_MAP,exports.isLifecycleKind=t.isLifecycleKind,exports.mapAttrKeyToLifecycleKind=t.mapAttrKeyToLifecycleKind;
|
package/dist/types/lifecycle.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e={onMounted:"mounted",onUpdated:"updated",onUnmounted:"unmounted"};exports.LIFECYCLE_ATTRS_MAP=e,exports.isLifecycleKind=function(e){return"mounted"===e||"updated"===e||"unmounted"===e},exports.mapAttrKeyToLifecycleKind=function(t){return e[t]??null};
|