@dxos/plugin-pwa 0.8.4-main.937b3ca → 0.8.4-main.9be5663bfe
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 +31 -30
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/types/src/PwaPlugin.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +7 -7
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +18 -14
- package/src/PwaPlugin.tsx +17 -17
- 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.
|
|
@@ -12,23 +12,25 @@ var meta = {
|
|
|
12
12
|
// src/PwaPlugin.tsx
|
|
13
13
|
import * as Effect from "effect/Effect";
|
|
14
14
|
import { registerSW } from "virtual:pwa-register";
|
|
15
|
-
import {
|
|
15
|
+
import { ActivationEvents, Capabilities, Capability, Plugin } from "@dxos/app-framework";
|
|
16
|
+
import { AppPlugin, LayoutOperation } from "@dxos/app-toolkit";
|
|
16
17
|
import { log } from "@dxos/log";
|
|
17
|
-
import {
|
|
18
|
+
import { meta as meta3 } from "#meta";
|
|
18
19
|
|
|
19
20
|
// src/translations.ts
|
|
21
|
+
import { meta as meta2 } from "#meta";
|
|
20
22
|
var translations = [
|
|
21
23
|
{
|
|
22
24
|
"en-US": {
|
|
23
|
-
[
|
|
24
|
-
"need
|
|
25
|
-
"need
|
|
26
|
-
"refresh
|
|
27
|
-
"refresh
|
|
25
|
+
[meta2.id]: {
|
|
26
|
+
"need-refresh.label": "Refresh now to get app updates",
|
|
27
|
+
"need-refresh.description": "You\u2019ll need these updates to continue without interruption.",
|
|
28
|
+
"refresh.label": "Refresh",
|
|
29
|
+
"refresh.alt": "Click your browser\u2019s refresh button or use the refresh keyboard shortcut.",
|
|
28
30
|
// TODO(wittjosiah): Non-react translation utils.
|
|
29
31
|
// 'offline ready label': '{{appName}} is ready to use offline.',
|
|
30
|
-
"offline
|
|
31
|
-
"confirm
|
|
32
|
+
"offline-ready.label": "Ready to use offline.",
|
|
33
|
+
"confirm.label": "Okay"
|
|
32
34
|
}
|
|
33
35
|
}
|
|
34
36
|
}
|
|
@@ -36,64 +38,63 @@ var translations = [
|
|
|
36
38
|
|
|
37
39
|
// src/PwaPlugin.tsx
|
|
38
40
|
var __dxlog_file = "/__w/dxos/dxos/packages/plugins/plugin-pwa/src/PwaPlugin.tsx";
|
|
39
|
-
var PwaPlugin = Plugin.define(
|
|
41
|
+
var PwaPlugin = Plugin.define(meta3).pipe(AppPlugin.addTranslationsModule({
|
|
40
42
|
translations
|
|
41
43
|
}), Plugin.addModule({
|
|
42
44
|
id: "register-pwa",
|
|
43
|
-
activatesOn:
|
|
45
|
+
activatesOn: ActivationEvents.OperationInvokerReady,
|
|
44
46
|
activate: Effect.fnUntraced(function* () {
|
|
45
|
-
const {
|
|
47
|
+
const { invokePromise } = yield* Capability.get(Capabilities.OperationInvoker);
|
|
46
48
|
const updateSW = registerSW({
|
|
47
49
|
onNeedRefresh: () => {
|
|
48
|
-
|
|
49
|
-
id: `${
|
|
50
|
+
void invokePromise(LayoutOperation.AddToast, {
|
|
51
|
+
id: `${meta3.id}.need-refresh`,
|
|
50
52
|
title: [
|
|
51
|
-
"need
|
|
53
|
+
"need-refresh.label",
|
|
52
54
|
{
|
|
53
|
-
ns:
|
|
55
|
+
ns: meta3.id
|
|
54
56
|
}
|
|
55
57
|
],
|
|
56
58
|
description: [
|
|
57
|
-
"need
|
|
59
|
+
"need-refresh.description",
|
|
58
60
|
{
|
|
59
|
-
ns:
|
|
61
|
+
ns: meta3.id
|
|
60
62
|
}
|
|
61
63
|
],
|
|
62
64
|
duration: 4 * 60 * 1e3,
|
|
63
65
|
actionLabel: [
|
|
64
|
-
"refresh
|
|
66
|
+
"refresh.label",
|
|
65
67
|
{
|
|
66
|
-
ns:
|
|
68
|
+
ns: meta3.id
|
|
67
69
|
}
|
|
68
70
|
],
|
|
69
71
|
actionAlt: [
|
|
70
|
-
"refresh
|
|
72
|
+
"refresh.alt",
|
|
71
73
|
{
|
|
72
|
-
ns:
|
|
74
|
+
ns: meta3.id
|
|
73
75
|
}
|
|
74
76
|
],
|
|
75
77
|
onAction: () => updateSW(true)
|
|
76
78
|
});
|
|
77
79
|
},
|
|
78
80
|
onOfflineReady: () => {
|
|
79
|
-
|
|
80
|
-
id: `${
|
|
81
|
+
void invokePromise(LayoutOperation.AddToast, {
|
|
82
|
+
id: `${meta3.id}.offline-ready`,
|
|
81
83
|
title: [
|
|
82
|
-
"offline
|
|
84
|
+
"offline-ready.label",
|
|
83
85
|
{
|
|
84
|
-
ns:
|
|
86
|
+
ns: meta3.id
|
|
85
87
|
}
|
|
86
88
|
],
|
|
87
89
|
closeLabel: [
|
|
88
|
-
"confirm
|
|
90
|
+
"confirm.label",
|
|
89
91
|
{
|
|
90
|
-
ns:
|
|
92
|
+
ns: meta3.id
|
|
91
93
|
}
|
|
92
94
|
]
|
|
93
95
|
});
|
|
94
96
|
},
|
|
95
97
|
onRegisterError: (err) => {
|
|
96
|
-
captureException(err);
|
|
97
98
|
log.error(err, void 0, {
|
|
98
99
|
F: __dxlog_file,
|
|
99
100
|
L: 44,
|
|
@@ -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 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,aAAaC;;;;AAIf;;;ACVA,YAAYC,YAAY;AACxB,SAASC,kBAAkB;AAE3B,SAASC,YAAYC,
|
|
6
|
-
"names": ["trim", "meta", "id", "name", "description", "trim", "Effect", "registerSW", "
|
|
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';\n\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", "//\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,OAAoB;EAC/BC,IAAI;EACJC,MAAM;EACNC,aAAaC;;;;AAIf;;;ACVA,YAAYC,YAAY;AACxB,SAASC,kBAAkB;AAE3B,SAASC,kBAAkBC,cAAcC,YAAYC,cAAc;AACnE,SAASC,WAAWC,uBAAuB;AAC3C,SAASC,WAAW;AAEpB,SAASC,QAAAA,aAAY;;;ACLrB,SAASC,QAAAA,aAAY;AAEd,IAAMC,eAAe;EAC1B;IACE,SAAS;MACP,CAACC,MAAKC,EAAE,GAAG;QACT,sBAAsB;QACtB,4BAA4B;QAC5B,iBAAiB;QACjB,eAAe;;;QAGf,uBAAuB;QACvB,iBAAiB;MACnB;IACF;EACF;;;;;ADPK,IAAMC,YAAYC,OAAOC,OAAOC,KAAAA,EAAMC,KAC3CC,UAAUC,sBAAsB;EAAEC;AAAa,CAAA,GAC/CN,OAAOO,UAAU;EACfC,IAAI;EACJC,aAAaC,iBAAiBC;EAC9BC,UAAiBC,kBAAW,aAAA;AAC1B,UAAM,EAAEC,cAAa,IAAK,OAAOC,WAAWC,IAAIC,aAAaC,gBAAgB;AAE7E,UAAMC,WAAWC,WAAW;MAC1BC,eAAe,MAAA;AACb,aAAKP,cAAcQ,gBAAgBC,UAAU;UAC3Cf,IAAI,GAAGN,MAAKM,EAAE;UACdgB,OAAO;YAAC;YAAsB;cAAEC,IAAIvB,MAAKM;YAAG;;UAC5CkB,aAAa;YAAC;YAA4B;cAAED,IAAIvB,MAAKM;YAAG;;UACxDmB,UAAU,IAAI,KAAK;UACnBC,aAAa;YAAC;YAAiB;cAAEH,IAAIvB,MAAKM;YAAG;;UAC7CqB,WAAW;YAAC;YAAe;cAAEJ,IAAIvB,MAAKM;YAAG;;UACzCsB,UAAU,MAAMX,SAAS,IAAA;QAC3B,CAAA;MACF;MACAY,gBAAgB,MAAA;AACd,aAAKjB,cAAcQ,gBAAgBC,UAAU;UAC3Cf,IAAI,GAAGN,MAAKM,EAAE;UACdgB,OAAO;YAAC;YAAuB;cAAEC,IAAIvB,MAAKM;YAAG;;UAC7CwB,YAAY;YAAC;YAAiB;cAAEP,IAAIvB,MAAKM;YAAG;;QAC9C,CAAA;MACF;MACAyB,iBAAiB,CAACC,QAAAA;AAChBC,YAAIC,MAAMF,KAAAA,QAAAA;;;;;;MACZ;IACF,CAAA;EACF,CAAA;AACF,CAAA,GACAlC,OAAOqC,IAAI;",
|
|
6
|
+
"names": ["trim", "meta", "id", "name", "description", "trim", "Effect", "registerSW", "ActivationEvents", "Capabilities", "Capability", "Plugin", "AppPlugin", "LayoutOperation", "log", "meta", "meta", "translations", "meta", "id", "PwaPlugin", "Plugin", "define", "meta", "pipe", "AppPlugin", "addTranslationsModule", "translations", "addModule", "id", "activatesOn", "ActivationEvents", "OperationInvokerReady", "activate", "fnUntraced", "invokePromise", "Capability", "get", "Capabilities", "OperationInvoker", "updateSW", "registerSW", "onNeedRefresh", "LayoutOperation", "AddToast", "title", "ns", "description", "duration", "actionLabel", "actionAlt", "onAction", "onOfflineReady", "closeLabel", "onRegisterError", "err", "log", "error", "make"]
|
|
7
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs":{"src/meta.ts":{"bytes":1383,"imports":[{"path":"@dxos/util","kind":"import-statement","external":true}],"format":"esm"},"src/translations.ts":{"bytes":
|
|
1
|
+
{"inputs":{"src/meta.ts":{"bytes":1383,"imports":[{"path":"@dxos/util","kind":"import-statement","external":true}],"format":"esm"},"src/translations.ts":{"bytes":2451,"imports":[{"path":"#meta","kind":"import-statement","external":true}],"format":"esm"},"src/PwaPlugin.tsx":{"bytes":7552,"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":"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":5105},"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":"#meta","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},"src/translations.ts":{"bytesInOutput":649}},"bytes":3164}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PwaPlugin.d.ts","sourceRoot":"","sources":["../../../src/PwaPlugin.tsx"],"names":[],"mappings":"AAOA,OAAO,
|
|
1
|
+
{"version":3,"file":"PwaPlugin.d.ts","sourceRoot":"","sources":["../../../src/PwaPlugin.tsx"],"names":[],"mappings":"AAOA,OAAO,EAA8C,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAQzF,eAAO,MAAM,SAAS,4BAkCrB,CAAC"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { meta } from '
|
|
1
|
+
import { meta } from '#meta';
|
|
2
2
|
export declare const translations: [{
|
|
3
3
|
readonly 'en-US': {
|
|
4
4
|
readonly [meta.id]: {
|
|
5
|
-
readonly 'need
|
|
6
|
-
readonly 'need
|
|
7
|
-
readonly 'refresh
|
|
8
|
-
readonly 'refresh
|
|
9
|
-
readonly 'offline
|
|
10
|
-
readonly 'confirm
|
|
5
|
+
readonly 'need-refresh.label': "Refresh now to get app updates";
|
|
6
|
+
readonly 'need-refresh.description': "You’ll need these updates to continue without interruption.";
|
|
7
|
+
readonly 'refresh.label': "Refresh";
|
|
8
|
+
readonly 'refresh.alt': "Click your browser’s refresh button or use the refresh keyboard shortcut.";
|
|
9
|
+
readonly 'offline-ready.label': "Ready to use offline.";
|
|
10
|
+
readonly 'confirm.label': "Okay";
|
|
11
11
|
};
|
|
12
12
|
};
|
|
13
13
|
}];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"translations.d.ts","sourceRoot":"","sources":["../../../src/translations.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,IAAI,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"translations.d.ts","sourceRoot":"","sources":["../../../src/translations.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAE7B,eAAO,MAAM,YAAY;;QAGnB,SAAA,CAAC,IAAI,CAAC,EAAE,CAAC;;;;;;;UASR;;EAGwB,CAAC"}
|