@dxos/plugin-pwa 0.8.4-main.e098934 → 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
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
// src/meta.ts
|
|
2
|
-
|
|
2
|
+
import { trim } from "@dxos/util";
|
|
3
3
|
var meta = {
|
|
4
|
-
id:
|
|
5
|
-
name: "PWA"
|
|
4
|
+
id: "dxos.org/plugin/pwa",
|
|
5
|
+
name: "PWA",
|
|
6
|
+
description: trim`
|
|
7
|
+
Progressive Web App capabilities enabling offline functionality and app-like experience.
|
|
8
|
+
Install to home screen and use the workspace without internet connection.
|
|
9
|
+
`
|
|
6
10
|
};
|
|
7
11
|
|
|
8
12
|
// src/PwaPlugin.tsx
|
|
@@ -31,7 +35,7 @@ var translations = [
|
|
|
31
35
|
|
|
32
36
|
// src/PwaPlugin.tsx
|
|
33
37
|
var __dxlog_file = "/__w/dxos/dxos/packages/plugins/plugin-pwa/src/PwaPlugin.tsx";
|
|
34
|
-
var PwaPlugin = () =>
|
|
38
|
+
var PwaPlugin = definePlugin(meta, () => [
|
|
35
39
|
defineModule({
|
|
36
40
|
id: `${meta.id}/module/translations`,
|
|
37
41
|
activatesOn: Events.SetupTranslations,
|
|
@@ -46,30 +50,30 @@ var PwaPlugin = () => definePlugin(meta, [
|
|
|
46
50
|
onNeedRefresh: () => dispatch?.(createIntent(LayoutAction.AddToast, {
|
|
47
51
|
part: "toast",
|
|
48
52
|
subject: {
|
|
49
|
-
id: `${
|
|
53
|
+
id: `${meta.id}/need-refresh`,
|
|
50
54
|
title: [
|
|
51
55
|
"need refresh label",
|
|
52
56
|
{
|
|
53
|
-
ns:
|
|
57
|
+
ns: meta.id
|
|
54
58
|
}
|
|
55
59
|
],
|
|
56
60
|
description: [
|
|
57
61
|
"need refresh description",
|
|
58
62
|
{
|
|
59
|
-
ns:
|
|
63
|
+
ns: meta.id
|
|
60
64
|
}
|
|
61
65
|
],
|
|
62
66
|
duration: 4 * 60 * 1e3,
|
|
63
67
|
actionLabel: [
|
|
64
68
|
"refresh label",
|
|
65
69
|
{
|
|
66
|
-
ns:
|
|
70
|
+
ns: meta.id
|
|
67
71
|
}
|
|
68
72
|
],
|
|
69
73
|
actionAlt: [
|
|
70
74
|
"refresh alt",
|
|
71
75
|
{
|
|
72
|
-
ns:
|
|
76
|
+
ns: meta.id
|
|
73
77
|
}
|
|
74
78
|
],
|
|
75
79
|
onAction: () => updateSW(true)
|
|
@@ -78,17 +82,17 @@ var PwaPlugin = () => definePlugin(meta, [
|
|
|
78
82
|
onOfflineReady: () => dispatch?.(createIntent(LayoutAction.AddToast, {
|
|
79
83
|
part: "toast",
|
|
80
84
|
subject: {
|
|
81
|
-
id: `${
|
|
85
|
+
id: `${meta.id}/offline-ready`,
|
|
82
86
|
title: [
|
|
83
87
|
"offline ready label",
|
|
84
88
|
{
|
|
85
|
-
ns:
|
|
89
|
+
ns: meta.id
|
|
86
90
|
}
|
|
87
91
|
],
|
|
88
92
|
closeLabel: [
|
|
89
93
|
"confirm label",
|
|
90
94
|
{
|
|
91
|
-
ns:
|
|
95
|
+
ns: meta.id
|
|
92
96
|
}
|
|
93
97
|
]
|
|
94
98
|
}
|
|
@@ -97,7 +101,7 @@ var PwaPlugin = () => definePlugin(meta, [
|
|
|
97
101
|
captureException(err);
|
|
98
102
|
log.error(err, void 0, {
|
|
99
103
|
F: __dxlog_file,
|
|
100
|
-
L:
|
|
104
|
+
L: 63,
|
|
101
105
|
S: void 0,
|
|
102
106
|
C: (f, a) => f(...a)
|
|
103
107
|
});
|
|
@@ -108,7 +112,6 @@ var PwaPlugin = () => definePlugin(meta, [
|
|
|
108
112
|
})
|
|
109
113
|
]);
|
|
110
114
|
export {
|
|
111
|
-
PWA_PLUGIN,
|
|
112
115
|
PwaPlugin,
|
|
113
116
|
meta
|
|
114
117
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
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';\
|
|
5
|
-
"mappings": ";
|
|
6
|
-
"names": ["
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { type PluginMeta } from '@dxos/app-framework';\nimport { trim } from '@dxos/util';\n\nexport const meta: PluginMeta = {\n id: 'dxos.org/plugin/pwa',\n name: 'PWA',\n description: trim`\n Progressive Web App capabilities enabling offline functionality and app-like experience.\n Install to home screen and use the workspace without internet connection.\n `,\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { registerSW } from 'virtual:pwa-register';\n\nimport {\n Capabilities,\n Events,\n LayoutAction,\n contributes,\n createIntent,\n defineModule,\n definePlugin,\n} from '@dxos/app-framework';\nimport { log } from '@dxos/log';\nimport { captureException } from '@dxos/observability/sentry';\n\nimport { meta } from './meta';\nimport { translations } from './translations';\n\nexport const PwaPlugin = 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: `${meta.id}/need-refresh`,\n title: ['need refresh label', { ns: meta.id }],\n description: ['need refresh description', { ns: meta.id }],\n duration: 4 * 60 * 1000, // 4m\n actionLabel: ['refresh label', { ns: meta.id }],\n actionAlt: ['refresh alt', { ns: meta.id }],\n onAction: () => updateSW(true),\n },\n }),\n ),\n onOfflineReady: () =>\n dispatch?.(\n createIntent(LayoutAction.AddToast, {\n part: 'toast',\n subject: {\n id: `${meta.id}/offline-ready`,\n title: ['offline ready label', { ns: meta.id }],\n closeLabel: ['confirm label', { ns: meta.id }],\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": ";AAKA,SAASA,YAAY;AAEd,IAAMC,OAAmB;EAC9BC,IAAI;EACJC,MAAM;EACNC,aAAaC;;;;AAIf;;;ACVA,SAASC,kBAAkB;AAE3B,SACEC,cACAC,QACAC,cACAC,aACAC,cACAC,cACAC,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,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,MAAM,IAAA;IACxC;EACF,CAAA;CACD;",
|
|
6
|
+
"names": ["trim", "meta", "id", "name", "description", "trim", "registerSW", "Capabilities", "Events", "LayoutAction", "contributes", "createIntent", "defineModule", "definePlugin", "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", "title", "ns", "description", "duration", "actionLabel", "actionAlt", "onAction", "onOfflineReady", "closeLabel", "onRegisterError", "err", "captureException", "log", "error", "Null"]
|
|
7
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs":{"src/meta.ts":{"bytes":
|
|
1
|
+
{"inputs":{"src/meta.ts":{"bytes":1387,"imports":[{"path":"@dxos/util","kind":"import-statement","external":true}],"format":"esm"},"src/translations.ts":{"bytes":2456,"imports":[{"path":"src/meta.ts","kind":"import-statement","original":"./meta"}],"format":"esm"},"src/PwaPlugin.tsx":{"bytes":9497,"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/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":5716},"dist/lib/browser/index.mjs":{"imports":[{"path":"@dxos/util","kind":"import-statement","external":true},{"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":["PwaPlugin","meta"],"entryPoint":"src/index.ts","inputs":{"src/meta.ts":{"bytesInOutput":291},"src/index.ts":{"bytesInOutput":0},"src/PwaPlugin.tsx":{"bytesInOutput":2421},"src/translations.ts":{"bytesInOutput":609}},"bytes":3471}}}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const PwaPlugin:
|
|
1
|
+
export declare const PwaPlugin: import("@dxos/app-framework").PluginFactory<void>;
|
|
2
2
|
//# sourceMappingURL=PwaPlugin.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PwaPlugin.d.ts","sourceRoot":"","sources":["../../../src/PwaPlugin.tsx"],"names":[],"mappings":"AAqBA,eAAO,MAAM,SAAS,
|
|
1
|
+
{"version":3,"file":"PwaPlugin.d.ts","sourceRoot":"","sources":["../../../src/PwaPlugin.tsx"],"names":[],"mappings":"AAqBA,eAAO,MAAM,SAAS,mDAgDpB,CAAC"}
|
package/dist/types/src/meta.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"meta.d.ts","sourceRoot":"","sources":["../../../src/meta.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"meta.d.ts","sourceRoot":"","sources":["../../../src/meta.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAGtD,eAAO,MAAM,IAAI,EAAE,UAOlB,CAAC"}
|