@dxos/plugin-deck 0.6.13 → 0.6.14-main.7bd9c89
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 +245 -189
- 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/DeckLayout/Toast.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 +5 -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 +30 -29
- package/src/DeckPlugin.tsx +93 -71
- package/src/components/DeckLayout/ComplementarySidebar.tsx +69 -27
- 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/DeckLayout/Toast.tsx +3 -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 +7 -3
- 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,64 @@ 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
|
+
{
|
|
316
|
+
id: "settings",
|
|
317
|
+
icon: "ph--gear--regular"
|
|
318
|
+
},
|
|
319
|
+
{
|
|
320
|
+
id: "comments",
|
|
321
|
+
icon: "ph--chat-text--regular"
|
|
322
|
+
},
|
|
323
|
+
{
|
|
324
|
+
id: "automation",
|
|
325
|
+
icon: "ph--atom--regular"
|
|
326
|
+
},
|
|
327
|
+
{
|
|
328
|
+
id: "debug",
|
|
329
|
+
icon: "ph--bug--regular"
|
|
330
|
+
}
|
|
331
|
+
];
|
|
332
|
+
var getPanel = (id) => {
|
|
333
|
+
const panel = panels.find((p) => p.id === id) ?? panels[0];
|
|
334
|
+
return panel.id;
|
|
335
|
+
};
|
|
336
|
+
var ComplementarySidebar = ({ layoutParts, flatDeck }) => {
|
|
318
337
|
const { popoverAnchorId } = useLayout();
|
|
338
|
+
const attended = useAttended();
|
|
339
|
+
const part = getPanel(layoutParts.complementary?.[0].id);
|
|
340
|
+
const id = attended[0] ? `${attended[0]}${SLUG_PATH_SEPARATOR2}${part}` : void 0;
|
|
319
341
|
const { graph } = useGraph3();
|
|
320
342
|
const node = useNode(graph, id);
|
|
321
|
-
const
|
|
343
|
+
const dispatch = useIntentDispatcher2();
|
|
322
344
|
useNodeActionExpander(node);
|
|
323
|
-
|
|
345
|
+
const actions = useMemo(() => panels.map(({ id: id2, icon }) => ({
|
|
346
|
+
id: `complementary-${id2}`,
|
|
347
|
+
data: () => {
|
|
348
|
+
void dispatch({
|
|
349
|
+
action: NavigationAction2.OPEN,
|
|
350
|
+
data: {
|
|
351
|
+
activeParts: {
|
|
352
|
+
complementary: id2
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
});
|
|
356
|
+
},
|
|
357
|
+
properties: {
|
|
358
|
+
label: [
|
|
359
|
+
`open ${id2} label`,
|
|
360
|
+
{
|
|
361
|
+
ns: DECK_PLUGIN
|
|
362
|
+
}
|
|
363
|
+
],
|
|
364
|
+
icon,
|
|
365
|
+
menuItemType: "toggle",
|
|
366
|
+
isChecked: part === id2
|
|
367
|
+
}
|
|
368
|
+
})), [
|
|
369
|
+
part
|
|
370
|
+
]);
|
|
371
|
+
return /* @__PURE__ */ React5.createElement(Main.ComplementarySidebar, null, /* @__PURE__ */ React5.createElement("div", {
|
|
324
372
|
role: "none",
|
|
325
373
|
className: mx2(deckGrid, "grid-cols-1 bs-full")
|
|
326
374
|
}, /* @__PURE__ */ React5.createElement(NodePlankHeading, {
|
|
@@ -329,18 +377,19 @@ var ComplementarySidebar = ({ id, layoutParts, flatDeck }) => {
|
|
|
329
377
|
layoutParts,
|
|
330
378
|
layoutPart: "complementary",
|
|
331
379
|
popoverAnchorId,
|
|
332
|
-
flatDeck
|
|
333
|
-
|
|
334
|
-
|
|
380
|
+
flatDeck,
|
|
381
|
+
actions
|
|
382
|
+
}), /* @__PURE__ */ React5.createElement("div", {
|
|
383
|
+
className: "row-span-2 divide-y divide-separator"
|
|
384
|
+
}, node && /* @__PURE__ */ React5.createElement(Surface3, {
|
|
385
|
+
role: `complementary--${part}`,
|
|
335
386
|
data: {
|
|
336
|
-
subject: node.
|
|
337
|
-
part: "complementary",
|
|
387
|
+
subject: node.properties.object,
|
|
338
388
|
popoverAnchorId
|
|
339
389
|
},
|
|
340
|
-
limit: 1,
|
|
341
390
|
fallback: PlankContentError,
|
|
342
391
|
placeholder: /* @__PURE__ */ React5.createElement(PlankLoading, null)
|
|
343
|
-
}))
|
|
392
|
+
}))));
|
|
344
393
|
};
|
|
345
394
|
|
|
346
395
|
// packages/plugins/plugin-deck/src/components/DeckLayout/ContentEmpty.tsx
|
|
@@ -401,11 +450,11 @@ var Fullscreen = ({ id }) => {
|
|
|
401
450
|
// packages/plugins/plugin-deck/src/components/DeckLayout/Plank.tsx
|
|
402
451
|
import { Plus } from "@phosphor-icons/react";
|
|
403
452
|
import React9, { useCallback, useLayoutEffect, useRef } from "react";
|
|
404
|
-
import { LayoutAction as LayoutAction2, NavigationAction as
|
|
453
|
+
import { LayoutAction as LayoutAction2, NavigationAction as NavigationAction3, Surface as Surface6, useIntentDispatcher as useIntentDispatcher3 } from "@dxos/app-framework";
|
|
405
454
|
import { debounce } from "@dxos/async";
|
|
406
455
|
import { useGraph as useGraph5 } from "@dxos/plugin-graph";
|
|
407
456
|
import { Button, Tooltip, useTranslation as useTranslation4 } from "@dxos/react-ui";
|
|
408
|
-
import {
|
|
457
|
+
import { useAttendableAttributes } from "@dxos/react-ui-attention";
|
|
409
458
|
import { Plank as NaturalPlank } from "@dxos/react-ui-deck";
|
|
410
459
|
import { mainIntrinsicSize } from "@dxos/react-ui-theme";
|
|
411
460
|
|
|
@@ -418,14 +467,14 @@ var useDeckContext = () => useContext2(DeckContext) ?? raise2(new Error("Missing
|
|
|
418
467
|
// packages/plugins/plugin-deck/src/components/DeckLayout/Plank.tsx
|
|
419
468
|
var Plank = ({ entry, layoutParts, part, flatDeck, searchEnabled, layoutMode }) => {
|
|
420
469
|
const { t } = useTranslation4(DECK_PLUGIN);
|
|
421
|
-
const dispatch =
|
|
470
|
+
const dispatch = useIntentDispatcher3();
|
|
422
471
|
const { popoverAnchorId, scrollIntoView } = useLayout();
|
|
423
472
|
const { plankSizing } = useDeckContext();
|
|
424
473
|
const { graph } = useGraph5();
|
|
425
474
|
const node = useNode(graph, entry.id);
|
|
426
475
|
const rootElement = useRef(null);
|
|
427
476
|
const resizeable = layoutMode === "deck";
|
|
428
|
-
const attendableAttrs =
|
|
477
|
+
const attendableAttrs = useAttendableAttributes(entry.id);
|
|
429
478
|
const coordinate = {
|
|
430
479
|
part,
|
|
431
480
|
entryId: entry.id
|
|
@@ -463,7 +512,7 @@ var Plank = ({ entry, layoutParts, part, flatDeck, searchEnabled, layoutMode })
|
|
|
463
512
|
layoutMode
|
|
464
513
|
]);
|
|
465
514
|
const isSolo = layoutMode === "solo" && part === "solo";
|
|
466
|
-
const isSuppressed = layoutMode === "solo" && part !== "solo";
|
|
515
|
+
const isSuppressed = layoutMode === "solo" && part !== "solo" || layoutMode === "deck" && part === "solo";
|
|
467
516
|
const sizeAttrs = useMainSize();
|
|
468
517
|
return /* @__PURE__ */ React9.createElement(NaturalPlank.Root, {
|
|
469
518
|
size,
|
|
@@ -529,7 +578,7 @@ var Plank = ({ entry, layoutParts, part, flatDeck, searchEnabled, layoutMode })
|
|
|
529
578
|
component: "dxos.org/plugin/search/Dialog",
|
|
530
579
|
dialogBlockAlign: "start",
|
|
531
580
|
subject: {
|
|
532
|
-
action:
|
|
581
|
+
action: NavigationAction3.SET,
|
|
533
582
|
position: "add-after",
|
|
534
583
|
coordinate
|
|
535
584
|
}
|
|
@@ -549,12 +598,14 @@ var Plank = ({ entry, layoutParts, part, flatDeck, searchEnabled, layoutMode })
|
|
|
549
598
|
};
|
|
550
599
|
|
|
551
600
|
// packages/plugins/plugin-deck/src/components/DeckLayout/Sidebar.tsx
|
|
552
|
-
import React10, { useMemo } from "react";
|
|
601
|
+
import React10, { useMemo as useMemo2 } from "react";
|
|
553
602
|
import { openIds, Surface as Surface7 } from "@dxos/app-framework";
|
|
554
603
|
import { Main as Main2 } from "@dxos/react-ui";
|
|
555
|
-
|
|
604
|
+
import { useAttended as useAttended2 } from "@dxos/react-ui-attention";
|
|
605
|
+
var Sidebar = ({ layoutParts }) => {
|
|
556
606
|
const { layoutMode, popoverAnchorId } = useLayout();
|
|
557
|
-
const
|
|
607
|
+
const attended = useAttended2();
|
|
608
|
+
const activeIds = useMemo2(() => {
|
|
558
609
|
if (layoutMode === "solo") {
|
|
559
610
|
return new Set(layoutParts?.solo?.map((e) => e.id) ?? []);
|
|
560
611
|
} else if (layoutMode === "deck") {
|
|
@@ -565,14 +616,14 @@ var Sidebar = ({ attention, layoutParts }) => {
|
|
|
565
616
|
layoutParts,
|
|
566
617
|
layoutMode
|
|
567
618
|
]);
|
|
568
|
-
const navigationData =
|
|
619
|
+
const navigationData = useMemo2(() => ({
|
|
569
620
|
popoverAnchorId,
|
|
570
621
|
activeIds,
|
|
571
|
-
attended
|
|
622
|
+
attended
|
|
572
623
|
}), [
|
|
573
624
|
popoverAnchorId,
|
|
574
625
|
activeIds,
|
|
575
|
-
|
|
626
|
+
attended
|
|
576
627
|
]);
|
|
577
628
|
return /* @__PURE__ */ React10.createElement(Main2.NavigationSidebar, null, /* @__PURE__ */ React10.createElement(Surface7, {
|
|
578
629
|
role: "navigation",
|
|
@@ -586,14 +637,19 @@ var Sidebar = ({ attention, layoutParts }) => {
|
|
|
586
637
|
// packages/plugins/plugin-deck/src/components/DeckLayout/StatusBar.tsx
|
|
587
638
|
import React11 from "react";
|
|
588
639
|
import { Surface as Surface8 } from "@dxos/app-framework";
|
|
589
|
-
import { mainPadding, mx as mx4 } from "@dxos/react-ui-theme";
|
|
590
|
-
var StatusBar = () => {
|
|
640
|
+
import { mainPadding, mainPaddingTransitions, mx as mx4 } from "@dxos/react-ui-theme";
|
|
641
|
+
var StatusBar = ({ showHints }) => {
|
|
591
642
|
const sizeAttrs = useMainSize();
|
|
592
643
|
return /* @__PURE__ */ React11.createElement("div", {
|
|
593
644
|
role: "none",
|
|
594
645
|
...sizeAttrs,
|
|
595
|
-
className: mx4("fixed block-end-0 inset-inline-0 z-[2]", mainPadding)
|
|
596
|
-
}, /* @__PURE__ */ React11.createElement(
|
|
646
|
+
className: mx4("fixed flex justify-between block-end-0 inset-inline-0 items-center border-bs border-separator z-[2]", mainPadding, mainPaddingTransitions)
|
|
647
|
+
}, /* @__PURE__ */ React11.createElement("div", {
|
|
648
|
+
role: "none"
|
|
649
|
+
}, showHints && /* @__PURE__ */ React11.createElement(Surface8, {
|
|
650
|
+
role: "hints",
|
|
651
|
+
limit: 1
|
|
652
|
+
})), /* @__PURE__ */ React11.createElement(Surface8, {
|
|
597
653
|
role: "status-bar",
|
|
598
654
|
limit: 1
|
|
599
655
|
}));
|
|
@@ -601,15 +657,19 @@ var StatusBar = () => {
|
|
|
601
657
|
|
|
602
658
|
// packages/plugins/plugin-deck/src/components/DeckLayout/Toast.tsx
|
|
603
659
|
import React12 from "react";
|
|
604
|
-
import { Button as Button2, Toast as NaturalToast } from "@dxos/react-ui";
|
|
660
|
+
import { Button as Button2, Icon as Icon2, Toast as NaturalToast } from "@dxos/react-ui";
|
|
605
661
|
var Toast = ({ id, title, description, icon, duration, actionLabel, actionAlt, closeLabel, onAction, onOpenChange }) => {
|
|
606
662
|
return /* @__PURE__ */ React12.createElement(NaturalToast.Root, {
|
|
607
663
|
"data-testid": id,
|
|
608
664
|
defaultOpen: true,
|
|
609
665
|
duration,
|
|
610
666
|
onOpenChange
|
|
611
|
-
}, /* @__PURE__ */ React12.createElement(NaturalToast.Body, null, /* @__PURE__ */ React12.createElement(NaturalToast.Title,
|
|
612
|
-
|
|
667
|
+
}, /* @__PURE__ */ React12.createElement(NaturalToast.Body, null, /* @__PURE__ */ React12.createElement(NaturalToast.Title, {
|
|
668
|
+
classNames: "items-center"
|
|
669
|
+
}, /* @__PURE__ */ React12.createElement(Icon2, {
|
|
670
|
+
icon,
|
|
671
|
+
size: 5,
|
|
672
|
+
classNames: "inline mr-1"
|
|
613
673
|
}), /* @__PURE__ */ React12.createElement("span", null, title)), description && /* @__PURE__ */ React12.createElement(NaturalToast.Description, null, description)), /* @__PURE__ */ React12.createElement(NaturalToast.Actions, null, onAction && actionAlt && actionLabel && /* @__PURE__ */ React12.createElement(NaturalToast.Action, {
|
|
614
674
|
altText: actionAlt,
|
|
615
675
|
asChild: true
|
|
@@ -646,7 +706,10 @@ var getEffectivePart = (partName, layoutMode) => layoutMode === "solo" && partNa
|
|
|
646
706
|
import { PLANK_DEFAULTS } from "@dxos/react-ui-deck";
|
|
647
707
|
var calculateOverscroll = (planks, plankSizing, sidebarOpen, complementarySidebarOpen) => {
|
|
648
708
|
if (!planks?.length) {
|
|
649
|
-
return
|
|
709
|
+
return {
|
|
710
|
+
paddingInlineStart: 0,
|
|
711
|
+
paddingInlineEnd: 0
|
|
712
|
+
};
|
|
650
713
|
}
|
|
651
714
|
const sidebarWidth = sidebarOpen ? "270px" : "0px";
|
|
652
715
|
const complementarySidebarWidth = complementarySidebarOpen ? "360px" : "0px";
|
|
@@ -656,8 +719,8 @@ var calculateOverscroll = (planks, plankSizing, sidebarOpen, complementarySideba
|
|
|
656
719
|
const plankSize = getPlankSize(plank.id);
|
|
657
720
|
const overscrollPadding = `max(0px, calc(((100dvw - ${sidebarWidth} - ${complementarySidebarWidth} - (${plankSize} + 20px)) / 2)))`;
|
|
658
721
|
return {
|
|
659
|
-
|
|
660
|
-
|
|
722
|
+
paddingInlineStart: overscrollPadding,
|
|
723
|
+
paddingInlineEnd: overscrollPadding
|
|
661
724
|
};
|
|
662
725
|
} else {
|
|
663
726
|
const first = planks[0];
|
|
@@ -665,27 +728,33 @@ var calculateOverscroll = (planks, plankSizing, sidebarOpen, complementarySideba
|
|
|
665
728
|
const last = planks[planks.length - 1];
|
|
666
729
|
const lastSize = getPlankSize(last.id);
|
|
667
730
|
return {
|
|
668
|
-
|
|
669
|
-
|
|
731
|
+
paddingInlineStart: `max(0px, calc(((100dvw - (${firstSize} + 20px)) / 2) - ${sidebarWidth}))`,
|
|
732
|
+
paddingInlineEnd: `max(0px, calc(((100dvw - (${lastSize} + 20px)) / 2) - ${complementarySidebarWidth}))`
|
|
670
733
|
};
|
|
671
734
|
}
|
|
672
735
|
};
|
|
673
736
|
|
|
674
737
|
// packages/plugins/plugin-deck/src/components/DeckLayout/DeckLayout.tsx
|
|
675
|
-
var DeckLayout = ({ layoutParts,
|
|
738
|
+
var DeckLayout = ({ layoutParts, toasts, flatDeck, overscroll, showHints, slots, onDismissToast }) => {
|
|
676
739
|
const context = useLayout();
|
|
677
740
|
const { layoutMode, sidebarOpen, complementarySidebarOpen, dialogOpen, dialogContent, dialogBlockAlign, popoverOpen, popoverContent, popoverAnchorId } = context;
|
|
678
741
|
const { t } = useTranslation5(DECK_PLUGIN);
|
|
679
742
|
const { plankSizing } = useDeckContext();
|
|
743
|
+
const attended = useAttended3();
|
|
680
744
|
const searchPlugin = usePlugin("dxos.org/plugin/search");
|
|
681
|
-
const fullScreenSlug =
|
|
745
|
+
const fullScreenSlug = useMemo3(() => firstIdInPart(layoutParts, "fullScreen"), [
|
|
682
746
|
layoutParts
|
|
683
747
|
]);
|
|
684
|
-
const
|
|
748
|
+
const scrollLeftRef = useRef2();
|
|
685
749
|
const deckRef = useRef2(null);
|
|
686
|
-
|
|
750
|
+
useEffect5(() => {
|
|
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
|
+
}, []);
|
|
687
756
|
const handleResize = useCallback2(() => {
|
|
688
|
-
|
|
757
|
+
scrollLeftRef.current = null;
|
|
689
758
|
}, []);
|
|
690
759
|
useEffect5(() => {
|
|
691
760
|
window.addEventListener("resize", handleResize);
|
|
@@ -693,36 +762,20 @@ var DeckLayout = ({ layoutParts, attention, toasts, flatDeck, overscroll, showHi
|
|
|
693
762
|
}, [
|
|
694
763
|
handleResize
|
|
695
764
|
]);
|
|
696
|
-
|
|
697
|
-
if (
|
|
698
|
-
|
|
699
|
-
} else if (restoreScrollRef.current && deckRef.current && scrollLeft) {
|
|
700
|
-
deckRef.current.scrollLeft = scrollLeft;
|
|
701
|
-
restoreScrollRef.current = false;
|
|
765
|
+
const restoreScroll = useCallback2(() => {
|
|
766
|
+
if (deckRef.current && scrollLeftRef.current != null) {
|
|
767
|
+
deckRef.current.scrollLeft = scrollLeftRef.current;
|
|
702
768
|
}
|
|
703
|
-
}, [
|
|
704
|
-
|
|
705
|
-
deckRef.current,
|
|
706
|
-
scrollLeft
|
|
707
|
-
]);
|
|
769
|
+
}, []);
|
|
770
|
+
useOnTransition(layoutMode, (mode) => mode !== "deck", "deck", restoreScroll);
|
|
708
771
|
const handleScroll = useCallback2((event) => {
|
|
709
772
|
if (layoutMode === "deck" && event.currentTarget === event.target) {
|
|
710
|
-
|
|
773
|
+
scrollLeftRef.current = event.target.scrollLeft;
|
|
711
774
|
}
|
|
712
775
|
}, [
|
|
713
776
|
layoutMode
|
|
714
777
|
]);
|
|
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
|
-
]);
|
|
778
|
+
const firstAttendedId = attended[0];
|
|
726
779
|
useEffect5(() => {
|
|
727
780
|
if (layoutMode === "deck" && firstAttendedId) {
|
|
728
781
|
}
|
|
@@ -730,21 +783,20 @@ var DeckLayout = ({ layoutParts, attention, toasts, flatDeck, overscroll, showHi
|
|
|
730
783
|
layoutMode,
|
|
731
784
|
firstAttendedId
|
|
732
785
|
]);
|
|
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
|
-
}
|
|
786
|
+
const isEmpty = layoutParts.main?.length === 0 && layoutParts.solo?.length === 0;
|
|
787
|
+
const padding = useMemo3(() => {
|
|
788
|
+
if (layoutMode === "deck" && overscroll === "centering") {
|
|
789
|
+
return calculateOverscroll(layoutParts.main, plankSizing, sidebarOpen, complementarySidebarOpen);
|
|
741
790
|
}
|
|
742
|
-
return
|
|
791
|
+
return {};
|
|
743
792
|
}, [
|
|
793
|
+
layoutMode,
|
|
794
|
+
overscroll,
|
|
744
795
|
layoutParts.main,
|
|
745
|
-
|
|
796
|
+
plankSizing,
|
|
797
|
+
sidebarOpen,
|
|
798
|
+
complementarySidebarOpen
|
|
746
799
|
]);
|
|
747
|
-
const padding = layoutMode === "deck" && overscroll === "centering" ? calculateOverscroll(layoutParts.main, plankSizing, sidebarOpen, complementarySidebarOpen) : {};
|
|
748
800
|
if (layoutMode === "fullscreen") {
|
|
749
801
|
return /* @__PURE__ */ React13.createElement(Fullscreen, {
|
|
750
802
|
id: fullScreenSlug
|
|
@@ -766,19 +818,13 @@ var DeckLayout = ({ layoutParts, attention, toasts, flatDeck, overscroll, showHi
|
|
|
766
818
|
}), /* @__PURE__ */ React13.createElement(Main3.Root, {
|
|
767
819
|
navigationSidebarOpen: context.sidebarOpen,
|
|
768
820
|
onNavigationSidebarOpenChange: (next) => context.sidebarOpen = next,
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
/* complementaryAvailable && */
|
|
772
|
-
context.complementarySidebarOpen
|
|
773
|
-
),
|
|
774
|
-
onComplementarySidebarOpenChange: (next) => context.complementarySidebarOpen = next
|
|
775
|
-
}
|
|
821
|
+
complementarySidebarOpen: context.complementarySidebarOpen,
|
|
822
|
+
onComplementarySidebarOpenChange: (next) => context.complementarySidebarOpen = next
|
|
776
823
|
}, /* @__PURE__ */ React13.createElement(Main3.Notch, {
|
|
777
824
|
classNames: "z-[21]"
|
|
778
825
|
}, /* @__PURE__ */ React13.createElement(Surface9, {
|
|
779
826
|
role: "notch-start"
|
|
780
827
|
}), /* @__PURE__ */ React13.createElement(Button3, {
|
|
781
|
-
// disabled={!sidebarAvailable}
|
|
782
828
|
onClick: () => context.sidebarOpen = !context.sidebarOpen,
|
|
783
829
|
variant: "ghost",
|
|
784
830
|
classNames: "p-1"
|
|
@@ -788,7 +834,6 @@ var DeckLayout = ({ layoutParts, attention, toasts, flatDeck, overscroll, showHi
|
|
|
788
834
|
weight: "light",
|
|
789
835
|
className: getSize(5)
|
|
790
836
|
})), /* @__PURE__ */ React13.createElement(Button3, {
|
|
791
|
-
// disabled={!complementaryAvailable}
|
|
792
837
|
onClick: () => context.complementarySidebarOpen = !context.complementarySidebarOpen,
|
|
793
838
|
variant: "ghost",
|
|
794
839
|
classNames: "p-1"
|
|
@@ -801,15 +846,14 @@ var DeckLayout = ({ layoutParts, attention, toasts, flatDeck, overscroll, showHi
|
|
|
801
846
|
})), /* @__PURE__ */ React13.createElement(Surface9, {
|
|
802
847
|
role: "notch-end"
|
|
803
848
|
})), /* @__PURE__ */ React13.createElement(Sidebar, {
|
|
804
|
-
attention,
|
|
805
849
|
layoutParts
|
|
806
850
|
}), /* @__PURE__ */ React13.createElement(ComplementarySidebar, {
|
|
807
|
-
|
|
851
|
+
context: "comments",
|
|
808
852
|
layoutParts,
|
|
809
853
|
flatDeck
|
|
810
|
-
}), /* @__PURE__ */ React13.createElement(Main3.Overlay, null),
|
|
854
|
+
}), /* @__PURE__ */ React13.createElement(Main3.Overlay, null), isEmpty && /* @__PURE__ */ React13.createElement(Main3.Content, {
|
|
811
855
|
handlesFocus: true
|
|
812
|
-
}, /* @__PURE__ */ React13.createElement(ContentEmpty, null)),
|
|
856
|
+
}, /* @__PURE__ */ React13.createElement(ContentEmpty, null)), !isEmpty && /* @__PURE__ */ React13.createElement(Main3.Content, {
|
|
813
857
|
bounce: true,
|
|
814
858
|
classNames: "grid block-end-[--statusbar-size]",
|
|
815
859
|
handlesFocus: true
|
|
@@ -820,26 +864,33 @@ var DeckLayout = ({ layoutParts, attention, toasts, flatDeck, overscroll, showHi
|
|
|
820
864
|
style: padding,
|
|
821
865
|
classNames: [
|
|
822
866
|
!flatDeck && "bg-deck",
|
|
867
|
+
mainPaddingTransitions2,
|
|
823
868
|
"absolute inset-0",
|
|
824
869
|
slots?.wallpaper?.classNames
|
|
825
870
|
],
|
|
826
871
|
solo: layoutMode === "solo",
|
|
827
872
|
onScroll: handleScroll,
|
|
828
873
|
ref: deckRef
|
|
829
|
-
},
|
|
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, {
|
|
830
884
|
key: layoutEntry.id,
|
|
831
885
|
entry: layoutEntry,
|
|
832
886
|
layoutParts,
|
|
833
|
-
part:
|
|
887
|
+
part: "main",
|
|
834
888
|
layoutMode,
|
|
835
889
|
flatDeck,
|
|
836
890
|
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, {
|
|
891
|
+
}))))), /* @__PURE__ */ React13.createElement(StatusBar, {
|
|
892
|
+
showHints
|
|
893
|
+
}), /* @__PURE__ */ React13.createElement(Popover2.Portal, null, /* @__PURE__ */ React13.createElement(Popover2.Content, {
|
|
843
894
|
classNames: "z-[60]",
|
|
844
895
|
onEscapeKeyDown: () => {
|
|
845
896
|
context.popoverOpen = false;
|
|
@@ -908,31 +959,31 @@ var LayoutSettings = ({ settings }) => {
|
|
|
908
959
|
key: option,
|
|
909
960
|
value: option
|
|
910
961
|
}, t(`settings overscroll ${option} label`)))))))), /* @__PURE__ */ React14.createElement(SettingsValue, {
|
|
911
|
-
label: t("settings show
|
|
962
|
+
label: t("settings show hints label")
|
|
912
963
|
}, /* @__PURE__ */ React14.createElement(Input.Switch, {
|
|
913
|
-
checked: settings.
|
|
914
|
-
onCheckedChange: (checked) => settings.
|
|
964
|
+
checked: settings.showHints,
|
|
965
|
+
onCheckedChange: (checked) => settings.showHints = checked
|
|
915
966
|
})), !isSocket && /* @__PURE__ */ React14.createElement(SettingsValue, {
|
|
916
967
|
label: t("settings native redirect label")
|
|
917
968
|
}, /* @__PURE__ */ React14.createElement(Input.Switch, {
|
|
918
969
|
checked: settings.enableNativeRedirect,
|
|
919
|
-
onCheckedChange: (checked) => settings.enableNativeRedirect =
|
|
970
|
+
onCheckedChange: (checked) => settings.enableNativeRedirect = checked
|
|
920
971
|
})), /* @__PURE__ */ React14.createElement(SettingsValue, {
|
|
921
972
|
label: t("settings custom slots")
|
|
922
973
|
}, /* @__PURE__ */ React14.createElement(Input.Switch, {
|
|
923
974
|
checked: settings.customSlots,
|
|
924
|
-
onCheckedChange: (checked) => settings.customSlots =
|
|
975
|
+
onCheckedChange: (checked) => settings.customSlots = checked
|
|
925
976
|
})), /* @__PURE__ */ React14.createElement(SettingsValue, {
|
|
926
977
|
label: t("settings flat deck")
|
|
927
978
|
}, /* @__PURE__ */ React14.createElement(Input.Switch, {
|
|
928
979
|
checked: settings.flatDeck,
|
|
929
|
-
onCheckedChange: (checked) => settings.flatDeck =
|
|
980
|
+
onCheckedChange: (checked) => settings.flatDeck = checked
|
|
930
981
|
})));
|
|
931
982
|
};
|
|
932
983
|
|
|
933
984
|
// packages/plugins/plugin-deck/src/layout.ts
|
|
934
985
|
import { produce } from "immer";
|
|
935
|
-
import { SLUG_ENTRY_SEPARATOR, SLUG_KEY_VALUE_SEPARATOR, SLUG_LIST_SEPARATOR, SLUG_PATH_SEPARATOR as
|
|
986
|
+
import { SLUG_ENTRY_SEPARATOR, SLUG_KEY_VALUE_SEPARATOR, SLUG_LIST_SEPARATOR, SLUG_PATH_SEPARATOR as SLUG_PATH_SEPARATOR3 } from "@dxos/app-framework";
|
|
936
987
|
var partsThatSupportIncrement = [
|
|
937
988
|
"main"
|
|
938
989
|
];
|
|
@@ -1045,7 +1096,7 @@ var mergeLayoutParts = (...layoutParts) => {
|
|
|
1045
1096
|
}), {});
|
|
1046
1097
|
};
|
|
1047
1098
|
var parseLayoutEntry = (itemString) => {
|
|
1048
|
-
const [id, path] = itemString.split(
|
|
1099
|
+
const [id, path] = itemString.split(SLUG_PATH_SEPARATOR3);
|
|
1049
1100
|
const entry = {
|
|
1050
1101
|
id
|
|
1051
1102
|
};
|
|
@@ -1072,7 +1123,7 @@ var soloPartToUri = (layout) => {
|
|
|
1072
1123
|
return "";
|
|
1073
1124
|
}
|
|
1074
1125
|
const entry = soloPart[0];
|
|
1075
|
-
return `${entry.id}${entry.path ?
|
|
1126
|
+
return `${entry.id}${entry.path ? SLUG_PATH_SEPARATOR3 + entry.path : ""}`;
|
|
1076
1127
|
};
|
|
1077
1128
|
|
|
1078
1129
|
// packages/plugins/plugin-deck/src/translations.ts
|
|
@@ -1083,12 +1134,11 @@ var translations_default = [
|
|
|
1083
1134
|
"main header label": "Main header",
|
|
1084
1135
|
"open navigation sidebar label": "Open navigation sidebar.",
|
|
1085
1136
|
"open complementary sidebar label": "Open complementary sidebar.",
|
|
1086
|
-
"open settings label": "Show settings",
|
|
1087
1137
|
"plugin error message": "Content failed to render.",
|
|
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",
|
|
@@ -1099,7 +1149,6 @@ var translations_default = [
|
|
|
1099
1149
|
"undo action label": "Undo",
|
|
1100
1150
|
"undo action alt": "Undo previous action",
|
|
1101
1151
|
"undo close label": "Dismiss",
|
|
1102
|
-
"open comments label": "Open comments",
|
|
1103
1152
|
"error fallback message": "Unable to open this item",
|
|
1104
1153
|
"plank heading fallback label": "Untitled",
|
|
1105
1154
|
"actions menu label": "Options",
|
|
@@ -1112,7 +1161,12 @@ var translations_default = [
|
|
|
1112
1161
|
"select overscroll placeholder": "Select plank overscrolling behavior",
|
|
1113
1162
|
"settings overscroll centering label": "Centering",
|
|
1114
1163
|
"settings overscroll none label": "None",
|
|
1115
|
-
"settings flat deck": "Flatten deck appearance"
|
|
1164
|
+
"settings flat deck": "Flatten deck appearance",
|
|
1165
|
+
// ComplementarySidebar
|
|
1166
|
+
"open settings label": "Show settings",
|
|
1167
|
+
"open comments label": "Show Comments",
|
|
1168
|
+
"open automation label": "Show Automation",
|
|
1169
|
+
"open debug label": "Show Debug"
|
|
1116
1170
|
}
|
|
1117
1171
|
}
|
|
1118
1172
|
}
|
|
@@ -1142,7 +1196,7 @@ var DeckPlugin = ({ observability } = {}) => {
|
|
|
1142
1196
|
let currentUndoId;
|
|
1143
1197
|
let handleNavigation;
|
|
1144
1198
|
const settings = new LocalStorageStore("dxos.org/settings/layout", {
|
|
1145
|
-
|
|
1199
|
+
showHints: false,
|
|
1146
1200
|
customSlots: false,
|
|
1147
1201
|
flatDeck: false,
|
|
1148
1202
|
enableNativeRedirect: false,
|
|
@@ -1227,6 +1281,22 @@ var DeckPlugin = ({ observability } = {}) => {
|
|
|
1227
1281
|
}
|
|
1228
1282
|
}
|
|
1229
1283
|
};
|
|
1284
|
+
const handleSetLocation = (next) => {
|
|
1285
|
+
if (attentionPlugin) {
|
|
1286
|
+
const attended = attentionPlugin.provides.attention.attended;
|
|
1287
|
+
const [attendedId] = Array.from(attended);
|
|
1288
|
+
const ids = (layout.values.layoutMode === "deck" ? next.main : next.solo)?.map(({ id }) => id) ?? [];
|
|
1289
|
+
const isAttendedAvailable = !!attendedId && ids.includes(attendedId);
|
|
1290
|
+
if (!isAttendedAvailable) {
|
|
1291
|
+
requestAnimationFrame(() => {
|
|
1292
|
+
const nextAttended = layout.values.layoutMode === "solo" ? next.solo?.[0].id : next.main?.[0]?.id;
|
|
1293
|
+
const article = document.querySelector(`article[data-attendable-id="${nextAttended}"]`);
|
|
1294
|
+
article?.focus();
|
|
1295
|
+
});
|
|
1296
|
+
}
|
|
1297
|
+
}
|
|
1298
|
+
location.values.active = next;
|
|
1299
|
+
};
|
|
1230
1300
|
return {
|
|
1231
1301
|
meta: meta_default,
|
|
1232
1302
|
ready: async (plugins) => {
|
|
@@ -1267,8 +1337,8 @@ var DeckPlugin = ({ observability } = {}) => {
|
|
|
1267
1337
|
deck.expunge();
|
|
1268
1338
|
}));
|
|
1269
1339
|
settings.prop({
|
|
1270
|
-
key: "
|
|
1271
|
-
storageKey: "show-
|
|
1340
|
+
key: "showHints",
|
|
1341
|
+
storageKey: "show-hints",
|
|
1272
1342
|
type: LocalStorageStore.bool()
|
|
1273
1343
|
}).prop({
|
|
1274
1344
|
key: "customSlots",
|
|
@@ -1301,13 +1371,13 @@ var DeckPlugin = ({ observability } = {}) => {
|
|
|
1301
1371
|
handleNavigation = async () => {
|
|
1302
1372
|
const pathname = window.location.pathname;
|
|
1303
1373
|
if (pathname === "/reset") {
|
|
1304
|
-
|
|
1374
|
+
handleSetLocation({
|
|
1305
1375
|
sidebar: [
|
|
1306
1376
|
{
|
|
1307
1377
|
id: NAV_ID
|
|
1308
1378
|
}
|
|
1309
1379
|
]
|
|
1310
|
-
};
|
|
1380
|
+
});
|
|
1311
1381
|
location.values.closed = [];
|
|
1312
1382
|
layout.values.layoutMode = "solo";
|
|
1313
1383
|
window.location.pathname = "/";
|
|
@@ -1318,26 +1388,16 @@ var DeckPlugin = ({ observability } = {}) => {
|
|
|
1318
1388
|
return;
|
|
1319
1389
|
}
|
|
1320
1390
|
const startingLayout = removePart(location.values.active, "solo");
|
|
1321
|
-
|
|
1391
|
+
handleSetLocation(mergeLayoutParts(layoutFromUri, startingLayout));
|
|
1322
1392
|
layout.values.layoutMode = "solo";
|
|
1323
1393
|
};
|
|
1324
1394
|
await handleNavigation();
|
|
1325
1395
|
window.addEventListener("popstate", handleNavigation);
|
|
1326
|
-
unsubscriptionCallbacks.push(
|
|
1327
|
-
|
|
1396
|
+
unsubscriptionCallbacks.push(scheduledEffect(() => ({
|
|
1397
|
+
selectedPath: soloPartToUri(location.values.active)
|
|
1398
|
+
}), ({ selectedPath }) => {
|
|
1328
1399
|
history.pushState(null, "", `/${selectedPath}${window.location.search}`);
|
|
1329
1400
|
}));
|
|
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
1401
|
layoutModeHistory.values.push(`${layout.values.layoutMode}`);
|
|
1342
1402
|
},
|
|
1343
1403
|
unload: async () => {
|
|
@@ -1380,8 +1440,7 @@ var DeckPlugin = ({ observability } = {}) => {
|
|
|
1380
1440
|
ns: DECK_PLUGIN
|
|
1381
1441
|
}
|
|
1382
1442
|
],
|
|
1383
|
-
icon:
|
|
1384
|
-
iconSymbol: "ph--arrows-out--regular",
|
|
1443
|
+
icon: "ph--arrows-out--regular",
|
|
1385
1444
|
keyBinding: {
|
|
1386
1445
|
macos: "ctrl+meta+f",
|
|
1387
1446
|
windows: "shift+ctrl+f"
|
|
@@ -1398,12 +1457,9 @@ var DeckPlugin = ({ observability } = {}) => {
|
|
|
1398
1457
|
value: deck.values
|
|
1399
1458
|
}, props.children)),
|
|
1400
1459
|
root: () => {
|
|
1401
|
-
return /* @__PURE__ */ React15.createElement(
|
|
1402
|
-
attention: attentionPlugin?.provides.attention ?? {
|
|
1403
|
-
attended: /* @__PURE__ */ new Set()
|
|
1404
|
-
},
|
|
1460
|
+
return /* @__PURE__ */ React15.createElement(DeckLayout, {
|
|
1405
1461
|
layoutParts: location.values.active,
|
|
1406
|
-
|
|
1462
|
+
showHints: settings.values.showHints,
|
|
1407
1463
|
overscroll: settings.values.overscroll,
|
|
1408
1464
|
flatDeck: settings.values.flatDeck,
|
|
1409
1465
|
slots: settings.values.customSlots ? customSlots : void 0,
|
|
@@ -1419,7 +1475,7 @@ var DeckPlugin = ({ observability } = {}) => {
|
|
|
1419
1475
|
}, 1e3);
|
|
1420
1476
|
}
|
|
1421
1477
|
}
|
|
1422
|
-
})
|
|
1478
|
+
});
|
|
1423
1479
|
},
|
|
1424
1480
|
surface: {
|
|
1425
1481
|
component: ({ data, role }) => {
|
|
@@ -1455,7 +1511,7 @@ var DeckPlugin = ({ observability } = {}) => {
|
|
|
1455
1511
|
} else {
|
|
1456
1512
|
log.warn("Invalid layout mode", intent?.data?.layoutMode, {
|
|
1457
1513
|
F: __dxlog_file,
|
|
1458
|
-
L:
|
|
1514
|
+
L: 404,
|
|
1459
1515
|
S: void 0,
|
|
1460
1516
|
C: (f, a) => f(...a)
|
|
1461
1517
|
});
|
|
@@ -1501,7 +1557,7 @@ var DeckPlugin = ({ observability } = {}) => {
|
|
|
1501
1557
|
data: true
|
|
1502
1558
|
};
|
|
1503
1559
|
}
|
|
1504
|
-
case
|
|
1560
|
+
case NavigationAction4.OPEN: {
|
|
1505
1561
|
const previouslyOpenIds = new Set(openIds2(location.values.active));
|
|
1506
1562
|
const layoutMode = layout.values.layoutMode;
|
|
1507
1563
|
batch(() => {
|
|
@@ -1510,7 +1566,7 @@ var DeckPlugin = ({ observability } = {}) => {
|
|
|
1510
1566
|
}
|
|
1511
1567
|
const processLayoutEntry = (partName, entryString, currentLayout) => {
|
|
1512
1568
|
const toggle = true;
|
|
1513
|
-
const [id, path] = entryString.split(
|
|
1569
|
+
const [id, path] = entryString.split(SLUG_PATH_SEPARATOR4);
|
|
1514
1570
|
const layoutEntry = {
|
|
1515
1571
|
id,
|
|
1516
1572
|
...path ? {
|
|
@@ -1539,7 +1595,7 @@ var DeckPlugin = ({ observability } = {}) => {
|
|
|
1539
1595
|
newLayout = processLayoutEntry(partName, layoutEntries, newLayout);
|
|
1540
1596
|
}
|
|
1541
1597
|
});
|
|
1542
|
-
|
|
1598
|
+
handleSetLocation(newLayout);
|
|
1543
1599
|
});
|
|
1544
1600
|
const ids = openIds2(location.values.active);
|
|
1545
1601
|
const newlyOpen = ids.filter((i) => !previouslyOpenIds.has(i));
|
|
@@ -1558,7 +1614,7 @@ var DeckPlugin = ({ observability } = {}) => {
|
|
|
1558
1614
|
] : [],
|
|
1559
1615
|
intent.data?.object ? [
|
|
1560
1616
|
{
|
|
1561
|
-
action:
|
|
1617
|
+
action: NavigationAction4.EXPOSE,
|
|
1562
1618
|
data: {
|
|
1563
1619
|
id: fullyQualifiedId(intent.data.object)
|
|
1564
1620
|
}
|
|
@@ -1581,16 +1637,16 @@ var DeckPlugin = ({ observability } = {}) => {
|
|
|
1581
1637
|
]
|
|
1582
1638
|
};
|
|
1583
1639
|
}
|
|
1584
|
-
case
|
|
1640
|
+
case NavigationAction4.ADD_TO_ACTIVE: {
|
|
1585
1641
|
const data = intent.data;
|
|
1586
1642
|
const layoutEntry = {
|
|
1587
1643
|
id: data.id
|
|
1588
1644
|
};
|
|
1589
1645
|
const effectivePart = getEffectivePart(data.part, layout.values.layoutMode);
|
|
1590
|
-
|
|
1646
|
+
handleSetLocation(openEntry(location.values.active, effectivePart, layoutEntry, {
|
|
1591
1647
|
positioning: data.positioning ?? settings.values.newPlankPositioning,
|
|
1592
1648
|
pivotId: data.pivotId
|
|
1593
|
-
});
|
|
1649
|
+
}));
|
|
1594
1650
|
const intents = [];
|
|
1595
1651
|
if (data.scrollIntoView && layout.values.layoutMode === "deck") {
|
|
1596
1652
|
intents.push([
|
|
@@ -1607,7 +1663,7 @@ var DeckPlugin = ({ observability } = {}) => {
|
|
|
1607
1663
|
intents
|
|
1608
1664
|
};
|
|
1609
1665
|
}
|
|
1610
|
-
case
|
|
1666
|
+
case NavigationAction4.CLOSE: {
|
|
1611
1667
|
return batch(() => {
|
|
1612
1668
|
if (!intent.data) {
|
|
1613
1669
|
return;
|
|
@@ -1632,32 +1688,32 @@ var DeckPlugin = ({ observability } = {}) => {
|
|
|
1632
1688
|
});
|
|
1633
1689
|
}
|
|
1634
1690
|
});
|
|
1635
|
-
|
|
1691
|
+
handleSetLocation(newLayout);
|
|
1636
1692
|
return {
|
|
1637
1693
|
data: true
|
|
1638
1694
|
};
|
|
1639
1695
|
});
|
|
1640
1696
|
}
|
|
1641
1697
|
// TODO(wittjosiah): Factor out.
|
|
1642
|
-
case
|
|
1698
|
+
case NavigationAction4.SET: {
|
|
1643
1699
|
return batch(() => {
|
|
1644
1700
|
if (isLayoutParts(intent.data?.activeParts)) {
|
|
1645
|
-
|
|
1701
|
+
handleSetLocation(intent.data.activeParts);
|
|
1646
1702
|
}
|
|
1647
1703
|
return {
|
|
1648
1704
|
data: true
|
|
1649
1705
|
};
|
|
1650
1706
|
});
|
|
1651
1707
|
}
|
|
1652
|
-
case
|
|
1708
|
+
case NavigationAction4.ADJUST: {
|
|
1653
1709
|
return batch(() => {
|
|
1654
1710
|
if (isLayoutAdjustment(intent.data)) {
|
|
1655
1711
|
const adjustment = intent.data;
|
|
1656
1712
|
if (adjustment.type === "increment-end" || adjustment.type === "increment-start") {
|
|
1657
|
-
|
|
1713
|
+
handleSetLocation(incrementPlank(location.values.active, {
|
|
1658
1714
|
type: adjustment.type,
|
|
1659
1715
|
layoutCoordinate: adjustment.layoutCoordinate
|
|
1660
|
-
});
|
|
1716
|
+
}));
|
|
1661
1717
|
}
|
|
1662
1718
|
if (adjustment.type === "solo") {
|
|
1663
1719
|
const entryId = adjustment.layoutCoordinate.entryId;
|
|
@@ -1673,7 +1729,7 @@ var DeckPlugin = ({ observability } = {}) => {
|
|
|
1673
1729
|
}
|
|
1674
1730
|
},
|
|
1675
1731
|
{
|
|
1676
|
-
action:
|
|
1732
|
+
action: NavigationAction4.OPEN,
|
|
1677
1733
|
data: {
|
|
1678
1734
|
activeParts: {
|
|
1679
1735
|
solo: [
|
|
@@ -1697,7 +1753,7 @@ var DeckPlugin = ({ observability } = {}) => {
|
|
|
1697
1753
|
}
|
|
1698
1754
|
},
|
|
1699
1755
|
{
|
|
1700
|
-
action:
|
|
1756
|
+
action: NavigationAction4.CLOSE,
|
|
1701
1757
|
data: {
|
|
1702
1758
|
activeParts: {
|
|
1703
1759
|
solo: [
|
|
@@ -1707,7 +1763,7 @@ var DeckPlugin = ({ observability } = {}) => {
|
|
|
1707
1763
|
}
|
|
1708
1764
|
},
|
|
1709
1765
|
{
|
|
1710
|
-
action:
|
|
1766
|
+
action: NavigationAction4.OPEN,
|
|
1711
1767
|
data: {
|
|
1712
1768
|
noToggle: true,
|
|
1713
1769
|
activeParts: {
|