@forgedevstack/ink 1.1.9 → 1.2.0

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 (247) hide show
  1. package/CHANGELOG.md +16 -1
  2. package/dist/common-components/Box/Box.cjs +1 -1
  3. package/dist/common-components/Box/Box.js +7 -6
  4. package/dist/common-components/Button/Button.cjs +1 -1
  5. package/dist/common-components/Button/Button.js +9 -8
  6. package/dist/common-components/Canvas/Canvas.cjs +1 -1
  7. package/dist/common-components/Canvas/Canvas.js +3 -2
  8. package/dist/common-components/ContextMenu/ContextMenu.cjs +1 -1
  9. package/dist/common-components/ContextMenu/ContextMenu.js +3 -2
  10. package/dist/common-components/Field/Field.cjs +1 -1
  11. package/dist/common-components/Field/Field.js +11 -10
  12. package/dist/common-components/icons/GripIcon.cjs +1 -1
  13. package/dist/common-components/icons/GripIcon.js +3 -2
  14. package/dist/components/InkEditor/InkEditor.cjs +1 -1
  15. package/dist/components/InkEditor/InkEditor.d.ts.map +1 -1
  16. package/dist/components/InkEditor/InkEditor.js +1308 -1028
  17. package/dist/components/InkEditor/components/AiPanel/AiPanel.cjs +1 -1
  18. package/dist/components/InkEditor/components/AiPanel/AiPanel.js +13 -12
  19. package/dist/components/InkEditor/components/AiSelectionBubble/AiSelectionBubble.cjs +1 -0
  20. package/dist/components/InkEditor/components/AiSelectionBubble/AiSelectionBubble.const.cjs +1 -0
  21. package/dist/components/InkEditor/components/AiSelectionBubble/AiSelectionBubble.const.d.ts +20 -0
  22. package/dist/components/InkEditor/components/AiSelectionBubble/AiSelectionBubble.const.d.ts.map +1 -0
  23. package/dist/components/InkEditor/components/AiSelectionBubble/AiSelectionBubble.const.js +25 -0
  24. package/dist/components/InkEditor/components/AiSelectionBubble/AiSelectionBubble.d.ts +4 -0
  25. package/dist/components/InkEditor/components/AiSelectionBubble/AiSelectionBubble.d.ts.map +1 -0
  26. package/dist/components/InkEditor/components/AiSelectionBubble/AiSelectionBubble.js +61 -0
  27. package/dist/components/InkEditor/components/AiSelectionBubble/AiSelectionBubble.types.d.ts +11 -0
  28. package/dist/components/InkEditor/components/AiSelectionBubble/AiSelectionBubble.types.d.ts.map +1 -0
  29. package/dist/components/InkEditor/components/AiSelectionBubble/AiSelectionBubble.utils.cjs +1 -0
  30. package/dist/components/InkEditor/components/AiSelectionBubble/AiSelectionBubble.utils.d.ts +19 -0
  31. package/dist/components/InkEditor/components/AiSelectionBubble/AiSelectionBubble.utils.d.ts.map +1 -0
  32. package/dist/components/InkEditor/components/AiSelectionBubble/AiSelectionBubble.utils.js +30 -0
  33. package/dist/components/InkEditor/components/AiSelectionBubble/AiSelectionBubble.utils.test.d.ts +2 -0
  34. package/dist/components/InkEditor/components/AiSelectionBubble/AiSelectionBubble.utils.test.d.ts.map +1 -0
  35. package/dist/components/InkEditor/components/AiSelectionBubble/index.d.ts +4 -0
  36. package/dist/components/InkEditor/components/AiSelectionBubble/index.d.ts.map +1 -0
  37. package/dist/components/InkEditor/components/BlockHandles/BlockHandles.cjs +1 -1
  38. package/dist/components/InkEditor/components/BlockHandles/BlockHandles.js +7 -6
  39. package/dist/components/InkEditor/components/CommentsPanel/CommentsPanel.cjs +1 -1
  40. package/dist/components/InkEditor/components/CommentsPanel/CommentsPanel.d.ts +2 -0
  41. package/dist/components/InkEditor/components/CommentsPanel/CommentsPanel.d.ts.map +1 -1
  42. package/dist/components/InkEditor/components/CommentsPanel/CommentsPanel.js +16 -15
  43. package/dist/components/InkEditor/components/ExcelSheetPanel/ExcelSheetPanel.cjs +1 -1
  44. package/dist/components/InkEditor/components/ExcelSheetPanel/ExcelSheetPanel.d.ts.map +1 -1
  45. package/dist/components/InkEditor/components/ExcelSheetPanel/ExcelSheetPanel.js +84 -97
  46. package/dist/components/InkEditor/components/FindReplace/FindReplace.cjs +1 -1
  47. package/dist/components/InkEditor/components/FindReplace/FindReplace.js +21 -20
  48. package/dist/components/InkEditor/components/GraphEditModal/GraphEditModal.cjs +1 -1
  49. package/dist/components/InkEditor/components/GraphEditModal/GraphEditModal.js +17 -16
  50. package/dist/components/InkEditor/components/GraphPicker/GraphPicker.cjs +1 -1
  51. package/dist/components/InkEditor/components/GraphPicker/GraphPicker.js +3 -2
  52. package/dist/components/InkEditor/components/HtmlSourcePanel/HtmlSourcePanel.cjs +1 -1
  53. package/dist/components/InkEditor/components/HtmlSourcePanel/HtmlSourcePanel.js +7 -6
  54. package/dist/components/InkEditor/components/ImageFrame/ImageFrame.cjs +1 -0
  55. package/dist/components/InkEditor/components/ImageFrame/ImageFrame.d.ts +8 -0
  56. package/dist/components/InkEditor/components/ImageFrame/ImageFrame.d.ts.map +1 -0
  57. package/dist/components/InkEditor/components/ImageFrame/ImageFrame.js +54 -0
  58. package/dist/components/InkEditor/components/ImageFrame/index.d.ts +3 -0
  59. package/dist/components/InkEditor/components/ImageFrame/index.d.ts.map +1 -0
  60. package/dist/components/InkEditor/components/InlineToolbar/InlineToolbar.cjs +1 -1
  61. package/dist/components/InkEditor/components/InlineToolbar/InlineToolbar.js +11 -10
  62. package/dist/components/InkEditor/components/MentionMenu/MentionMenu.cjs +1 -0
  63. package/dist/components/InkEditor/components/MentionMenu/MentionMenu.d.ts +16 -0
  64. package/dist/components/InkEditor/components/MentionMenu/MentionMenu.d.ts.map +1 -0
  65. package/dist/components/InkEditor/components/MentionMenu/MentionMenu.js +21 -0
  66. package/dist/components/InkEditor/components/MentionMenu/index.d.ts +3 -0
  67. package/dist/components/InkEditor/components/MentionMenu/index.d.ts.map +1 -0
  68. package/dist/components/InkEditor/components/OutlineRail/OutlineRail.cjs +1 -1
  69. package/dist/components/InkEditor/components/OutlineRail/OutlineRail.js +11 -10
  70. package/dist/components/InkEditor/components/PresenceStack/PresenceStack.cjs +1 -1
  71. package/dist/components/InkEditor/components/PresenceStack/PresenceStack.js +3 -2
  72. package/dist/components/InkEditor/components/RemoteCursors/RemoteCursors.cjs +1 -1
  73. package/dist/components/InkEditor/components/RemoteCursors/RemoteCursors.js +6 -5
  74. package/dist/components/InkEditor/components/SignPad/SignPad.cjs +1 -1
  75. package/dist/components/InkEditor/components/SignPad/SignPad.js +7 -6
  76. package/dist/components/InkEditor/components/SlashMenu/SlashMenu.cjs +1 -1
  77. package/dist/components/InkEditor/components/SlashMenu/SlashMenu.js +7 -6
  78. package/dist/components/InkEditor/components/TableSizePicker/TableSizePicker.cjs +1 -1
  79. package/dist/components/InkEditor/components/TableSizePicker/TableSizePicker.const.cjs +1 -1
  80. package/dist/components/InkEditor/components/TableSizePicker/TableSizePicker.const.js +8 -7
  81. package/dist/components/InkEditor/components/TableSizePicker/TableSizePicker.js +38 -38
  82. package/dist/components/InkEditor/components/ThemePicker/ThemePicker.cjs +1 -1
  83. package/dist/components/InkEditor/components/ThemePicker/ThemePicker.d.ts.map +1 -1
  84. package/dist/components/InkEditor/components/ThemePicker/ThemePicker.js +56 -39
  85. package/dist/components/InkEditor/components/TitleGallery/TitleGallery.cjs +1 -1
  86. package/dist/components/InkEditor/components/TitleGallery/TitleGallery.js +3 -2
  87. package/dist/components/InkEditor/components/ToolbarButton/ToolbarButton.cjs +1 -1
  88. package/dist/components/InkEditor/components/ToolbarButton/ToolbarButton.js +13 -12
  89. package/dist/components/InkEditor/components/ToolbarColorPicker/ToolbarColorPicker.cjs +1 -1
  90. package/dist/components/InkEditor/components/ToolbarColorPicker/ToolbarColorPicker.js +9 -8
  91. package/dist/components/InkEditor/components/ToolbarCustomize/ToolbarCustomize.cjs +1 -1
  92. package/dist/components/InkEditor/components/ToolbarCustomize/ToolbarCustomize.const.cjs +1 -1
  93. package/dist/components/InkEditor/components/ToolbarCustomize/ToolbarCustomize.const.js +9 -8
  94. package/dist/components/InkEditor/components/ToolbarCustomize/ToolbarCustomize.js +9 -8
  95. package/dist/components/InkEditor/components/ToolbarDropdown/ToolbarDropdown.cjs +1 -1
  96. package/dist/components/InkEditor/components/ToolbarDropdown/ToolbarDropdown.js +19 -18
  97. package/dist/components/InkEditor/components/ToolbarDropdown/ToolbarDropdown.utils.cjs +1 -1
  98. package/dist/components/InkEditor/components/ToolbarDropdown/ToolbarDropdown.utils.js +6 -5
  99. package/dist/components/InkEditor/components/VersionHistory/VersionHistory.cjs +1 -0
  100. package/dist/components/InkEditor/components/VersionHistory/VersionHistory.d.ts +11 -0
  101. package/dist/components/InkEditor/components/VersionHistory/VersionHistory.d.ts.map +1 -0
  102. package/dist/components/InkEditor/components/VersionHistory/VersionHistory.js +22 -0
  103. package/dist/components/InkEditor/components/VersionHistory/index.d.ts +3 -0
  104. package/dist/components/InkEditor/components/VersionHistory/index.d.ts.map +1 -0
  105. package/dist/components/InkEditor/components/index.d.ts +7 -0
  106. package/dist/components/InkEditor/components/index.d.ts.map +1 -1
  107. package/dist/components/InkEditor/helpers/format.utils.cjs +3 -2
  108. package/dist/components/InkEditor/helpers/format.utils.d.ts +1 -0
  109. package/dist/components/InkEditor/helpers/format.utils.d.ts.map +1 -1
  110. package/dist/components/InkEditor/helpers/format.utils.js +106 -84
  111. package/dist/components/InkEditor/helpers/index.d.ts +1 -1
  112. package/dist/components/InkEditor/helpers/index.d.ts.map +1 -1
  113. package/dist/components/InkWorkspace/InkWorkspace.cjs +1 -1
  114. package/dist/components/InkWorkspace/InkWorkspace.d.ts.map +1 -1
  115. package/dist/components/InkWorkspace/InkWorkspace.js +136 -144
  116. package/dist/components/InkWorkspace/hooks/useInkWorkspace.cjs +1 -1
  117. package/dist/components/InkWorkspace/hooks/useInkWorkspace.js +8 -7
  118. package/dist/constants/contextMenu.const.cjs +1 -1
  119. package/dist/constants/contextMenu.const.d.ts +8 -0
  120. package/dist/constants/contextMenu.const.d.ts.map +1 -1
  121. package/dist/constants/contextMenu.const.js +30 -22
  122. package/dist/constants/defaultIcons.cjs +1 -1
  123. package/dist/constants/defaultIcons.js +6 -5
  124. package/dist/constants/defaults.const.cjs +1 -1
  125. package/dist/constants/defaults.const.d.ts.map +1 -1
  126. package/dist/constants/defaults.const.js +150 -138
  127. package/dist/constants/numbers.cjs +1 -1
  128. package/dist/constants/numbers.js +28 -27
  129. package/dist/constants/toolbar.const.cjs +1 -1
  130. package/dist/constants/toolbar.const.d.ts +7 -0
  131. package/dist/constants/toolbar.const.d.ts.map +1 -1
  132. package/dist/constants/toolbar.const.js +16 -9
  133. package/dist/constants/toolbarMenu.const.cjs +1 -1
  134. package/dist/constants/toolbarMenu.const.d.ts.map +1 -1
  135. package/dist/constants/toolbarMenu.const.js +25 -11
  136. package/dist/hooks/useInkCollaboration.cjs +1 -1
  137. package/dist/hooks/useInkCollaboration.js +15 -14
  138. package/dist/hooks/useToolbarOverflow.cjs +1 -1
  139. package/dist/hooks/useToolbarOverflow.js +12 -11
  140. package/dist/index.cjs +1 -1
  141. package/dist/index.js +145 -144
  142. package/dist/plugins/ai/demoProvider.cjs +1 -1
  143. package/dist/plugins/ai/demoProvider.js +3 -2
  144. package/dist/plugins/ai/index.cjs +1 -1
  145. package/dist/plugins/ai/index.js +25 -24
  146. package/dist/plugins/excel/excel.utils.cjs +1 -1
  147. package/dist/plugins/excel/excel.utils.js +17 -16
  148. package/dist/plugins/graph/graph.utils.cjs +1 -1
  149. package/dist/plugins/graph/graph.utils.js +7 -6
  150. package/dist/plugins/theme/inkTheme.cjs +1 -1
  151. package/dist/plugins/theme/inkTheme.js +22 -19
  152. package/dist/plugins/titles/titles.const.cjs +1 -1
  153. package/dist/plugins/titles/titles.const.js +9 -8
  154. package/dist/plugins/titles/titles.utils.cjs +1 -1
  155. package/dist/plugins/titles/titles.utils.js +3 -2
  156. package/dist/styles.css +1 -1
  157. package/dist/types/collab.types.d.ts +0 -1
  158. package/dist/types/collab.types.d.ts.map +1 -1
  159. package/dist/types/features.types.d.ts +1 -1
  160. package/dist/types/features.types.d.ts.map +1 -1
  161. package/dist/types/ink.types.d.ts +1 -3
  162. package/dist/types/ink.types.d.ts.map +1 -1
  163. package/dist/utils/blocks.utils.cjs +1 -1
  164. package/dist/utils/blocks.utils.js +19 -18
  165. package/dist/utils/collab.utils.cjs +1 -1
  166. package/dist/utils/collab.utils.js +7 -6
  167. package/dist/utils/comments.utils.cjs +1 -1
  168. package/dist/utils/comments.utils.d.ts +4 -0
  169. package/dist/utils/comments.utils.d.ts.map +1 -1
  170. package/dist/utils/comments.utils.js +26 -18
  171. package/dist/utils/comments.utils.test.d.ts +2 -0
  172. package/dist/utils/comments.utils.test.d.ts.map +1 -0
  173. package/dist/utils/exportDocument.utils.cjs +2 -0
  174. package/dist/utils/exportDocument.utils.d.ts +16 -0
  175. package/dist/utils/exportDocument.utils.d.ts.map +1 -0
  176. package/dist/utils/exportDocument.utils.js +85 -0
  177. package/dist/utils/exportDocument.utils.test.d.ts +2 -0
  178. package/dist/utils/exportDocument.utils.test.d.ts.map +1 -0
  179. package/dist/utils/formatPainter.utils.cjs +1 -0
  180. package/dist/utils/formatPainter.utils.d.ts +11 -0
  181. package/dist/utils/formatPainter.utils.d.ts.map +1 -0
  182. package/dist/utils/formatPainter.utils.js +20 -0
  183. package/dist/utils/formatPainter.utils.test.d.ts +2 -0
  184. package/dist/utils/formatPainter.utils.test.d.ts.map +1 -0
  185. package/dist/utils/history.utils.cjs +1 -1
  186. package/dist/utils/history.utils.js +3 -2
  187. package/dist/utils/image.utils.cjs +1 -0
  188. package/dist/utils/image.utils.d.ts +14 -0
  189. package/dist/utils/image.utils.d.ts.map +1 -0
  190. package/dist/utils/image.utils.js +33 -0
  191. package/dist/utils/image.utils.test.d.ts +2 -0
  192. package/dist/utils/image.utils.test.d.ts.map +1 -0
  193. package/dist/utils/index.d.ts +10 -3
  194. package/dist/utils/index.d.ts.map +1 -1
  195. package/dist/utils/license.utils.cjs +1 -1
  196. package/dist/utils/license.utils.js +8 -7
  197. package/dist/utils/markdown.utils.cjs +11 -0
  198. package/dist/utils/markdown.utils.d.ts +7 -0
  199. package/dist/utils/markdown.utils.d.ts.map +1 -0
  200. package/dist/utils/markdown.utils.js +87 -0
  201. package/dist/utils/markdown.utils.test.d.ts +2 -0
  202. package/dist/utils/markdown.utils.test.d.ts.map +1 -0
  203. package/dist/utils/mentions.utils.cjs +1 -0
  204. package/dist/utils/mentions.utils.d.ts +13 -0
  205. package/dist/utils/mentions.utils.d.ts.map +1 -0
  206. package/dist/utils/mentions.utils.js +23 -0
  207. package/dist/utils/mentions.utils.test.d.ts +2 -0
  208. package/dist/utils/mentions.utils.test.d.ts.map +1 -0
  209. package/dist/utils/outline.utils.cjs +1 -1
  210. package/dist/utils/outline.utils.js +9 -8
  211. package/dist/utils/paste.utils.cjs +1 -1
  212. package/dist/utils/paste.utils.d.ts +2 -0
  213. package/dist/utils/paste.utils.d.ts.map +1 -1
  214. package/dist/utils/paste.utils.js +53 -19
  215. package/dist/utils/paste.utils.test.d.ts +2 -0
  216. package/dist/utils/paste.utils.test.d.ts.map +1 -0
  217. package/dist/utils/premium.utils.cjs +1 -1
  218. package/dist/utils/premium.utils.js +12 -11
  219. package/dist/utils/selection.utils.cjs +1 -1
  220. package/dist/utils/selection.utils.js +3 -2
  221. package/dist/utils/slash.utils.cjs +1 -1
  222. package/dist/utils/slash.utils.js +10 -9
  223. package/dist/utils/table.utils.cjs +1 -1
  224. package/dist/utils/table.utils.d.ts +8 -0
  225. package/dist/utils/table.utils.d.ts.map +1 -1
  226. package/dist/utils/table.utils.js +78 -54
  227. package/dist/utils/toolbarStorage.utils.cjs +1 -1
  228. package/dist/utils/toolbarStorage.utils.js +15 -14
  229. package/dist/utils/trackChanges.utils.cjs +1 -1
  230. package/dist/utils/trackChanges.utils.js +9 -8
  231. package/dist/utils/typo.utils.cjs +1 -1
  232. package/dist/utils/typo.utils.js +8 -7
  233. package/dist/utils/versions.utils.cjs +1 -0
  234. package/dist/utils/versions.utils.d.ts +11 -0
  235. package/dist/utils/versions.utils.d.ts.map +1 -0
  236. package/dist/utils/versions.utils.js +36 -0
  237. package/dist/utils/versions.utils.test.d.ts +2 -0
  238. package/dist/utils/versions.utils.test.d.ts.map +1 -0
  239. package/dist/utils/words.utils.cjs +1 -1
  240. package/dist/utils/words.utils.js +3 -2
  241. package/package.json +1 -1
  242. package/dist/components/InkEditor/components/ThemePicker/hooks/index.d.ts +0 -3
  243. package/dist/components/InkEditor/components/ThemePicker/hooks/index.d.ts.map +0 -1
  244. package/dist/components/InkEditor/components/ThemePicker/hooks/useThemePickerMenu.cjs +0 -1
  245. package/dist/components/InkEditor/components/ThemePicker/hooks/useThemePickerMenu.d.ts +0 -13
  246. package/dist/components/InkEditor/components/ThemePicker/hooks/useThemePickerMenu.d.ts.map +0 -1
  247. package/dist/components/InkEditor/components/ThemePicker/hooks/useThemePickerMenu.js +0 -39
