@dxos/plugin-registry 0.7.5-main.9d26e3a → 0.7.5-main.e9bb01b

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 (68) hide show
  1. package/dist/lib/browser/app-graph-builder-PPWF5KP5.mjs +164 -0
  2. package/dist/lib/browser/app-graph-builder-PPWF5KP5.mjs.map +7 -0
  3. package/dist/lib/browser/chunk-RGSIE33X.mjs +16 -0
  4. package/dist/lib/browser/chunk-RGSIE33X.mjs.map +7 -0
  5. package/dist/lib/browser/index.mjs +49 -189
  6. package/dist/lib/browser/index.mjs.map +4 -4
  7. package/dist/lib/browser/intent-resolver-2JQUQJI5.mjs +23 -0
  8. package/dist/lib/browser/intent-resolver-2JQUQJI5.mjs.map +7 -0
  9. package/dist/lib/browser/meta.json +1 -1
  10. package/dist/lib/browser/react-surface-NRETIUCH.mjs +295 -0
  11. package/dist/lib/browser/react-surface-NRETIUCH.mjs.map +7 -0
  12. package/dist/types/src/RegistryPlugin.d.ts +1 -6
  13. package/dist/types/src/RegistryPlugin.d.ts.map +1 -1
  14. package/dist/types/src/capabilities/app-graph-builder.d.ts +181 -0
  15. package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -0
  16. package/dist/types/src/capabilities/index.d.ts +180 -0
  17. package/dist/types/src/capabilities/index.d.ts.map +1 -0
  18. package/dist/types/src/capabilities/intent-resolver.d.ts +4 -0
  19. package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -0
  20. package/dist/types/src/capabilities/react-surface.d.ts +4 -0
  21. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -0
  22. package/dist/types/src/components/PluginDetail.d.ts +9 -0
  23. package/dist/types/src/components/PluginDetail.d.ts.map +1 -0
  24. package/dist/types/src/components/PluginDetail.stories.d.ts +8 -0
  25. package/dist/types/src/components/PluginDetail.stories.d.ts.map +1 -0
  26. package/dist/types/src/components/PluginItem.d.ts +11 -0
  27. package/dist/types/src/components/PluginItem.d.ts.map +1 -0
  28. package/dist/types/src/components/PluginList.d.ts +5 -8
  29. package/dist/types/src/components/PluginList.d.ts.map +1 -1
  30. package/dist/types/src/components/PluginList.stories.d.ts +6 -1
  31. package/dist/types/src/components/PluginList.stories.d.ts.map +1 -1
  32. package/dist/types/src/components/RegistryContainer.d.ts +7 -0
  33. package/dist/types/src/components/RegistryContainer.d.ts.map +1 -0
  34. package/dist/types/src/components/index.d.ts +2 -1
  35. package/dist/types/src/components/index.d.ts.map +1 -1
  36. package/dist/types/src/index.d.ts +1 -2
  37. package/dist/types/src/index.d.ts.map +1 -1
  38. package/dist/types/src/meta.d.ts +3 -2
  39. package/dist/types/src/meta.d.ts.map +1 -1
  40. package/dist/types/src/translations.d.ts +10 -0
  41. package/dist/types/src/translations.d.ts.map +1 -1
  42. package/dist/types/src/types.d.ts +6 -0
  43. package/dist/types/src/types.d.ts.map +1 -0
  44. package/dist/types/tsconfig.tsbuildinfo +1 -1
  45. package/package.json +17 -23
  46. package/src/RegistryPlugin.tsx +26 -41
  47. package/src/capabilities/app-graph-builder.ts +126 -0
  48. package/src/capabilities/index.ts +9 -0
  49. package/src/capabilities/intent-resolver.ts +27 -0
  50. package/src/capabilities/react-surface.tsx +90 -0
  51. package/src/components/PluginDetail.stories.tsx +45 -0
  52. package/src/components/PluginDetail.tsx +63 -0
  53. package/src/components/PluginItem.tsx +105 -0
  54. package/src/components/PluginList.stories.tsx +30 -21
  55. package/src/components/PluginList.tsx +13 -90
  56. package/src/components/RegistryContainer.tsx +51 -0
  57. package/src/components/index.ts +2 -1
  58. package/src/index.ts +1 -4
  59. package/src/meta.ts +5 -1
  60. package/src/translations.ts +12 -2
  61. package/src/types.ts +13 -0
  62. package/dist/lib/browser/chunk-NEMFDAOB.mjs +0 -12
  63. package/dist/lib/browser/chunk-NEMFDAOB.mjs.map +0 -7
  64. package/dist/lib/browser/meta.mjs +0 -9
  65. package/dist/lib/browser/meta.mjs.map +0 -7
  66. package/dist/types/src/components/PluginSettings.d.ts +0 -6
  67. package/dist/types/src/components/PluginSettings.d.ts.map +0 -1
  68. package/src/components/PluginSettings.tsx +0 -108
