@dxos/plugin-registry 0.7.5-main.9d2a38b → 0.7.5-main.c41020f
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/app-graph-builder-Z6FZXJWI.mjs +164 -0
- package/dist/lib/browser/app-graph-builder-Z6FZXJWI.mjs.map +7 -0
- package/dist/lib/browser/{chunk-CMDU7LPH.mjs → chunk-H6GNIIDK.mjs} +5 -1
- package/dist/lib/browser/chunk-H6GNIIDK.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +33 -12
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/intent-resolver-QW333HWJ.mjs +23 -0
- package/dist/lib/browser/intent-resolver-QW333HWJ.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/react-surface-6JN3QJEF.mjs +324 -0
- package/dist/lib/browser/react-surface-6JN3QJEF.mjs.map +7 -0
- package/dist/types/src/RegistryPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts +181 -0
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +179 -2
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/{settings.d.ts → intent-resolver.d.ts} +2 -2
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/components/PluginDetail.d.ts +8 -0
- package/dist/types/src/components/PluginDetail.d.ts.map +1 -0
- package/dist/types/src/components/PluginDetail.stories.d.ts +8 -0
- package/dist/types/src/components/PluginDetail.stories.d.ts.map +1 -0
- package/dist/types/src/components/PluginItem.d.ts +12 -0
- package/dist/types/src/components/PluginItem.d.ts.map +1 -0
- package/dist/types/src/components/PluginList.d.ts +5 -9
- package/dist/types/src/components/PluginList.d.ts.map +1 -1
- package/dist/types/src/components/PluginList.stories.d.ts +6 -1
- package/dist/types/src/components/PluginList.stories.d.ts.map +1 -1
- package/dist/types/src/components/RegistryContainer.d.ts +6 -0
- package/dist/types/src/components/RegistryContainer.d.ts.map +1 -0
- package/dist/types/src/components/index.d.ts +2 -1
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +2 -0
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +11 -0
- package/dist/types/src/translations.d.ts.map +1 -1
- package/package.json +17 -15
- package/src/RegistryPlugin.tsx +12 -7
- package/src/capabilities/app-graph-builder.ts +126 -0
- package/src/capabilities/index.ts +2 -1
- package/src/capabilities/intent-resolver.ts +27 -0
- package/src/capabilities/react-surface.tsx +76 -10
- package/src/components/PluginDetail.stories.tsx +45 -0
- package/src/components/PluginDetail.tsx +63 -0
- package/src/components/PluginItem.tsx +128 -0
- package/src/components/PluginList.stories.tsx +30 -21
- package/src/components/PluginList.tsx +13 -90
- package/src/components/RegistryContainer.tsx +81 -0
- package/src/components/index.ts +2 -1
- package/src/meta.ts +4 -0
- package/src/translations.ts +13 -2
- package/dist/lib/browser/chunk-CMDU7LPH.mjs.map +0 -7
- package/dist/lib/browser/react-surface-HKWZP7OW.mjs +0 -179
- package/dist/lib/browser/react-surface-HKWZP7OW.mjs.map +0 -7
- package/dist/lib/browser/settings-7LOHS2IV.mjs +0 -27
- package/dist/lib/browser/settings-7LOHS2IV.mjs.map +0 -7
- package/dist/types/src/capabilities/settings.d.ts.map +0 -1
- package/dist/types/src/components/PluginSettings.d.ts +0 -6
- package/dist/types/src/components/PluginSettings.d.ts.map +0 -1
- package/src/capabilities/settings.ts +0 -19
- package/src/components/PluginSettings.tsx +0 -112
|
@@ -1,179 +0,0 @@
|
|
|
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
|
|
@@ -1,7 +0,0 @@
|
|
|
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": ";;;;;;AAIA,OAAOA,YAAW;AAElB,SAASC,cAAcC,aAAaC,eAAeC,qBAAqB;;;ACFxE,OAAOC,SAASC,mBAAmB;AAGnC,SAASC,QAAQC,MAAMC,OAAOC,MAAMC,MAAMC,UAAUC,sBAAsB;AAC1E,SAASC,iBAAiBC,eAAeC,UAAU;AAY5C,IAAMC,aAAa,CAAC,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7D,gBAAAN,OAAA,cAACQ,SAAAA;IAAQN,OAAOtC,EAAE,kCAAA;KAChB,gBAAAoC,OAAA,cAACS,YAAAA;IACCnC,SAASF;IACTA,WAAWW;IACXH,SAASb,QAAQa;IACjB8B,UAAUtB;IACVuB,UAAUf;OAId,gBAAAI,OAAA,cAACQ,SAAAA;IAAQN,OAAOtC,EAAE,oCAAA;KAChB,gBAAAoC,OAAA,cAACS,YAAAA;IACCnC,SAASW;IACTb,WAAWW;IACXH,SAASb,QAAQa;IACjB8B,UAAUtB;IACVuB,UAAUf;OAIbjC,SAASwB,gBACR,gBAAAa,OAAA,cAACQ,SAAAA;IAAQN,OAAOtC,EAAE,qCAAA;KAChB,gBAAAoC,OAAA,cAACS,YAAAA;IACCnC,SAASa;IACTf,WAAWW;IACXH,SAASb,QAAQa;IACjB8B,UAAUtB;IACVuB,UAAUf;;AAMtB;AAEA,IAAMY,UAAU,CAAC,EAAEN,OAAOU,SAAQ,MAAwC;AACxE,SACE,gBAAAZ,OAAA,cAACa,OAAAA,MACC,gBAAAb,OAAA,cAACc,MAAAA;IAAGC,WAAU;KAA6Bb,KAAAA,GAC1CU,QAAAA;AAGP;;;AFnGA,IAAA,wBAAe,MACbI,YAAYC,aAAaC,cAAc;EACrCC,cAAc;IACZC,IAAIC,KAAKD;IACTE,MAAM;IACNC,QAAQ,CAACC,SAAsBA,KAAKC,YAAYC;IAChDC,WAAW,MAAA;AACT,YAAMC,WAAWC,cAAcZ,aAAaa,aAAa,EAAEC,SAA2BL,eAAAA,EAAkBM;AACxG,aAAO,gBAAAC,OAAA,cAACC,gBAAAA;QAAeN;;IACzB;EACF,CAAA;CACD;",
|
|
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
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
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
|
|
@@ -1,7 +0,0 @@
|
|
|
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 +0,0 @@
|
|
|
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 +0,0 @@
|
|
|
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,19 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2023 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import React, { useMemo, type PropsWithChildren } from 'react';
|
|
6
|
-
|
|
7
|
-
import { createIntent, type PluginMeta, useIntentDispatcher, usePluginManager } from '@dxos/app-framework';
|
|
8
|
-
import { ObservabilityAction } from '@dxos/plugin-observability/types';
|
|
9
|
-
import { Input, useTranslation } from '@dxos/react-ui';
|
|
10
|
-
import { DeprecatedFormInput } from '@dxos/react-ui-form';
|
|
11
|
-
|
|
12
|
-
import { PluginList } from './PluginList';
|
|
13
|
-
import { REGISTRY_PLUGIN } from '../meta';
|
|
14
|
-
import { type RegistrySettings } from '../types';
|
|
15
|
-
|
|
16
|
-
const sortPluginMeta = ({ name: a = '' }: PluginMeta, { name: b = '' }: PluginMeta) => a.localeCompare(b);
|
|
17
|
-
|
|
18
|
-
export const PluginSettings = ({ settings }: { settings: RegistrySettings }) => {
|
|
19
|
-
const { t } = useTranslation(REGISTRY_PLUGIN);
|
|
20
|
-
const manager = usePluginManager();
|
|
21
|
-
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
22
|
-
|
|
23
|
-
// Memoize to prevent plugins from disappearing when toggling enabled.
|
|
24
|
-
const installed = useMemo(
|
|
25
|
-
() =>
|
|
26
|
-
manager.plugins
|
|
27
|
-
.filter(({ meta }) => !manager.core.includes(meta.id))
|
|
28
|
-
.filter(({ meta }) => manager.enabled.includes(meta.id))
|
|
29
|
-
.map(({ meta }) => meta)
|
|
30
|
-
.sort(sortPluginMeta),
|
|
31
|
-
[],
|
|
32
|
-
);
|
|
33
|
-
const pluginIds = useMemo(() => installed.map((meta) => meta.id), [installed]);
|
|
34
|
-
|
|
35
|
-
const available = useMemo(
|
|
36
|
-
() =>
|
|
37
|
-
manager.plugins
|
|
38
|
-
.map(({ meta }) => meta)
|
|
39
|
-
.filter(({ id }) => !manager.enabled.includes(id))
|
|
40
|
-
.sort(sortPluginMeta),
|
|
41
|
-
[],
|
|
42
|
-
);
|
|
43
|
-
const recommended = available.filter((meta) => !meta.tags?.includes('experimental'));
|
|
44
|
-
const experimental = available.filter((meta) => meta.tags?.includes('experimental'));
|
|
45
|
-
|
|
46
|
-
const handleChange = (id: string, enabled: boolean) => {
|
|
47
|
-
enabled ? manager.enable(id) : manager.disable(id);
|
|
48
|
-
void dispatch(
|
|
49
|
-
createIntent(ObservabilityAction.SendEvent, {
|
|
50
|
-
name: 'plugins.toggle',
|
|
51
|
-
properties: { plugin: id, enabled },
|
|
52
|
-
}),
|
|
53
|
-
);
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
const handleReload = () => {
|
|
57
|
-
window.location.reload();
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
return (
|
|
61
|
-
<>
|
|
62
|
-
<DeprecatedFormInput label={t('settings show experimental label')}>
|
|
63
|
-
<Input.Switch
|
|
64
|
-
data-testid='pluginSettings.experimental'
|
|
65
|
-
checked={settings.experimental}
|
|
66
|
-
onCheckedChange={(checked) => (settings.experimental = !!checked)}
|
|
67
|
-
/>
|
|
68
|
-
</DeprecatedFormInput>
|
|
69
|
-
|
|
70
|
-
<Section label={t('settings section installed label')}>
|
|
71
|
-
<PluginList
|
|
72
|
-
plugins={installed}
|
|
73
|
-
installed={pluginIds}
|
|
74
|
-
enabled={manager.enabled}
|
|
75
|
-
onChange={handleChange}
|
|
76
|
-
onReload={handleReload}
|
|
77
|
-
/>
|
|
78
|
-
</Section>
|
|
79
|
-
|
|
80
|
-
<Section label={t('settings section recommended label')}>
|
|
81
|
-
<PluginList
|
|
82
|
-
plugins={recommended}
|
|
83
|
-
installed={pluginIds}
|
|
84
|
-
enabled={manager.enabled}
|
|
85
|
-
onChange={handleChange}
|
|
86
|
-
onReload={handleReload}
|
|
87
|
-
/>
|
|
88
|
-
</Section>
|
|
89
|
-
|
|
90
|
-
{settings.experimental && (
|
|
91
|
-
<Section label={t('settings section experimental label')}>
|
|
92
|
-
<PluginList
|
|
93
|
-
plugins={experimental}
|
|
94
|
-
installed={pluginIds}
|
|
95
|
-
enabled={manager.enabled}
|
|
96
|
-
onChange={handleChange}
|
|
97
|
-
onReload={handleReload}
|
|
98
|
-
/>
|
|
99
|
-
</Section>
|
|
100
|
-
)}
|
|
101
|
-
</>
|
|
102
|
-
);
|
|
103
|
-
};
|
|
104
|
-
|
|
105
|
-
const Section = ({ label, children }: PropsWithChildren<{ label: string }>) => {
|
|
106
|
-
return (
|
|
107
|
-
<div>
|
|
108
|
-
<h2 className='py-2 text-sm text-subdued'>{label}</h2>
|
|
109
|
-
{children}
|
|
110
|
-
</div>
|
|
111
|
-
);
|
|
112
|
-
};
|