@embedpdf/react 3.0.0-next.14 → 3.0.0-next.15

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 (232) hide show
  1. package/dist/AnnotationList-CkijRHet-HEFNUIZe.d.cts +877 -0
  2. package/dist/AnnotationList-CkijRHet-HEFNUIZe.d.ts +877 -0
  3. package/dist/actions.cjs +25 -5
  4. package/dist/actions.cjs.map +1 -1
  5. package/dist/actions.d.cts +18 -5
  6. package/dist/actions.d.ts +18 -5
  7. package/dist/actions.js +22 -6
  8. package/dist/actions.js.map +1 -1
  9. package/dist/anchored-DeX95xSd.d.ts +85 -0
  10. package/dist/anchored-DzN3JywS.d.cts +85 -0
  11. package/dist/anchored.cjs +71 -28
  12. package/dist/anchored.cjs.map +1 -1
  13. package/dist/anchored.d.cts +2 -45
  14. package/dist/anchored.d.ts +2 -45
  15. package/dist/anchored.js +56 -19
  16. package/dist/anchored.js.map +1 -1
  17. package/dist/annotation-B48UT2ln.d.ts +302 -0
  18. package/dist/annotation-C1ttM8Wj.js +708 -0
  19. package/dist/annotation-C1ttM8Wj.js.map +1 -0
  20. package/dist/annotation-C9dVwo9b.d.cts +302 -0
  21. package/dist/annotation-Dex5EBda.cjs +830 -0
  22. package/dist/annotation-Dex5EBda.cjs.map +1 -0
  23. package/dist/annotation.cjs +20 -784
  24. package/dist/annotation.d.cts +2 -2
  25. package/dist/annotation.d.ts +2 -2
  26. package/dist/annotation.js +2 -769
  27. package/dist/commands.cjs +68 -28
  28. package/dist/commands.cjs.map +1 -1
  29. package/dist/commands.d.cts +37 -10
  30. package/dist/commands.d.ts +37 -10
  31. package/dist/commands.js +68 -31
  32. package/dist/commands.js.map +1 -1
  33. package/dist/form-55izw0jS.js +511 -0
  34. package/dist/form-55izw0jS.js.map +1 -0
  35. package/dist/form-BNqQfGGH.cjs +548 -0
  36. package/dist/form-BNqQfGGH.cjs.map +1 -0
  37. package/dist/form.cjs +5 -5
  38. package/dist/form.d.cts +41 -2
  39. package/dist/form.d.ts +41 -2
  40. package/dist/form.js +2 -3
  41. package/dist/history.cjs +38 -0
  42. package/dist/history.cjs.map +1 -0
  43. package/dist/history.d.cts +27 -0
  44. package/dist/history.d.ts +27 -0
  45. package/dist/history.js +27 -0
  46. package/dist/history.js.map +1 -0
  47. package/dist/i18n.cjs +26 -30
  48. package/dist/i18n.cjs.map +1 -1
  49. package/dist/i18n.d.cts +24 -21
  50. package/dist/i18n.d.ts +24 -21
  51. package/dist/i18n.js +24 -31
  52. package/dist/i18n.js.map +1 -1
  53. package/dist/index.cjs +200 -57
  54. package/dist/index.d.cts +31 -32
  55. package/dist/index.d.ts +31 -32
  56. package/dist/index.js +32 -30
  57. package/dist/inert-CmBEbKCn.cjs +19 -0
  58. package/dist/inert-CmBEbKCn.cjs.map +1 -0
  59. package/dist/inert-D8fkennb.js +14 -0
  60. package/dist/inert-D8fkennb.js.map +1 -0
  61. package/dist/interaction.cjs +48 -102
  62. package/dist/interaction.cjs.map +1 -1
  63. package/dist/interaction.d.cts +23 -32
  64. package/dist/interaction.d.ts +23 -32
  65. package/dist/interaction.js +33 -102
  66. package/dist/interaction.js.map +1 -1
  67. package/dist/link.cjs +65 -104
  68. package/dist/link.cjs.map +1 -1
  69. package/dist/link.d.cts +21 -16
  70. package/dist/link.d.ts +22 -17
  71. package/dist/link.js +67 -107
  72. package/dist/link.js.map +1 -1
  73. package/dist/measurement.cjs +36 -11
  74. package/dist/measurement.cjs.map +1 -1
  75. package/dist/measurement.d.cts +33 -7
  76. package/dist/measurement.d.ts +33 -7
  77. package/dist/measurement.js +35 -14
  78. package/dist/measurement.js.map +1 -1
  79. package/dist/metadata.cjs +20 -7
  80. package/dist/metadata.cjs.map +1 -1
  81. package/dist/metadata.d.cts +22 -7
  82. package/dist/metadata.d.ts +22 -7
  83. package/dist/metadata.js +20 -10
  84. package/dist/metadata.js.map +1 -1
  85. package/dist/page-edit.cjs +7 -3
  86. package/dist/page-edit.cjs.map +1 -1
  87. package/dist/page-edit.d.cts +6 -2
  88. package/dist/page-edit.d.ts +6 -2
  89. package/dist/page-edit.js +7 -4
  90. package/dist/page-edit.js.map +1 -1
  91. package/dist/page-layers-Bkaaz8Zf.js +26 -0
  92. package/dist/page-layers-Bkaaz8Zf.js.map +1 -0
  93. package/dist/page-layers-BloZDoOV.cjs +37 -0
  94. package/dist/page-layers-BloZDoOV.cjs.map +1 -0
  95. package/dist/page-view.cjs +89 -82
  96. package/dist/page-view.cjs.map +1 -1
  97. package/dist/page-view.d.cts +14 -7
  98. package/dist/page-view.d.ts +18 -11
  99. package/dist/page-view.js +86 -81
  100. package/dist/page-view.js.map +1 -1
  101. package/dist/redaction.cjs +30 -15
  102. package/dist/redaction.cjs.map +1 -1
  103. package/dist/redaction.d.cts +27 -9
  104. package/dist/redaction.d.ts +27 -9
  105. package/dist/redaction.js +29 -18
  106. package/dist/redaction.js.map +1 -1
  107. package/dist/render.cjs +71 -46
  108. package/dist/render.cjs.map +1 -1
  109. package/dist/render.d.cts +17 -5
  110. package/dist/render.d.ts +17 -5
  111. package/dist/render.js +70 -49
  112. package/dist/render.js.map +1 -1
  113. package/dist/runtime-B6xcPsEb.js +398 -0
  114. package/dist/runtime-B6xcPsEb.js.map +1 -0
  115. package/dist/runtime-DBEBlpQV.d.cts +237 -0
  116. package/dist/runtime-V3MVMb91.d.ts +237 -0
  117. package/dist/runtime-fzpGv78v.cjs +555 -0
  118. package/dist/runtime-fzpGv78v.cjs.map +1 -0
  119. package/dist/runtime.cjs +45 -324
  120. package/dist/runtime.d.cts +2 -2
  121. package/dist/runtime.d.ts +2 -2
  122. package/dist/runtime.js +2 -306
  123. package/dist/search.cjs +81 -50
  124. package/dist/search.cjs.map +1 -1
  125. package/dist/search.d.cts +37 -24
  126. package/dist/search.d.ts +37 -24
  127. package/dist/search.js +81 -53
  128. package/dist/search.js.map +1 -1
  129. package/dist/selection.cjs +105 -108
  130. package/dist/selection.cjs.map +1 -1
  131. package/dist/selection.d.cts +54 -26
  132. package/dist/selection.d.ts +56 -28
  133. package/dist/selection.js +103 -110
  134. package/dist/selection.js.map +1 -1
  135. package/dist/shell.cjs +36 -21
  136. package/dist/shell.cjs.map +1 -1
  137. package/dist/shell.d.cts +32 -17
  138. package/dist/shell.d.ts +32 -17
  139. package/dist/shell.js +36 -24
  140. package/dist/shell.js.map +1 -1
  141. package/dist/signature.cjs +29 -48
  142. package/dist/signature.cjs.map +1 -1
  143. package/dist/signature.d.cts +26 -26
  144. package/dist/signature.d.ts +26 -26
  145. package/dist/signature.js +30 -48
  146. package/dist/signature.js.map +1 -1
  147. package/dist/stage-BIG6aeVd.cjs +369 -0
  148. package/dist/stage-BIG6aeVd.cjs.map +1 -0
  149. package/dist/stage-ByFPD-Fv.d.cts +117 -0
  150. package/dist/stage-DaboaheR.d.ts +117 -0
  151. package/dist/stage-DoVekb83.js +302 -0
  152. package/dist/stage-DoVekb83.js.map +1 -0
  153. package/dist/stage-scope-CQgCuf1w.cjs +46 -0
  154. package/dist/stage-scope-CQgCuf1w.cjs.map +1 -0
  155. package/dist/stage-scope-D7ZeNduT.js +23 -0
  156. package/dist/stage-scope-D7ZeNduT.js.map +1 -0
  157. package/dist/stage.cjs +12 -235
  158. package/dist/stage.d.cts +2 -116
  159. package/dist/stage.d.ts +2 -116
  160. package/dist/stage.js +3 -228
  161. package/dist/stamp.cjs +41 -35
  162. package/dist/stamp.cjs.map +1 -1
  163. package/dist/stamp.d.cts +25 -18
  164. package/dist/stamp.d.ts +25 -18
  165. package/dist/stamp.js +40 -37
  166. package/dist/stamp.js.map +1 -1
  167. package/dist/state-0K1I5cM4.d.cts +29 -0
  168. package/dist/state-0K1I5cM4.d.ts +29 -0
  169. package/dist/state-CbgxhwLA.js +62 -0
  170. package/dist/state-CbgxhwLA.js.map +1 -0
  171. package/dist/state-CsfZy_Eq.cjs +73 -0
  172. package/dist/state-CsfZy_Eq.cjs.map +1 -0
  173. package/dist/svg-shapes-Dm1yTR1b.js +40 -0
  174. package/dist/svg-shapes-Dm1yTR1b.js.map +1 -0
  175. package/dist/svg-shapes-zo0GNkc9.cjs +53 -0
  176. package/dist/svg-shapes-zo0GNkc9.cjs.map +1 -0
  177. package/dist/toolbar.cjs +297 -295
  178. package/dist/toolbar.cjs.map +1 -1
  179. package/dist/toolbar.d.cts +58 -68
  180. package/dist/toolbar.d.ts +67 -77
  181. package/dist/toolbar.js +271 -293
  182. package/dist/toolbar.js.map +1 -1
  183. package/dist/view-manager.cjs +34 -0
  184. package/dist/view-manager.cjs.map +1 -0
  185. package/dist/view-manager.d.cts +21 -0
  186. package/dist/view-manager.d.ts +21 -0
  187. package/dist/view-manager.js +23 -0
  188. package/dist/view-manager.js.map +1 -0
  189. package/package.json +37 -39
  190. package/dist/annotation-BCED_p9H.d.cts +0 -160
  191. package/dist/annotation-anchors-CetwM1g7.js +0 -15
  192. package/dist/annotation-anchors-CetwM1g7.js.map +0 -1
  193. package/dist/annotation-anchors-DuYRBJLl.cjs +0 -26
  194. package/dist/annotation-anchors-DuYRBJLl.cjs.map +0 -1
  195. package/dist/annotation-hooks-BB5ZhPpf.cjs +0 -16
  196. package/dist/annotation-hooks-BB5ZhPpf.cjs.map +0 -1
  197. package/dist/annotation-hooks-Df8EmzDO.js +0 -11
  198. package/dist/annotation-hooks-Df8EmzDO.js.map +0 -1
  199. package/dist/annotation-k38KDlIZ.d.ts +0 -160
  200. package/dist/annotation-menu.cjs +0 -64
  201. package/dist/annotation-menu.cjs.map +0 -1
  202. package/dist/annotation-menu.d.cts +0 -33
  203. package/dist/annotation-menu.d.ts +0 -33
  204. package/dist/annotation-menu.js +0 -48
  205. package/dist/annotation-menu.js.map +0 -1
  206. package/dist/annotation.cjs.map +0 -1
  207. package/dist/annotation.js.map +0 -1
  208. package/dist/form-BVumS7up.cjs +0 -926
  209. package/dist/form-BVumS7up.cjs.map +0 -1
  210. package/dist/form-Bdjk0Z3T.d.cts +0 -537
  211. package/dist/form-CK3mp99m.js +0 -895
  212. package/dist/form-CK3mp99m.js.map +0 -1
  213. package/dist/form-CYRYgthn.d.ts +0 -537
  214. package/dist/rolldown-runtime-BBjsoOtd.js +0 -27
  215. package/dist/runtime-DE76hlnl.d.ts +0 -216
  216. package/dist/runtime-umHA_xHt.d.cts +0 -216
  217. package/dist/runtime.cjs.map +0 -1
  218. package/dist/runtime.js.map +0 -1
  219. package/dist/scrollbar.cjs +0 -241
  220. package/dist/scrollbar.cjs.map +0 -1
  221. package/dist/scrollbar.d.cts +0 -42
  222. package/dist/scrollbar.d.ts +0 -42
  223. package/dist/scrollbar.js +0 -213
  224. package/dist/scrollbar.js.map +0 -1
  225. package/dist/stage.cjs.map +0 -1
  226. package/dist/stage.js.map +0 -1
  227. package/dist/views.cjs +0 -35
  228. package/dist/views.cjs.map +0 -1
  229. package/dist/views.d.cts +0 -21
  230. package/dist/views.d.ts +0 -21
  231. package/dist/views.js +0 -27
  232. package/dist/views.js.map +0 -1
