@dxos/plugin-deck 0.8.1 → 0.8.2-main.f081794
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-B4LOJUWW.mjs → chunk-4QSEGMY3.mjs} +10 -10
- package/dist/lib/browser/{chunk-B4LOJUWW.mjs.map → chunk-4QSEGMY3.mjs.map} +3 -3
- package/dist/lib/browser/{chunk-6ZSOFCPP.mjs → chunk-6HJZL3WT.mjs} +8 -7
- package/dist/lib/browser/{chunk-6ZSOFCPP.mjs.map → chunk-6HJZL3WT.mjs.map} +3 -3
- package/dist/lib/browser/{chunk-FJBMNSUC.mjs → chunk-VP6FCWFV.mjs} +171 -151
- package/dist/lib/browser/chunk-VP6FCWFV.mjs.map +7 -0
- package/dist/lib/browser/{chunk-RJNCG4ND.mjs → chunk-ZMJMCN7O.mjs} +9 -6
- package/dist/lib/browser/chunk-ZMJMCN7O.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +5 -3
- package/dist/lib/browser/index.mjs.map +2 -2
- package/dist/lib/browser/{intent-resolver-UDYKO2QW.mjs → intent-resolver-6AK45PT5.mjs} +49 -31
- package/dist/lib/browser/intent-resolver-6AK45PT5.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{react-root-XLXN2VEW.mjs → react-root-KA2IL5RA.mjs} +5 -5
- package/dist/lib/browser/{react-surface-WNGMZL7I.mjs → react-surface-LIPGYEYN.mjs} +5 -5
- package/dist/lib/browser/{settings-HMDGSBGO.mjs → settings-6NU7CF2B.mjs} +4 -4
- package/dist/lib/browser/settings-6NU7CF2B.mjs.map +7 -0
- package/dist/lib/browser/{state-7TN26M42.mjs → state-Z6UY2Z3M.mjs} +6 -5
- package/dist/lib/browser/state-Z6UY2Z3M.mjs.map +7 -0
- package/dist/lib/browser/{tools-SC6QEN7R.mjs → tools-VDVQTJMD.mjs} +2 -2
- package/dist/lib/browser/types.mjs +1 -1
- package/dist/lib/browser/{url-handler-ODG4B6NX.mjs → url-handler-3CARFXQK.mjs} +2 -2
- package/dist/types/src/capabilities/capabilities.d.ts +8 -6
- package/dist/types/src/capabilities/capabilities.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +2 -2
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -1
- package/dist/types/src/capabilities/state.d.ts +5 -4
- package/dist/types/src/capabilities/state.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/ContentEmpty.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/DeckLayout.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/Dialog.d.ts +3 -0
- package/dist/types/src/components/DeckLayout/Dialog.d.ts.map +1 -0
- package/dist/types/src/components/DeckLayout/Popover.d.ts +5 -0
- package/dist/types/src/components/DeckLayout/Popover.d.ts.map +1 -0
- package/dist/types/src/components/Plank/Plank.d.ts.map +1 -1
- package/dist/types/src/components/Plank/PlankControls.d.ts +2 -2
- package/dist/types/src/components/Plank/PlankControls.d.ts.map +1 -1
- package/dist/types/src/components/Plank/PlankHeading.d.ts +3 -2
- package/dist/types/src/components/Plank/PlankHeading.d.ts.map +1 -1
- package/dist/types/src/components/Sidebar/ComplementarySidebar.d.ts.map +1 -1
- package/dist/types/src/components/Sidebar/Sidebar.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +2 -0
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types.d.ts +11 -9
- package/dist/types/src/types.d.ts.map +1 -1
- package/dist/types/src/util/layoutAppliesTopbar.d.ts +2 -1
- package/dist/types/src/util/layoutAppliesTopbar.d.ts.map +1 -1
- package/dist/types/src/util/useHoistStatusbar.d.ts +2 -1
- package/dist/types/src/util/useHoistStatusbar.d.ts.map +1 -1
- package/package.json +28 -28
- package/src/capabilities/index.ts +2 -2
- package/src/capabilities/intent-resolver.ts +36 -20
- package/src/capabilities/settings.ts +2 -2
- package/src/capabilities/state.ts +3 -2
- package/src/components/DeckLayout/ContentEmpty.tsx +6 -2
- package/src/components/DeckLayout/DeckLayout.tsx +114 -181
- package/src/components/DeckLayout/Dialog.tsx +36 -0
- package/src/components/DeckLayout/Popover.tsx +76 -0
- package/src/components/Plank/Plank.tsx +3 -2
- package/src/components/Plank/PlankControls.tsx +33 -33
- package/src/components/Plank/PlankHeading.tsx +6 -4
- package/src/components/Sidebar/ComplementarySidebar.tsx +30 -20
- package/src/components/Sidebar/Sidebar.tsx +5 -3
- package/src/translations.ts +2 -0
- package/src/types.ts +9 -6
- package/src/util/layoutAppliesTopbar.ts +8 -2
- package/src/util/useHoistStatusbar.ts +9 -4
- package/dist/lib/browser/chunk-FJBMNSUC.mjs.map +0 -7
- package/dist/lib/browser/chunk-RJNCG4ND.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-UDYKO2QW.mjs.map +0 -7
- package/dist/lib/browser/settings-HMDGSBGO.mjs.map +0 -7
- package/dist/lib/browser/state-7TN26M42.mjs.map +0 -7
- package/dist/types/src/components/DeckLayout/Fullscreen.d.ts +0 -5
- package/dist/types/src/components/DeckLayout/Fullscreen.d.ts.map +0 -1
- package/src/components/DeckLayout/Fullscreen.tsx +0 -31
- /package/dist/lib/browser/{react-root-XLXN2VEW.mjs.map → react-root-KA2IL5RA.mjs.map} +0 -0
- /package/dist/lib/browser/{react-surface-WNGMZL7I.mjs.map → react-surface-LIPGYEYN.mjs.map} +0 -0
- /package/dist/lib/browser/{tools-SC6QEN7R.mjs.map → tools-VDVQTJMD.mjs.map} +0 -0
- /package/dist/lib/browser/{url-handler-ODG4B6NX.mjs.map → url-handler-3CARFXQK.mjs.map} +0 -0
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
useBreakpoints,
|
|
8
8
|
useCompanions,
|
|
9
9
|
useHoistStatusbar
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-6HJZL3WT.mjs";
|
|
11
11
|
import {
|
|
12
12
|
DeckCapabilities
|
|
13
13
|
} from "./chunk-XMCG42ID.mjs";
|
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
OverscrollOptions,
|
|
20
20
|
PLANK_COMPANION_TYPE,
|
|
21
21
|
getMode
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-ZMJMCN7O.mjs";
|
|
23
23
|
import {
|
|
24
24
|
DECK_PLUGIN
|
|
25
25
|
} from "./chunk-NSATFAEE.mjs";
|
|
@@ -152,15 +152,15 @@ var PlankCompanionControls = /* @__PURE__ */ forwardRef(({ primary }, forwardedR
|
|
|
152
152
|
}, /* @__PURE__ */ React2.createElement(PlankControl, {
|
|
153
153
|
label: t("close companion label"),
|
|
154
154
|
variant: "ghost",
|
|
155
|
-
// icon='ph--minus--regular'
|
|
156
155
|
icon: "ph--caret-left--regular",
|
|
157
156
|
onClick: handleCloseCompanion,
|
|
158
157
|
classNames: plankControlSpacing
|
|
159
158
|
}));
|
|
160
159
|
});
|
|
161
|
-
var PlankControls = /* @__PURE__ */ forwardRef(({ children, classNames, variant = "default", capabilities,
|
|
160
|
+
var PlankControls = /* @__PURE__ */ forwardRef(({ children, classNames, variant = "default", capabilities, layoutMode, pin, close = false, onClick, ...props }, forwardedRef) => {
|
|
162
161
|
const { t } = useTranslation2(DECK_PLUGIN);
|
|
163
162
|
const buttonClassNames = variant === "hide-disabled" ? `disabled:hidden ${plankControlSpacing}` : plankControlSpacing;
|
|
163
|
+
const layoutIsAnySolo = !!layoutMode?.startsWith("solo");
|
|
164
164
|
return /* @__PURE__ */ React2.createElement(ButtonGroup, {
|
|
165
165
|
...props,
|
|
166
166
|
classNames: [
|
|
@@ -168,12 +168,17 @@ var PlankControls = /* @__PURE__ */ forwardRef(({ children, classNames, variant
|
|
|
168
168
|
classNames
|
|
169
169
|
],
|
|
170
170
|
ref: forwardedRef
|
|
171
|
-
}, capabilities.deck && capabilities.solo && /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(PlankControl, {
|
|
172
|
-
label:
|
|
171
|
+
}, capabilities.deck && /* @__PURE__ */ React2.createElement(React2.Fragment, null, capabilities.solo && /* @__PURE__ */ React2.createElement(React2.Fragment, null, layoutMode === "solo" && /* @__PURE__ */ React2.createElement(PlankControl, {
|
|
172
|
+
label: t("show fullscreen plank label"),
|
|
173
173
|
classNames: buttonClassNames,
|
|
174
|
-
icon:
|
|
175
|
-
onClick: () => onClick?.("solo")
|
|
176
|
-
}),
|
|
174
|
+
icon: "ph--corners-out--regular",
|
|
175
|
+
onClick: () => onClick?.("solo--fullscreen")
|
|
176
|
+
}), /* @__PURE__ */ React2.createElement(PlankControl, {
|
|
177
|
+
label: t(layoutMode === "solo--fullscreen" ? "exit fullscreen label" : !layoutIsAnySolo ? "show solo plank label" : "show deck plank label"),
|
|
178
|
+
classNames: buttonClassNames,
|
|
179
|
+
icon: layoutIsAnySolo ? "ph--corners-in--regular" : "ph--corners-out--regular",
|
|
180
|
+
onClick: () => onClick?.(layoutMode === "solo--fullscreen" ? "solo--fullscreen" : "solo")
|
|
181
|
+
})), !layoutIsAnySolo && /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(PlankControl, {
|
|
177
182
|
label: t("increment start label"),
|
|
178
183
|
disabled: !capabilities.incrementStart,
|
|
179
184
|
classNames: buttonClassNames,
|
|
@@ -185,7 +190,7 @@ var PlankControls = /* @__PURE__ */ forwardRef(({ children, classNames, variant
|
|
|
185
190
|
classNames: buttonClassNames,
|
|
186
191
|
icon: "ph--caret-right--regular",
|
|
187
192
|
onClick: () => onClick?.("increment-end")
|
|
188
|
-
}))), close && !
|
|
193
|
+
}))), close && !layoutIsAnySolo && /* @__PURE__ */ React2.createElement(PlankControl, {
|
|
189
194
|
label: t(`${typeof close === "string" ? "minify" : "close"} label`),
|
|
190
195
|
classNames: buttonClassNames,
|
|
191
196
|
"data-testid": "plankHeading.close",
|
|
@@ -208,7 +213,7 @@ var fixedSidebarToggleStyles = mx(sidebarToggleStyles, "inline-start-2");
|
|
|
208
213
|
var fixedComplementarySidebarToggleStyles = mx(sidebarToggleStyles, "inline-end-2");
|
|
209
214
|
|
|
210
215
|
// packages/plugins/plugin-deck/src/components/Plank/PlankHeading.tsx
|
|
211
|
-
var PlankHeading = /* @__PURE__ */ memo(({ id, part, node, deckEnabled, canIncrementStart, canIncrementEnd, popoverAnchorId, primaryId, pending, companioned, companions, actions = [] }) => {
|
|
216
|
+
var PlankHeading = /* @__PURE__ */ memo(({ id, part, node, deckEnabled, canIncrementStart, canIncrementEnd, popoverAnchorId, primaryId, pending, companioned, companions, layoutMode, actions = [] }) => {
|
|
212
217
|
const { t } = useTranslation3(DECK_PLUGIN);
|
|
213
218
|
const { dispatchPromise: dispatch } = useIntentDispatcher2();
|
|
214
219
|
const { graph } = useAppGraph();
|
|
@@ -270,7 +275,7 @@ var PlankHeading = /* @__PURE__ */ memo(({ id, part, node, deckEnabled, canIncre
|
|
|
270
275
|
});
|
|
271
276
|
}, []);
|
|
272
277
|
const handlePlankAction = useCallback2((eventType) => {
|
|
273
|
-
if (eventType
|
|
278
|
+
if (eventType.startsWith("solo")) {
|
|
274
279
|
return dispatch(createIntent2(DeckAction.Adjust, {
|
|
275
280
|
type: eventType,
|
|
276
281
|
id
|
|
@@ -320,7 +325,7 @@ var PlankHeading = /* @__PURE__ */ memo(({ id, part, node, deckEnabled, canIncre
|
|
|
320
325
|
]);
|
|
321
326
|
return /* @__PURE__ */ React3.createElement(StackItem.Heading, {
|
|
322
327
|
classNames: [
|
|
323
|
-
"plb-1 border-be border-separator items-stretch gap-1 sticky inline-start-12 app-drag min-is-0 layout
|
|
328
|
+
"plb-1 border-be border-separator items-stretch gap-1 sticky inline-start-12 app-drag min-is-0 contain-layout",
|
|
324
329
|
part === "solo" ? soloInlinePadding : "pli-1"
|
|
325
330
|
]
|
|
326
331
|
}, companions && isCompanionNode ? /* @__PURE__ */ React3.createElement("div", {
|
|
@@ -370,7 +375,7 @@ var PlankHeading = /* @__PURE__ */ memo(({ id, part, node, deckEnabled, canIncre
|
|
|
370
375
|
primary: primaryId
|
|
371
376
|
}) : /* @__PURE__ */ React3.createElement(PlankControls, {
|
|
372
377
|
capabilities,
|
|
373
|
-
|
|
378
|
+
layoutMode,
|
|
374
379
|
close: part === "complementary" ? "minify-end" : true,
|
|
375
380
|
onClick: handlePlankAction
|
|
376
381
|
}));
|
|
@@ -493,8 +498,8 @@ var PlankImpl = /* @__PURE__ */ memo2(({ id, node, part, path, order, active, la
|
|
|
493
498
|
scrollIntoView,
|
|
494
499
|
layoutMode
|
|
495
500
|
]);
|
|
496
|
-
const isSolo = layoutMode
|
|
497
|
-
const isAttendable = layoutMode
|
|
501
|
+
const isSolo = layoutMode.startsWith("solo") && part === "solo";
|
|
502
|
+
const isAttendable = layoutMode.startsWith("solo") && part.startsWith("solo") || layoutMode === "deck" && part === "deck";
|
|
498
503
|
const sizeAttrs = useMainSize();
|
|
499
504
|
const data = useMemo2(() => node && {
|
|
500
505
|
subject: node.data,
|
|
@@ -534,6 +539,7 @@ var PlankImpl = /* @__PURE__ */ memo2(({ id, node, part, path, order, active, la
|
|
|
534
539
|
id,
|
|
535
540
|
part: part.startsWith("solo-") ? "solo" : part,
|
|
536
541
|
node,
|
|
542
|
+
layoutMode,
|
|
537
543
|
deckEnabled: settings?.enableDeck,
|
|
538
544
|
canIncrementStart,
|
|
539
545
|
canIncrementEnd,
|
|
@@ -621,12 +627,13 @@ var ComplementarySidebar = ({ current }) => {
|
|
|
621
627
|
const { t } = useTranslation5(DECK_PLUGIN);
|
|
622
628
|
const { dispatchPromise: dispatch } = useIntentDispatcher4();
|
|
623
629
|
const layout = useCapability3(DeckCapabilities.MutableDeckState);
|
|
630
|
+
const layoutMode = getMode(layout.deck);
|
|
624
631
|
const breakpoint = useBreakpoints();
|
|
625
|
-
const topbar = layoutAppliesTopbar(breakpoint);
|
|
626
|
-
const hoistStatusbar = useHoistStatusbar(breakpoint);
|
|
632
|
+
const topbar = layoutAppliesTopbar(breakpoint, layoutMode);
|
|
633
|
+
const hoistStatusbar = useHoistStatusbar(breakpoint, layoutMode);
|
|
627
634
|
const companions = useDeckCompanions();
|
|
628
|
-
const activeCompanion = companions.find((companion) => getCompanionId(companion.id) === current)
|
|
629
|
-
const activeId = getCompanionId(activeCompanion
|
|
635
|
+
const activeCompanion = companions.find((companion) => getCompanionId(companion.id) === current);
|
|
636
|
+
const activeId = activeCompanion && getCompanionId(activeCompanion.id);
|
|
630
637
|
const [internalValue, setInternalValue] = useState2(activeId);
|
|
631
638
|
useEffect4(() => {
|
|
632
639
|
setInternalValue(activeId);
|
|
@@ -657,6 +664,19 @@ var ComplementarySidebar = ({ current }) => {
|
|
|
657
664
|
activeCompanion?.id,
|
|
658
665
|
activeCompanion?.data
|
|
659
666
|
]);
|
|
667
|
+
useEffect4(() => {
|
|
668
|
+
if (!activeId) {
|
|
669
|
+
void dispatch(createIntent4(LayoutAction3.UpdateComplementary, {
|
|
670
|
+
part: "complementary",
|
|
671
|
+
options: {
|
|
672
|
+
state: "collapsed"
|
|
673
|
+
}
|
|
674
|
+
}));
|
|
675
|
+
}
|
|
676
|
+
}, [
|
|
677
|
+
activeId,
|
|
678
|
+
dispatch
|
|
679
|
+
]);
|
|
660
680
|
return /* @__PURE__ */ React7.createElement(Main.ComplementarySidebar, {
|
|
661
681
|
label,
|
|
662
682
|
classNames: [
|
|
@@ -695,7 +715,7 @@ var ComplementarySidebar = ({ current }) => {
|
|
|
695
715
|
})), /* @__PURE__ */ React7.createElement("div", {
|
|
696
716
|
role: "none",
|
|
697
717
|
className: "hidden lg:grid grid-cols-1 auto-rows-[--rail-action] p-1"
|
|
698
|
-
}, /* @__PURE__ */ React7.createElement(ToggleComplementarySidebarButton, null))), companions.map((companion) => /* @__PURE__ */ React7.createElement(Tabs.Tabpanel, {
|
|
718
|
+
}, /* @__PURE__ */ React7.createElement(ToggleComplementarySidebarButton, null))), activeId && companions.map((companion) => /* @__PURE__ */ React7.createElement(Tabs.Tabpanel, {
|
|
699
719
|
key: getCompanionId(companion.id),
|
|
700
720
|
value: getCompanionId(companion.id),
|
|
701
721
|
classNames: 'absolute data-[state="inactive"]:-z-[1] inset-block-0 inline-start-0 is-[calc(100%-var(--r0-size))] lg:is-[--r1-size] grid grid-cols-1 grid-rows-[var(--rail-size)_1fr_min-content] pbs-[env(safe-area-inset-top)]',
|
|
@@ -747,10 +767,11 @@ var label2 = [
|
|
|
747
767
|
}
|
|
748
768
|
];
|
|
749
769
|
var Sidebar = () => {
|
|
750
|
-
const { popoverAnchorId, activeDeck: current } = useCapability4(DeckCapabilities.DeckState);
|
|
770
|
+
const { popoverAnchorId, activeDeck: current, deck } = useCapability4(DeckCapabilities.DeckState);
|
|
751
771
|
const breakpoint = useBreakpoints();
|
|
752
|
-
const
|
|
753
|
-
const
|
|
772
|
+
const layoutMode = getMode(deck);
|
|
773
|
+
const topbar = layoutAppliesTopbar(breakpoint, layoutMode);
|
|
774
|
+
const hoistStatusbar = useHoistStatusbar(breakpoint, layoutMode);
|
|
754
775
|
const navigationData = useMemo4(() => ({
|
|
755
776
|
popoverAnchorId,
|
|
756
777
|
topbar,
|
|
@@ -808,10 +829,10 @@ var Banner = ({ variant, classNames }) => {
|
|
|
808
829
|
|
|
809
830
|
// packages/plugins/plugin-deck/src/components/DeckLayout/DeckLayout.tsx
|
|
810
831
|
import { untracked } from "@preact/signals-core";
|
|
811
|
-
import React17, { useCallback as
|
|
812
|
-
import { Capabilities, LayoutAction as LayoutAction4,
|
|
832
|
+
import React17, { useCallback as useCallback6, useEffect as useEffect6, useMemo as useMemo5, useRef as useRef3, Fragment as Fragment4 } from "react";
|
|
833
|
+
import { Capabilities, LayoutAction as LayoutAction4, createIntent as createIntent5, useCapability as useCapability8, useIntentDispatcher as useIntentDispatcher5, usePluginManager } from "@dxos/app-framework";
|
|
813
834
|
import { AttentionCapabilities } from "@dxos/plugin-attention";
|
|
814
|
-
import {
|
|
835
|
+
import { Main as Main3, useMediaQuery, useOnTransition } from "@dxos/react-ui";
|
|
815
836
|
import { Stack, StackContext, DEFAULT_HORIZONTAL_SIZE } from "@dxos/react-ui-stack";
|
|
816
837
|
import { mainPaddingTransitions } from "@dxos/react-ui-theme";
|
|
817
838
|
|
|
@@ -839,10 +860,12 @@ var ActiveNode = () => {
|
|
|
839
860
|
|
|
840
861
|
// packages/plugins/plugin-deck/src/components/DeckLayout/ContentEmpty.tsx
|
|
841
862
|
import React11 from "react";
|
|
842
|
-
import { Surface as Surface7 } from "@dxos/app-framework";
|
|
863
|
+
import { Surface as Surface7, useCapability as useCapability5 } from "@dxos/app-framework";
|
|
843
864
|
var ContentEmpty = () => {
|
|
844
865
|
const breakpoint = useBreakpoints();
|
|
845
|
-
const
|
|
866
|
+
const { deck } = useCapability5(DeckCapabilities.MutableDeckState);
|
|
867
|
+
const layoutMode = getMode(deck);
|
|
868
|
+
const topbar = layoutAppliesTopbar(breakpoint, layoutMode);
|
|
846
869
|
return /* @__PURE__ */ React11.createElement("div", {
|
|
847
870
|
role: "none",
|
|
848
871
|
className: "grid place-items-center p-8 relative bg-deck",
|
|
@@ -855,51 +878,102 @@ var ContentEmpty = () => {
|
|
|
855
878
|
}));
|
|
856
879
|
};
|
|
857
880
|
|
|
858
|
-
// packages/plugins/plugin-deck/src/components/DeckLayout/
|
|
859
|
-
import React13 from "react";
|
|
860
|
-
import { Surface as Surface8, useAppGraph as useAppGraph5 } from "@dxos/app-framework";
|
|
861
|
-
import { useNode as useNode3 } from "@dxos/plugin-graph";
|
|
862
|
-
import { fixedInsetFlexLayout } from "@dxos/react-ui-theme";
|
|
863
|
-
|
|
864
|
-
// packages/plugins/plugin-deck/src/components/DeckLayout/Fallback.tsx
|
|
881
|
+
// packages/plugins/plugin-deck/src/components/DeckLayout/Dialog.tsx
|
|
865
882
|
import React12 from "react";
|
|
866
|
-
import {
|
|
867
|
-
import {
|
|
868
|
-
var
|
|
869
|
-
const
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
883
|
+
import { Surface as Surface8, useCapability as useCapability6 } from "@dxos/app-framework";
|
|
884
|
+
import { AlertDialog, Dialog as NaturalDialog } from "@dxos/react-ui";
|
|
885
|
+
var Dialog = () => {
|
|
886
|
+
const context = useCapability6(DeckCapabilities.MutableDeckState);
|
|
887
|
+
const { dialogType, dialogBlockAlign, dialogContent, dialogOpen } = context;
|
|
888
|
+
const Root = dialogType === "alert" ? AlertDialog.Root : NaturalDialog.Root;
|
|
889
|
+
const Overlay = dialogType === "alert" ? AlertDialog.Overlay : NaturalDialog.Overlay;
|
|
890
|
+
return /* @__PURE__ */ React12.createElement(Root, {
|
|
891
|
+
modal: dialogBlockAlign !== "end",
|
|
892
|
+
open: dialogOpen,
|
|
893
|
+
onOpenChange: (nextOpen) => context.dialogOpen = nextOpen
|
|
894
|
+
}, dialogBlockAlign === "end" ? (
|
|
895
|
+
// TODO(burdon): Placeholder creates a suspense boundary; replace with defaults.
|
|
896
|
+
/* @__PURE__ */ React12.createElement(Surface8, {
|
|
897
|
+
role: "dialog",
|
|
898
|
+
data: dialogContent,
|
|
899
|
+
limit: 1,
|
|
900
|
+
fallback: PlankContentError,
|
|
901
|
+
placeholder: /* @__PURE__ */ React12.createElement("div", null)
|
|
902
|
+
})
|
|
903
|
+
) : /* @__PURE__ */ React12.createElement(Overlay, {
|
|
904
|
+
blockAlign: dialogBlockAlign
|
|
905
|
+
}, /* @__PURE__ */ React12.createElement(Surface8, {
|
|
906
|
+
role: "dialog",
|
|
907
|
+
data: dialogContent,
|
|
908
|
+
limit: 1,
|
|
909
|
+
fallback: PlankContentError
|
|
910
|
+
})));
|
|
877
911
|
};
|
|
878
912
|
|
|
879
|
-
// packages/plugins/plugin-deck/src/components/DeckLayout/
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
var
|
|
884
|
-
const
|
|
885
|
-
const
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
913
|
+
// packages/plugins/plugin-deck/src/components/DeckLayout/Popover.tsx
|
|
914
|
+
import React13, { useCallback as useCallback5, useEffect as useEffect5, useRef as useRef2, useState as useState3 } from "react";
|
|
915
|
+
import { Surface as Surface9, useCapability as useCapability7 } from "@dxos/app-framework";
|
|
916
|
+
import { Popover as Popover2 } from "@dxos/react-ui";
|
|
917
|
+
var PopoverRoot = ({ children }) => {
|
|
918
|
+
const context = useCapability7(DeckCapabilities.MutableDeckState);
|
|
919
|
+
const virtualRef = useRef2(null);
|
|
920
|
+
const [virtualIter, setVirtualIter] = useState3(0);
|
|
921
|
+
const [delayedPopoverVisibility, setDelayedPopoverVisibility] = useState3(false);
|
|
922
|
+
useEffect5(() => {
|
|
923
|
+
context.popoverOpen ? setTimeout(() => setDelayedPopoverVisibility(true), 40) : setDelayedPopoverVisibility(false);
|
|
924
|
+
}, [
|
|
925
|
+
context.popoverOpen
|
|
926
|
+
]);
|
|
927
|
+
const handlePopoverOpenChange = useCallback5((nextOpen) => {
|
|
928
|
+
if (nextOpen && (context.popoverAnchor || context.popoverAnchorId)) {
|
|
929
|
+
context.popoverOpen = true;
|
|
930
|
+
} else {
|
|
931
|
+
context.popoverOpen = false;
|
|
932
|
+
context.popoverAnchor = void 0;
|
|
933
|
+
context.popoverAnchorId = void 0;
|
|
934
|
+
context.popoverSide = void 0;
|
|
896
935
|
}
|
|
897
|
-
}
|
|
936
|
+
}, [
|
|
937
|
+
context
|
|
938
|
+
]);
|
|
939
|
+
useEffect5(() => {
|
|
940
|
+
virtualRef.current = context.popoverAnchor ?? null;
|
|
941
|
+
setVirtualIter((iter) => iter + 1);
|
|
942
|
+
}, [
|
|
943
|
+
context.popoverAnchor
|
|
944
|
+
]);
|
|
945
|
+
return /* @__PURE__ */ React13.createElement(Popover2.Root, {
|
|
946
|
+
modal: true,
|
|
947
|
+
open: !!((context.popoverAnchor || context.popoverAnchorId) && delayedPopoverVisibility),
|
|
948
|
+
onOpenChange: handlePopoverOpenChange
|
|
949
|
+
}, context.popoverAnchor && /* @__PURE__ */ React13.createElement(Popover2.VirtualTrigger, {
|
|
950
|
+
key: virtualIter,
|
|
951
|
+
virtualRef
|
|
952
|
+
}), children);
|
|
953
|
+
};
|
|
954
|
+
var PopoverContent = () => {
|
|
955
|
+
const context = useCapability7(DeckCapabilities.MutableDeckState);
|
|
956
|
+
const handlePopoverClose = useCallback5(() => {
|
|
957
|
+
context.popoverOpen = false;
|
|
958
|
+
context.popoverAnchor = void 0;
|
|
959
|
+
context.popoverAnchorId = void 0;
|
|
960
|
+
context.popoverSide = void 0;
|
|
961
|
+
}, [
|
|
962
|
+
context
|
|
963
|
+
]);
|
|
964
|
+
return /* @__PURE__ */ React13.createElement(Popover2.Portal, null, /* @__PURE__ */ React13.createElement(Popover2.Content, {
|
|
965
|
+
side: context.popoverSide,
|
|
966
|
+
onEscapeKeyDown: handlePopoverClose
|
|
967
|
+
}, /* @__PURE__ */ React13.createElement(Popover2.Viewport, null, /* @__PURE__ */ React13.createElement(Surface9, {
|
|
968
|
+
role: "popover",
|
|
969
|
+
data: context.popoverContent,
|
|
970
|
+
limit: 1
|
|
971
|
+
})), /* @__PURE__ */ React13.createElement(Popover2.Arrow, null)));
|
|
898
972
|
};
|
|
899
973
|
|
|
900
974
|
// packages/plugins/plugin-deck/src/components/DeckLayout/StatusBar.tsx
|
|
901
975
|
import React14 from "react";
|
|
902
|
-
import { Surface as
|
|
976
|
+
import { Surface as Surface10 } from "@dxos/app-framework";
|
|
903
977
|
import { useLandmarkMover } from "@dxos/react-ui";
|
|
904
978
|
var StatusBar = ({ showHints }) => {
|
|
905
979
|
const mover = useLandmarkMover(void 0, "3");
|
|
@@ -907,10 +981,10 @@ var StatusBar = ({ showHints }) => {
|
|
|
907
981
|
role: "contentinfo",
|
|
908
982
|
className: "fixed block-end-0 inset-inline-0 bs-[--statusbar-size] border-bs border-separator z-[2] flex text-description",
|
|
909
983
|
...mover
|
|
910
|
-
}, showHints && /* @__PURE__ */ React14.createElement(
|
|
984
|
+
}, showHints && /* @__PURE__ */ React14.createElement(Surface10, {
|
|
911
985
|
role: "hints",
|
|
912
986
|
limit: 1
|
|
913
|
-
}), /* @__PURE__ */ React14.createElement(
|
|
987
|
+
}), /* @__PURE__ */ React14.createElement(Surface10, {
|
|
914
988
|
role: "status-bar",
|
|
915
989
|
limit: 1
|
|
916
990
|
}));
|
|
@@ -918,9 +992,9 @@ var StatusBar = ({ showHints }) => {
|
|
|
918
992
|
|
|
919
993
|
// packages/plugins/plugin-deck/src/components/DeckLayout/Toast.tsx
|
|
920
994
|
import React15 from "react";
|
|
921
|
-
import { Button as Button2, Icon as Icon3, Toast as NaturalToast, toLocalizedString as toLocalizedString3, useTranslation as
|
|
995
|
+
import { Button as Button2, Icon as Icon3, Toast as NaturalToast, toLocalizedString as toLocalizedString3, useTranslation as useTranslation7 } from "@dxos/react-ui";
|
|
922
996
|
var Toast = ({ id, title, description, icon, duration, actionLabel, actionAlt, closeLabel, onAction, onOpenChange }) => {
|
|
923
|
-
const { t } =
|
|
997
|
+
const { t } = useTranslation7(DECK_PLUGIN);
|
|
924
998
|
return /* @__PURE__ */ React15.createElement(NaturalToast.Root, {
|
|
925
999
|
"data-testid": id,
|
|
926
1000
|
defaultOpen: true,
|
|
@@ -964,23 +1038,18 @@ var PlankSeparator = ({ order }) => order > 0 ? /* @__PURE__ */ React17.createEl
|
|
|
964
1038
|
}) : null;
|
|
965
1039
|
var DeckLayout = ({ onDismissToast }) => {
|
|
966
1040
|
const { dispatchPromise: dispatch } = useIntentDispatcher5();
|
|
967
|
-
const settings =
|
|
968
|
-
const context =
|
|
969
|
-
const { sidebarState, complementarySidebarState, complementarySidebarPanel,
|
|
1041
|
+
const settings = useCapability8(Capabilities.SettingsStore).getStore(DECK_PLUGIN).value;
|
|
1042
|
+
const context = useCapability8(DeckCapabilities.MutableDeckState);
|
|
1043
|
+
const { sidebarState, complementarySidebarState, complementarySidebarPanel, deck, toasts } = context;
|
|
970
1044
|
const { active, activeCompanions, fullscreen, solo, plankSizing } = deck;
|
|
971
1045
|
const breakpoint = useBreakpoints();
|
|
972
|
-
const
|
|
973
|
-
const
|
|
1046
|
+
const layoutMode = getMode(deck);
|
|
1047
|
+
const topbar = layoutAppliesTopbar(breakpoint, layoutMode);
|
|
1048
|
+
const hoistStatusbar = useHoistStatusbar(breakpoint, layoutMode);
|
|
974
1049
|
const pluginManager = usePluginManager();
|
|
975
|
-
const scrollLeftRef =
|
|
976
|
-
const deckRef =
|
|
977
|
-
|
|
978
|
-
useEffect5(() => {
|
|
979
|
-
popoverOpen ? setTimeout(() => setDelayedPopoverVisibility(true), 40) : setDelayedPopoverVisibility(false);
|
|
980
|
-
}, [
|
|
981
|
-
popoverOpen
|
|
982
|
-
]);
|
|
983
|
-
useEffect5(() => {
|
|
1050
|
+
const scrollLeftRef = useRef3();
|
|
1051
|
+
const deckRef = useRef3(null);
|
|
1052
|
+
useEffect6(() => {
|
|
984
1053
|
const attended = untracked(() => {
|
|
985
1054
|
const attention = pluginManager.context.requestCapability(AttentionCapabilities.Attention);
|
|
986
1055
|
return attention.current;
|
|
@@ -993,8 +1062,8 @@ var DeckLayout = ({ onDismissToast }) => {
|
|
|
993
1062
|
const [isNotMobile] = useMediaQuery("md", {
|
|
994
1063
|
ssr: false
|
|
995
1064
|
});
|
|
996
|
-
const shouldRevert =
|
|
997
|
-
|
|
1065
|
+
const shouldRevert = useRef3(false);
|
|
1066
|
+
useEffect6(() => {
|
|
998
1067
|
if (!isNotMobile && getMode(deck) === "deck") {
|
|
999
1068
|
const attended = untracked(() => {
|
|
1000
1069
|
const attention = pluginManager.context.requestCapability(AttentionCapabilities.Attention);
|
|
@@ -1021,7 +1090,7 @@ var DeckLayout = ({ onDismissToast }) => {
|
|
|
1021
1090
|
deck,
|
|
1022
1091
|
dispatch
|
|
1023
1092
|
]);
|
|
1024
|
-
|
|
1093
|
+
useEffect6(() => {
|
|
1025
1094
|
if (!settings.enableDeck) {
|
|
1026
1095
|
void dispatch(createIntent5(LayoutAction4.SetLayoutMode, {
|
|
1027
1096
|
part: "mode",
|
|
@@ -1036,23 +1105,22 @@ var DeckLayout = ({ onDismissToast }) => {
|
|
|
1036
1105
|
dispatch,
|
|
1037
1106
|
active
|
|
1038
1107
|
]);
|
|
1039
|
-
const handleResize =
|
|
1108
|
+
const handleResize = useCallback6(() => {
|
|
1040
1109
|
scrollLeftRef.current = null;
|
|
1041
1110
|
}, []);
|
|
1042
|
-
|
|
1111
|
+
useEffect6(() => {
|
|
1043
1112
|
window.addEventListener("resize", handleResize);
|
|
1044
1113
|
return () => window.removeEventListener("resize", handleResize);
|
|
1045
1114
|
}, [
|
|
1046
1115
|
handleResize
|
|
1047
1116
|
]);
|
|
1048
|
-
const restoreScroll =
|
|
1117
|
+
const restoreScroll = useCallback6(() => {
|
|
1049
1118
|
if (deckRef.current && scrollLeftRef.current != null) {
|
|
1050
1119
|
deckRef.current.scrollLeft = scrollLeftRef.current;
|
|
1051
1120
|
}
|
|
1052
1121
|
}, []);
|
|
1053
|
-
const layoutMode = getMode(deck);
|
|
1054
1122
|
useOnTransition(layoutMode, (mode) => mode !== "deck", "deck", restoreScroll);
|
|
1055
|
-
const handleScroll =
|
|
1123
|
+
const handleScroll = useCallback6((event) => {
|
|
1056
1124
|
if (!solo && event.currentTarget === event.target) {
|
|
1057
1125
|
scrollLeftRef.current = event.target.scrollLeft;
|
|
1058
1126
|
}
|
|
@@ -1078,21 +1146,6 @@ var DeckLayout = ({ onDismissToast }) => {
|
|
|
1078
1146
|
topbar,
|
|
1079
1147
|
hoistStatusbar
|
|
1080
1148
|
]);
|
|
1081
|
-
const Dialog = dialogType === "alert" ? AlertDialog : NaturalDialog;
|
|
1082
|
-
const handlePopoverOpenChange = useCallback5((nextOpen) => {
|
|
1083
|
-
if (nextOpen && popoverAnchorId) {
|
|
1084
|
-
context.popoverOpen = true;
|
|
1085
|
-
} else {
|
|
1086
|
-
context.popoverOpen = false;
|
|
1087
|
-
context.popoverAnchorId = void 0;
|
|
1088
|
-
context.popoverSide = void 0;
|
|
1089
|
-
}
|
|
1090
|
-
}, [
|
|
1091
|
-
context
|
|
1092
|
-
]);
|
|
1093
|
-
const handlePopoverClose = useCallback5(() => handlePopoverOpenChange(false), [
|
|
1094
|
-
handlePopoverOpenChange
|
|
1095
|
-
]);
|
|
1096
1149
|
const { order, itemsCount } = useMemo5(() => {
|
|
1097
1150
|
return active.reduce((acc, entryId) => {
|
|
1098
1151
|
acc.order[entryId] = acc.itemsCount + 1;
|
|
@@ -1106,16 +1159,10 @@ var DeckLayout = ({ onDismissToast }) => {
|
|
|
1106
1159
|
active,
|
|
1107
1160
|
activeCompanions
|
|
1108
1161
|
]);
|
|
1109
|
-
return /* @__PURE__ */ React17.createElement(
|
|
1110
|
-
|
|
1111
|
-
open: !!(popoverAnchorId && delayedPopoverVisibility),
|
|
1112
|
-
onOpenChange: handlePopoverOpenChange
|
|
1113
|
-
}, /* @__PURE__ */ React17.createElement(ActiveNode, null), fullscreen && /* @__PURE__ */ React17.createElement(Fullscreen, {
|
|
1114
|
-
id: solo
|
|
1115
|
-
}), !fullscreen && /* @__PURE__ */ React17.createElement(Main3.Root, {
|
|
1116
|
-
navigationSidebarState: context.sidebarState,
|
|
1162
|
+
return /* @__PURE__ */ React17.createElement(PopoverRoot, null, /* @__PURE__ */ React17.createElement(ActiveNode, null), /* @__PURE__ */ React17.createElement(Main3.Root, {
|
|
1163
|
+
navigationSidebarState: fullscreen ? "closed" : context.sidebarState,
|
|
1117
1164
|
onNavigationSidebarStateChange: (next) => context.sidebarState = next,
|
|
1118
|
-
complementarySidebarState: context.complementarySidebarState,
|
|
1165
|
+
complementarySidebarState: fullscreen ? "closed" : context.complementarySidebarState,
|
|
1119
1166
|
onComplementarySidebarStateChange: (next) => context.complementarySidebarState = next
|
|
1120
1167
|
}, /* @__PURE__ */ React17.createElement(Sidebar, null), /* @__PURE__ */ React17.createElement(ComplementarySidebar, {
|
|
1121
1168
|
current: complementarySidebarPanel
|
|
@@ -1139,9 +1186,9 @@ var DeckLayout = ({ onDismissToast }) => {
|
|
|
1139
1186
|
...solo && {
|
|
1140
1187
|
inert: ""
|
|
1141
1188
|
}
|
|
1142
|
-
}, !topbar && /* @__PURE__ */ React17.createElement(ToggleSidebarButton, {
|
|
1189
|
+
}, !topbar && !fullscreen && /* @__PURE__ */ React17.createElement(ToggleSidebarButton, {
|
|
1143
1190
|
classNames: fixedSidebarToggleStyles
|
|
1144
|
-
}), !topbar && /* @__PURE__ */ React17.createElement(ToggleComplementarySidebarButton, {
|
|
1191
|
+
}), !topbar && !fullscreen && /* @__PURE__ */ React17.createElement(ToggleComplementarySidebarButton, {
|
|
1145
1192
|
classNames: fixedComplementarySidebarToggleStyles
|
|
1146
1193
|
}), /* @__PURE__ */ React17.createElement(Stack, {
|
|
1147
1194
|
ref: deckRef,
|
|
@@ -1172,9 +1219,9 @@ var DeckLayout = ({ onDismissToast }) => {
|
|
|
1172
1219
|
...!solo && {
|
|
1173
1220
|
inert: ""
|
|
1174
1221
|
}
|
|
1175
|
-
}, !topbar && /* @__PURE__ */ React17.createElement(ToggleSidebarButton, {
|
|
1222
|
+
}, !topbar && !fullscreen && /* @__PURE__ */ React17.createElement(ToggleSidebarButton, {
|
|
1176
1223
|
classNames: fixedSidebarToggleStyles
|
|
1177
|
-
}), !topbar && /* @__PURE__ */ React17.createElement(ToggleComplementarySidebarButton, {
|
|
1224
|
+
}), !topbar && !fullscreen && /* @__PURE__ */ React17.createElement(ToggleComplementarySidebarButton, {
|
|
1178
1225
|
classNames: fixedComplementarySidebarToggleStyles
|
|
1179
1226
|
}), /* @__PURE__ */ React17.createElement(StackContext.Provider, {
|
|
1180
1227
|
value: {
|
|
@@ -1190,34 +1237,7 @@ var DeckLayout = ({ onDismissToast }) => {
|
|
|
1190
1237
|
settings
|
|
1191
1238
|
})))), topbar && /* @__PURE__ */ React17.createElement(Topbar, null), hoistStatusbar && /* @__PURE__ */ React17.createElement(StatusBar, {
|
|
1192
1239
|
showHints: settings.showHints
|
|
1193
|
-
})), /* @__PURE__ */ React17.createElement(
|
|
1194
|
-
side: context.popoverSide,
|
|
1195
|
-
onEscapeKeyDown: handlePopoverClose
|
|
1196
|
-
}, /* @__PURE__ */ React17.createElement(Popover2.Viewport, null, /* @__PURE__ */ React17.createElement(Surface10, {
|
|
1197
|
-
role: "popover",
|
|
1198
|
-
data: popoverContent,
|
|
1199
|
-
limit: 1
|
|
1200
|
-
})), /* @__PURE__ */ React17.createElement(Popover2.Arrow, null))), /* @__PURE__ */ React17.createElement(Dialog.Root, {
|
|
1201
|
-
modal: dialogBlockAlign !== "end",
|
|
1202
|
-
open: dialogOpen,
|
|
1203
|
-
onOpenChange: (nextOpen) => context.dialogOpen = nextOpen
|
|
1204
|
-
}, dialogBlockAlign === "end" ? (
|
|
1205
|
-
// TODO(burdon): Placeholder creates a suspense boundary; replace with defaults.
|
|
1206
|
-
/* @__PURE__ */ React17.createElement(Surface10, {
|
|
1207
|
-
role: "dialog",
|
|
1208
|
-
data: dialogContent,
|
|
1209
|
-
limit: 1,
|
|
1210
|
-
fallback: PlankContentError,
|
|
1211
|
-
placeholder: /* @__PURE__ */ React17.createElement("div", null)
|
|
1212
|
-
})
|
|
1213
|
-
) : /* @__PURE__ */ React17.createElement(Dialog.Overlay, {
|
|
1214
|
-
blockAlign: dialogBlockAlign
|
|
1215
|
-
}, /* @__PURE__ */ React17.createElement(Surface10, {
|
|
1216
|
-
role: "dialog",
|
|
1217
|
-
data: dialogContent,
|
|
1218
|
-
limit: 1,
|
|
1219
|
-
fallback: PlankContentError
|
|
1220
|
-
}))), toasts?.map((toast) => /* @__PURE__ */ React17.createElement(Toast, {
|
|
1240
|
+
})), /* @__PURE__ */ React17.createElement(PopoverContent, null), /* @__PURE__ */ React17.createElement(Dialog, null), toasts?.map((toast) => /* @__PURE__ */ React17.createElement(Toast, {
|
|
1221
1241
|
...toast,
|
|
1222
1242
|
key: toast.id,
|
|
1223
1243
|
onOpenChange: (open) => {
|
|
@@ -1231,11 +1251,11 @@ var DeckLayout = ({ onDismissToast }) => {
|
|
|
1231
1251
|
|
|
1232
1252
|
// packages/plugins/plugin-deck/src/components/DeckSettings/DeckSettings.tsx
|
|
1233
1253
|
import React18 from "react";
|
|
1234
|
-
import { Input, Select, useTranslation as
|
|
1254
|
+
import { Input, Select, useTranslation as useTranslation8 } from "@dxos/react-ui";
|
|
1235
1255
|
import { DeprecatedFormContainer, DeprecatedFormInput } from "@dxos/react-ui-form";
|
|
1236
1256
|
var isSocket = !!globalThis.__args;
|
|
1237
1257
|
var DeckSettings = ({ settings }) => {
|
|
1238
|
-
const { t } =
|
|
1258
|
+
const { t } = useTranslation8(DECK_PLUGIN);
|
|
1239
1259
|
return /* @__PURE__ */ React18.createElement(DeprecatedFormContainer, null, /* @__PURE__ */ React18.createElement(DeprecatedFormInput, {
|
|
1240
1260
|
label: t("settings enable deck label")
|
|
1241
1261
|
}, /* @__PURE__ */ React18.createElement(Input.Switch, {
|
|
@@ -1286,4 +1306,4 @@ export {
|
|
|
1286
1306
|
DeckLayout,
|
|
1287
1307
|
DeckSettings
|
|
1288
1308
|
};
|
|
1289
|
-
//# sourceMappingURL=chunk-
|
|
1309
|
+
//# sourceMappingURL=chunk-VP6FCWFV.mjs.map
|