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