@dxos/plugin-deck 0.6.12 → 0.6.13-main.548ca8d
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-YVHGFQQR.mjs → chunk-GVOGPULO.mjs} +1 -1
- package/dist/lib/browser/chunk-GVOGPULO.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +226 -176
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/meta.mjs +1 -1
- package/dist/types/src/DeckPlugin.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/ComplementarySidebar.d.ts +2 -2
- package/dist/types/src/components/DeckLayout/ComplementarySidebar.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/DeckLayout.d.ts +3 -4
- package/dist/types/src/components/DeckLayout/DeckLayout.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/NodePlankHeading.d.ts +4 -3
- package/dist/types/src/components/DeckLayout/NodePlankHeading.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/Sidebar.d.ts +2 -3
- package/dist/types/src/components/DeckLayout/Sidebar.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/StatusBar.d.ts +3 -1
- package/dist/types/src/components/DeckLayout/StatusBar.d.ts.map +1 -1
- package/dist/types/src/components/LayoutSettings.d.ts.map +1 -1
- package/dist/types/src/hooks/useNode.d.ts.map +1 -1
- package/dist/types/src/layout.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +3 -1
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types.d.ts +1 -1
- package/dist/types/src/types.d.ts.map +1 -1
- package/package.json +30 -29
- package/src/DeckPlugin.tsx +93 -71
- package/src/components/DeckLayout/ComplementarySidebar.tsx +67 -23
- package/src/components/DeckLayout/DeckLayout.tsx +56 -82
- package/src/components/DeckLayout/NodePlankHeading.tsx +15 -15
- package/src/components/DeckLayout/Plank.tsx +3 -3
- package/src/components/DeckLayout/Sidebar.tsx +6 -5
- package/src/components/DeckLayout/StatusBar.tsx +10 -2
- package/src/components/LayoutSettings.tsx +5 -8
- package/src/hooks/useNode.ts +5 -1
- package/src/layout.ts +1 -0
- package/src/meta.ts +3 -1
- package/src/translations.ts +3 -1
- package/src/types.ts +1 -1
- package/dist/lib/browser/chunk-YVHGFQQR.mjs.map +0 -7
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DECK_PLUGIN,
|
|
3
3
|
meta_default
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-GVOGPULO.mjs";
|
|
5
5
|
|
|
6
6
|
// packages/plugins/plugin-deck/src/DeckPlugin.tsx
|
|
7
|
-
import {
|
|
8
|
-
import { batch, effect } from "@preact/signals-core";
|
|
7
|
+
import { batch } from "@preact/signals-core";
|
|
9
8
|
import { setAutoFreeze } from "immer";
|
|
10
9
|
import React15 from "react";
|
|
11
|
-
import { IntentAction, LayoutAction as LayoutAction3, NavigationAction as
|
|
10
|
+
import { IntentAction, LayoutAction as LayoutAction3, NavigationAction as NavigationAction4, parseGraphPlugin, parseIntentPlugin, resolvePlugin, Toast as ToastSchema, SLUG_PATH_SEPARATOR as SLUG_PATH_SEPARATOR4, isLayoutParts, isLayoutAdjustment, isLayoutMode, openIds as openIds2 } from "@dxos/app-framework";
|
|
12
11
|
import { create, getTypename, isReactiveObject } from "@dxos/echo-schema";
|
|
12
|
+
import { scheduledEffect } from "@dxos/echo-signals/core";
|
|
13
13
|
import { LocalStorageStore } from "@dxos/local-storage";
|
|
14
14
|
import { log } from "@dxos/log";
|
|
15
15
|
import { parseAttentionPlugin } from "@dxos/plugin-attention";
|
|
@@ -18,7 +18,6 @@ import { createExtension } from "@dxos/plugin-graph";
|
|
|
18
18
|
import { ObservabilityAction } from "@dxos/plugin-observability/meta";
|
|
19
19
|
import { fullyQualifiedId } from "@dxos/react-client/echo";
|
|
20
20
|
import { translations as deckTranslations } from "@dxos/react-ui-deck";
|
|
21
|
-
import { Mosaic } from "@dxos/react-ui-mosaic";
|
|
22
21
|
|
|
23
22
|
// packages/plugins/plugin-deck/src/components/DeckLayout/constants.ts
|
|
24
23
|
var NAV_ID = "NavTree";
|
|
@@ -26,9 +25,10 @@ var SURFACE_PREFIX = "surface:";
|
|
|
26
25
|
|
|
27
26
|
// packages/plugins/plugin-deck/src/components/DeckLayout/DeckLayout.tsx
|
|
28
27
|
import { Sidebar as MenuIcon } from "@phosphor-icons/react";
|
|
29
|
-
import React13, { useCallback as useCallback2, useEffect as useEffect5, useMemo as
|
|
30
|
-
import {
|
|
31
|
-
import { Button as Button3, Dialog, Main as Main3, Popover as Popover2, useTranslation as useTranslation5 } from "@dxos/react-ui";
|
|
28
|
+
import React13, { useCallback as useCallback2, useEffect as useEffect5, useMemo as useMemo3, useRef as useRef2 } from "react";
|
|
29
|
+
import { Surface as Surface9, firstIdInPart, usePlugin } from "@dxos/app-framework";
|
|
30
|
+
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 } from "@dxos/react-ui-theme";
|
|
34
34
|
|
|
@@ -40,8 +40,11 @@ import { useGraph } from "@dxos/plugin-graph";
|
|
|
40
40
|
// packages/plugins/plugin-deck/src/hooks/useNode.ts
|
|
41
41
|
import { useEffect, useState } from "react";
|
|
42
42
|
var useNode = (graph, id, timeout) => {
|
|
43
|
-
const [nodeState, setNodeState] = useState(id ? graph.findNode(id) : void 0);
|
|
43
|
+
const [nodeState, setNodeState] = useState(id ? graph.findNode(id, false) : void 0);
|
|
44
44
|
useEffect(() => {
|
|
45
|
+
if (!id && nodeState) {
|
|
46
|
+
setNodeState(void 0);
|
|
47
|
+
}
|
|
45
48
|
if (nodeState?.id === id || !id) {
|
|
46
49
|
return;
|
|
47
50
|
}
|
|
@@ -113,36 +116,25 @@ var ActiveNode = ({ id }) => {
|
|
|
113
116
|
};
|
|
114
117
|
|
|
115
118
|
// packages/plugins/plugin-deck/src/components/DeckLayout/ComplementarySidebar.tsx
|
|
116
|
-
import React5 from "react";
|
|
117
|
-
import { SLUG_PATH_SEPARATOR as SLUG_PATH_SEPARATOR2, Surface as Surface3 } from "@dxos/app-framework";
|
|
119
|
+
import React5, { useMemo } from "react";
|
|
120
|
+
import { NavigationAction as NavigationAction2, SLUG_PATH_SEPARATOR as SLUG_PATH_SEPARATOR2, Surface as Surface3, useIntentDispatcher as useIntentDispatcher2 } from "@dxos/app-framework";
|
|
118
121
|
import { useGraph as useGraph3 } from "@dxos/plugin-graph";
|
|
119
122
|
import { Main } from "@dxos/react-ui";
|
|
120
|
-
import {
|
|
123
|
+
import { useAttended } from "@dxos/react-ui-attention";
|
|
121
124
|
import { deckGrid } from "@dxos/react-ui-deck";
|
|
122
125
|
import { mx as mx2 } from "@dxos/react-ui-theme";
|
|
123
126
|
|
|
124
127
|
// packages/plugins/plugin-deck/src/components/DeckLayout/NodePlankHeading.tsx
|
|
125
|
-
import { Placeholder } from "@phosphor-icons/react";
|
|
126
128
|
import React2, { Fragment, useEffect as useEffect3 } from "react";
|
|
127
|
-
import { LayoutAction, NavigationAction,
|
|
129
|
+
import { LayoutAction, NavigationAction, SLUG_PATH_SEPARATOR, Surface as Surface2, useIntentDispatcher, indexInPart, partLength } from "@dxos/app-framework";
|
|
128
130
|
import { useGraph as useGraph2 } from "@dxos/plugin-graph";
|
|
129
|
-
import { Popover, toLocalizedString, useMediaQuery, useTranslation } from "@dxos/react-ui";
|
|
130
|
-
import { PlankHeading
|
|
131
|
+
import { Icon, Popover, toLocalizedString, useMediaQuery, useTranslation } from "@dxos/react-ui";
|
|
132
|
+
import { PlankHeading } from "@dxos/react-ui-deck";
|
|
131
133
|
import { TextTooltip } from "@dxos/react-ui-text-tooltip";
|
|
132
|
-
var NodePlankHeading = ({
|
|
133
|
-
node,
|
|
134
|
-
id,
|
|
135
|
-
layoutParts,
|
|
136
|
-
layoutPart,
|
|
137
|
-
// TODO(wittjosiah): Unused?
|
|
138
|
-
layoutEntry,
|
|
139
|
-
popoverAnchorId,
|
|
140
|
-
pending,
|
|
141
|
-
flatDeck
|
|
142
|
-
}) => {
|
|
134
|
+
var NodePlankHeading = ({ node, id, layoutParts, layoutPart, popoverAnchorId, pending, flatDeck, actions = [] }) => {
|
|
143
135
|
const { t } = useTranslation(DECK_PLUGIN);
|
|
144
136
|
const { graph } = useGraph2();
|
|
145
|
-
const
|
|
137
|
+
const icon = node?.properties?.icon ?? "ph--placeholder--regular";
|
|
146
138
|
const label = pending ? t("pending heading") : toLocalizedString(node?.properties?.label ?? [
|
|
147
139
|
"plank heading fallback label",
|
|
148
140
|
{
|
|
@@ -172,10 +164,14 @@ var NodePlankHeading = ({
|
|
|
172
164
|
return /* @__PURE__ */ React2.createElement(PlankHeading.Root, (layoutPart !== "main" || !flatDeck) && {
|
|
173
165
|
classNames: "pie-1 border-b border-separator"
|
|
174
166
|
}, /* @__PURE__ */ React2.createElement(ActionRoot, null, node ? /* @__PURE__ */ React2.createElement(PlankHeading.ActionsMenu, {
|
|
175
|
-
|
|
167
|
+
icon,
|
|
168
|
+
related: layoutPart === "complementary",
|
|
176
169
|
attendableId,
|
|
177
170
|
triggerLabel: t("actions menu label"),
|
|
178
|
-
actions:
|
|
171
|
+
actions: [
|
|
172
|
+
actions,
|
|
173
|
+
graph.actions(node)
|
|
174
|
+
].filter((a) => a.length > 0),
|
|
179
175
|
onAction: (action) => typeof action.data === "function" && action.data?.({
|
|
180
176
|
node: action,
|
|
181
177
|
caller: DECK_PLUGIN
|
|
@@ -187,11 +183,15 @@ var NodePlankHeading = ({
|
|
|
187
183
|
}
|
|
188
184
|
})) : /* @__PURE__ */ React2.createElement(PlankHeading.Button, null, /* @__PURE__ */ React2.createElement("span", {
|
|
189
185
|
className: "sr-only"
|
|
190
|
-
}, label), /* @__PURE__ */ React2.createElement(Icon,
|
|
186
|
+
}, label), /* @__PURE__ */ React2.createElement(Icon, {
|
|
187
|
+
icon,
|
|
188
|
+
size: 5
|
|
189
|
+
}))), /* @__PURE__ */ React2.createElement(TextTooltip, {
|
|
191
190
|
text: label,
|
|
192
191
|
onlyWhenTruncating: true
|
|
193
192
|
}, /* @__PURE__ */ React2.createElement(PlankHeading.Label, {
|
|
194
|
-
attendableId
|
|
193
|
+
attendableId,
|
|
194
|
+
related: layoutPart === "complementary",
|
|
195
195
|
...pending && {
|
|
196
196
|
classNames: "text-description"
|
|
197
197
|
}
|
|
@@ -237,9 +237,6 @@ var NodePlankHeading = ({
|
|
|
237
237
|
action: NavigationAction.CLOSE,
|
|
238
238
|
data: {
|
|
239
239
|
activeParts: {
|
|
240
|
-
complementary: [
|
|
241
|
-
`${id}${SLUG_PATH_SEPARATOR}comments${SLUG_COLLECTION_INDICATOR}`
|
|
242
|
-
],
|
|
243
240
|
[layoutPart]: [
|
|
244
241
|
id
|
|
245
242
|
]
|
|
@@ -253,7 +250,7 @@ var NodePlankHeading = ({
|
|
|
253
250
|
}
|
|
254
251
|
});
|
|
255
252
|
},
|
|
256
|
-
close:
|
|
253
|
+
close: layoutPart === "complementary" ? "minify-end" : true
|
|
257
254
|
}));
|
|
258
255
|
};
|
|
259
256
|
|
|
@@ -314,13 +311,68 @@ var LayoutContext = createContext(null);
|
|
|
314
311
|
var useLayout = () => useContext(LayoutContext) ?? raise(new Error("Missing LayoutContext"));
|
|
315
312
|
|
|
316
313
|
// packages/plugins/plugin-deck/src/components/DeckLayout/ComplementarySidebar.tsx
|
|
317
|
-
var
|
|
314
|
+
var panels = [
|
|
315
|
+
"comments",
|
|
316
|
+
"settings",
|
|
317
|
+
"debug"
|
|
318
|
+
];
|
|
319
|
+
var nodes = [
|
|
320
|
+
{
|
|
321
|
+
id: "comments",
|
|
322
|
+
icon: "ph--chat-text--regular"
|
|
323
|
+
},
|
|
324
|
+
{
|
|
325
|
+
id: "settings",
|
|
326
|
+
icon: "ph--gear--regular"
|
|
327
|
+
},
|
|
328
|
+
{
|
|
329
|
+
id: "debug",
|
|
330
|
+
icon: "ph--bug--regular"
|
|
331
|
+
}
|
|
332
|
+
];
|
|
333
|
+
var getPanel = (part) => {
|
|
334
|
+
if (part && panels.findIndex((panel) => panel === part) !== -1) {
|
|
335
|
+
return part;
|
|
336
|
+
} else {
|
|
337
|
+
return "settings";
|
|
338
|
+
}
|
|
339
|
+
};
|
|
340
|
+
var ComplementarySidebar = ({ layoutParts, flatDeck }) => {
|
|
318
341
|
const { popoverAnchorId } = useLayout();
|
|
342
|
+
const attended = useAttended();
|
|
343
|
+
const part = getPanel(layoutParts.complementary?.[0].id);
|
|
344
|
+
const id = attended[0] ? `${attended[0]}${SLUG_PATH_SEPARATOR2}${part}` : void 0;
|
|
319
345
|
const { graph } = useGraph3();
|
|
320
346
|
const node = useNode(graph, id);
|
|
321
|
-
const
|
|
347
|
+
const dispatch = useIntentDispatcher2();
|
|
322
348
|
useNodeActionExpander(node);
|
|
323
|
-
|
|
349
|
+
const actions = useMemo(() => nodes.map(({ id: id2, icon }) => ({
|
|
350
|
+
id: `complementary-${id2}`,
|
|
351
|
+
data: () => {
|
|
352
|
+
void dispatch({
|
|
353
|
+
action: NavigationAction2.OPEN,
|
|
354
|
+
data: {
|
|
355
|
+
activeParts: {
|
|
356
|
+
complementary: id2
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
});
|
|
360
|
+
},
|
|
361
|
+
properties: {
|
|
362
|
+
label: [
|
|
363
|
+
`${id2} label`,
|
|
364
|
+
{
|
|
365
|
+
ns: DECK_PLUGIN
|
|
366
|
+
}
|
|
367
|
+
],
|
|
368
|
+
icon,
|
|
369
|
+
menuItemType: "toggle",
|
|
370
|
+
isChecked: part === id2
|
|
371
|
+
}
|
|
372
|
+
})), [
|
|
373
|
+
part
|
|
374
|
+
]);
|
|
375
|
+
return /* @__PURE__ */ React5.createElement(Main.ComplementarySidebar, null, /* @__PURE__ */ React5.createElement("div", {
|
|
324
376
|
role: "none",
|
|
325
377
|
className: mx2(deckGrid, "grid-cols-1 bs-full")
|
|
326
378
|
}, /* @__PURE__ */ React5.createElement(NodePlankHeading, {
|
|
@@ -329,18 +381,18 @@ var ComplementarySidebar = ({ id, layoutParts, flatDeck }) => {
|
|
|
329
381
|
layoutParts,
|
|
330
382
|
layoutPart: "complementary",
|
|
331
383
|
popoverAnchorId,
|
|
332
|
-
flatDeck
|
|
333
|
-
|
|
334
|
-
|
|
384
|
+
flatDeck,
|
|
385
|
+
actions
|
|
386
|
+
}), node && /* @__PURE__ */ React5.createElement(Surface3, {
|
|
387
|
+
role: `complementary--${part}`,
|
|
335
388
|
data: {
|
|
336
|
-
subject: node.
|
|
337
|
-
part: "complementary",
|
|
389
|
+
subject: node.properties.object,
|
|
338
390
|
popoverAnchorId
|
|
339
391
|
},
|
|
340
392
|
limit: 1,
|
|
341
393
|
fallback: PlankContentError,
|
|
342
394
|
placeholder: /* @__PURE__ */ React5.createElement(PlankLoading, null)
|
|
343
|
-
}))
|
|
395
|
+
})));
|
|
344
396
|
};
|
|
345
397
|
|
|
346
398
|
// packages/plugins/plugin-deck/src/components/DeckLayout/ContentEmpty.tsx
|
|
@@ -401,11 +453,11 @@ var Fullscreen = ({ id }) => {
|
|
|
401
453
|
// packages/plugins/plugin-deck/src/components/DeckLayout/Plank.tsx
|
|
402
454
|
import { Plus } from "@phosphor-icons/react";
|
|
403
455
|
import React9, { useCallback, useLayoutEffect, useRef } from "react";
|
|
404
|
-
import { LayoutAction as LayoutAction2, NavigationAction as
|
|
456
|
+
import { LayoutAction as LayoutAction2, NavigationAction as NavigationAction3, Surface as Surface6, useIntentDispatcher as useIntentDispatcher3 } from "@dxos/app-framework";
|
|
405
457
|
import { debounce } from "@dxos/async";
|
|
406
458
|
import { useGraph as useGraph5 } from "@dxos/plugin-graph";
|
|
407
459
|
import { Button, Tooltip, useTranslation as useTranslation4 } from "@dxos/react-ui";
|
|
408
|
-
import {
|
|
460
|
+
import { useAttendableAttributes } from "@dxos/react-ui-attention";
|
|
409
461
|
import { Plank as NaturalPlank } from "@dxos/react-ui-deck";
|
|
410
462
|
import { mainIntrinsicSize } from "@dxos/react-ui-theme";
|
|
411
463
|
|
|
@@ -418,14 +470,14 @@ var useDeckContext = () => useContext2(DeckContext) ?? raise2(new Error("Missing
|
|
|
418
470
|
// packages/plugins/plugin-deck/src/components/DeckLayout/Plank.tsx
|
|
419
471
|
var Plank = ({ entry, layoutParts, part, flatDeck, searchEnabled, layoutMode }) => {
|
|
420
472
|
const { t } = useTranslation4(DECK_PLUGIN);
|
|
421
|
-
const dispatch =
|
|
473
|
+
const dispatch = useIntentDispatcher3();
|
|
422
474
|
const { popoverAnchorId, scrollIntoView } = useLayout();
|
|
423
475
|
const { plankSizing } = useDeckContext();
|
|
424
476
|
const { graph } = useGraph5();
|
|
425
477
|
const node = useNode(graph, entry.id);
|
|
426
478
|
const rootElement = useRef(null);
|
|
427
479
|
const resizeable = layoutMode === "deck";
|
|
428
|
-
const attendableAttrs =
|
|
480
|
+
const attendableAttrs = useAttendableAttributes(entry.id);
|
|
429
481
|
const coordinate = {
|
|
430
482
|
part,
|
|
431
483
|
entryId: entry.id
|
|
@@ -463,7 +515,7 @@ var Plank = ({ entry, layoutParts, part, flatDeck, searchEnabled, layoutMode })
|
|
|
463
515
|
layoutMode
|
|
464
516
|
]);
|
|
465
517
|
const isSolo = layoutMode === "solo" && part === "solo";
|
|
466
|
-
const isSuppressed = layoutMode === "solo" && part !== "solo";
|
|
518
|
+
const isSuppressed = layoutMode === "solo" && part !== "solo" || layoutMode === "deck" && part === "solo";
|
|
467
519
|
const sizeAttrs = useMainSize();
|
|
468
520
|
return /* @__PURE__ */ React9.createElement(NaturalPlank.Root, {
|
|
469
521
|
size,
|
|
@@ -529,7 +581,7 @@ var Plank = ({ entry, layoutParts, part, flatDeck, searchEnabled, layoutMode })
|
|
|
529
581
|
component: "dxos.org/plugin/search/Dialog",
|
|
530
582
|
dialogBlockAlign: "start",
|
|
531
583
|
subject: {
|
|
532
|
-
action:
|
|
584
|
+
action: NavigationAction3.SET,
|
|
533
585
|
position: "add-after",
|
|
534
586
|
coordinate
|
|
535
587
|
}
|
|
@@ -549,12 +601,14 @@ var Plank = ({ entry, layoutParts, part, flatDeck, searchEnabled, layoutMode })
|
|
|
549
601
|
};
|
|
550
602
|
|
|
551
603
|
// packages/plugins/plugin-deck/src/components/DeckLayout/Sidebar.tsx
|
|
552
|
-
import React10, { useMemo } from "react";
|
|
604
|
+
import React10, { useMemo as useMemo2 } from "react";
|
|
553
605
|
import { openIds, Surface as Surface7 } from "@dxos/app-framework";
|
|
554
606
|
import { Main as Main2 } from "@dxos/react-ui";
|
|
555
|
-
|
|
607
|
+
import { useAttended as useAttended2 } from "@dxos/react-ui-attention";
|
|
608
|
+
var Sidebar = ({ layoutParts }) => {
|
|
556
609
|
const { layoutMode, popoverAnchorId } = useLayout();
|
|
557
|
-
const
|
|
610
|
+
const attended = useAttended2();
|
|
611
|
+
const activeIds = useMemo2(() => {
|
|
558
612
|
if (layoutMode === "solo") {
|
|
559
613
|
return new Set(layoutParts?.solo?.map((e) => e.id) ?? []);
|
|
560
614
|
} else if (layoutMode === "deck") {
|
|
@@ -565,14 +619,14 @@ var Sidebar = ({ attention, layoutParts }) => {
|
|
|
565
619
|
layoutParts,
|
|
566
620
|
layoutMode
|
|
567
621
|
]);
|
|
568
|
-
const navigationData =
|
|
622
|
+
const navigationData = useMemo2(() => ({
|
|
569
623
|
popoverAnchorId,
|
|
570
624
|
activeIds,
|
|
571
|
-
attended
|
|
625
|
+
attended
|
|
572
626
|
}), [
|
|
573
627
|
popoverAnchorId,
|
|
574
628
|
activeIds,
|
|
575
|
-
|
|
629
|
+
attended
|
|
576
630
|
]);
|
|
577
631
|
return /* @__PURE__ */ React10.createElement(Main2.NavigationSidebar, null, /* @__PURE__ */ React10.createElement(Surface7, {
|
|
578
632
|
role: "navigation",
|
|
@@ -587,13 +641,18 @@ var Sidebar = ({ attention, layoutParts }) => {
|
|
|
587
641
|
import React11 from "react";
|
|
588
642
|
import { Surface as Surface8 } from "@dxos/app-framework";
|
|
589
643
|
import { mainPadding, mx as mx4 } from "@dxos/react-ui-theme";
|
|
590
|
-
var StatusBar = () => {
|
|
644
|
+
var StatusBar = ({ showHints }) => {
|
|
591
645
|
const sizeAttrs = useMainSize();
|
|
592
646
|
return /* @__PURE__ */ React11.createElement("div", {
|
|
593
647
|
role: "none",
|
|
594
648
|
...sizeAttrs,
|
|
595
|
-
className: mx4("fixed block-end-0 inset-inline-0 z-[2]", mainPadding)
|
|
596
|
-
}, /* @__PURE__ */ React11.createElement(
|
|
649
|
+
className: mx4("fixed flex justify-between block-end-0 inset-inline-0 items-center border-bs border-separator z-[2]", mainPadding)
|
|
650
|
+
}, /* @__PURE__ */ React11.createElement("div", {
|
|
651
|
+
role: "none"
|
|
652
|
+
}, showHints && /* @__PURE__ */ React11.createElement(Surface8, {
|
|
653
|
+
role: "hints",
|
|
654
|
+
limit: 1
|
|
655
|
+
})), /* @__PURE__ */ React11.createElement(Surface8, {
|
|
597
656
|
role: "status-bar",
|
|
598
657
|
limit: 1
|
|
599
658
|
}));
|
|
@@ -672,20 +731,26 @@ var calculateOverscroll = (planks, plankSizing, sidebarOpen, complementarySideba
|
|
|
672
731
|
};
|
|
673
732
|
|
|
674
733
|
// packages/plugins/plugin-deck/src/components/DeckLayout/DeckLayout.tsx
|
|
675
|
-
var DeckLayout = ({ layoutParts,
|
|
734
|
+
var DeckLayout = ({ layoutParts, toasts, flatDeck, overscroll, showHints, slots, onDismissToast }) => {
|
|
676
735
|
const context = useLayout();
|
|
677
736
|
const { layoutMode, sidebarOpen, complementarySidebarOpen, dialogOpen, dialogContent, dialogBlockAlign, popoverOpen, popoverContent, popoverAnchorId } = context;
|
|
678
737
|
const { t } = useTranslation5(DECK_PLUGIN);
|
|
679
738
|
const { plankSizing } = useDeckContext();
|
|
739
|
+
const attended = useAttended3();
|
|
680
740
|
const searchPlugin = usePlugin("dxos.org/plugin/search");
|
|
681
|
-
const fullScreenSlug =
|
|
741
|
+
const fullScreenSlug = useMemo3(() => firstIdInPart(layoutParts, "fullScreen"), [
|
|
682
742
|
layoutParts
|
|
683
743
|
]);
|
|
684
|
-
const
|
|
744
|
+
const scrollLeftRef = useRef2();
|
|
685
745
|
const deckRef = useRef2(null);
|
|
686
|
-
|
|
746
|
+
useEffect5(() => {
|
|
747
|
+
const firstId = layoutMode === "solo" ? firstIdInPart(layoutParts, "solo") : firstIdInPart(layoutParts, "main");
|
|
748
|
+
if (attended.length === 0 && firstId) {
|
|
749
|
+
document.querySelector(`article[data-attendable-id="${firstId}"] button`)?.focus();
|
|
750
|
+
}
|
|
751
|
+
}, []);
|
|
687
752
|
const handleResize = useCallback2(() => {
|
|
688
|
-
|
|
753
|
+
scrollLeftRef.current = null;
|
|
689
754
|
}, []);
|
|
690
755
|
useEffect5(() => {
|
|
691
756
|
window.addEventListener("resize", handleResize);
|
|
@@ -693,36 +758,20 @@ var DeckLayout = ({ layoutParts, attention, toasts, flatDeck, overscroll, showHi
|
|
|
693
758
|
}, [
|
|
694
759
|
handleResize
|
|
695
760
|
]);
|
|
696
|
-
|
|
697
|
-
if (
|
|
698
|
-
|
|
699
|
-
} else if (restoreScrollRef.current && deckRef.current && scrollLeft) {
|
|
700
|
-
deckRef.current.scrollLeft = scrollLeft;
|
|
701
|
-
restoreScrollRef.current = false;
|
|
761
|
+
const restoreScroll = useCallback2(() => {
|
|
762
|
+
if (deckRef.current && scrollLeftRef.current != null) {
|
|
763
|
+
deckRef.current.scrollLeft = scrollLeftRef.current;
|
|
702
764
|
}
|
|
703
|
-
}, [
|
|
704
|
-
|
|
705
|
-
deckRef.current,
|
|
706
|
-
scrollLeft
|
|
707
|
-
]);
|
|
765
|
+
}, []);
|
|
766
|
+
useOnTransition(layoutMode, (mode) => mode !== "deck", "deck", restoreScroll);
|
|
708
767
|
const handleScroll = useCallback2((event) => {
|
|
709
768
|
if (layoutMode === "deck" && event.currentTarget === event.target) {
|
|
710
|
-
|
|
769
|
+
scrollLeftRef.current = event.target.scrollLeft;
|
|
711
770
|
}
|
|
712
771
|
}, [
|
|
713
772
|
layoutMode
|
|
714
773
|
]);
|
|
715
|
-
const
|
|
716
|
-
const entry = layoutParts.complementary?.at(0);
|
|
717
|
-
if (entry) {
|
|
718
|
-
return entry.path ? `${entry.id}${SLUG_PATH_SEPARATOR3}${entry.path}` : entry.id;
|
|
719
|
-
}
|
|
720
|
-
}, [
|
|
721
|
-
layoutParts
|
|
722
|
-
]);
|
|
723
|
-
const firstAttendedId = useMemo2(() => Array.from(attention.attended ?? [])[0], [
|
|
724
|
-
attention.attended
|
|
725
|
-
]);
|
|
774
|
+
const firstAttendedId = attended[0];
|
|
726
775
|
useEffect5(() => {
|
|
727
776
|
if (layoutMode === "deck" && firstAttendedId) {
|
|
728
777
|
}
|
|
@@ -730,21 +779,20 @@ var DeckLayout = ({ layoutParts, attention, toasts, flatDeck, overscroll, showHi
|
|
|
730
779
|
layoutMode,
|
|
731
780
|
firstAttendedId
|
|
732
781
|
]);
|
|
733
|
-
const
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
for (const part of layoutParts.solo ?? []) {
|
|
738
|
-
if (!parts2.find((entry) => entry.id === part.id)) {
|
|
739
|
-
parts2.push(part);
|
|
740
|
-
}
|
|
782
|
+
const isEmpty = layoutParts.main?.length === 0 && layoutParts.solo?.length === 0;
|
|
783
|
+
const padding = useMemo3(() => {
|
|
784
|
+
if (layoutMode === "deck" && overscroll === "centering") {
|
|
785
|
+
return calculateOverscroll(layoutParts.main, plankSizing, sidebarOpen, complementarySidebarOpen);
|
|
741
786
|
}
|
|
742
|
-
return
|
|
787
|
+
return {};
|
|
743
788
|
}, [
|
|
789
|
+
layoutMode,
|
|
790
|
+
overscroll,
|
|
744
791
|
layoutParts.main,
|
|
745
|
-
|
|
792
|
+
plankSizing,
|
|
793
|
+
sidebarOpen,
|
|
794
|
+
complementarySidebarOpen
|
|
746
795
|
]);
|
|
747
|
-
const padding = layoutMode === "deck" && overscroll === "centering" ? calculateOverscroll(layoutParts.main, plankSizing, sidebarOpen, complementarySidebarOpen) : {};
|
|
748
796
|
if (layoutMode === "fullscreen") {
|
|
749
797
|
return /* @__PURE__ */ React13.createElement(Fullscreen, {
|
|
750
798
|
id: fullScreenSlug
|
|
@@ -766,19 +814,13 @@ var DeckLayout = ({ layoutParts, attention, toasts, flatDeck, overscroll, showHi
|
|
|
766
814
|
}), /* @__PURE__ */ React13.createElement(Main3.Root, {
|
|
767
815
|
navigationSidebarOpen: context.sidebarOpen,
|
|
768
816
|
onNavigationSidebarOpenChange: (next) => context.sidebarOpen = next,
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
/* complementaryAvailable && */
|
|
772
|
-
context.complementarySidebarOpen
|
|
773
|
-
),
|
|
774
|
-
onComplementarySidebarOpenChange: (next) => context.complementarySidebarOpen = next
|
|
775
|
-
}
|
|
817
|
+
complementarySidebarOpen: context.complementarySidebarOpen,
|
|
818
|
+
onComplementarySidebarOpenChange: (next) => context.complementarySidebarOpen = next
|
|
776
819
|
}, /* @__PURE__ */ React13.createElement(Main3.Notch, {
|
|
777
820
|
classNames: "z-[21]"
|
|
778
821
|
}, /* @__PURE__ */ React13.createElement(Surface9, {
|
|
779
822
|
role: "notch-start"
|
|
780
823
|
}), /* @__PURE__ */ React13.createElement(Button3, {
|
|
781
|
-
// disabled={!sidebarAvailable}
|
|
782
824
|
onClick: () => context.sidebarOpen = !context.sidebarOpen,
|
|
783
825
|
variant: "ghost",
|
|
784
826
|
classNames: "p-1"
|
|
@@ -788,7 +830,6 @@ var DeckLayout = ({ layoutParts, attention, toasts, flatDeck, overscroll, showHi
|
|
|
788
830
|
weight: "light",
|
|
789
831
|
className: getSize(5)
|
|
790
832
|
})), /* @__PURE__ */ React13.createElement(Button3, {
|
|
791
|
-
// disabled={!complementaryAvailable}
|
|
792
833
|
onClick: () => context.complementarySidebarOpen = !context.complementarySidebarOpen,
|
|
793
834
|
variant: "ghost",
|
|
794
835
|
classNames: "p-1"
|
|
@@ -801,15 +842,14 @@ var DeckLayout = ({ layoutParts, attention, toasts, flatDeck, overscroll, showHi
|
|
|
801
842
|
})), /* @__PURE__ */ React13.createElement(Surface9, {
|
|
802
843
|
role: "notch-end"
|
|
803
844
|
})), /* @__PURE__ */ React13.createElement(Sidebar, {
|
|
804
|
-
attention,
|
|
805
845
|
layoutParts
|
|
806
846
|
}), /* @__PURE__ */ React13.createElement(ComplementarySidebar, {
|
|
807
|
-
|
|
847
|
+
context: "comments",
|
|
808
848
|
layoutParts,
|
|
809
849
|
flatDeck
|
|
810
|
-
}), /* @__PURE__ */ React13.createElement(Main3.Overlay, null),
|
|
850
|
+
}), /* @__PURE__ */ React13.createElement(Main3.Overlay, null), isEmpty && /* @__PURE__ */ React13.createElement(Main3.Content, {
|
|
811
851
|
handlesFocus: true
|
|
812
|
-
}, /* @__PURE__ */ React13.createElement(ContentEmpty, null)),
|
|
852
|
+
}, /* @__PURE__ */ React13.createElement(ContentEmpty, null)), !isEmpty && /* @__PURE__ */ React13.createElement(Main3.Content, {
|
|
813
853
|
bounce: true,
|
|
814
854
|
classNames: "grid block-end-[--statusbar-size]",
|
|
815
855
|
handlesFocus: true
|
|
@@ -826,20 +866,26 @@ var DeckLayout = ({ layoutParts, attention, toasts, flatDeck, overscroll, showHi
|
|
|
826
866
|
solo: layoutMode === "solo",
|
|
827
867
|
onScroll: handleScroll,
|
|
828
868
|
ref: deckRef
|
|
829
|
-
},
|
|
869
|
+
}, /* @__PURE__ */ React13.createElement(Plank, {
|
|
870
|
+
entry: layoutParts.solo?.[0] ?? {
|
|
871
|
+
id: "unknown-solo"
|
|
872
|
+
},
|
|
873
|
+
layoutParts,
|
|
874
|
+
part: "solo",
|
|
875
|
+
layoutMode,
|
|
876
|
+
flatDeck,
|
|
877
|
+
searchEnabled: !!searchPlugin
|
|
878
|
+
}), layoutParts.main?.map((layoutEntry) => /* @__PURE__ */ React13.createElement(Plank, {
|
|
830
879
|
key: layoutEntry.id,
|
|
831
880
|
entry: layoutEntry,
|
|
832
881
|
layoutParts,
|
|
833
|
-
part:
|
|
882
|
+
part: "main",
|
|
834
883
|
layoutMode,
|
|
835
884
|
flatDeck,
|
|
836
885
|
searchEnabled: !!searchPlugin
|
|
837
|
-
}))))), /* @__PURE__ */ React13.createElement(StatusBar,
|
|
838
|
-
|
|
839
|
-
}, /* @__PURE__ */ React13.createElement(
|
|
840
|
-
role: "hints",
|
|
841
|
-
limit: 1
|
|
842
|
-
})), /* @__PURE__ */ React13.createElement(Popover2.Portal, null, /* @__PURE__ */ React13.createElement(Popover2.Content, {
|
|
886
|
+
}))))), /* @__PURE__ */ React13.createElement(StatusBar, {
|
|
887
|
+
showHints
|
|
888
|
+
}), /* @__PURE__ */ React13.createElement(Popover2.Portal, null, /* @__PURE__ */ React13.createElement(Popover2.Content, {
|
|
843
889
|
classNames: "z-[60]",
|
|
844
890
|
onEscapeKeyDown: () => {
|
|
845
891
|
context.popoverOpen = false;
|
|
@@ -908,31 +954,31 @@ var LayoutSettings = ({ settings }) => {
|
|
|
908
954
|
key: option,
|
|
909
955
|
value: option
|
|
910
956
|
}, t(`settings overscroll ${option} label`)))))))), /* @__PURE__ */ React14.createElement(SettingsValue, {
|
|
911
|
-
label: t("settings show
|
|
957
|
+
label: t("settings show hints label")
|
|
912
958
|
}, /* @__PURE__ */ React14.createElement(Input.Switch, {
|
|
913
|
-
checked: settings.
|
|
914
|
-
onCheckedChange: (checked) => settings.
|
|
959
|
+
checked: settings.showHints,
|
|
960
|
+
onCheckedChange: (checked) => settings.showHints = checked
|
|
915
961
|
})), !isSocket && /* @__PURE__ */ React14.createElement(SettingsValue, {
|
|
916
962
|
label: t("settings native redirect label")
|
|
917
963
|
}, /* @__PURE__ */ React14.createElement(Input.Switch, {
|
|
918
964
|
checked: settings.enableNativeRedirect,
|
|
919
|
-
onCheckedChange: (checked) => settings.enableNativeRedirect =
|
|
965
|
+
onCheckedChange: (checked) => settings.enableNativeRedirect = checked
|
|
920
966
|
})), /* @__PURE__ */ React14.createElement(SettingsValue, {
|
|
921
967
|
label: t("settings custom slots")
|
|
922
968
|
}, /* @__PURE__ */ React14.createElement(Input.Switch, {
|
|
923
969
|
checked: settings.customSlots,
|
|
924
|
-
onCheckedChange: (checked) => settings.customSlots =
|
|
970
|
+
onCheckedChange: (checked) => settings.customSlots = checked
|
|
925
971
|
})), /* @__PURE__ */ React14.createElement(SettingsValue, {
|
|
926
972
|
label: t("settings flat deck")
|
|
927
973
|
}, /* @__PURE__ */ React14.createElement(Input.Switch, {
|
|
928
974
|
checked: settings.flatDeck,
|
|
929
|
-
onCheckedChange: (checked) => settings.flatDeck =
|
|
975
|
+
onCheckedChange: (checked) => settings.flatDeck = checked
|
|
930
976
|
})));
|
|
931
977
|
};
|
|
932
978
|
|
|
933
979
|
// packages/plugins/plugin-deck/src/layout.ts
|
|
934
980
|
import { produce } from "immer";
|
|
935
|
-
import { SLUG_ENTRY_SEPARATOR, SLUG_KEY_VALUE_SEPARATOR, SLUG_LIST_SEPARATOR, SLUG_PATH_SEPARATOR as
|
|
981
|
+
import { SLUG_ENTRY_SEPARATOR, SLUG_KEY_VALUE_SEPARATOR, SLUG_LIST_SEPARATOR, SLUG_PATH_SEPARATOR as SLUG_PATH_SEPARATOR3 } from "@dxos/app-framework";
|
|
936
982
|
var partsThatSupportIncrement = [
|
|
937
983
|
"main"
|
|
938
984
|
];
|
|
@@ -1045,7 +1091,7 @@ var mergeLayoutParts = (...layoutParts) => {
|
|
|
1045
1091
|
}), {});
|
|
1046
1092
|
};
|
|
1047
1093
|
var parseLayoutEntry = (itemString) => {
|
|
1048
|
-
const [id, path] = itemString.split(
|
|
1094
|
+
const [id, path] = itemString.split(SLUG_PATH_SEPARATOR3);
|
|
1049
1095
|
const entry = {
|
|
1050
1096
|
id
|
|
1051
1097
|
};
|
|
@@ -1072,7 +1118,7 @@ var soloPartToUri = (layout) => {
|
|
|
1072
1118
|
return "";
|
|
1073
1119
|
}
|
|
1074
1120
|
const entry = soloPart[0];
|
|
1075
|
-
return `${entry.id}${entry.path ?
|
|
1121
|
+
return `${entry.id}${entry.path ? SLUG_PATH_SEPARATOR3 + entry.path : ""}`;
|
|
1076
1122
|
};
|
|
1077
1123
|
|
|
1078
1124
|
// packages/plugins/plugin-deck/src/translations.ts
|
|
@@ -1088,7 +1134,7 @@ var translations_default = [
|
|
|
1088
1134
|
"content fallback message": "Unsupported",
|
|
1089
1135
|
"content fallback description": "No plugin had a response for the address you navigated\xA0to. Double-check the URL, and ensure you\u2019ve enabled a plugin that supports the\xA0object.",
|
|
1090
1136
|
"toggle fullscreen label": "Toggle fullscreen",
|
|
1091
|
-
"settings show
|
|
1137
|
+
"settings show hints label": "Show hints",
|
|
1092
1138
|
"settings native redirect label": "Enable native url redirect (experimental)",
|
|
1093
1139
|
"settings custom slots": "Theme option (experimental)",
|
|
1094
1140
|
"settings new plank position start label": "Start",
|
|
@@ -1112,7 +1158,9 @@ var translations_default = [
|
|
|
1112
1158
|
"select overscroll placeholder": "Select plank overscrolling behavior",
|
|
1113
1159
|
"settings overscroll centering label": "Centering",
|
|
1114
1160
|
"settings overscroll none label": "None",
|
|
1115
|
-
"settings flat deck": "Flatten deck appearance"
|
|
1161
|
+
"settings flat deck": "Flatten deck appearance",
|
|
1162
|
+
"comments label": "Show Comments",
|
|
1163
|
+
"settings label": "Show Settings"
|
|
1116
1164
|
}
|
|
1117
1165
|
}
|
|
1118
1166
|
}
|
|
@@ -1142,7 +1190,7 @@ var DeckPlugin = ({ observability } = {}) => {
|
|
|
1142
1190
|
let currentUndoId;
|
|
1143
1191
|
let handleNavigation;
|
|
1144
1192
|
const settings = new LocalStorageStore("dxos.org/settings/layout", {
|
|
1145
|
-
|
|
1193
|
+
showHints: true,
|
|
1146
1194
|
customSlots: false,
|
|
1147
1195
|
flatDeck: false,
|
|
1148
1196
|
enableNativeRedirect: false,
|
|
@@ -1227,6 +1275,22 @@ var DeckPlugin = ({ observability } = {}) => {
|
|
|
1227
1275
|
}
|
|
1228
1276
|
}
|
|
1229
1277
|
};
|
|
1278
|
+
const handleSetLocation = (next) => {
|
|
1279
|
+
if (attentionPlugin) {
|
|
1280
|
+
const attended = attentionPlugin.provides.attention.attended;
|
|
1281
|
+
const [attendedId] = Array.from(attended);
|
|
1282
|
+
const ids = (layout.values.layoutMode === "deck" ? next.main : next.solo)?.map(({ id }) => id) ?? [];
|
|
1283
|
+
const isAttendedAvailable = !!attendedId && ids.includes(attendedId);
|
|
1284
|
+
if (!isAttendedAvailable) {
|
|
1285
|
+
requestAnimationFrame(() => {
|
|
1286
|
+
const nextAttended = layout.values.layoutMode === "solo" ? next.solo?.[0].id : next.main?.[0]?.id;
|
|
1287
|
+
const article = document.querySelector(`article[data-attendable-id="${nextAttended}"]`);
|
|
1288
|
+
article?.focus();
|
|
1289
|
+
});
|
|
1290
|
+
}
|
|
1291
|
+
}
|
|
1292
|
+
location.values.active = next;
|
|
1293
|
+
};
|
|
1230
1294
|
return {
|
|
1231
1295
|
meta: meta_default,
|
|
1232
1296
|
ready: async (plugins) => {
|
|
@@ -1267,8 +1331,8 @@ var DeckPlugin = ({ observability } = {}) => {
|
|
|
1267
1331
|
deck.expunge();
|
|
1268
1332
|
}));
|
|
1269
1333
|
settings.prop({
|
|
1270
|
-
key: "
|
|
1271
|
-
storageKey: "show-
|
|
1334
|
+
key: "showHints",
|
|
1335
|
+
storageKey: "show-hints",
|
|
1272
1336
|
type: LocalStorageStore.bool()
|
|
1273
1337
|
}).prop({
|
|
1274
1338
|
key: "customSlots",
|
|
@@ -1301,13 +1365,13 @@ var DeckPlugin = ({ observability } = {}) => {
|
|
|
1301
1365
|
handleNavigation = async () => {
|
|
1302
1366
|
const pathname = window.location.pathname;
|
|
1303
1367
|
if (pathname === "/reset") {
|
|
1304
|
-
|
|
1368
|
+
handleSetLocation({
|
|
1305
1369
|
sidebar: [
|
|
1306
1370
|
{
|
|
1307
1371
|
id: NAV_ID
|
|
1308
1372
|
}
|
|
1309
1373
|
]
|
|
1310
|
-
};
|
|
1374
|
+
});
|
|
1311
1375
|
location.values.closed = [];
|
|
1312
1376
|
layout.values.layoutMode = "solo";
|
|
1313
1377
|
window.location.pathname = "/";
|
|
@@ -1318,26 +1382,16 @@ var DeckPlugin = ({ observability } = {}) => {
|
|
|
1318
1382
|
return;
|
|
1319
1383
|
}
|
|
1320
1384
|
const startingLayout = removePart(location.values.active, "solo");
|
|
1321
|
-
|
|
1385
|
+
handleSetLocation(mergeLayoutParts(layoutFromUri, startingLayout));
|
|
1322
1386
|
layout.values.layoutMode = "solo";
|
|
1323
1387
|
};
|
|
1324
1388
|
await handleNavigation();
|
|
1325
1389
|
window.addEventListener("popstate", handleNavigation);
|
|
1326
|
-
unsubscriptionCallbacks.push(
|
|
1327
|
-
|
|
1390
|
+
unsubscriptionCallbacks.push(scheduledEffect(() => ({
|
|
1391
|
+
selectedPath: soloPartToUri(location.values.active)
|
|
1392
|
+
}), ({ selectedPath }) => {
|
|
1328
1393
|
history.pushState(null, "", `/${selectedPath}${window.location.search}`);
|
|
1329
1394
|
}));
|
|
1330
|
-
unsubscriptionCallbacks.push(effect(() => {
|
|
1331
|
-
const soloId = location.values.active.solo?.[0].id;
|
|
1332
|
-
if (layout.values.layoutMode === "solo" && soloId && layout.values.scrollIntoView !== soloId) {
|
|
1333
|
-
void intentPlugin?.provides.intent.dispatch({
|
|
1334
|
-
action: LayoutAction3.SCROLL_INTO_VIEW,
|
|
1335
|
-
data: {
|
|
1336
|
-
id: soloId
|
|
1337
|
-
}
|
|
1338
|
-
});
|
|
1339
|
-
}
|
|
1340
|
-
}));
|
|
1341
1395
|
layoutModeHistory.values.push(`${layout.values.layoutMode}`);
|
|
1342
1396
|
},
|
|
1343
1397
|
unload: async () => {
|
|
@@ -1380,8 +1434,7 @@ var DeckPlugin = ({ observability } = {}) => {
|
|
|
1380
1434
|
ns: DECK_PLUGIN
|
|
1381
1435
|
}
|
|
1382
1436
|
],
|
|
1383
|
-
icon:
|
|
1384
|
-
iconSymbol: "ph--arrows-out--regular",
|
|
1437
|
+
icon: "ph--arrows-out--regular",
|
|
1385
1438
|
keyBinding: {
|
|
1386
1439
|
macos: "ctrl+meta+f",
|
|
1387
1440
|
windows: "shift+ctrl+f"
|
|
@@ -1398,12 +1451,9 @@ var DeckPlugin = ({ observability } = {}) => {
|
|
|
1398
1451
|
value: deck.values
|
|
1399
1452
|
}, props.children)),
|
|
1400
1453
|
root: () => {
|
|
1401
|
-
return /* @__PURE__ */ React15.createElement(
|
|
1402
|
-
attention: attentionPlugin?.provides.attention ?? {
|
|
1403
|
-
attended: /* @__PURE__ */ new Set()
|
|
1404
|
-
},
|
|
1454
|
+
return /* @__PURE__ */ React15.createElement(DeckLayout, {
|
|
1405
1455
|
layoutParts: location.values.active,
|
|
1406
|
-
|
|
1456
|
+
showHints: settings.values.showHints,
|
|
1407
1457
|
overscroll: settings.values.overscroll,
|
|
1408
1458
|
flatDeck: settings.values.flatDeck,
|
|
1409
1459
|
slots: settings.values.customSlots ? customSlots : void 0,
|
|
@@ -1419,7 +1469,7 @@ var DeckPlugin = ({ observability } = {}) => {
|
|
|
1419
1469
|
}, 1e3);
|
|
1420
1470
|
}
|
|
1421
1471
|
}
|
|
1422
|
-
})
|
|
1472
|
+
});
|
|
1423
1473
|
},
|
|
1424
1474
|
surface: {
|
|
1425
1475
|
component: ({ data, role }) => {
|
|
@@ -1455,7 +1505,7 @@ var DeckPlugin = ({ observability } = {}) => {
|
|
|
1455
1505
|
} else {
|
|
1456
1506
|
log.warn("Invalid layout mode", intent?.data?.layoutMode, {
|
|
1457
1507
|
F: __dxlog_file,
|
|
1458
|
-
L:
|
|
1508
|
+
L: 404,
|
|
1459
1509
|
S: void 0,
|
|
1460
1510
|
C: (f, a) => f(...a)
|
|
1461
1511
|
});
|
|
@@ -1501,7 +1551,7 @@ var DeckPlugin = ({ observability } = {}) => {
|
|
|
1501
1551
|
data: true
|
|
1502
1552
|
};
|
|
1503
1553
|
}
|
|
1504
|
-
case
|
|
1554
|
+
case NavigationAction4.OPEN: {
|
|
1505
1555
|
const previouslyOpenIds = new Set(openIds2(location.values.active));
|
|
1506
1556
|
const layoutMode = layout.values.layoutMode;
|
|
1507
1557
|
batch(() => {
|
|
@@ -1510,7 +1560,7 @@ var DeckPlugin = ({ observability } = {}) => {
|
|
|
1510
1560
|
}
|
|
1511
1561
|
const processLayoutEntry = (partName, entryString, currentLayout) => {
|
|
1512
1562
|
const toggle = true;
|
|
1513
|
-
const [id, path] = entryString.split(
|
|
1563
|
+
const [id, path] = entryString.split(SLUG_PATH_SEPARATOR4);
|
|
1514
1564
|
const layoutEntry = {
|
|
1515
1565
|
id,
|
|
1516
1566
|
...path ? {
|
|
@@ -1539,7 +1589,7 @@ var DeckPlugin = ({ observability } = {}) => {
|
|
|
1539
1589
|
newLayout = processLayoutEntry(partName, layoutEntries, newLayout);
|
|
1540
1590
|
}
|
|
1541
1591
|
});
|
|
1542
|
-
|
|
1592
|
+
handleSetLocation(newLayout);
|
|
1543
1593
|
});
|
|
1544
1594
|
const ids = openIds2(location.values.active);
|
|
1545
1595
|
const newlyOpen = ids.filter((i) => !previouslyOpenIds.has(i));
|
|
@@ -1558,7 +1608,7 @@ var DeckPlugin = ({ observability } = {}) => {
|
|
|
1558
1608
|
] : [],
|
|
1559
1609
|
intent.data?.object ? [
|
|
1560
1610
|
{
|
|
1561
|
-
action:
|
|
1611
|
+
action: NavigationAction4.EXPOSE,
|
|
1562
1612
|
data: {
|
|
1563
1613
|
id: fullyQualifiedId(intent.data.object)
|
|
1564
1614
|
}
|
|
@@ -1581,16 +1631,16 @@ var DeckPlugin = ({ observability } = {}) => {
|
|
|
1581
1631
|
]
|
|
1582
1632
|
};
|
|
1583
1633
|
}
|
|
1584
|
-
case
|
|
1634
|
+
case NavigationAction4.ADD_TO_ACTIVE: {
|
|
1585
1635
|
const data = intent.data;
|
|
1586
1636
|
const layoutEntry = {
|
|
1587
1637
|
id: data.id
|
|
1588
1638
|
};
|
|
1589
1639
|
const effectivePart = getEffectivePart(data.part, layout.values.layoutMode);
|
|
1590
|
-
|
|
1640
|
+
handleSetLocation(openEntry(location.values.active, effectivePart, layoutEntry, {
|
|
1591
1641
|
positioning: data.positioning ?? settings.values.newPlankPositioning,
|
|
1592
1642
|
pivotId: data.pivotId
|
|
1593
|
-
});
|
|
1643
|
+
}));
|
|
1594
1644
|
const intents = [];
|
|
1595
1645
|
if (data.scrollIntoView && layout.values.layoutMode === "deck") {
|
|
1596
1646
|
intents.push([
|
|
@@ -1607,7 +1657,7 @@ var DeckPlugin = ({ observability } = {}) => {
|
|
|
1607
1657
|
intents
|
|
1608
1658
|
};
|
|
1609
1659
|
}
|
|
1610
|
-
case
|
|
1660
|
+
case NavigationAction4.CLOSE: {
|
|
1611
1661
|
return batch(() => {
|
|
1612
1662
|
if (!intent.data) {
|
|
1613
1663
|
return;
|
|
@@ -1632,32 +1682,32 @@ var DeckPlugin = ({ observability } = {}) => {
|
|
|
1632
1682
|
});
|
|
1633
1683
|
}
|
|
1634
1684
|
});
|
|
1635
|
-
|
|
1685
|
+
handleSetLocation(newLayout);
|
|
1636
1686
|
return {
|
|
1637
1687
|
data: true
|
|
1638
1688
|
};
|
|
1639
1689
|
});
|
|
1640
1690
|
}
|
|
1641
1691
|
// TODO(wittjosiah): Factor out.
|
|
1642
|
-
case
|
|
1692
|
+
case NavigationAction4.SET: {
|
|
1643
1693
|
return batch(() => {
|
|
1644
1694
|
if (isLayoutParts(intent.data?.activeParts)) {
|
|
1645
|
-
|
|
1695
|
+
handleSetLocation(intent.data.activeParts);
|
|
1646
1696
|
}
|
|
1647
1697
|
return {
|
|
1648
1698
|
data: true
|
|
1649
1699
|
};
|
|
1650
1700
|
});
|
|
1651
1701
|
}
|
|
1652
|
-
case
|
|
1702
|
+
case NavigationAction4.ADJUST: {
|
|
1653
1703
|
return batch(() => {
|
|
1654
1704
|
if (isLayoutAdjustment(intent.data)) {
|
|
1655
1705
|
const adjustment = intent.data;
|
|
1656
1706
|
if (adjustment.type === "increment-end" || adjustment.type === "increment-start") {
|
|
1657
|
-
|
|
1707
|
+
handleSetLocation(incrementPlank(location.values.active, {
|
|
1658
1708
|
type: adjustment.type,
|
|
1659
1709
|
layoutCoordinate: adjustment.layoutCoordinate
|
|
1660
|
-
});
|
|
1710
|
+
}));
|
|
1661
1711
|
}
|
|
1662
1712
|
if (adjustment.type === "solo") {
|
|
1663
1713
|
const entryId = adjustment.layoutCoordinate.entryId;
|
|
@@ -1673,7 +1723,7 @@ var DeckPlugin = ({ observability } = {}) => {
|
|
|
1673
1723
|
}
|
|
1674
1724
|
},
|
|
1675
1725
|
{
|
|
1676
|
-
action:
|
|
1726
|
+
action: NavigationAction4.OPEN,
|
|
1677
1727
|
data: {
|
|
1678
1728
|
activeParts: {
|
|
1679
1729
|
solo: [
|
|
@@ -1697,7 +1747,7 @@ var DeckPlugin = ({ observability } = {}) => {
|
|
|
1697
1747
|
}
|
|
1698
1748
|
},
|
|
1699
1749
|
{
|
|
1700
|
-
action:
|
|
1750
|
+
action: NavigationAction4.CLOSE,
|
|
1701
1751
|
data: {
|
|
1702
1752
|
activeParts: {
|
|
1703
1753
|
solo: [
|
|
@@ -1707,7 +1757,7 @@ var DeckPlugin = ({ observability } = {}) => {
|
|
|
1707
1757
|
}
|
|
1708
1758
|
},
|
|
1709
1759
|
{
|
|
1710
|
-
action:
|
|
1760
|
+
action: NavigationAction4.OPEN,
|
|
1711
1761
|
data: {
|
|
1712
1762
|
noToggle: true,
|
|
1713
1763
|
activeParts: {
|