@forgedevstack/ink 1.1.9 → 1.2.1

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,4 +1,4 @@
1
- import { jsxs as m, jsx as n } from "react/jsx-runtime";
1
+ import { jsxs as m, jsx as t } from "react/jsx-runtime";
2
2
  import { useState as C, useRef as _, useEffect as K } from "react";
3
3
  import { createPortal as M } from "react-dom";
4
4
  import { NUMBER_ZERO as l } from "../../../../constants/numbers.js";
@@ -8,25 +8,26 @@ import { KEY_ESCAPE as Y } from "../../../../constants/keyboard.const.js";
8
8
  import { INK_CLASS_STYLE_DD as O, INK_CLASS_STYLE_TRIGGER as P, INK_CLASS_STYLE_MENU as y, INK_CLASS_STYLE_MENU_PORTAL as x, INK_CLASS_STYLE_MENU_FORCED as $, INK_CLASS_STYLE_OPTION as k, INK_CLASS_STYLE_OPTION_SEL as G, INK_CLASS_STYLE_CHECK as H, INK_CLASS_STYLE_CHEV as U } 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 W } from "./ToolbarDropdown.utils.js";
12
- const j = () => /* @__PURE__ */ n("svg", { className: U, viewBox: "0 0 10 10", "aria-hidden": "true", children: /* @__PURE__ */ n("path", { d: "M2 3.5L5 6.5L8 3.5", stroke: "currentColor", strokeWidth: "1.4", fill: "none" }) }), re = (h) => {
13
+ const j = () => /* @__PURE__ */ t("svg", { className: U, viewBox: "0 0 10 10", "aria-hidden": "true", children: /* @__PURE__ */ t("path", { d: "M2 3.5L5 6.5L8 3.5", stroke: "currentColor", strokeWidth: "1.4", fill: "none" }) }), se = (h) => {
13
14
  const { options: a, value: E, onChange: I, title: c, disabled: S = !1 } = h, [r, s] = C(!1), [d, b] = C({
14
15
  top: l,
15
16
  left: l,
16
17
  minWidth: l
17
- }), f = _(null), L = _(null), p = _(null), u = a.find((e) => e.value === E) ?? a[l], g = (u == null ? void 0 : u.label) ?? w;
18
+ }), f = _(null), p = _(null), L = _(null), u = a.find((e) => e.value === E) ?? a[l], g = (u == null ? void 0 : u.label) ?? w;
18
19
  return K(() => {
19
20
  if (!r) return;
20
21
  const e = () => {
21
- b(W(L.current));
22
+ b(W(p.current));
22
23
  };
23
24
  e();
24
- const o = (t) => {
25
+ const o = (n) => {
25
26
  var N, T;
26
- const v = t.target;
27
- (N = f.current) != null && N.contains(v) || (T = p.current) != null && T.contains(v) || s(!1);
28
- }, i = (t) => {
29
- t.key === Y && s(!1);
27
+ const v = n.target;
28
+ (N = f.current) != null && N.contains(v) || (T = L.current) != null && T.contains(v) || s(!1);
29
+ }, i = (n) => {
30
+ n.key === Y && s(!1);
30
31
  };
31
32
  return document.addEventListener("mousedown", o), document.addEventListener("keydown", i), window.addEventListener("resize", e), window.addEventListener("scroll", e, !0), () => {
32
33
  document.removeEventListener("mousedown", o), document.removeEventListener("keydown", i), window.removeEventListener("resize", e), window.removeEventListener("scroll", e, !0);
@@ -35,7 +36,7 @@ const j = () => /* @__PURE__ */ n("svg", { className: U, viewBox: "0 0 10 10", "
35
36
  /* @__PURE__ */ m(
36
37
  "button",
37
38
  {
38
- ref: L,
39
+ ref: p,
39
40
  type: "button",
40
41
  className: P,
41
42
  title: c,
@@ -50,16 +51,16 @@ const j = () => /* @__PURE__ */ n("svg", { className: U, viewBox: "0 0 10 10", "
50
51
  S || s((e) => !e);
51
52
  },
52
53
  children: [
53
- /* @__PURE__ */ n("span", { children: g }),
54
- /* @__PURE__ */ n(j, {})
54
+ /* @__PURE__ */ t("span", { children: g }),
55
+ /* @__PURE__ */ t(j, {})
55
56
  ]
56
57
  }
57
58
  ),
58
59
  r ? M(
59
- /* @__PURE__ */ n(
60
+ /* @__PURE__ */ t(
60
61
  "div",
61
62
  {
62
- ref: p,
63
+ ref: L,
63
64
  className: `${y} ${x} ${$}`,
64
65
  "data-color-mode": D,
65
66
  role: "listbox",
@@ -74,11 +75,11 @@ const j = () => /* @__PURE__ */ n("svg", { className: U, viewBox: "0 0 10 10", "
74
75
  role: "option",
75
76
  "aria-selected": o,
76
77
  className: i,
77
- onMouseDown: (t) => {
78
- t.preventDefault(), I(e.value), s(!1);
78
+ onMouseDown: (n) => {
79
+ n.preventDefault(), I(e.value), s(!1);
79
80
  },
80
81
  children: [
81
- o ? /* @__PURE__ */ n("span", { className: H, "aria-hidden": "true", children: A }) : null,
82
+ o ? /* @__PURE__ */ t("span", { className: H, "aria-hidden": "true", children: A }) : null,
82
83
  e.label
83
84
  ]
84
85
  },
@@ -92,5 +93,5 @@ const j = () => /* @__PURE__ */ n("svg", { className: U, viewBox: "0 0 10 10", "
92
93
  ] });
93
94
  };
94
95
  export {
95
- re as ToolbarDropdown
96
+ se as ToolbarDropdown
96
97
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _=require("../../../../constants/numbers.cjs");require("../../../../constants/openai.const.cjs");require("react/jsx-runtime");require("../../../../utils/paste.utils.cjs");require("react");require("react-dom");const c=(E,o=_.INK_STYLE_MENU_ESTIMATED_HEIGHT_PX)=>{if(!E)return{top:_.NUMBER_ZERO,left:_.NUMBER_ZERO,minWidth:_.INK_STYLE_MENU_MIN_WIDTH_PX};const t=E.getBoundingClientRect(),r=window.innerWidth,N=window.innerHeight,e=Math.max(t.width,_.INK_STYLE_MENU_MIN_WIDTH_PX),M=Math.max(_.INK_STYLE_MENU_EDGE_PX,r-e-_.INK_STYLE_MENU_EDGE_PX),T=Math.min(Math.max(t.left,_.INK_STYLE_MENU_EDGE_PX),M),n=o>_.NUMBER_ZERO?o:_.INK_STYLE_MENU_ESTIMATED_HEIGHT_PX,i=t.bottom+_.INK_STYLE_MENU_GAP_PX,I=t.top-n-_.INK_STYLE_MENU_GAP_PX;return{top:i+n>N-_.INK_STYLE_MENU_EDGE_PX?Math.max(_.INK_STYLE_MENU_EDGE_PX,I):i,left:T,minWidth:e}};exports.getToolbarDropdownMenuPosition=c;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _=require("../../../../constants/numbers.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 u=(E,e=_.INK_STYLE_MENU_ESTIMATED_HEIGHT_PX)=>{if(!E)return{top:_.NUMBER_ZERO,left:_.NUMBER_ZERO,minWidth:_.INK_STYLE_MENU_MIN_WIDTH_PX};const t=E.getBoundingClientRect(),r=window.innerWidth,N=window.innerHeight,o=Math.max(t.width,_.INK_STYLE_MENU_MIN_WIDTH_PX),M=Math.max(_.INK_STYLE_MENU_EDGE_PX,r-o-_.INK_STYLE_MENU_EDGE_PX),T=Math.min(Math.max(t.left,_.INK_STYLE_MENU_EDGE_PX),M),n=e>_.NUMBER_ZERO?e:_.INK_STYLE_MENU_ESTIMATED_HEIGHT_PX,i=t.bottom+_.INK_STYLE_MENU_GAP_PX,I=t.top-n-_.INK_STYLE_MENU_GAP_PX;return{top:i+n>N-_.INK_STYLE_MENU_EDGE_PX?Math.max(_.INK_STYLE_MENU_EDGE_PX,I):i,left:T,minWidth:o}};exports.getToolbarDropdownMenuPosition=u;
@@ -1,15 +1,16 @@
1
- import { INK_STYLE_MENU_ESTIMATED_HEIGHT_PX as E, INK_STYLE_MENU_MIN_WIDTH_PX as p, NUMBER_ZERO as n, INK_STYLE_MENU_EDGE_PX as t, INK_STYLE_MENU_GAP_PX as c } from "../../../../constants/numbers.js";
1
+ import { INK_STYLE_MENU_ESTIMATED_HEIGHT_PX as p, INK_STYLE_MENU_MIN_WIDTH_PX as E, NUMBER_ZERO as n, INK_STYLE_MENU_EDGE_PX as t, INK_STYLE_MENU_GAP_PX as c } from "../../../../constants/numbers.js";
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 P = (i, e = E) => {
8
+ const u = (i, e = p) => {
8
9
  if (!i)
9
- return { top: n, left: n, minWidth: p };
10
- const o = i.getBoundingClientRect(), M = window.innerWidth, h = window.innerHeight, _ = Math.max(o.width, p), a = Math.max(t, M - _ - t), s = Math.min(Math.max(o.left, t), a), r = e > n ? e : E, m = o.bottom + c, N = o.top - r - c;
10
+ return { top: n, left: n, minWidth: E };
11
+ const o = i.getBoundingClientRect(), M = window.innerWidth, h = window.innerHeight, _ = Math.max(o.width, E), a = Math.max(t, M - _ - t), s = Math.min(Math.max(o.left, t), a), r = e > n ? e : p, m = o.bottom + c, N = o.top - r - c;
11
12
  return { top: m + r > h - t ? Math.max(t, N) : m, left: s, minWidth: _ };
12
13
  };
13
14
  export {
14
- P as getToolbarDropdownMenuPosition
15
+ u as getToolbarDropdownMenuPosition
15
16
  };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),l=t=>{const{versions:n,onSave:o,onRestore:i,onCompare:r,onClose:a}=t;return s.jsxs("aside",{className:"Ink-Versions","aria-label":"Version history",children:[s.jsxs("div",{className:"Ink-Versions__header",children:[s.jsx("strong",{children:"Versions"}),s.jsx("button",{type:"button",className:"Ink-Editor__button Ink-Editor__button--active",onClick:o,children:"Save snapshot"}),s.jsx("button",{type:"button",className:"Ink-Editor__button",onClick:a,children:"×"})]}),s.jsx("div",{className:"Ink-Versions__list",children:n.length===0?s.jsx("p",{className:"Ink-Versions__empty",children:"No snapshots yet."}):n.map(e=>s.jsxs("article",{className:"Ink-Versions__item",children:[s.jsx("strong",{children:e.name}),s.jsx("time",{children:new Date(e.savedAt).toLocaleString()}),s.jsxs("div",{className:"Ink-Versions__actions",children:[s.jsx("button",{type:"button",className:"Ink-Editor__button",onClick:()=>i(e),children:"Restore"}),s.jsx("button",{type:"button",className:"Ink-Editor__button",onClick:()=>r(e),children:"Compare"})]})]},e.id))})]})};exports.VersionHistory=l;
@@ -0,0 +1,11 @@
1
+ import { FC } from 'react';
2
+ import { InkDocumentVersion } from '../../../../utils/versions.utils';
3
+ export interface VersionHistoryProps {
4
+ versions: InkDocumentVersion[];
5
+ onSave: () => void;
6
+ onRestore: (version: InkDocumentVersion) => void;
7
+ onCompare: (version: InkDocumentVersion) => void;
8
+ onClose: () => void;
9
+ }
10
+ export declare const VersionHistory: FC<VersionHistoryProps>;
11
+ //# sourceMappingURL=VersionHistory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"VersionHistory.d.ts","sourceRoot":"","sources":["../../../../../src/components/InkEditor/components/VersionHistory/VersionHistory.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAChC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AAE3E,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,kBAAkB,EAAE,CAAC;IAC/B,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,SAAS,EAAE,CAAC,OAAO,EAAE,kBAAkB,KAAK,IAAI,CAAC;IACjD,SAAS,EAAE,CAAC,OAAO,EAAE,kBAAkB,KAAK,IAAI,CAAC;IACjD,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED,eAAO,MAAM,cAAc,EAAE,EAAE,CAAC,mBAAmB,CAmClD,CAAC"}
@@ -0,0 +1,22 @@
1
+ import { jsxs as e, jsx as n } from "react/jsx-runtime";
2
+ const d = (o) => {
3
+ const { versions: s, onSave: i, onRestore: r, onCompare: a, onClose: l } = o;
4
+ return /* @__PURE__ */ e("aside", { className: "Ink-Versions", "aria-label": "Version history", children: [
5
+ /* @__PURE__ */ e("div", { className: "Ink-Versions__header", children: [
6
+ /* @__PURE__ */ n("strong", { children: "Versions" }),
7
+ /* @__PURE__ */ n("button", { type: "button", className: "Ink-Editor__button Ink-Editor__button--active", onClick: i, children: "Save snapshot" }),
8
+ /* @__PURE__ */ n("button", { type: "button", className: "Ink-Editor__button", onClick: l, children: "×" })
9
+ ] }),
10
+ /* @__PURE__ */ n("div", { className: "Ink-Versions__list", children: s.length === 0 ? /* @__PURE__ */ n("p", { className: "Ink-Versions__empty", children: "No snapshots yet." }) : s.map((t) => /* @__PURE__ */ e("article", { className: "Ink-Versions__item", children: [
11
+ /* @__PURE__ */ n("strong", { children: t.name }),
12
+ /* @__PURE__ */ n("time", { children: new Date(t.savedAt).toLocaleString() }),
13
+ /* @__PURE__ */ e("div", { className: "Ink-Versions__actions", children: [
14
+ /* @__PURE__ */ n("button", { type: "button", className: "Ink-Editor__button", onClick: () => r(t), children: "Restore" }),
15
+ /* @__PURE__ */ n("button", { type: "button", className: "Ink-Editor__button", onClick: () => a(t), children: "Compare" })
16
+ ] })
17
+ ] }, t.id)) })
18
+ ] });
19
+ };
20
+ export {
21
+ d as VersionHistory
22
+ };
@@ -0,0 +1,3 @@
1
+ export { VersionHistory } from './VersionHistory';
2
+ export type { VersionHistoryProps } from './VersionHistory';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/InkEditor/components/VersionHistory/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,YAAY,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC"}
@@ -3,6 +3,9 @@ export { ToolbarDropdown } from './ToolbarDropdown';
3
3
  export { ToolbarColorPicker } from './ToolbarColorPicker';
4
4
  export { CommentsPanel } from './CommentsPanel';
5
5
  export { AiPanel } from './AiPanel';
6
+ export { AiSelectionBubble } from './AiSelectionBubble';
7
+ export { capabilityForSelectionAction, htmlFromAiResponse, optionsForSelectionAction, placeAiSelectionBubble, } from './AiSelectionBubble';
8
+ export type { AiSelectionBubbleProps } from './AiSelectionBubble';
6
9
  export { AiAutocomplete, AI_AUTOCOMPLETE_DEBOUNCE_MS, AI_AUTOCOMPLETE_MAX_PREFIX_CHARS, AI_AUTOCOMPLETE_COMMAND_INSERT_TEXT, getTextBeforeCaret, getCaretPositionInRoot, } from './AiAutocomplete';
7
10
  export type { AiAutocompleteProps, AiAutocompletePosition } from './AiAutocomplete';
8
11
  export { BlockHandles, BLOCK_HANDLES_DRAG_EFFECT_MOVE, BLOCK_HANDLES_DRAG_MIME, BLOCK_HANDLES_DRAG_PAYLOAD, } from './BlockHandles';
@@ -12,6 +15,10 @@ export { SlashMenu } from './SlashMenu';
12
15
  export { OutlineRail } from './OutlineRail';
13
16
  export type { OutlineRailProps } from './OutlineRail';
14
17
  export { TrackChangesBar } from './TrackChangesBar';
18
+ export { VersionHistory } from './VersionHistory';
19
+ export type { VersionHistoryProps } from './VersionHistory';
20
+ export { MentionMenu } from './MentionMenu';
21
+ export { ImageFrame } from './ImageFrame';
15
22
  export { SignPad } from './SignPad';
16
23
  export { FindReplace } from './FindReplace';
17
24
  export { ToolbarCustomize } from './ToolbarCustomize';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/InkEditor/components/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EACL,cAAc,EACd,2BAA2B,EAC3B,gCAAgC,EAChC,mCAAmC,EACnC,kBAAkB,EAClB,sBAAsB,GACvB,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AACpF,OAAO,EACL,YAAY,EACZ,8BAA8B,EAC9B,uBAAuB,EACvB,0BAA0B,GAC3B,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,aAAa,EACb,0BAA0B,EAC1B,wBAAwB,EACxB,8BAA8B,EAC9B,kCAAkC,EAClC,iCAAiC,EACjC,qBAAqB,GACtB,MAAM,iBAAiB,CAAC;AACzB,YAAY,EACV,yBAAyB,EACzB,kBAAkB,GACnB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,YAAY,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,YAAY,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,YAAY,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,YAAY,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,YAAY,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,YAAY,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,YAAY,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,YAAY,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAC3E,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,YAAY,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,YAAY,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,YAAY,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/InkEditor/components/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EACL,4BAA4B,EAC5B,kBAAkB,EAClB,yBAAyB,EACzB,sBAAsB,GACvB,MAAM,qBAAqB,CAAC;AAC7B,YAAY,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAClE,OAAO,EACL,cAAc,EACd,2BAA2B,EAC3B,gCAAgC,EAChC,mCAAmC,EACnC,kBAAkB,EAClB,sBAAsB,GACvB,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AACpF,OAAO,EACL,YAAY,EACZ,8BAA8B,EAC9B,uBAAuB,EACvB,0BAA0B,GAC3B,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,aAAa,EACb,0BAA0B,EAC1B,wBAAwB,EACxB,8BAA8B,EAC9B,kCAAkC,EAClC,iCAAiC,EACjC,qBAAqB,GACtB,MAAM,iBAAiB,CAAC;AACzB,YAAY,EACV,yBAAyB,EACzB,kBAAkB,GACnB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,YAAY,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,YAAY,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,YAAY,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,YAAY,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,YAAY,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,YAAY,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,YAAY,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,YAAY,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,YAAY,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAC3E,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,YAAY,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,YAAY,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,YAAY,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC"}
@@ -1,2 +1,3 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("../../../constants/numbers.cjs"),l=require("../../../constants/fonts.const.cjs"),r=require("../../../constants/lists.const.cjs"),R=require("../../../constants/blocks.const.cjs");require("../../../constants/openai.const.cjs");require("react/jsx-runtime");const p=require("../../../utils/blocks.utils.cjs");require("../../../utils/paste.utils.cjs");require("react");require("react-dom");const M="color",y="background-color",g="background",A="color",d="style",I=1,U=3,D="removeFormat",S="insertUnorderedList",m="insertOrderedList",h="superscript",P="subscript",H="styleWithCSS",i=(t,e)=>document.execCommand(t,!1,e),c=t=>document.queryCommandState(t),B=t=>document.queryCommandValue(t),w="http://",f="https://",Y="mailto:",b="&amp;",q="&lt;",F="&gt;",k="&quot;",v=t=>t.replace(/&/g,b).replace(/</g,q).replace(/>/g,F).replace(/"/g,k),W=(t,e="")=>{if(!t)return!1;const o=t.startsWith(w)||t.startsWith(f)||t.startsWith(Y)?t:`${f}${t}`,n=window.getSelection();return(!n||n.isCollapsed)&&e?i("insertHTML",`<a href="${o}">${v(e)}</a>`):i("createLink",o)},x=t=>i("foreColor",t),K=t=>i("hiliteColor",t),C=t=>i("insertHTML",t),V=(t,e="")=>{const o=e.replace(/"/g,"&quot;");return C(`<img src="${t}" alt="${o}" style="max-width:100%;height:auto;" />`)},Z=t=>new Promise((e,o)=>{const n=new FileReader;n.onload=()=>e(String(n.result)),n.onerror=o,n.readAsDataURL(t)}),G=()=>{const t=new Set;return c("bold")&&t.add("bold"),c("italic")&&t.add("italic"),c("underline")&&t.add("underline"),c("strikeThrough")&&t.add("strikethrough"),c(S)&&t.add("bulletList"),c(m)&&t.add("orderedList"),c(h)&&t.add("superscript"),c(P)&&t.add("subscript"),t},O=t=>{t.style.removeProperty(M),t.style.removeProperty(y),t.style.removeProperty(g),t.hasAttribute(A)&&t.removeAttribute(A);const e=t.getAttribute(d);e!==null&&!e.trim()&&t.removeAttribute(d)},N=()=>{const t=window.getSelection();if(!t||t.rangeCount===a.NUMBER_ZERO)return;const o=t.getRangeAt(a.NUMBER_ZERO).commonAncestorContainer,n=o.nodeType===I?o:o.parentElement;n&&(n instanceof HTMLElement&&t.containsNode(n,!0)&&O(n),n.querySelectorAll("*").forEach(s=>{s instanceof HTMLElement&&t.containsNode(s,!0)&&O(s)}))},$=()=>{const t=i(D);return N(),t},j=t=>{const e=l.FONT_FAMILY_BY_VALUE[t]??t;if(i(H,"true"),t===l.FONT_VALUE_SYSTEM){const o=window.getSelection();if(!o||o.rangeCount===a.NUMBER_ZERO||o.isCollapsed)return i(l.FONT_COMMAND_NAME,e);const n=o.getRangeAt(a.NUMBER_ZERO),s=document.createElement("span");s.style.setProperty(l.FONT_STYLE_PROPERTY,e);try{return n.surroundContents(s),!0}catch{return i(l.FONT_COMMAND_NAME,e)}}return i(l.FONT_COMMAND_NAME,t)},Q=t=>{t.classList.remove(r.LIST_CLASS_DASH,r.LIST_CLASS_ALPHA),t.style.removeProperty("list-style-type")},X=t=>{t===r.LIST_VALUE_BULLET||t===r.LIST_VALUE_DASH?i(S):i(m);const e=window.getSelection();let n=(e==null?void 0:e.anchorNode)??null,s=null;for(;n;){if(n instanceof HTMLElement&&(n.tagName===r.LIST_TAG_UL||n.tagName===r.LIST_TAG_OL)){s=n;break}n=n.parentNode}return s&&(Q(s),t===r.LIST_VALUE_BULLET?s.style.listStyleType=r.LIST_STYLE_DISC:t===r.LIST_VALUE_DASH?s.classList.add(r.LIST_CLASS_DASH):t===r.LIST_VALUE_NUMBERS?s.style.listStyleType=r.LIST_STYLE_DECIMAL:t===r.LIST_VALUE_LETTERS&&(s.classList.add(r.LIST_CLASS_ALPHA),s.style.listStyleType=r.LIST_STYLE_LOWER_ALPHA)),!0},z=()=>{const t=window.getSelection();let e=(t==null?void 0:t.anchorNode)??null;for(;e;){if(e instanceof HTMLElement){if(e.tagName===r.LIST_TAG_UL)return e.classList.contains(r.LIST_CLASS_DASH)?r.LIST_VALUE_DASH:r.LIST_VALUE_BULLET;if(e.tagName===r.LIST_TAG_OL)return e.classList.contains(r.LIST_CLASS_ALPHA)||e.style.listStyleType===r.LIST_STYLE_LOWER_ALPHA?r.LIST_VALUE_LETTERS:r.LIST_VALUE_NUMBERS}e=e.parentNode}return r.LIST_VALUE_BULLET},J=(t,e)=>{const o=window.getSelection(),n=p.getBlockElement((o==null?void 0:o.anchorNode)??null,t);return n?(n.setAttribute(R.DIR_ATTRIBUTE,e),!0):!1},tt=t=>{if(t.key!==r.LIST_MARKDOWN_SPACE)return!1;const e=window.getSelection();if(!e||!e.isCollapsed||e.rangeCount===a.NUMBER_ZERO)return!1;const o=e.anchorNode;if(!o||o.nodeType!==U)return!1;const n=o.textContent??"",s=e.anchorOffset,T=n.slice(a.NUMBER_ZERO,s),E=T.endsWith(r.LIST_MARKDOWN_DASH)?r.LIST_MARKDOWN_DASH:T.endsWith(r.LIST_MARKDOWN_STAR)?r.LIST_MARKDOWN_STAR:null;if(!E)return!1;const L=s-E.length;if(L<a.NUMBER_ZERO)return!1;const u=L>a.NUMBER_ZERO?T[L-1]:"";if(u&&u!==`
2
- `)return!1;t.preventDefault();const _=e.getRangeAt(a.NUMBER_ZERO);return _.setStart(o,L),_.setEnd(o,s),_.deleteContents(),i(S),!0};exports.applyFontFamily=j;exports.applyListType=X;exports.clearFormatDeep=$;exports.detectListType=z;exports.execCommand=i;exports.fileToDataUrl=Z;exports.getActiveFormats=G;exports.insertHTML=C;exports.insertImage=V;exports.insertLink=W;exports.queryCommandState=c;exports.queryCommandValue=B;exports.setBlockDirection=J;exports.setHighlightColor=K;exports.setTextColor=x;exports.stripSelectionColors=N;exports.tryConvertMarkdownListPrefix=tt;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("../../../constants/numbers.cjs"),S=require("../../../constants/fonts.const.cjs"),n=require("../../../constants/lists.const.cjs"),M=require("../../../constants/blocks.const.cjs");require("../../../constants/openai.const.cjs");require("react/jsx-runtime");const y=require("../../../utils/blocks.utils.cjs");require("../../../utils/paste.utils.cjs");require("../../../utils/exportDocument.utils.cjs");require("react");require("react-dom");const g="color",I="background-color",U="background",E="color",A="style",D=1,O=3,h="removeFormat",d="insertUnorderedList",f="insertOrderedList",B="superscript",P="subscript",k="styleWithCSS",i=(e,t)=>document.execCommand(e,!1,t),l=e=>document.queryCommandState(e),w=e=>document.queryCommandValue(e),H="http://",m="https://",x="mailto:",v="&amp;",b="&lt;",q="&gt;",F="&quot;",Y=e=>e.replace(/&/g,v).replace(/</g,b).replace(/>/g,q).replace(/"/g,F),W=(e,t="")=>{if(!e)return!1;const r=e.startsWith(H)||e.startsWith(m)||e.startsWith(x)?e:`${m}${e}`,o=window.getSelection();return(!o||o.isCollapsed)&&t?i("insertHTML",`<a href="${r}">${Y(t)}</a>`):i("createLink",r)},K=e=>i("foreColor",e),Z=e=>i("hiliteColor",e),C=e=>i("insertHTML",e),V=(e,t="")=>{const r=t.replace(/"/g,"&quot;");return C(`<img src="${e}" alt="${r}" style="max-width:100%;height:auto;" />`)},G=e=>new Promise((t,r)=>{const o=new FileReader;o.onload=()=>t(String(o.result)),o.onerror=r,o.readAsDataURL(e)}),$=()=>{const e=new Set;return l("bold")&&e.add("bold"),l("italic")&&e.add("italic"),l("underline")&&e.add("underline"),l("strikeThrough")&&e.add("strikethrough"),l(d)&&e.add("bulletList"),l(f)&&e.add("orderedList"),l(B)&&e.add("superscript"),l(P)&&e.add("subscript"),e},R=e=>{e.style.removeProperty(g),e.style.removeProperty(I),e.style.removeProperty(U),e.hasAttribute(E)&&e.removeAttribute(E);const t=e.getAttribute(A);t!==null&&!t.trim()&&e.removeAttribute(A)},p=()=>{const e=window.getSelection();if(!e||e.rangeCount===c.NUMBER_ZERO)return;const r=e.getRangeAt(c.NUMBER_ZERO).commonAncestorContainer,o=r.nodeType===D?r:r.parentElement;o&&(o instanceof HTMLElement&&e.containsNode(o,!0)&&R(o),o.querySelectorAll("*").forEach(s=>{s instanceof HTMLElement&&e.containsNode(s,!0)&&R(s)}))},X=()=>{const e=i(h);return p(),e},j=e=>{const t=S.FONT_FAMILY_BY_VALUE[e]??e;if(i(k,"true"),e===S.FONT_VALUE_SYSTEM){const r=window.getSelection();if(!r||r.rangeCount===c.NUMBER_ZERO||r.isCollapsed)return i(S.FONT_COMMAND_NAME,t);const o=r.getRangeAt(c.NUMBER_ZERO),s=document.createElement("span");s.style.setProperty(S.FONT_STYLE_PROPERTY,t);try{return o.surroundContents(s),!0}catch{return i(S.FONT_COMMAND_NAME,t)}}return i(S.FONT_COMMAND_NAME,e)},Q=e=>{e.classList.remove(n.LIST_CLASS_DASH,n.LIST_CLASS_ALPHA),e.style.removeProperty("list-style-type")},z=e=>{e===n.LIST_VALUE_BULLET||e===n.LIST_VALUE_DASH?i(d):i(f);const t=window.getSelection();let o=(t==null?void 0:t.anchorNode)??null,s=null;for(;o;){if(o instanceof HTMLElement&&(o.tagName===n.LIST_TAG_UL||o.tagName===n.LIST_TAG_OL)){s=o;break}o=o.parentNode}return s&&(Q(s),e===n.LIST_VALUE_BULLET?s.style.listStyleType=n.LIST_STYLE_DISC:e===n.LIST_VALUE_DASH?s.classList.add(n.LIST_CLASS_DASH):e===n.LIST_VALUE_NUMBERS?s.style.listStyleType=n.LIST_STYLE_DECIMAL:e===n.LIST_VALUE_LETTERS&&(s.classList.add(n.LIST_CLASS_ALPHA),s.style.listStyleType=n.LIST_STYLE_LOWER_ALPHA)),!0},J=()=>{const e=window.getSelection();let t=(e==null?void 0:e.anchorNode)??null;for(;t;){if(t instanceof HTMLElement){if(t.tagName===n.LIST_TAG_UL)return t.classList.contains(n.LIST_CLASS_DASH)?n.LIST_VALUE_DASH:n.LIST_VALUE_BULLET;if(t.tagName===n.LIST_TAG_OL)return t.classList.contains(n.LIST_CLASS_ALPHA)||t.style.listStyleType===n.LIST_STYLE_LOWER_ALPHA?n.LIST_VALUE_LETTERS:n.LIST_VALUE_NUMBERS}t=t.parentNode}return n.LIST_VALUE_BULLET},ee=(e,t)=>{const r=window.getSelection(),o=y.getBlockElement((r==null?void 0:r.anchorNode)??null,e);return o?(o.setAttribute(M.DIR_ATTRIBUTE,t),!0):!1},te=[{prefix:"###",command:"formatBlock",value:"h3"},{prefix:"##",command:"formatBlock",value:"h2"},{prefix:"#",command:"formatBlock",value:"h1"},{prefix:">",command:"formatBlock",value:"blockquote"},{prefix:"1.",command:f}],re=e=>{if(e.key!==n.LIST_MARKDOWN_SPACE)return!1;const t=window.getSelection();if(!t||!t.isCollapsed||t.rangeCount===c.NUMBER_ZERO)return!1;const r=t.anchorNode;if(!r||r.nodeType!==O)return!1;const o=r.textContent??"",s=t.anchorOffset,T=o.slice(c.NUMBER_ZERO,s),a=te.find(N=>T.endsWith(N.prefix));if(!a)return!1;const _=s-a.prefix.length,u=_>c.NUMBER_ZERO?T[_-1]:"";if(u&&u!==`
2
+ `)return!1;e.preventDefault();const L=t.getRangeAt(c.NUMBER_ZERO);return L.setStart(r,_),L.setEnd(r,s),L.deleteContents(),a.value?i(a.command,a.value):i(a.command),!0},ne=e=>{if(e.key!==n.LIST_MARKDOWN_SPACE)return!1;const t=window.getSelection();if(!t||!t.isCollapsed||t.rangeCount===c.NUMBER_ZERO)return!1;const r=t.anchorNode;if(!r||r.nodeType!==O)return!1;const o=r.textContent??"",s=t.anchorOffset,T=o.slice(c.NUMBER_ZERO,s),a=T.endsWith(n.LIST_MARKDOWN_DASH)?n.LIST_MARKDOWN_DASH:T.endsWith(n.LIST_MARKDOWN_STAR)?n.LIST_MARKDOWN_STAR:null;if(!a)return!1;const _=s-a.length;if(_<c.NUMBER_ZERO)return!1;const u=_>c.NUMBER_ZERO?T[_-1]:"";if(u&&u!==`
3
+ `)return!1;e.preventDefault();const L=t.getRangeAt(c.NUMBER_ZERO);return L.setStart(r,_),L.setEnd(r,s),L.deleteContents(),i(d),!0};exports.applyFontFamily=j;exports.applyListType=z;exports.clearFormatDeep=X;exports.detectListType=J;exports.execCommand=i;exports.fileToDataUrl=G;exports.getActiveFormats=$;exports.insertHTML=C;exports.insertImage=V;exports.insertLink=W;exports.queryCommandState=l;exports.queryCommandValue=w;exports.setBlockDirection=ee;exports.setHighlightColor=Z;exports.setTextColor=K;exports.stripSelectionColors=p;exports.tryConvertMarkdownBlockPrefix=re;exports.tryConvertMarkdownListPrefix=ne;
@@ -16,6 +16,7 @@ export declare const applyFontFamily: (fontValue: string) => boolean;
16
16
  export declare const applyListType: (listValue: string) => boolean;
17
17
  export declare const detectListType: () => string;
18
18
  export declare const setBlockDirection: (root: HTMLElement, direction: typeof DIR_LTR | typeof DIR_RTL) => boolean;
19
+ export declare const tryConvertMarkdownBlockPrefix: (event: KeyboardEvent) => boolean;
19
20
  export declare const tryConvertMarkdownListPrefix: (event: KeyboardEvent) => boolean;
20
21
  export declare const isSelectionInListItem: () => boolean;
21
22
  export declare const applyFormat: (format: ToolbarOption) => boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"format.utils.d.ts","sourceRoot":"","sources":["../../../../src/components/InkEditor/helpers/format.utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,EAEL,OAAO,EACP,OAAO,EAqBR,MAAM,oBAAoB,CAAC;AAiB5B,eAAO,MAAM,WAAW,GAAI,SAAS,MAAM,EAAE,QAAQ,MAAM,KAAG,OACjB,CAAC;AAE9C,eAAO,MAAM,iBAAiB,GAAI,SAAS,MAAM,KAAG,OACf,CAAC;AAEtC,eAAO,MAAM,iBAAiB,GAAI,SAAS,MAAM,KAAG,MACf,CAAC;AAiBtC,eAAO,MAAM,UAAU,GAAI,KAAK,MAAM,EAAE,qBAAiB,KAAG,OAa3D,CAAC;AAEF,eAAO,MAAM,YAAY,GAAI,OAAO,MAAM,KAAG,OAA0C,CAAC;AAExF,eAAO,MAAM,iBAAiB,GAAI,OAAO,MAAM,KAAG,OAA4C,CAAC;AAE/F,eAAO,MAAM,UAAU,GAAI,MAAM,MAAM,KAAG,OAA0C,CAAC;AAErF,eAAO,MAAM,WAAW,GAAI,KAAK,MAAM,EAAE,YAAQ,KAAG,OAGnD,CAAC;AAEF,eAAO,MAAM,aAAa,GAAI,MAAM,IAAI,KAAG,OAAO,CAAC,MAAM,CAMrD,CAAC;AAEL,eAAO,MAAM,gBAAgB,QAAO,GAAG,CAAC,MAAM,CAW7C,CAAC;AAeF,eAAO,MAAM,oBAAoB,QAAO,IAkBvC,CAAC;AAEF,eAAO,MAAM,eAAe,QAAO,OAIlC,CAAC;AAEF,eAAO,MAAM,eAAe,GAAI,WAAW,MAAM,KAAG,OAmBnD,CAAC;AAOF,eAAO,MAAM,aAAa,GAAI,WAAW,MAAM,KAAG,OAgCjD,CAAC;AAEF,eAAO,MAAM,cAAc,QAAO,MAsBjC,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAC5B,MAAM,WAAW,EACjB,WAAW,OAAO,OAAO,GAAG,OAAO,OAAO,KACzC,OAMF,CAAC;AAEF,eAAO,MAAM,4BAA4B,GAAI,OAAO,aAAa,KAAG,OA4BnE,CAAC;AAEF,eAAO,MAAM,qBAAqB,QAAO,OAUxC,CAAC;AAEF,eAAO,MAAM,WAAW,GAAI,QAAQ,aAAa,KAAG,OA6BnD,CAAC"}
1
+ {"version":3,"file":"format.utils.d.ts","sourceRoot":"","sources":["../../../../src/components/InkEditor/helpers/format.utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,EAEL,OAAO,EACP,OAAO,EAqBR,MAAM,oBAAoB,CAAC;AAiB5B,eAAO,MAAM,WAAW,GAAI,SAAS,MAAM,EAAE,QAAQ,MAAM,KAAG,OACjB,CAAC;AAE9C,eAAO,MAAM,iBAAiB,GAAI,SAAS,MAAM,KAAG,OACf,CAAC;AAEtC,eAAO,MAAM,iBAAiB,GAAI,SAAS,MAAM,KAAG,MACf,CAAC;AAiBtC,eAAO,MAAM,UAAU,GAAI,KAAK,MAAM,EAAE,qBAAiB,KAAG,OAa3D,CAAC;AAEF,eAAO,MAAM,YAAY,GAAI,OAAO,MAAM,KAAG,OAA0C,CAAC;AAExF,eAAO,MAAM,iBAAiB,GAAI,OAAO,MAAM,KAAG,OAA4C,CAAC;AAE/F,eAAO,MAAM,UAAU,GAAI,MAAM,MAAM,KAAG,OAA0C,CAAC;AAErF,eAAO,MAAM,WAAW,GAAI,KAAK,MAAM,EAAE,YAAQ,KAAG,OAGnD,CAAC;AAEF,eAAO,MAAM,aAAa,GAAI,MAAM,IAAI,KAAG,OAAO,CAAC,MAAM,CAMrD,CAAC;AAEL,eAAO,MAAM,gBAAgB,QAAO,GAAG,CAAC,MAAM,CAW7C,CAAC;AAeF,eAAO,MAAM,oBAAoB,QAAO,IAkBvC,CAAC;AAEF,eAAO,MAAM,eAAe,QAAO,OAIlC,CAAC;AAEF,eAAO,MAAM,eAAe,GAAI,WAAW,MAAM,KAAG,OAmBnD,CAAC;AAOF,eAAO,MAAM,aAAa,GAAI,WAAW,MAAM,KAAG,OAgCjD,CAAC;AAEF,eAAO,MAAM,cAAc,QAAO,MAsBjC,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAC5B,MAAM,WAAW,EACjB,WAAW,OAAO,OAAO,GAAG,OAAO,OAAO,KACzC,OAMF,CAAC;AAUF,eAAO,MAAM,6BAA6B,GAAI,OAAO,aAAa,KAAG,OAsBpE,CAAC;AAEF,eAAO,MAAM,4BAA4B,GAAI,OAAO,aAAa,KAAG,OA4BnE,CAAC;AAEF,eAAO,MAAM,qBAAqB,QAAO,OAUxC,CAAC;AAEF,eAAO,MAAM,WAAW,GAAI,QAAQ,aAAa,KAAG,OA6BnD,CAAC"}
@@ -1,119 +1,141 @@
1
- import { NUMBER_ZERO as i } from "../../../constants/numbers.js";
2
- import { FONT_VALUE_SYSTEM as P, FONT_FAMILY_BY_VALUE as w, FONT_COMMAND_NAME as d, FONT_STYLE_PROPERTY as U } from "../../../constants/fonts.const.js";
3
- import { LIST_TAG_UL as N, LIST_CLASS_DASH as _, LIST_VALUE_DASH as u, LIST_VALUE_BULLET as l, LIST_TAG_OL as R, LIST_CLASS_ALPHA as f, LIST_STYLE_LOWER_ALPHA as M, LIST_VALUE_LETTERS as I, LIST_VALUE_NUMBERS as h, LIST_MARKDOWN_SPACE as Y, LIST_MARKDOWN_DASH as E, LIST_MARKDOWN_STAR as A, LIST_STYLE_DISC as H, LIST_STYLE_DECIMAL as b } from "../../../constants/lists.const.js";
4
- import { DIR_ATTRIBUTE as k } from "../../../constants/blocks.const.js";
1
+ import { NUMBER_ZERO as c } from "../../../constants/numbers.js";
2
+ import { FONT_VALUE_SYSTEM as U, FONT_FAMILY_BY_VALUE as x, FONT_COMMAND_NAME as m, FONT_STYLE_PROPERTY as Y } from "../../../constants/fonts.const.js";
3
+ import { LIST_MARKDOWN_SPACE as h, LIST_MARKDOWN_DASH as A, LIST_MARKDOWN_STAR as C, LIST_TAG_UL as R, LIST_CLASS_DASH as _, LIST_VALUE_DASH as L, LIST_VALUE_BULLET as u, LIST_TAG_OL as M, LIST_CLASS_ALPHA as S, LIST_STYLE_LOWER_ALPHA as I, LIST_VALUE_LETTERS as D, LIST_VALUE_NUMBERS as P, LIST_STYLE_DISC as v, LIST_STYLE_DECIMAL as B } from "../../../constants/lists.const.js";
4
+ import { DIR_ATTRIBUTE as b } from "../../../constants/blocks.const.js";
5
5
  import "../../../constants/openai.const.js";
6
6
  import "react/jsx-runtime";
7
- import { getBlockElement as F } from "../../../utils/blocks.utils.js";
7
+ import { getBlockElement as H } from "../../../utils/blocks.utils.js";
8
8
  import "../../../utils/paste.utils.js";
9
+ import "../../../utils/exportDocument.utils.js";
9
10
  import "react";
10
11
  import "react-dom";
11
- const v = "color", B = "background-color", W = "background", C = "color", y = "style", x = 1, K = 3, q = "removeFormat", S = "insertUnorderedList", D = "insertOrderedList", $ = "superscript", G = "subscript", V = "styleWithCSS", s = (t, e) => document.execCommand(t, !1, e), c = (t) => document.queryCommandState(t), _t = (t) => document.queryCommandValue(t), Q = "http://", O = "https://", X = "mailto:", Z = "&amp;", j = "&lt;", z = "&gt;", J = "&quot;", tt = (t) => t.replace(/&/g, Z).replace(/</g, j).replace(/>/g, z).replace(/"/g, J), ft = (t, e = "") => {
12
+ const F = "color", W = "background-color", K = "background", g = "color", y = "style", q = 1, w = 3, $ = "removeFormat", p = "insertUnorderedList", E = "insertOrderedList", G = "superscript", V = "subscript", X = "styleWithCSS", s = (t, e) => document.execCommand(t, !1, e), l = (t) => document.queryCommandState(t), St = (t) => document.queryCommandValue(t), Q = "http://", O = "https://", Z = "mailto:", j = "&amp;", z = "&lt;", J = "&gt;", tt = "&quot;", et = (t) => t.replace(/&/g, j).replace(/</g, z).replace(/>/g, J).replace(/"/g, tt), pt = (t, e = "") => {
12
13
  if (!t) return !1;
13
- const n = t.startsWith(Q) || t.startsWith(O) || t.startsWith(X) ? t : `${O}${t}`, r = window.getSelection();
14
- return (!r || r.isCollapsed) && e ? s("insertHTML", `<a href="${n}">${tt(e)}</a>`) : s("createLink", n);
15
- }, St = (t) => s("foreColor", t), mt = (t) => s("hiliteColor", t), et = (t) => s("insertHTML", t), pt = (t, e = "") => {
16
- const n = e.replace(/"/g, "&quot;");
17
- return et(`<img src="${t}" alt="${n}" style="max-width:100%;height:auto;" />`);
18
- }, Et = (t) => new Promise((e, n) => {
19
- const r = new FileReader();
20
- r.onload = () => e(String(r.result)), r.onerror = n, r.readAsDataURL(t);
21
- }), At = () => {
14
+ const o = t.startsWith(Q) || t.startsWith(O) || t.startsWith(Z) ? t : `${O}${t}`, n = window.getSelection();
15
+ return (!n || n.isCollapsed) && e ? s("insertHTML", `<a href="${o}">${et(e)}</a>`) : s("createLink", o);
16
+ }, Et = (t) => s("foreColor", t), At = (t) => s("hiliteColor", t), ot = (t) => s("insertHTML", t), Ct = (t, e = "") => {
17
+ const o = e.replace(/"/g, "&quot;");
18
+ return ot(`<img src="${t}" alt="${o}" style="max-width:100%;height:auto;" />`);
19
+ }, gt = (t) => new Promise((e, o) => {
20
+ const n = new FileReader();
21
+ n.onload = () => e(String(n.result)), n.onerror = o, n.readAsDataURL(t);
22
+ }), yt = () => {
22
23
  const t = /* @__PURE__ */ new Set();
23
- return c("bold") && t.add("bold"), c("italic") && t.add("italic"), c("underline") && t.add("underline"), c("strikeThrough") && t.add("strikethrough"), c(S) && t.add("bulletList"), c(D) && t.add("orderedList"), c($) && t.add("superscript"), c(G) && t.add("subscript"), t;
24
- }, g = (t) => {
25
- t.style.removeProperty(v), t.style.removeProperty(B), t.style.removeProperty(W), t.hasAttribute(C) && t.removeAttribute(C);
24
+ return l("bold") && t.add("bold"), l("italic") && t.add("italic"), l("underline") && t.add("underline"), l("strikeThrough") && t.add("strikethrough"), l(p) && t.add("bulletList"), l(E) && t.add("orderedList"), l(G) && t.add("superscript"), l(V) && t.add("subscript"), t;
25
+ }, N = (t) => {
26
+ t.style.removeProperty(F), t.style.removeProperty(W), t.style.removeProperty(K), t.hasAttribute(g) && t.removeAttribute(g);
26
27
  const e = t.getAttribute(y);
27
28
  e !== null && !e.trim() && t.removeAttribute(y);
28
- }, rt = () => {
29
+ }, nt = () => {
29
30
  const t = window.getSelection();
30
- if (!t || t.rangeCount === i) return;
31
- const n = t.getRangeAt(i).commonAncestorContainer, r = n.nodeType === x ? n : n.parentElement;
32
- r && (r instanceof HTMLElement && t.containsNode(r, !0) && g(r), r.querySelectorAll("*").forEach((o) => {
33
- o instanceof HTMLElement && t.containsNode(o, !0) && g(o);
31
+ if (!t || t.rangeCount === c) return;
32
+ const o = t.getRangeAt(c).commonAncestorContainer, n = o.nodeType === q ? o : o.parentElement;
33
+ n && (n instanceof HTMLElement && t.containsNode(n, !0) && N(n), n.querySelectorAll("*").forEach((r) => {
34
+ r instanceof HTMLElement && t.containsNode(r, !0) && N(r);
34
35
  }));
35
- }, Ct = () => {
36
- const t = s(q);
37
- return rt(), t;
38
- }, yt = (t) => {
39
- const e = w[t] ?? t;
40
- if (s(V, "true"), t === P) {
41
- const n = window.getSelection();
42
- if (!n || n.rangeCount === i || n.isCollapsed)
43
- return s(d, e);
44
- const r = n.getRangeAt(i), o = document.createElement("span");
45
- o.style.setProperty(U, e);
36
+ }, Ot = () => {
37
+ const t = s($);
38
+ return nt(), t;
39
+ }, Nt = (t) => {
40
+ const e = x[t] ?? t;
41
+ if (s(X, "true"), t === U) {
42
+ const o = window.getSelection();
43
+ if (!o || o.rangeCount === c || o.isCollapsed)
44
+ return s(m, e);
45
+ const n = o.getRangeAt(c), r = document.createElement("span");
46
+ r.style.setProperty(Y, e);
46
47
  try {
47
- return r.surroundContents(o), !0;
48
+ return n.surroundContents(r), !0;
48
49
  } catch {
49
- return s(d, e);
50
+ return s(m, e);
50
51
  }
51
52
  }
52
- return s(d, t);
53
- }, nt = (t) => {
54
- t.classList.remove(_, f), t.style.removeProperty("list-style-type");
55
- }, Ot = (t) => {
56
- s(t === l || t === u ? S : D);
53
+ return s(m, t);
54
+ }, rt = (t) => {
55
+ t.classList.remove(_, S), t.style.removeProperty("list-style-type");
56
+ }, ht = (t) => {
57
+ s(t === u || t === L ? p : E);
57
58
  const e = window.getSelection();
58
- let r = (e == null ? void 0 : e.anchorNode) ?? null, o = null;
59
- for (; r; ) {
60
- if (r instanceof HTMLElement && (r.tagName === N || r.tagName === R)) {
61
- o = r;
59
+ let n = (e == null ? void 0 : e.anchorNode) ?? null, r = null;
60
+ for (; n; ) {
61
+ if (n instanceof HTMLElement && (n.tagName === R || n.tagName === M)) {
62
+ r = n;
62
63
  break;
63
64
  }
64
- r = r.parentNode;
65
+ n = n.parentNode;
65
66
  }
66
- return o && (nt(o), t === l ? o.style.listStyleType = H : t === u ? o.classList.add(_) : t === h ? o.style.listStyleType = b : t === I && (o.classList.add(f), o.style.listStyleType = M)), !0;
67
- }, gt = () => {
67
+ return r && (rt(r), t === u ? r.style.listStyleType = v : t === L ? r.classList.add(_) : t === P ? r.style.listStyleType = B : t === D && (r.classList.add(S), r.style.listStyleType = I)), !0;
68
+ }, Rt = () => {
68
69
  const t = window.getSelection();
69
70
  let e = (t == null ? void 0 : t.anchorNode) ?? null;
70
71
  for (; e; ) {
71
72
  if (e instanceof HTMLElement) {
72
- if (e.tagName === N)
73
- return e.classList.contains(_) ? u : l;
74
73
  if (e.tagName === R)
75
- return e.classList.contains(f) || e.style.listStyleType === M ? I : h;
74
+ return e.classList.contains(_) ? L : u;
75
+ if (e.tagName === M)
76
+ return e.classList.contains(S) || e.style.listStyleType === I ? D : P;
76
77
  }
77
78
  e = e.parentNode;
78
79
  }
79
- return l;
80
- }, Nt = (t, e) => {
81
- const n = window.getSelection(), r = F((n == null ? void 0 : n.anchorNode) ?? null, t);
82
- return r ? (r.setAttribute(k, e), !0) : !1;
83
- }, Rt = (t) => {
84
- if (t.key !== Y) return !1;
80
+ return u;
81
+ }, Mt = (t, e) => {
82
+ const o = window.getSelection(), n = H((o == null ? void 0 : o.anchorNode) ?? null, t);
83
+ return n ? (n.setAttribute(b, e), !0) : !1;
84
+ }, st = [
85
+ { prefix: "###", command: "formatBlock", value: "h3" },
86
+ { prefix: "##", command: "formatBlock", value: "h2" },
87
+ { prefix: "#", command: "formatBlock", value: "h1" },
88
+ { prefix: ">", command: "formatBlock", value: "blockquote" },
89
+ { prefix: "1.", command: E }
90
+ ], It = (t) => {
91
+ if (t.key !== h) return !1;
85
92
  const e = window.getSelection();
86
- if (!e || !e.isCollapsed || e.rangeCount === i)
93
+ if (!e || !e.isCollapsed || e.rangeCount === c) return !1;
94
+ const o = e.anchorNode;
95
+ if (!o || o.nodeType !== w) return !1;
96
+ const n = o.textContent ?? "", r = e.anchorOffset, d = n.slice(c, r), i = st.find((k) => d.endsWith(k.prefix));
97
+ if (!i) return !1;
98
+ const a = r - i.prefix.length, T = a > c ? d[a - 1] : "";
99
+ if (T && T !== `
100
+ `) return !1;
101
+ t.preventDefault();
102
+ const f = e.getRangeAt(c);
103
+ return f.setStart(o, a), f.setEnd(o, r), f.deleteContents(), i.value ? s(i.command, i.value) : s(i.command), !0;
104
+ }, Dt = (t) => {
105
+ if (t.key !== h) return !1;
106
+ const e = window.getSelection();
107
+ if (!e || !e.isCollapsed || e.rangeCount === c)
87
108
  return !1;
88
- const n = e.anchorNode;
89
- if (!n || n.nodeType !== K) return !1;
90
- const r = n.textContent ?? "", o = e.anchorOffset, T = r.slice(i, o), m = T.endsWith(E) ? E : T.endsWith(A) ? A : null;
91
- if (!m) return !1;
92
- const a = o - m.length;
93
- if (a < i) return !1;
94
- const p = a > i ? T[a - 1] : "";
95
- if (p && p !== `
109
+ const o = e.anchorNode;
110
+ if (!o || o.nodeType !== w) return !1;
111
+ const n = o.textContent ?? "", r = e.anchorOffset, d = n.slice(c, r), i = d.endsWith(A) ? A : d.endsWith(C) ? C : null;
112
+ if (!i) return !1;
113
+ const a = r - i.length;
114
+ if (a < c) return !1;
115
+ const T = a > c ? d[a - 1] : "";
116
+ if (T && T !== `
96
117
  `) return !1;
97
118
  t.preventDefault();
98
- const L = e.getRangeAt(i);
99
- return L.setStart(n, a), L.setEnd(n, o), L.deleteContents(), s(S), !0;
119
+ const f = e.getRangeAt(c);
120
+ return f.setStart(o, a), f.setEnd(o, r), f.deleteContents(), s(p), !0;
100
121
  };
101
122
  export {
102
- yt as applyFontFamily,
103
- Ot as applyListType,
104
- Ct as clearFormatDeep,
105
- gt as detectListType,
123
+ Nt as applyFontFamily,
124
+ ht as applyListType,
125
+ Ot as clearFormatDeep,
126
+ Rt as detectListType,
106
127
  s as execCommand,
107
- Et as fileToDataUrl,
108
- At as getActiveFormats,
109
- et as insertHTML,
110
- pt as insertImage,
111
- ft as insertLink,
112
- c as queryCommandState,
113
- _t as queryCommandValue,
114
- Nt as setBlockDirection,
115
- mt as setHighlightColor,
116
- St as setTextColor,
117
- rt as stripSelectionColors,
118
- Rt as tryConvertMarkdownListPrefix
128
+ gt as fileToDataUrl,
129
+ yt as getActiveFormats,
130
+ ot as insertHTML,
131
+ Ct as insertImage,
132
+ pt as insertLink,
133
+ l as queryCommandState,
134
+ St as queryCommandValue,
135
+ Mt as setBlockDirection,
136
+ At as setHighlightColor,
137
+ Et as setTextColor,
138
+ nt as stripSelectionColors,
139
+ It as tryConvertMarkdownBlockPrefix,
140
+ Dt as tryConvertMarkdownListPrefix
119
141
  };
@@ -1,2 +1,2 @@
1
- export { execCommand, queryCommandState, queryCommandValue, insertLink, setTextColor, setHighlightColor, insertHTML, insertImage, fileToDataUrl, getActiveFormats, applyFormat, applyFontFamily, applyListType, detectListType, setBlockDirection, clearFormatDeep, stripSelectionColors, tryConvertMarkdownListPrefix, isSelectionInListItem, } from './format.utils';
1
+ export { execCommand, queryCommandState, queryCommandValue, insertLink, setTextColor, setHighlightColor, insertHTML, insertImage, fileToDataUrl, getActiveFormats, applyFormat, applyFontFamily, applyListType, detectListType, setBlockDirection, clearFormatDeep, stripSelectionColors, tryConvertMarkdownBlockPrefix, tryConvertMarkdownListPrefix, isSelectionInListItem, } from './format.utils';
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/InkEditor/helpers/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,iBAAiB,EACjB,iBAAiB,EACjB,UAAU,EACV,YAAY,EACZ,iBAAiB,EACjB,UAAU,EACV,WAAW,EACX,aAAa,EACb,gBAAgB,EAChB,WAAW,EACX,eAAe,EACf,aAAa,EACb,cAAc,EACd,iBAAiB,EACjB,eAAe,EACf,oBAAoB,EACpB,4BAA4B,EAC5B,qBAAqB,GACtB,MAAM,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/InkEditor/helpers/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,iBAAiB,EACjB,iBAAiB,EACjB,UAAU,EACV,YAAY,EACZ,iBAAiB,EACjB,UAAU,EACV,WAAW,EACX,aAAa,EACb,gBAAgB,EAChB,WAAW,EACX,eAAe,EACf,aAAa,EACb,cAAc,EACd,iBAAiB,EACjB,eAAe,EACf,oBAAoB,EACpB,6BAA6B,EAC7B,4BAA4B,EAC5B,qBAAqB,GACtB,MAAM,gBAAgB,CAAC"}
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),Z=require("react"),Q=require("../../plugins/theme/theme.const.cjs"),Y=require("../InkTabs/InkTabs.cjs"),A=require("../InkEditor/InkEditor.cjs"),$=require("../InkEditor/components/PresenceStack/PresenceStack.cjs"),z=require("./hooks/useInkWorkspace.cjs"),t=require("./components/WorkspaceIcons.cjs"),b=require("../../constants/numbers.cjs"),W=require("../../constants/generals.const.cjs");require("../../constants/openai.const.cjs");const E=require("../../utils/cn.utils.cjs");require("../../utils/paste.utils.cjs");const i=require("../../common-components/Button/Button.cjs");require("react-dom");const n=require("../../constants/workspace.const.cjs"),J=O=>{const{documents:N,activeDocumentId:h,onActiveDocumentChange:u,onDocumentChange:r,onDocumentDelete:p,onDocumentRename:D,onDocumentSave:S,folders:K=[],onFolderCreate:C,onFolderDelete:R,collaboration:_,editorProps:l={},className:v=W.EMPTY_STRING,style:w}=O,{sidebarOpen:I,setSidebarOpen:y,splitMode:d,setSplitMode:T,setSecondaryDocId:g,searchQuery:B,setSearchQuery:M,editingDocId:q,editTitle:F,setEditTitle:U,activeDocument:o,secondaryDocument:c,filteredDocs:H,handleCreateDocument:x,handleStartRename:L,handleSaveRename:j,handleCancelRename:V}=z.useInkWorkspace(O),[f,X]=Z.useState(l.themeId||Q.THEME_DEFAULT),m=l.themeId??f,P=a=>{var k;X(a),(k=l.onThemeChange)==null||k.call(l,a)};return e.jsxs("div",{className:E.cn("ink-workspace-root",v),style:w,"data-split-mode":d,"data-ink-theme":m,children:[e.jsxs("header",{className:"ink-workspace-header",children:[e.jsxs("div",{className:"ink-workspace-header-left",children:[e.jsx(i.Button,{type:"button",className:"ink-workspace-toggle-btn",onClick:()=>y(!I),title:I?n.INK_WORKSPACE_HIDE_EXPLORER_TITLE:n.INK_WORKSPACE_SHOW_EXPLORER_TITLE,"aria-label":I?n.INK_WORKSPACE_HIDE_EXPLORER_TITLE:n.INK_WORKSPACE_SHOW_EXPLORER_TITLE,children:e.jsx(t.SidebarToggleIcon,{})}),e.jsx("span",{className:"ink-workspace-title",children:n.INK_WORKSPACE_TITLE}),e.jsxs("span",{className:"ink-workspace-count",children:["(",N.length," ",n.INK_WORKSPACE_DOCS_SUFFIX,")"]})]}),e.jsxs("div",{className:"ink-workspace-header-right",children:[e.jsxs("div",{className:"ink-workspace-split-controls",role:"group","aria-label":n.INK_WORKSPACE_SPLIT_VIEW_LABEL,children:[e.jsx(i.Button,{type:"button",className:E.cn("ink-workspace-icon-btn",d===n.INK_SPLIT_MODE_NONE&&"ink-active"),onClick:()=>T(n.INK_SPLIT_MODE_NONE),title:n.INK_WORKSPACE_SINGLE_VIEW_TITLE,children:e.jsx(t.SingleViewIcon,{})}),e.jsx(i.Button,{type:"button",className:E.cn("ink-workspace-icon-btn",d===n.INK_SPLIT_MODE_VERTICAL&&"ink-active"),onClick:()=>T(n.INK_SPLIT_MODE_VERTICAL),title:n.INK_WORKSPACE_SPLIT_SIDE_TITLE,children:e.jsx(t.SplitVerticalIcon,{})}),e.jsx(i.Button,{type:"button",className:E.cn("ink-workspace-icon-btn",d===n.INK_SPLIT_MODE_HORIZONTAL&&"ink-active"),onClick:()=>T(n.INK_SPLIT_MODE_HORIZONTAL),title:n.INK_WORKSPACE_SPLIT_STACKED_TITLE,children:e.jsx(t.SplitHorizontalIcon,{})})]}),S&&o&&e.jsx(i.Button,{type:"button",className:"ink-workspace-icon-btn",onClick:()=>S(o.id),title:n.INK_WORKSPACE_SAVE_TITLE,"aria-label":n.INK_WORKSPACE_SAVE_TITLE,children:e.jsx(t.SaveDocIcon,{})}),(_==null?void 0:_.collaborators)&&e.jsx($.PresenceStack,{collaborators:_.collaborators,maxAvatars:_.maxAvatars})]})]}),e.jsxs("div",{className:"ink-workspace-body",children:[I&&e.jsxs("aside",{className:"ink-workspace-sidebar","aria-label":n.INK_WORKSPACE_TITLE,children:[e.jsxs("div",{className:"ink-workspace-sidebar-toolbar",children:[e.jsx("input",{type:"text",className:"ink-workspace-search-input",placeholder:n.INK_WORKSPACE_SEARCH_PLACEHOLDER,value:B,onChange:a=>M(a.target.value)}),e.jsx(i.Button,{type:"button",className:"ink-workspace-new-doc-btn",onClick:x,title:n.INK_WORKSPACE_NEW_DOC_BUTTON,"aria-label":n.INK_WORKSPACE_NEW_DOC_BUTTON,children:n.INK_WORKSPACE_NEW_DOC_BUTTON}),C&&e.jsx(i.Button,{type:"button",className:"ink-workspace-icon-btn",onClick:()=>C(n.INK_WORKSPACE_NEW_FOLDER),title:n.INK_WORKSPACE_NEW_FOLDER,"aria-label":n.INK_WORKSPACE_NEW_FOLDER,children:e.jsx(t.NewFolderIcon,{})})]}),K.length>b.NUMBER_ZERO&&e.jsx("div",{className:"ink-workspace-folders-section",children:K.map(a=>e.jsxs("div",{className:"ink-workspace-folder-item",children:[e.jsx("span",{className:"ink-doc-icon",children:"📁"}),e.jsx("span",{className:"ink-doc-title",children:a.name}),R&&e.jsx(i.Button,{type:"button",className:"ink-doc-action-btn ink-delete",onClick:()=>R(a.id),title:n.INK_WORKSPACE_CLOSE_FOLDER_BUTTON,"aria-label":n.INK_WORKSPACE_CLOSE_FOLDER_BUTTON,children:n.INK_WORKSPACE_CLOSE_FOLDER_BUTTON})]},a.id))}),e.jsx("div",{className:"ink-workspace-doc-list",role:"tree",children:H.map(a=>{const k=a.id===h,G=q===a.id;return e.jsxs("div",{role:"treeitem","aria-selected":k,className:E.cn("ink-workspace-doc-item",k&&"ink-doc-active"),onClick:()=>u(a.id),children:[e.jsx("span",{className:"ink-doc-icon",children:a.icon||e.jsx(t.FileDocumentIcon,{})}),G?e.jsx("input",{type:"text",className:"ink-doc-title-input",value:F,autoFocus:!0,onChange:s=>U(s.target.value),onBlur:()=>j(a.id),onKeyDown:s=>{s.key==="Enter"&&j(a.id),s.key==="Escape"&&V()},onClick:s=>s.stopPropagation()}):e.jsx("span",{className:"ink-doc-title",onDoubleClick:s=>L(a.id,a.title,s),children:a.title||n.INK_WORKSPACE_UNTITLED_FALLBACK}),a.isDirty&&e.jsx("span",{className:"ink-doc-dirty-dot"}),e.jsxs("div",{className:"ink-doc-actions",children:[e.jsx(i.Button,{type:"button",className:"ink-doc-action-btn",onClick:s=>L(a.id,a.title,s),title:n.INK_WORKSPACE_RENAME_TITLE,"aria-label":n.INK_WORKSPACE_RENAME_TITLE,children:e.jsx(t.RenamePencilIcon,{})}),N.length>b.NUMBER_ONE&&p&&e.jsx(i.Button,{type:"button",className:"ink-doc-action-btn ink-delete",onClick:s=>{s.stopPropagation(),p(a.id)},title:n.INK_WORKSPACE_DELETE_TITLE,"aria-label":n.INK_WORKSPACE_DELETE_TITLE,children:e.jsx(t.CloseCrossIcon,{})})]})]},a.id)})})]}),e.jsxs("main",{className:E.cn("ink-workspace-main-area",`ink-split-${d}`),children:[e.jsxs("section",{className:"ink-workspace-pane ink-primary-pane",children:[e.jsx(Y.InkTabs,{documents:N,activeDocumentId:h,onTabSelect:u,onTabClose:p,onTabAdd:x,onTabRename:D}),o&&e.jsx("div",{className:"ink-workspace-editor-wrapper",children:e.jsx(A.InkEditor,{value:o.content,onChange:a=>r==null?void 0:r(o.id,a),readOnly:o.readOnly,collaboration:_,...l,themeId:m,onThemeChange:P},o.id)})]}),d!==n.INK_SPLIT_MODE_NONE&&e.jsxs("section",{className:"ink-workspace-pane ink-secondary-pane",children:[e.jsxs("div",{className:"ink-secondary-pane-header",children:[e.jsx("span",{className:"ink-secondary-pane-label",children:n.INK_WORKSPACE_SPLIT_VIEW_LABEL}),e.jsx("select",{className:"ink-secondary-pane-select",value:(c==null?void 0:c.id)||W.EMPTY_STRING,onChange:a=>g(a.target.value),"aria-label":n.INK_WORKSPACE_SPLIT_VIEW_LABEL,children:N.map(a=>e.jsx("option",{value:a.id,children:a.title},a.id))})]}),c&&e.jsx("div",{className:"ink-workspace-editor-wrapper",children:e.jsx(A.InkEditor,{value:c.content,onChange:a=>r==null?void 0:r(c.id,a),readOnly:c.readOnly,...l,themeId:m,onThemeChange:P},`sec-${c.id}`)})]})]})]})]})};exports.InkWorkspace=J;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),H=require("../InkTabs/InkTabs.cjs"),j=require("../InkEditor/InkEditor.cjs"),f=require("../InkEditor/components/PresenceStack/PresenceStack.cjs"),X=require("./hooks/useInkWorkspace.cjs"),t=require("./components/WorkspaceIcons.cjs"),P=require("../../constants/numbers.cjs"),A=require("../../constants/generals.const.cjs");require("../../constants/openai.const.cjs");const d=require("../../utils/cn.utils.cjs");require("../../utils/paste.utils.cjs");require("../../utils/exportDocument.utils.cjs");const i=require("../../common-components/Button/Button.cjs");require("react");require("react-dom");const n=require("../../constants/workspace.const.cjs"),G=p=>{const{documents:E,activeDocumentId:O,onActiveDocumentChange:T,onDocumentChange:r,onDocumentDelete:N,onDocumentRename:b,onDocumentSave:u,folders:S=[],onFolderCreate:K,onFolderDelete:m,collaboration:o,editorProps:C={},className:W=A.EMPTY_STRING,style:D}=p,{sidebarOpen:k,setSidebarOpen:v,splitMode:_,setSplitMode:I,setSecondaryDocId:w,searchQuery:y,setSearchQuery:B,editingDocId:g,editTitle:q,setEditTitle:M,activeDocument:l,secondaryDocument:c,filteredDocs:F,handleCreateDocument:R,handleStartRename:x,handleSaveRename:h,handleCancelRename:U}=X.useInkWorkspace(p);return e.jsxs("div",{className:d.cn("ink-workspace-root",W),style:D,"data-split-mode":_,children:[e.jsxs("header",{className:"ink-workspace-header",children:[e.jsxs("div",{className:"ink-workspace-header-left",children:[e.jsx(i.Button,{type:"button",className:"ink-workspace-toggle-btn",onClick:()=>v(!k),title:k?n.INK_WORKSPACE_HIDE_EXPLORER_TITLE:n.INK_WORKSPACE_SHOW_EXPLORER_TITLE,"aria-label":k?n.INK_WORKSPACE_HIDE_EXPLORER_TITLE:n.INK_WORKSPACE_SHOW_EXPLORER_TITLE,children:e.jsx(t.SidebarToggleIcon,{})}),e.jsx("span",{className:"ink-workspace-title",children:n.INK_WORKSPACE_TITLE}),e.jsxs("span",{className:"ink-workspace-count",children:["(",E.length," ",n.INK_WORKSPACE_DOCS_SUFFIX,")"]})]}),e.jsxs("div",{className:"ink-workspace-header-right",children:[e.jsxs("div",{className:"ink-workspace-split-controls",role:"group","aria-label":n.INK_WORKSPACE_SPLIT_VIEW_LABEL,children:[e.jsx(i.Button,{type:"button",className:d.cn("ink-workspace-icon-btn",_===n.INK_SPLIT_MODE_NONE&&"ink-active"),onClick:()=>I(n.INK_SPLIT_MODE_NONE),title:n.INK_WORKSPACE_SINGLE_VIEW_TITLE,children:e.jsx(t.SingleViewIcon,{})}),e.jsx(i.Button,{type:"button",className:d.cn("ink-workspace-icon-btn",_===n.INK_SPLIT_MODE_VERTICAL&&"ink-active"),onClick:()=>I(n.INK_SPLIT_MODE_VERTICAL),title:n.INK_WORKSPACE_SPLIT_SIDE_TITLE,children:e.jsx(t.SplitVerticalIcon,{})}),e.jsx(i.Button,{type:"button",className:d.cn("ink-workspace-icon-btn",_===n.INK_SPLIT_MODE_HORIZONTAL&&"ink-active"),onClick:()=>I(n.INK_SPLIT_MODE_HORIZONTAL),title:n.INK_WORKSPACE_SPLIT_STACKED_TITLE,children:e.jsx(t.SplitHorizontalIcon,{})})]}),u&&l&&e.jsx(i.Button,{type:"button",className:"ink-workspace-icon-btn",onClick:()=>u(l.id),title:n.INK_WORKSPACE_SAVE_TITLE,"aria-label":n.INK_WORKSPACE_SAVE_TITLE,children:e.jsx(t.SaveDocIcon,{})}),(o==null?void 0:o.collaborators)&&e.jsx(f.PresenceStack,{collaborators:o.collaborators,maxAvatars:o.maxAvatars})]})]}),e.jsxs("div",{className:"ink-workspace-body",children:[k&&e.jsxs("aside",{className:"ink-workspace-sidebar","aria-label":n.INK_WORKSPACE_TITLE,children:[e.jsxs("div",{className:"ink-workspace-sidebar-toolbar",children:[e.jsx("input",{type:"text",className:"ink-workspace-search-input",placeholder:n.INK_WORKSPACE_SEARCH_PLACEHOLDER,value:y,onChange:s=>B(s.target.value)}),e.jsx(i.Button,{type:"button",className:"ink-workspace-new-doc-btn",onClick:R,title:n.INK_WORKSPACE_NEW_DOC_BUTTON,"aria-label":n.INK_WORKSPACE_NEW_DOC_BUTTON,children:n.INK_WORKSPACE_NEW_DOC_BUTTON}),K&&e.jsx(i.Button,{type:"button",className:"ink-workspace-icon-btn",onClick:()=>K(n.INK_WORKSPACE_NEW_FOLDER),title:n.INK_WORKSPACE_NEW_FOLDER,"aria-label":n.INK_WORKSPACE_NEW_FOLDER,children:e.jsx(t.NewFolderIcon,{})})]}),S.length>P.NUMBER_ZERO&&e.jsx("div",{className:"ink-workspace-folders-section",children:S.map(s=>e.jsxs("div",{className:"ink-workspace-folder-item",children:[e.jsx("span",{className:"ink-doc-icon",children:"📁"}),e.jsx("span",{className:"ink-doc-title",children:s.name}),m&&e.jsx(i.Button,{type:"button",className:"ink-doc-action-btn ink-delete",onClick:()=>m(s.id),title:n.INK_WORKSPACE_CLOSE_FOLDER_BUTTON,"aria-label":n.INK_WORKSPACE_CLOSE_FOLDER_BUTTON,children:n.INK_WORKSPACE_CLOSE_FOLDER_BUTTON})]},s.id))}),e.jsx("div",{className:"ink-workspace-doc-list",role:"tree",children:F.map(s=>{const L=s.id===O,V=g===s.id;return e.jsxs("div",{role:"treeitem","aria-selected":L,className:d.cn("ink-workspace-doc-item",L&&"ink-doc-active"),onClick:()=>T(s.id),children:[e.jsx("span",{className:"ink-doc-icon",children:s.icon||e.jsx(t.FileDocumentIcon,{})}),V?e.jsx("input",{type:"text",className:"ink-doc-title-input",value:q,autoFocus:!0,onChange:a=>M(a.target.value),onBlur:()=>h(s.id),onKeyDown:a=>{a.key==="Enter"&&h(s.id),a.key==="Escape"&&U()},onClick:a=>a.stopPropagation()}):e.jsx("span",{className:"ink-doc-title",onDoubleClick:a=>x(s.id,s.title,a),children:s.title||n.INK_WORKSPACE_UNTITLED_FALLBACK}),s.isDirty&&e.jsx("span",{className:"ink-doc-dirty-dot"}),e.jsxs("div",{className:"ink-doc-actions",children:[e.jsx(i.Button,{type:"button",className:"ink-doc-action-btn",onClick:a=>x(s.id,s.title,a),title:n.INK_WORKSPACE_RENAME_TITLE,"aria-label":n.INK_WORKSPACE_RENAME_TITLE,children:e.jsx(t.RenamePencilIcon,{})}),E.length>P.NUMBER_ONE&&N&&e.jsx(i.Button,{type:"button",className:"ink-doc-action-btn ink-delete",onClick:a=>{a.stopPropagation(),N(s.id)},title:n.INK_WORKSPACE_DELETE_TITLE,"aria-label":n.INK_WORKSPACE_DELETE_TITLE,children:e.jsx(t.CloseCrossIcon,{})})]})]},s.id)})})]}),e.jsxs("main",{className:d.cn("ink-workspace-main-area",`ink-split-${_}`),children:[e.jsxs("section",{className:"ink-workspace-pane ink-primary-pane",children:[e.jsx(H.InkTabs,{documents:E,activeDocumentId:O,onTabSelect:T,onTabClose:N,onTabAdd:R,onTabRename:b}),l&&e.jsx("div",{className:"ink-workspace-editor-wrapper",children:e.jsx(j.InkEditor,{value:l.content,onChange:s=>r==null?void 0:r(l.id,s),readOnly:l.readOnly,collaboration:o,...C},l.id)})]}),_!==n.INK_SPLIT_MODE_NONE&&e.jsxs("section",{className:"ink-workspace-pane ink-secondary-pane",children:[e.jsxs("div",{className:"ink-secondary-pane-header",children:[e.jsx("span",{className:"ink-secondary-pane-label",children:n.INK_WORKSPACE_SPLIT_VIEW_LABEL}),e.jsx("select",{className:"ink-secondary-pane-select",value:(c==null?void 0:c.id)||A.EMPTY_STRING,onChange:s=>w(s.target.value),"aria-label":n.INK_WORKSPACE_SPLIT_VIEW_LABEL,children:E.map(s=>e.jsx("option",{value:s.id,children:s.title},s.id))})]}),c&&e.jsx("div",{className:"ink-workspace-editor-wrapper",children:e.jsx(j.InkEditor,{value:c.content,onChange:s=>r==null?void 0:r(c.id,s),readOnly:c.readOnly,...C},`sec-${c.id}`)})]})]})]})]})};exports.InkWorkspace=G;
@@ -1 +1 @@
1
- {"version":3,"file":"InkWorkspace.d.ts","sourceRoot":"","sources":["../../../src/components/InkWorkspace/InkWorkspace.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AACxC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AA6CjD,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CAsTpD,CAAC"}
1
+ {"version":3,"file":"InkWorkspace.d.ts","sourceRoot":"","sources":["../../../src/components/InkWorkspace/InkWorkspace.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AA2CjD,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CA0SpD,CAAC"}