@dxos/plugin-testing 0.9.1-staging.ee54ba693a → 0.11.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 (129) hide show
  1. package/dist/lib/StorybookPlugin.mjs +20 -0
  2. package/dist/lib/StorybookPlugin.mjs.map +1 -0
  3. package/dist/lib/capabilities.mjs +8 -0
  4. package/dist/lib/capabilities.mjs.map +1 -0
  5. package/dist/lib/chunk-add-toast.mjs +12 -0
  6. package/dist/lib/chunk-add-toast.mjs.map +1 -0
  7. package/dist/lib/{neutral/close-L3FBJQ3J.mjs → chunk-close.mjs} +5 -8
  8. package/dist/lib/chunk-close.mjs.map +1 -0
  9. package/dist/lib/chunk-meta.mjs +22 -0
  10. package/dist/lib/chunk-meta.mjs.map +1 -0
  11. package/dist/lib/{neutral/open-O5FFJF2B.mjs → chunk-open.mjs} +12 -10
  12. package/dist/lib/chunk-open.mjs.map +1 -0
  13. package/dist/lib/chunk-operation-handler.mjs +11 -0
  14. package/dist/lib/chunk-operation-handler.mjs.map +1 -0
  15. package/dist/lib/{neutral/scroll-into-view-BKOOOECC.mjs → chunk-scroll-into-view.mjs} +5 -8
  16. package/dist/lib/chunk-scroll-into-view.mjs.map +1 -0
  17. package/dist/lib/chunk-state.mjs +38 -0
  18. package/dist/lib/chunk-state.mjs.map +1 -0
  19. package/dist/lib/chunk-switch-workspace.mjs +12 -0
  20. package/dist/lib/chunk-switch-workspace.mjs.map +1 -0
  21. package/dist/lib/chunk-types.mjs +21 -0
  22. package/dist/lib/chunk-types.mjs.map +1 -0
  23. package/dist/lib/chunk-update-complementary.mjs +16 -0
  24. package/dist/lib/chunk-update-complementary.mjs.map +1 -0
  25. package/dist/lib/chunk-update-dialog.mjs +22 -0
  26. package/dist/lib/chunk-update-dialog.mjs.map +1 -0
  27. package/dist/lib/chunk-update-popover.mjs +35 -0
  28. package/dist/lib/chunk-update-popover.mjs.map +1 -0
  29. package/dist/lib/chunk-update-sidebar.mjs +16 -0
  30. package/dist/lib/chunk-update-sidebar.mjs.map +1 -0
  31. package/dist/lib/chunk-update-state.mjs +20 -0
  32. package/dist/lib/chunk-update-state.mjs.map +1 -0
  33. package/dist/lib/components.mjs +175 -0
  34. package/dist/lib/components.mjs.map +1 -0
  35. package/dist/lib/core.mjs +23 -0
  36. package/dist/lib/core.mjs.map +1 -0
  37. package/dist/lib/harness.mjs +47 -0
  38. package/dist/lib/harness.mjs.map +1 -0
  39. package/dist/lib/index.mjs +216 -0
  40. package/dist/lib/index.mjs.map +1 -0
  41. package/dist/lib/meta.mjs +2 -0
  42. package/dist/lib/operations.mjs +7 -0
  43. package/dist/lib/operations.mjs.map +1 -0
  44. package/dist/lib/plugin.mjs +9 -0
  45. package/dist/lib/plugin.mjs.map +1 -0
  46. package/dist/lib/types.mjs +2 -0
  47. package/dist/types/src/capabilities/operation-handler.d.ts +1 -1
  48. package/dist/types/src/capabilities/state.d.ts +1 -1
  49. package/dist/types/src/corpus/index.d.ts +2 -0
  50. package/dist/types/src/corpus/index.d.ts.map +1 -0
  51. package/dist/types/src/corpus/sample-messages.d.ts +27 -0
  52. package/dist/types/src/corpus/sample-messages.d.ts.map +1 -0
  53. package/dist/types/src/corpus/sample-messages.test.d.ts +2 -0
  54. package/dist/types/src/corpus/sample-messages.test.d.ts.map +1 -0
  55. package/dist/types/src/index.d.ts +1 -0
  56. package/dist/types/src/index.d.ts.map +1 -1
  57. package/dist/types/src/operations/index.d.ts.map +1 -1
  58. package/dist/types/src/types/StorybookCapabilities.d.ts +1 -1
  59. package/dist/types/src/types/StorybookCapabilities.d.ts.map +1 -1
  60. package/dist/types/tsconfig.tsbuildinfo +1 -1
  61. package/dx.config.ts +1 -0
  62. package/package.json +28 -26
  63. package/src/capabilities/state.tsx +1 -1
  64. package/src/components/Layout/Layout.tsx +3 -3
  65. package/src/corpus/index.ts +5 -0
  66. package/src/corpus/sample-messages.test.ts +63 -0
  67. package/src/corpus/sample-messages.ts +170 -0
  68. package/src/index.ts +1 -0
  69. package/src/operations/index.ts +0 -1
  70. package/src/types/StorybookCapabilities.ts +1 -1
  71. package/dist/lib/neutral/StorybookPlugin.mjs +0 -10
  72. package/dist/lib/neutral/StorybookPlugin.mjs.map +0 -7
  73. package/dist/lib/neutral/add-toast-FAFD7SFC.mjs +0 -23
  74. package/dist/lib/neutral/add-toast-FAFD7SFC.mjs.map +0 -7
  75. package/dist/lib/neutral/capabilities/index.mjs +0 -11
  76. package/dist/lib/neutral/capabilities/index.mjs.map +0 -7
  77. package/dist/lib/neutral/chunk-6JK2MYJW.mjs +0 -26
  78. package/dist/lib/neutral/chunk-6JK2MYJW.mjs.map +0 -7
  79. package/dist/lib/neutral/chunk-C7HWAFWJ.mjs +0 -21
  80. package/dist/lib/neutral/chunk-C7HWAFWJ.mjs.map +0 -7
  81. package/dist/lib/neutral/chunk-FCEWZHUT.mjs +0 -17
  82. package/dist/lib/neutral/chunk-FCEWZHUT.mjs.map +0 -7
  83. package/dist/lib/neutral/chunk-GDMPQHRP.mjs +0 -26
  84. package/dist/lib/neutral/chunk-GDMPQHRP.mjs.map +0 -7
  85. package/dist/lib/neutral/chunk-J5LGTIGS.mjs +0 -10
  86. package/dist/lib/neutral/chunk-J5LGTIGS.mjs.map +0 -7
  87. package/dist/lib/neutral/chunk-MYIMDRVN.mjs +0 -8
  88. package/dist/lib/neutral/chunk-MYIMDRVN.mjs.map +0 -7
  89. package/dist/lib/neutral/chunk-R7AV233N.mjs +0 -31
  90. package/dist/lib/neutral/chunk-R7AV233N.mjs.map +0 -7
  91. package/dist/lib/neutral/close-L3FBJQ3J.mjs.map +0 -7
  92. package/dist/lib/neutral/components/index.mjs +0 -181
  93. package/dist/lib/neutral/components/index.mjs.map +0 -7
  94. package/dist/lib/neutral/core.mjs +0 -8
  95. package/dist/lib/neutral/core.mjs.map +0 -7
  96. package/dist/lib/neutral/harness.mjs +0 -42
  97. package/dist/lib/neutral/harness.mjs.map +0 -7
  98. package/dist/lib/neutral/index.mjs +0 -20
  99. package/dist/lib/neutral/index.mjs.map +0 -7
  100. package/dist/lib/neutral/meta.json +0 -1
  101. package/dist/lib/neutral/meta.mjs +0 -8
  102. package/dist/lib/neutral/meta.mjs.map +0 -7
  103. package/dist/lib/neutral/open-O5FFJF2B.mjs.map +0 -7
  104. package/dist/lib/neutral/operation-handler-LQIWHQVY.mjs +0 -13
  105. package/dist/lib/neutral/operation-handler-LQIWHQVY.mjs.map +0 -7
  106. package/dist/lib/neutral/operations/index.mjs +0 -8
  107. package/dist/lib/neutral/operations/index.mjs.map +0 -7
  108. package/dist/lib/neutral/plugin.mjs +0 -16
  109. package/dist/lib/neutral/plugin.mjs.map +0 -7
  110. package/dist/lib/neutral/scroll-into-view-BKOOOECC.mjs.map +0 -7
  111. package/dist/lib/neutral/set-layout-mode-2KHD2AEY.mjs +0 -12
  112. package/dist/lib/neutral/set-layout-mode-2KHD2AEY.mjs.map +0 -7
  113. package/dist/lib/neutral/state-AJ62JEEG.mjs +0 -43
  114. package/dist/lib/neutral/state-AJ62JEEG.mjs.map +0 -7
  115. package/dist/lib/neutral/switch-workspace-NZQAADOK.mjs +0 -20
  116. package/dist/lib/neutral/switch-workspace-NZQAADOK.mjs.map +0 -7
  117. package/dist/lib/neutral/types/index.mjs +0 -8
  118. package/dist/lib/neutral/types/index.mjs.map +0 -7
  119. package/dist/lib/neutral/update-complementary-AHNSCP2O.mjs +0 -26
  120. package/dist/lib/neutral/update-complementary-AHNSCP2O.mjs.map +0 -7
  121. package/dist/lib/neutral/update-dialog-2VZ3OCUB.mjs +0 -28
  122. package/dist/lib/neutral/update-dialog-2VZ3OCUB.mjs.map +0 -7
  123. package/dist/lib/neutral/update-popover-MNHWRUNS.mjs +0 -46
  124. package/dist/lib/neutral/update-popover-MNHWRUNS.mjs.map +0 -7
  125. package/dist/lib/neutral/update-sidebar-UYW5UT3H.mjs +0 -26
  126. package/dist/lib/neutral/update-sidebar-UYW5UT3H.mjs.map +0 -7
  127. package/dist/types/src/operations/set-layout-mode.d.ts +0 -5
  128. package/dist/types/src/operations/set-layout-mode.d.ts.map +0 -1
  129. package/src/operations/set-layout-mode.ts +0 -14
