@dxos/plugin-registry 0.8.4-main.937b3ca → 0.8.4-main.9be5663bfe

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 (137) hide show
  1. package/dist/lib/browser/cli/index.mjs +15 -19
  2. package/dist/lib/browser/cli/index.mjs.map +3 -3
  3. package/dist/lib/browser/index.mjs +50 -41
  4. package/dist/lib/browser/index.mjs.map +4 -4
  5. package/dist/lib/browser/meta.json +1 -1
  6. package/dist/lib/node-esm/cli/index.mjs +15 -18
  7. package/dist/lib/node-esm/cli/index.mjs.map +3 -3
  8. package/dist/lib/node-esm/index.mjs +51 -41
  9. package/dist/lib/node-esm/index.mjs.map +4 -4
  10. package/dist/lib/node-esm/meta.json +1 -1
  11. package/dist/types/src/RegistryPlugin.d.ts.map +1 -1
  12. package/dist/types/src/capabilities/app-graph-builder.d.ts +6 -0
  13. package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -0
  14. package/dist/types/src/capabilities/index.d.ts +5 -3
  15. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  16. package/dist/types/src/capabilities/operation-handler.d.ts +6 -0
  17. package/dist/types/src/capabilities/operation-handler.d.ts.map +1 -0
  18. package/dist/types/src/capabilities/react-surface.d.ts +5 -0
  19. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -0
  20. package/dist/types/src/cli/commands/disable.d.ts +2 -2
  21. package/dist/types/src/cli/commands/enable.d.ts +2 -2
  22. package/dist/types/src/cli/plugin.d.ts.map +1 -1
  23. package/dist/types/src/cli/storage.d.ts +4 -4
  24. package/dist/types/src/cli/storage.d.ts.map +1 -1
  25. package/dist/types/src/components/PluginDetail/PluginDetail.d.ts +11 -0
  26. package/dist/types/src/components/PluginDetail/PluginDetail.d.ts.map +1 -0
  27. package/dist/types/src/components/PluginDetail/PluginDetail.stories.d.ts +39 -0
  28. package/dist/types/src/components/PluginDetail/PluginDetail.stories.d.ts.map +1 -0
  29. package/dist/types/src/components/PluginDetail/index.d.ts +2 -0
  30. package/dist/types/src/components/PluginDetail/index.d.ts.map +1 -0
  31. package/dist/types/src/components/PluginList/PluginItem.d.ts.map +1 -0
  32. package/dist/types/src/components/PluginList/PluginList.d.ts.map +1 -0
  33. package/dist/types/src/components/PluginList/PluginList.stories.d.ts +38 -0
  34. package/dist/types/src/components/PluginList/PluginList.stories.d.ts.map +1 -0
  35. package/dist/types/src/components/PluginList/index.d.ts +2 -0
  36. package/dist/types/src/components/PluginList/index.d.ts.map +1 -0
  37. package/dist/types/src/components/index.d.ts +0 -1
  38. package/dist/types/src/components/index.d.ts.map +1 -1
  39. package/dist/types/src/containers/LoadPluginDialog/LoadPluginDialog.d.ts +4 -0
  40. package/dist/types/src/containers/LoadPluginDialog/LoadPluginDialog.d.ts.map +1 -0
  41. package/dist/types/src/containers/LoadPluginDialog/index.d.ts +2 -0
  42. package/dist/types/src/containers/LoadPluginDialog/index.d.ts.map +1 -0
  43. package/dist/types/src/containers/PluginArticle/PluginArticle.d.ts +7 -0
  44. package/dist/types/src/containers/PluginArticle/PluginArticle.d.ts.map +1 -0
  45. package/dist/types/src/containers/PluginArticle/index.d.ts +2 -0
  46. package/dist/types/src/containers/PluginArticle/index.d.ts.map +1 -0
  47. package/dist/types/src/containers/PluginRegistry/PluginRegistry.d.ts +10 -0
  48. package/dist/types/src/containers/PluginRegistry/PluginRegistry.d.ts.map +1 -0
  49. package/dist/types/src/containers/PluginRegistry/index.d.ts +2 -0
  50. package/dist/types/src/containers/PluginRegistry/index.d.ts.map +1 -0
  51. package/dist/types/src/containers/index.d.ts +6 -0
  52. package/dist/types/src/containers/index.d.ts.map +1 -0
  53. package/dist/types/src/meta.d.ts +5 -1
  54. package/dist/types/src/meta.d.ts.map +1 -1
  55. package/dist/types/src/operations/index.d.ts +3 -0
  56. package/dist/types/src/operations/index.d.ts.map +1 -0
  57. package/dist/types/src/operations/open-plugin-registry.d.ts +5 -0
  58. package/dist/types/src/operations/open-plugin-registry.d.ts.map +1 -0
  59. package/dist/types/src/translations.d.ts +19 -15
  60. package/dist/types/src/translations.d.ts.map +1 -1
  61. package/dist/types/tsconfig.tsbuildinfo +1 -1
  62. package/package.json +41 -31
  63. package/src/RegistryPlugin.tsx +9 -7
  64. package/src/capabilities/app-graph-builder.ts +149 -0
  65. package/src/capabilities/index.ts +9 -3
  66. package/src/capabilities/operation-handler.ts +16 -0
  67. package/src/capabilities/react-surface.tsx +95 -0
  68. package/src/cli/plugin.ts +4 -3
  69. package/src/cli/storage.ts +14 -21
  70. package/src/components/{PluginDetail.stories.tsx → PluginDetail/PluginDetail.stories.tsx} +6 -6
  71. package/src/components/PluginDetail/PluginDetail.tsx +84 -0
  72. package/src/components/PluginDetail/index.ts +5 -0
  73. package/src/components/{PluginItem.tsx → PluginList/PluginItem.tsx} +16 -12
  74. package/src/components/PluginList/PluginList.stories.tsx +87 -0
  75. package/src/components/PluginList/index.ts +5 -0
  76. package/src/components/index.ts +0 -1
  77. package/src/containers/LoadPluginDialog/LoadPluginDialog.tsx +85 -0
  78. package/src/containers/LoadPluginDialog/index.ts +5 -0
  79. package/src/containers/PluginArticle/PluginArticle.tsx +28 -0
  80. package/src/containers/PluginArticle/index.ts +5 -0
  81. package/src/containers/PluginRegistry/PluginRegistry.tsx +94 -0
  82. package/src/containers/PluginRegistry/index.ts +5 -0
  83. package/src/containers/index.ts +10 -0
  84. package/src/meta.ts +12 -5
  85. package/src/operations/index.ts +7 -0
  86. package/src/operations/open-plugin-registry.ts +21 -0
  87. package/src/translations.ts +19 -15
  88. package/dist/lib/browser/app-graph-builder-P3ZGGFAR.mjs +0 -166
  89. package/dist/lib/browser/app-graph-builder-P3ZGGFAR.mjs.map +0 -7
  90. package/dist/lib/browser/chunk-VOAOTNGS.mjs +0 -19
  91. package/dist/lib/browser/chunk-VOAOTNGS.mjs.map +0 -7
  92. package/dist/lib/browser/operation-resolver-P5PKLPRT.mjs +0 -24
  93. package/dist/lib/browser/operation-resolver-P5PKLPRT.mjs.map +0 -7
  94. package/dist/lib/browser/react-surface-IIM6T7IA.mjs +0 -337
  95. package/dist/lib/browser/react-surface-IIM6T7IA.mjs.map +0 -7
  96. package/dist/lib/node-esm/app-graph-builder-56JXLOGZ.mjs +0 -167
  97. package/dist/lib/node-esm/app-graph-builder-56JXLOGZ.mjs.map +0 -7
  98. package/dist/lib/node-esm/chunk-SALMIZ2W.mjs +0 -21
  99. package/dist/lib/node-esm/chunk-SALMIZ2W.mjs.map +0 -7
  100. package/dist/lib/node-esm/operation-resolver-3ZB5W3T3.mjs +0 -25
  101. package/dist/lib/node-esm/operation-resolver-3ZB5W3T3.mjs.map +0 -7
  102. package/dist/lib/node-esm/react-surface-F67P7RC3.mjs +0 -338
  103. package/dist/lib/node-esm/react-surface-F67P7RC3.mjs.map +0 -7
  104. package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts +0 -6
  105. package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts.map +0 -1
  106. package/dist/types/src/capabilities/app-graph-builder/index.d.ts +0 -3
  107. package/dist/types/src/capabilities/app-graph-builder/index.d.ts.map +0 -1
  108. package/dist/types/src/capabilities/operation-resolver/index.d.ts +0 -3
  109. package/dist/types/src/capabilities/operation-resolver/index.d.ts.map +0 -1
  110. package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts +0 -5
  111. package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts.map +0 -1
  112. package/dist/types/src/capabilities/react-surface/index.d.ts +0 -3
  113. package/dist/types/src/capabilities/react-surface/index.d.ts.map +0 -1
  114. package/dist/types/src/capabilities/react-surface/react-surface.d.ts +0 -5
  115. package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +0 -1
  116. package/dist/types/src/components/PluginDetail.d.ts +0 -9
  117. package/dist/types/src/components/PluginDetail.d.ts.map +0 -1
  118. package/dist/types/src/components/PluginDetail.stories.d.ts +0 -32
  119. package/dist/types/src/components/PluginDetail.stories.d.ts.map +0 -1
  120. package/dist/types/src/components/PluginItem.d.ts.map +0 -1
  121. package/dist/types/src/components/PluginList.d.ts.map +0 -1
  122. package/dist/types/src/components/PluginList.stories.d.ts +0 -34
  123. package/dist/types/src/components/PluginList.stories.d.ts.map +0 -1
  124. package/dist/types/src/components/RegistryContainer.d.ts +0 -8
  125. package/dist/types/src/components/RegistryContainer.d.ts.map +0 -1
  126. package/src/capabilities/app-graph-builder/app-graph-builder.ts +0 -136
  127. package/src/capabilities/app-graph-builder/index.ts +0 -7
  128. package/src/capabilities/operation-resolver/index.ts +0 -7
  129. package/src/capabilities/operation-resolver/operation-resolver.ts +0 -23
  130. package/src/capabilities/react-surface/index.ts +0 -7
  131. package/src/capabilities/react-surface/react-surface.tsx +0 -99
  132. package/src/components/PluginDetail.tsx +0 -79
  133. package/src/components/PluginList.stories.tsx +0 -77
  134. package/src/components/RegistryContainer.tsx +0 -83
  135. /package/dist/types/src/components/{PluginItem.d.ts → PluginList/PluginItem.d.ts} +0 -0
  136. /package/dist/types/src/components/{PluginList.d.ts → PluginList/PluginList.d.ts} +0 -0
  137. /package/src/components/{PluginList.tsx → PluginList/PluginList.tsx} +0 -0
