@dxos/plugin-testing 0.8.4-main.9be5663bfe → 0.8.4-main.bc2380dfbc

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.
Files changed (136) hide show
  1. package/LICENSE +102 -5
  2. package/dist/lib/neutral/StorybookPlugin.mjs +10 -0
  3. package/dist/lib/neutral/StorybookPlugin.mjs.map +7 -0
  4. package/dist/lib/neutral/add-toast-Z2RXG4RX.mjs +23 -0
  5. package/dist/lib/neutral/add-toast-Z2RXG4RX.mjs.map +7 -0
  6. package/dist/lib/neutral/capabilities/index.mjs +11 -0
  7. package/dist/lib/neutral/capabilities/index.mjs.map +7 -0
  8. package/dist/lib/neutral/chunk-E4LBVPH5.mjs +8 -0
  9. package/dist/lib/neutral/chunk-E4LBVPH5.mjs.map +7 -0
  10. package/dist/lib/neutral/chunk-J5LGTIGS.mjs +10 -0
  11. package/dist/lib/neutral/chunk-J5LGTIGS.mjs.map +7 -0
  12. package/dist/lib/neutral/chunk-NZ2VT6N2.mjs +17 -0
  13. package/dist/lib/neutral/chunk-NZ2VT6N2.mjs.map +7 -0
  14. package/dist/lib/neutral/chunk-R7AV233N.mjs +31 -0
  15. package/dist/lib/neutral/chunk-R7AV233N.mjs.map +7 -0
  16. package/dist/lib/neutral/chunk-ULNF6GTG.mjs +21 -0
  17. package/dist/lib/neutral/chunk-ULNF6GTG.mjs.map +7 -0
  18. package/dist/lib/neutral/chunk-VMXMXF46.mjs +22 -0
  19. package/dist/lib/neutral/chunk-VMXMXF46.mjs.map +7 -0
  20. package/dist/lib/neutral/chunk-ZVN23V74.mjs +16 -0
  21. package/dist/lib/neutral/chunk-ZVN23V74.mjs.map +7 -0
  22. package/dist/lib/neutral/close-L3FBJQ3J.mjs +12 -0
  23. package/dist/lib/neutral/close-L3FBJQ3J.mjs.map +7 -0
  24. package/dist/lib/neutral/components/index.mjs +183 -0
  25. package/dist/lib/neutral/components/index.mjs.map +7 -0
  26. package/dist/lib/neutral/core.mjs +8 -0
  27. package/dist/lib/neutral/core.mjs.map +7 -0
  28. package/dist/lib/neutral/harness.mjs +37 -0
  29. package/dist/lib/neutral/harness.mjs.map +7 -0
  30. package/dist/lib/neutral/index.mjs +20 -0
  31. package/dist/lib/neutral/index.mjs.map +7 -0
  32. package/dist/lib/neutral/meta.json +1 -0
  33. package/dist/lib/neutral/meta.mjs +8 -0
  34. package/dist/lib/neutral/meta.mjs.map +7 -0
  35. package/dist/lib/neutral/open-WBONYQ47.mjs +14 -0
  36. package/dist/lib/neutral/open-WBONYQ47.mjs.map +7 -0
  37. package/dist/lib/neutral/operation-handler-LQIWHQVY.mjs +13 -0
  38. package/dist/lib/neutral/operation-handler-LQIWHQVY.mjs.map +7 -0
  39. package/dist/lib/neutral/operations/index.mjs +8 -0
  40. package/dist/lib/neutral/operations/index.mjs.map +7 -0
  41. package/dist/lib/neutral/plugin.mjs +16 -0
  42. package/dist/lib/neutral/plugin.mjs.map +7 -0
  43. package/dist/lib/neutral/scroll-into-view-BKOOOECC.mjs +12 -0
  44. package/dist/lib/neutral/scroll-into-view-BKOOOECC.mjs.map +7 -0
  45. package/dist/lib/neutral/set-layout-mode-2KHD2AEY.mjs +12 -0
  46. package/dist/lib/neutral/set-layout-mode-2KHD2AEY.mjs.map +7 -0
  47. package/dist/lib/neutral/state-AJ62JEEG.mjs +43 -0
  48. package/dist/lib/neutral/state-AJ62JEEG.mjs.map +7 -0
  49. package/dist/lib/neutral/switch-workspace-SAT2NGXV.mjs +20 -0
  50. package/dist/lib/neutral/switch-workspace-SAT2NGXV.mjs.map +7 -0
  51. package/dist/lib/neutral/types/index.mjs +8 -0
  52. package/dist/lib/neutral/types/index.mjs.map +7 -0
  53. package/dist/lib/neutral/update-complementary-JP2OL73Z.mjs +26 -0
  54. package/dist/lib/neutral/update-complementary-JP2OL73Z.mjs.map +7 -0
  55. package/dist/lib/neutral/update-dialog-MX6IKKJX.mjs +28 -0
  56. package/dist/lib/neutral/update-dialog-MX6IKKJX.mjs.map +7 -0
  57. package/dist/lib/neutral/update-popover-DOORE3TD.mjs +46 -0
  58. package/dist/lib/neutral/update-popover-DOORE3TD.mjs.map +7 -0
  59. package/dist/lib/neutral/update-sidebar-LWQ3IA6S.mjs +26 -0
  60. package/dist/lib/neutral/update-sidebar-LWQ3IA6S.mjs.map +7 -0
  61. package/dist/types/src/StorybookPlugin.d.ts +3 -2
  62. package/dist/types/src/StorybookPlugin.d.ts.map +1 -1
  63. package/dist/types/src/capabilities/index.d.ts +3 -3
  64. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  65. package/dist/types/src/capabilities/operation-handler.d.ts +1 -1
  66. package/dist/types/src/capabilities/operation-handler.d.ts.map +1 -1
  67. package/dist/types/src/capabilities/state.d.ts +3 -3
  68. package/dist/types/src/capabilities/state.d.ts.map +1 -1
  69. package/dist/types/src/components/Layout/Layout.d.ts.map +1 -1
  70. package/dist/types/src/core.d.ts.map +1 -1
  71. package/dist/types/src/harness.d.ts +20 -0
  72. package/dist/types/src/harness.d.ts.map +1 -0
  73. package/dist/types/src/index.d.ts +1 -0
  74. package/dist/types/src/index.d.ts.map +1 -1
  75. package/dist/types/src/operations/add-toast.d.ts +1 -1
  76. package/dist/types/src/operations/add-toast.d.ts.map +1 -1
  77. package/dist/types/src/operations/close.d.ts +1 -1
  78. package/dist/types/src/operations/close.d.ts.map +1 -1
  79. package/dist/types/src/operations/index.d.ts +1 -1
  80. package/dist/types/src/operations/index.d.ts.map +1 -1
  81. package/dist/types/src/operations/open.d.ts +1 -1
  82. package/dist/types/src/operations/open.d.ts.map +1 -1
  83. package/dist/types/src/operations/scroll-into-view.d.ts +1 -1
  84. package/dist/types/src/operations/scroll-into-view.d.ts.map +1 -1
  85. package/dist/types/src/operations/set-layout-mode.d.ts +1 -1
  86. package/dist/types/src/operations/set-layout-mode.d.ts.map +1 -1
  87. package/dist/types/src/operations/switch-workspace.d.ts +1 -1
  88. package/dist/types/src/operations/switch-workspace.d.ts.map +1 -1
  89. package/dist/types/src/operations/update-complementary.d.ts +1 -1
  90. package/dist/types/src/operations/update-complementary.d.ts.map +1 -1
  91. package/dist/types/src/operations/update-dialog.d.ts +1 -1
  92. package/dist/types/src/operations/update-dialog.d.ts.map +1 -1
  93. package/dist/types/src/operations/update-popover.d.ts +1 -1
  94. package/dist/types/src/operations/update-popover.d.ts.map +1 -1
  95. package/dist/types/src/operations/update-sidebar.d.ts +1 -1
  96. package/dist/types/src/operations/update-sidebar.d.ts.map +1 -1
  97. package/dist/types/src/operations/update-state.d.ts +2 -2
  98. package/dist/types/src/operations/update-state.d.ts.map +1 -1
  99. package/dist/types/src/plugin.d.ts +5 -0
  100. package/dist/types/src/plugin.d.ts.map +1 -0
  101. package/dist/types/src/types/{capabilities.d.ts → StorybookCapabilities.d.ts} +1 -1
  102. package/dist/types/src/types/StorybookCapabilities.d.ts.map +1 -0
  103. package/dist/types/src/types/index.d.ts +1 -1
  104. package/dist/types/src/types/index.d.ts.map +1 -1
  105. package/dist/types/tsconfig.tsbuildinfo +1 -1
  106. package/package.json +57 -22
  107. package/src/StorybookPlugin.ts +5 -3
  108. package/src/capabilities/index.ts +1 -1
  109. package/src/capabilities/operation-handler.ts +1 -1
  110. package/src/capabilities/state.tsx +8 -5
  111. package/src/components/Layout/Layout.tsx +14 -8
  112. package/src/core.ts +17 -4
  113. package/src/harness.ts +52 -0
  114. package/src/index.ts +6 -0
  115. package/src/operations/add-toast.ts +1 -1
  116. package/src/operations/close.ts +1 -1
  117. package/src/operations/index.ts +1 -1
  118. package/src/operations/open.ts +1 -1
  119. package/src/operations/scroll-into-view.ts +1 -1
  120. package/src/operations/set-layout-mode.ts +1 -1
  121. package/src/operations/switch-workspace.ts +1 -1
  122. package/src/operations/update-complementary.ts +1 -1
  123. package/src/operations/update-dialog.ts +1 -1
  124. package/src/operations/update-popover.ts +3 -3
  125. package/src/operations/update-sidebar.ts +1 -1
  126. package/src/operations/update-state.ts +5 -3
  127. package/src/plugin.ts +12 -0
  128. package/src/types/{capabilities.ts → StorybookCapabilities.ts} +2 -0
  129. package/src/types/index.ts +1 -1
  130. package/dist/lib/browser/index.mjs +0 -60
  131. package/dist/lib/browser/index.mjs.map +0 -7
  132. package/dist/lib/browser/meta.json +0 -1
  133. package/dist/lib/node-esm/index.mjs +0 -62
  134. package/dist/lib/node-esm/index.mjs.map +0 -7
  135. package/dist/lib/node-esm/meta.json +0 -1
  136. package/dist/types/src/types/capabilities.d.ts.map +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dxos/plugin-testing",
