@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 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),i=require("react"),I=require("../../../../constants/generals.const.cjs"),o=require("../../../../constants/defaults.const.cjs"),P=require("../../../../constants/aiModels.const.cjs");require("../../../../constants/openai.const.cjs");const w=require("../../../../utils/id.utils.cjs");require("../../../../utils/paste.utils.cjs");require("react-dom");const G=require("../../../../plugins/ai/aiPlugin.cjs"),U=L=>{var f,y,S,T;const{config:s,documentHtml:v,selectionHtml:b,onApplyHtml:H,onClose:N,onBusyChange:h}=L,[a,K]=i.useState("chat"),[x,g]=i.useState(""),[c,m]=i.useState([]),[l,q]=i.useState(!1),[d,A]=i.useState(null),[B,D]=i.useState([]),[j,R]=i.useState(o.INK_TRANSLATE_LANGUAGES[1]),M=s.providerId||P.INK_AI_DEMO_PROVIDER_ID,O=((f=s.uiTheme)==null?void 0:f.className)||s.className||"",p=t=>{q(t),h==null||h(t)},u=async(t,r,_)=>{var E;p(!0);try{const C=t==="chat"&&_?[...c,{id:w.createInkId("turn"),role:"user",content:_,timestamp:Date.now(),capability:t}]:c;t==="chat"&&_&&m(C);const n=await G.inkAi.runProvider(M,{capability:t,html:v,selectionHtml:b||void 0,prompt:_,history:C,options:r,modelId:s.modelId,documentSnapshot:{html:v,selectionHtml:b||void 0}});(E=n.turns)!=null&&E.length?m(k=>[...k,...n.turns]):n.text&&t!=="chat"&&m(k=>[...k,{id:w.createInkId("turn"),role:"assistant",content:n.text||"",timestamp:Date.now(),capability:t}]),n.diff&&A(n.diff),n.reviewSuggestions&&D(n.reviewSuggestions)}finally{p(!1)}},$=t=>{t.preventDefault();const r=x.trim();!r||l||(g(""),u("chat",void 0,r))};return e.jsxs("aside",{className:`Ink-Ai ${O}`.trim(),"data-placement":s.placement||"sidebar",style:{"--ink-ai-accent":(y=s.uiTheme)==null?void 0:y.accent,"--ink-ai-surface":(S=s.uiTheme)==null?void 0:S.surface,"--ink-ai-border":(T=s.uiTheme)==null?void 0:T.border},"aria-label":"Ink AI",children:[e.jsxs("div",{className:"Ink-Ai__header",children:[e.jsx("strong",{children:"Ink AI"}),N?e.jsx("button",{type:"button",className:"Ink-Editor__button",onClick:N,title:"Close AI",children:"×"}):null]}),e.jsx("div",{className:"Ink-Ai__tabs",role:"tablist",children:[["chat",I.INK_AI_TAB_CHAT],["actions",I.INK_AI_TAB_ACTIONS],["review",I.INK_AI_TAB_REVIEW],["translate",I.INK_AI_TAB_TRANSLATE]].map(([t,r])=>e.jsx("button",{type:"button",role:"tab",className:`${o.INK_CLASS_AI_TAB}${a===t?` ${o.INK_CLASS_AI_TAB_ON}`:""}`,"aria-selected":a===t,onClick:()=>K(t),children:r},t))}),e.jsxs("div",{className:"Ink-Ai__body",children:[a==="chat"?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"Ink-Ai__history",children:c.length===0?e.jsxs("p",{className:"Ink-Ai__empty",children:["Multi-turn chat with local demo provider. Bring your own LLM via"," ",e.jsx("code",{children:"inkAi.registerProvider"}),"."]}):c.map(t=>e.jsxs("div",{className:`Ink-Ai__turn Ink-Ai__turn--${t.role}`,children:[e.jsx("span",{children:t.role}),e.jsx("p",{children:t.content})]},t.id))}),e.jsxs("form",{className:"Ink-Ai__form",onSubmit:$,children:[e.jsx("input",{value:x,onChange:t=>g(t.target.value),placeholder:"Ask Ink AI…",disabled:l}),e.jsx("button",{type:"submit",className:"Ink-Editor__button Ink-Editor__button--active",disabled:l,children:"Send"})]})]}):null,a==="actions"?e.jsxs("div",{className:"Ink-Ai__actions",children:[e.jsx("p",{className:"Ink-Ai__hint",children:"Quick actions use the current selection (or full document)."}),o.INK_QUICK_ACTIONS.map(t=>e.jsx("button",{type:"button",className:"Ink-Editor__button Ink-Ai__action",disabled:l,onClick:()=>void u(t.capability),children:t.label},t.id))]}):null,a==="review"?e.jsxs("div",{className:"Ink-Ai__review",children:[e.jsx("button",{type:"button",className:"Ink-Editor__button Ink-Editor__button--active",disabled:l,onClick:()=>void u("review"),children:"Run grammar & style review"}),B.map(t=>e.jsxs("article",{className:`Ink-Ai__suggestion Ink-Ai__suggestion--${t.severity}`,children:[e.jsx("strong",{children:t.severity}),e.jsx("p",{children:t.message}),e.jsx("code",{children:t.suggestedText})]},t.id))]}):null,a==="translate"?e.jsxs("div",{className:"Ink-Ai__translate",children:[e.jsxs("label",{children:["Language",e.jsx("select",{value:j,onChange:t=>R(t.target.value),children:o.INK_TRANSLATE_LANGUAGES.map(t=>e.jsx("option",{value:t,children:t},t))})]}),e.jsx("button",{type:"button",className:"Ink-Editor__button Ink-Editor__button--active",disabled:l,onClick:()=>void u("translate",{language:j}),children:"Translate"})]}):null,d?e.jsxs("div",{className:"Ink-Ai__diff",children:[e.jsx("strong",{children:"Suggested change"}),e.jsx("p",{children:d.summary}),e.jsx("div",{className:"Ink-Ai__diff-preview",dangerouslySetInnerHTML:{__html:d.suggestedHtml}}),e.jsxs("div",{className:"Ink-Ai__diff-actions",children:[e.jsx("button",{type:"button",className:"Ink-Editor__button Ink-Editor__button--active",onClick:()=>{H(d.suggestedHtml),A(null)},children:"Apply"}),e.jsx("button",{type:"button",className:"Ink-Editor__button",onClick:()=>A(null),children:"Dismiss"})]})]}):null]}),e.jsx("footer",{className:"Ink-Ai__footer",children:"Demo provider · BYO LLM"})]})};exports.AiPanel=U;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),i=require("react"),I=require("../../../../constants/generals.const.cjs"),o=require("../../../../constants/defaults.const.cjs"),P=require("../../../../constants/aiModels.const.cjs");require("../../../../constants/openai.const.cjs");const w=require("../../../../utils/id.utils.cjs");require("../../../../utils/paste.utils.cjs");require("../../../../utils/exportDocument.utils.cjs");require("react-dom");const G=require("../../../../plugins/ai/aiPlugin.cjs"),U=L=>{var f,y,S,T;const{config:s,documentHtml:v,selectionHtml:b,onApplyHtml:q,onClose:N,onBusyChange:h}=L,[a,H]=i.useState("chat"),[x,g]=i.useState(""),[c,m]=i.useState([]),[l,K]=i.useState(!1),[d,A]=i.useState(null),[B,D]=i.useState([]),[j,R]=i.useState(o.INK_TRANSLATE_LANGUAGES[1]),M=s.providerId||P.INK_AI_DEMO_PROVIDER_ID,O=((f=s.uiTheme)==null?void 0:f.className)||s.className||"",p=t=>{K(t),h==null||h(t)},u=async(t,r,_)=>{var E;p(!0);try{const C=t==="chat"&&_?[...c,{id:w.createInkId("turn"),role:"user",content:_,timestamp:Date.now(),capability:t}]:c;t==="chat"&&_&&m(C);const n=await G.inkAi.runProvider(M,{capability:t,html:v,selectionHtml:b||void 0,prompt:_,history:C,options:r,modelId:s.modelId,documentSnapshot:{html:v,selectionHtml:b||void 0}});(E=n.turns)!=null&&E.length?m(k=>[...k,...n.turns]):n.text&&t!=="chat"&&m(k=>[...k,{id:w.createInkId("turn"),role:"assistant",content:n.text||"",timestamp:Date.now(),capability:t}]),n.diff&&A(n.diff),n.reviewSuggestions&&D(n.reviewSuggestions)}finally{p(!1)}},$=t=>{t.preventDefault();const r=x.trim();!r||l||(g(""),u("chat",void 0,r))};return e.jsxs("aside",{className:`Ink-Ai ${O}`.trim(),"data-placement":s.placement||"sidebar",style:{"--ink-ai-accent":(y=s.uiTheme)==null?void 0:y.accent,"--ink-ai-surface":(S=s.uiTheme)==null?void 0:S.surface,"--ink-ai-border":(T=s.uiTheme)==null?void 0:T.border},"aria-label":"Ink AI",children:[e.jsxs("div",{className:"Ink-Ai__header",children:[e.jsx("strong",{children:"Ink AI"}),N?e.jsx("button",{type:"button",className:"Ink-Editor__button",onClick:N,title:"Close AI",children:"×"}):null]}),e.jsx("div",{className:"Ink-Ai__tabs",role:"tablist",children:[["chat",I.INK_AI_TAB_CHAT],["actions",I.INK_AI_TAB_ACTIONS],["review",I.INK_AI_TAB_REVIEW],["translate",I.INK_AI_TAB_TRANSLATE]].map(([t,r])=>e.jsx("button",{type:"button",role:"tab",className:`${o.INK_CLASS_AI_TAB}${a===t?` ${o.INK_CLASS_AI_TAB_ON}`:""}`,"aria-selected":a===t,onClick:()=>H(t),children:r},t))}),e.jsxs("div",{className:"Ink-Ai__body",children:[a==="chat"?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"Ink-Ai__history",children:c.length===0?e.jsxs("p",{className:"Ink-Ai__empty",children:["Multi-turn chat with local demo provider. Bring your own LLM via"," ",e.jsx("code",{children:"inkAi.registerProvider"}),"."]}):c.map(t=>e.jsxs("div",{className:`Ink-Ai__turn Ink-Ai__turn--${t.role}`,children:[e.jsx("span",{children:t.role}),e.jsx("p",{children:t.content})]},t.id))}),e.jsxs("form",{className:"Ink-Ai__form",onSubmit:$,children:[e.jsx("input",{value:x,onChange:t=>g(t.target.value),placeholder:"Ask Ink AI…",disabled:l}),e.jsx("button",{type:"submit",className:"Ink-Editor__button Ink-Editor__button--active",disabled:l,children:"Send"})]})]}):null,a==="actions"?e.jsxs("div",{className:"Ink-Ai__actions",children:[e.jsx("p",{className:"Ink-Ai__hint",children:"Quick actions use the current selection (or full document)."}),o.INK_QUICK_ACTIONS.map(t=>e.jsx("button",{type:"button",className:"Ink-Editor__button Ink-Ai__action",disabled:l,onClick:()=>void u(t.capability),children:t.label},t.id))]}):null,a==="review"?e.jsxs("div",{className:"Ink-Ai__review",children:[e.jsx("button",{type:"button",className:"Ink-Editor__button Ink-Editor__button--active",disabled:l,onClick:()=>void u("review"),children:"Run grammar & style review"}),B.map(t=>e.jsxs("article",{className:`Ink-Ai__suggestion Ink-Ai__suggestion--${t.severity}`,children:[e.jsx("strong",{children:t.severity}),e.jsx("p",{children:t.message}),e.jsx("code",{children:t.suggestedText})]},t.id))]}):null,a==="translate"?e.jsxs("div",{className:"Ink-Ai__translate",children:[e.jsxs("label",{children:["Language",e.jsx("select",{value:j,onChange:t=>R(t.target.value),children:o.INK_TRANSLATE_LANGUAGES.map(t=>e.jsx("option",{value:t,children:t},t))})]}),e.jsx("button",{type:"button",className:"Ink-Editor__button Ink-Editor__button--active",disabled:l,onClick:()=>void u("translate",{language:j}),children:"Translate"})]}):null,d?e.jsxs("div",{className:"Ink-Ai__diff",children:[e.jsx("strong",{children:"Suggested change"}),e.jsx("p",{children:d.summary}),e.jsx("div",{className:"Ink-Ai__diff-preview",dangerouslySetInnerHTML:{__html:d.suggestedHtml}}),e.jsxs("div",{className:"Ink-Ai__diff-actions",children:[e.jsx("button",{type:"button",className:"Ink-Editor__button Ink-Editor__button--active",onClick:()=>{q(d.suggestedHtml),A(null)},children:"Apply"}),e.jsx("button",{type:"button",className:"Ink-Editor__button",onClick:()=>A(null),children:"Dismiss"})]})]}):null]}),e.jsx("footer",{className:"Ink-Ai__footer",children:"Demo provider · BYO LLM"})]})};exports.AiPanel=U;
@@ -6,36 +6,37 @@ import { INK_AI_DEMO_PROVIDER_ID as z } from "../../../../constants/aiModels.con
6
6
  import "../../../../constants/openai.const.js";
