@dxos/plugin-deck 0.7.4 → 0.7.5-main.937ce75
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-ZC3K6C2W.mjs +37 -0
- package/dist/lib/browser/chunk-ZC3K6C2W.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +392 -420
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/types.mjs +6 -1
- package/dist/types/src/DeckPlugin.d.ts +1 -10
- package/dist/types/src/DeckPlugin.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/ComplementarySidebar.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/DeckLayout.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/NodePlankHeading.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/Plank.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/PlankControls.d.ts +2 -2
- package/dist/types/src/components/DeckLayout/PlankControls.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/Sidebar.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/Toast.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +3 -0
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types.d.ts +16 -0
- package/dist/types/src/types.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -0
- package/package.json +29 -28
- package/src/DeckPlugin.tsx +222 -256
- package/src/components/DeckLayout/ActiveNode.tsx +1 -1
- package/src/components/DeckLayout/ComplementarySidebar.tsx +4 -3
- package/src/components/DeckLayout/DeckLayout.tsx +3 -7
- package/src/components/DeckLayout/Fullscreen.tsx +1 -1
- package/src/components/DeckLayout/NodePlankHeading.tsx +15 -29
- package/src/components/DeckLayout/Plank.tsx +7 -5
- package/src/components/DeckLayout/PlankControls.tsx +3 -5
- package/src/components/DeckLayout/Sidebar.tsx +4 -21
- package/src/components/DeckLayout/Toast.tsx +19 -6
- package/src/translations.ts +3 -0
- package/src/types.ts +15 -0
- package/dist/lib/browser/chunk-NIRHDTX4.mjs +0 -17
- package/dist/lib/browser/chunk-NIRHDTX4.mjs.map +0 -7
|
@@ -1,27 +1,29 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
meta_default
|
|
4
|
-
} from "./chunk-GVOGPULO.mjs";
|
|
5
|
-
import {
|
|
2
|
+
DeckAction,
|
|
6
3
|
NewPlankPositions,
|
|
7
4
|
OverscrollOptions,
|
|
8
5
|
parsePanelPlugin
|
|
9
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-ZC3K6C2W.mjs";
|
|
7
|
+
import {
|
|
8
|
+
DECK_PLUGIN,
|
|
9
|
+
meta_default
|
|
10
|
+
} from "./chunk-GVOGPULO.mjs";
|
|
10
11
|
|
|
11
12
|
// packages/plugins/plugin-deck/src/DeckPlugin.tsx
|
|
12
13
|
import { batch } from "@preact/signals-core";
|
|
14
|
+
import { pipe } from "effect";
|
|
13
15
|
import { setAutoFreeze } from "immer";
|
|
14
16
|
import React16 from "react";
|
|
15
|
-
import {
|
|
16
|
-
import { getTypename } from "@dxos/echo-schema";
|
|
17
|
+
import { chain, createIntent as createIntent4, createResolver, createSurface, filterPlugins, IntentAction, LayoutAction as LayoutAction3, NavigationAction as NavigationAction3, openIds, parseGraphPlugin, parseIntentPlugin, resolvePlugin, SLUG_PATH_SEPARATOR as SLUG_PATH_SEPARATOR4, Toast as ToastSchema } from "@dxos/app-framework";
|
|
18
|
+
import { getTypename, S } from "@dxos/echo-schema";
|
|
17
19
|
import { scheduledEffect } from "@dxos/echo-signals/core";
|
|
20
|
+
import { invariant } from "@dxos/invariant";
|
|
18
21
|
import { create, isReactiveObject } from "@dxos/live-object";
|
|
19
22
|
import { LocalStorageStore } from "@dxos/local-storage";
|
|
20
23
|
import { log } from "@dxos/log";
|
|
21
24
|
import { parseAttentionPlugin } from "@dxos/plugin-attention";
|
|
22
|
-
import { createExtension } from "@dxos/plugin-graph";
|
|
23
|
-
import { ObservabilityAction } from "@dxos/plugin-observability/
|
|
24
|
-
import { fullyQualifiedId } from "@dxos/react-client/echo";
|
|
25
|
+
import { createExtension, ROOT_ID } from "@dxos/plugin-graph";
|
|
26
|
+
import { ObservabilityAction } from "@dxos/plugin-observability/types";
|
|
25
27
|
import { translations as stackTranslations } from "@dxos/react-ui-stack";
|
|
26
28
|
|
|
27
29
|
// packages/plugins/plugin-deck/src/components/DeckLayout/constants.ts
|
|
@@ -33,7 +35,7 @@ import { Sidebar as MenuIcon } from "@phosphor-icons/react";
|
|
|
33
35
|
import { untracked } from "@preact/signals-core";
|
|
34
36
|
import React14, { useCallback as useCallback2, useEffect as useEffect5, useMemo as useMemo5, useRef as useRef2, Fragment as Fragment2 } from "react";
|
|
35
37
|
import { Surface as Surface9, firstIdInPart, usePlugin } from "@dxos/app-framework";
|
|
36
|
-
import { AlertDialog, Button as Button3, Dialog as NaturalDialog, Main as Main3, Popover as Popover2, useOnTransition, useTranslation as
|
|
38
|
+
import { AlertDialog, Button as Button3, Dialog as NaturalDialog, Main as Main3, Popover as Popover2, useOnTransition, useTranslation as useTranslation6 } from "@dxos/react-ui";
|
|
37
39
|
import { Stack, StackContext as StackContext2, DEFAULT_HORIZONTAL_SIZE } from "@dxos/react-ui-stack";
|
|
38
40
|
import { getSize, mainPaddingTransitions as mainPaddingTransitions2 } from "@dxos/react-ui-theme";
|
|
39
41
|
|
|
@@ -116,7 +118,7 @@ var ActiveNode = () => {
|
|
|
116
118
|
}, /* @__PURE__ */ React.createElement(Surface, {
|
|
117
119
|
role: "document-title",
|
|
118
120
|
data: {
|
|
119
|
-
activeNode
|
|
121
|
+
subject: activeNode
|
|
120
122
|
},
|
|
121
123
|
limit: 1
|
|
122
124
|
}));
|
|
@@ -124,7 +126,7 @@ var ActiveNode = () => {
|
|
|
124
126
|
|
|
125
127
|
// packages/plugins/plugin-deck/src/components/DeckLayout/ComplementarySidebar.tsx
|
|
126
128
|
import React6, { useMemo as useMemo2 } from "react";
|
|
127
|
-
import { NavigationAction as NavigationAction2, SLUG_PATH_SEPARATOR as SLUG_PATH_SEPARATOR2, Surface as Surface3, useIntentDispatcher as useIntentDispatcher2 } from "@dxos/app-framework";
|
|
129
|
+
import { createIntent as createIntent2, NavigationAction as NavigationAction2, SLUG_PATH_SEPARATOR as SLUG_PATH_SEPARATOR2, Surface as Surface3, useIntentDispatcher as useIntentDispatcher2 } from "@dxos/app-framework";
|
|
128
130
|
import { useGraph as useGraph3 } from "@dxos/plugin-graph";
|
|
129
131
|
import { Main, ScrollArea } from "@dxos/react-ui";
|
|
130
132
|
import { useAttended as useAttended2 } from "@dxos/react-ui-attention";
|
|
@@ -133,7 +135,7 @@ import { mx as mx2 } from "@dxos/react-ui-theme";
|
|
|
133
135
|
|
|
134
136
|
// packages/plugins/plugin-deck/src/components/DeckLayout/NodePlankHeading.tsx
|
|
135
137
|
import React3, { Fragment, memo, useEffect as useEffect3, useMemo } from "react";
|
|
136
|
-
import { LayoutAction, NavigationAction, SLUG_PATH_SEPARATOR, Surface as Surface2, useIntentDispatcher } from "@dxos/app-framework";
|
|
138
|
+
import { createIntent, LayoutAction, NavigationAction, SLUG_PATH_SEPARATOR, Surface as Surface2, useIntentDispatcher } from "@dxos/app-framework";
|
|
137
139
|
import { useGraph as useGraph2 } from "@dxos/plugin-graph";
|
|
138
140
|
import { Icon as Icon2, Popover, toLocalizedString, useMediaQuery, useTranslation as useTranslation2, IconButton } from "@dxos/react-ui";
|
|
139
141
|
import { StackItem } from "@dxos/react-ui-stack";
|
|
@@ -154,8 +156,7 @@ var PlankControl = ({ icon, label, ...props }) => {
|
|
|
154
156
|
icon,
|
|
155
157
|
size: 4
|
|
156
158
|
}))), /* @__PURE__ */ React2.createElement(Tooltip.Portal, null, /* @__PURE__ */ React2.createElement(Tooltip.Content, {
|
|
157
|
-
side: "bottom"
|
|
158
|
-
classNames: "z-[70]"
|
|
159
|
+
side: "bottom"
|
|
159
160
|
}, label)));
|
|
160
161
|
};
|
|
161
162
|
var PlankControls = /* @__PURE__ */ forwardRef(({ onClick, variant = "default", capabilities: can, isSolo, pin, close = false, children, ...props }, forwardedRef) => {
|
|
@@ -225,7 +226,7 @@ var NodePlankHeading = /* @__PURE__ */ memo(({ coordinate, node, canIncrementSta
|
|
|
225
226
|
ns: DECK_PLUGIN
|
|
226
227
|
}
|
|
227
228
|
], t);
|
|
228
|
-
const dispatch = useIntentDispatcher();
|
|
229
|
+
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
229
230
|
const ActionRoot = node && popoverAnchorId === `dxos.org/ui/${DECK_PLUGIN}/${node.id}` ? Popover.Anchor : Fragment;
|
|
230
231
|
const [isNotMobile] = useMediaQuery("md");
|
|
231
232
|
useEffect3(() => {
|
|
@@ -266,7 +267,7 @@ var NodePlankHeading = /* @__PURE__ */ memo(({ coordinate, node, canIncrementSta
|
|
|
266
267
|
}, /* @__PURE__ */ React3.createElement(Surface2, {
|
|
267
268
|
role: "menu-footer",
|
|
268
269
|
data: {
|
|
269
|
-
|
|
270
|
+
subject: node.data
|
|
270
271
|
}
|
|
271
272
|
})) : /* @__PURE__ */ React3.createElement(StackItem.SigilButton, null, /* @__PURE__ */ React3.createElement("span", {
|
|
272
273
|
className: "sr-only"
|
|
@@ -285,9 +286,8 @@ var NodePlankHeading = /* @__PURE__ */ memo(({ coordinate, node, canIncrementSta
|
|
|
285
286
|
}, label)), node && layoutPart !== "complementary" && // TODO(Zan): What are we doing with layout coordinate here?
|
|
286
287
|
/* @__PURE__ */ React3.createElement(Surface2, {
|
|
287
288
|
role: "navbar-end",
|
|
288
|
-
direction: "inline-reverse",
|
|
289
289
|
data: {
|
|
290
|
-
|
|
290
|
+
subject: node.data
|
|
291
291
|
}
|
|
292
292
|
}), /* @__PURE__ */ React3.createElement(PlankControls, {
|
|
293
293
|
capabilities,
|
|
@@ -298,47 +298,33 @@ var NodePlankHeading = /* @__PURE__ */ memo(({ coordinate, node, canIncrementSta
|
|
|
298
298
|
return;
|
|
299
299
|
}
|
|
300
300
|
if (eventType === "solo") {
|
|
301
|
-
return dispatch(
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
layoutCoordinate: {
|
|
307
|
-
part: "main",
|
|
308
|
-
entryId: coordinate.entryId
|
|
309
|
-
}
|
|
310
|
-
}
|
|
301
|
+
return dispatch(createIntent(NavigationAction.Adjust, {
|
|
302
|
+
type: eventType,
|
|
303
|
+
layoutCoordinate: {
|
|
304
|
+
part: "main",
|
|
305
|
+
entryId: coordinate.entryId
|
|
311
306
|
}
|
|
312
|
-
|
|
307
|
+
}));
|
|
313
308
|
} else if (eventType === "close") {
|
|
314
309
|
if (layoutPart === "complementary") {
|
|
315
|
-
return dispatch({
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
state: false
|
|
320
|
-
}
|
|
321
|
-
});
|
|
310
|
+
return dispatch(createIntent(LayoutAction.SetLayout, {
|
|
311
|
+
element: "complementary",
|
|
312
|
+
state: false
|
|
313
|
+
}));
|
|
322
314
|
} else {
|
|
323
|
-
return dispatch({
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
coordinate.entryId
|
|
329
|
-
]
|
|
330
|
-
}
|
|
315
|
+
return dispatch(createIntent(NavigationAction.Close, {
|
|
316
|
+
activeParts: {
|
|
317
|
+
[layoutPart]: [
|
|
318
|
+
coordinate.entryId
|
|
319
|
+
]
|
|
331
320
|
}
|
|
332
|
-
});
|
|
321
|
+
}));
|
|
333
322
|
}
|
|
334
323
|
} else {
|
|
335
|
-
return dispatch({
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
layoutCoordinate: coordinate
|
|
340
|
-
}
|
|
341
|
-
});
|
|
324
|
+
return dispatch(createIntent(NavigationAction.Adjust, {
|
|
325
|
+
type: eventType,
|
|
326
|
+
layoutCoordinate: coordinate
|
|
327
|
+
}));
|
|
342
328
|
}
|
|
343
329
|
},
|
|
344
330
|
close: layoutPart === "complementary" ? "minify-end" : true
|
|
@@ -349,8 +335,7 @@ var NodePlankHeading = /* @__PURE__ */ memo(({ coordinate, node, canIncrementSta
|
|
|
349
335
|
label: t("open complementary sidebar label"),
|
|
350
336
|
classNames: "!pli-2 !plb-3 [&>svg]:-scale-x-100",
|
|
351
337
|
icon: "ph--sidebar-simple--regular",
|
|
352
|
-
size: 4
|
|
353
|
-
tooltipZIndex: "70"
|
|
338
|
+
size: 4
|
|
354
339
|
})));
|
|
355
340
|
});
|
|
356
341
|
|
|
@@ -402,19 +387,16 @@ var ComplementarySidebar = ({ panels, current }) => {
|
|
|
402
387
|
const id = attended[0] ? `${attended[0]}${SLUG_PATH_SEPARATOR2}${panel}` : void 0;
|
|
403
388
|
const { graph } = useGraph3();
|
|
404
389
|
const node = useNode(graph, id);
|
|
405
|
-
const dispatch = useIntentDispatcher2();
|
|
390
|
+
const { dispatchPromise: dispatch } = useIntentDispatcher2();
|
|
406
391
|
useNodeActionExpander(node);
|
|
407
392
|
const actions = useMemo2(() => panels.map(({ id: id2, label, icon }) => ({
|
|
408
393
|
id: `complementary-${id2}`,
|
|
409
394
|
data: () => {
|
|
410
|
-
void dispatch({
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
activeParts: {
|
|
414
|
-
complementary: id2
|
|
415
|
-
}
|
|
395
|
+
void dispatch(createIntent2(NavigationAction2.Open, {
|
|
396
|
+
activeParts: {
|
|
397
|
+
complementary: id2
|
|
416
398
|
}
|
|
417
|
-
});
|
|
399
|
+
}));
|
|
418
400
|
},
|
|
419
401
|
properties: {
|
|
420
402
|
label,
|
|
@@ -435,7 +417,6 @@ var ComplementarySidebar = ({ panels, current }) => {
|
|
|
435
417
|
value: {
|
|
436
418
|
size: "contain",
|
|
437
419
|
orientation: "horizontal",
|
|
438
|
-
separators: false,
|
|
439
420
|
rail: true
|
|
440
421
|
}
|
|
441
422
|
}, /* @__PURE__ */ React6.createElement("div", {
|
|
@@ -511,7 +492,7 @@ var Fullscreen = ({ id }) => {
|
|
|
511
492
|
limit: 1,
|
|
512
493
|
fallback: Fallback,
|
|
513
494
|
data: {
|
|
514
|
-
|
|
495
|
+
subject: fullScreenNode?.data,
|
|
515
496
|
component: id?.startsWith(SURFACE_PREFIX) ? id.slice(SURFACE_PREFIX.length) : void 0
|
|
516
497
|
}
|
|
517
498
|
}));
|
|
@@ -519,7 +500,7 @@ var Fullscreen = ({ id }) => {
|
|
|
519
500
|
|
|
520
501
|
// packages/plugins/plugin-deck/src/components/DeckLayout/Plank.tsx
|
|
521
502
|
import React10, { memo as memo2, useCallback, useLayoutEffect, useMemo as useMemo3, useRef } from "react";
|
|
522
|
-
import { Surface as Surface6, useIntentDispatcher as useIntentDispatcher3, indexInPart, partLength, LayoutAction as LayoutAction2 } from "@dxos/app-framework";
|
|
503
|
+
import { Surface as Surface6, useIntentDispatcher as useIntentDispatcher3, indexInPart, partLength, LayoutAction as LayoutAction2, createIntent as createIntent3 } from "@dxos/app-framework";
|
|
523
504
|
import { debounce } from "@dxos/async";
|
|
524
505
|
import { useGraph as useGraph5 } from "@dxos/plugin-graph";
|
|
525
506
|
import { useAttendableAttributes } from "@dxos/react-ui-attention";
|
|
@@ -535,7 +516,7 @@ var useDeckContext = () => useContext2(DeckContext) ?? raise2(new Error("Missing
|
|
|
535
516
|
// packages/plugins/plugin-deck/src/components/DeckLayout/Plank.tsx
|
|
536
517
|
var UNKNOWN_ID = "unknown_id";
|
|
537
518
|
var Plank = /* @__PURE__ */ memo2(({ entry, layoutParts, part, layoutMode, order }) => {
|
|
538
|
-
const dispatch = useIntentDispatcher3();
|
|
519
|
+
const { dispatchPromise: dispatch } = useIntentDispatcher3();
|
|
539
520
|
const coordinate = useMemo3(() => ({
|
|
540
521
|
part,
|
|
541
522
|
entryId: entry?.id ?? UNKNOWN_ID
|
|
@@ -557,13 +538,10 @@ var Plank = /* @__PURE__ */ memo2(({ entry, layoutParts, part, layoutMode, order
|
|
|
557
538
|
const canIncrementEnd = part === "main" && index !== void 0 && index < length - 1 && length !== void 0;
|
|
558
539
|
const size = plankSizing?.[coordinate.entryId];
|
|
559
540
|
const setSize = useCallback(debounce((nextSize) => {
|
|
560
|
-
return dispatch({
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
size: nextSize
|
|
565
|
-
}
|
|
566
|
-
});
|
|
541
|
+
return dispatch(createIntent3(DeckAction.UpdatePlankSize, {
|
|
542
|
+
id: coordinate.entryId,
|
|
543
|
+
size: nextSize
|
|
544
|
+
}));
|
|
567
545
|
}, 200), [
|
|
568
546
|
dispatch,
|
|
569
547
|
coordinate.entryId
|
|
@@ -583,12 +561,9 @@ var Plank = /* @__PURE__ */ memo2(({ entry, layoutParts, part, layoutMode, order
|
|
|
583
561
|
behavior: "smooth",
|
|
584
562
|
inline: "center"
|
|
585
563
|
});
|
|
586
|
-
void dispatch({
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
id: void 0
|
|
590
|
-
}
|
|
591
|
-
});
|
|
564
|
+
void dispatch(createIntent3(LayoutAction2.ScrollIntoView, {
|
|
565
|
+
id: void 0
|
|
566
|
+
}));
|
|
592
567
|
}
|
|
593
568
|
}, [
|
|
594
569
|
coordinate.entryId,
|
|
@@ -599,12 +574,8 @@ var Plank = /* @__PURE__ */ memo2(({ entry, layoutParts, part, layoutMode, order
|
|
|
599
574
|
const isAttendable = isSolo || layoutMode === "deck" && part === "main";
|
|
600
575
|
const sizeAttrs = useMainSize();
|
|
601
576
|
const data = useMemo3(() => node && {
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
path: entry.path
|
|
605
|
-
} : {
|
|
606
|
-
object: node.data
|
|
607
|
-
},
|
|
577
|
+
subject: node.data,
|
|
578
|
+
path: entry?.path,
|
|
608
579
|
coordinate,
|
|
609
580
|
popoverAnchorId
|
|
610
581
|
}, [
|
|
@@ -655,33 +626,18 @@ var Plank = /* @__PURE__ */ memo2(({ entry, layoutParts, part, layoutMode, order
|
|
|
655
626
|
|
|
656
627
|
// packages/plugins/plugin-deck/src/components/DeckLayout/Sidebar.tsx
|
|
657
628
|
import React11, { useMemo as useMemo4 } from "react";
|
|
658
|
-
import {
|
|
629
|
+
import { Surface as Surface7 } from "@dxos/app-framework";
|
|
659
630
|
import { Main as Main2 } from "@dxos/react-ui";
|
|
660
631
|
var Sidebar = ({ layoutParts }) => {
|
|
661
|
-
const {
|
|
662
|
-
const activeIds = useMemo4(() => {
|
|
663
|
-
if (layoutMode === "solo") {
|
|
664
|
-
return Array.from(new Set(layoutParts?.solo?.map((e) => e.id) ?? []));
|
|
665
|
-
} else if (layoutMode === "deck") {
|
|
666
|
-
return Array.from(new Set(layoutParts?.main?.map((e) => e.id) ?? []));
|
|
667
|
-
}
|
|
668
|
-
return Array.from(new Set(openIds(layoutParts)));
|
|
669
|
-
}, [
|
|
670
|
-
layoutParts,
|
|
671
|
-
layoutMode
|
|
672
|
-
]);
|
|
632
|
+
const { popoverAnchorId } = useLayout();
|
|
673
633
|
const navigationData = useMemo4(() => ({
|
|
674
|
-
popoverAnchorId
|
|
675
|
-
activeIds
|
|
634
|
+
popoverAnchorId
|
|
676
635
|
}), [
|
|
677
|
-
popoverAnchorId
|
|
678
|
-
activeIds
|
|
636
|
+
popoverAnchorId
|
|
679
637
|
]);
|
|
680
638
|
return /* @__PURE__ */ React11.createElement(Main2.NavigationSidebar, null, /* @__PURE__ */ React11.createElement(Surface7, {
|
|
681
639
|
role: "navigation",
|
|
682
|
-
data:
|
|
683
|
-
...navigationData
|
|
684
|
-
},
|
|
640
|
+
data: navigationData,
|
|
685
641
|
limit: 1
|
|
686
642
|
}));
|
|
687
643
|
};
|
|
@@ -709,8 +665,9 @@ var StatusBar = ({ showHints }) => {
|
|
|
709
665
|
|
|
710
666
|
// packages/plugins/plugin-deck/src/components/DeckLayout/Toast.tsx
|
|
711
667
|
import React13 from "react";
|
|
712
|
-
import { Button as Button2, Icon as Icon3, Toast as NaturalToast } from "@dxos/react-ui";
|
|
668
|
+
import { Button as Button2, Icon as Icon3, Toast as NaturalToast, toLocalizedString as toLocalizedString2, useTranslation as useTranslation5 } from "@dxos/react-ui";
|
|
713
669
|
var Toast = ({ id, title, description, icon, duration, actionLabel, actionAlt, closeLabel, onAction, onOpenChange }) => {
|
|
670
|
+
const { t } = useTranslation5(DECK_PLUGIN);
|
|
714
671
|
return /* @__PURE__ */ React13.createElement(NaturalToast.Root, {
|
|
715
672
|
"data-testid": id,
|
|
716
673
|
defaultOpen: true,
|
|
@@ -722,18 +679,18 @@ var Toast = ({ id, title, description, icon, duration, actionLabel, actionAlt, c
|
|
|
722
679
|
icon,
|
|
723
680
|
size: 5,
|
|
724
681
|
classNames: "inline mr-1"
|
|
725
|
-
}), /* @__PURE__ */ React13.createElement("span", null, title)), description && /* @__PURE__ */ React13.createElement(NaturalToast.Description, null, description)), /* @__PURE__ */ React13.createElement(NaturalToast.Actions, null, onAction && actionAlt && actionLabel && /* @__PURE__ */ React13.createElement(NaturalToast.Action, {
|
|
726
|
-
altText: actionAlt,
|
|
682
|
+
}), title && /* @__PURE__ */ React13.createElement("span", null, toLocalizedString2(title, t))), description && /* @__PURE__ */ React13.createElement(NaturalToast.Description, null, description && toLocalizedString2(description, t))), /* @__PURE__ */ React13.createElement(NaturalToast.Actions, null, onAction && actionAlt && actionLabel && /* @__PURE__ */ React13.createElement(NaturalToast.Action, {
|
|
683
|
+
altText: toLocalizedString2(actionAlt, t),
|
|
727
684
|
asChild: true
|
|
728
685
|
}, /* @__PURE__ */ React13.createElement(Button2, {
|
|
729
686
|
"data-testid": "toast.action",
|
|
730
687
|
variant: "primary",
|
|
731
688
|
onClick: () => onAction?.()
|
|
732
|
-
}, actionLabel)), closeLabel && /* @__PURE__ */ React13.createElement(NaturalToast.Close, {
|
|
689
|
+
}, toLocalizedString2(actionLabel, t))), closeLabel && /* @__PURE__ */ React13.createElement(NaturalToast.Close, {
|
|
733
690
|
asChild: true
|
|
734
691
|
}, /* @__PURE__ */ React13.createElement(Button2, {
|
|
735
692
|
"data-testid": "toast.close"
|
|
736
|
-
}, closeLabel))));
|
|
693
|
+
}, toLocalizedString2(closeLabel, t)))));
|
|
737
694
|
};
|
|
738
695
|
|
|
739
696
|
// packages/plugins/plugin-deck/src/util/check-app-scheme.ts
|
|
@@ -787,7 +744,7 @@ var PlankSeparator = ({ index }) => index > 0 ? /* @__PURE__ */ React14.createEl
|
|
|
787
744
|
var DeckLayout = ({ layoutParts, toasts, overscroll, showHints, panels, onDismissToast }) => {
|
|
788
745
|
const context = useLayout();
|
|
789
746
|
const { layoutMode, sidebarOpen, complementarySidebarOpen, dialogOpen, dialogContent, dialogBlockAlign, dialogType, popoverOpen, popoverContent, popoverAnchorId } = context;
|
|
790
|
-
const { t } =
|
|
747
|
+
const { t } = useTranslation6(DECK_PLUGIN);
|
|
791
748
|
const { plankSizing } = useDeckContext();
|
|
792
749
|
const attentionPlugin = usePlugin("dxos.org/plugin/attention");
|
|
793
750
|
const fullScreenSlug = useMemo5(() => firstIdInPart(layoutParts, "fullScreen"), [
|
|
@@ -894,7 +851,6 @@ var DeckLayout = ({ layoutParts, toasts, overscroll, showHints, panels, onDismis
|
|
|
894
851
|
inert: ""
|
|
895
852
|
}
|
|
896
853
|
}, /* @__PURE__ */ React14.createElement(Stack, {
|
|
897
|
-
separators: false,
|
|
898
854
|
orientation: "horizontal",
|
|
899
855
|
size: "contain",
|
|
900
856
|
classNames: [
|
|
@@ -925,7 +881,6 @@ var DeckLayout = ({ layoutParts, toasts, overscroll, showHints, panels, onDismis
|
|
|
925
881
|
value: {
|
|
926
882
|
size: "contain",
|
|
927
883
|
orientation: "horizontal",
|
|
928
|
-
separators: false,
|
|
929
884
|
rail: true
|
|
930
885
|
}
|
|
931
886
|
}, /* @__PURE__ */ React14.createElement(Plank, {
|
|
@@ -936,14 +891,14 @@ var DeckLayout = ({ layoutParts, toasts, overscroll, showHints, panels, onDismis
|
|
|
936
891
|
})))), /* @__PURE__ */ React14.createElement(StatusBar, {
|
|
937
892
|
showHints
|
|
938
893
|
})), /* @__PURE__ */ React14.createElement(Popover2.Portal, null, /* @__PURE__ */ React14.createElement(Popover2.Content, {
|
|
939
|
-
classNames: "z-[60]",
|
|
940
894
|
onEscapeKeyDown: () => {
|
|
941
895
|
context.popoverOpen = false;
|
|
942
896
|
context.popoverAnchorId = void 0;
|
|
943
897
|
}
|
|
944
898
|
}, /* @__PURE__ */ React14.createElement(Popover2.Viewport, null, /* @__PURE__ */ React14.createElement(Surface9, {
|
|
945
899
|
role: "popover",
|
|
946
|
-
data: popoverContent
|
|
900
|
+
data: popoverContent,
|
|
901
|
+
limit: 1
|
|
947
902
|
})), /* @__PURE__ */ React14.createElement(Popover2.Arrow, null))), /* @__PURE__ */ React14.createElement(Dialog.Root, {
|
|
948
903
|
open: dialogOpen,
|
|
949
904
|
onOpenChange: (nextOpen) => context.dialogOpen = nextOpen
|
|
@@ -951,7 +906,8 @@ var DeckLayout = ({ layoutParts, toasts, overscroll, showHints, panels, onDismis
|
|
|
951
906
|
blockAlign: dialogBlockAlign
|
|
952
907
|
}, /* @__PURE__ */ React14.createElement(Surface9, {
|
|
953
908
|
role: "dialog",
|
|
954
|
-
data: dialogContent
|
|
909
|
+
data: dialogContent,
|
|
910
|
+
limit: 1
|
|
955
911
|
}))), toasts?.map((toast) => /* @__PURE__ */ React14.createElement(Toast, {
|
|
956
912
|
...toast,
|
|
957
913
|
key: toast.id,
|
|
@@ -966,11 +922,11 @@ var DeckLayout = ({ layoutParts, toasts, overscroll, showHints, panels, onDismis
|
|
|
966
922
|
|
|
967
923
|
// packages/plugins/plugin-deck/src/components/LayoutSettings.tsx
|
|
968
924
|
import React15 from "react";
|
|
969
|
-
import { Input, Select, useTranslation as
|
|
925
|
+
import { Input, Select, useTranslation as useTranslation7 } from "@dxos/react-ui";
|
|
970
926
|
import { DeprecatedFormInput } from "@dxos/react-ui-form";
|
|
971
927
|
var isSocket = !!globalThis.__args;
|
|
972
928
|
var LayoutSettings = ({ settings }) => {
|
|
973
|
-
const { t } =
|
|
929
|
+
const { t } = useTranslation7(DECK_PLUGIN);
|
|
974
930
|
return /* @__PURE__ */ React15.createElement(React15.Fragment, null, /* @__PURE__ */ React15.createElement(DeprecatedFormInput, {
|
|
975
931
|
label: t("select new plank positioning label")
|
|
976
932
|
}, /* @__PURE__ */ React15.createElement(Select.Root, {
|
|
@@ -1202,7 +1158,10 @@ var translations_default = [
|
|
|
1202
1158
|
"select overscroll placeholder": "Select plank overscrolling behavior",
|
|
1203
1159
|
"settings overscroll centering label": "Centering",
|
|
1204
1160
|
"settings overscroll none label": "None",
|
|
1205
|
-
"settings flat deck": "Flatten deck appearance"
|
|
1161
|
+
"settings flat deck": "Flatten deck appearance",
|
|
1162
|
+
"close current label": "Close current plank",
|
|
1163
|
+
"close others label": "Close other planks",
|
|
1164
|
+
"close all label": "Close all planks"
|
|
1206
1165
|
}
|
|
1207
1166
|
}
|
|
1208
1167
|
}
|
|
@@ -1213,13 +1172,7 @@ var __dxlog_file = "/home/runner/work/dxos/dxos/packages/plugins/plugin-deck/src
|
|
|
1213
1172
|
var isSocket2 = !!globalThis.__args;
|
|
1214
1173
|
var appScheme = "composer://";
|
|
1215
1174
|
setAutoFreeze(false);
|
|
1216
|
-
var DECK_ACTION = "dxos.org/plugin/deck";
|
|
1217
|
-
var DeckAction;
|
|
1218
|
-
(function(DeckAction2) {
|
|
1219
|
-
DeckAction2[DeckAction2["UPDATE_PLANK_SIZE"] = `${DECK_ACTION}/update-plank-size`] = "UPDATE_PLANK_SIZE";
|
|
1220
|
-
})(DeckAction || (DeckAction = {}));
|
|
1221
1175
|
var DeckPlugin = ({ observability } = {}) => {
|
|
1222
|
-
let graphPlugin;
|
|
1223
1176
|
let intentPlugin;
|
|
1224
1177
|
let attentionPlugin;
|
|
1225
1178
|
const unsubscriptionCallbacks = [];
|
|
@@ -1268,15 +1221,11 @@ var DeckPlugin = ({ observability } = {}) => {
|
|
|
1268
1221
|
switch (element) {
|
|
1269
1222
|
case "sidebar": {
|
|
1270
1223
|
layout.values.sidebarOpen = state ?? !layout.values.sidebarOpen;
|
|
1271
|
-
|
|
1272
|
-
data: true
|
|
1273
|
-
};
|
|
1224
|
+
break;
|
|
1274
1225
|
}
|
|
1275
1226
|
case "complementary": {
|
|
1276
1227
|
layout.values.complementarySidebarOpen = !!state;
|
|
1277
|
-
|
|
1278
|
-
data: true
|
|
1279
|
-
};
|
|
1228
|
+
break;
|
|
1280
1229
|
}
|
|
1281
1230
|
case "dialog": {
|
|
1282
1231
|
layout.values.dialogOpen = state ?? Boolean(component);
|
|
@@ -1286,9 +1235,7 @@ var DeckPlugin = ({ observability } = {}) => {
|
|
|
1286
1235
|
} : null;
|
|
1287
1236
|
layout.values.dialogBlockAlign = dialogBlockAlign ?? "center";
|
|
1288
1237
|
layout.values.dialogType = dialogType;
|
|
1289
|
-
|
|
1290
|
-
data: true
|
|
1291
|
-
};
|
|
1238
|
+
break;
|
|
1292
1239
|
}
|
|
1293
1240
|
case "popover": {
|
|
1294
1241
|
layout.values.popoverOpen = state ?? Boolean(component);
|
|
@@ -1297,28 +1244,34 @@ var DeckPlugin = ({ observability } = {}) => {
|
|
|
1297
1244
|
subject
|
|
1298
1245
|
} : null;
|
|
1299
1246
|
layout.values.popoverAnchorId = anchorId;
|
|
1300
|
-
|
|
1301
|
-
data: true
|
|
1302
|
-
};
|
|
1247
|
+
break;
|
|
1303
1248
|
}
|
|
1304
1249
|
case "toast": {
|
|
1305
|
-
if (
|
|
1250
|
+
if (S.is(ToastSchema)(subject)) {
|
|
1306
1251
|
layout.values.toasts = [
|
|
1307
1252
|
...layout.values.toasts,
|
|
1308
1253
|
subject
|
|
1309
1254
|
];
|
|
1310
|
-
return {
|
|
1311
|
-
data: true
|
|
1312
|
-
};
|
|
1313
1255
|
}
|
|
1256
|
+
break;
|
|
1314
1257
|
}
|
|
1315
1258
|
}
|
|
1316
1259
|
};
|
|
1317
1260
|
const handleSetLocation = (next) => {
|
|
1318
1261
|
const part = layout.values.layoutMode === "solo" ? "solo" : "main";
|
|
1319
|
-
const ids =
|
|
1262
|
+
const ids = openIds(next, [
|
|
1320
1263
|
part
|
|
1321
1264
|
]);
|
|
1265
|
+
const current = openIds(location.values.active, [
|
|
1266
|
+
part
|
|
1267
|
+
]);
|
|
1268
|
+
const removed = current.filter((id) => !ids.includes(id));
|
|
1269
|
+
const closed = Array.from(/* @__PURE__ */ new Set([
|
|
1270
|
+
...location.values.closed.filter((id) => !ids.includes(id)),
|
|
1271
|
+
...removed
|
|
1272
|
+
]));
|
|
1273
|
+
location.values.closed = closed;
|
|
1274
|
+
location.values.active = next;
|
|
1322
1275
|
if (attentionPlugin) {
|
|
1323
1276
|
const attended = attentionPlugin.provides.attention.attended;
|
|
1324
1277
|
const [attendedId] = Array.from(attended);
|
|
@@ -1327,32 +1280,16 @@ var DeckPlugin = ({ observability } = {}) => {
|
|
|
1327
1280
|
const currentIds = location.values.active[part]?.map(({ id }) => id) ?? [];
|
|
1328
1281
|
const attendedIndex = currentIds.indexOf(attendedId);
|
|
1329
1282
|
const index = attendedIndex === -1 ? 0 : attendedIndex >= ids.length ? ids.length - 1 : attendedIndex;
|
|
1330
|
-
|
|
1331
|
-
void intentPlugin?.provides.intent.dispatch({
|
|
1332
|
-
action: LayoutAction3.SCROLL_INTO_VIEW,
|
|
1333
|
-
data: {
|
|
1334
|
-
id: nextAttended
|
|
1335
|
-
}
|
|
1336
|
-
});
|
|
1283
|
+
return next[part]?.[index].id;
|
|
1337
1284
|
}
|
|
1338
1285
|
}
|
|
1339
|
-
const current = openIds2(location.values.active, [
|
|
1340
|
-
part
|
|
1341
|
-
]);
|
|
1342
|
-
const removed = current.filter((id) => !ids.includes(id));
|
|
1343
|
-
const closed = Array.from(/* @__PURE__ */ new Set([
|
|
1344
|
-
...location.values.closed.filter((id) => !ids.includes(id)),
|
|
1345
|
-
...removed
|
|
1346
|
-
]));
|
|
1347
|
-
location.values.closed = closed;
|
|
1348
|
-
location.values.active = next;
|
|
1349
1286
|
};
|
|
1350
1287
|
return {
|
|
1351
1288
|
meta: meta_default,
|
|
1352
|
-
ready: async (plugins) => {
|
|
1353
|
-
intentPlugin = resolvePlugin(plugins, parseIntentPlugin);
|
|
1354
|
-
graphPlugin = resolvePlugin(plugins, parseGraphPlugin);
|
|
1289
|
+
ready: async ({ plugins }) => {
|
|
1355
1290
|
attentionPlugin = resolvePlugin(plugins, parseAttentionPlugin);
|
|
1291
|
+
intentPlugin = resolvePlugin(plugins, parseIntentPlugin);
|
|
1292
|
+
const dispatch = intentPlugin?.provides.intent.dispatchPromise;
|
|
1356
1293
|
layout.prop({
|
|
1357
1294
|
key: "layoutMode",
|
|
1358
1295
|
type: LocalStorageStore.enum()
|
|
@@ -1418,12 +1355,18 @@ var DeckPlugin = ({ observability } = {}) => {
|
|
|
1418
1355
|
const startingLayout = removePart(location.values.active, "solo");
|
|
1419
1356
|
const layoutFromUri = uriToSoloPart(pathname);
|
|
1420
1357
|
if (!layoutFromUri) {
|
|
1421
|
-
handleSetLocation(startingLayout);
|
|
1358
|
+
const toAttend2 = handleSetLocation(startingLayout);
|
|
1422
1359
|
layout.values.layoutMode = "deck";
|
|
1360
|
+
await dispatch?.(createIntent4(LayoutAction3.ScrollIntoView, {
|
|
1361
|
+
id: toAttend2
|
|
1362
|
+
}));
|
|
1423
1363
|
return;
|
|
1424
1364
|
}
|
|
1425
|
-
handleSetLocation(mergeLayoutParts(layoutFromUri, startingLayout));
|
|
1365
|
+
const toAttend = handleSetLocation(mergeLayoutParts(layoutFromUri, startingLayout));
|
|
1426
1366
|
layout.values.layoutMode = "solo";
|
|
1367
|
+
await dispatch?.(createIntent4(LayoutAction3.ScrollIntoView, {
|
|
1368
|
+
id: toAttend
|
|
1369
|
+
}));
|
|
1427
1370
|
};
|
|
1428
1371
|
await handleNavigation();
|
|
1429
1372
|
window.addEventListener("popstate", handleNavigation);
|
|
@@ -1449,23 +1392,37 @@ var DeckPlugin = ({ observability } = {}) => {
|
|
|
1449
1392
|
...stackTranslations
|
|
1450
1393
|
],
|
|
1451
1394
|
graph: {
|
|
1452
|
-
builder: () => {
|
|
1395
|
+
builder: (plugins) => {
|
|
1396
|
+
const dispatch = resolvePlugin(plugins, parseIntentPlugin)?.provides.intent.dispatchPromise;
|
|
1397
|
+
const attention = resolvePlugin(plugins, parseAttentionPlugin)?.provides.attention;
|
|
1398
|
+
invariant(dispatch, "Intent plugin is required for deck plugin.", {
|
|
1399
|
+
F: __dxlog_file,
|
|
1400
|
+
L: 295,
|
|
1401
|
+
S: void 0,
|
|
1402
|
+
A: [
|
|
1403
|
+
"dispatch",
|
|
1404
|
+
"'Intent plugin is required for deck plugin.'"
|
|
1405
|
+
]
|
|
1406
|
+
});
|
|
1407
|
+
invariant(attention, "Attention plugin is required for deck plugin.", {
|
|
1408
|
+
F: __dxlog_file,
|
|
1409
|
+
L: 296,
|
|
1410
|
+
S: void 0,
|
|
1411
|
+
A: [
|
|
1412
|
+
"attention",
|
|
1413
|
+
"'Attention plugin is required for deck plugin.'"
|
|
1414
|
+
]
|
|
1415
|
+
});
|
|
1453
1416
|
return createExtension({
|
|
1454
1417
|
id: DECK_PLUGIN,
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
{
|
|
1460
|
-
id: `${LayoutAction3.SET_LAYOUT_MODE}/fullscreen`,
|
|
1418
|
+
filter: (node) => node.id === ROOT_ID,
|
|
1419
|
+
actions: () => {
|
|
1420
|
+
const _fullscreen = {
|
|
1421
|
+
id: `${LayoutAction3.SetLayoutMode._tag}/fullscreen`,
|
|
1461
1422
|
data: async () => {
|
|
1462
|
-
await
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
data: {
|
|
1466
|
-
layoutMode: "fullscreen"
|
|
1467
|
-
}
|
|
1468
|
-
});
|
|
1423
|
+
await dispatch(createIntent4(LayoutAction3.SetLayoutMode, {
|
|
1424
|
+
layoutMode: "fullscreen"
|
|
1425
|
+
}));
|
|
1469
1426
|
},
|
|
1470
1427
|
properties: {
|
|
1471
1428
|
label: [
|
|
@@ -1480,8 +1437,81 @@ var DeckPlugin = ({ observability } = {}) => {
|
|
|
1480
1437
|
windows: "shift+ctrl+f"
|
|
1481
1438
|
}
|
|
1482
1439
|
}
|
|
1483
|
-
}
|
|
1484
|
-
|
|
1440
|
+
};
|
|
1441
|
+
const closeCurrent = {
|
|
1442
|
+
id: `${NavigationAction3.Close._tag}/current`,
|
|
1443
|
+
data: async () => {
|
|
1444
|
+
const attended = attention.attended.at(-1);
|
|
1445
|
+
if (attended) {
|
|
1446
|
+
await dispatch(createIntent4(NavigationAction3.Close, {
|
|
1447
|
+
activeParts: {
|
|
1448
|
+
main: [
|
|
1449
|
+
attended
|
|
1450
|
+
]
|
|
1451
|
+
}
|
|
1452
|
+
}));
|
|
1453
|
+
}
|
|
1454
|
+
},
|
|
1455
|
+
properties: {
|
|
1456
|
+
label: [
|
|
1457
|
+
"close current label",
|
|
1458
|
+
{
|
|
1459
|
+
ns: DECK_PLUGIN
|
|
1460
|
+
}
|
|
1461
|
+
],
|
|
1462
|
+
icon: "ph--x--regular"
|
|
1463
|
+
}
|
|
1464
|
+
};
|
|
1465
|
+
const closeOthers = {
|
|
1466
|
+
id: `${NavigationAction3.Close._tag}/others`,
|
|
1467
|
+
data: async () => {
|
|
1468
|
+
const attended = attention.attended.at(-1);
|
|
1469
|
+
const ids = openIds(location.values.active, [
|
|
1470
|
+
"main"
|
|
1471
|
+
]).filter((id) => id !== attended);
|
|
1472
|
+
await dispatch(createIntent4(NavigationAction3.Close, {
|
|
1473
|
+
activeParts: {
|
|
1474
|
+
main: ids
|
|
1475
|
+
}
|
|
1476
|
+
}));
|
|
1477
|
+
},
|
|
1478
|
+
properties: {
|
|
1479
|
+
label: [
|
|
1480
|
+
"close others label",
|
|
1481
|
+
{
|
|
1482
|
+
ns: DECK_PLUGIN
|
|
1483
|
+
}
|
|
1484
|
+
],
|
|
1485
|
+
icon: "ph--x-square--regular"
|
|
1486
|
+
}
|
|
1487
|
+
};
|
|
1488
|
+
const closeAll = {
|
|
1489
|
+
id: `${NavigationAction3.Close._tag}/all`,
|
|
1490
|
+
data: async () => {
|
|
1491
|
+
await dispatch(createIntent4(NavigationAction3.Close, {
|
|
1492
|
+
activeParts: {
|
|
1493
|
+
main: openIds(location.values.active, [
|
|
1494
|
+
"main"
|
|
1495
|
+
])
|
|
1496
|
+
}
|
|
1497
|
+
}));
|
|
1498
|
+
},
|
|
1499
|
+
properties: {
|
|
1500
|
+
label: [
|
|
1501
|
+
"close all label",
|
|
1502
|
+
{
|
|
1503
|
+
ns: DECK_PLUGIN
|
|
1504
|
+
}
|
|
1505
|
+
],
|
|
1506
|
+
icon: "ph--x-circle--regular"
|
|
1507
|
+
}
|
|
1508
|
+
};
|
|
1509
|
+
return layout.values.layoutMode === "deck" ? [
|
|
1510
|
+
closeCurrent,
|
|
1511
|
+
closeOthers,
|
|
1512
|
+
closeAll
|
|
1513
|
+
] : [];
|
|
1514
|
+
}
|
|
1485
1515
|
});
|
|
1486
1516
|
}
|
|
1487
1517
|
},
|
|
@@ -1511,28 +1541,67 @@ var DeckPlugin = ({ observability } = {}) => {
|
|
|
1511
1541
|
});
|
|
1512
1542
|
},
|
|
1513
1543
|
surface: {
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
}
|
|
1521
|
-
|
|
1522
|
-
}
|
|
1544
|
+
definitions: () => createSurface({
|
|
1545
|
+
id: DECK_PLUGIN,
|
|
1546
|
+
role: "settings",
|
|
1547
|
+
filter: (data) => data.subject === DECK_PLUGIN,
|
|
1548
|
+
component: () => /* @__PURE__ */ React16.createElement(LayoutSettings, {
|
|
1549
|
+
settings: settings.values
|
|
1550
|
+
})
|
|
1551
|
+
})
|
|
1523
1552
|
},
|
|
1524
1553
|
intent: {
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1554
|
+
resolvers: ({ plugins }) => {
|
|
1555
|
+
const graph = resolvePlugin(plugins, parseGraphPlugin)?.provides.graph;
|
|
1556
|
+
return [
|
|
1557
|
+
createResolver(DeckAction.UpdatePlankSize, (data) => {
|
|
1558
|
+
deck.values.plankSizing[data.id] = data.size;
|
|
1559
|
+
}),
|
|
1560
|
+
createResolver(IntentAction.ShowUndo, (data) => {
|
|
1561
|
+
if (currentUndoId) {
|
|
1562
|
+
layout.values.toasts = layout.values.toasts.filter((toast) => toast.id !== currentUndoId);
|
|
1563
|
+
}
|
|
1564
|
+
currentUndoId = `${IntentAction.ShowUndo._tag}-${Date.now()}`;
|
|
1565
|
+
layout.values.toasts = [
|
|
1566
|
+
...layout.values.toasts,
|
|
1567
|
+
{
|
|
1568
|
+
id: currentUndoId,
|
|
1569
|
+
title: data.message ?? [
|
|
1570
|
+
"undo available label",
|
|
1571
|
+
{
|
|
1572
|
+
ns: DECK_PLUGIN
|
|
1573
|
+
}
|
|
1574
|
+
],
|
|
1575
|
+
duration: 1e4,
|
|
1576
|
+
actionLabel: [
|
|
1577
|
+
"undo action label",
|
|
1578
|
+
{
|
|
1579
|
+
ns: DECK_PLUGIN
|
|
1580
|
+
}
|
|
1581
|
+
],
|
|
1582
|
+
actionAlt: [
|
|
1583
|
+
"undo action alt",
|
|
1584
|
+
{
|
|
1585
|
+
ns: DECK_PLUGIN
|
|
1586
|
+
}
|
|
1587
|
+
],
|
|
1588
|
+
closeLabel: [
|
|
1589
|
+
"undo close label",
|
|
1590
|
+
{
|
|
1591
|
+
ns: DECK_PLUGIN
|
|
1592
|
+
}
|
|
1593
|
+
],
|
|
1594
|
+
onAction: () => intentPlugin?.provides.intent.undoPromise?.()
|
|
1595
|
+
}
|
|
1596
|
+
];
|
|
1597
|
+
}),
|
|
1598
|
+
createResolver(LayoutAction3.SetLayout, handleSetLayout),
|
|
1599
|
+
createResolver(LayoutAction3.SetLayoutMode, (data) => {
|
|
1531
1600
|
const setMode = (mode) => {
|
|
1532
|
-
const main =
|
|
1601
|
+
const main = openIds(location.values.active, [
|
|
1533
1602
|
"main"
|
|
1534
1603
|
]);
|
|
1535
|
-
const solo =
|
|
1604
|
+
const solo = openIds(location.values.active, [
|
|
1536
1605
|
"solo"
|
|
1537
1606
|
]);
|
|
1538
1607
|
const current = layout.values.layoutMode === "solo" ? solo : main;
|
|
@@ -1549,76 +1618,29 @@ var DeckPlugin = ({ observability } = {}) => {
|
|
|
1549
1618
|
layout.values.layoutMode = mode;
|
|
1550
1619
|
};
|
|
1551
1620
|
return batch(() => {
|
|
1552
|
-
if (
|
|
1553
|
-
return;
|
|
1554
|
-
}
|
|
1555
|
-
if (intent.data?.revert) {
|
|
1556
|
-
setMode(layoutModeHistory.values.pop() ?? "solo");
|
|
1557
|
-
return {
|
|
1558
|
-
data: true
|
|
1559
|
-
};
|
|
1560
|
-
}
|
|
1561
|
-
if (isLayoutMode(intent?.data?.layoutMode)) {
|
|
1621
|
+
if ("layoutMode" in data) {
|
|
1562
1622
|
layoutModeHistory.values.push(layout.values.layoutMode);
|
|
1563
|
-
setMode(
|
|
1623
|
+
setMode(data.layoutMode);
|
|
1624
|
+
} else if (data.revert) {
|
|
1625
|
+
setMode(layoutModeHistory.values.pop() ?? "solo");
|
|
1564
1626
|
} else {
|
|
1565
|
-
log.warn("Invalid layout mode",
|
|
1627
|
+
log.warn("Invalid layout mode", data, {
|
|
1566
1628
|
F: __dxlog_file,
|
|
1567
|
-
L:
|
|
1629
|
+
L: 460,
|
|
1568
1630
|
S: void 0,
|
|
1569
1631
|
C: (f, a) => f(...a)
|
|
1570
1632
|
});
|
|
1571
1633
|
}
|
|
1572
|
-
return {
|
|
1573
|
-
data: true
|
|
1574
|
-
};
|
|
1575
1634
|
});
|
|
1576
|
-
}
|
|
1577
|
-
|
|
1578
|
-
layout.values.scrollIntoView =
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
case DeckAction.UPDATE_PLANK_SIZE: {
|
|
1584
|
-
const { id, size } = intent.data;
|
|
1585
|
-
deck.values.plankSizing[id] = size;
|
|
1586
|
-
return {
|
|
1587
|
-
data: true
|
|
1588
|
-
};
|
|
1589
|
-
}
|
|
1590
|
-
case IntentAction.SHOW_UNDO: {
|
|
1591
|
-
if (currentUndoId) {
|
|
1592
|
-
layout.values.toasts = layout.values.toasts.filter((toast) => toast.id !== currentUndoId);
|
|
1593
|
-
}
|
|
1594
|
-
currentUndoId = `${IntentAction.SHOW_UNDO}-${Date.now()}`;
|
|
1595
|
-
const title = (
|
|
1596
|
-
// TODO(wittjosiah): How to handle chains better?
|
|
1597
|
-
intent.data?.results?.[0]?.result?.undoable?.message ?? translations_default[0]["en-US"]["dxos.org/plugin/deck"]["undo available label"]
|
|
1598
|
-
);
|
|
1599
|
-
layout.values.toasts = [
|
|
1600
|
-
...layout.values.toasts,
|
|
1601
|
-
{
|
|
1602
|
-
id: currentUndoId,
|
|
1603
|
-
title,
|
|
1604
|
-
duration: 1e4,
|
|
1605
|
-
actionLabel: translations_default[0]["en-US"]["dxos.org/plugin/deck"]["undo action label"],
|
|
1606
|
-
actionAlt: translations_default[0]["en-US"]["dxos.org/plugin/deck"]["undo action alt"],
|
|
1607
|
-
closeLabel: translations_default[0]["en-US"]["dxos.org/plugin/deck"]["undo close label"],
|
|
1608
|
-
onAction: () => intentPlugin?.provides.intent.undo?.()
|
|
1609
|
-
}
|
|
1610
|
-
];
|
|
1611
|
-
return {
|
|
1612
|
-
data: true
|
|
1613
|
-
};
|
|
1614
|
-
}
|
|
1615
|
-
case NavigationAction3.OPEN: {
|
|
1616
|
-
const previouslyOpenIds = new Set(openIds2(location.values.active));
|
|
1635
|
+
}),
|
|
1636
|
+
createResolver(LayoutAction3.ScrollIntoView, ({ id }) => {
|
|
1637
|
+
layout.values.scrollIntoView = id;
|
|
1638
|
+
}),
|
|
1639
|
+
// TODO(wittjosiah): Factor out navgiation from deck plugin.
|
|
1640
|
+
createResolver(NavigationAction3.Open, (data) => {
|
|
1641
|
+
const previouslyOpenIds = new Set(openIds(location.values.active));
|
|
1617
1642
|
const layoutMode = layout.values.layoutMode;
|
|
1618
|
-
batch(() => {
|
|
1619
|
-
if (!intent.data || !intent.data?.activeParts) {
|
|
1620
|
-
return;
|
|
1621
|
-
}
|
|
1643
|
+
const toAttend = batch(() => {
|
|
1622
1644
|
const processLayoutEntry = (partName, entryString, currentLayout) => {
|
|
1623
1645
|
const toggle = false;
|
|
1624
1646
|
const [id, path] = entryString.split(SLUG_PATH_SEPARATOR4);
|
|
@@ -1629,7 +1651,7 @@ var DeckPlugin = ({ observability } = {}) => {
|
|
|
1629
1651
|
} : {}
|
|
1630
1652
|
};
|
|
1631
1653
|
const effectivePart = getEffectivePart(partName, layoutMode);
|
|
1632
|
-
if (toggle && layoutMode === "deck" && effectivePart === "main" && currentLayout[effectivePart]?.some((entry) => entry.id === id) && !
|
|
1654
|
+
if (toggle && layoutMode === "deck" && effectivePart === "main" && currentLayout[effectivePart]?.some((entry) => entry.id === id) && !data?.noToggle) {
|
|
1633
1655
|
return closeEntry(currentLayout, {
|
|
1634
1656
|
part: effectivePart,
|
|
1635
1657
|
entryId: id
|
|
@@ -1641,7 +1663,7 @@ var DeckPlugin = ({ observability } = {}) => {
|
|
|
1641
1663
|
}
|
|
1642
1664
|
};
|
|
1643
1665
|
let newLayout = location.values.active;
|
|
1644
|
-
Object.entries(
|
|
1666
|
+
Object.entries(data.activeParts).forEach(([partName, layoutEntries]) => {
|
|
1645
1667
|
if (Array.isArray(layoutEntries)) {
|
|
1646
1668
|
layoutEntries.forEach((activePartEntry) => {
|
|
1647
1669
|
newLayout = processLayoutEntry(partName, activePartEntry, newLayout);
|
|
@@ -1650,50 +1672,38 @@ var DeckPlugin = ({ observability } = {}) => {
|
|
|
1650
1672
|
newLayout = processLayoutEntry(partName, layoutEntries, newLayout);
|
|
1651
1673
|
}
|
|
1652
1674
|
});
|
|
1653
|
-
handleSetLocation(newLayout);
|
|
1675
|
+
return handleSetLocation(newLayout);
|
|
1654
1676
|
});
|
|
1655
|
-
const ids =
|
|
1677
|
+
const ids = openIds(location.values.active);
|
|
1656
1678
|
const newlyOpen = ids.filter((i) => !previouslyOpenIds.has(i));
|
|
1657
1679
|
return {
|
|
1658
1680
|
data: {
|
|
1659
|
-
ids
|
|
1681
|
+
open: ids
|
|
1660
1682
|
},
|
|
1661
1683
|
intents: [
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
}
|
|
1669
|
-
] : [],
|
|
1670
|
-
intent.data?.object ? [
|
|
1671
|
-
{
|
|
1672
|
-
action: NavigationAction3.EXPOSE,
|
|
1673
|
-
data: {
|
|
1674
|
-
id: fullyQualifiedId(intent.data.object)
|
|
1675
|
-
}
|
|
1676
|
-
}
|
|
1684
|
+
createIntent4(LayoutAction3.ScrollIntoView, {
|
|
1685
|
+
id: newlyOpen[0] ?? toAttend
|
|
1686
|
+
}),
|
|
1687
|
+
...toAttend ? [
|
|
1688
|
+
createIntent4(NavigationAction3.Expose, {
|
|
1689
|
+
id: toAttend
|
|
1690
|
+
})
|
|
1677
1691
|
] : [],
|
|
1678
|
-
observability ? newlyOpen.map((id) => {
|
|
1679
|
-
const active =
|
|
1692
|
+
...observability ? newlyOpen.map((id) => {
|
|
1693
|
+
const active = graph?.findNode(id)?.data;
|
|
1680
1694
|
const typename = isReactiveObject(active) ? getTypename(active) : void 0;
|
|
1681
|
-
return {
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
id,
|
|
1687
|
-
typename
|
|
1688
|
-
}
|
|
1695
|
+
return createIntent4(ObservabilityAction.SendEvent, {
|
|
1696
|
+
name: "navigation.activate",
|
|
1697
|
+
properties: {
|
|
1698
|
+
id,
|
|
1699
|
+
typename
|
|
1689
1700
|
}
|
|
1690
|
-
};
|
|
1701
|
+
});
|
|
1691
1702
|
}) : []
|
|
1692
1703
|
]
|
|
1693
1704
|
};
|
|
1694
|
-
}
|
|
1695
|
-
|
|
1696
|
-
const data = intent.data;
|
|
1705
|
+
}),
|
|
1706
|
+
createResolver(NavigationAction3.AddToActive, (data) => {
|
|
1697
1707
|
const layoutEntry = {
|
|
1698
1708
|
id: data.id
|
|
1699
1709
|
};
|
|
@@ -1704,147 +1714,110 @@ var DeckPlugin = ({ observability } = {}) => {
|
|
|
1704
1714
|
}));
|
|
1705
1715
|
const intents = [];
|
|
1706
1716
|
if (data.scrollIntoView && layout.values.layoutMode === "deck") {
|
|
1707
|
-
intents.push(
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
data: {
|
|
1711
|
-
id: data.id
|
|
1712
|
-
}
|
|
1713
|
-
}
|
|
1714
|
-
]);
|
|
1717
|
+
intents.push(createIntent4(LayoutAction3.ScrollIntoView, {
|
|
1718
|
+
id: data.id
|
|
1719
|
+
}));
|
|
1715
1720
|
}
|
|
1716
1721
|
return {
|
|
1717
|
-
data: true,
|
|
1718
1722
|
intents
|
|
1719
1723
|
};
|
|
1720
|
-
}
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
const
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
const effectivePart = getEffectivePart(partName, layoutMode);
|
|
1731
|
-
const ids = intentParts[partName];
|
|
1732
|
-
if (Array.isArray(ids)) {
|
|
1733
|
-
ids.forEach((id) => {
|
|
1734
|
-
newLayout = closeEntry(newLayout, {
|
|
1735
|
-
part: effectivePart,
|
|
1736
|
-
entryId: id
|
|
1737
|
-
});
|
|
1738
|
-
});
|
|
1739
|
-
} else {
|
|
1724
|
+
}),
|
|
1725
|
+
createResolver(NavigationAction3.Close, (data) => {
|
|
1726
|
+
let newLayout = location.values.active;
|
|
1727
|
+
const layoutMode = layout.values.layoutMode;
|
|
1728
|
+
const intentParts = data.activeParts;
|
|
1729
|
+
Object.keys(intentParts).forEach((partName) => {
|
|
1730
|
+
const effectivePart = getEffectivePart(partName, layoutMode);
|
|
1731
|
+
const ids = intentParts[partName];
|
|
1732
|
+
if (Array.isArray(ids)) {
|
|
1733
|
+
ids.forEach((id) => {
|
|
1740
1734
|
newLayout = closeEntry(newLayout, {
|
|
1741
1735
|
part: effectivePart,
|
|
1742
|
-
entryId:
|
|
1736
|
+
entryId: id
|
|
1743
1737
|
});
|
|
1744
|
-
}
|
|
1745
|
-
}
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1738
|
+
});
|
|
1739
|
+
} else {
|
|
1740
|
+
newLayout = closeEntry(newLayout, {
|
|
1741
|
+
part: effectivePart,
|
|
1742
|
+
entryId: ids
|
|
1743
|
+
});
|
|
1744
|
+
}
|
|
1750
1745
|
});
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1746
|
+
const toAttend = handleSetLocation(newLayout);
|
|
1747
|
+
return {
|
|
1748
|
+
intents: [
|
|
1749
|
+
createIntent4(LayoutAction3.ScrollIntoView, {
|
|
1750
|
+
id: toAttend
|
|
1751
|
+
})
|
|
1752
|
+
]
|
|
1753
|
+
};
|
|
1754
|
+
}),
|
|
1755
|
+
createResolver(NavigationAction3.Set, (data) => {
|
|
1754
1756
|
return batch(() => {
|
|
1755
|
-
|
|
1756
|
-
handleSetLocation(intent.data.activeParts);
|
|
1757
|
-
}
|
|
1757
|
+
const toAttend = handleSetLocation(data.activeParts);
|
|
1758
1758
|
return {
|
|
1759
|
-
|
|
1759
|
+
intents: [
|
|
1760
|
+
createIntent4(LayoutAction3.ScrollIntoView, {
|
|
1761
|
+
id: toAttend
|
|
1762
|
+
})
|
|
1763
|
+
]
|
|
1760
1764
|
};
|
|
1761
1765
|
});
|
|
1762
|
-
}
|
|
1763
|
-
|
|
1766
|
+
}),
|
|
1767
|
+
createResolver(NavigationAction3.Adjust, (adjustment) => {
|
|
1764
1768
|
return batch(() => {
|
|
1765
|
-
if (
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
if (
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
{
|
|
1813
|
-
action: NavigationAction3.CLOSE,
|
|
1814
|
-
data: {
|
|
1815
|
-
activeParts: {
|
|
1816
|
-
solo: [
|
|
1817
|
-
entryId
|
|
1818
|
-
]
|
|
1819
|
-
}
|
|
1820
|
-
}
|
|
1821
|
-
},
|
|
1822
|
-
{
|
|
1823
|
-
action: NavigationAction3.OPEN,
|
|
1824
|
-
data: {
|
|
1825
|
-
noToggle: true,
|
|
1826
|
-
activeParts: {
|
|
1827
|
-
main: [
|
|
1828
|
-
entryId
|
|
1829
|
-
]
|
|
1830
|
-
}
|
|
1831
|
-
}
|
|
1832
|
-
},
|
|
1833
|
-
{
|
|
1834
|
-
action: LayoutAction3.SCROLL_INTO_VIEW,
|
|
1835
|
-
data: {
|
|
1836
|
-
id: entryId
|
|
1837
|
-
}
|
|
1838
|
-
}
|
|
1839
|
-
]
|
|
1840
|
-
]
|
|
1841
|
-
};
|
|
1842
|
-
}
|
|
1769
|
+
if (adjustment.type === "increment-end" || adjustment.type === "increment-start") {
|
|
1770
|
+
handleSetLocation(incrementPlank(location.values.active, {
|
|
1771
|
+
type: adjustment.type,
|
|
1772
|
+
layoutCoordinate: adjustment.layoutCoordinate
|
|
1773
|
+
}));
|
|
1774
|
+
}
|
|
1775
|
+
if (adjustment.type === "solo") {
|
|
1776
|
+
const entryId = adjustment.layoutCoordinate.entryId;
|
|
1777
|
+
if (layout.values.layoutMode !== "solo") {
|
|
1778
|
+
return {
|
|
1779
|
+
intents: [
|
|
1780
|
+
// NOTE: The order of these is important.
|
|
1781
|
+
pipe(createIntent4(NavigationAction3.Open, {
|
|
1782
|
+
activeParts: {
|
|
1783
|
+
solo: [
|
|
1784
|
+
entryId
|
|
1785
|
+
]
|
|
1786
|
+
}
|
|
1787
|
+
}), chain(LayoutAction3.SetLayoutMode, {
|
|
1788
|
+
layoutMode: "solo"
|
|
1789
|
+
}))
|
|
1790
|
+
]
|
|
1791
|
+
};
|
|
1792
|
+
} else {
|
|
1793
|
+
return {
|
|
1794
|
+
intents: [
|
|
1795
|
+
// NOTE: The order of these is important.
|
|
1796
|
+
pipe(createIntent4(LayoutAction3.SetLayoutMode, {
|
|
1797
|
+
layoutMode: "deck"
|
|
1798
|
+
}), chain(NavigationAction3.Close, {
|
|
1799
|
+
activeParts: {
|
|
1800
|
+
solo: [
|
|
1801
|
+
entryId
|
|
1802
|
+
]
|
|
1803
|
+
}
|
|
1804
|
+
}), chain(NavigationAction3.Open, {
|
|
1805
|
+
activeParts: {
|
|
1806
|
+
main: [
|
|
1807
|
+
entryId
|
|
1808
|
+
]
|
|
1809
|
+
},
|
|
1810
|
+
noToggle: true
|
|
1811
|
+
}), chain(LayoutAction3.ScrollIntoView, {
|
|
1812
|
+
id: entryId
|
|
1813
|
+
}))
|
|
1814
|
+
]
|
|
1815
|
+
};
|
|
1843
1816
|
}
|
|
1844
1817
|
}
|
|
1845
1818
|
});
|
|
1846
|
-
}
|
|
1847
|
-
|
|
1819
|
+
})
|
|
1820
|
+
];
|
|
1848
1821
|
}
|
|
1849
1822
|
}
|
|
1850
1823
|
}
|
|
@@ -1854,7 +1827,6 @@ var DeckPlugin = ({ observability } = {}) => {
|
|
|
1854
1827
|
// packages/plugins/plugin-deck/src/index.ts
|
|
1855
1828
|
var src_default = DeckPlugin;
|
|
1856
1829
|
export {
|
|
1857
|
-
DeckAction,
|
|
1858
1830
|
DeckPlugin,
|
|
1859
1831
|
src_default as default
|
|
1860
1832
|
};
|