@@ -0,0 +1,20 @@
1
+ import { ActivationEvents, Capabilities, Capability, Plugin } from "@dxos/app-framework";
2
+ import { meta } from "#meta";
3
+ import * as Effect from "effect/Effect";
4
+ import { AppActivationEvents, AppPlugin } from "@dxos/app-toolkit";
5
+ import { OperationHandler, State } from "#capabilities";
6
+ import { Layout } from "#components";
7
+ //#region src/StorybookPlugin.ts
8
+ var StorybookPlugin = Plugin.define(meta).pipe(AppPlugin.addOperationHandlerModule({ activate: OperationHandler }), AppPlugin.addReactContextModule({ activate: () => Effect.succeed(Capability.contributes(Capabilities.ReactContext, {
9
+ id: "storybook-layout",
10
+ context: Layout
11
+ })) }), Plugin.addModule(({ initialState }) => ({
12
+ id: Capability.getModuleTag(State),
13
+ activatesOn: ActivationEvents.Startup,
14
+ firesAfterActivation: [AppActivationEvents.LayoutReady],
15
+ activate: () => State({ initialState })
16
+ })), Plugin.make);
17
+ //#endregion
18
+ export { StorybookPlugin, StorybookPlugin as default };
19
+
20
+ //# sourceMappingURL=StorybookPlugin.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StorybookPlugin.mjs","names":[],"sources":["../../src/StorybookPlugin.ts"],"sourcesContent":["//\n// Copyright 2023 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\n\nimport { ActivationEvents, Capabilities, Capability, Plugin } from '@dxos/app-framework';\nimport { AppActivationEvents, AppPlugin } from '@dxos/app-toolkit';\n\nimport { OperationHandler, State } from '#capabilities';\nimport { Layout } from '#components';\nimport { meta } from '#meta';\nimport { StorybookCapabilities } from '#types';\n\nexport type StorybookPluginOptions = {\n initialState?: Partial<StorybookCapabilities.LayoutStateProps>;\n};\n\nexport const StorybookPlugin = Plugin.define<StorybookPluginOptions>(meta).pipe(\n AppPlugin.addOperationHandlerModule({\n activate: OperationHandler,\n }),\n AppPlugin.addReactContextModule({\n activate: () =>\n Effect.succeed(\n Capability.contributes(Capabilities.ReactContext, {\n id: 'storybook-layout',\n context: Layout,\n }),\n ),\n }),\n Plugin.addModule(({ initialState }) => ({\n id: Capability.getModuleTag(State),\n activatesOn: ActivationEvents.Startup,\n firesAfterActivation: [AppActivationEvents.LayoutReady],\n activate: () => State({ initialState }),\n })),\n Plugin.make,\n);\n\nexport default StorybookPlugin;\n"],"mappings":";;;;;;;AAkBA,IAAa,kBAAkB,OAAO,OAA+B,IAAI,CAAC,CAAC,KACzE,UAAU,0BAA0B,EAClC,UAAU,iBACZ,CAAC,GACD,UAAU,sBAAsB,EAC9B,gBACE,OAAO,QACL,WAAW,YAAY,aAAa,cAAc;CAChD,IAAI;CACJ,SAAS;AACX,CAAC,CACH,EACJ,CAAC,GACD,OAAO,WAAW,EAAE,oBAAoB;CACtC,IAAI,WAAW,aAAa,KAAK;CACjC,aAAa,iBAAiB;CAC9B,sBAAsB,CAAC,oBAAoB,WAAW;CACtD,gBAAgB,MAAM,EAAE,aAAa,CAAC;AACxC,EAAE,GACF,OAAO,IACT"}
@@ -0,0 +1,8 @@
1
+ import { Capability } from "@dxos/app-framework";
2
+ //#region src/capabilities/index.ts
3
+ var OperationHandler = Capability.lazy("OperationHandler", () => import("./chunk-operation-handler.mjs"));
4
+ var State = Capability.lazy("State", () => import("./chunk-state.mjs"));
5
+ //#endregion
6
+ export { OperationHandler, State };
7
+
8
+ //# sourceMappingURL=capabilities.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"capabilities.mjs","names":[],"sources":["../../src/capabilities/index.ts"],"sourcesContent":["//\n// Copyright 2025 DXOS.org\n//\n\nimport { Capability } from '@dxos/app-framework';\nimport { OperationHandlerSet } from '@dxos/compute';\n\nexport const OperationHandler = Capability.lazy<OperationHandlerSet.OperationHandlerSet>(\n 'OperationHandler',\n () => import('./operation-handler'),\n);\nexport const State = Capability.lazy('State', () => import('./state'));\n"],"mappings":";;AAOA,IAAa,mBAAmB,WAAW,KACzC,0BACM,OAAO,gCACf;AACA,IAAa,QAAQ,WAAW,KAAK,eAAe,OAAO,oBAAU"}
@@ -0,0 +1,12 @@
1
+ import { t as updateState } from "./chunk-update-state.mjs";
2
+ import * as Effect from "effect/Effect";
3
+ import { LayoutOperation } from "@dxos/app-toolkit";
4
+ import { Operation } from "@dxos/compute";
5
+ //#region src/operations/add-toast.ts
6
+ var handler = LayoutOperation.AddToast.pipe(Operation.withHandler(Effect.fnUntraced(function* (input) {
7
+ yield* updateState((state) => ({ toasts: [...state.toasts, input] }));
8
+ })));
9
+ //#endregion
10
+ export { handler as default };
11
+
12
+ //# sourceMappingURL=chunk-add-toast.mjs.map
@@ -0,0 +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 { LayoutOperation } from '@dxos/app-toolkit';\nimport { Operation } from '@dxos/compute';\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,12 +1,9 @@
1
- import "./chunk-J5LGTIGS.mjs";
2
-
3
- // src/operations/close.ts
4
1
  import * as Effect from "effect/Effect";
