@dxos/plugin-deck 0.7.5-main.9d2a38b → 0.7.5-main.c41020f

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 (233) hide show
  1. package/dist/lib/browser/{app-graph-builder-67VRUD5K.mjs → app-graph-builder-IYHAGFA3.mjs} +61 -31
  2. package/dist/lib/browser/app-graph-builder-IYHAGFA3.mjs.map +7 -0
  3. package/dist/lib/browser/{check-app-scheme-GEX6W2R5.mjs → check-app-scheme-S3EYUPMF.mjs} +3 -3
  4. package/dist/lib/browser/{check-app-scheme-GEX6W2R5.mjs.map → check-app-scheme-S3EYUPMF.mjs.map} +2 -2
  5. package/dist/lib/browser/{chunk-5VFDMW5M.mjs → chunk-22AQ5IVX.mjs} +2 -2
  6. package/dist/lib/browser/chunk-22AQ5IVX.mjs.map +7 -0
  7. package/dist/lib/browser/chunk-FT33W5CI.mjs +128 -0
  8. package/dist/lib/browser/chunk-FT33W5CI.mjs.map +7 -0
  9. package/dist/lib/browser/chunk-G2X3ZDCE.mjs +24 -0
  10. package/dist/lib/browser/chunk-G2X3ZDCE.mjs.map +7 -0
  11. package/dist/lib/browser/chunk-KANJBSIX.mjs +97 -0
  12. package/dist/lib/browser/chunk-KANJBSIX.mjs.map +7 -0
  13. package/dist/lib/browser/{chunk-JQJ5UWVB.mjs → chunk-N7TEPFVR.mjs} +3 -2
  14. package/dist/lib/browser/{chunk-JQJ5UWVB.mjs.map → chunk-N7TEPFVR.mjs.map} +3 -3
  15. package/dist/lib/browser/chunk-O4RFYYQ6.mjs +1114 -0
  16. package/dist/lib/browser/chunk-O4RFYYQ6.mjs.map +7 -0
  17. package/dist/lib/browser/index.mjs +45 -78
  18. package/dist/lib/browser/index.mjs.map +4 -4
  19. package/dist/lib/browser/intent-resolver-ZD67BRUI.mjs +488 -0
  20. package/dist/lib/browser/intent-resolver-ZD67BRUI.mjs.map +7 -0
  21. package/dist/lib/browser/meta.json +1 -1
  22. package/dist/lib/browser/{react-root-UL7ZDRVZ.mjs → react-root-6ILKHD5J.mjs} +12 -17
  23. package/dist/lib/browser/react-root-6ILKHD5J.mjs.map +7 -0
  24. package/dist/lib/browser/react-surface-O75FKXAI.mjs +39 -0
  25. package/dist/lib/browser/react-surface-O75FKXAI.mjs.map +7 -0
  26. package/dist/lib/browser/{settings-FNWW6WIJ.mjs → settings-H35U6NHE.mjs} +6 -7
  27. package/dist/lib/browser/settings-H35U6NHE.mjs.map +7 -0
  28. package/dist/lib/browser/state-U4SHOPJW.mjs +129 -0
  29. package/dist/lib/browser/state-U4SHOPJW.mjs.map +7 -0
  30. package/dist/lib/browser/tools-64LXGLYR.mjs +59 -0
  31. package/dist/lib/browser/tools-64LXGLYR.mjs.map +7 -0
  32. package/dist/lib/browser/types.mjs +16 -4
  33. package/dist/lib/browser/url-handler-MVHTKUYA.mjs +72 -0
  34. package/dist/lib/browser/url-handler-MVHTKUYA.mjs.map +7 -0
  35. package/dist/types/src/DeckPlugin.d.ts.map +1 -1
  36. package/dist/types/src/capabilities/app-graph-builder.d.ts +181 -0
  37. package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -0
  38. package/dist/types/src/capabilities/capabilities.d.ts +137 -8
  39. package/dist/types/src/capabilities/capabilities.d.ts.map +1 -1
  40. package/dist/types/src/capabilities/check-app-scheme.d.ts.map +1 -0
  41. package/dist/types/src/capabilities/index.d.ts +188 -3
  42. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  43. package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -0
  44. package/dist/types/src/capabilities/react-root.d.ts.map +1 -0
  45. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -0
  46. package/dist/types/src/capabilities/settings.d.ts.map +1 -0
  47. package/dist/types/src/capabilities/state.d.ts +79 -0
  48. package/dist/types/src/capabilities/state.d.ts.map +1 -0
  49. package/dist/types/src/capabilities/tools.d.ts +10 -0
  50. package/dist/types/src/capabilities/tools.d.ts.map +1 -0
  51. package/dist/types/src/capabilities/url-handler.d.ts.map +1 -0
  52. package/dist/types/src/components/DeckLayout/ActiveNode.d.ts +1 -2
  53. package/dist/types/src/components/DeckLayout/ActiveNode.d.ts.map +1 -1
  54. package/dist/types/src/components/DeckLayout/Banner.d.ts +1 -2
  55. package/dist/types/src/components/DeckLayout/Banner.d.ts.map +1 -1
  56. package/dist/types/src/components/DeckLayout/ComplementarySidebar.d.ts +1 -4
  57. package/dist/types/src/components/DeckLayout/ComplementarySidebar.d.ts.map +1 -1
  58. package/dist/types/src/components/DeckLayout/ContentEmpty.d.ts +1 -2
  59. package/dist/types/src/components/DeckLayout/ContentEmpty.d.ts.map +1 -1
  60. package/dist/types/src/components/DeckLayout/DeckLayout.d.ts +2 -7
  61. package/dist/types/src/components/DeckLayout/DeckLayout.d.ts.map +1 -1
  62. package/dist/types/src/components/DeckLayout/Fallback.d.ts +1 -2
  63. package/dist/types/src/components/DeckLayout/Fallback.d.ts.map +1 -1
  64. package/dist/types/src/components/DeckLayout/Fullscreen.d.ts +1 -2
  65. package/dist/types/src/components/DeckLayout/Fullscreen.d.ts.map +1 -1
  66. package/dist/types/src/components/DeckLayout/NodePlankHeading.d.ts +3 -3
  67. package/dist/types/src/components/DeckLayout/NodePlankHeading.d.ts.map +1 -1
  68. package/dist/types/src/components/DeckLayout/Plank.d.ts +8 -6
  69. package/dist/types/src/components/DeckLayout/Plank.d.ts.map +1 -1
  70. package/dist/types/src/components/DeckLayout/PlankControls.d.ts +2 -2
  71. package/dist/types/src/components/DeckLayout/PlankControls.d.ts.map +1 -1
  72. package/dist/types/src/components/DeckLayout/PlankError.d.ts +6 -6
  73. package/dist/types/src/components/DeckLayout/PlankError.d.ts.map +1 -1
  74. package/dist/types/src/components/DeckLayout/PlankLoading.d.ts +1 -2
  75. package/dist/types/src/components/DeckLayout/PlankLoading.d.ts.map +1 -1
  76. package/dist/types/src/components/DeckLayout/Sidebar.d.ts +1 -2
  77. package/dist/types/src/components/DeckLayout/Sidebar.d.ts.map +1 -1
  78. package/dist/types/src/components/DeckLayout/SidebarButton.d.ts +6 -5
  79. package/dist/types/src/components/DeckLayout/SidebarButton.d.ts.map +1 -1
  80. package/dist/types/src/components/DeckLayout/StatusBar.d.ts +1 -2
  81. package/dist/types/src/components/DeckLayout/StatusBar.d.ts.map +1 -1
  82. package/dist/types/src/components/DeckLayout/Toast.d.ts +2 -3
  83. package/dist/types/src/components/DeckLayout/Toast.d.ts.map +1 -1
  84. package/dist/types/src/components/DeckLayout/Topbar.d.ts +1 -2
  85. package/dist/types/src/components/DeckLayout/Topbar.d.ts.map +1 -1
  86. package/dist/types/src/components/LayoutSettings.d.ts +1 -2
  87. package/dist/types/src/components/LayoutSettings.d.ts.map +1 -1
  88. package/dist/types/src/components/fragments.d.ts +2 -0
  89. package/dist/types/src/components/fragments.d.ts.map +1 -1
  90. package/dist/types/src/components/index.d.ts +0 -2
  91. package/dist/types/src/components/index.d.ts.map +1 -1
  92. package/dist/types/src/events.d.ts +1 -0
  93. package/dist/types/src/events.d.ts.map +1 -1
  94. package/dist/types/src/hooks/useMainSize.d.ts +2 -2
  95. package/dist/types/src/hooks/useNode.d.ts.map +1 -1
  96. package/dist/types/src/layout.d.ts +5 -19
  97. package/dist/types/src/layout.d.ts.map +1 -1
  98. package/dist/types/src/meta.d.ts +1 -0
  99. package/dist/types/src/meta.d.ts.map +1 -1
  100. package/dist/types/src/translations.d.ts +3 -3
  101. package/dist/types/src/types.d.ts +117 -2
  102. package/dist/types/src/types.d.ts.map +1 -1
  103. package/dist/types/src/util/index.d.ts +3 -1
  104. package/dist/types/src/util/index.d.ts.map +1 -1
  105. package/dist/types/src/util/layoutAppliesTopbar.d.ts +2 -0
  106. package/dist/types/src/util/layoutAppliesTopbar.d.ts.map +1 -0
  107. package/dist/types/src/util/set-active.d.ts +9 -0
  108. package/dist/types/src/util/set-active.d.ts.map +1 -0
  109. package/dist/types/src/util/useHoistStatusbar.d.ts.map +1 -1
  110. package/package.json +32 -31
  111. package/src/DeckPlugin.ts +23 -59
  112. package/src/capabilities/{layout/app-graph-builder.ts → app-graph-builder.ts} +40 -28
  113. package/src/capabilities/capabilities.ts +5 -7
  114. package/src/capabilities/{navigation/check-app-scheme.ts → check-app-scheme.ts} +2 -2
  115. package/src/capabilities/index.ts +12 -3
  116. package/src/capabilities/intent-resolver.ts +368 -0
  117. package/src/capabilities/{layout/react-root.tsx → react-root.tsx} +8 -14
  118. package/src/capabilities/react-surface.tsx +31 -0
  119. package/src/capabilities/{settings/settings.ts → settings.ts} +4 -5
  120. package/src/capabilities/state.ts +108 -0
  121. package/src/capabilities/tools.ts +66 -0
  122. package/src/capabilities/url-handler.ts +65 -0
  123. package/src/components/DeckLayout/ActiveNode.tsx +2 -3
  124. package/src/components/DeckLayout/ComplementarySidebar.tsx +185 -77
  125. package/src/components/DeckLayout/ContentEmpty.tsx +7 -10
  126. package/src/components/DeckLayout/DeckLayout.tsx +141 -84
  127. package/src/components/DeckLayout/Fullscreen.tsx +2 -3
  128. package/src/components/DeckLayout/NodePlankHeading.tsx +57 -65
  129. package/src/components/DeckLayout/Plank.tsx +33 -41
  130. package/src/components/DeckLayout/PlankControls.tsx +12 -11
  131. package/src/components/DeckLayout/PlankError.tsx +6 -5
  132. package/src/components/DeckLayout/Sidebar.tsx +17 -20
  133. package/src/components/DeckLayout/SidebarButton.tsx +25 -31
  134. package/src/components/DeckLayout/StatusBar.tsx +5 -11
  135. package/src/components/DeckLayout/Toast.tsx +2 -2
  136. package/src/components/LayoutSettings.tsx +8 -8
  137. package/src/components/fragments.ts +8 -0
  138. package/src/components/index.ts +0 -2
  139. package/src/events.ts +1 -0
  140. package/src/hooks/useMainSize.ts +3 -3
  141. package/src/hooks/useNode.ts +3 -1
  142. package/src/layout.ts +43 -212
  143. package/src/meta.ts +1 -0
  144. package/src/translations.ts +8 -8
  145. package/src/types.ts +103 -4
  146. package/src/util/index.ts +3 -1
  147. package/src/util/layoutAppliesTopbar.ts +7 -0
  148. package/src/util/set-active.ts +47 -0
  149. package/src/util/useHoistStatusbar.ts +13 -8
  150. package/dist/lib/browser/app-graph-builder-67VRUD5K.mjs.map +0 -7
  151. package/dist/lib/browser/chunk-2M4PXYNB.mjs +0 -1052
  152. package/dist/lib/browser/chunk-2M4PXYNB.mjs.map +0 -7
  153. package/dist/lib/browser/chunk-2PJNBVCY.mjs +0 -39
  154. package/dist/lib/browser/chunk-2PJNBVCY.mjs.map +0 -7
  155. package/dist/lib/browser/chunk-4C2AFTET.mjs +0 -186
  156. package/dist/lib/browser/chunk-4C2AFTET.mjs.map +0 -7
  157. package/dist/lib/browser/chunk-5VFDMW5M.mjs.map +0 -7
  158. package/dist/lib/browser/chunk-KY5WXIXY.mjs +0 -44
  159. package/dist/lib/browser/chunk-KY5WXIXY.mjs.map +0 -7
  160. package/dist/lib/browser/deck-PLCSKPGL.mjs +0 -26
  161. package/dist/lib/browser/deck-PLCSKPGL.mjs.map +0 -7
  162. package/dist/lib/browser/intent-resolver-FVOQSTBX.mjs +0 -152
  163. package/dist/lib/browser/intent-resolver-FVOQSTBX.mjs.map +0 -7
  164. package/dist/lib/browser/intent-resolver-K7GW4A2I.mjs +0 -249
  165. package/dist/lib/browser/intent-resolver-K7GW4A2I.mjs.map +0 -7
  166. package/dist/lib/browser/location-QHRBQBQN.mjs +0 -35
  167. package/dist/lib/browser/location-QHRBQBQN.mjs.map +0 -7
  168. package/dist/lib/browser/react-context-3BDW7W2N.mjs +0 -32
  169. package/dist/lib/browser/react-context-3BDW7W2N.mjs.map +0 -7
  170. package/dist/lib/browser/react-root-UL7ZDRVZ.mjs.map +0 -7
  171. package/dist/lib/browser/react-surface-VPNOGGNN.mjs +0 -28
  172. package/dist/lib/browser/react-surface-VPNOGGNN.mjs.map +0 -7
  173. package/dist/lib/browser/settings-FNWW6WIJ.mjs.map +0 -7
  174. package/dist/lib/browser/state-7I5BD7SE.mjs +0 -34
  175. package/dist/lib/browser/state-7I5BD7SE.mjs.map +0 -7
  176. package/dist/lib/browser/url-handler-Z5B7LD3N.mjs +0 -76
  177. package/dist/lib/browser/url-handler-Z5B7LD3N.mjs.map +0 -7
  178. package/dist/types/src/capabilities/layout/app-graph-builder.d.ts +0 -181
  179. package/dist/types/src/capabilities/layout/app-graph-builder.d.ts.map +0 -1
  180. package/dist/types/src/capabilities/layout/deck.d.ts +0 -4
  181. package/dist/types/src/capabilities/layout/deck.d.ts.map +0 -1
  182. package/dist/types/src/capabilities/layout/index.d.ts +0 -229
  183. package/dist/types/src/capabilities/layout/index.d.ts.map +0 -1
  184. package/dist/types/src/capabilities/layout/intent-resolver.d.ts.map +0 -1
  185. package/dist/types/src/capabilities/layout/react-context.d.ts +0 -8
  186. package/dist/types/src/capabilities/layout/react-context.d.ts.map +0 -1
  187. package/dist/types/src/capabilities/layout/react-root.d.ts.map +0 -1
  188. package/dist/types/src/capabilities/layout/state.d.ts +0 -42
  189. package/dist/types/src/capabilities/layout/state.d.ts.map +0 -1
  190. package/dist/types/src/capabilities/navigation/check-app-scheme.d.ts.map +0 -1
  191. package/dist/types/src/capabilities/navigation/index.d.ts +0 -5
  192. package/dist/types/src/capabilities/navigation/index.d.ts.map +0 -1
  193. package/dist/types/src/capabilities/navigation/intent-resolver.d.ts +0 -4
  194. package/dist/types/src/capabilities/navigation/intent-resolver.d.ts.map +0 -1
  195. package/dist/types/src/capabilities/navigation/location.d.ts +0 -4
  196. package/dist/types/src/capabilities/navigation/location.d.ts.map +0 -1
  197. package/dist/types/src/capabilities/navigation/set-location.d.ts +0 -10
  198. package/dist/types/src/capabilities/navigation/set-location.d.ts.map +0 -1
  199. package/dist/types/src/capabilities/navigation/url-handler.d.ts.map +0 -1
  200. package/dist/types/src/capabilities/settings/index.d.ts +0 -3
  201. package/dist/types/src/capabilities/settings/index.d.ts.map +0 -1
  202. package/dist/types/src/capabilities/settings/react-surface.d.ts.map +0 -1
  203. package/dist/types/src/capabilities/settings/settings.d.ts.map +0 -1
  204. package/dist/types/src/components/DeckContext.d.ts +0 -11
  205. package/dist/types/src/components/DeckContext.d.ts.map +0 -1
  206. package/dist/types/src/components/LayoutContext.d.ts +0 -5
  207. package/dist/types/src/components/LayoutContext.d.ts.map +0 -1
  208. package/dist/types/src/layout.test.d.ts +0 -2
  209. package/dist/types/src/layout.test.d.ts.map +0 -1
  210. package/dist/types/src/util/layout-parts.d.ts +0 -7
  211. package/dist/types/src/util/layout-parts.d.ts.map +0 -1
  212. package/src/capabilities/layout/deck.ts +0 -25
  213. package/src/capabilities/layout/index.ts +0 -12
  214. package/src/capabilities/layout/intent-resolver.ts +0 -128
  215. package/src/capabilities/layout/react-context.tsx +0 -26
  216. package/src/capabilities/layout/state.ts +0 -32
  217. package/src/capabilities/navigation/index.ts +0 -10
  218. package/src/capabilities/navigation/intent-resolver.ts +0 -216
  219. package/src/capabilities/navigation/location.ts +0 -28
  220. package/src/capabilities/navigation/set-location.ts +0 -38
  221. package/src/capabilities/navigation/url-handler.ts +0 -67
  222. package/src/capabilities/settings/index.ts +0 -8
  223. package/src/capabilities/settings/react-surface.tsx +0 -23
  224. package/src/components/DeckContext.ts +0 -19
  225. package/src/components/LayoutContext.ts +0 -12
  226. package/src/layout.test.ts +0 -380
  227. package/src/util/layout-parts.ts +0 -12
  228. /package/dist/types/src/capabilities/{navigation/check-app-scheme.d.ts → check-app-scheme.d.ts} +0 -0
  229. /package/dist/types/src/capabilities/{layout/intent-resolver.d.ts → intent-resolver.d.ts} +0 -0
  230. /package/dist/types/src/capabilities/{layout/react-root.d.ts → react-root.d.ts} +0 -0
  231. /package/dist/types/src/capabilities/{settings/react-surface.d.ts → react-surface.d.ts} +0 -0
  232. /package/dist/types/src/capabilities/{settings/settings.d.ts → settings.d.ts} +0 -0
  233. /package/dist/types/src/capabilities/{navigation/url-handler.d.ts → url-handler.d.ts} +0 -0
