@lytjs/core 4.0.4 → 4.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/error-entry.cjs +1 -1
- package/dist/error-entry.mjs +1 -1
- package/dist/index.cjs +1 -2
- package/dist/index.mjs +1 -2
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/types/create-app.d.ts.map +1 -1
- package/dist/types/error-handling.d.ts +4 -0
- package/dist/types/error-handling.d.ts.map +1 -1
- package/dist/types/index.d.ts +0 -4
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/warn.d.ts +27 -3
- package/dist/types/warn.d.ts.map +1 -1
- package/dist/web-component-entry.cjs +2 -2
- package/dist/web-component-entry.mjs +2 -2
- package/package.json +7 -7
package/dist/error-entry.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var I=Object.defineProperty;var P=Object.getOwnPropertyDescriptor;var
|
|
1
|
+
var I=Object.defineProperty;var P=Object.getOwnPropertyDescriptor;var h=Object.getOwnPropertyNames;var y=Object.prototype.hasOwnProperty;var d=(r,o)=>{for(var t in o)I(r,t,{get:o[t],enumerable:!0})},M=(r,o,t,i)=>{if(o&&typeof o=="object"||typeof o=="function")for(let s of h(o))!y.call(r,s)&&s!==t&&I(r,s,{get:()=>o[s],enumerable:!(i=P(o,s))||i.enumerable});return r};var m=r=>M(I({},"__esModule",{value:!0}),r);var V={};d(V,{ErrorBoundary:()=>R,ErrorCategory:()=>n.ErrorCategory,LytError:()=>a,LytErrorCodes:()=>N,NewLytError:()=>E.LytError,NewLytErrorCodes:()=>n.LytErrorCodes,callWithErrorHandling:()=>C,createCompilerError:()=>E.createCompilerError,createComponentError:()=>E.createComponentError,createMessage:()=>L,createRendererError:()=>E.createRendererError,getCategory:()=>n.getCategory,getDevMode:()=>u,getErrorMessage:()=>n.getErrorMessage,handleError:()=>c,resetWarnedMessages:()=>g,setDevMode:()=>f,warn:()=>l,warnOnce:()=>A,warnOnceUtil:()=>A,warnUtil:()=>l});module.exports=m(V);var N=(e=>(e[e.INVALID_ARGUMENT=1001]="INVALID_ARGUMENT",e[e.NOT_FOUND=1002]="NOT_FOUND",e[e.ALREADY_EXISTS=1003]="ALREADY_EXISTS",e[e.OPERATION_FAILED=1004]="OPERATION_FAILED",e[e.REACTIVE_READONLY=2001]="REACTIVE_READONLY",e[e.REACTIVE_EFFECT_DISPOSED=2002]="REACTIVE_EFFECT_DISPOSED",e[e.COMPUTED_CYCLE=2003]="COMPUTED_CYCLE",e[e.PARSE_ERROR=3001]="PARSE_ERROR",e[e.INVALID_EXPRESSION=3002]="INVALID_EXPRESSION",e[e.INVALID_DIRECTIVE=3003]="INVALID_DIRECTIVE",e[e.INVALID_TEMPLATE=3004]="INVALID_TEMPLATE",e[e.RENDER_ERROR=4001]="RENDER_ERROR",e[e.HYDRATION_MISMATCH=4002]="HYDRATION_MISMATCH",e[e.INVALID_VNODE=4003]="INVALID_VNODE",e[e.COMPONENT_INVALID_PROPS=5001]="COMPONENT_INVALID_PROPS",e[e.COMPONENT_MISSING_TEMPLATE=5002]="COMPONENT_MISSING_TEMPLATE",e[e.COMPONENT_LIFECYCLE_ERROR=5003]="COMPONENT_LIFECYCLE_ERROR",e[e.ROUTE_NOT_FOUND=6001]="ROUTE_NOT_FOUND",e[e.ROUTE_DUPLICATE=6002]="ROUTE_DUPLICATE",e[e.NAVIGATION_ABORTED=6003]="NAVIGATION_ABORTED",e[e.NAVIGATION_FAILED=6004]="NAVIGATION_FAILED",e[e.STORE_NOT_FOUND=7001]="STORE_NOT_FOUND",e[e.STORE_DUPLICATE=7002]="STORE_DUPLICATE",e))(N||{});var a=class extends Error{constructor(o,t,i){let s=`[Lyt ${o}] ${t}`;super(s),this.name="LytError",this.code=o,this.details=i}};var _=class _{constructor(o){this.errors=[],this.options=o||{},this._hasError=!1}get hasError(){return this._hasError}static setGlobalHandler(o){_.globalHandler=o}capture(o,t,i){var p;let s={error:o,vm:t,info:i||"",timestamp:Date.now()};this.errors.push(s),this._hasError=!0;let D=(p=this.options.maxErrors)!=null?p:100;this.errors.length>D&&this.errors.splice(0,this.errors.length-D),!(this.options.onErrorCaptured&&this.options.onErrorCaptured(o instanceof a?o:new a(1004,o.message),t,s.info)===!0)&&this.options.onError&&this.options.onError(o instanceof a?o:new a(1004,o.message),t)}getFallback(o){if(!this.options.fallback||this.errors.length===0)return null;let t=this.errors[this.errors.length-1];return this.options.fallback(t.error,t.vm,t.info)}getErrors(){return this.errors.slice()}getErrorCount(){return this.errors.length}getLastErrors(){return this.errors.length===0?null:{...this.errors[this.errors.length-1]}}clear(){this.errors=[],this._hasError=!1}};_.globalHandler=null;var R=_,O=!0,T=new Set;function f(r){O=r}function u(){return O}function l(r){if(!O)return;let o=console.warn;typeof o=="function"&&o(`[Lyt warn] ${r}`)}function A(r){if(!O||T.has(r))return;T.add(r);let o=console.warn;typeof o=="function"&&o(`[Lyt warn] ${r}`)}function g(){T.clear()}var S={1001:r=>`\u53C2\u6570 "${r}" \u65E0\u6548\u3002\u8BF7\u68C0\u67E5\u4F20\u5165\u7684\u503C\u7C7B\u578B\u548C\u8303\u56F4\u3002`,1002:r=>`"${r}" \u672A\u627E\u5230\u3002\u8BF7\u786E\u8BA4\u8D44\u6E90\u540D\u79F0\u6216\u8DEF\u5F84\u662F\u5426\u6B63\u786E\u3002`,1003:r=>`"${r}" \u5DF2\u5B58\u5728\u3002\u8BF7\u4F7F\u7528\u4E0D\u540C\u7684\u540D\u79F0\u3002`,1004:r=>`\u64CD\u4F5C "${r}" \u6267\u884C\u5931\u8D25\u3002\u8BF7\u68C0\u67E5\u76F8\u5173\u914D\u7F6E\u548C\u72B6\u6001\u3002`,2001:r=>`\u65E0\u6CD5\u4FEE\u6539\u53EA\u8BFB\u54CD\u5E94\u5F0F\u5C5E\u6027 "${r}"\u3002\u53EA\u8BFB\u5BF9\u8C61\u4E0D\u5141\u8BB8\u76F4\u63A5\u8D4B\u503C\u3002`,2002:()=>"\u526F\u4F5C\u7528\u51FD\u6570\u5DF2\u88AB\u9500\u6BC1\uFF0C\u65E0\u6CD5\u518D\u6B21\u6267\u884C\u3002\u8BF7\u521B\u5EFA\u65B0\u7684\u526F\u4F5C\u7528\u3002",2003:()=>"\u8BA1\u7B97\u5C5E\u6027\u68C0\u6D4B\u5230\u5FAA\u73AF\u4F9D\u8D56\u3002\u8BF7\u68C0\u67E5 computed \u51FD\u6570\u662F\u5426\u5F15\u7528\u4E86\u81EA\u8EAB\u3002",3001:r=>`\u6A21\u677F\u89E3\u6790\u9519\u8BEF\uFF1A${r}\u3002\u8BF7\u68C0\u67E5\u6A21\u677F\u8BED\u6CD5\u662F\u5426\u6B63\u786E\u3002`,3002:r=>`\u65E0\u6548\u7684\u8868\u8FBE\u5F0F "${r}"\u3002\u8BF7\u68C0\u67E5\u8868\u8FBE\u5F0F\u8BED\u6CD5\u3002`,3003:r=>`\u65E0\u6548\u7684\u6307\u4EE4 "${r}"\u3002\u8BF7\u786E\u8BA4\u6307\u4EE4\u540D\u79F0\u662F\u5426\u6B63\u786E\u3002`,3004:r=>`\u65E0\u6548\u7684\u6A21\u677F\uFF1A${r}\u3002\u8BF7\u68C0\u67E5\u6A21\u677F\u5185\u5BB9\u3002`,4001:r=>`\u6E32\u67D3\u9519\u8BEF\uFF1A${r}\u3002\u8BF7\u68C0\u67E5\u7EC4\u4EF6\u7684 render \u51FD\u6570\u6216\u6A21\u677F\u3002`,4002:r=>`\u6C34\u5408\u4E0D\u5339\u914D\uFF1A${r}\u3002\u670D\u52A1\u7AEF\u6E32\u67D3\u4E0E\u5BA2\u6237\u7AEF\u6E32\u67D3\u7ED3\u679C\u4E0D\u4E00\u81F4\u3002`,4003:r=>`\u65E0\u6548\u7684\u865A\u62DF\u8282\u70B9\uFF1A${r}\u3002VNode \u7F3A\u5C11\u5FC5\u8981\u7684 type \u6216\u5176\u4ED6\u5C5E\u6027\u3002`,5001:r=>`\u7EC4\u4EF6\u5C5E\u6027\u65E0\u6548\uFF1A${r}\u3002\u8BF7\u68C0\u67E5\u4F20\u5165\u7684 props \u662F\u5426\u7B26\u5408\u7EC4\u4EF6\u5B9A\u4E49\u3002`,5002:r=>`\u7EC4\u4EF6 "${r}" \u7F3A\u5C11 template \u6216 render \u51FD\u6570\u3002\u8BF7\u786E\u4FDD\u7EC4\u4EF6\u5B9A\u4E49\u4E2D\u5305\u542B template \u5B57\u7B26\u4E32\u6216 render \u65B9\u6CD5\u3002`,5003:r=>`\u7EC4\u4EF6\u751F\u547D\u5468\u671F\u9519\u8BEF\uFF1A${r}\u3002\u8BF7\u68C0\u67E5\u751F\u547D\u5468\u671F\u94A9\u5B50\u51FD\u6570\u3002`,6001:r=>`\u8DEF\u7531 "${r}" \u672A\u627E\u5230\u3002\u8BF7\u786E\u8BA4\u8DEF\u7531\u8DEF\u5F84\u662F\u5426\u5DF2\u6CE8\u518C\u3002`,6002:r=>`\u8DEF\u7531 "${r}" \u5DF2\u5B58\u5728\u3002\u8BF7\u907F\u514D\u91CD\u590D\u6CE8\u518C\u76F8\u540C\u7684\u8DEF\u7531\u8DEF\u5F84\u3002`,6003:r=>`\u5BFC\u822A\u88AB\u4E2D\u6B62\uFF1A${r}\u3002\u53EF\u80FD\u88AB\u5BFC\u822A\u5B88\u536B\u62E6\u622A\u3002`,6004:r=>`\u5BFC\u822A\u5931\u8D25\uFF1A${r}\u3002\u8BF7\u68C0\u67E5\u76EE\u6807\u8DEF\u7531\u662F\u5426\u6709\u6548\u3002`,7001:r=>`Store "${r}" \u672A\u627E\u5230\u3002\u8BF7\u786E\u8BA4 store \u662F\u5426\u5DF2\u6CE8\u518C\u3002`,7002:r=>`Store "${r}" \u5DF2\u5B58\u5728\u3002\u8BF7\u907F\u514D\u91CD\u590D\u521B\u5EFA\u76F8\u540C ID \u7684 store\u3002`};function L(r,...o){let t=S[r];if(t){let i=t(...o);return`[Lyt ${r}] ${i}`}return`[Lyt ${r}] \u672A\u77E5\u9519\u8BEF\u3002`}function c(r,o,t){R.globalHandler&&R.globalHandler(r,o,t||""),O&&r instanceof a&&r.details}function C(r,o){try{return r()}catch(t){c(t instanceof Error?t:new Error(String(t)),o);return}}var n=require("@lytjs/common");var E=require("@lytjs/common");
|
package/dist/error-entry.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var T=(e=>(e[e.INVALID_ARGUMENT=1001]="INVALID_ARGUMENT",e[e.NOT_FOUND=1002]="NOT_FOUND",e[e.ALREADY_EXISTS=1003]="ALREADY_EXISTS",e[e.OPERATION_FAILED=1004]="OPERATION_FAILED",e[e.REACTIVE_READONLY=2001]="REACTIVE_READONLY",e[e.REACTIVE_EFFECT_DISPOSED=2002]="REACTIVE_EFFECT_DISPOSED",e[e.COMPUTED_CYCLE=2003]="COMPUTED_CYCLE",e[e.PARSE_ERROR=3001]="PARSE_ERROR",e[e.INVALID_EXPRESSION=3002]="INVALID_EXPRESSION",e[e.INVALID_DIRECTIVE=3003]="INVALID_DIRECTIVE",e[e.INVALID_TEMPLATE=3004]="INVALID_TEMPLATE",e[e.RENDER_ERROR=4001]="RENDER_ERROR",e[e.HYDRATION_MISMATCH=4002]="HYDRATION_MISMATCH",e[e.INVALID_VNODE=4003]="INVALID_VNODE",e[e.COMPONENT_INVALID_PROPS=5001]="COMPONENT_INVALID_PROPS",e[e.COMPONENT_MISSING_TEMPLATE=5002]="COMPONENT_MISSING_TEMPLATE",e[e.COMPONENT_LIFECYCLE_ERROR=5003]="COMPONENT_LIFECYCLE_ERROR",e[e.ROUTE_NOT_FOUND=6001]="ROUTE_NOT_FOUND",e[e.ROUTE_DUPLICATE=6002]="ROUTE_DUPLICATE",e[e.NAVIGATION_ABORTED=6003]="NAVIGATION_ABORTED",e[e.NAVIGATION_FAILED=6004]="NAVIGATION_FAILED",e[e.STORE_NOT_FOUND=7001]="STORE_NOT_FOUND",e[e.STORE_DUPLICATE=7002]="STORE_DUPLICATE",e))(T||{});var n=class extends Error{constructor(o,t,E){let i=`[Lyt ${o}] ${t}`;super(i),this.name="LytError",this.code=o,this.details=E}};var R=class R{constructor(o){this.errors=[],this.options=o||{},this._hasError=!1}get hasError(){return this._hasError}static setGlobalHandler(o){R.globalHandler=o}capture(o,t,E){var I;let i={error:o,vm:t,info:E||"",timestamp:Date.now()};this.errors.push(i),this._hasError=!0;let _=(I=this.options.maxErrors)!=null?I:100;this.errors.length>_&&this.errors.splice(0,this.errors.length-_),!(this.options.onErrorCaptured&&this.options.onErrorCaptured(o instanceof n?o:new n(1004,o.message),t,i.info)===!0)&&this.options.onError&&this.options.onError(o instanceof n?o:new n(1004,o.message),t)}getFallback(o){if(!this.options.fallback||this.errors.length===0)return null;let t=this.errors[this.errors.length-1];return this.options.fallback(t.error,t.vm,t.info)}getErrors(){return this.errors.slice()}getErrorCount(){return this.errors.length}getLastErrors(){return this.errors.length===0?null:{...this.errors[this.errors.length-1]}}clear(){this.errors=[],this._hasError=!1}};R.globalHandler=null;var s=R,a=!0,O=new Set;function
|
|
1
|
+
var T=(e=>(e[e.INVALID_ARGUMENT=1001]="INVALID_ARGUMENT",e[e.NOT_FOUND=1002]="NOT_FOUND",e[e.ALREADY_EXISTS=1003]="ALREADY_EXISTS",e[e.OPERATION_FAILED=1004]="OPERATION_FAILED",e[e.REACTIVE_READONLY=2001]="REACTIVE_READONLY",e[e.REACTIVE_EFFECT_DISPOSED=2002]="REACTIVE_EFFECT_DISPOSED",e[e.COMPUTED_CYCLE=2003]="COMPUTED_CYCLE",e[e.PARSE_ERROR=3001]="PARSE_ERROR",e[e.INVALID_EXPRESSION=3002]="INVALID_EXPRESSION",e[e.INVALID_DIRECTIVE=3003]="INVALID_DIRECTIVE",e[e.INVALID_TEMPLATE=3004]="INVALID_TEMPLATE",e[e.RENDER_ERROR=4001]="RENDER_ERROR",e[e.HYDRATION_MISMATCH=4002]="HYDRATION_MISMATCH",e[e.INVALID_VNODE=4003]="INVALID_VNODE",e[e.COMPONENT_INVALID_PROPS=5001]="COMPONENT_INVALID_PROPS",e[e.COMPONENT_MISSING_TEMPLATE=5002]="COMPONENT_MISSING_TEMPLATE",e[e.COMPONENT_LIFECYCLE_ERROR=5003]="COMPONENT_LIFECYCLE_ERROR",e[e.ROUTE_NOT_FOUND=6001]="ROUTE_NOT_FOUND",e[e.ROUTE_DUPLICATE=6002]="ROUTE_DUPLICATE",e[e.NAVIGATION_ABORTED=6003]="NAVIGATION_ABORTED",e[e.NAVIGATION_FAILED=6004]="NAVIGATION_FAILED",e[e.STORE_NOT_FOUND=7001]="STORE_NOT_FOUND",e[e.STORE_DUPLICATE=7002]="STORE_DUPLICATE",e))(T||{});var n=class extends Error{constructor(o,t,E){let i=`[Lyt ${o}] ${t}`;super(i),this.name="LytError",this.code=o,this.details=E}};var R=class R{constructor(o){this.errors=[],this.options=o||{},this._hasError=!1}get hasError(){return this._hasError}static setGlobalHandler(o){R.globalHandler=o}capture(o,t,E){var I;let i={error:o,vm:t,info:E||"",timestamp:Date.now()};this.errors.push(i),this._hasError=!0;let _=(I=this.options.maxErrors)!=null?I:100;this.errors.length>_&&this.errors.splice(0,this.errors.length-_),!(this.options.onErrorCaptured&&this.options.onErrorCaptured(o instanceof n?o:new n(1004,o.message),t,i.info)===!0)&&this.options.onError&&this.options.onError(o instanceof n?o:new n(1004,o.message),t)}getFallback(o){if(!this.options.fallback||this.errors.length===0)return null;let t=this.errors[this.errors.length-1];return this.options.fallback(t.error,t.vm,t.info)}getErrors(){return this.errors.slice()}getErrorCount(){return this.errors.length}getLastErrors(){return this.errors.length===0?null:{...this.errors[this.errors.length-1]}}clear(){this.errors=[],this._hasError=!1}};R.globalHandler=null;var s=R,a=!0,O=new Set;function c(r){a=r}function D(){return a}function N(r){if(!a)return;let o=console.warn;typeof o=="function"&&o(`[Lyt warn] ${r}`)}function l(r){if(!a||O.has(r))return;O.add(r);let o=console.warn;typeof o=="function"&&o(`[Lyt warn] ${r}`)}function p(){O.clear()}var f={1001:r=>`\u53C2\u6570 "${r}" \u65E0\u6548\u3002\u8BF7\u68C0\u67E5\u4F20\u5165\u7684\u503C\u7C7B\u578B\u548C\u8303\u56F4\u3002`,1002:r=>`"${r}" \u672A\u627E\u5230\u3002\u8BF7\u786E\u8BA4\u8D44\u6E90\u540D\u79F0\u6216\u8DEF\u5F84\u662F\u5426\u6B63\u786E\u3002`,1003:r=>`"${r}" \u5DF2\u5B58\u5728\u3002\u8BF7\u4F7F\u7528\u4E0D\u540C\u7684\u540D\u79F0\u3002`,1004:r=>`\u64CD\u4F5C "${r}" \u6267\u884C\u5931\u8D25\u3002\u8BF7\u68C0\u67E5\u76F8\u5173\u914D\u7F6E\u548C\u72B6\u6001\u3002`,2001:r=>`\u65E0\u6CD5\u4FEE\u6539\u53EA\u8BFB\u54CD\u5E94\u5F0F\u5C5E\u6027 "${r}"\u3002\u53EA\u8BFB\u5BF9\u8C61\u4E0D\u5141\u8BB8\u76F4\u63A5\u8D4B\u503C\u3002`,2002:()=>"\u526F\u4F5C\u7528\u51FD\u6570\u5DF2\u88AB\u9500\u6BC1\uFF0C\u65E0\u6CD5\u518D\u6B21\u6267\u884C\u3002\u8BF7\u521B\u5EFA\u65B0\u7684\u526F\u4F5C\u7528\u3002",2003:()=>"\u8BA1\u7B97\u5C5E\u6027\u68C0\u6D4B\u5230\u5FAA\u73AF\u4F9D\u8D56\u3002\u8BF7\u68C0\u67E5 computed \u51FD\u6570\u662F\u5426\u5F15\u7528\u4E86\u81EA\u8EAB\u3002",3001:r=>`\u6A21\u677F\u89E3\u6790\u9519\u8BEF\uFF1A${r}\u3002\u8BF7\u68C0\u67E5\u6A21\u677F\u8BED\u6CD5\u662F\u5426\u6B63\u786E\u3002`,3002:r=>`\u65E0\u6548\u7684\u8868\u8FBE\u5F0F "${r}"\u3002\u8BF7\u68C0\u67E5\u8868\u8FBE\u5F0F\u8BED\u6CD5\u3002`,3003:r=>`\u65E0\u6548\u7684\u6307\u4EE4 "${r}"\u3002\u8BF7\u786E\u8BA4\u6307\u4EE4\u540D\u79F0\u662F\u5426\u6B63\u786E\u3002`,3004:r=>`\u65E0\u6548\u7684\u6A21\u677F\uFF1A${r}\u3002\u8BF7\u68C0\u67E5\u6A21\u677F\u5185\u5BB9\u3002`,4001:r=>`\u6E32\u67D3\u9519\u8BEF\uFF1A${r}\u3002\u8BF7\u68C0\u67E5\u7EC4\u4EF6\u7684 render \u51FD\u6570\u6216\u6A21\u677F\u3002`,4002:r=>`\u6C34\u5408\u4E0D\u5339\u914D\uFF1A${r}\u3002\u670D\u52A1\u7AEF\u6E32\u67D3\u4E0E\u5BA2\u6237\u7AEF\u6E32\u67D3\u7ED3\u679C\u4E0D\u4E00\u81F4\u3002`,4003:r=>`\u65E0\u6548\u7684\u865A\u62DF\u8282\u70B9\uFF1A${r}\u3002VNode \u7F3A\u5C11\u5FC5\u8981\u7684 type \u6216\u5176\u4ED6\u5C5E\u6027\u3002`,5001:r=>`\u7EC4\u4EF6\u5C5E\u6027\u65E0\u6548\uFF1A${r}\u3002\u8BF7\u68C0\u67E5\u4F20\u5165\u7684 props \u662F\u5426\u7B26\u5408\u7EC4\u4EF6\u5B9A\u4E49\u3002`,5002:r=>`\u7EC4\u4EF6 "${r}" \u7F3A\u5C11 template \u6216 render \u51FD\u6570\u3002\u8BF7\u786E\u4FDD\u7EC4\u4EF6\u5B9A\u4E49\u4E2D\u5305\u542B template \u5B57\u7B26\u4E32\u6216 render \u65B9\u6CD5\u3002`,5003:r=>`\u7EC4\u4EF6\u751F\u547D\u5468\u671F\u9519\u8BEF\uFF1A${r}\u3002\u8BF7\u68C0\u67E5\u751F\u547D\u5468\u671F\u94A9\u5B50\u51FD\u6570\u3002`,6001:r=>`\u8DEF\u7531 "${r}" \u672A\u627E\u5230\u3002\u8BF7\u786E\u8BA4\u8DEF\u7531\u8DEF\u5F84\u662F\u5426\u5DF2\u6CE8\u518C\u3002`,6002:r=>`\u8DEF\u7531 "${r}" \u5DF2\u5B58\u5728\u3002\u8BF7\u907F\u514D\u91CD\u590D\u6CE8\u518C\u76F8\u540C\u7684\u8DEF\u7531\u8DEF\u5F84\u3002`,6003:r=>`\u5BFC\u822A\u88AB\u4E2D\u6B62\uFF1A${r}\u3002\u53EF\u80FD\u88AB\u5BFC\u822A\u5B88\u536B\u62E6\u622A\u3002`,6004:r=>`\u5BFC\u822A\u5931\u8D25\uFF1A${r}\u3002\u8BF7\u68C0\u67E5\u76EE\u6807\u8DEF\u7531\u662F\u5426\u6709\u6548\u3002`,7001:r=>`Store "${r}" \u672A\u627E\u5230\u3002\u8BF7\u786E\u8BA4 store \u662F\u5426\u5DF2\u6CE8\u518C\u3002`,7002:r=>`Store "${r}" \u5DF2\u5B58\u5728\u3002\u8BF7\u907F\u514D\u91CD\u590D\u521B\u5EFA\u76F8\u540C ID \u7684 store\u3002`};function u(r,...o){let t=f[r];if(t){let E=t(...o);return`[Lyt ${r}] ${E}`}return`[Lyt ${r}] \u672A\u77E5\u9519\u8BEF\u3002`}function A(r,o,t){s.globalHandler&&s.globalHandler(r,o,t||""),a&&r instanceof n&&r.details}function g(r,o){try{return r()}catch(t){A(t instanceof Error?t:new Error(String(t)),o);return}}import{LytErrorCodes as L,ErrorCategory as C,getErrorMessage as P,getCategory as h}from"@lytjs/common";import{LytError as y,createCompilerError as d,createRendererError as M,createComponentError as m}from"@lytjs/common";export{s as ErrorBoundary,C as ErrorCategory,n as LytError,T as LytErrorCodes,y as NewLytError,L as NewLytErrorCodes,g as callWithErrorHandling,d as createCompilerError,m as createComponentError,u as createMessage,M as createRendererError,h as getCategory,D as getDevMode,P as getErrorMessage,A as handleError,p as resetWarnedMessages,c as setDevMode,N as warn,l as warnOnce,l as warnOnceUtil,N as warnUtil};
|
package/dist/index.cjs
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
var k=Object.defineProperty;var ee=Object.getOwnPropertyDescriptor;var te=Object.getOwnPropertyNames;var ne=Object.prototype.hasOwnProperty;var re=(e,t)=>{for(var n in t)k(e,n,{get:t[n],enumerable:!0})},w=(e,t,n,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let l of te(t))!ne.call(e,l)&&l!==n&&k(e,l,{get:()=>t[l],enumerable:!(a=ee(t,l))||a.enumerable});return e},b=(e,t,n)=>(w(e,t,"default"),n&&w(n,t,"default"));var oe=e=>w(k({},"__esModule",{value:!0}),e);var C={};re(C,{ErrorBoundary:()=>I,Fragment:()=>H,LytError:()=>N,ShapeFlags:()=>$,createApp:()=>z,defineCustomElement:()=>V,defineCustomElementFromSFC:()=>J,h:()=>A,handleError:()=>X,installPlugin:()=>D,isBrowser:()=>M,registerComponents:()=>K,uninstallPlugin:()=>L,unregisterElement:()=>Z});module.exports=oe(C);var T=require("@lytjs/common"),$=(d=>(d[d.ELEMENT=1]="ELEMENT",d[d.FUNCTIONAL_COMPONENT=2]="FUNCTIONAL_COMPONENT",d[d.STATEFUL_COMPONENT=4]="STATEFUL_COMPONENT",d[d.TEXT_CHILDREN=8]="TEXT_CHILDREN",d[d.ARRAY_CHILDREN=16]="ARRAY_CHILDREN",d[d.SLOTS_CHILDREN=32]="SLOTS_CHILDREN",d))($||{}),H=Symbol("Fragment");function ie(e,t){if(t!=null)if((0,T.isStringOrNumber)(t))e.children=String(t),e.shapeFlag|=8;else if((0,T.isArray)(t)){let n=[];for(let a=0;a<t.length;a++){let l=t[a];if(!(l==null||typeof l=="boolean"))if((0,T.isArray)(l))for(let y=0;y<l.length;y++){let d=l[y];d!=null&&typeof d!="boolean"&&n.push((0,T.isVNode)(d)?d:U(String(d)))}else(0,T.isVNode)(l)?n.push(l):n.push(U(String(l)))}e.children=n,e.shapeFlag|=16}else typeof t=="object"&&(e.children=t,e.shapeFlag|=32)}function U(e,t=null,n=null){var m,E;let a=0;typeof e=="string"?a=1:e===H?a=0:typeof e=="function"?a=2:typeof e=="object"&&e!==null&&(e.setup||e.__vccOpts||e.render)&&(a=4);let l=(m=t==null?void 0:t.key)!=null?m:null,y=(E=t==null?void 0:t.ref)!=null?E:null,d=t;if(t){let{key:h,ref:r,...i}=t;d=i}let g={type:e,props:d,children:null,key:l,ref:y,shapeFlag:a,el:null,component:null};return n!=null&&ie(g,n),g}function A(e,t,n){return U(e,t||null,n||null)}var P=require("@lytjs/common");function B(e){return Object.create(e||null)}function Y(e){return e!==null&&typeof e=="object"&&typeof e.install=="function"}function W(e){return typeof e=="function"}function D(e,t,...n){if(Y(t)){let a=t.onBeforeInstall?t.onBeforeInstall(e,...n):void 0;if((0,P.isPromise)(a))return a.then(()=>{let l=t.install(e,...n);if((0,P.isPromise)(l))return l.then(()=>{if(t.onInstalled)return t.onInstalled(e,...n)});if(t.onInstalled)return t.onInstalled(e,...n)});{let l=t.install(e,...n);if((0,P.isPromise)(l))return l.then(()=>{if(t.onInstalled)return t.onInstalled(e,...n)});if(t.onInstalled)return t.onInstalled(e,...n)}}else if(W(t))return t(e,...n)}function L(e,t){if(Y(t)){if(typeof t.uninstall=="function")return t.uninstall(e)}else W(t)}var x=require("@lytjs/reactivity"),G=require("@lytjs/compiler"),R=require("@lytjs/component"),q=require("@lytjs/renderer"),se=100,v=new Map;function ae(e){let t=v.get(e);if(t)return v.delete(e),v.set(e,t),t;let{code:n}=(0,G.compile)(e);if(t=new Function("h","_ctx",`return ${n}`),v.size>=se){let a=v.keys().next().value;v.delete(a)}return v.set(e,t),t}function le(e){let t={...e};if(e.state&&typeof e.state!="function"){let n=e.state;t.state=()=>({...n})}if(typeof e.render=="function"){let n=e.render;t.render=(a,l)=>n(a)}if(e.computed){let n={};for(let a of Object.keys(e.computed)){let l=e.computed[a];typeof l=="function"?n[a]={get:l}:n[a]=l}t.computed=n}if(typeof e.init=="function"){let n=e.init;t.init=function(a,l){return n.call(this,a)}}return t}function ce(){return{createElement(e){return document.createElement(e)},createText(e){return document.createTextNode(e)},createComment(e){return document.createComment(e)},setAttribute(e,t,n){e.setAttribute(t,String(n))},removeAttribute(e,t){e.removeAttribute(t)},setStyle(e,t){if(typeof t=="string")e.style.cssText=t;else if(t&&typeof t=="object")for(let n in t)e.style[n]=t[n]},setClass(e,t){if(typeof t=="string")e.className=t;else if(t&&typeof t=="object"){let n=[];for(let[a,l]of Object.entries(t))l&&n.push(a);e.className=n.join(" ")}else e.className=""},insert(e,t,n){n!=null?e.insertBefore(t,n):e.appendChild(t)},remove(e){e.parentNode&&e.parentNode.removeChild(e)},replace(e,t,n){e.replaceChild(n,t)},addEventListener(e,t,n,a){e.addEventListener(t,n,a)},removeEventListener(e,t,n){e.removeEventListener(t,n)},nextTick(e){Promise.resolve().then(e)},parentNode(e){return e.parentNode},nextSibling(e){return e.nextSibling},querySelector(e){return document.querySelector(e)}}}function z(e,t){let n=new Set,a={},l={},y=B(),d={},g={},m=null,E=null,h=null,r=null,i=!1,o=le(typeof e=="function"?{render:e}:e),u=(0,R.defineComponent)(o),s={config:d,globalProperties:g,get _instance(){return m},mount(f){if(i)return s;let p;if(typeof f=="string"){if(p=document.querySelector(f),!p)throw new Error(`[Lyt] \u627E\u4E0D\u5230\u6302\u8F7D\u76EE\u6807: "${f}"`)}else p=f;r=p;let _=ce();E=(0,q.createRenderer)(_),m=(0,R.createComponentInstance)(u),(0,R.setupComponent)(m,t||{},null);let O=m.type;if(!O.render&&O.template){let F=ae(O.template);O.render=(j,Q)=>F(j,Q.renderProxy)}return(0,R.mountComponent)(m,A),m.subTree&&E.mount(m.subTree,p),h=(0,x.effect)(()=>{if(!(!m||!m.isMounted||!E)&&((0,R.updateComponent)(m,A),m.subTree&&r)){let F=r.firstChild,j=m.subTree;r.innerHTML="",E.mount(j,r)}},{lazy:!0}),i=!0,s},unmount(){i&&(h&&((0,x.stop)(h),h=null),m&&(0,R.unmountComponent)(m),r&&(r.innerHTML=""),m=null,E=null,r=null,i=!1)},use(f,...p){if(n.has(f))return s;n.add(f);let _=D({use:s.use.bind(s),unuse:s.unuse.bind(s),isInstalled:s.isInstalled.bind(s),provide:s.provide.bind(s),inject:s.inject.bind(s),config:d,globalProperties:g},f,...p);return _ instanceof Promise?_.then(()=>s):s},unuse(f){if(!n.has(f))return s;n.delete(f);let p=L({use:s.use.bind(s),unuse:s.unuse.bind(s),isInstalled:s.isInstalled.bind(s),provide:s.provide.bind(s),inject:s.inject.bind(s),config:d,globalProperties:g},f);return p instanceof Promise?p.then(()=>s):s},isInstalled(f){return n.has(f)},provide(f,p){return y[f]=p,s},inject(f,p){let _=y[f];return _!==void 0?_:p},component(f,p){return p?(a[f]=p,s):a[f]},directive(f,p){return p?(l[f]=p,s):l[f]}};return s}var N=class extends Error{constructor(t,n,a){let l=`[Lyt ${t}] ${n}`;super(l),this.name="LytError",this.code=t,this.details=a}};var S=class S{constructor(t){this.errors=[],this.options=t||{},this._hasError=!1}get hasError(){return this._hasError}static setGlobalHandler(t){S.globalHandler=t}capture(t,n,a){var d;let l={error:t,vm:n,info:a||"",timestamp:Date.now()};this.errors.push(l),this._hasError=!0;let y=(d=this.options.maxErrors)!=null?d:100;this.errors.length>y&&this.errors.splice(0,this.errors.length-y),!(this.options.onErrorCaptured&&this.options.onErrorCaptured(t instanceof N?t:new N(1004,t.message),n,l.info)===!0)&&this.options.onError&&this.options.onError(t instanceof N?t:new N(1004,t.message),n)}getFallback(t){if(!this.options.fallback||this.errors.length===0)return null;let n=this.errors[this.errors.length-1];return this.options.fallback(n.error,n.vm,n.info)}getErrors(){return this.errors.slice()}getErrorCount(){return this.errors.length}getLastErrors(){return this.errors.length===0?null:{...this.errors[this.errors.length-1]}}clear(){this.errors=[],this._hasError=!1}};S.globalHandler=null;var I=S,ue=!0;function X(e,t,n){I.globalHandler&&I.globalHandler(e,t,n||""),ue&&e instanceof N&&e.details}function M(){return typeof window!="undefined"&&typeof document!="undefined"&&typeof HTMLElement!="undefined"&&typeof customElements!="undefined"}function de(e){return e.replace(/-([a-z])/g,(t,n)=>n.toUpperCase())}function fe(e){if(e===""||e==="true")return!0;if(e==="false")return!1;if(e==="null")return null;if(e==="undefined")return;let t=Number(e);if(!isNaN(t)&&e.trim()!=="")return t;if(e.startsWith("{")&&e.endsWith("}")||e.startsWith("[")&&e.endsWith("]"))try{return JSON.parse(e)}catch(n){}return e}function pe(e,t){return t&&t[e]?t[e]:de(e)}function me(e){let t=[],n=e;if(n.emits&&(Array.isArray(n.emits)?t.push(...n.emits):typeof n.emits=="object"&&t.push(...Object.keys(n.emits))),n.methods){for(let a of Object.keys(n.methods))if(a.startsWith("on")&&a.length>2){let l=a.charAt(2).toLowerCase()+a.slice(3);t.push(l)}}return t}function ye(e,t={}){let{shadowMode:n="open",styles:a="",propMappings:l,eventMappings:y={},attributeConverters:d={}}=t,g=t.observedAttributes||[],m=me(e);return class extends HTMLElement{constructor(){super();this._shadowRoot=null;this._instance=null;this._props={};this._container=null;this._connected=!1;this._eventCleanups=[];this._effectCleanup=null;this._updateScheduled=!1}static get observedAttributes(){return g}connectedCallback(){if(!this._connected){if(this._connected=!0,this._shadowRoot=this.attachShadow({mode:n}),a){let r=document.createElement("style");r.textContent=a,this._shadowRoot.appendChild(r)}this._container=document.createElement("div"),this._shadowRoot.appendChild(this._container),this._syncAttributesToProps(),this._mountComponent(),this._forwardSlots()}}disconnectedCallback(){if(this._connected){this._connected=!1;for(let r of this._eventCleanups)r();this._eventCleanups=[],this._effectCleanup&&(this._effectCleanup(),this._effectCleanup=null),this._instance=null,this._container&&(this._container.innerHTML="")}}attributeChangedCallback(r,i,c){i!==c&&this._connected&&(this._syncAttributesToProps(),this._updateComponent())}_syncAttributesToProps(){let r={};for(let i of g)if(this.hasAttribute(i)){let c=this.getAttribute(i),o=pe(i,l);d[i]?r[o]=d[i](c):r[o]=fe(c)}if(e.props){for(let[i,c]of Object.entries(e.props))if(r[i]===void 0){let o=c;o&&typeof o=="object"&&"default"in o?r[i]=typeof o.default=="function"?o.default():o.default:o==null}}this._props=r}_mountComponent(){let r=e.render?e.render:e.template?this._compileTemplate(e.template):null;if(!r)return;let i=this._createComponentContext(),c=r.call(i,A,i);c&&this._container&&this._renderVNode(c,this._container),this._setupReactiveUpdates(i,r)}_compileTemplate(r){try{let i=Function("return require")(),{compile:c}=i("../../compiler/src/index.ts"),{code:o}=c(r);return new Function("h","_ctx",`return ${o}`)}catch(i){return null}}_createComponentContext(){let r=e.state?typeof e.state=="function"?e.state():{...e.state}:{},i=e.computed||{},c=e.methods||{},o={...this._props,...r};for(let[u,s]of Object.entries(i))typeof s=="function"?Object.defineProperty(o,u,{get:s.bind(o),enumerable:!0}):s&&typeof s=="object"&&"get"in s&&Object.defineProperty(o,u,{get:s.get.bind(o),enumerable:!0});for(let[u,s]of Object.entries(c))typeof s=="function"&&(o[u]=s.bind(o));return o.emit=(u,...s)=>{let f=y[u]||u,p=new CustomEvent(f,{detail:s.length===1?s[0]:s,bubbles:!0,composed:!0});this.dispatchEvent(p)},o.$el=this._container,o.$attrs={...this._props},o.$slots=this._getSlotContent(),o}_setupReactiveUpdates(r,i){try{let c=Function("return require")(),{effect:o,stop:u}=c("../../reactivity/src/index.ts"),s=o(()=>{if(!this._connected||!this._container)return;let p=i.call(r,A,r);p&&(this._container.innerHTML="",this._renderVNode(p,this._container))},{lazy:!0}),f=e.state?typeof e.state=="function"?Object.keys(e.state()):Object.keys(e.state):[];for(let p of f){let _=r[p];Object.defineProperty(r,p,{get(){return _},set(O){_=O;try{s()}catch(F){}},enumerable:!0})}this._effectCleanup=()=>{try{u(s)}catch(p){}}}catch(c){let o=e.state?typeof e.state=="function"?Object.keys(e.state()):Object.keys(e.state):[];for(let u of o){let f=r[u],p=this;Object.defineProperty(r,u,{get(){return f},set(_){f=_,p._scheduleUpdate(r,i)},enumerable:!0})}}}_scheduleUpdate(r,i){this._updateScheduled||(this._updateScheduled=!0,Promise.resolve().then(()=>{if(this._updateScheduled=!1,!this._connected||!this._container)return;let c=i.call(r,A,r);c&&(this._container.innerHTML="",this._renderVNode(c,this._container))}))}_updateComponent(){if(!this._container)return;let r=e.render?e.render:e.template?this._compileTemplate(e.template):null;if(!r)return;let i=this._createComponentContext(),c=r.call(i,A,i);this._container.innerHTML="",c&&this._renderVNode(c,this._container)}_renderVNode(r,i){let c=this._vNodeToElement(r);c&&i.appendChild(c)}_vNodeToElement(r){if(!r)return null;if(typeof r.type=="symbol"){let i=document.createDocumentFragment();if(Array.isArray(r.children))for(let c of r.children){let o=this._vNodeToElement(c);o&&i.appendChild(o)}return i}if(typeof r.children=="string")return document.createTextNode(r.children);if(typeof r.type=="string"){let i=document.createElement(r.type);if(r.props)for(let[c,o]of Object.entries(r.props))if(c==="style"&&typeof o=="object")for(let[u,s]of Object.entries(o))i.style[u]=s;else if(c==="class"){if(typeof o=="string")i.className=o;else if(typeof o=="object"){let u=[];for(let[s,f]of Object.entries(o))f&&u.push(s);i.className=u.join(" ")}}else if(c.startsWith("on")&&typeof o=="function"){let u=c.slice(2).toLowerCase();i.addEventListener(u,o),this._eventCleanups.push(()=>{i.removeEventListener(u,o)})}else c==="ref"&&typeof o=="function"?o(i):i.setAttribute(c,String(o));if(Array.isArray(r.children))for(let c of r.children){let o=this._vNodeToElement(c);o&&i.appendChild(o)}else typeof r.children=="string"&&(i.textContent=r.children);return i}return typeof r.type=="object"||typeof r.type=="function"?r.component?this._vNodeToElement(r.component.subTree||r):document.createComment("component"):null}_forwardSlots(){if(!this._shadowRoot||!this._container)return;let r=this.querySelectorAll("[slot]");for(let c of r){let o=c.getAttribute("slot")||"default",u=document.createElement("slot");o!=="default"&&u.setAttribute("name",o),this._container.appendChild(u)}let i=document.createElement("slot");this._container.appendChild(i)}_getSlotContent(){var o;let r={},i=this.querySelectorAll("[slot]");for(let u of i){let s=u.getAttribute("slot")||"default";r[s]||(r[s]=[]),r[s].push(u.cloneNode(!0))}let c=[];for(let u of Array.from(this.childNodes))(o=u.hasAttribute)!=null&&o.call(u,"slot")||c.push(u.cloneNode(!0));return c.length>0&&(r.default=c),r}get _lytInstance(){return this._instance}get _lytProps(){return{...this._props}}}}function V(e,t,n){if(!e.includes("-"))throw new Error(`[Lyt Web Component] \u6807\u7B7E\u540D "${e}" \u5FC5\u987B\u5305\u542B\u8FDE\u5B57\u7B26 (-)\u3002\u8FD9\u662F Custom Element \u89C4\u8303\u7684\u8981\u6C42\u3002`);if(!M())return;let a=ye(t,n);customElements.define(e,a)}function K(e){for(let{tagName:t,component:n,options:a}of e)V(t,n,a)}function Z(e){if(M())try{let t=customElements;t.__unregister&&t.__unregister(e)}catch(t){}}async function J(e,t,n){let a=t.match(/<template>([\s\S]*?)<\/template>/),l=t.match(/<script[^>]*>([\s\S]*?)<\/script>/),y=/<style[^>]*>([\s\S]*?)<\/style>/g,d=[],g;for(;(g=y.exec(t))!==null;)d.push(g);let m=(n==null?void 0:n.styles)||"";for(let i of d)m+=i[1]+`
|
|
2
|
-
`;let E=a?a[1].trim():void 0,h={};if(l){let i=l[1].trim();if(i.match(/export\s+default\s*(\{[\s\S]*\}|\([\s\S]*\)[\s\S]*?\))/))try{let o={},u={exports:o};new Function("module","exports",`"use strict"; ${i.replace(/export\s+default\s*/,"module.exports =")}`)(u,o),h=u.exports||o}catch(o){}}let r={...n,styles:m};E&&!h.template&&!h.render&&(h.template=E),V(e,h,r)}b(C,require("@lytjs/common"),module.exports);
|
|
1
|
+
var O=Object.defineProperty;var $=Object.getOwnPropertyDescriptor;var q=Object.getOwnPropertyNames;var X=Object.prototype.hasOwnProperty;var Y=(n,e)=>{for(var t in e)O(n,t,{get:e[t],enumerable:!0})},h=(n,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of q(e))!X.call(n,o)&&o!==t&&O(n,o,{get:()=>e[o],enumerable:!(i=$(e,o))||i.enumerable});return n},A=(n,e,t)=>(h(n,e,"default"),t&&h(t,e,"default"));var K=n=>h(O({},"__esModule",{value:!0}),n);var v={};Y(v,{Fragment:()=>j,ShapeFlags:()=>L,createApp:()=>B,h:()=>I});module.exports=K(v);var y=require("@lytjs/common"),L=(s=>(s[s.ELEMENT=1]="ELEMENT",s[s.FUNCTIONAL_COMPONENT=2]="FUNCTIONAL_COMPONENT",s[s.STATEFUL_COMPONENT=4]="STATEFUL_COMPONENT",s[s.TEXT_CHILDREN=8]="TEXT_CHILDREN",s[s.ARRAY_CHILDREN=16]="ARRAY_CHILDREN",s[s.SLOTS_CHILDREN=32]="SLOTS_CHILDREN",s))(L||{}),j=Symbol("Fragment");function Z(n,e){if(e!=null)if((0,y.isStringOrNumber)(e))n.children=String(e),n.shapeFlag|=8;else if((0,y.isArray)(e)){let t=[];for(let i=0;i<e.length;i++){let o=e[i];if(!(o==null||typeof o=="boolean"))if((0,y.isArray)(o))for(let d=0;d<o.length;d++){let s=o[d];s!=null&&typeof s!="boolean"&&t.push((0,y.isVNode)(s)?s:E(String(s)))}else(0,y.isVNode)(o)?t.push(o):t.push(E(String(o)))}n.children=t,n.shapeFlag|=16}else typeof e=="object"&&(n.children=e,n.shapeFlag|=32)}function E(n,e=null,t=null){var u,f;let i=0;typeof n=="string"?i=1:n===j?i=0:typeof n=="function"?i=2:typeof n=="object"&&n!==null&&(n.setup||n.__vccOpts||n.render)&&(i=4);let o=(u=e==null?void 0:e.key)!=null?u:null,d=(f=e==null?void 0:e.ref)!=null?f:null,s=e;if(e){let{key:C,ref:p,...P}=e;s=P}let b={type:n,props:s,children:null,key:o,ref:d,shapeFlag:i,el:null,component:null};return t!=null&&Z(b,t),b}function I(n,e,t){return E(n,e||null,t||null)}var N=require("@lytjs/common");function D(n){return Object.create(n||null)}function V(n){return n!==null&&typeof n=="object"&&typeof n.install=="function"}function _(n){return typeof n=="function"}function F(n,e,...t){if(V(e)){let i=e.onBeforeInstall?e.onBeforeInstall(n,...t):void 0;if((0,N.isPromise)(i))return i.then(()=>{let o=e.install(n,...t);if((0,N.isPromise)(o))return o.then(()=>{if(e.onInstalled)return e.onInstalled(n,...t)});if(e.onInstalled)return e.onInstalled(n,...t)});{let o=e.install(n,...t);if((0,N.isPromise)(o))return o.then(()=>{if(e.onInstalled)return e.onInstalled(n,...t)});if(e.onInstalled)return e.onInstalled(n,...t)}}else if(_(e))return e(n,...t)}function S(n,e){if(V(e)){if(typeof e.uninstall=="function")return e.uninstall(n)}else _(e)}var T=require("@lytjs/reactivity"),H=require("@lytjs/compiler"),c=require("@lytjs/component"),M=require("@lytjs/renderer"),G=100,g=new Map;function J(n){let e=g.get(n);if(e)return g.delete(n),g.set(n,e),e;let{code:t}=(0,H.compile)(n);if(e=new Function("h","_ctx",`return ${t}`),g.size>=G){let i=g.keys().next().value;i!==void 0&&g.delete(i)}return g.set(n,e),e}function Q(n){let e={...n};if(n.state&&typeof n.state!="function"){let t=n.state;e.state=()=>({...t})}if(typeof n.render=="function"){let t=n.render;e.render=(i,o)=>t(i)}if(n.computed){let t={};for(let i of Object.keys(n.computed)){let o=n.computed[i];typeof o=="function"?t[i]={get:o}:t[i]=o}e.computed=t}if(typeof n.init=="function"){let t=n.init;e.init=function(i,o){return t.call(this,i)}}return e}function W(){return{createElement(n){return document.createElement(n)},createText(n){return document.createTextNode(n)},createComment(n){return document.createComment(n)},setAttribute(n,e,t){n.setAttribute(e,String(t))},removeAttribute(n,e){n.removeAttribute(e)},setStyle(n,e){if(typeof e=="string")n.style.cssText=e;else if(e&&typeof e=="object")for(let t in e)n.style[t]=e[t]},setClass(n,e){if(typeof e=="string")n.className=e;else if(e&&typeof e=="object"){let t=[];for(let[i,o]of Object.entries(e))o&&t.push(i);n.className=t.join(" ")}else n.className=""},insert(n,e,t){t!=null?n.insertBefore(e,t):n.appendChild(e)},remove(n){n.parentNode&&n.parentNode.removeChild(n)},replace(n,e,t){n.replaceChild(t,e)},addEventListener(n,e,t,i){n.addEventListener(e,t,i)},removeEventListener(n,e,t){n.removeEventListener(e,t)},nextTick(n){Promise.resolve().then(n)},parentNode(n){return n.parentNode},nextSibling(n){return n.nextSibling},querySelector(n){return document.querySelector(n)}}}function B(n,e){let t=new Set,i={},o={},d=D(),s={},b={},u=null,f=null,C=null,p=null,P=!1,w=Q(typeof n=="function"?{render:n}:n),U=(0,c.defineComponent)(w),r={config:s,globalProperties:b,get _instance(){return u},mount(a){if(P)return r;let l;if(typeof a=="string"){if(l=document.querySelector(a),!l)throw new Error(`[Lyt] \u627E\u4E0D\u5230\u6302\u8F7D\u76EE\u6807: "${a}"`)}else l=a;p=l;let m=W();f=(0,M.createRenderer)(m),u=(0,c.createComponentInstance)(U),(0,c.setupComponent)(u,e||{},null);let R=u.type;if(!R.render&&R.template){let k=J(R.template);R.render=(x,z)=>k(x,z.renderProxy)}return(0,c.mountComponent)(u,I),u.subTree&&f.mount(u.subTree,l),C=(0,T.effect)(()=>{if(!(!u||!u.isMounted||!f)&&((0,c.updateComponent)(u,I),u.subTree&&p)){let k=p.firstChild,x=u.subTree;p.innerHTML="",f.mount(x,p)}},{lazy:!0}),P=!0,r},unmount(){P&&(C&&((0,T.stop)(C),C=null),u&&(0,c.unmountComponent)(u),p&&(p.innerHTML=""),u=null,f=null,p=null,P=!1)},use(a,...l){if(t.has(a))return r;t.add(a);let m=F({use:r.use.bind(r),unuse:r.unuse.bind(r),isInstalled:r.isInstalled.bind(r),provide:r.provide.bind(r),inject:r.inject.bind(r),config:s,globalProperties:b},a,...l);return m instanceof Promise?m.then(()=>r):r},unuse(a){if(!t.has(a))return r;t.delete(a);let l=S({use:r.use.bind(r),unuse:r.unuse.bind(r),isInstalled:r.isInstalled.bind(r),provide:r.provide.bind(r),inject:r.inject.bind(r),config:s,globalProperties:b},a);return l instanceof Promise?l.then(()=>r):r},isInstalled(a){return t.has(a)},provide(a,l){return d[a]=l,r},inject(a,l){let m=d[a];return m!==void 0?m:l},component(a,l){return l?(i[a]=l,r):i[a]},directive(a,l){return l?(o[a]=l,r):o[a]}};return r}A(v,require("@lytjs/common"),module.exports);
|
package/dist/index.mjs
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
import{isStringOrNumber as H,isArray as M,isVNode as V}from"@lytjs/common";var F=(d=>(d[d.ELEMENT=1]="ELEMENT",d[d.FUNCTIONAL_COMPONENT=2]="FUNCTIONAL_COMPONENT",d[d.STATEFUL_COMPONENT=4]="STATEFUL_COMPONENT",d[d.TEXT_CHILDREN=8]="TEXT_CHILDREN",d[d.ARRAY_CHILDREN=16]="ARRAY_CHILDREN",d[d.SLOTS_CHILDREN=32]="SLOTS_CHILDREN",d))(F||{}),j=Symbol("Fragment");function B(e,t){if(t!=null)if(H(t))e.children=String(t),e.shapeFlag|=8;else if(M(t)){let n=[];for(let a=0;a<t.length;a++){let c=t[a];if(!(c==null||typeof c=="boolean"))if(M(c))for(let y=0;y<c.length;y++){let d=c[y];d!=null&&typeof d!="boolean"&&n.push(V(d)?d:I(String(d)))}else V(c)?n.push(c):n.push(I(String(c)))}e.children=n,e.shapeFlag|=16}else typeof t=="object"&&(e.children=t,e.shapeFlag|=32)}function I(e,t=null,n=null){var m,E;let a=0;typeof e=="string"?a=1:e===j?a=0:typeof e=="function"?a=2:typeof e=="object"&&e!==null&&(e.setup||e.__vccOpts||e.render)&&(a=4);let c=(m=t==null?void 0:t.key)!=null?m:null,y=(E=t==null?void 0:t.ref)!=null?E:null,d=t;if(t){let{key:h,ref:r,...i}=t;d=i}let g={type:e,props:d,children:null,key:c,ref:y,shapeFlag:a,el:null,component:null};return n!=null&&B(g,n),g}function R(e,t,n){return I(e,t||null,n||null)}import{isPromise as P}from"@lytjs/common";function w(e){return Object.create(e||null)}function k(e){return e!==null&&typeof e=="object"&&typeof e.install=="function"}function U(e){return typeof e=="function"}function D(e,t,...n){if(k(t)){let a=t.onBeforeInstall?t.onBeforeInstall(e,...n):void 0;if(P(a))return a.then(()=>{let c=t.install(e,...n);if(P(c))return c.then(()=>{if(t.onInstalled)return t.onInstalled(e,...n)});if(t.onInstalled)return t.onInstalled(e,...n)});{let c=t.install(e,...n);if(P(c))return c.then(()=>{if(t.onInstalled)return t.onInstalled(e,...n)});if(t.onInstalled)return t.onInstalled(e,...n)}}else if(U(t))return t(e,...n)}function L(e,t){if(k(t)){if(typeof t.uninstall=="function")return t.uninstall(e)}else U(t)}import{effect as Y,stop as W}from"@lytjs/reactivity";import{compile as G}from"@lytjs/compiler";import{defineComponent as q,createComponentInstance as z,setupComponent as X,mountComponent as K,updateComponent as Z,unmountComponent as J}from"@lytjs/component";import{createRenderer as Q}from"@lytjs/renderer";var ee=100,A=new Map;function te(e){let t=A.get(e);if(t)return A.delete(e),A.set(e,t),t;let{code:n}=G(e);if(t=new Function("h","_ctx",`return ${n}`),A.size>=ee){let a=A.keys().next().value;A.delete(a)}return A.set(e,t),t}function ne(e){let t={...e};if(e.state&&typeof e.state!="function"){let n=e.state;t.state=()=>({...n})}if(typeof e.render=="function"){let n=e.render;t.render=(a,c)=>n(a)}if(e.computed){let n={};for(let a of Object.keys(e.computed)){let c=e.computed[a];typeof c=="function"?n[a]={get:c}:n[a]=c}t.computed=n}if(typeof e.init=="function"){let n=e.init;t.init=function(a,c){return n.call(this,a)}}return t}function re(){return{createElement(e){return document.createElement(e)},createText(e){return document.createTextNode(e)},createComment(e){return document.createComment(e)},setAttribute(e,t,n){e.setAttribute(t,String(n))},removeAttribute(e,t){e.removeAttribute(t)},setStyle(e,t){if(typeof t=="string")e.style.cssText=t;else if(t&&typeof t=="object")for(let n in t)e.style[n]=t[n]},setClass(e,t){if(typeof t=="string")e.className=t;else if(t&&typeof t=="object"){let n=[];for(let[a,c]of Object.entries(t))c&&n.push(a);e.className=n.join(" ")}else e.className=""},insert(e,t,n){n!=null?e.insertBefore(t,n):e.appendChild(t)},remove(e){e.parentNode&&e.parentNode.removeChild(e)},replace(e,t,n){e.replaceChild(n,t)},addEventListener(e,t,n,a){e.addEventListener(t,n,a)},removeEventListener(e,t,n){e.removeEventListener(t,n)},nextTick(e){Promise.resolve().then(e)},parentNode(e){return e.parentNode},nextSibling(e){return e.nextSibling},querySelector(e){return document.querySelector(e)}}}function oe(e,t){let n=new Set,a={},c={},y=w(),d={},g={},m=null,E=null,h=null,r=null,i=!1,o=ne(typeof e=="function"?{render:e}:e),u=q(o),s={config:d,globalProperties:g,get _instance(){return m},mount(f){if(i)return s;let p;if(typeof f=="string"){if(p=document.querySelector(f),!p)throw new Error(`[Lyt] \u627E\u4E0D\u5230\u6302\u8F7D\u76EE\u6807: "${f}"`)}else p=f;r=p;let _=re();E=Q(_),m=z(u),X(m,t||{},null);let b=m.type;if(!b.render&&b.template){let v=te(b.template);b.render=(O,$)=>v(O,$.renderProxy)}return K(m,R),m.subTree&&E.mount(m.subTree,p),h=Y(()=>{if(!(!m||!m.isMounted||!E)&&(Z(m,R),m.subTree&&r)){let v=r.firstChild,O=m.subTree;r.innerHTML="",E.mount(O,r)}},{lazy:!0}),i=!0,s},unmount(){i&&(h&&(W(h),h=null),m&&J(m),r&&(r.innerHTML=""),m=null,E=null,r=null,i=!1)},use(f,...p){if(n.has(f))return s;n.add(f);let _=D({use:s.use.bind(s),unuse:s.unuse.bind(s),isInstalled:s.isInstalled.bind(s),provide:s.provide.bind(s),inject:s.inject.bind(s),config:d,globalProperties:g},f,...p);return _ instanceof Promise?_.then(()=>s):s},unuse(f){if(!n.has(f))return s;n.delete(f);let p=L({use:s.use.bind(s),unuse:s.unuse.bind(s),isInstalled:s.isInstalled.bind(s),provide:s.provide.bind(s),inject:s.inject.bind(s),config:d,globalProperties:g},f);return p instanceof Promise?p.then(()=>s):s},isInstalled(f){return n.has(f)},provide(f,p){return y[f]=p,s},inject(f,p){let _=y[f];return _!==void 0?_:p},component(f,p){return p?(a[f]=p,s):a[f]},directive(f,p){return p?(c[f]=p,s):c[f]}};return s}var C=class extends Error{constructor(t,n,a){let c=`[Lyt ${t}] ${n}`;super(c),this.name="LytError",this.code=t,this.details=a}};var T=class T{constructor(t){this.errors=[],this.options=t||{},this._hasError=!1}get hasError(){return this._hasError}static setGlobalHandler(t){T.globalHandler=t}capture(t,n,a){var d;let c={error:t,vm:n,info:a||"",timestamp:Date.now()};this.errors.push(c),this._hasError=!0;let y=(d=this.options.maxErrors)!=null?d:100;this.errors.length>y&&this.errors.splice(0,this.errors.length-y),!(this.options.onErrorCaptured&&this.options.onErrorCaptured(t instanceof C?t:new C(1004,t.message),n,c.info)===!0)&&this.options.onError&&this.options.onError(t instanceof C?t:new C(1004,t.message),n)}getFallback(t){if(!this.options.fallback||this.errors.length===0)return null;let n=this.errors[this.errors.length-1];return this.options.fallback(n.error,n.vm,n.info)}getErrors(){return this.errors.slice()}getErrorCount(){return this.errors.length}getLastErrors(){return this.errors.length===0?null:{...this.errors[this.errors.length-1]}}clear(){this.errors=[],this._hasError=!1}};T.globalHandler=null;var N=T,ie=!0;function se(e,t,n){N.globalHandler&&N.globalHandler(e,t,n||""),ie&&e instanceof C&&e.details}function x(){return typeof window!="undefined"&&typeof document!="undefined"&&typeof HTMLElement!="undefined"&&typeof customElements!="undefined"}function ae(e){return e.replace(/-([a-z])/g,(t,n)=>n.toUpperCase())}function le(e){if(e===""||e==="true")return!0;if(e==="false")return!1;if(e==="null")return null;if(e==="undefined")return;let t=Number(e);if(!isNaN(t)&&e.trim()!=="")return t;if(e.startsWith("{")&&e.endsWith("}")||e.startsWith("[")&&e.endsWith("]"))try{return JSON.parse(e)}catch(n){}return e}function ce(e,t){return t&&t[e]?t[e]:ae(e)}function ue(e){let t=[],n=e;if(n.emits&&(Array.isArray(n.emits)?t.push(...n.emits):typeof n.emits=="object"&&t.push(...Object.keys(n.emits))),n.methods){for(let a of Object.keys(n.methods))if(a.startsWith("on")&&a.length>2){let c=a.charAt(2).toLowerCase()+a.slice(3);t.push(c)}}return t}function de(e,t={}){let{shadowMode:n="open",styles:a="",propMappings:c,eventMappings:y={},attributeConverters:d={}}=t,g=t.observedAttributes||[],m=ue(e);return class extends HTMLElement{constructor(){super();this._shadowRoot=null;this._instance=null;this._props={};this._container=null;this._connected=!1;this._eventCleanups=[];this._effectCleanup=null;this._updateScheduled=!1}static get observedAttributes(){return g}connectedCallback(){if(!this._connected){if(this._connected=!0,this._shadowRoot=this.attachShadow({mode:n}),a){let r=document.createElement("style");r.textContent=a,this._shadowRoot.appendChild(r)}this._container=document.createElement("div"),this._shadowRoot.appendChild(this._container),this._syncAttributesToProps(),this._mountComponent(),this._forwardSlots()}}disconnectedCallback(){if(this._connected){this._connected=!1;for(let r of this._eventCleanups)r();this._eventCleanups=[],this._effectCleanup&&(this._effectCleanup(),this._effectCleanup=null),this._instance=null,this._container&&(this._container.innerHTML="")}}attributeChangedCallback(r,i,l){i!==l&&this._connected&&(this._syncAttributesToProps(),this._updateComponent())}_syncAttributesToProps(){let r={};for(let i of g)if(this.hasAttribute(i)){let l=this.getAttribute(i),o=ce(i,c);d[i]?r[o]=d[i](l):r[o]=le(l)}if(e.props){for(let[i,l]of Object.entries(e.props))if(r[i]===void 0){let o=l;o&&typeof o=="object"&&"default"in o?r[i]=typeof o.default=="function"?o.default():o.default:o==null}}this._props=r}_mountComponent(){let r=e.render?e.render:e.template?this._compileTemplate(e.template):null;if(!r)return;let i=this._createComponentContext(),l=r.call(i,R,i);l&&this._container&&this._renderVNode(l,this._container),this._setupReactiveUpdates(i,r)}_compileTemplate(r){try{let i=Function("return require")(),{compile:l}=i("../../compiler/src/index.ts"),{code:o}=l(r);return new Function("h","_ctx",`return ${o}`)}catch(i){return null}}_createComponentContext(){let r=e.state?typeof e.state=="function"?e.state():{...e.state}:{},i=e.computed||{},l=e.methods||{},o={...this._props,...r};for(let[u,s]of Object.entries(i))typeof s=="function"?Object.defineProperty(o,u,{get:s.bind(o),enumerable:!0}):s&&typeof s=="object"&&"get"in s&&Object.defineProperty(o,u,{get:s.get.bind(o),enumerable:!0});for(let[u,s]of Object.entries(l))typeof s=="function"&&(o[u]=s.bind(o));return o.emit=(u,...s)=>{let f=y[u]||u,p=new CustomEvent(f,{detail:s.length===1?s[0]:s,bubbles:!0,composed:!0});this.dispatchEvent(p)},o.$el=this._container,o.$attrs={...this._props},o.$slots=this._getSlotContent(),o}_setupReactiveUpdates(r,i){try{let l=Function("return require")(),{effect:o,stop:u}=l("../../reactivity/src/index.ts"),s=o(()=>{if(!this._connected||!this._container)return;let p=i.call(r,R,r);p&&(this._container.innerHTML="",this._renderVNode(p,this._container))},{lazy:!0}),f=e.state?typeof e.state=="function"?Object.keys(e.state()):Object.keys(e.state):[];for(let p of f){let _=r[p];Object.defineProperty(r,p,{get(){return _},set(b){_=b;try{s()}catch(v){}},enumerable:!0})}this._effectCleanup=()=>{try{u(s)}catch(p){}}}catch(l){let o=e.state?typeof e.state=="function"?Object.keys(e.state()):Object.keys(e.state):[];for(let u of o){let f=r[u],p=this;Object.defineProperty(r,u,{get(){return f},set(_){f=_,p._scheduleUpdate(r,i)},enumerable:!0})}}}_scheduleUpdate(r,i){this._updateScheduled||(this._updateScheduled=!0,Promise.resolve().then(()=>{if(this._updateScheduled=!1,!this._connected||!this._container)return;let l=i.call(r,R,r);l&&(this._container.innerHTML="",this._renderVNode(l,this._container))}))}_updateComponent(){if(!this._container)return;let r=e.render?e.render:e.template?this._compileTemplate(e.template):null;if(!r)return;let i=this._createComponentContext(),l=r.call(i,R,i);this._container.innerHTML="",l&&this._renderVNode(l,this._container)}_renderVNode(r,i){let l=this._vNodeToElement(r);l&&i.appendChild(l)}_vNodeToElement(r){if(!r)return null;if(typeof r.type=="symbol"){let i=document.createDocumentFragment();if(Array.isArray(r.children))for(let l of r.children){let o=this._vNodeToElement(l);o&&i.appendChild(o)}return i}if(typeof r.children=="string")return document.createTextNode(r.children);if(typeof r.type=="string"){let i=document.createElement(r.type);if(r.props)for(let[l,o]of Object.entries(r.props))if(l==="style"&&typeof o=="object")for(let[u,s]of Object.entries(o))i.style[u]=s;else if(l==="class"){if(typeof o=="string")i.className=o;else if(typeof o=="object"){let u=[];for(let[s,f]of Object.entries(o))f&&u.push(s);i.className=u.join(" ")}}else if(l.startsWith("on")&&typeof o=="function"){let u=l.slice(2).toLowerCase();i.addEventListener(u,o),this._eventCleanups.push(()=>{i.removeEventListener(u,o)})}else l==="ref"&&typeof o=="function"?o(i):i.setAttribute(l,String(o));if(Array.isArray(r.children))for(let l of r.children){let o=this._vNodeToElement(l);o&&i.appendChild(o)}else typeof r.children=="string"&&(i.textContent=r.children);return i}return typeof r.type=="object"||typeof r.type=="function"?r.component?this._vNodeToElement(r.component.subTree||r):document.createComment("component"):null}_forwardSlots(){if(!this._shadowRoot||!this._container)return;let r=this.querySelectorAll("[slot]");for(let l of r){let o=l.getAttribute("slot")||"default",u=document.createElement("slot");o!=="default"&&u.setAttribute("name",o),this._container.appendChild(u)}let i=document.createElement("slot");this._container.appendChild(i)}_getSlotContent(){var o;let r={},i=this.querySelectorAll("[slot]");for(let u of i){let s=u.getAttribute("slot")||"default";r[s]||(r[s]=[]),r[s].push(u.cloneNode(!0))}let l=[];for(let u of Array.from(this.childNodes))(o=u.hasAttribute)!=null&&o.call(u,"slot")||l.push(u.cloneNode(!0));return l.length>0&&(r.default=l),r}get _lytInstance(){return this._instance}get _lytProps(){return{...this._props}}}}function S(e,t,n){if(!e.includes("-"))throw new Error(`[Lyt Web Component] \u6807\u7B7E\u540D "${e}" \u5FC5\u987B\u5305\u542B\u8FDE\u5B57\u7B26 (-)\u3002\u8FD9\u662F Custom Element \u89C4\u8303\u7684\u8981\u6C42\u3002`);if(!x())return;let a=de(t,n);customElements.define(e,a)}function fe(e){for(let{tagName:t,component:n,options:a}of e)S(t,n,a)}function pe(e){if(x())try{let t=customElements;t.__unregister&&t.__unregister(e)}catch(t){}}async function me(e,t,n){let a=t.match(/<template>([\s\S]*?)<\/template>/),c=t.match(/<script[^>]*>([\s\S]*?)<\/script>/),y=/<style[^>]*>([\s\S]*?)<\/style>/g,d=[],g;for(;(g=y.exec(t))!==null;)d.push(g);let m=(n==null?void 0:n.styles)||"";for(let i of d)m+=i[1]+`
|
|
2
|
-
`;let E=a?a[1].trim():void 0,h={};if(c){let i=c[1].trim();if(i.match(/export\s+default\s*(\{[\s\S]*\}|\([\s\S]*\)[\s\S]*?\))/))try{let o={},u={exports:o};new Function("module","exports",`"use strict"; ${i.replace(/export\s+default\s*/,"module.exports =")}`)(u,o),h=u.exports||o}catch(o){}}let r={...n,styles:m};E&&!h.template&&!h.render&&(h.template=E),S(e,h,r)}export*from"@lytjs/common";export{N as ErrorBoundary,j as Fragment,C as LytError,F as ShapeFlags,oe as createApp,S as defineCustomElement,me as defineCustomElementFromSFC,R as h,se as handleError,D as installPlugin,x as isBrowser,fe as registerComponents,L as uninstallPlugin,pe as unregisterElement};
|
|
1
|
+
import{isStringOrNumber as F,isArray as N,isVNode as T}from"@lytjs/common";var x=(s=>(s[s.ELEMENT=1]="ELEMENT",s[s.FUNCTIONAL_COMPONENT=2]="FUNCTIONAL_COMPONENT",s[s.STATEFUL_COMPONENT=4]="STATEFUL_COMPONENT",s[s.TEXT_CHILDREN=8]="TEXT_CHILDREN",s[s.ARRAY_CHILDREN=16]="ARRAY_CHILDREN",s[s.SLOTS_CHILDREN=32]="SLOTS_CHILDREN",s))(x||{}),h=Symbol("Fragment");function S(n,e){if(e!=null)if(F(e))n.children=String(e),n.shapeFlag|=8;else if(N(e)){let t=[];for(let i=0;i<e.length;i++){let r=e[i];if(!(r==null||typeof r=="boolean"))if(N(r))for(let c=0;c<r.length;c++){let s=r[c];s!=null&&typeof s!="boolean"&&t.push(T(s)?s:C(String(s)))}else T(r)?t.push(r):t.push(C(String(r)))}n.children=t,n.shapeFlag|=16}else typeof e=="object"&&(n.children=e,n.shapeFlag|=32)}function C(n,e=null,t=null){var u,p;let i=0;typeof n=="string"?i=1:n===h?i=0:typeof n=="function"?i=2:typeof n=="object"&&n!==null&&(n.setup||n.__vccOpts||n.render)&&(i=4);let r=(u=e==null?void 0:e.key)!=null?u:null,c=(p=e==null?void 0:e.ref)!=null?p:null,s=e;if(e){let{key:v,ref:d,...g}=e;s=g}let m={type:n,props:s,children:null,key:r,ref:c,shapeFlag:i,el:null,component:null};return t!=null&&S(m,t),m}function P(n,e,t){return C(n,e||null,t||null)}import{isPromise as I}from"@lytjs/common";function O(n){return Object.create(n||null)}function E(n){return n!==null&&typeof n=="object"&&typeof n.install=="function"}function L(n){return typeof n=="function"}function j(n,e,...t){if(E(e)){let i=e.onBeforeInstall?e.onBeforeInstall(n,...t):void 0;if(I(i))return i.then(()=>{let r=e.install(n,...t);if(I(r))return r.then(()=>{if(e.onInstalled)return e.onInstalled(n,...t)});if(e.onInstalled)return e.onInstalled(n,...t)});{let r=e.install(n,...t);if(I(r))return r.then(()=>{if(e.onInstalled)return e.onInstalled(n,...t)});if(e.onInstalled)return e.onInstalled(n,...t)}}else if(L(e))return e(n,...t)}function k(n,e){if(E(e)){if(typeof e.uninstall=="function")return e.uninstall(n)}else L(e)}import{effect as H,stop as M}from"@lytjs/reactivity";import{compile as B}from"@lytjs/compiler";import{defineComponent as w,createComponentInstance as U,setupComponent as z,mountComponent as $,updateComponent as q,unmountComponent as X}from"@lytjs/component";import{createRenderer as Y}from"@lytjs/renderer";var K=100,y=new Map;function Z(n){let e=y.get(n);if(e)return y.delete(n),y.set(n,e),e;let{code:t}=B(n);if(e=new Function("h","_ctx",`return ${t}`),y.size>=K){let i=y.keys().next().value;i!==void 0&&y.delete(i)}return y.set(n,e),e}function G(n){let e={...n};if(n.state&&typeof n.state!="function"){let t=n.state;e.state=()=>({...t})}if(typeof n.render=="function"){let t=n.render;e.render=(i,r)=>t(i)}if(n.computed){let t={};for(let i of Object.keys(n.computed)){let r=n.computed[i];typeof r=="function"?t[i]={get:r}:t[i]=r}e.computed=t}if(typeof n.init=="function"){let t=n.init;e.init=function(i,r){return t.call(this,i)}}return e}function J(){return{createElement(n){return document.createElement(n)},createText(n){return document.createTextNode(n)},createComment(n){return document.createComment(n)},setAttribute(n,e,t){n.setAttribute(e,String(t))},removeAttribute(n,e){n.removeAttribute(e)},setStyle(n,e){if(typeof e=="string")n.style.cssText=e;else if(e&&typeof e=="object")for(let t in e)n.style[t]=e[t]},setClass(n,e){if(typeof e=="string")n.className=e;else if(e&&typeof e=="object"){let t=[];for(let[i,r]of Object.entries(e))r&&t.push(i);n.className=t.join(" ")}else n.className=""},insert(n,e,t){t!=null?n.insertBefore(e,t):n.appendChild(e)},remove(n){n.parentNode&&n.parentNode.removeChild(n)},replace(n,e,t){n.replaceChild(t,e)},addEventListener(n,e,t,i){n.addEventListener(e,t,i)},removeEventListener(n,e,t){n.removeEventListener(e,t)},nextTick(n){Promise.resolve().then(n)},parentNode(n){return n.parentNode},nextSibling(n){return n.nextSibling},querySelector(n){return document.querySelector(n)}}}function Q(n,e){let t=new Set,i={},r={},c=O(),s={},m={},u=null,p=null,v=null,d=null,g=!1,D=G(typeof n=="function"?{render:n}:n),V=w(D),o={config:s,globalProperties:m,get _instance(){return u},mount(a){if(g)return o;let l;if(typeof a=="string"){if(l=document.querySelector(a),!l)throw new Error(`[Lyt] \u627E\u4E0D\u5230\u6302\u8F7D\u76EE\u6807: "${a}"`)}else l=a;d=l;let f=J();p=Y(f),u=U(V),z(u,e||{},null);let b=u.type;if(!b.render&&b.template){let R=Z(b.template);b.render=(A,_)=>R(A,_.renderProxy)}return $(u,P),u.subTree&&p.mount(u.subTree,l),v=H(()=>{if(!(!u||!u.isMounted||!p)&&(q(u,P),u.subTree&&d)){let R=d.firstChild,A=u.subTree;d.innerHTML="",p.mount(A,d)}},{lazy:!0}),g=!0,o},unmount(){g&&(v&&(M(v),v=null),u&&X(u),d&&(d.innerHTML=""),u=null,p=null,d=null,g=!1)},use(a,...l){if(t.has(a))return o;t.add(a);let f=j({use:o.use.bind(o),unuse:o.unuse.bind(o),isInstalled:o.isInstalled.bind(o),provide:o.provide.bind(o),inject:o.inject.bind(o),config:s,globalProperties:m},a,...l);return f instanceof Promise?f.then(()=>o):o},unuse(a){if(!t.has(a))return o;t.delete(a);let l=k({use:o.use.bind(o),unuse:o.unuse.bind(o),isInstalled:o.isInstalled.bind(o),provide:o.provide.bind(o),inject:o.inject.bind(o),config:s,globalProperties:m},a);return l instanceof Promise?l.then(()=>o):o},isInstalled(a){return t.has(a)},provide(a,l){return c[a]=l,o},inject(a,l){let f=c[a];return f!==void 0?f:l},component(a,l){return l?(i[a]=l,o):i[a]},directive(a,l){return l?(r[a]=l,o):r[a]}};return o}export*from"@lytjs/common";export{h as Fragment,x as ShapeFlags,Q as createApp,P as h};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"fileNames":["../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es5.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2015.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2016.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2017.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2018.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2019.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2020.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2021.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2022.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.dom.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.dom.iterable.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.dom.asynciterable.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.webworker.importscripts.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.scripthost.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2015.core.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2015.collection.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2015.generator.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2015.promise.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2016.intl.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2017.arraybuffer.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2017.date.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2017.object.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2017.string.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2017.intl.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2018.intl.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2018.promise.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2019.array.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2019.object.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2019.string.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2019.intl.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2020.bigint.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2020.date.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2020.promise.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2020.string.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2020.intl.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2020.number.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2021.promise.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2021.string.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2021.weakref.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2021.intl.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2022.array.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2022.error.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2022.intl.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2022.object.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2022.string.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2022.regexp.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.decorators.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.decorators.legacy.d.ts","../../../node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2022.full.d.ts","../../common/dist/types/is.d.ts","../../common/dist/types/object.d.ts","../../common/dist/types/string.d.ts","../../common/dist/types/path.d.ts","../../common/dist/types/emitter.d.ts","../../common/dist/types/subscription.d.ts","../../common/dist/types/cache.d.ts","../../common/dist/types/timing.d.ts","../../common/dist/types/scheduler.d.ts","../../common/dist/types/error-codes.d.ts","../../common/dist/types/lyt-error.d.ts","../../common/dist/types/warn.d.ts","../../common/dist/types/algorithm.d.ts","../../common/dist/types/index.d.ts","../src/h.ts","../src/plugin.ts","../../reactivity/dist/types/effect.d.ts","../../reactivity/dist/types/reactive.d.ts","../../reactivity/dist/types/ref.d.ts","../../reactivity/dist/types/computed.d.ts","../../reactivity/dist/types/watch.d.ts","../../reactivity/dist/types/signal.d.ts","../../reactivity/dist/types/signal-component.d.ts","../../reactivity/dist/types/index.d.ts","../../compiler/dist/types/ast/nodes.d.ts","../../compiler/dist/types/parser/html-parser.d.ts","../../compiler/dist/types/transform/transform.d.ts","../../compiler/dist/types/transform/optimize.d.ts","../../compiler/dist/types/patch-flags.d.ts","../../compiler/dist/types/codegen/codegen.d.ts","../../compiler/dist/types/sfc/parse-sfc.d.ts","../../compiler/dist/types/sfc/compile-sfc.d.ts","../../compiler/dist/types/sfc/index.d.ts","../../compiler/dist/types/index.d.ts","../../component/dist/types/signal-state.d.ts","../../component/dist/types/props.d.ts","../../component/dist/types/emit.d.ts","../../component/dist/types/lifecycle.d.ts","../../component/dist/types/slots.d.ts","../../component/dist/types/composition-api.d.ts","../../component/dist/types/define-component.d.ts","../../component/dist/types/index.d.ts","../../renderer/dist/types/vnode.d.ts","../../renderer/dist/types/renderer-interfaces.d.ts","../../renderer/dist/types/create-renderer.d.ts","../../renderer/dist/types/dom/dom-renderer.d.ts","../../renderer/dist/types/dom/dom-ops.d.ts","../../renderer/dist/types/dom/patch-props.d.ts","../../renderer/dist/types/dom/patch-events.d.ts","../../renderer/dist/types/index.d.ts","../src/create-app.ts","../src/lyt-error.ts","../src/warn.ts","../src/dev-error.ts","../src/error-codes.ts","../src/error-handling.ts","../src/error-entry.ts","../src/index.ts","../src/plugin-entry.ts","../src/shared-entry.ts","../src/web-component.ts","../src/web-component-entry.ts"],"fileIdsList":[[64,65,66,67,68,69,70,71,72,73,74,75,76],[73],[88],[88,89,90,91,92,93,96],[94],[94,95],[87,98,99,100,101,102,103],[98,99,100,101,102,103,104],[85],[78,79,87,97,105,113],[115,116],[77],[115,118,119],[77,78,114],[79],[124],[121],[82],[80,81,82,83,84,85,86],[107],[106,107,108,109,110,111,112],[106]],"fileInfos":[{"version":"bcd24271a113971ba9eb71ff8cb01bc6b0f872a85c23fdbe5d93065b375933cd","affectsGlobalScope":true,"impliedFormat":1},{"version":"3f88bedbeb09c6f5a6645cb24c7c55f1aa22d19ae96c8e6959cbd8b85a707bc6","impliedFormat":1},{"version":"7fe93b39b810eadd916be8db880dd7f0f7012a5cc6ffb62de8f62a2117fa6f1f","impliedFormat":1},{"version":"bb0074cc08b84a2374af33d8bf044b80851ccc9e719a5e202eacf40db2c31600","impliedFormat":1},{"version":"1a7daebe4f45fb03d9ec53d60008fbf9ac45a697fdc89e4ce218bc94b94f94d6","impliedFormat":1},{"version":"f94b133a3cb14a288803be545ac2683e0d0ff6661bcd37e31aaaec54fc382aed","impliedFormat":1},{"version":"f59d0650799f8782fd74cf73c19223730c6d1b9198671b1c5b3a38e1188b5953","impliedFormat":1},{"version":"8a15b4607d9a499e2dbeed9ec0d3c0d7372c850b2d5f1fb259e8f6d41d468a84","impliedFormat":1},{"version":"26e0fe14baee4e127f4365d1ae0b276f400562e45e19e35fd2d4c296684715e6","impliedFormat":1},{"version":"d6b1eba8496bdd0eed6fc8a685768fe01b2da4a0388b5fe7df558290bffcf32f","affectsGlobalScope":true,"impliedFormat":1},{"version":"7f57fc4404ff020bc45b9c620aff2b40f700b95fe31164024c453a5e3c163c54","impliedFormat":1},{"version":"7f57fc4404ff020bc45b9c620aff2b40f700b95fe31164024c453a5e3c163c54","impliedFormat":1},{"version":"2a2de5b9459b3fc44decd9ce6100b72f1b002ef523126c1d3d8b2a4a63d74d78","affectsGlobalScope":true,"impliedFormat":1},{"version":"f13f4b465c99041e912db5c44129a94588e1aafee35a50eab51044833f50b4ee","affectsGlobalScope":true,"impliedFormat":1},{"version":"eadcffda2aa84802c73938e589b9e58248d74c59cb7fcbca6474e3435ac15504","affectsGlobalScope":true,"impliedFormat":1},{"version":"105ba8ff7ba746404fe1a2e189d1d3d2e0eb29a08c18dded791af02f29fb4711","affectsGlobalScope":true,"impliedFormat":1},{"version":"00343ca5b2e3d48fa5df1db6e32ea2a59afab09590274a6cccb1dbae82e60c7c","affectsGlobalScope":true,"impliedFormat":1},{"version":"ebd9f816d4002697cb2864bea1f0b70a103124e18a8cd9645eeccc09bdf80ab4","affectsGlobalScope":true,"impliedFormat":1},{"version":"2c1afac30a01772cd2a9a298a7ce7706b5892e447bb46bdbeef720f7b5da77ad","affectsGlobalScope":true,"impliedFormat":1},{"version":"7b0225f483e4fa685625ebe43dd584bb7973bbd84e66a6ba7bbe175ee1048b4f","affectsGlobalScope":true,"impliedFormat":1},{"version":"c0a4b8ac6ce74679c1da2b3795296f5896e31c38e888469a8e0f99dc3305de60","affectsGlobalScope":true,"impliedFormat":1},{"version":"3084a7b5f569088e0146533a00830e206565de65cae2239509168b11434cd84f","affectsGlobalScope":true,"impliedFormat":1},{"version":"c5079c53f0f141a0698faa903e76cb41cd664e3efb01cc17a5c46ec2eb0bef42","affectsGlobalScope":true,"impliedFormat":1},{"version":"32cafbc484dea6b0ab62cf8473182bbcb23020d70845b406f80b7526f38ae862","affectsGlobalScope":true,"impliedFormat":1},{"version":"fca4cdcb6d6c5ef18a869003d02c9f0fd95df8cfaf6eb431cd3376bc034cad36","affectsGlobalScope":true,"impliedFormat":1},{"version":"b93ec88115de9a9dc1b602291b85baf825c85666bf25985cc5f698073892b467","affectsGlobalScope":true,"impliedFormat":1},{"version":"f5c06dcc3fe849fcb297c247865a161f995cc29de7aa823afdd75aaaddc1419b","affectsGlobalScope":true,"impliedFormat":1},{"version":"b77e16112127a4b169ef0b8c3a4d730edf459c5f25fe52d5e436a6919206c4d7","affectsGlobalScope":true,"impliedFormat":1},{"version":"fbffd9337146eff822c7c00acbb78b01ea7ea23987f6c961eba689349e744f8c","affectsGlobalScope":true,"impliedFormat":1},{"version":"a995c0e49b721312f74fdfb89e4ba29bd9824c770bbb4021d74d2bf560e4c6bd","affectsGlobalScope":true,"impliedFormat":1},{"version":"c7b3542146734342e440a84b213384bfa188835537ddbda50d30766f0593aff9","affectsGlobalScope":true,"impliedFormat":1},{"version":"ce6180fa19b1cccd07ee7f7dbb9a367ac19c0ed160573e4686425060b6df7f57","affectsGlobalScope":true,"impliedFormat":1},{"version":"3f02e2476bccb9dbe21280d6090f0df17d2f66b74711489415a8aa4df73c9675","affectsGlobalScope":true,"impliedFormat":1},{"version":"45e3ab34c1c013c8ab2dc1ba4c80c780744b13b5676800ae2e3be27ae862c40c","affectsGlobalScope":true,"impliedFormat":1},{"version":"805c86f6cca8d7702a62a844856dbaa2a3fd2abef0536e65d48732441dde5b5b","affectsGlobalScope":true,"impliedFormat":1},{"version":"e42e397f1a5a77994f0185fd1466520691456c772d06bf843e5084ceb879a0ad","affectsGlobalScope":true,"impliedFormat":1},{"version":"f4c2b41f90c95b1c532ecc874bd3c111865793b23aebcc1c3cbbabcd5d76ffb0","affectsGlobalScope":true,"impliedFormat":1},{"version":"ab26191cfad5b66afa11b8bf935ef1cd88fabfcb28d30b2dfa6fad877d050332","affectsGlobalScope":true,"impliedFormat":1},{"version":"2088bc26531e38fb05eedac2951480db5309f6be3fa4a08d2221abb0f5b4200d","affectsGlobalScope":true,"impliedFormat":1},{"version":"cb9d366c425fea79716a8fb3af0d78e6b22ebbab3bd64d25063b42dc9f531c1e","affectsGlobalScope":true,"impliedFormat":1},{"version":"500934a8089c26d57ebdb688fc9757389bb6207a3c8f0674d68efa900d2abb34","affectsGlobalScope":true,"impliedFormat":1},{"version":"689da16f46e647cef0d64b0def88910e818a5877ca5379ede156ca3afb780ac3","affectsGlobalScope":true,"impliedFormat":1},{"version":"bc21cc8b6fee4f4c2440d08035b7ea3c06b3511314c8bab6bef7a92de58a2593","affectsGlobalScope":true,"impliedFormat":1},{"version":"7ca53d13d2957003abb47922a71866ba7cb2068f8d154877c596d63c359fed25","affectsGlobalScope":true,"impliedFormat":1},{"version":"54725f8c4df3d900cb4dac84b64689ce29548da0b4e9b7c2de61d41c79293611","affectsGlobalScope":true,"impliedFormat":1},{"version":"e5594bc3076ac29e6c1ebda77939bc4c8833de72f654b6e376862c0473199323","affectsGlobalScope":true,"impliedFormat":1},{"version":"2f3eb332c2d73e729f3364fcc0c2b375e72a121e8157d25a82d67a138c83a95c","affectsGlobalScope":true,"impliedFormat":1},{"version":"6f4427f9642ce8d500970e4e69d1397f64072ab73b97e476b4002a646ac743b1","affectsGlobalScope":true,"impliedFormat":1},{"version":"48915f327cd1dea4d7bd358d9dc7732f58f9e1626a29cc0c05c8c692419d9bb7","affectsGlobalScope":true,"impliedFormat":1},{"version":"b7bf9377723203b5a6a4b920164df22d56a43f593269ba6ae1fdc97774b68855","affectsGlobalScope":true,"impliedFormat":1},{"version":"db9709688f82c9e5f65a119c64d835f906efe5f559d08b11642d56eb85b79357","affectsGlobalScope":true,"impliedFormat":1},{"version":"4b25b8c874acd1a4cf8444c3617e037d444d19080ac9f634b405583fd10ce1f7","affectsGlobalScope":true,"impliedFormat":1},{"version":"37be57d7c90cf1f8112ee2636a068d8fd181289f82b744160ec56a7dc158a9f5","affectsGlobalScope":true,"impliedFormat":1},{"version":"a917a49ac94cd26b754ab84e113369a75d1a47a710661d7cd25e961cc797065f","affectsGlobalScope":true,"impliedFormat":1},{"version":"6d3261badeb7843d157ef3e6f5d1427d0eeb0af0cf9df84a62cfd29fd47ac86e","affectsGlobalScope":true,"impliedFormat":1},{"version":"195daca651dde22f2167ac0d0a05e215308119a3100f5e6268e8317d05a92526","affectsGlobalScope":true,"impliedFormat":1},{"version":"8b11e4285cd2bb164a4dc09248bdec69e9842517db4ca47c1ba913011e44ff2f","affectsGlobalScope":true,"impliedFormat":1},{"version":"0508571a52475e245b02bc50fa1394065a0a3d05277fbf5120c3784b85651799","affectsGlobalScope":true,"impliedFormat":1},{"version":"8f9af488f510c3015af3cc8c267a9e9d96c4dd38a1fdff0e11dc5a544711415b","affectsGlobalScope":true,"impliedFormat":1},{"version":"fc611fea8d30ea72c6bbfb599c9b4d393ce22e2f5bfef2172534781e7d138104","affectsGlobalScope":true,"impliedFormat":1},{"version":"1ce14b81c5cc821994aa8ec1d42b220dd41b27fcc06373bce3958af7421b77d4","affectsGlobalScope":true,"impliedFormat":1},{"version":"b3a048b3e9302ef9a34ef4ebb9aecfb28b66abb3bce577206a79fee559c230da","affectsGlobalScope":true,"impliedFormat":1},{"version":"01a30f9e8582b369075c0808df71121e6855cb06fd8d3d39511d9ebb66405205","impliedFormat":1},"0242b74c149e317117aa6c97acce4ad116212ebfd963ae50bcfe8bb4fa6410d2","8220087127ce86b259fdbc78efac6cf14064a970393dd72047205a559a67a4cd","a0c71b9e3689601665669b5ad5a43d6adb2310947a3ca8e63a8bea9bf0602c95","525e3e3f106504c4e62d3564c5fea77ab17d72725981f45042ce51e9f6ae0220","66558f40fbf300cbba390965583590c6e9a874c6f95f42549fe6bf10f2ec35dd","4addbf2b9b6fcad145efc10233ce211a220cbc6a35b069d0a0467dd10ec5d855","5ef34083e9d734dfc751b5a45e046219bc29d4d9b97c51b2fad58f4305b52d7f","290759e0e7e335e470cb0b8fb085232ba92bbf53e3a6d7dfdc65423a4baf644c","0db5120e2a3e67bc5892e63f1bcf4a3d933755d5ac15fb7e1c989deb34fafd61","df3112eeed1593533b757b55fba51326c3984752f79699bc3a9c919c6556e901","1e74c319ebca519283c6be7486b2f44f2bc180f4394b8191801294081169e459","5679cb7e73eb8c28182e6455e3146ec797942cdaa0b52ece0559f1997a1dc420","9555e351c5d92cadc1e3bee2ed9735874050d48f1ab0d2f9339ab6d83865566e","df0f6ffe3276b650678e05f472d35c46ef581bc2d402dcf2c3e452a8b773b7c9",{"version":"ed184145481ac609cc92f49346ec2b396dbeca767fdf4b9801a39335a5db4408","signature":"8da3bbc534c6c3b5a758c92d46029b449f5b450b693a2fadf7f3b5b8e1193dd6"},{"version":"42514c64b82ac01abe410b23d44e644a24a635330d1f3662a124fc1d50bd9d49","signature":"f2ab99ad646b9d11aa9370652f4849fa5a65b3be7b509272600eb1b729c1c92f"},"a931971a0aed3a04be8ef1ef78e4bdd05af6d408bec44f846d3a0794dda5d708","f39120ae19c79ceffa561da071bbf53b5cf418f3ad9c186e895fa55c3c42ae31","5fe944eec62fa00578c1b68dd15a46847218f15c35eca212f86caed1469108e9","1bb4fc70e4d98ca7ef67079adde1ee3bfa3b3829ae948cf2ce5b7a332430ee65","132b0d4b346da8f6d6004dc9eb4bfc09c0d292e9325aff621b2332a12973199f","ecd41394ecea0650d670ed4cdba72fac8f219fdfa1cdcbfdcdeb79413d712d15","fe965a8da8781e4e6cef466ccccd5430dc040ae5f17615301f4203434701237c","5142c441d5148e0b3d8aaa232af01166540bc049913ded34fe2065e0ebe2cf16","8b5bd5ff52710d8bcc95ad06438f124e5035f6f999e0962a625a627c6cbaa021","b672301f6213a14ee5e0ad56a3503f678c35337c6f5dbcfdd785576b289f35b5","acc796ca42aa019c1426ac1400f0ed8cf0c467a8ea153044b2338901fd660ff6","98c3feb377f4ebaf4849b0cf27890325d05f9c5563fb05010a76125c30992eca","f44da91ac3c3129ba19ee963272ed427eb761efc0c6c67ad7e45be5c5016b313","6249f7b74c8b8b2422f29c66d6aea8681f87b77f99a990bc184bd09df5235a3c","f24f1e4dde89fcad8a16d83ee41396c4c0721dbd8589031c3b8b5605052aca10","d0da22a2d67875ae317f6fbd87c7767bf38554e3884b3c3230c6f3da71dc81e0","49254b5de8510bfe5a923535338c04f12c31b315ca448180a929d54b0d0961a8","7ef365e0bf6677c95eb0f59654e08ee4c71ab9c7a57d3d11c593e16a99122198","2234975d1fcdcb753e30d293166f907c926ef9d11af56b6e1050c45bd9975908","d8719f09ad5f2c84672042d065d7a6093f1112a777846773045796d065abaef1","93c1e1ffeda376466dd6ddb1f61bd1f82ee4083349eff033a9f4cd443f2abe04","bccc98e1e0a3a3b3a992843d3b7e1a86902f0d3e40eeb7d2d36fcadf1dd96a6c","20266ce07b679d16d991e0ea49a3b8699b5ed6c6d7962d1bfed43273543bc380","0c593fcd916773a7926a4d2e8b6f8b15fd2adeeb61ecd5639569e402ba72fb43","56bfb70b6d817e80fdea255c24f956e5791e8a1e988513c5e2221c23acfbedae","282c0998963e10c93a89a53a618c76c9f34b33c3ddfe22b4b860d10f2fe07ab7","de20bc27fab21c2c5ca1341569040f132680b4ace695aebe17cf19d55d6a75dd","371b35236cadf3a5614284d37d577ac3868e422715c926c1a5d8e9b4964d3084","21a68a9b94108bb8ea13af27a7ca1010f6b4493ca4b4349c91b7a3eada0ab5b0","fdf11aa8433694f2f5e90835c7384a5056293f75d7e24353612cc1cdccd222c1","51356357dc2b282ba36e0942147a9de1d6379ece336fcc59635e1f5ebe5d7722","076fa2932000bdeb0bdc8e19478a8651c61934b7ebcecba4662cdbe2531694b7","fa8ca9d1a9c2e191d194871cf9c85ab107db82c3f921fc1613da3681a49b3b4c","84f7c054d973b7531378d0791e5e5949d39d09554d8582e1ca75847703f591fc",{"version":"b7020cbf5dff79498a0231fd5286d946160f8b228d273260ee6c4a6226e242c5","signature":"c11319ef2c0b6f387812b87ea439341b4d35f444e502ce1221943e75886a0257"},{"version":"c04f23e059dfca157b651ba3fa8dc132852a85b5c33959067f16ddf82ab14bf9","signature":"9d45c613b7e8e22346616f7aa112249d8c2691f7ee2cf8864194c20d2d9796ad"},{"version":"73456792e3c1447d08958feb5f0e2e40e82ea73f74986bf47f4c53315eecc1ef","signature":"5679cb7e73eb8c28182e6455e3146ec797942cdaa0b52ece0559f1997a1dc420"},{"version":"8af946b6cf28773c62367f7a0b3a4d2d6afac876cc8264366d6e2d2c16ee0d73","signature":"6a570db802fd6c47d92c7a101d1ddee1207f5d431de7a6035b212a976de0c10b"},{"version":"9310d79a11169e04006114c360eea91970c391d1e895ed834b4ea2a4e8edaf78","signature":"db5caaeea7406cfdda7f9abe6a83167ff460dd08ccbdb09aa602039a22749983"},{"version":"2e8c3b24d5b9caee5ea07f163ab82d9f03bb259e021c7a0030f7c9c98ed9752f","signature":"64bdd684816d475a8435b847a9099add637fcdaf293e48a658f64e02e0e7670a"},{"version":"907da4e1b0f94517f1702dc0018fafad335ddba250192718e4de9b65acb17d47","signature":"c35869ee4300019465d34280557c3eb7bd250f6219f2400e3f6400874f27b4b0"},{"version":"e21826b241d4971fa9e85f502299036af3a0f4fa8ddcb5c6e11f15a2997e4429","signature":"869cfc27f8683a60f8e816da5b0bd78916d9f010eb57c35bb013db19b0a603e8"},{"version":"5dc3f873b79be89bf09b8a4efe95266040a69b7ee80d7dbd2a19b0e4ccd6b049","signature":"011b236e9dc204546f321090e3f3a9d72aad57c0646d3f6d78a575a074a9d5aa"},{"version":"afcdcb2388e089cccd3ac59089e47e8e348e95136bc652a58371260b93a27fb8","signature":"923d93ab3b0045896da10aa39dbe304ad854398def41d24d1c77c947370ad20c"},{"version":"5f74c5d31a5f2a729a537ce1cce1c7a86ecb0b17a0661a1469bd2fcb496f217c","signature":"8f965198a23f1073cfdf04ee9f6145c4eff2dc3b2c5be331c736ff6c94917d2d"},{"version":"2f167891f59e027f453b71d47e5379832cd452eb81529d5bb06d00df27bb2b3a","signature":"f55d4ddc8b51a7e4af21e2d311261240b9bf1ab702c9255678f09af781141f9d"}],"root":[78,79,[114,125]],"options":{"allowImportingTsExtensions":true,"composite":true,"declaration":true,"declarationMap":true,"emitDeclarationOnly":true,"esModuleInterop":true,"exactOptionalPropertyTypes":true,"module":99,"noEmitOnError":false,"noFallthroughCasesInSwitch":true,"noImplicitOverride":true,"noImplicitReturns":true,"noUncheckedIndexedAccess":true,"noUnusedLocals":true,"noUnusedParameters":true,"outDir":"./types","rootDir":"../src","skipLibCheck":true,"sourceMap":true,"strict":true,"target":9,"useDefineForClassFields":true,"verbatimModuleSyntax":true},"referencedMap":[[77,1],[74,2],[93,3],[97,4],[89,3],[95,5],[96,6],[91,3],[90,3],[104,7],[105,8],[98,9],[114,10],[117,11],[118,12],[120,13],[78,12],[121,14],[115,12],[122,15],[79,12],[123,12],[125,16],[124,17],[83,18],[87,19],[86,9],[84,18],[108,20],[109,20],[113,21],[107,22]],"semanticDiagnosticsPerFile":[[79,[{"start":468,"length":10,"messageText":"'isFunction' is declared but its value is never read.","category":1,"code":6133,"reportsUnnecessary":true},{"start":480,"length":13,"messageText":"'isPlainObject' is declared but its value is never read.","category":1,"code":6133,"reportsUnnecessary":true}]],[114,[{"start":701,"length":5,"messageText":"'Props' is declared but its value is never read.","category":1,"code":6133,"reportsUnnecessary":true},{"start":713,"length":8,"messageText":"'Children' is declared but its value is never read.","category":1,"code":6133,"reportsUnnecessary":true},{"start":723,"length":8,"messageText":"'Fragment' is declared but its value is never read.","category":1,"code":6133,"reportsUnnecessary":true},{"start":877,"length":8,"messageText":"'reactive' is declared but its value is never read.","category":1,"code":6133,"reportsUnnecessary":true},{"start":887,"length":8,"messageText":"'nextTick' is declared but its value is never read.","category":1,"code":6133,"reportsUnnecessary":true},{"start":1206,"length":15,"messageText":"'ComponentDefine' is declared but its value is never read.","category":1,"code":6133,"reportsUnnecessary":true},{"start":2442,"length":8,"code":2345,"category":1,"messageText":{"messageText":"Argument of type 'string | undefined' is not assignable to parameter of type 'string'.","category":1,"code":2345,"next":[{"messageText":"Type 'undefined' is not assignable to type 'string'.","category":1,"code":2322}]}},{"start":5614,"length":10,"messageText":"'isFunction' is declared but its value is never read.","category":1,"code":6133,"reportsUnnecessary":true},{"start":5728,"length":13,"messageText":"'isPlainObject' is declared but its value is never read.","category":1,"code":6133,"reportsUnnecessary":true},{"start":6556,"length":8,"messageText":"'instance' is declared but its value is never read.","category":1,"code":6133,"reportsUnnecessary":true},{"start":7342,"length":5,"messageText":"'state' is declared but its value is never read.","category":1,"code":6133,"reportsUnnecessary":true},{"start":14895,"length":5,"messageText":"'oldEl' is declared but its value is never read.","category":1,"code":6133,"reportsUnnecessary":true}]],[119,[{"start":5326,"length":2,"messageText":"'vm' is declared but its value is never read.","category":1,"code":6133,"reportsUnnecessary":true},{"start":5506,"length":9,"messageText":"'lastError' is possibly 'undefined'.","category":1,"code":18048},{"start":5523,"length":9,"messageText":"'lastError' is possibly 'undefined'.","category":1,"code":18048},{"start":5537,"length":9,"messageText":"'lastError' is possibly 'undefined'.","category":1,"code":18048},{"start":5951,"length":6,"code":2322,"category":1,"messageText":{"messageText":"Type '{ error?: Error; vm?: any; info?: string; timestamp?: number; }' is not assignable to type '{ error: Error; vm: any; info: string; timestamp: number; }'.","category":1,"code":2322,"next":[{"messageText":"Property 'error' is optional in type '{ error?: Error; vm?: any; info?: string; timestamp?: number; }' but required in type '{ error: Error; vm: any; info: string; timestamp: number; }'.","category":1,"code":2327}]}}]],[124,[{"start":1995,"length":12,"messageText":"'camelToKebab' is declared but its value is never read.","category":1,"code":6133,"reportsUnnecessary":true},{"start":4450,"length":9,"messageText":"'lytEvents' is declared but its value is never read.","category":1,"code":6133,"reportsUnnecessary":true},{"start":6499,"length":4,"messageText":"'name' is declared but its value is never read.","category":1,"code":6133,"reportsUnnecessary":true},{"start":22915,"length":16,"messageText":"Object is possibly 'undefined'.","category":1,"code":2532},{"start":23055,"length":14,"messageText":"Object is possibly 'undefined'.","category":1,"code":2532}]]],"latestChangedDtsFile":"./types/web-component-entry.d.ts","version":"6.0.2"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-app.d.ts","sourceRoot":"","sources":["../../src/create-app.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAK,KAAK,KAAK,EAAuC,MAAM,KAAK,CAAC;AACzE,OAAO,EAIL,KAAK,MAAM,EACX,KAAK,SAAS,EACf,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"create-app.d.ts","sourceRoot":"","sources":["../../src/create-app.ts"],"names":[],"mappings":"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"}
|
|
@@ -154,6 +154,10 @@ export declare function warnOnce(msg: string): void;
|
|
|
154
154
|
* 重置已警告消息集合(仅用于测试)
|
|
155
155
|
*/
|
|
156
156
|
export declare function resetWarnedMessages(): void;
|
|
157
|
+
/**
|
|
158
|
+
* 始终输出错误信息(不受开发/生产模式限制)
|
|
159
|
+
*/
|
|
160
|
+
export declare function error(msg: string): void;
|
|
157
161
|
/**
|
|
158
162
|
* 根据错误码生成友好的中文提示信息
|
|
159
163
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error-handling.d.ts","sourceRoot":"","sources":["../../src/error-handling.ts"],"names":[],"mappings":"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
|
|
1
|
+
{"version":3,"file":"error-handling.d.ts","sourceRoot":"","sources":["../../src/error-handling.ts"],"names":[],"mappings":"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"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -9,9 +9,5 @@ export type { App, ComponentOptions, DirectiveHooks, DirectiveBinding, } from '.
|
|
|
9
9
|
export { h, Fragment } from './h';
|
|
10
10
|
export type { VNode, Children, Props, } from './h';
|
|
11
11
|
export { ShapeFlags } from './h';
|
|
12
|
-
export { installPlugin, uninstallPlugin } from './plugin';
|
|
13
|
-
export { LytError, ErrorBoundary, handleError } from './error-handling';
|
|
14
|
-
export { defineCustomElement, registerComponents, unregisterElement, isBrowser, defineCustomElementFromSFC, } from './web-component';
|
|
15
|
-
export type { CustomElementOptions, ComponentRegistration, } from './web-component';
|
|
16
12
|
export * from '@lytjs/common';
|
|
17
13
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,YAAY,EACV,GAAG,EACH,gBAAgB,EAChB,cAAc,EACd,gBAAgB,GACjB,MAAM,cAAc,CAAC;AAMtB,OAAO,EAAE,CAAC,EAAE,QAAQ,EAAE,MAAM,KAAK,CAAC;AAElC,YAAY,EACV,KAAK,EACL,QAAQ,EACR,KAAK,GACN,MAAM,KAAK,CAAC;AAEb,OAAO,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,YAAY,EACV,GAAG,EACH,gBAAgB,EAChB,cAAc,EACd,gBAAgB,GACjB,MAAM,cAAc,CAAC;AAMtB,OAAO,EAAE,CAAC,EAAE,QAAQ,EAAE,MAAM,KAAK,CAAC;AAElC,YAAY,EACV,KAAK,EACL,QAAQ,EACR,KAAK,GACN,MAAM,KAAK,CAAC;AAEb,OAAO,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AA8CjC,cAAc,eAAe,CAAC"}
|
package/dist/types/warn.d.ts
CHANGED
|
@@ -1,8 +1,32 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Lyt.js 警告与错误输出工具
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* 提供 warn、warnOnce、error 等工具函数。
|
|
5
|
+
* 开发模式下输出详细信息,生产模式下静默。
|
|
6
|
+
* 纯原生零依赖 TypeScript 实现。
|
|
6
7
|
*/
|
|
7
|
-
|
|
8
|
+
/**
|
|
9
|
+
* 设置开发/生产模式
|
|
10
|
+
*/
|
|
11
|
+
export declare function setDevMode(mode: boolean): void;
|
|
12
|
+
/**
|
|
13
|
+
* 获取当前是否为开发模式
|
|
14
|
+
*/
|
|
15
|
+
export declare function getDevMode(): boolean;
|
|
16
|
+
/**
|
|
17
|
+
* 仅开发模式输出警告
|
|
18
|
+
*/
|
|
19
|
+
export declare function warn(msg: string): void;
|
|
20
|
+
/**
|
|
21
|
+
* 每条消息只警告一次
|
|
22
|
+
*/
|
|
23
|
+
export declare function warnOnce(msg: string): void;
|
|
24
|
+
/**
|
|
25
|
+
* 始终输出错误信息(不受开发/生产模式限制)
|
|
26
|
+
*/
|
|
27
|
+
export declare function error(msg: string): void;
|
|
28
|
+
/**
|
|
29
|
+
* 重置已警告消息集合(仅用于测试)
|
|
30
|
+
*/
|
|
31
|
+
export declare function resetWarnedMessages(): void;
|
|
8
32
|
//# sourceMappingURL=warn.d.ts.map
|
package/dist/types/warn.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"warn.d.ts","sourceRoot":"","sources":["../../src/warn.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"warn.d.ts","sourceRoot":"","sources":["../../src/warn.ts"],"names":[],"mappings":"AACA;;;;;;GAMG;AAQH;;GAEG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,CAE9C;AAED;;GAEG;AACH,wBAAgB,UAAU,IAAI,OAAO,CAEpC;AASD;;GAEG;AACH,wBAAgB,IAAI,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAGtC;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAK1C;AAED;;GAEG;AACH,wBAAgB,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAEvC;AAED;;GAEG;AACH,wBAAgB,mBAAmB,IAAI,IAAI,CAE1C"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var H=Object.defineProperty;var te=Object.getOwnPropertyDescriptor;var ne=Object.getOwnPropertyNames;var re=Object.prototype.hasOwnProperty;var G=(e,t)=>{for(var n in t)H(e,n,{get:t[n],enumerable:!0})},$=(e,t,n,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let l of ne(t))!re.call(e,l)&&l!==n&&H(e,l,{get:()=>t[l],enumerable:!(a=te(t,l))||a.enumerable});return e},N=(e,t,n)=>($(e,t,"default"),n&&$(n,t,"default"));var oe=e=>$(H({},"__esModule",{value:!0}),e);var ge={};G(ge,{defineCustomElement:()=>D,defineCustomElementFromSFC:()=>w,isBrowser:()=>P,registerComponents:()=>F,unregisterElement:()=>j});module.exports=oe(ge);var A={};G(A,{ErrorBoundary:()=>I,Fragment:()=>W,LytError:()=>b,ShapeFlags:()=>Y,createApp:()=>J,defineCustomElement:()=>D,defineCustomElementFromSFC:()=>w,h:()=>C,handleError:()=>Q,installPlugin:()=>x,isBrowser:()=>P,registerComponents:()=>F,uninstallPlugin:()=>S,unregisterElement:()=>j});var T=require("@lytjs/common"),Y=(d=>(d[d.ELEMENT=1]="ELEMENT",d[d.FUNCTIONAL_COMPONENT=2]="FUNCTIONAL_COMPONENT",d[d.STATEFUL_COMPONENT=4]="STATEFUL_COMPONENT",d[d.TEXT_CHILDREN=8]="TEXT_CHILDREN",d[d.ARRAY_CHILDREN=16]="ARRAY_CHILDREN",d[d.SLOTS_CHILDREN=32]="SLOTS_CHILDREN",d))(Y||{}),W=Symbol("Fragment");function ie(e,t){if(t!=null)if((0,T.isStringOrNumber)(t))e.children=String(t),e.shapeFlag|=8;else if((0,T.isArray)(t)){let n=[];for(let a=0;a<t.length;a++){let l=t[a];if(!(l==null||typeof l=="boolean"))if((0,T.isArray)(l))for(let y=0;y<l.length;y++){let d=l[y];d!=null&&typeof d!="boolean"&&n.push((0,T.isVNode)(d)?d:B(String(d)))}else(0,T.isVNode)(l)?n.push(l):n.push(B(String(l)))}e.children=n,e.shapeFlag|=16}else typeof t=="object"&&(e.children=t,e.shapeFlag|=32)}function B(e,t=null,n=null){var m,E;let a=0;typeof e=="string"?a=1:e===W?a=0:typeof e=="function"?a=2:typeof e=="object"&&e!==null&&(e.setup||e.__vccOpts||e.render)&&(a=4);let l=(m=t==null?void 0:t.key)!=null?m:null,y=(E=t==null?void 0:t.ref)!=null?E:null,d=t;if(t){let{key:h,ref:r,...i}=t;d=i}let g={type:e,props:d,children:null,key:l,ref:y,shapeFlag:a,el:null,component:null};return n!=null&&ie(g,n),g}function C(e,t,n){return B(e,t||null,n||null)}var L=require("@lytjs/common");function q(e){return Object.create(e||null)}function z(e){return e!==null&&typeof e=="object"&&typeof e.install=="function"}function X(e){return typeof e=="function"}function x(e,t,...n){if(z(t)){let a=t.onBeforeInstall?t.onBeforeInstall(e,...n):void 0;if((0,L.isPromise)(a))return a.then(()=>{let l=t.install(e,...n);if((0,L.isPromise)(l))return l.then(()=>{if(t.onInstalled)return t.onInstalled(e,...n)});if(t.onInstalled)return t.onInstalled(e,...n)});{let l=t.install(e,...n);if((0,L.isPromise)(l))return l.then(()=>{if(t.onInstalled)return t.onInstalled(e,...n)});if(t.onInstalled)return t.onInstalled(e,...n)}}else if(X(t))return t(e,...n)}function S(e,t){if(z(t)){if(typeof t.uninstall=="function")return t.uninstall(e)}else X(t)}var M=require("@lytjs/reactivity"),K=require("@lytjs/compiler"),R=require("@lytjs/component"),Z=require("@lytjs/renderer"),se=100,v=new Map;function ae(e){let t=v.get(e);if(t)return v.delete(e),v.set(e,t),t;let{code:n}=(0,K.compile)(e);if(t=new Function("h","_ctx",`return ${n}`),v.size>=se){let a=v.keys().next().value;v.delete(a)}return v.set(e,t),t}function le(e){let t={...e};if(e.state&&typeof e.state!="function"){let n=e.state;t.state=()=>({...n})}if(typeof e.render=="function"){let n=e.render;t.render=(a,l)=>n(a)}if(e.computed){let n={};for(let a of Object.keys(e.computed)){let l=e.computed[a];typeof l=="function"?n[a]={get:l}:n[a]=l}t.computed=n}if(typeof e.init=="function"){let n=e.init;t.init=function(a,l){return n.call(this,a)}}return t}function ce(){return{createElement(e){return document.createElement(e)},createText(e){return document.createTextNode(e)},createComment(e){return document.createComment(e)},setAttribute(e,t,n){e.setAttribute(t,String(n))},removeAttribute(e,t){e.removeAttribute(t)},setStyle(e,t){if(typeof t=="string")e.style.cssText=t;else if(t&&typeof t=="object")for(let n in t)e.style[n]=t[n]},setClass(e,t){if(typeof t=="string")e.className=t;else if(t&&typeof t=="object"){let n=[];for(let[a,l]of Object.entries(t))l&&n.push(a);e.className=n.join(" ")}else e.className=""},insert(e,t,n){n!=null?e.insertBefore(t,n):e.appendChild(t)},remove(e){e.parentNode&&e.parentNode.removeChild(e)},replace(e,t,n){e.replaceChild(n,t)},addEventListener(e,t,n,a){e.addEventListener(t,n,a)},removeEventListener(e,t,n){e.removeEventListener(t,n)},nextTick(e){Promise.resolve().then(e)},parentNode(e){return e.parentNode},nextSibling(e){return e.nextSibling},querySelector(e){return document.querySelector(e)}}}function J(e,t){let n=new Set,a={},l={},y=q(),d={},g={},m=null,E=null,h=null,r=null,i=!1,o=le(typeof e=="function"?{render:e}:e),u=(0,R.defineComponent)(o),s={config:d,globalProperties:g,get _instance(){return m},mount(f){if(i)return s;let p;if(typeof f=="string"){if(p=document.querySelector(f),!p)throw new Error(`[Lyt] \u627E\u4E0D\u5230\u6302\u8F7D\u76EE\u6807: "${f}"`)}else p=f;r=p;let _=ce();E=(0,Z.createRenderer)(_),m=(0,R.createComponentInstance)(u),(0,R.setupComponent)(m,t||{},null);let O=m.type;if(!O.render&&O.template){let k=ae(O.template);O.render=(U,ee)=>k(U,ee.renderProxy)}return(0,R.mountComponent)(m,C),m.subTree&&E.mount(m.subTree,p),h=(0,M.effect)(()=>{if(!(!m||!m.isMounted||!E)&&((0,R.updateComponent)(m,C),m.subTree&&r)){let k=r.firstChild,U=m.subTree;r.innerHTML="",E.mount(U,r)}},{lazy:!0}),i=!0,s},unmount(){i&&(h&&((0,M.stop)(h),h=null),m&&(0,R.unmountComponent)(m),r&&(r.innerHTML=""),m=null,E=null,r=null,i=!1)},use(f,...p){if(n.has(f))return s;n.add(f);let _=x({use:s.use.bind(s),unuse:s.unuse.bind(s),isInstalled:s.isInstalled.bind(s),provide:s.provide.bind(s),inject:s.inject.bind(s),config:d,globalProperties:g},f,...p);return _ instanceof Promise?_.then(()=>s):s},unuse(f){if(!n.has(f))return s;n.delete(f);let p=S({use:s.use.bind(s),unuse:s.unuse.bind(s),isInstalled:s.isInstalled.bind(s),provide:s.provide.bind(s),inject:s.inject.bind(s),config:d,globalProperties:g},f);return p instanceof Promise?p.then(()=>s):s},isInstalled(f){return n.has(f)},provide(f,p){return y[f]=p,s},inject(f,p){let _=y[f];return _!==void 0?_:p},component(f,p){return p?(a[f]=p,s):a[f]},directive(f,p){return p?(l[f]=p,s):l[f]}};return s}var b=class extends Error{constructor(t,n,a){let l=`[Lyt ${t}] ${n}`;super(l),this.name="LytError",this.code=t,this.details=a}};var V=class V{constructor(t){this.errors=[],this.options=t||{},this._hasError=!1}get hasError(){return this._hasError}static setGlobalHandler(t){V.globalHandler=t}capture(t,n,a){var d;let l={error:t,vm:n,info:a||"",timestamp:Date.now()};this.errors.push(l),this._hasError=!0;let y=(d=this.options.maxErrors)!=null?d:100;this.errors.length>y&&this.errors.splice(0,this.errors.length-y),!(this.options.onErrorCaptured&&this.options.onErrorCaptured(t instanceof b?t:new b(1004,t.message),n,l.info)===!0)&&this.options.onError&&this.options.onError(t instanceof b?t:new b(1004,t.message),n)}getFallback(t){if(!this.options.fallback||this.errors.length===0)return null;let n=this.errors[this.errors.length-1];return this.options.fallback(n.error,n.vm,n.info)}getErrors(){return this.errors.slice()}getErrorCount(){return this.errors.length}getLastErrors(){return this.errors.length===0?null:{...this.errors[this.errors.length-1]}}clear(){this.errors=[],this._hasError=!1}};V.globalHandler=null;var I=V,ue=!0;function Q(e,t,n){I.globalHandler&&I.globalHandler(e,t,n||""),ue&&e instanceof b&&e.details}N(A,require("@lytjs/common"));function P(){return typeof window!="undefined"&&typeof document!="undefined"&&typeof HTMLElement!="undefined"&&typeof customElements!="undefined"}function de(e){return e.replace(/-([a-z])/g,(t,n)=>n.toUpperCase())}function fe(e){if(e===""||e==="true")return!0;if(e==="false")return!1;if(e==="null")return null;if(e==="undefined")return;let t=Number(e);if(!isNaN(t)&&e.trim()!=="")return t;if(e.startsWith("{")&&e.endsWith("}")||e.startsWith("[")&&e.endsWith("]"))try{return JSON.parse(e)}catch(n){}return e}function pe(e,t){return t&&t[e]?t[e]:de(e)}function me(e){let t=[],n=e;if(n.emits&&(Array.isArray(n.emits)?t.push(...n.emits):typeof n.emits=="object"&&t.push(...Object.keys(n.emits))),n.methods){for(let a of Object.keys(n.methods))if(a.startsWith("on")&&a.length>2){let l=a.charAt(2).toLowerCase()+a.slice(3);t.push(l)}}return t}function ye(e,t={}){let{shadowMode:n="open",styles:a="",propMappings:l,eventMappings:y={},attributeConverters:d={}}=t,g=t.observedAttributes||[],m=me(e);return class extends HTMLElement{constructor(){super();this._shadowRoot=null;this._instance=null;this._props={};this._container=null;this._connected=!1;this._eventCleanups=[];this._effectCleanup=null;this._updateScheduled=!1}static get observedAttributes(){return g}connectedCallback(){if(!this._connected){if(this._connected=!0,this._shadowRoot=this.attachShadow({mode:n}),a){let r=document.createElement("style");r.textContent=a,this._shadowRoot.appendChild(r)}this._container=document.createElement("div"),this._shadowRoot.appendChild(this._container),this._syncAttributesToProps(),this._mountComponent(),this._forwardSlots()}}disconnectedCallback(){if(this._connected){this._connected=!1;for(let r of this._eventCleanups)r();this._eventCleanups=[],this._effectCleanup&&(this._effectCleanup(),this._effectCleanup=null),this._instance=null,this._container&&(this._container.innerHTML="")}}attributeChangedCallback(r,i,c){i!==c&&this._connected&&(this._syncAttributesToProps(),this._updateComponent())}_syncAttributesToProps(){let r={};for(let i of g)if(this.hasAttribute(i)){let c=this.getAttribute(i),o=pe(i,l);d[i]?r[o]=d[i](c):r[o]=fe(c)}if(e.props){for(let[i,c]of Object.entries(e.props))if(r[i]===void 0){let o=c;o&&typeof o=="object"&&"default"in o?r[i]=typeof o.default=="function"?o.default():o.default:o==null}}this._props=r}_mountComponent(){let r=e.render?e.render:e.template?this._compileTemplate(e.template):null;if(!r)return;let i=this._createComponentContext(),c=r.call(i,C,i);c&&this._container&&this._renderVNode(c,this._container),this._setupReactiveUpdates(i,r)}_compileTemplate(r){try{let i=Function("return require")(),{compile:c}=i("../../compiler/src/index.ts"),{code:o}=c(r);return new Function("h","_ctx",`return ${o}`)}catch(i){return null}}_createComponentContext(){let r=e.state?typeof e.state=="function"?e.state():{...e.state}:{},i=e.computed||{},c=e.methods||{},o={...this._props,...r};for(let[u,s]of Object.entries(i))typeof s=="function"?Object.defineProperty(o,u,{get:s.bind(o),enumerable:!0}):s&&typeof s=="object"&&"get"in s&&Object.defineProperty(o,u,{get:s.get.bind(o),enumerable:!0});for(let[u,s]of Object.entries(c))typeof s=="function"&&(o[u]=s.bind(o));return o.emit=(u,...s)=>{let f=y[u]||u,p=new CustomEvent(f,{detail:s.length===1?s[0]:s,bubbles:!0,composed:!0});this.dispatchEvent(p)},o.$el=this._container,o.$attrs={...this._props},o.$slots=this._getSlotContent(),o}_setupReactiveUpdates(r,i){try{let c=Function("return require")(),{effect:o,stop:u}=c("../../reactivity/src/index.ts"),s=o(()=>{if(!this._connected||!this._container)return;let p=i.call(r,C,r);p&&(this._container.innerHTML="",this._renderVNode(p,this._container))},{lazy:!0}),f=e.state?typeof e.state=="function"?Object.keys(e.state()):Object.keys(e.state):[];for(let p of f){let _=r[p];Object.defineProperty(r,p,{get(){return _},set(O){_=O;try{s()}catch(k){}},enumerable:!0})}this._effectCleanup=()=>{try{u(s)}catch(p){}}}catch(c){let o=e.state?typeof e.state=="function"?Object.keys(e.state()):Object.keys(e.state):[];for(let u of o){let f=r[u],p=this;Object.defineProperty(r,u,{get(){return f},set(_){f=_,p._scheduleUpdate(r,i)},enumerable:!0})}}}_scheduleUpdate(r,i){this._updateScheduled||(this._updateScheduled=!0,Promise.resolve().then(()=>{if(this._updateScheduled=!1,!this._connected||!this._container)return;let c=i.call(r,C,r);c&&(this._container.innerHTML="",this._renderVNode(c,this._container))}))}_updateComponent(){if(!this._container)return;let r=e.render?e.render:e.template?this._compileTemplate(e.template):null;if(!r)return;let i=this._createComponentContext(),c=r.call(i,C,i);this._container.innerHTML="",c&&this._renderVNode(c,this._container)}_renderVNode(r,i){let c=this._vNodeToElement(r);c&&i.appendChild(c)}_vNodeToElement(r){if(!r)return null;if(typeof r.type=="symbol"){let i=document.createDocumentFragment();if(Array.isArray(r.children))for(let c of r.children){let o=this._vNodeToElement(c);o&&i.appendChild(o)}return i}if(typeof r.children=="string")return document.createTextNode(r.children);if(typeof r.type=="string"){let i=document.createElement(r.type);if(r.props)for(let[c,o]of Object.entries(r.props))if(c==="style"&&typeof o=="object")for(let[u,s]of Object.entries(o))i.style[u]=s;else if(c==="class"){if(typeof o=="string")i.className=o;else if(typeof o=="object"){let u=[];for(let[s,f]of Object.entries(o))f&&u.push(s);i.className=u.join(" ")}}else if(c.startsWith("on")&&typeof o=="function"){let u=c.slice(2).toLowerCase();i.addEventListener(u,o),this._eventCleanups.push(()=>{i.removeEventListener(u,o)})}else c==="ref"&&typeof o=="function"?o(i):i.setAttribute(c,String(o));if(Array.isArray(r.children))for(let c of r.children){let o=this._vNodeToElement(c);o&&i.appendChild(o)}else typeof r.children=="string"&&(i.textContent=r.children);return i}return typeof r.type=="object"||typeof r.type=="function"?r.component?this._vNodeToElement(r.component.subTree||r):document.createComment("component"):null}_forwardSlots(){if(!this._shadowRoot||!this._container)return;let r=this.querySelectorAll("[slot]");for(let c of r){let o=c.getAttribute("slot")||"default",u=document.createElement("slot");o!=="default"&&u.setAttribute("name",o),this._container.appendChild(u)}let i=document.createElement("slot");this._container.appendChild(i)}_getSlotContent(){var o;let r={},i=this.querySelectorAll("[slot]");for(let u of i){let s=u.getAttribute("slot")||"default";r[s]||(r[s]=[]),r[s].push(u.cloneNode(!0))}let c=[];for(let u of Array.from(this.childNodes))(o=u.hasAttribute)!=null&&o.call(u,"slot")||c.push(u.cloneNode(!0));return c.length>0&&(r.default=c),r}get _lytInstance(){return this._instance}get _lytProps(){return{...this._props}}}}function D(e,t,n){if(!e.includes("-"))throw new Error(`[Lyt Web Component] \u6807\u7B7E\u540D "${e}" \u5FC5\u987B\u5305\u542B\u8FDE\u5B57\u7B26 (-)\u3002\u8FD9\u662F Custom Element \u89C4\u8303\u7684\u8981\u6C42\u3002`);if(!P())return;let a=ye(t,n);customElements.define(e,a)}function F(e){for(let{tagName:t,component:n,options:a}of e)D(t,n,a)}function j(e){if(P())try{let t=customElements;t.__unregister&&t.__unregister(e)}catch(t){}}async function w(e,t,n){let a=t.match(/<template>([\s\S]*?)<\/template>/),l=t.match(/<script[^>]*>([\s\S]*?)<\/script>/),y=/<style[^>]*>([\s\S]*?)<\/style>/g,d=[],g;for(;(g=y.exec(t))!==null;)d.push(g);let m=(n==null?void 0:n.styles)||"";for(let i of d)m+=i[1]+`
|
|
2
|
-
`;let
|
|
1
|
+
var S=Object.defineProperty;var J=Object.getOwnPropertyDescriptor;var G=Object.getOwnPropertyNames;var Q=Object.prototype.hasOwnProperty;var F=(e,t)=>{for(var n in t)S(e,n,{get:t[n],enumerable:!0})},k=(e,t,n,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let c of G(t))!Q.call(e,c)&&c!==n&&S(e,c,{get:()=>t[c],enumerable:!(a=J(t,c))||a.enumerable});return e},R=(e,t,n)=>(k(e,t,"default"),n&&k(n,t,"default"));var ee=e=>k(S({},"__esModule",{value:!0}),e);var de={};F(de,{defineCustomElement:()=>j,defineCustomElementFromSFC:()=>Y,isBrowser:()=>I,registerComponents:()=>K,unregisterElement:()=>X});module.exports=ee(de);var E={};F(E,{Fragment:()=>M,ShapeFlags:()=>V,createApp:()=>z,h:()=>_});var A=require("@lytjs/common"),V=(f=>(f[f.ELEMENT=1]="ELEMENT",f[f.FUNCTIONAL_COMPONENT=2]="FUNCTIONAL_COMPONENT",f[f.STATEFUL_COMPONENT=4]="STATEFUL_COMPONENT",f[f.TEXT_CHILDREN=8]="TEXT_CHILDREN",f[f.ARRAY_CHILDREN=16]="ARRAY_CHILDREN",f[f.SLOTS_CHILDREN=32]="SLOTS_CHILDREN",f))(V||{}),M=Symbol("Fragment");function te(e,t){if(t!=null)if((0,A.isStringOrNumber)(t))e.children=String(t),e.shapeFlag|=8;else if((0,A.isArray)(t)){let n=[];for(let a=0;a<t.length;a++){let c=t[a];if(!(c==null||typeof c=="boolean"))if((0,A.isArray)(c))for(let m=0;m<c.length;m++){let f=c[m];f!=null&&typeof f!="boolean"&&n.push((0,A.isVNode)(f)?f:w(String(f)))}else(0,A.isVNode)(c)?n.push(c):n.push(w(String(c)))}e.children=n,e.shapeFlag|=16}else typeof t=="object"&&(e.children=t,e.shapeFlag|=32)}function w(e,t=null,n=null){var y,h;let a=0;typeof e=="string"?a=1:e===M?a=0:typeof e=="function"?a=2:typeof e=="object"&&e!==null&&(e.setup||e.__vccOpts||e.render)&&(a=4);let c=(y=t==null?void 0:t.key)!=null?y:null,m=(h=t==null?void 0:t.ref)!=null?h:null,f=t;if(t){let{key:b,ref:o,...i}=t;f=i}let g={type:e,props:f,children:null,key:c,ref:m,shapeFlag:a,el:null,component:null};return n!=null&&te(g,n),g}function _(e,t,n){return w(e,t||null,n||null)}var T=require("@lytjs/common");function D(e){return Object.create(e||null)}function H(e){return e!==null&&typeof e=="object"&&typeof e.install=="function"}function B(e){return typeof e=="function"}function U(e,t,...n){if(H(t)){let a=t.onBeforeInstall?t.onBeforeInstall(e,...n):void 0;if((0,T.isPromise)(a))return a.then(()=>{let c=t.install(e,...n);if((0,T.isPromise)(c))return c.then(()=>{if(t.onInstalled)return t.onInstalled(e,...n)});if(t.onInstalled)return t.onInstalled(e,...n)});{let c=t.install(e,...n);if((0,T.isPromise)(c))return c.then(()=>{if(t.onInstalled)return t.onInstalled(e,...n)});if(t.onInstalled)return t.onInstalled(e,...n)}}else if(B(t))return t(e,...n)}function $(e,t){if(H(t)){if(typeof t.uninstall=="function")return t.uninstall(e)}else B(t)}var x=require("@lytjs/reactivity"),W=require("@lytjs/compiler"),v=require("@lytjs/component"),q=require("@lytjs/renderer"),ne=100,P=new Map;function oe(e){let t=P.get(e);if(t)return P.delete(e),P.set(e,t),t;let{code:n}=(0,W.compile)(e);if(t=new Function("h","_ctx",`return ${n}`),P.size>=ne){let a=P.keys().next().value;a!==void 0&&P.delete(a)}return P.set(e,t),t}function re(e){let t={...e};if(e.state&&typeof e.state!="function"){let n=e.state;t.state=()=>({...n})}if(typeof e.render=="function"){let n=e.render;t.render=(a,c)=>n(a)}if(e.computed){let n={};for(let a of Object.keys(e.computed)){let c=e.computed[a];typeof c=="function"?n[a]={get:c}:n[a]=c}t.computed=n}if(typeof e.init=="function"){let n=e.init;t.init=function(a,c){return n.call(this,a)}}return t}function ie(){return{createElement(e){return document.createElement(e)},createText(e){return document.createTextNode(e)},createComment(e){return document.createComment(e)},setAttribute(e,t,n){e.setAttribute(t,String(n))},removeAttribute(e,t){e.removeAttribute(t)},setStyle(e,t){if(typeof t=="string")e.style.cssText=t;else if(t&&typeof t=="object")for(let n in t)e.style[n]=t[n]},setClass(e,t){if(typeof t=="string")e.className=t;else if(t&&typeof t=="object"){let n=[];for(let[a,c]of Object.entries(t))c&&n.push(a);e.className=n.join(" ")}else e.className=""},insert(e,t,n){n!=null?e.insertBefore(t,n):e.appendChild(t)},remove(e){e.parentNode&&e.parentNode.removeChild(e)},replace(e,t,n){e.replaceChild(n,t)},addEventListener(e,t,n,a){e.addEventListener(t,n,a)},removeEventListener(e,t,n){e.removeEventListener(t,n)},nextTick(e){Promise.resolve().then(e)},parentNode(e){return e.parentNode},nextSibling(e){return e.nextSibling},querySelector(e){return document.querySelector(e)}}}function z(e,t){let n=new Set,a={},c={},m=D(),f={},g={},y=null,h=null,b=null,o=null,i=!1,r=re(typeof e=="function"?{render:e}:e),u=(0,v.defineComponent)(r),s={config:f,globalProperties:g,get _instance(){return y},mount(d){if(i)return s;let p;if(typeof d=="string"){if(p=document.querySelector(d),!p)throw new Error(`[Lyt] \u627E\u4E0D\u5230\u6302\u8F7D\u76EE\u6807: "${d}"`)}else p=d;o=p;let C=ie();h=(0,q.createRenderer)(C),y=(0,v.createComponentInstance)(u),(0,v.setupComponent)(y,t||{},null);let N=y.type;if(!N.render&&N.template){let L=oe(N.template);N.render=(O,Z)=>L(O,Z.renderProxy)}return(0,v.mountComponent)(y,_),y.subTree&&h.mount(y.subTree,p),b=(0,x.effect)(()=>{if(!(!y||!y.isMounted||!h)&&((0,v.updateComponent)(y,_),y.subTree&&o)){let L=o.firstChild,O=y.subTree;o.innerHTML="",h.mount(O,o)}},{lazy:!0}),i=!0,s},unmount(){i&&(b&&((0,x.stop)(b),b=null),y&&(0,v.unmountComponent)(y),o&&(o.innerHTML=""),y=null,h=null,o=null,i=!1)},use(d,...p){if(n.has(d))return s;n.add(d);let C=U({use:s.use.bind(s),unuse:s.unuse.bind(s),isInstalled:s.isInstalled.bind(s),provide:s.provide.bind(s),inject:s.inject.bind(s),config:f,globalProperties:g},d,...p);return C instanceof Promise?C.then(()=>s):s},unuse(d){if(!n.has(d))return s;n.delete(d);let p=$({use:s.use.bind(s),unuse:s.unuse.bind(s),isInstalled:s.isInstalled.bind(s),provide:s.provide.bind(s),inject:s.inject.bind(s),config:f,globalProperties:g},d);return p instanceof Promise?p.then(()=>s):s},isInstalled(d){return n.has(d)},provide(d,p){return m[d]=p,s},inject(d,p){let C=m[d];return C!==void 0?C:p},component(d,p){return p?(a[d]=p,s):a[d]},directive(d,p){return p?(c[d]=p,s):c[d]}};return s}R(E,require("@lytjs/common"));function I(){return typeof globalThis.window!="undefined"&&typeof globalThis.document!="undefined"&&typeof globalThis.HTMLElement!="undefined"&&typeof globalThis.customElements!="undefined"}function se(e){return e.replace(/-([a-z])/g,(t,n)=>n.toUpperCase())}function ae(e){if(e===""||e==="true")return!0;if(e==="false")return!1;if(e==="null")return null;if(e==="undefined")return;let t=Number(e);if(!isNaN(t)&&e.trim()!=="")return t;if(e.startsWith("{")&&e.endsWith("}")||e.startsWith("[")&&e.endsWith("]"))try{return JSON.parse(e)}catch(n){}return e}function le(e,t){return t&&t[e]?t[e]:se(e)}function ce(e){let t=[],n=e;if(n.emits&&(Array.isArray(n.emits)?t.push(...n.emits):typeof n.emits=="object"&&t.push(...Object.keys(n.emits))),n.methods){for(let a of Object.keys(n.methods))if(a.startsWith("on")&&a.length>2){let c=a.charAt(2).toLowerCase()+a.slice(3);t.push(c)}}return t}function ue(e,t={}){let{shadowMode:n="open",styles:a="",propMappings:c,eventMappings:m={},attributeConverters:f={}}=t,g=t.observedAttributes||[],y=ce(e);return class extends HTMLElement{constructor(){super();this._shadowRoot=null;this._instance=null;this._props={};this._container=null;this._connected=!1;this._eventCleanups=[];this._effectCleanup=null;this._updateScheduled=!1}static get observedAttributes(){return g}connectedCallback(){if(!this._connected){if(this._connected=!0,this._shadowRoot=this.attachShadow({mode:n}),a){let o=document.createElement("style");o.textContent=a,this._shadowRoot.appendChild(o)}this._container=document.createElement("div"),this._shadowRoot.appendChild(this._container),this._syncAttributesToProps(),this._mountComponent(),this._forwardSlots()}}disconnectedCallback(){if(this._connected){this._connected=!1;for(let o of this._eventCleanups)o();this._eventCleanups=[],this._effectCleanup&&(this._effectCleanup(),this._effectCleanup=null),this._instance=null,this._container&&(this._container.innerHTML="")}}attributeChangedCallback(o,i,l){i!==l&&this._connected&&(this._syncAttributesToProps(),this._updateComponent())}_syncAttributesToProps(){let o={};for(let i of g)if(this.hasAttribute(i)){let l=this.getAttribute(i),r=le(i,c);f[i]?o[r]=f[i](l):o[r]=ae(l)}if(e.props){for(let[i,l]of Object.entries(e.props))if(o[i]===void 0){let r=l;r&&typeof r=="object"&&"default"in r?o[i]=typeof r.default=="function"?r.default():r.default:r==null}}this._props=o}_mountComponent(){let o=e.render?e.render:e.template?this._compileTemplate(e.template):null;if(!o)return;let i=this._createComponentContext(),l=o.call(i,_,i);l&&this._container&&this._renderVNode(l,this._container),this._setupReactiveUpdates(i,o)}_compileTemplate(o){try{let i=Function("return require")(),{compile:l}=i("../../compiler/src/index.ts"),{code:r}=l(o);return new Function("h","_ctx",`return ${r}`)}catch(i){return null}}_createComponentContext(){let o=e.state?typeof e.state=="function"?e.state():{...e.state}:{},i=e.computed||{},l=e.methods||{},r={...this._props,...o};for(let[u,s]of Object.entries(i))typeof s=="function"?Object.defineProperty(r,u,{get:s.bind(r),enumerable:!0}):s&&typeof s=="object"&&"get"in s&&Object.defineProperty(r,u,{get:s.get.bind(r),enumerable:!0});for(let[u,s]of Object.entries(l))typeof s=="function"&&(r[u]=s.bind(r));return r.emit=(u,...s)=>{let d=m[u]||u,p=new CustomEvent(d,{detail:s.length===1?s[0]:s,bubbles:!0,composed:!0});this.dispatchEvent(p)},r.$el=this._container,r.$attrs={...this._props},r.$slots=this._getSlotContent(),r}_setupReactiveUpdates(o,i){try{let l=Function("return require")(),{effect:r,stop:u}=l("../../reactivity/src/index.ts"),s=r(()=>{if(!this._connected||!this._container)return;let p=i.call(o,_,o);p&&(this._container.innerHTML="",this._renderVNode(p,this._container))},{lazy:!0}),d=e.state?typeof e.state=="function"?Object.keys(e.state()):Object.keys(e.state):[];for(let p of d){let C=o[p];Object.defineProperty(o,p,{get(){return C},set(N){C=N;try{s()}catch(L){}},enumerable:!0})}this._effectCleanup=()=>{try{u(s)}catch(p){}}}catch(l){let r=e.state?typeof e.state=="function"?Object.keys(e.state()):Object.keys(e.state):[];for(let u of r){let d=o[u],p=this;Object.defineProperty(o,u,{get(){return d},set(C){d=C,p._scheduleUpdate(o,i)},enumerable:!0})}}}_scheduleUpdate(o,i){this._updateScheduled||(this._updateScheduled=!0,Promise.resolve().then(()=>{if(this._updateScheduled=!1,!this._connected||!this._container)return;let l=i.call(o,_,o);l&&(this._container.innerHTML="",this._renderVNode(l,this._container))}))}_updateComponent(){if(!this._container)return;let o=e.render?e.render:e.template?this._compileTemplate(e.template):null;if(!o)return;let i=this._createComponentContext(),l=o.call(i,_,i);this._container.innerHTML="",l&&this._renderVNode(l,this._container)}_renderVNode(o,i){let l=this._vNodeToElement(o);l&&i.appendChild(l)}_vNodeToElement(o){if(!o)return null;if(typeof o.type=="symbol"){let i=document.createDocumentFragment();if(Array.isArray(o.children))for(let l of o.children){let r=this._vNodeToElement(l);r&&i.appendChild(r)}return i}if(typeof o.children=="string")return document.createTextNode(o.children);if(typeof o.type=="string"){let i=document.createElement(o.type);if(o.props)for(let[l,r]of Object.entries(o.props))if(l==="style"&&typeof r=="object")for(let[u,s]of Object.entries(r))i.style[u]=s;else if(l==="class"){if(typeof r=="string")i.className=r;else if(typeof r=="object"){let u=[];for(let[s,d]of Object.entries(r))d&&u.push(s);i.className=u.join(" ")}}else if(l.startsWith("on")&&typeof r=="function"){let u=l.slice(2).toLowerCase();i.addEventListener(u,r),this._eventCleanups.push(()=>{i.removeEventListener(u,r)})}else l==="ref"&&typeof r=="function"?r(i):i.setAttribute(l,String(r));if(Array.isArray(o.children))for(let l of o.children){let r=this._vNodeToElement(l);r&&i.appendChild(r)}else typeof o.children=="string"&&(i.textContent=o.children);return i}return typeof o.type=="object"||typeof o.type=="function"?o.component?this._vNodeToElement(o.component.subTree||o):document.createComment("component"):null}_forwardSlots(){if(!this._shadowRoot||!this._container)return;let o=this.querySelectorAll("[slot]");for(let l of o){let r=l.getAttribute("slot")||"default",u=document.createElement("slot");r!=="default"&&u.setAttribute("name",r),this._container.appendChild(u)}let i=document.createElement("slot");this._container.appendChild(i)}_getSlotContent(){var r;let o={},i=this.querySelectorAll("[slot]");for(let u of i){let s=u.getAttribute("slot")||"default";o[s]||(o[s]=[]),o[s].push(u.cloneNode(!0))}let l=[];for(let u of Array.from(this.childNodes))(r=u.hasAttribute)!=null&&r.call(u,"slot")||l.push(u.cloneNode(!0));return l.length>0&&(o.default=l),o}get _lytInstance(){return this._instance}get _lytProps(){return{...this._props}}}}function j(e,t,n){if(!e.includes("-"))throw new Error(`[Lyt Web Component] \u6807\u7B7E\u540D "${e}" \u5FC5\u987B\u5305\u542B\u8FDE\u5B57\u7B26 (-)\u3002\u8FD9\u662F Custom Element \u89C4\u8303\u7684\u8981\u6C42\u3002`);if(!I())return;let a=ue(t,n);customElements.define(e,a)}function K(e){for(let{tagName:t,component:n,options:a}of e)j(t,n,a)}function X(e){if(I())try{let t=customElements;t.__unregister&&t.__unregister(e)}catch(t){}}async function Y(e,t,n){let a=t.match(/<template>([\s\S]*?)<\/template>/),c=t.match(/<script[^>]*>([\s\S]*?)<\/script>/),m=/<style[^>]*>([\s\S]*?)<\/style>/g,f=[],g;for(;(g=m.exec(t))!==null;)f.push(g);let y=(n==null?void 0:n.styles)||"";for(let i of f)y+=i[1]+`
|
|
2
|
+
`;let h=a?a[1].trim():void 0,b={};if(c){let i=c[1].trim();if(i.match(/export\s+default\s*(\{[\s\S]*\}|\([\s\S]*\)[\s\S]*?\))/))try{let r={},u={exports:r};new Function("module","exports",`"use strict"; ${i.replace(/export\s+default\s*/,"module.exports =")}`)(u,r),b=u.exports||r}catch(r){}}let o={...n,styles:y};h&&!b.template&&!b.render&&(b.template=h),j(e,b,o)}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var H=Object.defineProperty;var Z=Object.getOwnPropertyDescriptor;var J=Object.getOwnPropertyNames;var Q=Object.prototype.hasOwnProperty;var ee=(e,t)=>{for(var n in t)H(e,n,{get:t[n],enumerable:!0})},$=(e,t,n,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let l of J(t))!Q.call(e,l)&&l!==n&&H(e,l,{get:()=>t[l],enumerable:!(a=Z(t,l))||a.enumerable});return e},b=(e,t,n)=>($(e,t,"default"),n&&$(n,t,"default"));var C={};ee(C,{ErrorBoundary:()=>v,Fragment:()=>F,LytError:()=>A,ShapeFlags:()=>V,createApp:()=>z,defineCustomElement:()=>I,defineCustomElementFromSFC:()=>U,h:()=>R,handleError:()=>X,installPlugin:()=>P,isBrowser:()=>O,registerComponents:()=>w,uninstallPlugin:()=>D,unregisterElement:()=>k});import{isStringOrNumber as te,isArray as B,isVNode as Y}from"@lytjs/common";var V=(d=>(d[d.ELEMENT=1]="ELEMENT",d[d.FUNCTIONAL_COMPONENT=2]="FUNCTIONAL_COMPONENT",d[d.STATEFUL_COMPONENT=4]="STATEFUL_COMPONENT",d[d.TEXT_CHILDREN=8]="TEXT_CHILDREN",d[d.ARRAY_CHILDREN=16]="ARRAY_CHILDREN",d[d.SLOTS_CHILDREN=32]="SLOTS_CHILDREN",d))(V||{}),F=Symbol("Fragment");function ne(e,t){if(t!=null)if(te(t))e.children=String(t),e.shapeFlag|=8;else if(B(t)){let n=[];for(let a=0;a<t.length;a++){let l=t[a];if(!(l==null||typeof l=="boolean"))if(B(l))for(let y=0;y<l.length;y++){let d=l[y];d!=null&&typeof d!="boolean"&&n.push(Y(d)?d:M(String(d)))}else Y(l)?n.push(l):n.push(M(String(l)))}e.children=n,e.shapeFlag|=16}else typeof t=="object"&&(e.children=t,e.shapeFlag|=32)}function M(e,t=null,n=null){var m,E;let a=0;typeof e=="string"?a=1:e===F?a=0:typeof e=="function"?a=2:typeof e=="object"&&e!==null&&(e.setup||e.__vccOpts||e.render)&&(a=4);let l=(m=t==null?void 0:t.key)!=null?m:null,y=(E=t==null?void 0:t.ref)!=null?E:null,d=t;if(t){let{key:h,ref:r,...i}=t;d=i}let g={type:e,props:d,children:null,key:l,ref:y,shapeFlag:a,el:null,component:null};return n!=null&&ne(g,n),g}function R(e,t,n){return M(e,t||null,n||null)}import{isPromise as j}from"@lytjs/common";function W(e){return Object.create(e||null)}function G(e){return e!==null&&typeof e=="object"&&typeof e.install=="function"}function q(e){return typeof e=="function"}function P(e,t,...n){if(G(t)){let a=t.onBeforeInstall?t.onBeforeInstall(e,...n):void 0;if(j(a))return a.then(()=>{let l=t.install(e,...n);if(j(l))return l.then(()=>{if(t.onInstalled)return t.onInstalled(e,...n)});if(t.onInstalled)return t.onInstalled(e,...n)});{let l=t.install(e,...n);if(j(l))return l.then(()=>{if(t.onInstalled)return t.onInstalled(e,...n)});if(t.onInstalled)return t.onInstalled(e,...n)}}else if(q(t))return t(e,...n)}function D(e,t){if(G(t)){if(typeof t.uninstall=="function")return t.uninstall(e)}else q(t)}import{effect as re,stop as oe}from"@lytjs/reactivity";import{compile as ie}from"@lytjs/compiler";import{defineComponent as se,createComponentInstance as ae,setupComponent as le,mountComponent as ce,updateComponent as ue,unmountComponent as de}from"@lytjs/component";import{createRenderer as fe}from"@lytjs/renderer";var pe=100,N=new Map;function me(e){let t=N.get(e);if(t)return N.delete(e),N.set(e,t),t;let{code:n}=ie(e);if(t=new Function("h","_ctx",`return ${n}`),N.size>=pe){let a=N.keys().next().value;N.delete(a)}return N.set(e,t),t}function ye(e){let t={...e};if(e.state&&typeof e.state!="function"){let n=e.state;t.state=()=>({...n})}if(typeof e.render=="function"){let n=e.render;t.render=(a,l)=>n(a)}if(e.computed){let n={};for(let a of Object.keys(e.computed)){let l=e.computed[a];typeof l=="function"?n[a]={get:l}:n[a]=l}t.computed=n}if(typeof e.init=="function"){let n=e.init;t.init=function(a,l){return n.call(this,a)}}return t}function ge(){return{createElement(e){return document.createElement(e)},createText(e){return document.createTextNode(e)},createComment(e){return document.createComment(e)},setAttribute(e,t,n){e.setAttribute(t,String(n))},removeAttribute(e,t){e.removeAttribute(t)},setStyle(e,t){if(typeof t=="string")e.style.cssText=t;else if(t&&typeof t=="object")for(let n in t)e.style[n]=t[n]},setClass(e,t){if(typeof t=="string")e.className=t;else if(t&&typeof t=="object"){let n=[];for(let[a,l]of Object.entries(t))l&&n.push(a);e.className=n.join(" ")}else e.className=""},insert(e,t,n){n!=null?e.insertBefore(t,n):e.appendChild(t)},remove(e){e.parentNode&&e.parentNode.removeChild(e)},replace(e,t,n){e.replaceChild(n,t)},addEventListener(e,t,n,a){e.addEventListener(t,n,a)},removeEventListener(e,t,n){e.removeEventListener(t,n)},nextTick(e){Promise.resolve().then(e)},parentNode(e){return e.parentNode},nextSibling(e){return e.nextSibling},querySelector(e){return document.querySelector(e)}}}function z(e,t){let n=new Set,a={},l={},y=W(),d={},g={},m=null,E=null,h=null,r=null,i=!1,o=ye(typeof e=="function"?{render:e}:e),u=se(o),s={config:d,globalProperties:g,get _instance(){return m},mount(f){if(i)return s;let p;if(typeof f=="string"){if(p=document.querySelector(f),!p)throw new Error(`[Lyt] \u627E\u4E0D\u5230\u6302\u8F7D\u76EE\u6807: "${f}"`)}else p=f;r=p;let _=ge();E=fe(_),m=ae(u),le(m,t||{},null);let T=m.type;if(!T.render&&T.template){let x=me(T.template);T.render=(S,K)=>x(S,K.renderProxy)}return ce(m,R),m.subTree&&E.mount(m.subTree,p),h=re(()=>{if(!(!m||!m.isMounted||!E)&&(ue(m,R),m.subTree&&r)){let x=r.firstChild,S=m.subTree;r.innerHTML="",E.mount(S,r)}},{lazy:!0}),i=!0,s},unmount(){i&&(h&&(oe(h),h=null),m&&de(m),r&&(r.innerHTML=""),m=null,E=null,r=null,i=!1)},use(f,...p){if(n.has(f))return s;n.add(f);let _=P({use:s.use.bind(s),unuse:s.unuse.bind(s),isInstalled:s.isInstalled.bind(s),provide:s.provide.bind(s),inject:s.inject.bind(s),config:d,globalProperties:g},f,...p);return _ instanceof Promise?_.then(()=>s):s},unuse(f){if(!n.has(f))return s;n.delete(f);let p=D({use:s.use.bind(s),unuse:s.unuse.bind(s),isInstalled:s.isInstalled.bind(s),provide:s.provide.bind(s),inject:s.inject.bind(s),config:d,globalProperties:g},f);return p instanceof Promise?p.then(()=>s):s},isInstalled(f){return n.has(f)},provide(f,p){return y[f]=p,s},inject(f,p){let _=y[f];return _!==void 0?_:p},component(f,p){return p?(a[f]=p,s):a[f]},directive(f,p){return p?(l[f]=p,s):l[f]}};return s}var A=class extends Error{constructor(t,n,a){let l=`[Lyt ${t}] ${n}`;super(l),this.name="LytError",this.code=t,this.details=a}};var L=class L{constructor(t){this.errors=[],this.options=t||{},this._hasError=!1}get hasError(){return this._hasError}static setGlobalHandler(t){L.globalHandler=t}capture(t,n,a){var d;let l={error:t,vm:n,info:a||"",timestamp:Date.now()};this.errors.push(l),this._hasError=!0;let y=(d=this.options.maxErrors)!=null?d:100;this.errors.length>y&&this.errors.splice(0,this.errors.length-y),!(this.options.onErrorCaptured&&this.options.onErrorCaptured(t instanceof A?t:new A(1004,t.message),n,l.info)===!0)&&this.options.onError&&this.options.onError(t instanceof A?t:new A(1004,t.message),n)}getFallback(t){if(!this.options.fallback||this.errors.length===0)return null;let n=this.errors[this.errors.length-1];return this.options.fallback(n.error,n.vm,n.info)}getErrors(){return this.errors.slice()}getErrorCount(){return this.errors.length}getLastErrors(){return this.errors.length===0?null:{...this.errors[this.errors.length-1]}}clear(){this.errors=[],this._hasError=!1}};L.globalHandler=null;var v=L,Ee=!0;function X(e,t,n){v.globalHandler&&v.globalHandler(e,t,n||""),Ee&&e instanceof A&&e.details}b(C,qe);import*as qe from"@lytjs/common";function O(){return typeof window!="undefined"&&typeof document!="undefined"&&typeof HTMLElement!="undefined"&&typeof customElements!="undefined"}function he(e){return e.replace(/-([a-z])/g,(t,n)=>n.toUpperCase())}function _e(e){if(e===""||e==="true")return!0;if(e==="false")return!1;if(e==="null")return null;if(e==="undefined")return;let t=Number(e);if(!isNaN(t)&&e.trim()!=="")return t;if(e.startsWith("{")&&e.endsWith("}")||e.startsWith("[")&&e.endsWith("]"))try{return JSON.parse(e)}catch(n){}return e}function Re(e,t){return t&&t[e]?t[e]:he(e)}function Ce(e){let t=[],n=e;if(n.emits&&(Array.isArray(n.emits)?t.push(...n.emits):typeof n.emits=="object"&&t.push(...Object.keys(n.emits))),n.methods){for(let a of Object.keys(n.methods))if(a.startsWith("on")&&a.length>2){let l=a.charAt(2).toLowerCase()+a.slice(3);t.push(l)}}return t}function Ae(e,t={}){let{shadowMode:n="open",styles:a="",propMappings:l,eventMappings:y={},attributeConverters:d={}}=t,g=t.observedAttributes||[],m=Ce(e);return class extends HTMLElement{constructor(){super();this._shadowRoot=null;this._instance=null;this._props={};this._container=null;this._connected=!1;this._eventCleanups=[];this._effectCleanup=null;this._updateScheduled=!1}static get observedAttributes(){return g}connectedCallback(){if(!this._connected){if(this._connected=!0,this._shadowRoot=this.attachShadow({mode:n}),a){let r=document.createElement("style");r.textContent=a,this._shadowRoot.appendChild(r)}this._container=document.createElement("div"),this._shadowRoot.appendChild(this._container),this._syncAttributesToProps(),this._mountComponent(),this._forwardSlots()}}disconnectedCallback(){if(this._connected){this._connected=!1;for(let r of this._eventCleanups)r();this._eventCleanups=[],this._effectCleanup&&(this._effectCleanup(),this._effectCleanup=null),this._instance=null,this._container&&(this._container.innerHTML="")}}attributeChangedCallback(r,i,c){i!==c&&this._connected&&(this._syncAttributesToProps(),this._updateComponent())}_syncAttributesToProps(){let r={};for(let i of g)if(this.hasAttribute(i)){let c=this.getAttribute(i),o=Re(i,l);d[i]?r[o]=d[i](c):r[o]=_e(c)}if(e.props){for(let[i,c]of Object.entries(e.props))if(r[i]===void 0){let o=c;o&&typeof o=="object"&&"default"in o?r[i]=typeof o.default=="function"?o.default():o.default:o==null}}this._props=r}_mountComponent(){let r=e.render?e.render:e.template?this._compileTemplate(e.template):null;if(!r)return;let i=this._createComponentContext(),c=r.call(i,R,i);c&&this._container&&this._renderVNode(c,this._container),this._setupReactiveUpdates(i,r)}_compileTemplate(r){try{let i=Function("return require")(),{compile:c}=i("../../compiler/src/index.ts"),{code:o}=c(r);return new Function("h","_ctx",`return ${o}`)}catch(i){return null}}_createComponentContext(){let r=e.state?typeof e.state=="function"?e.state():{...e.state}:{},i=e.computed||{},c=e.methods||{},o={...this._props,...r};for(let[u,s]of Object.entries(i))typeof s=="function"?Object.defineProperty(o,u,{get:s.bind(o),enumerable:!0}):s&&typeof s=="object"&&"get"in s&&Object.defineProperty(o,u,{get:s.get.bind(o),enumerable:!0});for(let[u,s]of Object.entries(c))typeof s=="function"&&(o[u]=s.bind(o));return o.emit=(u,...s)=>{let f=y[u]||u,p=new CustomEvent(f,{detail:s.length===1?s[0]:s,bubbles:!0,composed:!0});this.dispatchEvent(p)},o.$el=this._container,o.$attrs={...this._props},o.$slots=this._getSlotContent(),o}_setupReactiveUpdates(r,i){try{let c=Function("return require")(),{effect:o,stop:u}=c("../../reactivity/src/index.ts"),s=o(()=>{if(!this._connected||!this._container)return;let p=i.call(r,R,r);p&&(this._container.innerHTML="",this._renderVNode(p,this._container))},{lazy:!0}),f=e.state?typeof e.state=="function"?Object.keys(e.state()):Object.keys(e.state):[];for(let p of f){let _=r[p];Object.defineProperty(r,p,{get(){return _},set(T){_=T;try{s()}catch(x){}},enumerable:!0})}this._effectCleanup=()=>{try{u(s)}catch(p){}}}catch(c){let o=e.state?typeof e.state=="function"?Object.keys(e.state()):Object.keys(e.state):[];for(let u of o){let f=r[u],p=this;Object.defineProperty(r,u,{get(){return f},set(_){f=_,p._scheduleUpdate(r,i)},enumerable:!0})}}}_scheduleUpdate(r,i){this._updateScheduled||(this._updateScheduled=!0,Promise.resolve().then(()=>{if(this._updateScheduled=!1,!this._connected||!this._container)return;let c=i.call(r,R,r);c&&(this._container.innerHTML="",this._renderVNode(c,this._container))}))}_updateComponent(){if(!this._container)return;let r=e.render?e.render:e.template?this._compileTemplate(e.template):null;if(!r)return;let i=this._createComponentContext(),c=r.call(i,R,i);this._container.innerHTML="",c&&this._renderVNode(c,this._container)}_renderVNode(r,i){let c=this._vNodeToElement(r);c&&i.appendChild(c)}_vNodeToElement(r){if(!r)return null;if(typeof r.type=="symbol"){let i=document.createDocumentFragment();if(Array.isArray(r.children))for(let c of r.children){let o=this._vNodeToElement(c);o&&i.appendChild(o)}return i}if(typeof r.children=="string")return document.createTextNode(r.children);if(typeof r.type=="string"){let i=document.createElement(r.type);if(r.props)for(let[c,o]of Object.entries(r.props))if(c==="style"&&typeof o=="object")for(let[u,s]of Object.entries(o))i.style[u]=s;else if(c==="class"){if(typeof o=="string")i.className=o;else if(typeof o=="object"){let u=[];for(let[s,f]of Object.entries(o))f&&u.push(s);i.className=u.join(" ")}}else if(c.startsWith("on")&&typeof o=="function"){let u=c.slice(2).toLowerCase();i.addEventListener(u,o),this._eventCleanups.push(()=>{i.removeEventListener(u,o)})}else c==="ref"&&typeof o=="function"?o(i):i.setAttribute(c,String(o));if(Array.isArray(r.children))for(let c of r.children){let o=this._vNodeToElement(c);o&&i.appendChild(o)}else typeof r.children=="string"&&(i.textContent=r.children);return i}return typeof r.type=="object"||typeof r.type=="function"?r.component?this._vNodeToElement(r.component.subTree||r):document.createComment("component"):null}_forwardSlots(){if(!this._shadowRoot||!this._container)return;let r=this.querySelectorAll("[slot]");for(let c of r){let o=c.getAttribute("slot")||"default",u=document.createElement("slot");o!=="default"&&u.setAttribute("name",o),this._container.appendChild(u)}let i=document.createElement("slot");this._container.appendChild(i)}_getSlotContent(){var o;let r={},i=this.querySelectorAll("[slot]");for(let u of i){let s=u.getAttribute("slot")||"default";r[s]||(r[s]=[]),r[s].push(u.cloneNode(!0))}let c=[];for(let u of Array.from(this.childNodes))(o=u.hasAttribute)!=null&&o.call(u,"slot")||c.push(u.cloneNode(!0));return c.length>0&&(r.default=c),r}get _lytInstance(){return this._instance}get _lytProps(){return{...this._props}}}}function I(e,t,n){if(!e.includes("-"))throw new Error(`[Lyt Web Component] \u6807\u7B7E\u540D "${e}" \u5FC5\u987B\u5305\u542B\u8FDE\u5B57\u7B26 (-)\u3002\u8FD9\u662F Custom Element \u89C4\u8303\u7684\u8981\u6C42\u3002`);if(!O())return;let a=Ae(t,n);customElements.define(e,a)}function w(e){for(let{tagName:t,component:n,options:a}of e)I(t,n,a)}function k(e){if(O())try{let t=customElements;t.__unregister&&t.__unregister(e)}catch(t){}}async function U(e,t,n){let a=t.match(/<template>([\s\S]*?)<\/template>/),l=t.match(/<script[^>]*>([\s\S]*?)<\/script>/),y=/<style[^>]*>([\s\S]*?)<\/style>/g,d=[],g;for(;(g=y.exec(t))!==null;)d.push(g);let m=(n==null?void 0:n.styles)||"";for(let i of d)m+=i[1]+`
|
|
2
|
-
`;let
|
|
1
|
+
var S=Object.defineProperty;var W=Object.getOwnPropertyDescriptor;var q=Object.getOwnPropertyNames;var z=Object.prototype.hasOwnProperty;var K=(e,t)=>{for(var n in t)S(e,n,{get:t[n],enumerable:!0})},k=(e,t,n,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let c of q(t))!z.call(e,c)&&c!==n&&S(e,c,{get:()=>t[c],enumerable:!(a=W(t,c))||a.enumerable});return e},E=(e,t,n)=>(k(e,t,"default"),n&&k(n,t,"default"));var A={};K(A,{Fragment:()=>I,ShapeFlags:()=>x,createApp:()=>U,h:()=>v});import{isStringOrNumber as X,isArray as w,isVNode as V}from"@lytjs/common";var x=(f=>(f[f.ELEMENT=1]="ELEMENT",f[f.FUNCTIONAL_COMPONENT=2]="FUNCTIONAL_COMPONENT",f[f.STATEFUL_COMPONENT=4]="STATEFUL_COMPONENT",f[f.TEXT_CHILDREN=8]="TEXT_CHILDREN",f[f.ARRAY_CHILDREN=16]="ARRAY_CHILDREN",f[f.SLOTS_CHILDREN=32]="SLOTS_CHILDREN",f))(x||{}),I=Symbol("Fragment");function Y(e,t){if(t!=null)if(X(t))e.children=String(t),e.shapeFlag|=8;else if(w(t)){let n=[];for(let a=0;a<t.length;a++){let c=t[a];if(!(c==null||typeof c=="boolean"))if(w(c))for(let m=0;m<c.length;m++){let f=c[m];f!=null&&typeof f!="boolean"&&n.push(V(f)?f:T(String(f)))}else V(c)?n.push(c):n.push(T(String(c)))}e.children=n,e.shapeFlag|=16}else typeof t=="object"&&(e.children=t,e.shapeFlag|=32)}function T(e,t=null,n=null){var y,h;let a=0;typeof e=="string"?a=1:e===I?a=0:typeof e=="function"?a=2:typeof e=="object"&&e!==null&&(e.setup||e.__vccOpts||e.render)&&(a=4);let c=(y=t==null?void 0:t.key)!=null?y:null,m=(h=t==null?void 0:t.ref)!=null?h:null,f=t;if(t){let{key:b,ref:o,...i}=t;f=i}let g={type:e,props:f,children:null,key:c,ref:m,shapeFlag:a,el:null,component:null};return n!=null&&Y(g,n),g}function v(e,t,n){return T(e,t||null,n||null)}import{isPromise as j}from"@lytjs/common";function M(e){return Object.create(e||null)}function F(e){return e!==null&&typeof e=="object"&&typeof e.install=="function"}function D(e){return typeof e=="function"}function H(e,t,...n){if(F(t)){let a=t.onBeforeInstall?t.onBeforeInstall(e,...n):void 0;if(j(a))return a.then(()=>{let c=t.install(e,...n);if(j(c))return c.then(()=>{if(t.onInstalled)return t.onInstalled(e,...n)});if(t.onInstalled)return t.onInstalled(e,...n)});{let c=t.install(e,...n);if(j(c))return c.then(()=>{if(t.onInstalled)return t.onInstalled(e,...n)});if(t.onInstalled)return t.onInstalled(e,...n)}}else if(D(t))return t(e,...n)}function B(e,t){if(F(t)){if(typeof t.uninstall=="function")return t.uninstall(e)}else D(t)}import{effect as Z,stop as J}from"@lytjs/reactivity";import{compile as G}from"@lytjs/compiler";import{defineComponent as Q,createComponentInstance as ee,setupComponent as te,mountComponent as ne,updateComponent as oe,unmountComponent as re}from"@lytjs/component";import{createRenderer as ie}from"@lytjs/renderer";var se=100,_=new Map;function ae(e){let t=_.get(e);if(t)return _.delete(e),_.set(e,t),t;let{code:n}=G(e);if(t=new Function("h","_ctx",`return ${n}`),_.size>=se){let a=_.keys().next().value;a!==void 0&&_.delete(a)}return _.set(e,t),t}function le(e){let t={...e};if(e.state&&typeof e.state!="function"){let n=e.state;t.state=()=>({...n})}if(typeof e.render=="function"){let n=e.render;t.render=(a,c)=>n(a)}if(e.computed){let n={};for(let a of Object.keys(e.computed)){let c=e.computed[a];typeof c=="function"?n[a]={get:c}:n[a]=c}t.computed=n}if(typeof e.init=="function"){let n=e.init;t.init=function(a,c){return n.call(this,a)}}return t}function ce(){return{createElement(e){return document.createElement(e)},createText(e){return document.createTextNode(e)},createComment(e){return document.createComment(e)},setAttribute(e,t,n){e.setAttribute(t,String(n))},removeAttribute(e,t){e.removeAttribute(t)},setStyle(e,t){if(typeof t=="string")e.style.cssText=t;else if(t&&typeof t=="object")for(let n in t)e.style[n]=t[n]},setClass(e,t){if(typeof t=="string")e.className=t;else if(t&&typeof t=="object"){let n=[];for(let[a,c]of Object.entries(t))c&&n.push(a);e.className=n.join(" ")}else e.className=""},insert(e,t,n){n!=null?e.insertBefore(t,n):e.appendChild(t)},remove(e){e.parentNode&&e.parentNode.removeChild(e)},replace(e,t,n){e.replaceChild(n,t)},addEventListener(e,t,n,a){e.addEventListener(t,n,a)},removeEventListener(e,t,n){e.removeEventListener(t,n)},nextTick(e){Promise.resolve().then(e)},parentNode(e){return e.parentNode},nextSibling(e){return e.nextSibling},querySelector(e){return document.querySelector(e)}}}function U(e,t){let n=new Set,a={},c={},m=M(),f={},g={},y=null,h=null,b=null,o=null,i=!1,r=le(typeof e=="function"?{render:e}:e),u=Q(r),s={config:f,globalProperties:g,get _instance(){return y},mount(d){if(i)return s;let p;if(typeof d=="string"){if(p=document.querySelector(d),!p)throw new Error(`[Lyt] \u627E\u4E0D\u5230\u6302\u8F7D\u76EE\u6807: "${d}"`)}else p=d;o=p;let C=ce();h=ie(C),y=ee(u),te(y,t||{},null);let P=y.type;if(!P.render&&P.template){let N=ae(P.template);P.render=(R,$)=>N(R,$.renderProxy)}return ne(y,v),y.subTree&&h.mount(y.subTree,p),b=Z(()=>{if(!(!y||!y.isMounted||!h)&&(oe(y,v),y.subTree&&o)){let N=o.firstChild,R=y.subTree;o.innerHTML="",h.mount(R,o)}},{lazy:!0}),i=!0,s},unmount(){i&&(b&&(J(b),b=null),y&&re(y),o&&(o.innerHTML=""),y=null,h=null,o=null,i=!1)},use(d,...p){if(n.has(d))return s;n.add(d);let C=H({use:s.use.bind(s),unuse:s.unuse.bind(s),isInstalled:s.isInstalled.bind(s),provide:s.provide.bind(s),inject:s.inject.bind(s),config:f,globalProperties:g},d,...p);return C instanceof Promise?C.then(()=>s):s},unuse(d){if(!n.has(d))return s;n.delete(d);let p=B({use:s.use.bind(s),unuse:s.unuse.bind(s),isInstalled:s.isInstalled.bind(s),provide:s.provide.bind(s),inject:s.inject.bind(s),config:f,globalProperties:g},d);return p instanceof Promise?p.then(()=>s):s},isInstalled(d){return n.has(d)},provide(d,p){return m[d]=p,s},inject(d,p){let C=m[d];return C!==void 0?C:p},component(d,p){return p?(a[d]=p,s):a[d]},directive(d,p){return p?(c[d]=p,s):c[d]}};return s}E(A,Fe);import*as Fe from"@lytjs/common";function L(){return typeof globalThis.window!="undefined"&&typeof globalThis.document!="undefined"&&typeof globalThis.HTMLElement!="undefined"&&typeof globalThis.customElements!="undefined"}function ue(e){return e.replace(/-([a-z])/g,(t,n)=>n.toUpperCase())}function de(e){if(e===""||e==="true")return!0;if(e==="false")return!1;if(e==="null")return null;if(e==="undefined")return;let t=Number(e);if(!isNaN(t)&&e.trim()!=="")return t;if(e.startsWith("{")&&e.endsWith("}")||e.startsWith("[")&&e.endsWith("]"))try{return JSON.parse(e)}catch(n){}return e}function fe(e,t){return t&&t[e]?t[e]:ue(e)}function pe(e){let t=[],n=e;if(n.emits&&(Array.isArray(n.emits)?t.push(...n.emits):typeof n.emits=="object"&&t.push(...Object.keys(n.emits))),n.methods){for(let a of Object.keys(n.methods))if(a.startsWith("on")&&a.length>2){let c=a.charAt(2).toLowerCase()+a.slice(3);t.push(c)}}return t}function ye(e,t={}){let{shadowMode:n="open",styles:a="",propMappings:c,eventMappings:m={},attributeConverters:f={}}=t,g=t.observedAttributes||[],y=pe(e);return class extends HTMLElement{constructor(){super();this._shadowRoot=null;this._instance=null;this._props={};this._container=null;this._connected=!1;this._eventCleanups=[];this._effectCleanup=null;this._updateScheduled=!1}static get observedAttributes(){return g}connectedCallback(){if(!this._connected){if(this._connected=!0,this._shadowRoot=this.attachShadow({mode:n}),a){let o=document.createElement("style");o.textContent=a,this._shadowRoot.appendChild(o)}this._container=document.createElement("div"),this._shadowRoot.appendChild(this._container),this._syncAttributesToProps(),this._mountComponent(),this._forwardSlots()}}disconnectedCallback(){if(this._connected){this._connected=!1;for(let o of this._eventCleanups)o();this._eventCleanups=[],this._effectCleanup&&(this._effectCleanup(),this._effectCleanup=null),this._instance=null,this._container&&(this._container.innerHTML="")}}attributeChangedCallback(o,i,l){i!==l&&this._connected&&(this._syncAttributesToProps(),this._updateComponent())}_syncAttributesToProps(){let o={};for(let i of g)if(this.hasAttribute(i)){let l=this.getAttribute(i),r=fe(i,c);f[i]?o[r]=f[i](l):o[r]=de(l)}if(e.props){for(let[i,l]of Object.entries(e.props))if(o[i]===void 0){let r=l;r&&typeof r=="object"&&"default"in r?o[i]=typeof r.default=="function"?r.default():r.default:r==null}}this._props=o}_mountComponent(){let o=e.render?e.render:e.template?this._compileTemplate(e.template):null;if(!o)return;let i=this._createComponentContext(),l=o.call(i,v,i);l&&this._container&&this._renderVNode(l,this._container),this._setupReactiveUpdates(i,o)}_compileTemplate(o){try{let i=Function("return require")(),{compile:l}=i("../../compiler/src/index.ts"),{code:r}=l(o);return new Function("h","_ctx",`return ${r}`)}catch(i){return null}}_createComponentContext(){let o=e.state?typeof e.state=="function"?e.state():{...e.state}:{},i=e.computed||{},l=e.methods||{},r={...this._props,...o};for(let[u,s]of Object.entries(i))typeof s=="function"?Object.defineProperty(r,u,{get:s.bind(r),enumerable:!0}):s&&typeof s=="object"&&"get"in s&&Object.defineProperty(r,u,{get:s.get.bind(r),enumerable:!0});for(let[u,s]of Object.entries(l))typeof s=="function"&&(r[u]=s.bind(r));return r.emit=(u,...s)=>{let d=m[u]||u,p=new CustomEvent(d,{detail:s.length===1?s[0]:s,bubbles:!0,composed:!0});this.dispatchEvent(p)},r.$el=this._container,r.$attrs={...this._props},r.$slots=this._getSlotContent(),r}_setupReactiveUpdates(o,i){try{let l=Function("return require")(),{effect:r,stop:u}=l("../../reactivity/src/index.ts"),s=r(()=>{if(!this._connected||!this._container)return;let p=i.call(o,v,o);p&&(this._container.innerHTML="",this._renderVNode(p,this._container))},{lazy:!0}),d=e.state?typeof e.state=="function"?Object.keys(e.state()):Object.keys(e.state):[];for(let p of d){let C=o[p];Object.defineProperty(o,p,{get(){return C},set(P){C=P;try{s()}catch(N){}},enumerable:!0})}this._effectCleanup=()=>{try{u(s)}catch(p){}}}catch(l){let r=e.state?typeof e.state=="function"?Object.keys(e.state()):Object.keys(e.state):[];for(let u of r){let d=o[u],p=this;Object.defineProperty(o,u,{get(){return d},set(C){d=C,p._scheduleUpdate(o,i)},enumerable:!0})}}}_scheduleUpdate(o,i){this._updateScheduled||(this._updateScheduled=!0,Promise.resolve().then(()=>{if(this._updateScheduled=!1,!this._connected||!this._container)return;let l=i.call(o,v,o);l&&(this._container.innerHTML="",this._renderVNode(l,this._container))}))}_updateComponent(){if(!this._container)return;let o=e.render?e.render:e.template?this._compileTemplate(e.template):null;if(!o)return;let i=this._createComponentContext(),l=o.call(i,v,i);this._container.innerHTML="",l&&this._renderVNode(l,this._container)}_renderVNode(o,i){let l=this._vNodeToElement(o);l&&i.appendChild(l)}_vNodeToElement(o){if(!o)return null;if(typeof o.type=="symbol"){let i=document.createDocumentFragment();if(Array.isArray(o.children))for(let l of o.children){let r=this._vNodeToElement(l);r&&i.appendChild(r)}return i}if(typeof o.children=="string")return document.createTextNode(o.children);if(typeof o.type=="string"){let i=document.createElement(o.type);if(o.props)for(let[l,r]of Object.entries(o.props))if(l==="style"&&typeof r=="object")for(let[u,s]of Object.entries(r))i.style[u]=s;else if(l==="class"){if(typeof r=="string")i.className=r;else if(typeof r=="object"){let u=[];for(let[s,d]of Object.entries(r))d&&u.push(s);i.className=u.join(" ")}}else if(l.startsWith("on")&&typeof r=="function"){let u=l.slice(2).toLowerCase();i.addEventListener(u,r),this._eventCleanups.push(()=>{i.removeEventListener(u,r)})}else l==="ref"&&typeof r=="function"?r(i):i.setAttribute(l,String(r));if(Array.isArray(o.children))for(let l of o.children){let r=this._vNodeToElement(l);r&&i.appendChild(r)}else typeof o.children=="string"&&(i.textContent=o.children);return i}return typeof o.type=="object"||typeof o.type=="function"?o.component?this._vNodeToElement(o.component.subTree||o):document.createComment("component"):null}_forwardSlots(){if(!this._shadowRoot||!this._container)return;let o=this.querySelectorAll("[slot]");for(let l of o){let r=l.getAttribute("slot")||"default",u=document.createElement("slot");r!=="default"&&u.setAttribute("name",r),this._container.appendChild(u)}let i=document.createElement("slot");this._container.appendChild(i)}_getSlotContent(){var r;let o={},i=this.querySelectorAll("[slot]");for(let u of i){let s=u.getAttribute("slot")||"default";o[s]||(o[s]=[]),o[s].push(u.cloneNode(!0))}let l=[];for(let u of Array.from(this.childNodes))(r=u.hasAttribute)!=null&&r.call(u,"slot")||l.push(u.cloneNode(!0));return l.length>0&&(o.default=l),o}get _lytInstance(){return this._instance}get _lytProps(){return{...this._props}}}}function O(e,t,n){if(!e.includes("-"))throw new Error(`[Lyt Web Component] \u6807\u7B7E\u540D "${e}" \u5FC5\u987B\u5305\u542B\u8FDE\u5B57\u7B26 (-)\u3002\u8FD9\u662F Custom Element \u89C4\u8303\u7684\u8981\u6C42\u3002`);if(!L())return;let a=ye(t,n);customElements.define(e,a)}function me(e){for(let{tagName:t,component:n,options:a}of e)O(t,n,a)}function ge(e){if(L())try{let t=customElements;t.__unregister&&t.__unregister(e)}catch(t){}}async function he(e,t,n){let a=t.match(/<template>([\s\S]*?)<\/template>/),c=t.match(/<script[^>]*>([\s\S]*?)<\/script>/),m=/<style[^>]*>([\s\S]*?)<\/style>/g,f=[],g;for(;(g=m.exec(t))!==null;)f.push(g);let y=(n==null?void 0:n.styles)||"";for(let i of f)y+=i[1]+`
|
|
2
|
+
`;let h=a?a[1].trim():void 0,b={};if(c){let i=c[1].trim();if(i.match(/export\s+default\s*(\{[\s\S]*\}|\([\s\S]*\)[\s\S]*?\))/))try{let r={},u={exports:r};new Function("module","exports",`"use strict"; ${i.replace(/export\s+default\s*/,"module.exports =")}`)(u,r),b=u.exports||r}catch(r){}}let o={...n,styles:y};h&&!b.template&&!b.render&&(b.template=h),O(e,b,o)}export{O as defineCustomElement,he as defineCustomElementFromSFC,L as isBrowser,me as registerComponents,ge as unregisterElement};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lytjs/core",
|
|
3
|
-
"version": "4.0
|
|
3
|
+
"version": "4.1.0",
|
|
4
4
|
"description": "Lyt.js 核心入口 - 整合响应式、编译器、虚拟 DOM、渲染器和组件系统",
|
|
5
5
|
"main": "./dist/index.cjs",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -61,12 +61,12 @@
|
|
|
61
61
|
"createApp"
|
|
62
62
|
],
|
|
63
63
|
"dependencies": {
|
|
64
|
-
"@lytjs/common": "^4.0
|
|
65
|
-
"@lytjs/reactivity": "^4.0
|
|
66
|
-
"@lytjs/compiler": "^4.0
|
|
67
|
-
"@lytjs/vdom": "^4.0
|
|
68
|
-
"@lytjs/renderer": "^4.0
|
|
69
|
-
"@lytjs/component": "^4.0
|
|
64
|
+
"@lytjs/common": "^4.1.0",
|
|
65
|
+
"@lytjs/reactivity": "^4.1.0",
|
|
66
|
+
"@lytjs/compiler": "^4.1.0",
|
|
67
|
+
"@lytjs/vdom": "^4.1.0",
|
|
68
|
+
"@lytjs/renderer": "^4.1.0",
|
|
69
|
+
"@lytjs/component": "^4.1.0"
|
|
70
70
|
},
|
|
71
71
|
"engines": {
|
|
72
72
|
"node": ">=18.0.0"
|