@@ -1,5 +1,5 @@
1
- import { jsxs as a, jsx as E } from "react/jsx-runtime";
2
- import { useState as l, useRef as L, useEffect as B } from "react";
1
+ import { jsxs as l, jsx as E } from "react/jsx-runtime";
2
+ import { useState as m, useRef as a, useEffect as B } from "react";
3
3
  import { createPortal as O } from "react-dom";
4
4
  import { INK_TABLE_PICKER_MAX as n, NUMBER_ONE as A } from "../../../../constants/numbers.js";
5
5
  import { INK_TABLE_INSERT_TITLE as C, SPACE_STRING as $ } from "../../../../constants/generals.const.js";
@@ -8,50 +8,51 @@ import { KEY_ESCAPE as b } from "../../../../constants/keyboard.const.js";
8
8
  import { INK_CLASS_TABLE_PICKER as g, INK_CLASS_STYLE_MENU as h, INK_CLASS_STYLE_MENU_PORTAL as k, INK_CLASS_STYLE_MENU_FORCED as D, INK_CLASS_TABLE_PICKER_GRID as Y, INK_CLASS_TABLE_PICKER_CELL as U, INK_CLASS_TABLE_PICKER_CELL_ON as x, INK_CLASS_TABLE_PICKER_LABEL as z } from "../../../../constants/defaults.const.js";