@@ -5,25 +5,22 @@
5
5
  import React from 'react';
6
6
 
7
7
  import { Surface } from '@dxos/app-framework';
8
- import { mx } from '@dxos/react-ui-theme';
9
8
 
10
9
  import { ToggleSidebarButton } from './SidebarButton';
11
- import { soloInlinePadding } from '../fragments';
10
+ import { layoutAppliesTopbar, useBreakpoints } from '../../util';
11
+ import { fixedSidebarToggleStyles } from '../fragments';
12
12
 
13
13
  export const ContentEmpty = () => {
14
+ const breakpoint = useBreakpoints();
15
+ const topbar = layoutAppliesTopbar(breakpoint);
14
16
  return (
15
17
  <div
16
18
  role='none'
17
- className='min-bs-screen is-dvw sm:is-full p-8 grid grid-rows-[var(--rail-size)_1fr]'
19
+ className='grid place-items-center p-8 relative bg-deck'
18
20
  data-testid='layoutPlugin.firstRunMessage'
19
21
  >
20
- <div role='toolbar' className={mx(soloInlinePadding, 'flex items-stretch')}>
21
- <ToggleSidebarButton />
22
- <span role='none' className='grow' />
23
- </div>
24
- <div role='none' className='grid place-items-center'>
25
- <Surface role='keyshortcuts' />
26
- </div>
22
+ <Surface role='keyshortcuts' />
23
+ {!topbar && <ToggleSidebarButton variant='default' classNames={fixedSidebarToggleStyles} />}
27
24
  </div>
28
25
  );
29
26
  };
