@dxos/plugin-client 0.6.10 → 0.6.11-staging.66fb9aa
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 +4 -14
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node/index.cjs +2 -12
- package/dist/lib/node/index.cjs.map +3 -3
- package/dist/lib/node/meta.json +1 -1
- package/dist/types/src/ClientPlugin.d.ts.map +1 -1
- package/package.json +12 -12
- package/src/ClientPlugin.tsx +5 -12
|
@@ -6,13 +6,13 @@ import {
|
|
|
6
6
|
|
|
7
7
|
// packages/plugins/plugin-client/src/ClientPlugin.tsx
|
|
8
8
|
import { AddressBook } from "@phosphor-icons/react";
|
|
9
|
-
import React
|
|
9
|
+
import React from "react";
|
|
10
10
|
import { filterPlugins, parseIntentPlugin, resolvePlugin } from "@dxos/app-framework";
|
|
11
11
|
import { Config, Defaults, Envs, Local, Storage } from "@dxos/config";
|
|
12
12
|
import { registerSignalRuntime } from "@dxos/echo-signals/react";
|
|
13
13
|
import { log } from "@dxos/log";
|
|
14
14
|
import { createExtension } from "@dxos/plugin-graph";
|
|
15
|
-
import { Client, ClientContext } from "@dxos/react-client";
|
|
15
|
+
import { Client, ClientContext, useClientStatus } from "@dxos/react-client";
|
|
16
16
|
|
|
17
17
|
// packages/plugins/plugin-client/src/translations.ts
|
|
18
18
|
var translations_default = [
|
|
@@ -57,17 +57,7 @@ var ClientPlugin = ({ appKey, onClientInitialized, onReady, ...options }) => {
|
|
|
57
57
|
return {
|
|
58
58
|
client,
|
|
59
59
|
context: ({ children }) => {
|
|
60
|
-
const
|
|
61
|
-
useEffect(() => {
|
|
62
|
-
if (!client) {
|
|
63
|
-
return;
|
|
64
|
-
}
|
|
65
|
-
const subscription = client.status.subscribe((status2) => setStatus(status2));
|
|
66
|
-
return () => subscription.unsubscribe();
|
|
67
|
-
}, [
|
|
68
|
-
client,
|
|
69
|
-
setStatus
|
|
70
|
-
]);
|
|
60
|
+
const status = useClientStatus(client);
|
|
71
61
|
return /* @__PURE__ */ React.createElement(ClientContext.Provider, {
|
|
72
62
|
value: {
|
|
73
63
|
client,
|
|
@@ -87,7 +77,7 @@ var ClientPlugin = ({ appKey, onClientInitialized, onReady, ...options }) => {
|
|
|
87
77
|
id: plugin.meta.id
|
|
88
78
|
}, {
|
|
89
79
|
F: __dxlog_file,
|
|
90
|
-
L:
|
|
80
|
+
L: 118,
|
|
91
81
|
S: void 0,
|
|
92
82
|
C: (f, a) => f(...a)
|
|
93
83
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/ClientPlugin.tsx", "../../../src/translations.ts", "../../../src/index.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { AddressBook, type IconProps } from '@phosphor-icons/react';\nimport React
|
|
5
|
-
"mappings": ";;;;;;;AAIA,SAASA,mBAAmC;AAC5C,OAAOC,
|
|
6
|
-
"names": ["AddressBook", "React", "
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { AddressBook, type IconProps } from '@phosphor-icons/react';\nimport React from 'react';\n\nimport {\n filterPlugins,\n parseIntentPlugin,\n resolvePlugin,\n type GraphBuilderProvides,\n type IntentResolverProvides,\n type Plugin,\n type PluginDefinition,\n type TranslationsProvides,\n} from '@dxos/app-framework';\nimport { Config, Defaults, Envs, Local, Storage } from '@dxos/config';\nimport { type S } from '@dxos/echo-schema';\nimport { registerSignalRuntime } from '@dxos/echo-signals/react';\nimport { log } from '@dxos/log';\nimport { createExtension, type Node } from '@dxos/plugin-graph';\nimport { Client, type ClientOptions, ClientContext, useClientStatus } from '@dxos/react-client';\n\nimport meta, { CLIENT_PLUGIN, ClientAction } from './meta';\nimport translations from './translations';\n\nexport type ClientPluginOptions = ClientOptions & {\n /**\n * Used to track app-specific state in spaces.\n */\n appKey: string;\n\n /**\n * Run after the client has been initialized.\n */\n onClientInitialized?: (client: Client) => Promise<void>;\n\n /**\n * Run after the identity has been successfully initialized.\n * Run with client during plugin ready phase.\n */\n onReady?: (client: Client, plugins: Plugin[]) => Promise<void>;\n};\n\nexport type ClientPluginProvides = IntentResolverProvides &\n GraphBuilderProvides &\n TranslationsProvides & {\n client: Client;\n };\n\nexport const parseClientPlugin = (plugin?: Plugin) =>\n (plugin?.provides as any).client instanceof Client ? (plugin as Plugin<ClientPluginProvides>) : undefined;\n\nexport type SchemaProvides = {\n echo: {\n schema: S.Schema<any>[];\n };\n};\n\nexport const parseSchemaPlugin = (plugin?: Plugin) =>\n Array.isArray((plugin?.provides as any).echo?.schema) ? (plugin as Plugin<SchemaProvides>) : undefined;\n\nexport const ClientPlugin = ({\n appKey,\n onClientInitialized,\n onReady,\n ...options\n}: ClientPluginOptions): PluginDefinition<\n Omit<ClientPluginProvides, 'client'>,\n Pick<ClientPluginProvides, 'client'>\n> => {\n registerSignalRuntime();\n\n let client: Client;\n let error: unknown = null;\n\n return {\n meta,\n initialize: async () => {\n const config = new Config(await Storage(), Envs(), Local(), Defaults());\n client = new Client({ config, ...options });\n\n try {\n await client.initialize();\n await onClientInitialized?.(client);\n\n // TODO(wittjosiah): Remove. This is a hack to get the app to boot with the new identity after a reset.\n client.reloaded.on(() => {\n client.halo.identity.subscribe(async (identity) => {\n if (identity) {\n window.location.href = window.location.origin;\n }\n });\n });\n } catch (err) {\n error = err;\n }\n\n return {\n client,\n context: ({ children }) => {\n // TODO(burdon): Use ClientProvider?\n const status = useClientStatus(client);\n return <ClientContext.Provider value={{ client, status }}>{children}</ClientContext.Provider>;\n // return <ClientProvider client={client}>{children}</ClientProvider>;\n },\n };\n },\n ready: async (plugins) => {\n if (error) {\n throw error;\n }\n\n await onReady?.(client, plugins);\n\n filterPlugins(plugins, parseSchemaPlugin).forEach((plugin) => {\n log('ready', { id: plugin.meta.id });\n client.addTypes(plugin.provides.echo.schema);\n });\n },\n unload: async () => {\n await client.destroy();\n },\n provides: {\n translations,\n graph: {\n builder: (plugins) => {\n const intentPlugin = resolvePlugin(plugins, parseIntentPlugin);\n const id = `${CLIENT_PLUGIN}/open-shell`;\n\n return createExtension({\n id: CLIENT_PLUGIN,\n filter: (node): node is Node<null> => node.id === 'root',\n actions: () => [\n {\n id,\n data: async () => {\n await intentPlugin?.provides.intent.dispatch([\n { plugin: CLIENT_PLUGIN, action: ClientAction.OPEN_SHELL },\n ]);\n },\n properties: {\n label: ['open shell label', { ns: CLIENT_PLUGIN }],\n icon: (props: IconProps) => <AddressBook {...props} />,\n iconSymbol: 'ph--address-book--regular',\n keyBinding: {\n macos: 'meta+shift+.',\n // TODO(wittjosiah): Test on windows to see if it behaves the same as linux.\n windows: 'alt+shift+.',\n linux: 'alt+shift+>',\n },\n testId: 'clientPlugin.openShell',\n },\n },\n ],\n });\n },\n },\n intent: {\n resolver: async (intent) => {\n switch (intent.action) {\n case ClientAction.OPEN_SHELL:\n await client.shell.open(intent.data?.layout);\n return { data: true };\n\n case ClientAction.CREATE_IDENTITY: {\n const data = await client.halo.createIdentity();\n return {\n data,\n intents: [\n [\n {\n // NOTE: This action is hardcoded to avoid circular dependency with observability plugin.\n action: 'dxos.org/plugin/observability/send-event',\n data: {\n name: 'identity.created',\n },\n },\n ],\n ],\n };\n }\n\n case ClientAction.JOIN_IDENTITY: {\n const data = await client.shell.joinIdentity({ invitationCode: intent.data?.invitationCode });\n return {\n data,\n intents: [\n [\n {\n // NOTE: This action is hardcoded to avoid circular dependency with observability plugin.\n action: 'dxos.org/plugin/observability/send-event',\n data: {\n name: 'identity.joined',\n },\n },\n ],\n ],\n };\n }\n\n case ClientAction.SHARE_IDENTITY: {\n const data = await client.shell.shareIdentity();\n return {\n data,\n intents: [\n [\n {\n // NOTE: This action is hardcoded to avoid circular dependency with observability plugin.\n action: 'dxos.org/plugin/observability/send-event',\n data: {\n name: 'identity.shared',\n properties: {\n deviceKey: data.device?.deviceKey.truncate(),\n deviceKind: data.device?.kind,\n error: data.error?.message,\n canceled: data.cancelled,\n },\n },\n },\n ],\n ],\n };\n }\n }\n },\n },\n },\n };\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { CLIENT_PLUGIN } from './meta';\n\nexport default [\n {\n 'en-US': {\n [CLIENT_PLUGIN]: {\n 'open shell label': 'Open HALO',\n },\n },\n },\n];\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { ClientPlugin } from './ClientPlugin';\n\nexport default ClientPlugin;\n\nexport * from './ClientPlugin';\n"],
|
|
5
|
+
"mappings": ";;;;;;;AAIA,SAASA,mBAAmC;AAC5C,OAAOC,WAAW;AAElB,SACEC,eACAC,mBACAC,qBAMK;AACP,SAASC,QAAQC,UAAUC,MAAMC,OAAOC,eAAe;AAEvD,SAASC,6BAA6B;AACtC,SAASC,WAAW;AACpB,SAASC,uBAAkC;AAC3C,SAASC,QAA4BC,eAAeC,uBAAuB;;;AChB3E,IAAA,uBAAe;EACb;IACE,SAAS;MACP,CAACC,aAAAA,GAAgB;QACf,oBAAoB;MACtB;IACF;EACF;;;;;ADsCK,IAAMC,oBAAoB,CAACC,YAC/BA,QAAQC,UAAiBC,kBAAkBC,SAAUH,SAA0CI;AAQ3F,IAAMC,oBAAoB,CAACL,WAChCM,MAAMC,QAASP,QAAQC,SAAiBO,MAAMC,MAAAA,IAAWT,SAAoCI;AAExF,IAAMM,eAAe,CAAC,EAC3BC,QACAC,qBACAC,SACA,GAAGC,QAAAA,MACiB;AAIpBC,wBAAAA;AAEA,MAAIb;AACJ,MAAIc,QAAiB;AAErB,SAAO;IACLC;IACAC,YAAY,YAAA;AACV,YAAMC,SAAS,IAAIC,OAAO,MAAMC,QAAAA,GAAWC,KAAAA,GAAQC,MAAAA,GAASC,SAAAA,CAAAA;AAC5DtB,eAAS,IAAIC,OAAO;QAAEgB;QAAQ,GAAGL;MAAQ,CAAA;AAEzC,UAAI;AACF,cAAMZ,OAAOgB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;EACF;AACF;;;AEhOA,IAAA,cAAeC;",
|
|
6
|
+
"names": ["AddressBook", "React", "filterPlugins", "parseIntentPlugin", "resolvePlugin", "Config", "Defaults", "Envs", "Local", "Storage", "registerSignalRuntime", "log", "createExtension", "Client", "ClientContext", "useClientStatus", "CLIENT_PLUGIN", "parseClientPlugin", "plugin", "provides", "client", "Client", "undefined", "parseSchemaPlugin", "Array", "isArray", "echo", "schema", "ClientPlugin", "appKey", "onClientInitialized", "onReady", "options", "registerSignalRuntime", "error", "meta", "initialize", "config", "Config", "Storage", "Envs", "Local", "Defaults", "reloaded", "on", "halo", "identity", "subscribe", "window", "location", "href", "origin", "err", "context", "children", "status", "useClientStatus", "ClientContext", "Provider", "value", "ready", "plugins", "filterPlugins", "forEach", "log", "id", "addTypes", "unload", "destroy", "translations", "graph", "builder", "intentPlugin", "resolvePlugin", "parseIntentPlugin", "CLIENT_PLUGIN", "createExtension", "filter", "node", "actions", "data", "intent", "dispatch", "action", "ClientAction", "OPEN_SHELL", "properties", "label", "ns", "icon", "props", "AddressBook", "iconSymbol", "keyBinding", "macos", "windows", "linux", "testId", "resolver", "shell", "open", "layout", "CREATE_IDENTITY", "createIdentity", "intents", "name", "JOIN_IDENTITY", "joinIdentity", "invitationCode", "SHARE_IDENTITY", "shareIdentity", "deviceKey", "device", "truncate", "deviceKind", "kind", "message", "canceled", "cancelled", "ClientPlugin"]
|
|
7
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs":{"packages/plugins/plugin-client/src/meta.ts":{"bytes":2078,"imports":[],"format":"esm"},"packages/plugins/plugin-client/src/translations.ts":{"bytes":1043,"imports":[{"path":"packages/plugins/plugin-client/src/meta.ts","kind":"import-statement","original":"./meta"}],"format":"esm"},"packages/plugins/plugin-client/src/ClientPlugin.tsx":{"bytes":
|
|
1
|
+
{"inputs":{"packages/plugins/plugin-client/src/meta.ts":{"bytes":2078,"imports":[],"format":"esm"},"packages/plugins/plugin-client/src/translations.ts":{"bytes":1043,"imports":[{"path":"packages/plugins/plugin-client/src/meta.ts","kind":"import-statement","original":"./meta"}],"format":"esm"},"packages/plugins/plugin-client/src/ClientPlugin.tsx":{"bytes":25699,"imports":[{"path":"@phosphor-icons/react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/config","kind":"import-statement","external":true},{"path":"@dxos/echo-signals/react","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/plugin-graph","kind":"import-statement","external":true},{"path":"@dxos/react-client","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-client/src/meta.ts","kind":"import-statement","original":"./meta"},{"path":"packages/plugins/plugin-client/src/translations.ts","kind":"import-statement","original":"./translations"}],"format":"esm"},"packages/plugins/plugin-client/src/index.ts":{"bytes":782,"imports":[{"path":"packages/plugins/plugin-client/src/ClientPlugin.tsx","kind":"import-statement","original":"./ClientPlugin"},{"path":"packages/plugins/plugin-client/src/ClientPlugin.tsx","kind":"import-statement","original":"./ClientPlugin"}],"format":"esm"}},"outputs":{"packages/plugins/plugin-client/dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":12468},"packages/plugins/plugin-client/dist/lib/browser/index.mjs":{"imports":[{"path":"packages/plugins/plugin-client/dist/lib/browser/chunk-3GFJ7SEI.mjs","kind":"import-statement"},{"path":"@phosphor-icons/react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/config","kind":"import-statement","external":true},{"path":"@dxos/echo-signals/react","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/plugin-graph","kind":"import-statement","external":true},{"path":"@dxos/react-client","kind":"import-statement","external":true}],"exports":["ClientPlugin","default","parseClientPlugin","parseSchemaPlugin"],"entryPoint":"packages/plugins/plugin-client/src/index.ts","inputs":{"packages/plugins/plugin-client/src/ClientPlugin.tsx":{"bytesInOutput":6269},"packages/plugins/plugin-client/src/translations.ts":{"bytesInOutput":134},"packages/plugins/plugin-client/src/index.ts":{"bytesInOutput":32}},"bytes":6868},"packages/plugins/plugin-client/dist/lib/browser/meta.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"packages/plugins/plugin-client/dist/lib/browser/meta.mjs":{"imports":[{"path":"packages/plugins/plugin-client/dist/lib/browser/chunk-3GFJ7SEI.mjs","kind":"import-statement"}],"exports":["CLIENT_PLUGIN","ClientAction","default"],"entryPoint":"packages/plugins/plugin-client/src/meta.ts","inputs":{},"bytes":193},"packages/plugins/plugin-client/dist/lib/browser/chunk-3GFJ7SEI.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":888},"packages/plugins/plugin-client/dist/lib/browser/chunk-3GFJ7SEI.mjs":{"imports":[],"exports":["CLIENT_PLUGIN","ClientAction","meta_default"],"inputs":{"packages/plugins/plugin-client/src/meta.ts":{"bytesInOutput":644}},"bytes":795}}}
|
package/dist/lib/node/index.cjs
CHANGED
|
@@ -83,17 +83,7 @@ var ClientPlugin = ({ appKey, onClientInitialized, onReady, ...options }) => {
|
|
|
83
83
|
return {
|
|
84
84
|
client,
|
|
85
85
|
context: ({ children }) => {
|
|
86
|
-
const
|
|
87
|
-
(0, import_react2.useEffect)(() => {
|
|
88
|
-
if (!client) {
|
|
89
|
-
return;
|
|
90
|
-
}
|
|
91
|
-
const subscription = client.status.subscribe((status2) => setStatus(status2));
|
|
92
|
-
return () => subscription.unsubscribe();
|
|
93
|
-
}, [
|
|
94
|
-
client,
|
|
95
|
-
setStatus
|
|
96
|
-
]);
|
|
86
|
+
const status = (0, import_react_client.useClientStatus)(client);
|
|
97
87
|
return /* @__PURE__ */ import_react2.default.createElement(import_react_client.ClientContext.Provider, {
|
|
98
88
|
value: {
|
|
99
89
|
client,
|
|
@@ -113,7 +103,7 @@ var ClientPlugin = ({ appKey, onClientInitialized, onReady, ...options }) => {
|
|
|
113
103
|
id: plugin.meta.id
|
|
114
104
|
}, {
|
|
115
105
|
F: __dxlog_file,
|
|
116
|
-
L:
|
|
106
|
+
L: 118,
|
|
117
107
|
S: void 0,
|
|
118
108
|
C: (f, a) => f(...a)
|
|
119
109
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/ClientPlugin.tsx", "../../../src/translations.ts", "../../../src/index.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { AddressBook, type IconProps } from '@phosphor-icons/react';\nimport React
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,mBAA4C;AAC5C,IAAAA,
|
|
6
|
-
"names": ["import_react", "CLIENT_PLUGIN", "parseClientPlugin", "plugin", "provides", "client", "Client", "undefined", "parseSchemaPlugin", "Array", "isArray", "echo", "schema", "ClientPlugin", "appKey", "onClientInitialized", "onReady", "options", "registerSignalRuntime", "error", "meta", "initialize", "config", "Config", "Storage", "Envs", "Local", "Defaults", "reloaded", "on", "halo", "identity", "subscribe", "window", "location", "href", "origin", "err", "context", "children", "status", "
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { AddressBook, type IconProps } from '@phosphor-icons/react';\nimport React from 'react';\n\nimport {\n filterPlugins,\n parseIntentPlugin,\n resolvePlugin,\n type GraphBuilderProvides,\n type IntentResolverProvides,\n type Plugin,\n type PluginDefinition,\n type TranslationsProvides,\n} from '@dxos/app-framework';\nimport { Config, Defaults, Envs, Local, Storage } from '@dxos/config';\nimport { type S } from '@dxos/echo-schema';\nimport { registerSignalRuntime } from '@dxos/echo-signals/react';\nimport { log } from '@dxos/log';\nimport { createExtension, type Node } from '@dxos/plugin-graph';\nimport { Client, type ClientOptions, ClientContext, useClientStatus } from '@dxos/react-client';\n\nimport meta, { CLIENT_PLUGIN, ClientAction } from './meta';\nimport translations from './translations';\n\nexport type ClientPluginOptions = ClientOptions & {\n /**\n * Used to track app-specific state in spaces.\n */\n appKey: string;\n\n /**\n * Run after the client has been initialized.\n */\n onClientInitialized?: (client: Client) => Promise<void>;\n\n /**\n * Run after the identity has been successfully initialized.\n * Run with client during plugin ready phase.\n */\n onReady?: (client: Client, plugins: Plugin[]) => Promise<void>;\n};\n\nexport type ClientPluginProvides = IntentResolverProvides &\n GraphBuilderProvides &\n TranslationsProvides & {\n client: Client;\n };\n\nexport const parseClientPlugin = (plugin?: Plugin) =>\n (plugin?.provides as any).client instanceof Client ? (plugin as Plugin<ClientPluginProvides>) : undefined;\n\nexport type SchemaProvides = {\n echo: {\n schema: S.Schema<any>[];\n };\n};\n\nexport const parseSchemaPlugin = (plugin?: Plugin) =>\n Array.isArray((plugin?.provides as any).echo?.schema) ? (plugin as Plugin<SchemaProvides>) : undefined;\n\nexport const ClientPlugin = ({\n appKey,\n onClientInitialized,\n onReady,\n ...options\n}: ClientPluginOptions): PluginDefinition<\n Omit<ClientPluginProvides, 'client'>,\n Pick<ClientPluginProvides, 'client'>\n> => {\n registerSignalRuntime();\n\n let client: Client;\n let error: unknown = null;\n\n return {\n meta,\n initialize: async () => {\n const config = new Config(await Storage(), Envs(), Local(), Defaults());\n client = new Client({ config, ...options });\n\n try {\n await client.initialize();\n await onClientInitialized?.(client);\n\n // TODO(wittjosiah): Remove. This is a hack to get the app to boot with the new identity after a reset.\n client.reloaded.on(() => {\n client.halo.identity.subscribe(async (identity) => {\n if (identity) {\n window.location.href = window.location.origin;\n }\n });\n });\n } catch (err) {\n error = err;\n }\n\n return {\n client,\n context: ({ children }) => {\n // TODO(burdon): Use ClientProvider?\n const status = useClientStatus(client);\n return <ClientContext.Provider value={{ client, status }}>{children}</ClientContext.Provider>;\n // return <ClientProvider client={client}>{children}</ClientProvider>;\n },\n };\n },\n ready: async (plugins) => {\n if (error) {\n throw error;\n }\n\n await onReady?.(client, plugins);\n\n filterPlugins(plugins, parseSchemaPlugin).forEach((plugin) => {\n log('ready', { id: plugin.meta.id });\n client.addTypes(plugin.provides.echo.schema);\n });\n },\n unload: async () => {\n await client.destroy();\n },\n provides: {\n translations,\n graph: {\n builder: (plugins) => {\n const intentPlugin = resolvePlugin(plugins, parseIntentPlugin);\n const id = `${CLIENT_PLUGIN}/open-shell`;\n\n return createExtension({\n id: CLIENT_PLUGIN,\n filter: (node): node is Node<null> => node.id === 'root',\n actions: () => [\n {\n id,\n data: async () => {\n await intentPlugin?.provides.intent.dispatch([\n { plugin: CLIENT_PLUGIN, action: ClientAction.OPEN_SHELL },\n ]);\n },\n properties: {\n label: ['open shell label', { ns: CLIENT_PLUGIN }],\n icon: (props: IconProps) => <AddressBook {...props} />,\n iconSymbol: 'ph--address-book--regular',\n keyBinding: {\n macos: 'meta+shift+.',\n // TODO(wittjosiah): Test on windows to see if it behaves the same as linux.\n windows: 'alt+shift+.',\n linux: 'alt+shift+>',\n },\n testId: 'clientPlugin.openShell',\n },\n },\n ],\n });\n },\n },\n intent: {\n resolver: async (intent) => {\n switch (intent.action) {\n case ClientAction.OPEN_SHELL:\n await client.shell.open(intent.data?.layout);\n return { data: true };\n\n case ClientAction.CREATE_IDENTITY: {\n const data = await client.halo.createIdentity();\n return {\n data,\n intents: [\n [\n {\n // NOTE: This action is hardcoded to avoid circular dependency with observability plugin.\n action: 'dxos.org/plugin/observability/send-event',\n data: {\n name: 'identity.created',\n },\n },\n ],\n ],\n };\n }\n\n case ClientAction.JOIN_IDENTITY: {\n const data = await client.shell.joinIdentity({ invitationCode: intent.data?.invitationCode });\n return {\n data,\n intents: [\n [\n {\n // NOTE: This action is hardcoded to avoid circular dependency with observability plugin.\n action: 'dxos.org/plugin/observability/send-event',\n data: {\n name: 'identity.joined',\n },\n },\n ],\n ],\n };\n }\n\n case ClientAction.SHARE_IDENTITY: {\n const data = await client.shell.shareIdentity();\n return {\n data,\n intents: [\n [\n {\n // NOTE: This action is hardcoded to avoid circular dependency with observability plugin.\n action: 'dxos.org/plugin/observability/send-event',\n data: {\n name: 'identity.shared',\n properties: {\n deviceKey: data.device?.deviceKey.truncate(),\n deviceKind: data.device?.kind,\n error: data.error?.message,\n canceled: data.cancelled,\n },\n },\n },\n ],\n ],\n };\n }\n }\n },\n },\n },\n };\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { CLIENT_PLUGIN } from './meta';\n\nexport default [\n {\n 'en-US': {\n [CLIENT_PLUGIN]: {\n 'open shell label': 'Open HALO',\n },\n },\n },\n];\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { ClientPlugin } from './ClientPlugin';\n\nexport default ClientPlugin;\n\nexport * from './ClientPlugin';\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,mBAA4C;AAC5C,IAAAA,gBAAkB;AAElB,2BASO;AACP,oBAAuD;AAEvD,IAAAA,gBAAsC;AACtC,iBAAoB;AACpB,0BAA2C;AAC3C,0BAA2E;AChB3E,IAAA,uBAAe;EACb;IACE,SAAS;MACP,CAACC,mCAAAA,GAAgB;QACf,oBAAoB;MACtB;IACF;EACF;;;ADsCK,IAAMC,oBAAoB,CAACC,YAC/BA,QAAQC,UAAiBC,kBAAkBC,6BAAUH,SAA0CI;AAQ3F,IAAMC,oBAAoB,CAACL,WAChCM,MAAMC,QAASP,QAAQC,SAAiBO,MAAMC,MAAAA,IAAWT,SAAoCI;AAExF,IAAMM,eAAe,CAAC,EAC3BC,QACAC,qBACAC,SACA,GAAGC,QAAAA,MACiB;AAIpBC,2CAAAA;AAEA,MAAIb;AACJ,MAAIc,QAAiB;AAErB,SAAO;IACLC,MAAAA;IACAC,YAAY,YAAA;AACV,YAAMC,SAAS,IAAIC,qBAAO,UAAMC,uBAAAA,OAAWC,oBAAAA,OAAQC,qBAAAA,OAASC,wBAAAA,CAAAA;AAC5DtB,eAAS,IAAIC,2BAAO;QAAEgB;QAAQ,GAAGL;MAAQ,CAAA;AAEzC,UAAI;AACF,cAAMZ,OAAO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sBACF;oBACF;;;cAGN;YACF;UACF;QACF;MACF;IACF;EACF;AACF;AEhOA,IAAA,cAAe1F;",
|
|
6
|
+
"names": ["import_react", "CLIENT_PLUGIN", "parseClientPlugin", "plugin", "provides", "client", "Client", "undefined", "parseSchemaPlugin", "Array", "isArray", "echo", "schema", "ClientPlugin", "appKey", "onClientInitialized", "onReady", "options", "registerSignalRuntime", "error", "meta", "initialize", "config", "Config", "Storage", "Envs", "Local", "Defaults", "reloaded", "on", "halo", "identity", "subscribe", "window", "location", "href", "origin", "err", "context", "children", "status", "useClientStatus", "React", "ClientContext", "Provider", "value", "ready", "plugins", "filterPlugins", "forEach", "log", "id", "addTypes", "unload", "destroy", "translations", "graph", "builder", "intentPlugin", "resolvePlugin", "parseIntentPlugin", "createExtension", "filter", "node", "actions", "data", "intent", "dispatch", "action", "ClientAction", "OPEN_SHELL", "properties", "label", "ns", "icon", "props", "AddressBook", "iconSymbol", "keyBinding", "macos", "windows", "linux", "testId", "resolver", "shell", "open", "layout", "CREATE_IDENTITY", "createIdentity", "intents", "name", "JOIN_IDENTITY", "joinIdentity", "invitationCode", "SHARE_IDENTITY", "shareIdentity", "deviceKey", "device", "truncate", "deviceKind", "kind", "message", "canceled", "cancelled"]
|
|
7
7
|
}
|
package/dist/lib/node/meta.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs":{"packages/plugins/plugin-client/src/meta.ts":{"bytes":2078,"imports":[],"format":"esm"},"packages/plugins/plugin-client/src/translations.ts":{"bytes":1043,"imports":[{"path":"packages/plugins/plugin-client/src/meta.ts","kind":"import-statement","original":"./meta"}],"format":"esm"},"packages/plugins/plugin-client/src/ClientPlugin.tsx":{"bytes":
|
|
1
|
+
{"inputs":{"packages/plugins/plugin-client/src/meta.ts":{"bytes":2078,"imports":[],"format":"esm"},"packages/plugins/plugin-client/src/translations.ts":{"bytes":1043,"imports":[{"path":"packages/plugins/plugin-client/src/meta.ts","kind":"import-statement","original":"./meta"}],"format":"esm"},"packages/plugins/plugin-client/src/ClientPlugin.tsx":{"bytes":25699,"imports":[{"path":"@phosphor-icons/react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/config","kind":"import-statement","external":true},{"path":"@dxos/echo-signals/react","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/plugin-graph","kind":"import-statement","external":true},{"path":"@dxos/react-client","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-client/src/meta.ts","kind":"import-statement","original":"./meta"},{"path":"packages/plugins/plugin-client/src/translations.ts","kind":"import-statement","original":"./translations"}],"format":"esm"},"packages/plugins/plugin-client/src/index.ts":{"bytes":782,"imports":[{"path":"packages/plugins/plugin-client/src/ClientPlugin.tsx","kind":"import-statement","original":"./ClientPlugin"},{"path":"packages/plugins/plugin-client/src/ClientPlugin.tsx","kind":"import-statement","original":"./ClientPlugin"}],"format":"esm"}},"outputs":{"packages/plugins/plugin-client/dist/lib/node/index.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":12468},"packages/plugins/plugin-client/dist/lib/node/index.cjs":{"imports":[{"path":"packages/plugins/plugin-client/dist/lib/node/chunk-2E5ZNH3H.cjs","kind":"import-statement"},{"path":"@phosphor-icons/react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/config","kind":"import-statement","external":true},{"path":"@dxos/echo-signals/react","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/plugin-graph","kind":"import-statement","external":true},{"path":"@dxos/react-client","kind":"import-statement","external":true}],"exports":["ClientPlugin","default","parseClientPlugin","parseSchemaPlugin"],"entryPoint":"packages/plugins/plugin-client/src/index.ts","inputs":{"packages/plugins/plugin-client/src/ClientPlugin.tsx":{"bytesInOutput":6269},"packages/plugins/plugin-client/src/translations.ts":{"bytesInOutput":134},"packages/plugins/plugin-client/src/index.ts":{"bytesInOutput":32}},"bytes":6868},"packages/plugins/plugin-client/dist/lib/node/meta.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"packages/plugins/plugin-client/dist/lib/node/meta.cjs":{"imports":[{"path":"packages/plugins/plugin-client/dist/lib/node/chunk-2E5ZNH3H.cjs","kind":"import-statement"}],"exports":["CLIENT_PLUGIN","ClientAction","default"],"entryPoint":"packages/plugins/plugin-client/src/meta.ts","inputs":{},"bytes":193},"packages/plugins/plugin-client/dist/lib/node/chunk-2E5ZNH3H.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":888},"packages/plugins/plugin-client/dist/lib/node/chunk-2E5ZNH3H.cjs":{"imports":[],"exports":["CLIENT_PLUGIN","ClientAction","meta_default"],"inputs":{"packages/plugins/plugin-client/src/meta.ts":{"bytesInOutput":644}},"bytes":795}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ClientPlugin.d.ts","sourceRoot":"","sources":["../../../src/ClientPlugin.tsx"],"names":[],"mappings":"AAOA,OAAO,EAIL,KAAK,oBAAoB,EACzB,KAAK,sBAAsB,EAC3B,KAAK,MAAM,EACX,KAAK,gBAAgB,EACrB,KAAK,oBAAoB,EAC1B,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,KAAK,CAAC,EAAE,MAAM,mBAAmB,CAAC;AAI3C,OAAO,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"ClientPlugin.d.ts","sourceRoot":"","sources":["../../../src/ClientPlugin.tsx"],"names":[],"mappings":"AAOA,OAAO,EAIL,KAAK,oBAAoB,EACzB,KAAK,sBAAsB,EAC3B,KAAK,MAAM,EACX,KAAK,gBAAgB,EACrB,KAAK,oBAAoB,EAC1B,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,KAAK,CAAC,EAAE,MAAM,mBAAmB,CAAC;AAI3C,OAAO,EAAE,MAAM,EAAE,KAAK,aAAa,EAAkC,MAAM,oBAAoB,CAAC;AAKhG,MAAM,MAAM,mBAAmB,GAAG,aAAa,GAAG;IAChD;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,mBAAmB,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAExD;;;OAGG;IACH,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CAChE,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG,sBAAsB,GACvD,oBAAoB,GACpB,oBAAoB,GAAG;IACrB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEJ,eAAO,MAAM,iBAAiB,YAAa,MAAM,6CAC0D,CAAC;AAE5G,MAAM,MAAM,cAAc,GAAG;IAC3B,IAAI,EAAE;QACJ,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC;KACzB,CAAC;CACH,CAAC;AAEF,eAAO,MAAM,iBAAiB,YAAa,MAAM,uCACuD,CAAC;AAEzG,eAAO,MAAM,YAAY,yDAKtB,mBAAmB,KAAG,gBAAgB,CACvC,IAAI,CAAC,oBAAoB,EAAE,QAAQ,CAAC,EACpC,IAAI,CAAC,oBAAoB,EAAE,QAAQ,CAAC,CAgKrC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/plugin-client",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.11-staging.66fb9aa",
|
|
4
4
|
"description": "DXOS Surface plugin for DXOS Client",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -36,16 +36,16 @@
|
|
|
36
36
|
],
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@phosphor-icons/react": "^2.1.5",
|
|
39
|
-
"@dxos/app-framework": "0.6.
|
|
40
|
-
"@dxos/config": "0.6.
|
|
41
|
-
"@dxos/echo-
|
|
42
|
-
"@dxos/
|
|
43
|
-
"@dxos/
|
|
44
|
-
"@dxos/
|
|
45
|
-
"@dxos/
|
|
46
|
-
"@dxos/
|
|
47
|
-
"@dxos/react-client": "0.6.
|
|
48
|
-
"@dxos/react-ui": "0.6.
|
|
39
|
+
"@dxos/app-framework": "0.6.11-staging.66fb9aa",
|
|
40
|
+
"@dxos/config": "0.6.11-staging.66fb9aa",
|
|
41
|
+
"@dxos/echo-schema": "0.6.11-staging.66fb9aa",
|
|
42
|
+
"@dxos/echo-signals": "0.6.11-staging.66fb9aa",
|
|
43
|
+
"@dxos/invariant": "0.6.11-staging.66fb9aa",
|
|
44
|
+
"@dxos/log": "0.6.11-staging.66fb9aa",
|
|
45
|
+
"@dxos/local-storage": "0.6.11-staging.66fb9aa",
|
|
46
|
+
"@dxos/plugin-graph": "0.6.11-staging.66fb9aa",
|
|
47
|
+
"@dxos/react-client": "0.6.11-staging.66fb9aa",
|
|
48
|
+
"@dxos/react-ui": "0.6.11-staging.66fb9aa"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@types/react": "~18.2.0",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"react": "~18.2.0",
|
|
54
54
|
"react-dom": "~18.2.0",
|
|
55
55
|
"vite": "^5.3.4",
|
|
56
|
-
"@dxos/storybook-utils": "0.6.
|
|
56
|
+
"@dxos/storybook-utils": "0.6.11-staging.66fb9aa"
|
|
57
57
|
},
|
|
58
58
|
"peerDependencies": {
|
|
59
59
|
"react": "^18.0.0",
|
package/src/ClientPlugin.tsx
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { AddressBook, type IconProps } from '@phosphor-icons/react';
|
|
6
|
-
import React
|
|
6
|
+
import React from 'react';
|
|
7
7
|
|
|
8
8
|
import {
|
|
9
9
|
filterPlugins,
|
|
@@ -20,7 +20,7 @@ import { type S } from '@dxos/echo-schema';
|
|
|
20
20
|
import { registerSignalRuntime } from '@dxos/echo-signals/react';
|
|
21
21
|
import { log } from '@dxos/log';
|
|
22
22
|
import { createExtension, type Node } from '@dxos/plugin-graph';
|
|
23
|
-
import { Client,
|
|
23
|
+
import { Client, type ClientOptions, ClientContext, useClientStatus } from '@dxos/react-client';
|
|
24
24
|
|
|
25
25
|
import meta, { CLIENT_PLUGIN, ClientAction } from './meta';
|
|
26
26
|
import translations from './translations';
|
|
@@ -100,17 +100,10 @@ export const ClientPlugin = ({
|
|
|
100
100
|
return {
|
|
101
101
|
client,
|
|
102
102
|
context: ({ children }) => {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
if (!client) {
|
|
106
|
-
return;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
const subscription = client.status.subscribe((status) => setStatus(status));
|
|
110
|
-
return () => subscription.unsubscribe();
|
|
111
|
-
}, [client, setStatus]);
|
|
112
|
-
|
|
103
|
+
// TODO(burdon): Use ClientProvider?
|
|
104
|
+
const status = useClientStatus(client);
|
|
113
105
|
return <ClientContext.Provider value={{ client, status }}>{children}</ClientContext.Provider>;
|
|
106
|
+
// return <ClientProvider client={client}>{children}</ClientProvider>;
|
|
114
107
|
},
|
|
115
108
|
};
|
|
116
109
|
},
|