@dxos/plugin-registry 0.8.4-main.ead640a → 0.8.4-main.effb148878
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/LICENSE +102 -5
- package/dist/lib/neutral/RegistryPlugin.mjs +27 -0
- package/dist/lib/neutral/RegistryPlugin.mjs.map +7 -0
- package/dist/lib/neutral/RegistryPlugin.node.mjs +153 -0
- package/dist/lib/neutral/RegistryPlugin.node.mjs.map +7 -0
- package/dist/lib/neutral/RegistryPlugin.workerd.mjs +10 -0
- package/dist/lib/neutral/RegistryPlugin.workerd.mjs.map +7 -0
- package/dist/lib/neutral/chunk-MYLRMFLY.mjs +34 -0
- package/dist/lib/neutral/chunk-MYLRMFLY.mjs.map +7 -0
- package/dist/lib/neutral/chunk-XK2JMH3H.mjs +33 -0
- package/dist/lib/neutral/chunk-XK2JMH3H.mjs.map +7 -0
- package/dist/lib/neutral/index.mjs +25 -0
- package/dist/lib/neutral/index.mjs.map +7 -0
- package/dist/lib/neutral/meta.json +1 -0
- package/dist/lib/neutral/open-plugin-registry-II735N76.mjs +15 -0
- package/dist/lib/neutral/open-plugin-registry-II735N76.mjs.map +7 -0
- package/dist/lib/neutral/plugin.mjs +18 -0
- package/dist/lib/neutral/plugin.mjs.map +7 -0
- package/dist/lib/neutral/translations.mjs +70 -0
- package/dist/lib/neutral/translations.mjs.map +7 -0
- package/dist/types/src/RegistryPlugin.d.ts +3 -1
- package/dist/types/src/RegistryPlugin.d.ts.map +1 -1
- package/dist/types/src/RegistryPlugin.node.d.ts +4 -0
- package/dist/types/src/RegistryPlugin.node.d.ts.map +1 -0
- package/dist/types/src/RegistryPlugin.test.d.ts +2 -0
- package/dist/types/src/RegistryPlugin.test.d.ts.map +1 -0
- package/dist/types/src/RegistryPlugin.workerd.d.ts +4 -0
- package/dist/types/src/RegistryPlugin.workerd.d.ts.map +1 -0
- package/dist/types/src/capabilities/app-graph-builder.d.ts +4 -2
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/capabilities/dev-plugin-loader.d.ts +11 -0
- package/dist/types/src/capabilities/dev-plugin-loader.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +15 -3
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/operation-handler.d.ts +6 -0
- package/dist/types/src/capabilities/operation-handler.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface.d.ts +3 -2
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/capabilities/settings.d.ts +14 -0
- package/dist/types/src/capabilities/settings.d.ts.map +1 -0
- package/dist/types/src/commands/disable.d.ts +11 -0
- package/dist/types/src/commands/disable.d.ts.map +1 -0
- package/dist/types/src/commands/enable.d.ts +11 -0
- package/dist/types/src/commands/enable.d.ts.map +1 -0
- package/dist/types/src/commands/index.d.ts +3 -0
- package/dist/types/src/commands/index.d.ts.map +1 -0
- package/dist/types/src/commands/list.d.ts +7 -0
- package/dist/types/src/commands/list.d.ts.map +1 -0
- package/dist/types/src/commands/util.d.ts +11 -0
- package/dist/types/src/commands/util.d.ts.map +1 -0
- package/dist/types/src/components/DisableDependentsAlert/DisableDependentsAlert.d.ts +24 -0
- package/dist/types/src/components/DisableDependentsAlert/DisableDependentsAlert.d.ts.map +1 -0
- package/dist/types/src/components/DisableDependentsAlert/index.d.ts +2 -0
- package/dist/types/src/components/DisableDependentsAlert/index.d.ts.map +1 -0
- package/dist/types/src/components/PluginDetail/PluginDetail.d.ts +82 -0
- package/dist/types/src/components/PluginDetail/PluginDetail.d.ts.map +1 -0
- package/dist/types/src/components/PluginDetail/PluginDetail.stories.d.ts +77 -0
- package/dist/types/src/components/PluginDetail/PluginDetail.stories.d.ts.map +1 -0
- package/dist/types/src/components/PluginDetail/index.d.ts +2 -0
- package/dist/types/src/components/PluginDetail/index.d.ts.map +1 -0
- package/dist/types/src/components/PluginFailureBadge/PluginFailureBadge.d.ts +20 -0
- package/dist/types/src/components/PluginFailureBadge/PluginFailureBadge.d.ts.map +1 -0
- package/dist/types/src/components/PluginFailureBadge/index.d.ts +2 -0
- package/dist/types/src/components/PluginFailureBadge/index.d.ts.map +1 -0
- package/dist/types/src/components/PluginList/PluginItem.d.ts +40 -0
- package/dist/types/src/components/PluginList/PluginItem.d.ts.map +1 -0
- package/dist/types/src/components/PluginList/PluginList.d.ts +23 -0
- package/dist/types/src/components/PluginList/PluginList.d.ts.map +1 -0
- package/dist/types/src/components/PluginList/PluginList.stories.d.ts +76 -0
- package/dist/types/src/components/PluginList/PluginList.stories.d.ts.map +1 -0
- package/dist/types/src/components/PluginList/index.d.ts +2 -0
- package/dist/types/src/components/PluginList/index.d.ts.map +1 -0
- package/dist/types/src/components/RegistrySettings/RegistrySettings.d.ts +18 -0
- package/dist/types/src/components/RegistrySettings/RegistrySettings.d.ts.map +1 -0
- package/dist/types/src/components/RegistrySettings/index.d.ts +2 -0
- package/dist/types/src/components/RegistrySettings/index.d.ts.map +1 -0
- package/dist/types/src/components/index.d.ts +3 -1
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/containers/BaseRegistryArticle/BaseRegistryArticle.d.ts +20 -0
- package/dist/types/src/containers/BaseRegistryArticle/BaseRegistryArticle.d.ts.map +1 -0
- package/dist/types/src/containers/BaseRegistryArticle/index.d.ts +2 -0
- package/dist/types/src/containers/BaseRegistryArticle/index.d.ts.map +1 -0
- package/dist/types/src/containers/LoadPluginDialog/LoadPluginDialog.d.ts +4 -0
- package/dist/types/src/containers/LoadPluginDialog/LoadPluginDialog.d.ts.map +1 -0
- package/dist/types/src/containers/LoadPluginDialog/index.d.ts +2 -0
- package/dist/types/src/containers/LoadPluginDialog/index.d.ts.map +1 -0
- package/dist/types/src/containers/PluginArticle/PluginArticle.d.ts +7 -0
- package/dist/types/src/containers/PluginArticle/PluginArticle.d.ts.map +1 -0
- package/dist/types/src/containers/PluginArticle/index.d.ts +2 -0
- package/dist/types/src/containers/PluginArticle/index.d.ts.map +1 -0
- package/dist/types/src/containers/PublicRegistryArticle/PublicRegistryArticle.d.ts +8 -0
- package/dist/types/src/containers/PublicRegistryArticle/PublicRegistryArticle.d.ts.map +1 -0
- package/dist/types/src/containers/PublicRegistryArticle/index.d.ts +2 -0
- package/dist/types/src/containers/PublicRegistryArticle/index.d.ts.map +1 -0
- package/dist/types/src/containers/RegistryArticle/RegistryArticle.d.ts +14 -0
- package/dist/types/src/containers/RegistryArticle/RegistryArticle.d.ts.map +1 -0
- package/dist/types/src/containers/RegistryArticle/index.d.ts +2 -0
- package/dist/types/src/containers/RegistryArticle/index.d.ts.map +1 -0
- package/dist/types/src/containers/RegistrySettingsContainer/RegistrySettingsContainer.d.ts +13 -0
- package/dist/types/src/containers/RegistrySettingsContainer/RegistrySettingsContainer.d.ts.map +1 -0
- package/dist/types/src/containers/RegistrySettingsContainer/index.d.ts +2 -0
- package/dist/types/src/containers/RegistrySettingsContainer/index.d.ts.map +1 -0
- package/dist/types/src/containers/index.d.ts +8 -0
- package/dist/types/src/containers/index.d.ts.map +1 -0
- package/dist/types/src/hooks/index.d.ts +9 -0
- package/dist/types/src/hooks/index.d.ts.map +1 -0
- package/dist/types/src/hooks/useAutoTags.d.ts +20 -0
- package/dist/types/src/hooks/useAutoTags.d.ts.map +1 -0
- package/dist/types/src/hooks/useCatalogEntry.d.ts +11 -0
- package/dist/types/src/hooks/useCatalogEntry.d.ts.map +1 -0
- package/dist/types/src/hooks/useDisableConfirmation.d.ts +19 -0
- package/dist/types/src/hooks/useDisableConfirmation.d.ts.map +1 -0
- package/dist/types/src/hooks/useInstalledVersionTag.d.ts +18 -0
- package/dist/types/src/hooks/useInstalledVersionTag.d.ts.map +1 -0
- package/dist/types/src/hooks/usePluginActions.d.ts +36 -0
- package/dist/types/src/hooks/usePluginActions.d.ts.map +1 -0
- package/dist/types/src/hooks/useRegistryPlugins.d.ts +15 -0
- package/dist/types/src/hooks/useRegistryPlugins.d.ts.map +1 -0
- package/dist/types/src/hooks/useUpdateAvailable.d.ts +18 -0
- package/dist/types/src/hooks/useUpdateAvailable.d.ts.map +1 -0
- package/dist/types/src/hooks/useVersionPicker.d.ts +21 -0
- package/dist/types/src/hooks/useVersionPicker.d.ts.map +1 -0
- package/dist/types/src/index.d.ts +1 -1
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +20 -3
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/operations/index.d.ts +3 -0
- package/dist/types/src/operations/index.d.ts.map +1 -0
- package/dist/types/src/operations/open-plugin-registry.d.ts +5 -0
- package/dist/types/src/operations/open-plugin-registry.d.ts.map +1 -0
- package/dist/types/src/plugin.d.ts +4 -0
- package/dist/types/src/plugin.d.ts.map +1 -0
- package/dist/types/src/storage.d.ts +18 -0
- package/dist/types/src/storage.d.ts.map +1 -0
- package/dist/types/src/translations.d.ts +57 -16
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types.d.ts +31 -0
- package/dist/types/src/types.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +76 -36
- package/src/RegistryPlugin.node.ts +19 -0
- package/src/RegistryPlugin.test.ts +24 -0
- package/src/RegistryPlugin.tsx +19 -25
- package/src/RegistryPlugin.workerd.ts +11 -0
- package/src/capabilities/app-graph-builder.ts +180 -136
- package/src/capabilities/dev-plugin-loader.ts +39 -0
- package/src/capabilities/index.ts +10 -4
- package/src/capabilities/operation-handler.ts +16 -0
- package/src/capabilities/react-surface.tsx +133 -73
- package/src/capabilities/settings.ts +34 -0
- package/src/commands/disable.ts +47 -0
- package/src/commands/enable.ts +44 -0
- package/src/commands/index.ts +14 -0
- package/src/commands/list.ts +41 -0
- package/src/commands/util.ts +24 -0
- package/src/components/DisableDependentsAlert/DisableDependentsAlert.tsx +69 -0
- package/src/components/DisableDependentsAlert/index.ts +5 -0
- package/src/components/PluginDetail/PluginDetail.stories.tsx +45 -0
- package/src/components/PluginDetail/PluginDetail.tsx +340 -0
- package/src/components/PluginDetail/index.ts +5 -0
- package/src/components/PluginFailureBadge/PluginFailureBadge.tsx +68 -0
- package/src/components/PluginFailureBadge/index.ts +5 -0
- package/src/components/PluginList/PluginItem.tsx +226 -0
- package/src/components/PluginList/PluginList.stories.tsx +87 -0
- package/src/components/PluginList/PluginList.tsx +52 -0
- package/src/components/PluginList/index.ts +5 -0
- package/src/components/RegistrySettings/RegistrySettings.tsx +120 -0
- package/src/components/RegistrySettings/index.ts +5 -0
- package/src/components/index.ts +3 -1
- package/src/containers/BaseRegistryArticle/BaseRegistryArticle.tsx +178 -0
- package/src/containers/BaseRegistryArticle/index.ts +5 -0
- package/src/containers/LoadPluginDialog/LoadPluginDialog.tsx +87 -0
- package/src/containers/LoadPluginDialog/index.ts +5 -0
- package/src/containers/PluginArticle/PluginArticle.tsx +117 -0
- package/src/containers/PluginArticle/index.ts +5 -0
- package/src/containers/PublicRegistryArticle/PublicRegistryArticle.tsx +192 -0
- package/src/containers/PublicRegistryArticle/index.ts +5 -0
- package/src/containers/RegistryArticle/RegistryArticle.tsx +53 -0
- package/src/containers/RegistryArticle/index.ts +5 -0
- package/src/containers/RegistrySettingsContainer/RegistrySettingsContainer.tsx +59 -0
- package/src/containers/RegistrySettingsContainer/index.ts +5 -0
- package/src/containers/index.ts +12 -0
- package/src/hooks/index.ts +12 -0
- package/src/hooks/useAutoTags.ts +51 -0
- package/src/hooks/useCatalogEntry.ts +25 -0
- package/src/hooks/useDisableConfirmation.ts +58 -0
- package/src/hooks/useInstalledVersionTag.ts +41 -0
- package/src/hooks/usePluginActions.ts +174 -0
- package/src/hooks/useRegistryPlugins.ts +29 -0
- package/src/hooks/useUpdateAvailable.ts +31 -0
- package/src/hooks/useVersionPicker.ts +112 -0
- package/src/index.ts +1 -1
- package/src/meta.ts +37 -7
- package/src/operations/index.ts +7 -0
- package/src/operations/open-plugin-registry.ts +21 -0
- package/src/plugin.ts +11 -0
- package/src/storage.ts +50 -0
- package/src/translations.ts +62 -15
- package/src/types.ts +36 -0
- package/dist/lib/browser/app-graph-builder-5BKKIS5T.mjs +0 -162
- package/dist/lib/browser/app-graph-builder-5BKKIS5T.mjs.map +0 -7
- package/dist/lib/browser/chunk-MWZPWWWF.mjs +0 -14
- package/dist/lib/browser/chunk-MWZPWWWF.mjs.map +0 -7
- package/dist/lib/browser/index.mjs +0 -69
- package/dist/lib/browser/index.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-RUD6WFGT.mjs +0 -23
- package/dist/lib/browser/intent-resolver-RUD6WFGT.mjs.map +0 -7
- package/dist/lib/browser/meta.json +0 -1
- package/dist/lib/browser/react-surface-FYRVOQGA.mjs +0 -335
- package/dist/lib/browser/react-surface-FYRVOQGA.mjs.map +0 -7
- package/dist/types/src/capabilities/intent-resolver.d.ts +0 -4
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +0 -1
- package/dist/types/src/components/Icon.stories.d.ts +0 -14
- package/dist/types/src/components/Icon.stories.d.ts.map +0 -1
- package/dist/types/src/components/PluginDetail.d.ts +0 -9
- package/dist/types/src/components/PluginDetail.d.ts.map +0 -1
- package/dist/types/src/components/PluginDetail.stories.d.ts +0 -32
- package/dist/types/src/components/PluginDetail.stories.d.ts.map +0 -1
- package/dist/types/src/components/PluginItem.d.ts +0 -13
- package/dist/types/src/components/PluginItem.d.ts.map +0 -1
- package/dist/types/src/components/PluginList.d.ts +0 -8
- package/dist/types/src/components/PluginList.d.ts.map +0 -1
- package/dist/types/src/components/PluginList.stories.d.ts +0 -36
- package/dist/types/src/components/PluginList.stories.d.ts.map +0 -1
- package/dist/types/src/components/RegistryContainer.d.ts +0 -7
- package/dist/types/src/components/RegistryContainer.d.ts.map +0 -1
- package/src/capabilities/intent-resolver.ts +0 -27
- package/src/components/Icon.stories.tsx +0 -110
- package/src/components/PluginDetail.stories.tsx +0 -44
- package/src/components/PluginDetail.tsx +0 -65
- package/src/components/PluginItem.tsx +0 -119
- package/src/components/PluginList.stories.tsx +0 -82
- package/src/components/PluginList.tsx +0 -26
- package/src/components/RegistryContainer.tsx +0 -84
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
|
|
7
|
+
import { Capabilities, Capability } from '@dxos/app-framework';
|
|
8
|
+
import type { OperationHandlerSet } from '@dxos/compute';
|
|
9
|
+
|
|
10
|
+
import { RegistryOperationHandlerSet } from '#operations';
|
|
11
|
+
|
|
12
|
+
export default Capability.makeModule<OperationHandlerSet.OperationHandlerSet>(
|
|
13
|
+
Effect.fnUntraced(function* () {
|
|
14
|
+
return Capability.contributes(Capabilities.OperationHandler, RegistryOperationHandlerSet);
|
|
15
|
+
}),
|
|
16
|
+
);
|
|
@@ -2,84 +2,144 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
import React, { type ComponentProps, useMemo } from 'react';
|
|
6
7
|
|
|
7
|
-
import { Capabilities,
|
|
8
|
+
import { Capabilities, Capability, Plugin } from '@dxos/app-framework';
|
|
9
|
+
import { Surface, usePluginManager } from '@dxos/app-framework/ui';
|
|
10
|
+
import { AppCapabilities } from '@dxos/app-toolkit';
|
|
11
|
+
import { AppSurface } from '@dxos/app-toolkit/ui';
|
|
8
12
|
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
13
|
+
import { DisableDependentsAlert } from '#components';
|
|
14
|
+
import {
|
|
15
|
+
LOAD_PLUGIN_DIALOG,
|
|
16
|
+
LoadPluginDialog,
|
|
17
|
+
PluginArticle,
|
|
18
|
+
PublicRegistryArticle,
|
|
19
|
+
RegistryArticle,
|
|
20
|
+
RegistrySettingsContainer,
|
|
21
|
+
} from '#containers';
|
|
22
|
+
import { DISABLE_DEPENDENTS_DIALOG, meta, registryCategoryId } from '#meta';
|
|
11
23
|
|
|
12
|
-
|
|
13
|
-
contributes(Capabilities.ReactSurface, [
|
|
14
|
-
createSurface({
|
|
15
|
-
id: `${meta.id}/all`,
|
|
16
|
-
role: 'article',
|
|
17
|
-
filter: (data): data is any => data.subject === `${REGISTRY_KEY}+all`,
|
|
18
|
-
component: () => {
|
|
19
|
-
const manager = usePluginManager();
|
|
20
|
-
const filtered = useMemo(() => manager.plugins.filter(({ meta }) => !manager.core.includes(meta.id)), []);
|
|
24
|
+
import { useAutoTags, useRegistryPlugins, useRemotePluginIds } from '../hooks';
|
|
21
25
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
(
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
26
|
+
export default Capability.makeModule(() =>
|
|
27
|
+
Effect.succeed(
|
|
28
|
+
Capability.contributes(Capabilities.ReactSurface, [
|
|
29
|
+
Surface.create({
|
|
30
|
+
id: 'bundled',
|
|
31
|
+
filter: AppSurface.literal(AppSurface.Article, registryCategoryId('bundled')),
|
|
32
|
+
component: () => {
|
|
33
|
+
const manager = usePluginManager();
|
|
34
|
+
const remoteIds = useRemotePluginIds();
|
|
35
|
+
const core = useMemo(() => manager.getCore(), [manager]);
|
|
36
|
+
const predicate = useMemo<PluginPredicate>(
|
|
37
|
+
() =>
|
|
38
|
+
({ meta }) =>
|
|
39
|
+
!core.includes(meta.id) && !remoteIds.has(meta.id),
|
|
40
|
+
[core, remoteIds],
|
|
41
|
+
);
|
|
38
42
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
(
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
43
|
+
return <FilteredRegistryArticle id={registryCategoryId('bundled')} filter={predicate} />;
|
|
44
|
+
},
|
|
45
|
+
}),
|
|
46
|
+
Surface.create({
|
|
47
|
+
id: 'installed',
|
|
48
|
+
filter: AppSurface.literal(AppSurface.Article, registryCategoryId('installed')),
|
|
49
|
+
component: () => {
|
|
50
|
+
const manager = usePluginManager();
|
|
51
|
+
const core = useMemo(() => manager.getCore(), [manager]);
|
|
52
|
+
const enabled = useMemo(() => manager.getEnabled(), [manager]);
|
|
53
|
+
const predicate = useMemo<PluginPredicate>(
|
|
54
|
+
() =>
|
|
55
|
+
({ meta }) =>
|
|
56
|
+
!core.includes(meta.id) && enabled.includes(meta.id),
|
|
57
|
+
[core, enabled],
|
|
58
|
+
);
|
|
55
59
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
60
|
+
return <FilteredRegistryArticle id={registryCategoryId('installed')} filter={predicate} />;
|
|
61
|
+
},
|
|
62
|
+
}),
|
|
63
|
+
Surface.create({
|
|
64
|
+
id: 'recommended',
|
|
65
|
+
filter: AppSurface.literal(AppSurface.Article, registryCategoryId('recommended')),
|
|
66
|
+
component: () => {
|
|
67
|
+
const manager = usePluginManager();
|
|
68
|
+
const remoteIds = useRemotePluginIds();
|
|
69
|
+
const core = useMemo(() => manager.getCore(), [manager]);
|
|
70
|
+
const predicate = useMemo<PluginPredicate>(
|
|
71
|
+
() =>
|
|
72
|
+
({ meta }) =>
|
|
73
|
+
!core.includes(meta.id) && !remoteIds.has(meta.id) && !meta.tags?.includes('labs'),
|
|
74
|
+
[core, remoteIds],
|
|
75
|
+
);
|
|
66
76
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
);
|
|
77
|
+
return <FilteredRegistryArticle id={registryCategoryId('recommended')} filter={predicate} />;
|
|
78
|
+
},
|
|
79
|
+
}),
|
|
80
|
+
Surface.create({
|
|
81
|
+
id: 'labs',
|
|
82
|
+
filter: AppSurface.literal(AppSurface.Article, registryCategoryId('labs')),
|
|
83
|
+
component: () => {
|
|
84
|
+
const predicate = useMemo<PluginPredicate>(
|
|
85
|
+
() =>
|
|
86
|
+
({ meta }) =>
|
|
87
|
+
meta.tags?.includes('labs') ?? false,
|
|
88
|
+
[],
|
|
89
|
+
);
|
|
81
90
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
91
|
+
return <FilteredRegistryArticle id={registryCategoryId('labs')} filter={predicate} />;
|
|
92
|
+
},
|
|
93
|
+
}),
|
|
94
|
+
Surface.create({
|
|
95
|
+
id: 'registry',
|
|
96
|
+
filter: AppSurface.literal(AppSurface.Article, registryCategoryId('registry')),
|
|
97
|
+
component: () => <PublicRegistryArticle id={registryCategoryId('registry')} />,
|
|
98
|
+
}),
|
|
99
|
+
Surface.create({
|
|
100
|
+
id: 'plugin-details',
|
|
101
|
+
filter: AppSurface.subject(AppSurface.Article, Plugin.isPlugin),
|
|
102
|
+
component: ({ data: { subject } }) => {
|
|
103
|
+
return <PluginArticle subject={subject} />;
|
|
104
|
+
},
|
|
105
|
+
}),
|
|
106
|
+
Surface.create({
|
|
107
|
+
id: LOAD_PLUGIN_DIALOG,
|
|
108
|
+
filter: AppSurface.component(AppSurface.Dialog, LOAD_PLUGIN_DIALOG),
|
|
109
|
+
component: () => <LoadPluginDialog />,
|
|
110
|
+
}),
|
|
111
|
+
Surface.create({
|
|
112
|
+
id: DISABLE_DEPENDENTS_DIALOG,
|
|
113
|
+
filter: AppSurface.component<ComponentProps<typeof DisableDependentsAlert>>(
|
|
114
|
+
AppSurface.Dialog,
|
|
115
|
+
DISABLE_DEPENDENTS_DIALOG,
|
|
116
|
+
),
|
|
117
|
+
component: ({ data }) => <DisableDependentsAlert {...data.props} />,
|
|
118
|
+
}),
|
|
119
|
+
Surface.create({
|
|
120
|
+
id: 'plugin-settings',
|
|
121
|
+
role: 'article',
|
|
122
|
+
filter: (data): data is { subject: AppCapabilities.Settings } =>
|
|
123
|
+
AppCapabilities.isSettings(data.subject) && data.subject.prefix === meta.id,
|
|
124
|
+
component: ({ data: { subject } }) => <RegistrySettingsContainer subject={subject} />,
|
|
125
|
+
}),
|
|
126
|
+
]),
|
|
127
|
+
),
|
|
128
|
+
);
|
|
129
|
+
|
|
130
|
+
type PluginPredicate = (plugin: Plugin.Plugin) => boolean;
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Renders the {@link RegistryArticle} surface filtered by an arbitrary
|
|
134
|
+
* predicate computed against the live plugin list. Centralises the
|
|
135
|
+
* `usePluginManager` + `useRegistryPlugins` + `useAutoTags` wiring shared
|
|
136
|
+
* by every category surface.
|
|
137
|
+
*/
|
|
138
|
+
const FilteredRegistryArticle = ({ id, filter }: { id: string; filter: PluginPredicate }) => {
|
|
139
|
+
const manager = usePluginManager();
|
|
140
|
+
const { entries } = useRegistryPlugins();
|
|
141
|
+
const extraTagsById = useAutoTags(entries);
|
|
142
|
+
const filtered = useMemo(() => manager.getPlugins().filter(filter), [manager, filter]);
|
|
143
|
+
|
|
144
|
+
return <RegistryArticle id={id} plugins={filtered} extraTagsById={extraTagsById} />;
|
|
145
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2026 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
|
|
7
|
+
import { Capability, PLUGIN_DEV_SERVER_PORT } from '@dxos/app-framework';
|
|
8
|
+
import { AppCapabilities } from '@dxos/app-toolkit';
|
|
9
|
+
import { createKvsStore } from '@dxos/effect';
|
|
10
|
+
|
|
11
|
+
import { meta } from '#meta';
|
|
12
|
+
|
|
13
|
+
import { RegistryCapabilities, RegistrySettingsSchema } from '../types';
|
|
14
|
+
|
|
15
|
+
const DEFAULT_DEV_PLUGIN_URL = `http://localhost:${PLUGIN_DEV_SERVER_PORT}/manifest.json`;
|
|
16
|
+
|
|
17
|
+
export default Capability.makeModule(() =>
|
|
18
|
+
Effect.sync(() => {
|
|
19
|
+
const settingsAtom = createKvsStore({
|
|
20
|
+
key: meta.id,
|
|
21
|
+
schema: RegistrySettingsSchema,
|
|
22
|
+
defaultValue: () => ({ devPluginUrl: DEFAULT_DEV_PLUGIN_URL }),
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
return [
|
|
26
|
+
Capability.contributes(RegistryCapabilities.Settings, settingsAtom),
|
|
27
|
+
Capability.contributes(AppCapabilities.Settings, {
|
|
28
|
+
prefix: meta.id,
|
|
29
|
+
schema: RegistrySettingsSchema,
|
|
30
|
+
atom: settingsAtom,
|
|
31
|
+
}),
|
|
32
|
+
];
|
|
33
|
+
}),
|
|
34
|
+
);
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Args from '@effect/cli/Args';
|
|
6
|
+
import * as Command from '@effect/cli/Command';
|
|
7
|
+
import * as Console from 'effect/Console';
|
|
8
|
+
import * as Effect from 'effect/Effect';
|
|
9
|
+
|
|
10
|
+
import { Plugin } from '@dxos/app-framework';
|
|
11
|
+
import { CommandConfig } from '@dxos/cli-util';
|
|
12
|
+
import { invariant } from '@dxos/invariant';
|
|
13
|
+
|
|
14
|
+
import { saveEnabledPlugins } from '../storage';
|
|
15
|
+
|
|
16
|
+
export const handler = Effect.fn(function* ({ id }: { id: string }) {
|
|
17
|
+
const { json, profile } = yield* CommandConfig;
|
|
18
|
+
const manager = yield* Plugin.Service;
|
|
19
|
+
|
|
20
|
+
const plugins = manager.getPlugins();
|
|
21
|
+
const plugin = plugins.find((p: Plugin.Plugin) => p.meta.id === id);
|
|
22
|
+
invariant(plugin, `Plugin not found: ${id}`);
|
|
23
|
+
|
|
24
|
+
const core = manager.getCore();
|
|
25
|
+
invariant(!core.includes(id), `Cannot disable core plugin: ${id}`);
|
|
26
|
+
|
|
27
|
+
const disabled = yield* manager.disable(id);
|
|
28
|
+
invariant(disabled, `Failed to disable plugin: ${id}`);
|
|
29
|
+
|
|
30
|
+
// Save enabled plugins to storage
|
|
31
|
+
const enabledPlugins = manager.getEnabled();
|
|
32
|
+
yield* saveEnabledPlugins({ profile, enabled: [...enabledPlugins] });
|
|
33
|
+
|
|
34
|
+
if (json) {
|
|
35
|
+
yield* Console.log(JSON.stringify({ id, enabled: false }, null, 2));
|
|
36
|
+
} else {
|
|
37
|
+
yield* Console.log(`Plugin "${plugin.meta.name ?? id}" disabled.`);
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
export const disable = Command.make(
|
|
42
|
+
'disable',
|
|
43
|
+
{
|
|
44
|
+
id: Args.text({ name: 'id' }).pipe(Args.withDescription('The ID of the plugin to disable.')),
|
|
45
|
+
},
|
|
46
|
+
handler,
|
|
47
|
+
).pipe(Command.withDescription('Disable a plugin.'));
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Args from '@effect/cli/Args';
|
|
6
|
+
import * as Command from '@effect/cli/Command';
|
|
7
|
+
import * as Console from 'effect/Console';
|
|
8
|
+
import * as Effect from 'effect/Effect';
|
|
9
|
+
|
|
10
|
+
import { Plugin } from '@dxos/app-framework';
|
|
11
|
+
import { CommandConfig } from '@dxos/cli-util';
|
|
12
|
+
import { invariant } from '@dxos/invariant';
|
|
13
|
+
|
|
14
|
+
import { saveEnabledPlugins } from '../storage';
|
|
15
|
+
|
|
16
|
+
export const handler = Effect.fn(function* ({ id }: { id: string }) {
|
|
17
|
+
const { json, profile } = yield* CommandConfig;
|
|
18
|
+
const manager = yield* Plugin.Service;
|
|
19
|
+
|
|
20
|
+
const plugins = manager.getPlugins();
|
|
21
|
+
const plugin = plugins.find((p: Plugin.Plugin) => p.meta.id === id);
|
|
22
|
+
invariant(plugin, `Plugin not found: ${id}`);
|
|
23
|
+
|
|
24
|
+
const enabled = yield* manager.enable(id);
|
|
25
|
+
invariant(enabled, `Failed to enable plugin: ${id}`);
|
|
26
|
+
|
|
27
|
+
// Save enabled plugins to storage
|
|
28
|
+
const enabledPlugins = manager.getEnabled();
|
|
29
|
+
yield* saveEnabledPlugins({ profile, enabled: [...enabledPlugins] });
|
|
30
|
+
|
|
31
|
+
if (json) {
|
|
32
|
+
yield* Console.log(JSON.stringify({ id, enabled: true }, null, 2));
|
|
33
|
+
} else {
|
|
34
|
+
yield* Console.log(`Plugin "${plugin.meta.name ?? id}" enabled.`);
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
export const enable = Command.make(
|
|
39
|
+
'enable',
|
|
40
|
+
{
|
|
41
|
+
id: Args.text({ name: 'id' }).pipe(Args.withDescription('The ID of the plugin to enable.')),
|
|
42
|
+
},
|
|
43
|
+
handler,
|
|
44
|
+
).pipe(Command.withDescription('Enable a plugin.'));
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Command from '@effect/cli/Command';
|
|
6
|
+
|
|
7
|
+
import { disable } from './disable';
|
|
8
|
+
import { enable } from './enable';
|
|
9
|
+
import { list } from './list';
|
|
10
|
+
|
|
11
|
+
export const plugin: Command.Command<any, any, any, any> = Command.make('plugin').pipe(
|
|
12
|
+
Command.withDescription('Manage plugins.'),
|
|
13
|
+
Command.withSubcommands([enable, disable, list]),
|
|
14
|
+
);
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Command from '@effect/cli/Command';
|
|
6
|
+
import * as Console from 'effect/Console';
|
|
7
|
+
import * as Effect from 'effect/Effect';
|
|
8
|
+
|
|
9
|
+
import { Plugin } from '@dxos/app-framework';
|
|
10
|
+
import { CommandConfig, printList } from '@dxos/cli-util';
|
|
11
|
+
|
|
12
|
+
import { type FormattedPlugin, printPlugin } from './util';
|
|
13
|
+
|
|
14
|
+
export const handler = Effect.fn(function* () {
|
|
15
|
+
const { json } = yield* CommandConfig;
|
|
16
|
+
const manager = yield* Plugin.Service;
|
|
17
|
+
|
|
18
|
+
const plugins = manager.getPlugins();
|
|
19
|
+
const enabled = manager.getEnabled();
|
|
20
|
+
const core = manager.getCore();
|
|
21
|
+
|
|
22
|
+
const formattedPlugins: FormattedPlugin[] = plugins.map((plugin: Plugin.Plugin) => {
|
|
23
|
+
const isEnabled = enabled.includes(plugin.meta.id);
|
|
24
|
+
const isCore = core.includes(plugin.meta.id);
|
|
25
|
+
return {
|
|
26
|
+
id: plugin.meta.id,
|
|
27
|
+
name: plugin.meta.name ?? plugin.meta.id,
|
|
28
|
+
enabled: isEnabled,
|
|
29
|
+
core: isCore,
|
|
30
|
+
};
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
if (json) {
|
|
34
|
+
yield* Console.log(JSON.stringify(formattedPlugins, null, 2));
|
|
35
|
+
} else {
|
|
36
|
+
const formatted = formattedPlugins.map(printPlugin);
|
|
37
|
+
yield* Console.log(printList(formatted));
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
export const list = Command.make('list', {}, handler).pipe(Command.withDescription('List all available plugins.'));
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { FormBuilder } from '@dxos/cli-util';
|
|
6
|
+
|
|
7
|
+
export type FormattedPlugin = {
|
|
8
|
+
id: string;
|
|
9
|
+
name: string;
|
|
10
|
+
enabled: boolean;
|
|
11
|
+
core: boolean;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Pretty prints a plugin with ANSI colors.
|
|
16
|
+
*/
|
|
17
|
+
export const printPlugin = (plugin: FormattedPlugin) => {
|
|
18
|
+
const status = plugin.core ? 'core' : plugin.enabled ? 'enabled' : 'disabled';
|
|
19
|
+
return FormBuilder.make({ title: plugin.name }).pipe(
|
|
20
|
+
FormBuilder.set('id', plugin.id),
|
|
21
|
+
FormBuilder.set('status', status),
|
|
22
|
+
FormBuilder.build,
|
|
23
|
+
);
|
|
24
|
+
};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2026 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React from 'react';
|
|
6
|
+
|
|
7
|
+
import { AlertDialog, Button, useTranslation } from '@dxos/react-ui';
|
|
8
|
+
|
|
9
|
+
import { meta } from '#meta';
|
|
10
|
+
|
|
11
|
+
export type DisableDependentsAlertProps = {
|
|
12
|
+
/** Id of the plugin the user requested to disable. */
|
|
13
|
+
pluginId: string;
|
|
14
|
+
/** Ids of the currently-enabled dependents that would also be disabled. */
|
|
15
|
+
dependents: readonly string[];
|
|
16
|
+
/**
|
|
17
|
+
* Resolves a plugin id to its display name. The component delegates this so
|
|
18
|
+
* the parent can choose how to source names (typically the registered
|
|
19
|
+
* `Plugin.Meta.name`). Falls back to the id when omitted.
|
|
20
|
+
*/
|
|
21
|
+
onResolvePluginName?: (pluginId: string) => string;
|
|
22
|
+
onConfirm: () => void;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Confirmation prompt shown when a user toggles off a plugin that has
|
|
27
|
+
* currently-enabled dependents. Rendered inside the layout's dialog surface
|
|
28
|
+
* (via `LayoutOperation.UpdateDialog` with `type: 'alert'`), which provides
|
|
29
|
+
* the `AlertDialog.Root` / `Overlay` wrappers — this component renders only
|
|
30
|
+
* the content. `onConfirm` runs the cascade disable and closes the dialog;
|
|
31
|
+
* cancel is handled by the layout's open-change wiring.
|
|
32
|
+
*/
|
|
33
|
+
export const DisableDependentsAlert = ({
|
|
34
|
+
pluginId,
|
|
35
|
+
dependents,
|
|
36
|
+
onResolvePluginName,
|
|
37
|
+
onConfirm,
|
|
38
|
+
}: DisableDependentsAlertProps) => {
|
|
39
|
+
const { t } = useTranslation(meta.id);
|
|
40
|
+
const resolveName = onResolvePluginName ?? ((id: string) => id);
|
|
41
|
+
return (
|
|
42
|
+
<AlertDialog.Content>
|
|
43
|
+
<AlertDialog.Body>
|
|
44
|
+
<AlertDialog.Title>{t('disable-dependents-dialog.title')}</AlertDialog.Title>
|
|
45
|
+
<AlertDialog.Description>
|
|
46
|
+
{t('disable-dependents-dialog.description', { plugin: resolveName(pluginId) })}
|
|
47
|
+
</AlertDialog.Description>
|
|
48
|
+
<ul className='mt-2 list-disc pl-6 text-sm text-description'>
|
|
49
|
+
{dependents.map((dependentId) => (
|
|
50
|
+
<li key={dependentId} title={dependentId}>
|
|
51
|
+
{resolveName(dependentId)}
|
|
52
|
+
</li>
|
|
53
|
+
))}
|
|
54
|
+
</ul>
|
|
55
|
+
</AlertDialog.Body>
|
|
56
|
+
<AlertDialog.ActionBar>
|
|
57
|
+
<div className='grow' />
|
|
58
|
+
<AlertDialog.Cancel asChild>
|
|
59
|
+
<Button>{t('cancel.label')}</Button>
|
|
60
|
+
</AlertDialog.Cancel>
|
|
61
|
+
<AlertDialog.Action asChild>
|
|
62
|
+
<Button variant='primary' onClick={onConfirm}>
|
|
63
|
+
{t('disable-dependents-dialog.confirm.label')}
|
|
64
|
+
</Button>
|
|
65
|
+
</AlertDialog.Action>
|
|
66
|
+
</AlertDialog.ActionBar>
|
|
67
|
+
</AlertDialog.Content>
|
|
68
|
+
);
|
|
69
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
6
|
+
|
|
7
|
+
import { Plugin } from '@dxos/app-framework';
|
|
8
|
+
import { random } from '@dxos/random';
|
|
9
|
+
import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
10
|
+
|
|
11
|
+
import { translations } from '#translations';
|
|
12
|
+
|
|
13
|
+
import { PluginDetail } from './PluginDetail';
|
|
14
|
+
|
|
15
|
+
const meta = {
|
|
16
|
+
title: 'plugins/plugin-registry/components/PluginDetail',
|
|
17
|
+
component: PluginDetail,
|
|
18
|
+
decorators: [withTheme(), withLayout({ layout: 'column' })],
|
|
19
|
+
parameters: {
|
|
20
|
+
layout: 'fullscreen',
|
|
21
|
+
translations,
|
|
22
|
+
},
|
|
23
|
+
} satisfies Meta<typeof PluginDetail>;
|
|
24
|
+
|
|
25
|
+
export default meta;
|
|
26
|
+
|
|
27
|
+
type Story = StoryObj<typeof meta>;
|
|
28
|
+
|
|
29
|
+
export const Default: Story = {
|
|
30
|
+
args: {
|
|
31
|
+
plugin: Plugin.define({
|
|
32
|
+
id: 'com.example.plugin.test',
|
|
33
|
+
name: 'Test Plugin',
|
|
34
|
+
author: 'DXOS',
|
|
35
|
+
description: random.lorem.paragraphs(2),
|
|
36
|
+
icon: 'ph--bug--regular',
|
|
37
|
+
iconHue: 'sky',
|
|
38
|
+
homePage: 'https://example.com',
|
|
39
|
+
source: 'https://github.com/example/test-plugin',
|
|
40
|
+
screenshots: [
|
|
41
|
+
'https://media.gcflearnfree.org/content/55e073de7dd48174331f51b3_01_17_2014/getting_started_interactive2.png',
|
|
42
|
+
],
|
|
43
|
+
}).pipe(Plugin.make)(),
|
|
44
|
+
},
|
|
45
|
+
};
|