@dxos/plugin-registry 0.8.4-main.72ec0f3 → 0.8.4-main.74a063c4e0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/browser/cli/index.mjs +219 -0
- package/dist/lib/browser/cli/index.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +52 -50
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node-esm/cli/index.mjs +221 -0
- package/dist/lib/node-esm/cli/index.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +73 -0
- package/dist/lib/node-esm/index.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -0
- package/dist/types/src/RegistryPlugin.d.ts +2 -1
- package/dist/types/src/RegistryPlugin.d.ts.map +1 -1
- 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/index.d.ts +5 -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/cli/commands/disable.d.ts +11 -0
- package/dist/types/src/cli/commands/disable.d.ts.map +1 -0
- package/dist/types/src/cli/commands/enable.d.ts +11 -0
- package/dist/types/src/cli/commands/enable.d.ts.map +1 -0
- package/dist/types/src/cli/commands/index.d.ts +3 -0
- package/dist/types/src/cli/commands/index.d.ts.map +1 -0
- package/dist/types/src/cli/commands/list.d.ts +7 -0
- package/dist/types/src/cli/commands/list.d.ts.map +1 -0
- package/dist/types/src/cli/commands/util.d.ts +11 -0
- package/dist/types/src/cli/commands/util.d.ts.map +1 -0
- package/dist/types/src/cli/index.d.ts +3 -0
- package/dist/types/src/cli/index.d.ts.map +1 -0
- package/dist/types/src/cli/plugin.d.ts +3 -0
- package/dist/types/src/cli/plugin.d.ts.map +1 -0
- package/dist/types/src/cli/storage.d.ts +18 -0
- package/dist/types/src/cli/storage.d.ts.map +1 -0
- package/dist/types/src/components/PluginDetail/PluginDetail.d.ts +15 -0
- package/dist/types/src/components/PluginDetail/PluginDetail.d.ts.map +1 -0
- package/dist/types/src/components/PluginDetail/PluginDetail.stories.d.ts +43 -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/{PluginItem.d.ts → PluginList/PluginItem.d.ts} +2 -2
- package/dist/types/src/components/PluginList/PluginItem.d.ts.map +1 -0
- package/dist/types/src/components/{PluginList.d.ts → PluginList/PluginList.d.ts} +1 -1
- package/dist/types/src/components/PluginList/PluginList.d.ts.map +1 -0
- package/dist/types/src/components/PluginList/PluginList.stories.d.ts +38 -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/index.d.ts +0 -1
- package/dist/types/src/components/index.d.ts.map +1 -1
- 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/PluginRegistry/PluginRegistry.d.ts +14 -0
- package/dist/types/src/containers/PluginRegistry/PluginRegistry.d.ts.map +1 -0
- package/dist/types/src/containers/PluginRegistry/index.d.ts +2 -0
- package/dist/types/src/containers/PluginRegistry/index.d.ts.map +1 -0
- package/dist/types/src/containers/index.d.ts +6 -0
- package/dist/types/src/containers/index.d.ts.map +1 -0
- package/dist/types/src/meta.d.ts +7 -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/translations.d.ts +19 -15
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +58 -32
- package/src/RegistryPlugin.tsx +12 -25
- package/src/capabilities/app-graph-builder.ts +128 -135
- package/src/capabilities/index.ts +8 -4
- package/src/capabilities/operation-handler.ts +16 -0
- package/src/capabilities/react-surface.tsx +84 -75
- package/src/cli/commands/disable.ts +47 -0
- package/src/cli/commands/enable.ts +44 -0
- package/src/cli/commands/index.ts +14 -0
- package/src/cli/commands/list.ts +41 -0
- package/src/cli/commands/util.ts +24 -0
- package/src/cli/index.ts +6 -0
- package/src/cli/plugin.ts +17 -0
- package/src/cli/storage.ts +50 -0
- package/src/components/PluginDetail/PluginDetail.stories.tsx +43 -0
- package/src/components/PluginDetail/PluginDetail.tsx +84 -0
- package/src/components/PluginDetail/index.ts +5 -0
- package/src/components/{PluginItem.tsx → PluginList/PluginItem.tsx} +20 -16
- package/src/components/PluginList/PluginList.stories.tsx +87 -0
- package/src/components/{PluginList.tsx → PluginList/PluginList.tsx} +2 -2
- package/src/components/PluginList/index.ts +5 -0
- package/src/components/index.ts +0 -1
- package/src/containers/LoadPluginDialog/LoadPluginDialog.tsx +84 -0
- package/src/containers/LoadPluginDialog/index.ts +5 -0
- package/src/containers/PluginArticle/PluginArticle.tsx +28 -0
- package/src/containers/PluginArticle/index.ts +5 -0
- package/src/containers/PluginRegistry/PluginRegistry.tsx +94 -0
- package/src/containers/PluginRegistry/index.ts +5 -0
- package/src/containers/index.ts +10 -0
- package/src/meta.ts +14 -7
- package/src/operations/index.ts +7 -0
- package/src/operations/open-plugin-registry.ts +21 -0
- package/src/translations.ts +19 -15
- package/dist/lib/browser/app-graph-builder-6CNBP3A4.mjs +0 -162
- package/dist/lib/browser/app-graph-builder-6CNBP3A4.mjs.map +0 -7
- package/dist/lib/browser/chunk-XPEFEID2.mjs +0 -19
- package/dist/lib/browser/chunk-XPEFEID2.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-LKNUYBTN.mjs +0 -23
- package/dist/lib/browser/intent-resolver-LKNUYBTN.mjs.map +0 -7
- package/dist/lib/browser/react-surface-IGCXOVE2.mjs +0 -359
- package/dist/lib/browser/react-surface-IGCXOVE2.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/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.map +0 -1
- package/dist/types/src/components/PluginList.d.ts.map +0 -1
- package/dist/types/src/components/PluginList.stories.d.ts +0 -34
- 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/PluginDetail.stories.tsx +0 -45
- package/src/components/PluginDetail.tsx +0 -82
- package/src/components/PluginList.stories.tsx +0 -80
- package/src/components/RegistryContainer.tsx +0 -76
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
6
|
-
|
|
7
|
-
import { faker } from '@dxos/random';
|
|
8
|
-
import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
9
|
-
|
|
10
|
-
import { translations } from '../translations';
|
|
11
|
-
|
|
12
|
-
import { PluginDetail } from './PluginDetail';
|
|
13
|
-
|
|
14
|
-
const meta = {
|
|
15
|
-
title: 'plugins/plugin-registry/PluginDetail',
|
|
16
|
-
component: PluginDetail,
|
|
17
|
-
decorators: [withTheme, withLayout({ container: 'column' })],
|
|
18
|
-
parameters: {
|
|
19
|
-
translations,
|
|
20
|
-
},
|
|
21
|
-
} satisfies Meta<typeof PluginDetail>;
|
|
22
|
-
|
|
23
|
-
export default meta;
|
|
24
|
-
|
|
25
|
-
type Story = StoryObj<typeof meta>;
|
|
26
|
-
|
|
27
|
-
export const Default: Story = {
|
|
28
|
-
args: {
|
|
29
|
-
plugin: {
|
|
30
|
-
meta: {
|
|
31
|
-
id: 'example.com/plugin/test-plugin',
|
|
32
|
-
name: 'Test Plugin',
|
|
33
|
-
description: faker.lorem.paragraphs(2),
|
|
34
|
-
icon: 'ph--bug--regular',
|
|
35
|
-
iconHue: 'sky',
|
|
36
|
-
homePage: 'https://example.com',
|
|
37
|
-
source: 'https://github.com/example/test-plugin',
|
|
38
|
-
screenshots: [
|
|
39
|
-
'https://media.gcflearnfree.org/content/55e073de7dd48174331f51b3_01_17_2014/getting_started_interactive2.png',
|
|
40
|
-
],
|
|
41
|
-
},
|
|
42
|
-
modules: [],
|
|
43
|
-
},
|
|
44
|
-
},
|
|
45
|
-
};
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import React from 'react';
|
|
6
|
-
|
|
7
|
-
import { type Plugin } from '@dxos/app-framework';
|
|
8
|
-
import { Icon, Input, Link, useTranslation } from '@dxos/react-ui';
|
|
9
|
-
import { StackItem } from '@dxos/react-ui-stack';
|
|
10
|
-
import { getStyles, mx } from '@dxos/react-ui-theme';
|
|
11
|
-
|
|
12
|
-
import { meta } from '../meta';
|
|
13
|
-
|
|
14
|
-
export type PluginDetailProps = {
|
|
15
|
-
plugin: Plugin;
|
|
16
|
-
enabled?: boolean;
|
|
17
|
-
onEnable?: () => void;
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
export const PluginDetail = ({ plugin, enabled, onEnable }: PluginDetailProps) => {
|
|
21
|
-
const { t } = useTranslation(meta.id);
|
|
22
|
-
const {
|
|
23
|
-
id,
|
|
24
|
-
name,
|
|
25
|
-
description,
|
|
26
|
-
homePage,
|
|
27
|
-
source,
|
|
28
|
-
screenshots,
|
|
29
|
-
icon = 'ph--circle--regular',
|
|
30
|
-
iconHue = 'neutral',
|
|
31
|
-
} = plugin.meta;
|
|
32
|
-
const styles = getStyles(iconHue);
|
|
33
|
-
|
|
34
|
-
return (
|
|
35
|
-
<StackItem.Content scrollable>
|
|
36
|
-
<div role='none' className='grid grid-cols-[min-content_1fr] gap-4 container-max-width p-4'>
|
|
37
|
-
<div role='none'>
|
|
38
|
-
<Icon classNames={mx('p-1 rounded', styles.bg, styles.icon)} icon={icon} size={14} />
|
|
39
|
-
</div>
|
|
40
|
-
<div role='none' className='flex flex-col gap-6'>
|
|
41
|
-
<div role='none' className='grid grid-cols-[1fr_min-content] gap-x-3 is-full pbs-1'>
|
|
42
|
-
<h2 className='text-xl'>{name}</h2>
|
|
43
|
-
<Input.Root>
|
|
44
|
-
<Input.Switch classNames='self-center' checked={enabled} onClick={onEnable} />
|
|
45
|
-
</Input.Root>
|
|
46
|
-
<p className='pbs-0.5 text-sm text-description'>{id}</p>
|
|
47
|
-
</div>
|
|
48
|
-
|
|
49
|
-
<div role='none'>
|
|
50
|
-
<p className='text-description'>{description}</p>
|
|
51
|
-
</div>
|
|
52
|
-
|
|
53
|
-
{screenshots && screenshots.length > 0 && (
|
|
54
|
-
<div role='none' className='flex flex-col gap-2'>
|
|
55
|
-
<h2>Preview</h2>
|
|
56
|
-
<img src={screenshots[0]} alt={name} className='aspect-video object-fit' />
|
|
57
|
-
</div>
|
|
58
|
-
)}
|
|
59
|
-
|
|
60
|
-
<div role='none' className='flex flex-col gap-2'>
|
|
61
|
-
<h2>Resources</h2>
|
|
62
|
-
<div className='flex gap-2'>
|
|
63
|
-
{homePage && (
|
|
64
|
-
<Link href={homePage} target='_blank' rel='noreferrer' classNames='text-sm text-description'>
|
|
65
|
-
{t('home page label')}
|
|
66
|
-
<Icon icon='ph--arrow-square-out--bold' size={3} classNames='inline-block leading-none mli-1' />
|
|
67
|
-
</Link>
|
|
68
|
-
)}
|
|
69
|
-
|
|
70
|
-
{source && (
|
|
71
|
-
<Link href={source} target='_blank' rel='noreferrer' classNames='text-sm text-description'>
|
|
72
|
-
{t('source label')}
|
|
73
|
-
<Icon icon='ph--arrow-square-out--bold' size={3} classNames='inline-block leading-none mli-1' />
|
|
74
|
-
</Link>
|
|
75
|
-
)}
|
|
76
|
-
</div>
|
|
77
|
-
</div>
|
|
78
|
-
</div>
|
|
79
|
-
</div>
|
|
80
|
-
</StackItem.Content>
|
|
81
|
-
);
|
|
82
|
-
};
|
|
@@ -1,80 +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, definePlugin } from '@dxos/app-framework';
|
|
9
|
-
import { faker } from '@dxos/random';
|
|
10
|
-
import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
11
|
-
import { getHashHue } from '@dxos/react-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[]>(
|
|
31
|
-
faker.helpers.multiple(
|
|
32
|
-
() =>
|
|
33
|
-
definePlugin(
|
|
34
|
-
{
|
|
35
|
-
id: `dxos.org/plugin/plugin-${faker.string.uuid()}`,
|
|
36
|
-
name: `${faker.commerce.productName()}`,
|
|
37
|
-
description: faker.lorem.sentences(Math.ceil(Math.random() * 3)),
|
|
38
|
-
tags: faker.helpers.uniqueArray(RegistryTagType.literals as any, Math.floor(Math.random() * 3)),
|
|
39
|
-
icon: faker.helpers.arrayElement(icons),
|
|
40
|
-
iconHue: getHashHue(faker.string.uuid()),
|
|
41
|
-
homePage: faker.datatype.boolean({ probability: 0.5 }) ? faker.internet.url() : undefined,
|
|
42
|
-
source: faker.internet.url(),
|
|
43
|
-
},
|
|
44
|
-
() => [],
|
|
45
|
-
)(),
|
|
46
|
-
{ count: 32 },
|
|
47
|
-
),
|
|
48
|
-
);
|
|
49
|
-
const [enabled, setEnabled] = useState<string[]>([]);
|
|
50
|
-
|
|
51
|
-
const handleChange = (id: string, enabled: boolean) => {
|
|
52
|
-
setEnabled((plugins) => (enabled ? [...plugins, id] : plugins.filter((plugin) => plugin === id)));
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
return <PluginList plugins={plugins} enabled={enabled} onChange={handleChange} hasSettings={() => true} />;
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
const meta = {
|
|
59
|
-
title: 'plugins/plugin-registry/PluginList',
|
|
60
|
-
component: PluginList,
|
|
61
|
-
render: DefaultStory,
|
|
62
|
-
parameters: {
|
|
63
|
-
translations,
|
|
64
|
-
},
|
|
65
|
-
} satisfies Meta<typeof PluginList>;
|
|
66
|
-
|
|
67
|
-
export default meta;
|
|
68
|
-
|
|
69
|
-
type Story = StoryObj<typeof meta>;
|
|
70
|
-
|
|
71
|
-
export const Default: Story = {
|
|
72
|
-
decorators: [withTheme, withLayout({ container: 'column', scroll: true })],
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
export const FullScreen: Story = {
|
|
76
|
-
decorators: [withTheme, withLayout({ scroll: true })],
|
|
77
|
-
parameters: {
|
|
78
|
-
layout: 'fullscreen',
|
|
79
|
-
},
|
|
80
|
-
};
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2023 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import React, { useCallback, useMemo } from 'react';
|
|
6
|
-
|
|
7
|
-
import { Capabilities, LayoutAction, type Plugin, SettingsAction, createIntent } from '@dxos/app-framework';
|
|
8
|
-
import { useCapability, useIntentDispatcher, usePluginManager } from '@dxos/app-framework/react';
|
|
9
|
-
import { ObservabilityAction } from '@dxos/plugin-observability/types';
|
|
10
|
-
import { StackItem } from '@dxos/react-ui-stack';
|
|
11
|
-
|
|
12
|
-
import { PluginList } from './PluginList';
|
|
13
|
-
|
|
14
|
-
const sortByPluginMeta = ({ meta: { name: a = '' } }: Plugin, { meta: { name: b = '' } }: Plugin) => a.localeCompare(b);
|
|
15
|
-
|
|
16
|
-
export const RegistryContainer = ({ id, plugins: _plugins }: { id: string; plugins: Plugin[] }) => {
|
|
17
|
-
const manager = usePluginManager();
|
|
18
|
-
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
19
|
-
const plugins = useMemo(() => _plugins.sort(sortByPluginMeta), [_plugins]);
|
|
20
|
-
const settingsStore = useCapability(Capabilities.SettingsStore);
|
|
21
|
-
|
|
22
|
-
// TODO(wittjosiah): Factor out to an intent?
|
|
23
|
-
const handleChange = useCallback(
|
|
24
|
-
async (id: string, enabled: boolean) => {
|
|
25
|
-
if (enabled) {
|
|
26
|
-
await manager.enable(id);
|
|
27
|
-
} else {
|
|
28
|
-
await manager.disable(id);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
await dispatch(
|
|
32
|
-
createIntent(ObservabilityAction.SendEvent, {
|
|
33
|
-
name: 'plugins.toggle',
|
|
34
|
-
properties: {
|
|
35
|
-
plugin: id,
|
|
36
|
-
enabled,
|
|
37
|
-
},
|
|
38
|
-
}),
|
|
39
|
-
);
|
|
40
|
-
},
|
|
41
|
-
[dispatch, manager],
|
|
42
|
-
);
|
|
43
|
-
|
|
44
|
-
const handleClick = useCallback(
|
|
45
|
-
(pluginId: string) =>
|
|
46
|
-
dispatch(
|
|
47
|
-
createIntent(LayoutAction.Open, {
|
|
48
|
-
part: 'main',
|
|
49
|
-
// TODO(wittjosiah): `/` currently is not supported in ids.
|
|
50
|
-
subject: [pluginId.replaceAll('/', ':')],
|
|
51
|
-
options: { pivotId: id, positioning: 'end' },
|
|
52
|
-
}),
|
|
53
|
-
),
|
|
54
|
-
[dispatch, id],
|
|
55
|
-
);
|
|
56
|
-
|
|
57
|
-
const hasSettings = useCallback((pluginId: string) => !!settingsStore.getStore(pluginId), [settingsStore]);
|
|
58
|
-
|
|
59
|
-
const handleSettings = useCallback(
|
|
60
|
-
(pluginId: string) => dispatch(createIntent(SettingsAction.Open, { plugin: pluginId })),
|
|
61
|
-
[dispatch],
|
|
62
|
-
);
|
|
63
|
-
|
|
64
|
-
return (
|
|
65
|
-
<StackItem.Content scrollable>
|
|
66
|
-
<PluginList
|
|
67
|
-
plugins={plugins}
|
|
68
|
-
enabled={manager.enabled}
|
|
69
|
-
onClick={handleClick}
|
|
70
|
-
onChange={handleChange}
|
|
71
|
-
hasSettings={hasSettings}
|
|
72
|
-
onSettings={handleSettings}
|
|
73
|
-
/>
|
|
74
|
-
</StackItem.Content>
|
|
75
|
-
);
|
|
76
|
-
};
|