5
2
  import { LayoutOperation } from "@dxos/app-toolkit";
6
3
  import { Operation } from "@dxos/compute";
4
+ //#region src/operations/close.ts
7
5
  var handler = LayoutOperation.Close.pipe(Operation.withHandler(() => Effect.void));
8
- var close_default = handler;
9
- export {
10
- close_default as default
11
- };
12
- //# sourceMappingURL=close-L3FBJQ3J.mjs.map
6
+ //#endregion
7
+ export { handler as default };
8
+
9
+ //# sourceMappingURL=chunk-close.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chunk-close.mjs","names":[],"sources":["../../src/operations/close.ts"],"sourcesContent":["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\n\nimport { LayoutOperation } from '@dxos/app-toolkit';\nimport { Operation } from '@dxos/compute';\n\nconst handler: Operation.WithHandler<typeof LayoutOperation.Close> = LayoutOperation.Close.pipe(\n Operation.withHandler(() => Effect.void),\n);\n\nexport default handler;\n"],"mappings":";;;;AASA,IAAM,UAA+D,gBAAgB,MAAM,KACzF,UAAU,kBAAkB,OAAO,IAAI,CACzC"}
@@ -0,0 +1,22 @@
1
+ import { Plugin } from "@dxos/app-framework";
2
+ import { Config2 } from "@dxos/app-framework/config";
3
+ import { trim } from "@dxos/util";
4
+ //#region dx.config.ts
5
+ var dx_config_default = Config2.make({ plugin: {
6
+ key: "org.dxos.plugin.storybookLayout",
7
+ name: "Storybook",
8
+ author: "DXOS",
9
+ description: trim`
10
+ Development layout optimized for Storybook component testing and documentation.
11
+ Provides specialized views for component development and design system exploration.
12
+ `,
13
+ source: "https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-testing",
14
+ tags: ["labs"]
15
+ } });
16
+ //#endregion
17
+ //#region src/meta.ts
18
+ var meta = Plugin.getMetaFromConfig(dx_config_default);
19
+ //#endregion
20
+ export { meta as t };
21
+
22
+ //# sourceMappingURL=chunk-meta.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chunk-meta.mjs","names":[],"sources":["../../dx.config.ts","../../src/meta.ts"],"sourcesContent":["//\n// Copyright 2025 DXOS.org\n//\n\nimport { Config2 } from '@dxos/app-framework/config';\nimport { trim } from '@dxos/util';\n\nexport default Config2.make({\n plugin: {\n key: 'org.dxos.plugin.storybookLayout',\n name: 'Storybook',\n author: 'DXOS',\n description: trim`\n Development layout optimized for Storybook component testing and documentation.\n Provides specialized views for component development and design system exploration.\n `,\n source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-testing',\n tags: ['labs'],\n },\n});\n","//\n// Copyright 2023 DXOS.org\n//\n\nimport { Plugin } from '@dxos/app-framework';\n\nimport config from '../dx.config';\n\nexport const meta = Plugin.getMetaFromConfig(config);\n"],"mappings":";;;;AAOA,IAAA,oBAAe,QAAQ,KAAK,EAC1B,QAAQ;CACN,KAAK;CACL,MAAM;CACN,QAAQ;CACR,aAAa,IAAI;;;;CAIjB,QAAQ;CACR,MAAM,CAAC,MAAM;AACf,EACF,CAAC;;;ACXD,IAAa,OAAO,OAAO,kBAAkB,iBAAM"}
@@ -1,17 +1,19 @@
1
- import "./chunk-J5LGTIGS.mjs";
2
-
3
- // src/operations/open.ts
4
1
  import * as Effect from "effect/Effect";