3
- "version": "0.8.4-main.9be5663bfe",
3
+ "version": "0.8.4-main.bc2380dfbc",
4
4
  "description": "Plugin testing utils",
5
5
  "homepage": "https://dxos.org",
6
6
  "bugs": "https://github.com/dxos/dxos/issues",
@@ -8,22 +8,57 @@
8
8
  "type": "git",
9
9
  "url": "https://github.com/dxos/dxos"
10
10
  },
11
- "license": "MIT",
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": "./src/capabilities/index.ts",
17
- "#components": "./src/components/index.ts",
18
- "#meta": "./src/meta.ts",
19
- "#operations": "./src/operations/index.ts",
20
- "#types": "./src/types/index.ts"
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
- "browser": "./dist/lib/browser/index.mjs"
51
+ "default": "./dist/lib/neutral/index.mjs"
52
+ },
53
+ "./harness": {
54
+ "source": "./src/harness.ts",
55
+ "types": "./dist/types/src/harness.d.ts",
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"
27
62
  }
28
63
  },
29
64
  "types": "dist/types/src/index.d.ts",
@@ -34,15 +69,15 @@
34
69
  "dependencies": {
35
70
  "@effect-atom/atom": "^0.5.1",
36
71
  "@effect-atom/atom-react": "^0.5.0",
37
- "@dxos/app-framework": "0.8.4-main.9be5663bfe",
38
- "@dxos/app-toolkit": "0.8.4-main.9be5663bfe",
39
- "@dxos/operation": "0.8.4-main.9be5663bfe",
40
- "@dxos/plugin-settings": "0.8.4-main.9be5663bfe",
41
- "@dxos/plugin-graph": "0.8.4-main.9be5663bfe",
42
- "@dxos/plugin-theme": "0.8.4-main.9be5663bfe",
43
- "@dxos/util": "0.8.4-main.9be5663bfe",
44
- "@dxos/react-ui-mosaic": "0.8.4-main.9be5663bfe",
45
- "@dxos/plugin-attention": "0.8.4-main.9be5663bfe"
72
+ "@dxos/compute": "0.8.4-main.bc2380dfbc",
73
+ "@dxos/app-toolkit": "0.8.4-main.bc2380dfbc",
74
+ "@dxos/app-framework": "0.8.4-main.bc2380dfbc",
75
+ "@dxos/plugin-attention": "0.8.4-main.bc2380dfbc",
76
+ "@dxos/plugin-settings": "0.8.4-main.bc2380dfbc",
77
+ "@dxos/plugin-theme": "0.8.4-main.bc2380dfbc",
78
+ "@dxos/react-ui-mosaic": "0.8.4-main.bc2380dfbc",
79
+ "@dxos/util": "0.8.4-main.bc2380dfbc",
80
+ "@dxos/plugin-graph": "0.8.4-main.bc2380dfbc"
46
81
  },
