@dxos/plugin-deck 0.6.14-main.7bd9c89 → 0.6.14-staging.934c9de
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/index.mjs +123 -127
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/types/src/DeckPlugin.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/ActiveNode.d.ts +1 -3
- package/dist/types/src/components/DeckLayout/ActiveNode.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/ComplementarySidebar.d.ts +2 -4
- package/dist/types/src/components/DeckLayout/ComplementarySidebar.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/DeckLayout.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/NodePlankHeading.d.ts +7 -6
- package/dist/types/src/components/DeckLayout/NodePlankHeading.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/Plank.d.ts +1 -1
- package/dist/types/src/components/DeckLayout/Plank.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/PlankError.d.ts +1 -2
- package/dist/types/src/components/DeckLayout/PlankError.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/Sidebar.d.ts.map +1 -1
- package/package.json +32 -31
- package/src/DeckPlugin.tsx +13 -25
- package/src/components/DeckLayout/ActiveNode.tsx +4 -1
- package/src/components/DeckLayout/ComplementarySidebar.tsx +12 -10
- package/src/components/DeckLayout/DeckLayout.tsx +7 -18
- package/src/components/DeckLayout/NodePlankHeading.tsx +127 -124
- package/src/components/DeckLayout/Plank.tsx +28 -19
- package/src/components/DeckLayout/PlankError.tsx +1 -9
- package/src/components/DeckLayout/Sidebar.tsx +5 -7
- package/src/components/LayoutSettings.tsx +13 -13
|
@@ -25,10 +25,10 @@ var SURFACE_PREFIX = "surface:";
|
|
|
25
25
|
|
|
26
26
|
// packages/plugins/plugin-deck/src/components/DeckLayout/DeckLayout.tsx
|
|
27
27
|
import { Sidebar as MenuIcon } from "@phosphor-icons/react";
|
|
28
|
-
import
|
|
28
|
+
import { untracked } from "@preact/signals-core";
|
|
29
|
+
import React13, { useCallback as useCallback2, useEffect as useEffect5, useMemo as useMemo5, useRef as useRef2 } from "react";
|
|
29
30
|
import { Surface as Surface9, firstIdInPart, usePlugin } from "@dxos/app-framework";
|
|
30
31
|
import { Button as Button3, Dialog, Main as Main3, Popover as Popover2, useOnTransition, useTranslation as useTranslation5 } from "@dxos/react-ui";
|
|
31
|
-
import { useAttended as useAttended3 } from "@dxos/react-ui-attention";
|
|
32
32
|
import { Deck } from "@dxos/react-ui-deck";
|
|
33
33
|
import { getSize, mainPaddingTransitions as mainPaddingTransitions2 } from "@dxos/react-ui-theme";
|
|
34
34
|
|
|
@@ -36,6 +36,7 @@ import { getSize, mainPaddingTransitions as mainPaddingTransitions2 } from "@dxo
|
|
|
36
36
|
import React from "react";
|
|
37
37
|
import { Surface } from "@dxos/app-framework";
|
|
38
38
|
import { useGraph } from "@dxos/plugin-graph";
|
|
39
|
+
import { useAttended } from "@dxos/react-ui-attention";
|
|
39
40
|
|
|
40
41
|
// packages/plugins/plugin-deck/src/hooks/useNode.ts
|
|
41
42
|
import { useEffect, useState } from "react";
|
|
@@ -99,7 +100,8 @@ var useMainSize = () => {
|
|
|
99
100
|
};
|
|
100
101
|
|
|
101
102
|
// packages/plugins/plugin-deck/src/components/DeckLayout/ActiveNode.tsx
|
|
102
|
-
var ActiveNode = (
|
|
103
|
+
var ActiveNode = () => {
|
|
104
|
+
const [id] = useAttended();
|
|
103
105
|
const { graph } = useGraph();
|
|
104
106
|
const activeNode = useNode(graph, id);
|
|
105
107
|
useNodeActionExpander(activeNode);
|
|
@@ -116,22 +118,22 @@ var ActiveNode = ({ id }) => {
|
|
|
116
118
|
};
|
|
117
119
|
|
|
118
120
|
// packages/plugins/plugin-deck/src/components/DeckLayout/ComplementarySidebar.tsx
|
|
119
|
-
import React5, { useMemo } from "react";
|
|
121
|
+
import React5, { useMemo as useMemo2 } from "react";
|
|
120
122
|
import { NavigationAction as NavigationAction2, SLUG_PATH_SEPARATOR as SLUG_PATH_SEPARATOR2, Surface as Surface3, useIntentDispatcher as useIntentDispatcher2 } from "@dxos/app-framework";
|
|
121
123
|
import { useGraph as useGraph3 } from "@dxos/plugin-graph";
|
|
122
124
|
import { Main } from "@dxos/react-ui";
|
|
123
|
-
import { useAttended } from "@dxos/react-ui-attention";
|
|
125
|
+
import { useAttended as useAttended2 } from "@dxos/react-ui-attention";
|
|
124
126
|
import { deckGrid } from "@dxos/react-ui-deck";
|
|
125
127
|
import { mx as mx2 } from "@dxos/react-ui-theme";
|
|
126
128
|
|
|
127
129
|
// packages/plugins/plugin-deck/src/components/DeckLayout/NodePlankHeading.tsx
|
|
128
|
-
import React2, { Fragment, useEffect as useEffect3 } from "react";
|
|
129
|
-
import { LayoutAction, NavigationAction, SLUG_PATH_SEPARATOR, Surface as Surface2, useIntentDispatcher
|
|
130
|
+
import React2, { Fragment, memo, useEffect as useEffect3, useMemo } from "react";
|
|
131
|
+
import { LayoutAction, NavigationAction, SLUG_PATH_SEPARATOR, Surface as Surface2, useIntentDispatcher } from "@dxos/app-framework";
|
|
130
132
|
import { useGraph as useGraph2 } from "@dxos/plugin-graph";
|
|
131
133
|
import { Icon, Popover, toLocalizedString, useMediaQuery, useTranslation } from "@dxos/react-ui";
|
|
132
134
|
import { PlankHeading } from "@dxos/react-ui-deck";
|
|
133
135
|
import { TextTooltip } from "@dxos/react-ui-text-tooltip";
|
|
134
|
-
var NodePlankHeading = ({
|
|
136
|
+
var NodePlankHeading = /* @__PURE__ */ memo(({ coordinate, node, canIncrementStart, canIncrementEnd, popoverAnchorId, pending, flatDeck, actions = [] }) => {
|
|
135
137
|
const { t } = useTranslation(DECK_PLUGIN);
|
|
136
138
|
const { graph } = useGraph2();
|
|
137
139
|
const icon = node?.properties?.icon ?? "ph--placeholder--regular";
|
|
@@ -152,15 +154,18 @@ var NodePlankHeading = ({ node, id, layoutParts, layoutPart, popoverAnchorId, pe
|
|
|
152
154
|
}, [
|
|
153
155
|
node
|
|
154
156
|
]);
|
|
155
|
-
const
|
|
156
|
-
const
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
157
|
+
const layoutPart = coordinate.part;
|
|
158
|
+
const attendableId = coordinate.entryId.split(SLUG_PATH_SEPARATOR).at(0);
|
|
159
|
+
const capabilities = useMemo(() => ({
|
|
160
|
+
solo: (layoutPart === "solo" || layoutPart === "main") && isNotMobile,
|
|
161
|
+
incrementStart: canIncrementStart,
|
|
162
|
+
incrementEnd: canIncrementEnd
|
|
163
|
+
}), [
|
|
164
|
+
isNotMobile,
|
|
165
|
+
layoutPart,
|
|
166
|
+
canIncrementStart,
|
|
167
|
+
canIncrementEnd
|
|
168
|
+
]);
|
|
164
169
|
return /* @__PURE__ */ React2.createElement(PlankHeading.Root, (layoutPart !== "main" || !flatDeck) && {
|
|
165
170
|
classNames: "pie-1 border-b border-separator"
|
|
166
171
|
}, /* @__PURE__ */ React2.createElement(ActionRoot, null, node ? /* @__PURE__ */ React2.createElement(PlankHeading.ActionsMenu, {
|
|
@@ -203,11 +208,7 @@ var NodePlankHeading = ({ node, id, layoutParts, layoutPart, popoverAnchorId, pe
|
|
|
203
208
|
object: node.data
|
|
204
209
|
}
|
|
205
210
|
}), /* @__PURE__ */ React2.createElement(PlankHeading.Controls, {
|
|
206
|
-
capabilities
|
|
207
|
-
solo: (layoutPart === "solo" || layoutPart === "main") && isNotMobile,
|
|
208
|
-
incrementStart: canIncrementStart,
|
|
209
|
-
incrementEnd: canIncrementEnd
|
|
210
|
-
},
|
|
211
|
+
capabilities,
|
|
211
212
|
isSolo: layoutPart === "solo",
|
|
212
213
|
onClick: (eventType) => {
|
|
213
214
|
if (!layoutPart) {
|
|
@@ -221,38 +222,45 @@ var NodePlankHeading = ({ node, id, layoutParts, layoutPart, popoverAnchorId, pe
|
|
|
221
222
|
type: eventType,
|
|
222
223
|
layoutCoordinate: {
|
|
223
224
|
part: "main",
|
|
224
|
-
entryId:
|
|
225
|
+
entryId: coordinate.entryId
|
|
225
226
|
}
|
|
226
227
|
}
|
|
227
228
|
}
|
|
228
229
|
]);
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
230
|
+
} else if (eventType === "close") {
|
|
231
|
+
if (layoutPart === "complementary") {
|
|
232
|
+
return dispatch({
|
|
233
|
+
action: LayoutAction.SET_LAYOUT,
|
|
234
|
+
data: {
|
|
235
|
+
element: "complementary",
|
|
236
|
+
state: false
|
|
237
|
+
}
|
|
238
|
+
});
|
|
239
|
+
} else {
|
|
240
|
+
return dispatch({
|
|
241
|
+
action: NavigationAction.CLOSE,
|
|
242
|
+
data: {
|
|
243
|
+
activeParts: {
|
|
244
|
+
[layoutPart]: [
|
|
245
|
+
coordinate.entryId
|
|
246
|
+
]
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
});
|
|
235
250
|
}
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
]
|
|
251
|
+
} else {
|
|
252
|
+
return dispatch({
|
|
253
|
+
action: NavigationAction.ADJUST,
|
|
254
|
+
data: {
|
|
255
|
+
type: eventType,
|
|
256
|
+
layoutCoordinate: coordinate
|
|
243
257
|
}
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
action: NavigationAction.ADJUST,
|
|
247
|
-
data: {
|
|
248
|
-
type: eventType,
|
|
249
|
-
layoutCoordinate
|
|
250
|
-
}
|
|
251
|
-
});
|
|
258
|
+
});
|
|
259
|
+
}
|
|
252
260
|
},
|
|
253
261
|
close: layoutPart === "complementary" ? "minify-end" : true
|
|
254
262
|
}));
|
|
255
|
-
};
|
|
263
|
+
});
|
|
256
264
|
|
|
257
265
|
// packages/plugins/plugin-deck/src/components/DeckLayout/PlankError.tsx
|
|
258
266
|
import React4, { useEffect as useEffect4, useState as useState2 } from "react";
|
|
@@ -288,15 +296,14 @@ var PlankContentError = ({ error }) => {
|
|
|
288
296
|
)
|
|
289
297
|
}, error ? error.toString() : t("error fallback message")));
|
|
290
298
|
};
|
|
291
|
-
var PlankError = ({ layoutCoordinate,
|
|
299
|
+
var PlankError = ({ layoutCoordinate, node, error, flatDeck }) => {
|
|
292
300
|
const [timedOut, setTimedOut] = useState2(false);
|
|
293
301
|
useEffect4(() => {
|
|
294
302
|
setTimeout(() => setTimedOut(true), 5e3);
|
|
295
303
|
}, []);
|
|
296
304
|
return /* @__PURE__ */ React4.createElement(React4.Fragment, null, /* @__PURE__ */ React4.createElement(NodePlankHeading, {
|
|
305
|
+
coordinate: layoutCoordinate,
|
|
297
306
|
node,
|
|
298
|
-
id,
|
|
299
|
-
layoutPart: layoutCoordinate.part,
|
|
300
307
|
pending: !timedOut,
|
|
301
308
|
flatDeck
|
|
302
309
|
}), timedOut ? /* @__PURE__ */ React4.createElement(PlankContentError, {
|
|
@@ -333,16 +340,16 @@ var getPanel = (id) => {
|
|
|
333
340
|
const panel = panels.find((p) => p.id === id) ?? panels[0];
|
|
334
341
|
return panel.id;
|
|
335
342
|
};
|
|
336
|
-
var ComplementarySidebar = ({
|
|
343
|
+
var ComplementarySidebar = ({ panel, flatDeck }) => {
|
|
337
344
|
const { popoverAnchorId } = useLayout();
|
|
338
|
-
const attended =
|
|
339
|
-
const part = getPanel(
|
|
345
|
+
const attended = useAttended2();
|
|
346
|
+
const part = getPanel(panel);
|
|
340
347
|
const id = attended[0] ? `${attended[0]}${SLUG_PATH_SEPARATOR2}${part}` : void 0;
|
|
341
348
|
const { graph } = useGraph3();
|
|
342
349
|
const node = useNode(graph, id);
|
|
343
350
|
const dispatch = useIntentDispatcher2();
|
|
344
351
|
useNodeActionExpander(node);
|
|
345
|
-
const actions =
|
|
352
|
+
const actions = useMemo2(() => panels.map(({ id: id2, icon }) => ({
|
|
346
353
|
id: `complementary-${id2}`,
|
|
347
354
|
data: () => {
|
|
348
355
|
void dispatch({
|
|
@@ -368,23 +375,29 @@ var ComplementarySidebar = ({ layoutParts, flatDeck }) => {
|
|
|
368
375
|
})), [
|
|
369
376
|
part
|
|
370
377
|
]);
|
|
378
|
+
const coordinate = useMemo2(() => ({
|
|
379
|
+
entryId: id ?? "unknown",
|
|
380
|
+
part: "complementary"
|
|
381
|
+
}), [
|
|
382
|
+
id
|
|
383
|
+
]);
|
|
371
384
|
return /* @__PURE__ */ React5.createElement(Main.ComplementarySidebar, null, /* @__PURE__ */ React5.createElement("div", {
|
|
372
385
|
role: "none",
|
|
373
386
|
className: mx2(deckGrid, "grid-cols-1 bs-full")
|
|
374
387
|
}, /* @__PURE__ */ React5.createElement(NodePlankHeading, {
|
|
388
|
+
coordinate,
|
|
375
389
|
node,
|
|
376
|
-
id,
|
|
377
|
-
layoutParts,
|
|
378
|
-
layoutPart: "complementary",
|
|
379
390
|
popoverAnchorId,
|
|
380
391
|
flatDeck,
|
|
381
392
|
actions
|
|
382
393
|
}), /* @__PURE__ */ React5.createElement("div", {
|
|
383
|
-
className: "row-span-2 divide-y divide-separator"
|
|
394
|
+
className: "row-span-2 divide-y divide-separator overflow-x-hidden overflow-y-scroll"
|
|
384
395
|
}, node && /* @__PURE__ */ React5.createElement(Surface3, {
|
|
396
|
+
key: id,
|
|
385
397
|
role: `complementary--${part}`,
|
|
386
398
|
data: {
|
|
387
|
-
|
|
399
|
+
id,
|
|
400
|
+
subject: node.properties.object ?? node.properties.space,
|
|
388
401
|
popoverAnchorId
|
|
389
402
|
},
|
|
390
403
|
fallback: PlankContentError,
|
|
@@ -449,8 +462,8 @@ var Fullscreen = ({ id }) => {
|
|
|
449
462
|
|
|
450
463
|
// packages/plugins/plugin-deck/src/components/DeckLayout/Plank.tsx
|
|
451
464
|
import { Plus } from "@phosphor-icons/react";
|
|
452
|
-
import React9, { useCallback, useLayoutEffect, useRef } from "react";
|
|
453
|
-
import { LayoutAction as LayoutAction2, NavigationAction as NavigationAction3, Surface as Surface6, useIntentDispatcher as useIntentDispatcher3 } from "@dxos/app-framework";
|
|
465
|
+
import React9, { memo as memo2, useCallback, useLayoutEffect, useMemo as useMemo3, useRef } from "react";
|
|
466
|
+
import { LayoutAction as LayoutAction2, NavigationAction as NavigationAction3, Surface as Surface6, useIntentDispatcher as useIntentDispatcher3, indexInPart, partLength } from "@dxos/app-framework";
|
|
454
467
|
import { debounce } from "@dxos/async";
|
|
455
468
|
import { useGraph as useGraph5 } from "@dxos/plugin-graph";
|
|
456
469
|
import { Button, Tooltip, useTranslation as useTranslation4 } from "@dxos/react-ui";
|
|
@@ -465,7 +478,7 @@ var DeckContext = createContext2(null);
|
|
|
465
478
|
var useDeckContext = () => useContext2(DeckContext) ?? raise2(new Error("Missing DeckContext"));
|
|
466
479
|
|
|
467
480
|
// packages/plugins/plugin-deck/src/components/DeckLayout/Plank.tsx
|
|
468
|
-
var Plank = ({ entry, layoutParts, part, flatDeck, searchEnabled, layoutMode }) => {
|
|
481
|
+
var Plank = /* @__PURE__ */ memo2(({ entry, layoutParts, part, flatDeck, searchEnabled, layoutMode }) => {
|
|
469
482
|
const { t } = useTranslation4(DECK_PLUGIN);
|
|
470
483
|
const dispatch = useIntentDispatcher3();
|
|
471
484
|
const { popoverAnchorId, scrollIntoView } = useLayout();
|
|
@@ -475,10 +488,17 @@ var Plank = ({ entry, layoutParts, part, flatDeck, searchEnabled, layoutMode })
|
|
|
475
488
|
const rootElement = useRef(null);
|
|
476
489
|
const resizeable = layoutMode === "deck";
|
|
477
490
|
const attendableAttrs = useAttendableAttributes(entry.id);
|
|
478
|
-
const coordinate = {
|
|
491
|
+
const coordinate = useMemo3(() => ({
|
|
479
492
|
part,
|
|
480
493
|
entryId: entry.id
|
|
481
|
-
}
|
|
494
|
+
}), [
|
|
495
|
+
entry.id,
|
|
496
|
+
part
|
|
497
|
+
]);
|
|
498
|
+
const index = indexInPart(layoutParts, coordinate);
|
|
499
|
+
const length = partLength(layoutParts, part);
|
|
500
|
+
const canIncrementStart = part === "main" && index !== void 0 && index > 0 && length !== void 0 && length > 1;
|
|
501
|
+
const canIncrementEnd = part === "main" && index !== void 0 && index < length - 1 && length !== void 0;
|
|
482
502
|
const size = plankSizing?.[entry.id];
|
|
483
503
|
const setSize = useCallback(debounce((newSize) => {
|
|
484
504
|
void dispatch({
|
|
@@ -514,6 +534,19 @@ var Plank = ({ entry, layoutParts, part, flatDeck, searchEnabled, layoutMode })
|
|
|
514
534
|
const isSolo = layoutMode === "solo" && part === "solo";
|
|
515
535
|
const isSuppressed = layoutMode === "solo" && part !== "solo" || layoutMode === "deck" && part === "solo";
|
|
516
536
|
const sizeAttrs = useMainSize();
|
|
537
|
+
const data = useMemo3(() => node && {
|
|
538
|
+
...entry.path ? {
|
|
539
|
+
subject: node.data,
|
|
540
|
+
path: entry.path
|
|
541
|
+
} : {
|
|
542
|
+
object: node.data
|
|
543
|
+
},
|
|
544
|
+
coordinate,
|
|
545
|
+
popoverAnchorId
|
|
546
|
+
}, [
|
|
547
|
+
node
|
|
548
|
+
]);
|
|
549
|
+
const placeholder = useMemo3(() => /* @__PURE__ */ React9.createElement(PlankLoading, null), []);
|
|
517
550
|
return /* @__PURE__ */ React9.createElement(NaturalPlank.Root, {
|
|
518
551
|
size,
|
|
519
552
|
setSize,
|
|
@@ -536,30 +569,20 @@ var Plank = ({ entry, layoutParts, part, flatDeck, searchEnabled, layoutMode })
|
|
|
536
569
|
inlineSize: ""
|
|
537
570
|
} : {}
|
|
538
571
|
}, node ? /* @__PURE__ */ React9.createElement(React9.Fragment, null, /* @__PURE__ */ React9.createElement(NodePlankHeading, {
|
|
539
|
-
|
|
572
|
+
coordinate,
|
|
540
573
|
node,
|
|
541
|
-
|
|
542
|
-
|
|
574
|
+
canIncrementStart,
|
|
575
|
+
canIncrementEnd,
|
|
543
576
|
popoverAnchorId,
|
|
544
577
|
flatDeck
|
|
545
578
|
}), /* @__PURE__ */ React9.createElement(Surface6, {
|
|
546
579
|
role: "article",
|
|
547
|
-
data
|
|
548
|
-
...entry.path ? {
|
|
549
|
-
subject: node.data,
|
|
550
|
-
path: entry.path
|
|
551
|
-
} : {
|
|
552
|
-
object: node.data
|
|
553
|
-
},
|
|
554
|
-
coordinate,
|
|
555
|
-
popoverAnchorId
|
|
556
|
-
},
|
|
580
|
+
data,
|
|
557
581
|
limit: 1,
|
|
558
582
|
fallback: PlankContentError,
|
|
559
|
-
placeholder
|
|
583
|
+
placeholder
|
|
560
584
|
})) : /* @__PURE__ */ React9.createElement(PlankError, {
|
|
561
585
|
layoutCoordinate: coordinate,
|
|
562
|
-
id: entry.id,
|
|
563
586
|
flatDeck
|
|
564
587
|
})), searchEnabled && resizeable ? /* @__PURE__ */ React9.createElement("div", {
|
|
565
588
|
role: "none",
|
|
@@ -595,35 +618,31 @@ var Plank = ({ entry, layoutParts, part, flatDeck, searchEnabled, layoutMode })
|
|
|
595
618
|
})) : resizeable ? /* @__PURE__ */ React9.createElement(NaturalPlank.ResizeHandle, {
|
|
596
619
|
classNames: "row-span-3"
|
|
597
620
|
}) : null);
|
|
598
|
-
};
|
|
621
|
+
});
|
|
599
622
|
|
|
600
623
|
// packages/plugins/plugin-deck/src/components/DeckLayout/Sidebar.tsx
|
|
601
|
-
import React10, { useMemo as
|
|
624
|
+
import React10, { useMemo as useMemo4 } from "react";
|
|
602
625
|
import { openIds, Surface as Surface7 } from "@dxos/app-framework";
|
|
603
626
|
import { Main as Main2 } from "@dxos/react-ui";
|
|
604
|
-
import { useAttended as useAttended2 } from "@dxos/react-ui-attention";
|
|
605
627
|
var Sidebar = ({ layoutParts }) => {
|
|
606
628
|
const { layoutMode, popoverAnchorId } = useLayout();
|
|
607
|
-
const
|
|
608
|
-
const activeIds = useMemo2(() => {
|
|
629
|
+
const activeIds = useMemo4(() => {
|
|
609
630
|
if (layoutMode === "solo") {
|
|
610
|
-
return new Set(layoutParts?.solo?.map((e) => e.id) ?? []);
|
|
631
|
+
return Array.from(new Set(layoutParts?.solo?.map((e) => e.id) ?? []));
|
|
611
632
|
} else if (layoutMode === "deck") {
|
|
612
|
-
return new Set(layoutParts?.main?.map((e) => e.id) ?? []);
|
|
633
|
+
return Array.from(new Set(layoutParts?.main?.map((e) => e.id) ?? []));
|
|
613
634
|
}
|
|
614
|
-
return new Set(openIds(layoutParts));
|
|
635
|
+
return Array.from(new Set(openIds(layoutParts)));
|
|
615
636
|
}, [
|
|
616
637
|
layoutParts,
|
|
617
638
|
layoutMode
|
|
618
639
|
]);
|
|
619
|
-
const navigationData =
|
|
640
|
+
const navigationData = useMemo4(() => ({
|
|
620
641
|
popoverAnchorId,
|
|
621
|
-
activeIds
|
|
622
|
-
attended
|
|
642
|
+
activeIds
|
|
623
643
|
}), [
|
|
624
644
|
popoverAnchorId,
|
|
625
|
-
activeIds
|
|
626
|
-
attended
|
|
645
|
+
activeIds
|
|
627
646
|
]);
|
|
628
647
|
return /* @__PURE__ */ React10.createElement(Main2.NavigationSidebar, null, /* @__PURE__ */ React10.createElement(Surface7, {
|
|
629
648
|
role: "navigation",
|
|
@@ -740,14 +759,15 @@ var DeckLayout = ({ layoutParts, toasts, flatDeck, overscroll, showHints, slots,
|
|
|
740
759
|
const { layoutMode, sidebarOpen, complementarySidebarOpen, dialogOpen, dialogContent, dialogBlockAlign, popoverOpen, popoverContent, popoverAnchorId } = context;
|
|
741
760
|
const { t } = useTranslation5(DECK_PLUGIN);
|
|
742
761
|
const { plankSizing } = useDeckContext();
|
|
743
|
-
const
|
|
762
|
+
const attentionPlugin = usePlugin("dxos.org/plugin/attention");
|
|
744
763
|
const searchPlugin = usePlugin("dxos.org/plugin/search");
|
|
745
|
-
const fullScreenSlug =
|
|
764
|
+
const fullScreenSlug = useMemo5(() => firstIdInPart(layoutParts, "fullScreen"), [
|
|
746
765
|
layoutParts
|
|
747
766
|
]);
|
|
748
767
|
const scrollLeftRef = useRef2();
|
|
749
768
|
const deckRef = useRef2(null);
|
|
750
769
|
useEffect5(() => {
|
|
770
|
+
const attended = untracked(() => attentionPlugin?.provides.attention.attended ?? []);
|
|
751
771
|
const firstId = layoutMode === "solo" ? firstIdInPart(layoutParts, "solo") : firstIdInPart(layoutParts, "main");
|
|
752
772
|
if (attended.length === 0 && firstId) {
|
|
753
773
|
document.querySelector(`article[data-attendable-id="${firstId}"] button`)?.focus();
|
|
@@ -775,16 +795,8 @@ var DeckLayout = ({ layoutParts, toasts, flatDeck, overscroll, showHints, slots,
|
|
|
775
795
|
}, [
|
|
776
796
|
layoutMode
|
|
777
797
|
]);
|
|
778
|
-
const firstAttendedId = attended[0];
|
|
779
|
-
useEffect5(() => {
|
|
780
|
-
if (layoutMode === "deck" && firstAttendedId) {
|
|
781
|
-
}
|
|
782
|
-
}, [
|
|
783
|
-
layoutMode,
|
|
784
|
-
firstAttendedId
|
|
785
|
-
]);
|
|
786
798
|
const isEmpty = layoutParts.main?.length === 0 && layoutParts.solo?.length === 0;
|
|
787
|
-
const padding =
|
|
799
|
+
const padding = useMemo5(() => {
|
|
788
800
|
if (layoutMode === "deck" && overscroll === "centering") {
|
|
789
801
|
return calculateOverscroll(layoutParts.main, plankSizing, sidebarOpen, complementarySidebarOpen);
|
|
790
802
|
}
|
|
@@ -813,9 +825,7 @@ var DeckLayout = ({ layoutParts, toasts, flatDeck, overscroll, showHints, slots,
|
|
|
813
825
|
context.popoverAnchorId = void 0;
|
|
814
826
|
}
|
|
815
827
|
}
|
|
816
|
-
}, /* @__PURE__ */ React13.createElement(ActiveNode, {
|
|
817
|
-
id: firstAttendedId
|
|
818
|
-
}), /* @__PURE__ */ React13.createElement(Main3.Root, {
|
|
828
|
+
}, /* @__PURE__ */ React13.createElement(ActiveNode, null), /* @__PURE__ */ React13.createElement(Main3.Root, {
|
|
819
829
|
navigationSidebarOpen: context.sidebarOpen,
|
|
820
830
|
onNavigationSidebarOpenChange: (next) => context.sidebarOpen = next,
|
|
821
831
|
complementarySidebarOpen: context.complementarySidebarOpen,
|
|
@@ -848,8 +858,7 @@ var DeckLayout = ({ layoutParts, toasts, flatDeck, overscroll, showHints, slots,
|
|
|
848
858
|
})), /* @__PURE__ */ React13.createElement(Sidebar, {
|
|
849
859
|
layoutParts
|
|
850
860
|
}), /* @__PURE__ */ React13.createElement(ComplementarySidebar, {
|
|
851
|
-
|
|
852
|
-
layoutParts,
|
|
861
|
+
panel: layoutParts.complementary?.[0].id,
|
|
853
862
|
flatDeck
|
|
854
863
|
}), /* @__PURE__ */ React13.createElement(Main3.Overlay, null), isEmpty && /* @__PURE__ */ React13.createElement(Main3.Content, {
|
|
855
864
|
handlesFocus: true
|
|
@@ -921,8 +930,8 @@ var DeckLayout = ({ layoutParts, toasts, flatDeck, overscroll, showHints, slots,
|
|
|
921
930
|
|
|
922
931
|
// packages/plugins/plugin-deck/src/components/LayoutSettings.tsx
|
|
923
932
|
import React14 from "react";
|
|
924
|
-
import { SettingsValue } from "@dxos/plugin-settings";
|
|
925
933
|
import { Input, Select, useTranslation as useTranslation6 } from "@dxos/react-ui";
|
|
934
|
+
import { FormInput } from "@dxos/react-ui-data";
|
|
926
935
|
|
|
927
936
|
// packages/plugins/plugin-deck/src/types.ts
|
|
928
937
|
var NewPlankPositions = [
|
|
@@ -938,7 +947,7 @@ var OverscrollOptions = [
|
|
|
938
947
|
var isSocket = !!globalThis.__args;
|
|
939
948
|
var LayoutSettings = ({ settings }) => {
|
|
940
949
|
const { t } = useTranslation6(DECK_PLUGIN);
|
|
941
|
-
return /* @__PURE__ */ React14.createElement(React14.Fragment, null, /* @__PURE__ */ React14.createElement(
|
|
950
|
+
return /* @__PURE__ */ React14.createElement(React14.Fragment, null, /* @__PURE__ */ React14.createElement(FormInput, {
|
|
942
951
|
label: t("select new plank positioning label")
|
|
943
952
|
}, /* @__PURE__ */ React14.createElement(Select.Root, {
|
|
944
953
|
value: settings.newPlankPositioning ?? "start",
|
|
@@ -948,7 +957,7 @@ var LayoutSettings = ({ settings }) => {
|
|
|
948
957
|
}), /* @__PURE__ */ React14.createElement(Select.Portal, null, /* @__PURE__ */ React14.createElement(Select.Content, null, /* @__PURE__ */ React14.createElement(Select.Viewport, null, NewPlankPositions.map((position) => /* @__PURE__ */ React14.createElement(Select.Option, {
|
|
949
958
|
key: position,
|
|
950
959
|
value: position
|
|
951
|
-
}, t(`settings new plank position ${position} label`)))))))), /* @__PURE__ */ React14.createElement(
|
|
960
|
+
}, t(`settings new plank position ${position} label`)))))))), /* @__PURE__ */ React14.createElement(FormInput, {
|
|
952
961
|
label: t("settings overscroll label")
|
|
953
962
|
}, /* @__PURE__ */ React14.createElement(Select.Root, {
|
|
954
963
|
value: settings.overscroll ?? "none",
|
|
@@ -958,22 +967,22 @@ var LayoutSettings = ({ settings }) => {
|
|
|
958
967
|
}), /* @__PURE__ */ React14.createElement(Select.Portal, null, /* @__PURE__ */ React14.createElement(Select.Content, null, /* @__PURE__ */ React14.createElement(Select.Viewport, null, OverscrollOptions.map((option) => /* @__PURE__ */ React14.createElement(Select.Option, {
|
|
959
968
|
key: option,
|
|
960
969
|
value: option
|
|
961
|
-
}, t(`settings overscroll ${option} label`)))))))), /* @__PURE__ */ React14.createElement(
|
|
970
|
+
}, t(`settings overscroll ${option} label`)))))))), /* @__PURE__ */ React14.createElement(FormInput, {
|
|
962
971
|
label: t("settings show hints label")
|
|
963
972
|
}, /* @__PURE__ */ React14.createElement(Input.Switch, {
|
|
964
973
|
checked: settings.showHints,
|
|
965
974
|
onCheckedChange: (checked) => settings.showHints = checked
|
|
966
|
-
})), !isSocket && /* @__PURE__ */ React14.createElement(
|
|
975
|
+
})), !isSocket && /* @__PURE__ */ React14.createElement(FormInput, {
|
|
967
976
|
label: t("settings native redirect label")
|
|
968
977
|
}, /* @__PURE__ */ React14.createElement(Input.Switch, {
|
|
969
978
|
checked: settings.enableNativeRedirect,
|
|
970
979
|
onCheckedChange: (checked) => settings.enableNativeRedirect = checked
|
|
971
|
-
})), /* @__PURE__ */ React14.createElement(
|
|
980
|
+
})), /* @__PURE__ */ React14.createElement(FormInput, {
|
|
972
981
|
label: t("settings custom slots")
|
|
973
982
|
}, /* @__PURE__ */ React14.createElement(Input.Switch, {
|
|
974
983
|
checked: settings.customSlots,
|
|
975
984
|
onCheckedChange: (checked) => settings.customSlots = checked
|
|
976
|
-
})), /* @__PURE__ */ React14.createElement(
|
|
985
|
+
})), /* @__PURE__ */ React14.createElement(FormInput, {
|
|
977
986
|
label: t("settings flat deck")
|
|
978
987
|
}, /* @__PURE__ */ React14.createElement(Input.Switch, {
|
|
979
988
|
checked: settings.flatDeck,
|
|
@@ -1306,29 +1315,23 @@ var DeckPlugin = ({ observability } = {}) => {
|
|
|
1306
1315
|
clientPlugin = resolvePlugin(plugins, parseClientPlugin);
|
|
1307
1316
|
layout.prop({
|
|
1308
1317
|
key: "layoutMode",
|
|
1309
|
-
storageKey: "layout-mode",
|
|
1310
1318
|
type: LocalStorageStore.enum()
|
|
1311
1319
|
}).prop({
|
|
1312
1320
|
key: "sidebarOpen",
|
|
1313
|
-
storageKey: "sidebar-open",
|
|
1314
1321
|
type: LocalStorageStore.bool()
|
|
1315
1322
|
}).prop({
|
|
1316
1323
|
key: "complementarySidebarOpen",
|
|
1317
|
-
storageKey: "complementary-sidebar-open",
|
|
1318
1324
|
type: LocalStorageStore.bool()
|
|
1319
1325
|
});
|
|
1320
1326
|
deck.prop({
|
|
1321
1327
|
key: "plankSizing",
|
|
1322
|
-
storageKey: "plank-sizing",
|
|
1323
1328
|
type: LocalStorageStore.json()
|
|
1324
1329
|
});
|
|
1325
1330
|
location.prop({
|
|
1326
1331
|
key: "active",
|
|
1327
|
-
storageKey: "active",
|
|
1328
1332
|
type: LocalStorageStore.json()
|
|
1329
1333
|
}).prop({
|
|
1330
1334
|
key: "closed",
|
|
1331
|
-
storageKey: "closed",
|
|
1332
1335
|
type: LocalStorageStore.json()
|
|
1333
1336
|
});
|
|
1334
1337
|
unsubscriptionCallbacks.push(clientPlugin?.provides.client.shell.onReset(() => {
|
|
@@ -1338,31 +1341,24 @@ var DeckPlugin = ({ observability } = {}) => {
|
|
|
1338
1341
|
}));
|
|
1339
1342
|
settings.prop({
|
|
1340
1343
|
key: "showHints",
|
|
1341
|
-
storageKey: "show-hints",
|
|
1342
1344
|
type: LocalStorageStore.bool()
|
|
1343
1345
|
}).prop({
|
|
1344
1346
|
key: "customSlots",
|
|
1345
|
-
storageKey: "customSlots",
|
|
1346
1347
|
type: LocalStorageStore.bool()
|
|
1347
1348
|
}).prop({
|
|
1348
1349
|
key: "flatDeck",
|
|
1349
|
-
storageKey: "flatDeck",
|
|
1350
1350
|
type: LocalStorageStore.bool()
|
|
1351
1351
|
}).prop({
|
|
1352
1352
|
key: "enableNativeRedirect",
|
|
1353
|
-
storageKey: "enable-native-redirect",
|
|
1354
1353
|
type: LocalStorageStore.bool()
|
|
1355
1354
|
}).prop({
|
|
1356
1355
|
key: "disableDeck",
|
|
1357
|
-
storageKey: "disable-deck",
|
|
1358
1356
|
type: LocalStorageStore.bool()
|
|
1359
1357
|
}).prop({
|
|
1360
1358
|
key: "newPlankPositioning",
|
|
1361
|
-
storageKey: "newPlankPositioning",
|
|
1362
1359
|
type: LocalStorageStore.enum()
|
|
1363
1360
|
}).prop({
|
|
1364
1361
|
key: "overscroll",
|
|
1365
|
-
storageKey: "overscroll",
|
|
1366
1362
|
type: LocalStorageStore.enum()
|
|
1367
1363
|
});
|
|
1368
1364
|
if (!isSocket2 && settings.values.enableNativeRedirect) {
|
|
@@ -1511,7 +1507,7 @@ var DeckPlugin = ({ observability } = {}) => {
|
|
|
1511
1507
|
} else {
|
|
1512
1508
|
log.warn("Invalid layout mode", intent?.data?.layoutMode, {
|
|
1513
1509
|
F: __dxlog_file,
|
|
1514
|
-
L:
|
|
1510
|
+
L: 392,
|
|
1515
1511
|
S: void 0,
|
|
1516
1512
|
C: (f, a) => f(...a)
|
|
1517
1513
|
});
|