@dxos/plugin-testing 0.12.0-next-73daef452f1464b62efdbca75fb0067c1066f264 → 0.13.0

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 (87) hide show
  1. package/dist/lib/StorybookCapabilities.mjs.map +1 -1
  2. package/dist/lib/capabilities.browser.mjs +16 -0
  3. package/dist/lib/capabilities.browser.mjs.map +1 -0
  4. package/dist/lib/capabilities.mjs.map +1 -1
  5. package/dist/lib/capabilities.node.mjs.map +1 -1
  6. package/dist/lib/capabilities.tauri.mjs +16 -0
  7. package/dist/lib/capabilities.tauri.mjs.map +1 -0
  8. package/dist/lib/capabilities.workerd.mjs.map +1 -1
  9. package/dist/lib/chunk-add-toast.mjs.map +1 -1
  10. package/dist/lib/chunk-state.mjs +1 -1
  11. package/dist/lib/chunk-state.mjs.map +1 -1
  12. package/dist/lib/chunk-switch-workspace.mjs.map +1 -1
  13. package/dist/lib/chunk-update-complementary.mjs.map +1 -1
  14. package/dist/lib/chunk-update-dialog.mjs.map +1 -1
  15. package/dist/lib/chunk-update-popover.mjs.map +1 -1
  16. package/dist/lib/chunk-update-sidebar.mjs.map +1 -1
  17. package/dist/lib/components.mjs +62 -55
  18. package/dist/lib/components.mjs.map +1 -1
  19. package/dist/lib/core.mjs +4 -4
  20. package/dist/lib/core.mjs.map +1 -1
  21. package/dist/lib/harness.mjs +7 -5
  22. package/dist/lib/harness.mjs.map +1 -1
  23. package/dist/lib/index.mjs +4 -214
  24. package/dist/lib/meta.mjs.map +1 -1
  25. package/dist/lib/ns/CorePlugins.mjs +8 -0
  26. package/dist/lib/ns/CorePlugins.mjs.map +1 -0
  27. package/dist/lib/ns/Corpus.mjs +216 -0
  28. package/dist/lib/ns/Corpus.mjs.map +1 -0
  29. package/dist/lib/operations.mjs.map +1 -1
  30. package/dist/types/src/CorePlugins.d.ts +2 -0
  31. package/dist/types/src/CorePlugins.d.ts.map +1 -0
  32. package/dist/types/src/Corpus.d.ts +2 -0
  33. package/dist/types/src/Corpus.d.ts.map +1 -0
  34. package/dist/types/src/{harness.d.ts → Harness.d.ts} +1 -1
  35. package/dist/types/src/{harness.d.ts.map → Harness.d.ts.map} +1 -1
  36. package/dist/types/src/capabilities/gen/browser.d.ts +8 -0
  37. package/dist/types/src/capabilities/gen/browser.d.ts.map +1 -0
  38. package/dist/types/src/capabilities/gen/node.d.ts.map +1 -1
  39. package/dist/types/src/capabilities/gen/tauri.d.ts +8 -0
  40. package/dist/types/src/capabilities/gen/tauri.d.ts.map +1 -0
  41. package/dist/types/src/capabilities/gen/workerd.d.ts.map +1 -1
  42. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  43. package/dist/types/src/components/Layout/Layout.d.ts.map +1 -1
  44. package/dist/types/src/components/Layout/index.d.ts +1 -1
  45. package/dist/types/src/components/Layout/index.d.ts.map +1 -1
  46. package/dist/types/src/components/index.d.ts +1 -1
  47. package/dist/types/src/components/index.d.ts.map +1 -1
  48. package/dist/types/src/core.d.ts.map +1 -1
  49. package/dist/types/src/corpus/index.d.ts +1 -1
  50. package/dist/types/src/corpus/index.d.ts.map +1 -1
  51. package/dist/types/src/index.d.ts +4 -4
  52. package/dist/types/src/index.d.ts.map +1 -1
  53. package/dist/types/src/operations/update-state.d.ts +1 -1
  54. package/dist/types/src/operations/update-state.d.ts.map +1 -1
  55. package/dist/types/src/types/StorybookCapabilities.d.ts +3 -3
  56. package/dist/types/src/types/StorybookCapabilities.d.ts.map +1 -1
  57. package/dist/types/src/types/index.d.ts +1 -1
  58. package/dist/types/src/types/index.d.ts.map +1 -1
  59. package/dist/types/tsconfig.tsbuildinfo +1 -1
  60. package/package.json +37 -25
  61. package/src/CorePlugins.ts +7 -0
  62. package/src/Corpus.ts +7 -0
  63. package/src/{harness.ts → Harness.ts} +5 -3
  64. package/src/capabilities/gen/browser.ts +23 -0
  65. package/src/capabilities/gen/node.ts +2 -2
  66. package/src/capabilities/gen/tauri.ts +23 -0
  67. package/src/capabilities/gen/workerd.ts +2 -2
  68. package/src/capabilities/index.ts +3 -3
  69. package/src/capabilities/state.tsx +1 -1
  70. package/src/components/Layout/Layout.tsx +101 -96
  71. package/src/components/Layout/index.ts +1 -1
  72. package/src/components/index.ts +1 -1
  73. package/src/core.ts +4 -4
  74. package/src/corpus/index.ts +1 -1
  75. package/src/corpus/sample-messages.test.ts +1 -1
  76. package/src/index.ts +4 -4
  77. package/src/meta.ts +1 -1
  78. package/src/operations/add-toast.ts +1 -1
  79. package/src/operations/index.ts +9 -9
  80. package/src/operations/switch-workspace.ts +1 -1
  81. package/src/operations/update-complementary.ts +1 -1
  82. package/src/operations/update-dialog.ts +1 -1
  83. package/src/operations/update-popover.ts +1 -1
  84. package/src/operations/update-sidebar.ts +1 -1
  85. package/src/types/StorybookCapabilities.ts +3 -3
  86. package/src/types/index.ts +1 -1
  87. package/dist/lib/index.mjs.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"StorybookCapabilities.mjs","names":[],"sources":["../../src/types/StorybookCapabilities.ts"],"sourcesContent":["//\n// Copyright 2025 DXOS.org\n//\n\n// @import-as-namespace\n\nimport type * as Atom from 'effect/unstable/reactivity/Atom';\n\nimport * as Capability from '@dxos/app-framework/Capability';\nimport type * as LayoutOperation from '@dxos/app-toolkit/LayoutOperation';\nimport { type Label } from '@dxos/react-ui';\n\nimport { meta } from '#meta';\n\nexport type LayoutStateProps = {\n sidebarState?: 'expanded' | 'collapsed' | 'closed';\n complementarySidebarState?: 'expanded' | 'collapsed' | 'closed';\n\n dialogOpen: boolean;\n dialogType?: 'default' | 'alert';\n dialogBlockAlign?: 'start' | 'center' | 'end';\n dialogOverlayClasses?: string;\n dialogOverlayStyle?: Record<string, any>;\n /** Data to be passed to the dialog Surface. */\n dialogContent?: any;\n\n popoverOpen?: boolean;\n popoverSide?: 'top' | 'right' | 'bottom' | 'left';\n popoverVariant?: 'virtual' | 'react';\n popoverAnchor?: HTMLButtonElement;\n popoverAnchorId?: string;\n popoverKind?: 'base' | 'card' | 'rename';\n popoverTitle?: Label;\n popoverContent?: any;\n\n toasts: LayoutOperation.Toast[];\n\n workspace: string;\n};\n\nexport const LayoutState = Capability.makeSingleton<Atom.Writable<LayoutStateProps>>()(`${meta.profile.key}.state`);\n"],"mappings":";;;;;AAwCA,IAAa,cAAc,WAAW,cAA+C,CAAC,CAAC,GAAG,KAAK,QAAQ,IAAI,OAAO"}