@@ -3,52 +3,60 @@
3
3
  //
4
4
 
5
5
  import { untracked } from '@preact/signals-core';
6
- import React, { useCallback, useEffect, useMemo, useRef, type UIEvent, Fragment } from 'react';
6
+ import React, { useCallback, useEffect, useMemo, useRef, type UIEvent, Fragment, useState } from 'react';
7
7
 
8
8
  import {
9
- firstIdInPart,
9
+ LayoutAction,
10
+ createIntent,
10
11
  Surface,
12
+ useCapability,
13
+ useIntentDispatcher,
11
14
  usePluginManager,
12
- type LayoutParts,
13
- type Toast as ToastSchema,
14
15
  } from '@dxos/app-framework';
15
16
  import { AttentionCapabilities } from '@dxos/plugin-attention';
16
- import { AlertDialog, Dialog as NaturalDialog, Main, Popover, useOnTransition, type MainProps } from '@dxos/react-ui';
17
+ import {
18
+ AlertDialog,
19
+ Dialog as NaturalDialog,
20
+ Main,
21
+ Popover,
22
+ useOnTransition,
23
+ type MainProps,
24
+ useMediaQuery,
25
+ } from '@dxos/react-ui';
17
26
  import { Stack, StackContext, DEFAULT_HORIZONTAL_SIZE } from '@dxos/react-ui-stack';
