@dxos/plugin-pwa 0.8.4-main.ae835ea → 0.8.4-main.bc674ce
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 +69 -76
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/types/src/PwaPlugin.d.ts +2 -1
- package/dist/types/src/PwaPlugin.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +2 -2
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +23 -19
- package/src/PwaPlugin.tsx +30 -50
- package/src/meta.ts +2 -2
package/package.json
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/plugin-pwa",
|
|
3
|
-
"version": "0.8.4-main.
|
|
3
|
+
"version": "0.8.4-main.bc674ce",
|
|
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",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/dxos/dxos"
|
|
10
|
+
},
|
|
7
11
|
"license": "MIT",
|
|
8
12
|
"author": "DXOS.org",
|
|
9
13
|
"sideEffects": true,
|
|
@@ -24,31 +28,31 @@
|
|
|
24
28
|
"src"
|
|
25
29
|
],
|
|
26
30
|
"dependencies": {
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"@dxos/
|
|
30
|
-
"@dxos/
|
|
31
|
-
"@dxos/
|
|
32
|
-
"@dxos/
|
|
31
|
+
"effect": "3.19.11",
|
|
32
|
+
"@dxos/log": "0.8.4-main.bc674ce",
|
|
33
|
+
"@dxos/app-framework": "0.8.4-main.bc674ce",
|
|
34
|
+
"@dxos/observability": "0.8.4-main.bc674ce",
|
|
35
|
+
"@dxos/operation": "0.8.4-main.bc674ce",
|
|
36
|
+
"@dxos/util": "0.8.4-main.bc674ce"
|
|
33
37
|
},
|
|
34
38
|
"devDependencies": {
|
|
35
|
-
"@types/react": "~19.2.
|
|
36
|
-
"@types/react-dom": "~19.2.
|
|
37
|
-
"react": "~19.2.
|
|
38
|
-
"react-dom": "~19.2.
|
|
39
|
+
"@types/react": "~19.2.7",
|
|
40
|
+
"@types/react-dom": "~19.2.3",
|
|
41
|
+
"react": "~19.2.3",
|
|
42
|
+
"react-dom": "~19.2.3",
|
|
39
43
|
"vite": "7.1.9",
|
|
40
44
|
"vite-plugin-pwa": "^1.0.2",
|
|
41
45
|
"workbox-window": "^7.3.0",
|
|
42
|
-
"@dxos/react-ui": "0.8.4-main.
|
|
43
|
-
"@dxos/
|
|
44
|
-
"@dxos/
|
|
46
|
+
"@dxos/react-ui": "0.8.4-main.bc674ce",
|
|
47
|
+
"@dxos/storybook-utils": "0.8.4-main.bc674ce",
|
|
48
|
+
"@dxos/ui-theme": "0.8.4-main.bc674ce"
|
|
45
49
|
},
|
|
46
50
|
"peerDependencies": {
|
|
47
|
-
"effect": "
|
|
48
|
-
"react": "
|
|
49
|
-
"react-dom": "
|
|
50
|
-
"@dxos/react-ui": "0.8.4-main.
|
|
51
|
-
"@dxos/
|
|
51
|
+
"effect": "3.19.11",
|
|
52
|
+
"react": "~19.2.3",
|
|
53
|
+
"react-dom": "~19.2.3",
|
|
54
|
+
"@dxos/react-ui": "0.8.4-main.bc674ce",
|
|
55
|
+
"@dxos/ui-theme": "0.8.4-main.bc674ce"
|
|
52
56
|
},
|
|
53
57
|
"publishConfig": {
|
|
54
58
|
"access": "public"
|
package/src/PwaPlugin.tsx
CHANGED
|
@@ -2,69 +2,49 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
5
6
|
import { registerSW } from 'virtual:pwa-register';
|
|
6
7
|
|
|
7
|
-
import {
|
|
8
|
-
Capabilities,
|
|
9
|
-
Events,
|
|
10
|
-
LayoutAction,
|
|
11
|
-
contributes,
|
|
12
|
-
createIntent,
|
|
13
|
-
defineModule,
|
|
14
|
-
definePlugin,
|
|
15
|
-
} from '@dxos/app-framework';
|
|
8
|
+
import { Capability, Common, Plugin } from '@dxos/app-framework';
|
|
16
9
|
import { log } from '@dxos/log';
|
|
17
10
|
import { captureException } from '@dxos/observability/sentry';
|
|
18
11
|
|
|
19
12
|
import { meta } from './meta';
|
|
20
13
|
import { translations } from './translations';
|
|
21
14
|
|
|
22
|
-
export const PwaPlugin =
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
id: `${meta.id}/module/register-pwa`,
|
|
30
|
-
activatesOn: Events.DispatcherReady,
|
|
31
|
-
activate: (context) => {
|
|
32
|
-
const { dispatchPromise: dispatch } = context.getCapability(Capabilities.IntentDispatcher);
|
|
15
|
+
export const PwaPlugin = Plugin.define(meta).pipe(
|
|
16
|
+
Common.Plugin.addTranslationsModule({ translations }),
|
|
17
|
+
Plugin.addModule({
|
|
18
|
+
id: 'register-pwa',
|
|
19
|
+
activatesOn: Common.ActivationEvent.OperationInvokerReady,
|
|
20
|
+
activate: Effect.fnUntraced(function* () {
|
|
21
|
+
const { invokeSync } = yield* Capability.get(Common.Capability.OperationInvoker);
|
|
33
22
|
|
|
34
23
|
const updateSW = registerSW({
|
|
35
|
-
onNeedRefresh: () =>
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
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
|
-
),
|
|
24
|
+
onNeedRefresh: () => {
|
|
25
|
+
invokeSync(Common.LayoutOperation.AddToast, {
|
|
26
|
+
id: `${meta.id}/need-refresh`,
|
|
27
|
+
title: ['need refresh label', { ns: meta.id }],
|
|
28
|
+
description: ['need refresh description', { ns: meta.id }],
|
|
29
|
+
duration: 4 * 60 * 1000, // 4m
|
|
30
|
+
actionLabel: ['refresh label', { ns: meta.id }],
|
|
31
|
+
actionAlt: ['refresh alt', { ns: meta.id }],
|
|
32
|
+
onAction: () => updateSW(true),
|
|
33
|
+
});
|
|
34
|
+
},
|
|
35
|
+
onOfflineReady: () => {
|
|
36
|
+
invokeSync(Common.LayoutOperation.AddToast, {
|
|
37
|
+
id: `${meta.id}/offline-ready`,
|
|
38
|
+
title: ['offline ready label', { ns: meta.id }],
|
|
39
|
+
closeLabel: ['confirm label', { ns: meta.id }],
|
|
40
|
+
});
|
|
41
|
+
},
|
|
61
42
|
onRegisterError: (err) => {
|
|
62
43
|
captureException(err);
|
|
63
44
|
log.error(err);
|
|
64
45
|
},
|
|
65
46
|
});
|
|
66
|
-
|
|
67
|
-
return contributes(Capabilities.Null, null);
|
|
68
|
-
},
|
|
47
|
+
}),
|
|
69
48
|
}),
|
|
70
|
-
|
|
49
|
+
Plugin.make,
|
|
50
|
+
);
|
package/src/meta.ts
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { type
|
|
5
|
+
import { type Plugin } from '@dxos/app-framework';
|
|
6
6
|
import { trim } from '@dxos/util';
|
|
7
7
|
|
|
8
|
-
export const meta:
|
|
8
|
+
export const meta: Plugin.Meta = {
|
|
9
9
|
id: 'dxos.org/plugin/pwa',
|
|
10
10
|
name: 'PWA',
|
|
11
11
|
description: trim`
|