@weapp-vite/web 1.3.15 → 1.3.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/_virtual/_rolldown/runtime.mjs +18 -0
- package/dist/compiler/wxml/attributes.mjs +93 -0
- package/dist/compiler/wxml/attributes.mjs.map +1 -0
- package/dist/compiler/wxml/compile.mjs +158 -0
- package/dist/compiler/wxml/compile.mjs.map +1 -0
- package/dist/compiler/wxml/dependency.mjs +31 -0
- package/dist/compiler/wxml/dependency.mjs.map +1 -0
- package/dist/compiler/wxml/interpolation.mjs +142 -0
- package/dist/compiler/wxml/interpolation.mjs.map +1 -0
- package/dist/compiler/wxml/navigation.mjs +85 -0
- package/dist/compiler/wxml/navigation.mjs.map +1 -0
- package/dist/compiler/wxml/parser.mjs +41 -0
- package/dist/compiler/wxml/parser.mjs.map +1 -0
- package/dist/compiler/wxml/renderer.mjs +114 -0
- package/dist/compiler/wxml/renderer.mjs.map +1 -0
- package/dist/compiler/wxml/specialNodes.mjs +85 -0
- package/dist/compiler/wxml/specialNodes.mjs.map +1 -0
- package/dist/compiler/wxs.mjs +83 -0
- package/dist/compiler/wxs.mjs.map +1 -0
- package/dist/css/wxss.d.mts +25 -0
- package/dist/css/wxss.mjs +17 -0
- package/dist/css/wxss.mjs.map +1 -0
- package/dist/index.d.mts +18 -2
- package/dist/index.mjs +18 -3
- package/dist/plugin/constants.mjs +43 -0
- package/dist/plugin/constants.mjs.map +1 -0
- package/dist/plugin/entry.mjs +29 -0
- package/dist/plugin/entry.mjs.map +1 -0
- package/dist/plugin/files.mjs +58 -0
- package/dist/plugin/files.mjs.map +1 -0
- package/dist/plugin/index.d.mts +33 -0
- package/dist/plugin/index.mjs +188 -0
- package/dist/plugin/index.mjs.map +1 -0
- package/dist/plugin/navigation.mjs +20 -0
- package/dist/plugin/navigation.mjs.map +1 -0
- package/dist/plugin/path.mjs +85 -0
- package/dist/plugin/path.mjs.map +1 -0
- package/dist/plugin/register.mjs +83 -0
- package/dist/plugin/register.mjs.map +1 -0
- package/dist/plugin/scan.mjs +195 -0
- package/dist/plugin/scan.mjs.map +1 -0
- package/dist/plugin/scanConfig.mjs +45 -0
- package/dist/plugin/scanConfig.mjs.map +1 -0
- package/dist/plugin/state.mjs +22 -0
- package/dist/plugin/state.mjs.map +1 -0
- package/dist/plugin/types.d.mts +46 -0
- package/dist/plugin.d.mts +3 -2
- package/dist/plugin.mjs +3 -2
- package/dist/runtime/button/helpers.mjs +92 -0
- package/dist/runtime/button/helpers.mjs.map +1 -0
- package/dist/runtime/button/index.d.mts +9 -0
- package/dist/runtime/button/index.mjs +198 -0
- package/dist/runtime/button/index.mjs.map +1 -0
- package/dist/runtime/button/style.mjs +168 -0
- package/dist/runtime/button/style.mjs.map +1 -0
- package/dist/runtime/component/behavior.mjs +98 -0
- package/dist/runtime/component/behavior.mjs.map +1 -0
- package/dist/runtime/component/constants.mjs +13 -0
- package/dist/runtime/component/constants.mjs.map +1 -0
- package/dist/runtime/component/dom.mjs +32 -0
- package/dist/runtime/component/dom.mjs.map +1 -0
- package/dist/runtime/component/element.mjs +208 -0
- package/dist/runtime/component/element.mjs.map +1 -0
- package/dist/runtime/component/events.mjs +49 -0
- package/dist/runtime/component/events.mjs.map +1 -0
- package/dist/runtime/component/index.d.mts +7 -0
- package/dist/runtime/component/index.mjs +44 -0
- package/dist/runtime/component/index.mjs.map +1 -0
- package/dist/runtime/component/state.mjs +63 -0
- package/dist/runtime/component/state.mjs.map +1 -0
- package/dist/runtime/component/types.d.mts +49 -0
- package/dist/runtime/component/utils.mjs +39 -0
- package/dist/runtime/component/utils.mjs.map +1 -0
- package/dist/runtime/execution.d.mts +7 -0
- package/dist/runtime/execution.mjs +37 -0
- package/dist/runtime/execution.mjs.map +1 -0
- package/dist/runtime/index.d.mts +16 -2
- package/dist/runtime/index.mjs +16 -2
- package/dist/runtime/legacyTemplate/dom.mjs +76 -0
- package/dist/runtime/legacyTemplate/dom.mjs.map +1 -0
- package/dist/runtime/legacyTemplate/expression.mjs +113 -0
- package/dist/runtime/legacyTemplate/expression.mjs.map +1 -0
- package/dist/runtime/legacyTemplate/index.d.mts +9 -0
- package/dist/runtime/legacyTemplate/index.mjs +132 -0
- package/dist/runtime/legacyTemplate/index.mjs.map +1 -0
- package/dist/runtime/legacyTemplate/types.d.mts +6 -0
- package/dist/runtime/navigationBar/index.d.mts +10 -0
- package/dist/runtime/navigationBar/index.mjs +162 -0
- package/dist/runtime/navigationBar/index.mjs.map +1 -0
- package/dist/runtime/navigationBar/style.mjs +108 -0
- package/dist/runtime/navigationBar/style.mjs.map +1 -0
- package/dist/runtime/polyfill/ad.mjs +150 -0
- package/dist/runtime/polyfill/ad.mjs.map +1 -0
- package/dist/runtime/polyfill/appState.mjs +31 -0
- package/dist/runtime/polyfill/appState.mjs.map +1 -0
- package/dist/runtime/polyfill/async.mjs +31 -0
- package/dist/runtime/polyfill/async.mjs.map +1 -0
- package/dist/runtime/polyfill/auth.mjs +120 -0
- package/dist/runtime/polyfill/auth.mjs.map +1 -0
- package/dist/runtime/polyfill/authApi.mjs +101 -0
- package/dist/runtime/polyfill/authApi.mjs.map +1 -0
- package/dist/runtime/polyfill/background.mjs +31 -0
- package/dist/runtime/polyfill/background.mjs.map +1 -0
- package/dist/runtime/polyfill/canvasContext.mjs +115 -0
- package/dist/runtime/polyfill/canvasContext.mjs.map +1 -0
- package/dist/runtime/polyfill/capability.mjs +20 -0
- package/dist/runtime/polyfill/capability.mjs.map +1 -0
- package/dist/runtime/polyfill/cloud.mjs +39 -0
- package/dist/runtime/polyfill/cloud.mjs.map +1 -0
- package/dist/runtime/polyfill/device.mjs +44 -0
- package/dist/runtime/polyfill/device.mjs.map +1 -0
- package/dist/runtime/polyfill/deviceApi.mjs +31 -0
- package/dist/runtime/polyfill/deviceApi.mjs.map +1 -0
- package/dist/runtime/polyfill/deviceAuthSystemApi.d.mts +102 -0
- package/dist/runtime/polyfill/deviceAuthSystemApi.mjs +144 -0
- package/dist/runtime/polyfill/deviceAuthSystemApi.mjs.map +1 -0
- package/dist/runtime/polyfill/filePicker.mjs +158 -0
- package/dist/runtime/polyfill/filePicker.mjs.map +1 -0
- package/dist/runtime/polyfill/fileSystemManager.mjs +45 -0
- package/dist/runtime/polyfill/fileSystemManager.mjs.map +1 -0
- package/dist/runtime/polyfill/files.mjs +118 -0
- package/dist/runtime/polyfill/files.mjs.map +1 -0
- package/dist/runtime/polyfill/index.d.mts +40 -0
- package/dist/runtime/polyfill/index.mjs +110 -0
- package/dist/runtime/polyfill/index.mjs.map +1 -0
- package/dist/runtime/polyfill/interaction.mjs +38 -0
- package/dist/runtime/polyfill/interaction.mjs.map +1 -0
- package/dist/runtime/polyfill/interactionApi.mjs +54 -0
- package/dist/runtime/polyfill/interactionApi.mjs.map +1 -0
- package/dist/runtime/polyfill/location.mjs +106 -0
- package/dist/runtime/polyfill/location.mjs.map +1 -0
- package/dist/runtime/polyfill/locationApi.mjs +120 -0
- package/dist/runtime/polyfill/locationApi.mjs.map +1 -0
- package/dist/runtime/polyfill/mediaActions.mjs +52 -0
- package/dist/runtime/polyfill/mediaActions.mjs.map +1 -0
- package/dist/runtime/polyfill/mediaApi/file.mjs +63 -0
- package/dist/runtime/polyfill/mediaApi/file.mjs.map +1 -0
- package/dist/runtime/polyfill/mediaApi/info.mjs +59 -0
- package/dist/runtime/polyfill/mediaApi/info.mjs.map +1 -0
- package/dist/runtime/polyfill/mediaApi/picker.mjs +82 -0
- package/dist/runtime/polyfill/mediaApi/picker.mjs.map +1 -0
- package/dist/runtime/polyfill/mediaApi/preview.mjs +39 -0
- package/dist/runtime/polyfill/mediaApi/preview.mjs.map +1 -0
- package/dist/runtime/polyfill/mediaApi/process.mjs +46 -0
- package/dist/runtime/polyfill/mediaApi/process.mjs.map +1 -0
- package/dist/runtime/polyfill/mediaInfo.mjs +136 -0
- package/dist/runtime/polyfill/mediaInfo.mjs.map +1 -0
- package/dist/runtime/polyfill/mediaPicker.mjs +213 -0
- package/dist/runtime/polyfill/mediaPicker.mjs.map +1 -0
- package/dist/runtime/polyfill/mediaProcess.mjs +65 -0
- package/dist/runtime/polyfill/mediaProcess.mjs.map +1 -0
- package/dist/runtime/polyfill/menuApi.mjs +70 -0
- package/dist/runtime/polyfill/menuApi.mjs.map +1 -0
- package/dist/runtime/polyfill/navigationBarRuntime.mjs +66 -0
- package/dist/runtime/polyfill/navigationBarRuntime.mjs.map +1 -0
- package/dist/runtime/polyfill/network/request.mjs +162 -0
- package/dist/runtime/polyfill/network/request.mjs.map +1 -0
- package/dist/runtime/polyfill/network/requestBridge.mjs +49 -0
- package/dist/runtime/polyfill/network/requestBridge.mjs.map +1 -0
- package/dist/runtime/polyfill/network/status.mjs +55 -0
- package/dist/runtime/polyfill/network/status.mjs.map +1 -0
- package/dist/runtime/polyfill/platformApi.mjs +33 -0
- package/dist/runtime/polyfill/platformApi.mjs.map +1 -0
- package/dist/runtime/polyfill/platformRuntime.mjs +120 -0
- package/dist/runtime/polyfill/platformRuntime.mjs.map +1 -0
- package/dist/runtime/polyfill/routeRuntime/dom.mjs +36 -0
- package/dist/runtime/polyfill/routeRuntime/dom.mjs.map +1 -0
- package/dist/runtime/polyfill/routeRuntime/lifecycle.mjs +83 -0
- package/dist/runtime/polyfill/routeRuntime/lifecycle.mjs.map +1 -0
- package/dist/runtime/polyfill/routeRuntime/options.d.mts +33 -0
- package/dist/runtime/polyfill/routeRuntime/options.mjs +76 -0
- package/dist/runtime/polyfill/routeRuntime/options.mjs.map +1 -0
- package/dist/runtime/polyfill/routeRuntime/url.mjs +35 -0
- package/dist/runtime/polyfill/routeRuntime/url.mjs.map +1 -0
- package/dist/runtime/polyfill/routeRuntime.d.mts +43 -0
- package/dist/runtime/polyfill/routeRuntime.mjs +202 -0
- package/dist/runtime/polyfill/routeRuntime.mjs.map +1 -0
- package/dist/runtime/polyfill/runtimeCapabilityApi.mjs +26 -0
- package/dist/runtime/polyfill/runtimeCapabilityApi.mjs.map +1 -0
- package/dist/runtime/polyfill/runtimeDataApi.d.mts +79 -0
- package/dist/runtime/polyfill/runtimeDataApi.mjs +134 -0
- package/dist/runtime/polyfill/runtimeDataApi.mjs.map +1 -0
- package/dist/runtime/polyfill/runtimeInfra.mjs +40 -0
- package/dist/runtime/polyfill/runtimeInfra.mjs.map +1 -0
- package/dist/runtime/polyfill/runtimeOps.mjs +62 -0
- package/dist/runtime/polyfill/runtimeOps.mjs.map +1 -0
- package/dist/runtime/polyfill/selectorQuery.mjs +204 -0
- package/dist/runtime/polyfill/selectorQuery.mjs.map +1 -0
- package/dist/runtime/polyfill/storage.mjs +103 -0
- package/dist/runtime/polyfill/storage.mjs.map +1 -0
- package/dist/runtime/polyfill/storageAsync.mjs +62 -0
- package/dist/runtime/polyfill/storageAsync.mjs.map +1 -0
- package/dist/runtime/polyfill/subscribe.mjs +30 -0
- package/dist/runtime/polyfill/subscribe.mjs.map +1 -0
- package/dist/runtime/polyfill/system.mjs +111 -0
- package/dist/runtime/polyfill/system.mjs.map +1 -0
- package/dist/runtime/polyfill/systemApi.mjs +65 -0
- package/dist/runtime/polyfill/systemApi.mjs.map +1 -0
- package/dist/runtime/polyfill/types/base.d.mts +12 -0
- package/dist/runtime/polyfill/types/common.d.mts +126 -0
- package/dist/runtime/polyfill/types/locationRuntime.d.mts +151 -0
- package/dist/runtime/polyfill/types/mediaAuth.d.mts +152 -0
- package/dist/runtime/polyfill/types/platformRuntime.d.mts +141 -0
- package/dist/runtime/polyfill/types/systemAuth.d.mts +122 -0
- package/dist/runtime/polyfill/ui.mjs +135 -0
- package/dist/runtime/polyfill/ui.mjs.map +1 -0
- package/dist/runtime/polyfill/uiFeedback.mjs +35 -0
- package/dist/runtime/polyfill/uiFeedback.mjs.map +1 -0
- package/dist/runtime/polyfill/uiMediaApi.d.mts +172 -0
- package/dist/runtime/polyfill/uiMediaApi.mjs +162 -0
- package/dist/runtime/polyfill/uiMediaApi.mjs.map +1 -0
- package/dist/runtime/polyfill/videoContext.mjs +56 -0
- package/dist/runtime/polyfill/videoContext.mjs.map +1 -0
- package/dist/runtime/polyfill/vkSession.mjs +58 -0
- package/dist/runtime/polyfill/vkSession.mjs.map +1 -0
- package/dist/runtime/polyfill/windowResize.mjs +39 -0
- package/dist/runtime/polyfill/windowResize.mjs.map +1 -0
- package/dist/runtime/polyfill/worker.mjs +77 -0
- package/dist/runtime/polyfill/worker.mjs.map +1 -0
- package/dist/runtime/polyfill.d.mts +5 -0
- package/dist/runtime/renderContext.d.mts +21 -0
- package/dist/runtime/renderContext.mjs +147 -0
- package/dist/runtime/renderContext.mjs.map +1 -0
- package/dist/runtime/rpx.d.mts +9 -0
- package/dist/runtime/rpx.mjs +27 -0
- package/dist/runtime/rpx.mjs.map +1 -0
- package/dist/runtime/style.d.mts +6 -0
- package/dist/runtime/style.mjs +37 -0
- package/dist/runtime/style.mjs.map +1 -0
- package/dist/runtime/template.d.mts +10 -0
- package/dist/runtime/warning.d.mts +10 -0
- package/dist/runtime/warning.mjs +43 -0
- package/dist/runtime/warning.mjs.map +1 -0
- package/dist/{slugify-B4l45KNs.mjs → shared/slugify.mjs} +3 -1
- package/dist/shared/slugify.mjs.map +1 -0
- package/dist/shared/wxml.mjs +83 -0
- package/dist/shared/wxml.mjs.map +1 -0
- package/package.json +2 -2
- package/dist/index-w9xxIH-l.d.mts +0 -1229
- package/dist/plugin-BARxSPO8.mjs +0 -1567
- package/dist/plugin-DP2iPVmw.d.mts +0 -96
- package/dist/runtime-D6j2_x_N.mjs +0 -6251
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { callMiniProgramAsyncFailure, callMiniProgramAsyncSuccess } from "../async.mjs";
|
|
2
|
+
import { normalizePreviewMediaSources, openTargetInNewWindow, readOpenVideoEditorPreset } from "../mediaActions.mjs";
|
|
3
|
+
|
|
4
|
+
//#region src/runtime/polyfill/mediaApi/preview.ts
|
|
5
|
+
function previewImageBridge(options) {
|
|
6
|
+
const urls = Array.isArray(options?.urls) ? options.urls.map((url) => String(url).trim()).filter(Boolean) : [];
|
|
7
|
+
if (!urls.length) {
|
|
8
|
+
const failure = callMiniProgramAsyncFailure(options, "previewImage:fail invalid urls");
|
|
9
|
+
return Promise.reject(failure);
|
|
10
|
+
}
|
|
11
|
+
const current = typeof options?.current === "string" && options.current.trim() ? options.current.trim() : urls[0];
|
|
12
|
+
openTargetInNewWindow(urls.includes(current) ? current : urls[0]);
|
|
13
|
+
return Promise.resolve(callMiniProgramAsyncSuccess(options, { errMsg: "previewImage:ok" }));
|
|
14
|
+
}
|
|
15
|
+
function previewMediaBridge(options) {
|
|
16
|
+
const sources = normalizePreviewMediaSources(options?.sources);
|
|
17
|
+
if (!sources.length) {
|
|
18
|
+
const failure = callMiniProgramAsyncFailure(options, "previewMedia:fail invalid sources");
|
|
19
|
+
return Promise.reject(failure);
|
|
20
|
+
}
|
|
21
|
+
openTargetInNewWindow(sources[typeof options?.current === "number" && Number.isFinite(options.current) ? Math.max(0, Math.floor(options.current)) : 0]?.url ?? sources[0].url);
|
|
22
|
+
return Promise.resolve(callMiniProgramAsyncSuccess(options, { errMsg: "previewMedia:ok" }));
|
|
23
|
+
}
|
|
24
|
+
function openVideoEditorBridge(options) {
|
|
25
|
+
const src = typeof options?.src === "string" ? options.src.trim() : "";
|
|
26
|
+
if (!src) {
|
|
27
|
+
const failure = callMiniProgramAsyncFailure(options, "openVideoEditor:fail invalid src");
|
|
28
|
+
return Promise.reject(failure);
|
|
29
|
+
}
|
|
30
|
+
const tempFilePath = readOpenVideoEditorPreset(src) || src;
|
|
31
|
+
return Promise.resolve(callMiniProgramAsyncSuccess(options, {
|
|
32
|
+
errMsg: "openVideoEditor:ok",
|
|
33
|
+
tempFilePath
|
|
34
|
+
}));
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
//#endregion
|
|
38
|
+
export { openVideoEditorBridge, previewImageBridge, previewMediaBridge };
|
|
39
|
+
//# sourceMappingURL=preview.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preview.mjs","names":[],"sources":["../../../../src/runtime/polyfill/mediaApi/preview.ts"],"sourcesContent":["import {\n callMiniProgramAsyncFailure,\n callMiniProgramAsyncSuccess,\n} from '../async'\nimport {\n normalizePreviewMediaSources,\n openTargetInNewWindow,\n readOpenVideoEditorPreset,\n} from '../mediaActions'\n\nexport function previewImageBridge(options?: any) {\n const urls = Array.isArray(options?.urls)\n ? options.urls.map((url: unknown) => String(url).trim()).filter(Boolean)\n : []\n if (!urls.length) {\n const failure = callMiniProgramAsyncFailure(options, 'previewImage:fail invalid urls')\n return Promise.reject(failure)\n }\n const current = typeof options?.current === 'string' && options.current.trim()\n ? options.current.trim()\n : urls[0]\n const target = urls.includes(current) ? current : urls[0]\n openTargetInNewWindow(target)\n return Promise.resolve(callMiniProgramAsyncSuccess(options, { errMsg: 'previewImage:ok' }))\n}\n\nexport function previewMediaBridge(options?: any) {\n const sources = normalizePreviewMediaSources(options?.sources)\n if (!sources.length) {\n const failure = callMiniProgramAsyncFailure(options, 'previewMedia:fail invalid sources')\n return Promise.reject(failure)\n }\n const current = typeof options?.current === 'number' && Number.isFinite(options.current)\n ? Math.max(0, Math.floor(options.current))\n : 0\n const target = sources[current]?.url ?? sources[0].url\n openTargetInNewWindow(target)\n return Promise.resolve(callMiniProgramAsyncSuccess(options, { errMsg: 'previewMedia:ok' }))\n}\n\nexport function openVideoEditorBridge(options?: any) {\n const src = typeof options?.src === 'string' ? options.src.trim() : ''\n if (!src) {\n const failure = callMiniProgramAsyncFailure(options, 'openVideoEditor:fail invalid src')\n return Promise.reject(failure)\n }\n const tempFilePath = readOpenVideoEditorPreset(src) || src\n return Promise.resolve(callMiniProgramAsyncSuccess(options, {\n errMsg: 'openVideoEditor:ok',\n tempFilePath,\n }))\n}\n"],"mappings":";;;;AAUA,SAAgB,mBAAmB,SAAe;CAChD,MAAM,OAAO,MAAM,QAAQ,SAAS,KAAK,GACrC,QAAQ,KAAK,KAAK,QAAiB,OAAO,IAAI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etCompressVideo } from "../mediaInfo.mjs";
|
|
3
|
+
import { compressImageByCanvas, normalizeCompressImageQuality } from "../mediaProcess.mjs";
|
|
4
|
+
|
|
5
|
+
//#region src/runtime/polyfill/mediaApi/process.ts
|
|
6
|
+
async function compressImageBridge(options) {
|
|
7
|
+
const src = typeof options?.src === "string" ? options.src.trim() : "";
|
|
8
|
+
if (!src) {
|
|
9
|
+
const failure = callMiniProgramAsyncFailure(options, "compressImage:fail invalid src");
|
|
10
|
+
return Promise.reject(failure);
|
|
11
|
+
}
|
|
12
|
+
const quality = normalizeCompressImageQuality(options?.quality);
|
|
13
|
+
try {
|
|
14
|
+
return callMiniProgramAsyncSuccess(options, {
|
|
15
|
+
errMsg: "compressImage:ok",
|
|
16
|
+
tempFilePath: await compressImageByCanvas(src, quality)
|
|
17
|
+
});
|
|
18
|
+
} catch (error) {
|
|
19
|
+
const failure = callMiniProgramAsyncFailure(options, `compressImage:fail ${error instanceof Error ? error.message : String(error)}`);
|
|
20
|
+
return Promise.reject(failure);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
function compressVideoBridge(options) {
|
|
24
|
+
const src = typeof options?.src === "string" ? options.src.trim() : "";
|
|
25
|
+
if (!src) {
|
|
26
|
+
const failure = callMiniProgramAsyncFailure(options, "compressVideo:fail invalid src");
|
|
27
|
+
return Promise.reject(failure);
|
|
28
|
+
}
|
|
29
|
+
const result = readPresetCompressVideo(src) ?? {
|
|
30
|
+
tempFilePath: src,
|
|
31
|
+
size: 0,
|
|
32
|
+
duration: 0,
|
|
33
|
+
width: 0,
|
|
34
|
+
height: 0,
|
|
35
|
+
bitrate: 0,
|
|
36
|
+
fps: 0
|
|
37
|
+
};
|
|
38
|
+
return Promise.resolve(callMiniProgramAsyncSuccess(options, {
|
|
39
|
+
errMsg: "compressVideo:ok",
|
|
40
|
+
...result
|
|
41
|
+
}));
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
//#endregion
|
|
45
|
+
export { compressImageBridge, compressVideoBridge };
|
|
46
|
+
//# sourceMappingURL=process.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"process.mjs","names":[],"sources":["../../../../src/runtime/polyfill/mediaApi/process.ts"],"sourcesContent":["import {\n callMiniProgramAsyncFailure,\n callMiniProgramAsyncSuccess,\n} from '../async'\nimport { readPresetCompressVideo } from '../mediaInfo'\nimport {\n compressImageByCanvas,\n normalizeCompressImageQuality,\n} from '../mediaProcess'\n\nexport async function compressImageBridge(options?: any) {\n const src = typeof options?.src === 'string' ? options.src.trim() : ''\n if (!src) {\n const failure = callMiniProgramAsyncFailure(options, 'compressImage:fail invalid src')\n return Promise.reject(failure)\n }\n const quality = normalizeCompressImageQuality(options?.quality)\n try {\n const tempFilePath = await compressImageByCanvas(src, quality)\n return callMiniProgramAsyncSuccess(options, {\n errMsg: 'compressImage:ok',\n tempFilePath,\n })\n }\n catch (error) {\n const message = error instanceof Error ? error.message : String(error)\n const failure = callMiniProgramAsyncFailure(options, `compressImage:fail ${message}`)\n return Promise.reject(failure)\n }\n}\n\nexport function compressVideoBridge(options?: any) {\n const src = typeof options?.src === 'string' ? options.src.trim() : ''\n if (!src) {\n const failure = callMiniProgramAsyncFailure(options, 'compressVideo:fail invalid src')\n return Promise.reject(failure)\n }\n const preset = readPresetCompressVideo(src)\n const result = preset ?? {\n tempFilePath: src,\n size: 0,\n duration: 0,\n width: 0,\n height: 0,\n bitrate: 0,\n fps: 0,\n }\n return Promise.resolve(callMiniProgramAsyncSuccess(options, {\n errMsg: 'compressVideo:ok',\n ...result,\n }))\n}\n"],"mappings":";;;;;AAUA,eAAsB,oBAAoB,SAAe;CACvD,MAAM,MAAM,OAAO,SAAS,QAAQ,WAAW,QAAQ,IAAI,MAAM,GAAG;AACpE,KAAI,CAAC,KAAK;EACR,MAAM,UAAU,4BAA4B,SAAS,iCAAiC;AACtF,SAAO,QAAQ,OAAO,QAAQ;;CAEhC,MAAM,UAAU,8BAA8B,SAAS,QAAQ;AAC/D,KAAI;AAEF,SAAO,4BAA4B,SAAS;GAC1C,QAAQ;GACR,cAHmB,MAAM,sBAAsB,KAAK,QAAQ;GAI7D,CAAC;UAEG,OAAO;EAEZ,MAAM,UAAU,4BAA4B,SAAS,sBADrC,iBAAiB,QAAQ,MAAM,UAAU,OAAO,MAAM,GACe;AACrF,SAAO,QAAQ,OAAO,QAAQ;;;AAIlC,SAAgB,oBAAoB,SAAe;CACjD,MAAM,MAAM,OAAO,SAAS,QAAQ,WAAW,QAAQ,IAAI,MAAM,GAAG;AACpE,KAAI,CAAC,KAAK;EACR,MAAM,UAAU,4BAA4B,SAAS,iCAAiC;AACtF,SAAO,QAAQ,OAAO,QAAQ;;CAGhC,MAAM,SADS,wBAAwB,IAAI,IAClB;EACvB,cAAc;EACd,MAAM;EACN,UAAU;EACV,OAAO;EACP,QAAQ;EACR,SAAS;EACT,KAAK;EACN;AACD,QAAO,QAAQ,QAAQ,4BAA4B,SAAS;EAC1D,QAAQ;EACR,GAAG;EACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { WEAPP_VITE_WEB_COMPRESS_VIDEO_KEY, WEAPP_VITE_WEB_VIDEO_INFO_KEY } from "@weapp-core/constants";
|
|
2
|
+
|
|
3
|
+
//#region src/runtime/polyfill/mediaInfo.ts
|
|
4
|
+
function inferImageTypeFromPath(path) {
|
|
5
|
+
const lower = path.toLowerCase();
|
|
6
|
+
if (lower.includes(".png")) return "png";
|
|
7
|
+
if (lower.includes(".jpg") || lower.includes(".jpeg")) return "jpg";
|
|
8
|
+
if (lower.includes(".gif")) return "gif";
|
|
9
|
+
if (lower.includes(".webp")) return "webp";
|
|
10
|
+
if (lower.includes(".bmp")) return "bmp";
|
|
11
|
+
if (lower.includes(".svg")) return "svg";
|
|
12
|
+
if (lower.includes(".avif")) return "avif";
|
|
13
|
+
return "unknown";
|
|
14
|
+
}
|
|
15
|
+
function inferVideoTypeFromPath(path) {
|
|
16
|
+
const lower = path.toLowerCase();
|
|
17
|
+
if (lower.includes(".mp4")) return "mp4";
|
|
18
|
+
if (lower.includes(".mov")) return "mov";
|
|
19
|
+
if (lower.includes(".m4v")) return "m4v";
|
|
20
|
+
if (lower.includes(".webm")) return "webm";
|
|
21
|
+
if (lower.includes(".avi")) return "avi";
|
|
22
|
+
if (lower.includes(".mkv")) return "mkv";
|
|
23
|
+
return "unknown";
|
|
24
|
+
}
|
|
25
|
+
function normalizeVideoInfoNumber(value) {
|
|
26
|
+
if (typeof value !== "number" || Number.isNaN(value) || value < 0) return 0;
|
|
27
|
+
return value;
|
|
28
|
+
}
|
|
29
|
+
function normalizeVideoInfoPreset(value, src) {
|
|
30
|
+
if (!value || typeof value !== "object") return null;
|
|
31
|
+
const info = value;
|
|
32
|
+
return {
|
|
33
|
+
size: normalizeVideoInfoNumber(info.size),
|
|
34
|
+
duration: normalizeVideoInfoNumber(info.duration),
|
|
35
|
+
width: normalizeVideoInfoNumber(info.width),
|
|
36
|
+
height: normalizeVideoInfoNumber(info.height),
|
|
37
|
+
fps: normalizeVideoInfoNumber(info.fps),
|
|
38
|
+
bitrate: normalizeVideoInfoNumber(info.bitrate),
|
|
39
|
+
type: typeof info.type === "string" ? info.type : inferVideoTypeFromPath(src),
|
|
40
|
+
orientation: "up"
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
function readPresetVideoInfo(src) {
|
|
44
|
+
const preset = globalThis[WEAPP_VITE_WEB_VIDEO_INFO_KEY];
|
|
45
|
+
if (typeof preset === "function") return normalizeVideoInfoPreset(preset(src), src);
|
|
46
|
+
if (preset && typeof preset === "object") {
|
|
47
|
+
const sourcePreset = preset[src];
|
|
48
|
+
if (sourcePreset && typeof sourcePreset === "object") return normalizeVideoInfoPreset(sourcePreset, src);
|
|
49
|
+
return normalizeVideoInfoPreset(preset, src);
|
|
50
|
+
}
|
|
51
|
+
return null;
|
|
52
|
+
}
|
|
53
|
+
function normalizeCompressVideoResult(value, src) {
|
|
54
|
+
if (!value || typeof value !== "object") return null;
|
|
55
|
+
const info = value;
|
|
56
|
+
return {
|
|
57
|
+
tempFilePath: typeof info.tempFilePath === "string" && info.tempFilePath.trim() ? info.tempFilePath.trim() : src,
|
|
58
|
+
size: normalizeVideoInfoNumber(info.size),
|
|
59
|
+
duration: normalizeVideoInfoNumber(info.duration),
|
|
60
|
+
width: normalizeVideoInfoNumber(info.width),
|
|
61
|
+
height: normalizeVideoInfoNumber(info.height),
|
|
62
|
+
bitrate: normalizeVideoInfoNumber(info.bitrate),
|
|
63
|
+
fps: normalizeVideoInfoNumber(info.fps)
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
function readPresetCompressVideo(src) {
|
|
67
|
+
const preset = globalThis[WEAPP_VITE_WEB_COMPRESS_VIDEO_KEY];
|
|
68
|
+
if (typeof preset === "function") return normalizeCompressVideoResult(preset(src), src);
|
|
69
|
+
if (preset && typeof preset === "object") {
|
|
70
|
+
const sourcePreset = preset[src];
|
|
71
|
+
if (sourcePreset && typeof sourcePreset === "object") return normalizeCompressVideoResult(sourcePreset, src);
|
|
72
|
+
return normalizeCompressVideoResult(preset, src);
|
|
73
|
+
}
|
|
74
|
+
if (typeof preset === "string" && preset.trim()) return {
|
|
75
|
+
tempFilePath: preset.trim(),
|
|
76
|
+
size: 0,
|
|
77
|
+
duration: 0,
|
|
78
|
+
width: 0,
|
|
79
|
+
height: 0,
|
|
80
|
+
bitrate: 0,
|
|
81
|
+
fps: 0
|
|
82
|
+
};
|
|
83
|
+
return null;
|
|
84
|
+
}
|
|
85
|
+
async function readImageInfoFromSource(src) {
|
|
86
|
+
const ImageCtor = globalThis.Image;
|
|
87
|
+
if (typeof ImageCtor !== "function") throw new TypeError("Image is unavailable");
|
|
88
|
+
return new Promise((resolve, reject) => {
|
|
89
|
+
const image = new ImageCtor();
|
|
90
|
+
image.onload = () => {
|
|
91
|
+
const width = Number(image.naturalWidth ?? image.width ?? 0);
|
|
92
|
+
const height = Number(image.naturalHeight ?? image.height ?? 0);
|
|
93
|
+
resolve({
|
|
94
|
+
width: Number.isFinite(width) ? width : 0,
|
|
95
|
+
height: Number.isFinite(height) ? height : 0
|
|
96
|
+
});
|
|
97
|
+
};
|
|
98
|
+
image.onerror = () => {
|
|
99
|
+
reject(/* @__PURE__ */ new Error("image load error"));
|
|
100
|
+
};
|
|
101
|
+
image.src = src;
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
async function readVideoInfoFromSource(src) {
|
|
105
|
+
if (typeof document === "undefined" || typeof document.createElement !== "function") throw new TypeError("video element is unavailable");
|
|
106
|
+
const video = document.createElement("video");
|
|
107
|
+
if (!video || typeof video.addEventListener !== "function") throw new Error("video element is unavailable");
|
|
108
|
+
return new Promise((resolve, reject) => {
|
|
109
|
+
const cleanup = () => {
|
|
110
|
+
if (typeof video.removeEventListener === "function") {
|
|
111
|
+
video.removeEventListener("loadedmetadata", onLoadedMetadata);
|
|
112
|
+
video.removeEventListener("error", onError);
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
const onLoadedMetadata = () => {
|
|
116
|
+
cleanup();
|
|
117
|
+
resolve({
|
|
118
|
+
duration: normalizeVideoInfoNumber(video.duration),
|
|
119
|
+
width: normalizeVideoInfoNumber(video.videoWidth),
|
|
120
|
+
height: normalizeVideoInfoNumber(video.videoHeight)
|
|
121
|
+
});
|
|
122
|
+
};
|
|
123
|
+
const onError = () => {
|
|
124
|
+
cleanup();
|
|
125
|
+
reject(/* @__PURE__ */ new Error("video load error"));
|
|
126
|
+
};
|
|
127
|
+
video.addEventListener("loadedmetadata", onLoadedMetadata, { once: true });
|
|
128
|
+
video.addEventListener("error", onError, { once: true });
|
|
129
|
+
video.src = src;
|
|
130
|
+
video.load?.();
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
//#endregion
|
|
135
|
+
export { inferImageTypeFromPath, inferVideoTypeFromPath, normalizeVideoInfoNumber, readImageInfoFromSource, readPresetCompressVideo, readPresetVideoInfo, readVideoInfoFromSource };
|
|
136
|
+
//# sourceMappingURL=mediaInfo.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mediaInfo.mjs","names":[],"sources":["../../../src/runtime/polyfill/mediaInfo.ts"],"sourcesContent":["import {\n WEAPP_VITE_WEB_COMPRESS_VIDEO_KEY,\n WEAPP_VITE_WEB_VIDEO_INFO_KEY,\n} from '@weapp-core/constants'\n\nexport function inferImageTypeFromPath(path: string) {\n const lower = path.toLowerCase()\n if (lower.includes('.png')) {\n return 'png'\n }\n if (lower.includes('.jpg') || lower.includes('.jpeg')) {\n return 'jpg'\n }\n if (lower.includes('.gif')) {\n return 'gif'\n }\n if (lower.includes('.webp')) {\n return 'webp'\n }\n if (lower.includes('.bmp')) {\n return 'bmp'\n }\n if (lower.includes('.svg')) {\n return 'svg'\n }\n if (lower.includes('.avif')) {\n return 'avif'\n }\n return 'unknown'\n}\n\nexport function inferVideoTypeFromPath(path: string) {\n const lower = path.toLowerCase()\n if (lower.includes('.mp4')) {\n return 'mp4'\n }\n if (lower.includes('.mov')) {\n return 'mov'\n }\n if (lower.includes('.m4v')) {\n return 'm4v'\n }\n if (lower.includes('.webm')) {\n return 'webm'\n }\n if (lower.includes('.avi')) {\n return 'avi'\n }\n if (lower.includes('.mkv')) {\n return 'mkv'\n }\n return 'unknown'\n}\n\nexport function normalizeVideoInfoNumber(value: unknown) {\n if (typeof value !== 'number' || Number.isNaN(value) || value < 0) {\n return 0\n }\n return value\n}\n\nfunction normalizeVideoInfoPreset(value: unknown, src: string) {\n if (!value || typeof value !== 'object') {\n return null\n }\n const info = value as Record<string, unknown>\n return {\n size: normalizeVideoInfoNumber(info.size),\n duration: normalizeVideoInfoNumber(info.duration),\n width: normalizeVideoInfoNumber(info.width),\n height: normalizeVideoInfoNumber(info.height),\n fps: normalizeVideoInfoNumber(info.fps),\n bitrate: normalizeVideoInfoNumber(info.bitrate),\n type: typeof info.type === 'string' ? info.type : inferVideoTypeFromPath(src),\n orientation: 'up' as const,\n }\n}\n\nexport function readPresetVideoInfo(src: string) {\n const runtimeGlobal = globalThis as Record<string, unknown>\n const preset = runtimeGlobal[WEAPP_VITE_WEB_VIDEO_INFO_KEY]\n if (typeof preset === 'function') {\n return normalizeVideoInfoPreset((preset as (value: string) => unknown)(src), src)\n }\n if (preset && typeof preset === 'object') {\n const sourcePreset = (preset as Record<string, unknown>)[src]\n if (sourcePreset && typeof sourcePreset === 'object') {\n return normalizeVideoInfoPreset(sourcePreset, src)\n }\n return normalizeVideoInfoPreset(preset, src)\n }\n return null\n}\n\nfunction normalizeCompressVideoResult(value: unknown, src: string) {\n if (!value || typeof value !== 'object') {\n return null\n }\n const info = value as Record<string, unknown>\n const tempFilePath = typeof info.tempFilePath === 'string' && info.tempFilePath.trim()\n ? info.tempFilePath.trim()\n : src\n return {\n tempFilePath,\n size: normalizeVideoInfoNumber(info.size),\n duration: normalizeVideoInfoNumber(info.duration),\n width: normalizeVideoInfoNumber(info.width),\n height: normalizeVideoInfoNumber(info.height),\n bitrate: normalizeVideoInfoNumber(info.bitrate),\n fps: normalizeVideoInfoNumber(info.fps),\n }\n}\n\nexport function readPresetCompressVideo(src: string) {\n const runtimeGlobal = globalThis as Record<string, unknown>\n const preset = runtimeGlobal[WEAPP_VITE_WEB_COMPRESS_VIDEO_KEY]\n if (typeof preset === 'function') {\n return normalizeCompressVideoResult((preset as (value: string) => unknown)(src), src)\n }\n if (preset && typeof preset === 'object') {\n const sourcePreset = (preset as Record<string, unknown>)[src]\n if (sourcePreset && typeof sourcePreset === 'object') {\n return normalizeCompressVideoResult(sourcePreset, src)\n }\n return normalizeCompressVideoResult(preset, src)\n }\n if (typeof preset === 'string' && preset.trim()) {\n return {\n tempFilePath: preset.trim(),\n size: 0,\n duration: 0,\n width: 0,\n height: 0,\n bitrate: 0,\n fps: 0,\n }\n }\n return null\n}\n\nexport async function readImageInfoFromSource(src: string) {\n const ImageCtor = (globalThis as { Image?: typeof Image }).Image\n if (typeof ImageCtor !== 'function') {\n throw new TypeError('Image is unavailable')\n }\n return new Promise<{ width: number, height: number }>((resolve, reject) => {\n const image = new ImageCtor()\n image.onload = () => {\n const width = Number((image as { naturalWidth?: number }).naturalWidth ?? image.width ?? 0)\n const height = Number((image as { naturalHeight?: number }).naturalHeight ?? image.height ?? 0)\n resolve({\n width: Number.isFinite(width) ? width : 0,\n height: Number.isFinite(height) ? height : 0,\n })\n }\n image.onerror = () => {\n reject(new Error('image load error'))\n }\n image.src = src\n })\n}\n\nexport async function readVideoInfoFromSource(src: string) {\n if (typeof document === 'undefined' || typeof document.createElement !== 'function') {\n throw new TypeError('video element is unavailable')\n }\n const video = document.createElement('video') as HTMLVideoElement\n if (!video || typeof video.addEventListener !== 'function') {\n throw new Error('video element is unavailable')\n }\n return new Promise<{ duration: number, width: number, height: number }>((resolve, reject) => {\n const cleanup = () => {\n if (typeof video.removeEventListener === 'function') {\n // eslint-disable-next-line ts/no-use-before-define\n video.removeEventListener('loadedmetadata', onLoadedMetadata)\n // eslint-disable-next-line ts/no-use-before-define\n video.removeEventListener('error', onError)\n }\n }\n const onLoadedMetadata = () => {\n cleanup()\n resolve({\n duration: normalizeVideoInfoNumber(video.duration),\n width: normalizeVideoInfoNumber((video as { videoWidth?: number }).videoWidth),\n height: normalizeVideoInfoNumber((video as { videoHeight?: number }).videoHeight),\n })\n }\n const onError = () => {\n cleanup()\n reject(new Error('video load error'))\n }\n video.addEventListener('loadedmetadata', onLoadedMetadata, { once: true })\n video.addEventListener('error', onError, { once: true })\n video.src = src\n video.load?.()\n })\n}\n"],"mappings":";;;AAKA,SAAgB,uBAAuB,MAAc;CACnD,MAAM,QAAQ,KAAK,aAAa;AAChC,KAAI,MAAM,SAAS,OAAO,CACxB,QAAO;AAET,KAAI,MAAM,SAAS,OAAO,IAAI,MAAM,SAAS,QAAQ,CACnD,QAAO;AAET,KAAI,MAAM,SAAS,OAAO,CACxB,QAAO;AAET,KAAI,MAAM,SAAS,QAAQ,CACzB,QAAO;AA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ACN,OAAO,OAAO,SAAS,MAAM,GAAG,QAAQ;IACxC,QAAQ,OAAO,SAAS,OAAO,GAAG,SAAS;IAC5C,CAAC;;AAEJ,QAAM,gBAAgB;AACpB,0BAAO,IAAI,MAAM,mBAAmB,CAAC;;AAEvC,QAAM,MAAM;GACZ;;AAGJ,eAAsB,wBAAwB,KAAa;AACzD,KAAI,OAAO,aAAa,eAAe,OAAO,SAAS,kBAAkB,WACvE,OAAM,IAAI,UAAU,+BAA+B;CAErD,MAAM,QAAQ,SAAS,cAAc,QAAQ;AAC7C,KAAI,CAAC,SAAS,OAAO,MAAM,qBAAqB,WAC9C,OAAM,IAAI,MAAM,+BAA+B;AAEjD,QAAO,IAAI,SAA8D,SAAS,WAAW;EAC3F,MAAM,gBAAgB;AACpB,OAAI,OAAO,MAAM,wBAAwB,YAAY;AAEnD,UAAM,oBAAoB,kBAAkB,iBAAiB;AAE7D,UAAM,oBAAoB,SAAS,QAAQ;;;EAG/C,MAAM,yBAAyB;AAC7B,YAAS;AACT,WAAQ;IACN,UAAU,yBAAyB,MAAM,SAAS;IAClD,OAAO,yBAA0B,MAAkC,WAAW;IAC9E,QAAQ,yBAA0B,MAAmC,YAAY;IAClF,CAAC;;EAEJ,MAAM,gBAAgB;AACpB,YAAS;AACT,0BAAO,IAAI,MAAM,mBAAmB,CAAC;;AAEvC,QAAM,iBAAiB,kBAAkB,kBAAkB,EAAE,MAAM,MAAM,CAAC;AAC1E,QAAM,iBAAiB,SAAS,SAAS,EAAE,MAAM,MAAM,CAAC;AACxD,QAAM,MAAM;AACZ,QAAM,QAAQ;GACd"}
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
//#region src/runtime/polyfill/mediaPicker.ts
|
|
2
|
+
function normalizeChooseImageCount(count) {
|
|
3
|
+
if (typeof count !== "number" || Number.isNaN(count)) return 9;
|
|
4
|
+
return Math.max(1, Math.floor(count));
|
|
5
|
+
}
|
|
6
|
+
function createTempFilePath(file) {
|
|
7
|
+
const runtimeUrl = globalThis.URL;
|
|
8
|
+
if (runtimeUrl && typeof runtimeUrl.createObjectURL === "function") {
|
|
9
|
+
const result = runtimeUrl.createObjectURL(file);
|
|
10
|
+
if (result) return result;
|
|
11
|
+
}
|
|
12
|
+
return file.name ?? "";
|
|
13
|
+
}
|
|
14
|
+
function normalizeChooseImageFile(file) {
|
|
15
|
+
return {
|
|
16
|
+
path: createTempFilePath(file),
|
|
17
|
+
size: typeof file.size === "number" ? file.size : 0,
|
|
18
|
+
type: typeof file.type === "string" ? file.type : "",
|
|
19
|
+
name: typeof file.name === "string" ? file.name : ""
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
async function pickImageFilesByOpenPicker(count) {
|
|
23
|
+
const picker = globalThis.showOpenFilePicker;
|
|
24
|
+
if (typeof picker !== "function") return null;
|
|
25
|
+
const handles = await picker({
|
|
26
|
+
multiple: count > 1,
|
|
27
|
+
types: [{
|
|
28
|
+
description: "Images",
|
|
29
|
+
accept: { "image/*": [
|
|
30
|
+
".png",
|
|
31
|
+
".jpg",
|
|
32
|
+
".jpeg",
|
|
33
|
+
".gif",
|
|
34
|
+
".webp",
|
|
35
|
+
".bmp",
|
|
36
|
+
".svg",
|
|
37
|
+
".avif"
|
|
38
|
+
] }
|
|
39
|
+
}]
|
|
40
|
+
});
|
|
41
|
+
const files = [];
|
|
42
|
+
for (const handle of handles ?? []) {
|
|
43
|
+
const file = await handle?.getFile?.();
|
|
44
|
+
if (file) files.push(file);
|
|
45
|
+
if (files.length >= count) break;
|
|
46
|
+
}
|
|
47
|
+
return files;
|
|
48
|
+
}
|
|
49
|
+
async function pickImageFilesByInput(count) {
|
|
50
|
+
if (typeof document === "undefined" || typeof document.createElement !== "function") return null;
|
|
51
|
+
const input = document.createElement("input");
|
|
52
|
+
if (!input || typeof input !== "object") return null;
|
|
53
|
+
input.setAttribute("type", "file");
|
|
54
|
+
input.setAttribute("accept", "image/*");
|
|
55
|
+
if (count > 1) input.setAttribute("multiple", "true");
|
|
56
|
+
input.setAttribute("style", "position: fixed; left: -9999px; top: -9999px; opacity: 0;");
|
|
57
|
+
if (document.body) document.body.append(input);
|
|
58
|
+
try {
|
|
59
|
+
return await new Promise((resolve, reject) => {
|
|
60
|
+
const onChange = () => {
|
|
61
|
+
const selected = input.files ? Array.from(input.files) : [];
|
|
62
|
+
if (selected.length) {
|
|
63
|
+
resolve(selected.slice(0, count));
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
reject(/* @__PURE__ */ new Error("no file selected"));
|
|
67
|
+
};
|
|
68
|
+
input.addEventListener("change", onChange, { once: true });
|
|
69
|
+
if (typeof input.click === "function") {
|
|
70
|
+
input.click();
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
reject(/* @__PURE__ */ new Error("file input click is unavailable"));
|
|
74
|
+
});
|
|
75
|
+
} finally {
|
|
76
|
+
if (input.parentNode) input.parentNode.removeChild(input);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
async function pickChooseImageFiles(count) {
|
|
80
|
+
const viaPicker = await pickImageFilesByOpenPicker(count);
|
|
81
|
+
if (Array.isArray(viaPicker)) return viaPicker;
|
|
82
|
+
const viaInput = await pickImageFilesByInput(count);
|
|
83
|
+
if (Array.isArray(viaInput)) return viaInput;
|
|
84
|
+
throw new TypeError("Image picker is unavailable in current environment.");
|
|
85
|
+
}
|
|
86
|
+
function normalizeChooseMediaCount(count) {
|
|
87
|
+
if (typeof count !== "number" || Number.isNaN(count)) return 1;
|
|
88
|
+
return Math.max(1, Math.floor(count));
|
|
89
|
+
}
|
|
90
|
+
function normalizeChooseMediaTypes(mediaType) {
|
|
91
|
+
const normalized = /* @__PURE__ */ new Set();
|
|
92
|
+
for (const item of mediaType ?? []) {
|
|
93
|
+
if (item === "image") {
|
|
94
|
+
normalized.add("image");
|
|
95
|
+
continue;
|
|
96
|
+
}
|
|
97
|
+
if (item === "video") {
|
|
98
|
+
normalized.add("video");
|
|
99
|
+
continue;
|
|
100
|
+
}
|
|
101
|
+
if (item === "mix") {
|
|
102
|
+
normalized.add("image");
|
|
103
|
+
normalized.add("video");
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
if (normalized.size === 0) {
|
|
107
|
+
normalized.add("image");
|
|
108
|
+
normalized.add("video");
|
|
109
|
+
}
|
|
110
|
+
return normalized;
|
|
111
|
+
}
|
|
112
|
+
function buildChooseMediaOpenPickerAccept(types) {
|
|
113
|
+
const accept = {};
|
|
114
|
+
if (types.has("image")) accept["image/*"] = [
|
|
115
|
+
".png",
|
|
116
|
+
".jpg",
|
|
117
|
+
".jpeg",
|
|
118
|
+
".gif",
|
|
119
|
+
".webp",
|
|
120
|
+
".bmp",
|
|
121
|
+
".svg",
|
|
122
|
+
".avif"
|
|
123
|
+
];
|
|
124
|
+
if (types.has("video")) accept["video/*"] = [
|
|
125
|
+
".mp4",
|
|
126
|
+
".mov",
|
|
127
|
+
".m4v",
|
|
128
|
+
".webm"
|
|
129
|
+
];
|
|
130
|
+
return accept;
|
|
131
|
+
}
|
|
132
|
+
function buildChooseMediaInputAccept(types) {
|
|
133
|
+
if (types.size === 2) return "image/*,video/*";
|
|
134
|
+
return types.has("video") ? "video/*" : "image/*";
|
|
135
|
+
}
|
|
136
|
+
function inferChooseMediaFileType(file) {
|
|
137
|
+
const mimeType = typeof file.type === "string" ? file.type.toLowerCase() : "";
|
|
138
|
+
if (mimeType.startsWith("video/")) return "video";
|
|
139
|
+
if (mimeType.startsWith("image/")) return "image";
|
|
140
|
+
const fileName = typeof file.name === "string" ? file.name.toLowerCase() : "";
|
|
141
|
+
if (/\.(?:mp4|mov|m4v|webm)$/i.test(fileName)) return "video";
|
|
142
|
+
return "image";
|
|
143
|
+
}
|
|
144
|
+
function normalizeChooseMediaFile(file) {
|
|
145
|
+
const fileType = inferChooseMediaFileType(file);
|
|
146
|
+
return {
|
|
147
|
+
tempFilePath: createTempFilePath(file),
|
|
148
|
+
size: typeof file.size === "number" ? file.size : 0,
|
|
149
|
+
fileType,
|
|
150
|
+
width: 0,
|
|
151
|
+
height: 0,
|
|
152
|
+
duration: 0
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
async function pickMediaFilesByOpenPicker(count, types) {
|
|
156
|
+
const picker = globalThis.showOpenFilePicker;
|
|
157
|
+
if (typeof picker !== "function") return null;
|
|
158
|
+
const handles = await picker({
|
|
159
|
+
multiple: count > 1,
|
|
160
|
+
types: [{
|
|
161
|
+
description: "Media",
|
|
162
|
+
accept: buildChooseMediaOpenPickerAccept(types)
|
|
163
|
+
}]
|
|
164
|
+
});
|
|
165
|
+
const files = [];
|
|
166
|
+
for (const handle of handles ?? []) {
|
|
167
|
+
const file = await handle?.getFile?.();
|
|
168
|
+
if (file) files.push(file);
|
|
169
|
+
if (files.length >= count) break;
|
|
170
|
+
}
|
|
171
|
+
return files;
|
|
172
|
+
}
|
|
173
|
+
async function pickMediaFilesByInput(count, types) {
|
|
174
|
+
if (typeof document === "undefined" || typeof document.createElement !== "function") return null;
|
|
175
|
+
const input = document.createElement("input");
|
|
176
|
+
if (!input || typeof input !== "object") return null;
|
|
177
|
+
input.setAttribute("type", "file");
|
|
178
|
+
input.setAttribute("accept", buildChooseMediaInputAccept(types));
|
|
179
|
+
if (count > 1) input.setAttribute("multiple", "true");
|
|
180
|
+
input.setAttribute("style", "position: fixed; left: -9999px; top: -9999px; opacity: 0;");
|
|
181
|
+
if (document.body) document.body.append(input);
|
|
182
|
+
try {
|
|
183
|
+
return await new Promise((resolve, reject) => {
|
|
184
|
+
const onChange = () => {
|
|
185
|
+
const selected = input.files ? Array.from(input.files) : [];
|
|
186
|
+
if (selected.length) {
|
|
187
|
+
resolve(selected.slice(0, count));
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
190
|
+
reject(/* @__PURE__ */ new Error("no file selected"));
|
|
191
|
+
};
|
|
192
|
+
input.addEventListener("change", onChange, { once: true });
|
|
193
|
+
if (typeof input.click === "function") {
|
|
194
|
+
input.click();
|
|
195
|
+
return;
|
|
196
|
+
}
|
|
197
|
+
reject(/* @__PURE__ */ new Error("file input click is unavailable"));
|
|
198
|
+
});
|
|
199
|
+
} finally {
|
|
200
|
+
if (input.parentNode) input.parentNode.removeChild(input);
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
async function pickChooseMediaFiles(count, types) {
|
|
204
|
+
const viaPicker = await pickMediaFilesByOpenPicker(count, types);
|
|
205
|
+
if (Array.isArray(viaPicker)) return viaPicker;
|
|
206
|
+
const viaInput = await pickMediaFilesByInput(count, types);
|
|
207
|
+
if (Array.isArray(viaInput)) return viaInput;
|
|
208
|
+
throw new TypeError("Media picker is unavailable in current environment.");
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
//#endregion
|
|
212
|
+
export { createTempFilePath, inferChooseMediaFileType, normalizeChooseImageCount, normalizeChooseImageFile, normalizeChooseMediaCount, normalizeChooseMediaFile, normalizeChooseMediaTypes, pickChooseImageFiles, pickChooseMediaFiles };
|
|
213
|
+
//# sourceMappingURL=mediaPicker.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mediaPicker.mjs","names":[],"sources":["../../../src/runtime/polyfill/mediaPicker.ts"],"sourcesContent":["type ChooseMediaType = 'image' | 'video'\n\ntype RawChooseMediaType = ChooseMediaType | 'mix'\n\nexport function normalizeChooseImageCount(count: number | undefined) {\n if (typeof count !== 'number' || Number.isNaN(count)) {\n return 9\n }\n return Math.max(1, Math.floor(count))\n}\n\nexport function createTempFilePath(file: { name?: string }) {\n const runtimeUrl = (globalThis as {\n URL?: {\n createObjectURL?: (value: unknown) => string\n }\n }).URL\n if (runtimeUrl && typeof runtimeUrl.createObjectURL === 'function') {\n const result = runtimeUrl.createObjectURL(file)\n if (result) {\n return result\n }\n }\n return file.name ?? ''\n}\n\nexport function normalizeChooseImageFile(file: {\n size?: number\n type?: string\n name?: string\n}) {\n return {\n path: createTempFilePath(file),\n size: typeof file.size === 'number' ? file.size : 0,\n type: typeof file.type === 'string' ? file.type : '',\n name: typeof file.name === 'string' ? file.name : '',\n }\n}\n\nasync function pickImageFilesByOpenPicker(count: number) {\n const picker = (globalThis as {\n showOpenFilePicker?: (options: {\n multiple?: boolean\n types?: Array<{\n description?: string\n accept?: Record<string, string[]>\n }>\n }) => Promise<Array<{ getFile?: () => Promise<any> }>>\n }).showOpenFilePicker\n if (typeof picker !== 'function') {\n return null\n }\n const handles = await picker({\n multiple: count > 1,\n types: [{\n description: 'Images',\n accept: {\n 'image/*': ['.png', '.jpg', '.jpeg', '.gif', '.webp', '.bmp', '.svg', '.avif'],\n },\n }],\n })\n const files: any[] = []\n for (const handle of handles ?? []) {\n const file = await handle?.getFile?.()\n if (file) {\n files.push(file)\n }\n if (files.length >= count) {\n break\n }\n }\n return files\n}\n\nasync function pickImageFilesByInput(count: number) {\n if (typeof document === 'undefined' || typeof document.createElement !== 'function') {\n return null\n }\n const input = document.createElement('input') as HTMLInputElement\n if (!input || typeof input !== 'object') {\n return null\n }\n input.setAttribute('type', 'file')\n input.setAttribute('accept', 'image/*')\n if (count > 1) {\n input.setAttribute('multiple', 'true')\n }\n input.setAttribute('style', 'position: fixed; left: -9999px; top: -9999px; opacity: 0;')\n if (document.body) {\n document.body.append(input)\n }\n try {\n const files = await new Promise<any[]>((resolve, reject) => {\n const onChange = () => {\n const selected = input.files ? Array.from(input.files) : []\n if (selected.length) {\n resolve(selected.slice(0, count))\n return\n }\n reject(new Error('no file selected'))\n }\n input.addEventListener('change', onChange, { once: true })\n if (typeof input.click === 'function') {\n input.click()\n return\n }\n reject(new Error('file input click is unavailable'))\n })\n return files\n }\n finally {\n if (input.parentNode) {\n input.parentNode.removeChild(input)\n }\n }\n}\n\nexport async function pickChooseImageFiles(count: number) {\n const viaPicker = await pickImageFilesByOpenPicker(count)\n if (Array.isArray(viaPicker)) {\n return viaPicker\n }\n const viaInput = await pickImageFilesByInput(count)\n if (Array.isArray(viaInput)) {\n return viaInput\n }\n throw new TypeError('Image picker is unavailable in current environment.')\n}\n\nexport function normalizeChooseMediaCount(count: number | undefined) {\n if (typeof count !== 'number' || Number.isNaN(count)) {\n return 1\n }\n return Math.max(1, Math.floor(count))\n}\n\nexport function normalizeChooseMediaTypes(mediaType: RawChooseMediaType[] | undefined) {\n const normalized = new Set<ChooseMediaType>()\n for (const item of mediaType ?? []) {\n if (item === 'image') {\n normalized.add('image')\n continue\n }\n if (item === 'video') {\n normalized.add('video')\n continue\n }\n if (item === 'mix') {\n normalized.add('image')\n normalized.add('video')\n }\n }\n if (normalized.size === 0) {\n normalized.add('image')\n normalized.add('video')\n }\n return normalized\n}\n\nfunction buildChooseMediaOpenPickerAccept(types: Set<ChooseMediaType>) {\n const accept: Record<string, string[]> = {}\n if (types.has('image')) {\n accept['image/*'] = ['.png', '.jpg', '.jpeg', '.gif', '.webp', '.bmp', '.svg', '.avif']\n }\n if (types.has('video')) {\n accept['video/*'] = ['.mp4', '.mov', '.m4v', '.webm']\n }\n return accept\n}\n\nfunction buildChooseMediaInputAccept(types: Set<ChooseMediaType>) {\n if (types.size === 2) {\n return 'image/*,video/*'\n }\n return types.has('video') ? 'video/*' : 'image/*'\n}\n\nexport function inferChooseMediaFileType(file: { type?: string, name?: string }): ChooseMediaType {\n const mimeType = typeof file.type === 'string' ? file.type.toLowerCase() : ''\n if (mimeType.startsWith('video/')) {\n return 'video'\n }\n if (mimeType.startsWith('image/')) {\n return 'image'\n }\n const fileName = typeof file.name === 'string' ? file.name.toLowerCase() : ''\n if (/\\.(?:mp4|mov|m4v|webm)$/i.test(fileName)) {\n return 'video'\n }\n return 'image'\n}\n\nexport function normalizeChooseMediaFile(file: {\n size?: number\n type?: string\n name?: string\n}) {\n const fileType = inferChooseMediaFileType(file)\n return {\n tempFilePath: createTempFilePath(file),\n size: typeof file.size === 'number' ? file.size : 0,\n fileType,\n width: 0,\n height: 0,\n duration: 0,\n }\n}\n\nasync function pickMediaFilesByOpenPicker(count: number, types: Set<ChooseMediaType>) {\n const picker = (globalThis as {\n showOpenFilePicker?: (options: {\n multiple?: boolean\n types?: Array<{\n description?: string\n accept?: Record<string, string[]>\n }>\n }) => Promise<Array<{ getFile?: () => Promise<any> }>>\n }).showOpenFilePicker\n if (typeof picker !== 'function') {\n return null\n }\n const handles = await picker({\n multiple: count > 1,\n types: [{\n description: 'Media',\n accept: buildChooseMediaOpenPickerAccept(types),\n }],\n })\n const files: any[] = []\n for (const handle of handles ?? []) {\n const file = await handle?.getFile?.()\n if (file) {\n files.push(file)\n }\n if (files.length >= count) {\n break\n }\n }\n return files\n}\n\nasync function pickMediaFilesByInput(count: number, types: Set<ChooseMediaType>) {\n if (typeof document === 'undefined' || typeof document.createElement !== 'function') {\n return null\n }\n const input = document.createElement('input') as HTMLInputElement\n if (!input || typeof input !== 'object') {\n return null\n }\n input.setAttribute('type', 'file')\n input.setAttribute('accept', buildChooseMediaInputAccept(types))\n if (count > 1) {\n input.setAttribute('multiple', 'true')\n }\n input.setAttribute('style', 'position: fixed; left: -9999px; top: -9999px; opacity: 0;')\n if (document.body) {\n document.body.append(input)\n }\n try {\n const files = await new Promise<any[]>((resolve, reject) => {\n const onChange = () => {\n const selected = input.files ? Array.from(input.files) : []\n if (selected.length) {\n resolve(selected.slice(0, count))\n return\n }\n reject(new Error('no file selected'))\n }\n input.addEventListener('change', onChange, { once: true })\n if (typeof input.click === 'function') {\n input.click()\n return\n }\n reject(new Error('file input click is unavailable'))\n })\n return files\n }\n finally {\n if (input.parentNode) {\n input.parentNode.removeChild(input)\n }\n }\n}\n\nexport async function pickChooseMediaFiles(count: number, types: Set<ChooseMediaType>) {\n const viaPicker = await pickMediaFilesByOpenPicker(count, types)\n if (Array.isArray(viaPicker)) {\n return viaPicker\n }\n const viaInput = await pickMediaFilesByInput(count, types)\n if (Array.isArray(viaInput)) {\n return viaInput\n }\n throw new TypeError('Media picker is unavailable in current environment.')\n}\n"],"mappings":";AAIA,SAAgB,0BAA0B,OAA2B;AACnE,KAAI,OAAO,UAAU,YAAY,OAAO,MAAM,MAAM,CAClD,Q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"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { createTempFilePath, inferChooseMediaFileType, pickChooseMediaFiles } from "./mediaPicker.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/runtime/polyfill/mediaProcess.ts
|
|
4
|
+
function normalizeCompressImageQuality(quality) {
|
|
5
|
+
if (typeof quality !== "number" || Number.isNaN(quality)) return 80;
|
|
6
|
+
return Math.max(0, Math.min(100, Math.round(quality)));
|
|
7
|
+
}
|
|
8
|
+
function resolveCompressImageMimeType(src) {
|
|
9
|
+
const lower = src.toLowerCase();
|
|
10
|
+
if (lower.includes(".jpg") || lower.includes(".jpeg")) return "image/jpeg";
|
|
11
|
+
if (lower.includes(".webp")) return "image/webp";
|
|
12
|
+
return "image/png";
|
|
13
|
+
}
|
|
14
|
+
async function compressImageByCanvas(src, quality) {
|
|
15
|
+
if (typeof document === "undefined" || typeof document.createElement !== "function") return src;
|
|
16
|
+
const ImageCtor = globalThis.Image;
|
|
17
|
+
if (typeof ImageCtor !== "function") return src;
|
|
18
|
+
const canvas = document.createElement("canvas");
|
|
19
|
+
if (!canvas || typeof canvas.getContext !== "function") return src;
|
|
20
|
+
return new Promise((resolve, reject) => {
|
|
21
|
+
const image = new ImageCtor();
|
|
22
|
+
image.onload = () => {
|
|
23
|
+
try {
|
|
24
|
+
const width = Number(image.naturalWidth ?? image.width ?? 0);
|
|
25
|
+
const height = Number(image.naturalHeight ?? image.height ?? 0);
|
|
26
|
+
const context = canvas.getContext("2d");
|
|
27
|
+
if (!context || typeof context.drawImage !== "function" || width <= 0 || height <= 0) {
|
|
28
|
+
resolve(src);
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
canvas.width = width;
|
|
32
|
+
canvas.height = height;
|
|
33
|
+
context.drawImage(image, 0, 0, width, height);
|
|
34
|
+
if (typeof canvas.toDataURL !== "function") {
|
|
35
|
+
resolve(src);
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
resolve(canvas.toDataURL(resolveCompressImageMimeType(src), quality / 100) || src);
|
|
39
|
+
} catch (error) {
|
|
40
|
+
reject(error);
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
image.onerror = () => {
|
|
44
|
+
reject(/* @__PURE__ */ new Error("image load error"));
|
|
45
|
+
};
|
|
46
|
+
image.src = src;
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
function normalizeChooseVideoFile(file) {
|
|
50
|
+
if (inferChooseMediaFileType(file) !== "video") return null;
|
|
51
|
+
return {
|
|
52
|
+
tempFilePath: createTempFilePath(file),
|
|
53
|
+
duration: 0,
|
|
54
|
+
size: typeof file.size === "number" ? file.size : 0,
|
|
55
|
+
height: 0,
|
|
56
|
+
width: 0
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
async function pickChooseVideoFile() {
|
|
60
|
+
return (await pickChooseMediaFiles(1, new Set(["video"])))[0] ?? null;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
//#endregion
|
|
64
|
+
export { compressImageByCanvas, normalizeChooseVideoFile, normalizeCompressImageQuality, pickChooseVideoFile };
|
|
65
|
+
//# sourceMappingURL=mediaProcess.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mediaProcess.mjs","names":[],"sources":["../../../src/runtime/polyfill/mediaProcess.ts"],"sourcesContent":["import {\n createTempFilePath,\n inferChooseMediaFileType,\n pickChooseMediaFiles,\n} from './mediaPicker'\n\nexport function normalizeCompressImageQuality(quality: number | undefined) {\n if (typeof quality !== 'number' || Number.isNaN(quality)) {\n return 80\n }\n return Math.max(0, Math.min(100, Math.round(quality)))\n}\n\nfunction resolveCompressImageMimeType(src: string) {\n const lower = src.toLowerCase()\n if (lower.includes('.jpg') || lower.includes('.jpeg')) {\n return 'image/jpeg'\n }\n if (lower.includes('.webp')) {\n return 'image/webp'\n }\n return 'image/png'\n}\n\nexport async function compressImageByCanvas(src: string, quality: number) {\n if (typeof document === 'undefined' || typeof document.createElement !== 'function') {\n return src\n }\n const ImageCtor = (globalThis as { Image?: typeof Image }).Image\n if (typeof ImageCtor !== 'function') {\n return src\n }\n const canvas = document.createElement('canvas') as HTMLCanvasElement\n if (!canvas || typeof canvas.getContext !== 'function') {\n return src\n }\n return new Promise<string>((resolve, reject) => {\n const image = new ImageCtor()\n image.onload = () => {\n try {\n const width = Number((image as { naturalWidth?: number }).naturalWidth ?? image.width ?? 0)\n const height = Number((image as { naturalHeight?: number }).naturalHeight ?? image.height ?? 0)\n const context = canvas.getContext('2d')\n if (!context || typeof context.drawImage !== 'function' || width <= 0 || height <= 0) {\n resolve(src)\n return\n }\n canvas.width = width\n canvas.height = height\n context.drawImage(image, 0, 0, width, height)\n if (typeof canvas.toDataURL !== 'function') {\n resolve(src)\n return\n }\n const dataUrl = canvas.toDataURL(resolveCompressImageMimeType(src), quality / 100)\n resolve(dataUrl || src)\n }\n catch (error) {\n reject(error)\n }\n }\n image.onerror = () => {\n reject(new Error('image load error'))\n }\n image.src = src\n })\n}\n\nexport function normalizeChooseVideoFile(file: {\n size?: number\n type?: string\n name?: string\n}) {\n if (inferChooseMediaFileType(file) !== 'video') {\n return null\n }\n return {\n tempFilePath: createTempFilePath(file),\n duration: 0,\n size: typeof file.size === 'number' ? file.size : 0,\n height: 0,\n width: 0,\n }\n}\n\nexport async function pickChooseVideoFile() {\n const files = await pickChooseMediaFiles(1, new Set(['video']))\n return files[0] ?? null\n}\n"],"mappings":";;;AAMA,SAAgB,8BAA8B,SAA6B;AACzE,KAAI,OAAO,YAAY,YAAY,OAAO,MAAM,QAAQ,CACtD,QAAO;AAET,QAAO,KAAK,IAAI,GAAG,KAAK,IAAI,KAAK,KAAK,MAAM,QAAQ,CAAC,CAAC;;AAGxD,SAAS,6BAA6B,KAAa;CACjD,MAAM,QAAQ,IAAI,aAAa;AAC/B,KAAI,MAAM,SAAS,OAAO,IAAI,MAAM,SAAS,QAAQ,CACnD,QAAO;AAET,KAAI,MAAM,SAAS,QAAQ,CACzB,QAAO;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AQ,CAAC,CAAC,EAClD,MAAM"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { callMiniProgramAsyncFailure, callMiniProgramAsyncSuccess } from "./async.mjs";
|
|
2
|
+
import { normalizeActionSheetItems, resolveActionSheetSelection, resolveModalSelection } from "./ui.mjs";
|
|
3
|
+
import { readNetworkStatusSnapshot } from "./network/status.mjs";
|
|
4
|
+
import { normalizeSubscribeTemplateIds, resolveSubscribeDecisionMap } from "./subscribe.mjs";
|
|
5
|
+
|
|
6
|
+
//#region src/runtime/polyfill/menuApi.ts
|
|
7
|
+
function getNetworkTypeBridge(options) {
|
|
8
|
+
const status = readNetworkStatusSnapshot();
|
|
9
|
+
return Promise.resolve(callMiniProgramAsyncSuccess(options, {
|
|
10
|
+
errMsg: "getNetworkType:ok",
|
|
11
|
+
...status
|
|
12
|
+
}));
|
|
13
|
+
}
|
|
14
|
+
function showTabBarBridge(options) {
|
|
15
|
+
return Promise.resolve(callMiniProgramAsyncSuccess(options, { errMsg: "showTabBar:ok" }));
|
|
16
|
+
}
|
|
17
|
+
function hideTabBarBridge(options) {
|
|
18
|
+
return Promise.resolve(callMiniProgramAsyncSuccess(options, { errMsg: "hideTabBar:ok" }));
|
|
19
|
+
}
|
|
20
|
+
function requestPaymentBridge(options) {
|
|
21
|
+
return Promise.resolve(callMiniProgramAsyncSuccess(options, { errMsg: "requestPayment:ok" }));
|
|
22
|
+
}
|
|
23
|
+
function requestSubscribeMessageBridge(options) {
|
|
24
|
+
const tmplIds = normalizeSubscribeTemplateIds(options?.tmplIds);
|
|
25
|
+
if (tmplIds.length === 0) {
|
|
26
|
+
const failure = callMiniProgramAsyncFailure(options, "requestSubscribeMessage:fail invalid tmplIds");
|
|
27
|
+
return Promise.reject(failure);
|
|
28
|
+
}
|
|
29
|
+
const decisionMap = resolveSubscribeDecisionMap(tmplIds);
|
|
30
|
+
const result = tmplIds.reduce((payload, tmplId) => {
|
|
31
|
+
payload[tmplId] = decisionMap[tmplId];
|
|
32
|
+
return payload;
|
|
33
|
+
}, { errMsg: "requestSubscribeMessage:ok" });
|
|
34
|
+
return Promise.resolve(callMiniProgramAsyncSuccess(options, result));
|
|
35
|
+
}
|
|
36
|
+
function showModalBridge(options) {
|
|
37
|
+
const modalResult = resolveModalSelection(options);
|
|
38
|
+
const result = {
|
|
39
|
+
errMsg: "showModal:ok",
|
|
40
|
+
confirm: modalResult.confirm,
|
|
41
|
+
cancel: modalResult.cancel
|
|
42
|
+
};
|
|
43
|
+
return Promise.resolve(callMiniProgramAsyncSuccess(options, result));
|
|
44
|
+
}
|
|
45
|
+
function showActionSheetBridge(options) {
|
|
46
|
+
const itemList = normalizeActionSheetItems(options?.itemList);
|
|
47
|
+
if (!itemList.length) {
|
|
48
|
+
const failure = callMiniProgramAsyncFailure(options, "showActionSheet:fail invalid itemList");
|
|
49
|
+
return Promise.reject(failure);
|
|
50
|
+
}
|
|
51
|
+
const tapIndex = resolveActionSheetSelection(itemList);
|
|
52
|
+
if (tapIndex === null) {
|
|
53
|
+
const failure = callMiniProgramAsyncFailure(options, "showActionSheet:fail cancel");
|
|
54
|
+
return Promise.reject(failure);
|
|
55
|
+
}
|
|
56
|
+
return Promise.resolve(callMiniProgramAsyncSuccess(options, {
|
|
57
|
+
errMsg: "showActionSheet:ok",
|
|
58
|
+
tapIndex
|
|
59
|
+
}));
|
|
60
|
+
}
|
|
61
|
+
function showShareMenuBridge(options) {
|
|
62
|
+
return Promise.resolve(callMiniProgramAsyncSuccess(options, { errMsg: "showShareMenu:ok" }));
|
|
63
|
+
}
|
|
64
|
+
function updateShareMenuBridge(options) {
|
|
65
|
+
return Promise.resolve(callMiniProgramAsyncSuccess(options, { errMsg: "updateShareMenu:ok" }));
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
//#endregion
|
|
69
|
+
export { getNetworkTypeBridge, hideTabBarBridge, requestPaymentBridge, requestSubscribeMessageBridge, showActionSheetBridge, showModalBridge, showShareMenuBridge, showTabBarBridge, updateShareMenuBridge };
|
|
70
|
+
//# sourceMappingURL=menuApi.mjs.map
|