@dxos/plugin-deck 0.8.2-staging.7ac8446 → 0.8.3-main.672df60

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.
Files changed (155) hide show
  1. package/dist/lib/browser/{app-graph-builder-VYZ4IWI3.mjs → app-graph-builder-M5BT34YG.mjs} +17 -16
  2. package/dist/lib/browser/app-graph-builder-M5BT34YG.mjs.map +7 -0
  3. package/dist/lib/browser/{check-app-scheme-SEYECDHI.mjs → check-app-scheme-7AXGR6UT.mjs} +2 -3
  4. package/dist/lib/browser/check-app-scheme-7AXGR6UT.mjs.map +7 -0
  5. package/dist/lib/browser/{state-7TN26M42.mjs → chunk-FX44YX3G.mjs} +11 -8
  6. package/dist/lib/browser/chunk-FX44YX3G.mjs.map +7 -0
  7. package/dist/lib/browser/{chunk-XMCG42ID.mjs → chunk-KLN73CM3.mjs} +2 -2
  8. package/dist/lib/browser/{chunk-XMCG42ID.mjs.map → chunk-KLN73CM3.mjs.map} +1 -1
  9. package/dist/lib/browser/chunk-KRDA6PUM.mjs +127 -0
  10. package/dist/lib/browser/chunk-KRDA6PUM.mjs.map +7 -0
  11. package/dist/lib/browser/chunk-LWXMANOA.mjs +1487 -0
  12. package/dist/lib/browser/chunk-LWXMANOA.mjs.map +7 -0
  13. package/dist/lib/browser/chunk-TRFYUEBA.mjs +145 -0
  14. package/dist/lib/browser/chunk-TRFYUEBA.mjs.map +7 -0
  15. package/dist/lib/browser/chunk-YN5OZEGS.mjs +162 -0
  16. package/dist/lib/browser/chunk-YN5OZEGS.mjs.map +7 -0
  17. package/dist/lib/browser/index.mjs +8 -8
  18. package/dist/lib/browser/index.mjs.map +2 -2
  19. package/dist/lib/browser/{intent-resolver-UDYKO2QW.mjs → intent-resolver-3GAC57UA.mjs} +135 -92
  20. package/dist/lib/browser/intent-resolver-3GAC57UA.mjs.map +7 -0
  21. package/dist/lib/browser/meta.json +1 -1
  22. package/dist/lib/browser/{react-root-XLXN2VEW.mjs → react-root-DF3IUPSE.mjs} +7 -7
  23. package/dist/lib/browser/{react-surface-WNGMZL7I.mjs → react-surface-T6YWQ6CS.mjs} +7 -7
  24. package/dist/lib/browser/{settings-HMDGSBGO.mjs → settings-X7GDEXU3.mjs} +6 -6
  25. package/dist/lib/browser/settings-X7GDEXU3.mjs.map +7 -0
  26. package/dist/lib/browser/state-VJ6E3ADY.mjs +10 -0
  27. package/dist/lib/browser/state-VJ6E3ADY.mjs.map +7 -0
  28. package/dist/lib/browser/{tools-SC6QEN7R.mjs → tools-N57NQ2LH.mjs} +28 -18
  29. package/dist/lib/browser/tools-N57NQ2LH.mjs.map +7 -0
  30. package/dist/lib/browser/types.mjs +1 -1
  31. package/dist/lib/browser/{url-handler-ODG4B6NX.mjs → url-handler-BUGI6XRE.mjs} +5 -5
  32. package/dist/lib/browser/url-handler-BUGI6XRE.mjs.map +7 -0
  33. package/dist/types/src/capabilities/app-graph-builder.d.ts +2 -179
  34. package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
  35. package/dist/types/src/capabilities/capabilities.d.ts +18 -8
  36. package/dist/types/src/capabilities/capabilities.d.ts.map +1 -1
  37. package/dist/types/src/capabilities/check-app-scheme.d.ts +2 -2
  38. package/dist/types/src/capabilities/check-app-scheme.d.ts.map +1 -1
  39. package/dist/types/src/capabilities/index.d.ts +8 -183
  40. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  41. package/dist/types/src/capabilities/intent-resolver.d.ts +2 -2
  42. package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -1
  43. package/dist/types/src/capabilities/state.d.ts +12 -7
  44. package/dist/types/src/capabilities/state.d.ts.map +1 -1
  45. package/dist/types/src/capabilities/tools.d.ts +1 -1
  46. package/dist/types/src/capabilities/tools.d.ts.map +1 -1
  47. package/dist/types/src/capabilities/url-handler.d.ts +2 -2
  48. package/dist/types/src/capabilities/url-handler.d.ts.map +1 -1
  49. package/dist/types/src/components/DeckLayout/Banner.d.ts.map +1 -1
  50. package/dist/types/src/components/DeckLayout/ContentEmpty.d.ts.map +1 -1
  51. package/dist/types/src/components/DeckLayout/DeckLayout.d.ts.map +1 -1
  52. package/dist/types/src/components/DeckLayout/Dialog.d.ts +3 -0
  53. package/dist/types/src/components/DeckLayout/Dialog.d.ts.map +1 -0
  54. package/dist/types/src/components/DeckLayout/Popover.d.ts +5 -0
  55. package/dist/types/src/components/DeckLayout/Popover.d.ts.map +1 -0
  56. package/dist/types/src/components/DeckLayout/StatusBar.d.ts.map +1 -1
  57. package/dist/types/src/components/DeckLayout/Toast.d.ts.map +1 -1
  58. package/dist/types/src/components/DeckSettings/DeckSettings.d.ts.map +1 -1
  59. package/dist/types/src/components/Plank/Plank.d.ts +18 -5
  60. package/dist/types/src/components/Plank/Plank.d.ts.map +1 -1
  61. package/dist/types/src/components/Plank/Plank.stories.d.ts +3 -3
  62. package/dist/types/src/components/Plank/Plank.stories.d.ts.map +1 -1
  63. package/dist/types/src/components/Plank/PlankControls.d.ts +3 -2
  64. package/dist/types/src/components/Plank/PlankControls.d.ts.map +1 -1
  65. package/dist/types/src/components/Plank/PlankError.d.ts.map +1 -1
  66. package/dist/types/src/components/Plank/PlankHeading.d.ts +3 -2
  67. package/dist/types/src/components/Plank/PlankHeading.d.ts.map +1 -1
  68. package/dist/types/src/components/Sidebar/ComplementarySidebar.d.ts.map +1 -1
  69. package/dist/types/src/components/Sidebar/Sidebar.d.ts.map +1 -1
  70. package/dist/types/src/components/Sidebar/SidebarButton.d.ts +2 -1
  71. package/dist/types/src/components/Sidebar/SidebarButton.d.ts.map +1 -1
  72. package/dist/types/src/hooks/index.d.ts +5 -1
  73. package/dist/types/src/hooks/index.d.ts.map +1 -1
  74. package/dist/types/src/hooks/useBreakpoints.d.ts.map +1 -0
  75. package/dist/types/src/hooks/useCompanions.d.ts.map +1 -0
  76. package/dist/types/src/hooks/useDeckCompanions.d.ts +13 -0
  77. package/dist/types/src/hooks/useDeckCompanions.d.ts.map +1 -0
  78. package/dist/types/src/hooks/useHoistStatusbar.d.ts +3 -0
  79. package/dist/types/src/hooks/useHoistStatusbar.d.ts.map +1 -0
  80. package/dist/types/src/hooks/useNodeActionExpander.d.ts.map +1 -1
  81. package/dist/types/src/index.d.ts +1 -1
  82. package/dist/types/src/index.d.ts.map +1 -1
  83. package/dist/types/src/layout.d.ts.map +1 -1
  84. package/dist/types/src/translations.d.ts +2 -1
  85. package/dist/types/src/translations.d.ts.map +1 -1
  86. package/dist/types/src/types.d.ts +108 -104
  87. package/dist/types/src/types.d.ts.map +1 -1
  88. package/dist/types/src/util/index.d.ts +1 -4
  89. package/dist/types/src/util/index.d.ts.map +1 -1
  90. package/dist/types/src/util/layoutAppliesTopbar.d.ts +2 -1
  91. package/dist/types/src/util/layoutAppliesTopbar.d.ts.map +1 -1
  92. package/dist/types/src/util/overscroll.d.ts.map +1 -1
  93. package/dist/types/src/util/set-active.d.ts.map +1 -1
  94. package/dist/types/tsconfig.tsbuildinfo +1 -1
  95. package/package.json +39 -30
  96. package/src/capabilities/app-graph-builder.ts +120 -92
  97. package/src/capabilities/check-app-scheme.ts +3 -7
  98. package/src/capabilities/index.ts +3 -2
  99. package/src/capabilities/intent-resolver.ts +181 -135
  100. package/src/capabilities/settings.ts +4 -4
  101. package/src/capabilities/state.ts +7 -4
  102. package/src/capabilities/tools.ts +15 -12
  103. package/src/capabilities/url-handler.ts +4 -4
  104. package/src/components/DeckLayout/ContentEmpty.tsx +9 -4
  105. package/src/components/DeckLayout/DeckLayout.tsx +123 -188
  106. package/src/components/DeckLayout/Dialog.tsx +36 -0
  107. package/src/components/DeckLayout/Popover.tsx +104 -0
  108. package/src/components/Plank/Plank.stories.tsx +20 -8
  109. package/src/components/Plank/Plank.tsx +108 -72
  110. package/src/components/Plank/PlankControls.tsx +53 -57
  111. package/src/components/Plank/PlankError.tsx +2 -6
  112. package/src/components/Plank/PlankHeading.tsx +31 -12
  113. package/src/components/Sidebar/ComplementarySidebar.tsx +36 -57
  114. package/src/components/Sidebar/Sidebar.tsx +7 -4
  115. package/src/components/Sidebar/SidebarButton.tsx +26 -7
  116. package/src/components/fragments.ts +1 -1
  117. package/src/hooks/index.ts +5 -1
  118. package/src/{util → hooks}/useCompanions.ts +3 -3
  119. package/src/hooks/useDeckCompanions.ts +33 -0
  120. package/src/{util → hooks}/useHoistStatusbar.ts +9 -4
  121. package/src/hooks/useNodeActionExpander.ts +3 -8
  122. package/src/index.ts +1 -1
  123. package/src/translations.ts +2 -1
  124. package/src/types.ts +77 -71
  125. package/src/util/index.ts +1 -4
  126. package/src/util/layoutAppliesTopbar.ts +8 -2
  127. package/dist/lib/browser/app-graph-builder-VYZ4IWI3.mjs.map +0 -7
  128. package/dist/lib/browser/check-app-scheme-SEYECDHI.mjs.map +0 -7
  129. package/dist/lib/browser/chunk-6ZSOFCPP.mjs +0 -117
  130. package/dist/lib/browser/chunk-6ZSOFCPP.mjs.map +0 -7
  131. package/dist/lib/browser/chunk-B4LOJUWW.mjs +0 -24
  132. package/dist/lib/browser/chunk-B4LOJUWW.mjs.map +0 -7
  133. package/dist/lib/browser/chunk-FJBMNSUC.mjs +0 -1289
  134. package/dist/lib/browser/chunk-FJBMNSUC.mjs.map +0 -7
  135. package/dist/lib/browser/chunk-FLOVGNYB.mjs +0 -81
  136. package/dist/lib/browser/chunk-FLOVGNYB.mjs.map +0 -7
  137. package/dist/lib/browser/chunk-RJNCG4ND.mjs +0 -154
  138. package/dist/lib/browser/chunk-RJNCG4ND.mjs.map +0 -7
  139. package/dist/lib/browser/intent-resolver-UDYKO2QW.mjs.map +0 -7
  140. package/dist/lib/browser/settings-HMDGSBGO.mjs.map +0 -7
  141. package/dist/lib/browser/state-7TN26M42.mjs.map +0 -7
  142. package/dist/lib/browser/tools-SC6QEN7R.mjs.map +0 -7
  143. package/dist/lib/browser/url-handler-ODG4B6NX.mjs.map +0 -7
  144. package/dist/types/src/components/DeckLayout/Fullscreen.d.ts +0 -5
  145. package/dist/types/src/components/DeckLayout/Fullscreen.d.ts.map +0 -1
  146. package/dist/types/src/util/useBreakpoints.d.ts.map +0 -1
  147. package/dist/types/src/util/useCompanions.d.ts.map +0 -1
  148. package/dist/types/src/util/useHoistStatusbar.d.ts +0 -2
  149. package/dist/types/src/util/useHoistStatusbar.d.ts.map +0 -1
  150. package/src/components/DeckLayout/Fullscreen.tsx +0 -31
  151. /package/dist/lib/browser/{react-root-XLXN2VEW.mjs.map → react-root-DF3IUPSE.mjs.map} +0 -0
  152. /package/dist/lib/browser/{react-surface-WNGMZL7I.mjs.map → react-surface-T6YWQ6CS.mjs.map} +0 -0
  153. /package/dist/types/src/{util → hooks}/useBreakpoints.d.ts +0 -0
  154. /package/dist/types/src/{util → hooks}/useCompanions.d.ts +0 -0
  155. /package/src/{util → hooks}/useBreakpoints.ts +0 -0
