@dxos/plugin-testing 0.8.4-main.d05673bc65 → 0.8.4-main.fcfe5033a5
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/browser/chunk-G2BI2IZM.mjs +36 -0
- package/dist/lib/browser/chunk-G2BI2IZM.mjs.map +7 -0
- package/dist/lib/browser/harness.mjs +7 -0
- package/dist/lib/browser/harness.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +24 -164
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node-esm/chunk-U342VJPQ.mjs +38 -0
- package/dist/lib/node-esm/chunk-U342VJPQ.mjs.map +7 -0
- package/dist/lib/node-esm/harness.mjs +8 -0
- package/dist/lib/node-esm/harness.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +24 -164
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/types/src/StorybookPlugin.d.ts +1 -1
- 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} +1 -1
- 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/types/capabilities.d.ts +2 -0
- package/dist/types/src/types/capabilities.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +29 -17
- package/src/StorybookPlugin.ts +7 -7
- package/src/capabilities/index.ts +8 -2
- package/src/capabilities/operation-handler.ts +16 -0
- package/src/capabilities/{state/state.tsx → state.tsx} +2 -1
- package/src/components/Layout/Layout.tsx +133 -73
- package/src/core.ts +0 -5
- package/src/harness.ts +52 -0
- package/src/index.ts +1 -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 +17 -0
- package/src/types/capabilities.ts +4 -1
- package/dist/lib/browser/chunk-NWOKPVNQ.mjs +0 -21
- package/dist/lib/browser/chunk-NWOKPVNQ.mjs.map +0 -7
- 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 +0 -43
- 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/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/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,27 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
|
|
7
|
+
import { LayoutOperation } from '@dxos/app-toolkit';
|
|
8
|
+
import { Operation } from '@dxos/operation';
|
|
9
|
+
|
|
10
|
+
import { updateState } from './update-state';
|
|
11
|
+
|
|
12
|
+
const handler: Operation.WithHandler<typeof LayoutOperation.UpdateDialog> = LayoutOperation.UpdateDialog.pipe(
|
|
13
|
+
Operation.withHandler(
|
|
14
|
+
Effect.fnUntraced(function* ({ subject, state, type, blockAlign, overlayClasses, overlayStyle, props }) {
|
|
15
|
+
yield* updateState(() => ({
|
|
16
|
+
dialogOpen: state ?? Boolean(subject),
|
|
17
|
+
dialogType: type ?? 'default',
|
|
18
|
+
dialogBlockAlign: blockAlign ?? 'center',
|
|
19
|
+
dialogOverlayClasses: overlayClasses,
|
|
20
|
+
dialogOverlayStyle: overlayStyle,
|
|
21
|
+
dialogContent: subject ? { component: subject, props } : null,
|
|
22
|
+
}));
|
|
23
|
+
}),
|
|
24
|
+
),
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
export default handler;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
|
|
7
|
+
import { LayoutOperation } from '@dxos/app-toolkit';
|
|
8
|
+
import { Operation } from '@dxos/operation';
|
|
9
|
+
|
|
10
|
+
import { type LayoutStateProps } from '../types';
|
|
11
|
+
import { updateState } from './update-state';
|
|
12
|
+
|
|
13
|
+
const handler: Operation.WithHandler<typeof LayoutOperation.UpdatePopover> = LayoutOperation.UpdatePopover.pipe(
|
|
14
|
+
Operation.withHandler(
|
|
15
|
+
Effect.fnUntraced(function* (input) {
|
|
16
|
+
const { subject, state, side, kind, props } = input;
|
|
17
|
+
yield* updateState(() => {
|
|
18
|
+
const base: Partial<LayoutStateProps> = {
|
|
19
|
+
popoverKind: kind ?? 'base',
|
|
20
|
+
popoverTitle: kind === 'card' ? input.title : undefined,
|
|
21
|
+
popoverContent:
|
|
22
|
+
typeof subject === 'string' ? { component: subject, props } : subject ? { subject } : undefined,
|
|
23
|
+
popoverOpen: state ?? Boolean(subject),
|
|
24
|
+
popoverSide: side,
|
|
25
|
+
};
|
|
26
|
+
if ('variant' in input && input.variant === 'virtual') {
|
|
27
|
+
return { ...base, popoverVariant: 'virtual', popoverAnchor: input.anchor };
|
|
28
|
+
} else if ('anchorId' in input) {
|
|
29
|
+
return { ...base, popoverVariant: 'react', popoverAnchorId: input.anchorId };
|
|
30
|
+
}
|
|
31
|
+
return base;
|
|
32
|
+
});
|
|
33
|
+
}),
|
|
34
|
+
),
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
export default handler;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
|
|
7
|
+
import { LayoutOperation } from '@dxos/app-toolkit';
|
|
8
|
+
import { Operation } from '@dxos/operation';
|
|
9
|
+
|
|
10
|
+
import { updateState } from './update-state';
|
|
11
|
+
|
|
12
|
+
const handler: Operation.WithHandler<typeof LayoutOperation.UpdateSidebar> = LayoutOperation.UpdateSidebar.pipe(
|
|
13
|
+
Operation.withHandler(
|
|
14
|
+
Effect.fnUntraced(function* ({ state }) {
|
|
15
|
+
yield* updateState((layout) => {
|
|
16
|
+
const next = state ?? layout.sidebarState;
|
|
17
|
+
if (next !== layout.sidebarState) {
|
|
18
|
+
return { sidebarState: next };
|
|
19
|
+
}
|
|
20
|
+
return {};
|
|
21
|
+
});
|
|
22
|
+
}),
|
|
23
|
+
),
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
export default handler;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
|
|
7
|
+
import { Capabilities, Capability } from '@dxos/app-framework';
|
|
8
|
+
|
|
9
|
+
import { LayoutState, type LayoutStateProps } from '../types';
|
|
10
|
+
|
|
11
|
+
export const updateState = (fn: (state: LayoutStateProps) => Partial<LayoutStateProps>) =>
|
|
12
|
+
Effect.gen(function* () {
|
|
13
|
+
const registry = yield* Capability.get(Capabilities.AtomRegistry);
|
|
14
|
+
const stateAtom = yield* Capability.get(LayoutState);
|
|
15
|
+
const current = registry.get(stateAtom);
|
|
16
|
+
registry.set(stateAtom, { ...current, ...fn(current) });
|
|
17
|
+
});
|
|
@@ -5,9 +5,10 @@
|
|
|
5
5
|
import { type Atom } from '@effect-atom/atom-react';
|
|
6
6
|
|
|
7
7
|
import { Capability } from '@dxos/app-framework';
|
|
8
|
+
import { type LayoutOperation } from '@dxos/app-toolkit';
|
|
8
9
|
import { type Label } from '@dxos/react-ui';
|
|
9
10
|
|
|
10
|
-
import { meta } from '
|
|
11
|
+
import { meta } from '#meta';
|
|
11
12
|
|
|
12
13
|
export type LayoutStateProps = {
|
|
13
14
|
sidebarState?: 'expanded' | 'collapsed' | 'closed';
|
|
@@ -30,6 +31,8 @@ export type LayoutStateProps = {
|
|
|
30
31
|
popoverTitle?: Label;
|
|
31
32
|
popoverContent?: any;
|
|
32
33
|
|
|
34
|
+
toasts: LayoutOperation.Toast[];
|
|
35
|
+
|
|
33
36
|
workspace: string;
|
|
34
37
|
};
|
|
35
38
|
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
// src/meta.ts
|
|
2
|
-
import { trim } from "@dxos/util";
|
|
3
|
-
var meta = {
|
|
4
|
-
id: "org.dxos.plugin.storybook-layout",
|
|
5
|
-
name: "Storybook",
|
|
6
|
-
description: trim`
|
|
7
|
-
Development layout optimized for Storybook component testing and documentation.
|
|
8
|
-
Provides specialized views for component development and design system exploration.
|
|
9
|
-
`,
|
|
10
|
-
source: "https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-testing"
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
// src/types/capabilities.ts
|
|
14
|
-
import { Capability } from "@dxos/app-framework";
|
|
15
|
-
var LayoutState = Capability.make(`${meta.id}.state`);
|
|
16
|
-
|
|
17
|
-
export {
|
|
18
|
-
meta,
|
|
19
|
-
LayoutState
|
|
20
|
-
};
|
|
21
|
-
//# sourceMappingURL=chunk-NWOKPVNQ.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/meta.ts", "../../../src/types/capabilities.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", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { type Atom } from '@effect-atom/atom-react';\n\nimport { Capability } from '@dxos/app-framework';\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 workspace: string;\n};\n\nexport const LayoutState = Capability.make<Atom.Writable<LayoutStateProps>>(`${meta.id}.state`);\n"],
|
|
5
|
-
"mappings": ";AAKA,SAASA,YAAY;AAEd,IAAMC,OAAoB;EAC/BC,IAAI;EACJC,MAAM;EACNC,aAAaC;;;;EAIbC,QAAQ;AACV;;;ACTA,SAASC,kBAAkB;AA6BpB,IAAMC,cAAcC,WAAWC,KAAsC,GAAGC,KAAKC,EAAE,QAAQ;",
|
|
6
|
-
"names": ["trim", "meta", "id", "name", "description", "trim", "source", "Capability", "LayoutState", "Capability", "make", "meta", "id"]
|
|
7
|
-
}
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
LayoutState
|
|
3
|
-
} from "./chunk-NWOKPVNQ.mjs";
|
|
4
|
-
|
|
5
|
-
// src/capabilities/operation-resolver/operation-resolver.ts
|
|
6
|
-
import * as Effect from "effect/Effect";
|
|
7
|
-
import { Capabilities, Capability } from "@dxos/app-framework";
|
|
8
|
-
import { LayoutOperation } from "@dxos/app-toolkit";
|
|
9
|
-
import { OperationResolver } from "@dxos/operation";
|
|
10
|
-
var operation_resolver_default = Capability.makeModule(Effect.fnUntraced(function* () {
|
|
11
|
-
const registry = yield* Capability.get(Capabilities.AtomRegistry);
|
|
12
|
-
const stateAtom = yield* Capability.get(LayoutState);
|
|
13
|
-
const updateState = (fn) => {
|
|
14
|
-
const current = registry.get(stateAtom);
|
|
15
|
-
registry.set(stateAtom, {
|
|
16
|
-
...current,
|
|
17
|
-
...fn(current)
|
|
18
|
-
});
|
|
19
|
-
};
|
|
20
|
-
return Capability.contributes(Capabilities.OperationResolver, [
|
|
21
|
-
OperationResolver.make({
|
|
22
|
-
operation: LayoutOperation.UpdateSidebar,
|
|
23
|
-
handler: Effect.fnUntraced(function* ({ state }) {
|
|
24
|
-
updateState((layout) => {
|
|
25
|
-
const next = state ?? layout.sidebarState;
|
|
26
|
-
if (next !== layout.sidebarState) {
|
|
27
|
-
return {
|
|
28
|
-
sidebarState: next
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
return {};
|
|
32
|
-
});
|
|
33
|
-
})
|
|
34
|
-
}),
|
|
35
|
-
OperationResolver.make({
|
|
36
|
-
operation: LayoutOperation.UpdateComplementary,
|
|
37
|
-
handler: Effect.fnUntraced(function* ({ state }) {
|
|
38
|
-
updateState((layout) => {
|
|
39
|
-
const next = state ?? layout.complementarySidebarState;
|
|
40
|
-
if (next !== layout.complementarySidebarState) {
|
|
41
|
-
return {
|
|
42
|
-
complementarySidebarState: next
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
return {};
|
|
46
|
-
});
|
|
47
|
-
})
|
|
48
|
-
}),
|
|
49
|
-
OperationResolver.make({
|
|
50
|
-
operation: LayoutOperation.UpdateDialog,
|
|
51
|
-
handler: Effect.fnUntraced(function* ({ subject, state, type, blockAlign, overlayClasses, overlayStyle, props }) {
|
|
52
|
-
updateState(() => ({
|
|
53
|
-
dialogOpen: state ?? Boolean(subject),
|
|
54
|
-
dialogType: type ?? "default",
|
|
55
|
-
dialogBlockAlign: blockAlign ?? "center",
|
|
56
|
-
dialogOverlayClasses: overlayClasses,
|
|
57
|
-
dialogOverlayStyle: overlayStyle,
|
|
58
|
-
dialogContent: subject ? {
|
|
59
|
-
component: subject,
|
|
60
|
-
props
|
|
61
|
-
} : null
|
|
62
|
-
}));
|
|
63
|
-
})
|
|
64
|
-
}),
|
|
65
|
-
OperationResolver.make({
|
|
66
|
-
operation: LayoutOperation.UpdatePopover,
|
|
67
|
-
handler: Effect.fnUntraced(function* (input) {
|
|
68
|
-
const { subject, state, side, kind, props } = input;
|
|
69
|
-
updateState(() => {
|
|
70
|
-
const base = {
|
|
71
|
-
popoverKind: kind ?? "base",
|
|
72
|
-
popoverTitle: kind === "card" ? input.title : void 0,
|
|
73
|
-
popoverContent: typeof subject === "string" ? {
|
|
74
|
-
component: subject,
|
|
75
|
-
props
|
|
76
|
-
} : subject ? {
|
|
77
|
-
subject
|
|
78
|
-
} : void 0,
|
|
79
|
-
popoverOpen: state ?? Boolean(subject),
|
|
80
|
-
popoverSide: side
|
|
81
|
-
};
|
|
82
|
-
if ("variant" in input && input.variant === "virtual") {
|
|
83
|
-
return {
|
|
84
|
-
...base,
|
|
85
|
-
popoverVariant: "virtual",
|
|
86
|
-
popoverAnchor: input.anchor
|
|
87
|
-
};
|
|
88
|
-
} else if ("anchorId" in input) {
|
|
89
|
-
return {
|
|
90
|
-
...base,
|
|
91
|
-
popoverVariant: "react",
|
|
92
|
-
popoverAnchorId: input.anchorId
|
|
93
|
-
};
|
|
94
|
-
}
|
|
95
|
-
return base;
|
|
96
|
-
});
|
|
97
|
-
})
|
|
98
|
-
}),
|
|
99
|
-
OperationResolver.make({
|
|
100
|
-
operation: LayoutOperation.SwitchWorkspace,
|
|
101
|
-
handler: Effect.fnUntraced(function* ({ subject }) {
|
|
102
|
-
updateState(() => ({
|
|
103
|
-
workspace: subject
|
|
104
|
-
}));
|
|
105
|
-
})
|
|
106
|
-
})
|
|
107
|
-
]);
|
|
108
|
-
}));
|
|
109
|
-
export {
|
|
110
|
-
operation_resolver_default as default
|
|
111
|
-
};
|
|
112
|
-
//# sourceMappingURL=operation-resolver-SR4GZ7Q5.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/capabilities/operation-resolver/operation-resolver.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\n\nimport { Capabilities, Capability } from '@dxos/app-framework';\nimport { LayoutOperation } from '@dxos/app-toolkit';\nimport { OperationResolver } from '@dxos/operation';\n\nimport { LayoutState, type LayoutStateProps } from '../../types';\n\nexport default Capability.makeModule(\n Effect.fnUntraced(function* () {\n const registry = yield* Capability.get(Capabilities.AtomRegistry);\n const stateAtom = yield* Capability.get(LayoutState);\n\n const updateState = (fn: (state: LayoutStateProps) => Partial<LayoutStateProps>) => {\n const current = registry.get(stateAtom);\n registry.set(stateAtom, { ...current, ...fn(current) });\n };\n\n return Capability.contributes(Capabilities.OperationResolver, [\n OperationResolver.make({\n operation: LayoutOperation.UpdateSidebar,\n handler: Effect.fnUntraced(function* ({ state }) {\n updateState((layout) => {\n const next = state ?? layout.sidebarState;\n if (next !== layout.sidebarState) {\n return { sidebarState: next };\n }\n return {};\n });\n }),\n }),\n OperationResolver.make({\n operation: LayoutOperation.UpdateComplementary,\n handler: Effect.fnUntraced(function* ({ state }) {\n updateState((layout) => {\n const next = state ?? layout.complementarySidebarState;\n if (next !== layout.complementarySidebarState) {\n return { complementarySidebarState: next };\n }\n return {};\n });\n }),\n }),\n OperationResolver.make({\n operation: LayoutOperation.UpdateDialog,\n handler: Effect.fnUntraced(function* ({\n subject,\n state,\n type,\n blockAlign,\n overlayClasses,\n overlayStyle,\n props,\n }) {\n 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 OperationResolver.make({\n operation: LayoutOperation.UpdatePopover,\n handler: Effect.fnUntraced(function* (input) {\n const { subject, state, side, kind, props } = input;\n updateState(() => {\n const base: Partial<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 OperationResolver.make({\n operation: LayoutOperation.SwitchWorkspace,\n handler: Effect.fnUntraced(function* ({ subject }) {\n updateState(() => ({ workspace: subject }));\n }),\n }),\n ]);\n }),\n);\n"],
|
|
5
|
-
"mappings": ";;;;;AAIA,YAAYA,YAAY;AAExB,SAASC,cAAcC,kBAAkB;AACzC,SAASC,uBAAuB;AAChC,SAASC,yBAAyB;AAIlC,IAAA,6BAAeC,WAAWC,WACjBC,kBAAW,aAAA;AAChB,QAAMC,WAAW,OAAOH,WAAWI,IAAIC,aAAaC,YAAY;AAChE,QAAMC,YAAY,OAAOP,WAAWI,IAAII,WAAAA;AAExC,QAAMC,cAAc,CAACC,OAAAA;AACnB,UAAMC,UAAUR,SAASC,IAAIG,SAAAA;AAC7BJ,aAASS,IAAIL,WAAW;MAAE,GAAGI;MAAS,GAAGD,GAAGC,OAAAA;IAAS,CAAA;EACvD;AAEA,SAAOX,WAAWa,YAAYR,aAAaS,mBAAmB;IAC5DA,kBAAkBC,KAAK;MACrBC,WAAWC,gBAAgBC;MAC3BC,SAAgBjB,kBAAW,WAAW,EAAEkB,MAAK,GAAE;AAC7CX,oBAAY,CAACY,WAAAA;AACX,gBAAMC,OAAOF,SAASC,OAAOE;AAC7B,cAAID,SAASD,OAAOE,cAAc;AAChC,mBAAO;cAAEA,cAAcD;YAAK;UAC9B;AACA,iBAAO,CAAC;QACV,CAAA;MACF,CAAA;IACF,CAAA;IACAR,kBAAkBC,KAAK;MACrBC,WAAWC,gBAAgBO;MAC3BL,SAAgBjB,kBAAW,WAAW,EAAEkB,MAAK,GAAE;AAC7CX,oBAAY,CAACY,WAAAA;AACX,gBAAMC,OAAOF,SAASC,OAAOI;AAC7B,cAAIH,SAASD,OAAOI,2BAA2B;AAC7C,mBAAO;cAAEA,2BAA2BH;YAAK;UAC3C;AACA,iBAAO,CAAC;QACV,CAAA;MACF,CAAA;IACF,CAAA;IACAR,kBAAkBC,KAAK;MACrBC,WAAWC,gBAAgBS;MAC3BP,SAAgBjB,kBAAW,WAAW,EACpCyB,SACAP,OACAQ,MACAC,YACAC,gBACAC,cACAC,MAAK,GACN;AACCvB,oBAAY,OAAO;UACjBwB,YAAYb,SAASc,QAAQP,OAAAA;UAC7BQ,YAAYP,QAAQ;UACpBQ,kBAAkBP,cAAc;UAChCQ,sBAAsBP;UACtBQ,oBAAoBP;UACpBQ,eAAeZ,UAAU;YAAEa,WAAWb;YAASK;UAAM,IAAI;QAC3D,EAAA;MACF,CAAA;IACF,CAAA;IACAlB,kBAAkBC,KAAK;MACrBC,WAAWC,gBAAgBwB;MAC3BtB,SAAgBjB,kBAAW,WAAWwC,OAAK;AACzC,cAAM,EAAEf,SAASP,OAAOuB,MAAMC,MAAMZ,MAAK,IAAKU;AAC9CjC,oBAAY,MAAA;AACV,gBAAMoC,OAAkC;YACtCC,aAAaF,QAAQ;YACrBG,cAAcH,SAAS,SAASF,MAAMM,QAAQC;YAC9CC,gBACE,OAAOvB,YAAY,WAAW;cAAEa,WAAWb;cAASK;YAAM,IAAIL,UAAU;cAAEA;YAAQ,IAAIsB;YACxFE,aAAa/B,SAASc,QAAQP,OAAAA;YAC9ByB,aAAaT;UACf;AACA,cAAI,aAAaD,SAASA,MAAMW,YAAY,WAAW;AACrD,mBAAO;cAAE,GAAGR;cAAMS,gBAAgB;cAAWC,eAAeb,MAAMc;YAAO;UAC3E,WAAW,cAAcd,OAAO;AAC9B,mBAAO;cAAE,GAAGG;cAAMS,gBAAgB;cAASG,iBAAiBf,MAAMgB;YAAS;UAC7E;AACA,iBAAOb;QACT,CAAA;MACF,CAAA;IACF,CAAA;IACA/B,kBAAkBC,KAAK;MACrBC,WAAWC,gBAAgB0C;MAC3BxC,SAAgBjB,kBAAW,WAAW,EAAEyB,QAAO,GAAE;AAC/ClB,oBAAY,OAAO;UAAEmD,WAAWjC;QAAQ,EAAA;MAC1C,CAAA;IACF,CAAA;GACD;AACH,CAAA,CAAA;",
|
|
6
|
-
"names": ["Effect", "Capabilities", "Capability", "LayoutOperation", "OperationResolver", "Capability", "makeModule", "fnUntraced", "registry", "get", "Capabilities", "AtomRegistry", "stateAtom", "LayoutState", "updateState", "fn", "current", "set", "contributes", "OperationResolver", "make", "operation", "LayoutOperation", "UpdateSidebar", "handler", "state", "layout", "next", "sidebarState", "UpdateComplementary", "complementarySidebarState", "UpdateDialog", "subject", "type", "blockAlign", "overlayClasses", "overlayStyle", "props", "dialogOpen", "Boolean", "dialogType", "dialogBlockAlign", "dialogOverlayClasses", "dialogOverlayStyle", "dialogContent", "component", "UpdatePopover", "input", "side", "kind", "base", "popoverKind", "popoverTitle", "title", "undefined", "popoverContent", "popoverOpen", "popoverSide", "variant", "popoverVariant", "popoverAnchor", "anchor", "popoverAnchorId", "anchorId", "SwitchWorkspace", "workspace"]
|
|
7
|
-
}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
LayoutState
|
|
3
|
-
} from "./chunk-NWOKPVNQ.mjs";
|
|
4
|
-
|
|
5
|
-
// src/capabilities/state/state.tsx
|
|
6
|
-
import { Atom } from "@effect-atom/atom-react";
|
|
7
|
-
import * as Effect from "effect/Effect";
|
|
8
|
-
import { Capability } from "@dxos/app-framework";
|
|
9
|
-
import { AppCapabilities } from "@dxos/app-toolkit";
|
|
10
|
-
var defaultState = {
|
|
11
|
-
sidebarState: "closed",
|
|
12
|
-
complementarySidebarState: "closed",
|
|
13
|
-
dialogOpen: false,
|
|
14
|
-
workspace: "default"
|
|
15
|
-
};
|
|
16
|
-
var state_default = Capability.makeModule(Effect.fnUntraced(function* (props) {
|
|
17
|
-
const { initialState } = props ?? {};
|
|
18
|
-
const stateAtom = Atom.make({
|
|
19
|
-
...defaultState,
|
|
20
|
-
...initialState
|
|
21
|
-
});
|
|
22
|
-
const layoutAtom = Atom.make((get) => {
|
|
23
|
-
const state = get(stateAtom);
|
|
24
|
-
return {
|
|
25
|
-
mode: "storybook",
|
|
26
|
-
dialogOpen: state.dialogOpen,
|
|
27
|
-
sidebarOpen: state.sidebarState === "expanded",
|
|
28
|
-
complementarySidebarOpen: state.complementarySidebarState === "expanded",
|
|
29
|
-
workspace: state.workspace,
|
|
30
|
-
active: [],
|
|
31
|
-
inactive: [],
|
|
32
|
-
scrollIntoView: void 0
|
|
33
|
-
};
|
|
34
|
-
});
|
|
35
|
-
return [
|
|
36
|
-
Capability.contributes(LayoutState, stateAtom),
|
|
37
|
-
Capability.contributes(AppCapabilities.Layout, layoutAtom)
|
|
38
|
-
];
|
|
39
|
-
}));
|
|
40
|
-
export {
|
|
41
|
-
state_default as default
|
|
42
|
-
};
|
|
43
|
-
//# sourceMappingURL=state-TCYYH5JN.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/capabilities/state/state.tsx"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { Atom } from '@effect-atom/atom-react';\nimport * as Effect from 'effect/Effect';\n\nimport { Capability } from '@dxos/app-framework';\nimport { AppCapabilities } from '@dxos/app-toolkit';\n\nimport { LayoutState, type LayoutStateProps } from '../../types';\n\nconst defaultState: LayoutStateProps = {\n sidebarState: 'closed',\n complementarySidebarState: 'closed',\n dialogOpen: false,\n workspace: 'default',\n};\n\nexport default Capability.makeModule(\n Effect.fnUntraced(function* (props?: { initialState?: Partial<LayoutStateProps> }) {\n const { initialState } = props ?? {};\n const stateAtom = Atom.make<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 [Capability.contributes(LayoutState, stateAtom), Capability.contributes(AppCapabilities.Layout, layoutAtom)];\n }),\n);\n"],
|
|
5
|
-
"mappings": ";;;;;AAIA,SAASA,YAAY;AACrB,YAAYC,YAAY;AAExB,SAASC,kBAAkB;AAC3B,SAASC,uBAAuB;AAIhC,IAAMC,eAAiC;EACrCC,cAAc;EACdC,2BAA2B;EAC3BC,YAAY;EACZC,WAAW;AACb;AAEA,IAAA,gBAAeC,WAAWC,WACjBC,kBAAW,WAAWC,OAAoD;AAC/E,QAAM,EAAEC,aAAY,IAAKD,SAAS,CAAC;AACnC,QAAME,YAAYC,KAAKC,KAAuB;IAAE,GAAGZ;IAAc,GAAGS;EAAa,CAAA;AAEjF,QAAMI,aAAaF,KAAKC,KAAK,CAACE,QAAAA;AAC5B,UAAMC,QAAQD,IAAIJ,SAAAA;AAClB,WAAO;MACLM,MAAM;MACNb,YAAYY,MAAMZ;MAClBc,aAAaF,MAAMd,iBAAiB;MACpCiB,0BAA0BH,MAAMb,8BAA8B;MAC9DE,WAAWW,MAAMX;MACjBe,QAAQ,CAAA;MACRC,UAAU,CAAA;MACVC,gBAAgBC;IAClB;EACF,CAAA;AAEA,SAAO;IAACjB,WAAWkB,YAAYC,aAAad,SAAAA;IAAYL,WAAWkB,YAAYE,gBAAgBC,QAAQb,UAAAA;;AACzG,CAAA,CAAA;",
|
|
6
|
-
"names": ["Atom", "Effect", "Capability", "AppCapabilities", "defaultState", "sidebarState", "complementarySidebarState", "dialogOpen", "workspace", "Capability", "makeModule", "fnUntraced", "props", "initialState", "stateAtom", "Atom", "make", "layoutAtom", "get", "state", "mode", "sidebarOpen", "complementarySidebarOpen", "active", "inactive", "scrollIntoView", "undefined", "contributes", "LayoutState", "AppCapabilities", "Layout"]
|
|
7
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
|
-
|
|
3
|
-
// src/meta.ts
|
|
4
|
-
import { trim } from "@dxos/util";
|
|
5
|
-
var meta = {
|
|
6
|
-
id: "org.dxos.plugin.storybook-layout",
|
|
7
|
-
name: "Storybook",
|
|
8
|
-
description: trim`
|
|
9
|
-
Development layout optimized for Storybook component testing and documentation.
|
|
10
|
-
Provides specialized views for component development and design system exploration.
|
|
11
|
-
`,
|
|
12
|
-
source: "https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-testing"
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
// src/types/capabilities.ts
|
|
16
|
-
import { Capability } from "@dxos/app-framework";
|
|
17
|
-
var LayoutState = Capability.make(`${meta.id}.state`);
|
|
18
|
-
|
|
19
|
-
export {
|
|
20
|
-
meta,
|
|
21
|
-
LayoutState
|
|
22
|
-
};
|
|
23
|
-
//# sourceMappingURL=chunk-NWN7D2LS.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/meta.ts", "../../../src/types/capabilities.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", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { type Atom } from '@effect-atom/atom-react';\n\nimport { Capability } from '@dxos/app-framework';\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 workspace: string;\n};\n\nexport const LayoutState = Capability.make<Atom.Writable<LayoutStateProps>>(`${meta.id}.state`);\n"],
|
|
5
|
-
"mappings": ";;;AAKA,SAASA,YAAY;AAEd,IAAMC,OAAoB;EAC/BC,IAAI;EACJC,MAAM;EACNC,aAAaC;;;;EAIbC,QAAQ;AACV;;;ACTA,SAASC,kBAAkB;AA6BpB,IAAMC,cAAcC,WAAWC,KAAsC,GAAGC,KAAKC,EAAE,QAAQ;",
|
|
6
|
-
"names": ["trim", "meta", "id", "name", "description", "trim", "source", "Capability", "LayoutState", "Capability", "make", "meta", "id"]
|
|
7
|
-
}
|
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
|
-
import {
|
|
3
|
-
LayoutState
|
|
4
|
-
} from "./chunk-NWN7D2LS.mjs";
|
|
5
|
-
|
|
6
|
-
// src/capabilities/operation-resolver/operation-resolver.ts
|
|
7
|
-
import * as Effect from "effect/Effect";
|
|
8
|
-
import { Capabilities, Capability } from "@dxos/app-framework";
|
|
9
|
-
import { LayoutOperation } from "@dxos/app-toolkit";
|
|
10
|
-
import { OperationResolver } from "@dxos/operation";
|
|
11
|
-
var operation_resolver_default = Capability.makeModule(Effect.fnUntraced(function* () {
|
|
12
|
-
const registry = yield* Capability.get(Capabilities.AtomRegistry);
|
|
13
|
-
const stateAtom = yield* Capability.get(LayoutState);
|
|
14
|
-
const updateState = (fn) => {
|
|
15
|
-
const current = registry.get(stateAtom);
|
|
16
|
-
registry.set(stateAtom, {
|
|
17
|
-
...current,
|
|
18
|
-
...fn(current)
|
|
19
|
-
});
|
|
20
|
-
};
|
|
21
|
-
return Capability.contributes(Capabilities.OperationResolver, [
|
|
22
|
-
OperationResolver.make({
|
|
23
|
-
operation: LayoutOperation.UpdateSidebar,
|
|
24
|
-
handler: Effect.fnUntraced(function* ({ state }) {
|
|
25
|
-
updateState((layout) => {
|
|
26
|
-
const next = state ?? layout.sidebarState;
|
|
27
|
-
if (next !== layout.sidebarState) {
|
|
28
|
-
return {
|
|
29
|
-
sidebarState: next
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
return {};
|
|
33
|
-
});
|
|
34
|
-
})
|
|
35
|
-
}),
|
|
36
|
-
OperationResolver.make({
|
|
37
|
-
operation: LayoutOperation.UpdateComplementary,
|
|
38
|
-
handler: Effect.fnUntraced(function* ({ state }) {
|
|
39
|
-
updateState((layout) => {
|
|
40
|
-
const next = state ?? layout.complementarySidebarState;
|
|
41
|
-
if (next !== layout.complementarySidebarState) {
|
|
42
|
-
return {
|
|
43
|
-
complementarySidebarState: next
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
return {};
|
|
47
|
-
});
|
|
48
|
-
})
|
|
49
|
-
}),
|
|
50
|
-
OperationResolver.make({
|
|
51
|
-
operation: LayoutOperation.UpdateDialog,
|
|
52
|
-
handler: Effect.fnUntraced(function* ({ subject, state, type, blockAlign, overlayClasses, overlayStyle, props }) {
|
|
53
|
-
updateState(() => ({
|
|
54
|
-
dialogOpen: state ?? Boolean(subject),
|
|
55
|
-
dialogType: type ?? "default",
|
|
56
|
-
dialogBlockAlign: blockAlign ?? "center",
|
|
57
|
-
dialogOverlayClasses: overlayClasses,
|
|
58
|
-
dialogOverlayStyle: overlayStyle,
|
|
59
|
-
dialogContent: subject ? {
|
|
60
|
-
component: subject,
|
|
61
|
-
props
|
|
62
|
-
} : null
|
|
63
|
-
}));
|
|
64
|
-
})
|
|
65
|
-
}),
|
|
66
|
-
OperationResolver.make({
|
|
67
|
-
operation: LayoutOperation.UpdatePopover,
|
|
68
|
-
handler: Effect.fnUntraced(function* (input) {
|
|
69
|
-
const { subject, state, side, kind, props } = input;
|
|
70
|
-
updateState(() => {
|
|
71
|
-
const base = {
|
|
72
|
-
popoverKind: kind ?? "base",
|
|
73
|
-
popoverTitle: kind === "card" ? input.title : void 0,
|
|
74
|
-
popoverContent: typeof subject === "string" ? {
|
|
75
|
-
component: subject,
|
|
76
|
-
props
|
|
77
|
-
} : subject ? {
|
|
78
|
-
subject
|
|
79
|
-
} : void 0,
|
|
80
|
-
popoverOpen: state ?? Boolean(subject),
|
|
81
|
-
popoverSide: side
|
|
82
|
-
};
|
|
83
|
-
if ("variant" in input && input.variant === "virtual") {
|
|
84
|
-
return {
|
|
85
|
-
...base,
|
|
86
|
-
popoverVariant: "virtual",
|
|
87
|
-
popoverAnchor: input.anchor
|
|
88
|
-
};
|
|
89
|
-
} else if ("anchorId" in input) {
|
|
90
|
-
return {
|
|
91
|
-
...base,
|
|
92
|
-
popoverVariant: "react",
|
|
93
|
-
popoverAnchorId: input.anchorId
|
|
94
|
-
};
|
|
95
|
-
}
|
|
96
|
-
return base;
|
|
97
|
-
});
|
|
98
|
-
})
|
|
99
|
-
}),
|
|
100
|
-
OperationResolver.make({
|
|
101
|
-
operation: LayoutOperation.SwitchWorkspace,
|
|
102
|
-
handler: Effect.fnUntraced(function* ({ subject }) {
|
|
103
|
-
updateState(() => ({
|
|
104
|
-
workspace: subject
|
|
105
|
-
}));
|
|
106
|
-
})
|
|
107
|
-
})
|
|
108
|
-
]);
|
|
109
|
-
}));
|
|
110
|
-
export {
|
|
111
|
-
operation_resolver_default as default
|
|
112
|
-
};
|
|
113
|
-
//# sourceMappingURL=operation-resolver-A6XLCTWX.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/capabilities/operation-resolver/operation-resolver.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\n\nimport { Capabilities, Capability } from '@dxos/app-framework';\nimport { LayoutOperation } from '@dxos/app-toolkit';\nimport { OperationResolver } from '@dxos/operation';\n\nimport { LayoutState, type LayoutStateProps } from '../../types';\n\nexport default Capability.makeModule(\n Effect.fnUntraced(function* () {\n const registry = yield* Capability.get(Capabilities.AtomRegistry);\n const stateAtom = yield* Capability.get(LayoutState);\n\n const updateState = (fn: (state: LayoutStateProps) => Partial<LayoutStateProps>) => {\n const current = registry.get(stateAtom);\n registry.set(stateAtom, { ...current, ...fn(current) });\n };\n\n return Capability.contributes(Capabilities.OperationResolver, [\n OperationResolver.make({\n operation: LayoutOperation.UpdateSidebar,\n handler: Effect.fnUntraced(function* ({ state }) {\n updateState((layout) => {\n const next = state ?? layout.sidebarState;\n if (next !== layout.sidebarState) {\n return { sidebarState: next };\n }\n return {};\n });\n }),\n }),\n OperationResolver.make({\n operation: LayoutOperation.UpdateComplementary,\n handler: Effect.fnUntraced(function* ({ state }) {\n updateState((layout) => {\n const next = state ?? layout.complementarySidebarState;\n if (next !== layout.complementarySidebarState) {\n return { complementarySidebarState: next };\n }\n return {};\n });\n }),\n }),\n OperationResolver.make({\n operation: LayoutOperation.UpdateDialog,\n handler: Effect.fnUntraced(function* ({\n subject,\n state,\n type,\n blockAlign,\n overlayClasses,\n overlayStyle,\n props,\n }) {\n 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 OperationResolver.make({\n operation: LayoutOperation.UpdatePopover,\n handler: Effect.fnUntraced(function* (input) {\n const { subject, state, side, kind, props } = input;\n updateState(() => {\n const base: Partial<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 OperationResolver.make({\n operation: LayoutOperation.SwitchWorkspace,\n handler: Effect.fnUntraced(function* ({ subject }) {\n updateState(() => ({ workspace: subject }));\n }),\n }),\n ]);\n }),\n);\n"],
|
|
5
|
-
"mappings": ";;;;;;AAIA,YAAYA,YAAY;AAExB,SAASC,cAAcC,kBAAkB;AACzC,SAASC,uBAAuB;AAChC,SAASC,yBAAyB;AAIlC,IAAA,6BAAeC,WAAWC,WACjBC,kBAAW,aAAA;AAChB,QAAMC,WAAW,OAAOH,WAAWI,IAAIC,aAAaC,YAAY;AAChE,QAAMC,YAAY,OAAOP,WAAWI,IAAII,WAAAA;AAExC,QAAMC,cAAc,CAACC,OAAAA;AACnB,UAAMC,UAAUR,SAASC,IAAIG,SAAAA;AAC7BJ,aAASS,IAAIL,WAAW;MAAE,GAAGI;MAAS,GAAGD,GAAGC,OAAAA;IAAS,CAAA;EACvD;AAEA,SAAOX,WAAWa,YAAYR,aAAaS,mBAAmB;IAC5DA,kBAAkBC,KAAK;MACrBC,WAAWC,gBAAgBC;MAC3BC,SAAgBjB,kBAAW,WAAW,EAAEkB,MAAK,GAAE;AAC7CX,oBAAY,CAACY,WAAAA;AACX,gBAAMC,OAAOF,SAASC,OAAOE;AAC7B,cAAID,SAASD,OAAOE,cAAc;AAChC,mBAAO;cAAEA,cAAcD;YAAK;UAC9B;AACA,iBAAO,CAAC;QACV,CAAA;MACF,CAAA;IACF,CAAA;IACAR,kBAAkBC,KAAK;MACrBC,WAAWC,gBAAgBO;MAC3BL,SAAgBjB,kBAAW,WAAW,EAAEkB,MAAK,GAAE;AAC7CX,oBAAY,CAACY,WAAAA;AACX,gBAAMC,OAAOF,SAASC,OAAOI;AAC7B,cAAIH,SAASD,OAAOI,2BAA2B;AAC7C,mBAAO;cAAEA,2BAA2BH;YAAK;UAC3C;AACA,iBAAO,CAAC;QACV,CAAA;MACF,CAAA;IACF,CAAA;IACAR,kBAAkBC,KAAK;MACrBC,WAAWC,gBAAgBS;MAC3BP,SAAgBjB,kBAAW,WAAW,EACpCyB,SACAP,OACAQ,MACAC,YACAC,gBACAC,cACAC,MAAK,GACN;AACCvB,oBAAY,OAAO;UACjBwB,YAAYb,SAASc,QAAQP,OAAAA;UAC7BQ,YAAYP,QAAQ;UACpBQ,kBAAkBP,cAAc;UAChCQ,sBAAsBP;UACtBQ,oBAAoBP;UACpBQ,eAAeZ,UAAU;YAAEa,WAAWb;YAASK;UAAM,IAAI;QAC3D,EAAA;MACF,CAAA;IACF,CAAA;IACAlB,kBAAkBC,KAAK;MACrBC,WAAWC,gBAAgBwB;MAC3BtB,SAAgBjB,kBAAW,WAAWwC,OAAK;AACzC,cAAM,EAAEf,SAASP,OAAOuB,MAAMC,MAAMZ,MAAK,IAAKU;AAC9CjC,oBAAY,MAAA;AACV,gBAAMoC,OAAkC;YACtCC,aAAaF,QAAQ;YACrBG,cAAcH,SAAS,SAASF,MAAMM,QAAQC;YAC9CC,gBACE,OAAOvB,YAAY,WAAW;cAAEa,WAAWb;cAASK;YAAM,IAAIL,UAAU;cAAEA;YAAQ,IAAIsB;YACxFE,aAAa/B,SAASc,QAAQP,OAAAA;YAC9ByB,aAAaT;UACf;AACA,cAAI,aAAaD,SAASA,MAAMW,YAAY,WAAW;AACrD,mBAAO;cAAE,GAAGR;cAAMS,gBAAgB;cAAWC,eAAeb,MAAMc;YAAO;UAC3E,WAAW,cAAcd,OAAO;AAC9B,mBAAO;cAAE,GAAGG;cAAMS,gBAAgB;cAASG,iBAAiBf,MAAMgB;YAAS;UAC7E;AACA,iBAAOb;QACT,CAAA;MACF,CAAA;IACF,CAAA;IACA/B,kBAAkBC,KAAK;MACrBC,WAAWC,gBAAgB0C;MAC3BxC,SAAgBjB,kBAAW,WAAW,EAAEyB,QAAO,GAAE;AAC/ClB,oBAAY,OAAO;UAAEmD,WAAWjC;QAAQ,EAAA;MAC1C,CAAA;IACF,CAAA;GACD;AACH,CAAA,CAAA;",
|
|
6
|
-
"names": ["Effect", "Capabilities", "Capability", "LayoutOperation", "OperationResolver", "Capability", "makeModule", "fnUntraced", "registry", "get", "Capabilities", "AtomRegistry", "stateAtom", "LayoutState", "updateState", "fn", "current", "set", "contributes", "OperationResolver", "make", "operation", "LayoutOperation", "UpdateSidebar", "handler", "state", "layout", "next", "sidebarState", "UpdateComplementary", "complementarySidebarState", "UpdateDialog", "subject", "type", "blockAlign", "overlayClasses", "overlayStyle", "props", "dialogOpen", "Boolean", "dialogType", "dialogBlockAlign", "dialogOverlayClasses", "dialogOverlayStyle", "dialogContent", "component", "UpdatePopover", "input", "side", "kind", "base", "popoverKind", "popoverTitle", "title", "undefined", "popoverContent", "popoverOpen", "popoverSide", "variant", "popoverVariant", "popoverAnchor", "anchor", "popoverAnchorId", "anchorId", "SwitchWorkspace", "workspace"]
|
|
7
|
-
}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
|
-
import {
|
|
3
|
-
LayoutState
|
|
4
|
-
} from "./chunk-NWN7D2LS.mjs";
|
|
5
|
-
|
|
6
|
-
// src/capabilities/state/state.tsx
|
|
7
|
-
import { Atom } from "@effect-atom/atom-react";
|
|
8
|
-
import * as Effect from "effect/Effect";
|
|
9
|
-
import { Capability } from "@dxos/app-framework";
|
|
10
|
-
import { AppCapabilities } from "@dxos/app-toolkit";
|
|
11
|
-
var defaultState = {
|
|
12
|
-
sidebarState: "closed",
|
|
13
|
-
complementarySidebarState: "closed",
|
|
14
|
-
dialogOpen: false,
|
|
15
|
-
workspace: "default"
|
|
16
|
-
};
|
|
17
|
-
var state_default = Capability.makeModule(Effect.fnUntraced(function* (props) {
|
|
18
|
-
const { initialState } = props ?? {};
|
|
19
|
-
const stateAtom = Atom.make({
|
|
20
|
-
...defaultState,
|
|
21
|
-
...initialState
|
|
22
|
-
});
|
|
23
|
-
const layoutAtom = Atom.make((get) => {
|
|
24
|
-
const state = get(stateAtom);
|
|
25
|
-
return {
|
|
26
|
-
mode: "storybook",
|
|
27
|
-
dialogOpen: state.dialogOpen,
|
|
28
|
-
sidebarOpen: state.sidebarState === "expanded",
|
|
29
|
-
complementarySidebarOpen: state.complementarySidebarState === "expanded",
|
|
30
|
-
workspace: state.workspace,
|
|
31
|
-
active: [],
|
|
32
|
-
inactive: [],
|
|
33
|
-
scrollIntoView: void 0
|
|
34
|
-
};
|
|
35
|
-
});
|
|
36
|
-
return [
|
|
37
|
-
Capability.contributes(LayoutState, stateAtom),
|
|
38
|
-
Capability.contributes(AppCapabilities.Layout, layoutAtom)
|
|
39
|
-
];
|
|
40
|
-
}));
|
|
41
|
-
export {
|
|
42
|
-
state_default as default
|
|
43
|
-
};
|
|
44
|
-
//# sourceMappingURL=state-ZJEK6SP7.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/capabilities/state/state.tsx"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { Atom } from '@effect-atom/atom-react';\nimport * as Effect from 'effect/Effect';\n\nimport { Capability } from '@dxos/app-framework';\nimport { AppCapabilities } from '@dxos/app-toolkit';\n\nimport { LayoutState, type LayoutStateProps } from '../../types';\n\nconst defaultState: LayoutStateProps = {\n sidebarState: 'closed',\n complementarySidebarState: 'closed',\n dialogOpen: false,\n workspace: 'default',\n};\n\nexport default Capability.makeModule(\n Effect.fnUntraced(function* (props?: { initialState?: Partial<LayoutStateProps> }) {\n const { initialState } = props ?? {};\n const stateAtom = Atom.make<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 [Capability.contributes(LayoutState, stateAtom), Capability.contributes(AppCapabilities.Layout, layoutAtom)];\n }),\n);\n"],
|
|
5
|
-
"mappings": ";;;;;;AAIA,SAASA,YAAY;AACrB,YAAYC,YAAY;AAExB,SAASC,kBAAkB;AAC3B,SAASC,uBAAuB;AAIhC,IAAMC,eAAiC;EACrCC,cAAc;EACdC,2BAA2B;EAC3BC,YAAY;EACZC,WAAW;AACb;AAEA,IAAA,gBAAeC,WAAWC,WACjBC,kBAAW,WAAWC,OAAoD;AAC/E,QAAM,EAAEC,aAAY,IAAKD,SAAS,CAAC;AACnC,QAAME,YAAYC,KAAKC,KAAuB;IAAE,GAAGZ;IAAc,GAAGS;EAAa,CAAA;AAEjF,QAAMI,aAAaF,KAAKC,KAAK,CAACE,QAAAA;AAC5B,UAAMC,QAAQD,IAAIJ,SAAAA;AAClB,WAAO;MACLM,MAAM;MACNb,YAAYY,MAAMZ;MAClBc,aAAaF,MAAMd,iBAAiB;MACpCiB,0BAA0BH,MAAMb,8BAA8B;MAC9DE,WAAWW,MAAMX;MACjBe,QAAQ,CAAA;MACRC,UAAU,CAAA;MACVC,gBAAgBC;IAClB;EACF,CAAA;AAEA,SAAO;IAACjB,WAAWkB,YAAYC,aAAad,SAAAA;IAAYL,WAAWkB,YAAYE,gBAAgBC,QAAQb,UAAAA;;AACzG,CAAA,CAAA;",
|
|
6
|
-
"names": ["Atom", "Effect", "Capability", "AppCapabilities", "defaultState", "sidebarState", "complementarySidebarState", "dialogOpen", "workspace", "Capability", "makeModule", "fnUntraced", "props", "initialState", "stateAtom", "Atom", "make", "layoutAtom", "get", "state", "mode", "sidebarOpen", "complementarySidebarOpen", "active", "inactive", "scrollIntoView", "undefined", "contributes", "LayoutState", "AppCapabilities", "Layout"]
|
|
7
|
-
}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { Capability } from '@dxos/app-framework';
|
|
2
|
-
export declare const OperationResolver: Capability.LazyCapability<void, Capability.Capability<Capability.InterfaceDef<import("@dxos/app-framework/Capabilities").OperationResolver[]>>, Error>;
|
|
3
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/capabilities/operation-resolver/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjD,eAAO,MAAM,iBAAiB,wJAA6E,CAAC"}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import * as Effect from 'effect/Effect';
|
|
2
|
-
import { Capabilities, Capability } from '@dxos/app-framework';
|
|
3
|
-
declare const _default: (props: void) => Effect.Effect<Capability.Capability<Capability.InterfaceDef<Capabilities.OperationResolver[]>>, Error, Capability.Service>;
|
|
4
|
-
export default _default;
|
|
5
|
-
//# sourceMappingURL=operation-resolver.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"operation-resolver.d.ts","sourceRoot":"","sources":["../../../../../src/capabilities/operation-resolver/operation-resolver.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;;AAM/D,wBAsFE"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { Capability } from '@dxos/app-framework';
|
|
2
|
-
export declare const State: Capability.LazyCapability<{
|
|
3
|
-
initialState?: Partial<import("../../types").LayoutStateProps>;
|
|
4
|
-
} | undefined, [Capability.Capability<Capability.InterfaceDef<import("@effect-atom/atom/Atom").Writable<import("../../types").LayoutStateProps, import("../../types").LayoutStateProps>>>, Capability.Capability<Capability.InterfaceDef<import("@effect-atom/atom/Atom").Atom<Readonly<{
|
|
5
|
-
mode: string;
|
|
6
|
-
dialogOpen: boolean;
|
|
7
|
-
sidebarOpen: boolean;
|
|
8
|
-
complementarySidebarOpen: boolean;
|
|
9
|
-
workspace: string;
|
|
10
|
-
active: string[];
|
|
11
|
-
inactive: string[];
|
|
12
|
-
scrollIntoView: string | undefined;
|
|
13
|
-
}>>>>], Error>;
|
|
14
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/capabilities/state/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjD,eAAO,MAAM,KAAK;;;;;;;;;;;cAAoD,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../../../../src/capabilities/state/state.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAC/C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAGjD,OAAO,EAAe,KAAK,gBAAgB,EAAE,MAAM,aAAa,CAAC;;mBAUT,OAAO,CAAC,gBAAgB,CAAC;;;;;;;;;;;AADjF,wBAqBE"}
|