@vuepress/plugin-pwa 2.0.0-rc.123 → 2.0.0-rc.124

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.
Files changed (37) hide show
  1. package/lib/PwaInstallModal-DH0cwyM5.js +2 -0
  2. package/lib/PwaInstallModal-DH0cwyM5.js.map +1 -0
  3. package/lib/client/components/PwaFoundPopup.d.ts +21 -19
  4. package/lib/client/components/PwaFoundPopup.js +2 -2
  5. package/lib/client/components/PwaFoundPopup.js.map +1 -1
  6. package/lib/client/components/PwaInstall.d.ts +15 -15
  7. package/lib/client/components/PwaInstall.js +2 -2
  8. package/lib/client/components/PwaInstall.js.map +1 -1
  9. package/lib/client/components/PwaReadyPopup.d.ts +21 -19
  10. package/lib/client/components/PwaReadyPopup.js +2 -2
  11. package/lib/client/components/PwaReadyPopup.js.map +1 -1
  12. package/lib/client/composables/index.d.ts +19 -15
  13. package/lib/client/composables/index.js +1 -2
  14. package/lib/client/index.d.ts +16 -14
  15. package/lib/client/index.js +2 -2
  16. package/lib/client/index.js.map +1 -1
  17. package/lib/{client/icons-DQk7h1-3.js → icons-RRw4DIWa.js} +2 -2
  18. package/lib/icons-RRw4DIWa.js.map +1 -0
  19. package/lib/locales-BlsUewPq.d.ts +72 -0
  20. package/lib/node/index.d.ts +263 -327
  21. package/lib/node/index.js +18 -18
  22. package/lib/node/index.js.map +1 -1
  23. package/lib/setupViewPoint-DS4c13mS.js +2 -0
  24. package/lib/setupViewPoint-DS4c13mS.js.map +1 -0
  25. package/lib/skipWaiting-wM8NHpWa.js +2 -0
  26. package/lib/skipWaiting-wM8NHpWa.js.map +1 -0
  27. package/lib/types-CGDCqUfb.d.ts +8 -0
  28. package/package.json +16 -12
  29. package/lib/client/PwaReadyPopup-Crl_YRc0.js +0 -2
  30. package/lib/client/PwaReadyPopup-Crl_YRc0.js.map +0 -1
  31. package/lib/client/composables/index.js.map +0 -1
  32. package/lib/client/icons-DQk7h1-3.js.map +0 -1
  33. package/lib/client/index-BvxQeVsR.js +0 -2
  34. package/lib/client/index-BvxQeVsR.js.map +0 -1
  35. package/lib/client/types-B0Ty8tPv.d.ts +0 -74
  36. package/lib/client/usePwaEvent-CUDY9qle.js +0 -2
  37. package/lib/client/usePwaEvent-CUDY9qle.js.map +0 -1
@@ -1,77 +1,10 @@
1
- import { DefaultLocaleInfo } from '@vuepress/helper';
2
- import { LocaleConfig } from 'vuepress/shared';
3
- import { GenerateSWOptions } from 'workbox-build';
4
- import { PluginFunction } from 'vuepress/core';
5
-
6
- interface PwaPluginLocaleData {
7
- /**
8
- * Install button text
9
- *
10
- * 安装按钮文字
11
- */
12
- install: string;
13
- /**
14
- * iOS install hint text
15
- *
16
- * iOS 安装文字
17
- */
18
- iOSInstall: string;
19
- /**
20
- * Cancel button text
21
- *
22
- * 取消按钮文字
23
- */
24
- cancel: string;
25
- /**
26
- * Close button text
27
- *
28
- * 关闭按钮文字
29
- */
30
- close: string;
31
- /**
32
- * Previous image text
33
- *
34
- * 上一张图片文字
35
- */
36
- prevImage: string;
37
- /**
38
- * Next image text
39
- *
40
- * 下一张图片文字
41
- */
42
- nextImage: string;
43
- /**
44
- * Install explain text
45
- *
46
- * 安装解释
47
- */
48
- explain: string;
49
- /**
50
- * Description label text
51
- *
52
- * 描述标签文字
53
- */
54
- desc: string;
55
- /**
56
- * Feature label text
57
- *
58
- * 特性标签文字
59
- */
60
- feature: string;
61
- /**
62
- * Update hint text
63
- *
64
- * 提示有更新文字
65
- */
66
- hint: string;
67
- /**
68
- * Update available text
69
- *
70
- * 更新可用文字
71
- */
72
- update: string;
73
- }
1
+ import { t as PwaPluginLocaleData } from "../locales-BlsUewPq.js";
2
+ import { DefaultLocaleInfo } from "@vuepress/helper";
3
+ import { GenerateSWOptions } from "workbox-build";
4
+ import { LocaleConfig } from "vuepress/shared";
5
+ import { PluginFunction } from "vuepress/core";
74
6
 