5
2
  import { LayoutOperation } from "@dxos/app-toolkit";
6
3
  import { Operation } from "@dxos/compute";
7
4
  import { log } from "@dxos/log";
5
+ //#region src/operations/open.ts
8
6
  var __dxlog_file = "/__w/dxos/dxos/packages/plugins/plugin-testing/src/operations/open.ts";
9
7
  var handler = LayoutOperation.Open.pipe(Operation.withHandler(Effect.fnUntraced(function* (input) {
10
- log("LayoutOperation.Open handler start", void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 9, S: this });
11
- return input.subject;
8
+ log("LayoutOperation.Open handler start", void 0, {
9
+ "~LogMeta": "~LogMeta",
10
+ F: __dxlog_file,
11
+ L: 14,
12
+ S: this
13
+ });
14
+ return input.subject;
12
15
  })));
13
- var open_default = handler;
14
- export {
15
- open_default as default
16
- };
17
- //# sourceMappingURL=open-O5FFJF2B.mjs.map
16
+ //#endregion
17
+ export { handler as default };
18
+
19
+ //# sourceMappingURL=chunk-open.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chunk-open.mjs","names":[],"sources":["../../src/operations/open.ts"],"sourcesContent":["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\n\nimport { LayoutOperation } from '@dxos/app-toolkit';\nimport { Operation } from '@dxos/compute';\nimport { log } from '@dxos/log';\n\nconst handler: Operation.WithHandler<typeof LayoutOperation.Open> = LayoutOperation.Open.pipe(\n Operation.withHandler(\n Effect.fnUntraced(function* (input) {\n log('LayoutOperation.Open handler start');\n return input.subject;\n }),\n ),\n);\n\nexport default handler;\n"],"mappings":";;;;;;AAUA,IAAM,UAA8D,gBAAgB,KAAK,KACvF,UAAU,YACR,OAAO,WAAW,WAAW,OAAO;CAClC,IAAI,sCAAmC,KAAA,GAAA;EAAA,YAAA;EAAA,GAAA;EAAA,GAAA;EAAA,GAAA;CAAA,CAAC;CACxC,OAAO,MAAM;AACf,CAAC,CACH,CACF"}
@@ -0,0 +1,11 @@
1
+ import { Capabilities, Capability } from "@dxos/app-framework";
2
+ import * as Effect from "effect/Effect";
3
+ import { TestingOperationHandlerSet } from "#operations";
4
+ //#region src/capabilities/operation-handler.ts
5
+ var operation_handler_default = Capability.makeModule(Effect.fnUntraced(function* () {
6
+ return Capability.contributes(Capabilities.OperationHandler, TestingOperationHandlerSet);
7
+ }));
8
+ //#endregion
9
+ export { operation_handler_default as default };
10
+
11
+ //# sourceMappingURL=chunk-operation-handler.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chunk-operation-handler.mjs","names":[],"sources":["../../src/capabilities/operation-handler.ts"],"sourcesContent":["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\n\nimport { Capabilities, Capability } from '@dxos/app-framework';\nimport type { OperationHandlerSet } from '@dxos/compute';\n\nimport { TestingOperationHandlerSet } from '#operations';\n\nexport default Capability.makeModule<OperationHandlerSet.OperationHandlerSet>(\n Effect.fnUntraced(function* () {\n return Capability.contributes(Capabilities.OperationHandler, TestingOperationHandlerSet);\n }),\n);\n"],"mappings":";;;;AAWA,IAAA,4BAAe,WAAW,WACxB,OAAO,WAAW,aAAa;CAC7B,OAAO,WAAW,YAAY,aAAa,kBAAkB,0BAA0B;AACzF,CAAC,CACH"}
@@ -1,12 +1,9 @@
1
- import "./chunk-J5LGTIGS.mjs";
2
-
3
- // src/operations/scroll-into-view.ts
4
1
  import * as Effect from "effect/Effect";