@@ -0,0 +1,51 @@
1
+ //
2
+ // Copyright 2023 DXOS.org
3
+ //
4
+
5
+ import React, { useMemo } from 'react';
6
+
7
+ import { createIntent, LayoutAction, type Plugin, useIntentDispatcher, usePluginManager } from '@dxos/app-framework';
8
+ import { ObservabilityAction } from '@dxos/plugin-observability/types';
9
+ import { StackItem } from '@dxos/react-ui-stack';
10
+
11
+ import { PluginList } from './PluginList';
12
+
13
+ const sortByPluginMeta = ({ meta: { name: a = '' } }: Plugin, { meta: { name: b = '' } }: Plugin) => a.localeCompare(b);
14
+
15
+ export const RegistryContainer = ({ id, plugins: _plugins }: { id: string; plugins: Plugin[] }) => {
16
+ const manager = usePluginManager();
17
+ const { dispatchPromise: dispatch } = useIntentDispatcher();
18
+ const plugins = useMemo(() => _plugins.sort(sortByPluginMeta), [_plugins]);
19
+
20
+ // TODO(wittjosiah): Factor out to an intent?
21
+ const handleChange = async (id: string, enabled: boolean) => {
22
+ if (enabled) {
23
+ await manager.enable(id);
24
+ } else {
25
+ await manager.disable(id);
26
+ }
27
+
28
+ await dispatch(
29
+ createIntent(ObservabilityAction.SendEvent, {
30
+ name: 'plugins.toggle',
31
+ properties: { plugin: id, enabled },
32
+ }),
33
+ );
34
+ };
35
+
36
+ const handleClick = (pluginId: string) =>
37
+ dispatch(
38
+ createIntent(LayoutAction.Open, {
39
+ part: 'main',
40
+ // TODO(wittjosiah): `/` currently is not supported in ids.
41
+ subject: [pluginId.replaceAll('/', ':')],
42
+ options: { pivotId: id, positioning: 'end' },
43
+ }),
44
+ );
45
+
46
+ return (
47
+ <StackItem.Content toolbar={false} role='article' classNames='overflow-x-hidden overflow-y-auto'>
48
+ <PluginList plugins={plugins} enabled={manager.enabled} onClick={handleClick} onChange={handleChange} />
49
+ </StackItem.Content>
50
+ );
51
+ };
@@ -2,5 +2,6 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
+ export * from './PluginDetail';
5
6
  export * from './PluginList';
6
- export * from './PluginSettings';
7
+ export * from './RegistryContainer';
package/src/index.ts CHANGED
@@ -2,8 +2,5 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
- import { RegistryPlugin } from './RegistryPlugin';
6
-
7
- export default RegistryPlugin;
8
-
5
+ export * from './meta';
9
6
  export * from './RegistryPlugin';
package/src/meta.ts CHANGED
@@ -6,7 +6,11 @@ import { type PluginMeta } from '@dxos/app-framework';
6
6
 
7
7
  export const REGISTRY_PLUGIN = 'dxos.org/plugin/registry';
