@weapp-vite/web 1.3.16 → 1.3.18
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/compiler/wxml/attributes.mjs +6 -6
- package/dist/compiler/wxml/attributes.mjs.map +1 -1
- package/dist/compiler/wxml/renderer.mjs +6 -6
- package/dist/compiler/wxml/renderer.mjs.map +1 -1
- package/dist/compiler/wxml/specialNodes.mjs +6 -5
- package/dist/compiler/wxml/specialNodes.mjs.map +1 -1
- package/dist/plugin/files.mjs +1 -1
- package/dist/plugin/files.mjs.map +1 -1
- package/dist/runtime/component/constants.mjs +7 -2
- package/dist/runtime/component/constants.mjs.map +1 -1
- package/dist/runtime/component/dom.mjs +9 -3
- package/dist/runtime/component/dom.mjs.map +1 -1
- package/dist/runtime/component/events.mjs +5 -4
- package/dist/runtime/component/events.mjs.map +1 -1
- package/dist/runtime/legacyTemplate/dom.mjs +10 -65
- package/dist/runtime/legacyTemplate/dom.mjs.map +1 -1
- package/dist/runtime/legacyTemplate/index.mjs +7 -6
- package/dist/runtime/legacyTemplate/index.mjs.map +1 -1
- package/dist/runtime/polyfill/async.mjs +3 -3
- package/dist/runtime/polyfill/async.mjs.map +1 -1
- package/dist/runtime/polyfill/authApi.mjs +16 -16
- package/dist/runtime/polyfill/authApi.mjs.map +1 -1
- package/dist/runtime/polyfill/background.mjs +4 -4
- package/dist/runtime/polyfill/background.mjs.map +1 -1
- package/dist/runtime/polyfill/capability.mjs +6 -3
- package/dist/runtime/polyfill/capability.mjs.map +1 -1
- package/dist/runtime/polyfill/cloud.mjs +3 -3
- package/dist/runtime/polyfill/cloud.mjs.map +1 -1
- package/dist/runtime/polyfill/deviceApi.mjs +5 -5
- package/dist/runtime/polyfill/deviceApi.mjs.map +1 -1
- package/dist/runtime/polyfill/deviceAuthSystemApi.d.mts +2 -2
- package/dist/runtime/polyfill/deviceAuthSystemApi.mjs.map +1 -1
- package/dist/runtime/polyfill/fileSystemManager.mjs +7 -7
- package/dist/runtime/polyfill/fileSystemManager.mjs.map +1 -1
- package/dist/runtime/polyfill/index.mjs +21 -10
- package/dist/runtime/polyfill/index.mjs.map +1 -1
- package/dist/runtime/polyfill/interactionApi.mjs +8 -8
- package/dist/runtime/polyfill/interactionApi.mjs.map +1 -1
- package/dist/runtime/polyfill/locationApi.mjs +21 -21
- package/dist/runtime/polyfill/locationApi.mjs.map +1 -1
- package/dist/runtime/polyfill/mediaApi/file.mjs +12 -12
- package/dist/runtime/polyfill/mediaApi/file.mjs.map +1 -1
- package/dist/runtime/polyfill/mediaApi/info.mjs +7 -7
- package/dist/runtime/polyfill/mediaApi/info.mjs.map +1 -1
- package/dist/runtime/polyfill/mediaApi/picker.mjs +11 -11
- package/dist/runtime/polyfill/mediaApi/picker.mjs.map +1 -1
- package/dist/runtime/polyfill/mediaApi/preview.mjs +7 -7
- package/dist/runtime/polyfill/mediaApi/preview.mjs.map +1 -1
- package/dist/runtime/polyfill/mediaApi/process.mjs +6 -6
- package/dist/runtime/polyfill/mediaApi/process.mjs.map +1 -1
- package/dist/runtime/polyfill/menuApi.mjs +13 -13
- package/dist/runtime/polyfill/menuApi.mjs.map +1 -1
- package/dist/runtime/polyfill/navigationBarRuntime.mjs +5 -4
- package/dist/runtime/polyfill/navigationBarRuntime.mjs.map +1 -1
- package/dist/runtime/polyfill/network/requestBridge.mjs +7 -7
- package/dist/runtime/polyfill/network/requestBridge.mjs.map +1 -1
- package/dist/runtime/polyfill/platformApi.mjs +2 -2
- package/dist/runtime/polyfill/platformApi.mjs.map +1 -1
- package/dist/runtime/polyfill/runtimeCapabilityApi.mjs +2 -2
- package/dist/runtime/polyfill/runtimeCapabilityApi.mjs.map +1 -1
- package/dist/runtime/polyfill/runtimeDataApi.d.mts +7 -7
- package/dist/runtime/polyfill/runtimeDataApi.mjs +5 -5
- package/dist/runtime/polyfill/runtimeDataApi.mjs.map +1 -1
- package/dist/runtime/polyfill/runtimeOps.mjs +10 -10
- package/dist/runtime/polyfill/runtimeOps.mjs.map +1 -1
- package/dist/runtime/polyfill/storageAsync.mjs +12 -12
- package/dist/runtime/polyfill/storageAsync.mjs.map +1 -1
- package/dist/runtime/polyfill/systemApi.mjs +3 -3
- package/dist/runtime/polyfill/systemApi.mjs.map +1 -1
- package/dist/runtime/polyfill/types/base.d.mts +5 -5
- package/dist/runtime/polyfill/types/common.d.mts +22 -22
- package/dist/runtime/polyfill/types/locationRuntime.d.mts +27 -27
- package/dist/runtime/polyfill/types/mediaAuth.d.mts +30 -30
- package/dist/runtime/polyfill/types/platformRuntime.d.mts +13 -13
- package/dist/runtime/polyfill/types/systemAuth.d.mts +11 -11
- package/dist/runtime/polyfill/uiFeedback.mjs +4 -4
- package/dist/runtime/polyfill/uiFeedback.mjs.map +1 -1
- package/dist/runtime/polyfill/uiMediaApi.d.mts +2 -2
- package/dist/runtime/polyfill/uiMediaApi.mjs.map +1 -1
- package/dist/shared/wxml.mjs +29 -10
- package/dist/shared/wxml.mjs.map +1 -1
- package/package.json +3 -3
|
@@ -1,43 +1,43 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { MiniProgramAsyncOptions, MiniProgramBaseResult } from "./base.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/runtime/polyfill/types/platformRuntime.d.ts
|
|
4
|
-
interface VibrateShortOptions extends
|
|
4
|
+
interface VibrateShortOptions extends MiniProgramAsyncOptions<MiniProgramBaseResult> {
|
|
5
5
|
type?: 'heavy' | 'medium' | 'light';
|
|
6
6
|
}
|
|
7
7
|
interface BatteryInfo {
|
|
8
8
|
level: number;
|
|
9
9
|
isCharging: boolean;
|
|
10
10
|
}
|
|
11
|
-
interface GetBatteryInfoSuccessResult extends
|
|
12
|
-
interface GetExtConfigSuccessResult extends
|
|
11
|
+
interface GetBatteryInfoSuccessResult extends MiniProgramBaseResult, BatteryInfo {}
|
|
12
|
+
interface GetExtConfigSuccessResult extends MiniProgramBaseResult {
|
|
13
13
|
extConfig: Record<string, any>;
|
|
14
14
|
}
|
|
15
|
-
interface GetExtConfigOptions extends
|
|
16
|
-
interface ShowModalSuccessResult extends
|
|
15
|
+
interface GetExtConfigOptions extends MiniProgramAsyncOptions<GetExtConfigSuccessResult> {}
|
|
16
|
+
interface ShowModalSuccessResult extends MiniProgramBaseResult {
|
|
17
17
|
confirm: boolean;
|
|
18
18
|
cancel: boolean;
|
|
19
19
|
}
|
|
20
|
-
interface ShowModalOptions extends
|
|
20
|
+
interface ShowModalOptions extends MiniProgramAsyncOptions<ShowModalSuccessResult> {
|
|
21
21
|
title?: string;
|
|
22
22
|
content?: string;
|
|
23
23
|
showCancel?: boolean;
|
|
24
24
|
confirmText?: string;
|
|
25
25
|
cancelText?: string;
|
|
26
26
|
}
|
|
27
|
-
interface ShowActionSheetSuccessResult extends
|
|
27
|
+
interface ShowActionSheetSuccessResult extends MiniProgramBaseResult {
|
|
28
28
|
tapIndex: number;
|
|
29
29
|
}
|
|
30
|
-
interface ShowActionSheetOptions extends
|
|
30
|
+
interface ShowActionSheetOptions extends MiniProgramAsyncOptions<ShowActionSheetSuccessResult> {
|
|
31
31
|
itemList?: string[];
|
|
32
32
|
itemColor?: string;
|
|
33
33
|
alertText?: string;
|
|
34
34
|
}
|
|
35
|
-
interface OpenDocumentOptions extends
|
|
35
|
+
interface OpenDocumentOptions extends MiniProgramAsyncOptions<MiniProgramBaseResult> {
|
|
36
36
|
filePath?: string;
|
|
37
37
|
fileType?: string;
|
|
38
38
|
showMenu?: boolean;
|
|
39
39
|
}
|
|
40
|
-
interface PageScrollToOptions extends
|
|
40
|
+
interface PageScrollToOptions extends MiniProgramAsyncOptions<MiniProgramBaseResult> {
|
|
41
41
|
scrollTop?: number;
|
|
42
42
|
duration?: number;
|
|
43
43
|
}
|
|
@@ -130,8 +130,8 @@ interface InterstitialAd {
|
|
|
130
130
|
offClose: (callback?: () => void) => void;
|
|
131
131
|
}
|
|
132
132
|
interface VkSession {
|
|
133
|
-
start: () => Promise<
|
|
134
|
-
stop: () => Promise<
|
|
133
|
+
start: () => Promise<MiniProgramBaseResult>;
|
|
134
|
+
stop: () => Promise<MiniProgramBaseResult>;
|
|
135
135
|
destroy: () => void;
|
|
136
136
|
on: (eventName: string, callback: (payload: unknown) => void) => void;
|
|
137
137
|
off: (eventName?: string, callback?: (payload: unknown) => void) => void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { MiniProgramAsyncOptions, MiniProgramBaseResult } from "./base.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/runtime/polyfill/types/systemAuth.d.ts
|
|
4
4
|
interface SystemInfo {
|
|
@@ -75,15 +75,15 @@ interface AppAuthorizeSetting {
|
|
|
75
75
|
notificationAuthorized: AppAuthorizeStatus;
|
|
76
76
|
phoneCalendarAuthorized: AppAuthorizeStatus;
|
|
77
77
|
}
|
|
78
|
-
interface OpenAppAuthorizeSettingSuccessResult extends
|
|
79
|
-
interface OpenAppAuthorizeSettingOptions extends
|
|
80
|
-
interface LoginSuccessResult extends
|
|
78
|
+
interface OpenAppAuthorizeSettingSuccessResult extends MiniProgramBaseResult, AppAuthorizeSetting {}
|
|
79
|
+
interface OpenAppAuthorizeSettingOptions extends MiniProgramAsyncOptions<OpenAppAuthorizeSettingSuccessResult> {}
|
|
80
|
+
interface LoginSuccessResult extends MiniProgramBaseResult {
|
|
81
81
|
code: string;
|
|
82
82
|
}
|
|
83
|
-
interface LoginOptions extends
|
|
83
|
+
interface LoginOptions extends MiniProgramAsyncOptions<LoginSuccessResult> {
|
|
84
84
|
timeout?: number;
|
|
85
85
|
}
|
|
86
|
-
interface CheckSessionOptions extends
|
|
86
|
+
interface CheckSessionOptions extends MiniProgramAsyncOptions<MiniProgramBaseResult> {}
|
|
87
87
|
interface UserInfo {
|
|
88
88
|
nickName: string;
|
|
89
89
|
avatarUrl: string;
|
|
@@ -93,17 +93,17 @@ interface UserInfo {
|
|
|
93
93
|
city: string;
|
|
94
94
|
language: string;
|
|
95
95
|
}
|
|
96
|
-
interface UserProfileSuccessResult extends
|
|
96
|
+
interface UserProfileSuccessResult extends MiniProgramBaseResult {
|
|
97
97
|
userInfo: UserInfo;
|
|
98
98
|
rawData: string;
|
|
99
99
|
signature: string;
|
|
100
100
|
encryptedData: string;
|
|
101
101
|
iv: string;
|
|
102
102
|
}
|
|
103
|
-
interface GetUserInfoOptions extends
|
|
103
|
+
interface GetUserInfoOptions extends MiniProgramAsyncOptions<UserProfileSuccessResult> {
|
|
104
104
|
lang?: 'en' | 'zh_CN' | 'zh_TW';
|
|
105
105
|
}
|
|
106
|
-
interface GetUserProfileOptions extends
|
|
106
|
+
interface GetUserProfileOptions extends MiniProgramAsyncOptions<UserProfileSuccessResult> {
|
|
107
107
|
desc?: string;
|
|
108
108
|
lang?: 'en' | 'zh_CN' | 'zh_TW';
|
|
109
109
|
}
|
|
@@ -115,8 +115,8 @@ interface AccountInfoSync {
|
|
|
115
115
|
};
|
|
116
116
|
plugin: Record<string, unknown>;
|
|
117
117
|
}
|
|
118
|
-
interface GetSystemInfoSuccessResult extends
|
|
119
|
-
interface GetSystemInfoOptions extends
|
|
118
|
+
interface GetSystemInfoSuccessResult extends MiniProgramBaseResult, SystemInfo {}
|
|
119
|
+
interface GetSystemInfoOptions extends MiniProgramAsyncOptions<GetSystemInfoSuccessResult> {}
|
|
120
120
|
//#endregion
|
|
121
121
|
export { AccountInfoSync, AppAuthorizeSetting, AppBaseInfo, CheckSessionOptions, DeviceInfo, GetSystemInfoOptions, GetUserInfoOptions, GetUserProfileOptions, LoginOptions, MenuButtonBoundingClientRect, OpenAppAuthorizeSettingOptions, SystemInfo, SystemSetting, WindowInfo };
|
|
122
122
|
//# sourceMappingURL=systemAuth.d.mts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { callMiniProgramAsyncSuccess, normalizeDuration } from "./async.mjs";
|
|
2
2
|
import { getLoadingElement, getToastElement, hideToastElement, resolveToastPrefix, setLoadingVisible, setToastVisible } from "./ui.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/runtime/polyfill/uiFeedback.ts
|
|
@@ -16,18 +16,18 @@ function showToastBridge(options) {
|
|
|
16
16
|
toastHideTimer = void 0;
|
|
17
17
|
}, duration);
|
|
18
18
|
}
|
|
19
|
-
const result =
|
|
19
|
+
const result = callMiniProgramAsyncSuccess(options, { errMsg: "showToast:ok" });
|
|
20
20
|
return Promise.resolve(result);
|
|
21
21
|
}
|
|
22
22
|
function showLoadingBridge(options) {
|
|
23
23
|
const loading = getLoadingElement();
|
|
24
24
|
if (loading) setLoadingVisible(loading, true, options?.title?.trim() || "加载中", Boolean(options?.mask));
|
|
25
|
-
return Promise.resolve(
|
|
25
|
+
return Promise.resolve(callMiniProgramAsyncSuccess(options, { errMsg: "showLoading:ok" }));
|
|
26
26
|
}
|
|
27
27
|
function hideLoadingBridge(options) {
|
|
28
28
|
const loading = getLoadingElement();
|
|
29
29
|
if (loading) setLoadingVisible(loading, false, loading.textContent ?? "", false);
|
|
30
|
-
return Promise.resolve(
|
|
30
|
+
return Promise.resolve(callMiniProgramAsyncSuccess(options, { errMsg: "hideLoading:ok" }));
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uiFeedback.mjs","names":[],"sources":["../../../src/runtime/polyfill/uiFeedback.ts"],"sourcesContent":["import {\n
|
|
1
|
+
{"version":3,"file":"uiFeedback.mjs","names":[],"sources":["../../../src/runtime/polyfill/uiFeedback.ts"],"sourcesContent":["import {\n callMiniProgramAsyncSuccess,\n normalizeDuration,\n} from './async'\nimport {\n getLoadingElement,\n getToastElement,\n hideToastElement,\n resolveToastPrefix,\n setLoadingVisible,\n setToastVisible,\n} from './ui'\n\nlet toastHideTimer: ReturnType<typeof setTimeout> | undefined\n\nexport function showToastBridge(options?: any): Promise<any> {\n const toast = getToastElement()\n const content = `${resolveToastPrefix(options?.icon)}${options?.title ?? ''}`.trim()\n if (toast) {\n toast.textContent = content\n setToastVisible(toast, true)\n if (toastHideTimer) {\n clearTimeout(toastHideTimer)\n }\n const duration = normalizeDuration(options?.duration, 1500)\n toastHideTimer = setTimeout(() => {\n hideToastElement()\n toastHideTimer = undefined\n }, duration)\n }\n const result = callMiniProgramAsyncSuccess(options, { errMsg: 'showToast:ok' })\n return Promise.resolve(result)\n}\n\nexport function showLoadingBridge(options?: any): Promise<any> {\n const loading = getLoadingElement()\n if (loading) {\n setLoadingVisible(\n loading,\n true,\n options?.title?.trim() || '加载中',\n Boolean(options?.mask),\n )\n }\n return Promise.resolve(callMiniProgramAsyncSuccess(options, { errMsg: 'showLoading:ok' }))\n}\n\nexport function hideLoadingBridge(options?: any): Promise<any> {\n const loading = getLoadingElement()\n if (loading) {\n setLoadingVisible(loading, false, loading.textContent ?? '', false)\n }\n return Promise.resolve(callMiniProgramAsyncSuccess(options, { errMsg: 'hideLoading:ok' }))\n}\n"],"mappings":";;;;AAaA,IAAI;AAEJ,SAAgB,gBAAgB,SAA6B;CAC3D,MAAM,QAAQ,iBAAiB;CAC/B,MAAM,UAAU,GAAG,mBAAmB,SAAS,KAAK,GAAG,SAAS,SAAS,KAAK,MAAM;AACpF,KAAI,OAAO;AACT,QAAM,cAAc;AACpB,kBAAgB,OAAO,KAAK;AAC5B,MAAI,eACF,cAAa,eAAe;EAE9B,MAAM,WAAW,kBAAkB,SAAS,UAAU,KAAK;AAC3D,mBAAiB,iBAAiB;AAChC,qBAAkB;AAClB,oBAAiB;KAChB,SAAS;;CAEd,MAAM,SAAS,4BAA4B,SAAS,EAAE,QAAQ,gBAAgB,CAAC;AAC/E,QAAO,QAAQ,QAAQ,OAAO;;AAGhC,SAAgB,kBAAkB,SAA6B;CAC7D,MAAM,UAAU,mBAAmB;AACnC,KAAI,QACF,mBACE,SACA,MACA,SAAS,OAAO,MAAM,IAAI,OAC1B,QAAQ,SAAS,KAAK,CACvB;AAEH,QAAO,QAAQ,QAAQ,4BAA4B,SAAS,EAAE,QAAQ,kBAAkB,CAAC,CAAC;;AAG5F,SAAgB,kBAAkB,SAA6B;CAC7D,MAAM,UAAU,mBAAmB;AACnC,KAAI,QACF,mBAAkB,SAAS,OAAO,QAAQ,eAAe,IAAI,MAAM;AAErE,QAAO,QAAQ,QAAQ,4BAA4B,SAAS,EAAE,QAAQ,kBAAkB,CAAC,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { MiniProgramAsyncOptions, MiniProgramBaseResult } from "./types/base.mjs";
|
|
2
2
|
import { ChooseImageOptions, GetClipboardDataOptions, PreviewImageOptions, SetClipboardDataOptions, ShowToastOptions } from "./types/common.mjs";
|
|
3
3
|
import { ChooseAddressOptions, ChooseLocationOptions, GetImageInfoOptions, MakePhoneCallOptions, OpenCustomerServiceChatOptions, OpenLocationOptions, RequestPaymentOptions, RequestSubscribeMessageOptions, RequestSubscribeMessageSuccessResult, ShareMenuOptions, ShowLoadingOptions, TabBarOptions } from "./types/locationRuntime.mjs";
|
|
4
4
|
import { ChooseFileOptions, ChooseMediaOptions, ChooseMessageFileOptions, ChooseVideoOptions, CompressImageOptions, CompressVideoOptions, GetVideoInfoOptions, OpenVideoEditorOptions, PreviewMediaOptions, SaveFileOptions, SaveFileToDiskOptions, SaveImageToPhotosAlbumOptions, SaveVideoToPhotosAlbumOptions, ScanCodeOptions } from "./types/mediaAuth.mjs";
|
|
@@ -7,7 +7,7 @@ import { OpenDocumentOptions, ShowActionSheetOptions, ShowModalOptions } from ".
|
|
|
7
7
|
//#region src/runtime/polyfill/uiMediaApi.d.ts
|
|
8
8
|
declare function showToast(options?: ShowToastOptions): Promise<any>;
|
|
9
9
|
declare function showLoading(options?: ShowLoadingOptions): Promise<any>;
|
|
10
|
-
declare function hideLoading(options?:
|
|
10
|
+
declare function hideLoading(options?: MiniProgramAsyncOptions<MiniProgramBaseResult>): Promise<any>;
|
|
11
11
|
declare function showShareMenu(options?: ShareMenuOptions): Promise<any>;
|
|
12
12
|
declare function updateShareMenu(options?: ShareMenuOptions): Promise<any>;
|
|
13
13
|
declare function openCustomerServiceChat(options?: OpenCustomerServiceChatOptions): Promise<{
|
|
@@ -1 +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 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
|
|
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"}
|
package/dist/shared/wxml.mjs
CHANGED
|
@@ -1,13 +1,19 @@
|
|
|
1
|
+
import { getMiniProgramDirectivePrefix, getSupportedMiniProgramPlatforms } from "@weapp-core/shared";
|
|
2
|
+
|
|
1
3
|
//#region src/shared/wxml.ts
|
|
2
|
-
const
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
"
|
|
10
|
-
]
|
|
4
|
+
const CONTROL_ATTR_SUFFIXES = [
|
|
5
|
+
"if",
|
|
6
|
+
"elif",
|
|
7
|
+
"else",
|
|
8
|
+
"for",
|
|
9
|
+
"for-item",
|
|
10
|
+
"for-index",
|
|
11
|
+
"key"
|
|
12
|
+
];
|
|
13
|
+
const CONTROL_ATTR_PREFIXES = Array.from(new Set(getSupportedMiniProgramPlatforms().map((platform) => getMiniProgramDirectivePrefix(platform))));
|
|
14
|
+
const TEMPLATE_IMPORT_TAG_NAMES = Array.from(new Set(["import", ...CONTROL_ATTR_PREFIXES.map((prefix) => `${prefix}-import`)]));
|
|
15
|
+
const TEMPLATE_INCLUDE_TAG_NAMES = Array.from(new Set(["include", ...CONTROL_ATTR_PREFIXES.map((prefix) => `${prefix}-include`)]));
|
|
16
|
+
const CONTROL_ATTRS = new Set([...CONTROL_ATTR_PREFIXES.flatMap((prefix) => CONTROL_ATTR_SUFFIXES.map((suffix) => `${prefix}:${suffix}`))]);
|
|
11
17
|
const EVENT_PREFIX_RE = /^(?:bind|catch|mut-bind|capture-bind|capture-catch)([\w-]+)$/;
|
|
12
18
|
const EVENT_KIND_ALIAS = { tap: "click" };
|
|
13
19
|
const SELF_CLOSING_TAGS = new Set([
|
|
@@ -27,6 +33,19 @@ const SELF_CLOSING_TAGS = new Set([
|
|
|
27
33
|
"track",
|
|
28
34
|
"wbr"
|
|
29
35
|
]);
|
|
36
|
+
function resolveControlAttributeName(attribs, suffix) {
|
|
37
|
+
for (const prefix of CONTROL_ATTR_PREFIXES) {
|
|
38
|
+
const name = `${prefix}:${suffix}`;
|
|
39
|
+
if (name in attribs) return name;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
function resolveControlAttributeValue(attribs, suffix) {
|
|
43
|
+
const name = resolveControlAttributeName(attribs, suffix);
|
|
44
|
+
return name ? attribs[name] : void 0;
|
|
45
|
+
}
|
|
46
|
+
function hasControlAttribute(attribs, suffix) {
|
|
47
|
+
return resolveControlAttributeName(attribs, suffix) !== void 0;
|
|
48
|
+
}
|
|
30
49
|
function normalizeTagName(name) {
|
|
31
50
|
switch (name) {
|
|
32
51
|
case "view":
|
|
@@ -60,5 +79,5 @@ function normalizeAttributeName(name) {
|
|
|
60
79
|
}
|
|
61
80
|
|
|
62
81
|
//#endregion
|
|
63
|
-
export { CONTROL_ATTRS, EVENT_KIND_ALIAS, EVENT_PREFIX_RE, SELF_CLOSING_TAGS, normalizeAttributeName, normalizeTagName };
|
|
82
|
+
export { CONTROL_ATTRS, EVENT_KIND_ALIAS, EVENT_PREFIX_RE, SELF_CLOSING_TAGS, TEMPLATE_IMPORT_TAG_NAMES, TEMPLATE_INCLUDE_TAG_NAMES, hasControlAttribute, normalizeAttributeName, normalizeTagName, resolveControlAttributeValue };
|
|
64
83
|
//# sourceMappingURL=wxml.mjs.map
|
package/dist/shared/wxml.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wxml.mjs","names":[],"sources":["../../src/shared/wxml.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"wxml.mjs","names":[],"sources":["../../src/shared/wxml.ts"],"sourcesContent":["import { getMiniProgramDirectivePrefix, getSupportedMiniProgramPlatforms } from '@weapp-core/shared'\n\nconst CONTROL_ATTR_SUFFIXES = [\n 'if',\n 'elif',\n 'else',\n 'for',\n 'for-item',\n 'for-index',\n 'key',\n] as const\n\nexport type ControlAttrSuffix = typeof CONTROL_ATTR_SUFFIXES[number]\n\nexport const CONTROL_ATTR_PREFIXES = Array.from(new Set(\n getSupportedMiniProgramPlatforms().map(platform => getMiniProgramDirectivePrefix(platform)),\n))\n\nexport const TEMPLATE_IMPORT_TAG_NAMES = Array.from(new Set([\n 'import',\n ...CONTROL_ATTR_PREFIXES.map(prefix => `${prefix}-import`),\n]))\n\nexport const TEMPLATE_INCLUDE_TAG_NAMES = Array.from(new Set([\n 'include',\n ...CONTROL_ATTR_PREFIXES.map(prefix => `${prefix}-include`),\n]))\n\nexport const CONTROL_ATTRS = new Set([\n ...CONTROL_ATTR_PREFIXES.flatMap(prefix => CONTROL_ATTR_SUFFIXES.map(suffix => `${prefix}:${suffix}`)),\n])\n\nexport const EVENT_PREFIX_RE = /^(?:bind|catch|mut-bind|capture-bind|capture-catch)([\\w-]+)$/\nexport const EVENT_KIND_ALIAS: Record<string, string> = {\n tap: 'click',\n}\n\nexport const SELF_CLOSING_TAGS = new Set([\n 'area',\n 'base',\n 'br',\n 'col',\n 'embed',\n 'hr',\n 'img',\n 'image',\n 'input',\n 'link',\n 'meta',\n 'param',\n 'source',\n 'track',\n 'wbr',\n])\n\nexport function resolveControlAttributeName(\n attribs: Record<string, string>,\n suffix: ControlAttrSuffix,\n): string | undefined {\n for (const prefix of CONTROL_ATTR_PREFIXES) {\n const name = `${prefix}:${suffix}`\n if (name in attribs) {\n return name\n }\n }\n return undefined\n}\n\nexport function resolveControlAttributeValue(\n attribs: Record<string, string>,\n suffix: ControlAttrSuffix,\n): string | undefined {\n const name = resolveControlAttributeName(attribs, suffix)\n return name ? attribs[name] : undefined\n}\n\nexport function hasControlAttribute(\n attribs: Record<string, string>,\n suffix: ControlAttrSuffix,\n): boolean {\n return resolveControlAttributeName(attribs, suffix) !== undefined\n}\n\nexport function normalizeTagName(name: string) {\n switch (name) {\n case 'view':\n case 'cover-view':\n case 'navigator':\n case 'scroll-view':\n case 'swiper':\n case 'swiper-item':\n case 'movable-area':\n case 'movable-view':\n case 'cover-image':\n return 'div'\n case 'text':\n case 'icon':\n return 'span'\n case 'image':\n return 'img'\n case 'button':\n return 'weapp-button'\n case 'input':\n return 'input'\n case 'textarea':\n return 'textarea'\n case 'form':\n return 'form'\n case 'label':\n return 'label'\n case 'picker':\n case 'picker-view':\n return 'select'\n case 'block':\n return '#fragment'\n case 'slot':\n return 'slot'\n default:\n return name || 'div'\n }\n}\n\nexport function normalizeAttributeName(name: string) {\n if (name === 'class' || name === 'style' || name.startsWith('data-')) {\n return name\n }\n if (name === 'hover-class') {\n return 'data-hover-class'\n }\n return name.replace(/[A-Z]/g, match => `-${match.toLowerCase()}`)\n}\n"],"mappings":";;;AAEA,MAAM,wBAAwB;CAC5B;CACA;CACA;CACA;CACA;CACA;CACA;CACD;AAID,MAAa,wBAAwB,MAAM,KAAK,IAAI,IAClD,kCAAkC,CAAC,KAAI,aAAY,8BAA8B,SAAS,CAAC,CAC5F,CAAC;AAEF,MAAa,4BAA4B,MAAM,KAAK,IAAI,IAAI,CAC1D,UACA,GAAG,sBAAsB,KAAI,WAAU,GAAG,OAAO,SAAS,CAC3D,CAAC,CAAC;AAEH,MAAa,6BAA6B,MAAM,KAAK,IAAI,IAAI,CAC3D,WACA,GAAG,sBAAsB,KAAI,WAAU,GAAG,OAAO,UAAU,CAC5D,CAAC,CAAC;AAEH,MAAa,gBAAgB,IAAI,IAAI,CACnC,GAAG,sBAAsB,SAAQ,WAAU,sBAAsB,KAAI,WAAU,GAAG,OAAO,GAAG,SAAS,CAAC,CACvG,CAAC;AAEF,MAAa,kBAAkB;AAC/B,MAAa,mBAA2C,EACtD,KAAK,SACN;AAED,MAAa,oBAAoB,IAAI,IAAI;CACvC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD,CAAC;AAEF,SAAgB,4BACd,SACA,QACoB;AACpB,MAAK,MAAM,UAAU,uBAAuB;EAC1C,MAAM,OAAO,GAAG,OAAO,GAAG;AAC1B,MAAI,QAAQ,QACV,QAAO;;;AAMb,SAAgB,6BACd,SACA,QACoB;CACpB,MAAM,OAAO,4BAA4B,SAAS,OAAO;AACzD,QAAO,OAAO,QAAQ,QAAQ;;AAGhC,SAAgB,oBACd,SACA,QACS;AACT,QAAO,4BAA4B,SAAS,OAAO,KAAK;;AAG1D,SAAgB,iBAAiB,MAAc;AAC7C,SAAQ,MAAR;EACE,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK,cACH,QAAO;EACT,KAAK;EACL,KAAK,OACH,QAAO;EACT,KAAK,QACH,QAAO;EACT,KAAK,SACH,QAAO;EACT,KAAK,QACH,QAAO;EACT,KAAK,WACH,QAAO;EACT,KAAK,OACH,QAAO;EACT,KAAK,QACH,QAAO;EACT,KAAK;EACL,KAAK,cACH,QAAO;EACT,KAAK,QACH,QAAO;EACT,KAAK,OACH,QAAO;EACT,QACE,QAAO,QAAQ;;;AAIrB,SAAgB,uBAAuB,MAAc;AACnD,KAAI,SAAS,WAAW,SAAS,WAAW,KAAK,WAAW,QAAQ,CAClE,QAAO;AAET,KAAI,SAAS,cACX,QAAO;AAET,QAAO,KAAK,QAAQ,WAAU,UAAS,IAAI,MAAM,aAAa,GAAG"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@weapp-vite/web",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.3.
|
|
4
|
+
"version": "1.3.18",
|
|
5
5
|
"description": "Experimental web runtime for weapp-vite templates",
|
|
6
6
|
"author": "ice breaker <1324318532@qq.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -57,8 +57,8 @@
|
|
|
57
57
|
"magic-string": "^0.30.21",
|
|
58
58
|
"pathe": "^2.0.3",
|
|
59
59
|
"@weapp-core/constants": "^0.1.1",
|
|
60
|
-
"@weapp-core/shared": "^3.0.
|
|
61
|
-
"rolldown-require": "2.0.
|
|
60
|
+
"@weapp-core/shared": "^3.0.4",
|
|
61
|
+
"rolldown-require": "2.0.14"
|
|
62
62
|
},
|
|
63
63
|
"scripts": {
|
|
64
64
|
"dev": "tsdown -w --sourcemap",
|