@dxos/plugin-registry 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.
- package/dist/lib/browser/PluginArticle-N2ITBUGD.mjs +29 -0
- package/dist/lib/browser/PluginArticle-N2ITBUGD.mjs.map +7 -0
- package/dist/lib/browser/PluginRegistry-DKO4UEYH.mjs +78 -0
- package/dist/lib/browser/PluginRegistry-DKO4UEYH.mjs.map +7 -0
- package/dist/lib/browser/{app-graph-builder-P3ZGGFAR.mjs → app-graph-builder-AHS5BI4Y.mjs} +21 -20
- package/dist/lib/browser/app-graph-builder-AHS5BI4Y.mjs.map +7 -0
- package/dist/lib/browser/chunk-2YWVCU2W.mjs +191 -0
- package/dist/lib/browser/chunk-2YWVCU2W.mjs.map +7 -0
- package/dist/lib/browser/{chunk-VOAOTNGS.mjs → chunk-KMUDYITM.mjs} +4 -2
- package/dist/lib/browser/chunk-KMUDYITM.mjs.map +7 -0
- package/dist/lib/browser/cli/index.mjs +15 -16
- package/dist/lib/browser/cli/index.mjs.map +3 -3
- package/dist/lib/browser/index.mjs +15 -12
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{operation-resolver-P5PKLPRT.mjs → operation-resolver-PK4B2BZQ.mjs} +7 -6
- package/dist/lib/browser/operation-resolver-PK4B2BZQ.mjs.map +7 -0
- package/dist/lib/browser/react-surface-ZBP7YXKO.mjs +85 -0
- package/dist/lib/browser/react-surface-ZBP7YXKO.mjs.map +7 -0
- package/dist/lib/node-esm/PluginArticle-3NEYDKN5.mjs +30 -0
- package/dist/lib/node-esm/PluginArticle-3NEYDKN5.mjs.map +7 -0
- package/dist/lib/node-esm/PluginRegistry-BYKWC732.mjs +79 -0
- package/dist/lib/node-esm/PluginRegistry-BYKWC732.mjs.map +7 -0
- package/dist/lib/node-esm/{app-graph-builder-56JXLOGZ.mjs → app-graph-builder-DBDL5WWF.mjs} +21 -20
- package/dist/lib/node-esm/app-graph-builder-DBDL5WWF.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-BOCFM775.mjs +192 -0
- package/dist/lib/node-esm/chunk-BOCFM775.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-SALMIZ2W.mjs → chunk-ENSNUFQK.mjs} +4 -2
- package/dist/lib/node-esm/chunk-ENSNUFQK.mjs.map +7 -0
- package/dist/lib/node-esm/cli/index.mjs +15 -16
- package/dist/lib/node-esm/cli/index.mjs.map +3 -3
- package/dist/lib/node-esm/index.mjs +15 -12
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/{operation-resolver-3ZB5W3T3.mjs → operation-resolver-CCHN4NBP.mjs} +7 -6
- package/dist/lib/node-esm/operation-resolver-CCHN4NBP.mjs.map +7 -0
- package/dist/lib/node-esm/react-surface-FJHMLGZF.mjs +86 -0
- package/dist/lib/node-esm/react-surface-FJHMLGZF.mjs.map +7 -0
- package/dist/types/src/RegistryPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts +1 -1
- package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/capabilities/operation-resolver/index.d.ts +1 -1
- package/dist/types/src/capabilities/operation-resolver/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts +2 -2
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface/index.d.ts +1 -1
- package/dist/types/src/capabilities/react-surface/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts +2 -2
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +1 -1
- package/dist/types/src/cli/commands/disable.d.ts +2 -2
- package/dist/types/src/cli/commands/enable.d.ts +2 -2
- package/dist/types/src/cli/plugin.d.ts.map +1 -1
- package/dist/types/src/cli/storage.d.ts +4 -4
- package/dist/types/src/cli/storage.d.ts.map +1 -1
- package/dist/types/src/components/PluginDetail/PluginDetail.d.ts.map +1 -0
- package/dist/types/src/components/{PluginDetail.stories.d.ts → PluginDetail/PluginDetail.stories.d.ts} +1 -0
- package/dist/types/src/components/PluginDetail/PluginDetail.stories.d.ts.map +1 -0
- package/dist/types/src/components/PluginDetail/index.d.ts +2 -0
- package/dist/types/src/components/PluginDetail/index.d.ts.map +1 -0
- package/dist/types/src/components/PluginList/PluginItem.d.ts.map +1 -0
- package/dist/types/src/components/PluginList/PluginList.d.ts.map +1 -0
- package/dist/types/src/components/PluginList/PluginList.stories.d.ts.map +1 -0
- package/dist/types/src/components/PluginList/index.d.ts +2 -0
- package/dist/types/src/components/PluginList/index.d.ts.map +1 -0
- package/dist/types/src/components/index.d.ts +0 -1
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/containers/PluginArticle/PluginArticle.d.ts +7 -0
- package/dist/types/src/containers/PluginArticle/PluginArticle.d.ts.map +1 -0
- package/dist/types/src/containers/PluginArticle/index.d.ts +3 -0
- package/dist/types/src/containers/PluginArticle/index.d.ts.map +1 -0
- package/dist/types/src/containers/PluginRegistry/PluginRegistry.d.ts +8 -0
- package/dist/types/src/containers/PluginRegistry/PluginRegistry.d.ts.map +1 -0
- package/dist/types/src/containers/PluginRegistry/index.d.ts +3 -0
- package/dist/types/src/containers/PluginRegistry/index.d.ts.map +1 -0
- package/dist/types/src/containers/index.d.ts +4 -0
- package/dist/types/src/containers/index.d.ts.map +1 -0
- package/dist/types/src/meta.d.ts +2 -0
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +33 -31
- package/src/RegistryPlugin.tsx +6 -5
- package/src/capabilities/app-graph-builder/app-graph-builder.ts +23 -22
- package/src/capabilities/operation-resolver/operation-resolver.ts +4 -3
- package/src/capabilities/react-surface/react-surface.tsx +24 -35
- package/src/cli/plugin.ts +3 -2
- package/src/cli/storage.ts +14 -21
- package/src/components/{PluginDetail.stories.tsx → PluginDetail/PluginDetail.stories.tsx} +4 -3
- package/src/components/PluginDetail/PluginDetail.tsx +81 -0
- package/src/components/PluginDetail/index.ts +5 -0
- package/src/components/{PluginItem.tsx → PluginList/PluginItem.tsx} +14 -10
- package/src/components/{PluginList.stories.tsx → PluginList/PluginList.stories.tsx} +14 -7
- package/src/components/PluginList/index.ts +5 -0
- package/src/components/index.ts +0 -1
- package/src/containers/PluginArticle/PluginArticle.tsx +28 -0
- package/src/containers/PluginArticle/index.ts +7 -0
- package/src/{components/RegistryContainer.tsx → containers/PluginRegistry/PluginRegistry.tsx} +23 -20
- package/src/containers/PluginRegistry/index.ts +7 -0
- package/src/containers/index.ts +8 -0
- package/src/meta.ts +4 -4
- package/dist/lib/browser/app-graph-builder-P3ZGGFAR.mjs.map +0 -7
- package/dist/lib/browser/chunk-VOAOTNGS.mjs.map +0 -7
- package/dist/lib/browser/operation-resolver-P5PKLPRT.mjs.map +0 -7
- package/dist/lib/browser/react-surface-IIM6T7IA.mjs +0 -337
- package/dist/lib/browser/react-surface-IIM6T7IA.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-builder-56JXLOGZ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-SALMIZ2W.mjs.map +0 -7
- package/dist/lib/node-esm/operation-resolver-3ZB5W3T3.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-F67P7RC3.mjs +0 -338
- package/dist/lib/node-esm/react-surface-F67P7RC3.mjs.map +0 -7
- package/dist/types/src/components/PluginDetail.d.ts.map +0 -1
- package/dist/types/src/components/PluginDetail.stories.d.ts.map +0 -1
- package/dist/types/src/components/PluginItem.d.ts.map +0 -1
- package/dist/types/src/components/PluginList.d.ts.map +0 -1
- package/dist/types/src/components/PluginList.stories.d.ts.map +0 -1
- package/dist/types/src/components/RegistryContainer.d.ts +0 -8
- package/dist/types/src/components/RegistryContainer.d.ts.map +0 -1
- package/src/components/PluginDetail.tsx +0 -79
- /package/dist/types/src/components/{PluginDetail.d.ts → PluginDetail/PluginDetail.d.ts} +0 -0
- /package/dist/types/src/components/{PluginItem.d.ts → PluginList/PluginItem.d.ts} +0 -0
- /package/dist/types/src/components/{PluginList.d.ts → PluginList/PluginList.d.ts} +0 -0
- /package/dist/types/src/components/{PluginList.stories.d.ts → PluginList/PluginList.stories.d.ts} +0 -0
- /package/src/components/{PluginList.tsx → PluginList/PluginList.tsx} +0 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/containers/PluginRegistry/PluginRegistry.tsx", "../../../src/containers/PluginRegistry/index.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { useAtomValue } from '@effect-atom/atom-react';\nimport * as Effect from 'effect/Effect';\nimport React, { useCallback, useMemo } from 'react';\n\nimport { type Plugin } from '@dxos/app-framework';\nimport { useCapabilities, useOperationInvoker, usePluginManager } from '@dxos/app-framework/ui';\nimport { AppCapabilities, LayoutOperation, SettingsOperation } from '@dxos/app-toolkit';\nimport { runAndForwardErrors } from '@dxos/effect';\nimport { ObservabilityOperation } from '@dxos/plugin-observability/types';\nimport { ScrollArea } from '@dxos/react-ui';\n\nimport { PluginList } from '../../components';\nimport { getPluginPath } from '../../meta';\n\nconst sortByPluginMeta = ({ meta: { name: a = '' } }: Plugin.Plugin, { meta: { name: b = '' } }: Plugin.Plugin) =>\n a.localeCompare(b);\n\nexport type PluginRegistryProps = {\n id: string;\n plugins: Plugin.Plugin[];\n};\n\nexport const PluginRegistry = ({ id, plugins: pluginsProp }: PluginRegistryProps) => {\n const manager = usePluginManager();\n const { invoke, invokePromise } = useOperationInvoker();\n const plugins = useMemo(() => pluginsProp.sort(sortByPluginMeta), [pluginsProp]);\n const enabled = useAtomValue(manager.enabled);\n const allSettings = useCapabilities(AppCapabilities.Settings);\n\n // TODO(wittjosiah): Factor out to an intent?\n const handleChange = useCallback(\n (id: string, enabled: boolean) =>\n Effect.gen(function* () {\n if (enabled) {\n yield* manager.enable(id);\n } else {\n yield* manager.disable(id);\n }\n\n yield* invoke(ObservabilityOperation.SendEvent, {\n name: 'plugins.toggle',\n properties: {\n plugin: id,\n enabled,\n },\n });\n }).pipe(runAndForwardErrors),\n [invoke, manager],\n );\n\n const handleClick = useCallback(\n (pluginId: string) =>\n invokePromise(LayoutOperation.Open, {\n subject: [getPluginPath(pluginId)],\n pivotId: id,\n positioning: 'end',\n }),\n [invokePromise, id],\n );\n\n const hasSettings = useCallback((pluginId: string) => allSettings.some((s) => s.prefix === pluginId), [allSettings]);\n\n const handleSettings = useCallback(\n (pluginId: string) => invokePromise(SettingsOperation.Open, { plugin: pluginId }),\n [invokePromise],\n );\n\n return (\n <ScrollArea.Root orientation='vertical'>\n <ScrollArea.Viewport>\n <PluginList\n plugins={plugins}\n enabled={enabled}\n onClick={handleClick}\n onChange={handleChange}\n hasSettings={hasSettings}\n onSettings={handleSettings}\n />\n </ScrollArea.Viewport>\n </ScrollArea.Root>\n );\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { PluginRegistry } from './PluginRegistry';\n\nexport default PluginRegistry;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;AAIA,SAASA,oBAAoB;AAC7B,YAAYC,YAAY;AACxB,OAAOC,SAASC,aAAaC,eAAe;AAG5C,SAASC,iBAAiBC,qBAAqBC,wBAAwB;AACvE,SAASC,iBAAiBC,iBAAiBC,yBAAyB;AACpE,SAASC,2BAA2B;AACpC,SAASC,8BAA8B;AACvC,SAASC,kBAAkB;AAK3B,IAAMC,mBAAmB,CAAC,EAAEC,MAAM,EAAEC,MAAMC,IAAI,GAAE,EAAE,GAAmB,EAAEF,MAAM,EAAEC,MAAME,IAAI,GAAE,EAAE,MAC3FD,EAAEE,cAAcD,CAAAA;AAOX,IAAME,iBAAiB,CAAC,EAAEC,IAAIC,SAASC,YAAW,MAA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React", "useCallback", "useMemo", "useCapabilities", "useOperationInvoker", "usePluginManager", "AppCapabilities", "LayoutOperation", "SettingsOperation", "runAndForwardErrors", "ObservabilityOperation", "ScrollArea", "sortByPluginMeta", "meta", "name", "a", "b", "localeCompare", "PluginRegistry", "id", "plugins", "pluginsProp", "manager", "usePluginManager", "invoke", "invokePromise", "useOperationInvoker", "useMemo", "sort", "enabled", "useAtomValue", "allSettings", "useCapabilities", "AppCapabilities", "Settings", "handleChange", "useCallback", "gen", "enable", "disable", "ObservabilityOperation", "SendEvent", "properties", "plugin", "pipe", "runAndForwardErrors", "handleClick", "pluginId", "LayoutOperation", "Open", "subject", "getPluginPath", "pivotId", "positioning", "hasSettings", "some", "s", "prefix", "handleSettings", "SettingsOperation", "ScrollArea", "Root", "orientation", "Viewport", "PluginList", "onClick", "onChange", "onSettings", "PluginRegistry"]
|
|
7
|
+
}
|
|
@@ -3,11 +3,12 @@ import {
|
|
|
3
3
|
REGISTRY_ID,
|
|
4
4
|
REGISTRY_KEY,
|
|
5
5
|
meta
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-ENSNUFQK.mjs";
|
|
7
7
|
|
|
8
8
|
// src/capabilities/app-graph-builder/app-graph-builder.ts
|
|
9
9
|
import * as Effect from "effect/Effect";
|
|
10
|
-
import {
|
|
10
|
+
import { Capabilities, Capability } from "@dxos/app-framework";
|
|
11
|
+
import { AppCapabilities, SettingsOperation } from "@dxos/app-toolkit";
|
|
11
12
|
import { Operation } from "@dxos/operation";
|
|
12
13
|
import { GraphBuilder, NodeMatcher } from "@dxos/plugin-graph";
|
|
13
14
|
var app_graph_builder_default = Capability.makeModule(Effect.fnUntraced(function* () {
|
|
@@ -53,9 +54,9 @@ var app_graph_builder_default = Capability.makeModule(Effect.fnUntraced(function
|
|
|
53
54
|
},
|
|
54
55
|
nodes: [
|
|
55
56
|
{
|
|
56
|
-
id: `${REGISTRY_KEY}
|
|
57
|
+
id: `${REGISTRY_KEY}>all`,
|
|
57
58
|
type: "category",
|
|
58
|
-
data: `${REGISTRY_KEY}
|
|
59
|
+
data: `${REGISTRY_KEY}>all`,
|
|
59
60
|
properties: {
|
|
60
61
|
label: [
|
|
61
62
|
"all plugins label",
|
|
@@ -69,9 +70,9 @@ var app_graph_builder_default = Capability.makeModule(Effect.fnUntraced(function
|
|
|
69
70
|
}
|
|
70
71
|
},
|
|
71
72
|
{
|
|
72
|
-
id: `${REGISTRY_KEY}
|
|
73
|
+
id: `${REGISTRY_KEY}>installed`,
|
|
73
74
|
type: "category",
|
|
74
|
-
data: `${REGISTRY_KEY}
|
|
75
|
+
data: `${REGISTRY_KEY}>installed`,
|
|
75
76
|
properties: {
|
|
76
77
|
label: [
|
|
77
78
|
"installed plugins label",
|
|
@@ -85,9 +86,9 @@ var app_graph_builder_default = Capability.makeModule(Effect.fnUntraced(function
|
|
|
85
86
|
}
|
|
86
87
|
},
|
|
87
88
|
{
|
|
88
|
-
id: `${REGISTRY_KEY}
|
|
89
|
+
id: `${REGISTRY_KEY}>recommended`,
|
|
89
90
|
type: "category",
|
|
90
|
-
data: `${REGISTRY_KEY}
|
|
91
|
+
data: `${REGISTRY_KEY}>recommended`,
|
|
91
92
|
properties: {
|
|
92
93
|
label: [
|
|
93
94
|
"recommended plugins label",
|
|
@@ -101,9 +102,9 @@ var app_graph_builder_default = Capability.makeModule(Effect.fnUntraced(function
|
|
|
101
102
|
}
|
|
102
103
|
},
|
|
103
104
|
{
|
|
104
|
-
id: `${REGISTRY_KEY}
|
|
105
|
+
id: `${REGISTRY_KEY}>labs`,
|
|
105
106
|
type: "category",
|
|
106
|
-
data: `${REGISTRY_KEY}
|
|
107
|
+
data: `${REGISTRY_KEY}>labs`,
|
|
107
108
|
properties: {
|
|
108
109
|
label: [
|
|
109
110
|
"labs plugins label",
|
|
@@ -121,11 +122,11 @@ var app_graph_builder_default = Capability.makeModule(Effect.fnUntraced(function
|
|
|
121
122
|
])
|
|
122
123
|
}),
|
|
123
124
|
GraphBuilder.createExtension({
|
|
124
|
-
id: `${meta.id}
|
|
125
|
-
match: NodeMatcher.whenId(REGISTRY_ID),
|
|
125
|
+
id: `${meta.id}.actions`,
|
|
126
|
+
match: NodeMatcher.whenId(`root/${REGISTRY_ID}`),
|
|
126
127
|
actions: () => Effect.succeed([
|
|
127
128
|
{
|
|
128
|
-
id: `${meta.id}
|
|
129
|
+
id: `${meta.id}.load-by-url`,
|
|
129
130
|
data: Effect.fnUntraced(function* () {
|
|
130
131
|
}),
|
|
131
132
|
properties: {
|
|
@@ -142,13 +143,13 @@ var app_graph_builder_default = Capability.makeModule(Effect.fnUntraced(function
|
|
|
142
143
|
])
|
|
143
144
|
}),
|
|
144
145
|
GraphBuilder.createExtension({
|
|
145
|
-
id: `${meta.id}
|
|
146
|
-
match: NodeMatcher.whenId(REGISTRY_ID),
|
|
146
|
+
id: `${meta.id}.plugins`,
|
|
147
|
+
match: NodeMatcher.whenId(`root/${REGISTRY_ID}`),
|
|
147
148
|
connector: () => {
|
|
148
|
-
const manager = capabilities.get(
|
|
149
|
+
const manager = capabilities.get(Capabilities.PluginManager);
|
|
149
150
|
return Effect.succeed(manager.getPlugins().map((plugin) => ({
|
|
150
|
-
id: plugin.meta.id
|
|
151
|
-
type: "dxos.
|
|
151
|
+
id: plugin.meta.id,
|
|
152
|
+
type: "org.dxos.plugin",
|
|
152
153
|
data: plugin,
|
|
153
154
|
properties: {
|
|
154
155
|
label: plugin.meta.name ?? plugin.meta.id,
|
|
@@ -159,9 +160,9 @@ var app_graph_builder_default = Capability.makeModule(Effect.fnUntraced(function
|
|
|
159
160
|
}
|
|
160
161
|
})
|
|
161
162
|
]);
|
|
162
|
-
return Capability.contributes(
|
|
163
|
+
return Capability.contributes(AppCapabilities.AppGraphBuilder, extensions);
|
|
163
164
|
}));
|
|
164
165
|
export {
|
|
165
166
|
app_graph_builder_default as default
|
|
166
167
|
};
|
|
167
|
-
//# sourceMappingURL=app-graph-builder-
|
|
168
|
+
//# sourceMappingURL=app-graph-builder-DBDL5WWF.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/capabilities/app-graph-builder/app-graph-builder.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\n\nimport { Capabilities, Capability } from '@dxos/app-framework';\nimport { AppCapabilities, SettingsOperation } from '@dxos/app-toolkit';\nimport { Operation } from '@dxos/operation';\nimport { GraphBuilder, NodeMatcher } from '@dxos/plugin-graph';\n\nimport { REGISTRY_ID, REGISTRY_KEY, meta } from '../../meta';\n\nexport default Capability.makeModule(\n Effect.fnUntraced(function* () {\n const capabilities = yield* Capability.Service;\n\n const extensions = yield* Effect.all([\n GraphBuilder.createExtension({\n id: meta.id,\n match: NodeMatcher.whenRoot,\n actions: () =>\n Effect.succeed([\n {\n id: meta.id,\n data: () => Operation.invoke(SettingsOperation.OpenPluginRegistry),\n properties: {\n label: ['open plugin registry label', { ns: meta.id }],\n icon: 'ph--squares-four--regular',\n disposition: 'menu',\n },\n },\n ]),\n }),\n GraphBuilder.createExtension({\n id: meta.id,\n match: NodeMatcher.whenRoot,\n connector: () =>\n Effect.succeed([\n {\n id: REGISTRY_ID,\n type: meta.id,\n properties: {\n label: ['plugin registry label', { ns: meta.id }],\n icon: 'ph--squares-four--regular',\n disposition: 'pin-end',\n testId: 'treeView.pluginRegistry',\n },\n nodes: [\n {\n id: `${REGISTRY_KEY}>all`,\n type: 'category' as const,\n data: `${REGISTRY_KEY}>all`,\n properties: {\n label: ['all plugins label', { ns: meta.id }],\n icon: 'ph--squares-four--regular',\n key: REGISTRY_KEY,\n testId: 'pluginRegistry.all',\n },\n },\n {\n id: `${REGISTRY_KEY}>installed`,\n type: 'category' as const,\n data: `${REGISTRY_KEY}>installed`,\n properties: {\n label: ['installed plugins label', { ns: meta.id }],\n icon: 'ph--check--regular',\n key: REGISTRY_KEY,\n testId: 'pluginRegistry.installed',\n },\n },\n {\n id: `${REGISTRY_KEY}>recommended`,\n type: 'category' as const,\n data: `${REGISTRY_KEY}>recommended`,\n properties: {\n label: ['recommended plugins label', { ns: meta.id }],\n icon: 'ph--star--regular',\n key: REGISTRY_KEY,\n testId: 'pluginRegistry.recommended',\n },\n },\n {\n id: `${REGISTRY_KEY}>labs`,\n type: 'category' as const,\n data: `${REGISTRY_KEY}>labs`,\n properties: {\n label: ['labs plugins label', { ns: meta.id }],\n icon: 'ph--flask--regular',\n key: REGISTRY_KEY,\n testId: 'pluginRegistry.labs',\n },\n },\n ],\n },\n ]),\n }),\n GraphBuilder.createExtension({\n id: `${meta.id}.actions`,\n match: NodeMatcher.whenId(`root/${REGISTRY_ID}`),\n actions: () =>\n Effect.succeed([\n {\n id: `${meta.id}.load-by-url`,\n data: Effect.fnUntraced(function* () {}),\n properties: {\n label: ['load by url label', { ns: meta.id }],\n icon: 'ph--cloud-arrow-down--regular',\n disabled: true,\n },\n },\n ]),\n }),\n GraphBuilder.createExtension({\n id: `${meta.id}.plugins`,\n match: NodeMatcher.whenId(`root/${REGISTRY_ID}`),\n connector: () => {\n const manager = capabilities.get(Capabilities.PluginManager);\n return Effect.succeed(\n manager.getPlugins().map((plugin) => ({\n id: plugin.meta.id,\n type: 'org.dxos.plugin',\n data: plugin,\n properties: {\n label: plugin.meta.name ?? plugin.meta.id,\n icon: plugin.meta.icon ?? 'ph--circle--regular',\n disposition: 'hidden',\n },\n })),\n );\n },\n }),\n ]);\n\n return Capability.contributes(AppCapabilities.AppGraphBuilder, extensions);\n }),\n);\n"],
|
|
5
|
+
"mappings": ";;;;;;;;AAIA,YAAYA,YAAY;AAExB,SAASC,cAAcC,kBAAkB;AACzC,SAASC,iBAAiBC,yBAAyB;AACnD,SAASC,iBAAiB;AAC1B,SAASC,cAAcC,mBAAmB;AAI1C,IAAA,4BAAeC,WAAWC,WACjBC,kBAAW,aAAA;AAChB,QAAMC,eAAe,OAAOH,WAAWI;AAEvC,QAAMC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e,YAAAA;cACTV,YAAY;gBACVC,OAAO;kBAAC;kBAAsB;oBAAEC,IAAIb,KAAKD;kBAAG;;gBAC5Ce,MAAM;gBACNQ,KAAKD;gBACLF,QAAQ;cACV;YACF;;QAEJ;OACD;IACL,CAAA;IACAtB,aAAaC,gBAAgB;MAC3BC,IAAI,GAAGC,KAAKD,EAAE;MACdE,OAAOC,YAAYqB,OAAO,QAAQN,WAAAA,EAAa;MAC/Cb,SAAS,MACAC,eAAQ;QACb;UACEN,IAAI,GAAGC,KAAKD,EAAE;UACdO,MAAad,kBAAW,aAAA;UAAc,CAAA;UACtCmB,YAAY;YACVC,OAAO;cAAC;cAAqB;gBAAEC,IAAIb,KAAKD;cAAG;;YAC3Ce,MAAM;YACNU,UAAU;UACZ;QACF;OACD;IACL,CAAA;IACA3B,aAAaC,gBAAgB;MAC3BC,IAAI,GAAGC,KAAKD,EAAE;MACdE,OAAOC,YAAYqB,OAAO,QAAQN,WAAAA,EAAa;MAC/CD,WAAW,MAAA;AACT,cAAMS,UAAUhC,aAAaiC,IAAIC,aAAaC,aAAa;AAC3D,eAAcvB,eACZoB,QAAQI,WAAU,EAAGC,IAAI,CAACC,YAAY;UACpChC,IAAIgC,OAAO/B,KAAKD;UAChBmB,MAAM;UACNZ,MAAMyB;UACNpB,YAAY;YACVC,OAAOmB,OAAO/B,KAAKgC,QAAQD,OAAO/B,KAAKD;YACvCe,MAAMiB,OAAO/B,KAAKc,QAAQ;YAC1BC,aAAa;UACf;QACF,EAAA,CAAA;MAEJ;IACF,CAAA;GACD;AAED,SAAOzB,WAAW2C,YAAYC,gBAAgBC,iBAAiBxC,UAAAA;AACjE,CAAA,CAAA;",
|
|
6
|
+
"names": ["Effect", "Capabilities", "Capability", "AppCapabilities", "SettingsOperation", "Operation", "GraphBuilder", "NodeMatcher", "Capability", "makeModule", "fnUntraced", "capabilities", "Service", "extensions", "all", "GraphBuilder", "createExtension", "id", "meta", "match", "NodeMatcher", "whenRoot", "actions", "succeed", "data", "Operation", "invoke", "SettingsOperation", "OpenPluginRegistry", "properties", "label", "ns", "icon", "disposition", "connector", "REGISTRY_ID", "type", "testId", "nodes", "REGISTRY_KEY", "key", "whenId", "disabled", "manager", "get", "Capabilities", "PluginManager", "getPlugins", "map", "plugin", "name", "contributes", "AppCapabilities", "AppGraphBuilder"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
meta
|
|
4
|
+
} from "./chunk-ENSNUFQK.mjs";
|
|
5
|
+
|
|
6
|
+
// src/components/PluginDetail/PluginDetail.tsx
|
|
7
|
+
import React from "react";
|
|
8
|
+
import { Icon, Input, Link, useTranslation } from "@dxos/react-ui";
|
|
9
|
+
import { ScrollArea } from "@dxos/react-ui";
|
|
10
|
+
import { getStyles, mx } from "@dxos/ui-theme";
|
|
11
|
+
var PluginDetail = ({ plugin, enabled, onEnabledChange }) => {
|
|
12
|
+
const { t } = useTranslation(meta.id);
|
|
13
|
+
const { id, name, description, homePage, source, screenshots, icon = "ph--circle--regular", iconHue = "neutral" } = plugin.meta;
|
|
14
|
+
const styles = getStyles(iconHue);
|
|
15
|
+
return /* @__PURE__ */ React.createElement(ScrollArea.Root, {
|
|
16
|
+
orientation: "vertical"
|
|
17
|
+
}, /* @__PURE__ */ React.createElement(ScrollArea.Viewport, null, /* @__PURE__ */ React.createElement("div", {
|
|
18
|
+
role: "none",
|
|
19
|
+
className: "dx-document grid grid-cols-[min-content_1fr] gap-4 p-4"
|
|
20
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
21
|
+
role: "none"
|
|
22
|
+
}, /* @__PURE__ */ React.createElement(Icon, {
|
|
23
|
+
classNames: mx("p-1 rounded-md", styles.fill, styles.surfaceText),
|
|
24
|
+
icon,
|
|
25
|
+
size: 14
|
|
26
|
+
})), /* @__PURE__ */ React.createElement("div", {
|
|
27
|
+
role: "none",
|
|
28
|
+
className: "flex flex-col gap-6"
|
|
29
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
30
|
+
role: "none",
|
|
31
|
+
className: "grid grid-cols-[1fr_min-content] gap-x-3 w-full pt-1"
|
|
32
|
+
}, /* @__PURE__ */ React.createElement("h2", {
|
|
33
|
+
className: "text-xl"
|
|
34
|
+
}, name), /* @__PURE__ */ React.createElement(Input.Root, null, /* @__PURE__ */ React.createElement(Input.Switch, {
|
|
35
|
+
classNames: "self-center",
|
|
36
|
+
checked: enabled,
|
|
37
|
+
onCheckedChange: onEnabledChange
|
|
38
|
+
})), /* @__PURE__ */ React.createElement("p", {
|
|
39
|
+
className: "pt-0.5 text-sm text-description"
|
|
40
|
+
}, id)), /* @__PURE__ */ React.createElement("div", {
|
|
41
|
+
role: "none"
|
|
42
|
+
}, /* @__PURE__ */ React.createElement("p", {
|
|
43
|
+
className: "text-description"
|
|
44
|
+
}, description)), screenshots && screenshots.length > 0 && /* @__PURE__ */ React.createElement("div", {
|
|
45
|
+
role: "none",
|
|
46
|
+
className: "flex flex-col gap-2"
|
|
47
|
+
}, /* @__PURE__ */ React.createElement("h2", null, "Preview"), /* @__PURE__ */ React.createElement("img", {
|
|
48
|
+
src: screenshots[0],
|
|
49
|
+
alt: name,
|
|
50
|
+
className: "aspect-video object-fit"
|
|
51
|
+
})), /* @__PURE__ */ React.createElement("div", {
|
|
52
|
+
role: "none",
|
|
53
|
+
className: "flex flex-col gap-2"
|
|
54
|
+
}, /* @__PURE__ */ React.createElement("h2", null, "Resources"), /* @__PURE__ */ React.createElement("div", {
|
|
55
|
+
className: "flex gap-2"
|
|
56
|
+
}, homePage && /* @__PURE__ */ React.createElement(Link, {
|
|
57
|
+
href: homePage,
|
|
58
|
+
target: "_blank",
|
|
59
|
+
rel: "noreferrer",
|
|
60
|
+
classNames: "text-sm text-description"
|
|
61
|
+
}, t("home page label"), /* @__PURE__ */ React.createElement(Icon, {
|
|
62
|
+
icon: "ph--arrow-square-out--bold",
|
|
63
|
+
size: 3,
|
|
64
|
+
classNames: "inline-block leading-none mx-1"
|
|
65
|
+
})), source && /* @__PURE__ */ React.createElement(Link, {
|
|
66
|
+
href: source,
|
|
67
|
+
target: "_blank",
|
|
68
|
+
rel: "noreferrer",
|
|
69
|
+
classNames: "text-sm text-description"
|
|
70
|
+
}, t("source label"), /* @__PURE__ */ React.createElement(Icon, {
|
|
71
|
+
icon: "ph--arrow-square-out--bold",
|
|
72
|
+
size: 3,
|
|
73
|
+
classNames: "inline-block leading-none mx-1"
|
|
74
|
+
}))))))));
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
// src/components/PluginList/PluginList.tsx
|
|
78
|
+
import React3 from "react";
|
|
79
|
+
import { List } from "@dxos/react-ui";
|
|
80
|
+
|
|
81
|
+
// src/components/PluginList/PluginItem.tsx
|
|
82
|
+
import React2, { useCallback } from "react";
|
|
83
|
+
import { Icon as Icon2, IconButton, Input as Input2, Link as Link2, ListItem, Tag, useTranslation as useTranslation2 } from "@dxos/react-ui";
|
|
84
|
+
import { mx as mx2 } from "@dxos/ui-theme";
|
|
85
|
+
import { getStyles as getStyles2 } from "@dxos/ui-theme";
|
|
86
|
+
var PluginItem = ({ plugin, enabled = [], onClick, onChange, hasSettings: hasSettingsProp, onSettings }) => {
|
|
87
|
+
const { t } = useTranslation2(meta.id);
|
|
88
|
+
const { id, name, description, tags, icon = "ph--circle--regular", iconHue = "neutral" } = plugin.meta;
|
|
89
|
+
const isEnabled = enabled.includes(id);
|
|
90
|
+
const inputId = `${id}-input`;
|
|
91
|
+
const labelId = `${id}-label`;
|
|
92
|
+
const descriptionId = `${id}-description`;
|
|
93
|
+
const handleClick = useCallback(() => onClick?.(id), [
|
|
94
|
+
id,
|
|
95
|
+
onClick
|
|
96
|
+
]);
|
|
97
|
+
const handleChange = useCallback((event) => {
|
|
98
|
+
event.stopPropagation();
|
|
99
|
+
onChange?.(id, !isEnabled);
|
|
100
|
+
}, [
|
|
101
|
+
id,
|
|
102
|
+
isEnabled,
|
|
103
|
+
onChange
|
|
104
|
+
]);
|
|
105
|
+
const hasSettings = hasSettingsProp?.(id) ?? false;
|
|
106
|
+
const handleSettings = useCallback(() => onSettings?.(id), [
|
|
107
|
+
id,
|
|
108
|
+
onSettings
|
|
109
|
+
]);
|
|
110
|
+
const styles = getStyles2(iconHue);
|
|
111
|
+
const gridCols = "grid grid-cols-[5rem_1fr]";
|
|
112
|
+
const gridRows = "grid grid-rows-[40px_1fr_min-content_40px]";
|
|
113
|
+
return /* @__PURE__ */ React2.createElement(ListItem.Root, {
|
|
114
|
+
key: id,
|
|
115
|
+
labelId,
|
|
116
|
+
"data-testid": `pluginList.${id}`,
|
|
117
|
+
"aria-describedby": descriptionId,
|
|
118
|
+
classNames: mx2(gridCols, "h-[12rem] w-full gap-3 pe-2 bg-modal-surface rounded-md overflow-hidden")
|
|
119
|
+
}, /* @__PURE__ */ React2.createElement("div", {
|
|
120
|
+
className: mx2(gridRows, "justify-center rounded-l-md", styles.surface)
|
|
121
|
+
}, /* @__PURE__ */ React2.createElement(Icon2, {
|
|
122
|
+
classNames: mx2("row-start-2 cursor-pointer", styles.surfaceText),
|
|
123
|
+
icon,
|
|
124
|
+
size: 14,
|
|
125
|
+
onClick: handleClick
|
|
126
|
+
})), /* @__PURE__ */ React2.createElement("div", {
|
|
127
|
+
className: mx2(gridRows)
|
|
128
|
+
}, /* @__PURE__ */ React2.createElement("div", {
|
|
129
|
+
className: "flex items-center overflow-hidden cursor-pointer",
|
|
130
|
+
onClick: handleClick
|
|
131
|
+
}, /* @__PURE__ */ React2.createElement("span", {
|
|
132
|
+
className: "text-lg truncate"
|
|
133
|
+
}, name ?? id)), /* @__PURE__ */ React2.createElement("div", null, /* @__PURE__ */ React2.createElement("p", {
|
|
134
|
+
className: mx2("text-description", "line-clamp-4 min-w-0")
|
|
135
|
+
}, description)), /* @__PURE__ */ React2.createElement("div", {
|
|
136
|
+
className: "flex -ms-0.5 overflow-x-auto scrollbar-none"
|
|
137
|
+
}, tags?.map((tag) => /* @__PURE__ */ React2.createElement(Tag, {
|
|
138
|
+
key: tag,
|
|
139
|
+
palette: tagColors[tag],
|
|
140
|
+
classNames: "text-xs uppercase font-thin"
|
|
141
|
+
}, tag))), /* @__PURE__ */ React2.createElement("div", {
|
|
142
|
+
className: "flex gap-2 items-center text-sm"
|
|
143
|
+
}, /* @__PURE__ */ React2.createElement(IconButton, {
|
|
144
|
+
"aria-describedby": descriptionId,
|
|
145
|
+
classNames: "cursor-pointer",
|
|
146
|
+
icon: "ph--gear--regular",
|
|
147
|
+
label: t("settings label"),
|
|
148
|
+
iconOnly: true,
|
|
149
|
+
size: 4,
|
|
150
|
+
onClick: handleSettings,
|
|
151
|
+
disabled: !hasSettings
|
|
152
|
+
}), /* @__PURE__ */ React2.createElement(Link2, {
|
|
153
|
+
"aria-describedby": descriptionId,
|
|
154
|
+
classNames: "text-description cursor-pointer",
|
|
155
|
+
onClick: handleClick
|
|
156
|
+
}, t("details label")), /* @__PURE__ */ React2.createElement("div", {
|
|
157
|
+
className: "grow"
|
|
158
|
+
}), /* @__PURE__ */ React2.createElement("div", {
|
|
159
|
+
className: "pe-1"
|
|
160
|
+
}, /* @__PURE__ */ React2.createElement(Input2.Root, {
|
|
161
|
+
id: inputId
|
|
162
|
+
}, /* @__PURE__ */ React2.createElement(Input2.Switch, {
|
|
163
|
+
classNames: "self-center",
|
|
164
|
+
checked: isEnabled,
|
|
165
|
+
onClick: handleChange
|
|
166
|
+
}))))));
|
|
167
|
+
};
|
|
168
|
+
var tagColors = {
|
|
169
|
+
new: "rose",
|
|
170
|
+
beta: "teal",
|
|
171
|
+
labs: "blue",
|
|
172
|
+
popular: "green",
|
|
173
|
+
featured: "pink",
|
|
174
|
+
experimental: "amber"
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
// src/components/PluginList/PluginList.tsx
|
|
178
|
+
var PluginList = ({ plugins = [], ...props }) => {
|
|
179
|
+
return /* @__PURE__ */ React3.createElement(List, {
|
|
180
|
+
classNames: "grid grid-cols-[repeat(auto-fill,minmax(18rem,1fr))] auto-rows-[max-content] gap-4 p-4"
|
|
181
|
+
}, plugins.map((plugin) => /* @__PURE__ */ React3.createElement(PluginItem, {
|
|
182
|
+
key: plugin.meta.id,
|
|
183
|
+
plugin,
|
|
184
|
+
...props
|
|
185
|
+
})));
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
export {
|
|
189
|
+
PluginDetail,
|
|
190
|
+
PluginList
|
|
191
|
+
};
|
|
192
|
+
//# sourceMappingURL=chunk-BOCFM775.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/PluginDetail/PluginDetail.tsx", "../../../src/components/PluginList/PluginList.tsx", "../../../src/components/PluginList/PluginItem.tsx"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport React from 'react';\n\nimport { type Plugin } from '@dxos/app-framework';\nimport { Icon, Input, Link, useTranslation } from '@dxos/react-ui';\nimport { ScrollArea } from '@dxos/react-ui';\nimport { getStyles, mx } from '@dxos/ui-theme';\n\nimport { meta } from '../../meta';\n\nexport type PluginDetailProps = {\n plugin: Plugin.Plugin;\n enabled?: boolean;\n onEnabledChange?: (enabled: boolean) => void;\n};\n\nexport const PluginDetail = ({ plugin, enabled, onEnabledChange }: PluginDetailProps) => {\n const { t } = useTranslation(meta.id);\n const {\n id,\n name,\n description,\n homePage,\n source,\n screenshots,\n icon = 'ph--circle--regular',\n iconHue = 'neutral',\n } = plugin.meta;\n const styles = getStyles(iconHue);\n\n return (\n <ScrollArea.Root orientation='vertical'>\n <ScrollArea.Viewport>\n <div role='none' className='dx-document grid grid-cols-[min-content_1fr] gap-4 p-4'>\n <div role='none'>\n <Icon classNames={mx('p-1 rounded-md', styles.fill, styles.surfaceText)} icon={icon} size={14} />\n </div>\n <div role='none' className='flex flex-col gap-6'>\n <div role='none' className='grid grid-cols-[1fr_min-content] gap-x-3 w-full pt-1'>\n <h2 className='text-xl'>{name}</h2>\n <Input.Root>\n <Input.Switch classNames='self-center' checked={enabled} onCheckedChange={onEnabledChange} />\n </Input.Root>\n <p className='pt-0.5 text-sm text-description'>{id}</p>\n </div>\n <div role='none'>\n <p className='text-description'>{description}</p>\n </div>\n {screenshots && screenshots.length > 0 && (\n <div role='none' className='flex flex-col gap-2'>\n <h2>Preview</h2>\n <img src={screenshots[0]} alt={name} className='aspect-video object-fit' />\n </div>\n )}\n <div role='none' className='flex flex-col gap-2'>\n <h2>Resources</h2>\n <div className='flex gap-2'>\n {homePage && (\n <Link href={homePage} target='_blank' rel='noreferrer' classNames='text-sm text-description'>\n {t('home page label')}\n <Icon icon='ph--arrow-square-out--bold' size={3} classNames='inline-block leading-none mx-1' />\n </Link>\n )}\n\n {source && (\n <Link href={source} target='_blank' rel='noreferrer' classNames='text-sm text-description'>\n {t('source label')}\n <Icon icon='ph--arrow-square-out--bold' size={3} classNames='inline-block leading-none mx-1' />\n </Link>\n )}\n </div>\n </div>\n </div>\n </div>\n </ScrollArea.Viewport>\n </ScrollArea.Root>\n );\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport React from 'react';\n\nimport { type Plugin } from '@dxos/app-framework';\nimport { List } from '@dxos/react-ui';\n\nimport { PluginItem, type PluginItemProps } from './PluginItem';\n\nexport type PluginListProps = Omit<PluginItemProps, 'plugin'> & {\n plugins?: readonly Plugin.Plugin[];\n};\n\nexport const PluginList = ({ plugins = [], ...props }: PluginListProps) => {\n return (\n <List classNames='grid grid-cols-[repeat(auto-fill,minmax(18rem,1fr))] auto-rows-[max-content] gap-4 p-4'>\n {plugins.map((plugin) => (\n <PluginItem key={plugin.meta.id} plugin={plugin} {...props} />\n ))}\n </List>\n );\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport React, { type MouseEvent, useCallback } from 'react';\n\nimport { type Plugin } from '@dxos/app-framework';\nimport { type ChromaticPalette, Icon, IconButton, Input, Link, ListItem, Tag, useTranslation } from '@dxos/react-ui';\nimport { mx } from '@dxos/ui-theme';\nimport { getStyles } from '@dxos/ui-theme';\n\nimport { meta } from '../../meta';\nimport { type RegistryTagType } from '../../types';\n\nexport type PluginItemProps = {\n plugin: Plugin.Plugin;\n installed?: readonly string[];\n enabled?: readonly string[];\n onClick?: (id: string) => void;\n onChange?: (id: string, enabled: boolean) => void;\n hasSettings?: (id: string) => boolean;\n onSettings?: (id: string) => void;\n};\n\nexport const PluginItem = ({\n plugin,\n enabled = [],\n onClick,\n onChange,\n hasSettings: hasSettingsProp,\n onSettings,\n}: PluginItemProps) => {\n const { t } = useTranslation(meta.id);\n const { id, name, description, tags, icon = 'ph--circle--regular', iconHue = 'neutral' } = plugin.meta;\n const isEnabled = enabled.includes(id);\n const inputId = `${id}-input`;\n const labelId = `${id}-label`;\n const descriptionId = `${id}-description`;\n const handleClick = useCallback(() => onClick?.(id), [id, onClick]);\n\n const handleChange = useCallback(\n (event: MouseEvent) => {\n event.stopPropagation();\n onChange?.(id, !isEnabled);\n },\n [id, isEnabled, onChange],\n );\n\n const hasSettings = hasSettingsProp?.(id) ?? false;\n const handleSettings = useCallback(() => onSettings?.(id), [id, onSettings]);\n const styles = getStyles(iconHue);\n const gridCols = 'grid grid-cols-[5rem_1fr]';\n const gridRows = 'grid grid-rows-[40px_1fr_min-content_40px]';\n\n return (\n <ListItem.Root\n key={id}\n labelId={labelId}\n data-testid={`pluginList.${id}`}\n aria-describedby={descriptionId}\n classNames={mx(gridCols, 'h-[12rem] w-full gap-3 pe-2 bg-modal-surface rounded-md overflow-hidden')}\n >\n <div className={mx(gridRows, 'justify-center rounded-l-md', styles.surface)}>\n <Icon\n classNames={mx('row-start-2 cursor-pointer', styles.surfaceText)}\n icon={icon}\n size={14}\n onClick={handleClick}\n />\n </div>\n\n <div className={mx(gridRows)}>\n <div className='flex items-center overflow-hidden cursor-pointer' onClick={handleClick}>\n <span className='text-lg truncate'>{name ?? id}</span>\n </div>\n\n <div>\n <p className={mx('text-description', 'line-clamp-4 min-w-0')}>{description}</p>\n </div>\n\n <div className='flex -ms-0.5 overflow-x-auto scrollbar-none'>\n {tags?.map((tag) => (\n <Tag key={tag} palette={tagColors[tag as RegistryTagType]} classNames='text-xs uppercase font-thin'>\n {tag}\n </Tag>\n ))}\n </div>\n\n <div className='flex gap-2 items-center text-sm'>\n <IconButton\n aria-describedby={descriptionId}\n classNames='cursor-pointer'\n icon='ph--gear--regular'\n label={t('settings label')}\n iconOnly\n size={4}\n onClick={handleSettings}\n disabled={!hasSettings}\n />\n\n <Link aria-describedby={descriptionId} classNames='text-description cursor-pointer' onClick={handleClick}>\n {t('details label')}\n </Link>\n\n <div className='grow' />\n <div className='pe-1'>\n <Input.Root id={inputId}>\n <Input.Switch classNames='self-center' checked={isEnabled} onClick={handleChange} />\n </Input.Root>\n </div>\n </div>\n </div>\n </ListItem.Root>\n );\n};\n\nconst tagColors: Record<RegistryTagType, ChromaticPalette> = {\n new: 'rose',\n beta: 'teal',\n labs: 'blue',\n popular: 'green',\n featured: 'pink',\n experimental: 'amber',\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;AAIA,OAAOA,WAAW;AAGlB,SAASC,MAAMC,OAAOC,MAAMC,sBAAsB;AAClD,SAASC,kBAAkB;AAC3B,SAASC,WAAWC,UAAU;AAUvB,IAAMC,eAAe,CAAC,EAAEC,QAAQC,SAASC,gBAAe,MAAqB;AAClF,QAAM,EAAEC,EAAC,IAAKC,eAAeC,KAAKC,EAAE;AACpC,QAAM,EACJA,IACAC,MACAC,aACAC,UACAC,QACAC,aACAC,OAAO,uBACPC,UAAU,UAAS,IACjBb,OAAOK;AACX,QAAMS,SAASC,UAAUF,OAAAA;AAEzB,SACE,sBAAA,cAACG,WAAWC,MAAI;IAACC,aAAY;KAC3B,sBAAA,cAACF,WAAWG,UAAQ,MAClB,sBAAA,cAACC,OAAAA;IAAIC,MAAK;IAAOC,WAAU;KACzB,sBAAA,cAACF,OAAAA;IAAIC,MAAK;KACR,s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B,YAAW;IAAcsB,SAAS3C;IAAWd,SAASqB;;AAOlF;AAEA,IAAM4B,YAAuD;EAC3DS,KAAK;EACLC,MAAM;EACNC,MAAM;EACNC,SAAS;EACTC,UAAU;EACVC,cAAc;AAChB;;;AD5GO,IAAMC,aAAa,CAAC,EAAEC,UAAU,CAAA,GAAI,GAAGC,MAAAA,MAAwB;AACpE,SACE,gBAAAC,OAAA,cAACC,MAAAA;IAAKC,YAAW;KACdJ,QAAQK,IAAI,CAACC,WACZ,gBAAAJ,OAAA,cAACK,YAAAA;IAAWC,KAAKF,OAAOG,KAAKC;IAAIJ;IAAiB,GAAGL;;AAI7D;",
|
|
6
|
+
"names": ["React", "Icon", "Input", "Link", "useTranslation", "ScrollArea", "getStyles", "mx", "PluginDetail", "plugin", "enabled", "onEnabledChange", "t", "useTranslation", "meta", "id", "name", "description", "homePage", "source", "screenshots", "icon", "iconHue", "styles", "getStyles", "ScrollArea", "Root", "orientation", "Viewport", "div", "role", "className", "Icon", "classNames", "mx", "fill", "surfaceText", "size", "h2", "Input", "Switch", "checked", "onCheckedChange", "p", "length", "img", "src", "alt", "Link", "href", "target", "rel", "React", "List", "React", "useCallback", "Icon", "IconButton", "Input", "Link", "ListItem", "Tag", "useTranslation", "mx", "getStyles", "PluginItem", "plugin", "enabled", "onClick", "onChange", "hasSettings", "hasSettingsProp", "onSettings", "t", "useTranslation", "meta", "id", "name", "description", "tags", "icon", "iconHue", "isEnabled", "includes", "inputId", "labelId", "descriptionId", "handleClick", "useCallback", "handleChange", "event", "stopPropagation", "handleSettings", "styles", "getStyles", "gridCols", "gridRows", "React", "ListItem", "Root", "key", "data-testid", "aria-describedby", "classNames", "mx", "div", "className", "surface", "Icon", "surfaceText", "size", "span", "p", "map", "tag", "Tag", "palette", "tagColors", "IconButton", "label", "iconOnly", "disabled", "Link", "Input", "Switch", "checked", "new", "beta", "labs", "popular", "featured", "experimental", "PluginList", "plugins", "props", "React", "List", "classNames", "map", "plugin", "PluginItem", "key", "meta", "id"]
|
|
7
|
+
}
|
|
@@ -4,8 +4,9 @@ import { createRequire } from 'node:module';const require = createRequire(import
|
|
|
4
4
|
import { trim } from "@dxos/util";
|
|
5
5
|
var REGISTRY_ID = "!dxos:plugin-registry";
|
|
6
6
|
var REGISTRY_KEY = "plugin-registry";
|
|
7
|
+
var getPluginPath = (pluginId) => `root/${REGISTRY_ID}/${pluginId}`;
|
|
7
8
|
var meta = {
|
|
8
|
-
id: "dxos.
|
|
9
|
+
id: "org.dxos.plugin.registry",
|
|
9
10
|
name: "Plugins",
|
|
10
11
|
description: trim`
|
|
11
12
|
Plugin management system for discovering, installing, and configuring workspace extensions.
|
|
@@ -16,6 +17,7 @@ var meta = {
|
|
|
16
17
|
export {
|
|
17
18
|
REGISTRY_ID,
|
|
18
19
|
REGISTRY_KEY,
|
|
20
|
+
getPluginPath,
|
|
19
21
|
meta
|
|
20
22
|
};
|
|
21
|
-
//# sourceMappingURL=chunk-
|
|
23
|
+
//# sourceMappingURL=chunk-ENSNUFQK.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/meta.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 REGISTRY_ID = '!dxos:plugin-registry';\nexport const REGISTRY_KEY = 'plugin-registry';\n\n/** Qualified graph path to a specific plugin node. */\nexport const getPluginPath = (pluginId: string): string => `root/${REGISTRY_ID}/${pluginId}`;\n\nexport const meta: Plugin.Meta = {\n id: 'org.dxos.plugin.registry',\n name: 'Plugins',\n description: trim`\n Plugin management system for discovering, installing, and configuring workspace extensions.\n Browse available plugins and customize your workspace capabilities.\n `,\n};\n"],
|
|
5
|
+
"mappings": ";;;AAKA,SAASA,YAAY;AAEd,IAAMC,cAAc;AACpB,IAAMC,eAAe;AAGrB,IAAMC,gBAAgB,CAACC,aAA6B,QAAQH,WAAAA,IAAeG,QAAAA;AAE3E,IAAMC,OAAoB;EAC/BC,IAAI;EACJC,MAAM;EACNC,aAAaC;;;;AAIf;",
|
|
6
|
+
"names": ["trim", "REGISTRY_ID", "REGISTRY_KEY", "getPluginPath", "pluginId", "meta", "id", "name", "description", "trim"]
|
|
7
|
+
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
meta
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-ENSNUFQK.mjs";
|
|
5
5
|
|
|
6
6
|
// src/cli/plugin.ts
|
|
7
|
-
import {
|
|
7
|
+
import { Plugin as Plugin4 } from "@dxos/app-framework";
|
|
8
|
+
import { AppPlugin } from "@dxos/app-toolkit";
|
|
8
9
|
|
|
9
10
|
// src/cli/commands/index.ts
|
|
10
11
|
import * as Command4 from "@effect/cli/Command";
|
|
@@ -23,29 +24,27 @@ import * as FileSystem from "@effect/platform/FileSystem";
|
|
|
23
24
|
import * as Path from "@effect/platform/Path";
|
|
24
25
|
import * as Effect from "effect/Effect";
|
|
25
26
|
import * as Schema from "effect/Schema";
|
|
26
|
-
import
|
|
27
|
-
|
|
27
|
+
import * as Yaml from "yaml";
|
|
28
|
+
import { DX_CONFIG } from "@dxos/client-protocol";
|
|
28
29
|
var PluginsSchema = Schema.Array(Schema.String);
|
|
29
|
-
var
|
|
30
|
-
const path = yield* Path.Path;
|
|
31
|
-
return path.join(getProfilePath(DX_CONFIG, profile), PLUGINS_FILE);
|
|
32
|
-
});
|
|
30
|
+
var getPluginsConfigPath = (profile) => `${DX_CONFIG}/plugins/${profile}.yml`;
|
|
33
31
|
var loadEnabledPlugins = Effect.fn(function* ({ profile }) {
|
|
34
32
|
const fs = yield* FileSystem.FileSystem;
|
|
35
|
-
const pluginsPath =
|
|
33
|
+
const pluginsPath = getPluginsConfigPath(profile);
|
|
36
34
|
const content = yield* fs.readFileString(pluginsPath).pipe(Effect.catchTag("SystemError", () => Effect.succeed("[]")));
|
|
37
|
-
const
|
|
35
|
+
const raw = Yaml.parse(content);
|
|
36
|
+
const parsed = yield* Schema.decodeUnknown(PluginsSchema)(raw ?? []).pipe(Effect.catchAll(() => Effect.succeed([])));
|
|
38
37
|
return parsed;
|
|
39
38
|
});
|
|
40
39
|
var saveEnabledPlugins = Effect.fn(function* ({ profile, enabled }) {
|
|
41
40
|
const fs = yield* FileSystem.FileSystem;
|
|
42
|
-
const
|
|
43
|
-
const
|
|
44
|
-
yield* fs.makeDirectory(
|
|
41
|
+
const path = yield* Path.Path;
|
|
42
|
+
const pluginsPath = getPluginsConfigPath(profile);
|
|
43
|
+
yield* fs.makeDirectory(path.dirname(pluginsPath), {
|
|
45
44
|
recursive: true
|
|
46
45
|
});
|
|
47
|
-
const encoded =
|
|
48
|
-
yield* fs.writeFileString(pluginsPath, encoded
|
|
46
|
+
const encoded = Yaml.stringify(enabled);
|
|
47
|
+
yield* fs.writeFileString(pluginsPath, encoded);
|
|
49
48
|
});
|
|
50
49
|
|
|
51
50
|
// src/cli/commands/disable.ts
|
|
@@ -211,7 +210,7 @@ var plugin = Command4.make("plugin").pipe(Command4.withDescription("Manage plugi
|
|
|
211
210
|
]));
|
|
212
211
|
|
|
213
212
|
// src/cli/plugin.ts
|
|
214
|
-
var RegistryPlugin = Plugin4.define(meta).pipe(
|
|
213
|
+
var RegistryPlugin = Plugin4.define(meta).pipe(AppPlugin.addCommandModule({
|
|
215
214
|
commands: [
|
|
216
215
|
plugin
|
|
217
216
|
]
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/cli/plugin.ts", "../../../../src/cli/commands/index.ts", "../../../../src/cli/commands/disable.ts", "../../../../src/cli/storage.ts", "../../../../src/cli/commands/enable.ts", "../../../../src/cli/commands/list.ts", "../../../../src/cli/commands/util.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport {
|
|
5
|
-
"mappings": ";;;;;;AAIA,SAASA,
|
|
6
|
-
"names": ["
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { Plugin } from '@dxos/app-framework';\nimport { AppPlugin } from '@dxos/app-toolkit';\n\nimport { meta } from '../meta';\n\nimport { plugin } from './commands';\n\nexport const RegistryPlugin = Plugin.define(meta).pipe(\n AppPlugin.addCommandModule({\n commands: [plugin],\n }),\n Plugin.make,\n);\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Command from '@effect/cli/Command';\n\nimport { disable } from './disable';\nimport { enable } from './enable';\nimport { list } from './list';\n\nexport const plugin: Command.Command<any, any, any, any> = Command.make('plugin').pipe(\n Command.withDescription('Manage plugins.'),\n Command.withSubcommands([enable, disable, list]),\n);\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Args from '@effect/cli/Args';\nimport * as Command from '@effect/cli/Command';\nimport * as Console from 'effect/Console';\nimport * as Effect from 'effect/Effect';\n\nimport { Plugin } from '@dxos/app-framework';\nimport { CommandConfig } from '@dxos/cli-util';\nimport { invariant } from '@dxos/invariant';\n\nimport { saveEnabledPlugins } from '../storage';\n\nexport const handler = Effect.fn(function* ({ id }: { id: string }) {\n const { json, profile } = yield* CommandConfig;\n const manager = yield* Plugin.Service;\n\n const plugins = manager.getPlugins();\n const plugin = plugins.find((p: Plugin.Plugin) => p.meta.id === id);\n invariant(plugin, `Plugin not found: ${id}`);\n\n const core = manager.getCore();\n invariant(!core.includes(id), `Cannot disable core plugin: ${id}`);\n\n const disabled = yield* manager.disable(id);\n invariant(disabled, `Failed to disable plugin: ${id}`);\n\n // Save enabled plugins to storage\n const enabledPlugins = manager.getEnabled();\n yield* saveEnabledPlugins({ profile, enabled: [...enabledPlugins] });\n\n if (json) {\n yield* Console.log(JSON.stringify({ id, enabled: false }, null, 2));\n } else {\n yield* Console.log(`Plugin \"${plugin.meta.name ?? id}\" disabled.`);\n }\n});\n\nexport const disable = Command.make(\n 'disable',\n {\n id: Args.text({ name: 'id' }).pipe(Args.withDescription('The ID of the plugin to disable.')),\n },\n handler,\n).pipe(Command.withDescription('Disable a plugin.'));\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport * as FileSystem from '@effect/platform/FileSystem';\nimport * as Path from '@effect/platform/Path';\nimport * as Effect from 'effect/Effect';\nimport * as Schema from 'effect/Schema';\nimport * as Yaml from 'yaml';\n\nimport { DX_CONFIG } from '@dxos/client-protocol';\n\n// TODO(wittjosiah): Factor out to app-framework?\n\nconst PluginsSchema = Schema.Array(Schema.String);\n\n/** CLI-only: path to plugins/<profile>.yml (sibling to profile/). */\nconst getPluginsConfigPath = (profile: string) => `${DX_CONFIG}/plugins/${profile}.yml`;\n\n/**\n * Load enabled plugins from plugins/<profile>.yml (sibling to profile/).\n * Returns the list of enabled plugin IDs, or an empty array if the file doesn't exist.\n */\nexport const loadEnabledPlugins = Effect.fn(function* ({ profile }: { profile: string }) {\n const fs = yield* FileSystem.FileSystem;\n const pluginsPath = getPluginsConfigPath(profile);\n\n const content = yield* fs\n .readFileString(pluginsPath)\n .pipe(Effect.catchTag('SystemError', () => Effect.succeed('[]')));\n\n const raw = Yaml.parse(content);\n const parsed = yield* Schema.decodeUnknown(PluginsSchema)(raw ?? []).pipe(\n Effect.catchAll(() => Effect.succeed([] as string[])),\n );\n\n return parsed;\n});\n\n/**\n * Save enabled plugins to plugins/<profile>.yml.\n */\nexport const saveEnabledPlugins = Effect.fn(function* ({ profile, enabled }: { profile: string; enabled: string[] }) {\n const fs = yield* FileSystem.FileSystem;\n const path = yield* Path.Path;\n const pluginsPath = getPluginsConfigPath(profile);\n yield* fs.makeDirectory(path.dirname(pluginsPath), { recursive: true });\n const encoded = Yaml.stringify(enabled);\n yield* fs.writeFileString(pluginsPath, encoded);\n});\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Args from '@effect/cli/Args';\nimport * as Command from '@effect/cli/Command';\nimport * as Console from 'effect/Console';\nimport * as Effect from 'effect/Effect';\n\nimport { Plugin } from '@dxos/app-framework';\nimport { CommandConfig } from '@dxos/cli-util';\nimport { invariant } from '@dxos/invariant';\n\nimport { saveEnabledPlugins } from '../storage';\n\nexport const handler = Effect.fn(function* ({ id }: { id: string }) {\n const { json, profile } = yield* CommandConfig;\n const manager = yield* Plugin.Service;\n\n const plugins = manager.getPlugins();\n const plugin = plugins.find((p: Plugin.Plugin) => p.meta.id === id);\n invariant(plugin, `Plugin not found: ${id}`);\n\n const enabled = yield* manager.enable(id);\n invariant(enabled, `Failed to enable plugin: ${id}`);\n\n // Save enabled plugins to storage\n const enabledPlugins = manager.getEnabled();\n yield* saveEnabledPlugins({ profile, enabled: [...enabledPlugins] });\n\n if (json) {\n yield* Console.log(JSON.stringify({ id, enabled: true }, null, 2));\n } else {\n yield* Console.log(`Plugin \"${plugin.meta.name ?? id}\" enabled.`);\n }\n});\n\nexport const enable = Command.make(\n 'enable',\n {\n id: Args.text({ name: 'id' }).pipe(Args.withDescription('The ID of the plugin to enable.')),\n },\n handler,\n).pipe(Command.withDescription('Enable a plugin.'));\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Command from '@effect/cli/Command';\nimport * as Console from 'effect/Console';\nimport * as Effect from 'effect/Effect';\n\nimport { Plugin } from '@dxos/app-framework';\nimport { CommandConfig, printList } from '@dxos/cli-util';\n\nimport { type FormattedPlugin, printPlugin } from './util';\n\nexport const handler = Effect.fn(function* () {\n const { json } = yield* CommandConfig;\n const manager = yield* Plugin.Service;\n\n const plugins = manager.getPlugins();\n const enabled = manager.getEnabled();\n const core = manager.getCore();\n\n const formattedPlugins: FormattedPlugin[] = plugins.map((plugin: Plugin.Plugin) => {\n const isEnabled = enabled.includes(plugin.meta.id);\n const isCore = core.includes(plugin.meta.id);\n return {\n id: plugin.meta.id,\n name: plugin.meta.name ?? plugin.meta.id,\n enabled: isEnabled,\n core: isCore,\n };\n });\n\n if (json) {\n yield* Console.log(JSON.stringify(formattedPlugins, null, 2));\n } else {\n const formatted = formattedPlugins.map(printPlugin);\n yield* Console.log(printList(formatted));\n }\n});\n\nexport const list = Command.make('list', {}, handler).pipe(Command.withDescription('List all available plugins.'));\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { FormBuilder } from '@dxos/cli-util';\n\nexport type FormattedPlugin = {\n id: string;\n name: string;\n enabled: boolean;\n core: boolean;\n};\n\n/**\n * Pretty prints a plugin with ANSI colors.\n */\nexport const printPlugin = (plugin: FormattedPlugin) => {\n const status = plugin.core ? 'core' : plugin.enabled ? 'enabled' : 'disabled';\n return FormBuilder.make({ title: plugin.name }).pipe(\n FormBuilder.set('id', plugin.id),\n FormBuilder.set('status', status),\n FormBuilder.build,\n );\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;AAIA,SAASA,UAAAA,eAAc;AACvB,SAASC,iBAAiB;;;ACD1B,YAAYC,cAAa;;;ACAzB,YAAYC,UAAU;AACtB,YAAYC,aAAa;AACzB,YAAYC,aAAa;AACzB,YAAYC,aAAY;AAExB,SAASC,cAAc;AACvB,SAASC,qBAAqB;AAC9B,SAASC,iBAAiB;;;ACP1B,YAAYC,gBAAgB;AAC5B,YAAYC,UAAU;AACtB,YAAYC,YAAY;AACxB,YAAYC,YAAY;AACxB,YAAYC,UAAU;AAEtB,SAASC,iBAAiB;AAI1B,IAAMC,gBAAuBC,aAAaC,aAAM;AAGhD,IAAMC,uBAAuB,CAACC,YAAoB,GAAGC,SAAAA,YAAqBD,OAAAA;AAMnE,IAAME,qBAA4BC,UAAG,WAAW,EAAEH,QAAO,GAAuB;AACrF,QAAMI,KAAK,OAAkBC;AAC7B,QAAMC,cAAcP,qBAAqBC,OAAAA;AAEzC,QAAMO,UAAU,OAAOH,GACpBI,eAAeF,WAAAA,EACfG,KAAYC,gBAAS,eAAe,MAAaC,eAAQ,IAAA,CAAA,CAAA;AAE5D,QAAMC,MAAWC,WAAMN,OAAAA;AACvB,QAAMO,SAAS,O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G7B,QAAAA,EAAS8B,KAAaC,yBAAgB,6BAAA,CAAA;;;AJ9B5E,IAAMC,SAAsDC,cAAK,QAAA,EAAUC,KACxEC,yBAAgB,iBAAA,GAChBC,yBAAgB;EAACC;EAAQC;EAASC;CAAK,CAAA;;;ADD1C,IAAMC,iBAAiBC,QAAOC,OAAOC,IAAAA,EAAMC,KAChDC,UAAUC,iBAAiB;EACzBC,UAAU;IAACC;;AACb,CAAA,GACAP,QAAOQ,IAAI;",
|
|
6
|
+
"names": ["Plugin", "AppPlugin", "Command", "Args", "Command", "Console", "Effect", "Plugin", "CommandConfig", "invariant", "FileSystem", "Path", "Effect", "Schema", "Yaml", "DX_CONFIG", "PluginsSchema", "Array", "String", "getPluginsConfigPath", "profile", "DX_CONFIG", "loadEnabledPlugins", "fn", "fs", "FileSystem", "pluginsPath", "content", "readFileString", "pipe", "catchTag", "succeed", "raw", "parse", "parsed", "decodeUnknown", "catchAll", "saveEnabledPlugins", "enabled", "path", "Path", "makeDirectory", "dirname", "recursive", "encoded", "stringify", "writeFileString", "handler", "fn", "id", "json", "profile", "CommandConfig", "manager", "Plugin", "Service", "plugins", "getPlugins", "plugin", "find", "p", "meta", "invariant", "core", "getCore", "includes", "disabled", "disable", "enabledPlugins", "getEnabled", "saveEnabledPlugins", "enabled", "log", "JSON", "stringify", "name", "make", "text", "pipe", "withDescription", "Args", "Command", "Console", "Effect", "Plugin", "CommandConfig", "invariant", "handler", "fn", "id", "json", "profile", "CommandConfig", "manager", "Plugin", "Service", "plugins", "getPlugins", "plugin", "find", "p", "meta", "invariant", "enabled", "enable", "enabledPlugins", "getEnabled", "saveEnabledPlugins", "log", "JSON", "stringify", "name", "make", "text", "pipe", "withDescription", "Command", "Console", "Effect", "Plugin", "CommandConfig", "printList", "FormBuilder", "printPlugin", "plugin", "status", "core", "enabled", "FormBuilder", "make", "title", "name", "pipe", "set", "id", "build", "handler", "fn", "json", "CommandConfig", "manager", "Plugin", "Service", "plugins", "getPlugins", "enabled", "getEnabled", "core", "getCore", "formattedPlugins", "map", "plugin", "isEnabled", "includes", "meta", "id", "isCore", "name", "log", "JSON", "stringify", "formatted", "printPlugin", "printList", "list", "make", "pipe", "withDescription", "plugin", "make", "pipe", "withDescription", "withSubcommands", "enable", "disable", "list", "RegistryPlugin", "Plugin", "define", "meta", "pipe", "AppPlugin", "addCommandModule", "commands", "plugin", "make"]
|
|
7
7
|
}
|
|
@@ -2,23 +2,25 @@ import { createRequire } from 'node:module';const require = createRequire(import
|
|
|
2
2
|
import {
|
|
3
3
|
REGISTRY_ID,
|
|
4
4
|
REGISTRY_KEY,
|
|
5
|
+
getPluginPath,
|
|
5
6
|
meta
|
|
6
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-ENSNUFQK.mjs";
|
|
7
8
|
|
|
8
9
|
// src/RegistryPlugin.tsx
|
|
9
|
-
import {
|
|
10
|
+
import { Plugin } from "@dxos/app-framework";
|
|
11
|
+
import { AppPlugin } from "@dxos/app-toolkit";
|
|
10
12
|
|
|
11
13
|
// src/capabilities/app-graph-builder/index.ts
|
|
12
14
|
import { Capability } from "@dxos/app-framework";
|
|
13
|
-
var AppGraphBuilder = Capability.lazy("AppGraphBuilder", () => import("./app-graph-builder-
|
|
15
|
+
var AppGraphBuilder = Capability.lazy("AppGraphBuilder", () => import("./app-graph-builder-DBDL5WWF.mjs"));
|
|
14
16
|
|
|
15
17
|
// src/capabilities/operation-resolver/index.ts
|
|
16
18
|
import { Capability as Capability2 } from "@dxos/app-framework";
|
|
17
|
-
var OperationResolver = Capability2.lazy("OperationResolver", () => import("./operation-resolver-
|
|
19
|
+
var OperationResolver = Capability2.lazy("OperationResolver", () => import("./operation-resolver-CCHN4NBP.mjs"));
|
|
18
20
|
|
|
19
21
|
// src/capabilities/react-surface/index.ts
|
|
20
22
|
import { Capability as Capability3 } from "@dxos/app-framework";
|
|
21
|
-
var ReactSurface = Capability3.lazy("ReactSurface", () => import("./react-surface-
|
|
23
|
+
var ReactSurface = Capability3.lazy("ReactSurface", () => import("./react-surface-FJHMLGZF.mjs"));
|
|
22
24
|
|
|
23
25
|
// src/translations.ts
|
|
24
26
|
var translations = [
|
|
@@ -45,19 +47,20 @@ var translations = [
|
|
|
45
47
|
];
|
|
46
48
|
|
|
47
49
|
// src/RegistryPlugin.tsx
|
|
48
|
-
var RegistryPlugin = Plugin.define(meta).pipe(
|
|
49
|
-
translations
|
|
50
|
-
}), Common.Plugin.addSurfaceModule({
|
|
51
|
-
activate: ReactSurface
|
|
52
|
-
}), Common.Plugin.addOperationResolverModule({
|
|
53
|
-
activate: OperationResolver
|
|
54
|
-
}), Common.Plugin.addAppGraphModule({
|
|
50
|
+
var RegistryPlugin = Plugin.define(meta).pipe(AppPlugin.addAppGraphModule({
|
|
55
51
|
activate: AppGraphBuilder
|
|
52
|
+
}), AppPlugin.addOperationResolverModule({
|
|
53
|
+
activate: OperationResolver
|
|
54
|
+
}), AppPlugin.addSurfaceModule({
|
|
55
|
+
activate: ReactSurface
|
|
56
|
+
}), AppPlugin.addTranslationsModule({
|
|
57
|
+
translations
|
|
56
58
|
}), Plugin.make);
|
|
57
59
|
export {
|
|
58
60
|
REGISTRY_ID,
|
|
59
61
|
REGISTRY_KEY,
|
|
60
62
|
RegistryPlugin,
|
|
63
|
+
getPluginPath,
|
|
61
64
|
meta
|
|
62
65
|
};
|
|
63
66
|
//# sourceMappingURL=index.mjs.map
|