@dxos/plugin-testing 0.8.4-main.422d1c7879 → 0.8.4-main.4668b7de9b
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/LICENSE +102 -5
- package/dist/lib/neutral/StorybookPlugin.mjs +10 -0
- package/dist/lib/neutral/add-toast-Z2RXG4RX.mjs +23 -0
- package/dist/lib/neutral/add-toast-Z2RXG4RX.mjs.map +7 -0
- package/dist/lib/neutral/capabilities/index.mjs +11 -0
- package/dist/lib/neutral/capabilities/index.mjs.map +7 -0
- package/dist/lib/neutral/chunk-C7HWAFWJ.mjs +21 -0
- package/dist/lib/neutral/chunk-C7HWAFWJ.mjs.map +7 -0
- package/dist/lib/neutral/chunk-HI5MWUZZ.mjs +19 -0
- package/dist/lib/neutral/chunk-HI5MWUZZ.mjs.map +7 -0
- package/dist/lib/neutral/chunk-J5LGTIGS.mjs +10 -0
- package/dist/lib/neutral/chunk-NZ2VT6N2.mjs +17 -0
- package/dist/lib/neutral/chunk-NZ2VT6N2.mjs.map +7 -0
- package/dist/lib/neutral/chunk-R7AV233N.mjs +31 -0
- package/dist/lib/neutral/chunk-R7AV233N.mjs.map +7 -0
- package/dist/lib/neutral/chunk-S4IEYCPX.mjs +8 -0
- package/dist/lib/neutral/chunk-S4IEYCPX.mjs.map +7 -0
- package/dist/lib/neutral/chunk-ULNF6GTG.mjs +21 -0
- package/dist/lib/neutral/chunk-ULNF6GTG.mjs.map +7 -0
- package/dist/lib/neutral/close-L3FBJQ3J.mjs +12 -0
- package/dist/lib/neutral/close-L3FBJQ3J.mjs.map +7 -0
- package/dist/lib/neutral/components/index.mjs +181 -0
- package/dist/lib/neutral/components/index.mjs.map +7 -0
- package/dist/lib/neutral/core.mjs +8 -0
- package/dist/lib/neutral/core.mjs.map +7 -0
- package/dist/lib/{browser/chunk-G2BI2IZM.mjs → neutral/harness.mjs} +10 -10
- package/dist/lib/neutral/harness.mjs.map +7 -0
- package/dist/lib/neutral/index.mjs +20 -0
- package/dist/lib/neutral/index.mjs.map +7 -0
- package/dist/lib/neutral/meta.json +1 -0
- package/dist/lib/neutral/meta.mjs +8 -0
- package/dist/lib/neutral/meta.mjs.map +7 -0
- package/dist/lib/neutral/open-O5FFJF2B.mjs +17 -0
- package/dist/lib/neutral/open-O5FFJF2B.mjs.map +7 -0
- package/dist/lib/neutral/operation-handler-LQIWHQVY.mjs +13 -0
- package/dist/lib/neutral/operation-handler-LQIWHQVY.mjs.map +7 -0
- package/dist/lib/neutral/operations/index.mjs +8 -0
- package/dist/lib/neutral/operations/index.mjs.map +7 -0
- package/dist/lib/neutral/plugin.mjs +16 -0
- package/dist/lib/neutral/plugin.mjs.map +7 -0
- package/dist/lib/neutral/scroll-into-view-BKOOOECC.mjs +12 -0
- package/dist/lib/neutral/scroll-into-view-BKOOOECC.mjs.map +7 -0
- package/dist/lib/neutral/set-layout-mode-2KHD2AEY.mjs +12 -0
- package/dist/lib/neutral/set-layout-mode-2KHD2AEY.mjs.map +7 -0
- package/dist/lib/neutral/state-AJ62JEEG.mjs +43 -0
- package/dist/lib/neutral/state-AJ62JEEG.mjs.map +7 -0
- package/dist/lib/neutral/switch-workspace-SAT2NGXV.mjs +20 -0
- package/dist/lib/neutral/switch-workspace-SAT2NGXV.mjs.map +7 -0
- package/dist/lib/neutral/types/index.mjs +8 -0
- package/dist/lib/neutral/types/index.mjs.map +7 -0
- package/dist/lib/neutral/update-complementary-JP2OL73Z.mjs +26 -0
- package/dist/lib/neutral/update-complementary-JP2OL73Z.mjs.map +7 -0
- package/dist/lib/neutral/update-dialog-MX6IKKJX.mjs +28 -0
- package/dist/lib/neutral/update-dialog-MX6IKKJX.mjs.map +7 -0
- package/dist/lib/neutral/update-popover-DOORE3TD.mjs +46 -0
- package/dist/lib/neutral/update-popover-DOORE3TD.mjs.map +7 -0
- package/dist/lib/neutral/update-sidebar-LWQ3IA6S.mjs +26 -0
- package/dist/lib/neutral/update-sidebar-LWQ3IA6S.mjs.map +7 -0
- package/dist/types/src/StorybookPlugin.d.ts +3 -2
- package/dist/types/src/StorybookPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +3 -3
- 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 +3 -3
- 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/core.d.ts.map +1 -1
- package/dist/types/src/harness.d.ts +1 -1
- package/dist/types/src/harness.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +1 -1
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +1 -1
- package/dist/types/src/meta.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 +2 -2
- package/dist/types/src/operations/update-state.d.ts.map +1 -1
- package/dist/types/src/plugin.d.ts +5 -0
- package/dist/types/src/plugin.d.ts.map +1 -0
- package/dist/types/src/types/{capabilities.d.ts → StorybookCapabilities.d.ts} +1 -1
- package/dist/types/src/types/StorybookCapabilities.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +1 -1
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +55 -25
- package/src/StorybookPlugin.ts +4 -2
- package/src/capabilities/index.ts +1 -1
- package/src/capabilities/operation-handler.ts +1 -1
- package/src/capabilities/state.tsx +8 -5
- package/src/components/Layout/Layout.tsx +18 -26
- package/src/core.ts +20 -8
- package/src/harness.ts +8 -9
- package/src/index.ts +6 -1
- package/src/meta.ts +6 -4
- 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 +3 -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 +3 -3
- package/src/operations/update-sidebar.ts +1 -1
- package/src/operations/update-state.ts +5 -3
- package/src/plugin.ts +12 -0
- package/src/types/{capabilities.ts → StorybookCapabilities.ts} +2 -0
- package/src/types/index.ts +1 -1
- package/dist/lib/browser/chunk-G2BI2IZM.mjs.map +0 -7
- package/dist/lib/browser/harness.mjs +0 -7
- package/dist/lib/browser/index.mjs +0 -65
- package/dist/lib/browser/index.mjs.map +0 -7
- package/dist/lib/browser/meta.json +0 -1
- package/dist/lib/node-esm/chunk-U342VJPQ.mjs +0 -38
- package/dist/lib/node-esm/chunk-U342VJPQ.mjs.map +0 -7
- package/dist/lib/node-esm/harness.mjs +0 -8
- package/dist/lib/node-esm/index.mjs +0 -66
- package/dist/lib/node-esm/index.mjs.map +0 -7
- package/dist/lib/node-esm/meta.json +0 -1
- package/dist/types/src/types/capabilities.d.ts.map +0 -1
- /package/dist/lib/{browser/harness.mjs.map → neutral/StorybookPlugin.mjs.map} +0 -0
- /package/dist/lib/{node-esm/harness.mjs.map → neutral/chunk-J5LGTIGS.mjs.map} +0 -0
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.4668b7de9b",
|
|
4
4
|
"description": "Plugin testing utils",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -8,28 +8,57 @@
|
|
|
8
8
|
"type": "git",
|
|
9
9
|
"url": "https://github.com/dxos/dxos"
|
|
10
10
|
},
|
|
11
|
-
"license": "
|
|
11
|
+
"license": "FSL-1.1-Apache-2.0",
|
|
12
12
|
"author": "DXOS.org",
|
|
13
13
|
"sideEffects": true,
|
|
14
14
|
"type": "module",
|
|
15
15
|
"imports": {
|
|
16
|
-
"#capabilities":
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
16
|
+
"#capabilities": {
|
|
17
|
+
"source": "./src/capabilities/index.ts",
|
|
18
|
+
"types": "./dist/types/src/capabilities/index.d.ts",
|
|
19
|
+
"default": "./dist/lib/neutral/capabilities/index.mjs"
|
|
20
|
+
},
|
|
21
|
+
"#components": {
|
|
22
|
+
"source": "./src/components/index.ts",
|
|
23
|
+
"types": "./dist/types/src/components/index.d.ts",
|
|
24
|
+
"default": "./dist/lib/neutral/components/index.mjs"
|
|
25
|
+
},
|
|
26
|
+
"#meta": {
|
|
27
|
+
"source": "./src/meta.ts",
|
|
28
|
+
"types": "./dist/types/src/meta.d.ts",
|
|
29
|
+
"default": "./dist/lib/neutral/meta.mjs"
|
|
30
|
+
},
|
|
31
|
+
"#operations": {
|
|
32
|
+
"source": "./src/operations/index.ts",
|
|
33
|
+
"types": "./dist/types/src/operations/index.d.ts",
|
|
34
|
+
"default": "./dist/lib/neutral/operations/index.mjs"
|
|
35
|
+
},
|
|
36
|
+
"#plugin": {
|
|
37
|
+
"source": "./src/StorybookPlugin.ts",
|
|
38
|
+
"types": "./dist/types/src/StorybookPlugin.d.ts",
|
|
39
|
+
"default": "./dist/lib/neutral/StorybookPlugin.mjs"
|
|
40
|
+
},
|
|
41
|
+
"#types": {
|
|
42
|
+
"source": "./src/types/index.ts",
|
|
43
|
+
"types": "./dist/types/src/types/index.d.ts",
|
|
44
|
+
"default": "./dist/lib/neutral/types/index.mjs"
|
|
45
|
+
}
|
|
21
46
|
},
|
|
22
47
|
"exports": {
|
|
23
48
|
".": {
|
|
24
49
|
"source": "./src/index.ts",
|
|
25
50
|
"types": "./dist/types/src/index.d.ts",
|
|
26
|
-
"
|
|
51
|
+
"default": "./dist/lib/neutral/index.mjs"
|
|
27
52
|
},
|
|
28
53
|
"./harness": {
|
|
29
54
|
"source": "./src/harness.ts",
|
|
30
55
|
"types": "./dist/types/src/harness.d.ts",
|
|
31
|
-
"
|
|
32
|
-
|
|
56
|
+
"default": "./dist/lib/neutral/harness.mjs"
|
|
57
|
+
},
|
|
58
|
+
"./plugin": {
|
|
59
|
+
"source": "./src/plugin.ts",
|
|
60
|
+
"types": "./dist/types/src/plugin.d.ts",
|
|
61
|
+
"default": "./dist/lib/neutral/plugin.mjs"
|
|
33
62
|
}
|
|
34
63
|
},
|
|
35
64
|
"types": "dist/types/src/index.d.ts",
|
|
@@ -38,17 +67,18 @@
|
|
|
38
67
|
"src"
|
|
39
68
|
],
|
|
40
69
|
"dependencies": {
|
|
41
|
-
"@effect-atom/atom": "^0.5.1",
|
|
42
70
|
"@effect-atom/atom-react": "^0.5.0",
|
|
43
|
-
"@dxos/app-
|
|
44
|
-
"@dxos/app-
|
|
45
|
-
"@dxos/
|
|
46
|
-
"@dxos/plugin-
|
|
47
|
-
"@dxos/
|
|
48
|
-
"@dxos/plugin-settings": "0.8.4-main.
|
|
49
|
-
"@dxos/
|
|
50
|
-
"@dxos/
|
|
51
|
-
"@dxos/
|
|
71
|
+
"@dxos/app-framework": "0.8.4-main.4668b7de9b",
|
|
72
|
+
"@dxos/app-toolkit": "0.8.4-main.4668b7de9b",
|
|
73
|
+
"@dxos/log": "0.8.4-main.4668b7de9b",
|
|
74
|
+
"@dxos/plugin-graph": "0.8.4-main.4668b7de9b",
|
|
75
|
+
"@dxos/plugin-theme": "0.8.4-main.4668b7de9b",
|
|
76
|
+
"@dxos/plugin-settings": "0.8.4-main.4668b7de9b",
|
|
77
|
+
"@dxos/react-ui-mosaic": "0.8.4-main.4668b7de9b",
|
|
78
|
+
"@dxos/util": "0.8.4-main.4668b7de9b",
|
|
79
|
+
"@dxos/keys": "0.8.4-main.4668b7de9b",
|
|
80
|
+
"@dxos/plugin-attention": "0.8.4-main.4668b7de9b",
|
|
81
|
+
"@dxos/compute": "0.8.4-main.4668b7de9b"
|
|
52
82
|
},
|
|
53
83
|
"devDependencies": {
|
|
54
84
|
"@types/react": "~19.2.7",
|
|
@@ -56,16 +86,16 @@
|
|
|
56
86
|
"effect": "3.20.0",
|
|
57
87
|
"react": "~19.2.3",
|
|
58
88
|
"react-dom": "~19.2.3",
|
|
59
|
-
"vite": "^
|
|
60
|
-
"@dxos/
|
|
61
|
-
"@dxos/ui
|
|
89
|
+
"vite": "^8.0.14",
|
|
90
|
+
"@dxos/ui-theme": "0.8.4-main.4668b7de9b",
|
|
91
|
+
"@dxos/react-ui": "0.8.4-main.4668b7de9b"
|
|
62
92
|
},
|
|
63
93
|
"peerDependencies": {
|
|
64
94
|
"effect": "3.20.0",
|
|
65
95
|
"react": "~19.2.3",
|
|
66
96
|
"react-dom": "~19.2.3",
|
|
67
|
-
"@dxos/react-ui": "0.8.4-main.
|
|
68
|
-
"@dxos/ui-theme": "0.8.4-main.
|
|
97
|
+
"@dxos/react-ui": "0.8.4-main.4668b7de9b",
|
|
98
|
+
"@dxos/ui-theme": "0.8.4-main.4668b7de9b"
|
|
69
99
|
},
|
|
70
100
|
"publishConfig": {
|
|
71
101
|
"access": "public"
|
package/src/StorybookPlugin.ts
CHANGED
|
@@ -10,10 +10,10 @@ import { AppActivationEvents, AppPlugin } from '@dxos/app-toolkit';
|
|
|
10
10
|
import { OperationHandler, State } from '#capabilities';
|
|
11
11
|
import { Layout } from '#components';
|
|
12
12
|
import { meta } from '#meta';
|
|
13
|
-
import {
|
|
13
|
+
import { StorybookCapabilities } from '#types';
|
|
14
14
|
|
|
15
15
|
export type StorybookPluginOptions = {
|
|
16
|
-
initialState?: Partial<LayoutStateProps>;
|
|
16
|
+
initialState?: Partial<StorybookCapabilities.LayoutStateProps>;
|
|
17
17
|
};
|
|
18
18
|
|
|
19
19
|
export const StorybookPlugin = Plugin.define<StorybookPluginOptions>(meta).pipe(
|
|
@@ -37,3 +37,5 @@ export const StorybookPlugin = Plugin.define<StorybookPluginOptions>(meta).pipe(
|
|
|
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
|
|
|
@@ -8,9 +8,9 @@ import * as Effect from 'effect/Effect';
|
|
|
8
8
|
import { Capability } from '@dxos/app-framework';
|
|
9
9
|
import { AppCapabilities } from '@dxos/app-toolkit';
|
|
10
10
|
|
|
11
|
-
import {
|
|
11
|
+
import { StorybookCapabilities } from '#types';
|
|
12
12
|
|
|
13
|
-
const defaultState: LayoutStateProps = {
|
|
13
|
+
const defaultState: StorybookCapabilities.LayoutStateProps = {
|
|
14
14
|
sidebarState: 'closed',
|
|
15
15
|
complementarySidebarState: 'closed',
|
|
16
16
|
dialogOpen: false,
|
|
@@ -19,9 +19,9 @@ const defaultState: LayoutStateProps = {
|
|
|
19
19
|
};
|
|
20
20
|
|
|
21
21
|
export default Capability.makeModule(
|
|
22
|
-
Effect.fnUntraced(function* (props?: { initialState?: Partial<LayoutStateProps> }) {
|
|
22
|
+
Effect.fnUntraced(function* (props?: { initialState?: Partial<StorybookCapabilities.LayoutStateProps> }) {
|
|
23
23
|
const { initialState } = props ?? {};
|
|
24
|
-
const stateAtom = Atom.make<LayoutStateProps>({ ...defaultState, ...initialState });
|
|
24
|
+
const stateAtom = Atom.make<StorybookCapabilities.LayoutStateProps>({ ...defaultState, ...initialState });
|
|
25
25
|
|
|
26
26
|
const layoutAtom = Atom.make((get): AppCapabilities.Layout => {
|
|
27
27
|
const state = get(stateAtom);
|
|
@@ -37,6 +37,9 @@ export default Capability.makeModule(
|
|
|
37
37
|
};
|
|
38
38
|
});
|
|
39
39
|
|
|
40
|
-
return [
|
|
40
|
+
return [
|
|
41
|
+
Capability.contributes(StorybookCapabilities.LayoutState, stateAtom),
|
|
42
|
+
Capability.contributes(AppCapabilities.Layout, layoutAtom),
|
|
43
|
+
];
|
|
41
44
|
}),
|
|
42
45
|
);
|
|
@@ -12,7 +12,6 @@ import {
|
|
|
12
12
|
AlertDialog,
|
|
13
13
|
Button,
|
|
14
14
|
Dialog,
|
|
15
|
-
Icon,
|
|
16
15
|
Main,
|
|
17
16
|
Popover,
|
|
18
17
|
type PopoverContentInteractOutsideEvent,
|
|
@@ -25,7 +24,7 @@ import { Mosaic } from '@dxos/react-ui-mosaic';
|
|
|
25
24
|
import { descriptionMessage, mx } from '@dxos/ui-theme';
|
|
26
25
|
|
|
27
26
|
import { meta } from '#meta';
|
|
28
|
-
import {
|
|
27
|
+
import { StorybookCapabilities } from '#types';
|
|
29
28
|
|
|
30
29
|
const debounce_delay = 100;
|
|
31
30
|
|
|
@@ -42,27 +41,19 @@ const StoryToast = ({ toast, onDismiss }: { toast: LayoutOperation.Toast; onDism
|
|
|
42
41
|
}
|
|
43
42
|
}}
|
|
44
43
|
>
|
|
45
|
-
<Toast.
|
|
46
|
-
<
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
</Toast.Body>
|
|
52
|
-
<Toast.Actions>
|
|
53
|
-
{toast.onAction && toast.actionAlt && toast.actionLabel && (
|
|
44
|
+
<Toast.Title icon={toast.icon} onClose={toast.closeLabel ? () => onDismiss(toast.id) : undefined}>
|
|
45
|
+
{toast.title && <span>{toLocalizedString(toast.title, t)}</span>}
|
|
46
|
+
</Toast.Title>
|
|
47
|
+
{toast.description && <Toast.Description>{toLocalizedString(toast.description, t)}</Toast.Description>}
|
|
48
|
+
{toast.onAction && toast.actionAlt && toast.actionLabel && (
|
|
49
|
+
<Toast.Actions>
|
|
54
50
|
<Toast.Action altText={toLocalizedString(toast.actionAlt, t)} asChild>
|
|
55
51
|
<Button variant='primary' onClick={() => toast.onAction?.()}>
|
|
56
52
|
{toLocalizedString(toast.actionLabel, t)}
|
|
57
53
|
</Button>
|
|
58
54
|
</Toast.Action>
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
<Toast.Close asChild>
|
|
62
|
-
<Button>{toLocalizedString(toast.closeLabel, t)}</Button>
|
|
63
|
-
</Toast.Close>
|
|
64
|
-
)}
|
|
65
|
-
</Toast.Actions>
|
|
55
|
+
</Toast.Actions>
|
|
56
|
+
)}
|
|
66
57
|
</Toast.Root>
|
|
67
58
|
);
|
|
68
59
|
};
|
|
@@ -71,14 +62,14 @@ export const Layout = ({ children }: PropsWithChildren<{}>) => {
|
|
|
71
62
|
const { t } = useTranslation(meta.id);
|
|
72
63
|
const trigger = useRef<HTMLButtonElement | null>(null);
|
|
73
64
|
const registry = useContext(RegistryContext);
|
|
74
|
-
const stateAtom = useCapability(LayoutState);
|
|
65
|
+
const stateAtom = useCapability(StorybookCapabilities.LayoutState);
|
|
75
66
|
const layout = useAtomValue(stateAtom);
|
|
76
67
|
const [iter, setIter] = useState(0);
|
|
77
68
|
const [open, setOpen] = useState(false);
|
|
78
69
|
const debounceRef = useRef<NodeJS.Timeout | null>(null);
|
|
79
70
|
|
|
80
71
|
const updateState = useCallback(
|
|
81
|
-
(updates: Partial<LayoutStateProps>) => {
|
|
72
|
+
(updates: Partial<StorybookCapabilities.LayoutStateProps>) => {
|
|
82
73
|
const current = registry.get(stateAtom);
|
|
83
74
|
registry.set(stateAtom, { ...current, ...updates });
|
|
84
75
|
},
|
|
@@ -135,7 +126,7 @@ export const Layout = ({ children }: PropsWithChildren<{}>) => {
|
|
|
135
126
|
|
|
136
127
|
return (
|
|
137
128
|
<Toast.Provider>
|
|
138
|
-
<div
|
|
129
|
+
<div className='fixed inset-0 flex overflow-hidden'>
|
|
139
130
|
<Mosaic.Root>
|
|
140
131
|
<Popover.Root open={open}>
|
|
141
132
|
<Main.Root
|
|
@@ -180,6 +171,7 @@ export const Layout = ({ children }: PropsWithChildren<{}>) => {
|
|
|
180
171
|
<Popover.Portal>
|
|
181
172
|
<Popover.Content
|
|
182
173
|
side={layout.popoverSide}
|
|
174
|
+
onOpenAutoFocus={(event) => event.preventDefault()}
|
|
183
175
|
onInteractOutside={handleInteractOutside}
|
|
184
176
|
onEscapeKeyDown={handleInteractOutside}
|
|
185
177
|
sticky='always'
|
|
@@ -188,16 +180,16 @@ export const Layout = ({ children }: PropsWithChildren<{}>) => {
|
|
|
188
180
|
<Popover.Viewport>
|
|
189
181
|
{layout.popoverKind === 'card' && (
|
|
190
182
|
<Card.Root>
|
|
191
|
-
<Card.
|
|
192
|
-
{/*
|
|
193
|
-
<
|
|
183
|
+
<Card.Header>
|
|
184
|
+
{/* Disabled drag handle keeps the toolbar slot layout consistent with regular cards. */}
|
|
185
|
+
<Card.DragHandle />
|
|
194
186
|
{layout.popoverTitle ? (
|
|
195
187
|
<Card.Title>{toLocalizedString(layout.popoverTitle, t)}</Card.Title>
|
|
196
188
|
) : (
|
|
197
189
|
<span />
|
|
198
190
|
)}
|
|
199
|
-
<Card.
|
|
200
|
-
</Card.
|
|
191
|
+
<Card.ActionIconButton action='close' onClick={handleClose} />
|
|
192
|
+
</Card.Header>
|
|
201
193
|
<Surface.Surface type={AppSurface.Card} data={layout.popoverContent} limit={1} />
|
|
202
194
|
</Card.Root>
|
|
203
195
|
)}
|
package/src/core.ts
CHANGED
|
@@ -2,12 +2,25 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
|
|
5
|
+
import { type Plugin, ProcessManagerPlugin } from '@dxos/app-framework';
|
|
6
|
+
// `/testing` entrypoints re-export the plugin eagerly (without `Plugin.lazy`).
|
|
7
|
+
// The default `.` and `/plugin` exports wrap each plugin in a lazy stub
|
|
8
|
+
// (`() => import('./XPlugin')`), which webkit cannot reliably resolve under
|
|
9
|
+
// vite-dev: the dynamic-import promise can settle with a partially-evaluated
|
|
10
|
+
// namespace, throwing `ReferenceError: Cannot access 'default' before
|
|
11
|
+
// initialization` from the loader's `mod.default` access. Storybook runs
|
|
12
|
+
// inside `storybook dev` (vite-dev) and is currently the only host that hits
|
|
13
|
+
// this. Production hosts (composer-app via `vite preview`) keep using the
|
|
14
|
+
// lazy `.` exports and their associated code splitting.
|
|
15
|
+
//
|
|
16
|
+
// Use these `/testing` entrypoints from any storybook `withPluginManager`
|
|
17
|
+
// setup. The single-line `export * from './XPlugin'` re-exports avoid the
|
|
18
|
+
// dynamic-import path entirely — see e.g. `plugin-attention/src/testing.ts`.
|
|
19
|
+
import { AttentionPlugin } from '@dxos/plugin-attention/testing';
|
|
20
|
+
import { GraphPlugin } from '@dxos/plugin-graph/testing';
|
|
21
|
+
import { SettingsPlugin } from '@dxos/plugin-settings/testing';
|
|
22
|
+
import { ThemePlugin } from '@dxos/plugin-theme/testing';
|
|
23
|
+
import { defaultTx } from '@dxos/react-ui';
|
|
11
24
|
|
|
12
25
|
/**
|
|
13
26
|
* Core plugins for testing/storybook environments.
|
|
@@ -17,8 +30,7 @@ import { defaultTx } from '@dxos/ui-theme';
|
|
|
17
30
|
export const corePlugins = (): Plugin.Plugin[] => [
|
|
18
31
|
AttentionPlugin(),
|
|
19
32
|
GraphPlugin(),
|
|
20
|
-
|
|
21
|
-
RuntimePlugin(),
|
|
33
|
+
ProcessManagerPlugin(),
|
|
22
34
|
SettingsPlugin(),
|
|
23
35
|
ThemePlugin({ tx: defaultTx }),
|
|
24
36
|
];
|
package/src/harness.ts
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
// Copyright 2026 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { type Plugin, ProcessManagerPlugin } from '@dxos/app-framework';
|
|
6
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';
|
|
7
|
+
import { AttentionPlugin } from '@dxos/plugin-attention/testing';
|
|
8
|
+
import { GraphPlugin } from '@dxos/plugin-graph/testing';
|
|
9
|
+
import { SettingsPlugin } from '@dxos/plugin-settings/testing';
|
|
10
10
|
|
|
11
11
|
export type ComposerTestAppOptions = Omit<TestAppOptions, 'plugins'> & {
|
|
12
12
|
/** Plugins to register in addition to the Composer core plugins. */
|
|
@@ -26,14 +26,13 @@ export type ComposerTestAppOptions = Omit<TestAppOptions, 'plugins'> & {
|
|
|
26
26
|
const headlessCorePlugins = (): Plugin.Plugin[] => [
|
|
27
27
|
AttentionPlugin(),
|
|
28
28
|
GraphPlugin(),
|
|
29
|
-
|
|
30
|
-
RuntimePlugin(),
|
|
29
|
+
ProcessManagerPlugin(),
|
|
31
30
|
SettingsPlugin(),
|
|
32
31
|
];
|
|
33
32
|
|
|
34
33
|
/**
|
|
35
34
|
* Creates a TestHarness pre-loaded with the Composer core plugins
|
|
36
|
-
* (Attention, Graph,
|
|
35
|
+
* (Attention, Graph, ProcessManager, Settings, optionally Theme).
|
|
37
36
|
*
|
|
38
37
|
* For a ClientPlugin-backed harness, pass `ClientPlugin({ ... })` via `plugins`.
|
|
39
38
|
*/
|
|
@@ -41,8 +40,8 @@ export const createComposerTestApp = async (opts: ComposerTestAppOptions = {}):
|
|
|
41
40
|
const { plugins = [], theme = false, ...rest } = opts;
|
|
42
41
|
const core = headlessCorePlugins();
|
|
43
42
|
if (theme) {
|
|
44
|
-
const { ThemePlugin } = await import('@dxos/plugin-theme');
|
|
45
|
-
const { defaultTx } = await import('@dxos/ui
|
|
43
|
+
const { ThemePlugin } = await import('@dxos/plugin-theme/testing');
|
|
44
|
+
const { defaultTx } = await import('@dxos/react-ui');
|
|
46
45
|
core.push(ThemePlugin({ tx: defaultTx }));
|
|
47
46
|
}
|
|
48
47
|
return createTestApp({
|
package/src/index.ts
CHANGED
|
@@ -3,7 +3,12 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
export * from './core';
|
|
6
|
-
export * from './harness';
|
|
7
6
|
export * from './meta';
|
|
7
|
+
export * from './types';
|
|
8
8
|
|
|
9
|
+
// `@dxos/plugin-testing` is a testing-only package, so `StorybookPlugin` is
|
|
10
|
+
// exported eagerly from the `.` entrypoint (no `Plugin.lazy` indirection).
|
|
11
|
+
// Storybook on webkit + vite-dev cannot reliably resolve the lazy form's
|
|
12
|
+
// dynamic `import()` — see `./core.ts` for the underlying chunk-init issue
|
|
13
|
+
// — and there is no production code-splitting benefit to recover here.
|
|
9
14
|
export * from './StorybookPlugin';
|
package/src/meta.ts
CHANGED
|
@@ -2,15 +2,17 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { Plugin } from '@dxos/app-framework';
|
|
6
|
+
import { DXN } from '@dxos/keys';
|
|
6
7
|
import { trim } from '@dxos/util';
|
|
7
8
|
|
|
8
|
-
export const meta
|
|
9
|
-
|
|
9
|
+
export const meta = Plugin.makeMeta({
|
|
10
|
+
key: DXN.make('org.dxos.plugin.storybookLayout'),
|
|
10
11
|
name: 'Storybook',
|
|
12
|
+
author: 'DXOS',
|
|
11
13
|
description: trim`
|
|
12
14
|
Development layout optimized for Storybook component testing and documentation.
|
|
13
15
|
Provides specialized views for component development and design system exploration.
|
|
14
16
|
`,
|
|
15
17
|
source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-testing',
|
|
16
|
-
};
|
|
18
|
+
});
|
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,11 +5,13 @@
|
|
|
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
|
+
import { log } from '@dxos/log';
|
|
9
10
|
|
|
10
11
|
const handler: Operation.WithHandler<typeof LayoutOperation.Open> = LayoutOperation.Open.pipe(
|
|
11
12
|
Operation.withHandler(
|
|
12
13
|
Effect.fnUntraced(function* (input) {
|
|
14
|
+
log('LayoutOperation.Open handler start');
|
|
13
15
|
return input.subject;
|
|
14
16
|
}),
|
|
15
17
|
),
|
|
@@ -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,9 +5,9 @@
|
|
|
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
|
-
import {
|
|
10
|
+
import { StorybookCapabilities } from '../types';
|
|
11
11
|
import { updateState } from './update-state';
|
|
12
12
|
|
|
13
13
|
const handler: Operation.WithHandler<typeof LayoutOperation.UpdatePopover> = LayoutOperation.UpdatePopover.pipe(
|
|
@@ -15,7 +15,7 @@ const handler: Operation.WithHandler<typeof LayoutOperation.UpdatePopover> = Lay
|
|
|
15
15
|
Effect.fnUntraced(function* (input) {
|
|
16
16
|
const { subject, state, side, kind, props } = input;
|
|
17
17
|
yield* updateState(() => {
|
|
18
|
-
const base: Partial<LayoutStateProps> = {
|
|
18
|
+
const base: Partial<StorybookCapabilities.LayoutStateProps> = {
|
|
19
19
|
popoverKind: kind ?? 'base',
|
|
20
20
|
popoverTitle: kind === 'card' ? input.title : undefined,
|
|
21
21
|
popoverContent:
|
|
@@ -6,12 +6,14 @@ import * as Effect from 'effect/Effect';
|
|
|
6
6
|
|
|
7
7
|
import { Capabilities, Capability } from '@dxos/app-framework';
|
|
8
8
|
|
|
9
|
-
import {
|
|
9
|
+
import { StorybookCapabilities } from '../types';
|
|
10
10
|
|
|
11
|
-
export const updateState = (
|
|
11
|
+
export const updateState = (
|
|
12
|
+
fn: (state: StorybookCapabilities.LayoutStateProps) => Partial<StorybookCapabilities.LayoutStateProps>,
|
|
13
|
+
) =>
|
|
12
14
|
Effect.gen(function* () {
|
|
13
15
|
const registry = yield* Capability.get(Capabilities.AtomRegistry);
|
|
14
|
-
const stateAtom = yield* Capability.get(LayoutState);
|
|
16
|
+
const stateAtom = yield* Capability.get(StorybookCapabilities.LayoutState);
|
|
15
17
|
const current = registry.get(stateAtom);
|
|
16
18
|
registry.set(stateAtom, { ...current, ...fn(current) });
|
|
17
19
|
});
|
package/src/plugin.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2023 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { Plugin } from '@dxos/app-framework';
|
|
6
|
+
|
|
7
|
+
import { meta } from './meta';
|
|
8
|
+
|
|
9
|
+
export const StorybookPlugin = Plugin.lazy(meta, () => import('#plugin'));
|
|
10
|
+
export type { StorybookPluginOptions } from '#plugin';
|
|
11
|
+
|
|
12
|
+
export { TestingOperationHandlerSet } from './operations';
|
package/src/types/index.ts
CHANGED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/harness.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2026 DXOS.org\n//\n\nimport { OperationPlugin, type Plugin, RuntimePlugin } from '@dxos/app-framework';\nimport { createTestApp, type TestAppOptions, type TestHarness } from '@dxos/app-framework/testing';\nimport { AttentionPlugin } from '@dxos/plugin-attention';\nimport { GraphPlugin } from '@dxos/plugin-graph';\nimport { SettingsPlugin } from '@dxos/plugin-settings';\n\nexport type ComposerTestAppOptions = Omit<TestAppOptions, 'plugins'> & {\n /** Plugins to register in addition to the Composer core plugins. */\n plugins?: Plugin.Plugin[];\n /**\n * Whether to include `ThemePlugin` in the core plugin set.\n * Defaults to `false` — `ThemePlugin` requires a browser DOM and breaks Node-only tests.\n * Set to `true` (with jsdom/happy-dom) when rendering React surfaces.\n */\n theme?: boolean;\n};\n\n/**\n * Headless core plugins for the test harness — the subset of `corePlugins()`\n * that can be activated without a browser DOM.\n */\nconst headlessCorePlugins = (): Plugin.Plugin[] => [\n AttentionPlugin(),\n GraphPlugin(),\n OperationPlugin(),\n RuntimePlugin(),\n SettingsPlugin(),\n];\n\n/**\n * Creates a TestHarness pre-loaded with the Composer core plugins\n * (Attention, Graph, Operation, Runtime, Settings, optionally Theme).\n *\n * For a ClientPlugin-backed harness, pass `ClientPlugin({ ... })` via `plugins`.\n */\nexport const createComposerTestApp = async (opts: ComposerTestAppOptions = {}): Promise<TestHarness> => {\n const { plugins = [], theme = false, ...rest } = opts;\n const core = headlessCorePlugins();\n if (theme) {\n const { ThemePlugin } = await import('@dxos/plugin-theme');\n const { defaultTx } = await import('@dxos/ui-theme');\n core.push(ThemePlugin({ tx: defaultTx }));\n }\n return createTestApp({\n ...rest,\n plugins: [...core, ...plugins],\n });\n};\n"],
|
|
5
|
-
"mappings": ";AAIA,SAASA,iBAA8BC,qBAAqB;AAC5D,SAASC,qBAA4D;AACrE,SAASC,uBAAuB;AAChC,SAASC,mBAAmB;AAC5B,SAASC,sBAAsB;AAiB/B,IAAMC,sBAAsB,MAAuB;EACjDC,gBAAAA;EACAC,YAAAA;EACAC,gBAAAA;EACAC,cAAAA;EACAC,eAAAA;;AASK,IAAMC,wBAAwB,OAAOC,OAA+B,CAAC,MAAC;AAC3E,QAAM,EAAEC,UAAU,CAAA,GAAIC,QAAQ,OAAO,GAAGC,KAAAA,IAASH;AACjD,QAAMI,OAAOX,oBAAAA;AACb,MAAIS,OAAO;AACT,UAAM,EAAEG,YAAW,IAAK,MAAM,OAAO,oBAAA;AACrC,UAAM,EAAEC,UAAS,IAAK,MAAM,OAAO,gBAAA;AACnCF,SAAKG,KAAKF,YAAY;MAAEG,IAAIF;IAAU,CAAA,CAAA;EACxC;AACA,SAAOG,cAAc;IACnB,GAAGN;IACHF,SAAS;SAAIG;SAASH;;EACxB,CAAA;AACF;",
|
|
6
|
-
"names": ["OperationPlugin", "RuntimePlugin", "createTestApp", "AttentionPlugin", "GraphPlugin", "SettingsPlugin", "headlessCorePlugins", "AttentionPlugin", "GraphPlugin", "OperationPlugin", "RuntimePlugin", "SettingsPlugin", "createComposerTestApp", "opts", "plugins", "theme", "rest", "core", "ThemePlugin", "defaultTx", "push", "tx", "createTestApp"]
|
|
7
|
-
}
|