@@ -0,0 +1,1487 @@
1
+ import {
2
+ getCompanionId,
3
+ useBreakpoints,
4
+ useCompanions,
5
+ useDeckCompanions,
6
+ useHoistStatusbar,
7
+ useMainSize,
8
+ useNodeActionExpander
9
+ } from "./chunk-KRDA6PUM.mjs";
10
+ import {
11
+ calculateOverscroll,
12
+ layoutAppliesTopbar,
13
+ parseEntryId
14
+ } from "./chunk-TRFYUEBA.mjs";
15
+ import {
16
+ DeckCapabilities
17
+ } from "./chunk-KLN73CM3.mjs";
18
+ import {
19
+ DeckAction,
20
+ NewPlankPositions,
21
+ OverscrollOptions,
22
+ PLANK_COMPANION_TYPE,
23
+ getMode
24
+ } from "./chunk-YN5OZEGS.mjs";
25
+ import {
26
+ DECK_PLUGIN
27
+ } from "./chunk-NSATFAEE.mjs";
28
+
29
+ // packages/plugins/plugin-deck/src/components/DeckLayout/Banner.tsx
30
+ import { useSignals as _useSignals9 } from "@preact-signals/safe-react/tracking";
31
+ import React9 from "react";
32
+ import { Surface as Surface5 } from "@dxos/app-framework";
33
+ import { useTranslation as useTranslation6 } from "@dxos/react-ui";
34
+ import { mx as mx4 } from "@dxos/react-ui-theme";
35
+
36
+ // packages/plugins/plugin-deck/src/components/Sidebar/ComplementarySidebar.tsx
37
+ import { useSignals as _useSignals7 } from "@preact-signals/safe-react/tracking";
38
+ import React7, { Fragment as Fragment2, useCallback as useCallback5, useEffect as useEffect3, useMemo as useMemo3, useState as useState2 } from "react";
39
+ import { LayoutAction as LayoutAction4, Surface as Surface3, createIntent as createIntent5, useCapability as useCapability3, useIntentDispatcher as useIntentDispatcher5 } from "@dxos/app-framework";
40
+ import { Main, useTranslation as useTranslation5, toLocalizedString as toLocalizedString2, IconButton as IconButton4 } from "@dxos/react-ui";
41
+ import { Tabs } from "@dxos/react-ui-tabs";
42
+
43
+ // packages/plugins/plugin-deck/src/components/Sidebar/SidebarButton.tsx
44
+ import { useSignals as _useSignals } from "@preact-signals/safe-react/tracking";
45
+ import React, { useCallback } from "react";
46
+ import { createIntent, LayoutAction, useCapability, useIntentDispatcher } from "@dxos/app-framework";
47
+ import { IconButton, useTranslation } from "@dxos/react-ui";
48
+ var ToggleSidebarButton = ({ classNames, variant = "ghost" }) => {
49
+ var _effect = _useSignals();
50
+ try {
51
+ const layoutContext = useCapability(DeckCapabilities.MutableDeckState);
52
+ const { t } = useTranslation(DECK_PLUGIN);
53
+ return /* @__PURE__ */ React.createElement(IconButton, {
54
+ variant,
55
+ iconOnly: true,
56
+ icon: "ph--sidebar--regular",
57
+ size: 4,
58
+ label: t("open navigation sidebar label"),
59
+ onClick: () => layoutContext.sidebarState = layoutContext.sidebarState === "expanded" ? "collapsed" : "expanded",
60
+ classNames
61
+ });
62
+ } finally {
63
+ _effect.f();
64
+ }
65
+ };
66
+ var CloseSidebarButton = () => {
67
+ var _effect = _useSignals();
68
+ try {
69
+ const layoutContext = useCapability(DeckCapabilities.MutableDeckState);
70
+ const { t } = useTranslation(DECK_PLUGIN);
71
+ return /* @__PURE__ */ React.createElement(IconButton, {
72
+ variant: "ghost",
73
+ iconOnly: true,
74
+ icon: "ph--caret-line-left--regular",
75
+ size: 4,
76
+ label: t("close navigation sidebar label"),
77
+ onClick: () => layoutContext.sidebarState = "collapsed",
78
+ classNames: "rounded-none pli-1 dx-focus-ring-inset pie-[max(.5rem,env(safe-area-inset-left))]"
79
+ });
80
+ } finally {
81
+ _effect.f();
82
+ }
83
+ };
84
+ var ToggleComplementarySidebarButton = ({ inR0, classNames, current }) => {
85
+ var _effect = _useSignals();
86
+ try {
87
+ const { dispatchPromise: dispatch } = useIntentDispatcher();
88
+ const layoutContext = useCapability(DeckCapabilities.MutableDeckState);
89
+ const { t } = useTranslation(DECK_PLUGIN);
90
+ const companions = useDeckCompanions();
91
+ const handleClick = useCallback(async () => {
92
+ layoutContext.complementarySidebarState = layoutContext.complementarySidebarState === "expanded" ? "collapsed" : "expanded";
93
+ const firstCompanion = companions[0];
94
+ if (layoutContext.complementarySidebarState === "expanded" && !current && firstCompanion) {
95
+ await dispatch(createIntent(LayoutAction.UpdateComplementary, {
96
+ part: "complementary",
97
+ subject: getCompanionId(firstCompanion.id)
98
+ }));
99
+ }
100
+ }, [
101
+ layoutContext,
102
+ current,
103
+ companions,
104
+ dispatch
105
+ ]);
106
+ return /* @__PURE__ */ React.createElement(IconButton, {
107
+ iconOnly: true,
108
+ onClick: handleClick,
109
+ variant: "ghost",
110
+ label: t("open complementary sidebar label"),
111
+ classNames: [
112
+ "[&>svg]:-scale-x-100",
113
+ classNames
114
+ ],
115
+ icon: "ph--sidebar-simple--regular",
116
+ size: inR0 ? 5 : 4,
117
+ tooltipSide: inR0 ? "left" : void 0
118
+ });
119
+ } finally {
120
+ _effect.f();
121
+ }
122
+ };
123
+
124
+ // packages/plugins/plugin-deck/src/components/Plank/Plank.tsx
125
+ import { useSignals as _useSignals6 } from "@preact-signals/safe-react/tracking";
126
+ import React6, { memo as memo2, useCallback as useCallback4, useLayoutEffect, useMemo as useMemo2, useRef } from "react";
127
+ import { LayoutAction as LayoutAction3, Surface as Surface2, createIntent as createIntent4, useCapability as useCapability2, useAppGraph as useAppGraph2, useIntentDispatcher as useIntentDispatcher4 } from "@dxos/app-framework";
128
+ import { debounce } from "@dxos/async";
129
+ import { useNode } from "@dxos/plugin-graph";
130
+ import { ATTENDABLE_PATH_SEPARATOR, useAttentionAttributes } from "@dxos/react-ui-attention";
131
+ import { StackItem as StackItem2, railGridHorizontal } from "@dxos/react-ui-stack";
132
+ import { mainIntrinsicSize, mx as mx3 } from "@dxos/react-ui-theme";
133
+
134
+ // packages/plugins/plugin-deck/src/components/Plank/PlankError.tsx
135
+ import { useSignals as _useSignals5 } from "@preact-signals/safe-react/tracking";
136
+ import React5, { useEffect as useEffect2, useState } from "react";
137
+ import { useTranslation as useTranslation4 } from "@dxos/react-ui";
138
+ import { descriptionMessage, mx as mx2 } from "@dxos/react-ui-theme";
139
+
140
+ // packages/plugins/plugin-deck/src/components/Plank/PlankHeading.tsx
141
+ import { useSignals as _useSignals3 } from "@preact-signals/safe-react/tracking";
142
+ import React3, { Fragment, memo, useCallback as useCallback3, useEffect, useMemo } from "react";
143
+ import { createIntent as createIntent3, LayoutAction as LayoutAction2, Surface, useAppGraph, useIntentDispatcher as useIntentDispatcher3 } from "@dxos/app-framework";
144
+ import { Icon, IconButton as IconButton3, Popover, toLocalizedString, useTranslation as useTranslation3 } from "@dxos/react-ui";
145
+ import { StackItem } from "@dxos/react-ui-stack";
146
+ import { TextTooltip } from "@dxos/react-ui-text-tooltip";
147
+ import { hoverableControls, hoverableFocusedWithinControls } from "@dxos/react-ui-theme";
148
+
149
+ // packages/plugins/plugin-deck/src/components/Plank/PlankControls.tsx
150
+ import { useSignals as _useSignals2 } from "@preact-signals/safe-react/tracking";
151
+ import React2, { forwardRef, useCallback as useCallback2 } from "react";
152
+ import { createIntent as createIntent2, useIntentDispatcher as useIntentDispatcher2 } from "@dxos/app-framework";
153
+ import { invariant } from "@dxos/invariant";
154
+ import { ButtonGroup, IconButton as IconButton2, useTranslation as useTranslation2 } from "@dxos/react-ui";
155
+ var __dxlog_file = "/home/runner/work/dxos/dxos/packages/plugins/plugin-deck/src/components/Plank/PlankControls.tsx";
156
+ var PlankControl = ({ icon, label: label3, ...props }) => {
157
+ var _effect = _useSignals2();
158
+ try {
159
+ return /* @__PURE__ */ React2.createElement(IconButton2, {
160
+ iconOnly: true,
161
+ label: label3,
162
+ icon,
163
+ size: 5,
164
+ variant: "ghost",
165
+ tooltipSide: "bottom",
166
+ ...props
167
+ });
168
+ } finally {
169
+ _effect.f();
170
+ }
171
+ };
172
+ var plankControlSpacing = "pli-2";
173
+ var PlankCompanionControls = /* @__PURE__ */ forwardRef(({ primary }, forwardedRef) => {
174
+ var _effect = _useSignals2();
175
+ try {
176
+ const { t } = useTranslation2(DECK_PLUGIN);
177
+ const { dispatchPromise: dispatch } = useIntentDispatcher2();
178
+ const handleCloseCompanion = useCallback2(() => {
179
+ invariant(primary, void 0, {
180
+ F: __dxlog_file,
181
+ L: 49,
182
+ S: void 0,
183
+ A: [
184
+ "primary",
185
+ ""
186
+ ]
187
+ });
188
+ return dispatch(createIntent2(DeckAction.ChangeCompanion, {
189
+ primary,
190
+ companion: null
191
+ }));
192
+ }, []);
193
+ return /* @__PURE__ */ React2.createElement("div", {
194
+ ref: forwardedRef,
195
+ className: "contents app-no-drag"
196
+ }, /* @__PURE__ */ React2.createElement(PlankControl, {
197
+ label: t("close companion label"),
198
+ variant: "ghost",
199
+ icon: "ph--x--regular",
200
+ onClick: handleCloseCompanion,
201
+ classNames: plankControlSpacing
202
+ }));
203
+ } finally {
204
+ _effect.f();
205
+ }
206
+ });
207
+ var PlankControls = /* @__PURE__ */ forwardRef(({ children, classNames, variant = "default", capabilities, layoutMode, pin, close = false, onClick, ...props }, forwardedRef) => {
208
+ var _effect = _useSignals2();
209
+ try {
210
+ const { t } = useTranslation2(DECK_PLUGIN);
211
+ const buttonClassNames = variant === "hide-disabled" ? `disabled:hidden ${plankControlSpacing}` : plankControlSpacing;
212
+ const layoutIsAnySolo = !!layoutMode?.startsWith("solo");
213
+ return /* @__PURE__ */ React2.createElement(ButtonGroup, {
214
+ ...props,
215
+ classNames: [
216
+ "app-no-drag !opacity-100",
217
+ classNames
218
+ ],
219
+ ref: forwardedRef
220
+ }, capabilities.deck ? /* @__PURE__ */ React2.createElement(React2.Fragment, null, capabilities.solo && /* @__PURE__ */ React2.createElement(React2.Fragment, null, layoutMode === "solo" && /* @__PURE__ */ React2.createElement(PlankControl, {
221
+ label: t("show fullscreen plank label"),
222
+ classNames: buttonClassNames,
223
+ icon: "ph--corners-out--regular",
224
+ onClick: () => onClick?.("solo--fullscreen")
225
+ }), /* @__PURE__ */ React2.createElement(PlankControl, {
226
+ label: t(layoutMode === "solo--fullscreen" ? "exit fullscreen label" : layoutIsAnySolo ? "show deck plank label" : "show solo plank label"),
227
+ classNames: buttonClassNames,
228
+ icon: layoutMode === "solo--fullscreen" ? "ph--corners-in--regular" : layoutIsAnySolo ? "ph--arrows-in-line-horizontal--regular" : "ph--arrows-out-line-horizontal--regular",
229
+ onClick: () => onClick?.(layoutMode === "solo--fullscreen" ? "solo--fullscreen" : "solo")
230
+ })), !layoutIsAnySolo && /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(PlankControl, {
231
+ label: t("increment start label"),
232
+ disabled: !capabilities.incrementStart,
233
+ classNames: buttonClassNames,
234
+ icon: "ph--caret-left--regular",
235
+ onClick: () => onClick?.("increment-start")
236
+ }), /* @__PURE__ */ React2.createElement(PlankControl, {
237
+ label: t("increment end label"),
238
+ disabled: !capabilities.incrementEnd,
239
+ classNames: buttonClassNames,
240
+ icon: "ph--caret-right--regular",
241
+ onClick: () => onClick?.("increment-end")
242
+ }))) : capabilities.fullscreen && /* @__PURE__ */ React2.createElement(PlankControl, {
243
+ label: t(layoutMode === "solo--fullscreen" ? "exit fullscreen label" : "show fullscreen plank label"),
244
+ classNames: buttonClassNames,
245
+ icon: layoutMode === "solo--fullscreen" ? "ph--corners-in--regular" : "ph--corners-out--regular",
246
+ onClick: () => onClick?.("solo--fullscreen")
247
+ }), close && !layoutIsAnySolo && /* @__PURE__ */ React2.createElement(PlankControl, {
248
+ label: t(`${typeof close === "string" ? "minify" : "close"} label`),
249
+ classNames: buttonClassNames,
250
+ "data-testid": "plankHeading.close",
251
+ icon: close === "minify-start" ? "ph--caret-line-left--regular" : close === "minify-end" ? "ph--caret-line-right--regular" : "ph--x--regular",
252
+ onClick: () => onClick?.("close")
253
+ }), capabilities.companion && /* @__PURE__ */ React2.createElement(PlankControl, {
254
+ label: t("open companion label"),
255
+ classNames: buttonClassNames,
256
+ "data-testid": "plankHeading.companion",
257
+ icon: "ph--square-split-horizontal--regular",
258
+ onClick: () => onClick?.("companion")
259
+ }), children);
260
+ } finally {
261
+ _effect.f();
262
+ }
263
+ });
264
+
265
+ // packages/plugins/plugin-deck/src/components/fragments.ts
266
+ import { mx } from "@dxos/react-ui-theme";
267
+ var soloInlinePadding = "pis-[calc(env(safe-area-inset-left)+.25rem)] pie-[calc(env(safe-area-inset-left)+.25rem)]";
268
+ var sidebarToggleStyles = "bs-[--rail-item] is-[--rail-item] absolute block-end-2 z-[1] !bg-deckSurface lg:hidden";
269
+ var fixedSidebarToggleStyles = mx(sidebarToggleStyles, "inline-start-2");
270
+ var fixedComplementarySidebarToggleStyles = mx(sidebarToggleStyles, "inline-end-2");
271
+
272
+ // packages/plugins/plugin-deck/src/components/Plank/PlankHeading.tsx
273
+ var MAX_COMPANIONS = 5;
274
+ var PlankHeading = /* @__PURE__ */ memo(({ id, part, node, deckEnabled, canIncrementStart, canIncrementEnd, popoverAnchorId, primaryId, pending, companioned, companions, layoutMode, actions = [] }) => {
275
+ var _effect = _useSignals3();
276
+ try {
277
+ const { t } = useTranslation3(DECK_PLUGIN);
278
+ const { dispatchPromise: dispatch } = useIntentDispatcher3();
279
+ const { graph } = useAppGraph();
280
+ const breakpoint = useBreakpoints();
281
+ const icon = node?.properties?.icon ?? "ph--placeholder--regular";
282
+ const label3 = pending ? t("pending heading") : toLocalizedString(node?.properties?.label ?? [
283
+ "plank heading fallback label",
284
+ {
285
+ ns: DECK_PLUGIN
286
+ }
287
+ ], t);
288
+ const isCompanionNode = node?.type === PLANK_COMPANION_TYPE;
289
+ useEffect(() => {
290
+ const frame = requestAnimationFrame(() => {
291
+ if (node) {
292
+ void graph.expand(node.id);
293
+ }
294
+ });
295
+ return () => cancelAnimationFrame(frame);
296
+ }, [
297
+ node
298
+ ]);
299
+ const attendableId = primaryId ?? id;
300
+ const capabilities = useMemo(() => ({
301
+ deck: deckEnabled ?? true,
302
+ solo: breakpoint !== "mobile" && (part === "solo" || part === "deck"),
303
+ incrementStart: canIncrementStart,
304
+ incrementEnd: canIncrementEnd,
305
+ fullscreen: !isCompanionNode,
306
+ companion: !isCompanionNode && companions && companions.length > 0
307
+ }), [
308
+ breakpoint,
309
+ part,
310
+ companions,
311
+ canIncrementStart,
312
+ canIncrementEnd,
313
+ isCompanionNode,
314
+ deckEnabled
315
+ ]);
316
+ const { variant } = parseEntryId(id);
317
+ const sigilActions = useMemo(() => {
318
+ if (!node) {
319
+ return void 0;
320
+ } else if (variant) {
321
+ return [];
322
+ } else {
323
+ return [
324
+ actions,
325
+ graph.getActions(node.id)
326
+ ].filter((a) => a.length > 0);
327
+ }
328
+ }, [
329
+ actions,
330
+ node,
331
+ variant,
332
+ graph
333
+ ]);
334
+ const handleAction = useCallback3((action) => {
335
+ typeof action.data === "function" && action.data?.({
336
+ parent: node,
337
+ caller: DECK_PLUGIN
338
+ });
339
+ }, [
340
+ node
341
+ ]);
342
+ const handlePlankAction = useCallback3((eventType) => {
343
+ if (eventType.startsWith("solo")) {
344
+ return dispatch(createIntent3(DeckAction.Adjust, {
345
+ type: eventType,
346
+ id
347
+ }));
348
+ } else if (eventType === "close") {
349
+ if (part === "complementary") {
350
+ return dispatch(createIntent3(LayoutAction2.UpdateComplementary, {
351
+ part: "complementary",
352
+ options: {
353
+ state: "collapsed"
354
+ }
355
+ }));
356
+ } else {
357
+ return dispatch(createIntent3(LayoutAction2.Close, {
358
+ part: "main",
359
+ subject: [
360
+ id
361
+ ],
362
+ options: {
363
+ state: false
364
+ }
365
+ }));
366
+ }
367
+ } else {
368
+ return dispatch(createIntent3(DeckAction.Adjust, {
369
+ type: eventType,
370
+ id
371
+ }));
372
+ }
373
+ }, [
374
+ dispatch,
375
+ id,
376
+ part
377
+ ]);
378
+ const ActionRoot = node && popoverAnchorId === `dxos.org/ui/${DECK_PLUGIN}/${node.id}` ? Popover.Anchor : Fragment;
379
+ const handleTabClick = useCallback3((event) => {
380
+ const target = event.target.closest("[data-id]");
381
+ const tabId = target?.dataset?.id;
382
+ if (primaryId && tabId) {
383
+ void dispatch(createIntent3(DeckAction.ChangeCompanion, {
384
+ primary: primaryId,
385
+ companion: tabId
386
+ }));
387
+ }
388
+ }, [
389
+ primaryId
390
+ ]);
391
+ return /* @__PURE__ */ React3.createElement(StackItem.Heading, {
392
+ classNames: [
393
+ "plb-1 border-be border-subduedSeparator items-stretch gap-1 sticky inline-start-12 app-drag min-is-0 contain-layout",
394
+ part === "solo" ? soloInlinePadding : "pli-1",
395
+ ...layoutMode === "solo--fullscreen" ? [
396
+ hoverableControls,
397
+ hoverableFocusedWithinControls,
398
+ "[&>*]: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-subduedSeparator focus-within:border-subduedSeparator"
399
+ ] : []
400
+ ],
401
+ "data-plank-heading": true
402
+ }, companions && isCompanionNode ? /* @__PURE__ */ React3.createElement("div", {
403
+ role: "none",
404
+ className: "flex-1 min-is-0 overflow-x-auto scrollbar-thin flex gap-1"
405
+ }, companions.map(({ id: id2, properties: { icon: icon2, label: label4 } }) => /* @__PURE__ */ React3.createElement(IconButton3, {
406
+ key: id2,
407
+ "data-id": id2,
408
+ icon: icon2,
409
+ iconOnly: companions.length > MAX_COMPANIONS && node?.id !== id2,
410
+ label: toLocalizedString(label4, t),
411
+ size: 5,
412
+ variant: node?.id === id2 ? "primary" : "default",
413
+ onClick: handleTabClick
414
+ }))) : /* @__PURE__ */ React3.createElement(React3.Fragment, null, /* @__PURE__ */ React3.createElement(ActionRoot, null, node && sigilActions ? /* @__PURE__ */ React3.createElement(StackItem.Sigil, {
415
+ icon,
416
+ related: part === "complementary",
417
+ attendableId,
418
+ triggerLabel: t("actions menu label"),
419
+ actions: sigilActions,
420
+ onAction: handleAction
421
+ }, /* @__PURE__ */ React3.createElement(Surface, {
422
+ role: "menu-footer",
423
+ data: {
424
+ subject: node.data
425
+ }
426
+ })) : /* @__PURE__ */ React3.createElement(StackItem.SigilButton, null, /* @__PURE__ */ React3.createElement("span", {
427
+ className: "sr-only"
428
+ }, label3), /* @__PURE__ */ React3.createElement(Icon, {
429
+ icon,
430
+ size: 5
431
+ }))), /* @__PURE__ */ React3.createElement(TextTooltip, {
432
+ text: label3,
433
+ onlyWhenTruncating: true
434
+ }, /* @__PURE__ */ React3.createElement(StackItem.HeadingLabel, {
435
+ attendableId,
436
+ related: part === "complementary",
437
+ ...pending && {
438
+ classNames: "text-description"
439
+ }
440
+ }, label3))), node && part !== "complementary" && /* @__PURE__ */ React3.createElement(Surface, {
441
+ role: "navbar-end",
442
+ data: {
443
+ subject: node.data
444
+ }
445
+ }), companioned === "companion" ? /* @__PURE__ */ React3.createElement(PlankCompanionControls, {
446
+ primary: primaryId
447
+ }) : /* @__PURE__ */ React3.createElement(PlankControls, {
448
+ capabilities,
449
+ layoutMode,
450
+ close: part === "complementary" ? "minify-end" : true,
451
+ onClick: handlePlankAction
452
+ }));
453
+ } finally {
454
+ _effect.f();
455
+ }
456
+ });
457
+
458
+ // packages/plugins/plugin-deck/src/components/Plank/PlankLoading.tsx
459
+ import { useSignals as _useSignals4 } from "@preact-signals/safe-react/tracking";
460
+ import React4 from "react";
461
+ var PlankLoading = () => {
462
+ var _effect = _useSignals4();
463
+ try {
464
+ return /* @__PURE__ */ React4.createElement("div", {
465
+ role: "none",
466
+ className: "grid place-items-center attention-surface"
467
+ });
468
+ } finally {
469
+ _effect.f();
470
+ }
471
+ };
472
+
473
+ // packages/plugins/plugin-deck/src/components/Plank/PlankError.tsx
474
+ var PlankContentError = ({ error }) => {
475
+ var _effect = _useSignals5();
476
+ try {
477
+ const { t } = useTranslation4(DECK_PLUGIN);
478
+ const errorString = error?.toString() ?? "";
479
+ return /* @__PURE__ */ React5.createElement("div", {
480
+ role: "none",
481
+ className: "overflow-auto p-8 attention-surface grid place-items-center"
482
+ }, /* @__PURE__ */ React5.createElement("p", {
483
+ role: "alert",
484
+ className: mx2(descriptionMessage, "break-words rounded-lg p-8", errorString.length < 256 && "text-lg")
485
+ }, error ? errorString : t("error fallback message")));
486
+ } finally {
487
+ _effect.f();
488
+ }
489
+ };
490
+ var PlankError = ({ id, part, node, error }) => {
491
+ var _effect = _useSignals5();
492
+ try {
493
+ const [timedOut, setTimedOut] = useState(false);
494
+ useEffect2(() => {
495
+ setTimeout(() => setTimedOut(true), 5e3);
496
+ }, []);
497
+ return /* @__PURE__ */ React5.createElement(React5.Fragment, null, /* @__PURE__ */ React5.createElement(PlankHeading, {
498
+ id,
499
+ part,
500
+ node,
501
+ pending: !timedOut
502
+ }), timedOut ? /* @__PURE__ */ React5.createElement(PlankContentError, {
503
+ error
504
+ }) : /* @__PURE__ */ React5.createElement(PlankLoading, null));
505
+ } finally {
506
+ _effect.f();
507
+ }
508
+ };
509
+
510
+ // packages/plugins/plugin-deck/src/components/Plank/Plank.tsx
511
+ var UNKNOWN_ID = "unknown_id";
512
+ var Plank = /* @__PURE__ */ memo2(({ id = UNKNOWN_ID, companionId, ...props }) => {
513
+ var _effect = _useSignals6();
514
+ try {
515
+ const { graph } = useAppGraph2();
516
+ const node = useNode(graph, id);
517
+ const companions = useCompanions(id);
518
+ const currentCompanion = companions.find(({ id: id2 }) => id2 === companionId);
519
+ const hasCompanion = !!(companionId && currentCompanion);
520
+ return /* @__PURE__ */ React6.createElement(PlankContainer, {
521
+ solo: props.part === "solo",
522
+ companion: hasCompanion
523
+ }, /* @__PURE__ */ React6.createElement(PlankComponent, {
524
+ id,
525
+ node,
526
+ companioned: hasCompanion ? "primary" : void 0,
527
+ companions: hasCompanion ? [] : companions,
528
+ ...props,
529
+ ...props.part === "solo" ? {
530
+ part: "solo-primary"
531
+ } : {}
532
+ }), hasCompanion && /* @__PURE__ */ React6.createElement(PlankComponent, {
533
+ id: companionId,
534
+ node: currentCompanion,
535
+ primary: node,
536
+ companions,
537
+ companioned: "companion",
538
+ ...props,
539
+ ...props.part === "solo" ? {
540
+ part: "solo-companion"
541
+ } : {
542
+ order: (props.order ?? 0) + 1
543
+ }
544
+ }));
545
+ } finally {
546
+ _effect.f();
547
+ }
548
+ });
549
+ var PlankContainer = ({ children, solo, companion }) => {
550
+ var _effect = _useSignals6();
551
+ try {
552
+ const sizeAttrs = useMainSize();
553
+ if (!solo) {
554
+ return children;
555
+ }
556
+ return /* @__PURE__ */ React6.createElement("div", {
557
+ role: "none",
558
+ className: mx3("absolute inset-0 grid", companion && "grid-cols-[1fr_1fr]", railGridHorizontal, mainIntrinsicSize),
559
+ ...sizeAttrs
560
+ }, children);
561
+ } finally {
562
+ _effect.f();
563
+ }
564
+ };
565
+ var PlankComponent = /* @__PURE__ */ memo2(({ layoutMode, id, part, path, order, active, companioned, node, primary, companions, settings }) => {
566
+ var _effect = _useSignals6();
567
+ try {
568
+ const { dispatchPromise: dispatch } = useIntentDispatcher4();
569
+ const { deck, popoverAnchorId, scrollIntoView } = useCapability2(DeckCapabilities.DeckState);
570
+ const canResize = layoutMode === "deck";
571
+ const attentionAttrs = useAttentionAttributes(primary?.id ?? id);
572
+ const index = active ? active.findIndex((entryId) => entryId === id) : 0;
573
+ const length = active?.length ?? 1;
574
+ const canIncrementStart = active && index !== void 0 && index > 0 && length !== void 0 && length > 1;
575
+ const canIncrementEnd = active && index !== void 0 && index < length - 1 && length !== void 0;
576
+ const rootElement = useRef(null);
577
+ const { variant } = parseEntryId(id);
578
+ const sizeKey = `${id.split("+")[0]}${variant ? `${ATTENDABLE_PATH_SEPARATOR}${variant}` : ""}`;
579
+ const size = deck.plankSizing[sizeKey];
580
+ const handleSizeChange = useCallback4(debounce((nextSize) => {
581
+ return dispatch(createIntent4(DeckAction.UpdatePlankSize, {
582
+ id: sizeKey,
583
+ size: nextSize
584
+ }));
585
+ }, 200), [
586
+ dispatch,
587
+ sizeKey
588
+ ]);
589
+ const handleKeyDown = useCallback4((event) => {
590
+ if (event.target === event.currentTarget && event.key === "Escape") {
591
+ rootElement.current?.closest("main")?.focus();
592
+ }
593
+ }, []);
594
+ useLayoutEffect(() => {
595
+ if (scrollIntoView === id) {
596
+ const focusable = rootElement.current?.querySelector("button") || rootElement.current;
597
+ focusable?.focus({
598
+ preventScroll: true
599
+ });
600
+ layoutMode === "deck" && focusable?.scrollIntoView({
601
+ behavior: "smooth",
602
+ inline: "center"
603
+ });
604
+ void dispatch(createIntent4(LayoutAction3.ScrollIntoView, {
605
+ part: "current",
606
+ subject: void 0
607
+ }));
608
+ }
609
+ }, [
610
+ id,
611
+ scrollIntoView,
612
+ layoutMode
613
+ ]);
614
+ const isSolo = layoutMode.startsWith("solo") && part === "solo";
615
+ const isAttendable = layoutMode.startsWith("solo") && part.startsWith("solo") || layoutMode === "deck" && part === "deck";
616
+ const sizeAttrs = useMainSize();
617
+ const data = useMemo2(() => node && {
618
+ subject: node.data,
619
+ companionTo: primary?.data,
620
+ variant,
621
+ path,
622
+ popoverAnchorId
623
+ }, [
624
+ node,
625
+ node?.data,
626
+ path,
627
+ popoverAnchorId,
628
+ primary?.data,
629
+ variant
630
+ ]);
631
+ const placeholder = useMemo2(() => /* @__PURE__ */ React6.createElement(PlankLoading, null), []);
632
+ const Root = part.startsWith("solo") ? "article" : StackItem2.Root;
633
+ const className = mx3("attention-surface relative dx-focus-ring-inset-over-all", 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");
634
+ return /* @__PURE__ */ React6.createElement(Root, {
635
+ ref: rootElement,
636
+ "data-testid": "deck.plank",
637
+ tabIndex: 0,
638
+ ...part.startsWith("solo") ? {
639
+ ...sizeAttrs,
640
+ className
641
+ } : {
642
+ item: {
643
+ id
644
+ },
645
+ size,
646
+ onSizeChange: handleSizeChange,
647
+ classNames: className,
648
+ order,
649
+ role: "article"
650
+ },
651
+ ...isAttendable ? attentionAttrs : {},
652
+ onKeyDown: handleKeyDown
653
+ }, node ? /* @__PURE__ */ React6.createElement(React6.Fragment, null, /* @__PURE__ */ React6.createElement(PlankHeading, {
654
+ id,
655
+ part: part.startsWith("solo-") ? "solo" : part,
656
+ node,
657
+ layoutMode,
658
+ deckEnabled: settings?.enableDeck,
659
+ canIncrementStart,
660
+ canIncrementEnd,
661
+ popoverAnchorId,
662
+ primaryId: primary?.id,
663
+ companioned,
664
+ companions
665
+ }), /* @__PURE__ */ React6.createElement(Surface2, {
666
+ key: node.id,
667
+ role: "article",
668
+ data,
669
+ limit: 1,
670
+ fallback: PlankContentError,
671
+ placeholder
672
+ })) : /* @__PURE__ */ React6.createElement(PlankError, {
673
+ id,
674
+ part
675
+ }), canResize && /* @__PURE__ */ React6.createElement(StackItem2.ResizeHandle, null));
676
+ } finally {
677
+ _effect.f();
678
+ }
679
+ });
680
+
681
+ // packages/plugins/plugin-deck/src/components/Sidebar/ComplementarySidebar.tsx
682
+ var label = [
683
+ "complementary sidebar title",
684
+ {
685
+ ns: DECK_PLUGIN
686
+ }
687
+ ];
688
+ var ComplementarySidebar = ({ current }) => {
689
+ var _effect = _useSignals7();
690
+ try {
691
+ const { t } = useTranslation5(DECK_PLUGIN);
692
+ const { dispatchPromise: dispatch } = useIntentDispatcher5();
693
+ const layout = useCapability3(DeckCapabilities.MutableDeckState);
694
+ const layoutMode = getMode(layout.deck);
695
+ const breakpoint = useBreakpoints();
696
+ const topbar = layoutAppliesTopbar(breakpoint, layoutMode);
697
+ const hoistStatusbar = useHoistStatusbar(breakpoint, layoutMode);
698
+ const companions = useDeckCompanions();
699
+ const activeCompanion = companions.find((companion) => getCompanionId(companion.id) === current);
700
+ const activeId = activeCompanion && getCompanionId(activeCompanion.id);
701
+ const [internalValue, setInternalValue] = useState2(activeId);
702
+ useEffect3(() => {
703
+ setInternalValue(activeId);
704
+ }, [
705
+ activeId
706
+ ]);
707
+ const handleTabClick = useCallback5((event) => {
708
+ const nextValue = event.currentTarget.getAttribute("data-value");
709
+ if (nextValue === activeId) {
710
+ layout.complementarySidebarState = layout.complementarySidebarState === "expanded" ? "collapsed" : "expanded";
711
+ } else {
712
+ setInternalValue(nextValue);
713
+ layout.complementarySidebarState = "expanded";
714
+ void dispatch(createIntent5(LayoutAction4.UpdateComplementary, {
715
+ part: "complementary",
716
+ subject: nextValue
717
+ }));
718
+ }
719
+ }, [
720
+ layout,
721
+ activeId,
722
+ dispatch
723
+ ]);
724
+ const data = useMemo3(() => activeCompanion && {
725
+ id: activeCompanion.id,
726
+ subject: activeCompanion.data
727
+ }, [
728
+ activeCompanion?.id,
729
+ activeCompanion?.data
730
+ ]);
731
+ useEffect3(() => {
732
+ if (!activeId) {
733
+ void dispatch(createIntent5(LayoutAction4.UpdateComplementary, {
734
+ part: "complementary",
735
+ options: {
736
+ state: "collapsed"
737
+ }
738
+ }));
739
+ }
740
+ }, [
741
+ activeId,
742
+ dispatch
743
+ ]);
744
+ return /* @__PURE__ */ React7.createElement(Main.ComplementarySidebar, {
745
+ label,
746
+ classNames: [
747
+ topbar && "block-start-[calc(env(safe-area-inset-top)+var(--rail-size))]",
748
+ hoistStatusbar && "block-end-[--statusbar-size]"
749
+ ]
750
+ }, /* @__PURE__ */ React7.createElement(Tabs.Root, {
751
+ orientation: "vertical",
752
+ verticalVariant: "stateless",
753
+ value: internalValue,
754
+ classNames: "contents"
755
+ }, /* @__PURE__ */ React7.createElement("div", {
756
+ role: "none",
757
+ className: "absolute z-[1] inset-block-0 inline-end-0 !is-[--r0-size] pbs-[env(safe-area-inset-top)] pbe-[env(safe-area-inset-bottom)] border-is border-subduedSeparator grid grid-cols-1 grid-rows-[1fr_min-content] bg-baseSurface contain-layout app-drag"
758
+ }, /* @__PURE__ */ React7.createElement(Tabs.Tablist, {
759
+ classNames: "grid grid-cols-1 auto-rows-[--rail-action] p-1 gap-1 !overflow-y-auto"
760
+ }, companions.map((companion) => /* @__PURE__ */ React7.createElement(Tabs.Tab, {
761
+ key: getCompanionId(companion.id),
762
+ value: getCompanionId(companion.id),
763
+ asChild: true
764
+ }, /* @__PURE__ */ React7.createElement(IconButton4, {
765
+ label: toLocalizedString2(companion.properties.label, t),
766
+ icon: companion.properties.icon,
767
+ size: 5,
768
+ iconOnly: true,
769
+ tooltipSide: "left",
770
+ "data-value": getCompanionId(companion.id),
771
+ variant: activeId === getCompanionId(companion.id) ? layout.complementarySidebarState === "expanded" ? "primary" : "default" : "ghost",
772
+ onClick: handleTabClick
773
+ })))), !hoistStatusbar && /* @__PURE__ */ React7.createElement("div", {
774
+ role: "none",
775
+ className: "grid grid-cols-1 auto-rows-[--rail-item] p-1 overflow-y-auto"
776
+ }, /* @__PURE__ */ React7.createElement(Surface3, {
777
+ role: "status-bar--r0-footer",
778
+ limit: 1
779
+ })), /* @__PURE__ */ React7.createElement("div", {
780
+ role: "none",
781
+ className: "hidden lg:grid grid-cols-1 auto-rows-[--rail-action] p-1"
782
+ }, /* @__PURE__ */ React7.createElement(ToggleComplementarySidebarButton, null))), activeId && companions.map((companion) => /* @__PURE__ */ React7.createElement(Tabs.Tabpanel, {
783
+ key: getCompanionId(companion.id),
784
+ value: getCompanionId(companion.id),
785
+ 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)]',
786
+ ...layout.complementarySidebarState !== "expanded" && {
787
+ inert: "true"
788
+ }
789
+ }, /* @__PURE__ */ React7.createElement(ComplementarySidebarPanel, {
790
+ companion,
791
+ activeId,
792
+ data,
793
+ hoistStatusbar
794
+ })))));
795
+ } finally {
796
+ _effect.f();
797
+ }
798
+ };
799
+ var ScrollArea = ({ children }) => {
800
+ var _effect = _useSignals7();
801
+ try {
802
+ return /* @__PURE__ */ React7.createElement("div", {
803
+ className: "flex flex-col grow overflow-x-hidden overflow-y-auto scrollbar-thin"
804
+ }, children);
805
+ } finally {
806
+ _effect.f();
807
+ }
808
+ };
809
+ var ComplementarySidebarPanel = ({ companion, activeId, data, hoistStatusbar }) => {
810
+ var _effect = _useSignals7();
811
+ try {
812
+ const { t } = useTranslation5(DECK_PLUGIN);
813
+ if (getCompanionId(companion.id) !== activeId && !data) {
814
+ return null;
815
+ }
816
+ const Wrapper = companion.properties.fixed ? Fragment2 : ScrollArea;
817
+ return /* @__PURE__ */ React7.createElement(React7.Fragment, null, /* @__PURE__ */ React7.createElement("h2", {
818
+ className: "flex items-center pli-2 border-subduedSeparator border-be font-medium"
819
+ }, toLocalizedString2(companion.properties.label, t)), /* @__PURE__ */ React7.createElement(Wrapper, null, /* @__PURE__ */ React7.createElement(Surface3, {
820
+ role: `deck-companion--${getCompanionId(companion.id)}`,
821
+ data,
822
+ fallback: PlankContentError,
823
+ placeholder: /* @__PURE__ */ React7.createElement(PlankLoading, null)
824
+ })), !hoistStatusbar && /* @__PURE__ */ React7.createElement("div", {
825
+ role: "contentinfo",
826
+ className: "flex flex-wrap justify-center items-center border-bs border-subduedSeparator pbs-1 pbe-[max(env(safe-area-inset-bottom),0.25rem)]"
827
+ }, /* @__PURE__ */ React7.createElement(Surface3, {
828
+ role: "status-bar--r1-footer",
829
+ limit: 1
830
+ })));
831
+ } finally {
832
+ _effect.f();
833
+ }
834
+ };
835
+
836
+ // packages/plugins/plugin-deck/src/components/Sidebar/Sidebar.tsx
837
+ import { useSignals as _useSignals8 } from "@preact-signals/safe-react/tracking";
838
+ import React8, { useMemo as useMemo4 } from "react";
839
+ import { Surface as Surface4, useCapability as useCapability4 } from "@dxos/app-framework";
840
+ import { Main as Main2 } from "@dxos/react-ui";
841
+ var label2 = [
842
+ "sidebar title",
843
+ {
844
+ ns: DECK_PLUGIN
845
+ }
846
+ ];
847
+ var Sidebar = () => {
848
+ var _effect = _useSignals8();
849
+ try {
850
+ const { popoverAnchorId, activeDeck: current, deck } = useCapability4(DeckCapabilities.DeckState);
851
+ const breakpoint = useBreakpoints();
852
+ const layoutMode = getMode(deck);
853
+ const topbar = layoutAppliesTopbar(breakpoint, layoutMode);
854
+ const hoistStatusbar = useHoistStatusbar(breakpoint, layoutMode);
855
+ const navigationData = useMemo4(() => ({
856
+ popoverAnchorId,
857
+ topbar,
858
+ hoistStatusbar,
859
+ current
860
+ }), [
861
+ popoverAnchorId,
862
+ topbar,
863
+ hoistStatusbar,
864
+ current
865
+ ]);
866
+ return /* @__PURE__ */ React8.createElement(Main2.NavigationSidebar, {
867
+ label: label2,
868
+ classNames: [
869
+ "grid",
870
+ topbar && "block-start-[calc(env(safe-area-inset-top)+var(--rail-size))]",
871
+ hoistStatusbar && "block-end-[--statusbar-size]"
872
+ ]
873
+ }, /* @__PURE__ */ React8.createElement(Surface4, {
874
+ role: "navigation",
875
+ data: navigationData,
876
+ limit: 1
877
+ }));
878
+ } finally {
879
+ _effect.f();
880
+ }
881
+ };
882
+
883
+ // packages/plugins/plugin-deck/src/components/DeckLayout/Banner.tsx
884
+ var Banner = ({ variant, classNames }) => {
885
+ var _effect = _useSignals9();
886
+ try {
887
+ const { t } = useTranslation6(DECK_PLUGIN);
888
+ return /* @__PURE__ */ React9.createElement("header", {
889
+ className: mx4("flex items-stretch relative plb-1 pis-1 pie-2", variant === "topbar" && "fixed inset-inline-0 block-start-[env(safe-area-inset-top)] bs-[--rail-size] border-be border-separator", classNames)
890
+ }, variant === "sidebar" ? /* @__PURE__ */ React9.createElement(CloseSidebarButton, null) : /* @__PURE__ */ React9.createElement(ToggleSidebarButton, null), /* @__PURE__ */ React9.createElement("span", {
891
+ className: "self-center grow mis-1"
892
+ }, t("current app name", {
893
+ ns: "appkit"
894
+ })), variant === "topbar" && /* @__PURE__ */ React9.createElement("div", {
895
+ role: "none",
896
+ className: "absolute inset-0 pointer-events-none"
897
+ }, /* @__PURE__ */ React9.createElement("div", {
898
+ role: "none",
899
+ className: "grid bs-full pointer-fine:p-1 max-is-md mli-auto pointer-events-auto"
900
+ }, /* @__PURE__ */ React9.createElement(Surface5, {
901
+ role: "search-input",
902
+ limit: 1
903
+ }))), /* @__PURE__ */ React9.createElement("span", {
904
+ role: "none",
905
+ className: "grow"
906
+ }), /* @__PURE__ */ React9.createElement(Surface5, {
907
+ role: "header-end",
908
+ limit: 1
909
+ }), /* @__PURE__ */ React9.createElement(Surface5, {
910
+ role: "notch-start",
911
+ limit: 1
912
+ }));
913
+ } finally {
914
+ _effect.f();
915
+ }
916
+ };
917
+
918
+ // packages/plugins/plugin-deck/src/components/DeckLayout/DeckLayout.tsx
919
+ import { useSignals as _useSignals17 } from "@preact-signals/safe-react/tracking";
920
+ import { untracked } from "@preact/signals-core";
921
+ import React17, { useCallback as useCallback7, useEffect as useEffect5, useMemo as useMemo6, useRef as useRef3, Fragment as Fragment3 } from "react";
922
+ import { Capabilities, LayoutAction as LayoutAction5, createIntent as createIntent6, useCapability as useCapability8, useIntentDispatcher as useIntentDispatcher6, usePluginManager } from "@dxos/app-framework";
923
+ import { AttentionCapabilities } from "@dxos/plugin-attention";
924
+ import { Main as Main3, useMediaQuery, useOnTransition } from "@dxos/react-ui";
925
+ import { Stack, StackContext, DEFAULT_HORIZONTAL_SIZE } from "@dxos/react-ui-stack";
926
+ import { mainPaddingTransitions } from "@dxos/react-ui-theme";
927
+
928
+ // packages/plugins/plugin-deck/src/components/DeckLayout/ActiveNode.tsx
929
+ import { useSignals as _useSignals10 } from "@preact-signals/safe-react/tracking";
930
+ import React10 from "react";
931
+ import { Surface as Surface6, useAppGraph as useAppGraph3 } from "@dxos/app-framework";
932
+ import { useNode as useNode2 } from "@dxos/plugin-graph";
933
+ import { useAttended } from "@dxos/react-ui-attention";
934
+ var ActiveNode = () => {
935
+ var _effect = _useSignals10();
936
+ try {
937
+ const [id] = useAttended();
938
+ const { graph } = useAppGraph3();
939
+ const activeNode = useNode2(graph, id);
940
+ useNodeActionExpander(activeNode);
941
+ return /* @__PURE__ */ React10.createElement("div", {
942
+ role: "none",
943
+ className: "sr-only"
944
+ }, /* @__PURE__ */ React10.createElement(Surface6, {
945
+ role: "document-title",
946
+ data: {
947
+ subject: activeNode
948
+ },
949
+ limit: 1
950
+ }));
951
+ } finally {
952
+ _effect.f();
953
+ }
954
+ };
955
+
956
+ // packages/plugins/plugin-deck/src/components/DeckLayout/ContentEmpty.tsx
957
+ import { useSignals as _useSignals11 } from "@preact-signals/safe-react/tracking";
958
+ import React11 from "react";
959
+ import { Surface as Surface7, useCapability as useCapability5 } from "@dxos/app-framework";
960
+ var ContentEmpty = () => {
961
+ var _effect = _useSignals11();
962
+ try {
963
+ const breakpoint = useBreakpoints();
964
+ const { deck } = useCapability5(DeckCapabilities.MutableDeckState);
965
+ const layoutMode = getMode(deck);
966
+ const topbar = layoutAppliesTopbar(breakpoint, layoutMode);
967
+ return /* @__PURE__ */ React11.createElement("div", {
968
+ role: "none",
969
+ className: "grid place-items-center p-8 relative bg-deckSurface",
970
+ "data-testid": "layoutPlugin.firstRunMessage"
971
+ }, /* @__PURE__ */ React11.createElement(Surface7, {
972
+ role: "keyshortcuts"
973
+ }), !topbar && /* @__PURE__ */ React11.createElement(ToggleSidebarButton, {
974
+ variant: "default",
975
+ classNames: fixedSidebarToggleStyles
976
+ }));
977
+ } finally {
978
+ _effect.f();
979
+ }
980
+ };
981
+
982
+ // packages/plugins/plugin-deck/src/components/DeckLayout/Dialog.tsx
983
+ import { useSignals as _useSignals12 } from "@preact-signals/safe-react/tracking";
984
+ import React12 from "react";
985
+ import { Surface as Surface8, useCapability as useCapability6 } from "@dxos/app-framework";
986
+ import { AlertDialog, Dialog as NaturalDialog } from "@dxos/react-ui";
987
+ var Dialog = () => {
988
+ var _effect = _useSignals12();
989
+ try {
990
+ const context = useCapability6(DeckCapabilities.MutableDeckState);
991
+ const { dialogOpen, dialogType, dialogBlockAlign, dialogOverlayClasses, dialogOverlayStyle, dialogContent } = context;
992
+ const Root = dialogType === "alert" ? AlertDialog.Root : NaturalDialog.Root;
993
+ const Overlay = dialogType === "alert" ? AlertDialog.Overlay : NaturalDialog.Overlay;
994
+ return /* @__PURE__ */ React12.createElement(Root, {
995
+ modal: dialogBlockAlign !== "end",
996
+ open: dialogOpen,
997
+ onOpenChange: (nextOpen) => context.dialogOpen = nextOpen
998
+ }, dialogBlockAlign === "end" ? (
999
+ // TODO(burdon): Placeholder creates a suspense boundary; replace with defaults.
1000
+ /* @__PURE__ */ React12.createElement(Surface8, {
1001
+ role: "dialog",
1002
+ data: dialogContent,
1003
+ limit: 1,
1004
+ fallback: PlankContentError,
1005
+ placeholder: /* @__PURE__ */ React12.createElement("div", null)
1006
+ })
1007
+ ) : /* @__PURE__ */ React12.createElement(Overlay, {
1008
+ blockAlign: dialogBlockAlign,
1009
+ classNames: dialogOverlayClasses,
1010
+ style: dialogOverlayStyle
1011
+ }, /* @__PURE__ */ React12.createElement(Surface8, {
1012
+ role: "dialog",
1013
+ data: dialogContent,
1014
+ limit: 1,
1015
+ fallback: PlankContentError
1016
+ })));
1017
+ } finally {
1018
+ _effect.f();
1019
+ }
1020
+ };
1021
+
1022
+ // packages/plugins/plugin-deck/src/components/DeckLayout/Popover.tsx
1023
+ import { useSignals as _useSignals13 } from "@preact-signals/safe-react/tracking";
1024
+ import { createContext } from "@radix-ui/react-context";
1025
+ import React13, { useCallback as useCallback6, useEffect as useEffect4, useMemo as useMemo5, useRef as useRef2, useState as useState3 } from "react";
1026
+ import { Surface as Surface9, useCapability as useCapability7 } from "@dxos/app-framework";
1027
+ import { Popover as Popover2 } from "@dxos/react-ui";
1028
+ var DEBOUNCE_DELAY = 40;
1029
+ var [DeckPopoverProvider, useDeckPopoverContext] = createContext("DeckPopover");
1030
+ var PopoverRoot = ({ children }) => {
1031
+ var _effect = _useSignals13();
1032
+ try {
1033
+ const layout = useCapability7(DeckCapabilities.MutableDeckState);
1034
+ const virtualRef = useRef2(null);
1035
+ const [virtualIter, setVirtualIter] = useState3(0);
1036
+ const [open, setOpen] = useState3(false);
1037
+ const debounceRef = useRef2(null);
1038
+ useEffect4(() => {
1039
+ setOpen(false);
1040
+ if (layout.popoverOpen) {
1041
+ if (debounceRef.current) {
1042
+ clearTimeout(debounceRef.current);
1043
+ }
1044
+ if (layout.popoverAnchor && virtualRef.current !== layout.popoverAnchor) {
1045
+ virtualRef.current = layout.popoverAnchor ?? null;
1046
+ setVirtualIter((iter) => iter + 1);
1047
+ }
1048
+ debounceRef.current = setTimeout(() => setOpen(true), DEBOUNCE_DELAY);
1049
+ }
1050
+ }, [
1051
+ layout.popoverOpen,
1052
+ layout.popoverAnchorId,
1053
+ layout.popoverAnchor,
1054
+ layout.popoverContent
1055
+ ]);
1056
+ return /* @__PURE__ */ React13.createElement(DeckPopoverProvider, {
1057
+ setOpen
1058
+ }, /* @__PURE__ */ React13.createElement(Popover2.Root, {
1059
+ modal: false,
1060
+ open
1061
+ }, layout.popoverAnchor && /* @__PURE__ */ React13.createElement(Popover2.VirtualTrigger, {
1062
+ key: virtualIter,
1063
+ virtualRef
1064
+ }), children));
1065
+ } finally {
1066
+ _effect.f();
1067
+ }
1068
+ };
1069
+ var PopoverContent = () => {
1070
+ var _effect = _useSignals13();
1071
+ try {
1072
+ const layout = useCapability7(DeckCapabilities.MutableDeckState);
1073
+ const { setOpen } = useDeckPopoverContext("PopoverContent");
1074
+ const handleClose = useCallback6((event) => {
1075
+ if (
1076
+ // TODO(thure): CodeMirror should not focus itself when it updates.
1077
+ event.type === "dismissableLayer.focusOutside" && event.currentTarget?.classList.contains("cm-content")
1078
+ ) {
1079
+ event.preventDefault();
1080
+ } else {
1081
+ setOpen(false);
1082
+ layout.popoverOpen = false;
1083
+ layout.popoverAnchor = void 0;
1084
+ layout.popoverAnchorId = void 0;
1085
+ layout.popoverSide = void 0;
1086
+ }
1087
+ }, [
1088
+ setOpen
1089
+ ]);
1090
+ const collisionBoundaries = useMemo5(() => {
1091
+ const closest = layout.popoverAnchor?.closest("[data-popover-collision-boundary]");
1092
+ return closest ? [
1093
+ closest
1094
+ ] : [];
1095
+ }, [
1096
+ layout.popoverAnchor
1097
+ ]);
1098
+ return /* @__PURE__ */ React13.createElement(Popover2.Portal, null, /* @__PURE__ */ React13.createElement(Popover2.Content, {
1099
+ side: layout.popoverSide,
1100
+ onInteractOutside: handleClose,
1101
+ onEscapeKeyDown: handleClose,
1102
+ collisionBoundary: collisionBoundaries,
1103
+ sticky: "always",
1104
+ hideWhenDetached: true
1105
+ }, /* @__PURE__ */ React13.createElement(Popover2.Viewport, null, /* @__PURE__ */ React13.createElement(Surface9, {
1106
+ role: "popover",
1107
+ data: layout.popoverContent,
1108
+ limit: 1
1109
+ })), /* @__PURE__ */ React13.createElement(Popover2.Arrow, null)));
1110
+ } finally {
1111
+ _effect.f();
1112
+ }
1113
+ };
1114
+
1115
+ // packages/plugins/plugin-deck/src/components/DeckLayout/StatusBar.tsx
1116
+ import { useSignals as _useSignals14 } from "@preact-signals/safe-react/tracking";
1117
+ import React14 from "react";
1118
+ import { Surface as Surface10 } from "@dxos/app-framework";
1119
+ import { useLandmarkMover } from "@dxos/react-ui";
1120
+ var StatusBar = ({ showHints }) => {
1121
+ var _effect = _useSignals14();
1122
+ try {
1123
+ const mover = useLandmarkMover(void 0, "3");
1124
+ return /* @__PURE__ */ React14.createElement("div", {
1125
+ role: "contentinfo",
1126
+ className: "fixed block-end-0 inset-inline-0 bs-[--statusbar-size] border-bs border-separator z-[2] flex text-description",
1127
+ ...mover
1128
+ }, showHints && /* @__PURE__ */ React14.createElement(Surface10, {
1129
+ role: "hints",
1130
+ limit: 1
1131
+ }), /* @__PURE__ */ React14.createElement(Surface10, {
1132
+ role: "status-bar",
1133
+ limit: 1
1134
+ }));
1135
+ } finally {
1136
+ _effect.f();
1137
+ }
1138
+ };
1139
+
1140
+ // packages/plugins/plugin-deck/src/components/DeckLayout/Toast.tsx
1141
+ import { useSignals as _useSignals15 } from "@preact-signals/safe-react/tracking";
1142
+ import React15 from "react";
1143
+ import { Button, Icon as Icon2, Toast as NaturalToast, toLocalizedString as toLocalizedString3, useTranslation as useTranslation7 } from "@dxos/react-ui";
1144
+ var Toast = ({ id, title, description, icon, duration, actionLabel, actionAlt, closeLabel, onAction, onOpenChange }) => {
1145
+ var _effect = _useSignals15();
1146
+ try {
1147
+ const { t } = useTranslation7(DECK_PLUGIN);
1148
+ return /* @__PURE__ */ React15.createElement(NaturalToast.Root, {
1149
+ "data-testid": id,
1150
+ defaultOpen: true,
1151
+ duration,
1152
+ onOpenChange
1153
+ }, /* @__PURE__ */ React15.createElement(NaturalToast.Body, null, /* @__PURE__ */ React15.createElement(NaturalToast.Title, {
1154
+ classNames: "items-center"
1155
+ }, icon && /* @__PURE__ */ React15.createElement(Icon2, {
1156
+ icon,
1157
+ size: 5,
1158
+ classNames: "inline mr-1"
1159
+ }), 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, {
1160
+ altText: toLocalizedString3(actionAlt, t),
1161
+ asChild: true
1162
+ }, /* @__PURE__ */ React15.createElement(Button, {
1163
+ "data-testid": "toast.action",
1164
+ variant: "primary",
1165
+ onClick: () => onAction?.()
1166
+ }, toLocalizedString3(actionLabel, t))), closeLabel && /* @__PURE__ */ React15.createElement(NaturalToast.Close, {
1167
+ asChild: true
1168
+ }, /* @__PURE__ */ React15.createElement(Button, {
1169
+ "data-testid": "toast.close"
1170
+ }, toLocalizedString3(closeLabel, t)))));
1171
+ } finally {
1172
+ _effect.f();
1173
+ }
1174
+ };
1175
+
1176
+ // packages/plugins/plugin-deck/src/components/DeckLayout/Topbar.tsx
1177
+ import { useSignals as _useSignals16 } from "@preact-signals/safe-react/tracking";
1178
+ import React16 from "react";
1179
+ var Topbar = () => {
1180
+ var _effect = _useSignals16();
1181
+ try {
1182
+ return /* @__PURE__ */ React16.createElement(Banner, {
1183
+ variant: "topbar"
1184
+ });
1185
+ } finally {
1186
+ _effect.f();
1187
+ }
1188
+ };
1189
+
1190
+ // packages/plugins/plugin-deck/src/components/DeckLayout/DeckLayout.tsx
1191
+ var PlankSeparator = ({ order }) => {
1192
+ var _effect = _useSignals17();
1193
+ try {
1194
+ return order > 0 ? /* @__PURE__ */ React17.createElement("span", {
1195
+ role: "separator",
1196
+ className: "row-span-2 bg-deckSurface is-4",
1197
+ style: {
1198
+ gridColumn: order
1199
+ }
1200
+ }) : null;
1201
+ } finally {
1202
+ _effect.f();
1203
+ }
1204
+ };
1205
+ var DeckLayout = ({ onDismissToast }) => {
1206
+ var _effect = _useSignals17();
1207
+ try {
1208
+ const { dispatchPromise: dispatch } = useIntentDispatcher6();
1209
+ const settings = useCapability8(Capabilities.SettingsStore).getStore(DECK_PLUGIN).value;
1210
+ const context = useCapability8(DeckCapabilities.MutableDeckState);
1211
+ const { sidebarState, complementarySidebarState, complementarySidebarPanel, deck, toasts } = context;
1212
+ const { active, activeCompanions, fullscreen, solo, plankSizing } = deck;
1213
+ const breakpoint = useBreakpoints();
1214
+ const layoutMode = getMode(deck);
1215
+ const topbar = layoutAppliesTopbar(breakpoint, layoutMode);
1216
+ const hoistStatusbar = useHoistStatusbar(breakpoint, layoutMode);
1217
+ const pluginManager = usePluginManager();
1218
+ const scrollLeftRef = useRef3();
1219
+ const deckRef = useRef3(null);
1220
+ useEffect5(() => {
1221
+ const attended = untracked(() => {
1222
+ const attention = pluginManager.context.getCapability(AttentionCapabilities.Attention);
1223
+ return attention.current;
1224
+ });
1225
+ const firstId = solo ?? active[0];
1226
+ if (attended.length === 0 && firstId) {
1227
+ document.querySelector(`article[data-attendable-id="${firstId}"] button`)?.focus();
1228
+ }
1229
+ }, []);
1230
+ const [isNotMobile] = useMediaQuery("md", {
1231
+ ssr: false
1232
+ });
1233
+ const shouldRevert = useRef3(false);
1234
+ useEffect5(() => {
1235
+ if (!isNotMobile && getMode(deck) === "deck") {
1236
+ const attended = untracked(() => {
1237
+ const attention = pluginManager.context.getCapability(AttentionCapabilities.Attention);
1238
+ return attention.current;
1239
+ });
1240
+ shouldRevert.current = true;
1241
+ void dispatch(createIntent6(LayoutAction5.SetLayoutMode, {
1242
+ part: "mode",
1243
+ subject: attended[0],
1244
+ options: {
1245
+ mode: "solo"
1246
+ }
1247
+ }));
1248
+ } else if (isNotMobile && getMode(deck) === "solo" && shouldRevert.current) {
1249
+ void dispatch(createIntent6(LayoutAction5.SetLayoutMode, {
1250
+ part: "mode",
1251
+ options: {
1252
+ revert: true
1253
+ }
1254
+ }));
1255
+ }
1256
+ }, [
1257
+ isNotMobile,
1258
+ deck,
1259
+ dispatch
1260
+ ]);
1261
+ useEffect5(() => {
1262
+ if (!settings.enableDeck && layoutMode === "deck") {
1263
+ void dispatch(createIntent6(LayoutAction5.SetLayoutMode, {
1264
+ part: "mode",
1265
+ subject: active[0],
1266
+ options: {
1267
+ mode: "solo"
1268
+ }
1269
+ }));
1270
+ }
1271
+ }, [
1272
+ settings.enableDeck,
1273
+ dispatch,
1274
+ active,
1275
+ layoutMode
1276
+ ]);
1277
+ const handleResize = useCallback7(() => {
1278
+ scrollLeftRef.current = null;
1279
+ }, []);
1280
+ useEffect5(() => {
1281
+ window.addEventListener("resize", handleResize);
1282
+ return () => window.removeEventListener("resize", handleResize);
1283
+ }, [
1284
+ handleResize
1285
+ ]);
1286
+ const restoreScroll = useCallback7(() => {
1287
+ if (deckRef.current && scrollLeftRef.current != null) {
1288
+ deckRef.current.scrollLeft = scrollLeftRef.current;
1289
+ }
1290
+ }, []);
1291
+ useOnTransition(layoutMode, (mode) => mode !== "deck", "deck", restoreScroll);
1292
+ const handleScroll = useCallback7((event) => {
1293
+ if (!solo && event.currentTarget === event.target) {
1294
+ scrollLeftRef.current = event.target.scrollLeft;
1295
+ }
1296
+ }, [
1297
+ solo
1298
+ ]);
1299
+ const isEmpty = !solo && active.length === 0;
1300
+ const padding = useMemo6(() => {
1301
+ if (!solo && settings.overscroll === "centering") {
1302
+ return calculateOverscroll(active.length);
1303
+ }
1304
+ return {};
1305
+ }, [
1306
+ solo,
1307
+ settings.overscroll,
1308
+ deck
1309
+ ]);
1310
+ const mainPosition = useMemo6(() => [
1311
+ "grid !block-start-[env(safe-area-inset-top)]",
1312
+ topbar && "!block-start-[calc(env(safe-area-inset-top)+var(--rail-size))]",
1313
+ hoistStatusbar && "lg:block-end-[--statusbar-size]"
1314
+ ], [
1315
+ topbar,
1316
+ hoistStatusbar
1317
+ ]);
1318
+ const { order, itemsCount } = useMemo6(() => {
1319
+ return active.reduce((acc, entryId) => {
1320
+ acc.order[entryId] = acc.itemsCount + 1;
1321
+ acc.itemsCount += activeCompanions?.[entryId] ? 3 : 2;
1322
+ return acc;
1323
+ }, {
1324
+ order: {},
1325
+ itemsCount: 0
1326
+ });
1327
+ }, [
1328
+ active,
1329
+ activeCompanions
1330
+ ]);
1331
+ return /* @__PURE__ */ React17.createElement(PopoverRoot, null, /* @__PURE__ */ React17.createElement(ActiveNode, null), /* @__PURE__ */ React17.createElement(Main3.Root, {
1332
+ navigationSidebarState: fullscreen ? "closed" : context.sidebarState,
1333
+ onNavigationSidebarStateChange: (next) => context.sidebarState = next,
1334
+ complementarySidebarState: fullscreen ? "closed" : context.complementarySidebarState,
1335
+ onComplementarySidebarStateChange: (next) => context.complementarySidebarState = next
1336
+ }, /* @__PURE__ */ React17.createElement(Sidebar, null), /* @__PURE__ */ React17.createElement(ComplementarySidebar, {
1337
+ current: complementarySidebarPanel
1338
+ }), /* @__PURE__ */ React17.createElement(Main3.Overlay, null), isEmpty && /* @__PURE__ */ React17.createElement(Main3.Content, {
1339
+ bounce: true,
1340
+ handlesFocus: true,
1341
+ classNames: mainPosition
1342
+ }, /* @__PURE__ */ React17.createElement(ContentEmpty, null)), !isEmpty && /* @__PURE__ */ React17.createElement(Main3.Content, {
1343
+ bounce: true,
1344
+ handlesFocus: true,
1345
+ classNames: mainPosition,
1346
+ style: {
1347
+ "--dx-main-sidebarWidth": sidebarState === "expanded" ? "var(--nav-sidebar-size)" : sidebarState === "collapsed" ? "var(--l0-size)" : "0",
1348
+ "--dx-main-complementaryWidth": complementarySidebarState === "expanded" ? "var(--complementary-sidebar-size)" : complementarySidebarState === "collapsed" ? "var(--rail-size)" : "0",
1349
+ "--dx-main-contentFirstWidth": `${plankSizing[active[0] ?? "never"] ?? DEFAULT_HORIZONTAL_SIZE}rem`,
1350
+ "--dx-main-contentLastWidth": `${plankSizing[active[(active.length ?? 1) - 1] ?? "never"] ?? DEFAULT_HORIZONTAL_SIZE}rem`
1351
+ }
1352
+ }, /* @__PURE__ */ React17.createElement("div", {
1353
+ role: "none",
1354
+ className: !solo ? "relative bg-deckSurface overflow-hidden" : "sr-only",
1355
+ ...solo && {
1356
+ inert: ""
1357
+ }
1358
+ }, !topbar && !fullscreen && /* @__PURE__ */ React17.createElement(ToggleSidebarButton, {
1359
+ classNames: fixedSidebarToggleStyles
1360
+ }), !topbar && !fullscreen && /* @__PURE__ */ React17.createElement(ToggleComplementarySidebarButton, {
1361
+ classNames: fixedComplementarySidebarToggleStyles
1362
+ }), /* @__PURE__ */ React17.createElement(Stack, {
1363
+ ref: deckRef,
1364
+ orientation: "horizontal",
1365
+ size: "contain",
1366
+ classNames: [
1367
+ "absolute inset-block-0 -inset-inline-px",
1368
+ mainPaddingTransitions
1369
+ ],
1370
+ itemsCount: itemsCount - 1,
1371
+ style: padding,
1372
+ onScroll: handleScroll
1373
+ }, active.map((entryId) => /* @__PURE__ */ React17.createElement(Fragment3, {
1374
+ key: entryId
1375
+ }, /* @__PURE__ */ React17.createElement(PlankSeparator, {
1376
+ order: order[entryId] - 1
1377
+ }), /* @__PURE__ */ React17.createElement(Plank, {
1378
+ id: entryId,
1379
+ companionId: activeCompanions?.[entryId],
1380
+ part: "deck",
1381
+ order: order[entryId],
1382
+ active,
1383
+ layoutMode,
1384
+ settings
1385
+ }))))), /* @__PURE__ */ React17.createElement("div", {
1386
+ role: "none",
1387
+ className: solo ? "relative bg-deckSurface overflow-hidden" : "sr-only",
1388
+ ...!solo && {
1389
+ inert: ""
1390
+ }
1391
+ }, !topbar && !fullscreen && /* @__PURE__ */ React17.createElement(ToggleSidebarButton, {
1392
+ classNames: fixedSidebarToggleStyles
1393
+ }), !topbar && !fullscreen && /* @__PURE__ */ React17.createElement(ToggleComplementarySidebarButton, {
1394
+ classNames: fixedComplementarySidebarToggleStyles
1395
+ }), /* @__PURE__ */ React17.createElement(StackContext.Provider, {
1396
+ value: {
1397
+ size: "contain",
1398
+ orientation: "horizontal",
1399
+ rail: true
1400
+ }
1401
+ }, /* @__PURE__ */ React17.createElement(Plank, {
1402
+ id: solo,
1403
+ companionId: solo ? activeCompanions?.[solo] : void 0,
1404
+ part: "solo",
1405
+ layoutMode,
1406
+ settings
1407
+ })))), topbar && /* @__PURE__ */ React17.createElement(Topbar, null), hoistStatusbar && /* @__PURE__ */ React17.createElement(StatusBar, {
1408
+ showHints: settings.showHints
1409
+ })), /* @__PURE__ */ React17.createElement(PopoverContent, null), /* @__PURE__ */ React17.createElement(Dialog, null), toasts?.map((toast) => /* @__PURE__ */ React17.createElement(Toast, {
1410
+ ...toast,
1411
+ key: toast.id,
1412
+ onOpenChange: (open) => {
1413
+ if (!open) {
1414
+ onDismissToast(toast.id);
1415
+ }
1416
+ return open;
1417
+ }
1418
+ })));
1419
+ } finally {
1420
+ _effect.f();
1421
+ }
1422
+ };
1423
+
1424
+ // packages/plugins/plugin-deck/src/components/DeckSettings/DeckSettings.tsx
1425
+ import { useSignals as _useSignals18 } from "@preact-signals/safe-react/tracking";
1426
+ import React18 from "react";
1427
+ import { Input, Select, useTranslation as useTranslation8 } from "@dxos/react-ui";
1428
+ import { DeprecatedFormContainer, DeprecatedFormInput } from "@dxos/react-ui-form";
1429
+ var isSocket = !!globalThis.__args;
1430
+ var DeckSettings = ({ settings }) => {
1431
+ var _effect = _useSignals18();
1432
+ try {
1433
+ const { t } = useTranslation8(DECK_PLUGIN);
1434
+ return /* @__PURE__ */ React18.createElement(DeprecatedFormContainer, null, /* @__PURE__ */ React18.createElement(DeprecatedFormInput, {
1435
+ label: t("settings enable deck label")
1436
+ }, /* @__PURE__ */ React18.createElement(Input.Switch, {
1437
+ checked: settings.enableDeck,
1438
+ onCheckedChange: (checked) => settings.enableDeck = checked
1439
+ })), /* @__PURE__ */ React18.createElement(DeprecatedFormInput, {
1440
+ label: t("select new plank positioning label")
1441
+ }, /* @__PURE__ */ React18.createElement(Select.Root, {
1442
+ disabled: !settings.enableDeck,
1443
+ value: settings.newPlankPositioning ?? "start",
1444
+ onValueChange: (value) => settings.newPlankPositioning = value
1445
+ }, /* @__PURE__ */ React18.createElement(Select.TriggerButton, {
1446
+ placeholder: t("select new plank positioning placeholder")
1447
+ }), /* @__PURE__ */ React18.createElement(Select.Portal, null, /* @__PURE__ */ React18.createElement(Select.Content, null, /* @__PURE__ */ React18.createElement(Select.Viewport, null, NewPlankPositions.map((position) => /* @__PURE__ */ React18.createElement(Select.Option, {
1448
+ key: position,
1449
+ value: position
1450
+ }, t(`settings new plank position ${position} label`)))))))), /* @__PURE__ */ React18.createElement(DeprecatedFormInput, {
1451
+ label: t("settings overscroll label")
1452
+ }, /* @__PURE__ */ React18.createElement(Select.Root, {
1453
+ disabled: !settings.enableDeck,
1454
+ value: settings.overscroll ?? "none",
1455
+ onValueChange: (value) => settings.overscroll = value
1456
+ }, /* @__PURE__ */ React18.createElement(Select.TriggerButton, {
1457
+ placeholder: t("select overscroll placeholder")
1458
+ }), /* @__PURE__ */ React18.createElement(Select.Portal, null, /* @__PURE__ */ React18.createElement(Select.Content, null, /* @__PURE__ */ React18.createElement(Select.Viewport, null, OverscrollOptions.map((option) => /* @__PURE__ */ React18.createElement(Select.Option, {
1459
+ key: option,
1460
+ value: option
1461
+ }, t(`settings overscroll ${option} label`)))))))), /* @__PURE__ */ React18.createElement(DeprecatedFormInput, {
1462
+ label: t("settings enable statusbar label")
1463
+ }, /* @__PURE__ */ React18.createElement(Input.Switch, {
1464
+ checked: settings.enableStatusbar,
1465
+ onCheckedChange: (checked) => settings.enableStatusbar = checked
1466
+ })), /* @__PURE__ */ React18.createElement(DeprecatedFormInput, {
1467
+ label: t("settings show hints label")
1468
+ }, /* @__PURE__ */ React18.createElement(Input.Switch, {
1469
+ checked: settings.showHints,
1470
+ onCheckedChange: (checked) => settings.showHints = checked
1471
+ })), !isSocket && /* @__PURE__ */ React18.createElement(DeprecatedFormInput, {
1472
+ label: t("settings native redirect label")
1473
+ }, /* @__PURE__ */ React18.createElement(Input.Switch, {
1474
+ checked: settings.enableNativeRedirect,
1475
+ onCheckedChange: (checked) => settings.enableNativeRedirect = checked
1476
+ })));
1477
+ } finally {
1478
+ _effect.f();
1479
+ }
1480
+ };
1481
+
1482
+ export {
1483
+ Banner,
1484
+ DeckLayout,
1485
+ DeckSettings
1486
+ };
1487
+ //# sourceMappingURL=chunk-LWXMANOA.mjs.map