@dxos/plugin-pwa 0.8.4-main.bc674ce → 0.8.4-main.c351d160a8

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.
@@ -1,7 +1,7 @@
1
1
  // src/meta.ts
2
2
  import { trim } from "@dxos/util";
3
3
  var meta = {
4
- id: "dxos.org/plugin/pwa",
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,9 +12,9 @@ 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 { Capability, Common, Plugin } from "@dxos/app-framework";
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 { captureException } from "@dxos/observability/sentry";
18
18
 
19
19
  // src/translations.ts
20
20
  var translations = [
@@ -36,17 +36,17 @@ var translations = [
36
36
 
37
37
  // src/PwaPlugin.tsx
38
38
  var __dxlog_file = "/__w/dxos/dxos/packages/plugins/plugin-pwa/src/PwaPlugin.tsx";
39
- var PwaPlugin = Plugin.define(meta).pipe(Common.Plugin.addTranslationsModule({
39
+ var PwaPlugin = Plugin.define(meta).pipe(AppPlugin.addTranslationsModule({
40
40
  translations
41
41
  }), Plugin.addModule({
42
42
  id: "register-pwa",
43
- activatesOn: Common.ActivationEvent.OperationInvokerReady,
43
+ activatesOn: ActivationEvents.OperationInvokerReady,
44
44
  activate: Effect.fnUntraced(function* () {
45
- const { invokeSync } = yield* Capability.get(Common.Capability.OperationInvoker);
45
+ const { invokeSync } = yield* Capability.get(Capabilities.OperationInvoker);
46
46
  const updateSW = registerSW({
47
47
  onNeedRefresh: () => {
48
- invokeSync(Common.LayoutOperation.AddToast, {
49
- id: `${meta.id}/need-refresh`,
48
+ invokeSync(LayoutOperation.AddToast, {
49
+ id: `${meta.id}.need-refresh`,
50
50
  title: [
51
51
  "need refresh label",
52
52
  {
@@ -76,8 +76,8 @@ var PwaPlugin = Plugin.define(meta).pipe(Common.Plugin.addTranslationsModule({
76
76
  });
77
77
  },
78
78
  onOfflineReady: () => {
79
- invokeSync(Common.LayoutOperation.AddToast, {
80
- id: `${meta.id}/offline-ready`,
79
+ invokeSync(LayoutOperation.AddToast, {
80
+ id: `${meta.id}.offline-ready`,
81
81
  title: [
82
82
  "offline ready label",
83
83
  {
@@ -93,10 +93,9 @@ var PwaPlugin = Plugin.define(meta).pipe(Common.Plugin.addTranslationsModule({
93
93
  });
94
94
  },
95
95
  onRegisterError: (err) => {
96
- captureException(err);
97
96
  log.error(err, void 0, {
98
97
  F: __dxlog_file,
99
- L: 44,
98
+ L: 43,
100
99
  S: this,
101
100
  C: (f, a) => f(...a)
102
101
  });
@@ -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.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 * as Effect from 'effect/Effect';\nimport { registerSW } from 'virtual:pwa-register';\n\nimport { Capability, Common, Plugin } 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 = Plugin.define(meta).pipe(\n Common.Plugin.addTranslationsModule({ translations }),\n Plugin.addModule({\n id: 'register-pwa',\n activatesOn: Common.ActivationEvent.OperationInvokerReady,\n activate: Effect.fnUntraced(function* () {\n const { invokeSync } = yield* Capability.get(Common.Capability.OperationInvoker);\n\n const updateSW = registerSW({\n onNeedRefresh: () => {\n invokeSync(Common.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 invokeSync(Common.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 captureException(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,YAAYC,QAAQC,cAAc;AAC3C,SAASC,WAAW;AACpB,SAASC,wBAAwB;;;ACD1B,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;;;;;ADRK,IAAMC,YAAYC,OAAOC,OAAOC,IAAAA,EAAMC,KAC3CC,OAAOJ,OAAOK,sBAAsB;EAAEC;AAAa,CAAA,GACnDN,OAAOO,UAAU;EACfC,IAAI;EACJC,aAAaL,OAAOM,gBAAgBC;EACpCC,UAAiBC,kBAAW,aAAA;AAC1B,UAAM,EAAEC,WAAU,IAAK,OAAOC,WAAWC,IAAIZ,OAAOW,WAAWE,gBAAgB;AAE/E,UAAMC,WAAWC,WAAW;MAC1BC,eAAe,MAAA;AACbN,mBAAWV,OAAOiB,gBAAgBC,UAAU;UAC1Cd,IAAI,GAAGN,KAAKM,EAAE;UACde,OAAO;YAAC;YAAsB;cAAEC,IAAItB,KAAKM;YAAG;;UAC5CiB,aAAa;YAAC;YAA4B;cAAED,IAAItB,KAAKM;YAAG;;UACxDkB,UAAU,IAAI,KAAK;UACnBC,aAAa;YAAC;YAAiB;cAAEH,IAAItB,KAAKM;YAAG;;UAC7CoB,WAAW;YAAC;YAAe;cAAEJ,IAAItB,KAAKM;YAAG;;UACzCqB,UAAU,MAAMX,SAAS,IAAA;QAC3B,CAAA;MACF;MACAY,gBAAgB,MAAA;AACdhB,mBAAWV,OAAOiB,gBAAgBC,UAAU;UAC1Cd,IAAI,GAAGN,KAAKM,EAAE;UACde,OAAO;YAAC;YAAuB;cAAEC,IAAItB,KAAKM;YAAG;;UAC7CuB,YAAY;YAAC;YAAiB;cAAEP,IAAItB,KAAKM;YAAG;;QAC9C,CAAA;MACF;MACAwB,iBAAiB,CAACC,QAAAA;AAChBC,yBAAiBD,GAAAA;AACjBE,YAAIC,MAAMH,KAAAA,QAAAA;;;;;;MACZ;IACF,CAAA;EACF,CAAA;AACF,CAAA,GACAjC,OAAOqC,IAAI;",
6
- "names": ["trim", "meta", "id", "name", "description", "trim", "Effect", "registerSW", "Capability", "Common", "Plugin", "log", "captureException", "translations", "meta", "id", "PwaPlugin", "Plugin", "define", "meta", "pipe", "Common", "addTranslationsModule", "translations", "addModule", "id", "activatesOn", "ActivationEvent", "OperationInvokerReady", "activate", "fnUntraced", "invokeSync", "Capability", "get", "OperationInvoker", "updateSW", "registerSW", "onNeedRefresh", "LayoutOperation", "AddToast", "title", "ns", "description", "duration", "actionLabel", "actionAlt", "onAction", "onOfflineReady", "closeLabel", "onRegisterError", "err", "captureException", "log", "error", "make"]
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 { invokeSync } = yield* Capability.get(Capabilities.OperationInvoker);\n\n const updateSW = registerSW({\n onNeedRefresh: () => {\n invokeSync(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 invokeSync(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;;;ACDb,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;;;;;ADRK,IAAMC,YAAYC,OAAOC,OAAOC,IAAAA,EAAMC,KAC3CC,UAAUC,sBAAsB;EAAEC;AAAa,CAAA,GAC/CN,OAAOO,UAAU;EACfC,IAAI;EACJC,aAAaC,iBAAiBC;EAC9BC,UAAiBC,kBAAW,aAAA;AAC1B,UAAM,EAAEC,WAAU,IAAK,OAAOC,WAAWC,IAAIC,aAAaC,gBAAgB;AAE1E,UAAMC,WAAWC,WAAW;MAC1BC,eAAe,MAAA;AACbP,mBAAWQ,gBAAgBC,UAAU;UACnCf,IAAI,GAAGN,KAAKM,EAAE;UACdgB,OAAO;YAAC;YAAsB;cAAEC,IAAIvB,KAAKM;YAAG;;UAC5CkB,aAAa;YAAC;YAA4B;cAAED,IAAIvB,KAAKM;YAAG;;UACxDmB,UAAU,IAAI,KAAK;UACnBC,aAAa;YAAC;YAAiB;cAAEH,IAAIvB,KAAKM;YAAG;;UAC7CqB,WAAW;YAAC;YAAe;cAAEJ,IAAIvB,KAAKM;YAAG;;UACzCsB,UAAU,MAAMX,SAAS,IAAA;QAC3B,CAAA;MACF;MACAY,gBAAgB,MAAA;AACdjB,mBAAWQ,gBAAgBC,UAAU;UACnCf,IAAI,GAAGN,KAAKM,EAAE;UACdgB,OAAO;YAAC;YAAuB;cAAEC,IAAIvB,KAAKM;YAAG;;UAC7CwB,YAAY;YAAC;YAAiB;cAAEP,IAAIvB,KAAKM;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", "translations", "meta", "id", "PwaPlugin", "Plugin", "define", "meta", "pipe", "AppPlugin", "addTranslationsModule", "translations", "addModule", "id", "activatesOn", "ActivationEvents", "OperationInvokerReady", "activate", "fnUntraced", "invokeSync", "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":2456,"imports":[{"path":"src/meta.ts","kind":"import-statement","original":"./meta"}],"format":"esm"},"src/PwaPlugin.tsx":{"bytes":7645,"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/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":5051},"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/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":2042},"src/translations.ts":{"bytesInOutput":609}},"bytes":3092}}}
1
+ {"inputs":{"src/meta.ts":{"bytes":1383,"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":7490,"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":"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":5013},"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}],"exports":["PwaPlugin","meta"],"entryPoint":"src/index.ts","inputs":{"src/meta.ts":{"bytesInOutput":291},"src/index.ts":{"bytesInOutput":0},"src/PwaPlugin.tsx":{"bytesInOutput":2007},"src/translations.ts":{"bytesInOutput":609}},"bytes":3057}}}
@@ -1 +1 @@
1
- {"version":3,"file":"PwaPlugin.d.ts","sourceRoot":"","sources":["../../../src/PwaPlugin.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAsB,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAOjE,eAAO,MAAM,SAAS,4BAmCrB,CAAC"}
1
+ {"version":3,"file":"PwaPlugin.d.ts","sourceRoot":"","sources":["../../../src/PwaPlugin.tsx"],"names":[],"mappings":"AAOA,OAAO,EAA8C,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAOzF,eAAO,MAAM,SAAS,4BAkCrB,CAAC"}