solely 0.5.8 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (160) hide show
  1. package/README.md +82 -31
  2. package/dist/compiler/ir/buildIR.cjs +1 -1
  3. package/dist/compiler/ir/buildIR.js +1 -1
  4. package/dist/compiler/parser/parser.cjs +1 -1
  5. package/dist/compiler/parser/parser.js +1 -1
  6. package/dist/components/commands/drawer/index.cjs +1 -1
  7. package/dist/components/commands/drawer/index.js +1 -1
  8. package/dist/components/commands/drawer/style.css.cjs +1 -1
  9. package/dist/components/commands/drawer/style.css.js +1 -1
  10. package/dist/components/commands/message/index.cjs +1 -1
  11. package/dist/components/commands/message/index.js +1 -1
  12. package/dist/components/commands/modal/index.cjs +1 -1
  13. package/dist/components/commands/modal/index.js +1 -1
  14. package/dist/components/commands/modal/style.css.cjs +1 -1
  15. package/dist/components/commands/modal/style.css.js +1 -1
  16. package/dist/components/commands/popconfirm/index.cjs +1 -1
  17. package/dist/components/commands/popconfirm/index.js +1 -1
  18. package/dist/components/commands/tooltip/index.cjs +1 -1
  19. package/dist/components/commands/tooltip/index.js +1 -1
  20. package/dist/components/commands/utils.cjs +1 -1
  21. package/dist/components/commands/utils.js +1 -1
  22. package/dist/components/elements/alert/index.cjs +1 -1
  23. package/dist/components/elements/alert/index.html.cjs +1 -1
  24. package/dist/components/elements/alert/index.html.js +1 -1
  25. package/dist/components/elements/alert/index.js +1 -1
  26. package/dist/components/elements/backtop/index.cjs +1 -1
  27. package/dist/components/elements/backtop/index.html.cjs +1 -1
  28. package/dist/components/elements/backtop/index.html.js +1 -1
  29. package/dist/components/elements/backtop/index.js +1 -1
  30. package/dist/components/elements/badge/index.html.cjs +1 -1
  31. package/dist/components/elements/badge/index.html.js +1 -1
  32. package/dist/components/elements/breadcrumb/index.cjs +1 -1
  33. package/dist/components/elements/breadcrumb/index.html.cjs +1 -1
  34. package/dist/components/elements/breadcrumb/index.html.js +1 -1
  35. package/dist/components/elements/breadcrumb/index.js +1 -1
  36. package/dist/components/elements/button/index.cjs +1 -1
  37. package/dist/components/elements/button/index.html.cjs +1 -1
  38. package/dist/components/elements/button/index.html.js +1 -1
  39. package/dist/components/elements/button/index.js +1 -1
  40. package/dist/components/elements/card/index.html.cjs +1 -1
  41. package/dist/components/elements/card/index.html.js +1 -1
  42. package/dist/components/elements/checkbox/index.cjs +1 -1
  43. package/dist/components/elements/checkbox/index.html.cjs +1 -1
  44. package/dist/components/elements/checkbox/index.html.js +1 -1
  45. package/dist/components/elements/checkbox/index.js +1 -1
  46. package/dist/components/elements/coordinate-input/index.html.cjs +1 -1
  47. package/dist/components/elements/coordinate-input/index.html.js +1 -1
  48. package/dist/components/elements/coordinate-input/style.css.cjs +1 -1
  49. package/dist/components/elements/coordinate-input/style.css.js +1 -1
  50. package/dist/components/elements/fab/index.cjs +1 -1
  51. package/dist/components/elements/fab/index.html.cjs +1 -1
  52. package/dist/components/elements/fab/index.html.js +1 -1
  53. package/dist/components/elements/fab/index.js +1 -1
  54. package/dist/components/elements/icon/index.cjs +1 -1
  55. package/dist/components/elements/icon/index.d.ts +8 -0
  56. package/dist/components/elements/icon/index.html.cjs +1 -1
  57. package/dist/components/elements/icon/index.html.js +1 -1
  58. package/dist/components/elements/icon/index.js +1 -1
  59. package/dist/components/elements/input/index.cjs +1 -1
  60. package/dist/components/elements/input/index.html.cjs +1 -1
  61. package/dist/components/elements/input/index.html.js +1 -1
  62. package/dist/components/elements/input/index.js +1 -1
  63. package/dist/components/elements/not-found/index.html.cjs +1 -1
  64. package/dist/components/elements/not-found/index.html.js +1 -1
  65. package/dist/components/elements/not-found/style.css.cjs +1 -1
  66. package/dist/components/elements/not-found/style.css.js +1 -1
  67. package/dist/components/elements/pagination/index.html.cjs +1 -1
  68. package/dist/components/elements/pagination/index.html.js +1 -1
  69. package/dist/components/elements/pagination/style.css.cjs +1 -1
  70. package/dist/components/elements/pagination/style.css.js +1 -1
  71. package/dist/components/elements/progress/index.html.cjs +1 -1
  72. package/dist/components/elements/progress/index.html.js +1 -1
  73. package/dist/components/elements/radio/index.cjs +1 -1
  74. package/dist/components/elements/radio/index.html.cjs +1 -1
  75. package/dist/components/elements/radio/index.html.js +1 -1
  76. package/dist/components/elements/radio/index.js +1 -1
  77. package/dist/components/elements/rate/index.cjs +1 -1
  78. package/dist/components/elements/rate/index.html.cjs +1 -1
  79. package/dist/components/elements/rate/index.html.js +1 -1
  80. package/dist/components/elements/rate/index.js +1 -1
  81. package/dist/components/elements/select/index.cjs +1 -1
  82. package/dist/components/elements/select/index.html.cjs +1 -1
  83. package/dist/components/elements/select/index.html.js +1 -1
  84. package/dist/components/elements/select/index.js +1 -1
  85. package/dist/components/elements/skeleton/index.html.cjs +1 -1
  86. package/dist/components/elements/skeleton/index.html.js +1 -1
  87. package/dist/components/elements/slider/index.cjs +1 -1
  88. package/dist/components/elements/slider/index.html.cjs +1 -1
  89. package/dist/components/elements/slider/index.html.js +1 -1
  90. package/dist/components/elements/slider/index.js +1 -1
  91. package/dist/components/elements/steps/index.cjs +1 -1
  92. package/dist/components/elements/steps/index.html.cjs +1 -1
  93. package/dist/components/elements/steps/index.html.js +1 -1
  94. package/dist/components/elements/steps/index.js +1 -1
  95. package/dist/components/elements/switch/index.cjs +1 -1
  96. package/dist/components/elements/switch/index.html.cjs +1 -1
  97. package/dist/components/elements/switch/index.html.js +1 -1
  98. package/dist/components/elements/switch/index.js +1 -1
  99. package/dist/components/elements/table/index.html.cjs +1 -1
  100. package/dist/components/elements/table/index.html.js +1 -1
  101. package/dist/components/elements/tabs/index.html.cjs +1 -1
  102. package/dist/components/elements/tabs/index.html.js +1 -1
  103. package/dist/components/elements/tag/index.html.cjs +1 -1
  104. package/dist/components/elements/tag/index.html.js +1 -1
  105. package/dist/components/elements/timeline/index.cjs +1 -1
  106. package/dist/components/elements/timeline/index.html.cjs +1 -1
  107. package/dist/components/elements/timeline/index.html.js +1 -1
  108. package/dist/components/elements/timeline/index.js +1 -1
  109. package/dist/components/elements/tooltip/index.cjs +1 -1
  110. package/dist/components/elements/tooltip/index.html.cjs +1 -1
  111. package/dist/components/elements/tooltip/index.html.js +1 -1
  112. package/dist/components/elements/tooltip/index.js +1 -1
  113. package/dist/components/elements/tree/index.cjs +1 -1
  114. package/dist/components/elements/tree/index.d.ts +5 -0
  115. package/dist/components/elements/tree/index.html.cjs +1 -1
  116. package/dist/components/elements/tree/index.html.js +1 -1
  117. package/dist/components/elements/tree/index.js +1 -1
  118. package/dist/components/elements/upload/index.cjs +1 -1
  119. package/dist/components/elements/upload/index.html.cjs +1 -1
  120. package/dist/components/elements/upload/index.html.js +1 -1
  121. package/dist/components/elements/upload/index.js +1 -1
  122. package/dist/index.cjs +1 -1
  123. package/dist/index.js +1 -1
  124. package/dist/plugins/solely-vite-plugin.cjs +1 -1
  125. package/dist/plugins/solely-vite-plugin.d.ts +10 -1
  126. package/dist/plugins/solely-vite-plugin.js +1 -1
  127. package/dist/router/core.cjs +1 -1
  128. package/dist/router/core.js +1 -1
  129. package/dist/router/router-link.cjs +1 -1
  130. package/dist/router/router-link.js +1 -1
  131. package/dist/router/router-view.cjs +1 -1
  132. package/dist/router/router-view.js +1 -1
  133. package/dist/runtime/component/base-element.cjs +1 -1
  134. package/dist/runtime/component/base-element.d.ts +8 -1
  135. package/dist/runtime/component/base-element.js +1 -1
  136. package/dist/runtime/component/decorators.cjs +1 -1
  137. package/dist/runtime/component/decorators.d.ts +7 -0
  138. package/dist/runtime/component/decorators.js +1 -1
  139. package/dist/runtime/reactivity/observe.cjs +1 -1
  140. package/dist/runtime/reactivity/observe.d.ts +1 -0
  141. package/dist/runtime/reactivity/observe.js +1 -1
  142. package/dist/runtime/renderer/html-decode.cjs +1 -1
  143. package/dist/runtime/renderer/html-decode.js +1 -1
  144. package/dist/runtime/renderer/renderIR.cjs +1 -1
  145. package/dist/runtime/renderer/renderIR.js +1 -1
  146. package/dist/shared/env.cjs +1 -1
  147. package/dist/shared/env.js +1 -1
  148. package/dist/shared/functions.d.ts +2 -2
  149. package/dist/shared/gen-function.cjs +1 -1
  150. package/dist/shared/gen-function.js +1 -1
  151. package/dist/shared/index.cjs +1 -1
  152. package/dist/shared/index.d.ts +1 -0
  153. package/dist/shared/index.js +1 -1
  154. package/dist/shared/svg-sanitize.cjs +1 -0
  155. package/dist/shared/svg-sanitize.d.ts +27 -0
  156. package/dist/shared/svg-sanitize.js +1 -0
  157. package/dist/shared/templateError.cjs +1 -1
  158. package/dist/shared/templateError.js +1 -1
  159. package/dist/types/ir.d.ts +2 -2
  160. package/package.json +19 -14
