@dxos/plugin-simple-layout 0.8.4-main.6fa680abb7 → 0.8.4-main.7996785055

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 (195) hide show
  1. package/dist/lib/browser/{chunk-MDPEKLKR.mjs → chunk-J5FQ32AV.mjs} +302 -209
  2. package/dist/lib/browser/chunk-J5FQ32AV.mjs.map +7 -0
  3. package/dist/lib/browser/chunk-XJVW3PRY.mjs +22 -0
  4. package/dist/lib/browser/chunk-XJVW3PRY.mjs.map +7 -0
  5. package/dist/lib/browser/close-OT5JOGVY.mjs +34 -0
  6. package/dist/lib/browser/close-OT5JOGVY.mjs.map +7 -0
  7. package/dist/lib/browser/index.mjs +23 -22
  8. package/dist/lib/browser/index.mjs.map +4 -4
  9. package/dist/lib/browser/meta.json +1 -1
  10. package/dist/lib/browser/open-4FQ44Z5G.mjs +31 -0
  11. package/dist/lib/browser/open-4FQ44Z5G.mjs.map +7 -0
  12. package/dist/lib/browser/operation-handler-OAD7LISD.mjs +16 -0
  13. package/dist/lib/browser/operation-handler-OAD7LISD.mjs.map +7 -0
  14. package/dist/lib/browser/{react-root-WVQYY2JA.mjs → react-root-6KIGPLUT.mjs} +2 -2
  15. package/dist/lib/browser/{react-surface-VLBR37ED.mjs → react-surface-JLIEQGOL.mjs} +2 -2
  16. package/dist/lib/browser/revert-workspace-DLE265AN.mjs +21 -0
  17. package/dist/lib/browser/revert-workspace-DLE265AN.mjs.map +7 -0
  18. package/dist/lib/browser/set-52HGTSH4.mjs +21 -0
  19. package/dist/lib/browser/set-52HGTSH4.mjs.map +7 -0
  20. package/dist/lib/browser/set-layout-mode-T6QI3DGU.mjs +11 -0
  21. package/dist/lib/browser/set-layout-mode-T6QI3DGU.mjs.map +7 -0
  22. package/dist/lib/browser/switch-workspace-5Y6T4BWJ.mjs +24 -0
  23. package/dist/lib/browser/switch-workspace-5Y6T4BWJ.mjs.map +7 -0
  24. package/dist/lib/browser/update-complementary-MX3TTVAB.mjs +31 -0
  25. package/dist/lib/browser/update-complementary-MX3TTVAB.mjs.map +7 -0
  26. package/dist/lib/browser/update-dialog-FPAPZXKO.mjs +29 -0
  27. package/dist/lib/browser/update-dialog-FPAPZXKO.mjs.map +7 -0
  28. package/dist/lib/browser/update-popover-6V5ZTIYN.mjs +33 -0
  29. package/dist/lib/browser/update-popover-6V5ZTIYN.mjs.map +7 -0
  30. package/dist/lib/browser/update-sidebar-WHDKYMV7.mjs +10 -0
  31. package/dist/lib/browser/update-sidebar-WHDKYMV7.mjs.map +7 -0
  32. package/dist/lib/browser/{url-handler-RBRONH7S.mjs → url-handler-GUJ3L7Y3.mjs} +24 -12
  33. package/dist/lib/browser/url-handler-GUJ3L7Y3.mjs.map +7 -0
  34. package/dist/lib/node-esm/chunk-27K22G6S.mjs +23 -0
  35. package/dist/lib/node-esm/chunk-27K22G6S.mjs.map +7 -0
  36. package/dist/lib/node-esm/{chunk-DCKASLMP.mjs → chunk-EXNDYZTP.mjs} +302 -209
  37. package/dist/lib/node-esm/chunk-EXNDYZTP.mjs.map +7 -0
  38. package/dist/lib/node-esm/close-PEVHREL2.mjs +35 -0
  39. package/dist/lib/node-esm/close-PEVHREL2.mjs.map +7 -0
  40. package/dist/lib/node-esm/index.mjs +23 -22
  41. package/dist/lib/node-esm/index.mjs.map +4 -4
  42. package/dist/lib/node-esm/meta.json +1 -1
  43. package/dist/lib/node-esm/open-LMJY7JCJ.mjs +32 -0
  44. package/dist/lib/node-esm/open-LMJY7JCJ.mjs.map +7 -0
  45. package/dist/lib/node-esm/operation-handler-A2DC4WHC.mjs +18 -0
  46. package/dist/lib/node-esm/operation-handler-A2DC4WHC.mjs.map +7 -0
  47. package/dist/lib/node-esm/{react-root-XBNDM7BE.mjs → react-root-5SCW2KTH.mjs} +2 -2
  48. package/dist/lib/node-esm/{react-surface-U5NHA367.mjs → react-surface-WLKB6AET.mjs} +2 -2
  49. package/dist/lib/node-esm/revert-workspace-XZXT64YA.mjs +22 -0
  50. package/dist/lib/node-esm/revert-workspace-XZXT64YA.mjs.map +7 -0
  51. package/dist/lib/node-esm/set-5I6LFH5L.mjs +22 -0
  52. package/dist/lib/node-esm/set-5I6LFH5L.mjs.map +7 -0
  53. package/dist/lib/node-esm/set-layout-mode-F5B6QLZM.mjs +13 -0
  54. package/dist/lib/node-esm/set-layout-mode-F5B6QLZM.mjs.map +7 -0
  55. package/dist/lib/node-esm/switch-workspace-PB6T2SGY.mjs +25 -0
  56. package/dist/lib/node-esm/switch-workspace-PB6T2SGY.mjs.map +7 -0
  57. package/dist/lib/node-esm/update-complementary-FTW423IY.mjs +32 -0
  58. package/dist/lib/node-esm/update-complementary-FTW423IY.mjs.map +7 -0
  59. package/dist/lib/node-esm/update-dialog-ID267DCL.mjs +30 -0
  60. package/dist/lib/node-esm/update-dialog-ID267DCL.mjs.map +7 -0
  61. package/dist/lib/node-esm/update-popover-RLHU2HF4.mjs +34 -0
  62. package/dist/lib/node-esm/update-popover-RLHU2HF4.mjs.map +7 -0
  63. package/dist/lib/node-esm/update-sidebar-BJ7HTNZ4.mjs +12 -0
  64. package/dist/lib/node-esm/update-sidebar-BJ7HTNZ4.mjs.map +7 -0
  65. package/dist/lib/node-esm/{url-handler-QSMCH3JB.mjs → url-handler-WMONO2T6.mjs} +24 -12
  66. package/dist/lib/node-esm/url-handler-WMONO2T6.mjs.map +7 -0
  67. package/dist/types/src/SimpleLayoutPlugin.d.ts +1 -1
  68. package/dist/types/src/SimpleLayoutPlugin.d.ts.map +1 -1
  69. package/dist/types/src/capabilities/index.d.ts +1 -1
  70. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  71. package/dist/types/src/capabilities/operation-handler/index.d.ts +4 -0
  72. package/dist/types/src/capabilities/operation-handler/index.d.ts.map +1 -0
  73. package/dist/types/src/capabilities/operation-handler/operation-handler.d.ts +6 -0
  74. package/dist/types/src/capabilities/operation-handler/operation-handler.d.ts.map +1 -0
  75. package/dist/types/src/capabilities/url-handler/url-handler.d.ts.map +1 -1
  76. package/dist/types/src/components/ContentError.stories.d.ts +6 -1
  77. package/dist/types/src/components/ContentError.stories.d.ts.map +1 -1
  78. package/dist/types/src/components/DebugOverlay/DebugOverlay.d.ts +19 -0
  79. package/dist/types/src/components/DebugOverlay/DebugOverlay.d.ts.map +1 -0
  80. package/dist/types/src/components/DebugOverlay/index.d.ts +2 -0
  81. package/dist/types/src/components/DebugOverlay/index.d.ts.map +1 -0
  82. package/dist/types/src/components/Home/Home.d.ts.map +1 -1
  83. package/dist/types/src/components/Loading/Loading.d.ts +3 -0
  84. package/dist/types/src/components/Loading/Loading.d.ts.map +1 -0
  85. package/dist/types/src/components/{ContentLoading/ContentLoading.stories.d.ts → Loading/Loading.stories.d.ts} +1 -1
  86. package/dist/types/src/components/Loading/Loading.stories.d.ts.map +1 -0
  87. package/dist/types/src/components/Loading/index.d.ts +2 -0
  88. package/dist/types/src/components/Loading/index.d.ts.map +1 -0
  89. package/dist/types/src/components/MobileLayout/MobileLayout.d.ts.map +1 -1
  90. package/dist/types/src/components/MobileLayout/MobileLayout.stories.d.ts.map +1 -1
  91. package/dist/types/src/components/NavBranch/NavBranch.d.ts.map +1 -1
  92. package/dist/types/src/components/Popover/Popover.d.ts.map +1 -1
  93. package/dist/types/src/components/SimpleLayout/AppBar.d.ts +9 -7
  94. package/dist/types/src/components/SimpleLayout/AppBar.d.ts.map +1 -1
  95. package/dist/types/src/components/SimpleLayout/AppBar.stories.d.ts +9 -4
  96. package/dist/types/src/components/SimpleLayout/AppBar.stories.d.ts.map +1 -1
  97. package/dist/types/src/components/SimpleLayout/Main.d.ts.map +1 -1
  98. package/dist/types/src/components/SimpleLayout/NavBar.d.ts +9 -7
  99. package/dist/types/src/components/SimpleLayout/NavBar.d.ts.map +1 -1
  100. package/dist/types/src/components/SimpleLayout/NavBar.stories.d.ts +13 -5
  101. package/dist/types/src/components/SimpleLayout/NavBar.stories.d.ts.map +1 -1
  102. package/dist/types/src/components/SimpleLayout/SimpleLayout.d.ts.map +1 -1
  103. package/dist/types/src/components/SimpleLayout/SimpleLayout.stories.d.ts +10 -11
  104. package/dist/types/src/components/SimpleLayout/SimpleLayout.stories.d.ts.map +1 -1
  105. package/dist/types/src/components/index.d.ts +2 -1
  106. package/dist/types/src/components/index.d.ts.map +1 -1
  107. package/dist/types/src/operations/close.d.ts +5 -0
  108. package/dist/types/src/operations/close.d.ts.map +1 -0
  109. package/dist/types/src/operations/index.d.ts +3 -0
  110. package/dist/types/src/operations/index.d.ts.map +1 -0
  111. package/dist/types/src/operations/open.d.ts +5 -0
  112. package/dist/types/src/operations/open.d.ts.map +1 -0
  113. package/dist/types/src/operations/revert-workspace.d.ts +5 -0
  114. package/dist/types/src/operations/revert-workspace.d.ts.map +1 -0
  115. package/dist/types/src/operations/set-layout-mode.d.ts +5 -0
  116. package/dist/types/src/operations/set-layout-mode.d.ts.map +1 -0
  117. package/dist/types/src/operations/set.d.ts +5 -0
  118. package/dist/types/src/operations/set.d.ts.map +1 -0
  119. package/dist/types/src/operations/state-access.d.ts +8 -0
  120. package/dist/types/src/operations/state-access.d.ts.map +1 -0
  121. package/dist/types/src/operations/switch-workspace.d.ts +5 -0
  122. package/dist/types/src/operations/switch-workspace.d.ts.map +1 -0
  123. package/dist/types/src/operations/update-complementary.d.ts +5 -0
  124. package/dist/types/src/operations/update-complementary.d.ts.map +1 -0
  125. package/dist/types/src/operations/update-dialog.d.ts +5 -0
  126. package/dist/types/src/operations/update-dialog.d.ts.map +1 -0
  127. package/dist/types/src/operations/update-popover.d.ts +5 -0
  128. package/dist/types/src/operations/update-popover.d.ts.map +1 -0
  129. package/dist/types/src/operations/update-sidebar.d.ts +5 -0
  130. package/dist/types/src/operations/update-sidebar.d.ts.map +1 -0
  131. package/dist/types/src/translations.d.ts +6 -1
  132. package/dist/types/src/translations.d.ts.map +1 -1
  133. package/dist/types/tsconfig.tsbuildinfo +1 -1
  134. package/package.json +29 -29
  135. package/src/SimpleLayoutPlugin.ts +3 -3
  136. package/src/capabilities/index.ts +1 -1
  137. package/src/capabilities/operation-handler/index.ts +9 -0
  138. package/src/capabilities/operation-handler/operation-handler.ts +14 -0
  139. package/src/capabilities/url-handler/url-handler.ts +15 -3
  140. package/src/components/DebugOverlay/DebugOverlay.tsx +96 -0
  141. package/src/components/DebugOverlay/index.ts +5 -0
  142. package/src/components/Home/Home.tsx +27 -28
  143. package/src/components/{ContentLoading/ContentLoading.stories.tsx → Loading/Loading.stories.tsx} +4 -4
  144. package/src/components/{ContentLoading/ContentLoading.tsx → Loading/Loading.tsx} +1 -1
  145. package/src/components/{ContentLoading → Loading}/index.ts +1 -1
  146. package/src/components/MobileLayout/MobileLayout.stories.tsx +10 -6
  147. package/src/components/MobileLayout/MobileLayout.tsx +118 -49
  148. package/src/components/NavBranch/NavBranch.tsx +27 -30
  149. package/src/components/Popover/Popover.tsx +2 -12
  150. package/src/components/SimpleLayout/AppBar.stories.tsx +3 -3
  151. package/src/components/SimpleLayout/AppBar.tsx +58 -59
  152. package/src/components/SimpleLayout/Drawer.tsx +6 -6
  153. package/src/components/SimpleLayout/Main.tsx +15 -19
  154. package/src/components/SimpleLayout/NavBar.tsx +8 -9
  155. package/src/components/SimpleLayout/SimpleLayout.stories.tsx +41 -64
  156. package/src/components/SimpleLayout/SimpleLayout.tsx +29 -30
  157. package/src/components/index.ts +2 -1
  158. package/src/hooks/useAppBarProps.ts +6 -6
  159. package/src/hooks/useDrawerActions.ts +1 -1
  160. package/src/operations/close.ts +34 -0
  161. package/src/operations/index.ts +16 -0
  162. package/src/operations/open.ts +32 -0
  163. package/src/operations/revert-workspace.ts +22 -0
  164. package/src/operations/set-layout-mode.ts +12 -0
  165. package/src/operations/set.ts +23 -0
  166. package/src/operations/state-access.ts +19 -0
  167. package/src/operations/switch-workspace.ts +26 -0
  168. package/src/operations/update-complementary.ts +34 -0
  169. package/src/operations/update-dialog.ts +28 -0
  170. package/src/operations/update-popover.ts +35 -0
  171. package/src/operations/update-sidebar.ts +12 -0
  172. package/src/translations.ts +2 -1
  173. package/dist/lib/browser/chunk-MDPEKLKR.mjs.map +0 -7
  174. package/dist/lib/browser/operation-resolver-VTZ6HZ4B.mjs +0 -194
  175. package/dist/lib/browser/operation-resolver-VTZ6HZ4B.mjs.map +0 -7
  176. package/dist/lib/browser/url-handler-RBRONH7S.mjs.map +0 -7
  177. package/dist/lib/node-esm/chunk-DCKASLMP.mjs.map +0 -7
  178. package/dist/lib/node-esm/operation-resolver-R7CQ6ERU.mjs +0 -195
  179. package/dist/lib/node-esm/operation-resolver-R7CQ6ERU.mjs.map +0 -7
  180. package/dist/lib/node-esm/url-handler-QSMCH3JB.mjs.map +0 -7
  181. package/dist/types/src/capabilities/operation-resolver/index.d.ts +0 -3
  182. package/dist/types/src/capabilities/operation-resolver/index.d.ts.map +0 -1
  183. package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts +0 -5
  184. package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts.map +0 -1
  185. package/dist/types/src/components/ContentLoading/ContentLoading.d.ts +0 -3
  186. package/dist/types/src/components/ContentLoading/ContentLoading.d.ts.map +0 -1
  187. package/dist/types/src/components/ContentLoading/ContentLoading.stories.d.ts.map +0 -1
  188. package/dist/types/src/components/ContentLoading/index.d.ts +0 -2
  189. package/dist/types/src/components/ContentLoading/index.d.ts.map +0 -1
  190. package/src/capabilities/operation-resolver/index.ts +0 -10
  191. package/src/capabilities/operation-resolver/operation-resolver.ts +0 -202
  192. /package/dist/lib/browser/{react-root-WVQYY2JA.mjs.map → react-root-6KIGPLUT.mjs.map} +0 -0
  193. /package/dist/lib/browser/{react-surface-VLBR37ED.mjs.map → react-surface-JLIEQGOL.mjs.map} +0 -0
  194. /package/dist/lib/node-esm/{react-root-XBNDM7BE.mjs.map → react-root-5SCW2KTH.mjs.map} +0 -0
  195. /package/dist/lib/node-esm/{react-surface-U5NHA367.mjs.map → react-surface-WLKB6AET.mjs.map} +0 -0
