@dxos/plugin-native 0.8.2-main.f11618f → 0.8.2-staging.42af850

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.
@@ -12,7 +12,7 @@ var NativePlugin = () => definePlugin(meta, [
12
12
  id: `${meta.id}/module/startup`,
13
13
  activatesOn: Events.DispatcherReady,
14
14
  activate: async (context) => {
15
- const { initializeNativeApp } = await import("./initialize-NE33RD7P.mjs");
15
+ const { initializeNativeApp } = await import("./initialize-OGKEIRPC.mjs");
16
16
  await initializeNativeApp(context);
17
17
  return [];
18
18
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/meta.ts", "../../../src/NativePlugin.tsx"],
4
- "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { type PluginMeta } from '@dxos/app-framework';\n\nexport const NATIVE_PLUGIN = 'dxos.org/plugin/native';\n\nexport const meta: PluginMeta = {\n id: NATIVE_PLUGIN,\n name: 'Native',\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport type { PluginsContext } from '@dxos/app-framework';\nimport { definePlugin, Events, defineModule } from '@dxos/app-framework';\n\nimport { meta } from './meta';\n\n// TODO(burdon): Initial url has index.html, which must be caught/redirected.\n\nexport const NativePlugin = () =>\n definePlugin(meta, [\n defineModule({\n id: `${meta.id}/module/startup`,\n activatesOn: Events.DispatcherReady,\n activate: async (context: PluginsContext) => {\n const { initializeNativeApp } = await import('./initialize');\n await initializeNativeApp(context);\n return [];\n },\n }),\n ]);\n"],
4
+ "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { type PluginMeta } from '@dxos/app-framework';\n\nexport const NATIVE_PLUGIN = 'dxos.org/plugin/native';\n\nexport const meta: PluginMeta = {\n id: NATIVE_PLUGIN,\n name: 'Native',\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport type { PluginContext } from '@dxos/app-framework';\nimport { definePlugin, Events, defineModule } from '@dxos/app-framework';\n\nimport { meta } from './meta';\n\n// TODO(burdon): Initial url has index.html, which must be caught/redirected.\n\nexport const NativePlugin = () =>\n definePlugin(meta, [\n defineModule({\n id: `${meta.id}/module/startup`,\n activatesOn: Events.DispatcherReady,\n activate: async (context: PluginContext) => {\n const { initializeNativeApp } = await import('./initialize');\n await initializeNativeApp(context);\n return [];\n },\n }),\n ]);\n"],
5
5
  "mappings": ";AAMO,IAAMA,gBAAgB;AAEtB,IAAMC,OAAmB;EAC9BC,IAAIF;EACJG,MAAM;AACR;;;ACNA,SAASC,cAAcC,QAAQC,oBAAoB;AAM5C,IAAMC,eAAe,MAC1BC,aAAaC,MAAM;EACjBC,aAAa;IACXC,IAAI,GAAGF,KAAKE,EAAE;IACdC,aAAaC,OAAOC;IACpBC,UAAU,OAAOC,YAAAA;AACf,YAAM,EAAEC,oBAAmB,IAAK,MAAM,OAAO,2BAAA;AAC7C,YAAMA,oBAAoBD,OAAAA;AAC1B,aAAO,CAAA;IACT;EACF,CAAA;CACD;",
6
6
  "names": ["NATIVE_PLUGIN", "meta", "id", "name", "definePlugin", "Events", "defineModule", "NativePlugin", "definePlugin", "meta", "defineModule", "id", "activatesOn", "Events", "DispatcherReady", "activate", "context", "initializeNativeApp"]
7
7
  }
@@ -144,7 +144,7 @@ var setupGlobalHotkey = async (socketWindow, appWindow, dispatch) => {
144
144
  };
