@weapp-vite/web 1.4.20 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/compiler/wxml/attributes.mjs +5 -3
- package/dist/compiler/wxml/attributes.mjs.map +1 -1
- package/dist/compiler/wxml/compile.mjs +6 -1
- package/dist/compiler/wxml/compile.mjs.map +1 -1
- package/dist/compiler/wxml/types.d.mts +1 -2
- package/dist/css/wxss.d.mts +3 -4
- package/dist/index.d.mts +5 -3
- package/dist/index.mjs +4 -3
- package/dist/plugin/assets.d.mts +1 -2
- package/dist/plugin/constants.mjs +2 -1
- package/dist/plugin/constants.mjs.map +1 -1
- package/dist/plugin/index.d.mts +2 -2
- package/dist/plugin/index.mjs +7 -2
- package/dist/plugin/index.mjs.map +1 -1
- package/dist/plugin/register.mjs +20 -5
- package/dist/plugin/register.mjs.map +1 -1
- package/dist/plugin/types.d.mts +5 -6
- package/dist/runtime/button/index.d.mts +3 -4
- package/dist/runtime/component/constants.mjs +9 -1
- package/dist/runtime/component/constants.mjs.map +1 -1
- package/dist/runtime/component/element.mjs +24 -4
- package/dist/runtime/component/element.mjs.map +1 -1
- package/dist/runtime/component/events.mjs +6 -4
- package/dist/runtime/component/events.mjs.map +1 -1
- package/dist/runtime/component/index.d.mts +2 -2
- package/dist/runtime/component/types.d.mts +13 -14
- package/dist/runtime/eventBinding.d.mts +16 -0
- package/dist/runtime/eventBinding.mjs +51 -0
- package/dist/runtime/eventBinding.mjs.map +1 -0
- package/dist/runtime/execution.d.mts +3 -4
- package/dist/runtime/host/index.d.mts +9 -9
- package/dist/runtime/host/types.d.mts +4 -5
- package/dist/runtime/hostGlobals.d.mts +1 -2
- package/dist/runtime/index.d.mts +5 -3
- package/dist/runtime/index.mjs +4 -3
- package/dist/runtime/index.mjs.map +1 -1
- package/dist/runtime/inputHandlerResult.mjs +22 -0
- package/dist/runtime/inputHandlerResult.mjs.map +1 -0
- package/dist/runtime/legacyTemplate/dom.mjs +27 -9
- package/dist/runtime/legacyTemplate/dom.mjs.map +1 -1
- package/dist/runtime/legacyTemplate/index.d.mts +2 -3
- package/dist/runtime/legacyTemplate/types.d.mts +2 -3
- package/dist/runtime/nativeComponents/form.d.mts +1 -2
- package/dist/runtime/nativeComponents/image.d.mts +1 -2
- package/dist/runtime/nativeComponents/index.d.mts +2 -2
- package/dist/runtime/nativeComponents/input.d.mts +1 -2
- package/dist/runtime/nativeComponents/input.mjs +3 -1
- package/dist/runtime/nativeComponents/input.mjs.map +1 -1
- package/dist/runtime/nativeComponents/scrollView.d.mts +1 -2
- package/dist/runtime/nativeComponents/scrollView.mjs +21 -12
- package/dist/runtime/nativeComponents/scrollView.mjs.map +1 -1
- package/dist/runtime/nativeComponents/switch.d.mts +1 -2
- package/dist/runtime/nativeComponents/textarea.d.mts +1 -2
- package/dist/runtime/nativeComponents/video/helpers.d.mts +3 -4
- package/dist/runtime/navigationBar/index.d.mts +2 -2
- package/dist/runtime/pageLayout.d.mts +2 -3
- package/dist/runtime/polyfill/async.d.mts +1 -2
- package/dist/runtime/polyfill/deviceAuthSystemApi.d.mts +27 -28
- package/dist/runtime/polyfill/index.d.mts +17 -16
- package/dist/runtime/polyfill/index.mjs +6 -2
- package/dist/runtime/polyfill/index.mjs.map +1 -1
- package/dist/runtime/polyfill/routeRuntime/appLifecycle.mjs +53 -7
- package/dist/runtime/polyfill/routeRuntime/appLifecycle.mjs.map +1 -1
- package/dist/runtime/polyfill/routeRuntime/history.d.mts +8 -9
- package/dist/runtime/polyfill/routeRuntime/options.d.mts +14 -10
- package/dist/runtime/polyfill/routeRuntime/options.mjs.map +1 -1
- package/dist/runtime/polyfill/routeRuntime.d.mts +17 -13
- package/dist/runtime/polyfill/routeRuntime.mjs +13 -1
- package/dist/runtime/polyfill/routeRuntime.mjs.map +1 -1
- package/dist/runtime/polyfill/runtimeDataApi.d.mts +28 -29
- package/dist/runtime/polyfill/types/base.d.mts +2 -3
- package/dist/runtime/polyfill/types/common.d.mts +26 -27
- package/dist/runtime/polyfill/types/locationRuntime.d.mts +34 -35
- package/dist/runtime/polyfill/types/mediaAuth.d.mts +34 -35
- package/dist/runtime/polyfill/types/platformRuntime.d.mts +25 -26
- package/dist/runtime/polyfill/types/systemAuth.d.mts +22 -23
- package/dist/runtime/polyfill/types/tabBarRuntime.d.mts +5 -6
- package/dist/runtime/polyfill/uiMediaApi.d.mts +42 -43
- package/dist/runtime/polyfill.d.mts +3 -2
- package/dist/runtime/renderContext.d.mts +2 -3
- package/dist/runtime/renderContext.mjs +2 -1
- package/dist/runtime/renderContext.mjs.map +1 -1
- package/dist/runtime/rpx.d.mts +2 -3
- package/dist/runtime/seo/index.d.mts +11 -11
- package/dist/runtime/style.d.mts +2 -3
- package/dist/runtime/template.d.mts +3 -3
- package/dist/runtime/viewport/index.d.mts +4 -4
- package/dist/runtime/viewport/types.d.mts +2 -3
- package/dist/runtime/warning.d.mts +3 -4
- package/dist/runtime/wevu.d.mts +7 -4
- package/dist/runtime/wevu.mjs +13 -2
- package/dist/runtime/wevu.mjs.map +1 -1
- package/dist/shared/tabBar.d.mts +2 -3
- package/package.json +20 -12
|
@@ -4,16 +4,16 @@ import { AuthorizeOptions, GetSettingOptions, OpenSettingOptions } from "./types
|
|
|
4
4
|
import { BatteryInfo, GetBatteryInfoSuccessResult, VibrateShortOptions } from "./types/platformRuntime.mjs";
|
|
5
5
|
import { AccountInfoSync, AppAuthorizeSetting, AppBaseInfo, CheckSessionOptions, DeviceInfo, GetSystemInfoOptions, GetUserInfoOptions, GetUserProfileOptions, LoginOptions, MenuButtonBoundingClientRect, OpenAppAuthorizeSettingOptions, SystemInfo, SystemSetting, WindowInfo } from "./types/systemAuth.mjs";
|
|
6
6
|
//#region src/runtime/polyfill/deviceAuthSystemApi.d.ts
|
|
7
|
-
declare function vibrateShort(options?: VibrateShortOptions): Promise<{
|
|
7
|
+
export declare function vibrateShort(options?: VibrateShortOptions): Promise<{
|
|
8
8
|
errMsg: string;
|
|
9
9
|
}>;
|
|
10
|
-
declare function getBatteryInfoSync(): BatteryInfo;
|
|
11
|
-
declare function getBatteryInfo(options?: MiniProgramAsyncOptions<GetBatteryInfoSuccessResult>): Promise<{
|
|
10
|
+
export declare function getBatteryInfoSync(): BatteryInfo;
|
|
11
|
+
export declare function getBatteryInfo(options?: MiniProgramAsyncOptions<GetBatteryInfoSuccessResult>): Promise<{
|
|
12
12
|
level: number;
|
|
13
13
|
isCharging: boolean;
|
|
14
14
|
errMsg: string;
|
|
15
15
|
}>;
|
|
16
|
-
declare function getLocation(options?: GetLocationOptions): Promise<{
|
|
16
|
+
export declare function getLocation(options?: GetLocationOptions): Promise<{
|
|
17
17
|
latitude: number;
|
|
18
18
|
longitude: number;
|
|
19
19
|
speed: number;
|
|
@@ -23,45 +23,45 @@ declare function getLocation(options?: GetLocationOptions): Promise<{
|
|
|
23
23
|
horizontalAccuracy: number;
|
|
24
24
|
errMsg: string;
|
|
25
25
|
}>;
|
|
26
|
-
declare function getFuzzyLocation(options?: GetFuzzyLocationOptions): Promise<{
|
|
26
|
+
export declare function getFuzzyLocation(options?: GetFuzzyLocationOptions): Promise<{
|
|
27
27
|
latitude: number;
|
|
28
28
|
longitude: number;
|
|
29
29
|
accuracy: number;
|
|
30
30
|
errMsg: string;
|
|
31
31
|
}>;
|
|
32
|
-
declare function getSetting(options?: GetSettingOptions): Promise<{
|
|
32
|
+
export declare function getSetting(options?: GetSettingOptions): Promise<{
|
|
33
33
|
errMsg: string;
|
|
34
34
|
authSetting: Record<string, boolean>;
|
|
35
35
|
}>;
|
|
36
|
-
declare function authorize(options?: AuthorizeOptions): Promise<{
|
|
36
|
+
export declare function authorize(options?: AuthorizeOptions): Promise<{
|
|
37
37
|
errMsg: string;
|
|
38
38
|
}>;
|
|
39
|
-
declare function openSetting(options?: OpenSettingOptions): Promise<{
|
|
39
|
+
export declare function openSetting(options?: OpenSettingOptions): Promise<{
|
|
40
40
|
errMsg: string;
|
|
41
41
|
authSetting: Record<string, boolean>;
|
|
42
42
|
}>;
|
|
43
|
-
declare function getAppAuthorizeSetting(): AppAuthorizeSetting;
|
|
44
|
-
declare function openAppAuthorizeSetting(options?: OpenAppAuthorizeSettingOptions): Promise<{
|
|
43
|
+
export declare function getAppAuthorizeSetting(): AppAuthorizeSetting;
|
|
44
|
+
export declare function openAppAuthorizeSetting(options?: OpenAppAuthorizeSettingOptions): Promise<{
|
|
45
45
|
errMsg: string;
|
|
46
46
|
}>;
|
|
47
|
-
declare function getNetworkType(options?: GetNetworkTypeOptions): Promise<any>;
|
|
48
|
-
declare function onNetworkStatusChange(callback: NetworkStatusChangeCallback): void;
|
|
49
|
-
declare function offNetworkStatusChange(callback?: NetworkStatusChangeCallback): void;
|
|
50
|
-
declare function getWindowInfo(): WindowInfo;
|
|
51
|
-
declare function onWindowResize(callback: WindowResizeCallback): void;
|
|
52
|
-
declare function offWindowResize(callback?: WindowResizeCallback): void;
|
|
53
|
-
declare function getSystemInfoSync(): SystemInfo;
|
|
54
|
-
declare function getSystemInfo(options?: GetSystemInfoOptions): Promise<any>;
|
|
55
|
-
declare function getDeviceInfo(): DeviceInfo;
|
|
56
|
-
declare function getSystemSetting(): SystemSetting;
|
|
57
|
-
declare function login(options?: LoginOptions): Promise<{
|
|
47
|
+
export declare function getNetworkType(options?: GetNetworkTypeOptions): Promise<any>;
|
|
48
|
+
export declare function onNetworkStatusChange(callback: NetworkStatusChangeCallback): void;
|
|
49
|
+
export declare function offNetworkStatusChange(callback?: NetworkStatusChangeCallback): void;
|
|
50
|
+
export declare function getWindowInfo(): WindowInfo;
|
|
51
|
+
export declare function onWindowResize(callback: WindowResizeCallback): void;
|
|
52
|
+
export declare function offWindowResize(callback?: WindowResizeCallback): void;
|
|
53
|
+
export declare function getSystemInfoSync(): SystemInfo;
|
|
54
|
+
export declare function getSystemInfo(options?: GetSystemInfoOptions): Promise<any>;
|
|
55
|
+
export declare function getDeviceInfo(): DeviceInfo;
|
|
56
|
+
export declare function getSystemSetting(): SystemSetting;
|
|
57
|
+
export declare function login(options?: LoginOptions): Promise<{
|
|
58
58
|
errMsg: string;
|
|
59
59
|
code: string;
|
|
60
60
|
}>;
|
|
61
|
-
declare function checkSession(options?: CheckSessionOptions): Promise<{
|
|
61
|
+
export declare function checkSession(options?: CheckSessionOptions): Promise<{
|
|
62
62
|
errMsg: string;
|
|
63
63
|
}>;
|
|
64
|
-
declare function getUserInfo(options?: GetUserInfoOptions): Promise<{
|
|
64
|
+
export declare function getUserInfo(options?: GetUserInfoOptions): Promise<{
|
|
65
65
|
errMsg: "getUserInfo:ok" | "getUserProfile:ok";
|
|
66
66
|
userInfo: {
|
|
67
67
|
nickName: string;
|
|
@@ -77,7 +77,7 @@ declare function getUserInfo(options?: GetUserInfoOptions): Promise<{
|
|
|
77
77
|
encryptedData: string;
|
|
78
78
|
iv: string;
|
|
79
79
|
}>;
|
|
80
|
-
declare function getUserProfile(options?: GetUserProfileOptions): Promise<{
|
|
80
|
+
export declare function getUserProfile(options?: GetUserProfileOptions): Promise<{
|
|
81
81
|
errMsg: "getUserInfo:ok" | "getUserProfile:ok";
|
|
82
82
|
userInfo: {
|
|
83
83
|
nickName: string;
|
|
@@ -93,9 +93,8 @@ declare function getUserProfile(options?: GetUserProfileOptions): Promise<{
|
|
|
93
93
|
encryptedData: string;
|
|
94
94
|
iv: string;
|
|
95
95
|
}>;
|
|
96
|
-
declare function getAccountInfoSync(): AccountInfoSync;
|
|
97
|
-
declare function getAppBaseInfo(): AppBaseInfo;
|
|
98
|
-
declare function getMenuButtonBoundingClientRect(): MenuButtonBoundingClientRect;
|
|
96
|
+
export declare function getAccountInfoSync(): AccountInfoSync;
|
|
97
|
+
export declare function getAppBaseInfo(): AppBaseInfo;
|
|
98
|
+
export declare function getMenuButtonBoundingClientRect(): MenuButtonBoundingClientRect;
|
|
99
99
|
//#endregion
|
|
100
|
-
export { 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 };
|
|
101
100
|
//# sourceMappingURL=deviceAuthSystemApi.d.mts.map
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { LogManager, LogManagerOptions, SetBackgroundColorOptions, SetBackgroundTextStyleOptions, UpdateManager } from "./types/locationRuntime.mjs";
|
|
2
2
|
import { AdBaseOptions, GetExtConfigOptions, InterstitialAd, RewardedVideoAd } from "./types/platformRuntime.mjs";
|
|
3
|
+
import { AppHideCallback, AppHideOptions, AppLaunchOptions, AppShowCallback } from "./routeRuntime/options.mjs";
|
|
3
4
|
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 "./deviceAuthSystemApi.mjs";
|
|
4
|
-
import { getEnterOptionsSync, getLaunchOptionsSync, initializePageRoutes, navigateBack, navigateTo, reLaunch, redirectTo, registerApp, registerComponent, registerPage, switchTab } from "./routeRuntime.mjs";
|
|
5
|
+
import { getEnterOptionsSync, getLaunchOptionsSync, initializePageRoutes, navigateBack, navigateTo, offAppHide, offAppShow, onAppHide, onAppShow, reLaunch, redirectTo, registerApp, registerComponent, registerPage, switchTab } from "./routeRuntime.mjs";
|
|
5
6
|
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 "./runtimeDataApi.mjs";
|
|
6
7
|
import { chooseAddress, chooseFile, chooseImage, chooseLocation, chooseMedia, chooseMessageFile, chooseVideo, compressImage, compressVideo, getClipboardData, getImageInfo, getVideoInfo, hideLoading, hideTabBar, hideTabBarRedDot, makePhoneCall, openCustomerServiceChat, openDocument, openLocation, openVideoEditor, previewImage, previewMedia, removeTabBarBadge, requestPayment, requestSubscribeMessage, saveFile, saveFileToDisk, saveImageToPhotosAlbum, saveVideoToPhotosAlbum, scanCode, setClipboardData, setTabBarBadge, setTabBarItem, setTabBarStyle, showActionSheet, showLoading, showModal, showShareMenu, showTabBar, showTabBarRedDot, showToast, updateShareMenu } from "./uiMediaApi.mjs";
|
|
7
8
|
//#region src/runtime/polyfill/index.d.ts
|
|
8
|
-
declare function setNavigationBarTitle(options: {
|
|
9
|
+
export declare function setNavigationBarTitle(options: {
|
|
9
10
|
title: string;
|
|
10
11
|
}): Promise<void>;
|
|
11
|
-
declare function setNavigationBarColor(options: {
|
|
12
|
+
export declare function setNavigationBarColor(options: {
|
|
12
13
|
frontColor?: string;
|
|
13
14
|
backgroundColor?: string;
|
|
14
15
|
animation?: {
|
|
@@ -16,24 +17,24 @@ declare function setNavigationBarColor(options: {
|
|
|
16
17
|
timingFunction?: string;
|
|
17
18
|
};
|
|
18
19
|
}): Promise<void>;
|
|
19
|
-
declare function showNavigationBarLoading(): Promise<void>;
|
|
20
|
-
declare function hideNavigationBarLoading(): Promise<void>;
|
|
21
|
-
declare function setBackgroundColor(options?: SetBackgroundColorOptions): Promise<{
|
|
20
|
+
export declare function showNavigationBarLoading(): Promise<void>;
|
|
21
|
+
export declare function hideNavigationBarLoading(): Promise<void>;
|
|
22
|
+
export declare function setBackgroundColor(options?: SetBackgroundColorOptions): Promise<{
|
|
22
23
|
errMsg: string;
|
|
23
24
|
}>;
|
|
24
|
-
declare function setBackgroundTextStyle(options?: SetBackgroundTextStyleOptions): Promise<{
|
|
25
|
+
export declare function setBackgroundTextStyle(options?: SetBackgroundTextStyleOptions): Promise<{
|
|
25
26
|
errMsg: string;
|
|
26
27
|
}>;
|
|
27
|
-
declare function canIUse(schema: string): boolean;
|
|
28
|
-
declare function createRewardedVideoAd(options?: AdBaseOptions): RewardedVideoAd;
|
|
29
|
-
declare function createInterstitialAd(options?: AdBaseOptions): InterstitialAd;
|
|
30
|
-
declare function getExtConfigSync(): {
|
|
28
|
+
export declare function canIUse(schema: string): boolean;
|
|
29
|
+
export declare function createRewardedVideoAd(options?: AdBaseOptions): RewardedVideoAd;
|
|
30
|
+
export declare function createInterstitialAd(options?: AdBaseOptions): InterstitialAd;
|
|
31
|
+
export declare function getExtConfigSync(): {
|
|
31
32
|
[x: string]: unknown;
|
|
32
33
|
};
|
|
33
|
-
declare function getExtConfig(options?: GetExtConfigOptions): Promise<any>;
|
|
34
|
-
declare function getUpdateManager(): UpdateManager;
|
|
35
|
-
declare function getLogManager(options?: LogManagerOptions): LogManager;
|
|
36
|
-
declare function reportAnalytics(eventName: string, data?: Record<string, unknown>): void;
|
|
34
|
+
export declare function getExtConfig(options?: GetExtConfigOptions): Promise<any>;
|
|
35
|
+
export declare function getUpdateManager(): UpdateManager;
|
|
36
|
+
export declare function getLogManager(options?: LogManagerOptions): LogManager;
|
|
37
|
+
export declare function reportAnalytics(eventName: string, data?: Record<string, unknown>): void;
|
|
37
38
|
//#endregion
|
|
38
|
-
export {
|
|
39
|
+
export { type AppHideCallback, type AppHideOptions, type AppLaunchOptions, type AppShowCallback, authorize, checkSession, chooseAddress, chooseFile, chooseImage, chooseLocation, chooseMedia, chooseMessageFile, chooseVideo, clearStorage, clearStorageSync, compressImage, compressVideo, createCanvasContext, createSelectorQuery, createVKSession, createVideoContext, createWorker, downloadFile, exitMiniProgram, getAccountInfoSync, getAppAuthorizeSetting, getAppBaseInfo, getBatteryInfo, getBatteryInfoSync, getClipboardData, getDeviceInfo, getEnterOptionsSync, getFileSystemManager, getFuzzyLocation, getImageInfo, getLaunchOptionsSync, getLocation, getMenuButtonBoundingClientRect, getNetworkType, getSetting, getStorage, getStorageInfo, getStorageInfoSync, getStorageSync, getSystemInfo, getSystemInfoSync, getSystemSetting, getUserInfo, getUserProfile, getVideoInfo, getWindowInfo, hideKeyboard, hideLoading, hideTabBar, hideTabBarRedDot, initializePageRoutes, loadSubPackage, login, makePhoneCall, navigateBack, navigateTo, navigateToMiniProgram, nextTick, offAppHide, offAppShow, offNetworkStatusChange, offWindowResize, onAppHide, onAppShow, onNetworkStatusChange, onWindowResize, openAppAuthorizeSetting, openCustomerServiceChat, openDocument, openLocation, openSetting, openVideoEditor, pageScrollTo, preloadSubpackage, previewImage, previewMedia, reLaunch, redirectTo, registerApp, registerComponent, registerPage, removeStorage, removeStorageSync, removeTabBarBadge, request, requestPayment, requestSubscribeMessage, saveFile, saveFileToDisk, saveImageToPhotosAlbum, saveVideoToPhotosAlbum, scanCode, setClipboardData, setStorage, setStorageSync, setTabBarBadge, setTabBarItem, setTabBarStyle, showActionSheet, showLoading, showModal, showShareMenu, showTabBar, showTabBarRedDot, showToast, startPullDownRefresh, stopPullDownRefresh, switchTab, updateShareMenu, uploadFile, vibrateShort };
|
|
39
40
|
//# sourceMappingURL=index.d.mts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { emitRuntimeWarning } from "../warning.mjs";
|
|
2
2
|
import { callMiniProgramAsyncFailure, callMiniProgramAsyncSuccess } from "./async.mjs";
|
|
3
|
-
import { getAppInstance, getCurrentPagesInternal, getEnterOptionsSync, getLaunchOptionsSync, initializePageRoutes, navigateBack, navigateTo, reLaunch, redirectTo, registerApp, registerComponent, registerPage, switchTab } from "./routeRuntime.mjs";
|
|
3
|
+
import { getAppInstance, getCurrentPagesInternal, getEnterOptionsSync, getLaunchOptionsSync, initializePageRoutes, navigateBack, navigateTo, offAppHide, offAppShow, onAppHide, onAppShow, reLaunch, redirectTo, registerApp, registerComponent, registerPage, switchTab } from "./routeRuntime.mjs";
|
|
4
4
|
import { WEB_USER_DATA_PATH } from "./files.mjs";
|
|
5
5
|
import { clearStorage, clearStorageSync, createCanvasContext, createIntersectionObserver, createSelectorQuery, createVKSession, createVideoContext, createWorker, downloadFile, exitMiniProgram, getFileSystemManager, getStorage, getStorageInfo, getStorageInfoSync, getStorageSync, hideKeyboard, loadSubPackage, navigateToMiniProgram, nextTick, pageScrollTo, preloadSubpackage, removeStorage, removeStorageSync, request, runtimeDataApi_exports, setStorage, setStorageSync, startPullDownRefresh, stopPullDownRefresh, uploadFile } from "./runtimeDataApi.mjs";
|
|
6
6
|
import { createAnimation } from "./animation.mjs";
|
|
@@ -79,6 +79,10 @@ Object.assign(miniProgramBridge, {
|
|
|
79
79
|
reLaunch,
|
|
80
80
|
getLaunchOptionsSync,
|
|
81
81
|
getEnterOptionsSync,
|
|
82
|
+
offAppHide,
|
|
83
|
+
offAppShow,
|
|
84
|
+
onAppHide,
|
|
85
|
+
onAppShow,
|
|
82
86
|
...runtimeDataApi_exports,
|
|
83
87
|
setNavigationBarTitle,
|
|
84
88
|
setNavigationBarColor,
|
|
@@ -110,5 +114,5 @@ if (typeof globalTarget.getApp !== "function") globalTarget.getApp = getAppInsta
|
|
|
110
114
|
if (typeof globalTarget.getCurrentPages !== "function") globalTarget.getCurrentPages = getCurrentPagesInternal;
|
|
111
115
|
|
|
112
116
|
//#endregion
|
|
113
|
-
export { $emit, $off, $on, $once, authorize, canIUse, checkSession, chooseAddress, chooseFile, chooseImage, chooseLocation, chooseMedia, chooseMessageFile, chooseVideo, clearStorage, clearStorageSync, compressImage, compressVideo, createCanvasContext, createIntersectionObserver, createInterstitialAd, createRewardedVideoAd, createSelectorQuery, createVKSession, createVideoContext, createWorker, downloadFile, exitMiniProgram, getAccountInfoSync, getAppAuthorizeSetting, getAppBaseInfo, getBatteryInfo, getBatteryInfoSync, getClipboardData, getDeviceInfo, getEnterOptionsSync, getExtConfig, getExtConfigSync, getFileSystemManager, getFuzzyLocation, getImageInfo, getLaunchOptionsSync, getLocation, getLogManager, getMenuButtonBoundingClientRect, getNetworkType, getSetting, getStorage, getStorageInfo, getStorageInfoSync, getStorageSync, getSystemInfo, getSystemInfoSync, getSystemSetting, getUpdateManager, getUserInfo, getUserProfile, getVideoInfo, getWindowInfo, hideKeyboard, hideLoading, hideNavigationBarLoading, hideTabBar, hideTabBarRedDot, initializePageRoutes, loadSubPackage, login, makePhoneCall, navigateBack, navigateTo, navigateToMiniProgram, nextTick, offNetworkStatusChange, offWindowResize, onNetworkStatusChange, onWindowResize, openAppAuthorizeSetting, openCustomerServiceChat, openDocument, openLocation, openSetting, openVideoEditor, pageScrollTo, preloadSubpackage, previewImage, previewMedia, reLaunch, redirectTo, registerApp, registerComponent, registerPage, removeStorage, removeStorageSync, removeTabBarBadge, reportAnalytics, request, requestPayment, requestSubscribeMessage, rpx2px, saveFile, saveFileToDisk, saveImageToPhotosAlbum, saveVideoToPhotosAlbum, scanCode, setBackgroundColor, setBackgroundTextStyle, setClipboardData, setNavigationBarColor, setNavigationBarTitle, setStorage, setStorageSync, setTabBarBadge, setTabBarItem, setTabBarStyle, showActionSheet, showLoading, showModal, showNavigationBarLoading, showShareMenu, showTabBar, showTabBarRedDot, showToast, startPullDownRefresh, stopPullDownRefresh, switchTab, updateShareMenu, uploadFile, upx2px, vibrateShort };
|
|
117
|
+
export { $emit, $off, $on, $once, authorize, canIUse, checkSession, chooseAddress, chooseFile, chooseImage, chooseLocation, chooseMedia, chooseMessageFile, chooseVideo, clearStorage, clearStorageSync, compressImage, compressVideo, createCanvasContext, createIntersectionObserver, createInterstitialAd, createRewardedVideoAd, createSelectorQuery, createVKSession, createVideoContext, createWorker, downloadFile, exitMiniProgram, getAccountInfoSync, getAppAuthorizeSetting, getAppBaseInfo, getBatteryInfo, getBatteryInfoSync, getClipboardData, getDeviceInfo, getEnterOptionsSync, getExtConfig, getExtConfigSync, getFileSystemManager, getFuzzyLocation, getImageInfo, getLaunchOptionsSync, getLocation, getLogManager, getMenuButtonBoundingClientRect, getNetworkType, getSetting, getStorage, getStorageInfo, getStorageInfoSync, getStorageSync, getSystemInfo, getSystemInfoSync, getSystemSetting, getUpdateManager, getUserInfo, getUserProfile, getVideoInfo, getWindowInfo, hideKeyboard, hideLoading, hideNavigationBarLoading, hideTabBar, hideTabBarRedDot, initializePageRoutes, loadSubPackage, login, makePhoneCall, navigateBack, navigateTo, navigateToMiniProgram, nextTick, offAppHide, offAppShow, offNetworkStatusChange, offWindowResize, onAppHide, onAppShow, onNetworkStatusChange, onWindowResize, openAppAuthorizeSetting, openCustomerServiceChat, openDocument, openLocation, openSetting, openVideoEditor, pageScrollTo, preloadSubpackage, previewImage, previewMedia, reLaunch, redirectTo, registerApp, registerComponent, registerPage, removeStorage, removeStorageSync, removeTabBarBadge, reportAnalytics, request, requestPayment, requestSubscribeMessage, rpx2px, saveFile, saveFileToDisk, saveImageToPhotosAlbum, saveVideoToPhotosAlbum, scanCode, setBackgroundColor, setBackgroundTextStyle, setClipboardData, setNavigationBarColor, setNavigationBarTitle, setStorage, setStorageSync, setTabBarBadge, setTabBarItem, setTabBarStyle, showActionSheet, showLoading, showModal, showNavigationBarLoading, showShareMenu, showTabBar, showTabBarRedDot, showToast, startPullDownRefresh, stopPullDownRefresh, switchTab, updateShareMenu, uploadFile, upx2px, vibrateShort };
|
|
114
118
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["runtimeDataApi","uiMediaApi","deviceAuthSystemApi","eventBusApi"],"sources":["../../../src/runtime/polyfill/index.ts"],"sourcesContent":["import type {\n AdBaseOptions,\n CloudBridge,\n GetExtConfigOptions,\n InterstitialAd,\n LogManager,\n LogManagerOptions,\n MiniProgramAsyncOptions,\n MiniProgramBaseResult,\n RewardedVideoAd,\n SetBackgroundColorOptions,\n SetBackgroundTextStyleOptions,\n UpdateManager,\n} from './types'\nimport { getDefaultMiniProgramRuntimeGlobalKey, getMiniProgramRuntimeGlobalKeys } from '@weapp-core/shared'\nimport { emitRuntimeWarning } from '../warning'\nimport { createAnimation } from './animation'\nimport {\n callMiniProgramAsyncFailure,\n callMiniProgramAsyncSuccess,\n} from './async'\nimport {\n setBackgroundColorBridge,\n setBackgroundTextStyleBridge,\n} from './background'\nimport { createCloudBridge } from './cloud'\nimport * as deviceAuthSystemApi from './deviceAuthSystemApi'\nimport * as eventBusApi from './eventBus'\nimport { WEB_USER_DATA_PATH } from './files'\nimport { loadFontFace } from './font'\nimport { getLocale } from './locale'\nimport { createNavigationBarRuntimeBridge } from './navigationBarRuntime'\nimport {\n createInterstitialAdBridge,\n createRewardedVideoAdBridge,\n getExtConfigBridge,\n getExtConfigSyncBridge,\n getLogManagerBridge,\n getUpdateManagerBridge,\n reportAnalyticsBridge,\n} from './platformApi'\nimport {\n getAppInstance,\n getCurrentPagesInternal,\n getEnterOptionsSync,\n getLaunchOptionsSync,\n navigateBack,\n navigateTo,\n redirectTo,\n reLaunch,\n switchTab,\n} from './routeRuntime'\nimport {\n canIUseBridge,\n} from './runtimeCapabilityApi'\nimport * as runtimeDataApi from './runtimeDataApi'\nimport * as uiMediaApi from './uiMediaApi'\n\nexport { createAnimation } from './animation'\nexport * from './deviceAuthSystemApi'\nexport * from './eventBus'\nexport { loadFontFace } from './font'\nexport { getLocale } from './locale'\n\nexport {\n getEnterOptionsSync,\n getLaunchOptionsSync,\n initializePageRoutes,\n navigateBack,\n navigateTo,\n redirectTo,\n registerApp,\n registerComponent,\n registerPage,\n reLaunch,\n switchTab,\n} from './routeRuntime'\n\nexport * from './runtimeDataApi'\nexport * from './uiMediaApi'\n\nconst MINI_PROGRAM_GLOBAL_KEYS = getMiniProgramRuntimeGlobalKeys()\nconst DEFAULT_MINI_PROGRAM_GLOBAL_KEY = getDefaultMiniProgramRuntimeGlobalKey()\nconst globalTarget = globalThis as Record<string, unknown>\n\nfunction resolveMiniProgramBridge() {\n for (const runtimeGlobalKey of MINI_PROGRAM_GLOBAL_KEYS) {\n const candidate = globalTarget[runtimeGlobalKey]\n if (candidate && typeof candidate === 'object') {\n return candidate as Record<string, unknown>\n }\n }\n return undefined\n}\n\nconst navigationBarRuntimeBridge = createNavigationBarRuntimeBridge(\n () => getCurrentPagesInternal() as Array<HTMLElement & { renderRoot?: ShadowRoot | HTMLElement }>,\n emitRuntimeWarning,\n)\n\nexport function setNavigationBarTitle(options: { title: string }) {\n return navigationBarRuntimeBridge.setNavigationBarTitle(options)\n}\n\nexport function setNavigationBarColor(options: {\n frontColor?: string\n backgroundColor?: string\n animation?: { duration?: number, timingFunction?: string }\n}) {\n return navigationBarRuntimeBridge.setNavigationBarColor(options)\n}\n\nexport function showNavigationBarLoading() {\n return navigationBarRuntimeBridge.showNavigationBarLoading()\n}\n\nexport function hideNavigationBarLoading() {\n return navigationBarRuntimeBridge.hideNavigationBarLoading()\n}\n\nexport function setBackgroundColor(options?: SetBackgroundColorOptions) {\n return setBackgroundColorBridge(options)\n}\n\nexport function setBackgroundTextStyle(options?: SetBackgroundTextStyleOptions) {\n return setBackgroundTextStyleBridge(options)\n}\n\nexport function canIUse(schema: string) {\n return canIUseBridge(resolveMiniProgramBridge(), schema)\n}\n\nconst cloudBridge: CloudBridge = createCloudBridge(\n (options, result) => callMiniProgramAsyncSuccess(\n options as unknown as MiniProgramAsyncOptions<MiniProgramBaseResult> | undefined,\n result as MiniProgramBaseResult,\n ),\n (options, errMsg) => callMiniProgramAsyncFailure(\n options as unknown as MiniProgramAsyncOptions<MiniProgramBaseResult> | undefined,\n errMsg,\n ),\n) as CloudBridge\n\nexport function createRewardedVideoAd(options?: AdBaseOptions): RewardedVideoAd {\n return createRewardedVideoAdBridge(options)\n}\n\nexport function createInterstitialAd(options?: AdBaseOptions): InterstitialAd {\n return createInterstitialAdBridge(options)\n}\n\nexport function getExtConfigSync() {\n return getExtConfigSyncBridge()\n}\n\nexport function getExtConfig(options?: GetExtConfigOptions) {\n return getExtConfigBridge(options)\n}\n\nexport function getUpdateManager(): UpdateManager {\n return getUpdateManagerBridge()\n}\n\nexport function getLogManager(options?: LogManagerOptions): LogManager {\n return getLogManagerBridge(options)\n}\n\nexport function reportAnalytics(eventName: string, data?: Record<string, unknown>) {\n reportAnalyticsBridge(eventName, data)\n}\n\nconst miniProgramBridge = (globalTarget[DEFAULT_MINI_PROGRAM_GLOBAL_KEY] as Record<string, unknown> | undefined) ?? {}\nObject.assign(miniProgramBridge, {\n navigateTo,\n navigateBack,\n redirectTo,\n switchTab,\n reLaunch,\n getLaunchOptionsSync,\n getEnterOptionsSync,\n ...runtimeDataApi,\n setNavigationBarTitle,\n setNavigationBarColor,\n setBackgroundColor,\n setBackgroundTextStyle,\n showNavigationBarLoading,\n hideNavigationBarLoading,\n ...uiMediaApi,\n ...deviceAuthSystemApi,\n ...eventBusApi,\n loadFontFace,\n getLocale,\n createAnimation,\n createRewardedVideoAd,\n createInterstitialAd,\n getExtConfigSync,\n getExtConfig,\n getUpdateManager,\n getLogManager,\n reportAnalytics,\n canIUse,\n cloud: cloudBridge,\n})\nconst miniProgramEnv = (miniProgramBridge.env as Record<string, unknown> | undefined) ?? {}\nif (typeof miniProgramEnv.USER_DATA_PATH !== 'string' || !miniProgramEnv.USER_DATA_PATH.trim()) {\n miniProgramEnv.USER_DATA_PATH = WEB_USER_DATA_PATH\n}\nminiProgramBridge.env = miniProgramEnv\nfor (const runtimeGlobalKey of MINI_PROGRAM_GLOBAL_KEYS) {\n globalTarget[runtimeGlobalKey] = miniProgramBridge\n}\nif (typeof globalTarget.getApp !== 'function') {\n globalTarget.getApp = getAppInstance\n}\nif (typeof globalTarget.getCurrentPages !== 'function') {\n globalTarget.getCurrentPages = getCurrentPagesInternal\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["runtimeDataApi","uiMediaApi","deviceAuthSystemApi","eventBusApi"],"sources":["../../../src/runtime/polyfill/index.ts"],"sourcesContent":["import type {\n AdBaseOptions,\n CloudBridge,\n GetExtConfigOptions,\n InterstitialAd,\n LogManager,\n LogManagerOptions,\n MiniProgramAsyncOptions,\n MiniProgramBaseResult,\n RewardedVideoAd,\n SetBackgroundColorOptions,\n SetBackgroundTextStyleOptions,\n UpdateManager,\n} from './types'\nimport { getDefaultMiniProgramRuntimeGlobalKey, getMiniProgramRuntimeGlobalKeys } from '@weapp-core/shared'\nimport { emitRuntimeWarning } from '../warning'\nimport { createAnimation } from './animation'\nimport {\n callMiniProgramAsyncFailure,\n callMiniProgramAsyncSuccess,\n} from './async'\nimport {\n setBackgroundColorBridge,\n setBackgroundTextStyleBridge,\n} from './background'\nimport { createCloudBridge } from './cloud'\nimport * as deviceAuthSystemApi from './deviceAuthSystemApi'\nimport * as eventBusApi from './eventBus'\nimport { WEB_USER_DATA_PATH } from './files'\nimport { loadFontFace } from './font'\nimport { getLocale } from './locale'\nimport { createNavigationBarRuntimeBridge } from './navigationBarRuntime'\nimport {\n createInterstitialAdBridge,\n createRewardedVideoAdBridge,\n getExtConfigBridge,\n getExtConfigSyncBridge,\n getLogManagerBridge,\n getUpdateManagerBridge,\n reportAnalyticsBridge,\n} from './platformApi'\nimport {\n getAppInstance,\n getCurrentPagesInternal,\n getEnterOptionsSync,\n getLaunchOptionsSync,\n navigateBack,\n navigateTo,\n offAppHide,\n offAppShow,\n onAppHide,\n onAppShow,\n redirectTo,\n reLaunch,\n switchTab,\n} from './routeRuntime'\nimport {\n canIUseBridge,\n} from './runtimeCapabilityApi'\nimport * as runtimeDataApi from './runtimeDataApi'\nimport * as uiMediaApi from './uiMediaApi'\n\nexport { createAnimation } from './animation'\nexport * from './deviceAuthSystemApi'\nexport * from './eventBus'\nexport { loadFontFace } from './font'\nexport { getLocale } from './locale'\n\nexport {\n getEnterOptionsSync,\n getLaunchOptionsSync,\n initializePageRoutes,\n navigateBack,\n navigateTo,\n offAppHide,\n offAppShow,\n onAppHide,\n onAppShow,\n redirectTo,\n registerApp,\n registerComponent,\n registerPage,\n reLaunch,\n switchTab,\n} from './routeRuntime'\n\nexport type { AppHideCallback, AppHideOptions, AppLaunchOptions, AppShowCallback } from './routeRuntime/options'\n\nexport * from './runtimeDataApi'\nexport * from './uiMediaApi'\n\nconst MINI_PROGRAM_GLOBAL_KEYS = getMiniProgramRuntimeGlobalKeys()\nconst DEFAULT_MINI_PROGRAM_GLOBAL_KEY = getDefaultMiniProgramRuntimeGlobalKey()\nconst globalTarget = globalThis as Record<string, unknown>\n\nfunction resolveMiniProgramBridge() {\n for (const runtimeGlobalKey of MINI_PROGRAM_GLOBAL_KEYS) {\n const candidate = globalTarget[runtimeGlobalKey]\n if (candidate && typeof candidate === 'object') {\n return candidate as Record<string, unknown>\n }\n }\n return undefined\n}\n\nconst navigationBarRuntimeBridge = createNavigationBarRuntimeBridge(\n () => getCurrentPagesInternal() as Array<HTMLElement & { renderRoot?: ShadowRoot | HTMLElement }>,\n emitRuntimeWarning,\n)\n\nexport function setNavigationBarTitle(options: { title: string }) {\n return navigationBarRuntimeBridge.setNavigationBarTitle(options)\n}\n\nexport function setNavigationBarColor(options: {\n frontColor?: string\n backgroundColor?: string\n animation?: { duration?: number, timingFunction?: string }\n}) {\n return navigationBarRuntimeBridge.setNavigationBarColor(options)\n}\n\nexport function showNavigationBarLoading() {\n return navigationBarRuntimeBridge.showNavigationBarLoading()\n}\n\nexport function hideNavigationBarLoading() {\n return navigationBarRuntimeBridge.hideNavigationBarLoading()\n}\n\nexport function setBackgroundColor(options?: SetBackgroundColorOptions) {\n return setBackgroundColorBridge(options)\n}\n\nexport function setBackgroundTextStyle(options?: SetBackgroundTextStyleOptions) {\n return setBackgroundTextStyleBridge(options)\n}\n\nexport function canIUse(schema: string) {\n return canIUseBridge(resolveMiniProgramBridge(), schema)\n}\n\nconst cloudBridge: CloudBridge = createCloudBridge(\n (options, result) => callMiniProgramAsyncSuccess(\n options as unknown as MiniProgramAsyncOptions<MiniProgramBaseResult> | undefined,\n result as MiniProgramBaseResult,\n ),\n (options, errMsg) => callMiniProgramAsyncFailure(\n options as unknown as MiniProgramAsyncOptions<MiniProgramBaseResult> | undefined,\n errMsg,\n ),\n) as CloudBridge\n\nexport function createRewardedVideoAd(options?: AdBaseOptions): RewardedVideoAd {\n return createRewardedVideoAdBridge(options)\n}\n\nexport function createInterstitialAd(options?: AdBaseOptions): InterstitialAd {\n return createInterstitialAdBridge(options)\n}\n\nexport function getExtConfigSync() {\n return getExtConfigSyncBridge()\n}\n\nexport function getExtConfig(options?: GetExtConfigOptions) {\n return getExtConfigBridge(options)\n}\n\nexport function getUpdateManager(): UpdateManager {\n return getUpdateManagerBridge()\n}\n\nexport function getLogManager(options?: LogManagerOptions): LogManager {\n return getLogManagerBridge(options)\n}\n\nexport function reportAnalytics(eventName: string, data?: Record<string, unknown>) {\n reportAnalyticsBridge(eventName, data)\n}\n\nconst miniProgramBridge = (globalTarget[DEFAULT_MINI_PROGRAM_GLOBAL_KEY] as Record<string, unknown> | undefined) ?? {}\nObject.assign(miniProgramBridge, {\n navigateTo,\n navigateBack,\n redirectTo,\n switchTab,\n reLaunch,\n getLaunchOptionsSync,\n getEnterOptionsSync,\n offAppHide,\n offAppShow,\n onAppHide,\n onAppShow,\n ...runtimeDataApi,\n setNavigationBarTitle,\n setNavigationBarColor,\n setBackgroundColor,\n setBackgroundTextStyle,\n showNavigationBarLoading,\n hideNavigationBarLoading,\n ...uiMediaApi,\n ...deviceAuthSystemApi,\n ...eventBusApi,\n loadFontFace,\n getLocale,\n createAnimation,\n createRewardedVideoAd,\n createInterstitialAd,\n getExtConfigSync,\n getExtConfig,\n getUpdateManager,\n getLogManager,\n reportAnalytics,\n canIUse,\n cloud: cloudBridge,\n})\nconst miniProgramEnv = (miniProgramBridge.env as Record<string, unknown> | undefined) ?? {}\nif (typeof miniProgramEnv.USER_DATA_PATH !== 'string' || !miniProgramEnv.USER_DATA_PATH.trim()) {\n miniProgramEnv.USER_DATA_PATH = WEB_USER_DATA_PATH\n}\nminiProgramBridge.env = miniProgramEnv\nfor (const runtimeGlobalKey of MINI_PROGRAM_GLOBAL_KEYS) {\n globalTarget[runtimeGlobalKey] = miniProgramBridge\n}\nif (typeof globalTarget.getApp !== 'function') {\n globalTarget.getApp = getAppInstance\n}\nif (typeof globalTarget.getCurrentPages !== 'function') {\n globalTarget.getCurrentPages = getCurrentPagesInternal\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AA2FA,MAAM,2BAA2B,gCAAgC;AACjE,MAAM,kCAAkC,sCAAsC;AAC9E,MAAM,eAAe;AAErB,SAAS,2BAA2B;CAClC,KAAK,MAAM,oBAAoB,0BAA0B;EACvD,MAAM,YAAY,aAAa;EAC/B,IAAI,aAAa,OAAO,cAAc,UACpC,OAAO;CAEX;AAEF;AAEA,MAAM,6BAA6B,uCAC3B,wBAAwB,GAC9B,kBACF;AAEA,SAAgB,sBAAsB,SAA4B;CAChE,OAAO,2BAA2B,sBAAsB,OAAO;AACjE;AAEA,SAAgB,sBAAsB,SAInC;CACD,OAAO,2BAA2B,sBAAsB,OAAO;AACjE;AAEA,SAAgB,2BAA2B;CACzC,OAAO,2BAA2B,yBAAyB;AAC7D;AAEA,SAAgB,2BAA2B;CACzC,OAAO,2BAA2B,yBAAyB;AAC7D;AAEA,SAAgB,mBAAmB,SAAqC;CACtE,OAAO,yBAAyB,OAAO;AACzC;AAEA,SAAgB,uBAAuB,SAAyC;CAC9E,OAAO,6BAA6B,OAAO;AAC7C;AAEA,SAAgB,QAAQ,QAAgB;CACtC,OAAO,cAAc,yBAAyB,GAAG,MAAM;AACzD;AAEA,MAAM,cAA2B,mBAC9B,SAAS,WAAW,4BACnB,SACA,MACF,IACC,SAAS,WAAW,4BACnB,SACA,MACF,CACF;AAEA,SAAgB,sBAAsB,SAA0C;CAC9E,OAAO,4BAA4B,OAAO;AAC5C;AAEA,SAAgB,qBAAqB,SAAyC;CAC5E,OAAO,2BAA2B,OAAO;AAC3C;AAEA,SAAgB,mBAAmB;CACjC,OAAO,uBAAuB;AAChC;AAEA,SAAgB,aAAa,SAA+B;CAC1D,OAAO,mBAAmB,OAAO;AACnC;AAEA,SAAgB,mBAAkC;CAChD,OAAO,uBAAuB;AAChC;AAEA,SAAgB,cAAc,SAAyC;CACrE,OAAO,oBAAoB,OAAO;AACpC;AAEA,SAAgB,gBAAgB,WAAmB,MAAgC;CACjF,sBAAsB,WAAW,IAAI;AACvC;AAEA,MAAM,oBAAqB,aAAa,oCAA4E,CAAC;AACrH,OAAO,OAAO,mBAAmB;CAC/B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA,GAAGA;CACH;CACA;CACA;CACA;CACA;CACA;CACA,GAAGC;CACH,GAAGC;CACH,GAAGC;CACH;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA,OAAO;AACT,CAAC;AACD,MAAM,iBAAkB,kBAAkB,OAA+C,CAAC;AAC1F,IAAI,OAAO,eAAe,mBAAmB,YAAY,CAAC,eAAe,eAAe,KAAK,GAC3F,eAAe,iBAAiB;AAElC,kBAAkB,MAAM;AACxB,KAAK,MAAM,oBAAoB,0BAC7B,aAAa,oBAAoB;AAEnC,IAAI,OAAO,aAAa,WAAW,YACjC,aAAa,SAAS;AAExB,IAAI,OAAO,aAAa,oBAAoB,YAC1C,aAAa,kBAAkB"}
|
|
@@ -11,15 +11,47 @@ function isDocumentHidden(target) {
|
|
|
11
11
|
var AppLifecycleRuntime = class {
|
|
12
12
|
resolveCurrentEntry;
|
|
13
13
|
#appInstance;
|
|
14
|
+
#hideCallbacks = [];
|
|
14
15
|
#foreground = false;
|
|
15
16
|
#lastEnterOptions;
|
|
16
17
|
#launchOptions;
|
|
17
18
|
#launched = false;
|
|
19
|
+
#showCallbacks = [];
|
|
18
20
|
#visibilityDocument;
|
|
19
21
|
#visibilityHandler;
|
|
20
22
|
constructor(resolveCurrentEntry) {
|
|
21
23
|
this.resolveCurrentEntry = resolveCurrentEntry;
|
|
22
24
|
}
|
|
25
|
+
offAppHide(callback) {
|
|
26
|
+
if (!callback) {
|
|
27
|
+
this.#hideCallbacks.length = 0;
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
let retainedCount = 0;
|
|
31
|
+
for (const registeredCallback of this.#hideCallbacks) if (registeredCallback !== callback) {
|
|
32
|
+
this.#hideCallbacks[retainedCount] = registeredCallback;
|
|
33
|
+
retainedCount += 1;
|
|
34
|
+
}
|
|
35
|
+
this.#hideCallbacks.length = retainedCount;
|
|
36
|
+
}
|
|
37
|
+
offAppShow(callback) {
|
|
38
|
+
if (!callback) {
|
|
39
|
+
this.#showCallbacks.length = 0;
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
let retainedCount = 0;
|
|
43
|
+
for (const registeredCallback of this.#showCallbacks) if (registeredCallback !== callback) {
|
|
44
|
+
this.#showCallbacks[retainedCount] = registeredCallback;
|
|
45
|
+
retainedCount += 1;
|
|
46
|
+
}
|
|
47
|
+
this.#showCallbacks.length = retainedCount;
|
|
48
|
+
}
|
|
49
|
+
onAppHide(callback) {
|
|
50
|
+
this.#hideCallbacks.push(callback);
|
|
51
|
+
}
|
|
52
|
+
onAppShow(callback) {
|
|
53
|
+
this.#showCallbacks.push(callback);
|
|
54
|
+
}
|
|
23
55
|
register(options) {
|
|
24
56
|
const resolved = options ?? {};
|
|
25
57
|
if (this.#appInstance) {
|
|
@@ -42,13 +74,13 @@ var AppLifecycleRuntime = class {
|
|
|
42
74
|
}
|
|
43
75
|
ensureLaunched(entry) {
|
|
44
76
|
if (!this.#appInstance || this.#launched) return;
|
|
45
|
-
const
|
|
46
|
-
this.#launchOptions = cloneLaunchOptions(
|
|
47
|
-
this.#lastEnterOptions = cloneLaunchOptions(
|
|
77
|
+
const payload = resolveEntryOptions(entry);
|
|
78
|
+
this.#launchOptions = cloneLaunchOptions(payload);
|
|
79
|
+
this.#lastEnterOptions = cloneLaunchOptions(payload);
|
|
48
80
|
this.#foreground = true;
|
|
49
81
|
this.#launched = true;
|
|
50
|
-
this.#appInstance.onLaunch?.(
|
|
51
|
-
this.#
|
|
82
|
+
this.#appInstance.onLaunch?.(payload);
|
|
83
|
+
this.#triggerAppShow(payload, true);
|
|
52
84
|
}
|
|
53
85
|
get instance() {
|
|
54
86
|
return this.#appInstance;
|
|
@@ -60,21 +92,35 @@ var AppLifecycleRuntime = class {
|
|
|
60
92
|
return this.#lastEnterOptions ? cloneLaunchOptions(this.#lastEnterOptions) : this.getLaunchOptions();
|
|
61
93
|
}
|
|
62
94
|
dispose() {
|
|
95
|
+
this.#hideCallbacks.length = 0;
|
|
96
|
+
this.#showCallbacks.length = 0;
|
|
63
97
|
this.#unbindVisibility();
|
|
64
98
|
}
|
|
65
99
|
#syncVisibility(target) {
|
|
66
100
|
if (!this.#appInstance || !this.#launched) return;
|
|
67
101
|
if (isDocumentHidden(target)) {
|
|
68
102
|
if (!this.#foreground) return;
|
|
69
|
-
this.#appInstance.onHide?.();
|
|
70
103
|
this.#foreground = false;
|
|
104
|
+
this.#triggerAppHide();
|
|
71
105
|
return;
|
|
72
106
|
}
|
|
73
107
|
if (this.#foreground) return;
|
|
74
108
|
const options = resolveEntryOptions(this.resolveCurrentEntry());
|
|
75
109
|
this.#lastEnterOptions = cloneLaunchOptions(options);
|
|
76
|
-
this.#appInstance.onShow?.(cloneLaunchOptions(options));
|
|
77
110
|
this.#foreground = true;
|
|
111
|
+
this.#triggerAppShow(options, false);
|
|
112
|
+
}
|
|
113
|
+
#triggerAppHide() {
|
|
114
|
+
const options = { reason: 3 };
|
|
115
|
+
const callbacks = [...this.#hideCallbacks];
|
|
116
|
+
for (const callback of callbacks) callback(options);
|
|
117
|
+
this.#appInstance?.onHide?.(options);
|
|
118
|
+
}
|
|
119
|
+
#triggerAppShow(options, isInitialShow) {
|
|
120
|
+
const callbacks = [...this.#showCallbacks];
|
|
121
|
+
if (isInitialShow) this.#appInstance?.onShow?.(options);
|
|
122
|
+
for (const callback of callbacks) callback(options);
|
|
123
|
+
if (!isInitialShow) this.#appInstance?.onShow?.(options);
|
|
78
124
|
}
|
|
79
125
|
#unbindVisibility() {
|
|
80
126
|
if (this.#visibilityDocument && this.#visibilityHandler) this.#visibilityDocument.removeEventListener("visibilitychange", this.#visibilityHandler);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"appLifecycle.mjs","names":[],"sources":["../../../../src/runtime/polyfill/routeRuntime/appLifecycle.ts"],"sourcesContent":["import type { AppLaunchOptions, AppRuntime, PageStackEntry } from './options'\nimport { cloneLaunchOptions, resolveFallbackLaunchOptions } from '../appState'\nimport { isRecord } from './options'\n\ntype VisibilityDocument = Pick<Document, 'addEventListener' | 'hidden' | 'removeEventListener' | 'visibilityState'>\n\nfunction resolveEntryOptions(entry: Pick<PageStackEntry, 'id' | 'query'> | undefined): AppLaunchOptions {\n return resolveFallbackLaunchOptions(entry ? [entry] : [])\n}\n\nfunction isDocumentHidden(target: VisibilityDocument) {\n return target.visibilityState === 'hidden' || target.hidden === true\n}\n\nexport class AppLifecycleRuntime {\n #appInstance: AppRuntime | undefined\n #foreground = false\n #lastEnterOptions: AppLaunchOptions | undefined\n #launchOptions: AppLaunchOptions | undefined\n #launched = false\n #visibilityDocument: VisibilityDocument | undefined\n #visibilityHandler: (() => void) | undefined\n\n constructor(private readonly resolveCurrentEntry: () => PageStackEntry | undefined) {}\n\n register<T extends AppRuntime | undefined>(options: T): T {\n const resolved = (options ?? {}) as AppRuntime\n if (this.#appInstance) {\n const currentGlobal = this.#appInstance.globalData\n Object.assign(this.#appInstance, resolved)\n if (isRecord(currentGlobal)) {\n this.#appInstance.globalData = currentGlobal\n }\n else if (!isRecord(this.#appInstance.globalData)) {\n this.#appInstance.globalData = {}\n }\n return options\n }\n this.#appInstance = resolved\n if (!isRecord(this.#appInstance.globalData)) {\n this.#appInstance.globalData = {}\n }\n return options\n }\n\n bindVisibility(target: VisibilityDocument | undefined = typeof document === 'undefined' ? undefined : document) {\n if (!target || this.#visibilityDocument === target || typeof target.addEventListener !== 'function') {\n return\n }\n this.#unbindVisibility()\n this.#visibilityDocument = target\n this.#visibilityHandler = () => this.#syncVisibility(target)\n target.addEventListener('visibilitychange', this.#visibilityHandler)\n }\n\n ensureLaunched(entry: PageStackEntry) {\n if (!this.#appInstance || this.#launched) {\n return\n }\n const
|
|
1
|
+
{"version":3,"file":"appLifecycle.mjs","names":[],"sources":["../../../../src/runtime/polyfill/routeRuntime/appLifecycle.ts"],"sourcesContent":["import type { AppHideCallback, AppHideOptions, AppLaunchOptions, AppRuntime, AppShowCallback, PageStackEntry } from './options'\nimport { cloneLaunchOptions, resolveFallbackLaunchOptions } from '../appState'\nimport { isRecord } from './options'\n\ntype VisibilityDocument = Pick<Document, 'addEventListener' | 'hidden' | 'removeEventListener' | 'visibilityState'>\n\nfunction resolveEntryOptions(entry: Pick<PageStackEntry, 'id' | 'query'> | undefined): AppLaunchOptions {\n return resolveFallbackLaunchOptions(entry ? [entry] : [])\n}\n\nfunction isDocumentHidden(target: VisibilityDocument) {\n return target.visibilityState === 'hidden' || target.hidden === true\n}\n\nexport class AppLifecycleRuntime {\n #appInstance: AppRuntime | undefined\n readonly #hideCallbacks: AppHideCallback[] = []\n #foreground = false\n #lastEnterOptions: AppLaunchOptions | undefined\n #launchOptions: AppLaunchOptions | undefined\n #launched = false\n readonly #showCallbacks: AppShowCallback[] = []\n #visibilityDocument: VisibilityDocument | undefined\n #visibilityHandler: (() => void) | undefined\n\n constructor(private readonly resolveCurrentEntry: () => PageStackEntry | undefined) {}\n\n offAppHide(callback?: AppHideCallback) {\n if (!callback) {\n this.#hideCallbacks.length = 0\n return\n }\n\n let retainedCount = 0\n for (const registeredCallback of this.#hideCallbacks) {\n if (registeredCallback !== callback) {\n this.#hideCallbacks[retainedCount] = registeredCallback\n retainedCount += 1\n }\n }\n this.#hideCallbacks.length = retainedCount\n }\n\n offAppShow(callback?: AppShowCallback) {\n if (!callback) {\n this.#showCallbacks.length = 0\n return\n }\n\n let retainedCount = 0\n for (const registeredCallback of this.#showCallbacks) {\n if (registeredCallback !== callback) {\n this.#showCallbacks[retainedCount] = registeredCallback\n retainedCount += 1\n }\n }\n this.#showCallbacks.length = retainedCount\n }\n\n onAppHide(callback: AppHideCallback) {\n this.#hideCallbacks.push(callback)\n }\n\n onAppShow(callback: AppShowCallback) {\n this.#showCallbacks.push(callback)\n }\n\n register<T extends AppRuntime | undefined>(options: T): T {\n const resolved = (options ?? {}) as AppRuntime\n if (this.#appInstance) {\n const currentGlobal = this.#appInstance.globalData\n Object.assign(this.#appInstance, resolved)\n if (isRecord(currentGlobal)) {\n this.#appInstance.globalData = currentGlobal\n }\n else if (!isRecord(this.#appInstance.globalData)) {\n this.#appInstance.globalData = {}\n }\n return options\n }\n this.#appInstance = resolved\n if (!isRecord(this.#appInstance.globalData)) {\n this.#appInstance.globalData = {}\n }\n return options\n }\n\n bindVisibility(target: VisibilityDocument | undefined = typeof document === 'undefined' ? undefined : document) {\n if (!target || this.#visibilityDocument === target || typeof target.addEventListener !== 'function') {\n return\n }\n this.#unbindVisibility()\n this.#visibilityDocument = target\n this.#visibilityHandler = () => this.#syncVisibility(target)\n target.addEventListener('visibilitychange', this.#visibilityHandler)\n }\n\n ensureLaunched(entry: PageStackEntry) {\n if (!this.#appInstance || this.#launched) {\n return\n }\n const payload = resolveEntryOptions(entry)\n this.#launchOptions = cloneLaunchOptions(payload)\n this.#lastEnterOptions = cloneLaunchOptions(payload)\n this.#foreground = true\n this.#launched = true\n this.#appInstance.onLaunch?.(payload)\n this.#triggerAppShow(payload, true)\n }\n\n get instance() {\n return this.#appInstance\n }\n\n getLaunchOptions() {\n return this.#launchOptions\n ? cloneLaunchOptions(this.#launchOptions)\n : resolveEntryOptions(this.resolveCurrentEntry())\n }\n\n getEnterOptions() {\n return this.#lastEnterOptions\n ? cloneLaunchOptions(this.#lastEnterOptions)\n : this.getLaunchOptions()\n }\n\n dispose() {\n this.#hideCallbacks.length = 0\n this.#showCallbacks.length = 0\n this.#unbindVisibility()\n }\n\n #syncVisibility(target: VisibilityDocument) {\n if (!this.#appInstance || !this.#launched) {\n return\n }\n if (isDocumentHidden(target)) {\n if (!this.#foreground) {\n return\n }\n this.#foreground = false\n this.#triggerAppHide()\n return\n }\n if (this.#foreground) {\n return\n }\n const options = resolveEntryOptions(this.resolveCurrentEntry())\n this.#lastEnterOptions = cloneLaunchOptions(options)\n this.#foreground = true\n this.#triggerAppShow(options, false)\n }\n\n #triggerAppHide() {\n // 浏览器可见性事件无法区分微信退出方式,统一映射为“其他”。\n const options: AppHideOptions = { reason: 3 }\n const callbacks = [...this.#hideCallbacks]\n for (const callback of callbacks) {\n callback(options)\n }\n this.#appInstance?.onHide?.(options)\n }\n\n #triggerAppShow(options: AppLaunchOptions, isInitialShow: boolean) {\n const callbacks = [...this.#showCallbacks]\n if (isInitialShow) {\n this.#appInstance?.onShow?.(options)\n }\n for (const callback of callbacks) {\n callback(options)\n }\n if (!isInitialShow) {\n this.#appInstance?.onShow?.(options)\n }\n }\n\n #unbindVisibility() {\n if (this.#visibilityDocument && this.#visibilityHandler) {\n this.#visibilityDocument.removeEventListener('visibilitychange', this.#visibilityHandler)\n }\n this.#visibilityDocument = undefined\n this.#visibilityHandler = undefined\n }\n}\n"],"mappings":";;;;AAMA,SAAS,oBAAoB,OAA2E;CACtG,OAAO,6BAA6B,QAAQ,CAAC,KAAK,IAAI,CAAC,CAAC;AAC1D;AAEA,SAAS,iBAAiB,QAA4B;CACpD,OAAO,OAAO,oBAAoB,YAAY,OAAO,WAAW;AAClE;AAEA,IAAa,sBAAb,MAAiC;CAWF;CAV7B;CACA,AAAS,iBAAoC,CAAC;CAC9C,cAAc;CACd;CACA;CACA,YAAY;CACZ,AAAS,iBAAoC,CAAC;CAC9C;CACA;CAEA,YAAY,AAAiB,qBAAuD;EAAvD;CAAwD;CAErF,WAAW,UAA4B;EACrC,IAAI,CAAC,UAAU;GACb,KAAK,eAAe,SAAS;GAC7B;EACF;EAEA,IAAI,gBAAgB;EACpB,KAAK,MAAM,sBAAsB,KAAK,gBACpC,IAAI,uBAAuB,UAAU;GACnC,KAAK,eAAe,iBAAiB;GACrC,iBAAiB;EACnB;EAEF,KAAK,eAAe,SAAS;CAC/B;CAEA,WAAW,UAA4B;EACrC,IAAI,CAAC,UAAU;GACb,KAAK,eAAe,SAAS;GAC7B;EACF;EAEA,IAAI,gBAAgB;EACpB,KAAK,MAAM,sBAAsB,KAAK,gBACpC,IAAI,uBAAuB,UAAU;GACnC,KAAK,eAAe,iBAAiB;GACrC,iBAAiB;EACnB;EAEF,KAAK,eAAe,SAAS;CAC/B;CAEA,UAAU,UAA2B;EACnC,KAAK,eAAe,KAAK,QAAQ;CACnC;CAEA,UAAU,UAA2B;EACnC,KAAK,eAAe,KAAK,QAAQ;CACnC;CAEA,SAA2C,SAAe;EACxD,MAAM,WAAY,WAAW,CAAC;EAC9B,IAAI,KAAK,cAAc;GACrB,MAAM,gBAAgB,KAAK,aAAa;GACxC,OAAO,OAAO,KAAK,cAAc,QAAQ;GACzC,IAAI,SAAS,aAAa,GACxB,KAAK,aAAa,aAAa;QAE5B,IAAI,CAAC,SAAS,KAAK,aAAa,UAAU,GAC7C,KAAK,aAAa,aAAa,CAAC;GAElC,OAAO;EACT;EACA,KAAK,eAAe;EACpB,IAAI,CAAC,SAAS,KAAK,aAAa,UAAU,GACxC,KAAK,aAAa,aAAa,CAAC;EAElC,OAAO;CACT;CAEA,eAAe,SAAyC,OAAO,aAAa,cAAc,SAAY,UAAU;EAC9G,IAAI,CAAC,UAAU,KAAK,wBAAwB,UAAU,OAAO,OAAO,qBAAqB,YACvF;EAEF,KAAK,kBAAkB;EACvB,KAAK,sBAAsB;EAC3B,KAAK,2BAA2B,KAAK,gBAAgB,MAAM;EAC3D,OAAO,iBAAiB,oBAAoB,KAAK,kBAAkB;CACrE;CAEA,eAAe,OAAuB;EACpC,IAAI,CAAC,KAAK,gBAAgB,KAAK,WAC7B;EAEF,MAAM,UAAU,oBAAoB,KAAK;EACzC,KAAK,iBAAiB,mBAAmB,OAAO;EAChD,KAAK,oBAAoB,mBAAmB,OAAO;EACnD,KAAK,cAAc;EACnB,KAAK,YAAY;EACjB,KAAK,aAAa,WAAW,OAAO;EACpC,KAAK,gBAAgB,SAAS,IAAI;CACpC;CAEA,IAAI,WAAW;EACb,OAAO,KAAK;CACd;CAEA,mBAAmB;EACjB,OAAO,KAAK,iBACR,mBAAmB,KAAK,cAAc,IACtC,oBAAoB,KAAK,oBAAoB,CAAC;CACpD;CAEA,kBAAkB;EAChB,OAAO,KAAK,oBACR,mBAAmB,KAAK,iBAAiB,IACzC,KAAK,iBAAiB;CAC5B;CAEA,UAAU;EACR,KAAK,eAAe,SAAS;EAC7B,KAAK,eAAe,SAAS;EAC7B,KAAK,kBAAkB;CACzB;CAEA,gBAAgB,QAA4B;EAC1C,IAAI,CAAC,KAAK,gBAAgB,CAAC,KAAK,WAC9B;EAEF,IAAI,iBAAiB,MAAM,GAAG;GAC5B,IAAI,CAAC,KAAK,aACR;GAEF,KAAK,cAAc;GACnB,KAAK,gBAAgB;GACrB;EACF;EACA,IAAI,KAAK,aACP;EAEF,MAAM,UAAU,oBAAoB,KAAK,oBAAoB,CAAC;EAC9D,KAAK,oBAAoB,mBAAmB,OAAO;EACnD,KAAK,cAAc;EACnB,KAAK,gBAAgB,SAAS,KAAK;CACrC;CAEA,kBAAkB;EAEhB,MAAM,UAA0B,EAAE,QAAQ,EAAE;EAC5C,MAAM,YAAY,CAAC,GAAG,KAAK,cAAc;EACzC,KAAK,MAAM,YAAY,WACrB,SAAS,OAAO;EAElB,KAAK,cAAc,SAAS,OAAO;CACrC;CAEA,gBAAgB,SAA2B,eAAwB;EACjE,MAAM,YAAY,CAAC,GAAG,KAAK,cAAc;EACzC,IAAI,eACF,KAAK,cAAc,SAAS,OAAO;EAErC,KAAK,MAAM,YAAY,WACrB,SAAS,OAAO;EAElB,IAAI,CAAC,eACH,KAAK,cAAc,SAAS,OAAO;CAEvC;CAEA,oBAAoB;EAClB,IAAI,KAAK,uBAAuB,KAAK,oBACnC,KAAK,oBAAoB,oBAAoB,oBAAoB,KAAK,kBAAkB;EAE1F,KAAK,sBAAsB;EAC3B,KAAK,qBAAqB;CAC5B;AACF"}
|
|
@@ -1,30 +1,29 @@
|
|
|
1
1
|
import "./options.mjs";
|
|
2
2
|
//#region src/runtime/polyfill/routeRuntime/history.d.ts
|
|
3
|
-
type WebRoutingMode = 'memory' | 'history' | 'hash';
|
|
4
|
-
interface WebRoutingConfig {
|
|
3
|
+
export type WebRoutingMode = 'memory' | 'history' | 'hash';
|
|
4
|
+
export interface WebRoutingConfig {
|
|
5
5
|
mode?: WebRoutingMode;
|
|
6
6
|
/** 部署目录前缀,例如 /mini-program。 */
|
|
7
7
|
base?: string;
|
|
8
8
|
}
|
|
9
|
-
interface ResolvedWebRoutingConfig {
|
|
9
|
+
export interface ResolvedWebRoutingConfig {
|
|
10
10
|
mode: WebRoutingMode;
|
|
11
11
|
base: string;
|
|
12
12
|
}
|
|
13
|
-
interface WebRouteTarget {
|
|
13
|
+
export interface WebRouteTarget {
|
|
14
14
|
id: string;
|
|
15
15
|
query: Record<string, string>;
|
|
16
16
|
}
|
|
17
|
-
interface WebRouteHistoryState {
|
|
17
|
+
export interface WebRouteHistoryState {
|
|
18
18
|
__weappWebRuntime?: {
|
|
19
19
|
stack: WebRouteTarget[];
|
|
20
20
|
};
|
|
21
21
|
}
|
|
22
|
-
declare function resolveWebRoutingConfig(config?: WebRoutingConfig): ResolvedWebRoutingConfig;
|
|
23
|
-
declare function disposeWebRouting(): void;
|
|
24
|
-
declare function getWebRoutingConfig(): {
|
|
22
|
+
export declare function resolveWebRoutingConfig(config?: WebRoutingConfig): ResolvedWebRoutingConfig;
|
|
23
|
+
export declare function disposeWebRouting(): void;
|
|
24
|
+
export declare function getWebRoutingConfig(): {
|
|
25
25
|
mode: WebRoutingMode;
|
|
26
26
|
base: string;
|
|
27
27
|
};
|
|
28
28
|
//#endregion
|
|
29
|
-
export { ResolvedWebRoutingConfig, WebRouteHistoryState, WebRouteTarget, WebRoutingConfig, WebRoutingMode, disposeWebRouting, getWebRoutingConfig, resolveWebRoutingConfig };
|
|
30
29
|
//# sourceMappingURL=history.d.mts.map
|
|
@@ -4,13 +4,13 @@ import { ComponentOptions, ComponentPublicInstance } from "../../component/types
|
|
|
4
4
|
import "../../component/index.mjs";
|
|
5
5
|
import { MiniProgramAsyncOptions, MiniProgramBaseResult } from "../types/base.mjs";
|
|
6
6
|
//#region src/runtime/polyfill/routeRuntime/options.d.ts
|
|
7
|
-
interface RegisterMeta {
|
|
7
|
+
export interface RegisterMeta {
|
|
8
8
|
id: string;
|
|
9
9
|
template?: TemplateRenderer;
|
|
10
10
|
style?: string;
|
|
11
11
|
navigationBar?: NavigationBarConfig;
|
|
12
12
|
}
|
|
13
|
-
interface PageHooks {
|
|
13
|
+
export interface PageHooks {
|
|
14
14
|
onLoad?: (this: ComponentPublicInstance, query: Record<string, string>) => void;
|
|
15
15
|
onReady?: (this: ComponentPublicInstance) => void;
|
|
16
16
|
onShow?: (this: ComponentPublicInstance) => void;
|
|
@@ -20,25 +20,29 @@ interface PageHooks {
|
|
|
20
20
|
interface AppLifecycleHooks {
|
|
21
21
|
onLaunch?: (this: AppRuntime, options: AppLaunchOptions) => void;
|
|
22
22
|
onShow?: (this: AppRuntime, options: AppLaunchOptions) => void;
|
|
23
|
-
onHide?: (this: AppRuntime) => void;
|
|
23
|
+
onHide?: (this: AppRuntime, options: AppHideOptions) => void;
|
|
24
24
|
}
|
|
25
|
-
type AppRuntime = Record<string, unknown> & Partial<AppLifecycleHooks> & {
|
|
25
|
+
export type AppRuntime = Record<string, unknown> & Partial<AppLifecycleHooks> & {
|
|
26
26
|
globalData?: Record<string, unknown>;
|
|
27
27
|
};
|
|
28
|
-
interface AppLaunchOptions {
|
|
28
|
+
export interface AppLaunchOptions {
|
|
29
29
|
path: string;
|
|
30
30
|
scene: number;
|
|
31
31
|
query: Record<string, string>;
|
|
32
32
|
referrerInfo: Record<string, unknown>;
|
|
33
33
|
}
|
|
34
|
-
interface
|
|
34
|
+
export interface AppHideOptions {
|
|
35
|
+
reason: 0 | 1 | 2 | 3;
|
|
36
|
+
}
|
|
37
|
+
export type AppHideCallback = (options: AppHideOptions) => void;
|
|
38
|
+
export type AppShowCallback = (options: AppLaunchOptions) => void;
|
|
39
|
+
export interface RouteOptions extends MiniProgramAsyncOptions<MiniProgramBaseResult> {
|
|
35
40
|
url: string;
|
|
36
41
|
}
|
|
37
|
-
interface NavigateBackOptions extends MiniProgramAsyncOptions<MiniProgramBaseResult> {
|
|
42
|
+
export interface NavigateBackOptions extends MiniProgramAsyncOptions<MiniProgramBaseResult> {
|
|
38
43
|
delta?: number;
|
|
39
44
|
}
|
|
40
|
-
type PageRawOptions = ComponentOptions & PageHooks & Record<string, unknown>;
|
|
41
|
-
type ComponentRawOptions = ComponentOptions & Record<string, unknown>;
|
|
45
|
+
export type PageRawOptions = ComponentOptions & PageHooks & Record<string, unknown>;
|
|
46
|
+
export type ComponentRawOptions = ComponentOptions & Record<string, unknown>;
|
|
42
47
|
//#endregion
|
|
43
|
-
export { AppLaunchOptions, AppRuntime, ComponentRawOptions, NavigateBackOptions, PageHooks, PageRawOptions, RegisterMeta, RouteOptions };
|
|
44
48
|
//# sourceMappingURL=options.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"options.mjs","names":[],"sources":["../../../../src/runtime/polyfill/routeRuntime/options.ts"],"sourcesContent":["import type { NavigationBarConfig } from '../../../compiler/wxml'\nimport type { ComponentOptions, ComponentPublicInstance } from '../../component'\nimport type { TemplateRenderer } from '../../template'\nimport type { MiniProgramAsyncOptions, MiniProgramBaseResult } from '../types'\n\nexport interface RegisterMeta {\n id: string\n template?: TemplateRenderer\n style?: string\n navigationBar?: NavigationBarConfig\n}\n\nexport interface PageHooks {\n onLoad?: (this: ComponentPublicInstance, query: Record<string, string>) => void\n onReady?: (this: ComponentPublicInstance) => void\n onShow?: (this: ComponentPublicInstance) => void\n onHide?: (this: ComponentPublicInstance) => void\n onUnload?: (this: ComponentPublicInstance) => void\n}\n\nexport interface PageRecord {\n tag: string\n hooks: PageHooks\n instances: Set<ComponentPublicInstance>\n navigationBar?: NavigationBarConfig\n}\n\nexport interface ComponentRecord {\n tag: string\n}\n\nexport interface PageStackEntry {\n id: string\n query: Record<string, string>\n active: boolean\n element?: HTMLElement & ComponentPublicInstance\n instance?: ComponentPublicInstance\n scrollTop?: number\n}\n\nexport interface RouteMeta {\n id: string\n query: Record<string, string>\n entry: PageStackEntry\n}\n\ninterface AppLifecycleHooks {\n onLaunch?: (this: AppRuntime, options: AppLaunchOptions) => void\n onShow?: (this: AppRuntime, options: AppLaunchOptions) => void\n onHide?: (this: AppRuntime) => void\n}\n\nexport type AppRuntime = Record<string, unknown> & Partial<AppLifecycleHooks> & {\n globalData?: Record<string, unknown>\n}\n\nexport interface AppLaunchOptions {\n path: string\n scene: number\n query: Record<string, string>\n referrerInfo: Record<string, unknown>\n}\n\nexport interface RouteOptions extends MiniProgramAsyncOptions<MiniProgramBaseResult> {\n url: string\n}\n\nexport interface NavigateBackOptions extends MiniProgramAsyncOptions<MiniProgramBaseResult> {\n delta?: number\n}\n\ntype MethodHandler = (this: ComponentPublicInstance, ...args: unknown[]) => unknown\n\nexport type PageRawOptions = ComponentOptions & PageHooks & Record<string, unknown>\nexport type ComponentRawOptions = ComponentOptions & Record<string, unknown>\n\nconst PAGE_LIFECYCLE_KEYS = new Set(['onLoad', 'onReady', 'onShow', 'onHide', 'onUnload'])\nconst RESERVED_PAGE_METHOD_KEYS = new Set([\n 'data',\n 'methods',\n 'lifetimes',\n 'properties',\n 'behaviors',\n 'options',\n 'observers',\n 'mixins',\n ...PAGE_LIFECYCLE_KEYS,\n])\nconst RESERVED_COMPONENT_METHOD_KEYS = new Set([\n 'data',\n 'methods',\n 'lifetimes',\n 'pageLifetimes',\n 'properties',\n 'behaviors',\n 'options',\n 'observers',\n 'mixins',\n])\n\nfunction cloneLifetimes(source: NonNullable<ComponentOptions['lifetimes']>): ComponentOptions['lifetimes'] {\n return {\n ...source,\n }\n}\n\nexport function isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null\n}\n\nfunction isMethodHandler(value: unknown): value is MethodHandler {\n return typeof value === 'function'\n}\n\nfunction normalizeMethodBag(\n source: Record<string, unknown> | undefined,\n reserved: Set<string>,\n) {\n const methods: Record<string, MethodHandler> = {}\n const sourceMethods = isRecord(source?.methods) ? source?.methods : undefined\n\n if (sourceMethods) {\n for (const [key, value] of Object.entries(sourceMethods)) {\n if (isMethodHandler(value)) {\n methods[key] = value\n }\n }\n }\n\n if (source) {\n for (const [key, value] of Object.entries(source)) {\n if (reserved.has(key)) {\n continue\n }\n if (isMethodHandler(value) && methods[key] === undefined) {\n methods[key] = value\n }\n }\n }\n return methods\n}\n\nexport function normalizePageOptions(raw: PageRawOptions | undefined): { component: ComponentOptions, hooks: PageHooks } {\n const component = { ...(raw ?? {}) } as ComponentOptions\n component.methods = normalizeMethodBag(raw as Record<string, unknown> | undefined, RESERVED_PAGE_METHOD_KEYS) as ComponentOptions['methods']\n if (raw?.lifetimes) {\n component.lifetimes = cloneLifetimes(raw.lifetimes)\n }\n const hooks: PageHooks = {}\n if (typeof raw?.onLoad === 'function') {\n hooks.onLoad = raw.onLoad as PageHooks['onLoad']\n }\n if (typeof raw?.onReady === 'function') {\n hooks.onReady = raw.onReady as PageHooks['onReady']\n }\n if (typeof raw?.onShow === 'function') {\n hooks.onShow = raw.onShow as PageHooks['onShow']\n }\n if (typeof raw?.onHide === 'function') {\n hooks.onHide = raw.onHide as PageHooks['onHide']\n }\n if (typeof raw?.onUnload === 'function') {\n hooks.onUnload = raw.onUnload as PageHooks['onUnload']\n }\n return { component, hooks }\n}\n\nexport function normalizeComponentOptions(raw: ComponentRawOptions | undefined): ComponentOptions {\n const component = { ...(raw ?? {}) } as ComponentOptions\n component.methods = normalizeMethodBag(raw as Record<string, unknown> | undefined, RESERVED_COMPONENT_METHOD_KEYS) as ComponentOptions['methods']\n if (raw?.lifetimes) {\n component.lifetimes = cloneLifetimes(raw.lifetimes)\n }\n return component\n}\n"],"mappings":";
|
|
1
|
+
{"version":3,"file":"options.mjs","names":[],"sources":["../../../../src/runtime/polyfill/routeRuntime/options.ts"],"sourcesContent":["import type { NavigationBarConfig } from '../../../compiler/wxml'\nimport type { ComponentOptions, ComponentPublicInstance } from '../../component'\nimport type { TemplateRenderer } from '../../template'\nimport type { MiniProgramAsyncOptions, MiniProgramBaseResult } from '../types'\n\nexport interface RegisterMeta {\n id: string\n template?: TemplateRenderer\n style?: string\n navigationBar?: NavigationBarConfig\n}\n\nexport interface PageHooks {\n onLoad?: (this: ComponentPublicInstance, query: Record<string, string>) => void\n onReady?: (this: ComponentPublicInstance) => void\n onShow?: (this: ComponentPublicInstance) => void\n onHide?: (this: ComponentPublicInstance) => void\n onUnload?: (this: ComponentPublicInstance) => void\n}\n\nexport interface PageRecord {\n tag: string\n hooks: PageHooks\n instances: Set<ComponentPublicInstance>\n navigationBar?: NavigationBarConfig\n}\n\nexport interface ComponentRecord {\n tag: string\n}\n\nexport interface PageStackEntry {\n id: string\n query: Record<string, string>\n active: boolean\n element?: HTMLElement & ComponentPublicInstance\n instance?: ComponentPublicInstance\n scrollTop?: number\n}\n\nexport interface RouteMeta {\n id: string\n query: Record<string, string>\n entry: PageStackEntry\n}\n\ninterface AppLifecycleHooks {\n onLaunch?: (this: AppRuntime, options: AppLaunchOptions) => void\n onShow?: (this: AppRuntime, options: AppLaunchOptions) => void\n onHide?: (this: AppRuntime, options: AppHideOptions) => void\n}\n\nexport type AppRuntime = Record<string, unknown> & Partial<AppLifecycleHooks> & {\n globalData?: Record<string, unknown>\n}\n\nexport interface AppLaunchOptions {\n path: string\n scene: number\n query: Record<string, string>\n referrerInfo: Record<string, unknown>\n}\n\nexport interface AppHideOptions {\n reason: 0 | 1 | 2 | 3\n}\n\nexport type AppHideCallback = (options: AppHideOptions) => void\nexport type AppShowCallback = (options: AppLaunchOptions) => void\n\nexport interface RouteOptions extends MiniProgramAsyncOptions<MiniProgramBaseResult> {\n url: string\n}\n\nexport interface NavigateBackOptions extends MiniProgramAsyncOptions<MiniProgramBaseResult> {\n delta?: number\n}\n\ntype MethodHandler = (this: ComponentPublicInstance, ...args: unknown[]) => unknown\n\nexport type PageRawOptions = ComponentOptions & PageHooks & Record<string, unknown>\nexport type ComponentRawOptions = ComponentOptions & Record<string, unknown>\n\nconst PAGE_LIFECYCLE_KEYS = new Set(['onLoad', 'onReady', 'onShow', 'onHide', 'onUnload'])\nconst RESERVED_PAGE_METHOD_KEYS = new Set([\n 'data',\n 'methods',\n 'lifetimes',\n 'properties',\n 'behaviors',\n 'options',\n 'observers',\n 'mixins',\n ...PAGE_LIFECYCLE_KEYS,\n])\nconst RESERVED_COMPONENT_METHOD_KEYS = new Set([\n 'data',\n 'methods',\n 'lifetimes',\n 'pageLifetimes',\n 'properties',\n 'behaviors',\n 'options',\n 'observers',\n 'mixins',\n])\n\nfunction cloneLifetimes(source: NonNullable<ComponentOptions['lifetimes']>): ComponentOptions['lifetimes'] {\n return {\n ...source,\n }\n}\n\nexport function isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null\n}\n\nfunction isMethodHandler(value: unknown): value is MethodHandler {\n return typeof value === 'function'\n}\n\nfunction normalizeMethodBag(\n source: Record<string, unknown> | undefined,\n reserved: Set<string>,\n) {\n const methods: Record<string, MethodHandler> = {}\n const sourceMethods = isRecord(source?.methods) ? source?.methods : undefined\n\n if (sourceMethods) {\n for (const [key, value] of Object.entries(sourceMethods)) {\n if (isMethodHandler(value)) {\n methods[key] = value\n }\n }\n }\n\n if (source) {\n for (const [key, value] of Object.entries(source)) {\n if (reserved.has(key)) {\n continue\n }\n if (isMethodHandler(value) && methods[key] === undefined) {\n methods[key] = value\n }\n }\n }\n return methods\n}\n\nexport function normalizePageOptions(raw: PageRawOptions | undefined): { component: ComponentOptions, hooks: PageHooks } {\n const component = { ...(raw ?? {}) } as ComponentOptions\n component.methods = normalizeMethodBag(raw as Record<string, unknown> | undefined, RESERVED_PAGE_METHOD_KEYS) as ComponentOptions['methods']\n if (raw?.lifetimes) {\n component.lifetimes = cloneLifetimes(raw.lifetimes)\n }\n const hooks: PageHooks = {}\n if (typeof raw?.onLoad === 'function') {\n hooks.onLoad = raw.onLoad as PageHooks['onLoad']\n }\n if (typeof raw?.onReady === 'function') {\n hooks.onReady = raw.onReady as PageHooks['onReady']\n }\n if (typeof raw?.onShow === 'function') {\n hooks.onShow = raw.onShow as PageHooks['onShow']\n }\n if (typeof raw?.onHide === 'function') {\n hooks.onHide = raw.onHide as PageHooks['onHide']\n }\n if (typeof raw?.onUnload === 'function') {\n hooks.onUnload = raw.onUnload as PageHooks['onUnload']\n }\n return { component, hooks }\n}\n\nexport function normalizeComponentOptions(raw: ComponentRawOptions | undefined): ComponentOptions {\n const component = { ...(raw ?? {}) } as ComponentOptions\n component.methods = normalizeMethodBag(raw as Record<string, unknown> | undefined, RESERVED_COMPONENT_METHOD_KEYS) as ComponentOptions['methods']\n if (raw?.lifetimes) {\n component.lifetimes = cloneLifetimes(raw.lifetimes)\n }\n return component\n}\n"],"mappings":";AAoFA,MAAM,4CAA4B,IAAI,IAAI;CACxC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA,mBAAG,IAV2B,IAAI;EAAC;EAAU;EAAW;EAAU;EAAU;CAAU,CAUjE;AACvB,CAAC;AACD,MAAM,iDAAiC,IAAI,IAAI;CAC7C;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAC;AAED,SAAS,eAAe,QAAmF;CACzG,OAAO,EACL,GAAG,OACL;AACF;AAEA,SAAgB,SAAS,OAAkD;CACzE,OAAO,OAAO,UAAU,YAAY,UAAU;AAChD;AAEA,SAAS,gBAAgB,OAAwC;CAC/D,OAAO,OAAO,UAAU;AAC1B;AAEA,SAAS,mBACP,QACA,UACA;CACA,MAAM,UAAyC,CAAC;CAChD,MAAM,gBAAgB,SAAS,QAAQ,OAAO,IAAI,QAAQ,UAAU;CAEpE,IAAI,eACF;OAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,aAAa,GACrD,IAAI,gBAAgB,KAAK,GACvB,QAAQ,OAAO;CAEnB;CAGF,IAAI,QACF,KAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,MAAM,GAAG;EACjD,IAAI,SAAS,IAAI,GAAG,GAClB;EAEF,IAAI,gBAAgB,KAAK,KAAK,QAAQ,SAAS,QAC7C,QAAQ,OAAO;CAEnB;CAEF,OAAO;AACT;AAEA,SAAgB,qBAAqB,KAAoF;CACvH,MAAM,YAAY,EAAE,GAAI,OAAO,CAAC,EAAG;CACnC,UAAU,UAAU,mBAAmB,KAA4C,yBAAyB;CAC5G,IAAI,KAAK,WACP,UAAU,YAAY,eAAe,IAAI,SAAS;CAEpD,MAAM,QAAmB,CAAC;CAC1B,IAAI,OAAO,KAAK,WAAW,YACzB,MAAM,SAAS,IAAI;CAErB,IAAI,OAAO,KAAK,YAAY,YAC1B,MAAM,UAAU,IAAI;CAEtB,IAAI,OAAO,KAAK,WAAW,YACzB,MAAM,SAAS,IAAI;CAErB,IAAI,OAAO,KAAK,WAAW,YACzB,MAAM,SAAS,IAAI;CAErB,IAAI,OAAO,KAAK,aAAa,YAC3B,MAAM,WAAW,IAAI;CAEvB,OAAO;EAAE;EAAW;CAAM;AAC5B;AAEA,SAAgB,0BAA0B,KAAwD;CAChG,MAAM,YAAY,EAAE,GAAI,OAAO,CAAC,EAAG;CACnC,UAAU,UAAU,mBAAmB,KAA4C,8BAA8B;CACjH,IAAI,KAAK,WACP,UAAU,YAAY,eAAe,IAAI,SAAS;CAEpD,OAAO;AACT"}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import "../component/index.mjs";
|
|
2
|
-
import { AppLaunchOptions, AppRuntime, ComponentRawOptions, NavigateBackOptions, PageRawOptions, RegisterMeta, RouteOptions } from "./routeRuntime/options.mjs";
|
|
2
|
+
import { AppHideCallback, AppLaunchOptions, AppRuntime, AppShowCallback, ComponentRawOptions, NavigateBackOptions, PageRawOptions, RegisterMeta, RouteOptions } from "./routeRuntime/options.mjs";
|
|
3
3
|
import { WebRoutingConfig } from "./routeRuntime/history.mjs";
|
|
4
4
|
import { WebResourceHintsConfig, WebRuntimeSeoConfig as WebSeoConfig } from "../seo/index.mjs";
|
|
5
5
|
import { WebTabBarConfig } from "../../shared/tabBar.mjs";
|
|
6
6
|
import { ButtonFormConfig } from "../button/index.mjs";
|
|
7
7
|
import { NavigationBarMetrics } from "../navigationBar/index.mjs";
|
|
8
8
|
import { WebViewportConfig } from "../viewport/types.mjs";
|
|
9
|
+
import "./index.mjs";
|
|
9
10
|
//#region src/runtime/polyfill/routeRuntime.d.ts
|
|
10
|
-
declare function initializePageRoutes(ids: string[], options?: {
|
|
11
|
+
export declare function initializePageRoutes(ids: string[], options?: {
|
|
11
12
|
rpx?: {
|
|
12
13
|
designWidth?: number;
|
|
13
14
|
varName?: string;
|
|
@@ -27,26 +28,29 @@ declare function initializePageRoutes(ids: string[], options?: {
|
|
|
27
28
|
resourceHints?: WebResourceHintsConfig;
|
|
28
29
|
};
|
|
29
30
|
}): void;
|
|
30
|
-
declare function registerPage<T extends PageRawOptions | undefined>(options: T, meta: RegisterMeta): T;
|
|
31
|
-
declare function registerComponent<T extends ComponentRawOptions | undefined>(options: T, meta: RegisterMeta): T;
|
|
32
|
-
declare function registerApp<T extends AppRuntime | undefined>(options: T, _meta?: RegisterMeta): T;
|
|
33
|
-
declare function
|
|
31
|
+
export declare function registerPage<T extends PageRawOptions | undefined>(options: T, meta: RegisterMeta): T;
|
|
32
|
+
export declare function registerComponent<T extends ComponentRawOptions | undefined>(options: T, meta: RegisterMeta): T;
|
|
33
|
+
export declare function registerApp<T extends AppRuntime | undefined>(options: T, _meta?: RegisterMeta): T;
|
|
34
|
+
export declare function offAppHide(callback?: AppHideCallback): void;
|
|
35
|
+
export declare function offAppShow(callback?: AppShowCallback): void;
|
|
36
|
+
export declare function onAppHide(callback: AppHideCallback): void;
|
|
37
|
+
export declare function onAppShow(callback: AppShowCallback): void;
|
|
38
|
+
export declare function navigateTo(options: RouteOptions): Promise<{
|
|
34
39
|
errMsg: string;
|
|
35
40
|
}>;
|
|
36
|
-
declare function redirectTo(options: RouteOptions): Promise<{
|
|
41
|
+
export declare function redirectTo(options: RouteOptions): Promise<{
|
|
37
42
|
errMsg: string;
|
|
38
43
|
}>;
|
|
39
|
-
declare function reLaunch(options: RouteOptions): Promise<{
|
|
44
|
+
export declare function reLaunch(options: RouteOptions): Promise<{
|
|
40
45
|
errMsg: string;
|
|
41
46
|
}>;
|
|
42
|
-
declare function switchTab(options: RouteOptions): Promise<{
|
|
47
|
+
export declare function switchTab(options: RouteOptions): Promise<{
|
|
43
48
|
errMsg: string;
|
|
44
49
|
}>;
|
|
45
|
-
declare function navigateBack(options?: NavigateBackOptions): Promise<{
|
|
50
|
+
export declare function navigateBack(options?: NavigateBackOptions): Promise<{
|
|
46
51
|
errMsg: string;
|
|
47
52
|
}>;
|
|
48
|
-
declare function getLaunchOptionsSync(): AppLaunchOptions;
|
|
49
|
-
declare function getEnterOptionsSync(): AppLaunchOptions;
|
|
53
|
+
export declare function getLaunchOptionsSync(): AppLaunchOptions;
|
|
54
|
+
export declare function getEnterOptionsSync(): AppLaunchOptions;
|
|
50
55
|
//#endregion
|
|
51
|
-
export { getEnterOptionsSync, getLaunchOptionsSync, initializePageRoutes, navigateBack, navigateTo, reLaunch, redirectTo, registerApp, registerComponent, registerPage, switchTab };
|
|
52
56
|
//# sourceMappingURL=routeRuntime.d.mts.map
|
|
@@ -171,6 +171,18 @@ function registerComponent(options, meta) {
|
|
|
171
171
|
function registerApp(options, _meta) {
|
|
172
172
|
return appLifecycle.register(options);
|
|
173
173
|
}
|
|
174
|
+
function offAppHide(callback) {
|
|
175
|
+
appLifecycle.offAppHide(callback);
|
|
176
|
+
}
|
|
177
|
+
function offAppShow(callback) {
|
|
178
|
+
appLifecycle.offAppShow(callback);
|
|
179
|
+
}
|
|
180
|
+
function onAppHide(callback) {
|
|
181
|
+
appLifecycle.onAppHide(callback);
|
|
182
|
+
}
|
|
183
|
+
function onAppShow(callback) {
|
|
184
|
+
appLifecycle.onAppShow(callback);
|
|
185
|
+
}
|
|
174
186
|
function navigateTo(options) {
|
|
175
187
|
const { id, query } = parsePageUrl(options?.url ?? "");
|
|
176
188
|
const succeeded = pageStack.push(id, query);
|
|
@@ -223,5 +235,5 @@ function getEnterOptionsSync() {
|
|
|
223
235
|
}
|
|
224
236
|
|
|
225
237
|
//#endregion
|
|
226
|
-
export { getAppInstance, getCurrentPageInstance, getCurrentPagesInternal, getEnterOptionsSync, getLaunchOptionsSync, initializePageRoutes, navigateBack, navigateTo, reLaunch, redirectTo, registerApp, registerComponent, registerPage, switchTab };
|
|
238
|
+
export { getAppInstance, getCurrentPageInstance, getCurrentPagesInternal, getEnterOptionsSync, getLaunchOptionsSync, initializePageRoutes, navigateBack, navigateTo, offAppHide, offAppShow, onAppHide, onAppShow, reLaunch, redirectTo, registerApp, registerComponent, registerPage, switchTab };
|
|
227
239
|
//# sourceMappingURL=routeRuntime.mjs.map
|