@@ -10,12 +10,12 @@ import { useOperationInvoker } from "@dxos/app-framework/ui";
10
10
  import { LayoutOperation } from "@dxos/app-toolkit";
11
11
  import { useAppGraph as useAppGraph2 } from "@dxos/app-toolkit/ui";
12
12
  import { Node, useConnections } from "@dxos/plugin-graph";
13
- import { Avatar, Icon, Panel, ScrollArea, Toolbar, toLocalizedString, useTranslation } from "@dxos/react-ui";
13
+ import { Avatar, Icon, ScrollArea, toLocalizedString, useTranslation } from "@dxos/react-ui";
14
14
  import { Card } from "@dxos/react-ui";
15
15
  import { Mosaic } from "@dxos/react-ui-mosaic";
16
- import { SearchList, useSearchListItem, useSearchListResults } from "@dxos/react-ui-searchlist";
16
+ import { SearchPanel, useSearchListItem, useSearchListResults } from "@dxos/react-ui-search";
17
17
  import { mx } from "@dxos/ui-theme";
18
- import { byPosition } from "@dxos/util";
18
+ import { byPosition, getHostPlatform, isTauri } from "@dxos/util";
19
19
 
20
20
  // src/components/hooks.ts
21
21
  import { useEffect } from "react";
@@ -58,26 +58,22 @@ var Home = (_) => {
58
58
  items,
59
59
  extract: (node) => toLocalizedString(node.properties.label, t)
60
60
  });