package/dist/toolbar.js CHANGED
@@ -1,19 +1,20 @@
1
- import "./rolldown-runtime-BBjsoOtd.js";
2
- import { useCapability, useDocumentId, useKernel, useKernelValue } from "./runtime.js";
3
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
4
- import * as React from "react";
1
+ import { b as useKernel, f as useCapability, h as useDocumentId, x as useKernelValue } from "./runtime-B6xcPsEb.js";
2
+ import { t as INERT } from "./inert-D8fkennb.js";
3
+ import { jsx, jsxs } from "react/jsx-runtime";
4
+ import { TOOLBAR_ITEM_ATTRIBUTE, attachMenuKeys, attachToolbarFocus, createToolbarLengths, focusablesIn, observeContentLength, observeLength, observeOutsidePress, paintDefault, toolbarMeasureKey } from "@embedpdf/web";
5
+ import * as React$1 from "react";
5
6
  import { useEffect, useLayoutEffect, useMemo, useReducer, useRef, useState } from "react";
6
- import { filterBar, normalizeBar, projectOverflow, projectStrip, solve } from "@embedpdf/core-ui";
7
- import { CommandsToken, resolvedCommandsEqual } from "@embedpdf/plugin-commands/contract";
8
- export * from "@embedpdf/core-ui";
7
+ import { DEFAULT_IMPORTANCE, PINNED, custom, group, groupMenuView, item, layoutToolbar, normalizeBar, sameStripGroups, stripGroupsOf } from "@embedpdf/core-ui";
8
+ import { CommandsToken } from "@embedpdf/plugin-commands/contract/host";
9
+ import { resolvedCommandsEqual, unregisteredCommand } from "@embedpdf/plugin-commands/contract";
9
10
  //#region src/toolbar.tsx
