@dxos/plugin-registry 0.6.13-main.548ca8d → 0.6.13-staging.1e988a3
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-2FC6QNHB.mjs} +1 -1
- package/dist/lib/browser/chunk-2FC6QNHB.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +22 -19
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/meta.mjs +1 -1
- package/dist/types/src/components/PluginList.d.ts +2 -2
- package/dist/types/src/components/PluginList.d.ts.map +1 -1
- package/dist/types/src/components/PluginList.stories.d.ts.map +1 -1
- package/dist/types/src/components/PluginSettings.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/sanity.test.d.ts +2 -0
- package/dist/types/src/sanity.test.d.ts.map +1 -0
- package/package.json +17 -17
- package/src/components/PluginList.stories.tsx +5 -11
- package/src/components/PluginList.tsx +29 -8
- package/src/components/PluginSettings.tsx +8 -9
- package/src/meta.ts +1 -3
- package/src/sanity.test.ts +13 -0
- package/dist/lib/browser/chunk-NEMFDAOB.mjs.map +0 -7
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/meta.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nexport const REGISTRY_PLUGIN = 'dxos.org/plugin/registry';\n\nexport default {\n id: REGISTRY_PLUGIN,\n name: 'Plugins',\n};\n"],
|
|
5
|
+
"mappings": ";AAIO,IAAMA,kBAAkB;AAE/B,IAAA,eAAe;EACbC,IAAID;EACJE,MAAM;AACR;",
|
|
6
|
+
"names": ["REGISTRY_PLUGIN", "id", "name"]
|
|
7
|
+
}
|
|
@@ -1,23 +1,31 @@
|
|
|
1
1
|
import {
|
|
2
2
|
REGISTRY_PLUGIN,
|
|
3
3
|
meta_default
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-2FC6QNHB.mjs";
|
|
5
5
|
|
|
6
6
|
// packages/plugins/plugin-registry/src/RegistryPlugin.tsx
|
|
7
7
|
import React3 from "react";
|
|
8
8
|
import { LocalStorageStore } from "@dxos/local-storage";
|
|
9
9
|
|
|
10
10
|
// packages/plugins/plugin-registry/src/components/PluginList.tsx
|
|
11
|
+
import { ArrowClockwise, Circle } from "@phosphor-icons/react";
|
|
11
12
|
import React from "react";
|
|
12
|
-
import {
|
|
13
|
-
|
|
13
|
+
import {
|
|
14
|
+
Button,
|
|
15
|
+
DensityProvider,
|
|
16
|
+
Input,
|
|
17
|
+
List,
|
|
18
|
+
ListItem,
|
|
19
|
+
useTranslation
|
|
20
|
+
} from "@dxos/react-ui";
|
|
21
|
+
import { descriptionText, fineBlockSize, getSize, ghostHover, mx } from "@dxos/react-ui-theme";
|
|
14
22
|
var PluginList = ({ plugins = [], loaded = [], enabled = [], onChange, onReload }) => {
|
|
15
23
|
const { t } = useTranslation(REGISTRY_PLUGIN);
|
|
16
24
|
return /* @__PURE__ */ React.createElement(DensityProvider, {
|
|
17
25
|
density: "fine"
|
|
18
26
|
}, /* @__PURE__ */ React.createElement(List, {
|
|
19
27
|
classNames: "mb-4 select-none"
|
|
20
|
-
}, plugins.map(({ id, name, description, homePage,
|
|
28
|
+
}, plugins.map(({ id, name, description, homePage, iconComponent: Icon = Circle }) => {
|
|
21
29
|
const isEnabled = enabled.includes(id);
|
|
22
30
|
const isLoaded = loaded.includes(id);
|
|
23
31
|
const reloadRequired = isEnabled !== isLoaded;
|
|
@@ -36,9 +44,8 @@ var PluginList = ({ plugins = [], loaded = [], enabled = [], onChange, onReload
|
|
|
36
44
|
ghostHover
|
|
37
45
|
]
|
|
38
46
|
}, /* @__PURE__ */ React.createElement(Icon, {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
classNames: "shrink-0 mbs-1"
|
|
47
|
+
weight: "duotone",
|
|
48
|
+
className: mx("shrink-0 mbs-1", getSize(6))
|
|
42
49
|
}), /* @__PURE__ */ React.createElement("div", {
|
|
43
50
|
role: "none",
|
|
44
51
|
className: mx(fineBlockSize, "grow pbs-1 pl-1")
|
|
@@ -55,16 +62,13 @@ var PluginList = ({ plugins = [], loaded = [], enabled = [], onChange, onReload
|
|
|
55
62
|
variant: "ghost",
|
|
56
63
|
classNames: "p-0 gap-2",
|
|
57
64
|
onClick: onReload
|
|
58
|
-
}, /* @__PURE__ */ React.createElement(
|
|
59
|
-
size: 4,
|
|
60
|
-
icon: "ph--arrow-clockwise--regular"
|
|
61
|
-
}), /* @__PURE__ */ React.createElement("p", {
|
|
65
|
+
}, /* @__PURE__ */ React.createElement(ArrowClockwise, null), /* @__PURE__ */ React.createElement("p", {
|
|
62
66
|
className: "text-sm font-medium"
|
|
63
67
|
}, t("reload required message"))))), /* @__PURE__ */ React.createElement("div", {
|
|
64
68
|
className: "pbs-1"
|
|
65
69
|
}, /* @__PURE__ */ React.createElement(Input.Switch, {
|
|
66
70
|
classNames: "self-center",
|
|
67
|
-
checked: isEnabled,
|
|
71
|
+
checked: !!isEnabled,
|
|
68
72
|
onClick: () => onChange?.(id, !isEnabled)
|
|
69
73
|
}))));
|
|
70
74
|
})));
|
|
@@ -76,13 +80,12 @@ import { useIntentDispatcher, usePlugins } from "@dxos/app-framework";
|
|
|
76
80
|
import { ObservabilityAction } from "@dxos/plugin-observability/meta";
|
|
77
81
|
import { SettingsValue } from "@dxos/plugin-settings";
|
|
78
82
|
import { Input as Input2, useTranslation as useTranslation2 } from "@dxos/react-ui";
|
|
79
|
-
var sort = ({ name: a = "" }, { name: b = "" }) => a.localeCompare(b);
|
|
80
83
|
var PluginSettings = ({ settings }) => {
|
|
81
84
|
const { t } = useTranslation2(REGISTRY_PLUGIN);
|
|
82
|
-
const {
|
|
85
|
+
const { enabled, core, plugins, setPlugin, ...pluginContext } = usePlugins();
|
|
83
86
|
const dispatch = useIntentDispatcher();
|
|
87
|
+
const sort = (a, b) => a.name?.localeCompare(b.name ?? "") ?? 0;
|
|
84
88
|
const installed = useMemo(() => plugins.filter(({ meta }) => !core.includes(meta.id)).filter(({ meta }) => enabled.includes(meta.id)).map(({ meta }) => meta).sort(sort), []);
|
|
85
|
-
const pluginIds = plugins.map(({ meta }) => meta.id);
|
|
86
89
|
const available = useMemo(() => pluginContext.available.filter(({ id }) => !enabled.includes(id)).sort(sort), []);
|
|
87
90
|
const recommended = available.filter((meta) => !meta.tags?.includes("experimental"));
|
|
88
91
|
const experimental = available.filter((meta) => meta.tags?.includes("experimental"));
|
|
@@ -112,7 +115,7 @@ var PluginSettings = ({ settings }) => {
|
|
|
112
115
|
label: t("settings section installed label")
|
|
113
116
|
}, /* @__PURE__ */ React2.createElement(PluginList, {
|
|
114
117
|
plugins: installed,
|
|
115
|
-
loaded:
|
|
118
|
+
loaded: plugins.map(({ meta }) => meta.id),
|
|
116
119
|
enabled,
|
|
117
120
|
onChange: handleChange,
|
|
118
121
|
onReload: handleReload
|
|
@@ -120,7 +123,7 @@ var PluginSettings = ({ settings }) => {
|
|
|
120
123
|
label: t("settings section recommended label")
|
|
121
124
|
}, /* @__PURE__ */ React2.createElement(PluginList, {
|
|
122
125
|
plugins: recommended,
|
|
123
|
-
loaded:
|
|
126
|
+
loaded: plugins.map(({ meta }) => meta.id),
|
|
124
127
|
enabled,
|
|
125
128
|
onChange: handleChange,
|
|
126
129
|
onReload: handleReload
|
|
@@ -128,7 +131,7 @@ var PluginSettings = ({ settings }) => {
|
|
|
128
131
|
label: t("settings section experimental label")
|
|
129
132
|
}, /* @__PURE__ */ React2.createElement(PluginList, {
|
|
130
133
|
plugins: experimental,
|
|
131
|
-
loaded:
|
|
134
|
+
loaded: plugins.map(({ meta }) => meta.id),
|
|
132
135
|
enabled,
|
|
133
136
|
onChange: handleChange,
|
|
134
137
|
onReload: handleReload
|
|
@@ -136,7 +139,7 @@ var PluginSettings = ({ settings }) => {
|
|
|
136
139
|
};
|
|
137
140
|
var Section = ({ label, children }) => {
|
|
138
141
|
return /* @__PURE__ */ React2.createElement("div", null, /* @__PURE__ */ React2.createElement("h2", {
|
|
139
|
-
className: "py-2 text-sm text-
|
|
142
|
+
className: "py-2 text-sm text-neutral-500"
|
|
140
143
|
}, label), children);
|
|
141
144
|
};
|
|
142
145
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/RegistryPlugin.tsx", "../../../src/components/PluginList.tsx", "../../../src/components/PluginSettings.tsx", "../../../src/translations.ts", "../../../src/index.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport React from 'react';\n\nimport type { PluginDefinition, SettingsProvides, SurfaceProvides, TranslationsProvides } from '@dxos/app-framework';\nimport { LocalStorageStore } from '@dxos/local-storage';\n\nimport { PluginSettings } from './components';\nimport meta, { REGISTRY_PLUGIN } from './meta';\nimport translations from './translations';\n\nexport type RegistrySettingsProps = {\n experimental?: boolean;\n};\n\nexport type RegistryPluginProvides = SurfaceProvides & TranslationsProvides & SettingsProvides<RegistrySettingsProps>;\n\nexport const RegistryPlugin = (): PluginDefinition<RegistryPluginProvides> => {\n const settings = new LocalStorageStore<RegistrySettingsProps>(REGISTRY_PLUGIN);\n\n return {\n meta,\n ready: async () => {\n settings.prop({ key: 'experimental', type: LocalStorageStore.bool({ allowUndefined: true }) });\n },\n provides: {\n settings: settings.values,\n translations,\n surface: {\n component: ({ data, role }) => {\n switch (role) {\n case 'settings':\n return data.plugin === meta.id ? <PluginSettings settings={settings.values} /> : null;\n }\n\n return null;\n },\n },\n },\n };\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport React from 'react';\n\nimport {
|
|
5
|
-
"mappings": ";;;;;;AAIA,OAAOA,YAAW;AAGlB,SAASC,yBAAyB;;;ACHlC,
|
|
6
|
-
"names": ["React", "LocalStorageStore", "
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport React from 'react';\n\nimport type { PluginDefinition, SettingsProvides, SurfaceProvides, TranslationsProvides } from '@dxos/app-framework';\nimport { LocalStorageStore } from '@dxos/local-storage';\n\nimport { PluginSettings } from './components';\nimport meta, { REGISTRY_PLUGIN } from './meta';\nimport translations from './translations';\n\nexport type RegistrySettingsProps = {\n experimental?: boolean;\n};\n\nexport type RegistryPluginProvides = SurfaceProvides & TranslationsProvides & SettingsProvides<RegistrySettingsProps>;\n\nexport const RegistryPlugin = (): PluginDefinition<RegistryPluginProvides> => {\n const settings = new LocalStorageStore<RegistrySettingsProps>(REGISTRY_PLUGIN);\n\n return {\n meta,\n ready: async () => {\n settings.prop({ key: 'experimental', type: LocalStorageStore.bool({ allowUndefined: true }) });\n },\n provides: {\n settings: settings.values,\n translations,\n surface: {\n component: ({ data, role }) => {\n switch (role) {\n case 'settings':\n return data.plugin === meta.id ? <PluginSettings settings={settings.values} /> : null;\n }\n\n return null;\n },\n },\n },\n };\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { ArrowClockwise, Circle } from '@phosphor-icons/react';\nimport React from 'react';\n\nimport type { Plugin } from '@dxos/app-framework';\nimport {\n Button,\n // type ChromaticPalette,\n // type NeutralPalette,\n DensityProvider,\n Input,\n List,\n ListItem,\n useTranslation,\n // Link,\n} from '@dxos/react-ui';\nimport { descriptionText, fineBlockSize, getSize, ghostHover, mx } from '@dxos/react-ui-theme';\n\nimport { REGISTRY_PLUGIN } from '../meta';\n\n// TODO(burdon): Reconcile with theme.\n// const palette: { [tag: string]: ChromaticPalette | NeutralPalette } = {\n// default: 'neutral',\n// new: 'green',\n// beta: 'cyan',\n// alpha: 'purple',\n// experimental: 'indigo',\n// 新発売: 'red',\n// };\n\nexport type PluginListProps = {\n plugins?: Plugin['meta'][];\n loaded?: string[];\n enabled?: string[];\n onChange?: (id: string, enabled: boolean) => void;\n onReload?: () => void;\n};\n\nexport const PluginList = ({ plugins = [], loaded = [], enabled = [], onChange, onReload }: PluginListProps) => {\n const { t } = useTranslation(REGISTRY_PLUGIN);\n\n return (\n <DensityProvider density='fine'>\n <List classNames='mb-4 select-none'>\n {plugins.map(({ id, name, description, homePage, iconComponent: Icon = Circle }) => {\n const isEnabled = enabled.includes(id);\n const isLoaded = loaded.includes(id);\n const reloadRequired = isEnabled !== isLoaded;\n const inputId = `${id}-input`;\n const labelId = `${id}-label`;\n const descriptionId = `${id}-description`;\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 cursor-pointer plb-2 pli-2 -mli-2 rounded', ghostHover]}\n >\n <Icon weight='duotone' className={mx('shrink-0 mbs-1', getSize(6))} />\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) && (\n <div id={descriptionId} className='space-b-1 pbs-1 pbe-1'>\n <p className={descriptionText}>{description}</p>\n {/* TODO(wittjosiah): Include once plugin docs are available. */}\n {/* {homePage && (\n <Link\n href={homePage}\n target='_blank'\n rel='noreferrer'\n aria-describedby={descriptionId}\n classNames='text-xs'\n >\n {t('home page label')}\n <ArrowSquareOut weight='bold' className={mx(getSize(3), 'inline-block leading-none mli-1')} />\n </Link>\n )} */}\n {reloadRequired && (\n <Button variant='ghost' classNames='p-0 gap-2' onClick={onReload}>\n <ArrowClockwise />\n <p className='text-sm font-medium'>{t('reload required message')}</p>\n </Button>\n )}\n </div>\n )}\n </div>\n <div className='pbs-1'>\n <Input.Switch\n classNames='self-center'\n checked={!!isEnabled}\n onClick={() => onChange?.(id, !isEnabled)}\n />\n </div>\n </ListItem.Root>\n </Input.Root>\n );\n })}\n </List>\n </DensityProvider>\n );\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport React, { useMemo, type PropsWithChildren } from 'react';\n\nimport { type Plugin, useIntentDispatcher, usePlugins } from '@dxos/app-framework';\nimport { ObservabilityAction } from '@dxos/plugin-observability/meta';\nimport { SettingsValue } from '@dxos/plugin-settings';\nimport { Input, useTranslation } from '@dxos/react-ui';\n\nimport { PluginList } from './PluginList';\nimport { type RegistrySettingsProps } from '../RegistryPlugin';\nimport { REGISTRY_PLUGIN } from '../meta';\n\nexport const PluginSettings = ({ settings }: { settings: RegistrySettingsProps }) => {\n const { t } = useTranslation(REGISTRY_PLUGIN);\n const { enabled, core, plugins, setPlugin, ...pluginContext } = usePlugins();\n const dispatch = useIntentDispatcher();\n\n const sort = (a: Plugin['meta'], b: Plugin['meta']) => a.name?.localeCompare(b.name ?? '') ?? 0;\n\n // Memoize to prevent plugins from disappearing when toggling enabled.\n const installed = useMemo(\n () =>\n plugins\n .filter(({ meta }) => !core.includes(meta.id))\n .filter(({ meta }) => enabled.includes(meta.id))\n .map(({ meta }) => meta)\n .sort(sort),\n [],\n );\n\n const available = useMemo(() => pluginContext.available.filter(({ id }) => !enabled.includes(id)).sort(sort), []);\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 setPlugin(id, enabled);\n void dispatch({\n action: ObservabilityAction.SEND_EVENT,\n data: {\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 <SettingsValue 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 </SettingsValue>\n\n <Section label={t('settings section installed label')}>\n <PluginList\n plugins={installed}\n loaded={plugins.map(({ meta }) => meta.id)}\n enabled={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 loaded={plugins.map(({ meta }) => meta.id)}\n enabled={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 loaded={plugins.map(({ meta }) => meta.id)}\n enabled={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-neutral-500'>{label}</h2>\n {children}\n </div>\n );\n};\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 },\n },\n },\n];\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { RegistryPlugin } from './RegistryPlugin';\n\nexport default RegistryPlugin;\n\nexport * from './RegistryPlugin';\n"],
|
|
5
|
+
"mappings": ";;;;;;AAIA,OAAOA,YAAW;AAGlB,SAASC,yBAAyB;;;ACHlC,SAASC,gBAAgBC,cAAc;AACvC,OAAOC,WAAW;AAGlB;EACEC;EAGAC;EACAC;EACAC;EACAC;EACAC;OAEK;AACP,SAASC,iBAAiBC,eAAeC,SAASC,YAAYC,UAAU;AAsBjE,IAAMC,aAAa,CAAC,EAAEC,UAAU,CAAA,GAAIC,SAAS,CAAA,GAAIC,UAAU,CAAA,GAAIC,UAAUC,SAAQ,MAAmB;AACzG,QAAM,EAAEC,EAAC,IAAKC,eAAeC,eAAAA;AAE7B,SACE,sBAAA,cAACC,iBAAAA;IAAgBC,SAAQ;KACvB,sBAAA,cAACC,MAAAA;IAAKC,YAAW;KACdX,QAAQY,IAAI,CAAC,EAAEC,IAAIC,MAAMC,aAAaC,UAAUC,eAAeC,OAAO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B;QACjB,eAAe;QACf,2BAA2B;QAC3B,oCAAoC;QACpC,oCAAoC;QACpC,sCAAsC;QACtC,uCAAuC;QACvC,mBAAmB;MACrB;IACF;EACF;;;;AHAK,IAAMC,iBAAiB,MAAA;AAC5B,QAAMC,WAAW,IAAIC,kBAAyCC,eAAAA;AAE9D,SAAO;IACLC;IACAC,OAAO,YAAA;AACLJ,eAASK,KAAK;QAAEC,KAAK;QAAgBC,MAAMN,kBAAkBO,KAAK;UAAEC,gBAAgB;QAAK,CAAA;MAAG,CAAA;IAC9F;IACAC,UAAU;MACRV,UAAUA,SAASW;MACnBC;MACAC,SAAS;QACPC,WAAW,CAAC,EAAEC,MAAMC,KAAI,MAAE;AACxB,kBAAQA,MAAAA;YACN,KAAK;AACH,qBAAOD,KAAKE,WAAWd,aAAKe,KAAK,gBAAAC,OAAA,cAACC,gBAAAA;gBAAepB,UAAUA,SAASW;mBAAa;UACrF;AAEA,iBAAO;QACT;MACF;IACF;EACF;AACF;;;AIpCA,IAAA,cAAeU;",
|
|
6
|
+
"names": ["React", "LocalStorageStore", "ArrowClockwise", "Circle", "React", "Button", "DensityProvider", "Input", "List", "ListItem", "useTranslation", "descriptionText", "fineBlockSize", "getSize", "ghostHover", "mx", "PluginList", "plugins", "loaded", "enabled", "onChange", "onReload", "t", "useTranslation", "REGISTRY_PLUGIN", "DensityProvider", "density", "List", "classNames", "map", "id", "name", "description", "homePage", "iconComponent", "Icon", "Circle", "isEnabled", "includes", "isLoaded", "reloadRequired", "inputId", "labelId", "descriptionId", "Input", "Root", "key", "ListItem", "data-testid", "aria-describedby", "ghostHover", "weight", "className", "mx", "getSize", "div", "role", "fineBlockSize", "label", "htmlFor", "p", "descriptionText", "Button", "variant", "onClick", "ArrowClockwise", "Switch", "checked", "React", "useMemo", "useIntentDispatcher", "usePlugins", "ObservabilityAction", "SettingsValue", "Input", "useTranslation", "PluginSettings", "settings", "t", "useTranslation", "REGISTRY_PLUGIN", "enabled", "core", "plugins", "setPlugin", "pluginContext", "usePlugins", "dispatch", "useIntentDispatcher", "sort", "a", "b", "name", "localeCompare", "installed", "useMemo", "filter", "meta", "includes", "id", "map", "available", "recommended", "tags", "experimental", "handleChange", "action", "ObservabilityAction", "SEND_EVENT", "data", "properties", "plugin", "handleReload", "window", "location", "reload", "React", "SettingsValue", "label", "Input", "Switch", "data-testid", "checked", "onCheckedChange", "Section", "PluginList", "loaded", "onChange", "onReload", "children", "div", "h2", "className", "REGISTRY_PLUGIN", "RegistryPlugin", "settings", "LocalStorageStore", "REGISTRY_PLUGIN", "meta", "ready", "prop", "key", "type", "bool", "allowUndefined", "provides", "values", "translations", "surface", "component", "data", "role", "plugin", "id", "React", "PluginSettings", "RegistryPlugin"]
|
|
7
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs":{"packages/plugins/plugin-registry/src/meta.ts":{"bytes":
|
|
1
|
+
{"inputs":{"packages/plugins/plugin-registry/src/meta.ts":{"bytes":851,"imports":[],"format":"esm"},"packages/plugins/plugin-registry/src/components/PluginList.tsx":{"bytes":11469,"imports":[{"path":"@phosphor-icons/react","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":"packages/plugins/plugin-registry/src/meta.ts","kind":"import-statement","original":"../meta"}],"format":"esm"},"packages/plugins/plugin-registry/src/components/PluginSettings.tsx":{"bytes":11868,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/plugin-observability/meta","kind":"import-statement","external":true},{"path":"@dxos/plugin-settings","kind":"import-statement","external":true},{"path":"@dxos/react-ui","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/translations.ts":{"bytes":2036,"imports":[{"path":"packages/plugins/plugin-registry/src/meta.ts","kind":"import-statement","original":"./meta"}],"format":"esm"},"packages/plugins/plugin-registry/src/RegistryPlugin.tsx":{"bytes":4337,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/local-storage","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"},{"path":"packages/plugins/plugin-registry/src/translations.ts","kind":"import-statement","original":"./translations"}],"format":"esm"},"packages/plugins/plugin-registry/src/index.ts":{"bytes":804,"imports":[{"path":"packages/plugins/plugin-registry/src/RegistryPlugin.tsx","kind":"import-statement","original":"./RegistryPlugin"},{"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":15802},"packages/plugins/plugin-registry/dist/lib/browser/index.mjs":{"imports":[{"path":"packages/plugins/plugin-registry/dist/lib/browser/chunk-2FC6QNHB.mjs","kind":"import-statement"},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/local-storage","kind":"import-statement","external":true},{"path":"@phosphor-icons/react","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/meta","kind":"import-statement","external":true},{"path":"@dxos/plugin-settings","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true}],"exports":["RegistryPlugin","default"],"entryPoint":"packages/plugins/plugin-registry/src/index.ts","inputs":{"packages/plugins/plugin-registry/src/RegistryPlugin.tsx":{"bytesInOutput":830},"packages/plugins/plugin-registry/src/components/PluginList.tsx":{"bytesInOutput":2559},"packages/plugins/plugin-registry/src/components/index.ts":{"bytesInOutput":0},"packages/plugins/plugin-registry/src/components/PluginSettings.tsx":{"bytesInOutput":2976},"packages/plugins/plugin-registry/src/translations.ts":{"bytesInOutput":479},"packages/plugins/plugin-registry/src/index.ts":{"bytesInOutput":34}},"bytes":7407},"packages/plugins/plugin-registry/dist/lib/browser/meta.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"packages/plugins/plugin-registry/dist/lib/browser/meta.mjs":{"imports":[{"path":"packages/plugins/plugin-registry/dist/lib/browser/chunk-2FC6QNHB.mjs","kind":"import-statement"}],"exports":["REGISTRY_PLUGIN","default"],"entryPoint":"packages/plugins/plugin-registry/src/meta.ts","inputs":{},"bytes":165},"packages/plugins/plugin-registry/dist/lib/browser/chunk-2FC6QNHB.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":377},"packages/plugins/plugin-registry/dist/lib/browser/chunk-2FC6QNHB.mjs":{"imports":[],"exports":["REGISTRY_PLUGIN","meta_default"],"inputs":{"packages/plugins/plugin-registry/src/meta.ts":{"bytesInOutput":115}},"bytes":254}}}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import type { Plugin } from '@dxos/app-framework';
|
|
3
3
|
export type PluginListProps = {
|
|
4
|
-
plugins?:
|
|
4
|
+
plugins?: Plugin['meta'][];
|
|
5
5
|
loaded?: string[];
|
|
6
6
|
enabled?: string[];
|
|
7
7
|
onChange?: (id: string, enabled: boolean) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PluginList.d.ts","sourceRoot":"","sources":["../../../../src/components/PluginList.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"PluginList.d.ts","sourceRoot":"","sources":["../../../../src/components/PluginList.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AA0BlD,MAAM,MAAM,eAAe,GAAG;IAC5B,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC;IAC3B,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,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,qDAAqE,eAAe,sBAkE1G,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PluginList.stories.d.ts","sourceRoot":"","sources":["../../../../src/components/PluginList.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"PluginList.stories.d.ts","sourceRoot":"","sources":["../../../../src/components/PluginList.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,aAAa,CAAC;AAGrB,OAAO,KAAmB,MAAM,OAAO,CAAC;;;;;;;;;;AAwCxC,wBAQE;AAEF,eAAO,MAAM,OAAO,IAAK,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PluginSettings.d.ts","sourceRoot":"","sources":["../../../../src/components/PluginSettings.tsx"],"names":[],"mappings":"AAIA,OAAO,KAA0C,MAAM,OAAO,CAAC;AAQ/D,OAAO,EAAE,KAAK,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"PluginSettings.d.ts","sourceRoot":"","sources":["../../../../src/components/PluginSettings.tsx"],"names":[],"mappings":"AAIA,OAAO,KAA0C,MAAM,OAAO,CAAC;AAQ/D,OAAO,EAAE,KAAK,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAG/D,eAAO,MAAM,cAAc,iBAAkB;IAAE,QAAQ,EAAE,qBAAqB,CAAA;CAAE,sBAgF/E,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"meta.d.ts","sourceRoot":"","sources":["../../../src/meta.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"meta.d.ts","sourceRoot":"","sources":["../../../src/meta.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,eAAe,6BAA6B,CAAC;;;;;AAE1D,wBAGE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sanity.test.d.ts","sourceRoot":"","sources":["../../../src/sanity.test.ts"],"names":[],"mappings":""}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/plugin-registry",
|
|
3
|
-
"version": "0.6.13-
|
|
3
|
+
"version": "0.6.13-staging.1e988a3",
|
|
4
4
|
"description": "Braneframe plugin gallery",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -29,11 +29,11 @@
|
|
|
29
29
|
"src"
|
|
30
30
|
],
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@dxos/
|
|
33
|
-
"@dxos/plugin-
|
|
34
|
-
"@dxos/
|
|
35
|
-
"@dxos/
|
|
36
|
-
"@dxos/util": "0.6.13-
|
|
32
|
+
"@dxos/local-storage": "0.6.13-staging.1e988a3",
|
|
33
|
+
"@dxos/plugin-observability": "0.6.13-staging.1e988a3",
|
|
34
|
+
"@dxos/plugin-settings": "0.6.13-staging.1e988a3",
|
|
35
|
+
"@dxos/app-framework": "0.6.13-staging.1e988a3",
|
|
36
|
+
"@dxos/util": "0.6.13-staging.1e988a3"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"@phosphor-icons/react": "^2.1.5",
|
|
@@ -41,20 +41,20 @@
|
|
|
41
41
|
"@types/react-dom": "~18.2.0",
|
|
42
42
|
"react": "~18.2.0",
|
|
43
43
|
"react-dom": "~18.2.0",
|
|
44
|
-
"vite": "5.4
|
|
45
|
-
"@dxos/random": "0.6.13-
|
|
46
|
-
"@dxos/react-ui
|
|
47
|
-
"@dxos/react-ui-
|
|
48
|
-
"@dxos/
|
|
49
|
-
"@dxos/
|
|
44
|
+
"vite": "^5.3.4",
|
|
45
|
+
"@dxos/random": "0.6.13-staging.1e988a3",
|
|
46
|
+
"@dxos/react-ui": "0.6.13-staging.1e988a3",
|
|
47
|
+
"@dxos/react-ui-mosaic": "0.6.13-staging.1e988a3",
|
|
48
|
+
"@dxos/storybook-utils": "0.6.13-staging.1e988a3",
|
|
49
|
+
"@dxos/react-ui-theme": "0.6.13-staging.1e988a3"
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {
|
|
52
52
|
"@phosphor-icons/react": "^2.1.5",
|
|
53
|
-
"react": "
|
|
54
|
-
"react-dom": "
|
|
55
|
-
"@dxos/react-ui": "0.6.13-
|
|
56
|
-
"@dxos/react-ui-
|
|
57
|
-
"@dxos/react-ui-
|
|
53
|
+
"react": "^18.0.0",
|
|
54
|
+
"react-dom": "^18.0.0",
|
|
55
|
+
"@dxos/react-ui": "0.6.13-staging.1e988a3",
|
|
56
|
+
"@dxos/react-ui-mosaic": "0.6.13-staging.1e988a3",
|
|
57
|
+
"@dxos/react-ui-theme": "0.6.13-staging.1e988a3"
|
|
58
58
|
},
|
|
59
59
|
"publishConfig": {
|
|
60
60
|
"access": "public"
|
|
@@ -4,9 +4,10 @@
|
|
|
4
4
|
|
|
5
5
|
import '@dxos-theme';
|
|
6
6
|
|
|
7
|
+
import { Bug, Compass, GithubLogo, Kanban, Gear, Table } from '@phosphor-icons/react';
|
|
7
8
|
import React, { useState } from 'react';
|
|
8
9
|
|
|
9
|
-
import {
|
|
10
|
+
import type { Plugin } from '@dxos/app-framework';
|
|
10
11
|
import { faker } from '@dxos/random';
|
|
11
12
|
import { withTheme } from '@dxos/storybook-utils';
|
|
12
13
|
|
|
@@ -14,17 +15,10 @@ import { PluginList } from './PluginList';
|
|
|
14
15
|
|
|
15
16
|
faker.seed(1);
|
|
16
17
|
|
|
17
|
-
const icons = [
|
|
18
|
-
'ph--bug--regular',
|
|
19
|
-
'ph--compass--regular',
|
|
20
|
-
'ph--kanban--regular',
|
|
21
|
-
'ph--table--regular',
|
|
22
|
-
'ph--gear--regular',
|
|
23
|
-
'ph--github-logo--regular',
|
|
24
|
-
];
|
|
18
|
+
const icons = [Bug, Compass, Kanban, Table, Gear, GithubLogo];
|
|
25
19
|
|
|
26
20
|
const Story = () => {
|
|
27
|
-
const [plugins] = useState<
|
|
21
|
+
const [plugins] = useState<Plugin['meta'][]>(
|
|
28
22
|
faker.helpers.multiple(
|
|
29
23
|
() => ({
|
|
30
24
|
id: `dxos.org/plugin/plugin-${faker.string.uuid()}`,
|
|
@@ -33,7 +27,7 @@ const Story = () => {
|
|
|
33
27
|
tags: faker.datatype.boolean({ probability: 0.6 })
|
|
34
28
|
? [faker.helpers.arrayElement(['experimental', 'beta', 'alpha', 'stable', 'new', '新発売'])]
|
|
35
29
|
: undefined,
|
|
36
|
-
|
|
30
|
+
iconComponent: faker.helpers.arrayElement(icons),
|
|
37
31
|
}),
|
|
38
32
|
{ count: 16 },
|
|
39
33
|
),
|
|
@@ -2,16 +2,37 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import { ArrowClockwise, Circle } from '@phosphor-icons/react';
|
|
5
6
|
import React from 'react';
|
|
6
7
|
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
|
|
8
|
+
import type { Plugin } from '@dxos/app-framework';
|
|
9
|
+
import {
|
|
10
|
+
Button,
|
|
11
|
+
// type ChromaticPalette,
|
|
12
|
+
// type NeutralPalette,
|
|
13
|
+
DensityProvider,
|
|
14
|
+
Input,
|
|
15
|
+
List,
|
|
16
|
+
ListItem,
|
|
17
|
+
useTranslation,
|
|
18
|
+
// Link,
|
|
19
|
+
} from '@dxos/react-ui';
|
|
20
|
+
import { descriptionText, fineBlockSize, getSize, ghostHover, mx } from '@dxos/react-ui-theme';
|
|
10
21
|
|
|
11
22
|
import { REGISTRY_PLUGIN } from '../meta';
|
|
12
23
|
|
|
24
|
+
// TODO(burdon): Reconcile with theme.
|
|
25
|
+
// const palette: { [tag: string]: ChromaticPalette | NeutralPalette } = {
|
|
26
|
+
// default: 'neutral',
|
|
27
|
+
// new: 'green',
|
|
28
|
+
// beta: 'cyan',
|
|
29
|
+
// alpha: 'purple',
|
|
30
|
+
// experimental: 'indigo',
|
|
31
|
+
// 新発売: 'red',
|
|
32
|
+
// };
|
|
33
|
+
|
|
13
34
|
export type PluginListProps = {
|
|
14
|
-
plugins?:
|
|
35
|
+
plugins?: Plugin['meta'][];
|
|
15
36
|
loaded?: string[];
|
|
16
37
|
enabled?: string[];
|
|
17
38
|
onChange?: (id: string, enabled: boolean) => void;
|
|
@@ -24,7 +45,7 @@ export const PluginList = ({ plugins = [], loaded = [], enabled = [], onChange,
|
|
|
24
45
|
return (
|
|
25
46
|
<DensityProvider density='fine'>
|
|
26
47
|
<List classNames='mb-4 select-none'>
|
|
27
|
-
{plugins.map(({ id, name, description, homePage,
|
|
48
|
+
{plugins.map(({ id, name, description, homePage, iconComponent: Icon = Circle }) => {
|
|
28
49
|
const isEnabled = enabled.includes(id);
|
|
29
50
|
const isLoaded = loaded.includes(id);
|
|
30
51
|
const reloadRequired = isEnabled !== isLoaded;
|
|
@@ -40,7 +61,7 @@ export const PluginList = ({ plugins = [], loaded = [], enabled = [], onChange,
|
|
|
40
61
|
aria-describedby={descriptionId}
|
|
41
62
|
classNames={['flex gap-2 cursor-pointer plb-2 pli-2 -mli-2 rounded', ghostHover]}
|
|
42
63
|
>
|
|
43
|
-
<Icon
|
|
64
|
+
<Icon weight='duotone' className={mx('shrink-0 mbs-1', getSize(6))} />
|
|
44
65
|
<div role='none' className={mx(fineBlockSize, 'grow pbs-1 pl-1')}>
|
|
45
66
|
<label htmlFor={inputId} id={labelId} className='truncate'>
|
|
46
67
|
{name ?? id}
|
|
@@ -63,7 +84,7 @@ export const PluginList = ({ plugins = [], loaded = [], enabled = [], onChange,
|
|
|
63
84
|
)} */}
|
|
64
85
|
{reloadRequired && (
|
|
65
86
|
<Button variant='ghost' classNames='p-0 gap-2' onClick={onReload}>
|
|
66
|
-
<
|
|
87
|
+
<ArrowClockwise />
|
|
67
88
|
<p className='text-sm font-medium'>{t('reload required message')}</p>
|
|
68
89
|
</Button>
|
|
69
90
|
)}
|
|
@@ -73,7 +94,7 @@ export const PluginList = ({ plugins = [], loaded = [], enabled = [], onChange,
|
|
|
73
94
|
<div className='pbs-1'>
|
|
74
95
|
<Input.Switch
|
|
75
96
|
classNames='self-center'
|
|
76
|
-
checked={isEnabled}
|
|
97
|
+
checked={!!isEnabled}
|
|
77
98
|
onClick={() => onChange?.(id, !isEnabled)}
|
|
78
99
|
/>
|
|
79
100
|
</div>
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import React, { useMemo, type PropsWithChildren } from 'react';
|
|
6
6
|
|
|
7
|
-
import { type
|
|
7
|
+
import { type Plugin, useIntentDispatcher, usePlugins } from '@dxos/app-framework';
|
|
8
8
|
import { ObservabilityAction } from '@dxos/plugin-observability/meta';
|
|
9
9
|
import { SettingsValue } from '@dxos/plugin-settings';
|
|
10
10
|
import { Input, useTranslation } from '@dxos/react-ui';
|
|
@@ -13,13 +13,13 @@ import { PluginList } from './PluginList';
|
|
|
13
13
|
import { type RegistrySettingsProps } from '../RegistryPlugin';
|
|
14
14
|
import { REGISTRY_PLUGIN } from '../meta';
|
|
15
15
|
|
|
16
|
-
const sort = ({ name: a = '' }: PluginMeta, { name: b = '' }: PluginMeta) => a.localeCompare(b);
|
|
17
|
-
|
|
18
16
|
export const PluginSettings = ({ settings }: { settings: RegistrySettingsProps }) => {
|
|
19
17
|
const { t } = useTranslation(REGISTRY_PLUGIN);
|
|
20
|
-
const {
|
|
18
|
+
const { enabled, core, plugins, setPlugin, ...pluginContext } = usePlugins();
|
|
21
19
|
const dispatch = useIntentDispatcher();
|
|
22
20
|
|
|
21
|
+
const sort = (a: Plugin['meta'], b: Plugin['meta']) => a.name?.localeCompare(b.name ?? '') ?? 0;
|
|
22
|
+
|
|
23
23
|
// Memoize to prevent plugins from disappearing when toggling enabled.
|
|
24
24
|
const installed = useMemo(
|
|
25
25
|
() =>
|
|
@@ -31,7 +31,6 @@ export const PluginSettings = ({ settings }: { settings: RegistrySettingsProps }
|
|
|
31
31
|
[],
|
|
32
32
|
);
|
|
33
33
|
|
|
34
|
-
const pluginIds = plugins.map(({ meta }) => meta.id);
|
|
35
34
|
const available = useMemo(() => pluginContext.available.filter(({ id }) => !enabled.includes(id)).sort(sort), []);
|
|
36
35
|
const recommended = available.filter((meta) => !meta.tags?.includes('experimental'));
|
|
37
36
|
const experimental = available.filter((meta) => meta.tags?.includes('experimental'));
|
|
@@ -64,7 +63,7 @@ export const PluginSettings = ({ settings }: { settings: RegistrySettingsProps }
|
|
|
64
63
|
<Section label={t('settings section installed label')}>
|
|
65
64
|
<PluginList
|
|
66
65
|
plugins={installed}
|
|
67
|
-
loaded={
|
|
66
|
+
loaded={plugins.map(({ meta }) => meta.id)}
|
|
68
67
|
enabled={enabled}
|
|
69
68
|
onChange={handleChange}
|
|
70
69
|
onReload={handleReload}
|
|
@@ -74,7 +73,7 @@ export const PluginSettings = ({ settings }: { settings: RegistrySettingsProps }
|
|
|
74
73
|
<Section label={t('settings section recommended label')}>
|
|
75
74
|
<PluginList
|
|
76
75
|
plugins={recommended}
|
|
77
|
-
loaded={
|
|
76
|
+
loaded={plugins.map(({ meta }) => meta.id)}
|
|
78
77
|
enabled={enabled}
|
|
79
78
|
onChange={handleChange}
|
|
80
79
|
onReload={handleReload}
|
|
@@ -85,7 +84,7 @@ export const PluginSettings = ({ settings }: { settings: RegistrySettingsProps }
|
|
|
85
84
|
<Section label={t('settings section experimental label')}>
|
|
86
85
|
<PluginList
|
|
87
86
|
plugins={experimental}
|
|
88
|
-
loaded={
|
|
87
|
+
loaded={plugins.map(({ meta }) => meta.id)}
|
|
89
88
|
enabled={enabled}
|
|
90
89
|
onChange={handleChange}
|
|
91
90
|
onReload={handleReload}
|
|
@@ -99,7 +98,7 @@ export const PluginSettings = ({ settings }: { settings: RegistrySettingsProps }
|
|
|
99
98
|
const Section = ({ label, children }: PropsWithChildren<{ label: string }>) => {
|
|
100
99
|
return (
|
|
101
100
|
<div>
|
|
102
|
-
<h2 className='py-2 text-sm text-
|
|
101
|
+
<h2 className='py-2 text-sm text-neutral-500'>{label}</h2>
|
|
103
102
|
{children}
|
|
104
103
|
</div>
|
|
105
104
|
);
|
package/src/meta.ts
CHANGED
|
@@ -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
|
-
}
|