@docusaurus/plugin-pwa 0.0.0-5023 → 0.0.0-5027
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/theme/PwaReloadPopup/index.js +33 -17
- package/package.json +9 -12
|
@@ -4,35 +4,51 @@
|
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
-
import React, {
|
|
7
|
+
import React, {useState} from 'react';
|
|
8
8
|
import clsx from 'clsx';
|
|
9
|
-
import Translate, {
|
|
9
|
+
import Translate, {translate} from '@docusaurus/Translate';
|
|
10
10
|
import styles from './styles.module.css';
|
|
11
|
-
export default function PwaReloadPopup({
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
export default function PwaReloadPopup({onReload}) {
|
|
12
|
+
const [isVisible, setIsVisible] = useState(true);
|
|
13
|
+
return (
|
|
14
|
+
isVisible && (
|
|
15
|
+
<div className={clsx('alert', 'alert--secondary', styles.popup)}>
|
|
14
16
|
<p>
|
|
15
|
-
<Translate
|
|
17
|
+
<Translate
|
|
18
|
+
id="theme.PwaReloadPopup.info"
|
|
19
|
+
description="The text for PWA reload popup">
|
|
16
20
|
New version available
|
|
17
21
|
</Translate>
|
|
18
22
|
</p>
|
|
19
23
|
<div className={styles.buttonContainer}>
|
|
20
|
-
<button
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
24
|
+
<button
|
|
25
|
+
className="button button--link"
|
|
26
|
+
type="button"
|
|
27
|
+
onClick={() => {
|
|
28
|
+
setIsVisible(false);
|
|
29
|
+
onReload();
|
|
30
|
+
}}>
|
|
31
|
+
<Translate
|
|
32
|
+
id="theme.PwaReloadPopup.refreshButtonText"
|
|
33
|
+
description="The text for PWA reload button">
|
|
25
34
|
Refresh
|
|
26
35
|
</Translate>
|
|
27
36
|
</button>
|
|
28
37
|
|
|
29
|
-
<button
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
38
|
+
<button
|
|
39
|
+
aria-label={translate({
|
|
40
|
+
id: 'theme.PwaReloadPopup.closeButtonAriaLabel',
|
|
41
|
+
message: 'Close',
|
|
42
|
+
description:
|
|
43
|
+
'The ARIA label for close button of PWA reload popup',
|
|
44
|
+
})}
|
|
45
|
+
className="close"
|
|
46
|
+
type="button"
|
|
47
|
+
onClick={() => setIsVisible(false)}>
|
|
34
48
|
<span aria-hidden="true">×</span>
|
|
35
49
|
</button>
|
|
36
50
|
</div>
|
|
37
|
-
</div>
|
|
51
|
+
</div>
|
|
52
|
+
)
|
|
53
|
+
);
|
|
38
54
|
}
|
package/package.json
CHANGED
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@docusaurus/plugin-pwa",
|
|
3
|
-
"version": "0.0.0-
|
|
3
|
+
"version": "0.0.0-5027",
|
|
4
4
|
"description": "Docusaurus Plugin to add PWA support.",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "src/plugin-pwa.d.ts",
|
|
7
7
|
"scripts": {
|
|
8
|
-
"build": "
|
|
9
|
-
"build:server": "tsc --project tsconfig.server.json",
|
|
10
|
-
"build:browser": "tsc --project tsconfig.browser.json",
|
|
11
|
-
"build:copy": "node copyUntypedFiles.mjs"
|
|
8
|
+
"build": "tsc --build && node copyUntypedFiles.mjs && prettier --config ../../.prettierrc --write \"lib/theme/**/*.js\""
|
|
12
9
|
},
|
|
13
10
|
"publishConfig": {
|
|
14
11
|
"access": "public"
|
|
@@ -22,11 +19,11 @@
|
|
|
22
19
|
"dependencies": {
|
|
23
20
|
"@babel/core": "^7.17.12",
|
|
24
21
|
"@babel/preset-env": "^7.17.12",
|
|
25
|
-
"@docusaurus/core": "0.0.0-
|
|
26
|
-
"@docusaurus/theme-common": "0.0.0-
|
|
27
|
-
"@docusaurus/theme-translations": "0.0.0-
|
|
28
|
-
"@docusaurus/utils": "0.0.0-
|
|
29
|
-
"@docusaurus/utils-validation": "0.0.0-
|
|
22
|
+
"@docusaurus/core": "0.0.0-5027",
|
|
23
|
+
"@docusaurus/theme-common": "0.0.0-5027",
|
|
24
|
+
"@docusaurus/theme-translations": "0.0.0-5027",
|
|
25
|
+
"@docusaurus/utils": "0.0.0-5027",
|
|
26
|
+
"@docusaurus/utils-validation": "0.0.0-5027",
|
|
30
27
|
"babel-loader": "^8.2.5",
|
|
31
28
|
"clsx": "^1.1.1",
|
|
32
29
|
"core-js": "^3.22.5",
|
|
@@ -39,12 +36,12 @@
|
|
|
39
36
|
"workbox-window": "^6.5.3"
|
|
40
37
|
},
|
|
41
38
|
"devDependencies": {
|
|
42
|
-
"@docusaurus/module-type-aliases": "0.0.0-
|
|
39
|
+
"@docusaurus/module-type-aliases": "0.0.0-5027",
|
|
43
40
|
"fs-extra": "^10.1.0"
|
|
44
41
|
},
|
|
45
42
|
"peerDependencies": {
|
|
46
43
|
"react": "^16.8.4 || ^17.0.0",
|
|
47
44
|
"react-dom": "^16.8.4 || ^17.0.0"
|
|
48
45
|
},
|
|
49
|
-
"gitHead": "
|
|
46
|
+
"gitHead": "780d7af951f49f7c5ac0cb04626844935d0ada7b"
|
|
50
47
|
}
|