145
145
  var initializeNativeApp = async (context) => {
146
146
  const { app, socketWindow, socketOs, appName } = await loadSocketSupplyModules();
147
- const { dispatchPromise: dispatch } = context.requestCapability(Capabilities.IntentDispatcher);
147
+ const { dispatchPromise: dispatch } = context.getCapability(Capabilities.IntentDispatcher);
148
148
  const platform = socketOs.platform();
149
149
  document.body.setAttribute("data-platform", platform);
150
150
  if (platform === "darwin" || platform === "win32") {
@@ -158,4 +158,4 @@ var initializeNativeApp = async (context) => {
158
158
  export {
159
159
  initializeNativeApp
160
160
  };
161
- //# sourceMappingURL=initialize-NE33RD7P.mjs.map
161
+ //# sourceMappingURL=initialize-OGKEIRPC.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/initialize.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport type { PluginContext } from '@dxos/app-framework';\nimport { SettingsAction, LayoutAction, createIntent, Capabilities } from '@dxos/app-framework';\nimport { HELP_PLUGIN } from '@dxos/plugin-help';\nimport { COMMANDS_DIALOG } from '@dxos/plugin-navtree';\nimport { safeParseJson } from '@dxos/util';\n\n// TODO(burdon): Reconcile with other properties.\nconst KEY_WINDOW_SIZE = 'dxos.org/plugin/native/window-size';\n\n/**\n * Native code for socketsupply app.\n * https://www.npmjs.com/package/@socketsupply/socket\n * https://github.com/socketsupply/socket-examples\n */\n\nconst loadSocketSupplyModules = async () => {\n // SocketSupply implements the dynamic import.\n const module = 'socket:application';\n const app = await import(/* @vite-ignore */ module);\n const windowModule = 'socket:window';\n const socketWindow = await import(/* @vite-ignore */ windowModule);\n const osModule = 'socket:os';\n const socketOs = await import(/* @vite-ignore */ osModule);\n const { meta_title: appName } = app.config;\n\n return { app, socketWindow, socketOs, appName };\n};\n\nconst configureDesktopWindowSizing = async (app: any) => {\n const { width, height } = safeParseJson<{ width?: number; height?: number }>(\n localStorage.getItem(KEY_WINDOW_SIZE),\n {},\n );\n\n if (width && height) {\n const appWindow = await app.getCurrentWindow();\n await appWindow.setSize({ width, height });\n }\n\n window.addEventListener('resize', async () => {\n const appWindow = await app.getCurrentWindow();\n const { width, height } = appWindow.getSize();\n localStorage.setItem(KEY_WINDOW_SIZE, JSON.stringify({ width, height }));\n });\n};\n\nconst configureSystemMenu = async (app: any, appName: string) => {\n const itemsMac = `\n Hide ${appName}: h + CommandOrControl\n Hide Others: h + Control + Meta\n ---\n `;\n\n // TODO(mjamesderocher) Change menu names to use translations\n const menu = `\n App Name:\n About ${appName}: _\n Settings...: , + CommandOrControl\n ---\n Show shortcuts: / + CommandOrControl\n Search commands: k + CommandOrControl\n ---\n ${itemsMac}\n Quit: q + CommandOrControl\n ;\n\n Edit:\n Cut: x + CommandOrControl\n Copy: c + CommandOrControl\n Paste: v + CommandOrControl\n Delete: _\n Select All: a + CommandOrControl\n ;\n `;\n\n void app.setSystemMenu({ index: 0, value: menu });\n};\n\nconst setupMenuItemListener = (dispatch: any, app: any) => {\n window.addEventListener('menuItemSelected', async (event: any) => {\n const id = `${event.detail.parent}:${event.detail.title}`;\n switch (id) {\n case 'App Name:Search commands': {\n void dispatch(\n createIntent(LayoutAction.UpdateDialog, {\n part: 'dialog',\n subject: COMMANDS_DIALOG,\n options: {\n blockAlign: 'start',\n },\n }),\n );\n break;\n }\n case 'App Name:Settings...': {\n void dispatch(createIntent(SettingsAction.Open));\n break;\n }\n case 'App Name:Show shortcuts': {\n void dispatch(\n createIntent(LayoutAction.UpdateDialog, {\n part: 'dialog',\n subject: `${HELP_PLUGIN}/Shortcuts`,\n options: {\n blockAlign: 'center',\n },\n }),\n );\n break;\n }\n case 'App Name:Quit': {\n await app.exit();\n break;\n }\n }\n });\n};\n\nconst setupApplicationUrlListener = (app: any, dispatch: any) => {\n const appWindow = app.getCurrentWindow();\n\n // applicationurl is a custom event fired by the Socket Supply Runtime:\n // https://github.com/socketsupply/socket/blob/ef7fb5559876e41062d5896aafb7b79989fc96e5/api/internal/events.js#L6\n window.addEventListener('applicationurl', ({ url }: any) => {\n appWindow.restore();\n const location = url.toString().replace('composer://', '');\n if (location.includes('InvitationCode')) {\n // TODO(mjamesderocher): Integrate this with app routing.\n // Currently, the dialogs are controlled by Client Plugin and not the Layout Plugin.\n window.location.href = location;\n } else {\n // TODO(thure): What is `location` and is this right?\n void dispatch(createIntent(LayoutAction.Open, { part: 'main', subject: [location] }));\n }\n });\n};\n\nconst setupGlobalHotkey = async (socketWindow: any, appWindow: any, dispatch: any) => {\n const binding = await socketWindow.hotkey.bind('cmd + k');\n\n // Global hotkey listener\n binding.addEventListener('hotkey', () => {\n appWindow.restore();\n void dispatch(\n createIntent(LayoutAction.UpdateDialog, {\n part: 'dialog',\n subject: COMMANDS_DIALOG,\n options: {\n blockAlign: 'start',\n },\n }),\n );\n });\n};\n\nexport const initializeNativeApp = async (context: PluginContext) => {\n const { app, socketWindow, socketOs, appName } = await loadSocketSupplyModules();\n const { dispatchPromise: dispatch } = context.getCapability(Capabilities.IntentDispatcher);\n\n const platform = socketOs.platform();\n\n document.body.setAttribute('data-platform', platform);\n\n if (platform === 'darwin' || platform === 'win32') {\n await configureDesktopWindowSizing(app);\n await configureSystemMenu(app, appName);\n setupMenuItemListener(dispatch, app);\n setupApplicationUrlListener(app, dispatch);\n await setupGlobalHotkey(socketWindow, app, dispatch);\n }\n};\n"],
5
+ "mappings": ";AAKA,SAASA,gBAAgBC,cAAcC,cAAcC,oBAAoB;AACzE,SAASC,mBAAmB;AAC5B,SAASC,uBAAuB;AAChC,SAASC,qBAAqB;AAG9B,IAAMC,kBAAkB;AAQxB,IAAMC,0BAA0B,YAAA;AAE9B,QAAMC,SAAS;AACf,QAAMC,MAAM,MAAM;;IAA0BD;;AAC5C,QAAME,eAAe;AACrB,QAAMC,eAAe,MAAM;;IAA0BD;;AACrD,QAAME,WAAW;AACjB,QAAMC,WAAW,MAAM;;IAA0BD;;AACjD,QAAM,EAAEE,YAAYC,QAAO,IAAKN,IAAIO;AAEpC,SAAO;IAAEP;IAAKE;IAAcE;IAAUE;EAAQ;AAChD;AAEA,IAAME,+BAA+B,OAAOR,QAAAA;AAC1C,QAAM,EAAES,OAAOC,OAAM,IAAKC,cACxBC,aAAaC,QAAQhB,eAAAA,GACrB,CAAC,CAAA;AAGH,MAAIY,SAASC,QAAQ;AACnB,UAAMI,YAAY,MAAMd,IAAIe,iBAAgB;AAC5C,UAAMD,UAAUE,QAAQ;MAAEP;MAAOC;IAAO,CAAA;EAC1C;AAEAO,SAAOC,iBAAiB,UAAU,YAAA;AAChC,UAAMJ,YAAY,MAAMd,IAAIe,iBAAgB;AAC5C,UAAM,EAAEN,OAAAA,QA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AAQ,eAAe,EAAA;AACvD,QAAIF,SAASG,SAAS,gBAAA,GAAmB;AAGvCrC,aAAOkC,SAASI,OAAOJ;IACzB,OAAO;AAEL,WAAKrB,SAASM,aAAaC,aAAaQ,MAAM;QAAEN,MAAM;QAAQC,SAAS;UAACW;;MAAU,CAAA,CAAA;IACpF;EACF,CAAA;AACF;AAEA,IAAMK,oBAAoB,OAAOtD,cAAmBY,WAAgBgB,aAAAA;AAClE,QAAM2B,UAAU,MAAMvD,aAAawD,OAAOC,KAAK,SAAA;AAG/CF,UAAQvC,iBAAiB,UAAU,MAAA;AACjCJ,cAAUoC,QAAO;AACjB,SAAKpB,SACHM,aAAaC,aAAaC,cAAc;MACtCC,MAAM;MACNC,SAASC;MACTC,SAAS;QACPC,YAAY;MACd;IACF,CAAA,CAAA;EAEJ,CAAA;AACF;AAEO,IAAMiB,sBAAsB,OAAOC,YAAAA;AACxC,QAAM,EAAE7D,KAAKE,cAAcE,UAAUE,QAAO,IAAK,MAAMR,wBAAAA;AACvD,QAAM,EAAEgE,iBAAiBhC,SAAQ,IAAK+B,QAAQE,cAAcC,aAAaC,gBAAgB;AAEzF,QAAMC,WAAW9D,SAAS8D,SAAQ;AAElCC,WAASC,KAAKC,aAAa,iBAAiBH,QAAAA;AAE5C,MAAIA,aAAa,YAAYA,aAAa,SAAS;AACjD,UAAM1D,6BAA6BR,GAAAA;AACnC,UAAMuB,oBAAoBvB,KAAKM,OAAAA;AAC/BuB,0BAAsBC,UAAU9B,GAAAA;AAChCgD,gCAA4BhD,KAAK8B,QAAAA;AACjC,UAAM0B,kBAAkBtD,cAAcF,KAAK8B,QAAAA;EAC7C;AACF;",
6
+ "names": ["SettingsAction", "LayoutAction", "createIntent", "Capabilities", "HELP_PLUGIN", "COMMANDS_DIALOG", "safeParseJson", "KEY_WINDOW_SIZE", "loadSocketSupplyModules", "module", "app", "windowModule", "socketWindow", "osModule", "socketOs", "meta_title", "appName", "config", "configureDesktopWindowSizing", "width", "height", "safeParseJson", "localStorage", "getItem", "appWindow", "getCurrentWindow", "setSize", "window", "addEventListener", "getSize", "setItem", "JSON", "stringify", "configureSystemMenu", "itemsMac", "menu", "setSystemMenu", "index", "value", "setupMenuItemListener", "dispatch", "event", "id", "detail", "parent", "title", "createIntent", "LayoutAction", "UpdateDialog", "part", "subject", "COMMANDS_DIALOG", "options", "blockAlign", "SettingsAction", "Open", "HELP_PLUGIN", "exit", "setupApplicationUrlListener", "url", "restore", "location", "toString", "replace", "includes", "href", "setupGlobalHotkey", "binding", "hotkey", "bind", "initializeNativeApp", "context", "dispatchPromise", "getCapability", "Capabilities", "IntentDispatcher", "platform", "document", "body", "setAttribute"]
7
+ }
@@ -1 +1 @@
1
- {"inputs":{"packages/plugins/plugin-native/src/meta.ts":{"bytes":963,"imports":[],"format":"esm"},"packages/plugins/plugin-native/src/initialize.ts":{"bytes":19074,"imports":[{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/plugin-help","kind":"import-statement","external":true},{"path":"@dxos/plugin-navtree","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true}],"format":"esm"},"packages/plugins/plugin-native/src/NativePlugin.tsx":{"bytes":2514,"imports":[{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-native/src/meta.ts","kind":"import-statement","original":"./meta"},{"path":"packages/plugins/plugin-native/src/initialize.ts","kind":"dynamic-import","original":"./initialize"}],"format":"esm"},"packages/plugins/plugin-native/src/index.ts":{"bytes":594,"imports":[{"path":"packages/plugins/plugin-native/src/meta.ts","kind":"import-statement","original":"./meta"},{"path":"packages/plugins/plugin-native/src/NativePlugin.tsx","kind":"import-statement","original":"./NativePlugin"}],"format":"esm"}},"outputs":{"packages/plugins/plugin-native/dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":1609},"packages/plugins/plugin-native/dist/lib/browser/index.mjs":{"imports":[{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-native/dist/lib/browser/initialize-NE33RD7P.mjs","kind":"dynamic-import"}],"exports":["NATIVE_PLUGIN","NativePlugin","meta"],"entryPoint":"packages/plugins/plugin-native/src/index.ts","inputs":{"packages/plugins/plugin-native/src/meta.ts":{"bytesInOutput":100},"packages/plugins/plugin-native/src/index.ts":{"bytesInOutput":0},"packages/plugins/plugin-native/src/NativePlugin.tsx":{"bytesInOutput":405}},"bytes":694},"packages/plugins/plugin-native/dist/lib/browser/initialize-NE33RD7P.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":9462},"packages/plugins/plugin-native/dist/lib/browser/initialize-NE33RD7P.mjs":{"imports":[{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/plugin-help","kind":"import-statement","external":true},{"path":"@dxos/plugin-navtree","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true}],"exports":["initializeNativeApp"],"entryPoint":"packages/plugins/plugin-native/src/initialize.ts","inputs":{"packages/plugins/plugin-native/src/initialize.ts":{"bytesInOutput":4504}},"bytes":4639}}}
1
+ {"inputs":{"packages/plugins/plugin-native/src/meta.ts":{"bytes":927,"imports":[],"format":"esm"},"packages/plugins/plugin-native/src/initialize.ts":{"bytes":18786,"imports":[{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/plugin-help","kind":"import-statement","external":true},{"path":"@dxos/plugin-navtree","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true}],"format":"esm"},"packages/plugins/plugin-native/src/NativePlugin.tsx":{"bytes":2458,"imports":[{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-native/src/meta.ts","kind":"import-statement","original":"./meta"},{"path":"packages/plugins/plugin-native/src/initialize.ts","kind":"dynamic-import","original":"./initialize"}],"format":"esm"},"packages/plugins/plugin-native/src/index.ts":{"bytes":562,"imports":[{"path":"packages/plugins/plugin-native/src/meta.ts","kind":"import-statement","original":"./meta"},{"path":"packages/plugins/plugin-native/src/NativePlugin.tsx","kind":"import-statement","original":"./NativePlugin"}],"format":"esm"}},"outputs":{"packages/plugins/plugin-native/dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":1607},"packages/plugins/plugin-native/dist/lib/browser/index.mjs":{"imports":[{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-native/dist/lib/browser/initialize-OGKEIRPC.mjs","kind":"dynamic-import"}],"exports":["NATIVE_PLUGIN","NativePlugin","meta"],"entryPoint":"packages/plugins/plugin-native/src/index.ts","inputs":{"packages/plugins/plugin-native/src/meta.ts":{"bytesInOutput":100},"packages/plugins/plugin-native/src/index.ts":{"bytesInOutput":0},"packages/plugins/plugin-native/src/NativePlugin.tsx":{"bytesInOutput":405}},"bytes":694},"packages/plugins/plugin-native/dist/lib/browser/initialize-OGKEIRPC.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":9450},"packages/plugins/plugin-native/dist/lib/browser/initialize-OGKEIRPC.mjs":{"imports":[{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/plugin-help","kind":"import-statement","external":true},{"path":"@dxos/plugin-navtree","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true}],"exports":["initializeNativeApp"],"entryPoint":"packages/plugins/plugin-native/src/initialize.ts","inputs":{"packages/plugins/plugin-native/src/initialize.ts":{"bytesInOutput":4500}},"bytes":4635}}}
@@ -1,3 +1,3 @@
1
- import type { PluginsContext } from '@dxos/app-framework';
2
- export declare const initializeNativeApp: (context: PluginsContext) => Promise<void>;
1
+ import type { PluginContext } from '@dxos/app-framework';
2
+ export declare const initializeNativeApp: (context: PluginContext) => Promise<void>;
3
3
  //# sourceMappingURL=initialize.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"initialize.d.ts","sourceRoot":"","sources":["../../../src/initialize.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AA2J1D,eAAO,MAAM,mBAAmB,YAAmB,cAAc,kBAehE,CAAC"}