7
+ //#region src/shared/manifest.d.ts
75
8
  /**
76
9
  * @see https://www.w3.org/TR/mediaqueries-5/#display-mode
77
10
  */
@@ -88,283 +21,286 @@ type OrientationLockType = 'any' | 'landscape-primary' | 'landscape-secondary' |
88
21
  * @see https://www.w3.org/TR/appmanifest/#manifest-image-resources
89
22
  */
90
23
  interface ManifestImageResource {
91
- src: string;
92
- sizes: string;
93
- type?: string;
24
+ src: string;
25
+ sizes: string;
26
+ type?: string;
94
27
  }
95
28
  interface ManifestIcon extends ManifestImageResource {
96
- purpose?: 'any' | 'maskable' | 'monochrome';
29
+ purpose?: 'any' | 'maskable' | 'monochrome';
97
30
  }
98
31
  /**
99
32
  * @see https://www.w3.org/TR/appmanifest/#external-application-resource
100
33
  */
101
34
  interface ManifestExternalApplicationResource {
102
- /**
103
- * @see https://github.com/w3c/manifest/wiki/Platforms
104
- */
105
- platform: 'amazon' | 'chrome_web_store' | 'chromeos_play' | 'f-droid' | 'itunes' | 'play' | 'webapp' | 'windows';
106
- url: string;
107
- id?: string;
108
- min_version?: string;
109
- fingerprints?: {
110
- type: string;
111
- value: string;
112
- }[];
35
+ /**
36
+ * @see https://github.com/w3c/manifest/wiki/Platforms
37
+ */
38
+ platform: 'amazon' | 'chrome_web_store' | 'chromeos_play' | 'f-droid' | 'itunes' | 'play' | 'webapp' | 'windows';
39
+ url: string;
40
+ id?: string;
41
+ min_version?: string;
42
+ fingerprints?: {
43
+ type: string;
44
+ value: string;
45
+ }[];
113
46
  }
114
47
  /**
115
48
  * @see https://www.w3.org/TR/appmanifest/#shortcut-items
116
49
  */
117
50
  interface ManifestShortCutItem {
118
- name: string;
119
- url: string;
120
- short_name?: string;
121
- description?: string;
122
- icons?: ManifestIcon[];
51
+ name: string;
52
+ url: string;
53
+ short_name?: string;
54
+ description?: string;
55
+ icons?: ManifestIcon[];
123
56
  }
124
57
  /**
125
58
  * @see https://www.w3.org/TR/appmanifest/
126
59
  */
