@dxos/plugin-registry 0.8.4-main.fffef41 → 0.8.4-staging.60fe92afc8

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.
Files changed (233) hide show
  1. package/LICENSE +102 -5
  2. package/dist/lib/neutral/RegistryPlugin.mjs +27 -0
  3. package/dist/lib/neutral/RegistryPlugin.mjs.map +7 -0
  4. package/dist/lib/neutral/RegistryPlugin.node.mjs +153 -0
  5. package/dist/lib/neutral/RegistryPlugin.node.mjs.map +7 -0
  6. package/dist/lib/neutral/RegistryPlugin.workerd.mjs +10 -0
  7. package/dist/lib/neutral/RegistryPlugin.workerd.mjs.map +7 -0
  8. package/dist/lib/neutral/chunk-GRQI6MLI.mjs +36 -0
  9. package/dist/lib/neutral/chunk-GRQI6MLI.mjs.map +7 -0
  10. package/dist/lib/neutral/chunk-XK2JMH3H.mjs +33 -0
  11. package/dist/lib/neutral/chunk-XK2JMH3H.mjs.map +7 -0
  12. package/dist/lib/neutral/index.mjs +25 -0
  13. package/dist/lib/neutral/index.mjs.map +7 -0
  14. package/dist/lib/neutral/meta.json +1 -0
  15. package/dist/lib/neutral/open-plugin-registry-II735N76.mjs +15 -0
  16. package/dist/lib/neutral/open-plugin-registry-II735N76.mjs.map +7 -0
  17. package/dist/lib/neutral/plugin.mjs +18 -0
  18. package/dist/lib/neutral/plugin.mjs.map +7 -0
  19. package/dist/lib/neutral/translations.mjs +72 -0
  20. package/dist/lib/neutral/translations.mjs.map +7 -0
  21. package/dist/types/src/RegistryPlugin.d.ts +3 -1
  22. package/dist/types/src/RegistryPlugin.d.ts.map +1 -1
  23. package/dist/types/src/RegistryPlugin.node.d.ts +4 -0
  24. package/dist/types/src/RegistryPlugin.node.d.ts.map +1 -0
  25. package/dist/types/src/RegistryPlugin.test.d.ts +2 -0
  26. package/dist/types/src/RegistryPlugin.test.d.ts.map +1 -0
  27. package/dist/types/src/RegistryPlugin.workerd.d.ts +4 -0
  28. package/dist/types/src/RegistryPlugin.workerd.d.ts.map +1 -0
  29. package/dist/types/src/capabilities/app-graph-builder.d.ts +4 -2
  30. package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
  31. package/dist/types/src/capabilities/dev-plugin-loader.d.ts +11 -0
  32. package/dist/types/src/capabilities/dev-plugin-loader.d.ts.map +1 -0
  33. package/dist/types/src/capabilities/index.d.ts +15 -3
  34. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  35. package/dist/types/src/capabilities/operation-handler.d.ts +6 -0
  36. package/dist/types/src/capabilities/operation-handler.d.ts.map +1 -0
  37. package/dist/types/src/capabilities/react-surface.d.ts +3 -2
  38. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
  39. package/dist/types/src/capabilities/settings.d.ts +14 -0
  40. package/dist/types/src/capabilities/settings.d.ts.map +1 -0
  41. package/dist/types/src/categories.d.ts +18 -0
  42. package/dist/types/src/categories.d.ts.map +1 -0
  43. package/dist/types/src/commands/disable.d.ts +11 -0
  44. package/dist/types/src/commands/disable.d.ts.map +1 -0
  45. package/dist/types/src/commands/enable.d.ts +11 -0
  46. package/dist/types/src/commands/enable.d.ts.map +1 -0
  47. package/dist/types/src/commands/index.d.ts +3 -0
  48. package/dist/types/src/commands/index.d.ts.map +1 -0
  49. package/dist/types/src/commands/list.d.ts +7 -0
  50. package/dist/types/src/commands/list.d.ts.map +1 -0
  51. package/dist/types/src/commands/util.d.ts +11 -0
  52. package/dist/types/src/commands/util.d.ts.map +1 -0
  53. package/dist/types/src/components/DisableDependentsAlert/DisableDependentsAlert.d.ts +24 -0
  54. package/dist/types/src/components/DisableDependentsAlert/DisableDependentsAlert.d.ts.map +1 -0
  55. package/dist/types/src/components/DisableDependentsAlert/index.d.ts +2 -0
  56. package/dist/types/src/components/DisableDependentsAlert/index.d.ts.map +1 -0
  57. package/dist/types/src/components/PluginDetail/PluginDetail.d.ts +82 -0
  58. package/dist/types/src/components/PluginDetail/PluginDetail.d.ts.map +1 -0
  59. package/dist/types/src/components/PluginDetail/PluginDetail.stories.d.ts +79 -0
  60. package/dist/types/src/components/PluginDetail/PluginDetail.stories.d.ts.map +1 -0
  61. package/dist/types/src/components/PluginDetail/index.d.ts +2 -0
  62. package/dist/types/src/components/PluginDetail/index.d.ts.map +1 -0
  63. package/dist/types/src/components/PluginFailureBadge/PluginFailureBadge.d.ts +20 -0
  64. package/dist/types/src/components/PluginFailureBadge/PluginFailureBadge.d.ts.map +1 -0
  65. package/dist/types/src/components/PluginFailureBadge/index.d.ts +2 -0
  66. package/dist/types/src/components/PluginFailureBadge/index.d.ts.map +1 -0
  67. package/dist/types/src/components/PluginList/PluginItem.d.ts +40 -0
  68. package/dist/types/src/components/PluginList/PluginItem.d.ts.map +1 -0
  69. package/dist/types/src/components/PluginList/PluginList.d.ts +23 -0
  70. package/dist/types/src/components/PluginList/PluginList.d.ts.map +1 -0
  71. package/dist/types/src/components/PluginList/PluginList.stories.d.ts +78 -0
  72. package/dist/types/src/components/PluginList/PluginList.stories.d.ts.map +1 -0
  73. package/dist/types/src/components/PluginList/index.d.ts +2 -0
  74. package/dist/types/src/components/PluginList/index.d.ts.map +1 -0
  75. package/dist/types/src/components/RegistrySettings/RegistrySettings.d.ts +18 -0
  76. package/dist/types/src/components/RegistrySettings/RegistrySettings.d.ts.map +1 -0
  77. package/dist/types/src/components/RegistrySettings/index.d.ts +2 -0
  78. package/dist/types/src/components/RegistrySettings/index.d.ts.map +1 -0
  79. package/dist/types/src/components/index.d.ts +3 -1
  80. package/dist/types/src/components/index.d.ts.map +1 -1
  81. package/dist/types/src/containers/BaseRegistryArticle/BaseRegistryArticle.d.ts +20 -0
  82. package/dist/types/src/containers/BaseRegistryArticle/BaseRegistryArticle.d.ts.map +1 -0
  83. package/dist/types/src/containers/BaseRegistryArticle/index.d.ts +2 -0
  84. package/dist/types/src/containers/BaseRegistryArticle/index.d.ts.map +1 -0
  85. package/dist/types/src/containers/LoadPluginDialog/LoadPluginDialog.d.ts +5 -0
  86. package/dist/types/src/containers/LoadPluginDialog/LoadPluginDialog.d.ts.map +1 -0
  87. package/dist/types/src/containers/LoadPluginDialog/index.d.ts +2 -0
  88. package/dist/types/src/containers/LoadPluginDialog/index.d.ts.map +1 -0
  89. package/dist/types/src/containers/PluginArticle/PluginArticle.d.ts +7 -0
  90. package/dist/types/src/containers/PluginArticle/PluginArticle.d.ts.map +1 -0
  91. package/dist/types/src/containers/PluginArticle/index.d.ts +2 -0
  92. package/dist/types/src/containers/PluginArticle/index.d.ts.map +1 -0
  93. package/dist/types/src/containers/PublicRegistryArticle/PublicRegistryArticle.d.ts +8 -0
  94. package/dist/types/src/containers/PublicRegistryArticle/PublicRegistryArticle.d.ts.map +1 -0
  95. package/dist/types/src/containers/PublicRegistryArticle/index.d.ts +2 -0
  96. package/dist/types/src/containers/PublicRegistryArticle/index.d.ts.map +1 -0
  97. package/dist/types/src/containers/RegistryArticle/RegistryArticle.d.ts +14 -0
  98. package/dist/types/src/containers/RegistryArticle/RegistryArticle.d.ts.map +1 -0
  99. package/dist/types/src/containers/RegistryArticle/index.d.ts +2 -0
  100. package/dist/types/src/containers/RegistryArticle/index.d.ts.map +1 -0
  101. package/dist/types/src/containers/RegistrySettingsContainer/RegistrySettingsContainer.d.ts +13 -0
  102. package/dist/types/src/containers/RegistrySettingsContainer/RegistrySettingsContainer.d.ts.map +1 -0
  103. package/dist/types/src/containers/RegistrySettingsContainer/index.d.ts +2 -0
  104. package/dist/types/src/containers/RegistrySettingsContainer/index.d.ts.map +1 -0
  105. package/dist/types/src/containers/index.d.ts +8 -0
  106. package/dist/types/src/containers/index.d.ts.map +1 -0
  107. package/dist/types/src/hooks/index.d.ts +9 -0
  108. package/dist/types/src/hooks/index.d.ts.map +1 -0
  109. package/dist/types/src/hooks/useAutoTags.d.ts +20 -0
  110. package/dist/types/src/hooks/useAutoTags.d.ts.map +1 -0
  111. package/dist/types/src/hooks/useCatalogEntry.d.ts +11 -0
  112. package/dist/types/src/hooks/useCatalogEntry.d.ts.map +1 -0
  113. package/dist/types/src/hooks/useDisableConfirmation.d.ts +19 -0
  114. package/dist/types/src/hooks/useDisableConfirmation.d.ts.map +1 -0
  115. package/dist/types/src/hooks/useInstalledVersionTag.d.ts +18 -0
  116. package/dist/types/src/hooks/useInstalledVersionTag.d.ts.map +1 -0
  117. package/dist/types/src/hooks/usePluginActions.d.ts +36 -0
  118. package/dist/types/src/hooks/usePluginActions.d.ts.map +1 -0
  119. package/dist/types/src/hooks/useRegistryPlugins.d.ts +15 -0
  120. package/dist/types/src/hooks/useRegistryPlugins.d.ts.map +1 -0
  121. package/dist/types/src/hooks/useUpdateAvailable.d.ts +18 -0
  122. package/dist/types/src/hooks/useUpdateAvailable.d.ts.map +1 -0
  123. package/dist/types/src/hooks/useVersionPicker.d.ts +21 -0
  124. package/dist/types/src/hooks/useVersionPicker.d.ts.map +1 -0
  125. package/dist/types/src/index.d.ts +1 -1
  126. package/dist/types/src/index.d.ts.map +1 -1
  127. package/dist/types/src/meta.d.ts +21 -3
  128. package/dist/types/src/meta.d.ts.map +1 -1
  129. package/dist/types/src/operations/index.d.ts +3 -0
  130. package/dist/types/src/operations/index.d.ts.map +1 -0
  131. package/dist/types/src/operations/open-plugin-registry.d.ts +5 -0
  132. package/dist/types/src/operations/open-plugin-registry.d.ts.map +1 -0
  133. package/dist/types/src/plugin.d.ts +4 -0
  134. package/dist/types/src/plugin.d.ts.map +1 -0
  135. package/dist/types/src/storage.d.ts +18 -0
  136. package/dist/types/src/storage.d.ts.map +1 -0
  137. package/dist/types/src/translations.d.ts +59 -16
  138. package/dist/types/src/translations.d.ts.map +1 -1
  139. package/dist/types/src/types.d.ts +30 -1
  140. package/dist/types/src/types.d.ts.map +1 -1
  141. package/dist/types/tsconfig.tsbuildinfo +1 -1
  142. package/package.json +76 -35
  143. package/src/RegistryPlugin.node.ts +19 -0
  144. package/src/RegistryPlugin.test.ts +24 -0
  145. package/src/RegistryPlugin.tsx +19 -25
  146. package/src/RegistryPlugin.workerd.ts +11 -0
  147. package/src/capabilities/app-graph-builder.ts +199 -136
  148. package/src/capabilities/dev-plugin-loader.ts +39 -0
  149. package/src/capabilities/index.ts +10 -4
  150. package/src/capabilities/operation-handler.ts +16 -0
  151. package/src/capabilities/react-surface.tsx +115 -75
  152. package/src/capabilities/settings.ts +34 -0
  153. package/src/categories.ts +44 -0
  154. package/src/commands/disable.ts +47 -0
  155. package/src/commands/enable.ts +44 -0
  156. package/src/commands/index.ts +14 -0
  157. package/src/commands/list.ts +41 -0
  158. package/src/commands/util.ts +24 -0
  159. package/src/components/DisableDependentsAlert/DisableDependentsAlert.tsx +69 -0
  160. package/src/components/DisableDependentsAlert/index.ts +5 -0
  161. package/src/components/{PluginDetail.stories.tsx → PluginDetail/PluginDetail.stories.tsx} +14 -11
  162. package/src/components/PluginDetail/PluginDetail.tsx +345 -0
  163. package/src/components/PluginDetail/index.ts +5 -0
  164. package/src/components/PluginFailureBadge/PluginFailureBadge.tsx +68 -0
  165. package/src/components/PluginFailureBadge/index.ts +5 -0
  166. package/src/components/PluginList/PluginItem.tsx +223 -0
  167. package/src/components/PluginList/PluginList.stories.tsx +90 -0
  168. package/src/components/PluginList/PluginList.tsx +52 -0
  169. package/src/components/PluginList/index.ts +5 -0
  170. package/src/components/RegistrySettings/RegistrySettings.tsx +120 -0
  171. package/src/components/RegistrySettings/index.ts +5 -0
  172. package/src/components/index.ts +3 -1
  173. package/src/containers/BaseRegistryArticle/BaseRegistryArticle.tsx +178 -0
  174. package/src/containers/BaseRegistryArticle/index.ts +5 -0
  175. package/src/containers/LoadPluginDialog/LoadPluginDialog.tsx +88 -0
  176. package/src/containers/LoadPluginDialog/index.ts +5 -0
  177. package/src/containers/PluginArticle/PluginArticle.tsx +117 -0
  178. package/src/containers/PluginArticle/index.ts +5 -0
  179. package/src/containers/PublicRegistryArticle/PublicRegistryArticle.tsx +193 -0
  180. package/src/containers/PublicRegistryArticle/index.ts +5 -0
  181. package/src/containers/RegistryArticle/RegistryArticle.tsx +53 -0
  182. package/src/containers/RegistryArticle/index.ts +5 -0
  183. package/src/containers/RegistrySettingsContainer/RegistrySettingsContainer.tsx +59 -0
  184. package/src/containers/RegistrySettingsContainer/index.ts +5 -0
  185. package/src/containers/index.ts +12 -0
  186. package/src/hooks/index.ts +12 -0
  187. package/src/hooks/useAutoTags.ts +52 -0
  188. package/src/hooks/useCatalogEntry.ts +25 -0
  189. package/src/hooks/useDisableConfirmation.ts +58 -0
  190. package/src/hooks/useInstalledVersionTag.ts +41 -0
  191. package/src/hooks/usePluginActions.ts +177 -0
  192. package/src/hooks/useRegistryPlugins.ts +29 -0
  193. package/src/hooks/useUpdateAvailable.ts +31 -0
  194. package/src/hooks/useVersionPicker.ts +112 -0
  195. package/src/index.ts +1 -1
  196. package/src/meta.ts +34 -8
  197. package/src/operations/index.ts +7 -0
  198. package/src/operations/open-plugin-registry.ts +21 -0
  199. package/src/plugin.ts +11 -0
  200. package/src/storage.ts +50 -0
  201. package/src/translations.ts +64 -15
  202. package/src/types.ts +33 -1
  203. package/dist/lib/browser/app-graph-builder-6CNBP3A4.mjs +0 -162
  204. package/dist/lib/browser/app-graph-builder-6CNBP3A4.mjs.map +0 -7
  205. package/dist/lib/browser/chunk-XPEFEID2.mjs +0 -19
  206. package/dist/lib/browser/chunk-XPEFEID2.mjs.map +0 -7
  207. package/dist/lib/browser/index.mjs +0 -69
  208. package/dist/lib/browser/index.mjs.map +0 -7
  209. package/dist/lib/browser/intent-resolver-LKNUYBTN.mjs +0 -23
  210. package/dist/lib/browser/intent-resolver-LKNUYBTN.mjs.map +0 -7
  211. package/dist/lib/browser/meta.json +0 -1
  212. package/dist/lib/browser/react-surface-IGCXOVE2.mjs +0 -359
  213. package/dist/lib/browser/react-surface-IGCXOVE2.mjs.map +0 -7
  214. package/dist/types/src/capabilities/intent-resolver.d.ts +0 -4
  215. package/dist/types/src/capabilities/intent-resolver.d.ts.map +0 -1
  216. package/dist/types/src/components/PluginDetail.d.ts +0 -9
  217. package/dist/types/src/components/PluginDetail.d.ts.map +0 -1
  218. package/dist/types/src/components/PluginDetail.stories.d.ts +0 -32
  219. package/dist/types/src/components/PluginDetail.stories.d.ts.map +0 -1
  220. package/dist/types/src/components/PluginItem.d.ts +0 -13
  221. package/dist/types/src/components/PluginItem.d.ts.map +0 -1
  222. package/dist/types/src/components/PluginList.d.ts +0 -8
  223. package/dist/types/src/components/PluginList.d.ts.map +0 -1
  224. package/dist/types/src/components/PluginList.stories.d.ts +0 -34
  225. package/dist/types/src/components/PluginList.stories.d.ts.map +0 -1
  226. package/dist/types/src/components/RegistryContainer.d.ts +0 -7
  227. package/dist/types/src/components/RegistryContainer.d.ts.map +0 -1
  228. package/src/capabilities/intent-resolver.ts +0 -27
  229. package/src/components/PluginDetail.tsx +0 -82
  230. package/src/components/PluginItem.tsx +0 -120
  231. package/src/components/PluginList.stories.tsx +0 -80
  232. package/src/components/PluginList.tsx +0 -24
  233. package/src/components/RegistryContainer.tsx +0 -76
