@dxos/plugin-testing 0.8.4-main.c85a9c8dae → 0.8.4-main.d9fc60f731
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/LICENSE +102 -5
- 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-C7HWAFWJ.mjs +21 -0
- package/dist/lib/neutral/chunk-C7HWAFWJ.mjs.map +7 -0
- package/dist/lib/{browser/chunk-YHPXIILW.mjs → neutral/chunk-HI5MWUZZ.mjs} +8 -10
- package/dist/lib/neutral/chunk-HI5MWUZZ.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-S4IEYCPX.mjs +8 -0
- package/dist/lib/neutral/chunk-S4IEYCPX.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/neutral/close-L3FBJQ3J.mjs +12 -0
- package/dist/lib/neutral/close-L3FBJQ3J.mjs.map +7 -0
- package/dist/lib/{browser → neutral/components}/index.mjs +53 -77
- 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 +36 -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-O5FFJF2B.mjs +17 -0
- package/dist/lib/neutral/open-O5FFJF2B.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-MIKI67FF.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 -0
- package/dist/types/src/components/Layout/index.d.ts +2 -0
- package/dist/types/src/components/Layout/index.d.ts.map +1 -0
- 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/meta.d.ts +1 -1
- package/dist/types/src/meta.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 +63 -21
- 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 +228 -0
- package/src/components/Layout/index.ts +5 -0
- package/src/core.ts +20 -13
- package/src/harness.ts +51 -0
- package/src/index.ts +6 -0
- package/src/meta.ts +6 -4
- 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 +20 -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} +7 -2
- package/src/types/index.ts +1 -1
- package/dist/lib/browser/chunk-YHPXIILW.mjs.map +0 -7
- package/dist/lib/browser/index.mjs.map +0 -7
- package/dist/lib/browser/meta.json +0 -1
- package/dist/lib/browser/operation-resolver-FLU4ZARD.mjs +0 -112
- package/dist/lib/browser/operation-resolver-FLU4ZARD.mjs.map +0 -7
- package/dist/lib/browser/state-MIKI67FF.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-OWK6XE6C.mjs +0 -23
- package/dist/lib/node-esm/chunk-OWK6XE6C.mjs.map +0 -7
- package/dist/lib/node-esm/index.mjs +0 -206
- 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-NWF6KBHP.mjs +0 -113
- package/dist/lib/node-esm/operation-resolver-NWF6KBHP.mjs.map +0 -7
- package/dist/lib/node-esm/state-JQVVUKO2.mjs +0 -44
- package/dist/lib/node-esm/state-JQVVUKO2.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/components/Layout.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
- package/src/components/Layout.tsx +0 -176
- /package/dist/types/src/components/{Layout.d.ts → Layout/Layout.d.ts} +0 -0
package/LICENSE
CHANGED
|
@@ -1,8 +1,105 @@
|
|
|
1
|
-
|
|
2
|
-
Copyright (c) 2022 DXOS
|
|
1
|
+
# Functional Source License, Version 1.1, ALv2 Future License
|
|
3
2
|
|
|
4
|
-
|
|
3
|
+
## Abbreviation
|
|
5
4
|
|
|
6
|
-
|
|
5
|
+
FSL-1.1-Apache-2.0
|
|
7
6
|
|
|
8
|
-
|
|
7
|
+
## Notice
|
|
8
|
+
|
|
9
|
+
Copyright 2026 DXOS
|
|
10
|
+
|
|
11
|
+
## Terms and Conditions
|
|
12
|
+
|
|
13
|
+
### Licensor ("We")
|
|
14
|
+
|
|
15
|
+
The party offering the Software under these Terms and Conditions.
|
|
16
|
+
|
|
17
|
+
### The Software
|
|
18
|
+
|
|
19
|
+
The "Software" is each version of the software that we make available under
|
|
20
|
+
these Terms and Conditions, as indicated by our inclusion of these Terms and
|
|
21
|
+
Conditions with the Software.
|
|
22
|
+
|
|
23
|
+
### License Grant
|
|
24
|
+
|
|
25
|
+
Subject to your compliance with this License Grant and the Patents,
|
|
26
|
+
Redistribution and Trademark clauses below, we hereby grant you the right to
|
|
27
|
+
use, copy, modify, create derivative works, publicly perform, publicly display
|
|
28
|
+
and redistribute the Software for any Permitted Purpose identified below.
|
|
29
|
+
|
|
30
|
+
### Permitted Purpose
|
|
31
|
+
|
|
32
|
+
A Permitted Purpose is any purpose other than a Competing Use. A Competing Use
|
|
33
|
+
means making the Software available to others in a commercial product or
|
|
34
|
+
service that:
|
|
35
|
+
|
|
36
|
+
1. substitutes for the Software;
|
|
37
|
+
|
|
38
|
+
2. substitutes for any other product or service we offer using the Software
|
|
39
|
+
that exists as of the date we make the Software available; or
|
|
40
|
+
|
|
41
|
+
3. offers the same or substantially similar functionality as the Software.
|
|
42
|
+
|
|
43
|
+
Permitted Purposes specifically include using the Software:
|
|
44
|
+
|
|
45
|
+
1. for your internal use and access;
|
|
46
|
+
|
|
47
|
+
2. for non-commercial education;
|
|
48
|
+
|
|
49
|
+
3. for non-commercial research; and
|
|
50
|
+
|
|
51
|
+
4. in connection with professional services that you provide to a licensee
|
|
52
|
+
using the Software in accordance with these Terms and Conditions.
|
|
53
|
+
|
|
54
|
+
### Patents
|
|
55
|
+
|
|
56
|
+
To the extent your use for a Permitted Purpose would necessarily infringe our
|
|
57
|
+
patents, the license grant above includes a license under our patents. If you
|
|
58
|
+
make a claim against any party that the Software infringes or contributes to
|
|
59
|
+
the infringement of any patent, then your patent license to the Software ends
|
|
60
|
+
immediately.
|
|
61
|
+
|
|
62
|
+
### Redistribution
|
|
63
|
+
|
|
64
|
+
The Terms and Conditions apply to all copies, modifications and derivatives of
|
|
65
|
+
the Software.
|
|
66
|
+
|
|
67
|
+
If you redistribute any copies, modifications or derivatives of the Software,
|
|
68
|
+
you must include a copy of or a link to these Terms and Conditions and not
|
|
69
|
+
remove any copyright notices provided in or with the Software.
|
|
70
|
+
|
|
71
|
+
### Disclaimer
|
|
72
|
+
|
|
73
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTIES OF ANY KIND, EXPRESS OR
|
|
74
|
+
IMPLIED, INCLUDING WITHOUT LIMITATION WARRANTIES OF FITNESS FOR A PARTICULAR
|
|
75
|
+
PURPOSE, MERCHANTABILITY, TITLE OR NON-INFRINGEMENT.
|
|
76
|
+
|
|
77
|
+
IN NO EVENT WILL WE HAVE ANY LIABILITY TO YOU ARISING OUT OF OR RELATED TO THE
|
|
78
|
+
SOFTWARE, INCLUDING INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES,
|
|
79
|
+
EVEN IF WE HAVE BEEN INFORMED OF THEIR POSSIBILITY IN ADVANCE.
|
|
80
|
+
|
|
81
|
+
### Trademarks
|
|
82
|
+
|
|
83
|
+
Except for displaying the License Details and identifying us as the origin of
|
|
84
|
+
the Software, you have no right under these Terms and Conditions to use our
|
|
85
|
+
trademarks, trade names, service marks or product names.
|
|
86
|
+
|
|
87
|
+
## Grant of Future License
|
|
88
|
+
|
|
89
|
+
We hereby irrevocably grant you an additional license to use the Software under
|
|
90
|
+
the Apache License, Version 2.0 that is effective on the second anniversary of
|
|
91
|
+
the date we make the Software available. On or after that date, you may use the
|
|
92
|
+
Software under the Apache License, Version 2.0, in which case the following
|
|
93
|
+
will apply:
|
|
94
|
+
|
|
95
|
+
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
96
|
+
this file except in compliance with the License.
|
|
97
|
+
|
|
98
|
+
You may obtain a copy of the License at
|
|
99
|
+
|
|
100
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
101
|
+
|
|
102
|
+
Unless required by applicable law or agreed to in writing, software distributed
|
|
103
|
+
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
|
104
|
+
CONDITIONS OF ANY KIND, either express or implied. See the License for the
|
|
105
|
+
specific language governing permissions and limitations under the License.
|
|
@@ -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,21 @@
|
|
|
1
|
+
// src/core.ts
|
|
2
|
+
import { ProcessManagerPlugin } 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/testing";
|
|
7
|
+
import { defaultTx } from "@dxos/react-ui";
|
|
8
|
+
var corePlugins = () => [
|
|
9
|
+
AttentionPlugin(),
|
|
10
|
+
GraphPlugin(),
|
|
11
|
+
ProcessManagerPlugin(),
|
|
12
|
+
SettingsPlugin(),
|
|
13
|
+
ThemePlugin({
|
|
14
|
+
tx: defaultTx
|
|
15
|
+
})
|
|
16
|
+
];
|
|
17
|
+
|
|
18
|
+
export {
|
|
19
|
+
corePlugins
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=chunk-C7HWAFWJ.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 { type Plugin, ProcessManagerPlugin } from '@dxos/app-framework';\n// `/testing` entrypoints re-export the plugin eagerly (without `Plugin.lazy`).\n// The default `.` and `/plugin` exports wrap each plugin in a lazy stub\n// (`() => import('./XPlugin')`), which webkit cannot reliably resolve under\n// vite-dev: the dynamic-import promise can settle with a partially-evaluated\n// namespace, throwing `ReferenceError: Cannot access 'default' before\n// initialization` from the loader's `mod.default` access. Storybook runs\n// inside `storybook dev` (vite-dev) and is currently the only host that hits\n// this. Production hosts (composer-app via `vite preview`) keep using the\n// lazy `.` exports and their associated code splitting.\n//\n// Use these `/testing` entrypoints from any storybook `withPluginManager`\n// setup. The single-line `export * from './XPlugin'` re-exports avoid the\n// dynamic-import path entirely — see e.g. `plugin-attention/src/testing.ts`.\nimport { AttentionPlugin } from '@dxos/plugin-attention/testing';\nimport { GraphPlugin } from '@dxos/plugin-graph/testing';\nimport { SettingsPlugin } from '@dxos/plugin-settings/testing';\nimport { ThemePlugin } from '@dxos/plugin-theme/testing';\nimport { defaultTx } from '@dxos/react-ui';\n\n/**\n * Core plugins for testing/storybook environments.\n * NOTE: Does not include SpacePlugin to avoid circular dependencies.\n * Import SpacePlugin directly in your stories if needed.\n */\nexport const corePlugins = (): Plugin.Plugin[] => [\n AttentionPlugin(),\n GraphPlugin(),\n ProcessManagerPlugin(),\n SettingsPlugin(),\n ThemePlugin({ tx: defaultTx }),\n];\n"],
|
|
5
|
+
"mappings": ";AAIA,SAAsBA,4BAA4B;AAclD,SAASC,uBAAuB;AAChC,SAASC,mBAAmB;AAC5B,SAASC,sBAAsB;AAC/B,SAASC,mBAAmB;AAC5B,SAASC,iBAAiB;AAOnB,IAAMC,cAAc,MAAuB;EAChDL,gBAAAA;EACAC,YAAAA;EACAF,qBAAAA;EACAG,eAAAA;EACAC,YAAY;IAAEG,IAAIF;EAAU,CAAA;;",
|
|
6
|
+
"names": ["ProcessManagerPlugin", "AttentionPlugin", "GraphPlugin", "SettingsPlugin", "ThemePlugin", "defaultTx", "corePlugins", "tx"]
|
|
7
|
+
}
|
|
@@ -1,21 +1,19 @@
|
|
|
1
1
|
// src/meta.ts
|
|
2
|
+
import { Plugin } from "@dxos/app-framework";
|
|
3
|
+
import { DXN } from "@dxos/keys";
|
|
2
4
|
import { trim } from "@dxos/util";
|
|
3
|
-
var meta = {
|
|
4
|
-
|
|
5
|
+
var meta = Plugin.makeMeta({
|
|
6
|
+
key: DXN.make("org.dxos.plugin.storybookLayout"),
|
|
5
7
|
name: "Storybook",
|
|
8
|
+
author: "DXOS",
|
|
6
9
|
description: trim`
|
|
7
10
|
Development layout optimized for Storybook component testing and documentation.
|
|
8
11
|
Provides specialized views for component development and design system exploration.
|
|
9
12
|
`,
|
|
10
13
|
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`);
|
|
14
|
+
});
|
|
16
15
|
|
|
17
16
|
export {
|
|
18
|
-
meta
|
|
19
|
-
LayoutState
|
|
17
|
+
meta
|
|
20
18
|
};
|
|
21
|
-
//# sourceMappingURL=chunk-
|
|
19
|
+
//# sourceMappingURL=chunk-HI5MWUZZ.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 { Plugin } from '@dxos/app-framework';\nimport { DXN } from '@dxos/keys';\nimport { trim } from '@dxos/util';\n\nexport const meta = Plugin.makeMeta({\n key: DXN.make('org.dxos.plugin.storybookLayout'),\n name: 'Storybook',\n author: 'DXOS',\n description: trim`\n Development layout optimized for Storybook component testing and documentation.\n Provides specialized views for component development and design system exploration.\n `,\n source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-testing',\n});\n"],
|
|
5
|
+
"mappings": ";AAIA,SAASA,cAAc;AACvB,SAASC,WAAW;AACpB,SAASC,YAAY;AAEd,IAAMC,OAAOH,OAAOI,SAAS;EAClCC,KAAKJ,IAAIK,KAAK,iCAAA;EACdC,MAAM;EACNC,QAAQ;EACRC,aAAaP;;;;EAIbQ,QAAQ;AACV,CAAA;",
|
|
6
|
+
"names": ["Plugin", "DXN", "trim", "meta", "makeMeta", "key", "make", "name", "author", "description", "source"]
|
|
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,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-O5FFJF2B.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-S4IEYCPX.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,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
|
+
}
|
|
@@ -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,54 +1,44 @@
|
|
|
1
|
-
import
|
|
2
|
-
LayoutState,
|
|
3
|
-
meta
|
|
4
|
-
} from "./chunk-YHPXIILW.mjs";
|
|
1
|
+
import "../chunk-J5LGTIGS.mjs";
|
|
5
2
|
|
|
6
|
-
// src/
|
|
7
|
-
import { OperationPlugin, RuntimePlugin } from "@dxos/app-framework";
|
|
8
|
-
import { AttentionPlugin } from "@dxos/plugin-attention";
|
|
9
|
-
import { ClientPlugin } from "@dxos/plugin-client";
|
|
10
|
-
import { GraphPlugin } from "@dxos/plugin-graph";
|
|
11
|
-
import { SettingsPlugin } from "@dxos/plugin-settings";
|
|
12
|
-
import { ThemePlugin } from "@dxos/plugin-theme";
|
|
13
|
-
import { defaultTx } from "@dxos/ui-theme";
|
|
14
|
-
var corePlugins = () => [
|
|
15
|
-
AttentionPlugin(),
|
|
16
|
-
GraphPlugin(),
|
|
17
|
-
OperationPlugin(),
|
|
18
|
-
RuntimePlugin(),
|
|
19
|
-
SettingsPlugin(),
|
|
20
|
-
ThemePlugin({
|
|
21
|
-
tx: defaultTx
|
|
22
|
-
})
|
|
23
|
-
];
|
|
24
|
-
|
|
25
|
-
// src/StorybookPlugin.ts
|
|
26
|
-
import * as Effect from "effect/Effect";
|
|
27
|
-
import { ActivationEvents, Capabilities, Capability as Capability3, Plugin } from "@dxos/app-framework";
|
|
28
|
-
import { AppActivationEvents, AppPlugin } from "@dxos/app-toolkit";
|
|
29
|
-
|
|
30
|
-
// src/capabilities/operation-resolver/index.ts
|
|
31
|
-
import { Capability } from "@dxos/app-framework";
|
|
32
|
-
var OperationResolver = Capability.lazy("OperationResolver", () => import("./operation-resolver-FLU4ZARD.mjs"));
|
|
33
|
-
|
|
34
|
-
// src/capabilities/state/index.ts
|
|
35
|
-
import { Capability as Capability2 } from "@dxos/app-framework";
|
|
36
|
-
var State = Capability2.lazy("State", () => import("./state-MIKI67FF.mjs"));
|
|
37
|
-
|
|
38
|
-
// src/components/Layout.tsx
|
|
3
|
+
// src/components/Layout/Layout.tsx
|
|
39
4
|
import { RegistryContext, useAtomValue } from "@effect-atom/atom-react";
|
|
40
5
|
import React, { useCallback, useContext, useEffect, useRef, useState } from "react";
|
|
41
6
|
import { Surface, useCapability } from "@dxos/app-framework/ui";
|
|
42
|
-
import {
|
|
7
|
+
import { AppSurface } from "@dxos/app-toolkit/ui";
|
|
8
|
+
import { AlertDialog, Button, Dialog, Main, Popover, Toast, toLocalizedString, useTranslation } from "@dxos/react-ui";
|
|
43
9
|
import { Card } from "@dxos/react-ui";
|
|
44
10
|
import { Mosaic } from "@dxos/react-ui-mosaic";
|
|
45
11
|
import { descriptionMessage, mx } from "@dxos/ui-theme";
|
|
12
|
+
import { meta } from "#meta";
|
|
13
|
+
import { StorybookCapabilities } from "#types";
|
|
46
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.Title, {
|
|
27
|
+
icon: toast.icon,
|
|
28
|
+
onClose: toast.closeLabel ? () => onDismiss(toast.id) : void 0
|
|
29
|
+
}, toast.title && /* @__PURE__ */ React.createElement("span", null, toLocalizedString(toast.title, t))), toast.description && /* @__PURE__ */ React.createElement(Toast.Description, null, toLocalizedString(toast.description, t)), toast.onAction && toast.actionAlt && toast.actionLabel && /* @__PURE__ */ React.createElement(Toast.Actions, null, /* @__PURE__ */ React.createElement(Toast.Action, {
|
|
30
|
+
altText: toLocalizedString(toast.actionAlt, t),
|
|
31
|
+
asChild: true
|
|
32
|
+
}, /* @__PURE__ */ React.createElement(Button, {
|
|
33
|
+
variant: "primary",
|
|
34
|
+
onClick: () => toast.onAction?.()
|
|
35
|
+
}, toLocalizedString(toast.actionLabel, t)))));
|
|
36
|
+
};
|
|
47
37
|
var Layout = ({ children }) => {
|
|
48
38
|
const { t } = useTranslation(meta.id);
|
|
49
39
|
const trigger = useRef(null);
|
|
50
40
|
const registry = useContext(RegistryContext);
|
|
51
|
-
const stateAtom = useCapability(LayoutState);
|
|
41
|
+
const stateAtom = useCapability(StorybookCapabilities.LayoutState);
|
|
52
42
|
const layout = useAtomValue(stateAtom);
|
|
53
43
|
const [iter, setIter] = useState(0);
|
|
54
44
|
const [open, setOpen] = useState(false);
|
|
@@ -102,10 +92,17 @@ var Layout = ({ children }) => {
|
|
|
102
92
|
}, [
|
|
103
93
|
handleClose
|
|
104
94
|
]);
|
|
95
|
+
const handleDismissToast = useCallback((id) => {
|
|
96
|
+
updateState({
|
|
97
|
+
toasts: layout.toasts.filter((toast) => toast.id !== id)
|
|
98
|
+
});
|
|
99
|
+
}, [
|
|
100
|
+
updateState,
|
|
101
|
+
layout.toasts
|
|
102
|
+
]);
|
|
105
103
|
const DialogRoot = layout.dialogType === "alert" ? AlertDialog.Root : Dialog.Root;
|
|
106
104
|
const DialogOverlay = layout.dialogType === "alert" ? AlertDialog.Overlay : Dialog.Overlay;
|
|
107
|
-
return /* @__PURE__ */ React.createElement("div", {
|
|
108
|
-
role: "none",
|
|
105
|
+
return /* @__PURE__ */ React.createElement(Toast.Provider, null, /* @__PURE__ */ React.createElement("div", {
|
|
109
106
|
className: "fixed inset-0 flex overflow-hidden"
|
|
110
107
|
}, /* @__PURE__ */ React.createElement(Mosaic.Root, null, /* @__PURE__ */ React.createElement(Popover.Root, {
|
|
111
108
|
open
|
|
@@ -125,7 +122,7 @@ var Layout = ({ children }) => {
|
|
|
125
122
|
dialogOpen: nextOpen
|
|
126
123
|
})
|
|
127
124
|
}, layout.dialogBlockAlign === "end" ? /* @__PURE__ */ React.createElement(Surface.Surface, {
|
|
128
|
-
|
|
125
|
+
type: AppSurface.Dialog,
|
|
129
126
|
data: layout.dialogContent,
|
|
130
127
|
limit: 1,
|
|
131
128
|
fallback: ErrorFallback,
|
|
@@ -135,7 +132,7 @@ var Layout = ({ children }) => {
|
|
|
135
132
|
classNames: layout.dialogOverlayClasses,
|
|
136
133
|
style: layout.dialogOverlayStyle
|
|
137
134
|
}, /* @__PURE__ */ React.createElement(Surface.Surface, {
|
|
138
|
-
|
|
135
|
+
type: AppSurface.Dialog,
|
|
139
136
|
data: layout.dialogContent,
|
|
140
137
|
limit: 1,
|
|
141
138
|
fallback: ErrorFallback
|
|
@@ -144,21 +141,27 @@ var Layout = ({ children }) => {
|
|
|
144
141
|
virtualRef: trigger
|
|
145
142
|
}), /* @__PURE__ */ React.createElement(Popover.Portal, null, /* @__PURE__ */ React.createElement(Popover.Content, {
|
|
146
143
|
side: layout.popoverSide,
|
|
144
|
+
onOpenAutoFocus: (event) => event.preventDefault(),
|
|
147
145
|
onInteractOutside: handleInteractOutside,
|
|
148
146
|
onEscapeKeyDown: handleInteractOutside,
|
|
149
147
|
sticky: "always",
|
|
150
148
|
hideWhenDetached: true
|
|
151
|
-
}, /* @__PURE__ */ React.createElement(Popover.Viewport, null, layout.popoverKind === "card" && /* @__PURE__ */ React.createElement(Card.Root, null, /* @__PURE__ */ React.createElement(Card.
|
|
149
|
+
}, /* @__PURE__ */ React.createElement(Popover.Viewport, null, layout.popoverKind === "card" && /* @__PURE__ */ React.createElement(Card.Root, null, /* @__PURE__ */ React.createElement(Card.Header, null, /* @__PURE__ */ React.createElement(Card.DragHandle, null), layout.popoverTitle ? /* @__PURE__ */ React.createElement(Card.Title, null, toLocalizedString(layout.popoverTitle, t)) : /* @__PURE__ */ React.createElement("span", null), /* @__PURE__ */ React.createElement(Card.ActionIconButton, {
|
|
150
|
+
action: "close",
|
|
152
151
|
onClick: handleClose
|
|
153
152
|
})), /* @__PURE__ */ React.createElement(Surface.Surface, {
|
|
154
|
-
|
|
153
|
+
type: AppSurface.Card,
|
|
155
154
|
data: layout.popoverContent,
|
|
156
155
|
limit: 1
|
|
157
156
|
})), layout.popoverKind === "base" && /* @__PURE__ */ React.createElement(Surface.Surface, {
|
|
158
|
-
|
|
157
|
+
type: AppSurface.Popover,
|
|
159
158
|
data: layout.popoverContent,
|
|
160
159
|
limit: 1
|
|
161
|
-
})), /* @__PURE__ */ React.createElement(Popover.Arrow, null))))))
|
|
160
|
+
})), /* @__PURE__ */ React.createElement(Popover.Arrow, null))))), layout.toasts.map((toast) => /* @__PURE__ */ React.createElement(StoryToast, {
|
|
161
|
+
key: toast.id,
|
|
162
|
+
toast,
|
|
163
|
+
onDismiss: handleDismissToast
|
|
164
|
+
})), /* @__PURE__ */ React.createElement(Toast.Viewport, null)));
|
|
162
165
|
};
|
|
163
166
|
var ErrorFallback = ({ error }) => {
|
|
164
167
|
const { t } = useTranslation(meta.id);
|
|
@@ -169,37 +172,10 @@ var ErrorFallback = ({ error }) => {
|
|
|
169
172
|
className: mx("overflow-auto p-8 dx-attention-surface grid place-items-center")
|
|
170
173
|
}, /* @__PURE__ */ React.createElement("p", {
|
|
171
174
|
className: mx(descriptionMessage, "break-words rounded-md p-8", errorString.length < 256 && "text-lg")
|
|
172
|
-
}, error ? errorString : t("error
|
|
175
|
+
}, error ? errorString : t("error-fallback.message")));
|
|
173
176
|
};
|
|
174
|
-
|
|
175
|
-
// src/StorybookPlugin.ts
|
|
176
|
-
var StorybookPlugin = Plugin.define(meta).pipe(AppPlugin.addOperationResolverModule({
|
|
177
|
-
activate: OperationResolver
|
|
178
|
-
}), AppPlugin.addReactContextModule({
|
|
179
|
-
activate: () => Effect.succeed(Capability3.contributes(Capabilities.ReactContext, {
|
|
180
|
-
id: "storybook-layout",
|
|
181
|
-
context: Layout
|
|
182
|
-
}))
|
|
183
|
-
}), Plugin.addModule(({ initialState }) => ({
|
|
184
|
-
id: Capability3.getModuleTag(State),
|
|
185
|
-
activatesOn: ActivationEvents.Startup,
|
|
186
|
-
activatesAfter: [
|
|
187
|
-
AppActivationEvents.LayoutReady
|
|
188
|
-
],
|
|
189
|
-
activate: () => State({
|
|
190
|
-
initialState
|
|
191
|
-
})
|
|
192
|
-
})), Plugin.make);
|
|
193
177
|
export {
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
GraphPlugin,
|
|
197
|
-
OperationPlugin,
|
|
198
|
-
RuntimePlugin,
|
|
199
|
-
SettingsPlugin,
|
|
200
|
-
StorybookPlugin,
|
|
201
|
-
ThemePlugin,
|
|
202
|
-
corePlugins,
|
|
203
|
-
meta
|
|
178
|
+
ErrorFallback,
|
|
179
|
+
Layout
|
|
204
180
|
};
|
|
205
181
|
//# sourceMappingURL=index.mjs.map
|