127
60
  interface AppManifest extends Record<string, unknown> {
128
- /**
129
- * @see https://www.w3.org/TR/appmanifest/#name-member
130
- *
131
- * The name of the web application as it is usually displayed to the user
132
- */
133
- name?: string;
134
- /**
135
- * @see https://www.w3.org/TR/appmanifest/#short_name-member
136
- *
137
- * A short version of the name of the web application
138
- */
139
- short_name?: string;
140
- /**
141
- * @see https://www.w3.org/TR/appmanifest/#dfn-background_color
142
- *
143
- * The expected background color of the web application
144
- */
145
- background_color?: string;
146
- /**
147
- * @see https://www.w3.org/TR/appmanifest/#dir-member
148
- *
149
- * The base direction for the localizable members of the manifest.
150
- */
151
- dir?: 'auto' | 'ltr' | 'rtl';
152
- /**
153
- * @see https://www.w3.org/TR/appmanifest/#lang-member
154
- *
155
- * specifies the primary language for the values of the manifest's localizable members
156
- */
157
- lang?: string;
158
- /**
159
- * @see https://www.w3.org/TR/appmanifest/#dfn-display
160
- *
161
- * The developer's preferred display mode for the web application
162
- */
163
- display?: DisplayMode;
164
- icons?: ManifestIcon[];
165
- /**
166
- * @see https://www.w3.org/TR/appmanifest/#orientation-member
167
- *
168
- * Serves as the default screen orientation for all top-level browsing contexts of the web application
169
- */
170
- orientation?: OrientationLockType;
171
- /**
172
- * @see https://www.w3.org/TR/appmanifest/#scope-member
173
- *
174
- * The navigation scope of this web application's application context.
175
- */
176
- scope?: string;
177
- /**
178
- * @see https://www.w3.org/TR/appmanifest/#start_url-member
179
- *
180
- * Start URL
181
- */
182
- start_url?: string;
183
- /**
184
- * @see https://www.w3.org/TR/appmanifest/#id-member
185
- *
186
- * Identity for the application
187
- */
188
- id?: string;
189
- /**
190
- * @see https://www.w3.org/TR/appmanifest/#theme_color-member
191
- *
192
- * Default theme color for an application context
193
- */
194
- theme_color?: string;
195
- shortcuts?: ManifestShortCutItem[];
196
- prefer_related_applications?: boolean;
197
- related_applications?: ManifestExternalApplicationResource[];
198
- description?: string;
199
- categories?: ManifestCategory[];
200
- screenshots?: ManifestImageResource[];
201
- iarc_rating_id?: string;
202
- features?: string[];
61
+ /**
62
+ * @see https://www.w3.org/TR/appmanifest/#name-member
63
+ *
64
+ * The name of the web application as it is usually displayed to the user
65
+ */
66
+ name?: string;
67
+ /**
68
+ * @see https://www.w3.org/TR/appmanifest/#short_name-member
69
+ *
70
+ * A short version of the name of the web application
71
+ */
72
+ short_name?: string;
73
+ /**
74
+ * @see https://www.w3.org/TR/appmanifest/#dfn-background_color
75
+ *
76
+ * The expected background color of the web application
77
+ */
78
+ background_color?: string;
79
+ /**
80
+ * @see https://www.w3.org/TR/appmanifest/#dir-member
81
+ *
82
+ * The base direction for the localizable members of the manifest.
83
+ */
84
+ dir?: 'auto' | 'ltr' | 'rtl';
85
+ /**
86
+ * @see https://www.w3.org/TR/appmanifest/#lang-member
87
+ *
88
+ * specifies the primary language for the values of the manifest's localizable members
89
+ */
90
+ lang?: string;
91
+ /**
92
+ * @see https://www.w3.org/TR/appmanifest/#dfn-display
93
+ *
94
+ * The developer's preferred display mode for the web application
95
+ */
96
+ display?: DisplayMode;
97
+ icons?: ManifestIcon[];
98
+ /**
99
+ * @see https://www.w3.org/TR/appmanifest/#orientation-member
100
+ *
101
+ * Serves as the default screen orientation for all top-level browsing contexts of the web application
102
+ */
103
+ orientation?: OrientationLockType;
104
+ /**
105
+ * @see https://www.w3.org/TR/appmanifest/#scope-member
106
+ *
107
+ * The navigation scope of this web application's application context.
108
+ */
109
+ scope?: string;
110
+ /**
111
+ * @see https://www.w3.org/TR/appmanifest/#start_url-member
112
+ *
113
+ * Start URL
114
+ */
115
+ start_url?: string;
116
+ /**
117
+ * @see https://www.w3.org/TR/appmanifest/#id-member
118
+ *
119
+ * Identity for the application
120
+ */
121
+ id?: string;
122
+ /**
123
+ * @see https://www.w3.org/TR/appmanifest/#theme_color-member
124
+ *
125
+ * Default theme color for an application context
126
+ */
127
+ theme_color?: string;
128
+ shortcuts?: ManifestShortCutItem[];
129
+ prefer_related_applications?: boolean;
130
+ related_applications?: ManifestExternalApplicationResource[];
131
+ description?: string;
132
+ categories?: ManifestCategory[];
133
+ screenshots?: ManifestImageResource[];
134
+ iarc_rating_id?: string;
135
+ features?: string[];
203
136
  }
