@dxos/plugin-registry 0.7.5-main.9d26e3a → 0.7.5-main.9d2a38b
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/{chunk-NEMFDAOB.mjs → chunk-CMDU7LPH.mjs} +3 -3
- package/dist/lib/browser/chunk-CMDU7LPH.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +26 -186
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/react-surface-HKWZP7OW.mjs +179 -0
- package/dist/lib/browser/react-surface-HKWZP7OW.mjs.map +7 -0
- package/dist/lib/browser/settings-7LOHS2IV.mjs +27 -0
- package/dist/lib/browser/settings-7LOHS2IV.mjs.map +7 -0
- package/dist/types/src/RegistryPlugin.d.ts +1 -6
- package/dist/types/src/RegistryPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +3 -0
- package/dist/types/src/capabilities/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface.d.ts +4 -0
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -0
- package/dist/types/src/capabilities/settings.d.ts +4 -0
- package/dist/types/src/capabilities/settings.d.ts.map +1 -0
- package/dist/types/src/components/PluginList.d.ts +4 -4
- package/dist/types/src/components/PluginList.d.ts.map +1 -1
- package/dist/types/src/components/PluginSettings.d.ts +2 -2
- package/dist/types/src/components/PluginSettings.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +1 -2
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +1 -2
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/types.d.ts +6 -0
- package/dist/types/src/types.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +16 -23
- package/src/RegistryPlugin.tsx +21 -41
- package/src/capabilities/index.ts +8 -0
- package/src/capabilities/react-surface.tsx +24 -0
- package/src/capabilities/settings.ts +19 -0
- package/src/components/PluginList.tsx +6 -6
- package/src/components/PluginSettings.tsx +20 -16
- package/src/index.ts +1 -4
- package/src/meta.ts +1 -1
- package/src/types.ts +13 -0
- package/dist/lib/browser/chunk-NEMFDAOB.mjs.map +0 -7
- package/dist/lib/browser/meta.mjs +0 -9
- package/dist/lib/browser/meta.mjs.map +0 -7
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
// packages/plugins/plugin-registry/src/meta.ts
|
|
2
2
|
var REGISTRY_PLUGIN = "dxos.org/plugin/registry";
|
|
3
|
-
var
|
|
3
|
+
var meta = {
|
|
4
4
|
id: REGISTRY_PLUGIN,
|
|
5
5
|
name: "Plugins"
|
|
6
6
|
};
|
|
7
7
|
|
|
8
8
|
export {
|
|
9
9
|
REGISTRY_PLUGIN,
|
|
10
|
-
|
|
10
|
+
meta
|
|
11
11
|
};
|
|
12
|
-
//# sourceMappingURL=chunk-
|
|
12
|
+
//# sourceMappingURL=chunk-CMDU7LPH.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 PluginMeta } from '@dxos/app-framework';\n\nexport const REGISTRY_PLUGIN = 'dxos.org/plugin/registry';\n\nexport const meta = {\n id: REGISTRY_PLUGIN,\n name: 'Plugins',\n} satisfies PluginMeta;\n"],
|
|
5
|
+
"mappings": ";AAMO,IAAMA,kBAAkB;AAExB,IAAMC,OAAO;EAClBC,IAAIF;EACJG,MAAM;AACR;",
|
|
6
|
+
"names": ["REGISTRY_PLUGIN", "meta", "id", "name"]
|
|
7
|
+
}
|
|
@@ -1,162 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
REGISTRY_PLUGIN,
|
|
3
|
-
|
|
4
|
-
} from "./chunk-
|
|
3
|
+
meta
|
|
4
|
+
} from "./chunk-CMDU7LPH.mjs";
|
|
5
5
|
|
|
6
6
|
// packages/plugins/plugin-registry/src/RegistryPlugin.tsx
|
|
7
|
-
import
|
|
8
|
-
import { createSurface } from "@dxos/app-framework";
|
|
9
|
-
import { LocalStorageStore } from "@dxos/local-storage";
|
|
7
|
+
import { Capabilities, contributes, defineModule, definePlugin, Events } from "@dxos/app-framework";
|
|
10
8
|
|
|
11
|
-
// packages/plugins/plugin-registry/src/
|
|
12
|
-
import
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
var PluginList = ({ plugins = [], loaded = [], enabled = [], onChange, onReload }) => {
|
|
16
|
-
const { t } = useTranslation(REGISTRY_PLUGIN);
|
|
17
|
-
return /* @__PURE__ */ React.createElement(List, {
|
|
18
|
-
classNames: "mb-4 select-none"
|
|
19
|
-
}, plugins.map(({ id, name, description, homePage, source, icon = "ph--circle--regular" }) => {
|
|
20
|
-
const isEnabled = enabled.includes(id);
|
|
21
|
-
const isLoaded = loaded.includes(id);
|
|
22
|
-
const reloadRequired = isEnabled !== isLoaded;
|
|
23
|
-
const inputId = `${id}-input`;
|
|
24
|
-
const labelId = `${id}-label`;
|
|
25
|
-
const descriptionId = `${id}-description`;
|
|
26
|
-
const handleChange = useCallback(() => onChange?.(id, !isEnabled), [
|
|
27
|
-
id,
|
|
28
|
-
isEnabled,
|
|
29
|
-
onChange
|
|
30
|
-
]);
|
|
31
|
-
return /* @__PURE__ */ React.createElement(Input.Root, {
|
|
32
|
-
key: id,
|
|
33
|
-
id: inputId
|
|
34
|
-
}, /* @__PURE__ */ React.createElement(ListItem.Root, {
|
|
35
|
-
labelId,
|
|
36
|
-
"data-testid": `pluginList.${id}`,
|
|
37
|
-
"aria-describedby": descriptionId,
|
|
38
|
-
classNames: "flex gap-2 plb-2 pli-2 -mli-2 rounded"
|
|
39
|
-
}, /* @__PURE__ */ React.createElement(Icon, {
|
|
40
|
-
icon,
|
|
41
|
-
size: 6,
|
|
42
|
-
classNames: "shrink-0 mbs-1"
|
|
43
|
-
}), /* @__PURE__ */ React.createElement("div", {
|
|
44
|
-
role: "none",
|
|
45
|
-
className: mx(fineBlockSize, "grow pbs-1 pl-1")
|
|
46
|
-
}, /* @__PURE__ */ React.createElement("label", {
|
|
47
|
-
htmlFor: inputId,
|
|
48
|
-
id: labelId,
|
|
49
|
-
className: "truncate"
|
|
50
|
-
}, name ?? id), (description || reloadRequired || homePage || source) && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", {
|
|
51
|
-
id: descriptionId,
|
|
52
|
-
className: "space-b-1 pbs-1 pbe-1"
|
|
53
|
-
}, /* @__PURE__ */ React.createElement("p", {
|
|
54
|
-
className: descriptionText
|
|
55
|
-
}, description), homePage && /* @__PURE__ */ React.createElement(Link, {
|
|
56
|
-
href: homePage,
|
|
57
|
-
target: "_blank",
|
|
58
|
-
rel: "noreferrer",
|
|
59
|
-
"aria-describedby": descriptionId,
|
|
60
|
-
classNames: "text-xs 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 mli-1"
|
|
65
|
-
})), source && /* @__PURE__ */ React.createElement(Link, {
|
|
66
|
-
href: source,
|
|
67
|
-
target: "_blank",
|
|
68
|
-
rel: "noreferrer",
|
|
69
|
-
"aria-describedby": descriptionId,
|
|
70
|
-
classNames: "text-xs text-description"
|
|
71
|
-
}, t("source label"), /* @__PURE__ */ React.createElement(Icon, {
|
|
72
|
-
icon: "ph--arrow-square-out--bold",
|
|
73
|
-
size: 3,
|
|
74
|
-
classNames: "inline-block leading-none mli-1"
|
|
75
|
-
}))), reloadRequired && /* @__PURE__ */ React.createElement(Button, {
|
|
76
|
-
variant: "ghost",
|
|
77
|
-
classNames: "p-0 gap-2",
|
|
78
|
-
onClick: onReload
|
|
79
|
-
}, /* @__PURE__ */ React.createElement(Icon, {
|
|
80
|
-
size: 4,
|
|
81
|
-
icon: "ph--arrow-clockwise--regular"
|
|
82
|
-
}), /* @__PURE__ */ React.createElement("p", {
|
|
83
|
-
className: "text-sm font-medium"
|
|
84
|
-
}, t("reload required message"))))), /* @__PURE__ */ React.createElement("div", {
|
|
85
|
-
className: "pbs-1"
|
|
86
|
-
}, /* @__PURE__ */ React.createElement(Input.Switch, {
|
|
87
|
-
classNames: "self-center",
|
|
88
|
-
checked: isEnabled,
|
|
89
|
-
onClick: handleChange
|
|
90
|
-
}))));
|
|
91
|
-
}));
|
|
92
|
-
};
|
|
93
|
-
|
|
94
|
-
// packages/plugins/plugin-registry/src/components/PluginSettings.tsx
|
|
95
|
-
import React2, { useMemo } from "react";
|
|
96
|
-
import { createIntent, useIntentDispatcher, usePlugins } from "@dxos/app-framework";
|
|
97
|
-
import { ObservabilityAction } from "@dxos/plugin-observability/types";
|
|
98
|
-
import { Input as Input2, useTranslation as useTranslation2 } from "@dxos/react-ui";
|
|
99
|
-
import { DeprecatedFormInput } from "@dxos/react-ui-form";
|
|
100
|
-
var sortPluginMeta = ({ name: a = "" }, { name: b = "" }) => a.localeCompare(b);
|
|
101
|
-
var PluginSettings = ({ settings }) => {
|
|
102
|
-
const { t } = useTranslation2(REGISTRY_PLUGIN);
|
|
103
|
-
const { plugins, enabled, core, setPlugin, ...pluginContext } = usePlugins();
|
|
104
|
-
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
105
|
-
const installed = useMemo(() => plugins.filter(({ meta }) => !core.includes(meta.id)).filter(({ meta }) => enabled.includes(meta.id)).map(({ meta }) => meta).sort(sortPluginMeta), []);
|
|
106
|
-
const pluginIds = plugins.map(({ meta }) => meta.id);
|
|
107
|
-
const available = useMemo(() => pluginContext.available.filter(({ id }) => !enabled.includes(id)).sort(sortPluginMeta), []);
|
|
108
|
-
const recommended = available.filter((meta) => !meta.tags?.includes("experimental"));
|
|
109
|
-
const experimental = available.filter((meta) => meta.tags?.includes("experimental"));
|
|
110
|
-
const handleChange = (id, enabled2) => {
|
|
111
|
-
setPlugin(id, enabled2);
|
|
112
|
-
void dispatch(createIntent(ObservabilityAction.SendEvent, {
|
|
113
|
-
name: "plugins.toggle",
|
|
114
|
-
properties: {
|
|
115
|
-
plugin: id,
|
|
116
|
-
enabled: enabled2
|
|
117
|
-
}
|
|
118
|
-
}));
|
|
119
|
-
};
|
|
120
|
-
const handleReload = () => {
|
|
121
|
-
window.location.reload();
|
|
122
|
-
};
|
|
123
|
-
return /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(DeprecatedFormInput, {
|
|
124
|
-
label: t("settings show experimental label")
|
|
125
|
-
}, /* @__PURE__ */ React2.createElement(Input2.Switch, {
|
|
126
|
-
"data-testid": "pluginSettings.experimental",
|
|
127
|
-
checked: settings.experimental,
|
|
128
|
-
onCheckedChange: (checked) => settings.experimental = !!checked
|
|
129
|
-
})), /* @__PURE__ */ React2.createElement(Section, {
|
|
130
|
-
label: t("settings section installed label")
|
|
131
|
-
}, /* @__PURE__ */ React2.createElement(PluginList, {
|
|
132
|
-
plugins: installed,
|
|
133
|
-
loaded: pluginIds,
|
|
134
|
-
enabled,
|
|
135
|
-
onChange: handleChange,
|
|
136
|
-
onReload: handleReload
|
|
137
|
-
})), /* @__PURE__ */ React2.createElement(Section, {
|
|
138
|
-
label: t("settings section recommended label")
|
|
139
|
-
}, /* @__PURE__ */ React2.createElement(PluginList, {
|
|
140
|
-
plugins: recommended,
|
|
141
|
-
loaded: pluginIds,
|
|
142
|
-
enabled,
|
|
143
|
-
onChange: handleChange,
|
|
144
|
-
onReload: handleReload
|
|
145
|
-
})), settings.experimental && /* @__PURE__ */ React2.createElement(Section, {
|
|
146
|
-
label: t("settings section experimental label")
|
|
147
|
-
}, /* @__PURE__ */ React2.createElement(PluginList, {
|
|
148
|
-
plugins: experimental,
|
|
149
|
-
loaded: pluginIds,
|
|
150
|
-
enabled,
|
|
151
|
-
onChange: handleChange,
|
|
152
|
-
onReload: handleReload
|
|
153
|
-
})));
|
|
154
|
-
};
|
|
155
|
-
var Section = ({ label, children }) => {
|
|
156
|
-
return /* @__PURE__ */ React2.createElement("div", null, /* @__PURE__ */ React2.createElement("h2", {
|
|
157
|
-
className: "py-2 text-sm text-subdued"
|
|
158
|
-
}, label), children);
|
|
159
|
-
};
|
|
9
|
+
// packages/plugins/plugin-registry/src/capabilities/index.ts
|
|
10
|
+
import { lazy } from "@dxos/app-framework";
|
|
11
|
+
var ReactSurface = lazy(() => import("./react-surface-HKWZP7OW.mjs"));
|
|
12
|
+
var RegistrySettings = lazy(() => import("./settings-7LOHS2IV.mjs"));
|
|
160
13
|
|
|
161
14
|
// packages/plugins/plugin-registry/src/translations.ts
|
|
162
15
|
var translations_default = [
|
|
@@ -177,39 +30,26 @@ var translations_default = [
|
|
|
177
30
|
];
|
|
178
31
|
|
|
179
32
|
// packages/plugins/plugin-registry/src/RegistryPlugin.tsx
|
|
180
|
-
var RegistryPlugin = () =>
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
id: meta_default.id,
|
|
198
|
-
role: "settings",
|
|
199
|
-
filter: (data) => data.subject === REGISTRY_PLUGIN,
|
|
200
|
-
component: () => /* @__PURE__ */ React3.createElement(PluginSettings, {
|
|
201
|
-
settings: settings.values
|
|
202
|
-
})
|
|
203
|
-
})
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
};
|
|
207
|
-
};
|
|
208
|
-
|
|
209
|
-
// packages/plugins/plugin-registry/src/index.ts
|
|
210
|
-
var src_default = RegistryPlugin;
|
|
33
|
+
var RegistryPlugin = () => definePlugin(meta, [
|
|
34
|
+
defineModule({
|
|
35
|
+
id: `${meta.id}/module/settings`,
|
|
36
|
+
activatesOn: Events.SetupSettings,
|
|
37
|
+
activate: RegistrySettings
|
|
38
|
+
}),
|
|
39
|
+
defineModule({
|
|
40
|
+
id: `${meta.id}/module/translations`,
|
|
41
|
+
activatesOn: Events.SetupTranslations,
|
|
42
|
+
activate: () => contributes(Capabilities.Translations, translations_default)
|
|
43
|
+
}),
|
|
44
|
+
defineModule({
|
|
45
|
+
id: `${meta.id}/module/react-surface`,
|
|
46
|
+
activatesOn: Events.Startup,
|
|
47
|
+
activate: ReactSurface
|
|
48
|
+
})
|
|
49
|
+
]);
|
|
211
50
|
export {
|
|
51
|
+
REGISTRY_PLUGIN,
|
|
212
52
|
RegistryPlugin,
|
|
213
|
-
|
|
53
|
+
meta
|
|
214
54
|
};
|
|
215
55
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../../src/RegistryPlugin.tsx", "../../../src/
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport
|
|
5
|
-
"mappings": ";;;;;;AAIA,
|
|
6
|
-
"names": ["
|
|
3
|
+
"sources": ["../../../src/RegistryPlugin.tsx", "../../../src/capabilities/index.ts", "../../../src/translations.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { Capabilities, contributes, defineModule, definePlugin, Events } from '@dxos/app-framework';\n\nimport { ReactSurface, RegistrySettings } from './capabilities';\nimport { meta } from './meta';\nimport translations from './translations';\n\nexport const RegistryPlugin = () =>\n definePlugin(meta, [\n defineModule({\n id: `${meta.id}/module/settings`,\n activatesOn: Events.SetupSettings,\n activate: RegistrySettings,\n }),\n defineModule({\n id: `${meta.id}/module/translations`,\n activatesOn: Events.SetupTranslations,\n activate: () => contributes(Capabilities.Translations, translations),\n }),\n defineModule({\n id: `${meta.id}/module/react-surface`,\n activatesOn: Events.Startup,\n activate: ReactSurface,\n }),\n ]);\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { lazy } from '@dxos/app-framework';\n\nexport const ReactSurface = lazy(() => import('./react-surface'));\nexport const RegistrySettings = lazy(() => import('./settings'));\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { REGISTRY_PLUGIN } from './meta';\n\nexport default [\n {\n 'en-US': {\n [REGISTRY_PLUGIN]: {\n 'plugin name': 'Registry',\n 'reload required message': 'Reload required.',\n 'settings show experimental label': 'Show experimental plugins',\n 'settings section installed label': 'Installed',\n 'settings section recommended label': 'Recommended',\n 'settings section experimental label': 'Experimental',\n 'home page label': 'Home page',\n 'source label': 'Source',\n },\n },\n },\n];\n"],
|
|
5
|
+
"mappings": ";;;;;;AAIA,SAASA,cAAcC,aAAaC,cAAcC,cAAcC,cAAc;;;ACA9E,SAASC,YAAY;AAEd,IAAMC,eAAeC,KAAK,MAAM,OAAO,8BAAA,CAAA;AACvC,IAAMC,mBAAmBD,KAAK,MAAM,OAAO,yBAAA,CAAA;;;ACDlD,IAAA,uBAAe;EACb;IACE,SAAS;MACP,CAACE,eAAAA,GAAkB;QACjB,eAAe;QACf,2BAA2B;QAC3B,oCAAoC;QACpC,oCAAoC;QACpC,sCAAsC;QACtC,uCAAuC;QACvC,mBAAmB;QACnB,gBAAgB;MAClB;IACF;EACF;;;;AFVK,IAAMC,iBAAiB,MAC5BC,aAAaC,MAAM;EACjBC,aAAa;IACXC,IAAI,GAAGF,KAAKE,EAAE;IACdC,aAAaC,OAAOC;IACpBC,UAAUC;EACZ,CAAA;EACAN,aAAa;IACXC,IAAI,GAAGF,KAAKE,EAAE;IACdC,aAAaC,OAAOI;IACpBF,UAAU,MAAMG,YAAYC,aAAaC,cAAcC,oBAAAA;EACzD,CAAA;EACAX,aAAa;IACXC,IAAI,GAAGF,KAAKE,EAAE;IACdC,aAAaC,OAAOS;IACpBP,UAAUQ;EACZ,CAAA;CACD;",
|
|
6
|
+
"names": ["Capabilities", "contributes", "defineModule", "definePlugin", "Events", "lazy", "ReactSurface", "lazy", "RegistrySettings", "REGISTRY_PLUGIN", "RegistryPlugin", "definePlugin", "meta", "defineModule", "id", "activatesOn", "Events", "SetupSettings", "activate", "RegistrySettings", "SetupTranslations", "contributes", "Capabilities", "Translations", "translations", "Startup", "ReactSurface"]
|
|
7
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs":{"packages/plugins/plugin-registry/src/meta.ts":{"bytes":
|
|
1
|
+
{"inputs":{"packages/plugins/plugin-registry/src/meta.ts":{"bytes":996,"imports":[],"format":"esm"},"packages/plugins/plugin-registry/src/components/PluginList.tsx":{"bytes":13039,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-registry/src/meta.ts","kind":"import-statement","original":"../meta"}],"format":"esm"},"packages/plugins/plugin-registry/src/components/PluginSettings.tsx":{"bytes":12383,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/plugin-observability/types","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-form","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-registry/src/components/PluginList.tsx","kind":"import-statement","original":"./PluginList"},{"path":"packages/plugins/plugin-registry/src/meta.ts","kind":"import-statement","original":"../meta"}],"format":"esm"},"packages/plugins/plugin-registry/src/components/index.ts":{"bytes":627,"imports":[{"path":"packages/plugins/plugin-registry/src/components/PluginList.tsx","kind":"import-statement","original":"./PluginList"},{"path":"packages/plugins/plugin-registry/src/components/PluginSettings.tsx","kind":"import-statement","original":"./PluginSettings"}],"format":"esm"},"packages/plugins/plugin-registry/src/capabilities/react-surface.tsx":{"bytes":3000,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-registry/src/components/index.ts","kind":"import-statement","original":"../components"},{"path":"packages/plugins/plugin-registry/src/meta.ts","kind":"import-statement","original":"../meta"}],"format":"esm"},"packages/plugins/plugin-registry/src/types.ts":{"bytes":1179,"imports":[{"path":"@dxos/echo-schema","kind":"import-statement","external":true}],"format":"esm"},"packages/plugins/plugin-registry/src/capabilities/settings.ts":{"bytes":1995,"imports":[{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/live-object","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-registry/src/meta.ts","kind":"import-statement","original":"../meta"},{"path":"packages/plugins/plugin-registry/src/types.ts","kind":"import-statement","original":"../types"}],"format":"esm"},"packages/plugins/plugin-registry/src/capabilities/index.ts":{"bytes":1074,"imports":[{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-registry/src/capabilities/react-surface.tsx","kind":"dynamic-import","original":"./react-surface"},{"path":"packages/plugins/plugin-registry/src/capabilities/settings.ts","kind":"dynamic-import","original":"./settings"}],"format":"esm"},"packages/plugins/plugin-registry/src/translations.ts":{"bytes":2142,"imports":[{"path":"packages/plugins/plugin-registry/src/meta.ts","kind":"import-statement","original":"./meta"}],"format":"esm"},"packages/plugins/plugin-registry/src/RegistryPlugin.tsx":{"bytes":3436,"imports":[{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-registry/src/capabilities/index.ts","kind":"import-statement","original":"./capabilities"},{"path":"packages/plugins/plugin-registry/src/meta.ts","kind":"import-statement","original":"./meta"},{"path":"packages/plugins/plugin-registry/src/translations.ts","kind":"import-statement","original":"./translations"}],"format":"esm"},"packages/plugins/plugin-registry/src/index.ts":{"bytes":602,"imports":[{"path":"packages/plugins/plugin-registry/src/meta.ts","kind":"import-statement","original":"./meta"},{"path":"packages/plugins/plugin-registry/src/RegistryPlugin.tsx","kind":"import-statement","original":"./RegistryPlugin"}],"format":"esm"}},"outputs":{"packages/plugins/plugin-registry/dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":2905},"packages/plugins/plugin-registry/dist/lib/browser/index.mjs":{"imports":[{"path":"packages/plugins/plugin-registry/dist/lib/browser/chunk-CMDU7LPH.mjs","kind":"import-statement"},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-registry/dist/lib/browser/react-surface-HKWZP7OW.mjs","kind":"dynamic-import"},{"path":"packages/plugins/plugin-registry/dist/lib/browser/settings-7LOHS2IV.mjs","kind":"dynamic-import"}],"exports":["REGISTRY_PLUGIN","RegistryPlugin","meta"],"entryPoint":"packages/plugins/plugin-registry/src/index.ts","inputs":{"packages/plugins/plugin-registry/src/index.ts":{"bytesInOutput":0},"packages/plugins/plugin-registry/src/RegistryPlugin.tsx":{"bytesInOutput":598},"packages/plugins/plugin-registry/src/capabilities/index.ts":{"bytesInOutput":185},"packages/plugins/plugin-registry/src/translations.ts":{"bytesInOutput":513}},"bytes":1693},"packages/plugins/plugin-registry/dist/lib/browser/react-surface-HKWZP7OW.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":15023},"packages/plugins/plugin-registry/dist/lib/browser/react-surface-HKWZP7OW.mjs":{"imports":[{"path":"packages/plugins/plugin-registry/dist/lib/browser/chunk-CMDU7LPH.mjs","kind":"import-statement"},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/plugin-observability/types","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-form","kind":"import-statement","external":true}],"exports":["default"],"entryPoint":"packages/plugins/plugin-registry/src/capabilities/react-surface.tsx","inputs":{"packages/plugins/plugin-registry/src/capabilities/react-surface.tsx":{"bytesInOutput":542},"packages/plugins/plugin-registry/src/components/PluginList.tsx":{"bytesInOutput":3369},"packages/plugins/plugin-registry/src/components/index.ts":{"bytesInOutput":0},"packages/plugins/plugin-registry/src/components/PluginSettings.tsx":{"bytesInOutput":3160}},"bytes":7518},"packages/plugins/plugin-registry/dist/lib/browser/settings-7LOHS2IV.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":1505},"packages/plugins/plugin-registry/dist/lib/browser/settings-7LOHS2IV.mjs":{"imports":[{"path":"packages/plugins/plugin-registry/dist/lib/browser/chunk-CMDU7LPH.mjs","kind":"import-statement"},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/live-object","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true}],"exports":["default"],"entryPoint":"packages/plugins/plugin-registry/src/capabilities/settings.ts","inputs":{"packages/plugins/plugin-registry/src/capabilities/settings.ts":{"bytesInOutput":311},"packages/plugins/plugin-registry/src/types.ts":{"bytesInOutput":132}},"bytes":772},"packages/plugins/plugin-registry/dist/lib/browser/chunk-CMDU7LPH.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":471},"packages/plugins/plugin-registry/dist/lib/browser/chunk-CMDU7LPH.mjs":{"imports":[],"exports":["REGISTRY_PLUGIN","meta"],"inputs":{"packages/plugins/plugin-registry/src/meta.ts":{"bytesInOutput":107}},"bytes":238}}}
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import {
|
|
2
|
+
REGISTRY_PLUGIN,
|
|
3
|
+
meta
|
|
4
|
+
} from "./chunk-CMDU7LPH.mjs";
|
|
5
|
+
|
|
6
|
+
// packages/plugins/plugin-registry/src/capabilities/react-surface.tsx
|
|
7
|
+
import React3 from "react";
|
|
8
|
+
import { Capabilities, contributes, createSurface, useCapability } from "@dxos/app-framework";
|
|
9
|
+
|
|
10
|
+
// packages/plugins/plugin-registry/src/components/PluginList.tsx
|
|
11
|
+
import React, { useCallback } from "react";
|
|
12
|
+
import { Button, Icon, Input, Link, List, ListItem, useTranslation } from "@dxos/react-ui";
|
|
13
|
+
import { descriptionText, fineBlockSize, mx } from "@dxos/react-ui-theme";
|
|
14
|
+
var PluginList = ({ plugins = [], installed = [], enabled = [], onChange, onReload }) => {
|
|
15
|
+
const { t } = useTranslation(REGISTRY_PLUGIN);
|
|
16
|
+
return /* @__PURE__ */ React.createElement(List, {
|
|
17
|
+
classNames: "mb-4 select-none"
|
|
18
|
+
}, plugins.map(({ id, name, description, homePage, source, icon = "ph--circle--regular" }) => {
|
|
19
|
+
const isEnabled = enabled.includes(id);
|
|
20
|
+
const isInstalled = installed.includes(id);
|
|
21
|
+
const reloadRequired = isEnabled !== isInstalled;
|
|
22
|
+
const inputId = `${id}-input`;
|
|
23
|
+
const labelId = `${id}-label`;
|
|
24
|
+
const descriptionId = `${id}-description`;
|
|
25
|
+
const handleChange = useCallback(() => onChange?.(id, !isEnabled), [
|
|
26
|
+
id,
|
|
27
|
+
isEnabled,
|
|
28
|
+
onChange
|
|
29
|
+
]);
|
|
30
|
+
return /* @__PURE__ */ React.createElement(Input.Root, {
|
|
31
|
+
key: id,
|
|
32
|
+
id: inputId
|
|
33
|
+
}, /* @__PURE__ */ React.createElement(ListItem.Root, {
|
|
34
|
+
labelId,
|
|
35
|
+
"data-testid": `pluginList.${id}`,
|
|
36
|
+
"aria-describedby": descriptionId,
|
|
37
|
+
classNames: "flex gap-2 plb-2 pli-2 -mli-2 rounded"
|
|
38
|
+
}, /* @__PURE__ */ React.createElement(Icon, {
|
|
39
|
+
icon,
|
|
40
|
+
size: 6,
|
|
41
|
+
classNames: "shrink-0 mbs-1"
|
|
42
|
+
}), /* @__PURE__ */ React.createElement("div", {
|
|
43
|
+
role: "none",
|
|
44
|
+
className: mx(fineBlockSize, "grow pbs-1 pl-1")
|
|
45
|
+
}, /* @__PURE__ */ React.createElement("label", {
|
|
46
|
+
htmlFor: inputId,
|
|
47
|
+
id: labelId,
|
|
48
|
+
className: "truncate"
|
|
49
|
+
}, name ?? id), (description || reloadRequired || homePage || source) && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", {
|
|
50
|
+
id: descriptionId,
|
|
51
|
+
className: "space-b-1 pbs-1 pbe-1"
|
|
52
|
+
}, /* @__PURE__ */ React.createElement("p", {
|
|
53
|
+
className: descriptionText
|
|
54
|
+
}, description), homePage && /* @__PURE__ */ React.createElement(Link, {
|
|
55
|
+
href: homePage,
|
|
56
|
+
target: "_blank",
|
|
57
|
+
rel: "noreferrer",
|
|
58
|
+
"aria-describedby": descriptionId,
|
|
59
|
+
classNames: "text-xs text-description"
|
|
60
|
+
}, t("home page label"), /* @__PURE__ */ React.createElement(Icon, {
|
|
61
|
+
icon: "ph--arrow-square-out--bold",
|
|
62
|
+
size: 3,
|
|
63
|
+
classNames: "inline-block leading-none mli-1"
|
|
64
|
+
})), source && /* @__PURE__ */ React.createElement(Link, {
|
|
65
|
+
href: source,
|
|
66
|
+
target: "_blank",
|
|
67
|
+
rel: "noreferrer",
|
|
68
|
+
"aria-describedby": descriptionId,
|
|
69
|
+
classNames: "text-xs 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 mli-1"
|
|
74
|
+
}))), reloadRequired && /* @__PURE__ */ React.createElement(Button, {
|
|
75
|
+
variant: "ghost",
|
|
76
|
+
classNames: "p-0 gap-2",
|
|
77
|
+
onClick: onReload
|
|
78
|
+
}, /* @__PURE__ */ React.createElement(Icon, {
|
|
79
|
+
size: 4,
|
|
80
|
+
icon: "ph--arrow-clockwise--regular"
|
|
81
|
+
}), /* @__PURE__ */ React.createElement("p", {
|
|
82
|
+
className: "text-sm font-medium"
|
|
83
|
+
}, t("reload required message"))))), /* @__PURE__ */ React.createElement("div", {
|
|
84
|
+
className: "pbs-1"
|
|
85
|
+
}, /* @__PURE__ */ React.createElement(Input.Switch, {
|
|
86
|
+
classNames: "self-center",
|
|
87
|
+
checked: isEnabled,
|
|
88
|
+
onClick: handleChange
|
|
89
|
+
}))));
|
|
90
|
+
}));
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
// packages/plugins/plugin-registry/src/components/PluginSettings.tsx
|
|
94
|
+
import React2, { useMemo } from "react";
|
|
95
|
+
import { createIntent, useIntentDispatcher, usePluginManager } from "@dxos/app-framework";
|
|
96
|
+
import { ObservabilityAction } from "@dxos/plugin-observability/types";
|
|
97
|
+
import { Input as Input2, useTranslation as useTranslation2 } from "@dxos/react-ui";
|
|
98
|
+
import { DeprecatedFormInput } from "@dxos/react-ui-form";
|
|
99
|
+
var sortPluginMeta = ({ name: a = "" }, { name: b = "" }) => a.localeCompare(b);
|
|
100
|
+
var PluginSettings = ({ settings }) => {
|
|
101
|
+
const { t } = useTranslation2(REGISTRY_PLUGIN);
|
|
102
|
+
const manager = usePluginManager();
|
|
103
|
+
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
104
|
+
const installed = useMemo(() => manager.plugins.filter(({ meta: meta2 }) => !manager.core.includes(meta2.id)).filter(({ meta: meta2 }) => manager.enabled.includes(meta2.id)).map(({ meta: meta2 }) => meta2).sort(sortPluginMeta), []);
|
|
105
|
+
const pluginIds = useMemo(() => installed.map((meta2) => meta2.id), [
|
|
106
|
+
installed
|
|
107
|
+
]);
|
|
108
|
+
const available = useMemo(() => manager.plugins.map(({ meta: meta2 }) => meta2).filter(({ id }) => !manager.enabled.includes(id)).sort(sortPluginMeta), []);
|
|
109
|
+
const recommended = available.filter((meta2) => !meta2.tags?.includes("experimental"));
|
|
110
|
+
const experimental = available.filter((meta2) => meta2.tags?.includes("experimental"));
|
|
111
|
+
const handleChange = (id, enabled) => {
|
|
112
|
+
enabled ? manager.enable(id) : manager.disable(id);
|
|
113
|
+
void dispatch(createIntent(ObservabilityAction.SendEvent, {
|
|
114
|
+
name: "plugins.toggle",
|
|
115
|
+
properties: {
|
|
116
|
+
plugin: id,
|
|
117
|
+
enabled
|
|
118
|
+
}
|
|
119
|
+
}));
|
|
120
|
+
};
|
|
121
|
+
const handleReload = () => {
|
|
122
|
+
window.location.reload();
|
|
123
|
+
};
|
|
124
|
+
return /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(DeprecatedFormInput, {
|
|
125
|
+
label: t("settings show experimental label")
|
|
126
|
+
}, /* @__PURE__ */ React2.createElement(Input2.Switch, {
|
|
127
|
+
"data-testid": "pluginSettings.experimental",
|
|
128
|
+
checked: settings.experimental,
|
|
129
|
+
onCheckedChange: (checked) => settings.experimental = !!checked
|
|
130
|
+
})), /* @__PURE__ */ React2.createElement(Section, {
|
|
131
|
+
label: t("settings section installed label")
|
|
132
|
+
}, /* @__PURE__ */ React2.createElement(PluginList, {
|
|
133
|
+
plugins: installed,
|
|
134
|
+
installed: pluginIds,
|
|
135
|
+
enabled: manager.enabled,
|
|
136
|
+
onChange: handleChange,
|
|
137
|
+
onReload: handleReload
|
|
138
|
+
})), /* @__PURE__ */ React2.createElement(Section, {
|
|
139
|
+
label: t("settings section recommended label")
|
|
140
|
+
}, /* @__PURE__ */ React2.createElement(PluginList, {
|
|
141
|
+
plugins: recommended,
|
|
142
|
+
installed: pluginIds,
|
|
143
|
+
enabled: manager.enabled,
|
|
144
|
+
onChange: handleChange,
|
|
145
|
+
onReload: handleReload
|
|
146
|
+
})), settings.experimental && /* @__PURE__ */ React2.createElement(Section, {
|
|
147
|
+
label: t("settings section experimental label")
|
|
148
|
+
}, /* @__PURE__ */ React2.createElement(PluginList, {
|
|
149
|
+
plugins: experimental,
|
|
150
|
+
installed: pluginIds,
|
|
151
|
+
enabled: manager.enabled,
|
|
152
|
+
onChange: handleChange,
|
|
153
|
+
onReload: handleReload
|
|
154
|
+
})));
|
|
155
|
+
};
|
|
156
|
+
var Section = ({ label, children }) => {
|
|
157
|
+
return /* @__PURE__ */ React2.createElement("div", null, /* @__PURE__ */ React2.createElement("h2", {
|
|
158
|
+
className: "py-2 text-sm text-subdued"
|
|
159
|
+
}, label), children);
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
// packages/plugins/plugin-registry/src/capabilities/react-surface.tsx
|
|
163
|
+
var react_surface_default = () => contributes(Capabilities.ReactSurface, [
|
|
164
|
+
createSurface({
|
|
165
|
+
id: meta.id,
|
|
166
|
+
role: "settings",
|
|
167
|
+
filter: (data) => data.subject === REGISTRY_PLUGIN,
|
|
168
|
+
component: () => {
|
|
169
|
+
const settings = useCapability(Capabilities.SettingsStore).getStore(REGISTRY_PLUGIN).value;
|
|
170
|
+
return /* @__PURE__ */ React3.createElement(PluginSettings, {
|
|
171
|
+
settings
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
})
|
|
175
|
+
]);
|
|
176
|
+
export {
|
|
177
|
+
react_surface_default as default
|
|
178
|
+
};
|
|
179
|
+
//# sourceMappingURL=react-surface-HKWZP7OW.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/capabilities/react-surface.tsx", "../../../src/components/PluginList.tsx", "../../../src/components/PluginSettings.tsx"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport React from 'react';\n\nimport { Capabilities, contributes, createSurface, useCapability } from '@dxos/app-framework';\n\nimport { PluginSettings } from '../components';\nimport { meta, REGISTRY_PLUGIN } from '../meta';\nimport { type RegistrySettings } from '../types';\n\nexport default () =>\n contributes(Capabilities.ReactSurface, [\n createSurface({\n id: meta.id,\n role: 'settings',\n filter: (data): data is any => data.subject === REGISTRY_PLUGIN,\n component: () => {\n const settings = useCapability(Capabilities.SettingsStore).getStore<RegistrySettings>(REGISTRY_PLUGIN)!.value;\n return <PluginSettings settings={settings} />;\n },\n }),\n ]);\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport React, { useCallback } from 'react';\n\nimport { type PluginMeta } from '@dxos/app-framework';\nimport { Button, Icon, Input, Link, List, ListItem, useTranslation } from '@dxos/react-ui';\nimport { descriptionText, fineBlockSize, mx } from '@dxos/react-ui-theme';\n\nimport { REGISTRY_PLUGIN } from '../meta';\n\nexport type PluginListProps = {\n plugins?: readonly PluginMeta[];\n installed?: readonly string[];\n enabled?: readonly string[];\n onChange?: (id: string, enabled: boolean) => void;\n onReload?: () => void;\n};\n\nexport const PluginList = ({ plugins = [], installed = [], enabled = [], onChange, onReload }: PluginListProps) => {\n const { t } = useTranslation(REGISTRY_PLUGIN);\n\n return (\n <List classNames='mb-4 select-none'>\n {plugins.map(({ id, name, description, homePage, source, icon = 'ph--circle--regular' }) => {\n const isEnabled = enabled.includes(id);\n const isInstalled = installed.includes(id);\n const reloadRequired = isEnabled !== isInstalled;\n const inputId = `${id}-input`;\n const labelId = `${id}-label`;\n const descriptionId = `${id}-description`;\n const handleChange = useCallback(() => onChange?.(id, !isEnabled), [id, isEnabled, onChange]);\n\n return (\n <Input.Root key={id} id={inputId}>\n <ListItem.Root\n labelId={labelId}\n data-testid={`pluginList.${id}`}\n aria-describedby={descriptionId}\n classNames='flex gap-2 plb-2 pli-2 -mli-2 rounded'\n >\n <Icon icon={icon} size={6} classNames='shrink-0 mbs-1' />\n <div role='none' className={mx(fineBlockSize, 'grow pbs-1 pl-1')}>\n <label htmlFor={inputId} id={labelId} className='truncate'>\n {name ?? id}\n </label>\n {(description || reloadRequired || homePage || source) && (\n <>\n <div id={descriptionId} className='space-b-1 pbs-1 pbe-1'>\n <p className={descriptionText}>{description}</p>\n {homePage && (\n <Link\n href={homePage}\n target='_blank'\n rel='noreferrer'\n aria-describedby={descriptionId}\n classNames='text-xs text-description'\n >\n {t('home page label')}\n <Icon\n icon='ph--arrow-square-out--bold'\n size={3}\n classNames='inline-block leading-none mli-1'\n />\n </Link>\n )}\n {source && (\n <Link\n href={source}\n target='_blank'\n rel='noreferrer'\n aria-describedby={descriptionId}\n classNames='text-xs text-description'\n >\n {t('source label')}\n <Icon\n icon='ph--arrow-square-out--bold'\n size={3}\n classNames='inline-block leading-none mli-1'\n />\n </Link>\n )}\n </div>\n {reloadRequired && (\n <Button variant='ghost' classNames='p-0 gap-2' onClick={onReload}>\n <Icon size={4} icon='ph--arrow-clockwise--regular' />\n <p className='text-sm font-medium'>{t('reload required message')}</p>\n </Button>\n )}\n </>\n )}\n </div>\n <div className='pbs-1'>\n <Input.Switch classNames='self-center' checked={isEnabled} onClick={handleChange} />\n </div>\n </ListItem.Root>\n </Input.Root>\n );\n })}\n </List>\n );\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport React, { useMemo, type PropsWithChildren } from 'react';\n\nimport { createIntent, type PluginMeta, useIntentDispatcher, usePluginManager } from '@dxos/app-framework';\nimport { ObservabilityAction } from '@dxos/plugin-observability/types';\nimport { Input, useTranslation } from '@dxos/react-ui';\nimport { DeprecatedFormInput } from '@dxos/react-ui-form';\n\nimport { PluginList } from './PluginList';\nimport { REGISTRY_PLUGIN } from '../meta';\nimport { type RegistrySettings } from '../types';\n\nconst sortPluginMeta = ({ name: a = '' }: PluginMeta, { name: b = '' }: PluginMeta) => a.localeCompare(b);\n\nexport const PluginSettings = ({ settings }: { settings: RegistrySettings }) => {\n const { t } = useTranslation(REGISTRY_PLUGIN);\n const manager = usePluginManager();\n const { dispatchPromise: dispatch } = useIntentDispatcher();\n\n // Memoize to prevent plugins from disappearing when toggling enabled.\n const installed = useMemo(\n () =>\n manager.plugins\n .filter(({ meta }) => !manager.core.includes(meta.id))\n .filter(({ meta }) => manager.enabled.includes(meta.id))\n .map(({ meta }) => meta)\n .sort(sortPluginMeta),\n [],\n );\n const pluginIds = useMemo(() => installed.map((meta) => meta.id), [installed]);\n\n const available = useMemo(\n () =>\n manager.plugins\n .map(({ meta }) => meta)\n .filter(({ id }) => !manager.enabled.includes(id))\n .sort(sortPluginMeta),\n [],\n );\n const recommended = available.filter((meta) => !meta.tags?.includes('experimental'));\n const experimental = available.filter((meta) => meta.tags?.includes('experimental'));\n\n const handleChange = (id: string, enabled: boolean) => {\n enabled ? manager.enable(id) : manager.disable(id);\n void dispatch(\n createIntent(ObservabilityAction.SendEvent, {\n name: 'plugins.toggle',\n properties: { plugin: id, enabled },\n }),\n );\n };\n\n const handleReload = () => {\n window.location.reload();\n };\n\n return (\n <>\n <DeprecatedFormInput label={t('settings show experimental label')}>\n <Input.Switch\n data-testid='pluginSettings.experimental'\n checked={settings.experimental}\n onCheckedChange={(checked) => (settings.experimental = !!checked)}\n />\n </DeprecatedFormInput>\n\n <Section label={t('settings section installed label')}>\n <PluginList\n plugins={installed}\n installed={pluginIds}\n enabled={manager.enabled}\n onChange={handleChange}\n onReload={handleReload}\n />\n </Section>\n\n <Section label={t('settings section recommended label')}>\n <PluginList\n plugins={recommended}\n installed={pluginIds}\n enabled={manager.enabled}\n onChange={handleChange}\n onReload={handleReload}\n />\n </Section>\n\n {settings.experimental && (\n <Section label={t('settings section experimental label')}>\n <PluginList\n plugins={experimental}\n installed={pluginIds}\n enabled={manager.enabled}\n onChange={handleChange}\n onReload={handleReload}\n />\n </Section>\n )}\n </>\n );\n};\n\nconst Section = ({ label, children }: PropsWithChildren<{ label: string }>) => {\n return (\n <div>\n <h2 className='py-2 text-sm text-subdued'>{label}</h2>\n {children}\n </div>\n );\n};\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
|
+
"names": ["React", "Capabilities", "contributes", "createSurface", "useCapability", "React", "useCallback", "Button", "Icon", "Input", "Link", "List", "ListItem", "useTranslation", "descriptionText", "fineBlockSize", "mx", "PluginList", "plugins", "installed", "enabled", "onChange", "onReload", "t", "useTranslation", "REGISTRY_PLUGIN", "List", "classNames", "map", "id", "name", "description", "homePage", "source", "icon", "isEnabled", "includes", "isInstalled", "reloadRequired", "inputId", "labelId", "descriptionId", "handleChange", "useCallback", "Input", "Root", "key", "ListItem", "data-testid", "aria-describedby", "Icon", "size", "div", "role", "className", "mx", "fineBlockSize", "label", "htmlFor", "p", "descriptionText", "Link", "href", "target", "rel", "Button", "variant", "onClick", "Switch", "checked", "React", "useMemo", "createIntent", "useIntentDispatcher", "usePluginManager", "ObservabilityAction", "Input", "useTranslation", "DeprecatedFormInput", "sortPluginMeta", "name", "a", "b", "localeCompare", "PluginSettings", "settings", "t", "useTranslation", "REGISTRY_PLUGIN", "manager", "usePluginManager", "dispatchPromise", "dispatch", "useIntentDispatcher", "installed", "useMemo", "plugins", "filter", "meta", "core", "includes", "id", "enabled", "map", "sort", "pluginIds", "available", "recommended", "tags", "experimental", "handleChange", "enable", "disable", "createIntent", "ObservabilityAction", "SendEvent", "properties", "plugin", "handleReload", "window", "location", "reload", "React", "DeprecatedFormInput", "label", "Input", "Switch", "data-testid", "checked", "onCheckedChange", "Section", "PluginList", "onChange", "onReload", "children", "div", "h2", "className", "contributes", "Capabilities", "ReactSurface", "createSurface", "id", "meta", "role", "filter", "data", "subject", "REGISTRY_PLUGIN", "component", "settings", "useCapability", "SettingsStore", "getStore", "value", "React", "PluginSettings"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import {
|
|
2
|
+
REGISTRY_PLUGIN
|
|
3
|
+
} from "./chunk-CMDU7LPH.mjs";
|
|
4
|
+
|
|
5
|
+
// packages/plugins/plugin-registry/src/capabilities/settings.ts
|
|
6
|
+
import { Capabilities, contributes } from "@dxos/app-framework";
|
|
7
|
+
import { create } from "@dxos/live-object";
|
|
8
|
+
|
|
9
|
+
// packages/plugins/plugin-registry/src/types.ts
|
|
10
|
+
import { S } from "@dxos/echo-schema";
|
|
11
|
+
var RegistrySettingsSchema = S.mutable(S.Struct({
|
|
12
|
+
experimental: S.optional(S.Boolean)
|
|
13
|
+
}));
|
|
14
|
+
|
|
15
|
+
// packages/plugins/plugin-registry/src/capabilities/settings.ts
|
|
16
|
+
var settings_default = () => {
|
|
17
|
+
const settings = create({});
|
|
18
|
+
return contributes(Capabilities.Settings, {
|
|
19
|
+
schema: RegistrySettingsSchema,
|
|
20
|
+
prefix: REGISTRY_PLUGIN,
|
|
21
|
+
value: settings
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
export {
|
|
25
|
+
settings_default as default
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=settings-7LOHS2IV.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/capabilities/settings.ts", "../../../src/types.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { Capabilities, contributes } from '@dxos/app-framework';\nimport { create } from '@dxos/live-object';\n\nimport { REGISTRY_PLUGIN } from '../meta';\nimport { type RegistrySettings, RegistrySettingsSchema } from '../types';\n\nexport default () => {\n const settings = create<RegistrySettings>({});\n\n return contributes(Capabilities.Settings, {\n schema: RegistrySettingsSchema,\n prefix: REGISTRY_PLUGIN,\n value: settings,\n });\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { S } from '@dxos/echo-schema';\n\nexport const RegistrySettingsSchema = S.mutable(\n S.Struct({\n experimental: S.optional(S.Boolean),\n }),\n);\n\nexport type RegistrySettings = S.Schema.Type<typeof RegistrySettingsSchema>;\n"],
|
|
5
|
+
"mappings": ";;;;;AAIA,SAASA,cAAcC,mBAAmB;AAC1C,SAASC,cAAc;;;ACDvB,SAASC,SAAS;AAEX,IAAMC,yBAAyBC,EAAEC,QACtCD,EAAEE,OAAO;EACPC,cAAcH,EAAEI,SAASJ,EAAEK,OAAO;AACpC,CAAA,CAAA;;;ADCF,IAAA,mBAAe,MAAA;AACb,QAAMC,WAAWC,OAAyB,CAAC,CAAA;AAE3C,SAAOC,YAAYC,aAAaC,UAAU;IACxCC,QAAQC;IACRC,QAAQC;IACRC,OAAOT;EACT,CAAA;AACF;",
|
|
6
|
+
"names": ["Capabilities", "contributes", "create", "S", "RegistrySettingsSchema", "S", "mutable", "Struct", "experimental", "optional", "Boolean", "settings", "create", "contributes", "Capabilities", "Settings", "schema", "RegistrySettingsSchema", "prefix", "REGISTRY_PLUGIN", "value"]
|
|
7
|
+
}
|
|
@@ -1,7 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
export type RegistrySettingsProps = {
|
|
3
|
-
experimental?: boolean;
|
|
4
|
-
};
|
|
5
|
-
export type RegistryPluginProvides = SurfaceProvides & TranslationsProvides & SettingsProvides<RegistrySettingsProps>;
|
|
6
|
-
export declare const RegistryPlugin: () => PluginDefinition<RegistryPluginProvides>;
|
|
1
|
+
export declare const RegistryPlugin: () => import("@dxos/app-framework").Plugin;
|
|
7
2
|
//# sourceMappingURL=RegistryPlugin.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RegistryPlugin.d.ts","sourceRoot":"","sources":["../../../src/RegistryPlugin.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"RegistryPlugin.d.ts","sourceRoot":"","sources":["../../../src/RegistryPlugin.tsx"],"names":[],"mappings":"AAUA,eAAO,MAAM,cAAc,4CAiBvB,CAAC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export declare const ReactSurface: (props?: unknown) => Promise<import("@dxos/app-framework").Capability<import("@dxos/app-framework").Capabilities.ReactSurface>>;
|
|
2
|
+
export declare const RegistrySettings: (props?: unknown) => Promise<import("@dxos/app-framework").Capability<import("@dxos/app-framework").Capabilities.Settings>>;
|
|
3
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/capabilities/index.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,YAAY,iIAAwC,CAAC;AAClE,eAAO,MAAM,gBAAgB,6HAAmC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"react-surface.d.ts","sourceRoot":"","sources":["../../../../src/capabilities/react-surface.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,YAAY,EAA6C,MAAM,qBAAqB,CAAC;;AAM9F,wBAWK"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../../../../src/capabilities/settings.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAe,MAAM,qBAAqB,CAAC;;AAMhE,wBAQE"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { type PluginMeta } from '@dxos/app-framework';
|
|
3
3
|
export type PluginListProps = {
|
|
4
|
-
plugins?: PluginMeta[];
|
|
5
|
-
|
|
6
|
-
enabled?: string[];
|
|
4
|
+
plugins?: readonly PluginMeta[];
|
|
5
|
+
installed?: readonly string[];
|
|
6
|
+
enabled?: readonly string[];
|
|
7
7
|
onChange?: (id: string, enabled: boolean) => void;
|
|
8
8
|
onReload?: () => void;
|
|
9
9
|
};
|
|
10
|
-
export declare const PluginList: ({ plugins,
|
|
10
|
+
export declare const PluginList: ({ plugins, installed, enabled, onChange, onReload }: PluginListProps) => React.JSX.Element;
|
|
11
11
|
//# sourceMappingURL=PluginList.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PluginList.d.ts","sourceRoot":"","sources":["../../../../src/components/PluginList.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAsB,MAAM,OAAO,CAAC;AAE3C,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAMtD,MAAM,MAAM,eAAe,GAAG;IAC5B,OAAO,CAAC,EAAE,UAAU,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"PluginList.d.ts","sourceRoot":"","sources":["../../../../src/components/PluginList.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAsB,MAAM,OAAO,CAAC;AAE3C,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAMtD,MAAM,MAAM,eAAe,GAAG;IAC5B,OAAO,CAAC,EAAE,SAAS,UAAU,EAAE,CAAC;IAChC,SAAS,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC9B,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC5B,QAAQ,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IAClD,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;CACvB,CAAC;AAEF,eAAO,MAAM,UAAU,wDAAwE,eAAe,sBAkF7G,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { type
|
|
2
|
+
import { type RegistrySettings } from '../types';
|
|
3
3
|
export declare const PluginSettings: ({ settings }: {
|
|
4
|
-
settings:
|
|
4
|
+
settings: RegistrySettings;
|
|
5
5
|
}) => React.JSX.Element;
|
|
6
6
|
//# sourceMappingURL=PluginSettings.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PluginSettings.d.ts","sourceRoot":"","sources":["../../../../src/components/PluginSettings.tsx"],"names":[],"mappings":"AAIA,OAAO,KAA0C,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"PluginSettings.d.ts","sourceRoot":"","sources":["../../../../src/components/PluginSettings.tsx"],"names":[],"mappings":"AAIA,OAAO,KAA0C,MAAM,OAAO,CAAC;AAS/D,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAIjD,eAAO,MAAM,cAAc,iBAAkB;IAAE,QAAQ,EAAE,gBAAgB,CAAA;CAAE,sBAqF1E,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAIA,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAIA,cAAc,QAAQ,CAAC;AACvB,cAAc,kBAAkB,CAAC"}
|
package/dist/types/src/meta.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"meta.d.ts","sourceRoot":"","sources":["../../../src/meta.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,eAAe,6BAA6B,CAAC
|
|
1
|
+
{"version":3,"file":"meta.d.ts","sourceRoot":"","sources":["../../../src/meta.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,eAAe,6BAA6B,CAAC;AAE1D,eAAO,MAAM,IAAI;;;CAGK,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { S } from '@dxos/echo-schema';
|
|
2
|
+
export declare const RegistrySettingsSchema: S.mutable<S.Struct<{
|
|
3
|
+
experimental: S.optional<typeof S.Boolean>;
|
|
4
|
+
}>>;
|
|
5
|
+
export type RegistrySettings = S.Schema.Type<typeof RegistrySettingsSchema>;
|
|
6
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/types.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,CAAC,EAAE,MAAM,mBAAmB,CAAC;AAEtC,eAAO,MAAM,sBAAsB;;GAIlC,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,sBAAsB,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":"5.7.
|
|
1
|
+
{"version":"5.7.3"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/plugin-registry",
|
|
3
|
-
"version": "0.7.5-main.
|
|
3
|
+
"version": "0.7.5-main.9d2a38b",
|
|
4
4
|
"description": "Braneframe plugin gallery",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -11,30 +11,23 @@
|
|
|
11
11
|
".": {
|
|
12
12
|
"types": "./dist/types/src/index.d.ts",
|
|
13
13
|
"browser": "./dist/lib/browser/index.mjs"
|
|
14
|
-
},
|
|
15
|
-
"./meta": {
|
|
16
|
-
"types": "./dist/types/src/meta.d.ts",
|
|
17
|
-
"browser": "./dist/lib/browser/meta.mjs"
|
|
18
14
|
}
|
|
19
15
|
},
|
|
20
16
|
"types": "dist/types/src/index.d.ts",
|
|
21
17
|
"typesVersions": {
|
|
22
|
-
"*": {
|
|
23
|
-
"meta": [
|
|
24
|
-
"dist/types/src/meta.d.ts"
|
|
25
|
-
]
|
|
26
|
-
}
|
|
18
|
+
"*": {}
|
|
27
19
|
},
|
|
28
20
|
"files": [
|
|
29
21
|
"dist",
|
|
30
22
|
"src"
|
|
31
23
|
],
|
|
32
24
|
"dependencies": {
|
|
33
|
-
"@dxos/
|
|
34
|
-
"@dxos/
|
|
35
|
-
"@dxos/plugin-observability": "0.7.5-main.
|
|
36
|
-
"@dxos/react-ui-form": "0.7.5-main.
|
|
37
|
-
"@dxos/util": "0.7.5-main.
|
|
25
|
+
"@dxos/app-framework": "0.7.5-main.9d2a38b",
|
|
26
|
+
"@dxos/live-object": "0.7.5-main.9d2a38b",
|
|
27
|
+
"@dxos/plugin-observability": "0.7.5-main.9d2a38b",
|
|
28
|
+
"@dxos/react-ui-form": "0.7.5-main.9d2a38b",
|
|
29
|
+
"@dxos/util": "0.7.5-main.9d2a38b",
|
|
30
|
+
"@dxos/echo-schema": "0.7.5-main.9d2a38b"
|
|
38
31
|
},
|
|
39
32
|
"devDependencies": {
|
|
40
33
|
"@phosphor-icons/react": "^2.1.5",
|
|
@@ -43,19 +36,19 @@
|
|
|
43
36
|
"react": "~18.2.0",
|
|
44
37
|
"react-dom": "~18.2.0",
|
|
45
38
|
"vite": "5.4.7",
|
|
46
|
-
"@dxos/random": "0.7.5-main.
|
|
47
|
-
"@dxos/react-ui": "0.7.5-main.
|
|
48
|
-
"@dxos/
|
|
49
|
-
"@dxos/react-ui-
|
|
50
|
-
"@dxos/
|
|
39
|
+
"@dxos/random": "0.7.5-main.9d2a38b",
|
|
40
|
+
"@dxos/react-ui": "0.7.5-main.9d2a38b",
|
|
41
|
+
"@dxos/storybook-utils": "0.7.5-main.9d2a38b",
|
|
42
|
+
"@dxos/react-ui-theme": "0.7.5-main.9d2a38b",
|
|
43
|
+
"@dxos/react-ui-mosaic": "0.7.5-main.9d2a38b"
|
|
51
44
|
},
|
|
52
45
|
"peerDependencies": {
|
|
53
46
|
"@phosphor-icons/react": "^2.1.5",
|
|
54
47
|
"react": "~18.2.0",
|
|
55
48
|
"react-dom": "~18.2.0",
|
|
56
|
-
"@dxos/react-ui": "0.7.5-main.
|
|
57
|
-
"@dxos/react-ui-theme": "0.7.5-main.
|
|
58
|
-
"@dxos/react-ui
|
|
49
|
+
"@dxos/react-ui-mosaic": "0.7.5-main.9d2a38b",
|
|
50
|
+
"@dxos/react-ui-theme": "0.7.5-main.9d2a38b",
|
|
51
|
+
"@dxos/react-ui": "0.7.5-main.9d2a38b"
|
|
59
52
|
},
|
|
60
53
|
"publishConfig": {
|
|
61
54
|
"access": "public"
|
package/src/RegistryPlugin.tsx
CHANGED
|
@@ -2,47 +2,27 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import { Capabilities, contributes, defineModule, definePlugin, Events } from '@dxos/app-framework';
|
|
6
6
|
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
type PluginDefinition,
|
|
10
|
-
type SettingsProvides,
|
|
11
|
-
type SurfaceProvides,
|
|
12
|
-
type TranslationsProvides,
|
|
13
|
-
} from '@dxos/app-framework';
|
|
14
|
-
import { LocalStorageStore } from '@dxos/local-storage';
|
|
15
|
-
|
|
16
|
-
import { PluginSettings } from './components';
|
|
17
|
-
import meta, { REGISTRY_PLUGIN } from './meta';
|
|
7
|
+
import { ReactSurface, RegistrySettings } from './capabilities';
|
|
8
|
+
import { meta } from './meta';
|
|
18
9
|
import translations from './translations';
|
|
19
10
|
|
|
20
|
-
export
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
definitions: () =>
|
|
39
|
-
createSurface({
|
|
40
|
-
id: meta.id,
|
|
41
|
-
role: 'settings',
|
|
42
|
-
filter: (data): data is any => data.subject === REGISTRY_PLUGIN,
|
|
43
|
-
component: () => <PluginSettings settings={settings.values} />,
|
|
44
|
-
}),
|
|
45
|
-
},
|
|
46
|
-
},
|
|
47
|
-
};
|
|
48
|
-
};
|
|
11
|
+
export const RegistryPlugin = () =>
|
|
12
|
+
definePlugin(meta, [
|
|
13
|
+
defineModule({
|
|
14
|
+
id: `${meta.id}/module/settings`,
|
|
15
|
+
activatesOn: Events.SetupSettings,
|
|
16
|
+
activate: RegistrySettings,
|
|
17
|
+
}),
|
|
18
|
+
defineModule({
|
|
19
|
+
id: `${meta.id}/module/translations`,
|
|
20
|
+
activatesOn: Events.SetupTranslations,
|
|
21
|
+
activate: () => contributes(Capabilities.Translations, translations),
|
|
22
|
+
}),
|
|
23
|
+
defineModule({
|
|
24
|
+
id: `${meta.id}/module/react-surface`,
|
|
25
|
+
activatesOn: Events.Startup,
|
|
26
|
+
activate: ReactSurface,
|
|
27
|
+
}),
|
|
28
|
+
]);
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React from 'react';
|
|
6
|
+
|
|
7
|
+
import { Capabilities, contributes, createSurface, useCapability } from '@dxos/app-framework';
|
|
8
|
+
|
|
9
|
+
import { PluginSettings } from '../components';
|
|
10
|
+
import { meta, REGISTRY_PLUGIN } from '../meta';
|
|
11
|
+
import { type RegistrySettings } from '../types';
|
|
12
|
+
|
|
13
|
+
export default () =>
|
|
14
|
+
contributes(Capabilities.ReactSurface, [
|
|
15
|
+
createSurface({
|
|
16
|
+
id: meta.id,
|
|
17
|
+
role: 'settings',
|
|
18
|
+
filter: (data): data is any => data.subject === REGISTRY_PLUGIN,
|
|
19
|
+
component: () => {
|
|
20
|
+
const settings = useCapability(Capabilities.SettingsStore).getStore<RegistrySettings>(REGISTRY_PLUGIN)!.value;
|
|
21
|
+
return <PluginSettings settings={settings} />;
|
|
22
|
+
},
|
|
23
|
+
}),
|
|
24
|
+
]);
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { Capabilities, contributes } from '@dxos/app-framework';
|
|
6
|
+
import { create } from '@dxos/live-object';
|
|
7
|
+
|
|
8
|
+
import { REGISTRY_PLUGIN } from '../meta';
|
|
9
|
+
import { type RegistrySettings, RegistrySettingsSchema } from '../types';
|
|
10
|
+
|
|
11
|
+
export default () => {
|
|
12
|
+
const settings = create<RegistrySettings>({});
|
|
13
|
+
|
|
14
|
+
return contributes(Capabilities.Settings, {
|
|
15
|
+
schema: RegistrySettingsSchema,
|
|
16
|
+
prefix: REGISTRY_PLUGIN,
|
|
17
|
+
value: settings,
|
|
18
|
+
});
|
|
19
|
+
};
|
|
@@ -11,22 +11,22 @@ import { descriptionText, fineBlockSize, mx } from '@dxos/react-ui-theme';
|
|
|
11
11
|
import { REGISTRY_PLUGIN } from '../meta';
|
|
12
12
|
|
|
13
13
|
export type PluginListProps = {
|
|
14
|
-
plugins?: PluginMeta[];
|
|
15
|
-
|
|
16
|
-
enabled?: string[];
|
|
14
|
+
plugins?: readonly PluginMeta[];
|
|
15
|
+
installed?: readonly string[];
|
|
16
|
+
enabled?: readonly string[];
|
|
17
17
|
onChange?: (id: string, enabled: boolean) => void;
|
|
18
18
|
onReload?: () => void;
|
|
19
19
|
};
|
|
20
20
|
|
|
21
|
-
export const PluginList = ({ plugins = [],
|
|
21
|
+
export const PluginList = ({ plugins = [], installed = [], enabled = [], onChange, onReload }: PluginListProps) => {
|
|
22
22
|
const { t } = useTranslation(REGISTRY_PLUGIN);
|
|
23
23
|
|
|
24
24
|
return (
|
|
25
25
|
<List classNames='mb-4 select-none'>
|
|
26
26
|
{plugins.map(({ id, name, description, homePage, source, icon = 'ph--circle--regular' }) => {
|
|
27
27
|
const isEnabled = enabled.includes(id);
|
|
28
|
-
const
|
|
29
|
-
const reloadRequired = isEnabled !==
|
|
28
|
+
const isInstalled = installed.includes(id);
|
|
29
|
+
const reloadRequired = isEnabled !== isInstalled;
|
|
30
30
|
const inputId = `${id}-input`;
|
|
31
31
|
const labelId = `${id}-label`;
|
|
32
32
|
const descriptionId = `${id}-description`;
|
|
@@ -4,43 +4,47 @@
|
|
|
4
4
|
|
|
5
5
|
import React, { useMemo, type PropsWithChildren } from 'react';
|
|
6
6
|
|
|
7
|
-
import { createIntent, type PluginMeta, useIntentDispatcher,
|
|
7
|
+
import { createIntent, type PluginMeta, useIntentDispatcher, usePluginManager } from '@dxos/app-framework';
|
|
8
8
|
import { ObservabilityAction } from '@dxos/plugin-observability/types';
|
|
9
9
|
import { Input, useTranslation } from '@dxos/react-ui';
|
|
10
10
|
import { DeprecatedFormInput } from '@dxos/react-ui-form';
|
|
11
11
|
|
|
12
12
|
import { PluginList } from './PluginList';
|
|
13
|
-
import { type RegistrySettingsProps } from '../RegistryPlugin';
|
|
14
13
|
import { REGISTRY_PLUGIN } from '../meta';
|
|
14
|
+
import { type RegistrySettings } from '../types';
|
|
15
15
|
|
|
16
16
|
const sortPluginMeta = ({ name: a = '' }: PluginMeta, { name: b = '' }: PluginMeta) => a.localeCompare(b);
|
|
17
17
|
|
|
18
|
-
export const PluginSettings = ({ settings }: { settings:
|
|
18
|
+
export const PluginSettings = ({ settings }: { settings: RegistrySettings }) => {
|
|
19
19
|
const { t } = useTranslation(REGISTRY_PLUGIN);
|
|
20
|
-
const
|
|
20
|
+
const manager = usePluginManager();
|
|
21
21
|
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
22
22
|
|
|
23
23
|
// Memoize to prevent plugins from disappearing when toggling enabled.
|
|
24
24
|
const installed = useMemo(
|
|
25
25
|
() =>
|
|
26
|
-
plugins
|
|
27
|
-
.filter(({ meta }) => !core.includes(meta.id))
|
|
28
|
-
.filter(({ meta }) => enabled.includes(meta.id))
|
|
26
|
+
manager.plugins
|
|
27
|
+
.filter(({ meta }) => !manager.core.includes(meta.id))
|
|
28
|
+
.filter(({ meta }) => manager.enabled.includes(meta.id))
|
|
29
29
|
.map(({ meta }) => meta)
|
|
30
30
|
.sort(sortPluginMeta),
|
|
31
31
|
[],
|
|
32
32
|
);
|
|
33
|
+
const pluginIds = useMemo(() => installed.map((meta) => meta.id), [installed]);
|
|
33
34
|
|
|
34
|
-
const pluginIds = plugins.map(({ meta }) => meta.id);
|
|
35
35
|
const available = useMemo(
|
|
36
|
-
() =>
|
|
36
|
+
() =>
|
|
37
|
+
manager.plugins
|
|
38
|
+
.map(({ meta }) => meta)
|
|
39
|
+
.filter(({ id }) => !manager.enabled.includes(id))
|
|
40
|
+
.sort(sortPluginMeta),
|
|
37
41
|
[],
|
|
38
42
|
);
|
|
39
43
|
const recommended = available.filter((meta) => !meta.tags?.includes('experimental'));
|
|
40
44
|
const experimental = available.filter((meta) => meta.tags?.includes('experimental'));
|
|
41
45
|
|
|
42
46
|
const handleChange = (id: string, enabled: boolean) => {
|
|
43
|
-
|
|
47
|
+
enabled ? manager.enable(id) : manager.disable(id);
|
|
44
48
|
void dispatch(
|
|
45
49
|
createIntent(ObservabilityAction.SendEvent, {
|
|
46
50
|
name: 'plugins.toggle',
|
|
@@ -66,8 +70,8 @@ export const PluginSettings = ({ settings }: { settings: RegistrySettingsProps }
|
|
|
66
70
|
<Section label={t('settings section installed label')}>
|
|
67
71
|
<PluginList
|
|
68
72
|
plugins={installed}
|
|
69
|
-
|
|
70
|
-
enabled={enabled}
|
|
73
|
+
installed={pluginIds}
|
|
74
|
+
enabled={manager.enabled}
|
|
71
75
|
onChange={handleChange}
|
|
72
76
|
onReload={handleReload}
|
|
73
77
|
/>
|
|
@@ -76,8 +80,8 @@ export const PluginSettings = ({ settings }: { settings: RegistrySettingsProps }
|
|
|
76
80
|
<Section label={t('settings section recommended label')}>
|
|
77
81
|
<PluginList
|
|
78
82
|
plugins={recommended}
|
|
79
|
-
|
|
80
|
-
enabled={enabled}
|
|
83
|
+
installed={pluginIds}
|
|
84
|
+
enabled={manager.enabled}
|
|
81
85
|
onChange={handleChange}
|
|
82
86
|
onReload={handleReload}
|
|
83
87
|
/>
|
|
@@ -87,8 +91,8 @@ export const PluginSettings = ({ settings }: { settings: RegistrySettingsProps }
|
|
|
87
91
|
<Section label={t('settings section experimental label')}>
|
|
88
92
|
<PluginList
|
|
89
93
|
plugins={experimental}
|
|
90
|
-
|
|
91
|
-
enabled={enabled}
|
|
94
|
+
installed={pluginIds}
|
|
95
|
+
enabled={manager.enabled}
|
|
92
96
|
onChange={handleChange}
|
|
93
97
|
onReload={handleReload}
|
|
94
98
|
/>
|
package/src/index.ts
CHANGED
package/src/meta.ts
CHANGED
package/src/types.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { S } from '@dxos/echo-schema';
|
|
6
|
+
|
|
7
|
+
export const RegistrySettingsSchema = S.mutable(
|
|
8
|
+
S.Struct({
|
|
9
|
+
experimental: S.optional(S.Boolean),
|
|
10
|
+
}),
|
|
11
|
+
);
|
|
12
|
+
|
|
13
|
+
export type RegistrySettings = S.Schema.Type<typeof RegistrySettingsSchema>;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/meta.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { type PluginMeta } from '@dxos/app-framework';\n\nexport const REGISTRY_PLUGIN = 'dxos.org/plugin/registry';\n\nexport default {\n id: REGISTRY_PLUGIN,\n name: 'Plugins',\n} satisfies PluginMeta;\n"],
|
|
5
|
-
"mappings": ";AAMO,IAAMA,kBAAkB;AAE/B,IAAA,eAAe;EACbC,IAAID;EACJE,MAAM;AACR;",
|
|
6
|
-
"names": ["REGISTRY_PLUGIN", "id", "name"]
|
|
7
|
-
}
|