@@ -0,0 +1,90 @@
1
+ //
2
+ // Copyright 2023 DXOS.org
3
+ //
4
+
5
+ import { type Meta, type StoryObj } from '@storybook/react-vite';
6
+ import React, { useState } from 'react';
7
+
8
+ import { type Plugin, Plugin as PluginNS } from '@dxos/app-framework';
9
+ import { DXN } from '@dxos/keys';
10
+ import { random } from '@dxos/random';
11
+ import { ScrollArea } from '@dxos/react-ui';
12
+ import { withLayout, withTheme } from '@dxos/react-ui/testing';
13
+ import { getHashHue } from '@dxos/ui-theme';
14
+
15
+ import { translations } from '#translations';
16
+ import { RegistryTagType } from '#types';
17
+
18
+ import { PluginList } from './PluginList';
19
+
20
+ random.seed(1);
21
+
22
+ const icons = [
23
+ 'ph--bug--regular',
24
+ 'ph--compass--regular',
25
+ 'ph--kanban--regular',
26
+ 'ph--table--regular',
27
+ 'ph--gear--regular',
28
+ 'ph--github-logo--regular',
29
+ ];
30
+
31
+ const DefaultStory = () => {
32
+ const [plugins] = useState<Plugin.Plugin[]>(
33
+ random.helpers.multiple(
34
+ () =>
35
+ PluginNS.define(
36
+ PluginNS.makeMeta({
37
+ key: DXN.make('org.dxos.plugin.test'),
38
+ name: `${random.commerce.productName()}`,
39
+ description: random.lorem.sentences(Math.ceil(Math.random() * 3)),
40
+ tags: random.helpers.uniqueArray(RegistryTagType.literals as any, Math.floor(Math.random() * 3)),
41
+ icon: random.helpers.arrayElement(icons),
42
+ iconHue: getHashHue(random.string.uuid()),
43
+ homePage: random.datatype.boolean({ probability: 0.5 }) ? random.internet.url() : undefined,
44
+ source: random.internet.url(),
45
+ }),
46
+ ).pipe(PluginNS.make)(),
47
+ { count: 32 },
48
+ ),
49
+ );
50
+ const [enabled, setEnabled] = useState<string[]>([]);
51
+
52
+ const handleChange = (id: string, enabled: boolean) => {
53
+ setEnabled((plugins) => (enabled ? [...plugins, id] : plugins.filter((plugin) => plugin === id)));
54
+ };
55
+
56
+ return (
57
+ <ScrollArea.Root orientation='vertical'>
58
+ <ScrollArea.Viewport>
59
+ <PluginList plugins={plugins} enabled={enabled} onChange={handleChange} hasSettings={() => true} />
60
+ </ScrollArea.Viewport>
61
+ </ScrollArea.Root>
62
+ );
63
+ };
64
+
65
+ const meta = {
66
+ title: 'plugins/plugin-registry/components/PluginList',
67
+ component: PluginList,
68
+ render: DefaultStory,
69
+ parameters: {
70
+ translations,
71
+ },
72
+ } satisfies Meta<typeof PluginList>;
73
+
74
+ export default meta;
75
+
76
+ type Story = StoryObj<typeof meta>;
77
+
78
+ export const Default: Story = {
79
+ decorators: [withTheme(), withLayout({ layout: 'column', classNames: 'bg-deck-surface' })],
80
+ parameters: {
81
+ layout: 'fullscreen',
82
+ },
83
+ };
84
+
85
+ export const FullScreen: Story = {
86
+ decorators: [withTheme(), withLayout({ scroll: true })],
87
+ parameters: {
88
+ layout: 'fullscreen',
89
+ },
90
+ };
@@ -0,0 +1,52 @@
1
+ //
2
+ // Copyright 2023 DXOS.org
3
+ //
4
+
5
+ import React from 'react';
6
+
7
+ import { type Plugin, type PluginManager } from '@dxos/app-framework';
8
+ import { List } from '@dxos/react-ui';
9
+
10
+ import { PluginItem, type PluginItemProps } from './PluginItem';
11
+
12
+ export type PluginListProps = Omit<PluginItemProps, 'plugin' | 'extraTags' | 'hasUpdate' | 'failure'> & {
13
+ plugins?: readonly Plugin.Plugin[];
14
+ /**
15
+ * Map from plugin id → extra tags to display (e.g. `registry`, `local`).
16
+ * Computed by the container; not persisted to plugin meta.
17
+ */
18
+ extraTagsById?: Record<string, readonly string[]>;
19
+ /**
20
+ * Set of plugin ids for which a newer version is available in the catalog.
21
+ * Causes each matching item to render an Update button instead of the enable switch.
22
+ */
23
+ updateAvailableIds?: ReadonlySet<string>;
24
+ /**
25
+ * Map from plugin id → most recent failure record. Used to render a warning
26
+ * badge next to the plugin name. Sourced from `PluginManager.failed`.
27
+ */
28
+ failuresById?: Record<string, PluginManager.PluginFailure>;
29
+ };
30
+
31
+ export const PluginList = ({
32
+ plugins = [],
33
+ extraTagsById,
34
+ updateAvailableIds,
35
+ failuresById,
36
+ ...props
37
+ }: PluginListProps) => {
38
+ return (
39
+ <List classNames='grid grid-cols-[repeat(auto-fill,minmax(18rem,1fr))] auto-rows-[max-content] gap-4 p-4'>
40
+ {plugins.map((plugin) => (
41
+ <PluginItem
42
+ key={plugin.meta.id}
43
+ plugin={plugin}
44
+ extraTags={extraTagsById?.[plugin.meta.id]}
45
+ hasUpdate={updateAvailableIds?.has(plugin.meta.id)}
46
+ failure={failuresById?.[plugin.meta.id]}
47
+ {...props}
48
+ />
49
+ ))}
50
+ </List>
51
+ );
52
+ };
@@ -0,0 +1,5 @@
1
+ //
2
+ // Copyright 2023 DXOS.org
3
+ //
4
+
5
+ export * from './PluginList';
@@ -0,0 +1,120 @@
1
+ //
2
+ // Copyright 2026 DXOS.org
3
+ //
4
+
5
+ import React, { useCallback, useState } from 'react';
6
+
7
+ import { type AppSurface } from '@dxos/app-toolkit/ui';
8
+ import { log } from '@dxos/log';
9
+ import { Button, Input, Message, useTranslation } from '@dxos/react-ui';
10
+ import { Settings as SettingsForm } from '@dxos/react-ui-form';
11
+
12
+ import { meta } from '#meta';
13
+
14
+ import { type RegistrySettings as RegistrySettingsType } from '../../types';
15
+
16
+ export type RegistrySettingsProps = AppSurface.SettingsArticleProps<
17
+ RegistrySettingsType,
18
+ {
19
+ activeDevPluginIds: readonly string[];
20
+ onEnableDev: (url: string) => Promise<void>;
21
+ onDisableDev: (id: string) => Promise<void>;
22
+ }
23
+ >;
24
+
25
+ /**
26
+ * Settings panel for `@dxos/plugin-registry`. The dev-plugin section lets a
27
+ * plugin author point Composer at a local Vite dev server (defaults to
28
+ * `localhost:3967`) and toggle the dev plugin on/off persistently — boot will
29
+ * re-attach it on the next reload, surviving HMR-triggered reloads. If the
30
+ * dev server is offline at boot, the toggle stays on and a warning is logged
31
+ * (the manager's `failed` atom also surfaces a badge on the plugin list).
32
+ */
33
+ export const RegistrySettings = ({
34
+ settings,
35
+ onSettingsChange,
36
+ activeDevPluginIds,
37
+ onEnableDev,
38
+ onDisableDev,
39
+ }: RegistrySettingsProps) => {
40
+ const { t } = useTranslation(meta.id);
41
+ const [busy, setBusy] = useState(false);
42
+ const enabled = !!settings.devPluginEnabled;
43
+ const url = settings.devPluginUrl ?? '';
44
+ const trimmedUrl = url.trim();
45
+ const loadedDevId = activeDevPluginIds[0];
46
+
47
+ const handleToggle = useCallback(async () => {
48
+ if (busy || !onSettingsChange) {
49
+ return;
50
+ }
51
+ setBusy(true);
52
+ try {
53
+ if (enabled && loadedDevId) {
54
+ await onDisableDev(loadedDevId);
55
+ onSettingsChange((current) => ({ ...current, devPluginEnabled: false }));
56
+ } else if (enabled) {
57
+ // Toggle is on but no dev plugin is currently loaded (boot-time load
58
+ // failed or hasn't finished). Treat the click as "turn it off."
59
+ onSettingsChange((current) => ({ ...current, devPluginEnabled: false }));
60
+ } else {
61
+ if (!trimmedUrl) {
62
+ return;
63
+ }
64
+ // Optimistically persist intent so the next reload retries even if
65
+ // the page closes mid-load.
66
+ onSettingsChange((current) => ({ ...current, devPluginEnabled: true }));
67
+ try {
68
+ await onEnableDev(trimmedUrl);
69
+ } catch (error) {
70
+ // Per product direction: leave the intent on, log the failure. The
71
+ // user explicitly turns it off if they're done iterating.
72
+ log.warn('dev plugin enable failed', { url: trimmedUrl, error });
73
+ }
74
+ }
75
+ } finally {
76
+ setBusy(false);
77
+ }
78
+ }, [busy, enabled, loadedDevId, onSettingsChange, onDisableDev, onEnableDev, trimmedUrl]);
79
+
80
+ // Button label tracks the persisted intent, not the current load state, so
81
+ // a transient "intent on but not loaded" combination still reads as
82
+ // "Disable Dev Plugin" — clicking it turns the intent off cleanly.
83
+ const buttonLabel = busy
84
+ ? t('dev-plugin.busy.label')
85
+ : enabled
86
+ ? t('dev-plugin.disable.label')
87
+ : t('dev-plugin.enable.label');
88
+
89
+ return (
90
+ <SettingsForm.Viewport>
91
+ <SettingsForm.Section title={t('dev-plugin.section.title')}>
92
+ <Message.Root valence='neutral'>
93
+ <Message.Content>{t('dev-plugin.description')}</Message.Content>
94
+ </Message.Root>
95
+ <SettingsForm.Item title={t('dev-plugin.url.label')} description={t('dev-plugin.url.description')}>
96
+ <Input.TextInput
97
+ classNames='ms-2'
98
+ disabled={!onSettingsChange || enabled || busy}
99
+ value={url}
100
+ onChange={(event) => onSettingsChange?.((current) => ({ ...current, devPluginUrl: event.target.value }))}
101
+ />
102
+ </SettingsForm.Item>
103
+ <SettingsForm.Item title={t('dev-plugin.toggle.label')} description={t('dev-plugin.toggle.description')}>
104
+ <Button
105
+ variant={enabled ? undefined : 'primary'}
106
+ disabled={busy || (!enabled && !trimmedUrl)}
107
+ onClick={() => void handleToggle()}
108
+ >
109
+ {buttonLabel}
110
+ </Button>
111
+ </SettingsForm.Item>
112
+ {enabled && !loadedDevId && !busy && (
113
+ <Message.Root valence='warning'>
114
+ <Message.Content>{t('dev-plugin.not-loaded.message')}</Message.Content>
115
+ </Message.Root>
116
+ )}
117
+ </SettingsForm.Section>
118
+ </SettingsForm.Viewport>
119
+ );
120
+ };
@@ -0,0 +1,5 @@
1
+ //
2
+ // Copyright 2026 DXOS.org
3
+ //
4
+
5
+ export * from './RegistrySettings';
@@ -2,6 +2,8 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
+ export * from './DisableDependentsAlert';
5
6
  export * from './PluginDetail';
