@dxos/plugin-testing 0.8.4-main.d05673bc65 → 0.8.4-main.dfabb4ec29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/neutral/StorybookPlugin.mjs +10 -0
- package/dist/lib/neutral/StorybookPlugin.mjs.map +7 -0
- package/dist/lib/neutral/add-toast-Z2RXG4RX.mjs +23 -0
- package/dist/lib/neutral/add-toast-Z2RXG4RX.mjs.map +7 -0
- package/dist/lib/neutral/capabilities/index.mjs +11 -0
- package/dist/lib/neutral/capabilities/index.mjs.map +7 -0
- package/dist/lib/neutral/chunk-7UPIIIZM.mjs +22 -0
- package/dist/lib/neutral/chunk-7UPIIIZM.mjs.map +7 -0
- package/dist/lib/neutral/chunk-E4LBVPH5.mjs +8 -0
- package/dist/lib/neutral/chunk-E4LBVPH5.mjs.map +7 -0
- package/dist/lib/neutral/chunk-J5LGTIGS.mjs +10 -0
- package/dist/lib/neutral/chunk-J5LGTIGS.mjs.map +7 -0
- package/dist/lib/neutral/chunk-NZ2VT6N2.mjs +17 -0
- package/dist/lib/neutral/chunk-NZ2VT6N2.mjs.map +7 -0
- package/dist/lib/neutral/chunk-R7AV233N.mjs +31 -0
- package/dist/lib/neutral/chunk-R7AV233N.mjs.map +7 -0
- package/dist/lib/neutral/chunk-ULNF6GTG.mjs +21 -0
- package/dist/lib/neutral/chunk-ULNF6GTG.mjs.map +7 -0
- package/dist/lib/{browser/chunk-NWOKPVNQ.mjs → neutral/chunk-ZVN23V74.mjs} +2 -7
- package/dist/lib/neutral/chunk-ZVN23V74.mjs.map +7 -0
- package/dist/lib/neutral/close-L3FBJQ3J.mjs +12 -0
- package/dist/lib/neutral/close-L3FBJQ3J.mjs.map +7 -0
- package/dist/lib/{node-esm → neutral/components}/index.mjs +53 -76
- package/dist/lib/neutral/components/index.mjs.map +7 -0
- package/dist/lib/neutral/core.mjs +8 -0
- package/dist/lib/neutral/core.mjs.map +7 -0
- package/dist/lib/neutral/harness.mjs +37 -0
- package/dist/lib/neutral/harness.mjs.map +7 -0
- package/dist/lib/neutral/index.mjs +20 -0
- package/dist/lib/neutral/index.mjs.map +7 -0
- package/dist/lib/neutral/meta.json +1 -0
- package/dist/lib/neutral/meta.mjs +8 -0
- package/dist/lib/neutral/meta.mjs.map +7 -0
- package/dist/lib/neutral/open-WBONYQ47.mjs +14 -0
- package/dist/lib/neutral/open-WBONYQ47.mjs.map +7 -0
- package/dist/lib/neutral/operation-handler-LQIWHQVY.mjs +13 -0
- package/dist/lib/neutral/operation-handler-LQIWHQVY.mjs.map +7 -0
- package/dist/lib/neutral/operations/index.mjs +8 -0
- package/dist/lib/neutral/operations/index.mjs.map +7 -0
- package/dist/lib/neutral/plugin.mjs +16 -0
- package/dist/lib/neutral/plugin.mjs.map +7 -0
- package/dist/lib/neutral/scroll-into-view-BKOOOECC.mjs +12 -0
- package/dist/lib/neutral/scroll-into-view-BKOOOECC.mjs.map +7 -0
- package/dist/lib/neutral/set-layout-mode-2KHD2AEY.mjs +12 -0
- package/dist/lib/neutral/set-layout-mode-2KHD2AEY.mjs.map +7 -0
- package/dist/lib/{browser/state-TCYYH5JN.mjs → neutral/state-AJ62JEEG.mjs} +6 -6
- package/dist/lib/neutral/state-AJ62JEEG.mjs.map +7 -0
- package/dist/lib/neutral/switch-workspace-SAT2NGXV.mjs +20 -0
- package/dist/lib/neutral/switch-workspace-SAT2NGXV.mjs.map +7 -0
- package/dist/lib/neutral/types/index.mjs +8 -0
- package/dist/lib/neutral/types/index.mjs.map +7 -0
- package/dist/lib/neutral/update-complementary-JP2OL73Z.mjs +26 -0
- package/dist/lib/neutral/update-complementary-JP2OL73Z.mjs.map +7 -0
- package/dist/lib/neutral/update-dialog-MX6IKKJX.mjs +28 -0
- package/dist/lib/neutral/update-dialog-MX6IKKJX.mjs.map +7 -0
- package/dist/lib/neutral/update-popover-DOORE3TD.mjs +46 -0
- package/dist/lib/neutral/update-popover-DOORE3TD.mjs.map +7 -0
- package/dist/lib/neutral/update-sidebar-LWQ3IA6S.mjs +26 -0
- package/dist/lib/neutral/update-sidebar-LWQ3IA6S.mjs.map +7 -0
- package/dist/types/src/StorybookPlugin.d.ts +3 -2
- package/dist/types/src/StorybookPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +15 -2
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/operation-handler.d.ts +6 -0
- package/dist/types/src/capabilities/operation-handler.d.ts.map +1 -0
- package/dist/types/src/capabilities/{state/state.d.ts → state.d.ts} +3 -3
- package/dist/types/src/capabilities/state.d.ts.map +1 -0
- package/dist/types/src/components/Layout/Layout.d.ts.map +1 -1
- package/dist/types/src/core.d.ts +1 -7
- package/dist/types/src/core.d.ts.map +1 -1
- package/dist/types/src/harness.d.ts +20 -0
- package/dist/types/src/harness.d.ts.map +1 -0
- package/dist/types/src/index.d.ts +1 -0
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/operations/add-toast.d.ts +5 -0
- package/dist/types/src/operations/add-toast.d.ts.map +1 -0
- package/dist/types/src/operations/close.d.ts +5 -0
- package/dist/types/src/operations/close.d.ts.map +1 -0
- package/dist/types/src/operations/index.d.ts +3 -0
- package/dist/types/src/operations/index.d.ts.map +1 -0
- package/dist/types/src/operations/open.d.ts +5 -0
- package/dist/types/src/operations/open.d.ts.map +1 -0
- package/dist/types/src/operations/scroll-into-view.d.ts +5 -0
- package/dist/types/src/operations/scroll-into-view.d.ts.map +1 -0
- package/dist/types/src/operations/set-layout-mode.d.ts +5 -0
- package/dist/types/src/operations/set-layout-mode.d.ts.map +1 -0
- package/dist/types/src/operations/switch-workspace.d.ts +5 -0
- package/dist/types/src/operations/switch-workspace.d.ts.map +1 -0
- package/dist/types/src/operations/update-complementary.d.ts +5 -0
- package/dist/types/src/operations/update-complementary.d.ts.map +1 -0
- package/dist/types/src/operations/update-dialog.d.ts +5 -0
- package/dist/types/src/operations/update-dialog.d.ts.map +1 -0
- package/dist/types/src/operations/update-popover.d.ts +5 -0
- package/dist/types/src/operations/update-popover.d.ts.map +1 -0
- package/dist/types/src/operations/update-sidebar.d.ts +5 -0
- package/dist/types/src/operations/update-sidebar.d.ts.map +1 -0
- package/dist/types/src/operations/update-state.d.ts +5 -0
- package/dist/types/src/operations/update-state.d.ts.map +1 -0
- package/dist/types/src/plugin.d.ts +5 -0
- package/dist/types/src/plugin.d.ts.map +1 -0
- package/dist/types/src/types/{capabilities.d.ts → StorybookCapabilities.d.ts} +3 -1
- package/dist/types/src/types/StorybookCapabilities.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +1 -1
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +60 -19
- package/src/StorybookPlugin.ts +10 -8
- package/src/capabilities/index.ts +8 -2
- package/src/capabilities/operation-handler.ts +16 -0
- package/src/capabilities/{state/state.tsx → state.tsx} +9 -5
- package/src/components/Layout/Layout.tsx +135 -75
- package/src/core.ts +19 -9
- package/src/harness.ts +52 -0
- package/src/index.ts +6 -0
- package/src/operations/add-toast.ts +22 -0
- package/src/operations/close.ts +14 -0
- package/src/operations/index.ts +18 -0
- package/src/operations/open.ts +18 -0
- package/src/operations/scroll-into-view.ts +14 -0
- package/src/operations/set-layout-mode.ts +14 -0
- package/src/operations/switch-workspace.ts +20 -0
- package/src/operations/update-complementary.ts +27 -0
- package/src/operations/update-dialog.ts +27 -0
- package/src/operations/update-popover.ts +37 -0
- package/src/operations/update-sidebar.ts +26 -0
- package/src/operations/update-state.ts +19 -0
- package/src/plugin.ts +12 -0
- package/src/types/{capabilities.ts → StorybookCapabilities.ts} +6 -1
- package/src/types/index.ts +1 -1
- package/dist/lib/browser/chunk-NWOKPVNQ.mjs.map +0 -7
- package/dist/lib/browser/index.mjs +0 -205
- package/dist/lib/browser/index.mjs.map +0 -7
- package/dist/lib/browser/meta.json +0 -1
- package/dist/lib/browser/operation-resolver-SR4GZ7Q5.mjs +0 -112
- package/dist/lib/browser/operation-resolver-SR4GZ7Q5.mjs.map +0 -7
- package/dist/lib/browser/state-TCYYH5JN.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-NWN7D2LS.mjs +0 -23
- package/dist/lib/node-esm/chunk-NWN7D2LS.mjs.map +0 -7
- package/dist/lib/node-esm/index.mjs.map +0 -7
- package/dist/lib/node-esm/meta.json +0 -1
- package/dist/lib/node-esm/operation-resolver-A6XLCTWX.mjs +0 -113
- package/dist/lib/node-esm/operation-resolver-A6XLCTWX.mjs.map +0 -7
- package/dist/lib/node-esm/state-ZJEK6SP7.mjs +0 -44
- package/dist/lib/node-esm/state-ZJEK6SP7.mjs.map +0 -7
- package/dist/types/src/capabilities/operation-resolver/index.d.ts +0 -3
- package/dist/types/src/capabilities/operation-resolver/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts +0 -5
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts.map +0 -1
- package/dist/types/src/capabilities/state/index.d.ts +0 -14
- package/dist/types/src/capabilities/state/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/state/state.d.ts.map +0 -1
- package/dist/types/src/types/capabilities.d.ts.map +0 -1
- package/src/capabilities/operation-resolver/index.ts +0 -7
- package/src/capabilities/operation-resolver/operation-resolver.ts +0 -99
- package/src/capabilities/state/index.ts +0 -7
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import {
|
|
2
|
+
updateState
|
|
3
|
+
} from "./chunk-ULNF6GTG.mjs";
|
|
4
|
+
import "./chunk-NZ2VT6N2.mjs";
|
|
5
|
+
import "./chunk-J5LGTIGS.mjs";
|
|
6
|
+
|
|
7
|
+
// src/operations/add-toast.ts
|
|
8
|
+
import * as Effect from "effect/Effect";
|
|
9
|
+
import { LayoutOperation } from "@dxos/app-toolkit";
|
|
10
|
+
import { Operation } from "@dxos/compute";
|
|
11
|
+
var handler = LayoutOperation.AddToast.pipe(Operation.withHandler(Effect.fnUntraced(function* (input) {
|
|
12
|
+
yield* updateState((state) => ({
|
|
13
|
+
toasts: [
|
|
14
|
+
...state.toasts,
|
|
15
|
+
input
|
|
16
|
+
]
|
|
17
|
+
}));
|
|
18
|
+
})));
|
|
19
|
+
var add_toast_default = handler;
|
|
20
|
+
export {
|
|
21
|
+
add_toast_default as default
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=add-toast-Z2RXG4RX.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/operations/add-toast.ts"],
|
|
4
|
+
"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"],
|
|
5
|
+
"mappings": ";;;;;;;AAIA,YAAYA,YAAY;AAExB,SAASC,uBAAuB;AAChC,SAASC,iBAAiB;AAI1B,IAAMC,UAAkEC,gBAAgBC,SAASC,KAC/FC,UAAUC,YACDC,kBAAW,WAAWC,OAAK;AAChC,SAAOC,YAAY,CAACC,WAAW;IAC7BC,QAAQ;SAAID,MAAMC;MAAQH;;EAC5B,EAAA;AACF,CAAA,CAAA,CAAA;AAIJ,IAAA,oBAAeP;",
|
|
6
|
+
"names": ["Effect", "LayoutOperation", "Operation", "handler", "LayoutOperation", "AddToast", "pipe", "Operation", "withHandler", "fnUntraced", "input", "updateState", "state", "toasts"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import "../chunk-J5LGTIGS.mjs";
|
|
2
|
+
|
|
3
|
+
// src/capabilities/index.ts
|
|
4
|
+
import { Capability } from "@dxos/app-framework";
|
|
5
|
+
var OperationHandler = Capability.lazy("OperationHandler", () => import("../operation-handler-LQIWHQVY.mjs"));
|
|
6
|
+
var State = Capability.lazy("State", () => import("../state-AJ62JEEG.mjs"));
|
|
7
|
+
export {
|
|
8
|
+
OperationHandler,
|
|
9
|
+
State
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/capabilities/index.ts"],
|
|
4
|
+
"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"],
|
|
5
|
+
"mappings": ";;;AAIA,SAASA,kBAAkB;AAGpB,IAAMC,mBAAmBD,WAAWE,KACzC,oBACA,MAAM,OAAO,mCAAA,CAAA;AAER,IAAMC,QAAQH,WAAWE,KAAK,SAAS,MAAM,OAAO,uBAAA,CAAA;",
|
|
6
|
+
"names": ["Capability", "OperationHandler", "lazy", "State"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// src/core.ts
|
|
2
|
+
import { OperationPlugin, RuntimePlugin } from "@dxos/app-framework";
|
|
3
|
+
import { AttentionPlugin } from "@dxos/plugin-attention/testing";
|
|
4
|
+
import { GraphPlugin } from "@dxos/plugin-graph/testing";
|
|
5
|
+
import { SettingsPlugin } from "@dxos/plugin-settings/testing";
|
|
6
|
+
import { ThemePlugin } from "@dxos/plugin-theme/plugin";
|
|
7
|
+
import { defaultTx } from "@dxos/ui-theme";
|
|
8
|
+
var corePlugins = () => [
|
|
9
|
+
AttentionPlugin(),
|
|
10
|
+
GraphPlugin(),
|
|
11
|
+
OperationPlugin(),
|
|
12
|
+
RuntimePlugin(),
|
|
13
|
+
SettingsPlugin(),
|
|
14
|
+
ThemePlugin({
|
|
15
|
+
tx: defaultTx
|
|
16
|
+
})
|
|
17
|
+
];
|
|
18
|
+
|
|
19
|
+
export {
|
|
20
|
+
corePlugins
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=chunk-7UPIIIZM.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/core.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { OperationPlugin, type Plugin, RuntimePlugin } from '@dxos/app-framework';\n// `/plugin` entrypoints — `@dxos/plugin-attention/plugin`, `/plugin-client/plugin`,\n// `/plugin-graph/plugin`, `/plugin-preview/plugin`, `/plugin-settings/plugin`,\n// `/plugin-space/plugin`, `/plugin-theme/plugin` — re-export the plugin eagerly\n// (without `Plugin.lazy`). The default `.` export wraps each plugin in a lazy\n// stub (`() => import('./XPlugin')`), which webkit cannot reliably resolve\n// under vite-dev: the dynamic-import promise can settle with a\n// partially-evaluated namespace, throwing `ReferenceError: Cannot access\n// 'default' before initialization` from the loader's `mod.default` access.\n// Storybook runs inside `storybook dev` (vite-dev) and is currently the only\n// host that hits this. Production hosts (composer-app via `vite preview`)\n// keep using the lazy `.` exports and their associated code splitting.\n//\n// Use these `/plugin` 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/plugin.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/plugin';\nimport { defaultTx } from '@dxos/ui-theme';\n\n/**\n * Core plugins for testing/storybook environments.\n * NOTE: Does not include SpacePlugin to avoid circular dependencies.\n * Import SpacePlugin directly in your stories if needed.\n */\nexport const corePlugins = (): Plugin.Plugin[] => [\n AttentionPlugin(),\n GraphPlugin(),\n OperationPlugin(),\n RuntimePlugin(),\n SettingsPlugin(),\n ThemePlugin({ tx: defaultTx }),\n];\n"],
|
|
5
|
+
"mappings": ";AAIA,SAASA,iBAA8BC,qBAAqB;AAgB5D,SAASC,uBAAuB;AAChC,SAASC,mBAAmB;AAC5B,SAASC,sBAAsB;AAC/B,SAASC,mBAAmB;AAC5B,SAASC,iBAAiB;AAOnB,IAAMC,cAAc,MAAuB;EAChDL,gBAAAA;EACAC,YAAAA;EACAH,gBAAAA;EACAC,cAAAA;EACAG,eAAAA;EACAC,YAAY;IAAEG,IAAIF;EAAU,CAAA;;",
|
|
6
|
+
"names": ["OperationPlugin", "RuntimePlugin", "AttentionPlugin", "GraphPlugin", "SettingsPlugin", "ThemePlugin", "defaultTx", "corePlugins", "tx"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// src/operations/index.ts
|
|
2
|
+
import { OperationHandlerSet } from "@dxos/compute";
|
|
3
|
+
var TestingOperationHandlerSet = OperationHandlerSet.lazy(() => import("./add-toast-Z2RXG4RX.mjs"), () => import("./close-L3FBJQ3J.mjs"), () => import("./open-WBONYQ47.mjs"), () => import("./scroll-into-view-BKOOOECC.mjs"), () => import("./set-layout-mode-2KHD2AEY.mjs"), () => import("./switch-workspace-SAT2NGXV.mjs"), () => import("./update-complementary-JP2OL73Z.mjs"), () => import("./update-dialog-MX6IKKJX.mjs"), () => import("./update-popover-DOORE3TD.mjs"), () => import("./update-sidebar-LWQ3IA6S.mjs"));
|
|
4
|
+
|
|
5
|
+
export {
|
|
6
|
+
TestingOperationHandlerSet
|
|
7
|
+
};
|
|
8
|
+
//# sourceMappingURL=chunk-E4LBVPH5.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/operations/index.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { OperationHandlerSet } from '@dxos/compute';\n\nexport const TestingOperationHandlerSet = OperationHandlerSet.lazy(\n () => import('./add-toast'),\n () => import('./close'),\n () => import('./open'),\n () => import('./scroll-into-view'),\n () => import('./set-layout-mode'),\n () => import('./switch-workspace'),\n () => import('./update-complementary'),\n () => import('./update-dialog'),\n () => import('./update-popover'),\n () => import('./update-sidebar'),\n);\n"],
|
|
5
|
+
"mappings": ";AAIA,SAASA,2BAA2B;AAE7B,IAAMC,6BAA6BD,oBAAoBE,KAC5D,MAAM,OAAO,0BAAA,GACb,MAAM,OAAO,sBAAA,GACb,MAAM,OAAO,qBAAA,GACb,MAAM,OAAO,iCAAA,GACb,MAAM,OAAO,gCAAA,GACb,MAAM,OAAO,iCAAA,GACb,MAAM,OAAO,qCAAA,GACb,MAAM,OAAO,8BAAA,GACb,MAAM,OAAO,+BAAA,GACb,MAAM,OAAO,+BAAA,CAAA;",
|
|
6
|
+
"names": ["OperationHandlerSet", "TestingOperationHandlerSet", "lazy"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import {
|
|
2
|
+
__export
|
|
3
|
+
} from "./chunk-J5LGTIGS.mjs";
|
|
4
|
+
|
|
5
|
+
// src/types/StorybookCapabilities.ts
|
|
6
|
+
var StorybookCapabilities_exports = {};
|
|
7
|
+
__export(StorybookCapabilities_exports, {
|
|
8
|
+
LayoutState: () => LayoutState
|
|
9
|
+
});
|
|
10
|
+
import { Capability } from "@dxos/app-framework";
|
|
11
|
+
import { meta } from "#meta";
|
|
12
|
+
var LayoutState = Capability.make(`${meta.id}.state`);
|
|
13
|
+
|
|
14
|
+
export {
|
|
15
|
+
StorybookCapabilities_exports
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=chunk-NZ2VT6N2.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/types/StorybookCapabilities.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\n// @import-as-namespace\n\nimport { type Atom } from '@effect-atom/atom-react';\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';\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.id}.state`);\n"],
|
|
5
|
+
"mappings": ";;;;;AAAA;;;;AAQA,SAASA,kBAAkB;AAI3B,SAASC,YAAY;AA4Bd,IAAMC,cAAcF,WAAWG,KAAsC,GAAGF,KAAKG,EAAE,QAAQ;",
|
|
6
|
+
"names": ["Capability", "meta", "LayoutState", "make", "id"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// src/StorybookPlugin.ts
|
|
2
|
+
import * as Effect from "effect/Effect";
|
|
3
|
+
import { ActivationEvents, Capabilities, Capability, Plugin } from "@dxos/app-framework";
|
|
4
|
+
import { AppActivationEvents, AppPlugin } from "@dxos/app-toolkit";
|
|
5
|
+
import { OperationHandler, State } from "#capabilities";
|
|
6
|
+
import { Layout } from "#components";
|
|
7
|
+
import { meta } from "#meta";
|
|
8
|
+
var StorybookPlugin = Plugin.define(meta).pipe(AppPlugin.addOperationHandlerModule({
|
|
9
|
+
activate: OperationHandler
|
|
10
|
+
}), AppPlugin.addReactContextModule({
|
|
11
|
+
activate: () => Effect.succeed(Capability.contributes(Capabilities.ReactContext, {
|
|
12
|
+
id: "storybook-layout",
|
|
13
|
+
context: Layout
|
|
14
|
+
}))
|
|
15
|
+
}), Plugin.addModule(({ initialState }) => ({
|
|
16
|
+
id: Capability.getModuleTag(State),
|
|
17
|
+
activatesOn: ActivationEvents.Startup,
|
|
18
|
+
firesAfterActivation: [
|
|
19
|
+
AppActivationEvents.LayoutReady
|
|
20
|
+
],
|
|
21
|
+
activate: () => State({
|
|
22
|
+
initialState
|
|
23
|
+
})
|
|
24
|
+
})), Plugin.make);
|
|
25
|
+
var StorybookPlugin_default = StorybookPlugin;
|
|
26
|
+
|
|
27
|
+
export {
|
|
28
|
+
StorybookPlugin,
|
|
29
|
+
StorybookPlugin_default
|
|
30
|
+
};
|
|
31
|
+
//# sourceMappingURL=chunk-R7AV233N.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/StorybookPlugin.ts"],
|
|
4
|
+
"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"],
|
|
5
|
+
"mappings": ";AAIA,YAAYA,YAAY;AAExB,SAASC,kBAAkBC,cAAcC,YAAYC,cAAc;AACnE,SAASC,qBAAqBC,iBAAiB;AAE/C,SAASC,kBAAkBC,aAAa;AACxC,SAASC,cAAc;AACvB,SAASC,YAAY;AAOd,IAAMC,kBAAkBP,OAAOQ,OAA+BF,IAAAA,EAAMG,KACzEP,UAAUQ,0BAA0B;EAClCC,UAAUR;AACZ,CAAA,GACAD,UAAUU,sBAAsB;EAC9BD,UAAU,MACDE,eACLd,WAAWe,YAAYhB,aAAaiB,cAAc;IAChDC,IAAI;IACJC,SAASZ;EACX,CAAA,CAAA;AAEN,CAAA,GACAL,OAAOkB,UAAU,CAAC,EAAEC,aAAY,OAAQ;EACtCH,IAAIjB,WAAWqB,aAAahB,KAAAA;EAC5BiB,aAAaxB,iBAAiByB;EAC9BC,sBAAsB;IAACtB,oBAAoBuB;;EAC3Cb,UAAU,MAAMP,MAAM;IAAEe;EAAa,CAAA;AACvC,EAAA,GACAnB,OAAOyB,IAAI;AAGb,IAAA,0BAAelB;",
|
|
6
|
+
"names": ["Effect", "ActivationEvents", "Capabilities", "Capability", "Plugin", "AppActivationEvents", "AppPlugin", "OperationHandler", "State", "Layout", "meta", "StorybookPlugin", "define", "pipe", "addOperationHandlerModule", "activate", "addReactContextModule", "succeed", "contributes", "ReactContext", "id", "context", "addModule", "initialState", "getModuleTag", "activatesOn", "Startup", "firesAfterActivation", "LayoutReady", "make"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import {
|
|
2
|
+
StorybookCapabilities_exports
|
|
3
|
+
} from "./chunk-NZ2VT6N2.mjs";
|
|
4
|
+
|
|
5
|
+
// src/operations/update-state.ts
|
|
6
|
+
import * as Effect from "effect/Effect";
|
|
7
|
+
import { Capabilities, Capability } from "@dxos/app-framework";
|
|
8
|
+
var updateState = (fn) => Effect.gen(function* () {
|
|
9
|
+
const registry = yield* Capability.get(Capabilities.AtomRegistry);
|
|
10
|
+
const stateAtom = yield* Capability.get(StorybookCapabilities_exports.LayoutState);
|
|
11
|
+
const current = registry.get(stateAtom);
|
|
12
|
+
registry.set(stateAtom, {
|
|
13
|
+
...current,
|
|
14
|
+
...fn(current)
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
export {
|
|
19
|
+
updateState
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=chunk-ULNF6GTG.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/operations/update-state.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\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 const stateAtom = yield* Capability.get(StorybookCapabilities.LayoutState);\n const current = registry.get(stateAtom);\n registry.set(stateAtom, { ...current, ...fn(current) });\n });\n"],
|
|
5
|
+
"mappings": ";;;;;AAIA,YAAYA,YAAY;AAExB,SAASC,cAAcC,kBAAkB;AAIlC,IAAMC,cAAc,CACzBC,OAEOC,WAAI,aAAA;AACT,QAAMC,WAAW,OAAOC,WAAWC,IAAIC,aAAaC,YAAY;AAChE,QAAMC,YAAY,OAAOJ,WAAWC,IAAII,8BAAsBC,WAAW;AACzE,QAAMC,UAAUR,SAASE,IAAIG,SAAAA;AAC7BL,WAASS,IAAIJ,WAAW;IAAE,GAAGG;IAAS,GAAGV,GAAGU,OAAAA;EAAS,CAAA;AACvD,CAAA;",
|
|
6
|
+
"names": ["Effect", "Capabilities", "Capability", "updateState", "fn", "gen", "registry", "Capability", "get", "Capabilities", "AtomRegistry", "stateAtom", "StorybookCapabilities", "LayoutState", "current", "set"]
|
|
7
|
+
}
|
|
@@ -10,12 +10,7 @@ var meta = {
|
|
|
10
10
|
source: "https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-testing"
|
|
11
11
|
};
|
|
12
12
|
|
|
13
|
-
// src/types/capabilities.ts
|
|
14
|
-
import { Capability } from "@dxos/app-framework";
|
|
15
|
-
var LayoutState = Capability.make(`${meta.id}.state`);
|
|
16
|
-
|
|
17
13
|
export {
|
|
18
|
-
meta
|
|
19
|
-
LayoutState
|
|
14
|
+
meta
|
|
20
15
|
};
|
|
21
|
-
//# sourceMappingURL=chunk-
|
|
16
|
+
//# sourceMappingURL=chunk-ZVN23V74.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/meta.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { type Plugin } from '@dxos/app-framework';\nimport { trim } from '@dxos/util';\n\nexport const meta: Plugin.Meta = {\n id: 'org.dxos.plugin.storybook-layout',\n name: 'Storybook',\n description: trim`\n Development layout optimized for Storybook component testing and documentation.\n Provides specialized views for component development and design system exploration.\n `,\n source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-testing',\n};\n"],
|
|
5
|
+
"mappings": ";AAKA,SAASA,YAAY;AAEd,IAAMC,OAAoB;EAC/BC,IAAI;EACJC,MAAM;EACNC,aAAaJ;;;;EAIbK,QAAQ;AACV;",
|
|
6
|
+
"names": ["trim", "meta", "id", "name", "description", "source"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import "./chunk-J5LGTIGS.mjs";
|
|
2
|
+
|
|
3
|
+
// src/operations/close.ts
|
|
4
|
+
import * as Effect from "effect/Effect";
|
|
5
|
+
import { LayoutOperation } from "@dxos/app-toolkit";
|
|
6
|
+
import { Operation } from "@dxos/compute";
|
|
7
|
+
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
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/operations/close.ts"],
|
|
4
|
+
"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"],
|
|
5
|
+
"mappings": ";;;AAIA,YAAYA,YAAY;AAExB,SAASC,uBAAuB;AAChC,SAASC,iBAAiB;AAE1B,IAAMC,UAA+DF,gBAAgBG,MAAMC,KACzFH,UAAUI,YAAY,MAAaC,WAAI,CAAA;AAGzC,IAAA,gBAAeJ;",
|
|
6
|
+
"names": ["Effect", "LayoutOperation", "Operation", "handler", "Close", "pipe", "withHandler", "void"]
|
|
7
|
+
}
|
|
@@ -1,55 +1,48 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
LayoutState,
|
|
4
|
-
meta
|
|
5
|
-
} from "./chunk-NWN7D2LS.mjs";
|
|
6
|
-
|
|
7
|
-
// src/core.ts
|
|
8
|
-
import { OperationPlugin, RuntimePlugin } from "@dxos/app-framework";
|
|
9
|
-
import { AttentionPlugin } from "@dxos/plugin-attention";
|
|
10
|
-
import { ClientPlugin } from "@dxos/plugin-client";
|
|
11
|
-
import { GraphPlugin } from "@dxos/plugin-graph";
|
|
12
|
-
import { SettingsPlugin } from "@dxos/plugin-settings";
|
|
13
|
-
import { ThemePlugin } from "@dxos/plugin-theme";
|
|
14
|
-
import { defaultTx } from "@dxos/ui-theme";
|
|
15
|
-
var corePlugins = () => [
|
|
16
|
-
AttentionPlugin(),
|
|
17
|
-
GraphPlugin(),
|
|
18
|
-
OperationPlugin(),
|
|
19
|
-
RuntimePlugin(),
|
|
20
|
-
SettingsPlugin(),
|
|
21
|
-
ThemePlugin({
|
|
22
|
-
tx: defaultTx
|
|
23
|
-
})
|
|
24
|
-
];
|
|
25
|
-
|
|
26
|
-
// src/StorybookPlugin.ts
|
|
27
|
-
import * as Effect from "effect/Effect";
|
|
28
|
-
import { ActivationEvents, Capabilities, Capability as Capability3, Plugin } from "@dxos/app-framework";
|
|
29
|
-
import { AppActivationEvents, AppPlugin } from "@dxos/app-toolkit";
|
|
30
|
-
|
|
31
|
-
// src/capabilities/operation-resolver/index.ts
|
|
32
|
-
import { Capability } from "@dxos/app-framework";
|
|
33
|
-
var OperationResolver = Capability.lazy("OperationResolver", () => import("./operation-resolver-A6XLCTWX.mjs"));
|
|
34
|
-
|
|
35
|
-
// src/capabilities/state/index.ts
|
|
36
|
-
import { Capability as Capability2 } from "@dxos/app-framework";
|
|
37
|
-
var State = Capability2.lazy("State", () => import("./state-ZJEK6SP7.mjs"));
|
|
1
|
+
import "../chunk-J5LGTIGS.mjs";
|
|
38
2
|
|
|
39
3
|
// src/components/Layout/Layout.tsx
|
|
40
4
|
import { RegistryContext, useAtomValue } from "@effect-atom/atom-react";
|
|
41
5
|
import React, { useCallback, useContext, useEffect, useRef, useState } from "react";
|
|
42
6
|
import { Surface, useCapability } from "@dxos/app-framework/ui";
|
|
43
|
-
import {
|
|
7
|
+
import { AppSurface } from "@dxos/app-toolkit/ui";
|
|
8
|
+
import { AlertDialog, Button, Dialog, Icon, Main, Popover, Toast, toLocalizedString, useTranslation } from "@dxos/react-ui";
|
|
44
9
|
import { Card } from "@dxos/react-ui";
|
|
45
10
|
import { Mosaic } from "@dxos/react-ui-mosaic";
|
|
46
11
|
import { descriptionMessage, mx } from "@dxos/ui-theme";
|
|
12
|
+
import { meta } from "#meta";
|
|
13
|
+
import { StorybookCapabilities } from "#types";
|
|
47
14
|
var debounce_delay = 100;
|
|
15
|
+
var StoryToast = ({ toast, onDismiss }) => {
|
|
16
|
+
const { t } = useTranslation(meta.id);
|
|
17
|
+
return /* @__PURE__ */ React.createElement(Toast.Root, {
|
|
18
|
+
"data-testid": toast.id,
|
|
19
|
+
defaultOpen: true,
|
|
20
|
+
duration: toast.duration,
|
|
21
|
+
onOpenChange: (open) => {
|
|
22
|
+
if (!open) {
|
|
23
|
+
onDismiss(toast.id);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}, /* @__PURE__ */ React.createElement(Toast.Body, null, /* @__PURE__ */ React.createElement(Toast.Title, {
|
|
27
|
+
classNames: "items-center"
|
|
28
|
+
}, toast.icon && /* @__PURE__ */ React.createElement(Icon, {
|
|
29
|
+
icon: toast.icon,
|
|
30
|
+
classNames: "inline mr-1"
|
|
31
|
+
}), toast.title && /* @__PURE__ */ React.createElement("span", null, toLocalizedString(toast.title, t))), toast.description && /* @__PURE__ */ React.createElement(Toast.Description, null, toLocalizedString(toast.description, t))), /* @__PURE__ */ React.createElement(Toast.Actions, null, toast.onAction && toast.actionAlt && toast.actionLabel && /* @__PURE__ */ React.createElement(Toast.Action, {
|
|
32
|
+
altText: toLocalizedString(toast.actionAlt, t),
|
|
33
|
+
asChild: true
|
|
34
|
+
}, /* @__PURE__ */ React.createElement(Button, {
|
|
35
|
+
variant: "primary",
|
|
36
|
+
onClick: () => toast.onAction?.()
|
|
37
|
+
}, toLocalizedString(toast.actionLabel, t))), toast.closeLabel && /* @__PURE__ */ React.createElement(Toast.Close, {
|
|
38
|
+
asChild: true
|
|
39
|
+
}, /* @__PURE__ */ React.createElement(Button, null, toLocalizedString(toast.closeLabel, t)))));
|
|
40
|
+
};
|
|
48
41
|
var Layout = ({ children }) => {
|
|
49
42
|
const { t } = useTranslation(meta.id);
|
|
50
43
|
const trigger = useRef(null);
|
|
51
44
|
const registry = useContext(RegistryContext);
|
|
52
|
-
const stateAtom = useCapability(LayoutState);
|
|
45
|
+
const stateAtom = useCapability(StorybookCapabilities.LayoutState);
|
|
53
46
|
const layout = useAtomValue(stateAtom);
|
|
54
47
|
const [iter, setIter] = useState(0);
|
|
55
48
|
const [open, setOpen] = useState(false);
|
|
@@ -103,10 +96,17 @@ var Layout = ({ children }) => {
|
|
|
103
96
|
}, [
|
|
104
97
|
handleClose
|
|
105
98
|
]);
|
|
99
|
+
const handleDismissToast = useCallback((id) => {
|
|
100
|
+
updateState({
|
|
101
|
+
toasts: layout.toasts.filter((toast) => toast.id !== id)
|
|
102
|
+
});
|
|
103
|
+
}, [
|
|
104
|
+
updateState,
|
|
105
|
+
layout.toasts
|
|
106
|
+
]);
|
|
106
107
|
const DialogRoot = layout.dialogType === "alert" ? AlertDialog.Root : Dialog.Root;
|
|
107
108
|
const DialogOverlay = layout.dialogType === "alert" ? AlertDialog.Overlay : Dialog.Overlay;
|
|
108
|
-
return /* @__PURE__ */ React.createElement("div", {
|
|
109
|
-
role: "none",
|
|
109
|
+
return /* @__PURE__ */ React.createElement(Toast.Provider, null, /* @__PURE__ */ React.createElement("div", {
|
|
110
110
|
className: "fixed inset-0 flex overflow-hidden"
|
|
111
111
|
}, /* @__PURE__ */ React.createElement(Mosaic.Root, null, /* @__PURE__ */ React.createElement(Popover.Root, {
|
|
112
112
|
open
|
|
@@ -126,7 +126,7 @@ var Layout = ({ children }) => {
|
|
|
126
126
|
dialogOpen: nextOpen
|
|
127
127
|
})
|
|
128
128
|
}, layout.dialogBlockAlign === "end" ? /* @__PURE__ */ React.createElement(Surface.Surface, {
|
|
129
|
-
|
|
129
|
+
type: AppSurface.Dialog,
|
|
130
130
|
data: layout.dialogContent,
|
|
131
131
|
limit: 1,
|
|
132
132
|
fallback: ErrorFallback,
|
|
@@ -136,7 +136,7 @@ var Layout = ({ children }) => {
|
|
|
136
136
|
classNames: layout.dialogOverlayClasses,
|
|
137
137
|
style: layout.dialogOverlayStyle
|
|
138
138
|
}, /* @__PURE__ */ React.createElement(Surface.Surface, {
|
|
139
|
-
|
|
139
|
+
type: AppSurface.Dialog,
|
|
140
140
|
data: layout.dialogContent,
|
|
141
141
|
limit: 1,
|
|
142
142
|
fallback: ErrorFallback
|
|
@@ -152,14 +152,18 @@ var Layout = ({ children }) => {
|
|
|
152
152
|
}, /* @__PURE__ */ React.createElement(Popover.Viewport, null, layout.popoverKind === "card" && /* @__PURE__ */ React.createElement(Card.Root, null, /* @__PURE__ */ React.createElement(Card.Toolbar, null, /* @__PURE__ */ React.createElement("span", null), layout.popoverTitle ? /* @__PURE__ */ React.createElement(Card.Title, null, toLocalizedString(layout.popoverTitle, t)) : /* @__PURE__ */ React.createElement("span", null), /* @__PURE__ */ React.createElement(Card.CloseIconButton, {
|
|
153
153
|
onClick: handleClose
|
|
154
154
|
})), /* @__PURE__ */ React.createElement(Surface.Surface, {
|
|
155
|
-
|
|
155
|
+
type: AppSurface.Card,
|
|
156
156
|
data: layout.popoverContent,
|
|
157
157
|
limit: 1
|
|
158
158
|
})), layout.popoverKind === "base" && /* @__PURE__ */ React.createElement(Surface.Surface, {
|
|
159
|
-
|
|
159
|
+
type: AppSurface.Popover,
|
|
160
160
|
data: layout.popoverContent,
|
|
161
161
|
limit: 1
|
|
162
|
-
})), /* @__PURE__ */ React.createElement(Popover.Arrow, null))))))
|
|
162
|
+
})), /* @__PURE__ */ React.createElement(Popover.Arrow, null))))), layout.toasts.map((toast) => /* @__PURE__ */ React.createElement(StoryToast, {
|
|
163
|
+
key: toast.id,
|
|
164
|
+
toast,
|
|
165
|
+
onDismiss: handleDismissToast
|
|
166
|
+
})), /* @__PURE__ */ React.createElement(Toast.Viewport, null)));
|
|
163
167
|
};
|
|
164
168
|
var ErrorFallback = ({ error }) => {
|
|
165
169
|
const { t } = useTranslation(meta.id);
|
|
@@ -170,37 +174,10 @@ var ErrorFallback = ({ error }) => {
|
|
|
170
174
|
className: mx("overflow-auto p-8 dx-attention-surface grid place-items-center")
|
|
171
175
|
}, /* @__PURE__ */ React.createElement("p", {
|
|
172
176
|
className: mx(descriptionMessage, "break-words rounded-md p-8", errorString.length < 256 && "text-lg")
|
|
173
|
-
}, error ? errorString : t("error
|
|
177
|
+
}, error ? errorString : t("error-fallback.message")));
|
|
174
178
|
};
|
|
175
|
-
|
|
176
|
-
// src/StorybookPlugin.ts
|
|
177
|
-
var StorybookPlugin = Plugin.define(meta).pipe(AppPlugin.addOperationResolverModule({
|
|
178
|
-
activate: OperationResolver
|
|
179
|
-
}), AppPlugin.addReactContextModule({
|
|
180
|
-
activate: () => Effect.succeed(Capability3.contributes(Capabilities.ReactContext, {
|
|
181
|
-
id: "storybook-layout",
|
|
182
|
-
context: Layout
|
|
183
|
-
}))
|
|
184
|
-
}), Plugin.addModule(({ initialState }) => ({
|
|
185
|
-
id: Capability3.getModuleTag(State),
|
|
186
|
-
activatesOn: ActivationEvents.Startup,
|
|
187
|
-
activatesAfter: [
|
|
188
|
-
AppActivationEvents.LayoutReady
|
|
189
|
-
],
|
|
190
|
-
activate: () => State({
|
|
191
|
-
initialState
|
|
192
|
-
})
|
|
193
|
-
})), Plugin.make);
|
|
194
179
|
export {
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
GraphPlugin,
|
|
198
|
-
OperationPlugin,
|
|
199
|
-
RuntimePlugin,
|
|
200
|
-
SettingsPlugin,
|
|
201
|
-
StorybookPlugin,
|
|
202
|
-
ThemePlugin,
|
|
203
|
-
corePlugins,
|
|
204
|
-
meta
|
|
180
|
+
ErrorFallback,
|
|
181
|
+
Layout
|
|
205
182
|
};
|
|
206
183
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/components/Layout/Layout.tsx"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { RegistryContext, useAtomValue } from '@effect-atom/atom-react';\nimport React, { type PropsWithChildren, useCallback, useContext, useEffect, useRef, useState } from 'react';\n\nimport { Surface, useCapability } from '@dxos/app-framework/ui';\nimport { type LayoutOperation } from '@dxos/app-toolkit';\nimport { AppSurface } from '@dxos/app-toolkit/ui';\nimport {\n AlertDialog,\n Button,\n Dialog,\n Icon,\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 { Mosaic } from '@dxos/react-ui-mosaic';\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.id);\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.Body>\n <Toast.Title classNames='items-center'>\n {toast.icon && <Icon icon={toast.icon} classNames='inline mr-1' />}\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.Body>\n <Toast.Actions>\n {toast.onAction && toast.actionAlt && toast.actionLabel && (\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 )}\n {toast.closeLabel && (\n <Toast.Close asChild>\n <Button>{toLocalizedString(toast.closeLabel, t)}</Button>\n </Toast.Close>\n )}\n </Toast.Actions>\n </Toast.Root>\n );\n};\n\nexport const Layout = ({ children }: PropsWithChildren<{}>) => {\n const { t } = useTranslation(meta.id);\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 <Mosaic.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 onInteractOutside={handleInteractOutside}\n onEscapeKeyDown={handleInteractOutside}\n sticky='always'\n hideWhenDetached\n >\n <Popover.Viewport>\n {layout.popoverKind === 'card' && (\n <Card.Root>\n <Card.Toolbar>\n {/* TODO(wittjosiah): Cleaner way to handle no drag handle in toolbar? */}\n <span />\n {layout.popoverTitle ? (\n <Card.Title>{toLocalizedString(layout.popoverTitle, t)}</Card.Title>\n ) : (\n <span />\n )}\n <Card.CloseIconButton onClick={handleClose} />\n </Card.Toolbar>\n <Surface.Surface type={AppSurface.Card} data={layout.popoverContent} limit={1} />\n </Card.Root>\n )}\n {layout.popoverKind === 'base' && (\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 </Mosaic.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.id);\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"],
|
|
5
|
+
"mappings": ";;;AAIA,SAASA,iBAAiBC,oBAAoB;AAC9C,OAAOC,SAAiCC,aAAaC,YAAYC,WAAWC,QAAQC,gBAAgB;AAEpG,SAASC,SAASC,qBAAqB;AAEvC,SAASC,kBAAkB;AAC3B,SACEC,aACAC,QACAC,QACAC,MACAC,MACAC,SAEAC,OACAC,mBACAC,sBACK;AACP,SAASC,YAAY;AACrB,SAASC,cAAc;AACvB,SAASC,oBAAoBC,UAAU;AAEvC,SAASC,YAAY;AACrB,SAASC,6BAA6B;AAEtC,IAAMC,iBAAiB;AAEvB,IAAMC,aAAa,CAAC,EAAEC,OAAOC,UAAS,MAAqE;AACzG,QAAM,EAAEC,EAAC,IAAKX,eAAeK,KAAKO,EAAE;AACpC,SACE,sBAAA,cAACd,MAAMe,MAAI;IACTC,eAAaL,MAAMG;IACnBG,aAAAA;IACAC,UAAUP,MAAMO;IAChBC,cAAc,CAACC,SAAAA;AACb,UAAI,CAACA,MAAM;AACTR,kBAAUD,MAAMG,EAAE;MACpB;IACF;KAEA,sBAAA,cAACd,MAAMqB,MAAI,MACT,sBAAA,cAACrB,MAAMsB,OAAK;IAACC,YAAW;KACrBZ,MAAMa,QAAQ,sBAAA,cAAC3B,MAAAA;IAAK2B,MAAMb,MAAMa;IAAMD,YAAW;MACjDZ,MAAMc,SAAS,sBAAA,cAACC,QAAAA,MAAMzB,kBAAkBU,MAAMc,OAAOZ,CAAAA,CAAAA,CAAAA,GAEvDF,MAAMgB,eAAe,sBAAA,cAAC3B,MAAM4B,aAAW,MAAE3B,kBAAkBU,MAAMgB,aAAad,CAAAA,CAAAA,CAAAA,GAEjF,sBAAA,cAACb,MAAM6B,SAAO,MACXlB,MAAMmB,YAAYnB,MAAMoB,aAAapB,MAAMqB,eAC1C,sBAAA,cAAChC,MAAMiC,QAAM;IAACC,SAASjC,kBAAkBU,MAAMoB,WAAWlB,CAAAA;IAAIsB,SAAAA;KAC5D,sBAAA,cAACxC,QAAAA;IAAOyC,SAAQ;IAAUC,SAAS,MAAM1B,MAAMmB,WAAQ;KACpD7B,kBAAkBU,MAAMqB,aAAanB,CAAAA,CAAAA,CAAAA,GAI3CF,MAAM2B,cACL,sBAAA,cAACtC,MAAMuC,OAAK;IAACJ,SAAAA;KACX,sBAAA,cAACxC,QAAAA,MAAQM,kBAAkBU,MAAM2B,YAAYzB,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA;AAMzD;AAEO,IAAM2B,SAAS,CAAC,EAAEC,SAAQ,MAAyB;AACxD,QAAM,EAAE5B,EAAC,IAAKX,eAAeK,KAAKO,EAAE;AACpC,QAAM4B,UAAUrD,OAAiC,IAAA;AACjD,QAAMsD,WAAWxD,WAAWJ,eAAAA;AAC5B,QAAM6D,YAAYpD,cAAcgB,sBAAsBqC,WAAW;AACjE,QAAMC,SAAS9D,aAAa4D,SAAAA;AAC5B,QAAM,CAACG,MAAMC,OAAAA,IAAW1D,SAAS,CAAA;AACjC,QAAM,CAAC8B,MAAM6B,OAAAA,IAAW3D,SAAS,KAAA;AACjC,QAAM4D,cAAc7D,OAA8B,IAAA;AAElD,QAAM8D,cAAcjE,YAClB,CAACkE,YAAAA;AACC,UAAMC,UAAUV,SAASW,IAAIV,SAAAA;AAC7BD,aAASY,IAAIX,WAAW;MAAE,GAAGS;MAAS,GAAGD;IAAQ,CAAA;EACnD,GACA;IAACT;IAAUC;GAAU;AAGvBxD,YAAU,MAAA;AACR6D,YAAQ,KAAA;AACR,QAAIC,YAAYG,SAAS;AACvBG,mBAAaN,YAAYG,OAAO;AAChCH,kBAAYG,UAAU;IACxB;AACAX,YAAQW,UAAUP,OAAOW,iBAAiB;AAC1CT,YAAQ,CAACD,UAASA,QAAO,CAAA;AACzB,QAAID,OAAOY,aAAa;AACtBR,kBAAYG,UAAUM,WAAW,MAAMV,QAAQ,IAAA,GAAOxC,cAAAA;IACxD;EACF,GAAG;IAACqC,OAAOW;IAAeX,OAAOc;IAAgBd,OAAOY;GAAY;AAEpE,QAAMG,cAAc3E,YAAY,MAAA;AAC9B+D,YAAQ,KAAA;AACRE,gBAAY;MACVO,aAAa;MACbD,eAAeK;MACfC,iBAAiBD;MACjBE,aAAaF;IACf,CAAA;EACF,GAAG;IAACX;GAAY;AAEhB,QAAMc,wBAAwB/E,YAC5B,CAACgF,UAAAA;AACC;;MAEEA,MAAMC,SAAS,mCACdD,MAAME,eAA2CC,UAAUC,SAAS,YAAA;MACrE;AACAJ,YAAMK,eAAc;IACtB,OAAO;AACLV,kBAAAA;IACF;EACF,GACA;IAACA;GAAY;AAGf,QAAMW,qBAAqBtF,YACzB,CAAC4B,OAAAA;AACCqC,gBAAY;MAAEsB,QAAQ3B,OAAO2B,OAAOC,OAAO,CAAC/D,UAAUA,MAAMG,OAAOA,EAAAA;IAAI,CAAA;EACzE,GACA;IAACqC;IAAaL,OAAO2B;GAAO;AAG9B,QAAME,aAAa7B,OAAO8B,eAAe,UAAUlF,YAAYqB,OAAOnB,OAAOmB;AAC7E,QAAM8D,gBAAgB/B,OAAO8B,eAAe,UAAUlF,YAAYoF,UAAUlF,OAAOkF;AAEnF,SACE,sBAAA,cAAC9E,MAAM+E,UAAQ,MACb,sBAAA,cAACC,OAAAA;IAAIC,WAAU;KACb,sBAAA,cAAC7E,OAAOW,MAAI,MACV,sBAAA,cAAChB,QAAQgB,MAAI;IAACK;KACZ,sBAAA,cAACtB,KAAKiB,MAAI;IACRmE,wBAAwBpC,OAAOqC;IAC/BC,2BAA2BtC,OAAOsC;IAClCC,gCAAgC,CAACC,SAASnC,YAAY;MAAEgC,cAAcG;IAAK,CAAA;IAC3EC,mCAAmC,CAACD,SAASnC,YAAY;MAAEiC,2BAA2BE;IAAK,CAAA;KAE1F7C,QAAAA,GAGH,sBAAA,cAACkC,YAAAA;IACCa,OAAO1C,OAAO2C,qBAAqB;IACnCrE,MAAM0B,OAAO4C;IACbvE,cAAc,CAACwE,aAAaxC,YAAY;MAAEuC,YAAYC;IAAS,CAAA;KAE9D7C,OAAO2C,qBAAqB,QAC3B,sBAAA,cAAClG,QAAQA,SAAO;IACd4E,MAAM1E,WAAWG;IACjBgG,MAAM9C,OAAO+C;IACbC,OAAO;IACPC,UAAUC;IACVC,aAAa,sBAAA,cAACjB,OAAAA,IAAAA;OAGhB,sBAAA,cAACH,eAAAA;IACCqB,YAAYpD,OAAO2C;IACnBlE,YAAYuB,OAAOqD;IACnBC,OAAOtD,OAAOuD;KAEd,sBAAA,cAAC9G,QAAQA,SAAO;IACd4E,MAAM1E,WAAWG;IACjBgG,MAAM9C,OAAO+C;IACbC,OAAO;IACPC,UAAUC;QAMlB,sBAAA,cAACjG,QAAQuG,gBAAc;IAACC,KAAKxD;IAAMyD,YAAY9D;MAC/C,sBAAA,cAAC3C,QAAQ0G,QAAM,MACb,sBAAA,cAAC1G,QAAQ2G,SAAO;IACdC,MAAM7D,OAAOkB;IACb4C,mBAAmB3C;IACnB4C,iBAAiB5C;IACjB6C,QAAO;IACPC,kBAAAA;KAEA,sBAAA,cAAChH,QAAQiH,UAAQ,MACdlE,OAAOmE,gBAAgB,UACtB,sBAAA,cAAC9G,KAAKY,MAAI,MACR,sBAAA,cAACZ,KAAK+G,SAAO,MAEX,sBAAA,cAACxF,QAAAA,IAAAA,GACAoB,OAAOqE,eACN,sBAAA,cAAChH,KAAKmB,OAAK,MAAErB,kBAAkB6C,OAAOqE,cAActG,CAAAA,CAAAA,IAEpD,sBAAA,cAACa,QAAAA,IAAAA,GAEH,sBAAA,cAACvB,KAAKiH,iBAAe;IAAC/E,SAASwB;OAEjC,sBAAA,cAACtE,QAAQA,SAAO;IAAC4E,MAAM1E,WAAWU;IAAMyF,MAAM9C,OAAOc;IAAgBkC,OAAO;OAG/EhD,OAAOmE,gBAAgB,UACtB,sBAAA,cAAC1H,QAAQA,SAAO;IAAC4E,MAAM1E,WAAWM;IAAS6F,MAAM9C,OAAOc;IAAgBkC,OAAO;OAGnF,sBAAA,cAAC/F,QAAQsH,OAAK,IAAA,CAAA,CAAA,CAAA,CAAA,GAKrBvE,OAAO2B,OAAO6C,IAAI,CAAC3G,UAClB,sBAAA,cAACD,YAAAA;IAAW6F,KAAK5F,MAAMG;IAAIH;IAAcC,WAAW4D;OAEtD,sBAAA,cAACxE,MAAMgH,UAAQ,IAAA,CAAA,CAAA;AAIvB;AAEO,IAAMhB,gBAAgB,CAAC,EAAEuB,MAAK,MAAqB;AACxD,QAAM,EAAE1G,EAAC,IAAKX,eAAeK,KAAKO,EAAE;AACpC,QAAM0G,cAAcD,OAAOE,SAAAA,KAAc;AACzC,SACE,sBAAA,cAACzC,OAAAA;IACC0C,MAAK;IACL1G,eAAY;IACZiE,WAAW3E,GAAG,gEAAA;KAEd,sBAAA,cAACqH,KAAAA;IAAE1C,WAAW3E,GAAGD,oBAAoB,8BAA8BmH,YAAYI,SAAS,OAAO,SAAA;KAC5FL,QAAQC,cAAc3G,EAAE,wBAAA,CAAA,CAAA;AAIjC;",
|
|
6
|
+
"names": ["RegistryContext", "useAtomValue", "React", "useCallback", "useContext", "useEffect", "useRef", "useState", "Surface", "useCapability", "AppSurface", "AlertDialog", "Button", "Dialog", "Icon", "Main", "Popover", "Toast", "toLocalizedString", "useTranslation", "Card", "Mosaic", "descriptionMessage", "mx", "meta", "StorybookCapabilities", "debounce_delay", "StoryToast", "toast", "onDismiss", "t", "id", "Root", "data-testid", "defaultOpen", "duration", "onOpenChange", "open", "Body", "Title", "classNames", "icon", "title", "span", "description", "Description", "Actions", "onAction", "actionAlt", "actionLabel", "Action", "altText", "asChild", "variant", "onClick", "closeLabel", "Close", "Layout", "children", "trigger", "registry", "stateAtom", "LayoutState", "layout", "iter", "setIter", "setOpen", "debounceRef", "updateState", "updates", "current", "get", "set", "clearTimeout", "popoverAnchor", "popoverOpen", "setTimeout", "popoverContent", "handleClose", "undefined", "popoverAnchorId", "popoverSide", "handleInteractOutside", "event", "type", "currentTarget", "classList", "contains", "preventDefault", "handleDismissToast", "toasts", "filter", "DialogRoot", "dialogType", "DialogOverlay", "Overlay", "Provider", "div", "className", "navigationSidebarState", "sidebarState", "complementarySidebarState", "onNavigationSidebarStateChange", "next", "onComplementarySidebarStateChange", "modal", "dialogBlockAlign", "dialogOpen", "nextOpen", "data", "dialogContent", "limit", "fallback", "ErrorFallback", "placeholder", "blockAlign", "dialogOverlayClasses", "style", "dialogOverlayStyle", "VirtualTrigger", "key", "virtualRef", "Portal", "Content", "side", "onInteractOutside", "onEscapeKeyDown", "sticky", "hideWhenDetached", "Viewport", "popoverKind", "Toolbar", "popoverTitle", "CloseIconButton", "Arrow", "map", "error", "errorString", "toString", "role", "p", "length"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import "./chunk-J5LGTIGS.mjs";
|
|
2
|
+
|
|
3
|
+
// src/harness.ts
|
|
4
|
+
import { OperationPlugin, RuntimePlugin } from "@dxos/app-framework";
|
|
5
|
+
import { createTestApp } from "@dxos/app-framework/testing";
|
|
6
|
+
import { AttentionPlugin } from "@dxos/plugin-attention/plugin";
|
|
7
|
+
import { GraphPlugin } from "@dxos/plugin-graph/plugin";
|
|
8
|
+
import { SettingsPlugin } from "@dxos/plugin-settings/plugin";
|
|
9
|
+
var headlessCorePlugins = () => [
|
|
10
|
+
AttentionPlugin(),
|
|
11
|
+
GraphPlugin(),
|
|
12
|
+
OperationPlugin(),
|
|
13
|
+
RuntimePlugin(),
|
|
14
|
+
SettingsPlugin()
|
|
15
|
+
];
|
|
16
|
+
var createComposerTestApp = async (opts = {}) => {
|
|
17
|
+
const { plugins = [], theme = false, ...rest } = opts;
|
|
18
|
+
const core = headlessCorePlugins();
|
|
19
|
+
if (theme) {
|
|
20
|
+
const { ThemePlugin } = await import("@dxos/plugin-theme/plugin");
|
|
21
|
+
const { defaultTx } = await import("@dxos/ui-theme");
|
|
22
|
+
core.push(ThemePlugin({
|
|
23
|
+
tx: defaultTx
|
|
24
|
+
}));
|
|
25
|
+
}
|
|
26
|
+
return createTestApp({
|
|
27
|
+
...rest,
|
|
28
|
+
plugins: [
|
|
29
|
+
...core,
|
|
30
|
+
...plugins
|
|
31
|
+
]
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
export {
|
|
35
|
+
createComposerTestApp
|
|
36
|
+
};
|
|
37
|
+
//# sourceMappingURL=harness.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/harness.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2026 DXOS.org\n//\n\nimport { OperationPlugin, type Plugin, RuntimePlugin } from '@dxos/app-framework';\nimport { createTestApp, type TestAppOptions, type TestHarness } from '@dxos/app-framework/testing';\nimport { AttentionPlugin } from '@dxos/plugin-attention/plugin';\nimport { GraphPlugin } from '@dxos/plugin-graph/plugin';\nimport { SettingsPlugin } from '@dxos/plugin-settings/plugin';\n\nexport type ComposerTestAppOptions = Omit<TestAppOptions, 'plugins'> & {\n /** Plugins to register in addition to the Composer core plugins. */\n plugins?: Plugin.Plugin[];\n /**\n * Whether to include `ThemePlugin` in the core plugin set.\n * Defaults to `false` — `ThemePlugin` requires a browser DOM and breaks Node-only tests.\n * Set to `true` (with jsdom/happy-dom) when rendering React surfaces.\n */\n theme?: boolean;\n};\n\n/**\n * Headless core plugins for the test harness — the subset of `corePlugins()`\n * that can be activated without a browser DOM.\n */\nconst headlessCorePlugins = (): Plugin.Plugin[] => [\n AttentionPlugin(),\n GraphPlugin(),\n OperationPlugin(),\n RuntimePlugin(),\n SettingsPlugin(),\n];\n\n/**\n * Creates a TestHarness pre-loaded with the Composer core plugins\n * (Attention, Graph, Operation, Runtime, Settings, optionally Theme).\n *\n * For a ClientPlugin-backed harness, pass `ClientPlugin({ ... })` via `plugins`.\n */\nexport const createComposerTestApp = async (opts: ComposerTestAppOptions = {}): Promise<TestHarness> => {\n const { plugins = [], theme = false, ...rest } = opts;\n const core = headlessCorePlugins();\n if (theme) {\n const { ThemePlugin } = await import('@dxos/plugin-theme/plugin');\n const { defaultTx } = await import('@dxos/ui-theme');\n core.push(ThemePlugin({ tx: defaultTx }));\n }\n return createTestApp({\n ...rest,\n plugins: [...core, ...plugins],\n });\n};\n"],
|
|
5
|
+
"mappings": ";;;AAIA,SAASA,iBAA8BC,qBAAqB;AAC5D,SAASC,qBAA4D;AACrE,SAASC,uBAAuB;AAChC,SAASC,mBAAmB;AAC5B,SAASC,sBAAsB;AAiB/B,IAAMC,sBAAsB,MAAuB;EACjDH,gBAAAA;EACAC,YAAAA;EACAJ,gBAAAA;EACAC,cAAAA;EACAI,eAAAA;;AASK,IAAME,wBAAwB,OAAOC,OAA+B,CAAC,MAAC;AAC3E,QAAM,EAAEC,UAAU,CAAA,GAAIC,QAAQ,OAAO,GAAGC,KAAAA,IAASH;AACjD,QAAMI,OAAON,oBAAAA;AACb,MAAII,OAAO;AACT,UAAM,EAAEG,YAAW,IAAK,MAAM,OAAO,2BAAA;AACrC,UAAM,EAAEC,UAAS,IAAK,MAAM,OAAO,gBAAA;AACnCF,SAAKG,KAAKF,YAAY;MAAEG,IAAIF;IAAU,CAAA,CAAA;EACxC;AACA,SAAOZ,cAAc;IACnB,GAAGS;IACHF,SAAS;SAAIG;SAASH;;EACxB,CAAA;AACF;",
|
|
6
|
+
"names": ["OperationPlugin", "RuntimePlugin", "createTestApp", "AttentionPlugin", "GraphPlugin", "SettingsPlugin", "headlessCorePlugins", "createComposerTestApp", "opts", "plugins", "theme", "rest", "core", "ThemePlugin", "defaultTx", "push", "tx"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import {
|
|
2
|
+
StorybookCapabilities_exports
|
|
3
|
+
} from "./chunk-NZ2VT6N2.mjs";
|
|
4
|
+
import {
|
|
5
|
+
StorybookPlugin
|
|
6
|
+
} from "./chunk-R7AV233N.mjs";
|
|
7
|
+
import {
|
|
8
|
+
corePlugins
|
|
9
|
+
} from "./chunk-7UPIIIZM.mjs";
|
|
10
|
+
import {
|
|
11
|
+
meta
|
|
12
|
+
} from "./chunk-ZVN23V74.mjs";
|
|
13
|
+
import "./chunk-J5LGTIGS.mjs";
|
|
14
|
+
export {
|
|
15
|
+
StorybookCapabilities_exports as StorybookCapabilities,
|
|
16
|
+
StorybookPlugin,
|
|
17
|
+
corePlugins,
|
|
18
|
+
meta
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=index.mjs.map
|