18
27
  import { mainPaddingTransitions } from '@dxos/react-ui-theme';
19
28
 
20
29
  import { ActiveNode } from './ActiveNode';
21
- import { ComplementarySidebar, type ComplementarySidebarProps } from './ComplementarySidebar';
30
+ import { ComplementarySidebar } from './ComplementarySidebar';
22
31
  import { ContentEmpty } from './ContentEmpty';
23
32
  import { Fullscreen } from './Fullscreen';
24
33
  import { Plank } from './Plank';
25
34
  import { Sidebar } from './Sidebar';
35
+ import { ToggleComplementarySidebarButton, ToggleSidebarButton } from './SidebarButton';
26
36
  import { StatusBar } from './StatusBar';
27
37
  import { Toast } from './Toast';
28
38
  import { Topbar } from './Topbar';
29
- import { type Overscroll } from '../../types';
30
- import { calculateOverscroll, useBreakpoints } from '../../util';
31
- import { useHoistStatusbar } from '../../util/useHoistStatusbar';
32
- import { useDeckContext } from '../DeckContext';
33
- import { useLayout } from '../LayoutContext';
39
+ import { DeckCapabilities } from '../../capabilities';
40
+ import { getMode, type Overscroll } from '../../types';
41
+ import { calculateOverscroll, layoutAppliesTopbar, useBreakpoints, useHoistStatusbar } from '../../util';
42
+ import { fixedComplementarySidebarToggleStyles, fixedSidebarToggleStyles } from '../fragments';
34
43
 
35
44
  export type DeckLayoutProps = {
36
- layoutParts: LayoutParts;
37
- toasts: ToastSchema[];
38
45
  overscroll: Overscroll;
39
46
  showHints: boolean;
40
47
  onDismissToast: (id: string) => void;
41
- } & Pick<ComplementarySidebarProps, 'panels'>;
48
+ };
42
49
 
43
50
  const PlankSeparator = ({ index }: { index: number }) =>
44
51
  index > 0 ? <span role='separator' className='row-span-2 bg-deck is-4' style={{ gridColumn: index * 2 }} /> : null;
45
52
 
