@dxos/plugin-simple-layout 0.8.4-main.52d7546f51 → 0.8.4-main.6fa680abb7
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-O3BQBYMW.mjs → chunk-MDPEKLKR.mjs} +181 -183
- package/dist/lib/browser/chunk-MDPEKLKR.mjs.map +7 -0
- package/dist/lib/browser/{chunk-7VLT3S46.mjs → chunk-MRR7PXSM.mjs} +3 -3
- package/dist/lib/browser/{chunk-7VLT3S46.mjs.map → chunk-MRR7PXSM.mjs.map} +1 -1
- package/dist/lib/browser/index.mjs +6 -6
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{operation-resolver-BYRIQOQT.mjs → operation-resolver-VTZ6HZ4B.mjs} +24 -35
- package/dist/lib/browser/operation-resolver-VTZ6HZ4B.mjs.map +7 -0
- package/dist/lib/browser/{react-root-GPTKI5H2.mjs → react-root-WVQYY2JA.mjs} +3 -3
- package/dist/lib/browser/{react-surface-LT5JJTPR.mjs → react-surface-VLBR37ED.mjs} +11 -8
- package/dist/lib/browser/{react-surface-LT5JJTPR.mjs.map → react-surface-VLBR37ED.mjs.map} +3 -3
- package/dist/lib/browser/{state-A3PGDWWZ.mjs → state-TXSMUWYI.mjs} +2 -2
- package/dist/lib/browser/{url-handler-HTIUY6WL.mjs → url-handler-RBRONH7S.mjs} +18 -19
- package/dist/lib/browser/url-handler-RBRONH7S.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-UAWM4B2S.mjs → chunk-DCKASLMP.mjs} +181 -183
- package/dist/lib/node-esm/chunk-DCKASLMP.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-VIDE5UMB.mjs → chunk-WMNTJ2MK.mjs} +3 -3
- package/dist/lib/node-esm/{chunk-VIDE5UMB.mjs.map → chunk-WMNTJ2MK.mjs.map} +1 -1
- package/dist/lib/node-esm/index.mjs +6 -6
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/{operation-resolver-BDTFNCS2.mjs → operation-resolver-R7CQ6ERU.mjs} +24 -35
- package/dist/lib/node-esm/operation-resolver-R7CQ6ERU.mjs.map +7 -0
- package/dist/lib/node-esm/{react-root-GRG2OAI2.mjs → react-root-XBNDM7BE.mjs} +3 -3
- package/dist/lib/node-esm/{react-surface-TCUSDIN2.mjs → react-surface-U5NHA367.mjs} +11 -8
- package/dist/lib/node-esm/{react-surface-TCUSDIN2.mjs.map → react-surface-U5NHA367.mjs.map} +3 -3
- package/dist/lib/node-esm/{state-ZCFZTTPL.mjs → state-JMX6FAG4.mjs} +2 -2
- package/dist/lib/node-esm/{url-handler-WBVVKVPC.mjs → url-handler-QSMCH3JB.mjs} +18 -19
- package/dist/lib/node-esm/url-handler-QSMCH3JB.mjs.map +7 -0
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts +1 -1
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-root/react-root.d.ts +1 -1
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts +1 -1
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +1 -1
- package/dist/types/src/capabilities/spotlight-dismiss/index.d.ts +1 -1
- package/dist/types/src/capabilities/spotlight-dismiss/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/spotlight-dismiss/spotlight-dismiss.d.ts +1 -1
- package/dist/types/src/capabilities/state/index.d.ts +1 -1
- package/dist/types/src/capabilities/state/state.d.ts +1 -1
- package/dist/types/src/capabilities/url-handler/url-handler.d.ts +3 -3
- package/dist/types/src/capabilities/url-handler/url-handler.d.ts.map +1 -1
- package/dist/types/src/components/ContentError.stories.d.ts +1 -3
- package/dist/types/src/components/ContentError.stories.d.ts.map +1 -1
- package/dist/types/src/components/ContentLoading/ContentLoading.d.ts.map +1 -0
- package/dist/types/src/components/ContentLoading/ContentLoading.stories.d.ts.map +1 -0
- package/dist/types/src/components/ContentLoading/index.d.ts +2 -0
- package/dist/types/src/components/ContentLoading/index.d.ts.map +1 -0
- package/dist/types/src/components/Home/Home.d.ts.map +1 -1
- package/dist/types/src/components/MobileLayout/MobileLayout.stories.d.ts.map +1 -1
- package/dist/types/src/components/NavBranch/NavBranch.d.ts +11 -0
- package/dist/types/src/components/NavBranch/NavBranch.d.ts.map +1 -0
- package/dist/types/src/components/NavBranch/index.d.ts +2 -0
- package/dist/types/src/components/NavBranch/index.d.ts.map +1 -0
- package/dist/types/src/components/Popover/Popover.d.ts.map +1 -1
- package/dist/types/src/components/SimpleLayout/AppBar.d.ts.map +1 -1
- package/dist/types/src/components/SimpleLayout/Drawer.d.ts.map +1 -1
- package/dist/types/src/components/SimpleLayout/Main.d.ts.map +1 -1
- package/dist/types/src/components/SimpleLayout/NavBar.d.ts.map +1 -1
- package/dist/types/src/components/hooks.d.ts +4 -2
- package/dist/types/src/components/hooks.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +1 -1
- package/dist/types/src/hooks/actions.d.ts +3 -4
- package/dist/types/src/hooks/actions.d.ts.map +1 -1
- package/dist/types/src/hooks/useAppBarProps.d.ts.map +1 -1
- package/dist/types/src/hooks/useDrawerActions.d.ts.map +1 -1
- package/dist/types/src/hooks/useNavbarActions.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +29 -28
- package/src/capabilities/operation-resolver/operation-resolver.ts +19 -34
- package/src/capabilities/react-surface/react-surface.tsx +8 -6
- package/src/capabilities/url-handler/url-handler.ts +11 -35
- package/src/components/ContentError.stories.tsx +7 -6
- package/src/components/{ContentLoading.stories.tsx → ContentLoading/ContentLoading.stories.tsx} +1 -1
- package/src/components/{ContentLoading.tsx → ContentLoading/ContentLoading.tsx} +1 -1
- package/src/components/ContentLoading/index.ts +5 -0
- package/src/components/Dialog/Dialog.tsx +3 -3
- package/src/components/Home/Home.tsx +30 -24
- package/src/components/MobileLayout/MobileLayout.stories.tsx +23 -19
- package/src/components/MobileLayout/MobileLayout.tsx +2 -2
- package/src/components/{Workspace/Workspace.tsx → NavBranch/NavBranch.tsx} +43 -32
- package/src/components/{Workspace → NavBranch}/index.ts +1 -1
- package/src/components/Popover/Popover.tsx +14 -4
- package/src/components/SimpleLayout/AppBar.stories.tsx +2 -2
- package/src/components/SimpleLayout/AppBar.tsx +14 -21
- package/src/components/SimpleLayout/Drawer.tsx +15 -21
- package/src/components/SimpleLayout/Main.tsx +11 -10
- package/src/components/SimpleLayout/NavBar.stories.tsx +8 -8
- package/src/components/SimpleLayout/NavBar.tsx +4 -10
- package/src/components/SimpleLayout/SimpleLayout.stories.tsx +2 -2
- package/src/components/SimpleLayout/SimpleLayout.tsx +1 -1
- package/src/components/hooks.ts +8 -8
- package/src/components/index.ts +1 -1
- package/src/hooks/actions.ts +15 -17
- package/src/hooks/useAppBarProps.ts +8 -5
- package/src/hooks/useCompanions.ts +1 -1
- package/src/hooks/useDrawerActions.ts +9 -7
- package/src/hooks/useNavbarActions.ts +10 -9
- package/src/meta.ts +1 -1
- package/src/types/capabilities.ts +1 -1
- package/dist/lib/browser/chunk-O3BQBYMW.mjs.map +0 -7
- package/dist/lib/browser/operation-resolver-BYRIQOQT.mjs.map +0 -7
- package/dist/lib/browser/url-handler-HTIUY6WL.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-UAWM4B2S.mjs.map +0 -7
- package/dist/lib/node-esm/operation-resolver-BDTFNCS2.mjs.map +0 -7
- package/dist/lib/node-esm/url-handler-WBVVKVPC.mjs.map +0 -7
- package/dist/types/src/components/ContentError.d.ts +0 -5
- package/dist/types/src/components/ContentError.d.ts.map +0 -1
- package/dist/types/src/components/ContentLoading.d.ts.map +0 -1
- package/dist/types/src/components/ContentLoading.stories.d.ts.map +0 -1
- package/dist/types/src/components/Workspace/Workspace.d.ts +0 -11
- package/dist/types/src/components/Workspace/Workspace.d.ts.map +0 -1
- package/dist/types/src/components/Workspace/index.d.ts +0 -2
- package/dist/types/src/components/Workspace/index.d.ts.map +0 -1
- package/src/components/ContentError.tsx +0 -23
- /package/dist/lib/browser/{react-root-GPTKI5H2.mjs.map → react-root-WVQYY2JA.mjs.map} +0 -0
- /package/dist/lib/browser/{state-A3PGDWWZ.mjs.map → state-TXSMUWYI.mjs.map} +0 -0
- /package/dist/lib/node-esm/{react-root-GRG2OAI2.mjs.map → react-root-XBNDM7BE.mjs.map} +0 -0
- /package/dist/lib/node-esm/{state-ZCFZTTPL.mjs.map → state-JMX6FAG4.mjs.map} +0 -0
- /package/dist/types/src/components/{ContentLoading.d.ts → ContentLoading/ContentLoading.d.ts} +0 -0
- /package/dist/types/src/components/{ContentLoading.stories.d.ts → ContentLoading/ContentLoading.stories.d.ts} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
SimpleLayoutState,
|
|
3
3
|
meta
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-MRR7PXSM.mjs";
|
|
5
5
|
|
|
6
6
|
// src/components/Home/Home.tsx
|
|
7
7
|
import React, { useCallback, useEffect as useEffect2, useMemo, useRef } from "react";
|
|
@@ -9,24 +9,25 @@ import { useOperationInvoker } from "@dxos/app-framework/ui";
|
|
|
9
9
|
import { LayoutOperation } from "@dxos/app-toolkit";
|
|
10
10
|
import { useAppGraph as useAppGraph2 } from "@dxos/app-toolkit/ui";
|
|
11
11
|
import { Node, useConnections } from "@dxos/plugin-graph";
|
|
12
|
-
import { Avatar, Icon,
|
|
13
|
-
import { Card
|
|
12
|
+
import { Avatar, Icon, Panel, ScrollArea, Toolbar, toLocalizedString, useTranslation } from "@dxos/react-ui";
|
|
13
|
+
import { Card } from "@dxos/react-ui";
|
|
14
|
+
import { Mosaic } from "@dxos/react-ui-mosaic";
|
|
14
15
|
import { SearchList, useSearchListItem, useSearchListResults } from "@dxos/react-ui-searchlist";
|
|
15
16
|
import { mx } from "@dxos/ui-theme";
|
|
16
17
|
import { byPosition } from "@dxos/util";
|
|
17
18
|
|
|
18
19
|
// src/components/hooks.ts
|
|
19
20
|
import { useEffect } from "react";
|
|
21
|
+
import { expandAttendableId } from "@dxos/react-ui-attention";
|
|
20
22
|
import { useAppGraph } from "@dxos/app-toolkit/ui";
|
|
21
23
|
import { Graph } from "@dxos/plugin-graph";
|
|
22
|
-
var
|
|
24
|
+
var useExpandPath = (nodeId) => {
|
|
23
25
|
const { graph } = useAppGraph();
|
|
24
26
|
useEffect(() => {
|
|
25
27
|
if (nodeId) {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
});
|
|
28
|
+
for (const prefix of expandAttendableId(nodeId)) {
|
|
29
|
+
Graph.expand(graph, prefix, "child");
|
|
30
|
+
}
|
|
30
31
|
}
|
|
31
32
|
}, [
|
|
32
33
|
nodeId,
|
|
@@ -40,7 +41,7 @@ var Home = (_) => {
|
|
|
40
41
|
const userAccountItem = useItemsByDisposition("user-account")[0];
|
|
41
42
|
const pinnedItems = useItemsByDisposition("pin-end", true);
|
|
42
43
|
const workspaceItems = useItemsByDisposition("workspace");
|
|
43
|
-
|
|
44
|
+
useExpandPath(Node.RootId);
|
|
44
45
|
const items = useMemo(() => [
|
|
45
46
|
...userAccountItem ? [
|
|
46
47
|
userAccountItem
|
|
@@ -56,14 +57,16 @@ var Home = (_) => {
|
|
|
56
57
|
items,
|
|
57
58
|
extract: (node) => toLocalizedString(node.properties.label, t)
|
|
58
59
|
});
|
|
59
|
-
return /* @__PURE__ */ React.createElement(
|
|
60
|
-
toolbar: true
|
|
61
|
-
}, /* @__PURE__ */ React.createElement(SearchList.Root, {
|
|
60
|
+
return /* @__PURE__ */ React.createElement(SearchList.Root, {
|
|
62
61
|
onSearch: handleSearch
|
|
62
|
+
}, /* @__PURE__ */ React.createElement(Panel.Root, null, /* @__PURE__ */ React.createElement(Panel.Toolbar, {
|
|
63
|
+
asChild: true
|
|
63
64
|
}, /* @__PURE__ */ React.createElement(Toolbar.Root, null, /* @__PURE__ */ React.createElement(SearchList.Input, {
|
|
64
65
|
placeholder: t("search placeholder"),
|
|
65
66
|
autoFocus: true
|
|
66
|
-
})), /* @__PURE__ */ React.createElement(
|
|
67
|
+
}))), /* @__PURE__ */ React.createElement(Panel.Content, {
|
|
68
|
+
asChild: true
|
|
69
|
+
}, /* @__PURE__ */ React.createElement(SearchList.Content, null, /* @__PURE__ */ React.createElement(Mosaic.Container, {
|
|
67
70
|
asChild: true
|
|
68
71
|
}, /* @__PURE__ */ React.createElement(ScrollArea.Root, {
|
|
69
72
|
orientation: "vertical"
|
|
@@ -73,16 +76,17 @@ var Home = (_) => {
|
|
|
73
76
|
items: results,
|
|
74
77
|
getId: (node) => node.id,
|
|
75
78
|
Tile: WorkspaceTile
|
|
76
|
-
})))))));
|
|
79
|
+
}))))))));
|
|
77
80
|
};
|
|
78
|
-
var WorkspaceTile = (
|
|
81
|
+
var WorkspaceTile = (props) => {
|
|
82
|
+
const data = props.data;
|
|
79
83
|
const { t } = useTranslation(meta.id);
|
|
80
84
|
const { invokePromise } = useOperationInvoker();
|
|
81
85
|
const { selectedValue, registerItem, unregisterItem } = useSearchListItem();
|
|
82
86
|
const name = toLocalizedString(data.properties.label, t);
|
|
83
87
|
const isSelected = selectedValue === data.id;
|
|
84
88
|
const cardRef = useRef(null);
|
|
85
|
-
|
|
89
|
+
useExpandPath(data.id);
|
|
86
90
|
const handleSelect = useCallback(() => invokePromise(LayoutOperation.SwitchWorkspace, {
|
|
87
91
|
subject: data.id
|
|
88
92
|
}), [
|
|
@@ -115,7 +119,7 @@ var WorkspaceTile = ({ data }) => {
|
|
|
115
119
|
fullWidth: true,
|
|
116
120
|
tabIndex: -1,
|
|
117
121
|
"data-selected": isSelected,
|
|
118
|
-
classNames: mx("dx-focus-ring", isSelected && "bg-
|
|
122
|
+
classNames: mx("dx-focus-ring", isSelected && "bg-hover-overlay"),
|
|
119
123
|
onClick: handleSelect,
|
|
120
124
|
ref: cardRef
|
|
121
125
|
}, /* @__PURE__ */ React.createElement(Card.Toolbar, {
|
|
@@ -136,13 +140,13 @@ var filterItems = (node, disposition) => {
|
|
|
136
140
|
};
|
|
137
141
|
var useItemsByDisposition = (disposition, sort = false) => {
|
|
138
142
|
const { graph } = useAppGraph2();
|
|
139
|
-
const connections = useConnections(graph, Node.RootId);
|
|
143
|
+
const connections = useConnections(graph, Node.RootId, "child");
|
|
140
144
|
const filtered = connections.filter((node) => filterItems(node, disposition));
|
|
141
145
|
return sort ? filtered.toSorted((a, b) => byPosition(a.properties, b.properties)) : filtered;
|
|
142
146
|
};
|
|
143
147
|
|
|
144
148
|
// src/components/SimpleLayout/SimpleLayout.tsx
|
|
145
|
-
import
|
|
149
|
+
import React11, { useEffect as useEffect6, useRef as useRef4, useState as useState3 } from "react";
|
|
146
150
|
import { Splitter } from "@dxos/react-ui";
|
|
147
151
|
import { Mosaic as Mosaic3 } from "@dxos/react-ui-mosaic";
|
|
148
152
|
|
|
@@ -178,9 +182,10 @@ var useAppBarProps = () => {
|
|
|
178
182
|
const nodes = filtered;
|
|
179
183
|
const edges = filtered.map((action) => ({
|
|
180
184
|
source: "root",
|
|
181
|
-
target: action.id
|
|
185
|
+
target: action.id,
|
|
186
|
+
relation: "child"
|
|
182
187
|
}));
|
|
183
|
-
const workspaceConnections = state2.workspace ? get(graph.connections(state2.workspace)) : [];
|
|
188
|
+
const workspaceConnections = state2.workspace ? get(graph.connections(state2.workspace, "child")) : [];
|
|
184
189
|
const alternateTreeNode = workspaceConnections.find((node2) => node2.properties.disposition === "alternate-tree");
|
|
185
190
|
if (alternateTreeNode && activeId2 !== alternateTreeNode.id) {
|
|
186
191
|
const settingsAction = {
|
|
@@ -199,7 +204,8 @@ var useAppBarProps = () => {
|
|
|
199
204
|
nodes.push(settingsAction);
|
|
200
205
|
edges.push({
|
|
201
206
|
source: "root",
|
|
202
|
-
target: settingsAction.id
|
|
207
|
+
target: settingsAction.id,
|
|
208
|
+
relation: "child"
|
|
203
209
|
});
|
|
204
210
|
}
|
|
205
211
|
return {
|
|
@@ -236,7 +242,7 @@ var useAppBarProps = () => {
|
|
|
236
242
|
state.active,
|
|
237
243
|
state.history.length
|
|
238
244
|
]);
|
|
239
|
-
const popoverAnchorId = node && state.popoverAnchorId ===
|
|
245
|
+
const popoverAnchorId = node && state.popoverAnchorId === `${meta.id}:${node.id}` ? state.popoverAnchorId : void 0;
|
|
240
246
|
return {
|
|
241
247
|
title,
|
|
242
248
|
actions: actionsAtom,
|
|
@@ -255,21 +261,20 @@ import { byPosition as byPosition3 } from "@dxos/util";
|
|
|
255
261
|
|
|
256
262
|
// src/hooks/actions.ts
|
|
257
263
|
import * as Effect2 from "effect/Effect";
|
|
258
|
-
import {
|
|
264
|
+
import { getCompanionVariant } from "@dxos/app-toolkit";
|
|
259
265
|
import { Node as Node3 } from "@dxos/plugin-graph";
|
|
260
|
-
import { ATTENDABLE_PATH_SEPARATOR } from "@dxos/react-ui-attention";
|
|
261
266
|
import { byPosition as byPosition2 } from "@dxos/util";
|
|
262
|
-
var PLANK_COMPANION_TYPE = "dxos.
|
|
267
|
+
var PLANK_COMPANION_TYPE = "org.dxos.plugin.deck.plank-companion";
|
|
263
268
|
var createCompanionActions = (graph, stateAtom, get, config) => {
|
|
264
|
-
const { idPrefix, selectedVariant,
|
|
269
|
+
const { idPrefix, selectedVariant, updateState } = config;
|
|
265
270
|
const state = get(stateAtom);
|
|
266
271
|
const activeId = state.active ?? state.workspace;
|
|
267
|
-
const activeConnections = activeId ? get(graph.connections(activeId)) : [];
|
|
272
|
+
const activeConnections = activeId ? get(graph.connections(activeId, "child")) : [];
|
|
268
273
|
const companions = activeConnections.filter((node) => node.type === PLANK_COMPANION_TYPE).toSorted((a, b) => byPosition2(a.properties, b.properties));
|
|
269
274
|
const nodes = [];
|
|
270
275
|
const edges = [];
|
|
271
276
|
companions.forEach((companion) => {
|
|
272
|
-
const
|
|
277
|
+
const companionVariant = getCompanionVariant(companion.id);
|
|
273
278
|
const companionAction = {
|
|
274
279
|
id: `${idPrefix}-companion-${companion.id}`,
|
|
275
280
|
type: Node3.ActionType,
|
|
@@ -277,21 +282,24 @@ var createCompanionActions = (graph, stateAtom, get, config) => {
|
|
|
277
282
|
icon: companion.properties.icon ?? "ph--placeholder--regular",
|
|
278
283
|
label: companion.properties.label,
|
|
279
284
|
iconOnly: true,
|
|
280
|
-
// Conditionally add variant highlighting.
|
|
281
285
|
...selectedVariant !== void 0 && {
|
|
282
286
|
variant: selectedVariant === companionVariant ? "primary" : "ghost"
|
|
283
287
|
}
|
|
284
288
|
},
|
|
285
|
-
data: () => Effect2.sync(() =>
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
+
data: () => Effect2.sync(() => updateState((current) => {
|
|
290
|
+
const closing = current.companionVariant === companionVariant && current.drawerState !== "closed";
|
|
291
|
+
return {
|
|
292
|
+
...current,
|
|
293
|
+
companionVariant: closing ? void 0 : companionVariant,
|
|
294
|
+
drawerState: closing ? "closed" : "open"
|
|
295
|
+
};
|
|
289
296
|
}))
|
|
290
297
|
};
|
|
291
298
|
nodes.push(companionAction);
|
|
292
299
|
edges.push({
|
|
293
300
|
source: "root",
|
|
294
|
-
target: companionAction.id
|
|
301
|
+
target: companionAction.id,
|
|
302
|
+
relation: "child"
|
|
295
303
|
});
|
|
296
304
|
});
|
|
297
305
|
return {
|
|
@@ -303,7 +311,7 @@ var createCompanionActions = (graph, stateAtom, get, config) => {
|
|
|
303
311
|
// src/hooks/useCompanions.ts
|
|
304
312
|
var useCompanions = (nodeId) => {
|
|
305
313
|
const { graph } = useAppGraph4();
|
|
306
|
-
const nodes = useConnections2(graph, nodeId);
|
|
314
|
+
const nodes = useConnections2(graph, nodeId, "child");
|
|
307
315
|
const companions = nodes.filter((node) => node.type === PLANK_COMPANION_TYPE);
|
|
308
316
|
return useMemo3(() => companions.toSorted((a, b) => byPosition3(a.properties, b.properties)), [
|
|
309
317
|
companions
|
|
@@ -313,19 +321,19 @@ var useCompanions = (nodeId) => {
|
|
|
313
321
|
// src/hooks/useDrawerActions.ts
|
|
314
322
|
import { Atom as Atom2 } from "@effect-atom/atom-react";
|
|
315
323
|
import * as Effect3 from "effect/Effect";
|
|
316
|
-
import { useMemo as
|
|
317
|
-
import { useCapability as useCapability3
|
|
324
|
+
import { useMemo as useMemo7 } from "react";
|
|
325
|
+
import { useCapability as useCapability3 } from "@dxos/app-framework/ui";
|
|
318
326
|
import { useAppGraph as useAppGraph7 } from "@dxos/app-toolkit/ui";
|
|
319
327
|
import { Node as Node4, useActionRunner as useActionRunner2 } from "@dxos/plugin-graph";
|
|
320
|
-
import { useTranslation as
|
|
328
|
+
import { useTranslation as useTranslation6 } from "@dxos/react-ui";
|
|
321
329
|
import { createGapSeparator } from "@dxos/react-ui-menu";
|
|
322
330
|
|
|
323
|
-
// src/components/ContentLoading.tsx
|
|
331
|
+
// src/components/ContentLoading/ContentLoading.tsx
|
|
324
332
|
import React2 from "react";
|
|
325
333
|
var ContentLoading = () => {
|
|
326
334
|
return /* @__PURE__ */ React2.createElement("div", {
|
|
327
335
|
role: "none",
|
|
328
|
-
className: "grid place-items-center attention-surface"
|
|
336
|
+
className: "grid place-items-center dx-attention-surface"
|
|
329
337
|
});
|
|
330
338
|
};
|
|
331
339
|
|
|
@@ -354,7 +362,7 @@ var MobileLayoutRoot = /* @__PURE__ */ forwardRef(({ classNames, children, trans
|
|
|
354
362
|
...props,
|
|
355
363
|
role: "none",
|
|
356
364
|
style: {
|
|
357
|
-
transition: `
|
|
365
|
+
transition: `h-size ${transition}ms ease-out`,
|
|
358
366
|
blockSize: "calc(100vh - var(--kb-height, 0px))"
|
|
359
367
|
},
|
|
360
368
|
className: mx2("absolute top-0 left-0 right-0 flex flex-col", classNames),
|
|
@@ -370,7 +378,7 @@ var MobileLayoutPanel = /* @__PURE__ */ forwardRef(({ classNames, children, safe
|
|
|
370
378
|
paddingTop: safe?.top ? "env(safe-area-inset-top)" : void 0,
|
|
371
379
|
paddingBottom: safe?.bottom ? `calc((1 - var(--kb-open, 0)) * env(safe-area-inset-bottom))` : void 0
|
|
372
380
|
},
|
|
373
|
-
className: mx2("relative
|
|
381
|
+
className: mx2("relative h-full flex flex-col overflow-hidden", classNames),
|
|
374
382
|
ref: forwardedRef
|
|
375
383
|
}, children);
|
|
376
384
|
});
|
|
@@ -510,8 +518,9 @@ var useIOSKeyboard = () => {
|
|
|
510
518
|
import { createContext as createContext2 } from "@radix-ui/react-context";
|
|
511
519
|
import React4, { useCallback as useCallback3, useEffect as useEffect4, useMemo as useMemo4, useRef as useRef2, useState as useState2 } from "react";
|
|
512
520
|
import { Surface } from "@dxos/app-framework/ui";
|
|
521
|
+
import { useObjectNavigate } from "@dxos/app-toolkit/ui";
|
|
513
522
|
import { Popover, toLocalizedString as toLocalizedString3, useTranslation as useTranslation3 } from "@dxos/react-ui";
|
|
514
|
-
import { Card as Card2 } from "@dxos/react-ui
|
|
523
|
+
import { Card as Card2 } from "@dxos/react-ui";
|
|
515
524
|
var DEBOUNCE_DELAY = 40;
|
|
516
525
|
var [LayoutPopoverProvider, useLayoutPopoverContext] = createContext2("LayoutPopover");
|
|
517
526
|
var PopoverRoot = ({ children }) => {
|
|
@@ -548,10 +557,12 @@ var PopoverRoot = ({ children }) => {
|
|
|
548
557
|
virtualRef
|
|
549
558
|
}), children));
|
|
550
559
|
};
|
|
560
|
+
var getPopoverSubject = (content) => content && typeof content === "object" && "subject" in content ? content.subject : content;
|
|
551
561
|
var PopoverContent = () => {
|
|
552
562
|
const { t } = useTranslation3(meta.id);
|
|
553
563
|
const { state, updateState } = useSimpleLayoutState();
|
|
554
564
|
const { setOpen } = useLayoutPopoverContext("PopoverContent");
|
|
565
|
+
const handleNavigate = useObjectNavigate(getPopoverSubject(state.popoverContent));
|
|
555
566
|
const handleClose = useCallback3(() => {
|
|
556
567
|
setOpen(false);
|
|
557
568
|
updateState((s) => ({
|
|
@@ -598,8 +609,10 @@ var PopoverContent = () => {
|
|
|
598
609
|
limit: 1
|
|
599
610
|
}), state.popoverKind === "card" && /* @__PURE__ */ React4.createElement(Card2.Root, {
|
|
600
611
|
border: false,
|
|
601
|
-
classNames: "
|
|
602
|
-
}, /* @__PURE__ */ React4.createElement(Card2.Toolbar, null, /* @__PURE__ */ React4.createElement("span", null), state.popoverTitle ? /* @__PURE__ */ React4.createElement(Card2.Title,
|
|
612
|
+
classNames: "dx-card-popover"
|
|
613
|
+
}, /* @__PURE__ */ React4.createElement(Card2.Toolbar, null, /* @__PURE__ */ React4.createElement("span", null), state.popoverTitle ? /* @__PURE__ */ React4.createElement(Card2.Title, {
|
|
614
|
+
onClick: handleNavigate
|
|
615
|
+
}, toLocalizedString3(state.popoverTitle, t)) : /* @__PURE__ */ React4.createElement("span", null), /* @__PURE__ */ React4.createElement(Card2.CloseIconButton, {
|
|
603
616
|
onClick: handleClose
|
|
604
617
|
})), /* @__PURE__ */ React4.createElement(Surface.Surface, {
|
|
605
618
|
role: "card--content",
|
|
@@ -612,7 +625,7 @@ var PopoverContent = () => {
|
|
|
612
625
|
import { useAtomValue as useAtomValue2 } from "@effect-atom/atom-react";
|
|
613
626
|
import React5, { Fragment } from "react";
|
|
614
627
|
import { IconButton, Popover as Popover2, Toolbar as Toolbar2, useTranslation as useTranslation4 } from "@dxos/react-ui";
|
|
615
|
-
import {
|
|
628
|
+
import { Menu, useMenuActions } from "@dxos/react-ui-menu";
|
|
616
629
|
import { mx as mx3, osTranslations } from "@dxos/ui-theme";
|
|
617
630
|
var APP_BAR_NAME = "SimpleLayout.AppBar";
|
|
618
631
|
var AppBar = ({ classNames, title, actions, showBackButton, popoverAnchorId, onAction, onBack }) => {
|
|
@@ -627,7 +640,7 @@ var AppBar = ({ classNames, title, actions, showBackButton, popoverAnchorId, onA
|
|
|
627
640
|
const AnchorRoot = popoverAnchorId ? Popover2.Anchor : Fragment;
|
|
628
641
|
return /* @__PURE__ */ React5.createElement(Toolbar2.Root, {
|
|
629
642
|
role: "banner",
|
|
630
|
-
classNames: mx3("grid grid-cols-[var(--rail-size)_1fr_var(--rail-size)]
|
|
643
|
+
classNames: mx3("grid grid-cols-[var(--dx-rail-size)_1fr_var(--dx-rail-size)] items-center", "dx-density-fine", classNames)
|
|
631
644
|
}, keyboardOpen ? /* @__PURE__ */ React5.createElement(IconButton, {
|
|
632
645
|
variant: "ghost",
|
|
633
646
|
icon: "ph--x--regular",
|
|
@@ -641,60 +654,44 @@ var AppBar = ({ classNames, title, actions, showBackButton, popoverAnchorId, onA
|
|
|
641
654
|
onClick: onBack
|
|
642
655
|
}) : /* @__PURE__ */ React5.createElement("div", null), /* @__PURE__ */ React5.createElement("h1", {
|
|
643
656
|
className: "text-center truncate font-thin uppercase"
|
|
644
|
-
}, displayTitle), hasActions ? /* @__PURE__ */ React5.createElement(AnchorRoot, null, /* @__PURE__ */ React5.createElement(
|
|
657
|
+
}, displayTitle), hasActions ? /* @__PURE__ */ React5.createElement(AnchorRoot, null, /* @__PURE__ */ React5.createElement(Menu.Root, {
|
|
645
658
|
...menu,
|
|
659
|
+
caller: meta.id,
|
|
646
660
|
onAction
|
|
647
|
-
}, /* @__PURE__ */ React5.createElement(
|
|
648
|
-
caller: meta.id
|
|
649
|
-
}, /* @__PURE__ */ React5.createElement(DropdownMenu.Trigger, {
|
|
661
|
+
}, /* @__PURE__ */ React5.createElement(Menu.Trigger, {
|
|
650
662
|
asChild: true
|
|
651
663
|
}, /* @__PURE__ */ React5.createElement(IconButton, {
|
|
652
664
|
variant: "ghost",
|
|
653
665
|
icon: "ph--dots-three-vertical--regular",
|
|
654
666
|
iconOnly: true,
|
|
655
667
|
label: t("actions menu label")
|
|
656
|
-
}))))) : /* @__PURE__ */ React5.createElement("span", null));
|
|
668
|
+
})), /* @__PURE__ */ React5.createElement(Menu.Content, null))) : /* @__PURE__ */ React5.createElement("span", null));
|
|
657
669
|
};
|
|
658
670
|
AppBar.displayName = APP_BAR_NAME;
|
|
659
671
|
|
|
660
672
|
// src/components/SimpleLayout/Main.tsx
|
|
661
|
-
import
|
|
673
|
+
import React7, { useMemo as useMemo5 } from "react";
|
|
662
674
|
import { Surface as Surface2 } from "@dxos/app-framework/ui";
|
|
663
675
|
import { useAppGraph as useAppGraph5 } from "@dxos/app-toolkit/ui";
|
|
664
676
|
import { useNode as useNode2 } from "@dxos/plugin-graph";
|
|
677
|
+
import { ErrorFallback } from "@dxos/react-ui";
|
|
665
678
|
import { useAttentionAttributes } from "@dxos/react-ui-attention";
|
|
666
|
-
import { mx as
|
|
667
|
-
|
|
668
|
-
// src/components/ContentError.tsx
|
|
669
|
-
import React6 from "react";
|
|
670
|
-
import { useTranslation as useTranslation5 } from "@dxos/react-ui";
|
|
671
|
-
import { descriptionMessage, mx as mx4 } from "@dxos/ui-theme";
|
|
672
|
-
var ContentError = ({ error }) => {
|
|
673
|
-
const { t } = useTranslation5(meta.id);
|
|
674
|
-
const errorString = error?.toString() ?? "";
|
|
675
|
-
return /* @__PURE__ */ React6.createElement("div", {
|
|
676
|
-
role: "none",
|
|
677
|
-
className: "grid place-items-center overflow-y-auto attention-surface"
|
|
678
|
-
}, /* @__PURE__ */ React6.createElement("p", {
|
|
679
|
-
role: "alert",
|
|
680
|
-
className: mx4(descriptionMessage, "p-2 break-all rounded-sm")
|
|
681
|
-
}, error ? errorString : t("error fallback message")));
|
|
682
|
-
};
|
|
679
|
+
import { mx as mx5 } from "@dxos/ui-theme";
|
|
683
680
|
|
|
684
681
|
// src/components/SimpleLayout/NavBar.tsx
|
|
685
|
-
import
|
|
686
|
-
import {
|
|
687
|
-
import { mx as
|
|
682
|
+
import React6 from "react";
|
|
683
|
+
import { Menu as Menu2, useMenuActions as useMenuActions2 } from "@dxos/react-ui-menu";
|
|
684
|
+
import { mx as mx4 } from "@dxos/ui-theme";
|
|
688
685
|
var NAVBAR_NAME = "SimpleLayout.NavBar";
|
|
689
686
|
var NavBar = ({ classNames, actions, onAction }) => {
|
|
690
687
|
const menu = useMenuActions2(actions);
|
|
691
|
-
return /* @__PURE__ */
|
|
688
|
+
return /* @__PURE__ */ React6.createElement(Menu2.Root, {
|
|
692
689
|
...menu,
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
}, /* @__PURE__ */
|
|
690
|
+
alwaysActive: true,
|
|
691
|
+
onAction
|
|
692
|
+
}, /* @__PURE__ */ React6.createElement(Menu2.Toolbar, {
|
|
696
693
|
density: "coarse",
|
|
697
|
-
classNames:
|
|
694
|
+
classNames: mx4(classNames)
|
|
698
695
|
}));
|
|
699
696
|
};
|
|
700
697
|
NavBar.displayName = NAVBAR_NAME;
|
|
@@ -708,7 +705,7 @@ var Main = () => {
|
|
|
708
705
|
const { keyboardOpen } = useMobileLayout(MAIN_NAME);
|
|
709
706
|
const { actions, onAction } = useNavbarActions();
|
|
710
707
|
const appBarProps = useAppBarProps();
|
|
711
|
-
const placeholder = useMemo5(() => /* @__PURE__ */
|
|
708
|
+
const placeholder = useMemo5(() => /* @__PURE__ */ React7.createElement(ContentLoading, null), []);
|
|
712
709
|
const { graph } = useAppGraph5();
|
|
713
710
|
const node = useNode2(graph, id);
|
|
714
711
|
const data = useMemo5(() => {
|
|
@@ -725,75 +722,82 @@ var Main = () => {
|
|
|
725
722
|
node?.properties,
|
|
726
723
|
state.popoverAnchorId
|
|
727
724
|
]);
|
|
728
|
-
|
|
725
|
+
useExpandPath(id);
|
|
729
726
|
const showNavBar = !keyboardOpen && !state.isPopover && state.drawerState === "closed";
|
|
730
|
-
return /* @__PURE__ */
|
|
727
|
+
return /* @__PURE__ */ React7.createElement("div", {
|
|
731
728
|
role: "none",
|
|
732
|
-
className:
|
|
729
|
+
className: mx5("h-full grid overflow-hidden bg-toolbar-surface", showNavBar ? "grid-rows-[var(--dx-rail-action)_1fr_var(--dx-toolbar-size)]" : "grid-rows-[var(--dx-rail-action)_1fr]"),
|
|
733
730
|
...attentionAttrs
|
|
734
|
-
}, /* @__PURE__ */
|
|
735
|
-
className: "
|
|
736
|
-
}, /* @__PURE__ */
|
|
731
|
+
}, /* @__PURE__ */ React7.createElement(AppBar, appBarProps), /* @__PURE__ */ React7.createElement("article", {
|
|
732
|
+
className: "h-full overflow-hidden bg-base-surface"
|
|
733
|
+
}, /* @__PURE__ */ React7.createElement(Surface2.Surface, {
|
|
737
734
|
key: id,
|
|
738
735
|
role: "article",
|
|
739
736
|
data,
|
|
740
737
|
limit: 1,
|
|
741
|
-
fallback:
|
|
738
|
+
fallback: ErrorFallback,
|
|
742
739
|
placeholder
|
|
743
|
-
})), showNavBar && /* @__PURE__ */
|
|
744
|
-
classNames: "border-
|
|
740
|
+
})), showNavBar && /* @__PURE__ */ React7.createElement(NavBar, {
|
|
741
|
+
classNames: "border-y border-subdued-separator",
|
|
745
742
|
actions,
|
|
746
743
|
onAction
|
|
747
744
|
}));
|
|
748
745
|
};
|
|
749
746
|
Main.displayName = MAIN_NAME;
|
|
750
747
|
|
|
751
|
-
// src/components/
|
|
752
|
-
import
|
|
748
|
+
// src/components/NavBranch/NavBranch.tsx
|
|
749
|
+
import React8, { useCallback as useCallback4, useEffect as useEffect5, useMemo as useMemo6, useRef as useRef3 } from "react";
|
|
753
750
|
import { useOperationInvoker as useOperationInvoker3 } from "@dxos/app-framework/ui";
|
|
754
|
-
import { LayoutOperation as
|
|
751
|
+
import { LayoutOperation as LayoutOperation3 } from "@dxos/app-toolkit";
|
|
755
752
|
import { useAppGraph as useAppGraph6 } from "@dxos/app-toolkit/ui";
|
|
756
753
|
import { useConnections as useConnections3 } from "@dxos/plugin-graph";
|
|
757
|
-
import { Avatar as Avatar2, Icon as Icon2,
|
|
758
|
-
import { Card as Card3
|
|
754
|
+
import { Avatar as Avatar2, Icon as Icon2, Panel as Panel2, ScrollArea as ScrollArea2, Toolbar as Toolbar3, toLocalizedString as toLocalizedString4, useTranslation as useTranslation5 } from "@dxos/react-ui";
|
|
755
|
+
import { Card as Card3 } from "@dxos/react-ui";
|
|
756
|
+
import { Mosaic as Mosaic2 } from "@dxos/react-ui-mosaic";
|
|
759
757
|
import { SearchList as SearchList2, useSearchListItem as useSearchListItem2, useSearchListResults as useSearchListResults2 } from "@dxos/react-ui-searchlist";
|
|
760
|
-
import { mx as
|
|
761
|
-
var
|
|
762
|
-
const { t } =
|
|
758
|
+
import { mx as mx6 } from "@dxos/ui-theme";
|
|
759
|
+
var NavBranch = ({ id }) => {
|
|
760
|
+
const { t } = useTranslation5(meta.id);
|
|
763
761
|
const { graph } = useAppGraph6();
|
|
764
|
-
|
|
765
|
-
const children = useConnections3(graph, id, "
|
|
762
|
+
useExpandPath(id);
|
|
763
|
+
const children = useConnections3(graph, id, "child");
|
|
764
|
+
const visibleChildren = useMemo6(() => children.filter((node) => node.properties.disposition !== "alternate-tree"), [
|
|
765
|
+
children
|
|
766
|
+
]);
|
|
766
767
|
const { results, handleSearch } = useSearchListResults2({
|
|
767
|
-
items:
|
|
768
|
+
items: visibleChildren,
|
|
768
769
|
extract: (child) => toLocalizedString4(child.properties.label, t)
|
|
769
770
|
});
|
|
770
|
-
return /* @__PURE__ */
|
|
771
|
-
toolbar: true
|
|
772
|
-
}, /* @__PURE__ */ React9.createElement(SearchList2.Root, {
|
|
771
|
+
return /* @__PURE__ */ React8.createElement(SearchList2.Root, {
|
|
773
772
|
onSearch: handleSearch
|
|
774
|
-
}, /* @__PURE__ */
|
|
773
|
+
}, /* @__PURE__ */ React8.createElement(Panel2.Root, null, /* @__PURE__ */ React8.createElement(Panel2.Toolbar, {
|
|
774
|
+
asChild: true
|
|
775
|
+
}, /* @__PURE__ */ React8.createElement(Toolbar3.Root, null, /* @__PURE__ */ React8.createElement(SearchList2.Input, {
|
|
775
776
|
placeholder: t("search placeholder"),
|
|
776
777
|
autoFocus: true
|
|
777
|
-
})), /* @__PURE__ */
|
|
778
|
+
}))), /* @__PURE__ */ React8.createElement(Panel2.Content, {
|
|
778
779
|
asChild: true
|
|
779
|
-
}, /* @__PURE__ */
|
|
780
|
+
}, /* @__PURE__ */ React8.createElement(SearchList2.Content, null, /* @__PURE__ */ React8.createElement(Mosaic2.Container, {
|
|
781
|
+
asChild: true
|
|
782
|
+
}, /* @__PURE__ */ React8.createElement(ScrollArea2.Root, {
|
|
780
783
|
orientation: "vertical"
|
|
781
|
-
}, /* @__PURE__ */
|
|
784
|
+
}, /* @__PURE__ */ React8.createElement(ScrollArea2.Viewport, {
|
|
782
785
|
classNames: "p-2"
|
|
783
|
-
}, /* @__PURE__ */
|
|
786
|
+
}, /* @__PURE__ */ React8.createElement(Mosaic2.Stack, {
|
|
784
787
|
items: results,
|
|
785
788
|
getId: (child) => child.id,
|
|
786
|
-
Tile:
|
|
787
|
-
})))))));
|
|
789
|
+
Tile: NavBranchTile
|
|
790
|
+
}))))))));
|
|
788
791
|
};
|
|
789
|
-
var
|
|
790
|
-
const
|
|
792
|
+
var NavBranchTile = (props) => {
|
|
793
|
+
const data = props.data;
|
|
794
|
+
const { t } = useTranslation5(meta.id);
|
|
791
795
|
const { invokeSync } = useOperationInvoker3();
|
|
792
796
|
const ref = useRef3(null);
|
|
793
797
|
const { selectedValue, registerItem, unregisterItem } = useSearchListItem2();
|
|
794
798
|
const isSelected = selectedValue === data.id;
|
|
795
799
|
const name = toLocalizedString4(data.properties.label, t);
|
|
796
|
-
const handleSelect = useCallback4(() => invokeSync(
|
|
800
|
+
const handleSelect = useCallback4(() => invokeSync(LayoutOperation3.Open, {
|
|
797
801
|
subject: [
|
|
798
802
|
data.id
|
|
799
803
|
]
|
|
@@ -822,24 +826,24 @@ var WorkspaceChildTile = ({ data }) => {
|
|
|
822
826
|
}, [
|
|
823
827
|
isSelected
|
|
824
828
|
]);
|
|
825
|
-
return /* @__PURE__ */
|
|
829
|
+
return /* @__PURE__ */ React8.createElement(Card3.Root, {
|
|
826
830
|
ref,
|
|
827
831
|
role: "button",
|
|
828
832
|
fullWidth: true,
|
|
829
833
|
tabIndex: -1,
|
|
830
834
|
"data-selected": isSelected,
|
|
831
|
-
classNames:
|
|
835
|
+
classNames: mx6("dx-focus-ring", isSelected && "bg-hover-overlay"),
|
|
832
836
|
onClick: handleSelect
|
|
833
|
-
}, /* @__PURE__ */
|
|
837
|
+
}, /* @__PURE__ */ React8.createElement(Card3.Toolbar, {
|
|
834
838
|
density: "coarse"
|
|
835
|
-
}, /* @__PURE__ */
|
|
839
|
+
}, /* @__PURE__ */ React8.createElement(Avatar2.Root, null, /* @__PURE__ */ React8.createElement(Avatar2.Content, {
|
|
836
840
|
hue: data.properties.hue,
|
|
837
841
|
icon: data.properties.icon,
|
|
838
842
|
hueVariant: "transparent",
|
|
839
843
|
variant: "square",
|
|
840
844
|
size: 12,
|
|
841
845
|
fallback: name
|
|
842
|
-
}), /* @__PURE__ */
|
|
846
|
+
}), /* @__PURE__ */ React8.createElement(Avatar2.Label, null, name), /* @__PURE__ */ React8.createElement(Icon2, {
|
|
843
847
|
icon: "ph--caret-right--regular"
|
|
844
848
|
}))));
|
|
845
849
|
};
|
|
@@ -866,19 +870,18 @@ var useSimpleLayoutState = () => {
|
|
|
866
870
|
|
|
867
871
|
// src/hooks/useDrawerActions.ts
|
|
868
872
|
var useDrawerActions = (consumerName) => {
|
|
869
|
-
const { t } =
|
|
873
|
+
const { t } = useTranslation6(meta.id);
|
|
870
874
|
const stateAtom = useCapability3(SimpleLayoutState);
|
|
871
875
|
const { graph } = useAppGraph7();
|
|
872
876
|
const runAction = useActionRunner2();
|
|
873
|
-
const { invokeSync } = useOperationInvoker4();
|
|
874
877
|
const { updateState } = useSimpleLayoutState();
|
|
875
878
|
const { keyboardOpen } = useMobileLayout(consumerName);
|
|
876
|
-
const actionsAtom =
|
|
879
|
+
const actionsAtom = useMemo7(() => Atom2.make((get) => {
|
|
877
880
|
const state = get(stateAtom);
|
|
878
881
|
const { nodes, edges } = createCompanionActions(graph, stateAtom, get, {
|
|
879
882
|
idPrefix: "drawer",
|
|
880
883
|
selectedVariant: state.companionVariant,
|
|
881
|
-
|
|
884
|
+
updateState
|
|
882
885
|
});
|
|
883
886
|
const gapSeparator = createGapSeparator("drawer-gap");
|
|
884
887
|
nodes.push(...gapSeparator.nodes);
|
|
@@ -901,7 +904,8 @@ var useDrawerActions = (consumerName) => {
|
|
|
901
904
|
nodes.push(toggleExpandAction);
|
|
902
905
|
edges.push({
|
|
903
906
|
source: "root",
|
|
904
|
-
target: toggleExpandAction.id
|
|
907
|
+
target: toggleExpandAction.id,
|
|
908
|
+
relation: "child"
|
|
905
909
|
});
|
|
906
910
|
}
|
|
907
911
|
const closeAction = {
|
|
@@ -914,13 +918,15 @@ var useDrawerActions = (consumerName) => {
|
|
|
914
918
|
},
|
|
915
919
|
data: () => Effect3.sync(() => updateState((state2) => ({
|
|
916
920
|
...state2,
|
|
917
|
-
drawerState: "closed"
|
|
921
|
+
drawerState: "closed",
|
|
922
|
+
companionVariant: void 0
|
|
918
923
|
})))
|
|
919
924
|
};
|
|
920
925
|
nodes.push(closeAction);
|
|
921
926
|
edges.push({
|
|
922
927
|
source: "root",
|
|
923
|
-
target: closeAction.id
|
|
928
|
+
target: closeAction.id,
|
|
929
|
+
relation: "child"
|
|
924
930
|
});
|
|
925
931
|
return {
|
|
926
932
|
nodes,
|
|
@@ -929,7 +935,6 @@ var useDrawerActions = (consumerName) => {
|
|
|
929
935
|
}), [
|
|
930
936
|
graph,
|
|
931
937
|
stateAtom,
|
|
932
|
-
invokeSync,
|
|
933
938
|
updateState,
|
|
934
939
|
keyboardOpen,
|
|
935
940
|
t
|
|
@@ -942,23 +947,23 @@ var useDrawerActions = (consumerName) => {
|
|
|
942
947
|
|
|
943
948
|
// src/hooks/useNavbarActions.ts
|
|
944
949
|
import { Atom as Atom3 } from "@effect-atom/atom-react";
|
|
945
|
-
import { useMemo as
|
|
946
|
-
import { useCapability as useCapability4
|
|
950
|
+
import { useMemo as useMemo8 } from "react";
|
|
951
|
+
import { useCapability as useCapability4 } from "@dxos/app-framework/ui";
|
|
947
952
|
import { useAppGraph as useAppGraph8 } from "@dxos/app-toolkit/ui";
|
|
948
953
|
import { Node as Node5, useActionRunner as useActionRunner3 } from "@dxos/plugin-graph";
|
|
949
|
-
import { useTranslation as
|
|
954
|
+
import { useTranslation as useTranslation7 } from "@dxos/react-ui";
|
|
950
955
|
import { createGapSeparator as createGapSeparator2, createMenuItemGroup } from "@dxos/react-ui-menu";
|
|
951
956
|
var MAIN_MENU_GROUP_ID = "navbar-main-menu";
|
|
952
957
|
var useNavbarActions = () => {
|
|
953
|
-
const { t } =
|
|
958
|
+
const { t } = useTranslation7(meta.id);
|
|
954
959
|
const { graph } = useAppGraph8();
|
|
955
960
|
const runAction = useActionRunner3();
|
|
956
|
-
const { invokeSync } = useOperationInvoker5();
|
|
957
961
|
const stateAtom = useCapability4(SimpleLayoutState);
|
|
958
|
-
const
|
|
962
|
+
const { updateState } = useSimpleLayoutState();
|
|
963
|
+
const actionsAtom = useMemo8(() => Atom3.make((get) => {
|
|
959
964
|
const { nodes, edges } = createCompanionActions(graph, stateAtom, get, {
|
|
960
965
|
idPrefix: "navbar",
|
|
961
|
-
|
|
966
|
+
updateState
|
|
962
967
|
});
|
|
963
968
|
const gapSeparator = createGapSeparator2("navbar-gap");
|
|
964
969
|
nodes.push(...gapSeparator.nodes);
|
|
@@ -973,15 +978,17 @@ var useNavbarActions = () => {
|
|
|
973
978
|
nodes.push(mainMenuGroup);
|
|
974
979
|
edges.push({
|
|
975
980
|
source: "root",
|
|
976
|
-
target: mainMenuGroup.id
|
|
981
|
+
target: mainMenuGroup.id,
|
|
982
|
+
relation: "child"
|
|
977
983
|
});
|
|
978
|
-
const
|
|
979
|
-
const menuActions =
|
|
984
|
+
const rootActions = get(graph.actions(Node5.RootId));
|
|
985
|
+
const menuActions = rootActions.filter((node) => node.properties.disposition === "menu");
|
|
980
986
|
menuActions.forEach((menuAction) => {
|
|
981
987
|
nodes.push(menuAction);
|
|
982
988
|
edges.push({
|
|
983
989
|
source: MAIN_MENU_GROUP_ID,
|
|
984
|
-
target: menuAction.id
|
|
990
|
+
target: menuAction.id,
|
|
991
|
+
relation: "child"
|
|
985
992
|
});
|
|
986
993
|
});
|
|
987
994
|
return {
|
|
@@ -991,7 +998,7 @@ var useNavbarActions = () => {
|
|
|
991
998
|
}), [
|
|
992
999
|
graph,
|
|
993
1000
|
stateAtom,
|
|
994
|
-
|
|
1001
|
+
updateState,
|
|
995
1002
|
t
|
|
996
1003
|
]);
|
|
997
1004
|
return {
|
|
@@ -1001,56 +1008,57 @@ var useNavbarActions = () => {
|
|
|
1001
1008
|
};
|
|
1002
1009
|
|
|
1003
1010
|
// src/components/Dialog/Dialog.tsx
|
|
1004
|
-
import
|
|
1011
|
+
import React9 from "react";
|
|
1005
1012
|
import { Surface as Surface3 } from "@dxos/app-framework/ui";
|
|
1006
1013
|
import { AlertDialog, Dialog as NaturalDialog } from "@dxos/react-ui";
|
|
1014
|
+
import { ErrorFallback as ErrorFallback2 } from "@dxos/react-ui";
|
|
1007
1015
|
var Dialog = () => {
|
|
1008
1016
|
const { state, updateState } = useSimpleLayoutState();
|
|
1009
1017
|
const DialogRoot = state.dialogType === "alert" ? AlertDialog.Root : NaturalDialog.Root;
|
|
1010
1018
|
const DialogOverlay = state.dialogType === "alert" ? AlertDialog.Overlay : NaturalDialog.Overlay;
|
|
1011
|
-
return /* @__PURE__ */
|
|
1019
|
+
return /* @__PURE__ */ React9.createElement(DialogRoot, {
|
|
1012
1020
|
modal: state.dialogBlockAlign !== "end",
|
|
1013
1021
|
open: state.dialogOpen,
|
|
1014
1022
|
onOpenChange: (nextOpen) => updateState((state2) => ({
|
|
1015
1023
|
...state2,
|
|
1016
1024
|
dialogOpen: nextOpen
|
|
1017
1025
|
}))
|
|
1018
|
-
}, state.dialogBlockAlign === "end" ? /* @__PURE__ */
|
|
1026
|
+
}, state.dialogBlockAlign === "end" ? /* @__PURE__ */ React9.createElement(Surface3.Surface, {
|
|
1019
1027
|
role: "dialog",
|
|
1020
1028
|
data: state.dialogContent,
|
|
1021
1029
|
limit: 1,
|
|
1022
|
-
fallback:
|
|
1023
|
-
}) : /* @__PURE__ */
|
|
1030
|
+
fallback: ErrorFallback2
|
|
1031
|
+
}) : /* @__PURE__ */ React9.createElement(DialogOverlay, {
|
|
1024
1032
|
blockAlign: state.dialogBlockAlign,
|
|
1025
1033
|
classNames: state.dialogOverlayClasses,
|
|
1026
1034
|
style: state.dialogOverlayStyle
|
|
1027
|
-
}, /* @__PURE__ */
|
|
1035
|
+
}, /* @__PURE__ */ React9.createElement(Surface3.Surface, {
|
|
1028
1036
|
role: "dialog",
|
|
1029
1037
|
data: state.dialogContent,
|
|
1030
1038
|
limit: 1,
|
|
1031
|
-
fallback:
|
|
1039
|
+
fallback: ErrorFallback2
|
|
1032
1040
|
})));
|
|
1033
1041
|
};
|
|
1034
1042
|
|
|
1035
1043
|
// src/components/SimpleLayout/Drawer.tsx
|
|
1036
|
-
import
|
|
1044
|
+
import React10, { useMemo as useMemo9 } from "react";
|
|
1037
1045
|
import { Surface as Surface4 } from "@dxos/app-framework/ui";
|
|
1046
|
+
import { getCompanionVariant as getCompanionVariant2 } from "@dxos/app-toolkit";
|
|
1038
1047
|
import { useAppGraph as useAppGraph9 } from "@dxos/app-toolkit/ui";
|
|
1039
1048
|
import { useNode as useNode3 } from "@dxos/plugin-graph";
|
|
1040
|
-
import {
|
|
1041
|
-
import {
|
|
1042
|
-
import { MenuProvider as MenuProvider3, ToolbarMenu as ToolbarMenu2, useMenuActions as useMenuActions3 } from "@dxos/react-ui-menu";
|
|
1049
|
+
import { ErrorFallback as ErrorFallback3, Panel as Panel3 } from "@dxos/react-ui";
|
|
1050
|
+
import { Menu as Menu3, useMenuActions as useMenuActions3 } from "@dxos/react-ui-menu";
|
|
1043
1051
|
var DRAWER_NAME = "SimpleLayout.Drawer";
|
|
1044
1052
|
var Drawer = () => {
|
|
1045
1053
|
const { graph } = useAppGraph9();
|
|
1046
1054
|
const { state: layoutState } = useSimpleLayoutState();
|
|
1047
|
-
const placeholder =
|
|
1055
|
+
const placeholder = useMemo9(() => /* @__PURE__ */ React10.createElement(ContentLoading, null), []);
|
|
1048
1056
|
const activeId = layoutState.active ?? layoutState.workspace;
|
|
1049
1057
|
const companions = useCompanions(activeId);
|
|
1050
1058
|
const { companionId, variant } = useSelectedCompanion(companions, layoutState.companionVariant);
|
|
1051
1059
|
const node = useNode3(graph, companionId);
|
|
1052
1060
|
const parentNode = useNode3(graph, activeId);
|
|
1053
|
-
const data =
|
|
1061
|
+
const data = useMemo9(() => {
|
|
1054
1062
|
return node && {
|
|
1055
1063
|
attendableId: companionId,
|
|
1056
1064
|
subject: node.data,
|
|
@@ -1066,40 +1074,30 @@ var Drawer = () => {
|
|
|
1066
1074
|
]);
|
|
1067
1075
|
const { actions, onAction } = useDrawerActions(DRAWER_NAME);
|
|
1068
1076
|
const menu = useMenuActions3(actions);
|
|
1069
|
-
return /* @__PURE__ */
|
|
1070
|
-
toolbar: true
|
|
1071
|
-
}, /* @__PURE__ */ React11.createElement(MenuProvider3, {
|
|
1077
|
+
return /* @__PURE__ */ React10.createElement(Panel3.Root, null, /* @__PURE__ */ React10.createElement(Panel3.Toolbar, null, /* @__PURE__ */ React10.createElement(Menu3.Root, {
|
|
1072
1078
|
...menu,
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
}, /* @__PURE__ */
|
|
1079
|
+
alwaysActive: true,
|
|
1080
|
+
onAction
|
|
1081
|
+
}, /* @__PURE__ */ React10.createElement(Menu3.Toolbar, {
|
|
1076
1082
|
density: "coarse"
|
|
1077
|
-
})), /* @__PURE__ */
|
|
1083
|
+
}))), /* @__PURE__ */ React10.createElement(Panel3.Content, {
|
|
1084
|
+
asChild: true
|
|
1085
|
+
}, /* @__PURE__ */ React10.createElement(Surface4.Surface, {
|
|
1078
1086
|
role: "article",
|
|
1079
1087
|
data,
|
|
1080
1088
|
limit: 1,
|
|
1081
|
-
fallback:
|
|
1089
|
+
fallback: ErrorFallback3,
|
|
1082
1090
|
placeholder
|
|
1083
|
-
}));
|
|
1091
|
+
})));
|
|
1084
1092
|
};
|
|
1085
1093
|
Drawer.displayName = DRAWER_NAME;
|
|
1086
|
-
var parseEntryId = (entryId) => {
|
|
1087
|
-
const [id, variant] = entryId.split(ATTENDABLE_PATH_SEPARATOR2);
|
|
1088
|
-
return {
|
|
1089
|
-
id,
|
|
1090
|
-
variant
|
|
1091
|
-
};
|
|
1092
|
-
};
|
|
1093
1094
|
var useSelectedCompanion = (companions, preferredVariant) => {
|
|
1094
|
-
const selectedCompanion =
|
|
1095
|
+
const selectedCompanion = useMemo9(() => {
|
|
1095
1096
|
if (companions.length === 0) {
|
|
1096
1097
|
return void 0;
|
|
1097
1098
|
}
|
|
1098
1099
|
if (preferredVariant) {
|
|
1099
|
-
const preferred = companions.find((c) =>
|
|
1100
|
-
const { variant: variant2 } = parseEntryId(c.id);
|
|
1101
|
-
return variant2 === preferredVariant;
|
|
1102
|
-
});
|
|
1100
|
+
const preferred = companions.find((c) => getCompanionVariant2(c.id) === preferredVariant);
|
|
1103
1101
|
if (preferred) {
|
|
1104
1102
|
return preferred;
|
|
1105
1103
|
}
|
|
@@ -1110,7 +1108,7 @@ var useSelectedCompanion = (companions, preferredVariant) => {
|
|
|
1110
1108
|
preferredVariant
|
|
1111
1109
|
]);
|
|
1112
1110
|
const companionId = selectedCompanion?.id;
|
|
1113
|
-
const
|
|
1111
|
+
const variant = companionId ? getCompanionVariant2(companionId) : void 0;
|
|
1114
1112
|
return {
|
|
1115
1113
|
selectedCompanion,
|
|
1116
1114
|
companionId,
|
|
@@ -1136,30 +1134,30 @@ var SimpleLayout = () => {
|
|
|
1136
1134
|
state.drawerState,
|
|
1137
1135
|
keyboardOpen
|
|
1138
1136
|
]);
|
|
1139
|
-
return /* @__PURE__ */
|
|
1137
|
+
return /* @__PURE__ */ React11.createElement(Mosaic3.Root, {
|
|
1140
1138
|
classNames: "contents"
|
|
1141
|
-
}, /* @__PURE__ */
|
|
1142
|
-
classNames: "bg-
|
|
1139
|
+
}, /* @__PURE__ */ React11.createElement(MobileLayout.Root, {
|
|
1140
|
+
classNames: "bg-toolbar-surface",
|
|
1143
1141
|
onKeyboardOpenChange: (keyboardOpen2) => setKeyboardOpen(keyboardOpen2)
|
|
1144
|
-
}, /* @__PURE__ */
|
|
1142
|
+
}, /* @__PURE__ */ React11.createElement(MobileLayout.Panel, {
|
|
1145
1143
|
safe: {
|
|
1146
1144
|
top: true,
|
|
1147
1145
|
bottom: splitterMode === "upper"
|
|
1148
1146
|
}
|
|
1149
|
-
}, /* @__PURE__ */
|
|
1147
|
+
}, /* @__PURE__ */ React11.createElement(PopoverRoot, null, /* @__PURE__ */ React11.createElement(Splitter.Root, {
|
|
1150
1148
|
mode: splitterMode,
|
|
1151
1149
|
ratio: 0.55
|
|
1152
|
-
}, /* @__PURE__ */
|
|
1150
|
+
}, /* @__PURE__ */ React11.createElement(Splitter.Panel, {
|
|
1153
1151
|
position: "upper"
|
|
1154
|
-
}, /* @__PURE__ */
|
|
1152
|
+
}, /* @__PURE__ */ React11.createElement(Main, null)), /* @__PURE__ */ React11.createElement(Splitter.Panel, {
|
|
1155
1153
|
position: "lower",
|
|
1156
1154
|
ref: drawerRef
|
|
1157
|
-
}, /* @__PURE__ */
|
|
1155
|
+
}, /* @__PURE__ */ React11.createElement(Drawer, null))), /* @__PURE__ */ React11.createElement(Dialog, null), /* @__PURE__ */ React11.createElement(PopoverContent, null)))));
|
|
1158
1156
|
};
|
|
1159
1157
|
|
|
1160
1158
|
export {
|
|
1161
1159
|
Home,
|
|
1162
1160
|
SimpleLayout,
|
|
1163
|
-
|
|
1161
|
+
NavBranch
|
|
1164
1162
|
};
|
|
1165
|
-
//# sourceMappingURL=chunk-
|
|
1163
|
+
//# sourceMappingURL=chunk-MDPEKLKR.mjs.map
|