@dxos/plugin-deck 0.6.8-main.046e6cf → 0.6.8-staging.77f93a3
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/index.mjs +59 -50
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/types/src/DeckPlugin.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/DeckLayout.d.ts +0 -6
- package/dist/types/src/components/DeckLayout/DeckLayout.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/Plank.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 +26 -26
- package/src/DeckPlugin.tsx +20 -22
- package/src/components/DeckLayout/DeckLayout.tsx +46 -51
- package/src/components/DeckLayout/Plank.tsx +11 -10
- package/src/util/overscroll.ts +2 -2
|
@@ -30,7 +30,7 @@ import React12, { useMemo as useMemo2 } from "react";
|
|
|
30
30
|
import { SLUG_PATH_SEPARATOR as SLUG_PATH_SEPARATOR3, Surface as Surface8, firstIdInPart, usePlugin } from "@dxos/app-framework";
|
|
31
31
|
import { Button as Button3, Dialog, Main as Main3, Popover as Popover2, useTranslation as useTranslation5 } from "@dxos/react-ui";
|
|
32
32
|
import { Deck } from "@dxos/react-ui-deck";
|
|
33
|
-
import { getSize
|
|
33
|
+
import { getSize } from "@dxos/react-ui-theme";
|
|
34
34
|
|
|
35
35
|
// packages/plugins/plugin-deck/src/components/DeckLayout/ActiveNode.tsx
|
|
36
36
|
import React from "react";
|
|
@@ -390,7 +390,7 @@ var Fullscreen = ({ id }) => {
|
|
|
390
390
|
|
|
391
391
|
// packages/plugins/plugin-deck/src/components/DeckLayout/Plank.tsx
|
|
392
392
|
import { Plus } from "@phosphor-icons/react";
|
|
393
|
-
import React9, { useCallback } from "react";
|
|
393
|
+
import React9, { useCallback, useLayoutEffect, useRef } from "react";
|
|
394
394
|
import { LayoutAction as LayoutAction2, NavigationAction as NavigationAction2, Surface as Surface6, useIntentDispatcher as useIntentDispatcher2 } from "@dxos/app-framework";
|
|
395
395
|
import { debounce } from "@dxos/async";
|
|
396
396
|
import { useGraph as useGraph5 } from "@dxos/plugin-graph";
|
|
@@ -430,22 +430,32 @@ var Plank = ({ entry, layoutParts, part, resizeable, flatDeck, searchEnabled, cl
|
|
|
430
430
|
part,
|
|
431
431
|
entryId: entry.id
|
|
432
432
|
};
|
|
433
|
+
const ref = useRef(null);
|
|
434
|
+
useLayoutEffect(() => {
|
|
435
|
+
if (scrollIntoView === entry.id) {
|
|
436
|
+
ref.current?.scrollIntoView({
|
|
437
|
+
behavior: "smooth",
|
|
438
|
+
inline: "center"
|
|
439
|
+
});
|
|
440
|
+
}
|
|
441
|
+
}, [
|
|
442
|
+
scrollIntoView
|
|
443
|
+
]);
|
|
433
444
|
return /* @__PURE__ */ React9.createElement(NaturalPlank.Root, {
|
|
434
445
|
size,
|
|
435
446
|
setSize
|
|
436
447
|
}, /* @__PURE__ */ React9.createElement(NaturalPlank.Content, {
|
|
437
448
|
...attendableAttrs,
|
|
449
|
+
ref,
|
|
438
450
|
classNames: [
|
|
439
451
|
!flatDeck && "surface-base",
|
|
440
452
|
classNames
|
|
441
|
-
]
|
|
442
|
-
scrollIntoViewOnMount: entry.id === scrollIntoView,
|
|
443
|
-
suppressAutofocus: entry.id === NAV_ID || !!node?.properties?.managesAutofocus
|
|
453
|
+
]
|
|
444
454
|
}, node ? /* @__PURE__ */ React9.createElement(React9.Fragment, null, /* @__PURE__ */ React9.createElement(NodePlankHeading, {
|
|
455
|
+
id: entry.id,
|
|
456
|
+
node,
|
|
445
457
|
layoutPart: coordinate.part,
|
|
446
458
|
layoutParts,
|
|
447
|
-
node,
|
|
448
|
-
id: entry.id,
|
|
449
459
|
popoverAnchorId,
|
|
450
460
|
flatDeck
|
|
451
461
|
}), /* @__PURE__ */ React9.createElement(Surface6, {
|
|
@@ -583,7 +593,7 @@ var getEffectivePart = (partName, layoutMode) => layoutMode === "solo" && partNa
|
|
|
583
593
|
|
|
584
594
|
// packages/plugins/plugin-deck/src/util/overscroll.ts
|
|
585
595
|
import { PLANK_DEFAULTS } from "@dxos/react-ui-deck";
|
|
586
|
-
var calculateOverscroll = (layoutMode,
|
|
596
|
+
var calculateOverscroll = (layoutMode, layoutParts, plankSizing, sidebarOpen, complementarySidebarOpen, overscroll) => {
|
|
587
597
|
if (!(layoutMode === "deck" && overscroll === "centering")) {
|
|
588
598
|
return;
|
|
589
599
|
}
|
|
@@ -621,6 +631,7 @@ var DeckLayout = ({ showHintsFooter, toasts, onDismissToast, flatDeck, attention
|
|
|
621
631
|
const { layoutMode, sidebarOpen, complementarySidebarOpen, dialogOpen, dialogContent, dialogBlockAlign, popoverOpen, popoverContent, popoverAnchorId } = context;
|
|
622
632
|
const { t } = useTranslation5(DECK_PLUGIN);
|
|
623
633
|
const { plankSizing } = useDeckContext();
|
|
634
|
+
const searchEnabled = !!usePlugin("dxos.org/plugin/search");
|
|
624
635
|
const fullScreenSlug = useMemo2(() => firstIdInPart(layoutParts, "fullScreen"), [
|
|
625
636
|
layoutParts
|
|
626
637
|
]);
|
|
@@ -632,11 +643,11 @@ var DeckLayout = ({ showHintsFooter, toasts, onDismissToast, flatDeck, attention
|
|
|
632
643
|
}, [
|
|
633
644
|
layoutParts
|
|
634
645
|
]);
|
|
635
|
-
const searchEnabled = !!usePlugin("dxos.org/plugin/search");
|
|
636
646
|
const activeId = useMemo2(() => Array.from(attention.attended ?? [])[0], [
|
|
637
647
|
attention.attended
|
|
638
648
|
]);
|
|
639
|
-
const overscrollAmount = calculateOverscroll(layoutMode,
|
|
649
|
+
const overscrollAmount = calculateOverscroll(layoutMode, layoutParts, plankSizing, sidebarOpen, complementarySidebarOpen, overscroll);
|
|
650
|
+
const isEmpty = layoutMode === "solo" && (!layoutParts.solo || layoutParts.solo.length === 0) || layoutMode === "deck" && (!layoutParts.main || layoutParts.main.length === 0);
|
|
640
651
|
if (layoutMode === "fullscreen") {
|
|
641
652
|
return /* @__PURE__ */ React12.createElement(Fullscreen, {
|
|
642
653
|
id: fullScreenSlug
|
|
@@ -699,53 +710,44 @@ var DeckLayout = ({ showHintsFooter, toasts, onDismissToast, flatDeck, attention
|
|
|
699
710
|
id: complementarySlug,
|
|
700
711
|
layoutParts,
|
|
701
712
|
flatDeck
|
|
702
|
-
}), /* @__PURE__ */ React12.createElement(Main3.Overlay, null),
|
|
713
|
+
}), /* @__PURE__ */ React12.createElement(Main3.Overlay, null), isEmpty && /* @__PURE__ */ React12.createElement(Main3.Content, null, /* @__PURE__ */ React12.createElement(ContentEmpty, null)), !isEmpty && /* @__PURE__ */ React12.createElement(Main3.Content, {
|
|
703
714
|
bounce: true,
|
|
704
715
|
classNames: [
|
|
705
716
|
"grid",
|
|
706
717
|
"block-end-[--statusbar-size]"
|
|
707
718
|
]
|
|
708
|
-
}, /* @__PURE__ */ React12.createElement("div", {
|
|
709
|
-
role: "none",
|
|
710
|
-
className: "relative"
|
|
711
719
|
}, /* @__PURE__ */ React12.createElement(Deck.Root, {
|
|
712
|
-
classNames:
|
|
720
|
+
classNames: [
|
|
721
|
+
!flatDeck && "surface-deck",
|
|
722
|
+
layoutMode === "deck" && [
|
|
723
|
+
"absolute inset-0",
|
|
724
|
+
"transition-[padding] duration-200 ease-in-out",
|
|
725
|
+
slots?.wallpaper?.classNames
|
|
726
|
+
]
|
|
727
|
+
],
|
|
728
|
+
solo: layoutMode === "solo",
|
|
713
729
|
style: {
|
|
714
730
|
...overscrollAmount
|
|
715
731
|
}
|
|
716
|
-
}, layoutParts.
|
|
732
|
+
}, layoutMode === "solo" && layoutParts.solo?.map((layoutEntry) => {
|
|
717
733
|
return /* @__PURE__ */ React12.createElement(Plank, {
|
|
718
734
|
key: layoutEntry.id,
|
|
719
735
|
entry: layoutEntry,
|
|
720
736
|
layoutParts,
|
|
721
|
-
part: "
|
|
722
|
-
|
|
723
|
-
flatDeck,
|
|
724
|
-
searchEnabled
|
|
737
|
+
part: "solo",
|
|
738
|
+
flatDeck
|
|
725
739
|
});
|
|
726
|
-
})
|
|
727
|
-
bounce: true,
|
|
728
|
-
classNames: [
|
|
729
|
-
"grid",
|
|
730
|
-
"block-end-[--statusbar-size]"
|
|
731
|
-
]
|
|
732
|
-
}, /* @__PURE__ */ React12.createElement(Deck.Root, {
|
|
733
|
-
classNames: [
|
|
734
|
-
!flatDeck && "surface-deck",
|
|
735
|
-
slots?.wallpaper?.classNames,
|
|
736
|
-
slots?.deck?.classNames
|
|
737
|
-
],
|
|
738
|
-
solo: true
|
|
739
|
-
}, layoutParts.solo.map((layoutEntry) => {
|
|
740
|
+
}), layoutMode === "deck" && layoutParts.main?.map((layoutEntry) => {
|
|
740
741
|
return /* @__PURE__ */ React12.createElement(Plank, {
|
|
741
742
|
key: layoutEntry.id,
|
|
742
743
|
entry: layoutEntry,
|
|
743
744
|
layoutParts,
|
|
744
|
-
part: "
|
|
745
|
+
part: "main",
|
|
746
|
+
resizeable: true,
|
|
745
747
|
flatDeck,
|
|
746
|
-
|
|
748
|
+
searchEnabled
|
|
747
749
|
});
|
|
748
|
-
}))),
|
|
750
|
+
}))), /* @__PURE__ */ React12.createElement(Main3.Content, {
|
|
749
751
|
role: "none",
|
|
750
752
|
classNames: [
|
|
751
753
|
"fixed inset-inline-0 block-end-0 z-[2]"
|
|
@@ -1044,12 +1046,6 @@ var appScheme = "composer://";
|
|
|
1044
1046
|
var customSlots = {
|
|
1045
1047
|
wallpaper: {
|
|
1046
1048
|
classNames: "bg-cover bg-no-repeat dark:bg-[url(https://cdn.midjourney.com/3865ba61-f98a-4d94-b91a-1763ead01f4f/0_0.jpeg)]"
|
|
1047
|
-
},
|
|
1048
|
-
deck: {
|
|
1049
|
-
classNames: "px-96 bg-neutral-50 __dark:bg-neutral-950 dark:bg-transparent dark:opacity-95"
|
|
1050
|
-
},
|
|
1051
|
-
plank: {
|
|
1052
|
-
classNames: "mx-1 bg-neutral-25 dark:bg-neutral-900"
|
|
1053
1049
|
}
|
|
1054
1050
|
};
|
|
1055
1051
|
setAutoFreeze(false);
|
|
@@ -1224,7 +1220,21 @@ var DeckPlugin = ({ observability } = {}) => {
|
|
|
1224
1220
|
checkAppScheme(appScheme);
|
|
1225
1221
|
}
|
|
1226
1222
|
handleNavigation = async () => {
|
|
1227
|
-
const
|
|
1223
|
+
const pathname = window.location.pathname;
|
|
1224
|
+
if (pathname === "/reset") {
|
|
1225
|
+
location.values.active = {
|
|
1226
|
+
sidebar: [
|
|
1227
|
+
{
|
|
1228
|
+
id: NAV_ID
|
|
1229
|
+
}
|
|
1230
|
+
]
|
|
1231
|
+
};
|
|
1232
|
+
location.values.closed = [];
|
|
1233
|
+
layout.values.layoutMode = "solo";
|
|
1234
|
+
window.location.pathname = "/";
|
|
1235
|
+
return;
|
|
1236
|
+
}
|
|
1237
|
+
const layoutFromUri = uriToSoloPart(pathname);
|
|
1228
1238
|
if (!layoutFromUri) {
|
|
1229
1239
|
return;
|
|
1230
1240
|
}
|
|
@@ -1364,7 +1374,7 @@ var DeckPlugin = ({ observability } = {}) => {
|
|
|
1364
1374
|
} else {
|
|
1365
1375
|
log.warn("Invalid layout mode", intent?.data?.layoutMode, {
|
|
1366
1376
|
F: __dxlog_file,
|
|
1367
|
-
L:
|
|
1377
|
+
L: 388,
|
|
1368
1378
|
S: void 0,
|
|
1369
1379
|
C: (f, a) => f(...a)
|
|
1370
1380
|
});
|
|
@@ -1417,8 +1427,8 @@ var DeckPlugin = ({ observability } = {}) => {
|
|
|
1417
1427
|
if (!intent.data || !intent.data?.activeParts) {
|
|
1418
1428
|
return;
|
|
1419
1429
|
}
|
|
1420
|
-
const newPlankPositioning = settings.values.newPlankPositioning;
|
|
1421
1430
|
const processLayoutEntry = (partName, entryString, currentLayout) => {
|
|
1431
|
+
const toggle = false;
|
|
1422
1432
|
const [id, path] = entryString.split(SLUG_PATH_SEPARATOR5);
|
|
1423
1433
|
const layoutEntry = {
|
|
1424
1434
|
id,
|
|
@@ -1427,14 +1437,14 @@ var DeckPlugin = ({ observability } = {}) => {
|
|
|
1427
1437
|
} : {}
|
|
1428
1438
|
};
|
|
1429
1439
|
const effectivePart = getEffectivePart(partName, layoutMode);
|
|
1430
|
-
if (layoutMode === "deck" && effectivePart === "main" && currentLayout[effectivePart]?.some((entry) => entry.id === id) && !intent.data?.noToggle) {
|
|
1440
|
+
if (toggle && layoutMode === "deck" && effectivePart === "main" && currentLayout[effectivePart]?.some((entry) => entry.id === id) && !intent.data?.noToggle) {
|
|
1431
1441
|
return closeEntry(currentLayout, {
|
|
1432
1442
|
part: effectivePart,
|
|
1433
1443
|
entryId: id
|
|
1434
1444
|
});
|
|
1435
1445
|
} else {
|
|
1436
1446
|
return openEntry(currentLayout, effectivePart, layoutEntry, {
|
|
1437
|
-
positioning: newPlankPositioning
|
|
1447
|
+
positioning: settings.values.newPlankPositioning
|
|
1438
1448
|
});
|
|
1439
1449
|
}
|
|
1440
1450
|
};
|
|
@@ -1562,11 +1572,10 @@ var DeckPlugin = ({ observability } = {}) => {
|
|
|
1562
1572
|
if (isLayoutAdjustment(intent.data)) {
|
|
1563
1573
|
const adjustment = intent.data;
|
|
1564
1574
|
if (adjustment.type === "increment-end" || adjustment.type === "increment-start") {
|
|
1565
|
-
|
|
1575
|
+
location.values.active = incrementPlank(location.values.active, {
|
|
1566
1576
|
type: adjustment.type,
|
|
1567
1577
|
layoutCoordinate: adjustment.layoutCoordinate
|
|
1568
1578
|
});
|
|
1569
|
-
location.values.active = nextActive;
|
|
1570
1579
|
}
|
|
1571
1580
|
if (adjustment.type === "solo") {
|
|
1572
1581
|
const entryId = adjustment.layoutCoordinate.entryId;
|