@dxos/plugin-registry 0.8.4-main.9735255 → 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.
- package/dist/lib/browser/cli/index.mjs +15 -19
- package/dist/lib/browser/cli/index.mjs.map +3 -3
- package/dist/lib/browser/index.mjs +50 -41
- 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 +15 -18
- package/dist/lib/node-esm/cli/index.mjs.map +3 -3
- package/dist/lib/node-esm/index.mjs +51 -41
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/types/src/RegistryPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts +6 -0
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -0
- 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 +5 -0
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -0
- package/dist/types/src/cli/commands/disable.d.ts +2 -2
- package/dist/types/src/cli/commands/enable.d.ts +2 -2
- package/dist/types/src/cli/plugin.d.ts.map +1 -1
- package/dist/types/src/cli/storage.d.ts +4 -4
- package/dist/types/src/cli/storage.d.ts.map +1 -1
- package/dist/types/src/components/PluginDetail/PluginDetail.d.ts +11 -0
- package/dist/types/src/components/PluginDetail/PluginDetail.d.ts.map +1 -0
- package/dist/types/src/components/PluginDetail/PluginDetail.stories.d.ts +39 -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/PluginList/PluginItem.d.ts.map +1 -0
- 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 +10 -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 +5 -1
- 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 +41 -31
- package/src/RegistryPlugin.tsx +9 -7
- package/src/capabilities/app-graph-builder.ts +149 -0
- package/src/capabilities/index.ts +9 -3
- package/src/capabilities/operation-handler.ts +16 -0
- package/src/capabilities/react-surface.tsx +95 -0
- package/src/cli/plugin.ts +4 -3
- package/src/cli/storage.ts +14 -21
- package/src/components/{PluginDetail.stories.tsx → PluginDetail/PluginDetail.stories.tsx} +6 -6
- package/src/components/PluginDetail/PluginDetail.tsx +84 -0
- package/src/components/PluginDetail/index.ts +5 -0
- package/src/components/{PluginItem.tsx → PluginList/PluginItem.tsx} +16 -12
- package/src/components/PluginList/PluginList.stories.tsx +87 -0
- package/src/components/PluginList/index.ts +5 -0
- package/src/components/index.ts +0 -1
- package/src/containers/LoadPluginDialog/LoadPluginDialog.tsx +85 -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 +12 -5
- 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-P3ZGGFAR.mjs +0 -166
- package/dist/lib/browser/app-graph-builder-P3ZGGFAR.mjs.map +0 -7
- package/dist/lib/browser/chunk-VOAOTNGS.mjs +0 -19
- package/dist/lib/browser/chunk-VOAOTNGS.mjs.map +0 -7
- package/dist/lib/browser/operation-resolver-P5PKLPRT.mjs +0 -24
- package/dist/lib/browser/operation-resolver-P5PKLPRT.mjs.map +0 -7
- package/dist/lib/browser/react-surface-IIM6T7IA.mjs +0 -337
- package/dist/lib/browser/react-surface-IIM6T7IA.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-builder-56JXLOGZ.mjs +0 -167
- package/dist/lib/node-esm/app-graph-builder-56JXLOGZ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-SALMIZ2W.mjs +0 -21
- package/dist/lib/node-esm/chunk-SALMIZ2W.mjs.map +0 -7
- package/dist/lib/node-esm/operation-resolver-3ZB5W3T3.mjs +0 -25
- package/dist/lib/node-esm/operation-resolver-3ZB5W3T3.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-F67P7RC3.mjs +0 -338
- package/dist/lib/node-esm/react-surface-F67P7RC3.mjs.map +0 -7
- package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts +0 -6
- package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts.map +0 -1
- package/dist/types/src/capabilities/app-graph-builder/index.d.ts +0 -3
- package/dist/types/src/capabilities/app-graph-builder/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/operation-resolver/index.d.ts +0 -3
- package/dist/types/src/capabilities/operation-resolver/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts +0 -5
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface/index.d.ts +0 -3
- package/dist/types/src/capabilities/react-surface/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts +0 -5
- package/dist/types/src/capabilities/react-surface/react-surface.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 -8
- package/dist/types/src/components/RegistryContainer.d.ts.map +0 -1
- package/src/capabilities/app-graph-builder/app-graph-builder.ts +0 -136
- package/src/capabilities/app-graph-builder/index.ts +0 -7
- package/src/capabilities/operation-resolver/index.ts +0 -7
- package/src/capabilities/operation-resolver/operation-resolver.ts +0 -23
- package/src/capabilities/react-surface/index.ts +0 -7
- package/src/capabilities/react-surface/react-surface.tsx +0 -99
- package/src/components/PluginDetail.tsx +0 -79
- package/src/components/PluginList.stories.tsx +0 -77
- package/src/components/RegistryContainer.tsx +0 -83
- /package/dist/types/src/components/{PluginItem.d.ts → PluginList/PluginItem.d.ts} +0 -0
- /package/dist/types/src/components/{PluginList.d.ts → PluginList/PluginList.d.ts} +0 -0
- /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
|
-
};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|