5
2
  import { LayoutOperation } from "@dxos/app-toolkit";
6
3
  import { Operation } from "@dxos/compute";
4
+ //#region src/operations/scroll-into-view.ts
7
5
  var handler = LayoutOperation.ScrollIntoView.pipe(Operation.withHandler(() => Effect.void));
8
- var scroll_into_view_default = handler;
9
- export {
10
- scroll_into_view_default as default
11
- };
12
- //# sourceMappingURL=scroll-into-view-BKOOOECC.mjs.map
6
+ //#endregion
7
+ export { handler as default };
8
+
9
+ //# sourceMappingURL=chunk-scroll-into-view.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chunk-scroll-into-view.mjs","names":[],"sources":["../../src/operations/scroll-into-view.ts"],"sourcesContent":["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\n\nimport { LayoutOperation } from '@dxos/app-toolkit';\nimport { Operation } from '@dxos/compute';\n\nconst handler: Operation.WithHandler<typeof LayoutOperation.ScrollIntoView> = LayoutOperation.ScrollIntoView.pipe(\n Operation.withHandler(() => Effect.void),\n);\n\nexport default handler;\n"],"mappings":";;;;AASA,IAAM,UAAwE,gBAAgB,eAAe,KAC3G,UAAU,kBAAkB,OAAO,IAAI,CACzC"}
@@ -0,0 +1,38 @@
1
+ import { Capability } from "@dxos/app-framework";
2
+ import * as Effect from "effect/Effect";
3
+ import { AppCapabilities } from "@dxos/app-toolkit";
4
+ import { StorybookCapabilities } from "#types";
5
+ import { Atom } from "@effect-atom/atom";
6
+ //#region src/capabilities/state.tsx
7
+ var defaultState = {
8
+ sidebarState: "closed",
9
+ complementarySidebarState: "closed",
10
+ dialogOpen: false,
11
+ toasts: [],
12
+ workspace: "default"
13
+ };
14
+ var state_default = Capability.makeModule(Effect.fnUntraced(function* (props) {
15
+ const { initialState } = props ?? {};
16
+ const stateAtom = Atom.make({
17
+ ...defaultState,
18
+ ...initialState
19
+ });
20
+ const layoutAtom = Atom.make((get) => {
21
+ const state = get(stateAtom);
22
+ return {
23
+ mode: "storybook",
24
+ dialogOpen: state.dialogOpen,
25
+ sidebarOpen: state.sidebarState === "expanded",
26
+ complementarySidebarOpen: state.complementarySidebarState === "expanded",
27
+ workspace: state.workspace,
28
+ active: [],
29
+ inactive: [],
30
+ scrollIntoView: void 0
31
+ };
32
+ });
33
+ return [Capability.contributes(StorybookCapabilities.LayoutState, stateAtom), Capability.contributes(AppCapabilities.Layout, layoutAtom)];
34
+ }));
35
+ //#endregion
36
+ export { state_default as default };
37
+
38
+ //# sourceMappingURL=chunk-state.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chunk-state.mjs","names":[],"sources":["../../src/capabilities/state.tsx"],"sourcesContent":["//\n// Copyright 2025 DXOS.org\n//\n\nimport { Atom } from '@effect-atom/atom';\nimport * as Effect from 'effect/Effect';\n\nimport { Capability } from '@dxos/app-framework';\nimport { AppCapabilities } from '@dxos/app-toolkit';\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.contributes(StorybookCapabilities.LayoutState, stateAtom),\n Capability.contributes(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,YAAY,sBAAsB,aAAa,SAAS,GACnE,WAAW,YAAY,gBAAgB,QAAQ,UAAU,CAC3D;AACF,CAAC,CACH"}
@@ -0,0 +1,12 @@
1
+ import { t as updateState } from "./chunk-update-state.mjs";
2
+ import * as Effect from "effect/Effect";
3
+ import { LayoutOperation } from "@dxos/app-toolkit";
4
+ import { Operation } from "@dxos/compute";
5
+ //#region src/operations/switch-workspace.ts
6
+ var handler = LayoutOperation.SwitchWorkspace.pipe(Operation.withHandler(Effect.fnUntraced(function* ({ subject }) {
7
+ yield* updateState(() => ({ workspace: subject }));
8
+ })));
9
+ //#endregion
10
+ export { handler as default };
11
+
12
+ //# sourceMappingURL=chunk-switch-workspace.mjs.map
@@ -0,0 +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 { LayoutOperation } from '@dxos/app-toolkit';\nimport { Operation } from '@dxos/compute';\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"}
@@ -0,0 +1,21 @@
1
+ import { Capability } from "@dxos/app-framework";
2
+ import { meta } from "#meta";
3
+ //#region \0rolldown/runtime.js
4
+ var __defProp = Object.defineProperty;
5
+ var __exportAll = (all, no_symbols) => {
6
+ let target = {};
7
+ for (var name in all) __defProp(target, name, {
8
+ get: all[name],
9
+ enumerable: true
10
+ });
11
+ if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
12
+ return target;
13
+ };
14
+ //#endregion
15
+ //#region src/types/StorybookCapabilities.ts
16
+ var StorybookCapabilities_exports = /* @__PURE__ */ __exportAll({ LayoutState: () => LayoutState });
17
+ var LayoutState = Capability.make(`${meta.profile.key}.state`);
18
+ //#endregion
19
+ export { StorybookCapabilities_exports as n, LayoutState as t };
20
+
21
+ //# sourceMappingURL=chunk-types.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chunk-types.mjs","names":[],"sources":["../../src/types/StorybookCapabilities.ts"],"sourcesContent":["//\n// Copyright 2025 DXOS.org\n//\n\n// @import-as-namespace\n\nimport { type Atom } from '@effect-atom/atom';\n\nimport { Capability } from '@dxos/app-framework';\nimport { type LayoutOperation } from '@dxos/app-toolkit';\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.make<Atom.Writable<LayoutStateProps>>(`${meta.profile.key}.state`);\n"],"mappings":";;;;;;;;;;;;;;;;AAwCA,IAAa,cAAc,WAAW,KAAsC,GAAG,KAAK,QAAQ,IAAI,OAAO"}
@@ -0,0 +1,16 @@
1
+ import { t as updateState } from "./chunk-update-state.mjs";
2
+ import * as Effect from "effect/Effect";
3
+ import { LayoutOperation } from "@dxos/app-toolkit";
4
+ import { Operation } from "@dxos/compute";
5
+ //#region src/operations/update-complementary.ts
6
+ var handler = LayoutOperation.UpdateComplementary.pipe(Operation.withHandler(Effect.fnUntraced(function* ({ state }) {
7
+ yield* updateState((layout) => {
8
+ const next = state ?? layout.complementarySidebarState;
9
+ if (next !== layout.complementarySidebarState) return { complementarySidebarState: next };
10
+ return {};
11
+ });
12
+ })));
13
+ //#endregion
14
+ export { handler as default };
15
+
16
+ //# sourceMappingURL=chunk-update-complementary.mjs.map
@@ -0,0 +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 { LayoutOperation } from '@dxos/app-toolkit';\nimport { Operation } from '@dxos/compute';\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"}
@@ -0,0 +1,22 @@
1
+ import { t as updateState } from "./chunk-update-state.mjs";
2
+ import * as Effect from "effect/Effect";
3
+ import { LayoutOperation } from "@dxos/app-toolkit";
4
+ import { Operation } from "@dxos/compute";
5
+ //#region src/operations/update-dialog.ts
6
+ var handler = LayoutOperation.UpdateDialog.pipe(Operation.withHandler(Effect.fnUntraced(function* ({ subject, state, type, blockAlign, overlayClasses, overlayStyle, props }) {
7
+ yield* updateState(() => ({
8
+ dialogOpen: state ?? Boolean(subject),
9
+ dialogType: type ?? "default",
10
+ dialogBlockAlign: blockAlign ?? "center",
11
+ dialogOverlayClasses: overlayClasses,
12
+ dialogOverlayStyle: overlayStyle,
13
+ dialogContent: subject ? {
14
+ component: subject,
15
+ props
16
+ } : null
17
+ }));
18
+ })));
19
+ //#endregion
20
+ export { handler as default };
21
+
22
+ //# sourceMappingURL=chunk-update-dialog.mjs.map
@@ -0,0 +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 { LayoutOperation } from '@dxos/app-toolkit';\nimport { Operation } from '@dxos/compute';\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"}
@@ -0,0 +1,35 @@
1
+ import { t as updateState } from "./chunk-update-state.mjs";
2
+ import * as Effect from "effect/Effect";
3
+ import { LayoutOperation } from "@dxos/app-toolkit";
4
+ import { Operation } from "@dxos/compute";
5
+ //#region src/operations/update-popover.ts
6
+ var handler = LayoutOperation.UpdatePopover.pipe(Operation.withHandler(Effect.fnUntraced(function* (input) {
7
+ const { subject, state, side, kind, props } = input;
8
+ yield* updateState(() => {
9
+ const base = {
10
+ popoverKind: kind ?? "base",
11
+ popoverTitle: kind === "card" ? input.title : void 0,
12
+ popoverContent: typeof subject === "string" ? {
13
+ component: subject,
14
+ props
15
+ } : subject ? { subject } : void 0,
16
+ popoverOpen: state ?? Boolean(subject),
17
+ popoverSide: side
18
+ };
19
+ if ("variant" in input && input.variant === "virtual") return {
20
+ ...base,
21
+ popoverVariant: "virtual",
22
+ popoverAnchor: input.anchor
23
+ };
24
+ else if ("anchorId" in input) return {
25
+ ...base,
26
+ popoverVariant: "react",
27
+ popoverAnchorId: input.anchorId
28
+ };
29
+ return base;
30
+ });
31
+ })));
32
+ //#endregion
33
+ export { handler as default };
34
+
35
+ //# sourceMappingURL=chunk-update-popover.mjs.map
@@ -0,0 +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 { LayoutOperation } from '@dxos/app-toolkit';\nimport { Operation } from '@dxos/compute';\n\nimport { StorybookCapabilities } from '../types';\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":";;;;;AAYA,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"}
@@ -0,0 +1,16 @@
1
+ import { t as updateState } from "./chunk-update-state.mjs";
2
+ import * as Effect from "effect/Effect";
3
+ import { LayoutOperation } from "@dxos/app-toolkit";
4
+ import { Operation } from "@dxos/compute";
5
+ //#region src/operations/update-sidebar.ts
6
+ var handler = LayoutOperation.UpdateSidebar.pipe(Operation.withHandler(Effect.fnUntraced(function* ({ state }) {
7
+ yield* updateState((layout) => {
8
+ const next = state ?? layout.sidebarState;
9
+ if (next !== layout.sidebarState) return { sidebarState: next };
10
+ return {};
11
+ });
12
+ })));
13
+ //#endregion
14
+ export { handler as default };
15
+
16
+ //# sourceMappingURL=chunk-update-sidebar.mjs.map
@@ -0,0 +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 { LayoutOperation } from '@dxos/app-toolkit';\nimport { Operation } from '@dxos/compute';\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"}
@@ -0,0 +1,20 @@
1
+ import { t as LayoutState } from "./chunk-types.mjs";
2
+ import { Capabilities, Capability } from "@dxos/app-framework";
3
+ import * as Effect from "effect/Effect";
4
+ import * as Option from "effect/Option";
5
+ //#region src/operations/update-state.ts
6
+ var updateState = (fn) => Effect.gen(function* () {
7
+ const registry = yield* Capability.get(Capabilities.AtomRegistry);
8
+ const stateAtomOption = yield* Effect.option(Capability.get(LayoutState));
9
+ if (Option.isNone(stateAtomOption)) return;
10
+ const stateAtom = stateAtomOption.value;
11
+ const current = registry.get(stateAtom);
12
+ registry.set(stateAtom, {
13
+ ...current,
14
+ ...fn(current)
15
+ });
16
+ });
17
+ //#endregion
18
+ export { updateState as t };
19
+
20
+ //# sourceMappingURL=chunk-update-state.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chunk-update-state.mjs","names":[],"sources":["../../src/operations/update-state.ts"],"sourcesContent":["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\nimport * as Option from 'effect/Option';\n\nimport { Capabilities, Capability } from '@dxos/app-framework';\n\nimport { StorybookCapabilities } from '../types';\n\nexport const updateState = (\n fn: (state: StorybookCapabilities.LayoutStateProps) => Partial<StorybookCapabilities.LayoutStateProps>,\n) =>\n Effect.gen(function* () {\n const registry = yield* Capability.get(Capabilities.AtomRegistry);\n // LayoutState may be absent when the plugin manager has been disposed (e.g. after a storybook test\n // completes but a background Effect fiber is still in flight). Treat this as a no-op.\n const stateAtomOption = yield* Effect.option(Capability.get(StorybookCapabilities.LayoutState));\n if (Option.isNone(stateAtomOption)) {\n return;\n }\n const stateAtom = stateAtomOption.value;\n const current = registry.get(stateAtom);\n registry.set(stateAtom, { ...current, ...fn(current) });\n });\n"],"mappings":";;;;;AAWA,IAAa,eACX,OAEA,OAAO,IAAI,aAAa;CACtB,MAAM,WAAW,OAAO,WAAW,IAAI,aAAa,YAAY;CAGhE,MAAM,kBAAkB,OAAO,OAAO,OAAO,WAAW,IAAI,WAAiC,CAAC;CAC9F,IAAI,OAAO,OAAO,eAAe,GAC/B;CAEF,MAAM,YAAY,gBAAgB;CAClC,MAAM,UAAU,SAAS,IAAI,SAAS;CACtC,SAAS,IAAI,WAAW;EAAE,GAAG;EAAS,GAAG,GAAG,OAAO;CAAE,CAAC;AACxD,CAAC"}
@@ -0,0 +1,175 @@
1
+ import { AlertDialog, Button, Card, Dialog, Main, Popover, Toast, toLocalizedString, useTranslation } from "@dxos/react-ui";
2
+ import { meta } from "#meta";
3
+ import { RegistryContext, useAtomValue } from "@effect-atom/atom-react";
4
+ import { useCallback, useContext, useEffect, useRef, useState } from "react";
5
+ import { Surface, useCapability } from "@dxos/app-framework/ui";
6
+ import { AppSurface } from "@dxos/app-toolkit/ui";
7
+ import { Dnd } from "@dxos/react-ui-dnd";
8
+ import { descriptionMessage, mx } from "@dxos/ui-theme";
9
+ import { StorybookCapabilities } from "#types";
10
+ import { jsx, jsxs } from "react/jsx-runtime";
11
+ //#region src/components/Layout/Layout.tsx
12
+ var debounce_delay = 100;
13
+ var StoryToast = ({ toast, onDismiss }) => {
14
+ const { t } = useTranslation(meta.profile.key);
15
+ return /* @__PURE__ */ jsxs(Toast.Root, {
16
+ "data-testid": toast.id,
17
+ defaultOpen: true,
18
+ duration: toast.duration,
19
+ onOpenChange: (open) => {
20
+ if (!open) onDismiss(toast.id);
21
+ },
22
+ children: [
23
+ /* @__PURE__ */ jsx(Toast.Title, {
24
+ icon: toast.icon,
25
+ onClose: toast.closeLabel ? () => onDismiss(toast.id) : void 0,
26
+ children: toast.title && /* @__PURE__ */ jsx("span", { children: toLocalizedString(toast.title, t) })
27
+ }),
28
+ toast.description && /* @__PURE__ */ jsx(Toast.Description, { children: toLocalizedString(toast.description, t) }),
29
+ toast.onAction && toast.actionAlt && toast.actionLabel && /* @__PURE__ */ jsx(Toast.Actions, { children: /* @__PURE__ */ jsx(Toast.Action, {
30
+ altText: toLocalizedString(toast.actionAlt, t),
31
+ asChild: true,
32
+ children: /* @__PURE__ */ jsx(Button, {
33
+ variant: "primary",
34
+ onClick: () => toast.onAction?.(),
35
+ children: toLocalizedString(toast.actionLabel, t)
36
+ })
37
+ }) })
38
+ ]
39
+ });
40
+ };
41
+ var Layout = ({ children }) => {
42
+ const { t } = useTranslation(meta.profile.key);
43
+ const trigger = useRef(null);
44
+ const registry = useContext(RegistryContext);
45
+ const stateAtom = useCapability(StorybookCapabilities.LayoutState);
46
+ const layout = useAtomValue(stateAtom);
47
+ const [iter, setIter] = useState(0);
48
+ const [open, setOpen] = useState(false);
49
+ const debounceRef = useRef(null);
50
+ const updateState = useCallback((updates) => {
51
+ const current = registry.get(stateAtom);
52
+ registry.set(stateAtom, {
53
+ ...current,
54
+ ...updates
55
+ });
56
+ }, [registry, stateAtom]);
57
+ useEffect(() => {
58
+ setOpen(false);
59
+ if (debounceRef.current) {
60
+ clearTimeout(debounceRef.current);
61
+ debounceRef.current = null;
62
+ }
63
+ trigger.current = layout.popoverAnchor ?? null;
64
+ setIter((iter) => iter + 1);
65
+ if (layout.popoverOpen) debounceRef.current = setTimeout(() => setOpen(true), debounce_delay);
66
+ }, [
67
+ layout.popoverAnchor,
68
+ layout.popoverContent,
69
+ layout.popoverOpen
70
+ ]);
71
+ const handleClose = useCallback(() => {
72
+ setOpen(false);
73
+ updateState({
74
+ popoverOpen: false,
75
+ popoverAnchor: void 0,
76
+ popoverAnchorId: void 0,
77
+ popoverSide: void 0
78
+ });
79
+ }, [updateState]);
80
+ const handleInteractOutside = useCallback((event) => {
81
+ if (event.type === "dismissableLayer.focusOutside" && event.currentTarget?.classList.contains("cm-content")) event.preventDefault();
82
+ else handleClose();
83
+ }, [handleClose]);
84
+ const handleDismissToast = useCallback((id) => {
85
+ updateState({ toasts: layout.toasts.filter((toast) => toast.id !== id) });
86
+ }, [updateState, layout.toasts]);
87
+ const DialogRoot = layout.dialogType === "alert" ? AlertDialog.Root : Dialog.Root;
88
+ const DialogOverlay = layout.dialogType === "alert" ? AlertDialog.Overlay : Dialog.Overlay;
89
+ return /* @__PURE__ */ jsx(Toast.Provider, { children: /* @__PURE__ */ jsxs("div", {
90
+ className: "fixed inset-0 flex overflow-hidden",
91
+ children: [
92
+ /* @__PURE__ */ jsx(Dnd.Root, { children: /* @__PURE__ */ jsxs(Popover.Root, {
93
+ open,
94
+ children: [
95
+ /* @__PURE__ */ jsx(Main.Root, {
96
+ navigationSidebarState: layout.sidebarState,
97
+ complementarySidebarState: layout.complementarySidebarState,
98
+ onNavigationSidebarStateChange: (next) => updateState({ sidebarState: next }),
99
+ onComplementarySidebarStateChange: (next) => updateState({ complementarySidebarState: next }),
100
+ children
101
+ }),
102
+ /* @__PURE__ */ jsx(DialogRoot, {
103
+ modal: layout.dialogBlockAlign !== "end",
104
+ open: layout.dialogOpen,
105
+ onOpenChange: (nextOpen) => updateState({ dialogOpen: nextOpen }),
106
+ children: layout.dialogBlockAlign === "end" ? /* @__PURE__ */ jsx(Surface.Surface, {
107
+ type: AppSurface.Dialog,
108
+ data: layout.dialogContent,
109
+ limit: 1,
110
+ fallback: ErrorFallback,
111
+ placeholder: /* @__PURE__ */ jsx("div", {})
112
+ }) : /* @__PURE__ */ jsx(DialogOverlay, {
113
+ blockAlign: layout.dialogBlockAlign,
114
+ classNames: layout.dialogOverlayClasses,
115
+ style: layout.dialogOverlayStyle,
116
+ children: /* @__PURE__ */ jsx(Surface.Surface, {
117
+ type: AppSurface.Dialog,
118
+ data: layout.dialogContent,
119
+ limit: 1,
120
+ fallback: ErrorFallback
121
+ })
122
+ })
123
+ }),
124
+ /* @__PURE__ */ jsx(Popover.VirtualTrigger, { virtualRef: trigger }, iter),
125
+ /* @__PURE__ */ jsx(Popover.Portal, { children: /* @__PURE__ */ jsxs(Popover.Content, {
126
+ side: layout.popoverSide,
127
+ onOpenAutoFocus: (event) => event.preventDefault(),
128
+ onInteractOutside: handleInteractOutside,
129
+ onEscapeKeyDown: handleInteractOutside,
130
+ sticky: "always",
131
+ hideWhenDetached: true,
132
+ children: [/* @__PURE__ */ jsxs(Popover.Viewport, { children: [layout.popoverKind === "card" && /* @__PURE__ */ jsxs(Card.Root, { children: [/* @__PURE__ */ jsxs(Card.Header, { children: [
133
+ /* @__PURE__ */ jsx(Card.DragHandle, {}),
134
+ layout.popoverTitle ? /* @__PURE__ */ jsx(Card.Title, { children: toLocalizedString(layout.popoverTitle, t) }) : /* @__PURE__ */ jsx("span", {}),
135
+ /* @__PURE__ */ jsx(Card.ActionIconButton, {
136
+ action: "close",
137
+ onClick: handleClose
138
+ })
139
+ ] }), /* @__PURE__ */ jsx(Surface.Surface, {
140
+ type: AppSurface.CardContent,
141
+ data: layout.popoverContent,
142
+ limit: 1
143
+ })] }), (layout.popoverKind === "base" || layout.popoverKind === "rename") && /* @__PURE__ */ jsx(Surface.Surface, {
144
+ type: AppSurface.Popover,
145
+ data: layout.popoverContent,
146
+ limit: 1
147
+ })] }), /* @__PURE__ */ jsx(Popover.Arrow, {})]
148
+ }) })
149
+ ]
150
+ }) }),
151
+ layout.toasts.map((toast) => /* @__PURE__ */ jsx(StoryToast, {
152
+ toast,
153
+ onDismiss: handleDismissToast
154
+ }, toast.id)),
155
+ /* @__PURE__ */ jsx(Toast.Viewport, {})
156
+ ]
157
+ }) });
158
+ };
159
+ var ErrorFallback = ({ error }) => {
160
+ const { t } = useTranslation(meta.profile.key);
161
+ const errorString = error?.toString() ?? "";
162
+ return /* @__PURE__ */ jsx("div", {
163
+ role: "alert",
164
+ "data-testid": "error-boundary-fallback",
165
+ className: mx("overflow-auto p-8 dx-attention-surface grid place-items-center"),
166
+ children: /* @__PURE__ */ jsx("p", {
167
+ className: mx(descriptionMessage, "break-words rounded-md p-8", errorString.length < 256 && "text-lg"),
168
+ children: error ? errorString : t("error-fallback.message")
169
+ })
170
+ });
171
+ };
172
+ //#endregion
173
+ export { ErrorFallback, Layout };
174
+
175
+ //# sourceMappingURL=components.mjs.map