wevu 7.3.0 → 7.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/dist/dev/_virtual/{_@oxc-project_runtime@0.151.0 → _@oxc-project_runtime@0.153.0}/helpers/esm/defineProperty.mjs +1 -1
- package/dist/dev/_virtual/{_@oxc-project_runtime@0.151.0 → _@oxc-project_runtime@0.153.0}/helpers/esm/toPrimitive.mjs +1 -1
- package/dist/dev/_virtual/{_@oxc-project_runtime@0.151.0 → _@oxc-project_runtime@0.153.0}/helpers/esm/toPropertyKey.mjs +1 -1
- package/dist/dev/_virtual/{_@oxc-project_runtime@0.151.0 → _@oxc-project_runtime@0.153.0}/helpers/esm/typeof.mjs +1 -1
- package/dist/dev/package.mjs +1 -1
- package/dist/dev/reactivity/core.mjs +1 -1
- package/dist/dev/reactivity/ref.mjs +1 -1
- package/dist/dev/router/initialNavigation.mjs +4 -1
- package/dist/dev/router/initialNavigation.mjs.map +1 -1
- package/dist/dev/router/scrollRestoration/adapters.mjs +86 -0
- package/dist/dev/router/scrollRestoration/adapters.mjs.map +1 -0
- package/dist/dev/router/scrollRestoration/controller.mjs +148 -0
- package/dist/dev/router/scrollRestoration/controller.mjs.map +1 -0
- package/dist/dev/router/scrollRestoration/host.mjs +76 -0
- package/dist/dev/router/scrollRestoration/host.mjs.map +1 -0
- package/dist/dev/router/scrollRestoration/index.mjs +156 -0
- package/dist/dev/router/scrollRestoration/index.mjs.map +1 -0
- package/dist/dev/router.mjs +4 -1
- package/dist/dev/runtime/app/diagnostics.mjs +5 -1
- package/dist/dev/runtime/app/diagnostics.mjs.map +1 -1
- package/dist/dev/runtime/app/mount.mjs +8 -3
- package/dist/dev/runtime/app/mount.mjs.map +1 -1
- package/dist/dev/runtime/app/setData/commitTracker.mjs +39 -4
- package/dist/dev/runtime/app/setData/commitTracker.mjs.map +1 -1
- package/dist/dev/runtime/app/setData/observation.mjs +109 -0
- package/dist/dev/runtime/app/setData/observation.mjs.map +1 -0
- package/dist/dev/runtime/app/setData/scheduler.mjs +12 -1
- package/dist/dev/runtime/app/setData/scheduler.mjs.map +1 -1
- package/dist/dev/runtime/app/setDataOptions.mjs +1 -0
- package/dist/dev/runtime/app/setDataOptions.mjs.map +1 -1
- package/dist/dev/runtime/define/initialComputed.mjs +13 -12
- package/dist/dev/runtime/define/initialComputed.mjs.map +1 -1
- package/dist/dev/runtime/define/props.mjs +5 -1
- package/dist/dev/runtime/define/props.mjs.map +1 -1
- package/dist/dev/runtime/define/scopedSlotOptions.mjs +2 -1
- package/dist/dev/runtime/define/scopedSlotOptions.mjs.map +1 -1
- package/dist/dev/runtime/define.mjs +1 -1
- package/dist/dev/runtime/define.mjs.map +1 -1
- package/dist/dev/runtime/features/scopedSlots.mjs.map +1 -1
- package/dist/dev/runtime/hooks/base.mjs +1 -13
- package/dist/dev/runtime/hooks/base.mjs.map +1 -1
- package/dist/dev/runtime/hooks/pageScroll.mjs +41 -0
- package/dist/dev/runtime/hooks/pageScroll.mjs.map +1 -0
- package/dist/dev/runtime/hooks/register.mjs +2 -1
- package/dist/dev/runtime/hooks/register.mjs.map +1 -1
- package/dist/dev/runtime/register/component/lifecycle/optionalHooks.mjs +2 -5
- package/dist/dev/runtime/register/component/lifecycle/optionalHooks.mjs.map +1 -1
- package/dist/dev/runtime/register/component/lifecycle/platform.mjs +8 -20
- package/dist/dev/runtime/register/component/lifecycle/platform.mjs.map +1 -1
- package/dist/dev/runtime/register/component/props.mjs +14 -4
- package/dist/dev/runtime/register/component/props.mjs.map +1 -1
- package/dist/dev/runtime/register/component/registerDefinition.mjs +30 -17
- package/dist/dev/runtime/register/component/registerDefinition.mjs.map +1 -1
- package/dist/dev/runtime/register/component.mjs +2 -1
- package/dist/dev/runtime/register/component.mjs.map +1 -1
- package/dist/dev/runtime/register/runtimeInstance/methodBridge.mjs +14 -7
- package/dist/dev/runtime/register/runtimeInstance/methodBridge.mjs.map +1 -1
- package/dist/dev/runtime/register/runtimeInstance/nativeDeclaration.mjs +78 -0
- package/dist/dev/runtime/register/runtimeInstance/nativeDeclaration.mjs.map +1 -0
- package/dist/dev/runtime/register/runtimeInstance/provideContext.mjs +52 -8
- package/dist/dev/runtime/register/runtimeInstance/provideContext.mjs.map +1 -1
- package/dist/dev/runtime/register/runtimeInstance/setupPhase.mjs +7 -2
- package/dist/dev/runtime/register/runtimeInstance/setupPhase.mjs.map +1 -1
- package/dist/dev/runtime/register/runtimeInstance/utils.mjs.map +1 -1
- package/dist/dev/runtime/register/runtimeInstance.mjs +60 -19
- package/dist/dev/runtime/register/runtimeInstance.mjs.map +1 -1
- package/dist/fetch.mjs +1 -1
- package/dist/internal-template.mjs +1 -1
- package/dist/package.mjs +1 -1
- package/dist/reactivity/core.mjs +1 -1
- package/dist/reactivity/reactive/patch.mjs +1 -1
- package/dist/reactivity/reactive/patchState.mjs +1 -1
- package/dist/reactivity/ref.mjs +1 -1
- package/dist/reactivity/watch/helpers.mjs +1 -1
- package/dist/router/initialNavigation.mjs +1 -1
- package/dist/router/scrollRestoration/adapters.d.mts +7 -0
- package/dist/router/scrollRestoration/adapters.mjs +1 -0
- package/dist/router/scrollRestoration/controller.d.mts +7 -0
- package/dist/router/scrollRestoration/controller.mjs +1 -0
- package/dist/router/scrollRestoration/host.d.mts +3 -0
- package/dist/router/scrollRestoration/host.mjs +1 -0
- package/dist/router/scrollRestoration/index.d.mts +8 -0
- package/dist/router/scrollRestoration/index.mjs +1 -0
- package/dist/router/scrollRestoration/types.d.mts +60 -0
- package/dist/router/useRoute.mjs +1 -1
- package/dist/router.d.mts +5 -1
- package/dist/router.mjs +1 -1
- package/dist/routerInternal/matching.mjs +1 -1
- package/dist/routerInternal/params.mjs +1 -1
- package/dist/routerInternal/path.mjs +1 -1
- package/dist/routerInternal/query.mjs +1 -1
- package/dist/routerInternal/records.mjs +1 -1
- package/dist/runtime/app/context.mjs +1 -1
- package/dist/runtime/app/diagnostics.mjs +1 -1
- package/dist/runtime/app/mount.mjs +1 -1
- package/dist/runtime/app/setData/commitTracker.d.mts +2 -1
- package/dist/runtime/app/setData/commitTracker.mjs +1 -1
- package/dist/runtime/app/setData/observation.d.mts +12 -0
- package/dist/runtime/app/setData/observation.mjs +1 -0
- package/dist/runtime/app/setData/scheduler.d.mts +1 -0
- package/dist/runtime/app/setData/scheduler.mjs +1 -1
- package/dist/runtime/app/setDataOptions.mjs +1 -1
- package/dist/runtime/define/initialComputed.mjs +1 -1
- package/dist/runtime/define/props.mjs +1 -1
- package/dist/runtime/define/scopedSlotOptions.mjs +1 -1
- package/dist/runtime/define.mjs +1 -1
- package/dist/runtime/diff.mjs +1 -1
- package/dist/runtime/features/publicLayout.mjs +1 -1
- package/dist/runtime/features/scopedSlots.d.mts +2 -1
- package/dist/runtime/hooks/base.mjs +1 -1
- package/dist/runtime/hooks/pageScroll.mjs +1 -0
- package/dist/runtime/hooks/register.mjs +1 -1
- package/dist/runtime/jsxIsland.mjs +1 -1
- package/dist/runtime/pageLayout.mjs +1 -1
- package/dist/runtime/pageScroll.mjs +1 -1
- package/dist/runtime/register/component/alipayRegistration.mjs +1 -1
- package/dist/runtime/register/component/lifecycle/optionalHooks.mjs +1 -1
- package/dist/runtime/register/component/lifecycle/platform.mjs +1 -1
- package/dist/runtime/register/component/lifecycle.mjs +1 -1
- package/dist/runtime/register/component/props.mjs +1 -1
- package/dist/runtime/register/component/registerDefinition.mjs +1 -1
- package/dist/runtime/register/component/registerNativeDefinition.mjs +1 -1
- package/dist/runtime/register/component.mjs +1 -1
- package/dist/runtime/register/runtimeInstance/methodBridge.mjs +1 -1
- package/dist/runtime/register/runtimeInstance/nativeDeclaration.mjs +1 -0
- package/dist/runtime/register/runtimeInstance/provideContext.mjs +1 -1
- package/dist/runtime/register/runtimeInstance/setupPhase.mjs +1 -1
- package/dist/runtime/register/runtimeInstance.d.mts +8 -4
- package/dist/runtime/register/runtimeInstance.mjs +1 -1
- package/dist/runtime/setupTracking.mjs +1 -1
- package/dist/runtime/templateRefs.mjs +1 -1
- package/dist/runtime/types/runtime.d.mts +1 -0
- package/dist/runtime/types/setData.d.mts +30 -0
- package/dist/scheduler.mjs +1 -1
- package/dist/web-apis.mjs +1 -1
- package/package.json +10 -9
- package/dist/dev/api/vitest/setup.d.mts +0 -1
- package/dist/dev/api/vitest.d.mts +0 -1
- package/dist/dev/api.d.mts +0 -1
- package/dist/dev/compiler.d.mts +0 -1
- package/dist/dev/fetch.d.mts +0 -9
- package/dist/dev/index.d.mts +0 -72
- package/dist/dev/internal-reactivity.d.mts +0 -18
- package/dist/dev/internal-runtime.d.mts +0 -45
- package/dist/dev/internal-template.d.mts +0 -2
- package/dist/dev/jsxTypes.d.mts +0 -9
- package/dist/dev/macros/shared.d.mts +0 -83
- package/dist/dev/macros.d.mts +0 -71
- package/dist/dev/reactivity/asyncDerivation.d.mts +0 -41
- package/dist/dev/reactivity/computed.d.mts +0 -25
- package/dist/dev/reactivity/core.d.mts +0 -35
- package/dist/dev/reactivity/index.d.mts +0 -16
- package/dist/dev/reactivity/reactive/mutation.d.mts +0 -21
- package/dist/dev/reactivity/reactive/patch.d.mts +0 -18
- package/dist/dev/reactivity/reactive/shallow.d.mts +0 -22
- package/dist/dev/reactivity/reactive/shared.d.mts +0 -4
- package/dist/dev/reactivity/reactive.d.mts +0 -42
- package/dist/dev/reactivity/readonly.d.mts +0 -27
- package/dist/dev/reactivity/ref.d.mts +0 -27
- package/dist/dev/reactivity/shallowRef.d.mts +0 -19
- package/dist/dev/reactivity/toRefs.d.mts +0 -43
- package/dist/dev/reactivity/traverse.d.mts +0 -8
- package/dist/dev/reactivity/watch/types.d.mts +0 -43
- package/dist/dev/reactivity/watch.d.mts +0 -22
- package/dist/dev/router/auto-routes.d.mts +0 -8
- package/dist/dev/router/createRouter.d.mts +0 -9
- package/dist/dev/router/navigationCore.d.mts +0 -7
- package/dist/dev/router/resolve.d.mts +0 -7
- package/dist/dev/router/routeSync.d.mts +0 -2
- package/dist/dev/router/types.d.mts +0 -267
- package/dist/dev/router/useRoute.d.mts +0 -20
- package/dist/dev/router/useRouter.d.mts +0 -9
- package/dist/dev/router.d.mts +0 -26
- package/dist/dev/routerInternal/location.d.mts +0 -2
- package/dist/dev/routerInternal/matching.d.mts +0 -2
- package/dist/dev/routerInternal/params.d.mts +0 -2
- package/dist/dev/routerInternal/query.d.mts +0 -7
- package/dist/dev/routerInternal/records.d.mts +0 -2
- package/dist/dev/routerInternal/recordsWarnings.d.mts +0 -2
- package/dist/dev/routerInternal/shared.d.mts +0 -9
- package/dist/dev/routerInternal/snapshots.d.mts +0 -2
- package/dist/dev/routerInternal/types.d.mts +0 -9
- package/dist/dev/runtime/app/pending.d.mts +0 -10
- package/dist/dev/runtime/app/setData/commitTracker.d.mts +0 -13
- package/dist/dev/runtime/app/setData/scheduler.d.mts +0 -51
- package/dist/dev/runtime/app.d.mts +0 -8
- package/dist/dev/runtime/capabilities.d.mts +0 -78
- package/dist/dev/runtime/css.d.mts +0 -14
- package/dist/dev/runtime/defaults.d.mts +0 -12
- package/dist/dev/runtime/define.d.mts +0 -118
- package/dist/dev/runtime/disposables.d.mts +0 -31
- package/dist/dev/runtime/elementIntersectionObserver.d.mts +0 -26
- package/dist/dev/runtime/features/inlineEvents.d.mts +0 -7
- package/dist/dev/runtime/features/jsxIslands.d.mts +0 -7
- package/dist/dev/runtime/features/layout.d.mts +0 -7
- package/dist/dev/runtime/features/patchStrategy.d.mts +0 -7
- package/dist/dev/runtime/features/publicLayout.d.mts +0 -24
- package/dist/dev/runtime/features/scopedSlots.d.mts +0 -23
- package/dist/dev/runtime/features/setDataHighFrequencyWarning.d.mts +0 -7
- package/dist/dev/runtime/features/templateRefs.d.mts +0 -7
- package/dist/dev/runtime/hooks/base.d.mts +0 -27
- package/dist/dev/runtime/hooks/register.d.mts +0 -30
- package/dist/dev/runtime/hooks/vue.d.mts +0 -52
- package/dist/dev/runtime/hooks.d.mts +0 -4
- package/dist/dev/runtime/index.d.mts +0 -46
- package/dist/dev/runtime/intersectionObserver.d.mts +0 -14
- package/dist/dev/runtime/jsxIsland.d.mts +0 -37
- package/dist/dev/runtime/layoutBridge.d.mts +0 -55
- package/dist/dev/runtime/noSetData.d.mts +0 -5
- package/dist/dev/runtime/pageEnvironment.d.mts +0 -50
- package/dist/dev/runtime/pageLayout.d.mts +0 -25
- package/dist/dev/runtime/pageScroll.d.mts +0 -29
- package/dist/dev/runtime/provide.d.mts +0 -60
- package/dist/dev/runtime/provideStore.d.mts +0 -7
- package/dist/dev/runtime/publicRuntime.d.mts +0 -22
- package/dist/dev/runtime/pullDownRefresh.d.mts +0 -12
- package/dist/dev/runtime/register/app.d.mts +0 -14
- package/dist/dev/runtime/register/component.d.mts +0 -17
- package/dist/dev/runtime/register/inline.d.mts +0 -15
- package/dist/dev/runtime/register/runtimeInstance.d.mts +0 -26
- package/dist/dev/runtime/register/setup.d.mts +0 -11
- package/dist/dev/runtime/register/watch.d.mts +0 -12
- package/dist/dev/runtime/register.d.mts +0 -5
- package/dist/dev/runtime/selectorQuery.d.mts +0 -54
- package/dist/dev/runtime/template.d.mts +0 -6
- package/dist/dev/runtime/templateRefTypes.d.mts +0 -12
- package/dist/dev/runtime/types/core.d.mts +0 -35
- package/dist/dev/runtime/types/miniprogram.d.mts +0 -84
- package/dist/dev/runtime/types/miniprogramHost.d.mts +0 -45
- package/dist/dev/runtime/types/miniprogramHostSources.d.mts +0 -112
- package/dist/dev/runtime/types/options.d.mts +0 -138
- package/dist/dev/runtime/types/props/propTypes.d.mts +0 -79
- package/dist/dev/runtime/types/props/router.d.mts +0 -51
- package/dist/dev/runtime/types/props/setup.d.mts +0 -96
- package/dist/dev/runtime/types/props.d.mts +0 -4
- package/dist/dev/runtime/types/runtime.d.mts +0 -59
- package/dist/dev/runtime/types/setData.d.mts +0 -237
- package/dist/dev/runtime/types.d.mts +0 -29
- package/dist/dev/runtime/uniAppHost.d.mts +0 -8
- package/dist/dev/runtime/updatePerformance.d.mts +0 -13
- package/dist/dev/runtime/use.d.mts +0 -13
- package/dist/dev/runtime/vueCompat/context.d.mts +0 -8
- package/dist/dev/runtime/vueCompat/model.d.mts +0 -30
- package/dist/dev/runtime/vueCompat/router.d.mts +0 -29
- package/dist/dev/runtime/vueCompat/templateRef.d.mts +0 -9
- package/dist/dev/runtime/vueCompat.d.mts +0 -5
- package/dist/dev/scheduler.d.mts +0 -4
- package/dist/dev/store/define.d.mts +0 -8
- package/dist/dev/store/manager.d.mts +0 -16
- package/dist/dev/store/storeToRefs.d.mts +0 -11
- package/dist/dev/store/types.d.mts +0 -106
- package/dist/dev/store.d.mts +0 -5
- package/dist/dev/version.d.mts +0 -4
- package/dist/dev/vue-augment.d.mts +0 -8
- package/dist/dev/vue-demi.d.mts +0 -87
- package/dist/dev/vue-types.d.mts +0 -19
- package/dist/dev/web-apis.d.mts +0 -3
- /package/dist/_virtual/{_@oxc-project_runtime@0.151.0 → _@oxc-project_runtime@0.153.0}/helpers/esm/defineProperty.mjs +0 -0
- /package/dist/_virtual/{_@oxc-project_runtime@0.151.0 → _@oxc-project_runtime@0.153.0}/helpers/esm/toPrimitive.mjs +0 -0
- /package/dist/_virtual/{_@oxc-project_runtime@0.151.0 → _@oxc-project_runtime@0.153.0}/helpers/esm/toPropertyKey.mjs +0 -0
- /package/dist/_virtual/{_@oxc-project_runtime@0.151.0 → _@oxc-project_runtime@0.153.0}/helpers/esm/typeof.mjs +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
import{nextTick as e}from"../../scheduler.mjs";import{toRaw as t}from"../../reactivity/reactive/shared.mjs";import{isRef as n,ref as r}from"../../reactivity/ref.mjs";import{hasOwn as i}from"../../utils.mjs";import{setComputedValue as a}from"../internal.mjs";import{normalizeEmitEventName as o,normalizeEmitPayload as s}from"../emit.mjs";import{isNativeBridgeMethod as c,markNativeBridgeMethod as l}from"../nativeBridge.mjs";import{createComputedAccessors as u}from"./computed.mjs";import{WEVU_COMPONENT_NAME_KEY as d,WEVU_HOST_COMMIT_PROMISE_KEY as f,WEVU_INLINE_MAP_KEY as p,WEVU_NATIVE_INSTANCE_KEY as m,WEVU_PARENT_INSTANCE_KEY as h,WEVU_PROPS_KEY as g,WEVU_RESOLVE_PUBLIC_INSTANCE_METHOD as _,WEVU_RUNTIME_APP_KEY as v,WEVU_RUNTIME_KEY as y}from"@weapp-core/constants";function b(b){let{state:x,setupState:S,computedDefs:C,methodDefs:w,appConfig:T,includeComputed:E,setDataStrategy:D}=b,O={},{computedRefs:k,computedSetters:A,dirtyComputedKeys:j,createTrackedComputed:M,computedProxy:N}=u({includeComputed:E,setDataStrategy:D}),P=r(0),F=Object.create(null),I=(e,n)=>{let r=t(e),i=r[y],a=i?.proxy,o=(e,t)=>{let n=e[t];return c(n)},s=t=>!(!t||typeof t!=`object`||t===e||t===n||t===a||o(t,`triggerEvent`)||o(t,`createSelectorQuery`)||o(t,`createIntersectionObserver`)||o(t,`setData`)),l=r[m];if(s(l))return l;let u=i?.instance;if(s(u))return u},L=e=>{if(i(O,e))return;let t=(...t)=>{let n=I(x,x);if(!n)return;let r=Reflect.get(n,e);if(typeof r==`function`)return r.apply(n,t)};l(t),O[e]=t},R=(e,t)=>{let n=/* @__PURE__ */ new Set,r=e;for(;r&&!n.has(r);){n.add(r);let e=r[v]?.config?.globalProperties;if(e&&i(e,t))return{found:!0,value:e[t]};r=r[h]}let a=typeof globalThis<`u`?globalThis.getApp:void 0;if(typeof a==`function`)try{let e=a()?.[v]?.config?.globalProperties;if(e&&i(e,t))return{found:!0,value:e[t]}}catch{}return{found:!1,value:void 0}},z=e=>{let t=e&&Reflect.get(e,`selectOwnerComponent`);if(typeof t==`function`)try{let n=t.call(e);if(!n||typeof n!=`object`)return;let r=Reflect.get(n,_);if(typeof r==`function`){let e=r.call(n);if(e)return e}return n[y]?.proxy??n.__wevu?.proxy??n}catch{return}},B=new Proxy(x,{get(n,r,a){if(typeof r==`string`){if(P.value,i(S,r))return Reflect.get(S,r,a);if(r===`props`){let e=n[g];if(e&&typeof e==`object`)return e}if(r===`$props`){let e=n[g];if(e&&typeof e==`object`)return e}let c=n[g];if(c&&typeof c==`object`&&i(c,r))return Reflect.get(c,r);if(r===`data`||r===`$state`)return x;if(r===`$computed`)return N;if(r===`$emit`)return(e,...t)=>{let r=I(n,a),i=r&&Reflect.get(r,`triggerEvent`);if(typeof i!=`function`)return;let{detail:c,options:l}=s(t);return i.call(r,o(e),c,l)};if(r===`$nextTick`)return async t=>{await e();let r=I(n,a),i=r&&Reflect.get(r,f);if(i&&(typeof i==`object`||typeof i==`function`)&&`then`in i&&typeof i.then==`function`&&await i,t)return t.call(B)};if(r===`$set`)return(e,t,n)=>(Reflect.set(e,t,n),n);if(r===`$delete`)return(e,t)=>Reflect.deleteProperty(e,t);if(r===`$slots`)return t(n).$slots??Object.freeze(Object.create(null));if(r===`$refs`)return t(n).$refs??Object.create(null);if(r===`$parent`)return z(I(n,a));if(r===`$options`){let e=I(n,a);return{name:e?.[d]??e?.name??e?.is}}if(i(F,r))return Reflect.get(F,r);if(i(O,r))return O[r];if(k[r])return k[r].value;if(i(T.globalProperties,r))return T.globalProperties[r];let l=R(I(n,a),r);if(l.found)return l.value}if(!Reflect.has(n,r)){let e=I(n,a);if(e&&Reflect.has(e,r)){let t=Reflect.get(e,r);return typeof t==`function`?t.bind(e):t}}let c=Reflect.get(n,r,a);return typeof r==`string`&&i(S,r)?Reflect.get(S,r,a):c},set(e,t,r,o){if(typeof t==`string`&&k[t])return a(A,t,r),!0;if(i(S,t)){let e=Reflect.get(S,t,o);return n(e)&&!n(r)?(e.value=r,!0):Reflect.set(S,t,r,o)}if(i(F,t))return Reflect.set(F,t,r);if(Reflect.has(e,t)){let a=Reflect.get(e,t,o);return n(a)&&!n(r)?(a.value=r,!0):i(e[g]??{},t)?Reflect.set(S,t,r,o):Reflect.set(e,t,r,o)}return Reflect.set(F,t,r)},has(e,t){if(t===`data`||t===`$emit`||t===`$nextTick`||t===`$set`||t===`$delete`||t===`$slots`||t===`$refs`||t===`$parent`||t===`$options`||typeof t==`string`&&(i(S,t)||k[t]||i(O,t))||i(F,t))return!0;let n=I(e,e);return typeof t==`string`&&R(n,t).found||n&&Reflect.has(n,t)?!0:Reflect.has(e,t)},ownKeys(e){let t=/* @__PURE__ */ new Set;return Reflect.ownKeys(e).forEach(e=>{t.add(e)}),Reflect.ownKeys(S).forEach(e=>{t.add(e)}),Reflect.ownKeys(F).forEach(e=>t.add(e)),Object.keys(O).forEach(e=>t.add(e)),Object.keys(k).forEach(e=>t.add(e)),[...t]},getOwnPropertyDescriptor(e,t){if(typeof t==`string`&&i(S,t))return Object.getOwnPropertyDescriptor(S,t);if(i(F,t))return Object.getOwnPropertyDescriptor(F,t);if(Reflect.has(e,t))return Object.getOwnPropertyDescriptor(e,t);if(typeof t==`string`){if(t===`data`)return{configurable:!0,enumerable:!1,get(){return x}};if(k[t])return{configurable:!0,enumerable:!0,get(){return k[t].value},set(e){a(A,t,e)}};if(i(O,t))return{configurable:!0,enumerable:!1,value:O[t]}}}});return Object.keys(w).forEach(e=>{let t=w[e];
|
|
1
|
+
import{nextTick as e}from"../../scheduler.mjs";import{toRaw as t}from"../../reactivity/reactive/shared.mjs";import{isRef as n,ref as r}from"../../reactivity/ref.mjs";import{hasOwn as i}from"../../utils.mjs";import{setComputedValue as a}from"../internal.mjs";import{normalizeEmitEventName as o,normalizeEmitPayload as s}from"../emit.mjs";import{isNativeBridgeMethod as c,markNativeBridgeMethod as l}from"../nativeBridge.mjs";import{createComputedAccessors as u}from"./computed.mjs";import{WEVU_COMPONENT_NAME_KEY as d,WEVU_HOST_COMMIT_PROMISE_KEY as f,WEVU_INLINE_MAP_KEY as p,WEVU_NATIVE_INSTANCE_KEY as m,WEVU_PARENT_INSTANCE_KEY as h,WEVU_PROPS_KEY as g,WEVU_RESOLVE_PUBLIC_INSTANCE_METHOD as _,WEVU_RUNTIME_APP_KEY as v,WEVU_RUNTIME_KEY as y}from"@weapp-core/constants";function b(b){let{state:x,setupState:S,computedDefs:C,methodDefs:w,appConfig:T,includeComputed:E,setDataStrategy:D}=b,O={},{computedRefs:k,computedSetters:A,dirtyComputedKeys:j,createTrackedComputed:M,computedProxy:N}=u({includeComputed:E,setDataStrategy:D}),P=r(0),F=Object.create(null),I=(e,n)=>{let r=t(e),i=r[y],a=i?.proxy,o=(e,t)=>{let n=e[t];return c(n)},s=t=>!(!t||typeof t!=`object`||t===e||t===n||t===a||o(t,`triggerEvent`)||o(t,`createSelectorQuery`)||o(t,`createIntersectionObserver`)||o(t,`setData`)),l=r[m];if(s(l))return l;let u=i?.instance;if(s(u))return u},L=e=>{if(i(O,e))return;let t=(...t)=>{let n=I(x,x);if(!n)return;let r=Reflect.get(n,e);if(typeof r==`function`)return r.apply(n,t)};l(t),O[e]=t},R=(e,t)=>{let n=/* @__PURE__ */ new Set,r=e;for(;r&&!n.has(r);){n.add(r);let e=r[v]?.config?.globalProperties;if(e&&i(e,t))return{found:!0,value:e[t]};r=r[h]}let a=typeof globalThis<`u`?globalThis.getApp:void 0;if(typeof a==`function`)try{let e=a()?.[v]?.config?.globalProperties;if(e&&i(e,t))return{found:!0,value:e[t]}}catch{}return{found:!1,value:void 0}},z=e=>{let t=e&&Reflect.get(e,`selectOwnerComponent`);if(typeof t==`function`)try{let n=t.call(e);if(!n||typeof n!=`object`)return;let r=Reflect.get(n,_);if(typeof r==`function`){let e=r.call(n);if(e)return e}return n[y]?.proxy??n.__wevu?.proxy??n}catch{return}},B=new Proxy(x,{get(n,r,a){if(typeof r==`string`){if(P.value,i(S,r))return Reflect.get(S,r,a);if(r===`props`){let e=n[g];if(e&&typeof e==`object`)return e}if(r===`$props`){let e=n[g];if(e&&typeof e==`object`)return e}let c=n[g];if(c&&typeof c==`object`&&i(c,r))return Reflect.get(c,r);if(r===`data`||r===`$state`)return x;if(r===`$computed`)return N;if(r===`$emit`)return(e,...t)=>{let r=I(n,a),i=r&&Reflect.get(r,`triggerEvent`);if(typeof i!=`function`)return;let{detail:c,options:l}=s(t);return i.call(r,o(e),c,l)};if(r===`$nextTick`)return async t=>{await e();let r=I(n,a),i=r&&Reflect.get(r,f);if(i&&(typeof i==`object`||typeof i==`function`)&&`then`in i&&typeof i.then==`function`&&await i,t)return t.call(B)};if(r===`$set`)return(e,t,n)=>(Reflect.set(e,t,n),n);if(r===`$delete`)return(e,t)=>Reflect.deleteProperty(e,t);if(r===`$slots`)return t(n).$slots??Object.freeze(Object.create(null));if(r===`$refs`)return t(n).$refs??Object.create(null);if(r===`$parent`)return z(I(n,a));if(r===`$options`){let e=I(n,a);return{name:e?.[d]??e?.name??e?.is}}if(i(F,r))return Reflect.get(F,r);if(i(O,r))return O[r];if(k[r])return k[r].value;if(i(T.globalProperties,r))return T.globalProperties[r];let l=R(I(n,a),r);if(l.found)return l.value}if(!Reflect.has(n,r)){let e=I(n,a);if(e&&Reflect.has(e,r)){let t=Reflect.get(e,r);return typeof t==`function`?t.bind(e):t}}let c=Reflect.get(n,r,a);return typeof r==`string`&&i(S,r)?Reflect.get(S,r,a):c},set(e,t,r,o){if(typeof t==`string`&&k[t])return a(A,t,r),!0;if(i(S,t)){let e=Reflect.get(S,t,o);return n(e)&&!n(r)?(e.value=r,!0):Reflect.set(S,t,r,o)}if(i(F,t))return Reflect.set(F,t,r);if(Reflect.has(e,t)){let a=Reflect.get(e,t,o);return n(a)&&!n(r)?(a.value=r,!0):i(e[g]??{},t)?Reflect.set(S,t,r,o):Reflect.set(e,t,r,o)}return Reflect.set(F,t,r)},has(e,t){if(t===`data`||t===`$emit`||t===`$nextTick`||t===`$set`||t===`$delete`||t===`$slots`||t===`$refs`||t===`$parent`||t===`$options`||typeof t==`string`&&(i(S,t)||k[t]||i(O,t))||i(F,t))return!0;let n=I(e,e);return typeof t==`string`&&R(n,t).found||n&&Reflect.has(n,t)?!0:Reflect.has(e,t)},ownKeys(e){let t=/* @__PURE__ */ new Set;return Reflect.ownKeys(e).forEach(e=>{t.add(e)}),Reflect.ownKeys(S).forEach(e=>{t.add(e)}),Reflect.ownKeys(F).forEach(e=>t.add(e)),Object.keys(O).forEach(e=>t.add(e)),Object.keys(k).forEach(e=>t.add(e)),[...t]},getOwnPropertyDescriptor(e,t){if(typeof t==`string`&&i(S,t))return Object.getOwnPropertyDescriptor(S,t);if(i(F,t))return Object.getOwnPropertyDescriptor(F,t);if(Reflect.has(e,t))return Object.getOwnPropertyDescriptor(e,t);if(typeof t==`string`){if(t===`data`)return{configurable:!0,enumerable:!1,get(){return x}};if(k[t])return{configurable:!0,enumerable:!0,get(){return k[t].value},set(e){a(A,t,e)}};if(i(O,t))return{configurable:!0,enumerable:!1,value:O[t]}}}});return Object.keys(w).forEach(e=>{let t=w[e];typeof t==`function`?O[e]=(...e)=>t.apply(B,e):e===p&&t&&typeof t==`object`&&(O[e]=t)}),L(`triggerEvent`),L(`createSelectorQuery`),L(`createIntersectionObserver`),L(`setData`),Object.keys(C).forEach(e=>{let t=C[e];if(typeof t==`function`)k[e]=M(e,()=>t.call(B));else{let n=t.get?.bind(B);if(!n)throw Error(`计算属性 "${e}" 需要提供 getter`);let r=t.set?.bind(B);r?(A[e]=r,k[e]=M(e,n,r)):k[e]=M(e,n)}}),{boundMethods:O,computedRefs:k,computedSetters:A,dirtyComputedKeys:j,computedProxy:N,publicInstance:B,touchSetupMethodsVersion(){P.value+=1}}}export{b as createRuntimeContext};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function e(e){return e!==`patch`&&e!==`diff`}function t(t){if(t!==`off`)return n=>{if(t===`fallback`&&!e(n.reason))return;let r=typeof n.bytes==`number`?n.bytes:n.estimatedBytes,i=typeof r==`number`?`${r}B`:`unknown`,a=[`mode=${n.mode}`,`reason=${n.reason}`,`pending=${n.pendingPatchKeys}`,`keys=${n.payloadKeys}`,`bytes=${i}`];if(typeof n.revision==`number`&&a.push(`revision=${n.revision}`),typeof n.committedRevision==`number`&&a.push(`committedRevision=${n.committedRevision}`),typeof n.mergedSiblingParents==`number`&&a.push(`mergedParents=${n.mergedSiblingParents}`),typeof n.computedDirtyKeys==`number`&&a.push(`computedDirty=${n.computedDirtyKeys}`),typeof n.flushCount==`number`&&a.push(`flushes=${n.flushCount}`),typeof n.windowMs==`number`&&a.push(`window=${n.windowMs}ms`),n.targetLabel&&a.push(`target=${n.targetLabel}`),n.bindings?.length){let e=n.bindings.map(e=>{let t=e.sourceLocation?.start;return t?`${e.id}@${e.sourceFile}:${t.line}:${t.column}`:`${e.id}@${e.sourceFile}`});a.push(`bindings=${e.join(`,`)}`)}n.message&&a.push(`message=${n.message}`);let o=`[wevu:setData] ${a.join(` `)}`;
|
|
1
|
+
function e(e){return e!==`patch`&&e!==`diff`}function t(t){if(t!==`off`)return n=>{if(t===`fallback`&&!e(n.reason))return;let r=n.phase?n.phase.dispatch?.payloadBytes:typeof n.bytes==`number`?n.bytes:n.estimatedBytes,i=typeof r==`number`?`${r}B`:`unknown`,a=[`mode=${n.mode}`,`reason=${n.reason}`,`pending=${n.pendingPatchKeys}`,`keys=${n.payloadKeys}`,`bytes=${i}`];if(typeof n.revision==`number`&&a.push(`revision=${n.revision}`),typeof n.committedRevision==`number`&&a.push(`committedRevision=${n.committedRevision}`),n.phase){let e=n.phase;a.push(`phase=${e.name}`,`observer=${e.observerId}`,`result=${e.result}`,`completion=${e.completion}`,`dispatch=${e.dispatch?.id??`unknown`}`,`prepareMs=${e.prepareDurationMs??`unknown`}`,`dispatchMs=${e.dispatch?.durationMs??`unknown`}`,`commitMs=${e.commitDurationMs??`unknown`}`,`visibleAt=unknown`)}if(typeof n.mergedSiblingParents==`number`&&a.push(`mergedParents=${n.mergedSiblingParents}`),typeof n.computedDirtyKeys==`number`&&a.push(`computedDirty=${n.computedDirtyKeys}`),typeof n.flushCount==`number`&&a.push(`flushes=${n.flushCount}`),typeof n.windowMs==`number`&&a.push(`window=${n.windowMs}ms`),n.targetLabel&&a.push(`target=${n.targetLabel}`),n.bindings?.length){let e=n.bindings.map(e=>{let t=e.sourceLocation?.start;return t?`${e.id}@${e.sourceFile}:${t.line}:${t.column}`:`${e.id}@${e.sourceFile}`});a.push(`bindings=${e.join(`,`)}`)}n.message&&a.push(`message=${n.message}`);let o=`[wevu:setData] ${a.join(` `)}`;e(n.reason)?console.warn(o):console.info(o)}}export{t as createDiagnosticsLogger};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{queueJob as e}from"../../scheduler.mjs";import{effect as t,stop as n}from"../../reactivity/core.mjs";import{touchReactive as r}from"../../reactivity/reactive/patch.mjs";import{shallowReactive as i}from"../../reactivity/reactive/shallow.mjs";import{isReactive as a,reactive as o}from"../../reactivity/reactive.mjs";import{watch as ee}from"../../reactivity/watch.mjs";import{requireRuntimeCapability as s}from"../capabilities.mjs";import{hasOwn as c}from"../../utils.mjs";import{createBindModel as te}from"../bindModel.mjs";import{hasTrackableSetupBinding as ne,touchSetupBinding as re}from"../setupTracking.mjs";import{createRuntimeContext as ie}from"./context.mjs";import{createDiagnosticsLogger as l}from"./diagnostics.mjs";import{createSetDataScheduler as ae}from"./setData/scheduler.mjs";import{resolveSetDataOptions as oe}from"./setDataOptions.mjs";import{WEVU_ATTRS_KEY as se,WEVU_PROPS_DERIVED_KEYS_KEY as u,WEVU_PROPS_KEY as d,WEVU_SETUP_STATE_KEY as f}from"@weapp-core/constants";function p(e,t){let n=(()=>{e()});return n.stop=()=>n(),n.pause=()=>{t?.pause?.()},n.resume=()=>{t?.resume?.()},n}function ce(e){return typeof e==`function`?e():e??{}}function m(m){let{data:le,resolvedComputed:ue,resolvedMethods:de,appConfig:
|
|
1
|
+
import{queueJob as e}from"../../scheduler.mjs";import{effect as t,stop as n}from"../../reactivity/core.mjs";import{touchReactive as r}from"../../reactivity/reactive/patch.mjs";import{shallowReactive as i}from"../../reactivity/reactive/shallow.mjs";import{isReactive as a,reactive as o}from"../../reactivity/reactive.mjs";import{watch as ee}from"../../reactivity/watch.mjs";import{requireRuntimeCapability as s}from"../capabilities.mjs";import{hasOwn as c}from"../../utils.mjs";import{createBindModel as te}from"../bindModel.mjs";import{hasTrackableSetupBinding as ne,touchSetupBinding as re}from"../setupTracking.mjs";import{createRuntimeContext as ie}from"./context.mjs";import{createDiagnosticsLogger as l}from"./diagnostics.mjs";import{createSetDataScheduler as ae}from"./setData/scheduler.mjs";import{resolveSetDataOptions as oe}from"./setDataOptions.mjs";import{WEVU_ATTRS_KEY as se,WEVU_PROPS_DERIVED_KEYS_KEY as u,WEVU_PROPS_KEY as d,WEVU_SETUP_STATE_KEY as f}from"@weapp-core/constants";function p(e,t){let n=(()=>{e()});return n.stop=()=>n(),n.pause=()=>{t?.pause?.()},n.resume=()=>{t?.resume?.()},n}function ce(e){return typeof e==`function`?e():e??{}}function m(m){let{data:le,resolvedComputed:ue,resolvedMethods:de,appConfig:fe,setDataOptions:h,bindingManifest:g}=m;return m=>{h?.strategy===`patch`&&s(`patchStrategy`,`createRuntimeMount(setData.strategy="patch")`);let _=ce(le),v=m?.__wevu_initialProps;if(_&&typeof _==`object`&&!c(_,d))try{Object.defineProperty(_,d,{value:i(Object.create(null)),configurable:!0,enumerable:!1,writable:!1})}catch{}let y=_&&typeof _==`object`?_[d]:void 0;y&&typeof y==`object`&&v&&typeof v==`object`&&Object.assign(y,v);let b=o(_),x=o(Object.create(null)),S=m?.__wevu_snapshotOmitKeys,pe=!!m?.__wevu_deferInitialSnapshot,C=m?.__wevu_initialSnapshot,w=m?.__wevu_initialState,T=new Set(S instanceof Set||Array.isArray(S)?S:[]);if(_&&typeof _==`object`&&!c(_,f))try{Object.defineProperty(_,f,{value:x,configurable:!0,enumerable:!1,writable:!1})}catch{}if(_&&typeof _==`object`&&w&&typeof w==`object`)for(let[e,t]of Object.entries(w))T.has(e)||(_[e]=t);let me=ue,he=de,E=!0,D=[],O=/* @__PURE__ */ new Set;Object.keys(b).forEach(e=>{let t=b[e];ne(t)&&O.add(e)});let{includeComputed:k,setDataStrategy:A,maxPatchKeys:j,maxPayloadBytes:M,mergeSiblingThreshold:N,mergeSiblingMaxInflationRatio:P,mergeSiblingMaxParentBytes:F,mergeSiblingSkipArray:I,computedCompare:L,computedCompareMaxDepth:R,computedCompareMaxKeys:ge,prelinkMaxDepth:_e,prelinkMaxKeys:ve,debug:z,diagnostics:B,loopWarning:V,debugWhen:ye,debugSampleRate:be,debugPhases:xe,elevateTopKeyThreshold:Se,toPlainMaxDepth:Ce,toPlainMaxKeys:we,includeFunctions:Te,functionPaths:Ee,shouldIncludeKey:De}=oe(h),H=l(B),U=B===`off`&&V?l(`fallback`):void 0,Oe=z||H||U?e=>{if(typeof z==`function`)try{z(e)}catch{}H?.(e),e.reason===`loopWarning`&&U?.(e)}:void 0,ke=B===`always`?`always`:ye,{boundMethods:Ae,computedRefs:W,computedSetters:je,dirtyComputedKeys:Me,computedProxy:Ne,publicInstance:G,touchSetupMethodsVersion:K}=ie({state:b,setupState:x,computedDefs:me,methodDefs:he,appConfig:fe,includeComputed:k,setDataStrategy:A}),q=m??{setData:()=>{}},Pe=q.__wevu_targetLabel,J,Y={state:b,setupState:x,snapshotOmitKeys:T,computedRefs:W,dirtyComputedKeys:Me,includeComputed:k,setDataStrategy:A,computedCompare:L,computedCompareMaxDepth:R,computedCompareMaxKeys:ge,currentAdapter:q,shouldIncludeKey:De,maxPatchKeys:j,maxPayloadBytes:M,mergeSiblingThreshold:N,mergeSiblingMaxInflationRatio:P,mergeSiblingMaxParentBytes:F,mergeSiblingSkipArray:I,elevateTopKeyThreshold:Se,prelinkMaxDepth:_e,prelinkMaxKeys:ve,toPlainMaxDepth:Ce,toPlainMaxKeys:we,includeFunctions:Te,functionPaths:Ee,debug:Oe,debugWhen:ke,debugSampleRate:be,debugPhases:xe,bindingManifest:g,loopWarning:V,targetLabel:Pe,runTracker:()=>J?.(),isMounted:()=>E,initialSnapshot:C&&typeof C==`object`?C:void 0,initialState:w&&typeof w==`object`?w:void 0},X=A===`patch`?s(`patchStrategy`,`createRuntimeMount(setData.strategy="patch")`).createScheduler(Y):ae(Y),Z=()=>X.job(),Q=()=>{J?.(),X.job()};J=t(()=>{r(b);let e=b[d];a(e)&&r(e);let t=b[se];a(t)&&r(t),O.forEach(e=>{let t=x[e]??b[e];re(t)})},{lazy:!0,scheduler:()=>e(Z)}),pe||Z(),D.push(p(()=>n(J))),X.start?.(),X.dispose&&D.push(p(X.dispose));function Fe(e,t,n){let r=ee(e,(e,n)=>t(e,n),n);return D.push(r),p(()=>{r();let e=D.indexOf(r);e>=0&&D.splice(e,1)},r)}let $={get state(){return b},get setupState(){return x},get proxy(){return G},get methods(){return Ae},get computed(){return Ne},get adapter(){return q},bindModel:te(G,b,W,je,x),watch:Fe,snapshot:()=>X.snapshot(),unmount:()=>{if(E){E=!1,X.dispose?.();try{q.__wevu_disposeSetData?.()}catch{}D.forEach(e=>{try{e()}catch{}}),D.length=0}}};try{Object.defineProperty($,"__wevu_touchSetupMethodsVersion",{value:K,configurable:!0,enumerable:!1,writable:!1})}catch{$.__wevu_touchSetupMethodsVersion=K}try{Object.defineProperty($,"__wevu_flushSetupSnapshotSync",{value:Q,configurable:!0,enumerable:!1,writable:!1})}catch{$.__wevu_flushSetupSnapshotSync=Q}try{Object.defineProperty($,"__wevu_cloneDispatchedSnapshot",{value:X.cloneLatestSnapshot,configurable:!0,enumerable:!1,writable:!1})}catch{$.__wevu_cloneDispatchedSnapshot=X.cloneLatestSnapshot}try{Object.defineProperty($,"__wevu_trackSetupReactiveKey",{value:e=>{O.add(e)},configurable:!0,enumerable:!1,writable:!1})}catch{$.__wevu_trackSetupReactiveKey=e=>{O.add(e)}}try{Object.defineProperty($,u,{value:T,configurable:!0,enumerable:!1,writable:!1})}catch{$[u]=T}return $}}export{m as createRuntimeMount};
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { MiniProgramAdapter } from "../../types/miniprogram.mjs";
|
|
2
2
|
import "../../types.mjs";
|
|
3
|
+
import { PhysicalSetDataObserver } from "./observation.mjs";
|
|
3
4
|
//#region src/runtime/app/setData/commitTracker.d.ts
|
|
4
5
|
export type SetDataPayload = Record<string, unknown>;
|
|
5
6
|
export type SetDataAdapterSettlement = 'committed' | 'failed' | 'abandoned';
|
|
6
7
|
export type SetDataAdapterSettler = (settlement: SetDataAdapterSettlement, cause?: unknown) => void;
|
|
7
8
|
export interface CommitAwareSetDataAdapter extends MiniProgramAdapter {
|
|
8
|
-
__wevu_dispatchSetData?: (payload: SetDataPayload, settle: SetDataAdapterSettler) => void;
|
|
9
|
+
__wevu_dispatchSetData?: (payload: SetDataPayload, settle: SetDataAdapterSettler, observer?: PhysicalSetDataObserver) => void;
|
|
9
10
|
__wevu_reportSetDataError?: (error: Error) => void;
|
|
10
11
|
__wevu_disposeSetData?: () => void;
|
|
11
12
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{observePhysicalDispatch as e}from"./observation.mjs";import{cloneSnapshotValue as t}from"./snapshot.mjs";const n=Promise.resolve();function r(e){return!(!e||typeof e!=`object`&&typeof e!=`function`||typeof e.then!=`function`)}function i(e){try{return e instanceof Error?e.message:String(e)}catch{return`<unprintable cause>`}}function a(e,t,n){let r=i(n),a=/* @__PURE__ */ Error(`[wevu] setData commit failed (${e===`adapter`?`adapter failure`:`out-of-order completion`}, revision=${t.revision}, mode=${t.mode}, kind=${t.kind}): ${r}`);return a.cause=n,a}function o(t){let n=!1,i=!0,a=!1,o=!1,s=!1,c=t.completion,l=(e,r)=>{n||(n=!0,t.observer?.complete(c),t.settle(e,r))},u=()=>{i?a=!0:s||t.completion===`callback`&&l(`committed`)};try{t.observer&&t.payload&&e(t.observer,t.payload);let n=t.invoke(u),d=r(n);if(s=d,i=!1,t.observer&&!o&&(o=!0,t.observer.returned(Date.now())),d){c=`promise`,n.then(()=>l(`committed`),e=>l(`failed`,e));return}(t.completion===`return`||a)&&l(`committed`)}catch(e){c=`throw`,i=!1,t.observer&&!o&&(o=!0,t.observer.returned(Date.now())),l(`failed`,e)}}function s(e){let r=e.initialSnapshot?t(e.initialSnapshot):{},i=new Set(Object.keys(r)),s=0,c=0,l,u;function d(e){return e.inLedger?(e.commitPromise||(e.commitPromise=new Promise(t=>{e.resolveCommit=t})),e.commitPromise):n}let f={preparedSnapshot:r,dispatchedSnapshot:r,committedSnapshot:r,revision:0,committedRevision:0,failedRevision:void 0,needsFullSnapshot:!1,get commitPromise(){return u?d(u):n},disposed:!1},p=(t,n,r)=>{let i=a(t,n,r);try{e.onFailure({kind:t,revision:n.revision,committedRevision:f.committedRevision,mode:n.mode,cause:r,error:i,payloadKeys:n.payloadKeys,pendingPatchKeys:n.pendingPatchKeys})}catch{}},m=e=>{e.resolveCommit?.(),e.resolveCommit=void 0},h=e=>{let t=l;for(;t;){let n=t.next;if(t.inLedger=!1,t.next=void 0,m(t),t===e){l=n,l||(u=void 0);return}t=n}},g=()=>{let e,t=f.disposed?`disposed`:`abandoned`,n=l;for(;n;){let t=n.next;n.inLedger=!1,n.next=void 0,n.physicalSettled||(n.status=`abandoned`,n.observation&&(e??(e=[])).push(n.observation)),m(n),n=t}l=void 0,u=void 0,s+=1,c=f.committedRevision,e?.forEach(e=>e.finish(t))},_=()=>{f.needsFullSnapshot=!0},v=(e,t,n)=>{t.status=`failed`,f.failedRevision=t.revision,_(),g(),p(e,t,n)},y=()=>{for(;l?.status===`succeeded`;){let e=l;f.committedSnapshot=e.snapshot,f.committedRevision=e.revision,l=e.next,e.inLedger=!1,e.next=void 0,m(e)}l||(u=void 0)},b=e=>{f.committedSnapshot=e.snapshot,f.committedRevision=e.revision,f.failedRevision=void 0,f.needsFullSnapshot=!1,h(e),y()},x=(e,t,n)=>{t===`failed`?p(`adapter`,e,n):t===`committed`&&f.committedRevision>e.revision&&(l&&g(),_(),p(`out-of-order`,e,`revision ${e.revision} completed after committed revision ${f.committedRevision}`))},S=(e,t,n)=>{f.disposed||e.physicalSettled||(e.physicalSettled=!0,!e.inLedger||e.epoch!==s?x(e,t,n):t===`abandoned`?(e.status=`abandoned`,_(),g()):t===`failed`?v(`adapter`,e,n):(e.status=`succeeded`,c>e.revision?v(`out-of-order`,e,`revision ${e.revision} completed after revision ${c}`):(c=e.revision,e.kind===`full`?b(e):y())))},C=(e,t,n)=>{if(f.disposed||e.physicalSettled)return;if(!e.observation){S(e,t,n);return}let r=!e.inLedger||e.epoch!==s,i=t===`committed`&&(r?f.committedRevision>e.revision:c>e.revision);S(e,t,n),e.observation?.finish(i?`out-of-order`:r?t===`failed`?`late-failed`:t===`committed`?`late-committed`:`abandoned`:t)};return{state:f,dispatch:n=>{if(f.disposed)return f.revision;let r=f.revision+1;f.revision=r,f.preparedSnapshot=n.snapshot;let a={revision:r,epoch:s,mode:n.mode,kind:n.kind,snapshot:n.snapshot,payloadKeys:Object.keys(n.payload).length,pendingPatchKeys:n.pendingPatchKeys,status:`dispatched`,physicalSettled:!1,inLedger:!0,next:void 0};u?u.next=a:l=a,u=a,f.dispatchedSnapshot=n.snapshot;for(let e of Object.keys(n.payload))i.add(e.split(`.`,1)[0]);a.observation=e.observe?.(n,r);let c=(e,t)=>{C(a,e,t)},d=t(n.payload);if(typeof e.adapter.__wevu_dispatchSetData==`function`)try{e.adapter.__wevu_dispatchSetData(d,c,a.observation?.physical)}catch(e){c(`failed`,e)}else o({invoke:()=>e.adapter.setData?.(d),completion:`return`,settle:c,payload:d,observer:e.adapter.setData?a.observation?.physical:void 0});return r},createFullPayload:e=>{let t={},n=new Set(Object.keys(e));for(let[n,r]of Object.entries(e))t[n]=r===void 0?null:r;for(let e of i)n.has(e)||(t[e]=null);return t},dispose:()=>{f.disposed||(f.disposed=!0,g())}}}export{s as createSetDataCommitTracker,o as observeSetDataCompletion};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { SetDataDebugInfo } from "../../types/setData.mjs";
|
|
2
|
+
import "../../types.mjs";
|
|
3
|
+
import "./commitTracker.mjs";
|
|
4
|
+
//#region src/runtime/app/setData/observation.d.ts
|
|
5
|
+
type Phase = NonNullable<SetDataDebugInfo['phase']>;
|
|
6
|
+
export type SetDataCompletionBoundary = Phase['completion'];
|
|
7
|
+
export interface PhysicalSetDataObserver {
|
|
8
|
+
dispatch: (dispatch: NonNullable<Phase['dispatch']>) => void;
|
|
9
|
+
returned: (returnedAt: number) => void;
|
|
10
|
+
complete: (boundary: SetDataCompletionBoundary) => void;
|
|
11
|
+
}
|
|
12
|
+
//#endregion
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
let e=0,t=0;function n(e,t){return e!==null&&t>=e?t-e:null}function r(e){try{let t=JSON.stringify(e),n=0;for(let e=0;e<t.length;e++){let r=t.charCodeAt(e);r<128?n+=1:r<2048?n+=2:r>=55296&&r<=56319&&t.charCodeAt(e+1)>=56320&&t.charCodeAt(e+1)<=57343?(n+=4,e+=1):n+=3}return n}catch{return null}}function i(e,n){let i=r(n);e.dispatch({id:++t,startedAt:Date.now(),payloadBytes:i,returnedAt:null,durationMs:null})}function a(t){let r=++e,i=null;return{prepare(){i=Date.now()},revision(e,a){let o=i;if(i=null,t.debugWhen===`fallback`&&(e.reason===`patch`||e.reason===`diff`)||t.debugSampleRate<=0||t.debugSampleRate<1&&Math.random()>=t.debugSampleRate)return;let s=Date.now(),c=null,l=`unknown`,u={mode:e.mode,reason:e.reason,pendingPatchKeys:e.pendingPatchKeys,payloadKeys:Object.keys(e.payload).length,revision:a,targetLabel:t.targetLabel},d=(e,i,a=null)=>{try{t.debug({...u,committedRevision:t.committedRevision(),phase:{version:1,observerId:r,name:e,result:i,completion:l,prepareStartedAt:o,preparedAt:s,prepareDurationMs:n(o,s),settledAt:a,commitDurationMs:a===null?null:n(c?.startedAt??null,a),visibleAt:null,dispatch:c?{...c}:null}})}catch{}};return d(`prepare`,`prepared`),{physical:{dispatch(e){c=e},returned(e){c&&(c={...c,returnedAt:e,durationMs:n(c.startedAt,e)},d(`dispatch`,`pending`))},complete(e){(c||e===`throw`)&&(l=e)}},finish(e){d(`commit`,e,Date.now())}}}}}export{a as createSetDataObservation,i as observePhysicalDispatch};
|
|
@@ -35,6 +35,7 @@ export interface SetDataSchedulerOptions {
|
|
|
35
35
|
debug: ((info: SetDataDebugInfo) => void) | undefined;
|
|
36
36
|
debugWhen: 'fallback' | 'always';
|
|
37
37
|
debugSampleRate: number;
|
|
38
|
+
debugPhases?: boolean;
|
|
38
39
|
bindingManifest?: WevuRuntimeBindingManifestV1;
|
|
39
40
|
loopWarning: false | {
|
|
40
41
|
sampleWindowMs: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{toRaw as e}from"../../../reactivity/reactive/shared.mjs";import{getReactiveVersion as t,isReactive as n}from"../../../reactivity/reactive.mjs";import{isRef as r}from"../../../reactivity/ref.mjs";import{hasOwn as i}from"../../../utils.mjs";import{hasTrackableSetupBinding as a}from"../../setupTracking.mjs";import{resolveBindingDiagnostics as o}from"../../bindingManifest.mjs";import{diffSnapshots as s,toPlain as c}from"../../diff.mjs";import{
|
|
1
|
+
import{toRaw as e}from"../../../reactivity/reactive/shared.mjs";import{getReactiveVersion as t,isReactive as n}from"../../../reactivity/reactive.mjs";import{isRef as r}from"../../../reactivity/ref.mjs";import{hasOwn as i}from"../../../utils.mjs";import{hasTrackableSetupBinding as a}from"../../setupTracking.mjs";import{resolveBindingDiagnostics as o}from"../../bindingManifest.mjs";import{diffSnapshots as s,toPlain as c}from"../../diff.mjs";import{createSetDataObservation as l}from"./observation.mjs";import{collectSnapshot as u}from"./snapshot.mjs";import{createSetDataCommitTracker as d}from"./commitTracker.mjs";function f(f){let{state:p,setupState:m,snapshotOmitKeys:h,computedRefs:g,dirtyComputedKeys:_,includeComputed:v,setDataStrategy:y,currentAdapter:b,shouldIncludeKey:x,toPlainMaxDepth:S,toPlainMaxKeys:C,includeFunctions:w=!1,functionPaths:T,debug:E,debugWhen:D,debugSampleRate:O,bindingManifest:k,loopWarning:A,targetLabel:j,runTracker:M,isMounted:ee,initialSnapshot:N,initialState:P}=f,F=/* @__PURE__ */ new WeakMap,I=/* @__PURE__ */ new WeakMap,L={},R=Object.create(null),z=Object.create(null),B=[],V=-1/0,H=new Set(P&&typeof P==`object`?Object.keys(P):[]),U=e=>{if(Object.prototype.toString.call(e)!==`[object Object]`)return!1;let t=Object.getPrototypeOf(e);return t===null||t===Object.prototype},W=(e,t)=>{if(Object.is(e,t))return!0;if(Array.isArray(e)&&Array.isArray(t))return e.length===t.length&&e.every((e,n)=>W(e,t[n]));if(U(e)&&U(t)){let n=Object.keys(e),r=Object.keys(t);return n.length===r.length&&n.every(n=>i(t,n)&&W(e[n],t[n]))}return!1},G=i=>{let o=r(i)?i.value:i;if(typeof o!=`object`||!o)return o;if(!n(o)&&a(o))return{snapshot:c(o,/* @__PURE__ */ new WeakMap,{cacheEligibility:I,maxDepth:S,maxKeys:C,includeFunctions:w,functionPaths:T})};let s=n(o)?e(o):o;return{raw:s,version:t(s)}},K=(e,t)=>Object.is(e,t)?!0:!e||!t||typeof e!=`object`||typeof t!=`object`||!i(e,`raw`)||!i(t,`raw`)?e&&t&&typeof e==`object`&&typeof t==`object`&&i(e,`snapshot`)&&i(t,`snapshot`)?W(e.snapshot,t.snapshot):!1:e.raw===t.raw&&e.version===t.version,q=e=>x(e)&&!h?.has(e);if(N)for(let[e,t]of Object.entries(N))q(e)&&(L[e]=t);let te=()=>{if(!N)return;let t=n(p)?e(p):p,r=m&&typeof m==`object`?n(m)?e(m):m:void 0;for(let e of Object.keys(N))if(q(e)){if(r&&i(r,e))R[e]=G(r[e]);else if(i(t,e)){if(H.has(e))continue;t[e]=N[e],R[e]=G(t[e])}}},ne=t=>{let a=[],o=m&&typeof m==`object`?n(m)?e(m):m:void 0;for(let n of/* @__PURE__ */ new Set([...Object.keys(p),...o?Object.keys(o):[]])){if(!q(n))continue;let s=o&&i(o,n)?o[n]:p[n],c=r(s)?s.value:s;c&&typeof c==`object`&&e(c)===t&&a.push(n)}return a},J=(e,t)=>{if(!E)return;let n=e.reason!==`patch`&&e.reason!==`diff`;if(D===`fallback`&&!n||e.reason!==`commitFailure`&&O<1&&Math.random()>O)return;let r=e;if(k){let n=typeof t==`function`?t():t??[],i=e.reason===`needsFullSnapshot`||e.reason===`maxPatchKeys`||e.reason===`maxPayloadBytes`;r={...e,bindings:o(k,n,i)}}try{E(r)}catch{}},Y,X=f.debugPhases&&E?l({debug:E,debugWhen:D,debugSampleRate:O,targetLabel:j,committedRevision:()=>Y.state.committedRevision}):void 0;Y=d({observe:X?.revision,initialSnapshot:L,adapter:b,onFailure:e=>{J({mode:e.mode,reason:`commitFailure`,pendingPatchKeys:e.pendingPatchKeys,payloadKeys:e.payloadKeys,revision:e.revision,committedRevision:e.committedRevision,targetLabel:j,message:e.error.message});try{b.__wevu_reportSetDataError?.(e.error)}catch{}}});let re=(e=0,t)=>{if(!A)return;let n=Date.now();B.push(n);let r=n-A.sampleWindowMs;for(;B.length&&B[0]<r;)B.shift();B.length<=A.maxFlushes||A.coolDownMs>0&&n-V<A.coolDownMs||(V=n,J({mode:y,reason:`loopWarning`,pendingPatchKeys:e,payloadKeys:0,computedDirtyKeys:v?_.size:0,flushCount:B.length,windowMs:A.sampleWindowMs,targetLabel:j,message:`${j?`${j} `:``}疑似运行时更新循环:${B.length} 次 setData flush/${A.sampleWindowMs}ms`},t))},Z=()=>u({state:p,setupState:m,computedRefs:g,includeComputed:v,shouldIncludeKey:q,plainCache:F,plainCacheEligibility:I,toPlainMaxDepth:S,toPlainMaxKeys:C,includeFunctions:w,functionPaths:T});te();let ie=()=>{let t=n(p)?e(p):p,r=m&&typeof m==`object`?n(m)?e(m):m:void 0,a=Y.state.dispatchedSnapshot,o={...a},s=/* @__PURE__ */ new WeakMap,l=/* @__PURE__ */ new Set,u=/* @__PURE__ */ new Set,d=/* @__PURE__ */ new Set;for(let e of/* @__PURE__ */ new Set([...Object.keys(t),...r?Object.keys(r):[]])){if(!q(e))continue;l.add(e);let n=r&&i(r,e)?r:t,u=G(n[e]),f=R[e];f&&u&&typeof f==`object`&&typeof u==`object`&&i(f,`raw`)&&i(u,`raw`)&&Array.isArray(f.raw)&&Array.isArray(u.raw)&&f.raw!==u.raw&&d.add(e),(!K(f,u)||!i(a,e))&&(o[e]=c(n[e],s,{cache:F,cacheEligibility:I,maxDepth:S,maxKeys:C,includeFunctions:w,functionPaths:T,_path:e})),R[e]=u}for(let e of Object.keys(R))l.has(e)||(delete R[e],(!v||!i(g,e))&&delete o[e]);if(!v){for(let e of Object.keys(z))delete z[e];return{snapshot:o,replacedTopLevelKeys:d}}for(let e of Object.keys(g)){if(!q(e))continue;u.add(e);let t=g[e].value,n=G(t);(!K(z[e],n)||!i(a,e))&&(o[e]=c(t,s,{cache:F,cacheEligibility:I,maxDepth:S,maxKeys:C,includeFunctions:w,functionPaths:T,_path:e})),z[e]=n}for(let e of Object.keys(z))u.has(e)||(delete z[e],(!i(t,e)||!q(e))&&delete o[e]);return{snapshot:o,replacedTopLevelKeys:d}},Q=(e=`diff`,t=0,n)=>{let r=y===`diff`?ie():void 0,i=r?.snapshot??Z(),a=Y.state.dispatchedSnapshot,o=Y.state.needsFullSnapshot,c=o?Y.createFullPayload(i):r?(()=>{let e={};for(let t of r.replacedTopLevelKeys)e[t]=i[t];return{...s(a,i,{skipKeys:r.replacedTopLevelKeys}),...e}})():s(a,i);n?.(i);let l=Object.keys(c).length;if(!l&&!o)return;let u=o?`needsFullSnapshot`:e;J({mode:`diff`,reason:u,pendingPatchKeys:t,payloadKeys:l},Object.keys(c)),Y.dispatch({mode:`diff`,kind:o?`full`:`delta`,reason:u,snapshot:i,payload:c,pendingPatchKeys:t})},$=(e=0,t)=>ee()?(X?.prepare(),re(e,t),M(),!0):!1;return{collect:Z,emitDebug:J,getLatestSnapshot:()=>Y.state.dispatchedSnapshot,dispatchUpdate:Y.dispatch,needsFullSnapshot:()=>Y.state.needsFullSnapshot,job:e=>{if($())return Q(`diff`)},plainCache:F,plainCacheEligibility:I,prepareJob:$,resolveTopKeysByRoot:ne,runDiffUpdate:Q,shouldIncludeSnapshotKey:q,snapshot:()=>y===`patch`?Z():{...Y.state.dispatchedSnapshot},cloneLatestSnapshot:()=>({...Y.state.dispatchedSnapshot}),dispose:Y.dispose}}export{f as createSetDataScheduler};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function e(e){let t=e?.includeComputed??!0,n=e?.suspendWhenHidden??!1,r=e?.strategy??`diff`,i=typeof e?.maxPatchKeys==`number`?Math.max(0,e.maxPatchKeys):1/0,a=typeof e?.maxPayloadBytes==`number`?Math.max(0,e.maxPayloadBytes):1/0,o=typeof e?.mergeSiblingThreshold==`number`?Math.max(2,Math.floor(e.mergeSiblingThreshold)):0,s=typeof e?.mergeSiblingMaxInflationRatio==`number`?Math.max(0,e.mergeSiblingMaxInflationRatio):1.25,c=typeof e?.mergeSiblingMaxParentBytes==`number`?Math.max(0,e.mergeSiblingMaxParentBytes):1/0,l=e?.mergeSiblingSkipArray??!0,u=e?.computedCompare??(r===`patch`?`deep`:`reference`),d=typeof e?.computedCompareMaxDepth==`number`?Math.max(0,Math.floor(e.computedCompareMaxDepth)):4,f=typeof e?.computedCompareMaxKeys==`number`?Math.max(0,Math.floor(e.computedCompareMaxKeys)):200,p=e?.prelinkMaxDepth,m=e?.prelinkMaxKeys,h=e?.debug,g=e?.diagnostics??`off`,_=e?.loopWarning,v=_===!1||_&&typeof _==`object`&&_.enabled===!1?!1:{sampleWindowMs:typeof _==`object`&&typeof _.sampleWindowMs==`number`?Math.max(100,Math.floor(_.sampleWindowMs)):1e3,maxFlushes:typeof _==`object`&&typeof _.maxFlushes==`number`?Math.max(1,Math.floor(_.maxFlushes)):50,coolDownMs:typeof _==`object`&&typeof _.coolDownMs==`number`?Math.max(0,Math.floor(_.coolDownMs)):5e3},y=e?.debugWhen??`fallback`,b=typeof e?.debugSampleRate==`number`?Math.min(1,Math.max(0,e.debugSampleRate)):1,x=typeof e?.elevateTopKeyThreshold==`number`?Math.max(0,Math.floor(e.elevateTopKeyThreshold)):1/0,S=typeof e?.toPlainMaxDepth==`number`?Math.max(0,Math.floor(e.toPlainMaxDepth)):1/0,C=typeof e?.toPlainMaxKeys==`number`?Math.max(0,Math.floor(e.toPlainMaxKeys)):1/0,w=!!e?.includeFunctions,T=Array.isArray(e?.functionPaths)?[...new Set(e.functionPaths.filter(e=>typeof e==`string`&&e.length>0))]:[],E=Array.isArray(e?.pick)&&e.pick.length>0?new Set(e.pick):void 0,D=Array.isArray(e?.omit)&&e.omit.length>0?new Set(e.omit):void 0;return{includeComputed:t,suspendWhenHidden:n,setDataStrategy:r,maxPatchKeys:i,maxPayloadBytes:a,mergeSiblingThreshold:o,mergeSiblingMaxInflationRatio:s,mergeSiblingMaxParentBytes:c,mergeSiblingSkipArray:l,computedCompare:u,computedCompareMaxDepth:d,computedCompareMaxKeys:f,prelinkMaxDepth:p,prelinkMaxKeys:m,debug:h,diagnostics:g,loopWarning:v,debugWhen:y,debugSampleRate:b,elevateTopKeyThreshold:x,toPlainMaxDepth:S,toPlainMaxKeys:C,includeFunctions:w,functionPaths:T,pickSet:E,omitSet:D,shouldIncludeKey:e=>!(E&&!E.has(e)||D&&D.has(e))}}export{e as resolveSetDataOptions};
|
|
1
|
+
function e(e){let t=e?.includeComputed??!0,n=e?.suspendWhenHidden??!1,r=e?.strategy??`diff`,i=typeof e?.maxPatchKeys==`number`?Math.max(0,e.maxPatchKeys):1/0,a=typeof e?.maxPayloadBytes==`number`?Math.max(0,e.maxPayloadBytes):1/0,o=typeof e?.mergeSiblingThreshold==`number`?Math.max(2,Math.floor(e.mergeSiblingThreshold)):0,s=typeof e?.mergeSiblingMaxInflationRatio==`number`?Math.max(0,e.mergeSiblingMaxInflationRatio):1.25,c=typeof e?.mergeSiblingMaxParentBytes==`number`?Math.max(0,e.mergeSiblingMaxParentBytes):1/0,l=e?.mergeSiblingSkipArray??!0,u=e?.computedCompare??(r===`patch`?`deep`:`reference`),d=typeof e?.computedCompareMaxDepth==`number`?Math.max(0,Math.floor(e.computedCompareMaxDepth)):4,f=typeof e?.computedCompareMaxKeys==`number`?Math.max(0,Math.floor(e.computedCompareMaxKeys)):200,p=e?.prelinkMaxDepth,m=e?.prelinkMaxKeys,h=e?.debug,g=e?.diagnostics??`off`,_=e?.loopWarning,v=_===!1||_&&typeof _==`object`&&_.enabled===!1?!1:{sampleWindowMs:typeof _==`object`&&typeof _.sampleWindowMs==`number`?Math.max(100,Math.floor(_.sampleWindowMs)):1e3,maxFlushes:typeof _==`object`&&typeof _.maxFlushes==`number`?Math.max(1,Math.floor(_.maxFlushes)):50,coolDownMs:typeof _==`object`&&typeof _.coolDownMs==`number`?Math.max(0,Math.floor(_.coolDownMs)):5e3},y=e?.debugWhen??`fallback`,b=typeof e?.debugSampleRate==`number`?Math.min(1,Math.max(0,e.debugSampleRate)):1,x=typeof e?.elevateTopKeyThreshold==`number`?Math.max(0,Math.floor(e.elevateTopKeyThreshold)):1/0,S=typeof e?.toPlainMaxDepth==`number`?Math.max(0,Math.floor(e.toPlainMaxDepth)):1/0,C=typeof e?.toPlainMaxKeys==`number`?Math.max(0,Math.floor(e.toPlainMaxKeys)):1/0,w=!!e?.includeFunctions,T=Array.isArray(e?.functionPaths)?[...new Set(e.functionPaths.filter(e=>typeof e==`string`&&e.length>0))]:[],E=Array.isArray(e?.pick)&&e.pick.length>0?new Set(e.pick):void 0,D=Array.isArray(e?.omit)&&e.omit.length>0?new Set(e.omit):void 0;return{includeComputed:t,suspendWhenHidden:n,setDataStrategy:r,maxPatchKeys:i,maxPayloadBytes:a,mergeSiblingThreshold:o,mergeSiblingMaxInflationRatio:s,mergeSiblingMaxParentBytes:c,mergeSiblingSkipArray:l,computedCompare:u,computedCompareMaxDepth:d,computedCompareMaxKeys:f,prelinkMaxDepth:p,prelinkMaxKeys:m,debug:h,debugPhases:e?.debugPhases===!0,diagnostics:g,loopWarning:v,debugWhen:y,debugSampleRate:b,elevateTopKeyThreshold:x,toPlainMaxDepth:S,toPlainMaxKeys:C,includeFunctions:w,functionPaths:T,pickSet:E,omitSet:D,shouldIncludeKey:e=>!(E&&!E.has(e)||D&&D.has(e))}}export{e as resolveSetDataOptions};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{hasOwn as e}from"../../utils.mjs";import{toPlain as t}from"../diff.mjs";import{resolveSetDataOptions as n}from"../app/setDataOptions.mjs";import{WEVU_SLOT_OWNER_ID_KEY as r}from"@weapp-core/constants";var i=class extends Error{};function a(e){if(typeof e==`function`)return e;let t=e?.get;return typeof t==`function`?t:void 0}function o(e){return e.startsWith(`__wv_bind_`)||e.startsWith(`__wv_cls_`)||e.startsWith(`__wv_style_`)}function s(e,t){if(!e.startsWith(`__wv_bind_`))return!1;try{return!/\bthis\b/.test(Function.prototype.toString.call(t))}catch{return!1}}function c(e){if(e===r)return``;if(e.startsWith(`__wv_bind_`))return null;if(e.startsWith(`__wv_cls_`)||e.startsWith(`__wv_style_`))return``}function l(t,
|
|
1
|
+
import{hasOwn as e}from"../../utils.mjs";import{toPlain as t}from"../diff.mjs";import{resolveSetDataOptions as n}from"../app/setDataOptions.mjs";import{WEVU_SLOT_OWNER_ID_KEY as r}from"@weapp-core/constants";var i=class extends Error{};function a(e){if(typeof e==`function`)return e;let t=e?.get;return typeof t==`function`?t:void 0}function o(e){return e.startsWith(`__wv_bind_`)||e.startsWith(`__wv_cls_`)||e.startsWith(`__wv_style_`)}function s(e,t){if(!e.startsWith(`__wv_bind_`))return!1;try{return!/\bthis\b/.test(Function.prototype.toString.call(t))}catch{return!1}}function c(e){if(e===r)return``;if(e.startsWith(`__wv_bind_`))return null;if(e.startsWith(`__wv_cls_`)||e.startsWith(`__wv_style_`))return``}function l(t,r,i){let a=/* @__PURE__ */ new Set([...Array.isArray(r?.pick)?r.pick:[],...i?.bindings.map(e=>e.outputPath)??[]]);if(!a.size)return;let{shouldIncludeKey:o}=n(r),s={};for(let n of a){if(!o(n)||e(t,n)||n.includes(`.`)||n.includes(`[`))continue;let r=c(n);r!==void 0&&(s[n]=r)}return Object.keys(s).length?s:void 0}function u(r){let{data:c,computed:l,methods:u,setData:d}=r,f=l?Object.keys(l):[];if(!f.length)return;let{includeComputed:p,shouldIncludeKey:m,toPlainMaxDepth:h,toPlainMaxKeys:g,includeFunctions:_,functionPaths:v}=n(d);if(!p)return;let y={},b=/* @__PURE__ */ new Set,x,S=n=>{if(e(c,n)||!m(n))return{ok:!1};if(e(y,n))return{ok:!0,value:y[n]};if(b.has(n))return{ok:!1};let r=a(l[n]);if(!r)return{ok:!1};b.add(n);try{let e=r.call(x);if(e===void 0)return{ok:!1};let i=t(e,/* @__PURE__ */ new WeakMap,{maxDepth:h,maxKeys:g,includeFunctions:_,functionPaths:v,_path:n});return i===void 0?{ok:!1}:(y[n]=i,{ok:!0,value:i})}catch{return{ok:!1}}finally{b.delete(n)}};x=new Proxy(c,{get(t,n,r){if(typeof n==`string`){if(n===`data`||n===`$state`)return c;if(n===`props`||n===`$props`||n===`$attrs`)throw new i;if(e(c,n))return Reflect.get(t,n,r);if(u&&e(u,n)){let e=u[n];return typeof e==`function`?e.bind(x):e}if(l&&e(l,n)){let e=S(n);if(e.ok)return e.value;throw new i}throw new i}return Reflect.get(t,n,r)},has(t,n){return Reflect.has(t,n)||typeof n==`string`&&!!(l&&e(l,n))}});for(let e of f){let t=a(l[e]);(!o(e)||t&&s(e,t))&&S(e)}return Object.keys(y).length?y:void 0}function d(e,t,n,r,i){if(e!==void 0&&(!e||typeof e!=`object`))return e;let a=e??{},o=e===void 0?void 0:u({data:a,computed:t,methods:r,setData:n}),s=l(a,n,i);return o||s?{...a,...s,...o}:e}export{u as resolveInitialComputedData,d as resolveNativeInitialData};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{hasOwn as e}from"../../utils.mjs";import{
|
|
1
|
+
import{hasOwn as e}from"../../utils.mjs";import{WEVU_NATIVE_DECLARATION_ADDRESS_PROP as t,WEVU_NATIVE_SLOT_CONTEXT_KEY as n,WEVU_SLOT_NAMES_PROP as r,WEVU_SLOT_OWNER_ID_PROP as i,WEVU_SLOT_SCOPE_KEY as a}from"@weapp-core/constants";const o=`__wevu_allowNullPropInput`,s=`allowNullPropInput`,c=/* @__PURE__ */ new Map([[String,String],[Number,Number],[Boolean,Boolean],[Object,Object],[Array,Array],[Function,Function],[`String`,String],[`Number`,Number],[`Boolean`,Boolean],[`Object`,Object],[`Array`,Array],[`Function`,Function],[null,null],[`null`,null],[`Null`,null]]);function l(e){return c.get(e)}function u(e,t=[]){if(Array.isArray(e)){for(let n of e)u(n,t);return t}let n=l(e);return n!==void 0&&!t.includes(n)&&t.push(n),t}function d(e){if(e===void 0)return[];let t=u(e).filter(e=>e!==null);return t.length>0?t:[null]}function f(e,t){let n=d(t);if(n.length!==0&&(e.type=n[0],n.length>1)){let t=[];for(let e of n.slice(1))t.includes(e)||t.push(e);t.length>0&&(e.optionalTypes=t)}}function p(t){e(t,`value`)||(t.type===String?t.value=``:t.type===Number?t.value=0:t.type===Boolean?t.value=!1:t.type===Array&&(t.value=[]))}function m(e,t,n){if(!n||e.type===null)return;let r=t&&typeof t==`object`&&!Array.isArray(t)?t:void 0,i=u(r?[r.type,r.optionalTypes]:t),a=i.includes(null),o=i.filter(e=>e!==null).length>1,s=r?.required!==!0;(a||o||s)&&(a||p(e),e.type=null,delete e.optionalTypes)}function h(t,n){let r={};return t&&Object.entries(t).forEach(([t,i])=>{if(i!==void 0){if(i===null)r[t]={type:null};else if(Array.isArray(i)||typeof i==`function`){let a={};f(a,i),e(a,`type`)||(a.type=null),m(a,i,n),r[t]=a}else if(typeof i==`object`){if(t.endsWith(`Modifiers`)&&Object.keys(i).length===0){r[t]={type:Object,value:{}};return}let a={};if(`type`in i&&i.type!==void 0&&f(a,i.type),Array.isArray(i.optionalTypes)){let e=i.optionalTypes.map(e=>l(e)).filter(e=>e!=null);if(e.length>0){let t=Array.isArray(a.optionalTypes)?a.optionalTypes:[];for(let n of e)n!==a.type&&(t.includes(n)||t.push(n));t.length>0&&(a.optionalTypes=t)}}`observer`in i&&(typeof i.observer==`function`||typeof i.observer==`string`)&&(a.observer=i.observer);let o=`default`in i?i.default:i.value;o!==void 0&&(a.value=typeof o==`function`?o():o),e(a,`type`)||(a.type=null),m(a,i,n),r[t]=a}}}),r}function g(c,l,u){let d=!!(c[o]??c[s]),{[o]:f,[s]:p,...m}=c,g=c.properties,_=g&&typeof g==`object`&&Object.keys(g).length>0?g:void 0,v=u??_,y=!!(l||v),b=o=>{let s={...o??{}};return(!import.meta.env?.PLATFORM||import.meta.env?.PLATFORM===`weapp`)&&c[n]===!0&&(s[t]={type:Array,value:[]}),y&&(e(s,i)||(s[i]={type:String,value:``}),e(s,a)||(s[a]={type:null,value:null}),e(s,r)||(s[r]={type:null,value:null})),s};if(v){let{properties:e,...t}=m,n=v,r=h(l,d);return{...t,properties:b({...r,...n})}}return{...m,properties:b(h(l,d))}}export{g as normalizeProps};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{requireRuntimeCapability as e,runtimeCapabilityRegistry as t}from"../capabilities.mjs";import{runTeardownSteps as n}from"../teardown.mjs";import{hasOwn as r}from"../../utils.mjs";import{cloneSnapshotValue as i,isDeepEqualValue as a}from"../app/setData/snapshot.mjs";import{decodeWxmlEntities as o,resolveDatasetEventValue as s}from"../inlineDataset.mjs";import{getOwnerProxy as c,getOwnerSnapshot as l,getOwnerTarget as u,subscribeOwner as d}from"../scopedSlots.mjs";import{WEVU_BINDING_MANIFEST_KEY as f,WEVU_INLINE_HANDLER as p,WEVU_INLINE_MAP_KEY as m,WEVU_LAYOUT_HOSTS_KEY as h,
|
|
1
|
+
import{requireRuntimeCapability as e,runtimeCapabilityRegistry as t}from"../capabilities.mjs";import{runTeardownSteps as n}from"../teardown.mjs";import{hasOwn as r}from"../../utils.mjs";import{cloneSnapshotValue as i,isDeepEqualValue as a}from"../app/setData/snapshot.mjs";import{decodeWxmlEntities as o,resolveDatasetEventValue as s}from"../inlineDataset.mjs";import{getOwnerProxy as c,getOwnerSnapshot as l,getOwnerTarget as u,subscribeOwner as d}from"../scopedSlots.mjs";import{WEVU_BINDING_MANIFEST_KEY as f,WEVU_INLINE_HANDLER as p,WEVU_INLINE_MAP_KEY as m,WEVU_LAYOUT_HOSTS_KEY as h,WEVU_NATIVE_SLOT_CONTEXT_KEY as g,WEVU_OWNER_HANDLER as _,WEVU_PROPS_DERIVED_KEYS_KEY as v,WEVU_PUBLIC_RUNTIME_KEY as y,WEVU_SCOPED_SLOT_OWNER_REQUIRED_KEY as b,WEVU_SLOT_FUNCTION_TOKEN as x,WEVU_SLOT_OWNER_ID_KEY as S,WEVU_SLOT_OWNER_ID_PROP as C,WEVU_SLOT_OWNER_KEY as w,WEVU_SLOT_OWNER_PROXY_KEY as T,WEVU_SLOT_PROPS_DATA_KEY as E,WEVU_SLOT_PROPS_KEY as D,WEVU_SLOT_SCOPE_KEY as O,WEVU_TEMPLATE_REFS_KEY as k}from"@weapp-core/constants";const A=[S,C,T,w,E,D,O];function j(e){let t=e?.currentTarget?.dataset??e?.target?.dataset??{},n=s(t,`wvArgs`,e),r=[];if(Array.isArray(n))r=n;else if(typeof n==`string`)try{r=JSON.parse(n)}catch{try{r=JSON.parse(o(n))}catch{r=[]}}return Array.isArray(r)||(r=[]),r.map(t=>t===`$event`?e:t)}function M(e){if(!e||typeof e!=`object`)return{};if(Array.isArray(e)){let t={};for(let n=0;n<e.length;n+=2){let r=e[n];typeof r==`string`&&r&&(t[r]=e[n+1])}return t}return e}function N(e){return Array.isArray(e)&&e[0]===x&&typeof e[1]==`string`}function P(e,t){return(...n)=>{let r=e?.selectOwnerComponent?.(),i=r?.[p];if(typeof i!=`function`)return;let a={wd:1,wi:t[1]},o=Array.isArray(t[2])?t[2]:[],s=Array.isArray(t[3])?t[3]:[];o.forEach((e,t)=>a[`wvS${t}`]=e),s.forEach((e,t)=>a[`wvI${t}`]=e);let c={type:`wv-slot-function`,detail:n,currentTarget:{dataset:a},target:{dataset:a}};return i.call(r,c)}}function F(e,t){let n={};for(let[r,i]of Object.entries(t))n[r]=N(i)?P(e,i):i;return n}function I(e){return e?.__wevu?.proxy??e?.[y]?.proxy??e}function L(e,t){if(!t||Object.keys(t).length===0)return;let n=I(e),r={};for(let[e,i]of Object.entries(t))try{let t;typeof i==`function`?t=i.call(n):typeof i?.get==`function`&&(t=i.get.call(n)),t!==void 0&&(r[e]=t)}catch{}return r}function R(e){e?.__wevu?.__wevu_flushSetupSnapshotSync?.()}function z(e,t,n){R(e);let o=L(e,t);if(!o||typeof e?.setData!=`function`)return;let s=r(e,`__wvScopedSlotComputedSnapshot`),c=e.__wvScopedSlotComputedSnapshot??{},l={},u={};for(let[e,t]of Object.entries(o))l[e]=i(t),(n?.force||!s||!r(c,e)||!a(c[e],t,20,{keys:1e4}))&&(u[e]=t);for(let e of Object.keys(c))r(o,e)||(u[e]=null);e.__wvScopedSlotComputedSnapshot=l,Object.keys(u).length>0&&e.setData(u)}function B(e,t){let n=r(t??{},O)?t[O]:e?.properties?.[O],o=r(t??{},D)?t[D]:e?.properties?.[D],s=M(n),c=M(o),l={...s,...c},u=!r(e,`__wvSlotPropsSnapshot`)||!a(e.__wvSlotPropsSnapshot??{},l,20,{keys:1e4}),d=u||!e[E]?F(e,l):e[E];u&&(e.__wvSlotPropsSnapshot=i(l)),e[E]=d;let f=e?.__wevu?.state,p=!(!f||typeof f!=`object`||r(f,E)&&a(f[E]??{},l,20,{keys:1e4}));return f&&typeof f==`object`&&(f[E]=d),{merged:d,runtimeSnapshotChanged:p,snapshot:l,snapshotChanged:u}}function V(e,t,n){let{runtimeSnapshotChanged:r,snapshot:i,snapshotChanged:a}=B(e,n);(a||r)&&typeof e?.setData==`function`&&e.setData({[E]:i}),a&&z(e,t)}function H(e,t){let n=!1;e[T]!==t&&(e[T]=t,n=!0);let r=e?.data;if(r&&typeof r==`object`&&r[T]!==t){try{Object.defineProperty(r,T,{value:t,configurable:!0,enumerable:!1,writable:!0})}catch{r[T]=t}n=!0}let i=e?.__wevu?.state;return i&&typeof i==`object`&&i[T]!==t&&(i[T]=t,n=!0),n}function U(e){if(!e||typeof e!=`object`)return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function W(e,t,n,r){if(typeof e==`function`){n[t]=e;return}if(typeof e!=`object`||!e)return e;if(r.has(e))return;if(Array.isArray(e)){r.add(e);let i=e.map((e,i)=>{let a=W(e,`${t}.${i}`,n,r);return a===void 0?null:a});return r.delete(e),i}if(!U(e))return i(e);r.add(e);let a={};for(let[i,o]of Object.entries(e)){let e=W(o,`${t}.${i}`,n,r);e!==void 0&&(a[i]=e)}return r.delete(e),a}function G(e){let t={},n=W(e,w,t,/* @__PURE__ */ new WeakSet);return{[w]:n,...t}}function K(e,t,n,o){let s=H(e,n),{snapshotChanged:c}=B(e),l=t||{},u=!r(e,`__wvOwnerSnapshot`)||!a(e.__wvOwnerSnapshot??{},l,20,{keys:1e4});if(u){e.__wvOwnerSnapshot=i(l),e[w]=l;let t=e?.__wevu?.state;t&&typeof t==`object`&&(t[w]=l)}u&&typeof e?.setData==`function`&&e.setData(G(l)),(u||s||c)&&z(e,o)}function q(e,t,n){if(!t){typeof e?.__wvOwnerUnsub==`function`&&e.__wvOwnerUnsub(),e.__wvOwnerUnsub=void 0,e.__wvOwnerBoundId=``,H(e,void 0);return}let r=(t,r)=>{K(e,t,r,n)};e.__wvOwnerBoundId!==t&&(typeof e.__wvOwnerUnsub==`function`&&e.__wvOwnerUnsub(),e.__wvOwnerBoundId=t,e.__wvOwnerUnsub=d(t,r));let i=l(t);i&&r(i,c(t))}function J(e){return e?.properties?.[C]??e?.properties?.[S]??``}function Y(e,t){V(e,t);let n=J(e);n&&q(e,n,t)}function X(){let e={[w]:{},[E]:{}};return Object.defineProperty(e,T,{value:void 0,configurable:!0,enumerable:!1,writable:!0}),e}function Z(r){let i=r?.computed,a=r?.layoutHosts,o=r?.templateRefs;o?.length&&e(`templateRefs`,`createWevuScopedSlotComponent(templateRefs)`);let c=!!(r?.inlineMap&&Object.keys(r.inlineMap).length);c&&e(`inlineEvents`,`createWevuScopedSlotComponent(inlineMap)`),a?.length&&e(`layout`,`createWevuScopedSlotComponent(layoutHosts)`);let l=e=>{let t=J(e);return t?u(t):void 0},d={[g]:r?.[g],[b]:!0,options:{virtualHost:!0},setData:{omit:A},[v]:A,properties:{[C]:{type:String,value:``,observer(e){q(this,e||``,i)}},[S]:{type:String,value:``,observer(e){q(this,e||``,i)}},[D]:{type:null,value:null,observer(e){V(this,i,{[D]:e})}},[O]:{type:null,value:null,observer(e){V(this,i,{[O]:e})}}},data:X,lifetimes:{attached(){Y(this,i)},ready(){Y(this,i),z(this,i,{force:!0});let e=l(this);e&&o?.length&&t.templateRefs?.schedule(this,void 0,e)},detached(){let e=l(this);n([()=>{e&&o?.length&&t.templateRefs?.clear(this,e)},()=>{typeof this.__wvOwnerUnsub==`function`&&this.__wvOwnerUnsub()},()=>{this.__wvOwnerUnsub=void 0,this.__wvOwnerBoundId=``},()=>H(this,void 0)])}},methods:{[_](e){let n=this[T],r=this.__wevu?.methods?.[m];if(c){let i=t.inlineEvents?.run(n,void 0,e,r);if(i!==void 0)return i}if(!n)return;let i=e?.currentTarget?.dataset??e?.target?.dataset??{},a=s(i,`wvHandler`,e);if(typeof a!=`string`||!a)return;let o=n?.[a];if(typeof o!=`function`)return;let l=j(e);return o.apply(n,l)}}};return r?.computed&&Object.keys(r.computed).length>0&&(d.computed=r.computed),r?.inlineMap&&Object.keys(r.inlineMap).length>0&&(d.methods={...d.methods,[m]:r.inlineMap}),o?.length&&(d[k]=o),a?.length&&(d[h]=a),r?.[f]&&(d[f]=r[f]),d}export{Z as createScopedSlotOptions};
|
package/dist/runtime/define.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{applyWevuComponentDefaults as e}from"./defaults.mjs";import{requireRuntimeCapability as t}from"./capabilities.mjs";import{hasOwn as n}from"../utils.mjs";import{hasBindingOutputPath as r,resolveBindingManifest as i}from"./bindingManifest.mjs";import{applySetupResult as a,mergeSetupResultDescriptors as o}from"./define/setupResult.mjs";import{runSetupFunction as s}from"./register/setup.mjs";import{createRuntimeComponentDefinition as c}from"./define/componentDefinition.mjs";import{resolveNativeInitialData as l}from"./define/initialComputed.mjs";import{resolveVueComponentOptions as u}from"./define/options.mjs";import{applyOptionsApiProvide as d,resolveOptionsApiInjections as f}from"./define/optionsApi.mjs";import{normalizeProps as p}from"./define/props.mjs";import{WEVU_BINDING_MANIFEST_KEY as m,WEVU_CSS_MODULES_KEY as h,WEVU_FUNCTION_PROP_PATHS_KEY as g,WEVU_SCOPED_SLOT_OWNER_REQUIRED_KEY as _,WEVU_SLOT_OWNER_ID_KEY as v,WEVU_SLOT_OWNER_ID_PROP as y,WEVU_SLOT_SCOPE_KEY as b}from"@weapp-core/constants";const x=/* @__PURE__ */ new WeakMap;function S(e,t){let r={...t??{}};if(!e||typeof e!=`object`)return r;for(let[t,i]of Object.entries(e))i&&typeof i==`object`&&n(i,`value`)&&(r[t]=i.value);return r}function C(e,t){return Array.isArray(e?.pick)&&e.pick.includes(v)||t?.features?.scopedSlots===!0&&r(t,v)}function w(e){return!!e.__wevu_isPage}function T(e){let t=e.properties;return!!(t&&typeof t==`object`&&(y in t||b in t))}function E(e,t){return t?.strategy!==`patch`||!T(e)?t:{...t,strategy:`diff`}}function D(e,t=!1){let{lifecycleDefinition:n,runtimeApp:r}=c(e,t),i={__wevu_runtime:r,__wevu_options:e};return x.set(i,n),i}function O(e){return k(e,!0)}function k(n,r){let{__typeProps:c,[_]:y,data:b,computed:x,methods:T,setData:O,watch:k,setup:A,props:j,inject:M,provide:N,allowFunctionProps:P,[m]:F,[h]:I,...L}=u(e(n)),R=i(F),z=L[g],B=Array.isArray(z)?[...new Set(z.filter(e=>typeof e==`string`&&e.length>0))]:[];delete L[g];let V=E(L,P===!0?{...O??{},includeFunctions:!0,functionPaths:B}:P===!1?O:B.length?{...O??{},functionPaths:B}:O),H=new Set(B.filter(e=>!e.includes(`.`))),U=p(L,j,L.properties),W=S(U.properties,T),G=typeof b==`function`?()=>b.call(W):b,K=typeof A==`function`||M!=null||N!=null||I?((e,t)=>{I&&typeof I==`object`&&(t.instance[h]=I);let n=t?.proxy??t?.instance??Object.create(null),r=f(M,n);N!=null&&d(N,n);let i=typeof A==`function`?s(A,e,t):void 0,c=o({...r,...I??{}},i);return t&&Object.keys(c).length&&a(t.runtime,t.instance,c,{includeFunctionsInState:P===!0,functionPropPaths:P===!1?void 0:H}),c}):void 0,q=typeof G==`function`?G():G,J=q&&typeof q==`object`?Reflect.get(q,v):void 0,Y=C(V,R),X=Y?t(`scopedSlots`,`defineComponent(scoped-slot owner metadata)`):void 0,Z=Y?{...q&&typeof q==`object`?q:{},[v]:w(L)?J||X?.allocateOwnerId():J||``}:q,Q=l(Z,x,V,T),$=Q===void 0?U:{...U,data:Q};return D({scopedSlotOwnerRequired:y===!0,data:G,computed:x,methods:T,setData:V,bindingManifest:R,watch:k,setup:K,mpOptions:$},r)}function A(e){return k(e,!1)}function j(e){let t=e.__wevu_options;if(!t)throw TypeError(`无法从非 Wevu 组件定义创建独立运行时`);return D(t)}function M(e){return x.get(e)}function N(e){let t=e.allowNullPropInput??!0;O({...e,allowNullPropInput:t,__wevu_allowNullPropInput:t})}export{j as createIsolatedWevuComponentDefinition,N as createWevuComponent,A as createWevuComponentDefinition,O as defineComponent,M as getWevuComponentLifecycleDefinition};
|
|
1
|
+
import{applyWevuComponentDefaults as e}from"./defaults.mjs";import{requireRuntimeCapability as t}from"./capabilities.mjs";import{hasOwn as n}from"../utils.mjs";import{hasBindingOutputPath as r,resolveBindingManifest as i}from"./bindingManifest.mjs";import{applySetupResult as a,mergeSetupResultDescriptors as o}from"./define/setupResult.mjs";import{runSetupFunction as s}from"./register/setup.mjs";import{createRuntimeComponentDefinition as c}from"./define/componentDefinition.mjs";import{resolveNativeInitialData as l}from"./define/initialComputed.mjs";import{resolveVueComponentOptions as u}from"./define/options.mjs";import{applyOptionsApiProvide as d,resolveOptionsApiInjections as f}from"./define/optionsApi.mjs";import{normalizeProps as p}from"./define/props.mjs";import{WEVU_BINDING_MANIFEST_KEY as m,WEVU_CSS_MODULES_KEY as h,WEVU_FUNCTION_PROP_PATHS_KEY as g,WEVU_SCOPED_SLOT_OWNER_REQUIRED_KEY as _,WEVU_SLOT_OWNER_ID_KEY as v,WEVU_SLOT_OWNER_ID_PROP as y,WEVU_SLOT_SCOPE_KEY as b}from"@weapp-core/constants";const x=/* @__PURE__ */ new WeakMap;function S(e,t){let r={...t??{}};if(!e||typeof e!=`object`)return r;for(let[t,i]of Object.entries(e))i&&typeof i==`object`&&n(i,`value`)&&(r[t]=i.value);return r}function C(e,t){return Array.isArray(e?.pick)&&e.pick.includes(v)||t?.features?.scopedSlots===!0&&r(t,v)}function w(e){return!!e.__wevu_isPage}function T(e){let t=e.properties;return!!(t&&typeof t==`object`&&(y in t||b in t))}function E(e,t){return t?.strategy!==`patch`||!T(e)?t:{...t,strategy:`diff`}}function D(e,t=!1){let{lifecycleDefinition:n,runtimeApp:r}=c(e,t),i={__wevu_runtime:r,__wevu_options:e};return x.set(i,n),i}function O(e){return k(e,!0)}function k(n,r){let{__typeProps:c,[_]:y,data:b,computed:x,methods:T,setData:O,watch:k,setup:A,props:j,inject:M,provide:N,allowFunctionProps:P,[m]:F,[h]:I,...L}=u(e(n)),R=i(F),z=L[g],B=Array.isArray(z)?[...new Set(z.filter(e=>typeof e==`string`&&e.length>0))]:[];delete L[g];let V=E(L,P===!0?{...O??{},includeFunctions:!0,functionPaths:B}:P===!1?O:B.length?{...O??{},functionPaths:B}:O),H=new Set(B.filter(e=>!e.includes(`.`))),U=p(L,j,L.properties),W=S(U.properties,T),G=typeof b==`function`?()=>b.call(W):b,K=typeof A==`function`||M!=null||N!=null||I?((e,t)=>{I&&typeof I==`object`&&(t.instance[h]=I);let n=t?.proxy??t?.instance??Object.create(null),r=f(M,n);N!=null&&d(N,n);let i=typeof A==`function`?s(A,e,t):void 0,c=o({...r,...I??{}},i);return t&&Object.keys(c).length&&a(t.runtime,t.instance,c,{includeFunctionsInState:P===!0,functionPropPaths:P===!1?void 0:H}),c}):void 0,q=typeof G==`function`?G():G,J=q&&typeof q==`object`?Reflect.get(q,v):void 0,Y=C(V,R),X=Y?t(`scopedSlots`,`defineComponent(scoped-slot owner metadata)`):void 0,Z=Y?{...q&&typeof q==`object`?q:{},[v]:w(L)?J||X?.allocateOwnerId():J||``}:q,Q=l(Z,x,V,T,R),$=Q===void 0?U:{...U,data:Q};return D({scopedSlotOwnerRequired:y===!0,data:G,computed:x,methods:T,setData:V,bindingManifest:R,watch:k,setup:K,mpOptions:$},r)}function A(e){return k(e,!1)}function j(e){let t=e.__wevu_options;if(!t)throw TypeError(`无法从非 Wevu 组件定义创建独立运行时`);return D(t)}function M(e){return x.get(e)}function N(e){let t=e.allowNullPropInput??!0;O({...e,allowNullPropInput:t,__wevu_allowNullPropInput:t})}export{j as createIsolatedWevuComponentDefinition,N as createWevuComponent,A as createWevuComponentDefinition,O as defineComponent,M as getWevuComponentLifecycleDefinition};
|
package/dist/runtime/diff.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{toRaw as e}from"../reactivity/reactive/shared.mjs";import{getReactiveVersion as t,isReactive as n}from"../reactivity/reactive.mjs";import{unref as r}from"../reactivity/ref.mjs";import{isNoSetData as i}from"./noSetData.mjs";import{hasOwn as a}from"../utils.mjs";import{hasTrackableSetupBinding as o}from"./setupTracking.mjs";function s(e){if(Object.prototype.toString.call(e)!==`[object Object]`)return!1;let t=Object.getPrototypeOf(e);return t===null||t===Object.prototype}function c(e,t){if(!e||!t)return!1;let n=t;for(;n;){if(e.has(n))return!0;let t=n.lastIndexOf(`.`);if(t<0)return!1;n=n.slice(0,t)}return!1}function l(a,s,u,d,f,p,m,h,g,_){let v=r(a);if(typeof v==`bigint`){let e=Number(v);return Number.isSafeInteger(e)?e:v.toString()}if(typeof v==`symbol`)return v.toString();if(typeof v==`function`)return h||c(g,_)?v:void 0;if(typeof v!=`object`||!v)return v;if(i(v))return;let y=n(v),b=y?e(v):v,x=!!d&&y;d&&!x&&(x=f?.get(b)??!o(b),f?.set(b,x));let S=x?d:void 0;if(p<=0||m.keys<=0)return b;if(S){let e=t(b),n=S.get(b);if(n&&n.version===e)return n.value}if(u.has(b))return;if(s.has(b))return s.get(b);if(b instanceof Date)return b.getTime();if(b instanceof RegExp)return b.toString();if(b instanceof Map){let e=[];return s.set(b,e),u.add(b),b.forEach((t,n)=>{e.push([l(n,s,u,void 0,void 0,1/0,{keys:1/0},h,void 0,``),l(t,s,u,void 0,void 0,1/0,{keys:1/0},h,void 0,``)])}),u.delete(b),e}if(b instanceof Set){let e=[];return s.set(b,e),u.add(b),b.forEach(t=>{e.push(l(t,s,u,void 0,void 0,1/0,{keys:1/0},h,void 0,``))}),u.delete(b),e}if(typeof ArrayBuffer<`u`){if(b instanceof ArrayBuffer)return b.byteLength;if(ArrayBuffer.isView(b)){let e=b;if(typeof e[Symbol.iterator]==`function`){let t=[...e];return s.set(b,t),t.map(e=>l(e,s,u,void 0,void 0,1/0,{keys:1/0},h,void 0,``))}let t=[...new Uint8Array(e.buffer,e.byteOffset,e.byteLength)];return s.set(b,t),t}}if(b instanceof Error)return{name:b.name,message:b.message};if(Array.isArray(b)){let e=[];s.set(b,e),u.add(b);let n=p-1;for(let t=0;t<b.length;t+=1){let r=_?`${_}.${t}`:String(t),i=l(b[t],s,u,d,f,n,m,h,g,r);e[t]=i===void 0?null:i}return u.delete(b),S&&S.set(b,{version:t(b),value:e}),e}let C={};s.set(b,C),u.add(b);let w=p-1;for(let e of Object.keys(b)){if(--m.keys,m.keys<=0)break;let t=_?`${_}.${e}`:e,n=l(b[e],s,u,d,f,w,m,h,g,t);n!==void 0&&(C[e]=n)}return u.delete(b),S&&S.set(b,{version:t(b),value:C}),C}function u(e,t=/* @__PURE__ */ new WeakMap,n){let r=n?._depth??(typeof n?.maxDepth==`number`?Math.max(0,Math.floor(n.maxDepth)):1/0),i=n?._budget??(typeof n?.maxKeys==`number`?{keys:Math.max(0,Math.floor(n.maxKeys))}:{keys:1/0}),a=Array.isArray(n?.functionPaths)&&n.functionPaths.length?new Set(n.functionPaths):void 0;return l(e,t,/* @__PURE__ */ new WeakSet,n?.cache,n?.cacheEligibility,r,i,!!n?.includeFunctions,a,n?._path??``)}function d(e,t,n){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(!n(e[r],t[r]))return!1;return!0}function f(e,t,n){let r=Object.keys(e),i=Object.keys(t);if(r.length!==i.length)return!1;for(let i of r)if(!a(t,i)||!n(e[i],t[i]))return!1;return!0}function p(e,t){return Object.is(e,t)?!0:Array.isArray(e)&&Array.isArray(t)?d(e,t,p):s(e)&&s(t)?f(e,t,p):!1}function m(e){return e===void 0?null:e}function h(e,t,n,r){if(!p(e,t)){if(s(e)&&s(t)){for(let i of Object.keys(t))
|
|
1
|
+
import{toRaw as e}from"../reactivity/reactive/shared.mjs";import{getReactiveVersion as t,isReactive as n}from"../reactivity/reactive.mjs";import{unref as r}from"../reactivity/ref.mjs";import{isNoSetData as i}from"./noSetData.mjs";import{hasOwn as a}from"../utils.mjs";import{hasTrackableSetupBinding as o}from"./setupTracking.mjs";function s(e){if(Object.prototype.toString.call(e)!==`[object Object]`)return!1;let t=Object.getPrototypeOf(e);return t===null||t===Object.prototype}function c(e,t){if(!e||!t)return!1;let n=t;for(;n;){if(e.has(n))return!0;let t=n.lastIndexOf(`.`);if(t<0)return!1;n=n.slice(0,t)}return!1}function l(a,s,u,d,f,p,m,h,g,_){let v=r(a);if(typeof v==`bigint`){let e=Number(v);return Number.isSafeInteger(e)?e:v.toString()}if(typeof v==`symbol`)return v.toString();if(typeof v==`function`)return h||c(g,_)?v:void 0;if(typeof v!=`object`||!v)return v;if(i(v))return;let y=n(v),b=y?e(v):v,x=!!d&&y;d&&!x&&(x=f?.get(b)??!o(b),f?.set(b,x));let S=x?d:void 0;if(p<=0||m.keys<=0)return b;if(S){let e=t(b),n=S.get(b);if(n&&n.version===e)return n.value}if(u.has(b))return;if(s.has(b))return s.get(b);if(b instanceof Date)return b.getTime();if(b instanceof RegExp)return b.toString();if(b instanceof Map){let e=[];return s.set(b,e),u.add(b),b.forEach((t,n)=>{e.push([l(n,s,u,void 0,void 0,1/0,{keys:1/0},h,void 0,``),l(t,s,u,void 0,void 0,1/0,{keys:1/0},h,void 0,``)])}),u.delete(b),e}if(b instanceof Set){let e=[];return s.set(b,e),u.add(b),b.forEach(t=>{e.push(l(t,s,u,void 0,void 0,1/0,{keys:1/0},h,void 0,``))}),u.delete(b),e}if(typeof ArrayBuffer<`u`){if(b instanceof ArrayBuffer)return b.byteLength;if(ArrayBuffer.isView(b)){let e=b;if(typeof e[Symbol.iterator]==`function`){let t=[...e];return s.set(b,t),t.map(e=>l(e,s,u,void 0,void 0,1/0,{keys:1/0},h,void 0,``))}let t=[...new Uint8Array(e.buffer,e.byteOffset,e.byteLength)];return s.set(b,t),t}}if(b instanceof Error)return{name:b.name,message:b.message};if(Array.isArray(b)){let e=[];s.set(b,e),u.add(b);let n=p-1;for(let t=0;t<b.length;t+=1){let r=_?`${_}.${t}`:String(t),i=l(b[t],s,u,d,f,n,m,h,g,r);e[t]=i===void 0?null:i}return u.delete(b),S&&S.set(b,{version:t(b),value:e}),e}let C={};s.set(b,C),u.add(b);let w=p-1;for(let e of Object.keys(b)){if(--m.keys,m.keys<=0)break;let t=_?`${_}.${e}`:e,n=l(b[e],s,u,d,f,w,m,h,g,t);n!==void 0&&(C[e]=n)}return u.delete(b),S&&S.set(b,{version:t(b),value:C}),C}function u(e,t=/* @__PURE__ */ new WeakMap,n){let r=n?._depth??(typeof n?.maxDepth==`number`?Math.max(0,Math.floor(n.maxDepth)):1/0),i=n?._budget??(typeof n?.maxKeys==`number`?{keys:Math.max(0,Math.floor(n.maxKeys))}:{keys:1/0}),a=Array.isArray(n?.functionPaths)&&n.functionPaths.length?new Set(n.functionPaths):void 0;return l(e,t,/* @__PURE__ */ new WeakSet,n?.cache,n?.cacheEligibility,r,i,!!n?.includeFunctions,a,n?._path??``)}function d(e,t,n){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(!n(e[r],t[r]))return!1;return!0}function f(e,t,n){let r=Object.keys(e),i=Object.keys(t);if(r.length!==i.length)return!1;for(let i of r)if(!a(t,i)||!n(e[i],t[i]))return!1;return!0}function p(e,t){return Object.is(e,t)?!0:Array.isArray(e)&&Array.isArray(t)?d(e,t,p):s(e)&&s(t)?f(e,t,p):!1}function m(e){return e===void 0?null:e}function h(e,t,n,r){if(!p(e,t)){if(s(e)&&s(t)){for(let i of Object.keys(t))a(e,i)?h(e[i],t[i],`${n}.${i}`,r):r[`${n}.${i}`]=m(t[i]);for(let i of Object.keys(e))a(t,i)||(r[`${n}.${i}`]=null)}else Array.isArray(e)&&Array.isArray(t)&&d(e,t,p)||(r[n]=m(t))}}function g(e,t,n){let r={},i=n?.skipKeys;for(let n of Object.keys(t))i?.has(n)||h(e[n],t[n],n,r);for(let n of Object.keys(e))i?.has(n)||a(t,n)||(r[n]=null);return r}export{g as diffSnapshots,u as toPlain};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{getCurrentMiniProgramPages as e}from"../platform.mjs";import{getCurrentInstance as t}from"../hooks/base.mjs";import{runtimeCapabilityRegistry as n}from"../capabilities.mjs";import{registerPageLayoutBridge as r,registerRuntimeLayoutHosts as i,resolveLayoutBridge as a,resolveLayoutHost as o,unregisterPageLayoutBridge as s,unregisterRuntimeLayoutHosts as c,useLayoutBridge as l,useLayoutHosts as u,waitForLayoutHost as d}from"../layoutBridge.mjs";import{getCurrentPageInstance as f}from"../register/component/lifecycle/platform.mjs";import{resolveRuntimePageLayoutName as p,setPageLayout as m,syncRuntimePageLayoutState as h,syncRuntimePageLayoutStateFromRuntime as g,usePageLayout as _}from"../pageLayout.mjs";import{installLayout as v}from"./layout.mjs";const y=(...e)=>(v(),r(...e)),b=(...e)=>(v(),s(...e)),x=(...e)=>(v(),a(...e)),S=(...e)=>(v(),o(...e)),C=(...e)=>(v(),d(...e)),w=(...e)=>(v(),l(...e)),T=(...e)=>(v(),i(...e)),E=(...e)=>(v(),c(...e)),D=(...e)=>(v(),u(...e)),O=(...e)=>(v(),_(...e));function k(r,i){v();let a=e(),o=t(),s=o&&typeof o.route==`string`&&o.route?o:f()??a[a.length-1];
|
|
1
|
+
import{getCurrentMiniProgramPages as e}from"../platform.mjs";import{getCurrentInstance as t}from"../hooks/base.mjs";import{runtimeCapabilityRegistry as n}from"../capabilities.mjs";import{registerPageLayoutBridge as r,registerRuntimeLayoutHosts as i,resolveLayoutBridge as a,resolveLayoutHost as o,unregisterPageLayoutBridge as s,unregisterRuntimeLayoutHosts as c,useLayoutBridge as l,useLayoutHosts as u,waitForLayoutHost as d}from"../layoutBridge.mjs";import{getCurrentPageInstance as f}from"../register/component/lifecycle/platform.mjs";import{resolveRuntimePageLayoutName as p,setPageLayout as m,syncRuntimePageLayoutState as h,syncRuntimePageLayoutStateFromRuntime as g,usePageLayout as _}from"../pageLayout.mjs";import{installLayout as v}from"./layout.mjs";const y=(...e)=>(v(),r(...e)),b=(...e)=>(v(),s(...e)),x=(...e)=>(v(),a(...e)),S=(...e)=>(v(),o(...e)),C=(...e)=>(v(),d(...e)),w=(...e)=>(v(),l(...e)),T=(...e)=>(v(),i(...e)),E=(...e)=>(v(),c(...e)),D=(...e)=>(v(),u(...e)),O=(...e)=>(v(),_(...e));function k(r,i){v();let a=e(),o=t(),s=o&&typeof o.route==`string`&&o.route?o:f()??a[a.length-1];s&&n.layout?.attachPageSetter(s),r===!1?m(!1):m(r,i)}const A=(...e)=>(v(),h(...e)),j=(...e)=>(v(),g(...e)),M=(...e)=>(v(),p(...e));export{y as registerPageLayoutBridge,T as registerRuntimeLayoutHosts,x as resolveLayoutBridge,S as resolveLayoutHost,M as resolveRuntimePageLayoutName,k as setPageLayout,A as syncRuntimePageLayoutState,j as syncRuntimePageLayoutStateFromRuntime,b as unregisterPageLayoutBridge,E as unregisterRuntimeLayoutHosts,w as useLayoutBridge,D as useLayoutHosts,O as usePageLayout,C as waitForLayoutHost};
|
|
@@ -2,7 +2,7 @@ import { ComputedDefinitions } from "../types/core.mjs";
|
|
|
2
2
|
import "../types.mjs";
|
|
3
3
|
import { InlineExpressionMap } from "../register/inline.mjs";
|
|
4
4
|
import { LayoutHostBinding, TemplateRefBinding } from "../capabilities.mjs";
|
|
5
|
-
import { WEVU_BINDING_MANIFEST_KEY, WevuRuntimeBindingManifestV1 } from "@weapp-core/constants";
|
|
5
|
+
import { WEVU_BINDING_MANIFEST_KEY, WEVU_NATIVE_SLOT_CONTEXT_KEY, WevuRuntimeBindingManifestV1 } from "@weapp-core/constants";
|
|
6
6
|
//#region src/runtime/features/scopedSlots.d.ts
|
|
7
7
|
export interface CreateWevuScopedSlotComponentOptions {
|
|
8
8
|
computed?: ComputedDefinitions;
|
|
@@ -10,6 +10,7 @@ export interface CreateWevuScopedSlotComponentOptions {
|
|
|
10
10
|
layoutHosts?: LayoutHostBinding[];
|
|
11
11
|
templateRefs?: TemplateRefBinding[];
|
|
12
12
|
[WEVU_BINDING_MANIFEST_KEY]?: WevuRuntimeBindingManifestV1;
|
|
13
|
+
[WEVU_NATIVE_SLOT_CONTEXT_KEY]?: boolean;
|
|
13
14
|
}
|
|
14
15
|
/**
|
|
15
16
|
* 创建编译器生成的作用域插槽组件。
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{getCurrentMiniProgramGlobalObject as e,getCurrentMiniProgramRuntimeCapabilities as t}from"../platform/current.mjs";import{getMiniProgramRuntimeGlobalObject as n,supportsCurrentMiniProgramRuntimeCapability as r}from"../platform.mjs";import{WEVU_CURRENT_SETUP_STATE_KEY as i,WEVU_HOOKS_KEY as a}from"@weapp-core/constants";const o=(()=>{let e=typeof globalThis<`u`?globalThis:n();return e?e[i]??(e[i]={}):{}})();function s(){return o.instance}function c(e){o.instance=e}function l(){return o.context}function u(e){o.context=e}function d(e){if(!o.instance)throw Error(`${e}() 必须在 setup() 的同步阶段调用`);return o.instance}function f(e){return e[a]||(e[a]=Object.create(null)),e[a]}function p(e,n){let r=t().shareTimelineRequiresShareAppMessage?e||n:e,i=[];return r&&i.push(`shareAppMessage`),n&&i.push(`shareTimeline`),i}function m(e,t){let n=[{withShareTicket:!0,menus:t},{menus:t},t.includes(`shareTimeline`)?{withShareTicket:!0}:void 0,t.includes(`shareTimeline`)?{}:void 0,void 0];for(let t of n)try{t===void 0?e():e(t);return}catch{}}function h(e,t,n,{single:r=!1}={}){let i=f(e);r?i[t]=n:(i[t]??(i[t]=[])).push(n)}function g(e,t){var n;let r=(n=e).__wevuShareHookBridges??(n.__wevuShareHookBridges=Object.create(null));if(typeof r[t]==`function`)return;let i=e[t],o=function(...e){let n=this[a]?.[t],r=this.__wevu?.proxy??this,o;if(typeof n==`function`)try{o=n.apply(r,e)}catch{o=void 0}else if(Array.isArray(n))for(let t of n)try{o=t.apply(r,e)}catch{}if(o!==void 0)return o;if(typeof i==`function`)return i.apply(this,e)};r[t]=o,e[t]=o}function _(t){if(!r(`pageShareMenu`))return;let n=e();if(!n||typeof n.showShareMenu!=`function`)return;let i=t[a]??{},o=typeof i.onShareAppMessage==`function`,s=typeof i.onShareTimeline==`function`;if(!o&&!s)return;let c=p(o,s);c.length&&m(n.showShareMenu.bind(n),c)}function v(e,t,n=[]){let r=e[a];if(!r)return;let i=r[t];if(!i)return;let o=e.__wevu?.proxy??e;if(Array.isArray(i))for(let e of i)try{e.apply(o,n)}catch{}else if(typeof i==`function`)try{i.apply(o,n)}catch{}}function y(e,t
|
|
1
|
+
import{getCurrentMiniProgramGlobalObject as e,getCurrentMiniProgramRuntimeCapabilities as t}from"../platform/current.mjs";import{getMiniProgramRuntimeGlobalObject as n,supportsCurrentMiniProgramRuntimeCapability as r}from"../platform.mjs";import{WEVU_CURRENT_SETUP_STATE_KEY as i,WEVU_HOOKS_KEY as a}from"@weapp-core/constants";const o=(()=>{let e=typeof globalThis<`u`?globalThis:n();return e?e[i]??(e[i]={}):{}})();function s(){return o.instance}function c(e){o.instance=e}function l(){return o.context}function u(e){o.context=e}function d(e){if(!o.instance)throw Error(`${e}() 必须在 setup() 的同步阶段调用`);return o.instance}function f(e){return e[a]||(e[a]=Object.create(null)),e[a]}function p(e,n){let r=t().shareTimelineRequiresShareAppMessage?e||n:e,i=[];return r&&i.push(`shareAppMessage`),n&&i.push(`shareTimeline`),i}function m(e,t){let n=[{withShareTicket:!0,menus:t},{menus:t},t.includes(`shareTimeline`)?{withShareTicket:!0}:void 0,t.includes(`shareTimeline`)?{}:void 0,void 0];for(let t of n)try{t===void 0?e():e(t);return}catch{}}function h(e,t,n,{single:r=!1}={}){let i=f(e);r?i[t]=n:(i[t]??(i[t]=[])).push(n)}function g(e,t){var n;let r=(n=e).__wevuShareHookBridges??(n.__wevuShareHookBridges=Object.create(null));if(typeof r[t]==`function`)return;let i=e[t],o=function(...e){let n=this[a]?.[t],r=this.__wevu?.proxy??this,o;if(typeof n==`function`)try{o=n.apply(r,e)}catch{o=void 0}else if(Array.isArray(n))for(let t of n)try{o=t.apply(r,e)}catch{}if(o!==void 0)return o;if(typeof i==`function`)return i.apply(this,e)};r[t]=o,e[t]=o}function _(t){if(!r(`pageShareMenu`))return;let n=e();if(!n||typeof n.showShareMenu!=`function`)return;let i=t[a]??{},o=typeof i.onShareAppMessage==`function`,s=typeof i.onShareTimeline==`function`;if(!o&&!s)return;let c=p(o,s);c.length&&m(n.showShareMenu.bind(n),c)}function v(e,t,n=[]){let r=e[a];if(!r)return;let i=r[t];if(!i)return;let o=e.__wevu?.proxy??e;if(Array.isArray(i))for(let e of i)try{e.apply(o,n)}catch{}else if(typeof i==`function`)try{i.apply(o,n)}catch{}}function y(e,t,n=[]){let r=e[a];if(!r)return;let i=r[t];if(!i)return;let o=e.__wevu?.proxy??e;if(typeof i==`function`)try{return i.apply(o,n)}catch{return}if(Array.isArray(i)){let e;for(let t of i)try{e=t.apply(o,n)}catch{}return e}}export{d as assertInSetup,v as callHookList,y as callHookReturn,_ as ensurePageShareMenusOnSetup,g as ensureSinglePageHookOnInstance,s as getCurrentInstance,l as getCurrentSetupContext,h as pushHook,c as setCurrentInstance,u as setCurrentSetupContext};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{callHookList as e}from"./base.mjs";import{WEVU_PAGE_HOOK_BRIDGES_KEY as t,WEVU_PAGE_SCROLL_HOOK_DEPTH_KEY as n,WEVU_PAGE_SCROLL_OBSERVERS_KEY as r}from"@weapp-core/constants";function i(e,t){let r=e,i=Number(r[n]??0);r[n]=i+1;try{return t()}finally{i===0?delete r[n]:r[n]=i}}function a(t,a,o){let s=Number(t[n]??0)>0;return i(t,()=>(s||(e(t,r,a),e(t,`onPageScroll`,a)),o?.apply(t,a)))}function o(e,n){let r=e,i=r[t]??(r[t]={});if(typeof i[n]==`function`)return;let o=r[n],s=function(...e){return a(this,e,o)};i[n]=s,r[n]=s}export{a as callPageScrollHooks,o as ensurePageHookOnInstance,i as runInPageScrollHook};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{assertInSetup as e,
|
|
1
|
+
import{assertInSetup as e,ensurePageShareMenusOnSetup as t,ensureSinglePageHookOnInstance as n,pushHook as r}from"./base.mjs";import{ensurePageHookOnInstance as i}from"./pageScroll.mjs";function a(t,n,i){r(e(t),t,n,i)}function o(e){a(`onLaunch`,e)}function s(e){a(`onPageNotFound`,e)}function c(e){a(`onUnhandledRejection`,e)}function l(e){a(`onThemeChange`,e)}function u(e){a(`onMemoryWarning`,e)}function d(e){a(`onShow`,e)}function f(e){a(`onLoad`,e)}function p(e){a(`onHide`,e)}function m(e){a(`onUnload`,e)}function h(e){a(`onReady`,e)}function g(e){a(`onPullDownRefresh`,e)}function _(e){a(`onReachBottom`,e)}function v(t){let n=e(`onPageScroll`);r(n,`onPageScroll`,t),i(n,`onPageScroll`)}function y(e){a(`onRouteDone`,e)}function b(e){a(`onTabItemTap`,e)}function x(e){a(`onResize`,e)}function S(e){a(`onMoved`,e)}function C(e){a(`onAttached`,e)}function w(e){a(`onDetached`,e)}function T(e){a(`onError`,e)}function E(e){a(`onSaveExitState`,e,{single:!0})}function D(i){let a=e(`onShareAppMessage`);r(a,`onShareAppMessage`,i,{single:!0}),n(a,`onShareAppMessage`),t(a)}function O(i){let a=e(`onShareTimeline`);r(a,`onShareTimeline`,i,{single:!0}),n(a,`onShareTimeline`),t(a)}function k(t){let i=e(`onAddToFavorites`);r(i,`onAddToFavorites`,t,{single:!0}),n(i,`onAddToFavorites`)}export{k as onAddToFavorites,C as onAttached,w as onDetached,T as onError,p as onHide,o as onLaunch,f as onLoad,u as onMemoryWarning,S as onMoved,s as onPageNotFound,v as onPageScroll,g as onPullDownRefresh,_ as onReachBottom,h as onReady,x as onResize,y as onRouteDone,E as onSaveExitState,D as onShareAppMessage,O as onShareTimeline,d as onShow,b as onTabItemTap,l as onThemeChange,c as onUnhandledRejection,m as onUnload};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{WEVU_JSX_ISLAND_HANDLER_MAP_KEY as e}from"@weapp-core/constants";const t=Symbol.for(`wevu.jsx.fragment`);function n(e,t,n){return{type:e,props:t,children:n}}function r(e){return{type:`text`,props:null,children:String(e??``)}}function i(e){return!!e&&typeof e==`object`&&`type`in e}function a(...e){let t={};for(let n of e)if(n)for(let[e,r]of Object.entries(n))e===`class`&&t.class?t.class=[t.class,r]:e===`style`&&t.style?t.style=[t.style,r]:t[e]=r;return t}function o(e){let t={};for(let[n,r]of Object.entries(e))t[`on${n.charAt(0).toUpperCase()}${n.slice(1)}`]=r;return t}function s(e){return e}const c=`show`,l=`model-text`,u=`model-checkbox`,d=`model-radio`,f=`model-select`;function p(e,t){let n={...e.props??{}};for(let e of t){if(!Array.isArray(e))continue;let[t,r,i]=e;if(t===`show`)
|
|
1
|
+
import{WEVU_JSX_ISLAND_HANDLER_MAP_KEY as e}from"@weapp-core/constants";const t=Symbol.for(`wevu.jsx.fragment`);function n(e,t,n){return{type:e,props:t,children:n}}function r(e){return{type:`text`,props:null,children:String(e??``)}}function i(e){return!!e&&typeof e==`object`&&`type`in e}function a(...e){let t={};for(let n of e)if(n)for(let[e,r]of Object.entries(n))e===`class`&&t.class?t.class=[t.class,r]:e===`style`&&t.style?t.style=[t.style,r]:t[e]=r;return t}function o(e){let t={};for(let[n,r]of Object.entries(e))t[`on${n.charAt(0).toUpperCase()}${n.slice(1)}`]=r;return t}function s(e){return e}const c=`show`,l=`model-text`,u=`model-checkbox`,d=`model-radio`,f=`model-select`;function p(e,t){let n={...e.props??{}};for(let e of t){if(!Array.isArray(e))continue;let[t,r,i]=e;if(t===`show`)n.hidden=!r;else if(t===`model-text`||t===`model-checkbox`||t===`model-radio`||t===`model-select`){let e=typeof i==`string`&&i?i:`modelValue`,a=n[`onUpdate:${e}`];if(n[e===`modelValue`?`value`:e]=r,typeof a==`function`){let e=t===`model-text`?`onInput`:`onChange`;n[e]=e=>a(e?.detail?.value??e?.detail)}}}return{...e,props:n}}function m(e){return e}function h(e){if(/^on[A-Z]/.test(e))return e.slice(2).toLowerCase()}function g(t){let n=t?.[e];if(n&&typeof n==`object`)return n;let r=Object.create(null);return t&&(typeof t==`object`||typeof t==`function`)&&Object.defineProperty(t,e,{value:r,configurable:!0,writable:!0}),r}function _(e,t,n,r,a){let o=typeof e==`function`?e():e;if(o==null||o===!1||o===!0)return[];if(Array.isArray(o)){let e=[];for(let i of o)e.push(..._(i,t,n,r,a));return e}if(typeof o==`object`&&!i(o))return _(o.default,t,n,r,a);let s=v(o,t,n,r,a);return s?[s]:[]}function v(e,n,r,a,o){if(e==null||e===!1||e===!0)return;if(Array.isArray(e))return{kind:`fragment`,children:_(e,n,r,a,o)};if(typeof e==`string`||typeof e==`number`||!i(e))return{kind:`text`,text:String(e)};if(e.type===t)return{kind:`fragment`,children:_(e.children,n,r,a,o)};if(e.type===`text`)return{kind:`text`,text:String(e.children??``)};if(typeof e.type==`function`)return v(e.type(e.props??{},e.children),n,r,a,o);if(e.type&&typeof e.type==`object`&&typeof e.type.render==`function`)return v(e.type.render.call(e.props??{}),n,r,a,o);let s=typeof e.type==`string`?e.type:void 0;if(!s)return;let c={},l={},u=g(n);for(let[t,n]of Object.entries(e.props??{})){let e=h(t);if(e&&typeof n==`function`){let t=`${r}:${a.value++}`;u[t]=n,l[e]=t}else typeof n!=`function`&&n!==void 0&&(t===`class`||t===`className`?c.class=o.normalizeClass(n):t===`style`?c.style=o.normalizeStyle(n):c[t]=n)}return{kind:`element`,tag:s,props:c,events:l,children:_(e.children,n,r,a,o)}}function y(e,t,n){let r=g(this);for(let e of Object.keys(r))e.startsWith(`${t}:`)&&delete r[e];return v(e,this,t,{value:0},n)??null}function b(t,n){let r=n?.currentTarget?.dataset?.wvJsxHandler??n?.target?.dataset?.wvJsxHandler;if(typeof r!=`string`||!r)return;let i=t?.__wevu,a=(t?.[e]??i?.proxy?.[e])?.[r];return typeof a==`function`?a.call(i?.proxy??t,n):void 0}export{t as Fragment,r as createTextVNode,n as createVNode,i as isVNode,a as mergeProps,y as normalizeJsxIsland,s as resolveComponent,m as resolveDirective,b as runJsxIslandHandler,o as transformOn,u as vModelCheckbox,d as vModelRadio,f as vModelSelect,l as vModelText,c as vShow,p as withDirectives};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{reactive as e}from"../reactivity/reactive.mjs";import{readonly as t}from"../reactivity/readonly.mjs";import{getCurrentMiniProgramPages as n}from"./platform.mjs";import{getCurrentInstance as r,getCurrentSetupContext as i}from"./hooks/base.mjs";import{getCurrentPageInstance as a}from"./register/component/lifecycle/platform.mjs";import{WEVU_PAGE_LAYOUT_NAME_KEY as o,WEVU_PAGE_LAYOUT_NONE as s,WEVU_PAGE_LAYOUT_PROPS_KEY as c,WEVU_PAGE_LAYOUT_SETTER_KEY as l}from"@weapp-core/constants";function u(){let e=a();if(e)return e;let t=n();return t[t.length-1]}function d(e){return e!==s&&e}function f(){if(!i())throw Error(`usePageLayout() 必须在 setup() 的同步阶段调用`);let n=r(),a=n?.__wevu?.state,s=e({name:d(a?.[o]),props:{...a?.[c]??{}}});return n&&(n.__wevuPageLayoutState=s),t(s)}function p(e,t,n){let r=e.__wevuPageLayoutState;r&&(r.name=t,r.props={...n})}function m(e){let t=e.__wevuPageLayoutState,n=e.__wevu?.state;t&&n&&(t.name=d(n[o]),t.props={...n[c]??{}})}function h(e,t){let n=r()?.[l];if(typeof n==`function`){n(e,t);return}let i=u()?.[l];if(typeof i==`function`)
|
|
1
|
+
import{reactive as e}from"../reactivity/reactive.mjs";import{readonly as t}from"../reactivity/readonly.mjs";import{getCurrentMiniProgramPages as n}from"./platform.mjs";import{getCurrentInstance as r,getCurrentSetupContext as i}from"./hooks/base.mjs";import{getCurrentPageInstance as a}from"./register/component/lifecycle/platform.mjs";import{WEVU_PAGE_LAYOUT_NAME_KEY as o,WEVU_PAGE_LAYOUT_NONE as s,WEVU_PAGE_LAYOUT_PROPS_KEY as c,WEVU_PAGE_LAYOUT_SETTER_KEY as l}from"@weapp-core/constants";function u(){let e=a();if(e)return e;let t=n();return t[t.length-1]}function d(e){return e!==s&&e}function f(){if(!i())throw Error(`usePageLayout() 必须在 setup() 的同步阶段调用`);let n=r(),a=n?.__wevu?.state,s=e({name:d(a?.[o]),props:{...a?.[c]??{}}});return n&&(n.__wevuPageLayoutState=s),t(s)}function p(e,t,n){let r=e.__wevuPageLayoutState;r&&(r.name=t,r.props={...n})}function m(e){let t=e.__wevuPageLayoutState,n=e.__wevu?.state;t&&n&&(t.name=d(n[o]),t.props={...n[c]??{}})}function h(e,t){let n=r()?.[l];if(typeof n==`function`){n(e,t);return}let i=u()?.[l];if(typeof i==`function`)i(e,t);else throw Error(`setPageLayout() 未找到当前页面实例。请在页面 setup()、事件回调或当前页面上下文中调用。`)}function g(e){return e===!1?s:e}export{g as resolveRuntimePageLayoutName,h as setPageLayout,p as syncRuntimePageLayoutState,m as syncRuntimePageLayoutStateFromRuntime,f as usePageLayout};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{getCurrentInstance as e}from"./hooks/base.mjs";import{onDetached as t,onPageScroll as n,onUnload as r}from"./hooks/register.mjs";function i(e){return typeof e!=`number`||!Number.isFinite(e)?80:Math.max(0,e)}function a(e){if(typeof e==`number`&&Number.isFinite(e))return Math.max(0,e)}function o(o,s={}){if(!e())throw Error(`usePageScrollThrottle() 必须在 setup() 的同步阶段调用`);if(typeof o!=`function`)throw TypeError(`usePageScrollThrottle() 需要传入回调函数`);let c=i(s.interval),l=s.leading??!0,u=s.trailing??!0,d=a(s.maxWait),f,p,m=!1,h=0,g,_=()=>{f&&(clearTimeout(f),f=void 0)},v=()=>{p&&(clearTimeout(p),p=void 0)},y=e=>{_(),v(),g=void 0,h=Date.now(),o(e)},b=()=>{let e=g;g=void 0,f=void 0,e&&!m&&y(e)},x=()=>{let e=g;p=void 0,e&&!m&&y(e)},S=e=>{if(!u||f)return;let t=Math.max(0,c-(e-(h===0?e:h)));f=setTimeout(b,t)},C=e=>{if(typeof d!=`number`||p)return;let t=d-(e-(h===0?e:h));
|
|
1
|
+
import{getCurrentInstance as e}from"./hooks/base.mjs";import{onDetached as t,onPageScroll as n,onUnload as r}from"./hooks/register.mjs";function i(e){return typeof e!=`number`||!Number.isFinite(e)?80:Math.max(0,e)}function a(e){if(typeof e==`number`&&Number.isFinite(e))return Math.max(0,e)}function o(o,s={}){if(!e())throw Error(`usePageScrollThrottle() 必须在 setup() 的同步阶段调用`);if(typeof o!=`function`)throw TypeError(`usePageScrollThrottle() 需要传入回调函数`);let c=i(s.interval),l=s.leading??!0,u=s.trailing??!0,d=a(s.maxWait),f,p,m=!1,h=0,g,_=()=>{f&&(clearTimeout(f),f=void 0)},v=()=>{p&&(clearTimeout(p),p=void 0)},y=e=>{_(),v(),g=void 0,h=Date.now(),o(e)},b=()=>{let e=g;g=void 0,f=void 0,e&&!m&&y(e)},x=()=>{let e=g;p=void 0,e&&!m&&y(e)},S=e=>{if(!u||f)return;let t=Math.max(0,c-(e-(h===0?e:h)));f=setTimeout(b,t)},C=e=>{if(typeof d!=`number`||p)return;let t=d-(e-(h===0?e:h));t<=0?x():p=setTimeout(x,t)};n(e=>{if(m)return;if(c===0){y(e);return}let t=Date.now();g=e,l&&(h===0||t-h>=c)||typeof d==`number`&&t-(h===0?t:h)>=d?y(e):(u||typeof d==`number`)&&(S(t),C(t))});let w=()=>{m||(m=!0,g=void 0,_(),v())};return r(w),t(w),w}export{o as usePageScrollThrottle};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{getMiniProgramRuntimeGlobalObject as e}from"../../platform.mjs";import{createAlipayComponentDefinition as t}from"./alipay.mjs";import{WEAPP_VITE_STATEFUL_HMR_BRIDGE_KEY as n}from"@weapp-core/constants";function r(e){let{lifetimes:t={},methods:n={},observers:r,options:i,pageLifetimes:a={},properties:o,...s}=e,c=s.onLoad;return{...s,...n,onLoad(...e){this.options=e[0]&&typeof e[0]==`object`?e[0]:{},t.created?.apply(this,e);let n=c?.apply(this,e);return t.attached?.apply(this,e),n},onShow(...e){return a.show?.apply(this,e)},onReady(...e){return t.ready?.apply(this,e)},onHide(...e){return a.hide?.apply(this,e)},onResize(...e){return a.resize?.apply(this,e)},onUnload(...e){return t.detached?.apply(this,e)},onError(...e){return t.error?.apply(this,e)}}}function i(i,a){let o=e()?.[n];if(a){let e=r(i);if(typeof o?.Page==`function`){o.Page(e);return}Page(e);return}let s=t(i);
|
|
1
|
+
import{getMiniProgramRuntimeGlobalObject as e}from"../../platform.mjs";import{createAlipayComponentDefinition as t}from"./alipay.mjs";import{WEAPP_VITE_STATEFUL_HMR_BRIDGE_KEY as n}from"@weapp-core/constants";function r(e){let{lifetimes:t={},methods:n={},observers:r,options:i,pageLifetimes:a={},properties:o,...s}=e,c=s.onLoad;return{...s,...n,onLoad(...e){this.options=e[0]&&typeof e[0]==`object`?e[0]:{},t.created?.apply(this,e);let n=c?.apply(this,e);return t.attached?.apply(this,e),n},onShow(...e){return a.show?.apply(this,e)},onReady(...e){return t.ready?.apply(this,e)},onHide(...e){return a.hide?.apply(this,e)},onResize(...e){return a.resize?.apply(this,e)},onUnload(...e){return t.detached?.apply(this,e)},onError(...e){return t.error?.apply(this,e)}}}function i(i,a){let o=e()?.[n];if(a){let e=r(i);if(typeof o?.Page==`function`){o.Page(e);return}Page(e);return}let s=t(i);typeof o?.Component==`function`?o.Component(s):Component(s)}export{i as registerAlipayComponentDefinition};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{callHookList as e,callHookReturn as t}from"../../../hooks/base.mjs";import{
|
|
1
|
+
import{callHookList as e,callHookReturn as t}from"../../../hooks/base.mjs";import{callPageScrollHooks as n}from"../../../hooks/pageScroll.mjs";import{WEVU_ROUTE_DONE_CALLED_KEY as r,WEVU_ROUTE_DONE_IN_TICK_KEY as i}from"@weapp-core/constants";function a(a,o){let{enableOnSaveExitState:s,enableOnPullDownRefresh:c,enableOnReachBottom:l,enableOnPageScroll:u,enableOnRouteDone:d,enableOnTabItemTap:f,enableOnResize:p,enableOnShareAppMessage:m,enableOnShareTimeline:h,enableOnAddToFavorites:g,effectiveOnSaveExitState:_,effectiveOnPullDownRefresh:v,effectiveOnReachBottom:y,effectiveOnPageScroll:b,effectiveOnRouteDone:x,effectiveOnTabItemTap:S,effectiveOnResize:C,effectiveOnShareAppMessage:w,effectiveOnShareTimeline:T,effectiveOnAddToFavorites:E,hasHook:D}=o;s&&(a.onSaveExitState=function(...e){let n=t(this,`onSaveExitState`,e);return n===void 0?_.apply(this,e):n}),c&&(a.onPullDownRefresh=function(...t){if(e(this,`onPullDownRefresh`,t),!D(this,`onPullDownRefresh`))return v.apply(this,t)}),l&&(a.onReachBottom=function(...t){if(e(this,`onReachBottom`,t),!D(this,`onReachBottom`))return y.apply(this,t)}),u&&(a.onPageScroll=function(...e){return n(this,e,D(this,`onPageScroll`)?void 0:b)}),d&&(a.onRouteDone=function(...t){if(!this[i]&&(this[i]=!0,Promise.resolve().then(()=>{this[i]=!1}),this[r]=!0,e(this,`onRouteDone`,t),!D(this,`onRouteDone`)))return x.apply(this,t)}),f&&(a.onTabItemTap=function(...t){if(e(this,`onTabItemTap`,t),!D(this,`onTabItemTap`))return S.apply(this,t)}),p&&(a.onResize=function(...t){if(e(this,`onResize`,t),!D(this,`onResize`))return C.apply(this,t)}),m&&(a.onShareAppMessage=function(...e){let n=t(this,`onShareAppMessage`,e);return n===void 0?w.apply(this,e):n}),h&&(a.onShareTimeline=function(...e){let n=t(this,`onShareTimeline`,e);return n===void 0?T.apply(this,e):n}),g&&(a.onAddToFavorites=function(...e){let n=t(this,`onAddToFavorites`,e);return n===void 0?E.apply(this,e):n})}export{a as attachOptionalPageLifecycleHooks};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{getCurrentMiniProgramGlobalObject as e,getCurrentMiniProgramRuntimeCapabilities as t}from"../../../platform/current.mjs";import{getCurrentMiniProgramPages as n,supportsCurrentMiniProgramRuntimeCapability as r}from"../../../platform.mjs";import{callHookList as i}from"../../../hooks/base.mjs";import{
|
|
1
|
+
import{getCurrentMiniProgramGlobalObject as e,getCurrentMiniProgramRuntimeCapabilities as t}from"../../../platform/current.mjs";import{getCurrentMiniProgramPages as n,supportsCurrentMiniProgramRuntimeCapability as r}from"../../../platform.mjs";import{callHookList as i}from"../../../hooks/base.mjs";import{runInPageScrollHook as a}from"../../../hooks/pageScroll.mjs";import{WEVU_PAGE_SCROLL_EVENT_CONTRACT_KEY as o}from"@weapp-core/constants";let s=!1,c;function l(){return c}function u(e){c=e}function d(e){c===e&&(c=void 0)}function f(e){let t=e.options;if(t&&typeof t==`object`)return t;let r=n(),i=r[r.length-1],a=i&&typeof i==`object`?i.options:void 0;return a&&typeof a==`object`?a:{}}function p(){if(s)return;s=!0;let t=e();if(t&&typeof t==`object`){if(r(`pullDownRefreshApi`)){let e=t.startPullDownRefresh;typeof e==`function`&&(t.startPullDownRefresh=function(...t){let n=e.apply(this,t);return c&&i(c,`onPullDownRefresh`,[]),n})}if(r(`pageScrollApi`)&&t[o]!==1){let e=t.pageScrollTo;typeof e==`function`&&(t.pageScrollTo=function(t,...n){let r=c,o=e.apply(this,[t,...n]);return r&&a(r,()=>{i(r,`onPageScroll`,[t??{}])}),o})}}}function m(n){let{enableOnShareAppMessage:i,enableOnShareTimeline:a}=n;if(!i&&!a||!r(`pageShareMenu`))return;let o=e();if(!o||typeof o.showShareMenu!=`function`)return;let s=t().shareTimelineRequiresShareAppMessage?i||a:i;if(!s&&!a)return;let c=[];s&&c.push(`shareAppMessage`),a&&c.push(`shareTimeline`);let l=[{withShareTicket:!0,menus:c},{menus:c},a?{withShareTicket:!0}:void 0,a?{}:void 0,void 0];for(let e of l)try{e===void 0?o.showShareMenu():o.showShareMenu(e);break}catch{}}export{u as bindCurrentPageInstance,p as ensureMiniProgramGlobalPatched,m as ensurePageShareMenus,l as getCurrentPageInstance,d as releaseCurrentPageInstance,f as resolvePageOptions};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{callHookList as e}from"../../hooks/base.mjs";import{runtimeCapabilityRegistry as t}from"../../capabilities.mjs";import{bindCurrentPageInstance as n,ensureMiniProgramGlobalPatched as r,ensurePageShareMenus as i,releaseCurrentPageInstance as a,resolvePageOptions as o}from"./lifecycle/platform.mjs";import{runTeardownSteps as s}from"../../teardown.mjs";import{enableDeferredSetData as c,mountRuntimeInstance as l,setRuntimeSetDataVisibility as u,teardownRuntimeInstance as d}from"../runtimeInstance.mjs";import{notifyRouteStateSync as f}from"../../../router/routeSync.mjs";import{cancelInitialNavigation as p,ensureInitialNavigation as m}from"../../navigationLifecycle.mjs";import{attachOptionalPageLifecycleHooks as h}from"./lifecycle/optionalHooks.mjs";import{WEVU_ON_LOAD_CALLED_KEY as g,WEVU_READY_CALLED_KEY as _,WEVU_ROUTE_DONE_CALLED_KEY as v}from"@weapp-core/constants";function y(y){let{runtimeApp:b,watch:x,setup:S,userOnLoad:C,userOnUnload:w,userOnShow:T,userOnHide:E,userOnReady:D,isPage:O,enableOnSaveExitState:k,enableOnPullDownRefresh:A,enableOnReachBottom:j,enableOnPageScroll:M,enableOnRouteDone:N,enableOnRouteDoneFallback:P,enableOnTabItemTap:F,enableOnResize:I,enableOnShareAppMessage:L,enableOnShareTimeline:R,enableOnAddToFavorites:z,syncWevuPropsFromValues:B,effectiveOnSaveExitState:V,effectiveOnPullDownRefresh:H,effectiveOnReachBottom:U,effectiveOnPageScroll:W,effectiveOnRouteDone:G,effectiveOnTabItemTap:K,effectiveOnResize:q,effectiveOnShareAppMessage:J,effectiveOnShareTimeline:Y,effectiveOnAddToFavorites:X,hasHook:Z}=y,Q=e=>{e.__wevu?.__wevu_flushSetupSnapshotSync?.()},$={onLoad(...t){if(this[g])return;this[g]=!0;let n=()=>{l(this,b,x,S);let n=t[0]&&typeof t[0]==`object`?t[0]:o(this);if(B?.(this,n),Q(this),c(this),O&&i({enableOnShareAppMessage:L,enableOnShareTimeline:R}),e(this,`onLoad`,t),typeof C==`function`)return C.apply(this,t.length?t:[n])};return(O?m(this,t[0],{onComplete:e=>{e&&n()}}):void 0)||n()},onUnload(...e){let t;return s([()=>p(this),()=>{O&&a(this)},()=>d(this),()=>{typeof w==`function`&&(t=w.apply(this,e))}]),t},onShow(...t){if(O&&(r(),n(this),this[g]||$.onLoad.call(this,o(this)),B?.(this,o(this)),Q(this),i({enableOnShareAppMessage:L,enableOnShareTimeline:R}),this[v]=!1),u(this,!0),O&&f({page:this,source:`page`}),e(this,`onShow`,t),typeof T==`function`)return T.apply(this,t)},onHide(...t){if(O&&a(this),u(this,!1),e(this,`onHide`,t),typeof E==`function`)return E.apply(this,t)},onReady(...n){if(O&&(this[g]||$.onLoad.call(this,o(this)),B?.(this,o(this)),Q(this),i({enableOnShareAppMessage:L,enableOnShareTimeline:R})),!this[_]){if(this[_]=!0,O&&N&&P){let e=this;setTimeout(()=>{e[v]||$.onRouteDone?.call(e)},0)}let r=()=>{e(this,`onReady`,n),typeof D==`function`&&D.apply(this,n)},i=()=>{
|
|
1
|
+
import{callHookList as e}from"../../hooks/base.mjs";import{runtimeCapabilityRegistry as t}from"../../capabilities.mjs";import{bindCurrentPageInstance as n,ensureMiniProgramGlobalPatched as r,ensurePageShareMenus as i,releaseCurrentPageInstance as a,resolvePageOptions as o}from"./lifecycle/platform.mjs";import{runTeardownSteps as s}from"../../teardown.mjs";import{enableDeferredSetData as c,mountRuntimeInstance as l,setRuntimeSetDataVisibility as u,teardownRuntimeInstance as d}from"../runtimeInstance.mjs";import{notifyRouteStateSync as f}from"../../../router/routeSync.mjs";import{cancelInitialNavigation as p,ensureInitialNavigation as m}from"../../navigationLifecycle.mjs";import{attachOptionalPageLifecycleHooks as h}from"./lifecycle/optionalHooks.mjs";import{WEVU_ON_LOAD_CALLED_KEY as g,WEVU_READY_CALLED_KEY as _,WEVU_ROUTE_DONE_CALLED_KEY as v}from"@weapp-core/constants";function y(y){let{runtimeApp:b,watch:x,setup:S,userOnLoad:C,userOnUnload:w,userOnShow:T,userOnHide:E,userOnReady:D,isPage:O,enableOnSaveExitState:k,enableOnPullDownRefresh:A,enableOnReachBottom:j,enableOnPageScroll:M,enableOnRouteDone:N,enableOnRouteDoneFallback:P,enableOnTabItemTap:F,enableOnResize:I,enableOnShareAppMessage:L,enableOnShareTimeline:R,enableOnAddToFavorites:z,syncWevuPropsFromValues:B,effectiveOnSaveExitState:V,effectiveOnPullDownRefresh:H,effectiveOnReachBottom:U,effectiveOnPageScroll:W,effectiveOnRouteDone:G,effectiveOnTabItemTap:K,effectiveOnResize:q,effectiveOnShareAppMessage:J,effectiveOnShareTimeline:Y,effectiveOnAddToFavorites:X,hasHook:Z}=y,Q=e=>{e.__wevu?.__wevu_flushSetupSnapshotSync?.()},$={onLoad(...t){if(this[g])return;this[g]=!0;let n=()=>{l(this,b,x,S);let n=t[0]&&typeof t[0]==`object`?t[0]:o(this);if(B?.(this,n),Q(this),c(this),O&&i({enableOnShareAppMessage:L,enableOnShareTimeline:R}),e(this,`onLoad`,t),typeof C==`function`)return C.apply(this,t.length?t:[n])};return(O?m(this,t[0],{onComplete:e=>{e&&n()}}):void 0)||n()},onUnload(...e){let t;return s([()=>p(this),()=>{O&&a(this)},()=>d(this),()=>{typeof w==`function`&&(t=w.apply(this,e))}]),t},onShow(...t){if(O&&(r(),n(this),this[g]||$.onLoad.call(this,o(this)),B?.(this,o(this)),Q(this),i({enableOnShareAppMessage:L,enableOnShareTimeline:R}),this[v]=!1),u(this,!0),O&&f({page:this,source:`page`}),e(this,`onShow`,t),typeof T==`function`)return T.apply(this,t)},onHide(...t){if(O&&a(this),u(this,!1),e(this,`onHide`,t),typeof E==`function`)return E.apply(this,t)},onReady(...n){if(O&&(this[g]||$.onLoad.call(this,o(this)),B?.(this,o(this)),Q(this),i({enableOnShareAppMessage:L,enableOnShareTimeline:R})),!this[_]){if(this[_]=!0,O&&N&&P){let e=this;setTimeout(()=>{e[v]||$.onRouteDone?.call(e)},0)}let r=()=>{e(this,`onReady`,n),typeof D==`function`&&D.apply(this,n)},i=()=>{Array.isArray(this.__wevuTemplateRefs)&&this.__wevuTemplateRefs.length>0?t.templateRefs?.schedule(this,r):r()};O&&m(this,void 0,{start:!1,onComplete:e=>{e&&i()}})||i()}else if(typeof D==`function`)return D.apply(this,n)}};return h($,{enableOnSaveExitState:k,enableOnPullDownRefresh:A,enableOnReachBottom:j,enableOnPageScroll:M,enableOnRouteDone:N,enableOnTabItemTap:F,enableOnResize:I,enableOnShareAppMessage:L,enableOnShareTimeline:R,enableOnAddToFavorites:z,effectiveOnSaveExitState:V,effectiveOnPullDownRefresh:H,effectiveOnReachBottom:U,effectiveOnPageScroll:W,effectiveOnRouteDone:G,effectiveOnTabItemTap:K,effectiveOnResize:q,effectiveOnShareAppMessage:J,effectiveOnShareTimeline:Y,effectiveOnAddToFavorites:X,hasHook:Z}),$}export{y as createPageLifecycleHooks};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{hasOwn as e}from"../../../utils.mjs";import{isDeepEqualValue as t}from"../../app/setData/snapshot.mjs";import{
|
|
1
|
+
import{hasOwn as e}from"../../../utils.mjs";import{isDeepEqualValue as t}from"../../app/setData/snapshot.mjs";import{updateNativeDeclarationAddress as n}from"../runtimeInstance/nativeDeclaration.mjs";import{refreshOwnerSnapshotFromInstance as r}from"../snapshot.mjs";import{WEVU_ATTRS_KEY as i,WEVU_NATIVE_DECLARATION_ADDRESS_PROP as a,WEVU_PENDING_PROP_VALUES_KEY as o,WEVU_PROPS_DERIVED_KEYS_KEY as s,WEVU_PROPS_KEY as c,WEVU_PROP_KEYS_KEY as l,WEVU_SLOT_NAMES_PROP as u,WEVU_SLOT_OWNER_ID_PROP as d,WEVU_SLOT_SCOPE_KEY as f}from"@weapp-core/constants";function p(p){let{restOptions:m,propsAliases:h,propsDerivedKeys:g,userObservers:_}=p,v=m.properties&&typeof m.properties==`object`?Object.keys(m.properties):[],y=new Set(v),b=new Set(g??[]),x=Object.entries(h??{}).filter(([e,t])=>e&&t),S=/* @__PURE__ */ new Set([u,d,f]),C=v.filter(e=>!S.has(e)),w=/* @__PURE__ */ new WeakMap,T=e=>e.startsWith(`__wv_`),E=e=>{let t=e.__wevu?.[s];if(t instanceof Set)for(let e of C)t.add(e)},D=(t,n,r)=>e(t,n)&&Object.is(t[n],r)?!1:(t[n]=r,!0),O=(n,r,i)=>S.has(r)&&e(n,r)&&t(n[r],i,20,{keys:1e4})?!1:D(n,r,i),k=(e,t,n)=>{if(!S.has(t))return;let r=!1,i=e.__wevu?.state;try{i&&typeof i==`object`&&O(i,t,n);let a=e.data;a&&typeof a==`object`&&(r=O(a,t,n))}catch{}if(r&&typeof e.setData==`function`)try{e.setData({[t]:n})}catch{}},A=(t,n)=>{if(!x.length)return;let r=t.__wevu,i=r?.setupState,a=r?.state;if(!i||typeof i!=`object`)return;E(t);let o=w.get(t)??/* @__PURE__ */ new Set;w.set(t,o);for(let[t,r]of x){if(e(i,t)&&!o.has(t))continue;let s=n[r];try{D(i,t,s),o.add(t)}catch{}if(a&&typeof a==`object`&&(!e(a,t)||o.has(t)))try{D(a,t,s)}catch{}}},j=(t,n)=>{if(!b.size)return;let r=t.__wevu?.setupState;if(!r||typeof r!=`object`)return;E(t);let i=new Map(x);for(let t of b){let a=i.get(t)??t;if(e(n,a))try{D(r,t,n[a])}catch{}}},M=e=>{try{Object.defineProperty(e,l,{value:v,configurable:!0,enumerable:!1,writable:!1})}catch{e[l]=v}},N=t=>{let n=t[i];if(!n||typeof n!=`object`)return;let a=n=>{let r=t.__wevu?.state;return typeof r==`object`&&!!r&&e(r,n)},o=t.properties,s=o&&typeof o==`object`?o:void 0,c=Object.keys(n);for(let t of c)if(!s||!e(s,t)||T(t)||y.has(t)||a(t))try{delete n[t]}catch{}if(!s)r(t);else{for(let[e,t]of Object.entries(s))if(!(T(e)||y.has(e)||a(e)))try{n[e]=t}catch{}r(t)}},P=t=>{let n=t[c],i=t.properties,a=t[o];if(n&&typeof n==`object`&&i&&typeof i==`object`){let o=i,s=Object.keys(n);for(let t of s)if(!y.has(t)||!e(o,t))try{delete n[t]}catch{}for(let r of v){let i=a&&e(a,r);if(!i&&!e(o,r))continue;let s=i?a[r]:o[r];try{O(n,r,s)}catch{}k(t,r,s)}j(t,n),A(t,n),r(t)}a&&delete t[o],N(t)},F=(t,n)=>{if(!n||typeof n!=`object`)return;let i=t[c];if(!i||typeof i!=`object`)return;let a=!1;for(let r of v)if(e(n,r)){try{a=O(i,r,n[r])||a}catch{}k(t,r,n[r])}a&&(j(t,i),A(t,i),r(t),N(t))},I=(e,t,n)=>{var i;let a=e[c];if(!a||typeof a!=`object`)return;try{if(!O(a,t,n)){k(e,t,n);return}}catch{}k(e,t,n);let s=(i=e)[o]??(i[o]=Object.create(null));s[t]=n,j(e,a),A(e,a),r(e),N(e)},L={};if(v.length)for(let e of v)L[e]=function(t){(!import.meta.env?.PLATFORM||import.meta.env?.PLATFORM===`weapp`)&&e===a&&n(this,t),I(this,e,t)};let R={...(!import.meta.env?.PLATFORM||import.meta.env?.PLATFORM===`weapp`)&&y.has(a)?{[a]:void 0}:{},..._??{}};for(let[e,t]of Object.entries(L)){let n=R[e];R[e]=typeof n==`function`?function(...r){e===a?(t.apply(this,r),n.apply(this,r)):(n.apply(this,r),t.apply(this,r))}:t}let z=R[`**`];return R[`**`]=function(...e){typeof z==`function`&&z.apply(this,e),P(this)},{attachWevuPropKeys:M,directPropsDerivedKeys:C,syncWevuPropsFromInstance:P,syncWevuPropsFromValues:F,finalObservers:R}}export{p as createPropsSync};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{getMiniProgramRuntimeGlobalObject as e}from"../../platform.mjs";import{callHookList as t}from"../../hooks/base.mjs";import{requireRuntimeCapability as n,runtimeCapabilityRegistry as r}from"../../capabilities.mjs";import{runTeardownSteps as i}from"../../teardown.mjs";import{enableDeferredSetData as
|
|
1
|
+
import{getMiniProgramRuntimeGlobalObject as e}from"../../platform.mjs";import{callHookList as t}from"../../hooks/base.mjs";import{requireRuntimeCapability as n,runtimeCapabilityRegistry as r}from"../../capabilities.mjs";import{runTeardownSteps as i}from"../../teardown.mjs";import{receiveNativeDeclaration as ee}from"../runtimeInstance/nativeDeclaration.mjs";import{receiveNativeSlotParent as a}from"../runtimeInstance/provideContext.mjs";import{enableDeferredSetData as o,mountRuntimeInstance as s,refreshRuntimeInstance as c,setRuntimeSetDataVisibility as l,teardownRuntimeInstance as u}from"../runtimeInstance.mjs";import{ensureInitialNavigation as d}from"../../navigationLifecycle.mjs";import{registerNativeComponentDefinition as f}from"./registerNativeDefinition.mjs";import{WEAPP_VITE_STATEFUL_HMR_BRIDGE_KEY as p,WEVU_NATIVE_DECLARATION_METHOD as m,WEVU_NATIVE_SLOT_PARENT_METHOD as h,WEVU_PUBLIC_RUNTIME_KEY as te,WEVU_READY_CALLED_KEY as g,WEVU_RESOLVE_PUBLIC_INSTANCE_METHOD as _,WEVU_RUNTIME_KEY as v}from"@weapp-core/constants";function y(y){let{runtimeApp:b,watch:x,setup:S,restOptions:C,pageLifecycleHooks:w,finalObservers:ne,userLifetimes:T,userPageLifetimes:E,finalMethods:D,finalOptions:re,applyExtraInstanceFields:O,templateRefs:k,layoutHosts:A,attachWevuPropKeys:j,setupLifecycle:M,syncWevuPropsFromInstance:N,directPropsDerivedKeys:P,isPage:F,nativeSlotContext:ie,vueLifecycles:I,getRuntimeOwnerLabel:L,registerNative:ae=!0}=y,R=Array.isArray(k)&&k.length>0?k:void 0,z=/* @__PURE__ */ new WeakSet;R&&n(`templateRefs`,`registerComponentDefinition(template refs)`);let B=Array.isArray(A)&&A.length>0?A:void 0,V=B?n(`layout`,`registerComponentDefinition(layout hosts)`):void 0,H=(e,t)=>{R?r.templateRefs?.schedule(e,t):t?.()},U=e=>{let t=e.__wevu??e[te];if(t)return t;let n=e.$state;if(n&&typeof n==`object`)return n[v]},W=e=>U(e)?.proxy||(r.scopedSlots?.resolveLifecycleProxy(e)??e),G=e=>{let t=U(e);return t?{runtime:t,mounted:!1}:(O(e),j(e),s(e,b,x,S,{deferSetData:!0,snapshotOmitKeys:P,attached:!z.has(e)}),N(e),o(e),{runtime:U(e),mounted:!0})},K=(e,t,n)=>{let r=I[t];if(typeof r==`function`)return r.apply(W(e),n)},q=(e,t)=>{F&&d(e,void 0,{start:!1,onComplete:e=>{e&&t()}})||t()},oe=e=>{U(e)||typeof I.mounted!=`function`||G(e).mounted&&(K(e,`created`,[]),K(e,`beforeMount`,[]))},J={},Y=e=>{B&&V?.attachHosts(B,e)},X=e=>{F&&V&&V?.attachPageSetter(e)};if(F)for(let e of[`onPageScroll`,`onPullDownRefresh`,`onReachBottom`,`onShareAppMessage`,`onShareTimeline`,`onAddToFavorites`]){let t=w[e];typeof t==`function`&&typeof D[e]!=`function`&&(J[e]=function(...e){return t.apply(this,e)})}let Z={...J,...D,[_]:function(){let e=G(this);return e.mounted&&(K(this,`created`,[]),K(this,`beforeMount`,[])),e.runtime?.proxy}};(!import.meta.env?.PLATFORM||import.meta.env?.PLATFORM===`weapp`)&&(Z[h]=a,ie&&(Z[m]=ee));let Q={...C,...F?w:{},observers:ne,lifetimes:{...T,created:function(...e){z.add(this),O(this),j(this),R&&r.templateRefs?.attachBindings(this,R),q(this,()=>{if(K(this,`beforeCreate`,e),M===`created`){try{s(this,b,x,S,{deferSetData:!0,snapshotOmitKeys:P})}catch(e){let t=L(this);throw Error(`[wevu] mount runtime failed in created (${t}): ${e instanceof Error?e.message:String(e)}`)}N(this),X(this)}typeof T.created==`function`&&T.created.apply(this,e)})},moved:function(...e){t(this,`onMoved`,e),typeof T.moved==`function`&&T.moved.apply(this,e)},attached:function(...e){z.delete(this),O(this),j(this),R&&!r.templateRefs?.hasBindings(this)&&r.templateRefs?.attachBindings(this,R),q(this,()=>{if(M!==`created`||!this.__wevu)try{s(this,b,x,S,{deferSetData:!0,snapshotOmitKeys:P,attached:!0})}catch(e){let t=L(this);throw Error(`[wevu] mount runtime failed in attached (${t}): ${e instanceof Error?e.message:String(e)}`)}N(this),K(this,`created`,e),K(this,`beforeMount`,e),X(this),Y(this),o(this),t(this,`onAttached`,e),typeof T.attached==`function`&&T.attached.apply(this,e)})},ready:function(...e){if(z.has(this))return T.ready?.apply(this,e);if(!F||this[g]||!d(this,void 0,{start:!0,onComplete:t=>{t&&!this.__wevuInitialNavigationReady&&(this.__wevuInitialNavigationReady=!0,Q.lifetimes.ready.call(this,...e))}})||this.__wevuInitialNavigationReady){if(oe(this),F&&typeof w.onReady==`function`){let t=!!this[g];if(w.onReady.call(this,...e),!t){let t=()=>K(this,`mounted`,e);d(this,void 0,{start:!1,onComplete:e=>{e&&t()}})||t()}typeof T.ready==`function`&&T.ready.apply(this,e)}else this[g]?typeof T.ready==`function`&&T.ready.apply(this,e):(this[g]=!0,N(this),r.templateRefs?.scheduleOwner(this),H(this,()=>{t(this,`onReady`,e),K(this,`mounted`,e),typeof T.ready==`function`&&T.ready.apply(this,e)}))}},detached:function(...e){F&&typeof w.onUnload==`function`?i([()=>K(this,`beforeUnmount`,e),()=>K(this,`beforeDestroy`,e),()=>r.templateRefs?.scheduleOwner(this),()=>t(this,`onDetached`,e),()=>w.onUnload.call(this,...e),()=>{typeof T.detached==`function`&&T.detached.apply(this,e)},()=>K(this,`unmounted`,e),()=>K(this,`destroyed`,e)]):i([()=>K(this,`beforeUnmount`,e),()=>K(this,`beforeDestroy`,e),()=>r.templateRefs?.scheduleOwner(this),()=>t(this,`onDetached`,e),()=>{B&&V?.detachHosts(B,this)},()=>u(this),()=>K(this,`unmounted`,e),()=>K(this,`destroyed`,e),()=>{typeof T.detached==`function`&&T.detached.apply(this,e)}])},error:function(...e){t(this,`onError`,e),typeof T.error==`function`&&T.error.apply(this,e)}},pageLifetimes:{...E,show:function(...e){F&&typeof w.onShow==`function`?(w.onShow.call(this,...e),typeof E.show==`function`&&E.show.apply(this,e)):(l(this,!0),t(this,`onShow`,e),typeof E.show==`function`&&E.show.apply(this,e))},hide:function(...e){F&&typeof w.onHide==`function`?(w.onHide.call(this,...e),typeof E.hide==`function`&&E.hide.apply(this,e)):(l(this,!1),t(this,`onHide`,e),typeof E.hide==`function`&&E.hide.apply(this,e))},resize:function(...e){F&&typeof w.onResize==`function`?(w.onResize.call(this,...e),typeof E.resize==`function`&&E.resize.apply(this,e)):(t(this,`onResize`,e),typeof E.resize==`function`&&E.resize.apply(this,e))},routeDone:function(...e){F&&typeof w.onRouteDone==`function`?(w.onRouteDone.call(this,...e),typeof E.routeDone==`function`&&E.routeDone.apply(this,e)):(t(this,`onRouteDone`,e),typeof E.routeDone==`function`&&E.routeDone.apply(this,e))}},methods:Z,options:re};if(!ae)return Q;let $=e()?.[p];if(typeof $?.trackWevuComponent==`function`){let e=$.trackWevuComponent(Q,(e,t)=>{c(e,b,x,S,{snapshotOmitKeys:P,stateSnapshot:t,attached:!z.has(e)}),N(e),X(e),Y(e),o(e,{rehydrateSetupState:!0})},e=>{i([()=>B&&V?.detachHosts(B,e),()=>u(e,{skipHooks:!0})])});return $.isApplying()||f(e,F),e}return f(Q,F),Q}export{y as registerComponentDefinition};
|