@vuepress/plugin-pwa 2.0.0-rc.124 → 2.0.0-rc.126
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/{lib/client/components/PwaFoundPopup.d.ts → dist/PwaFoundPopup-B699MRU_.d.ts} +3 -6
- package/{lib/client/components/PwaInstall.d.ts → dist/PwaInstall-B7B9aSAb.d.ts} +3 -4
- package/dist/PwaInstall-D2rYRuV_.css +470 -0
- package/dist/PwaInstall-D2rYRuV_.js +3 -0
- package/dist/PwaInstall-D2rYRuV_.js.map +1 -0
- package/dist/PwaReadyPopup-Da6_dOG6.js +2 -0
- package/dist/PwaReadyPopup-Da6_dOG6.js.map +1 -0
- package/{lib/client/components/PwaReadyPopup.d.ts → dist/PwaReadyPopup-dyWv1jdP.d.ts} +3 -6
- package/dist/client/components/PwaFoundPopup.d.ts +2 -0
- package/dist/client/components/PwaFoundPopup.js +2 -0
- package/dist/client/components/PwaFoundPopup.js.map +1 -0
- package/dist/client/components/PwaInstall.d.ts +2 -0
- package/dist/client/components/PwaInstall.js +1 -0
- package/dist/client/components/PwaReadyPopup.d.ts +2 -0
- package/dist/client/components/PwaReadyPopup.js +1 -0
- package/dist/client/composables/index.js +1 -0
- package/{lib → dist}/client/index.d.ts +4 -4
- package/dist/client/index.js +2 -0
- package/{lib → dist}/client/index.js.map +1 -1
- package/dist/client/styles/vars.css +12 -0
- package/dist/composables-Bdxx2hts.js +2 -0
- package/dist/composables-Bdxx2hts.js.map +1 -0
- package/{lib/locales-BlsUewPq.d.ts → dist/locales-BzKyD3qP.d.ts} +1 -1
- package/{lib → dist}/node/index.d.ts +1 -1
- package/dist/node/index.js.map +1 -0
- package/dist/popup-AhQUNvCQ.css +57 -0
- package/{lib/types-CGDCqUfb.d.ts → dist/types-BLkMmayH.d.ts} +2 -2
- package/package.json +12 -12
- package/lib/PwaInstallModal-DH0cwyM5.js +0 -2
- package/lib/PwaInstallModal-DH0cwyM5.js.map +0 -1
- package/lib/client/components/PwaFoundPopup.js +0 -2
- package/lib/client/components/PwaFoundPopup.js.map +0 -1
- package/lib/client/components/PwaInstall.js +0 -2
- package/lib/client/components/PwaInstall.js.map +0 -1
- package/lib/client/components/PwaReadyPopup.js +0 -2
- package/lib/client/components/PwaReadyPopup.js.map +0 -1
- package/lib/client/composables/index.js +0 -1
- package/lib/client/index.js +0 -2
- package/lib/client/styles/modal.css +0 -1
- package/lib/client/styles/modal.css.map +0 -1
- package/lib/client/styles/popup.css +0 -1
- package/lib/client/styles/popup.css.map +0 -1
- package/lib/client/styles/vars.css +0 -1
- package/lib/client/styles/vars.css.map +0 -1
- package/lib/node/index.js.map +0 -1
- package/lib/setupViewPoint-DS4c13mS.js +0 -2
- package/lib/setupViewPoint-DS4c13mS.js.map +0 -1
- package/lib/skipWaiting-wM8NHpWa.js +0 -2
- package/lib/skipWaiting-wM8NHpWa.js.map +0 -1
- /package/{lib → dist}/client/composables/index.d.ts +0 -0
- /package/{lib → dist}/icons-RRw4DIWa.js +0 -0
- /package/{lib → dist}/icons-RRw4DIWa.js.map +0 -0
- /package/{lib → dist}/node/index.js +0 -0
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
import { t as PwaPluginLocaleConfig } from "
|
|
1
|
+
import { t as PwaPluginLocaleConfig } from "./types-BLkMmayH.js";
|
|
2
2
|
import { Slot } from "@vuepress/helper/client";
|
|
3
3
|
import * as vue from "vue";
|
|
4
4
|
import { PropType, SlotsType, VNode } from "vue";
|
|
5
|
-
import "@vuepress/helper/transition/fade-in-scale-up.css";
|
|
6
|
-
import "../styles/popup.css";
|
|
7
|
-
|
|
8
5
|
//#region src/client/components/PwaFoundPopup.d.ts
|
|
9
6
|
declare const PwaFoundPopup: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
10
7
|
/** locale data */locales: {
|
|
@@ -23,5 +20,5 @@ declare const PwaFoundPopup: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
|
23
20
|
}>;
|
|
24
21
|
}>, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
|
|
25
22
|
//#endregion
|
|
26
|
-
export { PwaFoundPopup };
|
|
27
|
-
//# sourceMappingURL=PwaFoundPopup.d.ts.map
|
|
23
|
+
export { PwaFoundPopup as t };
|
|
24
|
+
//# sourceMappingURL=PwaFoundPopup-B699MRU_.d.ts.map
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { t as PwaPluginLocaleConfig } from "
|
|
1
|
+
import { t as PwaPluginLocaleConfig } from "./types-BLkMmayH.js";
|
|
2
2
|
import * as vue from "vue";
|
|
3
3
|
import { PropType, VNode } from "vue";
|
|
4
|
-
import "../styles/modal.css";
|
|
5
4
|
|
|
6
5
|
//#region src/client/components/PwaInstall.d.ts
|
|
7
6
|
declare const PwaInstall: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
@@ -16,5 +15,5 @@ declare const PwaInstall: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
|
16
15
|
};
|
|
17
16
|
}>> & Readonly<{}>, {}, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
|
|
18
17
|
//#endregion
|
|
19
|
-
export { PwaInstall };
|
|
20
|
-
//# sourceMappingURL=PwaInstall.d.ts.map
|
|
18
|
+
export { PwaInstall as t };
|
|
19
|
+
//# sourceMappingURL=PwaInstall-B7B9aSAb.d.ts.map
|
|
@@ -0,0 +1,470 @@
|
|
|
1
|
+
@keyframes pwa-opened {
|
|
2
|
+
from {
|
|
3
|
+
opacity: .4;
|
|
4
|
+
transform: scale(.8);
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
to {
|
|
8
|
+
opacity: 1;
|
|
9
|
+
transform: scale(1);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
@keyframes pwa-mobile {
|
|
14
|
+
from {
|
|
15
|
+
opacity: .6;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
to {
|
|
19
|
+
opacity: 1;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@keyframes pwa-fade-in {
|
|
24
|
+
from {
|
|
25
|
+
opacity: .2;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
to {
|
|
29
|
+
opacity: 1;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.modal-button {
|
|
34
|
+
inset-inline-end: 1rem;
|
|
35
|
+
z-index: 50;
|
|
36
|
+
background: var(--pwa-c-accent-bg);
|
|
37
|
+
color: var(--pwa-c-accent-text);
|
|
38
|
+
cursor: pointer;
|
|
39
|
+
border-width: 0;
|
|
40
|
+
border-radius: 1.2rem;
|
|
41
|
+
outline: none;
|
|
42
|
+
padding: 0 16px;
|
|
43
|
+
font-weight: 600;
|
|
44
|
+
line-height: 2.2rem;
|
|
45
|
+
transition: background .3s, color .3s;
|
|
46
|
+
position: fixed;
|
|
47
|
+
bottom: 1rem;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
@media (display-mode: standalone) {
|
|
51
|
+
.modal-button {
|
|
52
|
+
display: none;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
@media print {
|
|
57
|
+
.modal-button {
|
|
58
|
+
display: none;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.modal-button:hover, .modal-button:active {
|
|
63
|
+
background: var(--pwa-c-accent-hover);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
#install-modal-wrapper {
|
|
67
|
+
inset-inline-start: 0;
|
|
68
|
+
z-index: 997;
|
|
69
|
+
justify-content: center;
|
|
70
|
+
align-items: center;
|
|
71
|
+
width: 100vw;
|
|
72
|
+
height: 100vh;
|
|
73
|
+
display: flex;
|
|
74
|
+
position: fixed;
|
|
75
|
+
top: 0;
|
|
76
|
+
overflow: auto;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
@media print {
|
|
80
|
+
#install-modal-wrapper {
|
|
81
|
+
display: none;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
#install-modal-wrapper button {
|
|
86
|
+
cursor: pointer;
|
|
87
|
+
background: none;
|
|
88
|
+
border-width: 0;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
#install-modal-wrapper .background {
|
|
92
|
+
z-index: 998;
|
|
93
|
+
-webkit-backdrop-filter: blur(10px);
|
|
94
|
+
backdrop-filter: blur(10px);
|
|
95
|
+
animation: .25s pwa-fade-in;
|
|
96
|
+
position: fixed;
|
|
97
|
+
inset: 0;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
#install-modal-wrapper .install-modal {
|
|
101
|
+
z-index: 999;
|
|
102
|
+
background: var(--pwa-c-bg);
|
|
103
|
+
border-radius: 10px;
|
|
104
|
+
flex-flow: column;
|
|
105
|
+
max-width: 56em;
|
|
106
|
+
transition: background .3s;
|
|
107
|
+
animation: .15s pwa-opened;
|
|
108
|
+
display: flex;
|
|
109
|
+
position: absolute;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
@media (max-width: 1280px) {
|
|
113
|
+
#install-modal-wrapper .install-modal {
|
|
114
|
+
width: 92%;
|
|
115
|
+
animation: .25s pwa-mobile;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
@media (max-width: 419px) {
|
|
120
|
+
#install-modal-wrapper .install-modal {
|
|
121
|
+
max-height: 80%;
|
|
122
|
+
overflow-y: auto;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
#install-modal-wrapper .install-modal::-webkit-scrollbar {
|
|
126
|
+
display: none;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
#install-modal-wrapper .header {
|
|
131
|
+
margin: 40px 40px 32px;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
@media (max-width: 959px) {
|
|
135
|
+
#install-modal-wrapper .header {
|
|
136
|
+
margin-bottom: 24px;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
@media (max-width: 719px) {
|
|
141
|
+
#install-modal-wrapper .header {
|
|
142
|
+
margin: 20px;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
#install-modal-wrapper .header .close-button {
|
|
147
|
+
float: right;
|
|
148
|
+
color: var(--pwa-c-text);
|
|
149
|
+
cursor: pointer;
|
|
150
|
+
background: none;
|
|
151
|
+
border-width: 0;
|
|
152
|
+
transition: color .3s;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
[dir="rtl"] #install-modal-wrapper .header .close-button {
|
|
156
|
+
float: left;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
#install-modal-wrapper .header .close-button:hover, #install-modal-wrapper .header .close-button:focus {
|
|
160
|
+
color: var(--pwa-c-text-mute);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
#install-modal-wrapper .header .logo {
|
|
164
|
+
display: flex;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
#install-modal-wrapper .header h1 {
|
|
168
|
+
color: var(--pwa-c-text-mute);
|
|
169
|
+
margin-top: 0;
|
|
170
|
+
margin-bottom: 7px;
|
|
171
|
+
font-size: 34px;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
@media (max-width: 959px) {
|
|
175
|
+
#install-modal-wrapper .header h1 {
|
|
176
|
+
margin-bottom: 0;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
@media (max-width: 419px) {
|
|
181
|
+
#install-modal-wrapper .header h1 {
|
|
182
|
+
font-size: 26px;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
#install-modal-wrapper .header img {
|
|
187
|
+
border-radius: 24px;
|
|
188
|
+
width: 122px;
|
|
189
|
+
height: 122px;
|
|
190
|
+
margin-inline-end: 24px;
|
|
191
|
+
padding: 12px;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
@media (max-width: 959px) {
|
|
195
|
+
#install-modal-wrapper .header img {
|
|
196
|
+
width: 60px;
|
|
197
|
+
height: 60px;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
@media (max-width: 719px) {
|
|
202
|
+
#install-modal-wrapper .header img {
|
|
203
|
+
margin-inline-end: 12px;
|
|
204
|
+
padding: 8px;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
@media (max-width: 419px) {
|
|
209
|
+
#install-modal-wrapper .header img {
|
|
210
|
+
width: 40px;
|
|
211
|
+
height: 40px;
|
|
212
|
+
padding: 6px;
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
#install-modal-wrapper .header .desc {
|
|
217
|
+
color: #888;
|
|
218
|
+
text-overflow: ellipsis;
|
|
219
|
+
white-space: pre-wrap;
|
|
220
|
+
max-width: 40em;
|
|
221
|
+
font-size: 14px;
|
|
222
|
+
overflow: hidden;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
@media (max-width: 959px) {
|
|
226
|
+
#install-modal-wrapper .header .desc {
|
|
227
|
+
display: none;
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
#install-modal-wrapper .content {
|
|
232
|
+
color: var(--pwa-c-text);
|
|
233
|
+
flex: 1;
|
|
234
|
+
margin: 0 40px;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
@media (max-width: 719px) {
|
|
238
|
+
#install-modal-wrapper .content {
|
|
239
|
+
margin: 0 20px;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
#install-modal-wrapper .content h3 {
|
|
244
|
+
margin-bottom: 12px;
|
|
245
|
+
font-size: 22px;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
#install-modal-wrapper .content p {
|
|
249
|
+
font-size: 14px;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
#install-modal-wrapper .highlight {
|
|
253
|
+
justify-content: space-around;
|
|
254
|
+
align-items: center;
|
|
255
|
+
margin-inline-end: 20px;
|
|
256
|
+
display: flex;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
@media (max-width: 719px) {
|
|
260
|
+
#install-modal-wrapper .highlight {
|
|
261
|
+
flex-flow: column;
|
|
262
|
+
align-items: flex-start;
|
|
263
|
+
margin-inline-end: 0;
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
#install-modal-wrapper .highlight h3 {
|
|
268
|
+
margin-top: 0;
|
|
269
|
+
font-size: 22px;
|
|
270
|
+
font-weight: 600;
|
|
271
|
+
line-height: 225%;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
@media (max-width: 419px) {
|
|
275
|
+
#install-modal-wrapper .highlight h3 {
|
|
276
|
+
margin-bottom: 0;
|
|
277
|
+
font-size: 18px;
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
#install-modal-wrapper .feature-wrapper {
|
|
282
|
+
padding-inline-end: 2em;
|
|
283
|
+
overflow: hidden;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
#install-modal-wrapper .feature-wrapper ul {
|
|
287
|
+
margin-block-start: 12px;
|
|
288
|
+
padding-inline-start: 22px;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
@media (max-width: 419px) {
|
|
292
|
+
#install-modal-wrapper .feature-wrapper ul {
|
|
293
|
+
margin-top: 0;
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
#install-modal-wrapper .feature-wrapper li {
|
|
298
|
+
color: var(--pwa-c-text-mute);
|
|
299
|
+
font-size: 16px;
|
|
300
|
+
font-weight: 600;
|
|
301
|
+
line-height: 29px;
|
|
302
|
+
transition: color .3s;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
#install-modal-wrapper .screenshot-wrapper {
|
|
306
|
+
max-width: 30em;
|
|
307
|
+
max-height: 220px;
|
|
308
|
+
display: flex;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
@media (max-width: 719px) {
|
|
312
|
+
#install-modal-wrapper .screenshot-wrapper {
|
|
313
|
+
width: 100%;
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
#install-modal-wrapper .screenshot-wrapper button {
|
|
318
|
+
cursor: pointer;
|
|
319
|
+
background: none;
|
|
320
|
+
border-width: 0;
|
|
321
|
+
width: 4em;
|
|
322
|
+
transition: background .3s;
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
#install-modal-wrapper .screenshot-wrapper button:hover, #install-modal-wrapper .screenshot-wrapper button:focus {
|
|
326
|
+
background: #bbb;
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
#install-modal-wrapper .screenshot-wrapper button svg {
|
|
330
|
+
fill: #6b6969;
|
|
331
|
+
width: 28px;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
#install-modal-wrapper .screenshot {
|
|
335
|
+
scroll-snap-type: x mandatory;
|
|
336
|
+
-webkit-overflow-scrolling: touch;
|
|
337
|
+
flex-flow: column wrap;
|
|
338
|
+
width: 22em;
|
|
339
|
+
max-height: 220px;
|
|
340
|
+
display: flex;
|
|
341
|
+
overflow-x: auto;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
@media (max-width: 1280px) {
|
|
345
|
+
#install-modal-wrapper .screenshot {
|
|
346
|
+
justify-content: center;
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
#install-modal-wrapper .screenshot::-webkit-scrollbar {
|
|
351
|
+
display: none;
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
#install-modal-wrapper .screenshot div {
|
|
355
|
+
scroll-snap-align: start;
|
|
356
|
+
background: #efefef;
|
|
357
|
+
justify-content: center;
|
|
358
|
+
align-items: center;
|
|
359
|
+
width: 100%;
|
|
360
|
+
height: 14em;
|
|
361
|
+
display: flex;
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
#install-modal-wrapper .screenshot img {
|
|
365
|
+
object-fit: contain;
|
|
366
|
+
height: 100%;
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
@media (max-width: 719px) {
|
|
370
|
+
#install-modal-wrapper .screenshot img {
|
|
371
|
+
height: 180px;
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
#install-modal-wrapper .description {
|
|
376
|
+
margin-bottom: 3em;
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
#install-modal-wrapper .button-wrapper {
|
|
380
|
+
text-align: end;
|
|
381
|
+
width: 100%;
|
|
382
|
+
padding: 1rem 0;
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
@media (max-width: 719px) {
|
|
386
|
+
#install-modal-wrapper .button-wrapper {
|
|
387
|
+
text-align: center;
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
#install-modal-wrapper .install-button, #install-modal-wrapper .cancel-button {
|
|
392
|
+
cursor: pointer;
|
|
393
|
+
background: none;
|
|
394
|
+
border-radius: 20px;
|
|
395
|
+
flex: none;
|
|
396
|
+
min-width: 80px;
|
|
397
|
+
margin: .5rem 1rem;
|
|
398
|
+
padding: .5rem 1rem;
|
|
399
|
+
font-size: 14px;
|
|
400
|
+
font-weight: 600;
|
|
401
|
+
display: inline-block;
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
#install-modal-wrapper .install-button {
|
|
405
|
+
background: var(--pwa-c-accent-bg);
|
|
406
|
+
color: var(--pwa-c-accent-text);
|
|
407
|
+
transition: color .3s;
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
#install-modal-wrapper .install-button:hover, #install-modal-wrapper .install-button:focus {
|
|
411
|
+
background: var(--pwa-c-accent-hover);
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
@media (max-width: 419px) {
|
|
415
|
+
#install-modal-wrapper .install-button span {
|
|
416
|
+
display: none;
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
#install-modal-wrapper .cancel-button {
|
|
421
|
+
background: var(--pwa-c-control);
|
|
422
|
+
color: var(--pwa-c-text);
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
#install-modal-wrapper .cancel-button:hover, #install-modal-wrapper .cancel-button:focus {
|
|
426
|
+
background: var(--pwa-c-control-hover);
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
#install-modal-wrapper .ios-text {
|
|
430
|
+
box-sizing: border-box;
|
|
431
|
+
background: var(--pwa-c-bg);
|
|
432
|
+
width: 92%;
|
|
433
|
+
box-shadow: 0 2px 12px 0 var(--pwa-c-shadow);
|
|
434
|
+
text-align: center;
|
|
435
|
+
border-radius: 8px;
|
|
436
|
+
margin: 2em auto;
|
|
437
|
+
padding: .5em 2em;
|
|
438
|
+
font-size: 14px;
|
|
439
|
+
font-weight: bold;
|
|
440
|
+
transition: background .3s, box-shadow .3s;
|
|
441
|
+
position: fixed;
|
|
442
|
+
bottom: 0;
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
#install-modal-wrapper .ios-text:after {
|
|
446
|
+
content: " ";
|
|
447
|
+
inset-inline-start: calc(50% - .8em);
|
|
448
|
+
border-inline: .8em solid #0000;
|
|
449
|
+
border-top: 1em solid var(--pwa-c-bg);
|
|
450
|
+
width: 0;
|
|
451
|
+
height: 0;
|
|
452
|
+
transition: border-color .3s;
|
|
453
|
+
position: absolute;
|
|
454
|
+
bottom: -1em;
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
#install-modal-wrapper .ios-text p {
|
|
458
|
+
margin: 0 0 .5em;
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
#install-modal-wrapper .ios-text .success {
|
|
462
|
+
color: var(--pwa-c-bg);
|
|
463
|
+
cursor: pointer;
|
|
464
|
+
background: #07c160;
|
|
465
|
+
border: none;
|
|
466
|
+
border-radius: 1em;
|
|
467
|
+
margin-bottom: .5em;
|
|
468
|
+
padding: .5em 1em;
|
|
469
|
+
transition: color .3s;
|
|
470
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import './PwaInstall-D2rYRuV_.css';
|
|
2
|
+
import{n as e,r as t,t as n}from"./icons-RRw4DIWa.js";import{useLocale as r}from"@vuepress/helper/client";import{useEventListener as i,useToggle as a}from"@vueuse/core";import{computed as o,defineComponent as s,h as c,onMounted as l,ref as u,shallowRef as d}from"vue";import{withBase as f}from"vuepress/client";const p=()=>{let e=document.querySelector(`.screenshot`);e&&e.scrollBy({left:-e.clientWidth,top:0,behavior:`smooth`})},m=()=>{let e=document.querySelector(`.screenshot`);e&&e.scrollBy({left:e.clientWidth,top:0,behavior:`smooth`})},h=s({name:`PwaInstallModal`,props:{locales:{type:Object,required:!0},useHint:Boolean},emits:[`canInstall`,`hint`,`close`],setup(a,{emit:o}){let s=r(a.locales),u=d({}),h=d(),g=async()=>{let e=localStorage.getItem(`manifest`);if(e)u.value=JSON.parse(e);else try{let e=await(await fetch(f(`manifest.webmanifest`))).json();u.value=e,localStorage.setItem(`manifest`,JSON.stringify(e))}catch{console.error(`[PWA]: Error getting manifest, check that you have a valid web manifest or network connection`)}},_=async()=>{h.value&&(h.value.prompt(),document.dispatchEvent(new CustomEvent(`show`)),(await h.value.userChoice).outcome===`accepted`?(console.info(`PWA has been installed`),o(`close`,!1),o(`canInstall`,!1)):(console.info(`You choose to not install PWA`),o(`close`,!1),o(`canInstall`,!1)))},v=()=>{console.info(`You accepted the install hint`),o(`hint`)};return l(()=>{window.hasOwnProperty(`BeforeInstallPromptEvent`)&&(i(window,`beforeinstallprompt`,e=>{h.value=e,o(`canInstall`,!0),e.preventDefault()}),i(`keyup`,e=>{e.key===`Escape`&&o(`close`,!1)},{passive:!0}),g())}),()=>c(`div`,{id:`install-modal-wrapper`},[c(`div`,{class:`background`,onClick:()=>{o(`close`,!1)}}),c(`div`,{class:`install-modal`},[c(`div`,{class:`header`},[c(`button`,{type:`button`,class:`close-button`,"aria-label":s.value.close,onClick:()=>{o(`close`,!1)}},c(t)),c(`div`,{class:`logo`},[u.value.icons?c(`img`,{src:u.value.icons[0]?.src,alt:`App Logo`}):null,c(`div`,{class:`title`},[c(`h1`,u.value.short_name||u.value.name),c(`p`,{class:`desc`},s.value.explain)])])]),c(`div`,{class:`content`},[c(`div`,{class:`highlight`},[u.value.features?c(`div`,{class:`feature-wrapper`},[c(`h3`,s.value.feature),c(`ul`,u.value.features.map(e=>c(`li`,e)))]):null,u.value.screenshots?c(`div`,{class:`screenshot-wrapper`},[c(`button`,{type:`button`,"aria-label":s.value.prevImage,onClick:p},c(n)),c(`section`,{class:`screenshot`},[u.value.screenshots.map(e=>c(`div`,c(`img`,{src:e.src,alt:`App Screenshot`})))]),c(`button`,{type:`button`,"aria-label":s.value.nextImage,onClick:m},c(e))]):null]),c(`div`,{class:`description`},[c(`h3`,s.value.desc),c(`p`,u.value.description)])]),a.useHint?c(`div`,{class:`ios-text`,onClick:v},[c(`p`,s.value.iOSInstall),c(`button`,{type:`button`,class:`success`},`Got it!`)]):c(`div`,{class:`button-wrapper`},[c(`button`,{type:`button`,class:`install-button`,onClick:_},[s.value.install,c(`span`,u.value.short_name)]),c(`button`,{type:`button`,class:`cancel-button`,onClick:()=>{o(`close`,!1)}},s.value.cancel)])])])}}),g=s({name:`PwaInstall`,props:{locales:{type:Object,required:!0}},setup(e){let t=r(e.locales),[n,i]=a(),s=u(!1),d=u(!1),f=u(!1),p=u(!1),m=u(!1),g=o(()=>f.value&&p.value&&!m.value),_=o(()=>d.value&&s.value||g.value),v=()=>navigator.standalone?navigator.standalone:matchMedia(`(display-mode: standalone)`).matches,y=()=>{i(!1),m.value=!0,localStorage.setItem(`iOS-pwa-hint`,`hinted`)};return l(()=>{if(v()){let{userAgent:e}=navigator;f.value=e.includes(`iPhone`)||e.includes(`iPad`)||!!(e.includes(`Macintosh`)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>2),p.value=navigator.userAgent.includes(`Safari`)&&!e.includes(`Chrome`),m.value=!!localStorage.getItem(`iOS-pwa-hint`)}`getInstalledRelatedApps`in navigator&&navigator.getInstalledRelatedApps().then(e=>{d.value=e.length>0})}),()=>c(`div`,{id:`pwa-install`},[_.value?c(`button`,{type:`button`,class:`modal-button`,onClick:()=>{i(!0)}},t.value.install):null,c(h,{style:{display:n.value?`block`:`none`},locales:e.locales,useHint:g.value,onCanInstall:e=>{s.value=e},onHint:()=>{y()},onClose:()=>i(!1)})])}});export{g as t};
|
|
3
|
+
//# sourceMappingURL=PwaInstall-D2rYRuV_.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PwaInstall-D2rYRuV_.js","names":[],"sources":["../src/client/components/PwaInstallModal.ts","../src/client/components/PwaInstall.ts"],"sourcesContent":["/* eslint-disable no-console */\nimport { useLocale } from '@vuepress/helper/client'\nimport { useEventListener } from '@vueuse/core'\nimport type { PropType, VNode } from 'vue'\nimport { defineComponent, h, onMounted, shallowRef } from 'vue'\nimport { withBase } from 'vuepress/client'\n\nimport type { AppManifest } from '../../shared/index.js'\nimport type { PwaPluginLocaleConfig } from '../types.js'\nimport { ArrowLeftIcon, ArrowRightIcon, CloseIcon } from './icons.js'\n\ninterface InstallPromptEvent extends Event {\n readonly platforms: string\n prompt: () => void\n readonly userChoice: Promise<{ outcome: 'accepted' | 'dismissed' }>\n}\n\nconst scrollToLeft = (): void => {\n const screenshotsDiv = document.querySelector('.screenshot')\n\n if (screenshotsDiv) {\n screenshotsDiv.scrollBy({\n left: -screenshotsDiv.clientWidth,\n top: 0,\n behavior: 'smooth',\n })\n }\n}\n\nconst scrollToRight = (): void => {\n const screenshotsDiv = document.querySelector('.screenshot')\n\n if (screenshotsDiv) {\n screenshotsDiv.scrollBy({\n left: screenshotsDiv.clientWidth,\n top: 0,\n behavior: 'smooth',\n })\n }\n}\n\nexport const PwaInstallModal = defineComponent({\n name: 'PwaInstallModal',\n\n props: {\n /** locale data */\n locales: {\n type: Object as PropType<PwaPluginLocaleConfig>,\n required: true,\n },\n\n /**\n * Whether use hint message instead of showing a button\n *\n * 是否使用提示\n */\n useHint: Boolean,\n },\n\n emits: ['canInstall', 'hint', 'close'],\n\n setup(props, { emit }) {\n const locale = useLocale(props.locales)\n\n const manifest = shallowRef<AppManifest>({})\n const deferredPrompt = shallowRef<InstallPromptEvent>()\n\n const getManifest = async (): Promise<void> => {\n const manifestContent = localStorage.getItem('manifest')\n\n if (manifestContent) {\n manifest.value = JSON.parse(manifestContent) as AppManifest\n } else {\n try {\n const response = await fetch(withBase('manifest.webmanifest'))\n const data = (await response.json()) as AppManifest\n\n manifest.value = data\n localStorage.setItem('manifest', JSON.stringify(data))\n } catch {\n console.error(\n '[PWA]: Error getting manifest, check that you have a valid web manifest or network connection',\n )\n }\n }\n }\n\n const install = async (): Promise<void> => {\n if (deferredPrompt.value) {\n deferredPrompt.value.prompt()\n\n document.dispatchEvent(new CustomEvent('show'))\n\n const choiceResult = await deferredPrompt.value.userChoice\n\n if (choiceResult.outcome === 'accepted') {\n console.info('PWA has been installed')\n\n emit('close', false)\n emit('canInstall', false)\n } else {\n console.info('You choose to not install PWA')\n\n emit('close', false)\n emit('canInstall', false)\n }\n }\n }\n\n const hint = (): void => {\n console.info('You accepted the install hint')\n emit('hint')\n }\n\n onMounted(() => {\n // eslint-disable-next-line no-prototype-builtins\n if (window.hasOwnProperty('BeforeInstallPromptEvent')) {\n useEventListener(window, 'beforeinstallprompt', (event) => {\n deferredPrompt.value = event as InstallPromptEvent\n\n emit('canInstall', true)\n event.preventDefault()\n })\n\n useEventListener(\n 'keyup',\n (event): void => {\n if (event.key === 'Escape') emit('close', false)\n },\n { passive: true },\n )\n\n void getManifest()\n }\n })\n\n return (): VNode =>\n h('div', { id: 'install-modal-wrapper' }, [\n h('div', {\n class: 'background',\n onClick: () => {\n emit('close', false)\n },\n }),\n\n h('div', { class: 'install-modal' }, [\n h('div', { class: 'header' }, [\n // close button\n h(\n 'button',\n {\n 'type': 'button',\n 'class': 'close-button',\n 'aria-label': locale.value.close,\n 'onClick': () => {\n emit('close', false)\n },\n },\n h(CloseIcon),\n ),\n\n h('div', { class: 'logo' }, [\n manifest.value.icons\n ? h('img', {\n src: manifest.value.icons[0]?.src,\n alt: 'App Logo',\n })\n : null,\n h('div', { class: 'title' }, [\n h('h1', manifest.value.short_name || manifest.value.name),\n h('p', { class: 'desc' }, locale.value.explain),\n ]),\n ]),\n ]),\n\n h('div', { class: 'content' }, [\n h('div', { class: 'highlight' }, [\n manifest.value.features\n ? h('div', { class: 'feature-wrapper' }, [\n h('h3', locale.value.feature),\n h(\n 'ul',\n manifest.value.features.map((feature) =>\n h('li', feature),\n ),\n ),\n ])\n : null,\n\n manifest.value.screenshots\n ? h('div', { class: 'screenshot-wrapper' }, [\n h(\n 'button',\n {\n 'type': 'button',\n 'aria-label': locale.value.prevImage,\n 'onClick': scrollToLeft,\n },\n h(ArrowLeftIcon),\n ),\n h('section', { class: 'screenshot' }, [\n manifest.value.screenshots.map((screenshot) =>\n h(\n 'div',\n h('img', {\n src: screenshot.src,\n alt: 'App Screenshot',\n }),\n ),\n ),\n ]),\n h(\n 'button',\n {\n 'type': 'button',\n 'aria-label': locale.value.nextImage,\n 'onClick': scrollToRight,\n },\n h(ArrowRightIcon),\n ),\n ])\n : null,\n ]),\n\n h('div', { class: 'description' }, [\n h('h3', locale.value.desc),\n h('p', manifest.value.description),\n ]),\n ]),\n\n props.useHint\n ? h('div', { class: 'ios-text', onClick: hint }, [\n h('p', locale.value.iOSInstall),\n h('button', { type: 'button', class: 'success' }, 'Got it!'),\n ])\n : h('div', { class: 'button-wrapper' }, [\n h(\n 'button',\n { type: 'button', class: 'install-button', onClick: install },\n [locale.value.install, h('span', manifest.value.short_name)],\n ),\n h(\n 'button',\n {\n type: 'button',\n class: 'cancel-button',\n onClick: () => {\n emit('close', false)\n },\n },\n locale.value.cancel,\n ),\n ]),\n ]),\n ])\n },\n})\n","import { useLocale } from '@vuepress/helper/client'\nimport { useToggle } from '@vueuse/core'\nimport type { PropType, VNode } from 'vue'\nimport { computed, defineComponent, h, onMounted, ref } from 'vue'\n\nimport type { ManifestExternalApplicationResource } from '../../shared/index.js'\nimport type { PwaPluginLocaleConfig } from '../types.js'\nimport { PwaInstallModal } from './PwaInstallModal.js'\n\nimport '../styles/modal.scss'\n\ninterface ModernNavigator extends Navigator {\n // Nonstandard Api\n getInstalledRelatedApps: () => Promise<ManifestExternalApplicationResource[]>\n}\n\ninterface SafariNavigator extends Navigator {\n // Available on Apple’s iOS Safari only.\n standalone: boolean\n}\n\nexport const PwaInstall = defineComponent({\n name: 'PwaInstall',\n\n props: {\n /** locale data */\n locales: {\n type: Object as PropType<PwaPluginLocaleConfig>,\n required: true,\n },\n },\n\n setup(props) {\n const locale = useLocale(props.locales)\n const [isOpen, toggleIsOpen] = useToggle()\n\n const canInstall = ref(false)\n const hasRelatedApps = ref(false)\n const isIOS = ref(false)\n const isSafari = ref(false)\n const hinted = ref(false)\n\n const useHint = computed(\n () => isIOS.value && isSafari.value && !hinted.value,\n )\n\n const showInstall = computed(\n () => (hasRelatedApps.value && canInstall.value) || useHint.value,\n )\n\n const getInstallStatus = (): boolean => {\n if ((navigator as SafariNavigator).standalone)\n return (navigator as SafariNavigator).standalone\n\n return matchMedia('(display-mode: standalone)').matches\n }\n\n const hint = (): void => {\n toggleIsOpen(false)\n hinted.value = true\n // do not notify again\n localStorage.setItem('iOS-pwa-hint', 'hinted')\n }\n\n onMounted(() => {\n if (getInstallStatus()) {\n const { userAgent } = navigator\n\n // handle iOS specifically\n isIOS.value =\n // regular iPhone\n userAgent.includes('iPhone') ||\n // regular iPad\n userAgent.includes('iPad') ||\n // iPad pro\n Boolean(\n userAgent.includes('Macintosh') &&\n navigator.maxTouchPoints &&\n navigator.maxTouchPoints > 2,\n )\n\n isSafari.value =\n navigator.userAgent.includes('Safari') &&\n !userAgent.includes('Chrome')\n\n hinted.value = Boolean(localStorage.getItem('iOS-pwa-hint'))\n }\n\n if ('getInstalledRelatedApps' in (navigator as ModernNavigator)) {\n void (navigator as ModernNavigator)\n .getInstalledRelatedApps()\n .then((result) => {\n hasRelatedApps.value = result.length > 0\n })\n }\n })\n\n return (): VNode =>\n h('div', { id: 'pwa-install' }, [\n showInstall.value\n ? h(\n 'button',\n {\n type: 'button',\n class: 'modal-button',\n onClick: () => {\n toggleIsOpen(true)\n },\n },\n locale.value.install,\n )\n : null,\n h(PwaInstallModal, {\n style: {\n display: isOpen.value ? 'block' : 'none',\n },\n locales: props.locales,\n useHint: useHint.value,\n onCanInstall: (value: boolean) => {\n canInstall.value = value\n },\n onHint: () => {\n hint()\n },\n onClose: () => toggleIsOpen(false),\n }),\n ])\n },\n})\n"],"mappings":"uTAiBA,MAAM,MAA2B,CAC/B,IAAM,EAAiB,SAAS,cAAc,cAAc,CAExD,GACF,EAAe,SAAS,CACtB,KAAM,CAAC,EAAe,YACtB,IAAK,EACL,SAAU,SACX,CAAC,EAIA,MAA4B,CAChC,IAAM,EAAiB,SAAS,cAAc,cAAc,CAExD,GACF,EAAe,SAAS,CACtB,KAAM,EAAe,YACrB,IAAK,EACL,SAAU,SACX,CAAC,EAIO,EAAkB,EAAgB,CAC7C,KAAM,kBAEN,MAAO,CAEL,QAAS,CACP,KAAM,OACN,SAAU,GACX,CAOD,QAAS,QACV,CAED,MAAO,CAAC,aAAc,OAAQ,QAAQ,CAEtC,MAAM,EAAO,CAAE,QAAQ,CACrB,IAAM,EAAS,EAAU,EAAM,QAAQ,CAEjC,EAAW,EAAwB,EAAE,CAAC,CACtC,EAAiB,GAAgC,CAEjD,EAAc,SAA2B,CAC7C,IAAM,EAAkB,aAAa,QAAQ,WAAW,CAExD,GAAI,EACF,EAAS,MAAQ,KAAK,MAAM,EAAgB,MAE5C,GAAI,CAEF,IAAM,EAAQ,MADG,MAAM,MAAM,EAAS,uBAAuB,CAAC,EACjC,MAAM,CAEnC,EAAS,MAAQ,EACjB,aAAa,QAAQ,WAAY,KAAK,UAAU,EAAK,CAAC,MAChD,CACN,QAAQ,MACN,gGACD,GAKD,EAAU,S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eACP,YAAe,CACb,EAAa,GAAK,EAErB,CACD,EAAO,MAAM,QACd,CACD,KACJ,EAAE,EAAiB,CACjB,MAAO,CACL,QAAS,EAAO,MAAQ,QAAU,OACnC,CACD,QAAS,EAAM,QACf,QAAS,EAAQ,MACjB,aAAe,GAAmB,CAChC,EAAW,MAAQ,GAErB,WAAc,CACZ,GAAM,EAER,YAAe,EAAa,GAAM,CACnC,CAAC,CACH,CAAC,EAEP,CAAC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{i as e}from"./icons-RRw4DIWa.js";import{a as t}from"./composables-Bdxx2hts.js";import"./popup-AhQUNvCQ.css";import{useLocale as n}from"@vuepress/helper/client";import{Transition as r,computed as i,defineComponent as a,h as o,onMounted as s,shallowRef as c}from"vue";import"@vuepress/helper/transition/fade-in-scale-up.css";const l=e=>{let t=e.waiting;if(!t)return;let n=new MessageChannel;t.postMessage({type:`SKIP_WAITING`},[n.port2])},u=a({name:`PwaReadyPopup`,props:{locales:{type:Object,required:!0}},slots:Object,setup(a,{slots:u}){let d=n(a.locales),f=c(),p=i(()=>!!f.value),m=()=>{f.value&&=(l(f.value),void 0)};return s(()=>{t().on(`updated`,e=>{f.value=e})}),()=>o(r,{name:`fade-in-scale-up`},()=>u.default?.({isReady:p.value,reload:m})??(p.value?o(`button`,{type:`button`,class:`sw-update-popup`,tabindex:0,onClick:()=>{m()}},[d.value.update,o(`span`,{class:`icon-wrapper`},o(e))]):null))}});export{l as n,u as t};
|
|
2
|
+
//# sourceMappingURL=PwaReadyPopup-Da6_dOG6.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PwaReadyPopup-Da6_dOG6.js","names":[],"sources":["../src/client/utils/skipWaiting.ts","../src/client/components/PwaReadyPopup.ts"],"sourcesContent":["/**\n * Call `skipWaiting()` inside current waiting worker\n *\n * 在当前等待中的 Service Worker 中调用 `skipWaiting()`\n *\n * @param registration - The registration of the service worker you want activate / 想要激活的 Service Worker 的注册\n */\nexport const skipWaiting = (registration: ServiceWorkerRegistration): void => {\n // Get the waiting worker\n const worker = registration.waiting\n\n // If there is no waiting worker, return directly\n if (!worker) return\n\n // Post SKIP_WAITING message to the waiting worker\n const channel = new MessageChannel()\n\n worker.postMessage({ type: 'SKIP_WAITING' }, [channel.port2])\n}\n","import type { Slot } from '@vuepress/helper/client'\nimport { useLocale } from '@vuepress/helper/client'\nimport type { PropType, SlotsType, VNode } from 'vue'\nimport {\n Transition,\n computed,\n defineComponent,\n h,\n onMounted,\n shallowRef,\n} from 'vue'\n\nimport { usePwaEvent } from '../composables/index.js'\nimport type { PwaPluginLocaleConfig } from '../types.js'\nimport { skipWaiting } from '../utils/index.js'\nimport { UpdateIcon } from './icons.js'\n\nimport '@vuepress/helper/transition/fade-in-scale-up.css'\nimport '../styles/popup.scss'\n\nexport const PwaReadyPopup = defineComponent({\n name: 'PwaReadyPopup',\n\n props: {\n /** locale data */\n locales: {\n type: Object as PropType<PwaPluginLocaleConfig>,\n required: true,\n },\n },\n\n slots: Object as SlotsType<{\n default?: Slot<{ isReady: boolean; reload: () => void }>\n }>,\n\n setup(props, { slots }) {\n const locale = useLocale(props.locales)\n const registration = shallowRef<ServiceWorkerRegistration>()\n\n const isReady = computed(() => Boolean(registration.value))\n\n const reload = (): void => {\n if (registration.value) {\n skipWaiting(registration.value)\n registration.value = undefined\n }\n }\n\n onMounted(() => {\n const event = usePwaEvent()\n\n event.on('updated', (reg) => {\n registration.value = reg\n })\n })\n\n return (): VNode =>\n h(\n Transition,\n { name: 'fade-in-scale-up' },\n () =>\n slots.default?.({\n isReady: isReady.value,\n reload,\n }) ??\n (isReady.value\n ? h(\n 'button',\n {\n type: 'button',\n class: 'sw-update-popup',\n tabindex: 0,\n onClick: () => {\n reload()\n },\n },\n [\n locale.value.update,\n h('span', { class: 'icon-wrapper' }, h(UpdateIcon)),\n ],\n )\n : null),\n )\n },\n})\n"],"mappings":"yUAOA,MAAa,EAAe,GAAkD,CAE5E,IAAM,EAAS,EAAa,QAG5B,GAAI,CAAC,EAAQ,OAGb,IAAM,EAAU,IAAI,eAEpB,EAAO,YAAY,CAAE,KAAM,eAAgB,CAAE,CAAC,EAAQ,MAAM,CAAC,ECGlD,EAAgB,EAAgB,CAC3C,KAAM,gBAEN,MAAO,CAEL,QAAS,CACP,KAAM,OACN,SAAU,GACX,CACF,CAED,MAAO,OAIP,MAAM,EAAO,CAAE,SAAS,CACtB,IAAM,EAAS,EAAU,EAAM,QAAQ,CACjC,EAAe,GAAuC,CAEtD,EAAU,MAAe,EAAQ,EAAa,MAAO,CAErD,MAAqB,CACzB,AAEE,EAAa,SADb,EAAY,EAAa,MAAM,CACV,IAAA,KAYzB,OARA,MAAgB,CACA,GAAa,CAErB,GAAG,UAAY,GAAQ,CAC3B,EAAa,MAAQ,GACrB,EACF,KAGA,EACE,EACA,CAAE,KAAM,mBAAoB,KAE1B,EAAM,UAAU,CACd,QAAS,EAAQ,MACjB,SACD,CAAC,GACD,EAAQ,MACL,EACE,SACA,CACE,KAAM,SACN,MAAO,kBACP,SAAU,EACV,YAAe,CACb,GAAQ,EAEX,CACD,CACE,EAAO,MAAM,OACb,EAAE,OAAQ,CAAE,MAAO,eAAgB,CAAE,EAAE,EAAW,CAAC,CACpD,CACF,CACD,MACP,EAEN,CAAC"}
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
import { t as PwaPluginLocaleConfig } from "
|
|
1
|
+
import { t as PwaPluginLocaleConfig } from "./types-BLkMmayH.js";
|
|
2
2
|
import { Slot } from "@vuepress/helper/client";
|
|
3
3
|
import * as vue from "vue";
|
|
4
4
|
import { PropType, SlotsType, VNode } from "vue";
|
|
5
|
-
import "@vuepress/helper/transition/fade-in-scale-up.css";
|
|
6
|
-
import "../styles/popup.css";
|
|
7
|
-
|
|
8
5
|
//#region src/client/components/PwaReadyPopup.d.ts
|
|
9
6
|
declare const PwaReadyPopup: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
10
7
|
/** locale data */locales: {
|
|
@@ -23,5 +20,5 @@ declare const PwaReadyPopup: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
|
23
20
|
}>;
|
|
24
21
|
}>, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
|
|
25
22
|
//#endregion
|
|
26
|
-
export { PwaReadyPopup };
|
|
27
|
-
//# sourceMappingURL=PwaReadyPopup.d.ts.map
|
|
23
|
+
export { PwaReadyPopup as t };
|
|
24
|
+
//# sourceMappingURL=PwaReadyPopup-dyWv1jdP.d.ts.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{i as e}from"../../icons-RRw4DIWa.js";import{a as t}from"../../composables-Bdxx2hts.js";import"../../popup-AhQUNvCQ.css";import{useLocale as n}from"@vuepress/helper/client";import{Transition as r,defineComponent as i,h as a,onMounted as o,ref as s}from"vue";import"@vuepress/helper/transition/fade-in-scale-up.css";const c=i({name:`PwaFoundPopup`,props:{locales:{type:Object,required:!0}},slots:Object,setup(i,{slots:c}){let l=n(i.locales),u=s(!1),d=()=>{u.value&&=(window.location.reload(!0),!1)};return o(()=>{let e=t();e.on(`updatefound`,()=>{navigator.serviceWorker.getRegistration().then(e=>{e?.active&&(u.value=!0)})}),e.on(`updated`,()=>{u.value=!1})}),()=>a(r,{name:`fade-in-scale-up`},()=>c.default?.({found:u.value,refresh:d})??(u.value?a(`button`,{type:`button`,class:`sw-hint-popup`,tabindex:0,onClick:()=>{d()}},[l.value.hint,a(`span`,{class:`icon-wrapper`},a(e))]):null))}});export{c as PwaFoundPopup};
|
|
2
|
+
//# sourceMappingURL=PwaFoundPopup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PwaFoundPopup.js","names":[],"sources":["../../../src/client/components/PwaFoundPopup.ts"],"sourcesContent":["import type { Slot } from '@vuepress/helper/client'\nimport { useLocale } from '@vuepress/helper/client'\nimport type { PropType, SlotsType, VNode } from 'vue'\nimport { Transition, defineComponent, h, onMounted, ref } from 'vue'\n\nimport { usePwaEvent } from '../composables/index.js'\nimport type { PwaPluginLocaleConfig } from '../types.js'\nimport { UpdateIcon } from './icons.js'\n\nimport '@vuepress/helper/transition/fade-in-scale-up.css'\nimport '../styles/popup.scss'\n\nexport const PwaFoundPopup = defineComponent({\n name: 'PwaFoundPopup',\n\n props: {\n /** locale data */\n locales: {\n type: Object as PropType<PwaPluginLocaleConfig>,\n required: true,\n },\n },\n\n slots: Object as SlotsType<{\n default?: Slot<{ found: boolean; refresh: () => void }>\n }>,\n\n setup(props, { slots }) {\n const locale = useLocale(props.locales)\n const found = ref(false)\n\n const refresh = (): void => {\n if (found.value) {\n // force refresh\n // @ts-expect-error: A non-standard API\n window.location.reload(true)\n found.value = false\n }\n }\n\n onMounted(() => {\n const event = usePwaEvent()\n\n event.on('updatefound', () => {\n void navigator.serviceWorker.getRegistration().then((registration) => {\n // Check whether a valid service worker is active\n if (registration?.active) found.value = true\n })\n })\n\n event.on('updated', () => {\n found.value = false\n })\n })\n\n return (): VNode =>\n h(\n Transition,\n { name: 'fade-in-scale-up' },\n () =>\n slots.default?.({\n found: found.value,\n refresh,\n }) ??\n (found.value\n ? h(\n 'button',\n {\n type: 'button',\n class: 'sw-hint-popup',\n tabindex: 0,\n onClick: () => {\n refresh()\n },\n },\n [\n locale.value.hint,\n h('span', { class: 'icon-wrapper' }, h(UpdateIcon)),\n ],\n )\n : null),\n )\n },\n})\n"],"mappings":"gUAYA,MAAa,EAAgB,EAAgB,CAC3C,KAAM,gBAEN,MAAO,CAEL,QAAS,CACP,KAAM,OACN,SAAU,GACX,CACF,CAED,MAAO,OAIP,MAAM,EAAO,CAAE,SAAS,CACtB,IAAM,EAAS,EAAU,EAAM,QAAQ,CACjC,EAAQ,EAAI,GAAM,CAElB,MAAsB,CAC1B,AAIE,EAAM,SADN,OAAO,SAAS,OAAO,GAAK,CACd,KAmBlB,OAfA,MAAgB,CACd,IAAM,EAAQ,GAAa,CAE3B,EAAM,GAAG,kBAAqB,CACvB,UAAU,cAAc,iBAAiB,CAAC,KAAM,GAAiB,CAEhE,GAAc,SAAQ,EAAM,MAAQ,KACxC,EACF,CAEF,EAAM,GAAG,cAAiB,CACxB,EAAM,MAAQ,IACd,EACF,KAGA,EACE,EACA,CAAE,KAAM,mBAAoB,KAE1B,EAAM,UAAU,CACd,MAAO,EAAM,MACb,UACD,CAAC,GACD,EAAM,MACH,EACE,SACA,CACE,KAAM,SACN,MAAO,gBACP,SAAU,EACV,YAAe,CACb,GAAS,EAEZ,CACD,CACE,EAAO,MAAM,KACb,EAAE,OAAQ,CAAE,MAAO,eAAgB,CAAE,EAAE,EAAW,CAAC,CACpD,CACF,CACD,MACP,EAEN,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"../../PwaInstall-D2rYRuV_.js";export{e as PwaInstall};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"../../PwaReadyPopup-Da6_dOG6.js";export{e as PwaReadyPopup};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,i as t,n,r,t as i}from"../../composables-Bdxx2hts.js";export{t as pwaEventSymbol,n as setupPwa,i as setupViewPoint,e as usePwaEvent,r as useRegisterSW};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { t as PwaPluginLocaleConfig } from "../types-
|
|
2
|
-
import { PwaFoundPopup } from "
|
|
3
|
-
import { PwaInstall } from "
|
|
4
|
-
import { PwaReadyPopup } from "
|
|
1
|
+
import { t as PwaPluginLocaleConfig } from "../types-BLkMmayH.js";
|
|
2
|
+
import { t as PwaFoundPopup } from "../PwaFoundPopup-B699MRU_.js";
|
|
3
|
+
import { t as PwaInstall } from "../PwaInstall-B7B9aSAb.js";
|
|
4
|
+
import { t as PwaReadyPopup } from "../PwaReadyPopup-dyWv1jdP.js";
|
|
5
5
|
import { PwaEvent, pwaEventSymbol, setupPwa, setupViewPoint, usePwaEvent, useRegisterSW } from "./composables/index.js";
|
|
6
6
|
import { Hooks } from "register-service-worker";
|
|
7
7
|
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{t as e}from"../PwaInstall-D2rYRuV_.js";import{a as t,i as n,n as r,o as i,r as a,s as o,t as s}from"../composables-Bdxx2hts.js";import{n as c,t as l}from"../PwaReadyPopup-Da6_dOG6.js";import{PwaFoundPopup as u}from"./components/PwaFoundPopup.js";const d=async()=>{try{let e=await navigator.serviceWorker.getRegistration();if(e){let t=await e.unregister();return t&&console.log(`[PWA] Current service worker unregistered`),t}}catch(e){console.error(`[PWA] Unregister current service worker failed with error:`,e)}return!1};export{u as PwaFoundPopup,e as PwaInstall,l as PwaReadyPopup,o as forceUpdate,n as pwaEventSymbol,i as registerSW,r as setupPwa,s as setupViewPoint,c as skipWaiting,d as unregisterSW,t as usePwaEvent,a as useRegisterSW};
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../src/client/utils/unregisterSW.ts"],"sourcesContent":["/* eslint-disable no-console */\n/**\n * Call `unregister()` inside current active worker\n *\n * 在当前激活的 Service Worker 中调用 `unregister()`\n *\n * @returns `true` if unregister success, `false` if unregister failed / `true` 表示注销成功,`false` 表示注销失败\n */\nexport const unregisterSW = async (): Promise<boolean> => {\n try {\n const registration = await navigator.serviceWorker.getRegistration()\n if (registration) {\n const found = await registration.unregister()\n if (found) console.log('[PWA] Current service worker unregistered')\n return found\n }\n } catch (err: unknown) {\n console.error(\n '[PWA] Unregister current service worker failed with error:',\n err,\n )\n }\n return false\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/client/utils/unregisterSW.ts"],"sourcesContent":["/* eslint-disable no-console */\n/**\n * Call `unregister()` inside current active worker\n *\n * 在当前激活的 Service Worker 中调用 `unregister()`\n *\n * @returns `true` if unregister success, `false` if unregister failed / `true` 表示注销成功,`false` 表示注销失败\n */\nexport const unregisterSW = async (): Promise<boolean> => {\n try {\n const registration = await navigator.serviceWorker.getRegistration()\n if (registration) {\n const found = await registration.unregister()\n if (found) console.log('[PWA] Current service worker unregistered')\n return found\n }\n } catch (err: unknown) {\n console.error(\n '[PWA] Unregister current service worker failed with error:',\n err,\n )\n }\n return false\n}\n"],"mappings":"6PAQA,MAAa,EAAe,SAA8B,CACxD,GAAI,CACF,IAAM,EAAe,MAAM,UAAU,cAAc,iBAAiB,CACpE,GAAI,EAAc,CAChB,IAAM,EAAQ,MAAM,EAAa,YAAY,CAE7C,OADI,GAAO,QAAQ,IAAI,4CAA4C,CAC5D,SAEF,EAAc,CACrB,QAAQ,MACN,6DACA,EACD,CAEH,MAAO"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
--pwa-z-index: 10;
|
|
3
|
+
--pwa-c-bg: var(--vp-c-bg-elv);
|
|
4
|
+
--pwa-c-text: var(--vp-c-text);
|
|
5
|
+
--pwa-c-shadow: var(--vp-c-shadow);
|
|
6
|
+
--pwa-c-accent-bg: var(--vp-c-accent-bg);
|
|
7
|
+
--pwa-c-accent-hover: var(--vp-c-accent-hover);
|
|
8
|
+
--pwa-c-accent-text: var(--vp-c-accent-text);
|
|
9
|
+
--pwa-c-control: var(--vp-c-control);
|
|
10
|
+
--pwa-c-control-hover: var(--vp-c-control-hover);
|
|
11
|
+
--pwa-c-text-mute: var(--vp-c-text-mute);
|
|
12
|
+
}
|