@dxos/plugin-pwa 0.8.4-main.67995b8 → 0.8.4-main.a4bbb77
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/lib/browser/index.mjs +12 -14
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/types/src/PwaPlugin.d.ts +1 -1
- package/dist/types/src/PwaPlugin.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +0 -1
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +21 -21
- package/src/PwaPlugin.tsx +50 -51
- package/src/meta.ts +1 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/plugin-pwa",
|
|
3
|
-
"version": "0.8.4-main.
|
|
3
|
+
"version": "0.8.4-main.a4bbb77",
|
|
4
4
|
"description": "DXOS Surface plugin for PWA registration and update handling.",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -10,9 +10,9 @@
|
|
|
10
10
|
"type": "module",
|
|
11
11
|
"exports": {
|
|
12
12
|
".": {
|
|
13
|
+
"source": "./src/index.ts",
|
|
13
14
|
"types": "./dist/types/src/index.d.ts",
|
|
14
|
-
"browser": "./dist/lib/browser/index.mjs"
|
|
15
|
-
"source": "./src/index.ts"
|
|
15
|
+
"browser": "./dist/lib/browser/index.mjs"
|
|
16
16
|
}
|
|
17
17
|
},
|
|
18
18
|
"types": "dist/types/src/index.d.ts",
|
|
@@ -25,29 +25,29 @@
|
|
|
25
25
|
],
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@preact-signals/safe-react": "^0.9.0",
|
|
28
|
-
"effect": "3.
|
|
29
|
-
"@dxos/app-framework": "0.8.4-main.
|
|
30
|
-
"@dxos/log": "0.8.4-main.
|
|
31
|
-
"@dxos/observability": "0.8.4-main.
|
|
28
|
+
"effect": "3.18.3",
|
|
29
|
+
"@dxos/app-framework": "0.8.4-main.a4bbb77",
|
|
30
|
+
"@dxos/log": "0.8.4-main.a4bbb77",
|
|
31
|
+
"@dxos/observability": "0.8.4-main.a4bbb77"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
|
-
"@types/react": "~
|
|
35
|
-
"@types/react-dom": "~
|
|
36
|
-
"react": "~
|
|
37
|
-
"react-dom": "~
|
|
38
|
-
"vite": "
|
|
39
|
-
"vite-plugin-pwa": "^0.
|
|
40
|
-
"workbox-window": "^7.
|
|
41
|
-
"@dxos/react-ui
|
|
42
|
-
"@dxos/react-ui": "0.8.4-main.
|
|
43
|
-
"@dxos/storybook-utils": "0.8.4-main.
|
|
34
|
+
"@types/react": "~19.2.0",
|
|
35
|
+
"@types/react-dom": "~19.2.0",
|
|
36
|
+
"react": "~19.2.0",
|
|
37
|
+
"react-dom": "~19.2.0",
|
|
38
|
+
"vite": "7.1.9",
|
|
39
|
+
"vite-plugin-pwa": "^1.0.2",
|
|
40
|
+
"workbox-window": "^7.3.0",
|
|
41
|
+
"@dxos/react-ui": "0.8.4-main.a4bbb77",
|
|
42
|
+
"@dxos/react-ui-theme": "0.8.4-main.a4bbb77",
|
|
43
|
+
"@dxos/storybook-utils": "0.8.4-main.a4bbb77"
|
|
44
44
|
},
|
|
45
45
|
"peerDependencies": {
|
|
46
46
|
"effect": "^3.13.3",
|
|
47
|
-
"react": "
|
|
48
|
-
"react-dom": "
|
|
49
|
-
"@dxos/react-ui": "0.8.4-main.
|
|
50
|
-
"@dxos/react-ui-theme": "0.8.4-main.
|
|
47
|
+
"react": "^19.0.0",
|
|
48
|
+
"react-dom": "^19.0.0",
|
|
49
|
+
"@dxos/react-ui": "0.8.4-main.a4bbb77",
|
|
50
|
+
"@dxos/react-ui-theme": "0.8.4-main.a4bbb77"
|
|
51
51
|
},
|
|
52
52
|
"publishConfig": {
|
|
53
53
|
"access": "public"
|
package/src/PwaPlugin.tsx
CHANGED
|
@@ -6,66 +6,65 @@ import { registerSW } from 'virtual:pwa-register';
|
|
|
6
6
|
|
|
7
7
|
import {
|
|
8
8
|
Capabilities,
|
|
9
|
+
Events,
|
|
10
|
+
LayoutAction,
|
|
9
11
|
contributes,
|
|
10
12
|
createIntent,
|
|
11
13
|
defineModule,
|
|
12
14
|
definePlugin,
|
|
13
|
-
Events,
|
|
14
|
-
LayoutAction,
|
|
15
15
|
} from '@dxos/app-framework';
|
|
16
16
|
import { log } from '@dxos/log';
|
|
17
17
|
import { captureException } from '@dxos/observability/sentry';
|
|
18
18
|
|
|
19
|
-
import { meta
|
|
19
|
+
import { meta } from './meta';
|
|
20
20
|
import { translations } from './translations';
|
|
21
21
|
|
|
22
|
-
export const PwaPlugin = () =>
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
const { dispatchPromise: dispatch } = context.getCapability(Capabilities.IntentDispatcher);
|
|
22
|
+
export const PwaPlugin = definePlugin(meta, () => [
|
|
23
|
+
defineModule({
|
|
24
|
+
id: `${meta.id}/module/translations`,
|
|
25
|
+
activatesOn: Events.SetupTranslations,
|
|
26
|
+
activate: () => contributes(Capabilities.Translations, translations),
|
|
27
|
+
}),
|
|
28
|
+
defineModule({
|
|
29
|
+
id: `${meta.id}/module/register-pwa`,
|
|
30
|
+
activatesOn: Events.DispatcherReady,
|
|
31
|
+
activate: (context) => {
|
|
32
|
+
const { dispatchPromise: dispatch } = context.getCapability(Capabilities.IntentDispatcher);
|
|
34
33
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
34
|
+
const updateSW = registerSW({
|
|
35
|
+
onNeedRefresh: () =>
|
|
36
|
+
dispatch?.(
|
|
37
|
+
createIntent(LayoutAction.AddToast, {
|
|
38
|
+
part: 'toast',
|
|
39
|
+
subject: {
|
|
40
|
+
id: `${meta.id}/need-refresh`,
|
|
41
|
+
title: ['need refresh label', { ns: meta.id }],
|
|
42
|
+
description: ['need refresh description', { ns: meta.id }],
|
|
43
|
+
duration: 4 * 60 * 1000, // 4m
|
|
44
|
+
actionLabel: ['refresh label', { ns: meta.id }],
|
|
45
|
+
actionAlt: ['refresh alt', { ns: meta.id }],
|
|
46
|
+
onAction: () => updateSW(true),
|
|
47
|
+
},
|
|
48
|
+
}),
|
|
49
|
+
),
|
|
50
|
+
onOfflineReady: () =>
|
|
51
|
+
dispatch?.(
|
|
52
|
+
createIntent(LayoutAction.AddToast, {
|
|
53
|
+
part: 'toast',
|
|
54
|
+
subject: {
|
|
55
|
+
id: `${meta.id}/offline-ready`,
|
|
56
|
+
title: ['offline ready label', { ns: meta.id }],
|
|
57
|
+
closeLabel: ['confirm label', { ns: meta.id }],
|
|
58
|
+
},
|
|
59
|
+
}),
|
|
60
|
+
),
|
|
61
|
+
onRegisterError: (err) => {
|
|
62
|
+
captureException(err);
|
|
63
|
+
log.error(err);
|
|
64
|
+
},
|
|
65
|
+
});
|
|
67
66
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
67
|
+
return contributes(Capabilities.Null, null);
|
|
68
|
+
},
|
|
69
|
+
}),
|
|
70
|
+
]);
|