@@ -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"),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);
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"),r=require("../runtime/component/decorators.cjs");var i,n=Object.defineProperty,a=(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)||a("Cannot "+s);exports.default=class extends s.default{constructor(){var e,s;super(...arguments),e=this,(s=i).has(e)?a("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=>{if(e.defaultPrevented)return;if(e.ctrlKey||e.metaKey||e.shiftKey||e.altKey)return;if(0!==e.button)return;const s=e.target;s.closest("a")?.getAttribute("target")||(e.preventDefault(),t.getRouter()?.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(){this.mountVersion++,this.unsubscribe?.(),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],r=this.$data.to.split("?")[0];s=t===r||t.startsWith(r+"/")}}}this.$data.isActive=s;const r=this.$data.activeClass||"active";this.classList.toggle(r,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,r=e,i=t.length-1;i>=0;i--)(s=t[i])&&(r=s(r)||r);return r})([r.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 +1 @@
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
+ 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),c=(t,e,s)=>e.has(t)||o("Cannot "+s);let u=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=>{if(t.defaultPrevented)return;if(t.ctrlKey||t.metaKey||t.shiftKey||t.altKey)return;if(0!==t.button)return;const s=t.target;s.closest("a")?.getAttribute("target")||(t.preventDefault(),e()?.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(){this.mountVersion++,this.unsubscribe?.(),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(c(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)=>{c(t,e,"write to private field"),e.set(t,!0)})(this,a))}};a=new WeakMap,u=((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"]})],u);export{u as default};
@@ -1 +1 @@
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.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=require("./core.cjs"),o=require("../runtime/component/base-element.cjs"),s=require("../runtime/component/decorators.cjs");Object.getOwnPropertyDescriptor;const n=new WeakMap;exports.default=class extends o.default{constructor(){super(...arguments),t(this,"unsubscribe"),t(this,"level",0),t(this,"currentElement",null),t(this,"currentTagName",null),t(this,"managedNodes",new Set),t(this,"scheduled",!1),t(this,"latestLoadId",0),t(this,"abortController",null),t(this,"disposed",!1),t(this,"router",null)}async mounted(){this.disposed=!1,this.detectLevel(),this.router=await r.routerReady(),this.disposed||(this.unsubscribe=this.router.listen(()=>this.scheduleLoad()),this.loadRoute(this.router.getCurrentRoute()))}unmounted(){var e,t;this.disposed=!0,null==(e=this.abortController)||e.abort(),this.abortController=null,null==(t=this.unsubscribe)||t.call(this),this.clear()}scheduleLoad(){!this.router||this.scheduled||this.disposed||(this.scheduled=!0,queueMicrotask(()=>{this.scheduled=!1,!this.disposed&&this.router&&this.loadRoute(this.router.getCurrentRoute())}))}detectLevel(){let e=0,t=this.parentElement;for(;t;){const r=t.closest("router-view");if(r){if(e++,t=r.parentElement,!t){const e=r.getRootNode();t=e instanceof ShadowRoot?e.host:null}}else{const e=t.getRootNode();t=e instanceof ShadowRoot?e.host:null}}this.level=e}async loadRoute(e){var t,r;this.abortController&&(this.abortController.abort(),this.abortController=null);const o=++this.latestLoadId,s=null==e?void 0:e.matched[this.level];if(!s)return void this.handleEmptyRoute(e);const{config:n}=s;let i=n.tagName;if(!i&&"function"==typeof n.component){this.renderLoading();const s=new AbortController;this.abortController=s;try{const l=null==(r=null==(t=this.router)?void 0:t.getComponentFromCache)?void 0:r.call(t,null==e?void 0:e.fullPath),a=l?await l:await n.component();if(s.signal.aborted||o!==this.latestLoadId||this.disposed)return;i="string"==typeof a?a:a.tagName}catch(l){if(s.signal.aborted||o!==this.latestLoadId||this.disposed)return;return void this.renderError(`Load Error: ${l}`)}finally{this.abortController===s&&(this.abortController=null)}}if(o===this.latestLoadId&&!this.disposed)if(i)if(!n.forceReload&&this.currentElement&&this.currentTagName===i.toLowerCase())this.syncState(this.currentElement,(null==e?void 0:e.params)||{},(null==e?void 0:e.query)||{},n.props);else{this.clear();const t=this.getOrCreateComponent(i,n,e);this.syncState(t,(null==e?void 0:e.params)||{},(null==e?void 0:e.query)||{},n.props),this.appendManagedNode(t),this.currentElement=t,this.currentTagName=i.toLowerCase()}else this.clear()}syncState(e,t,r,o={}){const s=e=>e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),i=function(e){let t=n.get(e);return t||(t={routerAttrs:new Set,propKeys:new Set},n.set(e,t)),t}(e),l=new Map;Object.entries(t).forEach(([e,t])=>l.set(s(e),String(t))),Object.entries(r).forEach(([e,t])=>l.set(`query-${s(e)}`,String(t))),i.routerAttrs.forEach(t=>{l.has(t)||(e.removeAttribute(t),i.routerAttrs.delete(t))}),l.forEach((t,r)=>{e.getAttribute(r)!==t&&e.setAttribute(r,t),i.routerAttrs.add(r)});const a=new Set(Object.keys(o)),d=e;i.propKeys.forEach(e=>{a.has(e)||(d[e]=void 0)}),Object.entries(o).forEach(([e,t])=>{d[e]!==t&&(d[e]=t)}),i.propKeys=a}getOrCreateComponent(e,t,r){var o,s;if(!r)throw new Error("Route is required to create or retrieve component");const n=t.keepAliveKey?t.keepAliveKey(r,this.level):this.buildKeepAliveKey(e,r),i=t.keepAlive&&(null==(o=this.router)?void 0:o.getKeepAlive(n));if(i)return i;const l=document.createElement(e);return t.keepAlive&&(null==(s=this.router)||s.setKeepAlive(n,l)),l}buildKeepAliveKey(e,t){const r=t.matched[this.level],o=(null==r?void 0:r.config.path)??e.toLowerCase(),s=Object.values((null==r?void 0:r.params)??{});return s.length?`${this.level}:${o}:${s.join("|")}`:`${this.level}:${o}`}handleEmptyRoute(e){var t,r;if(0===this.level){this.clear();const o=null==(t=null==e?void 0:e.matched)?void 0:t[0],s=(null==(r=null==o?void 0:o.config)?void 0:r.notFoundComponent)||this.$data.notFound;if(s){const e=document.createElement(s);this.appendManagedNode(e),this.currentElement=e,this.currentTagName=s.toLowerCase()}else this.renderError("404 Not Found")}else this.clear()}appendManagedNode(e){e.parentNode!==this&&this.appendChild(e),this.managedNodes.add(e)}clear(){this.managedNodes.forEach(e=>{e.parentNode===this&&this.removeChild(e)}),this.managedNodes.clear(),this.currentElement=null,this.currentTagName=null}renderLoading(){this.clear();const e=document.createElement("div");e.style.cssText="padding:20px; color:#999;",e.textContent="Loading...",this.appendManagedNode(e)}renderError(e){this.clear();const t=document.createElement("div");t.style.cssText="padding:20px; color:#ff4d4f;",t.textContent=e,this.appendManagedNode(t)}},exports.default=((e,t)=>{for(var r,o=t,s=e.length-1;s>=0;s--)(r=e[s])&&(o=r(o)||o);return o})([s.CustomElement({tagName:"router-view",props:[{name:"notFound",type:"string",default:""}]})],exports.default);
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./core.cjs"),t=require("../runtime/component/base-element.cjs"),r=require("../runtime/component/decorators.cjs");Object.getOwnPropertyDescriptor;const o=new WeakMap;exports.default=class extends t.default{unsubscribe;level=0;currentElement=null;currentTagName=null;managedNodes=new Set;scheduled=!1;latestLoadId=0;abortController=null;disposed=!1;router=null;async mounted(){this.disposed=!1,this.detectLevel(),this.router=await e.routerReady(),this.disposed||(this.unsubscribe=this.router.listen(()=>this.scheduleLoad()),this.loadRoute(this.router.getCurrentRoute()))}unmounted(){this.disposed=!0,this.abortController?.abort(),this.abortController=null,this.unsubscribe?.(),this.clear()}scheduleLoad(){!this.router||this.scheduled||this.disposed||(this.scheduled=!0,queueMicrotask(()=>{this.scheduled=!1,!this.disposed&&this.router&&this.loadRoute(this.router.getCurrentRoute())}))}detectLevel(){let e=0,t=this.parentElement;for(;t;){const r=t.closest("router-view");if(r){if(e++,t=r.parentElement,!t){const e=r.getRootNode();t=e instanceof ShadowRoot?e.host:null}}else{const e=t.getRootNode();t=e instanceof ShadowRoot?e.host:null}}this.level=e}async loadRoute(e){this.abortController&&(this.abortController.abort(),this.abortController=null);const t=++this.latestLoadId,r=e?.matched[this.level];if(!r)return void this.handleEmptyRoute(e);const{config:o}=r;let s=o.tagName;if(!s&&"function"==typeof o.component){this.renderLoading();const r=new AbortController;this.abortController=r;try{const n=this.router?.getComponentFromCache?.(e?.fullPath),i=n?await n:await o.component();if(r.signal.aborted||t!==this.latestLoadId||this.disposed)return;s="string"==typeof i?i:i.tagName}catch(n){if(r.signal.aborted||t!==this.latestLoadId||this.disposed)return;return void this.renderError(`Load Error: ${n}`)}finally{this.abortController===r&&(this.abortController=null)}}if(t===this.latestLoadId&&!this.disposed)if(s)if(!o.forceReload&&this.currentElement&&this.currentTagName===s.toLowerCase())this.syncState(this.currentElement,e?.params||{},e?.query||{},o.props);else{this.clear();const t=this.getOrCreateComponent(s,o,e);this.syncState(t,e?.params||{},e?.query||{},o.props),this.appendManagedNode(t),this.currentElement=t,this.currentTagName=s.toLowerCase()}else this.clear()}syncState(e,t,r,s={}){const n=e=>e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),i=function(e){let t=o.get(e);return t||(t={routerAttrs:new Set,propKeys:new Set},o.set(e,t)),t}(e),a=new Map;Object.entries(t).forEach(([e,t])=>a.set(n(e),String(t))),Object.entries(r).forEach(([e,t])=>a.set(`query-${n(e)}`,String(t))),i.routerAttrs.forEach(t=>{a.has(t)||(e.removeAttribute(t),i.routerAttrs.delete(t))}),a.forEach((t,r)=>{e.getAttribute(r)!==t&&e.setAttribute(r,t),i.routerAttrs.add(r)});const l=new Set(Object.keys(s)),d=e;i.propKeys.forEach(e=>{l.has(e)||(d[e]=void 0)}),Object.entries(s).forEach(([e,t])=>{d[e]!==t&&(d[e]=t)}),i.propKeys=l}getOrCreateComponent(e,t,r){if(!r)throw new Error("Route is required to create or retrieve component");const o=t.keepAliveKey?t.keepAliveKey(r,this.level):this.buildKeepAliveKey(e,r),s=t.keepAlive&&this.router?.getKeepAlive(o);if(s)return s;const n=document.createElement(e);return t.keepAlive&&this.router?.setKeepAlive(o,n),n}buildKeepAliveKey(e,t){const r=t.matched[this.level],o=r?.config.path??e.toLowerCase(),s=Object.values(r?.params??{});return s.length?`${this.level}:${o}:${s.join("|")}`:`${this.level}:${o}`}handleEmptyRoute(e){if(0===this.level){this.clear();const t=e?.matched?.[0],r=t?.config?.notFoundComponent||this.$data.notFound;if(r){const e=document.createElement(r);this.appendManagedNode(e),this.currentElement=e,this.currentTagName=r.toLowerCase()}else this.renderError("404 Not Found")}else this.clear()}appendManagedNode(e){e.parentNode!==this&&this.appendChild(e),this.managedNodes.add(e)}clear(){this.managedNodes.forEach(e=>{e.parentNode===this&&this.removeChild(e)}),this.managedNodes.clear(),this.currentElement=null,this.currentTagName=null}renderLoading(){this.clear();const e=document.createElement("div");e.style.cssText="padding:20px; color:#999;",e.textContent="Loading...",this.appendManagedNode(e)}renderError(e){this.clear();const t=document.createElement("div");t.style.cssText="padding:20px; color:#ff4d4f;",t.textContent=e,this.appendManagedNode(t)}},exports.default=((e,t)=>{for(var r,o=t,s=e.length-1;s>=0;s--)(r=e[s])&&(o=r(o)||o);return o})([r.CustomElement({tagName:"router-view",props:[{name:"notFound",type:"string",default:""}]})],exports.default);
@@ -1 +1 @@
1
- var e=Object.defineProperty,t=(t,o,r)=>((t,o,r)=>o in t?e(t,o,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[o]=r)(t,"symbol"!=typeof o?o+"":o,r);import{routerReady as o}from"./core.js";import r from"../runtime/component/base-element.js";import{CustomElement as s}from"../runtime/component/decorators.js";Object.getOwnPropertyDescriptor;const n=new WeakMap;let i=class extends r{constructor(){super(...arguments),t(this,"unsubscribe"),t(this,"level",0),t(this,"currentElement",null),t(this,"currentTagName",null),t(this,"managedNodes",new Set),t(this,"scheduled",!1),t(this,"latestLoadId",0),t(this,"abortController",null),t(this,"disposed",!1),t(this,"router",null)}async mounted(){this.disposed=!1,this.detectLevel(),this.router=await o(),this.disposed||(this.unsubscribe=this.router.listen(()=>this.scheduleLoad()),this.loadRoute(this.router.getCurrentRoute()))}unmounted(){var e,t;this.disposed=!0,null==(e=this.abortController)||e.abort(),this.abortController=null,null==(t=this.unsubscribe)||t.call(this),this.clear()}scheduleLoad(){!this.router||this.scheduled||this.disposed||(this.scheduled=!0,queueMicrotask(()=>{this.scheduled=!1,!this.disposed&&this.router&&this.loadRoute(this.router.getCurrentRoute())}))}detectLevel(){let e=0,t=this.parentElement;for(;t;){const o=t.closest("router-view");if(o){if(e++,t=o.parentElement,!t){const e=o.getRootNode();t=e instanceof ShadowRoot?e.host:null}}else{const e=t.getRootNode();t=e instanceof ShadowRoot?e.host:null}}this.level=e}async loadRoute(e){var t,o;this.abortController&&(this.abortController.abort(),this.abortController=null);const r=++this.latestLoadId,s=null==e?void 0:e.matched[this.level];if(!s)return void this.handleEmptyRoute(e);const{config:n}=s;let i=n.tagName;if(!i&&"function"==typeof n.component){this.renderLoading();const s=new AbortController;this.abortController=s;try{const l=null==(o=null==(t=this.router)?void 0:t.getComponentFromCache)?void 0:o.call(t,null==e?void 0:e.fullPath),a=l?await l:await n.component();if(s.signal.aborted||r!==this.latestLoadId||this.disposed)return;i="string"==typeof a?a:a.tagName}catch(l){if(s.signal.aborted||r!==this.latestLoadId||this.disposed)return;return void this.renderError(`Load Error: ${l}`)}finally{this.abortController===s&&(this.abortController=null)}}if(r===this.latestLoadId&&!this.disposed)if(i)if(!n.forceReload&&this.currentElement&&this.currentTagName===i.toLowerCase())this.syncState(this.currentElement,(null==e?void 0:e.params)||{},(null==e?void 0:e.query)||{},n.props);else{this.clear();const t=this.getOrCreateComponent(i,n,e);this.syncState(t,(null==e?void 0:e.params)||{},(null==e?void 0:e.query)||{},n.props),this.appendManagedNode(t),this.currentElement=t,this.currentTagName=i.toLowerCase()}else this.clear()}syncState(e,t,o,r={}){const s=e=>e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),i=function(e){let t=n.get(e);return t||(t={routerAttrs:new Set,propKeys:new Set},n.set(e,t)),t}(e),l=new Map;Object.entries(t).forEach(([e,t])=>l.set(s(e),String(t))),Object.entries(o).forEach(([e,t])=>l.set(`query-${s(e)}`,String(t))),i.routerAttrs.forEach(t=>{l.has(t)||(e.removeAttribute(t),i.routerAttrs.delete(t))}),l.forEach((t,o)=>{e.getAttribute(o)!==t&&e.setAttribute(o,t),i.routerAttrs.add(o)});const a=new Set(Object.keys(r)),d=e;i.propKeys.forEach(e=>{a.has(e)||(d[e]=void 0)}),Object.entries(r).forEach(([e,t])=>{d[e]!==t&&(d[e]=t)}),i.propKeys=a}getOrCreateComponent(e,t,o){var r,s;if(!o)throw new Error("Route is required to create or retrieve component");const n=t.keepAliveKey?t.keepAliveKey(o,this.level):this.buildKeepAliveKey(e,o),i=t.keepAlive&&(null==(r=this.router)?void 0:r.getKeepAlive(n));if(i)return i;const l=document.createElement(e);return t.keepAlive&&(null==(s=this.router)||s.setKeepAlive(n,l)),l}buildKeepAliveKey(e,t){const o=t.matched[this.level],r=(null==o?void 0:o.config.path)??e.toLowerCase(),s=Object.values((null==o?void 0:o.params)??{});return s.length?`${this.level}:${r}:${s.join("|")}`:`${this.level}:${r}`}handleEmptyRoute(e){var t,o;if(0===this.level){this.clear();const r=null==(t=null==e?void 0:e.matched)?void 0:t[0],s=(null==(o=null==r?void 0:r.config)?void 0:o.notFoundComponent)||this.$data.notFound;if(s){const e=document.createElement(s);this.appendManagedNode(e),this.currentElement=e,this.currentTagName=s.toLowerCase()}else this.renderError("404 Not Found")}else this.clear()}appendManagedNode(e){e.parentNode!==this&&this.appendChild(e),this.managedNodes.add(e)}clear(){this.managedNodes.forEach(e=>{e.parentNode===this&&this.removeChild(e)}),this.managedNodes.clear(),this.currentElement=null,this.currentTagName=null}renderLoading(){this.clear();const e=document.createElement("div");e.style.cssText="padding:20px; color:#999;",e.textContent="Loading...",this.appendManagedNode(e)}renderError(e){this.clear();const t=document.createElement("div");t.style.cssText="padding:20px; color:#ff4d4f;",t.textContent=e,this.appendManagedNode(t)}};i=((e,t)=>{for(var o,r=t,s=e.length-1;s>=0;s--)(o=e[s])&&(r=o(r)||r);return r})([s({tagName:"router-view",props:[{name:"notFound",type:"string",default:""}]})],i);export{i as default};
1
+ import{routerReady as e}from"./core.js";import t from"../runtime/component/base-element.js";import{CustomElement as r}from"../runtime/component/decorators.js";Object.getOwnPropertyDescriptor;const o=new WeakMap;let s=class extends t{unsubscribe;level=0;currentElement=null;currentTagName=null;managedNodes=new Set;scheduled=!1;latestLoadId=0;abortController=null;disposed=!1;router=null;async mounted(){this.disposed=!1,this.detectLevel(),this.router=await e(),this.disposed||(this.unsubscribe=this.router.listen(()=>this.scheduleLoad()),this.loadRoute(this.router.getCurrentRoute()))}unmounted(){this.disposed=!0,this.abortController?.abort(),this.abortController=null,this.unsubscribe?.(),this.clear()}scheduleLoad(){!this.router||this.scheduled||this.disposed||(this.scheduled=!0,queueMicrotask(()=>{this.scheduled=!1,!this.disposed&&this.router&&this.loadRoute(this.router.getCurrentRoute())}))}detectLevel(){let e=0,t=this.parentElement;for(;t;){const r=t.closest("router-view");if(r){if(e++,t=r.parentElement,!t){const e=r.getRootNode();t=e instanceof ShadowRoot?e.host:null}}else{const e=t.getRootNode();t=e instanceof ShadowRoot?e.host:null}}this.level=e}async loadRoute(e){this.abortController&&(this.abortController.abort(),this.abortController=null);const t=++this.latestLoadId,r=e?.matched[this.level];if(!r)return void this.handleEmptyRoute(e);const{config:o}=r;let s=o.tagName;if(!s&&"function"==typeof o.component){this.renderLoading();const r=new AbortController;this.abortController=r;try{const n=this.router?.getComponentFromCache?.(e?.fullPath),i=n?await n:await o.component();if(r.signal.aborted||t!==this.latestLoadId||this.disposed)return;s="string"==typeof i?i:i.tagName}catch(n){if(r.signal.aborted||t!==this.latestLoadId||this.disposed)return;return void this.renderError(`Load Error: ${n}`)}finally{this.abortController===r&&(this.abortController=null)}}if(t===this.latestLoadId&&!this.disposed)if(s)if(!o.forceReload&&this.currentElement&&this.currentTagName===s.toLowerCase())this.syncState(this.currentElement,e?.params||{},e?.query||{},o.props);else{this.clear();const t=this.getOrCreateComponent(s,o,e);this.syncState(t,e?.params||{},e?.query||{},o.props),this.appendManagedNode(t),this.currentElement=t,this.currentTagName=s.toLowerCase()}else this.clear()}syncState(e,t,r,s={}){const n=e=>e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),i=function(e){let t=o.get(e);return t||(t={routerAttrs:new Set,propKeys:new Set},o.set(e,t)),t}(e),a=new Map;Object.entries(t).forEach(([e,t])=>a.set(n(e),String(t))),Object.entries(r).forEach(([e,t])=>a.set(`query-${n(e)}`,String(t))),i.routerAttrs.forEach(t=>{a.has(t)||(e.removeAttribute(t),i.routerAttrs.delete(t))}),a.forEach((t,r)=>{e.getAttribute(r)!==t&&e.setAttribute(r,t),i.routerAttrs.add(r)});const l=new Set(Object.keys(s)),d=e;i.propKeys.forEach(e=>{l.has(e)||(d[e]=void 0)}),Object.entries(s).forEach(([e,t])=>{d[e]!==t&&(d[e]=t)}),i.propKeys=l}getOrCreateComponent(e,t,r){if(!r)throw new Error("Route is required to create or retrieve component");const o=t.keepAliveKey?t.keepAliveKey(r,this.level):this.buildKeepAliveKey(e,r),s=t.keepAlive&&this.router?.getKeepAlive(o);if(s)return s;const n=document.createElement(e);return t.keepAlive&&this.router?.setKeepAlive(o,n),n}buildKeepAliveKey(e,t){const r=t.matched[this.level],o=r?.config.path??e.toLowerCase(),s=Object.values(r?.params??{});return s.length?`${this.level}:${o}:${s.join("|")}`:`${this.level}:${o}`}handleEmptyRoute(e){if(0===this.level){this.clear();const t=e?.matched?.[0],r=t?.config?.notFoundComponent||this.$data.notFound;if(r){const e=document.createElement(r);this.appendManagedNode(e),this.currentElement=e,this.currentTagName=r.toLowerCase()}else this.renderError("404 Not Found")}else this.clear()}appendManagedNode(e){e.parentNode!==this&&this.appendChild(e),this.managedNodes.add(e)}clear(){this.managedNodes.forEach(e=>{e.parentNode===this&&this.removeChild(e)}),this.managedNodes.clear(),this.currentElement=null,this.currentTagName=null}renderLoading(){this.clear();const e=document.createElement("div");e.style.cssText="padding:20px; color:#999;",e.textContent="Loading...",this.appendManagedNode(e)}renderError(e){this.clear();const t=document.createElement("div");t.style.cssText="padding:20px; color:#ff4d4f;",t.textContent=e,this.appendManagedNode(t)}};s=((e,t)=>{for(var r,o=t,s=e.length-1;s>=0;s--)(r=e[s])&&(o=r(o)||o);return o})([r({tagName:"router-view",props:[{name:"notFound",type:"string",default:""}]})],s);export{s 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,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
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../../shared/is-object.cjs"),t=require("../../shared/env.cjs"),s=require("../../shared/case-convert.cjs"),i=require("../reactivity/observe.cjs"),r=require("../renderer/renderIR.cjs"),a=Symbol.for("solely.manifest"),o="undefined"!=typeof HTMLElement?HTMLElement:class{};function n(e){if(null===e||"object"!=typeof e)return e;const t=globalThis.structuredClone;if("function"==typeof t)try{return t(e)}catch{}try{return JSON.parse(JSON.stringify(e))}catch{return e}}class c extends o{$refs={};#e;#t;#s;#i;#r;#a;#o=!1;#n=!1;#c=!1;#d=!1;#h=!1;#l=!1;#u=!1;#p=new Set;#f=!1;#b=!1;static#y=new Map;static#m=new WeakSet;#g=new Map;static#S=new Set(["$data","$refs","constructor","created","mounted","beforeUpdate","updated","unmounted","attributeChanged","beforeAttributesUpdate","afterAttributesUpdate","emit","emitNative","refresh","dispose","warn","error"]);static get observedAttributes(){const e=this[a];return e?.attributeMap?Array.from(e.attributeMap.keys()):[]}constructor(e={}){super();const t=this.constructor;this.#e=t[a]||{tagName:"base-element"};const s=this.#e;this.#r=s.shadowDOM?.use?this.attachShadow({mode:s.shadowDOM.mode||"open"}):this,this.#v(e),this.#A(s),queueMicrotask(()=>this.#O())}#C(){const e=Object.getOwnPropertyNames(this),t=["#","_"],s=c.#S,i=new Map;let r=Object.getPrototypeOf(this);for(;r&&r!==o.prototype;){const e=Object.getOwnPropertyDescriptors(r);for(const[t,s]of Object.entries(e))s.set&&!i.has(t)&&i.set(t,s);r=Object.getPrototypeOf(r)}for(const a of e){if(s.has(a))continue;if(t.some(e=>a.startsWith(e)))continue;const e=Object.getOwnPropertyDescriptor(this,a);if(!e||!("value"in e))continue;const r=e.value,o=i.get(a);o?.set&&(delete this[a],this[a]=r)}}#v(e){t.IS_DEV&&e&&"object"==typeof e&&(c.#m.has(e)&&console.warn(`[Solely] <${this.#e.tagName}>: 该初始数据对象已被其他实例使用,$data 会共享同一响应式代理(改一个实例会同时触发另一个实例刷新)。如需实例隔离,请为每个实例传入新对象。`),c.#m.add(e));const{proxy:s,dispose:r}=i.observe(e,e=>{if("set"===e.type||"array-replace"===e.type){const{key:t,newValue:s}=e,i=this.#e,r=String(t),a=i.propMap?.get(r);a?.reflect&&this.#R(a,s)}!1!==this.#e.dataChangeEvent&&this.emit("dataChange",{...e}),this.#w()});this.#i=s,this.#a=r}#R(e,t){const i=s.camelToKebab(e.name);this.#p.add(i);try{if(null==t)return void this.removeAttribute(i);if("boolean"===e.type)t?this.setAttribute(i,""):this.removeAttribute(i);else{const e="object"==typeof t?JSON.stringify(t):String(t);this.setAttribute(i,e)}}finally{this.#p.delete(i)}}#A(e){e.ir&&(this.#s=e.ir)}#j(e){const t=this.#g.get(e);if(void 0!==t)return t;let s=null,i=Object.getPrototypeOf(this);for(;i&&i!==o.prototype;){const t=Object.getOwnPropertyDescriptor(i,e);if(t){s=t.get||t.set?t:null;break}i=Object.getPrototypeOf(i)}return this.#g.set(e,s),s}#$(e,t){const s=this.#j(e.name);s?.set?this[e.name]=t:this.$data[e.name]=t}#N(){const e=this.#e;if(e.attributeMap)for(const[,t]of e.attributeMap)if(!1!==t.reactive&&!this.#j(t.name)){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})}}#P(){this.#u||(this.#u=!0,this.#N())}get $data(){return this.#i}set $data(t){e.isObject(t)||(t={}),t!==this.#i&&(this.#a?.(),this.#v(t),this.#P(),this.#w())}#M(e,t,s){if(null===e)return"boolean"!==s&&t;switch(s){case"boolean":return!0;case"number":{const s=Number(e);return isNaN(s)?t:s}case"object":try{return JSON.parse(e)}catch(i){return console.error(`[Solely] Failed to parse object value: "${e}", using default value.`,i),t}case"array":try{const s=JSON.parse(e);return Array.isArray(s)?s:t}catch(i){return console.error(`[Solely] Failed to parse array value: "${e}", using default value.`,i),t}default:return e}}#w(){this.#f||(this.#h?!this.#n&&this.#t&&(this.#n=!0,queueMicrotask(()=>{this.#f||(this.#n=!1,this.#D())})):this.#l=!0)}#D(){if(!this.#f&&!this.#o&&this.#h){this.#o=!0;try{this.#c&&this.beforeAttributesUpdate(),this.beforeUpdate(),this.#t?.update(),this.updated(),this.#c&&(this.afterAttributesUpdate(),this.#c=!1)}finally{this.#o=!1}}}refresh(){this.#w()}#E(){const e=this.#e;if(!e.styles)return;const s=this.#r;if(e.sheet&&s instanceof ShadowRoot&&"adoptedStyleSheets"in s){if(!s.adoptedStyleSheets.includes(e.sheet)){const t=Array.from(s.adoptedStyleSheets);t.push(e.sheet),s.adoptedStyleSheets=t}return void(this.#b=!0)}const i=s instanceof ShadowRoot?s:document.head,r=`solely-style-${t.SOLELY_VERSION}-${e.tagName}`,a=!e.shadowDOM?.use,o="undefined"!=typeof CSS&&CSS.escape?CSS.escape(r):r.replace(/([.#:[\]()!])/g,"\\$1");if(!i.querySelector(`#${o}`)){const t=document.createElement("style");t.id=r,t.textContent=e.styles,i.appendChild(t)}if(a){const e=c.#y.get(r)||0;c.#y.set(r,e+1),this.#b=!0}}#U(){if(!this.#b)return;this.#b=!1;const e=this.#e;if(!e.shadowDOM?.use&&e.styles){const s=`solely-style-${t.SOLELY_VERSION}-${e.tagName}`,i=c.#y.get(s)||0;if(i<=1){const e="undefined"!=typeof CSS&&CSS.escape?CSS.escape(s):s.replace(/([.#:[\]()!])/g,"\\$1");document.head.querySelector(`#${e}`)?.remove(),c.#y.delete(s)}else c.#y.set(s,i-1)}}connectedCallback(){if(this.#f)return t.IS_DEV&&console.error(`[Solely] <${this.tagName.toLowerCase()}> has been disposed and cannot be reconnected.`),void this.remove();this.#h=!0;const s=this.#e;if(this.#O(),(s.className||s.tagName||"").split(" ").forEach(e=>e&&this.classList.add(e)),this.#E(),s.attributeMap&&e.isObject(this.$data)){this.#P();for(const[e,t]of s.attributeMap){const s=t.name;if(this.hasAttribute(e)){const s=this.getAttribute(e),i=this.#M(s,n(t.default),t.type);this.#$(t,i)}else"default"in t&&void 0===this.$data[s]&&(this.#$(t,n(t.default)),"boolean"===t.type&&!0===t.default&&this.setAttribute(e,""))}}this.#C(),this.#s&&!this.#t&&(this.#t=r.createRender(this.#s,this.#r,this)),this.#l&&(this.#l=!1,this.#w()),this.mounted()}disconnectedCallback(){this.#h=!1,this.#f||this.#U(),this.unmounted()}attributeChangedCallback(t,s,i){if(this.#f||s===i||!e.isObject(this.$data))return;if(this.#p.has(t))return;const r=this.#e,a=r.attributeMap?.get(t);if(!a)return;const o=a.name,c=this.$data[o],d=void 0!==a.default?n(a.default):c,h=this.#M(i,d,a.type);c!==h&&(this.#c=!0,this.#$(a,h),this.$data[o]===c&&(this.#c=!1),this.attributeChanged(t,c,h))}#O(){this.#d||(this.#d=!0,this.created())}emit(e,t,s){this.#f||this.dispatchEvent(new CustomEvent(e,{bubbles:!0,composed:!0,detail:t,...s}))}emitNative(e,t){this.#f||this.dispatchEvent(new Event(e,{bubbles:!0,composed:!0,...t}))}warn(e,s){if(t.IS_DEV&&e){const e=this.tagName.toLowerCase();console.warn(`[${e}] ${s}`)}}error(e,s){if(t.IS_DEV&&e){const e=this.tagName.toLowerCase();console.error(`[${e}] ${s}`)}}dispose(){this.#f||(this.#f=!0,this.#h=!1,this.#U(),this.#t?.destroy(),this.#t=void 0,this.#a?.(),this.#a=void 0,this.remove())}created(){}mounted(){}beforeUpdate(){}updated(){}unmounted(){}attributeChanged(e,t,s){}beforeAttributesUpdate(){}afterAttributesUpdate(){}}exports.default=c;
@@ -1,3 +1,10 @@
1
+ /**
2
+ * Node/SSR 环境没有 HTMLElement。若模块顶层直接 `extends HTMLElement`,
3
+ * `import 'solely'` 会在求值阶段抛 `ReferenceError: HTMLElement is not defined`。
4
+ * 这里退化为空基类:浏览器环境仍是原生 HTMLElement(行为不变),
5
+ * Node 环境仅保证「可导入」,实例化与渲染仍需 DOM。
6
+ */
7
+ declare const HTMLElementBase: typeof HTMLElement;
1
8
  declare interface BaseElement<TData extends object = Record<string, unknown>, TRefs extends Record<string, Element> = Record<string, Element>> {
2
9
  /**
3
10
  * 通过 ref 属性获取的 DOM 元素引用集合
@@ -6,7 +13,7 @@ declare interface BaseElement<TData extends object = Record<string, unknown>, TR
6
13
  */
7
14
  $refs: TRefs;
8
15
  }
9
- declare class BaseElement<TData extends object = Record<string, unknown>, TRefs extends Record<string, Element> = Record<string, Element>> extends HTMLElement implements BaseElement<TData, TRefs> {
16
+ declare class BaseElement<TData extends object = Record<string, unknown>, TRefs extends Record<string, Element> = Record<string, Element>> extends HTMLElementBase implements BaseElement<TData, TRefs> {
10
17
  #private;
11
18
  $refs: TRefs;
12
19
  static get observedAttributes(): string[];
@@ -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,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
+ import{isObject as t}from"../../shared/is-object.js";import{IS_DEV as e,SOLELY_VERSION as s}from"../../shared/env.js";import{camelToKebab as i}from"../../shared/case-convert.js";import{observe as r}from"../reactivity/observe.js";import{createRender as a}from"../renderer/renderIR.js";const o=Symbol.for("solely.manifest"),n="undefined"!=typeof HTMLElement?HTMLElement:class{};function d(t){if(null===t||"object"!=typeof t)return t;const e=globalThis.structuredClone;if("function"==typeof e)try{return e(t)}catch{}try{return JSON.parse(JSON.stringify(t))}catch{return t}}class h extends n{$refs={};#t;#e;#s;#i;#r;#a;#o=!1;#n=!1;#d=!1;#h=!1;#c=!1;#l=!1;#u=!1;#p=new Set;#f=!1;#m=!1;static#b=new Map;static#y=new WeakSet;#g=new Map;static#v=new Set(["$data","$refs","constructor","created","mounted","beforeUpdate","updated","unmounted","attributeChanged","beforeAttributesUpdate","afterAttributesUpdate","emit","emitNative","refresh","dispose","warn","error"]);static get observedAttributes(){const t=this[o];return t?.attributeMap?Array.from(t.attributeMap.keys()):[]}constructor(t={}){super();const e=this.constructor;this.#t=e[o]||{tagName:"base-element"};const s=this.#t;this.#r=s.shadowDOM?.use?this.attachShadow({mode:s.shadowDOM.mode||"open"}):this,this.#A(t),this.#S(s),queueMicrotask(()=>this.#O())}#C(){const t=Object.getOwnPropertyNames(this),e=["#","_"],s=h.#v,i=new Map;let r=Object.getPrototypeOf(this);for(;r&&r!==n.prototype;){const t=Object.getOwnPropertyDescriptors(r);for(const[e,s]of Object.entries(t))s.set&&!i.has(e)&&i.set(e,s);r=Object.getPrototypeOf(r)}for(const a of t){if(s.has(a))continue;if(e.some(t=>a.startsWith(t)))continue;const t=Object.getOwnPropertyDescriptor(this,a);if(!t||!("value"in t))continue;const r=t.value,o=i.get(a);o?.set&&(delete this[a],this[a]=r)}}#A(t){e&&t&&"object"==typeof t&&(h.#y.has(t)&&console.warn(`[Solely] <${this.#t.tagName}>: 该初始数据对象已被其他实例使用,$data 会共享同一响应式代理(改一个实例会同时触发另一个实例刷新)。如需实例隔离,请为每个实例传入新对象。`),h.#y.add(t));const{proxy:s,dispose:i}=r(t,t=>{if("set"===t.type||"array-replace"===t.type){const{key:e,newValue:s}=t,i=this.#t,r=String(e),a=i.propMap?.get(r);a?.reflect&&this.#w(a,s)}!1!==this.#t.dataChangeEvent&&this.emit("dataChange",{...t}),this.#R()});this.#i=s,this.#a=i}#w(t,e){const s=i(t.name);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{this.#p.delete(s)}}#S(t){t.ir&&(this.#s=t.ir)}#$(t){const e=this.#g.get(t);if(void 0!==e)return e;let s=null,i=Object.getPrototypeOf(this);for(;i&&i!==n.prototype;){const e=Object.getOwnPropertyDescriptor(i,t);if(e){s=e.get||e.set?e:null;break}i=Object.getPrototypeOf(i)}return this.#g.set(t,s),s}#j(t,e){const s=this.#$(t.name);s?.set?this[t.name]=e:this.$data[t.name]=e}#P(){const t=this.#t;if(t.attributeMap)for(const[,e]of t.attributeMap)if(!1!==e.reactive&&!this.#$(e.name)){const t=Object.getOwnPropertyDescriptor(this,e.name);t&&"value"in t&&(this.$data[e.name]=t.value,delete this[e.name]),Object.defineProperty(this,e.name,{get:()=>this.$data[e.name],set:t=>{this.$data[e.name]=t},configurable:!0,enumerable:!0})}}#N(){this.#u||(this.#u=!0,this.#P())}get $data(){return this.#i}set $data(e){t(e)||(e={}),e!==this.#i&&(this.#a?.(),this.#A(e),this.#N(),this.#R())}#M(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}}#R(){this.#f||(this.#c?!this.#n&&this.#e&&(this.#n=!0,queueMicrotask(()=>{this.#f||(this.#n=!1,this.#U())})):this.#l=!0)}#U(){if(!this.#f&&!this.#o&&this.#c){this.#o=!0;try{this.#d&&this.beforeAttributesUpdate(),this.beforeUpdate(),this.#e?.update(),this.updated(),this.#d&&(this.afterAttributesUpdate(),this.#d=!1)}finally{this.#o=!1}}}refresh(){this.#R()}#D(){const t=this.#t;if(!t.styles)return;const e=this.#r;if(t.sheet&&e instanceof ShadowRoot&&"adoptedStyleSheets"in e){if(!e.adoptedStyleSheets.includes(t.sheet)){const s=Array.from(e.adoptedStyleSheets);s.push(t.sheet),e.adoptedStyleSheets=s}return void(this.#m=!0)}const i=e instanceof ShadowRoot?e:document.head,r=`solely-style-${s}-${t.tagName}`,a=!t.shadowDOM?.use,o="undefined"!=typeof CSS&&CSS.escape?CSS.escape(r):r.replace(/([.#:[\]()!])/g,"\\$1");if(!i.querySelector(`#${o}`)){const e=document.createElement("style");e.id=r,e.textContent=t.styles,i.appendChild(e)}if(a){const t=h.#b.get(r)||0;h.#b.set(r,t+1),this.#m=!0}}#k(){if(!this.#m)return;this.#m=!1;const t=this.#t;if(!t.shadowDOM?.use&&t.styles){const e=`solely-style-${s}-${t.tagName}`,i=h.#b.get(e)||0;if(i<=1){const t="undefined"!=typeof CSS&&CSS.escape?CSS.escape(e):e.replace(/([.#:[\]()!])/g,"\\$1");document.head.querySelector(`#${t}`)?.remove(),h.#b.delete(e)}else h.#b.set(e,i-1)}}connectedCallback(){if(this.#f)return e&&console.error(`[Solely] <${this.tagName.toLowerCase()}> has been disposed and cannot be reconnected.`),void this.remove();this.#c=!0;const s=this.#t;if(this.#O(),(s.className||s.tagName||"").split(" ").forEach(t=>t&&this.classList.add(t)),this.#D(),s.attributeMap&&t(this.$data)){this.#N();for(const[t,e]of s.attributeMap){const s=e.name;if(this.hasAttribute(t)){const s=this.getAttribute(t),i=this.#M(s,d(e.default),e.type);this.#j(e,i)}else"default"in e&&void 0===this.$data[s]&&(this.#j(e,d(e.default)),"boolean"===e.type&&!0===e.default&&this.setAttribute(t,""))}}this.#C(),this.#s&&!this.#e&&(this.#e=a(this.#s,this.#r,this)),this.#l&&(this.#l=!1,this.#R()),this.mounted()}disconnectedCallback(){this.#c=!1,this.#f||this.#k(),this.unmounted()}attributeChangedCallback(e,s,i){if(this.#f||s===i||!t(this.$data))return;if(this.#p.has(e))return;const r=this.#t,a=r.attributeMap?.get(e);if(!a)return;const o=a.name,n=this.$data[o],h=void 0!==a.default?d(a.default):n,c=this.#M(i,h,a.type);n!==c&&(this.#d=!0,this.#j(a,c),this.$data[o]===n&&(this.#d=!1),this.attributeChanged(e,n,c))}#O(){this.#h||(this.#h=!0,this.created())}emit(t,e,s){this.#f||this.dispatchEvent(new CustomEvent(t,{bubbles:!0,composed:!0,detail:e,...s}))}emitNative(t,e){this.#f||this.dispatchEvent(new Event(t,{bubbles:!0,composed:!0,...e}))}warn(t,s){if(e&&t){const t=this.tagName.toLowerCase();console.warn(`[${t}] ${s}`)}}error(t,s){if(e&&t){const t=this.tagName.toLowerCase();console.error(`[${t}] ${s}`)}}dispose(){this.#f||(this.#f=!0,this.#c=!1,this.#k(),this.#e?.destroy(),this.#e=void 0,this.#a?.(),this.#a=void 0,this.remove())}created(){}mounted(){}beforeUpdate(){}updated(){}unmounted(){}attributeChanged(t,e,s){}beforeAttributesUpdate(){}afterAttributesUpdate(){}}export{h as default};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../shared/env.cjs"),t=require("../../shared/case-convert.cjs"),o=require("../../compiler/parser/parser.cjs"),r=require("../../compiler/ir/buildIR.cjs"),n=Symbol.for("solely.manifest");exports.CustomElement=s=>{const l=s,a="undefined"!=typeof window&&"undefined"!=typeof customElements;return s=>{const{tagName:c}=l;if(a&&!(s.prototype instanceof HTMLElement)&&s!==HTMLElement)throw new TypeError(`[Solely] CustomElement decorator can only be applied to classes extending HTMLElement.\nReceived: ${s.name||"anonymous class"}`);if(a&&customElements.get(c))return e.IS_DEV&&console.warn(`[Solely] 标签名称 "${c}" 已经被注册,跳过重复定义。`),s[n]=l,s;if("string"!=typeof l.template||l.ir){if(l.template&&!l.ir)if("object"==typeof l.template&&null!==l.template){const t=l.template;"root"===t.t&&Array.isArray(t.fns)&&Array.isArray(t.n)?(l.ir=t,e.IS_DEV&&console.info(`[Solely] Using precompiled IR for <${c}> | Nodes: ${t.n.length} | Fns: ${t.fns.length}`)):console.error(`[Manifest Error] <${c}>: 提供的 template 不是有效的 IRRoot 对象。\n期望: { t: "root", fns: [], n: [] }\n实际: ${JSON.stringify(Object.keys(t))}`)}else console.error(`[Manifest Error] <${c}>: template 类型无效。\n期望: string 或 IRRoot 对象\n实际: ${typeof l.template}`)}else if(l.template.trim())try{const e=o.parseHtml(l.template);l.ir=r.buildIR(e,{source:l.template,filename:c})}catch(p){const t=p instanceof Error?p:new Error(String(p));console.error(`[Compiler Error] <${c}>: 模板编译失败\n错误: ${t.message}\n模板长度: ${l.template.length} 字符`,e.IS_DEV?t.stack:"")}else e.IS_DEV&&console.warn(`[Solely] <${c}>: 模板为空字符串`);if(a&&l.styles&&!l.sheet&&"CSSStyleSheet"in window)try{const e=new CSSStyleSheet;"function"==typeof e.replaceSync&&(e.replaceSync(l.styles),l.sheet=e)}catch{e.IS_DEV&&console.warn(`[Solely] <${c}>: CSSStyleSheet 不可用,将使用 style 标签回退方案`)}if(l.props&&!l.attributeMap){const e=new Map,o=new Map;l.props.forEach(r=>{const n="string"==typeof r?{name:r}:r,s=t.camelToKebab(n.name),l=n.name,a={...n,name:l};e.set(s,a),o.set(l,a)}),l.attributeMap=e,l.propMap=o}class i extends s{}if(i[n]=l,a){if(e.IS_DEV){const e=s.prototype,t=["connectedCallback","disconnectedCallback","attributeChangedCallback"];for(const o of t)Object.prototype.hasOwnProperty.call(e,o)&&console.error(`[${c}] 禁止重写 ${o}(),请使用框架钩子`)}customElements.define(c,i)}return i}};
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../shared/env.cjs"),t=require("../../shared/case-convert.cjs"),o=require("../../compiler/parser/parser.cjs"),r=require("../../compiler/ir/buildIR.cjs"),n=Symbol.for("solely.manifest");exports.CustomElement=s=>{const l=s,a="undefined"!=typeof window&&"undefined"!=typeof customElements;return s=>{const c=s,{tagName:i}=l,p="undefined"!=typeof HTMLElement&&!(s.prototype instanceof HTMLElement)&&s!==HTMLElement;if(a&&p)throw new TypeError(`[Solely] CustomElement decorator can only be applied to classes extending HTMLElement.\nReceived: ${s.name||"anonymous class"}`);if(a&&customElements.get(i))return e.IS_DEV&&console.warn(`[Solely] 标签名称 "${i}" 已经被注册,跳过重复定义。`),s[n]=l,s;if("string"!=typeof l.template||l.ir){if(l.template&&!l.ir)if("object"==typeof l.template&&null!==l.template){const t=l.template;"root"===t.t&&Array.isArray(t.fns)&&Array.isArray(t.n)?(l.ir=t,e.IS_DEV&&console.info(`[Solely] Using precompiled IR for <${i}> | Nodes: ${t.n.length} | Fns: ${t.fns.length}`)):console.error(`[Manifest Error] <${i}>: 提供的 template 不是有效的 IRRoot 对象。\n期望: { t: "root", fns: [], n: [] }\n实际: ${JSON.stringify(Object.keys(t))}`)}else console.error(`[Manifest Error] <${i}>: template 类型无效。\n期望: string 或 IRRoot 对象\n实际: ${typeof l.template}`)}else if(l.template.trim())try{const e=o.parseHtml(l.template);l.ir=r.buildIR(e,{source:l.template,filename:i})}catch(f){const t=f instanceof Error?f:new Error(String(f));console.error(`[Compiler Error] <${i}>: 模板编译失败\n错误: ${t.message}\n模板长度: ${l.template.length} 字符`,e.IS_DEV?t.stack:"")}else e.IS_DEV&&console.warn(`[Solely] <${i}>: 模板为空字符串`);if(a&&l.styles&&!l.sheet&&"CSSStyleSheet"in window)try{const e=new CSSStyleSheet;"function"==typeof e.replaceSync&&(e.replaceSync(l.styles),l.sheet=e)}catch{e.IS_DEV&&console.warn(`[Solely] <${i}>: CSSStyleSheet 不可用,将使用 style 标签回退方案`)}if(l.props&&!l.attributeMap){const e=new Map,o=new Map;l.props.forEach(r=>{const n="string"==typeof r?{name:r}:r,s=t.camelToKebab(n.name),l=n.name,a={...n,name:l};e.set(s,a),o.set(l,a)}),l.attributeMap=e,l.propMap=o}class m extends c{}if(m[n]=l,a){if(e.IS_DEV){const e=s.prototype,t=["connectedCallback","disconnectedCallback","attributeChangedCallback"];for(const o of t)Object.prototype.hasOwnProperty.call(e,o)&&console.error(`[${i}] 禁止重写 ${o}(),请使用框架钩子`)}customElements.define(i,m)}return m}};
@@ -51,6 +51,13 @@ export interface Manifest {
51
51
  tagName: string;
52
52
  /** s-model 双向绑定配置 */
53
53
  model?: ModelConfig;
54
+ /**
55
+ * 是否在每次数据变更时派发 `dataChange` 事件(冒泡 + composed)
56
+ * - 默认 true,便于外部监听
57
+ * - 高频更新场景(输入框、拖拽)可设为 false 以省去事件构造与派发开销
58
+ * @default true
59
+ */
60
+ dataChangeEvent?: boolean;
54
61
  }
55
62
  /** 框架内部使用的运行时版本 */
56
63
  export interface InternalManifest extends Manifest {
@@ -1 +1 @@
1
- import{IS_DEV as e}from"../../shared/env.js";import{camelToKebab as t}from"../../shared/case-convert.js";import{parseHtml as o}from"../../compiler/parser/parser.js";import{buildIR as r}from"../../compiler/ir/buildIR.js";const n=Symbol.for("solely.manifest"),s=s=>{const l=s,a="undefined"!=typeof window&&"undefined"!=typeof customElements;return s=>{const{tagName:c}=l;if(a&&!(s.prototype instanceof HTMLElement)&&s!==HTMLElement)throw new TypeError(`[Solely] CustomElement decorator can only be applied to classes extending HTMLElement.\nReceived: ${s.name||"anonymous class"}`);if(a&&customElements.get(c))return e&&console.warn(`[Solely] 标签名称 "${c}" 已经被注册,跳过重复定义。`),s[n]=l,s;if("string"!=typeof l.template||l.ir){if(l.template&&!l.ir)if("object"==typeof l.template&&null!==l.template){const t=l.template;"root"===t.t&&Array.isArray(t.fns)&&Array.isArray(t.n)?(l.ir=t,e&&console.info(`[Solely] Using precompiled IR for <${c}> | Nodes: ${t.n.length} | Fns: ${t.fns.length}`)):console.error(`[Manifest Error] <${c}>: 提供的 template 不是有效的 IRRoot 对象。\n期望: { t: "root", fns: [], n: [] }\n实际: ${JSON.stringify(Object.keys(t))}`)}else console.error(`[Manifest Error] <${c}>: template 类型无效。\n期望: string 或 IRRoot 对象\n实际: ${typeof l.template}`)}else if(l.template.trim())try{const e=o(l.template);l.ir=r(e,{source:l.template,filename:c})}catch(p){const t=p instanceof Error?p:new Error(String(p));console.error(`[Compiler Error] <${c}>: 模板编译失败\n错误: ${t.message}\n模板长度: ${l.template.length} 字符`,e?t.stack:"")}else e&&console.warn(`[Solely] <${c}>: 模板为空字符串`);if(a&&l.styles&&!l.sheet&&"CSSStyleSheet"in window)try{const e=new CSSStyleSheet;"function"==typeof e.replaceSync&&(e.replaceSync(l.styles),l.sheet=e)}catch{e&&console.warn(`[Solely] <${c}>: CSSStyleSheet 不可用,将使用 style 标签回退方案`)}if(l.props&&!l.attributeMap){const e=new Map,o=new Map;l.props.forEach(r=>{const n="string"==typeof r?{name:r}:r,s=t(n.name),l=n.name,a={...n,name:l};e.set(s,a),o.set(l,a)}),l.attributeMap=e,l.propMap=o}class i extends s{}if(i[n]=l,a){if(e){const e=s.prototype,t=["connectedCallback","disconnectedCallback","attributeChangedCallback"];for(const o of t)Object.prototype.hasOwnProperty.call(e,o)&&console.error(`[${c}] 禁止重写 ${o}(),请使用框架钩子`)}customElements.define(c,i)}return i}};export{s as CustomElement};
1
+ import{IS_DEV as e}from"../../shared/env.js";import{camelToKebab as t}from"../../shared/case-convert.js";import{parseHtml as o}from"../../compiler/parser/parser.js";import{buildIR as n}from"../../compiler/ir/buildIR.js";const r=Symbol.for("solely.manifest"),s=s=>{const l=s,a="undefined"!=typeof window&&"undefined"!=typeof customElements;return s=>{const c=s,{tagName:i}=l,p="undefined"!=typeof HTMLElement&&!(s.prototype instanceof HTMLElement)&&s!==HTMLElement;if(a&&p)throw new TypeError(`[Solely] CustomElement decorator can only be applied to classes extending HTMLElement.\nReceived: ${s.name||"anonymous class"}`);if(a&&customElements.get(i))return e&&console.warn(`[Solely] 标签名称 "${i}" 已经被注册,跳过重复定义。`),s[r]=l,s;if("string"!=typeof l.template||l.ir){if(l.template&&!l.ir)if("object"==typeof l.template&&null!==l.template){const t=l.template;"root"===t.t&&Array.isArray(t.fns)&&Array.isArray(t.n)?(l.ir=t,e&&console.info(`[Solely] Using precompiled IR for <${i}> | Nodes: ${t.n.length} | Fns: ${t.fns.length}`)):console.error(`[Manifest Error] <${i}>: 提供的 template 不是有效的 IRRoot 对象。\n期望: { t: "root", fns: [], n: [] }\n实际: ${JSON.stringify(Object.keys(t))}`)}else console.error(`[Manifest Error] <${i}>: template 类型无效。\n期望: string 或 IRRoot 对象\n实际: ${typeof l.template}`)}else if(l.template.trim())try{const e=o(l.template);l.ir=n(e,{source:l.template,filename:i})}catch(f){const t=f instanceof Error?f:new Error(String(f));console.error(`[Compiler Error] <${i}>: 模板编译失败\n错误: ${t.message}\n模板长度: ${l.template.length} 字符`,e?t.stack:"")}else e&&console.warn(`[Solely] <${i}>: 模板为空字符串`);if(a&&l.styles&&!l.sheet&&"CSSStyleSheet"in window)try{const e=new CSSStyleSheet;"function"==typeof e.replaceSync&&(e.replaceSync(l.styles),l.sheet=e)}catch{e&&console.warn(`[Solely] <${i}>: CSSStyleSheet 不可用,将使用 style 标签回退方案`)}if(l.props&&!l.attributeMap){const e=new Map,o=new Map;l.props.forEach(n=>{const r="string"==typeof n?{name:n}:n,s=t(r.name),l=r.name,a={...r,name:l};e.set(s,a),o.set(l,a)}),l.attributeMap=e,l.propMap=o}class m extends c{}if(m[r]=l,a){if(e){const e=s.prototype,t=["connectedCallback","disconnectedCallback","attributeChangedCallback"];for(const o of t)Object.prototype.hasOwnProperty.call(e,o)&&console.error(`[${i}] 禁止重写 ${o}(),请使用框架钩子`)}customElements.define(i,m)}return m}};export{s as CustomElement};
@@ -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,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
+ "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 a(e,t,n){c(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 c(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 l(t,n){const r=i.get(n);if(r)for(const e of r.keys())c(n,e);for(let o=0;o<t.length;o++){const r=t[o];e.isObject(r)&&!p(r)&&a(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,n=new WeakMap)=>{if(Object.is(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;let r=n.get(e);if(r?.has(t))return!0;if(r||(r=new WeakSet,n.set(e,r)),r.add(t),Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(!g(e[r],t[r],n))return!1;return!0}if(Array.isArray(e)!==Array.isArray(t))return!1;const o=Reflect.ownKeys(e),i=Reflect.ownKeys(t);if(o.length!==i.length)return!1;for(const s of o){if(!Reflect.has(t,s))return!1;const r=e[s],o=t[s];if(!g(r,o,n))return!1}return!0},b=(e,t)=>{e.active&&(e.deepCompare&&("set"===t.type||"array-replace"===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)))},R=(e,t)=>{const n=[{node:e,relativePath:[],visited:new Set([e])}];let o=0;for(;o<n.length;){const{node:e,relativePath:i,visited:a}=n[o++],c=r.get(e);c&&c.forEach(e=>{if(!e.active)return;let n=i;if("set"===t.type||"delete"===t.type||"array-replace"===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 l=s.get(e);if(l)for(let t=l.length-1;t>=0;t--){const e=l[t],r=e.parentRef.deref();if(!r){l.splice(t,1);continue}if(a.has(r))continue;const o=new Set(a);o.add(r),n.push({node:r,relativePath:[e.key,...i],visited:o})}}},v={},w=(e,t)=>e[t];["push","pop","shift","unshift","splice"].forEach(t=>{v[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=w(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)&&a(r,String(t+o),m(n))}R(r,{type:"array-push",index:t,values:n})}else if("pop"===t)c(r,String(o-1)),R(r,{type:"array-splice",index:o-1,deleteCount:1,insert:[]});else if(l(i,r),"unshift"===t)R(r,{type:"array-push",index:0,values:n});else if("shift"===t)R(r,{type:"array-splice",index:0,deleteCount:1,insert:[]});else if("splice"===t){const[e,t,...o]=n;R(r,{type:"array-splice",index:e,deleteCount:t,insert:o})}return s}finally{o.set(r,s)}}}),["sort","reverse","fill","copyWithin"].forEach(e=>{v[e]=function(...t){const n=this,r=f(n),i=o.get(n)||0;o.set(n,i+1);try{const o=w(r,e).apply(r,t);return l(r,n),R(n,{type:"array-reset",method:e}),o}finally{o.set(n,i)}}}),["indexOf","lastIndexOf","includes"].forEach(e=>{v[e]=function(t,...n){const r=f(this),o=w(r,e);let i=o.apply(r,[t,...n]);return-1!==i&&!1!==i||!y(t)||(i=o.apply(r,[f(t),...n])),i}});const j={get(n,r,o){if(r===t)return n;if(Array.isArray(n)&&Object.prototype.hasOwnProperty.call(v,r))return Reflect.get(v,r,o);const s=Reflect.get(n,r,o);if("symbol"==typeof r)return s;if(e.isObject(s)&&!p(s)){const e=m(s),t=i.get(o)?.get(r);return t!==e&&a(o,r,e),e}return s},set(t,n,r,i){const s=Reflect.get(t,n,i),l=f(r);if(Object.is(s,l))return!0;const u=Reflect.set(t,n,l,i);return!!u&&(e.isObject(l)&&!p(l)?a(i,n,m(l)):c(i,n),0===(o.get(i)||0)&&(!Array.isArray(t)&&Array.isArray(s)&&Array.isArray(l)?R(i,{type:"array-replace",key:n,oldValue:s,newValue:l}):R(i,{type:"set",key:n,newValue:l,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&&(c(i,t),0===(o.get(i)||0)&&R(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:a=!1,deepCompare:c}=o,l={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 a=0;a<e.length;a++){const t=e[a];"*"===t&&"*"===e[a+1]?(n+="**",a++):"*"===t?n+="*":"."===t?n+=".":/[.*+?^${}()|[\]\\]/.test(t)?n+="\\"+t:n+=t}const r=n.split("."),o=[];for(let a=0;a<r.length;a++){const e=r[a];"**"===e?1===r.length?o.push(".*"):0===a?o.push("(?:[^.]+\\.)*"):o.push("(?:\\.[^.]+)*"):"*"===e?o.push("[^.]+"):o.push(e)}let i="^";for(let a=0;a<o.length;a++)if(i+=o[a],a<o.length-1){const e=o[a],t=o[a+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:c},u=m(t);let y=r.get(u);if(y||(y=new Set,r.set(u,y)),y.add(l),a){const n=[...y],r=(t,o,i=[],s=new WeakSet)=>{e.isObject(t)&&!s.has(t)&&(s.add(t),Reflect.ownKeys(t).forEach(a=>{const c=Reflect.get(t,a);if(e.isObject(c)&&s.has(c))return;const l=Reflect.get(o,a),f=[...i,a];n.forEach(e=>{d(f,e.filterRegexes)&&b(e,{type:"set",key:a,newValue:c,oldValue:void 0,path:f})}),e.isObject(c)&&!p(c)&&r(c,l,f,s)}))};r(f(t),u)}const g=()=>{const e=r.get(u);e&&(e.delete(l),0===e.size&&r.delete(u)),l.pending=[],l.timer&&(clearTimeout(l.timer),l.timer=null)};return{proxy:u,unobserve:()=>{l.active&&(l.active=!1,g())},resume:()=>{l.active||(l.active=!0,(()=>{let e=r.get(u);e||(e=new Set,r.set(u,e)),e.add(l)})())},dispose:()=>{if(!l.active)return l.callback=()=>{},void(l.onBatch=void 0);l.active=!1,g(),l.callback=()=>{},l.onBatch=void 0}}},exports.toProxy=function(e){return e&&"object"==typeof e&&"proxy"in e?e.proxy:e},exports.toRaw=f;
@@ -19,6 +19,7 @@ export type ChangePayload = {
19
19
  insert: unknown[];
20
20
  } | {
21
21
  type: 'array-replace';
22
+ key: PathKey;
22
23
  oldValue: unknown[];
23
24
  newValue: unknown[];
24
25
  } | {
@@ -1 +1 @@
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
+ 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 a(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 c(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(r)&&!p(r)&&a(n,String(o),A(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},R=(e,t,n=new WeakMap)=>{if(Object.is(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;let r=n.get(e);if(r?.has(t))return!0;if(r||(r=new WeakSet,n.set(e,r)),r.add(t),Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(!R(e[r],t[r],n))return!1;return!0}if(Array.isArray(e)!==Array.isArray(t))return!1;const o=Reflect.ownKeys(e),i=Reflect.ownKeys(t);if(o.length!==i.length)return!1;for(const s of o){if(!Reflect.has(t,s))return!1;const r=e[s],o=t[s];if(!R(r,o,n))return!1}return!0},b=(e,t)=>{e.active&&(e.deepCompare&&("set"===t.type||"array-replace"===t.type)&&R(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 o=0;for(;o<n.length;){const{node:e,relativePath:i,visited:a}=n[o++],l=r.get(e);l&&l.forEach(e=>{if(!e.active)return;let n=i;if("set"===t.type||"delete"===t.type||"array-replace"===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};b(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(a.has(r))continue;const o=new Set(a);o.add(r),n.push({node:r,relativePath:[e.key,...i],visited:o})}}},w={},v=(e,t)=>e[t];["push","pop","shift","unshift","splice"].forEach(t=>{w[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=v(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)&&a(r,String(t+o),A(n))}m(r,{type:"array-push",index:t,values:n})}else if("pop"===t)l(r,String(o-1)),m(r,{type:"array-splice",index:o-1,deleteCount:1,insert:[]});else if(c(i,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,...o]=n;m(r,{type:"array-splice",index:e,deleteCount:t,insert:o})}return s}finally{o.set(r,s)}}}),["sort","reverse","fill","copyWithin"].forEach(e=>{w[e]=function(...t){const n=this,r=f(n),i=o.get(n)||0;o.set(n,i+1);try{const o=v(r,e).apply(r,t);return c(r,n),m(n,{type:"array-reset",method:e}),o}finally{o.set(n,i)}}}),["indexOf","lastIndexOf","includes"].forEach(e=>{w[e]=function(t,...n){const r=f(this),o=v(r,e);let i=o.apply(r,[t,...n]);return-1!==i&&!1!==i||!y(t)||(i=o.apply(r,[f(t),...n])),i}});const k={get(n,r,o){if(r===t)return n;if(Array.isArray(n)&&Object.prototype.hasOwnProperty.call(w,r))return Reflect.get(w,r,o);const s=Reflect.get(n,r,o);if("symbol"==typeof r)return s;if(e(s)&&!p(s)){const e=A(s),t=i.get(o)?.get(r);return t!==e&&a(o,r,e),e}return s},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)?a(i,n,A(c)):l(i,n),0===(o.get(i)||0)&&(!Array.isArray(t)&&Array.isArray(s)&&Array.isArray(c)?m(i,{type:"array-replace",key:n,oldValue:s,newValue:c}):m(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&&(l(i,t),0===(o.get(i)||0)&&m(i,{type:"delete",key:t,oldValue:r}))}return i}};function A(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,k);return n.set(e,o),o}function x(t,n,o={}){const{throttle:i=0,onBatch:s,immediate:a=!1,deepCompare:l}=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 a=0;a<e.length;a++){const t=e[a];"*"===t&&"*"===e[a+1]?(n+="**",a++):"*"===t?n+="*":"."===t?n+=".":/[.*+?^${}()|[\]\\]/.test(t)?n+="\\"+t:n+=t}const r=n.split("."),o=[];for(let a=0;a<r.length;a++){const e=r[a];"**"===e?1===r.length?o.push(".*"):0===a?o.push("(?:[^.]+\\.)*"):o.push("(?:\\.[^.]+)*"):"*"===e?o.push("[^.]+"):o.push(e)}let i="^";for(let a=0;a<o.length;a++)if(i+=o[a],a<o.length-1){const e=o[a],t=o[a+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:l},u=A(t);let y=r.get(u);if(y||(y=new Set,r.set(u,y)),y.add(c),a){const n=[...y],r=(t,o,i=[],s=new WeakSet)=>{e(t)&&!s.has(t)&&(s.add(t),Reflect.ownKeys(t).forEach(a=>{const l=Reflect.get(t,a);if(e(l)&&s.has(l))return;const c=Reflect.get(o,a),f=[...i,a];n.forEach(e=>{g(f,e.filterRegexes)&&b(e,{type:"set",key:a,newValue:l,oldValue:void 0,path:f})}),e(l)&&!p(l)&&r(l,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,x as observe,h as toProxy,f as toRaw};
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});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;exports.default=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};
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e={amp:"&",lt:"<",gt:">",quot:'"',apos:"'",nbsp:" ",ensp:" ",emsp:" ",thinsp:" ",shy:"­",zwj:"‍",zwnj:"‌",hellip:"…",middot:"·",bull:"•",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",ldquo:"“",rdquo:"”",laquo:"«",raquo:"»",lsaquo:"‹",rsaquo:"›",dagger:"†",Dagger:"‡",prime:"′",Prime:"″",permil:"‰",cent:"¢",pound:"£",yen:"¥",euro:"€",curren:"¤",copy:"©",reg:"®",trade:"™",deg:"°",plusmn:"±",times:"×",divide:"÷",frac12:"½",frac14:"¼",frac34:"¾",sup1:"¹",sup2:"²",sup3:"³",micro:"µ",para:"¶",sect:"§",iexcl:"¡",iquest:"¿",minus:"−",le:"≤",ge:"≥",ne:"≠",asymp:"≈",equiv:"≡",infin:"∞",sum:"∑",radic:"√",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔"},r={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},t=/&(?:#([xX][0-9a-fA-F]+|\d+)|([a-zA-Z0-9]+));/g;exports.default=function(s){return s&&"string"==typeof s&&s.includes("&")?s.replace(t,(t,s,o)=>{if(o){if(Object.prototype.hasOwnProperty.call(e,o))return e[o];const r=o.toLowerCase();return Object.prototype.hasOwnProperty.call(e,r)?e[r]:t}if(s){const e="x"===s[0]||"X"===s[0];let o=parseInt(e?s.slice(1):s,e?16:10);return isNaN(o)?t:(o>=128&&o<=159&&(o=r[o]||o),0===o||o>=55296&&o<=57343||o>1114111?"�":String.fromCodePoint(o))}return t}):s};
@@ -1 +1 @@
1
- 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;function o(o){return o&&"string"==typeof o&&o.includes("&")?o.replace(r,(r,o,n)=>{if(n)return t[n.toLowerCase()]||r;if(o){const t="x"===o[0]||"X"===o[0];let n=parseInt(t?o.slice(1):o,t?16:10);return isNaN(n)?r:(n>=128&&n<=159&&(n=e[n]||n),0===n||n>=55296&&n<=57343||n>1114111?"�":String.fromCodePoint(n))}return r}):o}export{o as default};
1
+ const r={amp:"&",lt:"<",gt:">",quot:'"',apos:"'",nbsp:" ",ensp:" ",emsp:" ",thinsp:" ",shy:"­",zwj:"‍",zwnj:"‌",hellip:"…",middot:"·",bull:"•",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",ldquo:"“",rdquo:"”",laquo:"«",raquo:"»",lsaquo:"‹",rsaquo:"›",dagger:"†",Dagger:"‡",prime:"′",Prime:"″",permil:"‰",cent:"¢",pound:"£",yen:"¥",euro:"€",curren:"¤",copy:"©",reg:"®",trade:"™",deg:"°",plusmn:"±",times:"×",divide:"÷",frac12:"½",frac14:"¼",frac34:"¾",sup1:"¹",sup2:"²",sup3:"³",micro:"µ",para:"¶",sect:"§",iexcl:"¡",iquest:"¿",minus:"−",le:"≤",ge:"≥",ne:"≠",asymp:"≈",equiv:"≡",infin:"∞",sum:"∑",radic:"√",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔"},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},t=/&(?:#([xX][0-9a-fA-F]+|\d+)|([a-zA-Z0-9]+));/g;function a(a){return a&&"string"==typeof a&&a.includes("&")?a.replace(t,(t,a,s)=>{if(s){if(Object.prototype.hasOwnProperty.call(r,s))return r[s];const e=s.toLowerCase();return Object.prototype.hasOwnProperty.call(r,e)?r[e]:t}if(a){const r="x"===a[0]||"X"===a[0];let s=parseInt(r?a.slice(1):a,r?16:10);return isNaN(s)?t:(s>=128&&s<=159&&(s=e[s]||s),0===s||s>=55296&&s<=57343||s>1114111?"�":String.fromCodePoint(s))}return t}):a}export{a as default};
@@ -1 +1 @@
1
- "use strict";var e=Object.defineProperty,t=(t,s,n)=>((t,s,n)=>s in t?e(t,s,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[s]=n)(t,"symbol"!=typeof s?s+"":s,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("../../types/ast.cjs"),n=require("../../shared/templateError.cjs"),i=require("../../shared/env.cjs"),o=require("./html-decode.cjs"),r=/([^:;]+)\s*:\s*([^;]*\(.*?\)[^;]*|[^;]+)/g,a={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"},c=new Set(["data-","aria-","role","form"]),l=new Set(["value","selectedIndex"]),p=new WeakMap;function d(e){let t=p.get(e);return t||(t={loops:null,events:Object.create(null),prevClassObj:void 0,prevStyleObj:void 0},p.set(e,t)),t}function u(e,t){var s;const n=null==(s=t.a)?void 0:s.find(e=>"class"===e.k&&!e.d);(null==n?void 0:n.v)&&e.setAttribute("class",n.v)}function f(e,t){var s;if(!e.style)return;const n=null==(s=t.a)?void 0:s.find(e=>"style"===e.k&&!e.d),i=n?m(n.v):{};for(const o in i){const t=i[o];o.startsWith("--")?e.style.setProperty(o,t):e.style[o]=t}}const v=e=>!(!e||0===e.length||/\s/.test(e)&&(i.IS_DEV&&console.warn(`[Solely] Invalid class name "${e}" contains whitespace, will be ignored`),1));function m(e){const t={},s=[[e]];for(;s.length;){const[e,n]=s.pop()||[];if(e){if("string"==typeof e){let s;for(r.lastIndex=0;null!==(s=r.exec(e));){const e=s[1].trim(),n=s[2].trim();e&&n&&(t[e]=n)}continue}if(Array.isArray(e))for(let t=e.length-1;t>=0;t--)s.push([e[t]]);else if("object"==typeof e){const i=e;for(const e in i){const o=i[e];if(null==o)continue;const r=n?`${n}-${e}`:e;"object"!=typeof o||Array.isArray(o)?t[r]=String(o):s.push([o,r])}}}}return t}function y(e,t,s){const n=null==s?"":String(s),i=t.indexOf(":");if(i>0){const s=t.slice(0,i),o=a[s];if(o)return void(e.getAttributeNS(o,t)!==n&&e.setAttributeNS(o,t,n))}e.getAttribute(t)!==n&&e.setAttribute(t,n)}function g(e,t,s,n){const i=h[t]||t;if(t.startsWith("data-")||t.startsWith("aria-")||c.has(t))return void y(e,t,s);const o=e,r=o.tagName;if(null!=s){if("src"===i||"href"===i){const t=String(s);if(o[i]===t||e.getAttribute(i)===t)return}if("value"!==i||"INPUT"!==r&&"TEXTAREA"!==r||o.value!==s)if("boolean"!=typeof s)(n??(e instanceof SVGElement||void 0!==o.ownerSVGElement))&&!h[t]?y(e,t,s):o[i]!==s&&(o[i]=s);else{if(o[i]===s)return;o[i]=s}}else if("boolean"==typeof o[i])!1!==o[i]&&(o[i]=!1);else{const s=o[i];""!==s&&void 0!==s&&(o[i]=""),e.hasAttribute(t)&&e.removeAttribute(t)}}class N{constructor(e,s,n={}){t(this,"nodeMap",new Map),t(this,"prevNodeMap",new Map),t(this,"pathStack",[]),t(this,"pathKey",""),t(this,"staticSubtreeCache",new Map),t(this,"keepaliveCache",new Map),t(this,"currentKaKey",null),t(this,"kaDepth",0),t(this,"isKaRestoring",!1),t(this,"rafIds",new Set),t(this,"keepaliveAccessCounter",0),t(this,"maxKeepalive",20),t(this,"renderedKaKeys",new Set),this.ir=e,this.container=s,this.scope=n}scheduleRaf(e){const t=requestAnimationFrame(()=>{this.rafIds.delete(t),e()});return this.rafIds.add(t),t}pushPath(e){this.pathStack.push(e),this.pathKey=this.pathStack.join(".")}popPath(){this.pathStack.pop(),this.pathKey=this.pathStack.join(".")}evalIR(e,t,s){var o;const r=this.ir.fns[e-1];if(i.IS_DEV)try{return r?r.apply(this.scope,t):""}catch(a){return n.showTemplateError(a.message||a.toString(),(null==(o=this.ir.m)?void 0:o.src)||"",s,this.scope.tagName),""}return r?r.apply(this.scope,t):""}createElement(e,t){const s=e.g??"";return t instanceof SVGElement||"svg"===s?document.createElementNS("http://www.w3.org/2000/svg",s):document.createElement(s)}createText(e,t){const s=e.d?this.evalIR(e.f??-1,[t],e.__m):o.default(e.x||"");return document.createTextNode(s)}createComment(e,t){const s=e.d?this.evalIR(e.f??-1,[t],e.__m):e.x||"";return document.createComment(s)}removeEventListenersFromNode(e){const t=p.get(e);if(t)for(const[s,n]of Object.entries(t.events))n.listener&&e.removeEventListener(s,n.listener)}applyAttrs(e,t,s,n=!1,i=!1){const o=[],r=d(e),a=e instanceof SVGElement||void 0!==e.ownerSVGElement;let h;r.loops=s;let c,p=!1,u=!1;for(const d of t){const{k:t,f:f,d:v,v:m}=d;if(":class"===t){h=this.evalIR(f??-1,[s],d.__m),p=!0;continue}if(":style"===t){c=this.evalIR(f??-1,[s],d.__m),u=!0;continue}if("class"===t||"style"===t)continue;const N=t[0];if("@"===N){const s=t.slice(1),i=d.r??"user";let o=r.events[s];if(!o){o={model:[],user:[],listener:null};const t=e=>{for(const t of o.model)t(e);for(const t of o.user)t(e)};o.listener=t,e.addEventListener(s,t),r.events[s]=o}if(!n){const e=e=>this.evalIR(f??-1,[e,r.loops],d.__m);o[i].push(e)}continue}if("mounted"===t){n||i||this.scheduleRaf(()=>this.evalIR(f??-1,[e,s],d.__m));continue}if("activated"===t){i&&this.scheduleRaf(()=>this.evalIR(f??-1,[e,s],d.__m));continue}if("deactivated"===t)continue;if("updated"===t){n&&!i&&this.scheduleRaf(()=>this.evalIR(f??-1,[e,s],d.__m));continue}if("ref"===t&&m){this.scope.$refs=this.scope.$refs||{},this.scope.$refs[m]=e;continue}const S=v?this.evalIR(f??-1,[s],d.__m):m??"";if(":"===N){const s=t.slice(1);"SELECT"===e.tagName&&l.has(s)?o.push(()=>g(e,s,S,a)):g(e,s,S,a)}else n||y(e,t,String(S))}return p&&((e,t)=>{const s=d(e),n=s.prevClassObj,i=function(e){const t={},s=[e];for(;s.length;){const e=s.pop();if(e)if("string"==typeof e){const s=e.split(" ");for(let e=0;e<s.length;e++){const n=s[e].trim();n&&(t[n]=!0)}}else if(Array.isArray(e))for(let t=e.length-1;t>=0;t--)s.push(e[t]);else if("object"==typeof e){const s=e;for(const e in s)s[e]&&(t[e]=!0)}}return t}(t),o={};for(const h in i)v(h)&&(o[h]=i[h]);if(!n){const t=[];for(const e in o)t.push(e);return t.length&&e.classList.add(...t),void(s.prevClassObj=o)}const r=[],a=[];for(const h in n)o[h]||a.push(h);for(const h in o)n[h]||r.push(h);(r.length||a.length)&&(r.length&&e.classList.add(...r),a.length&&e.classList.remove(...a),s.prevClassObj=o)})(e,h),u&&((e,t)=>{const s=d(e),n=m(t),i=s.prevStyleObj;if(!i){for(const t in n){const s=n[t];t.startsWith("--")?e.style.setProperty(t,s):e.style[t]=s}return void(s.prevStyleObj=n)}let o=!1;for(const r in i)r in n||(r.startsWith("--")?e.style.removeProperty(r):e.style[r]="",o=!0);for(const r in n){const t=n[r];t!==i[r]&&(r.startsWith("--")?e.style.setProperty(r,t):e.style[r]=t,o=!0)}o&&(s.prevStyleObj=n)})(e,c),o}updateNode(e,t,s){const n=t.d?this.evalIR(t.f??-1,[s],t.__m):t.x||"";t.d&&e.textContent!==n&&(e.textContent=n)}createStaticSubtree(e,t,n){var i;switch(e.t){case s.ASTType.Element:{const s=this.createElement(e,t);u(s,e),f(s,e);const o=this.applyAttrs(s,e.a??[],n);return null==(i=e.c)||i.forEach(e=>{const t=this.createStaticSubtree(e,s,n);s.appendChild(t)}),o.forEach(e=>e()),s}case s.ASTType.Text:return this.createText(e,n);case s.ASTType.Comment:return this.createComment(e,n);default:return document.createComment("unknown")}}handleStaticSubtree(e,t,s,n){const i=this.staticSubtreeCache.get(t);if(i){const e=i.cloneNode(!0);return s.appendChild(e),e}const o=this.createStaticSubtree(e,s,n);return s.appendChild(o),this.staticSubtreeCache.set(t,o.cloneNode(!0)),o}currentKey(){return this.pathKey}findEntry(e){let t=this.nodeMap.get(e);return t||(t=this.prevNodeMap.get(e),t&&(this.prevNodeMap.delete(e),this.nodeMap.set(e,t))),t}registerNode(e,t,s,n){const i=this.currentKaKey?{irNode:t,node:s,loops:n,kaKey:this.currentKaKey}:{irNode:t,node:s,loops:n};this.nodeMap.set(e,i)}processNode(e,t,n){var o,r,a,h,c,l,p,d,v;const m=this.currentKey(),y=this.findEntry(m);let g;if(1!==e.s)if(y){g=y.node;let t=[];e.d&&(e.t===s.ASTType.Element?t=this.applyAttrs(g,e.a??[],n,!0,this.isKaRestoring):this.updateNode(g,e,n)),null==(o=e.c)||o.forEach((e,t)=>{this.pushPath(t),this.processNode(e,g,n),this.popPath()}),t.forEach(e=>e())}else switch(e.t){case s.ASTType.Element:g=this.createElement(e,t),u(g,e),f(g,e);const o=this.applyAttrs(g,e.a??[],n);t.appendChild(g),this.registerNode(m,e,g,n),null==(r=e.c)||r.forEach((e,t)=>{this.pushPath(t),this.processNode(e,g,n),this.popPath()}),o.forEach(e=>e());break;case s.ASTType.Text:g=this.createText(e,n),t.appendChild(g),this.registerNode(m,e,g,n);break;case s.ASTType.Comment:g=this.createComment(e,n),t.appendChild(g),this.registerNode(m,e,g,n);break;case s.ASTType.For:{this.pushPath(-1);const i=this.currentKey();this.popPath();let o=null==(a=this.findEntry(i))?void 0:a.node;o||(o=document.createComment("for"),t.appendChild(o),this.registerNode(i,{t:s.ASTType.Comment},o,n));const r=this.evalIR(e.f??-1,[n],e.__m)||[],c=document.createDocumentFragment();r.forEach((t,s)=>{var i;const o=[...n,{itmVal:t,idxVal:s}];null==(i=e.c)||i.forEach((e,t)=>{this.pushPath(s),this.pushPath(t),this.processNode(e,c,o),this.popPath(),this.popPath()})}),null==(h=o.parentNode)||h.insertBefore(c,o);break}case s.ASTType.Conditional:{this.pushPath(-1);const s=this.currentKey();this.popPath();let o=null==(c=this.findEntry(s))?void 0:c.node;o||(o=document.createComment("if"),t.appendChild(o),this.registerNode(s,{},o,n));for(let r=0;r<(e.b||[]).length;r++){const s=null==(l=e.b)?void 0:l[r];if(null===s.f||this.evalIR(s.f,[n],s.__m)){this.pushPath(r);const e=this.currentKey();if(this.popPath(),1===s.ka){this.renderedKaKeys.add(e);const a=this.keepaliveCache.get(e);if(a&&!a.active){null==(p=o.parentNode)||p.insertBefore(a.fragment,o);for(const[e,t]of a.entries)this.prevNodeMap.set(e,t);a.active=!0,a.lastUsed=++this.keepaliveAccessCounter;const h=this.isKaRestoring;this.isKaRestoring=!0;const c=this.currentKaKey;this.currentKaKey=e,this.kaDepth++,i.IS_DEV&&this.kaDepth>1&&console.warn("[Solely] Nested keepalive is not supported. Inner keepalive branches may not cache correctly."),s.c.forEach((e,s)=>{this.pushPath(r),this.pushPath(s),this.processNode(e,t,n),this.popPath(),this.popPath()}),this.kaDepth--,this.currentKaKey=c,this.isKaRestoring=h}else{a&&a.active&&(a.lastUsed=++this.keepaliveAccessCounter);const h=this.currentKaKey;this.currentKaKey=e,this.kaDepth++,i.IS_DEV&&this.kaDepth>1&&console.warn("[Solely] Nested keepalive is not supported. Inner keepalive branches may not cache correctly.");const c=e+".0";if(this.prevNodeMap.get(c))s.c.forEach((e,s)=>{this.pushPath(r),this.pushPath(s),this.processNode(e,t,n),this.popPath(),this.popPath()});else{const e=document.createDocumentFragment();s.c.forEach((t,s)=>{this.pushPath(r),this.pushPath(s),this.processNode(t,e,n),this.popPath(),this.popPath()}),null==(d=o.parentNode)||d.insertBefore(e,o)}this.kaDepth--,this.currentKaKey=h}}else{const e=document.createDocumentFragment();s.c.forEach((t,s)=>{this.pushPath(r),this.pushPath(s),this.processNode(t,e,n),this.popPath(),this.popPath()}),null==(v=o.parentNode)||v.insertBefore(e,o)}break}}break}}else y?g=y.node:(g=this.handleStaticSubtree(e,m,t,n),this.registerNode(m,e,g,n))}evictKeepaliveIfNeeded(){var e;let t=0;for(const[,i]of this.keepaliveCache.entries())i.active||t++;if(t<=this.maxKeepalive)return;let s=null,n=1/0;for(const[i,o]of this.keepaliveCache.entries())o.active||o.lastUsed<n&&(n=o.lastUsed,s=i);if(s){const t=this.keepaliveCache.get(s);for(const[,s]of t.entries){if(this.removeEventListenersFromNode(s.node),s.irNode.a){const e=s.irNode.a.find(e=>"unmounted"===e.k);e&&this.scheduleRaf(()=>{this.evalIR(e.f??-1,[s.node,s.loops],e.__m)})}null==(e=s.node)||e.remove()}this.keepaliveCache.delete(s)}}cleanupOldNodes(){const e=this.prevNodeMap,t=new Map;for(const[s,n]of e.entries()){const{irNode:e,node:i,loops:o}=n,r=n.kaKey&&this.renderedKaKeys.has(n.kaKey);if(e.a){if(n.kaKey&&!r){const t=e.a.find(e=>"deactivated"===e.k);t&&this.scheduleRaf(()=>this.evalIR(t.f??-1,[i,o],t.__m))}else{const t=e.a.find(e=>"unmounted"===e.k);t&&this.scheduleRaf(()=>this.evalIR(t.f??-1,[i,o],t.__m))}const t=e.a.find(e=>"ref"===e.k);t&&t.v&&delete this.scope.$refs[t.v]}if(n.kaKey&&!r&&i.parentNode){let e=t.get(n.kaKey);e||(e={fragment:document.createDocumentFragment(),entries:[]},t.set(n.kaKey,e));const o=n.kaKey.split(".").length;s.split(".").length===o+1&&e.fragment.appendChild(i),e.entries.push([s,n])}else this.removeEventListenersFromNode(i),null==i||i.remove()}for(const[s,n]of t.entries()){const e=this.keepaliveCache.get(s);e&&e.active?(e.fragment=n.fragment,e.entries=n.entries,e.active=!1,e.lastUsed=++this.keepaliveAccessCounter):e||this.keepaliveCache.set(s,{fragment:n.fragment,entries:n.entries,lastUsed:++this.keepaliveAccessCounter,active:!1})}this.evictKeepaliveIfNeeded(),e.clear()}mount(){this.renderedKaKeys.clear(),this.prevNodeMap=this.nodeMap,this.nodeMap=new Map,this.pathStack.length=0,this.pathKey="",this.ir.n.forEach((e,t)=>{this.irToNode(e,t,this.container,[])}),this.cleanupOldNodes()}update(){this.renderedKaKeys.clear(),this.prevNodeMap=this.nodeMap,this.nodeMap=new Map,this.pathStack.length=0,this.pathKey="",this.ir.n.forEach((e,t)=>{this.irToNode(e,t,this.container,[])}),this.cleanupOldNodes()}destroy(){var e;this.rafIds.forEach(e=>cancelAnimationFrame(e)),this.rafIds.clear();const t=e=>{for(const[,t]of e.entries())this.removeEventListenersFromNode(t.node)};t(this.nodeMap),t(this.prevNodeMap);for(const[,s]of this.keepaliveCache.entries())for(const[,t]of s.entries){if(this.removeEventListenersFromNode(t.node),t.irNode.a){const e=t.irNode.a.find(e=>"unmounted"===e.k);e&&this.evalIR(e.f??-1,[t.node,t.loops],e.__m)}null==(e=t.node)||e.remove()}this.container.innerHTML="",this.scope.$refs={},this.nodeMap.clear(),this.prevNodeMap.clear(),this.staticSubtreeCache.clear(),this.keepaliveCache.clear(),this.renderedKaKeys.clear()}irToNode(e,t,s,n){this.pushPath(t),this.processNode(e,s,n),this.popPath()}}exports.IRRenderer=N,exports.createRender=(e,t,s={})=>{const n=new N(e,t,s);return n.mount(),{update:()=>n.update(),destroy:()=>n.destroy()}};
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../types/ast.cjs"),t=require("../../shared/templateError.cjs"),s=require("../../shared/env.cjs"),n=require("./html-decode.cjs"),i=/([^:;]+)\s*:\s*([^;]*\(.*?\)[^;]*|[^;]+)/g,o={xml:"http://www.w3.org/XML/1998/namespace",xlink:"http://www.w3.org/1999/xlink",xmlns:"http://www.w3.org/2000/xmlns/"},r={readonly:"readOnly",for:"htmlFor",tabindex:"tabIndex",contenteditable:"contentEditable",maxlength:"maxLength"},a=new Set(["data-","aria-","role","form"]),c=new Set(["value","selectedIndex"]),h=new Set(["href","src","srcset","action","formaction","xlink:href","poster"]),l=new Set(["srcdoc"]),p=/^\s*(?:javascript|vbscript)\s*:|^\s*data:text\/html(?:[;,]|$)/i,d=new WeakMap;function f(e,t,n){if(!s.IS_DEV)return;let i=d.get(e);i||(i=new Set,d.set(e,i)),i.has(t)||(i.add(t),console.warn(n))}const u=new WeakMap;function m(e){let t=u.get(e);return t||(t={loops:null,events:Object.create(null),prevClassObj:void 0,prevStyleObj:void 0},u.set(e,t)),t}function v(e,t){const s=t.a?.find(e=>"class"===e.k&&!e.d);s?.v&&e.setAttribute("class",s.v)}function y(e,t){if(!e.style)return;const s=t.a?.find(e=>"style"===e.k&&!e.d),n=s?S(s.v):{};for(const i in n){const t=n[i];i.startsWith("--")?e.style.setProperty(i,t):e.style[i]=t}}const g=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 S(e){const t={},s=[[e]];for(;s.length;){const[e,n]=s.pop()||[];if(e){if("string"==typeof e){let s;for(i.lastIndex=0;null!==(s=i.exec(e));){const e=s[1].trim(),n=s[2].trim();e&&n&&(t[e]=n)}continue}if(Array.isArray(e))for(let t=e.length-1;t>=0;t--)s.push([e[t]]);else if("object"==typeof e){const i=e;for(const e in i){const o=i[e];if(null==o)continue;const r=n?`${n}-${e}`:e;"object"!=typeof o||Array.isArray(o)?t[r]=String(o):s.push([o,r])}}}}return t}function k(e,t,s){const n=null==s?"":String(s),i=t.indexOf(":");if(i>0){const s=t.slice(0,i),r=o[s];if(r)return void(e.getAttributeNS(r,t)!==n&&e.setAttributeNS(r,t,n))}e.getAttribute(t)!==n&&e.setAttribute(t,n)}function N(e,t,s,n){const i=r[t]||t;if(t.startsWith("data-")||t.startsWith("aria-")||a.has(t))return void k(e,t,s);if(l.has(t)&&null!=s)return void function(e,t){f(e,`srcdoc:${String(t)}`,'[Solely] Blocked "srcdoc" binding (HTML injection risk). Use a sandboxed iframe with "src" instead.')}(e,s);if((h.has(t)||h.has(i))&&function(e){return"string"==typeof e&&p.test(e.replace(/\s+/g,""))}(s))return void function(e,t,s){f(e,`${t}:${String(s)}`,`[Solely] Blocked unsafe URL for "${t}": ${String(s).slice(0,80)}. Use a http(s)/relative URL instead.`)}(e,t,s);const o=e,c=o.tagName;if(null!=s){if("src"===i||"href"===i){const t=String(s);if(o[i]===t||e.getAttribute(i)===t)return}if("value"!==i||"INPUT"!==c&&"TEXTAREA"!==c||o.value!==s)if("boolean"!=typeof s)(n??(e instanceof SVGElement||void 0!==o.ownerSVGElement))&&!r[t]?k(e,t,s):o[i]!==s&&(o[i]=s);else{if(o[i]===s)return;o[i]=s}}else if("boolean"==typeof o[i])!1!==o[i]&&(o[i]=!1);else{const s=o[i];""!==s&&void 0!==s&&(o[i]=""),e.hasAttribute(t)&&e.removeAttribute(t)}}class K{constructor(e,t,s={}){this.ir=e,this.container=t,this.scope=s}ir;container;scope;nodeMap=new Map;prevNodeMap=new Map;pathStack=[];pathKey="";staticSubtreeCache=new Map;keepaliveCache=new Map;currentKaKey=null;kaDepth=0;isKaRestoring=!1;rafIds=new Set;keepaliveAccessCounter=0;maxKeepalive=20;renderedKaKeys=new Set;scheduleRaf(e){const t=requestAnimationFrame(()=>{this.rafIds.delete(t),e()});return this.rafIds.add(t),t}pushPath(e){this.pathStack.push(e),this.pathKey=this.pathStack.join(".")}popPath(){this.pathStack.pop(),this.pathKey=this.pathStack.join(".")}evalIR(e,n,i){const o=this.ir.fns[e-1];if(s.IS_DEV)try{return o?o.apply(this.scope,n):""}catch(r){return t.showTemplateError(r.message||r.toString(),this.ir.m?.src||"",i,this.scope.tagName),""}return o?o.apply(this.scope,n):""}createElement(e,t){const s=e.g??"";return t instanceof SVGElement||"svg"===s?document.createElementNS("http://www.w3.org/2000/svg",s):document.createElement(s)}createText(e,t){const s=e.d?this.evalIR(e.f??-1,[t],e.__m):n.default(e.x||"");return document.createTextNode(s)}createComment(e,t){const s=e.d?this.evalIR(e.f??-1,[t],e.__m):e.x||"";return document.createComment(s)}removeEventListenersFromNode(e){const t=u.get(e);if(t)for(const[s,n]of Object.entries(t.events))n.listener&&e.removeEventListener(s,n.listener)}applyAttrs(e,t,s,n=!1,i=!1){const o=[],r=m(e),a=e instanceof SVGElement||void 0!==e.ownerSVGElement;let h;r.loops=s;let l,p=!1,d=!1;for(const f of t){const{k:t,f:u,d:m,v:v}=f;if(":class"===t){h=this.evalIR(u??-1,[s],f.__m),p=!0;continue}if(":style"===t){l=this.evalIR(u??-1,[s],f.__m),d=!0;continue}if("class"===t||"style"===t)continue;const y=t[0];if("@"===y){const s=t.slice(1),i=f.r??"user";let o=r.events[s];if(!o){o={model:[],user:[],listener:null};const t=e=>{for(const t of o.model)t(e);for(const t of o.user)t(e)};o.listener=t,e.addEventListener(s,t),r.events[s]=o}if(!n){const e=e=>this.evalIR(u??-1,[e,r.loops],f.__m);o[i].push(e)}continue}if("mounted"===t){n||i||this.scheduleRaf(()=>this.evalIR(u??-1,[e,s],f.__m));continue}if("activated"===t){i&&this.scheduleRaf(()=>this.evalIR(u??-1,[e,s],f.__m));continue}if("deactivated"===t)continue;if("updated"===t){n&&!i&&this.scheduleRaf(()=>this.evalIR(u??-1,[e,s],f.__m));continue}if("ref"===t&&v){this.scope.$refs=this.scope.$refs||{},this.scope.$refs[v]=e;continue}const g=m?this.evalIR(u??-1,[s],f.__m):v??"";if(":"===y){const s=t.slice(1);"SELECT"===e.tagName&&c.has(s)?o.push(()=>N(e,s,g,a)):N(e,s,g,a)}else n||k(e,t,String(g))}return p&&((e,t)=>{const s=m(e),n=s.prevClassObj,i=function(e){const t={},s=[e];for(;s.length;){const e=s.pop();if(e)if("string"==typeof e){const s=e.split(" ");for(let e=0;e<s.length;e++){const n=s[e].trim();n&&(t[n]=!0)}}else if(Array.isArray(e))for(let t=e.length-1;t>=0;t--)s.push(e[t]);else if("object"==typeof e){const s=e;for(const e in s)s[e]&&(t[e]=!0)}}return t}(t),o={};for(const c in i)g(c)&&(o[c]=i[c]);if(!n){const t=[];for(const e in o)t.push(e);return t.length&&e.classList.add(...t),void(s.prevClassObj=o)}const r=[],a=[];for(const c in n)o[c]||a.push(c);for(const c in o)n[c]||r.push(c);(r.length||a.length)&&(r.length&&e.classList.add(...r),a.length&&e.classList.remove(...a),s.prevClassObj=o)})(e,h),d&&((e,t)=>{const s=m(e),n=S(t),i=s.prevStyleObj;if(!i){for(const t in n){const s=n[t];t.startsWith("--")?e.style.setProperty(t,s):e.style[t]=s}return void(s.prevStyleObj=n)}let o=!1;for(const r in i)r in n||(r.startsWith("--")?e.style.removeProperty(r):e.style[r]="",o=!0);for(const r in n){const t=n[r];t!==i[r]&&(r.startsWith("--")?e.style.setProperty(r,t):e.style[r]=t,o=!0)}o&&(s.prevStyleObj=n)})(e,l),o}updateNode(e,t,s){const n=t.d?this.evalIR(t.f??-1,[s],t.__m):t.x||"";t.d&&e.textContent!==n&&(e.textContent=n)}createStaticSubtree(t,s,n){switch(t.t){case e.ASTType.Element:{const e=this.createElement(t,s);v(e,t),y(e,t);const i=this.applyAttrs(e,t.a??[],n);return t.c?.forEach(t=>{const s=this.createStaticSubtree(t,e,n);e.appendChild(s)}),i.forEach(e=>e()),e}case e.ASTType.Text:return this.createText(t,n);case e.ASTType.Comment:return this.createComment(t,n);default:return document.createComment("unknown")}}handleStaticSubtree(e,t,s,n){const i=this.staticSubtreeCache.get(t);if(i){const e=i.cloneNode(!0);return s.appendChild(e),e}const o=this.createStaticSubtree(e,s,n);return s.appendChild(o),this.staticSubtreeCache.set(t,o.cloneNode(!0)),o}currentKey(){return this.pathKey}findEntry(e){let t=this.nodeMap.get(e);return t||(t=this.prevNodeMap.get(e),t&&(this.prevNodeMap.delete(e),this.nodeMap.set(e,t))),t}registerNode(e,t,s,n){const i=this.currentKaKey?{irNode:t,node:s,loops:n,kaKey:this.currentKaKey}:{irNode:t,node:s,loops:n};this.nodeMap.set(e,i)}processNode(t,n,i){const o=this.currentKey(),r=this.findEntry(o);let a;if(1!==t.s)if(r){a=r.node;let s=[];t.d&&(t.t===e.ASTType.Element?s=this.applyAttrs(a,t.a??[],i,!0,this.isKaRestoring):this.updateNode(a,t,i)),t.c?.forEach((e,t)=>{this.pushPath(t),this.processNode(e,a,i),this.popPath()}),s.forEach(e=>e())}else switch(t.t){case e.ASTType.Element:a=this.createElement(t,n),v(a,t),y(a,t);const r=this.applyAttrs(a,t.a??[],i);n.appendChild(a),this.registerNode(o,t,a,i),t.c?.forEach((e,t)=>{this.pushPath(t),this.processNode(e,a,i),this.popPath()}),r.forEach(e=>e());break;case e.ASTType.Text:a=this.createText(t,i),n.appendChild(a),this.registerNode(o,t,a,i);break;case e.ASTType.Comment:a=this.createComment(t,i),n.appendChild(a),this.registerNode(o,t,a,i);break;case e.ASTType.For:{this.pushPath(-1);const s=this.currentKey();this.popPath();let o=this.findEntry(s)?.node;o||(o=document.createComment("for"),n.appendChild(o),this.registerNode(s,{t:e.ASTType.Comment},o,i));const r=this.evalIR(t.f??-1,[i],t.__m)||[],a=document.createDocumentFragment();r.forEach((e,s)=>{const n=[...i,{itmVal:e,idxVal:s}];t.c?.forEach((e,t)=>{this.pushPath(s),this.pushPath(t),this.processNode(e,a,n),this.popPath(),this.popPath()})}),o.parentNode?.insertBefore(a,o);break}case e.ASTType.Conditional:{this.pushPath(-1);const e=this.currentKey();this.popPath();let o=this.findEntry(e)?.node;o||(o=document.createComment("if"),n.appendChild(o),this.registerNode(e,{},o,i));for(let r=0;r<(t.b||[]).length;r++){const e=t.b?.[r];if(null===e.f||this.evalIR(e.f,[i],e.__m)){this.pushPath(r);const t=this.currentKey();if(this.popPath(),1===e.ka){this.renderedKaKeys.add(t);const a=this.keepaliveCache.get(t);if(a&&!a.active){o.parentNode?.insertBefore(a.fragment,o);for(const[e,t]of a.entries)this.prevNodeMap.set(e,t);a.active=!0,a.lastUsed=++this.keepaliveAccessCounter;const c=this.isKaRestoring;this.isKaRestoring=!0;const h=this.currentKaKey;this.currentKaKey=t,this.kaDepth++,s.IS_DEV&&this.kaDepth>1&&console.warn("[Solely] Nested keepalive is not supported. Inner keepalive branches may not cache correctly."),e.c.forEach((e,t)=>{this.pushPath(r),this.pushPath(t),this.processNode(e,n,i),this.popPath(),this.popPath()}),this.kaDepth--,this.currentKaKey=h,this.isKaRestoring=c}else{a&&a.active&&(a.lastUsed=++this.keepaliveAccessCounter);const c=this.currentKaKey;this.currentKaKey=t,this.kaDepth++,s.IS_DEV&&this.kaDepth>1&&console.warn("[Solely] Nested keepalive is not supported. Inner keepalive branches may not cache correctly.");const h=t+".0";if(this.prevNodeMap.get(h))e.c.forEach((e,t)=>{this.pushPath(r),this.pushPath(t),this.processNode(e,n,i),this.popPath(),this.popPath()});else{const t=document.createDocumentFragment();e.c.forEach((e,s)=>{this.pushPath(r),this.pushPath(s),this.processNode(e,t,i),this.popPath(),this.popPath()}),o.parentNode?.insertBefore(t,o)}this.kaDepth--,this.currentKaKey=c}}else{const t=document.createDocumentFragment();e.c.forEach((e,s)=>{this.pushPath(r),this.pushPath(s),this.processNode(e,t,i),this.popPath(),this.popPath()}),o.parentNode?.insertBefore(t,o)}break}}break}}else r?a=r.node:(a=this.handleStaticSubtree(t,o,n,i),this.registerNode(o,t,a,i))}evictKeepaliveIfNeeded(){let e=0;for(const[,n]of this.keepaliveCache.entries())n.active||e++;if(e<=this.maxKeepalive)return;let t=null,s=1/0;for(const[n,i]of this.keepaliveCache.entries())i.active||i.lastUsed<s&&(s=i.lastUsed,t=n);if(t){const e=this.keepaliveCache.get(t);for(const[,t]of e.entries){if(this.removeEventListenersFromNode(t.node),t.irNode.a){const e=t.irNode.a.find(e=>"unmounted"===e.k);e&&this.scheduleRaf(()=>{this.evalIR(e.f??-1,[t.node,t.loops],e.__m)})}t.node?.remove()}this.keepaliveCache.delete(t)}}cleanupOldNodes(){const e=this.prevNodeMap,t=new Map;for(const[s,n]of e.entries()){const{irNode:e,node:i,loops:o}=n,r=n.kaKey&&this.renderedKaKeys.has(n.kaKey);if(e.a){if(n.kaKey&&!r){const t=e.a.find(e=>"deactivated"===e.k);t&&this.scheduleRaf(()=>this.evalIR(t.f??-1,[i,o],t.__m))}else{const t=e.a.find(e=>"unmounted"===e.k);t&&this.scheduleRaf(()=>this.evalIR(t.f??-1,[i,o],t.__m))}const t=e.a.find(e=>"ref"===e.k);t&&t.v&&delete this.scope.$refs[t.v]}if(n.kaKey&&!r&&i.parentNode){let e=t.get(n.kaKey);e||(e={fragment:document.createDocumentFragment(),entries:[]},t.set(n.kaKey,e));const o=n.kaKey.split(".").length;s.split(".").length===o+1&&e.fragment.appendChild(i),e.entries.push([s,n])}else this.removeEventListenersFromNode(i),i?.remove()}for(const[s,n]of t.entries()){const e=this.keepaliveCache.get(s);e&&e.active?(e.fragment=n.fragment,e.entries=n.entries,e.active=!1,e.lastUsed=++this.keepaliveAccessCounter):e||this.keepaliveCache.set(s,{fragment:n.fragment,entries:n.entries,lastUsed:++this.keepaliveAccessCounter,active:!1})}this.evictKeepaliveIfNeeded(),e.clear()}mount(){this.renderedKaKeys.clear(),this.prevNodeMap=this.nodeMap,this.nodeMap=new Map,this.pathStack.length=0,this.pathKey="",this.ir.n.forEach((e,t)=>{this.irToNode(e,t,this.container,[])}),this.cleanupOldNodes()}update(){this.renderedKaKeys.clear(),this.prevNodeMap=this.nodeMap,this.nodeMap=new Map,this.pathStack.length=0,this.pathKey="",this.ir.n.forEach((e,t)=>{this.irToNode(e,t,this.container,[])}),this.cleanupOldNodes()}destroy(){this.rafIds.forEach(e=>cancelAnimationFrame(e)),this.rafIds.clear();const e=e=>{for(const[,t]of e.entries())this.removeEventListenersFromNode(t.node)};e(this.nodeMap),e(this.prevNodeMap);for(const[,t]of this.keepaliveCache.entries())for(const[,e]of t.entries){if(this.removeEventListenersFromNode(e.node),e.irNode.a){const t=e.irNode.a.find(e=>"unmounted"===e.k);t&&this.evalIR(t.f??-1,[e.node,e.loops],t.__m)}e.node?.remove()}this.container.innerHTML="",this.scope.$refs={},this.nodeMap.clear(),this.prevNodeMap.clear(),this.staticSubtreeCache.clear(),this.keepaliveCache.clear(),this.renderedKaKeys.clear()}irToNode(e,t,s,n){this.pushPath(t),this.processNode(e,s,n),this.popPath()}}exports.IRRenderer=K,exports.createRender=(e,t,s={})=>{const n=new K(e,t,s);return n.mount(),{update:()=>n.update(),destroy:()=>n.destroy()}};