47
82
  "devDependencies": {
48
83
  "@types/react": "~19.2.7",
@@ -50,16 +85,16 @@
50
85
  "effect": "3.20.0",
51
86
  "react": "~19.2.3",
52
87
  "react-dom": "~19.2.3",
53
- "vite": "^7.1.11",
54
- "@dxos/react-ui": "0.8.4-main.9be5663bfe",
55
- "@dxos/ui-theme": "0.8.4-main.9be5663bfe"
88
+ "vite": "^8.0.13",
89
+ "@dxos/react-ui": "0.8.4-main.bc2380dfbc",
90
+ "@dxos/ui-theme": "0.8.4-main.bc2380dfbc"
56
91
  },
57
92
  "peerDependencies": {
58
93
  "effect": "3.20.0",
59
94
  "react": "~19.2.3",
60
95
  "react-dom": "~19.2.3",
61
- "@dxos/react-ui": "0.8.4-main.9be5663bfe",
62
- "@dxos/ui-theme": "0.8.4-main.9be5663bfe"
96
+ "@dxos/react-ui": "0.8.4-main.bc2380dfbc",
97
+ "@dxos/ui-theme": "0.8.4-main.bc2380dfbc"
63
98
  },
64
99
  "publishConfig": {
65
100
  "access": "public"
@@ -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 { type LayoutStateProps } from '#types';
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(
@@ -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
- activatesAfter: [AppActivationEvents.LayoutReady],
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/operation';
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/operation';
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 { LayoutState, type LayoutStateProps } from '#types';
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 [Capability.contributes(LayoutState, stateAtom), Capability.contributes(AppCapabilities.Layout, layoutAtom)];
40
+ return [
41
+ Capability.contributes(StorybookCapabilities.LayoutState, stateAtom),
42
+ Capability.contributes(AppCapabilities.Layout, layoutAtom),
43
+ ];
41
44
  }),