1
+ {"version":3,"file":"StorybookCapabilities.mjs","names":[],"sources":["../../src/types/StorybookCapabilities.ts"],"sourcesContent":["//\n// Copyright 2025 DXOS.org\n//\n\n// @import-as-namespace\n\nimport type * as Atom from 'effect/reactivity/Atom';\n\nimport * as Capability from '@dxos/app-framework/Capability';\nimport type * as LayoutOperation from '@dxos/app-toolkit/LayoutOperation';\nimport type * as Theme from '@dxos/react-ui/Theme';\n\nimport { meta } from '#meta';\n\nexport type LayoutStateProps = {\n sidebarState?: 'expanded' | 'collapsed' | 'closed';\n complementarySidebarState?: 'expanded' | 'collapsed' | 'closed';\n\n dialogOpen: boolean;\n dialogType?: 'default' | 'alert';\n dialogBlockAlign?: 'start' | 'center' | 'end';\n dialogOverlayClasses?: string;\n dialogOverlayStyle?: Record<string, any>;\n /** Data to be passed to the dialog Surface. */\n dialogContent?: any;\n\n popoverOpen?: boolean;\n popoverSide?: 'top' | 'right' | 'bottom' | 'left';\n popoverVariant?: 'virtual' | 'react';\n popoverAnchor?: HTMLButtonElement;\n popoverAnchorId?: string;\n popoverKind?: 'base' | 'card' | 'rename';\n popoverTitle?: Theme.Label;\n popoverContent?: any;\n\n toasts: LayoutOperation.Toast[];\n\n workspace: string;\n};\n\nexport const LayoutState = Capability.makeSingleton<Atom.Writable<LayoutStateProps>>()(`${meta.profile.key}.state`);\n"],"mappings":";;;;;AAwCA,IAAa,cAAc,WAAW,cAA+C,CAAC,CAAC,GAAG,KAAK,QAAQ,IAAI,OAAO"}
@@ -0,0 +1,16 @@
1
+ import * as ActivationEvents from "@dxos/app-framework/ActivationEvents";
2
+ import * as Capability from "@dxos/app-framework/Capability";
3
+ import * as AppCapabilities from "@dxos/app-toolkit/AppCapabilities";
4
+ import * as AppCapability from "@dxos/app-toolkit/AppCapability";
5
+ import { StorybookCapabilities } from "#types";
6
+ //#region src/capabilities/gen/browser.ts
7
+ var OperationHandler = AppCapability.operationHandler(() => import("./chunk-operation-handler.mjs"));
8
+ var ReactContext = AppCapability.reactContext(() => import("./chunk-react-context.mjs"));
9
+ var State = Capability.lazyModule("State", {
10
+ activatesOn: ActivationEvents.Startup,
11
+ provides: [StorybookCapabilities.LayoutState, AppCapabilities.Layout]
12
+ }, () => import("./chunk-state.mjs"));
13
+ //#endregion
14
+ export { OperationHandler, ReactContext, State };
15
+
16
+ //# sourceMappingURL=capabilities.browser.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"capabilities.browser.mjs","names":[],"sources":["../../src/capabilities/gen/browser.ts"],"sourcesContent":["//\n// Copyright 2026 DXOS.org\n//\n\n// GENERATED by dx-plugin — do not edit. Sliced from ../index.ts for the 'browser' condition.\n\nimport * as ActivationEvents from '@dxos/app-framework/ActivationEvents';\nimport * as Capability from '@dxos/app-framework/Capability';\nimport * as AppCapabilities from '@dxos/app-toolkit/AppCapabilities';\nimport * as AppCapability from '@dxos/app-toolkit/AppCapability';\n\nimport { StorybookCapabilities } from '#types';\n\nexport const OperationHandler = AppCapability.operationHandler(() => import('../operation-handler.ts'));\n\nexport const ReactContext = AppCapability.reactContext(() => import('../react-context.tsx'));\n\nexport const State = Capability.lazyModule(\n 'State',\n // Shell state read by `Layout` on its first render — same class as the deck's `DeckState`.\n { activatesOn: ActivationEvents.Startup, provides: [StorybookCapabilities.LayoutState, AppCapabilities.Layout] },\n () => import('../state.tsx'),\n);\n"],"mappings":";;;;;;AAaA,IAAa,mBAAmB,cAAc,uBAAuB,OAAO,gCAA0B;AAEtG,IAAa,eAAe,cAAc,mBAAmB,OAAO,4BAAuB;AAE3F,IAAa,QAAQ,WAAW,WAC9B,SAEA;CAAE,aAAa,iBAAiB;CAAS,UAAU,CAAC,sBAAsB,aAAa,gBAAgB,MAAM;AAAE,SACzG,OAAO,oBACf"}
@@ -1 +1 @@
1
- {"version":3,"file":"capabilities.mjs","names":[],"sources":["../../src/capabilities/index.ts"],"sourcesContent":["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as ActivationEvents from '@dxos/app-framework/ActivationEvents';\nimport * as Capability from '@dxos/app-framework/Capability';\nimport * as AppCapabilities from '@dxos/app-toolkit/AppCapabilities';\nimport * as AppCapability from '@dxos/app-toolkit/AppCapability';\n\nimport { StorybookCapabilities } from '#types';\n\nexport const OperationHandler = AppCapability.operationHandler(() => import('./operation-handler'));\nexport const ReactContext = AppCapability.reactContext(() => import('./react-context'));\nexport const State = Capability.lazyModule(\n 'State',\n // Shell state read by `Layout` on its first render — same class as the deck's `DeckState`.\n { activatesOn: ActivationEvents.Startup, provides: [StorybookCapabilities.LayoutState, AppCapabilities.Layout] },\n () => import('./state'),\n);\n"],"mappings":";;;;;;AAWA,IAAa,mBAAmB,cAAc,uBAAuB,OAAO,gCAAsB;AAClG,IAAa,eAAe,cAAc,mBAAmB,OAAO,4BAAkB;AACtF,IAAa,QAAQ,WAAW,WAC9B,SAEA;CAAE,aAAa,iBAAiB;CAAS,UAAU,CAAC,sBAAsB,aAAa,gBAAgB,MAAM;AAAE,SACzG,OAAO,oBACf"}
1
+ {"version":3,"file":"capabilities.mjs","names":[],"sources":["../../src/capabilities/index.ts"],"sourcesContent":["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as ActivationEvents from '@dxos/app-framework/ActivationEvents';\nimport * as Capability from '@dxos/app-framework/Capability';\nimport * as AppCapabilities from '@dxos/app-toolkit/AppCapabilities';\nimport * as AppCapability from '@dxos/app-toolkit/AppCapability';\n\nimport { StorybookCapabilities } from '#types';\n\nexport const OperationHandler = AppCapability.operationHandler(() => import('./operation-handler.ts'));\nexport const ReactContext = AppCapability.reactContext(() => import('./react-context.tsx'));\nexport const State = Capability.lazyModule(\n 'State',\n // Shell state read by `Layout` on its first render — same class as the deck's `DeckState`.\n { activatesOn: ActivationEvents.Startup, provides: [StorybookCapabilities.LayoutState, AppCapabilities.Layout] },\n () => import('./state.tsx'),\n);\n"],"mappings":";;;;;;AAWA,IAAa,mBAAmB,cAAc,uBAAuB,OAAO,gCAAyB;AACrG,IAAa,eAAe,cAAc,mBAAmB,OAAO,4BAAsB;AAC1F,IAAa,QAAQ,WAAW,WAC9B,SAEA;CAAE,aAAa,iBAAiB;CAAS,UAAU,CAAC,sBAAsB,aAAa,gBAAgB,MAAM;AAAE,SACzG,OAAO,oBACf"}
@@ -1 +1 @@
1
- {"version":3,"file":"capabilities.node.mjs","names":[],"sources":["../../src/capabilities/gen/node.ts"],"sourcesContent":["//\n// Copyright 2026 DXOS.org\n//\n\n// GENERATED by dx-plugin — do not edit. Sliced from ../index.ts for the 'node' condition.\n\nimport * as ActivationEvents from '@dxos/app-framework/ActivationEvents';\nimport * as Capability from '@dxos/app-framework/Capability';\nimport * as AppCapabilities from '@dxos/app-toolkit/AppCapabilities';\nimport * as AppCapability from '@dxos/app-toolkit/AppCapability';\n\nimport { StorybookCapabilities } from '#types';\n\nexport const OperationHandler = AppCapability.operationHandler(() => import('../operation-handler'));\n\nexport const State = Capability.lazyModule(\n 'State',\n // Shell state read by `Layout` on its first render — same class as the deck's `DeckState`.\n { activatesOn: ActivationEvents.Startup, provides: [StorybookCapabilities.LayoutState, AppCapabilities.Layout] },\n () => import('../state'),\n);\n\nexport const ReactContext = undefined;\n"],"mappings":";;;;;;AAaA,IAAa,mBAAmB,cAAc,uBAAuB,OAAO,gCAAuB;AAEnG,IAAa,QAAQ,WAAW,WAC9B,SAEA;CAAE,aAAa,iBAAiB;CAAS,UAAU,CAAC,sBAAsB,aAAa,gBAAgB,MAAM;AAAE,SACzG,OAAO,oBACf;AAEA,IAAa,eAAe,KAAA"}
1
+ {"version":3,"file":"capabilities.node.mjs","names":[],"sources":["../../src/capabilities/gen/node.ts"],"sourcesContent":["//\n// Copyright 2026 DXOS.org\n//\n\n// GENERATED by dx-plugin — do not edit. Sliced from ../index.ts for the 'node' condition.\n\nimport * as ActivationEvents from '@dxos/app-framework/ActivationEvents';\nimport * as Capability from '@dxos/app-framework/Capability';\nimport * as AppCapabilities from '@dxos/app-toolkit/AppCapabilities';\nimport * as AppCapability from '@dxos/app-toolkit/AppCapability';\n\nimport { StorybookCapabilities } from '#types';\n\nexport const OperationHandler = AppCapability.operationHandler(() => import('../operation-handler.ts'));\n\nexport const State = Capability.lazyModule(\n 'State',\n // Shell state read by `Layout` on its first render — same class as the deck's `DeckState`.\n { activatesOn: ActivationEvents.Startup, provides: [StorybookCapabilities.LayoutState, AppCapabilities.Layout] },\n () => import('../state.tsx'),\n);\n\nexport const ReactContext = undefined;\n"],"mappings":";;;;;;AAaA,IAAa,mBAAmB,cAAc,uBAAuB,OAAO,gCAA0B;AAEtG,IAAa,QAAQ,WAAW,WAC9B,SAEA;CAAE,aAAa,iBAAiB;CAAS,UAAU,CAAC,sBAAsB,aAAa,gBAAgB,MAAM;AAAE,SACzG,OAAO,oBACf;AAEA,IAAa,eAAe,KAAA"}
@@ -0,0 +1,16 @@
1
+ import * as ActivationEvents from "@dxos/app-framework/ActivationEvents";
2
+ import * as Capability from "@dxos/app-framework/Capability";
3
+ import * as AppCapabilities from "@dxos/app-toolkit/AppCapabilities";
4
+ import * as AppCapability from "@dxos/app-toolkit/AppCapability";
5
+ import { StorybookCapabilities } from "#types";
6
+ //#region src/capabilities/gen/tauri.ts
7
+ var OperationHandler = AppCapability.operationHandler(() => import("./chunk-operation-handler.mjs"));
8
+ var ReactContext = AppCapability.reactContext(() => import("./chunk-react-context.mjs"));
9
+ var State = Capability.lazyModule("State", {
10
+ activatesOn: ActivationEvents.Startup,
11
+ provides: [StorybookCapabilities.LayoutState, AppCapabilities.Layout]
12
+ }, () => import("./chunk-state.mjs"));
13
+ //#endregion
14
+ export { OperationHandler, ReactContext, State };
15
+
16
+ //# sourceMappingURL=capabilities.tauri.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"capabilities.tauri.mjs","names":[],"sources":["../../src/capabilities/gen/tauri.ts"],"sourcesContent":["//\n// Copyright 2026 DXOS.org\n//\n\n// GENERATED by dx-plugin — do not edit. Sliced from ../index.ts for the 'tauri' condition.\n\nimport * as ActivationEvents from '@dxos/app-framework/ActivationEvents';\nimport * as Capability from '@dxos/app-framework/Capability';\nimport * as AppCapabilities from '@dxos/app-toolkit/AppCapabilities';\nimport * as AppCapability from '@dxos/app-toolkit/AppCapability';\n\nimport { StorybookCapabilities } from '#types';\n\nexport const OperationHandler = AppCapability.operationHandler(() => import('../operation-handler.ts'));\n\nexport const ReactContext = AppCapability.reactContext(() => import('../react-context.tsx'));\n\nexport const State = Capability.lazyModule(\n 'State',\n // Shell state read by `Layout` on its first render — same class as the deck's `DeckState`.\n { activatesOn: ActivationEvents.Startup, provides: [StorybookCapabilities.LayoutState, AppCapabilities.Layout] },\n () => import('../state.tsx'),\n);\n"],"mappings":";;;;;;AAaA,IAAa,mBAAmB,cAAc,uBAAuB,OAAO,gCAA0B;AAEtG,IAAa,eAAe,cAAc,mBAAmB,OAAO,4BAAuB;AAE3F,IAAa,QAAQ,WAAW,WAC9B,SAEA;CAAE,aAAa,iBAAiB;CAAS,UAAU,CAAC,sBAAsB,aAAa,gBAAgB,MAAM;AAAE,SACzG,OAAO,oBACf"}
@@ -1 +1 @@
1
- {"version":3,"file":"capabilities.workerd.mjs","names":[],"sources":["../../src/capabilities/gen/workerd.ts"],"sourcesContent":["//\n// Copyright 2026 DXOS.org\n//\n\n// GENERATED by dx-plugin — do not edit. Sliced from ../index.ts for the 'workerd' condition.\n\nimport * as ActivationEvents from '@dxos/app-framework/ActivationEvents';\nimport * as Capability from '@dxos/app-framework/Capability';\nimport * as AppCapabilities from '@dxos/app-toolkit/AppCapabilities';\nimport * as AppCapability from '@dxos/app-toolkit/AppCapability';\n\nimport { StorybookCapabilities } from '#types';\n\nexport const OperationHandler = AppCapability.operationHandler(() => import('../operation-handler'));\n\nexport const State = Capability.lazyModule(\n 'State',\n // Shell state read by `Layout` on its first render — same class as the deck's `DeckState`.\n { activatesOn: ActivationEvents.Startup, provides: [StorybookCapabilities.LayoutState, AppCapabilities.Layout] },\n () => import('../state'),\n);\n\nexport const ReactContext = undefined;\n"],"mappings":";;;;;;AAaA,IAAa,mBAAmB,cAAc,uBAAuB,OAAO,gCAAuB;AAEnG,IAAa,QAAQ,WAAW,WAC9B,SAEA;CAAE,aAAa,iBAAiB;CAAS,UAAU,CAAC,sBAAsB,aAAa,gBAAgB,MAAM;AAAE,SACzG,OAAO,oBACf;AAEA,IAAa,eAAe,KAAA"}
1
+ {"version":3,"file":"capabilities.workerd.mjs","names":[],"sources":["../../src/capabilities/gen/workerd.ts"],"sourcesContent":["//\n// Copyright 2026 DXOS.org\n//\n\n// GENERATED by dx-plugin — do not edit. Sliced from ../index.ts for the 'workerd' condition.\n\nimport * as ActivationEvents from '@dxos/app-framework/ActivationEvents';\nimport * as Capability from '@dxos/app-framework/Capability';\nimport * as AppCapabilities from '@dxos/app-toolkit/AppCapabilities';\nimport * as AppCapability from '@dxos/app-toolkit/AppCapability';\n\nimport { StorybookCapabilities } from '#types';\n\nexport const OperationHandler = AppCapability.operationHandler(() => import('../operation-handler.ts'));\n\nexport const State = Capability.lazyModule(\n 'State',\n // Shell state read by `Layout` on its first render — same class as the deck's `DeckState`.\n { activatesOn: ActivationEvents.Startup, provides: [StorybookCapabilities.LayoutState, AppCapabilities.Layout] },\n () => import('../state.tsx'),\n);\n\nexport const ReactContext = undefined;\n"],"mappings":";;;;;;AAaA,IAAa,mBAAmB,cAAc,uBAAuB,OAAO,gCAA0B;AAEtG,IAAa,QAAQ,WAAW,WAC9B,SAEA;CAAE,aAAa,iBAAiB;CAAS,UAAU,CAAC,sBAAsB,aAAa,gBAAgB,MAAM;AAAE,SACzG,OAAO,oBACf;AAEA,IAAa,eAAe,KAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"chunk-add-toast.mjs","names":[],"sources":["../../src/operations/add-toast.ts"],"sourcesContent":["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\n\nimport * as LayoutOperation from '@dxos/app-toolkit/LayoutOperation';\nimport * as Operation from '@dxos/compute/Operation';\n\nimport { updateState } from './update-state';\n\nconst handler: Operation.WithHandler<typeof LayoutOperation.AddToast> = LayoutOperation.AddToast.pipe(\n Operation.withHandler(\n Effect.fnUntraced(function* (input) {\n yield* updateState((state) => ({\n toasts: [...state.toasts, input as LayoutOperation.Toast],\n }));\n }),\n ),\n);\n\nexport default handler;\n"],"mappings":";;;;;AAWA,IAAM,UAAkE,gBAAgB,SAAS,KAC/F,UAAU,YACR,OAAO,WAAW,WAAW,OAAO;CAClC,OAAO,aAAa,WAAW,EAC7B,QAAQ,CAAC,GAAG,MAAM,QAAQ,KAA8B,EAC1D,EAAE;AACJ,CAAC,CACH,CACF"}
1
+ {"version":3,"file":"chunk-add-toast.mjs","names":[],"sources":["../../src/operations/add-toast.ts"],"sourcesContent":["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\n\nimport * as LayoutOperation from '@dxos/app-toolkit/LayoutOperation';\nimport * as Operation from '@dxos/compute/Operation';\n\nimport { updateState } from './update-state.ts';\n\nconst handler: Operation.WithHandler<typeof LayoutOperation.AddToast> = LayoutOperation.AddToast.pipe(\n Operation.withHandler(\n Effect.fnUntraced(function* (input) {\n yield* updateState((state) => ({\n toasts: [...state.toasts, input as LayoutOperation.Toast],\n }));\n }),\n ),\n);\n\nexport default handler;\n"],"mappings":";;;;;AAWA,IAAM,UAAkE,gBAAgB,SAAS,KAC/F,UAAU,YACR,OAAO,WAAW,WAAW,OAAO;CAClC,OAAO,aAAa,WAAW,EAC7B,QAAQ,CAAC,GAAG,MAAM,QAAQ,KAA8B,EAC1D,EAAE;AACJ,CAAC,CACH,CACF"}
@@ -2,7 +2,7 @@ import * as Capability from "@dxos/app-framework/Capability";
2
2
  import * as AppCapabilities from "@dxos/app-toolkit/AppCapabilities";
3
3
  import { StorybookCapabilities } from "#types";
4
4
  import * as Effect from "effect/Effect";
5
- import * as Atom from "effect/unstable/reactivity/Atom";
5
+ import * as Atom from "effect/reactivity/Atom";
6
6
  //#region src/capabilities/state.tsx
7
7
  var defaultState = {
8
8
  sidebarState: "closed",
@@ -1 +1 @@
1
- {"version":3,"file":"chunk-state.mjs","names":[],"sources":["../../src/capabilities/state.tsx"],"sourcesContent":["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\nimport * as Atom from 'effect/unstable/reactivity/Atom';\n\nimport * as Capability from '@dxos/app-framework/Capability';\nimport * as AppCapabilities from '@dxos/app-toolkit/AppCapabilities';\n\nimport { StorybookCapabilities } from '#types';\n\nconst defaultState: StorybookCapabilities.LayoutStateProps = {\n sidebarState: 'closed',\n complementarySidebarState: 'closed',\n dialogOpen: false,\n toasts: [],\n workspace: 'default',\n};\n\nexport default Capability.makeModule(\n Effect.fnUntraced(function* (props?: { initialState?: Partial<StorybookCapabilities.LayoutStateProps> }) {\n const { initialState } = props ?? {};\n const stateAtom = Atom.make<StorybookCapabilities.LayoutStateProps>({ ...defaultState, ...initialState });\n\n const layoutAtom = Atom.make((get): AppCapabilities.Layout => {\n const state = get(stateAtom);\n return {\n mode: 'storybook',\n dialogOpen: state.dialogOpen,\n sidebarOpen: state.sidebarState === 'expanded',\n complementarySidebarOpen: state.complementarySidebarState === 'expanded',\n workspace: state.workspace,\n active: [],\n inactive: [],\n scrollIntoView: undefined,\n };\n });\n\n return [\n Capability.contribute(StorybookCapabilities.LayoutState, stateAtom),\n Capability.contribute(AppCapabilities.Layout, layoutAtom),\n ];\n }),\n);\n"],"mappings":";;;;;;AAYA,IAAM,eAAuD;CAC3D,cAAc;CACd,2BAA2B;CAC3B,YAAY;CACZ,QAAQ,CAAC;CACT,WAAW;AACb;AAEA,IAAA,gBAAe,WAAW,WACxB,OAAO,WAAW,WAAW,OAA4E;CACvG,MAAM,EAAE,iBAAiB,SAAS,CAAC;CACnC,MAAM,YAAY,KAAK,KAA6C;EAAE,GAAG;EAAc,GAAG;CAAa,CAAC;CAExG,MAAM,aAAa,KAAK,MAAM,QAAgC;EAC5D,MAAM,QAAQ,IAAI,SAAS;EAC3B,OAAO;GACL,MAAM;GACN,YAAY,MAAM;GAClB,aAAa,MAAM,iBAAiB;GACpC,0BAA0B,MAAM,8BAA8B;GAC9D,WAAW,MAAM;GACjB,QAAQ,CAAC;GACT,UAAU,CAAC;GACX,gBAAgB,KAAA;EAClB;CACF,CAAC;CAED,OAAO,CACL,WAAW,WAAW,sBAAsB,aAAa,SAAS,GAClE,WAAW,WAAW,gBAAgB,QAAQ,UAAU,CAC1D;AACF,CAAC,CACH"}
1
+ {"version":3,"file":"chunk-state.mjs","names":[],"sources":["../../src/capabilities/state.tsx"],"sourcesContent":["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\nimport * as Atom from 'effect/reactivity/Atom';\n\nimport * as Capability from '@dxos/app-framework/Capability';\nimport * as AppCapabilities from '@dxos/app-toolkit/AppCapabilities';\n\nimport { StorybookCapabilities } from '#types';\n\nconst defaultState: StorybookCapabilities.LayoutStateProps = {\n sidebarState: 'closed',\n complementarySidebarState: 'closed',\n dialogOpen: false,\n toasts: [],\n workspace: 'default',\n};\n\nexport default Capability.makeModule(\n Effect.fnUntraced(function* (props?: { initialState?: Partial<StorybookCapabilities.LayoutStateProps> }) {\n const { initialState } = props ?? {};\n const stateAtom = Atom.make<StorybookCapabilities.LayoutStateProps>({ ...defaultState, ...initialState });\n\n const layoutAtom = Atom.make((get): AppCapabilities.Layout => {\n const state = get(stateAtom);\n return {\n mode: 'storybook',\n dialogOpen: state.dialogOpen,\n sidebarOpen: state.sidebarState === 'expanded',\n complementarySidebarOpen: state.complementarySidebarState === 'expanded',\n workspace: state.workspace,\n active: [],\n inactive: [],\n scrollIntoView: undefined,\n };\n });\n\n return [\n Capability.contribute(StorybookCapabilities.LayoutState, stateAtom),\n Capability.contribute(AppCapabilities.Layout, layoutAtom),\n ];\n }),\n);\n"],"mappings":";;;;;;AAYA,IAAM,eAAuD;CAC3D,cAAc;CACd,2BAA2B;CAC3B,YAAY;CACZ,QAAQ,CAAC;CACT,WAAW;AACb;AAEA,IAAA,gBAAe,WAAW,WACxB,OAAO,WAAW,WAAW,OAA4E;CACvG,MAAM,EAAE,iBAAiB,SAAS,CAAC;CACnC,MAAM,YAAY,KAAK,KAA6C;EAAE,GAAG;EAAc,GAAG;CAAa,CAAC;CAExG,MAAM,aAAa,KAAK,MAAM,QAAgC;EAC5D,MAAM,QAAQ,IAAI,SAAS;EAC3B,OAAO;GACL,MAAM;GACN,YAAY,MAAM;GAClB,aAAa,MAAM,iBAAiB;GACpC,0BAA0B,MAAM,8BAA8B;GAC9D,WAAW,MAAM;GACjB,QAAQ,CAAC;GACT,UAAU,CAAC;GACX,gBAAgB,KAAA;EAClB;CACF,CAAC;CAED,OAAO,CACL,WAAW,WAAW,sBAAsB,aAAa,SAAS,GAClE,WAAW,WAAW,gBAAgB,QAAQ,UAAU,CAC1D;AACF,CAAC,CACH"}
@@ -1 +1 @@
1
- {"version":3,"file":"chunk-switch-workspace.mjs","names":[],"sources":["../../src/operations/switch-workspace.ts"],"sourcesContent":["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\n\nimport * as LayoutOperation from '@dxos/app-toolkit/LayoutOperation';\nimport * as Operation from '@dxos/compute/Operation';\n\nimport { updateState } from './update-state';\n\nconst handler: Operation.WithHandler<typeof LayoutOperation.SwitchWorkspace> = LayoutOperation.SwitchWorkspace.pipe(\n Operation.withHandler(\n Effect.fnUntraced(function* ({ subject }) {\n yield* updateState(() => ({ workspace: subject }));\n }),\n ),\n);\n\nexport default handler;\n"],"mappings":";;;;;AAWA,IAAM,UAAyE,gBAAgB,gBAAgB,KAC7G,UAAU,YACR,OAAO,WAAW,WAAW,EAAE,WAAW;CACxC,OAAO,mBAAmB,EAAE,WAAW,QAAQ,EAAE;AACnD,CAAC,CACH,CACF"}
1
+ {"version":3,"file":"chunk-switch-workspace.mjs","names":[],"sources":["../../src/operations/switch-workspace.ts"],"sourcesContent":["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\n\nimport * as LayoutOperation from '@dxos/app-toolkit/LayoutOperation';\nimport * as Operation from '@dxos/compute/Operation';\n\nimport { updateState } from './update-state.ts';\n\nconst handler: Operation.WithHandler<typeof LayoutOperation.SwitchWorkspace> = LayoutOperation.SwitchWorkspace.pipe(\n Operation.withHandler(\n Effect.fnUntraced(function* ({ subject }) {\n yield* updateState(() => ({ workspace: subject }));\n }),\n ),\n);\n\nexport default handler;\n"],"mappings":";;;;;AAWA,IAAM,UAAyE,gBAAgB,gBAAgB,KAC7G,UAAU,YACR,OAAO,WAAW,WAAW,EAAE,WAAW;CACxC,OAAO,mBAAmB,EAAE,WAAW,QAAQ,EAAE;AACnD,CAAC,CACH,CACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"chunk-update-complementary.mjs","names":[],"sources":["../../src/operations/update-complementary.ts"],"sourcesContent":["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\n\nimport * as LayoutOperation from '@dxos/app-toolkit/LayoutOperation';\nimport * as Operation from '@dxos/compute/Operation';\n\nimport { updateState } from './update-state';\n\nconst handler: Operation.WithHandler<typeof LayoutOperation.UpdateComplementary> =\n LayoutOperation.UpdateComplementary.pipe(\n Operation.withHandler(\n Effect.fnUntraced(function* ({ state }) {\n yield* updateState((layout) => {\n const next = state ?? layout.complementarySidebarState;\n if (next !== layout.complementarySidebarState) {\n return { complementarySidebarState: next };\n }\n return {};\n });\n }),\n ),\n );\n\nexport default handler;\n"],"mappings":";;;;;AAWA,IAAM,UACJ,gBAAgB,oBAAoB,KAClC,UAAU,YACR,OAAO,WAAW,WAAW,EAAE,SAAS;CACtC,OAAO,aAAa,WAAW;EAC7B,MAAM,OAAO,SAAS,OAAO;EAC7B,IAAI,SAAS,OAAO,2BAClB,OAAO,EAAE,2BAA2B,KAAK;EAE3C,OAAO,CAAC;CACV,CAAC;AACH,CAAC,CACH,CACF"}
1
+ {"version":3,"file":"chunk-update-complementary.mjs","names":[],"sources":["../../src/operations/update-complementary.ts"],"sourcesContent":["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\n\nimport * as LayoutOperation from '@dxos/app-toolkit/LayoutOperation';\nimport * as Operation from '@dxos/compute/Operation';\n\nimport { updateState } from './update-state.ts';\n\nconst handler: Operation.WithHandler<typeof LayoutOperation.UpdateComplementary> =\n LayoutOperation.UpdateComplementary.pipe(\n Operation.withHandler(\n Effect.fnUntraced(function* ({ state }) {\n yield* updateState((layout) => {\n const next = state ?? layout.complementarySidebarState;\n if (next !== layout.complementarySidebarState) {\n return { complementarySidebarState: next };\n }\n return {};\n });\n }),\n ),\n );\n\nexport default handler;\n"],"mappings":";;;;;AAWA,IAAM,UACJ,gBAAgB,oBAAoB,KAClC,UAAU,YACR,OAAO,WAAW,WAAW,EAAE,SAAS;CACtC,OAAO,aAAa,WAAW;EAC7B,MAAM,OAAO,SAAS,OAAO;EAC7B,IAAI,SAAS,OAAO,2BAClB,OAAO,EAAE,2BAA2B,KAAK;EAE3C,OAAO,CAAC;CACV,CAAC;AACH,CAAC,CACH,CACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"chunk-update-dialog.mjs","names":[],"sources":["../../src/operations/update-dialog.ts"],"sourcesContent":["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\n\nimport * as LayoutOperation from '@dxos/app-toolkit/LayoutOperation';\nimport * as Operation from '@dxos/compute/Operation';\n\nimport { updateState } from './update-state';\n\nconst handler: Operation.WithHandler<typeof LayoutOperation.UpdateDialog> = LayoutOperation.UpdateDialog.pipe(\n Operation.withHandler(\n Effect.fnUntraced(function* ({ subject, state, type, blockAlign, overlayClasses, overlayStyle, props }) {\n yield* updateState(() => ({\n dialogOpen: state ?? Boolean(subject),\n dialogType: type ?? 'default',\n dialogBlockAlign: blockAlign ?? 'center',\n dialogOverlayClasses: overlayClasses,\n dialogOverlayStyle: overlayStyle,\n dialogContent: subject ? { component: subject, props } : null,\n }));\n }),\n ),\n);\n\nexport default handler;\n"],"mappings":";;;;;AAWA,IAAM,UAAsE,gBAAgB,aAAa,KACvG,UAAU,YACR,OAAO,WAAW,WAAW,EAAE,SAAS,OAAO,MAAM,YAAY,gBAAgB,cAAc,SAAS;CACtG,OAAO,mBAAmB;EACxB,YAAY,SAAS,QAAQ,OAAO;EACpC,YAAY,QAAQ;EACpB,kBAAkB,cAAc;EAChC,sBAAsB;EACtB,oBAAoB;EACpB,eAAe,UAAU;GAAE,WAAW;GAAS;EAAM,IAAI;CAC3D,EAAE;AACJ,CAAC,CACH,CACF"}
1
+ {"version":3,"file":"chunk-update-dialog.mjs","names":[],"sources":["../../src/operations/update-dialog.ts"],"sourcesContent":["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\n\nimport * as LayoutOperation from '@dxos/app-toolkit/LayoutOperation';\nimport * as Operation from '@dxos/compute/Operation';\n\nimport { updateState } from './update-state.ts';\n\nconst handler: Operation.WithHandler<typeof LayoutOperation.UpdateDialog> = LayoutOperation.UpdateDialog.pipe(\n Operation.withHandler(\n Effect.fnUntraced(function* ({ subject, state, type, blockAlign, overlayClasses, overlayStyle, props }) {\n yield* updateState(() => ({\n dialogOpen: state ?? Boolean(subject),\n dialogType: type ?? 'default',\n dialogBlockAlign: blockAlign ?? 'center',\n dialogOverlayClasses: overlayClasses,\n dialogOverlayStyle: overlayStyle,\n dialogContent: subject ? { component: subject, props } : null,\n }));\n }),\n ),\n);\n\nexport default handler;\n"],"mappings":";;;;;AAWA,IAAM,UAAsE,gBAAgB,aAAa,KACvG,UAAU,YACR,OAAO,WAAW,WAAW,EAAE,SAAS,OAAO,MAAM,YAAY,gBAAgB,cAAc,SAAS;CACtG,OAAO,mBAAmB;EACxB,YAAY,SAAS,QAAQ,OAAO;EACpC,YAAY,QAAQ;EACpB,kBAAkB,cAAc;EAChC,sBAAsB;EACtB,oBAAoB;EACpB,eAAe,UAAU;GAAE,WAAW;GAAS;EAAM,IAAI;CAC3D,EAAE;AACJ,CAAC,CACH,CACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"chunk-update-popover.mjs","names":[],"sources":["../../src/operations/update-popover.ts"],"sourcesContent":["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\n\nimport * as LayoutOperation from '@dxos/app-toolkit/LayoutOperation';\nimport * as Operation from '@dxos/compute/Operation';\n\nimport { StorybookCapabilities } from '#types';\n\nimport { updateState } from './update-state';\n\nconst handler: Operation.WithHandler<typeof LayoutOperation.UpdatePopover> = LayoutOperation.UpdatePopover.pipe(\n Operation.withHandler(\n Effect.fnUntraced(function* (input) {\n const { subject, state, side, kind, props } = input;\n yield* updateState(() => {\n const base: Partial<StorybookCapabilities.LayoutStateProps> = {\n popoverKind: kind ?? 'base',\n popoverTitle: kind === 'card' ? input.title : undefined,\n popoverContent:\n typeof subject === 'string' ? { component: subject, props } : subject ? { subject } : undefined,\n popoverOpen: state ?? Boolean(subject),\n popoverSide: side,\n };\n if ('variant' in input && input.variant === 'virtual') {\n return { ...base, popoverVariant: 'virtual', popoverAnchor: input.anchor };\n } else if ('anchorId' in input) {\n return { ...base, popoverVariant: 'react', popoverAnchorId: input.anchorId };\n }\n return base;\n });\n }),\n ),\n);\n\nexport default handler;\n"],"mappings":";;;;;AAaA,IAAM,UAAuE,gBAAgB,cAAc,KACzG,UAAU,YACR,OAAO,WAAW,WAAW,OAAO;CAClC,MAAM,EAAE,SAAS,OAAO,MAAM,MAAM,UAAU;CAC9C,OAAO,kBAAkB;EACvB,MAAM,OAAwD;GAC5D,aAAa,QAAQ;GACrB,cAAc,SAAS,SAAS,MAAM,QAAQ,KAAA;GAC9C,gBACE,OAAO,YAAY,WAAW;IAAE,WAAW;IAAS;GAAM,IAAI,UAAU,EAAE,QAAQ,IAAI,KAAA;GACxF,aAAa,SAAS,QAAQ,OAAO;GACrC,aAAa;EACf;EACA,IAAI,aAAa,SAAS,MAAM,YAAY,WAC1C,OAAO;GAAE,GAAG;GAAM,gBAAgB;GAAW,eAAe,MAAM;EAAO;OACpE,IAAI,cAAc,OACvB,OAAO;GAAE,GAAG;GAAM,gBAAgB;GAAS,iBAAiB,MAAM;EAAS;EAE7E,OAAO;CACT,CAAC;AACH,CAAC,CACH,CACF"}
1
+ {"version":3,"file":"chunk-update-popover.mjs","names":[],"sources":["../../src/operations/update-popover.ts"],"sourcesContent":["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\n\nimport * as LayoutOperation from '@dxos/app-toolkit/LayoutOperation';\nimport * as Operation from '@dxos/compute/Operation';\n\nimport { StorybookCapabilities } from '#types';\n\nimport { updateState } from './update-state.ts';\n\nconst handler: Operation.WithHandler<typeof LayoutOperation.UpdatePopover> = LayoutOperation.UpdatePopover.pipe(\n Operation.withHandler(\n Effect.fnUntraced(function* (input) {\n const { subject, state, side, kind, props } = input;\n yield* updateState(() => {\n const base: Partial<StorybookCapabilities.LayoutStateProps> = {\n popoverKind: kind ?? 'base',\n popoverTitle: kind === 'card' ? input.title : undefined,\n popoverContent:\n typeof subject === 'string' ? { component: subject, props } : subject ? { subject } : undefined,\n popoverOpen: state ?? Boolean(subject),\n popoverSide: side,\n };\n if ('variant' in input && input.variant === 'virtual') {\n return { ...base, popoverVariant: 'virtual', popoverAnchor: input.anchor };\n } else if ('anchorId' in input) {\n return { ...base, popoverVariant: 'react', popoverAnchorId: input.anchorId };\n }\n return base;\n });\n }),\n ),\n);\n\nexport default handler;\n"],"mappings":";;;;;AAaA,IAAM,UAAuE,gBAAgB,cAAc,KACzG,UAAU,YACR,OAAO,WAAW,WAAW,OAAO;CAClC,MAAM,EAAE,SAAS,OAAO,MAAM,MAAM,UAAU;CAC9C,OAAO,kBAAkB;EACvB,MAAM,OAAwD;GAC5D,aAAa,QAAQ;GACrB,cAAc,SAAS,SAAS,MAAM,QAAQ,KAAA;GAC9C,gBACE,OAAO,YAAY,WAAW;IAAE,WAAW;IAAS;GAAM,IAAI,UAAU,EAAE,QAAQ,IAAI,KAAA;GACxF,aAAa,SAAS,QAAQ,OAAO;GACrC,aAAa;EACf;EACA,IAAI,aAAa,SAAS,MAAM,YAAY,WAC1C,OAAO;GAAE,GAAG;GAAM,gBAAgB;GAAW,eAAe,MAAM;EAAO;OACpE,IAAI,cAAc,OACvB,OAAO;GAAE,GAAG;GAAM,gBAAgB;GAAS,iBAAiB,MAAM;EAAS;EAE7E,OAAO;CACT,CAAC;AACH,CAAC,CACH,CACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"chunk-update-sidebar.mjs","names":[],"sources":["../../src/operations/update-sidebar.ts"],"sourcesContent":["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\n\nimport * as LayoutOperation from '@dxos/app-toolkit/LayoutOperation';\nimport * as Operation from '@dxos/compute/Operation';\n\nimport { updateState } from './update-state';\n\nconst handler: Operation.WithHandler<typeof LayoutOperation.UpdateSidebar> = LayoutOperation.UpdateSidebar.pipe(\n Operation.withHandler(\n Effect.fnUntraced(function* ({ state }) {\n yield* updateState((layout) => {\n const next = state ?? layout.sidebarState;\n if (next !== layout.sidebarState) {\n return { sidebarState: next };\n }\n return {};\n });\n }),\n ),\n);\n\nexport default handler;\n"],"mappings":";;;;;AAWA,IAAM,UAAuE,gBAAgB,cAAc,KACzG,UAAU,YACR,OAAO,WAAW,WAAW,EAAE,SAAS;CACtC,OAAO,aAAa,WAAW;EAC7B,MAAM,OAAO,SAAS,OAAO;EAC7B,IAAI,SAAS,OAAO,cAClB,OAAO,EAAE,cAAc,KAAK;EAE9B,OAAO,CAAC;CACV,CAAC;AACH,CAAC,CACH,CACF"}
1
+ {"version":3,"file":"chunk-update-sidebar.mjs","names":[],"sources":["../../src/operations/update-sidebar.ts"],"sourcesContent":["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\n\nimport * as LayoutOperation from '@dxos/app-toolkit/LayoutOperation';\nimport * as Operation from '@dxos/compute/Operation';\n\nimport { updateState } from './update-state.ts';\n\nconst handler: Operation.WithHandler<typeof LayoutOperation.UpdateSidebar> = LayoutOperation.UpdateSidebar.pipe(\n Operation.withHandler(\n Effect.fnUntraced(function* ({ state }) {\n yield* updateState((layout) => {\n const next = state ?? layout.sidebarState;\n if (next !== layout.sidebarState) {\n return { sidebarState: next };\n }\n return {};\n });\n }),\n ),\n);\n\nexport default handler;\n"],"mappings":";;;;;AAWA,IAAM,UAAuE,gBAAgB,cAAc,KACzG,UAAU,YACR,OAAO,WAAW,WAAW,EAAE,SAAS;CACtC,OAAO,aAAa,WAAW;EAC7B,MAAM,OAAO,SAAS,OAAO;EAC7B,IAAI,SAAS,OAAO,cAClB,OAAO,EAAE,cAAc,KAAK;EAE9B,OAAO,CAAC;CACV,CAAC;AACH,CAAC,CACH,CACF"}
@@ -1,18 +1,28 @@
1
1
  import { StorybookCapabilities } from "#types";
2
+ import * as Theme from "@dxos/react-ui/Theme";
2
3
  import { meta } from "#meta";
3
- import { AlertDialog, Button, Card, Dialog, Main, Popover, Toast, toLocalizedString, useTranslation } from "@dxos/react-ui";
4
4
  import { useAtomValue } from "@effect/atom-react/Hooks";
5
5
  import { RegistryContext } from "@effect/atom-react/RegistryContext";
6
6
  import { useCallback, useContext, useEffect, useRef, useState } from "react";
7
- import { Surface, useCapability } from "@dxos/app-framework/ui";
8
- import { AppSurface } from "@dxos/app-toolkit/ui";
7
+ import * as Hooks from "@dxos/app-framework/Hooks";
8
+ import * as Surface from "@dxos/app-framework/Surface";
9
+ import * as AppSurface from "@dxos/app-toolkit/AppSurface";
9
10
  import { Dnd } from "@dxos/react-ui-dnd";
11
+ import * as AlertDialog from "@dxos/react-ui/AlertDialog";
12
+ import * as Card from "@dxos/react-ui/Card";
13
+ import * as Dialog from "@dxos/react-ui/Dialog";
14
+ import * as DragHandle from "@dxos/react-ui/DragHandle";
15
+ import * as UiHooks from "@dxos/react-ui/Hooks";
16
+ import * as Main from "@dxos/react-ui/Main";
17
+ import * as Popover from "@dxos/react-ui/Popover";
18
+ import * as Toast from "@dxos/react-ui/Toast";
19
+ import * as VirtualAnchor from "@dxos/react-ui/VirtualAnchor";
10
20
  import { descriptionMessage, mx } from "@dxos/ui-theme";
11
21
  import { jsx, jsxs } from "react/jsx-runtime";
12
22
  //#region src/components/Layout/Layout.tsx
13
23
  var debounce_delay = 100;
14
24
  var StoryToast = ({ toast, onDismiss }) => {
15
- const { t } = useTranslation(meta.profile.key);
25
+ const { t } = UiHooks.useTranslation(meta.profile.key);
16
26
  return /* @__PURE__ */ jsxs(Toast.Root, {
17
27
  "data-testid": toast.id,
18
28
  defaultOpen: true,
@@ -21,29 +31,25 @@ var StoryToast = ({ toast, onDismiss }) => {
21
31
  if (!open) onDismiss(toast.id);
22
32
  },
23
33
  children: [
24
- /* @__PURE__ */ jsx(Toast.Title, {
34
+ /* @__PURE__ */ jsx(Toast.Header, {
25
35
  icon: toast.icon,
26
- onClose: toast.closeLabel ? () => onDismiss(toast.id) : void 0,
27
- children: toast.title && /* @__PURE__ */ jsx("span", { children: toLocalizedString(toast.title, t) })
36
+ closable: !!toast.closeLabel,
37
+ children: toast.title && Theme.toLocalizedString(toast.title, t)
28
38
  }),
29
- toast.description && /* @__PURE__ */ jsx(Toast.Description, { children: toLocalizedString(toast.description, t) }),
30
- toast.onAction && toast.actionAlt && toast.actionLabel && /* @__PURE__ */ jsx(Toast.Actions, { children: /* @__PURE__ */ jsx(Toast.Action, {
31
- altText: toLocalizedString(toast.actionAlt, t),
32
- asChild: true,
33
- children: /* @__PURE__ */ jsx(Button, {
34
- variant: "primary",
35
- onClick: () => toast.onAction?.(),
36
- children: toLocalizedString(toast.actionLabel, t)
37
- })
39
+ toast.description && /* @__PURE__ */ jsx(Toast.Description, { children: Theme.toLocalizedString(toast.description, t) }),
40
+ toast.onAction && toast.actionAlt && toast.actionLabel && /* @__PURE__ */ jsx(Toast.Footer, { children: /* @__PURE__ */ jsx(Toast.ActionTrigger, {
41
+ variant: "primary",
42
+ onClick: () => toast.onAction?.(),
43
+ children: Theme.toLocalizedString(toast.actionLabel, t)
38
44
  }) })
39
45
  ]
40
46
  });
41
47
  };
42
48
  var Layout = ({ children }) => {
43
- const { t } = useTranslation(meta.profile.key);
49
+ const { t } = UiHooks.useTranslation(meta.profile.key);
44
50
  const trigger = useRef(null);
45
51
  const registry = useContext(RegistryContext);
46
- const stateAtom = useCapability(StorybookCapabilities.LayoutState);
52
+ const stateAtom = Hooks.useCapability(StorybookCapabilities.LayoutState);
47
53
  const layout = useAtomValue(stateAtom);
48
54
  const [iter, setIter] = useState(0);
49
55
  const [open, setOpen] = useState(false);
@@ -78,20 +84,29 @@ var Layout = ({ children }) => {
78
84
  popoverSide: void 0
79
85
  });
80
86
  }, [updateState]);
81
- const handleInteractOutside = useCallback((event) => {
82
- if (event.type === "dismissableLayer.focusOutside" && event.currentTarget?.classList.contains("cm-content")) event.preventDefault();
87
+ const handleFocusOutside = useCallback((event) => {
88
+ const target = event.detail.originalEvent.target;
89
+ if (target instanceof HTMLElement && target.classList.contains("cm-content")) event.preventDefault();
83
90
  else handleClose();
84
91
  }, [handleClose]);
85
92
  const handleDismissToast = useCallback((id) => {
86
93
  updateState({ toasts: layout.toasts.filter((toast) => toast.id !== id) });
87
94
  }, [updateState, layout.toasts]);
88
95
  const DialogRoot = layout.dialogType === "alert" ? AlertDialog.Root : Dialog.Root;
89
- const DialogOverlay = layout.dialogType === "alert" ? AlertDialog.Overlay : Dialog.Overlay;
90
96
  return /* @__PURE__ */ jsx(Toast.Provider, { children: /* @__PURE__ */ jsxs("div", {
91
97
  className: "fixed inset-0 flex overflow-hidden",
92
98
  children: [
93
99
  /* @__PURE__ */ jsx(Dnd.Root, { children: /* @__PURE__ */ jsxs(Popover.Root, {
94
100
  open,
101
+ positioning: {
102
+ ...VirtualAnchor.virtualAnchor(trigger),
103
+ placement: layout.popoverSide,
104
+ hideWhenDetached: true
105
+ },
106
+ autoFocus: false,
107
+ onFocusOutside: handleFocusOutside,
108
+ onPointerDownOutside: handleClose,
109
+ onEscapeKeyDown: handleClose,
95
110
  children: [
96
111
  /* @__PURE__ */ jsx(Main.Root, {
97
112
  navigationSidebarState: layout.sidebarState,
@@ -103,62 +118,54 @@ var Layout = ({ children }) => {
103
118
  /* @__PURE__ */ jsx(DialogRoot, {
104
119
  modal: layout.dialogBlockAlign !== "end",
105
120
  open: layout.dialogOpen,
106
- onOpenChange: (nextOpen) => updateState({ dialogOpen: nextOpen }),
107
- children: layout.dialogBlockAlign === "end" ? /* @__PURE__ */ jsx(Surface.Surface, {
121
+ onOpenChange: ({ open: nextOpen }) => updateState({ dialogOpen: nextOpen }),
122
+ children: /* @__PURE__ */ jsx(Surface.Surface, {
108
123
  type: AppSurface.Dialog,
109
124
  data: layout.dialogContent,
110
125
  limit: 1,
111
126
  fallback: ErrorFallback,
112
127
  placeholder: /* @__PURE__ */ jsx("div", {})
113
- }) : /* @__PURE__ */ jsx(DialogOverlay, {
114
- blockAlign: layout.dialogBlockAlign,
115
- classNames: layout.dialogOverlayClasses,
116
- style: layout.dialogOverlayStyle,
117
- children: /* @__PURE__ */ jsx(Surface.Surface, {
118
- type: AppSurface.Dialog,
119
- data: layout.dialogContent,
120
- limit: 1,
121
- fallback: ErrorFallback
122
- })
123
128
  })
124
129
  }),
125
- /* @__PURE__ */ jsx(Popover.VirtualTrigger, { virtualRef: trigger }, iter),
126
- /* @__PURE__ */ jsx(Popover.Portal, { children: /* @__PURE__ */ jsxs(Popover.Content, {
127
- side: layout.popoverSide,
128
- onOpenAutoFocus: (event) => event.preventDefault(),
129
- onInteractOutside: handleInteractOutside,
130
- onEscapeKeyDown: handleInteractOutside,
131
- sticky: "always",
132
- hideWhenDetached: true,
133
- children: [/* @__PURE__ */ jsxs(Popover.Viewport, { children: [layout.popoverKind === "card" && /* @__PURE__ */ jsxs(Card.Root, { children: [/* @__PURE__ */ jsxs(Card.Header, { children: [
134
- /* @__PURE__ */ jsx(Card.DragHandle, {}),
135
- layout.popoverTitle ? /* @__PURE__ */ jsx(Card.Title, { children: toLocalizedString(layout.popoverTitle, t) }) : /* @__PURE__ */ jsx("span", {}),
136
- /* @__PURE__ */ jsx(Card.ActionIconButton, {
137
- action: "close",
130
+ /* @__PURE__ */ jsx(Popover.Content, { children: /* @__PURE__ */ jsxs(Popover.Body, { children: [layout.popoverKind === "card" && /* @__PURE__ */ jsxs(Card.Root, {
131
+ grid: true,
132
+ border: false,
133
+ classNames: "dx-card-popover rounded-md",
134
+ children: [/* @__PURE__ */ jsxs(Card.Header, { children: [
135
+ /* @__PURE__ */ jsx(DragHandle.DragHandle, {}),
136
+ layout.popoverTitle ? /* @__PURE__ */ jsx(Card.Title, { children: Theme.toLocalizedString(layout.popoverTitle, t) }) : /* @__PURE__ */ jsx("span", {}),
137
+ /* @__PURE__ */ jsx(Card.Action, {
138
+ system: "close",
138
139
  onClick: handleClose
139
140
  })
140
- ] }), /* @__PURE__ */ jsx(Surface.Surface, {
141
+ ] }), layout.popoverContent ? /* @__PURE__ */ jsx(Surface.Surface, {
141
142
  type: AppSurface.CardContent,
142
143
  data: layout.popoverContent,
143
144
  limit: 1
144
- })] }), (layout.popoverKind === "base" || layout.popoverKind === "rename") && /* @__PURE__ */ jsx(Surface.Surface, {
145
- type: AppSurface.Popover,
146
- data: layout.popoverContent,
147
- limit: 1
148
- })] }), /* @__PURE__ */ jsx(Popover.Arrow, {})]
149
- }) })
145
+ }) : /* @__PURE__ */ jsx(Card.Body, {
146
+ classNames: "min-h-8",
147
+ children: /* @__PURE__ */ jsx(Card.Row, { children: /* @__PURE__ */ jsx(Card.Text, {
148
+ variant: "muted",
149
+ children: "No preview available."
150
+ }) })
151
+ })]
152
+ }), (layout.popoverKind === "base" || layout.popoverKind === "rename") && /* @__PURE__ */ jsx(Surface.Surface, {
153
+ type: AppSurface.Popover,
154
+ data: layout.popoverContent,
155
+ limit: 1
156
+ })] }) })
150
157
  ]
151
158
  }) }),
152
159
  layout.toasts.map((toast) => /* @__PURE__ */ jsx(StoryToast, {
153
160
  toast,
154
161
  onDismiss: handleDismissToast
155
162
  }, toast.id)),
156
- /* @__PURE__ */ jsx(Toast.Viewport, {})
163
+ /* @__PURE__ */ jsx(Toast.Toaster, {})
157
164
  ]
158
165
  }) });
159
166
  };
160
167
  var ErrorFallback = ({ error }) => {
161
- const { t } = useTranslation(meta.profile.key);
168
+ const { t } = UiHooks.useTranslation(meta.profile.key);
162
169
  const errorString = error?.toString() ?? "";
163
170
  return /* @__PURE__ */ jsx("div", {
164
171
  role: "alert",
@@ -1 +1 @@
1
- {"version":3,"file":"components.mjs","names":[],"sources":["../../src/components/Layout/Layout.tsx"],"sourcesContent":["//\n// Copyright 2023 DXOS.org\n//\n\nimport { useAtomValue } from '@effect/atom-react/Hooks';\nimport { RegistryContext } from '@effect/atom-react/RegistryContext';\nimport React, { type PropsWithChildren, useCallback, useContext, useEffect, useRef, useState } from 'react';\n\nimport { Surface, useCapability } from '@dxos/app-framework/ui';\nimport type * as LayoutOperation from '@dxos/app-toolkit/LayoutOperation';\nimport { AppSurface } from '@dxos/app-toolkit/ui';\nimport {\n AlertDialog,\n Button,\n Dialog,\n Main,\n Popover,\n type PopoverContentInteractOutsideEvent,\n Toast,\n toLocalizedString,\n useTranslation,\n} from '@dxos/react-ui';\nimport { Card } from '@dxos/react-ui';\nimport { Dnd } from '@dxos/react-ui-dnd';\nimport { descriptionMessage, mx } from '@dxos/ui-theme';\n\nimport { meta } from '#meta';\nimport { StorybookCapabilities } from '#types';\n\nconst debounce_delay = 100;\n\nconst StoryToast = ({ toast, onDismiss }: { toast: LayoutOperation.Toast; onDismiss: (id: string) => void }) => {\n const { t } = useTranslation(meta.profile.key);\n return (\n <Toast.Root\n data-testid={toast.id}\n defaultOpen\n duration={toast.duration}\n onOpenChange={(open) => {\n if (!open) {\n onDismiss(toast.id);\n }\n }}\n >\n <Toast.Title icon={toast.icon} onClose={toast.closeLabel ? () => onDismiss(toast.id) : undefined}>\n {toast.title && <span>{toLocalizedString(toast.title, t)}</span>}\n </Toast.Title>\n {toast.description && <Toast.Description>{toLocalizedString(toast.description, t)}</Toast.Description>}\n {toast.onAction && toast.actionAlt && toast.actionLabel && (\n <Toast.Actions>\n <Toast.Action altText={toLocalizedString(toast.actionAlt, t)} asChild>\n <Button variant='primary' onClick={() => toast.onAction?.()}>\n {toLocalizedString(toast.actionLabel, t)}\n </Button>\n </Toast.Action>\n </Toast.Actions>\n )}\n </Toast.Root>\n );\n};\n\nexport const Layout = ({ children }: PropsWithChildren<{}>) => {\n const { t } = useTranslation(meta.profile.key);\n const trigger = useRef<HTMLButtonElement | null>(null);\n const registry = useContext(RegistryContext);\n const stateAtom = useCapability(StorybookCapabilities.LayoutState);\n const layout = useAtomValue(stateAtom);\n const [iter, setIter] = useState(0);\n const [open, setOpen] = useState(false);\n const debounceRef = useRef<NodeJS.Timeout | null>(null);\n\n const updateState = useCallback(\n (updates: Partial<StorybookCapabilities.LayoutStateProps>) => {\n const current = registry.get(stateAtom);\n registry.set(stateAtom, { ...current, ...updates });\n },\n [registry, stateAtom],\n );\n\n useEffect(() => {\n setOpen(false);\n if (debounceRef.current) {\n clearTimeout(debounceRef.current);\n debounceRef.current = null;\n }\n trigger.current = layout.popoverAnchor ?? null;\n setIter((iter) => iter + 1);\n if (layout.popoverOpen) {\n debounceRef.current = setTimeout(() => setOpen(true), debounce_delay);\n }\n }, [layout.popoverAnchor, layout.popoverContent, layout.popoverOpen]);\n\n const handleClose = useCallback(() => {\n setOpen(false);\n updateState({\n popoverOpen: false,\n popoverAnchor: undefined,\n popoverAnchorId: undefined,\n popoverSide: undefined,\n });\n }, [updateState]);\n\n const handleInteractOutside = useCallback(\n (event: KeyboardEvent | PopoverContentInteractOutsideEvent) => {\n if (\n // TODO(thure): CodeMirror should not focus itself when it updates.\n event.type === 'dismissableLayer.focusOutside' &&\n (event.currentTarget as HTMLElement | undefined)?.classList.contains('cm-content')\n ) {\n event.preventDefault();\n } else {\n handleClose();\n }\n },\n [handleClose],\n );\n\n const handleDismissToast = useCallback(\n (id: string) => {\n updateState({ toasts: layout.toasts.filter((toast) => toast.id !== id) });\n },\n [updateState, layout.toasts],\n );\n\n const DialogRoot = layout.dialogType === 'alert' ? AlertDialog.Root : Dialog.Root;\n const DialogOverlay = layout.dialogType === 'alert' ? AlertDialog.Overlay : Dialog.Overlay;\n\n return (\n <Toast.Provider>\n <div className='fixed inset-0 flex overflow-hidden'>\n <Dnd.Root>\n <Popover.Root open={open}>\n <Main.Root\n navigationSidebarState={layout.sidebarState}\n complementarySidebarState={layout.complementarySidebarState}\n onNavigationSidebarStateChange={(next) => updateState({ sidebarState: next })}\n onComplementarySidebarStateChange={(next) => updateState({ complementarySidebarState: next })}\n >\n {children}\n </Main.Root>\n\n <DialogRoot\n modal={layout.dialogBlockAlign !== 'end'}\n open={layout.dialogOpen}\n onOpenChange={(nextOpen) => updateState({ dialogOpen: nextOpen })}\n >\n {layout.dialogBlockAlign === 'end' ? (\n <Surface.Surface\n type={AppSurface.Dialog}\n data={layout.dialogContent}\n limit={1}\n fallback={ErrorFallback}\n placeholder={<div />}\n />\n ) : (\n <DialogOverlay\n blockAlign={layout.dialogBlockAlign}\n classNames={layout.dialogOverlayClasses}\n style={layout.dialogOverlayStyle}\n >\n <Surface.Surface\n type={AppSurface.Dialog}\n data={layout.dialogContent}\n limit={1}\n fallback={ErrorFallback}\n />\n </DialogOverlay>\n )}\n </DialogRoot>\n\n <Popover.VirtualTrigger key={iter} virtualRef={trigger} />\n <Popover.Portal>\n <Popover.Content\n side={layout.popoverSide}\n onOpenAutoFocus={(event) => event.preventDefault()}\n onInteractOutside={handleInteractOutside}\n onEscapeKeyDown={handleInteractOutside}\n sticky='always'\n hideWhenDetached\n >\n <Popover.Viewport>\n {layout.popoverKind === 'card' && (\n <Card.Root>\n <Card.Header>\n {/* Disabled drag handle keeps the toolbar slot layout consistent with regular cards. */}\n <Card.DragHandle />\n {layout.popoverTitle ? (\n <Card.Title>{toLocalizedString(layout.popoverTitle, t)}</Card.Title>\n ) : (\n <span />\n )}\n <Card.ActionIconButton action='close' onClick={handleClose} />\n </Card.Header>\n <Surface.Surface type={AppSurface.CardContent} data={layout.popoverContent} limit={1} />\n </Card.Root>\n )}\n {(layout.popoverKind === 'base' || layout.popoverKind === 'rename') && (\n <Surface.Surface type={AppSurface.Popover} data={layout.popoverContent} limit={1} />\n )}\n </Popover.Viewport>\n <Popover.Arrow />\n </Popover.Content>\n </Popover.Portal>\n </Popover.Root>\n </Dnd.Root>\n {layout.toasts.map((toast) => (\n <StoryToast key={toast.id} toast={toast} onDismiss={handleDismissToast} />\n ))}\n <Toast.Viewport />\n </div>\n </Toast.Provider>\n );\n};\n\nexport const ErrorFallback = ({ error }: { error?: Error }) => {\n const { t } = useTranslation(meta.profile.key);\n const errorString = error?.toString() ?? '';\n return (\n <div\n role='alert'\n data-testid='error-boundary-fallback'\n className={mx('overflow-auto p-8 dx-attention-surface grid place-items-center')}\n >\n <p className={mx(descriptionMessage, 'break-words rounded-md p-8', errorString.length < 256 && 'text-lg')}>\n {error ? errorString : t('error-fallback.message')}\n </p>\n </div>\n );\n};\n"],"mappings":";;;;;;;;;;;;AA6BA,IAAM,iBAAiB;AAEvB,IAAM,cAAc,EAAE,OAAO,gBAAmF;CAC9G,MAAM,EAAE,MAAM,eAAe,KAAK,QAAQ,GAAG;CAC7C,OACE,qBAAC,MAAM,MAAP;EACE,eAAa,MAAM;EACnB,aAAA;EACA,UAAU,MAAM;EAChB,eAAe,SAAS;GACtB,IAAI,CAAC,MACH,UAAU,MAAM,EAAE;EAEtB;EARF,UAAA;GAUE,oBAAC,MAAM,OAAP;IAAa,MAAM,MAAM;IAAM,SAAS,MAAM,mBAAmB,UAAU,MAAM,EAAE,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WAAW;GAAqB,GAAxD,MAAM,EAAkD,CAC1E;GACD,oBAAC,MAAM,UAAP,CAAiB,CAAA;EACd;CACS,CAAA,EAAA,CAAA;AAEpB;AAEA,IAAa,iBAAiB,EAAE,YAA+B;CAC7D,MAAM,EAAE,MAAM,eAAe,KAAK,QAAQ,GAAG;CAC7C,MAAM,cAAc,OAAO,SAAS,KAAK;CACzC,OACE,oBAAC,OAAD;EACE,MAAK;EACL,eAAY;EACZ,WAAW,GAAG,gEAAgE;EAE9E,UAAA,oBAAC,KAAD;GAAG,WAAW,GAAG,oBAAoB,8BAA8B,YAAY,SAAS,OAAO,SAAS;GACrG,UAAA,QAAQ,cAAc,EAAE,wBAAwB;EAChD,CAAA;CACA,CAAA;AAET"}
1
+ {"version":3,"file":"components.mjs","names":[],"sources":["../../src/components/Layout/Layout.tsx"],"sourcesContent":["//\n// Copyright 2023 DXOS.org\n//\n\nimport { useAtomValue } from '@effect/atom-react/Hooks';\nimport { RegistryContext } from '@effect/atom-react/RegistryContext';\nimport React, {\n type ComponentProps,\n type PropsWithChildren,\n useCallback,\n useContext,\n useEffect,\n useRef,\n useState,\n} from 'react';\n\nimport * as Hooks from '@dxos/app-framework/Hooks';\nimport * as Surface from '@dxos/app-framework/Surface';\nimport * as AppSurface from '@dxos/app-toolkit/AppSurface';\nimport type * as LayoutOperation from '@dxos/app-toolkit/LayoutOperation';\nimport { Dnd } from '@dxos/react-ui-dnd';\nimport * as AlertDialog from '@dxos/react-ui/AlertDialog';\nimport * as Card from '@dxos/react-ui/Card';\nimport * as Dialog from '@dxos/react-ui/Dialog';\nimport * as DragHandle from '@dxos/react-ui/DragHandle';\nimport * as UiHooks from '@dxos/react-ui/Hooks';\nimport * as Main from '@dxos/react-ui/Main';\nimport * as Popover from '@dxos/react-ui/Popover';\nimport * as Theme from '@dxos/react-ui/Theme';\nimport * as Toast from '@dxos/react-ui/Toast';\nimport * as VirtualAnchor from '@dxos/react-ui/VirtualAnchor';\nimport { descriptionMessage, mx } from '@dxos/ui-theme';\n\nimport { meta } from '#meta';\nimport { StorybookCapabilities } from '#types';\n\nconst debounce_delay = 100;\n\ntype FocusOutsideEvent = Parameters<NonNullable<ComponentProps<typeof Popover.Root>['onFocusOutside']>>[0];\n\nconst StoryToast = ({ toast, onDismiss }: { toast: LayoutOperation.Toast; onDismiss: (id: string) => void }) => {\n const { t } = UiHooks.useTranslation(meta.profile.key);\n return (\n <Toast.Root\n data-testid={toast.id}\n defaultOpen\n duration={toast.duration}\n onOpenChange={(open) => {\n if (!open) {\n onDismiss(toast.id);\n }\n }}\n >\n <Toast.Header icon={toast.icon} closable={!!toast.closeLabel}>\n {toast.title && Theme.toLocalizedString(toast.title, t)}\n </Toast.Header>\n {toast.description && <Toast.Description>{Theme.toLocalizedString(toast.description, t)}</Toast.Description>}\n {toast.onAction && toast.actionAlt && toast.actionLabel && (\n <Toast.Footer>\n <Toast.ActionTrigger variant='primary' onClick={() => toast.onAction?.()}>\n {Theme.toLocalizedString(toast.actionLabel, t)}\n </Toast.ActionTrigger>\n </Toast.Footer>\n )}\n </Toast.Root>\n );\n};\n\nexport const Layout = ({ children }: PropsWithChildren<{}>) => {\n const { t } = UiHooks.useTranslation(meta.profile.key);\n const trigger = useRef<HTMLButtonElement | null>(null);\n const registry = useContext(RegistryContext);\n const stateAtom = Hooks.useCapability(StorybookCapabilities.LayoutState);\n const layout = useAtomValue(stateAtom);\n const [iter, setIter] = useState(0);\n const [open, setOpen] = useState(false);\n const debounceRef = useRef<NodeJS.Timeout | null>(null);\n\n const updateState = useCallback(\n (updates: Partial<StorybookCapabilities.LayoutStateProps>) => {\n const current = registry.get(stateAtom);\n registry.set(stateAtom, { ...current, ...updates });\n },\n [registry, stateAtom],\n );\n\n useEffect(() => {\n setOpen(false);\n if (debounceRef.current) {\n clearTimeout(debounceRef.current);\n debounceRef.current = null;\n }\n trigger.current = layout.popoverAnchor ?? null;\n setIter((iter) => iter + 1);\n if (layout.popoverOpen) {\n debounceRef.current = setTimeout(() => setOpen(true), debounce_delay);\n }\n }, [layout.popoverAnchor, layout.popoverContent, layout.popoverOpen]);\n\n const handleClose = useCallback(() => {\n setOpen(false);\n updateState({\n popoverOpen: false,\n popoverAnchor: undefined,\n popoverAnchorId: undefined,\n popoverSide: undefined,\n });\n }, [updateState]);\n\n const handleFocusOutside = useCallback(\n (event: FocusOutsideEvent) => {\n // TODO(thure): CodeMirror should not focus itself when it updates.\n const target = event.detail.originalEvent.target;\n if (target instanceof HTMLElement && target.classList.contains('cm-content')) {\n event.preventDefault();\n } else {\n handleClose();\n }\n },\n [handleClose],\n );\n\n const handleDismissToast = useCallback(\n (id: string) => {\n updateState({ toasts: layout.toasts.filter((toast) => toast.id !== id) });\n },\n [updateState, layout.toasts],\n );\n\n const DialogRoot = layout.dialogType === 'alert' ? AlertDialog.Root : Dialog.Root;\n\n return (\n <Toast.Provider>\n {/* The plugin `ReactContext` capabilities — the theme plugin's `Tooltip.Provider` among them —\n wrap `children` only, so the dialog and popover portals rendered as its siblings below sit\n outside them. Any `IconButton` there renders a `Tooltip.Trigger`, which throws rather than\n degrades when it finds no provider, taking the whole surface down with it. */}\n <div className='fixed inset-0 flex overflow-hidden'>\n <Dnd.Root>\n <Popover.Root\n open={open}\n positioning={{\n ...VirtualAnchor.virtualAnchor(trigger),\n placement: layout.popoverSide,\n hideWhenDetached: true,\n }}\n autoFocus={false}\n onFocusOutside={handleFocusOutside}\n onPointerDownOutside={handleClose}\n onEscapeKeyDown={handleClose}\n >\n <Main.Root\n navigationSidebarState={layout.sidebarState}\n complementarySidebarState={layout.complementarySidebarState}\n onNavigationSidebarStateChange={(next) => updateState({ sidebarState: next })}\n onComplementarySidebarStateChange={(next) => updateState({ complementarySidebarState: next })}\n >\n {children}\n </Main.Root>\n\n <DialogRoot\n modal={layout.dialogBlockAlign !== 'end'}\n open={layout.dialogOpen}\n onOpenChange={({ open: nextOpen }) => updateState({ dialogOpen: nextOpen })}\n >\n {/* The dialog surface renders its own Content, which carries the placement and scrim. */}\n <Surface.Surface\n type={AppSurface.Dialog}\n data={layout.dialogContent}\n limit={1}\n fallback={ErrorFallback}\n placeholder={<div />}\n />\n </DialogRoot>\n\n <Popover.Content>\n <Popover.Body>\n {/* `border={false}`: the popover content already draws the surface and its border,\n so a bordered card inside it reads as a second frame. Matches the deck's popover. */}\n {layout.popoverKind === 'card' && (\n <Card.Root grid border={false} classNames='dx-card-popover rounded-md'>\n <Card.Header>\n {/* Disabled drag handle keeps the toolbar slot layout consistent with regular cards. */}\n <DragHandle.DragHandle />\n {layout.popoverTitle ? (\n <Card.Title>{Theme.toLocalizedString(layout.popoverTitle, t)}</Card.Title>\n ) : (\n <span />\n )}\n <Card.Action system='close' onClick={handleClose} />\n </Card.Header>\n {layout.popoverContent ? (\n <Surface.Surface type={AppSurface.CardContent} data={layout.popoverContent} limit={1} />\n ) : (\n // Matches the deck's popover, which opens a card with no subject for a link that did not resolve.\n <Card.Body classNames='min-h-8'>\n <Card.Row>\n <Card.Text variant='muted'>No preview available.</Card.Text>\n </Card.Row>\n </Card.Body>\n )}\n </Card.Root>\n )}\n {(layout.popoverKind === 'base' || layout.popoverKind === 'rename') && (\n <Surface.Surface type={AppSurface.Popover} data={layout.popoverContent} limit={1} />\n )}\n </Popover.Body>\n </Popover.Content>\n </Popover.Root>\n </Dnd.Root>\n {layout.toasts.map((toast) => (\n <StoryToast key={toast.id} toast={toast} onDismiss={handleDismissToast} />\n ))}\n <Toast.Toaster />\n </div>\n </Toast.Provider>\n );\n};\n\nexport const ErrorFallback = ({ error }: { error?: Error }) => {\n const { t } = UiHooks.useTranslation(meta.profile.key);\n const errorString = error?.toString() ?? '';\n return (\n <div\n role='alert'\n data-testid='error-boundary-fallback'\n className={mx('overflow-auto p-8 dx-attention-surface grid place-items-center')}\n >\n <p className={mx(descriptionMessage, 'break-words rounded-md p-8', errorString.length < 256 && 'text-lg')}>\n {error ? errorString : t('error-fallback.message')}\n </p>\n </div>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;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I,CAAA,CAEzE,EAAA,CAAA,EACC,CAAA;IACL;GACN,CAAA,EAAA,CAAA;GACT,OAAO,OAAO,KAAK,UAClB,oBAAC,YAAD;IAAkC;IAAO,WAAW;GAAqB,GAAxD,MAAM,EAAkD,CAC1E;GACD,oBAAC,MAAM,SAAP,CAAgB,CAAA;EACb;CACS,CAAA,EAAA,CAAA;AAEpB;AAEA,IAAa,iBAAiB,EAAE,YAA+B;CAC7D,MAAM,EAAE,MAAM,QAAQ,eAAe,KAAK,QAAQ,GAAG;CACrD,MAAM,cAAc,OAAO,SAAS,KAAK;CACzC,OACE,oBAAC,OAAD;EACE,MAAK;EACL,eAAY;EACZ,WAAW,GAAG,gEAAgE;EAE9E,UAAA,oBAAC,KAAD;GAAG,WAAW,GAAG,oBAAoB,8BAA8B,YAAY,SAAS,OAAO,SAAS;GACrG,UAAA,QAAQ,cAAc,EAAE,wBAAwB;EAChD,CAAA;CACA,CAAA;AAET"}
package/dist/lib/core.mjs CHANGED
@@ -1,9 +1,9 @@
1
- import { ProcessManagerPlugin } from "@dxos/app-framework";
1
+ import * as ProcessManagerPlugin from "@dxos/app-framework/ProcessManagerPlugin";
2
2
  import { AttentionPlugin } from "@dxos/plugin-attention/testing";
3
3
  import { GraphPlugin } from "@dxos/plugin-graph/testing";
4
4
  import { SettingsPlugin } from "@dxos/plugin-settings/testing";
5
5
  import { ThemePlugin } from "@dxos/plugin-theme/testing";
6
- import { defaultTx } from "@dxos/react-ui";
6
+ import * as Theme from "@dxos/react-ui/Theme";
7
7
  //#region src/core.ts
8
8
  /**
9
9
  * Core plugins for testing/storybook environments.
@@ -13,9 +13,9 @@ import { defaultTx } from "@dxos/react-ui";
13
13
  var corePlugins = () => [
14
14
  AttentionPlugin.make(),
15
15
  GraphPlugin.make(),
16
- ProcessManagerPlugin(),
16
+ ProcessManagerPlugin.make(),
17
17
  SettingsPlugin.make(),
18
- ThemePlugin.make({ tx: defaultTx })
18
+ ThemePlugin.make({ tx: Theme.defaultTx })
19
19
  ];
20
20
  //#endregion
21
21
  export { corePlugins };
@@ -1 +1 @@
1
- {"version":3,"file":"core.mjs","names":[],"sources":["../../src/core.ts"],"sourcesContent":["//\n// Copyright 2025 DXOS.org\n//\n\nimport { ProcessManagerPlugin } from '@dxos/app-framework';\nimport type * as Plugin from '@dxos/app-framework/Plugin';\n// `/testing` entrypoints re-export the plugin eagerly (without `Plugin.lazy`).\n// The default `.` and `/plugin` exports wrap each plugin in a lazy stub\n// (`() => import('./XPlugin')`), which webkit cannot reliably resolve under\n// vite-dev: the dynamic-import promise can settle with a partially-evaluated\n// namespace, throwing `ReferenceError: Cannot access 'default' before\n// initialization` from the loader's `mod.default` access. Storybook runs\n// inside `storybook dev` (vite-dev) and is currently the only host that hits\n// this. Production hosts (composer-app via `vite preview`) keep using the\n// lazy `.` exports and their associated code splitting.\n//\n// Use these `/testing` entrypoints from any storybook `withPluginManager`\n// setup. The single-line `export * from './XPlugin'` re-exports avoid the\n// dynamic-import path entirely — see e.g. `plugin-attention/src/testing.ts`.\nimport { AttentionPlugin } from '@dxos/plugin-attention/testing';\nimport { GraphPlugin } from '@dxos/plugin-graph/testing';\nimport { SettingsPlugin } from '@dxos/plugin-settings/testing';\nimport { ThemePlugin } from '@dxos/plugin-theme/testing';\nimport { defaultTx } from '@dxos/react-ui';\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.make(),\n GraphPlugin.make(),\n ProcessManagerPlugin(),\n SettingsPlugin.make(),\n ThemePlugin.make({ tx: defaultTx }),\n];\n"],"mappings":";;;;;;;;;;;;AA8BA,IAAa,oBAAqC;CAChD,gBAAgB,KAAK;CACrB,YAAY,KAAK;CACjB,qBAAqB;CACrB,eAAe,KAAK;CACpB,YAAY,KAAK,EAAE,IAAI,UAAU,CAAC;AACpC"}
1
+ {"version":3,"file":"core.mjs","names":[],"sources":["../../src/core.ts"],"sourcesContent":["//\n// Copyright 2025 DXOS.org\n//\n\nimport type * as Plugin from '@dxos/app-framework/Plugin';\nimport * as ProcessManagerPlugin from '@dxos/app-framework/ProcessManagerPlugin';\n// `/testing` entrypoints re-export the plugin eagerly (without `Plugin.lazy`).\n// The default `.` and `/plugin` exports wrap each plugin in a lazy stub\n// (`() => import('./XPlugin')`), which webkit cannot reliably resolve under\n// vite-dev: the dynamic-import promise can settle with a partially-evaluated\n// namespace, throwing `ReferenceError: Cannot access 'default' before\n// initialization` from the loader's `mod.default` access. Storybook runs\n// inside `storybook dev` (vite-dev) and is currently the only host that hits\n// this. Production hosts (composer-app via `vite preview`) keep using the\n// lazy `.` exports and their associated code splitting.\n//\n// Use these `/testing` entrypoints from any storybook `withPluginManager`\n// setup. The single-line `export * from './XPlugin'` re-exports avoid the\n// dynamic-import path entirely — see e.g. `plugin-attention/src/testing.ts`.\nimport { AttentionPlugin } from '@dxos/plugin-attention/testing';\nimport { GraphPlugin } from '@dxos/plugin-graph/testing';\nimport { SettingsPlugin } from '@dxos/plugin-settings/testing';\nimport { ThemePlugin } from '@dxos/plugin-theme/testing';\nimport * as Theme from '@dxos/react-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.make(),\n GraphPlugin.make(),\n ProcessManagerPlugin.make(),\n SettingsPlugin.make(),\n ThemePlugin.make({ tx: Theme.defaultTx }),\n];\n"],"mappings":";;;;;;;;;;;;AA8BA,IAAa,oBAAqC;CAChD,gBAAgB,KAAK;CACrB,YAAY,KAAK;CACjB,qBAAqB,KAAK;CAC1B,eAAe,KAAK;CACpB,YAAY,KAAK,EAAE,IAAI,MAAM,UAAU,CAAC;AAC1C"}
@@ -1,9 +1,11 @@
1
- import { ProcessManagerPlugin } from "@dxos/app-framework";
1
+ import { t as __exportAll } from "./chunk-rolldown-runtime.mjs";
2
+ import * as ProcessManagerPlugin from "@dxos/app-framework/ProcessManagerPlugin";
2
3
  import { AttentionPlugin } from "@dxos/plugin-attention/testing";
3
4
  import { GraphPlugin } from "@dxos/plugin-graph/testing";
4
5
  import { SettingsPlugin } from "@dxos/plugin-settings/testing";
5
6
  import { createTestApp } from "@dxos/app-framework/testing";
6
- //#region src/harness.ts
7
+ //#region src/Harness.ts
8
+ var Harness_exports = /* @__PURE__ */ __exportAll({ createComposerTestApp: () => createComposerTestApp });
7
9
  /**
8
10
  * Headless core plugins for the test harness — the subset of `corePlugins()`
9
11
  * that can be activated without a browser DOM.
@@ -11,7 +13,7 @@ import { createTestApp } from "@dxos/app-framework/testing";
11
13
  var headlessCorePlugins = () => [
12
14
  AttentionPlugin.make(),
13
15
  GraphPlugin.make(),
14
- ProcessManagerPlugin(),
16
+ ProcessManagerPlugin.make(),
15
17
  SettingsPlugin.make()
16
18
  ];
17
19
  /**
@@ -31,7 +33,7 @@ var createComposerTestApp = async (opts = {}) => {
31
33
  const core = headlessCorePlugins();
32
34
  if (theme) {
33
35
  const { ThemePlugin } = await import("@dxos/plugin-theme/testing");
34
- const { defaultTx } = await import("@dxos/react-ui");
36
+ const { defaultTx } = await import("@dxos/react-ui/Theme");
35
37
  core.push(ThemePlugin.make({ tx: defaultTx }));
36
38
  }
37
39
  return createTestApp({
@@ -40,6 +42,6 @@ var createComposerTestApp = async (opts = {}) => {
40
42
  });
41
43
  };
42
44
  //#endregion
43
- export { createComposerTestApp };
45
+ export { createComposerTestApp, Harness_exports as t };
44
46
 
45
47
  //# sourceMappingURL=harness.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"harness.mjs","names":[],"sources":["../../src/harness.ts"],"sourcesContent":["//\n// Copyright 2026 DXOS.org\n//\n\nimport { ProcessManagerPlugin } from '@dxos/app-framework';\nimport type * as Plugin from '@dxos/app-framework/Plugin';\nimport { type TestAppOptions, type TestHarness, createTestApp } from '@dxos/app-framework/testing';\nimport { AttentionPlugin } from '@dxos/plugin-attention/testing';\nimport { GraphPlugin } from '@dxos/plugin-graph/testing';\nimport { SettingsPlugin } from '@dxos/plugin-settings/testing';\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.make(),\n GraphPlugin.make(),\n ProcessManagerPlugin(),\n SettingsPlugin.make(),\n];\n\n/**\n * Creates a TestHarness pre-loaded with the Composer core plugins\n * (Attention, Graph, ProcessManager, Settings, optionally Theme).\n *\n * For a ClientPlugin-backed harness, pass `ClientPlugin.make({ ... })` via `plugins`.\n *\n * @idiom org.dxos.plugin-testing.pluginModuleActivation\n * applies: Writing a basic activation smoke-test for any Composer plugin\n * instead-of: Manually inspecting PluginManager internals or relying on e2e tests for activation checks\n * uses: {@link createComposerTestApp}, {@link AppActivationEvents}\n * related: org.dxos.app-framework.testing.operationCapture\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/testing');\n const { defaultTx } = await import('@dxos/react-ui');\n core.push(ThemePlugin.make({ tx: defaultTx }));\n }\n return createTestApp({\n ...rest,\n plugins: [...core, ...plugins],\n });\n};\n"],"mappings":";;;;;;;;;;AA0BA,IAAM,4BAA6C;CACjD,gBAAgB,KAAK;CACrB,YAAY,KAAK;CACjB,qBAAqB;CACrB,eAAe,KAAK;AACtB;;;;;;;;;;;;;AAcA,IAAa,wBAAwB,OAAO,OAA+B,CAAC,MAA4B;CACtG,MAAM,EAAE,UAAU,CAAC,GAAG,QAAQ,OAAO,GAAG,SAAS;CACjD,MAAM,OAAO,oBAAoB;CACjC,IAAI,OAAO;EACT,MAAM,EAAE,gBAAgB,MAAM,OAAO;EACrC,MAAM,EAAE,cAAc,MAAM,OAAO;EACnC,KAAK,KAAK,YAAY,KAAK,EAAE,IAAI,UAAU,CAAC,CAAC;CAC/C;CACA,OAAO,cAAc;EACnB,GAAG;EACH,SAAS,CAAC,GAAG,MAAM,GAAG,OAAO;CAC/B,CAAC;AACH"}
1
+ {"version":3,"file":"harness.mjs","names":[],"sources":["../../src/Harness.ts"],"sourcesContent":["//\n// Copyright 2026 DXOS.org\n//\n\n// @import-as-namespace\n\nimport type * as Plugin from '@dxos/app-framework/Plugin';\nimport * as ProcessManagerPlugin from '@dxos/app-framework/ProcessManagerPlugin';\nimport { type TestAppOptions, type TestHarness, createTestApp } from '@dxos/app-framework/testing';\nimport { AttentionPlugin } from '@dxos/plugin-attention/testing';\nimport { GraphPlugin } from '@dxos/plugin-graph/testing';\nimport { SettingsPlugin } from '@dxos/plugin-settings/testing';\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.make(),\n GraphPlugin.make(),\n ProcessManagerPlugin.make(),\n SettingsPlugin.make(),\n];\n\n/**\n * Creates a TestHarness pre-loaded with the Composer core plugins\n * (Attention, Graph, ProcessManager, Settings, optionally Theme).\n *\n * For a ClientPlugin-backed harness, pass `ClientPlugin.make({ ... })` via `plugins`.\n *\n * @idiom org.dxos.plugin-testing.pluginModuleActivation\n * applies: Writing a basic activation smoke-test for any Composer plugin\n * instead-of: Manually inspecting PluginManager internals or relying on e2e tests for activation checks\n * uses: {@link createComposerTestApp}, {@link AppActivationEvents}\n * related: org.dxos.app-framework.testing.operationCapture\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/testing');\n const { defaultTx } = await import('@dxos/react-ui/Theme');\n core.push(ThemePlugin.make({ tx: defaultTx }));\n }\n return createTestApp({\n ...rest,\n plugins: [...core, ...plugins],\n });\n};\n"],"mappings":";;;;;;;;;;;;AA4BA,IAAM,4BAA6C;CACjD,gBAAgB,KAAK;CACrB,YAAY,KAAK;CACjB,qBAAqB,KAAK;CAC1B,eAAe,KAAK;AACtB;;;;;;;;;;;;;AAcA,IAAa,wBAAwB,OAAO,OAA+B,CAAC,MAA4B;CACtG,MAAM,EAAE,UAAU,CAAC,GAAG,QAAQ,OAAO,GAAG,SAAS;CACjD,MAAM,OAAO,oBAAoB;CACjC,IAAI,OAAO;EACT,MAAM,EAAE,gBAAgB,MAAM,OAAO;EACrC,MAAM,EAAE,cAAc,MAAM,OAAO;EACnC,KAAK,KAAK,YAAY,KAAK,EAAE,IAAI,UAAU,CAAC,CAAC;CAC/C;CACA,OAAO,cAAc;EACnB,GAAG;EACH,SAAS,CAAC,GAAG,MAAM,GAAG,OAAO;CAC/B,CAAC;AACH"}