@dxos/plugin-pwa 0.8.4-main.84f28bd → 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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dxos/plugin-pwa",
3
- "version": "0.8.4-main.84f28bd",
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,6 +10,7 @@
10
10
  "type": "module",
11
11
  "exports": {
12
12
  ".": {
13
+ "source": "./src/index.ts",
13
14
  "types": "./dist/types/src/index.d.ts",
14
15
  "browser": "./dist/lib/browser/index.mjs"
15
16
  }
@@ -24,29 +25,29 @@
24
25
  ],
25
26
  "dependencies": {
26
27
  "@preact-signals/safe-react": "^0.9.0",
27
- "effect": "3.16.13",
28
- "@dxos/app-framework": "0.8.4-main.84f28bd",
29
- "@dxos/log": "0.8.4-main.84f28bd",
30
- "@dxos/observability": "0.8.4-main.84f28bd"
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"
31
32
  },
32
33
  "devDependencies": {
33
- "@types/react": "~18.2.0",
34
- "@types/react-dom": "~18.2.0",
35
- "react": "~18.2.0",
36
- "react-dom": "~18.2.0",
37
- "vite": "5.4.7",
38
- "vite-plugin-pwa": "^0.18.2",
39
- "workbox-window": "^7.0.0",
40
- "@dxos/react-ui-theme": "0.8.4-main.84f28bd",
41
- "@dxos/react-ui": "0.8.4-main.84f28bd",
42
- "@dxos/storybook-utils": "0.8.4-main.84f28bd"
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"
43
44
  },
44
45
  "peerDependencies": {
45
46
  "effect": "^3.13.3",
46
- "react": "~18.2.0",
47
- "react-dom": "~18.2.0",
48
- "@dxos/react-ui": "0.8.4-main.84f28bd",
49
- "@dxos/react-ui-theme": "0.8.4-main.84f28bd"
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"
50
51
  },
51
52
  "publishConfig": {
52
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, PWA_PLUGIN } from './meta';
19
+ import { meta } from './meta';
20
20
  import { translations } from './translations';
21
21
 
22
- export const PwaPlugin = () =>
23
- definePlugin(meta, [
24
- defineModule({
25
- id: `${meta.id}/module/translations`,
26
- activatesOn: Events.SetupTranslations,
27
- activate: () => contributes(Capabilities.Translations, translations),
28
- }),
29
- defineModule({
30
- id: `${meta.id}/module/register-pwa`,
31
- activatesOn: Events.DispatcherReady,
32
- activate: (context) => {
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
- const updateSW = registerSW({
36
- onNeedRefresh: () =>
37
- dispatch?.(
38
- createIntent(LayoutAction.AddToast, {
39
- part: 'toast',
40
- subject: {
41
- id: `${PWA_PLUGIN}/need-refresh`,
42
- title: ['need refresh label', { ns: PWA_PLUGIN }],
43
- description: ['need refresh description', { ns: PWA_PLUGIN }],
44
- duration: 4 * 60 * 1000, // 4m
45
- actionLabel: ['refresh label', { ns: PWA_PLUGIN }],
46
- actionAlt: ['refresh alt', { ns: PWA_PLUGIN }],
47
- onAction: () => updateSW(true),
48
- },
49
- }),
50
- ),
51
- onOfflineReady: () =>
52
- dispatch?.(
53
- createIntent(LayoutAction.AddToast, {
54
- part: 'toast',
55
- subject: {
56
- id: `${PWA_PLUGIN}/offline-ready`,
57
- title: ['offline ready label', { ns: PWA_PLUGIN }],
58
- closeLabel: ['confirm label', { ns: PWA_PLUGIN }],
59
- },
60
- }),
61
- ),
62
- onRegisterError: (err) => {
63
- captureException(err);
64
- log.error(err);
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
- return contributes(Capabilities.Null, null);
69
- },
70
- }),
71
- ]);
67
+ return contributes(Capabilities.Null, null);
68
+ },
69
+ }),
70
+ ]);
package/src/meta.ts CHANGED
@@ -4,9 +4,7 @@
4
4
 
5
5
  import { type PluginMeta } from '@dxos/app-framework';
6
6
 
7
- export const PWA_PLUGIN = 'dxos.org/plugin/pwa';
8
-
9
7
  export const meta: PluginMeta = {
10
- id: PWA_PLUGIN,
8
+ id: 'dxos.org/plugin/pwa',
11
9
  name: 'PWA',
12
10
  };
