@dxos/plugin-deck 0.6.13-main.ed424a1 → 0.6.13-staging.1e988a3
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-GVOGPULO.mjs → chunk-YVHGFQQR.mjs} +1 -1
- package/dist/lib/browser/chunk-YVHGFQQR.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +184 -239
- 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 +4 -3
- package/dist/types/src/components/DeckLayout/DeckLayout.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/NodePlankHeading.d.ts +3 -4
- package/dist/types/src/components/DeckLayout/NodePlankHeading.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/Sidebar.d.ts +3 -2
- package/dist/types/src/components/DeckLayout/Sidebar.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/StatusBar.d.ts +1 -3
- 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 +1 -3
- 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/dist/types/src/util/overscroll.d.ts +1 -1
- package/dist/types/src/util/overscroll.d.ts.map +1 -1
- package/package.json +29 -30
- package/src/DeckPlugin.tsx +71 -93
- package/src/components/DeckLayout/ComplementarySidebar.tsx +27 -72
- package/src/components/DeckLayout/DeckLayout.tsx +84 -63
- package/src/components/DeckLayout/NodePlankHeading.tsx +15 -15
- package/src/components/DeckLayout/Plank.tsx +3 -3
- package/src/components/DeckLayout/Sidebar.tsx +5 -6
- package/src/components/DeckLayout/StatusBar.tsx +3 -12
- package/src/components/LayoutSettings.tsx +8 -5
- package/src/hooks/useNode.ts +1 -5
- package/src/layout.ts +0 -1
- package/src/meta.ts +1 -3
- package/src/translations.ts +1 -3
- package/src/types.ts +1 -1
- package/src/util/overscroll.ts +5 -5
- package/dist/lib/browser/chunk-GVOGPULO.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-YVHGFQQR.mjs";
|
|
5
5
|
|
|
6
6
|
// packages/plugins/plugin-deck/src/DeckPlugin.tsx
|
|
7
|
-
import {
|
|
7
|
+
import { ArrowsOut } from "@phosphor-icons/react";
|
|
8
|
+
import { batch, effect } from "@preact/signals-core";
|
|
8
9
|
import { setAutoFreeze } from "immer";
|
|
9
10
|
import React15 from "react";
|
|
10
|
-
import { IntentAction, LayoutAction as LayoutAction3, NavigationAction as
|
|
11
|
+
import { IntentAction, LayoutAction as LayoutAction3, NavigationAction as NavigationAction3, parseGraphPlugin, parseIntentPlugin, resolvePlugin, Toast as ToastSchema, SLUG_PATH_SEPARATOR as SLUG_PATH_SEPARATOR5, isLayoutParts, isLayoutAdjustment, isLayoutMode, openIds as openIds2 } from "@dxos/app-framework";
|
|
11
12
|
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,6 +18,7 @@ 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";
|
|
21
22
|
|
|
22
23
|
// packages/plugins/plugin-deck/src/components/DeckLayout/constants.ts
|
|
23
24
|
var NAV_ID = "NavTree";
|
|
@@ -25,12 +26,11 @@ var SURFACE_PREFIX = "surface:";
|
|
|
25
26
|
|
|
26
27
|
// packages/plugins/plugin-deck/src/components/DeckLayout/DeckLayout.tsx
|
|
27
28
|
import { Sidebar as MenuIcon } from "@phosphor-icons/react";
|
|
28
|
-
import React13, { useCallback as useCallback2, useEffect as useEffect5, useMemo as
|
|
29
|
-
import { Surface as Surface9, firstIdInPart, usePlugin } from "@dxos/app-framework";
|
|
30
|
-
import { Button as Button3, Dialog, Main as Main3, Popover as Popover2,
|
|
31
|
-
import { useAttended as useAttended3 } from "@dxos/react-ui-attention";
|
|
29
|
+
import React13, { useCallback as useCallback2, useEffect as useEffect5, useMemo as useMemo2, useRef as useRef2, useState as useState3, useLayoutEffect as useLayoutEffect2 } from "react";
|
|
30
|
+
import { SLUG_PATH_SEPARATOR as SLUG_PATH_SEPARATOR3, Surface as Surface9, firstIdInPart, usePlugin } from "@dxos/app-framework";
|
|
31
|
+
import { Button as Button3, Dialog, Main as Main3, Popover as Popover2, useTranslation as useTranslation5 } from "@dxos/react-ui";
|
|
32
32
|
import { Deck } from "@dxos/react-ui-deck";
|
|
33
|
-
import { getSize
|
|
33
|
+
import { getSize } from "@dxos/react-ui-theme";
|
|
34
34
|
|
|
35
35
|
// packages/plugins/plugin-deck/src/components/DeckLayout/ActiveNode.tsx
|
|
36
36
|
import React from "react";
|
|
@@ -40,11 +40,8 @@ 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
|
|
43
|
+
const [nodeState, setNodeState] = useState(id ? graph.findNode(id) : void 0);
|
|
44
44
|
useEffect(() => {
|
|
45
|
-
if (!id && nodeState) {
|
|
46
|
-
setNodeState(void 0);
|
|
47
|
-
}
|
|
48
45
|
if (nodeState?.id === id || !id) {
|
|
49
46
|
return;
|
|
50
47
|
}
|
|
@@ -116,25 +113,36 @@ var ActiveNode = ({ id }) => {
|
|
|
116
113
|
};
|
|
117
114
|
|
|
118
115
|
// packages/plugins/plugin-deck/src/components/DeckLayout/ComplementarySidebar.tsx
|
|
119
|
-
import React5
|
|
120
|
-
import {
|
|
116
|
+
import React5 from "react";
|
|
117
|
+
import { SLUG_PATH_SEPARATOR as SLUG_PATH_SEPARATOR2, Surface as Surface3 } from "@dxos/app-framework";
|
|
121
118
|
import { useGraph as useGraph3 } from "@dxos/plugin-graph";
|
|
122
119
|
import { Main } from "@dxos/react-ui";
|
|
123
|
-
import {
|
|
120
|
+
import { createAttendableAttributes } from "@dxos/react-ui-attention";
|
|
124
121
|
import { deckGrid } from "@dxos/react-ui-deck";
|
|
125
122
|
import { mx as mx2 } from "@dxos/react-ui-theme";
|
|
126
123
|
|
|
127
124
|
// packages/plugins/plugin-deck/src/components/DeckLayout/NodePlankHeading.tsx
|
|
125
|
+
import { Placeholder } from "@phosphor-icons/react";
|
|
128
126
|
import React2, { Fragment, useEffect as useEffect3 } from "react";
|
|
129
|
-
import { LayoutAction, NavigationAction, SLUG_PATH_SEPARATOR, Surface as Surface2, useIntentDispatcher, indexInPart, partLength } from "@dxos/app-framework";
|
|
127
|
+
import { LayoutAction, NavigationAction, SLUG_COLLECTION_INDICATOR, SLUG_PATH_SEPARATOR, Surface as Surface2, useIntentDispatcher, indexInPart, partLength } from "@dxos/app-framework";
|
|
130
128
|
import { useGraph as useGraph2 } from "@dxos/plugin-graph";
|
|
131
|
-
import {
|
|
132
|
-
import { PlankHeading } from "@dxos/react-ui-deck";
|
|
129
|
+
import { Popover, toLocalizedString, useMediaQuery, useTranslation } from "@dxos/react-ui";
|
|
130
|
+
import { PlankHeading, plankHeadingIconProps } from "@dxos/react-ui-deck";
|
|
133
131
|
import { TextTooltip } from "@dxos/react-ui-text-tooltip";
|
|
134
|
-
var NodePlankHeading = ({
|
|
132
|
+
var NodePlankHeading = ({
|
|
133
|
+
node,
|
|
134
|
+
id,
|
|
135
|
+
layoutParts,
|
|
136
|
+
layoutPart,
|
|
137
|
+
// TODO(wittjosiah): Unused?
|
|
138
|
+
layoutEntry,
|
|
139
|
+
popoverAnchorId,
|
|
140
|
+
pending,
|
|
141
|
+
flatDeck
|
|
142
|
+
}) => {
|
|
135
143
|
const { t } = useTranslation(DECK_PLUGIN);
|
|
136
144
|
const { graph } = useGraph2();
|
|
137
|
-
const
|
|
145
|
+
const Icon = node?.properties?.icon ?? Placeholder;
|
|
138
146
|
const label = pending ? t("pending heading") : toLocalizedString(node?.properties?.label ?? [
|
|
139
147
|
"plank heading fallback label",
|
|
140
148
|
{
|
|
@@ -164,14 +172,10 @@ var NodePlankHeading = ({ node, id, layoutParts, layoutPart, popoverAnchorId, pe
|
|
|
164
172
|
return /* @__PURE__ */ React2.createElement(PlankHeading.Root, (layoutPart !== "main" || !flatDeck) && {
|
|
165
173
|
classNames: "pie-1 border-b border-separator"
|
|
166
174
|
}, /* @__PURE__ */ React2.createElement(ActionRoot, null, node ? /* @__PURE__ */ React2.createElement(PlankHeading.ActionsMenu, {
|
|
167
|
-
|
|
168
|
-
related: layoutPart === "complementary",
|
|
175
|
+
Icon,
|
|
169
176
|
attendableId,
|
|
170
177
|
triggerLabel: t("actions menu label"),
|
|
171
|
-
actions:
|
|
172
|
-
actions,
|
|
173
|
-
graph.actions(node)
|
|
174
|
-
].filter((a) => a.length > 0),
|
|
178
|
+
actions: graph.actions(node),
|
|
175
179
|
onAction: (action) => typeof action.data === "function" && action.data?.({
|
|
176
180
|
node: action,
|
|
177
181
|
caller: DECK_PLUGIN
|
|
@@ -183,15 +187,11 @@ var NodePlankHeading = ({ node, id, layoutParts, layoutPart, popoverAnchorId, pe
|
|
|
183
187
|
}
|
|
184
188
|
})) : /* @__PURE__ */ React2.createElement(PlankHeading.Button, null, /* @__PURE__ */ React2.createElement("span", {
|
|
185
189
|
className: "sr-only"
|
|
186
|
-
}, label), /* @__PURE__ */ React2.createElement(Icon, {
|
|
187
|
-
icon,
|
|
188
|
-
size: 5
|
|
189
|
-
}))), /* @__PURE__ */ React2.createElement(TextTooltip, {
|
|
190
|
+
}, label), /* @__PURE__ */ React2.createElement(Icon, plankHeadingIconProps))), /* @__PURE__ */ React2.createElement(TextTooltip, {
|
|
190
191
|
text: label,
|
|
191
192
|
onlyWhenTruncating: true
|
|
192
193
|
}, /* @__PURE__ */ React2.createElement(PlankHeading.Label, {
|
|
193
|
-
attendableId,
|
|
194
|
-
related: layoutPart === "complementary",
|
|
194
|
+
attendableId: node?.id,
|
|
195
195
|
...pending && {
|
|
196
196
|
classNames: "text-description"
|
|
197
197
|
}
|
|
@@ -237,6 +237,9 @@ var NodePlankHeading = ({ node, id, layoutParts, layoutPart, popoverAnchorId, pe
|
|
|
237
237
|
action: NavigationAction.CLOSE,
|
|
238
238
|
data: {
|
|
239
239
|
activeParts: {
|
|
240
|
+
complementary: [
|
|
241
|
+
`${id}${SLUG_PATH_SEPARATOR}comments${SLUG_COLLECTION_INDICATOR}`
|
|
242
|
+
],
|
|
240
243
|
[layoutPart]: [
|
|
241
244
|
id
|
|
242
245
|
]
|
|
@@ -250,7 +253,7 @@ var NodePlankHeading = ({ node, id, layoutParts, layoutPart, popoverAnchorId, pe
|
|
|
250
253
|
}
|
|
251
254
|
});
|
|
252
255
|
},
|
|
253
|
-
close:
|
|
256
|
+
close: layoutCoordinate?.part === "complementary" ? "minify-end" : true
|
|
254
257
|
}));
|
|
255
258
|
};
|
|
256
259
|
|
|
@@ -311,68 +314,13 @@ var LayoutContext = createContext(null);
|
|
|
311
314
|
var useLayout = () => useContext(LayoutContext) ?? raise(new Error("Missing LayoutContext"));
|
|
312
315
|
|
|
313
316
|
// packages/plugins/plugin-deck/src/components/DeckLayout/ComplementarySidebar.tsx
|
|
314
|
-
var
|
|
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 }) => {
|
|
317
|
+
var ComplementarySidebar = ({ id, layoutParts, flatDeck }) => {
|
|
341
318
|
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;
|
|
345
319
|
const { graph } = useGraph3();
|
|
346
320
|
const node = useNode(graph, id);
|
|
347
|
-
const
|
|
321
|
+
const complementaryAttrs = createAttendableAttributes(id?.split(SLUG_PATH_SEPARATOR2)[0] ?? "never");
|
|
348
322
|
useNodeActionExpander(node);
|
|
349
|
-
|
|
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", {
|
|
323
|
+
return /* @__PURE__ */ React5.createElement(Main.ComplementarySidebar, complementaryAttrs, node ? /* @__PURE__ */ React5.createElement("div", {
|
|
376
324
|
role: "none",
|
|
377
325
|
className: mx2(deckGrid, "grid-cols-1 bs-full")
|
|
378
326
|
}, /* @__PURE__ */ React5.createElement(NodePlankHeading, {
|
|
@@ -381,19 +329,18 @@ var ComplementarySidebar = ({ layoutParts, flatDeck }) => {
|
|
|
381
329
|
layoutParts,
|
|
382
330
|
layoutPart: "complementary",
|
|
383
331
|
popoverAnchorId,
|
|
384
|
-
flatDeck
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
className: "row-span-2"
|
|
388
|
-
}, node && /* @__PURE__ */ React5.createElement(Surface3, {
|
|
389
|
-
role: `complementary--${part}`,
|
|
332
|
+
flatDeck
|
|
333
|
+
}), /* @__PURE__ */ React5.createElement(Surface3, {
|
|
334
|
+
role: "article",
|
|
390
335
|
data: {
|
|
391
|
-
subject: node.
|
|
336
|
+
subject: node.data,
|
|
337
|
+
part: "complementary",
|
|
392
338
|
popoverAnchorId
|
|
393
339
|
},
|
|
340
|
+
limit: 1,
|
|
394
341
|
fallback: PlankContentError,
|
|
395
342
|
placeholder: /* @__PURE__ */ React5.createElement(PlankLoading, null)
|
|
396
|
-
})))
|
|
343
|
+
})) : null);
|
|
397
344
|
};
|
|
398
345
|
|
|
399
346
|
// packages/plugins/plugin-deck/src/components/DeckLayout/ContentEmpty.tsx
|
|
@@ -454,11 +401,11 @@ var Fullscreen = ({ id }) => {
|
|
|
454
401
|
// packages/plugins/plugin-deck/src/components/DeckLayout/Plank.tsx
|
|
455
402
|
import { Plus } from "@phosphor-icons/react";
|
|
456
403
|
import React9, { useCallback, useLayoutEffect, useRef } from "react";
|
|
457
|
-
import { LayoutAction as LayoutAction2, NavigationAction as
|
|
404
|
+
import { LayoutAction as LayoutAction2, NavigationAction as NavigationAction2, Surface as Surface6, useIntentDispatcher as useIntentDispatcher2 } from "@dxos/app-framework";
|
|
458
405
|
import { debounce } from "@dxos/async";
|
|
459
406
|
import { useGraph as useGraph5 } from "@dxos/plugin-graph";
|
|
460
407
|
import { Button, Tooltip, useTranslation as useTranslation4 } from "@dxos/react-ui";
|
|
461
|
-
import {
|
|
408
|
+
import { createAttendableAttributes as createAttendableAttributes2 } from "@dxos/react-ui-attention";
|
|
462
409
|
import { Plank as NaturalPlank } from "@dxos/react-ui-deck";
|
|
463
410
|
import { mainIntrinsicSize } from "@dxos/react-ui-theme";
|
|
464
411
|
|
|
@@ -471,14 +418,14 @@ var useDeckContext = () => useContext2(DeckContext) ?? raise2(new Error("Missing
|
|
|
471
418
|
// packages/plugins/plugin-deck/src/components/DeckLayout/Plank.tsx
|
|
472
419
|
var Plank = ({ entry, layoutParts, part, flatDeck, searchEnabled, layoutMode }) => {
|
|
473
420
|
const { t } = useTranslation4(DECK_PLUGIN);
|
|
474
|
-
const dispatch =
|
|
421
|
+
const dispatch = useIntentDispatcher2();
|
|
475
422
|
const { popoverAnchorId, scrollIntoView } = useLayout();
|
|
476
423
|
const { plankSizing } = useDeckContext();
|
|
477
424
|
const { graph } = useGraph5();
|
|
478
425
|
const node = useNode(graph, entry.id);
|
|
479
426
|
const rootElement = useRef(null);
|
|
480
427
|
const resizeable = layoutMode === "deck";
|
|
481
|
-
const attendableAttrs =
|
|
428
|
+
const attendableAttrs = createAttendableAttributes2(entry.id);
|
|
482
429
|
const coordinate = {
|
|
483
430
|
part,
|
|
484
431
|
entryId: entry.id
|
|
@@ -516,7 +463,7 @@ var Plank = ({ entry, layoutParts, part, flatDeck, searchEnabled, layoutMode })
|
|
|
516
463
|
layoutMode
|
|
517
464
|
]);
|
|
518
465
|
const isSolo = layoutMode === "solo" && part === "solo";
|
|
519
|
-
const isSuppressed = layoutMode === "solo" && part !== "solo"
|
|
466
|
+
const isSuppressed = layoutMode === "solo" && part !== "solo";
|
|
520
467
|
const sizeAttrs = useMainSize();
|
|
521
468
|
return /* @__PURE__ */ React9.createElement(NaturalPlank.Root, {
|
|
522
469
|
size,
|
|
@@ -582,7 +529,7 @@ var Plank = ({ entry, layoutParts, part, flatDeck, searchEnabled, layoutMode })
|
|
|
582
529
|
component: "dxos.org/plugin/search/Dialog",
|
|
583
530
|
dialogBlockAlign: "start",
|
|
584
531
|
subject: {
|
|
585
|
-
action:
|
|
532
|
+
action: NavigationAction2.SET,
|
|
586
533
|
position: "add-after",
|
|
587
534
|
coordinate
|
|
588
535
|
}
|
|
@@ -602,14 +549,12 @@ var Plank = ({ entry, layoutParts, part, flatDeck, searchEnabled, layoutMode })
|
|
|
602
549
|
};
|
|
603
550
|
|
|
604
551
|
// packages/plugins/plugin-deck/src/components/DeckLayout/Sidebar.tsx
|
|
605
|
-
import React10, { useMemo
|
|
552
|
+
import React10, { useMemo } from "react";
|
|
606
553
|
import { openIds, Surface as Surface7 } from "@dxos/app-framework";
|
|
607
554
|
import { Main as Main2 } from "@dxos/react-ui";
|
|
608
|
-
|
|
609
|
-
var Sidebar = ({ layoutParts }) => {
|
|
555
|
+
var Sidebar = ({ attention, layoutParts }) => {
|
|
610
556
|
const { layoutMode, popoverAnchorId } = useLayout();
|
|
611
|
-
const
|
|
612
|
-
const activeIds = useMemo2(() => {
|
|
557
|
+
const activeIds = useMemo(() => {
|
|
613
558
|
if (layoutMode === "solo") {
|
|
614
559
|
return new Set(layoutParts?.solo?.map((e) => e.id) ?? []);
|
|
615
560
|
} else if (layoutMode === "deck") {
|
|
@@ -620,14 +565,14 @@ var Sidebar = ({ layoutParts }) => {
|
|
|
620
565
|
layoutParts,
|
|
621
566
|
layoutMode
|
|
622
567
|
]);
|
|
623
|
-
const navigationData =
|
|
568
|
+
const navigationData = useMemo(() => ({
|
|
624
569
|
popoverAnchorId,
|
|
625
570
|
activeIds,
|
|
626
|
-
attended
|
|
571
|
+
attended: attention.attended
|
|
627
572
|
}), [
|
|
628
573
|
popoverAnchorId,
|
|
629
574
|
activeIds,
|
|
630
|
-
attended
|
|
575
|
+
attention.attended
|
|
631
576
|
]);
|
|
632
577
|
return /* @__PURE__ */ React10.createElement(Main2.NavigationSidebar, null, /* @__PURE__ */ React10.createElement(Surface7, {
|
|
633
578
|
role: "navigation",
|
|
@@ -641,19 +586,14 @@ var Sidebar = ({ layoutParts }) => {
|
|
|
641
586
|
// packages/plugins/plugin-deck/src/components/DeckLayout/StatusBar.tsx
|
|
642
587
|
import React11 from "react";
|
|
643
588
|
import { Surface as Surface8 } from "@dxos/app-framework";
|
|
644
|
-
import { mainPadding,
|
|
645
|
-
var StatusBar = (
|
|
589
|
+
import { mainPadding, mx as mx4 } from "@dxos/react-ui-theme";
|
|
590
|
+
var StatusBar = () => {
|
|
646
591
|
const sizeAttrs = useMainSize();
|
|
647
592
|
return /* @__PURE__ */ React11.createElement("div", {
|
|
648
593
|
role: "none",
|
|
649
594
|
...sizeAttrs,
|
|
650
|
-
className: mx4("fixed
|
|
651
|
-
}, /* @__PURE__ */ React11.createElement(
|
|
652
|
-
role: "none"
|
|
653
|
-
}, showHints && /* @__PURE__ */ React11.createElement(Surface8, {
|
|
654
|
-
role: "hints",
|
|
655
|
-
limit: 1
|
|
656
|
-
})), /* @__PURE__ */ React11.createElement(Surface8, {
|
|
595
|
+
className: mx4("fixed block-end-0 inset-inline-0 z-[2]", mainPadding)
|
|
596
|
+
}, /* @__PURE__ */ React11.createElement(Surface8, {
|
|
657
597
|
role: "status-bar",
|
|
658
598
|
limit: 1
|
|
659
599
|
}));
|
|
@@ -706,10 +646,7 @@ var getEffectivePart = (partName, layoutMode) => layoutMode === "solo" && partNa
|
|
|
706
646
|
import { PLANK_DEFAULTS } from "@dxos/react-ui-deck";
|
|
707
647
|
var calculateOverscroll = (planks, plankSizing, sidebarOpen, complementarySidebarOpen) => {
|
|
708
648
|
if (!planks?.length) {
|
|
709
|
-
return
|
|
710
|
-
paddingInlineStart: 0,
|
|
711
|
-
paddingInlineEnd: 0
|
|
712
|
-
};
|
|
649
|
+
return;
|
|
713
650
|
}
|
|
714
651
|
const sidebarWidth = sidebarOpen ? "270px" : "0px";
|
|
715
652
|
const complementarySidebarWidth = complementarySidebarOpen ? "360px" : "0px";
|
|
@@ -719,8 +656,8 @@ var calculateOverscroll = (planks, plankSizing, sidebarOpen, complementarySideba
|
|
|
719
656
|
const plankSize = getPlankSize(plank.id);
|
|
720
657
|
const overscrollPadding = `max(0px, calc(((100dvw - ${sidebarWidth} - ${complementarySidebarWidth} - (${plankSize} + 20px)) / 2)))`;
|
|
721
658
|
return {
|
|
722
|
-
|
|
723
|
-
|
|
659
|
+
paddingLeft: overscrollPadding,
|
|
660
|
+
paddingRight: overscrollPadding
|
|
724
661
|
};
|
|
725
662
|
} else {
|
|
726
663
|
const first = planks[0];
|
|
@@ -728,33 +665,27 @@ var calculateOverscroll = (planks, plankSizing, sidebarOpen, complementarySideba
|
|
|
728
665
|
const last = planks[planks.length - 1];
|
|
729
666
|
const lastSize = getPlankSize(last.id);
|
|
730
667
|
return {
|
|
731
|
-
|
|
732
|
-
|
|
668
|
+
paddingLeft: `max(0px, calc(((100dvw - (${firstSize} + 20px)) / 2) - ${sidebarWidth}))`,
|
|
669
|
+
paddingRight: `max(0px, calc(((100dvw - (${lastSize} + 20px)) / 2) - ${complementarySidebarWidth}))`
|
|
733
670
|
};
|
|
734
671
|
}
|
|
735
672
|
};
|
|
736
673
|
|
|
737
674
|
// packages/plugins/plugin-deck/src/components/DeckLayout/DeckLayout.tsx
|
|
738
|
-
var DeckLayout = ({ layoutParts, toasts, flatDeck, overscroll,
|
|
675
|
+
var DeckLayout = ({ layoutParts, attention, toasts, flatDeck, overscroll, showHintsFooter, slots, onDismissToast }) => {
|
|
739
676
|
const context = useLayout();
|
|
740
677
|
const { layoutMode, sidebarOpen, complementarySidebarOpen, dialogOpen, dialogContent, dialogBlockAlign, popoverOpen, popoverContent, popoverAnchorId } = context;
|
|
741
678
|
const { t } = useTranslation5(DECK_PLUGIN);
|
|
742
679
|
const { plankSizing } = useDeckContext();
|
|
743
|
-
const attended = useAttended3();
|
|
744
680
|
const searchPlugin = usePlugin("dxos.org/plugin/search");
|
|
745
|
-
const fullScreenSlug =
|
|
681
|
+
const fullScreenSlug = useMemo2(() => firstIdInPart(layoutParts, "fullScreen"), [
|
|
746
682
|
layoutParts
|
|
747
683
|
]);
|
|
748
|
-
const
|
|
684
|
+
const [scrollLeft, setScrollLeft] = useState3(null);
|
|
749
685
|
const deckRef = useRef2(null);
|
|
750
|
-
|
|
751
|
-
const firstId = layoutMode === "solo" ? firstIdInPart(layoutParts, "solo") : firstIdInPart(layoutParts, "main");
|
|
752
|
-
if (attended.length === 0 && firstId) {
|
|
753
|
-
document.querySelector(`article[data-attendable-id="${firstId}"] button`)?.focus();
|
|
754
|
-
}
|
|
755
|
-
}, []);
|
|
686
|
+
const restoreScrollRef = useRef2(false);
|
|
756
687
|
const handleResize = useCallback2(() => {
|
|
757
|
-
|
|
688
|
+
setScrollLeft(null);
|
|
758
689
|
}, []);
|
|
759
690
|
useEffect5(() => {
|
|
760
691
|
window.addEventListener("resize", handleResize);
|
|
@@ -762,20 +693,36 @@ var DeckLayout = ({ layoutParts, toasts, flatDeck, overscroll, showHints, slots,
|
|
|
762
693
|
}, [
|
|
763
694
|
handleResize
|
|
764
695
|
]);
|
|
765
|
-
|
|
766
|
-
if (
|
|
767
|
-
|
|
696
|
+
useLayoutEffect2(() => {
|
|
697
|
+
if (layoutMode !== "deck") {
|
|
698
|
+
restoreScrollRef.current = true;
|
|
699
|
+
} else if (restoreScrollRef.current && deckRef.current && scrollLeft) {
|
|
700
|
+
deckRef.current.scrollLeft = scrollLeft;
|
|
701
|
+
restoreScrollRef.current = false;
|
|
768
702
|
}
|
|
769
|
-
}, [
|
|
770
|
-
|
|
703
|
+
}, [
|
|
704
|
+
layoutMode,
|
|
705
|
+
deckRef.current,
|
|
706
|
+
scrollLeft
|
|
707
|
+
]);
|
|
771
708
|
const handleScroll = useCallback2((event) => {
|
|
772
709
|
if (layoutMode === "deck" && event.currentTarget === event.target) {
|
|
773
|
-
|
|
710
|
+
setScrollLeft(event.target.scrollLeft);
|
|
774
711
|
}
|
|
775
712
|
}, [
|
|
776
713
|
layoutMode
|
|
777
714
|
]);
|
|
778
|
-
const
|
|
715
|
+
const complementarySlug = useMemo2(() => {
|
|
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
|
+
]);
|
|
779
726
|
useEffect5(() => {
|
|
780
727
|
if (layoutMode === "deck" && firstAttendedId) {
|
|
781
728
|
}
|
|
@@ -783,20 +730,21 @@ var DeckLayout = ({ layoutParts, toasts, flatDeck, overscroll, showHints, slots,
|
|
|
783
730
|
layoutMode,
|
|
784
731
|
firstAttendedId
|
|
785
732
|
]);
|
|
786
|
-
const
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
733
|
+
const parts = useMemo2(() => {
|
|
734
|
+
const parts2 = [
|
|
735
|
+
...layoutParts.main ?? []
|
|
736
|
+
];
|
|
737
|
+
for (const part of layoutParts.solo ?? []) {
|
|
738
|
+
if (!parts2.find((entry) => entry.id === part.id)) {
|
|
739
|
+
parts2.push(part);
|
|
740
|
+
}
|
|
790
741
|
}
|
|
791
|
-
return
|
|
742
|
+
return parts2;
|
|
792
743
|
}, [
|
|
793
|
-
layoutMode,
|
|
794
|
-
overscroll,
|
|
795
744
|
layoutParts.main,
|
|
796
|
-
|
|
797
|
-
sidebarOpen,
|
|
798
|
-
complementarySidebarOpen
|
|
745
|
+
layoutParts.solo
|
|
799
746
|
]);
|
|
747
|
+
const padding = layoutMode === "deck" && overscroll === "centering" ? calculateOverscroll(layoutParts.main, plankSizing, sidebarOpen, complementarySidebarOpen) : {};
|
|
800
748
|
if (layoutMode === "fullscreen") {
|
|
801
749
|
return /* @__PURE__ */ React13.createElement(Fullscreen, {
|
|
802
750
|
id: fullScreenSlug
|
|
@@ -818,13 +766,19 @@ var DeckLayout = ({ layoutParts, toasts, flatDeck, overscroll, showHints, slots,
|
|
|
818
766
|
}), /* @__PURE__ */ React13.createElement(Main3.Root, {
|
|
819
767
|
navigationSidebarOpen: context.sidebarOpen,
|
|
820
768
|
onNavigationSidebarOpenChange: (next) => context.sidebarOpen = next,
|
|
821
|
-
complementarySidebarOpen
|
|
822
|
-
|
|
769
|
+
...complementarySidebarOpen !== null && {
|
|
770
|
+
complementarySidebarOpen: (
|
|
771
|
+
/* complementaryAvailable && */
|
|
772
|
+
context.complementarySidebarOpen
|
|
773
|
+
),
|
|
774
|
+
onComplementarySidebarOpenChange: (next) => context.complementarySidebarOpen = next
|
|
775
|
+
}
|
|
823
776
|
}, /* @__PURE__ */ React13.createElement(Main3.Notch, {
|
|
824
777
|
classNames: "z-[21]"
|
|
825
778
|
}, /* @__PURE__ */ React13.createElement(Surface9, {
|
|
826
779
|
role: "notch-start"
|
|
827
780
|
}), /* @__PURE__ */ React13.createElement(Button3, {
|
|
781
|
+
// disabled={!sidebarAvailable}
|
|
828
782
|
onClick: () => context.sidebarOpen = !context.sidebarOpen,
|
|
829
783
|
variant: "ghost",
|
|
830
784
|
classNames: "p-1"
|
|
@@ -834,6 +788,7 @@ var DeckLayout = ({ layoutParts, toasts, flatDeck, overscroll, showHints, slots,
|
|
|
834
788
|
weight: "light",
|
|
835
789
|
className: getSize(5)
|
|
836
790
|
})), /* @__PURE__ */ React13.createElement(Button3, {
|
|
791
|
+
// disabled={!complementaryAvailable}
|
|
837
792
|
onClick: () => context.complementarySidebarOpen = !context.complementarySidebarOpen,
|
|
838
793
|
variant: "ghost",
|
|
839
794
|
classNames: "p-1"
|
|
@@ -846,14 +801,15 @@ var DeckLayout = ({ layoutParts, toasts, flatDeck, overscroll, showHints, slots,
|
|
|
846
801
|
})), /* @__PURE__ */ React13.createElement(Surface9, {
|
|
847
802
|
role: "notch-end"
|
|
848
803
|
})), /* @__PURE__ */ React13.createElement(Sidebar, {
|
|
804
|
+
attention,
|
|
849
805
|
layoutParts
|
|
850
806
|
}), /* @__PURE__ */ React13.createElement(ComplementarySidebar, {
|
|
851
|
-
|
|
807
|
+
id: complementarySlug,
|
|
852
808
|
layoutParts,
|
|
853
809
|
flatDeck
|
|
854
|
-
}), /* @__PURE__ */ React13.createElement(Main3.Overlay, null),
|
|
810
|
+
}), /* @__PURE__ */ React13.createElement(Main3.Overlay, null), parts.length === 0 && /* @__PURE__ */ React13.createElement(Main3.Content, {
|
|
855
811
|
handlesFocus: true
|
|
856
|
-
}, /* @__PURE__ */ React13.createElement(ContentEmpty, null)),
|
|
812
|
+
}, /* @__PURE__ */ React13.createElement(ContentEmpty, null)), parts.length !== 0 && /* @__PURE__ */ React13.createElement(Main3.Content, {
|
|
857
813
|
bounce: true,
|
|
858
814
|
classNames: "grid block-end-[--statusbar-size]",
|
|
859
815
|
handlesFocus: true
|
|
@@ -864,33 +820,26 @@ var DeckLayout = ({ layoutParts, toasts, flatDeck, overscroll, showHints, slots,
|
|
|
864
820
|
style: padding,
|
|
865
821
|
classNames: [
|
|
866
822
|
!flatDeck && "bg-deck",
|
|
867
|
-
mainPaddingTransitions2,
|
|
868
823
|
"absolute inset-0",
|
|
869
824
|
slots?.wallpaper?.classNames
|
|
870
825
|
],
|
|
871
826
|
solo: layoutMode === "solo",
|
|
872
827
|
onScroll: handleScroll,
|
|
873
828
|
ref: deckRef
|
|
874
|
-
}, /* @__PURE__ */ React13.createElement(Plank, {
|
|
875
|
-
entry: layoutParts.solo?.[0] ?? {
|
|
876
|
-
id: "unknown-solo"
|
|
877
|
-
},
|
|
878
|
-
layoutParts,
|
|
879
|
-
part: "solo",
|
|
880
|
-
layoutMode,
|
|
881
|
-
flatDeck,
|
|
882
|
-
searchEnabled: !!searchPlugin
|
|
883
|
-
}), layoutParts.main?.map((layoutEntry) => /* @__PURE__ */ React13.createElement(Plank, {
|
|
829
|
+
}, parts.map((layoutEntry) => /* @__PURE__ */ React13.createElement(Plank, {
|
|
884
830
|
key: layoutEntry.id,
|
|
885
831
|
entry: layoutEntry,
|
|
886
832
|
layoutParts,
|
|
887
|
-
part: "main",
|
|
833
|
+
part: layoutMode === "solo" && layoutEntry.id === layoutParts.solo?.[0]?.id ? "solo" : "main",
|
|
888
834
|
layoutMode,
|
|
889
835
|
flatDeck,
|
|
890
836
|
searchEnabled: !!searchPlugin
|
|
891
|
-
}))))), /* @__PURE__ */ React13.createElement(StatusBar, {
|
|
892
|
-
|
|
893
|
-
}
|
|
837
|
+
}))))), /* @__PURE__ */ React13.createElement(StatusBar, null), showHintsFooter && /* @__PURE__ */ React13.createElement("div", {
|
|
838
|
+
className: "fixed bottom-0 left-0 right-0 h-[32px] z-[1] flex justify-center"
|
|
839
|
+
}, /* @__PURE__ */ React13.createElement(Surface9, {
|
|
840
|
+
role: "hints",
|
|
841
|
+
limit: 1
|
|
842
|
+
})), /* @__PURE__ */ React13.createElement(Popover2.Portal, null, /* @__PURE__ */ React13.createElement(Popover2.Content, {
|
|
894
843
|
classNames: "z-[60]",
|
|
895
844
|
onEscapeKeyDown: () => {
|
|
896
845
|
context.popoverOpen = false;
|
|
@@ -959,31 +908,31 @@ var LayoutSettings = ({ settings }) => {
|
|
|
959
908
|
key: option,
|
|
960
909
|
value: option
|
|
961
910
|
}, t(`settings overscroll ${option} label`)))))))), /* @__PURE__ */ React14.createElement(SettingsValue, {
|
|
962
|
-
label: t("settings show
|
|
911
|
+
label: t("settings show footer label")
|
|
963
912
|
}, /* @__PURE__ */ React14.createElement(Input.Switch, {
|
|
964
|
-
checked: settings.
|
|
965
|
-
onCheckedChange: (checked) => settings.
|
|
913
|
+
checked: settings.showFooter,
|
|
914
|
+
onCheckedChange: (checked) => settings.showFooter = !!checked
|
|
966
915
|
})), !isSocket && /* @__PURE__ */ React14.createElement(SettingsValue, {
|
|
967
916
|
label: t("settings native redirect label")
|
|
968
917
|
}, /* @__PURE__ */ React14.createElement(Input.Switch, {
|
|
969
918
|
checked: settings.enableNativeRedirect,
|
|
970
|
-
onCheckedChange: (checked) => settings.enableNativeRedirect = checked
|
|
919
|
+
onCheckedChange: (checked) => settings.enableNativeRedirect = !!checked
|
|
971
920
|
})), /* @__PURE__ */ React14.createElement(SettingsValue, {
|
|
972
921
|
label: t("settings custom slots")
|
|
973
922
|
}, /* @__PURE__ */ React14.createElement(Input.Switch, {
|
|
974
923
|
checked: settings.customSlots,
|
|
975
|
-
onCheckedChange: (checked) => settings.customSlots = checked
|
|
924
|
+
onCheckedChange: (checked) => settings.customSlots = !!checked
|
|
976
925
|
})), /* @__PURE__ */ React14.createElement(SettingsValue, {
|
|
977
926
|
label: t("settings flat deck")
|
|
978
927
|
}, /* @__PURE__ */ React14.createElement(Input.Switch, {
|
|
979
928
|
checked: settings.flatDeck,
|
|
980
|
-
onCheckedChange: (checked) => settings.flatDeck = checked
|
|
929
|
+
onCheckedChange: (checked) => settings.flatDeck = !!checked
|
|
981
930
|
})));
|
|
982
931
|
};
|
|
983
932
|
|
|
984
933
|
// packages/plugins/plugin-deck/src/layout.ts
|
|
985
934
|
import { produce } from "immer";
|
|
986
|
-
import { SLUG_ENTRY_SEPARATOR, SLUG_KEY_VALUE_SEPARATOR, SLUG_LIST_SEPARATOR, SLUG_PATH_SEPARATOR as
|
|
935
|
+
import { SLUG_ENTRY_SEPARATOR, SLUG_KEY_VALUE_SEPARATOR, SLUG_LIST_SEPARATOR, SLUG_PATH_SEPARATOR as SLUG_PATH_SEPARATOR4 } from "@dxos/app-framework";
|
|
987
936
|
var partsThatSupportIncrement = [
|
|
988
937
|
"main"
|
|
989
938
|
];
|
|
@@ -1096,7 +1045,7 @@ var mergeLayoutParts = (...layoutParts) => {
|
|
|
1096
1045
|
}), {});
|
|
1097
1046
|
};
|
|
1098
1047
|
var parseLayoutEntry = (itemString) => {
|
|
1099
|
-
const [id, path] = itemString.split(
|
|
1048
|
+
const [id, path] = itemString.split(SLUG_PATH_SEPARATOR4);
|
|
1100
1049
|
const entry = {
|
|
1101
1050
|
id
|
|
1102
1051
|
};
|
|
@@ -1123,7 +1072,7 @@ var soloPartToUri = (layout) => {
|
|
|
1123
1072
|
return "";
|
|
1124
1073
|
}
|
|
1125
1074
|
const entry = soloPart[0];
|
|
1126
|
-
return `${entry.id}${entry.path ?
|
|
1075
|
+
return `${entry.id}${entry.path ? SLUG_PATH_SEPARATOR4 + entry.path : ""}`;
|
|
1127
1076
|
};
|
|
1128
1077
|
|
|
1129
1078
|
// packages/plugins/plugin-deck/src/translations.ts
|
|
@@ -1139,7 +1088,7 @@ var translations_default = [
|
|
|
1139
1088
|
"content fallback message": "Unsupported",
|
|
1140
1089
|
"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.",
|
|
1141
1090
|
"toggle fullscreen label": "Toggle fullscreen",
|
|
1142
|
-
"settings show
|
|
1091
|
+
"settings show footer label": "Show footer (experimental)",
|
|
1143
1092
|
"settings native redirect label": "Enable native url redirect (experimental)",
|
|
1144
1093
|
"settings custom slots": "Theme option (experimental)",
|
|
1145
1094
|
"settings new plank position start label": "Start",
|
|
@@ -1163,9 +1112,7 @@ var translations_default = [
|
|
|
1163
1112
|
"select overscroll placeholder": "Select plank overscrolling behavior",
|
|
1164
1113
|
"settings overscroll centering label": "Centering",
|
|
1165
1114
|
"settings overscroll none label": "None",
|
|
1166
|
-
"settings flat deck": "Flatten deck appearance"
|
|
1167
|
-
"comments label": "Show Comments",
|
|
1168
|
-
"settings label": "Show Settings"
|
|
1115
|
+
"settings flat deck": "Flatten deck appearance"
|
|
1169
1116
|
}
|
|
1170
1117
|
}
|
|
1171
1118
|
}
|
|
@@ -1195,7 +1142,7 @@ var DeckPlugin = ({ observability } = {}) => {
|
|
|
1195
1142
|
let currentUndoId;
|
|
1196
1143
|
let handleNavigation;
|
|
1197
1144
|
const settings = new LocalStorageStore("dxos.org/settings/layout", {
|
|
1198
|
-
|
|
1145
|
+
showFooter: false,
|
|
1199
1146
|
customSlots: false,
|
|
1200
1147
|
flatDeck: false,
|
|
1201
1148
|
enableNativeRedirect: false,
|
|
@@ -1280,22 +1227,6 @@ var DeckPlugin = ({ observability } = {}) => {
|
|
|
1280
1227
|
}
|
|
1281
1228
|
}
|
|
1282
1229
|
};
|
|
1283
|
-
const handleSetLocation = (next) => {
|
|
1284
|
-
if (attentionPlugin) {
|
|
1285
|
-
const attended = attentionPlugin.provides.attention.attended;
|
|
1286
|
-
const [attendedId] = Array.from(attended);
|
|
1287
|
-
const ids = (layout.values.layoutMode === "deck" ? next.main : next.solo)?.map(({ id }) => id) ?? [];
|
|
1288
|
-
const isAttendedAvailable = !!attendedId && ids.includes(attendedId);
|
|
1289
|
-
if (!isAttendedAvailable) {
|
|
1290
|
-
requestAnimationFrame(() => {
|
|
1291
|
-
const nextAttended = layout.values.layoutMode === "solo" ? next.solo?.[0].id : next.main?.[0]?.id;
|
|
1292
|
-
const article = document.querySelector(`article[data-attendable-id="${nextAttended}"]`);
|
|
1293
|
-
article?.focus();
|
|
1294
|
-
});
|
|
1295
|
-
}
|
|
1296
|
-
}
|
|
1297
|
-
location.values.active = next;
|
|
1298
|
-
};
|
|
1299
1230
|
return {
|
|
1300
1231
|
meta: meta_default,
|
|
1301
1232
|
ready: async (plugins) => {
|
|
@@ -1336,8 +1267,8 @@ var DeckPlugin = ({ observability } = {}) => {
|
|
|
1336
1267
|
deck.expunge();
|
|
1337
1268
|
}));
|
|
1338
1269
|
settings.prop({
|
|
1339
|
-
key: "
|
|
1340
|
-
storageKey: "show-
|
|
1270
|
+
key: "showFooter",
|
|
1271
|
+
storageKey: "show-footer",
|
|
1341
1272
|
type: LocalStorageStore.bool()
|
|
1342
1273
|
}).prop({
|
|
1343
1274
|
key: "customSlots",
|
|
@@ -1370,13 +1301,13 @@ var DeckPlugin = ({ observability } = {}) => {
|
|
|
1370
1301
|
handleNavigation = async () => {
|
|
1371
1302
|
const pathname = window.location.pathname;
|
|
1372
1303
|
if (pathname === "/reset") {
|
|
1373
|
-
|
|
1304
|
+
location.values.active = {
|
|
1374
1305
|
sidebar: [
|
|
1375
1306
|
{
|
|
1376
1307
|
id: NAV_ID
|
|
1377
1308
|
}
|
|
1378
1309
|
]
|
|
1379
|
-
}
|
|
1310
|
+
};
|
|
1380
1311
|
location.values.closed = [];
|
|
1381
1312
|
layout.values.layoutMode = "solo";
|
|
1382
1313
|
window.location.pathname = "/";
|
|
@@ -1387,16 +1318,26 @@ var DeckPlugin = ({ observability } = {}) => {
|
|
|
1387
1318
|
return;
|
|
1388
1319
|
}
|
|
1389
1320
|
const startingLayout = removePart(location.values.active, "solo");
|
|
1390
|
-
|
|
1321
|
+
location.values.active = mergeLayoutParts(layoutFromUri, startingLayout);
|
|
1391
1322
|
layout.values.layoutMode = "solo";
|
|
1392
1323
|
};
|
|
1393
1324
|
await handleNavigation();
|
|
1394
1325
|
window.addEventListener("popstate", handleNavigation);
|
|
1395
|
-
unsubscriptionCallbacks.push(
|
|
1396
|
-
selectedPath
|
|
1397
|
-
}), ({ selectedPath }) => {
|
|
1326
|
+
unsubscriptionCallbacks.push(effect(() => {
|
|
1327
|
+
const selectedPath = soloPartToUri(location.values.active);
|
|
1398
1328
|
history.pushState(null, "", `/${selectedPath}${window.location.search}`);
|
|
1399
1329
|
}));
|
|
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
|
+
}));
|
|
1400
1341
|
layoutModeHistory.values.push(`${layout.values.layoutMode}`);
|
|
1401
1342
|
},
|
|
1402
1343
|
unload: async () => {
|
|
@@ -1439,7 +1380,8 @@ var DeckPlugin = ({ observability } = {}) => {
|
|
|
1439
1380
|
ns: DECK_PLUGIN
|
|
1440
1381
|
}
|
|
1441
1382
|
],
|
|
1442
|
-
icon:
|
|
1383
|
+
icon: (props) => /* @__PURE__ */ React15.createElement(ArrowsOut, props),
|
|
1384
|
+
iconSymbol: "ph--arrows-out--regular",
|
|
1443
1385
|
keyBinding: {
|
|
1444
1386
|
macos: "ctrl+meta+f",
|
|
1445
1387
|
windows: "shift+ctrl+f"
|
|
@@ -1456,9 +1398,12 @@ var DeckPlugin = ({ observability } = {}) => {
|
|
|
1456
1398
|
value: deck.values
|
|
1457
1399
|
}, props.children)),
|
|
1458
1400
|
root: () => {
|
|
1459
|
-
return /* @__PURE__ */ React15.createElement(DeckLayout, {
|
|
1401
|
+
return /* @__PURE__ */ React15.createElement(Mosaic.Root, null, /* @__PURE__ */ React15.createElement(DeckLayout, {
|
|
1402
|
+
attention: attentionPlugin?.provides.attention ?? {
|
|
1403
|
+
attended: /* @__PURE__ */ new Set()
|
|
1404
|
+
},
|
|
1460
1405
|
layoutParts: location.values.active,
|
|
1461
|
-
|
|
1406
|
+
showHintsFooter: settings.values.showFooter,
|
|
1462
1407
|
overscroll: settings.values.overscroll,
|
|
1463
1408
|
flatDeck: settings.values.flatDeck,
|
|
1464
1409
|
slots: settings.values.customSlots ? customSlots : void 0,
|
|
@@ -1474,7 +1419,7 @@ var DeckPlugin = ({ observability } = {}) => {
|
|
|
1474
1419
|
}, 1e3);
|
|
1475
1420
|
}
|
|
1476
1421
|
}
|
|
1477
|
-
});
|
|
1422
|
+
}), /* @__PURE__ */ React15.createElement(Mosaic.DragOverlay, null));
|
|
1478
1423
|
},
|
|
1479
1424
|
surface: {
|
|
1480
1425
|
component: ({ data, role }) => {
|
|
@@ -1510,7 +1455,7 @@ var DeckPlugin = ({ observability } = {}) => {
|
|
|
1510
1455
|
} else {
|
|
1511
1456
|
log.warn("Invalid layout mode", intent?.data?.layoutMode, {
|
|
1512
1457
|
F: __dxlog_file,
|
|
1513
|
-
L:
|
|
1458
|
+
L: 390,
|
|
1514
1459
|
S: void 0,
|
|
1515
1460
|
C: (f, a) => f(...a)
|
|
1516
1461
|
});
|
|
@@ -1556,7 +1501,7 @@ var DeckPlugin = ({ observability } = {}) => {
|
|
|
1556
1501
|
data: true
|
|
1557
1502
|
};
|
|
1558
1503
|
}
|
|
1559
|
-
case
|
|
1504
|
+
case NavigationAction3.OPEN: {
|
|
1560
1505
|
const previouslyOpenIds = new Set(openIds2(location.values.active));
|
|
1561
1506
|
const layoutMode = layout.values.layoutMode;
|
|
1562
1507
|
batch(() => {
|
|
@@ -1565,7 +1510,7 @@ var DeckPlugin = ({ observability } = {}) => {
|
|
|
1565
1510
|
}
|
|
1566
1511
|
const processLayoutEntry = (partName, entryString, currentLayout) => {
|
|
1567
1512
|
const toggle = true;
|
|
1568
|
-
const [id, path] = entryString.split(
|
|
1513
|
+
const [id, path] = entryString.split(SLUG_PATH_SEPARATOR5);
|
|
1569
1514
|
const layoutEntry = {
|
|
1570
1515
|
id,
|
|
1571
1516
|
...path ? {
|
|
@@ -1594,7 +1539,7 @@ var DeckPlugin = ({ observability } = {}) => {
|
|
|
1594
1539
|
newLayout = processLayoutEntry(partName, layoutEntries, newLayout);
|
|
1595
1540
|
}
|
|
1596
1541
|
});
|
|
1597
|
-
|
|
1542
|
+
location.values.active = newLayout;
|
|
1598
1543
|
});
|
|
1599
1544
|
const ids = openIds2(location.values.active);
|
|
1600
1545
|
const newlyOpen = ids.filter((i) => !previouslyOpenIds.has(i));
|
|
@@ -1613,7 +1558,7 @@ var DeckPlugin = ({ observability } = {}) => {
|
|
|
1613
1558
|
] : [],
|
|
1614
1559
|
intent.data?.object ? [
|
|
1615
1560
|
{
|
|
1616
|
-
action:
|
|
1561
|
+
action: NavigationAction3.EXPOSE,
|
|
1617
1562
|
data: {
|
|
1618
1563
|
id: fullyQualifiedId(intent.data.object)
|
|
1619
1564
|
}
|
|
@@ -1636,16 +1581,16 @@ var DeckPlugin = ({ observability } = {}) => {
|
|
|
1636
1581
|
]
|
|
1637
1582
|
};
|
|
1638
1583
|
}
|
|
1639
|
-
case
|
|
1584
|
+
case NavigationAction3.ADD_TO_ACTIVE: {
|
|
1640
1585
|
const data = intent.data;
|
|
1641
1586
|
const layoutEntry = {
|
|
1642
1587
|
id: data.id
|
|
1643
1588
|
};
|
|
1644
1589
|
const effectivePart = getEffectivePart(data.part, layout.values.layoutMode);
|
|
1645
|
-
|
|
1590
|
+
location.values.active = openEntry(location.values.active, effectivePart, layoutEntry, {
|
|
1646
1591
|
positioning: data.positioning ?? settings.values.newPlankPositioning,
|
|
1647
1592
|
pivotId: data.pivotId
|
|
1648
|
-
})
|
|
1593
|
+
});
|
|
1649
1594
|
const intents = [];
|
|
1650
1595
|
if (data.scrollIntoView && layout.values.layoutMode === "deck") {
|
|
1651
1596
|
intents.push([
|
|
@@ -1662,7 +1607,7 @@ var DeckPlugin = ({ observability } = {}) => {
|
|
|
1662
1607
|
intents
|
|
1663
1608
|
};
|
|
1664
1609
|
}
|
|
1665
|
-
case
|
|
1610
|
+
case NavigationAction3.CLOSE: {
|
|
1666
1611
|
return batch(() => {
|
|
1667
1612
|
if (!intent.data) {
|
|
1668
1613
|
return;
|
|
@@ -1687,32 +1632,32 @@ var DeckPlugin = ({ observability } = {}) => {
|
|
|
1687
1632
|
});
|
|
1688
1633
|
}
|
|
1689
1634
|
});
|
|
1690
|
-
|
|
1635
|
+
location.values.active = newLayout;
|
|
1691
1636
|
return {
|
|
1692
1637
|
data: true
|
|
1693
1638
|
};
|
|
1694
1639
|
});
|
|
1695
1640
|
}
|
|
1696
1641
|
// TODO(wittjosiah): Factor out.
|
|
1697
|
-
case
|
|
1642
|
+
case NavigationAction3.SET: {
|
|
1698
1643
|
return batch(() => {
|
|
1699
1644
|
if (isLayoutParts(intent.data?.activeParts)) {
|
|
1700
|
-
|
|
1645
|
+
location.values.active = intent.data.activeParts;
|
|
1701
1646
|
}
|
|
1702
1647
|
return {
|
|
1703
1648
|
data: true
|
|
1704
1649
|
};
|
|
1705
1650
|
});
|
|
1706
1651
|
}
|
|
1707
|
-
case
|
|
1652
|
+
case NavigationAction3.ADJUST: {
|
|
1708
1653
|
return batch(() => {
|
|
1709
1654
|
if (isLayoutAdjustment(intent.data)) {
|
|
1710
1655
|
const adjustment = intent.data;
|
|
1711
1656
|
if (adjustment.type === "increment-end" || adjustment.type === "increment-start") {
|
|
1712
|
-
|
|
1657
|
+
location.values.active = incrementPlank(location.values.active, {
|
|
1713
1658
|
type: adjustment.type,
|
|
1714
1659
|
layoutCoordinate: adjustment.layoutCoordinate
|
|
1715
|
-
})
|
|
1660
|
+
});
|
|
1716
1661
|
}
|
|
1717
1662
|
if (adjustment.type === "solo") {
|
|
1718
1663
|
const entryId = adjustment.layoutCoordinate.entryId;
|
|
@@ -1728,7 +1673,7 @@ var DeckPlugin = ({ observability } = {}) => {
|
|
|
1728
1673
|
}
|
|
1729
1674
|
},
|
|
1730
1675
|
{
|
|
1731
|
-
action:
|
|
1676
|
+
action: NavigationAction3.OPEN,
|
|
1732
1677
|
data: {
|
|
1733
1678
|
activeParts: {
|
|
1734
1679
|
solo: [
|
|
@@ -1752,7 +1697,7 @@ var DeckPlugin = ({ observability } = {}) => {
|
|
|
1752
1697
|
}
|
|
1753
1698
|
},
|
|
1754
1699
|
{
|
|
1755
|
-
action:
|
|
1700
|
+
action: NavigationAction3.CLOSE,
|
|
1756
1701
|
data: {
|
|
1757
1702
|
activeParts: {
|
|
1758
1703
|
solo: [
|
|
@@ -1762,7 +1707,7 @@ var DeckPlugin = ({ observability } = {}) => {
|
|
|
1762
1707
|
}
|
|
1763
1708
|
},
|
|
1764
1709
|
{
|
|
1765
|
-
action:
|
|
1710
|
+
action: NavigationAction3.OPEN,
|
|
1766
1711
|
data: {
|
|
1767
1712
|
noToggle: true,
|
|
1768
1713
|
activeParts: {
|