@dxos/plugin-deck 0.8.4-main.a4bbb77 → 0.8.4-main.ae835ea
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/{app-graph-builder-7SR53CCK.mjs → app-graph-builder-PCMSER2O.mjs} +6 -5
- package/dist/lib/browser/app-graph-builder-PCMSER2O.mjs.map +7 -0
- package/dist/lib/browser/{check-app-scheme-GCOL6YDT.mjs → check-app-scheme-HIEVFAAX.mjs} +2 -2
- package/dist/lib/browser/{chunk-WOCUNO27.mjs → chunk-27I7DJUG.mjs} +5 -5
- package/dist/lib/browser/{chunk-WOCUNO27.mjs.map → chunk-27I7DJUG.mjs.map} +2 -2
- package/dist/lib/browser/{chunk-HUWUYTOI.mjs → chunk-5KMJPIQC.mjs} +2 -2
- package/dist/lib/browser/{chunk-VSJ7FFQS.mjs → chunk-F3VCCHVL.mjs} +6 -4
- package/dist/lib/browser/chunk-F3VCCHVL.mjs.map +7 -0
- package/dist/lib/browser/{chunk-7CL25AYA.mjs → chunk-MFFZK4LT.mjs} +13 -13
- package/dist/lib/browser/{chunk-7CL25AYA.mjs.map → chunk-MFFZK4LT.mjs.map} +3 -3
- package/dist/lib/browser/{chunk-QHJ7N7BF.mjs → chunk-SBJLGRJV.mjs} +322 -288
- package/dist/lib/browser/chunk-SBJLGRJV.mjs.map +7 -0
- package/dist/lib/browser/chunk-UXLU6CMW.mjs +16 -0
- package/dist/lib/browser/chunk-UXLU6CMW.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +6 -5
- package/dist/lib/browser/index.mjs.map +2 -2
- package/dist/lib/browser/{intent-resolver-Y5YOA4NR.mjs → intent-resolver-Q3KETDSS.mjs} +12 -9
- package/dist/lib/browser/intent-resolver-Q3KETDSS.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{react-root-A537NMT6.mjs → react-root-LU3662ME.mjs} +7 -7
- package/dist/lib/browser/{react-surface-DAS4HS3Y.mjs → react-surface-TDBFPN5T.mjs} +7 -7
- package/dist/lib/browser/{settings-3642GPOR.mjs → settings-SDPTOCCM.mjs} +5 -4
- package/dist/lib/browser/{settings-3642GPOR.mjs.map → settings-SDPTOCCM.mjs.map} +3 -3
- package/dist/lib/browser/state-QTVNH7N6.mjs +12 -0
- package/dist/lib/browser/toolkit-TM2Y6YL2.mjs +53 -0
- package/dist/lib/browser/toolkit-TM2Y6YL2.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +2 -2
- package/dist/lib/browser/{url-handler-354LL74P.mjs → url-handler-QEYGYE2H.mjs} +4 -4
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -1
- package/dist/types/src/capabilities/settings.d.ts.map +1 -1
- package/dist/types/src/capabilities/state.d.ts +3 -0
- package/dist/types/src/capabilities/state.d.ts.map +1 -1
- package/dist/types/src/capabilities/toolkit.d.ts +21 -3
- package/dist/types/src/capabilities/toolkit.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/DeckLayout.d.ts +2 -3
- package/dist/types/src/components/DeckLayout/DeckLayout.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/DeckLayout.stories.d.ts +74 -0
- package/dist/types/src/components/DeckLayout/DeckLayout.stories.d.ts.map +1 -0
- package/dist/types/src/components/DeckLayout/DeckMain.d.ts +3 -0
- package/dist/types/src/components/DeckLayout/DeckMain.d.ts.map +1 -0
- package/dist/types/src/components/DeckLayout/Toast.d.ts +5 -0
- package/dist/types/src/components/DeckLayout/Toast.d.ts.map +1 -1
- package/dist/types/src/components/DeckSettings/DeckSettings.d.ts.map +1 -1
- package/dist/types/src/components/Plank/Plank.d.ts.map +1 -1
- package/dist/types/src/components/Plank/Plank.stories.d.ts +1 -0
- package/dist/types/src/components/Plank/Plank.stories.d.ts.map +1 -1
- package/dist/types/src/components/Plank/PlankHeading.d.ts.map +1 -1
- package/dist/types/src/hooks/useHoistStatusbar.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +1 -0
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/schema.d.ts +2 -1
- package/dist/types/src/types/schema.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +32 -33
- package/src/capabilities/app-graph-builder.ts +3 -2
- package/src/capabilities/intent-resolver.ts +6 -3
- package/src/capabilities/settings.ts +1 -0
- package/src/capabilities/state.ts +3 -0
- package/src/capabilities/toolkit.ts +23 -10
- package/src/capabilities/tools.ts +1 -1
- package/src/components/DeckLayout/DeckLayout.stories.tsx +64 -0
- package/src/components/DeckLayout/DeckLayout.tsx +8 -278
- package/src/components/DeckLayout/DeckMain.tsx +285 -0
- package/src/components/DeckLayout/Toast.tsx +25 -0
- package/src/components/DeckSettings/DeckSettings.tsx +6 -0
- package/src/components/Plank/Plank.tsx +27 -12
- package/src/components/Plank/PlankHeading.tsx +2 -1
- package/src/hooks/useHoistStatusbar.ts +3 -2
- package/src/meta.ts +5 -0
- package/src/translations.ts +1 -0
- package/src/types/schema.ts +3 -1
- package/dist/lib/browser/app-graph-builder-7SR53CCK.mjs.map +0 -7
- package/dist/lib/browser/chunk-MHP4GPX5.mjs +0 -11
- package/dist/lib/browser/chunk-MHP4GPX5.mjs.map +0 -7
- package/dist/lib/browser/chunk-QHJ7N7BF.mjs.map +0 -7
- package/dist/lib/browser/chunk-VSJ7FFQS.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-Y5YOA4NR.mjs.map +0 -7
- package/dist/lib/browser/state-MKKK3WGD.mjs +0 -12
- package/dist/lib/browser/toolkit-UPUBQIYU.mjs +0 -61
- package/dist/lib/browser/toolkit-UPUBQIYU.mjs.map +0 -7
- /package/dist/lib/browser/{check-app-scheme-GCOL6YDT.mjs.map → check-app-scheme-HIEVFAAX.mjs.map} +0 -0
- /package/dist/lib/browser/{chunk-HUWUYTOI.mjs.map → chunk-5KMJPIQC.mjs.map} +0 -0
- /package/dist/lib/browser/{react-root-A537NMT6.mjs.map → react-root-LU3662ME.mjs.map} +0 -0
- /package/dist/lib/browser/{react-surface-DAS4HS3Y.mjs.map → react-surface-TDBFPN5T.mjs.map} +0 -0
- /package/dist/lib/browser/{state-MKKK3WGD.mjs.map → state-QTVNH7N6.mjs.map} +0 -0
- /package/dist/lib/browser/{url-handler-354LL74P.mjs.map → url-handler-QEYGYE2H.mjs.map} +0 -0
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
useHoistStatusbar,
|
|
7
7
|
useMainSize,
|
|
8
8
|
useNodeActionExpander
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-MFFZK4LT.mjs";
|
|
10
10
|
import {
|
|
11
11
|
calculateOverscroll,
|
|
12
12
|
layoutAppliesTopbar,
|
|
@@ -14,17 +14,17 @@ import {
|
|
|
14
14
|
} from "./chunk-CNTGBCMK.mjs";
|
|
15
15
|
import {
|
|
16
16
|
DeckCapabilities
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-5KMJPIQC.mjs";
|
|
18
18
|
import {
|
|
19
19
|
DeckAction,
|
|
20
20
|
NewPlankPositions,
|
|
21
21
|
OverscrollOptions,
|
|
22
22
|
PLANK_COMPANION_TYPE,
|
|
23
23
|
getMode
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-F3VCCHVL.mjs";
|
|
25
25
|
import {
|
|
26
26
|
meta
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-UXLU6CMW.mjs";
|
|
28
28
|
|
|
29
29
|
// src/components/DeckLayout/Banner.tsx
|
|
30
30
|
import { useSignals as _useSignals9 } from "@preact-signals/safe-react/tracking";
|
|
@@ -318,7 +318,8 @@ var PlankHeading = /* @__PURE__ */ memo(({ id, part, node, deckEnabled, canIncre
|
|
|
318
318
|
...layoutMode === "solo--fullscreen" ? [
|
|
319
319
|
hoverableControls,
|
|
320
320
|
hoverableFocusedWithinControls,
|
|
321
|
-
"*:transition-opacity *:opacity-[--controls-opacity] bg-transparent border-transparent transition-[background-color,border-color]
|
|
321
|
+
"*:transition-opacity *:opacity-[--controls-opacity] bg-transparent border-transparent transition-[background-color,border-color]",
|
|
322
|
+
"hover-hover:hover:bg-headerSurface focus-within:bg-headerSurface hover-hover:hover:border-subduedSeparator focus-within:border-subduedSeparator"
|
|
322
323
|
] : []
|
|
323
324
|
],
|
|
324
325
|
"data-plank-heading": true
|
|
@@ -445,7 +446,8 @@ var Plank = /* @__PURE__ */ memo2(({ id = UNKNOWN_ID, companionId, ...props }) =
|
|
|
445
446
|
const hasCompanion = !!(companionId && currentCompanion);
|
|
446
447
|
return /* @__PURE__ */ React5.createElement(PlankContainer, {
|
|
447
448
|
solo: props.part === "solo",
|
|
448
|
-
companion: hasCompanion
|
|
449
|
+
companion: hasCompanion,
|
|
450
|
+
encapsulate: !!props.settings?.encapsulatedPlanks
|
|
449
451
|
}, /* @__PURE__ */ React5.createElement(PlankComponent, {
|
|
450
452
|
id,
|
|
451
453
|
node,
|
|
@@ -472,7 +474,7 @@ var Plank = /* @__PURE__ */ memo2(({ id = UNKNOWN_ID, companionId, ...props }) =
|
|
|
472
474
|
_effect.f();
|
|
473
475
|
}
|
|
474
476
|
});
|
|
475
|
-
var PlankContainer = ({ children, solo, companion }) => {
|
|
477
|
+
var PlankContainer = ({ children, solo, companion, encapsulate }) => {
|
|
476
478
|
var _effect = _useSignals5();
|
|
477
479
|
try {
|
|
478
480
|
const sizeAttrs = useMainSize();
|
|
@@ -481,7 +483,7 @@ var PlankContainer = ({ children, solo, companion }) => {
|
|
|
481
483
|
}
|
|
482
484
|
return /* @__PURE__ */ React5.createElement("div", {
|
|
483
485
|
role: "none",
|
|
484
|
-
className: mx3("absolute inset-
|
|
486
|
+
className: mx3("absolute inset-[--main-spacing] grid", encapsulate && "border border-separator rounded overflow-hidden", companion && "grid-cols-[6fr_4fr]", railGridHorizontal, mainIntrinsicSize),
|
|
485
487
|
...sizeAttrs
|
|
486
488
|
}, children);
|
|
487
489
|
} finally {
|
|
@@ -519,11 +521,7 @@ var PlankComponent = /* @__PURE__ */ memo2(({ layoutMode, id, part, path, order,
|
|
|
519
521
|
}, []);
|
|
520
522
|
useLayoutEffect(() => {
|
|
521
523
|
if (scrollIntoView === id) {
|
|
522
|
-
|
|
523
|
-
focusable?.focus({
|
|
524
|
-
preventScroll: true
|
|
525
|
-
});
|
|
526
|
-
layoutMode === "deck" && focusable?.scrollIntoView({
|
|
524
|
+
layoutMode === "deck" && rootElement.current?.scrollIntoView({
|
|
527
525
|
behavior: "smooth",
|
|
528
526
|
inline: "center"
|
|
529
527
|
});
|
|
@@ -541,14 +539,17 @@ var PlankComponent = /* @__PURE__ */ memo2(({ layoutMode, id, part, path, order,
|
|
|
541
539
|
const isAttendable = layoutMode.startsWith("solo") && part.startsWith("solo") || layoutMode === "deck" && part === "deck";
|
|
542
540
|
const sizeAttrs = useMainSize();
|
|
543
541
|
const data = useMemo2(() => node && {
|
|
542
|
+
attendableId: id,
|
|
544
543
|
subject: node.data,
|
|
545
544
|
companionTo: primary?.data,
|
|
545
|
+
properties: node.properties,
|
|
546
546
|
variant,
|
|
547
547
|
path,
|
|
548
548
|
popoverAnchorId
|
|
549
549
|
}, [
|
|
550
550
|
node,
|
|
551
551
|
node?.data,
|
|
552
|
+
node?.properties,
|
|
552
553
|
path,
|
|
553
554
|
popoverAnchorId,
|
|
554
555
|
primary?.data,
|
|
@@ -556,7 +557,7 @@ var PlankComponent = /* @__PURE__ */ memo2(({ layoutMode, id, part, path, order,
|
|
|
556
557
|
]);
|
|
557
558
|
const placeholder = useMemo2(() => /* @__PURE__ */ React5.createElement(PlankLoading, null), []);
|
|
558
559
|
const Root = part.startsWith("solo") ? "article" : StackItem2.Root;
|
|
559
|
-
const className = mx3("attention-surface relative dx-focus-ring-inset-over-all density-coarse", isSolo &&
|
|
560
|
+
const className = mx3("attention-surface relative dx-focus-ring-inset-over-all density-coarse", isSolo && "absolute inset-0", isSolo && mainIntrinsicSize, railGridHorizontal, part.startsWith("solo") && "grid", part === "deck" && (companioned === "companion" ? "!border-separator border-ie" : "!border-separator border-li"), part.startsWith("solo-") && "row-span-2 grid-rows-subgrid min-is-0", part === "solo-companion" && "!border-separator border-is", settings?.encapsulatedPlanks && !part.startsWith("solo") && "mli-[--main-spacing] !border-separator border rounded overflow-hidden");
|
|
560
561
|
return /* @__PURE__ */ React5.createElement(Root, {
|
|
561
562
|
ref: rootElement,
|
|
562
563
|
"data-testid": "deck.plank",
|
|
@@ -923,14 +924,9 @@ var Banner = ({ variant, classNames }) => {
|
|
|
923
924
|
};
|
|
924
925
|
|
|
925
926
|
// src/components/DeckLayout/DeckLayout.tsx
|
|
926
|
-
import { useSignals as
|
|
927
|
-
import
|
|
928
|
-
import
|
|
929
|
-
import { Capabilities, LayoutAction as LayoutAction5, createIntent as createIntent6, useCapability as useCapability8, useIntentDispatcher as useIntentDispatcher6, usePluginManager } from "@dxos/app-framework";
|
|
930
|
-
import { AttentionCapabilities } from "@dxos/plugin-attention";
|
|
931
|
-
import { Main as Main3, useMediaQuery, useOnTransition } from "@dxos/react-ui";
|
|
932
|
-
import { DEFAULT_HORIZONTAL_SIZE, Stack, StackContext } from "@dxos/react-ui-stack";
|
|
933
|
-
import { mainPaddingTransitions } from "@dxos/react-ui-theme";
|
|
927
|
+
import { useSignals as _useSignals18 } from "@preact-signals/safe-react/tracking";
|
|
928
|
+
import React18 from "react";
|
|
929
|
+
import { useCapability as useCapability9 } from "@dxos/app-framework";
|
|
934
930
|
|
|
935
931
|
// src/components/DeckLayout/ActiveNode.tsx
|
|
936
932
|
import { useSignals as _useSignals10 } from "@preact-signals/safe-react/tracking";
|
|
@@ -960,6 +956,16 @@ var ActiveNode = () => {
|
|
|
960
956
|
}
|
|
961
957
|
};
|
|
962
958
|
|
|
959
|
+
// src/components/DeckLayout/DeckMain.tsx
|
|
960
|
+
import { useSignals as _useSignals14 } from "@preact-signals/safe-react/tracking";
|
|
961
|
+
import { untracked } from "@preact/signals-core";
|
|
962
|
+
import React14, { Fragment as Fragment3, useCallback as useCallback6, useEffect as useEffect4, useMemo as useMemo5, useRef as useRef2 } from "react";
|
|
963
|
+
import { Capabilities, LayoutAction as LayoutAction5, createIntent as createIntent6, useCapability as useCapability6, useIntentDispatcher as useIntentDispatcher6, usePluginManager } from "@dxos/app-framework";
|
|
964
|
+
import { AttentionCapabilities } from "@dxos/plugin-attention";
|
|
965
|
+
import { Main as Main3, useMediaQuery, useOnTransition } from "@dxos/react-ui";
|
|
966
|
+
import { DEFAULT_HORIZONTAL_SIZE, Stack, StackContext } from "@dxos/react-ui-stack";
|
|
967
|
+
import { mainPaddingTransitions, mx as mx5 } from "@dxos/react-ui-theme";
|
|
968
|
+
|
|
963
969
|
// src/components/DeckLayout/ContentEmpty.tsx
|
|
964
970
|
import { useSignals as _useSignals11 } from "@preact-signals/safe-react/tracking";
|
|
965
971
|
import React11 from "react";
|
|
@@ -986,156 +992,23 @@ var ContentEmpty = () => {
|
|
|
986
992
|
}
|
|
987
993
|
};
|
|
988
994
|
|
|
989
|
-
// src/components/DeckLayout/
|
|
995
|
+
// src/components/DeckLayout/StatusBar.tsx
|
|
990
996
|
import { useSignals as _useSignals12 } from "@preact-signals/safe-react/tracking";
|
|
991
997
|
import React12 from "react";
|
|
992
|
-
import { Surface as Surface8
|
|
993
|
-
import { AlertDialog, Dialog as NaturalDialog } from "@dxos/react-ui";
|
|
994
|
-
var Dialog = () => {
|
|
995
|
-
var _effect = _useSignals12();
|
|
996
|
-
try {
|
|
997
|
-
const context = useCapability6(DeckCapabilities.MutableDeckState);
|
|
998
|
-
const { dialogOpen, dialogType, dialogBlockAlign, dialogOverlayClasses, dialogOverlayStyle, dialogContent } = context;
|
|
999
|
-
const Root = dialogType === "alert" ? AlertDialog.Root : NaturalDialog.Root;
|
|
1000
|
-
const Overlay = dialogType === "alert" ? AlertDialog.Overlay : NaturalDialog.Overlay;
|
|
1001
|
-
return /* @__PURE__ */ React12.createElement(Root, {
|
|
1002
|
-
modal: dialogBlockAlign !== "end",
|
|
1003
|
-
open: dialogOpen,
|
|
1004
|
-
onOpenChange: (nextOpen) => context.dialogOpen = nextOpen
|
|
1005
|
-
}, dialogBlockAlign === "end" ? (
|
|
1006
|
-
// TODO(burdon): Placeholder creates a suspense boundary; replace with defaults.
|
|
1007
|
-
/* @__PURE__ */ React12.createElement(Surface8, {
|
|
1008
|
-
role: "dialog",
|
|
1009
|
-
data: dialogContent,
|
|
1010
|
-
limit: 1,
|
|
1011
|
-
fallback: PlankContentError,
|
|
1012
|
-
placeholder: /* @__PURE__ */ React12.createElement("div", null)
|
|
1013
|
-
})
|
|
1014
|
-
) : /* @__PURE__ */ React12.createElement(Overlay, {
|
|
1015
|
-
blockAlign: dialogBlockAlign,
|
|
1016
|
-
classNames: dialogOverlayClasses,
|
|
1017
|
-
style: dialogOverlayStyle
|
|
1018
|
-
}, /* @__PURE__ */ React12.createElement(Surface8, {
|
|
1019
|
-
role: "dialog",
|
|
1020
|
-
data: dialogContent,
|
|
1021
|
-
limit: 1,
|
|
1022
|
-
fallback: PlankContentError
|
|
1023
|
-
})));
|
|
1024
|
-
} finally {
|
|
1025
|
-
_effect.f();
|
|
1026
|
-
}
|
|
1027
|
-
};
|
|
1028
|
-
|
|
1029
|
-
// src/components/DeckLayout/Popover.tsx
|
|
1030
|
-
import { useSignals as _useSignals13 } from "@preact-signals/safe-react/tracking";
|
|
1031
|
-
import { createContext } from "@radix-ui/react-context";
|
|
1032
|
-
import React13, { useCallback as useCallback6, useEffect as useEffect4, useMemo as useMemo5, useRef as useRef2, useState as useState3 } from "react";
|
|
1033
|
-
import { Surface as Surface9, useCapability as useCapability7 } from "@dxos/app-framework";
|
|
1034
|
-
import { Popover as Popover2 } from "@dxos/react-ui";
|
|
1035
|
-
var DEBOUNCE_DELAY = 40;
|
|
1036
|
-
var [DeckPopoverProvider, useDeckPopoverContext] = createContext("DeckPopover");
|
|
1037
|
-
var PopoverRoot = ({ children }) => {
|
|
1038
|
-
var _effect = _useSignals13();
|
|
1039
|
-
try {
|
|
1040
|
-
const layout = useCapability7(DeckCapabilities.MutableDeckState);
|
|
1041
|
-
const virtualRef = useRef2(null);
|
|
1042
|
-
const [virtualIter, setVirtualIter] = useState3(0);
|
|
1043
|
-
const [open, setOpen] = useState3(false);
|
|
1044
|
-
const debounceRef = useRef2(null);
|
|
1045
|
-
useEffect4(() => {
|
|
1046
|
-
setOpen(false);
|
|
1047
|
-
if (layout.popoverOpen) {
|
|
1048
|
-
if (debounceRef.current) {
|
|
1049
|
-
clearTimeout(debounceRef.current);
|
|
1050
|
-
}
|
|
1051
|
-
if (layout.popoverAnchor && virtualRef.current !== layout.popoverAnchor) {
|
|
1052
|
-
virtualRef.current = layout.popoverAnchor ?? null;
|
|
1053
|
-
setVirtualIter((iter) => iter + 1);
|
|
1054
|
-
}
|
|
1055
|
-
debounceRef.current = setTimeout(() => setOpen(true), DEBOUNCE_DELAY);
|
|
1056
|
-
}
|
|
1057
|
-
}, [
|
|
1058
|
-
layout.popoverOpen,
|
|
1059
|
-
layout.popoverAnchorId,
|
|
1060
|
-
layout.popoverAnchor,
|
|
1061
|
-
layout.popoverContent
|
|
1062
|
-
]);
|
|
1063
|
-
return /* @__PURE__ */ React13.createElement(DeckPopoverProvider, {
|
|
1064
|
-
setOpen
|
|
1065
|
-
}, /* @__PURE__ */ React13.createElement(Popover2.Root, {
|
|
1066
|
-
modal: false,
|
|
1067
|
-
open
|
|
1068
|
-
}, layout.popoverAnchor && /* @__PURE__ */ React13.createElement(Popover2.VirtualTrigger, {
|
|
1069
|
-
key: virtualIter,
|
|
1070
|
-
virtualRef
|
|
1071
|
-
}), children));
|
|
1072
|
-
} finally {
|
|
1073
|
-
_effect.f();
|
|
1074
|
-
}
|
|
1075
|
-
};
|
|
1076
|
-
var PopoverContent = () => {
|
|
1077
|
-
var _effect = _useSignals13();
|
|
1078
|
-
try {
|
|
1079
|
-
const layout = useCapability7(DeckCapabilities.MutableDeckState);
|
|
1080
|
-
const { setOpen } = useDeckPopoverContext("PopoverContent");
|
|
1081
|
-
const handleClose = useCallback6((event) => {
|
|
1082
|
-
if (
|
|
1083
|
-
// TODO(thure): CodeMirror should not focus itself when it updates.
|
|
1084
|
-
event.type === "dismissableLayer.focusOutside" && event.currentTarget?.classList.contains("cm-content")
|
|
1085
|
-
) {
|
|
1086
|
-
event.preventDefault();
|
|
1087
|
-
} else {
|
|
1088
|
-
setOpen(false);
|
|
1089
|
-
layout.popoverOpen = false;
|
|
1090
|
-
layout.popoverAnchor = void 0;
|
|
1091
|
-
layout.popoverAnchorId = void 0;
|
|
1092
|
-
layout.popoverSide = void 0;
|
|
1093
|
-
}
|
|
1094
|
-
}, [
|
|
1095
|
-
setOpen
|
|
1096
|
-
]);
|
|
1097
|
-
const collisionBoundaries = useMemo5(() => {
|
|
1098
|
-
const closest = layout.popoverAnchor?.closest("[data-popover-collision-boundary]");
|
|
1099
|
-
return closest ? [
|
|
1100
|
-
closest
|
|
1101
|
-
] : [];
|
|
1102
|
-
}, [
|
|
1103
|
-
layout.popoverAnchor
|
|
1104
|
-
]);
|
|
1105
|
-
return /* @__PURE__ */ React13.createElement(Popover2.Portal, null, /* @__PURE__ */ React13.createElement(Popover2.Content, {
|
|
1106
|
-
side: layout.popoverSide,
|
|
1107
|
-
onInteractOutside: handleClose,
|
|
1108
|
-
onEscapeKeyDown: handleClose,
|
|
1109
|
-
collisionBoundary: collisionBoundaries,
|
|
1110
|
-
sticky: "always",
|
|
1111
|
-
hideWhenDetached: true
|
|
1112
|
-
}, /* @__PURE__ */ React13.createElement(Popover2.Viewport, null, /* @__PURE__ */ React13.createElement(Surface9, {
|
|
1113
|
-
role: "card--popover",
|
|
1114
|
-
data: layout.popoverContent,
|
|
1115
|
-
limit: 1
|
|
1116
|
-
})), /* @__PURE__ */ React13.createElement(Popover2.Arrow, null)));
|
|
1117
|
-
} finally {
|
|
1118
|
-
_effect.f();
|
|
1119
|
-
}
|
|
1120
|
-
};
|
|
1121
|
-
|
|
1122
|
-
// src/components/DeckLayout/StatusBar.tsx
|
|
1123
|
-
import { useSignals as _useSignals14 } from "@preact-signals/safe-react/tracking";
|
|
1124
|
-
import React14 from "react";
|
|
1125
|
-
import { Surface as Surface10 } from "@dxos/app-framework";
|
|
998
|
+
import { Surface as Surface8 } from "@dxos/app-framework";
|
|
1126
999
|
import { useLandmarkMover } from "@dxos/react-ui";
|
|
1127
1000
|
var StatusBar = ({ showHints }) => {
|
|
1128
|
-
var _effect =
|
|
1001
|
+
var _effect = _useSignals12();
|
|
1129
1002
|
try {
|
|
1130
1003
|
const mover = useLandmarkMover(void 0, "3");
|
|
1131
|
-
return /* @__PURE__ */
|
|
1004
|
+
return /* @__PURE__ */ React12.createElement("div", {
|
|
1132
1005
|
role: "contentinfo",
|
|
1133
1006
|
className: "fixed block-end-0 inset-inline-0 bs-[--statusbar-size] border-bs border-separator z-[2] flex text-description",
|
|
1134
1007
|
...mover
|
|
1135
|
-
}, showHints && /* @__PURE__ */
|
|
1008
|
+
}, showHints && /* @__PURE__ */ React12.createElement(Surface8, {
|
|
1136
1009
|
role: "hints",
|
|
1137
1010
|
limit: 1
|
|
1138
|
-
}), /* @__PURE__ */
|
|
1011
|
+
}), /* @__PURE__ */ React12.createElement(Surface8, {
|
|
1139
1012
|
role: "status-bar",
|
|
1140
1013
|
limit: 1
|
|
1141
1014
|
}));
|
|
@@ -1144,49 +1017,13 @@ var StatusBar = ({ showHints }) => {
|
|
|
1144
1017
|
}
|
|
1145
1018
|
};
|
|
1146
1019
|
|
|
1147
|
-
// src/components/DeckLayout/Toast.tsx
|
|
1148
|
-
import { useSignals as _useSignals15 } from "@preact-signals/safe-react/tracking";
|
|
1149
|
-
import React15 from "react";
|
|
1150
|
-
import { Button, Icon as Icon2, Toast as NaturalToast, toLocalizedString as toLocalizedString3, useTranslation as useTranslation7 } from "@dxos/react-ui";
|
|
1151
|
-
var Toast = ({ id, title, description, icon, duration, actionLabel, actionAlt, closeLabel, onAction, onOpenChange }) => {
|
|
1152
|
-
var _effect = _useSignals15();
|
|
1153
|
-
try {
|
|
1154
|
-
const { t } = useTranslation7(meta.id);
|
|
1155
|
-
return /* @__PURE__ */ React15.createElement(NaturalToast.Root, {
|
|
1156
|
-
"data-testid": id,
|
|
1157
|
-
defaultOpen: true,
|
|
1158
|
-
duration,
|
|
1159
|
-
onOpenChange
|
|
1160
|
-
}, /* @__PURE__ */ React15.createElement(NaturalToast.Body, null, /* @__PURE__ */ React15.createElement(NaturalToast.Title, {
|
|
1161
|
-
classNames: "items-center"
|
|
1162
|
-
}, icon && /* @__PURE__ */ React15.createElement(Icon2, {
|
|
1163
|
-
icon,
|
|
1164
|
-
size: 5,
|
|
1165
|
-
classNames: "inline mr-1"
|
|
1166
|
-
}), title && /* @__PURE__ */ React15.createElement("span", null, toLocalizedString3(title, t))), description && /* @__PURE__ */ React15.createElement(NaturalToast.Description, null, description && toLocalizedString3(description, t))), /* @__PURE__ */ React15.createElement(NaturalToast.Actions, null, onAction && actionAlt && actionLabel && /* @__PURE__ */ React15.createElement(NaturalToast.Action, {
|
|
1167
|
-
altText: toLocalizedString3(actionAlt, t),
|
|
1168
|
-
asChild: true
|
|
1169
|
-
}, /* @__PURE__ */ React15.createElement(Button, {
|
|
1170
|
-
"data-testid": "toast.action",
|
|
1171
|
-
variant: "primary",
|
|
1172
|
-
onClick: () => onAction?.()
|
|
1173
|
-
}, toLocalizedString3(actionLabel, t))), closeLabel && /* @__PURE__ */ React15.createElement(NaturalToast.Close, {
|
|
1174
|
-
asChild: true
|
|
1175
|
-
}, /* @__PURE__ */ React15.createElement(Button, {
|
|
1176
|
-
"data-testid": "toast.close"
|
|
1177
|
-
}, toLocalizedString3(closeLabel, t)))));
|
|
1178
|
-
} finally {
|
|
1179
|
-
_effect.f();
|
|
1180
|
-
}
|
|
1181
|
-
};
|
|
1182
|
-
|
|
1183
1020
|
// src/components/DeckLayout/Topbar.tsx
|
|
1184
|
-
import { useSignals as
|
|
1185
|
-
import
|
|
1021
|
+
import { useSignals as _useSignals13 } from "@preact-signals/safe-react/tracking";
|
|
1022
|
+
import React13 from "react";
|
|
1186
1023
|
var Topbar = () => {
|
|
1187
|
-
var _effect =
|
|
1024
|
+
var _effect = _useSignals13();
|
|
1188
1025
|
try {
|
|
1189
|
-
return /* @__PURE__ */
|
|
1026
|
+
return /* @__PURE__ */ React13.createElement(Banner, {
|
|
1190
1027
|
variant: "topbar"
|
|
1191
1028
|
});
|
|
1192
1029
|
} finally {
|
|
@@ -1194,37 +1031,23 @@ var Topbar = () => {
|
|
|
1194
1031
|
}
|
|
1195
1032
|
};
|
|
1196
1033
|
|
|
1197
|
-
// src/components/DeckLayout/
|
|
1198
|
-
var
|
|
1199
|
-
var _effect =
|
|
1200
|
-
try {
|
|
1201
|
-
return order > 0 ? /* @__PURE__ */ React17.createElement("span", {
|
|
1202
|
-
role: "separator",
|
|
1203
|
-
className: "row-span-2 bg-deckSurface is-4",
|
|
1204
|
-
style: {
|
|
1205
|
-
gridColumn: order
|
|
1206
|
-
}
|
|
1207
|
-
}) : null;
|
|
1208
|
-
} finally {
|
|
1209
|
-
_effect.f();
|
|
1210
|
-
}
|
|
1211
|
-
};
|
|
1212
|
-
var DeckLayout = ({ onDismissToast }) => {
|
|
1213
|
-
var _effect = _useSignals17();
|
|
1034
|
+
// src/components/DeckLayout/DeckMain.tsx
|
|
1035
|
+
var DeckMain = () => {
|
|
1036
|
+
var _effect = _useSignals14();
|
|
1214
1037
|
try {
|
|
1215
1038
|
const { dispatchPromise: dispatch } = useIntentDispatcher6();
|
|
1216
|
-
const settings =
|
|
1217
|
-
const context =
|
|
1218
|
-
const { sidebarState, complementarySidebarState, complementarySidebarPanel, deck
|
|
1039
|
+
const settings = useCapability6(Capabilities.SettingsStore).getStore(meta.id)?.value;
|
|
1040
|
+
const context = useCapability6(DeckCapabilities.MutableDeckState);
|
|
1041
|
+
const { sidebarState, complementarySidebarState, complementarySidebarPanel, deck } = context;
|
|
1219
1042
|
const { active, activeCompanions, fullscreen, solo, plankSizing } = deck;
|
|
1220
|
-
const breakpoint = useBreakpoints();
|
|
1221
1043
|
const layoutMode = getMode(deck);
|
|
1044
|
+
const breakpoint = useBreakpoints();
|
|
1222
1045
|
const topbar = layoutAppliesTopbar(breakpoint, layoutMode);
|
|
1223
1046
|
const hoistStatusbar = useHoistStatusbar(breakpoint, layoutMode);
|
|
1224
1047
|
const pluginManager = usePluginManager();
|
|
1225
|
-
const scrollLeftRef =
|
|
1226
|
-
const deckRef =
|
|
1227
|
-
|
|
1048
|
+
const scrollLeftRef = useRef2(null);
|
|
1049
|
+
const deckRef = useRef2(null);
|
|
1050
|
+
useEffect4(() => {
|
|
1228
1051
|
const attended = untracked(() => {
|
|
1229
1052
|
const attention = pluginManager.context.getCapability(AttentionCapabilities.Attention);
|
|
1230
1053
|
return attention.current;
|
|
@@ -1234,11 +1057,9 @@ var DeckLayout = ({ onDismissToast }) => {
|
|
|
1234
1057
|
document.querySelector(`article[data-attendable-id="${firstId}"] button`)?.focus();
|
|
1235
1058
|
}
|
|
1236
1059
|
}, []);
|
|
1237
|
-
const [isNotMobile] = useMediaQuery("md"
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
const shouldRevert = useRef3(false);
|
|
1241
|
-
useEffect5(() => {
|
|
1060
|
+
const [isNotMobile] = useMediaQuery("md");
|
|
1061
|
+
const shouldRevert = useRef2(false);
|
|
1062
|
+
useEffect4(() => {
|
|
1242
1063
|
if (!isNotMobile && getMode(deck) === "deck") {
|
|
1243
1064
|
const attended = untracked(() => {
|
|
1244
1065
|
const attention = pluginManager.context.getCapability(AttentionCapabilities.Attention);
|
|
@@ -1265,8 +1086,8 @@ var DeckLayout = ({ onDismissToast }) => {
|
|
|
1265
1086
|
deck,
|
|
1266
1087
|
dispatch
|
|
1267
1088
|
]);
|
|
1268
|
-
|
|
1269
|
-
if (!settings
|
|
1089
|
+
useEffect4(() => {
|
|
1090
|
+
if (!settings?.enableDeck && layoutMode === "deck") {
|
|
1270
1091
|
void dispatch(createIntent6(LayoutAction5.SetLayoutMode, {
|
|
1271
1092
|
part: "mode",
|
|
1272
1093
|
subject: active[0],
|
|
@@ -1276,27 +1097,27 @@ var DeckLayout = ({ onDismissToast }) => {
|
|
|
1276
1097
|
}));
|
|
1277
1098
|
}
|
|
1278
1099
|
}, [
|
|
1279
|
-
settings
|
|
1100
|
+
settings?.enableDeck,
|
|
1280
1101
|
dispatch,
|
|
1281
1102
|
active,
|
|
1282
1103
|
layoutMode
|
|
1283
1104
|
]);
|
|
1284
|
-
const handleResize =
|
|
1105
|
+
const handleResize = useCallback6(() => {
|
|
1285
1106
|
scrollLeftRef.current = null;
|
|
1286
1107
|
}, []);
|
|
1287
|
-
|
|
1108
|
+
useEffect4(() => {
|
|
1288
1109
|
window.addEventListener("resize", handleResize);
|
|
1289
1110
|
return () => window.removeEventListener("resize", handleResize);
|
|
1290
1111
|
}, [
|
|
1291
1112
|
handleResize
|
|
1292
1113
|
]);
|
|
1293
|
-
const restoreScroll =
|
|
1114
|
+
const restoreScroll = useCallback6(() => {
|
|
1294
1115
|
if (deckRef.current && scrollLeftRef.current != null) {
|
|
1295
1116
|
deckRef.current.scrollLeft = scrollLeftRef.current;
|
|
1296
1117
|
}
|
|
1297
1118
|
}, []);
|
|
1298
1119
|
useOnTransition(layoutMode, (mode) => mode !== "deck", "deck", restoreScroll);
|
|
1299
|
-
const handleScroll =
|
|
1120
|
+
const handleScroll = useCallback6((event) => {
|
|
1300
1121
|
if (!solo && event.currentTarget === event.target) {
|
|
1301
1122
|
scrollLeftRef.current = event.target.scrollLeft;
|
|
1302
1123
|
}
|
|
@@ -1304,17 +1125,17 @@ var DeckLayout = ({ onDismissToast }) => {
|
|
|
1304
1125
|
solo
|
|
1305
1126
|
]);
|
|
1306
1127
|
const isEmpty = !solo && active.length === 0;
|
|
1307
|
-
const padding =
|
|
1308
|
-
if (!solo && settings
|
|
1128
|
+
const padding = useMemo5(() => {
|
|
1129
|
+
if (!solo && settings?.overscroll === "centering") {
|
|
1309
1130
|
return calculateOverscroll(active.length);
|
|
1310
1131
|
}
|
|
1311
1132
|
return {};
|
|
1312
1133
|
}, [
|
|
1313
1134
|
solo,
|
|
1314
|
-
settings
|
|
1135
|
+
settings?.overscroll,
|
|
1315
1136
|
deck
|
|
1316
1137
|
]);
|
|
1317
|
-
const mainPosition =
|
|
1138
|
+
const mainPosition = useMemo5(() => [
|
|
1318
1139
|
"grid !block-start-[env(safe-area-inset-top)]",
|
|
1319
1140
|
topbar && "!block-start-[calc(env(safe-area-inset-top)+var(--rail-size))]",
|
|
1320
1141
|
hoistStatusbar && "lg:block-end-[--statusbar-size]"
|
|
@@ -1322,7 +1143,7 @@ var DeckLayout = ({ onDismissToast }) => {
|
|
|
1322
1143
|
topbar,
|
|
1323
1144
|
hoistStatusbar
|
|
1324
1145
|
]);
|
|
1325
|
-
const { order, itemsCount } =
|
|
1146
|
+
const { order, itemsCount } = useMemo5(() => {
|
|
1326
1147
|
return active.reduce((acc, entryId) => {
|
|
1327
1148
|
acc.order[entryId] = acc.itemsCount + 1;
|
|
1328
1149
|
acc.itemsCount += activeCompanions?.[entryId] ? 3 : 2;
|
|
@@ -1335,53 +1156,55 @@ var DeckLayout = ({ onDismissToast }) => {
|
|
|
1335
1156
|
active,
|
|
1336
1157
|
activeCompanions
|
|
1337
1158
|
]);
|
|
1338
|
-
return /* @__PURE__ */
|
|
1159
|
+
return /* @__PURE__ */ React14.createElement(Main3.Root, {
|
|
1339
1160
|
navigationSidebarState: fullscreen ? "closed" : context.sidebarState,
|
|
1340
1161
|
onNavigationSidebarStateChange: (next) => context.sidebarState = next,
|
|
1341
1162
|
complementarySidebarState: fullscreen ? "closed" : context.complementarySidebarState,
|
|
1342
1163
|
onComplementarySidebarStateChange: (next) => context.complementarySidebarState = next
|
|
1343
|
-
}, /* @__PURE__ */
|
|
1164
|
+
}, /* @__PURE__ */ React14.createElement(Sidebar, null), /* @__PURE__ */ React14.createElement(ComplementarySidebar, {
|
|
1344
1165
|
current: complementarySidebarPanel
|
|
1345
|
-
}), /* @__PURE__ */
|
|
1166
|
+
}), /* @__PURE__ */ React14.createElement(Main3.Overlay, null), isEmpty && /* @__PURE__ */ React14.createElement(Main3.Content, {
|
|
1346
1167
|
bounce: true,
|
|
1347
1168
|
handlesFocus: true,
|
|
1348
1169
|
classNames: mainPosition
|
|
1349
|
-
}, /* @__PURE__ */
|
|
1170
|
+
}, /* @__PURE__ */ React14.createElement(ContentEmpty, null)), !isEmpty && /* @__PURE__ */ React14.createElement(Main3.Content, {
|
|
1350
1171
|
bounce: true,
|
|
1351
1172
|
handlesFocus: true,
|
|
1352
1173
|
classNames: mainPosition,
|
|
1353
1174
|
style: {
|
|
1175
|
+
"--main-spacing": settings?.encapsulatedPlanks ? "0.75rem" : "0",
|
|
1354
1176
|
"--dx-main-sidebarWidth": sidebarState === "expanded" ? "var(--nav-sidebar-size)" : sidebarState === "collapsed" ? "var(--l0-size)" : "0",
|
|
1355
1177
|
"--dx-main-complementaryWidth": complementarySidebarState === "expanded" ? "var(--complementary-sidebar-size)" : complementarySidebarState === "collapsed" ? "var(--rail-size)" : "0",
|
|
1356
1178
|
"--dx-main-contentFirstWidth": `${plankSizing[active[0] ?? "never"] ?? DEFAULT_HORIZONTAL_SIZE}rem`,
|
|
1357
1179
|
"--dx-main-contentLastWidth": `${plankSizing[active[(active.length ?? 1) - 1] ?? "never"] ?? DEFAULT_HORIZONTAL_SIZE}rem`
|
|
1358
1180
|
}
|
|
1359
|
-
}, /* @__PURE__ */
|
|
1181
|
+
}, /* @__PURE__ */ React14.createElement("div", {
|
|
1360
1182
|
role: "none",
|
|
1361
1183
|
className: !solo ? "relative bg-deckSurface overflow-hidden" : "sr-only",
|
|
1362
1184
|
...solo && {
|
|
1363
1185
|
inert: true
|
|
1364
1186
|
}
|
|
1365
|
-
}, !topbar && !fullscreen && /* @__PURE__ */
|
|
1187
|
+
}, !topbar && !fullscreen && /* @__PURE__ */ React14.createElement(ToggleSidebarButton, {
|
|
1366
1188
|
classNames: fixedSidebarToggleStyles
|
|
1367
|
-
}), !topbar && !fullscreen && /* @__PURE__ */
|
|
1189
|
+
}), !topbar && !fullscreen && /* @__PURE__ */ React14.createElement(ToggleComplementarySidebarButton, {
|
|
1368
1190
|
classNames: fixedComplementarySidebarToggleStyles
|
|
1369
|
-
}), /* @__PURE__ */
|
|
1191
|
+
}), /* @__PURE__ */ React14.createElement(Stack, {
|
|
1370
1192
|
ref: deckRef,
|
|
1371
1193
|
orientation: "horizontal",
|
|
1372
1194
|
size: "contain",
|
|
1195
|
+
itemsCount: itemsCount - 1,
|
|
1373
1196
|
classNames: [
|
|
1374
|
-
"absolute inset-block-
|
|
1197
|
+
"absolute inset-block-[--main-spacing] -inset-inline-px bs-[calc(100%-2*var(--main-spacing))]",
|
|
1375
1198
|
mainPaddingTransitions
|
|
1376
1199
|
],
|
|
1377
|
-
itemsCount: itemsCount - 1,
|
|
1378
1200
|
style: padding,
|
|
1379
1201
|
onScroll: handleScroll
|
|
1380
|
-
}, active.map((entryId) => /* @__PURE__ */
|
|
1202
|
+
}, active.map((entryId) => /* @__PURE__ */ React14.createElement(Fragment3, {
|
|
1381
1203
|
key: entryId
|
|
1382
|
-
}, /* @__PURE__ */
|
|
1383
|
-
order: order[entryId] - 1
|
|
1384
|
-
|
|
1204
|
+
}, /* @__PURE__ */ React14.createElement(PlankSeparator, {
|
|
1205
|
+
order: order[entryId] - 1,
|
|
1206
|
+
encapsulate: !!settings?.enableDeck
|
|
1207
|
+
}), /* @__PURE__ */ React14.createElement(Plank, {
|
|
1385
1208
|
id: entryId,
|
|
1386
1209
|
companionId: activeCompanions?.[entryId],
|
|
1387
1210
|
part: "deck",
|
|
@@ -1389,36 +1212,227 @@ var DeckLayout = ({ onDismissToast }) => {
|
|
|
1389
1212
|
active,
|
|
1390
1213
|
layoutMode,
|
|
1391
1214
|
settings
|
|
1392
|
-
}))))), /* @__PURE__ */
|
|
1215
|
+
}))))), /* @__PURE__ */ React14.createElement("div", {
|
|
1393
1216
|
role: "none",
|
|
1394
|
-
className: solo ? "relative bg-deckSurface
|
|
1217
|
+
className: solo ? "relative overflow-hidden bg-deckSurface" : "sr-only",
|
|
1395
1218
|
...!solo && {
|
|
1396
1219
|
inert: true
|
|
1397
1220
|
}
|
|
1398
|
-
}, !topbar && !fullscreen && /* @__PURE__ */
|
|
1221
|
+
}, !topbar && !fullscreen && /* @__PURE__ */ React14.createElement(ToggleSidebarButton, {
|
|
1399
1222
|
classNames: fixedSidebarToggleStyles
|
|
1400
|
-
}), !topbar && !fullscreen && /* @__PURE__ */
|
|
1223
|
+
}), !topbar && !fullscreen && /* @__PURE__ */ React14.createElement(ToggleComplementarySidebarButton, {
|
|
1401
1224
|
classNames: fixedComplementarySidebarToggleStyles
|
|
1402
|
-
}), /* @__PURE__ */
|
|
1225
|
+
}), /* @__PURE__ */ React14.createElement(StackContext.Provider, {
|
|
1403
1226
|
value: {
|
|
1404
|
-
size: "contain",
|
|
1405
1227
|
orientation: "horizontal",
|
|
1228
|
+
size: "contain",
|
|
1406
1229
|
rail: true
|
|
1407
1230
|
}
|
|
1408
|
-
}, /* @__PURE__ */
|
|
1231
|
+
}, /* @__PURE__ */ React14.createElement(Plank, {
|
|
1409
1232
|
id: solo,
|
|
1410
1233
|
companionId: solo ? activeCompanions?.[solo] : void 0,
|
|
1411
1234
|
part: "solo",
|
|
1412
1235
|
layoutMode,
|
|
1413
1236
|
settings
|
|
1414
|
-
})))), topbar && /* @__PURE__ */
|
|
1415
|
-
showHints: settings
|
|
1416
|
-
}))
|
|
1237
|
+
})))), topbar && /* @__PURE__ */ React14.createElement(Topbar, null), hoistStatusbar && /* @__PURE__ */ React14.createElement(StatusBar, {
|
|
1238
|
+
showHints: settings?.showHints
|
|
1239
|
+
}));
|
|
1240
|
+
} finally {
|
|
1241
|
+
_effect.f();
|
|
1242
|
+
}
|
|
1243
|
+
};
|
|
1244
|
+
var PlankSeparator = ({ order, encapsulate }) => {
|
|
1245
|
+
var _effect = _useSignals14();
|
|
1246
|
+
try {
|
|
1247
|
+
return order > 0 ? /* @__PURE__ */ React14.createElement("span", {
|
|
1248
|
+
role: "separator",
|
|
1249
|
+
className: mx5("row-span-2 bg-deckSurface", encapsulate ? "is-0" : "is-4"),
|
|
1250
|
+
style: {
|
|
1251
|
+
gridColumn: order
|
|
1252
|
+
}
|
|
1253
|
+
}) : null;
|
|
1254
|
+
} finally {
|
|
1255
|
+
_effect.f();
|
|
1256
|
+
}
|
|
1257
|
+
};
|
|
1258
|
+
|
|
1259
|
+
// src/components/DeckLayout/Dialog.tsx
|
|
1260
|
+
import { useSignals as _useSignals15 } from "@preact-signals/safe-react/tracking";
|
|
1261
|
+
import React15 from "react";
|
|
1262
|
+
import { Surface as Surface9, useCapability as useCapability7 } from "@dxos/app-framework";
|
|
1263
|
+
import { AlertDialog, Dialog as NaturalDialog } from "@dxos/react-ui";
|
|
1264
|
+
var Dialog = () => {
|
|
1265
|
+
var _effect = _useSignals15();
|
|
1266
|
+
try {
|
|
1267
|
+
const context = useCapability7(DeckCapabilities.MutableDeckState);
|
|
1268
|
+
const { dialogOpen, dialogType, dialogBlockAlign, dialogOverlayClasses, dialogOverlayStyle, dialogContent } = context;
|
|
1269
|
+
const Root = dialogType === "alert" ? AlertDialog.Root : NaturalDialog.Root;
|
|
1270
|
+
const Overlay = dialogType === "alert" ? AlertDialog.Overlay : NaturalDialog.Overlay;
|
|
1271
|
+
return /* @__PURE__ */ React15.createElement(Root, {
|
|
1272
|
+
modal: dialogBlockAlign !== "end",
|
|
1273
|
+
open: dialogOpen,
|
|
1274
|
+
onOpenChange: (nextOpen) => context.dialogOpen = nextOpen
|
|
1275
|
+
}, dialogBlockAlign === "end" ? (
|
|
1276
|
+
// TODO(burdon): Placeholder creates a suspense boundary; replace with defaults.
|
|
1277
|
+
/* @__PURE__ */ React15.createElement(Surface9, {
|
|
1278
|
+
role: "dialog",
|
|
1279
|
+
data: dialogContent,
|
|
1280
|
+
limit: 1,
|
|
1281
|
+
fallback: PlankContentError,
|
|
1282
|
+
placeholder: /* @__PURE__ */ React15.createElement("div", null)
|
|
1283
|
+
})
|
|
1284
|
+
) : /* @__PURE__ */ React15.createElement(Overlay, {
|
|
1285
|
+
blockAlign: dialogBlockAlign,
|
|
1286
|
+
classNames: dialogOverlayClasses,
|
|
1287
|
+
style: dialogOverlayStyle
|
|
1288
|
+
}, /* @__PURE__ */ React15.createElement(Surface9, {
|
|
1289
|
+
role: "dialog",
|
|
1290
|
+
data: dialogContent,
|
|
1291
|
+
limit: 1,
|
|
1292
|
+
fallback: PlankContentError
|
|
1293
|
+
})));
|
|
1294
|
+
} finally {
|
|
1295
|
+
_effect.f();
|
|
1296
|
+
}
|
|
1297
|
+
};
|
|
1298
|
+
|
|
1299
|
+
// src/components/DeckLayout/Popover.tsx
|
|
1300
|
+
import { useSignals as _useSignals16 } from "@preact-signals/safe-react/tracking";
|
|
1301
|
+
import { createContext } from "@radix-ui/react-context";
|
|
1302
|
+
import React16, { useCallback as useCallback7, useEffect as useEffect5, useMemo as useMemo6, useRef as useRef3, useState as useState3 } from "react";
|
|
1303
|
+
import { Surface as Surface10, useCapability as useCapability8 } from "@dxos/app-framework";
|
|
1304
|
+
import { Popover as Popover2 } from "@dxos/react-ui";
|
|
1305
|
+
var DEBOUNCE_DELAY = 40;
|
|
1306
|
+
var [DeckPopoverProvider, useDeckPopoverContext] = createContext("DeckPopover");
|
|
1307
|
+
var PopoverRoot = ({ children }) => {
|
|
1308
|
+
var _effect = _useSignals16();
|
|
1309
|
+
try {
|
|
1310
|
+
const layout = useCapability8(DeckCapabilities.MutableDeckState);
|
|
1311
|
+
const virtualRef = useRef3(null);
|
|
1312
|
+
const [virtualIter, setVirtualIter] = useState3(0);
|
|
1313
|
+
const [open, setOpen] = useState3(false);
|
|
1314
|
+
const debounceRef = useRef3(null);
|
|
1315
|
+
useEffect5(() => {
|
|
1316
|
+
setOpen(false);
|
|
1317
|
+
if (layout.popoverOpen) {
|
|
1318
|
+
if (debounceRef.current) {
|
|
1319
|
+
clearTimeout(debounceRef.current);
|
|
1320
|
+
}
|
|
1321
|
+
if (layout.popoverAnchor && virtualRef.current !== layout.popoverAnchor) {
|
|
1322
|
+
virtualRef.current = layout.popoverAnchor ?? null;
|
|
1323
|
+
setVirtualIter((iter) => iter + 1);
|
|
1324
|
+
}
|
|
1325
|
+
debounceRef.current = setTimeout(() => setOpen(true), DEBOUNCE_DELAY);
|
|
1326
|
+
}
|
|
1327
|
+
}, [
|
|
1328
|
+
layout.popoverOpen,
|
|
1329
|
+
layout.popoverAnchorId,
|
|
1330
|
+
layout.popoverAnchor,
|
|
1331
|
+
layout.popoverContent
|
|
1332
|
+
]);
|
|
1333
|
+
return /* @__PURE__ */ React16.createElement(DeckPopoverProvider, {
|
|
1334
|
+
setOpen
|
|
1335
|
+
}, /* @__PURE__ */ React16.createElement(Popover2.Root, {
|
|
1336
|
+
modal: false,
|
|
1337
|
+
open
|
|
1338
|
+
}, layout.popoverAnchor && /* @__PURE__ */ React16.createElement(Popover2.VirtualTrigger, {
|
|
1339
|
+
key: virtualIter,
|
|
1340
|
+
virtualRef
|
|
1341
|
+
}), children));
|
|
1342
|
+
} finally {
|
|
1343
|
+
_effect.f();
|
|
1344
|
+
}
|
|
1345
|
+
};
|
|
1346
|
+
var PopoverContent = () => {
|
|
1347
|
+
var _effect = _useSignals16();
|
|
1348
|
+
try {
|
|
1349
|
+
const layout = useCapability8(DeckCapabilities.MutableDeckState);
|
|
1350
|
+
const { setOpen } = useDeckPopoverContext("PopoverContent");
|
|
1351
|
+
const handleClose = useCallback7((event) => {
|
|
1352
|
+
if (
|
|
1353
|
+
// TODO(thure): CodeMirror should not focus itself when it updates.
|
|
1354
|
+
event.type === "dismissableLayer.focusOutside" && event.currentTarget?.classList.contains("cm-content")
|
|
1355
|
+
) {
|
|
1356
|
+
event.preventDefault();
|
|
1357
|
+
} else {
|
|
1358
|
+
setOpen(false);
|
|
1359
|
+
layout.popoverOpen = false;
|
|
1360
|
+
layout.popoverAnchor = void 0;
|
|
1361
|
+
layout.popoverAnchorId = void 0;
|
|
1362
|
+
layout.popoverSide = void 0;
|
|
1363
|
+
}
|
|
1364
|
+
}, [
|
|
1365
|
+
setOpen
|
|
1366
|
+
]);
|
|
1367
|
+
const collisionBoundaries = useMemo6(() => {
|
|
1368
|
+
const closest = layout.popoverAnchor?.closest("[data-popover-collision-boundary]");
|
|
1369
|
+
return closest ? [
|
|
1370
|
+
closest
|
|
1371
|
+
] : [];
|
|
1372
|
+
}, [
|
|
1373
|
+
layout.popoverAnchor
|
|
1374
|
+
]);
|
|
1375
|
+
return /* @__PURE__ */ React16.createElement(Popover2.Portal, null, /* @__PURE__ */ React16.createElement(Popover2.Content, {
|
|
1376
|
+
side: layout.popoverSide,
|
|
1377
|
+
onInteractOutside: handleClose,
|
|
1378
|
+
onEscapeKeyDown: handleClose,
|
|
1379
|
+
collisionBoundary: collisionBoundaries,
|
|
1380
|
+
sticky: "always",
|
|
1381
|
+
hideWhenDetached: true
|
|
1382
|
+
}, /* @__PURE__ */ React16.createElement(Popover2.Viewport, null, /* @__PURE__ */ React16.createElement(Surface10, {
|
|
1383
|
+
role: "card--popover",
|
|
1384
|
+
data: layout.popoverContent,
|
|
1385
|
+
limit: 1
|
|
1386
|
+
})), /* @__PURE__ */ React16.createElement(Popover2.Arrow, null)));
|
|
1387
|
+
} finally {
|
|
1388
|
+
_effect.f();
|
|
1389
|
+
}
|
|
1390
|
+
};
|
|
1391
|
+
|
|
1392
|
+
// src/components/DeckLayout/Toast.tsx
|
|
1393
|
+
import { useSignals as _useSignals17 } from "@preact-signals/safe-react/tracking";
|
|
1394
|
+
import React17 from "react";
|
|
1395
|
+
import { Button, Icon as Icon2, Toast as NaturalToast, toLocalizedString as toLocalizedString3, useTranslation as useTranslation7 } from "@dxos/react-ui";
|
|
1396
|
+
var Toast = ({ id, title, description, icon, duration, actionLabel, actionAlt, closeLabel, onAction, onOpenChange }) => {
|
|
1397
|
+
var _effect = _useSignals17();
|
|
1398
|
+
try {
|
|
1399
|
+
const { t } = useTranslation7(meta.id);
|
|
1400
|
+
return /* @__PURE__ */ React17.createElement(NaturalToast.Root, {
|
|
1401
|
+
"data-testid": id,
|
|
1402
|
+
defaultOpen: true,
|
|
1403
|
+
duration,
|
|
1404
|
+
onOpenChange
|
|
1405
|
+
}, /* @__PURE__ */ React17.createElement(NaturalToast.Body, null, /* @__PURE__ */ React17.createElement(NaturalToast.Title, {
|
|
1406
|
+
classNames: "items-center"
|
|
1407
|
+
}, icon && /* @__PURE__ */ React17.createElement(Icon2, {
|
|
1408
|
+
icon,
|
|
1409
|
+
size: 5,
|
|
1410
|
+
classNames: "inline mr-1"
|
|
1411
|
+
}), title && /* @__PURE__ */ React17.createElement("span", null, toLocalizedString3(title, t))), description && /* @__PURE__ */ React17.createElement(NaturalToast.Description, null, description && toLocalizedString3(description, t))), /* @__PURE__ */ React17.createElement(NaturalToast.Actions, null, onAction && actionAlt && actionLabel && /* @__PURE__ */ React17.createElement(NaturalToast.Action, {
|
|
1412
|
+
altText: toLocalizedString3(actionAlt, t),
|
|
1413
|
+
asChild: true
|
|
1414
|
+
}, /* @__PURE__ */ React17.createElement(Button, {
|
|
1415
|
+
"data-testid": "toast.action",
|
|
1416
|
+
variant: "primary",
|
|
1417
|
+
onClick: () => onAction?.()
|
|
1418
|
+
}, toLocalizedString3(actionLabel, t))), closeLabel && /* @__PURE__ */ React17.createElement(NaturalToast.Close, {
|
|
1419
|
+
asChild: true
|
|
1420
|
+
}, /* @__PURE__ */ React17.createElement(Button, {
|
|
1421
|
+
"data-testid": "toast.close"
|
|
1422
|
+
}, toLocalizedString3(closeLabel, t)))));
|
|
1423
|
+
} finally {
|
|
1424
|
+
_effect.f();
|
|
1425
|
+
}
|
|
1426
|
+
};
|
|
1427
|
+
var Toaster = ({ toasts, onDismissToast }) => {
|
|
1428
|
+
var _effect = _useSignals17();
|
|
1429
|
+
try {
|
|
1430
|
+
return /* @__PURE__ */ React17.createElement(React17.Fragment, null, toasts?.map((toast) => /* @__PURE__ */ React17.createElement(Toast, {
|
|
1417
1431
|
...toast,
|
|
1418
1432
|
key: toast.id,
|
|
1419
1433
|
onOpenChange: (open) => {
|
|
1420
1434
|
if (!open) {
|
|
1421
|
-
onDismissToast(toast.id);
|
|
1435
|
+
onDismissToast?.(toast.id);
|
|
1422
1436
|
}
|
|
1423
1437
|
return open;
|
|
1424
1438
|
}
|
|
@@ -1428,60 +1442,80 @@ var DeckLayout = ({ onDismissToast }) => {
|
|
|
1428
1442
|
}
|
|
1429
1443
|
};
|
|
1430
1444
|
|
|
1445
|
+
// src/components/DeckLayout/DeckLayout.tsx
|
|
1446
|
+
var DeckLayout = ({ onDismissToast }) => {
|
|
1447
|
+
var _effect = _useSignals18();
|
|
1448
|
+
try {
|
|
1449
|
+
const context = useCapability9(DeckCapabilities.MutableDeckState);
|
|
1450
|
+
const { toasts } = context;
|
|
1451
|
+
return /* @__PURE__ */ React18.createElement(PopoverRoot, null, /* @__PURE__ */ React18.createElement(ActiveNode, null), /* @__PURE__ */ React18.createElement(DeckMain, null), /* @__PURE__ */ React18.createElement(PopoverContent, null), /* @__PURE__ */ React18.createElement(Dialog, null), /* @__PURE__ */ React18.createElement(Toaster, {
|
|
1452
|
+
toasts,
|
|
1453
|
+
onDismissToast
|
|
1454
|
+
}));
|
|
1455
|
+
} finally {
|
|
1456
|
+
_effect.f();
|
|
1457
|
+
}
|
|
1458
|
+
};
|
|
1459
|
+
|
|
1431
1460
|
// src/components/DeckSettings/DeckSettings.tsx
|
|
1432
|
-
import { useSignals as
|
|
1433
|
-
import
|
|
1461
|
+
import { useSignals as _useSignals19 } from "@preact-signals/safe-react/tracking";
|
|
1462
|
+
import React19 from "react";
|
|
1434
1463
|
import { Input, Select, useTranslation as useTranslation8 } from "@dxos/react-ui";
|
|
1435
1464
|
import { ControlGroup, ControlItemInput, ControlPage, ControlSection } from "@dxos/react-ui-form";
|
|
1436
1465
|
var isSocket = !!globalThis.__args;
|
|
1437
1466
|
var DeckSettings = ({ settings }) => {
|
|
1438
|
-
var _effect =
|
|
1467
|
+
var _effect = _useSignals19();
|
|
1439
1468
|
try {
|
|
1440
1469
|
const { t } = useTranslation8(meta.id);
|
|
1441
|
-
return /* @__PURE__ */
|
|
1470
|
+
return /* @__PURE__ */ React19.createElement(ControlPage, null, /* @__PURE__ */ React19.createElement(ControlSection, {
|
|
1442
1471
|
title: t("settings title", {
|
|
1443
1472
|
ns: meta.id
|
|
1444
1473
|
})
|
|
1445
|
-
}, /* @__PURE__ */
|
|
1474
|
+
}, /* @__PURE__ */ React19.createElement(ControlGroup, null, /* @__PURE__ */ React19.createElement(ControlItemInput, {
|
|
1446
1475
|
title: t("settings enable deck label")
|
|
1447
|
-
}, /* @__PURE__ */
|
|
1476
|
+
}, /* @__PURE__ */ React19.createElement(Input.Switch, {
|
|
1448
1477
|
checked: settings.enableDeck,
|
|
1449
1478
|
onCheckedChange: (checked) => settings.enableDeck = checked
|
|
1450
|
-
})), /* @__PURE__ */
|
|
1479
|
+
})), /* @__PURE__ */ React19.createElement(ControlItemInput, {
|
|
1480
|
+
title: t("settings encapsulated planks label")
|
|
1481
|
+
}, /* @__PURE__ */ React19.createElement(Input.Switch, {
|
|
1482
|
+
checked: settings.encapsulatedPlanks ?? false,
|
|
1483
|
+
onCheckedChange: (checked) => settings.encapsulatedPlanks = checked
|
|
1484
|
+
})), /* @__PURE__ */ React19.createElement(ControlItemInput, {
|
|
1451
1485
|
title: t("select new plank positioning label")
|
|
1452
|
-
}, /* @__PURE__ */
|
|
1486
|
+
}, /* @__PURE__ */ React19.createElement(Select.Root, {
|
|
1453
1487
|
disabled: !settings.enableDeck,
|
|
1454
1488
|
value: settings.newPlankPositioning ?? "start",
|
|
1455
1489
|
onValueChange: (value) => settings.newPlankPositioning = value
|
|
1456
|
-
}, /* @__PURE__ */
|
|
1490
|
+
}, /* @__PURE__ */ React19.createElement(Select.TriggerButton, {
|
|
1457
1491
|
placeholder: t("select new plank positioning placeholder")
|
|
1458
|
-
}), /* @__PURE__ */
|
|
1492
|
+
}), /* @__PURE__ */ React19.createElement(Select.Portal, null, /* @__PURE__ */ React19.createElement(Select.Content, null, /* @__PURE__ */ React19.createElement(Select.Viewport, null, NewPlankPositions.map((position) => /* @__PURE__ */ React19.createElement(Select.Option, {
|
|
1459
1493
|
key: position,
|
|
1460
1494
|
value: position
|
|
1461
|
-
}, t(`settings new plank position ${position} label`)))), /* @__PURE__ */
|
|
1495
|
+
}, t(`settings new plank position ${position} label`)))), /* @__PURE__ */ React19.createElement(Select.Arrow, null))))), /* @__PURE__ */ React19.createElement(ControlItemInput, {
|
|
1462
1496
|
title: t("settings overscroll label")
|
|
1463
|
-
}, /* @__PURE__ */
|
|
1497
|
+
}, /* @__PURE__ */ React19.createElement(Select.Root, {
|
|
1464
1498
|
disabled: !settings.enableDeck,
|
|
1465
1499
|
value: settings.overscroll ?? "none",
|
|
1466
1500
|
onValueChange: (value) => settings.overscroll = value
|
|
1467
|
-
}, /* @__PURE__ */
|
|
1501
|
+
}, /* @__PURE__ */ React19.createElement(Select.TriggerButton, {
|
|
1468
1502
|
placeholder: t("select overscroll placeholder")
|
|
1469
|
-
}), /* @__PURE__ */
|
|
1503
|
+
}), /* @__PURE__ */ React19.createElement(Select.Portal, null, /* @__PURE__ */ React19.createElement(Select.Content, null, /* @__PURE__ */ React19.createElement(Select.Viewport, null, OverscrollOptions.map((option) => /* @__PURE__ */ React19.createElement(Select.Option, {
|
|
1470
1504
|
key: option,
|
|
1471
1505
|
value: option
|
|
1472
|
-
}, t(`settings overscroll ${option} label`)))), /* @__PURE__ */
|
|
1506
|
+
}, t(`settings overscroll ${option} label`)))), /* @__PURE__ */ React19.createElement(Select.Arrow, null))))), /* @__PURE__ */ React19.createElement(ControlItemInput, {
|
|
1473
1507
|
title: t("settings enable statusbar label")
|
|
1474
|
-
}, /* @__PURE__ */
|
|
1508
|
+
}, /* @__PURE__ */ React19.createElement(Input.Switch, {
|
|
1475
1509
|
checked: settings.enableStatusbar,
|
|
1476
1510
|
onCheckedChange: (checked) => settings.enableStatusbar = checked
|
|
1477
|
-
})), /* @__PURE__ */
|
|
1511
|
+
})), /* @__PURE__ */ React19.createElement(ControlItemInput, {
|
|
1478
1512
|
title: t("settings show hints label")
|
|
1479
|
-
}, /* @__PURE__ */
|
|
1513
|
+
}, /* @__PURE__ */ React19.createElement(Input.Switch, {
|
|
1480
1514
|
checked: settings.showHints,
|
|
1481
1515
|
onCheckedChange: (checked) => settings.showHints = checked
|
|
1482
|
-
})), !isSocket && /* @__PURE__ */
|
|
1516
|
+
})), !isSocket && /* @__PURE__ */ React19.createElement(ControlItemInput, {
|
|
1483
1517
|
title: t("settings native redirect label")
|
|
1484
|
-
}, /* @__PURE__ */
|
|
1518
|
+
}, /* @__PURE__ */ React19.createElement(Input.Switch, {
|
|
1485
1519
|
checked: settings.enableNativeRedirect,
|
|
1486
1520
|
onCheckedChange: (checked) => settings.enableNativeRedirect = checked
|
|
1487
1521
|
})))));
|
|
@@ -1495,4 +1529,4 @@ export {
|
|
|
1495
1529
|
DeckLayout,
|
|
1496
1530
|
DeckSettings
|
|
1497
1531
|
};
|
|
1498
|
-
//# sourceMappingURL=chunk-
|
|
1532
|
+
//# sourceMappingURL=chunk-SBJLGRJV.mjs.map
|