wevu 7.2.2 → 7.3.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 +6 -0
- package/dist/dev/_virtual/{_@oxc-project_runtime@0.150.0 → _@oxc-project_runtime@0.151.0}/helpers/esm/defineProperty.mjs +1 -1
- package/dist/dev/_virtual/{_@oxc-project_runtime@0.150.0 → _@oxc-project_runtime@0.151.0}/helpers/esm/toPrimitive.mjs +1 -1
- package/dist/dev/_virtual/{_@oxc-project_runtime@0.150.0 → _@oxc-project_runtime@0.151.0}/helpers/esm/toPropertyKey.mjs +1 -1
- package/dist/dev/_virtual/{_@oxc-project_runtime@0.150.0 → _@oxc-project_runtime@0.151.0}/helpers/esm/typeof.mjs +1 -1
- package/dist/dev/internal-runtime.d.mts +2 -1
- package/dist/dev/internal-runtime.mjs +3 -2
- package/dist/dev/package.mjs +1 -1
- package/dist/dev/reactivity/asyncDerivation.mjs +8 -10
- package/dist/dev/reactivity/asyncDerivation.mjs.map +1 -1
- package/dist/dev/reactivity/core.mjs +5 -8
- package/dist/dev/reactivity/core.mjs.map +1 -1
- package/dist/dev/reactivity/reactive/patch.mjs +3 -3
- package/dist/dev/reactivity/reactive/patch.mjs.map +1 -1
- package/dist/dev/reactivity/reactive/patchState.mjs +4 -8
- package/dist/dev/reactivity/reactive/patchState.mjs.map +1 -1
- package/dist/dev/reactivity/reactive/shared.mjs +1 -2
- package/dist/dev/reactivity/reactive/shared.mjs.map +1 -1
- package/dist/dev/reactivity/reactive.mjs +5 -10
- package/dist/dev/reactivity/reactive.mjs.map +1 -1
- package/dist/dev/reactivity/ref.mjs +2 -2
- package/dist/dev/reactivity/ref.mjs.map +1 -1
- package/dist/dev/reactivity/shallowRef.mjs +1 -1
- package/dist/dev/reactivity/shallowRef.mjs.map +1 -1
- package/dist/dev/reactivity/watch/helpers.mjs +1 -1
- package/dist/dev/reactivity/watch/helpers.mjs.map +1 -1
- package/dist/dev/reactivity/watch.mjs +6 -8
- package/dist/dev/reactivity/watch.mjs.map +1 -1
- package/dist/dev/router/createRouter.mjs +17 -24
- package/dist/dev/router/createRouter.mjs.map +1 -1
- package/dist/dev/router/initialNavigation.mjs +18 -16
- package/dist/dev/router/initialNavigation.mjs.map +1 -1
- package/dist/dev/router/instance.mjs +1 -2
- package/dist/dev/router/instance.mjs.map +1 -1
- package/dist/dev/router/navigationCore.mjs +2 -2
- package/dist/dev/router/navigationCore.mjs.map +1 -1
- package/dist/dev/router/navigationResult.mjs +7 -10
- package/dist/dev/router/navigationResult.mjs.map +1 -1
- package/dist/dev/router/navigationTarget.mjs +1 -3
- package/dist/dev/router/navigationTarget.mjs.map +1 -1
- package/dist/dev/router/resolve.mjs +3 -4
- package/dist/dev/router/resolve.mjs.map +1 -1
- package/dist/dev/router/routeRegistry.mjs +1 -1
- package/dist/dev/router/routeRegistry.mjs.map +1 -1
- package/dist/dev/router/routeSync.mjs +1 -1
- package/dist/dev/router/routeSync.mjs.map +1 -1
- package/dist/dev/router/useRoute.mjs +12 -19
- package/dist/dev/router/useRoute.mjs.map +1 -1
- package/dist/dev/routerInternal/location.mjs +2 -3
- package/dist/dev/routerInternal/location.mjs.map +1 -1
- package/dist/dev/routerInternal/params.mjs +2 -3
- package/dist/dev/routerInternal/params.mjs.map +1 -1
- package/dist/dev/routerInternal/records.mjs +1 -1
- package/dist/dev/routerInternal/records.mjs.map +1 -1
- package/dist/dev/routerInternal/recordsWarnings.mjs +1 -2
- package/dist/dev/routerInternal/recordsWarnings.mjs.map +1 -1
- package/dist/dev/runtime/app/context.mjs +13 -26
- package/dist/dev/runtime/app/context.mjs.map +1 -1
- package/dist/dev/runtime/app/diagnostics.mjs +2 -4
- package/dist/dev/runtime/app/diagnostics.mjs.map +1 -1
- package/dist/dev/runtime/app/mount.mjs +27 -33
- package/dist/dev/runtime/app/mount.mjs.map +1 -1
- package/dist/dev/runtime/app/setData/commitTracker.mjs +5 -9
- package/dist/dev/runtime/app/setData/commitTracker.mjs.map +1 -1
- package/dist/dev/runtime/app/setData/patchScheduler.mjs +2 -4
- package/dist/dev/runtime/app/setData/patchScheduler.mjs.map +1 -1
- package/dist/dev/runtime/app/setData/payload.mjs +2 -3
- package/dist/dev/runtime/app/setData/payload.mjs.map +1 -1
- package/dist/dev/runtime/app/setData/scheduler.mjs +7 -9
- package/dist/dev/runtime/app/setData/scheduler.mjs.map +1 -1
- package/dist/dev/runtime/app/setData/snapshot.mjs +5 -6
- package/dist/dev/runtime/app/setData/snapshot.mjs.map +1 -1
- package/dist/dev/runtime/app/setDataOptions.mjs +26 -27
- package/dist/dev/runtime/app/setDataOptions.mjs.map +1 -1
- package/dist/dev/runtime/app.mjs +9 -9
- package/dist/dev/runtime/app.mjs.map +1 -1
- package/dist/dev/runtime/bindingManifest.mjs +6 -14
- package/dist/dev/runtime/bindingManifest.mjs.map +1 -1
- package/dist/dev/runtime/capabilities.d.mts +4 -1
- package/dist/dev/runtime/capabilities.mjs.map +1 -1
- package/dist/dev/runtime/css.mjs +4 -8
- package/dist/dev/runtime/css.mjs.map +1 -1
- package/dist/dev/runtime/defaults.mjs +4 -4
- package/dist/dev/runtime/defaults.mjs.map +1 -1
- package/dist/dev/runtime/define/initialComputed.mjs +5 -5
- package/dist/dev/runtime/define/initialComputed.mjs.map +1 -1
- package/dist/dev/runtime/define/options.mjs +10 -12
- package/dist/dev/runtime/define/options.mjs.map +1 -1
- package/dist/dev/runtime/define/props.mjs +4 -5
- package/dist/dev/runtime/define/props.mjs.map +1 -1
- package/dist/dev/runtime/define/scopedSlotOptions.mjs +43 -61
- package/dist/dev/runtime/define/scopedSlotOptions.mjs.map +1 -1
- package/dist/dev/runtime/define/setupResult.mjs +17 -28
- package/dist/dev/runtime/define/setupResult.mjs.map +1 -1
- package/dist/dev/runtime/define.mjs +9 -12
- package/dist/dev/runtime/define.mjs.map +1 -1
- package/dist/dev/runtime/diff.mjs +9 -11
- package/dist/dev/runtime/diff.mjs.map +1 -1
- package/dist/dev/runtime/disposables.mjs +2 -2
- package/dist/dev/runtime/disposables.mjs.map +1 -1
- package/dist/dev/runtime/elementIntersectionObserver.mjs +16 -24
- package/dist/dev/runtime/elementIntersectionObserver.mjs.map +1 -1
- package/dist/dev/runtime/features/inlineEvents.mjs +2 -3
- package/dist/dev/runtime/features/inlineEvents.mjs.map +1 -1
- package/dist/dev/runtime/features/jsxIslands.d.mts +7 -0
- package/dist/dev/runtime/features/jsxIslands.mjs +20 -0
- package/dist/dev/runtime/features/jsxIslands.mjs.map +1 -0
- package/dist/dev/runtime/features/layout.mjs +2 -3
- package/dist/dev/runtime/features/layout.mjs.map +1 -1
- package/dist/dev/runtime/features/publicLayout.mjs +2 -6
- package/dist/dev/runtime/features/publicLayout.mjs.map +1 -1
- package/dist/dev/runtime/features/scopedSlots.mjs +5 -9
- package/dist/dev/runtime/features/scopedSlots.mjs.map +1 -1
- package/dist/dev/runtime/features/templateRefs.mjs +1 -1
- package/dist/dev/runtime/features/templateRefs.mjs.map +1 -1
- package/dist/dev/runtime/hooks/base.mjs +21 -32
- package/dist/dev/runtime/hooks/base.mjs.map +1 -1
- package/dist/dev/runtime/inlineDataset.mjs +1 -2
- package/dist/dev/runtime/inlineDataset.mjs.map +1 -1
- package/dist/dev/runtime/intersectionObserver.mjs +6 -6
- package/dist/dev/runtime/intersectionObserver.mjs.map +1 -1
- package/dist/dev/runtime/jsxIsland.mjs +16 -33
- package/dist/dev/runtime/jsxIsland.mjs.map +1 -1
- package/dist/dev/runtime/layoutBridge.mjs +32 -62
- package/dist/dev/runtime/layoutBridge.mjs.map +1 -1
- package/dist/dev/runtime/nativeBridge.mjs +1 -1
- package/dist/dev/runtime/nativeBridge.mjs.map +1 -1
- package/dist/dev/runtime/navigationLifecycle.mjs +24 -0
- package/dist/dev/runtime/navigationLifecycle.mjs.map +1 -0
- package/dist/dev/runtime/pageEnvironment.mjs +15 -18
- package/dist/dev/runtime/pageEnvironment.mjs.map +1 -1
- package/dist/dev/runtime/pageLayout.mjs +7 -11
- package/dist/dev/runtime/pageLayout.mjs.map +1 -1
- package/dist/dev/runtime/pageScroll.mjs +2 -3
- package/dist/dev/runtime/pageScroll.mjs.map +1 -1
- package/dist/dev/runtime/platform/current.mjs +12 -0
- package/dist/dev/runtime/platform/current.mjs.map +1 -0
- package/dist/dev/runtime/platform/generic.mjs +36 -0
- package/dist/dev/runtime/platform/generic.mjs.map +1 -0
- package/dist/dev/runtime/platform/globals.mjs +29 -0
- package/dist/dev/runtime/platform/globals.mjs.map +1 -0
- package/dist/dev/runtime/platform.mjs +15 -60
- package/dist/dev/runtime/platform.mjs.map +1 -1
- package/dist/dev/runtime/provideContext.mjs +7 -9
- package/dist/dev/runtime/provideContext.mjs.map +1 -1
- package/dist/dev/runtime/publicRuntime.mjs +4 -0
- package/dist/dev/runtime/publicRuntime.mjs.map +1 -1
- package/dist/dev/runtime/pullDownRefresh.mjs +2 -4
- package/dist/dev/runtime/pullDownRefresh.mjs.map +1 -1
- package/dist/dev/runtime/register/app.mjs +18 -19
- package/dist/dev/runtime/register/app.mjs.map +1 -1
- package/dist/dev/runtime/register/component/alipay.mjs +9 -18
- package/dist/dev/runtime/register/component/alipay.mjs.map +1 -1
- package/dist/dev/runtime/register/component/alipayRegistration.mjs +60 -0
- package/dist/dev/runtime/register/component/alipayRegistration.mjs.map +1 -0
- package/dist/dev/runtime/register/component/lifecycle/platform.mjs +8 -9
- package/dist/dev/runtime/register/component/lifecycle/platform.mjs.map +1 -1
- package/dist/dev/runtime/register/component/lifecycle.mjs +7 -12
- package/dist/dev/runtime/register/component/lifecycle.mjs.map +1 -1
- package/dist/dev/runtime/register/component/methods.mjs +13 -18
- package/dist/dev/runtime/register/component/methods.mjs.map +1 -1
- package/dist/dev/runtime/register/component/options.mjs +3 -4
- package/dist/dev/runtime/register/component/options.mjs.map +1 -1
- package/dist/dev/runtime/register/component/props.mjs +25 -31
- package/dist/dev/runtime/register/component/props.mjs.map +1 -1
- package/dist/dev/runtime/register/component/registerDefinition.mjs +18 -40
- package/dist/dev/runtime/register/component/registerDefinition.mjs.map +1 -1
- package/dist/dev/runtime/register/component/registerNativeDefinition.mjs +18 -60
- package/dist/dev/runtime/register/component/registerNativeDefinition.mjs.map +1 -1
- package/dist/dev/runtime/register/component.mjs +3 -5
- package/dist/dev/runtime/register/component.mjs.map +1 -1
- package/dist/dev/runtime/register/inline.mjs +8 -10
- package/dist/dev/runtime/register/inline.mjs.map +1 -1
- package/dist/dev/runtime/register/runtimeInstance/methodBridge.mjs +7 -8
- package/dist/dev/runtime/register/runtimeInstance/methodBridge.mjs.map +1 -1
- package/dist/dev/runtime/register/runtimeInstance/provideContext.mjs +1 -1
- package/dist/dev/runtime/register/runtimeInstance/provideContext.mjs.map +1 -1
- package/dist/dev/runtime/register/runtimeInstance/setupContext.mjs +25 -34
- package/dist/dev/runtime/register/runtimeInstance/setupContext.mjs.map +1 -1
- package/dist/dev/runtime/register/runtimeInstance/setupPhase.mjs +6 -13
- package/dist/dev/runtime/register/runtimeInstance/setupPhase.mjs.map +1 -1
- package/dist/dev/runtime/register/runtimeInstance/setupSnapshot.mjs +2 -2
- package/dist/dev/runtime/register/runtimeInstance/setupSnapshot.mjs.map +1 -1
- package/dist/dev/runtime/register/runtimeInstance/utils.mjs +9 -9
- package/dist/dev/runtime/register/runtimeInstance/utils.mjs.map +1 -1
- package/dist/dev/runtime/register/runtimeInstance.mjs +74 -100
- package/dist/dev/runtime/register/runtimeInstance.mjs.map +1 -1
- package/dist/dev/runtime/register/setDataFrequencyWarning.mjs +12 -15
- package/dist/dev/runtime/register/setDataFrequencyWarning.mjs.map +1 -1
- package/dist/dev/runtime/register/setup.mjs +2 -3
- package/dist/dev/runtime/register/setup.mjs.map +1 -1
- package/dist/dev/runtime/register/snapshot.mjs +1 -4
- package/dist/dev/runtime/register/snapshot.mjs.map +1 -1
- package/dist/dev/runtime/register/watch.mjs +3 -5
- package/dist/dev/runtime/register/watch.mjs.map +1 -1
- package/dist/dev/runtime/scopedSlots.mjs +14 -21
- package/dist/dev/runtime/scopedSlots.mjs.map +1 -1
- package/dist/dev/runtime/selectorQuery.mjs +5 -9
- package/dist/dev/runtime/selectorQuery.mjs.map +1 -1
- package/dist/dev/runtime/template.mjs +1 -1
- package/dist/dev/runtime/template.mjs.map +1 -1
- package/dist/dev/runtime/templateRefs/helpers.mjs +14 -24
- package/dist/dev/runtime/templateRefs/helpers.mjs.map +1 -1
- package/dist/dev/runtime/templateRefs.mjs +8 -15
- package/dist/dev/runtime/templateRefs.mjs.map +1 -1
- package/dist/dev/runtime/uniAppHost.mjs +6 -14
- package/dist/dev/runtime/uniAppHost.mjs.map +1 -1
- package/dist/dev/runtime/updatePerformance.mjs +1 -1
- package/dist/dev/runtime/updatePerformance.mjs.map +1 -1
- package/dist/dev/runtime/use.mjs +1 -1
- package/dist/dev/runtime/use.mjs.map +1 -1
- package/dist/dev/runtime/vueCompat/context.mjs +3 -5
- package/dist/dev/runtime/vueCompat/context.mjs.map +1 -1
- package/dist/dev/runtime/vueCompat/model.mjs +9 -13
- package/dist/dev/runtime/vueCompat/model.mjs.map +1 -1
- package/dist/dev/runtime/vueCompat/router.mjs +4 -4
- package/dist/dev/runtime/vueCompat/router.mjs.map +1 -1
- package/dist/dev/runtime/vueCompat/templateRef.mjs +1 -1
- package/dist/dev/runtime/vueCompat/templateRef.mjs.map +1 -1
- package/dist/dev/scheduler.mjs +3 -4
- package/dist/dev/scheduler.mjs.map +1 -1
- package/dist/dev/store/base.mjs +1 -2
- package/dist/dev/store/base.mjs.map +1 -1
- package/dist/dev/store/define/create.mjs +11 -22
- package/dist/dev/store/define/create.mjs.map +1 -1
- package/dist/dev/store/define.mjs +1 -1
- package/dist/dev/store/define.mjs.map +1 -1
- package/dist/dev/store/view.mjs +1 -1
- package/dist/dev/store/view.mjs.map +1 -1
- package/dist/internal-runtime.d.mts +2 -1
- package/dist/internal-runtime.mjs +1 -1
- package/dist/package.mjs +1 -1
- package/dist/reactivity/asyncDerivation.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/reactive/shared.mjs +1 -1
- package/dist/reactivity/reactive.mjs +1 -1
- package/dist/reactivity/ref.mjs +1 -1
- package/dist/reactivity/shallowRef.mjs +1 -1
- package/dist/reactivity/watch/helpers.mjs +1 -1
- package/dist/reactivity/watch.mjs +1 -1
- package/dist/router/createRouter.mjs +1 -1
- package/dist/router/initialNavigation.mjs +1 -1
- package/dist/router/instance.mjs +1 -1
- package/dist/router/navigationCore.mjs +1 -1
- package/dist/router/navigationResult.mjs +1 -1
- package/dist/router/navigationTarget.mjs +1 -1
- package/dist/router/resolve.mjs +1 -1
- package/dist/router/routeRegistry.mjs +1 -1
- package/dist/router/routeSync.mjs +1 -1
- package/dist/router/useRoute.mjs +1 -1
- package/dist/routerInternal/location.mjs +1 -1
- package/dist/routerInternal/params.mjs +1 -1
- package/dist/routerInternal/records.mjs +1 -1
- package/dist/routerInternal/recordsWarnings.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.mjs +1 -1
- package/dist/runtime/app/setData/patchScheduler.mjs +1 -1
- package/dist/runtime/app/setData/payload.mjs +1 -1
- package/dist/runtime/app/setData/scheduler.mjs +1 -1
- package/dist/runtime/app/setData/snapshot.mjs +1 -1
- package/dist/runtime/app/setDataOptions.mjs +1 -1
- package/dist/runtime/app.mjs +1 -1
- package/dist/runtime/bindingManifest.mjs +1 -1
- package/dist/runtime/capabilities.d.mts +4 -1
- package/dist/runtime/css.mjs +1 -1
- package/dist/runtime/defaults.mjs +1 -1
- package/dist/runtime/define/initialComputed.mjs +1 -1
- package/dist/runtime/define/options.mjs +1 -1
- 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.mjs +1 -1
- package/dist/runtime/diff.mjs +1 -1
- package/dist/runtime/disposables.mjs +1 -1
- package/dist/runtime/elementIntersectionObserver.mjs +1 -1
- package/dist/runtime/features/inlineEvents.mjs +1 -1
- package/dist/runtime/features/jsxIslands.d.mts +6 -0
- package/dist/runtime/features/jsxIslands.mjs +1 -0
- package/dist/runtime/features/layout.mjs +1 -1
- package/dist/runtime/features/publicLayout.mjs +1 -1
- package/dist/runtime/features/scopedSlots.mjs +1 -1
- package/dist/runtime/features/templateRefs.mjs +1 -1
- package/dist/runtime/hooks/base.mjs +1 -1
- package/dist/runtime/inlineDataset.mjs +1 -1
- package/dist/runtime/intersectionObserver.mjs +1 -1
- package/dist/runtime/jsxIsland.mjs +1 -1
- package/dist/runtime/layoutBridge.mjs +1 -1
- package/dist/runtime/nativeBridge.mjs +1 -1
- package/dist/runtime/navigationLifecycle.mjs +1 -0
- package/dist/runtime/pageEnvironment.mjs +1 -1
- package/dist/runtime/pageLayout.mjs +1 -1
- package/dist/runtime/pageScroll.mjs +1 -1
- package/dist/runtime/platform/current.mjs +1 -0
- package/dist/runtime/platform/generic.mjs +1 -0
- package/dist/runtime/platform/globals.mjs +1 -0
- package/dist/runtime/platform.mjs +1 -1
- package/dist/runtime/provideContext.mjs +1 -1
- package/dist/runtime/publicRuntime.mjs +1 -1
- package/dist/runtime/pullDownRefresh.mjs +1 -1
- package/dist/runtime/register/app.mjs +1 -1
- package/dist/runtime/register/component/alipay.mjs +1 -1
- package/dist/runtime/register/component/alipayRegistration.mjs +1 -0
- package/dist/runtime/register/component/lifecycle/platform.mjs +1 -1
- package/dist/runtime/register/component/lifecycle.mjs +1 -1
- package/dist/runtime/register/component/methods.mjs +1 -1
- package/dist/runtime/register/component/options.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/inline.mjs +1 -1
- package/dist/runtime/register/runtimeInstance/methodBridge.mjs +1 -1
- package/dist/runtime/register/runtimeInstance/provideContext.mjs +1 -1
- package/dist/runtime/register/runtimeInstance/setupContext.mjs +1 -1
- package/dist/runtime/register/runtimeInstance/setupPhase.mjs +1 -1
- package/dist/runtime/register/runtimeInstance/setupSnapshot.mjs +1 -1
- package/dist/runtime/register/runtimeInstance/utils.mjs +1 -1
- package/dist/runtime/register/runtimeInstance.mjs +1 -1
- package/dist/runtime/register/setDataFrequencyWarning.mjs +1 -1
- package/dist/runtime/register/setup.mjs +1 -1
- package/dist/runtime/register/snapshot.mjs +1 -1
- package/dist/runtime/register/watch.mjs +1 -1
- package/dist/runtime/scopedSlots.mjs +1 -1
- package/dist/runtime/selectorQuery.mjs +1 -1
- package/dist/runtime/template.mjs +1 -1
- package/dist/runtime/templateRefs/helpers.mjs +1 -1
- package/dist/runtime/templateRefs.mjs +1 -1
- package/dist/runtime/uniAppHost.mjs +1 -1
- package/dist/runtime/updatePerformance.mjs +1 -1
- package/dist/runtime/use.mjs +1 -1
- package/dist/runtime/vueCompat/context.mjs +1 -1
- package/dist/runtime/vueCompat/model.mjs +1 -1
- package/dist/runtime/vueCompat/router.mjs +1 -1
- package/dist/runtime/vueCompat/templateRef.mjs +1 -1
- package/dist/scheduler.mjs +1 -1
- package/dist/store/base.mjs +1 -1
- package/dist/store/define/create.mjs +1 -1
- package/dist/store/define.mjs +1 -1
- package/dist/store/view.mjs +1 -1
- package/package.json +7 -7
- /package/dist/_virtual/{_@oxc-project_runtime@0.150.0 → _@oxc-project_runtime@0.151.0}/helpers/esm/defineProperty.mjs +0 -0
- /package/dist/_virtual/{_@oxc-project_runtime@0.150.0 → _@oxc-project_runtime@0.151.0}/helpers/esm/toPrimitive.mjs +0 -0
- /package/dist/_virtual/{_@oxc-project_runtime@0.150.0 → _@oxc-project_runtime@0.151.0}/helpers/esm/toPropertyKey.mjs +0 -0
- /package/dist/_virtual/{_@oxc-project_runtime@0.150.0 → _@oxc-project_runtime@0.151.0}/helpers/esm/typeof.mjs +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scopedSlots.mjs","names":[],"sources":["../../../../src/runtime/features/scopedSlots.ts"],"sourcesContent":["import type { WEVU_BINDING_MANIFEST_KEY, WevuRuntimeBindingManifestV1 } from '@weapp-core/constants'\nimport type {\n LayoutHostBinding,\n RuntimeCapabilityRegistry,\n ScopedSlotMountState,\n TemplateRefBinding,\n} from '../capabilities'\nimport type { InlineExpressionMap } from '../register/inline'\nimport type { ComputedDefinitions, InternalRuntimeState } from '../types'\nimport {\n WEVU_PROPS_KEY,\n WEVU_RUNTIME_OWNER_ID_KEY,\n WEVU_SCOPED_SLOT_CREATOR_KEY,\n WEVU_SLOT_OWNER_ID_KEY,\n} from '@weapp-core/constants'\nimport {\n getScopedSlotMountState,\n registerRuntimeCapability,\n requireRuntimeCapability,\n RUNTIME_SCOPED_SLOT_STATE_KEY,\n} from '../capabilities'\nimport { createWevuComponent } from '../define'\nimport { createScopedSlotOptions } from '../define/scopedSlotOptions'\nimport { getScopedSlotHostGlobalObject } from '../platform'\nimport { callNativeSetData, resolveNativeSetData } from '../register/runtimeInstance/utils'\nimport {\n allocateOwnerId,\n attachOwnerSnapshot,\n getOwnerProxy,\n mergeOwnerSnapshotProps,\n removeOwner,\n resolveOwnerSnapshot,\n updateOwnerSnapshot,\n} from '../scopedSlots'\nimport { runTeardownSteps } from '../teardown'\n\nexport interface CreateWevuScopedSlotComponentOptions {\n computed?: ComputedDefinitions\n inlineMap?: InlineExpressionMap\n layoutHosts?: LayoutHostBinding[]\n templateRefs?: TemplateRefBinding[]\n [WEVU_BINDING_MANIFEST_KEY]?: WevuRuntimeBindingManifestV1\n}\n\ntype RuntimeTargetWithScopedSlotState = InternalRuntimeState & {\n [RUNTIME_SCOPED_SLOT_STATE_KEY]?: ScopedSlotMountState\n [WEVU_PROPS_KEY]?: unknown\n [WEVU_RUNTIME_OWNER_ID_KEY]?: unknown\n [WEVU_SLOT_OWNER_ID_KEY]?: unknown\n}\n\nconst scopedSlotHooks: NonNullable<RuntimeCapabilityRegistry['scopedSlots']> = {\n prepareMount(target: InternalRuntimeState) {\n const existing = getScopedSlotMountState(target)\n if (existing) {\n return existing\n }\n const initialNativeOwnerId = target.data?.[WEVU_SLOT_OWNER_ID_KEY]\n const ownerId = typeof initialNativeOwnerId === 'string' && initialNativeOwnerId\n ? initialNativeOwnerId\n : allocateOwnerId()\n const state: ScopedSlotMountState = {\n ownerId,\n shouldFlushNativeOwnerId: typeof initialNativeOwnerId === 'string' && initialNativeOwnerId !== ownerId,\n }\n Object.defineProperty(target, RUNTIME_SCOPED_SLOT_STATE_KEY, {\n value: state,\n configurable: true,\n enumerable: false,\n writable: false,\n })\n return state\n },\n attachMount(target, runtime, state, deferSnapshot) {\n attachOwnerSnapshot(target, runtime, state.ownerId, { deferSnapshot })\n },\n refresh(target: InternalRuntimeState, state: ScopedSlotMountState) {\n const runtime = target.__wevu\n if (!runtime) {\n return\n }\n const snapshot = resolveOwnerSnapshot(runtime)\n const propsSource = (target as RuntimeTargetWithScopedSlotState)[WEVU_PROPS_KEY] ?? target.properties\n mergeOwnerSnapshotProps(snapshot, propsSource)\n updateOwnerSnapshot(state.ownerId, snapshot, runtime.proxy, target)\n },\n syncNativeOwnerId(target: InternalRuntimeState, state: ScopedSlotMountState) {\n if (!state.shouldFlushNativeOwnerId) {\n return\n }\n try {\n if (target.data && typeof target.data === 'object') {\n target.data[WEVU_SLOT_OWNER_ID_KEY] = state.ownerId\n }\n }\n catch {\n // 忽略直接写入失败,后续 setData 仍会尝试同步。\n }\n const setData = resolveNativeSetData(target)\n if (setData) {\n callNativeSetData(target, setData, { [WEVU_SLOT_OWNER_ID_KEY]: state.ownerId })\n }\n },\n teardown(target: InternalRuntimeState) {\n const state = getScopedSlotMountState(target)\n const scopedTarget = target as RuntimeTargetWithScopedSlotState\n const ownerId = state?.ownerId\n ?? scopedTarget[WEVU_RUNTIME_OWNER_ID_KEY]\n ?? scopedTarget[WEVU_SLOT_OWNER_ID_KEY]\n runTeardownSteps([\n () => {\n if (typeof ownerId === 'string' && ownerId) {\n removeOwner(ownerId)\n }\n },\n () => {\n delete scopedTarget[RUNTIME_SCOPED_SLOT_STATE_KEY]\n },\n ])\n },\n resolveLifecycleProxy(target: InternalRuntimeState) {\n const scopedTarget = target as RuntimeTargetWithScopedSlotState\n const ownerId = scopedTarget[WEVU_RUNTIME_OWNER_ID_KEY]\n ?? scopedTarget[WEVU_SLOT_OWNER_ID_KEY]\n ?? target.data?.[WEVU_SLOT_OWNER_ID_KEY]\n ?? target.properties?.[WEVU_SLOT_OWNER_ID_KEY]\n return typeof ownerId === 'string' && ownerId ? getOwnerProxy(ownerId) : undefined\n },\n allocateOwnerId,\n}\n\n/**\n * 创建编译器生成的作用域插槽组件。\n */\nexport function createWevuScopedSlotComponent(\n overrides?: CreateWevuScopedSlotComponentOptions,\n): void {\n requireRuntimeCapability('scopedSlots', 'createWevuScopedSlotComponent')\n const baseOptions = createScopedSlotOptions(overrides)\n // 作用域插槽选项由内部工厂完整构造,动态常量键会丢失静态索引信息。\n const componentOptions = baseOptions as unknown as Parameters<typeof createWevuComponent>[0]\n createWevuComponent(componentOptions)\n}\n/**\n * 安装作用域插槽的 owner 生命周期与组件创建能力。\n */\nexport function installScopedSlots(): void {\n registerRuntimeCapability('scopedSlots', scopedSlotHooks)\n const globalObject = getScopedSlotHostGlobalObject()\n if (globalObject && globalObject[WEVU_SCOPED_SLOT_CREATOR_KEY] !== createWevuScopedSlotComponent) {\n globalObject[WEVU_SCOPED_SLOT_CREATOR_KEY] = createWevuScopedSlotComponent\n }\n}\n"],"mappings":";;;;;;;;;;AAmDA,MAAM,kBAAyE;CAC7E,aAAa,QAA8B
|
|
1
|
+
{"version":3,"file":"scopedSlots.mjs","names":[],"sources":["../../../../src/runtime/features/scopedSlots.ts"],"sourcesContent":["import type { WEVU_BINDING_MANIFEST_KEY, WevuRuntimeBindingManifestV1 } from '@weapp-core/constants'\nimport type {\n LayoutHostBinding,\n RuntimeCapabilityRegistry,\n ScopedSlotMountState,\n TemplateRefBinding,\n} from '../capabilities'\nimport type { InlineExpressionMap } from '../register/inline'\nimport type { ComputedDefinitions, InternalRuntimeState } from '../types'\nimport {\n WEVU_PROPS_KEY,\n WEVU_RUNTIME_OWNER_ID_KEY,\n WEVU_SCOPED_SLOT_CREATOR_KEY,\n WEVU_SLOT_OWNER_ID_KEY,\n} from '@weapp-core/constants'\nimport {\n getScopedSlotMountState,\n registerRuntimeCapability,\n requireRuntimeCapability,\n RUNTIME_SCOPED_SLOT_STATE_KEY,\n} from '../capabilities'\nimport { createWevuComponent } from '../define'\nimport { createScopedSlotOptions } from '../define/scopedSlotOptions'\nimport { getScopedSlotHostGlobalObject } from '../platform'\nimport { callNativeSetData, resolveNativeSetData } from '../register/runtimeInstance/utils'\nimport {\n allocateOwnerId,\n attachOwnerSnapshot,\n getOwnerProxy,\n mergeOwnerSnapshotProps,\n removeOwner,\n resolveOwnerSnapshot,\n updateOwnerSnapshot,\n} from '../scopedSlots'\nimport { runTeardownSteps } from '../teardown'\n\nexport interface CreateWevuScopedSlotComponentOptions {\n computed?: ComputedDefinitions\n inlineMap?: InlineExpressionMap\n layoutHosts?: LayoutHostBinding[]\n templateRefs?: TemplateRefBinding[]\n [WEVU_BINDING_MANIFEST_KEY]?: WevuRuntimeBindingManifestV1\n}\n\ntype RuntimeTargetWithScopedSlotState = InternalRuntimeState & {\n [RUNTIME_SCOPED_SLOT_STATE_KEY]?: ScopedSlotMountState\n [WEVU_PROPS_KEY]?: unknown\n [WEVU_RUNTIME_OWNER_ID_KEY]?: unknown\n [WEVU_SLOT_OWNER_ID_KEY]?: unknown\n}\n\nconst scopedSlotHooks: NonNullable<RuntimeCapabilityRegistry['scopedSlots']> = {\n prepareMount(target: InternalRuntimeState) {\n const existing = getScopedSlotMountState(target)\n if (existing) {\n return existing\n }\n const initialNativeOwnerId = target.data?.[WEVU_SLOT_OWNER_ID_KEY]\n const ownerId = typeof initialNativeOwnerId === 'string' && initialNativeOwnerId\n ? initialNativeOwnerId\n : allocateOwnerId()\n const state: ScopedSlotMountState = {\n ownerId,\n shouldFlushNativeOwnerId: typeof initialNativeOwnerId === 'string' && initialNativeOwnerId !== ownerId,\n }\n Object.defineProperty(target, RUNTIME_SCOPED_SLOT_STATE_KEY, {\n value: state,\n configurable: true,\n enumerable: false,\n writable: false,\n })\n return state\n },\n attachMount(target, runtime, state, deferSnapshot) {\n attachOwnerSnapshot(target, runtime, state.ownerId, { deferSnapshot })\n },\n refresh(target: InternalRuntimeState, state: ScopedSlotMountState) {\n const runtime = target.__wevu\n if (!runtime) {\n return\n }\n const snapshot = resolveOwnerSnapshot(runtime)\n const propsSource = (target as RuntimeTargetWithScopedSlotState)[WEVU_PROPS_KEY] ?? target.properties\n mergeOwnerSnapshotProps(snapshot, propsSource)\n updateOwnerSnapshot(state.ownerId, snapshot, runtime.proxy, target)\n },\n syncNativeOwnerId(target: InternalRuntimeState, state: ScopedSlotMountState) {\n if (!state.shouldFlushNativeOwnerId) {\n return\n }\n try {\n if (target.data && typeof target.data === 'object') {\n target.data[WEVU_SLOT_OWNER_ID_KEY] = state.ownerId\n }\n }\n catch {\n // 忽略直接写入失败,后续 setData 仍会尝试同步。\n }\n const setData = resolveNativeSetData(target)\n if (setData) {\n callNativeSetData(target, setData, { [WEVU_SLOT_OWNER_ID_KEY]: state.ownerId })\n }\n },\n teardown(target: InternalRuntimeState) {\n const state = getScopedSlotMountState(target)\n const scopedTarget = target as RuntimeTargetWithScopedSlotState\n const ownerId = state?.ownerId\n ?? scopedTarget[WEVU_RUNTIME_OWNER_ID_KEY]\n ?? scopedTarget[WEVU_SLOT_OWNER_ID_KEY]\n runTeardownSteps([\n () => {\n if (typeof ownerId === 'string' && ownerId) {\n removeOwner(ownerId)\n }\n },\n () => {\n delete scopedTarget[RUNTIME_SCOPED_SLOT_STATE_KEY]\n },\n ])\n },\n resolveLifecycleProxy(target: InternalRuntimeState) {\n const scopedTarget = target as RuntimeTargetWithScopedSlotState\n const ownerId = scopedTarget[WEVU_RUNTIME_OWNER_ID_KEY]\n ?? scopedTarget[WEVU_SLOT_OWNER_ID_KEY]\n ?? target.data?.[WEVU_SLOT_OWNER_ID_KEY]\n ?? target.properties?.[WEVU_SLOT_OWNER_ID_KEY]\n return typeof ownerId === 'string' && ownerId ? getOwnerProxy(ownerId) : undefined\n },\n allocateOwnerId,\n}\n\n/**\n * 创建编译器生成的作用域插槽组件。\n */\nexport function createWevuScopedSlotComponent(\n overrides?: CreateWevuScopedSlotComponentOptions,\n): void {\n requireRuntimeCapability('scopedSlots', 'createWevuScopedSlotComponent')\n const baseOptions = createScopedSlotOptions(overrides)\n // 作用域插槽选项由内部工厂完整构造,动态常量键会丢失静态索引信息。\n const componentOptions = baseOptions as unknown as Parameters<typeof createWevuComponent>[0]\n createWevuComponent(componentOptions)\n}\n/**\n * 安装作用域插槽的 owner 生命周期与组件创建能力。\n */\nexport function installScopedSlots(): void {\n registerRuntimeCapability('scopedSlots', scopedSlotHooks)\n const globalObject = getScopedSlotHostGlobalObject()\n if (globalObject && globalObject[WEVU_SCOPED_SLOT_CREATOR_KEY] !== createWevuScopedSlotComponent) {\n globalObject[WEVU_SCOPED_SLOT_CREATOR_KEY] = createWevuScopedSlotComponent\n }\n}\n"],"mappings":";;;;;;;;;;AAmDA,MAAM,kBAAyE;CAC7E,aAAa,QAA8B;EACzC,MAAM,WAAW,wBAAwB,MAAM;EAC/C,IAAI,UACF,OAAO;EAET,MAAM,uBAAuB,OAAO,OAAO;EAC3C,MAAM,UAAU,OAAO,yBAAyB,YAAY,uBACxD,uBACA,gBAAgB;EACpB,MAAM,QAA8B;GAClC;GACA,0BAA0B,OAAO,yBAAyB,YAAY,yBAAyB;EACjG;EACA,OAAO,eAAe,QAAQ,+BAA+B;GAC3D,OAAO;GACP,cAAc;GACd,YAAY;GACZ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;CACxD,MAAM,eAAe,8BAA8B;CACnD,IAAI,gBAAgB,aAAa,kCAAkC,+BACjE,aAAa,gCAAgC;AAEjD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"templateRefs.mjs","names":[],"sources":["../../../../src/runtime/features/templateRefs.ts"],"sourcesContent":["import type { RuntimeCapabilityRegistry, TemplateRefBinding } from '../capabilities'\nimport type { InternalRuntimeState } from '../types'\nimport { WEVU_TEMPLATE_REFS_KEY } from '@weapp-core/constants'\nimport { registerRuntimeCapability } from '../capabilities'\nimport { clearTemplateRefs, scheduleTemplateRefUpdate } from '../templateRefs'\n\nconst templateRefHooks: NonNullable<RuntimeCapabilityRegistry['templateRefs']> = {\n attachBindings(target: InternalRuntimeState, bindings: readonly TemplateRefBinding[]) {\n Object.defineProperty(target, WEVU_TEMPLATE_REFS_KEY, {\n value: bindings,\n configurable: true,\n enumerable: false,\n writable: false,\n })\n },\n hasBindings(target: InternalRuntimeState) {\n const bindings = target[WEVU_TEMPLATE_REFS_KEY]\n return Array.isArray(bindings) && bindings.length > 0\n },\n schedule: scheduleTemplateRefUpdate,\n scheduleOwner(target: InternalRuntimeState) {\n const selectOwnerComponent = target.selectOwnerComponent\n if (typeof selectOwnerComponent !== 'function') {\n return\n }\n try {\n const owner = selectOwnerComponent.call(target) as InternalRuntimeState | null | undefined\n if (owner && owner !== target) {\n scheduleTemplateRefUpdate(owner)\n }\n }\n catch {\n // 宿主不支持 owner 查询时保持当前组件生命周期正常执行。\n }\n },\n clear: clearTemplateRefs,\n}\n\n/**\n * 安装模板 ref 能力。\n */\nexport function installTemplateRefs(): void {\n registerRuntimeCapability('templateRefs', templateRefHooks)\n}\n"],"mappings":";;;;;AAMA,MAAM,mBAA2E;CAC/E,eAAe,QAA8B,UAAyC;EACpF,OAAO,eAAe,QAAQ,wBAAwB;GACpD,OAAO;GACP,cAAc;GACd,YAAY;GACZ,UAAU;EACZ,CAAC;CACH;CACA,YAAY,QAA8B;EACxC,MAAM,WAAW,OAAO;EACxB,OAAO,MAAM,QAAQ,QAAQ,KAAK,SAAS,SAAS;CACtD;CACA,UAAU;CACV,cAAc,QAA8B;EAC1C,MAAM,uBAAuB,OAAO;EACpC,IAAI,OAAO,yBAAyB,YAClC;EAEF,IAAI;GACF,MAAM,QAAQ,qBAAqB,KAAK,MAAM;GAC9C,IAAI,SAAS,UAAU,QACrB,0BAA0B,KAAK;EAEnC,
|
|
1
|
+
{"version":3,"file":"templateRefs.mjs","names":[],"sources":["../../../../src/runtime/features/templateRefs.ts"],"sourcesContent":["import type { RuntimeCapabilityRegistry, TemplateRefBinding } from '../capabilities'\nimport type { InternalRuntimeState } from '../types'\nimport { WEVU_TEMPLATE_REFS_KEY } from '@weapp-core/constants'\nimport { registerRuntimeCapability } from '../capabilities'\nimport { clearTemplateRefs, scheduleTemplateRefUpdate } from '../templateRefs'\n\nconst templateRefHooks: NonNullable<RuntimeCapabilityRegistry['templateRefs']> = {\n attachBindings(target: InternalRuntimeState, bindings: readonly TemplateRefBinding[]) {\n Object.defineProperty(target, WEVU_TEMPLATE_REFS_KEY, {\n value: bindings,\n configurable: true,\n enumerable: false,\n writable: false,\n })\n },\n hasBindings(target: InternalRuntimeState) {\n const bindings = target[WEVU_TEMPLATE_REFS_KEY]\n return Array.isArray(bindings) && bindings.length > 0\n },\n schedule: scheduleTemplateRefUpdate,\n scheduleOwner(target: InternalRuntimeState) {\n const selectOwnerComponent = target.selectOwnerComponent\n if (typeof selectOwnerComponent !== 'function') {\n return\n }\n try {\n const owner = selectOwnerComponent.call(target) as InternalRuntimeState | null | undefined\n if (owner && owner !== target) {\n scheduleTemplateRefUpdate(owner)\n }\n }\n catch {\n // 宿主不支持 owner 查询时保持当前组件生命周期正常执行。\n }\n },\n clear: clearTemplateRefs,\n}\n\n/**\n * 安装模板 ref 能力。\n */\nexport function installTemplateRefs(): void {\n registerRuntimeCapability('templateRefs', templateRefHooks)\n}\n"],"mappings":";;;;;AAMA,MAAM,mBAA2E;CAC/E,eAAe,QAA8B,UAAyC;EACpF,OAAO,eAAe,QAAQ,wBAAwB;GACpD,OAAO;GACP,cAAc;GACd,YAAY;GACZ,UAAU;EACZ,CAAC;CACH;CACA,YAAY,QAA8B;EACxC,MAAM,WAAW,OAAO;EACxB,OAAO,MAAM,QAAQ,QAAQ,KAAK,SAAS,SAAS;CACtD;CACA,UAAU;CACV,cAAc,QAA8B;EAC1C,MAAM,uBAAuB,OAAO;EACpC,IAAI,OAAO,yBAAyB,YAClC;EAEF,IAAI;GACF,MAAM,QAAQ,qBAAqB,KAAK,MAAM;GAC9C,IAAI,SAAS,UAAU,QACrB,0BAA0B,KAAK;EAEnC,QACM,CAEN;CACF;CACA,OAAO;AACT;;;;AAKA,SAAgB,sBAA4B;CAC1C,0BAA0B,gBAAgB,gBAAgB;AAC5D"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getCurrentMiniProgramGlobalObject, getCurrentMiniProgramRuntimeCapabilities } from "../platform/current.mjs";
|
|
2
|
+
import { getMiniProgramRuntimeGlobalObject, supportsCurrentMiniProgramRuntimeCapability } from "../platform.mjs";
|
|
2
3
|
import { WEVU_CURRENT_SETUP_STATE_KEY, WEVU_HOOKS_KEY } from "@weapp-core/constants";
|
|
3
4
|
|
|
4
5
|
//#region src/runtime/hooks/base.ts
|
|
5
6
|
const currentSetupState = (() => {
|
|
6
|
-
var _host$WEVU_CURRENT_SE;
|
|
7
7
|
const host = typeof globalThis !== "undefined" ? globalThis : getMiniProgramRuntimeGlobalObject();
|
|
8
|
-
return host ?
|
|
8
|
+
return host ? host[WEVU_CURRENT_SETUP_STATE_KEY] ?? (host[WEVU_CURRENT_SETUP_STATE_KEY] = {}) : {};
|
|
9
9
|
})();
|
|
10
10
|
function getCurrentInstance() {
|
|
11
11
|
return currentSetupState.instance;
|
|
@@ -57,36 +57,30 @@ function tryShowShareMenu(showShareMenu, menus) {
|
|
|
57
57
|
if (payload === void 0) showShareMenu();
|
|
58
58
|
else showShareMenu(payload);
|
|
59
59
|
return;
|
|
60
|
-
} catch
|
|
60
|
+
} catch {}
|
|
61
61
|
}
|
|
62
62
|
function pushHook(target, name, handler, { single = false } = {}) {
|
|
63
63
|
const bucket = ensureHookBucket(target);
|
|
64
64
|
if (single) bucket[name] = handler;
|
|
65
|
-
else
|
|
66
|
-
var _bucket$name;
|
|
67
|
-
((_bucket$name = bucket[name]) !== null && _bucket$name !== void 0 ? _bucket$name : bucket[name] = []).push(handler);
|
|
68
|
-
}
|
|
65
|
+
else (bucket[name] ?? (bucket[name] = [])).push(handler);
|
|
69
66
|
}
|
|
70
67
|
function ensureSinglePageHookOnInstance(target, name) {
|
|
71
|
-
var _ref
|
|
72
|
-
const bridges = (_ref
|
|
68
|
+
var _ref;
|
|
69
|
+
const bridges = (_ref = target).__wevuShareHookBridges ?? (_ref.__wevuShareHookBridges = Object.create(null));
|
|
73
70
|
if (typeof bridges[name] === "function") return;
|
|
74
71
|
const original = target[name];
|
|
75
72
|
const bridge = function onWevuShareHookBridge(...args) {
|
|
76
|
-
|
|
77
|
-
const
|
|
78
|
-
const entry = hooks === null || hooks === void 0 ? void 0 : hooks[name];
|
|
79
|
-
const runtime = this.__wevu;
|
|
80
|
-
const ctx = (_runtime$proxy = runtime === null || runtime === void 0 ? void 0 : runtime.proxy) !== null && _runtime$proxy !== void 0 ? _runtime$proxy : this;
|
|
73
|
+
const entry = this[WEVU_HOOKS_KEY]?.[name];
|
|
74
|
+
const ctx = this.__wevu?.proxy ?? this;
|
|
81
75
|
let ret;
|
|
82
76
|
if (typeof entry === "function") try {
|
|
83
77
|
ret = entry.apply(ctx, args);
|
|
84
|
-
} catch
|
|
78
|
+
} catch {
|
|
85
79
|
ret = void 0;
|
|
86
80
|
}
|
|
87
81
|
else if (Array.isArray(entry)) for (const fn of entry) try {
|
|
88
82
|
ret = fn.apply(ctx, args);
|
|
89
|
-
} catch
|
|
83
|
+
} catch {}
|
|
90
84
|
if (ret !== void 0) return ret;
|
|
91
85
|
if (typeof original === "function") return original.apply(this, args);
|
|
92
86
|
};
|
|
@@ -94,11 +88,10 @@ function ensureSinglePageHookOnInstance(target, name) {
|
|
|
94
88
|
target[name] = bridge;
|
|
95
89
|
}
|
|
96
90
|
function ensurePageShareMenusOnSetup(target) {
|
|
97
|
-
var _target$WEVU_HOOKS_KE;
|
|
98
91
|
if (!supportsCurrentMiniProgramRuntimeCapability("pageShareMenu")) return;
|
|
99
|
-
const miniProgramGlobal =
|
|
92
|
+
const miniProgramGlobal = getCurrentMiniProgramGlobalObject();
|
|
100
93
|
if (!miniProgramGlobal || typeof miniProgramGlobal.showShareMenu !== "function") return;
|
|
101
|
-
const hooks =
|
|
94
|
+
const hooks = target[WEVU_HOOKS_KEY] ?? {};
|
|
102
95
|
const hasShareAppMessage = typeof hooks.onShareAppMessage === "function";
|
|
103
96
|
const hasShareTimeline = typeof hooks.onShareTimeline === "function";
|
|
104
97
|
if (!hasShareAppMessage && !hasShareTimeline) return;
|
|
@@ -111,23 +104,21 @@ function ensurePageShareMenusOnSetup(target) {
|
|
|
111
104
|
* @internal
|
|
112
105
|
*/
|
|
113
106
|
function callHookList(target, name, args = []) {
|
|
114
|
-
var _runtime$proxy2;
|
|
115
107
|
const hooks = target[WEVU_HOOKS_KEY];
|
|
116
108
|
if (!hooks) return;
|
|
117
109
|
const list = hooks[name];
|
|
118
110
|
if (!list) return;
|
|
119
|
-
const
|
|
120
|
-
const ctx = (_runtime$proxy2 = runtime === null || runtime === void 0 ? void 0 : runtime.proxy) !== null && _runtime$proxy2 !== void 0 ? _runtime$proxy2 : target;
|
|
111
|
+
const ctx = target.__wevu?.proxy ?? target;
|
|
121
112
|
if (Array.isArray(list)) for (const fn of list) try {
|
|
122
113
|
fn.apply(ctx, args);
|
|
123
|
-
} catch
|
|
114
|
+
} catch {}
|
|
124
115
|
else if (typeof list === "function") try {
|
|
125
116
|
list.apply(ctx, args);
|
|
126
|
-
} catch
|
|
117
|
+
} catch {}
|
|
127
118
|
}
|
|
128
119
|
function ensurePageHookOnInstance(target, name) {
|
|
129
|
-
var _ref2
|
|
130
|
-
const bridges = (_ref2
|
|
120
|
+
var _ref2;
|
|
121
|
+
const bridges = (_ref2 = target).__wevuPageHookBridges ?? (_ref2.__wevuPageHookBridges = Object.create(null));
|
|
131
122
|
if (typeof bridges[name] === "function") return;
|
|
132
123
|
const original = target[name];
|
|
133
124
|
const bridge = function onWevuPageHookBridge(...args) {
|
|
@@ -142,23 +133,21 @@ function ensurePageHookOnInstance(target, name) {
|
|
|
142
133
|
* @internal
|
|
143
134
|
*/
|
|
144
135
|
function callHookReturn(target, name, args = []) {
|
|
145
|
-
var _runtime$proxy3;
|
|
146
136
|
const hooks = target[WEVU_HOOKS_KEY];
|
|
147
137
|
if (!hooks) return;
|
|
148
138
|
const entry = hooks[name];
|
|
149
139
|
if (!entry) return;
|
|
150
|
-
const
|
|
151
|
-
const ctx = (_runtime$proxy3 = runtime === null || runtime === void 0 ? void 0 : runtime.proxy) !== null && _runtime$proxy3 !== void 0 ? _runtime$proxy3 : target;
|
|
140
|
+
const ctx = target.__wevu?.proxy ?? target;
|
|
152
141
|
if (typeof entry === "function") try {
|
|
153
142
|
return entry.apply(ctx, args);
|
|
154
|
-
} catch
|
|
143
|
+
} catch {
|
|
155
144
|
return;
|
|
156
145
|
}
|
|
157
146
|
if (Array.isArray(entry)) {
|
|
158
147
|
let out;
|
|
159
148
|
for (const fn of entry) try {
|
|
160
149
|
out = fn.apply(ctx, args);
|
|
161
|
-
} catch
|
|
150
|
+
} catch {}
|
|
162
151
|
return out;
|
|
163
152
|
}
|
|
164
153
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.mjs","names":[],"sources":["../../../../src/runtime/hooks/base.ts"],"sourcesContent":["import type { InternalRuntimeState } from '../types'\nimport { WEVU_CURRENT_SETUP_STATE_KEY, WEVU_HOOKS_KEY } from '@weapp-core/constants'\nimport { getCurrentMiniProgramRuntimeCapabilities, getMiniProgramGlobalObject, getMiniProgramRuntimeGlobalObject, supportsCurrentMiniProgramRuntimeCapability } from '../platform'\n\n// 仅供同步 setup() 调用期间使用的当前实例引用。wevu 的根入口与\n// `wevu/router` 可能被打包成多个模块副本,必须通过宿主全局共享状态。\ninterface CurrentSetupState {\n instance?: InternalRuntimeState\n context?: any\n}\n\nconst currentSetupState: CurrentSetupState = (() => {\n // Web 会在模块加载后安装宿主 API;可用时优先使用稳定的执行域全局,\n // 防止不同入口因导入时机不同而持有两份 setup 状态。\n const host = typeof globalThis !== 'undefined'\n ? globalThis as Record<string, any>\n : getMiniProgramRuntimeGlobalObject()\n return host ? host[WEVU_CURRENT_SETUP_STATE_KEY] ??= {} : {}\n})()\n\nexport function getCurrentInstance<T extends InternalRuntimeState = InternalRuntimeState>(): T | undefined {\n return currentSetupState.instance as T | undefined\n}\n\n/**\n * 设置当前运行时实例(框架内部使用)。\n * @internal\n */\nexport function setCurrentInstance(inst: InternalRuntimeState | undefined) {\n currentSetupState.instance = inst\n}\n\nexport function getCurrentSetupContext<T = any>(): T | undefined {\n return currentSetupState.context as T | undefined\n}\n\n/**\n * 设置当前 setup 上下文(框架内部使用)。\n * @internal\n */\nexport function setCurrentSetupContext(ctx: any | undefined) {\n currentSetupState.context = ctx\n}\n\nexport function assertInSetup(name: string): InternalRuntimeState {\n if (!currentSetupState.instance) {\n throw new Error(`${name}() 必须在 setup() 的同步阶段调用`)\n }\n return currentSetupState.instance\n}\n\nfunction ensureHookBucket(target: InternalRuntimeState): Record<string, any> {\n if (!target[WEVU_HOOKS_KEY]) {\n target[WEVU_HOOKS_KEY] = Object.create(null)\n }\n return target[WEVU_HOOKS_KEY] as Record<string, any>\n}\n\ntype ShareMenuName = 'shareAppMessage' | 'shareTimeline'\n\nfunction buildShareMenus(\n enableOnShareAppMessage: boolean,\n enableOnShareTimeline: boolean,\n): ShareMenuName[] {\n const runtimeCapabilities = getCurrentMiniProgramRuntimeCapabilities()\n const shouldShowShareAppMessage = runtimeCapabilities.shareTimelineRequiresShareAppMessage\n ? (enableOnShareAppMessage || enableOnShareTimeline)\n : enableOnShareAppMessage\n\n const menus: ShareMenuName[] = []\n if (shouldShowShareAppMessage) {\n menus.push('shareAppMessage')\n }\n if (enableOnShareTimeline) {\n menus.push('shareTimeline')\n }\n return menus\n}\n\nfunction tryShowShareMenu(showShareMenu: (...args: any[]) => unknown, menus: ShareMenuName[]) {\n const payloads = [\n { withShareTicket: true, menus },\n { menus },\n menus.includes('shareTimeline') ? { withShareTicket: true } : undefined,\n menus.includes('shareTimeline') ? {} : undefined,\n undefined,\n ]\n\n for (const payload of payloads) {\n try {\n if (payload === undefined) {\n showShareMenu()\n }\n else {\n showShareMenu(payload as any)\n }\n return\n }\n catch {\n // 继续尝试更保守的 payload,兼容不同宿主的 showShareMenu 参数形态。\n }\n }\n}\n\nexport function pushHook(\n target: InternalRuntimeState,\n name: string,\n handler: (...args: any[]) => any,\n { single = false } = {},\n) {\n const bucket = ensureHookBucket(target)\n if (single) {\n bucket[name] = handler\n }\n else {\n const list: Array<(...args: any[]) => any> = bucket[name] ?? (bucket[name] = [])\n list.push(handler)\n }\n}\n\nexport function ensureSinglePageHookOnInstance(target: InternalRuntimeState, name: 'onShareAppMessage' | 'onShareTimeline' | 'onAddToFavorites') {\n const bridges = ((target as any).__wevuShareHookBridges ??= Object.create(null)) as Record<string, (...args: any[]) => any>\n if (typeof bridges[name] === 'function') {\n return\n }\n\n const original = (target as any)[name]\n const bridge = function onWevuShareHookBridge(this: InternalRuntimeState, ...args: any[]) {\n const hooks = this[WEVU_HOOKS_KEY] as Record<string, any> | undefined\n const entry = hooks?.[name]\n const runtime = this.__wevu\n const ctx = runtime?.proxy ?? this\n let ret: any\n\n if (typeof entry === 'function') {\n try {\n ret = entry.apply(ctx, args)\n }\n catch {\n ret = undefined\n }\n }\n else if (Array.isArray(entry)) {\n for (const fn of entry) {\n try {\n ret = fn.apply(ctx, args)\n }\n catch {\n // 忽略单个 hook 抛出的异常,继续执行后续 hook\n }\n }\n }\n\n if (ret !== undefined) {\n return ret\n }\n if (typeof original === 'function') {\n return original.apply(this, args)\n }\n return undefined\n }\n\n bridges[name] = bridge\n ;(target as any)[name] = bridge\n}\n\nexport function ensurePageShareMenusOnSetup(target: InternalRuntimeState) {\n if (!supportsCurrentMiniProgramRuntimeCapability('pageShareMenu')) {\n return\n }\n const miniProgramGlobal = getMiniProgramGlobalObject()\n if (!miniProgramGlobal || typeof miniProgramGlobal.showShareMenu !== 'function') {\n return\n }\n\n const hooks = (target[WEVU_HOOKS_KEY] ?? {}) as Record<string, any>\n const hasShareAppMessage = typeof hooks.onShareAppMessage === 'function'\n const hasShareTimeline = typeof hooks.onShareTimeline === 'function'\n\n if (!hasShareAppMessage && !hasShareTimeline) {\n return\n }\n\n const menus = buildShareMenus(hasShareAppMessage, hasShareTimeline)\n if (!menus.length) {\n return\n }\n\n tryShowShareMenu(miniProgramGlobal.showShareMenu.bind(miniProgramGlobal), menus)\n}\n\n/**\n * 调用批量 hook(框架内部调度入口)。\n * @internal\n */\nexport function callHookList(target: InternalRuntimeState, name: string, args: any[] = []) {\n const hooks = target[WEVU_HOOKS_KEY]\n if (!hooks) {\n return\n }\n const list = hooks[name]\n if (!list) {\n return\n }\n const runtime = target.__wevu\n const ctx = runtime?.proxy ?? target\n if (Array.isArray(list)) {\n for (const fn of list) {\n try {\n fn.apply(ctx, args)\n }\n catch {\n // 忽略单个 hook 抛出的异常,防止阻塞其他监听\n }\n }\n }\n else if (typeof list === 'function') {\n try {\n list.apply(ctx, args)\n }\n catch {\n // 忽略单个 hook 抛出的异常,防止阻塞其他监听\n }\n }\n}\n\nexport function ensurePageHookOnInstance(target: InternalRuntimeState, name: 'onPageScroll') {\n const bridges = ((target as any).__wevuPageHookBridges ??= Object.create(null)) as Record<string, (...args: any[]) => any>\n if (typeof bridges[name] === 'function') {\n return\n }\n\n const original = (target as any)[name]\n const bridge = function onWevuPageHookBridge(this: InternalRuntimeState, ...args: any[]) {\n callHookList(this, name, args)\n if (typeof original === 'function') {\n return original.apply(this, args)\n }\n return undefined\n }\n\n bridges[name] = bridge\n ;(target as any)[name] = bridge\n}\n\n/**\n * 调用返回值型 hook(框架内部调度入口)。\n * @internal\n */\nexport function callHookReturn(target: InternalRuntimeState, name: string, args: any[] = []) {\n const hooks = target[WEVU_HOOKS_KEY]\n if (!hooks) {\n return undefined\n }\n const entry = hooks[name]\n if (!entry) {\n return undefined\n }\n const runtime = target.__wevu\n const ctx = runtime?.proxy ?? target\n if (typeof entry === 'function') {\n try {\n return entry.apply(ctx, args)\n }\n catch {\n return undefined\n }\n }\n if (Array.isArray(entry)) {\n let out: any\n for (const fn of entry) {\n try {\n out = fn.apply(ctx, args)\n }\n catch {\n // 忽略单个 hook 抛出的异常,继续执行后续 hook\n }\n }\n return out\n }\n return undefined\n}\n"],"mappings":";;;;AAWA,MAAM,2BAA8C;;CAGlD,MAAM,OAAO,OAAO,eAAe,cAC/B,aACA,kCAAkC;CACtC,OAAO,gCAAO,KAAK,sGAAL,KAAK,gCAAkC,CAAC,IAAI,CAAC;AAC7D,EAAC,CAAE;AAEH,SAAgB,qBAA2F;CACzG,OAAO,kBAAkB;AAC3B;;;;;AAMA,SAAgB,mBAAmB,MAAwC;CACzE,kBAAkB,WAAW;AAC/B;AAEA,SAAgB,yBAAiD;CAC/D,OAAO,kBAAkB;AAC3B;;;;;AAMA,SAAgB,uBAAuB,KAAsB;CAC3D,kBAAkB,UAAU;AAC9B;AAEA,SAAgB,cAAc,MAAoC;CAChE,IAAI,CAAC,kBAAkB,UACrB,MAAM,IAAI,MAAM,GAAG,KAAK,uBAAuB;CAEjD,OAAO,kBAAkB;AAC3B;AAEA,SAAS,iBAAiB,QAAmD;CAC3E,IAAI,CAAC,OAAO,iBACV,OAAO,kBAAkB,OAAO,OAAO,IAAI;CAE7C,OAAO,OAAO;AAChB;AAIA,SAAS,gBACP,yBACA,uBACiB;CAEjB,MAAM,4BADsB,yCACwB,CAAC,CAAC,uCACjD,2BAA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I;EAC7B,IAAI,OAAO,aAAa,YACtB,OAAO,SAAS,MAAM,MAAM,IAAI;CAGpC;CAEA,QAAQ,QAAQ;CACf,AAAC,OAAe,QAAQ;AAC3B;;;;;AAMA,SAAgB,eAAe,QAA8B,MAAc,OAAc,CAAC,GAAG;;CAC3F,MAAM,QAAQ,OAAO;CACrB,IAAI,CAAC,OACH;CAEF,MAAM,QAAQ,MAAM;CACpB,IAAI,CAAC,OACH;CAEF,MAAM,UAAU,OAAO;CACvB,MAAM,2EAAM,QAAS,kEAAS;CAC9B,IAAI,OAAO,UAAU,YACnB,IAAI;EACF,OAAO,MAAM,MAAM,KAAK,IAAI;CAC9B,mBACM;EACJ;CACF;CAEF,IAAI,MAAM,QAAQ,KAAK,GAAG;EACxB,IAAI;EACJ,KAAK,MAAM,MAAM,OACf,IAAI;GACF,MAAM,GAAG,MAAM,KAAK,IAAI;EAC1B,mBACM,CAEN;EAEF,OAAO;CACT;AAEF"}
|
|
1
|
+
{"version":3,"file":"base.mjs","names":[],"sources":["../../../../src/runtime/hooks/base.ts"],"sourcesContent":["import type { InternalRuntimeState } from '../types'\nimport { WEVU_CURRENT_SETUP_STATE_KEY, WEVU_HOOKS_KEY } from '@weapp-core/constants'\nimport { getCurrentMiniProgramGlobalObject, getCurrentMiniProgramRuntimeCapabilities, getMiniProgramRuntimeGlobalObject, supportsCurrentMiniProgramRuntimeCapability } from '../platform'\n\n// 仅供同步 setup() 调用期间使用的当前实例引用。wevu 的根入口与\n// `wevu/router` 可能被打包成多个模块副本,必须通过宿主全局共享状态。\ninterface CurrentSetupState {\n instance?: InternalRuntimeState\n context?: any\n}\n\nconst currentSetupState: CurrentSetupState = (() => {\n // Web 会在模块加载后安装宿主 API;可用时优先使用稳定的执行域全局,\n // 防止不同入口因导入时机不同而持有两份 setup 状态。\n const host = typeof globalThis !== 'undefined'\n ? globalThis as Record<string, any>\n : getMiniProgramRuntimeGlobalObject()\n return host ? host[WEVU_CURRENT_SETUP_STATE_KEY] ??= {} : {}\n})()\n\nexport function getCurrentInstance<T extends InternalRuntimeState = InternalRuntimeState>(): T | undefined {\n return currentSetupState.instance as T | undefined\n}\n\n/**\n * 设置当前运行时实例(框架内部使用)。\n * @internal\n */\nexport function setCurrentInstance(inst: InternalRuntimeState | undefined) {\n currentSetupState.instance = inst\n}\n\nexport function getCurrentSetupContext<T = any>(): T | undefined {\n return currentSetupState.context as T | undefined\n}\n\n/**\n * 设置当前 setup 上下文(框架内部使用)。\n * @internal\n */\nexport function setCurrentSetupContext(ctx: any | undefined) {\n currentSetupState.context = ctx\n}\n\nexport function assertInSetup(name: string): InternalRuntimeState {\n if (!currentSetupState.instance) {\n throw new Error(`${name}() 必须在 setup() 的同步阶段调用`)\n }\n return currentSetupState.instance\n}\n\nfunction ensureHookBucket(target: InternalRuntimeState): Record<string, any> {\n if (!target[WEVU_HOOKS_KEY]) {\n target[WEVU_HOOKS_KEY] = Object.create(null)\n }\n return target[WEVU_HOOKS_KEY] as Record<string, any>\n}\n\ntype ShareMenuName = 'shareAppMessage' | 'shareTimeline'\n\nfunction buildShareMenus(\n enableOnShareAppMessage: boolean,\n enableOnShareTimeline: boolean,\n): ShareMenuName[] {\n const runtimeCapabilities = getCurrentMiniProgramRuntimeCapabilities()\n const shouldShowShareAppMessage = runtimeCapabilities.shareTimelineRequiresShareAppMessage\n ? (enableOnShareAppMessage || enableOnShareTimeline)\n : enableOnShareAppMessage\n\n const menus: ShareMenuName[] = []\n if (shouldShowShareAppMessage) {\n menus.push('shareAppMessage')\n }\n if (enableOnShareTimeline) {\n menus.push('shareTimeline')\n }\n return menus\n}\n\nfunction tryShowShareMenu(showShareMenu: (...args: any[]) => unknown, menus: ShareMenuName[]) {\n const payloads = [\n { withShareTicket: true, menus },\n { menus },\n menus.includes('shareTimeline') ? { withShareTicket: true } : undefined,\n menus.includes('shareTimeline') ? {} : undefined,\n undefined,\n ]\n\n for (const payload of payloads) {\n try {\n if (payload === undefined) {\n showShareMenu()\n }\n else {\n showShareMenu(payload as any)\n }\n return\n }\n catch {\n // 继续尝试更保守的 payload,兼容不同宿主的 showShareMenu 参数形态。\n }\n }\n}\n\nexport function pushHook(\n target: InternalRuntimeState,\n name: string,\n handler: (...args: any[]) => any,\n { single = false } = {},\n) {\n const bucket = ensureHookBucket(target)\n if (single) {\n bucket[name] = handler\n }\n else {\n const list: Array<(...args: any[]) => any> = bucket[name] ?? (bucket[name] = [])\n list.push(handler)\n }\n}\n\nexport function ensureSinglePageHookOnInstance(target: InternalRuntimeState, name: 'onShareAppMessage' | 'onShareTimeline' | 'onAddToFavorites') {\n const bridges = ((target as any).__wevuShareHookBridges ??= Object.create(null)) as Record<string, (...args: any[]) => any>\n if (typeof bridges[name] === 'function') {\n return\n }\n\n const original = (target as any)[name]\n const bridge = function onWevuShareHookBridge(this: InternalRuntimeState, ...args: any[]) {\n const hooks = this[WEVU_HOOKS_KEY] as Record<string, any> | undefined\n const entry = hooks?.[name]\n const runtime = this.__wevu\n const ctx = runtime?.proxy ?? this\n let ret: any\n\n if (typeof entry === 'function') {\n try {\n ret = entry.apply(ctx, args)\n }\n catch {\n ret = undefined\n }\n }\n else if (Array.isArray(entry)) {\n for (const fn of entry) {\n try {\n ret = fn.apply(ctx, args)\n }\n catch {\n // 忽略单个 hook 抛出的异常,继续执行后续 hook\n }\n }\n }\n\n if (ret !== undefined) {\n return ret\n }\n if (typeof original === 'function') {\n return original.apply(this, args)\n }\n return undefined\n }\n\n bridges[name] = bridge\n ;(target as any)[name] = bridge\n}\n\nexport function ensurePageShareMenusOnSetup(target: InternalRuntimeState) {\n if (!supportsCurrentMiniProgramRuntimeCapability('pageShareMenu')) {\n return\n }\n const miniProgramGlobal = getCurrentMiniProgramGlobalObject()\n if (!miniProgramGlobal || typeof miniProgramGlobal.showShareMenu !== 'function') {\n return\n }\n\n const hooks = (target[WEVU_HOOKS_KEY] ?? {}) as Record<string, any>\n const hasShareAppMessage = typeof hooks.onShareAppMessage === 'function'\n const hasShareTimeline = typeof hooks.onShareTimeline === 'function'\n\n if (!hasShareAppMessage && !hasShareTimeline) {\n return\n }\n\n const menus = buildShareMenus(hasShareAppMessage, hasShareTimeline)\n if (!menus.length) {\n return\n }\n\n tryShowShareMenu(miniProgramGlobal.showShareMenu.bind(miniProgramGlobal), menus)\n}\n\n/**\n * 调用批量 hook(框架内部调度入口)。\n * @internal\n */\nexport function callHookList(target: InternalRuntimeState, name: string, args: any[] = []) {\n const hooks = target[WEVU_HOOKS_KEY]\n if (!hooks) {\n return\n }\n const list = hooks[name]\n if (!list) {\n return\n }\n const runtime = target.__wevu\n const ctx = runtime?.proxy ?? target\n if (Array.isArray(list)) {\n for (const fn of list) {\n try {\n fn.apply(ctx, args)\n }\n catch {\n // 忽略单个 hook 抛出的异常,防止阻塞其他监听\n }\n }\n }\n else if (typeof list === 'function') {\n try {\n list.apply(ctx, args)\n }\n catch {\n // 忽略单个 hook 抛出的异常,防止阻塞其他监听\n }\n }\n}\n\nexport function ensurePageHookOnInstance(target: InternalRuntimeState, name: 'onPageScroll') {\n const bridges = ((target as any).__wevuPageHookBridges ??= Object.create(null)) as Record<string, (...args: any[]) => any>\n if (typeof bridges[name] === 'function') {\n return\n }\n\n const original = (target as any)[name]\n const bridge = function onWevuPageHookBridge(this: InternalRuntimeState, ...args: any[]) {\n callHookList(this, name, args)\n if (typeof original === 'function') {\n return original.apply(this, args)\n }\n return undefined\n }\n\n bridges[name] = bridge\n ;(target as any)[name] = bridge\n}\n\n/**\n * 调用返回值型 hook(框架内部调度入口)。\n * @internal\n */\nexport function callHookReturn(target: InternalRuntimeState, name: string, args: any[] = []) {\n const hooks = target[WEVU_HOOKS_KEY]\n if (!hooks) {\n return undefined\n }\n const entry = hooks[name]\n if (!entry) {\n return undefined\n }\n const runtime = target.__wevu\n const ctx = runtime?.proxy ?? target\n if (typeof entry === 'function') {\n try {\n return entry.apply(ctx, args)\n }\n catch {\n return undefined\n }\n }\n if (Array.isArray(entry)) {\n let out: any\n for (const fn of entry) {\n try {\n out = fn.apply(ctx, args)\n }\n catch {\n // 忽略单个 hook 抛出的异常,继续执行后续 hook\n }\n }\n return out\n }\n return undefined\n}\n"],"mappings":";;;;;AAWA,MAAM,2BAA8C;CAGlD,MAAM,OAAO,OAAO,eAAe,cAC/B,aACA,kCAAkC;CACtC,OAAO,OAAO,KAAK,kCAAL,KAAK,gCAAkC,CAAC,KAAI,CAAC;AAC7D,EAAC,CAAE;AAEH,SAAgB,qBAA2F;CACzG,OAAO,kBAAkB;AAC3B;;;;;AAMA,SAAgB,mBAAmB,MAAwC;CACzE,kBAAkB,WAAW;AAC/B;AAEA,SAAgB,yBAAiD;CAC/D,OAAO,kBAAkB;AAC3B;;;;;AAMA,SAAgB,uBAAuB,KAAsB;CAC3D,kBAAkB,UAAU;AAC9B;AAEA,SAAgB,cAAc,MAAoC;CAChE,IAAI,CAAC,kBAAkB,UACrB,MAAM,IAAI,MAAM,GAAG,KAAK,uBAAuB;CAEjD,OAAO,kBAAkB;AAC3B;AAEA,SAAS,iBAAiB,QAAmD;CAC3E,IAAI,CAAC,OAAO,iBACV,OAAO,kBAAkB,OAAO,OAAO,IAAI;CAE7C,OAAO,OAAO;AAChB;AAIA,SAAS,gBACP,yBACA,uBACiB;CAEjB,MAAM,4BADsB,yCACwB,CAAC,CAAC,uCACjD,2BAA2B,wBAC5B;CAEJ,MAAM,QAAyB,CAAC;CAChC,IAAI,2BACF,MAAM,KAAK,iBAAiB;CAE9B,IAAI,uBACF,MAAM,KAAK,eAAe;CAE5B,OAAO;AACT;AAEA,SAAS,iBAAiB,eAA4C,OAAwB;CAC5F,MAAM,WAAW;EACf;GAAE,iBAAiB;GAAM;EAAM;EAC/B,EAAE,MAAM;EACR,MAAM,SAAS,eAAe,IAAI,EAAE,iBAAiB,KAAK,IAAI;EAC9D,MAAM,SAAS,eAAe,IAAI,CAAC,IAAI;EACvC;CACF;CAEA,KAAK,MAAM,WAAW,UACpB,IAAI;EACF,IAAI,YAAY,QACd,cAAc;OAGd,cAAc,OAA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AK,IAAI;EAC1B,QACM,CAEN;EAEF,OAAO;CACT;AAEF"}
|
|
@@ -47,8 +47,7 @@ function decodeWxmlEntities(value) {
|
|
|
47
47
|
* 解析模板事件数据集键,兼容平台的大小写和事件后缀归一化。
|
|
48
48
|
*/
|
|
49
49
|
function resolveDatasetEventValue(dataset, baseKey, event) {
|
|
50
|
-
|
|
51
|
-
const aliasKeys = (_DATASET_KEY_ALIASES$ = DATASET_KEY_ALIASES[baseKey]) !== null && _DATASET_KEY_ALIASES$ !== void 0 ? _DATASET_KEY_ALIASES$ : [baseKey];
|
|
50
|
+
const aliasKeys = DATASET_KEY_ALIASES[baseKey] ?? [baseKey];
|
|
52
51
|
for (const aliasKey of aliasKeys) {
|
|
53
52
|
const specificKey = resolveEventDatasetKey(aliasKey, event);
|
|
54
53
|
if (specificKey && dataset[specificKey] !== void 0) return dataset[specificKey];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inlineDataset.mjs","names":[],"sources":["../../../src/runtime/inlineDataset.ts"],"sourcesContent":["const AMP_RE = /&/g\nconst QUOT_RE = /"/g\nconst NUM_QUOT_RE = /"/g\nconst APOS_RE = /'/g\nconst NUM_APOS_RE = /'/g\nconst LT_RE = /</g\nconst GT_RE = />/g\n\nconst DATASET_ARRAY_INDEX_RE = /^(?:0|[1-9]\\d*)$/\nconst NON_ALNUM_RE = /[^a-z0-9]+/gi\nconst LEADING_TRAILING_DASH_RE = /^-+|-+$/g\nconst DASH_ALNUM_RE = /-([a-z0-9])/g\nconst DATASET_KEY_SEPARATOR_RE = /[-_]/g\n\nfunction normalizeDatasetIndex(value: unknown): number | string | undefined {\n if (typeof value === 'number' && Number.isFinite(value)) {\n return value\n }\n if (typeof value === 'string' && value.trim()) {\n const trimmed = value.trim()\n return DATASET_ARRAY_INDEX_RE.test(trimmed) ? Number(trimmed) : trimmed\n }\n return undefined\n}\n\nfunction normalizeEventToken(value: string): string {\n return value\n .trim()\n .replace(NON_ALNUM_RE, '-')\n .replace(LEADING_TRAILING_DASH_RE, '')\n .toLowerCase()\n}\n\nfunction resolveNormalizedDatasetValue(dataset: Record<string, unknown>, key: string): unknown {\n const normalizedKey = key.replace(DATASET_KEY_SEPARATOR_RE, '').toLowerCase()\n for (const [datasetKey, value] of Object.entries(dataset)) {\n if (datasetKey.replace(DATASET_KEY_SEPARATOR_RE, '').toLowerCase() === normalizedKey) {\n return value\n }\n }\n return undefined\n}\n\nfunction resolveEventDatasetKey(baseKey: string, event: unknown): string | undefined {\n const eventType = event && typeof event === 'object' && 'type' in event && typeof event.type === 'string'\n ? event.type\n : ''\n const token = normalizeEventToken(eventType)\n if (!token) {\n return undefined\n }\n const camelToken = token.replace(DASH_ALNUM_RE, (_, character: string) => character.toUpperCase())\n if (!camelToken) {\n return undefined\n }\n return `${baseKey}${camelToken[0].toUpperCase()}${camelToken.slice(1)}`\n}\n\nconst DATASET_KEY_ALIASES: Record<string, string[]> = {\n wvEventDetail: ['wd', 'wvEventDetail'],\n wvHandler: ['wh', 'wvHandler'],\n wvInlineId: ['wi', 'wvInlineId'],\n}\n\n/**\n * 解码 WXML 数据集传递时可能保留的实体。\n */\nexport function decodeWxmlEntities(value: string): string {\n return value\n .replace(AMP_RE, '&')\n .replace(QUOT_RE, '\"')\n .replace(NUM_QUOT_RE, '\"')\n .replace(APOS_RE, '\\'')\n .replace(NUM_APOS_RE, '\\'')\n .replace(LT_RE, '<')\n .replace(GT_RE, '>')\n}\n\n/**\n * 解析模板事件数据集键,兼容平台的大小写和事件后缀归一化。\n */\nexport function resolveDatasetEventValue(\n dataset: Record<string, unknown>,\n baseKey: string,\n event: unknown,\n): unknown {\n const aliasKeys = DATASET_KEY_ALIASES[baseKey] ?? [baseKey]\n for (const aliasKey of aliasKeys) {\n const specificKey = resolveEventDatasetKey(aliasKey, event)\n if (specificKey && dataset[specificKey] !== undefined) {\n return dataset[specificKey]\n }\n if (specificKey) {\n const normalizedValue = resolveNormalizedDatasetValue(dataset, specificKey)\n if (normalizedValue !== undefined) {\n return normalizedValue\n }\n }\n }\n for (const aliasKey of aliasKeys) {\n if (dataset[aliasKey] !== undefined) {\n return dataset[aliasKey]\n }\n const normalizedValue = resolveNormalizedDatasetValue(dataset, aliasKey)\n if (normalizedValue !== undefined) {\n return normalizedValue\n }\n }\n return undefined\n}\n\n/**\n * 将模板循环索引转换为稳定的数字或字符串键。\n */\nexport function resolveDatasetIndex(value: unknown): number | string | undefined {\n return normalizeDatasetIndex(value)\n}\n"],"mappings":";AAAA,MAAM,SAAS;AACf,MAAM,UAAU;AAChB,MAAM,cAAc;AACpB,MAAM,UAAU;AAChB,MAAM,cAAc;AACpB,MAAM,QAAQ;AACd,MAAM,QAAQ;AAEd,MAAM,yBAAyB;AAC/B,MAAM,eAAe;AACrB,MAAM,2BAA2B;AACjC,MAAM,gBAAgB;AACtB,MAAM,2BAA2B;AAEjC,SAAS,sBAAsB,OAA6C;CAC1E,IAAI,OAAO,UAAU,YAAY,OAAO,SAAS,KAAK,GACpD,OAAO;CAET,IAAI,OAAO,UAAU,YAAY,MAAM,KAAK,GAAG;EAC7C,MAAM,UAAU,MAAM,KAAK;EAC3B,OAAO,uBAAuB,KAAK,OAAO,IAAI,OAAO,OAAO,IAAI;CAClE;AAEF;AAEA,SAAS,oBAAoB,OAAuB;CAClD,OAAO,MACJ,KAAK,CAAC,CACN,QAAQ,cAAc,GAAG,CAAC,CAC1B,QAAQ,0BAA0B,EAAE,CAAC,CACrC,YAAY;AACjB;AAEA,SAAS,8BAA8B,SAAkC,KAAsB;CAC7F,MAAM,gBAAgB,IAAI,QAAQ,0BAA0B,EAAE,CAAC,CAAC,YAAY;CAC5E,KAAK,MAAM,CAAC,YAAY,UAAU,OAAO,QAAQ,OAAO,GACtD,IAAI,WAAW,QAAQ,0BAA0B,EAAE,CAAC,CAAC,YAAY,MAAM,eACrE,OAAO;AAIb;AAEA,SAAS,uBAAuB,SAAiB,OAAoC;CAInF,MAAM,QAAQ,oBAHI,SAAS,OAAO,UAAU,YAAY,UAAU,SAAS,OAAO,MAAM,SAAS,WAC7F,MAAM,OACN,EACuC;CAC3C,IAAI,CAAC,OACH;CAEF,MAAM,aAAa,MAAM,QAAQ,gBAAgB,GAAG,cAAsB,UAAU,YAAY,CAAC;CACjG,IAAI,CAAC,YACH;CAEF,OAAO,GAAG,UAAU,WAAW,EAAE,CAAC,YAAY,IAAI,WAAW,MAAM,CAAC;AACtE;AAEA,MAAM,sBAAgD;CACpD,eAAe,CAAC,MAAM,eAAe;CACrC,WAAW,CAAC,MAAM,WAAW;CAC7B,YAAY,CAAC,MAAM,YAAY;AACjC;;;;AAKA,SAAgB,mBAAmB,OAAuB;CACxD,OAAO,MACJ,QAAQ,QAAQ,GAAG,CAAC,CACpB,QAAQ,SAAS,IAAG,CAAC,CACrB,QAAQ,aAAa,IAAG,CAAC,CACzB,QAAQ,SAAS,GAAI,CAAC,CACtB,QAAQ,aAAa,GAAI,CAAC,CAC1B,QAAQ,OAAO,GAAG,CAAC,CACnB,QAAQ,OAAO,GAAG;AACvB;;;;AAKA,SAAgB,yBACd,SACA,SACA,OACS
|
|
1
|
+
{"version":3,"file":"inlineDataset.mjs","names":[],"sources":["../../../src/runtime/inlineDataset.ts"],"sourcesContent":["const AMP_RE = /&/g\nconst QUOT_RE = /"/g\nconst NUM_QUOT_RE = /"/g\nconst APOS_RE = /'/g\nconst NUM_APOS_RE = /'/g\nconst LT_RE = /</g\nconst GT_RE = />/g\n\nconst DATASET_ARRAY_INDEX_RE = /^(?:0|[1-9]\\d*)$/\nconst NON_ALNUM_RE = /[^a-z0-9]+/gi\nconst LEADING_TRAILING_DASH_RE = /^-+|-+$/g\nconst DASH_ALNUM_RE = /-([a-z0-9])/g\nconst DATASET_KEY_SEPARATOR_RE = /[-_]/g\n\nfunction normalizeDatasetIndex(value: unknown): number | string | undefined {\n if (typeof value === 'number' && Number.isFinite(value)) {\n return value\n }\n if (typeof value === 'string' && value.trim()) {\n const trimmed = value.trim()\n return DATASET_ARRAY_INDEX_RE.test(trimmed) ? Number(trimmed) : trimmed\n }\n return undefined\n}\n\nfunction normalizeEventToken(value: string): string {\n return value\n .trim()\n .replace(NON_ALNUM_RE, '-')\n .replace(LEADING_TRAILING_DASH_RE, '')\n .toLowerCase()\n}\n\nfunction resolveNormalizedDatasetValue(dataset: Record<string, unknown>, key: string): unknown {\n const normalizedKey = key.replace(DATASET_KEY_SEPARATOR_RE, '').toLowerCase()\n for (const [datasetKey, value] of Object.entries(dataset)) {\n if (datasetKey.replace(DATASET_KEY_SEPARATOR_RE, '').toLowerCase() === normalizedKey) {\n return value\n }\n }\n return undefined\n}\n\nfunction resolveEventDatasetKey(baseKey: string, event: unknown): string | undefined {\n const eventType = event && typeof event === 'object' && 'type' in event && typeof event.type === 'string'\n ? event.type\n : ''\n const token = normalizeEventToken(eventType)\n if (!token) {\n return undefined\n }\n const camelToken = token.replace(DASH_ALNUM_RE, (_, character: string) => character.toUpperCase())\n if (!camelToken) {\n return undefined\n }\n return `${baseKey}${camelToken[0].toUpperCase()}${camelToken.slice(1)}`\n}\n\nconst DATASET_KEY_ALIASES: Record<string, string[]> = {\n wvEventDetail: ['wd', 'wvEventDetail'],\n wvHandler: ['wh', 'wvHandler'],\n wvInlineId: ['wi', 'wvInlineId'],\n}\n\n/**\n * 解码 WXML 数据集传递时可能保留的实体。\n */\nexport function decodeWxmlEntities(value: string): string {\n return value\n .replace(AMP_RE, '&')\n .replace(QUOT_RE, '\"')\n .replace(NUM_QUOT_RE, '\"')\n .replace(APOS_RE, '\\'')\n .replace(NUM_APOS_RE, '\\'')\n .replace(LT_RE, '<')\n .replace(GT_RE, '>')\n}\n\n/**\n * 解析模板事件数据集键,兼容平台的大小写和事件后缀归一化。\n */\nexport function resolveDatasetEventValue(\n dataset: Record<string, unknown>,\n baseKey: string,\n event: unknown,\n): unknown {\n const aliasKeys = DATASET_KEY_ALIASES[baseKey] ?? [baseKey]\n for (const aliasKey of aliasKeys) {\n const specificKey = resolveEventDatasetKey(aliasKey, event)\n if (specificKey && dataset[specificKey] !== undefined) {\n return dataset[specificKey]\n }\n if (specificKey) {\n const normalizedValue = resolveNormalizedDatasetValue(dataset, specificKey)\n if (normalizedValue !== undefined) {\n return normalizedValue\n }\n }\n }\n for (const aliasKey of aliasKeys) {\n if (dataset[aliasKey] !== undefined) {\n return dataset[aliasKey]\n }\n const normalizedValue = resolveNormalizedDatasetValue(dataset, aliasKey)\n if (normalizedValue !== undefined) {\n return normalizedValue\n }\n }\n return undefined\n}\n\n/**\n * 将模板循环索引转换为稳定的数字或字符串键。\n */\nexport function resolveDatasetIndex(value: unknown): number | string | undefined {\n return normalizeDatasetIndex(value)\n}\n"],"mappings":";AAAA,MAAM,SAAS;AACf,MAAM,UAAU;AAChB,MAAM,cAAc;AACpB,MAAM,UAAU;AAChB,MAAM,cAAc;AACpB,MAAM,QAAQ;AACd,MAAM,QAAQ;AAEd,MAAM,yBAAyB;AAC/B,MAAM,eAAe;AACrB,MAAM,2BAA2B;AACjC,MAAM,gBAAgB;AACtB,MAAM,2BAA2B;AAEjC,SAAS,sBAAsB,OAA6C;CAC1E,IAAI,OAAO,UAAU,YAAY,OAAO,SAAS,KAAK,GACpD,OAAO;CAET,IAAI,OAAO,UAAU,YAAY,MAAM,KAAK,GAAG;EAC7C,MAAM,UAAU,MAAM,KAAK;EAC3B,OAAO,uBAAuB,KAAK,OAAO,IAAI,OAAO,OAAO,IAAI;CAClE;AAEF;AAEA,SAAS,oBAAoB,OAAuB;CAClD,OAAO,MACJ,KAAK,CAAC,CACN,QAAQ,cAAc,GAAG,CAAC,CAC1B,QAAQ,0BAA0B,EAAE,CAAC,CACrC,YAAY;AACjB;AAEA,SAAS,8BAA8B,SAAkC,KAAsB;CAC7F,MAAM,gBAAgB,IAAI,QAAQ,0BAA0B,EAAE,CAAC,CAAC,YAAY;CAC5E,KAAK,MAAM,CAAC,YAAY,UAAU,OAAO,QAAQ,OAAO,GACtD,IAAI,WAAW,QAAQ,0BAA0B,EAAE,CAAC,CAAC,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AgB,oBAAoB,OAA6C;CAC/E,OAAO,sBAAsB,KAAK;AACpC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getCurrentMiniProgramGlobalObject, getCurrentMiniProgramRuntimeCapabilities } from "./platform/current.mjs";
|
|
2
|
+
import { supportsCurrentMiniProgramRuntimeCapability } from "./platform.mjs";
|
|
2
3
|
import { getCurrentInstance } from "./hooks/base.mjs";
|
|
3
4
|
import { onDetached, onUnload } from "./hooks/register.mjs";
|
|
4
5
|
|
|
@@ -11,8 +12,8 @@ function createObserverFromInstance(instance, options) {
|
|
|
11
12
|
}
|
|
12
13
|
function createObserverFromGlobal(instance, options) {
|
|
13
14
|
if (!supportsCurrentMiniProgramRuntimeCapability("globalCreateIntersectionObserver")) return;
|
|
14
|
-
const miniProgramGlobal =
|
|
15
|
-
const creator = miniProgramGlobal
|
|
15
|
+
const miniProgramGlobal = getCurrentMiniProgramGlobalObject();
|
|
16
|
+
const creator = miniProgramGlobal?.createIntersectionObserver;
|
|
16
17
|
if (typeof creator !== "function") return;
|
|
17
18
|
return getCurrentMiniProgramRuntimeCapabilities().intersectionObserverScopeByParameter ? creator.call(miniProgramGlobal, instance, options) : creator.call(miniProgramGlobal, options);
|
|
18
19
|
}
|
|
@@ -23,10 +24,9 @@ function createObserverFromGlobal(instance, options) {
|
|
|
23
24
|
* - 不可用时回退到宿主全局对象的 `createIntersectionObserver(...)`。
|
|
24
25
|
*/
|
|
25
26
|
function useIntersectionObserver(options = {}) {
|
|
26
|
-
var _createObserverFromIn;
|
|
27
27
|
const instance = getCurrentInstance();
|
|
28
28
|
if (!instance) throw new Error("useIntersectionObserver() 必须在 setup() 的同步阶段调用");
|
|
29
|
-
const observer =
|
|
29
|
+
const observer = createObserverFromInstance(instance, options) ?? createObserverFromGlobal(instance, options);
|
|
30
30
|
if (!observer || typeof observer.disconnect !== "function") throw new Error("当前运行环境不支持 IntersectionObserver,请检查基础库版本或平台能力");
|
|
31
31
|
let disconnected = false;
|
|
32
32
|
const disconnect = () => {
|
|
@@ -34,7 +34,7 @@ function useIntersectionObserver(options = {}) {
|
|
|
34
34
|
disconnected = true;
|
|
35
35
|
try {
|
|
36
36
|
observer.disconnect();
|
|
37
|
-
} catch
|
|
37
|
+
} catch {}
|
|
38
38
|
};
|
|
39
39
|
onUnload(disconnect);
|
|
40
40
|
onDetached(disconnect);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"intersectionObserver.mjs","names":[],"sources":["../../../src/runtime/intersectionObserver.ts"],"sourcesContent":["import type {\n InternalRuntimeState,\n MiniProgramIntersectionObserver,\n MiniProgramIntersectionObserverOptions,\n} from './types'\nimport { getCurrentInstance, onDetached, onUnload } from './hooks'\nimport {
|
|
1
|
+
{"version":3,"file":"intersectionObserver.mjs","names":[],"sources":["../../../src/runtime/intersectionObserver.ts"],"sourcesContent":["import type {\n InternalRuntimeState,\n MiniProgramIntersectionObserver,\n MiniProgramIntersectionObserverOptions,\n} from './types'\nimport { getCurrentInstance, onDetached, onUnload } from './hooks'\nimport { getCurrentMiniProgramGlobalObject, getCurrentMiniProgramRuntimeCapabilities, supportsCurrentMiniProgramRuntimeCapability } from './platform'\n\nexport type UseIntersectionObserverOptions = MiniProgramIntersectionObserverOptions\nexport type UseIntersectionObserverResult = MiniProgramIntersectionObserver\n\nfunction createObserverFromInstance(\n instance: InternalRuntimeState,\n options: UseIntersectionObserverOptions,\n): UseIntersectionObserverResult | undefined {\n const nativeInstance = instance as Record<string, any>\n const creator = nativeInstance.createIntersectionObserver\n if (typeof creator !== 'function') {\n return undefined\n }\n const observer = creator.call(nativeInstance, options)\n return observer as UseIntersectionObserverResult | undefined\n}\n\nfunction createObserverFromGlobal(\n instance: InternalRuntimeState,\n options: UseIntersectionObserverOptions,\n): UseIntersectionObserverResult | undefined {\n if (!supportsCurrentMiniProgramRuntimeCapability('globalCreateIntersectionObserver')) {\n return undefined\n }\n const miniProgramGlobal = getCurrentMiniProgramGlobalObject()\n const creator = miniProgramGlobal?.createIntersectionObserver\n if (typeof creator !== 'function') {\n return undefined\n }\n const observer = getCurrentMiniProgramRuntimeCapabilities().intersectionObserverScopeByParameter\n ? creator.call(miniProgramGlobal, instance, options)\n : creator.call(miniProgramGlobal, options)\n return observer as UseIntersectionObserverResult | undefined\n}\n\n/**\n * 在 setup 中创建 IntersectionObserver,并在卸载时自动断开。\n *\n * - 优先使用 `ctx.instance.createIntersectionObserver(options)`。\n * - 不可用时回退到宿主全局对象的 `createIntersectionObserver(...)`。\n */\nexport function useIntersectionObserver(\n options: UseIntersectionObserverOptions = {},\n): UseIntersectionObserverResult {\n const instance = getCurrentInstance()\n if (!instance) {\n throw new Error('useIntersectionObserver() 必须在 setup() 的同步阶段调用')\n }\n\n const observer = createObserverFromInstance(instance, options)\n ?? createObserverFromGlobal(instance, options)\n\n if (!observer || typeof observer.disconnect !== 'function') {\n throw new Error('当前运行环境不支持 IntersectionObserver,请检查基础库版本或平台能力')\n }\n\n let disconnected = false\n const disconnect = () => {\n if (disconnected) {\n return\n }\n disconnected = true\n try {\n observer.disconnect()\n }\n catch {\n // 忽略平台差异导致的断开异常,避免影响页面卸载流程\n }\n }\n\n onUnload(disconnect)\n onDetached(disconnect)\n\n return observer\n}\n"],"mappings":";;;;;;AAWA,SAAS,2BACP,UACA,SAC2C;CAC3C,MAAM,iBAAiB;CACvB,MAAM,UAAU,eAAe;CAC/B,IAAI,OAAO,YAAY,YACrB;CAGF,OADiB,QAAQ,KAAK,gBAAgB,OAChC;AAChB;AAEA,SAAS,yBACP,UACA,SAC2C;CAC3C,IAAI,CAAC,4CAA4C,kCAAkC,GACjF;CAEF,MAAM,oBAAoB,kCAAkC;CAC5D,MAAM,UAAU,mBAAmB;CACnC,IAAI,OAAO,YAAY,YACrB;CAKF,OAHiB,yCAAyC,CAAC,CAAC,uCACxD,QAAQ,KAAK,mBAAmB,UAAU,OAAO,IACjD,QAAQ,KAAK,mBAAmB,OAAO;AAE7C;;;;;;;AAQA,SAAgB,wBACd,UAA0C,CAAC,GACZ;CAC/B,MAAM,WAAW,mBAAmB;CACpC,IAAI,CAAC,UACH,MAAM,IAAI,MAAM,+CAA+C;CAGjE,MAAM,WAAW,2BAA2B,UAAU,OAAO,KACxD,yBAAyB,UAAU,OAAO;CAE/C,IAAI,CAAC,YAAY,OAAO,SAAS,eAAe,YAC9C,MAAM,IAAI,MAAM,8CAA8C;CAGhE,IAAI,eAAe;CACnB,MAAM,mBAAmB;EACvB,IAAI,cACF;EAEF,eAAe;EACf,IAAI;GACF,SAAS,WAAW;EACtB,QACM,CAEN;CACF;CAEA,SAAS,UAAU;CACnB,WAAW,UAAU;CAErB,OAAO;AACT"}
|
|
@@ -13,7 +13,7 @@ function createTextVNode(text) {
|
|
|
13
13
|
return {
|
|
14
14
|
type: "text",
|
|
15
15
|
props: null,
|
|
16
|
-
children: String(text
|
|
16
|
+
children: String(text ?? "")
|
|
17
17
|
};
|
|
18
18
|
}
|
|
19
19
|
function isVNode(value) {
|
|
@@ -43,8 +43,7 @@ const vModelCheckbox = "model-checkbox";
|
|
|
43
43
|
const vModelRadio = "model-radio";
|
|
44
44
|
const vModelSelect = "model-select";
|
|
45
45
|
function withDirectives(vnode, directives) {
|
|
46
|
-
|
|
47
|
-
const props = { ...(_vnode$props = vnode.props) !== null && _vnode$props !== void 0 ? _vnode$props : {} };
|
|
46
|
+
const props = { ...vnode.props ?? {} };
|
|
48
47
|
for (const raw of directives) {
|
|
49
48
|
if (!Array.isArray(raw)) continue;
|
|
50
49
|
const [directive, value, argument] = raw;
|
|
@@ -58,10 +57,7 @@ function withDirectives(vnode, directives) {
|
|
|
58
57
|
props[modelName === "modelValue" ? "value" : modelName] = value;
|
|
59
58
|
if (typeof updater === "function") {
|
|
60
59
|
const eventName = directive === "model-text" ? "onInput" : "onChange";
|
|
61
|
-
props[eventName] = (event) =>
|
|
62
|
-
var _event$detail$value, _event$detail;
|
|
63
|
-
return updater((_event$detail$value = event === null || event === void 0 || (_event$detail = event.detail) === null || _event$detail === void 0 ? void 0 : _event$detail.value) !== null && _event$detail$value !== void 0 ? _event$detail$value : event === null || event === void 0 ? void 0 : event.detail);
|
|
64
|
-
};
|
|
60
|
+
props[eventName] = (event) => updater(event?.detail?.value ?? event?.detail);
|
|
65
61
|
}
|
|
66
62
|
}
|
|
67
63
|
}
|
|
@@ -78,7 +74,7 @@ function eventNameFromProp(name) {
|
|
|
78
74
|
return name.slice(2).toLowerCase();
|
|
79
75
|
}
|
|
80
76
|
function getHandlerMap(target) {
|
|
81
|
-
const existing = target
|
|
77
|
+
const existing = target?.[WEVU_JSX_ISLAND_HANDLER_MAP_KEY];
|
|
82
78
|
if (existing && typeof existing === "object") return existing;
|
|
83
79
|
const next = Object.create(null);
|
|
84
80
|
if (target && (typeof target === "object" || typeof target === "function")) Object.defineProperty(target, WEVU_JSX_ISLAND_HANDLER_MAP_KEY, {
|
|
@@ -101,7 +97,6 @@ function normalizeChildren(value, target, islandId, seed, adapters) {
|
|
|
101
97
|
return node ? [node] : [];
|
|
102
98
|
}
|
|
103
99
|
function normalizeNode(value, target, islandId, seed, adapters) {
|
|
104
|
-
var _value$props3;
|
|
105
100
|
if (value == null || value === false || value === true) return;
|
|
106
101
|
if (Array.isArray(value)) return {
|
|
107
102
|
kind: "fragment",
|
|
@@ -119,27 +114,18 @@ function normalizeNode(value, target, islandId, seed, adapters) {
|
|
|
119
114
|
kind: "fragment",
|
|
120
115
|
children: normalizeChildren(value.children, target, islandId, seed, adapters)
|
|
121
116
|
};
|
|
122
|
-
if (value.type === "text") {
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
}
|
|
129
|
-
if (typeof value.type === "function") {
|
|
130
|
-
var _value$props;
|
|
131
|
-
return normalizeNode(value.type((_value$props = value.props) !== null && _value$props !== void 0 ? _value$props : {}, value.children), target, islandId, seed, adapters);
|
|
132
|
-
}
|
|
133
|
-
if (value.type && typeof value.type === "object" && typeof value.type.render === "function") {
|
|
134
|
-
var _value$props2;
|
|
135
|
-
return normalizeNode(value.type.render.call((_value$props2 = value.props) !== null && _value$props2 !== void 0 ? _value$props2 : {}), target, islandId, seed, adapters);
|
|
136
|
-
}
|
|
117
|
+
if (value.type === "text") return {
|
|
118
|
+
kind: "text",
|
|
119
|
+
text: String(value.children ?? "")
|
|
120
|
+
};
|
|
121
|
+
if (typeof value.type === "function") return normalizeNode(value.type(value.props ?? {}, value.children), target, islandId, seed, adapters);
|
|
122
|
+
if (value.type && typeof value.type === "object" && typeof value.type.render === "function") return normalizeNode(value.type.render.call(value.props ?? {}), target, islandId, seed, adapters);
|
|
137
123
|
const tag = typeof value.type === "string" ? value.type : void 0;
|
|
138
124
|
if (!tag) return;
|
|
139
125
|
const props = {};
|
|
140
126
|
const events = {};
|
|
141
127
|
const handlers = getHandlerMap(target);
|
|
142
|
-
for (const [name, raw] of Object.entries(
|
|
128
|
+
for (const [name, raw] of Object.entries(value.props ?? {})) {
|
|
143
129
|
const eventName = eventNameFromProp(name);
|
|
144
130
|
if (eventName && typeof raw === "function") {
|
|
145
131
|
const handlerId = `${islandId}:${seed.value++}`;
|
|
@@ -161,19 +147,16 @@ function normalizeNode(value, target, islandId, seed, adapters) {
|
|
|
161
147
|
};
|
|
162
148
|
}
|
|
163
149
|
function normalizeJsxIsland(value, islandId, adapters) {
|
|
164
|
-
var _normalizeNode;
|
|
165
150
|
const handlers = getHandlerMap(this);
|
|
166
151
|
for (const key of Object.keys(handlers)) if (key.startsWith(`${islandId}:`)) delete handlers[key];
|
|
167
|
-
return
|
|
152
|
+
return normalizeNode(value, this, islandId, { value: 0 }, adapters) ?? null;
|
|
168
153
|
}
|
|
169
154
|
function runJsxIslandHandler(target, event) {
|
|
170
|
-
|
|
171
|
-
const handlerId = (_event$currentTarget$ = event === null || event === void 0 || (_event$currentTarget = event.currentTarget) === null || _event$currentTarget === void 0 || (_event$currentTarget = _event$currentTarget.dataset) === null || _event$currentTarget === void 0 ? void 0 : _event$currentTarget.wvJsxHandler) !== null && _event$currentTarget$ !== void 0 ? _event$currentTarget$ : event === null || event === void 0 || (_event$target = event.target) === null || _event$target === void 0 || (_event$target = _event$target.dataset) === null || _event$target === void 0 ? void 0 : _event$target.wvJsxHandler;
|
|
155
|
+
const handlerId = event?.currentTarget?.dataset?.wvJsxHandler ?? event?.target?.dataset?.wvJsxHandler;
|
|
172
156
|
if (typeof handlerId !== "string" || !handlerId) return;
|
|
173
|
-
const runtime = target
|
|
174
|
-
const
|
|
175
|
-
|
|
176
|
-
return typeof handler === "function" ? handler.call((_runtime$proxy2 = runtime === null || runtime === void 0 ? void 0 : runtime.proxy) !== null && _runtime$proxy2 !== void 0 ? _runtime$proxy2 : target, event) : void 0;
|
|
157
|
+
const runtime = target?.__wevu;
|
|
158
|
+
const handler = (target?.[WEVU_JSX_ISLAND_HANDLER_MAP_KEY] ?? runtime?.proxy?.[WEVU_JSX_ISLAND_HANDLER_MAP_KEY])?.[handlerId];
|
|
159
|
+
return typeof handler === "function" ? handler.call(runtime?.proxy ?? target, event) : void 0;
|
|
177
160
|
}
|
|
178
161
|
|
|
179
162
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jsxIsland.mjs","names":["slots"],"sources":["../../../src/runtime/jsxIsland.ts"],"sourcesContent":["import type { WevuJsxVNode } from '../jsxTypes'\nimport { WEVU_JSX_ISLAND_HANDLER_MAP_KEY } from '@weapp-core/constants'\n\nexport const Fragment = Symbol.for('wevu.jsx.fragment')\n\nexport interface WevuJsxIslandNode {\n children?: WevuJsxIslandNode[]\n events?: Record<string, string>\n kind: 'element' | 'fragment' | 'text'\n props?: Record<string, any>\n tag?: string\n text?: string\n}\n\nexport interface WevuJsxIslandAdapters {\n normalizeClass: (value: unknown) => string\n normalizeStyle: (value: unknown) => string\n}\n\nexport function createVNode(type: unknown, props?: Record<string, any> | null, children?: unknown): WevuJsxVNode {\n return { type, props, children }\n}\n\nexport function createTextVNode(text: unknown): WevuJsxVNode {\n return { type: 'text', props: null, children: String(text ?? '') }\n}\n\nexport function isVNode(value: unknown): value is WevuJsxVNode {\n return !!value && typeof value === 'object' && 'type' in value\n}\n\nexport function mergeProps(...sources: Array<Record<string, any> | null | undefined>) {\n const output: Record<string, any> = {}\n for (const source of sources) {\n if (!source) {\n continue\n }\n for (const [key, value] of Object.entries(source)) {\n if (key === 'class' && output.class) {\n output.class = [output.class, value]\n }\n else if (key === 'style' && output.style) {\n output.style = [output.style, value]\n }\n else {\n output[key] = value\n }\n }\n }\n return output\n}\n\nexport function transformOn(events: Record<string, unknown>) {\n const output: Record<string, unknown> = {}\n for (const [name, handler] of Object.entries(events)) {\n output[`on${name.charAt(0).toUpperCase()}${name.slice(1)}`] = handler\n }\n return output\n}\n\nexport function resolveComponent(name: string) {\n return name\n}\n\nexport const vShow = 'show'\nexport const vModelText = 'model-text'\nexport const vModelCheckbox = 'model-checkbox'\nexport const vModelRadio = 'model-radio'\nexport const vModelSelect = 'model-select'\n\nexport function withDirectives(vnode: WevuJsxVNode, directives: unknown[]) {\n const props = { ...(vnode.props ?? {}) }\n for (const raw of directives) {\n if (!Array.isArray(raw)) {\n continue\n }\n const [directive, value, argument] = raw\n if (directive === vShow) {\n props.hidden = !value\n continue\n }\n if (\n directive === vModelText\n || directive === vModelCheckbox\n || directive === vModelRadio\n || directive === vModelSelect\n ) {\n const modelName = typeof argument === 'string' && argument ? argument : 'modelValue'\n const updater = props[`onUpdate:${modelName}`]\n props[modelName === 'modelValue' ? 'value' : modelName] = value\n if (typeof updater === 'function') {\n const eventName = directive === vModelText ? 'onInput' : 'onChange'\n props[eventName] = (event: any) => updater(event?.detail?.value ?? event?.detail)\n }\n }\n }\n return { ...vnode, props }\n}\n\nexport function resolveDirective(name: string) {\n return name\n}\n\nfunction eventNameFromProp(name: string) {\n if (!/^on[A-Z]/.test(name)) {\n return undefined\n }\n return name.slice(2).toLowerCase()\n}\n\nfunction getHandlerMap(target: any): Record<string, (...args: any[]) => any> {\n const existing = target?.[WEVU_JSX_ISLAND_HANDLER_MAP_KEY]\n if (existing && typeof existing === 'object') {\n return existing\n }\n const next: Record<string, (...args: any[]) => any> = Object.create(null)\n if (target && (typeof target === 'object' || typeof target === 'function')) {\n Object.defineProperty(target, WEVU_JSX_ISLAND_HANDLER_MAP_KEY, {\n value: next,\n configurable: true,\n writable: true,\n })\n }\n return next\n}\n\nfunction normalizeChildren(\n value: unknown,\n target: any,\n islandId: string,\n seed: { value: number },\n adapters: WevuJsxIslandAdapters,\n): WevuJsxIslandNode[] {\n const resolved = typeof value === 'function' ? value() : value\n if (resolved == null || resolved === false || resolved === true) {\n return []\n }\n if (Array.isArray(resolved)) {\n const children: WevuJsxIslandNode[] = []\n for (const item of resolved) {\n children.push(...normalizeChildren(item, target, islandId, seed, adapters))\n }\n return children\n }\n if (typeof resolved === 'object' && !isVNode(resolved)) {\n const slots = resolved as Record<string, unknown>\n return normalizeChildren(slots.default, target, islandId, seed, adapters)\n }\n // eslint-disable-next-line ts/no-use-before-define\n const node = normalizeNode(resolved, target, islandId, seed, adapters)\n return node ? [node] : []\n}\n\nfunction normalizeNode(\n value: unknown,\n target: any,\n islandId: string,\n seed: { value: number },\n adapters: WevuJsxIslandAdapters,\n): WevuJsxIslandNode | undefined {\n if (value == null || value === false || value === true) {\n return undefined\n }\n if (Array.isArray(value)) {\n return { kind: 'fragment', children: normalizeChildren(value, target, islandId, seed, adapters) }\n }\n if (typeof value === 'string' || typeof value === 'number') {\n return { kind: 'text', text: String(value) }\n }\n if (!isVNode(value)) {\n return { kind: 'text', text: String(value) }\n }\n if (value.type === Fragment) {\n return { kind: 'fragment', children: normalizeChildren(value.children, target, islandId, seed, adapters) }\n }\n if (value.type === 'text') {\n return { kind: 'text', text: String(value.children ?? '') }\n }\n if (typeof value.type === 'function') {\n return normalizeNode(value.type(value.props ?? {}, value.children), target, islandId, seed, adapters)\n }\n if (value.type && typeof value.type === 'object' && typeof (value.type as any).render === 'function') {\n return normalizeNode((value.type as any).render.call(value.props ?? {}), target, islandId, seed, adapters)\n }\n const tag = typeof value.type === 'string' ? value.type : undefined\n if (!tag) {\n return undefined\n }\n\n const props: Record<string, any> = {}\n const events: Record<string, string> = {}\n const handlers = getHandlerMap(target)\n for (const [name, raw] of Object.entries(value.props ?? {})) {\n const eventName = eventNameFromProp(name)\n if (eventName && typeof raw === 'function') {\n const handlerId = `${islandId}:${seed.value++}`\n handlers[handlerId] = raw as unknown as (...args: unknown[]) => unknown\n events[eventName] = handlerId\n continue\n }\n if (typeof raw === 'function' || raw === undefined) {\n continue\n }\n if (name === 'class' || name === 'className') {\n props.class = adapters.normalizeClass(raw)\n }\n else if (name === 'style') {\n props.style = adapters.normalizeStyle(raw)\n }\n else {\n props[name] = raw\n }\n }\n return {\n kind: 'element',\n tag,\n props,\n events,\n children: normalizeChildren(value.children, target, islandId, seed, adapters),\n }\n}\n\nexport function normalizeJsxIsland(\n this: any,\n value: unknown,\n islandId: string,\n adapters: WevuJsxIslandAdapters,\n): WevuJsxIslandNode | null {\n const handlers = getHandlerMap(this)\n for (const key of Object.keys(handlers)) {\n if (key.startsWith(`${islandId}:`)) {\n delete handlers[key]\n }\n }\n return normalizeNode(value, this, islandId, { value: 0 }, adapters) ?? null\n}\n\nexport function runJsxIslandHandler(target: any, event: any) {\n const handlerId = event?.currentTarget?.dataset?.wvJsxHandler ?? event?.target?.dataset?.wvJsxHandler\n if (typeof handlerId !== 'string' || !handlerId) {\n return undefined\n }\n const runtime = target?.__wevu\n const handlers = target?.[WEVU_JSX_ISLAND_HANDLER_MAP_KEY]\n ?? runtime?.proxy?.[WEVU_JSX_ISLAND_HANDLER_MAP_KEY]\n const handler = handlers?.[handlerId]\n return typeof handler === 'function' ? handler.call(runtime?.proxy ?? target, event) : undefined\n}\n"],"mappings":";;;AAGA,MAAa,WAAW,OAAO,IAAI,mBAAmB;AAgBtD,SAAgB,YAAY,MAAe,OAAoC,UAAkC;CAC/G,OAAO;EAAE;EAAM;EAAO;CAAS;AACj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AAC,GAAG;EAC3D,MAAM,YAAY,kBAAkB,IAAI;EACxC,IAAI,aAAa,OAAO,QAAQ,YAAY;GAC1C,MAAM,YAAY,GAAG,SAAS,GAAG,KAAK;GACtC,SAAS,aAAa;GACtB,OAAO,aAAa;GACpB;EACF;EACA,IAAI,OAAO,QAAQ,cAAc,QAAQ,QACvC;EAEF,IAAI,SAAS,WAAW,SAAS,aAC/B,MAAM,QAAQ,SAAS,eAAe,GAAG;OAEtC,IAAI,SAAS,SAChB,MAAM,QAAQ,SAAS,eAAe,GAAG;OAGzC,MAAM,QAAQ;CAElB;CACA,OAAO;EACL,MAAM;EACN;EACA;EACA;EACA,UAAU,kBAAkB,MAAM,UAAU,QAAQ,UAAU,MAAM,QAAQ;CAC9E;AACF;AAEA,SAAgB,mBAEd,OACA,UACA,UAC0B;;CAC1B,MAAM,WAAW,cAAc,IAAI;CACnC,KAAK,MAAM,OAAO,OAAO,KAAK,QAAQ,GACpC,IAAI,IAAI,WAAW,GAAG,SAAS,EAAE,GAC/B,OAAO,SAAS;CAGpB,yBAAO,cAAc,OAAO,MAAM,UAAU,EAAE,OAAO,EAAE,GAAG,QAAQ,4DAAK;AACzE;AAEA,SAAgB,oBAAoB,QAAa,OAAY;;CAC3D,MAAM,mGAAY,MAAO,2GAAe,qFAAS,4IAAgB,MAAO,+EAAQ,uEAAS;CACzF,IAAI,OAAO,cAAc,YAAY,CAAC,WACpC;CAEF,MAAM,0DAAU,OAAQ;CACxB,MAAM,oFAAW,OAAS,qKACrB,QAAS,uEAAQ;CACtB,MAAM,8DAAU,SAAW;CAC3B,OAAO,OAAO,YAAY,aAAa,QAAQ,0EAAK,QAAS,kEAAS,QAAQ,KAAK,IAAI;AACzF"}
|
|
1
|
+
{"version":3,"file":"jsxIsland.mjs","names":["slots"],"sources":["../../../src/runtime/jsxIsland.ts"],"sourcesContent":["import type { WevuJsxVNode } from '../jsxTypes'\nimport { WEVU_JSX_ISLAND_HANDLER_MAP_KEY } from '@weapp-core/constants'\n\nexport const Fragment = Symbol.for('wevu.jsx.fragment')\n\nexport interface WevuJsxIslandNode {\n children?: WevuJsxIslandNode[]\n events?: Record<string, string>\n kind: 'element' | 'fragment' | 'text'\n props?: Record<string, any>\n tag?: string\n text?: string\n}\n\nexport interface WevuJsxIslandAdapters {\n normalizeClass: (value: unknown) => string\n normalizeStyle: (value: unknown) => string\n}\n\nexport function createVNode(type: unknown, props?: Record<string, any> | null, children?: unknown): WevuJsxVNode {\n return { type, props, children }\n}\n\nexport function createTextVNode(text: unknown): WevuJsxVNode {\n return { type: 'text', props: null, children: String(text ?? '') }\n}\n\nexport function isVNode(value: unknown): value is WevuJsxVNode {\n return !!value && typeof value === 'object' && 'type' in value\n}\n\nexport function mergeProps(...sources: Array<Record<string, any> | null | undefined>) {\n const output: Record<string, any> = {}\n for (const source of sources) {\n if (!source) {\n continue\n }\n for (const [key, value] of Object.entries(source)) {\n if (key === 'class' && output.class) {\n output.class = [output.class, value]\n }\n else if (key === 'style' && output.style) {\n output.style = [output.style, value]\n }\n else {\n output[key] = value\n }\n }\n }\n return output\n}\n\nexport function transformOn(events: Record<string, unknown>) {\n const output: Record<string, unknown> = {}\n for (const [name, handler] of Object.entries(events)) {\n output[`on${name.charAt(0).toUpperCase()}${name.slice(1)}`] = handler\n }\n return output\n}\n\nexport function resolveComponent(name: string) {\n return name\n}\n\nexport const vShow = 'show'\nexport const vModelText = 'model-text'\nexport const vModelCheckbox = 'model-checkbox'\nexport const vModelRadio = 'model-radio'\nexport const vModelSelect = 'model-select'\n\nexport function withDirectives(vnode: WevuJsxVNode, directives: unknown[]) {\n const props = { ...(vnode.props ?? {}) }\n for (const raw of directives) {\n if (!Array.isArray(raw)) {\n continue\n }\n const [directive, value, argument] = raw\n if (directive === vShow) {\n props.hidden = !value\n continue\n }\n if (\n directive === vModelText\n || directive === vModelCheckbox\n || directive === vModelRadio\n || directive === vModelSelect\n ) {\n const modelName = typeof argument === 'string' && argument ? argument : 'modelValue'\n const updater = props[`onUpdate:${modelName}`]\n props[modelName === 'modelValue' ? 'value' : modelName] = value\n if (typeof updater === 'function') {\n const eventName = directive === vModelText ? 'onInput' : 'onChange'\n props[eventName] = (event: any) => updater(event?.detail?.value ?? event?.detail)\n }\n }\n }\n return { ...vnode, props }\n}\n\nexport function resolveDirective(name: string) {\n return name\n}\n\nfunction eventNameFromProp(name: string) {\n if (!/^on[A-Z]/.test(name)) {\n return undefined\n }\n return name.slice(2).toLowerCase()\n}\n\nfunction getHandlerMap(target: any): Record<string, (...args: any[]) => any> {\n const existing = target?.[WEVU_JSX_ISLAND_HANDLER_MAP_KEY]\n if (existing && typeof existing === 'object') {\n return existing\n }\n const next: Record<string, (...args: any[]) => any> = Object.create(null)\n if (target && (typeof target === 'object' || typeof target === 'function')) {\n Object.defineProperty(target, WEVU_JSX_ISLAND_HANDLER_MAP_KEY, {\n value: next,\n configurable: true,\n writable: true,\n })\n }\n return next\n}\n\nfunction normalizeChildren(\n value: unknown,\n target: any,\n islandId: string,\n seed: { value: number },\n adapters: WevuJsxIslandAdapters,\n): WevuJsxIslandNode[] {\n const resolved = typeof value === 'function' ? value() : value\n if (resolved == null || resolved === false || resolved === true) {\n return []\n }\n if (Array.isArray(resolved)) {\n const children: WevuJsxIslandNode[] = []\n for (const item of resolved) {\n children.push(...normalizeChildren(item, target, islandId, seed, adapters))\n }\n return children\n }\n if (typeof resolved === 'object' && !isVNode(resolved)) {\n const slots = resolved as Record<string, unknown>\n return normalizeChildren(slots.default, target, islandId, seed, adapters)\n }\n // eslint-disable-next-line ts/no-use-before-define\n const node = normalizeNode(resolved, target, islandId, seed, adapters)\n return node ? [node] : []\n}\n\nfunction normalizeNode(\n value: unknown,\n target: any,\n islandId: string,\n seed: { value: number },\n adapters: WevuJsxIslandAdapters,\n): WevuJsxIslandNode | undefined {\n if (value == null || value === false || value === true) {\n return undefined\n }\n if (Array.isArray(value)) {\n return { kind: 'fragment', children: normalizeChildren(value, target, islandId, seed, adapters) }\n }\n if (typeof value === 'string' || typeof value === 'number') {\n return { kind: 'text', text: String(value) }\n }\n if (!isVNode(value)) {\n return { kind: 'text', text: String(value) }\n }\n if (value.type === Fragment) {\n return { kind: 'fragment', children: normalizeChildren(value.children, target, islandId, seed, adapters) }\n }\n if (value.type === 'text') {\n return { kind: 'text', text: String(value.children ?? '') }\n }\n if (typeof value.type === 'function') {\n return normalizeNode(value.type(value.props ?? {}, value.children), target, islandId, seed, adapters)\n }\n if (value.type && typeof value.type === 'object' && typeof (value.type as any).render === 'function') {\n return normalizeNode((value.type as any).render.call(value.props ?? {}), target, islandId, seed, adapters)\n }\n const tag = typeof value.type === 'string' ? value.type : undefined\n if (!tag) {\n return undefined\n }\n\n const props: Record<string, any> = {}\n const events: Record<string, string> = {}\n const handlers = getHandlerMap(target)\n for (const [name, raw] of Object.entries(value.props ?? {})) {\n const eventName = eventNameFromProp(name)\n if (eventName && typeof raw === 'function') {\n const handlerId = `${islandId}:${seed.value++}`\n handlers[handlerId] = raw as unknown as (...args: unknown[]) => unknown\n events[eventName] = handlerId\n continue\n }\n if (typeof raw === 'function' || raw === undefined) {\n continue\n }\n if (name === 'class' || name === 'className') {\n props.class = adapters.normalizeClass(raw)\n }\n else if (name === 'style') {\n props.style = adapters.normalizeStyle(raw)\n }\n else {\n props[name] = raw\n }\n }\n return {\n kind: 'element',\n tag,\n props,\n events,\n children: normalizeChildren(value.children, target, islandId, seed, adapters),\n }\n}\n\nexport function normalizeJsxIsland(\n this: any,\n value: unknown,\n islandId: string,\n adapters: WevuJsxIslandAdapters,\n): WevuJsxIslandNode | null {\n const handlers = getHandlerMap(this)\n for (const key of Object.keys(handlers)) {\n if (key.startsWith(`${islandId}:`)) {\n delete handlers[key]\n }\n }\n return normalizeNode(value, this, islandId, { value: 0 }, adapters) ?? null\n}\n\nexport function runJsxIslandHandler(target: any, event: any) {\n const handlerId = event?.currentTarget?.dataset?.wvJsxHandler ?? event?.target?.dataset?.wvJsxHandler\n if (typeof handlerId !== 'string' || !handlerId) {\n return undefined\n }\n const runtime = target?.__wevu\n const handlers = target?.[WEVU_JSX_ISLAND_HANDLER_MAP_KEY]\n ?? runtime?.proxy?.[WEVU_JSX_ISLAND_HANDLER_MAP_KEY]\n const handler = handlers?.[handlerId]\n return typeof handler === 'function' ? handler.call(runtime?.proxy ?? target, event) : undefined\n}\n"],"mappings":";;;AAGA,MAAa,WAAW,OAAO,IAAI,mBAAmB;AAgBtD,SAAgB,YAAY,MAAe,OAAoC,UAAkC;CAC/G,OAAO;EAAE;EAAM;EAAO;CAAS;AACjC;AAEA,SAAgB,gBAAgB,MAA6B;CAC3D,OAAO;EAAE,MAAM;EAAQ,OAAO;EAAM,UAAU,OAAO,QAAQ,EAAE;CAAE;AACnE;AAEA,SAAgB,QAAQ,OAAuC;CAC7D,OAAO,CAAC,CAAC,SAAS,OAAO,UAAU,YAAY,UAAU;AAC3D;AAEA,SAAgB,WAAW,GAAG,SAAwD;CACpF,MAAM,SAA8B,CAAC;CACrC,KAAK,MAAM,UAAU,SAAS;EAC5B,IAAI,CAAC,QACH;EAEF,KAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,MAAM,GAC9C,IAAI,QAAQ,WAAW,OAAO,OAC5B,OAAO,QAAQ,CAAC,OAAO,OAAO,KAAK;OAEhC,IAAI,QAAQ,WAAW,OAAO,OACjC,OAAO,QAAQ,CAAC,OAAO,OAAO,KAAK;OAGnC,OAAO,OAAO;CAGpB;CACA,OAAO;AACT;AAEA,SAAgB,YAAY,QAAiC;CAC3D,MAAM,SAAkC,CAAC;CACzC,KAAK,MAAM,CAAC,MAAM,YAAY,OAAO,QAAQ,MAAM,GACjD,OAAO,KAAK,KAAK,OAAO,CAAC,CAAC,CAAC,YAAY,IAAI,KAAK,MAAM,CAAC,OAAO;CAEhE,OAAO;AACT;AAEA,SAAgB,iBAAiB,MAAc;CAC7C,OAAO;AACT;AAEA,MAAa,QAAQ;AACrB,MAAa,aAAa;AAC1B,MAAa,iBAAiB;AAC9B,MAAa,cAA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