@dxos/plugin-testing 0.8.4-main.9be5663bfe → 0.8.4-main.abd8ff62ef
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/harness.mjs +35 -0
- package/dist/lib/browser/harness.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +17 -36
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node-esm/harness.mjs +37 -0
- package/dist/lib/node-esm/harness.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +17 -36
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/types/src/StorybookPlugin.d.ts +1 -0
- package/dist/types/src/StorybookPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +1 -1
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/operation-handler.d.ts +1 -1
- package/dist/types/src/capabilities/operation-handler.d.ts.map +1 -1
- package/dist/types/src/capabilities/state.d.ts.map +1 -1
- package/dist/types/src/components/Layout/Layout.d.ts.map +1 -1
- package/dist/types/src/harness.d.ts +20 -0
- package/dist/types/src/harness.d.ts.map +1 -0
- package/dist/types/src/index.d.ts +3 -1
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/operations/add-toast.d.ts +1 -1
- package/dist/types/src/operations/add-toast.d.ts.map +1 -1
- package/dist/types/src/operations/close.d.ts +1 -1
- package/dist/types/src/operations/close.d.ts.map +1 -1
- package/dist/types/src/operations/index.d.ts +1 -1
- package/dist/types/src/operations/index.d.ts.map +1 -1
- package/dist/types/src/operations/open.d.ts +1 -1
- package/dist/types/src/operations/open.d.ts.map +1 -1
- package/dist/types/src/operations/scroll-into-view.d.ts +1 -1
- package/dist/types/src/operations/scroll-into-view.d.ts.map +1 -1
- package/dist/types/src/operations/set-layout-mode.d.ts +1 -1
- package/dist/types/src/operations/set-layout-mode.d.ts.map +1 -1
- package/dist/types/src/operations/switch-workspace.d.ts +1 -1
- package/dist/types/src/operations/switch-workspace.d.ts.map +1 -1
- package/dist/types/src/operations/update-complementary.d.ts +1 -1
- package/dist/types/src/operations/update-complementary.d.ts.map +1 -1
- package/dist/types/src/operations/update-dialog.d.ts +1 -1
- package/dist/types/src/operations/update-dialog.d.ts.map +1 -1
- package/dist/types/src/operations/update-popover.d.ts +1 -1
- package/dist/types/src/operations/update-popover.d.ts.map +1 -1
- package/dist/types/src/operations/update-sidebar.d.ts +1 -1
- package/dist/types/src/operations/update-sidebar.d.ts.map +1 -1
- package/dist/types/src/operations/update-state.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +22 -15
- package/src/StorybookPlugin.ts +3 -1
- package/src/capabilities/index.ts +1 -1
- package/src/capabilities/operation-handler.ts +1 -1
- package/src/components/Layout/Layout.tsx +10 -4
- package/src/harness.ts +52 -0
- package/src/index.ts +6 -1
- package/src/operations/add-toast.ts +1 -1
- package/src/operations/close.ts +1 -1
- package/src/operations/index.ts +1 -1
- package/src/operations/open.ts +1 -1
- package/src/operations/scroll-into-view.ts +1 -1
- package/src/operations/set-layout-mode.ts +1 -1
- package/src/operations/switch-workspace.ts +1 -1
- package/src/operations/update-complementary.ts +1 -1
- package/src/operations/update-dialog.ts +1 -1
- package/src/operations/update-popover.ts +1 -1
- package/src/operations/update-sidebar.ts +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/plugin-testing",
|
|
3
|
-
"version": "0.8.4-main.
|
|
3
|
+
"version": "0.8.4-main.abd8ff62ef",
|
|
4
4
|
"description": "Plugin testing utils",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
"sideEffects": true,
|
|
14
14
|
"type": "module",
|
|
15
15
|
"imports": {
|
|
16
|
+
"#plugin": "./src/StorybookPlugin.ts",
|
|
16
17
|
"#capabilities": "./src/capabilities/index.ts",
|
|
17
18
|
"#components": "./src/components/index.ts",
|
|
18
19
|
"#meta": "./src/meta.ts",
|
|
@@ -24,6 +25,12 @@
|
|
|
24
25
|
"source": "./src/index.ts",
|
|
25
26
|
"types": "./dist/types/src/index.d.ts",
|
|
26
27
|
"browser": "./dist/lib/browser/index.mjs"
|
|
28
|
+
},
|
|
29
|
+
"./harness": {
|
|
30
|
+
"source": "./src/harness.ts",
|
|
31
|
+
"types": "./dist/types/src/harness.d.ts",
|
|
32
|
+
"browser": "./dist/lib/browser/harness.mjs",
|
|
33
|
+
"node": "./dist/lib/node-esm/harness.mjs"
|
|
27
34
|
}
|
|
28
35
|
},
|
|
29
36
|
"types": "dist/types/src/index.d.ts",
|
|
@@ -34,15 +41,15 @@
|
|
|
34
41
|
"dependencies": {
|
|
35
42
|
"@effect-atom/atom": "^0.5.1",
|
|
36
43
|
"@effect-atom/atom-react": "^0.5.0",
|
|
37
|
-
"@dxos/app-framework": "0.8.4-main.
|
|
38
|
-
"@dxos/app-toolkit": "0.8.4-main.
|
|
39
|
-
"@dxos/
|
|
40
|
-
"@dxos/plugin-
|
|
41
|
-
"@dxos/plugin-graph": "0.8.4-main.
|
|
42
|
-
"@dxos/plugin-
|
|
43
|
-
"@dxos/
|
|
44
|
-
"@dxos/
|
|
45
|
-
"@dxos/
|
|
44
|
+
"@dxos/app-framework": "0.8.4-main.abd8ff62ef",
|
|
45
|
+
"@dxos/app-toolkit": "0.8.4-main.abd8ff62ef",
|
|
46
|
+
"@dxos/compute": "0.8.4-main.abd8ff62ef",
|
|
47
|
+
"@dxos/plugin-attention": "0.8.4-main.abd8ff62ef",
|
|
48
|
+
"@dxos/plugin-graph": "0.8.4-main.abd8ff62ef",
|
|
49
|
+
"@dxos/plugin-settings": "0.8.4-main.abd8ff62ef",
|
|
50
|
+
"@dxos/plugin-theme": "0.8.4-main.abd8ff62ef",
|
|
51
|
+
"@dxos/util": "0.8.4-main.abd8ff62ef",
|
|
52
|
+
"@dxos/react-ui-mosaic": "0.8.4-main.abd8ff62ef"
|
|
46
53
|
},
|
|
47
54
|
"devDependencies": {
|
|
48
55
|
"@types/react": "~19.2.7",
|
|
@@ -50,16 +57,16 @@
|
|
|
50
57
|
"effect": "3.20.0",
|
|
51
58
|
"react": "~19.2.3",
|
|
52
59
|
"react-dom": "~19.2.3",
|
|
53
|
-
"vite": "^
|
|
54
|
-
"@dxos/react-ui": "0.8.4-main.
|
|
55
|
-
"@dxos/ui-theme": "0.8.4-main.
|
|
60
|
+
"vite": "^8.0.10",
|
|
61
|
+
"@dxos/react-ui": "0.8.4-main.abd8ff62ef",
|
|
62
|
+
"@dxos/ui-theme": "0.8.4-main.abd8ff62ef"
|
|
56
63
|
},
|
|
57
64
|
"peerDependencies": {
|
|
58
65
|
"effect": "3.20.0",
|
|
59
66
|
"react": "~19.2.3",
|
|
60
67
|
"react-dom": "~19.2.3",
|
|
61
|
-
"@dxos/react-ui": "0.8.4-main.
|
|
62
|
-
"@dxos/ui-theme": "0.8.4-main.
|
|
68
|
+
"@dxos/react-ui": "0.8.4-main.abd8ff62ef",
|
|
69
|
+
"@dxos/ui-theme": "0.8.4-main.abd8ff62ef"
|
|
63
70
|
},
|
|
64
71
|
"publishConfig": {
|
|
65
72
|
"access": "public"
|
package/src/StorybookPlugin.ts
CHANGED
|
@@ -32,8 +32,10 @@ export const StorybookPlugin = Plugin.define<StorybookPluginOptions>(meta).pipe(
|
|
|
32
32
|
Plugin.addModule(({ initialState }) => ({
|
|
33
33
|
id: Capability.getModuleTag(State),
|
|
34
34
|
activatesOn: ActivationEvents.Startup,
|
|
35
|
-
|
|
35
|
+
firesAfterActivation: [AppActivationEvents.LayoutReady],
|
|
36
36
|
activate: () => State({ initialState }),
|
|
37
37
|
})),
|
|
38
38
|
Plugin.make,
|
|
39
39
|
);
|
|
40
|
+
|
|
41
|
+
export default StorybookPlugin;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { Capability } from '@dxos/app-framework';
|
|
6
|
-
import { OperationHandlerSet } from '@dxos/
|
|
6
|
+
import { OperationHandlerSet } from '@dxos/compute';
|
|
7
7
|
|
|
8
8
|
export const OperationHandler = Capability.lazy<OperationHandlerSet.OperationHandlerSet>(
|
|
9
9
|
'OperationHandler',
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import * as Effect from 'effect/Effect';
|
|
6
6
|
|
|
7
7
|
import { Capabilities, Capability } from '@dxos/app-framework';
|
|
8
|
-
import type { OperationHandlerSet } from '@dxos/
|
|
8
|
+
import type { OperationHandlerSet } from '@dxos/compute';
|
|
9
9
|
|
|
10
10
|
import { TestingOperationHandlerSet } from '#operations';
|
|
11
11
|
|
|
@@ -7,6 +7,7 @@ import React, { type PropsWithChildren, useCallback, useContext, useEffect, useR
|
|
|
7
7
|
|
|
8
8
|
import { Surface, useCapability } from '@dxos/app-framework/ui';
|
|
9
9
|
import { type LayoutOperation } from '@dxos/app-toolkit';
|
|
10
|
+
import { AppSurface } from '@dxos/app-toolkit/ui';
|
|
10
11
|
import {
|
|
11
12
|
AlertDialog,
|
|
12
13
|
Button,
|
|
@@ -153,7 +154,7 @@ export const Layout = ({ children }: PropsWithChildren<{}>) => {
|
|
|
153
154
|
>
|
|
154
155
|
{layout.dialogBlockAlign === 'end' ? (
|
|
155
156
|
<Surface.Surface
|
|
156
|
-
|
|
157
|
+
type={AppSurface.Dialog}
|
|
157
158
|
data={layout.dialogContent}
|
|
158
159
|
limit={1}
|
|
159
160
|
fallback={ErrorFallback}
|
|
@@ -165,7 +166,12 @@ export const Layout = ({ children }: PropsWithChildren<{}>) => {
|
|
|
165
166
|
classNames={layout.dialogOverlayClasses}
|
|
166
167
|
style={layout.dialogOverlayStyle}
|
|
167
168
|
>
|
|
168
|
-
<Surface.Surface
|
|
169
|
+
<Surface.Surface
|
|
170
|
+
type={AppSurface.Dialog}
|
|
171
|
+
data={layout.dialogContent}
|
|
172
|
+
limit={1}
|
|
173
|
+
fallback={ErrorFallback}
|
|
174
|
+
/>
|
|
169
175
|
</DialogOverlay>
|
|
170
176
|
)}
|
|
171
177
|
</DialogRoot>
|
|
@@ -192,11 +198,11 @@ export const Layout = ({ children }: PropsWithChildren<{}>) => {
|
|
|
192
198
|
)}
|
|
193
199
|
<Card.CloseIconButton onClick={handleClose} />
|
|
194
200
|
</Card.Toolbar>
|
|
195
|
-
<Surface.Surface
|
|
201
|
+
<Surface.Surface type={AppSurface.Card} data={layout.popoverContent} limit={1} />
|
|
196
202
|
</Card.Root>
|
|
197
203
|
)}
|
|
198
204
|
{layout.popoverKind === 'base' && (
|
|
199
|
-
<Surface.Surface
|
|
205
|
+
<Surface.Surface type={AppSurface.Popover} data={layout.popoverContent} limit={1} />
|
|
200
206
|
)}
|
|
201
207
|
</Popover.Viewport>
|
|
202
208
|
<Popover.Arrow />
|
package/src/harness.ts
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2026 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { OperationPlugin, type Plugin, RuntimePlugin } from '@dxos/app-framework';
|
|
6
|
+
import { createTestApp, type TestAppOptions, type TestHarness } from '@dxos/app-framework/testing';
|
|
7
|
+
import { AttentionPlugin } from '@dxos/plugin-attention';
|
|
8
|
+
import { GraphPlugin } from '@dxos/plugin-graph';
|
|
9
|
+
import { SettingsPlugin } from '@dxos/plugin-settings';
|
|
10
|
+
|
|
11
|
+
export type ComposerTestAppOptions = Omit<TestAppOptions, 'plugins'> & {
|
|
12
|
+
/** Plugins to register in addition to the Composer core plugins. */
|
|
13
|
+
plugins?: Plugin.Plugin[];
|
|
14
|
+
/**
|
|
15
|
+
* Whether to include `ThemePlugin` in the core plugin set.
|
|
16
|
+
* Defaults to `false` — `ThemePlugin` requires a browser DOM and breaks Node-only tests.
|
|
17
|
+
* Set to `true` (with jsdom/happy-dom) when rendering React surfaces.
|
|
18
|
+
*/
|
|
19
|
+
theme?: boolean;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Headless core plugins for the test harness — the subset of `corePlugins()`
|
|
24
|
+
* that can be activated without a browser DOM.
|
|
25
|
+
*/
|
|
26
|
+
const headlessCorePlugins = (): Plugin.Plugin[] => [
|
|
27
|
+
AttentionPlugin(),
|
|
28
|
+
GraphPlugin(),
|
|
29
|
+
OperationPlugin(),
|
|
30
|
+
RuntimePlugin(),
|
|
31
|
+
SettingsPlugin(),
|
|
32
|
+
];
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Creates a TestHarness pre-loaded with the Composer core plugins
|
|
36
|
+
* (Attention, Graph, Operation, Runtime, Settings, optionally Theme).
|
|
37
|
+
*
|
|
38
|
+
* For a ClientPlugin-backed harness, pass `ClientPlugin({ ... })` via `plugins`.
|
|
39
|
+
*/
|
|
40
|
+
export const createComposerTestApp = async (opts: ComposerTestAppOptions = {}): Promise<TestHarness> => {
|
|
41
|
+
const { plugins = [], theme = false, ...rest } = opts;
|
|
42
|
+
const core = headlessCorePlugins();
|
|
43
|
+
if (theme) {
|
|
44
|
+
const { ThemePlugin } = await import('@dxos/plugin-theme');
|
|
45
|
+
const { defaultTx } = await import('@dxos/ui-theme');
|
|
46
|
+
core.push(ThemePlugin({ tx: defaultTx }));
|
|
47
|
+
}
|
|
48
|
+
return createTestApp({
|
|
49
|
+
...rest,
|
|
50
|
+
plugins: [...core, ...plugins],
|
|
51
|
+
});
|
|
52
|
+
};
|
package/src/index.ts
CHANGED
|
@@ -2,7 +2,12 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import { Plugin } from '@dxos/app-framework';
|
|
6
|
+
|
|
7
|
+
import { meta } from './meta';
|
|
8
|
+
|
|
5
9
|
export * from './core';
|
|
6
10
|
export * from './meta';
|
|
7
11
|
|
|
8
|
-
export
|
|
12
|
+
export const StorybookPlugin = Plugin.lazy(meta, () => import('#plugin'));
|
|
13
|
+
export type { StorybookPluginOptions } from '#plugin';
|
package/src/operations/close.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import * as Effect from 'effect/Effect';
|
|
6
6
|
|
|
7
7
|
import { LayoutOperation } from '@dxos/app-toolkit';
|
|
8
|
-
import { Operation } from '@dxos/
|
|
8
|
+
import { Operation } from '@dxos/compute';
|
|
9
9
|
|
|
10
10
|
const handler: Operation.WithHandler<typeof LayoutOperation.Close> = LayoutOperation.Close.pipe(
|
|
11
11
|
Operation.withHandler(() => Effect.void),
|
package/src/operations/index.ts
CHANGED
package/src/operations/open.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import * as Effect from 'effect/Effect';
|
|
6
6
|
|
|
7
7
|
import { LayoutOperation } from '@dxos/app-toolkit';
|
|
8
|
-
import { Operation } from '@dxos/
|
|
8
|
+
import { Operation } from '@dxos/compute';
|
|
9
9
|
|
|
10
10
|
const handler: Operation.WithHandler<typeof LayoutOperation.Open> = LayoutOperation.Open.pipe(
|
|
11
11
|
Operation.withHandler(
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import * as Effect from 'effect/Effect';
|
|
6
6
|
|
|
7
7
|
import { LayoutOperation } from '@dxos/app-toolkit';
|
|
8
|
-
import { Operation } from '@dxos/
|
|
8
|
+
import { Operation } from '@dxos/compute';
|
|
9
9
|
|
|
10
10
|
const handler: Operation.WithHandler<typeof LayoutOperation.ScrollIntoView> = LayoutOperation.ScrollIntoView.pipe(
|
|
11
11
|
Operation.withHandler(() => Effect.void),
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import * as Effect from 'effect/Effect';
|
|
6
6
|
|
|
7
7
|
import { LayoutOperation } from '@dxos/app-toolkit';
|
|
8
|
-
import { Operation } from '@dxos/
|
|
8
|
+
import { Operation } from '@dxos/compute';
|
|
9
9
|
|
|
10
10
|
const handler: Operation.WithHandler<typeof LayoutOperation.SetLayoutMode> = LayoutOperation.SetLayoutMode.pipe(
|
|
11
11
|
Operation.withHandler(() => Effect.void),
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import * as Effect from 'effect/Effect';
|
|
6
6
|
|
|
7
7
|
import { LayoutOperation } from '@dxos/app-toolkit';
|
|
8
|
-
import { Operation } from '@dxos/
|
|
8
|
+
import { Operation } from '@dxos/compute';
|
|
9
9
|
|
|
10
10
|
import { type LayoutStateProps } from '../types';
|
|
11
11
|
import { updateState } from './update-state';
|