mp-weixin-back 0.0.17 → 0.0.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/dist/index.cjs +599 -482
- package/dist/index.d.cts +32 -1
- package/dist/index.d.mts +32 -1
- package/dist/index.d.ts +32 -1
- package/dist/index.mjs +599 -482
- package/package.json +10 -4
- package/readme.md +50 -18
package/dist/index.d.cts
CHANGED
|
@@ -6,12 +6,15 @@ import { Plugin } from 'vite';
|
|
|
6
6
|
type BackParams = {
|
|
7
7
|
/**
|
|
8
8
|
* The path of the current page that triggered the back event.
|
|
9
|
+
* `null` when the page path cannot be resolved (e.g. pages.json not found).
|
|
9
10
|
* @example 'pages/index/index'
|
|
10
11
|
*/
|
|
11
|
-
page: string;
|
|
12
|
+
page: string | null;
|
|
12
13
|
};
|
|
13
14
|
/**
|
|
14
15
|
* Per-page options for `onPageBack()`.
|
|
16
|
+
*
|
|
17
|
+
* 这些值在构建期静态读取,必须是布尔/数字字面量。
|
|
15
18
|
*/
|
|
16
19
|
type OnPageBackOptions = {
|
|
17
20
|
/**
|
|
@@ -42,6 +45,26 @@ type OnPageBackOptions = {
|
|
|
42
45
|
*/
|
|
43
46
|
initialValue: boolean;
|
|
44
47
|
};
|
|
48
|
+
/**
|
|
49
|
+
* 注入的 page-container 组件属性。
|
|
50
|
+
*/
|
|
51
|
+
type PageContainerOptions = {
|
|
52
|
+
/**
|
|
53
|
+
* z-index of the injected page-container.
|
|
54
|
+
* @default 1
|
|
55
|
+
*/
|
|
56
|
+
zIndex?: number;
|
|
57
|
+
/**
|
|
58
|
+
* Whether to show the overlay.
|
|
59
|
+
* @default false
|
|
60
|
+
*/
|
|
61
|
+
overlay?: boolean;
|
|
62
|
+
/**
|
|
63
|
+
* Animation duration in ms, or `false` to disable.
|
|
64
|
+
* @default false
|
|
65
|
+
*/
|
|
66
|
+
duration?: number | boolean;
|
|
67
|
+
};
|
|
45
68
|
/**
|
|
46
69
|
* Global plugin options passed to `mpBackPlugin()` in `vite.config.ts`.
|
|
47
70
|
*/
|
|
@@ -54,15 +77,23 @@ type Config = OnPageBackOptions & {
|
|
|
54
77
|
/**
|
|
55
78
|
* Global callback fired every time a back event is detected on any page.
|
|
56
79
|
* Page-level callbacks registered via `onPageBack()` run in addition to this.
|
|
80
|
+
*
|
|
81
|
+
* ⚠️ 该函数会被序列化注入到页面代码中,必须自包含:
|
|
82
|
+
* 不能引用 vite.config.ts 中的闭包变量或 import 的模块。
|
|
57
83
|
* @example
|
|
58
84
|
* mpBackPlugin({
|
|
59
85
|
* onPageBack: ({ page }) => console.log('back on:', page)
|
|
60
86
|
* })
|
|
61
87
|
*/
|
|
62
88
|
onPageBack?: (params: BackParams) => void;
|
|
89
|
+
/**
|
|
90
|
+
* 注入的 page-container 组件属性。
|
|
91
|
+
*/
|
|
92
|
+
pageContainer?: PageContainerOptions;
|
|
63
93
|
};
|
|
64
94
|
type UserOptions = Partial<Config>;
|
|
65
95
|
|
|
66
96
|
declare function MpBackPlugin(userOptions?: UserOptions): Plugin;
|
|
67
97
|
|
|
68
98
|
export { MpBackPlugin as default };
|
|
99
|
+
export type { BackParams, Config, OnPageBackOptions, PageContainerOptions, UserOptions };
|
package/dist/index.d.mts
CHANGED
|
@@ -6,12 +6,15 @@ import { Plugin } from 'vite';
|
|
|
6
6
|
type BackParams = {
|
|
7
7
|
/**
|
|
8
8
|
* The path of the current page that triggered the back event.
|
|
9
|
+
* `null` when the page path cannot be resolved (e.g. pages.json not found).
|
|
9
10
|
* @example 'pages/index/index'
|
|
10
11
|
*/
|
|
11
|
-
page: string;
|
|
12
|
+
page: string | null;
|
|
12
13
|
};
|
|
13
14
|
/**
|
|
14
15
|
* Per-page options for `onPageBack()`.
|
|
16
|
+
*
|
|
17
|
+
* 这些值在构建期静态读取,必须是布尔/数字字面量。
|
|
15
18
|
*/
|
|
16
19
|
type OnPageBackOptions = {
|
|
17
20
|
/**
|
|
@@ -42,6 +45,26 @@ type OnPageBackOptions = {
|
|
|
42
45
|
*/
|
|
43
46
|
initialValue: boolean;
|
|
44
47
|
};
|
|
48
|
+
/**
|
|
49
|
+
* 注入的 page-container 组件属性。
|
|
50
|
+
*/
|
|
51
|
+
type PageContainerOptions = {
|
|
52
|
+
/**
|
|
53
|
+
* z-index of the injected page-container.
|
|
54
|
+
* @default 1
|
|
55
|
+
*/
|
|
56
|
+
zIndex?: number;
|
|
57
|
+
/**
|
|
58
|
+
* Whether to show the overlay.
|
|
59
|
+
* @default false
|
|
60
|
+
*/
|
|
61
|
+
overlay?: boolean;
|
|
62
|
+
/**
|
|
63
|
+
* Animation duration in ms, or `false` to disable.
|
|
64
|
+
* @default false
|
|
65
|
+
*/
|
|
66
|
+
duration?: number | boolean;
|
|
67
|
+
};
|
|
45
68
|
/**
|
|
46
69
|
* Global plugin options passed to `mpBackPlugin()` in `vite.config.ts`.
|
|
47
70
|
*/
|
|
@@ -54,15 +77,23 @@ type Config = OnPageBackOptions & {
|
|
|
54
77
|
/**
|
|
55
78
|
* Global callback fired every time a back event is detected on any page.
|
|
56
79
|
* Page-level callbacks registered via `onPageBack()` run in addition to this.
|
|
80
|
+
*
|
|
81
|
+
* ⚠️ 该函数会被序列化注入到页面代码中,必须自包含:
|
|
82
|
+
* 不能引用 vite.config.ts 中的闭包变量或 import 的模块。
|
|
57
83
|
* @example
|
|
58
84
|
* mpBackPlugin({
|
|
59
85
|
* onPageBack: ({ page }) => console.log('back on:', page)
|
|
60
86
|
* })
|
|
61
87
|
*/
|
|
62
88
|
onPageBack?: (params: BackParams) => void;
|
|
89
|
+
/**
|
|
90
|
+
* 注入的 page-container 组件属性。
|
|
91
|
+
*/
|
|
92
|
+
pageContainer?: PageContainerOptions;
|
|
63
93
|
};
|
|
64
94
|
type UserOptions = Partial<Config>;
|
|
65
95
|
|
|
66
96
|
declare function MpBackPlugin(userOptions?: UserOptions): Plugin;
|
|
67
97
|
|
|
68
98
|
export { MpBackPlugin as default };
|
|
99
|
+
export type { BackParams, Config, OnPageBackOptions, PageContainerOptions, UserOptions };
|
package/dist/index.d.ts
CHANGED
|
@@ -6,12 +6,15 @@ import { Plugin } from 'vite';
|
|
|
6
6
|
type BackParams = {
|
|
7
7
|
/**
|
|
8
8
|
* The path of the current page that triggered the back event.
|
|
9
|
+
* `null` when the page path cannot be resolved (e.g. pages.json not found).
|
|
9
10
|
* @example 'pages/index/index'
|
|
10
11
|
*/
|
|
11
|
-
page: string;
|
|
12
|
+
page: string | null;
|
|
12
13
|
};
|
|
13
14
|
/**
|
|
14
15
|
* Per-page options for `onPageBack()`.
|
|
16
|
+
*
|
|
17
|
+
* 这些值在构建期静态读取,必须是布尔/数字字面量。
|
|
15
18
|
*/
|
|
16
19
|
type OnPageBackOptions = {
|
|
17
20
|
/**
|
|
@@ -42,6 +45,26 @@ type OnPageBackOptions = {
|
|
|
42
45
|
*/
|
|
43
46
|
initialValue: boolean;
|
|
44
47
|
};
|
|
48
|
+
/**
|
|
49
|
+
* 注入的 page-container 组件属性。
|
|
50
|
+
*/
|
|
51
|
+
type PageContainerOptions = {
|
|
52
|
+
/**
|
|
53
|
+
* z-index of the injected page-container.
|
|
54
|
+
* @default 1
|
|
55
|
+
*/
|
|
56
|
+
zIndex?: number;
|
|
57
|
+
/**
|
|
58
|
+
* Whether to show the overlay.
|
|
59
|
+
* @default false
|
|
60
|
+
*/
|
|
61
|
+
overlay?: boolean;
|
|
62
|
+
/**
|
|
63
|
+
* Animation duration in ms, or `false` to disable.
|
|
64
|
+
* @default false
|
|
65
|
+
*/
|
|
66
|
+
duration?: number | boolean;
|
|
67
|
+
};
|
|
45
68
|
/**
|
|
46
69
|
* Global plugin options passed to `mpBackPlugin()` in `vite.config.ts`.
|
|
47
70
|
*/
|
|
@@ -54,15 +77,23 @@ type Config = OnPageBackOptions & {
|
|
|
54
77
|
/**
|
|
55
78
|
* Global callback fired every time a back event is detected on any page.
|
|
56
79
|
* Page-level callbacks registered via `onPageBack()` run in addition to this.
|
|
80
|
+
*
|
|
81
|
+
* ⚠️ 该函数会被序列化注入到页面代码中,必须自包含:
|
|
82
|
+
* 不能引用 vite.config.ts 中的闭包变量或 import 的模块。
|
|
57
83
|
* @example
|
|
58
84
|
* mpBackPlugin({
|
|
59
85
|
* onPageBack: ({ page }) => console.log('back on:', page)
|
|
60
86
|
* })
|
|
61
87
|
*/
|
|
62
88
|
onPageBack?: (params: BackParams) => void;
|
|
89
|
+
/**
|
|
90
|
+
* 注入的 page-container 组件属性。
|
|
91
|
+
*/
|
|
92
|
+
pageContainer?: PageContainerOptions;
|
|
63
93
|
};
|
|
64
94
|
type UserOptions = Partial<Config>;
|
|
65
95
|
|
|
66
96
|
declare function MpBackPlugin(userOptions?: UserOptions): Plugin;
|
|
67
97
|
|
|
68
98
|
export { MpBackPlugin as default };
|
|
99
|
+
export type { BackParams, Config, OnPageBackOptions, PageContainerOptions, UserOptions };
|