61
- return /* @__PURE__ */ React.createElement(SearchList.Root, {
61
+ const autoFocus = !isTauri() || getHostPlatform() !== "ios";
62
+ return /* @__PURE__ */ React.createElement(SearchPanel, {
62
63
  onSearch: handleSearch
63
- }, /* @__PURE__ */ React.createElement(Panel.Root, null, /* @__PURE__ */ React.createElement(Panel.Toolbar, {
64
- asChild: true
65
- }, /* @__PURE__ */ React.createElement(Toolbar.Root, null, /* @__PURE__ */ React.createElement(SearchList.Input, {
66
- placeholder: t("search placeholder"),
67
- autoFocus: true
68
- }))), /* @__PURE__ */ React.createElement(Panel.Content, {
69
- asChild: true
70
- }, /* @__PURE__ */ React.createElement(SearchList.Content, null, /* @__PURE__ */ React.createElement(Mosaic.Container, {
64
+ }, /* @__PURE__ */ React.createElement(Mosaic.Container, {
71
65
  asChild: true
72
66
  }, /* @__PURE__ */ React.createElement(ScrollArea.Root, {
73
- orientation: "vertical"
74
- }, /* @__PURE__ */ React.createElement(ScrollArea.Viewport, {
75
- classNames: "p-2"
76
- }, /* @__PURE__ */ React.createElement(Mosaic.Stack, {
67
+ centered: true,
68
+ padding: true,
69
+ thin: true
70
+ }, /* @__PURE__ */ React.createElement(ScrollArea.Viewport, null, /* @__PURE__ */ React.createElement(Mosaic.Stack, {
71
+ classNames: "gap-1",
72
+ draggable: false,
77
73
  items: results,
78
- getId: (node) => node.id,
74
+ getId: (item) => item.id,
79
75
  Tile: WorkspaceTile
80
- }))))))));
76
+ })))));
81
77
  };
82
78
  var WorkspaceTile = (props) => {
83
79
  const data = props.data;
@@ -124,15 +120,17 @@ var WorkspaceTile = (props) => {
124
120
  onClick: handleSelect,
125
121
  ref: cardRef
126
122
  }, /* @__PURE__ */ React.createElement(Card.Toolbar, {
127
- density: "coarse"
123
+ density: "fine"
128
124
  }, /* @__PURE__ */ React.createElement(Avatar.Root, null, /* @__PURE__ */ React.createElement(Avatar.Content, {
129
125
  icon: data.properties.icon,
130
126
  hue: data.properties.hue,
131
127
  hueVariant: "transparent",
132
128
  variant: "square",
133
- size: 12,
129
+ size: 8,
134
130
  fallback: name
135
- }), /* @__PURE__ */ React.createElement(Avatar.Label, null, name), /* @__PURE__ */ React.createElement(Icon, {
131
+ }), /* @__PURE__ */ React.createElement(Avatar.Label, {
132
+ classNames: "cursor-pointer"
133
+ }, name), /* @__PURE__ */ React.createElement(Icon, {
136
134
  icon: "ph--caret-right--regular"
137
135
  }))));
138
136
  };