10
- const stripGroupsEqual = (a, b) => a.length === b.length && a.every((g, i) => g.id === b[i].id && g.commands.length === b[i].commands.length && g.commands.every((c, j) => resolvedCommandsEqual(c, b[i].commands[j])));
11
+ const stripGroupsEqual = (left, right) => sameStripGroups(left, right, resolvedCommandsEqual);
11
12
  const NO_STRIP_GROUPS = [];
12
13
  /**
13
14
  * The live projection of a bar through the command registry — <Toolbar>'s
14
- * un-measured sibling, for contextual strips (ChromeSchema.strips). The schema
15
- * declares what COULD appear; each command's `visible` derivation decides what
16
- * DOES; null means nothing currently applies, so `if (!view) return null` is
15
+ * un-measured sibling, for contextual strips (a bar over a selection). The schema
16
+ * declares what could appear; each command's `visible` derivation decides what
17
+ * does; null means nothing currently applies, so `if (!view) return null` is
17
18
  * the caller's entire show/hide logic. `execute` is pre-bound to this
18
19
  * subtree's document. Reads are value-equal (resolvedCommandsEqual), so
19
20
  * consumers re-render on real change, not on every store action.
@@ -22,41 +23,24 @@ function useStripView(bar) {
22
23
  const commands = useCapability(CommandsToken);
23
24
  const documentId = useDocumentId();
24
25
  const normalized = useMemo(() => bar ? normalizeBar(bar) : null, [bar]);
25
- const groups = useKernelValue(() => {
26
- if (!normalized) return NO_STRIP_GROUPS;
27
- const resolved = /* @__PURE__ */ new Map();
28
- const visible = (id) => {
29
- const cmd = commands.resolve(id, documentId ?? void 0);
30
- if (cmd) resolved.set(id, cmd);
31
- return cmd?.visible === true;
32
- };
33
- return projectStrip(normalized, visible).map((g) => ({
34
- id: g.id,
35
- labelKey: g.labelKey,
36
- commands: g.commands.map((id) => resolved.get(id))
37
- }));
38
- }, stripGroupsEqual);
26
+ const groups = useKernelValue(() => normalized ? stripGroupsOf(normalized, (id) => commands.resolveCommand(id, documentId ?? void 0)) : NO_STRIP_GROUPS, stripGroupsEqual);
39
27
  return useMemo(() => groups.length === 0 ? null : {
40
28
  groups,
41
- execute: (id) => commands.execute(id, documentId ?? void 0)
29
+ execute: (id) => void commands.execute(id, { documentId: documentId ?? void 0 })
42
30
  }, [
43
31
  groups,
44
32
  commands,
45
33
  documentId
46
34
  ]);
47
35
  }
