@weapp-vite/web 2.0.0 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_virtual/_rolldown/runtime.mjs +1 -2
- package/dist/compiler/wxml/attributes.mjs +12 -4
- package/dist/compiler/wxml/attributes.mjs.map +1 -1
- package/dist/compiler/wxml/compile.mjs +33 -39
- package/dist/compiler/wxml/compile.mjs.map +1 -1
- package/dist/compiler/wxml/dependency.mjs +10 -3
- package/dist/compiler/wxml/dependency.mjs.map +1 -1
- package/dist/compiler/wxml/interpolation.mjs +13 -3
- package/dist/compiler/wxml/interpolation.mjs.map +1 -1
- package/dist/compiler/wxml/nativeTags.mjs +60 -0
- package/dist/compiler/wxml/nativeTags.mjs.map +1 -0
- package/dist/compiler/wxml/navigation.mjs +1 -2
- package/dist/compiler/wxml/parser.mjs +1 -2
- package/dist/compiler/wxml/prepare.mjs +42 -0
- package/dist/compiler/wxml/prepare.mjs.map +1 -0
- package/dist/compiler/wxml/renderer.mjs +1 -2
- package/dist/compiler/wxml/specialNodes.mjs +1 -2
- package/dist/compiler/wxml/types.d.mts +0 -2
- package/dist/compiler/wxml/unknownTags.mjs +33 -0
- package/dist/compiler/wxml/unknownTags.mjs.map +1 -0
- package/dist/compiler/wxs.mjs +1 -2
- package/dist/css/wxss.d.mts +2 -19
- package/dist/css/wxss.mjs +5 -12
- package/dist/css/wxss.mjs.map +1 -1
- package/dist/index.d.mts +8 -3
- package/dist/index.mjs +8 -5
- package/dist/plugin/assets.d.mts +1 -2
- package/dist/plugin/assets.mjs +1 -2
- package/dist/plugin/constants.mjs +5 -4
- package/dist/plugin/constants.mjs.map +1 -1
- package/dist/plugin/dependencyScan.mjs +1 -2
- package/dist/plugin/entry.mjs +6 -4
- package/dist/plugin/entry.mjs.map +1 -1
- package/dist/plugin/files.mjs +1 -2
- package/dist/plugin/hostTypes.d.mts +1 -2
- package/dist/plugin/index.d.mts +0 -2
- package/dist/plugin/index.mjs +29 -24
- package/dist/plugin/index.mjs.map +1 -1
- package/dist/plugin/layout.mjs +1 -2
- package/dist/plugin/navigation.mjs +1 -2
- package/dist/plugin/packageResolution.mjs +1 -2
- package/dist/plugin/path.mjs +1 -2
- package/dist/plugin/register.mjs +1 -2
- package/dist/plugin/scan.mjs +1 -2
- package/dist/plugin/scanConfig.mjs +1 -2
- package/dist/plugin/scanSfc.mjs +1 -2
- package/dist/plugin/sfcHmr.mjs +28 -10
- package/dist/plugin/sfcHmr.mjs.map +1 -1
- package/dist/plugin/state.mjs +1 -2
- package/dist/plugin/styleModule.mjs +1 -2
- package/dist/plugin/types.d.mts +2 -3
- package/dist/plugin/vueSfc.mjs +1 -2
- package/dist/runtime/appShell/container.mjs +1 -2
- package/dist/runtime/appShell/tabBar/index.mjs +1 -2
- package/dist/runtime/appShell/tabBar/style.mjs +1 -2
- package/dist/runtime/appStyle.mjs +1 -2
- package/dist/runtime/button/helpers.mjs +1 -2
- package/dist/runtime/button/index.d.mts +0 -2
- package/dist/runtime/button/index.mjs +1 -2
- package/dist/runtime/button/style.mjs +1 -2
- package/dist/runtime/component/behavior.mjs +1 -2
- package/dist/runtime/component/constants.mjs +1 -2
- package/dist/runtime/component/dom.mjs +1 -2
- package/dist/runtime/component/element.mjs +9 -2
- package/dist/runtime/component/element.mjs.map +1 -1
- package/dist/runtime/component/events.mjs +4 -4
- package/dist/runtime/component/events.mjs.map +1 -1
- package/dist/runtime/component/index.d.mts +0 -2
- package/dist/runtime/component/index.mjs +1 -2
- package/dist/runtime/component/observers.mjs +1 -2
- package/dist/runtime/component/publicInstance.mjs +1 -2
- package/dist/runtime/component/relations.mjs +1 -2
- package/dist/runtime/component/slots.mjs +1 -2
- package/dist/runtime/component/state.mjs +1 -2
- package/dist/runtime/component/types.d.mts +0 -2
- package/dist/runtime/component/utils.mjs +1 -2
- package/dist/runtime/component/virtualHost.mjs +1 -2
- package/dist/runtime/componentEvents.mjs +1 -2
- package/dist/runtime/dataset.mjs +49 -0
- package/dist/runtime/dataset.mjs.map +1 -0
- package/dist/runtime/datasetBinding.d.mts +13 -0
- package/dist/runtime/datasetBinding.mjs +40 -0
- package/dist/runtime/datasetBinding.mjs.map +1 -0
- package/dist/runtime/eventBinding.d.mts +1 -2
- package/dist/runtime/eventBinding.mjs +1 -2
- package/dist/runtime/execution.d.mts +0 -2
- package/dist/runtime/execution.mjs +1 -2
- package/dist/runtime/host/index.d.mts +0 -2
- package/dist/runtime/host/index.mjs +1 -2
- package/dist/runtime/host/types.d.mts +0 -2
- package/dist/runtime/hostGlobals.d.mts +1 -2
- package/dist/runtime/hostGlobals.mjs +1 -2
- package/dist/runtime/index.d.mts +8 -3
- package/dist/runtime/index.mjs +9 -7
- package/dist/runtime/index.mjs.map +1 -1
- package/dist/runtime/inlineStyle.d.mts +5 -0
- package/dist/runtime/inlineStyle.mjs +21 -0
- package/dist/runtime/inlineStyle.mjs.map +1 -0
- package/dist/runtime/inputHandlerResult.mjs +1 -2
- package/dist/runtime/legacyTemplate/dataset.mjs +53 -0
- package/dist/runtime/legacyTemplate/dataset.mjs.map +1 -0
- package/dist/runtime/legacyTemplate/dom.mjs +20 -5
- package/dist/runtime/legacyTemplate/dom.mjs.map +1 -1
- package/dist/runtime/legacyTemplate/expression.mjs +1 -2
- package/dist/runtime/legacyTemplate/index.d.mts +0 -2
- package/dist/runtime/legacyTemplate/index.mjs +23 -16
- package/dist/runtime/legacyTemplate/index.mjs.map +1 -1
- package/dist/runtime/legacyTemplate/types.d.mts +0 -2
- package/dist/runtime/nativeComponents/canvas/index.mjs +1 -2
- package/dist/runtime/nativeComponents/checkbox.mjs +1 -2
- package/dist/runtime/nativeComponents/cover/index.mjs +1 -2
- package/dist/runtime/nativeComponents/form.d.mts +0 -2
- package/dist/runtime/nativeComponents/form.mjs +1 -2
- package/dist/runtime/nativeComponents/formControl.mjs +1 -2
- package/dist/runtime/nativeComponents/helpers.mjs +1 -2
- package/dist/runtime/nativeComponents/icon/helpers.mjs +1 -2
- package/dist/runtime/nativeComponents/icon/index.mjs +1 -2
- package/dist/runtime/nativeComponents/icon/style.mjs +1 -2
- package/dist/runtime/nativeComponents/image.d.mts +0 -2
- package/dist/runtime/nativeComponents/image.mjs +1 -2
- package/dist/runtime/nativeComponents/index.d.mts +1 -3
- package/dist/runtime/nativeComponents/index.mjs +3 -4
- package/dist/runtime/nativeComponents/index.mjs.map +1 -1
- package/dist/runtime/nativeComponents/input.d.mts +0 -2
- package/dist/runtime/nativeComponents/input.mjs +1 -2
- package/dist/runtime/nativeComponents/label.mjs +1 -2
- package/dist/runtime/nativeComponents/mediaRegistry.mjs +1 -2
- package/dist/runtime/nativeComponents/movable/helpers.mjs +1 -2
- package/dist/runtime/nativeComponents/movable/index.mjs +1 -2
- package/dist/runtime/nativeComponents/navigator.mjs +1 -2
- package/dist/runtime/nativeComponents/picker/editors.mjs +1 -2
- package/dist/runtime/nativeComponents/picker/helpers.mjs +1 -2
- package/dist/runtime/nativeComponents/picker/index.mjs +1 -2
- package/dist/runtime/nativeComponents/picker/style.mjs +1 -2
- package/dist/runtime/nativeComponents/pickerView/column.mjs +1 -2
- package/dist/runtime/nativeComponents/pickerView/helpers.mjs +1 -2
- package/dist/runtime/nativeComponents/pickerView/index.mjs +1 -2
- package/dist/runtime/nativeComponents/pickerView/style.mjs +1 -2
- package/dist/runtime/nativeComponents/primitives.mjs +1 -2
- package/dist/runtime/nativeComponents/progress/helpers.mjs +1 -2
- package/dist/runtime/nativeComponents/progress/index.mjs +1 -2
- package/dist/runtime/nativeComponents/progress/style.mjs +1 -2
- package/dist/runtime/nativeComponents/radio.mjs +1 -2
- package/dist/runtime/nativeComponents/richText/index.mjs +3 -4
- package/dist/runtime/nativeComponents/richText/index.mjs.map +1 -1
- package/dist/runtime/nativeComponents/scrollView/boundaries.mjs +62 -0
- package/dist/runtime/nativeComponents/scrollView/boundaries.mjs.map +1 -0
- package/dist/runtime/nativeComponents/{scrollView.d.mts → scrollView/helpers.d.mts} +4 -5
- package/dist/runtime/nativeComponents/scrollView/helpers.mjs +14 -0
- package/dist/runtime/nativeComponents/scrollView/helpers.mjs.map +1 -0
- package/dist/runtime/nativeComponents/scrollView/index.mjs +193 -0
- package/dist/runtime/nativeComponents/scrollView/index.mjs.map +1 -0
- package/dist/runtime/nativeComponents/scrollView/position.mjs +43 -0
- package/dist/runtime/nativeComponents/scrollView/position.mjs.map +1 -0
- package/dist/runtime/nativeComponents/slider/helpers.mjs +1 -2
- package/dist/runtime/nativeComponents/slider/index.mjs +1 -2
- package/dist/runtime/nativeComponents/slider/style.mjs +1 -2
- package/dist/runtime/nativeComponents/style.mjs +1 -2
- package/dist/runtime/nativeComponents/swiper/helpers.mjs +1 -2
- package/dist/runtime/nativeComponents/swiper/index.mjs +1 -2
- package/dist/runtime/nativeComponents/swiper/item.mjs +1 -2
- package/dist/runtime/nativeComponents/swiper/style.mjs +1 -2
- package/dist/runtime/nativeComponents/switch.d.mts +0 -2
- package/dist/runtime/nativeComponents/switch.mjs +1 -2
- package/dist/runtime/nativeComponents/textarea.d.mts +0 -2
- package/dist/runtime/nativeComponents/textarea.mjs +1 -2
- package/dist/runtime/nativeComponents/video/helpers.d.mts +0 -2
- package/dist/runtime/nativeComponents/video/helpers.mjs +1 -2
- package/dist/runtime/nativeComponents/video/index.mjs +1 -2
- package/dist/runtime/nativeComponents/video/style.mjs +1 -2
- package/dist/runtime/navigationBar/index.d.mts +0 -2
- package/dist/runtime/navigationBar/index.mjs +1 -2
- package/dist/runtime/navigationBar/style.mjs +1 -2
- package/dist/runtime/pageLayout.d.mts +1 -2
- package/dist/runtime/pageLayout.mjs +1 -2
- package/dist/runtime/polyfill/ad.mjs +1 -2
- package/dist/runtime/polyfill/animation.mjs +1 -2
- package/dist/runtime/polyfill/appState.mjs +1 -2
- package/dist/runtime/polyfill/async.d.mts +0 -2
- package/dist/runtime/polyfill/async.mjs +1 -2
- package/dist/runtime/polyfill/auth.mjs +1 -2
- package/dist/runtime/polyfill/authApi.mjs +1 -2
- package/dist/runtime/polyfill/background.mjs +1 -2
- package/dist/runtime/polyfill/canvasContext.mjs +1 -2
- package/dist/runtime/polyfill/capability.mjs +1 -2
- package/dist/runtime/polyfill/cloud.mjs +1 -2
- package/dist/runtime/polyfill/device.mjs +1 -2
- package/dist/runtime/polyfill/deviceApi.mjs +1 -2
- package/dist/runtime/polyfill/deviceAuthSystemApi.d.mts +0 -2
- package/dist/runtime/polyfill/deviceAuthSystemApi.mjs +1 -2
- package/dist/runtime/polyfill/eventBus.mjs +1 -2
- package/dist/runtime/polyfill/filePicker.mjs +1 -2
- package/dist/runtime/polyfill/fileSystemManager.mjs +1 -2
- package/dist/runtime/polyfill/files.mjs +1 -2
- package/dist/runtime/polyfill/font.mjs +1 -2
- package/dist/runtime/polyfill/index.d.mts +4 -4
- package/dist/runtime/polyfill/index.mjs +12 -5
- package/dist/runtime/polyfill/index.mjs.map +1 -1
- package/dist/runtime/polyfill/interaction.mjs +1 -2
- package/dist/runtime/polyfill/interactionApi.mjs +1 -2
- package/dist/runtime/polyfill/intersectionObserver.mjs +4 -4
- package/dist/runtime/polyfill/intersectionObserver.mjs.map +1 -1
- package/dist/runtime/polyfill/lifecycleEvents.d.mts +12 -0
- package/dist/runtime/polyfill/lifecycleEvents.mjs +67 -0
- package/dist/runtime/polyfill/lifecycleEvents.mjs.map +1 -0
- package/dist/runtime/polyfill/locale.mjs +1 -2
- package/dist/runtime/polyfill/location.mjs +1 -2
- package/dist/runtime/polyfill/locationApi.mjs +1 -2
- package/dist/runtime/polyfill/mediaActions.mjs +1 -2
- package/dist/runtime/polyfill/mediaApi/file.mjs +1 -2
- package/dist/runtime/polyfill/mediaApi/info.mjs +1 -2
- package/dist/runtime/polyfill/mediaApi/picker.mjs +1 -2
- package/dist/runtime/polyfill/mediaApi/preview.mjs +1 -2
- package/dist/runtime/polyfill/mediaApi/process.mjs +1 -2
- package/dist/runtime/polyfill/mediaInfo.mjs +1 -2
- package/dist/runtime/polyfill/mediaPicker.mjs +1 -2
- package/dist/runtime/polyfill/mediaProcess.mjs +1 -2
- package/dist/runtime/polyfill/menuApi.mjs +5 -3
- package/dist/runtime/polyfill/menuApi.mjs.map +1 -1
- package/dist/runtime/polyfill/navigationBarRuntime.mjs +1 -2
- package/dist/runtime/polyfill/network/request.mjs +1 -2
- package/dist/runtime/polyfill/network/requestBridge.mjs +1 -2
- package/dist/runtime/polyfill/network/status.mjs +1 -2
- package/dist/runtime/polyfill/platformApi.mjs +1 -2
- package/dist/runtime/polyfill/platformRuntime.mjs +1 -2
- package/dist/runtime/polyfill/routeRuntime/appLifecycle.mjs +1 -2
- package/dist/runtime/polyfill/routeRuntime/dom.mjs +1 -2
- package/dist/runtime/polyfill/routeRuntime/events.d.mts +0 -2
- package/dist/runtime/polyfill/routeRuntime/events.mjs +1 -2
- package/dist/runtime/polyfill/routeRuntime/history.d.mts +0 -2
- package/dist/runtime/polyfill/routeRuntime/history.mjs +1 -2
- package/dist/runtime/polyfill/routeRuntime/lifecycle.mjs +1 -2
- package/dist/runtime/polyfill/routeRuntime/options.d.mts +1 -2
- package/dist/runtime/polyfill/routeRuntime/options.mjs +1 -2
- package/dist/runtime/polyfill/routeRuntime/result.mjs +1 -2
- package/dist/runtime/polyfill/routeRuntime/scroll.mjs +37 -6
- package/dist/runtime/polyfill/routeRuntime/scroll.mjs.map +1 -1
- package/dist/runtime/polyfill/routeRuntime/stack.mjs +1 -2
- package/dist/runtime/polyfill/routeRuntime/url.mjs +1 -2
- package/dist/runtime/polyfill/routeRuntime.d.mts +2 -2
- package/dist/runtime/polyfill/routeRuntime.mjs +14 -5
- package/dist/runtime/polyfill/routeRuntime.mjs.map +1 -1
- package/dist/runtime/polyfill/runtimeCapabilityApi.mjs +1 -2
- package/dist/runtime/polyfill/runtimeDataApi.d.mts +0 -2
- package/dist/runtime/polyfill/runtimeDataApi.mjs +1 -2
- package/dist/runtime/polyfill/runtimeInfra.mjs +1 -2
- package/dist/runtime/polyfill/runtimeOps.mjs +1 -2
- package/dist/runtime/polyfill/selectorQuery.mjs +3 -3
- package/dist/runtime/polyfill/selectorQuery.mjs.map +1 -1
- package/dist/runtime/polyfill/storage.mjs +1 -2
- package/dist/runtime/polyfill/storageAsync.mjs +1 -2
- package/dist/runtime/polyfill/subscribe.mjs +1 -2
- package/dist/runtime/polyfill/system.mjs +1 -2
- package/dist/runtime/polyfill/systemApi.mjs +1 -2
- package/dist/runtime/polyfill/types/base.d.mts +0 -2
- package/dist/runtime/polyfill/types/common.d.mts +0 -2
- package/dist/runtime/polyfill/types/lifecycle.d.mts +12 -0
- package/dist/runtime/polyfill/types/locationRuntime.d.mts +0 -2
- package/dist/runtime/polyfill/types/mediaAuth.d.mts +0 -2
- package/dist/runtime/polyfill/types/platformRuntime.d.mts +0 -2
- package/dist/runtime/polyfill/types/systemAuth.d.mts +0 -2
- package/dist/runtime/polyfill/types/tabBarRuntime.d.mts +0 -2
- package/dist/runtime/polyfill/ui.mjs +1 -2
- package/dist/runtime/polyfill/uiFeedback.mjs +19 -5
- package/dist/runtime/polyfill/uiFeedback.mjs.map +1 -1
- package/dist/runtime/polyfill/uiMediaApi.d.mts +8 -2
- package/dist/runtime/polyfill/uiMediaApi.mjs +20 -5
- package/dist/runtime/polyfill/uiMediaApi.mjs.map +1 -1
- package/dist/runtime/polyfill/videoContext.mjs +1 -2
- package/dist/runtime/polyfill/vkSession.mjs +1 -2
- package/dist/runtime/polyfill/windowResize.mjs +1 -2
- package/dist/runtime/polyfill/worker.mjs +1 -2
- package/dist/runtime/polyfill.d.mts +4 -2
- package/dist/runtime/renderContext.d.mts +0 -2
- package/dist/runtime/renderContext.mjs +5 -4
- package/dist/runtime/renderContext.mjs.map +1 -1
- package/dist/runtime/rpx.d.mts +0 -2
- package/dist/runtime/rpx.mjs +6 -6
- package/dist/runtime/rpx.mjs.map +1 -1
- package/dist/runtime/seo/index.d.mts +0 -2
- package/dist/runtime/seo/index.mjs +1 -2
- package/dist/runtime/style.d.mts +0 -2
- package/dist/runtime/style.mjs +1 -2
- package/dist/runtime/template.d.mts +0 -2
- package/dist/runtime/utils/object.mjs +1 -2
- package/dist/runtime/viewport/index.d.mts +0 -2
- package/dist/runtime/viewport/index.mjs +1 -2
- package/dist/runtime/viewport/style.mjs +2 -2
- package/dist/runtime/viewport/style.mjs.map +1 -1
- package/dist/runtime/viewport/types.d.mts +0 -2
- package/dist/runtime/warning.d.mts +0 -2
- package/dist/runtime/warning.mjs +1 -2
- package/dist/runtime/wevu.d.mts +1 -2
- package/dist/runtime/wevu.mjs +1 -2
- package/dist/shared/nativeComponents.mjs +10 -3
- package/dist/shared/nativeComponents.mjs.map +1 -1
- package/dist/shared/slugify.mjs +1 -2
- package/dist/shared/styleUnits/options.d.mts +24 -0
- package/dist/shared/styleUnits/options.mjs +13 -0
- package/dist/shared/styleUnits/options.mjs.map +1 -0
- package/dist/shared/styleUnits/value.mjs +63 -0
- package/dist/shared/styleUnits/value.mjs.map +1 -0
- package/dist/shared/tabBar.d.mts +0 -2
- package/dist/shared/tabBar.mjs +1 -2
- package/dist/shared/wxml.mjs +1 -2
- package/package.json +15 -13
- package/dist/runtime/nativeComponents/richText/helpers.mjs +0 -230
- package/dist/runtime/nativeComponents/richText/helpers.mjs.map +0 -1
- package/dist/runtime/nativeComponents/scrollView.mjs +0 -88
- package/dist/runtime/nativeComponents/scrollView.mjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"intersectionObserver.mjs","names":[],"sources":["../../../src/runtime/polyfill/intersectionObserver.ts"],"sourcesContent":["import { resolveSelectorTargets } from './selectorQuery'\n\nexport interface IntersectionMargins {\n left?: number\n right?: number\n top?: number\n bottom?: number\n}\n\nexport interface MiniProgramIntersectionObserverOptions {\n initialRatio?: number\n observeAll?: boolean\n thresholds?: number[]\n}\n\ntype MiniProgramIntersectionCallback = (result: Record<string, any>) => void\n\nexport interface MiniProgramIntersectionObserver {\n relativeTo: (selector: string, margins?: IntersectionMargins) => MiniProgramIntersectionObserver\n relativeToViewport: (margins?: IntersectionMargins) => MiniProgramIntersectionObserver\n observe: (selector: string, callback: MiniProgramIntersectionCallback) => MiniProgramIntersectionObserver\n disconnect: () => void\n}\n\nfunction isObservableElement(value: unknown): value is Element {\n return Boolean(value && typeof value === 'object' && typeof (value as Element).getBoundingClientRect === 'function')\n}\n\nfunction normalizeNumber(value: unknown, fallback = 0) {\n return typeof value === 'number' && Number.isFinite(value) ? value : fallback\n}\n\nfunction normalizeMargins(margins: IntersectionMargins = {}) {\n return {\n left: normalizeNumber(margins.left),\n right: normalizeNumber(margins.right),\n top: normalizeNumber(margins.top),\n bottom: normalizeNumber(margins.bottom),\n }\n}\n\nfunction toRootMargin(margins: IntersectionMargins) {\n const normalized = normalizeMargins(margins)\n return `${normalized.top}px ${normalized.right}px ${normalized.bottom}px ${normalized.left}px`\n}\n\nfunction toRect(value: DOMRectReadOnly | null) {\n if (!value) {\n return null\n }\n return {\n left: value.left,\n right: value.right,\n top: value.top,\n bottom: value.bottom,\n width: value.width,\n height: value.height,\n }\n}\n\nfunction mapIntersectionEntry(entry: IntersectionObserverEntry) {\n const target = entry.target as HTMLElement & { getAttribute?: (name: string) => string | null }\n return {\n id: target.id ?? target.getAttribute?.('id') ?? '',\n dataset: { ...(target
|
|
1
|
+
{"version":3,"file":"intersectionObserver.mjs","names":[],"sources":["../../../src/runtime/polyfill/intersectionObserver.ts"],"sourcesContent":["import { readRuntimeDataset } from '../dataset'\nimport { resolveSelectorTargets } from './selectorQuery'\n\nexport interface IntersectionMargins {\n left?: number\n right?: number\n top?: number\n bottom?: number\n}\n\nexport interface MiniProgramIntersectionObserverOptions {\n initialRatio?: number\n observeAll?: boolean\n thresholds?: number[]\n}\n\ntype MiniProgramIntersectionCallback = (result: Record<string, any>) => void\n\nexport interface MiniProgramIntersectionObserver {\n relativeTo: (selector: string, margins?: IntersectionMargins) => MiniProgramIntersectionObserver\n relativeToViewport: (margins?: IntersectionMargins) => MiniProgramIntersectionObserver\n observe: (selector: string, callback: MiniProgramIntersectionCallback) => MiniProgramIntersectionObserver\n disconnect: () => void\n}\n\nfunction isObservableElement(value: unknown): value is Element {\n return Boolean(value && typeof value === 'object' && typeof (value as Element).getBoundingClientRect === 'function')\n}\n\nfunction normalizeNumber(value: unknown, fallback = 0) {\n return typeof value === 'number' && Number.isFinite(value) ? value : fallback\n}\n\nfunction normalizeMargins(margins: IntersectionMargins = {}) {\n return {\n left: normalizeNumber(margins.left),\n right: normalizeNumber(margins.right),\n top: normalizeNumber(margins.top),\n bottom: normalizeNumber(margins.bottom),\n }\n}\n\nfunction toRootMargin(margins: IntersectionMargins) {\n const normalized = normalizeMargins(margins)\n return `${normalized.top}px ${normalized.right}px ${normalized.bottom}px ${normalized.left}px`\n}\n\nfunction toRect(value: DOMRectReadOnly | null) {\n if (!value) {\n return null\n }\n return {\n left: value.left,\n right: value.right,\n top: value.top,\n bottom: value.bottom,\n width: value.width,\n height: value.height,\n }\n}\n\nfunction mapIntersectionEntry(entry: IntersectionObserverEntry) {\n const target = entry.target as HTMLElement & { getAttribute?: (name: string) => string | null }\n return {\n id: target.id ?? target.getAttribute?.('id') ?? '',\n dataset: { ...readRuntimeDataset(target) },\n intersectionRatio: entry.intersectionRatio,\n intersectionRect: toRect(entry.intersectionRect),\n boundingClientRect: toRect(entry.boundingClientRect),\n relativeRect: toRect(entry.rootBounds),\n time: entry.time,\n }\n}\n\nexport function createIntersectionObserverBridge(\n scope?: unknown,\n options: MiniProgramIntersectionObserverOptions = {},\n): MiniProgramIntersectionObserver {\n let relativeSelector: string | undefined\n let relativeMargins: IntersectionMargins = {}\n let viewportRelative = true\n const observers = new Set<IntersectionObserver>()\n\n const api = {\n relativeTo(selector: string, margins: IntersectionMargins = {}) {\n relativeSelector = selector\n relativeMargins = margins\n viewportRelative = false\n return api\n },\n relativeToViewport(margins: IntersectionMargins = {}) {\n relativeSelector = undefined\n relativeMargins = margins\n viewportRelative = true\n return api\n },\n observe(selector: string, callback: MiniProgramIntersectionCallback) {\n const targets = resolveSelectorTargets(scope, selector, Boolean(options.observeAll))\n .filter(isObservableElement)\n const relativeTarget = viewportRelative || !relativeSelector\n ? null\n : resolveSelectorTargets(scope, relativeSelector, false)[0]\n const root = isObservableElement(relativeTarget) ? relativeTarget : null\n const thresholds = Array.isArray(options.thresholds) && options.thresholds.length > 0\n ? options.thresholds.map(value => normalizeNumber(value)).filter(value => value >= 0 && value <= 1)\n : [normalizeNumber(options.initialRatio)]\n\n if (typeof IntersectionObserver !== 'function') {\n queueMicrotask(() => {\n for (const target of targets) {\n const rect = target.getBoundingClientRect()\n callback({\n id: (target as HTMLElement).id,\n dataset: readRuntimeDataset(target),\n intersectionRatio: 1,\n intersectionRect: toRect(rect),\n boundingClientRect: toRect(rect),\n relativeRect: null,\n time: Date.now(),\n })\n }\n })\n return api\n }\n\n const observer = new IntersectionObserver((entries) => {\n for (const entry of entries) {\n callback(mapIntersectionEntry(entry))\n }\n }, {\n root,\n rootMargin: toRootMargin(relativeMargins),\n threshold: thresholds.length > 0 ? thresholds : [0],\n })\n observers.add(observer)\n for (const target of targets) {\n observer.observe(target)\n }\n return api\n },\n disconnect() {\n for (const observer of observers) {\n observer.disconnect()\n }\n observers.clear()\n },\n }\n\n return api\n}\n"],"mappings":";;;;AAyBA,SAAS,oBAAoB,OAAkC;CAC7D,OAAO,QAAQ,SAAS,OAAO,UAAU,YAAY,OAAQ,MAAkB,0BAA0B,UAAU;AACrH;AAEA,SAAS,gBAAgB,OAAgB,WAAW,GAAG;CACrD,OAAO,OAAO,UAAU,YAAY,OAAO,SAAS,KAAK,IAAI,QAAQ;AACvE;AAEA,SAAS,iBAAiB,UAA+B,CAAC,GAAG;CAC3D,OAAO;EACL,MAAM,gBAAgB,QAAQ,IAAI;EAClC,OAAO,gBAAgB,QAAQ,KAAK;EACpC,KAAK,gBAAgB,QAAQ,GAAG;EAChC,QAAQ,gBAAgB,QAAQ,MAAM;CACxC;AACF;AAEA,SAAS,aAAa,SAA8B;CAClD,MAAM,aAAa,iBAAi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U,KAAK,QAAQ,WAAW,SAAS,IAChF,QAAQ,WAAW,KAAI,UAAS,gBAAgB,KAAK,CAAC,CAAC,CAAC,QAAO,UAAS,SAAS,KAAK,SAAS,CAAC,IAChG,CAAC,gBAAgB,QAAQ,YAAY,CAAC;GAE1C,IAAI,OAAO,yBAAyB,YAAY;IAC9C,qBAAqB;KACnB,KAAK,MAAM,UAAU,SAAS;MAC5B,MAAM,OAAO,OAAO,sBAAsB;MAC1C,SAAS;OACP,IAAK,OAAuB;OAC5B,SAAS,mBAAmB,MAAM;OAClC,mBAAmB;OACnB,kBAAkB,OAAO,IAAI;OAC7B,oBAAoB,OAAO,IAAI;OAC/B,cAAc;OACd,MAAM,KAAK,IAAI;MACjB,CAAC;KACH;IACF,CAAC;IACD,OAAO;GACT;GAEA,MAAM,WAAW,IAAI,sBAAsB,YAAY;IACrD,KAAK,MAAM,SAAS,SAClB,SAAS,qBAAqB,KAAK,CAAC;GAExC,GAAG;IACD;IACA,YAAY,aAAa,eAAe;IACxC,WAAW,WAAW,SAAS,IAAI,aAAa,CAAC,CAAC;GACpD,CAAC;GACD,UAAU,IAAI,QAAQ;GACtB,KAAK,MAAM,UAAU,SACnB,SAAS,QAAQ,MAAM;GAEzB,OAAO;EACT;EACA,aAAa;GACX,KAAK,MAAM,YAAY,WACrB,SAAS,WAAW;GAEtB,UAAU,MAAM;EAClB;CACF;CAEA,OAAO;AACT"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { MiniProgramErrorCallback, ThemeChangeCallback, ThemeChangeEvent, UnhandledRejectionCallback, UnhandledRejectionEvent } from "./types/lifecycle.mjs";
|
|
2
|
+
/** 监听脚本错误,错误字符串优先保留浏览器提供的堆栈。 */
|
|
3
|
+
export declare const onError: (handler: MiniProgramErrorCallback) => void;
|
|
4
|
+
export declare const offError: (handler?: MiniProgramErrorCallback) => void;
|
|
5
|
+
export declare const onUnhandledRejection: (listener: (payload: UnhandledRejectionEvent) => void) => void;
|
|
6
|
+
export declare const offUnhandledRejection: (listener?: ((payload: UnhandledRejectionEvent) => void) | undefined) => void;
|
|
7
|
+
export declare const onThemeChange: (listener: (payload: ThemeChangeEvent) => void) => void;
|
|
8
|
+
export declare const offThemeChange: (listener?: ((payload: ThemeChangeEvent) => void) | undefined) => void;
|
|
9
|
+
/** Web 不上报微信平台埋点,只按现有告警策略说明能力边界。 */
|
|
10
|
+
export declare function reportEvent(_eventId: string, _data?: Record<string, unknown>): void;
|
|
11
|
+
export type { MiniProgramErrorCallback, ThemeChangeCallback, ThemeChangeEvent, UnhandledRejectionCallback, UnhandledRejectionEvent };
|
|
12
|
+
//# sourceMappingURL=lifecycleEvents.d.mts.map
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { emitRuntimeWarning } from "../warning.mjs";
|
|
2
|
+
|
|
3
|
+
// src/runtime/polyfill/lifecycleEvents.ts
|
|
4
|
+
function createSubscription(name, eventName, readPayload, resolveTarget = (owner) => owner) {
|
|
5
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
6
|
+
let dispose;
|
|
7
|
+
const emit = (event) => {
|
|
8
|
+
const payload = readPayload(event);
|
|
9
|
+
for (const listener of [...listeners]) try {
|
|
10
|
+
listener(payload);
|
|
11
|
+
} catch (error) {
|
|
12
|
+
const reason = error instanceof Error ? error.message : String(error);
|
|
13
|
+
emitRuntimeWarning(`[@weapp-vite/web] ${name} 监听器执行失败:${reason}`, {
|
|
14
|
+
key: `lifecycle-listener:${name}:${reason}`,
|
|
15
|
+
context: "runtime:lifecycle"
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
return {
|
|
20
|
+
on(listener) {
|
|
21
|
+
if (typeof listener !== "function") return;
|
|
22
|
+
listeners.add(listener);
|
|
23
|
+
if (dispose || typeof window === "undefined") return;
|
|
24
|
+
const target = resolveTarget(window);
|
|
25
|
+
if (!target) return;
|
|
26
|
+
if (typeof target.addEventListener === "function") {
|
|
27
|
+
target.addEventListener(eventName, emit);
|
|
28
|
+
dispose = () => target.removeEventListener(eventName, emit);
|
|
29
|
+
} else if ("addListener" in target && typeof target.addListener === "function") {
|
|
30
|
+
target.addListener(emit);
|
|
31
|
+
dispose = () => target.removeListener(emit);
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
off(listener) {
|
|
35
|
+
if (listener === void 0) listeners.clear();
|
|
36
|
+
else listeners.delete(listener);
|
|
37
|
+
if (listeners.size === 0) {
|
|
38
|
+
dispose?.();
|
|
39
|
+
dispose = void 0;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
const errors = createSubscription("onError", "error", (event) => {
|
|
45
|
+
const error = event.error;
|
|
46
|
+
const stack = error && typeof error === "object" && "stack" in error ? error.stack : void 0;
|
|
47
|
+
return typeof stack === "string" && stack ? stack : event.message;
|
|
48
|
+
});
|
|
49
|
+
const rejections = createSubscription("onUnhandledRejection", "unhandledrejection", (event) => ({
|
|
50
|
+
promise: event.promise,
|
|
51
|
+
reason: event.reason
|
|
52
|
+
}));
|
|
53
|
+
const themes = createSubscription("onThemeChange", "change", (event) => ({ theme: event.matches ? "dark" : "light" }), (owner) => typeof owner.matchMedia === "function" ? owner.matchMedia("(prefers-color-scheme: dark)") : void 0);
|
|
54
|
+
/** 监听脚本错误,错误字符串优先保留浏览器提供的堆栈。 */
|
|
55
|
+
const onError = errors.on;
|
|
56
|
+
const offError = errors.off;
|
|
57
|
+
const onUnhandledRejection = rejections.on;
|
|
58
|
+
const offUnhandledRejection = rejections.off;
|
|
59
|
+
const onThemeChange = themes.on;
|
|
60
|
+
const offThemeChange = themes.off;
|
|
61
|
+
/** Web 不上报微信平台埋点,只按现有告警策略说明能力边界。 */
|
|
62
|
+
function reportEvent(_eventId, _data) {
|
|
63
|
+
emitRuntimeWarning("[@weapp-vite/web] wx.reportEvent 在 Web 端仅提供兼容调用,不会上报到微信平台。", { key: "reportEvent" });
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export { offError, offThemeChange, offUnhandledRejection, onError, onThemeChange, onUnhandledRejection, reportEvent };
|
|
67
|
+
//# sourceMappingURL=lifecycleEvents.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lifecycleEvents.mjs","names":[],"sources":["../../../src/runtime/polyfill/lifecycleEvents.ts"],"sourcesContent":["import type {\n MiniProgramErrorCallback,\n ThemeChangeEvent,\n UnhandledRejectionEvent,\n} from './types/lifecycle'\nimport { emitRuntimeWarning } from '../warning'\n\nexport type { MiniProgramErrorCallback, ThemeChangeCallback, ThemeChangeEvent, UnhandledRejectionCallback, UnhandledRejectionEvent } from './types/lifecycle'\n\nfunction createSubscription<NativeEvent extends Event, Payload>(\n name: string,\n eventName: string,\n readPayload: (event: NativeEvent) => Payload,\n resolveTarget: (owner: Window) => EventTarget | MediaQueryList | undefined = owner => owner,\n) {\n const listeners = new Set<(payload: Payload) => void>()\n let dispose: (() => void) | undefined\n const emit = (event: Event) => {\n const payload = readPayload(event as NativeEvent)\n for (const listener of [...listeners]) {\n try {\n listener(payload)\n }\n catch (error) {\n const reason = error instanceof Error ? error.message : String(error)\n emitRuntimeWarning(`[@weapp-vite/web] ${name} 监听器执行失败:${reason}`, {\n key: `lifecycle-listener:${name}:${reason}`,\n context: 'runtime:lifecycle',\n })\n }\n }\n }\n return {\n on(listener: (payload: Payload) => void): void {\n if (typeof listener !== 'function') {\n return\n }\n listeners.add(listener)\n if (dispose || typeof window === 'undefined') {\n return\n }\n const target = resolveTarget(window)\n if (!target) {\n return\n }\n if (typeof target.addEventListener === 'function') {\n target.addEventListener(eventName, emit)\n dispose = () => target.removeEventListener(eventName, emit)\n }\n else if ('addListener' in target && typeof target.addListener === 'function') {\n target.addListener(emit)\n dispose = () => target.removeListener(emit)\n }\n },\n off(listener?: (payload: Payload) => void): void {\n if (listener === undefined) {\n listeners.clear()\n }\n else {\n listeners.delete(listener)\n }\n if (listeners.size === 0) {\n dispose?.()\n dispose = undefined\n }\n },\n }\n}\n\nconst errors = createSubscription('onError', 'error', (event: ErrorEvent) => {\n const error: unknown = event.error\n const stack = error && typeof error === 'object' && 'stack' in error ? error.stack : undefined\n return typeof stack === 'string' && stack ? stack : event.message\n})\n\nconst rejections = createSubscription(\n 'onUnhandledRejection',\n 'unhandledrejection',\n (event: PromiseRejectionEvent): UnhandledRejectionEvent => ({ promise: event.promise, reason: event.reason }),\n)\n\nconst themes = createSubscription(\n 'onThemeChange',\n 'change',\n (event: MediaQueryListEvent): ThemeChangeEvent => ({ theme: event.matches ? 'dark' : 'light' }),\n owner => typeof owner.matchMedia === 'function' ? owner.matchMedia('(prefers-color-scheme: dark)') : undefined,\n)\n\n/** 监听脚本错误,错误字符串优先保留浏览器提供的堆栈。 */\nexport const onError: (handler: MiniProgramErrorCallback) => void = errors.on\nexport const offError: (handler?: MiniProgramErrorCallback) => void = errors.off\nexport const onUnhandledRejection = rejections.on\nexport const offUnhandledRejection = rejections.off\nexport const onThemeChange = themes.on\nexport const offThemeChange = themes.off\n\n/** Web 不上报微信平台埋点,只按现有告警策略说明能力边界。 */\nexport function reportEvent(_eventId: string, _data?: Record<string, unknown>): void {\n emitRuntimeWarning('[@weapp-vite/web] wx.reportEvent 在 Web 端仅提供兼容调用,不会上报到微信平台。', {\n key: 'reportEvent',\n })\n}\n"],"mappings":";;;AASA,SAAS,mBACP,MACA,WACA,aACA,iBAA6E,UAAS,OACtF;CACA,MAAM,4BAAY,IAAI,IAAgC;CACtD,IAAI;CACJ,MAAM,QAAQ,UAAiB;EAC7B,MAAM,UAAU,YAAY,KAAoB;EAChD,KAAK,MAAM,YAAY,CAAC,GAAG,SAAS,GAClC,IAAI;GACF,SAAS,OAAO;EAClB,SACO,OAAO;GACZ,MAAM,SAAS,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;GACpE,mBAAmB,qBAAqB,KAAK,WAAW,UAAU;IAChE,KAAK,sBAAsB,KAAK,GAAG;IACnC,SAAS;GACX,CAAC;EACH;CAEJ;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,8DAA8D,EAC/E,KAAK,cACP,CAAC;AACH"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/runtime/polyfill/locale.ts
|
|
2
2
|
function normalizeLocale(locale) {
|
|
3
3
|
const normalized = locale.trim().replace("_", "-").toLowerCase();
|
|
4
4
|
if (normalized === "zh-tw" || normalized === "zh-hk" || normalized === "zh-mo" || normalized.startsWith("zh-hant")) return "zh-Hant";
|
|
@@ -9,6 +9,5 @@ function getLocale() {
|
|
|
9
9
|
return normalizeLocale((typeof navigator === "undefined" ? void 0 : navigator)?.language ?? "en");
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
//#endregion
|
|
13
12
|
export { getLocale };
|
|
14
13
|
//# sourceMappingURL=locale.mjs.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { WEAPP_VITE_WEB_CHOOSE_ADDRESS_KEY, WEAPP_VITE_WEB_CHOOSE_LOCATION_KEY, WEAPP_VITE_WEB_FUZZY_LOCATION_KEY } from "@weapp-core/constants";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
// src/runtime/polyfill/location.ts
|
|
4
4
|
const ADDRESS_PROMPT_SPLIT_RE = /[,,]/;
|
|
5
5
|
function normalizeGeoNumber(value, fallback = 0) {
|
|
6
6
|
if (typeof value !== "number" || Number.isNaN(value)) return fallback;
|
|
@@ -101,6 +101,5 @@ function parseChooseLocationPromptInput(input) {
|
|
|
101
101
|
};
|
|
102
102
|
}
|
|
103
103
|
|
|
104
|
-
//#endregion
|
|
105
104
|
export { normalizeFuzzyCoordinate, normalizeGeoNumber, parseChooseAddressPromptInput, parseChooseLocationPromptInput, readCurrentLocation, readPresetChooseAddress, readPresetChooseLocation, readPresetFuzzyLocation };
|
|
106
105
|
//# sourceMappingURL=location.mjs.map
|
|
@@ -4,7 +4,7 @@ import { normalizeFuzzyCoordinate, normalizeGeoNumber, parseChooseAddressPromptI
|
|
|
4
4
|
import { openTargetInNewWindow } from "./mediaActions.mjs";
|
|
5
5
|
import { getGlobalDialogHandlers } from "./ui.mjs";
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
// src/runtime/polyfill/locationApi.ts
|
|
8
8
|
function makePhoneCallBridge(options) {
|
|
9
9
|
const phoneNumber = typeof options?.phoneNumber === "string" ? options.phoneNumber.trim() : "";
|
|
10
10
|
if (!phoneNumber) {
|
|
@@ -120,6 +120,5 @@ async function getFuzzyLocationBridge(options) {
|
|
|
120
120
|
}
|
|
121
121
|
}
|
|
122
122
|
|
|
123
|
-
//#endregion
|
|
124
123
|
export { chooseAddressBridge, chooseLocationBridge, getFuzzyLocationBridge, getLocationBridge, makePhoneCallBridge, openLocationBridge };
|
|
125
124
|
//# sourceMappingURL=locationApi.mjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { openRuntimeUrl } from "../host/index.mjs";
|
|
2
2
|
import { WEAPP_VITE_WEB_OPEN_VIDEO_EDITOR_KEY } from "@weapp-core/constants";
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
// src/runtime/polyfill/mediaActions.ts
|
|
5
5
|
function openTargetInNewWindow(target) {
|
|
6
6
|
try {
|
|
7
7
|
openRuntimeUrl(target, "_blank", "noopener,noreferrer");
|
|
@@ -47,6 +47,5 @@ function triggerDownload(filePath, fileName = "") {
|
|
|
47
47
|
} catch {}
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
//#endregion
|
|
51
50
|
export { normalizePreviewMediaSources, openTargetInNewWindow, readOpenVideoEditorPreset, triggerDownload };
|
|
52
51
|
//# sourceMappingURL=mediaActions.mjs.map
|
|
@@ -2,7 +2,7 @@ import { callMiniProgramAsyncFailure, callMiniProgramAsyncSuccess } from "../asy
|
|
|
2
2
|
import { openTargetInNewWindow, triggerDownload } from "../mediaActions.mjs";
|
|
3
3
|
import { normalizeFilePath, resolveOpenDocumentUrl, resolveSaveFilePath, saveMemoryFile } from "../files.mjs";
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
// src/runtime/polyfill/mediaApi/file.ts
|
|
6
6
|
function saveImageToPhotosAlbumBridge(options) {
|
|
7
7
|
const filePath = typeof options?.filePath === "string" ? options.filePath.trim() : "";
|
|
8
8
|
if (!filePath) {
|
|
@@ -59,6 +59,5 @@ function openDocumentBridge(options) {
|
|
|
59
59
|
return Promise.resolve(callMiniProgramAsyncSuccess(options, { errMsg: "openDocument:ok" }));
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
//#endregion
|
|
63
62
|
export { openDocumentBridge, saveFileBridge, saveFileToDiskBridge, saveImageToPhotosAlbumBridge, saveVideoToPhotosAlbumBridge };
|
|
64
63
|
//# sourceMappingURL=file.mjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { callMiniProgramAsyncFailure, callMiniProgramAsyncSuccess } from "../async.mjs";
|
|
2
2
|
import { inferImageTypeFromPath, inferVideoTypeFromPath, normalizeVideoInfoNumber, readImageInfoFromSource, readPresetVideoInfo, readVideoInfoFromSource } from "../mediaInfo.mjs";
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
// src/runtime/polyfill/mediaApi/info.ts
|
|
5
5
|
function getImageInfoBridge(options) {
|
|
6
6
|
const src = typeof options?.src === "string" ? options.src.trim() : "";
|
|
7
7
|
if (!src) {
|
|
@@ -56,6 +56,5 @@ function getVideoInfoBridge(options) {
|
|
|
56
56
|
});
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
//#endregion
|
|
60
59
|
export { getImageInfoBridge, getVideoInfoBridge };
|
|
61
60
|
//# sourceMappingURL=info.mjs.map
|
|
@@ -3,7 +3,7 @@ import { normalizeChooseImageCount, normalizeChooseImageFile, normalizeChooseMed
|
|
|
3
3
|
import { normalizeChooseFileExtensions, normalizeChooseMessageFile, normalizeChooseMessageFileCount, normalizeChooseMessageFileType, pickChooseFileFiles, pickChooseMessageFiles } from "../filePicker.mjs";
|
|
4
4
|
import { normalizeChooseVideoFile, pickChooseVideoFile } from "../mediaProcess.mjs";
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
// src/runtime/polyfill/mediaApi/picker.ts
|
|
7
7
|
async function chooseImageBridge(options) {
|
|
8
8
|
const count = normalizeChooseImageCount(options?.count);
|
|
9
9
|
try {
|
|
@@ -85,6 +85,5 @@ async function chooseFileBridge(options) {
|
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
-
//#endregion
|
|
89
88
|
export { chooseFileBridge, chooseImageBridge, chooseMediaBridge, chooseMessageFileBridge, chooseVideoBridge };
|
|
90
89
|
//# sourceMappingURL=picker.mjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { callMiniProgramAsyncFailure, callMiniProgramAsyncSuccess } from "../async.mjs";
|
|
2
2
|
import { normalizePreviewMediaSources, openTargetInNewWindow, readOpenVideoEditorPreset } from "../mediaActions.mjs";
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
// src/runtime/polyfill/mediaApi/preview.ts
|
|
5
5
|
function previewImageBridge(options) {
|
|
6
6
|
const urls = Array.isArray(options?.urls) ? options.urls.map((url) => String(url).trim()).filter(Boolean) : [];
|
|
7
7
|
if (!urls.length) {
|
|
@@ -36,6 +36,5 @@ function openVideoEditorBridge(options) {
|
|
|
36
36
|
}));
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
//#endregion
|
|
40
39
|
export { openVideoEditorBridge, previewImageBridge, previewMediaBridge };
|
|
41
40
|
//# sourceMappingURL=preview.mjs.map
|
|
@@ -2,7 +2,7 @@ import { callMiniProgramAsyncFailure, callMiniProgramAsyncSuccess } from "../asy
|
|
|
2
2
|
import { readPresetCompressVideo } from "../mediaInfo.mjs";
|
|
3
3
|
import { compressImageByCanvas, normalizeCompressImageQuality } from "../mediaProcess.mjs";
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
// src/runtime/polyfill/mediaApi/process.ts
|
|
6
6
|
async function compressImageBridge(options) {
|
|
7
7
|
const src = typeof options?.src === "string" ? options.src.trim() : "";
|
|
8
8
|
if (!src) {
|
|
@@ -43,6 +43,5 @@ function compressVideoBridge(options) {
|
|
|
43
43
|
}));
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
//#endregion
|
|
47
46
|
export { compressImageBridge, compressVideoBridge };
|
|
48
47
|
//# sourceMappingURL=process.mjs.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { WEAPP_VITE_WEB_COMPRESS_VIDEO_KEY, WEAPP_VITE_WEB_VIDEO_INFO_KEY } from "@weapp-core/constants";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
// src/runtime/polyfill/mediaInfo.ts
|
|
4
4
|
function inferImageTypeFromPath(path) {
|
|
5
5
|
const lower = path.toLowerCase();
|
|
6
6
|
if (lower.includes(".png")) return "png";
|
|
@@ -131,6 +131,5 @@ async function readVideoInfoFromSource(src) {
|
|
|
131
131
|
});
|
|
132
132
|
}
|
|
133
133
|
|
|
134
|
-
//#endregion
|
|
135
134
|
export { inferImageTypeFromPath, inferVideoTypeFromPath, normalizeVideoInfoNumber, readImageInfoFromSource, readPresetCompressVideo, readPresetVideoInfo, readVideoInfoFromSource };
|
|
136
135
|
//# sourceMappingURL=mediaInfo.mjs.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/runtime/polyfill/mediaPicker.ts
|
|
2
2
|
function normalizeChooseImageCount(count) {
|
|
3
3
|
if (typeof count !== "number" || Number.isNaN(count)) return 9;
|
|
4
4
|
return Math.max(1, Math.floor(count));
|
|
@@ -208,6 +208,5 @@ async function pickChooseMediaFiles(count, types) {
|
|
|
208
208
|
throw new TypeError("Media picker is unavailable in current environment.");
|
|
209
209
|
}
|
|
210
210
|
|
|
211
|
-
//#endregion
|
|
212
211
|
export { createTempFilePath, inferChooseMediaFileType, normalizeChooseImageCount, normalizeChooseImageFile, normalizeChooseMediaCount, normalizeChooseMediaFile, normalizeChooseMediaTypes, pickChooseImageFiles, pickChooseMediaFiles };
|
|
213
212
|
//# sourceMappingURL=mediaPicker.mjs.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createTempFilePath, inferChooseMediaFileType, pickChooseMediaFiles } from "./mediaPicker.mjs";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
// src/runtime/polyfill/mediaProcess.ts
|
|
4
4
|
function normalizeCompressImageQuality(quality) {
|
|
5
5
|
if (typeof quality !== "number" || Number.isNaN(quality)) return 80;
|
|
6
6
|
return Math.max(0, Math.min(100, Math.round(quality)));
|
|
@@ -60,6 +60,5 @@ async function pickChooseVideoFile() {
|
|
|
60
60
|
return (await pickChooseMediaFiles(1, /* @__PURE__ */ new Set(["video"])))[0] ?? null;
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
//#endregion
|
|
64
63
|
export { compressImageByCanvas, normalizeChooseVideoFile, normalizeCompressImageQuality, pickChooseVideoFile };
|
|
65
64
|
//# sourceMappingURL=mediaProcess.mjs.map
|
|
@@ -4,7 +4,7 @@ import { setTabBarBadgeState, setTabBarRedDotState, setTabBarVisible, updateTabB
|
|
|
4
4
|
import { readNetworkStatusSnapshot } from "./network/status.mjs";
|
|
5
5
|
import { normalizeSubscribeTemplateIds, resolveSubscribeDecisionMap } from "./subscribe.mjs";
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
// src/runtime/polyfill/menuApi.ts
|
|
8
8
|
function getNetworkTypeBridge(options) {
|
|
9
9
|
const status = readNetworkStatusSnapshot();
|
|
10
10
|
return Promise.resolve(callMiniProgramAsyncSuccess(options, {
|
|
@@ -99,7 +99,9 @@ function showShareMenuBridge(options) {
|
|
|
99
99
|
function updateShareMenuBridge(options) {
|
|
100
100
|
return Promise.resolve(callMiniProgramAsyncSuccess(options, { errMsg: "updateShareMenu:ok" }));
|
|
101
101
|
}
|
|
102
|
+
function hideShareMenuBridge(options) {
|
|
103
|
+
return Promise.resolve(callMiniProgramAsyncSuccess(options, { errMsg: "hideShareMenu:ok" }));
|
|
104
|
+
}
|
|
102
105
|
|
|
103
|
-
|
|
104
|
-
export { getNetworkTypeBridge, hideTabBarBridge, hideTabBarRedDotBridge, removeTabBarBadgeBridge, requestPaymentBridge, requestSubscribeMessageBridge, setTabBarBadgeBridge, setTabBarItemBridge, setTabBarStyleBridge, showActionSheetBridge, showModalBridge, showShareMenuBridge, showTabBarBridge, showTabBarRedDotBridge, updateShareMenuBridge };
|
|
106
|
+
export { getNetworkTypeBridge, hideShareMenuBridge, hideTabBarBridge, hideTabBarRedDotBridge, removeTabBarBadgeBridge, requestPaymentBridge, requestSubscribeMessageBridge, setTabBarBadgeBridge, setTabBarItemBridge, setTabBarStyleBridge, showActionSheetBridge, showModalBridge, showShareMenuBridge, showTabBarBridge, showTabBarRedDotBridge, updateShareMenuBridge };
|
|
105
107
|
//# sourceMappingURL=menuApi.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"menuApi.mjs","names":[],"sources":["../../../src/runtime/polyfill/menuApi.ts"],"sourcesContent":["import {\n setTabBarBadgeState,\n setTabBarRedDotState,\n setTabBarVisible,\n updateTabBarItem,\n updateTabBarStyle,\n} from '../appShell/tabBar'\nimport {\n callMiniProgramAsyncFailure,\n callMiniProgramAsyncSuccess,\n} from './async'\nimport { readNetworkStatusSnapshot } from './network'\nimport {\n normalizeSubscribeTemplateIds,\n resolveSubscribeDecisionMap,\n} from './subscribe'\nimport {\n normalizeActionSheetItems,\n resolveActionSheetSelection,\n resolveModalSelection,\n} from './ui'\n\nexport function getNetworkTypeBridge(options?: any): Promise<any> {\n const status = readNetworkStatusSnapshot()\n return Promise.resolve(callMiniProgramAsyncSuccess(options, {\n errMsg: 'getNetworkType:ok',\n ...status,\n }))\n}\n\nfunction resolveTabBarMutation(action: string, options: any, succeeded: boolean, failureReason = 'tabBar not configured') {\n if (succeeded) {\n return Promise.resolve(callMiniProgramAsyncSuccess(options, { errMsg: `${action}:ok` }))\n }\n const failure = callMiniProgramAsyncFailure(options, `${action}:fail ${failureReason}`)\n return Promise.reject(failure)\n}\n\nexport function showTabBarBridge(options?: any): Promise<any> {\n return resolveTabBarMutation('showTabBar', options, setTabBarVisible(true, options?.animation === true))\n}\n\nexport function hideTabBarBridge(options?: any): Promise<any> {\n return resolveTabBarMutation('hideTabBar', options, setTabBarVisible(false, options?.animation === true))\n}\n\nexport function setTabBarItemBridge(options?: any): Promise<any> {\n const patch = {\n ...(typeof options?.text === 'string' ? { text: options.text } : {}),\n ...(typeof options?.iconPath === 'string' ? { iconPath: options.iconPath } : {}),\n ...(typeof options?.selectedIconPath === 'string' ? { selectedIconPath: options.selectedIconPath } : {}),\n }\n return resolveTabBarMutation('setTabBarItem', options, updateTabBarItem(options?.index, patch), 'invalid index')\n}\n\nexport function setTabBarStyleBridge(options?: any): Promise<any> {\n const patch = {\n ...(typeof options?.color === 'string' ? { color: options.color } : {}),\n ...(typeof options?.selectedColor === 'string' ? { selectedColor: options.selectedColor } : {}),\n ...(typeof options?.backgroundColor === 'string' ? { backgroundColor: options.backgroundColor } : {}),\n ...(options?.borderStyle === 'black' || options?.borderStyle === 'white'\n ? { borderStyle: options.borderStyle }\n : {}),\n }\n return resolveTabBarMutation('setTabBarStyle', options, updateTabBarStyle(patch))\n}\n\nexport function setTabBarBadgeBridge(options?: any): Promise<any> {\n const succeeded = typeof options?.text === 'string'\n && setTabBarBadgeState(options?.index, options.text)\n return resolveTabBarMutation('setTabBarBadge', options, succeeded, 'invalid index or text')\n}\n\nexport function removeTabBarBadgeBridge(options?: any): Promise<any> {\n return resolveTabBarMutation(\n 'removeTabBarBadge',\n options,\n setTabBarBadgeState(options?.index, undefined),\n 'invalid index',\n )\n}\n\nexport function showTabBarRedDotBridge(options?: any): Promise<any> {\n return resolveTabBarMutation('showTabBarRedDot', options, setTabBarRedDotState(options?.index, true), 'invalid index')\n}\n\nexport function hideTabBarRedDotBridge(options?: any): Promise<any> {\n return resolveTabBarMutation('hideTabBarRedDot', options, setTabBarRedDotState(options?.index, false), 'invalid index')\n}\n\nexport function requestPaymentBridge(options?: any): Promise<any> {\n return Promise.resolve(callMiniProgramAsyncSuccess(options, { errMsg: 'requestPayment:ok' }))\n}\n\nexport function requestSubscribeMessageBridge(options?: any): Promise<any> {\n const tmplIds = normalizeSubscribeTemplateIds(options?.tmplIds)\n if (tmplIds.length === 0) {\n const failure = callMiniProgramAsyncFailure(options, 'requestSubscribeMessage:fail invalid tmplIds')\n return Promise.reject(failure)\n }\n const decisionMap = resolveSubscribeDecisionMap(tmplIds)\n const result: Record<string, any> & { errMsg: string } = tmplIds.reduce<Record<string, any> & { errMsg: string }>((payload, tmplId) => {\n payload[tmplId] = decisionMap[tmplId]\n return payload\n }, { errMsg: 'requestSubscribeMessage:ok' })\n return Promise.resolve(callMiniProgramAsyncSuccess(options, result))\n}\n\nexport function showModalBridge(options?: any): Promise<any> {\n const modalResult = resolveModalSelection(options)\n const result = {\n errMsg: 'showModal:ok',\n confirm: modalResult.confirm,\n cancel: modalResult.cancel,\n }\n return Promise.resolve(callMiniProgramAsyncSuccess(options, result))\n}\n\nexport function showActionSheetBridge(options?: any): Promise<any> {\n const itemList = normalizeActionSheetItems(options?.itemList)\n if (!itemList.length) {\n const failure = callMiniProgramAsyncFailure(options, 'showActionSheet:fail invalid itemList')\n return Promise.reject(failure)\n }\n const tapIndex = resolveActionSheetSelection(itemList)\n if (tapIndex === null) {\n const failure = callMiniProgramAsyncFailure(options, 'showActionSheet:fail cancel')\n return Promise.reject(failure)\n }\n return Promise.resolve(callMiniProgramAsyncSuccess(options, {\n errMsg: 'showActionSheet:ok',\n tapIndex,\n }))\n}\n\nexport function showShareMenuBridge(options?: any): Promise<any> {\n return Promise.resolve(callMiniProgramAsyncSuccess(options, { errMsg: 'showShareMenu:ok' }))\n}\n\nexport function updateShareMenuBridge(options?: any): Promise<any> {\n return Promise.resolve(callMiniProgramAsyncSuccess(options, { errMsg: 'updateShareMenu:ok' }))\n}\n"],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"file":"menuApi.mjs","names":[],"sources":["../../../src/runtime/polyfill/menuApi.ts"],"sourcesContent":["import type { MiniProgramBaseResult, ShareMenuOptions } from './types'\nimport {\n setTabBarBadgeState,\n setTabBarRedDotState,\n setTabBarVisible,\n updateTabBarItem,\n updateTabBarStyle,\n} from '../appShell/tabBar'\nimport {\n callMiniProgramAsyncFailure,\n callMiniProgramAsyncSuccess,\n} from './async'\nimport { readNetworkStatusSnapshot } from './network'\nimport {\n normalizeSubscribeTemplateIds,\n resolveSubscribeDecisionMap,\n} from './subscribe'\nimport {\n normalizeActionSheetItems,\n resolveActionSheetSelection,\n resolveModalSelection,\n} from './ui'\n\nexport function getNetworkTypeBridge(options?: any): Promise<any> {\n const status = readNetworkStatusSnapshot()\n return Promise.resolve(callMiniProgramAsyncSuccess(options, {\n errMsg: 'getNetworkType:ok',\n ...status,\n }))\n}\n\nfunction resolveTabBarMutation(action: string, options: any, succeeded: boolean, failureReason = 'tabBar not configured') {\n if (succeeded) {\n return Promise.resolve(callMiniProgramAsyncSuccess(options, { errMsg: `${action}:ok` }))\n }\n const failure = callMiniProgramAsyncFailure(options, `${action}:fail ${failureReason}`)\n return Promise.reject(failure)\n}\n\nexport function showTabBarBridge(options?: any): Promise<any> {\n return resolveTabBarMutation('showTabBar', options, setTabBarVisible(true, options?.animation === true))\n}\n\nexport function hideTabBarBridge(options?: any): Promise<any> {\n return resolveTabBarMutation('hideTabBar', options, setTabBarVisible(false, options?.animation === true))\n}\n\nexport function setTabBarItemBridge(options?: any): Promise<any> {\n const patch = {\n ...(typeof options?.text === 'string' ? { text: options.text } : {}),\n ...(typeof options?.iconPath === 'string' ? { iconPath: options.iconPath } : {}),\n ...(typeof options?.selectedIconPath === 'string' ? { selectedIconPath: options.selectedIconPath } : {}),\n }\n return resolveTabBarMutation('setTabBarItem', options, updateTabBarItem(options?.index, patch), 'invalid index')\n}\n\nexport function setTabBarStyleBridge(options?: any): Promise<any> {\n const patch = {\n ...(typeof options?.color === 'string' ? { color: options.color } : {}),\n ...(typeof options?.selectedColor === 'string' ? { selectedColor: options.selectedColor } : {}),\n ...(typeof options?.backgroundColor === 'string' ? { backgroundColor: options.backgroundColor } : {}),\n ...(options?.borderStyle === 'black' || options?.borderStyle === 'white'\n ? { borderStyle: options.borderStyle }\n : {}),\n }\n return resolveTabBarMutation('setTabBarStyle', options, updateTabBarStyle(patch))\n}\n\nexport function setTabBarBadgeBridge(options?: any): Promise<any> {\n const succeeded = typeof options?.text === 'string'\n && setTabBarBadgeState(options?.index, options.text)\n return resolveTabBarMutation('setTabBarBadge', options, succeeded, 'invalid index or text')\n}\n\nexport function removeTabBarBadgeBridge(options?: any): Promise<any> {\n return resolveTabBarMutation(\n 'removeTabBarBadge',\n options,\n setTabBarBadgeState(options?.index, undefined),\n 'invalid index',\n )\n}\n\nexport function showTabBarRedDotBridge(options?: any): Promise<any> {\n return resolveTabBarMutation('showTabBarRedDot', options, setTabBarRedDotState(options?.index, true), 'invalid index')\n}\n\nexport function hideTabBarRedDotBridge(options?: any): Promise<any> {\n return resolveTabBarMutation('hideTabBarRedDot', options, setTabBarRedDotState(options?.index, false), 'invalid index')\n}\n\nexport function requestPaymentBridge(options?: any): Promise<any> {\n return Promise.resolve(callMiniProgramAsyncSuccess(options, { errMsg: 'requestPayment:ok' }))\n}\n\nexport function requestSubscribeMessageBridge(options?: any): Promise<any> {\n const tmplIds = normalizeSubscribeTemplateIds(options?.tmplIds)\n if (tmplIds.length === 0) {\n const failure = callMiniProgramAsyncFailure(options, 'requestSubscribeMessage:fail invalid tmplIds')\n return Promise.reject(failure)\n }\n const decisionMap = resolveSubscribeDecisionMap(tmplIds)\n const result: Record<string, any> & { errMsg: string } = tmplIds.reduce<Record<string, any> & { errMsg: string }>((payload, tmplId) => {\n payload[tmplId] = decisionMap[tmplId]\n return payload\n }, { errMsg: 'requestSubscribeMessage:ok' })\n return Promise.resolve(callMiniProgramAsyncSuccess(options, result))\n}\n\nexport function showModalBridge(options?: any): Promise<any> {\n const modalResult = resolveModalSelection(options)\n const result = {\n errMsg: 'showModal:ok',\n confirm: modalResult.confirm,\n cancel: modalResult.cancel,\n }\n return Promise.resolve(callMiniProgramAsyncSuccess(options, result))\n}\n\nexport function showActionSheetBridge(options?: any): Promise<any> {\n const itemList = normalizeActionSheetItems(options?.itemList)\n if (!itemList.length) {\n const failure = callMiniProgramAsyncFailure(options, 'showActionSheet:fail invalid itemList')\n return Promise.reject(failure)\n }\n const tapIndex = resolveActionSheetSelection(itemList)\n if (tapIndex === null) {\n const failure = callMiniProgramAsyncFailure(options, 'showActionSheet:fail cancel')\n return Promise.reject(failure)\n }\n return Promise.resolve(callMiniProgramAsyncSuccess(options, {\n errMsg: 'showActionSheet:ok',\n tapIndex,\n }))\n}\n\nexport function showShareMenuBridge(options?: any): Promise<any> {\n return Promise.resolve(callMiniProgramAsyncSuccess(options, { errMsg: 'showShareMenu:ok' }))\n}\n\nexport function updateShareMenuBridge(options?: any): Promise<any> {\n return Promise.resolve(callMiniProgramAsyncSuccess(options, { errMsg: 'updateShareMenu:ok' }))\n}\n\nexport function hideShareMenuBridge(options?: ShareMenuOptions): Promise<MiniProgramBaseResult> {\n return Promise.resolve(callMiniProgramAsyncSuccess(options, { errMsg: 'hideShareMenu:ok' }))\n}\n"],"mappings":";;;;;;;AAuBA,SAAgB,qBAAqB,SAA6B;CAChE,MAAM,SAAS,0BAA0B;CACzC,OAAO,QAAQ,QAAQ,4BAA4B,SAAS;EAC1D,QAAQ;EACR,GAAG;CACL,CAAC,CAAC;AACJ;AAEA,SAAS,sBAAsB,QAAgB,SAAc,WAAoB,gBAAgB,yBAAyB;CACxH,IAAI,WACF,OAAO,QAAQ,QAAQ,4BAA4B,SAAS,EAAE,QAAQ,GAAG,OAAO,KAAK,CAAC,CAAC;CAEzF,MAAM,UAAU,4BAA4B,SAAS,GAAG,OAAO,QAAQ,eAAe;CACtF,OAAO,QAAQ,OAAO,OAAO;AAC/B;AAEA,SAAgB,iBAAiB,SAA6B;CAC5D,OAAO,sBAAsB,cAAc,SAAS,iBAAiB,MAAM,SA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EACR;CACF,CAAC,CAAC;AACJ;AAEA,SAAgB,oBAAoB,SAA6B;CAC/D,OAAO,QAAQ,QAAQ,4BAA4B,SAAS,EAAE,QAAQ,mBAAmB,CAAC,CAAC;AAC7F;AAEA,SAAgB,sBAAsB,SAA6B;CACjE,OAAO,QAAQ,QAAQ,4BAA4B,SAAS,EAAE,QAAQ,qBAAqB,CAAC,CAAC;AAC/F;AAEA,SAAgB,oBAAoB,SAA4D;CAC9F,OAAO,QAAQ,QAAQ,4BAA4B,SAAS,EAAE,QAAQ,mBAAmB,CAAC,CAAC;AAC7F"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { updateWebDocumentTitle } from "../seo/index.mjs";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
// src/runtime/polyfill/navigationBarRuntime.ts
|
|
4
4
|
function getActiveNavigationBar(pages) {
|
|
5
5
|
const current = pages[pages.length - 1];
|
|
6
6
|
if (!current) return;
|
|
@@ -66,6 +66,5 @@ function createNavigationBarRuntimeBridge(getCurrentPages, emitWarning) {
|
|
|
66
66
|
};
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
-
//#endregion
|
|
70
69
|
export { createNavigationBarRuntimeBridge };
|
|
71
70
|
//# sourceMappingURL=navigationBarRuntime.mjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getRuntimeFetch as getRuntimeFetch$1 } from "../../host/index.mjs";
|
|
2
2
|
import { normalizeFilePath, resolveUploadFileBlob, resolveUploadFileName } from "../files.mjs";
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
// src/runtime/polyfill/network/request.ts
|
|
5
5
|
function resolveTimeoutSignal(timeout) {
|
|
6
6
|
const controller = typeof AbortController === "function" ? new AbortController() : void 0;
|
|
7
7
|
let timeoutTimer;
|
|
@@ -157,6 +157,5 @@ async function performUploadByFetch(options) {
|
|
|
157
157
|
}
|
|
158
158
|
}
|
|
159
159
|
|
|
160
|
-
//#endregion
|
|
161
160
|
export { buildRequestBody, buildRequestUrl, collectResponseHeaders, createBlobObjectUrl, getRuntimeFetch, normalizeRequestHeaders, normalizeRequestMethod, parseRequestResponseData, performDownloadByFetch, performRequestByFetch, performUploadByFetch, stripUploadContentType };
|
|
162
161
|
//# sourceMappingURL=request.mjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { callMiniProgramAsyncFailure, callMiniProgramAsyncSuccess } from "../async.mjs";
|
|
2
2
|
import { performDownloadByFetch, performRequestByFetch, performUploadByFetch } from "./request.mjs";
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
// src/runtime/polyfill/network/requestBridge.ts
|
|
5
5
|
async function requestByFetchBridge(options) {
|
|
6
6
|
try {
|
|
7
7
|
const response = await performRequestByFetch(options);
|
|
@@ -44,6 +44,5 @@ async function uploadFileByFetchBridge(options) {
|
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
//#endregion
|
|
48
47
|
export { downloadFileByFetchBridge, requestByFetchBridge, uploadFileByFetchBridge };
|
|
49
48
|
//# sourceMappingURL=requestBridge.mjs.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/runtime/polyfill/network/status.ts
|
|
2
2
|
function getNavigatorConnection() {
|
|
3
3
|
const runtimeNavigator = typeof navigator !== "undefined" ? navigator : void 0;
|
|
4
4
|
return runtimeNavigator?.connection ?? runtimeNavigator?.mozConnection ?? runtimeNavigator?.webkitConnection;
|
|
@@ -50,6 +50,5 @@ function removeNetworkStatusCallback(callback) {
|
|
|
50
50
|
networkStatusCallbacks.delete(callback);
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
//#endregion
|
|
54
53
|
export { addNetworkStatusCallback, getNavigatorConnection, readNetworkStatusSnapshot, removeNetworkStatusCallback };
|
|
55
54
|
//# sourceMappingURL=status.mjs.map
|
|
@@ -2,7 +2,7 @@ import { callMiniProgramAsyncSuccess, scheduleMicrotask } from "./async.mjs";
|
|
|
2
2
|
import { createInterstitialAdImpl, createRewardedVideoAdImpl } from "./ad.mjs";
|
|
3
3
|
import { createLogManagerBridge, createUpdateManagerBridge, readExtConfigValue, readRuntimeConsole, reportAnalyticsEvent, resolveUpdateManagerPreset } from "./platformRuntime.mjs";
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
// src/runtime/polyfill/platformApi.ts
|
|
6
6
|
function createRewardedVideoAdBridge(options) {
|
|
7
7
|
return createRewardedVideoAdImpl(options);
|
|
8
8
|
}
|
|
@@ -29,6 +29,5 @@ function reportAnalyticsBridge(eventName, data) {
|
|
|
29
29
|
reportAnalyticsEvent(eventName, data);
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
//#endregion
|
|
33
32
|
export { createInterstitialAdBridge, createRewardedVideoAdBridge, getExtConfigBridge, getExtConfigSyncBridge, getLogManagerBridge, getUpdateManagerBridge, reportAnalyticsBridge };
|
|
34
33
|
//# sourceMappingURL=platformApi.mjs.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { WEAPP_VITE_WEB_ANALYTICS_EVENTS_KEY, WEAPP_VITE_WEB_EXT_CONFIG_KEY, WEAPP_VITE_WEB_UPDATE_MANAGER_KEY } from "@weapp-core/constants";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
// src/runtime/polyfill/platformRuntime.ts
|
|
4
4
|
function normalizeSubPackageName(value) {
|
|
5
5
|
if (typeof value !== "string") return "";
|
|
6
6
|
return value.trim();
|
|
@@ -115,6 +115,5 @@ function reportAnalyticsEvent(eventName, data) {
|
|
|
115
115
|
});
|
|
116
116
|
}
|
|
117
117
|
|
|
118
|
-
//#endregion
|
|
119
118
|
export { createLogManagerBridge, createUpdateManagerBridge, readExtConfigValue, readRuntimeConsole, reportAnalyticsEvent, resolveSubPackageName, resolveUpdateManagerPreset };
|
|
120
119
|
//# sourceMappingURL=platformRuntime.mjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { cloneLaunchOptions, resolveFallbackLaunchOptions } from "../appState.mjs";
|
|
2
2
|
import { isRecord } from "./options.mjs";
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
// src/runtime/polyfill/routeRuntime/appLifecycle.ts
|
|
5
5
|
function resolveEntryOptions(entry) {
|
|
6
6
|
return resolveFallbackLaunchOptions(entry ? [entry] : []);
|
|
7
7
|
}
|
|
@@ -129,6 +129,5 @@ var AppLifecycleRuntime = class {
|
|
|
129
129
|
}
|
|
130
130
|
};
|
|
131
131
|
|
|
132
|
-
//#endregion
|
|
133
132
|
export { AppLifecycleRuntime };
|
|
134
133
|
//# sourceMappingURL=appLifecycle.mjs.map
|
|
@@ -3,7 +3,7 @@ import { bindPageScrollOwner, getPageContainer, restoreEntryScrollPosition, setE
|
|
|
3
3
|
import { cancelEntryRoute } from "./events.mjs";
|
|
4
4
|
import { attachRouteMeta } from "./lifecycle.mjs";
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
// src/runtime/polyfill/routeRuntime/dom.ts
|
|
7
7
|
function applyEntryVisibility(entry) {
|
|
8
8
|
const element = entry.element;
|
|
9
9
|
if (!element) return;
|
|
@@ -65,6 +65,5 @@ function mountEntryToDom(entry, pageRegistry, onBeforeMount) {
|
|
|
65
65
|
});
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
-
//#endregion
|
|
69
68
|
export { mountEntryToDom, setEntryActiveInDom, unmountEntryFromDom };
|
|
70
69
|
//# sourceMappingURL=dom.mjs.map
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { ComponentPublicInstance } from "../../component/types.mjs";
|
|
2
2
|
import "../../component/index.mjs";
|
|
3
3
|
import "./options.mjs";
|
|
4
|
-
//#region src/runtime/polyfill/routeRuntime/events.d.ts
|
|
5
4
|
export type AppRouteOpenType = 'appLaunch' | 'navigateTo' | 'redirectTo' | 'navigateBack' | 'switchTab' | 'reLaunch';
|
|
6
5
|
export interface AppRouteEvent {
|
|
7
6
|
routeEventId: string;
|
|
@@ -25,5 +24,4 @@ export declare function onAppRouteDone(callback: AppRouteCallback): void;
|
|
|
25
24
|
export declare function offAppRouteDone(callback?: AppRouteCallback): void;
|
|
26
25
|
export declare function onBeforePageUnload(callback: BeforePageUnloadCallback): void;
|
|
27
26
|
export declare function offBeforePageUnload(callback?: BeforePageUnloadCallback): void;
|
|
28
|
-
//#endregion
|
|
29
27
|
//# sourceMappingURL=events.d.mts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { WEVU_HOST_COMMIT_PROMISE_KEY } from "@weapp-core/constants";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
// src/runtime/polyfill/routeRuntime/events.ts
|
|
4
4
|
const beforeCallbacks = /* @__PURE__ */ new Set();
|
|
5
5
|
const routeCallbacks = /* @__PURE__ */ new Set();
|
|
6
6
|
const doneCallbacks = /* @__PURE__ */ new Set();
|
|
@@ -118,6 +118,5 @@ function finishAppRoute(entry, event) {
|
|
|
118
118
|
if (entry.instance) finishMounted();
|
|
119
119
|
}
|
|
120
120
|
|
|
121
|
-
//#endregion
|
|
122
121
|
export { beginAppRoute, cancelEntryRoute, emitBeforePageUnload, finishAppRoute, getEntryWebviewId, offAppRoute, offAppRouteDone, offBeforeAppRoute, offBeforePageUnload, onAppRoute, onAppRouteDone, onBeforeAppRoute, onBeforePageUnload };
|
|
123
122
|
//# sourceMappingURL=events.mjs.map
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import "./options.mjs";
|
|
2
|
-
//#region src/runtime/polyfill/routeRuntime/history.d.ts
|
|
3
2
|
export type WebRoutingMode = 'memory' | 'history' | 'hash';
|
|
4
3
|
export interface WebRoutingConfig {
|
|
5
4
|
mode?: WebRoutingMode;
|
|
@@ -27,5 +26,4 @@ export declare function getWebRoutingConfig(): {
|
|
|
27
26
|
mode: WebRoutingMode;
|
|
28
27
|
base: string;
|
|
29
28
|
};
|
|
30
|
-
//#endregion
|
|
31
29
|
//# sourceMappingURL=history.d.mts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getEntryWebviewId } from "./events.mjs";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
// src/runtime/polyfill/routeRuntime/history.ts
|
|
4
4
|
const DEFAULT_CONFIG = {
|
|
5
5
|
mode: "memory",
|
|
6
6
|
base: "/"
|
|
@@ -146,6 +146,5 @@ function getWebRoutingConfig() {
|
|
|
146
146
|
return { ...resolvedConfig };
|
|
147
147
|
}
|
|
148
148
|
|
|
149
|
-
//#endregion
|
|
150
149
|
export { configureWebRouting, disposeWebRouting, getWebHistoryStack, getWebRoutingConfig, readWebRouteTarget, resolveWebRoutingConfig, syncWebRouting };
|
|
151
150
|
//# sourceMappingURL=history.mjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getEntryWebviewId } from "./events.mjs";
|
|
2
2
|
import { WEVU_PAGE_LAYOUT_NAME_KEY, WEVU_PAGE_LAYOUT_PROPS_KEY, WEVU_PAGE_LAYOUT_SETTER_KEY } from "@weapp-core/constants";
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
// src/runtime/polyfill/routeRuntime/lifecycle.ts
|
|
5
5
|
const ROUTE_META_SYMBOL = Symbol("@weapp-vite/web:route-meta");
|
|
6
6
|
const PAGE_STATE_SYMBOL = Symbol("@weapp-vite/web:page-state");
|
|
7
7
|
function getRouteMeta(instance) {
|
|
@@ -119,6 +119,5 @@ function augmentPageComponentOptions(component, record) {
|
|
|
119
119
|
};
|
|
120
120
|
}
|
|
121
121
|
|
|
122
|
-
//#endregion
|
|
123
122
|
export { attachRouteMeta, augmentPageComponentOptions, dispatchPageLifetimeToComponents, hidePageInstance, showPageInstance };
|
|
124
123
|
//# sourceMappingURL=lifecycle.mjs.map
|
|
@@ -3,7 +3,6 @@ import { TemplateRenderer } from "../../template.mjs";
|
|
|
3
3
|
import { ComponentOptions, ComponentPublicInstance } from "../../component/types.mjs";
|
|
4
4
|
import "../../component/index.mjs";
|
|
5
5
|
import { MiniProgramAsyncOptions, MiniProgramBaseResult } from "../types/base.mjs";
|
|
6
|
-
//#region src/runtime/polyfill/routeRuntime/options.d.ts
|
|
7
6
|
export interface RegisterMeta {
|
|
8
7
|
id: string;
|
|
9
8
|
template?: TemplateRenderer;
|
|
@@ -44,5 +43,5 @@ export interface NavigateBackOptions extends MiniProgramAsyncOptions<MiniProgram
|
|
|
44
43
|
}
|
|
45
44
|
export type PageRawOptions = ComponentOptions & PageHooks & Record<string, unknown>;
|
|
46
45
|
export type ComponentRawOptions = ComponentOptions & Record<string, unknown>;
|
|
47
|
-
|
|
46
|
+
export {};
|
|
48
47
|
//# sourceMappingURL=options.d.mts.map
|