204
-
137
+ //#endregion
138
+ //#region src/node/locales.d.ts
205
139
  /**
206
140
  * Default locale info for `@vuepress/plugin-pwa`
207
141
  */
208
142
  declare const pwaLocaleInfo: DefaultLocaleInfo<PwaPluginLocaleData>;
209
-
143
+ //#endregion
144
+ //#region src/node/options.d.ts
210
145
  interface ApplePwaOptions {
211
- /**
212
- * Path of icon used on apple devices
213
- *
214
- * Recommend 152×152 size
215
- *
216
- * 苹果上使用的图标路径
217
- *
218
- * 推荐 152×152 大小
219
- */
220
- icon?: string;
221
- /**
222
- * Safari mask icon
223
- *
224
- * Safari 图标
225
- */
226
- maskIcon?: string;
227
- /**
228
- * @deprecated Related tag is unstandardized so you should avoid declaring it.
229
- *
230
- * Color of status bar
231
- *
232
- * 状态栏的颜色
233
- *
234
- * @default "default"
235
- */
236
- statusBarColor?: 'black-translucent' | 'black' | 'default';
146
+ /**
147
+ * Path of icon used on apple devices
148
+ *
149
+ * Recommend 152×152 size
150
+ *
151
+ * 苹果上使用的图标路径
152
+ *
153
+ * 推荐 152×152 大小
154
+ */
155
+ icon?: string;
156
+ /**
157
+ * Safari mask icon
158
+ *
159
+ * Safari 图标
160
+ */
161
+ maskIcon?: string;
162
+ /**
163
+ * @deprecated Related tag is unstandardized so you should avoid declaring it.
164
+ *
165
+ * Color of status bar
166
+ *
167
+ * 状态栏的颜色
168
+ *
169
+ * @default "default"
170
+ */
171
+ statusBarColor?: 'black-translucent' | 'black' | 'default';
237
172
  }