7
7
  import { createInkId as H } from "../../../../utils/id.utils.js";
8
8
  import "../../../../utils/paste.utils.js";
9
+ import "../../../../utils/exportDocument.utils.js";
9
10
  import "react-dom";
10
11
  import { inkAi as J } from "../../../../plugins/ai/aiPlugin.js";
11
- const re = (K) => {
12
+ const ce = (K) => {
12
13
  var y, T, C, E;
13
- const { config: i, documentHtml: k, selectionHtml: p, onApplyHtml: B, onClose: v, onBusyChange: m } = K, [o, D] = l("chat"), [b, N] = l(""), [c, h] = l([]), [a, x] = l(!1), [d, I] = l(null), [R, O] = l([]), [f, $] = l(L[1]), M = i.providerId || z, j = ((y = i.uiTheme) == null ? void 0 : y.className) || i.className || "", g = (e) => {
14
- x(e), m == null || m(e);
15
- }, _ = async (e, r, u) => {
14
+ const { config: i, documentHtml: p, selectionHtml: k, onApplyHtml: B, onClose: v, onBusyChange: u } = K, [o, D] = l("chat"), [b, N] = l(""), [c, h] = l([]), [a, x] = l(!1), [d, I] = l(null), [R, O] = l([]), [f, $] = l(L[1]), M = i.providerId || z, j = ((y = i.uiTheme) == null ? void 0 : y.className) || i.className || "", g = (e) => {
15
+ x(e), u == null || u(e);
16
+ }, _ = async (e, r, m) => {
16
17
  var S;
17
18
  g(!0);
18
19
  try {
19
- const w = e === "chat" && u ? [
20
+ const w = e === "chat" && m ? [
20
21
  ...c,
21
22
  {
22
23
  id: H("turn"),
23
24
  role: "user",
24
- content: u,
25
+ content: m,
25
26
  timestamp: Date.now(),
26
27
  capability: e
27
28
  }
28
29
  ] : c;
29
- e === "chat" && u && h(w);
30
+ e === "chat" && m && h(w);
30
31
  const s = await J.runProvider(M, {
31
32
  capability: e,
32
- html: k,
33
- selectionHtml: p || void 0,
34
- prompt: u,
33
+ html: p,
34
+ selectionHtml: k || void 0,
35
+ prompt: m,
35
36
  history: w,
36
37
  options: r,
37
38
  modelId: i.modelId,
38
- documentSnapshot: { html: k, selectionHtml: p || void 0 }
39
+ documentSnapshot: { html: p, selectionHtml: k || void 0 }
39
40
  });
40
41
  (S = s.turns) != null && S.length ? h((A) => [...A, ...s.turns]) : s.text && e !== "chat" && h((A) => [
41
42
  ...A,
@@ -185,5 +186,5 @@ const re = (K) => {
185
186
  );
186
187
  };
187
188
  export {
188
- re as AiPanel
189
+ ce as AiPanel
189
190
  };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),a=require("react-dom"),e=require("./AiSelectionBubble.const.cjs"),i=t=>{t.preventDefault(),t.stopPropagation()},u=t=>{const{open:s,top:r,left:A,busy:l,preview:_,onAction:S,onApply:c,onDismiss:I}=t;return!s||typeof document>"u"?null:a.createPortal(n.jsxs("div",{className:e.AI_SELECTION_BUBBLE_CLASS,style:{position:"fixed",top:r,left:A},role:"toolbar","aria-label":e.AI_SELECTION_BUBBLE_ARIA_LABEL,onPointerDown:o=>o.stopPropagation(),children:[e.AI_SELECTION_ACTIONS.map(o=>n.jsx("button",{type:"button",className:e.AI_SELECTION_ACTION_CLASS,disabled:l,onPointerDown:i,onClick:()=>S(o.id),children:o.label},o.id)),l?n.jsx("span",{className:"Ink-AiSelection__status",children:e.AI_SELECTION_BUSY_LABEL}):null,_?n.jsxs(n.Fragment,{children:[n.jsx("button",{type:"button",className:`${e.AI_SELECTION_ACTION_CLASS} ${e.AI_SELECTION_ACTION_ACTIVE_CLASS}`,onPointerDown:i,onClick:c,children:e.AI_SELECTION_APPLY_LABEL}),n.jsx("button",{type:"button",className:e.AI_SELECTION_ACTION_CLASS,onPointerDown:i,onClick:I,children:e.AI_SELECTION_DISMISS_LABEL})]}):null]}),document.body)};exports.AiSelectionBubble=u;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _=require("../../../../constants/numbers.cjs"),E="Ink-AiSelection",I="Ink-AiSelection__action",A="Ink-AiSelection__action--active",S="Selection AI",L="Apply",T="Dismiss",t="Ink AI is writing…",i="Spanish",C=_.NUMBER_EIGHT,e=_.NUMBER_EIGHT,N=_.NUMBER_FORTY,n=448,O=28,o=[{id:"improve",label:"Improve",capability:"rewrite"},{id:"shorter",label:"Shorter",capability:"summarize"},{id:"longer",label:"Longer",capability:"expand"},{id:"fix",label:"Fix",capability:"review"},{id:"tone",label:"Tone",capability:"tone"},{id:"translate",label:"Translate",capability:"translate"}];exports.AI_SELECTION_ACTIONS=o;exports.AI_SELECTION_ACTION_ACTIVE_CLASS=A;exports.AI_SELECTION_ACTION_CLASS=I;exports.AI_SELECTION_APPLY_LABEL=L;exports.AI_SELECTION_BUBBLE_ARIA_LABEL=S;exports.AI_SELECTION_BUBBLE_CLASS=E;exports.AI_SELECTION_BUSY_LABEL=t;exports.AI_SELECTION_DISMISS_LABEL=T;exports.AI_SELECTION_EDGE_PX=e;exports.AI_SELECTION_ESTIMATED_HEIGHT_PX=N;exports.AI_SELECTION_ESTIMATED_WIDTH_PX=n;exports.AI_SELECTION_GAP_PX=C;exports.AI_SELECTION_LINE_CAP_PX=O;exports.AI_SELECTION_TRANSLATE_LANGUAGE=i;
@@ -0,0 +1,20 @@
1
+ import { InkAiCapability } from '../../../../types';
2
+ export declare const AI_SELECTION_BUBBLE_CLASS = "Ink-AiSelection";
3
+ export declare const AI_SELECTION_ACTION_CLASS = "Ink-AiSelection__action";
4
+ export declare const AI_SELECTION_ACTION_ACTIVE_CLASS = "Ink-AiSelection__action--active";
5
+ export declare const AI_SELECTION_BUBBLE_ARIA_LABEL = "Selection AI";
6
+ export declare const AI_SELECTION_APPLY_LABEL = "Apply";
7
+ export declare const AI_SELECTION_DISMISS_LABEL = "Dismiss";
8
+ export declare const AI_SELECTION_BUSY_LABEL = "Ink AI is writing\u2026";
9
+ export declare const AI_SELECTION_TRANSLATE_LANGUAGE = "Spanish";
10
+ export declare const AI_SELECTION_GAP_PX = 8;
11
+ export declare const AI_SELECTION_EDGE_PX = 8;
12
+ export declare const AI_SELECTION_ESTIMATED_HEIGHT_PX = 40;
13
+ export declare const AI_SELECTION_ESTIMATED_WIDTH_PX = 448;
14
+ export declare const AI_SELECTION_LINE_CAP_PX = 28;
15
+ export declare const AI_SELECTION_ACTIONS: ReadonlyArray<{
16
+ id: string;
17
+ label: string;
18
+ capability: InkAiCapability;
19
+ }>;
20
+ //# sourceMappingURL=AiSelectionBubble.const.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AiSelectionBubble.const.d.ts","sourceRoot":"","sources":["../../../../../src/components/InkEditor/components/AiSelectionBubble/AiSelectionBubble.const.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAGzD,eAAO,MAAM,yBAAyB,oBAAoB,CAAC;AAC3D,eAAO,MAAM,yBAAyB,4BAA4B,CAAC;AACnE,eAAO,MAAM,gCAAgC,oCAAoC,CAAC;AAClF,eAAO,MAAM,8BAA8B,iBAAiB,CAAC;AAC7D,eAAO,MAAM,wBAAwB,UAAU,CAAC;AAChD,eAAO,MAAM,0BAA0B,YAAY,CAAC;AACpD,eAAO,MAAM,uBAAuB,4BAAuB,CAAC;AAC5D,eAAO,MAAM,+BAA+B,YAAY,CAAC;AACzD,eAAO,MAAM,mBAAmB,IAAe,CAAC;AAChD,eAAO,MAAM,oBAAoB,IAAe,CAAC;AACjD,eAAO,MAAM,gCAAgC,KAAe,CAAC;AAC7D,eAAO,MAAM,+BAA+B,MAAM,CAAC;AACnD,eAAO,MAAM,wBAAwB,KAAK,CAAC;AAE3C,eAAO,MAAM,oBAAoB,EAAE,aAAa,CAAC;IAC/C,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,eAAe,CAAC;CAC7B,CAOA,CAAC"}
@@ -0,0 +1,25 @@
1
+ import { NUMBER_EIGHT as _, NUMBER_FORTY as E } from "../../../../constants/numbers.js";
2
+ const A = "Ink-AiSelection", i = "Ink-AiSelection__action", t = "Ink-AiSelection__action--active", n = "Selection AI", e = "Apply", S = "Dismiss", o = "Ink AI is writing…", L = "Spanish", a = _, T = _, c = E, l = 448, s = 28, C = [
3
+ { id: "improve", label: "Improve", capability: "rewrite" },
4
+ { id: "shorter", label: "Shorter", capability: "summarize" },
5
+ { id: "longer", label: "Longer", capability: "expand" },
6
+ { id: "fix", label: "Fix", capability: "review" },
7
+ { id: "tone", label: "Tone", capability: "tone" },
8
+ { id: "translate", label: "Translate", capability: "translate" }
9
+ ];
10
+ export {
11
+ C as AI_SELECTION_ACTIONS,
12
+ t as AI_SELECTION_ACTION_ACTIVE_CLASS,
13
+ i as AI_SELECTION_ACTION_CLASS,
14
+ e as AI_SELECTION_APPLY_LABEL,
15
+ n as AI_SELECTION_BUBBLE_ARIA_LABEL,
16
+ A as AI_SELECTION_BUBBLE_CLASS,
17
+ o as AI_SELECTION_BUSY_LABEL,
18
+ S as AI_SELECTION_DISMISS_LABEL,
19
+ T as AI_SELECTION_EDGE_PX,
20
+ c as AI_SELECTION_ESTIMATED_HEIGHT_PX,
21
+ l as AI_SELECTION_ESTIMATED_WIDTH_PX,
22
+ a as AI_SELECTION_GAP_PX,
23
+ s as AI_SELECTION_LINE_CAP_PX,
24
+ L as AI_SELECTION_TRANSLATE_LANGUAGE
25
+ };
@@ -0,0 +1,4 @@
1
+ import { FC } from 'react';
2
+ import { AiSelectionBubbleProps } from './AiSelectionBubble.types';
3
+ export declare const AiSelectionBubble: FC<AiSelectionBubbleProps>;
4
+ //# sourceMappingURL=AiSelectionBubble.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AiSelectionBubble.d.ts","sourceRoot":"","sources":["../../../../../src/components/InkEditor/components/AiSelectionBubble/AiSelectionBubble.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAgB,MAAM,OAAO,CAAC;AAY9C,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AAOxE,eAAO,MAAM,iBAAiB,EAAE,EAAE,CAAC,sBAAsB,CAgDxD,CAAC"}
@@ -0,0 +1,61 @@
1
+ import { jsxs as r, jsx as e, Fragment as p } from "react/jsx-runtime";
2
+ import { createPortal as L } from "react-dom";
3
+ import { AI_SELECTION_BUBBLE_ARIA_LABEL as S, AI_SELECTION_BUBBLE_CLASS as u, AI_SELECTION_ACTIONS as C, AI_SELECTION_ACTION_CLASS as t, AI_SELECTION_BUSY_LABEL as d, AI_SELECTION_APPLY_LABEL as m, AI_SELECTION_ACTION_ACTIVE_CLASS as N, AI_SELECTION_DISMISS_LABEL as b } from "./AiSelectionBubble.const.js";
4
+ const l = (n) => {
5
+ n.preventDefault(), n.stopPropagation();
6
+ }, f = (n) => {
7
+ const { open: s, top: _, left: A, busy: i, preview: a, onAction: I, onApply: E, onDismiss: c } = n;
8
+ return !s || typeof document > "u" ? null : L(
9
+ /* @__PURE__ */ r(
10
+ "div",
11
+ {
12
+ className: u,
13
+ style: { position: "fixed", top: _, left: A },
14
+ role: "toolbar",
15
+ "aria-label": S,
16
+ onPointerDown: (o) => o.stopPropagation(),
17
+ children: [
18
+ C.map((o) => /* @__PURE__ */ e(
19
+ "button",
20
+ {
21
+ type: "button",
22
+ className: t,
23
+ disabled: i,
24
+ onPointerDown: l,
25
+ onClick: () => I(o.id),
26
+ children: o.label
27
+ },
28
+ o.id
29
+ )),
30
+ i ? /* @__PURE__ */ e("span", { className: "Ink-AiSelection__status", children: d }) : null,
31
+ a ? /* @__PURE__ */ r(p, { children: [
32
+ /* @__PURE__ */ e(
33
+ "button",
34
+ {
35
+ type: "button",
36
+ className: `${t} ${N}`,
37
+ onPointerDown: l,
38
+ onClick: E,
39
+ children: m
40
+ }
41
+ ),
42
+ /* @__PURE__ */ e(
43
+ "button",
44
+ {
45
+ type: "button",
46
+ className: t,
47
+ onPointerDown: l,
48
+ onClick: c,
49
+ children: b
50
+ }
51
+ )
52
+ ] }) : null
53
+ ]
54
+ }
55
+ ),
56
+ document.body
57
+ );
58
+ };
59
+ export {
60
+ f as AiSelectionBubble
61
+ };
@@ -0,0 +1,11 @@
1
+ export interface AiSelectionBubbleProps {
2
+ open: boolean;
3
+ top: number;
4
+ left: number;
5
+ busy: boolean;
6
+ preview: string;
7
+ onAction: (actionId: string) => void;
8
+ onApply: () => void;
9
+ onDismiss: () => void;
10
+ }
11
+ //# sourceMappingURL=AiSelectionBubble.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AiSelectionBubble.types.d.ts","sourceRoot":"","sources":["../../../../../src/components/InkEditor/components/AiSelectionBubble/AiSelectionBubble.types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,OAAO,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,SAAS,EAAE,MAAM,IAAI,CAAC;CACvB"}
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const I=require("../../../../constants/numbers.cjs"),e=require("./AiSelectionBubble.const.cjs"),c=(t,E)=>{const o=(t.bottom-t.top>e.AI_SELECTION_ESTIMATED_HEIGHT_PX?t.top+e.AI_SELECTION_LINE_CAP_PX:t.bottom)+e.AI_SELECTION_GAP_PX,r=t.top-e.AI_SELECTION_ESTIMATED_HEIGHT_PX-e.AI_SELECTION_GAP_PX,n=o+e.AI_SELECTION_ESTIMATED_HEIGHT_PX<=E.height-e.AI_SELECTION_EDGE_PX?o:Math.max(e.AI_SELECTION_EDGE_PX,r),T=Math.max(e.AI_SELECTION_EDGE_PX,E.width-e.AI_SELECTION_ESTIMATED_WIDTH_PX-e.AI_SELECTION_EDGE_PX),l=Math.min(Math.max(t.left,e.AI_SELECTION_EDGE_PX),T);return{top:Number.isFinite(n)?n:I.NUMBER_ZERO,left:Number.isFinite(l)?l:I.NUMBER_ZERO}},A=t=>t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),s=t=>{const E=e.AI_SELECTION_ACTIONS.find(i=>i.id===t);return(E==null?void 0:E.capability)??null},S=t=>{if(t==="translate")return{language:e.AI_SELECTION_TRANSLATE_LANGUAGE}},u=t=>{var i,_;if((i=t.diff)!=null&&i.suggestedHtml)return t.diff.suggestedHtml;if(t.html)return t.html;const E=(_=t.reviewSuggestions)==null?void 0:_.find(o=>o.suggestedText.trim());return E?`<p>${A(E.suggestedText)}</p>`:t.text?`<p>${A(t.text)}</p>`:""};exports.capabilityForSelectionAction=s;exports.htmlFromAiResponse=u;exports.optionsForSelectionAction=S;exports.placeAiSelectionBubble=c;
@@ -0,0 +1,19 @@
1
+ import { InkAiCapability, InkAiResponse } from '../../../../types';
2
+ export interface AiSelectionAnchor {
3
+ top: number;
4
+ left: number;
5
+ bottom: number;
6
+ width: number;
7
+ }
8
+ export interface AiSelectionViewport {
9
+ width: number;
10
+ height: number;
11
+ }
12
+ export declare const placeAiSelectionBubble: (selectionRect: AiSelectionAnchor, viewport: AiSelectionViewport) => {
13
+ top: number;
14
+ left: number;
15
+ };
16
+ export declare const capabilityForSelectionAction: (actionId: string) => InkAiCapability | null;
17
+ export declare const optionsForSelectionAction: (actionId: string) => Record<string, string> | undefined;
18
+ export declare const htmlFromAiResponse: (response: InkAiResponse) => string;
19
+ //# sourceMappingURL=AiSelectionBubble.utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AiSelectionBubble.utils.d.ts","sourceRoot":"","sources":["../../../../../src/components/InkEditor/components/AiSelectionBubble/AiSelectionBubble.utils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAWxE,MAAM,WAAW,iBAAiB;IAChC,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,eAAO,MAAM,sBAAsB,GACjC,eAAe,iBAAiB,EAChC,UAAU,mBAAmB,KAC5B;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAmB7B,CAAC;AAQF,eAAO,MAAM,4BAA4B,GAAI,UAAU,MAAM,KAAG,eAAe,GAAG,IAGjF,CAAC;AAEF,eAAO,MAAM,yBAAyB,GACpC,UAAU,MAAM,KACf,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAK3B,CAAC;AAEF,eAAO,MAAM,kBAAkB,GAAI,UAAU,aAAa,KAAG,MAO5D,CAAC"}
@@ -0,0 +1,30 @@
1
+ import { NUMBER_ZERO as _ } from "../../../../constants/numbers.js";
2
+ import { AI_SELECTION_ACTIONS as A, AI_SELECTION_TRANSLATE_LANGUAGE as I, AI_SELECTION_ESTIMATED_HEIGHT_PX as l, AI_SELECTION_EDGE_PX as i, AI_SELECTION_ESTIMATED_WIDTH_PX as f, AI_SELECTION_GAP_PX as a, AI_SELECTION_LINE_CAP_PX as c } from "./AiSelectionBubble.const.js";
3
+ const N = (t, o) => {
4
+ const n = (t.bottom - t.top > l ? t.top + c : t.bottom) + a, s = t.top - l - a, E = n + l <= o.height - i ? n : Math.max(i, s), u = Math.max(
5
+ i,
6
+ o.width - f - i
7
+ ), m = Math.min(Math.max(t.left, i), u);
8
+ return {
9
+ top: Number.isFinite(E) ? E : _,
10
+ left: Number.isFinite(m) ? m : _
11
+ };
12
+ }, g = (t) => t.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;"), h = (t) => {
13
+ const o = A.find((e) => e.id === t);
14
+ return (o == null ? void 0 : o.capability) ?? null;
15
+ }, d = (t) => {
16
+ if (t === "translate")
17
+ return { language: I };
18
+ }, L = (t) => {
19
+ var e, r;
20
+ if ((e = t.diff) != null && e.suggestedHtml) return t.diff.suggestedHtml;
21
+ if (t.html) return t.html;
22
+ const o = (r = t.reviewSuggestions) == null ? void 0 : r.find((n) => n.suggestedText.trim());
23
+ return o ? `<p>${g(o.suggestedText)}</p>` : t.text ? `<p>${g(t.text)}</p>` : "";
24
+ };
25
+ export {
26
+ h as capabilityForSelectionAction,
27
+ L as htmlFromAiResponse,
28
+ d as optionsForSelectionAction,
29
+ N as placeAiSelectionBubble
30
+ };
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=AiSelectionBubble.utils.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AiSelectionBubble.utils.test.d.ts","sourceRoot":"","sources":["../../../../../src/components/InkEditor/components/AiSelectionBubble/AiSelectionBubble.utils.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,4 @@
1
+ export { AiSelectionBubble } from './AiSelectionBubble';
2
+ export { capabilityForSelectionAction, htmlFromAiResponse, optionsForSelectionAction, placeAiSelectionBubble, } from './AiSelectionBubble.utils';
3
+ export type { AiSelectionBubbleProps } from './AiSelectionBubble.types';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/InkEditor/components/AiSelectionBubble/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EACL,4BAA4B,EAC5B,kBAAkB,EAClB,yBAAyB,EACzB,sBAAsB,GACvB,MAAM,2BAA2B,CAAC;AACnC,YAAY,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC"}
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime");require("../../../../constants/openai.const.cjs");require("../../../../utils/paste.utils.cjs");require("react");require("react-dom");const i=require("../../../../common-components/icons/GripIcon.cjs"),e=require("./BlockHandles.const.cjs"),l=n=>{const{visible:L,top:_,onMoveUp:r,onMoveDown:o,onDragStart:s}=n;return L?t.jsxs("div",{className:e.BLOCK_HANDLES_CLASS,style:{top:_},"aria-hidden":!L,children:[t.jsx("button",{type:"button",className:e.BLOCK_HANDLES_PLUS_CLASS,title:e.BLOCK_HANDLES_TITLE_PLUS,tabIndex:-1,children:e.BLOCK_HANDLES_PLUS_LABEL}),t.jsx("button",{type:"button",className:e.BLOCK_HANDLES_GRIP_CLASS,title:e.BLOCK_HANDLES_TITLE_GRIP,tabIndex:-1,draggable:!0,onDragStart:s,children:t.jsx(i.GripIcon,{})}),t.jsx("button",{type:"button",className:e.BLOCK_HANDLES_BTN_CLASS,title:e.BLOCK_HANDLES_TITLE_UP,onClick:r,children:e.BLOCK_HANDLES_UP_LABEL}),t.jsx("button",{type:"button",className:e.BLOCK_HANDLES_BTN_CLASS,title:e.BLOCK_HANDLES_TITLE_DOWN,onClick:o,children:e.BLOCK_HANDLES_DOWN_LABEL})]}):null};exports.BlockHandles=l;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime");require("../../../../constants/openai.const.cjs");require("../../../../utils/paste.utils.cjs");require("../../../../utils/exportDocument.utils.cjs");require("react");require("react-dom");const s=require("../../../../common-components/icons/GripIcon.cjs"),e=require("./BlockHandles.const.cjs"),l=n=>{const{visible:L,top:r,onMoveUp:_,onMoveDown:o,onDragStart:i}=n;return L?t.jsxs("div",{className:e.BLOCK_HANDLES_CLASS,style:{top:r},"aria-hidden":!L,children:[t.jsx("button",{type:"button",className:e.BLOCK_HANDLES_PLUS_CLASS,title:e.BLOCK_HANDLES_TITLE_PLUS,tabIndex:-1,children:e.BLOCK_HANDLES_PLUS_LABEL}),t.jsx("button",{type:"button",className:e.BLOCK_HANDLES_GRIP_CLASS,title:e.BLOCK_HANDLES_TITLE_GRIP,tabIndex:-1,draggable:!0,onDragStart:i,children:t.jsx(s.GripIcon,{})}),t.jsx("button",{type:"button",className:e.BLOCK_HANDLES_BTN_CLASS,title:e.BLOCK_HANDLES_TITLE_UP,onClick:_,children:e.BLOCK_HANDLES_UP_LABEL}),t.jsx("button",{type:"button",className:e.BLOCK_HANDLES_BTN_CLASS,title:e.BLOCK_HANDLES_TITLE_DOWN,onClick:o,children:e.BLOCK_HANDLES_DOWN_LABEL})]}):null};exports.BlockHandles=l;
@@ -1,11 +1,12 @@
1
1
  import { jsxs as l, jsx as t } from "react/jsx-runtime";
2
2
  import "../../../../constants/openai.const.js";
3
3
  import "../../../../utils/paste.utils.js";
4
+ import "../../../../utils/exportDocument.utils.js";
4
5
  import "react";
5
6
  import "react-dom";
6
7
  import { GripIcon as S } from "../../../../common-components/icons/GripIcon.js";
7
- import { BLOCK_HANDLES_CLASS as a, BLOCK_HANDLES_PLUS_LABEL as N, BLOCK_HANDLES_TITLE_PLUS as s, BLOCK_HANDLES_PLUS_CLASS as A, BLOCK_HANDLES_TITLE_GRIP as E, BLOCK_HANDLES_GRIP_CLASS as C, BLOCK_HANDLES_UP_LABEL as c, BLOCK_HANDLES_TITLE_UP as B, BLOCK_HANDLES_BTN_CLASS as o, BLOCK_HANDLES_DOWN_LABEL as m, BLOCK_HANDLES_TITLE_DOWN as p } from "./BlockHandles.const.js";
8
- const I = (_) => {
8
+ import { BLOCK_HANDLES_CLASS as a, BLOCK_HANDLES_PLUS_LABEL as N, BLOCK_HANDLES_TITLE_PLUS as s, BLOCK_HANDLES_PLUS_CLASS as A, BLOCK_HANDLES_TITLE_GRIP as E, BLOCK_HANDLES_GRIP_CLASS as C, BLOCK_HANDLES_UP_LABEL as c, BLOCK_HANDLES_TITLE_UP as m, BLOCK_HANDLES_BTN_CLASS as o, BLOCK_HANDLES_DOWN_LABEL as p, BLOCK_HANDLES_TITLE_DOWN as B } from "./BlockHandles.const.js";
9
+ const T = (_) => {
9
10
  const { visible: L, top: e, onMoveUp: n, onMoveDown: r, onDragStart: i } = _;
10
11
  return L ? /* @__PURE__ */ l("div", { className: a, style: { top: e }, "aria-hidden": !L, children: [
11
12
  /* @__PURE__ */ t(
@@ -35,7 +36,7 @@ const I = (_) => {
35
36
  {
36
37
  type: "button",
37
38
  className: o,
38
- title: B,
39
+ title: m,
39
40
  onClick: n,
40
41
  children: c
41
42
  }
@@ -45,13 +46,13 @@ const I = (_) => {
45
46
  {
46
47
  type: "button",
47
48
  className: o,
48
- title: p,
49
+ title: B,
49
50
  onClick: r,
50
- children: m
51
+ children: p
51
52
  }
52
53
  )
53
54
  ] }) : null;
54
55
  };
55
56
  export {
56
- I as BlockHandles
57
+ T as BlockHandles
57
58
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),j=require("react"),x=c=>{const{comments:o,author:r,onAddReply:d,onResolve:_,onClose:l}=c,[a,m]=j.useState({}),u=(s,n)=>{var i;s.preventDefault();const t=(i=a[n])==null?void 0:i.trim();t&&(d(n,t),m(h=>({...h,[n]:""})))};return e.jsxs("aside",{className:"Ink-Comments","aria-label":"Comments archive",children:[e.jsxs("div",{className:"Ink-Comments__header",children:[e.jsx("strong",{children:"Comments archive"}),l?e.jsx("button",{type:"button",className:"Ink-Editor__button",onClick:l,title:"Close",children:"×"}):null]}),e.jsx("div",{className:"Ink-Comments__list",children:o.length===0?e.jsx("p",{className:"Ink-Comments__empty",children:"Select text and add a comment to start a thread."}):o.map(s=>e.jsxs("article",{className:`Ink-Comments__thread${s.resolved?" Ink-Comments__thread--resolved":""}`,children:[e.jsxs("header",{className:"Ink-Comments__meta",children:[e.jsx("span",{children:s.author}),e.jsx("time",{children:new Date(s.timestamp).toLocaleString()})]}),e.jsx("p",{className:"Ink-Comments__body",children:s.body}),s.replies.map(n=>e.jsxs("div",{className:"Ink-Comments__reply",children:[e.jsxs("header",{className:"Ink-Comments__meta",children:[e.jsx("span",{children:n.author}),e.jsx("time",{children:new Date(n.timestamp).toLocaleString()})]}),e.jsx("p",{className:"Ink-Comments__body",children:n.body})]},n.id)),s.resolved?e.jsx("p",{className:"Ink-Comments__resolved",children:"Resolved"}):e.jsxs("form",{className:"Ink-Comments__form",onSubmit:n=>u(n,s.id),children:[e.jsx("input",{value:a[s.id]??"",onChange:n=>m(t=>({...t,[s.id]:n.target.value})),placeholder:`Reply as ${r}…`,"aria-label":`Reply to ${s.author}`}),e.jsx("button",{type:"submit",className:"Ink-Editor__button Ink-Editor__button--active",children:"Reply"}),e.jsx("button",{type:"button",className:"Ink-Editor__button",onClick:()=>_(s.id),children:"Resolve"})]})]},s.id))})]})};exports.CommentsPanel=x;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),x=require("react"),C=c=>{const{comments:o,author:r,onAddReply:d,onResolve:u,onReopen:_,onFocus:p,onClose:l}=c,[a,m]=x.useState({}),b=(n,s)=>{var i;n.preventDefault();const t=(i=a[s])==null?void 0:i.trim();t&&(d(s,t),m(j=>({...j,[s]:""})))};return e.jsxs("aside",{className:"Ink-Comments","aria-label":"Comments archive",children:[e.jsxs("div",{className:"Ink-Comments__header",children:[e.jsx("strong",{children:"Comments archive"}),l?e.jsx("button",{type:"button",className:"Ink-Editor__button",onClick:l,title:"Close",children:"×"}):null]}),e.jsx("div",{className:"Ink-Comments__list",children:o.length===0?e.jsx("p",{className:"Ink-Comments__empty",children:"Select text and add a comment to start a thread."}):o.map(n=>e.jsxs("article",{className:`Ink-Comments__thread${n.resolved?" Ink-Comments__thread--resolved":""}`,onClick:()=>p(n.id),children:[e.jsxs("header",{className:"Ink-Comments__meta",children:[e.jsx("span",{children:n.author}),e.jsx("time",{children:new Date(n.timestamp).toLocaleString()})]}),e.jsx("p",{className:"Ink-Comments__body",children:n.body}),n.replies.map(s=>e.jsxs("div",{className:"Ink-Comments__reply",children:[e.jsxs("header",{className:"Ink-Comments__meta",children:[e.jsx("span",{children:s.author}),e.jsx("time",{children:new Date(s.timestamp).toLocaleString()})]}),e.jsx("p",{className:"Ink-Comments__body",children:s.body})]},s.id)),n.resolved?e.jsx("button",{type:"button",className:"Ink-Editor__button",onClick:()=>_(n.id),children:"Reopen"}):e.jsxs("form",{className:"Ink-Comments__form",onSubmit:s=>b(s,n.id),children:[e.jsx("input",{value:a[n.id]??"",onChange:s=>m(t=>({...t,[n.id]:s.target.value})),placeholder:`Reply as ${r}…`,"aria-label":`Reply to ${n.author}`}),e.jsx("button",{type:"submit",className:"Ink-Editor__button Ink-Editor__button--active",children:"Reply"}),e.jsx("button",{type:"button",className:"Ink-Editor__button",onClick:()=>u(n.id),children:"Resolve"})]})]},n.id))})]})};exports.CommentsPanel=C;
@@ -5,6 +5,8 @@ export interface CommentsPanelProps {
5
5
  author: string;
6
6
  onAddReply: (threadId: string, body: string) => void;
7
7
  onResolve: (threadId: string) => void;
8
+ onReopen: (threadId: string) => void;
9
+ onFocus: (threadId: string) => void;
8
10
  onClose?: () => void;
9
11
  }
10
12
  export declare const CommentsPanel: FC<CommentsPanelProps>;
@@ -1 +1 @@
1
- {"version":3,"file":"CommentsPanel.d.ts","sourceRoot":"","sources":["../../../../../src/components/InkEditor/components/CommentsPanel/CommentsPanel.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,EAAE,EAAkB,MAAM,OAAO,CAAC;AAC1D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAE1D,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,gBAAgB,EAAE,CAAC;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACrD,SAAS,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,eAAO,MAAM,aAAa,EAAE,EAAE,CAAC,kBAAkB,CA2EhD,CAAC"}
1
+ {"version":3,"file":"CommentsPanel.d.ts","sourceRoot":"","sources":["../../../../../src/components/InkEditor/components/CommentsPanel/CommentsPanel.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,EAAE,EAAkB,MAAM,OAAO,CAAC;AAC1D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAE1D,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,gBAAgB,EAAE,CAAC;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACrD,SAAS,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,QAAQ,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,OAAO,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IACpC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,eAAO,MAAM,aAAa,EAAE,EAAE,CAAC,kBAAkB,CA8EhD,CAAC"}
@@ -1,40 +1,41 @@
1
- import { jsxs as s, jsx as n } from "react/jsx-runtime";
2
- import { useState as C } from "react";
1
+ import { jsxs as o, jsx as n } from "react/jsx-runtime";
2
+ import { useState as k } from "react";
3
3
  const v = (r) => {
4
- const { comments: m, author: d, onAddReply: _, onResolve: p, onClose: l } = r, [a, i] = C({}), h = (e, t) => {
4
+ const { comments: l, author: d, onAddReply: _, onResolve: u, onReopen: p, onFocus: C, onClose: m } = r, [a, i] = k({}), b = (e, t) => {
5
5
  var c;
6
6
  e.preventDefault();
7
- const o = (c = a[t]) == null ? void 0 : c.trim();
8
- o && (_(t, o), i((u) => ({ ...u, [t]: "" })));
7
+ const s = (c = a[t]) == null ? void 0 : c.trim();
8
+ s && (_(t, s), i((h) => ({ ...h, [t]: "" })));
9
9
  };
10
- return /* @__PURE__ */ s("aside", { className: "Ink-Comments", "aria-label": "Comments archive", children: [
11
- /* @__PURE__ */ s("div", { className: "Ink-Comments__header", children: [
10
+ return /* @__PURE__ */ o("aside", { className: "Ink-Comments", "aria-label": "Comments archive", children: [
11
+ /* @__PURE__ */ o("div", { className: "Ink-Comments__header", children: [
12
12
  /* @__PURE__ */ n("strong", { children: "Comments archive" }),
13
- l ? /* @__PURE__ */ n("button", { type: "button", className: "Ink-Editor__button", onClick: l, title: "Close", children: "×" }) : null
13
+ m ? /* @__PURE__ */ n("button", { type: "button", className: "Ink-Editor__button", onClick: m, title: "Close", children: "×" }) : null
14
14
  ] }),
15
- /* @__PURE__ */ n("div", { className: "Ink-Comments__list", children: m.length === 0 ? /* @__PURE__ */ n("p", { className: "Ink-Comments__empty", children: "Select text and add a comment to start a thread." }) : m.map((e) => /* @__PURE__ */ s(
15
+ /* @__PURE__ */ n("div", { className: "Ink-Comments__list", children: l.length === 0 ? /* @__PURE__ */ n("p", { className: "Ink-Comments__empty", children: "Select text and add a comment to start a thread." }) : l.map((e) => /* @__PURE__ */ o(
16
16
  "article",
17
17
  {
18
18
  className: `Ink-Comments__thread${e.resolved ? " Ink-Comments__thread--resolved" : ""}`,
19
+ onClick: () => C(e.id),
19
20
  children: [
20
- /* @__PURE__ */ s("header", { className: "Ink-Comments__meta", children: [
21
+ /* @__PURE__ */ o("header", { className: "Ink-Comments__meta", children: [
21
22
  /* @__PURE__ */ n("span", { children: e.author }),
22
23
  /* @__PURE__ */ n("time", { children: new Date(e.timestamp).toLocaleString() })
23
24
  ] }),
24
25
  /* @__PURE__ */ n("p", { className: "Ink-Comments__body", children: e.body }),
25
- e.replies.map((t) => /* @__PURE__ */ s("div", { className: "Ink-Comments__reply", children: [
26
- /* @__PURE__ */ s("header", { className: "Ink-Comments__meta", children: [
26
+ e.replies.map((t) => /* @__PURE__ */ o("div", { className: "Ink-Comments__reply", children: [
27
+ /* @__PURE__ */ o("header", { className: "Ink-Comments__meta", children: [
27
28
  /* @__PURE__ */ n("span", { children: t.author }),
28
29
  /* @__PURE__ */ n("time", { children: new Date(t.timestamp).toLocaleString() })
29
30
  ] }),
30
31
  /* @__PURE__ */ n("p", { className: "Ink-Comments__body", children: t.body })
31
32
  ] }, t.id)),
32
- e.resolved ? /* @__PURE__ */ n("p", { className: "Ink-Comments__resolved", children: "Resolved" }) : /* @__PURE__ */ s("form", { className: "Ink-Comments__form", onSubmit: (t) => h(t, e.id), children: [
33
+ e.resolved ? /* @__PURE__ */ n("button", { type: "button", className: "Ink-Editor__button", onClick: () => p(e.id), children: "Reopen" }) : /* @__PURE__ */ o("form", { className: "Ink-Comments__form", onSubmit: (t) => b(t, e.id), children: [
33
34
  /* @__PURE__ */ n(
34
35
  "input",
35
36
  {
36
37
  value: a[e.id] ?? "",
37
- onChange: (t) => i((o) => ({ ...o, [e.id]: t.target.value })),
38
+ onChange: (t) => i((s) => ({ ...s, [e.id]: t.target.value })),
38
39
  placeholder: `Reply as ${d}…`,
39
40
  "aria-label": `Reply to ${e.author}`
40
41
  }
@@ -45,7 +46,7 @@ const v = (r) => {
45
46
  {
46
47
  type: "button",
47
48
  className: "Ink-Editor__button",
48
- onClick: () => p(e.id),
49
+ onClick: () => u(e.id),
49
50
  children: "Resolve"
50
51
  }
51
52
  )
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),E=require("react"),B=require("react-dom"),s=require("../../../../constants/numbers.cjs"),c=require("../../../../constants/generals.const.cjs"),P=require("../../../../constants/colorMode.const.cjs"),G=require("../../../../constants/keyboard.const.cjs"),o=require("../../../../constants/defaults.const.cjs");require("../../../../constants/openai.const.cjs");require("../../../../utils/paste.utils.cjs");const u=require("../../../../plugins/excel/excel.utils.cjs"),V=require("../ToolbarDropdown/ToolbarDropdown.utils.cjs"),k=require("../ToolbarButton/ToolbarButton.cjs"),F=X=>{var b;const{icon:D,disabled:O=!1,hint:w,onHint:g,pluginColor:I,onInsert:j}=X,[M,R]=E.useState(!1),[r,i]=E.useState(u.createEmptyExcelGrid),[S,d]=E.useState(null),[m,N]=E.useState(null),[T,y]=E.useState({top:s.NUMBER_ZERO,left:s.NUMBER_ZERO}),A=E.useRef(null),K=E.useRef(null),p=E.useRef(null),h=E.useRef(null),v=((b=r[s.NUMBER_ZERO])==null?void 0:b.length)??s.NUMBER_ONE,$=r.length<s.INK_EXCEL_SHEET_MAX_ROWS,x=v<s.INK_EXCEL_SHEET_MAX_COLS,H=r.length>s.NUMBER_ONE,U=v>s.NUMBER_ONE;E.useEffect(()=>{if(!M)return;const e=()=>{var L;const l=(L=p.current)==null?void 0:L.getBoundingClientRect().height,C=V.getToolbarDropdownMenuPosition(K.current,l&&l>s.NUMBER_ZERO?l:s.INK_EXCEL_MENU_ESTIMATED_HEIGHT_PX);y({top:C.top,left:C.left})};e();const t=window.requestAnimationFrame(e),_=l=>{var L,f;const C=l.target;(L=A.current)!=null&&L.contains(C)||(f=p.current)!=null&&f.contains(C)||R(!1)},a=l=>{l.key===G.KEY_ESCAPE&&R(!1)};return document.addEventListener("mousedown",_),document.addEventListener("keydown",a),window.addEventListener("resize",e),window.addEventListener("scroll",e,!0),()=>{window.cancelAnimationFrame(t),document.removeEventListener("mousedown",_),document.removeEventListener("keydown",a),window.removeEventListener("resize",e),window.removeEventListener("scroll",e,!0)}},[M,r.length,v]);const q=e=>{var a;const t=(a=e.target.files)==null?void 0:a[s.NUMBER_ZERO];if(!t)return;const _=new FileReader;_.onload=()=>{i(u.parseCsvText(String(_.result)))},_.readAsText(t)};return n.jsxs("div",{className:o.INK_CLASS_STYLE_DD,ref:A,children:[n.jsx("div",{ref:K,children:n.jsx(k.ToolbarButton,{icon:D,title:c.INK_EXCEL_TITLE,hint:w,onHint:g,pluginColor:I,disabled:O,onClick:()=>{O||(i(u.createEmptyExcelGrid()),R(e=>!e))}})}),M?B.createPortal(n.jsxs("div",{ref:p,className:`${o.INK_CLASS_STYLE_MENU} ${o.INK_CLASS_STYLE_MENU_PORTAL} ${o.INK_CLASS_STYLE_MENU_FORCED} ${o.INK_CLASS_EXCEL_PANEL}`,"data-color-mode":P.COLOR_MODE_LIGHT,role:"dialog","aria-label":c.INK_EXCEL_TITLE,style:{top:T.top,left:T.left},children:[n.jsx("div",{className:o.INK_CLASS_EXCEL_TITLE,children:c.INK_EXCEL_TITLE}),n.jsxs("div",{className:o.INK_CLASS_EXCEL_GRID,style:{gridTemplateColumns:`2rem repeat(${v}, minmax(0, 1fr))`},onMouseLeave:()=>{d(null),N(null)},children:[n.jsx("span",{className:o.INK_CLASS_EXCEL_CORNER}),(r[s.NUMBER_ZERO]??[]).map((e,t)=>{const _=S!==null&&t<=S;return n.jsx("span",{className:`${o.INK_CLASS_EXCEL_HEAD}${_?` ${o.INK_CLASS_EXCEL_COL_HOVER}`:""}`,onMouseEnter:()=>d(t),onMouseMove:()=>d(t),children:o.EXCEL_COL_LETTERS[t]??t+s.NUMBER_ONE},`h-${t}`)}),r.map((e,t)=>{const _=m!==null&&t<=m;return n.jsxs(E.Fragment,{children:[n.jsx("span",{className:`${o.INK_CLASS_EXCEL_HEAD}${_?` ${o.INK_CLASS_EXCEL_ROW_HOVER}`:""}`,onMouseEnter:()=>N(t),onMouseMove:()=>N(t),children:t+s.NUMBER_ONE}),e.map((a,l)=>{const C=S!==null&&l<=S,L=m!==null&&t<=m;return n.jsx("input",{className:`${o.INK_CLASS_EXCEL_CELL}${C?` ${o.INK_CLASS_EXCEL_COL_HOVER}`:""}${L?` ${o.INK_CLASS_EXCEL_ROW_HOVER}`:""}`,value:a,onMouseEnter:()=>{d(l),N(t)},onMouseMove:()=>{d(l),N(t)},onChange:f=>i(u.setExcelCell(r,t,l,f.target.value))},`${t}-${l}`)})]},`row-${t}`)})]}),n.jsxs("div",{className:o.INK_CLASS_EXCEL_ACTIONS,children:[n.jsx("button",{type:"button",disabled:!$,onMouseDown:e=>{e.preventDefault(),i(u.addExcelRow(r))},children:c.INK_EXCEL_ADD_ROW}),n.jsx("button",{type:"button",disabled:!x,onMouseDown:e=>{e.preventDefault(),i(u.addExcelCol(r))},children:c.INK_EXCEL_ADD_COL}),n.jsx("button",{type:"button",disabled:!H,onMouseDown:e=>{e.preventDefault(),i(u.removeExcelRow(r))},children:c.INK_EXCEL_REMOVE_ROW}),n.jsx("button",{type:"button",disabled:!U,onMouseDown:e=>{e.preventDefault(),i(u.removeExcelCol(r))},children:c.INK_EXCEL_REMOVE_COL}),n.jsx("button",{type:"button",onMouseDown:e=>{e.preventDefault(),i(u.clearExcelGrid(r))},children:c.INK_EXCEL_CLEAR}),n.jsx("button",{type:"button",onMouseDown:e=>{var t;e.preventDefault(),(t=h.current)==null||t.click()},children:c.INK_EXCEL_IMPORT}),n.jsx("button",{type:"button",className:o.INK_CLASS_EXCEL_INSERT,onMouseDown:e=>{e.preventDefault(),j(u.excelGridToTableHtml(r)),R(!1)},children:c.INK_EXCEL_INSERT})]}),n.jsx("input",{ref:h,type:"file",accept:u.CSV_ACCEPT,hidden:!0,onChange:q})]}),document.body):null]})};exports.ExcelSheetPanel=F;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),E=require("react"),B=require("react-dom"),s=require("../../../../constants/numbers.cjs"),i=require("../../../../constants/generals.const.cjs"),P=require("../../../../constants/colorMode.const.cjs"),G=require("../../../../constants/keyboard.const.cjs"),o=require("../../../../constants/defaults.const.cjs");require("../../../../constants/openai.const.cjs");require("../../../../utils/paste.utils.cjs");require("../../../../utils/exportDocument.utils.cjs");const l=require("../../../../plugins/excel/excel.utils.cjs"),V=require("../ToolbarDropdown/ToolbarDropdown.utils.cjs"),k=require("../ToolbarButton/ToolbarButton.cjs"),F=X=>{var h;const{icon:D,disabled:p=!1,hint:I,onHint:w,pluginColor:g,onInsert:x}=X,[S,L]=E.useState(!1),[r,c]=E.useState(l.createEmptyExcelGrid),[v,R]=E.useState(null),[O,m]=E.useState(null),[M,j]=E.useState({top:s.NUMBER_ZERO,left:s.NUMBER_ZERO}),T=E.useRef(null),A=E.useRef(null),f=E.useRef(null),K=E.useRef(null),N=((h=r[s.NUMBER_ZERO])==null?void 0:h.length)??s.NUMBER_ONE,y=r.length<s.INK_EXCEL_SHEET_MAX_ROWS,$=N<s.INK_EXCEL_SHEET_MAX_COLS,q=r.length>s.NUMBER_ONE,H=N>s.NUMBER_ONE;E.useEffect(()=>{if(!S)return;const e=()=>{var C;const a=(C=f.current)==null?void 0:C.getBoundingClientRect().height,d=V.getToolbarDropdownMenuPosition(A.current,a&&a>s.NUMBER_ZERO?a:s.INK_EXCEL_MENU_ESTIMATED_HEIGHT_PX);j({top:d.top,left:d.left})};e();const t=window.requestAnimationFrame(e),u=a=>{var C,b;const d=a.target;(C=T.current)!=null&&C.contains(d)||(b=f.current)!=null&&b.contains(d)||L(!1)},_=a=>{a.key===G.KEY_ESCAPE&&L(!1)};return document.addEventListener("mousedown",u),document.addEventListener("keydown",_),window.addEventListener("resize",e),window.addEventListener("scroll",e,!0),()=>{window.cancelAnimationFrame(t),document.removeEventListener("mousedown",u),document.removeEventListener("keydown",_),window.removeEventListener("resize",e),window.removeEventListener("scroll",e,!0)}},[S,r.length,N]);const U=e=>{var _;const t=(_=e.target.files)==null?void 0:_[s.NUMBER_ZERO];if(!t)return;const u=new FileReader;u.onload=()=>{c(l.parseCsvText(String(u.result)))},u.readAsText(t)};return n.jsxs("div",{className:o.INK_CLASS_STYLE_DD,ref:T,children:[n.jsx("div",{ref:A,children:n.jsx(k.ToolbarButton,{icon:D,title:i.INK_EXCEL_TITLE,hint:I,onHint:w,pluginColor:g,disabled:p,onClick:()=>{p||(c(l.createEmptyExcelGrid()),L(e=>!e))}})}),S?B.createPortal(n.jsxs("div",{ref:f,className:`${o.INK_CLASS_STYLE_MENU} ${o.INK_CLASS_STYLE_MENU_PORTAL} ${o.INK_CLASS_STYLE_MENU_FORCED} ${o.INK_CLASS_EXCEL_PANEL}`,"data-color-mode":P.COLOR_MODE_LIGHT,role:"dialog","aria-label":i.INK_EXCEL_TITLE,style:{top:M.top,left:M.left},children:[n.jsx("div",{className:o.INK_CLASS_EXCEL_TITLE,children:i.INK_EXCEL_TITLE}),n.jsxs("div",{className:o.INK_CLASS_EXCEL_GRID,style:{gridTemplateColumns:`2rem repeat(${N}, minmax(0, 1fr))`},onMouseLeave:()=>{R(null),m(null)},children:[n.jsx("span",{className:o.INK_CLASS_EXCEL_CORNER}),(r[s.NUMBER_ZERO]??[]).map((e,t)=>n.jsx("span",{className:`${o.INK_CLASS_EXCEL_HEAD}${v===t?` ${o.INK_CLASS_EXCEL_COL_HOVER}`:""}`,onMouseEnter:()=>R(t),children:o.EXCEL_COL_LETTERS[t]??t+s.NUMBER_ONE},`h-${t}`)),r.map((e,t)=>n.jsxs(E.Fragment,{children:[n.jsx("span",{className:`${o.INK_CLASS_EXCEL_HEAD}${O===t?` ${o.INK_CLASS_EXCEL_ROW_HOVER}`:""}`,onMouseEnter:()=>m(t),children:t+s.NUMBER_ONE}),e.map((u,_)=>n.jsx("input",{className:`${o.INK_CLASS_EXCEL_CELL}${v===_?` ${o.INK_CLASS_EXCEL_COL_HOVER}`:""}${O===t?` ${o.INK_CLASS_EXCEL_ROW_HOVER}`:""}`,value:u,onMouseEnter:()=>{R(_),m(t)},onChange:a=>c(l.setExcelCell(r,t,_,a.target.value))},`${t}-${_}`))]},`row-${t}`))]}),n.jsxs("div",{className:o.INK_CLASS_EXCEL_ACTIONS,children:[n.jsx("button",{type:"button",disabled:!y,onMouseDown:e=>{e.preventDefault(),c(l.addExcelRow(r))},children:i.INK_EXCEL_ADD_ROW}),n.jsx("button",{type:"button",disabled:!$,onMouseDown:e=>{e.preventDefault(),c(l.addExcelCol(r))},children:i.INK_EXCEL_ADD_COL}),n.jsx("button",{type:"button",disabled:!q,onMouseDown:e=>{e.preventDefault(),c(l.removeExcelRow(r))},children:i.INK_EXCEL_REMOVE_ROW}),n.jsx("button",{type:"button",disabled:!H,onMouseDown:e=>{e.preventDefault(),c(l.removeExcelCol(r))},children:i.INK_EXCEL_REMOVE_COL}),n.jsx("button",{type:"button",onMouseDown:e=>{e.preventDefault(),c(l.clearExcelGrid(r))},children:i.INK_EXCEL_CLEAR}),n.jsx("button",{type:"button",onMouseDown:e=>{var t;e.preventDefault(),(t=K.current)==null||t.click()},children:i.INK_EXCEL_IMPORT}),n.jsx("button",{type:"button",className:o.INK_CLASS_EXCEL_INSERT,onMouseDown:e=>{e.preventDefault(),x(l.excelGridToTableHtml(r)),L(!1)},children:i.INK_EXCEL_INSERT})]}),n.jsx("input",{ref:K,type:"file",accept:l.CSV_ACCEPT,hidden:!0,onChange:U})]}),document.body):null]})};exports.ExcelSheetPanel=F;
@@ -1 +1 @@
1
- {"version":3,"file":"ExcelSheetPanel.d.ts","sourceRoot":"","sources":["../../../../../src/components/InkEditor/components/ExcelSheetPanel/ExcelSheetPanel.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA2D,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AAgDzF,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAEpE,eAAO,MAAM,eAAe,EAAE,EAAE,CAAC,oBAAoB,CAmOpD,CAAC"}
1
+ {"version":3,"file":"ExcelSheetPanel.d.ts","sourceRoot":"","sources":["../../../../../src/components/InkEditor/components/ExcelSheetPanel/ExcelSheetPanel.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA2D,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AAgDzF,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAEpE,eAAO,MAAM,eAAe,EAAE,EAAE,CAAC,oBAAoB,CAmNpD,CAAC"}