7
+ export * from './PluginFailureBadge';
6
8
  export * from './PluginList';
7
- export * from './RegistryContainer';
9
+ export * from './RegistrySettings';
@@ -0,0 +1,178 @@
1
+ //
2
+ // Copyright 2026 DXOS.org
3
+ //
4
+
5
+ import { useAtomValue } from '@effect-atom/atom-react';
6
+ import * as Effect from 'effect/Effect';
7
+ import React, { type ReactNode, useCallback, useMemo, useState } from 'react';
8
+
9
+ import { type Plugin } from '@dxos/app-framework';
10
+ import { useCapabilities, useOperationInvoker, usePluginManager } from '@dxos/app-framework/ui';
11
+ import { AppCapabilities, LayoutOperation, SettingsOperation } from '@dxos/app-toolkit';
12
+ import { EffectEx } from '@dxos/effect';
13
+ import { ObservabilityOperation } from '@dxos/plugin-observability';
14
+ import { Input, Panel, ScrollArea, Toolbar, useTranslation } from '@dxos/react-ui';
15
+ import { composable, composableProps } from '@dxos/react-ui';
16
+
17
+ import { PluginList, type PluginListProps } from '#components';
18
+ import { getPluginPath, meta } from '#meta';
19
+
20
+ import { useDisableConfirmation } from '../../hooks';
21
+
22
+ const matchesFilter = (plugin: Plugin.Plugin, query: string) => {
23
+ const haystack = `${plugin.meta.name ?? ''} ${plugin.meta.id}`.toLowerCase();
24
+ return haystack.includes(query);
25
+ };
26
+
27
+ export type BaseRegistryArticleProps = {
28
+ /** Article id used as the pivotId when opening a plugin's detail surface. */
29
+ id: string;
30
+ /** Plugins to display, pre-sorted by the caller. */
31
+ plugins: readonly Plugin.Plugin[];
32
+ /**
33
+ * Distinguishes the source of toggle events for observability
34
+ * (e.g. `'registry'` for the public registry surface).
35
+ */
36
+ source?: string;
37
+ /** Rendered in place of the list when no plugins match the current filter. */
38
+ empty?: ReactNode;
39
+ } & Pick<
40
+ PluginListProps,
41
+ | 'installed'
42
+ | 'installing'
43
+ | 'updating'
44
+ | 'updateAvailableIds'
45
+ | 'extraTagsById'
46
+ | 'failuresById'
47
+ | 'onInstall'
48
+ | 'onUpdate'
49
+ >;
50
+
51
+ export const BaseRegistryArticle = composable<HTMLDivElement, BaseRegistryArticleProps>(
52
+ (
53
+ {
54
+ id,
55
+ plugins,
56
+ source,
57
+ empty,
58
+ installed,
59
+ installing,
60
+ updating,
61
+ updateAvailableIds,
62
+ extraTagsById,
63
+ failuresById,
64
+ onInstall,
65
+ onUpdate,
66
+ ...props
67
+ },
68
+ forwardedRef,
69
+ ) => {
70
+ const { t } = useTranslation(meta.id);
71
+ const manager = usePluginManager();
72
+ const { invoke, invokePromise } = useOperationInvoker();
73
+ const allSettings = useCapabilities(AppCapabilities.Settings);
74
+ const enabled = useAtomValue(manager.enabled);
75
+ const [filter, setFilter] = useState('');
76
+
77
+ const filtered = useMemo(() => {
78
+ const query = filter.trim().toLowerCase();
79
+ return query.length === 0 ? plugins : plugins.filter((plugin) => matchesFilter(plugin, query));
80
+ }, [plugins, filter]);
81
+
82
+ const dispatchToggle = useCallback(
83
+ (pluginId: string, nextEnabled: boolean) =>
84
+ Effect.gen(function* () {
85
+ if (nextEnabled) {
86
+ yield* manager.enable(pluginId);
87
+ } else {
88
+ yield* manager.disable(pluginId);
89
+ }
90
+ yield* invoke(ObservabilityOperation.SendEvent, {
91
+ name: 'plugins.toggle',
92
+ properties: source
93
+ ? { plugin: pluginId, enabled: nextEnabled, source }
94
+ : { plugin: pluginId, enabled: nextEnabled },
95
+ });
96
+ }).pipe(EffectEx.runAndForwardErrors),
97
+ [invoke, manager, source],
98
+ );
99
+
100
+ const requestDisable = useDisableConfirmation(manager, (id) => void dispatchToggle(id, false));
101
+
102
+ const handleChange = useCallback(
103
+ (pluginId: string, nextEnabled: boolean) => {
104
+ if (nextEnabled) {
105
+ void dispatchToggle(pluginId, true);
106
+ return;
107
+ }
108
+ requestDisable(pluginId);
109
+ },
110
+ [dispatchToggle, requestDisable],
111
+ );
112
+
113
+ const handleClick = useCallback(
114
+ (pluginId: string) =>
115
+ invokePromise(LayoutOperation.Open, {
116
+ subject: [getPluginPath(pluginId)],
117
+ pivotId: id,
118
+ positioning: 'end',
119
+ }),
120
+ [invokePromise, id],
121
+ );
122
+
123
+ const hasSettings = useCallback(
124
+ (pluginId: string) => allSettings.some((setting) => setting.prefix === pluginId),
125
+ [allSettings],
126
+ );
127
+
128
+ const handleSettings = useCallback(
129
+ (pluginId: string) => invokePromise(SettingsOperation.Open, { plugin: pluginId }),
130
+ [invokePromise],
131
+ );
132
+
133
+ return (
134
+ <Panel.Root {...composableProps(props)} ref={forwardedRef}>
135
+ <Panel.Toolbar asChild>
136
+ <Toolbar.Root>
137
+ <Input.Root>
138
+ <Input.Label srOnly>{t('filter.label')}</Input.Label>
139
+ <Input.TextInput
140
+ placeholder={t('filter.placeholder')}
141
+ value={filter}
142
+ onChange={(event) => setFilter(event.target.value)}
143
+ />
144
+ </Input.Root>
145
+ </Toolbar.Root>
146
+ </Panel.Toolbar>
147
+ <Panel.Content asChild>
148
+ <ScrollArea.Root orientation='vertical'>
149
+ <ScrollArea.Viewport>
150
+ {filtered.length > 0 ? (
151
+ <PluginList
152
+ plugins={filtered}
153
+ enabled={enabled}
154
+ installed={installed}
155
+ installing={installing}
156
+ updating={updating}
157
+ updateAvailableIds={updateAvailableIds}
158
+ extraTagsById={extraTagsById}
159
+ failuresById={failuresById}
160
+ onClick={handleClick}
161
+ onChange={handleChange}
162
+ onInstall={onInstall}
163
+ onUpdate={onUpdate}
164
+ hasSettings={hasSettings}
165
+ onSettings={handleSettings}
166
+ />
167
+ ) : (
168
+ empty
169
+ )}
170
+ </ScrollArea.Viewport>
171
+ </ScrollArea.Root>
172
+ </Panel.Content>
173
+ </Panel.Root>
174
+ );
175
+ },
176
+ );
177
+
178
+ BaseRegistryArticle.displayName = 'BaseRegistryArticle';
@@ -0,0 +1,5 @@
1
+ //
2
+ // Copyright 2026 DXOS.org
3
+ //
4
+
5
+ export * from './BaseRegistryArticle';
@@ -0,0 +1,88 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import * as Effect from 'effect/Effect';
6
+ import React, { useCallback, useRef, useState } from 'react';
7
+
8
+ import { usePluginManager } from '@dxos/app-framework/ui';
9
+ import { EffectEx } from '@dxos/effect';
10
+ import { DXN } from '@dxos/keys';
11
+ import { Button, Dialog, Input, useTranslation } from '@dxos/react-ui';
12
+
13
+ import { meta } from '../../meta';
14
+
15
+ export const LOAD_PLUGIN_DIALOG = DXN.make(`${meta.id}.loadPluginDialog`);
16
+
17
+ export const LoadPluginDialog = () => {
18
+ const manager = usePluginManager();
19
+ const { t } = useTranslation(meta.id);
20
+ const [url, setUrl] = useState('');
21
+ const [loading, setLoading] = useState(false);
22
+ const [error, setError] = useState<string | null>(null);
23
+ const closeRef = useRef<HTMLButtonElement | null>(null);
24
+
25
+ const handleLoad = useCallback(() => {
26
+ const trimmed = url.trim();
27
+ if (!trimmed) {
28
+ return;
29
+ }
30
+
31
+ setLoading(true);
32
+ setError(null);
33
+
34
+ void Effect.gen(function* () {
35
+ const plugin = yield* manager.add(trimmed);
36
+ yield* manager.enable(plugin.meta.id);
37
+ closeRef.current?.click();
38
+ }).pipe(
39
+ Effect.catchAll((err) =>
40
+ Effect.sync(() => {
41
+ setError(String(err));
42
+ }),
43
+ ),
44
+ Effect.tap(() => Effect.sync(() => setLoading(false))),
45
+ EffectEx.runAndForwardErrors,
46
+ );
47
+ }, [url, manager]);
48
+
49
+ return (
50
+ <Dialog.Content>
51
+ <Dialog.Header>
52
+ <Dialog.Title>{t('load-by-url-dialog.title')}</Dialog.Title>
53
+ <Dialog.Close asChild>
54
+ <Dialog.ActionIconButton action='close' ref={closeRef} />
55
+ </Dialog.Close>
56
+ </Dialog.Header>
57
+ <Dialog.Body>
58
+ {/* TODO(burdon): Form section. */}
59
+ <div className='flex flex-col gap-4'>
60
+ <Input.Root validationValence={error ? 'error' : undefined}>
61
+ <Input.Label>{t('plugin-url.label')}</Input.Label>
62
+ <Input.TextInput
63
+ placeholder='https://example.com/manifest.json'
64
+ value={url}
65
+ onChange={(event) => {
66
+ setUrl(event.target.value);
67
+ setError(null);
68
+ }}
69
+ onKeyDown={(event) => {
70
+ if (event.key === 'Enter') {
71
+ handleLoad();
72
+ }
73
+ }}
74
+ disabled={loading}
75
+ autoFocus
76
+ />
77
+ {error && <Input.DescriptionAndValidation>{error}</Input.DescriptionAndValidation>}
78
+ </Input.Root>
79
+ <div className='flex justify-end'>
80
+ <Button variant='primary' disabled={!url.trim() || loading} onClick={handleLoad}>
81
+ {loading ? t('loading.label') : t('load-plugin.label')}
82
+ </Button>
83
+ </div>
84
+ </div>
85
+ </Dialog.Body>
86
+ </Dialog.Content>
87
+ );
88
+ };
@@ -0,0 +1,5 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ export { LoadPluginDialog as default } from './LoadPluginDialog';
@@ -0,0 +1,117 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { useAtomValue } from '@effect-atom/atom-react';
6
+ import React, { useCallback, useMemo } from 'react';
7
+
8
+ import { type Plugin } from '@dxos/app-framework';
9
+ import { useOperationInvoker, usePluginManager } from '@dxos/app-framework/ui';
10
+ import { LayoutOperation } from '@dxos/app-toolkit';
11
+
12
+ import { PluginDetail } from '#components';
13
+ import { getPluginPath } from '#meta';
14
+
15
+ import {
16
+ useCatalogEntry,
17
+ useInstalledVersionTag,
18
+ usePluginActions,
19
+ useRegistryPluginProvider,
20
+ useRemotePluginIds,
21
+ useVersionPicker,
22
+ } from '../../hooks';
23
+
24
+ export type PluginArticleProps = { subject: Plugin.Plugin };
25
+
26
+ export const PluginArticle = ({ subject: plugin }: PluginArticleProps) => {
27
+ const pluginId = plugin.meta.id;
28
+ const manager = usePluginManager();
29
+ const plugins = useAtomValue(manager.plugins);
30
+ const remotePluginIds = useRemotePluginIds();
31
+ const provider = useRegistryPluginProvider();
32
+ const { invokePromise } = useOperationInvoker();
33
+
34
+ const { catalogEntry, moduleUrl, repo } = useCatalogEntry(pluginId);
35
+ const { installedVersionTag, syncInstalledVersion } = useInstalledVersionTag(pluginId, plugins);
36
+ const { pickerVersions, selectedVersionTag, setSelectedVersionTag } = useVersionPicker({
37
+ provider,
38
+ pluginId,
39
+ repo,
40
+ moduleUrl,
41
+ installedVersionTag,
42
+ });
43
+
44
+ const enabled = manager.getEnabled().includes(pluginId);
45
+ const failed = useAtomValue(manager.failed);
46
+ const failure = useMemo(() => failed.find((entry) => entry.id === pluginId), [failed, pluginId]);
47
+ const isInstalled = useMemo(() => plugins.some((candidate) => candidate.meta.id === pluginId), [plugins, pluginId]);
48
+ const isCore = manager.getCore().includes(pluginId);
49
+ const canUninstall = isInstalled && !isCore && remotePluginIds.has(pluginId);
50
+ const hasUpdate =
51
+ isInstalled && !!catalogEntry && !!installedVersionTag && installedVersionTag !== catalogEntry.version;
52
+
53
+ // Recompute graph slices whenever the plugin list changes, so installs /
54
+ // removals through other surfaces (or this article's own actions) keep the
55
+ // detail view in sync.
56
+ const dependencies = useMemo(
57
+ () => manager.getDependencies(pluginId, { transitive: false }),
58
+ [manager, pluginId, plugins],
59
+ );
60
+ const dependents = useMemo(
61
+ () => manager.getDependents(pluginId, { transitive: false }),
62
+ [manager, pluginId, plugins],
63
+ );
64
+
65
+ // Resolves a plugin id to its display name. A plugin's translations are
66
+ // only loaded when it is activated, so the always-available `meta.name`
67
+ // from the registered plugin set is the right source for chip labels.
68
+ const handleResolvePluginName = useCallback(
69
+ (id: string): string => plugins.find((candidate) => candidate.meta.id === id)?.meta.name ?? id,
70
+ [plugins],
71
+ );
72
+
73
+ const handleNavigateToPlugin = useCallback(
74
+ (targetId: string) => {
75
+ void invokePromise(LayoutOperation.Open, {
76
+ subject: [getPluginPath(targetId)],
77
+ });
78
+ },
79
+ [invokePromise],
80
+ );
81
+
82
+ const actions = usePluginActions({
83
+ manager,
84
+ pluginId,
85
+ isInstalled,
86
+ moduleUrl,
87
+ catalogEntry,
88
+ pickerVersions,
89
+ selectedVersionTag,
90
+ syncInstalledVersion,
91
+ });
92
+
93
+ return (
94
+ <PluginDetail
95
+ plugin={plugin}
96
+ enabled={enabled}
97
+ installing={actions.installing}
98
+ updating={actions.updating}
99
+ hasUpdate={hasUpdate}
100
+ installedVersionTag={installedVersionTag}
101
+ selectedVersionTag={selectedVersionTag}
102
+ versions={pickerVersions}
103
+ dependencies={dependencies}
104
+ dependents={dependents}
105
+ failure={failure}
106
+ onOpenSpec={actions.handleOpenSpec}
107
+ onEnabledChange={actions.handleEnableChange}
108
+ onInstall={!isInstalled && moduleUrl ? actions.handleInstall : undefined}
109
+ onInstallVersion={pickerVersions.length > 0 ? actions.handleInstallVersion : undefined}
110
+ onNavigateToPlugin={handleNavigateToPlugin}
111
+ onResolvePluginName={handleResolvePluginName}
112
+ onUninstall={canUninstall ? actions.handleUninstall : undefined}
113
+ onUpdate={hasUpdate ? actions.handleUpdate : undefined}
114
+ onVersionChange={setSelectedVersionTag}
115
+ />
116
+ );
117
+ };
@@ -0,0 +1,5 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ export { PluginArticle as default } from './PluginArticle';