@dxos/app-framework 0.8.4-main.e098934 → 0.8.4-main.e8ec1fe
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/dist/lib/browser/{app-graph-builder-AFFC6VB2.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-ORWHM7CO.mjs → chunk-SCPE4ZO2.mjs} +11 -8
- package/dist/lib/browser/chunk-SCPE4ZO2.mjs.map +7 -0
- package/dist/lib/browser/{chunk-T6M7JB7M.mjs → chunk-VFUKEZIN.mjs} +121 -109
- package/dist/lib/browser/chunk-VFUKEZIN.mjs.map +7 -0
- package/dist/lib/browser/{chunk-OZY7HV2A.mjs → chunk-WPW5VVAX.mjs} +281 -273
- package/dist/lib/browser/chunk-WPW5VVAX.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +14 -56
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/{intent-dispatcher-QG7UPGQX.mjs → intent-dispatcher-LZ4AE66E.mjs} +2 -2
- package/dist/lib/browser/{intent-resolver-4S4PSTM5.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-6E33KLGK.mjs → store-CNPHOYTJ.mjs} +5 -5
- package/dist/lib/browser/store-CNPHOYTJ.mjs.map +7 -0
- package/dist/lib/browser/testing/index.mjs +14 -16
- package/dist/lib/browser/testing/index.mjs.map +3 -3
- package/dist/lib/node-esm/{app-graph-builder-S4OAULX5.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-HJFU7QOR.mjs → chunk-IJOHO66N.mjs} +121 -109
- package/dist/lib/node-esm/chunk-IJOHO66N.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-F63ZRXMK.mjs → chunk-XJZGUJ3H.mjs} +281 -273
- 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 +14 -56
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/{intent-dispatcher-NXBGPJOX.mjs → intent-dispatcher-MGOJ3CHD.mjs} +2 -2
- package/dist/lib/node-esm/{intent-resolver-2ZKXI5ET.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-QQUTQHHT.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 +14 -16
- package/dist/lib/node-esm/testing/index.mjs.map +3 -3
- package/dist/types/src/common/capabilities.d.ts +41 -37
- package/dist/types/src/common/capabilities.d.ts.map +1 -1
- package/dist/types/src/common/collaboration.d.ts +1 -1
- 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 +15 -15
- 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/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.map +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/plugin.d.ts +1 -1
- package/dist/types/src/playground/layout/plugin.d.ts.map +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 +0 -1
- 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/intent-dispatcher.d.ts +4 -4
- 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.map +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/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.map +1 -0
- package/dist/types/src/{components → react}/App.stories.d.ts +0 -1
- package/dist/types/src/react/App.stories.d.ts.map +1 -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 +3 -7
- 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/{components → react}/useApp.d.ts +2 -2
- package/dist/types/src/react/useApp.d.ts.map +1 -0
- package/dist/types/src/react/useLoading.d.ts.map +1 -0
- package/dist/types/src/testing/withPluginManager.d.ts +6 -7
- package/dist/types/src/testing/withPluginManager.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 +34 -19
- package/src/common/collaboration.ts +3 -3
- 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 +26 -22
- 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/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 +6 -7
- 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/intent-dispatcher.test.ts +10 -3
- package/src/plugin-intent/intent-dispatcher.ts +13 -6
- 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/{components → react}/App.stories.tsx +1 -3
- package/src/{components → react}/App.tsx +1 -1
- package/src/{components → react}/DefaultFallback.tsx +1 -1
- package/src/react/ErrorBoundary.tsx +10 -8
- package/src/react/Surface.stories.tsx +70 -49
- package/src/react/Surface.tsx +67 -36
- package/src/react/index.ts +4 -0
- package/src/react/types.ts +37 -0
- package/src/{components → react}/useApp.tsx +23 -24
- package/src/react/useCapabilities.ts +2 -2
- package/src/testing/withPluginManager.stories.tsx +1 -1
- package/src/testing/withPluginManager.tsx +22 -21
- package/tsconfig.json +10 -1
- package/vitest.config.ts +8 -6
- package/dist/lib/browser/app-graph-builder-AFFC6VB2.mjs.map +0 -7
- package/dist/lib/browser/chunk-ORWHM7CO.mjs.map +0 -7
- package/dist/lib/browser/chunk-OZY7HV2A.mjs.map +0 -7
- package/dist/lib/browser/chunk-T6M7JB7M.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-4S4PSTM5.mjs.map +0 -7
- package/dist/lib/browser/store-6E33KLGK.mjs.map +0 -7
- package/dist/lib/browser/worker.mjs +0 -85
- package/dist/lib/node-esm/app-graph-builder-S4OAULX5.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-F63ZRXMK.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-HJFU7QOR.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-UMZQERLE.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-2ZKXI5ET.mjs.map +0 -7
- package/dist/lib/node-esm/store-QQUTQHHT.mjs.map +0 -7
- package/dist/lib/node-esm/worker.mjs +0 -86
- package/dist/types/src/components/App.d.ts.map +0 -1
- package/dist/types/src/components/App.stories.d.ts.map +0 -1
- package/dist/types/src/components/DefaultFallback.d.ts.map +0 -1
- package/dist/types/src/components/index.d.ts +0 -2
- package/dist/types/src/components/index.d.ts.map +0 -1
- package/dist/types/src/components/useApp.d.ts.map +0 -1
- package/dist/types/src/components/useLoading.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/components/index.ts +0 -5
- package/src/worker.ts +0 -11
- /package/dist/lib/browser/{intent-dispatcher-QG7UPGQX.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-NXBGPJOX.mjs.map → intent-dispatcher-MGOJ3CHD.mjs.map} +0 -0
- /package/dist/lib/node-esm/{worker.mjs.map → react/index.mjs.map} +0 -0
- /package/dist/types/src/{components → react}/App.d.ts +0 -0
- /package/dist/types/src/{components → react}/DefaultFallback.d.ts +0 -0
- /package/dist/types/src/{components → react}/useLoading.d.ts +0 -0
- /package/src/{components → react}/useLoading.tsx +0 -0
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,37 @@
|
|
|
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
|
+
export type SurfaceComponentProps<Subject extends Obj.Any = Obj.Any, Props = {}, Role extends string = string> = {
|
|
33
|
+
role?: Role;
|
|
34
|
+
|
|
35
|
+
/** The object being displayed. */
|
|
36
|
+
subject: Subject;
|
|
37
|
+
} & Props;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { RegistryContext } from '@effect-
|
|
5
|
+
import { RegistryContext } from '@effect-atom/atom-react';
|
|
6
6
|
import { effect } from '@preact/signals-core';
|
|
7
7
|
import React, { type FC, useCallback, useEffect, useMemo } from 'react';
|
|
8
8
|
|
|
@@ -12,10 +12,11 @@ import { useAsyncEffect, useDefaultValue } from '@dxos/react-hooks';
|
|
|
12
12
|
|
|
13
13
|
import { Capabilities, Events } from '../common';
|
|
14
14
|
import { type Plugin, PluginManager, type PluginManagerOptions } from '../core';
|
|
15
|
-
import { ErrorBoundary, PluginManagerProvider } from '../react';
|
|
16
15
|
|
|
17
16
|
import { App } from './App';
|
|
18
17
|
import { DefaultFallback } from './DefaultFallback';
|
|
18
|
+
import { ErrorBoundary } from './ErrorBoundary';
|
|
19
|
+
import { PluginManagerProvider } from './PluginManagerProvider';
|
|
19
20
|
|
|
20
21
|
const ENABLED_KEY = 'dxos.org/app-framework/enabled';
|
|
21
22
|
|
|
@@ -59,30 +60,30 @@ export type UseAppOptions = {
|
|
|
59
60
|
*/
|
|
60
61
|
export const useApp = ({
|
|
61
62
|
pluginManager,
|
|
62
|
-
pluginLoader:
|
|
63
|
-
plugins:
|
|
64
|
-
core:
|
|
65
|
-
defaults:
|
|
63
|
+
pluginLoader: pluginLoaderParam,
|
|
64
|
+
plugins: pluginsParam,
|
|
65
|
+
core: coreParam,
|
|
66
|
+
defaults: defaultsParam,
|
|
66
67
|
placeholder,
|
|
67
68
|
fallback = DefaultFallback,
|
|
68
69
|
cacheEnabled = false,
|
|
69
70
|
safeMode = false,
|
|
70
71
|
debounce = 0,
|
|
71
72
|
}: UseAppOptions) => {
|
|
72
|
-
const plugins = useDefaultValue(
|
|
73
|
-
const core = useDefaultValue(
|
|
74
|
-
const defaults = useDefaultValue(
|
|
73
|
+
const plugins = useDefaultValue(pluginsParam, () => []);
|
|
74
|
+
const core = useDefaultValue(coreParam, () => plugins.map(({ meta }) => meta.id));
|
|
75
|
+
const defaults = useDefaultValue(defaultsParam, () => []);
|
|
75
76
|
|
|
76
77
|
// TODO(wittjosiah): Provide a custom plugin loader which supports loading via url.
|
|
77
78
|
const pluginLoader = useMemo(
|
|
78
79
|
() =>
|
|
79
|
-
|
|
80
|
+
pluginLoaderParam ??
|
|
80
81
|
((id: string) => {
|
|
81
82
|
const plugin = plugins.find((plugin) => plugin.meta.id === id);
|
|
82
83
|
invariant(plugin, `Plugin not found: ${id}`);
|
|
83
84
|
return plugin;
|
|
84
85
|
}),
|
|
85
|
-
[
|
|
86
|
+
[pluginLoaderParam, plugins],
|
|
86
87
|
);
|
|
87
88
|
|
|
88
89
|
const state = useMemo(() => live({ ready: false, error: null }), []);
|
|
@@ -116,6 +117,10 @@ export const useApp = ({
|
|
|
116
117
|
}, [cacheEnabled, manager]);
|
|
117
118
|
|
|
118
119
|
useEffect(() => {
|
|
120
|
+
setupDevtools(manager);
|
|
121
|
+
}, [manager]);
|
|
122
|
+
|
|
123
|
+
useAsyncEffect(async () => {
|
|
119
124
|
manager.context.contributeCapability({
|
|
120
125
|
interface: Capabilities.PluginManager,
|
|
121
126
|
implementation: manager,
|
|
@@ -123,27 +128,21 @@ export const useApp = ({
|
|
|
123
128
|
});
|
|
124
129
|
|
|
125
130
|
manager.context.contributeCapability({
|
|
126
|
-
interface: Capabilities.
|
|
131
|
+
interface: Capabilities.AtomRegistry,
|
|
127
132
|
implementation: manager.registry,
|
|
128
|
-
module: 'dxos.org/app-framework/
|
|
133
|
+
module: 'dxos.org/app-framework/atom-registry',
|
|
129
134
|
});
|
|
130
135
|
|
|
131
|
-
return () => {
|
|
132
|
-
manager.context.removeCapability(Capabilities.PluginManager, manager);
|
|
133
|
-
manager.context.removeCapability(Capabilities.RxRegistry, manager.registry);
|
|
134
|
-
};
|
|
135
|
-
}, [manager]);
|
|
136
|
-
|
|
137
|
-
useEffect(() => {
|
|
138
|
-
setupDevtools(manager);
|
|
139
|
-
}, [manager]);
|
|
140
|
-
|
|
141
|
-
useAsyncEffect(async () => {
|
|
142
136
|
await Promise.all([
|
|
143
137
|
// TODO(wittjosiah): Factor out such that this could be called per surface role when attempting to render.
|
|
144
138
|
manager.activate(Events.SetupReactSurface),
|
|
145
139
|
manager.activate(Events.Startup),
|
|
146
140
|
]);
|
|
141
|
+
|
|
142
|
+
return () => {
|
|
143
|
+
manager.context.removeCapability(Capabilities.PluginManager, manager);
|
|
144
|
+
manager.context.removeCapability(Capabilities.AtomRegistry, manager.registry);
|
|
145
|
+
};
|
|
147
146
|
}, [manager]);
|
|
148
147
|
|
|
149
148
|
return useCallback(
|
|
@@ -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
|
/**
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
6
6
|
import React from 'react';
|
|
7
7
|
|
|
8
|
-
import { withTheme } from '@dxos/
|
|
8
|
+
import { withTheme } from '@dxos/react-ui/testing';
|
|
9
9
|
|
|
10
10
|
import { Capabilities, createSurface } from '../common';
|
|
11
11
|
import { contributes } from '../core';
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { type Decorator } from '@storybook/react';
|
|
5
|
+
import { type Decorator, type StoryContext } from '@storybook/react';
|
|
6
6
|
import React, { useEffect, useMemo } from 'react';
|
|
7
7
|
|
|
8
8
|
import { raise } from '@dxos/debug';
|
|
9
9
|
import { useAsyncEffect } from '@dxos/react-hooks';
|
|
10
|
+
import { type MaybeProvider, getProviderValue } from '@dxos/util';
|
|
10
11
|
|
|
11
12
|
import { Capabilities, Events } from '../common';
|
|
12
|
-
import { type UseAppOptions, useApp } from '../components';
|
|
13
13
|
import {
|
|
14
14
|
type ActivationEvent,
|
|
15
15
|
type AnyCapability,
|
|
@@ -19,14 +19,7 @@ import {
|
|
|
19
19
|
defineModule,
|
|
20
20
|
definePlugin,
|
|
21
21
|
} from '../core';
|
|
22
|
-
|
|
23
|
-
// TODO(burdon): Factor out (use consistently in plugin framework?)
|
|
24
|
-
export type Provider<C, R> = (context: C) => R;
|
|
25
|
-
export type ProviderOrValue<C, R> = Provider<C, R> | R;
|
|
26
|
-
|
|
27
|
-
export const getValue = <C, R>(providerOrValue: ProviderOrValue<C, R>, context: C): R => {
|
|
28
|
-
return typeof providerOrValue === 'function' ? (providerOrValue as Provider<C, R>)(context) : providerOrValue;
|
|
29
|
-
};
|
|
22
|
+
import { type UseAppOptions, useApp } from '../react';
|
|
30
23
|
|
|
31
24
|
/**
|
|
32
25
|
* @internal
|
|
@@ -39,13 +32,13 @@ export const setupPluginManager = ({
|
|
|
39
32
|
}: UseAppOptions & Pick<WithPluginManagerOptions, 'capabilities'> = {}) => {
|
|
40
33
|
const pluginManager = new PluginManager({
|
|
41
34
|
pluginLoader: () => raise(new Error('Not implemented')),
|
|
42
|
-
plugins: [
|
|
43
|
-
core: [
|
|
35
|
+
plugins: [StoryPlugin(), ...plugins],
|
|
36
|
+
core: [StoryPlugin.meta.id, ...core],
|
|
44
37
|
...options,
|
|
45
38
|
});
|
|
46
39
|
|
|
47
40
|
if (capabilities) {
|
|
48
|
-
|
|
41
|
+
getProviderValue(capabilities, pluginManager.context).forEach((capability) => {
|
|
49
42
|
pluginManager.context.contributeCapability({
|
|
50
43
|
interface: capability.interface,
|
|
51
44
|
implementation: capability.implementation,
|
|
@@ -59,18 +52,23 @@ export const setupPluginManager = ({
|
|
|
59
52
|
|
|
60
53
|
export type WithPluginManagerOptions = UseAppOptions & {
|
|
61
54
|
/** @deprecated */
|
|
62
|
-
capabilities?:
|
|
55
|
+
capabilities?: MaybeProvider<AnyCapability[], PluginContext>;
|
|
63
56
|
/** @deprecated */
|
|
64
57
|
fireEvents?: (ActivationEvent | string)[];
|
|
65
58
|
};
|
|
66
59
|
|
|
60
|
+
export type WithPluginManagerInitializer<Args = void> =
|
|
61
|
+
| WithPluginManagerOptions
|
|
62
|
+
| ((context: StoryContext<Args>) => WithPluginManagerOptions);
|
|
63
|
+
|
|
67
64
|
/**
|
|
68
65
|
* Wraps a story with a plugin manager.
|
|
69
66
|
* NOTE: This builds up and tears down the plugin manager on every render.
|
|
70
67
|
*/
|
|
71
|
-
export const withPluginManager = (
|
|
68
|
+
export const withPluginManager = <Args,>(init: WithPluginManagerInitializer<Args> = {}): Decorator => {
|
|
72
69
|
return (Story, context) => {
|
|
73
|
-
const
|
|
70
|
+
const options = typeof init === 'function' ? init(context as any) : init;
|
|
71
|
+
const pluginManager = useMemo(() => setupPluginManager(options), [init]);
|
|
74
72
|
|
|
75
73
|
// Set-up root capability.
|
|
76
74
|
useEffect(() => {
|
|
@@ -101,10 +99,13 @@ export const withPluginManager = (options: WithPluginManagerOptions = {}): Decor
|
|
|
101
99
|
};
|
|
102
100
|
};
|
|
103
101
|
|
|
102
|
+
const storyMeta = {
|
|
103
|
+
id: 'dxos.org/app-framework/story',
|
|
104
|
+
name: 'Story',
|
|
105
|
+
};
|
|
106
|
+
|
|
104
107
|
// No-op plugin to ensure there exists at least one plugin for the startup event.
|
|
105
108
|
// This is necessary because `createApp` expects the startup event to complete before the app is ready.
|
|
106
|
-
const
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
defineModule({ id: STORY_PLUGIN, activatesOn: Events.Startup, activate: () => [] }),
|
|
110
|
-
]);
|
|
109
|
+
const StoryPlugin = definePlugin(storyMeta, () => [
|
|
110
|
+
defineModule({ id: storyMeta.id, activatesOn: Events.Startup, activate: () => [] }),
|
|
111
|
+
]);
|
package/tsconfig.json
CHANGED
|
@@ -38,11 +38,14 @@
|
|
|
38
38
|
{
|
|
39
39
|
"path": "../../core/ai"
|
|
40
40
|
},
|
|
41
|
+
{
|
|
42
|
+
"path": "../../core/assistant"
|
|
43
|
+
},
|
|
41
44
|
{
|
|
42
45
|
"path": "../../core/blueprints"
|
|
43
46
|
},
|
|
44
47
|
{
|
|
45
|
-
"path": "../../core/echo/echo
|
|
48
|
+
"path": "../../core/echo/echo"
|
|
46
49
|
},
|
|
47
50
|
{
|
|
48
51
|
"path": "../../core/echo/echo-signals"
|
|
@@ -62,6 +65,9 @@
|
|
|
62
65
|
{
|
|
63
66
|
"path": "../../ui/react-ui-syntax-highlighter"
|
|
64
67
|
},
|
|
68
|
+
{
|
|
69
|
+
"path": "../../ui/react-ui-theme"
|
|
70
|
+
},
|
|
65
71
|
{
|
|
66
72
|
"path": "../app-graph"
|
|
67
73
|
},
|
|
@@ -70,6 +76,9 @@
|
|
|
70
76
|
},
|
|
71
77
|
{
|
|
72
78
|
"path": "../schema"
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
"path": "../types"
|
|
73
82
|
}
|
|
74
83
|
]
|
|
75
84
|
}
|
package/vitest.config.ts
CHANGED
|
@@ -2,11 +2,13 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import path from 'node:path';
|
|
6
|
+
import { fileURLToPath } from 'node:url';
|
|
6
7
|
|
|
7
|
-
import {
|
|
8
|
+
import { createConfig } from '../../../vitest.base.config';
|
|
8
9
|
|
|
9
|
-
export default
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
export default createConfig({
|
|
11
|
+
dirname: typeof __dirname !== 'undefined' ? __dirname : path.dirname(fileURLToPath(import.meta.url)),
|
|
12
|
+
node: true,
|
|
13
|
+
storybook: true,
|
|
14
|
+
});
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/plugin-settings/app-graph-builder.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { Rx } from '@effect-rx/rx-react';\nimport { Option, pipe } from 'effect';\n\nimport { ROOT_ID, createExtension } from '@dxos/app-graph';\nimport { type SettingsStore, type SettingsValue } from '@dxos/local-storage';\nimport { isNonNullable } from '@dxos/util';\n\nimport { Capabilities } from '../common';\nimport { type PluginContext, type PluginMeta, contributes } from '../core';\nimport { createIntent } from '../plugin-intent';\n\nimport { SETTINGS_ID, SETTINGS_KEY, SETTINGS_PLUGIN, SettingsAction } from './actions';\n\nexport default (context: PluginContext) =>\n contributes(Capabilities.AppGraphBuilder, [\n createExtension({\n id: `${SETTINGS_PLUGIN}/action`,\n actions: (node) =>\n Rx.make((get) =>\n pipe(\n get(node),\n Option.flatMap((node) => (node.id === ROOT_ID ? Option.some(node) : Option.none())),\n Option.map(() => [\n {\n id: SETTINGS_PLUGIN,\n data: async () => {\n const { dispatchPromise: dispatch } = context.getCapability(Capabilities.IntentDispatcher);\n await dispatch(createIntent(SettingsAction.Open));\n },\n properties: {\n label: ['open settings label', { ns: SETTINGS_PLUGIN }],\n icon: 'ph--gear--regular',\n disposition: 'menu',\n keyBinding: {\n macos: 'meta+,',\n windows: 'alt+,',\n },\n },\n },\n ]),\n Option.getOrElse(() => []),\n ),\n ),\n }),\n createExtension({\n id: `${SETTINGS_PLUGIN}/core`,\n connector: (node) =>\n Rx.make((get) =>\n pipe(\n get(node),\n Option.flatMap((node) => (node.id === ROOT_ID ? Option.some(node) : Option.none())),\n Option.map(() => [\n {\n id: SETTINGS_ID,\n type: SETTINGS_PLUGIN,\n properties: {\n label: ['app settings label', { ns: SETTINGS_PLUGIN }],\n icon: 'ph--gear--regular',\n disposition: 'pin-end',\n position: 'hoist',\n testId: 'treeView.appSettings',\n },\n },\n ]),\n Option.getOrElse(() => []),\n ),\n ),\n }),\n createExtension({\n id: `${SETTINGS_PLUGIN}/core-plugins`,\n connector: (node) =>\n Rx.make((get) =>\n pipe(\n get(node),\n Option.flatMap((node) => (node.id !== SETTINGS_ID ? Option.none() : Option.some(node))),\n Option.map(() => {\n const manager = get(context.capability(Capabilities.PluginManager));\n const [settingsStore] = get(context.capabilities(Capabilities.SettingsStore));\n return [\n ...manager.plugins\n .filter((plugin) => manager.core.includes(plugin.meta.id))\n .map((plugin): [PluginMeta, SettingsStore<SettingsValue>] | null => {\n const settings = settingsStore?.getStore(plugin.meta.id);\n if (!settings) {\n return null;\n }\n\n return [plugin.meta, settings];\n })\n .filter(isNonNullable)\n .map(([meta, settings]) => ({\n id: `${SETTINGS_KEY}:${meta.id.replaceAll('/', ':')}`,\n type: 'category',\n data: settings,\n properties: {\n label: meta.name ?? meta.id,\n icon: meta.icon ?? 'ph--circle--regular',\n },\n })),\n\n {\n id: `${SETTINGS_KEY}:custom-plugins`,\n type: 'category',\n properties: {\n label: ['custom plugins label', { ns: SETTINGS_PLUGIN }],\n icon: 'ph--squares-four--regular',\n role: 'branch',\n disposition: 'collection',\n },\n },\n ];\n }),\n Option.getOrElse(() => []),\n ),\n ),\n }),\n createExtension({\n id: `${SETTINGS_PLUGIN}/custom-plugins`,\n connector: (node) =>\n Rx.make((get) =>\n pipe(\n get(node),\n Option.flatMap((node) =>\n node.id !== `${SETTINGS_KEY}:custom-plugins` ? Option.none() : Option.some(node),\n ),\n Option.map(() => {\n const manager = get(context.capability(Capabilities.PluginManager));\n const [settingsStore] = get(context.capabilities(Capabilities.SettingsStore));\n return manager.plugins\n .filter((plugin) => !manager.core.includes(plugin.meta.id))\n .map((plugin): [PluginMeta, SettingsStore<SettingsValue>] | null => {\n const settings = settingsStore?.getStore(plugin.meta.id);\n if (!settings) {\n return null;\n }\n\n return [plugin.meta, settings];\n })\n .filter(isNonNullable)\n .map(([meta, settings]) => ({\n id: `${SETTINGS_KEY}:${meta.id.replaceAll('/', ':')}`,\n type: 'category',\n data: settings,\n properties: {\n label: meta.name ?? meta.id,\n icon: meta.icon ?? 'ph--circle--regular',\n },\n }));\n }),\n Option.getOrElse(() => []),\n ),\n ),\n }),\n ]);\n"],
|
|
5
|
-
"mappings": "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",
|
|
6
|
-
"names": ["Rx", "Option", "pipe", "ROOT_ID", "createExtension", "isNonNullable", "context", "contributes", "Capabilities", "AppGraphBuilder", "createExtension", "id", "SETTINGS_PLUGIN", "actions", "node", "Rx", "make", "get", "pipe", "Option", "flatMap", "ROOT_ID", "some", "none", "map", "data", "dispatchPromise", "dispatch", "getCapability", "IntentDispatcher", "createIntent", "SettingsAction", "Open", "properties", "label", "ns", "icon", "disposition", "keyBinding", "macos", "windows", "getOrElse", "connector", "SETTINGS_ID", "type", "position", "testId", "manager", "capability", "PluginManager", "settingsStore", "capabilities", "SettingsStore", "plugins", "filter", "plugin", "core", "includes", "meta", "settings", "getStore", "isNonNullable", "SETTINGS_KEY", "replaceAll", "name", "role"]
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/plugin-settings/actions.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { Schema } from 'effect';\n\nexport const SETTINGS_PLUGIN = 'dxos.org/plugin/settings';\nexport const SETTINGS_ACTION = `${SETTINGS_PLUGIN}/action`;\n// TODO(wittjosiah): This is a hack to prevent the previous deck from being set for pinned items.\n// Ideally this should be worked into the data model in a generic way.\nexport const SETTINGS_ID = '!dxos:settings';\nexport const SETTINGS_KEY = 'settings';\n\nexport namespace SettingsAction {\n export class Open extends Schema.TaggedClass<Open>()(`${SETTINGS_ACTION}/open`, {\n input: Schema.Struct({\n plugin: Schema.optional(Schema.String),\n }),\n output: Schema.Void,\n }) {}\n\n export class OpenPluginRegistry extends Schema.TaggedClass<OpenPluginRegistry>()(\n `${SETTINGS_ACTION}/open-plugin-registry`,\n {\n input: Schema.Void,\n output: Schema.Void,\n },\n ) {}\n}\n"],
|
|
5
|
-
"mappings": ";AAIA,SAASA,cAAc;AAEhB,IAAMC,kBAAkB;AACxB,IAAMC,kBAAkB,GAAGD,eAAAA;AAG3B,IAAME,cAAc;AACpB,IAAMC,eAAe;UAEXC,iBAAAA;EACR,MAAMC,aAAaC,OAAOC,YAAW,EAAS,GAAGN,eAAAA,SAAwB;IAC9EO,OAAOF,OAAOG,OAAO;MACnBC,QAAQJ,OAAOK,SAASL,OAAOM,MAAM;IACvC,CAAA;IACAC,QAAQP,OAAOQ;EACjB,CAAA,EAAA;EAAI;kBALST,OAAAA;EAON,MAAMU,2BAA2BT,OAAOC,YAAW,EACxD,GAAGN,eAAAA,yBACH;IACEO,OAAOF,OAAOQ;IACdD,QAAQP,OAAOQ;EACjB,CAAA,EAAA;EACC;kBANUC,qBAAAA;AAOf,GAfiBX,mBAAAA,iBAAAA,CAAAA,EAAAA;;",
|
|
6
|
-
"names": ["Schema", "SETTINGS_PLUGIN", "SETTINGS_ACTION", "SETTINGS_ID", "SETTINGS_KEY", "SettingsAction", "Open", "Schema", "TaggedClass", "input", "Struct", "plugin", "optional", "String", "output", "Void", "OpenPluginRegistry"]
|
|
7
|
-
}
|