48
- /** Report this node's border-box width under `k`, live, via ResizeObserver. */
49
- function Measured({ k, onWidth, children }) {
36
+ /** Report this node's border-box length along the toolbar under `k`, live. */
37
+ function Measured({ k, orientation, onLength, children }) {
50
38
  const ref = useRef(null);
51
- useLayoutEffect(() => {
52
- const el = ref.current;
53
- if (!el) return;
54
- const report = () => onWidth(k, el.getBoundingClientRect().width);
55
- report();
56
- const observer = new ResizeObserver(report);
57
- observer.observe(el);
58
- return () => observer.disconnect();
59
- }, [k, onWidth]);
39
+ useLayoutEffect(() => ref.current ? observeLength(ref.current, orientation, (length) => onLength(k, length)) : void 0, [
40
+ k,
41
+ orientation,
42
+ onLength
43
+ ]);
60
44
  return /* @__PURE__ */ jsx("span", {
61
45
  ref,
62
46
  style: {
@@ -70,20 +54,16 @@ function Measured({ k, onWidth, children }) {
70
54
  * The socket for an unregistered custom unit: a real `<slot>` element. Inside
71
55
  * the <embedpdf-viewer> shadow root the browser projects same-named light-DOM
72
56
  * children into it; anywhere else it just displays its fallback (the terminal
73
- * command). Measured live — the projected content lives in the HOST's world,
74
- * so its width can only be observed where it actually renders.
57
+ * command). Measured live — the projected content lives in the host's world,
58
+ * so its length can only be observed where it actually renders.
75
59
  */
76
- function NativeSlotSocket({ name, k, onWidth, children }) {
60
+ function NativeSlotSocket({ name, k, orientation, onLength, children }) {
77
61
  const ref = useRef(null);
78
- useLayoutEffect(() => {
79
- const el = ref.current;
80
- if (!el) return;
81
- const report = () => onWidth(k, el.getBoundingClientRect().width);
82
- report();
83
- const observer = new ResizeObserver(report);
84
- observer.observe(el);
85
- return () => observer.disconnect();
86
- }, [k, onWidth]);
62
+ useLayoutEffect(() => ref.current ? observeLength(ref.current, orientation, (length) => onLength(k, length)) : void 0, [
63
+ k,
64
+ orientation,
65
+ onLength
66
+ ]);
87
67
  return /* @__PURE__ */ jsx("slot", {
88
68
  ref,
89
69
  name,
@@ -95,7 +75,13 @@ function NativeSlotSocket({ name, k, onWidth, children }) {
95
75
  children
96
76
  });
97
77
  }
98
- const measureLayerStyle = {
78
+ /**
79
+ * The hidden measurement layer: a row for a horizontal toolbar, a column for a
80
+ * vertical one, and no height either way, so it never adds to the page. A
81
+ * column keeps each item at its own width, so no text wraps and changes the
82
+ * heights it reports.
83
+ */
84
+ const measureLayerStyle = (orientation) => ({
99
85
  position: "absolute",
100
86
  left: 0,
101
87
  top: 0,
@@ -104,9 +90,20 @@ const measureLayerStyle = {
104
90
  visibility: "hidden",
105
91
  pointerEvents: "none",
106
92
  display: "flex",
107
- whiteSpace: "nowrap"
108
- };
109
- const defaultRenderCommand = (cmd, variant, run) => /* @__PURE__ */ jsxs("button", {
93
+ whiteSpace: "nowrap",
94
+ ...orientation === "vertical" ? {
95
+ flexDirection: "column",
96
+ alignItems: "flex-start"
97
+ } : null
98
+ });
99
+ /** Marks the element around each item of the live row: its first focusable element is a stop. */
100
+ const TOOLBAR_ITEM = { [TOOLBAR_ITEM_ATTRIBUTE]: "" };
101
+ /** The element around an item adds no box, so the item lays out as the section's own child. */
102
+ const ITEM_STYLE = { display: "contents" };
103
+ const SURFACE = paintDefault("toolbar-surface");
104
+ const BORDER = paintDefault("toolbar-border");
105
+ const ACTIVE = paintDefault("toolbar-active");
106
+ const defaultRenderCommand = (cmd, _variant, run) => /* @__PURE__ */ jsx("button", {
110
107
  type: "button",
111
108
  onClick: run,
112
109
  disabled: !cmd.enabled,
@@ -119,20 +116,25 @@ const defaultRenderCommand = (cmd, variant, run) => /* @__PURE__ */ jsxs("button
119
116
  gap: 4,
120
117
  padding: "4px 8px",
121
118
  whiteSpace: "nowrap",
122
- background: cmd.active ? "rgba(0,0,0,0.12)" : "transparent",
123
- border: "1px solid rgba(0,0,0,0.15)",
119
+ color: "inherit",
120
+ font: "inherit",
121
+ background: cmd.active ? ACTIVE : "transparent",
122
+ border: `1px solid ${BORDER}`,
124
123
  borderRadius: 4,
125
124
  cursor: cmd.enabled ? "pointer" : "default",
126
125
  opacity: cmd.enabled ? 1 : .4
127
126
  },
128
- children: [variant === "label" ? cmd.label : cmd.icon ?? cmd.label, variant === "icon+label" ? ` ${cmd.label}` : null]
127
+ children: cmd.label
129
128
  });
130
- const defaultRenderSeparator = () => /* @__PURE__ */ jsx("span", { style: {
131
- width: 1,
132
- alignSelf: "stretch",
133
- background: "currentColor",
134
- opacity: .2
135
- } });
129
+ /** A 1px line across the toolbar: upright in a horizontal one, flat in a vertical one. */
130
+ function DefaultSeparator({ orientation }) {
131
+ return /* @__PURE__ */ jsx("span", { style: {
132
+ ...orientation === "vertical" ? { height: 1 } : { width: 1 },
133
+ alignSelf: "stretch",
134
+ background: "currentColor",
135
+ opacity: .2
136
+ } });
137
+ }
136
138
  const defaultRenderOverflowTrigger = (isOpen, toggle) => /* @__PURE__ */ jsx("button", {
137
139
  type: "button",
138
140
  onClick: toggle,
@@ -143,39 +145,64 @@ const defaultRenderOverflowTrigger = (isOpen, toggle) => /* @__PURE__ */ jsx("bu
143
145
  display: "inline-flex",
144
146
  alignItems: "center",
145
147
  padding: "4px 8px",
146
- border: "1px solid rgba(0,0,0,0.15)",
148
+ color: "inherit",
149
+ font: "inherit",
150
+ border: `1px solid ${BORDER}`,
147
151
  borderRadius: 4,
148
- background: isOpen ? "rgba(0,0,0,0.12)" : "transparent",
152
+ background: isOpen ? ACTIVE : "transparent",
149
153
  cursor: "pointer"
150
154
  },
151
155
  children: "⋯"
152
156
  });
153
- function DefaultOverflowMenu({ view }) {
157
+ /** Where a default menu opens: under a horizontal toolbar's button, beside a vertical one's. */
158
+ const menuPlacement = (orientation) => orientation === "vertical" ? {
159
+ top: 0,
160
+ insetInlineStart: "100%"
161
+ } : {
162
+ top: "100%",
163
+ insetInlineEnd: 0
164
+ };
165
+ /**
166
+ * The default menu, opened by the button beside it in the same parent: it
167
+ * closes on a press outside that parent, and takes the menu keys while open.
168
+ */
169
+ function DefaultOverflowMenu({ view, orientation }) {
170
+ const menu = useRef(null);
171
+ const close = useRef(view.close);
172
+ close.current = view.close;
173
+ useLayoutEffect(() => {
174
+ const element = menu.current;
175
+ if (!view.isOpen || !element) return;
176
+ const container = element.parentElement ?? element;
177
+ const trigger = focusablesIn(container).find((candidate) => !element.contains(candidate)) ?? null;
178
+ const stopOutside = observeOutsidePress(container, () => close.current());
179
+ const detachKeys = attachMenuKeys(element, {
180
+ trigger,
181
+ close: () => close.current()
182
+ });
183
+ return () => {
184
+ stopOutside();
185
+ detachKeys();
186
+ };
187
+ }, [view.isOpen]);
154
188
  if (!view.isOpen) return null;
155
- return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("div", {
156
- style: {
157
- position: "fixed",
158
- inset: 0,
159
- zIndex: 40
160
- },
161
- onClick: view.close
162
- }), /* @__PURE__ */ jsx("div", {
189
+ return /* @__PURE__ */ jsx("div", {
190
+ ref: menu,
163
191
  role: "menu",
164
192
  style: {
165
193
  position: "absolute",
166
- right: 0,
167
- top: "100%",
194
+ ...menuPlacement(orientation),
168
195
  zIndex: 41,
169
196
  minWidth: 200,
170
197
  padding: 4,
171
- background: "white",
172
- border: "1px solid rgba(0,0,0,0.15)",
198
+ background: SURFACE,
199
+ border: `1px solid ${BORDER}`,
173
200
  borderRadius: 6,
174
201
  boxShadow: "0 4px 16px rgba(0,0,0,0.15)"
175
202
  },
176
- children: view.sections.map((section, i) => /* @__PURE__ */ jsxs(React.Fragment, { children: [i > 0 && /* @__PURE__ */ jsx("div", { style: {
203
+ children: view.sections.map((section, i) => /* @__PURE__ */ jsxs(React$1.Fragment, { children: [i > 0 && /* @__PURE__ */ jsx("div", { style: {
177
204
  height: 1,
178
- background: "rgba(0,0,0,0.1)",
205
+ background: BORDER,
179
206
  margin: "4px 0"
180
207
  } }), section.rows.map((row) => {
181
208
  const cmd = view.resolve(row.command);
@@ -186,6 +213,7 @@ function DefaultOverflowMenu({ view }) {
186
213
  role: section.role === "radio" ? "menuitemradio" : "menuitem",
187
214
  "aria-checked": section.role === "radio" ? cmd.active : void 0,
188
215
  disabled: !cmd.enabled,
216
+ tabIndex: -1,
189
217
  onClick: () => {
190
218
  view.execute(row.command);
191
219
  if (!isSubmenu) view.close();
@@ -198,6 +226,8 @@ function DefaultOverflowMenu({ view }) {
198
226
  gap: 16,
199
227
  padding: "6px 8px",
200
228
  border: "none",
229
+ color: "inherit",
230
+ font: "inherit",
201
231
  background: "transparent",
202
232
  cursor: cmd.enabled ? "pointer" : "default",
203
233
  opacity: cmd.enabled ? 1 : .4,
@@ -206,61 +236,48 @@ function DefaultOverflowMenu({ view }) {
206
236
  children: [/* @__PURE__ */ jsxs("span", { children: [cmd.active && section.role === "radio" ? "• " : "", cmd.label] }), isSubmenu ? /* @__PURE__ */ jsx("span", { children: "▸" }) : null]
207
237
  }, row.command);
208
238
  })] }, i))
209
- })] });
239
+ });
210
240
  }
211
- function DefaultCollapsed({ view }) {
241
+ function DefaultCollapsed({ view, orientation }) {
212
242
  if (view.collapse === "select") return /* @__PURE__ */ jsx("select", {
213
- value: view.commands.find((c) => c.active)?.id ?? "",
214
- onChange: (e) => view.execute(e.target.value),
243
+ value: view.commands.find((command) => command.active)?.id ?? "",
244
+ onChange: (event) => view.execute(event.target.value),
215
245
  style: {
216
246
  padding: "4px 6px",
217
- borderRadius: 4
247
+ font: "inherit",
248
+ borderRadius: 4,
249
+ border: `1px solid ${BORDER}`,
250
+ background: SURFACE
218
251
  },
219
- children: view.commands.map((c) => /* @__PURE__ */ jsx("option", {
220
- value: c.id,
221
- disabled: !c.enabled,
222
- children: c.label
223
- }, c.id))
252
+ children: view.commands.map((command) => /* @__PURE__ */ jsx("option", {
253
+ value: command.id,
254
+ disabled: !command.enabled,
255
+ children: command.label
256
+ }, command.id))
257
+ });
258
+ return /* @__PURE__ */ jsx(CollapsedMenuButton, {
259
+ view,
260
+ orientation
224
261
  });
225
- return /* @__PURE__ */ jsx(CollapsedMenuButton, { view });
226
262
  }
227
- function CollapsedMenuButton({ view }) {
263
+ function CollapsedMenuButton({ view, orientation }) {
228
264
  const [isOpen, setOpen] = useState(false);
229
- const sections = [{
230
- labelKey: view.labelKey,
231
- role: view.role === "tabs" ? "radio" : void 0,
232
- rows: view.commands.map((c) => ({
233
- type: "command",
234
- command: c.id
235
- }))
236
- }];
237
265
  return /* @__PURE__ */ jsxs("span", {
238
266
  style: {
239
267
  position: "relative",
240
268
  display: "inline-flex"
241
269
  },
242
- children: [defaultRenderOverflowTrigger(isOpen, () => setOpen((o) => !o)), /* @__PURE__ */ jsx(DefaultOverflowMenu, { view: {
243
- sections,
244
- isOpen,
245
- close: () => setOpen(false),
246
- resolve: (id) => view.commands.find((c) => c.id === id) ?? null,
247
- execute: view.execute
248
- } })]
270
+ children: [defaultRenderOverflowTrigger(isOpen, () => setOpen((previous) => !previous)), /* @__PURE__ */ jsx(DefaultOverflowMenu, {
271
+ view: groupMenuView(view, isOpen, () => setOpen(false)),
272
+ orientation
273
+ })]
249
274
  });
250
275
  }
251
276
  /** Default shed-group disclosure: a chevron opening a radio menu of the
252
- * hidden children — v2's overflow-tabs-button, derived. */
253
- function DefaultGroupTrigger({ view }) {
277
+ * hidden children. */
278
+ function DefaultGroupTrigger({ view, orientation }) {
254
279
  const [isOpen, setOpen] = useState(false);
255
- const someActive = view.commands.some((c) => c.active);
256
- const sections = [{
257
- labelKey: view.labelKey,
258
- role: view.role === "tabs" ? "radio" : void 0,
259
- rows: view.commands.map((c) => ({
260
- type: "command",
261
- command: c.id
262
- }))
263
- }];
280
+ const someActive = view.commands.some((command) => command.active);
264
281
  return /* @__PURE__ */ jsxs("span", {
265
282
  style: {
266
283
  position: "relative",
@@ -268,7 +285,7 @@ function DefaultGroupTrigger({ view }) {
268
285
  },
269
286
  children: [/* @__PURE__ */ jsx("button", {
270
287
  type: "button",
271
- onClick: () => setOpen((o) => !o),
288
+ onClick: () => setOpen((previous) => !previous),
272
289
  "aria-haspopup": "menu",
273
290
  "aria-expanded": isOpen,
274
291
  title: "More",
@@ -276,169 +293,138 @@ function DefaultGroupTrigger({ view }) {
276
293
  display: "inline-flex",
277
294
  alignItems: "center",
278
295
  padding: "4px 6px",
279
- border: "1px solid rgba(0,0,0,0.15)",
296
+ color: "inherit",
297
+ font: "inherit",
298
+ border: `1px solid ${BORDER}`,
280
299
  borderRadius: 4,
281
- background: isOpen || someActive ? "rgba(0,0,0,0.12)" : "transparent",
300
+ background: isOpen || someActive ? ACTIVE : "transparent",
282
301
  cursor: "pointer"
283
302
  },
284
303
  children: "▾"
285
- }), /* @__PURE__ */ jsx(DefaultOverflowMenu, { view: {
286
- sections,
287
- isOpen,
288
- close: () => setOpen(false),
289
- resolve: (id) => view.commands.find((c) => c.id === id) ?? null,
290
- execute: view.execute
291
- } })]
304
+ }), /* @__PURE__ */ jsx(DefaultOverflowMenu, {
305
+ view: groupMenuView(view, isOpen, () => setOpen(false)),
306
+ orientation
307
+ })]
292
308
  });
293
309
  }
294
- const unitKey = (u, variant) => `u:${u.key}@${variant}`;
295
- const groupKey = (id) => `g:${id}`;
296
- const groupTriggerKey = (id) => `gt:${id}`;
297
- const TRIGGER_KEY = "t:";
298
- function Toolbar({ bar, gap = 8, separatorWidth = 1, className, style, renderCommand = defaultRenderCommand, renderCustom, renderCollapsed, renderGroupTrigger, renderSeparator = defaultRenderSeparator, renderOverflowTrigger = defaultRenderOverflowTrigger, renderOverflowMenu }) {
310
+ function Toolbar({ bar, orientation = "horizontal", gap = 8, separatorWidth = 1, "aria-label": ariaLabel, className, style, renderCommand = defaultRenderCommand, renderCustom, renderCollapsed, renderGroupTrigger, renderSeparator, renderOverflowTrigger = defaultRenderOverflowTrigger, renderOverflowMenu }) {
299
311
  const kernel = useKernel();
300
312
  const commands = useCapability(CommandsToken);
301
313
  const documentId = useDocumentId();
314
+ const vertical = orientation === "vertical";
302
315
  const [, force] = useReducer((x) => x + 1, 0);
303
316
  useEffect(() => kernel.subscribe(force), [kernel]);
304
317
  const containerRef = useRef(null);
305
- const [containerWidth, setContainerWidth] = useState(0);
318
+ const [containerLength, setContainerLength] = useState(0);
319
+ useLayoutEffect(() => containerRef.current ? observeContentLength(containerRef.current, orientation, setContainerLength) : void 0, [orientation]);
320
+ const [lengths] = useState(createToolbarLengths);
321
+ const [, bumpMeasureVersion] = useReducer((version) => version + 1, 0);
322
+ const onLength = useMemo(() => (key, length) => {
323
+ if (lengths.report(orientation, key, length)) bumpMeasureVersion();
324
+ }, [lengths, orientation]);
325
+ const roving = useRef(null);
306
326
  useLayoutEffect(() => {
307
- const el = containerRef.current;
308
- if (!el) return;
309
- const observer = new ResizeObserver((entries) => {
310
- const w = entries[entries.length - 1]?.contentRect.width;
311
- if (w !== void 0) setContainerWidth((prev) => Math.abs(prev - w) > .5 ? w : prev);
312
- });
313
- observer.observe(el);
314
- setContainerWidth(el.clientWidth);
315
- return () => observer.disconnect();
316
- }, []);
317
- const widthsRef = useRef(/* @__PURE__ */ new Map());
318
- const [, bumpMeasureVersion] = useReducer((x) => x + 1, 0);
319
- const onWidth = useMemo(() => (key, width) => {
320
- const prev = widthsRef.current.get(key);
321
- if (prev !== void 0 && Math.abs(prev - width) <= .5) return;
322
- widthsRef.current.set(key, width);
323
- bumpMeasureVersion();
324
- }, []);
325
- const resolveCmd = (id) => commands.resolve(id, documentId ?? void 0);
326
- const executeCmd = (id) => commands.execute(id, documentId ?? void 0);
327
- const commandOf = (u) => u.kind === "command" ? u.command : u.terminal;
328
- const visibleBar = filterBar(useMemo(() => normalizeBar(bar), [bar]), (u) => resolveCmd(commandOf(u))?.visible === true);
329
- const fit = solve(visibleBar, {
330
- unit: (key, variant) => widthsRef.current.get(`u:${key}@${variant}`),
331
- groupCollapsed: (id) => widthsRef.current.get(groupKey(id)),
332
- groupTrigger: (id) => widthsRef.current.get(groupTriggerKey(id)),
333
- overflowTrigger: widthsRef.current.get(TRIGGER_KEY) ?? 32,
334
- gap,
335
- separator: separatorWidth + gap
336
- }, containerWidth);
337
- const overflowSections = projectOverflow(visibleBar, fit, (id) => commands.menuTarget(id));
327
+ const toolbar = containerRef.current;
328
+ if (!toolbar) return;
329
+ const focus = attachToolbarFocus(toolbar, orientation);
330
+ roving.current = focus;
331
+ return () => {
332
+ focus.detach();
333
+ roving.current = null;
334
+ };
335
+ }, [orientation]);
336
+ useLayoutEffect(() => roving.current?.refresh());
337
+ const resolveCmd = (id) => commands.resolveCommand(id, documentId ?? void 0);
338
+ const executeCmd = (id) => void commands.execute(id, { documentId: documentId ?? void 0 });
339
+ const layout = layoutToolbar({
340
+ bar: useMemo(() => normalizeBar(bar), [bar]),
341
+ resolve: resolveCmd,
342
+ unregistered: unregisteredCommand,
343
+ execute: executeCmd,
344
+ menuTarget: (id) => commands.getMenuTarget(id),
345
+ metrics: lengths.metrics(orientation, gap, separatorWidth),
346
+ measureKey: toolbarMeasureKey,
347
+ containerLength,
348
+ orientation
349
+ });
338
350
  const [overflowOpen, setOverflowOpen] = useState(false);
339
351
  useEffect(() => {
340
- if (!fit.hasOverflow) setOverflowOpen(false);
341
- }, [fit.hasOverflow]);
342
- /** External = custom unit with no registered renderer → native socket,
343
- * live-measured (it must NOT appear in the measurement layer: only the
352
+ if (!layout.hasOverflow) setOverflowOpen(false);
353
+ }, [layout.hasOverflow]);
354
+ /** External = custom part with no registered renderer → native socket,
355
+ * live-measured (it must not appear in the measurement layer: only the
344
356
  * first same-named <slot> in tree order receives the projected nodes). */
345
- const isExternalSlot = (u) => u.kind === "custom" && !renderCustom?.[u.slot];
346
- const renderUnitAt = (u, variant, layer) => {
347
- if (u.kind === "custom") {
348
- const registered = renderCustom?.[u.slot];
349
- if (registered) {
350
- const custom = registered(variant, {
351
- layer,
352
- measure: (width) => onWidth(unitKey(u, variant), width)
353
- });
354
- if (custom !== void 0) return custom;
355
- } else if (layer === "live") {
356
- const cmd = resolveCmd(u.terminal);
357
+ const isExternalSlot = (part) => part.kind === "custom" && !renderCustom?.[part.name];
358
+ const renderPart = (part, layer) => {
359
+ switch (part.kind) {
360
+ case "command": return renderCommand(part.command, part.variant, part.run);
361
+ case "custom": {
362
+ const terminal = () => part.terminal ? renderCommand(part.terminal, "icon", part.runTerminal) : null;
363
+ const registered = renderCustom?.[part.name];
364
+ if (registered) {
365
+ const custom = registered(part.variant, {
366
+ layer,
367
+ measure: (length) => onLength(part.measureKey, length)
368
+ });
369
+ return custom === void 0 ? terminal() : custom;
370
+ }
371
+ if (layer === "measure") return null;
357
372
  return /* @__PURE__ */ jsx(NativeSlotSocket, {
358
- name: u.slot,
359
- k: unitKey(u, variant),
360
- onWidth,
361
- children: cmd ? renderCommand(cmd, "icon", () => executeCmd(u.terminal)) : null
373
+ name: part.name,
374
+ k: part.measureKey,
375
+ orientation,
376
+ onLength,
377
+ children: terminal()
362
378
  });
363
- } else return null;
364
- const cmd = resolveCmd(u.terminal);
365
- return cmd ? renderCommand(cmd, "icon", () => executeCmd(u.terminal)) : null;
379
+ }
380
+ case "collapsed": {
381
+ const drawn = renderCollapsed?.(part.view);
382
+ return drawn === void 0 ? /* @__PURE__ */ jsx(DefaultCollapsed, {
383
+ view: part.view,
384
+ orientation
385
+ }) : drawn;
386
+ }
387
+ case "disclosure": {
388
+ const drawn = renderGroupTrigger?.(part.view);
389
+ return drawn === void 0 ? /* @__PURE__ */ jsx(DefaultGroupTrigger, {
390
+ view: part.view,
391
+ orientation
392
+ }) : drawn;
393
+ }
366
394
  }
367
- const cmd = resolveCmd(u.command);
368
- if (!cmd) return renderCommand({
369
- id: u.command,
370
- label: u.command,
371
- shortcuts: [],
372
- enabled: false,
373
- active: false,
374
- visible: true,
375
- categories: []
376
- }, variant, () => {});
377
- return renderCommand(cmd, variant, () => executeCmd(u.command));
378
395
  };
379
- const collapsedView = (g) => ({
380
- id: g.id,
381
- labelKey: g.labelKey,
382
- collapse: g.collapse ?? "menu",
383
- role: g.role,
384
- commands: g.units.map((u) => resolveCmd(commandOf(u))).filter((c) => c !== null && c.visible),
385
- execute: executeCmd
386
- });
387
- const renderCollapsedGroup = (g) => renderCollapsed ? renderCollapsed(collapsedView(g)) : /* @__PURE__ */ jsx(DefaultCollapsed, { view: collapsedView(g) });
388
- /** The disclosure view: shed children for the live trigger; the WHOLE group
389
- * for the measured trigger, so width is budgeted at its fullest content. */
390
- const disclosureView = (g, allChildren) => ({
391
- id: g.id,
392
- labelKey: g.labelKey,
393
- role: g.role,
394
- commands: g.units.filter((u) => allChildren || fit.units.get(u.key)?.kind === "shed").map((u) => resolveCmd(commandOf(u))).filter((c) => c !== null && c.visible),
395
- execute: executeCmd
396
- });
397
- const renderDisclosure = (g, allChildren) => renderGroupTrigger ? renderGroupTrigger(disclosureView(g, allChildren)) : /* @__PURE__ */ jsx(DefaultGroupTrigger, { view: disclosureView(g, allChildren) });
398
- const renderLiveGroup = (g) => {
399
- const assignment = fit.groups.get(g.id);
400
- if (!assignment || assignment.overflowed) return [];
401
- if (assignment.collapsed) return [/* @__PURE__ */ jsx(React.Fragment, { children: renderCollapsedGroup(g) }, g.id)];
402
- const nodes = [];
403
- for (const u of g.units) {
404
- const a = fit.units.get(u.key);
405
- if (a?.kind !== "variant") continue;
406
- nodes.push(/* @__PURE__ */ jsx(React.Fragment, { children: renderUnitAt(u, a.variant, "live") }, u.key));
407
- }
408
- if (assignment.shedCount > 0) nodes.push(/* @__PURE__ */ jsx(React.Fragment, { children: renderDisclosure(g, false) }, `${g.id}::trigger`));
409
- return nodes.length ? [/* @__PURE__ */ jsx(React.Fragment, { children: nodes }, g.id)] : [];
410
- };
411
- const renderLiveSection = (section) => {
412
- if (!section) return null;
413
- return section.groups.map((g) => ({
414
- id: g.id,
415
- nodes: renderLiveGroup(g)
416
- })).filter((g) => g.nodes.length > 0).map((g, i) => /* @__PURE__ */ jsxs(React.Fragment, { children: [i > 0 && renderSeparator(), g.nodes] }, g.id));
417
- };
418
- const sectionByName = (name) => visibleBar.sections.find((s) => s.name === name);
396
+ const renderLiveSection = (section) => section.groups.map((group, i) => /* @__PURE__ */ jsxs(React$1.Fragment, { children: [i > 0 && (renderSeparator ? renderSeparator() : /* @__PURE__ */ jsx(DefaultSeparator, { orientation })), group.parts.map((part) => /* @__PURE__ */ jsx("span", {
397
+ ...TOOLBAR_ITEM,
398
+ style: ITEM_STYLE,
399
+ children: renderPart(part, "live")
400
+ }, part.key))] }, group.id));
419
401
  /**
420
- * Segment layout — v2's spacer model, natively. The center segment carries
421
- * auto margins: it BALANCES in the leftover space (true center when the
422
- * flanks are symmetric) and yields when they aren't, collapsing to zero
423
- * before anything can overlap. The container itself has NO gap — segments
424
- * space themselves — so the solver's global budget (sum of unit widths +
425
- * per-unit gaps) is exactly the layout's minimum width: what the solver
402
+ * Segment layout, along the toolbar's axis. The center segment carries auto
403
+ * margins: it balances in the leftover space (true center when the flanks
404
+ * are symmetric) and yields when they aren't, collapsing to zero before
405
+ * anything can overlap. The container itself has no gap — segments space
406
+ * themselves — so the solver's global budget (sum of unit lengths +
407
+ * per-unit gaps) is exactly the layout's minimum length: what the solver
426
408
  * says fits, fits. Its cross-segment gap allowance (≤ 2×gap) becomes slack
427
409
  * the auto margins absorb, keeping ≥ gap between segments at the floor.
428
- * Segments never grow or shrink: fit is the SOLVER's job, not flexbox's.
410
+ * Segments never grow or shrink: fit is the solver's job, not flexbox's.
429
411
  */
430
412
  const sectionStyle = (position) => ({
431
413
  display: "flex",
414
+ flexDirection: vertical ? "column" : "row",
432
415
  alignItems: "center",
433
416
  gap,
434
417
  flex: "0 0 auto",
435
- ...position === "center" ? {
418
+ ...position !== "center" ? null : vertical ? {
419
+ marginTop: "auto",
420
+ marginBottom: "auto"
421
+ } : {
436
422
  marginLeft: "auto",
437
423
  marginRight: "auto"
438
- } : null
424
+ }
439
425
  });
440
426
  const overflowView = {
441
- sections: overflowSections,
427
+ sections: layout.overflow,
442
428
  isOpen: overflowOpen,
443
429
  close: () => setOverflowOpen(false),
444
430
  resolve: resolveCmd,
@@ -446,61 +432,53 @@ function Toolbar({ bar, gap = 8, separatorWidth = 1, className, style, renderCom
446
432
  };
447
433
  return /* @__PURE__ */ jsxs("div", {
448
434
  ref: containerRef,
435
+ role: "toolbar",
436
+ "aria-orientation": orientation,
437
+ "aria-label": ariaLabel,
449
438
  className,
450
439
  style: {
451
440
  position: "relative",
452
441
  display: "flex",
442
+ flexDirection: vertical ? "column" : "row",
453
443
  alignItems: "center",
454
444
  ...style
455
445
  },
456
- children: [
457
- /* @__PURE__ */ jsx("div", {
458
- style: sectionStyle("start"),
459
- children: renderLiveSection(sectionByName("start"))
460
- }),
461
- /* @__PURE__ */ jsx("div", {
462
- style: sectionStyle("center"),
463
- children: renderLiveSection(sectionByName("center"))
464
- }),
465
- /* @__PURE__ */ jsxs("div", {
466
- style: sectionStyle("end"),
467
- children: [renderLiveSection(sectionByName("end")), fit.hasOverflow && /* @__PURE__ */ jsxs("span", {
468
- style: {
469
- position: "relative",
470
- display: "inline-flex"
471
- },
472
- children: [renderOverflowTrigger(overflowOpen, () => setOverflowOpen((o) => !o)), renderOverflowMenu ? renderOverflowMenu(overflowView) : /* @__PURE__ */ jsx(DefaultOverflowMenu, { view: overflowView })]
473
- })]
474
- }),
475
- /* @__PURE__ */ jsxs("div", {
476
- "aria-hidden": true,
477
- style: measureLayerStyle,
478
- children: [visibleBar.sections.flatMap((s) => s.groups.flatMap((g) => [
479
- ...g.units.filter((u) => !isExternalSlot(u)).flatMap((u) => u.variants.map((variant) => /* @__PURE__ */ jsx(Measured, {
480
- k: unitKey(u, variant),
481
- onWidth,
482
- children: renderUnitAt(u, variant, "measure")
483
- }, unitKey(u, variant)))),
484
- ...g.collapse ? [/* @__PURE__ */ jsx(Measured, {
485
- k: groupKey(g.id),
486
- onWidth,
487
- children: renderCollapsedGroup(g)
488
- }, groupKey(g.id))] : [],
489
- ...g.shed ? [/* @__PURE__ */ jsx(Measured, {
490
- k: groupTriggerKey(g.id),
491
- onWidth,
492
- children: renderDisclosure(g, true)
493
- }, groupTriggerKey(g.id))] : []
494
- ])), /* @__PURE__ */ jsx(Measured, {
495
- k: TRIGGER_KEY,
496
- onWidth,
497
- children: renderOverflowTrigger(false, () => {})
446
+ children: [layout.sections.map((section) => /* @__PURE__ */ jsxs("div", {
447
+ style: sectionStyle(section.name),
448
+ children: [renderLiveSection(section), section.name === "end" && layout.hasOverflow && /* @__PURE__ */ jsxs("span", {
449
+ ...TOOLBAR_ITEM,
450
+ style: {
451
+ position: "relative",
452
+ display: "inline-flex"
453
+ },
454
+ children: [renderOverflowTrigger(overflowOpen, () => setOverflowOpen((previous) => !previous)), renderOverflowMenu ? renderOverflowMenu(overflowView) : /* @__PURE__ */ jsx(DefaultOverflowMenu, {
455
+ view: overflowView,
456
+ orientation
498
457
  })]
499
- })
500
- ]
458
+ })]
459
+ }, section.name)), /* @__PURE__ */ jsxs("div", {
460
+ "aria-hidden": true,
461
+ ...INERT,
462
+ style: measureLayerStyle(orientation),
463
+ children: [layout.measured.filter((part) => !isExternalSlot(part)).map((part) => {
464
+ const drawn = renderPart(part, "measure");
465
+ if (part.kind === "custom" && drawn === null) return null;
466
+ return /* @__PURE__ */ jsx(Measured, {
467
+ k: part.measureKey,
468
+ orientation,
469
+ onLength,
470
+ children: drawn
471
+ }, part.measureKey);
472
+ }), /* @__PURE__ */ jsx(Measured, {
473
+ k: toolbarMeasureKey.overflowTrigger,
474
+ orientation,
475
+ onLength,
476
+ children: renderOverflowTrigger(false, () => {})
477
+ })]
478
+ })]
501
479
  });
502
480
  }
503
481
  //#endregion
504
- export { Toolbar, useStripView };
482
+ export { DEFAULT_IMPORTANCE, PINNED, Toolbar, custom, group, item, useStripView };
505
483
 
506
484
  //# sourceMappingURL=toolbar.js.map