@dxos/plugin-pwa 0.8.4-main.dedc0f3 → 0.8.4-main.e8ec1fe
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 +17 -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 +18 -17
- package/src/PwaPlugin.tsx +48 -49
- package/src/meta.ts +6 -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.e8ec1fe",
|
|
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",
|
|
@@ -25,29 +25,30 @@
|
|
|
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/
|
|
31
|
-
"@dxos/
|
|
28
|
+
"effect": "3.18.3",
|
|
29
|
+
"@dxos/app-framework": "0.8.4-main.e8ec1fe",
|
|
30
|
+
"@dxos/log": "0.8.4-main.e8ec1fe",
|
|
31
|
+
"@dxos/observability": "0.8.4-main.e8ec1fe",
|
|
32
|
+
"@dxos/util": "0.8.4-main.e8ec1fe"
|
|
32
33
|
},
|
|
33
34
|
"devDependencies": {
|
|
34
|
-
"@types/react": "~
|
|
35
|
-
"@types/react-dom": "~
|
|
36
|
-
"react": "~
|
|
37
|
-
"react-dom": "~
|
|
38
|
-
"vite": "7.1.
|
|
35
|
+
"@types/react": "~19.2.2",
|
|
36
|
+
"@types/react-dom": "~19.2.2",
|
|
37
|
+
"react": "~19.2.0",
|
|
38
|
+
"react-dom": "~19.2.0",
|
|
39
|
+
"vite": "7.1.9",
|
|
39
40
|
"vite-plugin-pwa": "^1.0.2",
|
|
40
41
|
"workbox-window": "^7.3.0",
|
|
41
|
-
"@dxos/react-ui": "0.8.4-main.
|
|
42
|
-
"@dxos/
|
|
43
|
-
"@dxos/
|
|
42
|
+
"@dxos/react-ui": "0.8.4-main.e8ec1fe",
|
|
43
|
+
"@dxos/storybook-utils": "0.8.4-main.e8ec1fe",
|
|
44
|
+
"@dxos/react-ui-theme": "0.8.4-main.e8ec1fe"
|
|
44
45
|
},
|
|
45
46
|
"peerDependencies": {
|
|
46
47
|
"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.
|
|
48
|
+
"react": "^19.0.0",
|
|
49
|
+
"react-dom": "^19.0.0",
|
|
50
|
+
"@dxos/react-ui": "0.8.4-main.e8ec1fe",
|
|
51
|
+
"@dxos/react-ui-theme": "0.8.4-main.e8ec1fe"
|
|
51
52
|
},
|
|
52
53
|
"publishConfig": {
|
|
53
54
|
"access": "public"
|
package/src/PwaPlugin.tsx
CHANGED
|
@@ -16,56 +16,55 @@ import {
|
|
|
16
16
|
import { log } from '@dxos/log';
|
|
17
17
|
import { captureException } from '@dxos/observability/sentry';
|
|
18
18
|
|
|
19
|
-
import {
|
|
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
|
+
]);
|
package/src/meta.ts
CHANGED
|
@@ -3,10 +3,13 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { type PluginMeta } from '@dxos/app-framework';
|
|
6
|
-
|
|
7
|
-
export const PWA_PLUGIN = 'dxos.org/plugin/pwa';
|
|
6
|
+
import { trim } from '@dxos/util';
|
|
8
7
|
|
|
9
8
|
export const meta: PluginMeta = {
|
|
10
|
-
id:
|
|
9
|
+
id: 'dxos.org/plugin/pwa',
|
|
11
10
|
name: 'PWA',
|
|
11
|
+
description: trim`
|
|
12
|
+
Progressive Web App capabilities enabling offline functionality and app-like experience.
|
|
13
|
+
Install to home screen and use the workspace without internet connection.
|
|
14
|
+
`,
|
|
12
15
|
};
|