@dxos/plugin-deck 0.8.2-main.f11618f → 0.8.2-main.fbd8ed0
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-VYZ4IWI3.mjs → app-graph-builder-R7COZ4A6.mjs} +16 -15
- package/dist/lib/browser/app-graph-builder-R7COZ4A6.mjs.map +7 -0
- package/dist/lib/browser/{check-app-scheme-O7JPE4TM.mjs → check-app-scheme-7AXGR6UT.mjs} +2 -2
- package/dist/lib/browser/check-app-scheme-7AXGR6UT.mjs.map +7 -0
- package/dist/lib/browser/chunk-3O2UZVBA.mjs +121 -0
- package/dist/lib/browser/chunk-3O2UZVBA.mjs.map +7 -0
- package/dist/lib/browser/chunk-JAYQ5BTF.mjs +157 -0
- package/dist/lib/browser/chunk-JAYQ5BTF.mjs.map +7 -0
- package/dist/lib/browser/{chunk-RDFJGGGX.mjs → chunk-KIGMELV2.mjs} +186 -201
- package/dist/lib/browser/chunk-KIGMELV2.mjs.map +7 -0
- package/dist/lib/browser/{state-Z6UY2Z3M.mjs → chunk-OF5RIATN.mjs} +6 -4
- package/dist/lib/browser/chunk-OF5RIATN.mjs.map +7 -0
- package/dist/lib/browser/chunk-TRFYUEBA.mjs +145 -0
- package/dist/lib/browser/chunk-TRFYUEBA.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +4 -5
- package/dist/lib/browser/index.mjs.map +1 -1
- package/dist/lib/browser/{intent-resolver-JKWXWUV6.mjs → intent-resolver-MAKOS57L.mjs} +78 -62
- package/dist/lib/browser/intent-resolver-MAKOS57L.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{react-root-S6ZAKNZA.mjs → react-root-DGQVIHXP.mjs} +6 -6
- package/dist/lib/browser/{react-surface-I7WZBOGM.mjs → react-surface-PXBXIOPU.mjs} +6 -6
- package/dist/lib/browser/{settings-6NU7CF2B.mjs → settings-UBWJF7J7.mjs} +4 -4
- package/dist/lib/browser/{settings-6NU7CF2B.mjs.map → settings-UBWJF7J7.mjs.map} +3 -3
- package/dist/lib/browser/state-4WFB4SDO.mjs +10 -0
- package/dist/lib/browser/state-4WFB4SDO.mjs.map +7 -0
- package/dist/lib/browser/{tools-VDVQTJMD.mjs → tools-IVPIPTVA.mjs} +7 -7
- package/dist/lib/browser/tools-IVPIPTVA.mjs.map +7 -0
- package/dist/lib/browser/types.mjs +1 -1
- package/dist/lib/browser/{url-handler-3CARFXQK.mjs → url-handler-JSYGSVSB.mjs} +4 -4
- package/dist/lib/browser/url-handler-JSYGSVSB.mjs.map +7 -0
- package/dist/types/src/capabilities/app-graph-builder.d.ts +2 -179
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/capabilities/check-app-scheme.d.ts +2 -2
- package/dist/types/src/capabilities/check-app-scheme.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +5 -180
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts +2 -2
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -1
- package/dist/types/src/capabilities/state.d.ts +2 -2
- package/dist/types/src/capabilities/state.d.ts.map +1 -1
- package/dist/types/src/capabilities/tools.d.ts.map +1 -1
- package/dist/types/src/capabilities/url-handler.d.ts +2 -2
- package/dist/types/src/capabilities/url-handler.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/Banner.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/ContentEmpty.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/DeckLayout.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/Popover.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/StatusBar.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/Toast.d.ts.map +1 -1
- package/dist/types/src/components/DeckSettings/DeckSettings.d.ts.map +1 -1
- package/dist/types/src/components/Plank/Plank.d.ts +18 -5
- package/dist/types/src/components/Plank/Plank.d.ts.map +1 -1
- package/dist/types/src/components/Plank/Plank.stories.d.ts +3 -3
- package/dist/types/src/components/Plank/Plank.stories.d.ts.map +1 -1
- package/dist/types/src/components/Plank/PlankControls.d.ts +1 -0
- package/dist/types/src/components/Plank/PlankControls.d.ts.map +1 -1
- package/dist/types/src/components/Plank/PlankError.d.ts.map +1 -1
- package/dist/types/src/components/Plank/PlankHeading.d.ts.map +1 -1
- package/dist/types/src/components/Sidebar/ComplementarySidebar.d.ts.map +1 -1
- package/dist/types/src/components/Sidebar/Sidebar.d.ts.map +1 -1
- package/dist/types/src/components/Sidebar/SidebarButton.d.ts +2 -1
- package/dist/types/src/components/Sidebar/SidebarButton.d.ts.map +1 -1
- package/dist/types/src/hooks/index.d.ts +5 -1
- package/dist/types/src/hooks/index.d.ts.map +1 -1
- package/dist/types/src/hooks/useBreakpoints.d.ts.map +1 -0
- package/dist/types/src/hooks/useCompanions.d.ts.map +1 -0
- package/dist/types/src/hooks/useDeckCompanions.d.ts +13 -0
- package/dist/types/src/hooks/useDeckCompanions.d.ts.map +1 -0
- package/dist/types/src/hooks/useHoistStatusbar.d.ts.map +1 -0
- package/dist/types/src/hooks/useNodeActionExpander.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +1 -1
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/layout.d.ts.map +1 -1
- package/dist/types/src/types.d.ts +104 -104
- package/dist/types/src/types.d.ts.map +1 -1
- package/dist/types/src/util/index.d.ts +1 -4
- package/dist/types/src/util/index.d.ts.map +1 -1
- package/dist/types/src/util/layoutAppliesTopbar.d.ts.map +1 -1
- package/dist/types/src/util/overscroll.d.ts.map +1 -1
- package/dist/types/src/util/set-active.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +35 -29
- package/src/capabilities/app-graph-builder.ts +120 -92
- package/src/capabilities/check-app-scheme.ts +3 -5
- package/src/capabilities/index.ts +1 -0
- package/src/capabilities/intent-resolver.ts +94 -76
- package/src/capabilities/settings.ts +2 -2
- package/src/capabilities/state.ts +4 -2
- package/src/capabilities/tools.ts +4 -3
- package/src/capabilities/url-handler.ts +4 -4
- package/src/components/DeckLayout/ContentEmpty.tsx +3 -2
- package/src/components/DeckLayout/DeckLayout.tsx +12 -10
- package/src/components/Plank/Plank.stories.tsx +20 -8
- package/src/components/Plank/Plank.tsx +100 -67
- package/src/components/Plank/PlankControls.tsx +15 -25
- package/src/components/Plank/PlankHeading.tsx +19 -9
- package/src/components/Sidebar/ComplementarySidebar.tsx +4 -35
- package/src/components/Sidebar/Sidebar.tsx +2 -1
- package/src/components/Sidebar/SidebarButton.tsx +30 -7
- package/src/components/fragments.ts +1 -1
- package/src/hooks/index.ts +5 -1
- package/src/{util → hooks}/useCompanions.ts +3 -3
- package/src/hooks/useDeckCompanions.ts +33 -0
- package/src/hooks/useNodeActionExpander.ts +3 -8
- package/src/index.ts +1 -1
- package/src/types.ts +72 -71
- package/src/util/index.ts +1 -4
- package/dist/lib/browser/app-graph-builder-VYZ4IWI3.mjs.map +0 -7
- package/dist/lib/browser/check-app-scheme-O7JPE4TM.mjs.map +0 -7
- package/dist/lib/browser/chunk-6HJZL3WT.mjs +0 -118
- package/dist/lib/browser/chunk-6HJZL3WT.mjs.map +0 -7
- package/dist/lib/browser/chunk-FLOVGNYB.mjs +0 -81
- package/dist/lib/browser/chunk-FLOVGNYB.mjs.map +0 -7
- package/dist/lib/browser/chunk-RBJ6DLAC.mjs +0 -24
- package/dist/lib/browser/chunk-RBJ6DLAC.mjs.map +0 -7
- package/dist/lib/browser/chunk-RDFJGGGX.mjs.map +0 -7
- package/dist/lib/browser/chunk-ZMJMCN7O.mjs +0 -157
- package/dist/lib/browser/chunk-ZMJMCN7O.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-JKWXWUV6.mjs.map +0 -7
- package/dist/lib/browser/state-Z6UY2Z3M.mjs.map +0 -7
- package/dist/lib/browser/tools-VDVQTJMD.mjs.map +0 -7
- package/dist/lib/browser/url-handler-3CARFXQK.mjs.map +0 -7
- package/dist/types/src/util/useBreakpoints.d.ts.map +0 -1
- package/dist/types/src/util/useCompanions.d.ts.map +0 -1
- package/dist/types/src/util/useHoistStatusbar.d.ts.map +0 -1
- /package/dist/lib/browser/{react-root-S6ZAKNZA.mjs.map → react-root-DGQVIHXP.mjs.map} +0 -0
- /package/dist/lib/browser/{react-surface-I7WZBOGM.mjs.map → react-surface-PXBXIOPU.mjs.map} +0 -0
- /package/dist/types/src/{util → hooks}/useBreakpoints.d.ts +0 -0
- /package/dist/types/src/{util → hooks}/useCompanions.d.ts +0 -0
- /package/dist/types/src/{util → hooks}/useHoistStatusbar.d.ts +0 -0
- /package/src/{util → hooks}/useBreakpoints.ts +0 -0
- /package/src/{util → hooks}/useHoistStatusbar.ts +0 -0
|
@@ -1,25 +1,27 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
getCompanionId,
|
|
3
|
+
useBreakpoints,
|
|
4
|
+
useCompanions,
|
|
5
|
+
useDeckCompanions,
|
|
6
|
+
useHoistStatusbar,
|
|
7
|
+
useMainSize,
|
|
8
|
+
useNodeActionExpander
|
|
9
|
+
} from "./chunk-3O2UZVBA.mjs";
|
|
4
10
|
import {
|
|
5
11
|
calculateOverscroll,
|
|
6
12
|
layoutAppliesTopbar,
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
useHoistStatusbar
|
|
10
|
-
} from "./chunk-6HJZL3WT.mjs";
|
|
13
|
+
parseEntryId
|
|
14
|
+
} from "./chunk-TRFYUEBA.mjs";
|
|
11
15
|
import {
|
|
12
16
|
DeckCapabilities
|
|
13
17
|
} from "./chunk-XMCG42ID.mjs";
|
|
14
18
|
import {
|
|
15
|
-
ATTENDABLE_PATH_SEPARATOR,
|
|
16
|
-
DECK_COMPANION_TYPE,
|
|
17
19
|
DeckAction,
|
|
18
20
|
NewPlankPositions,
|
|
19
21
|
OverscrollOptions,
|
|
20
22
|
PLANK_COMPANION_TYPE,
|
|
21
23
|
getMode
|
|
22
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-JAYQ5BTF.mjs";
|
|
23
25
|
import {
|
|
24
26
|
DECK_PLUGIN
|
|
25
27
|
} from "./chunk-NSATFAEE.mjs";
|
|
@@ -31,15 +33,14 @@ import { useTranslation as useTranslation6 } from "@dxos/react-ui";
|
|
|
31
33
|
import { mx as mx4 } from "@dxos/react-ui-theme";
|
|
32
34
|
|
|
33
35
|
// packages/plugins/plugin-deck/src/components/Sidebar/ComplementarySidebar.tsx
|
|
34
|
-
import React7, { Fragment as
|
|
35
|
-
import { LayoutAction as
|
|
36
|
-
import { Main, useTranslation as useTranslation5, toLocalizedString as toLocalizedString2, IconButton as
|
|
36
|
+
import React7, { Fragment as Fragment2, useCallback as useCallback5, useEffect as useEffect3, useMemo as useMemo3, useState as useState2 } from "react";
|
|
37
|
+
import { LayoutAction as LayoutAction4, Surface as Surface3, createIntent as createIntent5, useCapability as useCapability3, useIntentDispatcher as useIntentDispatcher5 } from "@dxos/app-framework";
|
|
38
|
+
import { Main, useTranslation as useTranslation5, toLocalizedString as toLocalizedString2, IconButton as IconButton4 } from "@dxos/react-ui";
|
|
37
39
|
import { Tabs } from "@dxos/react-ui-tabs";
|
|
38
|
-
import { byPosition } from "@dxos/util";
|
|
39
40
|
|
|
40
41
|
// packages/plugins/plugin-deck/src/components/Sidebar/SidebarButton.tsx
|
|
41
|
-
import React from "react";
|
|
42
|
-
import { useCapability } from "@dxos/app-framework";
|
|
42
|
+
import React, { useCallback } from "react";
|
|
43
|
+
import { createIntent, LayoutAction, useCapability, useIntentDispatcher } from "@dxos/app-framework";
|
|
43
44
|
import { IconButton, useTranslation } from "@dxos/react-ui";
|
|
44
45
|
var ToggleSidebarButton = ({ classNames, variant = "ghost" }) => {
|
|
45
46
|
const layoutContext = useCapability(DeckCapabilities.MutableDeckState);
|
|
@@ -67,12 +68,30 @@ var CloseSidebarButton = () => {
|
|
|
67
68
|
classNames: "rounded-none pli-1 dx-focus-ring-inset pie-[max(.5rem,env(safe-area-inset-left))]"
|
|
68
69
|
});
|
|
69
70
|
};
|
|
70
|
-
var ToggleComplementarySidebarButton = ({ inR0, classNames }) => {
|
|
71
|
+
var ToggleComplementarySidebarButton = ({ inR0, classNames, current }) => {
|
|
72
|
+
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
71
73
|
const layoutContext = useCapability(DeckCapabilities.MutableDeckState);
|
|
72
74
|
const { t } = useTranslation(DECK_PLUGIN);
|
|
75
|
+
const companions = useDeckCompanions();
|
|
76
|
+
const handleClick = useCallback(async () => {
|
|
77
|
+
layoutContext.complementarySidebarState = layoutContext.complementarySidebarState === "expanded" ? "collapsed" : "expanded";
|
|
78
|
+
const firstCompanion = companions[0];
|
|
79
|
+
if (layoutContext.complementarySidebarState === "expanded" && !current && firstCompanion) {
|
|
80
|
+
await dispatch(createIntent(LayoutAction.UpdateComplementary, {
|
|
81
|
+
part: "complementary",
|
|
82
|
+
subject: getCompanionId(firstCompanion.id)
|
|
83
|
+
}));
|
|
84
|
+
}
|
|
85
|
+
}, [
|
|
86
|
+
layoutContext,
|
|
87
|
+
current,
|
|
88
|
+
companions,
|
|
89
|
+
dispatch
|
|
90
|
+
]);
|
|
73
91
|
return /* @__PURE__ */ React.createElement(IconButton, {
|
|
92
|
+
noTooltip: true,
|
|
74
93
|
iconOnly: true,
|
|
75
|
-
onClick:
|
|
94
|
+
onClick: handleClick,
|
|
76
95
|
variant: "ghost",
|
|
77
96
|
label: t("open complementary sidebar label"),
|
|
78
97
|
classNames: [
|
|
@@ -86,11 +105,11 @@ var ToggleComplementarySidebarButton = ({ inR0, classNames }) => {
|
|
|
86
105
|
};
|
|
87
106
|
|
|
88
107
|
// packages/plugins/plugin-deck/src/components/Plank/Plank.tsx
|
|
89
|
-
import React6, {
|
|
90
|
-
import { LayoutAction as
|
|
108
|
+
import React6, { memo as memo2, useCallback as useCallback4, useLayoutEffect, useMemo as useMemo2, useRef } from "react";
|
|
109
|
+
import { LayoutAction as LayoutAction3, Surface as Surface2, createIntent as createIntent4, useCapability as useCapability2, useAppGraph as useAppGraph2, useIntentDispatcher as useIntentDispatcher4 } from "@dxos/app-framework";
|
|
91
110
|
import { debounce } from "@dxos/async";
|
|
92
111
|
import { useNode } from "@dxos/plugin-graph";
|
|
93
|
-
import { ATTENDABLE_PATH_SEPARATOR
|
|
112
|
+
import { ATTENDABLE_PATH_SEPARATOR, useAttendableAttributes } from "@dxos/react-ui-attention";
|
|
94
113
|
import { StackItem as StackItem2, railGridHorizontal } from "@dxos/react-ui-stack";
|
|
95
114
|
import { mainIntrinsicSize, mx as mx3 } from "@dxos/react-ui-theme";
|
|
96
115
|
|
|
@@ -100,48 +119,45 @@ import { useTranslation as useTranslation4 } from "@dxos/react-ui";
|
|
|
100
119
|
import { descriptionMessage, mx as mx2 } from "@dxos/react-ui-theme";
|
|
101
120
|
|
|
102
121
|
// packages/plugins/plugin-deck/src/components/Plank/PlankHeading.tsx
|
|
103
|
-
import React3, { Fragment, memo, useCallback as
|
|
104
|
-
import { createIntent as
|
|
105
|
-
import { Icon
|
|
122
|
+
import React3, { Fragment, memo, useCallback as useCallback3, useEffect, useMemo } from "react";
|
|
123
|
+
import { createIntent as createIntent3, LayoutAction as LayoutAction2, Surface, useAppGraph, useIntentDispatcher as useIntentDispatcher3 } from "@dxos/app-framework";
|
|
124
|
+
import { Icon, IconButton as IconButton3, Popover, toLocalizedString, useTranslation as useTranslation3 } from "@dxos/react-ui";
|
|
106
125
|
import { StackItem } from "@dxos/react-ui-stack";
|
|
107
126
|
import { TextTooltip } from "@dxos/react-ui-text-tooltip";
|
|
127
|
+
import { hoverableControls, hoverableFocusedWithinControls } from "@dxos/react-ui-theme";
|
|
108
128
|
|
|
109
129
|
// packages/plugins/plugin-deck/src/components/Plank/PlankControls.tsx
|
|
110
|
-
import React2, { forwardRef, useCallback } from "react";
|
|
111
|
-
import { createIntent, useIntentDispatcher } from "@dxos/app-framework";
|
|
130
|
+
import React2, { forwardRef, useCallback as useCallback2 } from "react";
|
|
131
|
+
import { createIntent as createIntent2, useIntentDispatcher as useIntentDispatcher2 } from "@dxos/app-framework";
|
|
112
132
|
import { invariant } from "@dxos/invariant";
|
|
113
|
-
import {
|
|
133
|
+
import { ButtonGroup, IconButton as IconButton2, useTranslation as useTranslation2 } from "@dxos/react-ui";
|
|
114
134
|
var __dxlog_file = "/home/runner/work/dxos/dxos/packages/plugins/plugin-deck/src/components/Plank/PlankControls.tsx";
|
|
115
135
|
var PlankControl = ({ icon, label: label3, ...props }) => {
|
|
116
|
-
return /* @__PURE__ */ React2.createElement(
|
|
117
|
-
|
|
118
|
-
|
|
136
|
+
return /* @__PURE__ */ React2.createElement(IconButton2, {
|
|
137
|
+
iconOnly: true,
|
|
138
|
+
label: label3,
|
|
139
|
+
icon,
|
|
140
|
+
size: 5,
|
|
119
141
|
variant: "ghost",
|
|
142
|
+
tooltipSide: "bottom",
|
|
120
143
|
...props
|
|
121
|
-
}
|
|
122
|
-
className: "sr-only"
|
|
123
|
-
}, label3), /* @__PURE__ */ React2.createElement(Icon, {
|
|
124
|
-
icon,
|
|
125
|
-
size: 5
|
|
126
|
-
}))), /* @__PURE__ */ React2.createElement(Tooltip.Portal, null, /* @__PURE__ */ React2.createElement(Tooltip.Content, {
|
|
127
|
-
side: "bottom"
|
|
128
|
-
}, label3)));
|
|
144
|
+
});
|
|
129
145
|
};
|
|
130
|
-
var plankControlSpacing = "pli-2
|
|
146
|
+
var plankControlSpacing = "pli-2";
|
|
131
147
|
var PlankCompanionControls = /* @__PURE__ */ forwardRef(({ primary }, forwardedRef) => {
|
|
132
148
|
const { t } = useTranslation2(DECK_PLUGIN);
|
|
133
|
-
const { dispatchPromise: dispatch } =
|
|
134
|
-
const handleCloseCompanion =
|
|
149
|
+
const { dispatchPromise: dispatch } = useIntentDispatcher2();
|
|
150
|
+
const handleCloseCompanion = useCallback2(() => {
|
|
135
151
|
invariant(primary, void 0, {
|
|
136
152
|
F: __dxlog_file,
|
|
137
|
-
L:
|
|
153
|
+
L: 49,
|
|
138
154
|
S: void 0,
|
|
139
155
|
A: [
|
|
140
156
|
"primary",
|
|
141
157
|
""
|
|
142
158
|
]
|
|
143
159
|
});
|
|
144
|
-
return dispatch(
|
|
160
|
+
return dispatch(createIntent2(DeckAction.ChangeCompanion, {
|
|
145
161
|
primary,
|
|
146
162
|
companion: null
|
|
147
163
|
}));
|
|
@@ -164,11 +180,11 @@ var PlankControls = /* @__PURE__ */ forwardRef(({ children, classNames, variant
|
|
|
164
180
|
return /* @__PURE__ */ React2.createElement(ButtonGroup, {
|
|
165
181
|
...props,
|
|
166
182
|
classNames: [
|
|
167
|
-
"app-no-drag",
|
|
183
|
+
"app-no-drag !opacity-100",
|
|
168
184
|
classNames
|
|
169
185
|
],
|
|
170
186
|
ref: forwardedRef
|
|
171
|
-
}, capabilities.deck
|
|
187
|
+
}, capabilities.deck ? /* @__PURE__ */ React2.createElement(React2.Fragment, null, capabilities.solo && /* @__PURE__ */ React2.createElement(React2.Fragment, null, layoutMode === "solo" && /* @__PURE__ */ React2.createElement(PlankControl, {
|
|
172
188
|
label: t("show fullscreen plank label"),
|
|
173
189
|
classNames: buttonClassNames,
|
|
174
190
|
icon: "ph--corners-out--regular",
|
|
@@ -190,7 +206,12 @@ var PlankControls = /* @__PURE__ */ forwardRef(({ children, classNames, variant
|
|
|
190
206
|
classNames: buttonClassNames,
|
|
191
207
|
icon: "ph--caret-right--regular",
|
|
192
208
|
onClick: () => onClick?.("increment-end")
|
|
193
|
-
})))
|
|
209
|
+
}))) : capabilities.fullscreen && /* @__PURE__ */ React2.createElement(PlankControl, {
|
|
210
|
+
label: t(layoutMode === "solo--fullscreen" ? "exit fullscreen label" : "show fullscreen plank label"),
|
|
211
|
+
classNames: buttonClassNames,
|
|
212
|
+
icon: layoutMode === "solo--fullscreen" ? "ph--corners-in--regular" : "ph--corners-out--regular",
|
|
213
|
+
onClick: () => onClick?.("solo--fullscreen")
|
|
214
|
+
}), close && !layoutIsAnySolo && /* @__PURE__ */ React2.createElement(PlankControl, {
|
|
194
215
|
label: t(`${typeof close === "string" ? "minify" : "close"} label`),
|
|
195
216
|
classNames: buttonClassNames,
|
|
196
217
|
"data-testid": "plankHeading.close",
|
|
@@ -208,7 +229,7 @@ var PlankControls = /* @__PURE__ */ forwardRef(({ children, classNames, variant
|
|
|
208
229
|
// packages/plugins/plugin-deck/src/components/fragments.ts
|
|
209
230
|
import { mx } from "@dxos/react-ui-theme";
|
|
210
231
|
var soloInlinePadding = "pis-[calc(env(safe-area-inset-left)+.25rem)] pie-[calc(env(safe-area-inset-left)+.25rem)]";
|
|
211
|
-
var sidebarToggleStyles = "bs-[--rail-item] is-[--rail-item] absolute block-end-2 z-[1] !bg-
|
|
232
|
+
var sidebarToggleStyles = "bs-[--rail-item] is-[--rail-item] absolute block-end-2 z-[1] !bg-deckSurface lg:hidden";
|
|
212
233
|
var fixedSidebarToggleStyles = mx(sidebarToggleStyles, "inline-start-2");
|
|
213
234
|
var fixedComplementarySidebarToggleStyles = mx(sidebarToggleStyles, "inline-end-2");
|
|
214
235
|
|
|
@@ -216,7 +237,7 @@ var fixedComplementarySidebarToggleStyles = mx(sidebarToggleStyles, "inline-end-
|
|
|
216
237
|
var MAX_COMPANIONS = 5;
|
|
217
238
|
var PlankHeading = /* @__PURE__ */ memo(({ id, part, node, deckEnabled, canIncrementStart, canIncrementEnd, popoverAnchorId, primaryId, pending, companioned, companions, layoutMode, actions = [] }) => {
|
|
218
239
|
const { t } = useTranslation3(DECK_PLUGIN);
|
|
219
|
-
const { dispatchPromise: dispatch } =
|
|
240
|
+
const { dispatchPromise: dispatch } = useIntentDispatcher3();
|
|
220
241
|
const { graph } = useAppGraph();
|
|
221
242
|
const breakpoint = useBreakpoints();
|
|
222
243
|
const icon = node?.properties?.icon ?? "ph--placeholder--regular";
|
|
@@ -229,7 +250,7 @@ var PlankHeading = /* @__PURE__ */ memo(({ id, part, node, deckEnabled, canIncre
|
|
|
229
250
|
const isCompanionNode = node?.type === PLANK_COMPANION_TYPE;
|
|
230
251
|
useEffect(() => {
|
|
231
252
|
const frame = requestAnimationFrame(() => {
|
|
232
|
-
node && graph.
|
|
253
|
+
node && graph.expand(node.id);
|
|
233
254
|
});
|
|
234
255
|
return () => cancelAnimationFrame(frame);
|
|
235
256
|
}, [
|
|
@@ -241,6 +262,7 @@ var PlankHeading = /* @__PURE__ */ memo(({ id, part, node, deckEnabled, canIncre
|
|
|
241
262
|
solo: breakpoint !== "mobile" && (part === "solo" || part === "deck"),
|
|
242
263
|
incrementStart: canIncrementStart,
|
|
243
264
|
incrementEnd: canIncrementEnd,
|
|
265
|
+
fullscreen: !isCompanionNode,
|
|
244
266
|
companion: !isCompanionNode && companions && companions.length > 0
|
|
245
267
|
}), [
|
|
246
268
|
breakpoint,
|
|
@@ -260,7 +282,7 @@ var PlankHeading = /* @__PURE__ */ memo(({ id, part, node, deckEnabled, canIncre
|
|
|
260
282
|
} else {
|
|
261
283
|
return [
|
|
262
284
|
actions,
|
|
263
|
-
graph.
|
|
285
|
+
graph.getActions(node.id)
|
|
264
286
|
].filter((a) => a.length > 0);
|
|
265
287
|
}
|
|
266
288
|
}, [
|
|
@@ -269,28 +291,30 @@ var PlankHeading = /* @__PURE__ */ memo(({ id, part, node, deckEnabled, canIncre
|
|
|
269
291
|
variant,
|
|
270
292
|
graph
|
|
271
293
|
]);
|
|
272
|
-
const handleAction =
|
|
294
|
+
const handleAction = useCallback3((action) => {
|
|
273
295
|
typeof action.data === "function" && action.data?.({
|
|
274
|
-
|
|
296
|
+
parent: node,
|
|
275
297
|
caller: DECK_PLUGIN
|
|
276
298
|
});
|
|
277
|
-
}, [
|
|
278
|
-
|
|
299
|
+
}, [
|
|
300
|
+
node
|
|
301
|
+
]);
|
|
302
|
+
const handlePlankAction = useCallback3((eventType) => {
|
|
279
303
|
if (eventType.startsWith("solo")) {
|
|
280
|
-
return dispatch(
|
|
304
|
+
return dispatch(createIntent3(DeckAction.Adjust, {
|
|
281
305
|
type: eventType,
|
|
282
306
|
id
|
|
283
307
|
}));
|
|
284
308
|
} else if (eventType === "close") {
|
|
285
309
|
if (part === "complementary") {
|
|
286
|
-
return dispatch(
|
|
310
|
+
return dispatch(createIntent3(LayoutAction2.UpdateComplementary, {
|
|
287
311
|
part: "complementary",
|
|
288
312
|
options: {
|
|
289
313
|
state: "collapsed"
|
|
290
314
|
}
|
|
291
315
|
}));
|
|
292
316
|
} else {
|
|
293
|
-
return dispatch(
|
|
317
|
+
return dispatch(createIntent3(LayoutAction2.Close, {
|
|
294
318
|
part: "main",
|
|
295
319
|
subject: [
|
|
296
320
|
id
|
|
@@ -301,7 +325,7 @@ var PlankHeading = /* @__PURE__ */ memo(({ id, part, node, deckEnabled, canIncre
|
|
|
301
325
|
}));
|
|
302
326
|
}
|
|
303
327
|
} else {
|
|
304
|
-
return dispatch(
|
|
328
|
+
return dispatch(createIntent3(DeckAction.Adjust, {
|
|
305
329
|
type: eventType,
|
|
306
330
|
id
|
|
307
331
|
}));
|
|
@@ -312,11 +336,11 @@ var PlankHeading = /* @__PURE__ */ memo(({ id, part, node, deckEnabled, canIncre
|
|
|
312
336
|
part
|
|
313
337
|
]);
|
|
314
338
|
const ActionRoot = node && popoverAnchorId === `dxos.org/ui/${DECK_PLUGIN}/${node.id}` ? Popover.Anchor : Fragment;
|
|
315
|
-
const handleTabClick =
|
|
339
|
+
const handleTabClick = useCallback3((event) => {
|
|
316
340
|
const target = event.target.closest("[data-id]");
|
|
317
341
|
const tabId = target?.dataset?.id;
|
|
318
342
|
if (primaryId && tabId) {
|
|
319
|
-
void dispatch(
|
|
343
|
+
void dispatch(createIntent3(DeckAction.ChangeCompanion, {
|
|
320
344
|
primary: primaryId,
|
|
321
345
|
companion: tabId
|
|
322
346
|
}));
|
|
@@ -328,13 +352,17 @@ var PlankHeading = /* @__PURE__ */ memo(({ id, part, node, deckEnabled, canIncre
|
|
|
328
352
|
classNames: [
|
|
329
353
|
"plb-1 border-be border-separator items-stretch gap-1 sticky inline-start-12 app-drag min-is-0 contain-layout",
|
|
330
354
|
part === "solo" ? soloInlinePadding : "pli-1",
|
|
331
|
-
layoutMode === "solo--fullscreen"
|
|
355
|
+
...layoutMode === "solo--fullscreen" ? [
|
|
356
|
+
hoverableControls,
|
|
357
|
+
hoverableFocusedWithinControls,
|
|
358
|
+
"[&>*]:transition-opacity [&>*]:opacity-[--controls-opacity] bg-transparent border-transparent transition-[background-color,border-color] hover-hover:hover:bg-headerSurface focus-within:bg-headerSurface hover-hover:hover:border-separator focus-within:border-separator"
|
|
359
|
+
] : []
|
|
332
360
|
],
|
|
333
361
|
"data-plank-heading": true
|
|
334
362
|
}, companions && isCompanionNode ? /* @__PURE__ */ React3.createElement("div", {
|
|
335
363
|
role: "none",
|
|
336
364
|
className: "flex-1 min-is-0 overflow-x-auto scrollbar-thin flex gap-1"
|
|
337
|
-
}, companions.map(({ id: id2, properties: { icon: icon2, label: label4 } }) => /* @__PURE__ */ React3.createElement(
|
|
365
|
+
}, companions.map(({ id: id2, properties: { icon: icon2, label: label4 } }) => /* @__PURE__ */ React3.createElement(IconButton3, {
|
|
338
366
|
key: id2,
|
|
339
367
|
"data-id": id2,
|
|
340
368
|
icon: icon2,
|
|
@@ -357,7 +385,7 @@ var PlankHeading = /* @__PURE__ */ memo(({ id, part, node, deckEnabled, canIncre
|
|
|
357
385
|
}
|
|
358
386
|
})) : /* @__PURE__ */ React3.createElement(StackItem.SigilButton, null, /* @__PURE__ */ React3.createElement("span", {
|
|
359
387
|
className: "sr-only"
|
|
360
|
-
}, label3), /* @__PURE__ */ React3.createElement(
|
|
388
|
+
}, label3), /* @__PURE__ */ React3.createElement(Icon, {
|
|
361
389
|
icon,
|
|
362
390
|
size: 5
|
|
363
391
|
}))), /* @__PURE__ */ React3.createElement(TextTooltip, {
|
|
@@ -420,55 +448,66 @@ var PlankError = ({ id, part, node, error }) => {
|
|
|
420
448
|
}) : /* @__PURE__ */ React5.createElement(PlankLoading, null));
|
|
421
449
|
};
|
|
422
450
|
|
|
423
|
-
// packages/plugins/plugin-deck/src/hooks/useNodeActionExpander.ts
|
|
424
|
-
import { useEffect as useEffect3 } from "react";
|
|
425
|
-
import { ACTION_GROUP_TYPE, ACTION_TYPE, getGraph } from "@dxos/plugin-graph";
|
|
426
|
-
var expandNodeActions = async (node) => {
|
|
427
|
-
const graph = getGraph(node);
|
|
428
|
-
await graph.expand(node, "outbound", ACTION_GROUP_TYPE);
|
|
429
|
-
await graph.expand(node, "outbound", ACTION_TYPE);
|
|
430
|
-
};
|
|
431
|
-
var useNodeActionExpander = (node) => {
|
|
432
|
-
useEffect3(() => {
|
|
433
|
-
if (node) {
|
|
434
|
-
const frame = requestAnimationFrame(() => {
|
|
435
|
-
void expandNodeActions(node);
|
|
436
|
-
});
|
|
437
|
-
return () => cancelAnimationFrame(frame);
|
|
438
|
-
}
|
|
439
|
-
}, [
|
|
440
|
-
node
|
|
441
|
-
]);
|
|
442
|
-
};
|
|
443
|
-
|
|
444
|
-
// packages/plugins/plugin-deck/src/hooks/useMainSize.ts
|
|
445
|
-
import { useMainContext } from "@dxos/react-ui";
|
|
446
|
-
var useMainSize = () => {
|
|
447
|
-
const { navigationSidebarState, complementarySidebarState } = useMainContext("DeckPluginPlank");
|
|
448
|
-
return {
|
|
449
|
-
"data-sidebar-inline-start-state": navigationSidebarState,
|
|
450
|
-
"data-sidebar-inline-end-state": complementarySidebarState
|
|
451
|
-
};
|
|
452
|
-
};
|
|
453
|
-
|
|
454
451
|
// packages/plugins/plugin-deck/src/components/Plank/Plank.tsx
|
|
455
452
|
var UNKNOWN_ID = "unknown_id";
|
|
456
|
-
var
|
|
457
|
-
const {
|
|
453
|
+
var Plank = /* @__PURE__ */ memo2(({ id = UNKNOWN_ID, companionId, ...props }) => {
|
|
454
|
+
const { graph } = useAppGraph2();
|
|
455
|
+
const node = useNode(graph, id);
|
|
456
|
+
const companions = useCompanions(id);
|
|
457
|
+
const currentCompanion = companions.find(({ id: id2 }) => id2 === companionId);
|
|
458
|
+
const hasCompanion = !!(companionId && currentCompanion);
|
|
459
|
+
return /* @__PURE__ */ React6.createElement(PlankContainer, {
|
|
460
|
+
solo: props.part === "solo",
|
|
461
|
+
companion: hasCompanion
|
|
462
|
+
}, /* @__PURE__ */ React6.createElement(PlankComponent, {
|
|
463
|
+
id,
|
|
464
|
+
node,
|
|
465
|
+
companioned: hasCompanion ? "primary" : void 0,
|
|
466
|
+
companions: hasCompanion ? [] : companions,
|
|
467
|
+
...props,
|
|
468
|
+
...props.part === "solo" ? {
|
|
469
|
+
part: "solo-primary"
|
|
470
|
+
} : {}
|
|
471
|
+
}), hasCompanion && /* @__PURE__ */ React6.createElement(PlankComponent, {
|
|
472
|
+
id: companionId,
|
|
473
|
+
node: currentCompanion,
|
|
474
|
+
primary: node,
|
|
475
|
+
companions,
|
|
476
|
+
companioned: "companion",
|
|
477
|
+
...props,
|
|
478
|
+
...props.part === "solo" ? {
|
|
479
|
+
part: "solo-companion"
|
|
480
|
+
} : {
|
|
481
|
+
order: (props.order ?? 0) + 1
|
|
482
|
+
}
|
|
483
|
+
}));
|
|
484
|
+
});
|
|
485
|
+
var PlankContainer = ({ children, solo, companion }) => {
|
|
486
|
+
const sizeAttrs = useMainSize();
|
|
487
|
+
if (!solo) {
|
|
488
|
+
return children;
|
|
489
|
+
}
|
|
490
|
+
return /* @__PURE__ */ React6.createElement("div", {
|
|
491
|
+
role: "none",
|
|
492
|
+
className: mx3("absolute inset-0 grid", companion && "grid-cols-[1fr_1fr]", railGridHorizontal, mainIntrinsicSize),
|
|
493
|
+
...sizeAttrs
|
|
494
|
+
}, children);
|
|
495
|
+
};
|
|
496
|
+
var PlankComponent = /* @__PURE__ */ memo2(({ layoutMode, id, part, path, order, active, companioned, node, primary, companions, settings }) => {
|
|
497
|
+
const { dispatchPromise: dispatch } = useIntentDispatcher4();
|
|
458
498
|
const { deck, popoverAnchorId, scrollIntoView } = useCapability2(DeckCapabilities.DeckState);
|
|
459
|
-
const rootElement = useRef(null);
|
|
460
499
|
const canResize = layoutMode === "deck";
|
|
461
|
-
const Root = part.startsWith("solo") ? "article" : StackItem2.Root;
|
|
462
500
|
const attendableAttrs = useAttendableAttributes(primary?.id ?? id);
|
|
463
501
|
const index = active ? active.findIndex((entryId) => entryId === id) : 0;
|
|
464
502
|
const length = active?.length ?? 1;
|
|
465
503
|
const canIncrementStart = active && index !== void 0 && index > 0 && length !== void 0 && length > 1;
|
|
466
504
|
const canIncrementEnd = active && index !== void 0 && index < length - 1 && length !== void 0;
|
|
505
|
+
const rootElement = useRef(null);
|
|
467
506
|
const { variant } = parseEntryId(id);
|
|
468
|
-
const sizeKey = `${id.split("+")[0]}${variant ? `${
|
|
507
|
+
const sizeKey = `${id.split("+")[0]}${variant ? `${ATTENDABLE_PATH_SEPARATOR}${variant}` : ""}`;
|
|
469
508
|
const size = deck.plankSizing[sizeKey];
|
|
470
|
-
const
|
|
471
|
-
return dispatch(
|
|
509
|
+
const handleSizeChange = useCallback4(debounce((nextSize) => {
|
|
510
|
+
return dispatch(createIntent4(DeckAction.UpdatePlankSize, {
|
|
472
511
|
id: sizeKey,
|
|
473
512
|
size: nextSize
|
|
474
513
|
}));
|
|
@@ -476,7 +515,7 @@ var PlankImpl = /* @__PURE__ */ memo2(({ id, node, part, path, order, active, la
|
|
|
476
515
|
dispatch,
|
|
477
516
|
sizeKey
|
|
478
517
|
]);
|
|
479
|
-
const handleKeyDown =
|
|
518
|
+
const handleKeyDown = useCallback4((event) => {
|
|
480
519
|
if (event.target === event.currentTarget && event.key === "Escape") {
|
|
481
520
|
rootElement.current?.closest("main")?.focus();
|
|
482
521
|
}
|
|
@@ -491,7 +530,7 @@ var PlankImpl = /* @__PURE__ */ memo2(({ id, node, part, path, order, active, la
|
|
|
491
530
|
behavior: "smooth",
|
|
492
531
|
inline: "center"
|
|
493
532
|
});
|
|
494
|
-
void dispatch(
|
|
533
|
+
void dispatch(createIntent4(LayoutAction3.ScrollIntoView, {
|
|
495
534
|
part: "current",
|
|
496
535
|
subject: void 0
|
|
497
536
|
}));
|
|
@@ -519,7 +558,8 @@ var PlankImpl = /* @__PURE__ */ memo2(({ id, node, part, path, order, active, la
|
|
|
519
558
|
variant
|
|
520
559
|
]);
|
|
521
560
|
const placeholder = useMemo2(() => /* @__PURE__ */ React6.createElement(PlankLoading, null), []);
|
|
522
|
-
const
|
|
561
|
+
const Root = part.startsWith("solo") ? "article" : StackItem2.Root;
|
|
562
|
+
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");
|
|
523
563
|
return /* @__PURE__ */ React6.createElement(Root, {
|
|
524
564
|
ref: rootElement,
|
|
525
565
|
"data-testid": "deck.plank",
|
|
@@ -532,7 +572,7 @@ var PlankImpl = /* @__PURE__ */ memo2(({ id, node, part, path, order, active, la
|
|
|
532
572
|
id
|
|
533
573
|
},
|
|
534
574
|
size,
|
|
535
|
-
onSizeChange:
|
|
575
|
+
onSizeChange: handleSizeChange,
|
|
536
576
|
classNames: className,
|
|
537
577
|
order,
|
|
538
578
|
role: "article"
|
|
@@ -563,51 +603,6 @@ var PlankImpl = /* @__PURE__ */ memo2(({ id, node, part, path, order, active, la
|
|
|
563
603
|
part
|
|
564
604
|
}), canResize && /* @__PURE__ */ React6.createElement(StackItem2.ResizeHandle, null));
|
|
565
605
|
});
|
|
566
|
-
var SplitFrame = ({ children }) => {
|
|
567
|
-
const sizeAttrs = useMainSize();
|
|
568
|
-
return /* @__PURE__ */ React6.createElement("div", {
|
|
569
|
-
role: "none",
|
|
570
|
-
className: mx3("grid grid-cols-[1fr_1fr] absolute inset-0", railGridHorizontal, mainIntrinsicSize),
|
|
571
|
-
...sizeAttrs
|
|
572
|
-
}, children);
|
|
573
|
-
};
|
|
574
|
-
var Plank = ({ id = UNKNOWN_ID, ...props }) => {
|
|
575
|
-
const { graph } = useAppGraph2();
|
|
576
|
-
const node = useNode(graph, id);
|
|
577
|
-
const companions = useCompanions(id);
|
|
578
|
-
const currentCompanion = companions.find(({ id: id2 }) => id2 === props.companionId);
|
|
579
|
-
if (props.companionId) {
|
|
580
|
-
const Root = props.part === "solo" ? SplitFrame : Fragment2;
|
|
581
|
-
return /* @__PURE__ */ React6.createElement(Root, null, /* @__PURE__ */ React6.createElement(PlankImpl, {
|
|
582
|
-
id,
|
|
583
|
-
node,
|
|
584
|
-
companioned: "primary",
|
|
585
|
-
...props,
|
|
586
|
-
...props.part === "solo" ? {
|
|
587
|
-
part: "solo-primary"
|
|
588
|
-
} : {}
|
|
589
|
-
}), /* @__PURE__ */ React6.createElement(PlankImpl, {
|
|
590
|
-
id: props.companionId,
|
|
591
|
-
node: currentCompanion,
|
|
592
|
-
companioned: "companion",
|
|
593
|
-
primary: node,
|
|
594
|
-
companions,
|
|
595
|
-
...props,
|
|
596
|
-
...props.part === "solo" ? {
|
|
597
|
-
part: "solo-companion"
|
|
598
|
-
} : {
|
|
599
|
-
order: props.order + 1
|
|
600
|
-
}
|
|
601
|
-
}));
|
|
602
|
-
} else {
|
|
603
|
-
return /* @__PURE__ */ React6.createElement(PlankImpl, {
|
|
604
|
-
id,
|
|
605
|
-
node,
|
|
606
|
-
companions,
|
|
607
|
-
...props
|
|
608
|
-
});
|
|
609
|
-
}
|
|
610
|
-
};
|
|
611
606
|
|
|
612
607
|
// packages/plugins/plugin-deck/src/components/Sidebar/ComplementarySidebar.tsx
|
|
613
608
|
var label = [
|
|
@@ -616,20 +611,9 @@ var label = [
|
|
|
616
611
|
ns: DECK_PLUGIN
|
|
617
612
|
}
|
|
618
613
|
];
|
|
619
|
-
var getCompanionId = (id) => {
|
|
620
|
-
const [_, companionId] = id.split(ATTENDABLE_PATH_SEPARATOR);
|
|
621
|
-
return companionId ?? "never";
|
|
622
|
-
};
|
|
623
|
-
var useDeckCompanions = () => {
|
|
624
|
-
const { graph } = useAppGraph3();
|
|
625
|
-
const companions = graph.nodes(graph.root, {
|
|
626
|
-
type: DECK_COMPANION_TYPE
|
|
627
|
-
});
|
|
628
|
-
return companions.toSorted((a, b) => byPosition(a.properties, b.properties));
|
|
629
|
-
};
|
|
630
614
|
var ComplementarySidebar = ({ current }) => {
|
|
631
615
|
const { t } = useTranslation5(DECK_PLUGIN);
|
|
632
|
-
const { dispatchPromise: dispatch } =
|
|
616
|
+
const { dispatchPromise: dispatch } = useIntentDispatcher5();
|
|
633
617
|
const layout = useCapability3(DeckCapabilities.MutableDeckState);
|
|
634
618
|
const layoutMode = getMode(layout.deck);
|
|
635
619
|
const breakpoint = useBreakpoints();
|
|
@@ -639,19 +623,19 @@ var ComplementarySidebar = ({ current }) => {
|
|
|
639
623
|
const activeCompanion = companions.find((companion) => getCompanionId(companion.id) === current);
|
|
640
624
|
const activeId = activeCompanion && getCompanionId(activeCompanion.id);
|
|
641
625
|
const [internalValue, setInternalValue] = useState2(activeId);
|
|
642
|
-
|
|
626
|
+
useEffect3(() => {
|
|
643
627
|
setInternalValue(activeId);
|
|
644
628
|
}, [
|
|
645
629
|
activeId
|
|
646
630
|
]);
|
|
647
|
-
const handleTabClick =
|
|
631
|
+
const handleTabClick = useCallback5((event) => {
|
|
648
632
|
const nextValue = event.currentTarget.getAttribute("data-value");
|
|
649
633
|
if (nextValue === activeId) {
|
|
650
634
|
layout.complementarySidebarState = layout.complementarySidebarState === "expanded" ? "collapsed" : "expanded";
|
|
651
635
|
} else {
|
|
652
636
|
setInternalValue(nextValue);
|
|
653
637
|
layout.complementarySidebarState = "expanded";
|
|
654
|
-
void dispatch(
|
|
638
|
+
void dispatch(createIntent5(LayoutAction4.UpdateComplementary, {
|
|
655
639
|
part: "complementary",
|
|
656
640
|
subject: nextValue
|
|
657
641
|
}));
|
|
@@ -668,9 +652,9 @@ var ComplementarySidebar = ({ current }) => {
|
|
|
668
652
|
activeCompanion?.id,
|
|
669
653
|
activeCompanion?.data
|
|
670
654
|
]);
|
|
671
|
-
|
|
655
|
+
useEffect3(() => {
|
|
672
656
|
if (!activeId) {
|
|
673
|
-
void dispatch(
|
|
657
|
+
void dispatch(createIntent5(LayoutAction4.UpdateComplementary, {
|
|
674
658
|
part: "complementary",
|
|
675
659
|
options: {
|
|
676
660
|
state: "collapsed"
|
|
@@ -701,7 +685,7 @@ var ComplementarySidebar = ({ current }) => {
|
|
|
701
685
|
key: getCompanionId(companion.id),
|
|
702
686
|
value: getCompanionId(companion.id),
|
|
703
687
|
asChild: true
|
|
704
|
-
}, /* @__PURE__ */ React7.createElement(
|
|
688
|
+
}, /* @__PURE__ */ React7.createElement(IconButton4, {
|
|
705
689
|
label: toLocalizedString2(companion.properties.label, t),
|
|
706
690
|
icon: companion.properties.icon,
|
|
707
691
|
size: 5,
|
|
@@ -743,7 +727,7 @@ var ComplementarySidebarPanel = ({ companion, activeId, data, hoistStatusbar })
|
|
|
743
727
|
if (getCompanionId(companion.id) !== activeId && !data) {
|
|
744
728
|
return null;
|
|
745
729
|
}
|
|
746
|
-
const Wrapper = companion.properties.fixed ?
|
|
730
|
+
const Wrapper = companion.properties.fixed ? Fragment2 : ScrollArea;
|
|
747
731
|
return /* @__PURE__ */ React7.createElement(React7.Fragment, null, /* @__PURE__ */ React7.createElement("h2", {
|
|
748
732
|
className: "flex items-center pli-2 border-separator border-be font-medium"
|
|
749
733
|
}, toLocalizedString2(companion.properties.label, t)), /* @__PURE__ */ React7.createElement(Wrapper, null, /* @__PURE__ */ React7.createElement(Surface3, {
|
|
@@ -833,8 +817,8 @@ var Banner = ({ variant, classNames }) => {
|
|
|
833
817
|
|
|
834
818
|
// packages/plugins/plugin-deck/src/components/DeckLayout/DeckLayout.tsx
|
|
835
819
|
import { untracked } from "@preact/signals-core";
|
|
836
|
-
import React17, { useCallback as
|
|
837
|
-
import { Capabilities, LayoutAction as
|
|
820
|
+
import React17, { useCallback as useCallback7, useEffect as useEffect5, useMemo as useMemo6, useRef as useRef3, Fragment as Fragment3 } from "react";
|
|
821
|
+
import { Capabilities, LayoutAction as LayoutAction5, createIntent as createIntent6, useCapability as useCapability8, useIntentDispatcher as useIntentDispatcher6, usePluginManager } from "@dxos/app-framework";
|
|
838
822
|
import { AttentionCapabilities } from "@dxos/plugin-attention";
|
|
839
823
|
import { Main as Main3, useMediaQuery, useOnTransition } from "@dxos/react-ui";
|
|
840
824
|
import { Stack, StackContext, DEFAULT_HORIZONTAL_SIZE } from "@dxos/react-ui-stack";
|
|
@@ -842,12 +826,12 @@ import { mainPaddingTransitions } from "@dxos/react-ui-theme";
|
|
|
842
826
|
|
|
843
827
|
// packages/plugins/plugin-deck/src/components/DeckLayout/ActiveNode.tsx
|
|
844
828
|
import React10 from "react";
|
|
845
|
-
import { Surface as Surface6, useAppGraph as
|
|
829
|
+
import { Surface as Surface6, useAppGraph as useAppGraph3 } from "@dxos/app-framework";
|
|
846
830
|
import { useNode as useNode2 } from "@dxos/plugin-graph";
|
|
847
831
|
import { useAttended } from "@dxos/react-ui-attention";
|
|
848
832
|
var ActiveNode = () => {
|
|
849
833
|
const [id] = useAttended();
|
|
850
|
-
const { graph } =
|
|
834
|
+
const { graph } = useAppGraph3();
|
|
851
835
|
const activeNode = useNode2(graph, id);
|
|
852
836
|
useNodeActionExpander(activeNode);
|
|
853
837
|
return /* @__PURE__ */ React10.createElement("div", {
|
|
@@ -872,7 +856,7 @@ var ContentEmpty = () => {
|
|
|
872
856
|
const topbar = layoutAppliesTopbar(breakpoint, layoutMode);
|
|
873
857
|
return /* @__PURE__ */ React11.createElement("div", {
|
|
874
858
|
role: "none",
|
|
875
|
-
className: "grid place-items-center p-8 relative bg-
|
|
859
|
+
className: "grid place-items-center p-8 relative bg-deckSurface",
|
|
876
860
|
"data-testid": "layoutPlugin.firstRunMessage"
|
|
877
861
|
}, /* @__PURE__ */ React11.createElement(Surface7, {
|
|
878
862
|
role: "keyshortcuts"
|
|
@@ -916,7 +900,7 @@ var Dialog = () => {
|
|
|
916
900
|
|
|
917
901
|
// packages/plugins/plugin-deck/src/components/DeckLayout/Popover.tsx
|
|
918
902
|
import { createContext } from "@radix-ui/react-context";
|
|
919
|
-
import React13, { useCallback as
|
|
903
|
+
import React13, { useCallback as useCallback6, useEffect as useEffect4, useMemo as useMemo5, useRef as useRef2, useState as useState3 } from "react";
|
|
920
904
|
import { Surface as Surface9, useCapability as useCapability7 } from "@dxos/app-framework";
|
|
921
905
|
import { Popover as Popover2 } from "@dxos/react-ui";
|
|
922
906
|
var DEBOUNCE_DELAY = 40;
|
|
@@ -927,7 +911,7 @@ var PopoverRoot = ({ children }) => {
|
|
|
927
911
|
const [virtualIter, setVirtualIter] = useState3(0);
|
|
928
912
|
const [open, setOpen] = useState3(false);
|
|
929
913
|
const debounceRef = useRef2(null);
|
|
930
|
-
|
|
914
|
+
useEffect4(() => {
|
|
931
915
|
setOpen(false);
|
|
932
916
|
if (layout.popoverOpen) {
|
|
933
917
|
if (debounceRef.current) {
|
|
@@ -958,7 +942,7 @@ var PopoverRoot = ({ children }) => {
|
|
|
958
942
|
var PopoverContent = () => {
|
|
959
943
|
const layout = useCapability7(DeckCapabilities.MutableDeckState);
|
|
960
944
|
const { setOpen } = useDeckPopoverContext("PopoverContent");
|
|
961
|
-
const handleClose =
|
|
945
|
+
const handleClose = useCallback6((event) => {
|
|
962
946
|
if (
|
|
963
947
|
// TODO(thure): CodeMirror should not focus itself when it updates.
|
|
964
948
|
event.type === "dismissableLayer.focusOutside" && event.currentTarget?.classList.contains("cm-content")
|
|
@@ -1017,7 +1001,7 @@ var StatusBar = ({ showHints }) => {
|
|
|
1017
1001
|
|
|
1018
1002
|
// packages/plugins/plugin-deck/src/components/DeckLayout/Toast.tsx
|
|
1019
1003
|
import React15 from "react";
|
|
1020
|
-
import { Button
|
|
1004
|
+
import { Button, Icon as Icon2, Toast as NaturalToast, toLocalizedString as toLocalizedString3, useTranslation as useTranslation7 } from "@dxos/react-ui";
|
|
1021
1005
|
var Toast = ({ id, title, description, icon, duration, actionLabel, actionAlt, closeLabel, onAction, onOpenChange }) => {
|
|
1022
1006
|
const { t } = useTranslation7(DECK_PLUGIN);
|
|
1023
1007
|
return /* @__PURE__ */ React15.createElement(NaturalToast.Root, {
|
|
@@ -1027,20 +1011,20 @@ var Toast = ({ id, title, description, icon, duration, actionLabel, actionAlt, c
|
|
|
1027
1011
|
onOpenChange
|
|
1028
1012
|
}, /* @__PURE__ */ React15.createElement(NaturalToast.Body, null, /* @__PURE__ */ React15.createElement(NaturalToast.Title, {
|
|
1029
1013
|
classNames: "items-center"
|
|
1030
|
-
}, icon && /* @__PURE__ */ React15.createElement(
|
|
1014
|
+
}, icon && /* @__PURE__ */ React15.createElement(Icon2, {
|
|
1031
1015
|
icon,
|
|
1032
1016
|
size: 5,
|
|
1033
1017
|
classNames: "inline mr-1"
|
|
1034
1018
|
}), 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, {
|
|
1035
1019
|
altText: toLocalizedString3(actionAlt, t),
|
|
1036
1020
|
asChild: true
|
|
1037
|
-
}, /* @__PURE__ */ React15.createElement(
|
|
1021
|
+
}, /* @__PURE__ */ React15.createElement(Button, {
|
|
1038
1022
|
"data-testid": "toast.action",
|
|
1039
1023
|
variant: "primary",
|
|
1040
1024
|
onClick: () => onAction?.()
|
|
1041
1025
|
}, toLocalizedString3(actionLabel, t))), closeLabel && /* @__PURE__ */ React15.createElement(NaturalToast.Close, {
|
|
1042
1026
|
asChild: true
|
|
1043
|
-
}, /* @__PURE__ */ React15.createElement(
|
|
1027
|
+
}, /* @__PURE__ */ React15.createElement(Button, {
|
|
1044
1028
|
"data-testid": "toast.close"
|
|
1045
1029
|
}, toLocalizedString3(closeLabel, t)))));
|
|
1046
1030
|
};
|
|
@@ -1056,13 +1040,13 @@ var Topbar = () => {
|
|
|
1056
1040
|
// packages/plugins/plugin-deck/src/components/DeckLayout/DeckLayout.tsx
|
|
1057
1041
|
var PlankSeparator = ({ order }) => order > 0 ? /* @__PURE__ */ React17.createElement("span", {
|
|
1058
1042
|
role: "separator",
|
|
1059
|
-
className: "row-span-2 bg-
|
|
1043
|
+
className: "row-span-2 bg-deckSurface is-4",
|
|
1060
1044
|
style: {
|
|
1061
1045
|
gridColumn: order
|
|
1062
1046
|
}
|
|
1063
1047
|
}) : null;
|
|
1064
1048
|
var DeckLayout = ({ onDismissToast }) => {
|
|
1065
|
-
const { dispatchPromise: dispatch } =
|
|
1049
|
+
const { dispatchPromise: dispatch } = useIntentDispatcher6();
|
|
1066
1050
|
const settings = useCapability8(Capabilities.SettingsStore).getStore(DECK_PLUGIN).value;
|
|
1067
1051
|
const context = useCapability8(DeckCapabilities.MutableDeckState);
|
|
1068
1052
|
const { sidebarState, complementarySidebarState, complementarySidebarPanel, deck, toasts } = context;
|
|
@@ -1074,9 +1058,9 @@ var DeckLayout = ({ onDismissToast }) => {
|
|
|
1074
1058
|
const pluginManager = usePluginManager();
|
|
1075
1059
|
const scrollLeftRef = useRef3();
|
|
1076
1060
|
const deckRef = useRef3(null);
|
|
1077
|
-
|
|
1061
|
+
useEffect5(() => {
|
|
1078
1062
|
const attended = untracked(() => {
|
|
1079
|
-
const attention = pluginManager.context.
|
|
1063
|
+
const attention = pluginManager.context.getCapability(AttentionCapabilities.Attention);
|
|
1080
1064
|
return attention.current;
|
|
1081
1065
|
});
|
|
1082
1066
|
const firstId = solo ?? active[0];
|
|
@@ -1088,14 +1072,14 @@ var DeckLayout = ({ onDismissToast }) => {
|
|
|
1088
1072
|
ssr: false
|
|
1089
1073
|
});
|
|
1090
1074
|
const shouldRevert = useRef3(false);
|
|
1091
|
-
|
|
1075
|
+
useEffect5(() => {
|
|
1092
1076
|
if (!isNotMobile && getMode(deck) === "deck") {
|
|
1093
1077
|
const attended = untracked(() => {
|
|
1094
|
-
const attention = pluginManager.context.
|
|
1078
|
+
const attention = pluginManager.context.getCapability(AttentionCapabilities.Attention);
|
|
1095
1079
|
return attention.current;
|
|
1096
1080
|
});
|
|
1097
1081
|
shouldRevert.current = true;
|
|
1098
|
-
void dispatch(
|
|
1082
|
+
void dispatch(createIntent6(LayoutAction5.SetLayoutMode, {
|
|
1099
1083
|
part: "mode",
|
|
1100
1084
|
subject: attended[0],
|
|
1101
1085
|
options: {
|
|
@@ -1103,7 +1087,7 @@ var DeckLayout = ({ onDismissToast }) => {
|
|
|
1103
1087
|
}
|
|
1104
1088
|
}));
|
|
1105
1089
|
} else if (isNotMobile && getMode(deck) === "solo" && shouldRevert.current) {
|
|
1106
|
-
void dispatch(
|
|
1090
|
+
void dispatch(createIntent6(LayoutAction5.SetLayoutMode, {
|
|
1107
1091
|
part: "mode",
|
|
1108
1092
|
options: {
|
|
1109
1093
|
revert: true
|
|
@@ -1115,9 +1099,9 @@ var DeckLayout = ({ onDismissToast }) => {
|
|
|
1115
1099
|
deck,
|
|
1116
1100
|
dispatch
|
|
1117
1101
|
]);
|
|
1118
|
-
|
|
1119
|
-
if (!settings.enableDeck) {
|
|
1120
|
-
void dispatch(
|
|
1102
|
+
useEffect5(() => {
|
|
1103
|
+
if (!settings.enableDeck && layoutMode === "deck") {
|
|
1104
|
+
void dispatch(createIntent6(LayoutAction5.SetLayoutMode, {
|
|
1121
1105
|
part: "mode",
|
|
1122
1106
|
subject: active[0],
|
|
1123
1107
|
options: {
|
|
@@ -1128,24 +1112,25 @@ var DeckLayout = ({ onDismissToast }) => {
|
|
|
1128
1112
|
}, [
|
|
1129
1113
|
settings.enableDeck,
|
|
1130
1114
|
dispatch,
|
|
1131
|
-
active
|
|
1115
|
+
active,
|
|
1116
|
+
layoutMode
|
|
1132
1117
|
]);
|
|
1133
|
-
const handleResize =
|
|
1118
|
+
const handleResize = useCallback7(() => {
|
|
1134
1119
|
scrollLeftRef.current = null;
|
|
1135
1120
|
}, []);
|
|
1136
|
-
|
|
1121
|
+
useEffect5(() => {
|
|
1137
1122
|
window.addEventListener("resize", handleResize);
|
|
1138
1123
|
return () => window.removeEventListener("resize", handleResize);
|
|
1139
1124
|
}, [
|
|
1140
1125
|
handleResize
|
|
1141
1126
|
]);
|
|
1142
|
-
const restoreScroll =
|
|
1127
|
+
const restoreScroll = useCallback7(() => {
|
|
1143
1128
|
if (deckRef.current && scrollLeftRef.current != null) {
|
|
1144
1129
|
deckRef.current.scrollLeft = scrollLeftRef.current;
|
|
1145
1130
|
}
|
|
1146
1131
|
}, []);
|
|
1147
1132
|
useOnTransition(layoutMode, (mode) => mode !== "deck", "deck", restoreScroll);
|
|
1148
|
-
const handleScroll =
|
|
1133
|
+
const handleScroll = useCallback7((event) => {
|
|
1149
1134
|
if (!solo && event.currentTarget === event.target) {
|
|
1150
1135
|
scrollLeftRef.current = event.target.scrollLeft;
|
|
1151
1136
|
}
|
|
@@ -1197,8 +1182,8 @@ var DeckLayout = ({ onDismissToast }) => {
|
|
|
1197
1182
|
classNames: mainPosition
|
|
1198
1183
|
}, /* @__PURE__ */ React17.createElement(ContentEmpty, null)), !isEmpty && /* @__PURE__ */ React17.createElement(Main3.Content, {
|
|
1199
1184
|
bounce: true,
|
|
1200
|
-
classNames: mainPosition,
|
|
1201
1185
|
handlesFocus: true,
|
|
1186
|
+
classNames: mainPosition,
|
|
1202
1187
|
style: {
|
|
1203
1188
|
"--dx-main-sidebarWidth": sidebarState === "expanded" ? "var(--nav-sidebar-size)" : sidebarState === "collapsed" ? "var(--l0-size)" : "0",
|
|
1204
1189
|
"--dx-main-complementaryWidth": complementarySidebarState === "expanded" ? "var(--complementary-sidebar-size)" : complementarySidebarState === "collapsed" ? "var(--rail-size)" : "0",
|
|
@@ -1207,7 +1192,7 @@ var DeckLayout = ({ onDismissToast }) => {
|
|
|
1207
1192
|
}
|
|
1208
1193
|
}, /* @__PURE__ */ React17.createElement("div", {
|
|
1209
1194
|
role: "none",
|
|
1210
|
-
className: !solo ? "relative bg-
|
|
1195
|
+
className: !solo ? "relative bg-deckSurface overflow-hidden" : "sr-only",
|
|
1211
1196
|
...solo && {
|
|
1212
1197
|
inert: ""
|
|
1213
1198
|
}
|
|
@@ -1226,7 +1211,7 @@ var DeckLayout = ({ onDismissToast }) => {
|
|
|
1226
1211
|
itemsCount: itemsCount - 1,
|
|
1227
1212
|
style: padding,
|
|
1228
1213
|
onScroll: handleScroll
|
|
1229
|
-
}, active.map((entryId) => /* @__PURE__ */ React17.createElement(
|
|
1214
|
+
}, active.map((entryId) => /* @__PURE__ */ React17.createElement(Fragment3, {
|
|
1230
1215
|
key: entryId
|
|
1231
1216
|
}, /* @__PURE__ */ React17.createElement(PlankSeparator, {
|
|
1232
1217
|
order: order[entryId] - 1
|
|
@@ -1240,7 +1225,7 @@ var DeckLayout = ({ onDismissToast }) => {
|
|
|
1240
1225
|
settings
|
|
1241
1226
|
}))))), /* @__PURE__ */ React17.createElement("div", {
|
|
1242
1227
|
role: "none",
|
|
1243
|
-
className: solo ? "relative bg-
|
|
1228
|
+
className: solo ? "relative bg-deckSurface overflow-hidden" : "sr-only",
|
|
1244
1229
|
...!solo && {
|
|
1245
1230
|
inert: ""
|
|
1246
1231
|
}
|
|
@@ -1331,4 +1316,4 @@ export {
|
|
|
1331
1316
|
DeckLayout,
|
|
1332
1317
|
DeckSettings
|
|
1333
1318
|
};
|
|
1334
|
-
//# sourceMappingURL=chunk-
|
|
1319
|
+
//# sourceMappingURL=chunk-KIGMELV2.mjs.map
|