wevu 7.5.0 → 7.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/alipay/jsx-runtime.d.mts +0 -2
- package/dist/config/defaults.d.mts +42 -0
- package/dist/config/pageFeatures.d.mts +49 -0
- package/dist/config.d.mts +4 -0
- package/dist/config.mjs +1 -0
- package/dist/dev/_virtual/{_@oxc-project_runtime@0.153.0 → _@oxc-project_runtime@0.155.0}/helpers/esm/defineProperty.mjs +1 -2
- package/dist/dev/_virtual/{_@oxc-project_runtime@0.153.0 → _@oxc-project_runtime@0.155.0}/helpers/esm/toPrimitive.mjs +1 -2
- package/dist/dev/_virtual/{_@oxc-project_runtime@0.153.0 → _@oxc-project_runtime@0.155.0}/helpers/esm/toPropertyKey.mjs +1 -2
- package/dist/dev/_virtual/{_@oxc-project_runtime@0.153.0 → _@oxc-project_runtime@0.155.0}/helpers/esm/typeof.mjs +1 -2
- package/dist/dev/api/vitest/setup.mjs +1 -2
- package/dist/dev/package.mjs +2 -3
- package/dist/dev/reactivity/asyncDerivation.mjs +1 -2
- package/dist/dev/reactivity/computed.mjs +1 -2
- package/dist/dev/reactivity/computed.mjs.map +1 -1
- package/dist/dev/reactivity/core.mjs +2 -3
- package/dist/dev/reactivity/reactive/mutation.mjs +1 -2
- package/dist/dev/reactivity/reactive/patch.mjs +1 -2
- package/dist/dev/reactivity/reactive/patchState.mjs +1 -2
- package/dist/dev/reactivity/reactive/shallow.mjs +1 -2
- package/dist/dev/reactivity/reactive/shared.mjs +1 -2
- package/dist/dev/reactivity/reactive/state.mjs +1 -2
- package/dist/dev/reactivity/reactive.mjs +1 -2
- package/dist/dev/reactivity/readonly.mjs +1 -2
- package/dist/dev/reactivity/ref.mjs +2 -3
- package/dist/dev/reactivity/ref.mjs.map +1 -1
- package/dist/dev/reactivity/shallowRef.mjs +1 -2
- package/dist/dev/reactivity/toRefs.mjs +1 -2
- package/dist/dev/reactivity/traverse.mjs +1 -2
- package/dist/dev/reactivity/watch/helpers.mjs +1 -2
- package/dist/dev/reactivity/watch/types.mjs +1 -2
- package/dist/dev/reactivity/watch.mjs +1 -2
- package/dist/dev/router/auto-routes.mjs +1 -2
- package/dist/dev/router/backNavigation.mjs +1 -2
- package/dist/dev/router/createRouter.mjs +1 -2
- package/dist/dev/router/initialNavigation.mjs +1 -2
- package/dist/dev/router/instance.mjs +1 -2
- package/dist/dev/router/navigationApi.mjs +1 -2
- package/dist/dev/router/navigationCore.mjs +1 -2
- package/dist/dev/router/navigationResult.mjs +1 -2
- package/dist/dev/router/navigationTarget.mjs +1 -2
- package/dist/dev/router/navigationTargetHelpers.mjs +1 -2
- package/dist/dev/router/resolve.mjs +1 -2
- package/dist/dev/router/routeRegistry.mjs +1 -2
- package/dist/dev/router/routeSync.mjs +1 -2
- package/dist/dev/router/scrollRestoration/adapters.mjs +1 -2
- package/dist/dev/router/scrollRestoration/controller.mjs +1 -2
- package/dist/dev/router/scrollRestoration/host.mjs +1 -2
- package/dist/dev/router/scrollRestoration/index.mjs +1 -2
- package/dist/dev/router/types.mjs +1 -2
- package/dist/dev/router/useRoute.mjs +1 -2
- package/dist/dev/router/useRouter.mjs +1 -2
- package/dist/dev/routerInternal/location.mjs +1 -2
- package/dist/dev/routerInternal/matching.mjs +1 -2
- package/dist/dev/routerInternal/params.mjs +1 -2
- package/dist/dev/routerInternal/path.mjs +1 -2
- package/dist/dev/routerInternal/query.mjs +1 -2
- package/dist/dev/routerInternal/records.mjs +1 -2
- package/dist/dev/routerInternal/recordsWarnings.mjs +1 -2
- package/dist/dev/routerInternal/snapshots.mjs +1 -2
- package/dist/dev/runtime/app/computed.mjs +1 -2
- package/dist/dev/runtime/app/context.mjs +1 -2
- package/dist/dev/runtime/app/diagnostics.mjs +1 -2
- package/dist/dev/runtime/app/mount.mjs +1 -2
- package/dist/dev/runtime/app/pending.mjs +1 -2
- package/dist/dev/runtime/app/setData/commitTracker.mjs +1 -2
- package/dist/dev/runtime/app/setData/observation.mjs +1 -2
- package/dist/dev/runtime/app/setData/patchScheduler.mjs +1 -2
- package/dist/dev/runtime/app/setData/payload.mjs +1 -2
- package/dist/dev/runtime/app/setData/scheduler.mjs +1 -2
- package/dist/dev/runtime/app/setData/snapshot.mjs +1 -2
- package/dist/dev/runtime/app/setDataOptions.mjs +1 -2
- package/dist/dev/runtime/app.mjs +1 -2
- package/dist/dev/runtime/bindModel.mjs +1 -2
- package/dist/dev/runtime/bindingManifest.mjs +1 -2
- package/dist/dev/runtime/capabilities.mjs +1 -2
- package/dist/dev/runtime/css.mjs +1 -2
- package/dist/dev/runtime/defaults.mjs +1 -2
- package/dist/dev/runtime/define/componentDefinition.mjs +1 -2
- package/dist/dev/runtime/define/initialComputed.mjs +1 -2
- package/dist/dev/runtime/define/options.mjs +1 -2
- package/dist/dev/runtime/define/optionsApi.mjs +1 -2
- package/dist/dev/runtime/define/props.mjs +1 -2
- package/dist/dev/runtime/define/scopedSlotOptions.mjs +1 -2
- package/dist/dev/runtime/define/setupResult.mjs +4 -7
- package/dist/dev/runtime/define/setupResult.mjs.map +1 -1
- package/dist/dev/runtime/define.mjs +3 -9
- package/dist/dev/runtime/define.mjs.map +1 -1
- package/dist/dev/runtime/diff.mjs +1 -2
- package/dist/dev/runtime/disposables.mjs +1 -2
- package/dist/dev/runtime/elementIntersectionObserver.mjs +1 -2
- package/dist/dev/runtime/emit.mjs +1 -2
- package/dist/dev/runtime/features/inlineEvents.mjs +1 -2
- package/dist/dev/runtime/features/jsxIslands.mjs +1 -2
- package/dist/dev/runtime/features/layout.mjs +1 -2
- package/dist/dev/runtime/features/patchStrategy.mjs +1 -2
- package/dist/dev/runtime/features/publicLayout.mjs +1 -2
- package/dist/dev/runtime/features/scopedSlots.mjs +1 -2
- package/dist/dev/runtime/features/setDataHighFrequencyWarning.mjs +1 -2
- package/dist/dev/runtime/features/templateRefs.mjs +1 -2
- package/dist/dev/runtime/hooks/base.mjs +1 -2
- package/dist/dev/runtime/hooks/pageScroll.mjs +1 -2
- package/dist/dev/runtime/hooks/register.mjs +1 -2
- package/dist/dev/runtime/hooks/vue.mjs +1 -2
- package/dist/dev/runtime/inlineDataset.mjs +1 -2
- package/dist/dev/runtime/internal.mjs +1 -2
- package/dist/dev/runtime/intersectionObserver.mjs +1 -2
- package/dist/dev/runtime/jsxIsland.mjs +1 -2
- package/dist/dev/runtime/layoutBridge.mjs +1 -2
- package/dist/dev/runtime/layoutComponentMatcher.mjs +1 -2
- package/dist/dev/runtime/nativeBridge.mjs +1 -2
- package/dist/dev/runtime/navigationLifecycle.mjs +1 -2
- package/dist/dev/runtime/noSetData.mjs +1 -2
- package/dist/dev/runtime/pageEnvironment.mjs +1 -2
- package/dist/dev/runtime/pageLayout.mjs +1 -2
- package/dist/dev/runtime/pageLayout.mjs.map +1 -1
- package/dist/dev/runtime/pageScroll.mjs +1 -2
- package/dist/dev/runtime/platform/current.mjs +1 -2
- package/dist/dev/runtime/platform/generic.mjs +1 -2
- package/dist/dev/runtime/platform/globals.mjs +1 -2
- package/dist/dev/runtime/platform.mjs +1 -2
- package/dist/dev/runtime/provide.mjs +1 -2
- package/dist/dev/runtime/provideContext.mjs +1 -2
- package/dist/dev/runtime/provideStore.mjs +1 -2
- package/dist/dev/runtime/publicRuntime.mjs +1 -2
- package/dist/dev/runtime/pullDownRefresh.mjs +1 -2
- package/dist/dev/runtime/register/app.mjs +1 -2
- package/dist/dev/runtime/register/component/alipay.mjs +1 -2
- package/dist/dev/runtime/register/component/alipayRegistration.mjs +1 -2
- package/dist/dev/runtime/register/component/features.mjs +1 -2
- package/dist/dev/runtime/register/component/hmrRegistration.mjs +14 -0
- package/dist/dev/runtime/register/component/hmrRegistration.mjs.map +1 -0
- package/dist/dev/runtime/register/component/lifecycle/optionalHooks.mjs +1 -2
- package/dist/dev/runtime/register/component/lifecycle/platform.mjs +1 -2
- package/dist/dev/runtime/register/component/lifecycle.mjs +1 -2
- package/dist/dev/runtime/register/component/methods.mjs +1 -2
- package/dist/dev/runtime/register/component/options.mjs +1 -2
- package/dist/dev/runtime/register/component/props.mjs +5 -6
- package/dist/dev/runtime/register/component/props.mjs.map +1 -1
- package/dist/dev/runtime/register/component/registerDefinition.mjs +7 -6
- package/dist/dev/runtime/register/component/registerDefinition.mjs.map +1 -1
- package/dist/dev/runtime/register/component/registerNativeDefinition.mjs +1 -2
- package/dist/dev/runtime/register/component.mjs +23 -14
- package/dist/dev/runtime/register/component.mjs.map +1 -1
- package/dist/dev/runtime/register/inline.mjs +1 -2
- package/dist/dev/runtime/register/runtimeInstance/methodBridge.mjs +1 -2
- package/dist/dev/runtime/register/runtimeInstance/nativeDeclaration.mjs +1 -2
- package/dist/dev/runtime/register/runtimeInstance/provideContext.mjs +1 -2
- package/dist/dev/runtime/register/runtimeInstance/setupContext.mjs +1 -2
- package/dist/dev/runtime/register/runtimeInstance/setupPhase.mjs +3 -27
- package/dist/dev/runtime/register/runtimeInstance/setupPhase.mjs.map +1 -1
- package/dist/dev/runtime/register/runtimeInstance/setupSnapshot.mjs +1 -2
- package/dist/dev/runtime/register/runtimeInstance/utils.mjs +1 -2
- package/dist/dev/runtime/register/runtimeInstance.mjs +12 -14
- package/dist/dev/runtime/register/runtimeInstance.mjs.map +1 -1
- package/dist/dev/runtime/register/setDataFrequencyWarning.mjs +1 -2
- package/dist/dev/runtime/register/setup.mjs +1 -2
- package/dist/dev/runtime/register/snapshot.mjs +1 -2
- package/dist/dev/runtime/register/watch.mjs +2 -5
- package/dist/dev/runtime/register/watch.mjs.map +1 -1
- package/dist/dev/runtime/scopedSlots.mjs +1 -2
- package/dist/dev/runtime/selectorQuery.mjs +1 -2
- package/dist/dev/runtime/setupTracking.mjs +1 -2
- package/dist/dev/runtime/teardown.mjs +1 -2
- package/dist/dev/runtime/template.mjs +1 -2
- package/dist/dev/runtime/templateRefs/helpers.mjs +1 -2
- package/dist/dev/runtime/templateRefs.mjs +1 -2
- package/dist/dev/runtime/uniAppHost.mjs +1 -2
- package/dist/dev/runtime/updatePerformance.mjs +1 -2
- package/dist/dev/runtime/use.mjs +1 -2
- package/dist/dev/runtime/vueCompat/context.mjs +1 -2
- package/dist/dev/runtime/vueCompat/model.mjs +1 -2
- package/dist/dev/runtime/vueCompat/router.mjs +1 -2
- package/dist/dev/runtime/vueCompat/templateRef.mjs +1 -2
- package/dist/dev/scheduler.mjs +1 -2
- package/dist/dev/store/actions.mjs +1 -2
- package/dist/dev/store/base.mjs +1 -2
- package/dist/dev/store/define/create.mjs +1 -2
- package/dist/dev/store/define.mjs +1 -2
- package/dist/dev/store/manager.mjs +1 -2
- package/dist/dev/store/storeToRefs.mjs +1 -2
- package/dist/dev/store/subscriptions.mjs +1 -2
- package/dist/dev/store/types.mjs +1 -2
- package/dist/dev/store/utils.mjs +1 -2
- package/dist/dev/store/view.mjs +1 -2
- package/dist/dev/utils.mjs +1 -2
- package/dist/dev/version.mjs +1 -2
- package/dist/dev/vue-demi.mjs +1 -2
- package/dist/fetch.d.mts +0 -2
- package/dist/index.d.mts +13 -8
- package/dist/internal-reactivity.d.mts +2 -1
- package/dist/jsx-runtime.d.mts +1 -2
- package/dist/jsxTypes.d.mts +1 -3
- package/dist/macros/shared.d.mts +2 -3
- package/dist/macros.d.mts +3 -12
- package/dist/miniprogram/jsx-runtime.d.mts +0 -2
- package/dist/package.mjs +1 -1
- package/dist/reactivity/asyncDerivation.d.mts +1 -2
- package/dist/reactivity/computed.d.mts +2 -8
- package/dist/reactivity/core.d.mts +1 -3
- package/dist/reactivity/core.mjs +1 -1
- package/dist/reactivity/index.d.mts +2 -1
- package/dist/reactivity/reactive/mutation.d.mts +1 -2
- package/dist/reactivity/reactive/patch.d.mts +1 -3
- package/dist/reactivity/reactive/patchState.mjs +1 -1
- package/dist/reactivity/reactive/shallow.d.mts +1 -3
- package/dist/reactivity/reactive/shared.d.mts +1 -3
- package/dist/reactivity/reactive.d.mts +0 -2
- package/dist/reactivity/readonly.d.mts +1 -3
- package/dist/reactivity/ref.d.mts +2 -4
- package/dist/reactivity/ref.mjs +1 -1
- package/dist/reactivity/shallowRef.d.mts +1 -3
- package/dist/reactivity/toRefs.d.mts +1 -2
- package/dist/reactivity/traverse.d.mts +1 -3
- package/dist/reactivity/watch/types.d.mts +1 -2
- package/dist/reactivity/watch.d.mts +0 -2
- package/dist/router/auto-routes.d.mts +0 -2
- package/dist/router/createRouter.d.mts +1 -3
- package/dist/router/navigationCore.d.mts +1 -3
- package/dist/router/resolve.d.mts +1 -3
- package/dist/router/scrollRestoration/adapters.d.mts +1 -3
- package/dist/router/scrollRestoration/controller.d.mts +1 -3
- package/dist/router/scrollRestoration/index.d.mts +0 -2
- package/dist/router/scrollRestoration/index.mjs +1 -1
- package/dist/router/scrollRestoration/types.d.mts +1 -3
- package/dist/router/types.d.mts +1 -2
- package/dist/router/useRoute.d.mts +1 -3
- package/dist/router/useRouter.d.mts +1 -3
- package/dist/router.d.mts +0 -2
- package/dist/routerInternal/query.d.mts +1 -3
- package/dist/routerInternal/types.d.mts +1 -3
- package/dist/runtime/app/pending.d.mts +1 -3
- package/dist/runtime/app/setData/commitTracker.d.mts +1 -3
- package/dist/runtime/app/setData/observation.d.mts +1 -2
- package/dist/runtime/app/setData/scheduler.d.mts +1 -3
- package/dist/runtime/app/setData/scheduler.mjs +1 -1
- package/dist/runtime/app.d.mts +2 -4
- package/dist/runtime/capabilities.d.mts +2 -4
- package/dist/runtime/css.d.mts +1 -3
- package/dist/runtime/defaults.d.mts +1 -3
- package/dist/runtime/define/props.mjs +1 -1
- package/dist/runtime/define/scopedSlotOptions.mjs +1 -1
- package/dist/runtime/define/setupResult.mjs +1 -1
- package/dist/runtime/define.d.mts +4 -4
- package/dist/runtime/define.mjs +1 -1
- package/dist/runtime/disposables.d.mts +1 -3
- package/dist/runtime/elementIntersectionObserver.d.mts +1 -3
- package/dist/runtime/features/inlineEvents.d.mts +1 -3
- package/dist/runtime/features/jsxIslands.d.mts +1 -3
- package/dist/runtime/features/layout.d.mts +1 -3
- package/dist/runtime/features/patchStrategy.d.mts +1 -3
- package/dist/runtime/features/publicLayout.d.mts +2 -3
- package/dist/runtime/features/scopedSlots.d.mts +2 -4
- package/dist/runtime/features/setDataHighFrequencyWarning.d.mts +1 -3
- package/dist/runtime/features/templateRefs.d.mts +1 -3
- package/dist/runtime/hooks/base.d.mts +1 -3
- package/dist/runtime/hooks/register.d.mts +1 -3
- package/dist/runtime/hooks/vue.d.mts +1 -3
- package/dist/runtime/index.d.mts +7 -4
- package/dist/runtime/intersectionObserver.d.mts +1 -3
- package/dist/runtime/jsxIsland.d.mts +1 -3
- package/dist/runtime/layoutBridge.d.mts +0 -2
- package/dist/runtime/noSetData.d.mts +1 -3
- package/dist/runtime/pageEnvironment.d.mts +1 -3
- package/dist/runtime/pageLayout.d.mts +2 -3
- package/dist/runtime/pageScroll.d.mts +1 -3
- package/dist/runtime/provide.d.mts +0 -2
- package/dist/runtime/provideStore.d.mts +1 -3
- package/dist/runtime/publicRuntime.d.mts +1 -3
- package/dist/runtime/pullDownRefresh.d.mts +1 -3
- package/dist/runtime/register/app.d.mts +2 -4
- package/dist/runtime/register/component/hmrRegistration.mjs +1 -0
- package/dist/runtime/register/component/props.mjs +1 -1
- package/dist/runtime/register/component/registerDefinition.mjs +1 -1
- package/dist/runtime/register/component.d.mts +2 -4
- package/dist/runtime/register/component.mjs +1 -1
- package/dist/runtime/register/inline.d.mts +1 -2
- package/dist/runtime/register/runtimeInstance/setupPhase.mjs +1 -1
- package/dist/runtime/register/runtimeInstance.d.mts +2 -3
- package/dist/runtime/register/runtimeInstance.mjs +1 -1
- package/dist/runtime/register/setDataFrequencyWarning.mjs +1 -1
- package/dist/runtime/register/setup.d.mts +1 -2
- package/dist/runtime/register/watch.d.mts +1 -2
- package/dist/runtime/register/watch.mjs +1 -1
- package/dist/runtime/selectorQuery.d.mts +1 -3
- package/dist/runtime/template.d.mts +1 -3
- package/dist/runtime/templateRefTypes.d.mts +2 -6
- package/dist/runtime/types/core.d.mts +2 -8
- package/dist/runtime/types/miniprogram.d.mts +0 -2
- package/dist/runtime/types/miniprogramHost.d.mts +0 -2
- package/dist/runtime/types/miniprogramHostSources.d.mts +2 -3
- package/dist/runtime/types/options.d.mts +5 -53
- package/dist/runtime/types/props/propTypes.d.mts +1 -2
- package/dist/runtime/types/props/router.d.mts +1 -2
- package/dist/runtime/types/props/setup.d.mts +3 -4
- package/dist/runtime/types/runtime.d.mts +3 -4
- package/dist/runtime/types/setData.d.mts +1 -3
- package/dist/runtime/types.d.mts +5 -5
- package/dist/runtime/uniAppHost.d.mts +1 -2
- package/dist/runtime/updatePerformance.d.mts +1 -3
- package/dist/runtime/use.d.mts +1 -3
- package/dist/runtime/vueCompat/context.d.mts +1 -3
- package/dist/runtime/vueCompat/model.d.mts +2 -3
- package/dist/runtime/vueCompat/router.d.mts +1 -2
- package/dist/runtime/vueCompat/templateRef.d.mts +1 -3
- package/dist/scheduler.d.mts +1 -3
- package/dist/store/define.d.mts +1 -3
- package/dist/store/manager.d.mts +1 -3
- package/dist/store/storeToRefs.d.mts +1 -2
- package/dist/store/types.d.mts +3 -4
- package/dist/tt/jsx-runtime.d.mts +0 -2
- package/dist/types/definitions.d.mts +5 -0
- package/dist/types/pageLayout.d.mts +2 -0
- package/dist/types/pageMeta.d.mts +8 -0
- package/dist/types/reactivity.d.mts +11 -0
- package/dist/types.d.mts +5 -0
- package/dist/types.mjs +1 -0
- package/dist/version.d.mts +1 -3
- package/dist/vue-augment.d.mts +1 -3
- package/dist/vue-demi.d.mts +13 -9
- package/dist/vue-types.d.mts +3 -6
- package/dist/weapp/jsx-runtime.d.mts +0 -2
- package/package.json +22 -13
- /package/dist/_virtual/{_@oxc-project_runtime@0.153.0 → _@oxc-project_runtime@0.155.0}/helpers/esm/defineProperty.mjs +0 -0
- /package/dist/_virtual/{_@oxc-project_runtime@0.153.0 → _@oxc-project_runtime@0.155.0}/helpers/esm/toPrimitive.mjs +0 -0
- /package/dist/_virtual/{_@oxc-project_runtime@0.153.0 → _@oxc-project_runtime@0.155.0}/helpers/esm/toPropertyKey.mjs +0 -0
- /package/dist/_virtual/{_@oxc-project_runtime@0.153.0 → _@oxc-project_runtime@0.155.0}/helpers/esm/typeof.mjs +0 -0
|
@@ -3,7 +3,7 @@ import { registerComponent } from "../register/component.mjs";
|
|
|
3
3
|
import { createApp } from "../app.mjs";
|
|
4
4
|
import { WEVU_BINDING_MANIFEST_KEY, WEVU_SCOPED_SLOT_OWNER_REQUIRED_KEY } from "@weapp-core/constants";
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
// src/runtime/define/componentDefinition.ts
|
|
7
7
|
/**
|
|
8
8
|
* 从稳定的组件选项快照创建独立运行时和宿主生命周期定义。
|
|
9
9
|
*/
|
|
@@ -23,6 +23,5 @@ function createRuntimeComponentDefinition(options, registerNative = false) {
|
|
|
23
23
|
};
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
//#endregion
|
|
27
26
|
export { createRuntimeComponentDefinition };
|
|
28
27
|
//# sourceMappingURL=componentDefinition.mjs.map
|
|
@@ -3,7 +3,7 @@ import { toPlain } from "../diff.mjs";
|
|
|
3
3
|
import { resolveSetDataOptions } from "../app/setDataOptions.mjs";
|
|
4
4
|
import { WEVU_SLOT_OWNER_ID_KEY } from "@weapp-core/constants";
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
// src/runtime/define/initialComputed.ts
|
|
7
7
|
var InitialComputedBailout = class extends Error {};
|
|
8
8
|
function resolveComputedGetter(definition) {
|
|
9
9
|
if (typeof definition === "function") return definition;
|
|
@@ -126,6 +126,5 @@ function resolveNativeInitialData(data, computed, setData, methods, bindingManif
|
|
|
126
126
|
} : data;
|
|
127
127
|
}
|
|
128
128
|
|
|
129
|
-
//#endregion
|
|
130
129
|
export { resolveInitialComputedData, resolveNativeInitialData };
|
|
131
130
|
//# sourceMappingURL=initialComputed.mjs.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/runtime/define/options.ts
|
|
2
2
|
const OBJECT_OPTION_KEYS = [
|
|
3
3
|
"components",
|
|
4
4
|
"computed",
|
|
@@ -162,6 +162,5 @@ function resolveVueComponentOptions(options) {
|
|
|
162
162
|
return appendOptions({}, options, /* @__PURE__ */ new WeakSet());
|
|
163
163
|
}
|
|
164
164
|
|
|
165
|
-
//#endregion
|
|
166
165
|
export { resolveVueComponentOptions };
|
|
167
166
|
//# sourceMappingURL=options.mjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { inject, provide } from "../provide.mjs";
|
|
2
2
|
import { hasOwn } from "../../utils.mjs";
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
// src/runtime/define/optionsApi.ts
|
|
5
5
|
const MISSING_INJECTION = Symbol("wevu-missing-options-api-injection");
|
|
6
6
|
function resolveInjectionDescriptor(descriptor) {
|
|
7
7
|
if (typeof descriptor === "string" || typeof descriptor === "symbol") return { from: descriptor };
|
|
@@ -43,6 +43,5 @@ function applyOptionsApiProvide(option, context) {
|
|
|
43
43
|
for (const key of Reflect.ownKeys(provided)) provide(key, Reflect.get(provided, key));
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
//#endregion
|
|
47
46
|
export { applyOptionsApiProvide, resolveOptionsApiInjections };
|
|
48
47
|
//# sourceMappingURL=optionsApi.mjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { hasOwn } from "../../utils.mjs";
|
|
2
2
|
import { WEVU_NATIVE_DECLARATION_ADDRESS_PROP, WEVU_NATIVE_SLOT_CONTEXT_KEY, WEVU_SLOT_NAMES_PROP, WEVU_SLOT_OWNER_ID_PROP, WEVU_SLOT_SCOPE_KEY } from "@weapp-core/constants";
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
// src/runtime/define/props.ts
|
|
5
5
|
const ALLOW_NULL_PROP_INPUT_KEY = "__wevu_allowNullPropInput";
|
|
6
6
|
const PUBLIC_ALLOW_NULL_PROP_INPUT_KEY = "allowNullPropInput";
|
|
7
7
|
const NATIVE_PROPERTY_TYPE_MAP = /* @__PURE__ */ new Map([
|
|
@@ -162,6 +162,5 @@ function normalizeProps(baseOptions, props, explicitProperties) {
|
|
|
162
162
|
};
|
|
163
163
|
}
|
|
164
164
|
|
|
165
|
-
//#endregion
|
|
166
165
|
export { normalizeProps };
|
|
167
166
|
//# sourceMappingURL=props.mjs.map
|
|
@@ -6,7 +6,7 @@ import { decodeWxmlEntities, resolveDatasetEventValue } from "../inlineDataset.m
|
|
|
6
6
|
import { getOwnerProxy, getOwnerSnapshot, getOwnerTarget, subscribeOwner } from "../scopedSlots.mjs";
|
|
7
7
|
import { WEVU_BINDING_MANIFEST_KEY, WEVU_INLINE_HANDLER, WEVU_INLINE_MAP_KEY, WEVU_LAYOUT_HOSTS_KEY, WEVU_NATIVE_SLOT_CONTEXT_KEY, WEVU_OWNER_HANDLER, WEVU_PROPS_DERIVED_KEYS_KEY, WEVU_PUBLIC_RUNTIME_KEY, WEVU_SCOPED_SLOT_OWNER_REQUIRED_KEY, WEVU_SLOT_FUNCTION_TOKEN, WEVU_SLOT_OWNER_ID_KEY, WEVU_SLOT_OWNER_ID_PROP, WEVU_SLOT_OWNER_KEY, WEVU_SLOT_OWNER_PROXY_KEY, WEVU_SLOT_PROPS_DATA_KEY, WEVU_SLOT_PROPS_KEY, WEVU_SLOT_SCOPE_KEY, WEVU_TEMPLATE_REFS_KEY } from "@weapp-core/constants";
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
// src/runtime/define/scopedSlotOptions.ts
|
|
10
10
|
const SCOPED_SLOT_SNAPSHOT_OMIT_KEYS = [
|
|
11
11
|
WEVU_SLOT_OWNER_ID_KEY,
|
|
12
12
|
WEVU_SLOT_OWNER_ID_PROP,
|
|
@@ -362,6 +362,5 @@ function createScopedSlotOptions(overrides) {
|
|
|
362
362
|
return baseOptions;
|
|
363
363
|
}
|
|
364
364
|
|
|
365
|
-
//#endregion
|
|
366
365
|
export { createScopedSlotOptions };
|
|
367
366
|
//# sourceMappingURL=scopedSlotOptions.mjs.map
|
|
@@ -3,7 +3,7 @@ import { isReactive } from "../../reactivity/reactive.mjs";
|
|
|
3
3
|
import { isRef } from "../../reactivity/ref.mjs";
|
|
4
4
|
import { hasTrackableSetupBinding } from "../setupTracking.mjs";
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
// src/runtime/define/setupResult.ts
|
|
7
7
|
function isPlainObject(value) {
|
|
8
8
|
if (Object.prototype.toString.call(value) !== "[object Object]") return false;
|
|
9
9
|
const proto = Object.getPrototypeOf(value);
|
|
@@ -42,9 +42,7 @@ function preserveSetupAccessor(target, source, key) {
|
|
|
42
42
|
Object.defineProperty(target, key, descriptor);
|
|
43
43
|
return true;
|
|
44
44
|
}
|
|
45
|
-
function applySetupResult(runtime, target, result
|
|
46
|
-
const includeFunctionsInState = Boolean(options?.includeFunctionsInState);
|
|
47
|
-
const functionPropPaths = options?.functionPropPaths;
|
|
45
|
+
function applySetupResult(runtime, target, result) {
|
|
48
46
|
const methods = runtime?.methods ?? Object.create(null);
|
|
49
47
|
const state = runtime?.state ?? Object.create(null);
|
|
50
48
|
const setupState = runtime?.setupState ?? Object.create(null);
|
|
@@ -67,7 +65,7 @@ function applySetupResult(runtime, target, result, options) {
|
|
|
67
65
|
const bound = (...args) => val.apply(runtime?.proxy ?? runtime, args);
|
|
68
66
|
methods[key] = bound;
|
|
69
67
|
state[key] = bound;
|
|
70
|
-
|
|
68
|
+
rawSetupState[key] = bound;
|
|
71
69
|
methodsChanged = true;
|
|
72
70
|
} else {
|
|
73
71
|
if (hasTrackableSetupBinding(val)) runtime?.__wevu_trackSetupReactiveKey?.(key);
|
|
@@ -80,7 +78,7 @@ function applySetupResult(runtime, target, result, options) {
|
|
|
80
78
|
writable: true
|
|
81
79
|
});
|
|
82
80
|
} catch {}
|
|
83
|
-
if (!preservesAccessor)
|
|
81
|
+
if (!preservesAccessor) rawSetupState[key] = val;
|
|
84
82
|
}
|
|
85
83
|
});
|
|
86
84
|
if (runtime) {
|
|
@@ -90,6 +88,5 @@ function applySetupResult(runtime, target, result, options) {
|
|
|
90
88
|
}
|
|
91
89
|
}
|
|
92
90
|
|
|
93
|
-
//#endregion
|
|
94
91
|
export { applySetupResult, mergeSetupResultDescriptors, preserveSetupAccessor, shouldExposeInSnapshot };
|
|
95
92
|
//# sourceMappingURL=setupResult.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setupResult.mjs","names":[],"sources":["../../../../src/runtime/define/setupResult.ts"],"sourcesContent":["import { isReactive, isRef, toRaw } from '../../reactivity'\nimport { hasTrackableSetupBinding } from '../setupTracking'\n\nfunction isPlainObject(value: unknown): value is Record<string, any> {\n if (Object.prototype.toString.call(value) !== '[object Object]') {\n return false\n }\n const proto = Object.getPrototypeOf(value)\n return proto === null || proto === Object.prototype\n}\n\nexport function shouldExposeInSnapshot(value: unknown): boolean {\n if (value == null) {\n return true\n }\n if (typeof value !== 'object') {\n return true\n }\n if (isRef(value) || isReactive(value)) {\n return true\n }\n if (Array.isArray(value)) {\n return true\n }\n return isPlainObject(value)\n}\n\n/**\n * 合并编译后 setup 返回值,并保留可写顶层绑定的访问器。\n */\nexport function mergeSetupResultDescriptors(\n target: Record<string, unknown>,\n source: Record<string, unknown> | void,\n) {\n if (!source) {\n return target\n }\n for (const key of Object.keys(source)) {\n const descriptor = Object.getOwnPropertyDescriptor(source, key)\n if (typeof descriptor?.get === 'function' && typeof descriptor.set === 'function') {\n Object.defineProperty(target, key, descriptor)\n }\n else {\n Object.defineProperty(target, key, {\n configurable: true,\n enumerable: true,\n value: source[key],\n writable: true,\n })\n }\n }\n return target\n}\n\n/**\n * 将编译后 setup let 的访问器交给 setupState 持有。\n */\nexport function preserveSetupAccessor(\n target: Record<string, unknown>,\n source: Record<string, unknown>,\n key: string,\n) {\n const descriptor = Object.getOwnPropertyDescriptor(source, key)\n if (typeof descriptor?.get !== 'function' || typeof descriptor.set !== 'function') {\n return false\n }\n Object.defineProperty(target, key, descriptor)\n return true\n}\n\nexport function applySetupResult(\n runtime: any,\n target: any,\n result: any,\n
|
|
1
|
+
{"version":3,"file":"setupResult.mjs","names":[],"sources":["../../../../src/runtime/define/setupResult.ts"],"sourcesContent":["import { isReactive, isRef, toRaw } from '../../reactivity'\nimport { hasTrackableSetupBinding } from '../setupTracking'\n\nfunction isPlainObject(value: unknown): value is Record<string, any> {\n if (Object.prototype.toString.call(value) !== '[object Object]') {\n return false\n }\n const proto = Object.getPrototypeOf(value)\n return proto === null || proto === Object.prototype\n}\n\nexport function shouldExposeInSnapshot(value: unknown): boolean {\n if (value == null) {\n return true\n }\n if (typeof value !== 'object') {\n return true\n }\n if (isRef(value) || isReactive(value)) {\n return true\n }\n if (Array.isArray(value)) {\n return true\n }\n return isPlainObject(value)\n}\n\n/**\n * 合并编译后 setup 返回值,并保留可写顶层绑定的访问器。\n */\nexport function mergeSetupResultDescriptors(\n target: Record<string, unknown>,\n source: Record<string, unknown> | void,\n) {\n if (!source) {\n return target\n }\n for (const key of Object.keys(source)) {\n const descriptor = Object.getOwnPropertyDescriptor(source, key)\n if (typeof descriptor?.get === 'function' && typeof descriptor.set === 'function') {\n Object.defineProperty(target, key, descriptor)\n }\n else {\n Object.defineProperty(target, key, {\n configurable: true,\n enumerable: true,\n value: source[key],\n writable: true,\n })\n }\n }\n return target\n}\n\n/**\n * 将编译后 setup let 的访问器交给 setupState 持有。\n */\nexport function preserveSetupAccessor(\n target: Record<string, unknown>,\n source: Record<string, unknown>,\n key: string,\n) {\n const descriptor = Object.getOwnPropertyDescriptor(source, key)\n if (typeof descriptor?.get !== 'function' || typeof descriptor.set !== 'function') {\n return false\n }\n Object.defineProperty(target, key, descriptor)\n return true\n}\n\nexport function applySetupResult(\n runtime: any,\n target: any,\n result: any,\n) {\n const methods = runtime?.methods ?? Object.create(null)\n const state = runtime?.state ?? Object.create(null)\n const setupState = runtime?.setupState ?? Object.create(null)\n const rawState = isReactive(state) ? toRaw(state) : state\n const rawSetupState = (isReactive(setupState) ? toRaw(setupState) : setupState) as Record<string, unknown>\n let methodsChanged = false\n if (runtime && !runtime.methods) {\n try {\n runtime.methods = methods\n }\n catch {\n // 个别场景 runtime 可能只读,保持兼容行为。\n }\n }\n if (runtime && !runtime.state) {\n try {\n runtime.state = state\n }\n catch {\n // 个别场景 runtime 可能只读,保持兼容行为。\n }\n }\n if (runtime && !runtime.setupState) {\n try {\n runtime.setupState = setupState\n }\n catch {\n // 个别场景 runtime 可能只读,保持兼容行为。\n }\n }\n Object.keys(result).forEach((key) => {\n const val = (result as any)[key]\n const preservesAccessor = preserveSetupAccessor(rawSetupState, result, key)\n if (typeof val === 'function' && !preservesAccessor) {\n const bound = (...args: any[]) => (val as any).apply(runtime?.proxy ?? runtime, args)\n ;(methods as any)[key] = bound\n ;(state as any)[key] = bound\n rawSetupState[key] = bound\n methodsChanged = true\n }\n else {\n if (hasTrackableSetupBinding(val)) {\n runtime?.__wevu_trackSetupReactiveKey?.(key)\n }\n ;(state as any)[key] = val\n if (val === target || !shouldExposeInSnapshot(val)) {\n try {\n Object.defineProperty(rawState, key, {\n value: val,\n configurable: true,\n enumerable: false,\n writable: true,\n })\n }\n catch {\n // 保持 state 的兼容写入已完成,这里只兜底非枚举定义。\n }\n }\n if (!preservesAccessor) {\n rawSetupState[key] = val\n }\n }\n })\n if (runtime) {\n runtime.methods = runtime.methods ?? methods\n runtime.state = runtime.state ?? state\n if (methodsChanged) {\n runtime.__wevu_touchSetupMethodsVersion?.()\n }\n }\n}\n"],"mappings":";;;;;;AAGA,SAAS,cAAc,OAA8C;CACnE,IAAI,OAAO,UAAU,SAAS,KAAK,KAAK,MAAM,mBAC5C,OAAO;CAET,MAAM,QAAQ,OAAO,eAAe,KAAK;CACzC,OAAO,UAAU,QAAQ,UAAU,OAAO;AAC5C;AAEA,SAAgB,uBAAuB,OAAyB;CAC9D,IAAI,SAAS,MACX,OAAO;CAET,IAAI,OAAO,UAAU,UACnB,OAAO;CAET,IAAI,MAAM,KAAK,KAAK,WAAW,KAAK,GAClC,OAAO;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QAAQ;EACnC,MAAM,MAAO,OAAe;EAC5B,MAAM,oBAAoB,sBAAsB,eAAe,QAAQ,GAAG;EAC1E,IAAI,OAAO,QAAQ,cAAc,CAAC,mBAAmB;GACnD,MAAM,SAAS,GAAG,SAAiB,IAAY,MAAM,SAAS,SAAS,SAAS,IAAI;GACnF,AAAC,QAAgB,OAAO;GACxB,AAAC,MAAc,OAAO;GACvB,cAAc,OAAO;GACrB,iBAAiB;EACnB,OACK;GACH,IAAI,yBAAyB,GAAG,GAC9B,SAAS,+BAA+B,GAAG;GAE5C,AAAC,MAAc,OAAO;GACvB,IAAI,QAAQ,UAAU,CAAC,uBAAuB,GAAG,GAC/C,IAAI;IACF,OAAO,eAAe,UAAU,KAAK;KACnC,OAAO;KACP,cAAc;KACd,YAAY;KACZ,UAAU;IACZ,CAAC;GACH,QACM,CAEN;GAEF,IAAI,CAAC,mBACH,cAAc,OAAO;EAEzB;CACF,CAAC;CACD,IAAI,SAAS;EACX,QAAQ,UAAU,QAAQ,WAAW;EACrC,QAAQ,QAAQ,QAAQ,SAAS;EACjC,IAAI,gBACF,QAAQ,kCAAkC;CAE9C;AACF"}
|
|
@@ -11,7 +11,7 @@ import { applyOptionsApiProvide, resolveOptionsApiInjections } from "./define/op
|
|
|
11
11
|
import { normalizeProps } from "./define/props.mjs";
|
|
12
12
|
import { WEVU_BINDING_MANIFEST_KEY, WEVU_CSS_MODULES_KEY, WEVU_FUNCTION_PROP_PATHS_KEY, WEVU_SCOPED_SLOT_OWNER_REQUIRED_KEY, WEVU_SLOT_OWNER_ID_KEY, WEVU_SLOT_OWNER_ID_PROP, WEVU_SLOT_SCOPE_KEY } from "@weapp-core/constants";
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
// src/runtime/define.ts
|
|
15
15
|
const componentLifecycleDefinitions = /* @__PURE__ */ new WeakMap();
|
|
16
16
|
function resolveInitialDataContext(properties, methods) {
|
|
17
17
|
const context = { ...methods ?? {} };
|
|
@@ -62,7 +62,6 @@ function createComponentDefinition(options, registerNative) {
|
|
|
62
62
|
...setData ?? {},
|
|
63
63
|
functionPaths: functionPropPaths
|
|
64
64
|
} : setData);
|
|
65
|
-
const setupFunctionPropKeys = new Set(functionPropPaths.filter((path) => !path.includes(".")));
|
|
66
65
|
const normalizedMpOptions = normalizeProps(mpOptions, props, mpOptions.properties);
|
|
67
66
|
const initialDataContext = resolveInitialDataContext(normalizedMpOptions.properties, methods);
|
|
68
67
|
const resolvedData = typeof data === "function" ? () => data.call(initialDataContext) : data;
|
|
@@ -70,17 +69,13 @@ function createComponentDefinition(options, registerNative) {
|
|
|
70
69
|
if (cssModules && typeof cssModules === "object") ctx.instance[WEVU_CSS_MODULES_KEY] = cssModules;
|
|
71
70
|
const publicInstance = ctx?.proxy ?? ctx?.instance ?? Object.create(null);
|
|
72
71
|
const injected = resolveOptionsApiInjections(injectOptions, publicInstance);
|
|
73
|
-
if (provideOptions != null) applyOptionsApiProvide(provideOptions, publicInstance);
|
|
74
72
|
const setupResult = typeof setup === "function" ? runSetupFunction(setup, props, ctx) : void 0;
|
|
75
73
|
const result = mergeSetupResultDescriptors({
|
|
76
74
|
...injected,
|
|
77
75
|
...cssModules ?? {}
|
|
78
76
|
}, setupResult);
|
|
79
|
-
if (ctx && Object.keys(result).length) applySetupResult(ctx.runtime, ctx.instance, result
|
|
80
|
-
|
|
81
|
-
functionPropPaths: allowFunctionProps === false ? void 0 : setupFunctionPropKeys
|
|
82
|
-
});
|
|
83
|
-
return result;
|
|
77
|
+
if (ctx && Object.keys(result).length) applySetupResult(ctx.runtime, ctx.instance, result);
|
|
78
|
+
if (provideOptions != null) applyOptionsApiProvide(provideOptions, publicInstance);
|
|
84
79
|
}) : void 0;
|
|
85
80
|
const nativeData = typeof resolvedData === "function" ? resolvedData() : resolvedData;
|
|
86
81
|
const nativeOwnerId = nativeData && typeof nativeData === "object" ? Reflect.get(nativeData, WEVU_SLOT_OWNER_ID_KEY) : void 0;
|
|
@@ -151,6 +146,5 @@ function createWevuComponent(options) {
|
|
|
151
146
|
});
|
|
152
147
|
}
|
|
153
148
|
|
|
154
|
-
//#endregion
|
|
155
149
|
export { createIsolatedWevuComponentDefinition, createWevuComponent, createWevuComponentDefinition, defineComponent, getWevuComponentLifecycleDefinition };
|
|
156
150
|
//# sourceMappingURL=define.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"define.mjs","names":[],"sources":["../../../src/runtime/define.ts"],"sourcesContent":["import type { WevuRuntimeBindingManifestV1 } from '@weapp-core/constants'\nimport type { RuntimeComponentDefinitionOptions } from './define/componentDefinition'\nimport type {\n ComponentPropsOptions,\n ComponentPublicInstance,\n ComputedDefinitions,\n DefineComponent,\n DefineComponentOptions,\n InferProps,\n MethodDefinitions,\n MiniProgramComponentPropertyOption,\n MiniProgramComponentRawOptions,\n SetDataSnapshotOptions,\n ShallowUnwrapRef,\n} from './types'\nimport {\n WEVU_BINDING_MANIFEST_KEY,\n WEVU_CSS_MODULES_KEY,\n WEVU_FUNCTION_PROP_PATHS_KEY,\n WEVU_SCOPED_SLOT_OWNER_REQUIRED_KEY,\n WEVU_SLOT_OWNER_ID_KEY,\n WEVU_SLOT_OWNER_ID_PROP,\n WEVU_SLOT_SCOPE_KEY,\n} from '@weapp-core/constants'\nimport { hasOwn } from '../utils'\nimport { hasBindingOutputPath, resolveBindingManifest } from './bindingManifest'\nimport { requireRuntimeCapability } from './capabilities'\nimport { applyWevuComponentDefaults } from './defaults'\nimport {\n createRuntimeComponentDefinition,\n} from './define/componentDefinition'\nimport { resolveNativeInitialData } from './define/initialComputed'\nimport { resolveVueComponentOptions } from './define/options'\nimport { applyOptionsApiProvide, resolveOptionsApiInjections } from './define/optionsApi'\nimport { normalizeProps } from './define/props'\nimport { applySetupResult, mergeSetupResultDescriptors } from './define/setupResult'\nimport { runSetupFunction } from './register'\n\nconst componentLifecycleDefinitions = new WeakMap<object, Record<string, any>>()\n\nfunction resolveInitialDataContext(properties: unknown, methods: MethodDefinitions | undefined) {\n const context: Record<string, unknown> = { ...(methods ?? {}) }\n if (!properties || typeof properties !== 'object') {\n return context\n }\n for (const [name, definition] of Object.entries(properties)) {\n if (definition && typeof definition === 'object' && hasOwn(definition, 'value')) {\n context[name] = (definition as Record<string, unknown>).value\n }\n }\n return context\n}\n\nfunction shouldDeclareNativeSlotOwnerId(\n setData: SetDataSnapshotOptions | undefined,\n bindingManifest: WevuRuntimeBindingManifestV1 | undefined,\n) {\n return (\n Array.isArray(setData?.pick)\n && setData.pick.includes(WEVU_SLOT_OWNER_ID_KEY)\n ) || (\n bindingManifest?.features?.scopedSlots === true\n && hasBindingOutputPath(bindingManifest, WEVU_SLOT_OWNER_ID_KEY)\n )\n}\n\nfunction shouldSeedNativeSlotOwnerId(mpOptions: Record<string, unknown>) {\n return Boolean(mpOptions.__wevu_isPage)\n}\n\nfunction hasScopedSlotHostProperties(mpOptions: Record<string, any>) {\n const properties = mpOptions.properties\n return Boolean(\n properties\n && typeof properties === 'object'\n && (\n WEVU_SLOT_OWNER_ID_PROP in properties\n || WEVU_SLOT_SCOPE_KEY in properties\n ),\n )\n}\n\nfunction resolveScopedSlotHostSetData(\n mpOptions: Record<string, any>,\n setData: DefineComponentOptions<any, any, any, any, any>['setData'],\n) {\n if (setData?.strategy !== 'patch' || !hasScopedSlotHostProperties(mpOptions)) {\n return setData\n }\n return {\n ...setData,\n strategy: 'diff' as const,\n }\n}\n\n/**\n * defineComponent 返回的组件定义描述,用于手动注册或高级用法。\n */\nexport interface ComponentDefinition<\n D extends object,\n C extends ComputedDefinitions,\n M extends MethodDefinitions,\n> {\n /**\n * 内部 runtime app(高级能力使用),不对外暴露正式 API。\n * @internal\n */\n __wevu_runtime: import('./types').RuntimeApp<D, C, M>\n\n /**\n * 内部选项快照(高级能力使用),包含 data/computed/methods 等。\n * @internal\n */\n __wevu_options: {\n scopedSlotOwnerRequired: boolean\n data: () => D\n computed: C\n methods: M\n setData: import('./types').SetDataSnapshotOptions | undefined\n bindingManifest?: WevuRuntimeBindingManifestV1\n watch: Record<string, any> | undefined\n setup: ((props: any, ctx: any) => any) | undefined\n mpOptions: MiniProgramComponentRawOptions\n }\n}\n\nfunction materializeComponentDefinition(\n componentOptions: RuntimeComponentDefinitionOptions,\n registerNative = false,\n) {\n const { lifecycleDefinition, runtimeApp } = createRuntimeComponentDefinition(componentOptions, registerNative)\n const definition: ComponentDefinition<any, any, any> = {\n __wevu_runtime: runtimeApp as any,\n __wevu_options: componentOptions as ComponentDefinition<any, any, any>['__wevu_options'],\n }\n componentLifecycleDefinitions.set(definition, lifecycleDefinition)\n return definition\n}\n\ntype SetupBindings<S> = Exclude<S, void> extends never ? Record<never, never> : Exclude<S, void>\ntype ResolveProps<P> = P extends ComponentPropsOptions ? InferProps<P> : P\n\nexport interface WevuComponentConstructor<\n Props,\n RawBindings,\n D extends object,\n C extends ComputedDefinitions,\n M extends MethodDefinitions,\n> {\n new (): ComponentPublicInstance<D, C, M, Props> & ShallowUnwrapRef<RawBindings>\n}\n\nexport type WevuDefinedComponent<\n PropsOrPropOptions,\n RawBindings,\n D extends object,\n C extends ComputedDefinitions,\n M extends MethodDefinitions,\n> = DefineComponent<PropsOrPropOptions, RawBindings, D, C, M> & ComponentDefinition<D, C, M>\nexport interface SetupContextWithTypeProps<TypeProps> {\n props: TypeProps\n [key: string]: any\n}\nexport type SetupFunctionWithTypeProps<\n TypeProps,\n> = (\n props: TypeProps,\n ctx: SetupContextWithTypeProps<TypeProps>,\n) => Record<string, any> | void\nexport interface DefineComponentTypePropsOptions<TypeProps> {\n __typeProps: TypeProps\n setup?: SetupFunctionWithTypeProps<TypeProps>\n [key: string]: any\n}\nexport interface DefineComponentWithTypeProps<TypeProps> {\n new (): { $props: TypeProps } & Record<string, any>\n}\n\n/**\n * 按 Vue 3 风格定义一个小程序组件/页面。\n *\n * - 统一注册为 `Component()`\n *\n * @param options 组件定义项\n * @returns 可手动注册的组件定义\n *\n * @example\n * ```ts\n * defineComponent({\n * data: () => ({ count: 0 }),\n * setup() {\n * onMounted(() => console.log('已挂载'))\n * }\n * })\n * ```\n *\n * @example\n * ```ts\n * defineComponent({\n * setup() {\n * onPageScroll(() => {})\n * }\n * })\n * ```\n */\n// @ts-expect-error -- TS2589:__typeProps 签名的重载实例化深度过高。\nexport function defineComponent<\n TypeProps = any,\n>(\n options: DefineComponentTypePropsOptions<TypeProps>,\n): DefineComponentWithTypeProps<TypeProps>\nexport function defineComponent<\n P extends ComponentPropsOptions = Record<never, never>,\n D extends object = Record<never, never>,\n C extends ComputedDefinitions = Record<never, never>,\n M extends MethodDefinitions = Record<never, never>,\n S extends Record<string, any> | void = void,\n>(\n options: DefineComponentOptions<P, D, C, M, S>,\n): WevuComponentConstructor<ResolveProps<P>, SetupBindings<S>, D, C, M> & ComponentDefinition<D, C, M>\nexport function defineComponent(\n options: DefineComponentOptions<any, any, any, any, any>,\n): WevuComponentConstructor<Record<string, any>, Record<string, any>, Record<string, any>, ComputedDefinitions, MethodDefinitions>\n & ComponentDefinition<any, any, any> {\n // eslint-disable-next-line ts/no-use-before-define -- 重载实现需保持在内部共享工厂之前。\n return createComponentDefinition(options, true) as any\n}\n\nfunction createComponentDefinition(\n options: DefineComponentOptions<any, any, any, any, any>,\n registerNative: boolean,\n) {\n const resolvedOptions = resolveVueComponentOptions(applyWevuComponentDefaults(options))\n const {\n __typeProps: _typeProps,\n [WEVU_SCOPED_SLOT_OWNER_REQUIRED_KEY]: scopedSlotOwnerRequired,\n data,\n computed,\n methods,\n setData,\n watch,\n setup,\n props,\n inject: injectOptions,\n provide: provideOptions,\n allowFunctionProps,\n [WEVU_BINDING_MANIFEST_KEY]: rawBindingManifest,\n [WEVU_CSS_MODULES_KEY]: cssModules,\n ...mpOptions\n } = resolvedOptions as typeof resolvedOptions & { [WEVU_SCOPED_SLOT_OWNER_REQUIRED_KEY]?: boolean }\n const bindingManifest = resolveBindingManifest(rawBindingManifest)\n\n const rawFunctionPropPaths = (mpOptions as any)[WEVU_FUNCTION_PROP_PATHS_KEY]\n const functionPropPaths: string[] = Array.isArray(rawFunctionPropPaths)\n ? [...new Set(rawFunctionPropPaths.filter((path: unknown): path is string => typeof path === 'string' && path.length > 0))]\n : []\n delete (mpOptions as any)[WEVU_FUNCTION_PROP_PATHS_KEY]\n\n const rawResolvedSetData = allowFunctionProps === true\n ? {\n ...(setData ?? {}),\n includeFunctions: true,\n functionPaths: functionPropPaths,\n }\n : allowFunctionProps === false\n ? setData\n : functionPropPaths.length\n ? {\n ...(setData ?? {}),\n functionPaths: functionPropPaths,\n }\n : setData\n const resolvedSetData = resolveScopedSlotHostSetData(mpOptions, rawResolvedSetData)\n const setupFunctionPropKeys = new Set(\n functionPropPaths\n .filter(path => !path.includes('.')),\n )\n\n const normalizedMpOptions = normalizeProps(mpOptions, props, mpOptions.properties)\n const initialDataContext = resolveInitialDataContext(normalizedMpOptions.properties, methods)\n const resolvedData = typeof data === 'function'\n ? () => data.call(initialDataContext)\n : data\n\n const hasOptionsApiContext = injectOptions != null || provideOptions != null\n const setupWrapper = typeof setup === 'function' || hasOptionsApiContext || cssModules\n ? ((props, ctx) => {\n if (cssModules && typeof cssModules === 'object') {\n ;((ctx as any).instance as Record<string, any>)[WEVU_CSS_MODULES_KEY] = cssModules\n }\n const publicInstance = (ctx as any)?.proxy ?? (ctx as any)?.instance ?? Object.create(null)\n const injected = resolveOptionsApiInjections(injectOptions, publicInstance)\n if (provideOptions != null) {\n applyOptionsApiProvide(provideOptions, publicInstance)\n }\n const setupResult = typeof setup === 'function'\n ? runSetupFunction(setup as any, props as Record<string, any>, ctx as any) as Record<string, any> | void\n : undefined\n const result = mergeSetupResultDescriptors({\n ...injected,\n ...(cssModules ?? {}),\n }, setupResult)\n if (ctx && Object.keys(result).length) {\n applySetupResult((ctx as any).runtime, (ctx as any).instance, result, {\n includeFunctionsInState: allowFunctionProps === true,\n functionPropPaths: allowFunctionProps === false ? undefined : setupFunctionPropKeys,\n })\n }\n return result\n }) satisfies DefineComponentOptions<ComponentPropsOptions, any, any, any, any>['setup']\n : undefined\n\n const nativeData = typeof resolvedData === 'function'\n ? resolvedData()\n : resolvedData\n const nativeOwnerId = nativeData && typeof nativeData === 'object'\n ? Reflect.get(nativeData, WEVU_SLOT_OWNER_ID_KEY)\n : undefined\n const shouldDeclareOwnerId = shouldDeclareNativeSlotOwnerId(resolvedSetData, bindingManifest)\n const scopedSlotHooks = shouldDeclareOwnerId\n ? requireRuntimeCapability('scopedSlots', 'defineComponent(scoped-slot owner metadata)')\n : undefined\n const seededNativeData = shouldDeclareOwnerId\n ? {\n ...(nativeData && typeof nativeData === 'object' ? nativeData : {}),\n [WEVU_SLOT_OWNER_ID_KEY]: shouldSeedNativeSlotOwnerId(mpOptions)\n ? nativeOwnerId || scopedSlotHooks?.allocateOwnerId()\n : nativeOwnerId || '',\n }\n : nativeData\n const nativeInitialData = resolveNativeInitialData(seededNativeData, computed as ComputedDefinitions, resolvedSetData, methods as Record<string, any> | undefined, bindingManifest)\n const mpOptionsWithProps = nativeInitialData !== undefined\n ? {\n ...normalizedMpOptions,\n data: nativeInitialData,\n }\n : normalizedMpOptions\n\n const componentOptions: RuntimeComponentDefinitionOptions = {\n scopedSlotOwnerRequired: scopedSlotOwnerRequired === true,\n data: resolvedData as () => Record<string, any>,\n computed: computed as ComputedDefinitions,\n methods: methods as MethodDefinitions,\n setData: resolvedSetData,\n bindingManifest,\n watch,\n setup: setupWrapper,\n mpOptions: mpOptionsWithProps as MiniProgramComponentRawOptions,\n }\n\n const definition = materializeComponentDefinition(componentOptions, registerNative)\n\n return definition as unknown as WevuComponentConstructor<\n ResolveProps<ComponentPropsOptions>,\n Record<string, any>,\n Record<string, any>,\n ComputedDefinitions,\n MethodDefinitions\n > & ComponentDefinition<any, any, any>\n}\n\n/**\n * 创建不触发宿主全局注册的 Wevu 组件定义。\n *\n * @param options 组件选项\n * @internal\n */\nexport function createWevuComponentDefinition(\n options: DefineComponentOptions<any, any, any, any, any>,\n) {\n return createComponentDefinition(options, false)\n}\n\n/**\n * 从现有组件定义派生拥有独立应用上下文的组件定义。\n *\n * @param definition 已解析的 Wevu 组件定义\n * @internal\n */\nexport function createIsolatedWevuComponentDefinition(definition: object) {\n const componentOptions = (definition as ComponentDefinition<any, any, any>).__wevu_options\n if (!componentOptions) {\n throw new TypeError('无法从非 Wevu 组件定义创建独立运行时')\n }\n return materializeComponentDefinition(componentOptions)\n}\n\n/**\n * 获取组件定义对应的宿主生命周期定义。\n *\n * @param definition Wevu 组件定义\n * @internal\n */\nexport function getWevuComponentLifecycleDefinition(definition: object) {\n return componentLifecycleDefinitions.get(definition)\n}\n\n/**\n * 从 Vue SFC 选项创建 wevu 组件,供 weapp-vite 编译产物直接调用的兼容入口。\n *\n * @param options 组件选项,可能包含小程序特有的 properties\n * @internal\n */\nexport function createWevuComponent<\n P extends ComponentPropsOptions = ComponentPropsOptions,\n D extends object = Record<string, any>,\n C extends ComputedDefinitions = ComputedDefinitions,\n M extends MethodDefinitions = MethodDefinitions,\n>(\n options: DefineComponentOptions<P, D, C, M> & { properties?: MiniProgramComponentPropertyOption },\n): void {\n const allowNullPropInput = options.allowNullPropInput ?? true\n defineComponent({\n ...options,\n allowNullPropInput,\n __wevu_allowNullPropInput: allowNullPropInput,\n })\n}\n"],"mappings":";;;;;;;;;;;;;;AAsCA,MAAM,gDAAgC,IAAI,QAAqC;AAE/E,SAAS,0BAA0B,YAAqB,SAAwC;CAC9F,MAAM,UAAmC,EAAE,GAAI,WAAW,CAAC,EAAG;CAC9D,IAAI,CAAC,cAAc,OAAO,eAAe,UACvC,OAAO;CAET,KAAK,MAAM,CAAC,MAAM,eAAe,OAAO,QAAQ,UAAU,GACxD,IAAI,cAAc,OAAO,eAAe,YAAY,OAAO,YAAY,OAAO,GAC5E,QAAQ,QAAS,WAAuC;CAG5D,OAAO;AACT;AAEA,SAAS,+BACP,SACA,iBACA;CACA,OACE,MAAM,QAAQ,SAAS,IAAI,KACxB,QAAQ,KAAK,SAAS,sBAAsB,KAE/C,iBAAiB,UAAU,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OAAO,eAAe,WAAW,aAAa,CAAC;GAChE,yBAAyB,4BAA4B,SAAS,IAC3D,iBAAiB,iBAAiB,gBAAgB,IAClD,iBAAiB;CACvB,IACA;CACJ,MAAM,oBAAoB,yBAAyB,kBAAkB,UAAiC,iBAAiB,SAA4C,eAAe;CAClL,MAAM,qBAAqB,sBAAsB,SAC7C;EACE,GAAG;EACH,MAAM;CACR,IACA;CAgBJ,OAFmB,+BAA+B;EAXhD,yBAAyB,4BAA4B;EACrD,MAAM;EACI;EACD;EACT,SAAS;EACT;EACA;EACA,OAAO;EACP,WAAW;CAGoD,GAAG,cAEpD;AAOlB;;;;;;;AAQA,SAAgB,8BACd,SACA;CACA,OAAO,0BAA0B,SAAS,KAAK;AACjD;;;;;;;AAQA,SAAgB,sCAAsC,YAAoB;CACxE,MAAM,mBAAoB,WAAkD;CAC5E,IAAI,CAAC,kBACH,MAAM,IAAI,UAAU,uBAAuB;CAE7C,OAAO,+BAA+B,gBAAgB;AACxD;;;;;;;AAQA,SAAgB,oCAAoC,YAAoB;CACtE,OAAO,8BAA8B,IAAI,UAAU;AACrD;;;;;;;AAQA,SAAgB,oBAMd,SACM;CACN,MAAM,qBAAqB,QAAQ,sBAAsB;CACzD,gBAAgB;EACd,GAAG;EACH;EACA,2BAA2B;CAC7B,CAAC;AACH"}
|
|
1
|
+
{"version":3,"file":"define.mjs","names":[],"sources":["../../../src/runtime/define.ts"],"sourcesContent":["import type { WevuRuntimeBindingManifestV1 } from '@weapp-core/constants'\nimport type { RuntimeComponentDefinitionOptions } from './define/componentDefinition'\nimport type {\n ComponentPropsOptions,\n ComponentPublicInstance,\n ComputedDefinitions,\n DefineComponent,\n DefineComponentOptions,\n InferProps,\n MethodDefinitions,\n MiniProgramComponentPropertyOption,\n MiniProgramComponentRawOptions,\n SetDataSnapshotOptions,\n ShallowUnwrapRef,\n} from './types'\nimport {\n WEVU_BINDING_MANIFEST_KEY,\n WEVU_CSS_MODULES_KEY,\n WEVU_FUNCTION_PROP_PATHS_KEY,\n WEVU_SCOPED_SLOT_OWNER_REQUIRED_KEY,\n WEVU_SLOT_OWNER_ID_KEY,\n WEVU_SLOT_OWNER_ID_PROP,\n WEVU_SLOT_SCOPE_KEY,\n} from '@weapp-core/constants'\nimport { hasOwn } from '../utils'\nimport { hasBindingOutputPath, resolveBindingManifest } from './bindingManifest'\nimport { requireRuntimeCapability } from './capabilities'\nimport { applyWevuComponentDefaults } from './defaults'\nimport {\n createRuntimeComponentDefinition,\n} from './define/componentDefinition'\nimport { resolveNativeInitialData } from './define/initialComputed'\nimport { resolveVueComponentOptions } from './define/options'\nimport { applyOptionsApiProvide, resolveOptionsApiInjections } from './define/optionsApi'\nimport { normalizeProps } from './define/props'\nimport { applySetupResult, mergeSetupResultDescriptors } from './define/setupResult'\nimport { runSetupFunction } from './register'\n\nconst componentLifecycleDefinitions = new WeakMap<object, Record<string, any>>()\n\nfunction resolveInitialDataContext(properties: unknown, methods: MethodDefinitions | undefined) {\n const context: Record<string, unknown> = { ...(methods ?? {}) }\n if (!properties || typeof properties !== 'object') {\n return context\n }\n for (const [name, definition] of Object.entries(properties)) {\n if (definition && typeof definition === 'object' && hasOwn(definition, 'value')) {\n context[name] = (definition as Record<string, unknown>).value\n }\n }\n return context\n}\n\nfunction shouldDeclareNativeSlotOwnerId(\n setData: SetDataSnapshotOptions | undefined,\n bindingManifest: WevuRuntimeBindingManifestV1 | undefined,\n) {\n return (\n Array.isArray(setData?.pick)\n && setData.pick.includes(WEVU_SLOT_OWNER_ID_KEY)\n ) || (\n bindingManifest?.features?.scopedSlots === true\n && hasBindingOutputPath(bindingManifest, WEVU_SLOT_OWNER_ID_KEY)\n )\n}\n\nfunction shouldSeedNativeSlotOwnerId(mpOptions: Record<string, unknown>) {\n return Boolean(mpOptions.__wevu_isPage)\n}\n\nfunction hasScopedSlotHostProperties(mpOptions: Record<string, any>) {\n const properties = mpOptions.properties\n return Boolean(\n properties\n && typeof properties === 'object'\n && (\n WEVU_SLOT_OWNER_ID_PROP in properties\n || WEVU_SLOT_SCOPE_KEY in properties\n ),\n )\n}\n\nfunction resolveScopedSlotHostSetData(\n mpOptions: Record<string, any>,\n setData: DefineComponentOptions<any, any, any, any, any>['setData'],\n) {\n if (setData?.strategy !== 'patch' || !hasScopedSlotHostProperties(mpOptions)) {\n return setData\n }\n return {\n ...setData,\n strategy: 'diff' as const,\n }\n}\n\n/**\n * defineComponent 返回的组件定义描述,用于手动注册或高级用法。\n */\nexport interface ComponentDefinition<\n D extends object,\n C extends ComputedDefinitions,\n M extends MethodDefinitions,\n> {\n /**\n * 内部 runtime app(高级能力使用),不对外暴露正式 API。\n * @internal\n */\n __wevu_runtime: import('./types').RuntimeApp<D, C, M>\n\n /**\n * 内部选项快照(高级能力使用),包含 data/computed/methods 等。\n * @internal\n */\n __wevu_options: {\n scopedSlotOwnerRequired: boolean\n data: () => D\n computed: C\n methods: M\n setData: import('./types').SetDataSnapshotOptions | undefined\n bindingManifest?: WevuRuntimeBindingManifestV1\n watch: Record<string, any> | undefined\n setup: ((props: any, ctx: any) => any) | undefined\n mpOptions: MiniProgramComponentRawOptions\n }\n}\n\nfunction materializeComponentDefinition(\n componentOptions: RuntimeComponentDefinitionOptions,\n registerNative = false,\n) {\n const { lifecycleDefinition, runtimeApp } = createRuntimeComponentDefinition(componentOptions, registerNative)\n const definition: ComponentDefinition<any, any, any> = {\n __wevu_runtime: runtimeApp as any,\n __wevu_options: componentOptions as ComponentDefinition<any, any, any>['__wevu_options'],\n }\n componentLifecycleDefinitions.set(definition, lifecycleDefinition)\n return definition\n}\n\ntype SetupBindings<S> = Exclude<S, void> extends never ? Record<never, never> : Exclude<S, void>\ntype ResolveProps<P> = P extends ComponentPropsOptions ? InferProps<P> : P\n\nexport interface WevuComponentConstructor<\n Props,\n RawBindings,\n D extends object,\n C extends ComputedDefinitions,\n M extends MethodDefinitions,\n> {\n new (): ComponentPublicInstance<D, C, M, Props> & ShallowUnwrapRef<RawBindings>\n}\n\nexport type WevuDefinedComponent<\n PropsOrPropOptions,\n RawBindings,\n D extends object,\n C extends ComputedDefinitions,\n M extends MethodDefinitions,\n> = DefineComponent<PropsOrPropOptions, RawBindings, D, C, M> & ComponentDefinition<D, C, M>\nexport interface SetupContextWithTypeProps<TypeProps> {\n props: TypeProps\n [key: string]: any\n}\nexport type SetupFunctionWithTypeProps<\n TypeProps,\n> = (\n props: TypeProps,\n ctx: SetupContextWithTypeProps<TypeProps>,\n) => Record<string, any> | void\nexport interface DefineComponentTypePropsOptions<TypeProps> {\n __typeProps: TypeProps\n setup?: SetupFunctionWithTypeProps<TypeProps>\n [key: string]: any\n}\nexport interface DefineComponentWithTypeProps<TypeProps> {\n new (): { $props: TypeProps } & Record<string, any>\n}\n\n/**\n * 按 Vue 3 风格定义一个小程序组件/页面。\n *\n * - 统一注册为 `Component()`\n *\n * @param options 组件定义项\n * @returns 可手动注册的组件定义\n *\n * @example\n * ```ts\n * defineComponent({\n * data: () => ({ count: 0 }),\n * setup() {\n * onMounted(() => console.log('已挂载'))\n * }\n * })\n * ```\n *\n * @example\n * ```ts\n * defineComponent({\n * setup() {\n * onPageScroll(() => {})\n * }\n * })\n * ```\n */\n// @ts-expect-error -- TS2589:__typeProps 签名的重载实例化深度过高。\nexport function defineComponent<\n TypeProps = any,\n>(\n options: DefineComponentTypePropsOptions<TypeProps>,\n): DefineComponentWithTypeProps<TypeProps>\nexport function defineComponent<\n P extends ComponentPropsOptions = Record<never, never>,\n D extends object = Record<never, never>,\n C extends ComputedDefinitions = Record<never, never>,\n M extends MethodDefinitions = Record<never, never>,\n S extends Record<string, any> | void = void,\n>(\n options: DefineComponentOptions<P, D, C, M, S>,\n): WevuComponentConstructor<ResolveProps<P>, SetupBindings<S>, D, C, M> & ComponentDefinition<D, C, M>\nexport function defineComponent(\n options: DefineComponentOptions<any, any, any, any, any>,\n): WevuComponentConstructor<Record<string, any>, Record<string, any>, Record<string, any>, ComputedDefinitions, MethodDefinitions>\n & ComponentDefinition<any, any, any> {\n // eslint-disable-next-line ts/no-use-before-define -- 重载实现需保持在内部共享工厂之前。\n return createComponentDefinition(options, true) as any\n}\n\nfunction createComponentDefinition(\n options: DefineComponentOptions<any, any, any, any, any>,\n registerNative: boolean,\n) {\n const resolvedOptions = resolveVueComponentOptions(applyWevuComponentDefaults(options))\n const {\n __typeProps: _typeProps,\n [WEVU_SCOPED_SLOT_OWNER_REQUIRED_KEY]: scopedSlotOwnerRequired,\n data,\n computed,\n methods,\n setData,\n watch,\n setup,\n props,\n inject: injectOptions,\n provide: provideOptions,\n allowFunctionProps,\n [WEVU_BINDING_MANIFEST_KEY]: rawBindingManifest,\n [WEVU_CSS_MODULES_KEY]: cssModules,\n ...mpOptions\n } = resolvedOptions as typeof resolvedOptions & { [WEVU_SCOPED_SLOT_OWNER_REQUIRED_KEY]?: boolean }\n const bindingManifest = resolveBindingManifest(rawBindingManifest)\n\n const rawFunctionPropPaths = (mpOptions as any)[WEVU_FUNCTION_PROP_PATHS_KEY]\n const functionPropPaths: string[] = Array.isArray(rawFunctionPropPaths)\n ? [...new Set(rawFunctionPropPaths.filter((path: unknown): path is string => typeof path === 'string' && path.length > 0))]\n : []\n delete (mpOptions as any)[WEVU_FUNCTION_PROP_PATHS_KEY]\n\n const rawResolvedSetData = allowFunctionProps === true\n ? {\n ...(setData ?? {}),\n includeFunctions: true,\n functionPaths: functionPropPaths,\n }\n : allowFunctionProps === false\n ? setData\n : functionPropPaths.length\n ? {\n ...(setData ?? {}),\n functionPaths: functionPropPaths,\n }\n : setData\n const resolvedSetData = resolveScopedSlotHostSetData(mpOptions, rawResolvedSetData)\n\n const normalizedMpOptions = normalizeProps(mpOptions, props, mpOptions.properties)\n const initialDataContext = resolveInitialDataContext(normalizedMpOptions.properties, methods)\n const resolvedData = typeof data === 'function'\n ? () => data.call(initialDataContext)\n : data\n\n const hasOptionsApiContext = injectOptions != null || provideOptions != null\n const setupWrapper = typeof setup === 'function' || hasOptionsApiContext || cssModules\n ? ((props, ctx) => {\n if (cssModules && typeof cssModules === 'object') {\n ;((ctx as any).instance as Record<string, any>)[WEVU_CSS_MODULES_KEY] = cssModules\n }\n const publicInstance = (ctx as any)?.proxy ?? (ctx as any)?.instance ?? Object.create(null)\n const injected = resolveOptionsApiInjections(injectOptions, publicInstance)\n const setupResult = typeof setup === 'function'\n ? runSetupFunction(setup as any, props as Record<string, any>, ctx as any) as Record<string, any> | void\n : undefined\n const result = mergeSetupResultDescriptors({\n ...injected,\n ...(cssModules ?? {}),\n }, setupResult)\n if (ctx && Object.keys(result).length) {\n applySetupResult(ctx.runtime, ctx.instance, result)\n }\n if (provideOptions != null) {\n applyOptionsApiProvide(provideOptions, publicInstance)\n }\n }) satisfies DefineComponentOptions<ComponentPropsOptions, any, any, any, any>['setup']\n : undefined\n\n const nativeData = typeof resolvedData === 'function'\n ? resolvedData()\n : resolvedData\n const nativeOwnerId = nativeData && typeof nativeData === 'object'\n ? Reflect.get(nativeData, WEVU_SLOT_OWNER_ID_KEY)\n : undefined\n const shouldDeclareOwnerId = shouldDeclareNativeSlotOwnerId(resolvedSetData, bindingManifest)\n const scopedSlotHooks = shouldDeclareOwnerId\n ? requireRuntimeCapability('scopedSlots', 'defineComponent(scoped-slot owner metadata)')\n : undefined\n const seededNativeData = shouldDeclareOwnerId\n ? {\n ...(nativeData && typeof nativeData === 'object' ? nativeData : {}),\n [WEVU_SLOT_OWNER_ID_KEY]: shouldSeedNativeSlotOwnerId(mpOptions)\n ? nativeOwnerId || scopedSlotHooks?.allocateOwnerId()\n : nativeOwnerId || '',\n }\n : nativeData\n const nativeInitialData = resolveNativeInitialData(seededNativeData, computed as ComputedDefinitions, resolvedSetData, methods as Record<string, any> | undefined, bindingManifest)\n const mpOptionsWithProps = nativeInitialData !== undefined\n ? {\n ...normalizedMpOptions,\n data: nativeInitialData,\n }\n : normalizedMpOptions\n\n const componentOptions: RuntimeComponentDefinitionOptions = {\n scopedSlotOwnerRequired: scopedSlotOwnerRequired === true,\n data: resolvedData as () => Record<string, any>,\n computed: computed as ComputedDefinitions,\n methods: methods as MethodDefinitions,\n setData: resolvedSetData,\n bindingManifest,\n watch,\n setup: setupWrapper,\n mpOptions: mpOptionsWithProps as MiniProgramComponentRawOptions,\n }\n\n const definition = materializeComponentDefinition(componentOptions, registerNative)\n\n return definition as unknown as WevuComponentConstructor<\n ResolveProps<ComponentPropsOptions>,\n Record<string, any>,\n Record<string, any>,\n ComputedDefinitions,\n MethodDefinitions\n > & ComponentDefinition<any, any, any>\n}\n\n/**\n * 创建不触发宿主全局注册的 Wevu 组件定义。\n *\n * @param options 组件选项\n * @internal\n */\nexport function createWevuComponentDefinition(\n options: DefineComponentOptions<any, any, any, any, any>,\n) {\n return createComponentDefinition(options, false)\n}\n\n/**\n * 从现有组件定义派生拥有独立应用上下文的组件定义。\n *\n * @param definition 已解析的 Wevu 组件定义\n * @internal\n */\nexport function createIsolatedWevuComponentDefinition(definition: object) {\n const componentOptions = (definition as ComponentDefinition<any, any, any>).__wevu_options\n if (!componentOptions) {\n throw new TypeError('无法从非 Wevu 组件定义创建独立运行时')\n }\n return materializeComponentDefinition(componentOptions)\n}\n\n/**\n * 获取组件定义对应的宿主生命周期定义。\n *\n * @param definition Wevu 组件定义\n * @internal\n */\nexport function getWevuComponentLifecycleDefinition(definition: object) {\n return componentLifecycleDefinitions.get(definition)\n}\n\n/**\n * 从 Vue SFC 选项创建 wevu 组件,供 weapp-vite 编译产物直接调用的兼容入口。\n *\n * @param options 组件选项,可能包含小程序特有的 properties\n * @internal\n */\nexport function createWevuComponent<\n P extends ComponentPropsOptions = ComponentPropsOptions,\n D extends object = Record<string, any>,\n C extends ComputedDefinitions = ComputedDefinitions,\n M extends MethodDefinitions = MethodDefinitions,\n>(\n options: DefineComponentOptions<P, D, C, M> & { properties?: MiniProgramComponentPropertyOption },\n): void {\n const allowNullPropInput = options.allowNullPropInput ?? true\n defineComponent({\n ...options,\n allowNullPropInput,\n __wevu_allowNullPropInput: allowNullPropInput,\n })\n}\n"],"mappings":";;;;;;;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D,KACE;CAEJ,MAAM,aAAa,OAAO,iBAAiB,aACvC,aAAa,IACb;CACJ,MAAM,gBAAgB,cAAc,OAAO,eAAe,WACtD,QAAQ,IAAI,YAAY,sBAAsB,IAC9C;CACJ,MAAM,uBAAuB,+BAA+B,iBAAiB,eAAe;CAC5F,MAAM,kBAAkB,uBACpB,yBAAyB,eAAe,6CAA6C,IACrF;CACJ,MAAM,mBAAmB,uBACrB;EACE,GAAI,cAAc,OAAO,eAAe,WAAW,aAAa,CAAC;GAChE,yBAAyB,4BAA4B,SAAS,IAC3D,iBAAiB,iBAAiB,gBAAgB,IAClD,iBAAiB;CACvB,IACA;CACJ,MAAM,oBAAoB,yBAAyB,kBAAkB,UAAiC,iBAAiB,SAA4C,eAAe;CAClL,MAAM,qBAAqB,sBAAsB,SAC7C;EACE,GAAG;EACH,MAAM;CACR,IACA;CAgBJ,OAFmB,+BAA+B;EAXhD,yBAAyB,4BAA4B;EACrD,MAAM;EACI;EACD;EACT,SAAS;EACT;EACA;EACA,OAAO;EACP,WAAW;CAGoD,GAAG,cAEpD;AAOlB;;;;;;;AAQA,SAAgB,8BACd,SACA;CACA,OAAO,0BAA0B,SAAS,KAAK;AACjD;;;;;;;AAQA,SAAgB,sCAAsC,YAAoB;CACxE,MAAM,mBAAoB,WAAkD;CAC5E,IAAI,CAAC,kBACH,MAAM,IAAI,UAAU,uBAAuB;CAE7C,OAAO,+BAA+B,gBAAgB;AACxD;;;;;;;AAQA,SAAgB,oCAAoC,YAAoB;CACtE,OAAO,8BAA8B,IAAI,UAAU;AACrD;;;;;;;AAQA,SAAgB,oBAMd,SACM;CACN,MAAM,qBAAqB,QAAQ,sBAAsB;CACzD,gBAAgB;EACd,GAAG;EACH;EACA,2BAA2B;CAC7B,CAAC;AACH"}
|
|
@@ -5,7 +5,7 @@ import { isNoSetData } from "./noSetData.mjs";
|
|
|
5
5
|
import { hasOwn } from "../utils.mjs";
|
|
6
6
|
import { hasTrackableSetupBinding } from "./setupTracking.mjs";
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
// src/runtime/diff.ts
|
|
9
9
|
function isPlainObject(value) {
|
|
10
10
|
if (Object.prototype.toString.call(value) !== "[object Object]") return false;
|
|
11
11
|
const proto = Object.getPrototypeOf(value);
|
|
@@ -186,6 +186,5 @@ function diffSnapshots(prev, next, options) {
|
|
|
186
186
|
return diff;
|
|
187
187
|
}
|
|
188
188
|
|
|
189
|
-
//#endregion
|
|
190
189
|
export { diffSnapshots, toPlain };
|
|
191
190
|
//# sourceMappingURL=diff.mjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getCurrentInstance } from "./hooks/base.mjs";
|
|
2
2
|
import { onDetached, onUnload } from "./hooks/register.mjs";
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
// src/runtime/disposables.ts
|
|
5
5
|
const DISPOSABLE_METHODS = [
|
|
6
6
|
"dispose",
|
|
7
7
|
"abort",
|
|
@@ -76,6 +76,5 @@ function useDisposables() {
|
|
|
76
76
|
};
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
-
//#endregion
|
|
80
79
|
export { useDisposables };
|
|
81
80
|
//# sourceMappingURL=disposables.mjs.map
|
|
@@ -6,7 +6,7 @@ import { onDetached, onUnload } from "./hooks/register.mjs";
|
|
|
6
6
|
import { onMounted, onUnmounted } from "./hooks/vue.mjs";
|
|
7
7
|
import { watch } from "../reactivity/watch.mjs";
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
// src/runtime/elementIntersectionObserver.ts
|
|
10
10
|
function createObserverFromContext(context, options) {
|
|
11
11
|
const nativeContext = context;
|
|
12
12
|
const creator = nativeContext.createIntersectionObserver;
|
|
@@ -67,6 +67,5 @@ function useElementIntersectionObserver(options) {
|
|
|
67
67
|
};
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
-
//#endregion
|
|
71
70
|
export { useElementIntersectionObserver };
|
|
72
71
|
//# sourceMappingURL=elementIntersectionObserver.mjs.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { hasOwn, hyphenate } from "../utils.mjs";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
// src/runtime/emit.ts
|
|
4
4
|
function isTriggerEventOptions(value) {
|
|
5
5
|
if (!value || typeof value !== "object" || Array.isArray(value)) return false;
|
|
6
6
|
return hasOwn(value, "bubbles") || hasOwn(value, "composed") || hasOwn(value, "capturePhase");
|
|
@@ -31,6 +31,5 @@ function normalizeEmitPayload(args) {
|
|
|
31
31
|
};
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
//#endregion
|
|
35
34
|
export { normalizeEmitEventName, normalizeEmitPayload };
|
|
36
35
|
//# sourceMappingURL=emit.mjs.map
|
|
@@ -2,7 +2,7 @@ import { registerRuntimeCapability } from "../capabilities.mjs";
|
|
|
2
2
|
import { runInlineExpression } from "../register/inline.mjs";
|
|
3
3
|
import { WEVU_INLINE_MAP_KEY } from "@weapp-core/constants";
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
// src/runtime/features/inlineEvents.ts
|
|
6
6
|
const inlineEventHooks = {
|
|
7
7
|
handler(event) {
|
|
8
8
|
const runtime = this.__wevu;
|
|
@@ -19,6 +19,5 @@ function installInlineEvents() {
|
|
|
19
19
|
registerRuntimeCapability("inlineEvents", inlineEventHooks);
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
//#endregion
|
|
23
22
|
export { installInlineEvents };
|
|
24
23
|
//# sourceMappingURL=inlineEvents.mjs.map
|
|
@@ -2,7 +2,7 @@ import { registerRuntimeCapability } from "../capabilities.mjs";
|
|
|
2
2
|
import { runJsxIslandHandler } from "../jsxIsland.mjs";
|
|
3
3
|
import { WEVU_JSX_ISLAND_HANDLER } from "@weapp-core/constants";
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
// src/runtime/features/jsxIslands.ts
|
|
6
6
|
const jsxIslandHooks = { attachMethods(methods) {
|
|
7
7
|
if (!methods[WEVU_JSX_ISLAND_HANDLER]) methods[WEVU_JSX_ISLAND_HANDLER] = function(event) {
|
|
8
8
|
return runJsxIslandHandler(this, event);
|
|
@@ -15,6 +15,5 @@ function installJsxIslands() {
|
|
|
15
15
|
registerRuntimeCapability("jsxIslands", jsxIslandHooks);
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
//#endregion
|
|
19
18
|
export { installJsxIslands };
|
|
20
19
|
//# sourceMappingURL=jsxIslands.mjs.map
|
|
@@ -5,7 +5,7 @@ import { runTeardownSteps } from "../teardown.mjs";
|
|
|
5
5
|
import { installTemplateRefs } from "./templateRefs.mjs";
|
|
6
6
|
import { WEVU_LAYOUT_HOST_BRIDGE_KEY, WEVU_PAGE_LAYOUT_NAME_KEY, WEVU_PAGE_LAYOUT_PROPS_KEY, WEVU_PAGE_LAYOUT_SETTER_KEY } from "@weapp-core/constants";
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
// src/runtime/features/layout.ts
|
|
9
9
|
const layoutHooks = {
|
|
10
10
|
attachPageSetter(target) {
|
|
11
11
|
target[WEVU_PAGE_LAYOUT_SETTER_KEY] = (layout, props) => {
|
|
@@ -38,6 +38,5 @@ function installLayout() {
|
|
|
38
38
|
registerRuntimeCapability("layout", layoutHooks);
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
//#endregion
|
|
42
41
|
export { installLayout };
|
|
43
42
|
//# sourceMappingURL=layout.mjs.map
|
|
@@ -5,7 +5,7 @@ import { registerRuntimeCapability } from "../capabilities.mjs";
|
|
|
5
5
|
import { createSetDataScheduler } from "../app/setData/scheduler.mjs";
|
|
6
6
|
import { preparePatchUpdate } from "../app/setData/patchScheduler.mjs";
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
// src/runtime/features/patchStrategy.ts
|
|
9
9
|
function createPatchSetDataScheduler(options) {
|
|
10
10
|
const scheduler = createSetDataScheduler(options);
|
|
11
11
|
const stateRootRaw = toRaw(options.state);
|
|
@@ -124,6 +124,5 @@ function installPatchStrategy() {
|
|
|
124
124
|
registerRuntimeCapability("patchStrategy", patchStrategyHooks);
|
|
125
125
|
}
|
|
126
126
|
|
|
127
|
-
//#endregion
|
|
128
127
|
export { installPatchStrategy };
|
|
129
128
|
//# sourceMappingURL=patchStrategy.mjs.map
|
|
@@ -6,7 +6,7 @@ import { getCurrentPageInstance } from "../register/component/lifecycle/platform
|
|
|
6
6
|
import { resolveRuntimePageLayoutName as resolveRuntimePageLayoutName$1, setPageLayout as setPageLayout$1, syncRuntimePageLayoutState as syncRuntimePageLayoutState$1, syncRuntimePageLayoutStateFromRuntime as syncRuntimePageLayoutStateFromRuntime$1, usePageLayout as usePageLayout$1 } from "../pageLayout.mjs";
|
|
7
7
|
import { installLayout } from "./layout.mjs";
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
// src/runtime/features/publicLayout.ts
|
|
10
10
|
const registerPageLayoutBridge = (...args) => {
|
|
11
11
|
installLayout();
|
|
12
12
|
return registerPageLayoutBridge$1(...args);
|
|
@@ -72,6 +72,5 @@ const resolveRuntimePageLayoutName = (...args) => {
|
|
|
72
72
|
return resolveRuntimePageLayoutName$1(...args);
|
|
73
73
|
};
|
|
74
74
|
|
|
75
|
-
//#endregion
|
|
76
75
|
export { registerPageLayoutBridge, registerRuntimeLayoutHosts, resolveLayoutBridge, resolveLayoutHost, resolveRuntimePageLayoutName, setPageLayout, syncRuntimePageLayoutState, syncRuntimePageLayoutStateFromRuntime, unregisterPageLayoutBridge, unregisterRuntimeLayoutHosts, useLayoutBridge, useLayoutHosts, usePageLayout, waitForLayoutHost };
|
|
77
76
|
//# sourceMappingURL=publicLayout.mjs.map
|
|
@@ -7,7 +7,7 @@ import { allocateOwnerId, attachOwnerSnapshot, getOwnerProxy, mergeOwnerSnapshot
|
|
|
7
7
|
import { createScopedSlotOptions } from "../define/scopedSlotOptions.mjs";
|
|
8
8
|
import { WEVU_PROPS_KEY, WEVU_RUNTIME_OWNER_ID_KEY, WEVU_SCOPED_SLOT_CREATOR_KEY, WEVU_SLOT_OWNER_ID_KEY } from "@weapp-core/constants";
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
// src/runtime/features/scopedSlots.ts
|
|
11
11
|
const scopedSlotHooks = {
|
|
12
12
|
prepareMount(target) {
|
|
13
13
|
const existing = getScopedSlotMountState(target);
|
|
@@ -79,6 +79,5 @@ function installScopedSlots() {
|
|
|
79
79
|
if (globalObject && globalObject[WEVU_SCOPED_SLOT_CREATOR_KEY] !== createWevuScopedSlotComponent) globalObject[WEVU_SCOPED_SLOT_CREATOR_KEY] = createWevuScopedSlotComponent;
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
-
//#endregion
|
|
83
82
|
export { createWevuScopedSlotComponent, installScopedSlots };
|
|
84
83
|
//# sourceMappingURL=scopedSlots.mjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { registerRuntimeCapability } from "../capabilities.mjs";
|
|
2
2
|
import { createSetDataHighFrequencyWarningMonitor } from "../register/setDataFrequencyWarning.mjs";
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
// src/runtime/features/setDataHighFrequencyWarning.ts
|
|
5
5
|
const setDataHighFrequencyWarningHooks = { createMonitor: createSetDataHighFrequencyWarningMonitor };
|
|
6
6
|
/**
|
|
7
7
|
* 安装可选的 setData 高频告警能力。
|
|
@@ -10,6 +10,5 @@ function installSetDataHighFrequencyWarning() {
|
|
|
10
10
|
registerRuntimeCapability("setDataHighFrequencyWarning", setDataHighFrequencyWarningHooks);
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
//#endregion
|
|
14
13
|
export { installSetDataHighFrequencyWarning };
|
|
15
14
|
//# sourceMappingURL=setDataHighFrequencyWarning.mjs.map
|
|
@@ -2,7 +2,7 @@ import { registerRuntimeCapability } from "../capabilities.mjs";
|
|
|
2
2
|
import { clearTemplateRefs, scheduleTemplateRefUpdate } from "../templateRefs.mjs";
|
|
3
3
|
import { WEVU_TEMPLATE_REFS_KEY } from "@weapp-core/constants";
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
// src/runtime/features/templateRefs.ts
|
|
6
6
|
const templateRefHooks = {
|
|
7
7
|
attachBindings(target, bindings) {
|
|
8
8
|
Object.defineProperty(target, WEVU_TEMPLATE_REFS_KEY, {
|
|
@@ -34,6 +34,5 @@ function installTemplateRefs() {
|
|
|
34
34
|
registerRuntimeCapability("templateRefs", templateRefHooks);
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
//#endregion
|
|
38
37
|
export { installTemplateRefs };
|
|
39
38
|
//# sourceMappingURL=templateRefs.mjs.map
|
|
@@ -2,7 +2,7 @@ import { getCurrentMiniProgramGlobalObject, getCurrentMiniProgramRuntimeCapabili
|
|
|
2
2
|
import { getMiniProgramRuntimeGlobalObject, supportsCurrentMiniProgramRuntimeCapability } from "../platform.mjs";
|
|
3
3
|
import { WEVU_CURRENT_SETUP_STATE_KEY, WEVU_HOOKS_KEY } from "@weapp-core/constants";
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
// src/runtime/hooks/base.ts
|
|
6
6
|
const currentSetupState = (() => {
|
|
7
7
|
const host = typeof globalThis !== "undefined" ? globalThis : getMiniProgramRuntimeGlobalObject();
|
|
8
8
|
return host ? host[WEVU_CURRENT_SETUP_STATE_KEY] ?? (host[WEVU_CURRENT_SETUP_STATE_KEY] = {}) : {};
|
|
@@ -140,6 +140,5 @@ function callHookReturn(target, name, args = []) {
|
|
|
140
140
|
}
|
|
141
141
|
}
|
|
142
142
|
|
|
143
|
-
//#endregion
|
|
144
143
|
export { assertInSetup, callHookList, callHookReturn, ensurePageShareMenusOnSetup, ensureSinglePageHookOnInstance, getCurrentInstance, getCurrentSetupContext, pushHook, setCurrentInstance, setCurrentSetupContext };
|
|
145
144
|
//# sourceMappingURL=base.mjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { callHookList } from "./base.mjs";
|
|
2
2
|
import { WEVU_PAGE_HOOK_BRIDGES_KEY, WEVU_PAGE_SCROLL_HOOK_DEPTH_KEY, WEVU_PAGE_SCROLL_OBSERVERS_KEY } from "@weapp-core/constants";
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
// src/runtime/hooks/pageScroll.ts
|
|
5
5
|
function runInPageScrollHook(target, task) {
|
|
6
6
|
const state = target;
|
|
7
7
|
const depth = Number(state[WEVU_PAGE_SCROLL_HOOK_DEPTH_KEY] ?? 0);
|
|
@@ -36,6 +36,5 @@ function ensurePageHookOnInstance(target, name) {
|
|
|
36
36
|
page[name] = bridge;
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
//#endregion
|
|
40
39
|
export { callPageScrollHooks, ensurePageHookOnInstance, runInPageScrollHook };
|
|
41
40
|
//# sourceMappingURL=pageScroll.mjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { assertInSetup, ensurePageShareMenusOnSetup, ensureSinglePageHookOnInstance, pushHook } from "./base.mjs";
|
|
2
2
|
import { ensurePageHookOnInstance } from "./pageScroll.mjs";
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
// src/runtime/hooks/register.ts
|
|
5
5
|
function registerHook(name, handler, options) {
|
|
6
6
|
pushHook(assertInSetup(name), name, handler, options);
|
|
7
7
|
}
|
|
@@ -88,6 +88,5 @@ function onAddToFavorites(handler) {
|
|
|
88
88
|
ensureSinglePageHookOnInstance(instance, "onAddToFavorites");
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
-
//#endregion
|
|
92
91
|
export { onAddToFavorites, onAttached, onDetached, onError, onHide, onLaunch, onLoad, onMemoryWarning, onMoved, onPageNotFound, onPageScroll, onPullDownRefresh, onReachBottom, onReady, onResize, onRouteDone, onSaveExitState, onShareAppMessage, onShareTimeline, onShow, onTabItemTap, onThemeChange, onUnhandledRejection, onUnload };
|
|
93
92
|
//# sourceMappingURL=register.mjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { assertInSetup, callHookList, pushHook } from "./base.mjs";
|
|
2
2
|
import { WEVU_ON_BEFORE_UNMOUNT_HOOK, WEVU_ON_BEFORE_UPDATE_HOOK, WEVU_ON_UPDATED_HOOK } from "@weapp-core/constants";
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
// src/runtime/hooks/vue.ts
|
|
5
5
|
/**
|
|
6
6
|
* Vue 3 对齐:组件/页面已挂载,映射小程序 onReady
|
|
7
7
|
*/
|
|
@@ -74,6 +74,5 @@ function callUpdateHooks(target, phase) {
|
|
|
74
74
|
callHookList(target, phase === "before" ? WEVU_ON_BEFORE_UPDATE_HOOK : WEVU_ON_UPDATED_HOOK);
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
-
//#endregion
|
|
78
77
|
export { callUpdateHooks, onActivated, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onErrorCaptured, onMounted, onServerPrefetch, onUnmounted, onUpdated };
|
|
79
78
|
//# sourceMappingURL=vue.mjs.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/runtime/inlineDataset.ts
|
|
2
2
|
const AMP_RE = /&/g;
|
|
3
3
|
const QUOT_RE = /"/g;
|
|
4
4
|
const NUM_QUOT_RE = /"/g;
|
|
@@ -69,6 +69,5 @@ function resolveDatasetIndex(value) {
|
|
|
69
69
|
return normalizeDatasetIndex(value);
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
-
//#endregion
|
|
73
72
|
export { decodeWxmlEntities, resolveDatasetEventValue, resolveDatasetIndex };
|
|
74
73
|
//# sourceMappingURL=inlineDataset.mjs.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/runtime/internal.ts
|
|
2
2
|
function setComputedValue(setters, key, value) {
|
|
3
3
|
const setter = setters[key];
|
|
4
4
|
if (!setter) throw new Error(`计算属性 "${key}" 是只读的`);
|
|
@@ -13,6 +13,5 @@ function parseModelEventValue(event) {
|
|
|
13
13
|
return event;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
//#endregion
|
|
17
16
|
export { parseModelEventValue, setComputedValue };
|
|
18
17
|
//# sourceMappingURL=internal.mjs.map
|
|
@@ -3,7 +3,7 @@ import { supportsCurrentMiniProgramRuntimeCapability } from "./platform.mjs";
|
|
|
3
3
|
import { getCurrentInstance } from "./hooks/base.mjs";
|
|
4
4
|
import { onDetached, onUnload } from "./hooks/register.mjs";
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
// src/runtime/intersectionObserver.ts
|
|
7
7
|
function createObserverFromInstance(instance, options) {
|
|
8
8
|
const nativeInstance = instance;
|
|
9
9
|
const creator = nativeInstance.createIntersectionObserver;
|
|
@@ -41,6 +41,5 @@ function useIntersectionObserver(options = {}) {
|
|
|
41
41
|
return observer;
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
//#endregion
|
|
45
44
|
export { useIntersectionObserver };
|
|
46
45
|
//# sourceMappingURL=intersectionObserver.mjs.map
|