@dxos/plugin-deck 0.6.12 → 0.6.13-main.041e8aa
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 +237 -183
- 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/dist/types/src/util/overscroll.d.ts +1 -1
- package/dist/types/src/util/overscroll.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 +63 -84
- 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 +12 -3
- 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/src/util/overscroll.ts +5 -5
- 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,11 +25,12 @@ 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
|
-
import { getSize } from "@dxos/react-ui-theme";
|
|
33
|
+
import { getSize, mainPaddingTransitions as mainPaddingTransitions2 } 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,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",
|
|
@@ -586,14 +640,19 @@ var Sidebar = ({ attention, layoutParts }) => {
|
|
|
586
640
|
// packages/plugins/plugin-deck/src/components/DeckLayout/StatusBar.tsx
|
|
587
641
|
import React11 from "react";
|
|
588
642
|
import { Surface as Surface8 } from "@dxos/app-framework";
|
|
589
|
-
import { mainPadding, mx as mx4 } from "@dxos/react-ui-theme";
|
|
590
|
-
var StatusBar = () => {
|
|
643
|
+
import { mainPadding, mainPaddingTransitions, mx as mx4 } from "@dxos/react-ui-theme";
|
|
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, mainPaddingTransitions)
|
|
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
|
}));
|
|
@@ -646,7 +705,10 @@ var getEffectivePart = (partName, layoutMode) => layoutMode === "solo" && partNa
|
|
|
646
705
|
import { PLANK_DEFAULTS } from "@dxos/react-ui-deck";
|
|
647
706
|
var calculateOverscroll = (planks, plankSizing, sidebarOpen, complementarySidebarOpen) => {
|
|
648
707
|
if (!planks?.length) {
|
|
649
|
-
return
|
|
708
|
+
return {
|
|
709
|
+
paddingInlineStart: 0,
|
|
710
|
+
paddingInlineEnd: 0
|
|
711
|
+
};
|
|
650
712
|
}
|
|
651
713
|
const sidebarWidth = sidebarOpen ? "270px" : "0px";
|
|
652
714
|
const complementarySidebarWidth = complementarySidebarOpen ? "360px" : "0px";
|
|
@@ -656,8 +718,8 @@ var calculateOverscroll = (planks, plankSizing, sidebarOpen, complementarySideba
|
|
|
656
718
|
const plankSize = getPlankSize(plank.id);
|
|
657
719
|
const overscrollPadding = `max(0px, calc(((100dvw - ${sidebarWidth} - ${complementarySidebarWidth} - (${plankSize} + 20px)) / 2)))`;
|
|
658
720
|
return {
|
|
659
|
-
|
|
660
|
-
|
|
721
|
+
paddingInlineStart: overscrollPadding,
|
|
722
|
+
paddingInlineEnd: overscrollPadding
|
|
661
723
|
};
|
|
662
724
|
} else {
|
|
663
725
|
const first = planks[0];
|
|
@@ -665,27 +727,33 @@ var calculateOverscroll = (planks, plankSizing, sidebarOpen, complementarySideba
|
|
|
665
727
|
const last = planks[planks.length - 1];
|
|
666
728
|
const lastSize = getPlankSize(last.id);
|
|
667
729
|
return {
|
|
668
|
-
|
|
669
|
-
|
|
730
|
+
paddingInlineStart: `max(0px, calc(((100dvw - (${firstSize} + 20px)) / 2) - ${sidebarWidth}))`,
|
|
731
|
+
paddingInlineEnd: `max(0px, calc(((100dvw - (${lastSize} + 20px)) / 2) - ${complementarySidebarWidth}))`
|
|
670
732
|
};
|
|
671
733
|
}
|
|
672
734
|
};
|
|
673
735
|
|
|
674
736
|
// packages/plugins/plugin-deck/src/components/DeckLayout/DeckLayout.tsx
|
|
675
|
-
var DeckLayout = ({ layoutParts,
|
|
737
|
+
var DeckLayout = ({ layoutParts, toasts, flatDeck, overscroll, showHints, slots, onDismissToast }) => {
|
|
676
738
|
const context = useLayout();
|
|
677
739
|
const { layoutMode, sidebarOpen, complementarySidebarOpen, dialogOpen, dialogContent, dialogBlockAlign, popoverOpen, popoverContent, popoverAnchorId } = context;
|
|
678
740
|
const { t } = useTranslation5(DECK_PLUGIN);
|
|
679
741
|
const { plankSizing } = useDeckContext();
|
|
742
|
+
const attended = useAttended3();
|
|
680
743
|
const searchPlugin = usePlugin("dxos.org/plugin/search");
|
|
681
|
-
const fullScreenSlug =
|
|
744
|
+
const fullScreenSlug = useMemo3(() => firstIdInPart(layoutParts, "fullScreen"), [
|
|
682
745
|
layoutParts
|
|
683
746
|
]);
|
|
684
|
-
const
|
|
747
|
+
const scrollLeftRef = useRef2();
|
|
685
748
|
const deckRef = useRef2(null);
|
|
686
|
-
|
|
749
|
+
useEffect5(() => {
|
|
750
|
+
const firstId = layoutMode === "solo" ? firstIdInPart(layoutParts, "solo") : firstIdInPart(layoutParts, "main");
|
|
751
|
+
if (attended.length === 0 && firstId) {
|
|
752
|
+
document.querySelector(`article[data-attendable-id="${firstId}"] button`)?.focus();
|
|
753
|
+
}
|
|
754
|
+
}, []);
|
|
687
755
|
const handleResize = useCallback2(() => {
|
|
688
|
-
|
|
756
|
+
scrollLeftRef.current = null;
|
|
689
757
|
}, []);
|
|
690
758
|
useEffect5(() => {
|
|
691
759
|
window.addEventListener("resize", handleResize);
|
|
@@ -693,36 +761,20 @@ var DeckLayout = ({ layoutParts, attention, toasts, flatDeck, overscroll, showHi
|
|
|
693
761
|
}, [
|
|
694
762
|
handleResize
|
|
695
763
|
]);
|
|
696
|
-
|
|
697
|
-
if (
|
|
698
|
-
|
|
699
|
-
} else if (restoreScrollRef.current && deckRef.current && scrollLeft) {
|
|
700
|
-
deckRef.current.scrollLeft = scrollLeft;
|
|
701
|
-
restoreScrollRef.current = false;
|
|
764
|
+
const restoreScroll = useCallback2(() => {
|
|
765
|
+
if (deckRef.current && scrollLeftRef.current != null) {
|
|
766
|
+
deckRef.current.scrollLeft = scrollLeftRef.current;
|
|
702
767
|
}
|
|
703
|
-
}, [
|
|
704
|
-
|
|
705
|
-
deckRef.current,
|
|
706
|
-
scrollLeft
|
|
707
|
-
]);
|
|
768
|
+
}, []);
|
|
769
|
+
useOnTransition(layoutMode, (mode) => mode !== "deck", "deck", restoreScroll);
|
|
708
770
|
const handleScroll = useCallback2((event) => {
|
|
709
771
|
if (layoutMode === "deck" && event.currentTarget === event.target) {
|
|
710
|
-
|
|
772
|
+
scrollLeftRef.current = event.target.scrollLeft;
|
|
711
773
|
}
|
|
712
774
|
}, [
|
|
713
775
|
layoutMode
|
|
714
776
|
]);
|
|
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
|
-
]);
|
|
777
|
+
const firstAttendedId = attended[0];
|
|
726
778
|
useEffect5(() => {
|
|
727
779
|
if (layoutMode === "deck" && firstAttendedId) {
|
|
728
780
|
}
|
|
@@ -730,21 +782,20 @@ var DeckLayout = ({ layoutParts, attention, toasts, flatDeck, overscroll, showHi
|
|
|
730
782
|
layoutMode,
|
|
731
783
|
firstAttendedId
|
|
732
784
|
]);
|
|
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
|
-
}
|
|
785
|
+
const isEmpty = layoutParts.main?.length === 0 && layoutParts.solo?.length === 0;
|
|
786
|
+
const padding = useMemo3(() => {
|
|
787
|
+
if (layoutMode === "deck" && overscroll === "centering") {
|
|
788
|
+
return calculateOverscroll(layoutParts.main, plankSizing, sidebarOpen, complementarySidebarOpen);
|
|
741
789
|
}
|
|
742
|
-
return
|
|
790
|
+
return {};
|
|
743
791
|
}, [
|
|
792
|
+
layoutMode,
|
|
793
|
+
overscroll,
|
|
744
794
|
layoutParts.main,
|
|
745
|
-
|
|
795
|
+
plankSizing,
|
|
796
|
+
sidebarOpen,
|
|
797
|
+
complementarySidebarOpen
|
|
746
798
|
]);
|
|
747
|
-
const padding = layoutMode === "deck" && overscroll === "centering" ? calculateOverscroll(layoutParts.main, plankSizing, sidebarOpen, complementarySidebarOpen) : {};
|
|
748
799
|
if (layoutMode === "fullscreen") {
|
|
749
800
|
return /* @__PURE__ */ React13.createElement(Fullscreen, {
|
|
750
801
|
id: fullScreenSlug
|
|
@@ -766,19 +817,13 @@ var DeckLayout = ({ layoutParts, attention, toasts, flatDeck, overscroll, showHi
|
|
|
766
817
|
}), /* @__PURE__ */ React13.createElement(Main3.Root, {
|
|
767
818
|
navigationSidebarOpen: context.sidebarOpen,
|
|
768
819
|
onNavigationSidebarOpenChange: (next) => context.sidebarOpen = next,
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
/* complementaryAvailable && */
|
|
772
|
-
context.complementarySidebarOpen
|
|
773
|
-
),
|
|
774
|
-
onComplementarySidebarOpenChange: (next) => context.complementarySidebarOpen = next
|
|
775
|
-
}
|
|
820
|
+
complementarySidebarOpen: context.complementarySidebarOpen,
|
|
821
|
+
onComplementarySidebarOpenChange: (next) => context.complementarySidebarOpen = next
|
|
776
822
|
}, /* @__PURE__ */ React13.createElement(Main3.Notch, {
|
|
777
823
|
classNames: "z-[21]"
|
|
778
824
|
}, /* @__PURE__ */ React13.createElement(Surface9, {
|
|
779
825
|
role: "notch-start"
|
|
780
826
|
}), /* @__PURE__ */ React13.createElement(Button3, {
|
|
781
|
-
// disabled={!sidebarAvailable}
|
|
782
827
|
onClick: () => context.sidebarOpen = !context.sidebarOpen,
|
|
783
828
|
variant: "ghost",
|
|
784
829
|
classNames: "p-1"
|
|
@@ -788,7 +833,6 @@ var DeckLayout = ({ layoutParts, attention, toasts, flatDeck, overscroll, showHi
|
|
|
788
833
|
weight: "light",
|
|
789
834
|
className: getSize(5)
|
|
790
835
|
})), /* @__PURE__ */ React13.createElement(Button3, {
|
|
791
|
-
// disabled={!complementaryAvailable}
|
|
792
836
|
onClick: () => context.complementarySidebarOpen = !context.complementarySidebarOpen,
|
|
793
837
|
variant: "ghost",
|
|
794
838
|
classNames: "p-1"
|
|
@@ -801,15 +845,14 @@ var DeckLayout = ({ layoutParts, attention, toasts, flatDeck, overscroll, showHi
|
|
|
801
845
|
})), /* @__PURE__ */ React13.createElement(Surface9, {
|
|
802
846
|
role: "notch-end"
|
|
803
847
|
})), /* @__PURE__ */ React13.createElement(Sidebar, {
|
|
804
|
-
attention,
|
|
805
848
|
layoutParts
|
|
806
849
|
}), /* @__PURE__ */ React13.createElement(ComplementarySidebar, {
|
|
807
|
-
|
|
850
|
+
context: "comments",
|
|
808
851
|
layoutParts,
|
|
809
852
|
flatDeck
|
|
810
|
-
}), /* @__PURE__ */ React13.createElement(Main3.Overlay, null),
|
|
853
|
+
}), /* @__PURE__ */ React13.createElement(Main3.Overlay, null), isEmpty && /* @__PURE__ */ React13.createElement(Main3.Content, {
|
|
811
854
|
handlesFocus: true
|
|
812
|
-
}, /* @__PURE__ */ React13.createElement(ContentEmpty, null)),
|
|
855
|
+
}, /* @__PURE__ */ React13.createElement(ContentEmpty, null)), !isEmpty && /* @__PURE__ */ React13.createElement(Main3.Content, {
|
|
813
856
|
bounce: true,
|
|
814
857
|
classNames: "grid block-end-[--statusbar-size]",
|
|
815
858
|
handlesFocus: true
|
|
@@ -820,26 +863,33 @@ var DeckLayout = ({ layoutParts, attention, toasts, flatDeck, overscroll, showHi
|
|
|
820
863
|
style: padding,
|
|
821
864
|
classNames: [
|
|
822
865
|
!flatDeck && "bg-deck",
|
|
866
|
+
mainPaddingTransitions2,
|
|
823
867
|
"absolute inset-0",
|
|
824
868
|
slots?.wallpaper?.classNames
|
|
825
869
|
],
|
|
826
870
|
solo: layoutMode === "solo",
|
|
827
871
|
onScroll: handleScroll,
|
|
828
872
|
ref: deckRef
|
|
829
|
-
},
|
|
873
|
+
}, /* @__PURE__ */ React13.createElement(Plank, {
|
|
874
|
+
entry: layoutParts.solo?.[0] ?? {
|
|
875
|
+
id: "unknown-solo"
|
|
876
|
+
},
|
|
877
|
+
layoutParts,
|
|
878
|
+
part: "solo",
|
|
879
|
+
layoutMode,
|
|
880
|
+
flatDeck,
|
|
881
|
+
searchEnabled: !!searchPlugin
|
|
882
|
+
}), layoutParts.main?.map((layoutEntry) => /* @__PURE__ */ React13.createElement(Plank, {
|
|
830
883
|
key: layoutEntry.id,
|
|
831
884
|
entry: layoutEntry,
|
|
832
885
|
layoutParts,
|
|
833
|
-
part:
|
|
886
|
+
part: "main",
|
|
834
887
|
layoutMode,
|
|
835
888
|
flatDeck,
|
|
836
889
|
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, {
|
|
890
|
+
}))))), /* @__PURE__ */ React13.createElement(StatusBar, {
|
|
891
|
+
showHints
|
|
892
|
+
}), /* @__PURE__ */ React13.createElement(Popover2.Portal, null, /* @__PURE__ */ React13.createElement(Popover2.Content, {
|
|
843
893
|
classNames: "z-[60]",
|
|
844
894
|
onEscapeKeyDown: () => {
|
|
845
895
|
context.popoverOpen = false;
|
|
@@ -908,31 +958,31 @@ var LayoutSettings = ({ settings }) => {
|
|
|
908
958
|
key: option,
|
|
909
959
|
value: option
|
|
910
960
|
}, t(`settings overscroll ${option} label`)))))))), /* @__PURE__ */ React14.createElement(SettingsValue, {
|
|
911
|
-
label: t("settings show
|
|
961
|
+
label: t("settings show hints label")
|
|
912
962
|
}, /* @__PURE__ */ React14.createElement(Input.Switch, {
|
|
913
|
-
checked: settings.
|
|
914
|
-
onCheckedChange: (checked) => settings.
|
|
963
|
+
checked: settings.showHints,
|
|
964
|
+
onCheckedChange: (checked) => settings.showHints = checked
|
|
915
965
|
})), !isSocket && /* @__PURE__ */ React14.createElement(SettingsValue, {
|
|
916
966
|
label: t("settings native redirect label")
|
|
917
967
|
}, /* @__PURE__ */ React14.createElement(Input.Switch, {
|
|
918
968
|
checked: settings.enableNativeRedirect,
|
|
919
|
-
onCheckedChange: (checked) => settings.enableNativeRedirect =
|
|
969
|
+
onCheckedChange: (checked) => settings.enableNativeRedirect = checked
|
|
920
970
|
})), /* @__PURE__ */ React14.createElement(SettingsValue, {
|
|
921
971
|
label: t("settings custom slots")
|
|
922
972
|
}, /* @__PURE__ */ React14.createElement(Input.Switch, {
|
|
923
973
|
checked: settings.customSlots,
|
|
924
|
-
onCheckedChange: (checked) => settings.customSlots =
|
|
974
|
+
onCheckedChange: (checked) => settings.customSlots = checked
|
|
925
975
|
})), /* @__PURE__ */ React14.createElement(SettingsValue, {
|
|
926
976
|
label: t("settings flat deck")
|
|
927
977
|
}, /* @__PURE__ */ React14.createElement(Input.Switch, {
|
|
928
978
|
checked: settings.flatDeck,
|
|
929
|
-
onCheckedChange: (checked) => settings.flatDeck =
|
|
979
|
+
onCheckedChange: (checked) => settings.flatDeck = checked
|
|
930
980
|
})));
|
|
931
981
|
};
|
|
932
982
|
|
|
933
983
|
// packages/plugins/plugin-deck/src/layout.ts
|
|
934
984
|
import { produce } from "immer";
|
|
935
|
-
import { SLUG_ENTRY_SEPARATOR, SLUG_KEY_VALUE_SEPARATOR, SLUG_LIST_SEPARATOR, SLUG_PATH_SEPARATOR as
|
|
985
|
+
import { SLUG_ENTRY_SEPARATOR, SLUG_KEY_VALUE_SEPARATOR, SLUG_LIST_SEPARATOR, SLUG_PATH_SEPARATOR as SLUG_PATH_SEPARATOR3 } from "@dxos/app-framework";
|
|
936
986
|
var partsThatSupportIncrement = [
|
|
937
987
|
"main"
|
|
938
988
|
];
|
|
@@ -1045,7 +1095,7 @@ var mergeLayoutParts = (...layoutParts) => {
|
|
|
1045
1095
|
}), {});
|
|
1046
1096
|
};
|
|
1047
1097
|
var parseLayoutEntry = (itemString) => {
|
|
1048
|
-
const [id, path] = itemString.split(
|
|
1098
|
+
const [id, path] = itemString.split(SLUG_PATH_SEPARATOR3);
|
|
1049
1099
|
const entry = {
|
|
1050
1100
|
id
|
|
1051
1101
|
};
|
|
@@ -1072,7 +1122,7 @@ var soloPartToUri = (layout) => {
|
|
|
1072
1122
|
return "";
|
|
1073
1123
|
}
|
|
1074
1124
|
const entry = soloPart[0];
|
|
1075
|
-
return `${entry.id}${entry.path ?
|
|
1125
|
+
return `${entry.id}${entry.path ? SLUG_PATH_SEPARATOR3 + entry.path : ""}`;
|
|
1076
1126
|
};
|
|
1077
1127
|
|
|
1078
1128
|
// packages/plugins/plugin-deck/src/translations.ts
|
|
@@ -1088,7 +1138,7 @@ var translations_default = [
|
|
|
1088
1138
|
"content fallback message": "Unsupported",
|
|
1089
1139
|
"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
1140
|
"toggle fullscreen label": "Toggle fullscreen",
|
|
1091
|
-
"settings show
|
|
1141
|
+
"settings show hints label": "Show hints",
|
|
1092
1142
|
"settings native redirect label": "Enable native url redirect (experimental)",
|
|
1093
1143
|
"settings custom slots": "Theme option (experimental)",
|
|
1094
1144
|
"settings new plank position start label": "Start",
|
|
@@ -1112,7 +1162,9 @@ var translations_default = [
|
|
|
1112
1162
|
"select overscroll placeholder": "Select plank overscrolling behavior",
|
|
1113
1163
|
"settings overscroll centering label": "Centering",
|
|
1114
1164
|
"settings overscroll none label": "None",
|
|
1115
|
-
"settings flat deck": "Flatten deck appearance"
|
|
1165
|
+
"settings flat deck": "Flatten deck appearance",
|
|
1166
|
+
"comments label": "Show Comments",
|
|
1167
|
+
"settings label": "Show Settings"
|
|
1116
1168
|
}
|
|
1117
1169
|
}
|
|
1118
1170
|
}
|
|
@@ -1142,7 +1194,7 @@ var DeckPlugin = ({ observability } = {}) => {
|
|
|
1142
1194
|
let currentUndoId;
|
|
1143
1195
|
let handleNavigation;
|
|
1144
1196
|
const settings = new LocalStorageStore("dxos.org/settings/layout", {
|
|
1145
|
-
|
|
1197
|
+
showHints: true,
|
|
1146
1198
|
customSlots: false,
|
|
1147
1199
|
flatDeck: false,
|
|
1148
1200
|
enableNativeRedirect: false,
|
|
@@ -1227,6 +1279,22 @@ var DeckPlugin = ({ observability } = {}) => {
|
|
|
1227
1279
|
}
|
|
1228
1280
|
}
|
|
1229
1281
|
};
|
|
1282
|
+
const handleSetLocation = (next) => {
|
|
1283
|
+
if (attentionPlugin) {
|
|
1284
|
+
const attended = attentionPlugin.provides.attention.attended;
|
|
1285
|
+
const [attendedId] = Array.from(attended);
|
|
1286
|
+
const ids = (layout.values.layoutMode === "deck" ? next.main : next.solo)?.map(({ id }) => id) ?? [];
|
|
1287
|
+
const isAttendedAvailable = !!attendedId && ids.includes(attendedId);
|
|
1288
|
+
if (!isAttendedAvailable) {
|
|
1289
|
+
requestAnimationFrame(() => {
|
|
1290
|
+
const nextAttended = layout.values.layoutMode === "solo" ? next.solo?.[0].id : next.main?.[0]?.id;
|
|
1291
|
+
const article = document.querySelector(`article[data-attendable-id="${nextAttended}"]`);
|
|
1292
|
+
article?.focus();
|
|
1293
|
+
});
|
|
1294
|
+
}
|
|
1295
|
+
}
|
|
1296
|
+
location.values.active = next;
|
|
1297
|
+
};
|
|
1230
1298
|
return {
|
|
1231
1299
|
meta: meta_default,
|
|
1232
1300
|
ready: async (plugins) => {
|
|
@@ -1267,8 +1335,8 @@ var DeckPlugin = ({ observability } = {}) => {
|
|
|
1267
1335
|
deck.expunge();
|
|
1268
1336
|
}));
|
|
1269
1337
|
settings.prop({
|
|
1270
|
-
key: "
|
|
1271
|
-
storageKey: "show-
|
|
1338
|
+
key: "showHints",
|
|
1339
|
+
storageKey: "show-hints",
|
|
1272
1340
|
type: LocalStorageStore.bool()
|
|
1273
1341
|
}).prop({
|
|
1274
1342
|
key: "customSlots",
|
|
@@ -1301,13 +1369,13 @@ var DeckPlugin = ({ observability } = {}) => {
|
|
|
1301
1369
|
handleNavigation = async () => {
|
|
1302
1370
|
const pathname = window.location.pathname;
|
|
1303
1371
|
if (pathname === "/reset") {
|
|
1304
|
-
|
|
1372
|
+
handleSetLocation({
|
|
1305
1373
|
sidebar: [
|
|
1306
1374
|
{
|
|
1307
1375
|
id: NAV_ID
|
|
1308
1376
|
}
|
|
1309
1377
|
]
|
|
1310
|
-
};
|
|
1378
|
+
});
|
|
1311
1379
|
location.values.closed = [];
|
|
1312
1380
|
layout.values.layoutMode = "solo";
|
|
1313
1381
|
window.location.pathname = "/";
|
|
@@ -1318,26 +1386,16 @@ var DeckPlugin = ({ observability } = {}) => {
|
|
|
1318
1386
|
return;
|
|
1319
1387
|
}
|
|
1320
1388
|
const startingLayout = removePart(location.values.active, "solo");
|
|
1321
|
-
|
|
1389
|
+
handleSetLocation(mergeLayoutParts(layoutFromUri, startingLayout));
|
|
1322
1390
|
layout.values.layoutMode = "solo";
|
|
1323
1391
|
};
|
|
1324
1392
|
await handleNavigation();
|
|
1325
1393
|
window.addEventListener("popstate", handleNavigation);
|
|
1326
|
-
unsubscriptionCallbacks.push(
|
|
1327
|
-
|
|
1394
|
+
unsubscriptionCallbacks.push(scheduledEffect(() => ({
|
|
1395
|
+
selectedPath: soloPartToUri(location.values.active)
|
|
1396
|
+
}), ({ selectedPath }) => {
|
|
1328
1397
|
history.pushState(null, "", `/${selectedPath}${window.location.search}`);
|
|
1329
1398
|
}));
|
|
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
1399
|
layoutModeHistory.values.push(`${layout.values.layoutMode}`);
|
|
1342
1400
|
},
|
|
1343
1401
|
unload: async () => {
|
|
@@ -1380,8 +1438,7 @@ var DeckPlugin = ({ observability } = {}) => {
|
|
|
1380
1438
|
ns: DECK_PLUGIN
|
|
1381
1439
|
}
|
|
1382
1440
|
],
|
|
1383
|
-
icon:
|
|
1384
|
-
iconSymbol: "ph--arrows-out--regular",
|
|
1441
|
+
icon: "ph--arrows-out--regular",
|
|
1385
1442
|
keyBinding: {
|
|
1386
1443
|
macos: "ctrl+meta+f",
|
|
1387
1444
|
windows: "shift+ctrl+f"
|
|
@@ -1398,12 +1455,9 @@ var DeckPlugin = ({ observability } = {}) => {
|
|
|
1398
1455
|
value: deck.values
|
|
1399
1456
|
}, props.children)),
|
|
1400
1457
|
root: () => {
|
|
1401
|
-
return /* @__PURE__ */ React15.createElement(
|
|
1402
|
-
attention: attentionPlugin?.provides.attention ?? {
|
|
1403
|
-
attended: /* @__PURE__ */ new Set()
|
|
1404
|
-
},
|
|
1458
|
+
return /* @__PURE__ */ React15.createElement(DeckLayout, {
|
|
1405
1459
|
layoutParts: location.values.active,
|
|
1406
|
-
|
|
1460
|
+
showHints: settings.values.showHints,
|
|
1407
1461
|
overscroll: settings.values.overscroll,
|
|
1408
1462
|
flatDeck: settings.values.flatDeck,
|
|
1409
1463
|
slots: settings.values.customSlots ? customSlots : void 0,
|
|
@@ -1419,7 +1473,7 @@ var DeckPlugin = ({ observability } = {}) => {
|
|
|
1419
1473
|
}, 1e3);
|
|
1420
1474
|
}
|
|
1421
1475
|
}
|
|
1422
|
-
})
|
|
1476
|
+
});
|
|
1423
1477
|
},
|
|
1424
1478
|
surface: {
|
|
1425
1479
|
component: ({ data, role }) => {
|
|
@@ -1455,7 +1509,7 @@ var DeckPlugin = ({ observability } = {}) => {
|
|
|
1455
1509
|
} else {
|
|
1456
1510
|
log.warn("Invalid layout mode", intent?.data?.layoutMode, {
|
|
1457
1511
|
F: __dxlog_file,
|
|
1458
|
-
L:
|
|
1512
|
+
L: 404,
|
|
1459
1513
|
S: void 0,
|
|
1460
1514
|
C: (f, a) => f(...a)
|
|
1461
1515
|
});
|
|
@@ -1501,7 +1555,7 @@ var DeckPlugin = ({ observability } = {}) => {
|
|
|
1501
1555
|
data: true
|
|
1502
1556
|
};
|
|
1503
1557
|
}
|
|
1504
|
-
case
|
|
1558
|
+
case NavigationAction4.OPEN: {
|
|
1505
1559
|
const previouslyOpenIds = new Set(openIds2(location.values.active));
|
|
1506
1560
|
const layoutMode = layout.values.layoutMode;
|
|
1507
1561
|
batch(() => {
|
|
@@ -1510,7 +1564,7 @@ var DeckPlugin = ({ observability } = {}) => {
|
|
|
1510
1564
|
}
|
|
1511
1565
|
const processLayoutEntry = (partName, entryString, currentLayout) => {
|
|
1512
1566
|
const toggle = true;
|
|
1513
|
-
const [id, path] = entryString.split(
|
|
1567
|
+
const [id, path] = entryString.split(SLUG_PATH_SEPARATOR4);
|
|
1514
1568
|
const layoutEntry = {
|
|
1515
1569
|
id,
|
|
1516
1570
|
...path ? {
|
|
@@ -1539,7 +1593,7 @@ var DeckPlugin = ({ observability } = {}) => {
|
|
|
1539
1593
|
newLayout = processLayoutEntry(partName, layoutEntries, newLayout);
|
|
1540
1594
|
}
|
|
1541
1595
|
});
|
|
1542
|
-
|
|
1596
|
+
handleSetLocation(newLayout);
|
|
1543
1597
|
});
|
|
1544
1598
|
const ids = openIds2(location.values.active);
|
|
1545
1599
|
const newlyOpen = ids.filter((i) => !previouslyOpenIds.has(i));
|
|
@@ -1558,7 +1612,7 @@ var DeckPlugin = ({ observability } = {}) => {
|
|
|
1558
1612
|
] : [],
|
|
1559
1613
|
intent.data?.object ? [
|
|
1560
1614
|
{
|
|
1561
|
-
action:
|
|
1615
|
+
action: NavigationAction4.EXPOSE,
|
|
1562
1616
|
data: {
|
|
1563
1617
|
id: fullyQualifiedId(intent.data.object)
|
|
1564
1618
|
}
|
|
@@ -1581,16 +1635,16 @@ var DeckPlugin = ({ observability } = {}) => {
|
|
|
1581
1635
|
]
|
|
1582
1636
|
};
|
|
1583
1637
|
}
|
|
1584
|
-
case
|
|
1638
|
+
case NavigationAction4.ADD_TO_ACTIVE: {
|
|
1585
1639
|
const data = intent.data;
|
|
1586
1640
|
const layoutEntry = {
|
|
1587
1641
|
id: data.id
|
|
1588
1642
|
};
|
|
1589
1643
|
const effectivePart = getEffectivePart(data.part, layout.values.layoutMode);
|
|
1590
|
-
|
|
1644
|
+
handleSetLocation(openEntry(location.values.active, effectivePart, layoutEntry, {
|
|
1591
1645
|
positioning: data.positioning ?? settings.values.newPlankPositioning,
|
|
1592
1646
|
pivotId: data.pivotId
|
|
1593
|
-
});
|
|
1647
|
+
}));
|
|
1594
1648
|
const intents = [];
|
|
1595
1649
|
if (data.scrollIntoView && layout.values.layoutMode === "deck") {
|
|
1596
1650
|
intents.push([
|
|
@@ -1607,7 +1661,7 @@ var DeckPlugin = ({ observability } = {}) => {
|
|
|
1607
1661
|
intents
|
|
1608
1662
|
};
|
|
1609
1663
|
}
|
|
1610
|
-
case
|
|
1664
|
+
case NavigationAction4.CLOSE: {
|
|
1611
1665
|
return batch(() => {
|
|
1612
1666
|
if (!intent.data) {
|
|
1613
1667
|
return;
|
|
@@ -1632,32 +1686,32 @@ var DeckPlugin = ({ observability } = {}) => {
|
|
|
1632
1686
|
});
|
|
1633
1687
|
}
|
|
1634
1688
|
});
|
|
1635
|
-
|
|
1689
|
+
handleSetLocation(newLayout);
|
|
1636
1690
|
return {
|
|
1637
1691
|
data: true
|
|
1638
1692
|
};
|
|
1639
1693
|
});
|
|
1640
1694
|
}
|
|
1641
1695
|
// TODO(wittjosiah): Factor out.
|
|
1642
|
-
case
|
|
1696
|
+
case NavigationAction4.SET: {
|
|
1643
1697
|
return batch(() => {
|
|
1644
1698
|
if (isLayoutParts(intent.data?.activeParts)) {
|
|
1645
|
-
|
|
1699
|
+
handleSetLocation(intent.data.activeParts);
|
|
1646
1700
|
}
|
|
1647
1701
|
return {
|
|
1648
1702
|
data: true
|
|
1649
1703
|
};
|
|
1650
1704
|
});
|
|
1651
1705
|
}
|
|
1652
|
-
case
|
|
1706
|
+
case NavigationAction4.ADJUST: {
|
|
1653
1707
|
return batch(() => {
|
|
1654
1708
|
if (isLayoutAdjustment(intent.data)) {
|
|
1655
1709
|
const adjustment = intent.data;
|
|
1656
1710
|
if (adjustment.type === "increment-end" || adjustment.type === "increment-start") {
|
|
1657
|
-
|
|
1711
|
+
handleSetLocation(incrementPlank(location.values.active, {
|
|
1658
1712
|
type: adjustment.type,
|
|
1659
1713
|
layoutCoordinate: adjustment.layoutCoordinate
|
|
1660
|
-
});
|
|
1714
|
+
}));
|
|
1661
1715
|
}
|
|
1662
1716
|
if (adjustment.type === "solo") {
|
|
1663
1717
|
const entryId = adjustment.layoutCoordinate.entryId;
|
|
@@ -1673,7 +1727,7 @@ var DeckPlugin = ({ observability } = {}) => {
|
|
|
1673
1727
|
}
|
|
1674
1728
|
},
|
|
1675
1729
|
{
|
|
1676
|
-
action:
|
|
1730
|
+
action: NavigationAction4.OPEN,
|
|
1677
1731
|
data: {
|
|
1678
1732
|
activeParts: {
|
|
1679
1733
|
solo: [
|
|
@@ -1697,7 +1751,7 @@ var DeckPlugin = ({ observability } = {}) => {
|
|
|
1697
1751
|
}
|
|
1698
1752
|
},
|
|
1699
1753
|
{
|
|
1700
|
-
action:
|
|
1754
|
+
action: NavigationAction4.CLOSE,
|
|
1701
1755
|
data: {
|
|
1702
1756
|
activeParts: {
|
|
1703
1757
|
solo: [
|
|
@@ -1707,7 +1761,7 @@ var DeckPlugin = ({ observability } = {}) => {
|
|
|
1707
1761
|
}
|
|
1708
1762
|
},
|
|
1709
1763
|
{
|
|
1710
|
-
action:
|
|
1764
|
+
action: NavigationAction4.OPEN,
|
|
1711
1765
|
data: {
|
|
1712
1766
|
noToggle: true,
|
|
1713
1767
|
activeParts: {
|