@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,172 @@
|
|
|
1
|
+
import { MiniProgramAsyncOptions, MiniProgramBaseResult } from "./types/base.mjs";
|
|
2
|
+
import { ChooseImageOptions, GetClipboardDataOptions, PreviewImageOptions, SetClipboardDataOptions, ShowToastOptions } from "./types/common.mjs";
|
|
3
|
+
import { ChooseAddressOptions, ChooseLocationOptions, GetImageInfoOptions, MakePhoneCallOptions, OpenCustomerServiceChatOptions, OpenLocationOptions, RequestPaymentOptions, RequestSubscribeMessageOptions, RequestSubscribeMessageSuccessResult, ShareMenuOptions, ShowLoadingOptions, TabBarOptions } from "./types/locationRuntime.mjs";
|
|
4
|
+
import { ChooseFileOptions, ChooseMediaOptions, ChooseMessageFileOptions, ChooseVideoOptions, CompressImageOptions, CompressVideoOptions, GetVideoInfoOptions, OpenVideoEditorOptions, PreviewMediaOptions, SaveFileOptions, SaveFileToDiskOptions, SaveImageToPhotosAlbumOptions, SaveVideoToPhotosAlbumOptions, ScanCodeOptions } from "./types/mediaAuth.mjs";
|
|
5
|
+
import { OpenDocumentOptions, ShowActionSheetOptions, ShowModalOptions } from "./types/platformRuntime.mjs";
|
|
6
|
+
|
|
7
|
+
//#region src/runtime/polyfill/uiMediaApi.d.ts
|
|
8
|
+
declare function showToast(options?: ShowToastOptions): Promise<any>;
|
|
9
|
+
declare function showLoading(options?: ShowLoadingOptions): Promise<any>;
|
|
10
|
+
declare function hideLoading(options?: MiniProgramAsyncOptions<MiniProgramBaseResult>): Promise<any>;
|
|
11
|
+
declare function showShareMenu(options?: ShareMenuOptions): Promise<any>;
|
|
12
|
+
declare function updateShareMenu(options?: ShareMenuOptions): Promise<any>;
|
|
13
|
+
declare function openCustomerServiceChat(options?: OpenCustomerServiceChatOptions): Promise<{
|
|
14
|
+
errMsg: string;
|
|
15
|
+
}>;
|
|
16
|
+
declare function makePhoneCall(options?: MakePhoneCallOptions): Promise<{
|
|
17
|
+
errMsg: string;
|
|
18
|
+
}>;
|
|
19
|
+
declare function chooseAddress(options?: ChooseAddressOptions): Promise<{
|
|
20
|
+
userName: string;
|
|
21
|
+
postalCode: string;
|
|
22
|
+
provinceName: string;
|
|
23
|
+
cityName: string;
|
|
24
|
+
countyName: string;
|
|
25
|
+
detailInfo: string;
|
|
26
|
+
nationalCode: string;
|
|
27
|
+
telNumber: string;
|
|
28
|
+
errMsg: string;
|
|
29
|
+
}>;
|
|
30
|
+
declare function chooseLocation(options?: ChooseLocationOptions): Promise<{
|
|
31
|
+
name: string;
|
|
32
|
+
address: string;
|
|
33
|
+
latitude: number;
|
|
34
|
+
longitude: number;
|
|
35
|
+
errMsg: string;
|
|
36
|
+
}>;
|
|
37
|
+
declare function openLocation(options?: OpenLocationOptions): Promise<{
|
|
38
|
+
errMsg: string;
|
|
39
|
+
}>;
|
|
40
|
+
declare function getImageInfo(options?: GetImageInfoOptions): Promise<{
|
|
41
|
+
errMsg: string;
|
|
42
|
+
width: number;
|
|
43
|
+
height: number;
|
|
44
|
+
path: any;
|
|
45
|
+
type: string;
|
|
46
|
+
orientation: string;
|
|
47
|
+
}>;
|
|
48
|
+
declare function getVideoInfo(options?: GetVideoInfoOptions): Promise<{
|
|
49
|
+
errMsg: string;
|
|
50
|
+
orientation: string;
|
|
51
|
+
type: string;
|
|
52
|
+
duration: number;
|
|
53
|
+
size: number;
|
|
54
|
+
width: number;
|
|
55
|
+
height: number;
|
|
56
|
+
bitrate: number;
|
|
57
|
+
fps: number;
|
|
58
|
+
}>;
|
|
59
|
+
declare function showTabBar(options?: TabBarOptions): Promise<any>;
|
|
60
|
+
declare function hideTabBar(options?: TabBarOptions): Promise<any>;
|
|
61
|
+
declare function requestPayment(options?: RequestPaymentOptions): Promise<any>;
|
|
62
|
+
declare function requestSubscribeMessage(options?: RequestSubscribeMessageOptions): Promise<RequestSubscribeMessageSuccessResult>;
|
|
63
|
+
declare function showModal(options?: ShowModalOptions): Promise<any>;
|
|
64
|
+
declare function showActionSheet(options?: ShowActionSheetOptions): Promise<any>;
|
|
65
|
+
declare function chooseImage(options?: ChooseImageOptions): Promise<{
|
|
66
|
+
errMsg: string;
|
|
67
|
+
tempFilePaths: string[];
|
|
68
|
+
tempFiles: {
|
|
69
|
+
path: string;
|
|
70
|
+
size: number;
|
|
71
|
+
type: string;
|
|
72
|
+
name: string;
|
|
73
|
+
}[];
|
|
74
|
+
}>;
|
|
75
|
+
declare function chooseMedia(options?: ChooseMediaOptions): Promise<{
|
|
76
|
+
errMsg: string;
|
|
77
|
+
type: "image" | "video";
|
|
78
|
+
tempFiles: {
|
|
79
|
+
tempFilePath: string;
|
|
80
|
+
size: number;
|
|
81
|
+
fileType: "image" | "video";
|
|
82
|
+
width: number;
|
|
83
|
+
height: number;
|
|
84
|
+
duration: number;
|
|
85
|
+
}[];
|
|
86
|
+
}>;
|
|
87
|
+
declare function compressImage(options?: CompressImageOptions): Promise<{
|
|
88
|
+
errMsg: string;
|
|
89
|
+
tempFilePath: string;
|
|
90
|
+
}>;
|
|
91
|
+
declare function compressVideo(options?: CompressVideoOptions): Promise<{
|
|
92
|
+
tempFilePath: any;
|
|
93
|
+
size: number;
|
|
94
|
+
duration: number;
|
|
95
|
+
width: number;
|
|
96
|
+
height: number;
|
|
97
|
+
bitrate: number;
|
|
98
|
+
fps: number;
|
|
99
|
+
errMsg: string;
|
|
100
|
+
}>;
|
|
101
|
+
declare function chooseVideo(options?: ChooseVideoOptions): Promise<{
|
|
102
|
+
tempFilePath: string;
|
|
103
|
+
duration: number;
|
|
104
|
+
size: number;
|
|
105
|
+
height: number;
|
|
106
|
+
width: number;
|
|
107
|
+
errMsg: string;
|
|
108
|
+
}>;
|
|
109
|
+
declare function chooseMessageFile(options?: ChooseMessageFileOptions): Promise<{
|
|
110
|
+
errMsg: string;
|
|
111
|
+
tempFiles: {
|
|
112
|
+
path: string;
|
|
113
|
+
size: number;
|
|
114
|
+
type: string;
|
|
115
|
+
name: string;
|
|
116
|
+
time: number;
|
|
117
|
+
}[];
|
|
118
|
+
}>;
|
|
119
|
+
declare function chooseFile(options?: ChooseFileOptions): Promise<{
|
|
120
|
+
errMsg: string;
|
|
121
|
+
tempFiles: {
|
|
122
|
+
path: string;
|
|
123
|
+
size: number;
|
|
124
|
+
type: string;
|
|
125
|
+
name: string;
|
|
126
|
+
time: number;
|
|
127
|
+
}[];
|
|
128
|
+
}>;
|
|
129
|
+
declare function previewImage(options?: PreviewImageOptions): Promise<{
|
|
130
|
+
errMsg: string;
|
|
131
|
+
}>;
|
|
132
|
+
declare function previewMedia(options?: PreviewMediaOptions): Promise<{
|
|
133
|
+
errMsg: string;
|
|
134
|
+
}>;
|
|
135
|
+
declare function openVideoEditor(options?: OpenVideoEditorOptions): Promise<{
|
|
136
|
+
errMsg: string;
|
|
137
|
+
tempFilePath: any;
|
|
138
|
+
}>;
|
|
139
|
+
declare function saveImageToPhotosAlbum(options?: SaveImageToPhotosAlbumOptions): Promise<{
|
|
140
|
+
errMsg: string;
|
|
141
|
+
}>;
|
|
142
|
+
declare function saveVideoToPhotosAlbum(options?: SaveVideoToPhotosAlbumOptions): Promise<{
|
|
143
|
+
errMsg: string;
|
|
144
|
+
}>;
|
|
145
|
+
declare function saveFile(options?: SaveFileOptions): Promise<{
|
|
146
|
+
errMsg: string;
|
|
147
|
+
savedFilePath: string;
|
|
148
|
+
}>;
|
|
149
|
+
declare function saveFileToDisk(options?: SaveFileToDiskOptions): Promise<{
|
|
150
|
+
errMsg: string;
|
|
151
|
+
}>;
|
|
152
|
+
declare function openDocument(options?: OpenDocumentOptions): Promise<{
|
|
153
|
+
errMsg: string;
|
|
154
|
+
}>;
|
|
155
|
+
declare function scanCode(options?: ScanCodeOptions): Promise<{
|
|
156
|
+
errMsg: string;
|
|
157
|
+
result: string;
|
|
158
|
+
scanType: string;
|
|
159
|
+
charSet: string;
|
|
160
|
+
path: string;
|
|
161
|
+
rawData: string;
|
|
162
|
+
}>;
|
|
163
|
+
declare function setClipboardData(options?: SetClipboardDataOptions): Promise<{
|
|
164
|
+
errMsg: string;
|
|
165
|
+
}>;
|
|
166
|
+
declare function getClipboardData(options?: GetClipboardDataOptions): Promise<{
|
|
167
|
+
errMsg: string;
|
|
168
|
+
data: string;
|
|
169
|
+
}>;
|
|
170
|
+
//#endregion
|
|
171
|
+
export { chooseAddress, chooseFile, chooseImage, chooseLocation, chooseMedia, chooseMessageFile, chooseVideo, compressImage, compressVideo, getClipboardData, getImageInfo, getVideoInfo, hideLoading, hideTabBar, makePhoneCall, openCustomerServiceChat, openDocument, openLocation, openVideoEditor, previewImage, previewMedia, requestPayment, requestSubscribeMessage, saveFile, saveFileToDisk, saveImageToPhotosAlbum, saveVideoToPhotosAlbum, scanCode, setClipboardData, showActionSheet, showLoading, showModal, showShareMenu, showTabBar, showToast, updateShareMenu };
|
|
172
|
+
//# sourceMappingURL=uiMediaApi.d.mts.map
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import { __exportAll } from "../../_virtual/_rolldown/runtime.mjs";
|
|
2
|
+
import { chooseAddressBridge, chooseLocationBridge, makePhoneCallBridge, openLocationBridge } from "./locationApi.mjs";
|
|
3
|
+
import { hideTabBarBridge, requestPaymentBridge, requestSubscribeMessageBridge, showActionSheetBridge, showModalBridge, showShareMenuBridge, showTabBarBridge, updateShareMenuBridge } from "./menuApi.mjs";
|
|
4
|
+
import { getClipboardDataBridge, openCustomerServiceChatBridge, scanCodeBridge, setClipboardDataBridge } from "./interactionApi.mjs";
|
|
5
|
+
import { openDocumentBridge, saveFileBridge, saveFileToDiskBridge, saveImageToPhotosAlbumBridge, saveVideoToPhotosAlbumBridge } from "./mediaApi/file.mjs";
|
|
6
|
+
import { getImageInfoBridge, getVideoInfoBridge } from "./mediaApi/info.mjs";
|
|
7
|
+
import { chooseFileBridge, chooseImageBridge, chooseMediaBridge, chooseMessageFileBridge, chooseVideoBridge } from "./mediaApi/picker.mjs";
|
|
8
|
+
import { openVideoEditorBridge, previewImageBridge, previewMediaBridge } from "./mediaApi/preview.mjs";
|
|
9
|
+
import { compressImageBridge, compressVideoBridge } from "./mediaApi/process.mjs";
|
|
10
|
+
import { hideLoadingBridge, showLoadingBridge, showToastBridge } from "./uiFeedback.mjs";
|
|
11
|
+
|
|
12
|
+
//#region src/runtime/polyfill/uiMediaApi.ts
|
|
13
|
+
var uiMediaApi_exports = /* @__PURE__ */ __exportAll({
|
|
14
|
+
chooseAddress: () => chooseAddress,
|
|
15
|
+
chooseFile: () => chooseFile,
|
|
16
|
+
chooseImage: () => chooseImage,
|
|
17
|
+
chooseLocation: () => chooseLocation,
|
|
18
|
+
chooseMedia: () => chooseMedia,
|
|
19
|
+
chooseMessageFile: () => chooseMessageFile,
|
|
20
|
+
chooseVideo: () => chooseVideo,
|
|
21
|
+
compressImage: () => compressImage,
|
|
22
|
+
compressVideo: () => compressVideo,
|
|
23
|
+
getClipboardData: () => getClipboardData,
|
|
24
|
+
getImageInfo: () => getImageInfo,
|
|
25
|
+
getVideoInfo: () => getVideoInfo,
|
|
26
|
+
hideLoading: () => hideLoading,
|
|
27
|
+
hideTabBar: () => hideTabBar,
|
|
28
|
+
makePhoneCall: () => makePhoneCall,
|
|
29
|
+
openCustomerServiceChat: () => openCustomerServiceChat,
|
|
30
|
+
openDocument: () => openDocument,
|
|
31
|
+
openLocation: () => openLocation,
|
|
32
|
+
openVideoEditor: () => openVideoEditor,
|
|
33
|
+
previewImage: () => previewImage,
|
|
34
|
+
previewMedia: () => previewMedia,
|
|
35
|
+
requestPayment: () => requestPayment,
|
|
36
|
+
requestSubscribeMessage: () => requestSubscribeMessage,
|
|
37
|
+
saveFile: () => saveFile,
|
|
38
|
+
saveFileToDisk: () => saveFileToDisk,
|
|
39
|
+
saveImageToPhotosAlbum: () => saveImageToPhotosAlbum,
|
|
40
|
+
saveVideoToPhotosAlbum: () => saveVideoToPhotosAlbum,
|
|
41
|
+
scanCode: () => scanCode,
|
|
42
|
+
setClipboardData: () => setClipboardData,
|
|
43
|
+
showActionSheet: () => showActionSheet,
|
|
44
|
+
showLoading: () => showLoading,
|
|
45
|
+
showModal: () => showModal,
|
|
46
|
+
showShareMenu: () => showShareMenu,
|
|
47
|
+
showTabBar: () => showTabBar,
|
|
48
|
+
showToast: () => showToast,
|
|
49
|
+
updateShareMenu: () => updateShareMenu
|
|
50
|
+
});
|
|
51
|
+
function showToast(options) {
|
|
52
|
+
return showToastBridge(options);
|
|
53
|
+
}
|
|
54
|
+
function showLoading(options) {
|
|
55
|
+
return showLoadingBridge(options);
|
|
56
|
+
}
|
|
57
|
+
function hideLoading(options) {
|
|
58
|
+
return hideLoadingBridge(options);
|
|
59
|
+
}
|
|
60
|
+
function showShareMenu(options) {
|
|
61
|
+
return showShareMenuBridge(options);
|
|
62
|
+
}
|
|
63
|
+
function updateShareMenu(options) {
|
|
64
|
+
return updateShareMenuBridge(options);
|
|
65
|
+
}
|
|
66
|
+
function openCustomerServiceChat(options) {
|
|
67
|
+
return openCustomerServiceChatBridge(options);
|
|
68
|
+
}
|
|
69
|
+
function makePhoneCall(options) {
|
|
70
|
+
return makePhoneCallBridge(options);
|
|
71
|
+
}
|
|
72
|
+
function chooseAddress(options) {
|
|
73
|
+
return chooseAddressBridge(options);
|
|
74
|
+
}
|
|
75
|
+
function chooseLocation(options) {
|
|
76
|
+
return chooseLocationBridge(options);
|
|
77
|
+
}
|
|
78
|
+
function openLocation(options) {
|
|
79
|
+
return openLocationBridge(options);
|
|
80
|
+
}
|
|
81
|
+
function getImageInfo(options) {
|
|
82
|
+
return getImageInfoBridge(options);
|
|
83
|
+
}
|
|
84
|
+
function getVideoInfo(options) {
|
|
85
|
+
return getVideoInfoBridge(options);
|
|
86
|
+
}
|
|
87
|
+
function showTabBar(options) {
|
|
88
|
+
return showTabBarBridge(options);
|
|
89
|
+
}
|
|
90
|
+
function hideTabBar(options) {
|
|
91
|
+
return hideTabBarBridge(options);
|
|
92
|
+
}
|
|
93
|
+
function requestPayment(options) {
|
|
94
|
+
return requestPaymentBridge(options);
|
|
95
|
+
}
|
|
96
|
+
function requestSubscribeMessage(options) {
|
|
97
|
+
return requestSubscribeMessageBridge(options);
|
|
98
|
+
}
|
|
99
|
+
function showModal(options) {
|
|
100
|
+
return showModalBridge(options);
|
|
101
|
+
}
|
|
102
|
+
function showActionSheet(options) {
|
|
103
|
+
return showActionSheetBridge(options);
|
|
104
|
+
}
|
|
105
|
+
async function chooseImage(options) {
|
|
106
|
+
return chooseImageBridge(options);
|
|
107
|
+
}
|
|
108
|
+
async function chooseMedia(options) {
|
|
109
|
+
return chooseMediaBridge(options);
|
|
110
|
+
}
|
|
111
|
+
async function compressImage(options) {
|
|
112
|
+
return compressImageBridge(options);
|
|
113
|
+
}
|
|
114
|
+
function compressVideo(options) {
|
|
115
|
+
return compressVideoBridge(options);
|
|
116
|
+
}
|
|
117
|
+
async function chooseVideo(options) {
|
|
118
|
+
return chooseVideoBridge(options);
|
|
119
|
+
}
|
|
120
|
+
async function chooseMessageFile(options) {
|
|
121
|
+
return chooseMessageFileBridge(options);
|
|
122
|
+
}
|
|
123
|
+
async function chooseFile(options) {
|
|
124
|
+
return chooseFileBridge(options);
|
|
125
|
+
}
|
|
126
|
+
function previewImage(options) {
|
|
127
|
+
return previewImageBridge(options);
|
|
128
|
+
}
|
|
129
|
+
function previewMedia(options) {
|
|
130
|
+
return previewMediaBridge(options);
|
|
131
|
+
}
|
|
132
|
+
function openVideoEditor(options) {
|
|
133
|
+
return openVideoEditorBridge(options);
|
|
134
|
+
}
|
|
135
|
+
function saveImageToPhotosAlbum(options) {
|
|
136
|
+
return saveImageToPhotosAlbumBridge(options);
|
|
137
|
+
}
|
|
138
|
+
function saveVideoToPhotosAlbum(options) {
|
|
139
|
+
return saveVideoToPhotosAlbumBridge(options);
|
|
140
|
+
}
|
|
141
|
+
function saveFile(options) {
|
|
142
|
+
return saveFileBridge(options);
|
|
143
|
+
}
|
|
144
|
+
function saveFileToDisk(options) {
|
|
145
|
+
return saveFileToDiskBridge(options);
|
|
146
|
+
}
|
|
147
|
+
function openDocument(options) {
|
|
148
|
+
return openDocumentBridge(options);
|
|
149
|
+
}
|
|
150
|
+
function scanCode(options) {
|
|
151
|
+
return scanCodeBridge(options);
|
|
152
|
+
}
|
|
153
|
+
async function setClipboardData(options) {
|
|
154
|
+
return setClipboardDataBridge(options);
|
|
155
|
+
}
|
|
156
|
+
async function getClipboardData(options) {
|
|
157
|
+
return getClipboardDataBridge(options);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
//#endregion
|
|
161
|
+
export { chooseAddress, chooseFile, chooseImage, chooseLocation, chooseMedia, chooseMessageFile, chooseVideo, compressImage, compressVideo, getClipboardData, getImageInfo, getVideoInfo, hideLoading, hideTabBar, makePhoneCall, openCustomerServiceChat, openDocument, openLocation, openVideoEditor, previewImage, previewMedia, requestPayment, requestSubscribeMessage, saveFile, saveFileToDisk, saveImageToPhotosAlbum, saveVideoToPhotosAlbum, scanCode, setClipboardData, showActionSheet, showLoading, showModal, showShareMenu, showTabBar, showToast, uiMediaApi_exports, updateShareMenu };
|
|
162
|
+
//# sourceMappingURL=uiMediaApi.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"uiMediaApi.mjs","names":[],"sources":["../../../src/runtime/polyfill/uiMediaApi.ts"],"sourcesContent":["import type {\n ChooseAddressOptions,\n ChooseFileOptions,\n ChooseImageOptions,\n ChooseLocationOptions,\n ChooseMediaOptions,\n ChooseMessageFileOptions,\n ChooseVideoOptions,\n CompressImageOptions,\n CompressVideoOptions,\n GetClipboardDataOptions,\n GetImageInfoOptions,\n GetVideoInfoOptions,\n MakePhoneCallOptions,\n MiniProgramAsyncOptions,\n MiniProgramBaseResult,\n OpenCustomerServiceChatOptions,\n OpenDocumentOptions,\n OpenLocationOptions,\n OpenVideoEditorOptions,\n PreviewImageOptions,\n PreviewMediaOptions,\n RequestPaymentOptions,\n RequestSubscribeMessageOptions,\n RequestSubscribeMessageSuccessResult,\n SaveFileOptions,\n SaveFileToDiskOptions,\n SaveImageToPhotosAlbumOptions,\n SaveVideoToPhotosAlbumOptions,\n ScanCodeOptions,\n SetClipboardDataOptions,\n ShareMenuOptions,\n ShowActionSheetOptions,\n ShowLoadingOptions,\n ShowModalOptions,\n ShowToastOptions,\n TabBarOptions,\n} from './types'\nimport {\n getClipboardDataBridge,\n openCustomerServiceChatBridge,\n scanCodeBridge,\n setClipboardDataBridge,\n} from './interactionApi'\nimport {\n chooseAddressBridge,\n chooseLocationBridge,\n makePhoneCallBridge,\n openLocationBridge,\n} from './locationApi'\nimport {\n chooseFileBridge,\n chooseImageBridge,\n chooseMediaBridge,\n chooseMessageFileBridge,\n chooseVideoBridge,\n compressImageBridge,\n compressVideoBridge,\n getImageInfoBridge,\n getVideoInfoBridge,\n openDocumentBridge,\n openVideoEditorBridge,\n previewImageBridge,\n previewMediaBridge,\n saveFileBridge,\n saveFileToDiskBridge,\n saveImageToPhotosAlbumBridge,\n saveVideoToPhotosAlbumBridge,\n} from './mediaApi'\nimport {\n hideTabBarBridge,\n requestPaymentBridge,\n requestSubscribeMessageBridge,\n showActionSheetBridge,\n showModalBridge,\n showShareMenuBridge,\n showTabBarBridge,\n updateShareMenuBridge,\n} from './menuApi'\nimport {\n hideLoadingBridge,\n showLoadingBridge,\n showToastBridge,\n} from './uiFeedback'\n\nexport function showToast(options?: ShowToastOptions) {\n return showToastBridge(options)\n}\n\nexport function showLoading(options?: ShowLoadingOptions) {\n return showLoadingBridge(options)\n}\n\nexport function hideLoading(options?: MiniProgramAsyncOptions<MiniProgramBaseResult>) {\n return hideLoadingBridge(options)\n}\n\nexport function showShareMenu(options?: ShareMenuOptions) {\n return showShareMenuBridge(options)\n}\n\nexport function updateShareMenu(options?: ShareMenuOptions) {\n return updateShareMenuBridge(options)\n}\n\nexport function openCustomerServiceChat(options?: OpenCustomerServiceChatOptions) {\n return openCustomerServiceChatBridge(options)\n}\n\nexport function makePhoneCall(options?: MakePhoneCallOptions) {\n return makePhoneCallBridge(options)\n}\n\nexport function chooseAddress(options?: ChooseAddressOptions) {\n return chooseAddressBridge(options)\n}\n\nexport function chooseLocation(options?: ChooseLocationOptions) {\n return chooseLocationBridge(options)\n}\n\nexport function openLocation(options?: OpenLocationOptions) {\n return openLocationBridge(options)\n}\n\nexport function getImageInfo(options?: GetImageInfoOptions) {\n return getImageInfoBridge(options)\n}\n\nexport function getVideoInfo(options?: GetVideoInfoOptions) {\n return getVideoInfoBridge(options)\n}\n\nexport function showTabBar(options?: TabBarOptions) {\n return showTabBarBridge(options)\n}\n\nexport function hideTabBar(options?: TabBarOptions) {\n return hideTabBarBridge(options)\n}\n\nexport function requestPayment(options?: RequestPaymentOptions) {\n return requestPaymentBridge(options)\n}\n\nexport function requestSubscribeMessage(options?: RequestSubscribeMessageOptions): Promise<RequestSubscribeMessageSuccessResult> {\n return requestSubscribeMessageBridge(options)\n}\n\nexport function showModal(options?: ShowModalOptions) {\n return showModalBridge(options)\n}\n\nexport function showActionSheet(options?: ShowActionSheetOptions) {\n return showActionSheetBridge(options)\n}\n\nexport async function chooseImage(options?: ChooseImageOptions) {\n return chooseImageBridge(options)\n}\n\nexport async function chooseMedia(options?: ChooseMediaOptions) {\n return chooseMediaBridge(options)\n}\n\nexport async function compressImage(options?: CompressImageOptions) {\n return compressImageBridge(options)\n}\n\nexport function compressVideo(options?: CompressVideoOptions) {\n return compressVideoBridge(options)\n}\n\nexport async function chooseVideo(options?: ChooseVideoOptions) {\n return chooseVideoBridge(options)\n}\n\nexport async function chooseMessageFile(options?: ChooseMessageFileOptions) {\n return chooseMessageFileBridge(options)\n}\n\nexport async function chooseFile(options?: ChooseFileOptions) {\n return chooseFileBridge(options)\n}\n\nexport function previewImage(options?: PreviewImageOptions) {\n return previewImageBridge(options)\n}\n\nexport function previewMedia(options?: PreviewMediaOptions) {\n return previewMediaBridge(options)\n}\n\nexport function openVideoEditor(options?: OpenVideoEditorOptions) {\n return openVideoEditorBridge(options)\n}\n\nexport function saveImageToPhotosAlbum(options?: SaveImageToPhotosAlbumOptions) {\n return saveImageToPhotosAlbumBridge(options)\n}\n\nexport function saveVideoToPhotosAlbum(options?: SaveVideoToPhotosAlbumOptions) {\n return saveVideoToPhotosAlbumBridge(options)\n}\n\nexport function saveFile(options?: SaveFileOptions) {\n return saveFileBridge(options)\n}\n\nexport function saveFileToDisk(options?: SaveFileToDiskOptions) {\n return saveFileToDiskBridge(options)\n}\n\nexport function openDocument(options?: OpenDocumentOptions) {\n return openDocumentBridge(options)\n}\n\nexport function scanCode(options?: ScanCodeOptions) {\n return scanCodeBridge(options)\n}\n\nexport async function setClipboardData(options?: SetClipboardDataOptions) {\n return setClipboardDataBridge(options)\n}\n\nexport async function getClipboardData(options?: GetClipboardDataOptions) {\n return getClipboardDataBridge(options)\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqFA,SAAgB,UAAU,SAA4B;AACpD,QAAO,gBAAgB,QAAQ;;AAGjC,SAAgB,YAAY,SAA8B;AACxD,QAAO,kBAAkB,QAAQ;;AAGnC,SAAgB,YAAY,SAA0D;AACpF,QAAO,kBAAkB,QAAQ;;AAGnC,SAAgB,cAAc,SAA4B;AACxD,QAAO,oBAAoB,QAAQ;;AAGrC,SAAgB,gBAAgB,SAA4B;AAC1D,QAAO,sBAAsB,QAAQ;;AAGvC,SAAgB,wBAAwB,SAA0C;AAChF,QAAO,8BAA8B,QAAQ;;AAG/C,SAAgB,cAAc,SAAgC;AAC5D,QAAO,oBAAoB,QAAQ;;AAGrC,SAAgB,cAAc,SAAgC;AAC5D,QAAO,oBAAoB,QAAQ;;AAGrC,SAAgB,eAAe,SAAiC;AAC9D,QAAO,qBAAqB,QAAQ;;AAGtC,SAAgB,aAAa,SAA+B;AAC1D,QAAO,mBAAmB,QAAQ;;AAGpC,SAAgB,aAAa,SAA+B;AAC1D,QAAO,mBAAmB,QAAQ;;AAGpC,SAAgB,aAAa,SAA+B;AAC1D,QAAO,mBAAmB,QAAQ;;AAGpC,SAAgB,WAAW,SAAyB;AAClD,QAAO,iBAAiB,QAAQ;;AAGlC,SAAgB,WAAW,SAAyB;AAClD,QAAO,iBAAiB,QAAQ;;AAGlC,SAAgB,eAAe,SAAiC;AAC9D,QAAO,qBAAqB,QAAQ;;AAGtC,SAAgB,wBAAwB,SAAyF;AAC/H,QAAO,8BAA8B,QAAQ;;AAG/C,SAAgB,UAAU,SAA4B;AACpD,QAAO,gBAAgB,QAAQ;;AAGjC,SAAgB,gBAAgB,SAAkC;AAChE,QAAO,sBAAsB,QAAQ;;AAGvC,eAAsB,YAAY,SAA8B;AAC9D,QAAO,kBAAkB,QAAQ;;AAGnC,eAAsB,YAAY,SAA8B;AAC9D,QAAO,kBAAkB,QAAQ;;AAGnC,eAAsB,cAAc,SAAgC;AAClE,QAAO,oBAAoB,QAAQ;;AAGrC,SAAgB,cAAc,SAAgC;AAC5D,QAAO,oBAAoB,QAAQ;;AAGrC,eAAsB,YAAY,SAA8B;AAC9D,QAAO,kBAAkB,QAAQ;;AAGnC,eAAsB,kBAAkB,SAAoC;AAC1E,QAAO,wBAAwB,QAAQ;;AAGzC,eAAsB,WAAW,SAA6B;AAC5D,QAAO,iBAAiB,QAAQ;;AAGlC,SAAgB,aAAa,SAA+B;AAC1D,QAAO,mBAAmB,QAAQ;;AAGpC,SAAgB,aAAa,SAA+B;AAC1D,QAAO,mBAAmB,QAAQ;;AAGpC,SAAgB,gBAAgB,SAAkC;AAChE,QAAO,sBAAsB,QAAQ;;AAGvC,SAAgB,uBAAuB,SAAyC;AAC9E,QAAO,6BAA6B,QAAQ;;AAG9C,SAAgB,uBAAuB,SAAyC;AAC9E,QAAO,6BAA6B,QAAQ;;AAG9C,SAAgB,SAAS,SAA2B;AAClD,QAAO,eAAe,QAAQ;;AAGhC,SAAgB,eAAe,SAAiC;AAC9D,QAAO,qBAAqB,QAAQ;;AAGtC,SAAgB,aAAa,SAA+B;AAC1D,QAAO,mBAAmB,QAAQ;;AAGpC,SAAgB,SAAS,SAA2B;AAClD,QAAO,eAAe,QAAQ;;AAGhC,eAAsB,iBAAiB,SAAmC;AACxE,QAAO,uBAAuB,QAAQ;;AAGxC,eAAsB,iBAAiB,SAAmC;AACxE,QAAO,uBAAuB,QAAQ"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
//#region src/runtime/polyfill/videoContext.ts
|
|
2
|
+
function resolveVideoElementById(videoId) {
|
|
3
|
+
if (typeof document === "undefined") return;
|
|
4
|
+
const normalized = String(videoId ?? "").trim();
|
|
5
|
+
if (!normalized) return;
|
|
6
|
+
const fromId = document.getElementById(normalized);
|
|
7
|
+
if (fromId && "play" in fromId && "pause" in fromId) return fromId;
|
|
8
|
+
const escaped = typeof CSS !== "undefined" && typeof CSS.escape === "function" ? CSS.escape(normalized) : normalized.replace(/"/g, "\\\"");
|
|
9
|
+
const fromQuery = document.querySelector(`video#${escaped}`);
|
|
10
|
+
if (fromQuery && "play" in fromQuery && "pause" in fromQuery) return fromQuery;
|
|
11
|
+
}
|
|
12
|
+
function createVideoContextBridge(videoId) {
|
|
13
|
+
const getVideo = () => resolveVideoElementById(videoId);
|
|
14
|
+
return {
|
|
15
|
+
play() {
|
|
16
|
+
getVideo()?.play?.();
|
|
17
|
+
},
|
|
18
|
+
pause() {
|
|
19
|
+
getVideo()?.pause?.();
|
|
20
|
+
},
|
|
21
|
+
stop() {
|
|
22
|
+
const video = getVideo();
|
|
23
|
+
if (!video) return;
|
|
24
|
+
video.pause?.();
|
|
25
|
+
try {
|
|
26
|
+
video.currentTime = 0;
|
|
27
|
+
} catch {}
|
|
28
|
+
},
|
|
29
|
+
seek(position) {
|
|
30
|
+
if (!Number.isFinite(position)) return;
|
|
31
|
+
const video = getVideo();
|
|
32
|
+
if (!video) return;
|
|
33
|
+
try {
|
|
34
|
+
video.currentTime = Math.max(0, position);
|
|
35
|
+
} catch {}
|
|
36
|
+
},
|
|
37
|
+
playbackRate(rate) {
|
|
38
|
+
if (!Number.isFinite(rate) || rate <= 0) return;
|
|
39
|
+
const video = getVideo();
|
|
40
|
+
if (!video) return;
|
|
41
|
+
try {
|
|
42
|
+
video.playbackRate = rate;
|
|
43
|
+
} catch {}
|
|
44
|
+
},
|
|
45
|
+
requestFullScreen() {
|
|
46
|
+
getVideo()?.requestFullscreen?.();
|
|
47
|
+
},
|
|
48
|
+
exitFullScreen() {
|
|
49
|
+
document.exitFullscreen?.();
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
//#endregion
|
|
55
|
+
export { createVideoContextBridge };
|
|
56
|
+
//# sourceMappingURL=videoContext.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"videoContext.mjs","names":[],"sources":["../../../src/runtime/polyfill/videoContext.ts"],"sourcesContent":["import type { VideoContext } from './types/platformRuntime'\n\nfunction resolveVideoElementById(videoId: string) {\n if (typeof document === 'undefined') {\n return undefined\n }\n const normalized = String(videoId ?? '').trim()\n if (!normalized) {\n return undefined\n }\n const fromId = document.getElementById(normalized)\n if (fromId && 'play' in fromId && 'pause' in fromId) {\n return fromId as unknown as HTMLVideoElement\n }\n const escaped = typeof CSS !== 'undefined' && typeof CSS.escape === 'function'\n ? CSS.escape(normalized)\n : normalized.replace(/\"/g, '\\\\\"')\n const fromQuery = document.querySelector(`video#${escaped}`)\n if (fromQuery && 'play' in fromQuery && 'pause' in fromQuery) {\n return fromQuery as HTMLVideoElement\n }\n return undefined\n}\n\nexport function createVideoContextBridge(videoId: string): VideoContext {\n const getVideo = () => resolveVideoElementById(videoId)\n return {\n play() {\n getVideo()?.play?.()\n },\n pause() {\n getVideo()?.pause?.()\n },\n stop() {\n const video = getVideo()\n if (!video) {\n return\n }\n video.pause?.()\n try {\n video.currentTime = 0\n }\n catch {\n // ignore browsers that block currentTime mutation\n }\n },\n seek(position: number) {\n if (!Number.isFinite(position)) {\n return\n }\n const video = getVideo()\n if (!video) {\n return\n }\n try {\n video.currentTime = Math.max(0, position)\n }\n catch {\n // ignore browsers that block currentTime mutation\n }\n },\n playbackRate(rate: number) {\n if (!Number.isFinite(rate) || rate <= 0) {\n return\n }\n const video = getVideo()\n if (!video) {\n return\n }\n try {\n video.playbackRate = rate\n }\n catch {\n // ignore unsupported playbackRate mutation\n }\n },\n requestFullScreen() {\n const video = getVideo() as (HTMLVideoElement & { requestFullscreen?: () => Promise<void> | void }) | undefined\n video?.requestFullscreen?.()\n },\n exitFullScreen() {\n const runtimeDocument = document as { exitFullscreen?: () => Promise<void> | void }\n runtimeDocument.exitFullscreen?.()\n },\n }\n}\n"],"mappings":";AAEA,SAAS,wBAAwB,SAAiB;AAChD,KAAI,OAAO,aAAa,YACtB;CAEF,MAAM,aAAa,OAAO,WAAW,GAAG,CAAC,MAAM;AAC/C,KAAI,CAAC,WACH;CAEF,MAAM,SAAS,SAAS,eAAe,WAAW;AAClD,KAAI,UAAU,UAAU,UAAU,WAAW,OAC3C,QAAO;CAET,MAAM,UAAU,OAAO,QAAQ,eAAe,OAAO,IAAI,WAAW,aAChE,IAAI,OAAO,WAAW,GACtB,WAAW,QAAQ,MAAM,OAAM;CACnC,MAAM,YAAY,SAAS,cAAc,SAAS,UAAU;AAC5D,KAAI,aAAa,UAAU,aAAa,WAAW,UACjD,QAAO;;AAKX,SAAgB,yBAAyB,SAA+B;CACtE,MAAM,iBAAiB,wBAAwB,QAAQ;AACvD,QAAO;EACL,OAAO;AACL,aAAU,EAAE,QAAQ;;EAEtB,QAAQ;AACN,aAAU,EAAE,SAAS;;EAEvB,OAAO;GACL,MAAM,QAAQ,UAAU;AACxB,OAAI,CAAC,MACH;AAEF,SAAM,SAAS;AACf,OAAI;AACF,UAAM,cAAc;WAEhB;;EAIR,KAAK,UAAkB;AACrB,OAAI,CAAC,OAAO,SAAS,SAAS,CAC5B;GAEF,MAAM,QAAQ,UAAU;AACxB,OAAI,CAAC,MACH;AAEF,OAAI;AACF,UAAM,cAAc,KAAK,IAAI,GAAG,SAAS;WAErC;;EAIR,aAAa,MAAc;AACzB,OAAI,CAAC,OAAO,SAAS,KAAK,IAAI,QAAQ,EACpC;GAEF,MAAM,QAAQ,UAAU;AACxB,OAAI,CAAC,MACH;AAEF,OAAI;AACF,UAAM,eAAe;WAEjB;;EAIR,oBAAoB;AAElB,GADc,UAAU,EACjB,qBAAqB;;EAE9B,iBAAiB;AAEf,GADwB,SACR,kBAAkB;;EAErC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
//#region src/runtime/polyfill/vkSession.ts
|
|
2
|
+
function createVkSessionBridge() {
|
|
3
|
+
let destroyed = false;
|
|
4
|
+
const listeners = /* @__PURE__ */ new Map();
|
|
5
|
+
const ensureAvailable = (action) => {
|
|
6
|
+
if (destroyed) throw new TypeError(`createVKSession:fail session is destroyed (${action})`);
|
|
7
|
+
};
|
|
8
|
+
return {
|
|
9
|
+
start() {
|
|
10
|
+
try {
|
|
11
|
+
ensureAvailable("start");
|
|
12
|
+
} catch (error) {
|
|
13
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
14
|
+
return Promise.reject(new TypeError(message));
|
|
15
|
+
}
|
|
16
|
+
return Promise.resolve({ errMsg: "vkSession.start:ok" });
|
|
17
|
+
},
|
|
18
|
+
stop() {
|
|
19
|
+
try {
|
|
20
|
+
ensureAvailable("stop");
|
|
21
|
+
} catch (error) {
|
|
22
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
23
|
+
return Promise.reject(new TypeError(message));
|
|
24
|
+
}
|
|
25
|
+
return Promise.resolve({ errMsg: "vkSession.stop:ok" });
|
|
26
|
+
},
|
|
27
|
+
destroy() {
|
|
28
|
+
destroyed = true;
|
|
29
|
+
listeners.clear();
|
|
30
|
+
},
|
|
31
|
+
on(eventName, callback) {
|
|
32
|
+
if (typeof eventName !== "string" || typeof callback !== "function") return;
|
|
33
|
+
const key = eventName.trim();
|
|
34
|
+
if (!key) return;
|
|
35
|
+
const list = listeners.get(key) ?? /* @__PURE__ */ new Set();
|
|
36
|
+
list.add(callback);
|
|
37
|
+
listeners.set(key, list);
|
|
38
|
+
},
|
|
39
|
+
off(eventName, callback) {
|
|
40
|
+
if (typeof eventName !== "string" || !eventName.trim()) {
|
|
41
|
+
listeners.clear();
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
const list = listeners.get(eventName.trim());
|
|
45
|
+
if (!list) return;
|
|
46
|
+
if (typeof callback !== "function") {
|
|
47
|
+
listeners.delete(eventName.trim());
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
list.delete(callback);
|
|
51
|
+
if (list.size === 0) listeners.delete(eventName.trim());
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
//#endregion
|
|
57
|
+
export { createVkSessionBridge };
|
|
58
|
+
//# sourceMappingURL=vkSession.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vkSession.mjs","names":[],"sources":["../../../src/runtime/polyfill/vkSession.ts"],"sourcesContent":["interface VkSession {\n start: () => Promise<{ errMsg: string }>\n stop: () => Promise<{ errMsg: string }>\n destroy: () => void\n on: (eventName: string, callback: (payload: unknown) => void) => void\n off: (eventName?: string, callback?: (payload: unknown) => void) => void\n}\n\nexport function createVkSessionBridge(): VkSession {\n let destroyed = false\n const listeners = new Map<string, Set<(payload: unknown) => void>>()\n\n const ensureAvailable = (action: string) => {\n if (destroyed) {\n throw new TypeError(`createVKSession:fail session is destroyed (${action})`)\n }\n }\n\n return {\n start() {\n try {\n ensureAvailable('start')\n }\n catch (error) {\n const message = error instanceof Error ? error.message : String(error)\n return Promise.reject(new TypeError(message))\n }\n return Promise.resolve({ errMsg: 'vkSession.start:ok' })\n },\n stop() {\n try {\n ensureAvailable('stop')\n }\n catch (error) {\n const message = error instanceof Error ? error.message : String(error)\n return Promise.reject(new TypeError(message))\n }\n return Promise.resolve({ errMsg: 'vkSession.stop:ok' })\n },\n destroy() {\n destroyed = true\n listeners.clear()\n },\n on(eventName: string, callback: (payload: unknown) => void) {\n if (typeof eventName !== 'string' || typeof callback !== 'function') {\n return\n }\n const key = eventName.trim()\n if (!key) {\n return\n }\n const list = listeners.get(key) ?? new Set<(payload: unknown) => void>()\n list.add(callback)\n listeners.set(key, list)\n },\n off(eventName?: string, callback?: (payload: unknown) => void) {\n if (typeof eventName !== 'string' || !eventName.trim()) {\n listeners.clear()\n return\n }\n const list = listeners.get(eventName.trim())\n if (!list) {\n return\n }\n if (typeof callback !== 'function') {\n listeners.delete(eventName.trim())\n return\n }\n list.delete(callback)\n if (list.size === 0) {\n listeners.delete(eventName.trim())\n }\n },\n }\n}\n"],"mappings":";AAQA,SAAgB,wBAAmC;CACjD,IAAI,YAAY;CAChB,MAAM,4BAAY,IAAI,KAA8C;CAEpE,MAAM,mBAAmB,WAAmB;AAC1C,MAAI,UACF,OAAM,IAAI,UAAU,8CAA8C,OAAO,GAAG;;AAIhF,QAAO;EACL,QAAQ;AACN,OAAI;AACF,oBAAgB,QAAQ;YAEnB,OAAO;IACZ,MAAM,UAAU,iBAAiB,QAAQ,MAAM,UAAU,OAAO,MAAM;AACtE,WAAO,QAAQ,OAAO,IAAI,UAAU,QAAQ,CAAC;;AAE/C,UAAO,QAAQ,QAAQ,EAAE,QAAQ,sBAAsB,CAAC;;EAE1D,OAAO;AACL,OAAI;AACF,oBAAgB,OAAO;YAElB,OAAO;IACZ,MAAM,UAAU,iBAAiB,QAAQ,MAAM,UAAU,OAAO,MAAM;AACtE,WAAO,QAAQ,OAAO,IAAI,UAAU,QAAQ,CAAC;;AAE/C,UAAO,QAAQ,QAAQ,EAAE,QAAQ,qBAAqB,CAAC;;EAEzD,UAAU;AACR,eAAY;AACZ,aAAU,OAAO;;EAEnB,GAAG,WAAmB,UAAsC;AAC1D,OAAI,OAAO,cAAc,YAAY,OAAO,aAAa,WACvD;GAEF,MAAM,MAAM,UAAU,MAAM;AAC5B,OAAI,CAAC,IACH;GAEF,MAAM,OAAO,UAAU,IAAI,IAAI,oBAAI,IAAI,KAAiC;AACxE,QAAK,IAAI,SAAS;AAClB,aAAU,IAAI,KAAK,KAAK;;EAE1B,IAAI,WAAoB,UAAuC;AAC7D,OAAI,OAAO,cAAc,YAAY,CAAC,UAAU,MAAM,EAAE;AACtD,cAAU,OAAO;AACjB;;GAEF,MAAM,OAAO,UAAU,IAAI,UAAU,MAAM,CAAC;AAC5C,OAAI,CAAC,KACH;AAEF,OAAI,OAAO,aAAa,YAAY;AAClC,cAAU,OAAO,UAAU,MAAM,CAAC;AAClC;;AAEF,QAAK,OAAO,SAAS;AACrB,OAAI,KAAK,SAAS,EAChB,WAAU,OAAO,UAAU,MAAM,CAAC;;EAGvC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
//#region src/runtime/polyfill/windowResize.ts
|
|
2
|
+
const windowResizeCallbacks = /* @__PURE__ */ new Set();
|
|
3
|
+
let windowResizeBridgeBound = false;
|
|
4
|
+
function readWindowResizeResult(getWindowInfo) {
|
|
5
|
+
const windowInfo = getWindowInfo();
|
|
6
|
+
return {
|
|
7
|
+
size: {
|
|
8
|
+
windowWidth: windowInfo.windowWidth,
|
|
9
|
+
windowHeight: windowInfo.windowHeight
|
|
10
|
+
},
|
|
11
|
+
windowWidth: windowInfo.windowWidth,
|
|
12
|
+
windowHeight: windowInfo.windowHeight
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
function notifyWindowResize(getWindowInfo) {
|
|
16
|
+
if (windowResizeCallbacks.size === 0) return;
|
|
17
|
+
const result = readWindowResizeResult(getWindowInfo);
|
|
18
|
+
for (const callback of windowResizeCallbacks) callback(result);
|
|
19
|
+
}
|
|
20
|
+
function bindWindowResizeBridge(getWindowInfo) {
|
|
21
|
+
if (windowResizeBridgeBound) return;
|
|
22
|
+
windowResizeBridgeBound = true;
|
|
23
|
+
(typeof window !== "undefined" ? window : globalThis).addEventListener?.("resize", () => notifyWindowResize(getWindowInfo));
|
|
24
|
+
}
|
|
25
|
+
function addWindowResizeCallback(callback, getWindowInfo) {
|
|
26
|
+
bindWindowResizeBridge(getWindowInfo);
|
|
27
|
+
windowResizeCallbacks.add(callback);
|
|
28
|
+
}
|
|
29
|
+
function removeWindowResizeCallback(callback) {
|
|
30
|
+
if (typeof callback !== "function") {
|
|
31
|
+
windowResizeCallbacks.clear();
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
windowResizeCallbacks.delete(callback);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
//#endregion
|
|
38
|
+
export { addWindowResizeCallback, removeWindowResizeCallback };
|
|
39
|
+
//# sourceMappingURL=windowResize.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"windowResize.mjs","names":[],"sources":["../../../src/runtime/polyfill/windowResize.ts"],"sourcesContent":["interface WindowResizeSnapshot {\n size: {\n windowWidth: number\n windowHeight: number\n }\n windowWidth: number\n windowHeight: number\n}\n\nconst windowResizeCallbacks = new Set<(result: WindowResizeSnapshot) => void>()\nlet windowResizeBridgeBound = false\n\nfunction readWindowResizeResult(getWindowInfo: () => { windowWidth: number, windowHeight: number }) {\n const windowInfo = getWindowInfo()\n return {\n size: {\n windowWidth: windowInfo.windowWidth,\n windowHeight: windowInfo.windowHeight,\n },\n windowWidth: windowInfo.windowWidth,\n windowHeight: windowInfo.windowHeight,\n }\n}\n\nfunction notifyWindowResize(getWindowInfo: () => { windowWidth: number, windowHeight: number }) {\n if (windowResizeCallbacks.size === 0) {\n return\n }\n const result = readWindowResizeResult(getWindowInfo)\n for (const callback of windowResizeCallbacks) {\n callback(result)\n }\n}\n\nfunction bindWindowResizeBridge(getWindowInfo: () => { windowWidth: number, windowHeight: number }) {\n if (windowResizeBridgeBound) {\n return\n }\n windowResizeBridgeBound = true\n const runtimeTarget = (typeof window !== 'undefined'\n ? window\n : globalThis) as {\n addEventListener?: (type: string, listener: () => void) => void\n }\n runtimeTarget.addEventListener?.('resize', () => notifyWindowResize(getWindowInfo))\n}\n\nexport function addWindowResizeCallback(\n callback: (result: WindowResizeSnapshot) => void,\n getWindowInfo: () => { windowWidth: number, windowHeight: number },\n) {\n bindWindowResizeBridge(getWindowInfo)\n windowResizeCallbacks.add(callback)\n}\n\nexport function removeWindowResizeCallback(callback?: (result: WindowResizeSnapshot) => void) {\n if (typeof callback !== 'function') {\n windowResizeCallbacks.clear()\n return\n }\n windowResizeCallbacks.delete(callback)\n}\n"],"mappings":";AASA,MAAM,wCAAwB,IAAI,KAA6C;AAC/E,IAAI,0BAA0B;AAE9B,SAAS,uBAAuB,eAAoE;CAClG,MAAM,aAAa,eAAe;AAClC,QAAO;EACL,MAAM;GACJ,aAAa,WAAW;GACxB,cAAc,WAAW;GAC1B;EACD,aAAa,WAAW;EACxB,cAAc,WAAW;EAC1B;;AAGH,SAAS,mBAAmB,eAAoE;AAC9F,KAAI,sBAAsB,SAAS,EACjC;CAEF,MAAM,SAAS,uBAAuB,cAAc;AACpD,MAAK,MAAM,YAAY,sBACrB,UAAS,OAAO;;AAIpB,SAAS,uBAAuB,eAAoE;AAClG,KAAI,wBACF;AAEF,2BAA0B;AAM1B,EALuB,OAAO,WAAW,cACrC,SACA,YAGU,mBAAmB,gBAAgB,mBAAmB,cAAc,CAAC;;AAGrF,SAAgB,wBACd,UACA,eACA;AACA,wBAAuB,cAAc;AACrC,uBAAsB,IAAI,SAAS;;AAGrC,SAAgB,2BAA2B,UAAmD;AAC5F,KAAI,OAAO,aAAa,YAAY;AAClC,wBAAsB,OAAO;AAC7B;;AAEF,uBAAsB,OAAO,SAAS"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
//#region src/runtime/polyfill/worker.ts
|
|
2
|
+
function resolveWorkerPath(path) {
|
|
3
|
+
const normalized = typeof path === "string" ? path.trim() : "";
|
|
4
|
+
if (!normalized) throw new TypeError("createWorker:fail invalid scriptPath");
|
|
5
|
+
try {
|
|
6
|
+
const base = (typeof location !== "undefined" ? location : void 0)?.href;
|
|
7
|
+
if (base) return new URL(normalized, base).toString();
|
|
8
|
+
} catch {}
|
|
9
|
+
return normalized;
|
|
10
|
+
}
|
|
11
|
+
function createWorkerBridge(path) {
|
|
12
|
+
const WorkerCtor = globalThis.Worker;
|
|
13
|
+
if (typeof WorkerCtor !== "function") throw new TypeError("createWorker:fail Worker is unavailable");
|
|
14
|
+
const scriptPath = resolveWorkerPath(path);
|
|
15
|
+
let nativeWorker;
|
|
16
|
+
try {
|
|
17
|
+
nativeWorker = new WorkerCtor(scriptPath);
|
|
18
|
+
} catch (error) {
|
|
19
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
20
|
+
throw new TypeError(`createWorker:fail ${message}`);
|
|
21
|
+
}
|
|
22
|
+
const messageCallbacks = /* @__PURE__ */ new Set();
|
|
23
|
+
const errorCallbacks = /* @__PURE__ */ new Set();
|
|
24
|
+
const handleMessage = (event) => {
|
|
25
|
+
for (const callback of messageCallbacks) callback({ data: event?.data });
|
|
26
|
+
};
|
|
27
|
+
const handleError = (event) => {
|
|
28
|
+
const payload = {
|
|
29
|
+
message: event?.message ?? "unknown error",
|
|
30
|
+
filename: event?.filename,
|
|
31
|
+
lineno: event?.lineno,
|
|
32
|
+
colno: event?.colno
|
|
33
|
+
};
|
|
34
|
+
for (const callback of errorCallbacks) callback(payload);
|
|
35
|
+
};
|
|
36
|
+
if (typeof nativeWorker.addEventListener === "function") {
|
|
37
|
+
nativeWorker.addEventListener("message", handleMessage);
|
|
38
|
+
nativeWorker.addEventListener("error", handleError);
|
|
39
|
+
} else {
|
|
40
|
+
nativeWorker.onmessage = handleMessage;
|
|
41
|
+
nativeWorker.onerror = handleError;
|
|
42
|
+
}
|
|
43
|
+
return {
|
|
44
|
+
postMessage(data) {
|
|
45
|
+
nativeWorker.postMessage(data);
|
|
46
|
+
},
|
|
47
|
+
terminate() {
|
|
48
|
+
nativeWorker.terminate();
|
|
49
|
+
messageCallbacks.clear();
|
|
50
|
+
errorCallbacks.clear();
|
|
51
|
+
},
|
|
52
|
+
onMessage(callback) {
|
|
53
|
+
if (typeof callback === "function") messageCallbacks.add(callback);
|
|
54
|
+
},
|
|
55
|
+
offMessage(callback) {
|
|
56
|
+
if (typeof callback !== "function") {
|
|
57
|
+
messageCallbacks.clear();
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
messageCallbacks.delete(callback);
|
|
61
|
+
},
|
|
62
|
+
onError(callback) {
|
|
63
|
+
if (typeof callback === "function") errorCallbacks.add(callback);
|
|
64
|
+
},
|
|
65
|
+
offError(callback) {
|
|
66
|
+
if (typeof callback !== "function") {
|
|
67
|
+
errorCallbacks.clear();
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
errorCallbacks.delete(callback);
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
//#endregion
|
|
76
|
+
export { createWorkerBridge };
|
|
77
|
+
//# sourceMappingURL=worker.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"worker.mjs","names":[],"sources":["../../../src/runtime/polyfill/worker.ts"],"sourcesContent":["type WorkerMessageCallback = (result: { data: unknown }) => void\ntype WorkerErrorCallback = (error: {\n message: string\n filename?: string\n lineno?: number\n colno?: number\n}) => void\n\nfunction resolveWorkerPath(path: unknown) {\n const normalized = typeof path === 'string' ? path.trim() : ''\n if (!normalized) {\n throw new TypeError('createWorker:fail invalid scriptPath')\n }\n try {\n const runtimeLocation = (typeof location !== 'undefined' ? location : undefined) as { href?: string } | undefined\n const base = runtimeLocation?.href\n if (base) {\n return new URL(normalized, base).toString()\n }\n }\n catch {\n // fallback to raw path\n }\n return normalized\n}\n\nexport function createWorkerBridge(path: string) {\n const WorkerCtor = (globalThis as { Worker?: typeof Worker }).Worker\n if (typeof WorkerCtor !== 'function') {\n throw new TypeError('createWorker:fail Worker is unavailable')\n }\n const scriptPath = resolveWorkerPath(path)\n\n let nativeWorker: Worker\n try {\n nativeWorker = new WorkerCtor(scriptPath)\n }\n catch (error) {\n const message = error instanceof Error ? error.message : String(error)\n throw new TypeError(`createWorker:fail ${message}`)\n }\n\n const messageCallbacks = new Set<WorkerMessageCallback>()\n const errorCallbacks = new Set<WorkerErrorCallback>()\n\n const handleMessage = (event: MessageEvent<unknown>) => {\n for (const callback of messageCallbacks) {\n callback({ data: event?.data })\n }\n }\n const handleError = (event: ErrorEvent) => {\n const payload = {\n message: event?.message ?? 'unknown error',\n filename: event?.filename,\n lineno: event?.lineno,\n colno: event?.colno,\n }\n for (const callback of errorCallbacks) {\n callback(payload)\n }\n }\n\n if (typeof nativeWorker.addEventListener === 'function') {\n nativeWorker.addEventListener('message', handleMessage as EventListener)\n nativeWorker.addEventListener('error', handleError as EventListener)\n }\n else {\n nativeWorker.onmessage = handleMessage as ((this: AbstractWorker, ev: MessageEvent) => any)\n nativeWorker.onerror = handleError as ((this: AbstractWorker, ev: ErrorEvent) => any)\n }\n\n return {\n postMessage(data: unknown) {\n nativeWorker.postMessage(data)\n },\n terminate() {\n nativeWorker.terminate()\n messageCallbacks.clear()\n errorCallbacks.clear()\n },\n onMessage(callback: WorkerMessageCallback) {\n if (typeof callback === 'function') {\n messageCallbacks.add(callback)\n }\n },\n offMessage(callback?: WorkerMessageCallback) {\n if (typeof callback !== 'function') {\n messageCallbacks.clear()\n return\n }\n messageCallbacks.delete(callback)\n },\n onError(callback: WorkerErrorCallback) {\n if (typeof callback === 'function') {\n errorCallbacks.add(callback)\n }\n },\n offError(callback?: WorkerErrorCallback) {\n if (typeof callback !== 'function') {\n errorCallbacks.clear()\n return\n }\n errorCallbacks.delete(callback)\n },\n }\n}\n"],"mappings":";AAQA,SAAS,kBAAkB,MAAe;CACxC,MAAM,aAAa,OAAO,SAAS,WAAW,KAAK,MAAM,GAAG;AAC5D,KAAI,CAAC,WACH,OAAM,IAAI,UAAU,uCAAuC;AAE7D,KAAI;EAEF,MAAM,QADmB,OAAO,aAAa,cAAc,WAAW,SACxC;AAC9B,MAAI,KACF,QAAO,IAAI,IAAI,YAAY,KAAK,CAAC,UAAU;SAGzC;AAGN,QAAO;;AAGT,SAAgB,mBAAmB,MAAc;CAC/C,MAAM,aAAc,WAA0C;AAC9D,KAAI,OAAO,eAAe,WACxB,OAAM,IAAI,UAAU,0CAA0C;CAEhE,MAAM,aAAa,kBAAkB,KAAK;CAE1C,IAAI;AACJ,KAAI;AACF,iBAAe,IAAI,WAAW,WAAW;UAEpC,OAAO;EACZ,MAAM,UAAU,iBAAiB,QAAQ,MAAM,UAAU,OAAO,MAAM;AACtE,QAAM,IAAI,UAAU,qBAAqB,UAAU;;CAGrD,MAAM,mCAAmB,IAAI,KAA4B;CACzD,MAAM,iCAAiB,IAAI,KAA0B;CAErD,MAAM,iBAAiB,UAAiC;AACtD,OAAK,MAAM,YAAY,iBACrB,UAAS,EAAE,MAAM,OAAO,MAAM,CAAC;;CAGnC,MAAM,eAAe,UAAsB;EACzC,MAAM,UAAU;GACd,SAAS,OAAO,WAAW;GAC3B,UAAU,OAAO;GACjB,QAAQ,OAAO;GACf,OAAO,OAAO;GACf;AACD,OAAK,MAAM,YAAY,eACrB,UAAS,QAAQ;;AAIrB,KAAI,OAAO,aAAa,qBAAqB,YAAY;AACvD,eAAa,iBAAiB,WAAW,cAA+B;AACxE,eAAa,iBAAiB,SAAS,YAA6B;QAEjE;AACH,eAAa,YAAY;AACzB,eAAa,UAAU;;AAGzB,QAAO;EACL,YAAY,MAAe;AACzB,gBAAa,YAAY,KAAK;;EAEhC,YAAY;AACV,gBAAa,WAAW;AACxB,oBAAiB,OAAO;AACxB,kBAAe,OAAO;;EAExB,UAAU,UAAiC;AACzC,OAAI,OAAO,aAAa,WACtB,kBAAiB,IAAI,SAAS;;EAGlC,WAAW,UAAkC;AAC3C,OAAI,OAAO,aAAa,YAAY;AAClC,qBAAiB,OAAO;AACxB;;AAEF,oBAAiB,OAAO,SAAS;;EAEnC,QAAQ,UAA+B;AACrC,OAAI,OAAO,aAAa,WACtB,gBAAe,IAAI,SAAS;;EAGhC,SAAS,UAAgC;AACvC,OAAI,OAAO,aAAa,YAAY;AAClC,mBAAe,OAAO;AACtB;;AAEF,kBAAe,OAAO,SAAS;;EAElC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { authorize, checkSession, getAccountInfoSync, getAppAuthorizeSetting, getAppBaseInfo, getBatteryInfo, getBatteryInfoSync, getDeviceInfo, getFuzzyLocation, getLocation, getMenuButtonBoundingClientRect, getNetworkType, getSetting, getSystemInfo, getSystemInfoSync, getSystemSetting, getUserInfo, getUserProfile, getWindowInfo, login, offNetworkStatusChange, offWindowResize, onNetworkStatusChange, onWindowResize, openAppAuthorizeSetting, openSetting, vibrateShort } from "./polyfill/deviceAuthSystemApi.mjs";
|
|
2
|
+
import { getEnterOptionsSync, getLaunchOptionsSync, initializePageRoutes, navigateBack, navigateTo, reLaunch, redirectTo, registerApp, registerComponent, registerPage, switchTab } from "./polyfill/routeRuntime.mjs";
|
|
3
|
+
import { clearStorage, clearStorageSync, createCanvasContext, createSelectorQuery, createVKSession, createVideoContext, createWorker, downloadFile, exitMiniProgram, getFileSystemManager, getStorage, getStorageInfo, getStorageInfoSync, getStorageSync, hideKeyboard, loadSubPackage, navigateToMiniProgram, nextTick, pageScrollTo, preloadSubpackage, removeStorage, removeStorageSync, request, setStorage, setStorageSync, startPullDownRefresh, stopPullDownRefresh, uploadFile } from "./polyfill/runtimeDataApi.mjs";
|
|
4
|
+
import { chooseAddress, chooseFile, chooseImage, chooseLocation, chooseMedia, chooseMessageFile, chooseVideo, compressImage, compressVideo, getClipboardData, getImageInfo, getVideoInfo, hideLoading, hideTabBar, makePhoneCall, openCustomerServiceChat, openDocument, openLocation, openVideoEditor, previewImage, previewMedia, requestPayment, requestSubscribeMessage, saveFile, saveFileToDisk, saveImageToPhotosAlbum, saveVideoToPhotosAlbum, scanCode, setClipboardData, showActionSheet, showLoading, showModal, showShareMenu, showTabBar, showToast, updateShareMenu } from "./polyfill/uiMediaApi.mjs";
|
|
5
|
+
import { canIUse, createInterstitialAd, createRewardedVideoAd, getExtConfig, getExtConfigSync, getLogManager, getUpdateManager, hideNavigationBarLoading, reportAnalytics, setBackgroundColor, setBackgroundTextStyle, setNavigationBarColor, setNavigationBarTitle, showNavigationBarLoading } from "./polyfill/index.mjs";
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { TemplateScope } from "./template.mjs";
|
|
2
|
+
import { ComponentPublicInstance } from "./component/types.mjs";
|
|
3
|
+
//#region src/runtime/renderContext.d.ts
|
|
4
|
+
interface RenderContext {
|
|
5
|
+
instance: ComponentPublicInstance;
|
|
6
|
+
eval: (expression: string, scope: TemplateScope, wxs?: Record<string, any>) => any;
|
|
7
|
+
createScope: (parent: TemplateScope, locals?: Record<string, any>) => TemplateScope;
|
|
8
|
+
mergeScope: (parent: TemplateScope, data?: any) => TemplateScope;
|
|
9
|
+
normalizeList: (value: any) => any[];
|
|
10
|
+
key: (rawKey: string, item: any, index: number, scope: TemplateScope, wxs?: Record<string, any>) => any;
|
|
11
|
+
renderTemplate: (templates: Record<string, any>, name: any, scope: TemplateScope, ctx: RenderContext) => any;
|
|
12
|
+
event: (eventName: string, handlerName: any, scope: TemplateScope, wxs?: Record<string, any>, flags?: {
|
|
13
|
+
catch?: boolean;
|
|
14
|
+
capture?: boolean;
|
|
15
|
+
}) => (event: Event) => void;
|
|
16
|
+
createWxsModule: (code: string, id: string, requireMap?: Record<string, any>) => Record<string, any>;
|
|
17
|
+
}
|
|
18
|
+
declare function createRenderContext(instance: ComponentPublicInstance, methods: Record<string, (event: any) => any>): RenderContext;
|
|
19
|
+
//#endregion
|
|
20
|
+
export { RenderContext, createRenderContext };
|
|
21
|
+
//# sourceMappingURL=renderContext.d.mts.map
|