@dxos/plugin-deck 0.8.2-main.f11618f → 0.8.2-staging.42af850

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