46
- export const DeckLayout = ({ layoutParts, toasts, overscroll, showHints, panels, onDismissToast }: DeckLayoutProps) => {
47
- const context = useLayout();
53
+ export const DeckLayout = ({ overscroll, showHints, onDismissToast }: DeckLayoutProps) => {
54
+ const { dispatchPromise: dispatch } = useIntentDispatcher();
55
+ const context = useCapability(DeckCapabilities.MutableDeckState);
48
56
  const {
49
- layoutMode,
50
- sidebarOpen,
51
- complementarySidebarOpen,
57
+ sidebarState,
58
+ complementarySidebarState,
59
+ complementarySidebarPanel,
52
60
  dialogOpen,
53
61
  dialogContent,
54
62
  dialogBlockAlign,
@@ -56,17 +64,24 @@ export const DeckLayout = ({ layoutParts, toasts, overscroll, showHints, panels,
56
64
  popoverOpen,
57
65
  popoverContent,
58
66
  popoverAnchorId,
67
+ deck,
68
+ toasts,
59
69
  } = context;
70
+ const { active, fullscreen, solo, plankSizing } = deck;
60
71
  const breakpoint = useBreakpoints();
72
+ const topbar = layoutAppliesTopbar(breakpoint);
61
73
  const hoistStatusbar = useHoistStatusbar(breakpoint);
62
- const { plankSizing } = useDeckContext();
63
74
  const pluginManager = usePluginManager();
64
- const fullScreenSlug = useMemo(() => firstIdInPart(layoutParts, 'fullScreen'), [layoutParts]);
65
75
 
66
76
  const scrollLeftRef = useRef<number | null>();
67
77
  const deckRef = useRef<HTMLDivElement>(null);
68
78
 
69
- const isSoloModeLoaded = layoutMode === 'solo' && Boolean(layoutParts.solo?.[0]);
79
+ // TODO(thure): This is a workaround for the difference in `React`ion time between displaying a Popover and rendering
80
+ // the anchor further down the tree. Refactor to use VirtualTrigger or some other approach which does not cause a lag.
81
+ const [delayedPopoverVisibility, setDelayedPopoverVisibility] = useState(false);
82
+ useEffect(() => {
83
+ popoverOpen ? setTimeout(() => setDelayedPopoverVisibility(true), 40) : setDelayedPopoverVisibility(false);
84
+ }, [popoverOpen]);
70
85
 
71
86
  // Ensure the first plank is attended when the deck is first rendered.
72
87
  useEffect(() => {
@@ -75,7 +90,7 @@ export const DeckLayout = ({ layoutParts, toasts, overscroll, showHints, panels,
75
90
  const attention = pluginManager.context.requestCapability(AttentionCapabilities.Attention);
76
91
  return attention.current;
77
92
  });
78
- const firstId = isSoloModeLoaded ? firstIdInPart(layoutParts, 'solo') : firstIdInPart(layoutParts, 'main');
93
+ const firstId = solo ?? active[0];
79
94
  if (attended.length === 0 && firstId) {
80
95
  // TODO(wittjosiah): Focusing the type button is a workaround.
81
96
  // If the plank is directly focused on first load the focus ring appears.
@@ -83,6 +98,27 @@ export const DeckLayout = ({ layoutParts, toasts, overscroll, showHints, panels,
83
98
  }
84
99
  }, []);
85
100
 
101
+ // Not using `breakpoint` to avoid firing when breakpoint changes between tablet and desktop.
102
+ // `ssr: false` to avoid using fallback values and flashing into solo mode on startup.
103
+ const [isNotMobile] = useMediaQuery('md', { ssr: false });
104
+ const shouldRevert = useRef(false);
105
+ useEffect(() => {
106
+ if (!isNotMobile && getMode(deck) === 'deck') {
107
+ // NOTE: Not `useAttended` so that the layout component is not re-rendered when the attended list changes.
108
+ const attended = untracked(() => {
109
+ const attention = pluginManager.context.requestCapability(AttentionCapabilities.Attention);
110
+ return attention.current;
111
+ });
112
+
113
+ shouldRevert.current = true;
114
+ void dispatch(
115
+ createIntent(LayoutAction.SetLayoutMode, { part: 'mode', subject: attended[0], options: { mode: 'solo' } }),
116
+ );
117
+ } else if (isNotMobile && getMode(deck) === 'solo' && shouldRevert.current) {
118
+ void dispatch(createIntent(LayoutAction.SetLayoutMode, { part: 'mode', options: { revert: true } }));
119
+ }
120
+ }, [isNotMobile, deck, dispatch]);
121
+
86
122
  /**
87
123
  * Clear scroll restoration state if the window is resized
88
124
  */
@@ -101,6 +137,7 @@ export const DeckLayout = ({ layoutParts, toasts, overscroll, showHints, panels,
101
137
  }
102
138
  }, []);
103
139
 
140
+ const layoutMode = getMode(deck);
104
141
  useOnTransition(layoutMode, (mode) => mode !== 'deck', 'deck', restoreScroll);
105
142
 
106
143
  /**
@@ -108,60 +145,72 @@ export const DeckLayout = ({ layoutParts, toasts, overscroll, showHints, panels,
108
145
  */
109
146
  const handleScroll = useCallback(
110
147
  (event: UIEvent) => {
111
- if (layoutMode === 'deck' && event.currentTarget === event.target) {
148
+ if (!solo && event.currentTarget === event.target) {
112
149
  scrollLeftRef.current = (event.target as HTMLDivElement).scrollLeft;
113
150
  }
114
151
  },
115
- [layoutMode],
152
+ [solo],
116
153
  );
117
154
 
118
- const isEmpty = (layoutParts.main?.length ?? 0) === 0 && (layoutParts.solo?.length ?? 0) === 0;
155
+ const isEmpty = !solo && active.length === 0;
119
156
 
120
157
  const padding = useMemo(() => {
121
- if (layoutMode === 'deck' && overscroll === 'centering') {
122
- return calculateOverscroll(layoutParts.main?.length ?? 0);
158
+ if (!solo && overscroll === 'centering') {
159
+ return calculateOverscroll(active.length);
123
160
  }
124
161
  return {};
125
- }, [layoutMode, overscroll, layoutParts.main]);
162
+ }, [solo, overscroll, deck]);
163
+
164
+ const mainPosition = useMemo(
165
+ () => [
166
+ 'grid !block-start-[env(safe-area-inset-top)]',
167
+ topbar && '!block-start-[calc(env(safe-area-inset-top)+var(--rail-size))]',
168
+ hoistStatusbar && 'lg:block-end-[--statusbar-size]',
169
+ ],
170
+ [topbar, hoistStatusbar],
171
+ );
126
172
 
127
173
  const Dialog = dialogType === 'alert' ? AlertDialog : NaturalDialog;
128
174
 
175
+ const handlePopoverOpenChange = useCallback(
176
+ (nextOpen: boolean) => {
177
+ if (nextOpen && popoverAnchorId) {
178
+ context.popoverOpen = true;
179
+ } else {
180
+ context.popoverOpen = false;
181
+ context.popoverAnchorId = undefined;
182
+ context.popoverSide = undefined;
183
+ }
184
+ },
185
+ [context],
186
+ );
187
+ const handlePopoverClose = useCallback(() => handlePopoverOpenChange(false), [handlePopoverOpenChange]);
188
+
129
189
  return (
130
- <Popover.Root
131
- modal
132
- open={!!(popoverAnchorId && popoverOpen)}
133
- onOpenChange={(nextOpen) => {
134
- if (nextOpen && popoverAnchorId) {
135
- context.popoverOpen = true;
136
- } else {
137
- context.popoverOpen = false;
138
- context.popoverAnchorId = undefined;
139
- }
140
- }}
141
- >
190
+ <Popover.Root modal open={!!(popoverAnchorId && delayedPopoverVisibility)} onOpenChange={handlePopoverOpenChange}>
142
191
  <ActiveNode />
143
192
 
144
- {layoutMode === 'fullscreen' && <Fullscreen id={fullScreenSlug} />}
193
+ {fullscreen && <Fullscreen id={solo} />}
145
194
 
146
- {layoutMode !== 'fullscreen' && (
195
+ {!fullscreen && (
147
196
  <Main.Root
148
- navigationSidebarOpen={context.sidebarOpen}
149
- onNavigationSidebarOpenChange={(next) => (context.sidebarOpen = next)}
150
- complementarySidebarOpen={context.complementarySidebarOpen}
151
- onComplementarySidebarOpenChange={(next) => (context.complementarySidebarOpen = next)}
197
+ navigationSidebarState={context.sidebarState}
198
+ onNavigationSidebarStateChange={(next) => (context.sidebarState = next)}
199
+ complementarySidebarState={context.complementarySidebarState}
200
+ onComplementarySidebarStateChange={(next) => (context.complementarySidebarState = next)}
152
201
  >
153
202
  {/* Left sidebar. */}
154
203
  <Sidebar />
155
204
 
156
205
  {/* Right sidebar. */}
157
- <ComplementarySidebar panels={panels} current={layoutParts.complementary?.[0].id} />
206
+ <ComplementarySidebar current={complementarySidebarPanel} />
158
207
 
159
208
  {/* Dialog overlay to dismiss dialogs. */}
160
209
  <Main.Overlay />
161
210
 
162
211
  {/* No content. */}
163
212
  {isEmpty && (
164
- <Main.Content handlesFocus>
213
+ <Main.Content bounce handlesFocus classNames={mainPosition}>
165
214
  <ContentEmpty />
166
215
  </Main.Content>
167
216
  )}
@@ -170,76 +219,74 @@ export const DeckLayout = ({ layoutParts, toasts, overscroll, showHints, panels,
170
219
  {!isEmpty && (
171
220
  <Main.Content
172
221
  bounce
173
- classNames={[
174
- 'grid !block-start-[env(safe-area-inset-top)] lg:!block-start-[calc(env(safe-area-inset-top)+var(--rail-size))]',
175
- hoistStatusbar && 'lg:block-end-[--statusbar-size]',
176
- ]}
222
+ classNames={mainPosition}
177
223
  handlesFocus
178
224
  style={
179
225
  {
180
- '--dx-main-sidebarWidth': sidebarOpen ? 'var(--nav-sidebar-size)' : '0px',
181
- '--dx-main-complementaryWidth': complementarySidebarOpen
182
- ? 'var(--complementary-sidebar-size)'
183
- : '0px',
184
- '--dx-main-contentFirstWidth': `${plankSizing[layoutParts.main?.[0]?.id ?? 'never'] ?? DEFAULT_HORIZONTAL_SIZE}rem`,
185
- '--dx-main-contentLastWidth': `${plankSizing[layoutParts.main?.[(layoutParts.main?.length ?? 1) - 1]?.id ?? 'never'] ?? DEFAULT_HORIZONTAL_SIZE}rem`,
226
+ '--dx-main-sidebarWidth':
227
+ sidebarState === 'expanded'
228
+ ? 'var(--nav-sidebar-size)'
229
+ : sidebarState === 'collapsed'
230
+ ? 'var(--l0-size)'
231
+ : '0',
232
+ '--dx-main-complementaryWidth':
233
+ complementarySidebarState === 'expanded'
234
+ ? 'var(--complementary-sidebar-size)'
235
+ : complementarySidebarState === 'collapsed'
236
+ ? 'var(--rail-size)'
237
+ : '0',
238
+ '--dx-main-contentFirstWidth': `${plankSizing[active[0] ?? 'never'] ?? DEFAULT_HORIZONTAL_SIZE}rem`,
239
+ '--dx-main-contentLastWidth': `${plankSizing[active[(active.length ?? 1) - 1] ?? 'never'] ?? DEFAULT_HORIZONTAL_SIZE}rem`,
186
240
  } as MainProps['style']
187
241
  }
188
242
  >
189
243
  <div
190
244
  role='none'
191
- className={!isSoloModeLoaded ? 'relative bg-deck overflow-hidden' : 'sr-only'}
192
- {...(isSoloModeLoaded && { inert: '' })}
245
+ className={!solo ? 'relative bg-deck overflow-hidden' : 'sr-only'}
246
+ {...(solo && { inert: '' })}
193
247
  >
248
+ {!topbar && <ToggleSidebarButton classNames={fixedSidebarToggleStyles} />}
249
+ {!topbar && <ToggleComplementarySidebarButton classNames={fixedComplementarySidebarToggleStyles} />}
194
250
  <Stack
195
251
  orientation='horizontal'
196
252
  size='contain'
197
253
  classNames={['absolute inset-block-0 -inset-inline-px', mainPaddingTransitions]}
198
254
  onScroll={handleScroll}
199
- itemsCount={2 * (layoutParts.main?.length ?? 0) - 1}
255
+ itemsCount={2 * (active.length ?? 0) - 1}
200
256
  style={padding}
201
257
  ref={deckRef}
202
258
  >
203
- {layoutParts.main?.map((layoutEntry, index) => (
204
- <Fragment key={layoutEntry.id}>
259
+ {active.map((entryId, index) => (
260
+ <Fragment key={entryId}>
205
261
  <PlankSeparator index={index} />
206
- <Plank
207
- entry={layoutEntry}
208
- layoutParts={layoutParts}
209
- part='main'
210
- layoutMode={layoutMode}
211
- order={index * 2 + 1}
212
- />
262
+ <Plank id={entryId} part='deck' order={index * 2 + 1} active={active} layoutMode={layoutMode} />
213
263
  </Fragment>
214
264
  ))}
215
265
  </Stack>
216
266
  </div>
217
267
  <div
218
268
  role='none'
219
- className={isSoloModeLoaded ? 'relative bg-deck overflow-hidden' : 'sr-only'}
220
- {...(!isSoloModeLoaded && { inert: '' })}
269
+ className={solo ? 'relative bg-deck overflow-hidden' : 'sr-only'}
270
+ {...(!solo && { inert: '' })}
221
271
  >
272
+ {!topbar && <ToggleSidebarButton classNames={fixedSidebarToggleStyles} />}
273
+ {!topbar && <ToggleComplementarySidebarButton classNames={fixedComplementarySidebarToggleStyles} />}
222
274
  <StackContext.Provider value={{ size: 'contain', orientation: 'horizontal', rail: true }}>
223
- <Plank entry={layoutParts.solo?.[0]} layoutParts={layoutParts} part='solo' layoutMode={layoutMode} />
275
+ <Plank id={solo} part='solo' layoutMode={layoutMode} />
224
276
  </StackContext.Provider>
225
277
  </div>
226
278
  </Main.Content>
227
279
  )}
228
280
 
229
281
  {/* Status bar. */}
230
- {breakpoint === 'desktop' && <Topbar />}
282
+ {topbar && <Topbar />}
231
283
  {hoistStatusbar && <StatusBar showHints={showHints} />}
232
284
  </Main.Root>
233
285
  )}
234
286
 
235
287
  {/* Global popovers. */}
236
288
  <Popover.Portal>
237
- <Popover.Content
238
- onEscapeKeyDown={() => {
239
- context.popoverOpen = false;
240
- context.popoverAnchorId = undefined;
241
- }}
242
- >
289
+ <Popover.Content side={context.popoverSide} onEscapeKeyDown={handlePopoverClose}>
243
290
  <Popover.Viewport>
244
291
  <Surface role='popover' data={popoverContent} limit={1} />
245
292
  </Popover.Viewport>
@@ -248,10 +295,20 @@ export const DeckLayout = ({ layoutParts, toasts, overscroll, showHints, panels,
248
295
  </Popover.Portal>
249
296
 
250
297
  {/* Global dialog. */}
251
- <Dialog.Root open={dialogOpen} onOpenChange={(nextOpen) => (context.dialogOpen = nextOpen)}>
252
- <Dialog.Overlay blockAlign={dialogBlockAlign}>
298
+ {/* TODO(thure): End block alignment affecting `modal` and whether the surface renders in an overlay is tailored
299
+ to the needs of the ambient chat dialog. As the feature matures, consider separating concerns. */}
300
+ <Dialog.Root
301
+ modal={dialogBlockAlign !== 'end'}
302
+ open={dialogOpen}
303
+ onOpenChange={(nextOpen) => (context.dialogOpen = nextOpen)}
304
+ >
305
+ {dialogBlockAlign === 'end' ? (
253
306
  <Surface role='dialog' data={dialogContent} limit={1} />
254
- </Dialog.Overlay>
307
+ ) : (
308
+ <Dialog.Overlay blockAlign={dialogBlockAlign}>
309
+ <Surface role='dialog' data={dialogContent} limit={1} />
310
+ </Dialog.Overlay>
311
+ )}
255
312
  </Dialog.Root>
256
313
 
257
314
  {/* Global toasts. */}
@@ -4,8 +4,7 @@
4
4
 
5
5
  import React from 'react';
6
6
 
7
- import { Surface } from '@dxos/app-framework';
8
- import { useGraph } from '@dxos/plugin-graph';
7
+ import { Surface, useAppGraph } from '@dxos/app-framework';
9
8
  import { fixedInsetFlexLayout } from '@dxos/react-ui-theme';
10
9
 
11
10
  import { Fallback } from './Fallback';
@@ -13,7 +12,7 @@ import { SURFACE_PREFIX } from './constants';
13
12
  import { useNode } from '../../hooks';
14
13
 
15
14
  export const Fullscreen = ({ id }: { id?: string }) => {
16
- const { graph } = useGraph();
15
+ const { graph } = useAppGraph();
17
16
  const fullScreenNode = useNode(graph, id);
18
17
 
19
18
  return (
@@ -2,30 +2,23 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
- import React, { Fragment, memo, useEffect, useMemo } from 'react';
5
+ import React, { Fragment, memo, useCallback, useEffect, useMemo } from 'react';
6
6
 
7
- import {
8
- createIntent,
9
- LayoutAction,
10
- NavigationAction,
11
- SLUG_PATH_SEPARATOR,
12
- Surface,
13
- useIntentDispatcher,
14
- type LayoutCoordinate,
15
- } from '@dxos/app-framework';
16
- import { type Node, useGraph } from '@dxos/plugin-graph';
7
+ import { createIntent, LayoutAction, Surface, useAppGraph, useIntentDispatcher } from '@dxos/app-framework';
8
+ import { type Node } from '@dxos/plugin-graph';
17
9
  import { Icon, Popover, toLocalizedString, useTranslation } from '@dxos/react-ui';
18
10
  import { StackItem, type StackItemSigilAction } from '@dxos/react-ui-stack';
19
11
  import { TextTooltip } from '@dxos/react-ui-text-tooltip';
20
12
 
21
13
  import { PlankControls } from './PlankControls';
22
- import { ToggleComplementarySidebarButton, ToggleSidebarButton } from './SidebarButton';
23
14
  import { DECK_PLUGIN } from '../../meta';
15
+ import { DeckAction, SLUG_PATH_SEPARATOR } from '../../types';
24
16
  import { useBreakpoints } from '../../util';
25
17
  import { soloInlinePadding } from '../fragments';
26
18
 
27
19
  export type NodePlankHeadingProps = {
28
- coordinate: LayoutCoordinate;
20
+ id: string;
21
+ part: 'solo' | 'deck' | 'complementary';
29
22
  node?: Node;
30
23
  canIncrementStart?: boolean;
31
24
  canIncrementEnd?: boolean;
@@ -36,7 +29,8 @@ export type NodePlankHeadingProps = {
36
29
 
37
30
  export const NodePlankHeading = memo(
38
31
  ({
39
- coordinate,
32
+ id,
33
+ part,
40
34
  node,
41
35
  canIncrementStart,
42
36
  canIncrementEnd,
@@ -45,14 +39,14 @@ export const NodePlankHeading = memo(
45
39
  actions = [],
46
40
  }: NodePlankHeadingProps) => {
47
41
  const { t } = useTranslation(DECK_PLUGIN);
48
- const { graph } = useGraph();
42
+ const { graph } = useAppGraph();
43
+ const breakpoint = useBreakpoints();
49
44
  const icon = node?.properties?.icon ?? 'ph--placeholder--regular';
50
45
  const label = pending
51
46
  ? t('pending heading')
52
47
  : toLocalizedString(node?.properties?.label ?? ['plank heading fallback label', { ns: DECK_PLUGIN }], t);
53
48
  const { dispatchPromise: dispatch } = useIntentDispatcher();
54
49
  const ActionRoot = node && popoverAnchorId === `dxos.org/ui/${DECK_PLUGIN}/${node.id}` ? Popover.Anchor : Fragment;
55
- const breakpoint = useBreakpoints();
56
50
 
57
51
  useEffect(() => {
58
52
  const frame = requestAnimationFrame(() => {
@@ -63,36 +57,65 @@ export const NodePlankHeading = memo(
63
57
  return () => cancelAnimationFrame(frame);
64
58
  }, [node]);
65
59
 
66
- const layoutPart = coordinate.part;
67
60
  // NOTE(Zan): Node ids may now contain a path like `${space}:${id}~comments`
68
- const attendableId = coordinate.entryId.split(SLUG_PATH_SEPARATOR).at(0);
61
+ const attendableId = id.split(SLUG_PATH_SEPARATOR).at(0);
69
62
  const capabilities = useMemo(
70
63
  () => ({
71
- solo: layoutPart === 'solo' || layoutPart === 'main',
64
+ solo: breakpoint !== 'mobile' && (part === 'solo' || part === 'deck'),
72
65
  incrementStart: canIncrementStart,
73
66
  incrementEnd: canIncrementEnd,
74
67
  }),
75
- [breakpoint, layoutPart, canIncrementStart, canIncrementEnd],
68
+ [breakpoint, part, canIncrementStart, canIncrementEnd],
69
+ );
70
+
71
+ const sigilActions = useMemo(
72
+ () => node && [actions, graph.actions(node)].filter((a) => a.length > 0),
73
+ [actions, node, graph],
74
+ );
75
+ const handleAction = useCallback((action: StackItemSigilAction) => {
76
+ typeof action.data === 'function' && action.data?.({ node: action as Node, caller: DECK_PLUGIN });
77
+ }, []);
78
+
79
+ const handlePlankAction = useCallback(
80
+ (eventType: DeckAction.PartAdjustment) => {
81
+ if (eventType === 'solo') {
82
+ return dispatch(createIntent(DeckAction.Adjust, { type: eventType, id }));
83
+ } else if (eventType === 'close') {
84
+ if (part === 'complementary') {
85
+ return dispatch(
86
+ createIntent(LayoutAction.UpdateComplementary, {
87
+ part: 'complementary',
88
+ options: { state: 'collapsed' },
89
+ }),
90
+ );
91
+ } else {
92
+ return dispatch(
93
+ createIntent(LayoutAction.Close, { part: 'main', subject: [id], options: { state: false } }),
94
+ );
95
+ }
96
+ } else {
97
+ return dispatch(createIntent(DeckAction.Adjust, { type: eventType, id }));
98
+ }
99
+ },
100
+ [dispatch, id, part],
76
101
  );
77
102
 
78
103
  return (
79
104
  <StackItem.Heading
80
105
  classNames={[
81
- 'plb-1 border-be border-separator items-stretch gap-1',
82
- layoutPart === 'solo' ? soloInlinePadding : 'pli-1',
106
+ 'plb-1 border-be border-separator items-stretch gap-1 sticky inline-start-12 app-drag',
107
+ part === 'solo' ? soloInlinePadding : 'pli-1',
83
108
  ]}
84
109
  >
85
110
  <ActionRoot>
86
- {node ? (
111
+ {node && sigilActions ? (
87
112
  <StackItem.Sigil
88
113
  icon={icon}
89
- related={layoutPart === 'complementary'}
114
+ related={part === 'complementary'}
90
115
  attendableId={attendableId}
91
116
  triggerLabel={t('actions menu label')}
92
- actions={[actions, graph.actions(node)].filter((a) => a.length > 0)}
93
- onAction={(action) =>
94
- typeof action.data === 'function' && action.data?.({ node: action as Node, caller: DECK_PLUGIN })
95
- }
117
+ actions={sigilActions}
118
+ onAction={handleAction}
96
119
  >
97
120
  <Surface role='menu-footer' data={{ subject: node.data }} />
98
121
  </StackItem.Sigil>
@@ -103,53 +126,22 @@ export const NodePlankHeading = memo(
103
126
  </StackItem.SigilButton>
104
127
  )}
105
128
  </ActionRoot>
106
- {breakpoint !== 'desktop' && <ToggleSidebarButton />}
107
129
  <TextTooltip text={label} onlyWhenTruncating>
108
130
  <StackItem.HeadingLabel
109
131
  attendableId={attendableId}
110
- related={layoutPart === 'complementary'}
132
+ related={part === 'complementary'}
111
133
  {...(pending && { classNames: 'text-description' })}
112
134
  >
113
135
  {label}
114
136
  </StackItem.HeadingLabel>
115
137
  </TextTooltip>
116
- {node && layoutPart !== 'complementary' && (
117
- // TODO(Zan): What are we doing with layout coordinate here?
118
- <Surface role='navbar-end' data={{ subject: node.data }} />
119
- )}
120
- {/* NOTE(thure): Pinning & unpinning are temporarily disabled */}
138
+ {node && part !== 'complementary' && <Surface role='navbar-end' data={{ subject: node.data }} />}
121
139
  <PlankControls
122
140
  capabilities={capabilities}
123
- isSolo={layoutPart === 'solo'}
124
- onClick={(eventType) => {
125
- if (!layoutPart) {
126
- return;
127
- }
128
-
129
- // TODO(Zan): Update this to use the new layout actions.
130
- if (eventType === 'solo') {
131
- return dispatch(
132
- createIntent(NavigationAction.Adjust, {
133
- type: eventType,
134
- layoutCoordinate: { part: 'main', entryId: coordinate.entryId },
135
- }),
136
- );
137
- } else if (eventType === 'close') {
138
- if (layoutPart === 'complementary') {
139
- return dispatch(createIntent(LayoutAction.SetLayout, { element: 'complementary', state: false }));
140
- } else {
141
- return dispatch(
142
- createIntent(NavigationAction.Close, { activeParts: { [layoutPart]: [coordinate.entryId] } }),
143
- );
144
- }
145
- } else {
146
- return dispatch(createIntent(NavigationAction.Adjust, { type: eventType, layoutCoordinate: coordinate }));
147
- }
148
- }}
149
- close={layoutPart === 'complementary' ? 'minify-end' : true}
150
- >
151
- <ToggleComplementarySidebarButton />
152
- </PlankControls>
141
+ isSolo={part === 'solo'}
142
+ onClick={handlePlankAction}
143
+ close={part === 'complementary' ? 'minify-end' : true}
144
+ />
153
145
  </StackItem.Heading>
154
146
  );
155
147
  },