9
9
  import "../../../../constants/openai.const.js";
10
10
  import "../../../../utils/paste.utils.js";
11
+ import "../../../../utils/exportDocument.utils.js";
11
12
  import { getToolbarDropdownMenuPosition as G } from "../ToolbarDropdown/ToolbarDropdown.utils.js";
12
13
  import { ToolbarButton as H } from "../ToolbarButton/ToolbarButton.js";
13
- import { TABLE_PICKER_INITIAL_HOVER as N, TABLE_PICKER_EMPTY_POSITION as j, TABLE_PICKER_TIMES_MARK as w } from "./TableSizePicker.const.js";
14
- const so = (v) => {
15
- const { icon: K, disabled: d = !1, onSelect: R } = v, [c, s] = l(!1), [i, m] = l(N), [f, P] = l(j), u = L(null), I = L(null), S = L(null);
14
+ import { TABLE_PICKER_INITIAL_HOVER as N, TABLE_PICKER_EMPTY_POSITION as j, TABLE_PICKER_TIMES_MARK as K } from "./TableSizePicker.const.js";
15
+ const ie = (R) => {
16
+ const { icon: v, disabled: L = !1, onSelect: w } = R, [c, s] = m(!1), [i, d] = m(N), [f, P] = m(j), u = a(null), I = a(null), p = a(null);
16
17
  B(() => {
17
18
  if (!c) return;
18
- const o = () => {
19
- const e = G(I.current);
20
- P({ top: e.top, left: e.left });
19
+ const e = () => {
20
+ const o = G(I.current);
21
+ P({ top: o.top, left: o.left });
21
22
  };
22
- o();
23
- const t = (e) => {
24
- var p, T;
25
- const _ = e.target;
26
- (p = u.current) != null && p.contains(_) || (T = S.current) != null && T.contains(_) || s(!1);
27
- }, r = (e) => {
28
- e.key === b && s(!1);
23
+ e();
24
+ const t = (o) => {
25
+ var S, T;
26
+ const _ = o.target;
27
+ (S = u.current) != null && S.contains(_) || (T = p.current) != null && T.contains(_) || s(!1);
28
+ }, r = (o) => {
29
+ o.key === b && s(!1);
29
30
  };
30
- return document.addEventListener("mousedown", t), document.addEventListener("keydown", r), window.addEventListener("resize", o), window.addEventListener("scroll", o, !0), () => {
31
- document.removeEventListener("mousedown", t), document.removeEventListener("keydown", r), window.removeEventListener("resize", o), window.removeEventListener("scroll", o, !0);
31
+ return document.addEventListener("mousedown", t), document.addEventListener("keydown", r), window.addEventListener("resize", e), window.addEventListener("scroll", e, !0), () => {
32
+ document.removeEventListener("mousedown", t), document.removeEventListener("keydown", r), window.removeEventListener("resize", e), window.removeEventListener("scroll", e, !0);
32
33
  };
33
34
  }, [c]);
34
- const M = Array.from({ length: n * n }, (o, t) => {
35
- const r = Math.floor(t / n) + A, e = t % n + A, _ = r <= i.rows && e <= i.cols;
36
- return { rows: r, cols: e, isOn: _, key: `${r}-${e}` };
35
+ const M = Array.from({ length: n * n }, (e, t) => {
36
+ const r = Math.floor(t / n) + A, o = t % n + A, _ = r <= i.rows && o <= i.cols;
37
+ return { rows: r, cols: o, isOn: _, key: `${r}-${o}` };
37
38
  });
38
- return /* @__PURE__ */ a("div", { className: g, ref: u, children: [
39
+ return /* @__PURE__ */ l("div", { className: g, ref: u, children: [
39
40
  /* @__PURE__ */ E("div", { ref: I, children: /* @__PURE__ */ E(
40
41
  H,
41
42
  {
42
- icon: K,
43
+ icon: v,
43
44
  title: C,
44
- disabled: d,
45
+ disabled: L,
45
46
  onClick: () => {
46
- d || (m(N), s((o) => !o));
47
+ L || (d(N), s((e) => !e));
47
48
  }
48
49
  }
49
50
  ) }),
50
- c && O(
51
- /* @__PURE__ */ a(
51
+ c ? O(
52
+ /* @__PURE__ */ l(
52
53
  "div",
53
54
  {
54
- ref: S,
55
+ ref: p,
55
56
  className: `${h} ${k} ${D}`,
56
57
  "data-color-mode": y,
57
58
  role: "grid",
@@ -63,34 +64,33 @@ const so = (v) => {
63
64
  {
64
65
  className: Y,
65
66
  style: { gridTemplateColumns: `repeat(${n}, 1fr)` },
66
- children: M.map((o) => /* @__PURE__ */ E(
67
+ children: M.map((e) => /* @__PURE__ */ E(
67
68
  "button",
68
69
  {
69
70
  type: "button",
70
- className: `${U}${o.isOn ? `${$}${x}` : ""}`,
71
- "aria-label": `${o.rows}${w}${o.cols}`,
72
- onMouseEnter: () => m({ rows: o.rows, cols: o.cols }),
73
- onMouseMove: () => m({ rows: o.rows, cols: o.cols }),
71
+ className: `${U}${e.isOn ? `${$}${x}` : ""}`,
72
+ "aria-label": `${e.rows}${K}${e.cols}`,
73
+ onMouseEnter: () => d({ rows: e.rows, cols: e.cols }),
74
74
  onMouseDown: (t) => {
75
- t.preventDefault(), R(o.rows, o.cols), s(!1);
75
+ t.preventDefault(), w(e.rows, e.cols), s(!1);
76
76
  }
77
77
  },
78
- o.key
78
+ e.key
79
79
  ))
80
80
  }
81
81
  ),
82
- /* @__PURE__ */ a("div", { className: z, children: [
82
+ /* @__PURE__ */ l("div", { className: z, children: [
83
83
  i.rows,
84
- w,
84
+ K,
85
85
  i.cols
86
86
  ] })
87
87
  ]
88
88
  }
89
89
  ),
90
90
  document.body
91
- )
91
+ ) : null
92
92
  ] });
93
93
  };
94
94
  export {
95
- so as TableSizePicker
95
+ ie as TableSizePicker
96
96
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),S=require("react-dom"),c=require("../../../../constants/generals.const.cjs"),b=require("../../../../constants/colorMode.const.cjs"),n=require("../../../../constants/defaults.const.cjs");require("../../../../constants/openai.const.cjs");require("../../../../utils/paste.utils.cjs");require("react");const m=require("../../../../plugins/theme/theme.const.cjs");require("../../../../plugins/host/inkPlugins.cjs");const L=require("../ToolbarButton/ToolbarButton.cjs"),N=require("./hooks/useThemePickerMenu.cjs"),I=u=>{const{icon:a,disabled:i=!1,hint:_,onHint:d,pluginColor:T,value:E,onChange:s}=u,{open:f,setOpen:r,menuPosition:l,rootRef:p,triggerRef:q,menuRef:M}=N.useThemePickerMenu();return o.jsxs("div",{ref:p,children:[o.jsx("div",{ref:q,children:o.jsx(L.ToolbarButton,{icon:a,title:c.INK_THEME_TITLE,hint:_,onHint:d,pluginColor:T,disabled:i,onClick:()=>{i||r(e=>!e)}})}),f&&S.createPortal(o.jsx("div",{ref:M,className:`${n.INK_CLASS_STYLE_MENU} ${n.INK_CLASS_STYLE_MENU_PORTAL} ${n.INK_CLASS_STYLE_MENU_FORCED}`,"data-color-mode":b.COLOR_MODE_LIGHT,role:"listbox","aria-label":c.INK_THEME_TITLE,style:{top:l.top,left:l.left},children:m.INK_THEMES.map(e=>o.jsx("button",{type:"button",role:"option","aria-selected":e.id===E,className:"Ink-Editor__style-option",onMouseDown:t=>{t.preventDefault(),s(e.id),r(!1)},onClick:t=>{t.preventDefault(),s(e.id),r(!1)},children:e.label},e.id))}),document.body)]})};exports.ThemePicker=I;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),o=require("react"),y=require("react-dom"),L=require("../../../../constants/numbers.cjs"),T=require("../../../../constants/generals.const.cjs"),g=require("../../../../constants/colorMode.const.cjs"),I=require("../../../../constants/keyboard.const.cjs"),u=require("../../../../constants/defaults.const.cjs");require("../../../../constants/openai.const.cjs");require("../../../../utils/paste.utils.cjs");require("../../../../utils/exportDocument.utils.cjs");const P=require("../../../../plugins/theme/theme.const.cjs");require("../../../../plugins/host/inkPlugins.cjs");const C=require("../ToolbarDropdown/ToolbarDropdown.utils.cjs"),O=require("../ToolbarButton/ToolbarButton.cjs"),k=p=>{const{icon:b,disabled:c=!1,hint:q,onHint:w,pluginColor:S,value:M,onChange:R}=p,[i,r]=o.useState(!1),[l,N]=o.useState({top:L.NUMBER_ZERO,left:L.NUMBER_ZERO}),a=o.useRef(null),d=o.useRef(null),E=o.useRef(null);return o.useEffect(()=>{if(!i)return;const e=()=>{const t=C.getToolbarDropdownMenuPosition(d.current);N({top:t.top,left:t.left})};e();const s=t=>{var m,v;const f=t.target;(m=a.current)!=null&&m.contains(f)||(v=E.current)!=null&&v.contains(f)||r(!1)},_=t=>{t.key===I.KEY_ESCAPE&&r(!1)};return document.addEventListener("mousedown",s),document.addEventListener("keydown",_),window.addEventListener("resize",e),window.addEventListener("scroll",e,!0),()=>{document.removeEventListener("mousedown",s),document.removeEventListener("keydown",_),window.removeEventListener("resize",e),window.removeEventListener("scroll",e,!0)}},[i]),n.jsxs("div",{ref:a,children:[n.jsx("div",{ref:d,children:n.jsx(O.ToolbarButton,{icon:b,title:T.INK_THEME_TITLE,hint:q,onHint:w,pluginColor:S,disabled:c,onClick:()=>{c||r(e=>!e)}})}),i?y.createPortal(n.jsx("div",{ref:E,className:`${u.INK_CLASS_STYLE_MENU} ${u.INK_CLASS_STYLE_MENU_PORTAL} ${u.INK_CLASS_STYLE_MENU_FORCED}`,"data-color-mode":g.COLOR_MODE_LIGHT,role:"listbox","aria-label":T.INK_THEME_TITLE,style:{top:l.top,left:l.left},children:P.INK_THEMES.map(e=>n.jsx("button",{type:"button",role:"option","aria-selected":e.id===M,className:"Ink-Editor__style-option",onMouseDown:s=>{s.preventDefault(),R(e.id),r(!1)},children:e.label},e.id))}),document.body):null]})};exports.ThemePicker=k;
@@ -1 +1 @@
1
- {"version":3,"file":"ThemePicker.d.ts","sourceRoot":"","sources":["../../../../../src/components/InkEditor/components/ThemePicker/ThemePicker.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AAYhC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAE5D,eAAO,MAAM,WAAW,EAAE,EAAE,CAAC,gBAAgB,CAwD5C,CAAC"}
1
+ {"version":3,"file":"ThemePicker.d.ts","sourceRoot":"","sources":["../../../../../src/components/InkEditor/components/ThemePicker/ThemePicker.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA+B,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AAc7D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAE5D,eAAO,MAAM,WAAW,EAAE,EAAE,CAAC,gBAAgB,CAmF5C,CAAC"}
@@ -1,65 +1,82 @@
1
- import { jsxs as L, jsx as e } from "react/jsx-runtime";
2
- import { createPortal as N } from "react-dom";
3
- import { INK_THEME_TITLE as m } from "../../../../constants/generals.const.js";
4
- import { COLOR_MODE_LIGHT as S } from "../../../../constants/colorMode.const.js";
5
- import { INK_CLASS_STYLE_MENU as C, INK_CLASS_STYLE_MENU_PORTAL as b, INK_CLASS_STYLE_MENU_FORCED as I } from "../../../../constants/defaults.const.js";
1
+ import { jsxs as y, jsx as r } from "react/jsx-runtime";
2
+ import { useState as _, useRef as s, useEffect as I } from "react";
3
+ import { createPortal as P } from "react-dom";
4
+ import { NUMBER_ZERO as v } from "../../../../constants/numbers.js";
5
+ import { INK_THEME_TITLE as L } from "../../../../constants/generals.const.js";
6
+ import { COLOR_MODE_LIGHT as g } from "../../../../constants/colorMode.const.js";
7
+ import { KEY_ESCAPE as K } from "../../../../constants/keyboard.const.js";
8
+ import { INK_CLASS_STYLE_MENU as O, INK_CLASS_STYLE_MENU_PORTAL as k, INK_CLASS_STYLE_MENU_FORCED as x } from "../../../../constants/defaults.const.js";
6
9
  import "../../../../constants/openai.const.js";
7
10
  import "../../../../utils/paste.utils.js";
8
- import "react";
9
- import { INK_THEMES as M } from "../../../../plugins/theme/theme.const.js";
11
+ import "../../../../utils/exportDocument.utils.js";
12
+ import { INK_THEMES as A } from "../../../../plugins/theme/theme.const.js";
10
13
  import "../../../../plugins/host/inkPlugins.js";
11
- import { ToolbarButton as v } from "../ToolbarButton/ToolbarButton.js";
12
- import { useThemePickerMenu as O } from "./hooks/useThemePickerMenu.js";
13
- const Y = (a) => {
14
- const { icon: p, disabled: i = !1, hint: f, onHint: s, pluginColor: d, value: c, onChange: n } = a, { open: _, setOpen: r, menuPosition: l, rootRef: u, triggerRef: E, menuRef: T } = O();
15
- return /* @__PURE__ */ L("div", { ref: u, children: [
16
- /* @__PURE__ */ e("div", { ref: E, children: /* @__PURE__ */ e(
17
- v,
14
+ import { getToolbarDropdownMenuPosition as D } from "../ToolbarDropdown/ToolbarDropdown.utils.js";
15
+ import { ToolbarButton as h } from "../ToolbarButton/ToolbarButton.js";
16
+ const X = (w) => {
17
+ const { icon: S, disabled: l = !1, hint: T, onHint: N, pluginColor: M, value: b, onChange: C } = w, [i, t] = _(!1), [m, R] = _({ top: v, left: v }), d = s(null), c = s(null), a = s(null);
18
+ return I(() => {
19
+ if (!i) return;
20
+ const e = () => {
21
+ const o = D(c.current);
22
+ R({ top: o.top, left: o.left });
23
+ };
24
+ e();
25
+ const n = (o) => {
26
+ var p, E;
27
+ const u = o.target;
28
+ (p = d.current) != null && p.contains(u) || (E = a.current) != null && E.contains(u) || t(!1);
29
+ }, f = (o) => {
30
+ o.key === K && t(!1);
31
+ };
32
+ return document.addEventListener("mousedown", n), document.addEventListener("keydown", f), window.addEventListener("resize", e), window.addEventListener("scroll", e, !0), () => {
33
+ document.removeEventListener("mousedown", n), document.removeEventListener("keydown", f), window.removeEventListener("resize", e), window.removeEventListener("scroll", e, !0);
34
+ };
35
+ }, [i]), /* @__PURE__ */ y("div", { ref: d, children: [
36
+ /* @__PURE__ */ r("div", { ref: c, children: /* @__PURE__ */ r(
37
+ h,
18
38
  {
19
- icon: p,
20
- title: m,
21
- hint: f,
22
- onHint: s,
23
- pluginColor: d,
24
- disabled: i,
39
+ icon: S,
40
+ title: L,
41
+ hint: T,
42
+ onHint: N,
43
+ pluginColor: M,
44
+ disabled: l,
25
45
  onClick: () => {
26
- i || r((o) => !o);
46
+ l || t((e) => !e);
27
47
  }
28
48
  }
29
49
  ) }),
30
- _ && N(
31
- /* @__PURE__ */ e(
50
+ i ? P(
51
+ /* @__PURE__ */ r(
32
52
  "div",
33
53
  {
34
- ref: T,
35
- className: `${C} ${b} ${I}`,
36
- "data-color-mode": S,
54
+ ref: a,
55
+ className: `${O} ${k} ${x}`,
56
+ "data-color-mode": g,
37
57
  role: "listbox",
38
- "aria-label": m,
39
- style: { top: l.top, left: l.left },
40
- children: M.map((o) => /* @__PURE__ */ e(
58
+ "aria-label": L,
59
+ style: { top: m.top, left: m.left },
60
+ children: A.map((e) => /* @__PURE__ */ r(
41
61
  "button",
42
62
  {
43
63
  type: "button",
44
64
  role: "option",
45
- "aria-selected": o.id === c,
65
+ "aria-selected": e.id === b,
46
66
  className: "Ink-Editor__style-option",
47
- onMouseDown: (t) => {
48
- t.preventDefault(), n(o.id), r(!1);
67
+ onMouseDown: (n) => {
68
+ n.preventDefault(), C(e.id), t(!1);
49
69
  },
50
- onClick: (t) => {
51
- t.preventDefault(), n(o.id), r(!1);
52
- },
53
- children: o.label
70
+ children: e.label
54
71
  },
55
- o.id
72
+ e.id
56
73
  ))
57
74
  }
58
75
  ),
59
76
  document.body
60
- )
77
+ ) : null
61
78
  ] });
62
79
  };
63
80
  export {
64
- Y as ThemePicker
81
+ X as ThemePicker
65
82
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),r=require("react"),q=require("react-dom"),f=require("../../../../constants/numbers.cjs"),m=require("../../../../constants/generals.const.cjs"),K=require("../../../../constants/colorMode.const.cjs"),A=require("../../../../constants/keyboard.const.cjs"),t=require("../../../../constants/defaults.const.cjs");require("../../../../constants/openai.const.cjs");require("../../../../utils/paste.utils.cjs");const I=require("../../../../plugins/titles/titles.const.cjs"),M=require("../ToolbarDropdown/ToolbarDropdown.utils.cjs"),x=require("../ToolbarButton/ToolbarButton.cjs"),g=N=>{const{icon:v,disabled:c=!1,hint:R,onHint:p,pluginColor:b,onSelect:w}=N,[l,s]=r.useState(!1),[u,C]=r.useState({top:f.NUMBER_ZERO,left:f.NUMBER_ZERO}),a=r.useRef(null),_=r.useRef(null),d=r.useRef(null);return r.useEffect(()=>{if(!l)return;const e=()=>{const o=M.getToolbarDropdownMenuPosition(_.current);C({top:o.top,left:o.left})};e();const i=o=>{var T,S;const L=o.target;(T=a.current)!=null&&T.contains(L)||(S=d.current)!=null&&S.contains(L)||s(!1)},E=o=>{o.key===A.KEY_ESCAPE&&s(!1)};return document.addEventListener("mousedown",i),document.addEventListener("keydown",E),window.addEventListener("resize",e),window.addEventListener("scroll",e,!0),()=>{document.removeEventListener("mousedown",i),document.removeEventListener("keydown",E),window.removeEventListener("resize",e),window.removeEventListener("scroll",e,!0)}},[l]),n.jsxs("div",{className:t.INK_CLASS_TITLE_GALLERY,ref:a,children:[n.jsx("div",{ref:_,children:n.jsx(x.ToolbarButton,{icon:v,title:m.INK_TITLES_TITLE,hint:R,onHint:p,pluginColor:b,disabled:c,onClick:()=>{c||s(e=>!e)}})}),l?q.createPortal(n.jsx("div",{ref:d,className:`${t.INK_CLASS_STYLE_MENU} ${t.INK_CLASS_STYLE_MENU_PORTAL} ${t.INK_CLASS_STYLE_MENU_FORCED}`,"data-color-mode":K.COLOR_MODE_LIGHT,role:"listbox","aria-label":m.INK_TITLES_TITLE,style:{top:u.top,left:u.left},children:n.jsx("div",{className:t.INK_CLASS_TITLE_GRID,children:I.TITLE_STYLE_IDS.map(e=>n.jsx("button",{type:"button",className:t.INK_CLASS_TITLE_CELL,"aria-label":e,onMouseDown:i=>{i.preventDefault(),w(e),s(!1)},children:n.jsx("span",{className:`${t.INK_CLASS_TITLE} ${t.INK_CLASS_TITLE}--${e}`,children:I.TITLE_PREVIEW_TEXT})},e))})}),document.body):null]})};exports.TitleGallery=g;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),r=require("react"),C=require("react-dom"),f=require("../../../../constants/numbers.cjs"),m=require("../../../../constants/generals.const.cjs"),K=require("../../../../constants/colorMode.const.cjs"),A=require("../../../../constants/keyboard.const.cjs"),t=require("../../../../constants/defaults.const.cjs");require("../../../../constants/openai.const.cjs");require("../../../../utils/paste.utils.cjs");require("../../../../utils/exportDocument.utils.cjs");const I=require("../../../../plugins/titles/titles.const.cjs"),M=require("../ToolbarDropdown/ToolbarDropdown.utils.cjs"),x=require("../ToolbarButton/ToolbarButton.cjs"),g=N=>{const{icon:v,disabled:c=!1,hint:R,onHint:p,pluginColor:b,onSelect:w}=N,[l,s]=r.useState(!1),[u,q]=r.useState({top:f.NUMBER_ZERO,left:f.NUMBER_ZERO}),a=r.useRef(null),_=r.useRef(null),d=r.useRef(null);return r.useEffect(()=>{if(!l)return;const e=()=>{const o=M.getToolbarDropdownMenuPosition(_.current);q({top:o.top,left:o.left})};e();const i=o=>{var T,S;const L=o.target;(T=a.current)!=null&&T.contains(L)||(S=d.current)!=null&&S.contains(L)||s(!1)},E=o=>{o.key===A.KEY_ESCAPE&&s(!1)};return document.addEventListener("mousedown",i),document.addEventListener("keydown",E),window.addEventListener("resize",e),window.addEventListener("scroll",e,!0),()=>{document.removeEventListener("mousedown",i),document.removeEventListener("keydown",E),window.removeEventListener("resize",e),window.removeEventListener("scroll",e,!0)}},[l]),n.jsxs("div",{className:t.INK_CLASS_TITLE_GALLERY,ref:a,children:[n.jsx("div",{ref:_,children:n.jsx(x.ToolbarButton,{icon:v,title:m.INK_TITLES_TITLE,hint:R,onHint:p,pluginColor:b,disabled:c,onClick:()=>{c||s(e=>!e)}})}),l?C.createPortal(n.jsx("div",{ref:d,className:`${t.INK_CLASS_STYLE_MENU} ${t.INK_CLASS_STYLE_MENU_PORTAL} ${t.INK_CLASS_STYLE_MENU_FORCED}`,"data-color-mode":K.COLOR_MODE_LIGHT,role:"listbox","aria-label":m.INK_TITLES_TITLE,style:{top:u.top,left:u.left},children:n.jsx("div",{className:t.INK_CLASS_TITLE_GRID,children:I.TITLE_STYLE_IDS.map(e=>n.jsx("button",{type:"button",className:t.INK_CLASS_TITLE_CELL,"aria-label":e,onMouseDown:i=>{i.preventDefault(),w(e),s(!1)},children:n.jsx("span",{className:`${t.INK_CLASS_TITLE} ${t.INK_CLASS_TITLE}--${e}`,children:I.TITLE_PREVIEW_TEXT})},e))})}),document.body):null]})};exports.TitleGallery=g;
@@ -8,10 +8,11 @@ import { KEY_ESCAPE as h } from "../../../../constants/keyboard.const.js";
8
8
  import { INK_CLASS_TITLE_GALLERY as D, INK_CLASS_STYLE_MENU as O, INK_CLASS_STYLE_MENU_PORTAL as g, INK_CLASS_STYLE_MENU_FORCED as Y, INK_CLASS_TITLE_GRID as $, INK_CLASS_TITLE_CELL as x, INK_CLASS_TITLE as S } from "../../../../constants/defaults.const.js";
9
9
  import "../../../../constants/openai.const.js";
10
10
  import "../../../../utils/paste.utils.js";
11
+ import "../../../../utils/exportDocument.utils.js";
11
12
  import { TITLE_STYLE_IDS as y, TITLE_PREVIEW_TEXT as k } from "../../../../plugins/titles/titles.const.js";
12
13
  import { getToolbarDropdownMenuPosition as G } from "../ToolbarDropdown/ToolbarDropdown.utils.js";
13
14
  import { ToolbarButton as U } from "../ToolbarButton/ToolbarButton.js";
14
- const oe = (v) => {
15
+ const te = (v) => {
15
16
  const { icon: I, disabled: l = !1, hint: N, onHint: w, pluginColor: C, onSelect: R } = v, [i, n] = _(!1), [m, A] = _({ top: p, left: p }), a = s(null), c = s(null), E = s(null);
16
17
  return b(() => {
17
18
  if (!i) return;
@@ -75,5 +76,5 @@ const oe = (v) => {
75
76
  ] });
76
77
  };
77
78
  export {
78
- oe as TitleGallery
79
+ te as TitleGallery
79
80
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),p=require("../../../../constants/generals.const.cjs"),n=require("../../../../constants/defaults.const.cjs");require("../../../../constants/openai.const.cjs");require("../../../../utils/paste.utils.cjs");const N=require("../../../../common-components/Button/Button.cjs");require("react");require("react-dom");const S=a=>{const{icon:u,title:s,hint:l,onHint:e,pluginColor:t,active:o=!1,onClick:i,disabled:c=!1,className:d}=a,_=b=>{b.preventDefault()},q=l||s;return r.jsx("span",{className:n.INK_CLASS_TOOL_WRAP,onMouseEnter:()=>e==null?void 0:e(q),onMouseLeave:()=>e==null?void 0:e(p.EMPTY_STRING),children:r.jsxs(N.Button,{title:s,"aria-label":s,"aria-pressed":o,disabled:c,active:o,className:d,onMouseDown:_,onClick:i,children:[u,t?r.jsx("span",{className:n.INK_CLASS_PLUGIN_PIP,style:{background:t},"aria-hidden":!0}):null]})})};exports.ToolbarButton=S;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),p=require("../../../../constants/generals.const.cjs"),n=require("../../../../constants/defaults.const.cjs");require("../../../../constants/openai.const.cjs");require("../../../../utils/paste.utils.cjs");require("../../../../utils/exportDocument.utils.cjs");const N=require("../../../../common-components/Button/Button.cjs");require("react");require("react-dom");const S=a=>{const{icon:u,title:r,hint:l,onHint:e,pluginColor:t,active:o=!1,onClick:i,disabled:c=!1,className:d}=a,q=b=>{b.preventDefault()},_=l||r;return s.jsx("span",{className:n.INK_CLASS_TOOL_WRAP,onMouseEnter:()=>e==null?void 0:e(_),onMouseLeave:()=>e==null?void 0:e(p.EMPTY_STRING),children:s.jsxs(N.Button,{title:r,"aria-label":r,"aria-pressed":o,disabled:c,active:o,className:d,onMouseDown:q,onClick:i,children:[u,t?s.jsx("span",{className:n.INK_CLASS_PLUGIN_PIP,style:{background:t},"aria-hidden":!0}):null]})})};exports.ToolbarButton=S;
@@ -1,26 +1,27 @@
1
- import { jsx as t, jsxs as f } from "react/jsx-runtime";
1
+ import { jsx as s, jsxs as f } from "react/jsx-runtime";
2
2
  import { EMPTY_STRING as N } from "../../../../constants/generals.const.js";
3
3
  import { INK_CLASS_TOOL_WRAP as _, INK_CLASS_PLUGIN_PIP as I } from "../../../../constants/defaults.const.js";
4
4
  import "../../../../constants/openai.const.js";
5
5
  import "../../../../utils/paste.utils.js";
6
+ import "../../../../utils/exportDocument.utils.js";
6
7
  import { Button as L } from "../../../../common-components/Button/Button.js";
7
8
  import "react";
8
9
  import "react-dom";
9
- const x = (a) => {
10
+ const A = (a) => {
10
11
  const {
11
- icon: l,
12
+ icon: i,
12
13
  title: e,
13
- hint: i,
14
+ hint: l,
14
15
  onHint: o,
15
16
  pluginColor: r,
16
- active: s = !1,
17
+ active: t = !1,
17
18
  onClick: n,
18
19
  disabled: m = !1,
19
20
  className: p
20
21
  } = a, c = (d) => {
21
22
  d.preventDefault();
22
- }, u = i || e;
23
- return /* @__PURE__ */ t(
23
+ }, u = l || e;
24
+ return /* @__PURE__ */ s(
24
25
  "span",
25
26
  {
26
27
  className: _,
@@ -31,15 +32,15 @@ const x = (a) => {
31
32
  {
32
33
  title: e,
33
34
  "aria-label": e,
34
- "aria-pressed": s,
35
+ "aria-pressed": t,
35
36
  disabled: m,
36
- active: s,
37
+ active: t,
37
38
  className: p,
38
39
  onMouseDown: c,
39
40
  onClick: n,
40
41
  children: [
41
- l,
42
- r ? /* @__PURE__ */ t("span", { className: I, style: { background: r }, "aria-hidden": !0 }) : null
42
+ i,
43
+ r ? /* @__PURE__ */ s("span", { className: I, style: { background: r }, "aria-hidden": !0 }) : null
43
44
  ]
44
45
  }
45
46
  )
@@ -47,5 +48,5 @@ const x = (a) => {
47
48
  );
48
49
  };
49
50
  export {
50
- x as ToolbarButton
51
+ A as ToolbarButton
51
52
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),c=require("../../../../constants/defaults.const.cjs");require("../../../../constants/openai.const.cjs");require("../../../../utils/paste.utils.cjs");require("react");require("react-dom");const u=a=>{const{value:t,onChange:s,title:l,disabled:i=!1,type:o="text"}=a,n=r=>{s(r.target.value)};return e.jsxs("label",{className:"Ink-Editor__color",title:l,"aria-label":l,children:[e.jsx("span",{className:"Ink-Editor__color-swatch",style:{background:t},"data-type":o}),e.jsx("input",{type:"color",value:t,disabled:i,onChange:n,list:`ink-colors-${o}`}),e.jsx("datalist",{id:`ink-colors-${o}`,children:c.INK_COLOR_SWATCHES.map(r=>e.jsx("option",{value:r},r))})]})};exports.ToolbarColorPicker=u;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),c=require("../../../../constants/defaults.const.cjs");require("../../../../constants/openai.const.cjs");require("../../../../utils/paste.utils.cjs");require("../../../../utils/exportDocument.utils.cjs");require("react");require("react-dom");const u=a=>{const{value:t,onChange:s,title:l,disabled:i=!1,type:o="text"}=a,n=r=>{s(r.target.value)};return e.jsxs("label",{className:"Ink-Editor__color",title:l,"aria-label":l,children:[e.jsx("span",{className:"Ink-Editor__color-swatch",style:{background:t},"data-type":o}),e.jsx("input",{type:"color",value:t,disabled:i,onChange:n,list:`ink-colors-${o}`}),e.jsx("datalist",{id:`ink-colors-${o}`,children:c.INK_COLOR_SWATCHES.map(r=>e.jsx("option",{value:r},r))})]})};exports.ToolbarColorPicker=u;
@@ -1,28 +1,29 @@
1
1
  import { jsxs as s, jsx as t } from "react/jsx-runtime";
2
- import { INK_COLOR_SWATCHES as c } from "../../../../constants/defaults.const.js";
2
+ import { INK_COLOR_SWATCHES as p } from "../../../../constants/defaults.const.js";
3
3
  import "../../../../constants/openai.const.js";
4
4
  import "../../../../utils/paste.utils.js";
5
+ import "../../../../utils/exportDocument.utils.js";
5
6
  import "react";
6
7
  import "react-dom";
7
- const u = (r) => {
8
- const { value: e, onChange: n, title: l, disabled: i = !1, type: a = "text" } = r;
9
- return /* @__PURE__ */ s("label", { className: "Ink-Editor__color", title: l, "aria-label": l, children: [
8
+ const _ = (l) => {
9
+ const { value: e, onChange: i, title: r, disabled: n = !1, type: a = "text" } = l;
10
+ return /* @__PURE__ */ s("label", { className: "Ink-Editor__color", title: r, "aria-label": r, children: [
10
11
  /* @__PURE__ */ t("span", { className: "Ink-Editor__color-swatch", style: { background: e }, "data-type": a }),
11
12
  /* @__PURE__ */ t(
12
13
  "input",
13
14
  {
14
15
  type: "color",
15
16
  value: e,
16
- disabled: i,
17
+ disabled: n,
17
18
  onChange: (o) => {
18
- n(o.target.value);
19
+ i(o.target.value);
19
20
  },
20
21
  list: `ink-colors-${a}`
21
22
  }
22
23
  ),
23
- /* @__PURE__ */ t("datalist", { id: `ink-colors-${a}`, children: c.map((o) => /* @__PURE__ */ t("option", { value: o }, o)) })
24
+ /* @__PURE__ */ t("datalist", { id: `ink-colors-${a}`, children: p.map((o) => /* @__PURE__ */ t("option", { value: o }, o)) })
24
25
  ] });
25
26
  };
26
27
  export {
27
- u as ToolbarColorPicker
28
+ _ as ToolbarColorPicker
28
29
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),A=require("../../../../constants/toolbarMenu.const.cjs");require("../../../../constants/openai.const.cjs");require("../../../../utils/paste.utils.cjs");const C=require("../../../../common-components/Button/Button.cjs");require("react");require("react-dom");const s=require("./ToolbarCustomize.const.cjs"),I=t=>{const{open:T,options:n,visibleItems:O,onToggle:a,onClose:i,title:r=s.TOOLBAR_CUSTOMIZE_DEFAULT_TITLE,closeLabel:c=s.TOOLBAR_CUSTOMIZE_DEFAULT_CLOSE,listAriaLabel:o=s.TOOLBAR_CUSTOMIZE_DEFAULT_LIST_ARIA}=t;if(!T)return null;const _=new Set(O);return e.jsxs("div",{className:s.TOOLBAR_CUSTOMIZE_CLASS,"aria-label":r,children:[e.jsx("p",{className:s.TOOLBAR_CUSTOMIZE_TITLE_CLASS,children:r}),e.jsx("ul",{className:s.TOOLBAR_CUSTOMIZE_LIST_CLASS,"aria-label":o,children:n.map(l=>{const L=_.has(l),S=A.TOOLBAR_OPTION_LABELS[l]??l;return e.jsx("li",{className:s.TOOLBAR_CUSTOMIZE_ITEM_CLASS,children:e.jsxs("label",{children:[e.jsx("input",{type:s.TOOLBAR_CUSTOMIZE_INPUT_TYPE,checked:L,onChange:u=>a(l,u.target.checked)}),e.jsx("span",{children:S})]})},l)})}),e.jsx("div",{className:s.TOOLBAR_CUSTOMIZE_ACTIONS_CLASS,children:e.jsx(C.Button,{type:"button",onClick:i,children:c})})]})};exports.ToolbarCustomize=I;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),A=require("../../../../constants/toolbarMenu.const.cjs");require("../../../../constants/openai.const.cjs");require("../../../../utils/paste.utils.cjs");require("../../../../utils/exportDocument.utils.cjs");const C=require("../../../../common-components/Button/Button.cjs");require("react");require("react-dom");const s=require("./ToolbarCustomize.const.cjs"),I=t=>{const{open:T,options:n,visibleItems:i,onToggle:O,onClose:a,title:l=s.TOOLBAR_CUSTOMIZE_DEFAULT_TITLE,closeLabel:c=s.TOOLBAR_CUSTOMIZE_DEFAULT_CLOSE,listAriaLabel:o=s.TOOLBAR_CUSTOMIZE_DEFAULT_LIST_ARIA}=t;if(!T)return null;const _=new Set(i);return e.jsxs("div",{className:s.TOOLBAR_CUSTOMIZE_CLASS,"aria-label":l,children:[e.jsx("p",{className:s.TOOLBAR_CUSTOMIZE_TITLE_CLASS,children:l}),e.jsx("ul",{className:s.TOOLBAR_CUSTOMIZE_LIST_CLASS,"aria-label":o,children:n.map(r=>{const L=_.has(r),S=A.TOOLBAR_OPTION_LABELS[r]??r;return e.jsx("li",{className:s.TOOLBAR_CUSTOMIZE_ITEM_CLASS,children:e.jsxs("label",{children:[e.jsx("input",{type:s.TOOLBAR_CUSTOMIZE_INPUT_TYPE,checked:L,onChange:u=>O(r,u.target.checked)}),e.jsx("span",{children:S})]})},r)})}),e.jsx("div",{className:s.TOOLBAR_CUSTOMIZE_ACTIONS_CLASS,children:e.jsx(C.Button,{type:"button",onClick:a,children:c})})]})};exports.ToolbarCustomize=I;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const T=require("../../../../constants/toolbarMenu.const.cjs");require("../../../../constants/openai.const.cjs");require("react/jsx-runtime");require("../../../../utils/paste.utils.cjs");require("react");require("react-dom");const _="Ink-ToolbarCustomize",O="Ink-ToolbarCustomize__title",L="Ink-ToolbarCustomize__list",S="Ink-ToolbarCustomize__item",A="Ink-ToolbarCustomize__actions",I=T.TOOLBAR_CUSTOMIZE_TITLE,C=T.TOOLBAR_CUSTOMIZE_CLOSE_LABEL,E=T.TOOLBAR_CUSTOMIZE_LIST_ARIA_LABEL,o="checkbox";exports.TOOLBAR_CUSTOMIZE_ACTIONS_CLASS=A;exports.TOOLBAR_CUSTOMIZE_CLASS=_;exports.TOOLBAR_CUSTOMIZE_DEFAULT_CLOSE=C;exports.TOOLBAR_CUSTOMIZE_DEFAULT_LIST_ARIA=E;exports.TOOLBAR_CUSTOMIZE_DEFAULT_TITLE=I;exports.TOOLBAR_CUSTOMIZE_INPUT_TYPE=o;exports.TOOLBAR_CUSTOMIZE_ITEM_CLASS=S;exports.TOOLBAR_CUSTOMIZE_LIST_CLASS=L;exports.TOOLBAR_CUSTOMIZE_TITLE_CLASS=O;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const T=require("../../../../constants/toolbarMenu.const.cjs");require("../../../../constants/openai.const.cjs");require("react/jsx-runtime");require("../../../../utils/paste.utils.cjs");require("../../../../utils/exportDocument.utils.cjs");require("react");require("react-dom");const _="Ink-ToolbarCustomize",O="Ink-ToolbarCustomize__title",L="Ink-ToolbarCustomize__list",S="Ink-ToolbarCustomize__item",A="Ink-ToolbarCustomize__actions",I=T.TOOLBAR_CUSTOMIZE_TITLE,C=T.TOOLBAR_CUSTOMIZE_CLOSE_LABEL,E=T.TOOLBAR_CUSTOMIZE_LIST_ARIA_LABEL,o="checkbox";exports.TOOLBAR_CUSTOMIZE_ACTIONS_CLASS=A;exports.TOOLBAR_CUSTOMIZE_CLASS=_;exports.TOOLBAR_CUSTOMIZE_DEFAULT_CLOSE=C;exports.TOOLBAR_CUSTOMIZE_DEFAULT_LIST_ARIA=E;exports.TOOLBAR_CUSTOMIZE_DEFAULT_TITLE=I;exports.TOOLBAR_CUSTOMIZE_INPUT_TYPE=o;exports.TOOLBAR_CUSTOMIZE_ITEM_CLASS=S;exports.TOOLBAR_CUSTOMIZE_LIST_CLASS=L;exports.TOOLBAR_CUSTOMIZE_TITLE_CLASS=O;
@@ -2,17 +2,18 @@ import { TOOLBAR_CUSTOMIZE_LIST_ARIA_LABEL as T, TOOLBAR_CUSTOMIZE_TITLE as _, T
2
2
  import "../../../../constants/openai.const.js";
3
3
  import "react/jsx-runtime";
4
4
  import "../../../../utils/paste.utils.js";
5
+ import "../../../../utils/exportDocument.utils.js";
5
6
  import "react";
6
7
  import "react-dom";
7
- const C = "Ink-ToolbarCustomize", E = "Ink-ToolbarCustomize__title", s = "Ink-ToolbarCustomize__list", U = "Ink-ToolbarCustomize__item", i = "Ink-ToolbarCustomize__actions", n = _, B = O, R = T, m = "checkbox";
8
+ const E = "Ink-ToolbarCustomize", i = "Ink-ToolbarCustomize__title", s = "Ink-ToolbarCustomize__list", U = "Ink-ToolbarCustomize__item", n = "Ink-ToolbarCustomize__actions", m = _, r = O, B = T, R = "checkbox";
8
9
  export {
9
- i as TOOLBAR_CUSTOMIZE_ACTIONS_CLASS,
10
- C as TOOLBAR_CUSTOMIZE_CLASS,
11
- B as TOOLBAR_CUSTOMIZE_DEFAULT_CLOSE,
12
- R as TOOLBAR_CUSTOMIZE_DEFAULT_LIST_ARIA,
13
- n as TOOLBAR_CUSTOMIZE_DEFAULT_TITLE,
14
- m as TOOLBAR_CUSTOMIZE_INPUT_TYPE,
10
+ n as TOOLBAR_CUSTOMIZE_ACTIONS_CLASS,
11
+ E as TOOLBAR_CUSTOMIZE_CLASS,
12
+ r as TOOLBAR_CUSTOMIZE_DEFAULT_CLOSE,
13
+ B as TOOLBAR_CUSTOMIZE_DEFAULT_LIST_ARIA,
14
+ m as TOOLBAR_CUSTOMIZE_DEFAULT_TITLE,
15
+ R as TOOLBAR_CUSTOMIZE_INPUT_TYPE,
15
16
  U as TOOLBAR_CUSTOMIZE_ITEM_CLASS,
16
17
  s as TOOLBAR_CUSTOMIZE_LIST_CLASS,
17
- E as TOOLBAR_CUSTOMIZE_TITLE_CLASS
18
+ i as TOOLBAR_CUSTOMIZE_TITLE_CLASS
18
19
  };
@@ -1,12 +1,13 @@
1
- import { jsxs as O, jsx as e } from "react/jsx-runtime";
1
+ import { jsxs as r, jsx as e } from "react/jsx-runtime";
2
2
  import { TOOLBAR_OPTION_LABELS as m } from "../../../../constants/toolbarMenu.const.js";
3
3
  import "../../../../constants/openai.const.js";
4
4
  import "../../../../utils/paste.utils.js";
5
+ import "../../../../utils/exportDocument.utils.js";
5
6
  import { Button as C } from "../../../../common-components/Button/Button.js";
6
7
  import "react";
7
8
  import "react-dom";
8
- import { TOOLBAR_CUSTOMIZE_DEFAULT_LIST_ARIA as I, TOOLBAR_CUSTOMIZE_DEFAULT_TITLE as E, TOOLBAR_CUSTOMIZE_DEFAULT_CLOSE as d, TOOLBAR_CUSTOMIZE_CLASS as p, TOOLBAR_CUSTOMIZE_TITLE_CLASS as U, TOOLBAR_CUSTOMIZE_LIST_CLASS as h, TOOLBAR_CUSTOMIZE_ITEM_CLASS as B, TOOLBAR_CUSTOMIZE_INPUT_TYPE as R, TOOLBAR_CUSTOMIZE_ACTIONS_CLASS as b } from "./ToolbarCustomize.const.js";
9
- const x = (r) => {
9
+ import { TOOLBAR_CUSTOMIZE_DEFAULT_LIST_ARIA as I, TOOLBAR_CUSTOMIZE_DEFAULT_TITLE as E, TOOLBAR_CUSTOMIZE_DEFAULT_CLOSE as p, TOOLBAR_CUSTOMIZE_CLASS as d, TOOLBAR_CUSTOMIZE_TITLE_CLASS as U, TOOLBAR_CUSTOMIZE_LIST_CLASS as h, TOOLBAR_CUSTOMIZE_ITEM_CLASS as B, TOOLBAR_CUSTOMIZE_INPUT_TYPE as R, TOOLBAR_CUSTOMIZE_ACTIONS_CLASS as b } from "./ToolbarCustomize.const.js";
10
+ const D = (O) => {
10
11
  const {
11
12
  open: t,
12
13
  options: _,
@@ -14,16 +15,16 @@ const x = (r) => {
14
15
  onToggle: i,
15
16
  onClose: s,
16
17
  title: T = E,
17
- closeLabel: L = d,
18
+ closeLabel: L = p,
18
19
  listAriaLabel: n = I
19
- } = r;
20
+ } = O;
20
21
  if (!t) return null;
21
22
  const o = new Set(a);
22
- return /* @__PURE__ */ O("div", { className: p, "aria-label": T, children: [
23
+ return /* @__PURE__ */ r("div", { className: d, "aria-label": T, children: [
23
24
  /* @__PURE__ */ e("p", { className: U, children: T }),
24
25
  /* @__PURE__ */ e("ul", { className: h, "aria-label": n, children: _.map((l) => {
25
26
  const S = o.has(l), c = m[l] ?? l;
26
- return /* @__PURE__ */ e("li", { className: B, children: /* @__PURE__ */ O("label", { children: [
27
+ return /* @__PURE__ */ e("li", { className: B, children: /* @__PURE__ */ r("label", { children: [
27
28
  /* @__PURE__ */ e(
28
29
  "input",
29
30
  {
@@ -39,5 +40,5 @@ const x = (r) => {
39
40
  ] });
40
41
  };
41
42
  export {
42
- x as ToolbarCustomize
43
+ D as ToolbarCustomize
43
44
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),r=require("react"),O=require("react-dom"),c=require("../../../../constants/numbers.cjs"),u=require("../../../../constants/generals.const.cjs"),g=require("../../../../constants/colorMode.const.cjs"),x=require("../../../../constants/keyboard.const.cjs"),n=require("../../../../constants/defaults.const.cjs");require("../../../../constants/openai.const.cjs");require("../../../../utils/paste.utils.cjs");const D=require("./ToolbarDropdown.utils.cjs"),K=()=>t.jsx("svg",{className:n.INK_CLASS_STYLE_CHEV,viewBox:"0 0 10 10","aria-hidden":"true",children:t.jsx("path",{d:"M2 3.5L5 6.5L8 3.5",stroke:"currentColor",strokeWidth:"1.4",fill:"none"})}),P=R=>{const{options:d,value:L,onChange:b,title:_,disabled:f=!1}=R,[i,l]=r.useState(!1),[E,w]=r.useState({top:c.NUMBER_ZERO,left:c.NUMBER_ZERO,minWidth:c.NUMBER_ZERO}),m=r.useRef(null),N=r.useRef(null),T=r.useRef(null),S=d.find(e=>e.value===L)??d[c.NUMBER_ZERO],I=(S==null?void 0:S.label)??u.EMPTY_STRING;r.useEffect(()=>{if(!i)return;const e=()=>{w(D.getToolbarDropdownMenuPosition(N.current))};e();const o=s=>{var p,C;const v=s.target;(p=m.current)!=null&&p.contains(v)||(C=T.current)!=null&&C.contains(v)||l(!1)},a=s=>{s.key===x.KEY_ESCAPE&&l(!1)};return document.addEventListener("mousedown",o),document.addEventListener("keydown",a),window.addEventListener("resize",e),window.addEventListener("scroll",e,!0),()=>{document.removeEventListener("mousedown",o),document.removeEventListener("keydown",a),window.removeEventListener("resize",e),window.removeEventListener("scroll",e,!0)}},[i]);const M=e=>{e.preventDefault()},h=()=>{f||l(e=>!e)};return t.jsxs("div",{className:n.INK_CLASS_STYLE_DD,ref:m,children:[t.jsxs("button",{ref:N,type:"button",className:n.INK_CLASS_STYLE_TRIGGER,title:_,"aria-label":_,"aria-haspopup":"listbox","aria-expanded":i,disabled:f,onMouseDown:M,onClick:h,children:[t.jsx("span",{children:I}),t.jsx(K,{})]}),i?O.createPortal(t.jsx("div",{ref:T,className:`${n.INK_CLASS_STYLE_MENU} ${n.INK_CLASS_STYLE_MENU_PORTAL} ${n.INK_CLASS_STYLE_MENU_FORCED}`,"data-color-mode":g.COLOR_MODE_LIGHT,role:"listbox","aria-label":_,style:{top:E.top,left:E.left,minWidth:E.minWidth},children:d.map(e=>{const o=e.value===L,a=`${n.INK_CLASS_STYLE_OPTION}${o?`${u.SPACE_STRING}${n.INK_CLASS_STYLE_OPTION_SEL}`:u.EMPTY_STRING}`;return t.jsxs("button",{type:"button",role:"option","aria-selected":o,className:a,onMouseDown:s=>{s.preventDefault(),b(e.value),l(!1)},children:[o?t.jsx("span",{className:n.INK_CLASS_STYLE_CHECK,"aria-hidden":"true",children:u.INK_STYLE_CHECK}):null,e.label]},e.value)})}),document.body):null]})};exports.ToolbarDropdown=P;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),r=require("react"),O=require("react-dom"),u=require("../../../../constants/numbers.cjs"),c=require("../../../../constants/generals.const.cjs"),g=require("../../../../constants/colorMode.const.cjs"),x=require("../../../../constants/keyboard.const.cjs"),n=require("../../../../constants/defaults.const.cjs");require("../../../../constants/openai.const.cjs");require("../../../../utils/paste.utils.cjs");require("../../../../utils/exportDocument.utils.cjs");const D=require("./ToolbarDropdown.utils.cjs"),K=()=>t.jsx("svg",{className:n.INK_CLASS_STYLE_CHEV,viewBox:"0 0 10 10","aria-hidden":"true",children:t.jsx("path",{d:"M2 3.5L5 6.5L8 3.5",stroke:"currentColor",strokeWidth:"1.4",fill:"none"})}),P=R=>{const{options:d,value:L,onChange:b,title:_,disabled:f=!1}=R,[i,l]=r.useState(!1),[E,w]=r.useState({top:u.NUMBER_ZERO,left:u.NUMBER_ZERO,minWidth:u.NUMBER_ZERO}),m=r.useRef(null),N=r.useRef(null),T=r.useRef(null),S=d.find(e=>e.value===L)??d[u.NUMBER_ZERO],I=(S==null?void 0:S.label)??c.EMPTY_STRING;r.useEffect(()=>{if(!i)return;const e=()=>{w(D.getToolbarDropdownMenuPosition(N.current))};e();const o=s=>{var p,C;const v=s.target;(p=m.current)!=null&&p.contains(v)||(C=T.current)!=null&&C.contains(v)||l(!1)},a=s=>{s.key===x.KEY_ESCAPE&&l(!1)};return document.addEventListener("mousedown",o),document.addEventListener("keydown",a),window.addEventListener("resize",e),window.addEventListener("scroll",e,!0),()=>{document.removeEventListener("mousedown",o),document.removeEventListener("keydown",a),window.removeEventListener("resize",e),window.removeEventListener("scroll",e,!0)}},[i]);const M=e=>{e.preventDefault()},h=()=>{f||l(e=>!e)};return t.jsxs("div",{className:n.INK_CLASS_STYLE_DD,ref:m,children:[t.jsxs("button",{ref:N,type:"button",className:n.INK_CLASS_STYLE_TRIGGER,title:_,"aria-label":_,"aria-haspopup":"listbox","aria-expanded":i,disabled:f,onMouseDown:M,onClick:h,children:[t.jsx("span",{children:I}),t.jsx(K,{})]}),i?O.createPortal(t.jsx("div",{ref:T,className:`${n.INK_CLASS_STYLE_MENU} ${n.INK_CLASS_STYLE_MENU_PORTAL} ${n.INK_CLASS_STYLE_MENU_FORCED}`,"data-color-mode":g.COLOR_MODE_LIGHT,role:"listbox","aria-label":_,style:{top:E.top,left:E.left,minWidth:E.minWidth},children:d.map(e=>{const o=e.value===L,a=`${n.INK_CLASS_STYLE_OPTION}${o?`${c.SPACE_STRING}${n.INK_CLASS_STYLE_OPTION_SEL}`:c.EMPTY_STRING}`;return t.jsxs("button",{type:"button",role:"option","aria-selected":o,className:a,onMouseDown:s=>{s.preventDefault(),b(e.value),l(!1)},children:[o?t.jsx("span",{className:n.INK_CLASS_STYLE_CHECK,"aria-hidden":"true",children:c.INK_STYLE_CHECK}):null,e.label]},e.value)})}),document.body):null]})};exports.ToolbarDropdown=P;