8
8
 
9
- export default {
9
+ // TODO(wittjosiah): Deck does not currently support `/` in ids.
10
+ export const REGISTRY_ID = 'dxos:plugin-registry';
11
+ export const REGISTRY_KEY = 'plugin-registry';
12
+
13
+ export const meta = {
10
14
  id: REGISTRY_PLUGIN,
11
15
  name: 'Plugins',
12
16
  } satisfies PluginMeta;
@@ -11,11 +11,21 @@ export default [
11
11
  'plugin name': 'Registry',
12
12
  'reload required message': 'Reload required.',
13
13
  'settings show experimental label': 'Show experimental plugins',
14
- 'settings section installed label': 'Installed',
14
+ 'settings section installed label': 'Enabled',
15
15
  'settings section recommended label': 'Recommended',
16
16
  'settings section experimental label': 'Experimental',
17
- 'home page label': 'Home page',
17
+ 'details label': 'Details',
18
+ 'home page label': 'Website',
18
19
  'source label': 'Source',
20
+ 'plugin registry label': 'Plugin Registry',
21
+ 'all plugins label': 'All',
22
+ 'installed plugins label': 'Enabled',
23
+ 'recommended plugins label': 'Recommended',
24
+ 'experimental plugins label': 'Experimental',
25
+ 'community plugins label': 'Community',
26
+ 'load by url label': 'Load by URL (soon)',
27
+ 'coming soon label': 'Coming soon!',
28
+ 'open plugin registry label': 'Open plugin registry',
19
29
  },
20
30
  },
21
31
  },
