@dxos/plugin-deck 0.8.2-main.fbd8ed0 → 0.8.2-staging.7ac8446
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-R7COZ4A6.mjs → app-graph-builder-VYZ4IWI3.mjs} +15 -16
- package/dist/lib/browser/app-graph-builder-VYZ4IWI3.mjs.map +7 -0
- package/dist/lib/browser/{check-app-scheme-7AXGR6UT.mjs → check-app-scheme-SEYECDHI.mjs} +3 -2
- package/dist/lib/browser/check-app-scheme-SEYECDHI.mjs.map +7 -0
- package/dist/lib/browser/chunk-6ZSOFCPP.mjs +117 -0
- package/dist/lib/browser/chunk-6ZSOFCPP.mjs.map +7 -0
- package/dist/lib/browser/chunk-B4LOJUWW.mjs +24 -0
- package/dist/lib/browser/chunk-B4LOJUWW.mjs.map +7 -0
- package/dist/lib/browser/{chunk-KIGMELV2.mjs → chunk-FJBMNSUC.mjs} +336 -366
- 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-RJNCG4ND.mjs +154 -0
- package/dist/lib/browser/chunk-RJNCG4ND.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +5 -6
- package/dist/lib/browser/index.mjs.map +2 -2
- package/dist/lib/browser/{intent-resolver-MAKOS57L.mjs → intent-resolver-UDYKO2QW.mjs} +89 -130
- 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-DGQVIHXP.mjs → react-root-XLXN2VEW.mjs} +6 -6
- package/dist/lib/browser/{react-surface-PXBXIOPU.mjs → react-surface-WNGMZL7I.mjs} +6 -6
- package/dist/lib/browser/{settings-UBWJF7J7.mjs → settings-HMDGSBGO.mjs} +6 -6
- package/dist/lib/browser/settings-HMDGSBGO.mjs.map +7 -0
- package/dist/lib/browser/{chunk-OF5RIATN.mjs → state-7TN26M42.mjs} +7 -10
- package/dist/lib/browser/state-7TN26M42.mjs.map +7 -0
- package/dist/lib/browser/{tools-IVPIPTVA.mjs → tools-SC6QEN7R.mjs} +7 -7
- package/dist/lib/browser/tools-SC6QEN7R.mjs.map +7 -0
- package/dist/lib/browser/types.mjs +1 -1
- package/dist/lib/browser/{url-handler-JSYGSVSB.mjs → url-handler-ODG4B6NX.mjs} +4 -4
- package/dist/lib/browser/url-handler-ODG4B6NX.mjs.map +7 -0
- package/dist/types/src/capabilities/app-graph-builder.d.ts +179 -2
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/capabilities/capabilities.d.ts +6 -8
- package/dist/types/src/capabilities/capabilities.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 +182 -7
- 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 +6 -7
- 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/Fullscreen.d.ts +5 -0
- package/dist/types/src/components/DeckLayout/Fullscreen.d.ts.map +1 -0
- 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 +5 -18
- 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 +2 -3
- 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 +2 -3
- 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 +1 -2
- package/dist/types/src/components/Sidebar/SidebarButton.d.ts.map +1 -1
- package/dist/types/src/hooks/index.d.ts +1 -5
- package/dist/types/src/hooks/index.d.ts.map +1 -1
- 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/translations.d.ts +0 -2
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types.d.ts +104 -106
- package/dist/types/src/types.d.ts.map +1 -1
- package/dist/types/src/util/index.d.ts +4 -1
- package/dist/types/src/util/index.d.ts.map +1 -1
- package/dist/types/src/util/layoutAppliesTopbar.d.ts +1 -2
- 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/src/util/useBreakpoints.d.ts.map +1 -0
- package/dist/types/src/util/useCompanions.d.ts.map +1 -0
- package/dist/types/src/util/useHoistStatusbar.d.ts +2 -0
- package/dist/types/src/util/useHoistStatusbar.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +29 -36
- package/src/capabilities/app-graph-builder.ts +92 -120
- package/src/capabilities/check-app-scheme.ts +7 -3
- package/src/capabilities/index.ts +2 -3
- package/src/capabilities/intent-resolver.ts +133 -175
- package/src/capabilities/settings.ts +4 -4
- package/src/capabilities/state.ts +4 -7
- package/src/capabilities/tools.ts +3 -4
- package/src/capabilities/url-handler.ts +4 -4
- package/src/components/DeckLayout/ContentEmpty.tsx +4 -9
- package/src/components/DeckLayout/DeckLayout.tsx +188 -123
- package/src/components/DeckLayout/Fullscreen.tsx +31 -0
- package/src/components/Plank/Plank.stories.tsx +8 -20
- package/src/components/Plank/Plank.tsx +68 -104
- package/src/components/Plank/PlankControls.tsx +57 -53
- package/src/components/Plank/PlankError.tsx +6 -2
- package/src/components/Plank/PlankHeading.tsx +12 -29
- package/src/components/Sidebar/ComplementarySidebar.tsx +54 -33
- package/src/components/Sidebar/Sidebar.tsx +4 -7
- package/src/components/Sidebar/SidebarButton.tsx +7 -30
- package/src/components/fragments.ts +1 -1
- package/src/hooks/index.ts +1 -5
- package/src/hooks/useNodeActionExpander.ts +8 -3
- package/src/index.ts +1 -1
- package/src/translations.ts +0 -2
- package/src/types.ts +71 -75
- package/src/util/index.ts +4 -1
- package/src/util/layoutAppliesTopbar.ts +2 -8
- package/src/{hooks → util}/useCompanions.ts +3 -3
- package/src/{hooks → util}/useHoistStatusbar.ts +4 -9
- package/dist/lib/browser/app-graph-builder-R7COZ4A6.mjs.map +0 -7
- package/dist/lib/browser/check-app-scheme-7AXGR6UT.mjs.map +0 -7
- package/dist/lib/browser/chunk-3O2UZVBA.mjs +0 -121
- package/dist/lib/browser/chunk-3O2UZVBA.mjs.map +0 -7
- package/dist/lib/browser/chunk-JAYQ5BTF.mjs +0 -157
- package/dist/lib/browser/chunk-JAYQ5BTF.mjs.map +0 -7
- package/dist/lib/browser/chunk-KIGMELV2.mjs.map +0 -7
- package/dist/lib/browser/chunk-OF5RIATN.mjs.map +0 -7
- package/dist/lib/browser/chunk-TRFYUEBA.mjs +0 -145
- package/dist/lib/browser/chunk-TRFYUEBA.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-MAKOS57L.mjs.map +0 -7
- package/dist/lib/browser/settings-UBWJF7J7.mjs.map +0 -7
- package/dist/lib/browser/state-4WFB4SDO.mjs +0 -10
- package/dist/lib/browser/state-4WFB4SDO.mjs.map +0 -7
- package/dist/lib/browser/tools-IVPIPTVA.mjs.map +0 -7
- package/dist/lib/browser/url-handler-JSYGSVSB.mjs.map +0 -7
- package/dist/types/src/components/DeckLayout/Dialog.d.ts +0 -3
- package/dist/types/src/components/DeckLayout/Dialog.d.ts.map +0 -1
- package/dist/types/src/components/DeckLayout/Popover.d.ts +0 -5
- package/dist/types/src/components/DeckLayout/Popover.d.ts.map +0 -1
- package/dist/types/src/hooks/useBreakpoints.d.ts.map +0 -1
- package/dist/types/src/hooks/useCompanions.d.ts.map +0 -1
- package/dist/types/src/hooks/useDeckCompanions.d.ts +0 -13
- package/dist/types/src/hooks/useDeckCompanions.d.ts.map +0 -1
- package/dist/types/src/hooks/useHoistStatusbar.d.ts +0 -3
- package/dist/types/src/hooks/useHoistStatusbar.d.ts.map +0 -1
- package/src/components/DeckLayout/Dialog.tsx +0 -36
- package/src/components/DeckLayout/Popover.tsx +0 -104
- package/src/hooks/useDeckCompanions.ts +0 -33
- /package/dist/lib/browser/{react-root-DGQVIHXP.mjs.map → react-root-XLXN2VEW.mjs.map} +0 -0
- /package/dist/lib/browser/{react-surface-PXBXIOPU.mjs.map → react-surface-WNGMZL7I.mjs.map} +0 -0
- /package/dist/types/src/{hooks → util}/useBreakpoints.d.ts +0 -0
- /package/dist/types/src/{hooks → util}/useCompanions.d.ts +0 -0
- /package/src/{hooks → util}/useBreakpoints.ts +0 -0
|
@@ -1,27 +1,25 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
useCompanions,
|
|
5
|
-
useDeckCompanions,
|
|
6
|
-
useHoistStatusbar,
|
|
7
|
-
useMainSize,
|
|
8
|
-
useNodeActionExpander
|
|
9
|
-
} from "./chunk-3O2UZVBA.mjs";
|
|
2
|
+
parseEntryId
|
|
3
|
+
} from "./chunk-FLOVGNYB.mjs";
|
|
10
4
|
import {
|
|
11
5
|
calculateOverscroll,
|
|
12
6
|
layoutAppliesTopbar,
|
|
13
|
-
|
|
14
|
-
|
|
7
|
+
useBreakpoints,
|
|
8
|
+
useCompanions,
|
|
9
|
+
useHoistStatusbar
|
|
10
|
+
} from "./chunk-6ZSOFCPP.mjs";
|
|
15
11
|
import {
|
|
16
12
|
DeckCapabilities
|
|
17
13
|
} from "./chunk-XMCG42ID.mjs";
|
|
18
14
|
import {
|
|
15
|
+
ATTENDABLE_PATH_SEPARATOR,
|
|
16
|
+
DECK_COMPANION_TYPE,
|
|
19
17
|
DeckAction,
|
|
20
18
|
NewPlankPositions,
|
|
21
19
|
OverscrollOptions,
|
|
22
20
|
PLANK_COMPANION_TYPE,
|
|
23
21
|
getMode
|
|
24
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-RJNCG4ND.mjs";
|
|
25
23
|
import {
|
|
26
24
|
DECK_PLUGIN
|
|
27
25
|
} from "./chunk-NSATFAEE.mjs";
|
|
@@ -33,14 +31,15 @@ import { useTranslation as useTranslation6 } from "@dxos/react-ui";
|
|
|
33
31
|
import { mx as mx4 } from "@dxos/react-ui-theme";
|
|
34
32
|
|
|
35
33
|
// packages/plugins/plugin-deck/src/components/Sidebar/ComplementarySidebar.tsx
|
|
36
|
-
import React7, { Fragment as
|
|
37
|
-
import { LayoutAction as
|
|
38
|
-
import { Main, useTranslation as useTranslation5, toLocalizedString as toLocalizedString2, IconButton as
|
|
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";
|
|
39
37
|
import { Tabs } from "@dxos/react-ui-tabs";
|
|
38
|
+
import { byPosition } from "@dxos/util";
|
|
40
39
|
|
|
41
40
|
// packages/plugins/plugin-deck/src/components/Sidebar/SidebarButton.tsx
|
|
42
|
-
import React
|
|
43
|
-
import {
|
|
41
|
+
import React from "react";
|
|
42
|
+
import { useCapability } from "@dxos/app-framework";
|
|
44
43
|
import { IconButton, useTranslation } from "@dxos/react-ui";
|
|
45
44
|
var ToggleSidebarButton = ({ classNames, variant = "ghost" }) => {
|
|
46
45
|
const layoutContext = useCapability(DeckCapabilities.MutableDeckState);
|
|
@@ -68,30 +67,12 @@ var CloseSidebarButton = () => {
|
|
|
68
67
|
classNames: "rounded-none pli-1 dx-focus-ring-inset pie-[max(.5rem,env(safe-area-inset-left))]"
|
|
69
68
|
});
|
|
70
69
|
};
|
|
71
|
-
var ToggleComplementarySidebarButton = ({ inR0, classNames
|
|
72
|
-
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
70
|
+
var ToggleComplementarySidebarButton = ({ inR0, classNames }) => {
|
|
73
71
|
const layoutContext = useCapability(DeckCapabilities.MutableDeckState);
|
|
74
72
|
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
|
-
]);
|
|
91
73
|
return /* @__PURE__ */ React.createElement(IconButton, {
|
|
92
|
-
noTooltip: true,
|
|
93
74
|
iconOnly: true,
|
|
94
|
-
onClick:
|
|
75
|
+
onClick: () => layoutContext.complementarySidebarState = layoutContext.complementarySidebarState === "expanded" ? "collapsed" : "expanded",
|
|
95
76
|
variant: "ghost",
|
|
96
77
|
label: t("open complementary sidebar label"),
|
|
97
78
|
classNames: [
|
|
@@ -105,59 +86,62 @@ var ToggleComplementarySidebarButton = ({ inR0, classNames, current }) => {
|
|
|
105
86
|
};
|
|
106
87
|
|
|
107
88
|
// packages/plugins/plugin-deck/src/components/Plank/Plank.tsx
|
|
108
|
-
import React6, { memo as memo2, useCallback as
|
|
109
|
-
import { LayoutAction as
|
|
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";
|
|
110
91
|
import { debounce } from "@dxos/async";
|
|
111
92
|
import { useNode } from "@dxos/plugin-graph";
|
|
112
|
-
import { ATTENDABLE_PATH_SEPARATOR, useAttendableAttributes } from "@dxos/react-ui-attention";
|
|
93
|
+
import { ATTENDABLE_PATH_SEPARATOR as ATTENDABLE_PATH_SEPARATOR2, useAttendableAttributes } from "@dxos/react-ui-attention";
|
|
113
94
|
import { StackItem as StackItem2, railGridHorizontal } from "@dxos/react-ui-stack";
|
|
114
95
|
import { mainIntrinsicSize, mx as mx3 } from "@dxos/react-ui-theme";
|
|
115
96
|
|
|
116
97
|
// packages/plugins/plugin-deck/src/components/Plank/PlankError.tsx
|
|
117
98
|
import React5, { useEffect as useEffect2, useState } from "react";
|
|
118
99
|
import { useTranslation as useTranslation4 } from "@dxos/react-ui";
|
|
119
|
-
import {
|
|
100
|
+
import { descriptionText, mx as mx2 } from "@dxos/react-ui-theme";
|
|
120
101
|
|
|
121
102
|
// packages/plugins/plugin-deck/src/components/Plank/PlankHeading.tsx
|
|
122
|
-
import React3, { Fragment, memo, useCallback as
|
|
123
|
-
import { createIntent as
|
|
124
|
-
import { Icon, IconButton as
|
|
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";
|
|
125
106
|
import { StackItem } from "@dxos/react-ui-stack";
|
|
126
107
|
import { TextTooltip } from "@dxos/react-ui-text-tooltip";
|
|
127
|
-
import { hoverableControls, hoverableFocusedWithinControls } from "@dxos/react-ui-theme";
|
|
128
108
|
|
|
129
109
|
// packages/plugins/plugin-deck/src/components/Plank/PlankControls.tsx
|
|
130
|
-
import React2, { forwardRef, useCallback
|
|
131
|
-
import { createIntent
|
|
110
|
+
import React2, { forwardRef, useCallback } from "react";
|
|
111
|
+
import { createIntent, useIntentDispatcher } from "@dxos/app-framework";
|
|
132
112
|
import { invariant } from "@dxos/invariant";
|
|
133
|
-
import { ButtonGroup,
|
|
113
|
+
import { Button, ButtonGroup, Icon, Tooltip, useTranslation as useTranslation2 } from "@dxos/react-ui";
|
|
134
114
|
var __dxlog_file = "/home/runner/work/dxos/dxos/packages/plugins/plugin-deck/src/components/Plank/PlankControls.tsx";
|
|
135
115
|
var PlankControl = ({ icon, label: label3, ...props }) => {
|
|
136
|
-
return /* @__PURE__ */ React2.createElement(
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
icon,
|
|
140
|
-
size: 5,
|
|
116
|
+
return /* @__PURE__ */ React2.createElement(Tooltip.Root, null, /* @__PURE__ */ React2.createElement(Tooltip.Trigger, {
|
|
117
|
+
asChild: true
|
|
118
|
+
}, /* @__PURE__ */ React2.createElement(Button, {
|
|
141
119
|
variant: "ghost",
|
|
142
|
-
tooltipSide: "bottom",
|
|
143
120
|
...props
|
|
144
|
-
}
|
|
121
|
+
}, /* @__PURE__ */ React2.createElement("span", {
|
|
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)));
|
|
145
129
|
};
|
|
146
|
-
var plankControlSpacing = "pli-2";
|
|
130
|
+
var plankControlSpacing = "pli-2 plb-3";
|
|
147
131
|
var PlankCompanionControls = /* @__PURE__ */ forwardRef(({ primary }, forwardedRef) => {
|
|
148
132
|
const { t } = useTranslation2(DECK_PLUGIN);
|
|
149
|
-
const { dispatchPromise: dispatch } =
|
|
150
|
-
const handleCloseCompanion =
|
|
133
|
+
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
134
|
+
const handleCloseCompanion = useCallback(() => {
|
|
151
135
|
invariant(primary, void 0, {
|
|
152
136
|
F: __dxlog_file,
|
|
153
|
-
L:
|
|
137
|
+
L: 68,
|
|
154
138
|
S: void 0,
|
|
155
139
|
A: [
|
|
156
140
|
"primary",
|
|
157
141
|
""
|
|
158
142
|
]
|
|
159
143
|
});
|
|
160
|
-
return dispatch(
|
|
144
|
+
return dispatch(createIntent(DeckAction.ChangeCompanion, {
|
|
161
145
|
primary,
|
|
162
146
|
companion: null
|
|
163
147
|
}));
|
|
@@ -168,33 +152,28 @@ var PlankCompanionControls = /* @__PURE__ */ forwardRef(({ primary }, forwardedR
|
|
|
168
152
|
}, /* @__PURE__ */ React2.createElement(PlankControl, {
|
|
169
153
|
label: t("close companion label"),
|
|
170
154
|
variant: "ghost",
|
|
171
|
-
icon
|
|
155
|
+
// icon='ph--minus--regular'
|
|
156
|
+
icon: "ph--caret-left--regular",
|
|
172
157
|
onClick: handleCloseCompanion,
|
|
173
158
|
classNames: plankControlSpacing
|
|
174
159
|
}));
|
|
175
160
|
});
|
|
176
|
-
var PlankControls = /* @__PURE__ */ forwardRef(({ children, classNames, variant = "default", capabilities,
|
|
161
|
+
var PlankControls = /* @__PURE__ */ forwardRef(({ children, classNames, variant = "default", capabilities, isSolo, pin, close = false, onClick, ...props }, forwardedRef) => {
|
|
177
162
|
const { t } = useTranslation2(DECK_PLUGIN);
|
|
178
163
|
const buttonClassNames = variant === "hide-disabled" ? `disabled:hidden ${plankControlSpacing}` : plankControlSpacing;
|
|
179
|
-
const layoutIsAnySolo = !!layoutMode?.startsWith("solo");
|
|
180
164
|
return /* @__PURE__ */ React2.createElement(ButtonGroup, {
|
|
181
165
|
...props,
|
|
182
166
|
classNames: [
|
|
183
|
-
"app-no-drag
|
|
167
|
+
"app-no-drag",
|
|
184
168
|
classNames
|
|
185
169
|
],
|
|
186
170
|
ref: forwardedRef
|
|
187
|
-
}, capabilities.deck
|
|
188
|
-
label: t("show
|
|
171
|
+
}, capabilities.deck && capabilities.solo && /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(PlankControl, {
|
|
172
|
+
label: isSolo ? t("show deck plank label") : t("show solo plank label"),
|
|
189
173
|
classNames: buttonClassNames,
|
|
190
|
-
icon: "ph--corners-out--regular",
|
|
191
|
-
onClick: () => onClick?.("solo
|
|
192
|
-
}), /* @__PURE__ */ React2.createElement(PlankControl, {
|
|
193
|
-
label: t(layoutMode === "solo--fullscreen" ? "exit fullscreen label" : layoutIsAnySolo ? "show deck plank label" : "show solo plank label"),
|
|
194
|
-
classNames: buttonClassNames,
|
|
195
|
-
icon: layoutMode === "solo--fullscreen" ? "ph--corners-in--regular" : layoutIsAnySolo ? "ph--arrows-in-line-horizontal--regular" : "ph--arrows-out-line-horizontal--regular",
|
|
196
|
-
onClick: () => onClick?.(layoutMode === "solo--fullscreen" ? "solo--fullscreen" : "solo")
|
|
197
|
-
})), !layoutIsAnySolo && /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(PlankControl, {
|
|
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, {
|
|
198
177
|
label: t("increment start label"),
|
|
199
178
|
disabled: !capabilities.incrementStart,
|
|
200
179
|
classNames: buttonClassNames,
|
|
@@ -206,12 +185,7 @@ var PlankControls = /* @__PURE__ */ forwardRef(({ children, classNames, variant
|
|
|
206
185
|
classNames: buttonClassNames,
|
|
207
186
|
icon: "ph--caret-right--regular",
|
|
208
187
|
onClick: () => onClick?.("increment-end")
|
|
209
|
-
})))
|
|
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, {
|
|
188
|
+
}))), close && !isSolo && /* @__PURE__ */ React2.createElement(PlankControl, {
|
|
215
189
|
label: t(`${typeof close === "string" ? "minify" : "close"} label`),
|
|
216
190
|
classNames: buttonClassNames,
|
|
217
191
|
"data-testid": "plankHeading.close",
|
|
@@ -229,15 +203,14 @@ var PlankControls = /* @__PURE__ */ forwardRef(({ children, classNames, variant
|
|
|
229
203
|
// packages/plugins/plugin-deck/src/components/fragments.ts
|
|
230
204
|
import { mx } from "@dxos/react-ui-theme";
|
|
231
205
|
var soloInlinePadding = "pis-[calc(env(safe-area-inset-left)+.25rem)] pie-[calc(env(safe-area-inset-left)+.25rem)]";
|
|
232
|
-
var sidebarToggleStyles = "bs-[--rail-item] is-[--rail-item] absolute block-end-2 z-[1] !bg-
|
|
206
|
+
var sidebarToggleStyles = "bs-[--rail-item] is-[--rail-item] absolute block-end-2 z-[1] !bg-deck lg:hidden";
|
|
233
207
|
var fixedSidebarToggleStyles = mx(sidebarToggleStyles, "inline-start-2");
|
|
234
208
|
var fixedComplementarySidebarToggleStyles = mx(sidebarToggleStyles, "inline-end-2");
|
|
235
209
|
|
|
236
210
|
// packages/plugins/plugin-deck/src/components/Plank/PlankHeading.tsx
|
|
237
|
-
var
|
|
238
|
-
var PlankHeading = /* @__PURE__ */ memo(({ id, part, node, deckEnabled, canIncrementStart, canIncrementEnd, popoverAnchorId, primaryId, pending, companioned, companions, layoutMode, actions = [] }) => {
|
|
211
|
+
var PlankHeading = /* @__PURE__ */ memo(({ id, part, node, deckEnabled, canIncrementStart, canIncrementEnd, popoverAnchorId, primaryId, pending, companioned, companions, actions = [] }) => {
|
|
239
212
|
const { t } = useTranslation3(DECK_PLUGIN);
|
|
240
|
-
const { dispatchPromise: dispatch } =
|
|
213
|
+
const { dispatchPromise: dispatch } = useIntentDispatcher2();
|
|
241
214
|
const { graph } = useAppGraph();
|
|
242
215
|
const breakpoint = useBreakpoints();
|
|
243
216
|
const icon = node?.properties?.icon ?? "ph--placeholder--regular";
|
|
@@ -250,7 +223,7 @@ var PlankHeading = /* @__PURE__ */ memo(({ id, part, node, deckEnabled, canIncre
|
|
|
250
223
|
const isCompanionNode = node?.type === PLANK_COMPANION_TYPE;
|
|
251
224
|
useEffect(() => {
|
|
252
225
|
const frame = requestAnimationFrame(() => {
|
|
253
|
-
node && graph.
|
|
226
|
+
node && graph.actions(node);
|
|
254
227
|
});
|
|
255
228
|
return () => cancelAnimationFrame(frame);
|
|
256
229
|
}, [
|
|
@@ -262,7 +235,6 @@ var PlankHeading = /* @__PURE__ */ memo(({ id, part, node, deckEnabled, canIncre
|
|
|
262
235
|
solo: breakpoint !== "mobile" && (part === "solo" || part === "deck"),
|
|
263
236
|
incrementStart: canIncrementStart,
|
|
264
237
|
incrementEnd: canIncrementEnd,
|
|
265
|
-
fullscreen: !isCompanionNode,
|
|
266
238
|
companion: !isCompanionNode && companions && companions.length > 0
|
|
267
239
|
}), [
|
|
268
240
|
breakpoint,
|
|
@@ -282,7 +254,7 @@ var PlankHeading = /* @__PURE__ */ memo(({ id, part, node, deckEnabled, canIncre
|
|
|
282
254
|
} else {
|
|
283
255
|
return [
|
|
284
256
|
actions,
|
|
285
|
-
graph.
|
|
257
|
+
graph.actions(node)
|
|
286
258
|
].filter((a) => a.length > 0);
|
|
287
259
|
}
|
|
288
260
|
}, [
|
|
@@ -291,30 +263,28 @@ var PlankHeading = /* @__PURE__ */ memo(({ id, part, node, deckEnabled, canIncre
|
|
|
291
263
|
variant,
|
|
292
264
|
graph
|
|
293
265
|
]);
|
|
294
|
-
const handleAction =
|
|
266
|
+
const handleAction = useCallback2((action) => {
|
|
295
267
|
typeof action.data === "function" && action.data?.({
|
|
296
|
-
|
|
268
|
+
node: action,
|
|
297
269
|
caller: DECK_PLUGIN
|
|
298
270
|
});
|
|
299
|
-
}, [
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
if (eventType.startsWith("solo")) {
|
|
304
|
-
return dispatch(createIntent3(DeckAction.Adjust, {
|
|
271
|
+
}, []);
|
|
272
|
+
const handlePlankAction = useCallback2((eventType) => {
|
|
273
|
+
if (eventType === "solo") {
|
|
274
|
+
return dispatch(createIntent2(DeckAction.Adjust, {
|
|
305
275
|
type: eventType,
|
|
306
276
|
id
|
|
307
277
|
}));
|
|
308
278
|
} else if (eventType === "close") {
|
|
309
279
|
if (part === "complementary") {
|
|
310
|
-
return dispatch(
|
|
280
|
+
return dispatch(createIntent2(LayoutAction.UpdateComplementary, {
|
|
311
281
|
part: "complementary",
|
|
312
282
|
options: {
|
|
313
283
|
state: "collapsed"
|
|
314
284
|
}
|
|
315
285
|
}));
|
|
316
286
|
} else {
|
|
317
|
-
return dispatch(
|
|
287
|
+
return dispatch(createIntent2(LayoutAction.Close, {
|
|
318
288
|
part: "main",
|
|
319
289
|
subject: [
|
|
320
290
|
id
|
|
@@ -325,7 +295,7 @@ var PlankHeading = /* @__PURE__ */ memo(({ id, part, node, deckEnabled, canIncre
|
|
|
325
295
|
}));
|
|
326
296
|
}
|
|
327
297
|
} else {
|
|
328
|
-
return dispatch(
|
|
298
|
+
return dispatch(createIntent2(DeckAction.Adjust, {
|
|
329
299
|
type: eventType,
|
|
330
300
|
id
|
|
331
301
|
}));
|
|
@@ -336,11 +306,11 @@ var PlankHeading = /* @__PURE__ */ memo(({ id, part, node, deckEnabled, canIncre
|
|
|
336
306
|
part
|
|
337
307
|
]);
|
|
338
308
|
const ActionRoot = node && popoverAnchorId === `dxos.org/ui/${DECK_PLUGIN}/${node.id}` ? Popover.Anchor : Fragment;
|
|
339
|
-
const handleTabClick =
|
|
309
|
+
const handleTabClick = useCallback2((event) => {
|
|
340
310
|
const target = event.target.closest("[data-id]");
|
|
341
311
|
const tabId = target?.dataset?.id;
|
|
342
312
|
if (primaryId && tabId) {
|
|
343
|
-
void dispatch(
|
|
313
|
+
void dispatch(createIntent2(DeckAction.ChangeCompanion, {
|
|
344
314
|
primary: primaryId,
|
|
345
315
|
companion: tabId
|
|
346
316
|
}));
|
|
@@ -350,23 +320,17 @@ var PlankHeading = /* @__PURE__ */ memo(({ id, part, node, deckEnabled, canIncre
|
|
|
350
320
|
]);
|
|
351
321
|
return /* @__PURE__ */ React3.createElement(StackItem.Heading, {
|
|
352
322
|
classNames: [
|
|
353
|
-
"plb-1 border-be border-separator items-stretch gap-1 sticky inline-start-12 app-drag min-is-0 contain
|
|
354
|
-
part === "solo" ? soloInlinePadding : "pli-1"
|
|
355
|
-
|
|
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
|
-
] : []
|
|
360
|
-
],
|
|
361
|
-
"data-plank-heading": true
|
|
323
|
+
"plb-1 border-be border-separator items-stretch gap-1 sticky inline-start-12 app-drag min-is-0 layout-contain",
|
|
324
|
+
part === "solo" ? soloInlinePadding : "pli-1"
|
|
325
|
+
]
|
|
362
326
|
}, companions && isCompanionNode ? /* @__PURE__ */ React3.createElement("div", {
|
|
363
327
|
role: "none",
|
|
364
328
|
className: "flex-1 min-is-0 overflow-x-auto scrollbar-thin flex gap-1"
|
|
365
|
-
}, companions.map(({ id: id2, properties: { icon: icon2, label: label4 } }) => /* @__PURE__ */ React3.createElement(
|
|
329
|
+
}, companions.map(({ id: id2, properties: { icon: icon2, label: label4 } }) => /* @__PURE__ */ React3.createElement(IconButton2, {
|
|
366
330
|
key: id2,
|
|
367
331
|
"data-id": id2,
|
|
368
332
|
icon: icon2,
|
|
369
|
-
iconOnly:
|
|
333
|
+
iconOnly: node?.id !== id2,
|
|
370
334
|
label: toLocalizedString(label4, t),
|
|
371
335
|
size: 5,
|
|
372
336
|
variant: node?.id === id2 ? "primary" : "default",
|
|
@@ -385,7 +349,7 @@ var PlankHeading = /* @__PURE__ */ memo(({ id, part, node, deckEnabled, canIncre
|
|
|
385
349
|
}
|
|
386
350
|
})) : /* @__PURE__ */ React3.createElement(StackItem.SigilButton, null, /* @__PURE__ */ React3.createElement("span", {
|
|
387
351
|
className: "sr-only"
|
|
388
|
-
}, label3), /* @__PURE__ */ React3.createElement(
|
|
352
|
+
}, label3), /* @__PURE__ */ React3.createElement(Icon2, {
|
|
389
353
|
icon,
|
|
390
354
|
size: 5
|
|
391
355
|
}))), /* @__PURE__ */ React3.createElement(TextTooltip, {
|
|
@@ -406,7 +370,7 @@ var PlankHeading = /* @__PURE__ */ memo(({ id, part, node, deckEnabled, canIncre
|
|
|
406
370
|
primary: primaryId
|
|
407
371
|
}) : /* @__PURE__ */ React3.createElement(PlankControls, {
|
|
408
372
|
capabilities,
|
|
409
|
-
|
|
373
|
+
isSolo: part === "solo",
|
|
410
374
|
close: part === "complementary" ? "minify-end" : true,
|
|
411
375
|
onClick: handlePlankAction
|
|
412
376
|
}));
|
|
@@ -430,7 +394,7 @@ var PlankContentError = ({ error }) => {
|
|
|
430
394
|
className: "overflow-auto p-8 attention-surface grid place-items-center"
|
|
431
395
|
}, /* @__PURE__ */ React5.createElement("p", {
|
|
432
396
|
role: "alert",
|
|
433
|
-
className: mx2(
|
|
397
|
+
className: mx2(descriptionText, "break-words border border-dashed border-separator rounded-lg p-8", errorString.length < 256 && "text-lg")
|
|
434
398
|
}, error ? errorString : t("error fallback message")));
|
|
435
399
|
};
|
|
436
400
|
var PlankError = ({ id, part, node, error }) => {
|
|
@@ -448,66 +412,55 @@ var PlankError = ({ id, part, node, error }) => {
|
|
|
448
412
|
}) : /* @__PURE__ */ React5.createElement(PlankLoading, null));
|
|
449
413
|
};
|
|
450
414
|
|
|
451
|
-
// packages/plugins/plugin-deck/src/
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
const
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
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
|
|
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);
|
|
482
430
|
}
|
|
483
|
-
}
|
|
484
|
-
|
|
485
|
-
|
|
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);
|
|
431
|
+
}, [
|
|
432
|
+
node
|
|
433
|
+
]);
|
|
495
434
|
};
|
|
496
|
-
|
|
497
|
-
|
|
435
|
+
|
|
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
|
|
447
|
+
var UNKNOWN_ID = "unknown_id";
|
|
448
|
+
var PlankImpl = /* @__PURE__ */ memo2(({ id, node, part, path, order, active, layoutMode, companioned, primary, companions, settings }) => {
|
|
449
|
+
const { dispatchPromise: dispatch } = useIntentDispatcher3();
|
|
498
450
|
const { deck, popoverAnchorId, scrollIntoView } = useCapability2(DeckCapabilities.DeckState);
|
|
451
|
+
const rootElement = useRef(null);
|
|
499
452
|
const canResize = layoutMode === "deck";
|
|
453
|
+
const Root = part.startsWith("solo") ? "article" : StackItem2.Root;
|
|
500
454
|
const attendableAttrs = useAttendableAttributes(primary?.id ?? id);
|
|
501
455
|
const index = active ? active.findIndex((entryId) => entryId === id) : 0;
|
|
502
456
|
const length = active?.length ?? 1;
|
|
503
457
|
const canIncrementStart = active && index !== void 0 && index > 0 && length !== void 0 && length > 1;
|
|
504
458
|
const canIncrementEnd = active && index !== void 0 && index < length - 1 && length !== void 0;
|
|
505
|
-
const rootElement = useRef(null);
|
|
506
459
|
const { variant } = parseEntryId(id);
|
|
507
|
-
const sizeKey = `${id.split("+")[0]}${variant ? `${
|
|
460
|
+
const sizeKey = `${id.split("+")[0]}${variant ? `${ATTENDABLE_PATH_SEPARATOR2}${variant}` : ""}`;
|
|
508
461
|
const size = deck.plankSizing[sizeKey];
|
|
509
|
-
const
|
|
510
|
-
return dispatch(
|
|
462
|
+
const setSize = useCallback3(debounce((nextSize) => {
|
|
463
|
+
return dispatch(createIntent3(DeckAction.UpdatePlankSize, {
|
|
511
464
|
id: sizeKey,
|
|
512
465
|
size: nextSize
|
|
513
466
|
}));
|
|
@@ -515,7 +468,7 @@ var PlankComponent = /* @__PURE__ */ memo2(({ layoutMode, id, part, path, order,
|
|
|
515
468
|
dispatch,
|
|
516
469
|
sizeKey
|
|
517
470
|
]);
|
|
518
|
-
const handleKeyDown =
|
|
471
|
+
const handleKeyDown = useCallback3((event) => {
|
|
519
472
|
if (event.target === event.currentTarget && event.key === "Escape") {
|
|
520
473
|
rootElement.current?.closest("main")?.focus();
|
|
521
474
|
}
|
|
@@ -530,7 +483,7 @@ var PlankComponent = /* @__PURE__ */ memo2(({ layoutMode, id, part, path, order,
|
|
|
530
483
|
behavior: "smooth",
|
|
531
484
|
inline: "center"
|
|
532
485
|
});
|
|
533
|
-
void dispatch(
|
|
486
|
+
void dispatch(createIntent3(LayoutAction2.ScrollIntoView, {
|
|
534
487
|
part: "current",
|
|
535
488
|
subject: void 0
|
|
536
489
|
}));
|
|
@@ -540,8 +493,8 @@ var PlankComponent = /* @__PURE__ */ memo2(({ layoutMode, id, part, path, order,
|
|
|
540
493
|
scrollIntoView,
|
|
541
494
|
layoutMode
|
|
542
495
|
]);
|
|
543
|
-
const isSolo = layoutMode
|
|
544
|
-
const isAttendable = layoutMode
|
|
496
|
+
const isSolo = layoutMode === "solo" && part === "solo";
|
|
497
|
+
const isAttendable = layoutMode === "solo" && part.startsWith("solo") || layoutMode === "deck" && part === "deck";
|
|
545
498
|
const sizeAttrs = useMainSize();
|
|
546
499
|
const data = useMemo2(() => node && {
|
|
547
500
|
subject: node.data,
|
|
@@ -554,11 +507,9 @@ var PlankComponent = /* @__PURE__ */ memo2(({ layoutMode, id, part, path, order,
|
|
|
554
507
|
node?.data,
|
|
555
508
|
path,
|
|
556
509
|
popoverAnchorId,
|
|
557
|
-
primary?.data
|
|
558
|
-
variant
|
|
510
|
+
primary?.data
|
|
559
511
|
]);
|
|
560
512
|
const placeholder = useMemo2(() => /* @__PURE__ */ React6.createElement(PlankLoading, null), []);
|
|
561
|
-
const Root = part.startsWith("solo") ? "article" : StackItem2.Root;
|
|
562
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");
|
|
563
514
|
return /* @__PURE__ */ React6.createElement(Root, {
|
|
564
515
|
ref: rootElement,
|
|
@@ -572,7 +523,7 @@ var PlankComponent = /* @__PURE__ */ memo2(({ layoutMode, id, part, path, order,
|
|
|
572
523
|
id
|
|
573
524
|
},
|
|
574
525
|
size,
|
|
575
|
-
onSizeChange:
|
|
526
|
+
onSizeChange: setSize,
|
|
576
527
|
classNames: className,
|
|
577
528
|
order,
|
|
578
529
|
role: "article"
|
|
@@ -583,7 +534,6 @@ var PlankComponent = /* @__PURE__ */ memo2(({ layoutMode, id, part, path, order,
|
|
|
583
534
|
id,
|
|
584
535
|
part: part.startsWith("solo-") ? "solo" : part,
|
|
585
536
|
node,
|
|
586
|
-
layoutMode,
|
|
587
537
|
deckEnabled: settings?.enableDeck,
|
|
588
538
|
canIncrementStart,
|
|
589
539
|
canIncrementEnd,
|
|
@@ -603,6 +553,51 @@ var PlankComponent = /* @__PURE__ */ memo2(({ layoutMode, id, part, path, order,
|
|
|
603
553
|
part
|
|
604
554
|
}), canResize && /* @__PURE__ */ React6.createElement(StackItem2.ResizeHandle, null));
|
|
605
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
|
+
};
|
|
606
601
|
|
|
607
602
|
// packages/plugins/plugin-deck/src/components/Sidebar/ComplementarySidebar.tsx
|
|
608
603
|
var label = [
|
|
@@ -611,31 +606,41 @@ var label = [
|
|
|
611
606
|
ns: DECK_PLUGIN
|
|
612
607
|
}
|
|
613
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
|
+
};
|
|
614
620
|
var ComplementarySidebar = ({ current }) => {
|
|
615
621
|
const { t } = useTranslation5(DECK_PLUGIN);
|
|
616
|
-
const { dispatchPromise: dispatch } =
|
|
622
|
+
const { dispatchPromise: dispatch } = useIntentDispatcher4();
|
|
617
623
|
const layout = useCapability3(DeckCapabilities.MutableDeckState);
|
|
618
|
-
const layoutMode = getMode(layout.deck);
|
|
619
624
|
const breakpoint = useBreakpoints();
|
|
620
|
-
const topbar = layoutAppliesTopbar(breakpoint
|
|
621
|
-
const hoistStatusbar = useHoistStatusbar(breakpoint
|
|
625
|
+
const topbar = layoutAppliesTopbar(breakpoint);
|
|
626
|
+
const hoistStatusbar = useHoistStatusbar(breakpoint);
|
|
622
627
|
const companions = useDeckCompanions();
|
|
623
|
-
const activeCompanion = companions.find((companion) => getCompanionId(companion.id) === current);
|
|
624
|
-
const activeId =
|
|
628
|
+
const activeCompanion = companions.find((companion) => getCompanionId(companion.id) === current) ?? companions.at(0);
|
|
629
|
+
const activeId = getCompanionId(activeCompanion?.id ?? "never");
|
|
625
630
|
const [internalValue, setInternalValue] = useState2(activeId);
|
|
626
|
-
|
|
631
|
+
useEffect4(() => {
|
|
627
632
|
setInternalValue(activeId);
|
|
628
633
|
}, [
|
|
629
634
|
activeId
|
|
630
635
|
]);
|
|
631
|
-
const handleTabClick =
|
|
636
|
+
const handleTabClick = useCallback4((event) => {
|
|
632
637
|
const nextValue = event.currentTarget.getAttribute("data-value");
|
|
633
638
|
if (nextValue === activeId) {
|
|
634
639
|
layout.complementarySidebarState = layout.complementarySidebarState === "expanded" ? "collapsed" : "expanded";
|
|
635
640
|
} else {
|
|
636
641
|
setInternalValue(nextValue);
|
|
637
642
|
layout.complementarySidebarState = "expanded";
|
|
638
|
-
void dispatch(
|
|
643
|
+
void dispatch(createIntent4(LayoutAction3.UpdateComplementary, {
|
|
639
644
|
part: "complementary",
|
|
640
645
|
subject: nextValue
|
|
641
646
|
}));
|
|
@@ -652,19 +657,6 @@ var ComplementarySidebar = ({ current }) => {
|
|
|
652
657
|
activeCompanion?.id,
|
|
653
658
|
activeCompanion?.data
|
|
654
659
|
]);
|
|
655
|
-
useEffect3(() => {
|
|
656
|
-
if (!activeId) {
|
|
657
|
-
void dispatch(createIntent5(LayoutAction4.UpdateComplementary, {
|
|
658
|
-
part: "complementary",
|
|
659
|
-
options: {
|
|
660
|
-
state: "collapsed"
|
|
661
|
-
}
|
|
662
|
-
}));
|
|
663
|
-
}
|
|
664
|
-
}, [
|
|
665
|
-
activeId,
|
|
666
|
-
dispatch
|
|
667
|
-
]);
|
|
668
660
|
return /* @__PURE__ */ React7.createElement(Main.ComplementarySidebar, {
|
|
669
661
|
label,
|
|
670
662
|
classNames: [
|
|
@@ -685,7 +677,7 @@ var ComplementarySidebar = ({ current }) => {
|
|
|
685
677
|
key: getCompanionId(companion.id),
|
|
686
678
|
value: getCompanionId(companion.id),
|
|
687
679
|
asChild: true
|
|
688
|
-
}, /* @__PURE__ */ React7.createElement(
|
|
680
|
+
}, /* @__PURE__ */ React7.createElement(IconButton3, {
|
|
689
681
|
label: toLocalizedString2(companion.properties.label, t),
|
|
690
682
|
icon: companion.properties.icon,
|
|
691
683
|
size: 5,
|
|
@@ -703,7 +695,7 @@ var ComplementarySidebar = ({ current }) => {
|
|
|
703
695
|
})), /* @__PURE__ */ React7.createElement("div", {
|
|
704
696
|
role: "none",
|
|
705
697
|
className: "hidden lg:grid grid-cols-1 auto-rows-[--rail-action] p-1"
|
|
706
|
-
}, /* @__PURE__ */ React7.createElement(ToggleComplementarySidebarButton, null))),
|
|
698
|
+
}, /* @__PURE__ */ React7.createElement(ToggleComplementarySidebarButton, null))), companions.map((companion) => /* @__PURE__ */ React7.createElement(Tabs.Tabpanel, {
|
|
707
699
|
key: getCompanionId(companion.id),
|
|
708
700
|
value: getCompanionId(companion.id),
|
|
709
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)]',
|
|
@@ -727,7 +719,7 @@ var ComplementarySidebarPanel = ({ companion, activeId, data, hoistStatusbar })
|
|
|
727
719
|
if (getCompanionId(companion.id) !== activeId && !data) {
|
|
728
720
|
return null;
|
|
729
721
|
}
|
|
730
|
-
const Wrapper = companion.properties.fixed ?
|
|
722
|
+
const Wrapper = companion.properties.fixed ? Fragment3 : ScrollArea;
|
|
731
723
|
return /* @__PURE__ */ React7.createElement(React7.Fragment, null, /* @__PURE__ */ React7.createElement("h2", {
|
|
732
724
|
className: "flex items-center pli-2 border-separator border-be font-medium"
|
|
733
725
|
}, toLocalizedString2(companion.properties.label, t)), /* @__PURE__ */ React7.createElement(Wrapper, null, /* @__PURE__ */ React7.createElement(Surface3, {
|
|
@@ -755,11 +747,10 @@ var label2 = [
|
|
|
755
747
|
}
|
|
756
748
|
];
|
|
757
749
|
var Sidebar = () => {
|
|
758
|
-
const { popoverAnchorId, activeDeck: current
|
|
750
|
+
const { popoverAnchorId, activeDeck: current } = useCapability4(DeckCapabilities.DeckState);
|
|
759
751
|
const breakpoint = useBreakpoints();
|
|
760
|
-
const
|
|
761
|
-
const
|
|
762
|
-
const hoistStatusbar = useHoistStatusbar(breakpoint, layoutMode);
|
|
752
|
+
const topbar = layoutAppliesTopbar(breakpoint);
|
|
753
|
+
const hoistStatusbar = useHoistStatusbar(breakpoint);
|
|
763
754
|
const navigationData = useMemo4(() => ({
|
|
764
755
|
popoverAnchorId,
|
|
765
756
|
topbar,
|
|
@@ -817,21 +808,21 @@ var Banner = ({ variant, classNames }) => {
|
|
|
817
808
|
|
|
818
809
|
// packages/plugins/plugin-deck/src/components/DeckLayout/DeckLayout.tsx
|
|
819
810
|
import { untracked } from "@preact/signals-core";
|
|
820
|
-
import React17, { useCallback as
|
|
821
|
-
import { Capabilities, LayoutAction as
|
|
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";
|
|
822
813
|
import { AttentionCapabilities } from "@dxos/plugin-attention";
|
|
823
|
-
import { Main as Main3, useMediaQuery, useOnTransition } from "@dxos/react-ui";
|
|
814
|
+
import { AlertDialog, Dialog as NaturalDialog, Main as Main3, Popover as Popover2, useMediaQuery, useOnTransition } from "@dxos/react-ui";
|
|
824
815
|
import { Stack, StackContext, DEFAULT_HORIZONTAL_SIZE } from "@dxos/react-ui-stack";
|
|
825
816
|
import { mainPaddingTransitions } from "@dxos/react-ui-theme";
|
|
826
817
|
|
|
827
818
|
// packages/plugins/plugin-deck/src/components/DeckLayout/ActiveNode.tsx
|
|
828
819
|
import React10 from "react";
|
|
829
|
-
import { Surface as Surface6, useAppGraph as
|
|
820
|
+
import { Surface as Surface6, useAppGraph as useAppGraph4 } from "@dxos/app-framework";
|
|
830
821
|
import { useNode as useNode2 } from "@dxos/plugin-graph";
|
|
831
822
|
import { useAttended } from "@dxos/react-ui-attention";
|
|
832
823
|
var ActiveNode = () => {
|
|
833
824
|
const [id] = useAttended();
|
|
834
|
-
const { graph } =
|
|
825
|
+
const { graph } = useAppGraph4();
|
|
835
826
|
const activeNode = useNode2(graph, id);
|
|
836
827
|
useNodeActionExpander(activeNode);
|
|
837
828
|
return /* @__PURE__ */ React10.createElement("div", {
|
|
@@ -848,15 +839,13 @@ var ActiveNode = () => {
|
|
|
848
839
|
|
|
849
840
|
// packages/plugins/plugin-deck/src/components/DeckLayout/ContentEmpty.tsx
|
|
850
841
|
import React11 from "react";
|
|
851
|
-
import { Surface as Surface7
|
|
842
|
+
import { Surface as Surface7 } from "@dxos/app-framework";
|
|
852
843
|
var ContentEmpty = () => {
|
|
853
844
|
const breakpoint = useBreakpoints();
|
|
854
|
-
const
|
|
855
|
-
const layoutMode = getMode(deck);
|
|
856
|
-
const topbar = layoutAppliesTopbar(breakpoint, layoutMode);
|
|
845
|
+
const topbar = layoutAppliesTopbar(breakpoint);
|
|
857
846
|
return /* @__PURE__ */ React11.createElement("div", {
|
|
858
847
|
role: "none",
|
|
859
|
-
className: "grid place-items-center p-8 relative bg-
|
|
848
|
+
className: "grid place-items-center p-8 relative bg-deck",
|
|
860
849
|
"data-testid": "layoutPlugin.firstRunMessage"
|
|
861
850
|
}, /* @__PURE__ */ React11.createElement(Surface7, {
|
|
862
851
|
role: "keyshortcuts"
|
|
@@ -866,123 +855,51 @@ var ContentEmpty = () => {
|
|
|
866
855
|
}));
|
|
867
856
|
};
|
|
868
857
|
|
|
869
|
-
// packages/plugins/plugin-deck/src/components/DeckLayout/
|
|
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
|
|
870
865
|
import React12 from "react";
|
|
871
|
-
import {
|
|
872
|
-
import {
|
|
873
|
-
var
|
|
874
|
-
const
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
}, dialogBlockAlign === "end" ? (
|
|
883
|
-
// TODO(burdon): Placeholder creates a suspense boundary; replace with defaults.
|
|
884
|
-
/* @__PURE__ */ React12.createElement(Surface8, {
|
|
885
|
-
role: "dialog",
|
|
886
|
-
data: dialogContent,
|
|
887
|
-
limit: 1,
|
|
888
|
-
fallback: PlankContentError,
|
|
889
|
-
placeholder: /* @__PURE__ */ React12.createElement("div", null)
|
|
890
|
-
})
|
|
891
|
-
) : /* @__PURE__ */ React12.createElement(Overlay, {
|
|
892
|
-
blockAlign: dialogBlockAlign
|
|
893
|
-
}, /* @__PURE__ */ React12.createElement(Surface8, {
|
|
894
|
-
role: "dialog",
|
|
895
|
-
data: dialogContent,
|
|
896
|
-
limit: 1,
|
|
897
|
-
fallback: PlankContentError
|
|
898
|
-
})));
|
|
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")));
|
|
899
877
|
};
|
|
900
878
|
|
|
901
|
-
// packages/plugins/plugin-deck/src/components/DeckLayout/
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
clearTimeout(debounceRef.current);
|
|
919
|
-
}
|
|
920
|
-
if (layout.popoverAnchor && virtualRef.current !== layout.popoverAnchor) {
|
|
921
|
-
virtualRef.current = layout.popoverAnchor ?? null;
|
|
922
|
-
setVirtualIter((iter) => iter + 1);
|
|
923
|
-
}
|
|
924
|
-
debounceRef.current = setTimeout(() => setOpen(true), DEBOUNCE_DELAY);
|
|
925
|
-
}
|
|
926
|
-
}, [
|
|
927
|
-
layout.popoverOpen,
|
|
928
|
-
layout.popoverAnchorId,
|
|
929
|
-
layout.popoverAnchor,
|
|
930
|
-
layout.popoverContent
|
|
931
|
-
]);
|
|
932
|
-
return /* @__PURE__ */ React13.createElement(DeckPopoverProvider, {
|
|
933
|
-
setOpen
|
|
934
|
-
}, /* @__PURE__ */ React13.createElement(Popover2.Root, {
|
|
935
|
-
modal: false,
|
|
936
|
-
open
|
|
937
|
-
}, layout.popoverAnchor && /* @__PURE__ */ React13.createElement(Popover2.VirtualTrigger, {
|
|
938
|
-
key: virtualIter,
|
|
939
|
-
virtualRef
|
|
940
|
-
}), children));
|
|
941
|
-
};
|
|
942
|
-
var PopoverContent = () => {
|
|
943
|
-
const layout = useCapability7(DeckCapabilities.MutableDeckState);
|
|
944
|
-
const { setOpen } = useDeckPopoverContext("PopoverContent");
|
|
945
|
-
const handleClose = useCallback6((event) => {
|
|
946
|
-
if (
|
|
947
|
-
// TODO(thure): CodeMirror should not focus itself when it updates.
|
|
948
|
-
event.type === "dismissableLayer.focusOutside" && event.currentTarget?.classList.contains("cm-content")
|
|
949
|
-
) {
|
|
950
|
-
event.preventDefault();
|
|
951
|
-
} else {
|
|
952
|
-
setOpen(false);
|
|
953
|
-
layout.popoverOpen = false;
|
|
954
|
-
layout.popoverAnchor = void 0;
|
|
955
|
-
layout.popoverAnchorId = void 0;
|
|
956
|
-
layout.popoverSide = void 0;
|
|
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
|
|
957
896
|
}
|
|
958
|
-
}
|
|
959
|
-
setOpen
|
|
960
|
-
]);
|
|
961
|
-
const collisionBoundaries = useMemo5(() => {
|
|
962
|
-
const closest = layout.popoverAnchor?.closest("[data-popover-collision-boundary]");
|
|
963
|
-
return closest ? [
|
|
964
|
-
closest
|
|
965
|
-
] : [];
|
|
966
|
-
}, [
|
|
967
|
-
layout.popoverAnchor
|
|
968
|
-
]);
|
|
969
|
-
return /* @__PURE__ */ React13.createElement(Popover2.Portal, null, /* @__PURE__ */ React13.createElement(Popover2.Content, {
|
|
970
|
-
side: layout.popoverSide,
|
|
971
|
-
onInteractOutside: handleClose,
|
|
972
|
-
onEscapeKeyDown: handleClose,
|
|
973
|
-
collisionBoundary: collisionBoundaries,
|
|
974
|
-
sticky: "always",
|
|
975
|
-
hideWhenDetached: true
|
|
976
|
-
}, /* @__PURE__ */ React13.createElement(Popover2.Viewport, null, /* @__PURE__ */ React13.createElement(Surface9, {
|
|
977
|
-
role: "popover",
|
|
978
|
-
data: layout.popoverContent,
|
|
979
|
-
limit: 1
|
|
980
|
-
})), /* @__PURE__ */ React13.createElement(Popover2.Arrow, null)));
|
|
897
|
+
}));
|
|
981
898
|
};
|
|
982
899
|
|
|
983
900
|
// packages/plugins/plugin-deck/src/components/DeckLayout/StatusBar.tsx
|
|
984
901
|
import React14 from "react";
|
|
985
|
-
import { Surface as
|
|
902
|
+
import { Surface as Surface9 } from "@dxos/app-framework";
|
|
986
903
|
import { useLandmarkMover } from "@dxos/react-ui";
|
|
987
904
|
var StatusBar = ({ showHints }) => {
|
|
988
905
|
const mover = useLandmarkMover(void 0, "3");
|
|
@@ -990,10 +907,10 @@ var StatusBar = ({ showHints }) => {
|
|
|
990
907
|
role: "contentinfo",
|
|
991
908
|
className: "fixed block-end-0 inset-inline-0 bs-[--statusbar-size] border-bs border-separator z-[2] flex text-description",
|
|
992
909
|
...mover
|
|
993
|
-
}, showHints && /* @__PURE__ */ React14.createElement(
|
|
910
|
+
}, showHints && /* @__PURE__ */ React14.createElement(Surface9, {
|
|
994
911
|
role: "hints",
|
|
995
912
|
limit: 1
|
|
996
|
-
}), /* @__PURE__ */ React14.createElement(
|
|
913
|
+
}), /* @__PURE__ */ React14.createElement(Surface9, {
|
|
997
914
|
role: "status-bar",
|
|
998
915
|
limit: 1
|
|
999
916
|
}));
|
|
@@ -1001,9 +918,9 @@ var StatusBar = ({ showHints }) => {
|
|
|
1001
918
|
|
|
1002
919
|
// packages/plugins/plugin-deck/src/components/DeckLayout/Toast.tsx
|
|
1003
920
|
import React15 from "react";
|
|
1004
|
-
import { Button, Icon as
|
|
921
|
+
import { Button as Button2, Icon as Icon3, Toast as NaturalToast, toLocalizedString as toLocalizedString3, useTranslation as useTranslation8 } from "@dxos/react-ui";
|
|
1005
922
|
var Toast = ({ id, title, description, icon, duration, actionLabel, actionAlt, closeLabel, onAction, onOpenChange }) => {
|
|
1006
|
-
const { t } =
|
|
923
|
+
const { t } = useTranslation8(DECK_PLUGIN);
|
|
1007
924
|
return /* @__PURE__ */ React15.createElement(NaturalToast.Root, {
|
|
1008
925
|
"data-testid": id,
|
|
1009
926
|
defaultOpen: true,
|
|
@@ -1011,20 +928,20 @@ var Toast = ({ id, title, description, icon, duration, actionLabel, actionAlt, c
|
|
|
1011
928
|
onOpenChange
|
|
1012
929
|
}, /* @__PURE__ */ React15.createElement(NaturalToast.Body, null, /* @__PURE__ */ React15.createElement(NaturalToast.Title, {
|
|
1013
930
|
classNames: "items-center"
|
|
1014
|
-
}, icon && /* @__PURE__ */ React15.createElement(
|
|
931
|
+
}, icon && /* @__PURE__ */ React15.createElement(Icon3, {
|
|
1015
932
|
icon,
|
|
1016
933
|
size: 5,
|
|
1017
934
|
classNames: "inline mr-1"
|
|
1018
935
|
}), 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, {
|
|
1019
936
|
altText: toLocalizedString3(actionAlt, t),
|
|
1020
937
|
asChild: true
|
|
1021
|
-
}, /* @__PURE__ */ React15.createElement(
|
|
938
|
+
}, /* @__PURE__ */ React15.createElement(Button2, {
|
|
1022
939
|
"data-testid": "toast.action",
|
|
1023
940
|
variant: "primary",
|
|
1024
941
|
onClick: () => onAction?.()
|
|
1025
942
|
}, toLocalizedString3(actionLabel, t))), closeLabel && /* @__PURE__ */ React15.createElement(NaturalToast.Close, {
|
|
1026
943
|
asChild: true
|
|
1027
|
-
}, /* @__PURE__ */ React15.createElement(
|
|
944
|
+
}, /* @__PURE__ */ React15.createElement(Button2, {
|
|
1028
945
|
"data-testid": "toast.close"
|
|
1029
946
|
}, toLocalizedString3(closeLabel, t)))));
|
|
1030
947
|
};
|
|
@@ -1040,27 +957,32 @@ var Topbar = () => {
|
|
|
1040
957
|
// packages/plugins/plugin-deck/src/components/DeckLayout/DeckLayout.tsx
|
|
1041
958
|
var PlankSeparator = ({ order }) => order > 0 ? /* @__PURE__ */ React17.createElement("span", {
|
|
1042
959
|
role: "separator",
|
|
1043
|
-
className: "row-span-2 bg-
|
|
960
|
+
className: "row-span-2 bg-deck is-4",
|
|
1044
961
|
style: {
|
|
1045
962
|
gridColumn: order
|
|
1046
963
|
}
|
|
1047
964
|
}) : null;
|
|
1048
965
|
var DeckLayout = ({ onDismissToast }) => {
|
|
1049
|
-
const { dispatchPromise: dispatch } =
|
|
1050
|
-
const settings =
|
|
1051
|
-
const context =
|
|
1052
|
-
const { sidebarState, complementarySidebarState, complementarySidebarPanel, deck, toasts } = context;
|
|
966
|
+
const { dispatchPromise: dispatch } = useIntentDispatcher5();
|
|
967
|
+
const settings = useCapability5(Capabilities.SettingsStore).getStore(DECK_PLUGIN).value;
|
|
968
|
+
const context = useCapability5(DeckCapabilities.MutableDeckState);
|
|
969
|
+
const { sidebarState, complementarySidebarState, complementarySidebarPanel, dialogOpen, dialogContent, dialogBlockAlign, dialogType, popoverOpen, popoverContent, popoverAnchorId, deck, toasts } = context;
|
|
1053
970
|
const { active, activeCompanions, fullscreen, solo, plankSizing } = deck;
|
|
1054
971
|
const breakpoint = useBreakpoints();
|
|
1055
|
-
const
|
|
1056
|
-
const
|
|
1057
|
-
const hoistStatusbar = useHoistStatusbar(breakpoint, layoutMode);
|
|
972
|
+
const topbar = layoutAppliesTopbar(breakpoint);
|
|
973
|
+
const hoistStatusbar = useHoistStatusbar(breakpoint);
|
|
1058
974
|
const pluginManager = usePluginManager();
|
|
1059
|
-
const scrollLeftRef =
|
|
1060
|
-
const deckRef =
|
|
975
|
+
const scrollLeftRef = useRef2();
|
|
976
|
+
const deckRef = useRef2(null);
|
|
977
|
+
const [delayedPopoverVisibility, setDelayedPopoverVisibility] = useState3(false);
|
|
978
|
+
useEffect5(() => {
|
|
979
|
+
popoverOpen ? setTimeout(() => setDelayedPopoverVisibility(true), 40) : setDelayedPopoverVisibility(false);
|
|
980
|
+
}, [
|
|
981
|
+
popoverOpen
|
|
982
|
+
]);
|
|
1061
983
|
useEffect5(() => {
|
|
1062
984
|
const attended = untracked(() => {
|
|
1063
|
-
const attention = pluginManager.context.
|
|
985
|
+
const attention = pluginManager.context.requestCapability(AttentionCapabilities.Attention);
|
|
1064
986
|
return attention.current;
|
|
1065
987
|
});
|
|
1066
988
|
const firstId = solo ?? active[0];
|
|
@@ -1071,15 +993,15 @@ var DeckLayout = ({ onDismissToast }) => {
|
|
|
1071
993
|
const [isNotMobile] = useMediaQuery("md", {
|
|
1072
994
|
ssr: false
|
|
1073
995
|
});
|
|
1074
|
-
const shouldRevert =
|
|
996
|
+
const shouldRevert = useRef2(false);
|
|
1075
997
|
useEffect5(() => {
|
|
1076
998
|
if (!isNotMobile && getMode(deck) === "deck") {
|
|
1077
999
|
const attended = untracked(() => {
|
|
1078
|
-
const attention = pluginManager.context.
|
|
1000
|
+
const attention = pluginManager.context.requestCapability(AttentionCapabilities.Attention);
|
|
1079
1001
|
return attention.current;
|
|
1080
1002
|
});
|
|
1081
1003
|
shouldRevert.current = true;
|
|
1082
|
-
void dispatch(
|
|
1004
|
+
void dispatch(createIntent5(LayoutAction4.SetLayoutMode, {
|
|
1083
1005
|
part: "mode",
|
|
1084
1006
|
subject: attended[0],
|
|
1085
1007
|
options: {
|
|
@@ -1087,7 +1009,7 @@ var DeckLayout = ({ onDismissToast }) => {
|
|
|
1087
1009
|
}
|
|
1088
1010
|
}));
|
|
1089
1011
|
} else if (isNotMobile && getMode(deck) === "solo" && shouldRevert.current) {
|
|
1090
|
-
void dispatch(
|
|
1012
|
+
void dispatch(createIntent5(LayoutAction4.SetLayoutMode, {
|
|
1091
1013
|
part: "mode",
|
|
1092
1014
|
options: {
|
|
1093
1015
|
revert: true
|
|
@@ -1100,8 +1022,8 @@ var DeckLayout = ({ onDismissToast }) => {
|
|
|
1100
1022
|
dispatch
|
|
1101
1023
|
]);
|
|
1102
1024
|
useEffect5(() => {
|
|
1103
|
-
if (!settings.enableDeck
|
|
1104
|
-
void dispatch(
|
|
1025
|
+
if (!settings.enableDeck) {
|
|
1026
|
+
void dispatch(createIntent5(LayoutAction4.SetLayoutMode, {
|
|
1105
1027
|
part: "mode",
|
|
1106
1028
|
subject: active[0],
|
|
1107
1029
|
options: {
|
|
@@ -1112,10 +1034,9 @@ var DeckLayout = ({ onDismissToast }) => {
|
|
|
1112
1034
|
}, [
|
|
1113
1035
|
settings.enableDeck,
|
|
1114
1036
|
dispatch,
|
|
1115
|
-
active
|
|
1116
|
-
layoutMode
|
|
1037
|
+
active
|
|
1117
1038
|
]);
|
|
1118
|
-
const handleResize =
|
|
1039
|
+
const handleResize = useCallback5(() => {
|
|
1119
1040
|
scrollLeftRef.current = null;
|
|
1120
1041
|
}, []);
|
|
1121
1042
|
useEffect5(() => {
|
|
@@ -1124,13 +1045,14 @@ var DeckLayout = ({ onDismissToast }) => {
|
|
|
1124
1045
|
}, [
|
|
1125
1046
|
handleResize
|
|
1126
1047
|
]);
|
|
1127
|
-
const restoreScroll =
|
|
1048
|
+
const restoreScroll = useCallback5(() => {
|
|
1128
1049
|
if (deckRef.current && scrollLeftRef.current != null) {
|
|
1129
1050
|
deckRef.current.scrollLeft = scrollLeftRef.current;
|
|
1130
1051
|
}
|
|
1131
1052
|
}, []);
|
|
1053
|
+
const layoutMode = getMode(deck);
|
|
1132
1054
|
useOnTransition(layoutMode, (mode) => mode !== "deck", "deck", restoreScroll);
|
|
1133
|
-
const handleScroll =
|
|
1055
|
+
const handleScroll = useCallback5((event) => {
|
|
1134
1056
|
if (!solo && event.currentTarget === event.target) {
|
|
1135
1057
|
scrollLeftRef.current = event.target.scrollLeft;
|
|
1136
1058
|
}
|
|
@@ -1138,7 +1060,7 @@ var DeckLayout = ({ onDismissToast }) => {
|
|
|
1138
1060
|
solo
|
|
1139
1061
|
]);
|
|
1140
1062
|
const isEmpty = !solo && active.length === 0;
|
|
1141
|
-
const padding =
|
|
1063
|
+
const padding = useMemo5(() => {
|
|
1142
1064
|
if (!solo && settings.overscroll === "centering") {
|
|
1143
1065
|
return calculateOverscroll(active.length);
|
|
1144
1066
|
}
|
|
@@ -1148,7 +1070,7 @@ var DeckLayout = ({ onDismissToast }) => {
|
|
|
1148
1070
|
settings.overscroll,
|
|
1149
1071
|
deck
|
|
1150
1072
|
]);
|
|
1151
|
-
const mainPosition =
|
|
1073
|
+
const mainPosition = useMemo5(() => [
|
|
1152
1074
|
"grid !block-start-[env(safe-area-inset-top)]",
|
|
1153
1075
|
topbar && "!block-start-[calc(env(safe-area-inset-top)+var(--rail-size))]",
|
|
1154
1076
|
hoistStatusbar && "lg:block-end-[--statusbar-size]"
|
|
@@ -1156,7 +1078,22 @@ var DeckLayout = ({ onDismissToast }) => {
|
|
|
1156
1078
|
topbar,
|
|
1157
1079
|
hoistStatusbar
|
|
1158
1080
|
]);
|
|
1159
|
-
const
|
|
1081
|
+
const Dialog = dialogType === "alert" ? AlertDialog : NaturalDialog;
|
|
1082
|
+
const handlePopoverOpenChange = useCallback5((nextOpen) => {
|
|
1083
|
+
if (nextOpen && popoverAnchorId) {
|
|
1084
|
+
context.popoverOpen = true;
|
|
1085
|
+
} else {
|
|
1086
|
+
context.popoverOpen = false;
|
|
1087
|
+
context.popoverAnchorId = void 0;
|
|
1088
|
+
context.popoverSide = void 0;
|
|
1089
|
+
}
|
|
1090
|
+
}, [
|
|
1091
|
+
context
|
|
1092
|
+
]);
|
|
1093
|
+
const handlePopoverClose = useCallback5(() => handlePopoverOpenChange(false), [
|
|
1094
|
+
handlePopoverOpenChange
|
|
1095
|
+
]);
|
|
1096
|
+
const { order, itemsCount } = useMemo5(() => {
|
|
1160
1097
|
return active.reduce((acc, entryId) => {
|
|
1161
1098
|
acc.order[entryId] = acc.itemsCount + 1;
|
|
1162
1099
|
acc.itemsCount += activeCompanions?.[entryId] ? 3 : 2;
|
|
@@ -1169,10 +1106,16 @@ var DeckLayout = ({ onDismissToast }) => {
|
|
|
1169
1106
|
active,
|
|
1170
1107
|
activeCompanions
|
|
1171
1108
|
]);
|
|
1172
|
-
return /* @__PURE__ */ React17.createElement(
|
|
1173
|
-
|
|
1109
|
+
return /* @__PURE__ */ React17.createElement(Popover2.Root, {
|
|
1110
|
+
modal: true,
|
|
1111
|
+
open: !!(popoverAnchorId && delayedPopoverVisibility),
|
|
1112
|
+
onOpenChange: handlePopoverOpenChange
|
|
1113
|
+
}, /* @__PURE__ */ React17.createElement(ActiveNode, null), fullscreen && /* @__PURE__ */ React17.createElement(Fullscreen, {
|
|
1114
|
+
id: solo
|
|
1115
|
+
}), !fullscreen && /* @__PURE__ */ React17.createElement(Main3.Root, {
|
|
1116
|
+
navigationSidebarState: context.sidebarState,
|
|
1174
1117
|
onNavigationSidebarStateChange: (next) => context.sidebarState = next,
|
|
1175
|
-
complementarySidebarState:
|
|
1118
|
+
complementarySidebarState: context.complementarySidebarState,
|
|
1176
1119
|
onComplementarySidebarStateChange: (next) => context.complementarySidebarState = next
|
|
1177
1120
|
}, /* @__PURE__ */ React17.createElement(Sidebar, null), /* @__PURE__ */ React17.createElement(ComplementarySidebar, {
|
|
1178
1121
|
current: complementarySidebarPanel
|
|
@@ -1182,8 +1125,8 @@ var DeckLayout = ({ onDismissToast }) => {
|
|
|
1182
1125
|
classNames: mainPosition
|
|
1183
1126
|
}, /* @__PURE__ */ React17.createElement(ContentEmpty, null)), !isEmpty && /* @__PURE__ */ React17.createElement(Main3.Content, {
|
|
1184
1127
|
bounce: true,
|
|
1185
|
-
handlesFocus: true,
|
|
1186
1128
|
classNames: mainPosition,
|
|
1129
|
+
handlesFocus: true,
|
|
1187
1130
|
style: {
|
|
1188
1131
|
"--dx-main-sidebarWidth": sidebarState === "expanded" ? "var(--nav-sidebar-size)" : sidebarState === "collapsed" ? "var(--l0-size)" : "0",
|
|
1189
1132
|
"--dx-main-complementaryWidth": complementarySidebarState === "expanded" ? "var(--complementary-sidebar-size)" : complementarySidebarState === "collapsed" ? "var(--rail-size)" : "0",
|
|
@@ -1192,13 +1135,13 @@ var DeckLayout = ({ onDismissToast }) => {
|
|
|
1192
1135
|
}
|
|
1193
1136
|
}, /* @__PURE__ */ React17.createElement("div", {
|
|
1194
1137
|
role: "none",
|
|
1195
|
-
className: !solo ? "relative bg-
|
|
1138
|
+
className: !solo ? "relative bg-deck overflow-hidden" : "sr-only",
|
|
1196
1139
|
...solo && {
|
|
1197
1140
|
inert: ""
|
|
1198
1141
|
}
|
|
1199
|
-
}, !topbar &&
|
|
1142
|
+
}, !topbar && /* @__PURE__ */ React17.createElement(ToggleSidebarButton, {
|
|
1200
1143
|
classNames: fixedSidebarToggleStyles
|
|
1201
|
-
}), !topbar &&
|
|
1144
|
+
}), !topbar && /* @__PURE__ */ React17.createElement(ToggleComplementarySidebarButton, {
|
|
1202
1145
|
classNames: fixedComplementarySidebarToggleStyles
|
|
1203
1146
|
}), /* @__PURE__ */ React17.createElement(Stack, {
|
|
1204
1147
|
ref: deckRef,
|
|
@@ -1211,7 +1154,7 @@ var DeckLayout = ({ onDismissToast }) => {
|
|
|
1211
1154
|
itemsCount: itemsCount - 1,
|
|
1212
1155
|
style: padding,
|
|
1213
1156
|
onScroll: handleScroll
|
|
1214
|
-
}, active.map((entryId) => /* @__PURE__ */ React17.createElement(
|
|
1157
|
+
}, active.map((entryId) => /* @__PURE__ */ React17.createElement(Fragment4, {
|
|
1215
1158
|
key: entryId
|
|
1216
1159
|
}, /* @__PURE__ */ React17.createElement(PlankSeparator, {
|
|
1217
1160
|
order: order[entryId] - 1
|
|
@@ -1225,13 +1168,13 @@ var DeckLayout = ({ onDismissToast }) => {
|
|
|
1225
1168
|
settings
|
|
1226
1169
|
}))))), /* @__PURE__ */ React17.createElement("div", {
|
|
1227
1170
|
role: "none",
|
|
1228
|
-
className: solo ? "relative bg-
|
|
1171
|
+
className: solo ? "relative bg-deck overflow-hidden" : "sr-only",
|
|
1229
1172
|
...!solo && {
|
|
1230
1173
|
inert: ""
|
|
1231
1174
|
}
|
|
1232
|
-
}, !topbar &&
|
|
1175
|
+
}, !topbar && /* @__PURE__ */ React17.createElement(ToggleSidebarButton, {
|
|
1233
1176
|
classNames: fixedSidebarToggleStyles
|
|
1234
|
-
}), !topbar &&
|
|
1177
|
+
}), !topbar && /* @__PURE__ */ React17.createElement(ToggleComplementarySidebarButton, {
|
|
1235
1178
|
classNames: fixedComplementarySidebarToggleStyles
|
|
1236
1179
|
}), /* @__PURE__ */ React17.createElement(StackContext.Provider, {
|
|
1237
1180
|
value: {
|
|
@@ -1247,7 +1190,34 @@ var DeckLayout = ({ onDismissToast }) => {
|
|
|
1247
1190
|
settings
|
|
1248
1191
|
})))), topbar && /* @__PURE__ */ React17.createElement(Topbar, null), hoistStatusbar && /* @__PURE__ */ React17.createElement(StatusBar, {
|
|
1249
1192
|
showHints: settings.showHints
|
|
1250
|
-
})), /* @__PURE__ */ React17.createElement(
|
|
1193
|
+
})), /* @__PURE__ */ React17.createElement(Popover2.Portal, null, /* @__PURE__ */ React17.createElement(Popover2.Content, {
|
|
1194
|
+
side: context.popoverSide,
|
|
1195
|
+
onEscapeKeyDown: handlePopoverClose
|
|
1196
|
+
}, /* @__PURE__ */ React17.createElement(Popover2.Viewport, null, /* @__PURE__ */ React17.createElement(Surface10, {
|
|
1197
|
+
role: "popover",
|
|
1198
|
+
data: popoverContent,
|
|
1199
|
+
limit: 1
|
|
1200
|
+
})), /* @__PURE__ */ React17.createElement(Popover2.Arrow, null))), /* @__PURE__ */ React17.createElement(Dialog.Root, {
|
|
1201
|
+
modal: dialogBlockAlign !== "end",
|
|
1202
|
+
open: dialogOpen,
|
|
1203
|
+
onOpenChange: (nextOpen) => context.dialogOpen = nextOpen
|
|
1204
|
+
}, dialogBlockAlign === "end" ? (
|
|
1205
|
+
// TODO(burdon): Placeholder creates a suspense boundary; replace with defaults.
|
|
1206
|
+
/* @__PURE__ */ React17.createElement(Surface10, {
|
|
1207
|
+
role: "dialog",
|
|
1208
|
+
data: dialogContent,
|
|
1209
|
+
limit: 1,
|
|
1210
|
+
fallback: PlankContentError,
|
|
1211
|
+
placeholder: /* @__PURE__ */ React17.createElement("div", null)
|
|
1212
|
+
})
|
|
1213
|
+
) : /* @__PURE__ */ React17.createElement(Dialog.Overlay, {
|
|
1214
|
+
blockAlign: dialogBlockAlign
|
|
1215
|
+
}, /* @__PURE__ */ React17.createElement(Surface10, {
|
|
1216
|
+
role: "dialog",
|
|
1217
|
+
data: dialogContent,
|
|
1218
|
+
limit: 1,
|
|
1219
|
+
fallback: PlankContentError
|
|
1220
|
+
}))), toasts?.map((toast) => /* @__PURE__ */ React17.createElement(Toast, {
|
|
1251
1221
|
...toast,
|
|
1252
1222
|
key: toast.id,
|
|
1253
1223
|
onOpenChange: (open) => {
|
|
@@ -1261,11 +1231,11 @@ var DeckLayout = ({ onDismissToast }) => {
|
|
|
1261
1231
|
|
|
1262
1232
|
// packages/plugins/plugin-deck/src/components/DeckSettings/DeckSettings.tsx
|
|
1263
1233
|
import React18 from "react";
|
|
1264
|
-
import { Input, Select, useTranslation as
|
|
1234
|
+
import { Input, Select, useTranslation as useTranslation9 } from "@dxos/react-ui";
|
|
1265
1235
|
import { DeprecatedFormContainer, DeprecatedFormInput } from "@dxos/react-ui-form";
|
|
1266
1236
|
var isSocket = !!globalThis.__args;
|
|
1267
1237
|
var DeckSettings = ({ settings }) => {
|
|
1268
|
-
const { t } =
|
|
1238
|
+
const { t } = useTranslation9(DECK_PLUGIN);
|
|
1269
1239
|
return /* @__PURE__ */ React18.createElement(DeprecatedFormContainer, null, /* @__PURE__ */ React18.createElement(DeprecatedFormInput, {
|
|
1270
1240
|
label: t("settings enable deck label")
|
|
1271
1241
|
}, /* @__PURE__ */ React18.createElement(Input.Switch, {
|
|
@@ -1316,4 +1286,4 @@ export {
|
|
|
1316
1286
|
DeckLayout,
|
|
1317
1287
|
DeckSettings
|
|
1318
1288
|
};
|
|
1319
|
-
//# sourceMappingURL=chunk-
|
|
1289
|
+
//# sourceMappingURL=chunk-FJBMNSUC.mjs.map
|