@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.
Files changed (64) hide show
  1. package/dist/lib/browser/harness.mjs +35 -0
  2. package/dist/lib/browser/harness.mjs.map +7 -0
  3. package/dist/lib/browser/index.mjs +17 -36
  4. package/dist/lib/browser/index.mjs.map +4 -4
  5. package/dist/lib/browser/meta.json +1 -1
  6. package/dist/lib/node-esm/harness.mjs +37 -0
  7. package/dist/lib/node-esm/harness.mjs.map +7 -0
  8. package/dist/lib/node-esm/index.mjs +17 -36
  9. package/dist/lib/node-esm/index.mjs.map +4 -4
  10. package/dist/lib/node-esm/meta.json +1 -1
  11. package/dist/types/src/StorybookPlugin.d.ts +1 -0
  12. package/dist/types/src/StorybookPlugin.d.ts.map +1 -1
  13. package/dist/types/src/capabilities/index.d.ts +1 -1
  14. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  15. package/dist/types/src/capabilities/operation-handler.d.ts +1 -1
  16. package/dist/types/src/capabilities/operation-handler.d.ts.map +1 -1
  17. package/dist/types/src/capabilities/state.d.ts.map +1 -1
  18. package/dist/types/src/components/Layout/Layout.d.ts.map +1 -1
  19. package/dist/types/src/harness.d.ts +20 -0
  20. package/dist/types/src/harness.d.ts.map +1 -0
  21. package/dist/types/src/index.d.ts +3 -1
  22. package/dist/types/src/index.d.ts.map +1 -1
  23. package/dist/types/src/operations/add-toast.d.ts +1 -1
  24. package/dist/types/src/operations/add-toast.d.ts.map +1 -1
  25. package/dist/types/src/operations/close.d.ts +1 -1
  26. package/dist/types/src/operations/close.d.ts.map +1 -1
  27. package/dist/types/src/operations/index.d.ts +1 -1
  28. package/dist/types/src/operations/index.d.ts.map +1 -1
  29. package/dist/types/src/operations/open.d.ts +1 -1
  30. package/dist/types/src/operations/open.d.ts.map +1 -1
  31. package/dist/types/src/operations/scroll-into-view.d.ts +1 -1
  32. package/dist/types/src/operations/scroll-into-view.d.ts.map +1 -1
  33. package/dist/types/src/operations/set-layout-mode.d.ts +1 -1
  34. package/dist/types/src/operations/set-layout-mode.d.ts.map +1 -1
  35. package/dist/types/src/operations/switch-workspace.d.ts +1 -1
  36. package/dist/types/src/operations/switch-workspace.d.ts.map +1 -1
  37. package/dist/types/src/operations/update-complementary.d.ts +1 -1
  38. package/dist/types/src/operations/update-complementary.d.ts.map +1 -1
  39. package/dist/types/src/operations/update-dialog.d.ts +1 -1
  40. package/dist/types/src/operations/update-dialog.d.ts.map +1 -1
  41. package/dist/types/src/operations/update-popover.d.ts +1 -1
  42. package/dist/types/src/operations/update-popover.d.ts.map +1 -1
  43. package/dist/types/src/operations/update-sidebar.d.ts +1 -1
  44. package/dist/types/src/operations/update-sidebar.d.ts.map +1 -1
  45. package/dist/types/src/operations/update-state.d.ts.map +1 -1
  46. package/dist/types/tsconfig.tsbuildinfo +1 -1
  47. package/package.json +22 -15
  48. package/src/StorybookPlugin.ts +3 -1
  49. package/src/capabilities/index.ts +1 -1
  50. package/src/capabilities/operation-handler.ts +1 -1
  51. package/src/components/Layout/Layout.tsx +10 -4
  52. package/src/harness.ts +52 -0
  53. package/src/index.ts +6 -1
  54. package/src/operations/add-toast.ts +1 -1
  55. package/src/operations/close.ts +1 -1
  56. package/src/operations/index.ts +1 -1
  57. package/src/operations/open.ts +1 -1
  58. package/src/operations/scroll-into-view.ts +1 -1
  59. package/src/operations/set-layout-mode.ts +1 -1
  60. package/src/operations/switch-workspace.ts +1 -1
  61. package/src/operations/update-complementary.ts +1 -1
  62. package/src/operations/update-dialog.ts +1 -1
  63. package/src/operations/update-popover.ts +1 -1
  64. 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.9be5663bfe",
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.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"
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": "^7.1.11",
54
- "@dxos/react-ui": "0.8.4-main.9be5663bfe",
55
- "@dxos/ui-theme": "0.8.4-main.9be5663bfe"
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.9be5663bfe",
62
- "@dxos/ui-theme": "0.8.4-main.9be5663bfe"
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"
@@ -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
 
@@ -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
- 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/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 * from './StorybookPlugin';
12
+ export const StorybookPlugin = Plugin.lazy(meta, () => import('#plugin'));
13
+ export type { StorybookPluginOptions } from '#plugin';
@@ -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,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 { type LayoutStateProps } from '../types';
11
11
  import { updateState } from './update-state';
@@ -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