@dxos/plugin-deck 0.7.5-main.9d2a38b → 0.7.5-main.e94eead
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-67VRUD5K.mjs → app-graph-builder-IYHAGFA3.mjs} +61 -31
- package/dist/lib/browser/app-graph-builder-IYHAGFA3.mjs.map +7 -0
- package/dist/lib/browser/{check-app-scheme-GEX6W2R5.mjs → check-app-scheme-S3EYUPMF.mjs} +3 -3
- package/dist/lib/browser/{check-app-scheme-GEX6W2R5.mjs.map → check-app-scheme-S3EYUPMF.mjs.map} +2 -2
- package/dist/lib/browser/{chunk-5VFDMW5M.mjs → chunk-22AQ5IVX.mjs} +2 -2
- package/dist/lib/browser/chunk-22AQ5IVX.mjs.map +7 -0
- package/dist/lib/browser/chunk-FT33W5CI.mjs +128 -0
- package/dist/lib/browser/chunk-FT33W5CI.mjs.map +7 -0
- package/dist/lib/browser/chunk-G2X3ZDCE.mjs +24 -0
- package/dist/lib/browser/chunk-G2X3ZDCE.mjs.map +7 -0
- package/dist/lib/browser/chunk-KANJBSIX.mjs +97 -0
- package/dist/lib/browser/chunk-KANJBSIX.mjs.map +7 -0
- package/dist/lib/browser/{chunk-JQJ5UWVB.mjs → chunk-N7TEPFVR.mjs} +3 -2
- package/dist/lib/browser/{chunk-JQJ5UWVB.mjs.map → chunk-N7TEPFVR.mjs.map} +3 -3
- package/dist/lib/browser/chunk-O4RFYYQ6.mjs +1114 -0
- package/dist/lib/browser/chunk-O4RFYYQ6.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +45 -78
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/intent-resolver-ZD67BRUI.mjs +488 -0
- package/dist/lib/browser/intent-resolver-ZD67BRUI.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{react-root-UL7ZDRVZ.mjs → react-root-6ILKHD5J.mjs} +12 -17
- package/dist/lib/browser/react-root-6ILKHD5J.mjs.map +7 -0
- package/dist/lib/browser/react-surface-O75FKXAI.mjs +39 -0
- package/dist/lib/browser/react-surface-O75FKXAI.mjs.map +7 -0
- package/dist/lib/browser/{settings-FNWW6WIJ.mjs → settings-H35U6NHE.mjs} +6 -7
- package/dist/lib/browser/settings-H35U6NHE.mjs.map +7 -0
- package/dist/lib/browser/state-U4SHOPJW.mjs +129 -0
- package/dist/lib/browser/state-U4SHOPJW.mjs.map +7 -0
- package/dist/lib/browser/tools-64LXGLYR.mjs +59 -0
- package/dist/lib/browser/tools-64LXGLYR.mjs.map +7 -0
- package/dist/lib/browser/types.mjs +16 -4
- package/dist/lib/browser/url-handler-MVHTKUYA.mjs +72 -0
- package/dist/lib/browser/url-handler-MVHTKUYA.mjs.map +7 -0
- package/dist/types/src/DeckPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts +181 -0
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -0
- package/dist/types/src/capabilities/capabilities.d.ts +137 -8
- package/dist/types/src/capabilities/capabilities.d.ts.map +1 -1
- package/dist/types/src/capabilities/check-app-scheme.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +188 -3
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-root.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -0
- package/dist/types/src/capabilities/settings.d.ts.map +1 -0
- package/dist/types/src/capabilities/state.d.ts +79 -0
- package/dist/types/src/capabilities/state.d.ts.map +1 -0
- package/dist/types/src/capabilities/tools.d.ts +10 -0
- package/dist/types/src/capabilities/tools.d.ts.map +1 -0
- package/dist/types/src/capabilities/url-handler.d.ts.map +1 -0
- package/dist/types/src/components/DeckLayout/ActiveNode.d.ts +1 -2
- package/dist/types/src/components/DeckLayout/ActiveNode.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/Banner.d.ts +1 -2
- package/dist/types/src/components/DeckLayout/Banner.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/ComplementarySidebar.d.ts +1 -4
- package/dist/types/src/components/DeckLayout/ComplementarySidebar.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/ContentEmpty.d.ts +1 -2
- package/dist/types/src/components/DeckLayout/ContentEmpty.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/DeckLayout.d.ts +2 -7
- package/dist/types/src/components/DeckLayout/DeckLayout.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/Fallback.d.ts +1 -2
- package/dist/types/src/components/DeckLayout/Fallback.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/Fullscreen.d.ts +1 -2
- package/dist/types/src/components/DeckLayout/Fullscreen.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/NodePlankHeading.d.ts +3 -3
- package/dist/types/src/components/DeckLayout/NodePlankHeading.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/Plank.d.ts +8 -6
- package/dist/types/src/components/DeckLayout/Plank.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/PlankControls.d.ts +2 -2
- package/dist/types/src/components/DeckLayout/PlankControls.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/PlankError.d.ts +6 -6
- package/dist/types/src/components/DeckLayout/PlankError.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/PlankLoading.d.ts +1 -2
- package/dist/types/src/components/DeckLayout/PlankLoading.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/Sidebar.d.ts +1 -2
- package/dist/types/src/components/DeckLayout/Sidebar.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/SidebarButton.d.ts +6 -5
- package/dist/types/src/components/DeckLayout/SidebarButton.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/StatusBar.d.ts +1 -2
- package/dist/types/src/components/DeckLayout/StatusBar.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/Toast.d.ts +2 -3
- package/dist/types/src/components/DeckLayout/Toast.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/Topbar.d.ts +1 -2
- package/dist/types/src/components/DeckLayout/Topbar.d.ts.map +1 -1
- package/dist/types/src/components/LayoutSettings.d.ts +1 -2
- package/dist/types/src/components/LayoutSettings.d.ts.map +1 -1
- package/dist/types/src/components/fragments.d.ts +2 -0
- package/dist/types/src/components/fragments.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +0 -2
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/events.d.ts +1 -0
- package/dist/types/src/events.d.ts.map +1 -1
- package/dist/types/src/hooks/useMainSize.d.ts +2 -2
- package/dist/types/src/hooks/useNode.d.ts.map +1 -1
- package/dist/types/src/layout.d.ts +5 -19
- package/dist/types/src/layout.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +1 -0
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +3 -3
- package/dist/types/src/types.d.ts +117 -2
- package/dist/types/src/types.d.ts.map +1 -1
- package/dist/types/src/util/index.d.ts +3 -1
- package/dist/types/src/util/index.d.ts.map +1 -1
- package/dist/types/src/util/layoutAppliesTopbar.d.ts +2 -0
- package/dist/types/src/util/layoutAppliesTopbar.d.ts.map +1 -0
- package/dist/types/src/util/set-active.d.ts +9 -0
- package/dist/types/src/util/set-active.d.ts.map +1 -0
- package/dist/types/src/util/useHoistStatusbar.d.ts.map +1 -1
- package/package.json +32 -31
- package/src/DeckPlugin.ts +23 -59
- package/src/capabilities/{layout/app-graph-builder.ts → app-graph-builder.ts} +40 -28
- package/src/capabilities/capabilities.ts +5 -7
- package/src/capabilities/{navigation/check-app-scheme.ts → check-app-scheme.ts} +2 -2
- package/src/capabilities/index.ts +12 -3
- package/src/capabilities/intent-resolver.ts +368 -0
- package/src/capabilities/{layout/react-root.tsx → react-root.tsx} +8 -14
- package/src/capabilities/react-surface.tsx +31 -0
- package/src/capabilities/{settings/settings.ts → settings.ts} +4 -5
- package/src/capabilities/state.ts +108 -0
- package/src/capabilities/tools.ts +66 -0
- package/src/capabilities/url-handler.ts +65 -0
- package/src/components/DeckLayout/ActiveNode.tsx +2 -3
- package/src/components/DeckLayout/ComplementarySidebar.tsx +185 -77
- package/src/components/DeckLayout/ContentEmpty.tsx +7 -10
- package/src/components/DeckLayout/DeckLayout.tsx +141 -84
- package/src/components/DeckLayout/Fullscreen.tsx +2 -3
- package/src/components/DeckLayout/NodePlankHeading.tsx +57 -65
- package/src/components/DeckLayout/Plank.tsx +33 -41
- package/src/components/DeckLayout/PlankControls.tsx +12 -11
- package/src/components/DeckLayout/PlankError.tsx +6 -5
- package/src/components/DeckLayout/Sidebar.tsx +17 -20
- package/src/components/DeckLayout/SidebarButton.tsx +25 -31
- package/src/components/DeckLayout/StatusBar.tsx +5 -11
- package/src/components/DeckLayout/Toast.tsx +2 -2
- package/src/components/LayoutSettings.tsx +8 -8
- package/src/components/fragments.ts +8 -0
- package/src/components/index.ts +0 -2
- package/src/events.ts +1 -0
- package/src/hooks/useMainSize.ts +3 -3
- package/src/hooks/useNode.ts +3 -1
- package/src/layout.ts +43 -212
- package/src/meta.ts +1 -0
- package/src/translations.ts +8 -8
- package/src/types.ts +103 -4
- package/src/util/index.ts +3 -1
- package/src/util/layoutAppliesTopbar.ts +7 -0
- package/src/util/set-active.ts +47 -0
- package/src/util/useHoistStatusbar.ts +13 -8
- package/dist/lib/browser/app-graph-builder-67VRUD5K.mjs.map +0 -7
- package/dist/lib/browser/chunk-2M4PXYNB.mjs +0 -1052
- package/dist/lib/browser/chunk-2M4PXYNB.mjs.map +0 -7
- package/dist/lib/browser/chunk-2PJNBVCY.mjs +0 -39
- package/dist/lib/browser/chunk-2PJNBVCY.mjs.map +0 -7
- package/dist/lib/browser/chunk-4C2AFTET.mjs +0 -186
- package/dist/lib/browser/chunk-4C2AFTET.mjs.map +0 -7
- package/dist/lib/browser/chunk-5VFDMW5M.mjs.map +0 -7
- package/dist/lib/browser/chunk-KY5WXIXY.mjs +0 -44
- package/dist/lib/browser/chunk-KY5WXIXY.mjs.map +0 -7
- package/dist/lib/browser/deck-PLCSKPGL.mjs +0 -26
- package/dist/lib/browser/deck-PLCSKPGL.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-FVOQSTBX.mjs +0 -152
- package/dist/lib/browser/intent-resolver-FVOQSTBX.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-K7GW4A2I.mjs +0 -249
- package/dist/lib/browser/intent-resolver-K7GW4A2I.mjs.map +0 -7
- package/dist/lib/browser/location-QHRBQBQN.mjs +0 -35
- package/dist/lib/browser/location-QHRBQBQN.mjs.map +0 -7
- package/dist/lib/browser/react-context-3BDW7W2N.mjs +0 -32
- package/dist/lib/browser/react-context-3BDW7W2N.mjs.map +0 -7
- package/dist/lib/browser/react-root-UL7ZDRVZ.mjs.map +0 -7
- package/dist/lib/browser/react-surface-VPNOGGNN.mjs +0 -28
- package/dist/lib/browser/react-surface-VPNOGGNN.mjs.map +0 -7
- package/dist/lib/browser/settings-FNWW6WIJ.mjs.map +0 -7
- package/dist/lib/browser/state-7I5BD7SE.mjs +0 -34
- package/dist/lib/browser/state-7I5BD7SE.mjs.map +0 -7
- package/dist/lib/browser/url-handler-Z5B7LD3N.mjs +0 -76
- package/dist/lib/browser/url-handler-Z5B7LD3N.mjs.map +0 -7
- package/dist/types/src/capabilities/layout/app-graph-builder.d.ts +0 -181
- package/dist/types/src/capabilities/layout/app-graph-builder.d.ts.map +0 -1
- package/dist/types/src/capabilities/layout/deck.d.ts +0 -4
- package/dist/types/src/capabilities/layout/deck.d.ts.map +0 -1
- package/dist/types/src/capabilities/layout/index.d.ts +0 -229
- package/dist/types/src/capabilities/layout/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/layout/intent-resolver.d.ts.map +0 -1
- package/dist/types/src/capabilities/layout/react-context.d.ts +0 -8
- package/dist/types/src/capabilities/layout/react-context.d.ts.map +0 -1
- package/dist/types/src/capabilities/layout/react-root.d.ts.map +0 -1
- package/dist/types/src/capabilities/layout/state.d.ts +0 -42
- package/dist/types/src/capabilities/layout/state.d.ts.map +0 -1
- package/dist/types/src/capabilities/navigation/check-app-scheme.d.ts.map +0 -1
- package/dist/types/src/capabilities/navigation/index.d.ts +0 -5
- package/dist/types/src/capabilities/navigation/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/navigation/intent-resolver.d.ts +0 -4
- package/dist/types/src/capabilities/navigation/intent-resolver.d.ts.map +0 -1
- package/dist/types/src/capabilities/navigation/location.d.ts +0 -4
- package/dist/types/src/capabilities/navigation/location.d.ts.map +0 -1
- package/dist/types/src/capabilities/navigation/set-location.d.ts +0 -10
- package/dist/types/src/capabilities/navigation/set-location.d.ts.map +0 -1
- package/dist/types/src/capabilities/navigation/url-handler.d.ts.map +0 -1
- package/dist/types/src/capabilities/settings/index.d.ts +0 -3
- package/dist/types/src/capabilities/settings/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/settings/react-surface.d.ts.map +0 -1
- package/dist/types/src/capabilities/settings/settings.d.ts.map +0 -1
- package/dist/types/src/components/DeckContext.d.ts +0 -11
- package/dist/types/src/components/DeckContext.d.ts.map +0 -1
- package/dist/types/src/components/LayoutContext.d.ts +0 -5
- package/dist/types/src/components/LayoutContext.d.ts.map +0 -1
- package/dist/types/src/layout.test.d.ts +0 -2
- package/dist/types/src/layout.test.d.ts.map +0 -1
- package/dist/types/src/util/layout-parts.d.ts +0 -7
- package/dist/types/src/util/layout-parts.d.ts.map +0 -1
- package/src/capabilities/layout/deck.ts +0 -25
- package/src/capabilities/layout/index.ts +0 -12
- package/src/capabilities/layout/intent-resolver.ts +0 -128
- package/src/capabilities/layout/react-context.tsx +0 -26
- package/src/capabilities/layout/state.ts +0 -32
- package/src/capabilities/navigation/index.ts +0 -10
- package/src/capabilities/navigation/intent-resolver.ts +0 -216
- package/src/capabilities/navigation/location.ts +0 -28
- package/src/capabilities/navigation/set-location.ts +0 -38
- package/src/capabilities/navigation/url-handler.ts +0 -67
- package/src/capabilities/settings/index.ts +0 -8
- package/src/capabilities/settings/react-surface.tsx +0 -23
- package/src/components/DeckContext.ts +0 -19
- package/src/components/LayoutContext.ts +0 -12
- package/src/layout.test.ts +0 -380
- package/src/util/layout-parts.ts +0 -12
- /package/dist/types/src/capabilities/{navigation/check-app-scheme.d.ts → check-app-scheme.d.ts} +0 -0
- /package/dist/types/src/capabilities/{layout/intent-resolver.d.ts → intent-resolver.d.ts} +0 -0
- /package/dist/types/src/capabilities/{layout/react-root.d.ts → react-root.d.ts} +0 -0
- /package/dist/types/src/capabilities/{settings/react-surface.d.ts → react-surface.d.ts} +0 -0
- /package/dist/types/src/capabilities/{settings/settings.d.ts → settings.d.ts} +0 -0
- /package/dist/types/src/capabilities/{navigation/url-handler.d.ts → url-handler.d.ts} +0 -0
|
@@ -0,0 +1,1114 @@
|
|
|
1
|
+
import {
|
|
2
|
+
calculateOverscroll,
|
|
3
|
+
layoutAppliesTopbar,
|
|
4
|
+
useBreakpoints,
|
|
5
|
+
useHoistStatusbar
|
|
6
|
+
} from "./chunk-KANJBSIX.mjs";
|
|
7
|
+
import {
|
|
8
|
+
DeckCapabilities
|
|
9
|
+
} from "./chunk-22AQ5IVX.mjs";
|
|
10
|
+
import {
|
|
11
|
+
DeckAction,
|
|
12
|
+
NewPlankPositions,
|
|
13
|
+
OverscrollOptions,
|
|
14
|
+
SLUG_PATH_SEPARATOR,
|
|
15
|
+
getMode
|
|
16
|
+
} from "./chunk-FT33W5CI.mjs";
|
|
17
|
+
import {
|
|
18
|
+
DECK_PLUGIN
|
|
19
|
+
} from "./chunk-N7TEPFVR.mjs";
|
|
20
|
+
|
|
21
|
+
// packages/plugins/plugin-deck/src/components/DeckLayout/Banner.tsx
|
|
22
|
+
import React2 from "react";
|
|
23
|
+
import { Surface } from "@dxos/app-framework";
|
|
24
|
+
import { mx } from "@dxos/react-ui-theme";
|
|
25
|
+
|
|
26
|
+
// packages/plugins/plugin-deck/src/components/DeckLayout/SidebarButton.tsx
|
|
27
|
+
import React from "react";
|
|
28
|
+
import { useCapability } from "@dxos/app-framework";
|
|
29
|
+
import { IconButton, useTranslation } from "@dxos/react-ui";
|
|
30
|
+
var ToggleSidebarButton = ({ classNames, variant = "ghost" }) => {
|
|
31
|
+
const layoutContext = useCapability(DeckCapabilities.MutableDeckState);
|
|
32
|
+
const { t } = useTranslation(DECK_PLUGIN);
|
|
33
|
+
return /* @__PURE__ */ React.createElement(IconButton, {
|
|
34
|
+
variant,
|
|
35
|
+
iconOnly: true,
|
|
36
|
+
icon: "ph--sidebar--regular",
|
|
37
|
+
size: 4,
|
|
38
|
+
label: t("open navigation sidebar label"),
|
|
39
|
+
onClick: () => layoutContext.sidebarState = layoutContext.sidebarState === "expanded" ? "collapsed" : "expanded",
|
|
40
|
+
classNames
|
|
41
|
+
});
|
|
42
|
+
};
|
|
43
|
+
var CloseSidebarButton = () => {
|
|
44
|
+
const layoutContext = useCapability(DeckCapabilities.MutableDeckState);
|
|
45
|
+
const { t } = useTranslation(DECK_PLUGIN);
|
|
46
|
+
return /* @__PURE__ */ React.createElement(IconButton, {
|
|
47
|
+
variant: "ghost",
|
|
48
|
+
iconOnly: true,
|
|
49
|
+
icon: "ph--caret-line-left--regular",
|
|
50
|
+
size: 4,
|
|
51
|
+
label: t("close navigation sidebar label"),
|
|
52
|
+
onClick: () => layoutContext.sidebarState = "collapsed",
|
|
53
|
+
classNames: "rounded-none pli-1 dx-focus-ring-inset pie-[max(.5rem,env(safe-area-inset-left))]"
|
|
54
|
+
});
|
|
55
|
+
};
|
|
56
|
+
var ToggleComplementarySidebarButton = ({ inR0, classNames }) => {
|
|
57
|
+
const layoutContext = useCapability(DeckCapabilities.MutableDeckState);
|
|
58
|
+
const { t } = useTranslation(DECK_PLUGIN);
|
|
59
|
+
return /* @__PURE__ */ React.createElement(IconButton, {
|
|
60
|
+
iconOnly: true,
|
|
61
|
+
onClick: () => layoutContext.complementarySidebarState = layoutContext.complementarySidebarState === "expanded" ? "collapsed" : "expanded",
|
|
62
|
+
variant: "ghost",
|
|
63
|
+
label: t("open complementary sidebar label"),
|
|
64
|
+
classNames: [
|
|
65
|
+
"[&>svg]:-scale-x-100",
|
|
66
|
+
classNames
|
|
67
|
+
],
|
|
68
|
+
icon: "ph--sidebar-simple--regular",
|
|
69
|
+
size: inR0 ? 5 : 4,
|
|
70
|
+
tooltipSide: inR0 ? "left" : void 0
|
|
71
|
+
});
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
// packages/plugins/plugin-deck/src/components/DeckLayout/Banner.tsx
|
|
75
|
+
var Banner = ({ variant, classNames }) => {
|
|
76
|
+
return /* @__PURE__ */ React2.createElement("header", {
|
|
77
|
+
className: mx("flex items-stretch relative plb-1 pis-1 pie-2", variant === "topbar" && "fixed inset-inline-0 block-start-[env(safe-area-inset-top)] bs-[--rail-size] border-be border-separator", classNames)
|
|
78
|
+
}, variant === "sidebar" ? /* @__PURE__ */ React2.createElement(CloseSidebarButton, null) : /* @__PURE__ */ React2.createElement(ToggleSidebarButton, null), /* @__PURE__ */ React2.createElement("span", {
|
|
79
|
+
className: "self-center grow mis-1"
|
|
80
|
+
}, "Composer"), variant === "topbar" && /* @__PURE__ */ React2.createElement("div", {
|
|
81
|
+
role: "none",
|
|
82
|
+
className: "absolute inset-0 pointer-events-none"
|
|
83
|
+
}, /* @__PURE__ */ React2.createElement("div", {
|
|
84
|
+
role: "none",
|
|
85
|
+
className: "grid bs-full pointer-fine:p-1 max-is-md mli-auto pointer-events-auto"
|
|
86
|
+
}, /* @__PURE__ */ React2.createElement(Surface, {
|
|
87
|
+
role: "search-input",
|
|
88
|
+
limit: 1
|
|
89
|
+
}))), /* @__PURE__ */ React2.createElement("span", {
|
|
90
|
+
role: "none",
|
|
91
|
+
className: "grow"
|
|
92
|
+
}), /* @__PURE__ */ React2.createElement(Surface, {
|
|
93
|
+
role: "header-end",
|
|
94
|
+
limit: 1
|
|
95
|
+
}), /* @__PURE__ */ React2.createElement(Surface, {
|
|
96
|
+
role: "notch-start",
|
|
97
|
+
limit: 1
|
|
98
|
+
}));
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
// packages/plugins/plugin-deck/src/components/DeckLayout/DeckLayout.tsx
|
|
102
|
+
import { untracked } from "@preact/signals-core";
|
|
103
|
+
import React17, { useCallback as useCallback4, useEffect as useEffect6, useMemo as useMemo5, useRef as useRef2, Fragment as Fragment3, useState as useState4 } from "react";
|
|
104
|
+
import { LayoutAction as LayoutAction4, createIntent as createIntent4, Surface as Surface10, useCapability as useCapability5, useIntentDispatcher as useIntentDispatcher4, usePluginManager } from "@dxos/app-framework";
|
|
105
|
+
import { AttentionCapabilities } from "@dxos/plugin-attention";
|
|
106
|
+
import { AlertDialog, Dialog as NaturalDialog, Main as Main3, Popover as Popover2, useOnTransition, useMediaQuery } from "@dxos/react-ui";
|
|
107
|
+
import { Stack, StackContext, DEFAULT_HORIZONTAL_SIZE } from "@dxos/react-ui-stack";
|
|
108
|
+
import { mainPaddingTransitions } from "@dxos/react-ui-theme";
|
|
109
|
+
|
|
110
|
+
// packages/plugins/plugin-deck/src/components/DeckLayout/ActiveNode.tsx
|
|
111
|
+
import React3 from "react";
|
|
112
|
+
import { Surface as Surface2, useAppGraph } from "@dxos/app-framework";
|
|
113
|
+
import { useAttended } from "@dxos/react-ui-attention";
|
|
114
|
+
|
|
115
|
+
// packages/plugins/plugin-deck/src/hooks/useNode.ts
|
|
116
|
+
import { useEffect, useState } from "react";
|
|
117
|
+
var useNode = (graph, id, timeout) => {
|
|
118
|
+
const [nodeState, setNodeState] = useState(id ? graph.findNode(id, false) : void 0);
|
|
119
|
+
useEffect(() => {
|
|
120
|
+
if (!id && nodeState) {
|
|
121
|
+
setNodeState(void 0);
|
|
122
|
+
}
|
|
123
|
+
if (nodeState?.id === id || !id) {
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
const frame = requestAnimationFrame(async () => {
|
|
127
|
+
try {
|
|
128
|
+
const node = await graph.waitForNode(id, timeout);
|
|
129
|
+
if (node) {
|
|
130
|
+
setNodeState(node);
|
|
131
|
+
}
|
|
132
|
+
} catch {
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
return () => cancelAnimationFrame(frame);
|
|
136
|
+
}, [
|
|
137
|
+
graph,
|
|
138
|
+
id,
|
|
139
|
+
timeout,
|
|
140
|
+
nodeState?.id
|
|
141
|
+
]);
|
|
142
|
+
return nodeState;
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
// packages/plugins/plugin-deck/src/hooks/useNodeActionExpander.ts
|
|
146
|
+
import { useEffect as useEffect2 } from "react";
|
|
147
|
+
import { ACTION_GROUP_TYPE, ACTION_TYPE, getGraph } from "@dxos/plugin-graph";
|
|
148
|
+
var expandNodeActions = async (node) => {
|
|
149
|
+
const graph = getGraph(node);
|
|
150
|
+
await graph.expand(node, "outbound", ACTION_GROUP_TYPE);
|
|
151
|
+
await graph.expand(node, "outbound", ACTION_TYPE);
|
|
152
|
+
};
|
|
153
|
+
var useNodeActionExpander = (node) => {
|
|
154
|
+
useEffect2(() => {
|
|
155
|
+
if (node) {
|
|
156
|
+
const frame = requestAnimationFrame(() => {
|
|
157
|
+
void expandNodeActions(node);
|
|
158
|
+
});
|
|
159
|
+
return () => cancelAnimationFrame(frame);
|
|
160
|
+
}
|
|
161
|
+
}, [
|
|
162
|
+
node
|
|
163
|
+
]);
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
// packages/plugins/plugin-deck/src/hooks/useMainSize.ts
|
|
167
|
+
import { useMainContext } from "@dxos/react-ui";
|
|
168
|
+
var useMainSize = () => {
|
|
169
|
+
const { navigationSidebarState, complementarySidebarState } = useMainContext("DeckPluginPlank");
|
|
170
|
+
return {
|
|
171
|
+
"data-sidebar-inline-start-state": navigationSidebarState,
|
|
172
|
+
"data-sidebar-inline-end-state": complementarySidebarState
|
|
173
|
+
};
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
// packages/plugins/plugin-deck/src/components/DeckLayout/ActiveNode.tsx
|
|
177
|
+
var ActiveNode = () => {
|
|
178
|
+
const [id] = useAttended();
|
|
179
|
+
const { graph } = useAppGraph();
|
|
180
|
+
const activeNode = useNode(graph, id);
|
|
181
|
+
useNodeActionExpander(activeNode);
|
|
182
|
+
return /* @__PURE__ */ React3.createElement("div", {
|
|
183
|
+
role: "none",
|
|
184
|
+
className: "sr-only"
|
|
185
|
+
}, /* @__PURE__ */ React3.createElement(Surface2, {
|
|
186
|
+
role: "document-title",
|
|
187
|
+
data: {
|
|
188
|
+
subject: activeNode
|
|
189
|
+
},
|
|
190
|
+
limit: 1
|
|
191
|
+
}));
|
|
192
|
+
};
|
|
193
|
+
|
|
194
|
+
// packages/plugins/plugin-deck/src/components/DeckLayout/ComplementarySidebar.tsx
|
|
195
|
+
import React8, { useCallback as useCallback2, useEffect as useEffect5, useMemo as useMemo2, useState as useState3, Fragment as Fragment2 } from "react";
|
|
196
|
+
import { createIntent as createIntent2, LayoutAction as LayoutAction2, Surface as Surface4, useAppGraph as useAppGraph3, useCapabilities, useCapability as useCapability2, useIntentDispatcher as useIntentDispatcher2 } from "@dxos/app-framework";
|
|
197
|
+
import { Main, useTranslation as useTranslation5, toLocalizedString as toLocalizedString2, IconButton as IconButton2, ScrollArea as NaturalScrollArea } from "@dxos/react-ui";
|
|
198
|
+
import { useAttended as useAttended2 } from "@dxos/react-ui-attention";
|
|
199
|
+
import { Tabs } from "@dxos/react-ui-tabs";
|
|
200
|
+
import { byPosition } from "@dxos/util";
|
|
201
|
+
|
|
202
|
+
// packages/plugins/plugin-deck/src/components/DeckLayout/PlankError.tsx
|
|
203
|
+
import React7, { useEffect as useEffect4, useState as useState2 } from "react";
|
|
204
|
+
import { useTranslation as useTranslation4 } from "@dxos/react-ui";
|
|
205
|
+
import { descriptionText, mx as mx3 } from "@dxos/react-ui-theme";
|
|
206
|
+
|
|
207
|
+
// packages/plugins/plugin-deck/src/components/DeckLayout/NodePlankHeading.tsx
|
|
208
|
+
import React5, { Fragment, memo, useCallback, useEffect as useEffect3, useMemo } from "react";
|
|
209
|
+
import { createIntent, LayoutAction, Surface as Surface3, useAppGraph as useAppGraph2, useIntentDispatcher } from "@dxos/app-framework";
|
|
210
|
+
import { Icon as Icon2, Popover, toLocalizedString, useTranslation as useTranslation3 } from "@dxos/react-ui";
|
|
211
|
+
import { StackItem } from "@dxos/react-ui-stack";
|
|
212
|
+
import { TextTooltip } from "@dxos/react-ui-text-tooltip";
|
|
213
|
+
|
|
214
|
+
// packages/plugins/plugin-deck/src/components/DeckLayout/PlankControls.tsx
|
|
215
|
+
import React4, { forwardRef } from "react";
|
|
216
|
+
import { Button, ButtonGroup, Icon, Tooltip, useTranslation as useTranslation2 } from "@dxos/react-ui";
|
|
217
|
+
var PlankControl = ({ icon, label, ...props }) => {
|
|
218
|
+
return /* @__PURE__ */ React4.createElement(Tooltip.Root, null, /* @__PURE__ */ React4.createElement(Tooltip.Trigger, {
|
|
219
|
+
asChild: true
|
|
220
|
+
}, /* @__PURE__ */ React4.createElement(Button, {
|
|
221
|
+
variant: "ghost",
|
|
222
|
+
...props
|
|
223
|
+
}, /* @__PURE__ */ React4.createElement("span", {
|
|
224
|
+
className: "sr-only"
|
|
225
|
+
}, label), /* @__PURE__ */ React4.createElement(Icon, {
|
|
226
|
+
icon,
|
|
227
|
+
size: 5
|
|
228
|
+
}))), /* @__PURE__ */ React4.createElement(Tooltip.Portal, null, /* @__PURE__ */ React4.createElement(Tooltip.Content, {
|
|
229
|
+
side: "bottom"
|
|
230
|
+
}, label)));
|
|
231
|
+
};
|
|
232
|
+
var PlankControls = /* @__PURE__ */ forwardRef(({ onClick, variant = "default", capabilities: can, isSolo, pin, close = false, children, classNames, ...props }, forwardedRef) => {
|
|
233
|
+
const { t } = useTranslation2(DECK_PLUGIN);
|
|
234
|
+
const buttonClassNames = variant === "hide-disabled" ? "disabled:hidden pli-2 plb-3" : "pli-2 plb-3";
|
|
235
|
+
return /* @__PURE__ */ React4.createElement(ButtonGroup, {
|
|
236
|
+
...props,
|
|
237
|
+
classNames: [
|
|
238
|
+
"app-no-drag",
|
|
239
|
+
classNames
|
|
240
|
+
],
|
|
241
|
+
ref: forwardedRef
|
|
242
|
+
}, can.solo && /* @__PURE__ */ React4.createElement(PlankControl, {
|
|
243
|
+
label: isSolo ? t("show deck plank label") : t("show solo plank label"),
|
|
244
|
+
classNames: buttonClassNames,
|
|
245
|
+
onClick: () => onClick?.("solo"),
|
|
246
|
+
icon: isSolo ? "ph--corners-in--regular" : "ph--corners-out--regular"
|
|
247
|
+
}), !isSolo && can.solo && /* @__PURE__ */ React4.createElement(React4.Fragment, null, /* @__PURE__ */ React4.createElement(PlankControl, {
|
|
248
|
+
label: t("increment start label"),
|
|
249
|
+
disabled: !can.incrementStart,
|
|
250
|
+
classNames: buttonClassNames,
|
|
251
|
+
onClick: () => onClick?.("increment-start"),
|
|
252
|
+
icon: "ph--caret-left--regular"
|
|
253
|
+
}), /* @__PURE__ */ React4.createElement(PlankControl, {
|
|
254
|
+
label: t("increment end label"),
|
|
255
|
+
disabled: !can.incrementEnd,
|
|
256
|
+
classNames: buttonClassNames,
|
|
257
|
+
onClick: () => onClick?.("increment-end"),
|
|
258
|
+
icon: "ph--caret-right--regular"
|
|
259
|
+
})), close && !isSolo && /* @__PURE__ */ React4.createElement(PlankControl, {
|
|
260
|
+
label: t(`${typeof close === "string" ? "minify" : "close"} label`),
|
|
261
|
+
classNames: buttonClassNames,
|
|
262
|
+
onClick: () => onClick?.("close"),
|
|
263
|
+
"data-testid": "plankHeading.close",
|
|
264
|
+
icon: close === "minify-start" ? "ph--caret-line-left--regular" : close === "minify-end" ? "ph--caret-line-right--regular" : "ph--x--regular"
|
|
265
|
+
}), children);
|
|
266
|
+
});
|
|
267
|
+
|
|
268
|
+
// packages/plugins/plugin-deck/src/components/fragments.ts
|
|
269
|
+
import { mx as mx2 } from "@dxos/react-ui-theme";
|
|
270
|
+
var soloInlinePadding = "pis-[calc(env(safe-area-inset-left)+.25rem)] pie-[calc(env(safe-area-inset-left)+.25rem)]";
|
|
271
|
+
var sidebarToggleStyles = "bs-[--rail-item] is-[--rail-item] absolute block-end-2 z-[1] !bg-deck lg:hidden";
|
|
272
|
+
var fixedSidebarToggleStyles = mx2(sidebarToggleStyles, "inline-start-2");
|
|
273
|
+
var fixedComplementarySidebarToggleStyles = mx2(sidebarToggleStyles, "inline-end-2");
|
|
274
|
+
|
|
275
|
+
// packages/plugins/plugin-deck/src/components/DeckLayout/NodePlankHeading.tsx
|
|
276
|
+
var NodePlankHeading = /* @__PURE__ */ memo(({ id, part, node, canIncrementStart, canIncrementEnd, popoverAnchorId, pending, actions = [] }) => {
|
|
277
|
+
const { t } = useTranslation3(DECK_PLUGIN);
|
|
278
|
+
const { graph } = useAppGraph2();
|
|
279
|
+
const breakpoint = useBreakpoints();
|
|
280
|
+
const icon = node?.properties?.icon ?? "ph--placeholder--regular";
|
|
281
|
+
const label = pending ? t("pending heading") : toLocalizedString(node?.properties?.label ?? [
|
|
282
|
+
"plank heading fallback label",
|
|
283
|
+
{
|
|
284
|
+
ns: DECK_PLUGIN
|
|
285
|
+
}
|
|
286
|
+
], t);
|
|
287
|
+
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
288
|
+
const ActionRoot = node && popoverAnchorId === `dxos.org/ui/${DECK_PLUGIN}/${node.id}` ? Popover.Anchor : Fragment;
|
|
289
|
+
useEffect3(() => {
|
|
290
|
+
const frame = requestAnimationFrame(() => {
|
|
291
|
+
node && graph.actions(node);
|
|
292
|
+
});
|
|
293
|
+
return () => cancelAnimationFrame(frame);
|
|
294
|
+
}, [
|
|
295
|
+
node
|
|
296
|
+
]);
|
|
297
|
+
const attendableId = id.split(SLUG_PATH_SEPARATOR).at(0);
|
|
298
|
+
const capabilities = useMemo(() => ({
|
|
299
|
+
solo: breakpoint !== "mobile" && (part === "solo" || part === "deck"),
|
|
300
|
+
incrementStart: canIncrementStart,
|
|
301
|
+
incrementEnd: canIncrementEnd
|
|
302
|
+
}), [
|
|
303
|
+
breakpoint,
|
|
304
|
+
part,
|
|
305
|
+
canIncrementStart,
|
|
306
|
+
canIncrementEnd
|
|
307
|
+
]);
|
|
308
|
+
const sigilActions = useMemo(() => node && [
|
|
309
|
+
actions,
|
|
310
|
+
graph.actions(node)
|
|
311
|
+
].filter((a) => a.length > 0), [
|
|
312
|
+
actions,
|
|
313
|
+
node,
|
|
314
|
+
graph
|
|
315
|
+
]);
|
|
316
|
+
const handleAction = useCallback((action) => {
|
|
317
|
+
typeof action.data === "function" && action.data?.({
|
|
318
|
+
node: action,
|
|
319
|
+
caller: DECK_PLUGIN
|
|
320
|
+
});
|
|
321
|
+
}, []);
|
|
322
|
+
const handlePlankAction = useCallback((eventType) => {
|
|
323
|
+
if (eventType === "solo") {
|
|
324
|
+
return dispatch(createIntent(DeckAction.Adjust, {
|
|
325
|
+
type: eventType,
|
|
326
|
+
id
|
|
327
|
+
}));
|
|
328
|
+
} else if (eventType === "close") {
|
|
329
|
+
if (part === "complementary") {
|
|
330
|
+
return dispatch(createIntent(LayoutAction.UpdateComplementary, {
|
|
331
|
+
part: "complementary",
|
|
332
|
+
options: {
|
|
333
|
+
state: "collapsed"
|
|
334
|
+
}
|
|
335
|
+
}));
|
|
336
|
+
} else {
|
|
337
|
+
return dispatch(createIntent(LayoutAction.Close, {
|
|
338
|
+
part: "main",
|
|
339
|
+
subject: [
|
|
340
|
+
id
|
|
341
|
+
],
|
|
342
|
+
options: {
|
|
343
|
+
state: false
|
|
344
|
+
}
|
|
345
|
+
}));
|
|
346
|
+
}
|
|
347
|
+
} else {
|
|
348
|
+
return dispatch(createIntent(DeckAction.Adjust, {
|
|
349
|
+
type: eventType,
|
|
350
|
+
id
|
|
351
|
+
}));
|
|
352
|
+
}
|
|
353
|
+
}, [
|
|
354
|
+
dispatch,
|
|
355
|
+
id,
|
|
356
|
+
part
|
|
357
|
+
]);
|
|
358
|
+
return /* @__PURE__ */ React5.createElement(StackItem.Heading, {
|
|
359
|
+
classNames: [
|
|
360
|
+
"plb-1 border-be border-separator items-stretch gap-1 sticky inline-start-12 app-drag",
|
|
361
|
+
part === "solo" ? soloInlinePadding : "pli-1"
|
|
362
|
+
]
|
|
363
|
+
}, /* @__PURE__ */ React5.createElement(ActionRoot, null, node && sigilActions ? /* @__PURE__ */ React5.createElement(StackItem.Sigil, {
|
|
364
|
+
icon,
|
|
365
|
+
related: part === "complementary",
|
|
366
|
+
attendableId,
|
|
367
|
+
triggerLabel: t("actions menu label"),
|
|
368
|
+
actions: sigilActions,
|
|
369
|
+
onAction: handleAction
|
|
370
|
+
}, /* @__PURE__ */ React5.createElement(Surface3, {
|
|
371
|
+
role: "menu-footer",
|
|
372
|
+
data: {
|
|
373
|
+
subject: node.data
|
|
374
|
+
}
|
|
375
|
+
})) : /* @__PURE__ */ React5.createElement(StackItem.SigilButton, null, /* @__PURE__ */ React5.createElement("span", {
|
|
376
|
+
className: "sr-only"
|
|
377
|
+
}, label), /* @__PURE__ */ React5.createElement(Icon2, {
|
|
378
|
+
icon,
|
|
379
|
+
size: 5
|
|
380
|
+
}))), /* @__PURE__ */ React5.createElement(TextTooltip, {
|
|
381
|
+
text: label,
|
|
382
|
+
onlyWhenTruncating: true
|
|
383
|
+
}, /* @__PURE__ */ React5.createElement(StackItem.HeadingLabel, {
|
|
384
|
+
attendableId,
|
|
385
|
+
related: part === "complementary",
|
|
386
|
+
...pending && {
|
|
387
|
+
classNames: "text-description"
|
|
388
|
+
}
|
|
389
|
+
}, label)), node && part !== "complementary" && /* @__PURE__ */ React5.createElement(Surface3, {
|
|
390
|
+
role: "navbar-end",
|
|
391
|
+
data: {
|
|
392
|
+
subject: node.data
|
|
393
|
+
}
|
|
394
|
+
}), /* @__PURE__ */ React5.createElement(PlankControls, {
|
|
395
|
+
capabilities,
|
|
396
|
+
isSolo: part === "solo",
|
|
397
|
+
onClick: handlePlankAction,
|
|
398
|
+
close: part === "complementary" ? "minify-end" : true
|
|
399
|
+
}));
|
|
400
|
+
});
|
|
401
|
+
|
|
402
|
+
// packages/plugins/plugin-deck/src/components/DeckLayout/PlankLoading.tsx
|
|
403
|
+
import React6 from "react";
|
|
404
|
+
var PlankLoading = () => {
|
|
405
|
+
return /* @__PURE__ */ React6.createElement("div", {
|
|
406
|
+
role: "none",
|
|
407
|
+
className: "grid place-items-center attention-surface"
|
|
408
|
+
});
|
|
409
|
+
};
|
|
410
|
+
|
|
411
|
+
// packages/plugins/plugin-deck/src/components/DeckLayout/PlankError.tsx
|
|
412
|
+
var PlankContentError = ({ error }) => {
|
|
413
|
+
const { t } = useTranslation4(DECK_PLUGIN);
|
|
414
|
+
const errorString = error?.toString() ?? "";
|
|
415
|
+
return /* @__PURE__ */ React7.createElement("div", {
|
|
416
|
+
role: "none",
|
|
417
|
+
className: "overflow-auto p-8 attention-surface grid place-items-center"
|
|
418
|
+
}, /* @__PURE__ */ React7.createElement("p", {
|
|
419
|
+
role: "alert",
|
|
420
|
+
className: mx3(descriptionText, "break-words border border-dashed border-separator rounded-lg p-8", errorString.length < 256 && "text-lg")
|
|
421
|
+
}, error ? errorString : t("error fallback message")));
|
|
422
|
+
};
|
|
423
|
+
var PlankError = ({ id, part, node, error }) => {
|
|
424
|
+
const [timedOut, setTimedOut] = useState2(false);
|
|
425
|
+
useEffect4(() => {
|
|
426
|
+
setTimeout(() => setTimedOut(true), 5e3);
|
|
427
|
+
}, []);
|
|
428
|
+
return /* @__PURE__ */ React7.createElement(React7.Fragment, null, /* @__PURE__ */ React7.createElement(NodePlankHeading, {
|
|
429
|
+
id,
|
|
430
|
+
part,
|
|
431
|
+
node,
|
|
432
|
+
pending: !timedOut
|
|
433
|
+
}), timedOut ? /* @__PURE__ */ React7.createElement(PlankContentError, {
|
|
434
|
+
error
|
|
435
|
+
}) : /* @__PURE__ */ React7.createElement(PlankLoading, null));
|
|
436
|
+
};
|
|
437
|
+
|
|
438
|
+
// packages/plugins/plugin-deck/src/components/DeckLayout/ComplementarySidebar.tsx
|
|
439
|
+
var ComplementarySidebar = ({ current }) => {
|
|
440
|
+
const { t } = useTranslation5(DECK_PLUGIN);
|
|
441
|
+
const { dispatchPromise: dispatch } = useIntentDispatcher2();
|
|
442
|
+
const layout = useCapability2(DeckCapabilities.MutableDeckState);
|
|
443
|
+
const attended = useAttended2();
|
|
444
|
+
const { graph } = useAppGraph3();
|
|
445
|
+
const node = useNode(graph, attended[0]);
|
|
446
|
+
const breakpoint = useBreakpoints();
|
|
447
|
+
const topbar = layoutAppliesTopbar(breakpoint);
|
|
448
|
+
const hoistStatusbar = useHoistStatusbar(breakpoint);
|
|
449
|
+
const panels = useCapabilities(DeckCapabilities.ComplementaryPanel);
|
|
450
|
+
const availablePanels = panels.filter((panel) => {
|
|
451
|
+
if (!node || !panel.filter) {
|
|
452
|
+
return true;
|
|
453
|
+
}
|
|
454
|
+
return panel.filter(node);
|
|
455
|
+
}).toSorted(byPosition);
|
|
456
|
+
const activePanelId = availablePanels.find((panel) => panel.id === current)?.id ?? availablePanels[0]?.id;
|
|
457
|
+
const [internalValue, setInternalValue] = useState3(activePanelId);
|
|
458
|
+
useEffect5(() => {
|
|
459
|
+
setInternalValue(activePanelId);
|
|
460
|
+
}, [
|
|
461
|
+
activePanelId
|
|
462
|
+
]);
|
|
463
|
+
const handleTabClick = useCallback2((event) => {
|
|
464
|
+
const nextValue = event.currentTarget.getAttribute("data-value");
|
|
465
|
+
if (nextValue === activePanelId) {
|
|
466
|
+
layout.complementarySidebarState = layout.complementarySidebarState === "expanded" ? "collapsed" : "expanded";
|
|
467
|
+
} else {
|
|
468
|
+
setInternalValue(nextValue);
|
|
469
|
+
layout.complementarySidebarState = "expanded";
|
|
470
|
+
void dispatch(createIntent2(LayoutAction2.UpdateComplementary, {
|
|
471
|
+
part: "complementary",
|
|
472
|
+
subject: nextValue
|
|
473
|
+
}));
|
|
474
|
+
}
|
|
475
|
+
}, [
|
|
476
|
+
layout,
|
|
477
|
+
activePanelId,
|
|
478
|
+
dispatch
|
|
479
|
+
]);
|
|
480
|
+
const data = useMemo2(() => node && {
|
|
481
|
+
id: node.id,
|
|
482
|
+
subject: node.data,
|
|
483
|
+
workspace: layout.activeDeck,
|
|
484
|
+
popoverAnchorId: layout.popoverAnchorId
|
|
485
|
+
}, [
|
|
486
|
+
node,
|
|
487
|
+
layout.popoverAnchorId
|
|
488
|
+
]);
|
|
489
|
+
return /* @__PURE__ */ React8.createElement(Main.ComplementarySidebar, {
|
|
490
|
+
classNames: [
|
|
491
|
+
topbar && "block-start-[calc(env(safe-area-inset-top)+var(--rail-size))]",
|
|
492
|
+
hoistStatusbar && "block-end-[--statusbar-size]"
|
|
493
|
+
]
|
|
494
|
+
}, /* @__PURE__ */ React8.createElement(Tabs.Root, {
|
|
495
|
+
orientation: "vertical",
|
|
496
|
+
verticalVariant: "stateless",
|
|
497
|
+
value: internalValue,
|
|
498
|
+
attendableId: attended[0],
|
|
499
|
+
classNames: "contents"
|
|
500
|
+
}, /* @__PURE__ */ React8.createElement("div", {
|
|
501
|
+
role: "none",
|
|
502
|
+
className: "absolute z-[1] inset-block-0 inline-end-0 !is-[--r0-size] pbs-[env(safe-area-inset-top)] pbe-[env(safe-area-inset-bottom)] border-is border-separator grid grid-cols-1 grid-rows-[1fr_min-content] bg-baseSurface contain-layout app-drag"
|
|
503
|
+
}, /* @__PURE__ */ React8.createElement(Tabs.Tablist, {
|
|
504
|
+
classNames: "grid grid-cols-1 auto-rows-[--rail-action] p-1 gap-1 !overflow-y-auto"
|
|
505
|
+
}, availablePanels.map((panel) => /* @__PURE__ */ React8.createElement(Tabs.Tab, {
|
|
506
|
+
key: panel.id,
|
|
507
|
+
value: panel.id,
|
|
508
|
+
asChild: true
|
|
509
|
+
}, /* @__PURE__ */ React8.createElement(IconButton2, {
|
|
510
|
+
label: toLocalizedString2(panel.label, t),
|
|
511
|
+
icon: panel.icon,
|
|
512
|
+
size: 5,
|
|
513
|
+
iconOnly: true,
|
|
514
|
+
tooltipSide: "left",
|
|
515
|
+
"data-value": panel.id,
|
|
516
|
+
variant: activePanelId === panel.id ? layout.complementarySidebarState === "expanded" ? "primary" : "default" : "ghost",
|
|
517
|
+
onClick: handleTabClick
|
|
518
|
+
})))), !hoistStatusbar && /* @__PURE__ */ React8.createElement("div", {
|
|
519
|
+
role: "none",
|
|
520
|
+
className: "grid grid-cols-1 auto-rows-[--rail-item] p-1 overflow-y-auto"
|
|
521
|
+
}, /* @__PURE__ */ React8.createElement(Surface4, {
|
|
522
|
+
role: "status-bar--r0-footer",
|
|
523
|
+
limit: 1
|
|
524
|
+
})), /* @__PURE__ */ React8.createElement("div", {
|
|
525
|
+
role: "none",
|
|
526
|
+
className: "hidden lg:grid grid-cols-1 auto-rows-[--rail-action] p-1"
|
|
527
|
+
}, /* @__PURE__ */ React8.createElement(ToggleComplementarySidebarButton, null))), availablePanels.map((panel) => /* @__PURE__ */ React8.createElement(Tabs.Tabpanel, {
|
|
528
|
+
key: panel.id,
|
|
529
|
+
value: panel.id,
|
|
530
|
+
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)]',
|
|
531
|
+
...layout.complementarySidebarState !== "expanded" && {
|
|
532
|
+
inert: "true"
|
|
533
|
+
}
|
|
534
|
+
}, /* @__PURE__ */ React8.createElement(ComplementarySidebarPanel, {
|
|
535
|
+
panel,
|
|
536
|
+
activePanelId,
|
|
537
|
+
data,
|
|
538
|
+
hoistStatusbar
|
|
539
|
+
})))));
|
|
540
|
+
};
|
|
541
|
+
var ScrollArea = ({ children }) => {
|
|
542
|
+
return /* @__PURE__ */ React8.createElement(NaturalScrollArea.Root, null, /* @__PURE__ */ React8.createElement(NaturalScrollArea.Viewport, null, children), /* @__PURE__ */ React8.createElement(NaturalScrollArea.Scrollbar, {
|
|
543
|
+
orientation: "vertical"
|
|
544
|
+
}, /* @__PURE__ */ React8.createElement(NaturalScrollArea.Thumb, null)));
|
|
545
|
+
};
|
|
546
|
+
var ComplementarySidebarPanel = ({ panel, activePanelId, data, hoistStatusbar }) => {
|
|
547
|
+
const { t } = useTranslation5(DECK_PLUGIN);
|
|
548
|
+
if (panel.id !== activePanelId || !data) {
|
|
549
|
+
return null;
|
|
550
|
+
}
|
|
551
|
+
const Wrapper = panel.fixed ? Fragment2 : ScrollArea;
|
|
552
|
+
return /* @__PURE__ */ React8.createElement(React8.Fragment, null, /* @__PURE__ */ React8.createElement("h2", {
|
|
553
|
+
className: "flex items-center pli-2 border-separator border-be font-medium"
|
|
554
|
+
}, toLocalizedString2(panel.label, t)), /* @__PURE__ */ React8.createElement(Wrapper, null, /* @__PURE__ */ React8.createElement(Surface4, {
|
|
555
|
+
role: `complementary--${activePanelId}`,
|
|
556
|
+
data,
|
|
557
|
+
fallback: PlankContentError,
|
|
558
|
+
placeholder: /* @__PURE__ */ React8.createElement(PlankLoading, null)
|
|
559
|
+
})), !hoistStatusbar && /* @__PURE__ */ React8.createElement("div", {
|
|
560
|
+
role: "contentinfo",
|
|
561
|
+
className: "flex flex-wrap justify-center items-center border-bs border-separator pbs-1 pbe-[max(env(safe-area-inset-bottom),0.25rem)]"
|
|
562
|
+
}, /* @__PURE__ */ React8.createElement(Surface4, {
|
|
563
|
+
role: "status-bar--r1-footer",
|
|
564
|
+
limit: 1
|
|
565
|
+
})));
|
|
566
|
+
};
|
|
567
|
+
|
|
568
|
+
// packages/plugins/plugin-deck/src/components/DeckLayout/ContentEmpty.tsx
|
|
569
|
+
import React9 from "react";
|
|
570
|
+
import { Surface as Surface5 } from "@dxos/app-framework";
|
|
571
|
+
var ContentEmpty = () => {
|
|
572
|
+
const breakpoint = useBreakpoints();
|
|
573
|
+
const topbar = layoutAppliesTopbar(breakpoint);
|
|
574
|
+
return /* @__PURE__ */ React9.createElement("div", {
|
|
575
|
+
role: "none",
|
|
576
|
+
className: "grid place-items-center p-8 relative bg-deck",
|
|
577
|
+
"data-testid": "layoutPlugin.firstRunMessage"
|
|
578
|
+
}, /* @__PURE__ */ React9.createElement(Surface5, {
|
|
579
|
+
role: "keyshortcuts"
|
|
580
|
+
}), !topbar && /* @__PURE__ */ React9.createElement(ToggleSidebarButton, {
|
|
581
|
+
variant: "default",
|
|
582
|
+
classNames: fixedSidebarToggleStyles
|
|
583
|
+
}));
|
|
584
|
+
};
|
|
585
|
+
|
|
586
|
+
// packages/plugins/plugin-deck/src/components/DeckLayout/Fullscreen.tsx
|
|
587
|
+
import React11 from "react";
|
|
588
|
+
import { Surface as Surface6, useAppGraph as useAppGraph4 } from "@dxos/app-framework";
|
|
589
|
+
import { fixedInsetFlexLayout } from "@dxos/react-ui-theme";
|
|
590
|
+
|
|
591
|
+
// packages/plugins/plugin-deck/src/components/DeckLayout/Fallback.tsx
|
|
592
|
+
import React10 from "react";
|
|
593
|
+
import { useTranslation as useTranslation6 } from "@dxos/react-ui";
|
|
594
|
+
import { errorText, mx as mx4 } from "@dxos/react-ui-theme";
|
|
595
|
+
var Fallback = () => {
|
|
596
|
+
const { t } = useTranslation6(DECK_PLUGIN);
|
|
597
|
+
return /* @__PURE__ */ React10.createElement("div", {
|
|
598
|
+
role: "none",
|
|
599
|
+
className: "min-bs-screen is-full flex items-center justify-center p-8"
|
|
600
|
+
}, /* @__PURE__ */ React10.createElement("p", {
|
|
601
|
+
role: "alert",
|
|
602
|
+
className: mx4(errorText, "border border-error-400/50 rounded-lg flex items-center justify-center p-8 font-normal text-lg")
|
|
603
|
+
}, t("plugin error message")));
|
|
604
|
+
};
|
|
605
|
+
|
|
606
|
+
// packages/plugins/plugin-deck/src/components/DeckLayout/constants.ts
|
|
607
|
+
var SURFACE_PREFIX = "surface:";
|
|
608
|
+
|
|
609
|
+
// packages/plugins/plugin-deck/src/components/DeckLayout/Fullscreen.tsx
|
|
610
|
+
var Fullscreen = ({ id }) => {
|
|
611
|
+
const { graph } = useAppGraph4();
|
|
612
|
+
const fullScreenNode = useNode(graph, id);
|
|
613
|
+
return /* @__PURE__ */ React11.createElement("div", {
|
|
614
|
+
role: "none",
|
|
615
|
+
className: fixedInsetFlexLayout
|
|
616
|
+
}, /* @__PURE__ */ React11.createElement(Surface6, {
|
|
617
|
+
role: "main",
|
|
618
|
+
limit: 1,
|
|
619
|
+
fallback: Fallback,
|
|
620
|
+
data: {
|
|
621
|
+
subject: fullScreenNode?.data,
|
|
622
|
+
component: id?.startsWith(SURFACE_PREFIX) ? id.slice(SURFACE_PREFIX.length) : void 0
|
|
623
|
+
}
|
|
624
|
+
}));
|
|
625
|
+
};
|
|
626
|
+
|
|
627
|
+
// packages/plugins/plugin-deck/src/components/DeckLayout/Plank.tsx
|
|
628
|
+
import React12, { memo as memo2, useCallback as useCallback3, useLayoutEffect, useMemo as useMemo3, useRef } from "react";
|
|
629
|
+
import { createIntent as createIntent3, LayoutAction as LayoutAction3, Surface as Surface7, useCapability as useCapability3, useAppGraph as useAppGraph5, useIntentDispatcher as useIntentDispatcher3 } from "@dxos/app-framework";
|
|
630
|
+
import { debounce } from "@dxos/async";
|
|
631
|
+
import { useAttendableAttributes } from "@dxos/react-ui-attention";
|
|
632
|
+
import { StackItem as StackItem2, railGridHorizontal } from "@dxos/react-ui-stack";
|
|
633
|
+
import { mainIntrinsicSize, mx as mx5 } from "@dxos/react-ui-theme";
|
|
634
|
+
var UNKNOWN_ID = "unknown_id";
|
|
635
|
+
var Plank = /* @__PURE__ */ memo2(({ id = UNKNOWN_ID, part, path, order, active, layoutMode }) => {
|
|
636
|
+
const { dispatchPromise: dispatch } = useIntentDispatcher3();
|
|
637
|
+
const { deck, popoverAnchorId, scrollIntoView } = useCapability3(DeckCapabilities.DeckState);
|
|
638
|
+
const { graph } = useAppGraph5();
|
|
639
|
+
const node = useNode(graph, id);
|
|
640
|
+
const rootElement = useRef(null);
|
|
641
|
+
const canResize = layoutMode === "deck";
|
|
642
|
+
const Root = part === "solo" ? "article" : StackItem2.Root;
|
|
643
|
+
const attendableAttrs = useAttendableAttributes(id);
|
|
644
|
+
const index = active ? active.findIndex((entryId) => entryId === id) : 0;
|
|
645
|
+
const length = active?.length ?? 1;
|
|
646
|
+
const canIncrementStart = active && index !== void 0 && index > 0 && length !== void 0 && length > 1;
|
|
647
|
+
const canIncrementEnd = active && index !== void 0 && index < length - 1 && length !== void 0;
|
|
648
|
+
const key = id.split("+")[0];
|
|
649
|
+
const size = deck.plankSizing[key];
|
|
650
|
+
const setSize = useCallback3(debounce((nextSize) => {
|
|
651
|
+
return dispatch(createIntent3(DeckAction.UpdatePlankSize, {
|
|
652
|
+
id: key,
|
|
653
|
+
size: nextSize
|
|
654
|
+
}));
|
|
655
|
+
}, 200), [
|
|
656
|
+
dispatch,
|
|
657
|
+
key
|
|
658
|
+
]);
|
|
659
|
+
const handleKeyDown = useCallback3((event) => {
|
|
660
|
+
if (event.target === event.currentTarget && event.key === "Escape") {
|
|
661
|
+
rootElement.current?.closest("main")?.focus();
|
|
662
|
+
}
|
|
663
|
+
}, []);
|
|
664
|
+
useLayoutEffect(() => {
|
|
665
|
+
if (scrollIntoView === id) {
|
|
666
|
+
const focusable = rootElement.current?.querySelector("button") || rootElement.current;
|
|
667
|
+
focusable?.focus({
|
|
668
|
+
preventScroll: true
|
|
669
|
+
});
|
|
670
|
+
layoutMode === "deck" && focusable?.scrollIntoView({
|
|
671
|
+
behavior: "smooth",
|
|
672
|
+
inline: "center"
|
|
673
|
+
});
|
|
674
|
+
void dispatch(createIntent3(LayoutAction3.ScrollIntoView, {
|
|
675
|
+
part: "current",
|
|
676
|
+
subject: void 0
|
|
677
|
+
}));
|
|
678
|
+
}
|
|
679
|
+
}, [
|
|
680
|
+
id,
|
|
681
|
+
scrollIntoView,
|
|
682
|
+
layoutMode
|
|
683
|
+
]);
|
|
684
|
+
const isSolo = layoutMode === "solo" && part === "solo";
|
|
685
|
+
const isAttendable = isSolo || layoutMode === "deck" && part === "deck";
|
|
686
|
+
const sizeAttrs = useMainSize();
|
|
687
|
+
const data = useMemo3(() => node && {
|
|
688
|
+
subject: node.data,
|
|
689
|
+
path,
|
|
690
|
+
popoverAnchorId
|
|
691
|
+
}, [
|
|
692
|
+
node,
|
|
693
|
+
node?.data,
|
|
694
|
+
path,
|
|
695
|
+
popoverAnchorId
|
|
696
|
+
]);
|
|
697
|
+
const placeholder = useMemo3(() => /* @__PURE__ */ React12.createElement(PlankLoading, null), []);
|
|
698
|
+
const className = mx5("attention-surface relative", isSolo && mainIntrinsicSize, isSolo && railGridHorizontal, isSolo ? "grid absolute inset-0" : "!border-separator border-li");
|
|
699
|
+
return /* @__PURE__ */ React12.createElement(Root, {
|
|
700
|
+
ref: rootElement,
|
|
701
|
+
"data-testid": "deck.plank",
|
|
702
|
+
tabIndex: 0,
|
|
703
|
+
...part === "solo" ? {
|
|
704
|
+
...sizeAttrs,
|
|
705
|
+
className
|
|
706
|
+
} : {
|
|
707
|
+
item: {
|
|
708
|
+
id
|
|
709
|
+
},
|
|
710
|
+
size,
|
|
711
|
+
onSizeChange: setSize,
|
|
712
|
+
classNames: className,
|
|
713
|
+
order,
|
|
714
|
+
role: "article"
|
|
715
|
+
},
|
|
716
|
+
...isAttendable ? attendableAttrs : {},
|
|
717
|
+
onKeyDown: handleKeyDown
|
|
718
|
+
}, node ? /* @__PURE__ */ React12.createElement(React12.Fragment, null, /* @__PURE__ */ React12.createElement(NodePlankHeading, {
|
|
719
|
+
id,
|
|
720
|
+
part,
|
|
721
|
+
node,
|
|
722
|
+
canIncrementStart,
|
|
723
|
+
canIncrementEnd,
|
|
724
|
+
popoverAnchorId
|
|
725
|
+
}), /* @__PURE__ */ React12.createElement(Surface7, {
|
|
726
|
+
key: node.id,
|
|
727
|
+
role: "article",
|
|
728
|
+
data,
|
|
729
|
+
limit: 1,
|
|
730
|
+
fallback: PlankContentError,
|
|
731
|
+
placeholder
|
|
732
|
+
})) : /* @__PURE__ */ React12.createElement(PlankError, {
|
|
733
|
+
id,
|
|
734
|
+
part
|
|
735
|
+
}), canResize && /* @__PURE__ */ React12.createElement(StackItem2.ResizeHandle, null));
|
|
736
|
+
});
|
|
737
|
+
|
|
738
|
+
// packages/plugins/plugin-deck/src/components/DeckLayout/Sidebar.tsx
|
|
739
|
+
import React13, { useMemo as useMemo4 } from "react";
|
|
740
|
+
import { Surface as Surface8, useCapability as useCapability4 } from "@dxos/app-framework";
|
|
741
|
+
import { Main as Main2 } from "@dxos/react-ui";
|
|
742
|
+
var Sidebar = () => {
|
|
743
|
+
const { popoverAnchorId, activeDeck: current } = useCapability4(DeckCapabilities.DeckState);
|
|
744
|
+
const breakpoint = useBreakpoints();
|
|
745
|
+
const topbar = layoutAppliesTopbar(breakpoint);
|
|
746
|
+
const hoistStatusbar = useHoistStatusbar(breakpoint);
|
|
747
|
+
const navigationData = useMemo4(() => ({
|
|
748
|
+
popoverAnchorId,
|
|
749
|
+
topbar,
|
|
750
|
+
hoistStatusbar,
|
|
751
|
+
current
|
|
752
|
+
}), [
|
|
753
|
+
popoverAnchorId,
|
|
754
|
+
topbar,
|
|
755
|
+
hoistStatusbar,
|
|
756
|
+
current
|
|
757
|
+
]);
|
|
758
|
+
return /* @__PURE__ */ React13.createElement(Main2.NavigationSidebar, {
|
|
759
|
+
classNames: [
|
|
760
|
+
"grid",
|
|
761
|
+
topbar && "block-start-[calc(env(safe-area-inset-top)+var(--rail-size))]",
|
|
762
|
+
hoistStatusbar && "block-end-[--statusbar-size]"
|
|
763
|
+
]
|
|
764
|
+
}, /* @__PURE__ */ React13.createElement(Surface8, {
|
|
765
|
+
role: "navigation",
|
|
766
|
+
data: navigationData,
|
|
767
|
+
limit: 1
|
|
768
|
+
}));
|
|
769
|
+
};
|
|
770
|
+
|
|
771
|
+
// packages/plugins/plugin-deck/src/components/DeckLayout/StatusBar.tsx
|
|
772
|
+
import React14 from "react";
|
|
773
|
+
import { Surface as Surface9 } from "@dxos/app-framework";
|
|
774
|
+
import { useLandmarkMover } from "@dxos/react-ui";
|
|
775
|
+
var StatusBar = ({ showHints }) => {
|
|
776
|
+
const mover = useLandmarkMover(void 0, "3");
|
|
777
|
+
return /* @__PURE__ */ React14.createElement("div", {
|
|
778
|
+
role: "contentinfo",
|
|
779
|
+
className: "fixed block-end-0 inset-inline-0 bs-[--statusbar-size] border-bs border-separator z-[2] flex text-description",
|
|
780
|
+
...mover
|
|
781
|
+
}, showHints && /* @__PURE__ */ React14.createElement(Surface9, {
|
|
782
|
+
role: "hints",
|
|
783
|
+
limit: 1
|
|
784
|
+
}), /* @__PURE__ */ React14.createElement(Surface9, {
|
|
785
|
+
role: "status-bar",
|
|
786
|
+
limit: 1
|
|
787
|
+
}));
|
|
788
|
+
};
|
|
789
|
+
|
|
790
|
+
// packages/plugins/plugin-deck/src/components/DeckLayout/Toast.tsx
|
|
791
|
+
import React15 from "react";
|
|
792
|
+
import { Button as Button2, Icon as Icon3, Toast as NaturalToast, toLocalizedString as toLocalizedString3, useTranslation as useTranslation7 } from "@dxos/react-ui";
|
|
793
|
+
var Toast = ({ id, title, description, icon, duration, actionLabel, actionAlt, closeLabel, onAction, onOpenChange }) => {
|
|
794
|
+
const { t } = useTranslation7(DECK_PLUGIN);
|
|
795
|
+
return /* @__PURE__ */ React15.createElement(NaturalToast.Root, {
|
|
796
|
+
"data-testid": id,
|
|
797
|
+
defaultOpen: true,
|
|
798
|
+
duration,
|
|
799
|
+
onOpenChange
|
|
800
|
+
}, /* @__PURE__ */ React15.createElement(NaturalToast.Body, null, /* @__PURE__ */ React15.createElement(NaturalToast.Title, {
|
|
801
|
+
classNames: "items-center"
|
|
802
|
+
}, icon && /* @__PURE__ */ React15.createElement(Icon3, {
|
|
803
|
+
icon,
|
|
804
|
+
size: 5,
|
|
805
|
+
classNames: "inline mr-1"
|
|
806
|
+
}), 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, {
|
|
807
|
+
altText: toLocalizedString3(actionAlt, t),
|
|
808
|
+
asChild: true
|
|
809
|
+
}, /* @__PURE__ */ React15.createElement(Button2, {
|
|
810
|
+
"data-testid": "toast.action",
|
|
811
|
+
variant: "primary",
|
|
812
|
+
onClick: () => onAction?.()
|
|
813
|
+
}, toLocalizedString3(actionLabel, t))), closeLabel && /* @__PURE__ */ React15.createElement(NaturalToast.Close, {
|
|
814
|
+
asChild: true
|
|
815
|
+
}, /* @__PURE__ */ React15.createElement(Button2, {
|
|
816
|
+
"data-testid": "toast.close"
|
|
817
|
+
}, toLocalizedString3(closeLabel, t)))));
|
|
818
|
+
};
|
|
819
|
+
|
|
820
|
+
// packages/plugins/plugin-deck/src/components/DeckLayout/Topbar.tsx
|
|
821
|
+
import React16 from "react";
|
|
822
|
+
var Topbar = () => {
|
|
823
|
+
return /* @__PURE__ */ React16.createElement(Banner, {
|
|
824
|
+
variant: "topbar"
|
|
825
|
+
});
|
|
826
|
+
};
|
|
827
|
+
|
|
828
|
+
// packages/plugins/plugin-deck/src/components/DeckLayout/DeckLayout.tsx
|
|
829
|
+
var PlankSeparator = ({ index }) => index > 0 ? /* @__PURE__ */ React17.createElement("span", {
|
|
830
|
+
role: "separator",
|
|
831
|
+
className: "row-span-2 bg-deck is-4",
|
|
832
|
+
style: {
|
|
833
|
+
gridColumn: index * 2
|
|
834
|
+
}
|
|
835
|
+
}) : null;
|
|
836
|
+
var DeckLayout = ({ overscroll, showHints, onDismissToast }) => {
|
|
837
|
+
const { dispatchPromise: dispatch } = useIntentDispatcher4();
|
|
838
|
+
const context = useCapability5(DeckCapabilities.MutableDeckState);
|
|
839
|
+
const { sidebarState, complementarySidebarState, complementarySidebarPanel, dialogOpen, dialogContent, dialogBlockAlign, dialogType, popoverOpen, popoverContent, popoverAnchorId, deck, toasts } = context;
|
|
840
|
+
const { active, fullscreen, solo, plankSizing } = deck;
|
|
841
|
+
const breakpoint = useBreakpoints();
|
|
842
|
+
const topbar = layoutAppliesTopbar(breakpoint);
|
|
843
|
+
const hoistStatusbar = useHoistStatusbar(breakpoint);
|
|
844
|
+
const pluginManager = usePluginManager();
|
|
845
|
+
const scrollLeftRef = useRef2();
|
|
846
|
+
const deckRef = useRef2(null);
|
|
847
|
+
const [delayedPopoverVisibility, setDelayedPopoverVisibility] = useState4(false);
|
|
848
|
+
useEffect6(() => {
|
|
849
|
+
popoverOpen ? setTimeout(() => setDelayedPopoverVisibility(true), 40) : setDelayedPopoverVisibility(false);
|
|
850
|
+
}, [
|
|
851
|
+
popoverOpen
|
|
852
|
+
]);
|
|
853
|
+
useEffect6(() => {
|
|
854
|
+
const attended = untracked(() => {
|
|
855
|
+
const attention = pluginManager.context.requestCapability(AttentionCapabilities.Attention);
|
|
856
|
+
return attention.current;
|
|
857
|
+
});
|
|
858
|
+
const firstId = solo ?? active[0];
|
|
859
|
+
if (attended.length === 0 && firstId) {
|
|
860
|
+
document.querySelector(`article[data-attendable-id="${firstId}"] button`)?.focus();
|
|
861
|
+
}
|
|
862
|
+
}, []);
|
|
863
|
+
const [isNotMobile] = useMediaQuery("md", {
|
|
864
|
+
ssr: false
|
|
865
|
+
});
|
|
866
|
+
const shouldRevert = useRef2(false);
|
|
867
|
+
useEffect6(() => {
|
|
868
|
+
if (!isNotMobile && getMode(deck) === "deck") {
|
|
869
|
+
const attended = untracked(() => {
|
|
870
|
+
const attention = pluginManager.context.requestCapability(AttentionCapabilities.Attention);
|
|
871
|
+
return attention.current;
|
|
872
|
+
});
|
|
873
|
+
shouldRevert.current = true;
|
|
874
|
+
void dispatch(createIntent4(LayoutAction4.SetLayoutMode, {
|
|
875
|
+
part: "mode",
|
|
876
|
+
subject: attended[0],
|
|
877
|
+
options: {
|
|
878
|
+
mode: "solo"
|
|
879
|
+
}
|
|
880
|
+
}));
|
|
881
|
+
} else if (isNotMobile && getMode(deck) === "solo" && shouldRevert.current) {
|
|
882
|
+
void dispatch(createIntent4(LayoutAction4.SetLayoutMode, {
|
|
883
|
+
part: "mode",
|
|
884
|
+
options: {
|
|
885
|
+
revert: true
|
|
886
|
+
}
|
|
887
|
+
}));
|
|
888
|
+
}
|
|
889
|
+
}, [
|
|
890
|
+
isNotMobile,
|
|
891
|
+
deck,
|
|
892
|
+
dispatch
|
|
893
|
+
]);
|
|
894
|
+
const handleResize = useCallback4(() => {
|
|
895
|
+
scrollLeftRef.current = null;
|
|
896
|
+
}, []);
|
|
897
|
+
useEffect6(() => {
|
|
898
|
+
window.addEventListener("resize", handleResize);
|
|
899
|
+
return () => window.removeEventListener("resize", handleResize);
|
|
900
|
+
}, [
|
|
901
|
+
handleResize
|
|
902
|
+
]);
|
|
903
|
+
const restoreScroll = useCallback4(() => {
|
|
904
|
+
if (deckRef.current && scrollLeftRef.current != null) {
|
|
905
|
+
deckRef.current.scrollLeft = scrollLeftRef.current;
|
|
906
|
+
}
|
|
907
|
+
}, []);
|
|
908
|
+
const layoutMode = getMode(deck);
|
|
909
|
+
useOnTransition(layoutMode, (mode) => mode !== "deck", "deck", restoreScroll);
|
|
910
|
+
const handleScroll = useCallback4((event) => {
|
|
911
|
+
if (!solo && event.currentTarget === event.target) {
|
|
912
|
+
scrollLeftRef.current = event.target.scrollLeft;
|
|
913
|
+
}
|
|
914
|
+
}, [
|
|
915
|
+
solo
|
|
916
|
+
]);
|
|
917
|
+
const isEmpty = !solo && active.length === 0;
|
|
918
|
+
const padding = useMemo5(() => {
|
|
919
|
+
if (!solo && overscroll === "centering") {
|
|
920
|
+
return calculateOverscroll(active.length);
|
|
921
|
+
}
|
|
922
|
+
return {};
|
|
923
|
+
}, [
|
|
924
|
+
solo,
|
|
925
|
+
overscroll,
|
|
926
|
+
deck
|
|
927
|
+
]);
|
|
928
|
+
const mainPosition = useMemo5(() => [
|
|
929
|
+
"grid !block-start-[env(safe-area-inset-top)]",
|
|
930
|
+
topbar && "!block-start-[calc(env(safe-area-inset-top)+var(--rail-size))]",
|
|
931
|
+
hoistStatusbar && "lg:block-end-[--statusbar-size]"
|
|
932
|
+
], [
|
|
933
|
+
topbar,
|
|
934
|
+
hoistStatusbar
|
|
935
|
+
]);
|
|
936
|
+
const Dialog = dialogType === "alert" ? AlertDialog : NaturalDialog;
|
|
937
|
+
const handlePopoverOpenChange = useCallback4((nextOpen) => {
|
|
938
|
+
if (nextOpen && popoverAnchorId) {
|
|
939
|
+
context.popoverOpen = true;
|
|
940
|
+
} else {
|
|
941
|
+
context.popoverOpen = false;
|
|
942
|
+
context.popoverAnchorId = void 0;
|
|
943
|
+
context.popoverSide = void 0;
|
|
944
|
+
}
|
|
945
|
+
}, [
|
|
946
|
+
context
|
|
947
|
+
]);
|
|
948
|
+
const handlePopoverClose = useCallback4(() => handlePopoverOpenChange(false), [
|
|
949
|
+
handlePopoverOpenChange
|
|
950
|
+
]);
|
|
951
|
+
return /* @__PURE__ */ React17.createElement(Popover2.Root, {
|
|
952
|
+
modal: true,
|
|
953
|
+
open: !!(popoverAnchorId && delayedPopoverVisibility),
|
|
954
|
+
onOpenChange: handlePopoverOpenChange
|
|
955
|
+
}, /* @__PURE__ */ React17.createElement(ActiveNode, null), fullscreen && /* @__PURE__ */ React17.createElement(Fullscreen, {
|
|
956
|
+
id: solo
|
|
957
|
+
}), !fullscreen && /* @__PURE__ */ React17.createElement(Main3.Root, {
|
|
958
|
+
navigationSidebarState: context.sidebarState,
|
|
959
|
+
onNavigationSidebarStateChange: (next) => context.sidebarState = next,
|
|
960
|
+
complementarySidebarState: context.complementarySidebarState,
|
|
961
|
+
onComplementarySidebarStateChange: (next) => context.complementarySidebarState = next
|
|
962
|
+
}, /* @__PURE__ */ React17.createElement(Sidebar, null), /* @__PURE__ */ React17.createElement(ComplementarySidebar, {
|
|
963
|
+
current: complementarySidebarPanel
|
|
964
|
+
}), /* @__PURE__ */ React17.createElement(Main3.Overlay, null), isEmpty && /* @__PURE__ */ React17.createElement(Main3.Content, {
|
|
965
|
+
bounce: true,
|
|
966
|
+
handlesFocus: true,
|
|
967
|
+
classNames: mainPosition
|
|
968
|
+
}, /* @__PURE__ */ React17.createElement(ContentEmpty, null)), !isEmpty && /* @__PURE__ */ React17.createElement(Main3.Content, {
|
|
969
|
+
bounce: true,
|
|
970
|
+
classNames: mainPosition,
|
|
971
|
+
handlesFocus: true,
|
|
972
|
+
style: {
|
|
973
|
+
"--dx-main-sidebarWidth": sidebarState === "expanded" ? "var(--nav-sidebar-size)" : sidebarState === "collapsed" ? "var(--l0-size)" : "0",
|
|
974
|
+
"--dx-main-complementaryWidth": complementarySidebarState === "expanded" ? "var(--complementary-sidebar-size)" : complementarySidebarState === "collapsed" ? "var(--rail-size)" : "0",
|
|
975
|
+
"--dx-main-contentFirstWidth": `${plankSizing[active[0] ?? "never"] ?? DEFAULT_HORIZONTAL_SIZE}rem`,
|
|
976
|
+
"--dx-main-contentLastWidth": `${plankSizing[active[(active.length ?? 1) - 1] ?? "never"] ?? DEFAULT_HORIZONTAL_SIZE}rem`
|
|
977
|
+
}
|
|
978
|
+
}, /* @__PURE__ */ React17.createElement("div", {
|
|
979
|
+
role: "none",
|
|
980
|
+
className: !solo ? "relative bg-deck overflow-hidden" : "sr-only",
|
|
981
|
+
...solo && {
|
|
982
|
+
inert: ""
|
|
983
|
+
}
|
|
984
|
+
}, !topbar && /* @__PURE__ */ React17.createElement(ToggleSidebarButton, {
|
|
985
|
+
classNames: fixedSidebarToggleStyles
|
|
986
|
+
}), !topbar && /* @__PURE__ */ React17.createElement(ToggleComplementarySidebarButton, {
|
|
987
|
+
classNames: fixedComplementarySidebarToggleStyles
|
|
988
|
+
}), /* @__PURE__ */ React17.createElement(Stack, {
|
|
989
|
+
orientation: "horizontal",
|
|
990
|
+
size: "contain",
|
|
991
|
+
classNames: [
|
|
992
|
+
"absolute inset-block-0 -inset-inline-px",
|
|
993
|
+
mainPaddingTransitions
|
|
994
|
+
],
|
|
995
|
+
onScroll: handleScroll,
|
|
996
|
+
itemsCount: 2 * (active.length ?? 0) - 1,
|
|
997
|
+
style: padding,
|
|
998
|
+
ref: deckRef
|
|
999
|
+
}, active.map((entryId, index) => /* @__PURE__ */ React17.createElement(Fragment3, {
|
|
1000
|
+
key: entryId
|
|
1001
|
+
}, /* @__PURE__ */ React17.createElement(PlankSeparator, {
|
|
1002
|
+
index
|
|
1003
|
+
}), /* @__PURE__ */ React17.createElement(Plank, {
|
|
1004
|
+
id: entryId,
|
|
1005
|
+
part: "deck",
|
|
1006
|
+
order: index * 2 + 1,
|
|
1007
|
+
active,
|
|
1008
|
+
layoutMode
|
|
1009
|
+
}))))), /* @__PURE__ */ React17.createElement("div", {
|
|
1010
|
+
role: "none",
|
|
1011
|
+
className: solo ? "relative bg-deck overflow-hidden" : "sr-only",
|
|
1012
|
+
...!solo && {
|
|
1013
|
+
inert: ""
|
|
1014
|
+
}
|
|
1015
|
+
}, !topbar && /* @__PURE__ */ React17.createElement(ToggleSidebarButton, {
|
|
1016
|
+
classNames: fixedSidebarToggleStyles
|
|
1017
|
+
}), !topbar && /* @__PURE__ */ React17.createElement(ToggleComplementarySidebarButton, {
|
|
1018
|
+
classNames: fixedComplementarySidebarToggleStyles
|
|
1019
|
+
}), /* @__PURE__ */ React17.createElement(StackContext.Provider, {
|
|
1020
|
+
value: {
|
|
1021
|
+
size: "contain",
|
|
1022
|
+
orientation: "horizontal",
|
|
1023
|
+
rail: true
|
|
1024
|
+
}
|
|
1025
|
+
}, /* @__PURE__ */ React17.createElement(Plank, {
|
|
1026
|
+
id: solo,
|
|
1027
|
+
part: "solo",
|
|
1028
|
+
layoutMode
|
|
1029
|
+
})))), topbar && /* @__PURE__ */ React17.createElement(Topbar, null), hoistStatusbar && /* @__PURE__ */ React17.createElement(StatusBar, {
|
|
1030
|
+
showHints
|
|
1031
|
+
})), /* @__PURE__ */ React17.createElement(Popover2.Portal, null, /* @__PURE__ */ React17.createElement(Popover2.Content, {
|
|
1032
|
+
side: context.popoverSide,
|
|
1033
|
+
onEscapeKeyDown: handlePopoverClose
|
|
1034
|
+
}, /* @__PURE__ */ React17.createElement(Popover2.Viewport, null, /* @__PURE__ */ React17.createElement(Surface10, {
|
|
1035
|
+
role: "popover",
|
|
1036
|
+
data: popoverContent,
|
|
1037
|
+
limit: 1
|
|
1038
|
+
})), /* @__PURE__ */ React17.createElement(Popover2.Arrow, null))), /* @__PURE__ */ React17.createElement(Dialog.Root, {
|
|
1039
|
+
modal: dialogBlockAlign !== "end",
|
|
1040
|
+
open: dialogOpen,
|
|
1041
|
+
onOpenChange: (nextOpen) => context.dialogOpen = nextOpen
|
|
1042
|
+
}, dialogBlockAlign === "end" ? /* @__PURE__ */ React17.createElement(Surface10, {
|
|
1043
|
+
role: "dialog",
|
|
1044
|
+
data: dialogContent,
|
|
1045
|
+
limit: 1
|
|
1046
|
+
}) : /* @__PURE__ */ React17.createElement(Dialog.Overlay, {
|
|
1047
|
+
blockAlign: dialogBlockAlign
|
|
1048
|
+
}, /* @__PURE__ */ React17.createElement(Surface10, {
|
|
1049
|
+
role: "dialog",
|
|
1050
|
+
data: dialogContent,
|
|
1051
|
+
limit: 1
|
|
1052
|
+
}))), toasts?.map((toast) => /* @__PURE__ */ React17.createElement(Toast, {
|
|
1053
|
+
...toast,
|
|
1054
|
+
key: toast.id,
|
|
1055
|
+
onOpenChange: (open) => {
|
|
1056
|
+
if (!open) {
|
|
1057
|
+
onDismissToast(toast.id);
|
|
1058
|
+
}
|
|
1059
|
+
return open;
|
|
1060
|
+
}
|
|
1061
|
+
})));
|
|
1062
|
+
};
|
|
1063
|
+
|
|
1064
|
+
// packages/plugins/plugin-deck/src/components/LayoutSettings.tsx
|
|
1065
|
+
import React18 from "react";
|
|
1066
|
+
import { Input, Select, useTranslation as useTranslation8 } from "@dxos/react-ui";
|
|
1067
|
+
import { DeprecatedFormContainer, DeprecatedFormInput } from "@dxos/react-ui-form";
|
|
1068
|
+
var isSocket = !!globalThis.__args;
|
|
1069
|
+
var LayoutSettings = ({ settings }) => {
|
|
1070
|
+
const { t } = useTranslation8(DECK_PLUGIN);
|
|
1071
|
+
return /* @__PURE__ */ React18.createElement(DeprecatedFormContainer, null, /* @__PURE__ */ React18.createElement(DeprecatedFormInput, {
|
|
1072
|
+
label: t("select new plank positioning label")
|
|
1073
|
+
}, /* @__PURE__ */ React18.createElement(Select.Root, {
|
|
1074
|
+
value: settings.newPlankPositioning ?? "start",
|
|
1075
|
+
onValueChange: (value) => settings.newPlankPositioning = value
|
|
1076
|
+
}, /* @__PURE__ */ React18.createElement(Select.TriggerButton, {
|
|
1077
|
+
placeholder: t("select new plank positioning placeholder")
|
|
1078
|
+
}), /* @__PURE__ */ React18.createElement(Select.Portal, null, /* @__PURE__ */ React18.createElement(Select.Content, null, /* @__PURE__ */ React18.createElement(Select.Viewport, null, NewPlankPositions.map((position) => /* @__PURE__ */ React18.createElement(Select.Option, {
|
|
1079
|
+
key: position,
|
|
1080
|
+
value: position
|
|
1081
|
+
}, t(`settings new plank position ${position} label`)))))))), /* @__PURE__ */ React18.createElement(DeprecatedFormInput, {
|
|
1082
|
+
label: t("settings overscroll label")
|
|
1083
|
+
}, /* @__PURE__ */ React18.createElement(Select.Root, {
|
|
1084
|
+
value: settings.overscroll ?? "none",
|
|
1085
|
+
onValueChange: (value) => settings.overscroll = value
|
|
1086
|
+
}, /* @__PURE__ */ React18.createElement(Select.TriggerButton, {
|
|
1087
|
+
placeholder: t("select overscroll placeholder")
|
|
1088
|
+
}), /* @__PURE__ */ React18.createElement(Select.Portal, null, /* @__PURE__ */ React18.createElement(Select.Content, null, /* @__PURE__ */ React18.createElement(Select.Viewport, null, OverscrollOptions.map((option) => /* @__PURE__ */ React18.createElement(Select.Option, {
|
|
1089
|
+
key: option,
|
|
1090
|
+
value: option
|
|
1091
|
+
}, t(`settings overscroll ${option} label`)))))))), /* @__PURE__ */ React18.createElement(DeprecatedFormInput, {
|
|
1092
|
+
label: t("settings show hints label")
|
|
1093
|
+
}, /* @__PURE__ */ React18.createElement(Input.Switch, {
|
|
1094
|
+
checked: settings.showHints,
|
|
1095
|
+
onCheckedChange: (checked) => settings.showHints = checked
|
|
1096
|
+
})), !isSocket && /* @__PURE__ */ React18.createElement(DeprecatedFormInput, {
|
|
1097
|
+
label: t("settings native redirect label")
|
|
1098
|
+
}, /* @__PURE__ */ React18.createElement(Input.Switch, {
|
|
1099
|
+
checked: settings.enableNativeRedirect,
|
|
1100
|
+
onCheckedChange: (checked) => settings.enableNativeRedirect = checked
|
|
1101
|
+
})), /* @__PURE__ */ React18.createElement(DeprecatedFormInput, {
|
|
1102
|
+
label: t("settings enable ide-style statusbar label")
|
|
1103
|
+
}, /* @__PURE__ */ React18.createElement(Input.Switch, {
|
|
1104
|
+
checked: settings.enableIdeStyleStatusbar,
|
|
1105
|
+
onCheckedChange: (checked) => settings.enableIdeStyleStatusbar = checked
|
|
1106
|
+
})));
|
|
1107
|
+
};
|
|
1108
|
+
|
|
1109
|
+
export {
|
|
1110
|
+
Banner,
|
|
1111
|
+
DeckLayout,
|
|
1112
|
+
LayoutSettings
|
|
1113
|
+
};
|
|
1114
|
+
//# sourceMappingURL=chunk-O4RFYYQ6.mjs.map
|