@lytjs/core 3.1.0 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/error-entry.cjs +1 -0
- package/dist/error-entry.mjs +1 -0
- package/dist/index.cjs +1 -52
- package/dist/index.mjs +1 -52
- package/dist/plugin-entry.cjs +1 -0
- package/dist/plugin-entry.mjs +1 -0
- package/dist/types/error-entry.d.ts +14 -0
- package/dist/types/error-entry.d.ts.map +1 -0
- package/dist/types/index.d.ts +0 -12
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/plugin-entry.d.ts +9 -0
- package/dist/types/plugin-entry.d.ts.map +1 -0
- package/dist/types/web-component-entry.d.ts +9 -0
- package/dist/types/web-component-entry.d.ts.map +1 -0
- package/dist/web-component-entry.cjs +2 -0
- package/dist/web-component-entry.mjs +2 -0
- package/package.json +31 -19
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var o=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var h=Object.getOwnPropertyNames;var G=Object.prototype.hasOwnProperty;var x=(_,R)=>{for(var r in R)o(_,r,{get:R[r],enumerable:!0})},v=(_,R,r,O)=>{if(R&&typeof R=="object"||typeof R=="function")for(let e of h(R))!G.call(_,e)&&e!==r&&o(_,e,{get:()=>R[e],enumerable:!(O=m(R,e))||O.enumerable});return _};var $=_=>v(o({},"__esModule",{value:!0}),_);var B={};x(B,{ErrorBoundary:()=>N,ErrorCategory:()=>I,LytError:()=>n,LytErrorCodes:()=>s,NewLytError:()=>t,NewLytErrorCodes:()=>C,callWithErrorHandling:()=>p,createCompilerError:()=>f,createComponentError:()=>c,createMessage:()=>g,createRendererError:()=>F,getCategory:()=>i,getDevMode:()=>V,getErrorMessage:()=>D,handleError:()=>P,resetWarnedMessages:()=>U,setDevMode:()=>u,warn:()=>S,warnOnce:()=>Y,warnOnceUtil:()=>Y,warnUtil:()=>S});module.exports=$(B);var s=(T=>(T[T.INVALID_ARGUMENT=1001]="INVALID_ARGUMENT",T[T.NOT_FOUND=1002]="NOT_FOUND",T[T.ALREADY_EXISTS=1003]="ALREADY_EXISTS",T[T.OPERATION_FAILED=1004]="OPERATION_FAILED",T[T.REACTIVE_READONLY=2001]="REACTIVE_READONLY",T[T.REACTIVE_EFFECT_DISPOSED=2002]="REACTIVE_EFFECT_DISPOSED",T[T.COMPUTED_CYCLE=2003]="COMPUTED_CYCLE",T[T.PARSE_ERROR=3001]="PARSE_ERROR",T[T.INVALID_EXPRESSION=3002]="INVALID_EXPRESSION",T[T.INVALID_DIRECTIVE=3003]="INVALID_DIRECTIVE",T[T.INVALID_TEMPLATE=3004]="INVALID_TEMPLATE",T[T.RENDER_ERROR=4001]="RENDER_ERROR",T[T.HYDRATION_MISMATCH=4002]="HYDRATION_MISMATCH",T[T.INVALID_VNODE=4003]="INVALID_VNODE",T[T.COMPONENT_INVALID_PROPS=5001]="COMPONENT_INVALID_PROPS",T[T.COMPONENT_MISSING_TEMPLATE=5002]="COMPONENT_MISSING_TEMPLATE",T[T.COMPONENT_LIFECYCLE_ERROR=5003]="COMPONENT_LIFECYCLE_ERROR",T[T.ROUTE_NOT_FOUND=6001]="ROUTE_NOT_FOUND",T[T.ROUTE_DUPLICATE=6002]="ROUTE_DUPLICATE",T[T.NAVIGATION_ABORTED=6003]="NAVIGATION_ABORTED",T[T.NAVIGATION_FAILED=6004]="NAVIGATION_FAILED",T[T.STORE_NOT_FOUND=7001]="STORE_NOT_FOUND",T[T.STORE_DUPLICATE=7002]="STORE_DUPLICATE",T))(s||{});var n=class extends Error{constructor(R,r,O){let e=`[Lyt ${R}] ${r}`;super(e),this.name="LytError",this.code=R,this.details=O}};var A=class A{constructor(R){this.errors=[],this.options=R||{},this._hasError=!1}get hasError(){return this._hasError}static setGlobalHandler(R){A.globalHandler=R}capture(R,r,O){var l;let e={error:R,vm:r,info:O||"",timestamp:Date.now()};this.errors.push(e),this._hasError=!0;let M=(l=this.options.maxErrors)!=null?l:100;this.errors.length>M&&this.errors.splice(0,this.errors.length-M),!(this.options.onErrorCaptured&&this.options.onErrorCaptured(R instanceof n?R:new n(1004,R.message),r,e.info)===!0)&&this.options.onError&&this.options.onError(R instanceof n?R:new n(1004,R.message),r)}getFallback(R){if(!this.options.fallback||this.errors.length===0)return null;let r=this.errors[this.errors.length-1];return this.options.fallback(r.error,r.vm,r.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}};A.globalHandler=null;var N=A,L=!0,a=new Set;function u(_){L=_}function V(){return L}function S(_){}function Y(_){L&&(a.has(_)||a.add(_))}function U(){a.clear()}var H={1001:_=>`\u53C2\u6570 "${_}" \u65E0\u6548\u3002\u8BF7\u68C0\u67E5\u4F20\u5165\u7684\u503C\u7C7B\u578B\u548C\u8303\u56F4\u3002`,1002:_=>`"${_}" \u672A\u627E\u5230\u3002\u8BF7\u786E\u8BA4\u8D44\u6E90\u540D\u79F0\u6216\u8DEF\u5F84\u662F\u5426\u6B63\u786E\u3002`,1003:_=>`"${_}" \u5DF2\u5B58\u5728\u3002\u8BF7\u4F7F\u7528\u4E0D\u540C\u7684\u540D\u79F0\u3002`,1004:_=>`\u64CD\u4F5C "${_}" \u6267\u884C\u5931\u8D25\u3002\u8BF7\u68C0\u67E5\u76F8\u5173\u914D\u7F6E\u548C\u72B6\u6001\u3002`,2001:_=>`\u65E0\u6CD5\u4FEE\u6539\u53EA\u8BFB\u54CD\u5E94\u5F0F\u5C5E\u6027 "${_}"\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:_=>`\u6A21\u677F\u89E3\u6790\u9519\u8BEF\uFF1A${_}\u3002\u8BF7\u68C0\u67E5\u6A21\u677F\u8BED\u6CD5\u662F\u5426\u6B63\u786E\u3002`,3002:_=>`\u65E0\u6548\u7684\u8868\u8FBE\u5F0F "${_}"\u3002\u8BF7\u68C0\u67E5\u8868\u8FBE\u5F0F\u8BED\u6CD5\u3002`,3003:_=>`\u65E0\u6548\u7684\u6307\u4EE4 "${_}"\u3002\u8BF7\u786E\u8BA4\u6307\u4EE4\u540D\u79F0\u662F\u5426\u6B63\u786E\u3002`,3004:_=>`\u65E0\u6548\u7684\u6A21\u677F\uFF1A${_}\u3002\u8BF7\u68C0\u67E5\u6A21\u677F\u5185\u5BB9\u3002`,4001:_=>`\u6E32\u67D3\u9519\u8BEF\uFF1A${_}\u3002\u8BF7\u68C0\u67E5\u7EC4\u4EF6\u7684 render \u51FD\u6570\u6216\u6A21\u677F\u3002`,4002:_=>`\u6C34\u5408\u4E0D\u5339\u914D\uFF1A${_}\u3002\u670D\u52A1\u7AEF\u6E32\u67D3\u4E0E\u5BA2\u6237\u7AEF\u6E32\u67D3\u7ED3\u679C\u4E0D\u4E00\u81F4\u3002`,4003:_=>`\u65E0\u6548\u7684\u865A\u62DF\u8282\u70B9\uFF1A${_}\u3002VNode \u7F3A\u5C11\u5FC5\u8981\u7684 type \u6216\u5176\u4ED6\u5C5E\u6027\u3002`,5001:_=>`\u7EC4\u4EF6\u5C5E\u6027\u65E0\u6548\uFF1A${_}\u3002\u8BF7\u68C0\u67E5\u4F20\u5165\u7684 props \u662F\u5426\u7B26\u5408\u7EC4\u4EF6\u5B9A\u4E49\u3002`,5002:_=>`\u7EC4\u4EF6 "${_}" \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:_=>`\u7EC4\u4EF6\u751F\u547D\u5468\u671F\u9519\u8BEF\uFF1A${_}\u3002\u8BF7\u68C0\u67E5\u751F\u547D\u5468\u671F\u94A9\u5B50\u51FD\u6570\u3002`,6001:_=>`\u8DEF\u7531 "${_}" \u672A\u627E\u5230\u3002\u8BF7\u786E\u8BA4\u8DEF\u7531\u8DEF\u5F84\u662F\u5426\u5DF2\u6CE8\u518C\u3002`,6002:_=>`\u8DEF\u7531 "${_}" \u5DF2\u5B58\u5728\u3002\u8BF7\u907F\u514D\u91CD\u590D\u6CE8\u518C\u76F8\u540C\u7684\u8DEF\u7531\u8DEF\u5F84\u3002`,6003:_=>`\u5BFC\u822A\u88AB\u4E2D\u6B62\uFF1A${_}\u3002\u53EF\u80FD\u88AB\u5BFC\u822A\u5B88\u536B\u62E6\u622A\u3002`,6004:_=>`\u5BFC\u822A\u5931\u8D25\uFF1A${_}\u3002\u8BF7\u68C0\u67E5\u76EE\u6807\u8DEF\u7531\u662F\u5426\u6709\u6548\u3002`,7001:_=>`Store "${_}" \u672A\u627E\u5230\u3002\u8BF7\u786E\u8BA4 store \u662F\u5426\u5DF2\u6CE8\u518C\u3002`,7002:_=>`Store "${_}" \u5DF2\u5B58\u5728\u3002\u8BF7\u907F\u514D\u91CD\u590D\u521B\u5EFA\u76F8\u540C ID \u7684 store\u3002`};function g(_,...R){let r=H[_];if(r){let O=r(...R);return`[Lyt ${_}] ${O}`}return`[Lyt ${_}] \u672A\u77E5\u9519\u8BEF\u3002`}function P(_,R,r){N.globalHandler&&N.globalHandler(_,R,r||""),L&&_ instanceof n&&_.details}function p(_,R){try{return _()}catch(r){P(r instanceof Error?r:new Error(String(r)),R);return}}var C=(E=>(E[E.LYT_COMPILER_PARSE_ERROR=1001]="LYT_COMPILER_PARSE_ERROR",E[E.LYT_COMPILER_INVALID_EXPRESSION=1002]="LYT_COMPILER_INVALID_EXPRESSION",E[E.LYT_COMPILER_INVALID_TEMPLATE=1003]="LYT_COMPILER_INVALID_TEMPLATE",E[E.LYT_COMPILER_INVALID_DIRECTIVE=1004]="LYT_COMPILER_INVALID_DIRECTIVE",E[E.LYT_COMPILER_CODEGEN_ERROR=1005]="LYT_COMPILER_CODEGEN_ERROR",E[E.LYT_COMPILER_SFC_PARSE_ERROR=1006]="LYT_COMPILER_SFC_PARSE_ERROR",E[E.LYT_COMPILER_TRANSFORM_ERROR=1007]="LYT_COMPILER_TRANSFORM_ERROR",E[E.LYT_RENDERER_MOUNT_FAILED=2001]="LYT_RENDERER_MOUNT_FAILED",E[E.LYT_RENDERER_PATCH_FAILED=2002]="LYT_RENDERER_PATCH_FAILED",E[E.LYT_RENDERER_HYDRATION_MISMATCH=2003]="LYT_RENDERER_HYDRATION_MISMATCH",E[E.LYT_RENDERER_INVALID_VNODE=2004]="LYT_RENDERER_INVALID_VNODE",E[E.LYT_RENDERER_UNMOUNT_FAILED=2005]="LYT_RENDERER_UNMOUNT_FAILED",E[E.LYT_COMPONENT_INVALID_PROPS=3001]="LYT_COMPONENT_INVALID_PROPS",E[E.LYT_COMPONENT_MISSING_RENDER=3002]="LYT_COMPONENT_MISSING_RENDER",E[E.LYT_COMPONENT_LIFECYCLE_ERROR=3003]="LYT_COMPONENT_LIFECYCLE_ERROR",E[E.LYT_COMPONENT_INVALID=3004]="LYT_COMPONENT_INVALID",E[E.LYT_COMPONENT_EMIT_INVALID=3005]="LYT_COMPONENT_EMIT_INVALID",E[E.LYT_COMPONENT_RENDER_ERROR=3006]="LYT_COMPONENT_RENDER_ERROR",E[E.LYT_ROUTER_INVALID_ROUTE=4001]="LYT_ROUTER_INVALID_ROUTE",E[E.LYT_ROUTER_NAVIGATION_FAILED=4002]="LYT_ROUTER_NAVIGATION_FAILED",E[E.LYT_ROUTER_DUPLICATE_ROUTE=4003]="LYT_ROUTER_DUPLICATE_ROUTE",E[E.LYT_ROUTER_NAVIGATION_ABORTED=4004]="LYT_ROUTER_NAVIGATION_ABORTED",E[E.LYT_ROUTER_GUARD_ERROR=4005]="LYT_ROUTER_GUARD_ERROR",E[E.LYT_STORE_ALREADY_EXISTS=5001]="LYT_STORE_ALREADY_EXISTS",E[E.LYT_STORE_NOT_FOUND=5002]="LYT_STORE_NOT_FOUND",E[E.LYT_STORE_DISPOSED=5003]="LYT_STORE_DISPOSED",E[E.LYT_STORE_PATCH_ERROR=5004]="LYT_STORE_PATCH_ERROR",E[E.LYT_REACTIVITY_READONLY_SET=6001]="LYT_REACTIVITY_READONLY_SET",E[E.LYT_REACTIVITY_READONLY_DELETE=6002]="LYT_REACTIVITY_READONLY_DELETE",E[E.LYT_REACTIVITY_EFFECT_ERROR=6003]="LYT_REACTIVITY_EFFECT_ERROR",E[E.LYT_REACTIVITY_COMPUTED_CYCLE=6004]="LYT_REACTIVITY_COMPUTED_CYCLE",E[E.LYT_REACTIVITY_EFFECT_DISPOSED=6005]="LYT_REACTIVITY_EFFECT_DISPOSED",E[E.LYT_CORE_PLUGIN_ERROR=7001]="LYT_CORE_PLUGIN_ERROR",E[E.LYT_CORE_MOUNT_NO_CONTAINER=7002]="LYT_CORE_MOUNT_NO_CONTAINER",E[E.LYT_CORE_ALREADY_MOUNTED=7003]="LYT_CORE_ALREADY_MOUNTED",E[E.LYT_CORE_INVALID_ARGUMENT=7004]="LYT_CORE_INVALID_ARGUMENT",E[E.LYT_CORE_NOT_FOUND=7005]="LYT_CORE_NOT_FOUND",E[E.LYT_CORE_ALREADY_EXISTS=7006]="LYT_CORE_ALREADY_EXISTS",E[E.LYT_CORE_OPERATION_FAILED=7007]="LYT_CORE_OPERATION_FAILED",E[E.LYT_CLI_SCAFFOLD_FAILED=8001]="LYT_CLI_SCAFFOLD_FAILED",E[E.LYT_CLI_BUILD_FAILED=8002]="LYT_CLI_BUILD_FAILED",E[E.LYT_CLI_DEV_SERVER_ERROR=8003]="LYT_CLI_DEV_SERVER_ERROR",E[E.LYT_CLI_CONFIG_INVALID=8004]="LYT_CLI_CONFIG_INVALID",E[E.LYT_CLI_HMR_CONNECTION_FAILED=8005]="LYT_CLI_HMR_CONNECTION_FAILED",E[E.LYT_DEVTOOLS_CONNECTION_FAILED=9001]="LYT_DEVTOOLS_CONNECTION_FAILED",E[E.LYT_DEVTOOLS_PANEL_ERROR=9002]="LYT_DEVTOOLS_PANEL_ERROR",E[E.LYT_DEVTOOLS_PERF_OVERFLOW=9003]="LYT_DEVTOOLS_PERF_OVERFLOW",E[E.LYT_DEVTOOLS_COMPONENT_TREE_ERROR=9004]="LYT_DEVTOOLS_COMPONENT_TREE_ERROR",E[E.LYT_PLUGIN_INSTALL_FAILED=10001]="LYT_PLUGIN_INSTALL_FAILED",E[E.LYT_PLUGIN_ALREADY_INSTALLED=10002]="LYT_PLUGIN_ALREADY_INSTALLED",E[E.LYT_PLUGIN_INVALID=10003]="LYT_PLUGIN_INVALID",E[E.LYT_PLUGIN_UNINSTALL_FAILED=10004]="LYT_PLUGIN_UNINSTALL_FAILED",E[E.LYT_SSR_STREAM_ERROR=11001]="LYT_SSR_STREAM_ERROR",E[E.LYT_SSR_SUSPENSE_TIMEOUT=11002]="LYT_SSR_SUSPENSE_TIMEOUT",E[E.LYT_SSR_HYDRATION_ERROR=11003]="LYT_SSR_HYDRATION_ERROR",E[E.LYT_SSR_ISLAND_ERROR=11004]="LYT_SSR_ISLAND_ERROR",E))(C||{}),I={COMPILER:"COMPILER",RENDERER:"RENDERER",COMPONENT:"COMPONENT",ROUTER:"ROUTER",STORE:"STORE",REACTIVITY:"REACTIVITY",CORE:"CORE",CLI:"CLI",DEVTOOLS:"DEVTOOLS",PLUGIN:"PLUGIN",SSR:"SSR"},b={1001:"\u6A21\u677F\u89E3\u6790\u9519\u8BEF\uFF0C\u8BF7\u68C0\u67E5\u6A21\u677F\u8BED\u6CD5\u662F\u5426\u6B63\u786E\u3002",1002:"\u65E0\u6548\u7684\u8868\u8FBE\u5F0F\uFF0C\u8BF7\u68C0\u67E5\u8868\u8FBE\u5F0F\u8BED\u6CD5\u3002",1003:"\u65E0\u6548\u7684\u6A21\u677F\uFF0C\u8BF7\u68C0\u67E5\u6A21\u677F\u5185\u5BB9\u3002",1004:"\u65E0\u6548\u7684\u6307\u4EE4\uFF0C\u8BF7\u786E\u8BA4\u6307\u4EE4\u540D\u79F0\u662F\u5426\u6B63\u786E\u3002",1005:"\u4EE3\u7801\u751F\u6210\u9519\u8BEF\uFF0C\u8BF7\u68C0\u67E5\u6A21\u677F\u7F16\u8BD1\u914D\u7F6E\u3002",1006:"\u5355\u6587\u4EF6\u7EC4\u4EF6\u89E3\u6790\u9519\u8BEF\uFF0C\u8BF7\u68C0\u67E5 SFC \u8BED\u6CD5\u3002",1007:"\u6A21\u677F\u8F6C\u6362\u9519\u8BEF\uFF0C\u8BF7\u68C0\u67E5 AST \u8F6C\u6362\u903B\u8F91\u3002",2001:"\u6302\u8F7D\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u5BB9\u5668\u5143\u7D20\u662F\u5426\u5B58\u5728\u3002",2002:"\u8865\u4E01\u66F4\u65B0\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5 VNode \u7ED3\u6784\u3002",2003:"\u6C34\u5408\u4E0D\u5339\u914D\uFF0C\u670D\u52A1\u7AEF\u4E0E\u5BA2\u6237\u7AEF\u6E32\u67D3\u7ED3\u679C\u4E0D\u4E00\u81F4\u3002",2004:"\u65E0\u6548\u7684\u865A\u62DF\u8282\u70B9\uFF0CVNode \u7F3A\u5C11\u5FC5\u8981\u7684 type \u5C5E\u6027\u3002",2005:"\u5378\u8F7D\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u7EC4\u4EF6\u662F\u5426\u5DF2\u6302\u8F7D\u3002",3001:"\u7EC4\u4EF6\u5C5E\u6027\u65E0\u6548\uFF0C\u8BF7\u68C0\u67E5\u4F20\u5165\u7684 props\u3002",3002:"\u7EC4\u4EF6\u7F3A\u5C11 template \u6216 render \u51FD\u6570\u3002",3003:"\u7EC4\u4EF6\u751F\u547D\u5468\u671F\u9519\u8BEF\uFF0C\u8BF7\u68C0\u67E5\u751F\u547D\u5468\u671F\u94A9\u5B50\u51FD\u6570\u3002",3004:"\u65E0\u6548\u7684\u7EC4\u4EF6\u5B9A\u4E49\uFF0C\u8BF7\u68C0\u67E5\u7EC4\u4EF6\u914D\u7F6E\u3002",3005:"\u65E0\u6548\u7684\u4E8B\u4EF6\u53D1\u5C04\uFF0C\u8BF7\u68C0\u67E5 emits \u58F0\u660E\u3002",3006:"\u7EC4\u4EF6\u6E32\u67D3\u9519\u8BEF\uFF0C\u8BF7\u68C0\u67E5 render \u51FD\u6570\u3002",4001:"\u65E0\u6548\u7684\u8DEF\u7531\uFF0C\u8BF7\u786E\u8BA4\u8DEF\u7531\u8DEF\u5F84\u662F\u5426\u5DF2\u6CE8\u518C\u3002",4002:"\u5BFC\u822A\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u76EE\u6807\u8DEF\u7531\u662F\u5426\u6709\u6548\u3002",4003:"\u8DEF\u7531\u5DF2\u5B58\u5728\uFF0C\u8BF7\u907F\u514D\u91CD\u590D\u6CE8\u518C\u76F8\u540C\u7684\u8DEF\u7531\u8DEF\u5F84\u3002",4004:"\u5BFC\u822A\u88AB\u4E2D\u6B62\uFF0C\u53EF\u80FD\u88AB\u5BFC\u822A\u5B88\u536B\u62E6\u622A\u3002",4005:"\u8DEF\u7531\u5B88\u536B\u9519\u8BEF\uFF0C\u8BF7\u68C0\u67E5\u5B88\u536B\u51FD\u6570\u3002",5001:"Store \u5DF2\u5B58\u5728\uFF0C\u8BF7\u907F\u514D\u91CD\u590D\u521B\u5EFA\u76F8\u540C ID \u7684 store\u3002",5002:"Store \u672A\u627E\u5230\uFF0C\u8BF7\u786E\u8BA4 store \u662F\u5426\u5DF2\u6CE8\u518C\u3002",5003:"Store \u5DF2\u88AB\u9500\u6BC1\uFF0C\u65E0\u6CD5\u7EE7\u7EED\u64CD\u4F5C\u3002",5004:"Store \u72B6\u6001\u66F4\u65B0\u9519\u8BEF\uFF0C\u8BF7\u68C0\u67E5 patch \u6570\u636E\u3002",6001:"\u65E0\u6CD5\u4FEE\u6539\u53EA\u8BFB\u54CD\u5E94\u5F0F\u5C5E\u6027\u3002",6002:"\u65E0\u6CD5\u5220\u9664\u53EA\u8BFB\u54CD\u5E94\u5F0F\u5C5E\u6027\u3002",6003:"\u526F\u4F5C\u7528\u51FD\u6570\u6267\u884C\u9519\u8BEF\u3002",6004:"\u8BA1\u7B97\u5C5E\u6027\u68C0\u6D4B\u5230\u5FAA\u73AF\u4F9D\u8D56\u3002",6005:"\u526F\u4F5C\u7528\u51FD\u6570\u5DF2\u88AB\u9500\u6BC1\uFF0C\u65E0\u6CD5\u518D\u6B21\u6267\u884C\u3002",7001:"\u63D2\u4EF6\u9519\u8BEF\uFF0C\u8BF7\u68C0\u67E5\u63D2\u4EF6\u914D\u7F6E\u548C\u5B89\u88C5\u903B\u8F91\u3002",7002:"\u627E\u4E0D\u5230\u6302\u8F7D\u76EE\u6807\u5BB9\u5668\u3002",7003:"\u5E94\u7528\u5DF2\u7ECF\u6302\u8F7D\uFF0C\u4E0D\u80FD\u91CD\u590D\u6302\u8F7D\u3002",7004:"\u53C2\u6570\u65E0\u6548\uFF0C\u8BF7\u68C0\u67E5\u4F20\u5165\u7684\u503C\u7C7B\u578B\u548C\u8303\u56F4\u3002",7005:"\u8D44\u6E90\u672A\u627E\u5230\uFF0C\u8BF7\u786E\u8BA4\u540D\u79F0\u6216\u8DEF\u5F84\u662F\u5426\u6B63\u786E\u3002",7006:"\u8D44\u6E90\u5DF2\u5B58\u5728\uFF0C\u8BF7\u4F7F\u7528\u4E0D\u540C\u7684\u540D\u79F0\u3002",7007:"\u64CD\u4F5C\u6267\u884C\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u76F8\u5173\u914D\u7F6E\u548C\u72B6\u6001\u3002",8001:"\u9879\u76EE\u811A\u624B\u67B6\u521B\u5EFA\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u6A21\u677F\u548C\u76EE\u6807\u76EE\u5F55\u3002",8002:"\u9879\u76EE\u6784\u5EFA\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u6784\u5EFA\u914D\u7F6E\u548C\u6E90\u4EE3\u7801\u3002",8003:"\u5F00\u53D1\u670D\u52A1\u5668\u542F\u52A8\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u7AEF\u53E3\u548C\u914D\u7F6E\u3002",8004:"\u914D\u7F6E\u6587\u4EF6\u65E0\u6548\uFF0C\u8BF7\u68C0\u67E5\u914D\u7F6E\u683C\u5F0F\u548C\u5FC5\u586B\u5B57\u6BB5\u3002",8005:"\u70ED\u6A21\u5757\u66FF\u6362\u8FDE\u63A5\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5 WebSocket \u914D\u7F6E\u3002",9001:"DevTools \u8FDE\u63A5\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u6269\u5C55\u548C\u8FD0\u884C\u65F6\u7248\u672C\u662F\u5426\u5339\u914D\u3002",9002:"DevTools \u9762\u677F\u52A0\u8F7D\u9519\u8BEF\uFF0C\u8BF7\u5C1D\u8BD5\u5237\u65B0\u9875\u9762\u3002",9003:"\u6027\u80FD\u6570\u636E\u6EA2\u51FA\uFF0C\u8BF7\u51CF\u5C11\u76D1\u63A7\u7684\u7EC4\u4EF6\u6570\u91CF\u6216\u7F29\u77ED\u91C7\u96C6\u5468\u671F\u3002",9004:"\u7EC4\u4EF6\u6811\u89E3\u6790\u9519\u8BEF\uFF0C\u8BF7\u68C0\u67E5\u7EC4\u4EF6\u5B9E\u4F8B\u72B6\u6001\u3002",10001:"\u63D2\u4EF6\u5B89\u88C5\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u63D2\u4EF6\u5305\u548C\u5B89\u88C5\u903B\u8F91\u3002",10002:"\u63D2\u4EF6\u5DF2\u5B89\u88C5\uFF0C\u8BF7\u907F\u514D\u91CD\u590D\u5B89\u88C5\u76F8\u540C\u63D2\u4EF6\u3002",10003:"\u65E0\u6548\u7684\u63D2\u4EF6\uFF0C\u8BF7\u68C0\u67E5\u63D2\u4EF6\u662F\u5426\u6EE1\u8DB3\u63A5\u53E3\u8981\u6C42\u3002",10004:"\u63D2\u4EF6\u5378\u8F7D\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u63D2\u4EF6\u662F\u5426\u5DF2\u88AB\u6B63\u786E\u6E05\u7406\u3002",11001:"SSR \u6D41\u5F0F\u6E32\u67D3\u9519\u8BEF\uFF0C\u8BF7\u68C0\u67E5\u6D41\u7BA1\u9053\u914D\u7F6E\u3002",11002:"SSR Suspense \u8D85\u65F6\uFF0C\u8BF7\u68C0\u67E5\u5F02\u6B65\u7EC4\u4EF6\u7684\u52A0\u8F7D\u65F6\u95F4\u3002",11003:"SSR \u6C34\u5408\u9519\u8BEF\uFF0C\u670D\u52A1\u7AEF\u4E0E\u5BA2\u6237\u7AEF\u6E32\u67D3\u7ED3\u679C\u4E0D\u4E00\u81F4\u3002",11004:"SSR Island \u7EC4\u4EF6\u9519\u8BEF\uFF0C\u8BF7\u68C0\u67E5\u5B64\u5C9B\u7EC4\u4EF6\u7684\u5E8F\u5217\u5316\u548C\u6E32\u67D3\u903B\u8F91\u3002"};function w(_){return _>=1e3&&_<2e3?I.COMPILER:_>=2e3&&_<3e3?I.RENDERER:_>=3e3&&_<4e3?I.COMPONENT:_>=4e3&&_<5e3?I.ROUTER:_>=5e3&&_<6e3?I.STORE:_>=6e3&&_<7e3?I.REACTIVITY:_>=7e3&&_<8e3?I.CORE:_>=8e3&&_<9e3?I.CLI:_>=9e3&&_<1e4?I.DEVTOOLS:_>=1e4&&_<11e3?I.PLUGIN:_>=11e3&&_<12e3?I.SSR:"UNKNOWN"}function D(_){return b[_]||"\u672A\u77E5\u9519\u8BEF\u3002"}function i(_){return w(_)}var t=class extends Error{constructor(R,r,O){super(r||D(R)),this.name="LytError",this.code=R,this.category=i(R),this.details=O}};function f(_,R,r){let O=new t(_,r);return O.loc=R,O}function F(_,R,r){let O=new t(_,r);return O.details={vnode:R},O}function c(_,R,r){let O=typeof R=="string"?R:R==null?void 0:R.name,e=new t(_,r);return e.details={component:O},e}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var S=(R=>(R[R.INVALID_ARGUMENT=1001]="INVALID_ARGUMENT",R[R.NOT_FOUND=1002]="NOT_FOUND",R[R.ALREADY_EXISTS=1003]="ALREADY_EXISTS",R[R.OPERATION_FAILED=1004]="OPERATION_FAILED",R[R.REACTIVE_READONLY=2001]="REACTIVE_READONLY",R[R.REACTIVE_EFFECT_DISPOSED=2002]="REACTIVE_EFFECT_DISPOSED",R[R.COMPUTED_CYCLE=2003]="COMPUTED_CYCLE",R[R.PARSE_ERROR=3001]="PARSE_ERROR",R[R.INVALID_EXPRESSION=3002]="INVALID_EXPRESSION",R[R.INVALID_DIRECTIVE=3003]="INVALID_DIRECTIVE",R[R.INVALID_TEMPLATE=3004]="INVALID_TEMPLATE",R[R.RENDER_ERROR=4001]="RENDER_ERROR",R[R.HYDRATION_MISMATCH=4002]="HYDRATION_MISMATCH",R[R.INVALID_VNODE=4003]="INVALID_VNODE",R[R.COMPONENT_INVALID_PROPS=5001]="COMPONENT_INVALID_PROPS",R[R.COMPONENT_MISSING_TEMPLATE=5002]="COMPONENT_MISSING_TEMPLATE",R[R.COMPONENT_LIFECYCLE_ERROR=5003]="COMPONENT_LIFECYCLE_ERROR",R[R.ROUTE_NOT_FOUND=6001]="ROUTE_NOT_FOUND",R[R.ROUTE_DUPLICATE=6002]="ROUTE_DUPLICATE",R[R.NAVIGATION_ABORTED=6003]="NAVIGATION_ABORTED",R[R.NAVIGATION_FAILED=6004]="NAVIGATION_FAILED",R[R.STORE_NOT_FOUND=7001]="STORE_NOT_FOUND",R[R.STORE_DUPLICATE=7002]="STORE_DUPLICATE",R))(S||{});var I=class extends Error{constructor(T,r,O){let n=`[Lyt ${T}] ${r}`;super(n),this.name="LytError",this.code=T,this.details=O}};var A=class A{constructor(T){this.errors=[],this.options=T||{},this._hasError=!1}get hasError(){return this._hasError}static setGlobalHandler(T){A.globalHandler=T}capture(T,r,O){var s;let n={error:T,vm:r,info:O||"",timestamp:Date.now()};this.errors.push(n),this._hasError=!0;let a=(s=this.options.maxErrors)!=null?s:100;this.errors.length>a&&this.errors.splice(0,this.errors.length-a),!(this.options.onErrorCaptured&&this.options.onErrorCaptured(T instanceof I?T:new I(1004,T.message),r,n.info)===!0)&&this.options.onError&&this.options.onError(T instanceof I?T:new I(1004,T.message),r)}getFallback(T){if(!this.options.fallback||this.errors.length===0)return null;let r=this.errors[this.errors.length-1];return this.options.fallback(r.error,r.vm,r.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}};A.globalHandler=null;var N=A,L=!0,D=new Set;function l(_){L=_}function u(){return L}function Y(_){}function P(_){L&&(D.has(_)||D.add(_))}function V(){D.clear()}var U={1001:_=>`\u53C2\u6570 "${_}" \u65E0\u6548\u3002\u8BF7\u68C0\u67E5\u4F20\u5165\u7684\u503C\u7C7B\u578B\u548C\u8303\u56F4\u3002`,1002:_=>`"${_}" \u672A\u627E\u5230\u3002\u8BF7\u786E\u8BA4\u8D44\u6E90\u540D\u79F0\u6216\u8DEF\u5F84\u662F\u5426\u6B63\u786E\u3002`,1003:_=>`"${_}" \u5DF2\u5B58\u5728\u3002\u8BF7\u4F7F\u7528\u4E0D\u540C\u7684\u540D\u79F0\u3002`,1004:_=>`\u64CD\u4F5C "${_}" \u6267\u884C\u5931\u8D25\u3002\u8BF7\u68C0\u67E5\u76F8\u5173\u914D\u7F6E\u548C\u72B6\u6001\u3002`,2001:_=>`\u65E0\u6CD5\u4FEE\u6539\u53EA\u8BFB\u54CD\u5E94\u5F0F\u5C5E\u6027 "${_}"\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:_=>`\u6A21\u677F\u89E3\u6790\u9519\u8BEF\uFF1A${_}\u3002\u8BF7\u68C0\u67E5\u6A21\u677F\u8BED\u6CD5\u662F\u5426\u6B63\u786E\u3002`,3002:_=>`\u65E0\u6548\u7684\u8868\u8FBE\u5F0F "${_}"\u3002\u8BF7\u68C0\u67E5\u8868\u8FBE\u5F0F\u8BED\u6CD5\u3002`,3003:_=>`\u65E0\u6548\u7684\u6307\u4EE4 "${_}"\u3002\u8BF7\u786E\u8BA4\u6307\u4EE4\u540D\u79F0\u662F\u5426\u6B63\u786E\u3002`,3004:_=>`\u65E0\u6548\u7684\u6A21\u677F\uFF1A${_}\u3002\u8BF7\u68C0\u67E5\u6A21\u677F\u5185\u5BB9\u3002`,4001:_=>`\u6E32\u67D3\u9519\u8BEF\uFF1A${_}\u3002\u8BF7\u68C0\u67E5\u7EC4\u4EF6\u7684 render \u51FD\u6570\u6216\u6A21\u677F\u3002`,4002:_=>`\u6C34\u5408\u4E0D\u5339\u914D\uFF1A${_}\u3002\u670D\u52A1\u7AEF\u6E32\u67D3\u4E0E\u5BA2\u6237\u7AEF\u6E32\u67D3\u7ED3\u679C\u4E0D\u4E00\u81F4\u3002`,4003:_=>`\u65E0\u6548\u7684\u865A\u62DF\u8282\u70B9\uFF1A${_}\u3002VNode \u7F3A\u5C11\u5FC5\u8981\u7684 type \u6216\u5176\u4ED6\u5C5E\u6027\u3002`,5001:_=>`\u7EC4\u4EF6\u5C5E\u6027\u65E0\u6548\uFF1A${_}\u3002\u8BF7\u68C0\u67E5\u4F20\u5165\u7684 props \u662F\u5426\u7B26\u5408\u7EC4\u4EF6\u5B9A\u4E49\u3002`,5002:_=>`\u7EC4\u4EF6 "${_}" \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:_=>`\u7EC4\u4EF6\u751F\u547D\u5468\u671F\u9519\u8BEF\uFF1A${_}\u3002\u8BF7\u68C0\u67E5\u751F\u547D\u5468\u671F\u94A9\u5B50\u51FD\u6570\u3002`,6001:_=>`\u8DEF\u7531 "${_}" \u672A\u627E\u5230\u3002\u8BF7\u786E\u8BA4\u8DEF\u7531\u8DEF\u5F84\u662F\u5426\u5DF2\u6CE8\u518C\u3002`,6002:_=>`\u8DEF\u7531 "${_}" \u5DF2\u5B58\u5728\u3002\u8BF7\u907F\u514D\u91CD\u590D\u6CE8\u518C\u76F8\u540C\u7684\u8DEF\u7531\u8DEF\u5F84\u3002`,6003:_=>`\u5BFC\u822A\u88AB\u4E2D\u6B62\uFF1A${_}\u3002\u53EF\u80FD\u88AB\u5BFC\u822A\u5B88\u536B\u62E6\u622A\u3002`,6004:_=>`\u5BFC\u822A\u5931\u8D25\uFF1A${_}\u3002\u8BF7\u68C0\u67E5\u76EE\u6807\u8DEF\u7531\u662F\u5426\u6709\u6548\u3002`,7001:_=>`Store "${_}" \u672A\u627E\u5230\u3002\u8BF7\u786E\u8BA4 store \u662F\u5426\u5DF2\u6CE8\u518C\u3002`,7002:_=>`Store "${_}" \u5DF2\u5B58\u5728\u3002\u8BF7\u907F\u514D\u91CD\u590D\u521B\u5EFA\u76F8\u540C ID \u7684 store\u3002`};function g(_,...T){let r=U[_];if(r){let O=r(...T);return`[Lyt ${_}] ${O}`}return`[Lyt ${_}] \u672A\u77E5\u9519\u8BEF\u3002`}function C(_,T,r){N.globalHandler&&N.globalHandler(_,T,r||""),L&&_ instanceof I&&_.details}function p(_,T){try{return _()}catch(r){C(r instanceof Error?r:new Error(String(r)),T);return}}var M=(E=>(E[E.LYT_COMPILER_PARSE_ERROR=1001]="LYT_COMPILER_PARSE_ERROR",E[E.LYT_COMPILER_INVALID_EXPRESSION=1002]="LYT_COMPILER_INVALID_EXPRESSION",E[E.LYT_COMPILER_INVALID_TEMPLATE=1003]="LYT_COMPILER_INVALID_TEMPLATE",E[E.LYT_COMPILER_INVALID_DIRECTIVE=1004]="LYT_COMPILER_INVALID_DIRECTIVE",E[E.LYT_COMPILER_CODEGEN_ERROR=1005]="LYT_COMPILER_CODEGEN_ERROR",E[E.LYT_COMPILER_SFC_PARSE_ERROR=1006]="LYT_COMPILER_SFC_PARSE_ERROR",E[E.LYT_COMPILER_TRANSFORM_ERROR=1007]="LYT_COMPILER_TRANSFORM_ERROR",E[E.LYT_RENDERER_MOUNT_FAILED=2001]="LYT_RENDERER_MOUNT_FAILED",E[E.LYT_RENDERER_PATCH_FAILED=2002]="LYT_RENDERER_PATCH_FAILED",E[E.LYT_RENDERER_HYDRATION_MISMATCH=2003]="LYT_RENDERER_HYDRATION_MISMATCH",E[E.LYT_RENDERER_INVALID_VNODE=2004]="LYT_RENDERER_INVALID_VNODE",E[E.LYT_RENDERER_UNMOUNT_FAILED=2005]="LYT_RENDERER_UNMOUNT_FAILED",E[E.LYT_COMPONENT_INVALID_PROPS=3001]="LYT_COMPONENT_INVALID_PROPS",E[E.LYT_COMPONENT_MISSING_RENDER=3002]="LYT_COMPONENT_MISSING_RENDER",E[E.LYT_COMPONENT_LIFECYCLE_ERROR=3003]="LYT_COMPONENT_LIFECYCLE_ERROR",E[E.LYT_COMPONENT_INVALID=3004]="LYT_COMPONENT_INVALID",E[E.LYT_COMPONENT_EMIT_INVALID=3005]="LYT_COMPONENT_EMIT_INVALID",E[E.LYT_COMPONENT_RENDER_ERROR=3006]="LYT_COMPONENT_RENDER_ERROR",E[E.LYT_ROUTER_INVALID_ROUTE=4001]="LYT_ROUTER_INVALID_ROUTE",E[E.LYT_ROUTER_NAVIGATION_FAILED=4002]="LYT_ROUTER_NAVIGATION_FAILED",E[E.LYT_ROUTER_DUPLICATE_ROUTE=4003]="LYT_ROUTER_DUPLICATE_ROUTE",E[E.LYT_ROUTER_NAVIGATION_ABORTED=4004]="LYT_ROUTER_NAVIGATION_ABORTED",E[E.LYT_ROUTER_GUARD_ERROR=4005]="LYT_ROUTER_GUARD_ERROR",E[E.LYT_STORE_ALREADY_EXISTS=5001]="LYT_STORE_ALREADY_EXISTS",E[E.LYT_STORE_NOT_FOUND=5002]="LYT_STORE_NOT_FOUND",E[E.LYT_STORE_DISPOSED=5003]="LYT_STORE_DISPOSED",E[E.LYT_STORE_PATCH_ERROR=5004]="LYT_STORE_PATCH_ERROR",E[E.LYT_REACTIVITY_READONLY_SET=6001]="LYT_REACTIVITY_READONLY_SET",E[E.LYT_REACTIVITY_READONLY_DELETE=6002]="LYT_REACTIVITY_READONLY_DELETE",E[E.LYT_REACTIVITY_EFFECT_ERROR=6003]="LYT_REACTIVITY_EFFECT_ERROR",E[E.LYT_REACTIVITY_COMPUTED_CYCLE=6004]="LYT_REACTIVITY_COMPUTED_CYCLE",E[E.LYT_REACTIVITY_EFFECT_DISPOSED=6005]="LYT_REACTIVITY_EFFECT_DISPOSED",E[E.LYT_CORE_PLUGIN_ERROR=7001]="LYT_CORE_PLUGIN_ERROR",E[E.LYT_CORE_MOUNT_NO_CONTAINER=7002]="LYT_CORE_MOUNT_NO_CONTAINER",E[E.LYT_CORE_ALREADY_MOUNTED=7003]="LYT_CORE_ALREADY_MOUNTED",E[E.LYT_CORE_INVALID_ARGUMENT=7004]="LYT_CORE_INVALID_ARGUMENT",E[E.LYT_CORE_NOT_FOUND=7005]="LYT_CORE_NOT_FOUND",E[E.LYT_CORE_ALREADY_EXISTS=7006]="LYT_CORE_ALREADY_EXISTS",E[E.LYT_CORE_OPERATION_FAILED=7007]="LYT_CORE_OPERATION_FAILED",E[E.LYT_CLI_SCAFFOLD_FAILED=8001]="LYT_CLI_SCAFFOLD_FAILED",E[E.LYT_CLI_BUILD_FAILED=8002]="LYT_CLI_BUILD_FAILED",E[E.LYT_CLI_DEV_SERVER_ERROR=8003]="LYT_CLI_DEV_SERVER_ERROR",E[E.LYT_CLI_CONFIG_INVALID=8004]="LYT_CLI_CONFIG_INVALID",E[E.LYT_CLI_HMR_CONNECTION_FAILED=8005]="LYT_CLI_HMR_CONNECTION_FAILED",E[E.LYT_DEVTOOLS_CONNECTION_FAILED=9001]="LYT_DEVTOOLS_CONNECTION_FAILED",E[E.LYT_DEVTOOLS_PANEL_ERROR=9002]="LYT_DEVTOOLS_PANEL_ERROR",E[E.LYT_DEVTOOLS_PERF_OVERFLOW=9003]="LYT_DEVTOOLS_PERF_OVERFLOW",E[E.LYT_DEVTOOLS_COMPONENT_TREE_ERROR=9004]="LYT_DEVTOOLS_COMPONENT_TREE_ERROR",E[E.LYT_PLUGIN_INSTALL_FAILED=10001]="LYT_PLUGIN_INSTALL_FAILED",E[E.LYT_PLUGIN_ALREADY_INSTALLED=10002]="LYT_PLUGIN_ALREADY_INSTALLED",E[E.LYT_PLUGIN_INVALID=10003]="LYT_PLUGIN_INVALID",E[E.LYT_PLUGIN_UNINSTALL_FAILED=10004]="LYT_PLUGIN_UNINSTALL_FAILED",E[E.LYT_SSR_STREAM_ERROR=11001]="LYT_SSR_STREAM_ERROR",E[E.LYT_SSR_SUSPENSE_TIMEOUT=11002]="LYT_SSR_SUSPENSE_TIMEOUT",E[E.LYT_SSR_HYDRATION_ERROR=11003]="LYT_SSR_HYDRATION_ERROR",E[E.LYT_SSR_ISLAND_ERROR=11004]="LYT_SSR_ISLAND_ERROR",E))(M||{}),e={COMPILER:"COMPILER",RENDERER:"RENDERER",COMPONENT:"COMPONENT",ROUTER:"ROUTER",STORE:"STORE",REACTIVITY:"REACTIVITY",CORE:"CORE",CLI:"CLI",DEVTOOLS:"DEVTOOLS",PLUGIN:"PLUGIN",SSR:"SSR"},f={1001:"\u6A21\u677F\u89E3\u6790\u9519\u8BEF\uFF0C\u8BF7\u68C0\u67E5\u6A21\u677F\u8BED\u6CD5\u662F\u5426\u6B63\u786E\u3002",1002:"\u65E0\u6548\u7684\u8868\u8FBE\u5F0F\uFF0C\u8BF7\u68C0\u67E5\u8868\u8FBE\u5F0F\u8BED\u6CD5\u3002",1003:"\u65E0\u6548\u7684\u6A21\u677F\uFF0C\u8BF7\u68C0\u67E5\u6A21\u677F\u5185\u5BB9\u3002",1004:"\u65E0\u6548\u7684\u6307\u4EE4\uFF0C\u8BF7\u786E\u8BA4\u6307\u4EE4\u540D\u79F0\u662F\u5426\u6B63\u786E\u3002",1005:"\u4EE3\u7801\u751F\u6210\u9519\u8BEF\uFF0C\u8BF7\u68C0\u67E5\u6A21\u677F\u7F16\u8BD1\u914D\u7F6E\u3002",1006:"\u5355\u6587\u4EF6\u7EC4\u4EF6\u89E3\u6790\u9519\u8BEF\uFF0C\u8BF7\u68C0\u67E5 SFC \u8BED\u6CD5\u3002",1007:"\u6A21\u677F\u8F6C\u6362\u9519\u8BEF\uFF0C\u8BF7\u68C0\u67E5 AST \u8F6C\u6362\u903B\u8F91\u3002",2001:"\u6302\u8F7D\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u5BB9\u5668\u5143\u7D20\u662F\u5426\u5B58\u5728\u3002",2002:"\u8865\u4E01\u66F4\u65B0\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5 VNode \u7ED3\u6784\u3002",2003:"\u6C34\u5408\u4E0D\u5339\u914D\uFF0C\u670D\u52A1\u7AEF\u4E0E\u5BA2\u6237\u7AEF\u6E32\u67D3\u7ED3\u679C\u4E0D\u4E00\u81F4\u3002",2004:"\u65E0\u6548\u7684\u865A\u62DF\u8282\u70B9\uFF0CVNode \u7F3A\u5C11\u5FC5\u8981\u7684 type \u5C5E\u6027\u3002",2005:"\u5378\u8F7D\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u7EC4\u4EF6\u662F\u5426\u5DF2\u6302\u8F7D\u3002",3001:"\u7EC4\u4EF6\u5C5E\u6027\u65E0\u6548\uFF0C\u8BF7\u68C0\u67E5\u4F20\u5165\u7684 props\u3002",3002:"\u7EC4\u4EF6\u7F3A\u5C11 template \u6216 render \u51FD\u6570\u3002",3003:"\u7EC4\u4EF6\u751F\u547D\u5468\u671F\u9519\u8BEF\uFF0C\u8BF7\u68C0\u67E5\u751F\u547D\u5468\u671F\u94A9\u5B50\u51FD\u6570\u3002",3004:"\u65E0\u6548\u7684\u7EC4\u4EF6\u5B9A\u4E49\uFF0C\u8BF7\u68C0\u67E5\u7EC4\u4EF6\u914D\u7F6E\u3002",3005:"\u65E0\u6548\u7684\u4E8B\u4EF6\u53D1\u5C04\uFF0C\u8BF7\u68C0\u67E5 emits \u58F0\u660E\u3002",3006:"\u7EC4\u4EF6\u6E32\u67D3\u9519\u8BEF\uFF0C\u8BF7\u68C0\u67E5 render \u51FD\u6570\u3002",4001:"\u65E0\u6548\u7684\u8DEF\u7531\uFF0C\u8BF7\u786E\u8BA4\u8DEF\u7531\u8DEF\u5F84\u662F\u5426\u5DF2\u6CE8\u518C\u3002",4002:"\u5BFC\u822A\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u76EE\u6807\u8DEF\u7531\u662F\u5426\u6709\u6548\u3002",4003:"\u8DEF\u7531\u5DF2\u5B58\u5728\uFF0C\u8BF7\u907F\u514D\u91CD\u590D\u6CE8\u518C\u76F8\u540C\u7684\u8DEF\u7531\u8DEF\u5F84\u3002",4004:"\u5BFC\u822A\u88AB\u4E2D\u6B62\uFF0C\u53EF\u80FD\u88AB\u5BFC\u822A\u5B88\u536B\u62E6\u622A\u3002",4005:"\u8DEF\u7531\u5B88\u536B\u9519\u8BEF\uFF0C\u8BF7\u68C0\u67E5\u5B88\u536B\u51FD\u6570\u3002",5001:"Store \u5DF2\u5B58\u5728\uFF0C\u8BF7\u907F\u514D\u91CD\u590D\u521B\u5EFA\u76F8\u540C ID \u7684 store\u3002",5002:"Store \u672A\u627E\u5230\uFF0C\u8BF7\u786E\u8BA4 store \u662F\u5426\u5DF2\u6CE8\u518C\u3002",5003:"Store \u5DF2\u88AB\u9500\u6BC1\uFF0C\u65E0\u6CD5\u7EE7\u7EED\u64CD\u4F5C\u3002",5004:"Store \u72B6\u6001\u66F4\u65B0\u9519\u8BEF\uFF0C\u8BF7\u68C0\u67E5 patch \u6570\u636E\u3002",6001:"\u65E0\u6CD5\u4FEE\u6539\u53EA\u8BFB\u54CD\u5E94\u5F0F\u5C5E\u6027\u3002",6002:"\u65E0\u6CD5\u5220\u9664\u53EA\u8BFB\u54CD\u5E94\u5F0F\u5C5E\u6027\u3002",6003:"\u526F\u4F5C\u7528\u51FD\u6570\u6267\u884C\u9519\u8BEF\u3002",6004:"\u8BA1\u7B97\u5C5E\u6027\u68C0\u6D4B\u5230\u5FAA\u73AF\u4F9D\u8D56\u3002",6005:"\u526F\u4F5C\u7528\u51FD\u6570\u5DF2\u88AB\u9500\u6BC1\uFF0C\u65E0\u6CD5\u518D\u6B21\u6267\u884C\u3002",7001:"\u63D2\u4EF6\u9519\u8BEF\uFF0C\u8BF7\u68C0\u67E5\u63D2\u4EF6\u914D\u7F6E\u548C\u5B89\u88C5\u903B\u8F91\u3002",7002:"\u627E\u4E0D\u5230\u6302\u8F7D\u76EE\u6807\u5BB9\u5668\u3002",7003:"\u5E94\u7528\u5DF2\u7ECF\u6302\u8F7D\uFF0C\u4E0D\u80FD\u91CD\u590D\u6302\u8F7D\u3002",7004:"\u53C2\u6570\u65E0\u6548\uFF0C\u8BF7\u68C0\u67E5\u4F20\u5165\u7684\u503C\u7C7B\u578B\u548C\u8303\u56F4\u3002",7005:"\u8D44\u6E90\u672A\u627E\u5230\uFF0C\u8BF7\u786E\u8BA4\u540D\u79F0\u6216\u8DEF\u5F84\u662F\u5426\u6B63\u786E\u3002",7006:"\u8D44\u6E90\u5DF2\u5B58\u5728\uFF0C\u8BF7\u4F7F\u7528\u4E0D\u540C\u7684\u540D\u79F0\u3002",7007:"\u64CD\u4F5C\u6267\u884C\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u76F8\u5173\u914D\u7F6E\u548C\u72B6\u6001\u3002",8001:"\u9879\u76EE\u811A\u624B\u67B6\u521B\u5EFA\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u6A21\u677F\u548C\u76EE\u6807\u76EE\u5F55\u3002",8002:"\u9879\u76EE\u6784\u5EFA\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u6784\u5EFA\u914D\u7F6E\u548C\u6E90\u4EE3\u7801\u3002",8003:"\u5F00\u53D1\u670D\u52A1\u5668\u542F\u52A8\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u7AEF\u53E3\u548C\u914D\u7F6E\u3002",8004:"\u914D\u7F6E\u6587\u4EF6\u65E0\u6548\uFF0C\u8BF7\u68C0\u67E5\u914D\u7F6E\u683C\u5F0F\u548C\u5FC5\u586B\u5B57\u6BB5\u3002",8005:"\u70ED\u6A21\u5757\u66FF\u6362\u8FDE\u63A5\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5 WebSocket \u914D\u7F6E\u3002",9001:"DevTools \u8FDE\u63A5\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u6269\u5C55\u548C\u8FD0\u884C\u65F6\u7248\u672C\u662F\u5426\u5339\u914D\u3002",9002:"DevTools \u9762\u677F\u52A0\u8F7D\u9519\u8BEF\uFF0C\u8BF7\u5C1D\u8BD5\u5237\u65B0\u9875\u9762\u3002",9003:"\u6027\u80FD\u6570\u636E\u6EA2\u51FA\uFF0C\u8BF7\u51CF\u5C11\u76D1\u63A7\u7684\u7EC4\u4EF6\u6570\u91CF\u6216\u7F29\u77ED\u91C7\u96C6\u5468\u671F\u3002",9004:"\u7EC4\u4EF6\u6811\u89E3\u6790\u9519\u8BEF\uFF0C\u8BF7\u68C0\u67E5\u7EC4\u4EF6\u5B9E\u4F8B\u72B6\u6001\u3002",10001:"\u63D2\u4EF6\u5B89\u88C5\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u63D2\u4EF6\u5305\u548C\u5B89\u88C5\u903B\u8F91\u3002",10002:"\u63D2\u4EF6\u5DF2\u5B89\u88C5\uFF0C\u8BF7\u907F\u514D\u91CD\u590D\u5B89\u88C5\u76F8\u540C\u63D2\u4EF6\u3002",10003:"\u65E0\u6548\u7684\u63D2\u4EF6\uFF0C\u8BF7\u68C0\u67E5\u63D2\u4EF6\u662F\u5426\u6EE1\u8DB3\u63A5\u53E3\u8981\u6C42\u3002",10004:"\u63D2\u4EF6\u5378\u8F7D\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u63D2\u4EF6\u662F\u5426\u5DF2\u88AB\u6B63\u786E\u6E05\u7406\u3002",11001:"SSR \u6D41\u5F0F\u6E32\u67D3\u9519\u8BEF\uFF0C\u8BF7\u68C0\u67E5\u6D41\u7BA1\u9053\u914D\u7F6E\u3002",11002:"SSR Suspense \u8D85\u65F6\uFF0C\u8BF7\u68C0\u67E5\u5F02\u6B65\u7EC4\u4EF6\u7684\u52A0\u8F7D\u65F6\u95F4\u3002",11003:"SSR \u6C34\u5408\u9519\u8BEF\uFF0C\u670D\u52A1\u7AEF\u4E0E\u5BA2\u6237\u7AEF\u6E32\u67D3\u7ED3\u679C\u4E0D\u4E00\u81F4\u3002",11004:"SSR Island \u7EC4\u4EF6\u9519\u8BEF\uFF0C\u8BF7\u68C0\u67E5\u5B64\u5C9B\u7EC4\u4EF6\u7684\u5E8F\u5217\u5316\u548C\u6E32\u67D3\u903B\u8F91\u3002"};function F(_){return _>=1e3&&_<2e3?e.COMPILER:_>=2e3&&_<3e3?e.RENDERER:_>=3e3&&_<4e3?e.COMPONENT:_>=4e3&&_<5e3?e.ROUTER:_>=5e3&&_<6e3?e.STORE:_>=6e3&&_<7e3?e.REACTIVITY:_>=7e3&&_<8e3?e.CORE:_>=8e3&&_<9e3?e.CLI:_>=9e3&&_<1e4?e.DEVTOOLS:_>=1e4&&_<11e3?e.PLUGIN:_>=11e3&&_<12e3?e.SSR:"UNKNOWN"}function i(_){return f[_]||"\u672A\u77E5\u9519\u8BEF\u3002"}function o(_){return F(_)}var t=class extends Error{constructor(T,r,O){super(r||i(T)),this.name="LytError",this.code=T,this.category=o(T),this.details=O}};function c(_,T,r){let O=new t(_,r);return O.loc=T,O}function m(_,T,r){let O=new t(_,r);return O.details={vnode:T},O}function h(_,T,r){let O=typeof T=="string"?T:T==null?void 0:T.name,n=new t(_,r);return n.details={component:O},n}export{N as ErrorBoundary,e as ErrorCategory,I as LytError,S as LytErrorCodes,t as NewLytError,M as NewLytErrorCodes,p as callWithErrorHandling,c as createCompilerError,h as createComponentError,g as createMessage,m as createRendererError,o as getCategory,u as getDevMode,i as getErrorMessage,C as handleError,V as resetWarnedMessages,l as setDevMode,Y as warn,P as warnOnce,P as warnOnceUtil,Y as warnUtil};
|
package/dist/index.cjs
CHANGED
|
@@ -1,52 +1 @@
|
|
|
1
|
-
var B=Object.defineProperty;var Ce=Object.getOwnPropertyDescriptor;var he=Object.getOwnPropertyNames;var De=Object.prototype.hasOwnProperty;var Pe=(e,t)=>{for(var n in t)B(e,n,{get:t[n],enumerable:!0})},Se=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let c of he(t))!De.call(e,c)&&c!==n&&B(e,c,{get:()=>t[c],enumerable:!(o=Ce(t,c))||o.enumerable});return e};var be=e=>Se(B({},"__esModule",{value:!0}),e);var We={};Pe(We,{ErrorBoundary:()=>P,ErrorCategory:()=>O,Fragment:()=>z,LytError:()=>C,LytErrorCodes:()=>K,NewLytError:()=>L,NewLytErrorCodes:()=>Z,ShapeFlags:()=>X,callWithErrorHandling:()=>_e,createApp:()=>ae,createCompilerError:()=>fe,createComponentError:()=>Re,createErrorOverlay:()=>Ie,createMessage:()=>pe,createProvidesContext:()=>v,createRendererError:()=>de,defineCustomElement:()=>$,defineCustomElementFromSFC:()=>Ae,error:()=>Oe,formatError:()=>te,getCategory:()=>w,getComponentStack:()=>ge,getDevMode:()=>j,getErrorMessage:()=>U,getPluginName:()=>b,h:()=>A,handleError:()=>J,installPlugin:()=>Y,isBrowser:()=>k,isPluginFunction:()=>S,isPluginObject:()=>D,registerComponents:()=>Ne,resetWarnedMessages:()=>ye,setDevMode:()=>ce,uninstallPlugin:()=>M,unregisterElement:()=>Le,warn:()=>ue,warnOnce:()=>Ee,warnOnceUtil:()=>me,warnUtil:()=>Te});module.exports=be(We);var X=(_=>(_[_.ELEMENT=1]="ELEMENT",_[_.FUNCTIONAL_COMPONENT=2]="FUNCTIONAL_COMPONENT",_[_.STATEFUL_COMPONENT=4]="STATEFUL_COMPONENT",_[_.TEXT_CHILDREN=8]="TEXT_CHILDREN",_[_.ARRAY_CHILDREN=16]="ARRAY_CHILDREN",_[_.SLOTS_CHILDREN=32]="SLOTS_CHILDREN",_))(X||{}),z=Symbol("Fragment");function ve(e){return typeof e=="string"||typeof e=="number"}function ne(e){return Array.isArray(e)}function re(e){return e!==null&&typeof e=="object"&&e.type!==void 0&&e.shapeFlag!==void 0}function Ye(e,t){if(t!=null)if(ve(t))e.children=String(t),e.shapeFlag|=8;else if(ne(t)){let n=[];for(let o=0;o<t.length;o++){let c=t[o];if(!(c==null||typeof c=="boolean"))if(ne(c))for(let T=0;T<c.length;T++){let _=c[T];_!=null&&typeof _!="boolean"&&n.push(re(_)?_:W(String(_)))}else re(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 R,y;let o=0;typeof e=="string"?o=1:e===z?o=0:typeof e=="function"?o=2:typeof e=="object"&&e!==null&&(e.setup||e.__vccOpts||e.render)&&(o=4);let c=(R=t==null?void 0:t.key)!=null?R:null,T=(y=t==null?void 0:t.ref)!=null?y:null,_=t;if(t){let{key:g,ref:i,...a}=t;_=a}let m={type:e,props:_,children:null,key:c,ref:T,shapeFlag:o,el:null,component:null};return n!=null&&Ye(m,n),m}function A(e,t,n){return W(e,t||null,n||null)}function v(e){return Object.create(e||null)}function D(e){return e!==null&&typeof e=="object"&&typeof e.install=="function"}function S(e){return typeof e=="function"}function b(e){return D(e)&&e.name||S(e)&&e.name?e.name:D(e)?"[PluginObject]":"[PluginFunction]"}function Y(e,t,...n){if(D(t)){let o=t.onBeforeInstall?t.onBeforeInstall(e,...n):void 0;if(q(o))return o.then(()=>{let c=t.install(e,...n);if(q(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(q(c))return c.then(()=>{if(t.onInstalled)return t.onInstalled(e,...n)});if(t.onInstalled)return t.onInstalled(e,...n)}}else{if(S(t))return t(e,...n);console.warn("[Lyt] \u65E0\u6548\u7684\u63D2\u4EF6\uFF1A\u63D2\u4EF6\u5FC5\u987B\u662F\u5E26\u6709 install \u65B9\u6CD5\u7684\u5BF9\u8C61\u6216\u51FD\u6570\u3002")}}function M(e,t){if(D(t)){if(typeof t.uninstall=="function")return t.uninstall(e);console.warn(`[Lyt] \u63D2\u4EF6 "${b(t)}" \u672A\u5B9A\u4E49 uninstall \u65B9\u6CD5\uFF0C\u65E0\u6CD5\u5B8C\u5168\u5378\u8F7D\u3002`)}else S(t)&&console.warn(`[Lyt] \u51FD\u6570\u5F62\u5F0F\u63D2\u4EF6 "${b(t)}" \u4E0D\u652F\u6301\u5378\u8F7D\u3002`)}function q(e){return e!==null&&typeof e=="object"&&typeof e.then=="function"}var x=require("@lytjs/reactivity"),ie=require("@lytjs/compiler"),N=require("@lytjs/component"),se=require("@lytjs/renderer"),oe=new Map;function Me(e){let t=oe.get(e);if(t)return t;let{code:n}=(0,ie.compile)(e);return t=new Function("h","_ctx",`return ${n}`),oe.set(e,t),t}function xe(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=(o,c)=>n(c.renderProxy)}if(e.computed){let n={};for(let o of Object.keys(e.computed)){let c=e.computed[o];typeof c=="function"?n[o]={get:c}:n[o]=c}t.computed=n}if(typeof e.init=="function"){let n=e.init;t.init=function(o,c){return n.call(this,o)}}return t}function Ve(){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[o,c]of Object.entries(t))c&&n.push(o);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,o){e.addEventListener(t,n,o)},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 ae(e,t){let n=new Set,o={},c={},T=v(),_={},m={},R=null,y=null,g=null,i=null,a=!1,s=xe(typeof e=="function"?{render:e}:e),p=(0,N.defineComponent)(s),l={config:_,globalProperties:m,get _instance(){return R},mount(f){if(a)return console.warn("[Lyt] \u5E94\u7528\u5DF2\u7ECF\u6302\u8F7D\uFF0C\u4E0D\u80FD\u91CD\u590D\u6302\u8F7D\u3002"),l;let d;if(typeof f=="string"){if(d=document.querySelector(f),!d)throw new Error(`[Lyt] \u627E\u4E0D\u5230\u6302\u8F7D\u76EE\u6807: "${f}"`)}else d=f;i=d;let I=Ve();y=(0,se.createRenderer)(I),R=(0,N.createComponentInstance)(p),(0,N.setupComponent)(R,t||{},null);let h=R.type;if(!h.render&&h.template){let H=Me(h.template);h.render=(G,u)=>H(G,u.renderProxy)}return(0,N.mountComponent)(R,A),R.subTree&&y.mount(R.subTree,d),g=(0,x.effect)(()=>{if(!(!R||!R.isMounted||!y)&&((0,N.updateComponent)(R,A),R.subTree&&i)){let H=i.firstChild,G=R.subTree;i.innerHTML="",y.mount(G,i)}},{lazy:!0}),a=!0,l},unmount(){if(!a){console.warn("[Lyt] \u5E94\u7528\u672A\u6302\u8F7D\uFF0C\u65E0\u6CD5\u5378\u8F7D\u3002");return}g&&((0,x.stop)(g),g=null),R&&(0,N.unmountComponent)(R),i&&(i.innerHTML=""),R=null,y=null,i=null,a=!1},use(f,...d){if(n.has(f))return console.warn("[Lyt] \u63D2\u4EF6\u5DF2\u7ECF\u5B89\u88C5\uFF0C\u4E0D\u80FD\u91CD\u590D\u5B89\u88C5\u3002"),l;n.add(f);let I=Y({use:l.use.bind(l),unuse:l.unuse.bind(l),isInstalled:l.isInstalled.bind(l),provide:l.provide.bind(l),inject:l.inject.bind(l),config:_,globalProperties:m},f,...d);return I instanceof Promise?I.then(()=>l):l},unuse(f){if(!n.has(f))return console.warn("[Lyt] \u63D2\u4EF6\u672A\u5B89\u88C5\uFF0C\u65E0\u6CD5\u5378\u8F7D\u3002"),l;n.delete(f);let d=M({use:l.use.bind(l),unuse:l.unuse.bind(l),isInstalled:l.isInstalled.bind(l),provide:l.provide.bind(l),inject:l.inject.bind(l),config:_,globalProperties:m},f);return d instanceof Promise?d.then(()=>l):l},isInstalled(f){return n.has(f)},provide(f,d){return T[f]=d,l},inject(f,d){let I=T[f];return I!==void 0?I:d},component(f,d){return d?(o[f]=d,l):o[f]},directive(f,d){return d?(c[f]=d,l):c[f]}};return l}var K=(u=>(u[u.INVALID_ARGUMENT=1001]="INVALID_ARGUMENT",u[u.NOT_FOUND=1002]="NOT_FOUND",u[u.ALREADY_EXISTS=1003]="ALREADY_EXISTS",u[u.OPERATION_FAILED=1004]="OPERATION_FAILED",u[u.REACTIVE_READONLY=2001]="REACTIVE_READONLY",u[u.REACTIVE_EFFECT_DISPOSED=2002]="REACTIVE_EFFECT_DISPOSED",u[u.COMPUTED_CYCLE=2003]="COMPUTED_CYCLE",u[u.PARSE_ERROR=3001]="PARSE_ERROR",u[u.INVALID_EXPRESSION=3002]="INVALID_EXPRESSION",u[u.INVALID_DIRECTIVE=3003]="INVALID_DIRECTIVE",u[u.INVALID_TEMPLATE=3004]="INVALID_TEMPLATE",u[u.RENDER_ERROR=4001]="RENDER_ERROR",u[u.HYDRATION_MISMATCH=4002]="HYDRATION_MISMATCH",u[u.INVALID_VNODE=4003]="INVALID_VNODE",u[u.COMPONENT_INVALID_PROPS=5001]="COMPONENT_INVALID_PROPS",u[u.COMPONENT_MISSING_TEMPLATE=5002]="COMPONENT_MISSING_TEMPLATE",u[u.COMPONENT_LIFECYCLE_ERROR=5003]="COMPONENT_LIFECYCLE_ERROR",u[u.ROUTE_NOT_FOUND=6001]="ROUTE_NOT_FOUND",u[u.ROUTE_DUPLICATE=6002]="ROUTE_DUPLICATE",u[u.NAVIGATION_ABORTED=6003]="NAVIGATION_ABORTED",u[u.NAVIGATION_FAILED=6004]="NAVIGATION_FAILED",u[u.STORE_NOT_FOUND=7001]="STORE_NOT_FOUND",u[u.STORE_DUPLICATE=7002]="STORE_DUPLICATE",u))(K||{});var C=class extends Error{constructor(t,n,o){let c=`[Lyt ${t}] ${n}`;super(c),this.name="LytError",this.code=t,this.details=o}};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,o){var _;let c={error:t,vm:n,info:o||"",timestamp:Date.now()};this.errors.push(c),this._hasError=!0;let T=(_=this.options.maxErrors)!=null?_:100;this.errors.length>T&&this.errors.splice(0,this.errors.length-T),!(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}};V.globalHandler=null;var P=V,F=!0,le=new Set;function ce(e){F=e}function ue(e){F&&console.warn(`[Lyt warn] ${e}`)}function Ee(e){F&&(le.has(e)||(le.add(e),console.warn(`[Lyt warn] ${e}`)))}var Fe={1001:e=>`\u53C2\u6570 "${e}" \u65E0\u6548\u3002\u8BF7\u68C0\u67E5\u4F20\u5165\u7684\u503C\u7C7B\u578B\u548C\u8303\u56F4\u3002`,1002:e=>`"${e}" \u672A\u627E\u5230\u3002\u8BF7\u786E\u8BA4\u8D44\u6E90\u540D\u79F0\u6216\u8DEF\u5F84\u662F\u5426\u6B63\u786E\u3002`,1003:e=>`"${e}" \u5DF2\u5B58\u5728\u3002\u8BF7\u4F7F\u7528\u4E0D\u540C\u7684\u540D\u79F0\u3002`,1004:e=>`\u64CD\u4F5C "${e}" \u6267\u884C\u5931\u8D25\u3002\u8BF7\u68C0\u67E5\u76F8\u5173\u914D\u7F6E\u548C\u72B6\u6001\u3002`,2001:e=>`\u65E0\u6CD5\u4FEE\u6539\u53EA\u8BFB\u54CD\u5E94\u5F0F\u5C5E\u6027 "${e}"\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:e=>`\u6A21\u677F\u89E3\u6790\u9519\u8BEF\uFF1A${e}\u3002\u8BF7\u68C0\u67E5\u6A21\u677F\u8BED\u6CD5\u662F\u5426\u6B63\u786E\u3002`,3002:e=>`\u65E0\u6548\u7684\u8868\u8FBE\u5F0F "${e}"\u3002\u8BF7\u68C0\u67E5\u8868\u8FBE\u5F0F\u8BED\u6CD5\u3002`,3003:e=>`\u65E0\u6548\u7684\u6307\u4EE4 "${e}"\u3002\u8BF7\u786E\u8BA4\u6307\u4EE4\u540D\u79F0\u662F\u5426\u6B63\u786E\u3002`,3004:e=>`\u65E0\u6548\u7684\u6A21\u677F\uFF1A${e}\u3002\u8BF7\u68C0\u67E5\u6A21\u677F\u5185\u5BB9\u3002`,4001:e=>`\u6E32\u67D3\u9519\u8BEF\uFF1A${e}\u3002\u8BF7\u68C0\u67E5\u7EC4\u4EF6\u7684 render \u51FD\u6570\u6216\u6A21\u677F\u3002`,4002:e=>`\u6C34\u5408\u4E0D\u5339\u914D\uFF1A${e}\u3002\u670D\u52A1\u7AEF\u6E32\u67D3\u4E0E\u5BA2\u6237\u7AEF\u6E32\u67D3\u7ED3\u679C\u4E0D\u4E00\u81F4\u3002`,4003:e=>`\u65E0\u6548\u7684\u865A\u62DF\u8282\u70B9\uFF1A${e}\u3002VNode \u7F3A\u5C11\u5FC5\u8981\u7684 type \u6216\u5176\u4ED6\u5C5E\u6027\u3002`,5001:e=>`\u7EC4\u4EF6\u5C5E\u6027\u65E0\u6548\uFF1A${e}\u3002\u8BF7\u68C0\u67E5\u4F20\u5165\u7684 props \u662F\u5426\u7B26\u5408\u7EC4\u4EF6\u5B9A\u4E49\u3002`,5002:e=>`\u7EC4\u4EF6 "${e}" \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:e=>`\u7EC4\u4EF6\u751F\u547D\u5468\u671F\u9519\u8BEF\uFF1A${e}\u3002\u8BF7\u68C0\u67E5\u751F\u547D\u5468\u671F\u94A9\u5B50\u51FD\u6570\u3002`,6001:e=>`\u8DEF\u7531 "${e}" \u672A\u627E\u5230\u3002\u8BF7\u786E\u8BA4\u8DEF\u7531\u8DEF\u5F84\u662F\u5426\u5DF2\u6CE8\u518C\u3002`,6002:e=>`\u8DEF\u7531 "${e}" \u5DF2\u5B58\u5728\u3002\u8BF7\u907F\u514D\u91CD\u590D\u6CE8\u518C\u76F8\u540C\u7684\u8DEF\u7531\u8DEF\u5F84\u3002`,6003:e=>`\u5BFC\u822A\u88AB\u4E2D\u6B62\uFF1A${e}\u3002\u53EF\u80FD\u88AB\u5BFC\u822A\u5B88\u536B\u62E6\u622A\u3002`,6004:e=>`\u5BFC\u822A\u5931\u8D25\uFF1A${e}\u3002\u8BF7\u68C0\u67E5\u76EE\u6807\u8DEF\u7531\u662F\u5426\u6709\u6548\u3002`,7001:e=>`Store "${e}" \u672A\u627E\u5230\u3002\u8BF7\u786E\u8BA4 store \u662F\u5426\u5DF2\u6CE8\u518C\u3002`,7002:e=>`Store "${e}" \u5DF2\u5B58\u5728\u3002\u8BF7\u907F\u514D\u91CD\u590D\u521B\u5EFA\u76F8\u540C ID \u7684 store\u3002`};function pe(e,...t){let n=Fe[e];if(n){let o=n(...t);return`[Lyt ${e}] ${o}`}return`[Lyt ${e}] \u672A\u77E5\u9519\u8BEF\u3002`}function J(e,t,n){P.globalHandler&&P.globalHandler(e,t,n||""),F&&(e instanceof C?(console.error(e.message),e.details&&console.error("\u8BE6\u7EC6\u4FE1\u606F:",e.details)):console.error(`[Lyt Error] ${e.message}`),t&&console.error("\u7EC4\u4EF6\u5B9E\u4F8B:",t),n&&console.error("\u9519\u8BEF\u6765\u6E90:",n))}function _e(e,t){try{return e()}catch(n){J(n instanceof Error?n:new Error(String(n)),t);return}}var Z=(r=>(r[r.LYT_COMPILER_PARSE_ERROR=1001]="LYT_COMPILER_PARSE_ERROR",r[r.LYT_COMPILER_INVALID_EXPRESSION=1002]="LYT_COMPILER_INVALID_EXPRESSION",r[r.LYT_COMPILER_INVALID_TEMPLATE=1003]="LYT_COMPILER_INVALID_TEMPLATE",r[r.LYT_COMPILER_INVALID_DIRECTIVE=1004]="LYT_COMPILER_INVALID_DIRECTIVE",r[r.LYT_COMPILER_CODEGEN_ERROR=1005]="LYT_COMPILER_CODEGEN_ERROR",r[r.LYT_COMPILER_SFC_PARSE_ERROR=1006]="LYT_COMPILER_SFC_PARSE_ERROR",r[r.LYT_COMPILER_TRANSFORM_ERROR=1007]="LYT_COMPILER_TRANSFORM_ERROR",r[r.LYT_RENDERER_MOUNT_FAILED=2001]="LYT_RENDERER_MOUNT_FAILED",r[r.LYT_RENDERER_PATCH_FAILED=2002]="LYT_RENDERER_PATCH_FAILED",r[r.LYT_RENDERER_HYDRATION_MISMATCH=2003]="LYT_RENDERER_HYDRATION_MISMATCH",r[r.LYT_RENDERER_INVALID_VNODE=2004]="LYT_RENDERER_INVALID_VNODE",r[r.LYT_RENDERER_UNMOUNT_FAILED=2005]="LYT_RENDERER_UNMOUNT_FAILED",r[r.LYT_COMPONENT_INVALID_PROPS=3001]="LYT_COMPONENT_INVALID_PROPS",r[r.LYT_COMPONENT_MISSING_RENDER=3002]="LYT_COMPONENT_MISSING_RENDER",r[r.LYT_COMPONENT_LIFECYCLE_ERROR=3003]="LYT_COMPONENT_LIFECYCLE_ERROR",r[r.LYT_COMPONENT_INVALID=3004]="LYT_COMPONENT_INVALID",r[r.LYT_COMPONENT_EMIT_INVALID=3005]="LYT_COMPONENT_EMIT_INVALID",r[r.LYT_COMPONENT_RENDER_ERROR=3006]="LYT_COMPONENT_RENDER_ERROR",r[r.LYT_ROUTER_INVALID_ROUTE=4001]="LYT_ROUTER_INVALID_ROUTE",r[r.LYT_ROUTER_NAVIGATION_FAILED=4002]="LYT_ROUTER_NAVIGATION_FAILED",r[r.LYT_ROUTER_DUPLICATE_ROUTE=4003]="LYT_ROUTER_DUPLICATE_ROUTE",r[r.LYT_ROUTER_NAVIGATION_ABORTED=4004]="LYT_ROUTER_NAVIGATION_ABORTED",r[r.LYT_ROUTER_GUARD_ERROR=4005]="LYT_ROUTER_GUARD_ERROR",r[r.LYT_STORE_ALREADY_EXISTS=5001]="LYT_STORE_ALREADY_EXISTS",r[r.LYT_STORE_NOT_FOUND=5002]="LYT_STORE_NOT_FOUND",r[r.LYT_STORE_DISPOSED=5003]="LYT_STORE_DISPOSED",r[r.LYT_STORE_PATCH_ERROR=5004]="LYT_STORE_PATCH_ERROR",r[r.LYT_REACTIVITY_READONLY_SET=6001]="LYT_REACTIVITY_READONLY_SET",r[r.LYT_REACTIVITY_READONLY_DELETE=6002]="LYT_REACTIVITY_READONLY_DELETE",r[r.LYT_REACTIVITY_EFFECT_ERROR=6003]="LYT_REACTIVITY_EFFECT_ERROR",r[r.LYT_REACTIVITY_COMPUTED_CYCLE=6004]="LYT_REACTIVITY_COMPUTED_CYCLE",r[r.LYT_REACTIVITY_EFFECT_DISPOSED=6005]="LYT_REACTIVITY_EFFECT_DISPOSED",r[r.LYT_CORE_PLUGIN_ERROR=7001]="LYT_CORE_PLUGIN_ERROR",r[r.LYT_CORE_MOUNT_NO_CONTAINER=7002]="LYT_CORE_MOUNT_NO_CONTAINER",r[r.LYT_CORE_ALREADY_MOUNTED=7003]="LYT_CORE_ALREADY_MOUNTED",r[r.LYT_CORE_INVALID_ARGUMENT=7004]="LYT_CORE_INVALID_ARGUMENT",r[r.LYT_CORE_NOT_FOUND=7005]="LYT_CORE_NOT_FOUND",r[r.LYT_CORE_ALREADY_EXISTS=7006]="LYT_CORE_ALREADY_EXISTS",r[r.LYT_CORE_OPERATION_FAILED=7007]="LYT_CORE_OPERATION_FAILED",r[r.LYT_CLI_SCAFFOLD_FAILED=8001]="LYT_CLI_SCAFFOLD_FAILED",r[r.LYT_CLI_BUILD_FAILED=8002]="LYT_CLI_BUILD_FAILED",r[r.LYT_CLI_DEV_SERVER_ERROR=8003]="LYT_CLI_DEV_SERVER_ERROR",r[r.LYT_CLI_CONFIG_INVALID=8004]="LYT_CLI_CONFIG_INVALID",r[r.LYT_CLI_HMR_CONNECTION_FAILED=8005]="LYT_CLI_HMR_CONNECTION_FAILED",r[r.LYT_DEVTOOLS_CONNECTION_FAILED=9001]="LYT_DEVTOOLS_CONNECTION_FAILED",r[r.LYT_DEVTOOLS_PANEL_ERROR=9002]="LYT_DEVTOOLS_PANEL_ERROR",r[r.LYT_DEVTOOLS_PERF_OVERFLOW=9003]="LYT_DEVTOOLS_PERF_OVERFLOW",r[r.LYT_DEVTOOLS_COMPONENT_TREE_ERROR=9004]="LYT_DEVTOOLS_COMPONENT_TREE_ERROR",r[r.LYT_PLUGIN_INSTALL_FAILED=10001]="LYT_PLUGIN_INSTALL_FAILED",r[r.LYT_PLUGIN_ALREADY_INSTALLED=10002]="LYT_PLUGIN_ALREADY_INSTALLED",r[r.LYT_PLUGIN_INVALID=10003]="LYT_PLUGIN_INVALID",r[r.LYT_PLUGIN_UNINSTALL_FAILED=10004]="LYT_PLUGIN_UNINSTALL_FAILED",r[r.LYT_SSR_STREAM_ERROR=11001]="LYT_SSR_STREAM_ERROR",r[r.LYT_SSR_SUSPENSE_TIMEOUT=11002]="LYT_SSR_SUSPENSE_TIMEOUT",r[r.LYT_SSR_HYDRATION_ERROR=11003]="LYT_SSR_HYDRATION_ERROR",r[r.LYT_SSR_ISLAND_ERROR=11004]="LYT_SSR_ISLAND_ERROR",r))(Z||{}),O={COMPILER:"COMPILER",RENDERER:"RENDERER",COMPONENT:"COMPONENT",ROUTER:"ROUTER",STORE:"STORE",REACTIVITY:"REACTIVITY",CORE:"CORE",CLI:"CLI",DEVTOOLS:"DEVTOOLS",PLUGIN:"PLUGIN",SSR:"SSR"},Ue={1001:"\u6A21\u677F\u89E3\u6790\u9519\u8BEF\uFF0C\u8BF7\u68C0\u67E5\u6A21\u677F\u8BED\u6CD5\u662F\u5426\u6B63\u786E\u3002",1002:"\u65E0\u6548\u7684\u8868\u8FBE\u5F0F\uFF0C\u8BF7\u68C0\u67E5\u8868\u8FBE\u5F0F\u8BED\u6CD5\u3002",1003:"\u65E0\u6548\u7684\u6A21\u677F\uFF0C\u8BF7\u68C0\u67E5\u6A21\u677F\u5185\u5BB9\u3002",1004:"\u65E0\u6548\u7684\u6307\u4EE4\uFF0C\u8BF7\u786E\u8BA4\u6307\u4EE4\u540D\u79F0\u662F\u5426\u6B63\u786E\u3002",1005:"\u4EE3\u7801\u751F\u6210\u9519\u8BEF\uFF0C\u8BF7\u68C0\u67E5\u6A21\u677F\u7F16\u8BD1\u914D\u7F6E\u3002",1006:"\u5355\u6587\u4EF6\u7EC4\u4EF6\u89E3\u6790\u9519\u8BEF\uFF0C\u8BF7\u68C0\u67E5 SFC \u8BED\u6CD5\u3002",1007:"\u6A21\u677F\u8F6C\u6362\u9519\u8BEF\uFF0C\u8BF7\u68C0\u67E5 AST \u8F6C\u6362\u903B\u8F91\u3002",2001:"\u6302\u8F7D\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u5BB9\u5668\u5143\u7D20\u662F\u5426\u5B58\u5728\u3002",2002:"\u8865\u4E01\u66F4\u65B0\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5 VNode \u7ED3\u6784\u3002",2003:"\u6C34\u5408\u4E0D\u5339\u914D\uFF0C\u670D\u52A1\u7AEF\u4E0E\u5BA2\u6237\u7AEF\u6E32\u67D3\u7ED3\u679C\u4E0D\u4E00\u81F4\u3002",2004:"\u65E0\u6548\u7684\u865A\u62DF\u8282\u70B9\uFF0CVNode \u7F3A\u5C11\u5FC5\u8981\u7684 type \u5C5E\u6027\u3002",2005:"\u5378\u8F7D\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u7EC4\u4EF6\u662F\u5426\u5DF2\u6302\u8F7D\u3002",3001:"\u7EC4\u4EF6\u5C5E\u6027\u65E0\u6548\uFF0C\u8BF7\u68C0\u67E5\u4F20\u5165\u7684 props\u3002",3002:"\u7EC4\u4EF6\u7F3A\u5C11 template \u6216 render \u51FD\u6570\u3002",3003:"\u7EC4\u4EF6\u751F\u547D\u5468\u671F\u9519\u8BEF\uFF0C\u8BF7\u68C0\u67E5\u751F\u547D\u5468\u671F\u94A9\u5B50\u51FD\u6570\u3002",3004:"\u65E0\u6548\u7684\u7EC4\u4EF6\u5B9A\u4E49\uFF0C\u8BF7\u68C0\u67E5\u7EC4\u4EF6\u914D\u7F6E\u3002",3005:"\u65E0\u6548\u7684\u4E8B\u4EF6\u53D1\u5C04\uFF0C\u8BF7\u68C0\u67E5 emits \u58F0\u660E\u3002",3006:"\u7EC4\u4EF6\u6E32\u67D3\u9519\u8BEF\uFF0C\u8BF7\u68C0\u67E5 render \u51FD\u6570\u3002",4001:"\u65E0\u6548\u7684\u8DEF\u7531\uFF0C\u8BF7\u786E\u8BA4\u8DEF\u7531\u8DEF\u5F84\u662F\u5426\u5DF2\u6CE8\u518C\u3002",4002:"\u5BFC\u822A\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u76EE\u6807\u8DEF\u7531\u662F\u5426\u6709\u6548\u3002",4003:"\u8DEF\u7531\u5DF2\u5B58\u5728\uFF0C\u8BF7\u907F\u514D\u91CD\u590D\u6CE8\u518C\u76F8\u540C\u7684\u8DEF\u7531\u8DEF\u5F84\u3002",4004:"\u5BFC\u822A\u88AB\u4E2D\u6B62\uFF0C\u53EF\u80FD\u88AB\u5BFC\u822A\u5B88\u536B\u62E6\u622A\u3002",4005:"\u8DEF\u7531\u5B88\u536B\u9519\u8BEF\uFF0C\u8BF7\u68C0\u67E5\u5B88\u536B\u51FD\u6570\u3002",5001:"Store \u5DF2\u5B58\u5728\uFF0C\u8BF7\u907F\u514D\u91CD\u590D\u521B\u5EFA\u76F8\u540C ID \u7684 store\u3002",5002:"Store \u672A\u627E\u5230\uFF0C\u8BF7\u786E\u8BA4 store \u662F\u5426\u5DF2\u6CE8\u518C\u3002",5003:"Store \u5DF2\u88AB\u9500\u6BC1\uFF0C\u65E0\u6CD5\u7EE7\u7EED\u64CD\u4F5C\u3002",5004:"Store \u72B6\u6001\u66F4\u65B0\u9519\u8BEF\uFF0C\u8BF7\u68C0\u67E5 patch \u6570\u636E\u3002",6001:"\u65E0\u6CD5\u4FEE\u6539\u53EA\u8BFB\u54CD\u5E94\u5F0F\u5C5E\u6027\u3002",6002:"\u65E0\u6CD5\u5220\u9664\u53EA\u8BFB\u54CD\u5E94\u5F0F\u5C5E\u6027\u3002",6003:"\u526F\u4F5C\u7528\u51FD\u6570\u6267\u884C\u9519\u8BEF\u3002",6004:"\u8BA1\u7B97\u5C5E\u6027\u68C0\u6D4B\u5230\u5FAA\u73AF\u4F9D\u8D56\u3002",6005:"\u526F\u4F5C\u7528\u51FD\u6570\u5DF2\u88AB\u9500\u6BC1\uFF0C\u65E0\u6CD5\u518D\u6B21\u6267\u884C\u3002",7001:"\u63D2\u4EF6\u9519\u8BEF\uFF0C\u8BF7\u68C0\u67E5\u63D2\u4EF6\u914D\u7F6E\u548C\u5B89\u88C5\u903B\u8F91\u3002",7002:"\u627E\u4E0D\u5230\u6302\u8F7D\u76EE\u6807\u5BB9\u5668\u3002",7003:"\u5E94\u7528\u5DF2\u7ECF\u6302\u8F7D\uFF0C\u4E0D\u80FD\u91CD\u590D\u6302\u8F7D\u3002",7004:"\u53C2\u6570\u65E0\u6548\uFF0C\u8BF7\u68C0\u67E5\u4F20\u5165\u7684\u503C\u7C7B\u578B\u548C\u8303\u56F4\u3002",7005:"\u8D44\u6E90\u672A\u627E\u5230\uFF0C\u8BF7\u786E\u8BA4\u540D\u79F0\u6216\u8DEF\u5F84\u662F\u5426\u6B63\u786E\u3002",7006:"\u8D44\u6E90\u5DF2\u5B58\u5728\uFF0C\u8BF7\u4F7F\u7528\u4E0D\u540C\u7684\u540D\u79F0\u3002",7007:"\u64CD\u4F5C\u6267\u884C\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u76F8\u5173\u914D\u7F6E\u548C\u72B6\u6001\u3002",8001:"\u9879\u76EE\u811A\u624B\u67B6\u521B\u5EFA\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u6A21\u677F\u548C\u76EE\u6807\u76EE\u5F55\u3002",8002:"\u9879\u76EE\u6784\u5EFA\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u6784\u5EFA\u914D\u7F6E\u548C\u6E90\u4EE3\u7801\u3002",8003:"\u5F00\u53D1\u670D\u52A1\u5668\u542F\u52A8\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u7AEF\u53E3\u548C\u914D\u7F6E\u3002",8004:"\u914D\u7F6E\u6587\u4EF6\u65E0\u6548\uFF0C\u8BF7\u68C0\u67E5\u914D\u7F6E\u683C\u5F0F\u548C\u5FC5\u586B\u5B57\u6BB5\u3002",8005:"\u70ED\u6A21\u5757\u66FF\u6362\u8FDE\u63A5\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5 WebSocket \u914D\u7F6E\u3002",9001:"DevTools \u8FDE\u63A5\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u6269\u5C55\u548C\u8FD0\u884C\u65F6\u7248\u672C\u662F\u5426\u5339\u914D\u3002",9002:"DevTools \u9762\u677F\u52A0\u8F7D\u9519\u8BEF\uFF0C\u8BF7\u5C1D\u8BD5\u5237\u65B0\u9875\u9762\u3002",9003:"\u6027\u80FD\u6570\u636E\u6EA2\u51FA\uFF0C\u8BF7\u51CF\u5C11\u76D1\u63A7\u7684\u7EC4\u4EF6\u6570\u91CF\u6216\u7F29\u77ED\u91C7\u96C6\u5468\u671F\u3002",9004:"\u7EC4\u4EF6\u6811\u89E3\u6790\u9519\u8BEF\uFF0C\u8BF7\u68C0\u67E5\u7EC4\u4EF6\u5B9E\u4F8B\u72B6\u6001\u3002",10001:"\u63D2\u4EF6\u5B89\u88C5\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u63D2\u4EF6\u5305\u548C\u5B89\u88C5\u903B\u8F91\u3002",10002:"\u63D2\u4EF6\u5DF2\u5B89\u88C5\uFF0C\u8BF7\u907F\u514D\u91CD\u590D\u5B89\u88C5\u76F8\u540C\u63D2\u4EF6\u3002",10003:"\u65E0\u6548\u7684\u63D2\u4EF6\uFF0C\u8BF7\u68C0\u67E5\u63D2\u4EF6\u662F\u5426\u6EE1\u8DB3\u63A5\u53E3\u8981\u6C42\u3002",10004:"\u63D2\u4EF6\u5378\u8F7D\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u63D2\u4EF6\u662F\u5426\u5DF2\u88AB\u6B63\u786E\u6E05\u7406\u3002",11001:"SSR \u6D41\u5F0F\u6E32\u67D3\u9519\u8BEF\uFF0C\u8BF7\u68C0\u67E5\u6D41\u7BA1\u9053\u914D\u7F6E\u3002",11002:"SSR Suspense \u8D85\u65F6\uFF0C\u8BF7\u68C0\u67E5\u5F02\u6B65\u7EC4\u4EF6\u7684\u52A0\u8F7D\u65F6\u95F4\u3002",11003:"SSR \u6C34\u5408\u9519\u8BEF\uFF0C\u670D\u52A1\u7AEF\u4E0E\u5BA2\u6237\u7AEF\u6E32\u67D3\u7ED3\u679C\u4E0D\u4E00\u81F4\u3002",11004:"SSR Island \u7EC4\u4EF6\u9519\u8BEF\uFF0C\u8BF7\u68C0\u67E5\u5B64\u5C9B\u7EC4\u4EF6\u7684\u5E8F\u5217\u5316\u548C\u6E32\u67D3\u903B\u8F91\u3002"};function we(e){return e>=1e3&&e<2e3?O.COMPILER:e>=2e3&&e<3e3?O.RENDERER:e>=3e3&&e<4e3?O.COMPONENT:e>=4e3&&e<5e3?O.ROUTER:e>=5e3&&e<6e3?O.STORE:e>=6e3&&e<7e3?O.REACTIVITY:e>=7e3&&e<8e3?O.CORE:e>=8e3&&e<9e3?O.CLI:e>=9e3&&e<1e4?O.DEVTOOLS:e>=1e4&&e<11e3?O.PLUGIN:e>=11e3&&e<12e3?O.SSR:"UNKNOWN"}function U(e){return Ue[e]||"\u672A\u77E5\u9519\u8BEF\u3002"}function w(e){return we(e)}var L=class extends Error{constructor(t,n,o){super(n||U(t)),this.name="LytError",this.code=t,this.category=w(t),this.details=o}};function fe(e,t,n){let o=new L(e,n);return o.loc=t,o}function de(e,t,n){let o=new L(e,n);return o.details={vnode:t},o}function Re(e,t,n){let o=typeof t=="string"?t:t==null?void 0:t.name,c=new L(e,n);return c.details={component:o},c}var ee=!0;function j(){return ee}var Q=new Set;function Te(e){ee&&console.warn(`[Lyt warn] ${e}`)}function me(e){ee&&(Q.has(e)||(Q.add(e),console.warn(`[Lyt warn] ${e}`)))}function Oe(e){console.error(`[Lyt error] ${e}`)}function ye(){Q.clear()}function te(e){let t=[];if(e instanceof L?(t.push(`[Lyt Error] [${e.category}] Code: ${e.code}`),t.push(` Message: ${e.message}`)):t.push(`[Lyt Error] ${e.message}`),e instanceof L&&e.loc){let o=e.loc,c="";o.file&&(c+=o.file),o.line!=null&&(c+=`:${o.line}`),o.column!=null&&(c+=`:${o.column}`),c&&t.push(` Location: ${c}`),o.source&&t.push(` Source: ${o.source}`)}if(e instanceof L&&e.details&&e.details.component&&t.push(` Component: ${e.details.component}`),e.stack){t.push(""),t.push(" Stack:");let o=e.stack.split(`
|
|
2
|
-
`).slice(1);for(let c of o)t.push(` ${c.trim()}`)}let n=je(e);return n&&(t.push(""),t.push(` Suggestion: ${n}`)),t.join(`
|
|
3
|
-
`)}function ge(e){if(!e)return"";let t=[],n=e;for(;n;){let o=n.name||n.$name||"Anonymous";t.push(o),n=n.parent||n.$parent}return t.join(" > ")}function je(e){if(!(e instanceof L))return"\u8BF7\u68C0\u67E5\u4EE3\u7801\u903B\u8F91\uFF0C\u786E\u4FDD\u6CA1\u6709\u8FD0\u884C\u65F6\u5F02\u5E38\u3002";let t=e.code;return t>=1e3&&t<2e3?"\u8BF7\u68C0\u67E5\u6A21\u677F\u8BED\u6CD5\u662F\u5426\u6B63\u786E\uFF0C\u53C2\u8003 Lyt.js \u6A21\u677F\u8BED\u6CD5\u6587\u6863\u3002":t>=2e3&&t<3e3?t===2003?"\u6C34\u5408\u4E0D\u5339\u914D\u901A\u5E38\u7531\u670D\u52A1\u7AEF\u548C\u5BA2\u6237\u7AEF\u6E32\u67D3\u7ED3\u679C\u4E0D\u4E00\u81F4\u5F15\u8D77\u3002\u8BF7\u786E\u4FDD\u670D\u52A1\u7AEF\u548C\u5BA2\u6237\u7AEF\u4F7F\u7528\u76F8\u540C\u7684\u6570\u636E\u548C\u7EC4\u4EF6\u7248\u672C\u3002":"\u8BF7\u68C0\u67E5 VNode \u7ED3\u6784\u548C DOM \u5BB9\u5668\u662F\u5426\u6B63\u786E\u3002":t>=3e3&&t<4e3?t===3001?"\u8BF7\u68C0\u67E5\u4F20\u5165\u7684 props \u662F\u5426\u7B26\u5408\u7EC4\u4EF6\u5B9A\u4E49\u4E2D\u7684 props \u58F0\u660E\u3002":t===3002?"\u8BF7\u786E\u4FDD\u7EC4\u4EF6\u5B9A\u4E49\u4E2D\u5305\u542B template \u5B57\u7B26\u4E32\u6216 render \u65B9\u6CD5\u3002":"\u8BF7\u68C0\u67E5\u7EC4\u4EF6\u5B9A\u4E49\u548C\u751F\u547D\u5468\u671F\u94A9\u5B50\u51FD\u6570\u3002":t>=4e3&&t<5e3?"\u8BF7\u68C0\u67E5\u8DEF\u7531\u914D\u7F6E\uFF0C\u786E\u4FDD\u8DEF\u7531\u8DEF\u5F84\u5DF2\u6B63\u786E\u6CE8\u518C\u3002":t>=5e3&&t<6e3?"\u8BF7\u68C0\u67E5 Store \u7684\u521B\u5EFA\u548C\u4F7F\u7528\uFF0C\u786E\u4FDD ID \u552F\u4E00\u4E14 Store \u672A\u88AB\u9500\u6BC1\u3002":t>=6e3&&t<7e3?t===6004?"\u8BF7\u68C0\u67E5 computed \u51FD\u6570\u662F\u5426\u5F15\u7528\u4E86\u81EA\u8EAB\uFF0C\u79FB\u9664\u5FAA\u73AF\u4F9D\u8D56\u3002":"\u8BF7\u68C0\u67E5\u54CD\u5E94\u5F0F\u6570\u636E\u7684\u8BFB\u5199\u64CD\u4F5C\u3002":t>=7e3&&t<8e3?t===7002?"\u8BF7\u786E\u4FDD\u6302\u8F7D\u76EE\u6807\u5BB9\u5668\u5728\u8C03\u7528 mount() \u4E4B\u524D\u5DF2\u5B58\u5728\u4E8E DOM \u4E2D\u3002":t===7003?"\u5E94\u7528\u5DF2\u6302\u8F7D\uFF0C\u5982\u9700\u91CD\u65B0\u6302\u8F7D\u8BF7\u5148\u8C03\u7528 unmount()\u3002":"\u8BF7\u68C0\u67E5\u5E94\u7528\u914D\u7F6E\u548C\u53C2\u6570\u3002":null}function Ie(e){if(!j())return"";let t=te(e),n=e.message.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,"""),o=t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">");return`<div style="
|
|
4
|
-
position: fixed;
|
|
5
|
-
top: 0;
|
|
6
|
-
left: 0;
|
|
7
|
-
right: 0;
|
|
8
|
-
bottom: 0;
|
|
9
|
-
z-index: 999999;
|
|
10
|
-
background: rgba(0, 0, 0, 0.75);
|
|
11
|
-
display: flex;
|
|
12
|
-
align-items: center;
|
|
13
|
-
justify-content: center;
|
|
14
|
-
font-family: monospace;
|
|
15
|
-
">
|
|
16
|
-
<div style="
|
|
17
|
-
background: #1e1e1e;
|
|
18
|
-
color: #d4d4d4;
|
|
19
|
-
border-radius: 8px;
|
|
20
|
-
max-width: 640px;
|
|
21
|
-
width: 90%;
|
|
22
|
-
max-height: 80vh;
|
|
23
|
-
overflow: auto;
|
|
24
|
-
padding: 20px;
|
|
25
|
-
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
|
|
26
|
-
">
|
|
27
|
-
<div style="
|
|
28
|
-
color: #f44747;
|
|
29
|
-
font-size: 16px;
|
|
30
|
-
font-weight: bold;
|
|
31
|
-
margin-bottom: 12px;
|
|
32
|
-
border-bottom: 1px solid #333;
|
|
33
|
-
padding-bottom: 8px;
|
|
34
|
-
">Lyt.js Runtime Error</div>
|
|
35
|
-
<div style="
|
|
36
|
-
color: #ce9178;
|
|
37
|
-
font-size: 14px;
|
|
38
|
-
margin-bottom: 16px;
|
|
39
|
-
">${n}</div>
|
|
40
|
-
<pre style="
|
|
41
|
-
color: #d4d4d4;
|
|
42
|
-
font-size: 12px;
|
|
43
|
-
background: #2d2d2d;
|
|
44
|
-
padding: 12px;
|
|
45
|
-
border-radius: 4px;
|
|
46
|
-
overflow-x: auto;
|
|
47
|
-
white-space: pre-wrap;
|
|
48
|
-
word-break: break-all;
|
|
49
|
-
">${o}</pre>
|
|
50
|
-
</div>
|
|
51
|
-
</div>`}function k(){return typeof window!="undefined"&&typeof document!="undefined"&&typeof HTMLElement!="undefined"&&typeof customElements!="undefined"}function ke(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 He(e,t){return t&&t[e]?t[e]:ke(e)}function Ge(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 o of Object.keys(n.methods))if(o.startsWith("on")&&o.length>2){let c=o.charAt(2).toLowerCase()+o.slice(3);t.push(c)}}return t}function Be(e,t={}){let{shadowMode:n="open",styles:o="",propMappings:c,eventMappings:T={},attributeConverters:_={}}=t,m=t.observedAttributes||[],R=Ge(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 m}connectedCallback(){if(!this._connected){if(this._connected=!0,this._shadowRoot=this.attachShadow({mode:n}),o){let i=document.createElement("style");i.textContent=o,this._shadowRoot.appendChild(i)}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 i of this._eventCleanups)i();this._eventCleanups=[],this._effectCleanup&&(this._effectCleanup(),this._effectCleanup=null),this._instance=null,this._container&&(this._container.innerHTML="")}}attributeChangedCallback(i,a,E){a!==E&&this._connected&&(this._syncAttributesToProps(),this._updateComponent())}_syncAttributesToProps(){let i={};for(let a of m)if(this.hasAttribute(a)){let E=this.getAttribute(a),s=He(a,c);_[a]?i[s]=_[a](E):i[s]=$e(E)}if(e.props){for(let[a,E]of Object.entries(e.props))if(i[a]===void 0){let s=E;s&&typeof s=="object"&&"default"in s?i[a]=typeof s.default=="function"?s.default():s.default:s==null}}this._props=i}_mountComponent(){let i=e.render?e.render:e.template?this._compileTemplate(e.template):null;if(!i)return;let a=this._createComponentContext(),E=i.call(a,A,a);E&&this._container&&this._renderVNode(E,this._container),this._setupReactiveUpdates(a,i)}_compileTemplate(i){try{let a=Function("return require")(),{compile:E}=a("../../compiler/src/index.ts"),{code:s}=E(i);return new Function("h","_ctx",`return ${s}`)}catch(a){return console.warn("[Lyt Web Component] \u6A21\u677F\u7F16\u8BD1\u9700\u8981 @lytjs/compiler \u5305"),null}}_createComponentContext(){let i=e.state?typeof e.state=="function"?e.state():{...e.state}:{},a=e.computed||{},E=e.methods||{},s={...this._props,...i};for(let[p,l]of Object.entries(a))typeof l=="function"?Object.defineProperty(s,p,{get:l.bind(s),enumerable:!0}):l&&typeof l=="object"&&"get"in l&&Object.defineProperty(s,p,{get:l.get.bind(s),enumerable:!0});for(let[p,l]of Object.entries(E))typeof l=="function"&&(s[p]=l.bind(s));return s.emit=(p,...l)=>{let f=T[p]||p,d=new CustomEvent(f,{detail:l.length===1?l[0]:l,bubbles:!0,composed:!0});this.dispatchEvent(d)},s.$el=this._container,s.$attrs={...this._props},s.$slots=this._getSlotContent(),s}_setupReactiveUpdates(i,a){try{let E=Function("return require")(),{effect:s,stop:p}=E("../../reactivity/src/index.ts"),l=s(()=>{if(!this._connected||!this._container)return;let d=a.call(i,A,i);d&&(this._container.innerHTML="",this._renderVNode(d,this._container))},{lazy:!0}),f=e.state?typeof e.state=="function"?Object.keys(e.state()):Object.keys(e.state):[];for(let d of f){let I=i[d];Object.defineProperty(i,d,{get(){return I},set(h){I=h;try{l()}catch(H){}},enumerable:!0})}this._effectCleanup=()=>{try{p(l)}catch(d){}}}catch(E){let s=e.state?typeof e.state=="function"?Object.keys(e.state()):Object.keys(e.state):[];for(let p of s){let f=i[p],d=this;Object.defineProperty(i,p,{get(){return f},set(I){f=I,d._scheduleUpdate(i,a)},enumerable:!0})}}}_scheduleUpdate(i,a){this._updateScheduled||(this._updateScheduled=!0,Promise.resolve().then(()=>{if(this._updateScheduled=!1,!this._connected||!this._container)return;let E=a.call(i,A,i);E&&(this._container.innerHTML="",this._renderVNode(E,this._container))}))}_updateComponent(){if(!this._container)return;let i=e.render?e.render:e.template?this._compileTemplate(e.template):null;if(!i)return;let a=this._createComponentContext(),E=i.call(a,A,a);this._container.innerHTML="",E&&this._renderVNode(E,this._container)}_renderVNode(i,a){let E=this._vNodeToElement(i);E&&a.appendChild(E)}_vNodeToElement(i){if(!i)return null;if(typeof i.type=="symbol"){let a=document.createDocumentFragment();if(Array.isArray(i.children))for(let E of i.children){let s=this._vNodeToElement(E);s&&a.appendChild(s)}return a}if(typeof i.children=="string")return document.createTextNode(i.children);if(typeof i.type=="string"){let a=document.createElement(i.type);if(i.props)for(let[E,s]of Object.entries(i.props))if(E==="style"&&typeof s=="object")for(let[p,l]of Object.entries(s))a.style[p]=l;else if(E==="class"){if(typeof s=="string")a.className=s;else if(typeof s=="object"){let p=[];for(let[l,f]of Object.entries(s))f&&p.push(l);a.className=p.join(" ")}}else if(E.startsWith("on")&&typeof s=="function"){let p=E.slice(2).toLowerCase();a.addEventListener(p,s),this._eventCleanups.push(()=>{a.removeEventListener(p,s)})}else E==="ref"&&typeof s=="function"?s(a):a.setAttribute(E,String(s));if(Array.isArray(i.children))for(let E of i.children){let s=this._vNodeToElement(E);s&&a.appendChild(s)}else typeof i.children=="string"&&(a.textContent=i.children);return a}return typeof i.type=="object"||typeof i.type=="function"?i.component?this._vNodeToElement(i.component.subTree||i):document.createComment("component"):null}_forwardSlots(){if(!this._shadowRoot||!this._container)return;let i=this.querySelectorAll("[slot]");for(let E of i){let s=E.getAttribute("slot")||"default",p=document.createElement("slot");s!=="default"&&p.setAttribute("name",s),this._container.appendChild(p)}let a=document.createElement("slot");this._container.appendChild(a)}_getSlotContent(){var s;let i={},a=this.querySelectorAll("[slot]");for(let p of a){let l=p.getAttribute("slot")||"default";i[l]||(i[l]=[]),i[l].push(p.cloneNode(!0))}let E=[];for(let p of Array.from(this.childNodes))(s=p.hasAttribute)!=null&&s.call(p,"slot")||E.push(p.cloneNode(!0));return E.length>0&&(i.default=E),i}get _lytInstance(){return this._instance}get _lytProps(){return{...this._props}}}}function $(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(!k()){console.warn("[Lyt Web Component] defineCustomElement \u53EA\u80FD\u5728\u6D4F\u89C8\u5668\u73AF\u5883\u4E2D\u4F7F\u7528\u3002\u5F53\u524D\u73AF\u5883\u4E0D\u652F\u6301 Custom Elements API\u3002");return}let o=Be(t,n);customElements.define(e,o)}function Ne(e){for(let{tagName:t,component:n,options:o}of e)$(t,n,o)}function Le(e){if(k())try{let t=customElements;t.__unregister&&t.__unregister(e)}catch(t){console.warn(`[Lyt Web Component] \u65E0\u6CD5\u6CE8\u9500 "${e}"\u3002Custom Elements \u89C4\u8303\u4E0D\u652F\u6301\u76F4\u63A5\u6CE8\u9500\u5DF2\u6CE8\u518C\u7684\u5143\u7D20\u3002`)}}async function Ae(e,t,n){let o=t.match(/<template>([\s\S]*?)<\/template>/),c=t.match(/<script[^>]*>([\s\S]*?)<\/script>/),T=/<style[^>]*>([\s\S]*?)<\/style>/g,_=[],m;for(;(m=T.exec(t))!==null;)_.push(m);let R=(n==null?void 0:n.styles)||"";for(let a of _)R+=a[1]+`
|
|
52
|
-
`;let y=o?o[1].trim():void 0,g={};if(c){let a=c[1].trim();if(a.match(/export\s+default\s*(\{[\s\S]*\}|\([\s\S]*\)[\s\S]*?\))/))try{let s={},p={exports:s};new Function("module","exports",`"use strict"; ${a.replace(/export\s+default\s*/,"module.exports =")}`)(p,s),g=p.exports||s}catch(s){console.warn("[Lyt Web Component] \u65E0\u6CD5\u89E3\u6790 SFC \u811A\u672C\u5185\u5BB9")}}let i={...n,styles:R};y&&!g.template&&!g.render&&(g.template=y),$(e,g,i)}
|
|
1
|
+
var I=Object.defineProperty;var U=Object.getOwnPropertyDescriptor;var z=Object.getOwnPropertyNames;var $=Object.prototype.hasOwnProperty;var q=(n,e)=>{for(var t in e)I(n,t,{get:e[t],enumerable:!0})},X=(n,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of z(e))!$.call(n,o)&&o!==t&&I(n,o,{get:()=>e[o],enumerable:!(r=U(e,o))||r.enumerable});return n};var Y=n=>X(I({},"__esModule",{value:!0}),n);var Z={};q(Z,{Fragment:()=>T,ShapeFlags:()=>R,createApp:()=>M,h:()=>b});module.exports=Y(Z);var R=(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))(R||{}),T=Symbol("Fragment");function G(n){return typeof n=="string"||typeof n=="number"}function O(n){return Array.isArray(n)}function E(n){return n!==null&&typeof n=="object"&&n.type!==void 0&&n.shapeFlag!==void 0}function J(n,e){if(e!=null)if(G(e))n.children=String(e),n.shapeFlag|=8;else if(O(e)){let t=[];for(let r=0;r<e.length;r++){let o=e[r];if(!(o==null||typeof o=="boolean"))if(O(o))for(let d=0;d<o.length;d++){let s=o[d];s!=null&&typeof s!="boolean"&&t.push(E(s)?s:N(String(s)))}else E(o)?t.push(o):t.push(N(String(o)))}n.children=t,n.shapeFlag|=16}else typeof e=="object"&&(n.children=e,n.shapeFlag|=32)}function N(n,e=null,t=null){var u,f;let r=0;typeof n=="string"?r=1:n===T?r=0:typeof n=="function"?r=2:typeof n=="object"&&n!==null&&(n.setup||n.__vccOpts||n.render)&&(r=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:v,ref:p,...g}=e;s=g}let m={type:n,props:s,children:null,key:o,ref:d,shapeFlag:r,el:null,component:null};return t!=null&&J(m,t),m}function b(n,e,t){return N(n,e||null,t||null)}function j(n){return Object.create(n||null)}function L(n){return n!==null&&typeof n=="object"&&typeof n.install=="function"}function k(n){return typeof n=="function"}function D(n,e,...t){if(L(e)){let r=e.onBeforeInstall?e.onBeforeInstall(n,...t):void 0;if(x(r))return r.then(()=>{let o=e.install(n,...t);if(x(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(x(o))return o.then(()=>{if(e.onInstalled)return e.onInstalled(n,...t)});if(e.onInstalled)return e.onInstalled(n,...t)}}else if(k(e))return e(n,...t)}function V(n,e){if(L(e)){if(typeof e.uninstall=="function")return e.uninstall(n)}else k(e)}function x(n){return n!==null&&typeof n=="object"&&typeof n.then=="function"}var A=require("@lytjs/reactivity"),F=require("@lytjs/compiler"),c=require("@lytjs/component"),H=require("@lytjs/renderer"),_=new Map;function K(n){let e=_.get(n);if(e)return e;let{code:t}=(0,F.compile)(n);return e=new Function("h","_ctx",`return ${t}`),_.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=(r,o)=>t(o.renderProxy)}if(n.computed){let t={};for(let r of Object.keys(n.computed)){let o=n.computed[r];typeof o=="function"?t[r]={get:o}:t[r]=o}e.computed=t}if(typeof n.init=="function"){let t=n.init;e.init=function(r,o){return t.call(this,r)}}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[r,o]of Object.entries(e))o&&t.push(r);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,r){n.addEventListener(e,t,r)},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 M(n,e){let t=new Set,r={},o={},d=j(),s={},m={},u=null,f=null,v=null,p=null,g=!1,S=Q(typeof n=="function"?{render:n}:n),B=(0,c.defineComponent)(S),i={config:s,globalProperties:m,get _instance(){return u},mount(a){if(g)return i;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 y=W();f=(0,H.createRenderer)(y),u=(0,c.createComponentInstance)(B),(0,c.setupComponent)(u,e||{},null);let P=u.type;if(!P.render&&P.template){let h=K(P.template);P.render=(C,w)=>h(C,w.renderProxy)}return(0,c.mountComponent)(u,b),u.subTree&&f.mount(u.subTree,l),v=(0,A.effect)(()=>{if(!(!u||!u.isMounted||!f)&&((0,c.updateComponent)(u,b),u.subTree&&p)){let h=p.firstChild,C=u.subTree;p.innerHTML="",f.mount(C,p)}},{lazy:!0}),g=!0,i},unmount(){g&&(v&&((0,A.stop)(v),v=null),u&&(0,c.unmountComponent)(u),p&&(p.innerHTML=""),u=null,f=null,p=null,g=!1)},use(a,...l){if(t.has(a))return i;t.add(a);let y=D({use:i.use.bind(i),unuse:i.unuse.bind(i),isInstalled:i.isInstalled.bind(i),provide:i.provide.bind(i),inject:i.inject.bind(i),config:s,globalProperties:m},a,...l);return y instanceof Promise?y.then(()=>i):i},unuse(a){if(!t.has(a))return i;t.delete(a);let l=V({use:i.use.bind(i),unuse:i.unuse.bind(i),isInstalled:i.isInstalled.bind(i),provide:i.provide.bind(i),inject:i.inject.bind(i),config:s,globalProperties:m},a);return l instanceof Promise?l.then(()=>i):i},isInstalled(a){return t.has(a)},provide(a,l){return d[a]=l,i},inject(a,l){let y=d[a];return y!==void 0?y:l},component(a,l){return l?(r[a]=l,i):r[a]},directive(a,l){return l?(o[a]=l,i):o[a]}};return i}
|
package/dist/index.mjs
CHANGED
|
@@ -1,52 +1 @@
|
|
|
1
|
-
var q=(_=>(_[_.ELEMENT=1]="ELEMENT",_[_.FUNCTIONAL_COMPONENT=2]="FUNCTIONAL_COMPONENT",_[_.STATEFUL_COMPONENT=4]="STATEFUL_COMPONENT",_[_.TEXT_CHILDREN=8]="TEXT_CHILDREN",_[_.ARRAY_CHILDREN=16]="ARRAY_CHILDREN",_[_.SLOTS_CHILDREN=32]="SLOTS_CHILDREN",_))(q||{}),K=Symbol("Fragment");function re(e){return typeof e=="string"||typeof e=="number"}function X(e){return Array.isArray(e)}function z(e){return e!==null&&typeof e=="object"&&e.type!==void 0&&e.shapeFlag!==void 0}function oe(e,t){if(t!=null)if(re(t))e.children=String(t),e.shapeFlag|=8;else if(X(t)){let n=[];for(let i=0;i<t.length;i++){let c=t[i];if(!(c==null||typeof c=="boolean"))if(X(c))for(let T=0;T<c.length;T++){let _=c[T];_!=null&&typeof _!="boolean"&&n.push(z(_)?_:M(String(_)))}else z(c)?n.push(c):n.push(M(String(c)))}e.children=n,e.shapeFlag|=16}else typeof t=="object"&&(e.children=t,e.shapeFlag|=32)}function M(e,t=null,n=null){var R,O;let i=0;typeof e=="string"?i=1:e===K?i=0:typeof e=="function"?i=2:typeof e=="object"&&e!==null&&(e.setup||e.__vccOpts||e.render)&&(i=4);let c=(R=t==null?void 0:t.key)!=null?R:null,T=(O=t==null?void 0:t.ref)!=null?O:null,_=t;if(t){let{key:y,ref:o,...a}=t;_=a}let m={type:e,props:_,children:null,key:c,ref:T,shapeFlag:i,el:null,component:null};return n!=null&&oe(m,n),m}function L(e,t,n){return M(e,t||null,n||null)}function F(e){return Object.create(e||null)}function h(e){return e!==null&&typeof e=="object"&&typeof e.install=="function"}function P(e){return typeof e=="function"}function V(e){return h(e)&&e.name||P(e)&&e.name?e.name:h(e)?"[PluginObject]":"[PluginFunction]"}function U(e,t,...n){if(h(t)){let i=t.onBeforeInstall?t.onBeforeInstall(e,...n):void 0;if(x(i))return i.then(()=>{let c=t.install(e,...n);if(x(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(x(c))return c.then(()=>{if(t.onInstalled)return t.onInstalled(e,...n)});if(t.onInstalled)return t.onInstalled(e,...n)}}else{if(P(t))return t(e,...n);console.warn("[Lyt] \u65E0\u6548\u7684\u63D2\u4EF6\uFF1A\u63D2\u4EF6\u5FC5\u987B\u662F\u5E26\u6709 install \u65B9\u6CD5\u7684\u5BF9\u8C61\u6216\u51FD\u6570\u3002")}}function w(e,t){if(h(t)){if(typeof t.uninstall=="function")return t.uninstall(e);console.warn(`[Lyt] \u63D2\u4EF6 "${V(t)}" \u672A\u5B9A\u4E49 uninstall \u65B9\u6CD5\uFF0C\u65E0\u6CD5\u5B8C\u5168\u5378\u8F7D\u3002`)}else P(t)&&console.warn(`[Lyt] \u51FD\u6570\u5F62\u5F0F\u63D2\u4EF6 "${V(t)}" \u4E0D\u652F\u6301\u5378\u8F7D\u3002`)}function x(e){return e!==null&&typeof e=="object"&&typeof e.then=="function"}import{effect as ie,stop as se}from"@lytjs/reactivity";import{compile as ae}from"@lytjs/compiler";import{defineComponent as le,createComponentInstance as ce,setupComponent as ue,mountComponent as Ee,updateComponent as pe,unmountComponent as _e}from"@lytjs/component";import{createRenderer as fe}from"@lytjs/renderer";var J=new Map;function de(e){let t=J.get(e);if(t)return t;let{code:n}=ae(e);return t=new Function("h","_ctx",`return ${n}`),J.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=(i,c)=>n(c.renderProxy)}if(e.computed){let n={};for(let i of Object.keys(e.computed)){let c=e.computed[i];typeof c=="function"?n[i]={get:c}:n[i]=c}t.computed=n}if(typeof e.init=="function"){let n=e.init;t.init=function(i,c){return n.call(this,i)}}return t}function Te(){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[i,c]of Object.entries(t))c&&n.push(i);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,i){e.addEventListener(t,n,i)},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 me(e,t){let n=new Set,i={},c={},T=F(),_={},m={},R=null,O=null,y=null,o=null,a=!1,s=Re(typeof e=="function"?{render:e}:e),p=le(s),l={config:_,globalProperties:m,get _instance(){return R},mount(f){if(a)return console.warn("[Lyt] \u5E94\u7528\u5DF2\u7ECF\u6302\u8F7D\uFF0C\u4E0D\u80FD\u91CD\u590D\u6302\u8F7D\u3002"),l;let d;if(typeof f=="string"){if(d=document.querySelector(f),!d)throw new Error(`[Lyt] \u627E\u4E0D\u5230\u6302\u8F7D\u76EE\u6807: "${f}"`)}else d=f;o=d;let g=Te();O=fe(g),R=ce(p),ue(R,t||{},null);let C=R.type;if(!C.render&&C.template){let v=de(C.template);C.render=(Y,u)=>v(Y,u.renderProxy)}return Ee(R,L),R.subTree&&O.mount(R.subTree,d),y=ie(()=>{if(!(!R||!R.isMounted||!O)&&(pe(R,L),R.subTree&&o)){let v=o.firstChild,Y=R.subTree;o.innerHTML="",O.mount(Y,o)}},{lazy:!0}),a=!0,l},unmount(){if(!a){console.warn("[Lyt] \u5E94\u7528\u672A\u6302\u8F7D\uFF0C\u65E0\u6CD5\u5378\u8F7D\u3002");return}y&&(se(y),y=null),R&&_e(R),o&&(o.innerHTML=""),R=null,O=null,o=null,a=!1},use(f,...d){if(n.has(f))return console.warn("[Lyt] \u63D2\u4EF6\u5DF2\u7ECF\u5B89\u88C5\uFF0C\u4E0D\u80FD\u91CD\u590D\u5B89\u88C5\u3002"),l;n.add(f);let g=U({use:l.use.bind(l),unuse:l.unuse.bind(l),isInstalled:l.isInstalled.bind(l),provide:l.provide.bind(l),inject:l.inject.bind(l),config:_,globalProperties:m},f,...d);return g instanceof Promise?g.then(()=>l):l},unuse(f){if(!n.has(f))return console.warn("[Lyt] \u63D2\u4EF6\u672A\u5B89\u88C5\uFF0C\u65E0\u6CD5\u5378\u8F7D\u3002"),l;n.delete(f);let d=w({use:l.use.bind(l),unuse:l.unuse.bind(l),isInstalled:l.isInstalled.bind(l),provide:l.provide.bind(l),inject:l.inject.bind(l),config:_,globalProperties:m},f);return d instanceof Promise?d.then(()=>l):l},isInstalled(f){return n.has(f)},provide(f,d){return T[f]=d,l},inject(f,d){let g=T[f];return g!==void 0?g:d},component(f,d){return d?(i[f]=d,l):i[f]},directive(f,d){return d?(c[f]=d,l):c[f]}};return l}var Q=(u=>(u[u.INVALID_ARGUMENT=1001]="INVALID_ARGUMENT",u[u.NOT_FOUND=1002]="NOT_FOUND",u[u.ALREADY_EXISTS=1003]="ALREADY_EXISTS",u[u.OPERATION_FAILED=1004]="OPERATION_FAILED",u[u.REACTIVE_READONLY=2001]="REACTIVE_READONLY",u[u.REACTIVE_EFFECT_DISPOSED=2002]="REACTIVE_EFFECT_DISPOSED",u[u.COMPUTED_CYCLE=2003]="COMPUTED_CYCLE",u[u.PARSE_ERROR=3001]="PARSE_ERROR",u[u.INVALID_EXPRESSION=3002]="INVALID_EXPRESSION",u[u.INVALID_DIRECTIVE=3003]="INVALID_DIRECTIVE",u[u.INVALID_TEMPLATE=3004]="INVALID_TEMPLATE",u[u.RENDER_ERROR=4001]="RENDER_ERROR",u[u.HYDRATION_MISMATCH=4002]="HYDRATION_MISMATCH",u[u.INVALID_VNODE=4003]="INVALID_VNODE",u[u.COMPONENT_INVALID_PROPS=5001]="COMPONENT_INVALID_PROPS",u[u.COMPONENT_MISSING_TEMPLATE=5002]="COMPONENT_MISSING_TEMPLATE",u[u.COMPONENT_LIFECYCLE_ERROR=5003]="COMPONENT_LIFECYCLE_ERROR",u[u.ROUTE_NOT_FOUND=6001]="ROUTE_NOT_FOUND",u[u.ROUTE_DUPLICATE=6002]="ROUTE_DUPLICATE",u[u.NAVIGATION_ABORTED=6003]="NAVIGATION_ABORTED",u[u.NAVIGATION_FAILED=6004]="NAVIGATION_FAILED",u[u.STORE_NOT_FOUND=7001]="STORE_NOT_FOUND",u[u.STORE_DUPLICATE=7002]="STORE_DUPLICATE",u))(Q||{});var A=class extends Error{constructor(t,n,i){let c=`[Lyt ${t}] ${n}`;super(c),this.name="LytError",this.code=t,this.details=i}};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,i){var _;let c={error:t,vm:n,info:i||"",timestamp:Date.now()};this.errors.push(c),this._hasError=!0;let T=(_=this.options.maxErrors)!=null?_:100;this.errors.length>T&&this.errors.splice(0,this.errors.length-T),!(this.options.onErrorCaptured&&this.options.onErrorCaptured(t instanceof A?t:new A(1004,t.message),n,c.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}};S.globalHandler=null;var D=S,b=!0,Z=new Set;function Oe(e){b=e}function ye(e){b&&console.warn(`[Lyt warn] ${e}`)}function ge(e){b&&(Z.has(e)||(Z.add(e),console.warn(`[Lyt warn] ${e}`)))}var Ie={1001:e=>`\u53C2\u6570 "${e}" \u65E0\u6548\u3002\u8BF7\u68C0\u67E5\u4F20\u5165\u7684\u503C\u7C7B\u578B\u548C\u8303\u56F4\u3002`,1002:e=>`"${e}" \u672A\u627E\u5230\u3002\u8BF7\u786E\u8BA4\u8D44\u6E90\u540D\u79F0\u6216\u8DEF\u5F84\u662F\u5426\u6B63\u786E\u3002`,1003:e=>`"${e}" \u5DF2\u5B58\u5728\u3002\u8BF7\u4F7F\u7528\u4E0D\u540C\u7684\u540D\u79F0\u3002`,1004:e=>`\u64CD\u4F5C "${e}" \u6267\u884C\u5931\u8D25\u3002\u8BF7\u68C0\u67E5\u76F8\u5173\u914D\u7F6E\u548C\u72B6\u6001\u3002`,2001:e=>`\u65E0\u6CD5\u4FEE\u6539\u53EA\u8BFB\u54CD\u5E94\u5F0F\u5C5E\u6027 "${e}"\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:e=>`\u6A21\u677F\u89E3\u6790\u9519\u8BEF\uFF1A${e}\u3002\u8BF7\u68C0\u67E5\u6A21\u677F\u8BED\u6CD5\u662F\u5426\u6B63\u786E\u3002`,3002:e=>`\u65E0\u6548\u7684\u8868\u8FBE\u5F0F "${e}"\u3002\u8BF7\u68C0\u67E5\u8868\u8FBE\u5F0F\u8BED\u6CD5\u3002`,3003:e=>`\u65E0\u6548\u7684\u6307\u4EE4 "${e}"\u3002\u8BF7\u786E\u8BA4\u6307\u4EE4\u540D\u79F0\u662F\u5426\u6B63\u786E\u3002`,3004:e=>`\u65E0\u6548\u7684\u6A21\u677F\uFF1A${e}\u3002\u8BF7\u68C0\u67E5\u6A21\u677F\u5185\u5BB9\u3002`,4001:e=>`\u6E32\u67D3\u9519\u8BEF\uFF1A${e}\u3002\u8BF7\u68C0\u67E5\u7EC4\u4EF6\u7684 render \u51FD\u6570\u6216\u6A21\u677F\u3002`,4002:e=>`\u6C34\u5408\u4E0D\u5339\u914D\uFF1A${e}\u3002\u670D\u52A1\u7AEF\u6E32\u67D3\u4E0E\u5BA2\u6237\u7AEF\u6E32\u67D3\u7ED3\u679C\u4E0D\u4E00\u81F4\u3002`,4003:e=>`\u65E0\u6548\u7684\u865A\u62DF\u8282\u70B9\uFF1A${e}\u3002VNode \u7F3A\u5C11\u5FC5\u8981\u7684 type \u6216\u5176\u4ED6\u5C5E\u6027\u3002`,5001:e=>`\u7EC4\u4EF6\u5C5E\u6027\u65E0\u6548\uFF1A${e}\u3002\u8BF7\u68C0\u67E5\u4F20\u5165\u7684 props \u662F\u5426\u7B26\u5408\u7EC4\u4EF6\u5B9A\u4E49\u3002`,5002:e=>`\u7EC4\u4EF6 "${e}" \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:e=>`\u7EC4\u4EF6\u751F\u547D\u5468\u671F\u9519\u8BEF\uFF1A${e}\u3002\u8BF7\u68C0\u67E5\u751F\u547D\u5468\u671F\u94A9\u5B50\u51FD\u6570\u3002`,6001:e=>`\u8DEF\u7531 "${e}" \u672A\u627E\u5230\u3002\u8BF7\u786E\u8BA4\u8DEF\u7531\u8DEF\u5F84\u662F\u5426\u5DF2\u6CE8\u518C\u3002`,6002:e=>`\u8DEF\u7531 "${e}" \u5DF2\u5B58\u5728\u3002\u8BF7\u907F\u514D\u91CD\u590D\u6CE8\u518C\u76F8\u540C\u7684\u8DEF\u7531\u8DEF\u5F84\u3002`,6003:e=>`\u5BFC\u822A\u88AB\u4E2D\u6B62\uFF1A${e}\u3002\u53EF\u80FD\u88AB\u5BFC\u822A\u5B88\u536B\u62E6\u622A\u3002`,6004:e=>`\u5BFC\u822A\u5931\u8D25\uFF1A${e}\u3002\u8BF7\u68C0\u67E5\u76EE\u6807\u8DEF\u7531\u662F\u5426\u6709\u6548\u3002`,7001:e=>`Store "${e}" \u672A\u627E\u5230\u3002\u8BF7\u786E\u8BA4 store \u662F\u5426\u5DF2\u6CE8\u518C\u3002`,7002:e=>`Store "${e}" \u5DF2\u5B58\u5728\u3002\u8BF7\u907F\u514D\u91CD\u590D\u521B\u5EFA\u76F8\u540C ID \u7684 store\u3002`};function Ne(e,...t){let n=Ie[e];if(n){let i=n(...t);return`[Lyt ${e}] ${i}`}return`[Lyt ${e}] \u672A\u77E5\u9519\u8BEF\u3002`}function ee(e,t,n){D.globalHandler&&D.globalHandler(e,t,n||""),b&&(e instanceof A?(console.error(e.message),e.details&&console.error("\u8BE6\u7EC6\u4FE1\u606F:",e.details)):console.error(`[Lyt Error] ${e.message}`),t&&console.error("\u7EC4\u4EF6\u5B9E\u4F8B:",t),n&&console.error("\u9519\u8BEF\u6765\u6E90:",n))}function Le(e,t){try{return e()}catch(n){ee(n instanceof Error?n:new Error(String(n)),t);return}}var te=(r=>(r[r.LYT_COMPILER_PARSE_ERROR=1001]="LYT_COMPILER_PARSE_ERROR",r[r.LYT_COMPILER_INVALID_EXPRESSION=1002]="LYT_COMPILER_INVALID_EXPRESSION",r[r.LYT_COMPILER_INVALID_TEMPLATE=1003]="LYT_COMPILER_INVALID_TEMPLATE",r[r.LYT_COMPILER_INVALID_DIRECTIVE=1004]="LYT_COMPILER_INVALID_DIRECTIVE",r[r.LYT_COMPILER_CODEGEN_ERROR=1005]="LYT_COMPILER_CODEGEN_ERROR",r[r.LYT_COMPILER_SFC_PARSE_ERROR=1006]="LYT_COMPILER_SFC_PARSE_ERROR",r[r.LYT_COMPILER_TRANSFORM_ERROR=1007]="LYT_COMPILER_TRANSFORM_ERROR",r[r.LYT_RENDERER_MOUNT_FAILED=2001]="LYT_RENDERER_MOUNT_FAILED",r[r.LYT_RENDERER_PATCH_FAILED=2002]="LYT_RENDERER_PATCH_FAILED",r[r.LYT_RENDERER_HYDRATION_MISMATCH=2003]="LYT_RENDERER_HYDRATION_MISMATCH",r[r.LYT_RENDERER_INVALID_VNODE=2004]="LYT_RENDERER_INVALID_VNODE",r[r.LYT_RENDERER_UNMOUNT_FAILED=2005]="LYT_RENDERER_UNMOUNT_FAILED",r[r.LYT_COMPONENT_INVALID_PROPS=3001]="LYT_COMPONENT_INVALID_PROPS",r[r.LYT_COMPONENT_MISSING_RENDER=3002]="LYT_COMPONENT_MISSING_RENDER",r[r.LYT_COMPONENT_LIFECYCLE_ERROR=3003]="LYT_COMPONENT_LIFECYCLE_ERROR",r[r.LYT_COMPONENT_INVALID=3004]="LYT_COMPONENT_INVALID",r[r.LYT_COMPONENT_EMIT_INVALID=3005]="LYT_COMPONENT_EMIT_INVALID",r[r.LYT_COMPONENT_RENDER_ERROR=3006]="LYT_COMPONENT_RENDER_ERROR",r[r.LYT_ROUTER_INVALID_ROUTE=4001]="LYT_ROUTER_INVALID_ROUTE",r[r.LYT_ROUTER_NAVIGATION_FAILED=4002]="LYT_ROUTER_NAVIGATION_FAILED",r[r.LYT_ROUTER_DUPLICATE_ROUTE=4003]="LYT_ROUTER_DUPLICATE_ROUTE",r[r.LYT_ROUTER_NAVIGATION_ABORTED=4004]="LYT_ROUTER_NAVIGATION_ABORTED",r[r.LYT_ROUTER_GUARD_ERROR=4005]="LYT_ROUTER_GUARD_ERROR",r[r.LYT_STORE_ALREADY_EXISTS=5001]="LYT_STORE_ALREADY_EXISTS",r[r.LYT_STORE_NOT_FOUND=5002]="LYT_STORE_NOT_FOUND",r[r.LYT_STORE_DISPOSED=5003]="LYT_STORE_DISPOSED",r[r.LYT_STORE_PATCH_ERROR=5004]="LYT_STORE_PATCH_ERROR",r[r.LYT_REACTIVITY_READONLY_SET=6001]="LYT_REACTIVITY_READONLY_SET",r[r.LYT_REACTIVITY_READONLY_DELETE=6002]="LYT_REACTIVITY_READONLY_DELETE",r[r.LYT_REACTIVITY_EFFECT_ERROR=6003]="LYT_REACTIVITY_EFFECT_ERROR",r[r.LYT_REACTIVITY_COMPUTED_CYCLE=6004]="LYT_REACTIVITY_COMPUTED_CYCLE",r[r.LYT_REACTIVITY_EFFECT_DISPOSED=6005]="LYT_REACTIVITY_EFFECT_DISPOSED",r[r.LYT_CORE_PLUGIN_ERROR=7001]="LYT_CORE_PLUGIN_ERROR",r[r.LYT_CORE_MOUNT_NO_CONTAINER=7002]="LYT_CORE_MOUNT_NO_CONTAINER",r[r.LYT_CORE_ALREADY_MOUNTED=7003]="LYT_CORE_ALREADY_MOUNTED",r[r.LYT_CORE_INVALID_ARGUMENT=7004]="LYT_CORE_INVALID_ARGUMENT",r[r.LYT_CORE_NOT_FOUND=7005]="LYT_CORE_NOT_FOUND",r[r.LYT_CORE_ALREADY_EXISTS=7006]="LYT_CORE_ALREADY_EXISTS",r[r.LYT_CORE_OPERATION_FAILED=7007]="LYT_CORE_OPERATION_FAILED",r[r.LYT_CLI_SCAFFOLD_FAILED=8001]="LYT_CLI_SCAFFOLD_FAILED",r[r.LYT_CLI_BUILD_FAILED=8002]="LYT_CLI_BUILD_FAILED",r[r.LYT_CLI_DEV_SERVER_ERROR=8003]="LYT_CLI_DEV_SERVER_ERROR",r[r.LYT_CLI_CONFIG_INVALID=8004]="LYT_CLI_CONFIG_INVALID",r[r.LYT_CLI_HMR_CONNECTION_FAILED=8005]="LYT_CLI_HMR_CONNECTION_FAILED",r[r.LYT_DEVTOOLS_CONNECTION_FAILED=9001]="LYT_DEVTOOLS_CONNECTION_FAILED",r[r.LYT_DEVTOOLS_PANEL_ERROR=9002]="LYT_DEVTOOLS_PANEL_ERROR",r[r.LYT_DEVTOOLS_PERF_OVERFLOW=9003]="LYT_DEVTOOLS_PERF_OVERFLOW",r[r.LYT_DEVTOOLS_COMPONENT_TREE_ERROR=9004]="LYT_DEVTOOLS_COMPONENT_TREE_ERROR",r[r.LYT_PLUGIN_INSTALL_FAILED=10001]="LYT_PLUGIN_INSTALL_FAILED",r[r.LYT_PLUGIN_ALREADY_INSTALLED=10002]="LYT_PLUGIN_ALREADY_INSTALLED",r[r.LYT_PLUGIN_INVALID=10003]="LYT_PLUGIN_INVALID",r[r.LYT_PLUGIN_UNINSTALL_FAILED=10004]="LYT_PLUGIN_UNINSTALL_FAILED",r[r.LYT_SSR_STREAM_ERROR=11001]="LYT_SSR_STREAM_ERROR",r[r.LYT_SSR_SUSPENSE_TIMEOUT=11002]="LYT_SSR_SUSPENSE_TIMEOUT",r[r.LYT_SSR_HYDRATION_ERROR=11003]="LYT_SSR_HYDRATION_ERROR",r[r.LYT_SSR_ISLAND_ERROR=11004]="LYT_SSR_ISLAND_ERROR",r))(te||{}),I={COMPILER:"COMPILER",RENDERER:"RENDERER",COMPONENT:"COMPONENT",ROUTER:"ROUTER",STORE:"STORE",REACTIVITY:"REACTIVITY",CORE:"CORE",CLI:"CLI",DEVTOOLS:"DEVTOOLS",PLUGIN:"PLUGIN",SSR:"SSR"},Ae={1001:"\u6A21\u677F\u89E3\u6790\u9519\u8BEF\uFF0C\u8BF7\u68C0\u67E5\u6A21\u677F\u8BED\u6CD5\u662F\u5426\u6B63\u786E\u3002",1002:"\u65E0\u6548\u7684\u8868\u8FBE\u5F0F\uFF0C\u8BF7\u68C0\u67E5\u8868\u8FBE\u5F0F\u8BED\u6CD5\u3002",1003:"\u65E0\u6548\u7684\u6A21\u677F\uFF0C\u8BF7\u68C0\u67E5\u6A21\u677F\u5185\u5BB9\u3002",1004:"\u65E0\u6548\u7684\u6307\u4EE4\uFF0C\u8BF7\u786E\u8BA4\u6307\u4EE4\u540D\u79F0\u662F\u5426\u6B63\u786E\u3002",1005:"\u4EE3\u7801\u751F\u6210\u9519\u8BEF\uFF0C\u8BF7\u68C0\u67E5\u6A21\u677F\u7F16\u8BD1\u914D\u7F6E\u3002",1006:"\u5355\u6587\u4EF6\u7EC4\u4EF6\u89E3\u6790\u9519\u8BEF\uFF0C\u8BF7\u68C0\u67E5 SFC \u8BED\u6CD5\u3002",1007:"\u6A21\u677F\u8F6C\u6362\u9519\u8BEF\uFF0C\u8BF7\u68C0\u67E5 AST \u8F6C\u6362\u903B\u8F91\u3002",2001:"\u6302\u8F7D\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u5BB9\u5668\u5143\u7D20\u662F\u5426\u5B58\u5728\u3002",2002:"\u8865\u4E01\u66F4\u65B0\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5 VNode \u7ED3\u6784\u3002",2003:"\u6C34\u5408\u4E0D\u5339\u914D\uFF0C\u670D\u52A1\u7AEF\u4E0E\u5BA2\u6237\u7AEF\u6E32\u67D3\u7ED3\u679C\u4E0D\u4E00\u81F4\u3002",2004:"\u65E0\u6548\u7684\u865A\u62DF\u8282\u70B9\uFF0CVNode \u7F3A\u5C11\u5FC5\u8981\u7684 type \u5C5E\u6027\u3002",2005:"\u5378\u8F7D\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u7EC4\u4EF6\u662F\u5426\u5DF2\u6302\u8F7D\u3002",3001:"\u7EC4\u4EF6\u5C5E\u6027\u65E0\u6548\uFF0C\u8BF7\u68C0\u67E5\u4F20\u5165\u7684 props\u3002",3002:"\u7EC4\u4EF6\u7F3A\u5C11 template \u6216 render \u51FD\u6570\u3002",3003:"\u7EC4\u4EF6\u751F\u547D\u5468\u671F\u9519\u8BEF\uFF0C\u8BF7\u68C0\u67E5\u751F\u547D\u5468\u671F\u94A9\u5B50\u51FD\u6570\u3002",3004:"\u65E0\u6548\u7684\u7EC4\u4EF6\u5B9A\u4E49\uFF0C\u8BF7\u68C0\u67E5\u7EC4\u4EF6\u914D\u7F6E\u3002",3005:"\u65E0\u6548\u7684\u4E8B\u4EF6\u53D1\u5C04\uFF0C\u8BF7\u68C0\u67E5 emits \u58F0\u660E\u3002",3006:"\u7EC4\u4EF6\u6E32\u67D3\u9519\u8BEF\uFF0C\u8BF7\u68C0\u67E5 render \u51FD\u6570\u3002",4001:"\u65E0\u6548\u7684\u8DEF\u7531\uFF0C\u8BF7\u786E\u8BA4\u8DEF\u7531\u8DEF\u5F84\u662F\u5426\u5DF2\u6CE8\u518C\u3002",4002:"\u5BFC\u822A\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u76EE\u6807\u8DEF\u7531\u662F\u5426\u6709\u6548\u3002",4003:"\u8DEF\u7531\u5DF2\u5B58\u5728\uFF0C\u8BF7\u907F\u514D\u91CD\u590D\u6CE8\u518C\u76F8\u540C\u7684\u8DEF\u7531\u8DEF\u5F84\u3002",4004:"\u5BFC\u822A\u88AB\u4E2D\u6B62\uFF0C\u53EF\u80FD\u88AB\u5BFC\u822A\u5B88\u536B\u62E6\u622A\u3002",4005:"\u8DEF\u7531\u5B88\u536B\u9519\u8BEF\uFF0C\u8BF7\u68C0\u67E5\u5B88\u536B\u51FD\u6570\u3002",5001:"Store \u5DF2\u5B58\u5728\uFF0C\u8BF7\u907F\u514D\u91CD\u590D\u521B\u5EFA\u76F8\u540C ID \u7684 store\u3002",5002:"Store \u672A\u627E\u5230\uFF0C\u8BF7\u786E\u8BA4 store \u662F\u5426\u5DF2\u6CE8\u518C\u3002",5003:"Store \u5DF2\u88AB\u9500\u6BC1\uFF0C\u65E0\u6CD5\u7EE7\u7EED\u64CD\u4F5C\u3002",5004:"Store \u72B6\u6001\u66F4\u65B0\u9519\u8BEF\uFF0C\u8BF7\u68C0\u67E5 patch \u6570\u636E\u3002",6001:"\u65E0\u6CD5\u4FEE\u6539\u53EA\u8BFB\u54CD\u5E94\u5F0F\u5C5E\u6027\u3002",6002:"\u65E0\u6CD5\u5220\u9664\u53EA\u8BFB\u54CD\u5E94\u5F0F\u5C5E\u6027\u3002",6003:"\u526F\u4F5C\u7528\u51FD\u6570\u6267\u884C\u9519\u8BEF\u3002",6004:"\u8BA1\u7B97\u5C5E\u6027\u68C0\u6D4B\u5230\u5FAA\u73AF\u4F9D\u8D56\u3002",6005:"\u526F\u4F5C\u7528\u51FD\u6570\u5DF2\u88AB\u9500\u6BC1\uFF0C\u65E0\u6CD5\u518D\u6B21\u6267\u884C\u3002",7001:"\u63D2\u4EF6\u9519\u8BEF\uFF0C\u8BF7\u68C0\u67E5\u63D2\u4EF6\u914D\u7F6E\u548C\u5B89\u88C5\u903B\u8F91\u3002",7002:"\u627E\u4E0D\u5230\u6302\u8F7D\u76EE\u6807\u5BB9\u5668\u3002",7003:"\u5E94\u7528\u5DF2\u7ECF\u6302\u8F7D\uFF0C\u4E0D\u80FD\u91CD\u590D\u6302\u8F7D\u3002",7004:"\u53C2\u6570\u65E0\u6548\uFF0C\u8BF7\u68C0\u67E5\u4F20\u5165\u7684\u503C\u7C7B\u578B\u548C\u8303\u56F4\u3002",7005:"\u8D44\u6E90\u672A\u627E\u5230\uFF0C\u8BF7\u786E\u8BA4\u540D\u79F0\u6216\u8DEF\u5F84\u662F\u5426\u6B63\u786E\u3002",7006:"\u8D44\u6E90\u5DF2\u5B58\u5728\uFF0C\u8BF7\u4F7F\u7528\u4E0D\u540C\u7684\u540D\u79F0\u3002",7007:"\u64CD\u4F5C\u6267\u884C\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u76F8\u5173\u914D\u7F6E\u548C\u72B6\u6001\u3002",8001:"\u9879\u76EE\u811A\u624B\u67B6\u521B\u5EFA\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u6A21\u677F\u548C\u76EE\u6807\u76EE\u5F55\u3002",8002:"\u9879\u76EE\u6784\u5EFA\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u6784\u5EFA\u914D\u7F6E\u548C\u6E90\u4EE3\u7801\u3002",8003:"\u5F00\u53D1\u670D\u52A1\u5668\u542F\u52A8\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u7AEF\u53E3\u548C\u914D\u7F6E\u3002",8004:"\u914D\u7F6E\u6587\u4EF6\u65E0\u6548\uFF0C\u8BF7\u68C0\u67E5\u914D\u7F6E\u683C\u5F0F\u548C\u5FC5\u586B\u5B57\u6BB5\u3002",8005:"\u70ED\u6A21\u5757\u66FF\u6362\u8FDE\u63A5\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5 WebSocket \u914D\u7F6E\u3002",9001:"DevTools \u8FDE\u63A5\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u6269\u5C55\u548C\u8FD0\u884C\u65F6\u7248\u672C\u662F\u5426\u5339\u914D\u3002",9002:"DevTools \u9762\u677F\u52A0\u8F7D\u9519\u8BEF\uFF0C\u8BF7\u5C1D\u8BD5\u5237\u65B0\u9875\u9762\u3002",9003:"\u6027\u80FD\u6570\u636E\u6EA2\u51FA\uFF0C\u8BF7\u51CF\u5C11\u76D1\u63A7\u7684\u7EC4\u4EF6\u6570\u91CF\u6216\u7F29\u77ED\u91C7\u96C6\u5468\u671F\u3002",9004:"\u7EC4\u4EF6\u6811\u89E3\u6790\u9519\u8BEF\uFF0C\u8BF7\u68C0\u67E5\u7EC4\u4EF6\u5B9E\u4F8B\u72B6\u6001\u3002",10001:"\u63D2\u4EF6\u5B89\u88C5\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u63D2\u4EF6\u5305\u548C\u5B89\u88C5\u903B\u8F91\u3002",10002:"\u63D2\u4EF6\u5DF2\u5B89\u88C5\uFF0C\u8BF7\u907F\u514D\u91CD\u590D\u5B89\u88C5\u76F8\u540C\u63D2\u4EF6\u3002",10003:"\u65E0\u6548\u7684\u63D2\u4EF6\uFF0C\u8BF7\u68C0\u67E5\u63D2\u4EF6\u662F\u5426\u6EE1\u8DB3\u63A5\u53E3\u8981\u6C42\u3002",10004:"\u63D2\u4EF6\u5378\u8F7D\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u63D2\u4EF6\u662F\u5426\u5DF2\u88AB\u6B63\u786E\u6E05\u7406\u3002",11001:"SSR \u6D41\u5F0F\u6E32\u67D3\u9519\u8BEF\uFF0C\u8BF7\u68C0\u67E5\u6D41\u7BA1\u9053\u914D\u7F6E\u3002",11002:"SSR Suspense \u8D85\u65F6\uFF0C\u8BF7\u68C0\u67E5\u5F02\u6B65\u7EC4\u4EF6\u7684\u52A0\u8F7D\u65F6\u95F4\u3002",11003:"SSR \u6C34\u5408\u9519\u8BEF\uFF0C\u670D\u52A1\u7AEF\u4E0E\u5BA2\u6237\u7AEF\u6E32\u67D3\u7ED3\u679C\u4E0D\u4E00\u81F4\u3002",11004:"SSR Island \u7EC4\u4EF6\u9519\u8BEF\uFF0C\u8BF7\u68C0\u67E5\u5B64\u5C9B\u7EC4\u4EF6\u7684\u5E8F\u5217\u5316\u548C\u6E32\u67D3\u903B\u8F91\u3002"};function Ce(e){return e>=1e3&&e<2e3?I.COMPILER:e>=2e3&&e<3e3?I.RENDERER:e>=3e3&&e<4e3?I.COMPONENT:e>=4e3&&e<5e3?I.ROUTER:e>=5e3&&e<6e3?I.STORE:e>=6e3&&e<7e3?I.REACTIVITY:e>=7e3&&e<8e3?I.CORE:e>=8e3&&e<9e3?I.CLI:e>=9e3&&e<1e4?I.DEVTOOLS:e>=1e4&&e<11e3?I.PLUGIN:e>=11e3&&e<12e3?I.SSR:"UNKNOWN"}function j(e){return Ae[e]||"\u672A\u77E5\u9519\u8BEF\u3002"}function k(e){return Ce(e)}var N=class extends Error{constructor(t,n,i){super(n||j(t)),this.name="LytError",this.code=t,this.category=k(t),this.details=i}};function he(e,t,n){let i=new N(e,n);return i.loc=t,i}function De(e,t,n){let i=new N(e,n);return i.details={vnode:t},i}function Pe(e,t,n){let i=typeof t=="string"?t:t==null?void 0:t.name,c=new N(e,n);return c.details={component:i},c}var H=!0;function G(){return H}var $=new Set;function Se(e){H&&console.warn(`[Lyt warn] ${e}`)}function be(e){H&&($.has(e)||($.add(e),console.warn(`[Lyt warn] ${e}`)))}function ve(e){console.error(`[Lyt error] ${e}`)}function Ye(){$.clear()}function ne(e){let t=[];if(e instanceof N?(t.push(`[Lyt Error] [${e.category}] Code: ${e.code}`),t.push(` Message: ${e.message}`)):t.push(`[Lyt Error] ${e.message}`),e instanceof N&&e.loc){let i=e.loc,c="";i.file&&(c+=i.file),i.line!=null&&(c+=`:${i.line}`),i.column!=null&&(c+=`:${i.column}`),c&&t.push(` Location: ${c}`),i.source&&t.push(` Source: ${i.source}`)}if(e instanceof N&&e.details&&e.details.component&&t.push(` Component: ${e.details.component}`),e.stack){t.push(""),t.push(" Stack:");let i=e.stack.split(`
|
|
2
|
-
`).slice(1);for(let c of i)t.push(` ${c.trim()}`)}let n=xe(e);return n&&(t.push(""),t.push(` Suggestion: ${n}`)),t.join(`
|
|
3
|
-
`)}function Me(e){if(!e)return"";let t=[],n=e;for(;n;){let i=n.name||n.$name||"Anonymous";t.push(i),n=n.parent||n.$parent}return t.join(" > ")}function xe(e){if(!(e instanceof N))return"\u8BF7\u68C0\u67E5\u4EE3\u7801\u903B\u8F91\uFF0C\u786E\u4FDD\u6CA1\u6709\u8FD0\u884C\u65F6\u5F02\u5E38\u3002";let t=e.code;return t>=1e3&&t<2e3?"\u8BF7\u68C0\u67E5\u6A21\u677F\u8BED\u6CD5\u662F\u5426\u6B63\u786E\uFF0C\u53C2\u8003 Lyt.js \u6A21\u677F\u8BED\u6CD5\u6587\u6863\u3002":t>=2e3&&t<3e3?t===2003?"\u6C34\u5408\u4E0D\u5339\u914D\u901A\u5E38\u7531\u670D\u52A1\u7AEF\u548C\u5BA2\u6237\u7AEF\u6E32\u67D3\u7ED3\u679C\u4E0D\u4E00\u81F4\u5F15\u8D77\u3002\u8BF7\u786E\u4FDD\u670D\u52A1\u7AEF\u548C\u5BA2\u6237\u7AEF\u4F7F\u7528\u76F8\u540C\u7684\u6570\u636E\u548C\u7EC4\u4EF6\u7248\u672C\u3002":"\u8BF7\u68C0\u67E5 VNode \u7ED3\u6784\u548C DOM \u5BB9\u5668\u662F\u5426\u6B63\u786E\u3002":t>=3e3&&t<4e3?t===3001?"\u8BF7\u68C0\u67E5\u4F20\u5165\u7684 props \u662F\u5426\u7B26\u5408\u7EC4\u4EF6\u5B9A\u4E49\u4E2D\u7684 props \u58F0\u660E\u3002":t===3002?"\u8BF7\u786E\u4FDD\u7EC4\u4EF6\u5B9A\u4E49\u4E2D\u5305\u542B template \u5B57\u7B26\u4E32\u6216 render \u65B9\u6CD5\u3002":"\u8BF7\u68C0\u67E5\u7EC4\u4EF6\u5B9A\u4E49\u548C\u751F\u547D\u5468\u671F\u94A9\u5B50\u51FD\u6570\u3002":t>=4e3&&t<5e3?"\u8BF7\u68C0\u67E5\u8DEF\u7531\u914D\u7F6E\uFF0C\u786E\u4FDD\u8DEF\u7531\u8DEF\u5F84\u5DF2\u6B63\u786E\u6CE8\u518C\u3002":t>=5e3&&t<6e3?"\u8BF7\u68C0\u67E5 Store \u7684\u521B\u5EFA\u548C\u4F7F\u7528\uFF0C\u786E\u4FDD ID \u552F\u4E00\u4E14 Store \u672A\u88AB\u9500\u6BC1\u3002":t>=6e3&&t<7e3?t===6004?"\u8BF7\u68C0\u67E5 computed \u51FD\u6570\u662F\u5426\u5F15\u7528\u4E86\u81EA\u8EAB\uFF0C\u79FB\u9664\u5FAA\u73AF\u4F9D\u8D56\u3002":"\u8BF7\u68C0\u67E5\u54CD\u5E94\u5F0F\u6570\u636E\u7684\u8BFB\u5199\u64CD\u4F5C\u3002":t>=7e3&&t<8e3?t===7002?"\u8BF7\u786E\u4FDD\u6302\u8F7D\u76EE\u6807\u5BB9\u5668\u5728\u8C03\u7528 mount() \u4E4B\u524D\u5DF2\u5B58\u5728\u4E8E DOM \u4E2D\u3002":t===7003?"\u5E94\u7528\u5DF2\u6302\u8F7D\uFF0C\u5982\u9700\u91CD\u65B0\u6302\u8F7D\u8BF7\u5148\u8C03\u7528 unmount()\u3002":"\u8BF7\u68C0\u67E5\u5E94\u7528\u914D\u7F6E\u548C\u53C2\u6570\u3002":null}function Ve(e){if(!G())return"";let t=ne(e),n=e.message.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,"""),i=t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">");return`<div style="
|
|
4
|
-
position: fixed;
|
|
5
|
-
top: 0;
|
|
6
|
-
left: 0;
|
|
7
|
-
right: 0;
|
|
8
|
-
bottom: 0;
|
|
9
|
-
z-index: 999999;
|
|
10
|
-
background: rgba(0, 0, 0, 0.75);
|
|
11
|
-
display: flex;
|
|
12
|
-
align-items: center;
|
|
13
|
-
justify-content: center;
|
|
14
|
-
font-family: monospace;
|
|
15
|
-
">
|
|
16
|
-
<div style="
|
|
17
|
-
background: #1e1e1e;
|
|
18
|
-
color: #d4d4d4;
|
|
19
|
-
border-radius: 8px;
|
|
20
|
-
max-width: 640px;
|
|
21
|
-
width: 90%;
|
|
22
|
-
max-height: 80vh;
|
|
23
|
-
overflow: auto;
|
|
24
|
-
padding: 20px;
|
|
25
|
-
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
|
|
26
|
-
">
|
|
27
|
-
<div style="
|
|
28
|
-
color: #f44747;
|
|
29
|
-
font-size: 16px;
|
|
30
|
-
font-weight: bold;
|
|
31
|
-
margin-bottom: 12px;
|
|
32
|
-
border-bottom: 1px solid #333;
|
|
33
|
-
padding-bottom: 8px;
|
|
34
|
-
">Lyt.js Runtime Error</div>
|
|
35
|
-
<div style="
|
|
36
|
-
color: #ce9178;
|
|
37
|
-
font-size: 14px;
|
|
38
|
-
margin-bottom: 16px;
|
|
39
|
-
">${n}</div>
|
|
40
|
-
<pre style="
|
|
41
|
-
color: #d4d4d4;
|
|
42
|
-
font-size: 12px;
|
|
43
|
-
background: #2d2d2d;
|
|
44
|
-
padding: 12px;
|
|
45
|
-
border-radius: 4px;
|
|
46
|
-
overflow-x: auto;
|
|
47
|
-
white-space: pre-wrap;
|
|
48
|
-
word-break: break-all;
|
|
49
|
-
">${i}</pre>
|
|
50
|
-
</div>
|
|
51
|
-
</div>`}function B(){return typeof window!="undefined"&&typeof document!="undefined"&&typeof HTMLElement!="undefined"&&typeof customElements!="undefined"}function Fe(e){return e.replace(/-([a-z])/g,(t,n)=>n.toUpperCase())}function Ue(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 we(e,t){return t&&t[e]?t[e]:Fe(e)}function je(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 i of Object.keys(n.methods))if(i.startsWith("on")&&i.length>2){let c=i.charAt(2).toLowerCase()+i.slice(3);t.push(c)}}return t}function ke(e,t={}){let{shadowMode:n="open",styles:i="",propMappings:c,eventMappings:T={},attributeConverters:_={}}=t,m=t.observedAttributes||[],R=je(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 m}connectedCallback(){if(!this._connected){if(this._connected=!0,this._shadowRoot=this.attachShadow({mode:n}),i){let o=document.createElement("style");o.textContent=i,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,a,E){a!==E&&this._connected&&(this._syncAttributesToProps(),this._updateComponent())}_syncAttributesToProps(){let o={};for(let a of m)if(this.hasAttribute(a)){let E=this.getAttribute(a),s=we(a,c);_[a]?o[s]=_[a](E):o[s]=Ue(E)}if(e.props){for(let[a,E]of Object.entries(e.props))if(o[a]===void 0){let s=E;s&&typeof s=="object"&&"default"in s?o[a]=typeof s.default=="function"?s.default():s.default:s==null}}this._props=o}_mountComponent(){let o=e.render?e.render:e.template?this._compileTemplate(e.template):null;if(!o)return;let a=this._createComponentContext(),E=o.call(a,L,a);E&&this._container&&this._renderVNode(E,this._container),this._setupReactiveUpdates(a,o)}_compileTemplate(o){try{let a=Function("return require")(),{compile:E}=a("../../compiler/src/index.ts"),{code:s}=E(o);return new Function("h","_ctx",`return ${s}`)}catch(a){return console.warn("[Lyt Web Component] \u6A21\u677F\u7F16\u8BD1\u9700\u8981 @lytjs/compiler \u5305"),null}}_createComponentContext(){let o=e.state?typeof e.state=="function"?e.state():{...e.state}:{},a=e.computed||{},E=e.methods||{},s={...this._props,...o};for(let[p,l]of Object.entries(a))typeof l=="function"?Object.defineProperty(s,p,{get:l.bind(s),enumerable:!0}):l&&typeof l=="object"&&"get"in l&&Object.defineProperty(s,p,{get:l.get.bind(s),enumerable:!0});for(let[p,l]of Object.entries(E))typeof l=="function"&&(s[p]=l.bind(s));return s.emit=(p,...l)=>{let f=T[p]||p,d=new CustomEvent(f,{detail:l.length===1?l[0]:l,bubbles:!0,composed:!0});this.dispatchEvent(d)},s.$el=this._container,s.$attrs={...this._props},s.$slots=this._getSlotContent(),s}_setupReactiveUpdates(o,a){try{let E=Function("return require")(),{effect:s,stop:p}=E("../../reactivity/src/index.ts"),l=s(()=>{if(!this._connected||!this._container)return;let d=a.call(o,L,o);d&&(this._container.innerHTML="",this._renderVNode(d,this._container))},{lazy:!0}),f=e.state?typeof e.state=="function"?Object.keys(e.state()):Object.keys(e.state):[];for(let d of f){let g=o[d];Object.defineProperty(o,d,{get(){return g},set(C){g=C;try{l()}catch(v){}},enumerable:!0})}this._effectCleanup=()=>{try{p(l)}catch(d){}}}catch(E){let s=e.state?typeof e.state=="function"?Object.keys(e.state()):Object.keys(e.state):[];for(let p of s){let f=o[p],d=this;Object.defineProperty(o,p,{get(){return f},set(g){f=g,d._scheduleUpdate(o,a)},enumerable:!0})}}}_scheduleUpdate(o,a){this._updateScheduled||(this._updateScheduled=!0,Promise.resolve().then(()=>{if(this._updateScheduled=!1,!this._connected||!this._container)return;let E=a.call(o,L,o);E&&(this._container.innerHTML="",this._renderVNode(E,this._container))}))}_updateComponent(){if(!this._container)return;let o=e.render?e.render:e.template?this._compileTemplate(e.template):null;if(!o)return;let a=this._createComponentContext(),E=o.call(a,L,a);this._container.innerHTML="",E&&this._renderVNode(E,this._container)}_renderVNode(o,a){let E=this._vNodeToElement(o);E&&a.appendChild(E)}_vNodeToElement(o){if(!o)return null;if(typeof o.type=="symbol"){let a=document.createDocumentFragment();if(Array.isArray(o.children))for(let E of o.children){let s=this._vNodeToElement(E);s&&a.appendChild(s)}return a}if(typeof o.children=="string")return document.createTextNode(o.children);if(typeof o.type=="string"){let a=document.createElement(o.type);if(o.props)for(let[E,s]of Object.entries(o.props))if(E==="style"&&typeof s=="object")for(let[p,l]of Object.entries(s))a.style[p]=l;else if(E==="class"){if(typeof s=="string")a.className=s;else if(typeof s=="object"){let p=[];for(let[l,f]of Object.entries(s))f&&p.push(l);a.className=p.join(" ")}}else if(E.startsWith("on")&&typeof s=="function"){let p=E.slice(2).toLowerCase();a.addEventListener(p,s),this._eventCleanups.push(()=>{a.removeEventListener(p,s)})}else E==="ref"&&typeof s=="function"?s(a):a.setAttribute(E,String(s));if(Array.isArray(o.children))for(let E of o.children){let s=this._vNodeToElement(E);s&&a.appendChild(s)}else typeof o.children=="string"&&(a.textContent=o.children);return a}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 E of o){let s=E.getAttribute("slot")||"default",p=document.createElement("slot");s!=="default"&&p.setAttribute("name",s),this._container.appendChild(p)}let a=document.createElement("slot");this._container.appendChild(a)}_getSlotContent(){var s;let o={},a=this.querySelectorAll("[slot]");for(let p of a){let l=p.getAttribute("slot")||"default";o[l]||(o[l]=[]),o[l].push(p.cloneNode(!0))}let E=[];for(let p of Array.from(this.childNodes))(s=p.hasAttribute)!=null&&s.call(p,"slot")||E.push(p.cloneNode(!0));return E.length>0&&(o.default=E),o}get _lytInstance(){return this._instance}get _lytProps(){return{...this._props}}}}function W(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(!B()){console.warn("[Lyt Web Component] defineCustomElement \u53EA\u80FD\u5728\u6D4F\u89C8\u5668\u73AF\u5883\u4E2D\u4F7F\u7528\u3002\u5F53\u524D\u73AF\u5883\u4E0D\u652F\u6301 Custom Elements API\u3002");return}let i=ke(t,n);customElements.define(e,i)}function $e(e){for(let{tagName:t,component:n,options:i}of e)W(t,n,i)}function He(e){if(B())try{let t=customElements;t.__unregister&&t.__unregister(e)}catch(t){console.warn(`[Lyt Web Component] \u65E0\u6CD5\u6CE8\u9500 "${e}"\u3002Custom Elements \u89C4\u8303\u4E0D\u652F\u6301\u76F4\u63A5\u6CE8\u9500\u5DF2\u6CE8\u518C\u7684\u5143\u7D20\u3002`)}}async function Ge(e,t,n){let i=t.match(/<template>([\s\S]*?)<\/template>/),c=t.match(/<script[^>]*>([\s\S]*?)<\/script>/),T=/<style[^>]*>([\s\S]*?)<\/style>/g,_=[],m;for(;(m=T.exec(t))!==null;)_.push(m);let R=(n==null?void 0:n.styles)||"";for(let a of _)R+=a[1]+`
|
|
52
|
-
`;let O=i?i[1].trim():void 0,y={};if(c){let a=c[1].trim();if(a.match(/export\s+default\s*(\{[\s\S]*\}|\([\s\S]*\)[\s\S]*?\))/))try{let s={},p={exports:s};new Function("module","exports",`"use strict"; ${a.replace(/export\s+default\s*/,"module.exports =")}`)(p,s),y=p.exports||s}catch(s){console.warn("[Lyt Web Component] \u65E0\u6CD5\u89E3\u6790 SFC \u811A\u672C\u5185\u5BB9")}}let o={...n,styles:R};O&&!y.template&&!y.render&&(y.template=O),W(e,y,o)}export{D as ErrorBoundary,I as ErrorCategory,K as Fragment,A as LytError,Q as LytErrorCodes,N as NewLytError,te as NewLytErrorCodes,q as ShapeFlags,Le as callWithErrorHandling,me as createApp,he as createCompilerError,Pe as createComponentError,Ve as createErrorOverlay,Ne as createMessage,F as createProvidesContext,De as createRendererError,W as defineCustomElement,Ge as defineCustomElementFromSFC,ve as error,ne as formatError,k as getCategory,Me as getComponentStack,G as getDevMode,j as getErrorMessage,V as getPluginName,L as h,ee as handleError,U as installPlugin,B as isBrowser,P as isPluginFunction,h as isPluginObject,$e as registerComponents,Ye as resetWarnedMessages,Oe as setDevMode,w as uninstallPlugin,He as unregisterElement,ye as warn,ge as warnOnce,be as warnOnceUtil,Se as warnUtil};
|
|
1
|
+
var T=(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))(T||{}),x=Symbol("Fragment");function F(n){return typeof n=="string"||typeof n=="number"}function N(n){return Array.isArray(n)}function R(n){return n!==null&&typeof n=="object"&&n.type!==void 0&&n.shapeFlag!==void 0}function H(n,e){if(e!=null)if(F(e))n.children=String(e),n.shapeFlag|=8;else if(N(e)){let t=[];for(let r=0;r<e.length;r++){let i=e[r];if(!(i==null||typeof i=="boolean"))if(N(i))for(let c=0;c<i.length;c++){let s=i[c];s!=null&&typeof s!="boolean"&&t.push(R(s)?s:A(String(s)))}else R(i)?t.push(i):t.push(A(String(i)))}n.children=t,n.shapeFlag|=16}else typeof e=="object"&&(n.children=e,n.shapeFlag|=32)}function A(n,e=null,t=null){var u,p;let r=0;typeof n=="string"?r=1:n===x?r=0:typeof n=="function"?r=2:typeof n=="object"&&n!==null&&(n.setup||n.__vccOpts||n.render)&&(r=4);let i=(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:g,ref:d,...m}=e;s=m}let y={type:n,props:s,children:null,key:i,ref:c,shapeFlag:r,el:null,component:null};return t!=null&&H(y,t),y}function b(n,e,t){return A(n,e||null,t||null)}function h(n){return Object.create(n||null)}function O(n){return n!==null&&typeof n=="object"&&typeof n.install=="function"}function E(n){return typeof n=="function"}function j(n,e,...t){if(O(e)){let r=e.onBeforeInstall?e.onBeforeInstall(n,...t):void 0;if(C(r))return r.then(()=>{let i=e.install(n,...t);if(C(i))return i.then(()=>{if(e.onInstalled)return e.onInstalled(n,...t)});if(e.onInstalled)return e.onInstalled(n,...t)});{let i=e.install(n,...t);if(C(i))return i.then(()=>{if(e.onInstalled)return e.onInstalled(n,...t)});if(e.onInstalled)return e.onInstalled(n,...t)}}else if(E(e))return e(n,...t)}function L(n,e){if(O(e)){if(typeof e.uninstall=="function")return e.uninstall(n)}else E(e)}function C(n){return n!==null&&typeof n=="object"&&typeof n.then=="function"}import{effect as M,stop as S}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=new Map;function G(n){let e=k.get(n);if(e)return e;let{code:t}=B(n);return e=new Function("h","_ctx",`return ${t}`),k.set(n,e),e}function J(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=(r,i)=>t(i.renderProxy)}if(n.computed){let t={};for(let r of Object.keys(n.computed)){let i=n.computed[r];typeof i=="function"?t[r]={get:i}:t[r]=i}e.computed=t}if(typeof n.init=="function"){let t=n.init;e.init=function(r,i){return t.call(this,r)}}return e}function K(){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[r,i]of Object.entries(e))i&&t.push(r);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,r){n.addEventListener(e,t,r)},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,r={},i={},c=h(),s={},y={},u=null,p=null,g=null,d=null,m=!1,D=J(typeof n=="function"?{render:n}:n),V=w(D),o={config:s,globalProperties:y,get _instance(){return u},mount(a){if(m)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=K();p=Y(f),u=U(V),z(u,e||{},null);let v=u.type;if(!v.render&&v.template){let I=G(v.template);v.render=(P,_)=>I(P,_.renderProxy)}return $(u,b),u.subTree&&p.mount(u.subTree,l),g=M(()=>{if(!(!u||!u.isMounted||!p)&&(q(u,b),u.subTree&&d)){let I=d.firstChild,P=u.subTree;d.innerHTML="",p.mount(P,d)}},{lazy:!0}),m=!0,o},unmount(){m&&(g&&(S(g),g=null),u&&X(u),d&&(d.innerHTML=""),u=null,p=null,d=null,m=!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:y},a,...l);return f instanceof Promise?f.then(()=>o):o},unuse(a){if(!t.has(a))return o;t.delete(a);let l=L({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:y},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?(r[a]=l,o):r[a]},directive(a,l){return l?(i[a]=l,o):i[a]}};return o}export{x as Fragment,T as ShapeFlags,Q as createApp,b as h};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var s=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var y=Object.prototype.hasOwnProperty;var g=(n,e)=>{for(var t in e)s(n,t,{get:e[t],enumerable:!0})},A=(n,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of p(e))!y.call(n,i)&&i!==t&&s(n,i,{get:()=>e[i],enumerable:!(r=d(e,i))||r.enumerable});return n};var m=n=>A(s({},"__esModule",{value:!0}),n);var I={};g(I,{createProvidesContext:()=>u,getPluginName:()=>P,installPlugin:()=>f,isPluginFunction:()=>l,isPluginObject:()=>o,uninstallPlugin:()=>c});module.exports=m(I);function u(n){return Object.create(n||null)}function o(n){return n!==null&&typeof n=="object"&&typeof n.install=="function"}function l(n){return typeof n=="function"}function P(n){return o(n)&&n.name||l(n)&&n.name?n.name:o(n)?"[PluginObject]":"[PluginFunction]"}function f(n,e,...t){if(o(e)){let r=e.onBeforeInstall?e.onBeforeInstall(n,...t):void 0;if(a(r))return r.then(()=>{let i=e.install(n,...t);if(a(i))return i.then(()=>{if(e.onInstalled)return e.onInstalled(n,...t)});if(e.onInstalled)return e.onInstalled(n,...t)});{let i=e.install(n,...t);if(a(i))return i.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 c(n,e){if(o(e)){if(typeof e.uninstall=="function")return e.uninstall(n)}else l(e)}function a(n){return n!==null&&typeof n=="object"&&typeof n.then=="function"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function a(n){return Object.create(n||null)}function o(n){return n!==null&&typeof n=="object"&&typeof n.install=="function"}function r(n){return typeof n=="function"}function u(n){return o(n)&&n.name||r(n)&&n.name?n.name:o(n)?"[PluginObject]":"[PluginFunction]"}function P(n,e,...t){if(o(e)){let s=e.onBeforeInstall?e.onBeforeInstall(n,...t):void 0;if(l(s))return s.then(()=>{let i=e.install(n,...t);if(l(i))return i.then(()=>{if(e.onInstalled)return e.onInstalled(n,...t)});if(e.onInstalled)return e.onInstalled(n,...t)});{let i=e.install(n,...t);if(l(i))return i.then(()=>{if(e.onInstalled)return e.onInstalled(n,...t)});if(e.onInstalled)return e.onInstalled(n,...t)}}else if(r(e))return e(n,...t)}function f(n,e){if(o(e)){if(typeof e.uninstall=="function")return e.uninstall(n)}else r(e)}function l(n){return n!==null&&typeof n=="object"&&typeof n.then=="function"}export{a as createProvidesContext,u as getPluginName,P as installPlugin,r as isPluginFunction,o as isPluginObject,f as uninstallPlugin};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @lytjs/core/error — 错误处理子路径入口
|
|
3
|
+
*
|
|
4
|
+
* 按需导入错误处理 API:
|
|
5
|
+
* import { LytError, ErrorBoundary, handleError } from '@lytjs/core/error'
|
|
6
|
+
*/
|
|
7
|
+
export { LytError, LytErrorCodes, ErrorBoundary, handleError, callWithErrorHandling, warn, warnOnce, setDevMode, createMessage, } from './error-handling';
|
|
8
|
+
export type { ErrorBoundaryOptions, } from './error-handling';
|
|
9
|
+
export { LytErrorCodes as NewLytErrorCodes, ErrorCategory, getErrorMessage, getCategory, } from './error-codes';
|
|
10
|
+
export type { ErrorCategoryType, } from './error-codes';
|
|
11
|
+
export { LytError as NewLytError, createCompilerError, createRendererError, createComponentError, } from './lyt-error';
|
|
12
|
+
export type { SourceLocation, } from './lyt-error';
|
|
13
|
+
export { warn as warnUtil, warnOnce as warnOnceUtil, getDevMode, resetWarnedMessages, } from './error-handling';
|
|
14
|
+
//# sourceMappingURL=error-entry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error-entry.d.ts","sourceRoot":"","sources":["../../src/error-entry.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACL,QAAQ,EACR,aAAa,EACb,aAAa,EACb,WAAW,EACX,qBAAqB,EACrB,IAAI,EACJ,QAAQ,EACR,UAAU,EACV,aAAa,GACd,MAAM,kBAAkB,CAAA;AAEzB,YAAY,EACV,oBAAoB,GACrB,MAAM,kBAAkB,CAAA;AAEzB,OAAO,EACL,aAAa,IAAI,gBAAgB,EACjC,aAAa,EACb,eAAe,EACf,WAAW,GACZ,MAAM,eAAe,CAAA;AAEtB,YAAY,EACV,iBAAiB,GAClB,MAAM,eAAe,CAAA;AAEtB,OAAO,EACL,QAAQ,IAAI,WAAW,EACvB,mBAAmB,EACnB,mBAAmB,EACnB,oBAAoB,GACrB,MAAM,aAAa,CAAA;AAEpB,YAAY,EACV,cAAc,GACf,MAAM,aAAa,CAAA;AAEpB,OAAO,EACL,IAAI,IAAI,QAAQ,EAChB,QAAQ,IAAI,YAAY,EACxB,UAAU,EACV,mBAAmB,GACpB,MAAM,kBAAkB,CAAA"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -9,16 +9,4 @@ 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 { createProvidesContext, installPlugin, uninstallPlugin, isPluginObject, isPluginFunction, getPluginName, } from './plugin';
|
|
13
|
-
export type { Plugin, PluginObject, AppAPI, AppConfig, } from './plugin';
|
|
14
|
-
export { LytError, LytErrorCodes, ErrorBoundary, handleError, callWithErrorHandling, warn, warnOnce, setDevMode, createMessage, } from './error-handling';
|
|
15
|
-
export type { ErrorBoundaryOptions, } from './error-handling';
|
|
16
|
-
export { LytErrorCodes as NewLytErrorCodes, ErrorCategory, getErrorMessage, getCategory, } from './error-codes';
|
|
17
|
-
export type { ErrorCategoryType, } from './error-codes';
|
|
18
|
-
export { LytError as NewLytError, createCompilerError, createRendererError, createComponentError, } from './lyt-error';
|
|
19
|
-
export type { SourceLocation, } from './lyt-error';
|
|
20
|
-
export { warn as warnUtil, warnOnce as warnOnceUtil, error, getDevMode, resetWarnedMessages, } from './warn';
|
|
21
|
-
export { formatError, getComponentStack, createErrorOverlay, } from './dev-error';
|
|
22
|
-
export { defineCustomElement, registerComponents, unregisterElement, isBrowser, defineCustomElementFromSFC, } from './web-component';
|
|
23
|
-
export type { CustomElementOptions, ComponentRegistration, } from './web-component';
|
|
24
12
|
//# 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"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @lytjs/core/plugin — 插件系统子路径入口
|
|
3
|
+
*
|
|
4
|
+
* 按需导入插件系统 API:
|
|
5
|
+
* import { installPlugin, uninstallPlugin } from '@lytjs/core/plugin'
|
|
6
|
+
*/
|
|
7
|
+
export { createProvidesContext, installPlugin, uninstallPlugin, isPluginObject, isPluginFunction, getPluginName, } from './plugin';
|
|
8
|
+
export type { Plugin, PluginObject, AppAPI, AppConfig, } from './plugin';
|
|
9
|
+
//# sourceMappingURL=plugin-entry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin-entry.d.ts","sourceRoot":"","sources":["../../src/plugin-entry.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACL,qBAAqB,EACrB,aAAa,EACb,eAAe,EACf,cAAc,EACd,gBAAgB,EAChB,aAAa,GACd,MAAM,UAAU,CAAA;AAEjB,YAAY,EACV,MAAM,EACN,YAAY,EACZ,MAAM,EACN,SAAS,GACV,MAAM,UAAU,CAAA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @lytjs/core/web-component — Web Component 适配器子路径入口
|
|
3
|
+
*
|
|
4
|
+
* 按需导入 Web Component API:
|
|
5
|
+
* import { defineCustomElement, registerComponents } from '@lytjs/core/web-component'
|
|
6
|
+
*/
|
|
7
|
+
export { defineCustomElement, registerComponents, unregisterElement, isBrowser, defineCustomElementFromSFC, } from './web-component';
|
|
8
|
+
export type { CustomElementOptions, ComponentRegistration, } from './web-component';
|
|
9
|
+
//# sourceMappingURL=web-component-entry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"web-component-entry.d.ts","sourceRoot":"","sources":["../../src/web-component-entry.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACL,mBAAmB,EACnB,kBAAkB,EAClB,iBAAiB,EACjB,SAAS,EACT,0BAA0B,GAC3B,MAAM,iBAAiB,CAAA;AAExB,YAAY,EACV,oBAAoB,EACpB,qBAAqB,GACtB,MAAM,iBAAiB,CAAA"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var v=Object.defineProperty;var V=Object.getOwnPropertyDescriptor;var k=Object.getOwnPropertyNames;var O=Object.prototype.hasOwnProperty;var M=(e,r)=>{for(var i in r)v(e,i,{get:r[i],enumerable:!0})},P=(e,r,i,c)=>{if(r&&typeof r=="object"||typeof r=="function")for(let u of k(r))!O.call(e,u)&&u!==i&&v(e,u,{get:()=>r[u],enumerable:!(c=V(r,u))||c.enumerable});return e};var F=e=>P(v({},"__esModule",{value:!0}),e);var z={};M(z,{defineCustomElement:()=>N,defineCustomElementFromSFC:()=>j,isBrowser:()=>E,registerComponents:()=>w,unregisterElement:()=>L});module.exports=F(z);var x=Symbol("Fragment");function H(e){return typeof e=="string"||typeof e=="number"}function T(e){return Array.isArray(e)}function R(e){return e!==null&&typeof e=="object"&&e.type!==void 0&&e.shapeFlag!==void 0}function W(e,r){if(r!=null)if(H(r))e.children=String(r),e.shapeFlag|=8;else if(T(r)){let i=[];for(let c=0;c<r.length;c++){let u=r[c];if(!(u==null||typeof u=="boolean"))if(T(u))for(let p=0;p<u.length;p++){let f=u[p];f!=null&&typeof f!="boolean"&&i.push(R(f)?f:A(String(f)))}else R(u)?i.push(u):i.push(A(String(u)))}e.children=i,e.shapeFlag|=16}else typeof r=="object"&&(e.children=r,e.shapeFlag|=32)}function A(e,r=null,i=null){var g,_;let c=0;typeof e=="string"?c=1:e===x?c=0:typeof e=="function"?c=2:typeof e=="object"&&e!==null&&(e.setup||e.__vccOpts||e.render)&&(c=4);let u=(g=r==null?void 0:r.key)!=null?g:null,p=(_=r==null?void 0:r.ref)!=null?_:null,f=r;if(r){let{key:y,ref:t,...s}=r;f=s}let m={type:e,props:f,children:null,key:u,ref:p,shapeFlag:c,el:null,component:null};return i!=null&&W(m,i),m}function C(e,r,i){return A(e,r||null,i||null)}function E(){return typeof window!="undefined"&&typeof document!="undefined"&&typeof HTMLElement!="undefined"&&typeof customElements!="undefined"}function D(e){return e.replace(/-([a-z])/g,(r,i)=>i.toUpperCase())}function I(e){if(e===""||e==="true")return!0;if(e==="false")return!1;if(e==="null")return null;if(e==="undefined")return;let r=Number(e);if(!isNaN(r)&&e.trim()!=="")return r;if(e.startsWith("{")&&e.endsWith("}")||e.startsWith("[")&&e.endsWith("]"))try{return JSON.parse(e)}catch(i){}return e}function U(e,r){return r&&r[e]?r[e]:D(e)}function $(e){let r=[],i=e;if(i.emits&&(Array.isArray(i.emits)?r.push(...i.emits):typeof i.emits=="object"&&r.push(...Object.keys(i.emits))),i.methods){for(let c of Object.keys(i.methods))if(c.startsWith("on")&&c.length>2){let u=c.charAt(2).toLowerCase()+c.slice(3);r.push(u)}}return r}function q(e,r={}){let{shadowMode:i="open",styles:c="",propMappings:u,eventMappings:p={},attributeConverters:f={}}=r,m=r.observedAttributes||[],g=$(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 m}connectedCallback(){if(!this._connected){if(this._connected=!0,this._shadowRoot=this.attachShadow({mode:i}),c){let t=document.createElement("style");t.textContent=c,this._shadowRoot.appendChild(t)}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 t of this._eventCleanups)t();this._eventCleanups=[],this._effectCleanup&&(this._effectCleanup(),this._effectCleanup=null),this._instance=null,this._container&&(this._container.innerHTML="")}}attributeChangedCallback(t,s,o){s!==o&&this._connected&&(this._syncAttributesToProps(),this._updateComponent())}_syncAttributesToProps(){let t={};for(let s of m)if(this.hasAttribute(s)){let o=this.getAttribute(s),n=U(s,u);f[s]?t[n]=f[s](o):t[n]=I(o)}if(e.props){for(let[s,o]of Object.entries(e.props))if(t[s]===void 0){let n=o;n&&typeof n=="object"&&"default"in n?t[s]=typeof n.default=="function"?n.default():n.default:n==null}}this._props=t}_mountComponent(){let t=e.render?e.render:e.template?this._compileTemplate(e.template):null;if(!t)return;let s=this._createComponentContext(),o=t.call(s,C,s);o&&this._container&&this._renderVNode(o,this._container),this._setupReactiveUpdates(s,t)}_compileTemplate(t){try{let s=Function("return require")(),{compile:o}=s("../../compiler/src/index.ts"),{code:n}=o(t);return new Function("h","_ctx",`return ${n}`)}catch(s){return null}}_createComponentContext(){let t=e.state?typeof e.state=="function"?e.state():{...e.state}:{},s=e.computed||{},o=e.methods||{},n={...this._props,...t};for(let[l,a]of Object.entries(s))typeof a=="function"?Object.defineProperty(n,l,{get:a.bind(n),enumerable:!0}):a&&typeof a=="object"&&"get"in a&&Object.defineProperty(n,l,{get:a.get.bind(n),enumerable:!0});for(let[l,a]of Object.entries(o))typeof a=="function"&&(n[l]=a.bind(n));return n.emit=(l,...a)=>{let h=p[l]||l,d=new CustomEvent(h,{detail:a.length===1?a[0]:a,bubbles:!0,composed:!0});this.dispatchEvent(d)},n.$el=this._container,n.$attrs={...this._props},n.$slots=this._getSlotContent(),n}_setupReactiveUpdates(t,s){try{let o=Function("return require")(),{effect:n,stop:l}=o("../../reactivity/src/index.ts"),a=n(()=>{if(!this._connected||!this._container)return;let d=s.call(t,C,t);d&&(this._container.innerHTML="",this._renderVNode(d,this._container))},{lazy:!0}),h=e.state?typeof e.state=="function"?Object.keys(e.state()):Object.keys(e.state):[];for(let d of h){let b=t[d];Object.defineProperty(t,d,{get(){return b},set(S){b=S;try{a()}catch(K){}},enumerable:!0})}this._effectCleanup=()=>{try{l(a)}catch(d){}}}catch(o){let n=e.state?typeof e.state=="function"?Object.keys(e.state()):Object.keys(e.state):[];for(let l of n){let h=t[l],d=this;Object.defineProperty(t,l,{get(){return h},set(b){h=b,d._scheduleUpdate(t,s)},enumerable:!0})}}}_scheduleUpdate(t,s){this._updateScheduled||(this._updateScheduled=!0,Promise.resolve().then(()=>{if(this._updateScheduled=!1,!this._connected||!this._container)return;let o=s.call(t,C,t);o&&(this._container.innerHTML="",this._renderVNode(o,this._container))}))}_updateComponent(){if(!this._container)return;let t=e.render?e.render:e.template?this._compileTemplate(e.template):null;if(!t)return;let s=this._createComponentContext(),o=t.call(s,C,s);this._container.innerHTML="",o&&this._renderVNode(o,this._container)}_renderVNode(t,s){let o=this._vNodeToElement(t);o&&s.appendChild(o)}_vNodeToElement(t){if(!t)return null;if(typeof t.type=="symbol"){let s=document.createDocumentFragment();if(Array.isArray(t.children))for(let o of t.children){let n=this._vNodeToElement(o);n&&s.appendChild(n)}return s}if(typeof t.children=="string")return document.createTextNode(t.children);if(typeof t.type=="string"){let s=document.createElement(t.type);if(t.props)for(let[o,n]of Object.entries(t.props))if(o==="style"&&typeof n=="object")for(let[l,a]of Object.entries(n))s.style[l]=a;else if(o==="class"){if(typeof n=="string")s.className=n;else if(typeof n=="object"){let l=[];for(let[a,h]of Object.entries(n))h&&l.push(a);s.className=l.join(" ")}}else if(o.startsWith("on")&&typeof n=="function"){let l=o.slice(2).toLowerCase();s.addEventListener(l,n),this._eventCleanups.push(()=>{s.removeEventListener(l,n)})}else o==="ref"&&typeof n=="function"?n(s):s.setAttribute(o,String(n));if(Array.isArray(t.children))for(let o of t.children){let n=this._vNodeToElement(o);n&&s.appendChild(n)}else typeof t.children=="string"&&(s.textContent=t.children);return s}return typeof t.type=="object"||typeof t.type=="function"?t.component?this._vNodeToElement(t.component.subTree||t):document.createComment("component"):null}_forwardSlots(){if(!this._shadowRoot||!this._container)return;let t=this.querySelectorAll("[slot]");for(let o of t){let n=o.getAttribute("slot")||"default",l=document.createElement("slot");n!=="default"&&l.setAttribute("name",n),this._container.appendChild(l)}let s=document.createElement("slot");this._container.appendChild(s)}_getSlotContent(){var n;let t={},s=this.querySelectorAll("[slot]");for(let l of s){let a=l.getAttribute("slot")||"default";t[a]||(t[a]=[]),t[a].push(l.cloneNode(!0))}let o=[];for(let l of Array.from(this.childNodes))(n=l.hasAttribute)!=null&&n.call(l,"slot")||o.push(l.cloneNode(!0));return o.length>0&&(t.default=o),t}get _lytInstance(){return this._instance}get _lytProps(){return{...this._props}}}}function N(e,r,i){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(!E())return;let c=q(r,i);customElements.define(e,c)}function w(e){for(let{tagName:r,component:i,options:c}of e)N(r,i,c)}function L(e){if(E())try{let r=customElements;r.__unregister&&r.__unregister(e)}catch(r){}}async function j(e,r,i){let c=r.match(/<template>([\s\S]*?)<\/template>/),u=r.match(/<script[^>]*>([\s\S]*?)<\/script>/),p=/<style[^>]*>([\s\S]*?)<\/style>/g,f=[],m;for(;(m=p.exec(r))!==null;)f.push(m);let g=(i==null?void 0:i.styles)||"";for(let s of f)g+=s[1]+`
|
|
2
|
+
`;let _=c?c[1].trim():void 0,y={};if(u){let s=u[1].trim();if(s.match(/export\s+default\s*(\{[\s\S]*\}|\([\s\S]*\)[\s\S]*?\))/))try{let n={},l={exports:n};new Function("module","exports",`"use strict"; ${s.replace(/export\s+default\s*/,"module.exports =")}`)(l,n),y=l.exports||n}catch(n){}}let t={...i,styles:g};_&&!y.template&&!y.render&&(y.template=_),N(e,y,t)}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var R=Symbol("Fragment");function w(e){return typeof e=="string"||typeof e=="number"}function A(e){return Array.isArray(e)}function T(e){return e!==null&&typeof e=="object"&&e.type!==void 0&&e.shapeFlag!==void 0}function L(e,s){if(s!=null)if(w(s))e.children=String(s),e.shapeFlag|=8;else if(A(s)){let l=[];for(let a=0;a<s.length;a++){let u=s[a];if(!(u==null||typeof u=="boolean"))if(A(u))for(let p=0;p<u.length;p++){let f=u[p];f!=null&&typeof f!="boolean"&&l.push(T(f)?f:E(String(f)))}else T(u)?l.push(u):l.push(E(String(u)))}e.children=l,e.shapeFlag|=16}else typeof s=="object"&&(e.children=s,e.shapeFlag|=32)}function E(e,s=null,l=null){var g,_;let a=0;typeof e=="string"?a=1:e===R?a=0:typeof e=="function"?a=2:typeof e=="object"&&e!==null&&(e.setup||e.__vccOpts||e.render)&&(a=4);let u=(g=s==null?void 0:s.key)!=null?g:null,p=(_=s==null?void 0:s.ref)!=null?_:null,f=s;if(s){let{key:y,ref:t,...r}=s;f=r}let m={type:e,props:f,children:null,key:u,ref:p,shapeFlag:a,el:null,component:null};return l!=null&&L(m,l),m}function C(e,s,l){return E(e,s||null,l||null)}function N(){return typeof window!="undefined"&&typeof document!="undefined"&&typeof HTMLElement!="undefined"&&typeof customElements!="undefined"}function j(e){return e.replace(/-([a-z])/g,(s,l)=>l.toUpperCase())}function S(e){if(e===""||e==="true")return!0;if(e==="false")return!1;if(e==="null")return null;if(e==="undefined")return;let s=Number(e);if(!isNaN(s)&&e.trim()!=="")return s;if(e.startsWith("{")&&e.endsWith("}")||e.startsWith("[")&&e.endsWith("]"))try{return JSON.parse(e)}catch(l){}return e}function V(e,s){return s&&s[e]?s[e]:j(e)}function k(e){let s=[],l=e;if(l.emits&&(Array.isArray(l.emits)?s.push(...l.emits):typeof l.emits=="object"&&s.push(...Object.keys(l.emits))),l.methods){for(let a of Object.keys(l.methods))if(a.startsWith("on")&&a.length>2){let u=a.charAt(2).toLowerCase()+a.slice(3);s.push(u)}}return s}function O(e,s={}){let{shadowMode:l="open",styles:a="",propMappings:u,eventMappings:p={},attributeConverters:f={}}=s,m=s.observedAttributes||[],g=k(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 m}connectedCallback(){if(!this._connected){if(this._connected=!0,this._shadowRoot=this.attachShadow({mode:l}),a){let t=document.createElement("style");t.textContent=a,this._shadowRoot.appendChild(t)}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 t of this._eventCleanups)t();this._eventCleanups=[],this._effectCleanup&&(this._effectCleanup(),this._effectCleanup=null),this._instance=null,this._container&&(this._container.innerHTML="")}}attributeChangedCallback(t,r,o){r!==o&&this._connected&&(this._syncAttributesToProps(),this._updateComponent())}_syncAttributesToProps(){let t={};for(let r of m)if(this.hasAttribute(r)){let o=this.getAttribute(r),n=V(r,u);f[r]?t[n]=f[r](o):t[n]=S(o)}if(e.props){for(let[r,o]of Object.entries(e.props))if(t[r]===void 0){let n=o;n&&typeof n=="object"&&"default"in n?t[r]=typeof n.default=="function"?n.default():n.default:n==null}}this._props=t}_mountComponent(){let t=e.render?e.render:e.template?this._compileTemplate(e.template):null;if(!t)return;let r=this._createComponentContext(),o=t.call(r,C,r);o&&this._container&&this._renderVNode(o,this._container),this._setupReactiveUpdates(r,t)}_compileTemplate(t){try{let r=Function("return require")(),{compile:o}=r("../../compiler/src/index.ts"),{code:n}=o(t);return new Function("h","_ctx",`return ${n}`)}catch(r){return null}}_createComponentContext(){let t=e.state?typeof e.state=="function"?e.state():{...e.state}:{},r=e.computed||{},o=e.methods||{},n={...this._props,...t};for(let[i,c]of Object.entries(r))typeof c=="function"?Object.defineProperty(n,i,{get:c.bind(n),enumerable:!0}):c&&typeof c=="object"&&"get"in c&&Object.defineProperty(n,i,{get:c.get.bind(n),enumerable:!0});for(let[i,c]of Object.entries(o))typeof c=="function"&&(n[i]=c.bind(n));return n.emit=(i,...c)=>{let h=p[i]||i,d=new CustomEvent(h,{detail:c.length===1?c[0]:c,bubbles:!0,composed:!0});this.dispatchEvent(d)},n.$el=this._container,n.$attrs={...this._props},n.$slots=this._getSlotContent(),n}_setupReactiveUpdates(t,r){try{let o=Function("return require")(),{effect:n,stop:i}=o("../../reactivity/src/index.ts"),c=n(()=>{if(!this._connected||!this._container)return;let d=r.call(t,C,t);d&&(this._container.innerHTML="",this._renderVNode(d,this._container))},{lazy:!0}),h=e.state?typeof e.state=="function"?Object.keys(e.state()):Object.keys(e.state):[];for(let d of h){let b=t[d];Object.defineProperty(t,d,{get(){return b},set(x){b=x;try{c()}catch(H){}},enumerable:!0})}this._effectCleanup=()=>{try{i(c)}catch(d){}}}catch(o){let n=e.state?typeof e.state=="function"?Object.keys(e.state()):Object.keys(e.state):[];for(let i of n){let h=t[i],d=this;Object.defineProperty(t,i,{get(){return h},set(b){h=b,d._scheduleUpdate(t,r)},enumerable:!0})}}}_scheduleUpdate(t,r){this._updateScheduled||(this._updateScheduled=!0,Promise.resolve().then(()=>{if(this._updateScheduled=!1,!this._connected||!this._container)return;let o=r.call(t,C,t);o&&(this._container.innerHTML="",this._renderVNode(o,this._container))}))}_updateComponent(){if(!this._container)return;let t=e.render?e.render:e.template?this._compileTemplate(e.template):null;if(!t)return;let r=this._createComponentContext(),o=t.call(r,C,r);this._container.innerHTML="",o&&this._renderVNode(o,this._container)}_renderVNode(t,r){let o=this._vNodeToElement(t);o&&r.appendChild(o)}_vNodeToElement(t){if(!t)return null;if(typeof t.type=="symbol"){let r=document.createDocumentFragment();if(Array.isArray(t.children))for(let o of t.children){let n=this._vNodeToElement(o);n&&r.appendChild(n)}return r}if(typeof t.children=="string")return document.createTextNode(t.children);if(typeof t.type=="string"){let r=document.createElement(t.type);if(t.props)for(let[o,n]of Object.entries(t.props))if(o==="style"&&typeof n=="object")for(let[i,c]of Object.entries(n))r.style[i]=c;else if(o==="class"){if(typeof n=="string")r.className=n;else if(typeof n=="object"){let i=[];for(let[c,h]of Object.entries(n))h&&i.push(c);r.className=i.join(" ")}}else if(o.startsWith("on")&&typeof n=="function"){let i=o.slice(2).toLowerCase();r.addEventListener(i,n),this._eventCleanups.push(()=>{r.removeEventListener(i,n)})}else o==="ref"&&typeof n=="function"?n(r):r.setAttribute(o,String(n));if(Array.isArray(t.children))for(let o of t.children){let n=this._vNodeToElement(o);n&&r.appendChild(n)}else typeof t.children=="string"&&(r.textContent=t.children);return r}return typeof t.type=="object"||typeof t.type=="function"?t.component?this._vNodeToElement(t.component.subTree||t):document.createComment("component"):null}_forwardSlots(){if(!this._shadowRoot||!this._container)return;let t=this.querySelectorAll("[slot]");for(let o of t){let n=o.getAttribute("slot")||"default",i=document.createElement("slot");n!=="default"&&i.setAttribute("name",n),this._container.appendChild(i)}let r=document.createElement("slot");this._container.appendChild(r)}_getSlotContent(){var n;let t={},r=this.querySelectorAll("[slot]");for(let i of r){let c=i.getAttribute("slot")||"default";t[c]||(t[c]=[]),t[c].push(i.cloneNode(!0))}let o=[];for(let i of Array.from(this.childNodes))(n=i.hasAttribute)!=null&&n.call(i,"slot")||o.push(i.cloneNode(!0));return o.length>0&&(t.default=o),t}get _lytInstance(){return this._instance}get _lytProps(){return{...this._props}}}}function v(e,s,l){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(!N())return;let a=O(s,l);customElements.define(e,a)}function M(e){for(let{tagName:s,component:l,options:a}of e)v(s,l,a)}function P(e){if(N())try{let s=customElements;s.__unregister&&s.__unregister(e)}catch(s){}}async function F(e,s,l){let a=s.match(/<template>([\s\S]*?)<\/template>/),u=s.match(/<script[^>]*>([\s\S]*?)<\/script>/),p=/<style[^>]*>([\s\S]*?)<\/style>/g,f=[],m;for(;(m=p.exec(s))!==null;)f.push(m);let g=(l==null?void 0:l.styles)||"";for(let r of f)g+=r[1]+`
|
|
2
|
+
`;let _=a?a[1].trim():void 0,y={};if(u){let r=u[1].trim();if(r.match(/export\s+default\s*(\{[\s\S]*\}|\([\s\S]*\)[\s\S]*?\))/))try{let n={},i={exports:n};new Function("module","exports",`"use strict"; ${r.replace(/export\s+default\s*/,"module.exports =")}`)(i,n),y=i.exports||n}catch(n){}}let t={...l,styles:g};_&&!y.template&&!y.render&&(y.template=_),v(e,y,t)}export{v as defineCustomElement,F as defineCustomElementFromSFC,N as isBrowser,M as registerComponents,P as unregisterElement};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lytjs/core",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0",
|
|
4
4
|
"description": "Lyt.js 核心入口 - 整合响应式、编译器、虚拟 DOM、渲染器和组件系统",
|
|
5
5
|
"main": "./dist/index.cjs",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -11,6 +11,24 @@
|
|
|
11
11
|
"import": "./dist/index.mjs",
|
|
12
12
|
"require": "./dist/index.cjs",
|
|
13
13
|
"default": "./dist/index.mjs"
|
|
14
|
+
},
|
|
15
|
+
"./plugin": {
|
|
16
|
+
"types": "./dist/types/plugin-entry.d.ts",
|
|
17
|
+
"import": "./dist/plugin-entry.mjs",
|
|
18
|
+
"require": "./dist/plugin-entry.cjs",
|
|
19
|
+
"default": "./dist/plugin-entry.mjs"
|
|
20
|
+
},
|
|
21
|
+
"./error": {
|
|
22
|
+
"types": "./dist/types/error-entry.d.ts",
|
|
23
|
+
"import": "./dist/error-entry.mjs",
|
|
24
|
+
"require": "./dist/error-entry.cjs",
|
|
25
|
+
"default": "./dist/error-entry.mjs"
|
|
26
|
+
},
|
|
27
|
+
"./web-component": {
|
|
28
|
+
"types": "./dist/types/web-component-entry.d.ts",
|
|
29
|
+
"import": "./dist/web-component-entry.mjs",
|
|
30
|
+
"require": "./dist/web-component-entry.cjs",
|
|
31
|
+
"default": "./dist/web-component-entry.mjs"
|
|
14
32
|
}
|
|
15
33
|
},
|
|
16
34
|
"sideEffects": false,
|
|
@@ -19,28 +37,22 @@
|
|
|
19
37
|
"author": "lytjs",
|
|
20
38
|
"repository": {
|
|
21
39
|
"type": "git",
|
|
22
|
-
"url": "https://gitee.com
|
|
40
|
+
"url": "https://gitee.com/lytjs/lytjs"
|
|
23
41
|
},
|
|
24
|
-
"homepage": "https://gitee.com
|
|
42
|
+
"homepage": "https://gitee.com/lytjs/lytjs",
|
|
25
43
|
"keywords": [
|
|
26
|
-
"lyt",
|
|
27
|
-
"
|
|
28
|
-
"javascript",
|
|
29
|
-
"framework",
|
|
30
|
-
"frontend",
|
|
31
|
-
"vue-like",
|
|
32
|
-
"lightweight",
|
|
33
|
-
"zero-dependency",
|
|
34
|
-
"core",
|
|
35
|
-
"createApp",
|
|
36
|
-
"核心"
|
|
44
|
+
"lyt", "lytjs", "javascript", "framework", "frontend", "vue-like",
|
|
45
|
+
"lightweight", "zero-dependency", "core", "createApp"
|
|
37
46
|
],
|
|
38
47
|
"dependencies": {
|
|
39
|
-
"@lytjs/reactivity": "
|
|
40
|
-
"@lytjs/compiler": "
|
|
41
|
-
"@lytjs/vdom": "
|
|
42
|
-
"@lytjs/renderer": "
|
|
43
|
-
"@lytjs/component": "
|
|
48
|
+
"@lytjs/reactivity": "^4.0.0",
|
|
49
|
+
"@lytjs/compiler": "^4.0.0",
|
|
50
|
+
"@lytjs/vdom": "^4.0.0",
|
|
51
|
+
"@lytjs/renderer": "^4.0.0",
|
|
52
|
+
"@lytjs/component": "^4.0.0"
|
|
53
|
+
},
|
|
54
|
+
"engines": {
|
|
55
|
+
"node": ">=18.0.0"
|
|
44
56
|
},
|
|
45
57
|
"publishConfig": {
|
|
46
58
|
"access": "public"
|