@@ -1,77 +0,0 @@
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 { faker } from '@dxos/random';
10
- import { withLayout, withTheme } from '@dxos/react-ui/testing';
11
- import { getHashHue } from '@dxos/ui-theme';
12
-
13
- import { translations } from '../translations';
14
- import { RegistryTagType } from '../types';
15
-
16
- import { PluginList } from './PluginList';
17
-
18
- faker.seed(1);
19
-
20
- const icons = [
21
- 'ph--bug--regular',
22
- 'ph--compass--regular',
23
- 'ph--kanban--regular',
24
- 'ph--table--regular',
25
- 'ph--gear--regular',
26
- 'ph--github-logo--regular',
27
- ];
28
-
29
- const DefaultStory = () => {
30
- const [plugins] = useState<Plugin.Plugin[]>(
31
- faker.helpers.multiple(
32
- () =>
33
- PluginNS.define({
34
- id: `dxos.org/plugin/plugin-${faker.string.uuid()}`,
35
- name: `${faker.commerce.productName()}`,
36
- description: faker.lorem.sentences(Math.ceil(Math.random() * 3)),
37
- tags: faker.helpers.uniqueArray(RegistryTagType.literals as any, Math.floor(Math.random() * 3)),
38
- icon: faker.helpers.arrayElement(icons),
39
- iconHue: getHashHue(faker.string.uuid()),
40
- homePage: faker.datatype.boolean({ probability: 0.5 }) ? faker.internet.url() : undefined,
41
- source: faker.internet.url(),
42
- }).pipe(PluginNS.make)(),
43
- { count: 32 },
44
- ),
45
- );
46
- const [enabled, setEnabled] = useState<string[]>([]);
47
-
48
- const handleChange = (id: string, enabled: boolean) => {
49
- setEnabled((plugins) => (enabled ? [...plugins, id] : plugins.filter((plugin) => plugin === id)));
50
- };
51
-
52
- return <PluginList plugins={plugins} enabled={enabled} onChange={handleChange} hasSettings={() => true} />;
53
- };
54
-
55
- const meta = {
56
- title: 'plugins/plugin-registry/PluginList',
57
- component: PluginList,
58
- render: DefaultStory,
59
- parameters: {
60
- translations,
61
- },
62
- } satisfies Meta<typeof PluginList>;
63
-
64
- export default meta;
65
-
66
- type Story = StoryObj<typeof meta>;
67
-
68
- export const Default: Story = {
69
- decorators: [withTheme, withLayout({ layout: 'column', scroll: true })],
70
- };
71
-
72
- export const FullScreen: Story = {
73
- decorators: [withTheme, withLayout({ scroll: true })],
74
- parameters: {
75
- layout: 'fullscreen',
76
- },
77
- };
@@ -1,83 +0,0 @@
1
- //
2
- // Copyright 2023 DXOS.org
3
- //
4
-
5
- import { useAtomValue } from '@effect-atom/atom-react';
6
- import * as Effect from 'effect/Effect';
7
- import React, { useCallback, useMemo } from 'react';
8
-
9
- import { Common, type Plugin, SettingsOperation } from '@dxos/app-framework';
10
- import { useCapabilities, useOperationInvoker, usePluginManager } from '@dxos/app-framework/react';
11
- import { runAndForwardErrors } from '@dxos/effect';
12
- import { ObservabilityOperation } from '@dxos/plugin-observability/types';
13
- import { Layout } from '@dxos/react-ui-mosaic';
14
-
15
- import { PluginList } from './PluginList';
16
-
17
- const sortByPluginMeta = ({ meta: { name: a = '' } }: Plugin.Plugin, { meta: { name: b = '' } }: Plugin.Plugin) =>
18
- a.localeCompare(b);
19
-
20
- export type RegistryContainerProps = {
21
- id: string;
22
- plugins: Plugin.Plugin[];
23
- };
24
-
25
- export const RegistryContainer = ({ id, plugins: pluginsProp }: RegistryContainerProps) => {
26
- const manager = usePluginManager();
27
- const { invoke, invokePromise } = useOperationInvoker();
28
- const plugins = useMemo(() => pluginsProp.sort(sortByPluginMeta), [pluginsProp]);
29
- const enabled = useAtomValue(manager.enabled);
30
- const allSettings = useCapabilities(Common.Capability.Settings);
31
-
32
- // TODO(wittjosiah): Factor out to an intent?
33
- const handleChange = useCallback(
34
- (id: string, enabled: boolean) =>
35
- Effect.gen(function* () {
36
- if (enabled) {
37
- yield* manager.enable(id);
38
- } else {
39
- yield* manager.disable(id);
40
- }
41
-
42
- yield* invoke(ObservabilityOperation.SendEvent, {
43
- name: 'plugins.toggle',
44
- properties: {
45
- plugin: id,
46
- enabled,
47
- },
48
- });
49
- }).pipe(runAndForwardErrors),
50
- [invoke, manager],
51
- );
52
-
53
- const handleClick = useCallback(
54
- (pluginId: string) =>
55
- invokePromise(Common.LayoutOperation.Open, {
56
- // TODO(wittjosiah): `/` currently is not supported in ids.
57
- subject: [pluginId.replaceAll('/', ':')],
58
- pivotId: id,
59
- positioning: 'end',
60
- }),
61
- [invokePromise, id],
62
- );
63
-
64
- const hasSettings = useCallback((pluginId: string) => allSettings.some((s) => s.prefix === pluginId), [allSettings]);
65
-
66
- const handleSettings = useCallback(
67
- (pluginId: string) => invokePromise(SettingsOperation.Open, { plugin: pluginId }),
68
- [invokePromise],
69
- );
70
-
71
- return (
72
- <Layout.Container scrollable>
73
- <PluginList
74
- plugins={plugins}
75
- enabled={enabled}
76
- onClick={handleClick}
77
- onChange={handleChange}
78
- hasSettings={hasSettings}
79
- onSettings={handleSettings}
80
- />
81
- </Layout.Container>
82
- );
83
- };