@dxos/plugin-pwa 0.8.4-main.4a85c3132b → 0.8.4-main.51f1e5ca51
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 +22 -45
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/translations.mjs +22 -0
- package/dist/lib/browser/translations.mjs.map +7 -0
- package/dist/types/src/translations.d.ts +7 -8
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +27 -20
- package/src/PwaPlugin.tsx +13 -13
- package/src/meta.ts +1 -1
- package/src/translations.ts +7 -7
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// src/meta.ts
|
|
2
2
|
import { trim } from "@dxos/util";
|
|
3
3
|
var meta = {
|
|
4
|
-
id: "dxos.
|
|
4
|
+
id: "org.dxos.plugin.pwa",
|
|
5
5
|
name: "PWA",
|
|
6
6
|
description: trim`
|
|
7
7
|
Progressive Web App capabilities enabling offline functionality and app-like experience.
|
|
@@ -15,90 +15,67 @@ import { registerSW } from "virtual:pwa-register";
|
|
|
15
15
|
import { ActivationEvents, Capabilities, Capability, Plugin } from "@dxos/app-framework";
|
|
16
16
|
import { AppPlugin, LayoutOperation } from "@dxos/app-toolkit";
|
|
17
17
|
import { log } from "@dxos/log";
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
var translations = [
|
|
21
|
-
{
|
|
22
|
-
"en-US": {
|
|
23
|
-
[meta.id]: {
|
|
24
|
-
"need refresh label": "Refresh now to get app updates",
|
|
25
|
-
"need refresh description": "You\u2019ll need these updates to continue without interruption.",
|
|
26
|
-
"refresh label": "Refresh",
|
|
27
|
-
"refresh alt": "Click your browser\u2019s refresh button or use the refresh keyboard shortcut.",
|
|
28
|
-
// TODO(wittjosiah): Non-react translation utils.
|
|
29
|
-
// 'offline ready label': '{{appName}} is ready to use offline.',
|
|
30
|
-
"offline ready label": "Ready to use offline.",
|
|
31
|
-
"confirm label": "Okay"
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
];
|
|
36
|
-
|
|
37
|
-
// src/PwaPlugin.tsx
|
|
18
|
+
import { meta as meta2 } from "#meta";
|
|
19
|
+
import { translations } from "#translations";
|
|
38
20
|
var __dxlog_file = "/__w/dxos/dxos/packages/plugins/plugin-pwa/src/PwaPlugin.tsx";
|
|
39
|
-
var PwaPlugin = Plugin.define(
|
|
21
|
+
var PwaPlugin = Plugin.define(meta2).pipe(AppPlugin.addTranslationsModule({
|
|
40
22
|
translations
|
|
41
23
|
}), Plugin.addModule({
|
|
42
24
|
id: "register-pwa",
|
|
43
25
|
activatesOn: ActivationEvents.OperationInvokerReady,
|
|
44
26
|
activate: Effect.fnUntraced(function* () {
|
|
45
|
-
const {
|
|
27
|
+
const { invokePromise } = yield* Capability.get(Capabilities.OperationInvoker);
|
|
46
28
|
const updateSW = registerSW({
|
|
47
29
|
onNeedRefresh: () => {
|
|
48
|
-
|
|
49
|
-
id: `${
|
|
30
|
+
void invokePromise(LayoutOperation.AddToast, {
|
|
31
|
+
id: `${meta2.id}.need-refresh`,
|
|
50
32
|
title: [
|
|
51
|
-
"need
|
|
33
|
+
"need-refresh.label",
|
|
52
34
|
{
|
|
53
|
-
ns:
|
|
35
|
+
ns: meta2.id
|
|
54
36
|
}
|
|
55
37
|
],
|
|
56
38
|
description: [
|
|
57
|
-
"need
|
|
39
|
+
"need-refresh.description",
|
|
58
40
|
{
|
|
59
|
-
ns:
|
|
41
|
+
ns: meta2.id
|
|
60
42
|
}
|
|
61
43
|
],
|
|
62
44
|
duration: 4 * 60 * 1e3,
|
|
63
45
|
actionLabel: [
|
|
64
|
-
"refresh
|
|
46
|
+
"refresh.label",
|
|
65
47
|
{
|
|
66
|
-
ns:
|
|
48
|
+
ns: meta2.id
|
|
67
49
|
}
|
|
68
50
|
],
|
|
69
51
|
actionAlt: [
|
|
70
|
-
"refresh
|
|
52
|
+
"refresh.alt",
|
|
71
53
|
{
|
|
72
|
-
ns:
|
|
54
|
+
ns: meta2.id
|
|
73
55
|
}
|
|
74
56
|
],
|
|
75
57
|
onAction: () => updateSW(true)
|
|
76
58
|
});
|
|
77
59
|
},
|
|
78
60
|
onOfflineReady: () => {
|
|
79
|
-
|
|
80
|
-
id: `${
|
|
61
|
+
void invokePromise(LayoutOperation.AddToast, {
|
|
62
|
+
id: `${meta2.id}.offline-ready`,
|
|
81
63
|
title: [
|
|
82
|
-
"offline
|
|
64
|
+
"offline-ready.label",
|
|
83
65
|
{
|
|
84
|
-
ns:
|
|
66
|
+
ns: meta2.id
|
|
85
67
|
}
|
|
86
68
|
],
|
|
87
69
|
closeLabel: [
|
|
88
|
-
"confirm
|
|
70
|
+
"confirm.label",
|
|
89
71
|
{
|
|
90
|
-
ns:
|
|
72
|
+
ns: meta2.id
|
|
91
73
|
}
|
|
92
74
|
]
|
|
93
75
|
});
|
|
94
76
|
},
|
|
95
77
|
onRegisterError: (err) => {
|
|
96
|
-
log.error(err, void 0, {
|
|
97
|
-
F: __dxlog_file,
|
|
98
|
-
L: 43,
|
|
99
|
-
S: this,
|
|
100
|
-
C: (f, a) => f(...a)
|
|
101
|
-
});
|
|
78
|
+
log.error(err, void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 68, S: this });
|
|
102
79
|
}
|
|
103
80
|
});
|
|
104
81
|
})
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../../src/meta.ts", "../../../src/PwaPlugin.tsx"
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { type Plugin } from '@dxos/app-framework';\nimport { trim } from '@dxos/util';\n\nexport const meta: Plugin.Meta = {\n id: 'dxos.
|
|
5
|
-
"mappings": ";AAKA,SAASA,YAAY;AAEd,IAAMC,OAAoB;EAC/BC,IAAI;EACJC,MAAM;EACNC,
|
|
6
|
-
"names": ["trim", "meta", "id", "name", "description", "
|
|
3
|
+
"sources": ["../../../src/meta.ts", "../../../src/PwaPlugin.tsx"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { type Plugin } from '@dxos/app-framework';\nimport { trim } from '@dxos/util';\n\nexport const meta: Plugin.Meta = {\n id: 'org.dxos.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 * as Effect from 'effect/Effect';\nimport { registerSW } from 'virtual:pwa-register';\n\nimport { ActivationEvents, Capabilities, Capability, Plugin } from '@dxos/app-framework';\nimport { AppPlugin, LayoutOperation } from '@dxos/app-toolkit';\nimport { log } from '@dxos/log';\n\nimport { meta } from '#meta';\nimport { translations } from '#translations';\n\nexport const PwaPlugin = Plugin.define(meta).pipe(\n AppPlugin.addTranslationsModule({ translations }),\n Plugin.addModule({\n id: 'register-pwa',\n activatesOn: ActivationEvents.OperationInvokerReady,\n activate: Effect.fnUntraced(function* () {\n const { invokePromise } = yield* Capability.get(Capabilities.OperationInvoker);\n\n const updateSW = registerSW({\n onNeedRefresh: () => {\n void invokePromise(LayoutOperation.AddToast, {\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 onOfflineReady: () => {\n void invokePromise(LayoutOperation.AddToast, {\n id: `${meta.id}.offline-ready`,\n title: ['offline-ready.label', { ns: meta.id }],\n closeLabel: ['confirm.label', { ns: meta.id }],\n });\n },\n onRegisterError: (err) => {\n log.error(err);\n },\n });\n }),\n }),\n Plugin.make,\n);\n"],
|
|
5
|
+
"mappings": ";AAKA,SAASA,YAAY;AAEd,IAAMC,OAAoB;EAC/BC,IAAI;EACJC,MAAM;EACNC,aAAaJ;;;;AAIf;;;ACVA,YAAYK,YAAY;AACxB,SAASC,kBAAkB;AAE3B,SAASC,kBAAkBC,cAAcC,YAAYC,cAAc;AACnE,SAASC,WAAWC,uBAAuB;AAC3C,SAASC,WAAW;AAEpB,SAASC,QAAAA,aAAY;AACrB,SAASC,oBAAoB;AAE7B,IAAA,eAAaC;AAEXN,IAAOO,YAAU,OAAA,OAAAH,KAAA,EAAA,KAAA,UAAA,sBAAA;EACfI;IACAC,OAAAA,UAAaZ;EACba,IAAAA;eACUC,iBAAkB;YAEpBC,kBAAWhB,aAAW;UAC1BiB,EAAAA,cAAe,IAAA,OAAA,WAAA,IAAA,aAAA,gBAAA;qBACRF,WAAcT;qBACVE,MAAAA;aACPU,cAAO,gBAAA,UAAA;cAAC,GAAAV,MAAA,EAAA;iBAAsB;;YAAc;cAAE,IAAAA,MAAA;YAC9CW;;uBAA0C;;YAAc;cAAE,IAAAX,MAAA;YAC1DY;UACAC;oBAAc,IAAA,KAAA;uBAAiB;;YAAc;cAAE,IAAAb,MAAA;YAC/Cc;;qBAA2B;;YAAc;cAAE,IAAAd,MAAA;YAC3Ce;UACF;UACF,UAAA,MAAA,SAAA,IAAA;QACAC,CAAAA;;sBAEWhB,MAAKI;aACZM,cAAO,gBAAA,UAAA;cAAC,GAAAV,MAAA,EAAA;iBAAuB;;YAAc;cAAE,IAAAA,MAAA;YAC/CiB;;sBAA8B;;YAAc;cAAE,IAAAjB,MAAA;YAChD;UACF;QACAkB,CAAAA;;MAEA,iBAAA,CAAA,QAAA;AACF,YAAA,MAAA,KAAA,QAAA,EAAA,YAAA,YAAA,GAAA,cAAA,GAAA,IAAA,GAAA,KAAA,CAAA;MACF;IAEFtB,CAAAA;;;",
|
|
6
|
+
"names": ["trim", "meta", "id", "name", "description", "Effect", "registerSW", "ActivationEvents", "Capabilities", "Capability", "Plugin", "AppPlugin", "LayoutOperation", "log", "meta", "translations", "PwaPlugin", "addModule", "id", "activatesOn", "activate", "invokePromise", "updateSW", "onNeedRefresh", "title", "description", "duration", "actionLabel", "actionAlt", "onAction", "onOfflineReady", "closeLabel", "onRegisterError"]
|
|
7
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs":{"src/meta.ts":{"bytes":
|
|
1
|
+
{"inputs":{"src/meta.ts":{"bytes":1306,"imports":[{"path":"@dxos/util","kind":"import-statement","external":true}],"format":"esm"},"src/PwaPlugin.tsx":{"bytes":7435,"imports":[{"path":"effect/Effect","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/app-toolkit","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"#meta","kind":"import-statement","external":true},{"path":"#translations","kind":"import-statement","external":true}],"format":"esm"},"src/index.ts":{"bytes":457,"imports":[{"path":"src/meta.ts","kind":"import-statement","original":"./meta"},{"path":"src/PwaPlugin.tsx","kind":"import-statement","original":"./PwaPlugin"}],"format":"esm"},"src/translations.ts":{"bytes":2366,"imports":[{"path":"#meta","kind":"import-statement","external":true}],"format":"esm"}},"outputs":{"dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":3663},"dist/lib/browser/index.mjs":{"imports":[{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"effect/Effect","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/app-toolkit","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"#meta","kind":"import-statement","external":true},{"path":"#translations","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":2074}},"bytes":2469},"dist/lib/browser/translations.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":1106},"dist/lib/browser/translations.mjs":{"imports":[{"path":"#meta","kind":"import-statement","external":true}],"exports":["translations"],"entryPoint":"src/translations.ts","inputs":{"src/translations.ts":{"bytesInOutput":639}},"bytes":731}}}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// src/translations.ts
|
|
2
|
+
import { meta } from "#meta";
|
|
3
|
+
var translations = [
|
|
4
|
+
{
|
|
5
|
+
"en-US": {
|
|
6
|
+
[meta.id]: {
|
|
7
|
+
"need-refresh.label": "Refresh now to get app updates",
|
|
8
|
+
"need-refresh.description": "You\u2019ll need these updates to continue without interruption.",
|
|
9
|
+
"refresh.label": "Refresh",
|
|
10
|
+
"refresh.alt": "Click your browser\u2019s refresh button or use the refresh keyboard shortcut.",
|
|
11
|
+
// TODO(wittjosiah): Non-react translation utils.
|
|
12
|
+
// 'offline ready label': '{{appName}} is ready to use offline.',
|
|
13
|
+
"offline-ready.label": "Ready to use offline.",
|
|
14
|
+
"confirm.label": "Okay"
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
];
|
|
19
|
+
export {
|
|
20
|
+
translations
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=translations.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/translations.ts"],
|
|
4
|
+
"sourcesContent": ["//\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": ";AAMA,SAASA,YAAY;AAEd,IAAMC,eAAe;EAC1B;IACE,SAAS;MACP,CAACD,KAAKE,EAAE,GAAG;QACT,sBAAsB;QACtB,4BAA4B;QAC5B,iBAAiB;QACjB,eAAe;;;QAGf,uBAAuB;QACvB,iBAAiB;MACnB;IACF;EACF;;",
|
|
6
|
+
"names": ["meta", "translations", "id"]
|
|
7
|
+
}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import { meta } from './meta';
|
|
2
1
|
export declare const translations: [{
|
|
3
2
|
readonly 'en-US': {
|
|
4
|
-
readonly [
|
|
5
|
-
readonly 'need
|
|
6
|
-
readonly 'need
|
|
7
|
-
readonly 'refresh
|
|
8
|
-
readonly 'refresh
|
|
9
|
-
readonly 'offline
|
|
10
|
-
readonly 'confirm
|
|
3
|
+
readonly [x: string]: {
|
|
4
|
+
readonly 'need-refresh.label': 'Refresh now to get app updates';
|
|
5
|
+
readonly 'need-refresh.description': 'You\u2019ll need these updates to continue without interruption.';
|
|
6
|
+
readonly 'refresh.label': 'Refresh';
|
|
7
|
+
readonly 'refresh.alt': 'Click your browser\u2019s refresh button or use the refresh keyboard shortcut.';
|
|
8
|
+
readonly 'offline-ready.label': 'Ready to use offline.';
|
|
9
|
+
readonly 'confirm.label': 'Okay';
|
|
11
10
|
};
|
|
12
11
|
};
|
|
13
12
|
}];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"translations.d.ts","sourceRoot":"","sources":["../../../src/translations.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"translations.d.ts","sourceRoot":"","sources":["../../../src/translations.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,YAAY;;;2CAIK,gCAAgC;iDAC1B,kEAA6D;sCACxE,SAAS;oCACX,gFAA2E;4CAGnE,uBAAuB;sCAC7B,MAAM;;;EAIA,CAAC"}
|