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