@@ -1,117 +0,0 @@
1
- import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
2
-
3
- // src/meta.ts
4
- var PWA_PLUGIN = "dxos.org/plugin/pwa";
5
- var meta = {
6
- id: PWA_PLUGIN,
7
- name: "PWA"
8
- };
9
-
10
- // src/PwaPlugin.tsx
11
- import { registerSW } from "virtual:pwa-register";
12
- import { Capabilities, contributes, createIntent, defineModule, definePlugin, Events, LayoutAction } from "@dxos/app-framework";
13
- import { log } from "@dxos/log";
14
- import { captureException } from "@dxos/observability/sentry";
15
-
16
- // src/translations.ts
17
- var translations = [
18
- {
19
- "en-US": {
20
- [meta.id]: {
21
- "need refresh label": "Refresh now to get app updates",
22
- "need refresh description": "You\u2019ll need these updates to continue without interruption.",
23
- "refresh label": "Refresh",
24
- "refresh alt": "Click your browser\u2019s refresh button or use the refresh keyboard shortcut.",
25
- // TODO(wittjosiah): Non-react translation utils.
26
- // 'offline ready label': '{{appName}} is ready to use offline.',
27
- "offline ready label": "Ready to use offline.",
28
- "confirm label": "Okay"
29
- }
30
- }
31
- }
32
- ];
33
-
34
- // src/PwaPlugin.tsx
35
- var __dxlog_file = "/__w/dxos/dxos/packages/plugins/plugin-pwa/src/PwaPlugin.tsx";
36
- var PwaPlugin = () => definePlugin(meta, [
37
- defineModule({
38
- id: `${meta.id}/module/translations`,
39
- activatesOn: Events.SetupTranslations,
40
- activate: () => contributes(Capabilities.Translations, translations)
41
- }),
42
- defineModule({
43
- id: `${meta.id}/module/register-pwa`,
44
- activatesOn: Events.DispatcherReady,
45
- activate: (context) => {
46
- const { dispatchPromise: dispatch } = context.getCapability(Capabilities.IntentDispatcher);
47
- const updateSW = registerSW({
48
- onNeedRefresh: () => dispatch?.(createIntent(LayoutAction.AddToast, {
49
- part: "toast",
50
- subject: {
51
- id: `${PWA_PLUGIN}/need-refresh`,
52
- title: [
53
- "need refresh label",
54
- {
55
- ns: PWA_PLUGIN
56
- }
57
- ],
58
- description: [
59
- "need refresh description",
60
- {
61
- ns: PWA_PLUGIN
62
- }
63
- ],
64
- duration: 4 * 60 * 1e3,
65
- actionLabel: [
66
- "refresh label",
67
- {
68
- ns: PWA_PLUGIN
69
- }
70
- ],
71
- actionAlt: [
72
- "refresh alt",
73
- {
74
- ns: PWA_PLUGIN
75
- }
76
- ],
77
- onAction: () => updateSW(true)
78
- }
79
- })),
80
- onOfflineReady: () => dispatch?.(createIntent(LayoutAction.AddToast, {
81
- part: "toast",
82
- subject: {
83
- id: `${PWA_PLUGIN}/offline-ready`,
84
- title: [
85
- "offline ready label",
86
- {
87
- ns: PWA_PLUGIN
88
- }
89
- ],
90
- closeLabel: [
91
- "confirm label",
92
- {
93
- ns: PWA_PLUGIN
94
- }
95
- ]
96
- }
97
- })),
98
- onRegisterError: (err) => {
99
- captureException(err);
100
- log.error(err, void 0, {
101
- F: __dxlog_file,
102
- L: 64,
103
- S: void 0,
104
- C: (f, a) => f(...a)
105
- });
106
- }
107
- });
108
- return contributes(Capabilities.Null, null);
109
- }
110
- })
111
- ]);
112
- export {
113
- PWA_PLUGIN,
114
- PwaPlugin,
115
- meta
116
- };
117
- //# sourceMappingURL=index.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/meta.ts", "../../../src/PwaPlugin.tsx", "../../../src/translations.ts"],
4
- "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { type PluginMeta } from '@dxos/app-framework';\n\nexport const PWA_PLUGIN = 'dxos.org/plugin/pwa';\n\nexport const meta: PluginMeta = {\n id: PWA_PLUGIN,\n name: 'PWA',\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { registerSW } from 'virtual:pwa-register';\n\nimport {\n Capabilities,\n contributes,\n createIntent,\n defineModule,\n definePlugin,\n Events,\n LayoutAction,\n} from '@dxos/app-framework';\nimport { log } from '@dxos/log';\nimport { captureException } from '@dxos/observability/sentry';\n\nimport { meta, PWA_PLUGIN } from './meta';\nimport { translations } from './translations';\n\nexport const PwaPlugin = () =>\n definePlugin(meta, [\n defineModule({\n id: `${meta.id}/module/translations`,\n activatesOn: Events.SetupTranslations,\n activate: () => contributes(Capabilities.Translations, translations),\n }),\n defineModule({\n id: `${meta.id}/module/register-pwa`,\n activatesOn: Events.DispatcherReady,\n activate: (context) => {\n const { dispatchPromise: dispatch } = context.getCapability(Capabilities.IntentDispatcher);\n\n const updateSW = registerSW({\n onNeedRefresh: () =>\n dispatch?.(\n createIntent(LayoutAction.AddToast, {\n part: 'toast',\n subject: {\n id: `${PWA_PLUGIN}/need-refresh`,\n title: ['need refresh label', { ns: PWA_PLUGIN }],\n description: ['need refresh description', { ns: PWA_PLUGIN }],\n duration: 4 * 60 * 1000, // 4m\n actionLabel: ['refresh label', { ns: PWA_PLUGIN }],\n actionAlt: ['refresh alt', { ns: PWA_PLUGIN }],\n onAction: () => updateSW(true),\n },\n }),\n ),\n onOfflineReady: () =>\n dispatch?.(\n createIntent(LayoutAction.AddToast, {\n part: 'toast',\n subject: {\n id: `${PWA_PLUGIN}/offline-ready`,\n title: ['offline ready label', { ns: PWA_PLUGIN }],\n closeLabel: ['confirm label', { ns: PWA_PLUGIN }],\n },\n }),\n ),\n onRegisterError: (err) => {\n captureException(err);\n log.error(err);\n },\n });\n\n return contributes(Capabilities.Null, null);\n },\n }),\n ]);\n", "//\n// Copyright 2022 DXOS.org\n//\n\nimport { type Resource } from '@dxos/react-ui';\n\nimport { meta } from './meta';\n\nexport const translations = [\n {\n 'en-US': {\n [meta.id]: {\n 'need refresh label': 'Refresh now to get app updates',\n 'need refresh description': 'You’ll need these updates to continue without interruption.',\n 'refresh label': 'Refresh',\n 'refresh alt': 'Click your browser’s refresh button or use the refresh keyboard shortcut.',\n // TODO(wittjosiah): Non-react translation utils.\n // 'offline ready label': '{{appName}} is ready to use offline.',\n 'offline ready label': 'Ready to use offline.',\n 'confirm label': 'Okay',\n },\n },\n },\n] as const satisfies Resource[];\n"],
5
- "mappings": ";;;AAMO,IAAMA,aAAa;AAEnB,IAAMC,OAAmB;EAC9BC,IAAIF;EACJG,MAAM;AACR;;;ACPA,SAASC,kBAAkB;AAE3B,SACEC,cACAC,aACAC,cACAC,cACAC,cACAC,QACAC,oBACK;AACP,SAASC,WAAW;AACpB,SAASC,wBAAwB;;;ACR1B,IAAMC,eAAe;EAC1B;IACE,SAAS;MACP,CAACC,KAAKC,EAAE,GAAG;QACT,sBAAsB;QACtB,4BAA4B;QAC5B,iBAAiB;QACjB,eAAe;;;QAGf,uBAAuB;QACvB,iBAAiB;MACnB;IACF;EACF;;;;;ADDK,IAAMC,YAAY,MACvBC,aAAaC,MAAM;EACjBC,aAAa;IACXC,IAAI,GAAGF,KAAKE,EAAE;IACdC,aAAaC,OAAOC;IACpBC,UAAU,MAAMC,YAAYC,aAAaC,cAAcC,YAAAA;EACzD,CAAA;EACAT,aAAa;IACXC,IAAI,GAAGF,KAAKE,EAAE;IACdC,aAAaC,OAAOO;IACpBL,UAAU,CAACM,YAAAA;AACT,YAAM,EAAEC,iBAAiBC,SAAQ,IAAKF,QAAQG,cAAcP,aAAaQ,gBAAgB;AAEzF,YAAMC,WAAWC,WAAW;QAC1BC,eAAe,MACbL,WACEM,aAAaC,aAAaC,UAAU;UAClCC,MAAM;UACNC,SAAS;YACPtB,IAAI,GAAGuB,UAAAA;YACPC,OAAO;cAAC;cAAsB;gBAAEC,IAAIF;cAAW;;YAC/CG,aAAa;cAAC;cAA4B;gBAAED,IAAIF;cAAW;;YAC3DI,UAAU,IAAI,KAAK;YACnBC,aAAa;cAAC;cAAiB;gBAAEH,IAAIF;cAAW;;YAChDM,WAAW;cAAC;cAAe;gBAAEJ,IAAIF;cAAW;;YAC5CO,UAAU,MAAMf,SAAS,IAAA;UAC3B;QACF,CAAA,CAAA;QAEJgB,gBAAgB,MACdnB,WACEM,aAAaC,aAAaC,UAAU;UAClCC,MAAM;UACNC,SAAS;YACPtB,IAAI,GAAGuB,UAAAA;YACPC,OAAO;cAAC;cAAuB;gBAAEC,IAAIF;cAAW;;YAChDS,YAAY;cAAC;cAAiB;gBAAEP,IAAIF;cAAW;;UACjD;QACF,CAAA,CAAA;QAEJU,iBAAiB,CAACC,QAAAA;AAChBC,2BAAiBD,GAAAA;AACjBE,cAAIC,MAAMH,KAAAA,QAAAA;;;;;;QACZ;MACF,CAAA;AAEA,aAAO7B,YAAYC,aAAagC,MAAM,IAAA;IACxC;EACF,CAAA;CACD;",
6
- "names": ["PWA_PLUGIN", "meta", "id", "name", "registerSW", "Capabilities", "contributes", "createIntent", "defineModule", "definePlugin", "Events", "LayoutAction", "log", "captureException", "translations", "meta", "id", "PwaPlugin", "definePlugin", "meta", "defineModule", "id", "activatesOn", "Events", "SetupTranslations", "activate", "contributes", "Capabilities", "Translations", "translations", "DispatcherReady", "context", "dispatchPromise", "dispatch", "getCapability", "IntentDispatcher", "updateSW", "registerSW", "onNeedRefresh", "createIntent", "LayoutAction", "AddToast", "part", "subject", "PWA_PLUGIN", "title", "ns", "description", "duration", "actionLabel", "actionAlt", "onAction", "onOfflineReady", "closeLabel", "onRegisterError", "err", "captureException", "log", "error", "Null"]
7
- }
@@ -1 +0,0 @@
1
- {"inputs":{"src/meta.ts":{"bytes":875,"imports":[],"format":"esm"},"src/translations.ts":{"bytes":2456,"imports":[{"path":"src/meta.ts","kind":"import-statement","original":"./meta"}],"format":"esm"},"src/PwaPlugin.tsx":{"bytes":9621,"imports":[{"path":"virtual:pwa-register","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/observability/sentry","kind":"import-statement","external":true},{"path":"src/meta.ts","kind":"import-statement","original":"./meta"},{"path":"src/translations.ts","kind":"import-statement","original":"./translations"}],"format":"esm"},"src/index.ts":{"bytes":535,"imports":[{"path":"src/meta.ts","kind":"import-statement","original":"./meta"},{"path":"src/PwaPlugin.tsx","kind":"import-statement","original":"./PwaPlugin"}],"format":"esm"}},"outputs":{"dist/lib/node-esm/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":5581},"dist/lib/node-esm/index.mjs":{"imports":[{"path":"virtual:pwa-register","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/observability/sentry","kind":"import-statement","external":true}],"exports":["PWA_PLUGIN","PwaPlugin","meta"],"entryPoint":"src/index.ts","inputs":{"src/meta.ts":{"bytesInOutput":88},"src/index.ts":{"bytesInOutput":0},"src/PwaPlugin.tsx":{"bytesInOutput":2445},"src/translations.ts":{"bytesInOutput":609}},"bytes":3399}}}