package/src/types.ts ADDED
@@ -0,0 +1,13 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { S } from '@dxos/echo-schema';
6
+
7
+ export const RegistrySettingsSchema = S.mutable(
8
+ S.Struct({
9
+ experimental: S.optional(S.Boolean),
10
+ }),
11
+ );
12
+
13
+ export type RegistrySettings = S.Schema.Type<typeof RegistrySettingsSchema>;
@@ -1,12 +0,0 @@
1
- // packages/plugins/plugin-registry/src/meta.ts
2
- var REGISTRY_PLUGIN = "dxos.org/plugin/registry";
3
- var meta_default = {
4
- id: REGISTRY_PLUGIN,
5
- name: "Plugins"
6
- };
7
-
8
- export {
9
- REGISTRY_PLUGIN,
10
- meta_default
11
- };
12
- //# sourceMappingURL=chunk-NEMFDAOB.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/meta.ts"],
4
- "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { type PluginMeta } from '@dxos/app-framework';\n\nexport const REGISTRY_PLUGIN = 'dxos.org/plugin/registry';\n\nexport default {\n id: REGISTRY_PLUGIN,\n name: 'Plugins',\n} satisfies PluginMeta;\n"],
5
- "mappings": ";AAMO,IAAMA,kBAAkB;AAE/B,IAAA,eAAe;EACbC,IAAID;EACJE,MAAM;AACR;",
6
- "names": ["REGISTRY_PLUGIN", "id", "name"]
7
- }
@@ -1,9 +0,0 @@
1
- import {
2
- REGISTRY_PLUGIN,
3
- meta_default
4
- } from "./chunk-NEMFDAOB.mjs";
5
- export {
6
- REGISTRY_PLUGIN,
7
- meta_default as default
8
- };
9
- //# sourceMappingURL=meta.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": [],
4
- "sourcesContent": [],
5
- "mappings": "",
6
- "names": []
7
- }
@@ -1,6 +0,0 @@
1
- import React from 'react';
2
- import { type RegistrySettingsProps } from '../RegistryPlugin';
3
- export declare const PluginSettings: ({ settings }: {
4
- settings: RegistrySettingsProps;
5
- }) => React.JSX.Element;
6
- //# sourceMappingURL=PluginSettings.d.ts.map
@@ -1 +0,0 @@
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"}
@@ -1,108 +0,0 @@
1
- //
2
- // Copyright 2023 DXOS.org
3
- //
4
-
5
- import React, { useMemo, type PropsWithChildren } from 'react';
6
-
7
- import { createIntent, type PluginMeta, useIntentDispatcher, usePlugins } from '@dxos/app-framework';
8
- import { ObservabilityAction } from '@dxos/plugin-observability/types';
9
- import { Input, useTranslation } from '@dxos/react-ui';
10
- import { DeprecatedFormInput } from '@dxos/react-ui-form';
11
-
12
- import { PluginList } from './PluginList';
13
- import { type RegistrySettingsProps } from '../RegistryPlugin';
14
- import { REGISTRY_PLUGIN } from '../meta';
15
-
16
- const sortPluginMeta = ({ name: a = '' }: PluginMeta, { name: b = '' }: PluginMeta) => a.localeCompare(b);
17
-
18
- export const PluginSettings = ({ settings }: { settings: RegistrySettingsProps }) => {
19
- const { t } = useTranslation(REGISTRY_PLUGIN);
20
- const { plugins, enabled, core, setPlugin, ...pluginContext } = usePlugins();
21
- const { dispatchPromise: dispatch } = useIntentDispatcher();
22
-
23
- // Memoize to prevent plugins from disappearing when toggling enabled.
24
- const installed = useMemo(
25
- () =>
26
- plugins
27
- .filter(({ meta }) => !core.includes(meta.id))
28
- .filter(({ meta }) => enabled.includes(meta.id))
29
- .map(({ meta }) => meta)
30
- .sort(sortPluginMeta),
31
- [],
32
- );
33
-
34
- const pluginIds = plugins.map(({ meta }) => meta.id);
35
- const available = useMemo(
36
- () => pluginContext.available.filter(({ id }) => !enabled.includes(id)).sort(sortPluginMeta),
37
- [],
38
- );
39
- const recommended = available.filter((meta) => !meta.tags?.includes('experimental'));
40
- const experimental = available.filter((meta) => meta.tags?.includes('experimental'));
41
-
42
- const handleChange = (id: string, enabled: boolean) => {
43
- setPlugin(id, enabled);
44
- void dispatch(
45
- createIntent(ObservabilityAction.SendEvent, {
46
- name: 'plugins.toggle',
47
- properties: { plugin: id, enabled },
48
- }),
49
- );
50
- };
51
-
52
- const handleReload = () => {
53
- window.location.reload();
54
- };
55
-
56
- return (
57
- <>
58
- <DeprecatedFormInput label={t('settings show experimental label')}>
59
- <Input.Switch
60
- data-testid='pluginSettings.experimental'
61
- checked={settings.experimental}
62
- onCheckedChange={(checked) => (settings.experimental = !!checked)}
63
- />
64
- </DeprecatedFormInput>
65
-
66
- <Section label={t('settings section installed label')}>
67
- <PluginList
68
- plugins={installed}
69
- loaded={pluginIds}
70
- enabled={enabled}
71
- onChange={handleChange}
72
- onReload={handleReload}
73
- />
74
- </Section>
75
-
76
- <Section label={t('settings section recommended label')}>
77
- <PluginList
78
- plugins={recommended}
79
- loaded={pluginIds}
80
- enabled={enabled}
81
- onChange={handleChange}
82
- onReload={handleReload}
83
- />
84
- </Section>
85
-
86
- {settings.experimental && (
87
- <Section label={t('settings section experimental label')}>
88
- <PluginList
89
- plugins={experimental}
90
- loaded={pluginIds}
91
- enabled={enabled}
92
- onChange={handleChange}
93
- onReload={handleReload}
94
- />
95
- </Section>
96
- )}
97
- </>
98
- );
99
- };
100
-
101
- const Section = ({ label, children }: PropsWithChildren<{ label: string }>) => {
102
- return (
103
- <div>
104
- <h2 className='py-2 text-sm text-subdued'>{label}</h2>
105
- {children}
106
- </div>
107
- );
108
- };