@lytjs/core 4.0.0 → 4.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/error-entry.cjs +1 -1
- package/dist/error-entry.mjs +1 -1
- package/dist/index.cjs +2 -1
- package/dist/index.mjs +2 -1
- package/dist/plugin-entry.cjs +1 -1
- package/dist/plugin-entry.mjs +1 -1
- package/dist/shared-entry.cjs +1 -0
- package/dist/shared-entry.mjs +1 -0
- package/dist/types/create-app.d.ts.map +1 -1
- package/dist/types/error-codes.d.ts +3 -83
- package/dist/types/error-codes.d.ts.map +1 -1
- package/dist/types/h.d.ts.map +1 -1
- package/dist/types/index.d.ts +5 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/lyt-error.d.ts +3 -52
- package/dist/types/lyt-error.d.ts.map +1 -1
- package/dist/types/plugin.d.ts.map +1 -1
- package/dist/types/shared-entry.d.ts +8 -0
- package/dist/types/shared-entry.d.ts.map +1 -0
- package/dist/types/warn.d.ts +3 -27
- package/dist/types/warn.d.ts.map +1 -1
- package/dist/web-component-entry.cjs +2 -2
- package/dist/web-component-entry.mjs +2 -2
- package/package.json +26 -9
package/dist/error-entry.cjs
CHANGED
|
@@ -1 +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}
|
|
1
|
+
var I=Object.defineProperty;var P=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyNames;var h=Object.prototype.hasOwnProperty;var d=(r,o)=>{for(var t in o)I(r,t,{get:o[t],enumerable:!0})},M=(r,o,t,i)=>{if(o&&typeof o=="object"||typeof o=="function")for(let s of m(o))!h.call(r,s)&&s!==t&&I(r,s,{get:()=>o[s],enumerable:!(i=P(o,s))||i.enumerable});return r};var y=r=>M(I({},"__esModule",{value:!0}),r);var V={};d(V,{ErrorBoundary:()=>R,ErrorCategory:()=>n.ErrorCategory,LytError:()=>a,LytErrorCodes:()=>N,NewLytError:()=>E.LytError,NewLytErrorCodes:()=>n.LytErrorCodes,callWithErrorHandling:()=>L,createCompilerError:()=>E.createCompilerError,createComponentError:()=>E.createComponentError,createMessage:()=>C,createRendererError:()=>E.createRendererError,getCategory:()=>n.getCategory,getDevMode:()=>f,getErrorMessage:()=>n.getErrorMessage,handleError:()=>D,resetWarnedMessages:()=>u,setDevMode:()=>g,warn:()=>A,warnOnce:()=>l,warnOnceUtil:()=>l,warnUtil:()=>A});module.exports=y(V);var N=(e=>(e[e.INVALID_ARGUMENT=1001]="INVALID_ARGUMENT",e[e.NOT_FOUND=1002]="NOT_FOUND",e[e.ALREADY_EXISTS=1003]="ALREADY_EXISTS",e[e.OPERATION_FAILED=1004]="OPERATION_FAILED",e[e.REACTIVE_READONLY=2001]="REACTIVE_READONLY",e[e.REACTIVE_EFFECT_DISPOSED=2002]="REACTIVE_EFFECT_DISPOSED",e[e.COMPUTED_CYCLE=2003]="COMPUTED_CYCLE",e[e.PARSE_ERROR=3001]="PARSE_ERROR",e[e.INVALID_EXPRESSION=3002]="INVALID_EXPRESSION",e[e.INVALID_DIRECTIVE=3003]="INVALID_DIRECTIVE",e[e.INVALID_TEMPLATE=3004]="INVALID_TEMPLATE",e[e.RENDER_ERROR=4001]="RENDER_ERROR",e[e.HYDRATION_MISMATCH=4002]="HYDRATION_MISMATCH",e[e.INVALID_VNODE=4003]="INVALID_VNODE",e[e.COMPONENT_INVALID_PROPS=5001]="COMPONENT_INVALID_PROPS",e[e.COMPONENT_MISSING_TEMPLATE=5002]="COMPONENT_MISSING_TEMPLATE",e[e.COMPONENT_LIFECYCLE_ERROR=5003]="COMPONENT_LIFECYCLE_ERROR",e[e.ROUTE_NOT_FOUND=6001]="ROUTE_NOT_FOUND",e[e.ROUTE_DUPLICATE=6002]="ROUTE_DUPLICATE",e[e.NAVIGATION_ABORTED=6003]="NAVIGATION_ABORTED",e[e.NAVIGATION_FAILED=6004]="NAVIGATION_FAILED",e[e.STORE_NOT_FOUND=7001]="STORE_NOT_FOUND",e[e.STORE_DUPLICATE=7002]="STORE_DUPLICATE",e))(N||{});var a=class extends Error{constructor(o,t,i){let s=`[Lyt ${o}] ${t}`;super(s),this.name="LytError",this.code=o,this.details=i}};var _=class _{constructor(o){this.errors=[],this.options=o||{},this._hasError=!1}get hasError(){return this._hasError}static setGlobalHandler(o){_.globalHandler=o}capture(o,t,i){var p;let s={error:o,vm:t,info:i||"",timestamp:Date.now()};this.errors.push(s),this._hasError=!0;let c=(p=this.options.maxErrors)!=null?p:100;this.errors.length>c&&this.errors.splice(0,this.errors.length-c),!(this.options.onErrorCaptured&&this.options.onErrorCaptured(o instanceof a?o:new a(1004,o.message),t,s.info)===!0)&&this.options.onError&&this.options.onError(o instanceof a?o:new a(1004,o.message),t)}getFallback(o){if(!this.options.fallback||this.errors.length===0)return null;let t=this.errors[this.errors.length-1];return this.options.fallback(t.error,t.vm,t.info)}getErrors(){return this.errors.slice()}getErrorCount(){return this.errors.length}getLastErrors(){return this.errors.length===0?null:{...this.errors[this.errors.length-1]}}clear(){this.errors=[],this._hasError=!1}};_.globalHandler=null;var R=_,O=!0,T=new Set;function g(r){O=r}function f(){return O}function A(r){}function l(r){O&&(T.has(r)||T.add(r))}function u(){T.clear()}var S={1001:r=>`\u53C2\u6570 "${r}" \u65E0\u6548\u3002\u8BF7\u68C0\u67E5\u4F20\u5165\u7684\u503C\u7C7B\u578B\u548C\u8303\u56F4\u3002`,1002:r=>`"${r}" \u672A\u627E\u5230\u3002\u8BF7\u786E\u8BA4\u8D44\u6E90\u540D\u79F0\u6216\u8DEF\u5F84\u662F\u5426\u6B63\u786E\u3002`,1003:r=>`"${r}" \u5DF2\u5B58\u5728\u3002\u8BF7\u4F7F\u7528\u4E0D\u540C\u7684\u540D\u79F0\u3002`,1004:r=>`\u64CD\u4F5C "${r}" \u6267\u884C\u5931\u8D25\u3002\u8BF7\u68C0\u67E5\u76F8\u5173\u914D\u7F6E\u548C\u72B6\u6001\u3002`,2001:r=>`\u65E0\u6CD5\u4FEE\u6539\u53EA\u8BFB\u54CD\u5E94\u5F0F\u5C5E\u6027 "${r}"\u3002\u53EA\u8BFB\u5BF9\u8C61\u4E0D\u5141\u8BB8\u76F4\u63A5\u8D4B\u503C\u3002`,2002:()=>"\u526F\u4F5C\u7528\u51FD\u6570\u5DF2\u88AB\u9500\u6BC1\uFF0C\u65E0\u6CD5\u518D\u6B21\u6267\u884C\u3002\u8BF7\u521B\u5EFA\u65B0\u7684\u526F\u4F5C\u7528\u3002",2003:()=>"\u8BA1\u7B97\u5C5E\u6027\u68C0\u6D4B\u5230\u5FAA\u73AF\u4F9D\u8D56\u3002\u8BF7\u68C0\u67E5 computed \u51FD\u6570\u662F\u5426\u5F15\u7528\u4E86\u81EA\u8EAB\u3002",3001:r=>`\u6A21\u677F\u89E3\u6790\u9519\u8BEF\uFF1A${r}\u3002\u8BF7\u68C0\u67E5\u6A21\u677F\u8BED\u6CD5\u662F\u5426\u6B63\u786E\u3002`,3002:r=>`\u65E0\u6548\u7684\u8868\u8FBE\u5F0F "${r}"\u3002\u8BF7\u68C0\u67E5\u8868\u8FBE\u5F0F\u8BED\u6CD5\u3002`,3003:r=>`\u65E0\u6548\u7684\u6307\u4EE4 "${r}"\u3002\u8BF7\u786E\u8BA4\u6307\u4EE4\u540D\u79F0\u662F\u5426\u6B63\u786E\u3002`,3004:r=>`\u65E0\u6548\u7684\u6A21\u677F\uFF1A${r}\u3002\u8BF7\u68C0\u67E5\u6A21\u677F\u5185\u5BB9\u3002`,4001:r=>`\u6E32\u67D3\u9519\u8BEF\uFF1A${r}\u3002\u8BF7\u68C0\u67E5\u7EC4\u4EF6\u7684 render \u51FD\u6570\u6216\u6A21\u677F\u3002`,4002:r=>`\u6C34\u5408\u4E0D\u5339\u914D\uFF1A${r}\u3002\u670D\u52A1\u7AEF\u6E32\u67D3\u4E0E\u5BA2\u6237\u7AEF\u6E32\u67D3\u7ED3\u679C\u4E0D\u4E00\u81F4\u3002`,4003:r=>`\u65E0\u6548\u7684\u865A\u62DF\u8282\u70B9\uFF1A${r}\u3002VNode \u7F3A\u5C11\u5FC5\u8981\u7684 type \u6216\u5176\u4ED6\u5C5E\u6027\u3002`,5001:r=>`\u7EC4\u4EF6\u5C5E\u6027\u65E0\u6548\uFF1A${r}\u3002\u8BF7\u68C0\u67E5\u4F20\u5165\u7684 props \u662F\u5426\u7B26\u5408\u7EC4\u4EF6\u5B9A\u4E49\u3002`,5002:r=>`\u7EC4\u4EF6 "${r}" \u7F3A\u5C11 template \u6216 render \u51FD\u6570\u3002\u8BF7\u786E\u4FDD\u7EC4\u4EF6\u5B9A\u4E49\u4E2D\u5305\u542B template \u5B57\u7B26\u4E32\u6216 render \u65B9\u6CD5\u3002`,5003:r=>`\u7EC4\u4EF6\u751F\u547D\u5468\u671F\u9519\u8BEF\uFF1A${r}\u3002\u8BF7\u68C0\u67E5\u751F\u547D\u5468\u671F\u94A9\u5B50\u51FD\u6570\u3002`,6001:r=>`\u8DEF\u7531 "${r}" \u672A\u627E\u5230\u3002\u8BF7\u786E\u8BA4\u8DEF\u7531\u8DEF\u5F84\u662F\u5426\u5DF2\u6CE8\u518C\u3002`,6002:r=>`\u8DEF\u7531 "${r}" \u5DF2\u5B58\u5728\u3002\u8BF7\u907F\u514D\u91CD\u590D\u6CE8\u518C\u76F8\u540C\u7684\u8DEF\u7531\u8DEF\u5F84\u3002`,6003:r=>`\u5BFC\u822A\u88AB\u4E2D\u6B62\uFF1A${r}\u3002\u53EF\u80FD\u88AB\u5BFC\u822A\u5B88\u536B\u62E6\u622A\u3002`,6004:r=>`\u5BFC\u822A\u5931\u8D25\uFF1A${r}\u3002\u8BF7\u68C0\u67E5\u76EE\u6807\u8DEF\u7531\u662F\u5426\u6709\u6548\u3002`,7001:r=>`Store "${r}" \u672A\u627E\u5230\u3002\u8BF7\u786E\u8BA4 store \u662F\u5426\u5DF2\u6CE8\u518C\u3002`,7002:r=>`Store "${r}" \u5DF2\u5B58\u5728\u3002\u8BF7\u907F\u514D\u91CD\u590D\u521B\u5EFA\u76F8\u540C ID \u7684 store\u3002`};function C(r,...o){let t=S[r];if(t){let i=t(...o);return`[Lyt ${r}] ${i}`}return`[Lyt ${r}] \u672A\u77E5\u9519\u8BEF\u3002`}function D(r,o,t){R.globalHandler&&R.globalHandler(r,o,t||""),O&&r instanceof a&&r.details}function L(r,o){try{return r()}catch(t){D(t instanceof Error?t:new Error(String(t)),o);return}}var n=require("@lytjs/common");var E=require("@lytjs/common");
|
package/dist/error-entry.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var 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};
|
|
1
|
+
var T=(e=>(e[e.INVALID_ARGUMENT=1001]="INVALID_ARGUMENT",e[e.NOT_FOUND=1002]="NOT_FOUND",e[e.ALREADY_EXISTS=1003]="ALREADY_EXISTS",e[e.OPERATION_FAILED=1004]="OPERATION_FAILED",e[e.REACTIVE_READONLY=2001]="REACTIVE_READONLY",e[e.REACTIVE_EFFECT_DISPOSED=2002]="REACTIVE_EFFECT_DISPOSED",e[e.COMPUTED_CYCLE=2003]="COMPUTED_CYCLE",e[e.PARSE_ERROR=3001]="PARSE_ERROR",e[e.INVALID_EXPRESSION=3002]="INVALID_EXPRESSION",e[e.INVALID_DIRECTIVE=3003]="INVALID_DIRECTIVE",e[e.INVALID_TEMPLATE=3004]="INVALID_TEMPLATE",e[e.RENDER_ERROR=4001]="RENDER_ERROR",e[e.HYDRATION_MISMATCH=4002]="HYDRATION_MISMATCH",e[e.INVALID_VNODE=4003]="INVALID_VNODE",e[e.COMPONENT_INVALID_PROPS=5001]="COMPONENT_INVALID_PROPS",e[e.COMPONENT_MISSING_TEMPLATE=5002]="COMPONENT_MISSING_TEMPLATE",e[e.COMPONENT_LIFECYCLE_ERROR=5003]="COMPONENT_LIFECYCLE_ERROR",e[e.ROUTE_NOT_FOUND=6001]="ROUTE_NOT_FOUND",e[e.ROUTE_DUPLICATE=6002]="ROUTE_DUPLICATE",e[e.NAVIGATION_ABORTED=6003]="NAVIGATION_ABORTED",e[e.NAVIGATION_FAILED=6004]="NAVIGATION_FAILED",e[e.STORE_NOT_FOUND=7001]="STORE_NOT_FOUND",e[e.STORE_DUPLICATE=7002]="STORE_DUPLICATE",e))(T||{});var n=class extends Error{constructor(o,t,E){let i=`[Lyt ${o}] ${t}`;super(i),this.name="LytError",this.code=o,this.details=E}};var R=class R{constructor(o){this.errors=[],this.options=o||{},this._hasError=!1}get hasError(){return this._hasError}static setGlobalHandler(o){R.globalHandler=o}capture(o,t,E){var I;let i={error:o,vm:t,info:E||"",timestamp:Date.now()};this.errors.push(i),this._hasError=!0;let _=(I=this.options.maxErrors)!=null?I:100;this.errors.length>_&&this.errors.splice(0,this.errors.length-_),!(this.options.onErrorCaptured&&this.options.onErrorCaptured(o instanceof n?o:new n(1004,o.message),t,i.info)===!0)&&this.options.onError&&this.options.onError(o instanceof n?o:new n(1004,o.message),t)}getFallback(o){if(!this.options.fallback||this.errors.length===0)return null;let t=this.errors[this.errors.length-1];return this.options.fallback(t.error,t.vm,t.info)}getErrors(){return this.errors.slice()}getErrorCount(){return this.errors.length}getLastErrors(){return this.errors.length===0?null:{...this.errors[this.errors.length-1]}}clear(){this.errors=[],this._hasError=!1}};R.globalHandler=null;var s=R,a=!0,O=new Set;function D(r){a=r}function c(){return a}function N(r){}function A(r){a&&(O.has(r)||O.add(r))}function p(){O.clear()}var g={1001:r=>`\u53C2\u6570 "${r}" \u65E0\u6548\u3002\u8BF7\u68C0\u67E5\u4F20\u5165\u7684\u503C\u7C7B\u578B\u548C\u8303\u56F4\u3002`,1002:r=>`"${r}" \u672A\u627E\u5230\u3002\u8BF7\u786E\u8BA4\u8D44\u6E90\u540D\u79F0\u6216\u8DEF\u5F84\u662F\u5426\u6B63\u786E\u3002`,1003:r=>`"${r}" \u5DF2\u5B58\u5728\u3002\u8BF7\u4F7F\u7528\u4E0D\u540C\u7684\u540D\u79F0\u3002`,1004:r=>`\u64CD\u4F5C "${r}" \u6267\u884C\u5931\u8D25\u3002\u8BF7\u68C0\u67E5\u76F8\u5173\u914D\u7F6E\u548C\u72B6\u6001\u3002`,2001:r=>`\u65E0\u6CD5\u4FEE\u6539\u53EA\u8BFB\u54CD\u5E94\u5F0F\u5C5E\u6027 "${r}"\u3002\u53EA\u8BFB\u5BF9\u8C61\u4E0D\u5141\u8BB8\u76F4\u63A5\u8D4B\u503C\u3002`,2002:()=>"\u526F\u4F5C\u7528\u51FD\u6570\u5DF2\u88AB\u9500\u6BC1\uFF0C\u65E0\u6CD5\u518D\u6B21\u6267\u884C\u3002\u8BF7\u521B\u5EFA\u65B0\u7684\u526F\u4F5C\u7528\u3002",2003:()=>"\u8BA1\u7B97\u5C5E\u6027\u68C0\u6D4B\u5230\u5FAA\u73AF\u4F9D\u8D56\u3002\u8BF7\u68C0\u67E5 computed \u51FD\u6570\u662F\u5426\u5F15\u7528\u4E86\u81EA\u8EAB\u3002",3001:r=>`\u6A21\u677F\u89E3\u6790\u9519\u8BEF\uFF1A${r}\u3002\u8BF7\u68C0\u67E5\u6A21\u677F\u8BED\u6CD5\u662F\u5426\u6B63\u786E\u3002`,3002:r=>`\u65E0\u6548\u7684\u8868\u8FBE\u5F0F "${r}"\u3002\u8BF7\u68C0\u67E5\u8868\u8FBE\u5F0F\u8BED\u6CD5\u3002`,3003:r=>`\u65E0\u6548\u7684\u6307\u4EE4 "${r}"\u3002\u8BF7\u786E\u8BA4\u6307\u4EE4\u540D\u79F0\u662F\u5426\u6B63\u786E\u3002`,3004:r=>`\u65E0\u6548\u7684\u6A21\u677F\uFF1A${r}\u3002\u8BF7\u68C0\u67E5\u6A21\u677F\u5185\u5BB9\u3002`,4001:r=>`\u6E32\u67D3\u9519\u8BEF\uFF1A${r}\u3002\u8BF7\u68C0\u67E5\u7EC4\u4EF6\u7684 render \u51FD\u6570\u6216\u6A21\u677F\u3002`,4002:r=>`\u6C34\u5408\u4E0D\u5339\u914D\uFF1A${r}\u3002\u670D\u52A1\u7AEF\u6E32\u67D3\u4E0E\u5BA2\u6237\u7AEF\u6E32\u67D3\u7ED3\u679C\u4E0D\u4E00\u81F4\u3002`,4003:r=>`\u65E0\u6548\u7684\u865A\u62DF\u8282\u70B9\uFF1A${r}\u3002VNode \u7F3A\u5C11\u5FC5\u8981\u7684 type \u6216\u5176\u4ED6\u5C5E\u6027\u3002`,5001:r=>`\u7EC4\u4EF6\u5C5E\u6027\u65E0\u6548\uFF1A${r}\u3002\u8BF7\u68C0\u67E5\u4F20\u5165\u7684 props \u662F\u5426\u7B26\u5408\u7EC4\u4EF6\u5B9A\u4E49\u3002`,5002:r=>`\u7EC4\u4EF6 "${r}" \u7F3A\u5C11 template \u6216 render \u51FD\u6570\u3002\u8BF7\u786E\u4FDD\u7EC4\u4EF6\u5B9A\u4E49\u4E2D\u5305\u542B template \u5B57\u7B26\u4E32\u6216 render \u65B9\u6CD5\u3002`,5003:r=>`\u7EC4\u4EF6\u751F\u547D\u5468\u671F\u9519\u8BEF\uFF1A${r}\u3002\u8BF7\u68C0\u67E5\u751F\u547D\u5468\u671F\u94A9\u5B50\u51FD\u6570\u3002`,6001:r=>`\u8DEF\u7531 "${r}" \u672A\u627E\u5230\u3002\u8BF7\u786E\u8BA4\u8DEF\u7531\u8DEF\u5F84\u662F\u5426\u5DF2\u6CE8\u518C\u3002`,6002:r=>`\u8DEF\u7531 "${r}" \u5DF2\u5B58\u5728\u3002\u8BF7\u907F\u514D\u91CD\u590D\u6CE8\u518C\u76F8\u540C\u7684\u8DEF\u7531\u8DEF\u5F84\u3002`,6003:r=>`\u5BFC\u822A\u88AB\u4E2D\u6B62\uFF1A${r}\u3002\u53EF\u80FD\u88AB\u5BFC\u822A\u5B88\u536B\u62E6\u622A\u3002`,6004:r=>`\u5BFC\u822A\u5931\u8D25\uFF1A${r}\u3002\u8BF7\u68C0\u67E5\u76EE\u6807\u8DEF\u7531\u662F\u5426\u6709\u6548\u3002`,7001:r=>`Store "${r}" \u672A\u627E\u5230\u3002\u8BF7\u786E\u8BA4 store \u662F\u5426\u5DF2\u6CE8\u518C\u3002`,7002:r=>`Store "${r}" \u5DF2\u5B58\u5728\u3002\u8BF7\u907F\u514D\u91CD\u590D\u521B\u5EFA\u76F8\u540C ID \u7684 store\u3002`};function f(r,...o){let t=g[r];if(t){let E=t(...o);return`[Lyt ${r}] ${E}`}return`[Lyt ${r}] \u672A\u77E5\u9519\u8BEF\u3002`}function l(r,o,t){s.globalHandler&&s.globalHandler(r,o,t||""),a&&r instanceof n&&r.details}function u(r,o){try{return r()}catch(t){l(t instanceof Error?t:new Error(String(t)),o);return}}import{LytErrorCodes as C,ErrorCategory as L,getErrorMessage as P,getCategory as m}from"@lytjs/common";import{LytError as h,createCompilerError as d,createRendererError as M,createComponentError as y}from"@lytjs/common";export{s as ErrorBoundary,L as ErrorCategory,n as LytError,T as LytErrorCodes,h as NewLytError,C as NewLytErrorCodes,u as callWithErrorHandling,d as createCompilerError,y as createComponentError,f as createMessage,M as createRendererError,m as getCategory,c as getDevMode,P as getErrorMessage,l as handleError,p as resetWarnedMessages,D as setDevMode,N as warn,A as warnOnce,A as warnOnceUtil,N as warnUtil};
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1,2 @@
|
|
|
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}
|
|
1
|
+
var k=Object.defineProperty;var ee=Object.getOwnPropertyDescriptor;var te=Object.getOwnPropertyNames;var ne=Object.prototype.hasOwnProperty;var re=(e,t)=>{for(var n in t)k(e,n,{get:t[n],enumerable:!0})},w=(e,t,n,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let l of te(t))!ne.call(e,l)&&l!==n&&k(e,l,{get:()=>t[l],enumerable:!(a=ee(t,l))||a.enumerable});return e},b=(e,t,n)=>(w(e,t,"default"),n&&w(n,t,"default"));var oe=e=>w(k({},"__esModule",{value:!0}),e);var C={};re(C,{ErrorBoundary:()=>I,Fragment:()=>H,LytError:()=>N,ShapeFlags:()=>$,createApp:()=>z,defineCustomElement:()=>V,defineCustomElementFromSFC:()=>J,h:()=>A,handleError:()=>X,installPlugin:()=>D,isBrowser:()=>M,registerComponents:()=>K,uninstallPlugin:()=>L,unregisterElement:()=>Z});module.exports=oe(C);var T=require("@lytjs/common"),$=(d=>(d[d.ELEMENT=1]="ELEMENT",d[d.FUNCTIONAL_COMPONENT=2]="FUNCTIONAL_COMPONENT",d[d.STATEFUL_COMPONENT=4]="STATEFUL_COMPONENT",d[d.TEXT_CHILDREN=8]="TEXT_CHILDREN",d[d.ARRAY_CHILDREN=16]="ARRAY_CHILDREN",d[d.SLOTS_CHILDREN=32]="SLOTS_CHILDREN",d))($||{}),H=Symbol("Fragment");function ie(e,t){if(t!=null)if((0,T.isStringOrNumber)(t))e.children=String(t),e.shapeFlag|=8;else if((0,T.isArray)(t)){let n=[];for(let a=0;a<t.length;a++){let l=t[a];if(!(l==null||typeof l=="boolean"))if((0,T.isArray)(l))for(let y=0;y<l.length;y++){let d=l[y];d!=null&&typeof d!="boolean"&&n.push((0,T.isVNode)(d)?d:U(String(d)))}else(0,T.isVNode)(l)?n.push(l):n.push(U(String(l)))}e.children=n,e.shapeFlag|=16}else typeof t=="object"&&(e.children=t,e.shapeFlag|=32)}function U(e,t=null,n=null){var m,E;let a=0;typeof e=="string"?a=1:e===H?a=0:typeof e=="function"?a=2:typeof e=="object"&&e!==null&&(e.setup||e.__vccOpts||e.render)&&(a=4);let l=(m=t==null?void 0:t.key)!=null?m:null,y=(E=t==null?void 0:t.ref)!=null?E:null,d=t;if(t){let{key:h,ref:r,...i}=t;d=i}let g={type:e,props:d,children:null,key:l,ref:y,shapeFlag:a,el:null,component:null};return n!=null&&ie(g,n),g}function A(e,t,n){return U(e,t||null,n||null)}var P=require("@lytjs/common");function B(e){return Object.create(e||null)}function Y(e){return e!==null&&typeof e=="object"&&typeof e.install=="function"}function W(e){return typeof e=="function"}function D(e,t,...n){if(Y(t)){let a=t.onBeforeInstall?t.onBeforeInstall(e,...n):void 0;if((0,P.isPromise)(a))return a.then(()=>{let l=t.install(e,...n);if((0,P.isPromise)(l))return l.then(()=>{if(t.onInstalled)return t.onInstalled(e,...n)});if(t.onInstalled)return t.onInstalled(e,...n)});{let l=t.install(e,...n);if((0,P.isPromise)(l))return l.then(()=>{if(t.onInstalled)return t.onInstalled(e,...n)});if(t.onInstalled)return t.onInstalled(e,...n)}}else if(W(t))return t(e,...n)}function L(e,t){if(Y(t)){if(typeof t.uninstall=="function")return t.uninstall(e)}else W(t)}var x=require("@lytjs/reactivity"),G=require("@lytjs/compiler"),R=require("@lytjs/component"),q=require("@lytjs/renderer"),se=100,v=new Map;function ae(e){let t=v.get(e);if(t)return v.delete(e),v.set(e,t),t;let{code:n}=(0,G.compile)(e);if(t=new Function("h","_ctx",`return ${n}`),v.size>=se){let a=v.keys().next().value;v.delete(a)}return v.set(e,t),t}function le(e){let t={...e};if(e.state&&typeof e.state!="function"){let n=e.state;t.state=()=>({...n})}if(typeof e.render=="function"){let n=e.render;t.render=(a,l)=>n(a)}if(e.computed){let n={};for(let a of Object.keys(e.computed)){let l=e.computed[a];typeof l=="function"?n[a]={get:l}:n[a]=l}t.computed=n}if(typeof e.init=="function"){let n=e.init;t.init=function(a,l){return n.call(this,a)}}return t}function ce(){return{createElement(e){return document.createElement(e)},createText(e){return document.createTextNode(e)},createComment(e){return document.createComment(e)},setAttribute(e,t,n){e.setAttribute(t,String(n))},removeAttribute(e,t){e.removeAttribute(t)},setStyle(e,t){if(typeof t=="string")e.style.cssText=t;else if(t&&typeof t=="object")for(let n in t)e.style[n]=t[n]},setClass(e,t){if(typeof t=="string")e.className=t;else if(t&&typeof t=="object"){let n=[];for(let[a,l]of Object.entries(t))l&&n.push(a);e.className=n.join(" ")}else e.className=""},insert(e,t,n){n!=null?e.insertBefore(t,n):e.appendChild(t)},remove(e){e.parentNode&&e.parentNode.removeChild(e)},replace(e,t,n){e.replaceChild(n,t)},addEventListener(e,t,n,a){e.addEventListener(t,n,a)},removeEventListener(e,t,n){e.removeEventListener(t,n)},nextTick(e){Promise.resolve().then(e)},parentNode(e){return e.parentNode},nextSibling(e){return e.nextSibling},querySelector(e){return document.querySelector(e)}}}function z(e,t){let n=new Set,a={},l={},y=B(),d={},g={},m=null,E=null,h=null,r=null,i=!1,o=le(typeof e=="function"?{render:e}:e),u=(0,R.defineComponent)(o),s={config:d,globalProperties:g,get _instance(){return m},mount(f){if(i)return s;let p;if(typeof f=="string"){if(p=document.querySelector(f),!p)throw new Error(`[Lyt] \u627E\u4E0D\u5230\u6302\u8F7D\u76EE\u6807: "${f}"`)}else p=f;r=p;let _=ce();E=(0,q.createRenderer)(_),m=(0,R.createComponentInstance)(u),(0,R.setupComponent)(m,t||{},null);let O=m.type;if(!O.render&&O.template){let F=ae(O.template);O.render=(j,Q)=>F(j,Q.renderProxy)}return(0,R.mountComponent)(m,A),m.subTree&&E.mount(m.subTree,p),h=(0,x.effect)(()=>{if(!(!m||!m.isMounted||!E)&&((0,R.updateComponent)(m,A),m.subTree&&r)){let F=r.firstChild,j=m.subTree;r.innerHTML="",E.mount(j,r)}},{lazy:!0}),i=!0,s},unmount(){i&&(h&&((0,x.stop)(h),h=null),m&&(0,R.unmountComponent)(m),r&&(r.innerHTML=""),m=null,E=null,r=null,i=!1)},use(f,...p){if(n.has(f))return s;n.add(f);let _=D({use:s.use.bind(s),unuse:s.unuse.bind(s),isInstalled:s.isInstalled.bind(s),provide:s.provide.bind(s),inject:s.inject.bind(s),config:d,globalProperties:g},f,...p);return _ instanceof Promise?_.then(()=>s):s},unuse(f){if(!n.has(f))return s;n.delete(f);let p=L({use:s.use.bind(s),unuse:s.unuse.bind(s),isInstalled:s.isInstalled.bind(s),provide:s.provide.bind(s),inject:s.inject.bind(s),config:d,globalProperties:g},f);return p instanceof Promise?p.then(()=>s):s},isInstalled(f){return n.has(f)},provide(f,p){return y[f]=p,s},inject(f,p){let _=y[f];return _!==void 0?_:p},component(f,p){return p?(a[f]=p,s):a[f]},directive(f,p){return p?(l[f]=p,s):l[f]}};return s}var N=class extends Error{constructor(t,n,a){let l=`[Lyt ${t}] ${n}`;super(l),this.name="LytError",this.code=t,this.details=a}};var S=class S{constructor(t){this.errors=[],this.options=t||{},this._hasError=!1}get hasError(){return this._hasError}static setGlobalHandler(t){S.globalHandler=t}capture(t,n,a){var d;let l={error:t,vm:n,info:a||"",timestamp:Date.now()};this.errors.push(l),this._hasError=!0;let y=(d=this.options.maxErrors)!=null?d:100;this.errors.length>y&&this.errors.splice(0,this.errors.length-y),!(this.options.onErrorCaptured&&this.options.onErrorCaptured(t instanceof N?t:new N(1004,t.message),n,l.info)===!0)&&this.options.onError&&this.options.onError(t instanceof N?t:new N(1004,t.message),n)}getFallback(t){if(!this.options.fallback||this.errors.length===0)return null;let n=this.errors[this.errors.length-1];return this.options.fallback(n.error,n.vm,n.info)}getErrors(){return this.errors.slice()}getErrorCount(){return this.errors.length}getLastErrors(){return this.errors.length===0?null:{...this.errors[this.errors.length-1]}}clear(){this.errors=[],this._hasError=!1}};S.globalHandler=null;var I=S,ue=!0;function X(e,t,n){I.globalHandler&&I.globalHandler(e,t,n||""),ue&&e instanceof N&&e.details}function M(){return typeof window!="undefined"&&typeof document!="undefined"&&typeof HTMLElement!="undefined"&&typeof customElements!="undefined"}function de(e){return e.replace(/-([a-z])/g,(t,n)=>n.toUpperCase())}function fe(e){if(e===""||e==="true")return!0;if(e==="false")return!1;if(e==="null")return null;if(e==="undefined")return;let t=Number(e);if(!isNaN(t)&&e.trim()!=="")return t;if(e.startsWith("{")&&e.endsWith("}")||e.startsWith("[")&&e.endsWith("]"))try{return JSON.parse(e)}catch(n){}return e}function pe(e,t){return t&&t[e]?t[e]:de(e)}function me(e){let t=[],n=e;if(n.emits&&(Array.isArray(n.emits)?t.push(...n.emits):typeof n.emits=="object"&&t.push(...Object.keys(n.emits))),n.methods){for(let a of Object.keys(n.methods))if(a.startsWith("on")&&a.length>2){let l=a.charAt(2).toLowerCase()+a.slice(3);t.push(l)}}return t}function ye(e,t={}){let{shadowMode:n="open",styles:a="",propMappings:l,eventMappings:y={},attributeConverters:d={}}=t,g=t.observedAttributes||[],m=me(e);return class extends HTMLElement{constructor(){super();this._shadowRoot=null;this._instance=null;this._props={};this._container=null;this._connected=!1;this._eventCleanups=[];this._effectCleanup=null;this._updateScheduled=!1}static get observedAttributes(){return g}connectedCallback(){if(!this._connected){if(this._connected=!0,this._shadowRoot=this.attachShadow({mode:n}),a){let r=document.createElement("style");r.textContent=a,this._shadowRoot.appendChild(r)}this._container=document.createElement("div"),this._shadowRoot.appendChild(this._container),this._syncAttributesToProps(),this._mountComponent(),this._forwardSlots()}}disconnectedCallback(){if(this._connected){this._connected=!1;for(let r of this._eventCleanups)r();this._eventCleanups=[],this._effectCleanup&&(this._effectCleanup(),this._effectCleanup=null),this._instance=null,this._container&&(this._container.innerHTML="")}}attributeChangedCallback(r,i,c){i!==c&&this._connected&&(this._syncAttributesToProps(),this._updateComponent())}_syncAttributesToProps(){let r={};for(let i of g)if(this.hasAttribute(i)){let c=this.getAttribute(i),o=pe(i,l);d[i]?r[o]=d[i](c):r[o]=fe(c)}if(e.props){for(let[i,c]of Object.entries(e.props))if(r[i]===void 0){let o=c;o&&typeof o=="object"&&"default"in o?r[i]=typeof o.default=="function"?o.default():o.default:o==null}}this._props=r}_mountComponent(){let r=e.render?e.render:e.template?this._compileTemplate(e.template):null;if(!r)return;let i=this._createComponentContext(),c=r.call(i,A,i);c&&this._container&&this._renderVNode(c,this._container),this._setupReactiveUpdates(i,r)}_compileTemplate(r){try{let i=Function("return require")(),{compile:c}=i("../../compiler/src/index.ts"),{code:o}=c(r);return new Function("h","_ctx",`return ${o}`)}catch(i){return null}}_createComponentContext(){let r=e.state?typeof e.state=="function"?e.state():{...e.state}:{},i=e.computed||{},c=e.methods||{},o={...this._props,...r};for(let[u,s]of Object.entries(i))typeof s=="function"?Object.defineProperty(o,u,{get:s.bind(o),enumerable:!0}):s&&typeof s=="object"&&"get"in s&&Object.defineProperty(o,u,{get:s.get.bind(o),enumerable:!0});for(let[u,s]of Object.entries(c))typeof s=="function"&&(o[u]=s.bind(o));return o.emit=(u,...s)=>{let f=y[u]||u,p=new CustomEvent(f,{detail:s.length===1?s[0]:s,bubbles:!0,composed:!0});this.dispatchEvent(p)},o.$el=this._container,o.$attrs={...this._props},o.$slots=this._getSlotContent(),o}_setupReactiveUpdates(r,i){try{let c=Function("return require")(),{effect:o,stop:u}=c("../../reactivity/src/index.ts"),s=o(()=>{if(!this._connected||!this._container)return;let p=i.call(r,A,r);p&&(this._container.innerHTML="",this._renderVNode(p,this._container))},{lazy:!0}),f=e.state?typeof e.state=="function"?Object.keys(e.state()):Object.keys(e.state):[];for(let p of f){let _=r[p];Object.defineProperty(r,p,{get(){return _},set(O){_=O;try{s()}catch(F){}},enumerable:!0})}this._effectCleanup=()=>{try{u(s)}catch(p){}}}catch(c){let o=e.state?typeof e.state=="function"?Object.keys(e.state()):Object.keys(e.state):[];for(let u of o){let f=r[u],p=this;Object.defineProperty(r,u,{get(){return f},set(_){f=_,p._scheduleUpdate(r,i)},enumerable:!0})}}}_scheduleUpdate(r,i){this._updateScheduled||(this._updateScheduled=!0,Promise.resolve().then(()=>{if(this._updateScheduled=!1,!this._connected||!this._container)return;let c=i.call(r,A,r);c&&(this._container.innerHTML="",this._renderVNode(c,this._container))}))}_updateComponent(){if(!this._container)return;let r=e.render?e.render:e.template?this._compileTemplate(e.template):null;if(!r)return;let i=this._createComponentContext(),c=r.call(i,A,i);this._container.innerHTML="",c&&this._renderVNode(c,this._container)}_renderVNode(r,i){let c=this._vNodeToElement(r);c&&i.appendChild(c)}_vNodeToElement(r){if(!r)return null;if(typeof r.type=="symbol"){let i=document.createDocumentFragment();if(Array.isArray(r.children))for(let c of r.children){let o=this._vNodeToElement(c);o&&i.appendChild(o)}return i}if(typeof r.children=="string")return document.createTextNode(r.children);if(typeof r.type=="string"){let i=document.createElement(r.type);if(r.props)for(let[c,o]of Object.entries(r.props))if(c==="style"&&typeof o=="object")for(let[u,s]of Object.entries(o))i.style[u]=s;else if(c==="class"){if(typeof o=="string")i.className=o;else if(typeof o=="object"){let u=[];for(let[s,f]of Object.entries(o))f&&u.push(s);i.className=u.join(" ")}}else if(c.startsWith("on")&&typeof o=="function"){let u=c.slice(2).toLowerCase();i.addEventListener(u,o),this._eventCleanups.push(()=>{i.removeEventListener(u,o)})}else c==="ref"&&typeof o=="function"?o(i):i.setAttribute(c,String(o));if(Array.isArray(r.children))for(let c of r.children){let o=this._vNodeToElement(c);o&&i.appendChild(o)}else typeof r.children=="string"&&(i.textContent=r.children);return i}return typeof r.type=="object"||typeof r.type=="function"?r.component?this._vNodeToElement(r.component.subTree||r):document.createComment("component"):null}_forwardSlots(){if(!this._shadowRoot||!this._container)return;let r=this.querySelectorAll("[slot]");for(let c of r){let o=c.getAttribute("slot")||"default",u=document.createElement("slot");o!=="default"&&u.setAttribute("name",o),this._container.appendChild(u)}let i=document.createElement("slot");this._container.appendChild(i)}_getSlotContent(){var o;let r={},i=this.querySelectorAll("[slot]");for(let u of i){let s=u.getAttribute("slot")||"default";r[s]||(r[s]=[]),r[s].push(u.cloneNode(!0))}let c=[];for(let u of Array.from(this.childNodes))(o=u.hasAttribute)!=null&&o.call(u,"slot")||c.push(u.cloneNode(!0));return c.length>0&&(r.default=c),r}get _lytInstance(){return this._instance}get _lytProps(){return{...this._props}}}}function V(e,t,n){if(!e.includes("-"))throw new Error(`[Lyt Web Component] \u6807\u7B7E\u540D "${e}" \u5FC5\u987B\u5305\u542B\u8FDE\u5B57\u7B26 (-)\u3002\u8FD9\u662F Custom Element \u89C4\u8303\u7684\u8981\u6C42\u3002`);if(!M())return;let a=ye(t,n);customElements.define(e,a)}function K(e){for(let{tagName:t,component:n,options:a}of e)V(t,n,a)}function Z(e){if(M())try{let t=customElements;t.__unregister&&t.__unregister(e)}catch(t){}}async function J(e,t,n){let a=t.match(/<template>([\s\S]*?)<\/template>/),l=t.match(/<script[^>]*>([\s\S]*?)<\/script>/),y=/<style[^>]*>([\s\S]*?)<\/style>/g,d=[],g;for(;(g=y.exec(t))!==null;)d.push(g);let m=(n==null?void 0:n.styles)||"";for(let i of d)m+=i[1]+`
|
|
2
|
+
`;let E=a?a[1].trim():void 0,h={};if(l){let i=l[1].trim();if(i.match(/export\s+default\s*(\{[\s\S]*\}|\([\s\S]*\)[\s\S]*?\))/))try{let o={},u={exports:o};new Function("module","exports",`"use strict"; ${i.replace(/export\s+default\s*/,"module.exports =")}`)(u,o),h=u.exports||o}catch(o){}}let r={...n,styles:m};E&&!h.template&&!h.render&&(h.template=E),V(e,h,r)}b(C,require("@lytjs/common"),module.exports);
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1,2 @@
|
|
|
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};
|
|
1
|
+
import{isStringOrNumber as H,isArray as M,isVNode as V}from"@lytjs/common";var F=(d=>(d[d.ELEMENT=1]="ELEMENT",d[d.FUNCTIONAL_COMPONENT=2]="FUNCTIONAL_COMPONENT",d[d.STATEFUL_COMPONENT=4]="STATEFUL_COMPONENT",d[d.TEXT_CHILDREN=8]="TEXT_CHILDREN",d[d.ARRAY_CHILDREN=16]="ARRAY_CHILDREN",d[d.SLOTS_CHILDREN=32]="SLOTS_CHILDREN",d))(F||{}),j=Symbol("Fragment");function B(e,t){if(t!=null)if(H(t))e.children=String(t),e.shapeFlag|=8;else if(M(t)){let n=[];for(let a=0;a<t.length;a++){let c=t[a];if(!(c==null||typeof c=="boolean"))if(M(c))for(let y=0;y<c.length;y++){let d=c[y];d!=null&&typeof d!="boolean"&&n.push(V(d)?d:I(String(d)))}else V(c)?n.push(c):n.push(I(String(c)))}e.children=n,e.shapeFlag|=16}else typeof t=="object"&&(e.children=t,e.shapeFlag|=32)}function I(e,t=null,n=null){var m,E;let a=0;typeof e=="string"?a=1:e===j?a=0:typeof e=="function"?a=2:typeof e=="object"&&e!==null&&(e.setup||e.__vccOpts||e.render)&&(a=4);let c=(m=t==null?void 0:t.key)!=null?m:null,y=(E=t==null?void 0:t.ref)!=null?E:null,d=t;if(t){let{key:h,ref:r,...i}=t;d=i}let g={type:e,props:d,children:null,key:c,ref:y,shapeFlag:a,el:null,component:null};return n!=null&&B(g,n),g}function R(e,t,n){return I(e,t||null,n||null)}import{isPromise as P}from"@lytjs/common";function w(e){return Object.create(e||null)}function k(e){return e!==null&&typeof e=="object"&&typeof e.install=="function"}function U(e){return typeof e=="function"}function D(e,t,...n){if(k(t)){let a=t.onBeforeInstall?t.onBeforeInstall(e,...n):void 0;if(P(a))return a.then(()=>{let c=t.install(e,...n);if(P(c))return c.then(()=>{if(t.onInstalled)return t.onInstalled(e,...n)});if(t.onInstalled)return t.onInstalled(e,...n)});{let c=t.install(e,...n);if(P(c))return c.then(()=>{if(t.onInstalled)return t.onInstalled(e,...n)});if(t.onInstalled)return t.onInstalled(e,...n)}}else if(U(t))return t(e,...n)}function L(e,t){if(k(t)){if(typeof t.uninstall=="function")return t.uninstall(e)}else U(t)}import{effect as Y,stop as W}from"@lytjs/reactivity";import{compile as G}from"@lytjs/compiler";import{defineComponent as q,createComponentInstance as z,setupComponent as X,mountComponent as K,updateComponent as Z,unmountComponent as J}from"@lytjs/component";import{createRenderer as Q}from"@lytjs/renderer";var ee=100,A=new Map;function te(e){let t=A.get(e);if(t)return A.delete(e),A.set(e,t),t;let{code:n}=G(e);if(t=new Function("h","_ctx",`return ${n}`),A.size>=ee){let a=A.keys().next().value;A.delete(a)}return A.set(e,t),t}function ne(e){let t={...e};if(e.state&&typeof e.state!="function"){let n=e.state;t.state=()=>({...n})}if(typeof e.render=="function"){let n=e.render;t.render=(a,c)=>n(a)}if(e.computed){let n={};for(let a of Object.keys(e.computed)){let c=e.computed[a];typeof c=="function"?n[a]={get:c}:n[a]=c}t.computed=n}if(typeof e.init=="function"){let n=e.init;t.init=function(a,c){return n.call(this,a)}}return t}function re(){return{createElement(e){return document.createElement(e)},createText(e){return document.createTextNode(e)},createComment(e){return document.createComment(e)},setAttribute(e,t,n){e.setAttribute(t,String(n))},removeAttribute(e,t){e.removeAttribute(t)},setStyle(e,t){if(typeof t=="string")e.style.cssText=t;else if(t&&typeof t=="object")for(let n in t)e.style[n]=t[n]},setClass(e,t){if(typeof t=="string")e.className=t;else if(t&&typeof t=="object"){let n=[];for(let[a,c]of Object.entries(t))c&&n.push(a);e.className=n.join(" ")}else e.className=""},insert(e,t,n){n!=null?e.insertBefore(t,n):e.appendChild(t)},remove(e){e.parentNode&&e.parentNode.removeChild(e)},replace(e,t,n){e.replaceChild(n,t)},addEventListener(e,t,n,a){e.addEventListener(t,n,a)},removeEventListener(e,t,n){e.removeEventListener(t,n)},nextTick(e){Promise.resolve().then(e)},parentNode(e){return e.parentNode},nextSibling(e){return e.nextSibling},querySelector(e){return document.querySelector(e)}}}function oe(e,t){let n=new Set,a={},c={},y=w(),d={},g={},m=null,E=null,h=null,r=null,i=!1,o=ne(typeof e=="function"?{render:e}:e),u=q(o),s={config:d,globalProperties:g,get _instance(){return m},mount(f){if(i)return s;let p;if(typeof f=="string"){if(p=document.querySelector(f),!p)throw new Error(`[Lyt] \u627E\u4E0D\u5230\u6302\u8F7D\u76EE\u6807: "${f}"`)}else p=f;r=p;let _=re();E=Q(_),m=z(u),X(m,t||{},null);let b=m.type;if(!b.render&&b.template){let v=te(b.template);b.render=(O,$)=>v(O,$.renderProxy)}return K(m,R),m.subTree&&E.mount(m.subTree,p),h=Y(()=>{if(!(!m||!m.isMounted||!E)&&(Z(m,R),m.subTree&&r)){let v=r.firstChild,O=m.subTree;r.innerHTML="",E.mount(O,r)}},{lazy:!0}),i=!0,s},unmount(){i&&(h&&(W(h),h=null),m&&J(m),r&&(r.innerHTML=""),m=null,E=null,r=null,i=!1)},use(f,...p){if(n.has(f))return s;n.add(f);let _=D({use:s.use.bind(s),unuse:s.unuse.bind(s),isInstalled:s.isInstalled.bind(s),provide:s.provide.bind(s),inject:s.inject.bind(s),config:d,globalProperties:g},f,...p);return _ instanceof Promise?_.then(()=>s):s},unuse(f){if(!n.has(f))return s;n.delete(f);let p=L({use:s.use.bind(s),unuse:s.unuse.bind(s),isInstalled:s.isInstalled.bind(s),provide:s.provide.bind(s),inject:s.inject.bind(s),config:d,globalProperties:g},f);return p instanceof Promise?p.then(()=>s):s},isInstalled(f){return n.has(f)},provide(f,p){return y[f]=p,s},inject(f,p){let _=y[f];return _!==void 0?_:p},component(f,p){return p?(a[f]=p,s):a[f]},directive(f,p){return p?(c[f]=p,s):c[f]}};return s}var C=class extends Error{constructor(t,n,a){let c=`[Lyt ${t}] ${n}`;super(c),this.name="LytError",this.code=t,this.details=a}};var T=class T{constructor(t){this.errors=[],this.options=t||{},this._hasError=!1}get hasError(){return this._hasError}static setGlobalHandler(t){T.globalHandler=t}capture(t,n,a){var d;let c={error:t,vm:n,info:a||"",timestamp:Date.now()};this.errors.push(c),this._hasError=!0;let y=(d=this.options.maxErrors)!=null?d:100;this.errors.length>y&&this.errors.splice(0,this.errors.length-y),!(this.options.onErrorCaptured&&this.options.onErrorCaptured(t instanceof C?t:new C(1004,t.message),n,c.info)===!0)&&this.options.onError&&this.options.onError(t instanceof C?t:new C(1004,t.message),n)}getFallback(t){if(!this.options.fallback||this.errors.length===0)return null;let n=this.errors[this.errors.length-1];return this.options.fallback(n.error,n.vm,n.info)}getErrors(){return this.errors.slice()}getErrorCount(){return this.errors.length}getLastErrors(){return this.errors.length===0?null:{...this.errors[this.errors.length-1]}}clear(){this.errors=[],this._hasError=!1}};T.globalHandler=null;var N=T,ie=!0;function se(e,t,n){N.globalHandler&&N.globalHandler(e,t,n||""),ie&&e instanceof C&&e.details}function x(){return typeof window!="undefined"&&typeof document!="undefined"&&typeof HTMLElement!="undefined"&&typeof customElements!="undefined"}function ae(e){return e.replace(/-([a-z])/g,(t,n)=>n.toUpperCase())}function le(e){if(e===""||e==="true")return!0;if(e==="false")return!1;if(e==="null")return null;if(e==="undefined")return;let t=Number(e);if(!isNaN(t)&&e.trim()!=="")return t;if(e.startsWith("{")&&e.endsWith("}")||e.startsWith("[")&&e.endsWith("]"))try{return JSON.parse(e)}catch(n){}return e}function ce(e,t){return t&&t[e]?t[e]:ae(e)}function ue(e){let t=[],n=e;if(n.emits&&(Array.isArray(n.emits)?t.push(...n.emits):typeof n.emits=="object"&&t.push(...Object.keys(n.emits))),n.methods){for(let a of Object.keys(n.methods))if(a.startsWith("on")&&a.length>2){let c=a.charAt(2).toLowerCase()+a.slice(3);t.push(c)}}return t}function de(e,t={}){let{shadowMode:n="open",styles:a="",propMappings:c,eventMappings:y={},attributeConverters:d={}}=t,g=t.observedAttributes||[],m=ue(e);return class extends HTMLElement{constructor(){super();this._shadowRoot=null;this._instance=null;this._props={};this._container=null;this._connected=!1;this._eventCleanups=[];this._effectCleanup=null;this._updateScheduled=!1}static get observedAttributes(){return g}connectedCallback(){if(!this._connected){if(this._connected=!0,this._shadowRoot=this.attachShadow({mode:n}),a){let r=document.createElement("style");r.textContent=a,this._shadowRoot.appendChild(r)}this._container=document.createElement("div"),this._shadowRoot.appendChild(this._container),this._syncAttributesToProps(),this._mountComponent(),this._forwardSlots()}}disconnectedCallback(){if(this._connected){this._connected=!1;for(let r of this._eventCleanups)r();this._eventCleanups=[],this._effectCleanup&&(this._effectCleanup(),this._effectCleanup=null),this._instance=null,this._container&&(this._container.innerHTML="")}}attributeChangedCallback(r,i,l){i!==l&&this._connected&&(this._syncAttributesToProps(),this._updateComponent())}_syncAttributesToProps(){let r={};for(let i of g)if(this.hasAttribute(i)){let l=this.getAttribute(i),o=ce(i,c);d[i]?r[o]=d[i](l):r[o]=le(l)}if(e.props){for(let[i,l]of Object.entries(e.props))if(r[i]===void 0){let o=l;o&&typeof o=="object"&&"default"in o?r[i]=typeof o.default=="function"?o.default():o.default:o==null}}this._props=r}_mountComponent(){let r=e.render?e.render:e.template?this._compileTemplate(e.template):null;if(!r)return;let i=this._createComponentContext(),l=r.call(i,R,i);l&&this._container&&this._renderVNode(l,this._container),this._setupReactiveUpdates(i,r)}_compileTemplate(r){try{let i=Function("return require")(),{compile:l}=i("../../compiler/src/index.ts"),{code:o}=l(r);return new Function("h","_ctx",`return ${o}`)}catch(i){return null}}_createComponentContext(){let r=e.state?typeof e.state=="function"?e.state():{...e.state}:{},i=e.computed||{},l=e.methods||{},o={...this._props,...r};for(let[u,s]of Object.entries(i))typeof s=="function"?Object.defineProperty(o,u,{get:s.bind(o),enumerable:!0}):s&&typeof s=="object"&&"get"in s&&Object.defineProperty(o,u,{get:s.get.bind(o),enumerable:!0});for(let[u,s]of Object.entries(l))typeof s=="function"&&(o[u]=s.bind(o));return o.emit=(u,...s)=>{let f=y[u]||u,p=new CustomEvent(f,{detail:s.length===1?s[0]:s,bubbles:!0,composed:!0});this.dispatchEvent(p)},o.$el=this._container,o.$attrs={...this._props},o.$slots=this._getSlotContent(),o}_setupReactiveUpdates(r,i){try{let l=Function("return require")(),{effect:o,stop:u}=l("../../reactivity/src/index.ts"),s=o(()=>{if(!this._connected||!this._container)return;let p=i.call(r,R,r);p&&(this._container.innerHTML="",this._renderVNode(p,this._container))},{lazy:!0}),f=e.state?typeof e.state=="function"?Object.keys(e.state()):Object.keys(e.state):[];for(let p of f){let _=r[p];Object.defineProperty(r,p,{get(){return _},set(b){_=b;try{s()}catch(v){}},enumerable:!0})}this._effectCleanup=()=>{try{u(s)}catch(p){}}}catch(l){let o=e.state?typeof e.state=="function"?Object.keys(e.state()):Object.keys(e.state):[];for(let u of o){let f=r[u],p=this;Object.defineProperty(r,u,{get(){return f},set(_){f=_,p._scheduleUpdate(r,i)},enumerable:!0})}}}_scheduleUpdate(r,i){this._updateScheduled||(this._updateScheduled=!0,Promise.resolve().then(()=>{if(this._updateScheduled=!1,!this._connected||!this._container)return;let l=i.call(r,R,r);l&&(this._container.innerHTML="",this._renderVNode(l,this._container))}))}_updateComponent(){if(!this._container)return;let r=e.render?e.render:e.template?this._compileTemplate(e.template):null;if(!r)return;let i=this._createComponentContext(),l=r.call(i,R,i);this._container.innerHTML="",l&&this._renderVNode(l,this._container)}_renderVNode(r,i){let l=this._vNodeToElement(r);l&&i.appendChild(l)}_vNodeToElement(r){if(!r)return null;if(typeof r.type=="symbol"){let i=document.createDocumentFragment();if(Array.isArray(r.children))for(let l of r.children){let o=this._vNodeToElement(l);o&&i.appendChild(o)}return i}if(typeof r.children=="string")return document.createTextNode(r.children);if(typeof r.type=="string"){let i=document.createElement(r.type);if(r.props)for(let[l,o]of Object.entries(r.props))if(l==="style"&&typeof o=="object")for(let[u,s]of Object.entries(o))i.style[u]=s;else if(l==="class"){if(typeof o=="string")i.className=o;else if(typeof o=="object"){let u=[];for(let[s,f]of Object.entries(o))f&&u.push(s);i.className=u.join(" ")}}else if(l.startsWith("on")&&typeof o=="function"){let u=l.slice(2).toLowerCase();i.addEventListener(u,o),this._eventCleanups.push(()=>{i.removeEventListener(u,o)})}else l==="ref"&&typeof o=="function"?o(i):i.setAttribute(l,String(o));if(Array.isArray(r.children))for(let l of r.children){let o=this._vNodeToElement(l);o&&i.appendChild(o)}else typeof r.children=="string"&&(i.textContent=r.children);return i}return typeof r.type=="object"||typeof r.type=="function"?r.component?this._vNodeToElement(r.component.subTree||r):document.createComment("component"):null}_forwardSlots(){if(!this._shadowRoot||!this._container)return;let r=this.querySelectorAll("[slot]");for(let l of r){let o=l.getAttribute("slot")||"default",u=document.createElement("slot");o!=="default"&&u.setAttribute("name",o),this._container.appendChild(u)}let i=document.createElement("slot");this._container.appendChild(i)}_getSlotContent(){var o;let r={},i=this.querySelectorAll("[slot]");for(let u of i){let s=u.getAttribute("slot")||"default";r[s]||(r[s]=[]),r[s].push(u.cloneNode(!0))}let l=[];for(let u of Array.from(this.childNodes))(o=u.hasAttribute)!=null&&o.call(u,"slot")||l.push(u.cloneNode(!0));return l.length>0&&(r.default=l),r}get _lytInstance(){return this._instance}get _lytProps(){return{...this._props}}}}function S(e,t,n){if(!e.includes("-"))throw new Error(`[Lyt Web Component] \u6807\u7B7E\u540D "${e}" \u5FC5\u987B\u5305\u542B\u8FDE\u5B57\u7B26 (-)\u3002\u8FD9\u662F Custom Element \u89C4\u8303\u7684\u8981\u6C42\u3002`);if(!x())return;let a=de(t,n);customElements.define(e,a)}function fe(e){for(let{tagName:t,component:n,options:a}of e)S(t,n,a)}function pe(e){if(x())try{let t=customElements;t.__unregister&&t.__unregister(e)}catch(t){}}async function me(e,t,n){let a=t.match(/<template>([\s\S]*?)<\/template>/),c=t.match(/<script[^>]*>([\s\S]*?)<\/script>/),y=/<style[^>]*>([\s\S]*?)<\/style>/g,d=[],g;for(;(g=y.exec(t))!==null;)d.push(g);let m=(n==null?void 0:n.styles)||"";for(let i of d)m+=i[1]+`
|
|
2
|
+
`;let E=a?a[1].trim():void 0,h={};if(c){let i=c[1].trim();if(i.match(/export\s+default\s*(\{[\s\S]*\}|\([\s\S]*\)[\s\S]*?\))/))try{let o={},u={exports:o};new Function("module","exports",`"use strict"; ${i.replace(/export\s+default\s*/,"module.exports =")}`)(u,o),h=u.exports||o}catch(o){}}let r={...n,styles:m};E&&!h.template&&!h.render&&(h.template=E),S(e,h,r)}export*from"@lytjs/common";export{N as ErrorBoundary,j as Fragment,C as LytError,F as ShapeFlags,oe as createApp,S as defineCustomElement,me as defineCustomElementFromSFC,R as h,se as handleError,D as installPlugin,x as isBrowser,fe as registerComponents,L as uninstallPlugin,pe as unregisterElement};
|
package/dist/plugin-entry.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var a=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var g=Object.prototype.hasOwnProperty;var y=(n,e)=>{for(var t in e)a(n,t,{get:e[t],enumerable:!0})},A=(n,e,t,l)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of p(e))!g.call(n,i)&&i!==t&&a(n,i,{get:()=>e[i],enumerable:!(l=d(e,i))||l.enumerable});return n};var m=n=>A(a({},"__esModule",{value:!0}),n);var I={};y(I,{createProvidesContext:()=>u,getPluginName:()=>P,installPlugin:()=>c,isPluginFunction:()=>r,isPluginObject:()=>o,uninstallPlugin:()=>f});module.exports=m(I);var s=require("@lytjs/common");function u(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 P(n){return o(n)&&n.name||r(n)&&n.name?n.name:o(n)?"[PluginObject]":"[PluginFunction]"}function c(n,e,...t){if(o(e)){let l=e.onBeforeInstall?e.onBeforeInstall(n,...t):void 0;if((0,s.isPromise)(l))return l.then(()=>{let i=e.install(n,...t);if((0,s.isPromise)(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((0,s.isPromise)(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)}
|
package/dist/plugin-entry.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function a(n){return Object.create(n||null)}function o(n){return n!==null&&typeof n=="object"&&typeof n.install=="function"}function
|
|
1
|
+
import{isPromise as r}from"@lytjs/common";function a(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 u(n){return o(n)&&n.name||l(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(r(s))return s.then(()=>{let i=e.install(n,...t);if(r(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(r(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)}export{a as createProvidesContext,u as getPluginName,P as installPlugin,l as isPluginFunction,o as isPluginObject,c as uninstallPlugin};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var a=Object.defineProperty;var b=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var d=Object.prototype.hasOwnProperty;var p=(r,o,f,x)=>{if(o&&typeof o=="object"||typeof o=="function")for(let e of c(o))!d.call(r,e)&&e!==f&&a(r,e,{get:()=>o[e],enumerable:!(x=b(o,e))||x.enumerable});return r},t=(r,o,f)=>(p(r,o,"default"),f&&p(f,o,"default"));var g=r=>p(a({},"__esModule",{value:!0}),r);var m={};module.exports=g(m);t(m,require("@lytjs/common"),module.exports);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export*from"@lytjs/common";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-app.d.ts","sourceRoot":"","sources":["../../src/create-app.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAK,KAAK,KAAK,EAAuC,MAAM,KAAK,CAAC;AACzE,OAAO,EAIL,KAAK,MAAM,EACX,KAAK,SAAS,EACf,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"create-app.d.ts","sourceRoot":"","sources":["../../src/create-app.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAK,KAAK,KAAK,EAAuC,MAAM,KAAK,CAAC;AACzE,OAAO,EAIL,KAAK,MAAM,EACX,KAAK,SAAS,EACf,MAAM,UAAU,CAAC;AA6DlB;;;;;;;;GAQG;AACH,MAAM,WAAW,gBAAgB;IAC/B,WAAW;IACX,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,eAAe;IACf,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC5B,qBAAqB;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,CAAC,MAAM,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC;IAC1D,WAAW;IACX,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,CAAC,CAAC;IACrC,SAAS;IACT,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAC,CAAC;IAClD,YAAY;IACZ,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,yBAAyB;IACzB,MAAM,CAAC,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,KAAK,CAAC;IAC7B,wBAAwB;IACxB,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,GAAG,EAAE,GAAG,KAAK,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC;IAC7E,YAAY;IACZ,IAAI,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,IAAI,CAAC;IACvD,mBAAmB;IACnB,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,IAAI,CAAC;IAC9B,yBAAyB;IACzB,aAAa,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,IAAI,CAAC;IACpC,qBAAqB;IACrB,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,IAAI,CAAC;IAChC,UAAU;IACV,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACjC,cAAc;IACd,kBAAkB,CAAC,EAAE,IAAI,CAAC;CAC3B;AAED,WAAW;AACX,MAAM,WAAW,cAAc;IAC7B,eAAe;IACf,OAAO,CAAC,EAAE,CAAC,EAAE,EAAE,GAAG,EAAE,OAAO,EAAE,gBAAgB,KAAK,IAAI,CAAC;IACvD,iBAAiB;IACjB,WAAW,CAAC,EAAE,CAAC,EAAE,EAAE,GAAG,EAAE,OAAO,EAAE,gBAAgB,KAAK,IAAI,CAAC;IAC3D,iBAAiB;IACjB,OAAO,CAAC,EAAE,CAAC,EAAE,EAAE,GAAG,EAAE,OAAO,EAAE,gBAAgB,KAAK,IAAI,CAAC;IACvD,UAAU;IACV,YAAY,CAAC,EAAE,CAAC,EAAE,EAAE,GAAG,EAAE,OAAO,EAAE,gBAAgB,KAAK,IAAI,CAAC;IAC5D,UAAU;IACV,OAAO,CAAC,EAAE,CAAC,EAAE,EAAE,GAAG,EAAE,OAAO,EAAE,gBAAgB,KAAK,IAAI,CAAC;IACvD,UAAU;IACV,aAAa,CAAC,EAAE,CAAC,EAAE,EAAE,GAAG,EAAE,OAAO,EAAE,gBAAgB,KAAK,IAAI,CAAC;IAC7D,UAAU;IACV,SAAS,CAAC,EAAE,CAAC,EAAE,EAAE,GAAG,EAAE,OAAO,EAAE,gBAAgB,KAAK,IAAI,CAAC;CAC1D;AAED,aAAa;AACb,MAAM,WAAW,gBAAgB;IAC/B,UAAU;IACV,KAAK,EAAE,GAAG,CAAC;IACX,SAAS;IACT,QAAQ,EAAE,GAAG,CAAC;IACd,eAAe;IACf,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,YAAY;IACZ,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACnC,aAAa;IACb,QAAQ,EAAE,GAAG,CAAC;CACf;AAED,aAAa;AACb,MAAM,WAAW,GAAG;IAClB,WAAW;IACX,KAAK,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,GAAG,GAAG,CAAC;IACxC,WAAW;IACX,OAAO,IAAI,IAAI,CAAC;IAChB,yCAAyC;IACzC,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,EAAE,GAAG,EAAE,GAAG,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;IAC3D,yCAAyC;IACzC,KAAK,CAAC,MAAM,EAAE,MAAM,GAAG,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;IAC1C,gBAAgB;IAChB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC;IACrC,WAAW;IACX,OAAO,CAAC,CAAC,GAAG,GAAG,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,KAAK,EAAE,CAAC,GAAG,GAAG,CAAC;IACtD,WAAW;IACX,MAAM,CAAC,CAAC,GAAG,GAAG,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,YAAY,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC;IACvE,gBAAgB;IAChB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,gBAAgB,GAAG,GAAG,GAAG,gBAAgB,GAAG,SAAS,CAAC;IAC1F,gBAAgB;IAChB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,cAAc,GAAG,GAAG,GAAG,cAAc,GAAG,SAAS,CAAC;IACtF,WAAW;IACX,MAAM,EAAE,SAAS,CAAC;IAClB,WAAW;IACX,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACtC,cAAc;IACd,SAAS,EAAE,GAAG,CAAC;CAChB;AAiKD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,wBAAgB,SAAS,CACvB,aAAa,EAAE,gBAAgB,GAAG,CAAC,MAAM,KAAK,CAAC,EAC/C,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAC9B,GAAG,CAyVL"}
|
|
@@ -1,88 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Lyt.js 错误码系统
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* 纯原生零依赖 TypeScript 实现。
|
|
4
|
+
* 已移至 @lytjs/common
|
|
5
|
+
* 保持向后兼容性 - 重新导出自 @lytjs/common
|
|
7
6
|
*/
|
|
8
|
-
export
|
|
9
|
-
LYT_COMPILER_PARSE_ERROR = 1001,
|
|
10
|
-
LYT_COMPILER_INVALID_EXPRESSION = 1002,
|
|
11
|
-
LYT_COMPILER_INVALID_TEMPLATE = 1003,
|
|
12
|
-
LYT_COMPILER_INVALID_DIRECTIVE = 1004,
|
|
13
|
-
LYT_COMPILER_CODEGEN_ERROR = 1005,
|
|
14
|
-
LYT_COMPILER_SFC_PARSE_ERROR = 1006,
|
|
15
|
-
LYT_COMPILER_TRANSFORM_ERROR = 1007,
|
|
16
|
-
LYT_RENDERER_MOUNT_FAILED = 2001,
|
|
17
|
-
LYT_RENDERER_PATCH_FAILED = 2002,
|
|
18
|
-
LYT_RENDERER_HYDRATION_MISMATCH = 2003,
|
|
19
|
-
LYT_RENDERER_INVALID_VNODE = 2004,
|
|
20
|
-
LYT_RENDERER_UNMOUNT_FAILED = 2005,
|
|
21
|
-
LYT_COMPONENT_INVALID_PROPS = 3001,
|
|
22
|
-
LYT_COMPONENT_MISSING_RENDER = 3002,
|
|
23
|
-
LYT_COMPONENT_LIFECYCLE_ERROR = 3003,
|
|
24
|
-
LYT_COMPONENT_INVALID = 3004,
|
|
25
|
-
LYT_COMPONENT_EMIT_INVALID = 3005,
|
|
26
|
-
LYT_COMPONENT_RENDER_ERROR = 3006,
|
|
27
|
-
LYT_ROUTER_INVALID_ROUTE = 4001,
|
|
28
|
-
LYT_ROUTER_NAVIGATION_FAILED = 4002,
|
|
29
|
-
LYT_ROUTER_DUPLICATE_ROUTE = 4003,
|
|
30
|
-
LYT_ROUTER_NAVIGATION_ABORTED = 4004,
|
|
31
|
-
LYT_ROUTER_GUARD_ERROR = 4005,
|
|
32
|
-
LYT_STORE_ALREADY_EXISTS = 5001,
|
|
33
|
-
LYT_STORE_NOT_FOUND = 5002,
|
|
34
|
-
LYT_STORE_DISPOSED = 5003,
|
|
35
|
-
LYT_STORE_PATCH_ERROR = 5004,
|
|
36
|
-
LYT_REACTIVITY_READONLY_SET = 6001,
|
|
37
|
-
LYT_REACTIVITY_READONLY_DELETE = 6002,
|
|
38
|
-
LYT_REACTIVITY_EFFECT_ERROR = 6003,
|
|
39
|
-
LYT_REACTIVITY_COMPUTED_CYCLE = 6004,
|
|
40
|
-
LYT_REACTIVITY_EFFECT_DISPOSED = 6005,
|
|
41
|
-
LYT_CORE_PLUGIN_ERROR = 7001,
|
|
42
|
-
LYT_CORE_MOUNT_NO_CONTAINER = 7002,
|
|
43
|
-
LYT_CORE_ALREADY_MOUNTED = 7003,
|
|
44
|
-
LYT_CORE_INVALID_ARGUMENT = 7004,
|
|
45
|
-
LYT_CORE_NOT_FOUND = 7005,
|
|
46
|
-
LYT_CORE_ALREADY_EXISTS = 7006,
|
|
47
|
-
LYT_CORE_OPERATION_FAILED = 7007,
|
|
48
|
-
LYT_CLI_SCAFFOLD_FAILED = 8001,
|
|
49
|
-
LYT_CLI_BUILD_FAILED = 8002,
|
|
50
|
-
LYT_CLI_DEV_SERVER_ERROR = 8003,
|
|
51
|
-
LYT_CLI_CONFIG_INVALID = 8004,
|
|
52
|
-
LYT_CLI_HMR_CONNECTION_FAILED = 8005,
|
|
53
|
-
LYT_DEVTOOLS_CONNECTION_FAILED = 9001,
|
|
54
|
-
LYT_DEVTOOLS_PANEL_ERROR = 9002,
|
|
55
|
-
LYT_DEVTOOLS_PERF_OVERFLOW = 9003,
|
|
56
|
-
LYT_DEVTOOLS_COMPONENT_TREE_ERROR = 9004,
|
|
57
|
-
LYT_PLUGIN_INSTALL_FAILED = 10001,
|
|
58
|
-
LYT_PLUGIN_ALREADY_INSTALLED = 10002,
|
|
59
|
-
LYT_PLUGIN_INVALID = 10003,
|
|
60
|
-
LYT_PLUGIN_UNINSTALL_FAILED = 10004,
|
|
61
|
-
LYT_SSR_STREAM_ERROR = 11001,
|
|
62
|
-
LYT_SSR_SUSPENSE_TIMEOUT = 11002,
|
|
63
|
-
LYT_SSR_HYDRATION_ERROR = 11003,
|
|
64
|
-
LYT_SSR_ISLAND_ERROR = 11004
|
|
65
|
-
}
|
|
66
|
-
export declare const ErrorCategory: {
|
|
67
|
-
readonly COMPILER: "COMPILER";
|
|
68
|
-
readonly RENDERER: "RENDERER";
|
|
69
|
-
readonly COMPONENT: "COMPONENT";
|
|
70
|
-
readonly ROUTER: "ROUTER";
|
|
71
|
-
readonly STORE: "STORE";
|
|
72
|
-
readonly REACTIVITY: "REACTIVITY";
|
|
73
|
-
readonly CORE: "CORE";
|
|
74
|
-
readonly CLI: "CLI";
|
|
75
|
-
readonly DEVTOOLS: "DEVTOOLS";
|
|
76
|
-
readonly PLUGIN: "PLUGIN";
|
|
77
|
-
readonly SSR: "SSR";
|
|
78
|
-
};
|
|
79
|
-
export type ErrorCategoryType = (typeof ErrorCategory)[keyof typeof ErrorCategory];
|
|
80
|
-
/**
|
|
81
|
-
* 根据错误码获取人类可读的错误消息
|
|
82
|
-
*/
|
|
83
|
-
export declare function getErrorMessage(code: number): string;
|
|
84
|
-
/**
|
|
85
|
-
* 根据错误码获取错误分类
|
|
86
|
-
*/
|
|
87
|
-
export declare function getCategory(code: number): string;
|
|
7
|
+
export { LytErrorCodes, ErrorCategory, type ErrorCategoryType, getErrorMessage, getCategory, } from '@lytjs/common';
|
|
88
8
|
//# sourceMappingURL=error-codes.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error-codes.d.ts","sourceRoot":"","sources":["../../src/error-codes.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"error-codes.d.ts","sourceRoot":"","sources":["../../src/error-codes.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACL,aAAa,EACb,aAAa,EACb,KAAK,iBAAiB,EACtB,eAAe,EACf,WAAW,GACZ,MAAM,eAAe,CAAA"}
|
package/dist/types/h.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"h.d.ts","sourceRoot":"","sources":["../../src/h.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;
|
|
1
|
+
{"version":3,"file":"h.d.ts","sourceRoot":"","sources":["../../src/h.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAQH,sBAAsB;AACtB,0BAAkB,UAAU;IAC1B,qBAAqB;IACrB,OAAO,IAAI;IACX,YAAY;IACZ,oBAAoB,IAAI;IACxB,YAAY;IACZ,kBAAkB,IAAI;IACtB,cAAc;IACd,aAAa,IAAI;IACjB,aAAa;IACb,cAAc,KAAK;IACnB,aAAa;IACb,cAAc,KAAK;CACpB;AAED,sBAAsB;AACtB,MAAM,WAAW,KAAK;IACpB,kCAAkC;IAClC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;IAC/B,WAAW;IACX,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC;IAClC,UAAU;IACV,QAAQ,EAAE,MAAM,GAAG,KAAK,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC;IACxD,aAAa;IACb,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IAC5B,qBAAqB;IACrB,GAAG,EAAE,CAAC,CAAC,EAAE,EAAE,GAAG,KAAK,IAAI,CAAC,GAAG;QAAE,OAAO,EAAE,GAAG,CAAA;KAAE,GAAG,IAAI,CAAC;IACnD,WAAW;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,qBAAqB;IACrB,EAAE,EAAE,GAAG,CAAC;IACR,cAAc;IACd,SAAS,EAAE,GAAG,CAAC;CAChB;AAED,0BAA0B;AAC1B,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,MAAM,GAAG,KAAK,GAAG,QAAQ,EAAE,CAAC;AAE5D,uBAAuB;AACvB,MAAM,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC;AAM/C,yBAAyB;AACzB,eAAO,MAAM,QAAQ,eAAqB,CAAC;AA+H3C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,wBAAgB,CAAC,CACf,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,EAC9B,KAAK,CAAC,EAAE,KAAK,EACb,QAAQ,CAAC,EAAE,QAAQ,GAClB,KAAK,CAEP"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -9,4 +9,9 @@ export type { App, ComponentOptions, DirectiveHooks, DirectiveBinding, } from '.
|
|
|
9
9
|
export { h, Fragment } from './h';
|
|
10
10
|
export type { VNode, Children, Props, } from './h';
|
|
11
11
|
export { ShapeFlags } from './h';
|
|
12
|
+
export { installPlugin, uninstallPlugin } from './plugin';
|
|
13
|
+
export { LytError, ErrorBoundary, handleError } from './error-handling';
|
|
14
|
+
export { defineCustomElement, registerComponents, unregisterElement, isBrowser, defineCustomElementFromSFC, } from './web-component';
|
|
15
|
+
export type { CustomElementOptions, ComponentRegistration, } from './web-component';
|
|
16
|
+
export * from '@lytjs/common';
|
|
12
17
|
//# 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;AAKjC,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAKzD,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAKvE,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;AAOxB,cAAc,eAAe,CAAC"}
|
|
@@ -1,57 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Lyt.js LytError 错误类
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* 纯原生零依赖 TypeScript 实现。
|
|
4
|
+
* 已移至 @lytjs/common
|
|
5
|
+
* 保持向后兼容性 - 重新导出自 @lytjs/common
|
|
7
6
|
*/
|
|
8
|
-
|
|
9
|
-
/** 源代码位置 */
|
|
10
|
-
export interface SourceLocation {
|
|
11
|
-
/** 文件名 */
|
|
12
|
-
file?: string;
|
|
13
|
-
/** 行号(从 1 开始) */
|
|
14
|
-
line?: number;
|
|
15
|
-
/** 列号(从 1 开始) */
|
|
16
|
-
column?: number;
|
|
17
|
-
/** 源代码片段 */
|
|
18
|
-
source?: string;
|
|
19
|
-
}
|
|
20
|
-
export declare class LytError extends Error {
|
|
21
|
-
/** 错误码 */
|
|
22
|
-
code: LytErrorCodes;
|
|
23
|
-
/** 错误分类 */
|
|
24
|
-
category: string;
|
|
25
|
-
/** 附加详情 */
|
|
26
|
-
details?: any;
|
|
27
|
-
/** 源代码位置 */
|
|
28
|
-
loc?: SourceLocation;
|
|
29
|
-
constructor(code: LytErrorCodes, message?: string, details?: any);
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* 创建编译器错误(带源位置信息)
|
|
33
|
-
*
|
|
34
|
-
* @param code 错误码
|
|
35
|
-
* @param loc 源代码位置
|
|
36
|
-
* @param message 自定义消息(可选)
|
|
37
|
-
*/
|
|
38
|
-
export declare function createCompilerError(code: LytErrorCodes, loc?: SourceLocation, message?: string): LytError;
|
|
39
|
-
/**
|
|
40
|
-
* 创建渲染器错误(带 VNode 上下文)
|
|
41
|
-
*
|
|
42
|
-
* @param code 错误码
|
|
43
|
-
* @param vnode 相关的 VNode(可选)
|
|
44
|
-
* @param message 自定义消息(可选)
|
|
45
|
-
*/
|
|
46
|
-
export declare function createRendererError(code: LytErrorCodes, vnode?: any, message?: string): LytError;
|
|
47
|
-
/**
|
|
48
|
-
* 创建组件错误(带组件名称)
|
|
49
|
-
*
|
|
50
|
-
* @param code 错误码
|
|
51
|
-
* @param component 组件名称或组件实例(可选)
|
|
52
|
-
* @param message 自定义消息(可选)
|
|
53
|
-
*/
|
|
54
|
-
export declare function createComponentError(code: LytErrorCodes, component?: string | {
|
|
55
|
-
name?: string;
|
|
56
|
-
}, message?: string): LytError;
|
|
7
|
+
export { LytError, type SourceLocation, createCompilerError, createRendererError, createComponentError, } from '@lytjs/common';
|
|
57
8
|
//# sourceMappingURL=lyt-error.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lyt-error.d.ts","sourceRoot":"","sources":["../../src/lyt-error.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"lyt-error.d.ts","sourceRoot":"","sources":["../../src/lyt-error.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACL,QAAQ,EACR,KAAK,cAAc,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,oBAAoB,GACrB,MAAM,eAAe,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../src/plugin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../src/plugin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAQH,yBAAyB;AACzB,MAAM,WAAW,YAAY;IAC3B,oBAAoB;IACpB,OAAO,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,OAAO,EAAE,GAAG,EAAE,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAClE,eAAe;IACf,SAAS,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAClD,gBAAgB;IAChB,eAAe,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,OAAO,EAAE,GAAG,EAAE,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3E,gBAAgB;IAChB,WAAW,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,OAAO,EAAE,GAAG,EAAE,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACvE,iBAAiB;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,oBAAoB;AACpB,MAAM,MAAM,MAAM,GAAG,YAAY,GAAG,CAAC,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,OAAO,EAAE,GAAG,EAAE,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;AAE/F,sBAAsB;AACtB,MAAM,WAAW,MAAM;IACrB,+CAA+C;IAC/C,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,EAAE,GAAG,EAAE,GAAG,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACjE,WAAW;IACX,KAAK,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAChD,gBAAgB;IAChB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC;IACrC,WAAW;IACX,OAAO,CAAC,CAAC,GAAG,GAAG,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,KAAK,EAAE,CAAC,GAAG,IAAI,CAAC;IACvD,WAAW;IACX,MAAM,CAAC,CAAC,GAAG,GAAG,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,YAAY,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC;IACvE,aAAa;IACb,MAAM,EAAE,SAAS,CAAC;IAClB,wBAAwB;IACxB,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CACvC;AAED,WAAW;AACX,MAAM,WAAW,SAAS;IACxB,aAAa;IACb,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;IACnB,YAAY;IACZ,YAAY,CAAC,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/D,YAAY;IACZ,WAAW,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACnE;AAMD;;;;;;;;;;GAUG;AACH,wBAAgB,qBAAqB,CACnC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,GAAG,MAAM,EAAE,GAAG,CAAC,GACpC,MAAM,CAAC,MAAM,GAAG,MAAM,EAAE,GAAG,CAAC,CAK9B;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,IAAI,YAAY,CAMrE;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,OAAO,EAAE,GAAG,EAAE,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAEnH;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAQpD;AAMD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,aAAa,CAC3B,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,MAAM,EACd,GAAG,OAAO,EAAE,GAAG,EAAE,GAChB,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CA6CtB;AAED;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAC7B,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,MAAM,GACb,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CActB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared-entry.d.ts","sourceRoot":"","sources":["../../src/shared-entry.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,cAAc,eAAe,CAAC"}
|
package/dist/types/warn.d.ts
CHANGED
|
@@ -1,32 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Lyt.js 警告与错误输出工具
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* 纯原生零依赖 TypeScript 实现。
|
|
4
|
+
* 已移至 @lytjs/common
|
|
5
|
+
* 保持向后兼容性 - 重新导出自 @lytjs/common
|
|
7
6
|
*/
|
|
8
|
-
|
|
9
|
-
* 设置开发/生产模式
|
|
10
|
-
*/
|
|
11
|
-
export declare function setDevMode(mode: boolean): void;
|
|
12
|
-
/**
|
|
13
|
-
* 获取当前是否为开发模式
|
|
14
|
-
*/
|
|
15
|
-
export declare function getDevMode(): boolean;
|
|
16
|
-
/**
|
|
17
|
-
* 仅开发模式输出警告
|
|
18
|
-
*/
|
|
19
|
-
export declare function warn(msg: string): void;
|
|
20
|
-
/**
|
|
21
|
-
* 每条消息只警告一次
|
|
22
|
-
*/
|
|
23
|
-
export declare function warnOnce(msg: string): void;
|
|
24
|
-
/**
|
|
25
|
-
* 始终输出错误信息(不受开发/生产模式限制)
|
|
26
|
-
*/
|
|
27
|
-
export declare function error(msg: string): void;
|
|
28
|
-
/**
|
|
29
|
-
* 重置已警告消息集合(仅用于测试)
|
|
30
|
-
*/
|
|
31
|
-
export declare function resetWarnedMessages(): void;
|
|
7
|
+
export { warn, warnOnce, error, setDevMode, getDevMode, resetWarnedMessages, } from '@lytjs/common';
|
|
32
8
|
//# sourceMappingURL=warn.d.ts.map
|
package/dist/types/warn.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"warn.d.ts","sourceRoot":"","sources":["../../src/warn.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"warn.d.ts","sourceRoot":"","sources":["../../src/warn.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACL,IAAI,EACJ,QAAQ,EACR,KAAK,EACL,UAAU,EACV,UAAU,EACV,mBAAmB,GACpB,MAAM,eAAe,CAAA"}
|
|
@@ -1,2 +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
|
|
1
|
+
var H=Object.defineProperty;var te=Object.getOwnPropertyDescriptor;var ne=Object.getOwnPropertyNames;var re=Object.prototype.hasOwnProperty;var G=(e,t)=>{for(var n in t)H(e,n,{get:t[n],enumerable:!0})},$=(e,t,n,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let l of ne(t))!re.call(e,l)&&l!==n&&H(e,l,{get:()=>t[l],enumerable:!(a=te(t,l))||a.enumerable});return e},N=(e,t,n)=>($(e,t,"default"),n&&$(n,t,"default"));var oe=e=>$(H({},"__esModule",{value:!0}),e);var ge={};G(ge,{defineCustomElement:()=>D,defineCustomElementFromSFC:()=>w,isBrowser:()=>P,registerComponents:()=>F,unregisterElement:()=>j});module.exports=oe(ge);var A={};G(A,{ErrorBoundary:()=>I,Fragment:()=>W,LytError:()=>b,ShapeFlags:()=>Y,createApp:()=>J,defineCustomElement:()=>D,defineCustomElementFromSFC:()=>w,h:()=>C,handleError:()=>Q,installPlugin:()=>x,isBrowser:()=>P,registerComponents:()=>F,uninstallPlugin:()=>S,unregisterElement:()=>j});var T=require("@lytjs/common"),Y=(d=>(d[d.ELEMENT=1]="ELEMENT",d[d.FUNCTIONAL_COMPONENT=2]="FUNCTIONAL_COMPONENT",d[d.STATEFUL_COMPONENT=4]="STATEFUL_COMPONENT",d[d.TEXT_CHILDREN=8]="TEXT_CHILDREN",d[d.ARRAY_CHILDREN=16]="ARRAY_CHILDREN",d[d.SLOTS_CHILDREN=32]="SLOTS_CHILDREN",d))(Y||{}),W=Symbol("Fragment");function ie(e,t){if(t!=null)if((0,T.isStringOrNumber)(t))e.children=String(t),e.shapeFlag|=8;else if((0,T.isArray)(t)){let n=[];for(let a=0;a<t.length;a++){let l=t[a];if(!(l==null||typeof l=="boolean"))if((0,T.isArray)(l))for(let y=0;y<l.length;y++){let d=l[y];d!=null&&typeof d!="boolean"&&n.push((0,T.isVNode)(d)?d:B(String(d)))}else(0,T.isVNode)(l)?n.push(l):n.push(B(String(l)))}e.children=n,e.shapeFlag|=16}else typeof t=="object"&&(e.children=t,e.shapeFlag|=32)}function B(e,t=null,n=null){var m,E;let a=0;typeof e=="string"?a=1:e===W?a=0:typeof e=="function"?a=2:typeof e=="object"&&e!==null&&(e.setup||e.__vccOpts||e.render)&&(a=4);let l=(m=t==null?void 0:t.key)!=null?m:null,y=(E=t==null?void 0:t.ref)!=null?E:null,d=t;if(t){let{key:h,ref:r,...i}=t;d=i}let g={type:e,props:d,children:null,key:l,ref:y,shapeFlag:a,el:null,component:null};return n!=null&&ie(g,n),g}function C(e,t,n){return B(e,t||null,n||null)}var L=require("@lytjs/common");function q(e){return Object.create(e||null)}function z(e){return e!==null&&typeof e=="object"&&typeof e.install=="function"}function X(e){return typeof e=="function"}function x(e,t,...n){if(z(t)){let a=t.onBeforeInstall?t.onBeforeInstall(e,...n):void 0;if((0,L.isPromise)(a))return a.then(()=>{let l=t.install(e,...n);if((0,L.isPromise)(l))return l.then(()=>{if(t.onInstalled)return t.onInstalled(e,...n)});if(t.onInstalled)return t.onInstalled(e,...n)});{let l=t.install(e,...n);if((0,L.isPromise)(l))return l.then(()=>{if(t.onInstalled)return t.onInstalled(e,...n)});if(t.onInstalled)return t.onInstalled(e,...n)}}else if(X(t))return t(e,...n)}function S(e,t){if(z(t)){if(typeof t.uninstall=="function")return t.uninstall(e)}else X(t)}var M=require("@lytjs/reactivity"),K=require("@lytjs/compiler"),R=require("@lytjs/component"),Z=require("@lytjs/renderer"),se=100,v=new Map;function ae(e){let t=v.get(e);if(t)return v.delete(e),v.set(e,t),t;let{code:n}=(0,K.compile)(e);if(t=new Function("h","_ctx",`return ${n}`),v.size>=se){let a=v.keys().next().value;v.delete(a)}return v.set(e,t),t}function le(e){let t={...e};if(e.state&&typeof e.state!="function"){let n=e.state;t.state=()=>({...n})}if(typeof e.render=="function"){let n=e.render;t.render=(a,l)=>n(a)}if(e.computed){let n={};for(let a of Object.keys(e.computed)){let l=e.computed[a];typeof l=="function"?n[a]={get:l}:n[a]=l}t.computed=n}if(typeof e.init=="function"){let n=e.init;t.init=function(a,l){return n.call(this,a)}}return t}function ce(){return{createElement(e){return document.createElement(e)},createText(e){return document.createTextNode(e)},createComment(e){return document.createComment(e)},setAttribute(e,t,n){e.setAttribute(t,String(n))},removeAttribute(e,t){e.removeAttribute(t)},setStyle(e,t){if(typeof t=="string")e.style.cssText=t;else if(t&&typeof t=="object")for(let n in t)e.style[n]=t[n]},setClass(e,t){if(typeof t=="string")e.className=t;else if(t&&typeof t=="object"){let n=[];for(let[a,l]of Object.entries(t))l&&n.push(a);e.className=n.join(" ")}else e.className=""},insert(e,t,n){n!=null?e.insertBefore(t,n):e.appendChild(t)},remove(e){e.parentNode&&e.parentNode.removeChild(e)},replace(e,t,n){e.replaceChild(n,t)},addEventListener(e,t,n,a){e.addEventListener(t,n,a)},removeEventListener(e,t,n){e.removeEventListener(t,n)},nextTick(e){Promise.resolve().then(e)},parentNode(e){return e.parentNode},nextSibling(e){return e.nextSibling},querySelector(e){return document.querySelector(e)}}}function J(e,t){let n=new Set,a={},l={},y=q(),d={},g={},m=null,E=null,h=null,r=null,i=!1,o=le(typeof e=="function"?{render:e}:e),u=(0,R.defineComponent)(o),s={config:d,globalProperties:g,get _instance(){return m},mount(f){if(i)return s;let p;if(typeof f=="string"){if(p=document.querySelector(f),!p)throw new Error(`[Lyt] \u627E\u4E0D\u5230\u6302\u8F7D\u76EE\u6807: "${f}"`)}else p=f;r=p;let _=ce();E=(0,Z.createRenderer)(_),m=(0,R.createComponentInstance)(u),(0,R.setupComponent)(m,t||{},null);let O=m.type;if(!O.render&&O.template){let k=ae(O.template);O.render=(U,ee)=>k(U,ee.renderProxy)}return(0,R.mountComponent)(m,C),m.subTree&&E.mount(m.subTree,p),h=(0,M.effect)(()=>{if(!(!m||!m.isMounted||!E)&&((0,R.updateComponent)(m,C),m.subTree&&r)){let k=r.firstChild,U=m.subTree;r.innerHTML="",E.mount(U,r)}},{lazy:!0}),i=!0,s},unmount(){i&&(h&&((0,M.stop)(h),h=null),m&&(0,R.unmountComponent)(m),r&&(r.innerHTML=""),m=null,E=null,r=null,i=!1)},use(f,...p){if(n.has(f))return s;n.add(f);let _=x({use:s.use.bind(s),unuse:s.unuse.bind(s),isInstalled:s.isInstalled.bind(s),provide:s.provide.bind(s),inject:s.inject.bind(s),config:d,globalProperties:g},f,...p);return _ instanceof Promise?_.then(()=>s):s},unuse(f){if(!n.has(f))return s;n.delete(f);let p=S({use:s.use.bind(s),unuse:s.unuse.bind(s),isInstalled:s.isInstalled.bind(s),provide:s.provide.bind(s),inject:s.inject.bind(s),config:d,globalProperties:g},f);return p instanceof Promise?p.then(()=>s):s},isInstalled(f){return n.has(f)},provide(f,p){return y[f]=p,s},inject(f,p){let _=y[f];return _!==void 0?_:p},component(f,p){return p?(a[f]=p,s):a[f]},directive(f,p){return p?(l[f]=p,s):l[f]}};return s}var b=class extends Error{constructor(t,n,a){let l=`[Lyt ${t}] ${n}`;super(l),this.name="LytError",this.code=t,this.details=a}};var V=class V{constructor(t){this.errors=[],this.options=t||{},this._hasError=!1}get hasError(){return this._hasError}static setGlobalHandler(t){V.globalHandler=t}capture(t,n,a){var d;let l={error:t,vm:n,info:a||"",timestamp:Date.now()};this.errors.push(l),this._hasError=!0;let y=(d=this.options.maxErrors)!=null?d:100;this.errors.length>y&&this.errors.splice(0,this.errors.length-y),!(this.options.onErrorCaptured&&this.options.onErrorCaptured(t instanceof b?t:new b(1004,t.message),n,l.info)===!0)&&this.options.onError&&this.options.onError(t instanceof b?t:new b(1004,t.message),n)}getFallback(t){if(!this.options.fallback||this.errors.length===0)return null;let n=this.errors[this.errors.length-1];return this.options.fallback(n.error,n.vm,n.info)}getErrors(){return this.errors.slice()}getErrorCount(){return this.errors.length}getLastErrors(){return this.errors.length===0?null:{...this.errors[this.errors.length-1]}}clear(){this.errors=[],this._hasError=!1}};V.globalHandler=null;var I=V,ue=!0;function Q(e,t,n){I.globalHandler&&I.globalHandler(e,t,n||""),ue&&e instanceof b&&e.details}N(A,require("@lytjs/common"));function P(){return typeof window!="undefined"&&typeof document!="undefined"&&typeof HTMLElement!="undefined"&&typeof customElements!="undefined"}function de(e){return e.replace(/-([a-z])/g,(t,n)=>n.toUpperCase())}function fe(e){if(e===""||e==="true")return!0;if(e==="false")return!1;if(e==="null")return null;if(e==="undefined")return;let t=Number(e);if(!isNaN(t)&&e.trim()!=="")return t;if(e.startsWith("{")&&e.endsWith("}")||e.startsWith("[")&&e.endsWith("]"))try{return JSON.parse(e)}catch(n){}return e}function pe(e,t){return t&&t[e]?t[e]:de(e)}function me(e){let t=[],n=e;if(n.emits&&(Array.isArray(n.emits)?t.push(...n.emits):typeof n.emits=="object"&&t.push(...Object.keys(n.emits))),n.methods){for(let a of Object.keys(n.methods))if(a.startsWith("on")&&a.length>2){let l=a.charAt(2).toLowerCase()+a.slice(3);t.push(l)}}return t}function ye(e,t={}){let{shadowMode:n="open",styles:a="",propMappings:l,eventMappings:y={},attributeConverters:d={}}=t,g=t.observedAttributes||[],m=me(e);return class extends HTMLElement{constructor(){super();this._shadowRoot=null;this._instance=null;this._props={};this._container=null;this._connected=!1;this._eventCleanups=[];this._effectCleanup=null;this._updateScheduled=!1}static get observedAttributes(){return g}connectedCallback(){if(!this._connected){if(this._connected=!0,this._shadowRoot=this.attachShadow({mode:n}),a){let r=document.createElement("style");r.textContent=a,this._shadowRoot.appendChild(r)}this._container=document.createElement("div"),this._shadowRoot.appendChild(this._container),this._syncAttributesToProps(),this._mountComponent(),this._forwardSlots()}}disconnectedCallback(){if(this._connected){this._connected=!1;for(let r of this._eventCleanups)r();this._eventCleanups=[],this._effectCleanup&&(this._effectCleanup(),this._effectCleanup=null),this._instance=null,this._container&&(this._container.innerHTML="")}}attributeChangedCallback(r,i,c){i!==c&&this._connected&&(this._syncAttributesToProps(),this._updateComponent())}_syncAttributesToProps(){let r={};for(let i of g)if(this.hasAttribute(i)){let c=this.getAttribute(i),o=pe(i,l);d[i]?r[o]=d[i](c):r[o]=fe(c)}if(e.props){for(let[i,c]of Object.entries(e.props))if(r[i]===void 0){let o=c;o&&typeof o=="object"&&"default"in o?r[i]=typeof o.default=="function"?o.default():o.default:o==null}}this._props=r}_mountComponent(){let r=e.render?e.render:e.template?this._compileTemplate(e.template):null;if(!r)return;let i=this._createComponentContext(),c=r.call(i,C,i);c&&this._container&&this._renderVNode(c,this._container),this._setupReactiveUpdates(i,r)}_compileTemplate(r){try{let i=Function("return require")(),{compile:c}=i("../../compiler/src/index.ts"),{code:o}=c(r);return new Function("h","_ctx",`return ${o}`)}catch(i){return null}}_createComponentContext(){let r=e.state?typeof e.state=="function"?e.state():{...e.state}:{},i=e.computed||{},c=e.methods||{},o={...this._props,...r};for(let[u,s]of Object.entries(i))typeof s=="function"?Object.defineProperty(o,u,{get:s.bind(o),enumerable:!0}):s&&typeof s=="object"&&"get"in s&&Object.defineProperty(o,u,{get:s.get.bind(o),enumerable:!0});for(let[u,s]of Object.entries(c))typeof s=="function"&&(o[u]=s.bind(o));return o.emit=(u,...s)=>{let f=y[u]||u,p=new CustomEvent(f,{detail:s.length===1?s[0]:s,bubbles:!0,composed:!0});this.dispatchEvent(p)},o.$el=this._container,o.$attrs={...this._props},o.$slots=this._getSlotContent(),o}_setupReactiveUpdates(r,i){try{let c=Function("return require")(),{effect:o,stop:u}=c("../../reactivity/src/index.ts"),s=o(()=>{if(!this._connected||!this._container)return;let p=i.call(r,C,r);p&&(this._container.innerHTML="",this._renderVNode(p,this._container))},{lazy:!0}),f=e.state?typeof e.state=="function"?Object.keys(e.state()):Object.keys(e.state):[];for(let p of f){let _=r[p];Object.defineProperty(r,p,{get(){return _},set(O){_=O;try{s()}catch(k){}},enumerable:!0})}this._effectCleanup=()=>{try{u(s)}catch(p){}}}catch(c){let o=e.state?typeof e.state=="function"?Object.keys(e.state()):Object.keys(e.state):[];for(let u of o){let f=r[u],p=this;Object.defineProperty(r,u,{get(){return f},set(_){f=_,p._scheduleUpdate(r,i)},enumerable:!0})}}}_scheduleUpdate(r,i){this._updateScheduled||(this._updateScheduled=!0,Promise.resolve().then(()=>{if(this._updateScheduled=!1,!this._connected||!this._container)return;let c=i.call(r,C,r);c&&(this._container.innerHTML="",this._renderVNode(c,this._container))}))}_updateComponent(){if(!this._container)return;let r=e.render?e.render:e.template?this._compileTemplate(e.template):null;if(!r)return;let i=this._createComponentContext(),c=r.call(i,C,i);this._container.innerHTML="",c&&this._renderVNode(c,this._container)}_renderVNode(r,i){let c=this._vNodeToElement(r);c&&i.appendChild(c)}_vNodeToElement(r){if(!r)return null;if(typeof r.type=="symbol"){let i=document.createDocumentFragment();if(Array.isArray(r.children))for(let c of r.children){let o=this._vNodeToElement(c);o&&i.appendChild(o)}return i}if(typeof r.children=="string")return document.createTextNode(r.children);if(typeof r.type=="string"){let i=document.createElement(r.type);if(r.props)for(let[c,o]of Object.entries(r.props))if(c==="style"&&typeof o=="object")for(let[u,s]of Object.entries(o))i.style[u]=s;else if(c==="class"){if(typeof o=="string")i.className=o;else if(typeof o=="object"){let u=[];for(let[s,f]of Object.entries(o))f&&u.push(s);i.className=u.join(" ")}}else if(c.startsWith("on")&&typeof o=="function"){let u=c.slice(2).toLowerCase();i.addEventListener(u,o),this._eventCleanups.push(()=>{i.removeEventListener(u,o)})}else c==="ref"&&typeof o=="function"?o(i):i.setAttribute(c,String(o));if(Array.isArray(r.children))for(let c of r.children){let o=this._vNodeToElement(c);o&&i.appendChild(o)}else typeof r.children=="string"&&(i.textContent=r.children);return i}return typeof r.type=="object"||typeof r.type=="function"?r.component?this._vNodeToElement(r.component.subTree||r):document.createComment("component"):null}_forwardSlots(){if(!this._shadowRoot||!this._container)return;let r=this.querySelectorAll("[slot]");for(let c of r){let o=c.getAttribute("slot")||"default",u=document.createElement("slot");o!=="default"&&u.setAttribute("name",o),this._container.appendChild(u)}let i=document.createElement("slot");this._container.appendChild(i)}_getSlotContent(){var o;let r={},i=this.querySelectorAll("[slot]");for(let u of i){let s=u.getAttribute("slot")||"default";r[s]||(r[s]=[]),r[s].push(u.cloneNode(!0))}let c=[];for(let u of Array.from(this.childNodes))(o=u.hasAttribute)!=null&&o.call(u,"slot")||c.push(u.cloneNode(!0));return c.length>0&&(r.default=c),r}get _lytInstance(){return this._instance}get _lytProps(){return{...this._props}}}}function D(e,t,n){if(!e.includes("-"))throw new Error(`[Lyt Web Component] \u6807\u7B7E\u540D "${e}" \u5FC5\u987B\u5305\u542B\u8FDE\u5B57\u7B26 (-)\u3002\u8FD9\u662F Custom Element \u89C4\u8303\u7684\u8981\u6C42\u3002`);if(!P())return;let a=ye(t,n);customElements.define(e,a)}function F(e){for(let{tagName:t,component:n,options:a}of e)D(t,n,a)}function j(e){if(P())try{let t=customElements;t.__unregister&&t.__unregister(e)}catch(t){}}async function w(e,t,n){let a=t.match(/<template>([\s\S]*?)<\/template>/),l=t.match(/<script[^>]*>([\s\S]*?)<\/script>/),y=/<style[^>]*>([\s\S]*?)<\/style>/g,d=[],g;for(;(g=y.exec(t))!==null;)d.push(g);let m=(n==null?void 0:n.styles)||"";for(let i of d)m+=i[1]+`
|
|
2
|
+
`;let E=a?a[1].trim():void 0,h={};if(l){let i=l[1].trim();if(i.match(/export\s+default\s*(\{[\s\S]*\}|\([\s\S]*\)[\s\S]*?\))/))try{let o={},u={exports:o};new Function("module","exports",`"use strict"; ${i.replace(/export\s+default\s*/,"module.exports =")}`)(u,o),h=u.exports||o}catch(o){}}let r={...n,styles:m};E&&!h.template&&!h.render&&(h.template=E),D(e,h,r)}
|
|
@@ -1,2 +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
|
|
1
|
+
var H=Object.defineProperty;var Z=Object.getOwnPropertyDescriptor;var J=Object.getOwnPropertyNames;var Q=Object.prototype.hasOwnProperty;var ee=(e,t)=>{for(var n in t)H(e,n,{get:t[n],enumerable:!0})},$=(e,t,n,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let l of J(t))!Q.call(e,l)&&l!==n&&H(e,l,{get:()=>t[l],enumerable:!(a=Z(t,l))||a.enumerable});return e},b=(e,t,n)=>($(e,t,"default"),n&&$(n,t,"default"));var C={};ee(C,{ErrorBoundary:()=>v,Fragment:()=>F,LytError:()=>A,ShapeFlags:()=>V,createApp:()=>z,defineCustomElement:()=>I,defineCustomElementFromSFC:()=>U,h:()=>R,handleError:()=>X,installPlugin:()=>P,isBrowser:()=>O,registerComponents:()=>w,uninstallPlugin:()=>D,unregisterElement:()=>k});import{isStringOrNumber as te,isArray as B,isVNode as Y}from"@lytjs/common";var V=(d=>(d[d.ELEMENT=1]="ELEMENT",d[d.FUNCTIONAL_COMPONENT=2]="FUNCTIONAL_COMPONENT",d[d.STATEFUL_COMPONENT=4]="STATEFUL_COMPONENT",d[d.TEXT_CHILDREN=8]="TEXT_CHILDREN",d[d.ARRAY_CHILDREN=16]="ARRAY_CHILDREN",d[d.SLOTS_CHILDREN=32]="SLOTS_CHILDREN",d))(V||{}),F=Symbol("Fragment");function ne(e,t){if(t!=null)if(te(t))e.children=String(t),e.shapeFlag|=8;else if(B(t)){let n=[];for(let a=0;a<t.length;a++){let l=t[a];if(!(l==null||typeof l=="boolean"))if(B(l))for(let y=0;y<l.length;y++){let d=l[y];d!=null&&typeof d!="boolean"&&n.push(Y(d)?d:M(String(d)))}else Y(l)?n.push(l):n.push(M(String(l)))}e.children=n,e.shapeFlag|=16}else typeof t=="object"&&(e.children=t,e.shapeFlag|=32)}function M(e,t=null,n=null){var m,E;let a=0;typeof e=="string"?a=1:e===F?a=0:typeof e=="function"?a=2:typeof e=="object"&&e!==null&&(e.setup||e.__vccOpts||e.render)&&(a=4);let l=(m=t==null?void 0:t.key)!=null?m:null,y=(E=t==null?void 0:t.ref)!=null?E:null,d=t;if(t){let{key:h,ref:r,...i}=t;d=i}let g={type:e,props:d,children:null,key:l,ref:y,shapeFlag:a,el:null,component:null};return n!=null&&ne(g,n),g}function R(e,t,n){return M(e,t||null,n||null)}import{isPromise as j}from"@lytjs/common";function W(e){return Object.create(e||null)}function G(e){return e!==null&&typeof e=="object"&&typeof e.install=="function"}function q(e){return typeof e=="function"}function P(e,t,...n){if(G(t)){let a=t.onBeforeInstall?t.onBeforeInstall(e,...n):void 0;if(j(a))return a.then(()=>{let l=t.install(e,...n);if(j(l))return l.then(()=>{if(t.onInstalled)return t.onInstalled(e,...n)});if(t.onInstalled)return t.onInstalled(e,...n)});{let l=t.install(e,...n);if(j(l))return l.then(()=>{if(t.onInstalled)return t.onInstalled(e,...n)});if(t.onInstalled)return t.onInstalled(e,...n)}}else if(q(t))return t(e,...n)}function D(e,t){if(G(t)){if(typeof t.uninstall=="function")return t.uninstall(e)}else q(t)}import{effect as re,stop as oe}from"@lytjs/reactivity";import{compile as ie}from"@lytjs/compiler";import{defineComponent as se,createComponentInstance as ae,setupComponent as le,mountComponent as ce,updateComponent as ue,unmountComponent as de}from"@lytjs/component";import{createRenderer as fe}from"@lytjs/renderer";var pe=100,N=new Map;function me(e){let t=N.get(e);if(t)return N.delete(e),N.set(e,t),t;let{code:n}=ie(e);if(t=new Function("h","_ctx",`return ${n}`),N.size>=pe){let a=N.keys().next().value;N.delete(a)}return N.set(e,t),t}function ye(e){let t={...e};if(e.state&&typeof e.state!="function"){let n=e.state;t.state=()=>({...n})}if(typeof e.render=="function"){let n=e.render;t.render=(a,l)=>n(a)}if(e.computed){let n={};for(let a of Object.keys(e.computed)){let l=e.computed[a];typeof l=="function"?n[a]={get:l}:n[a]=l}t.computed=n}if(typeof e.init=="function"){let n=e.init;t.init=function(a,l){return n.call(this,a)}}return t}function ge(){return{createElement(e){return document.createElement(e)},createText(e){return document.createTextNode(e)},createComment(e){return document.createComment(e)},setAttribute(e,t,n){e.setAttribute(t,String(n))},removeAttribute(e,t){e.removeAttribute(t)},setStyle(e,t){if(typeof t=="string")e.style.cssText=t;else if(t&&typeof t=="object")for(let n in t)e.style[n]=t[n]},setClass(e,t){if(typeof t=="string")e.className=t;else if(t&&typeof t=="object"){let n=[];for(let[a,l]of Object.entries(t))l&&n.push(a);e.className=n.join(" ")}else e.className=""},insert(e,t,n){n!=null?e.insertBefore(t,n):e.appendChild(t)},remove(e){e.parentNode&&e.parentNode.removeChild(e)},replace(e,t,n){e.replaceChild(n,t)},addEventListener(e,t,n,a){e.addEventListener(t,n,a)},removeEventListener(e,t,n){e.removeEventListener(t,n)},nextTick(e){Promise.resolve().then(e)},parentNode(e){return e.parentNode},nextSibling(e){return e.nextSibling},querySelector(e){return document.querySelector(e)}}}function z(e,t){let n=new Set,a={},l={},y=W(),d={},g={},m=null,E=null,h=null,r=null,i=!1,o=ye(typeof e=="function"?{render:e}:e),u=se(o),s={config:d,globalProperties:g,get _instance(){return m},mount(f){if(i)return s;let p;if(typeof f=="string"){if(p=document.querySelector(f),!p)throw new Error(`[Lyt] \u627E\u4E0D\u5230\u6302\u8F7D\u76EE\u6807: "${f}"`)}else p=f;r=p;let _=ge();E=fe(_),m=ae(u),le(m,t||{},null);let T=m.type;if(!T.render&&T.template){let x=me(T.template);T.render=(S,K)=>x(S,K.renderProxy)}return ce(m,R),m.subTree&&E.mount(m.subTree,p),h=re(()=>{if(!(!m||!m.isMounted||!E)&&(ue(m,R),m.subTree&&r)){let x=r.firstChild,S=m.subTree;r.innerHTML="",E.mount(S,r)}},{lazy:!0}),i=!0,s},unmount(){i&&(h&&(oe(h),h=null),m&&de(m),r&&(r.innerHTML=""),m=null,E=null,r=null,i=!1)},use(f,...p){if(n.has(f))return s;n.add(f);let _=P({use:s.use.bind(s),unuse:s.unuse.bind(s),isInstalled:s.isInstalled.bind(s),provide:s.provide.bind(s),inject:s.inject.bind(s),config:d,globalProperties:g},f,...p);return _ instanceof Promise?_.then(()=>s):s},unuse(f){if(!n.has(f))return s;n.delete(f);let p=D({use:s.use.bind(s),unuse:s.unuse.bind(s),isInstalled:s.isInstalled.bind(s),provide:s.provide.bind(s),inject:s.inject.bind(s),config:d,globalProperties:g},f);return p instanceof Promise?p.then(()=>s):s},isInstalled(f){return n.has(f)},provide(f,p){return y[f]=p,s},inject(f,p){let _=y[f];return _!==void 0?_:p},component(f,p){return p?(a[f]=p,s):a[f]},directive(f,p){return p?(l[f]=p,s):l[f]}};return s}var A=class extends Error{constructor(t,n,a){let l=`[Lyt ${t}] ${n}`;super(l),this.name="LytError",this.code=t,this.details=a}};var L=class L{constructor(t){this.errors=[],this.options=t||{},this._hasError=!1}get hasError(){return this._hasError}static setGlobalHandler(t){L.globalHandler=t}capture(t,n,a){var d;let l={error:t,vm:n,info:a||"",timestamp:Date.now()};this.errors.push(l),this._hasError=!0;let y=(d=this.options.maxErrors)!=null?d:100;this.errors.length>y&&this.errors.splice(0,this.errors.length-y),!(this.options.onErrorCaptured&&this.options.onErrorCaptured(t instanceof A?t:new A(1004,t.message),n,l.info)===!0)&&this.options.onError&&this.options.onError(t instanceof A?t:new A(1004,t.message),n)}getFallback(t){if(!this.options.fallback||this.errors.length===0)return null;let n=this.errors[this.errors.length-1];return this.options.fallback(n.error,n.vm,n.info)}getErrors(){return this.errors.slice()}getErrorCount(){return this.errors.length}getLastErrors(){return this.errors.length===0?null:{...this.errors[this.errors.length-1]}}clear(){this.errors=[],this._hasError=!1}};L.globalHandler=null;var v=L,Ee=!0;function X(e,t,n){v.globalHandler&&v.globalHandler(e,t,n||""),Ee&&e instanceof A&&e.details}b(C,qe);import*as qe from"@lytjs/common";function O(){return typeof window!="undefined"&&typeof document!="undefined"&&typeof HTMLElement!="undefined"&&typeof customElements!="undefined"}function he(e){return e.replace(/-([a-z])/g,(t,n)=>n.toUpperCase())}function _e(e){if(e===""||e==="true")return!0;if(e==="false")return!1;if(e==="null")return null;if(e==="undefined")return;let t=Number(e);if(!isNaN(t)&&e.trim()!=="")return t;if(e.startsWith("{")&&e.endsWith("}")||e.startsWith("[")&&e.endsWith("]"))try{return JSON.parse(e)}catch(n){}return e}function Re(e,t){return t&&t[e]?t[e]:he(e)}function Ce(e){let t=[],n=e;if(n.emits&&(Array.isArray(n.emits)?t.push(...n.emits):typeof n.emits=="object"&&t.push(...Object.keys(n.emits))),n.methods){for(let a of Object.keys(n.methods))if(a.startsWith("on")&&a.length>2){let l=a.charAt(2).toLowerCase()+a.slice(3);t.push(l)}}return t}function Ae(e,t={}){let{shadowMode:n="open",styles:a="",propMappings:l,eventMappings:y={},attributeConverters:d={}}=t,g=t.observedAttributes||[],m=Ce(e);return class extends HTMLElement{constructor(){super();this._shadowRoot=null;this._instance=null;this._props={};this._container=null;this._connected=!1;this._eventCleanups=[];this._effectCleanup=null;this._updateScheduled=!1}static get observedAttributes(){return g}connectedCallback(){if(!this._connected){if(this._connected=!0,this._shadowRoot=this.attachShadow({mode:n}),a){let r=document.createElement("style");r.textContent=a,this._shadowRoot.appendChild(r)}this._container=document.createElement("div"),this._shadowRoot.appendChild(this._container),this._syncAttributesToProps(),this._mountComponent(),this._forwardSlots()}}disconnectedCallback(){if(this._connected){this._connected=!1;for(let r of this._eventCleanups)r();this._eventCleanups=[],this._effectCleanup&&(this._effectCleanup(),this._effectCleanup=null),this._instance=null,this._container&&(this._container.innerHTML="")}}attributeChangedCallback(r,i,c){i!==c&&this._connected&&(this._syncAttributesToProps(),this._updateComponent())}_syncAttributesToProps(){let r={};for(let i of g)if(this.hasAttribute(i)){let c=this.getAttribute(i),o=Re(i,l);d[i]?r[o]=d[i](c):r[o]=_e(c)}if(e.props){for(let[i,c]of Object.entries(e.props))if(r[i]===void 0){let o=c;o&&typeof o=="object"&&"default"in o?r[i]=typeof o.default=="function"?o.default():o.default:o==null}}this._props=r}_mountComponent(){let r=e.render?e.render:e.template?this._compileTemplate(e.template):null;if(!r)return;let i=this._createComponentContext(),c=r.call(i,R,i);c&&this._container&&this._renderVNode(c,this._container),this._setupReactiveUpdates(i,r)}_compileTemplate(r){try{let i=Function("return require")(),{compile:c}=i("../../compiler/src/index.ts"),{code:o}=c(r);return new Function("h","_ctx",`return ${o}`)}catch(i){return null}}_createComponentContext(){let r=e.state?typeof e.state=="function"?e.state():{...e.state}:{},i=e.computed||{},c=e.methods||{},o={...this._props,...r};for(let[u,s]of Object.entries(i))typeof s=="function"?Object.defineProperty(o,u,{get:s.bind(o),enumerable:!0}):s&&typeof s=="object"&&"get"in s&&Object.defineProperty(o,u,{get:s.get.bind(o),enumerable:!0});for(let[u,s]of Object.entries(c))typeof s=="function"&&(o[u]=s.bind(o));return o.emit=(u,...s)=>{let f=y[u]||u,p=new CustomEvent(f,{detail:s.length===1?s[0]:s,bubbles:!0,composed:!0});this.dispatchEvent(p)},o.$el=this._container,o.$attrs={...this._props},o.$slots=this._getSlotContent(),o}_setupReactiveUpdates(r,i){try{let c=Function("return require")(),{effect:o,stop:u}=c("../../reactivity/src/index.ts"),s=o(()=>{if(!this._connected||!this._container)return;let p=i.call(r,R,r);p&&(this._container.innerHTML="",this._renderVNode(p,this._container))},{lazy:!0}),f=e.state?typeof e.state=="function"?Object.keys(e.state()):Object.keys(e.state):[];for(let p of f){let _=r[p];Object.defineProperty(r,p,{get(){return _},set(T){_=T;try{s()}catch(x){}},enumerable:!0})}this._effectCleanup=()=>{try{u(s)}catch(p){}}}catch(c){let o=e.state?typeof e.state=="function"?Object.keys(e.state()):Object.keys(e.state):[];for(let u of o){let f=r[u],p=this;Object.defineProperty(r,u,{get(){return f},set(_){f=_,p._scheduleUpdate(r,i)},enumerable:!0})}}}_scheduleUpdate(r,i){this._updateScheduled||(this._updateScheduled=!0,Promise.resolve().then(()=>{if(this._updateScheduled=!1,!this._connected||!this._container)return;let c=i.call(r,R,r);c&&(this._container.innerHTML="",this._renderVNode(c,this._container))}))}_updateComponent(){if(!this._container)return;let r=e.render?e.render:e.template?this._compileTemplate(e.template):null;if(!r)return;let i=this._createComponentContext(),c=r.call(i,R,i);this._container.innerHTML="",c&&this._renderVNode(c,this._container)}_renderVNode(r,i){let c=this._vNodeToElement(r);c&&i.appendChild(c)}_vNodeToElement(r){if(!r)return null;if(typeof r.type=="symbol"){let i=document.createDocumentFragment();if(Array.isArray(r.children))for(let c of r.children){let o=this._vNodeToElement(c);o&&i.appendChild(o)}return i}if(typeof r.children=="string")return document.createTextNode(r.children);if(typeof r.type=="string"){let i=document.createElement(r.type);if(r.props)for(let[c,o]of Object.entries(r.props))if(c==="style"&&typeof o=="object")for(let[u,s]of Object.entries(o))i.style[u]=s;else if(c==="class"){if(typeof o=="string")i.className=o;else if(typeof o=="object"){let u=[];for(let[s,f]of Object.entries(o))f&&u.push(s);i.className=u.join(" ")}}else if(c.startsWith("on")&&typeof o=="function"){let u=c.slice(2).toLowerCase();i.addEventListener(u,o),this._eventCleanups.push(()=>{i.removeEventListener(u,o)})}else c==="ref"&&typeof o=="function"?o(i):i.setAttribute(c,String(o));if(Array.isArray(r.children))for(let c of r.children){let o=this._vNodeToElement(c);o&&i.appendChild(o)}else typeof r.children=="string"&&(i.textContent=r.children);return i}return typeof r.type=="object"||typeof r.type=="function"?r.component?this._vNodeToElement(r.component.subTree||r):document.createComment("component"):null}_forwardSlots(){if(!this._shadowRoot||!this._container)return;let r=this.querySelectorAll("[slot]");for(let c of r){let o=c.getAttribute("slot")||"default",u=document.createElement("slot");o!=="default"&&u.setAttribute("name",o),this._container.appendChild(u)}let i=document.createElement("slot");this._container.appendChild(i)}_getSlotContent(){var o;let r={},i=this.querySelectorAll("[slot]");for(let u of i){let s=u.getAttribute("slot")||"default";r[s]||(r[s]=[]),r[s].push(u.cloneNode(!0))}let c=[];for(let u of Array.from(this.childNodes))(o=u.hasAttribute)!=null&&o.call(u,"slot")||c.push(u.cloneNode(!0));return c.length>0&&(r.default=c),r}get _lytInstance(){return this._instance}get _lytProps(){return{...this._props}}}}function I(e,t,n){if(!e.includes("-"))throw new Error(`[Lyt Web Component] \u6807\u7B7E\u540D "${e}" \u5FC5\u987B\u5305\u542B\u8FDE\u5B57\u7B26 (-)\u3002\u8FD9\u662F Custom Element \u89C4\u8303\u7684\u8981\u6C42\u3002`);if(!O())return;let a=Ae(t,n);customElements.define(e,a)}function w(e){for(let{tagName:t,component:n,options:a}of e)I(t,n,a)}function k(e){if(O())try{let t=customElements;t.__unregister&&t.__unregister(e)}catch(t){}}async function U(e,t,n){let a=t.match(/<template>([\s\S]*?)<\/template>/),l=t.match(/<script[^>]*>([\s\S]*?)<\/script>/),y=/<style[^>]*>([\s\S]*?)<\/style>/g,d=[],g;for(;(g=y.exec(t))!==null;)d.push(g);let m=(n==null?void 0:n.styles)||"";for(let i of d)m+=i[1]+`
|
|
2
|
+
`;let E=a?a[1].trim():void 0,h={};if(l){let i=l[1].trim();if(i.match(/export\s+default\s*(\{[\s\S]*\}|\([\s\S]*\)[\s\S]*?\))/))try{let o={},u={exports:o};new Function("module","exports",`"use strict"; ${i.replace(/export\s+default\s*/,"module.exports =")}`)(u,o),h=u.exports||o}catch(o){}}let r={...n,styles:m};E&&!h.template&&!h.render&&(h.template=E),I(e,h,r)}export{I as defineCustomElement,U as defineCustomElementFromSFC,O as isBrowser,w as registerComponents,k as unregisterElement};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lytjs/core",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.4",
|
|
4
4
|
"description": "Lyt.js 核心入口 - 整合响应式、编译器、虚拟 DOM、渲染器和组件系统",
|
|
5
5
|
"main": "./dist/index.cjs",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -29,10 +29,18 @@
|
|
|
29
29
|
"import": "./dist/web-component-entry.mjs",
|
|
30
30
|
"require": "./dist/web-component-entry.cjs",
|
|
31
31
|
"default": "./dist/web-component-entry.mjs"
|
|
32
|
+
},
|
|
33
|
+
"./shared": {
|
|
34
|
+
"types": "./dist/types/shared-entry.d.ts",
|
|
35
|
+
"import": "./dist/shared-entry.mjs",
|
|
36
|
+
"require": "./dist/shared-entry.cjs",
|
|
37
|
+
"default": "./dist/shared-entry.mjs"
|
|
32
38
|
}
|
|
33
39
|
},
|
|
34
40
|
"sideEffects": false,
|
|
35
|
-
"files": [
|
|
41
|
+
"files": [
|
|
42
|
+
"dist"
|
|
43
|
+
],
|
|
36
44
|
"license": "MIT",
|
|
37
45
|
"author": "lytjs",
|
|
38
46
|
"repository": {
|
|
@@ -41,15 +49,24 @@
|
|
|
41
49
|
},
|
|
42
50
|
"homepage": "https://gitee.com/lytjs/lytjs",
|
|
43
51
|
"keywords": [
|
|
44
|
-
"lyt",
|
|
45
|
-
"
|
|
52
|
+
"lyt",
|
|
53
|
+
"lytjs",
|
|
54
|
+
"javascript",
|
|
55
|
+
"framework",
|
|
56
|
+
"frontend",
|
|
57
|
+
"vue-like",
|
|
58
|
+
"lightweight",
|
|
59
|
+
"zero-dependency",
|
|
60
|
+
"core",
|
|
61
|
+
"createApp"
|
|
46
62
|
],
|
|
47
63
|
"dependencies": {
|
|
48
|
-
"@lytjs/
|
|
49
|
-
"@lytjs/
|
|
50
|
-
"@lytjs/
|
|
51
|
-
"@lytjs/
|
|
52
|
-
"@lytjs/
|
|
64
|
+
"@lytjs/common": "^4.0.4",
|
|
65
|
+
"@lytjs/reactivity": "^4.0.4",
|
|
66
|
+
"@lytjs/compiler": "^4.0.4",
|
|
67
|
+
"@lytjs/vdom": "^4.0.4",
|
|
68
|
+
"@lytjs/renderer": "^4.0.4",
|
|
69
|
+
"@lytjs/component": "^4.0.4"
|
|
53
70
|
},
|
|
54
71
|
"engines": {
|
|
55
72
|
"node": ">=18.0.0"
|