@dxos/app-framework 0.8.4-main.fd6878d → 0.8.4-main.fffef41
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/.storybook/main.mts +11 -0
- package/.storybook/preview.mts +8 -0
- package/.swc/plugins/linux_x86_64_19.0.0/727453fb3a62f7f1d952a41e051ca8a6f88cadc45cee43c6a4d1aa45f9b75665.wasmer-v7 +0 -0
- package/.swc/plugins/{v7_linux_x86_64_13.0.0/fce1bdb8e20a094e4af08bad09cc81497ed0e2e7c51223b07d371063cca18429 → linux_x86_64_19.0.0/fce1bdb8e20a094e4af08bad09cc81497ed0e2e7c51223b07d371063cca18429.wasmer-v7} +0 -0
- package/dist/lib/browser/{app-graph-builder-MOVKFH3J.mjs → app-graph-builder-OIEZZC45.mjs} +31 -30
- package/dist/lib/browser/app-graph-builder-OIEZZC45.mjs.map +7 -0
- package/dist/lib/browser/{chunk-OSBZFKMO.mjs → chunk-6XKO24JP.mjs} +232 -177
- package/dist/lib/browser/chunk-6XKO24JP.mjs.map +7 -0
- package/dist/lib/browser/{chunk-ORWHM7CO.mjs → chunk-SCPE4ZO2.mjs} +11 -8
- package/dist/lib/browser/chunk-SCPE4ZO2.mjs.map +7 -0
- package/dist/lib/browser/{chunk-NKCIDYDI.mjs → chunk-WPW5VVAX.mjs} +189 -136
- package/dist/lib/browser/chunk-WPW5VVAX.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +20 -56
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/{intent-dispatcher-FTTJLVGN.mjs → intent-dispatcher-LZ4AE66E.mjs} +2 -2
- package/dist/lib/browser/{intent-resolver-ZCGEAG3E.mjs → intent-resolver-QVCKRX6G.mjs} +7 -7
- package/dist/lib/browser/intent-resolver-QVCKRX6G.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/react/index.mjs +34 -0
- package/dist/lib/browser/{store-3QB6Q2BC.mjs → store-CNPHOYTJ.mjs} +5 -5
- package/dist/lib/browser/store-CNPHOYTJ.mjs.map +7 -0
- package/dist/lib/browser/testing/index.mjs +17 -21
- package/dist/lib/browser/testing/index.mjs.map +3 -3
- package/dist/lib/node-esm/{app-graph-builder-ODE4B5GT.mjs → app-graph-builder-EBU4NVWD.mjs} +31 -30
- package/dist/lib/node-esm/app-graph-builder-EBU4NVWD.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-WU3QN5B6.mjs → chunk-3UPX5OIS.mjs} +232 -177
- package/dist/lib/node-esm/chunk-3UPX5OIS.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-YEN7NKTF.mjs → chunk-XJZGUJ3H.mjs} +189 -136
- package/dist/lib/node-esm/chunk-XJZGUJ3H.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-UMZQERLE.mjs → chunk-ZX63QUGE.mjs} +11 -8
- package/dist/lib/node-esm/chunk-ZX63QUGE.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +20 -56
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/{intent-dispatcher-YQIQ55LJ.mjs → intent-dispatcher-MGOJ3CHD.mjs} +2 -2
- package/dist/lib/node-esm/{intent-resolver-KG27L7EQ.mjs → intent-resolver-URF3HN3G.mjs} +7 -7
- package/dist/lib/node-esm/intent-resolver-URF3HN3G.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/react/index.mjs +35 -0
- package/dist/lib/node-esm/{store-TIJAVO3D.mjs → store-RK5B4XEL.mjs} +5 -5
- package/dist/lib/node-esm/store-RK5B4XEL.mjs.map +7 -0
- package/dist/lib/node-esm/testing/index.mjs +17 -21
- package/dist/lib/node-esm/testing/index.mjs.map +3 -3
- package/dist/types/src/common/capabilities.d.ts +41 -43
- package/dist/types/src/common/capabilities.d.ts.map +1 -1
- package/dist/types/src/common/collaboration.d.ts +10 -9
- package/dist/types/src/common/collaboration.d.ts.map +1 -1
- package/dist/types/src/common/file.d.ts +1 -1
- package/dist/types/src/common/file.d.ts.map +1 -1
- package/dist/types/src/common/layout.d.ts +1 -3
- package/dist/types/src/common/layout.d.ts.map +1 -1
- package/dist/types/src/common/surface.d.ts +19 -16
- package/dist/types/src/common/surface.d.ts.map +1 -1
- package/dist/types/src/common/translations.d.ts +1 -1
- package/dist/types/src/common/translations.d.ts.map +1 -1
- package/dist/types/src/core/capabilities.d.ts +19 -16
- package/dist/types/src/core/capabilities.d.ts.map +1 -1
- package/dist/types/src/core/manager.d.ts +1 -1
- package/dist/types/src/core/manager.d.ts.map +1 -1
- package/dist/types/src/core/plugin.d.ts +8 -1
- package/dist/types/src/core/plugin.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +0 -2
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/playground/debug/Debug.d.ts +1 -1
- package/dist/types/src/playground/debug/plugin.d.ts +1 -1
- package/dist/types/src/playground/debug/plugin.d.ts.map +1 -1
- package/dist/types/src/playground/generator/Main.d.ts +1 -1
- package/dist/types/src/playground/generator/Main.d.ts.map +1 -1
- package/dist/types/src/playground/generator/Toolbar.d.ts +1 -1
- package/dist/types/src/playground/generator/generator.d.ts +1 -1
- package/dist/types/src/playground/generator/generator.d.ts.map +1 -1
- package/dist/types/src/playground/generator/plugin.d.ts +1 -1
- package/dist/types/src/playground/generator/plugin.d.ts.map +1 -1
- package/dist/types/src/playground/layout/Layout.d.ts +2 -2
- package/dist/types/src/playground/layout/plugin.d.ts +1 -1
- package/dist/types/src/playground/layout/plugin.d.ts.map +1 -1
- package/dist/types/src/playground/logger/Toolbar.d.ts +1 -1
- package/dist/types/src/playground/logger/plugin.d.ts +1 -1
- package/dist/types/src/playground/logger/plugin.d.ts.map +1 -1
- package/dist/types/src/playground/logger/schema.d.ts +1 -1
- package/dist/types/src/playground/logger/schema.d.ts.map +1 -1
- package/dist/types/src/playground/playground.stories.d.ts +5 -4
- package/dist/types/src/playground/playground.stories.d.ts.map +1 -1
- package/dist/types/src/plugin-intent/IntentPlugin.d.ts +1 -1
- package/dist/types/src/plugin-intent/IntentPlugin.d.ts.map +1 -1
- package/dist/types/src/plugin-intent/actions.d.ts +5 -7
- package/dist/types/src/plugin-intent/actions.d.ts.map +1 -1
- package/dist/types/src/plugin-intent/errors.d.ts.map +1 -1
- package/dist/types/src/plugin-intent/index.d.ts +1 -0
- package/dist/types/src/plugin-intent/index.d.ts.map +1 -1
- package/dist/types/src/plugin-intent/intent-dispatcher.d.ts +5 -5
- package/dist/types/src/plugin-intent/intent-dispatcher.d.ts.map +1 -1
- package/dist/types/src/plugin-intent/intent.d.ts +1 -1
- package/dist/types/src/plugin-intent/intent.d.ts.map +1 -1
- package/dist/types/src/plugin-intent/meta.d.ts +3 -0
- package/dist/types/src/plugin-intent/meta.d.ts.map +1 -0
- package/dist/types/src/plugin-settings/SettingsPlugin.d.ts +1 -1
- package/dist/types/src/plugin-settings/SettingsPlugin.d.ts.map +1 -1
- package/dist/types/src/plugin-settings/actions.d.ts +5 -7
- package/dist/types/src/plugin-settings/actions.d.ts.map +1 -1
- package/dist/types/src/plugin-settings/app-graph-builder.d.ts +1 -1
- package/dist/types/src/plugin-settings/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/plugin-settings/intent-resolver.d.ts +1 -1
- package/dist/types/src/plugin-settings/meta.d.ts +3 -0
- package/dist/types/src/plugin-settings/meta.d.ts.map +1 -0
- package/dist/types/src/plugin-settings/store.d.ts +1 -1
- package/dist/types/src/plugin-settings/translations.d.ts +2 -1
- package/dist/types/src/plugin-settings/translations.d.ts.map +1 -1
- package/dist/types/src/react/App.d.ts +10 -0
- package/dist/types/src/react/App.d.ts.map +1 -0
- package/dist/types/src/react/App.stories.d.ts +14 -0
- package/dist/types/src/react/App.stories.d.ts.map +1 -0
- package/dist/types/src/react/DefaultFallback.d.ts +8 -0
- package/dist/types/src/react/DefaultFallback.d.ts.map +1 -0
- package/dist/types/src/react/ErrorBoundary.d.ts +2 -2
- package/dist/types/src/react/ErrorBoundary.d.ts.map +1 -1
- package/dist/types/src/react/Surface.d.ts +5 -5
- package/dist/types/src/react/Surface.d.ts.map +1 -1
- package/dist/types/src/react/Surface.stories.d.ts +8 -10
- package/dist/types/src/react/Surface.stories.d.ts.map +1 -1
- package/dist/types/src/react/index.d.ts +2 -0
- package/dist/types/src/react/index.d.ts.map +1 -1
- package/dist/types/src/react/types.d.ts +14 -0
- package/dist/types/src/react/types.d.ts.map +1 -0
- package/dist/types/src/{App.d.ts → react/useApp.d.ts} +7 -6
- package/dist/types/src/react/useApp.d.ts.map +1 -0
- package/dist/types/src/react/useLoading.d.ts +19 -0
- package/dist/types/src/react/useLoading.d.ts.map +1 -0
- package/dist/types/src/testing/withPluginManager.d.ts +7 -8
- package/dist/types/src/testing/withPluginManager.d.ts.map +1 -1
- package/dist/types/src/testing/withPluginManager.stories.d.ts +9 -3
- package/dist/types/src/testing/withPluginManager.stories.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/moon.yml +5 -1
- package/package.json +44 -40
- package/src/common/capabilities.ts +33 -25
- package/src/common/collaboration.ts +6 -9
- package/src/common/file.ts +1 -1
- package/src/common/layout.ts +3 -4
- package/src/common/surface.ts +23 -21
- package/src/common/translations.ts +1 -1
- package/src/core/capabilities.test.ts +2 -2
- package/src/core/capabilities.ts +35 -27
- package/src/core/manager.test.ts +19 -19
- package/src/core/manager.ts +14 -7
- package/src/core/plugin.ts +13 -2
- package/src/index.ts +0 -2
- package/src/playground/debug/Debug.tsx +1 -1
- package/src/playground/debug/plugin.ts +7 -8
- package/src/playground/generator/Main.tsx +0 -1
- package/src/playground/generator/generator.ts +2 -2
- package/src/playground/generator/plugin.ts +12 -13
- package/src/playground/layout/plugin.ts +9 -8
- package/src/playground/logger/plugin.ts +27 -23
- package/src/playground/logger/schema.ts +1 -1
- package/src/playground/playground.stories.tsx +17 -14
- package/src/plugin-intent/IntentPlugin.ts +12 -13
- package/src/plugin-intent/actions.ts +4 -6
- package/src/plugin-intent/errors.ts +2 -1
- package/src/plugin-intent/index.ts +1 -0
- package/src/plugin-intent/intent-dispatcher.test.ts +10 -3
- package/src/plugin-intent/intent-dispatcher.ts +16 -8
- package/src/plugin-intent/intent.ts +1 -1
- package/src/plugin-intent/meta.ts +10 -0
- package/src/plugin-settings/SettingsPlugin.ts +25 -27
- package/src/plugin-settings/actions.ts +9 -13
- package/src/plugin-settings/app-graph-builder.ts +22 -20
- package/src/plugin-settings/intent-resolver.ts +2 -2
- package/src/plugin-settings/meta.ts +10 -0
- package/src/plugin-settings/store.ts +2 -2
- package/src/plugin-settings/translations.ts +4 -4
- package/src/react/App.stories.tsx +33 -0
- package/src/react/App.tsx +59 -0
- package/src/react/DefaultFallback.tsx +26 -0
- package/src/react/ErrorBoundary.tsx +10 -8
- package/src/react/Surface.stories.tsx +79 -51
- package/src/react/Surface.tsx +67 -36
- package/src/react/index.ts +4 -0
- package/src/react/types.ts +38 -0
- package/src/react/useApp.tsx +165 -0
- package/src/react/useCapabilities.ts +2 -2
- package/src/react/useLoading.tsx +70 -0
- package/src/testing/withPluginManager.stories.tsx +7 -4
- package/src/testing/withPluginManager.tsx +27 -29
- package/tsconfig.json +11 -9
- package/vitest.config.ts +8 -6
- package/.swc/plugins/v7_linux_x86_64_13.0.0/c614d7475354583212fbd7669acbae95b9832c305bf51bdaabe2e6de05abb6bf +0 -0
- package/dist/lib/browser/app-graph-builder-MOVKFH3J.mjs.map +0 -7
- package/dist/lib/browser/chunk-NKCIDYDI.mjs.map +0 -7
- package/dist/lib/browser/chunk-ORWHM7CO.mjs.map +0 -7
- package/dist/lib/browser/chunk-OSBZFKMO.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-ZCGEAG3E.mjs.map +0 -7
- package/dist/lib/browser/store-3QB6Q2BC.mjs.map +0 -7
- package/dist/lib/browser/worker.mjs +0 -79
- package/dist/lib/node-esm/app-graph-builder-ODE4B5GT.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-UMZQERLE.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-WU3QN5B6.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-YEN7NKTF.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-KG27L7EQ.mjs.map +0 -7
- package/dist/lib/node-esm/store-TIJAVO3D.mjs.map +0 -7
- package/dist/lib/node-esm/worker.mjs +0 -80
- package/dist/types/src/App.d.ts.map +0 -1
- package/dist/types/src/worker.d.ts +0 -4
- package/dist/types/src/worker.d.ts.map +0 -1
- package/src/App.tsx +0 -284
- package/src/worker.ts +0 -11
- /package/dist/lib/browser/{intent-dispatcher-FTTJLVGN.mjs.map → intent-dispatcher-LZ4AE66E.mjs.map} +0 -0
- /package/dist/lib/browser/{worker.mjs.map → react/index.mjs.map} +0 -0
- /package/dist/lib/node-esm/{intent-dispatcher-YQIQ55LJ.mjs.map → intent-dispatcher-MGOJ3CHD.mjs.map} +0 -0
- /package/dist/lib/node-esm/{worker.mjs.map → react/index.mjs.map} +0 -0
|
@@ -2,96 +2,124 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import '@
|
|
6
|
-
|
|
7
|
-
import React, { useCallback, useState } from 'react';
|
|
5
|
+
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
6
|
+
import React, { useCallback, useEffect, useState } from 'react';
|
|
8
7
|
|
|
9
8
|
import { faker } from '@dxos/random';
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
9
|
+
import { List, ListItem, Toolbar } from '@dxos/react-ui';
|
|
10
|
+
import { withTheme } from '@dxos/react-ui/testing';
|
|
11
|
+
import { getHashStyles, mx } from '@dxos/react-ui-theme';
|
|
12
12
|
|
|
13
13
|
import { Capabilities, createSurface } from '../common';
|
|
14
|
-
import {
|
|
15
|
-
import { setupPluginManager } from '../testing';
|
|
14
|
+
import { withPluginManager } from '../testing';
|
|
16
15
|
|
|
17
|
-
import {
|
|
16
|
+
import { usePluginManager } from './PluginManagerProvider';
|
|
18
17
|
import { Surface, useSurfaces } from './Surface';
|
|
19
18
|
|
|
20
|
-
const
|
|
21
|
-
const
|
|
22
|
-
const saturation = faker.number.int({ min: 50, max: 90 });
|
|
23
|
-
const lightness = faker.number.int({ min: 40, max: 70 });
|
|
24
|
-
return `hsl(${hue}, ${saturation}%, ${lightness}%)`;
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
const Story = () => {
|
|
19
|
+
const DefaultStory = () => {
|
|
20
|
+
const [selected, setSelected] = useState<string | undefined>();
|
|
28
21
|
const manager = usePluginManager();
|
|
29
22
|
const surfaces = useSurfaces();
|
|
30
|
-
const [picked, setPicked] = useState('test');
|
|
31
23
|
|
|
32
24
|
const handleAdd = useCallback(() => {
|
|
33
|
-
const id = `test-${faker.number.int({ min: 0, max:
|
|
34
|
-
const
|
|
25
|
+
const id = `test-${faker.number.int({ min: 0, max: 1_000 })}`;
|
|
26
|
+
const styles = getHashStyles(id);
|
|
35
27
|
|
|
36
28
|
manager.context.contributeCapability({
|
|
37
29
|
module: 'test',
|
|
38
30
|
interface: Capabilities.ReactSurface,
|
|
39
31
|
implementation: createSurface({
|
|
40
32
|
id,
|
|
41
|
-
role:
|
|
33
|
+
role: 'item',
|
|
34
|
+
filter: (data): data is any => (data as any)?.id === id,
|
|
42
35
|
component: () => (
|
|
43
|
-
<div className='flex-
|
|
44
|
-
{id}
|
|
36
|
+
<div className={mx('flex justify-center items-center border rounded', styles.surface, styles.border)}>
|
|
37
|
+
<span className={mx('dx-tag font-mono text-lg', styles.text)}>{id}</span>
|
|
45
38
|
</div>
|
|
46
39
|
),
|
|
47
40
|
}),
|
|
48
41
|
});
|
|
49
42
|
|
|
50
|
-
|
|
43
|
+
setSelected(id);
|
|
51
44
|
}, [manager]);
|
|
52
45
|
|
|
53
|
-
const
|
|
54
|
-
|
|
46
|
+
const handleSelect = useCallback(() => {
|
|
47
|
+
setSelected(faker.helpers.arrayElement(surfaces)?.id);
|
|
55
48
|
}, [surfaces]);
|
|
56
49
|
|
|
50
|
+
const handleError = useCallback(() => {
|
|
51
|
+
manager.context.contributeCapability({
|
|
52
|
+
module: 'error',
|
|
53
|
+
interface: Capabilities.ReactSurface,
|
|
54
|
+
implementation: createSurface({
|
|
55
|
+
id: 'error',
|
|
56
|
+
role: 'item',
|
|
57
|
+
filter: (data): data is any => (data as any)?.id === 'error',
|
|
58
|
+
component: () => {
|
|
59
|
+
const [count, setCount] = useState(3);
|
|
60
|
+
useEffect(() => {
|
|
61
|
+
const interval = setInterval(() => {
|
|
62
|
+
setCount((count) => {
|
|
63
|
+
if (count <= 1) {
|
|
64
|
+
clearInterval(interval);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
return count - 1;
|
|
68
|
+
});
|
|
69
|
+
}, 1_000);
|
|
70
|
+
return () => clearInterval(interval);
|
|
71
|
+
}, []);
|
|
72
|
+
|
|
73
|
+
if (count <= 0) {
|
|
74
|
+
throw new Error('BANG!');
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
return (
|
|
78
|
+
<div className='flex justify-center items-center border border-roseFill rounded'>
|
|
79
|
+
<span className='font-mono'>Ticking... {count}</span>
|
|
80
|
+
</div>
|
|
81
|
+
);
|
|
82
|
+
},
|
|
83
|
+
}),
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
setSelected('error');
|
|
87
|
+
}, [manager]);
|
|
88
|
+
|
|
57
89
|
return (
|
|
58
|
-
<div className='flex flex-col
|
|
59
|
-
<
|
|
60
|
-
<Button onClick={handleAdd}>Add</Button>
|
|
61
|
-
<Button onClick={
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
90
|
+
<div className='flex flex-col bs-full overflow-hidden'>
|
|
91
|
+
<Toolbar.Root>
|
|
92
|
+
<Toolbar.Button onClick={handleAdd}>Add</Toolbar.Button>
|
|
93
|
+
<Toolbar.Button onClick={handleSelect}>Pick</Toolbar.Button>
|
|
94
|
+
<Toolbar.Button onClick={handleError}>Error</Toolbar.Button>
|
|
95
|
+
</Toolbar.Root>
|
|
96
|
+
<div className='grid grid-cols-2 bs-full gap-4 overflow-hidden'>
|
|
97
|
+
<Surface role='item' data={selected ? { id: selected } : undefined} limit={1} />
|
|
98
|
+
<div className='overflow-y-auto bs-full'>
|
|
99
|
+
<List>
|
|
66
100
|
{surfaces.map((surface) => (
|
|
67
101
|
<ListItem.Root key={surface.id} id={surface.id}>
|
|
68
|
-
<ListItem.Heading classNames='
|
|
102
|
+
<ListItem.Heading classNames='flex items-center'>{surface.id}</ListItem.Heading>
|
|
69
103
|
</ListItem.Root>
|
|
70
104
|
))}
|
|
71
105
|
</List>
|
|
72
106
|
</div>
|
|
73
|
-
<div className='flex-1'>
|
|
74
|
-
<Surface role={picked} limit={1} />
|
|
75
|
-
</div>
|
|
76
107
|
</div>
|
|
77
108
|
</div>
|
|
78
109
|
);
|
|
79
110
|
};
|
|
80
111
|
|
|
81
|
-
|
|
112
|
+
const meta = {
|
|
82
113
|
title: 'sdk/app-framework/Surface',
|
|
83
|
-
render:
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
</PluginManagerProvider>
|
|
88
|
-
);
|
|
89
|
-
},
|
|
90
|
-
// NOTE: Intentionally not using withPluginManager to try to reduce surface area of the story.
|
|
91
|
-
decorators: [withTheme, withLayout()],
|
|
92
|
-
args: {
|
|
93
|
-
manager: setupPluginManager(),
|
|
114
|
+
render: DefaultStory,
|
|
115
|
+
decorators: [withTheme, withPluginManager({ capabilities: [] })],
|
|
116
|
+
parameters: {
|
|
117
|
+
layout: 'fullscreen',
|
|
94
118
|
},
|
|
95
|
-
}
|
|
119
|
+
} satisfies Meta<typeof DefaultStory>;
|
|
120
|
+
|
|
121
|
+
export default meta;
|
|
122
|
+
|
|
123
|
+
type Story = StoryObj<typeof meta>;
|
|
96
124
|
|
|
97
|
-
export const Default = {};
|
|
125
|
+
export const Default: Story = {};
|
package/src/react/Surface.tsx
CHANGED
|
@@ -2,7 +2,15 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import React, {
|
|
5
|
+
import React, {
|
|
6
|
+
Fragment,
|
|
7
|
+
type NamedExoticComponent,
|
|
8
|
+
type RefAttributes,
|
|
9
|
+
Suspense,
|
|
10
|
+
forwardRef,
|
|
11
|
+
memo,
|
|
12
|
+
useMemo,
|
|
13
|
+
} from 'react';
|
|
6
14
|
|
|
7
15
|
import { useDefaultValue } from '@dxos/react-hooks';
|
|
8
16
|
import { byPosition } from '@dxos/util';
|
|
@@ -15,64 +23,87 @@ import { useCapabilities } from './useCapabilities';
|
|
|
15
23
|
|
|
16
24
|
const DEFAULT_PLACEHOLDER = <Fragment />;
|
|
17
25
|
|
|
18
|
-
/**
|
|
19
|
-
* @internal
|
|
20
|
-
*/
|
|
21
|
-
export const useSurfaces = () => {
|
|
22
|
-
const surfaces = useCapabilities(Capabilities.ReactSurface);
|
|
23
|
-
return useMemo(() => surfaces.flat(), [surfaces]);
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
const findCandidates = (surfaces: SurfaceDefinition[], { role, data }: Pick<SurfaceProps, 'role' | 'data'>) => {
|
|
27
|
-
return Object.values(surfaces)
|
|
28
|
-
.filter((definition) =>
|
|
29
|
-
Array.isArray(definition.role) ? definition.role.includes(role) : definition.role === role,
|
|
30
|
-
)
|
|
31
|
-
.filter(({ filter }) => (filter ? filter(data ?? {}) : true))
|
|
32
|
-
.toSorted(byPosition);
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* @returns `true` if there is a contributed surface which matches the specified role & data, `false` otherwise.
|
|
37
|
-
*/
|
|
38
|
-
export const isSurfaceAvailable = (context: PluginContext, { role, data }: Pick<SurfaceProps, 'role' | 'data'>) => {
|
|
39
|
-
const surfaces = context.getCapabilities(Capabilities.ReactSurface);
|
|
40
|
-
const candidates = findCandidates(surfaces.flat(), { role, data });
|
|
41
|
-
return candidates.length > 0;
|
|
42
|
-
};
|
|
43
|
-
|
|
44
26
|
/**
|
|
45
27
|
* A surface is a named region of the screen that can be populated by plugins.
|
|
46
28
|
*/
|
|
47
|
-
export const Surface = memo(
|
|
48
|
-
forwardRef
|
|
49
|
-
(
|
|
29
|
+
export const Surface: NamedExoticComponent<SurfaceProps & RefAttributes<HTMLElement>> = memo(
|
|
30
|
+
forwardRef(
|
|
31
|
+
(
|
|
32
|
+
{ id: _id, role, data: dataParam, limit, fallback = DefaultFallback, placeholder = DEFAULT_PLACEHOLDER, ...rest },
|
|
33
|
+
forwardedRef,
|
|
34
|
+
) => {
|
|
50
35
|
// TODO(wittjosiah): This will make all surfaces depend on a single signal.
|
|
51
36
|
// This isn't ideal because it means that any change to the data will cause all surfaces to re-render.
|
|
52
37
|
// This effectively means that plugin modules which contribute surfaces need to all be activated at startup.
|
|
53
|
-
// This should be fine for now because it's how it worked prior to capabilities api
|
|
38
|
+
// This should be fine for now because it's how it worked prior to capabilities api anyway.
|
|
54
39
|
// In the future, it would be nice to be able to bucket the surface contributions by role.
|
|
55
40
|
const surfaces = useSurfaces();
|
|
56
|
-
const data = useDefaultValue(
|
|
41
|
+
const data = useDefaultValue(dataParam, () => ({}));
|
|
57
42
|
|
|
58
43
|
// NOTE: Memoizing the candidates makes the surface not re-render based on reactivity within data.
|
|
59
44
|
const definitions = findCandidates(surfaces, { role, data });
|
|
60
45
|
const candidates = limit ? definitions.slice(0, limit) : definitions;
|
|
61
|
-
const nodes = candidates.map(({ component: Component
|
|
46
|
+
const nodes = candidates.map(({ id, component: Component }) => (
|
|
62
47
|
<Component ref={forwardedRef} key={id} id={id} role={role} data={data} limit={limit} {...rest} />
|
|
63
48
|
));
|
|
64
49
|
|
|
50
|
+
// TODO(burdon): Able to inject DOM properties into root (e.g., object.id).
|
|
65
51
|
const suspense = <Suspense fallback={placeholder}>{nodes}</Suspense>;
|
|
66
52
|
|
|
67
|
-
return
|
|
53
|
+
return (
|
|
68
54
|
<ErrorBoundary data={data} fallback={fallback}>
|
|
69
55
|
{suspense}
|
|
70
56
|
</ErrorBoundary>
|
|
71
|
-
) : (
|
|
72
|
-
suspense
|
|
73
57
|
);
|
|
74
58
|
},
|
|
75
59
|
),
|
|
76
60
|
);
|
|
77
61
|
|
|
62
|
+
// TODO(burdon): Make user facing, with telemetry.
|
|
63
|
+
// TODO(burdon): Change based on dev/prod mode; infer subject type, id.
|
|
64
|
+
const DefaultFallback = ({ data, error, dev }: { data: any; error: Error; dev?: boolean }) => {
|
|
65
|
+
if (dev) {
|
|
66
|
+
return (
|
|
67
|
+
<div className='flex flex-col gap-4 p-4 is-full overflow-y-auto'>
|
|
68
|
+
<h1 className='flex gap-2 text-sm mbs-2'>{error.message}</h1>
|
|
69
|
+
<pre className='overflow-auto text-xs text-description'>{JSON.stringify(data, null, 2)}</pre>
|
|
70
|
+
</div>
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return (
|
|
75
|
+
<div className='flex flex-col gap-4 p-4 is-full overflow-y-auto border border-roseFill'>
|
|
76
|
+
<h1 className='flex gap-2 text-sm mbs-2 text-rose-500'>{error.message}</h1>
|
|
77
|
+
<pre className='overflow-auto text-xs text-description'>{error.stack}</pre>
|
|
78
|
+
<pre className='overflow-auto text-xs text-description'>{JSON.stringify(data, null, 2)}</pre>
|
|
79
|
+
</div>
|
|
80
|
+
);
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* @internal
|
|
85
|
+
*/
|
|
86
|
+
export const useSurfaces = () => {
|
|
87
|
+
const surfaces = useCapabilities(Capabilities.ReactSurface);
|
|
88
|
+
return useMemo(() => surfaces.flat(), [surfaces]);
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* @returns `true` if there is a contributed surface which matches the specified role & data, `false` otherwise.
|
|
93
|
+
*/
|
|
94
|
+
export const isSurfaceAvailable = (context: PluginContext, { role, data }: Pick<SurfaceProps, 'role' | 'data'>) => {
|
|
95
|
+
const surfaces = context.getCapabilities(Capabilities.ReactSurface);
|
|
96
|
+
const candidates = findCandidates(surfaces.flat(), { role, data });
|
|
97
|
+
return candidates.length > 0;
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
const findCandidates = (surfaces: SurfaceDefinition[], { role, data }: Pick<SurfaceProps, 'role' | 'data'>) => {
|
|
101
|
+
return Object.values(surfaces)
|
|
102
|
+
.filter((definition) =>
|
|
103
|
+
Array.isArray(definition.role) ? definition.role.includes(role) : definition.role === role,
|
|
104
|
+
)
|
|
105
|
+
.filter(({ filter }) => (filter ? filter(data ?? {}) : true))
|
|
106
|
+
.toSorted(byPosition);
|
|
107
|
+
};
|
|
108
|
+
|
|
78
109
|
Surface.displayName = 'Surface';
|
package/src/react/index.ts
CHANGED
|
@@ -3,8 +3,12 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
export * from './common';
|
|
6
|
+
export * from './types';
|
|
7
|
+
|
|
6
8
|
export * from './ErrorBoundary';
|
|
7
9
|
export * from './PluginManagerProvider';
|
|
8
10
|
export * from './Surface';
|
|
11
|
+
|
|
12
|
+
export * from './useApp';
|
|
9
13
|
export * from './useCapabilities';
|
|
10
14
|
export * from './useIntentResolver';
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Schema from 'effect/Schema';
|
|
6
|
+
|
|
7
|
+
import { type Obj } from '@dxos/echo';
|
|
8
|
+
|
|
9
|
+
export const SurfaceCardRole = Schema.Literal(
|
|
10
|
+
'card',
|
|
11
|
+
'card--popover',
|
|
12
|
+
'card--intrinsic',
|
|
13
|
+
'card--extrinsic',
|
|
14
|
+
'card--transclusion',
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
export type SurfaceCardRole = Schema.Schema.Type<typeof SurfaceCardRole>;
|
|
18
|
+
|
|
19
|
+
// TODO(burdon): Define all roles.
|
|
20
|
+
export type SurfaceRole =
|
|
21
|
+
| 'item'
|
|
22
|
+
| 'article'
|
|
23
|
+
| 'complementary' // (for companion?)
|
|
24
|
+
| 'section'
|
|
25
|
+
| SurfaceCardRole;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Base type for surface components.
|
|
29
|
+
*/
|
|
30
|
+
// TODO(burdon): Standardize PluginSettings and ObjectProperties.
|
|
31
|
+
// TODO(burdon): Include attendableId?
|
|
32
|
+
// TODO(burdon): companionTo?
|
|
33
|
+
export type SurfaceComponentProps<Subject extends Obj.Any = Obj.Any, Role extends string = string> = {
|
|
34
|
+
role?: Role;
|
|
35
|
+
|
|
36
|
+
/** The primary object being displayed. */
|
|
37
|
+
subject: Subject;
|
|
38
|
+
};
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { RegistryContext } from '@effect-atom/atom-react';
|
|
6
|
+
import { effect } from '@preact/signals-core';
|
|
7
|
+
import React, { type FC, useCallback, useEffect, useMemo } from 'react';
|
|
8
|
+
|
|
9
|
+
import { invariant } from '@dxos/invariant';
|
|
10
|
+
import { live } from '@dxos/live-object';
|
|
11
|
+
import { useAsyncEffect, useDefaultValue } from '@dxos/react-hooks';
|
|
12
|
+
|
|
13
|
+
import { Capabilities, Events } from '../common';
|
|
14
|
+
import { type Plugin, PluginManager, type PluginManagerOptions } from '../core';
|
|
15
|
+
|
|
16
|
+
import { App } from './App';
|
|
17
|
+
import { DefaultFallback } from './DefaultFallback';
|
|
18
|
+
import { ErrorBoundary } from './ErrorBoundary';
|
|
19
|
+
import { PluginManagerProvider } from './PluginManagerProvider';
|
|
20
|
+
|
|
21
|
+
const ENABLED_KEY = 'dxos.org/app-framework/enabled';
|
|
22
|
+
|
|
23
|
+
export type UseAppOptions = {
|
|
24
|
+
pluginManager?: PluginManager;
|
|
25
|
+
pluginLoader?: PluginManagerOptions['pluginLoader'];
|
|
26
|
+
plugins?: Plugin[];
|
|
27
|
+
core?: string[];
|
|
28
|
+
defaults?: string[];
|
|
29
|
+
placeholder?: FC<{ stage: number }>;
|
|
30
|
+
fallback?: ErrorBoundary['props']['fallback'];
|
|
31
|
+
cacheEnabled?: boolean;
|
|
32
|
+
safeMode?: boolean;
|
|
33
|
+
debounce?: number;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Expected usage is for this to be the entrypoint of the application.
|
|
38
|
+
* Initializes plugins and renders the root components.
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* const plugins = [LayoutPlugin(), MyPlugin()];
|
|
42
|
+
* const core = [LayoutPluginId];
|
|
43
|
+
* const default = [MyPluginId];
|
|
44
|
+
* const fallback = <div>Initializing Plugins...</div>;
|
|
45
|
+
* const App = useApp({ plugins, core, default, fallback });
|
|
46
|
+
* createRoot(document.getElementById('root')!).render(
|
|
47
|
+
* <StrictMode>
|
|
48
|
+
* <App />
|
|
49
|
+
* </StrictMode>,
|
|
50
|
+
* );
|
|
51
|
+
*
|
|
52
|
+
* @param params.pluginLoader A function which loads new plugins.
|
|
53
|
+
* @param params.plugins All plugins available to the application.
|
|
54
|
+
* @param params.core Core plugins which will always be enabled.
|
|
55
|
+
* @param params.defaults Default plugins are enabled by default but can be disabled by the user.
|
|
56
|
+
* @param params.placeholder Placeholder component to render during startup.
|
|
57
|
+
* @param params.fallback Fallback component to render if an error occurs during startup.
|
|
58
|
+
* @param params.cacheEnabled Whether to cache enabled plugins in localStorage.
|
|
59
|
+
* @param params.safeMode Whether to enable safe mode, which disables optional plugins.
|
|
60
|
+
*/
|
|
61
|
+
export const useApp = ({
|
|
62
|
+
pluginManager,
|
|
63
|
+
pluginLoader: pluginLoaderParam,
|
|
64
|
+
plugins: pluginsParam,
|
|
65
|
+
core: coreParam,
|
|
66
|
+
defaults: defaultsParam,
|
|
67
|
+
placeholder,
|
|
68
|
+
fallback = DefaultFallback,
|
|
69
|
+
cacheEnabled = false,
|
|
70
|
+
safeMode = false,
|
|
71
|
+
debounce = 0,
|
|
72
|
+
}: UseAppOptions) => {
|
|
73
|
+
const plugins = useDefaultValue(pluginsParam, () => []);
|
|
74
|
+
const core = useDefaultValue(coreParam, () => plugins.map(({ meta }) => meta.id));
|
|
75
|
+
const defaults = useDefaultValue(defaultsParam, () => []);
|
|
76
|
+
|
|
77
|
+
// TODO(wittjosiah): Provide a custom plugin loader which supports loading via url.
|
|
78
|
+
const pluginLoader = useMemo(
|
|
79
|
+
() =>
|
|
80
|
+
pluginLoaderParam ??
|
|
81
|
+
((id: string) => {
|
|
82
|
+
const plugin = plugins.find((plugin) => plugin.meta.id === id);
|
|
83
|
+
invariant(plugin, `Plugin not found: ${id}`);
|
|
84
|
+
return plugin;
|
|
85
|
+
}),
|
|
86
|
+
[pluginLoaderParam, plugins],
|
|
87
|
+
);
|
|
88
|
+
|
|
89
|
+
const state = useMemo(() => live({ ready: false, error: null }), []);
|
|
90
|
+
const cached: string[] = useMemo(() => JSON.parse(localStorage.getItem(ENABLED_KEY) ?? '[]'), []);
|
|
91
|
+
const enabled = useMemo(
|
|
92
|
+
() => (safeMode ? [] : cacheEnabled && cached.length > 0 ? cached : defaults),
|
|
93
|
+
[safeMode, cacheEnabled, cached, defaults],
|
|
94
|
+
);
|
|
95
|
+
const manager = useMemo(
|
|
96
|
+
() => pluginManager ?? new PluginManager({ pluginLoader, plugins, core, enabled }),
|
|
97
|
+
[pluginManager, pluginLoader, plugins, core, enabled],
|
|
98
|
+
);
|
|
99
|
+
|
|
100
|
+
useEffect(() => {
|
|
101
|
+
return manager.activation.on(({ event, state: _state, error }) => {
|
|
102
|
+
// Once the app is ready the first time, don't show the fallback again.
|
|
103
|
+
if (!state.ready && event === Events.Startup.id) {
|
|
104
|
+
state.ready = _state === 'activated';
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
if (error && !state.ready && !state.error) {
|
|
108
|
+
state.error = error;
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
}, [manager, state]);
|
|
112
|
+
|
|
113
|
+
useEffect(() => {
|
|
114
|
+
effect(() => {
|
|
115
|
+
cacheEnabled && localStorage.setItem(ENABLED_KEY, JSON.stringify(manager.enabled));
|
|
116
|
+
});
|
|
117
|
+
}, [cacheEnabled, manager]);
|
|
118
|
+
|
|
119
|
+
useEffect(() => {
|
|
120
|
+
setupDevtools(manager);
|
|
121
|
+
}, [manager]);
|
|
122
|
+
|
|
123
|
+
useAsyncEffect(async () => {
|
|
124
|
+
manager.context.contributeCapability({
|
|
125
|
+
interface: Capabilities.PluginManager,
|
|
126
|
+
implementation: manager,
|
|
127
|
+
module: 'dxos.org/app-framework/plugin-manager',
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
manager.context.contributeCapability({
|
|
131
|
+
interface: Capabilities.AtomRegistry,
|
|
132
|
+
implementation: manager.registry,
|
|
133
|
+
module: 'dxos.org/app-framework/atom-registry',
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
await Promise.all([
|
|
137
|
+
// TODO(wittjosiah): Factor out such that this could be called per surface role when attempting to render.
|
|
138
|
+
manager.activate(Events.SetupReactSurface),
|
|
139
|
+
manager.activate(Events.Startup),
|
|
140
|
+
]);
|
|
141
|
+
|
|
142
|
+
return () => {
|
|
143
|
+
manager.context.removeCapability(Capabilities.PluginManager, manager);
|
|
144
|
+
manager.context.removeCapability(Capabilities.AtomRegistry, manager.registry);
|
|
145
|
+
};
|
|
146
|
+
}, [manager]);
|
|
147
|
+
|
|
148
|
+
return useCallback(
|
|
149
|
+
() => (
|
|
150
|
+
<ErrorBoundary fallback={fallback}>
|
|
151
|
+
<PluginManagerProvider value={manager}>
|
|
152
|
+
<RegistryContext.Provider value={manager.registry}>
|
|
153
|
+
<App placeholder={placeholder} state={state} debounce={debounce} />
|
|
154
|
+
</RegistryContext.Provider>
|
|
155
|
+
</PluginManagerProvider>
|
|
156
|
+
</ErrorBoundary>
|
|
157
|
+
),
|
|
158
|
+
[fallback, manager, placeholder, state],
|
|
159
|
+
);
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
const setupDevtools = (manager: PluginManager) => {
|
|
163
|
+
(globalThis as any).composer ??= {};
|
|
164
|
+
(globalThis as any).composer.manager = manager;
|
|
165
|
+
};
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { useAtomValue } from '@effect-atom/atom-react';
|
|
6
6
|
|
|
7
7
|
import { invariant } from '@dxos/invariant';
|
|
8
8
|
|
|
@@ -16,7 +16,7 @@ import { usePluginManager } from './PluginManagerProvider';
|
|
|
16
16
|
*/
|
|
17
17
|
export const useCapabilities = <T>(interfaceDef: InterfaceDef<T>) => {
|
|
18
18
|
const manager = usePluginManager();
|
|
19
|
-
return
|
|
19
|
+
return useAtomValue(manager.context.capabilities(interfaceDef));
|
|
20
20
|
};
|
|
21
21
|
|
|
22
22
|
/**
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { useEffect, useState } from 'react';
|
|
6
|
+
|
|
7
|
+
import { type AppProps } from './App';
|
|
8
|
+
|
|
9
|
+
export enum LoadingState {
|
|
10
|
+
Loading = 0,
|
|
11
|
+
FadeIn = 1,
|
|
12
|
+
FadeOut = 2,
|
|
13
|
+
Done = 3,
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* To avoid "flashing" the placeholder, we wait a period of time before starting the loading animation.
|
|
18
|
+
* If loading completes during this time the placehoder is not shown, otherwise is it displayed for a minimum period of time.
|
|
19
|
+
*
|
|
20
|
+
* States:
|
|
21
|
+
* 0: Loading - Wait for a period of time before starting the loading animation.
|
|
22
|
+
* 1: Fade-in - Display a loading animation.
|
|
23
|
+
* 2: Fade-out - Fade out the loading animation.
|
|
24
|
+
* 3: Done - Remove the placeholder.
|
|
25
|
+
*/
|
|
26
|
+
export const useLoading = (state: AppProps['state'], debounce = 0) => {
|
|
27
|
+
const [stage, setStage] = useState<LoadingState>(LoadingState.Loading);
|
|
28
|
+
useEffect(() => {
|
|
29
|
+
if (!debounce) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const i = setInterval(() => {
|
|
34
|
+
setStage((stage) => {
|
|
35
|
+
switch (stage) {
|
|
36
|
+
case LoadingState.Loading: {
|
|
37
|
+
if (!state.ready) {
|
|
38
|
+
return LoadingState.FadeIn;
|
|
39
|
+
} else {
|
|
40
|
+
clearInterval(i);
|
|
41
|
+
return LoadingState.Done;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
case LoadingState.FadeIn: {
|
|
46
|
+
if (state.ready) {
|
|
47
|
+
return LoadingState.FadeOut;
|
|
48
|
+
}
|
|
49
|
+
break;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
case LoadingState.FadeOut: {
|
|
53
|
+
clearInterval(i);
|
|
54
|
+
return LoadingState.Done;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
return stage;
|
|
59
|
+
});
|
|
60
|
+
}, debounce);
|
|
61
|
+
|
|
62
|
+
return () => clearInterval(i);
|
|
63
|
+
}, [debounce]);
|
|
64
|
+
|
|
65
|
+
if (!debounce) {
|
|
66
|
+
return state.ready ? LoadingState.Done : LoadingState.Loading;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return stage;
|
|
70
|
+
};
|
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
5
6
|
import React from 'react';
|
|
6
7
|
|
|
7
|
-
import {
|
|
8
|
+
import { withTheme } from '@dxos/react-ui/testing';
|
|
8
9
|
|
|
9
10
|
import { Capabilities, createSurface } from '../common';
|
|
10
11
|
import { contributes } from '../core';
|
|
@@ -22,7 +23,7 @@ const DefaultStory = () => {
|
|
|
22
23
|
);
|
|
23
24
|
};
|
|
24
25
|
|
|
25
|
-
const meta
|
|
26
|
+
const meta = {
|
|
26
27
|
title: 'sdk/app-framework/withPluginManager',
|
|
27
28
|
render: DefaultStory,
|
|
28
29
|
decorators: [
|
|
@@ -40,8 +41,10 @@ const meta: Meta = {
|
|
|
40
41
|
],
|
|
41
42
|
}),
|
|
42
43
|
],
|
|
43
|
-
}
|
|
44
|
+
} satisfies Meta<typeof DefaultStory>;
|
|
44
45
|
|
|
45
46
|
export default meta;
|
|
46
47
|
|
|
47
|
-
|
|
48
|
+
type Story = StoryObj<typeof meta>;
|
|
49
|
+
|
|
50
|
+
export const Default: Story = {};
|