238
173
  interface PwaPluginOptions {
239
- /**
240
- * Service Worker file path
241
- *
242
- * Service Worker 文件路径
243
- *
244
- * @default "service-worker.js"
245
- */
246
- serviceWorkerFilename?: string;
247
- /**
248
- * Whether display install button
249
- *
250
- * 是否显示安装按钮
251
- *
252
- * @default true
253
- */
254
- showInstall?: boolean;
255
- /**
256
- * Manifest file Config
257
- *
258
- * manifest 文件设置
259
- */
260
- manifest?: AppManifest;
261
- /**
262
- * Path of favicon
263
- *
264
- * favicon 地址
265
- */
266
- favicon?: string;
267
- /**
268
- * Theme Color
269
- *
270
- * 主题色
271
- *
272
- * @default "#46bd87"
273
- */
274
- themeColor?: string;
275
- /**
276
- * Max size which allows to cache, with KB unit
277
- *
278
- * 允许缓存的最大大小,单位 KB
279
- *
280
- * @default 2048
281
- */
282
- maxSize?: number;
283
- /**
284
- * Whether cache html files besides home page and 404
285
- *
286
- * 是否缓存除主页与 404 之外的 HTML
287
- *
288
- * @default false
289
- */
290
- cacheHTML?: boolean;
291
- /**
292
- * Whether cache pictures
293
- *
294
- * 是否缓存站点图片
295
- *
296
- * @default false
297
- */
298
- cacheImage?: boolean;
299
- /**
300
- * Max size which allows to cache, with KB unit
301
- *
302
- * 图片允许缓存的最大大小,单位 KB
303
- *
304
- * @default 1024
305
- */
306
- maxImageSize?: number;
307
- /**
308
- * Settings for apple
309
- *
310
- * 苹果设置
311
- */
312
- apple?: ApplePwaOptions | false;
313
- /**
314
- * Update logic
315
- *
316
- * - `"disable"`: Do nothing even when new service worker is available. After new service work succeeds installing and starts waiting, it will control page and provide new content in next visit.
317
- * - `"available"`: Only display update popup when the new service worker is available
318
- * - `"hint"`: Display a hint to let user choose to refresh immediately. This is helpful when you want users to see new docs immediately.
319
- * - `"force"`: unregister current service worker immediately then refresh to get new content. **This may affect visiting experiences**!
320
- *
321
- * 更新逻辑
322
- *
323
- * - `"disable"`: 即使有新的 service worker 也不做任何事情,新的 service work 开始等待后,会在用户下次访问时接管页面,让用户获得新内容。
324
- * - `"available"`: 仅当新的 service worker 可用时才显示更新弹出窗口
325
- * - `"hint"`: 显示更新内容可用提示,并允许用户立即刷新。当新的 SW 成功注册后,将转为更新内容就绪弹窗。当你希望用户立即查看新文档时,这很有帮助。
326
- * - `"force"`: 立即注销当前 Service Worker 然后刷新以获取新内容。**这可能会影响访问体验**!
327
- *
328
- * @default "available"
329
- */
330
- update?: 'available' | 'disable' | 'force' | 'hint';
331
- /**
332
- * A custom component to replace the default hint popup component.
333
- *
334
- * 用于替换默认提示弹出组件的自定义组件。
335
- *
336
- * @default "PwaFoundPopup"
337
- */
338
- foundComponent?: string;
339
- /**
340
- * A custom component to replace the default update popup component.
341
- *
342
- * 用于替换默认更新弹出组件的自定义组件。
343
- *
344
- * @default "PwaReadyPopup"
345
- */
346
- readyComponent?: string;
347
- /**
348
- * workbox-build’s [generateSW config](https://developers.google.com/web/tools/workbox/modules/workbox-build#full_generatesw_config)
349
- *
350
- */
351
- generateSWConfig?: Partial<GenerateSWOptions>;
352
- /**
353
- * Locales config
354
- *
355
- * 国际化配置
356
- */
357
- locales?: LocaleConfig<PwaPluginLocaleData>;
358
- /**
359
- * Whether append base to all absolute links in options
360
- *
361
- * 是否为选项中所有绝对链接添加 base
362
- *
363
- * @default false
364
- */
365
- appendBase?: boolean;
174
+ /**
175
+ * Service Worker file path
176
+ *
177
+ * Service Worker 文件路径
178
+ *
179
+ * @default "service-worker.js"
180
+ */
181
+ serviceWorkerFilename?: string;
182
+ /**
183
+ * Whether display install button
184
+ *
185
+ * 是否显示安装按钮
186
+ *
187
+ * @default true
188
+ */
189
+ showInstall?: boolean;
190
+ /**
191
+ * Manifest file Config
192
+ *
193
+ * manifest 文件设置
194
+ */
195
+ manifest?: AppManifest;
196
+ /**
197
+ * Path of favicon
198
+ *
199
+ * favicon 地址
200
+ */
201
+ favicon?: string;
202
+ /**
203
+ * Theme Color
204
+ *
205
+ * 主题色
206
+ *
207
+ * @default "#46bd87"
208
+ */
209
+ themeColor?: string;
210
+ /**
211
+ * Max size which allows to cache, with KB unit
212
+ *
213
+ * 允许缓存的最大大小,单位 KB
214
+ *
215
+ * @default 2048
216
+ */
217
+ maxSize?: number;
218
+ /**
219
+ * Whether cache html files besides home page and 404
220
+ *
221
+ * 是否缓存除主页与 404 之外的 HTML
222
+ *
223
+ * @default false
224
+ */
225
+ cacheHTML?: boolean;
226
+ /**
227
+ * Whether cache pictures
228
+ *
229
+ * 是否缓存站点图片
230
+ *
231
+ * @default false
232
+ */
233
+ cacheImage?: boolean;
234
+ /**
235
+ * Max size which allows to cache, with KB unit
236
+ *
237
+ * 图片允许缓存的最大大小,单位 KB
238
+ *
239
+ * @default 1024
240
+ */
241
+ maxImageSize?: number;
242
+ /**
243
+ * Settings for apple
244
+ *
245
+ * 苹果设置
246
+ */
247
+ apple?: ApplePwaOptions | false;
248
+ /**
249
+ * Update logic
250
+ *
251
+ * - `"disable"`: Do nothing even when new service worker is available. After new service work succeeds installing and starts waiting, it will control page and provide new content in next visit.
252
+ * - `"available"`: Only display update popup when the new service worker is available
253
+ * - `"hint"`: Display a hint to let user choose to refresh immediately. This is helpful when you want users to see new docs immediately.
254
+ * - `"force"`: unregister current service worker immediately then refresh to get new content. **This may affect visiting experiences**!
255
+ *
256
+ * 更新逻辑
257
+ *
258
+ * - `"disable"`: 即使有新的 service worker 也不做任何事情,新的 service work 开始等待后,会在用户下次访问时接管页面,让用户获得新内容。
259
+ * - `"available"`: 仅当新的 service worker 可用时才显示更新弹出窗口
260
+ * - `"hint"`: 显示更新内容可用提示,并允许用户立即刷新。当新的 SW 成功注册后,将转为更新内容就绪弹窗。当你希望用户立即查看新文档时,这很有帮助。
261
+ * - `"force"`: 立即注销当前 Service Worker 然后刷新以获取新内容。**这可能会影响访问体验**!
262
+ *
263
+ * @default "available"
264
+ */
265
+ update?: 'available' | 'disable' | 'force' | 'hint';
266
+ /**
267
+ * A custom component to replace the default hint popup component.
268
+ *
269
+ * 用于替换默认提示弹出组件的自定义组件。
270
+ *
271
+ * @default "PwaFoundPopup"
272
+ */
273
+ foundComponent?: string;
274
+ /**
275
+ * A custom component to replace the default update popup component.
276
+ *
277
+ * 用于替换默认更新弹出组件的自定义组件。
278
+ *
279
+ * @default "PwaReadyPopup"
280
+ */
281
+ readyComponent?: string;
282
+ /**
283
+ * workbox-build’s [generateSW config](https://developers.google.com/web/tools/workbox/modules/workbox-build#full_generatesw_config)
284
+ *
285
+ */
286
+ generateSWConfig?: Partial<GenerateSWOptions>;
287
+ /**
288
+ * Locales config
289
+ *
290
+ * 国际化配置
291
+ */
292
+ locales?: LocaleConfig<PwaPluginLocaleData>;
293
+ /**
294
+ * Whether append base to all absolute links in options
295
+ *
296
+ * 是否为选项中所有绝对链接添加 base
297
+ *
298
+ * @default false
299
+ */
300
+ appendBase?: boolean;
366
301
  }
367
-
302
+ //#endregion
303
+ //#region src/node/pwaPlugin.d.ts
368
304
  /**
369
305
  * PWA plugin
370
306
  *
@@ -391,6 +327,6 @@ interface PwaPluginOptions {
391
327
  * ```
392
328
  */
393
329
  declare const pwaPlugin: (options?: PwaPluginOptions) => PluginFunction;
394
-
395
- export { pwaLocaleInfo, pwaPlugin };
396
- export type { AppManifest, DisplayMode, ManifestCategory, ManifestExternalApplicationResource, ManifestIcon, ManifestImageResource, ManifestShortCutItem, OrientationLockType, PwaPluginLocaleData, PwaPluginOptions };
330
+ //#endregion
331
+ export { AppManifest, DisplayMode, ManifestCategory, ManifestExternalApplicationResource, ManifestIcon, ManifestImageResource, ManifestShortCutItem, OrientationLockType, PwaPluginLocaleData, PwaPluginOptions, pwaLocaleInfo, pwaPlugin };
332
+ //# sourceMappingURL=index.d.ts.map