@dxos/plugin-registry 0.7.4 → 0.7.5-main.499c70c
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/browser/index.mjs +18 -21
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/types/src/RegistryPlugin.d.ts +1 -1
- package/dist/types/src/RegistryPlugin.d.ts.map +1 -1
- package/dist/types/src/components/PluginSettings.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -0
- package/package.json +14 -14
- package/src/RegistryPlugin.tsx +14 -9
- package/src/components/PluginSettings.tsx +7 -8
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
|
|
6
6
|
// packages/plugins/plugin-registry/src/RegistryPlugin.tsx
|
|
7
7
|
import React3 from "react";
|
|
8
|
+
import { createSurface } from "@dxos/app-framework";
|
|
8
9
|
import { LocalStorageStore } from "@dxos/local-storage";
|
|
9
10
|
|
|
10
11
|
// packages/plugins/plugin-registry/src/components/PluginList.tsx
|
|
@@ -92,15 +93,15 @@ var PluginList = ({ plugins = [], loaded = [], enabled = [], onChange, onReload
|
|
|
92
93
|
|
|
93
94
|
// packages/plugins/plugin-registry/src/components/PluginSettings.tsx
|
|
94
95
|
import React2, { useMemo } from "react";
|
|
95
|
-
import { useIntentDispatcher, usePlugins } from "@dxos/app-framework";
|
|
96
|
-
import { ObservabilityAction } from "@dxos/plugin-observability/
|
|
96
|
+
import { createIntent, useIntentDispatcher, usePlugins } from "@dxos/app-framework";
|
|
97
|
+
import { ObservabilityAction } from "@dxos/plugin-observability/types";
|
|
97
98
|
import { Input as Input2, useTranslation as useTranslation2 } from "@dxos/react-ui";
|
|
98
99
|
import { DeprecatedFormInput } from "@dxos/react-ui-form";
|
|
99
100
|
var sortPluginMeta = ({ name: a = "" }, { name: b = "" }) => a.localeCompare(b);
|
|
100
101
|
var PluginSettings = ({ settings }) => {
|
|
101
102
|
const { t } = useTranslation2(REGISTRY_PLUGIN);
|
|
102
103
|
const { plugins, enabled, core, setPlugin, ...pluginContext } = usePlugins();
|
|
103
|
-
const dispatch = useIntentDispatcher();
|
|
104
|
+
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
104
105
|
const installed = useMemo(() => plugins.filter(({ meta }) => !core.includes(meta.id)).filter(({ meta }) => enabled.includes(meta.id)).map(({ meta }) => meta).sort(sortPluginMeta), []);
|
|
105
106
|
const pluginIds = plugins.map(({ meta }) => meta.id);
|
|
106
107
|
const available = useMemo(() => pluginContext.available.filter(({ id }) => !enabled.includes(id)).sort(sortPluginMeta), []);
|
|
@@ -108,16 +109,13 @@ var PluginSettings = ({ settings }) => {
|
|
|
108
109
|
const experimental = available.filter((meta) => meta.tags?.includes("experimental"));
|
|
109
110
|
const handleChange = (id, enabled2) => {
|
|
110
111
|
setPlugin(id, enabled2);
|
|
111
|
-
void dispatch({
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
plugin: id,
|
|
117
|
-
enabled: enabled2
|
|
118
|
-
}
|
|
112
|
+
void dispatch(createIntent(ObservabilityAction.SendEvent, {
|
|
113
|
+
name: "plugins.toggle",
|
|
114
|
+
properties: {
|
|
115
|
+
plugin: id,
|
|
116
|
+
enabled: enabled2
|
|
119
117
|
}
|
|
120
|
-
});
|
|
118
|
+
}));
|
|
121
119
|
};
|
|
122
120
|
const handleReload = () => {
|
|
123
121
|
window.location.reload();
|
|
@@ -195,15 +193,14 @@ var RegistryPlugin = () => {
|
|
|
195
193
|
settings: settings.values,
|
|
196
194
|
translations: translations_default,
|
|
197
195
|
surface: {
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
}
|
|
196
|
+
definitions: () => createSurface({
|
|
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
|
+
})
|
|
207
204
|
}
|
|
208
205
|
}
|
|
209
206
|
};
|
|
@@ -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
|
|
5
|
-
"mappings": ";;;;;;AAIA,OAAOA,YAAW;
|
|
6
|
-
"names": ["React", "LocalStorageStore", "React", "useCallback", "Button", "Icon", "Input", "Link", "List", "ListItem", "useTranslation", "descriptionText", "fineBlockSize", "mx", "PluginList", "plugins", "loaded", "enabled", "onChange", "onReload", "t", "useTranslation", "REGISTRY_PLUGIN", "List", "classNames", "map", "id", "name", "description", "homePage", "source", "icon", "isEnabled", "includes", "isLoaded", "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", "useIntentDispatcher", "usePlugins", "ObservabilityAction", "Input", "useTranslation", "DeprecatedFormInput", "sortPluginMeta", "name", "a", "b", "localeCompare", "PluginSettings", "settings", "t", "useTranslation", "REGISTRY_PLUGIN", "plugins", "enabled", "core", "setPlugin", "pluginContext", "usePlugins", "dispatch", "useIntentDispatcher", "installed", "useMemo", "filter", "meta", "includes", "id", "map", "sort", "pluginIds", "available", "recommended", "tags", "experimental", "handleChange", "
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport React from 'react';\n\nimport {\n createSurface,\n type PluginDefinition,\n type SettingsProvides,\n type SurfaceProvides,\n type TranslationsProvides,\n} 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 definitions: () =>\n createSurface({\n id: meta.id,\n role: 'settings',\n filter: (data): data is any => data.subject === REGISTRY_PLUGIN,\n component: () => <PluginSettings settings={settings.values} />,\n }),\n },\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?: PluginMeta[];\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 <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 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 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, usePlugins } 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 { type RegistrySettingsProps } from '../RegistryPlugin';\nimport { REGISTRY_PLUGIN } from '../meta';\n\nconst sortPluginMeta = ({ name: a = '' }: PluginMeta, { name: b = '' }: PluginMeta) => a.localeCompare(b);\n\nexport const PluginSettings = ({ settings }: { settings: RegistrySettingsProps }) => {\n const { t } = useTranslation(REGISTRY_PLUGIN);\n const { plugins, enabled, core, setPlugin, ...pluginContext } = usePlugins();\n const { dispatchPromise: dispatch } = useIntentDispatcher();\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(sortPluginMeta),\n [],\n );\n\n const pluginIds = plugins.map(({ meta }) => meta.id);\n const available = useMemo(\n () => pluginContext.available.filter(({ id }) => !enabled.includes(id)).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 setPlugin(id, enabled);\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 loaded={pluginIds}\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={pluginIds}\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={pluginIds}\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-subdued'>{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 'source label': 'Source',\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;AAElB,SACEC,qBAKK;AACP,SAASC,yBAAyB;;;ACTlC,OAAOC,SAASC,mBAAmB;AAGnC,SAASC,QAAQC,MAAMC,OAAOC,MAAMC,MAAMC,UAAUC,sBAAsB;AAC1E,SAASC,iBAAiBC,eAAeC,UAAU;AAY5C,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,MAAAA;IAAKC,YAAW;KACdT,QAAQU,IAAI,CAAC,EAAEC,IAAIC,MAAMC,aAAaC,UAAUC,QAAQC,OAAO,sBAAqB,MAAE;AACrF,UAAMC,YAAYf,QAAQgB,SAASP,EAAAA;AACnC,UAAMQ,WAAWlB,OAAOiB,SAASP,EAAA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B;IACTqB,QAAQzB;IACRhB;IACA0C,UAAUrB;IACVsB,UAAUhB;;AAMtB;AAEA,IAAMY,UAAU,CAAC,EAAEN,OAAOW,SAAQ,MAAwC;AACxE,SACE,gBAAAb,OAAA,cAACc,OAAAA,MACC,gBAAAd,OAAA,cAACe,MAAAA;IAAGC,WAAU;KAA6Bd,KAAAA,GAC1CW,QAAAA;AAGP;;;ACrGA,IAAA,uBAAe;EACb;IACE,SAAS;MACP,CAACI,eAAAA,GAAkB;QACjB,eAAe;QACf,2BAA2B;QAC3B,oCAAoC;QACpC,oCAAoC;QACpC,sCAAsC;QACtC,uCAAuC;QACvC,mBAAmB;QACnB,gBAAgB;MAClB;IACF;EACF;;;;AHKK,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,aAAa,MACXC,cAAc;UACZC,IAAIb,aAAKa;UACTC,MAAM;UACNC,QAAQ,CAACC,SAAsBA,KAAKC,YAAYlB;UAChDmB,WAAW,MAAM,gBAAAC,OAAA,cAACC,gBAAAA;YAAevB,UAAUA,SAASW;;QACtD,CAAA;MACJ;IACF;EACF;AACF;;;AIzCA,IAAA,cAAea;",
|
|
6
|
+
"names": ["React", "createSurface", "LocalStorageStore", "React", "useCallback", "Button", "Icon", "Input", "Link", "List", "ListItem", "useTranslation", "descriptionText", "fineBlockSize", "mx", "PluginList", "plugins", "loaded", "enabled", "onChange", "onReload", "t", "useTranslation", "REGISTRY_PLUGIN", "List", "classNames", "map", "id", "name", "description", "homePage", "source", "icon", "isEnabled", "includes", "isLoaded", "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", "usePlugins", "ObservabilityAction", "Input", "useTranslation", "DeprecatedFormInput", "sortPluginMeta", "name", "a", "b", "localeCompare", "PluginSettings", "settings", "t", "useTranslation", "REGISTRY_PLUGIN", "plugins", "enabled", "core", "setPlugin", "pluginContext", "usePlugins", "dispatchPromise", "dispatch", "useIntentDispatcher", "installed", "useMemo", "filter", "meta", "includes", "id", "map", "sort", "pluginIds", "available", "recommended", "tags", "experimental", "handleChange", "createIntent", "ObservabilityAction", "SendEvent", "properties", "plugin", "handleReload", "window", "location", "reload", "React", "DeprecatedFormInput", "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", "definitions", "createSurface", "id", "role", "filter", "data", "subject", "component", "React", "PluginSettings", "RegistryPlugin"]
|
|
7
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs":{"packages/plugins/plugin-registry/src/meta.ts":{"bytes":959,"imports":[],"format":"esm"},"packages/plugins/plugin-registry/src/components/PluginList.tsx":{"bytes":12963,"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":
|
|
1
|
+
{"inputs":{"packages/plugins/plugin-registry/src/meta.ts":{"bytes":959,"imports":[],"format":"esm"},"packages/plugins/plugin-registry/src/components/PluginList.tsx":{"bytes":12963,"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":11966,"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/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":4566,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/app-framework","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":16581},"packages/plugins/plugin-registry/dist/lib/browser/index.mjs":{"imports":[{"path":"packages/plugins/plugin-registry/dist/lib/browser/chunk-NEMFDAOB.mjs","kind":"import-statement"},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/local-storage","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":["RegistryPlugin","default"],"entryPoint":"packages/plugins/plugin-registry/src/index.ts","inputs":{"packages/plugins/plugin-registry/src/RegistryPlugin.tsx":{"bytesInOutput":873},"packages/plugins/plugin-registry/src/components/PluginList.tsx":{"bytesInOutput":3357},"packages/plugins/plugin-registry/src/components/index.ts":{"bytesInOutput":0},"packages/plugins/plugin-registry/src/components/PluginSettings.tsx":{"bytesInOutput":3000},"packages/plugins/plugin-registry/src/translations.ts":{"bytesInOutput":513},"packages/plugins/plugin-registry/src/index.ts":{"bytesInOutput":34}},"bytes":8306},"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-NEMFDAOB.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-NEMFDAOB.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":456},"packages/plugins/plugin-registry/dist/lib/browser/chunk-NEMFDAOB.mjs":{"imports":[],"exports":["REGISTRY_PLUGIN","meta_default"],"inputs":{"packages/plugins/plugin-registry/src/meta.ts":{"bytesInOutput":115}},"bytes":254}}}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type PluginDefinition, type SettingsProvides, type SurfaceProvides, type TranslationsProvides } from '@dxos/app-framework';
|
|
2
2
|
export type RegistrySettingsProps = {
|
|
3
3
|
experimental?: boolean;
|
|
4
4
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RegistryPlugin.d.ts","sourceRoot":"","sources":["../../../src/RegistryPlugin.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"RegistryPlugin.d.ts","sourceRoot":"","sources":["../../../src/RegistryPlugin.tsx"],"names":[],"mappings":"AAMA,OAAO,EAEL,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACpB,KAAK,oBAAoB,EAC1B,MAAM,qBAAqB,CAAC;AAO7B,MAAM,MAAM,qBAAqB,GAAG;IAClC,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG,eAAe,GAAG,oBAAoB,GAAG,gBAAgB,CAAC,qBAAqB,CAAC,CAAC;AAEtH,eAAO,MAAM,cAAc,QAAO,gBAAgB,CAAC,sBAAsB,CAsBxE,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;AAK/D,eAAO,MAAM,cAAc,iBAAkB;IAAE,QAAQ,EAAE,qBAAqB,CAAA;CAAE,
|
|
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;AAK/D,eAAO,MAAM,cAAc,iBAAkB;IAAE,QAAQ,EAAE,qBAAqB,CAAA;CAAE,sBAiF/E,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":"5.7.2"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/plugin-registry",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.5-main.499c70c",
|
|
4
4
|
"description": "Braneframe plugin gallery",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -30,11 +30,11 @@
|
|
|
30
30
|
"src"
|
|
31
31
|
],
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@dxos/app-framework": "0.7.
|
|
34
|
-
"@dxos/
|
|
35
|
-
"@dxos/
|
|
36
|
-
"@dxos/
|
|
37
|
-
"@dxos/util": "0.7.
|
|
33
|
+
"@dxos/app-framework": "0.7.5-main.499c70c",
|
|
34
|
+
"@dxos/react-ui-form": "0.7.5-main.499c70c",
|
|
35
|
+
"@dxos/local-storage": "0.7.5-main.499c70c",
|
|
36
|
+
"@dxos/plugin-observability": "0.7.5-main.499c70c",
|
|
37
|
+
"@dxos/util": "0.7.5-main.499c70c"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@phosphor-icons/react": "^2.1.5",
|
|
@@ -43,19 +43,19 @@
|
|
|
43
43
|
"react": "~18.2.0",
|
|
44
44
|
"react-dom": "~18.2.0",
|
|
45
45
|
"vite": "5.4.7",
|
|
46
|
-
"@dxos/random": "0.7.
|
|
47
|
-
"@dxos/react-ui": "0.7.
|
|
48
|
-
"@dxos/react-ui-theme": "0.7.
|
|
49
|
-
"@dxos/react-ui-mosaic": "0.7.
|
|
50
|
-
"@dxos/storybook-utils": "0.7.
|
|
46
|
+
"@dxos/random": "0.7.5-main.499c70c",
|
|
47
|
+
"@dxos/react-ui": "0.7.5-main.499c70c",
|
|
48
|
+
"@dxos/react-ui-theme": "0.7.5-main.499c70c",
|
|
49
|
+
"@dxos/react-ui-mosaic": "0.7.5-main.499c70c",
|
|
50
|
+
"@dxos/storybook-utils": "0.7.5-main.499c70c"
|
|
51
51
|
},
|
|
52
52
|
"peerDependencies": {
|
|
53
53
|
"@phosphor-icons/react": "^2.1.5",
|
|
54
54
|
"react": "~18.2.0",
|
|
55
55
|
"react-dom": "~18.2.0",
|
|
56
|
-
"@dxos/react-ui": "0.7.
|
|
57
|
-
"@dxos/react-ui-
|
|
58
|
-
"@dxos/react-ui-
|
|
56
|
+
"@dxos/react-ui": "0.7.5-main.499c70c",
|
|
57
|
+
"@dxos/react-ui-mosaic": "0.7.5-main.499c70c",
|
|
58
|
+
"@dxos/react-ui-theme": "0.7.5-main.499c70c"
|
|
59
59
|
},
|
|
60
60
|
"publishConfig": {
|
|
61
61
|
"access": "public"
|
package/src/RegistryPlugin.tsx
CHANGED
|
@@ -4,7 +4,13 @@
|
|
|
4
4
|
|
|
5
5
|
import React from 'react';
|
|
6
6
|
|
|
7
|
-
import
|
|
7
|
+
import {
|
|
8
|
+
createSurface,
|
|
9
|
+
type PluginDefinition,
|
|
10
|
+
type SettingsProvides,
|
|
11
|
+
type SurfaceProvides,
|
|
12
|
+
type TranslationsProvides,
|
|
13
|
+
} from '@dxos/app-framework';
|
|
8
14
|
import { LocalStorageStore } from '@dxos/local-storage';
|
|
9
15
|
|
|
10
16
|
import { PluginSettings } from './components';
|
|
@@ -29,14 +35,13 @@ export const RegistryPlugin = (): PluginDefinition<RegistryPluginProvides> => {
|
|
|
29
35
|
settings: settings.values,
|
|
30
36
|
translations,
|
|
31
37
|
surface: {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
},
|
|
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
|
+
}),
|
|
40
45
|
},
|
|
41
46
|
},
|
|
42
47
|
};
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
import React, { useMemo, type PropsWithChildren } from 'react';
|
|
6
6
|
|
|
7
|
-
import { type PluginMeta, useIntentDispatcher, usePlugins } from '@dxos/app-framework';
|
|
8
|
-
import { ObservabilityAction } from '@dxos/plugin-observability/
|
|
7
|
+
import { createIntent, type PluginMeta, useIntentDispatcher, usePlugins } from '@dxos/app-framework';
|
|
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
|
|
|
@@ -18,7 +18,7 @@ const sortPluginMeta = ({ name: a = '' }: PluginMeta, { name: b = '' }: PluginMe
|
|
|
18
18
|
export const PluginSettings = ({ settings }: { settings: RegistrySettingsProps }) => {
|
|
19
19
|
const { t } = useTranslation(REGISTRY_PLUGIN);
|
|
20
20
|
const { plugins, enabled, core, setPlugin, ...pluginContext } = usePlugins();
|
|
21
|
-
const dispatch = useIntentDispatcher();
|
|
21
|
+
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
22
22
|
|
|
23
23
|
// Memoize to prevent plugins from disappearing when toggling enabled.
|
|
24
24
|
const installed = useMemo(
|
|
@@ -41,13 +41,12 @@ export const PluginSettings = ({ settings }: { settings: RegistrySettingsProps }
|
|
|
41
41
|
|
|
42
42
|
const handleChange = (id: string, enabled: boolean) => {
|
|
43
43
|
setPlugin(id, enabled);
|
|
44
|
-
void dispatch(
|
|
45
|
-
|
|
46
|
-
data: {
|
|
44
|
+
void dispatch(
|
|
45
|
+
createIntent(ObservabilityAction.SendEvent, {
|
|
47
46
|
name: 'plugins.toggle',
|
|
48
47
|
properties: { plugin: id, enabled },
|
|
49
|
-
},
|
|
50
|
-
|
|
48
|
+
}),
|
|
49
|
+
);
|
|
51
50
|
};
|
|
52
51
|
|
|
53
52
|
const handleReload = () => {
|