@@ -142,12 +140,18 @@ var filterItems = (node, disposition) => {
142
140
  var useItemsByDisposition = (disposition, sort = false) => {
143
141
  const { graph } = useAppGraph2();
144
142
  const connections = useConnections(graph, Node.RootId, "child");
145
- const filtered = connections.filter((node) => filterItems(node, disposition));
146
- return sort ? filtered.toSorted((a, b) => byPosition(a.properties, b.properties)) : filtered;
143
+ return useMemo(() => {
144
+ const filtered = connections.filter((node) => filterItems(node, disposition));
145
+ return sort ? filtered.toSorted((a, b) => byPosition(a.properties, b.properties)) : filtered;
146
+ }, [
147
+ connections,
148
+ disposition,
149
+ sort
150
+ ]);
147
151
  };
148
152
 
149
153
  // src/components/SimpleLayout/SimpleLayout.tsx
150
- import React11, { useEffect as useEffect6, useRef as useRef4, useState as useState3 } from "react";
154
+ import React12, { useLayoutEffect as useLayoutEffect2, useRef as useRef5, useState as useState3 } from "react";
151
155
  import { Splitter } from "@dxos/react-ui";
152
156
  import { Mosaic as Mosaic3 } from "@dxos/react-ui-mosaic";
153
157
 
@@ -166,7 +170,7 @@ var useAppBarProps = () => {
166
170
  const stateAtom = useCapability(SimpleLayoutState);
167
171
  const state = useAtomValue(stateAtom);
168
172
  const { graph } = useAppGraph3();
169
- const { invokeSync } = useOperationInvoker2();
173
+ const { invokePromise } = useOperationInvoker2();
170
174
  const runAction = useActionRunner();
171
175
  const activeId = state.active ?? state.workspace;
172
176
  const node = useNode(graph, activeId);
@@ -192,7 +196,7 @@ var useAppBarProps = () => {
192
196
  const settingsAction = {
193
197
  id: `appbar-settings-${alternateTreeNode.id}`,
194
198
  type: Node2.ActionType,
195
- data: () => Effect.sync(() => invokeSync(LayoutOperation2.Open, {
199
+ data: () => Effect.promise(() => invokePromise(LayoutOperation2.Open, {
196
200
  subject: [
197
201
  alternateTreeNode.id
198
202
  ]
@@ -222,24 +226,24 @@ var useAppBarProps = () => {
222
226
  if (state.active) {
223
227
  const isWorkspace = Graph2.getNode(graph, state.active).pipe(Option.map((node2) => node2.properties.disposition === "workspace"), Option.getOrElse(() => false));
224
228
  if (state.history.length === 0 && isWorkspace) {
225
- invokeSync(LayoutOperation2.SwitchWorkspace, {
229
+ void invokePromise(LayoutOperation2.SwitchWorkspace, {
226
230
  subject: Node2.RootId
227
231
  });
228
232
  } else {
229
- invokeSync(LayoutOperation2.Close, {
233
+ void invokePromise(LayoutOperation2.Close, {
230
234
  subject: [
231
235
  state.active
232
236
  ]
233
237
  });
234
238
  }
235
239
  } else {
236
- invokeSync(LayoutOperation2.SwitchWorkspace, {
240
+ void invokePromise(LayoutOperation2.SwitchWorkspace, {
237
241
  subject: Node2.RootId
238
242
  });
239
243
  }
240
244
  }, [
241
245
  graph,
242
- invokeSync,
246
+ invokePromise,
243
247
  state.active,
244
248
  state.history.length
245
249
  ]);
@@ -329,18 +333,63 @@ import { Node as Node4, useActionRunner as useActionRunner2 } from "@dxos/plugin
329
333
  import { useTranslation as useTranslation6 } from "@dxos/react-ui";
330
334
  import { createGapSeparator } from "@dxos/react-ui-menu";
331
335
 
332
- // src/components/ContentLoading/ContentLoading.tsx
333
- import React2 from "react";
334
- var ContentLoading = () => {
335
- return /* @__PURE__ */ React2.createElement("div", {
336
+ // src/components/DebugOverlay/DebugOverlay.tsx
337
+ import { createContext } from "@radix-ui/react-context";
338
+ import React2, { useCallback as useCallback3, useRef as useRef2 } from "react";
339
+ var DEBUG_OVERLAY_NAME = "DebugOverlay";
340
+ var [DebugOverlayProvider, useDebugLog] = createContext(DEBUG_OVERLAY_NAME, {
341
+ dbg: () => {
342
+ }
343
+ });
344
+ var DebugOverlayRoot = ({ children, enabled = true, maxLines = 10 }) => {
345
+ const overlayRef = useRef2(null);
346
+ const dbg = useCallback3((msg) => {
347
+ if (!overlayRef.current) {
348
+ return;
349
+ }
350
+ const line = document.createElement("pre");
351
+ line.textContent = `${(performance.now() / 1e3).toFixed(2).padStart(8, " ")} ${msg}`;
352
+ overlayRef.current.prepend(line);
353
+ while (overlayRef.current.children.length > maxLines) {
354
+ overlayRef.current.lastChild?.remove();
355
+ }
356
+ }, []);
357
+ return /* @__PURE__ */ React2.createElement(DebugOverlayProvider, {
358
+ dbg
359
+ }, children, enabled && /* @__PURE__ */ React2.createElement("div", {
360
+ ref: overlayRef,
361
+ style: {
362
+ position: "fixed",
363
+ bottom: "calc(var(--kb-height, 0px) + 8px)",
364
+ left: 8,
365
+ right: 8,
366
+ background: "rgba(0,0,0,0.8)",
367
+ color: "#0f0",
368
+ fontSize: 10,
369
+ fontFamily: "monospace",
370
+ padding: 6,
371
+ borderRadius: 4,
372
+ zIndex: 9999,
373
+ pointerEvents: "none"
374
+ }
375
+ }));
376
+ };
377
+ var DebugOverlay = {
378
+ Root: DebugOverlayRoot
379
+ };
380
+
381
+ // src/components/Loading/Loading.tsx
382
+ import React3 from "react";
383
+ var Loading = () => {
384
+ return /* @__PURE__ */ React3.createElement("div", {
336
385
  role: "none",
337
386
  className: "grid place-items-center dx-attention-surface"
338
387
  });
339
388
  };
340
389
 
341
390
  // src/components/MobileLayout/MobileLayout.tsx
342
- import { createContext } from "@radix-ui/react-context";
343
- import React3, { forwardRef, useEffect as useEffect3, useState } from "react";
391
+ import { createContext as createContext2 } from "@radix-ui/react-context";
392
+ import React4, { forwardRef, useEffect as useEffect3, useLayoutEffect, useState } from "react";
344
393
  import { addEventListener, combine } from "@dxos/async";
345
394
  import { log } from "@dxos/log";
346
395
  import { mx as mx2 } from "@dxos/ui-theme";
@@ -348,38 +397,38 @@ var __dxlog_file = "/__w/dxos/dxos/packages/plugins/plugin-simple-layout/src/com
348
397
  var MOBILE_LAYOUT_NAME = "MobileLayout";
349
398
  var MOBILE_LAYOUT_ROOT_NAME = "MobileLayout.Root";
350
399
  var MOBILE_LAYOUT_PANEL_NAME = "MobileLayout.Panel";
351
- var [MobileLayoutProvider, useMobileLayout] = createContext(MOBILE_LAYOUT_NAME);
352
- var MobileLayoutRoot = /* @__PURE__ */ forwardRef(({ classNames, children, transition = 250, onKeyboardOpenChange, ...props }, forwardedRef) => {
400
+ var [MobileLayoutProvider, useMobileLayout] = createContext2(MOBILE_LAYOUT_NAME);
401
+ var MobileLayoutRoot = /* @__PURE__ */ forwardRef(({ classNames, children, transition = 500, onKeyboardOpenChange, ...props }, forwardedRef) => {
353
402
  const { open: keyboardOpen } = useIOSKeyboard();
403
+ useLockBodyScroll(keyboardOpen);
354
404
  useAutoScroll();
355
- useEffect3(() => onKeyboardOpenChange?.(keyboardOpen), [
356
- onKeyboardOpenChange,
357
- keyboardOpen
405
+ useLayoutEffect(() => onKeyboardOpenChange?.(keyboardOpen), [
406
+ keyboardOpen,
407
+ onKeyboardOpenChange
358
408
  ]);
359
- useLockBodyScroll(keyboardOpen);
360
- return /* @__PURE__ */ React3.createElement(MobileLayoutProvider, {
409
+ return /* @__PURE__ */ React4.createElement(MobileLayoutProvider, {
361
410
  keyboardOpen
362
- }, /* @__PURE__ */ React3.createElement("div", {
411
+ }, /* @__PURE__ */ React4.createElement("div", {
363
412
  ...props,
364
413
  role: "none",
365
414
  style: {
366
- transition: `h-size ${transition}ms ease-out`,
367
- blockSize: "calc(100vh - var(--kb-height, 0px))"
415
+ height: "calc(100vh - var(--kb-height, 0px))",
416
+ transition: `height ${keyboardOpen ? 0 : transition}ms ease-out`
368
417
  },
369
- className: mx2("absolute top-0 left-0 right-0 flex flex-col", classNames),
418
+ className: mx2("fixed top-0 left-0 right-0 grid overflow-hidden", classNames),
370
419
  ref: forwardedRef
371
420
  }, children));
372
421
  });
373
422
  MobileLayoutRoot.displayName = MOBILE_LAYOUT_ROOT_NAME;
374
423
  var MobileLayoutPanel = /* @__PURE__ */ forwardRef(({ classNames, children, safe, ...props }, forwardedRef) => {
375
- return /* @__PURE__ */ React3.createElement("div", {
424
+ return /* @__PURE__ */ React4.createElement("div", {
376
425
  ...props,
377
426
  role: "none",
378
427
  style: {
379
428
  paddingTop: safe?.top ? "env(safe-area-inset-top)" : void 0,
380
429
  paddingBottom: safe?.bottom ? `calc((1 - var(--kb-open, 0)) * env(safe-area-inset-bottom))` : void 0
381
430
  },
382
- className: mx2("relative h-full flex flex-col overflow-hidden", classNames),
431
+ className: mx2(classNames),
383
432
  ref: forwardedRef
384
433
  }, children);
385
434
  });
@@ -389,30 +438,51 @@ var MobileLayout = {
389
438
  Panel: MobileLayoutPanel
390
439
  };
391
440
  var useAutoScroll = () => {
441
+ const { dbg } = useDebugLog("useAutoScroll");
392
442
  useEffect3(() => {
393
- return addEventListener(
394
- document,
395
- "focus",
396
- (event) => {
397
- const target = event.target;
398
- if (target.tagName === "INPUT" || target.tagName === "TEXTAREA" || target.tagName === "DIV" && target.isContentEditable) {
399
- event.preventDefault();
400
- target.focus({
401
- preventScroll: true
402
- });
403
- const scrollX = window.scrollX;
404
- const scrollY = window.scrollY;
405
- requestAnimationFrame(() => {
406
- window.scrollTo(scrollX, scrollY);
407
- });
408
- }
443
+ const resetScroll = () => {
444
+ if (window.scrollX !== 0 || window.scrollY !== 0) {
445
+ window.scrollTo(0, 0);
446
+ }
447
+ };
448
+ const detectContainerScroll = (event) => {
449
+ const el = event.target;
450
+ if (el === document.documentElement || el === document.body) {
451
+ return;
452
+ }
453
+ dbg(`scroll: ${el.tagName}.${Array.from(el.classList).slice(0, 2).join(".")} top=${el.scrollTop.toFixed(0)}`);
454
+ };
455
+ return combine(
456
+ addEventListener(window, "scroll", resetScroll),
457
+ window.visualViewport ? addEventListener(window.visualViewport, "scroll", resetScroll) : () => {
409
458
  },
410
- // Important: focus events don't bubble, so capture phase is required.
411
- {
459
+ // TODO(burdon): Remove debug logging.
460
+ addEventListener(document, "scroll", detectContainerScroll, {
412
461
  capture: true
413
- }
462
+ }),
463
+ // Prevent focus-triggered scroll-into-view on inputs.
464
+ (() => {
465
+ let focusingWithPreventScroll = false;
466
+ return addEventListener(document, "focus", (event) => {
467
+ if (focusingWithPreventScroll) {
468
+ return;
469
+ }
470
+ const target = event.target;
471
+ if (target.tagName === "INPUT" || target.tagName === "TEXTAREA" || target.isContentEditable) {
472
+ focusingWithPreventScroll = true;
473
+ target.focus({
474
+ preventScroll: true
475
+ });
476
+ focusingWithPreventScroll = false;
477
+ }
478
+ }, {
479
+ capture: true
480
+ });
481
+ })()
414
482
  );
415
- }, []);
483
+ }, [
484
+ dbg
485
+ ]);
416
486
  };
417
487
  var useLockBodyScroll = (enabled) => {
418
488
  useEffect3(() => {
@@ -465,17 +535,20 @@ var useLockBodyScroll = (enabled) => {
465
535
  ]);
466
536
  };
467
537
  var useIOSKeyboard = () => {
538
+ const { dbg } = useDebugLog("useIOSKeyboard");
468
539
  const [open, setOpen] = useState(false);
469
540
  const [height, setHeight] = useState(0);
541
+ const [duration, setDuration] = useState(void 0);
470
542
  useEffect3(() => {
471
543
  const viewport = window.visualViewport;
472
544
  if (!viewport) {
473
545
  return;
474
546
  }
475
547
  const initialHeight = viewport.height ?? window.innerHeight;
476
- const updateState = (keyboardHeight, keyboardOpen) => {
548
+ const updateState = (keyboardHeight, keyboardOpen, animationDuration) => {
477
549
  setOpen(keyboardOpen);
478
550
  setHeight(keyboardHeight);
551
+ setDuration(animationDuration);
479
552
  const vvh = initialHeight - keyboardHeight;
480
553
  document.documentElement.style.setProperty("--vvh", `${vvh}px`);
481
554
  document.documentElement.style.setProperty("--kb-height", `${keyboardHeight}px`);
@@ -484,52 +557,84 @@ var useIOSKeyboard = () => {
484
557
  initialHeight,
485
558
  vvh,
486
559
  keyboardHeight,
487
- keyboardOpen
560
+ keyboardOpen,
561
+ animationDuration
488
562
  }, {
489
563
  F: __dxlog_file,
490
- L: 287,
564
+ L: 318,
491
565
  S: void 0,
492
566
  C: (f, a) => f(...a)
493
567
  });
494
568
  };
569
+ let rafId;
495
570
  return combine(
496
571
  // Handler for native iOS keyboard events (from KeyboardObserver.swift).
497
572
  addEventListener(window, "keyboard", (event) => {
498
- const { type, height: height2 } = event.detail;
573
+ const { type, height: height2, duration: duration2 } = event.detail;
574
+ const durationMs = duration2 < 1 ? duration2 * 1e3 : duration2;
575
+ const vp = window.visualViewport;
576
+ dbg(`kb:${type} h=${height2} dur=${duration2} scrollY=${window.scrollY} vpOffset=${vp?.offsetTop?.toFixed(0) ?? "?"}`);
499
577
  log.info("keyboard event", {
500
578
  type,
501
- height: height2
579
+ height: height2,
580
+ duration: duration2
502
581
  }, {
503
582
  F: __dxlog_file,
504
- L: 297,
583
+ L: 338,
505
584
  S: void 0,
506
585
  C: (f, a) => f(...a)
507
586
  });
508
- updateState(height2, type === "show");
509
- })
587
+ updateState(height2, type === "show", durationMs);
588
+ const end = performance.now() + durationMs + 300;
589
+ let prevOffsetTop = vp?.offsetTop ?? 0;
590
+ let prevScrollY = window.scrollY;
591
+ const monitorFrame = () => {
592
+ const offsetTop = vp?.offsetTop ?? 0;
593
+ const scrollY = window.scrollY;
594
+ if (offsetTop !== prevOffsetTop || scrollY !== prevScrollY) {
595
+ dbg(`\u0394 vpOffset=${offsetTop.toFixed(0)} scrollY=${scrollY.toFixed(0)}`);
596
+ prevOffsetTop = offsetTop;
597
+ prevScrollY = scrollY;
598
+ }
599
+ if (scrollY !== 0) {
600
+ window.scrollTo(0, 0);
601
+ }
602
+ if (performance.now() < end) {
603
+ rafId = requestAnimationFrame(monitorFrame);
604
+ }
605
+ };
606
+ rafId = requestAnimationFrame(monitorFrame);
607
+ }),
608
+ () => {
609
+ if (rafId !== void 0) {
610
+ cancelAnimationFrame(rafId);
611
+ }
612
+ }
510
613
  );
511
- }, []);
614
+ }, [
615
+ dbg
616
+ ]);
512
617
  return {
513
618
  open,
514
- height
619
+ height,
620
+ duration
515
621
  };
516
622
  };
517
623
 
518
624
  // src/components/Popover/Popover.tsx
519
- import { createContext as createContext2 } from "@radix-ui/react-context";
520
- import React4, { useCallback as useCallback3, useEffect as useEffect4, useMemo as useMemo4, useRef as useRef2, useState as useState2 } from "react";
625
+ import { createContext as createContext3 } from "@radix-ui/react-context";
626
+ import React5, { useCallback as useCallback4, useEffect as useEffect4, useMemo as useMemo4, useRef as useRef3, useState as useState2 } from "react";
521
627
  import { Surface } from "@dxos/app-framework/ui";
522
- import { useObjectNavigate } from "@dxos/app-toolkit/ui";
523
628
  import { Popover, toLocalizedString as toLocalizedString3, useTranslation as useTranslation3 } from "@dxos/react-ui";
524
629
  import { Card as Card2 } from "@dxos/react-ui";
525
630
  var DEBOUNCE_DELAY = 40;
526
- var [LayoutPopoverProvider, useLayoutPopoverContext] = createContext2("LayoutPopover");
631
+ var [LayoutPopoverProvider, useLayoutPopoverContext] = createContext3("LayoutPopover");
527
632
  var PopoverRoot = ({ children }) => {
528
633
  const { state } = useSimpleLayoutState();
529
634
  const [open, setOpen] = useState2(false);
530
- const virtualRef = useRef2(null);
635
+ const virtualRef = useRef3(null);
531
636
  const [virtualIter, setVirtualIter] = useState2(0);
532
- const debounceRef = useRef2(null);
637
+ const debounceRef = useRef3(null);
533
638
  useEffect4(() => {
534
639
  setOpen(false);
535
640
  if (state.popoverOpen) {
@@ -548,23 +653,21 @@ var PopoverRoot = ({ children }) => {
548
653
  state.popoverAnchor,
549
654
  state.popoverContent
550
655
  ]);
551
- return /* @__PURE__ */ React4.createElement(LayoutPopoverProvider, {
656
+ return /* @__PURE__ */ React5.createElement(LayoutPopoverProvider, {
552
657
  setOpen
553
- }, /* @__PURE__ */ React4.createElement(Popover.Root, {
658
+ }, /* @__PURE__ */ React5.createElement(Popover.Root, {
554
659
  modal: false,
555
660
  open
556
- }, state.popoverAnchor && /* @__PURE__ */ React4.createElement(Popover.VirtualTrigger, {
661
+ }, state.popoverAnchor && /* @__PURE__ */ React5.createElement(Popover.VirtualTrigger, {
557
662
  key: virtualIter,
558
663
  virtualRef
559
664
  }), children));
560
665
  };
561
- var getPopoverSubject = (content) => content && typeof content === "object" && "subject" in content ? content.subject : content;
562
666
  var PopoverContent = () => {
563
667
  const { t } = useTranslation3(meta.id);
564
668
  const { state, updateState } = useSimpleLayoutState();
565
669
  const { setOpen } = useLayoutPopoverContext("PopoverContent");
566
- const handleNavigate = useObjectNavigate(getPopoverSubject(state.popoverContent));
567
- const handleClose = useCallback3(() => {
670
+ const handleClose = useCallback4(() => {
568
671
  setOpen(false);
569
672
  updateState((s) => ({
570
673
  ...s,
@@ -577,7 +680,7 @@ var PopoverContent = () => {
577
680
  setOpen,
578
681
  updateState
579
682
  ]);
580
- const handleInteractOutside = useCallback3((event) => {
683
+ const handleInteractOutside = useCallback4((event) => {
581
684
  if (
582
685
  // TODO(thure): CodeMirror should not focus itself when it updates.
583
686
  event.type === "dismissableLayer.focusOutside" && event.currentTarget?.classList.contains("cm-content")
@@ -597,41 +700,39 @@ var PopoverContent = () => {
597
700
  }, [
598
701
  state.popoverAnchor
599
702
  ]);
600
- return /* @__PURE__ */ React4.createElement(Popover.Portal, null, /* @__PURE__ */ React4.createElement(Popover.Content, {
703
+ return /* @__PURE__ */ React5.createElement(Popover.Portal, null, /* @__PURE__ */ React5.createElement(Popover.Content, {
601
704
  side: state.popoverSide,
602
705
  sticky: "always",
603
706
  hideWhenDetached: true,
604
707
  collisionBoundary: collisionBoundaries,
605
708
  onInteractOutside: handleInteractOutside,
606
709
  onEscapeKeyDown: handleInteractOutside
607
- }, /* @__PURE__ */ React4.createElement(Popover.Viewport, null, state.popoverKind === "base" && /* @__PURE__ */ React4.createElement(Surface.Surface, {
710
+ }, /* @__PURE__ */ React5.createElement(Popover.Viewport, null, state.popoverKind === "base" && /* @__PURE__ */ React5.createElement(Surface.Surface, {
608
711
  role: "popover",
609
712
  data: state.popoverContent,
610
713
  limit: 1
611
- }), state.popoverKind === "card" && /* @__PURE__ */ React4.createElement(Card2.Root, {
714
+ }), state.popoverKind === "card" && /* @__PURE__ */ React5.createElement(Card2.Root, {
612
715
  border: false,
613
716
  classNames: "dx-card-popover"
614
- }, /* @__PURE__ */ React4.createElement(Card2.Toolbar, null, /* @__PURE__ */ React4.createElement("span", null), state.popoverTitle ? /* @__PURE__ */ React4.createElement(Card2.Title, {
615
- onClick: handleNavigate
616
- }, toLocalizedString3(state.popoverTitle, t)) : /* @__PURE__ */ React4.createElement("span", null), /* @__PURE__ */ React4.createElement(Card2.CloseIconButton, {
717
+ }, /* @__PURE__ */ React5.createElement(Card2.Toolbar, null, /* @__PURE__ */ React5.createElement("span", null), state.popoverTitle ? /* @__PURE__ */ React5.createElement(Card2.Title, null, toLocalizedString3(state.popoverTitle, t)) : /* @__PURE__ */ React5.createElement("span", null), /* @__PURE__ */ React5.createElement(Card2.CloseIconButton, {
617
718
  onClick: handleClose
618
- })), /* @__PURE__ */ React4.createElement(Surface.Surface, {
719
+ })), /* @__PURE__ */ React5.createElement(Surface.Surface, {
619
720
  role: "card--content",
620
721
  data: state.popoverContent,
621
722
  limit: 1
622
- }))), /* @__PURE__ */ React4.createElement(Popover.Arrow, null)));
723
+ }))), /* @__PURE__ */ React5.createElement(Popover.Arrow, null)));
623
724
  };
624
725
 
625
726
  // src/components/SimpleLayout/AppBar.tsx
626
727
  import { useAtomValue as useAtomValue2 } from "@effect-atom/atom-react";
627
- import React5, { Fragment } from "react";
628
- import { IconButton, Popover as Popover2, Toolbar as Toolbar2, useTranslation as useTranslation4 } from "@dxos/react-ui";
728
+ import React6, { Fragment } from "react";
729
+ import { IconButton, Popover as Popover2, Toolbar, useTranslation as useTranslation4 } from "@dxos/react-ui";
629
730
  import { Menu, useMenuActions } from "@dxos/react-ui-menu";
630
- import { mx as mx3, osTranslations } from "@dxos/ui-theme";
731
+ import { composable, composableProps, osTranslations } from "@dxos/ui-theme";
631
732
  var APP_BAR_NAME = "SimpleLayout.AppBar";
632
- var AppBar = ({ classNames, title, actions, showBackButton, popoverAnchorId, onAction, onBack }) => {
733
+ var AppBar = composable(({ classNames, title, actions, showBackButton, popoverAnchorId, onAction, onBack, ...props }, forwardedRef) => {
633
734
  const { t } = useTranslation4(meta.id);
634
- const menu = useMenuActions(actions);
735
+ const menuActions = useMenuActions(actions);
635
736
  const actionsValue = useAtomValue2(actions);
636
737
  const hasActions = actionsValue.nodes.length > 0;
637
738
  const { keyboardOpen } = useMobileLayout(APP_BAR_NAME);
@@ -639,62 +740,64 @@ var AppBar = ({ classNames, title, actions, showBackButton, popoverAnchorId, onA
639
740
  ns: osTranslations
640
741
  });
641
742
  const AnchorRoot = popoverAnchorId ? Popover2.Anchor : Fragment;
642
- return /* @__PURE__ */ React5.createElement(Toolbar2.Root, {
643
- role: "banner",
644
- classNames: mx3("grid grid-cols-[var(--dx-rail-size)_1fr_var(--dx-rail-size)] items-center", "dx-density-fine", classNames)
645
- }, keyboardOpen ? /* @__PURE__ */ React5.createElement(IconButton, {
743
+ return /* @__PURE__ */ React6.createElement(Toolbar.Root, {
744
+ ...composableProps(props, {
745
+ role: "banner",
746
+ classNames: "grid grid-cols-[var(--dx-rail-size)_1fr_var(--dx-rail-size)] items-center dx-density-fine"
747
+ }),
748
+ ref: forwardedRef
749
+ }, keyboardOpen ? /* @__PURE__ */ React6.createElement(IconButton, {
646
750
  variant: "ghost",
647
751
  icon: "ph--x--regular",
648
752
  iconOnly: true,
649
753
  label: t("done label")
650
- }) : showBackButton ? /* @__PURE__ */ React5.createElement(IconButton, {
754
+ }) : showBackButton ? /* @__PURE__ */ React6.createElement(IconButton, {
651
755
  variant: "ghost",
652
756
  icon: "ph--caret-left--regular",
653
757
  iconOnly: true,
654
758
  label: t("back label"),
655
759
  onClick: onBack
656
- }) : /* @__PURE__ */ React5.createElement("div", null), /* @__PURE__ */ React5.createElement("h1", {
760
+ }) : /* @__PURE__ */ React6.createElement("div", null), /* @__PURE__ */ React6.createElement("h1", {
657
761
  className: "text-center truncate font-thin uppercase"
658
- }, displayTitle), hasActions ? /* @__PURE__ */ React5.createElement(AnchorRoot, null, /* @__PURE__ */ React5.createElement(Menu.Root, {
659
- ...menu,
762
+ }, displayTitle), hasActions ? /* @__PURE__ */ React6.createElement(AnchorRoot, null, /* @__PURE__ */ React6.createElement(Menu.Root, {
763
+ ...menuActions,
660
764
  caller: meta.id,
661
765
  onAction
662
- }, /* @__PURE__ */ React5.createElement(Menu.Trigger, {
766
+ }, /* @__PURE__ */ React6.createElement(Menu.Trigger, {
663
767
  asChild: true
664
- }, /* @__PURE__ */ React5.createElement(IconButton, {
768
+ }, /* @__PURE__ */ React6.createElement(IconButton, {
665
769
  variant: "ghost",
666
770
  icon: "ph--dots-three-vertical--regular",
667
771
  iconOnly: true,
668
772
  label: t("actions menu label")
669
- })), /* @__PURE__ */ React5.createElement(Menu.Content, null))) : /* @__PURE__ */ React5.createElement("span", null));
670
- };
773
+ })), /* @__PURE__ */ React6.createElement(Menu.Content, null))) : /* @__PURE__ */ React6.createElement("span", null));
774
+ });
671
775
  AppBar.displayName = APP_BAR_NAME;
672
776
 
673
777
  // src/components/SimpleLayout/Main.tsx
674
- import React7, { useMemo as useMemo5 } from "react";
778
+ import React8, { useMemo as useMemo5 } from "react";
675
779
  import { Surface as Surface2 } from "@dxos/app-framework/ui";
676
780
  import { useAppGraph as useAppGraph5 } from "@dxos/app-toolkit/ui";
677
781
  import { useNode as useNode2 } from "@dxos/plugin-graph";
678
- import { ErrorFallback } from "@dxos/react-ui";
782
+ import { ErrorFallback, Panel } from "@dxos/react-ui";
679
783
  import { useAttentionAttributes } from "@dxos/react-ui-attention";
680
- import { mx as mx5 } from "@dxos/ui-theme";
681
784
 
682
785
  // src/components/SimpleLayout/NavBar.tsx
683
- import React6 from "react";
786
+ import React7 from "react";
684
787
  import { Menu as Menu2, useMenuActions as useMenuActions2 } from "@dxos/react-ui-menu";
685
- import { mx as mx4 } from "@dxos/ui-theme";
788
+ import { composable as composable2, composableProps as composableProps2 } from "@dxos/ui-theme";
686
789
  var NAVBAR_NAME = "SimpleLayout.NavBar";
687
- var NavBar = ({ classNames, actions, onAction }) => {
688
- const menu = useMenuActions2(actions);
689
- return /* @__PURE__ */ React6.createElement(Menu2.Root, {
690
- ...menu,
790
+ var NavBar = composable2(({ actions, onAction, ...props }, forwardedRef) => {
791
+ const menuActions = useMenuActions2(actions);
792
+ return /* @__PURE__ */ React7.createElement(Menu2.Root, {
793
+ ...menuActions,
691
794
  alwaysActive: true,
692
795
  onAction
693
- }, /* @__PURE__ */ React6.createElement(Menu2.Toolbar, {
694
- density: "coarse",
695
- classNames: mx4(classNames)
796
+ }, /* @__PURE__ */ React7.createElement(Menu2.Toolbar, {
797
+ ...composableProps2(props),
798
+ ref: forwardedRef
696
799
  }));
697
- };
800
+ });
698
801
  NavBar.displayName = NAVBAR_NAME;
699
802
 
700
803
  // src/components/SimpleLayout/Main.tsx
@@ -706,7 +809,7 @@ var Main = () => {
706
809
  const { keyboardOpen } = useMobileLayout(MAIN_NAME);
707
810
  const { actions, onAction } = useNavbarActions();
708
811
  const appBarProps = useAppBarProps();
709
- const placeholder = useMemo5(() => /* @__PURE__ */ React7.createElement(ContentLoading, null), []);
812
+ const placeholder = useMemo5(() => /* @__PURE__ */ React8.createElement(Loading, null), []);
710
813
  const { graph } = useAppGraph5();
711
814
  const node = useNode2(graph, id);
712
815
  const data = useMemo5(() => {
@@ -725,85 +828,83 @@ var Main = () => {
725
828
  ]);
726
829
  useExpandPath(id);
727
830
  const showNavBar = !keyboardOpen && !state.isPopover && state.drawerState === "closed";
728
- return /* @__PURE__ */ React7.createElement("div", {
729
- role: "none",
730
- className: mx5("h-full grid overflow-hidden bg-toolbar-surface", showNavBar ? "grid-rows-[var(--dx-rail-action)_1fr_var(--dx-toolbar-size)]" : "grid-rows-[var(--dx-rail-action)_1fr]"),
731
- ...attentionAttrs
732
- }, /* @__PURE__ */ React7.createElement(AppBar, appBarProps), /* @__PURE__ */ React7.createElement("article", {
733
- className: "h-full overflow-hidden bg-base-surface"
734
- }, /* @__PURE__ */ React7.createElement(Surface2.Surface, {
831
+ return /* @__PURE__ */ React8.createElement(Panel.Root, {
832
+ ...attentionAttrs,
833
+ className: "dx-document"
834
+ }, /* @__PURE__ */ React8.createElement(Panel.Toolbar, {
835
+ asChild: true
836
+ }, /* @__PURE__ */ React8.createElement(AppBar, appBarProps)), /* @__PURE__ */ React8.createElement(Panel.Content, {
837
+ role: "article",
838
+ className: "bg-base-surface"
839
+ }, /* @__PURE__ */ React8.createElement(Surface2.Surface, {
735
840
  key: id,
736
841
  role: "article",
737
842
  data,
738
843
  limit: 1,
739
844
  fallback: ErrorFallback,
740
845
  placeholder
741
- })), showNavBar && /* @__PURE__ */ React7.createElement(NavBar, {
742
- classNames: "border-y border-subdued-separator",
846
+ })), showNavBar && /* @__PURE__ */ React8.createElement(Panel.Statusbar, {
847
+ asChild: true
848
+ }, /* @__PURE__ */ React8.createElement(NavBar, {
743
849
  actions,
744
850
  onAction
745
- }));
851
+ })));
746
852
  };
747
853
  Main.displayName = MAIN_NAME;
748
854
 
749
855
  // src/components/NavBranch/NavBranch.tsx
750
- import React8, { useCallback as useCallback4, useEffect as useEffect5, useMemo as useMemo6, useRef as useRef3 } from "react";
856
+ import React9, { useCallback as useCallback5, useEffect as useEffect5, useMemo as useMemo6, useRef as useRef4 } from "react";
751
857
  import { useOperationInvoker as useOperationInvoker3 } from "@dxos/app-framework/ui";
752
858
  import { LayoutOperation as LayoutOperation3 } from "@dxos/app-toolkit";
753
859
  import { useAppGraph as useAppGraph6 } from "@dxos/app-toolkit/ui";
754
860
  import { useConnections as useConnections3 } from "@dxos/plugin-graph";
755
- import { Avatar as Avatar2, Icon as Icon2, Panel as Panel2, ScrollArea as ScrollArea2, Toolbar as Toolbar3, toLocalizedString as toLocalizedString4, useTranslation as useTranslation5 } from "@dxos/react-ui";
861
+ import { Avatar as Avatar2, Icon as Icon2, ScrollArea as ScrollArea2, toLocalizedString as toLocalizedString4, useTranslation as useTranslation5 } from "@dxos/react-ui";
756
862
  import { Card as Card3 } from "@dxos/react-ui";
757
863
  import { Mosaic as Mosaic2 } from "@dxos/react-ui-mosaic";
758
- import { SearchList as SearchList2, useSearchListItem as useSearchListItem2, useSearchListResults as useSearchListResults2 } from "@dxos/react-ui-searchlist";
759
- import { mx as mx6 } from "@dxos/ui-theme";
864
+ import { SearchPanel as SearchPanel2, useSearchListItem as useSearchListItem2, useSearchListResults as useSearchListResults2 } from "@dxos/react-ui-search";
865
+ import { mx as mx3 } from "@dxos/ui-theme";
760
866
  var NavBranch = ({ id }) => {
761
867
  const { t } = useTranslation5(meta.id);
762
868
  const { graph } = useAppGraph6();
763
869
  useExpandPath(id);
764
870
  const children = useConnections3(graph, id, "child");
765
- const visibleChildren = useMemo6(() => children.filter((node) => node.properties.disposition !== "alternate-tree"), [
871
+ const visibleChildren = useMemo6(() => children.filter((node) => node.properties.disposition !== "alternate-tree" && node.properties.disposition !== "hidden"), [
766
872
  children
767
873
  ]);
768
874
  const { results, handleSearch } = useSearchListResults2({
769
875
  items: visibleChildren,
770
876
  extract: (child) => toLocalizedString4(child.properties.label, t)
771
877
  });
772
- return /* @__PURE__ */ React8.createElement(SearchList2.Root, {
878
+ return /* @__PURE__ */ React9.createElement(SearchPanel2, {
773
879
  onSearch: handleSearch
774
- }, /* @__PURE__ */ React8.createElement(Panel2.Root, null, /* @__PURE__ */ React8.createElement(Panel2.Toolbar, {
775
- asChild: true
776
- }, /* @__PURE__ */ React8.createElement(Toolbar3.Root, null, /* @__PURE__ */ React8.createElement(SearchList2.Input, {
777
- placeholder: t("search placeholder"),
778
- autoFocus: true
779
- }))), /* @__PURE__ */ React8.createElement(Panel2.Content, {
780
- asChild: true
781
- }, /* @__PURE__ */ React8.createElement(SearchList2.Content, null, /* @__PURE__ */ React8.createElement(Mosaic2.Container, {
880
+ }, /* @__PURE__ */ React9.createElement(Mosaic2.Container, {
782
881
  asChild: true
783
- }, /* @__PURE__ */ React8.createElement(ScrollArea2.Root, {
784
- orientation: "vertical"
785
- }, /* @__PURE__ */ React8.createElement(ScrollArea2.Viewport, {
786
- classNames: "p-2"
787
- }, /* @__PURE__ */ React8.createElement(Mosaic2.Stack, {
882
+ }, /* @__PURE__ */ React9.createElement(ScrollArea2.Root, {
883
+ centered: true,
884
+ padding: true,
885
+ thin: true
886
+ }, /* @__PURE__ */ React9.createElement(ScrollArea2.Viewport, null, /* @__PURE__ */ React9.createElement(Mosaic2.Stack, {
887
+ classNames: "gap-1",
888
+ draggable: false,
788
889
  items: results,
789
- getId: (child) => child.id,
890
+ getId: (item) => item.id,
790
891
  Tile: NavBranchTile
791
- }))))))));
892
+ })))));
792
893
  };
793
894
  var NavBranchTile = (props) => {
794
895
  const data = props.data;
795
896
  const { t } = useTranslation5(meta.id);
796
- const { invokeSync } = useOperationInvoker3();
797
- const ref = useRef3(null);
897
+ const { invokePromise } = useOperationInvoker3();
898
+ const ref = useRef4(null);
798
899
  const { selectedValue, registerItem, unregisterItem } = useSearchListItem2();
799
900
  const isSelected = selectedValue === data.id;
800
901
  const name = toLocalizedString4(data.properties.label, t);
801
- const handleSelect = useCallback4(() => invokeSync(LayoutOperation3.Open, {
902
+ const handleSelect = useCallback5(() => void invokePromise(LayoutOperation3.Open, {
802
903
  subject: [
803
904
  data.id
804
905
  ]
805
906
  }), [
806
- invokeSync,
907
+ invokePromise,
807
908
  data.id
808
909
  ]);
809
910
  useEffect5(() => {
@@ -827,37 +928,35 @@ var NavBranchTile = (props) => {
827
928
  }, [
828
929
  isSelected
829
930
  ]);
830
- return /* @__PURE__ */ React8.createElement(Card3.Root, {
931
+ return /* @__PURE__ */ React9.createElement(Card3.Root, {
831
932
  ref,
832
933
  role: "button",
833
934
  fullWidth: true,
834
935
  tabIndex: -1,
835
936
  "data-selected": isSelected,
836
- classNames: mx6("dx-focus-ring", isSelected && "bg-hover-overlay"),
937
+ classNames: mx3("dx-focus-ring cursor-pointer", isSelected && "bg-hover-overlay"),
837
938
  onClick: handleSelect
838
- }, /* @__PURE__ */ React8.createElement(Card3.Toolbar, {
839
- density: "coarse"
840
- }, /* @__PURE__ */ React8.createElement(Avatar2.Root, null, /* @__PURE__ */ React8.createElement(Avatar2.Content, {
939
+ }, /* @__PURE__ */ React9.createElement(Card3.Toolbar, null, /* @__PURE__ */ React9.createElement(Avatar2.Root, null, /* @__PURE__ */ React9.createElement(Avatar2.Content, {
841
940
  hue: data.properties.hue,
842
941
  icon: data.properties.icon,
843
942
  hueVariant: "transparent",
844
943
  variant: "square",
845
- size: 12,
944
+ size: 8,
846
945
  fallback: name
847
- }), /* @__PURE__ */ React8.createElement(Avatar2.Label, null, name), /* @__PURE__ */ React8.createElement(Icon2, {
946
+ }), /* @__PURE__ */ React9.createElement(Avatar2.Label, null, name), /* @__PURE__ */ React9.createElement(Icon2, {
848
947
  icon: "ph--caret-right--regular"
849
948
  }))));
850
949
  };
851
950
 
852
951
  // src/hooks/useSimpleLayoutState.ts
853
952
  import { RegistryContext, useAtomValue as useAtomValue3 } from "@effect-atom/atom-react";
854
- import { useCallback as useCallback5, useContext } from "react";
953
+ import { useCallback as useCallback6, useContext } from "react";
855
954
  import { useCapability as useCapability2 } from "@dxos/app-framework/ui";
856
955
  var useSimpleLayoutState = () => {
857
956
  const registry = useContext(RegistryContext);
858
957
  const stateAtom = useCapability2(SimpleLayoutState);
859
958
  const state = useAtomValue3(stateAtom);
860
- const updateState = useCallback5((fn) => {
959
+ const updateState = useCallback6((fn) => {
861
960
  registry.set(stateAtom, fn(registry.get(stateAtom)));
862
961
  }, [
863
962
  registry,
@@ -881,7 +980,7 @@ var useDrawerActions = (consumerName) => {
881
980
  const state = get(stateAtom);
882
981
  const { nodes, edges } = createCompanionActions(graph, stateAtom, get, {
883
982
  idPrefix: "drawer",
884
- selectedVariant: state.companionVariant,
983
+ selectedVariant: state.drawerState !== "closed" ? state.companionVariant : void 0,
885
984
  updateState
886
985
  });
887
986
  const gapSeparator = createGapSeparator("drawer-gap");
@@ -1009,7 +1108,7 @@ var useNavbarActions = () => {
1009
1108
  };
1010
1109
 
1011
1110
  // src/components/Dialog/Dialog.tsx
1012
- import React9 from "react";
1111
+ import React10 from "react";
1013
1112
  import { Surface as Surface3 } from "@dxos/app-framework/ui";
1014
1113
  import { AlertDialog, Dialog as NaturalDialog } from "@dxos/react-ui";
1015
1114
  import { ErrorFallback as ErrorFallback2 } from "@dxos/react-ui";
@@ -1017,23 +1116,23 @@ var Dialog = () => {
1017
1116
  const { state, updateState } = useSimpleLayoutState();
1018
1117
  const DialogRoot = state.dialogType === "alert" ? AlertDialog.Root : NaturalDialog.Root;
1019
1118
  const DialogOverlay = state.dialogType === "alert" ? AlertDialog.Overlay : NaturalDialog.Overlay;
1020
- return /* @__PURE__ */ React9.createElement(DialogRoot, {
1119
+ return /* @__PURE__ */ React10.createElement(DialogRoot, {
1021
1120
  modal: state.dialogBlockAlign !== "end",
1022
1121
  open: state.dialogOpen,
1023
1122
  onOpenChange: (nextOpen) => updateState((state2) => ({
1024
1123
  ...state2,
1025
1124
  dialogOpen: nextOpen
1026
1125
  }))
1027
- }, state.dialogBlockAlign === "end" ? /* @__PURE__ */ React9.createElement(Surface3.Surface, {
1126
+ }, state.dialogBlockAlign === "end" ? /* @__PURE__ */ React10.createElement(Surface3.Surface, {
1028
1127
  role: "dialog",
1029
1128
  data: state.dialogContent,
1030
1129
  limit: 1,
1031
1130
  fallback: ErrorFallback2
1032
- }) : /* @__PURE__ */ React9.createElement(DialogOverlay, {
1131
+ }) : /* @__PURE__ */ React10.createElement(DialogOverlay, {
1033
1132
  blockAlign: state.dialogBlockAlign,
1034
1133
  classNames: state.dialogOverlayClasses,
1035
1134
  style: state.dialogOverlayStyle
1036
- }, /* @__PURE__ */ React9.createElement(Surface3.Surface, {
1135
+ }, /* @__PURE__ */ React10.createElement(Surface3.Surface, {
1037
1136
  role: "dialog",
1038
1137
  data: state.dialogContent,
1039
1138
  limit: 1,
@@ -1042,18 +1141,18 @@ var Dialog = () => {
1042
1141
  };
1043
1142
 
1044
1143
  // src/components/SimpleLayout/Drawer.tsx
1045
- import React10, { useMemo as useMemo9 } from "react";
1144
+ import React11, { useMemo as useMemo9 } from "react";
1046
1145
  import { Surface as Surface4 } from "@dxos/app-framework/ui";
1047
1146
  import { getCompanionVariant as getCompanionVariant2 } from "@dxos/app-toolkit";
1048
1147
  import { useAppGraph as useAppGraph9 } from "@dxos/app-toolkit/ui";
1049
1148
  import { useNode as useNode3 } from "@dxos/plugin-graph";
1050
- import { ErrorFallback as ErrorFallback3, Panel as Panel3 } from "@dxos/react-ui";
1149
+ import { ErrorFallback as ErrorFallback3, Panel as Panel2 } from "@dxos/react-ui";
1051
1150
  import { Menu as Menu3, useMenuActions as useMenuActions3 } from "@dxos/react-ui-menu";
1052
1151
  var DRAWER_NAME = "SimpleLayout.Drawer";
1053
1152
  var Drawer = () => {
1054
1153
  const { graph } = useAppGraph9();
1055
1154
  const { state: layoutState } = useSimpleLayoutState();
1056
- const placeholder = useMemo9(() => /* @__PURE__ */ React10.createElement(ContentLoading, null), []);
1155
+ const placeholder = useMemo9(() => /* @__PURE__ */ React11.createElement(Loading, null), []);
1057
1156
  const activeId = layoutState.active ?? layoutState.workspace;
1058
1157
  const companions = useCompanions(activeId);
1059
1158
  const { companionId, variant } = useSelectedCompanion(companions, layoutState.companionVariant);
@@ -1074,16 +1173,12 @@ var Drawer = () => {
1074
1173
  variant
1075
1174
  ]);
1076
1175
  const { actions, onAction } = useDrawerActions(DRAWER_NAME);
1077
- const menu = useMenuActions3(actions);
1078
- return /* @__PURE__ */ React10.createElement(Panel3.Root, null, /* @__PURE__ */ React10.createElement(Panel3.Toolbar, null, /* @__PURE__ */ React10.createElement(Menu3.Root, {
1079
- ...menu,
1176
+ const menuActions = useMenuActions3(actions);
1177
+ return /* @__PURE__ */ React11.createElement(Panel2.Root, null, /* @__PURE__ */ React11.createElement(Panel2.Toolbar, null, /* @__PURE__ */ React11.createElement(Menu3.Root, {
1178
+ ...menuActions,
1080
1179
  alwaysActive: true,
1081
1180
  onAction
1082
- }, /* @__PURE__ */ React10.createElement(Menu3.Toolbar, {
1083
- density: "coarse"
1084
- }))), /* @__PURE__ */ React10.createElement(Panel3.Content, {
1085
- asChild: true
1086
- }, /* @__PURE__ */ React10.createElement(Surface4.Surface, {
1181
+ }, /* @__PURE__ */ React11.createElement(Menu3.Toolbar, null))), /* @__PURE__ */ React11.createElement(Panel2.Content, null, /* @__PURE__ */ React11.createElement(Surface4.Surface, {
1087
1182
  role: "article",
1088
1183
  data,
1089
1184
  limit: 1,
@@ -1122,38 +1217,36 @@ var SimpleLayout = () => {
1122
1217
  const { state } = useSimpleLayoutState();
1123
1218
  const [keyboardOpen, setKeyboardOpen] = useState3(false);
1124
1219
  const [splitterMode, setSplitterMode] = useState3("upper");
1125
- const drawerRef = useRef4(null);
1126
- useEffect6(() => {
1127
- if (keyboardOpen) {
1128
- const activeElement = document.activeElement;
1129
- const drawerHasFocus = drawerRef.current?.contains(activeElement);
1130
- setSplitterMode(drawerHasFocus ? "lower" : "upper");
1131
- } else {
1220
+ const drawerRef = useRef5(null);
1221
+ useLayoutEffect2(() => {
1222
+ if (!keyboardOpen) {
1132
1223
  setSplitterMode(state.drawerState === "closed" ? "upper" : state.drawerState === "open" ? "both" : "lower");
1133
1224
  }
1134
1225
  }, [
1135
1226
  state.drawerState,
1136
1227
  keyboardOpen
1137
1228
  ]);
1138
- return /* @__PURE__ */ React11.createElement(Mosaic3.Root, {
1139
- classNames: "contents"
1140
- }, /* @__PURE__ */ React11.createElement(MobileLayout.Root, {
1229
+ return /* @__PURE__ */ React12.createElement(DebugOverlay.Root, {
1230
+ enabled: false
1231
+ }, /* @__PURE__ */ React12.createElement(PopoverRoot, null, /* @__PURE__ */ React12.createElement(Mosaic3.Root, {
1232
+ classNames: "dx-container grid relative"
1233
+ }, /* @__PURE__ */ React12.createElement(MobileLayout.Root, {
1141
1234
  classNames: "bg-toolbar-surface",
1142
- onKeyboardOpenChange: (keyboardOpen2) => setKeyboardOpen(keyboardOpen2)
1143
- }, /* @__PURE__ */ React11.createElement(MobileLayout.Panel, {
1235
+ onKeyboardOpenChange: (nextKeyboardOpen) => setKeyboardOpen(nextKeyboardOpen)
1236
+ }, /* @__PURE__ */ React12.createElement(MobileLayout.Panel, {
1144
1237
  safe: {
1145
1238
  top: true,
1146
1239
  bottom: splitterMode === "upper"
1147
1240
  }
1148
- }, /* @__PURE__ */ React11.createElement(PopoverRoot, null, /* @__PURE__ */ React11.createElement(Splitter.Root, {
1241
+ }, /* @__PURE__ */ React12.createElement(Splitter.Root, {
1149
1242
  mode: splitterMode,
1150
1243
  ratio: 0.55
1151
- }, /* @__PURE__ */ React11.createElement(Splitter.Panel, {
1244
+ }, /* @__PURE__ */ React12.createElement(Splitter.Panel, {
1152
1245
  position: "upper"
1153
- }, /* @__PURE__ */ React11.createElement(Main, null)), /* @__PURE__ */ React11.createElement(Splitter.Panel, {
1246
+ }, /* @__PURE__ */ React12.createElement(Main, null)), /* @__PURE__ */ React12.createElement(Splitter.Panel, {
1154
1247
  position: "lower",
1155
1248
  ref: drawerRef
1156
- }, /* @__PURE__ */ React11.createElement(Drawer, null))), /* @__PURE__ */ React11.createElement(Dialog, null), /* @__PURE__ */ React11.createElement(PopoverContent, null)))));
1249
+ }, /* @__PURE__ */ React12.createElement(Drawer, null))), /* @__PURE__ */ React12.createElement(Dialog, null), /* @__PURE__ */ React12.createElement(PopoverContent, null))))));
1157
1250
  };
1158
1251
 
1159
1252
  export {
@@ -1161,4 +1254,4 @@ export {
1161
1254
  SimpleLayout,
1162
1255
  NavBranch
1163
1256
  };
1164
- //# sourceMappingURL=chunk-DCKASLMP.mjs.map
1257
+ //# sourceMappingURL=chunk-EXNDYZTP.mjs.map