1
+ {"version":3,"file":"initialize.d.ts","sourceRoot":"","sources":["../../../src/initialize.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AA2JzD,eAAO,MAAM,mBAAmB,GAAU,SAAS,aAAa,kBAe/D,CAAC"}
@@ -1 +1 @@
1
- {"version":"5.7.3"}
1
+ {"version":"5.8.3"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dxos/plugin-native",
3
- "version": "0.8.2-main.f11618f",
3
+ "version": "0.8.2-staging.42af850",
4
4
  "description": "Composer plugin that runs when on a native device.",
5
5
  "homepage": "https://dxos.org",
6
6
  "bugs": "https://github.com/dxos/dxos/issues",
@@ -23,15 +23,20 @@
23
23
  "src"
24
24
  ],
25
25
  "dependencies": {
26
- "@dxos/app-framework": "0.8.2-main.f11618f",
27
- "@dxos/log": "0.8.2-main.f11618f",
28
- "@dxos/plugin-help": "0.8.2-main.f11618f",
29
- "@dxos/plugin-navtree": "0.8.2-main.f11618f",
30
- "@dxos/util": "0.8.2-main.f11618f"
26
+ "@preact-signals/safe-react": "^0.9.0",
27
+ "effect": "^3.13.3",
28
+ "@dxos/plugin-navtree": "0.8.2-staging.42af850",
29
+ "@dxos/app-framework": "0.8.2-staging.42af850",
30
+ "@dxos/util": "0.8.2-staging.42af850",
31
+ "@dxos/plugin-help": "0.8.2-staging.42af850",
32
+ "@dxos/log": "0.8.2-staging.42af850"
31
33
  },
32
34
  "devDependencies": {
33
35
  "vite": "5.4.7"
34
36
  },
37
+ "peerDependencies": {
38
+ "effect": "^3.13.3"
39
+ },
35
40
  "publishConfig": {
36
41
  "access": "public"
37
42
  }
@@ -2,7 +2,7 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
- import type { PluginsContext } from '@dxos/app-framework';
5
+ import type { PluginContext } from '@dxos/app-framework';
6
6
  import { definePlugin, Events, defineModule } from '@dxos/app-framework';
7
7
 
8
8
  import { meta } from './meta';
@@ -14,7 +14,7 @@ export const NativePlugin = () =>
14
14
  defineModule({
15
15
  id: `${meta.id}/module/startup`,
16
16
  activatesOn: Events.DispatcherReady,
17
- activate: async (context: PluginsContext) => {
17
+ activate: async (context: PluginContext) => {
18
18
  const { initializeNativeApp } = await import('./initialize');
19
19
  await initializeNativeApp(context);
20
20
  return [];
package/src/initialize.ts CHANGED
@@ -2,7 +2,7 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
- import type { PluginsContext } from '@dxos/app-framework';
5
+ import type { PluginContext } from '@dxos/app-framework';
6
6
  import { SettingsAction, LayoutAction, createIntent, Capabilities } from '@dxos/app-framework';
7
7
  import { HELP_PLUGIN } from '@dxos/plugin-help';
8
8
  import { COMMANDS_DIALOG } from '@dxos/plugin-navtree';
@@ -157,9 +157,9 @@ const setupGlobalHotkey = async (socketWindow: any, appWindow: any, dispatch: an
157
157
  });
158
158
  };
159
159
 
160
- export const initializeNativeApp = async (context: PluginsContext) => {
160
+ export const initializeNativeApp = async (context: PluginContext) => {
161
161
  const { app, socketWindow, socketOs, appName } = await loadSocketSupplyModules();
162
- const { dispatchPromise: dispatch } = context.requestCapability(Capabilities.IntentDispatcher);
162
+ const { dispatchPromise: dispatch } = context.getCapability(Capabilities.IntentDispatcher);
163
163
 
164
164
  const platform = socketOs.platform();
165
165
 
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/initialize.ts"],
4
- "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport type { PluginsContext } from '@dxos/app-framework';\nimport { SettingsAction, LayoutAction, createIntent, Capabilities } from '@dxos/app-framework';\nimport { HELP_PLUGIN } from '@dxos/plugin-help';\nimport { COMMANDS_DIALOG } from '@dxos/plugin-navtree';\nimport { safeParseJson } from '@dxos/util';\n\n// TODO(burdon): Reconcile with other properties.\nconst KEY_WINDOW_SIZE = 'dxos.org/plugin/native/window-size';\n\n/**\n * Native code for socketsupply app.\n * https://www.npmjs.com/package/@socketsupply/socket\n * https://github.com/socketsupply/socket-examples\n */\n\nconst loadSocketSupplyModules = async () => {\n // SocketSupply implements the dynamic import.\n const module = 'socket:application';\n const app = await import(/* @vite-ignore */ module);\n const windowModule = 'socket:window';\n const socketWindow = await import(/* @vite-ignore */ windowModule);\n const osModule = 'socket:os';\n const socketOs = await import(/* @vite-ignore */ osModule);\n const { meta_title: appName } = app.config;\n\n return { app, socketWindow, socketOs, appName };\n};\n\nconst configureDesktopWindowSizing = async (app: any) => {\n const { width, height } = safeParseJson<{ width?: number; height?: number }>(\n localStorage.getItem(KEY_WINDOW_SIZE),\n {},\n );\n\n if (width && height) {\n const appWindow = await app.getCurrentWindow();\n await appWindow.setSize({ width, height });\n }\n\n window.addEventListener('resize', async () => {\n const appWindow = await app.getCurrentWindow();\n const { width, height } = appWindow.getSize();\n localStorage.setItem(KEY_WINDOW_SIZE, JSON.stringify({ width, height }));\n });\n};\n\nconst configureSystemMenu = async (app: any, appName: string) => {\n const itemsMac = `\n Hide ${appName}: h + CommandOrControl\n Hide Others: h + Control + Meta\n ---\n `;\n\n // TODO(mjamesderocher) Change menu names to use translations\n const menu = `\n App Name:\n About ${appName}: _\n Settings...: , + CommandOrControl\n ---\n Show shortcuts: / + CommandOrControl\n Search commands: k + CommandOrControl\n ---\n ${itemsMac}\n Quit: q + CommandOrControl\n ;\n\n Edit:\n Cut: x + CommandOrControl\n Copy: c + CommandOrControl\n Paste: v + CommandOrControl\n Delete: _\n Select All: a + CommandOrControl\n ;\n `;\n\n void app.setSystemMenu({ index: 0, value: menu });\n};\n\nconst setupMenuItemListener = (dispatch: any, app: any) => {\n window.addEventListener('menuItemSelected', async (event: any) => {\n const id = `${event.detail.parent}:${event.detail.title}`;\n switch (id) {\n case 'App Name:Search commands': {\n void dispatch(\n createIntent(LayoutAction.UpdateDialog, {\n part: 'dialog',\n subject: COMMANDS_DIALOG,\n options: {\n blockAlign: 'start',\n },\n }),\n );\n break;\n }\n case 'App Name:Settings...': {\n void dispatch(createIntent(SettingsAction.Open));\n break;\n }\n case 'App Name:Show shortcuts': {\n void dispatch(\n createIntent(LayoutAction.UpdateDialog, {\n part: 'dialog',\n subject: `${HELP_PLUGIN}/Shortcuts`,\n options: {\n blockAlign: 'center',\n },\n }),\n );\n break;\n }\n case 'App Name:Quit': {\n await app.exit();\n break;\n }\n }\n });\n};\n\nconst setupApplicationUrlListener = (app: any, dispatch: any) => {\n const appWindow = app.getCurrentWindow();\n\n // applicationurl is a custom event fired by the Socket Supply Runtime:\n // https://github.com/socketsupply/socket/blob/ef7fb5559876e41062d5896aafb7b79989fc96e5/api/internal/events.js#L6\n window.addEventListener('applicationurl', ({ url }: any) => {\n appWindow.restore();\n const location = url.toString().replace('composer://', '');\n if (location.includes('InvitationCode')) {\n // TODO(mjamesderocher): Integrate this with app routing.\n // Currently, the dialogs are controlled by Client Plugin and not the Layout Plugin.\n window.location.href = location;\n } else {\n // TODO(thure): What is `location` and is this right?\n void dispatch(createIntent(LayoutAction.Open, { part: 'main', subject: [location] }));\n }\n });\n};\n\nconst setupGlobalHotkey = async (socketWindow: any, appWindow: any, dispatch: any) => {\n const binding = await socketWindow.hotkey.bind('cmd + k');\n\n // Global hotkey listener\n binding.addEventListener('hotkey', () => {\n appWindow.restore();\n void dispatch(\n createIntent(LayoutAction.UpdateDialog, {\n part: 'dialog',\n subject: COMMANDS_DIALOG,\n options: {\n blockAlign: 'start',\n },\n }),\n );\n });\n};\n\nexport const initializeNativeApp = async (context: PluginsContext) => {\n const { app, socketWindow, socketOs, appName } = await loadSocketSupplyModules();\n const { dispatchPromise: dispatch } = context.requestCapability(Capabilities.IntentDispatcher);\n\n const platform = socketOs.platform();\n\n document.body.setAttribute('data-platform', platform);\n\n if (platform === 'darwin' || platform === 'win32') {\n await configureDesktopWindowSizing(app);\n await configureSystemMenu(app, appName);\n setupMenuItemListener(dispatch, app);\n setupApplicationUrlListener(app, d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,QAAO;AACjB,SAAKpB,SACHM,aAAaC,aAAaC,cAAc;MACtCC,MAAM;MACNC,SAASC;MACTC,SAAS;QACPC,YAAY;MACd;IACF,CAAA,CAAA;EAEJ,CAAA;AACF;AAEO,IAAMiB,sBAAsB,OAAOC,YAAAA;AACxC,QAAM,EAAE7D,KAAKE,cAAcE,UAAUE,QAAO,IAAK,MAAMR,wBAAAA;AACvD,QAAM,EAAEgE,iBAAiBhC,SAAQ,IAAK+B,QAAQE,kBAAkBC,aAAaC,gBAAgB;AAE7F,QAAMC,WAAW9D,SAAS8D,SAAQ;AAElCC,WAASC,KAAKC,aAAa,iBAAiBH,QAAAA;AAE5C,MAAIA,aAAa,YAAYA,aAAa,SAAS;AACjD,UAAM1D,6BAA6BR,GAAAA;AACnC,UAAMuB,oBAAoBvB,KAAKM,OAAAA;AAC/BuB,0BAAsBC,UAAU9B,GAAAA;AAChCgD,gCAA4BhD,KAAK8B,QAAAA;AACjC,UAAM0B,kBAAkBtD,cAAcF,KAAK8B,QAAAA;EAC7C;AACF;",
6
- "names": ["SettingsAction", "LayoutAction", "createIntent", "Capabilities", "HELP_PLUGIN", "COMMANDS_DIALOG", "safeParseJson", "KEY_WINDOW_SIZE", "loadSocketSupplyModules", "module", "app", "windowModule", "socketWindow", "osModule", "socketOs", "meta_title", "appName", "config", "configureDesktopWindowSizing", "width", "height", "safeParseJson", "localStorage", "getItem", "appWindow", "getCurrentWindow", "setSize", "window", "addEventListener", "getSize", "setItem", "JSON", "stringify", "configureSystemMenu", "itemsMac", "menu", "setSystemMenu", "index", "value", "setupMenuItemListener", "dispatch", "event", "id", "detail", "parent", "title", "createIntent", "LayoutAction", "UpdateDialog", "part", "subject", "COMMANDS_DIALOG", "options", "blockAlign", "SettingsAction", "Open", "HELP_PLUGIN", "exit", "setupApplicationUrlListener", "url", "restore", "location", "toString", "replace", "includes", "href", "setupGlobalHotkey", "binding", "hotkey", "bind", "initializeNativeApp", "context", "dispatchPromise", "requestCapability", "Capabilities", "IntentDispatcher", "platform", "document", "body", "setAttribute"]
7
- }