42
45
  );
@@ -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,
@@ -24,7 +25,7 @@ import { Mosaic } from '@dxos/react-ui-mosaic';
24
25
  import { descriptionMessage, mx } from '@dxos/ui-theme';
25
26
 
26
27
  import { meta } from '#meta';
27
- import { LayoutState, type LayoutStateProps } from '#types';
28
+ import { StorybookCapabilities } from '#types';
28
29
 
29
30
  const debounce_delay = 100;
30
31
 
@@ -70,14 +71,14 @@ export const Layout = ({ children }: PropsWithChildren<{}>) => {
70
71
  const { t } = useTranslation(meta.id);
71
72
  const trigger = useRef<HTMLButtonElement | null>(null);
72
73
  const registry = useContext(RegistryContext);
73
- const stateAtom = useCapability(LayoutState);
74
+ const stateAtom = useCapability(StorybookCapabilities.LayoutState);
74
75
  const layout = useAtomValue(stateAtom);
75
76
  const [iter, setIter] = useState(0);
76
77
  const [open, setOpen] = useState(false);
77
78
  const debounceRef = useRef<NodeJS.Timeout | null>(null);
78
79
 
79
80
  const updateState = useCallback(
80
- (updates: Partial<LayoutStateProps>) => {
81
+ (updates: Partial<StorybookCapabilities.LayoutStateProps>) => {
81
82
  const current = registry.get(stateAtom);
82
83
  registry.set(stateAtom, { ...current, ...updates });
83
84
  },
@@ -134,7 +135,7 @@ export const Layout = ({ children }: PropsWithChildren<{}>) => {
134
135
 
135
136
  return (
136
137
  <Toast.Provider>
137
- <div role='none' className='fixed inset-0 flex overflow-hidden'>
138
+ <div className='fixed inset-0 flex overflow-hidden'>
138
139
  <Mosaic.Root>
139
140
  <Popover.Root open={open}>
140
141
  <Main.Root
@@ -153,7 +154,7 @@ export const Layout = ({ children }: PropsWithChildren<{}>) => {
153
154
  >
154
155
  {layout.dialogBlockAlign === 'end' ? (
155
156
  <Surface.Surface
156
- role='dialog'
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 role='dialog' data={layout.dialogContent} limit={1} fallback={ErrorFallback} />
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 role='card--content' data={layout.popoverContent} limit={1} />
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 role='popover' data={layout.popoverContent} limit={1} />
205
+ <Surface.Surface type={AppSurface.Popover} data={layout.popoverContent} limit={1} />
200
206
  )}
201
207
  </Popover.Viewport>
202
208
  <Popover.Arrow />
package/src/core.ts CHANGED
@@ -3,10 +3,23 @@
3
3
  //
4
4
 
5
5
  import { OperationPlugin, type Plugin, RuntimePlugin } from '@dxos/app-framework';
6
- import { AttentionPlugin } from '@dxos/plugin-attention';
7
- import { GraphPlugin } from '@dxos/plugin-graph';
8
- import { SettingsPlugin } from '@dxos/plugin-settings';
9
- import { ThemePlugin } from '@dxos/plugin-theme';
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';
10
23
  import { defaultTx } from '@dxos/ui-theme';
11
24
 
12
25
  /**
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/testing';
8
+ import { GraphPlugin } from '@dxos/plugin-graph/testing';
9
+ import { SettingsPlugin } from '@dxos/plugin-settings/testing';
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/testing');
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
@@ -4,5 +4,11 @@
4
4
 
5
5
  export * from './core';
6
6
  export * from './meta';
7
+ export * from './types';
7
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.
8
14
  export * from './StorybookPlugin';
@@ -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/operation';
8
+ import { Operation } from '@dxos/compute';
9
9
 
10
10
  import { updateState } from './update-state';
11
11
 
@@ -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/operation';
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),
@@ -2,7 +2,7 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
- import { OperationHandlerSet } from '@dxos/operation';
5
+ import { OperationHandlerSet } from '@dxos/compute';
6
6
 
7
7
  export const TestingOperationHandlerSet = OperationHandlerSet.lazy(
8
8
  () => import('./add-toast'),
@@ -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/operation';
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/operation';
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/operation';
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/operation';
8
+ import { Operation } from '@dxos/compute';
9
9
 
10
10
  import { updateState } from './update-state';
11
11
 
@@ -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/operation';
8
+ import { Operation } from '@dxos/compute';
9
9
 
10
10
  import { updateState } from './update-state';
11
11
 
@@ -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/operation';
8
+ import { Operation } from '@dxos/compute';
9
9
 
10
10
  import { updateState } from './update-state';
11
11
 
@@ -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/operation';
8
+ import { Operation } from '@dxos/compute';
9
9
 
10
- import { type LayoutStateProps } from '../types';
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:
@@ -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/operation';
8
+ import { Operation } from '@dxos/compute';
9
9
 
10
10
  import { updateState } from './update-state';
11
11
 
@@ -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 { LayoutState, type LayoutStateProps } from '../types';
9
+ import { StorybookCapabilities } from '../types';
10
10
 
11
- export const updateState = (fn: (state: LayoutStateProps) => Partial<LayoutStateProps>) =>
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';
@@ -2,6 +2,8 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
+ // @import-as-namespace
6
+
5
7
  import { type Atom } from '@effect-atom/atom-react';
6
8
 
7
9
  import { Capability } from '@dxos/app-framework';
@@ -2,4 +2,4 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
- export * from './capabilities';
5
+ export * as StorybookCapabilities from './StorybookCapabilities';
@@ -1,60 +0,0 @@
1
- // src/core.ts
2
- import { OperationPlugin, RuntimePlugin } from "@dxos/app-framework";
3
- import { AttentionPlugin } from "@dxos/plugin-attention";
4
- import { GraphPlugin } from "@dxos/plugin-graph";
5
- import { SettingsPlugin } from "@dxos/plugin-settings";
6
- import { ThemePlugin } from "@dxos/plugin-theme";
7
- import { defaultTx } from "@dxos/ui-theme";
8
- var corePlugins = () => [
9
- AttentionPlugin(),
10
- GraphPlugin(),
11
- OperationPlugin(),
12
- RuntimePlugin(),
13
- SettingsPlugin(),
14
- ThemePlugin({
15
- tx: defaultTx
16
- })
17
- ];
18
-
19
- // src/meta.ts
20
- import { trim } from "@dxos/util";
21
- var meta = {
22
- id: "org.dxos.plugin.storybook-layout",
23
- name: "Storybook",
24
- description: trim`
25
- Development layout optimized for Storybook component testing and documentation.
26
- Provides specialized views for component development and design system exploration.
27
- `,
28
- source: "https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-testing"
29
- };
30
-
31
- // src/StorybookPlugin.ts
32
- import * as Effect from "effect/Effect";
33
- import { ActivationEvents, Capabilities, Capability, Plugin } from "@dxos/app-framework";
34
- import { AppActivationEvents, AppPlugin } from "@dxos/app-toolkit";
35
- import { OperationHandler, State } from "#capabilities";
36
- import { Layout } from "#components";
37
- import { meta as meta2 } from "#meta";
38
- var StorybookPlugin = Plugin.define(meta2).pipe(AppPlugin.addOperationHandlerModule({
39
- activate: OperationHandler
40
- }), AppPlugin.addReactContextModule({
41
- activate: () => Effect.succeed(Capability.contributes(Capabilities.ReactContext, {
42
- id: "storybook-layout",
43
- context: Layout
44
- }))
45
- }), Plugin.addModule(({ initialState }) => ({
46
- id: Capability.getModuleTag(State),
47
- activatesOn: ActivationEvents.Startup,
48
- activatesAfter: [
49
- AppActivationEvents.LayoutReady
50
- ],
51
- activate: () => State({
52
- initialState
53
- })
54
- })), Plugin.make);
55
- export {
56
- StorybookPlugin,
57
- corePlugins,
58
- meta
59
- };
60
- //# sourceMappingURL=index.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/core.ts", "../../../src/meta.ts", "../../../src/StorybookPlugin.ts"],
4
- "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { OperationPlugin, type Plugin, RuntimePlugin } from '@dxos/app-framework';\nimport { AttentionPlugin } from '@dxos/plugin-attention';\nimport { GraphPlugin } from '@dxos/plugin-graph';\nimport { SettingsPlugin } from '@dxos/plugin-settings';\nimport { ThemePlugin } from '@dxos/plugin-theme';\nimport { defaultTx } from '@dxos/ui-theme';\n\n/**\n * Core plugins for testing/storybook environments.\n * NOTE: Does not include SpacePlugin to avoid circular dependencies.\n * Import SpacePlugin directly in your stories if needed.\n */\nexport const corePlugins = (): Plugin.Plugin[] => [\n AttentionPlugin(),\n GraphPlugin(),\n OperationPlugin(),\n RuntimePlugin(),\n SettingsPlugin(),\n ThemePlugin({ tx: defaultTx }),\n];\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { type Plugin } from '@dxos/app-framework';\nimport { trim } from '@dxos/util';\n\nexport const meta: Plugin.Meta = {\n id: 'org.dxos.plugin.storybook-layout',\n name: 'Storybook',\n description: trim`\n Development layout optimized for Storybook component testing and documentation.\n Provides specialized views for component development and design system exploration.\n `,\n source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-testing',\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\n\nimport { ActivationEvents, Capabilities, Capability, Plugin } from '@dxos/app-framework';\nimport { AppActivationEvents, AppPlugin } from '@dxos/app-toolkit';\n\nimport { OperationHandler, State } from '#capabilities';\nimport { Layout } from '#components';\nimport { meta } from '#meta';\nimport { type LayoutStateProps } from '#types';\n\nexport type StorybookPluginOptions = {\n initialState?: Partial<LayoutStateProps>;\n};\n\nexport const StorybookPlugin = Plugin.define<StorybookPluginOptions>(meta).pipe(\n AppPlugin.addOperationHandlerModule({\n activate: OperationHandler,\n }),\n AppPlugin.addReactContextModule({\n activate: () =>\n Effect.succeed(\n Capability.contributes(Capabilities.ReactContext, {\n id: 'storybook-layout',\n context: Layout,\n }),\n ),\n }),\n Plugin.addModule(({ initialState }) => ({\n id: Capability.getModuleTag(State),\n activatesOn: ActivationEvents.Startup,\n activatesAfter: [AppActivationEvents.LayoutReady],\n activate: () => State({ initialState }),\n })),\n Plugin.make,\n);\n"],
5
- "mappings": ";AAIA,SAASA,iBAA8BC,qBAAqB;AAC5D,SAASC,uBAAuB;AAChC,SAASC,mBAAmB;AAC5B,SAASC,sBAAsB;AAC/B,SAASC,mBAAmB;AAC5B,SAASC,iBAAiB;AAOnB,IAAMC,cAAc,MAAuB;EAChDC,gBAAAA;EACAC,YAAAA;EACAC,gBAAAA;EACAC,cAAAA;EACAC,eAAAA;EACAC,YAAY;IAAEC,IAAIC;EAAU,CAAA;;;;ACjB9B,SAASC,YAAY;AAEd,IAAMC,OAAoB;EAC/BC,IAAI;EACJC,MAAM;EACNC,aAAaC;;;;EAIbC,QAAQ;AACV;;;ACXA,YAAYC,YAAY;AAExB,SAASC,kBAAkBC,cAAcC,YAAYC,cAAc;AACnE,SAASC,qBAAqBC,iBAAiB;AAE/C,SAASC,kBAAkBC,aAAa;AACxC,SAASC,cAAc;AACvB,SAASC,QAAAA,aAAY;AAOd,IAAMC,kBAAkBC,OAAOC,OAA+BC,KAAAA,EAAMC,KACzEC,UAAUC,0BAA0B;EAClCC,UAAUC;AACZ,CAAA,GACAH,UAAUI,sBAAsB;EAC9BF,UAAU,MACDG,eACLC,WAAWC,YAAYC,aAAaC,cAAc;IAChDC,IAAI;IACJC,SAASC;EACX,CAAA,CAAA;AAEN,CAAA,GACAhB,OAAOiB,UAAU,CAAC,EAAEC,aAAY,OAAQ;EACtCJ,IAAIJ,WAAWS,aAAaC,KAAAA;EAC5BC,aAAaC,iBAAiBC;EAC9BC,gBAAgB;IAACC,oBAAoBC;;EACrCpB,UAAU,MAAMc,MAAM;IAAEF;EAAa,CAAA;AACvC,EAAA,GACAlB,OAAO2B,IAAI;",
6
- "names": ["OperationPlugin", "RuntimePlugin", "AttentionPlugin", "GraphPlugin", "SettingsPlugin", "ThemePlugin", "defaultTx", "corePlugins", "AttentionPlugin", "GraphPlugin", "OperationPlugin", "RuntimePlugin", "SettingsPlugin", "ThemePlugin", "tx", "defaultTx", "trim", "meta", "id", "name", "description", "trim", "source", "Effect", "ActivationEvents", "Capabilities", "Capability", "Plugin", "AppActivationEvents", "AppPlugin", "OperationHandler", "State", "Layout", "meta", "StorybookPlugin", "Plugin", "define", "meta", "pipe", "AppPlugin", "addOperationHandlerModule", "activate", "OperationHandler", "addReactContextModule", "succeed", "Capability", "contributes", "Capabilities", "ReactContext", "id", "context", "Layout", "addModule", "initialState", "getModuleTag", "State", "activatesOn", "ActivationEvents", "Startup", "activatesAfter", "AppActivationEvents", "LayoutReady", "make"]
7
- }
@@ -1 +0,0 @@
1
- {"inputs":{"src/core.ts":{"bytes":2660,"imports":[{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/plugin-attention","kind":"import-statement","external":true},{"path":"@dxos/plugin-graph","kind":"import-statement","external":true},{"path":"@dxos/plugin-settings","kind":"import-statement","external":true},{"path":"@dxos/plugin-theme","kind":"import-statement","external":true},{"path":"@dxos/ui-theme","kind":"import-statement","external":true}],"format":"esm"},"src/meta.ts":{"bytes":1661,"imports":[{"path":"@dxos/util","kind":"import-statement","external":true}],"format":"esm"},"src/StorybookPlugin.ts":{"bytes":4301,"imports":[{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/app-toolkit","kind":"import-statement","external":true},{"path":"#capabilities","kind":"import-statement","external":true},{"path":"#components","kind":"import-statement","external":true},{"path":"#meta","kind":"import-statement","external":true}],"format":"esm"},"src/index.ts":{"bytes":637,"imports":[{"path":"src/core.ts","kind":"import-statement","original":"./core"},{"path":"src/meta.ts","kind":"import-statement","original":"./meta"},{"path":"src/StorybookPlugin.ts","kind":"import-statement","original":"./StorybookPlugin"}],"format":"esm"}},"outputs":{"dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":4408},"dist/lib/browser/index.mjs":{"imports":[{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/plugin-attention","kind":"import-statement","external":true},{"path":"@dxos/plugin-graph","kind":"import-statement","external":true},{"path":"@dxos/plugin-settings","kind":"import-statement","external":true},{"path":"@dxos/plugin-theme","kind":"import-statement","external":true},{"path":"@dxos/ui-theme","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/app-toolkit","kind":"import-statement","external":true},{"path":"#capabilities","kind":"import-statement","external":true},{"path":"#components","kind":"import-statement","external":true},{"path":"#meta","kind":"import-statement","external":true}],"exports":["StorybookPlugin","corePlugins","meta"],"entryPoint":"src/index.ts","inputs":{"src/core.ts":{"bytesInOutput":494},"src/index.ts":{"bytesInOutput":0},"src/meta.ts":{"bytesInOutput":395},"src/StorybookPlugin.ts":{"bytesInOutput":878}},"bytes":1913}}}