@forgedevstack/ink 1.1.6 → 1.1.8

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 (278) hide show
  1. package/CHANGELOG.md +57 -1
  2. package/README.md +9 -1
  3. package/bin/ink.const.mjs +26 -0
  4. package/bin/ink.mjs +58 -0
  5. package/dist/common-components/icons/BulletListIcon.cjs +1 -0
  6. package/dist/common-components/icons/BulletListIcon.d.ts +3 -0
  7. package/dist/common-components/icons/BulletListIcon.d.ts.map +1 -0
  8. package/dist/common-components/icons/BulletListIcon.js +11 -0
  9. package/dist/common-components/icons/ChecklistIcon.cjs +1 -0
  10. package/dist/common-components/icons/ChecklistIcon.d.ts +3 -0
  11. package/dist/common-components/icons/ChecklistIcon.d.ts.map +1 -0
  12. package/dist/common-components/icons/ChecklistIcon.js +10 -0
  13. package/dist/common-components/icons/ImageToolIcon.cjs +1 -0
  14. package/dist/common-components/icons/ImageToolIcon.d.ts +3 -0
  15. package/dist/common-components/icons/ImageToolIcon.d.ts.map +1 -0
  16. package/dist/common-components/icons/ImageToolIcon.js +10 -0
  17. package/dist/common-components/icons/LinkToolIcon.cjs +1 -0
  18. package/dist/common-components/icons/LinkToolIcon.d.ts +3 -0
  19. package/dist/common-components/icons/LinkToolIcon.d.ts.map +1 -0
  20. package/dist/common-components/icons/LinkToolIcon.js +9 -0
  21. package/dist/common-components/icons/OrderedListIcon.cjs +1 -0
  22. package/dist/common-components/icons/OrderedListIcon.d.ts +3 -0
  23. package/dist/common-components/icons/OrderedListIcon.d.ts.map +1 -0
  24. package/dist/common-components/icons/OrderedListIcon.js +9 -0
  25. package/dist/common-components/icons/QuoteIcon.cjs +1 -0
  26. package/dist/common-components/icons/QuoteIcon.d.ts +3 -0
  27. package/dist/common-components/icons/QuoteIcon.d.ts.map +1 -0
  28. package/dist/common-components/icons/QuoteIcon.js +6 -0
  29. package/dist/common-components/icons/TableToolIcon.cjs +1 -0
  30. package/dist/common-components/icons/TableToolIcon.d.ts +3 -0
  31. package/dist/common-components/icons/TableToolIcon.d.ts.map +1 -0
  32. package/dist/common-components/icons/TableToolIcon.js +9 -0
  33. package/dist/common-components/icons/index.d.ts +7 -0
  34. package/dist/common-components/icons/index.d.ts.map +1 -1
  35. package/dist/common-components/index.d.ts +1 -1
  36. package/dist/common-components/index.d.ts.map +1 -1
  37. package/dist/components/InkEditor/InkEditor.cjs +1 -1
  38. package/dist/components/InkEditor/InkEditor.d.ts.map +1 -1
  39. package/dist/components/InkEditor/InkEditor.js +1230 -778
  40. package/dist/components/InkEditor/components/AiPanel/AiPanel.cjs +1 -1
  41. package/dist/components/InkEditor/components/AiPanel/AiPanel.d.ts.map +1 -1
  42. package/dist/components/InkEditor/components/AiPanel/AiPanel.js +58 -52
  43. package/dist/components/InkEditor/components/ExcelSheetPanel/ExcelSheetPanel.cjs +1 -0
  44. package/dist/components/InkEditor/components/ExcelSheetPanel/ExcelSheetPanel.d.ts +4 -0
  45. package/dist/components/InkEditor/components/ExcelSheetPanel/ExcelSheetPanel.d.ts.map +1 -0
  46. package/dist/components/InkEditor/components/ExcelSheetPanel/ExcelSheetPanel.js +209 -0
  47. package/dist/components/InkEditor/components/ExcelSheetPanel/ExcelSheetPanel.types.d.ts +10 -0
  48. package/dist/components/InkEditor/components/ExcelSheetPanel/ExcelSheetPanel.types.d.ts.map +1 -0
  49. package/dist/components/InkEditor/components/ExcelSheetPanel/index.d.ts +3 -0
  50. package/dist/components/InkEditor/components/ExcelSheetPanel/index.d.ts.map +1 -0
  51. package/dist/components/InkEditor/components/GraphEditModal/GraphEditModal.cjs +1 -0
  52. package/dist/components/InkEditor/components/GraphEditModal/GraphEditModal.d.ts +4 -0
  53. package/dist/components/InkEditor/components/GraphEditModal/GraphEditModal.d.ts.map +1 -0
  54. package/dist/components/InkEditor/components/GraphEditModal/GraphEditModal.js +91 -0
  55. package/dist/components/InkEditor/components/GraphEditModal/GraphEditModal.types.d.ts +11 -0
  56. package/dist/components/InkEditor/components/GraphEditModal/GraphEditModal.types.d.ts.map +1 -0
  57. package/dist/components/InkEditor/components/GraphEditModal/index.d.ts +3 -0
  58. package/dist/components/InkEditor/components/GraphEditModal/index.d.ts.map +1 -0
  59. package/dist/components/InkEditor/components/GraphPicker/GraphPicker.cjs +1 -0
  60. package/dist/components/InkEditor/components/GraphPicker/GraphPicker.d.ts +4 -0
  61. package/dist/components/InkEditor/components/GraphPicker/GraphPicker.d.ts.map +1 -0
  62. package/dist/components/InkEditor/components/GraphPicker/GraphPicker.js +98 -0
  63. package/dist/components/InkEditor/components/GraphPicker/GraphPicker.types.d.ts +10 -0
  64. package/dist/components/InkEditor/components/GraphPicker/GraphPicker.types.d.ts.map +1 -0
  65. package/dist/components/InkEditor/components/GraphPicker/index.d.ts +3 -0
  66. package/dist/components/InkEditor/components/GraphPicker/index.d.ts.map +1 -0
  67. package/dist/components/InkEditor/components/HtmlSourcePanel/HtmlSourcePanel.cjs +1 -0
  68. package/dist/components/InkEditor/components/HtmlSourcePanel/HtmlSourcePanel.d.ts +4 -0
  69. package/dist/components/InkEditor/components/HtmlSourcePanel/HtmlSourcePanel.d.ts.map +1 -0
  70. package/dist/components/InkEditor/components/HtmlSourcePanel/HtmlSourcePanel.js +27 -0
  71. package/dist/components/InkEditor/components/HtmlSourcePanel/HtmlSourcePanel.types.d.ts +7 -0
  72. package/dist/components/InkEditor/components/HtmlSourcePanel/HtmlSourcePanel.types.d.ts.map +1 -0
  73. package/dist/components/InkEditor/components/HtmlSourcePanel/index.d.ts +3 -0
  74. package/dist/components/InkEditor/components/HtmlSourcePanel/index.d.ts.map +1 -0
  75. package/dist/components/InkEditor/components/OutlineRail/OutlineRail.cjs +1 -0
  76. package/dist/components/InkEditor/components/OutlineRail/OutlineRail.d.ts +4 -0
  77. package/dist/components/InkEditor/components/OutlineRail/OutlineRail.d.ts.map +1 -0
  78. package/dist/components/InkEditor/components/OutlineRail/OutlineRail.js +36 -0
  79. package/dist/components/InkEditor/components/OutlineRail/OutlineRail.types.d.ts +8 -0
  80. package/dist/components/InkEditor/components/OutlineRail/OutlineRail.types.d.ts.map +1 -0
  81. package/dist/components/InkEditor/components/OutlineRail/index.d.ts +3 -0
  82. package/dist/components/InkEditor/components/OutlineRail/index.d.ts.map +1 -0
  83. package/dist/components/InkEditor/components/SlashMenu/SlashMenu.cjs +1 -1
  84. package/dist/components/InkEditor/components/SlashMenu/SlashMenu.d.ts +1 -0
  85. package/dist/components/InkEditor/components/SlashMenu/SlashMenu.d.ts.map +1 -1
  86. package/dist/components/InkEditor/components/SlashMenu/SlashMenu.js +62 -17
  87. package/dist/components/InkEditor/components/TableSizePicker/TableSizePicker.cjs +1 -0
  88. package/dist/components/InkEditor/components/TableSizePicker/TableSizePicker.const.cjs +1 -0
  89. package/dist/components/InkEditor/components/TableSizePicker/TableSizePicker.const.d.ts +10 -0
  90. package/dist/components/InkEditor/components/TableSizePicker/TableSizePicker.const.d.ts.map +1 -0
  91. package/dist/components/InkEditor/components/TableSizePicker/TableSizePicker.const.js +18 -0
  92. package/dist/components/InkEditor/components/TableSizePicker/TableSizePicker.d.ts +4 -0
  93. package/dist/components/InkEditor/components/TableSizePicker/TableSizePicker.d.ts.map +1 -0
  94. package/dist/components/InkEditor/components/TableSizePicker/TableSizePicker.js +95 -0
  95. package/dist/components/InkEditor/components/TableSizePicker/TableSizePicker.types.d.ts +11 -0
  96. package/dist/components/InkEditor/components/TableSizePicker/TableSizePicker.types.d.ts.map +1 -0
  97. package/dist/components/InkEditor/components/TableSizePicker/index.d.ts +3 -0
  98. package/dist/components/InkEditor/components/TableSizePicker/index.d.ts.map +1 -0
  99. package/dist/components/InkEditor/components/ThemePicker/ThemePicker.cjs +1 -0
  100. package/dist/components/InkEditor/components/ThemePicker/ThemePicker.d.ts +4 -0
  101. package/dist/components/InkEditor/components/ThemePicker/ThemePicker.d.ts.map +1 -0
  102. package/dist/components/InkEditor/components/ThemePicker/ThemePicker.js +81 -0
  103. package/dist/components/InkEditor/components/ThemePicker/ThemePicker.types.d.ts +12 -0
  104. package/dist/components/InkEditor/components/ThemePicker/ThemePicker.types.d.ts.map +1 -0
  105. package/dist/components/InkEditor/components/ThemePicker/index.d.ts +3 -0
  106. package/dist/components/InkEditor/components/ThemePicker/index.d.ts.map +1 -0
  107. package/dist/components/InkEditor/components/TitleGallery/TitleGallery.cjs +1 -0
  108. package/dist/components/InkEditor/components/TitleGallery/TitleGallery.d.ts +4 -0
  109. package/dist/components/InkEditor/components/TitleGallery/TitleGallery.d.ts.map +1 -0
  110. package/dist/components/InkEditor/components/TitleGallery/TitleGallery.js +79 -0
  111. package/dist/components/InkEditor/components/TitleGallery/TitleGallery.types.d.ts +10 -0
  112. package/dist/components/InkEditor/components/TitleGallery/TitleGallery.types.d.ts.map +1 -0
  113. package/dist/components/InkEditor/components/TitleGallery/index.d.ts +3 -0
  114. package/dist/components/InkEditor/components/TitleGallery/index.d.ts.map +1 -0
  115. package/dist/components/InkEditor/components/ToolbarButton/ToolbarButton.cjs +1 -1
  116. package/dist/components/InkEditor/components/ToolbarButton/ToolbarButton.d.ts.map +1 -1
  117. package/dist/components/InkEditor/components/ToolbarButton/ToolbarButton.js +41 -17
  118. package/dist/components/InkEditor/components/ToolbarDropdown/ToolbarDropdown.cjs +1 -1
  119. package/dist/components/InkEditor/components/ToolbarDropdown/ToolbarDropdown.d.ts.map +1 -1
  120. package/dist/components/InkEditor/components/ToolbarDropdown/ToolbarDropdown.js +93 -18
  121. package/dist/components/InkEditor/components/ToolbarDropdown/ToolbarDropdown.types.d.ts +6 -0
  122. package/dist/components/InkEditor/components/ToolbarDropdown/ToolbarDropdown.types.d.ts.map +1 -0
  123. package/dist/components/InkEditor/components/ToolbarDropdown/ToolbarDropdown.utils.cjs +1 -0
  124. package/dist/components/InkEditor/components/ToolbarDropdown/ToolbarDropdown.utils.d.ts +3 -0
  125. package/dist/components/InkEditor/components/ToolbarDropdown/ToolbarDropdown.utils.d.ts.map +1 -0
  126. package/dist/components/InkEditor/components/ToolbarDropdown/ToolbarDropdown.utils.js +15 -0
  127. package/dist/components/InkEditor/components/ToolbarDropdown/index.d.ts +2 -0
  128. package/dist/components/InkEditor/components/ToolbarDropdown/index.d.ts.map +1 -1
  129. package/dist/components/InkEditor/components/index.d.ts +16 -0
  130. package/dist/components/InkEditor/components/index.d.ts.map +1 -1
  131. package/dist/components/InkEditor/helpers/format.utils.cjs +2 -2
  132. package/dist/components/InkEditor/helpers/format.utils.d.ts +1 -1
  133. package/dist/components/InkEditor/helpers/format.utils.d.ts.map +1 -1
  134. package/dist/components/InkEditor/helpers/format.utils.js +72 -72
  135. package/dist/constants/colorMode.const.cjs +1 -1
  136. package/dist/constants/colorMode.const.d.ts +1 -1
  137. package/dist/constants/colorMode.const.d.ts.map +1 -1
  138. package/dist/constants/colorMode.const.js +4 -4
  139. package/dist/constants/contextMenu.const.cjs +1 -1
  140. package/dist/constants/contextMenu.const.d.ts +2 -0
  141. package/dist/constants/contextMenu.const.d.ts.map +1 -1
  142. package/dist/constants/contextMenu.const.js +17 -15
  143. package/dist/constants/defaultIcons.cjs +1 -1
  144. package/dist/constants/defaultIcons.d.ts.map +1 -1
  145. package/dist/constants/defaultIcons.js +35 -18
  146. package/dist/constants/defaults.const.cjs +1 -1
  147. package/dist/constants/defaults.const.d.ts +95 -1
  148. package/dist/constants/defaults.const.d.ts.map +1 -1
  149. package/dist/constants/defaults.const.js +323 -57
  150. package/dist/constants/generals.const.cjs +1 -1
  151. package/dist/constants/generals.const.d.ts +90 -0
  152. package/dist/constants/generals.const.d.ts.map +1 -1
  153. package/dist/constants/generals.const.js +75 -4
  154. package/dist/constants/index.d.ts +1 -0
  155. package/dist/constants/index.d.ts.map +1 -1
  156. package/dist/constants/keyboard.const.cjs +1 -1
  157. package/dist/constants/keyboard.const.d.ts +1 -0
  158. package/dist/constants/keyboard.const.d.ts.map +1 -1
  159. package/dist/constants/keyboard.const.js +2 -1
  160. package/dist/constants/lists.const.cjs +1 -1
  161. package/dist/constants/lists.const.d.ts +1 -0
  162. package/dist/constants/lists.const.d.ts.map +1 -1
  163. package/dist/constants/lists.const.js +10 -9
  164. package/dist/constants/numbers.cjs +1 -1
  165. package/dist/constants/numbers.d.ts +19 -1
  166. package/dist/constants/numbers.d.ts.map +1 -1
  167. package/dist/constants/numbers.js +46 -27
  168. package/dist/constants/plugins.const.cjs +1 -0
  169. package/dist/constants/plugins.const.d.ts +13 -0
  170. package/dist/constants/plugins.const.d.ts.map +1 -0
  171. package/dist/constants/plugins.const.js +45 -0
  172. package/dist/constants/premium.const.cjs +1 -1
  173. package/dist/constants/premium.const.d.ts.map +1 -1
  174. package/dist/constants/premium.const.js +10 -9
  175. package/dist/constants/table.const.cjs +1 -1
  176. package/dist/constants/table.const.d.ts +4 -0
  177. package/dist/constants/table.const.d.ts.map +1 -1
  178. package/dist/constants/table.const.js +10 -6
  179. package/dist/constants/toolbar.const.cjs +1 -1
  180. package/dist/constants/toolbar.const.d.ts +8 -0
  181. package/dist/constants/toolbar.const.d.ts.map +1 -1
  182. package/dist/constants/toolbar.const.js +16 -8
  183. package/dist/constants/toolbarMenu.const.cjs +1 -1
  184. package/dist/constants/toolbarMenu.const.d.ts +2 -0
  185. package/dist/constants/toolbarMenu.const.d.ts.map +1 -1
  186. package/dist/constants/toolbarMenu.const.js +80 -18
  187. package/dist/hooks/index.d.ts +2 -0
  188. package/dist/hooks/index.d.ts.map +1 -0
  189. package/dist/hooks/useToolbarOverflow.cjs +1 -0
  190. package/dist/hooks/useToolbarOverflow.d.ts +8 -0
  191. package/dist/hooks/useToolbarOverflow.d.ts.map +1 -0
  192. package/dist/hooks/useToolbarOverflow.js +29 -0
  193. package/dist/index.cjs +1 -1
  194. package/dist/index.d.ts +6 -3
  195. package/dist/index.d.ts.map +1 -1
  196. package/dist/index.js +126 -93
  197. package/dist/plugins/excel/excel.utils.cjs +1 -0
  198. package/dist/plugins/excel/excel.utils.d.ts +13 -0
  199. package/dist/plugins/excel/excel.utils.d.ts.map +1 -0
  200. package/dist/plugins/excel/excel.utils.js +40 -0
  201. package/dist/plugins/excel/index.d.ts +3 -0
  202. package/dist/plugins/excel/index.d.ts.map +1 -0
  203. package/dist/plugins/graph/graph.const.cjs +1 -0
  204. package/dist/plugins/graph/graph.const.d.ts +14 -0
  205. package/dist/plugins/graph/graph.const.d.ts.map +1 -0
  206. package/dist/plugins/graph/graph.const.js +24 -0
  207. package/dist/plugins/graph/graph.types.d.ts +7 -0
  208. package/dist/plugins/graph/graph.types.d.ts.map +1 -0
  209. package/dist/plugins/graph/graph.utils.cjs +1 -0
  210. package/dist/plugins/graph/graph.utils.d.ts +11 -0
  211. package/dist/plugins/graph/graph.utils.d.ts.map +1 -0
  212. package/dist/plugins/graph/graph.utils.js +76 -0
  213. package/dist/plugins/graph/index.d.ts +4 -0
  214. package/dist/plugins/graph/index.d.ts.map +1 -0
  215. package/dist/plugins/host/index.d.ts +2 -0
  216. package/dist/plugins/host/index.d.ts.map +1 -0
  217. package/dist/plugins/host/inkPlugins.cjs +1 -0
  218. package/dist/plugins/host/inkPlugins.d.ts +16 -0
  219. package/dist/plugins/host/inkPlugins.d.ts.map +1 -0
  220. package/dist/plugins/host/inkPlugins.js +20 -0
  221. package/dist/plugins/index.d.ts +5 -0
  222. package/dist/plugins/index.d.ts.map +1 -0
  223. package/dist/plugins/theme/index.d.ts +4 -0
  224. package/dist/plugins/theme/index.d.ts.map +1 -0
  225. package/dist/plugins/theme/inkTheme.cjs +1 -0
  226. package/dist/plugins/theme/inkTheme.d.ts +5 -0
  227. package/dist/plugins/theme/inkTheme.d.ts.map +1 -0
  228. package/dist/plugins/theme/inkTheme.js +30 -0
  229. package/dist/plugins/theme/theme.const.cjs +1 -0
  230. package/dist/plugins/theme/theme.const.d.ts +9 -0
  231. package/dist/plugins/theme/theme.const.d.ts.map +1 -0
  232. package/dist/plugins/theme/theme.const.js +15 -0
  233. package/dist/plugins/theme/theme.types.d.ts +12 -0
  234. package/dist/plugins/theme/theme.types.d.ts.map +1 -0
  235. package/dist/plugins/titles/index.d.ts +4 -0
  236. package/dist/plugins/titles/index.d.ts.map +1 -0
  237. package/dist/plugins/titles/titles.const.cjs +1 -0
  238. package/dist/plugins/titles/titles.const.d.ts +4 -0
  239. package/dist/plugins/titles/titles.const.d.ts.map +1 -0
  240. package/dist/plugins/titles/titles.const.js +15 -0
  241. package/dist/plugins/titles/titles.types.d.ts +2 -0
  242. package/dist/plugins/titles/titles.types.d.ts.map +1 -0
  243. package/dist/plugins/titles/titles.utils.cjs +1 -0
  244. package/dist/plugins/titles/titles.utils.d.ts +3 -0
  245. package/dist/plugins/titles/titles.utils.d.ts.map +1 -0
  246. package/dist/plugins/titles/titles.utils.js +14 -0
  247. package/dist/styles.css +1 -1
  248. package/dist/types/features.types.d.ts +1 -1
  249. package/dist/types/features.types.d.ts.map +1 -1
  250. package/dist/types/index.d.ts +3 -1
  251. package/dist/types/index.d.ts.map +1 -1
  252. package/dist/types/ink.types.d.ts +15 -2
  253. package/dist/types/ink.types.d.ts.map +1 -1
  254. package/dist/types/outline.types.d.ts +6 -0
  255. package/dist/types/outline.types.d.ts.map +1 -0
  256. package/dist/types/plugin.types.d.ts +8 -0
  257. package/dist/types/plugin.types.d.ts.map +1 -0
  258. package/dist/types/premium.types.d.ts +2 -2
  259. package/dist/types/premium.types.d.ts.map +1 -1
  260. package/dist/utils/index.d.ts +5 -2
  261. package/dist/utils/index.d.ts.map +1 -1
  262. package/dist/utils/outline.utils.cjs +1 -0
  263. package/dist/utils/outline.utils.d.ts +8 -0
  264. package/dist/utils/outline.utils.d.ts.map +1 -0
  265. package/dist/utils/outline.utils.js +49 -0
  266. package/dist/utils/slash.utils.cjs +1 -1
  267. package/dist/utils/slash.utils.d.ts +5 -0
  268. package/dist/utils/slash.utils.d.ts.map +1 -1
  269. package/dist/utils/slash.utils.js +24 -7
  270. package/dist/utils/table.utils.cjs +1 -1
  271. package/dist/utils/table.utils.d.ts +4 -0
  272. package/dist/utils/table.utils.d.ts.map +1 -1
  273. package/dist/utils/table.utils.js +84 -45
  274. package/dist/utils/words.utils.cjs +1 -0
  275. package/dist/utils/words.utils.d.ts +2 -0
  276. package/dist/utils/words.utils.d.ts.map +1 -0
  277. package/dist/utils/words.utils.js +14 -0
  278. package/package.json +7 -1
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),i=require("react"),k=require("../../../../constants/defaults.const.cjs"),G=require("../../../../constants/aiModels.const.cjs");require("../../../../constants/openai.const.cjs");const C=require("../../../../utils/id.utils.cjs");require("../../../../utils/paste.utils.cjs");require("react-dom");const $=require("../../../../plugins/ai/aiPlugin.cjs"),B=T=>{var N,f,y,S;const{config:s,documentHtml:v,selectionHtml:b,onApplyHtml:L,onClose:x,onBusyChange:_}=T,[a,H]=i.useState("chat"),[g,j]=i.useState(""),[r,h]=i.useState([]),[l,q]=i.useState(!1),[o,m]=i.useState(null),[D,M]=i.useState([]),[A,R]=i.useState(k.INK_TRANSLATE_LANGUAGES[1]),K=s.providerId||G.INK_AI_DEMO_PROVIDER_ID,O=((N=s.uiTheme)==null?void 0:N.className)||s.className||"",p=e=>{q(e),_==null||_(e)},c=async(e,d,u)=>{var E;p(!0);try{const w=e==="chat"&&u?[...r,{id:C.createInkId("turn"),role:"user",content:u,timestamp:Date.now(),capability:e}]:r;e==="chat"&&u&&h(w);const n=await $.inkAi.runProvider(K,{capability:e,html:v,selectionHtml:b||void 0,prompt:u,history:w,options:d,modelId:s.modelId,documentSnapshot:{html:v,selectionHtml:b||void 0}});(E=n.turns)!=null&&E.length?h(I=>[...I,...n.turns]):n.text&&e!=="chat"&&h(I=>[...I,{id:C.createInkId("turn"),role:"assistant",content:n.text||"",timestamp:Date.now(),capability:e}]),n.diff&&m(n.diff),n.reviewSuggestions&&M(n.reviewSuggestions)}finally{p(!1)}},P=e=>{e.preventDefault();const d=g.trim();!d||l||(j(""),c("chat",void 0,d))};return t.jsxs("aside",{className:`Ink-Ai ${O}`.trim(),"data-placement":s.placement||"sidebar",style:{"--ink-ai-accent":(f=s.uiTheme)==null?void 0:f.accent,"--ink-ai-surface":(y=s.uiTheme)==null?void 0:y.surface,"--ink-ai-border":(S=s.uiTheme)==null?void 0:S.border},"aria-label":"Ink AI",children:[t.jsxs("div",{className:"Ink-Ai__header",children:[t.jsx("strong",{children:"Ink AI"}),x?t.jsx("button",{type:"button",className:"Ink-Editor__button",onClick:x,title:"Close AI",children:"×"}):null]}),t.jsx("div",{className:"Ink-Ai__tabs",role:"tablist",children:["chat","actions","review","translate"].map(e=>t.jsx("button",{type:"button",role:"tab",className:`Ink-Editor__button${a===e?" Ink-Editor__button--active":""}`,"aria-selected":a===e,onClick:()=>H(e),children:e},e))}),t.jsxs("div",{className:"Ink-Ai__body",children:[a==="chat"?t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"Ink-Ai__history",children:r.length===0?t.jsxs("p",{className:"Ink-Ai__empty",children:["Multi-turn chat with local demo provider. Bring your own LLM via"," ",t.jsx("code",{children:"inkAi.registerProvider"}),"."]}):r.map(e=>t.jsxs("div",{className:`Ink-Ai__turn Ink-Ai__turn--${e.role}`,children:[t.jsx("span",{children:e.role}),t.jsx("p",{children:e.content})]},e.id))}),t.jsxs("form",{className:"Ink-Ai__form",onSubmit:P,children:[t.jsx("input",{value:g,onChange:e=>j(e.target.value),placeholder:"Ask Ink AI…",disabled:l}),t.jsx("button",{type:"submit",className:"Ink-Editor__button Ink-Editor__button--active",disabled:l,children:"Send"})]})]}):null,a==="actions"?t.jsxs("div",{className:"Ink-Ai__actions",children:[t.jsx("p",{className:"Ink-Ai__hint",children:"Quick actions use the current selection (or full document)."}),k.INK_QUICK_ACTIONS.map(e=>t.jsx("button",{type:"button",className:"Ink-Editor__button Ink-Ai__action",disabled:l,onClick:()=>void c(e.capability),children:e.label},e.id))]}):null,a==="review"?t.jsxs("div",{className:"Ink-Ai__review",children:[t.jsx("button",{type:"button",className:"Ink-Editor__button Ink-Editor__button--active",disabled:l,onClick:()=>void c("review"),children:"Run grammar & style review"}),D.map(e=>t.jsxs("article",{className:`Ink-Ai__suggestion Ink-Ai__suggestion--${e.severity}`,children:[t.jsx("strong",{children:e.severity}),t.jsx("p",{children:e.message}),t.jsx("code",{children:e.suggestedText})]},e.id))]}):null,a==="translate"?t.jsxs("div",{className:"Ink-Ai__translate",children:[t.jsxs("label",{children:["Language",t.jsx("select",{value:A,onChange:e=>R(e.target.value),children:k.INK_TRANSLATE_LANGUAGES.map(e=>t.jsx("option",{value:e,children:e},e))})]}),t.jsx("button",{type:"button",className:"Ink-Editor__button Ink-Editor__button--active",disabled:l,onClick:()=>void c("translate",{language:A}),children:"Translate"})]}):null,o?t.jsxs("div",{className:"Ink-Ai__diff",children:[t.jsx("strong",{children:"Suggested change"}),t.jsx("p",{children:o.summary}),t.jsx("div",{className:"Ink-Ai__diff-preview",dangerouslySetInnerHTML:{__html:o.suggestedHtml}}),t.jsxs("div",{className:"Ink-Ai__diff-actions",children:[t.jsx("button",{type:"button",className:"Ink-Editor__button Ink-Editor__button--active",onClick:()=>{L(o.suggestedHtml),m(null)},children:"Apply"}),t.jsx("button",{type:"button",className:"Ink-Editor__button",onClick:()=>m(null),children:"Dismiss"})]})]}):null]}),t.jsx("footer",{className:"Ink-Ai__footer",children:"Demo provider · BYO LLM"})]})};exports.AiPanel=B;
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 +1 @@
1
- {"version":3,"file":"AiPanel.d.ts","sourceRoot":"","sources":["../../../../../src/components/InkEditor/components/AiPanel/AiPanel.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,EAAE,EAAkB,MAAM,OAAO,CAAC;AAM1D,OAAO,KAAK,EAEV,WAAW,EAGZ,MAAM,mBAAmB,CAAC;AAI3B,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,WAAW,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACpC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;CACxC;AAID,eAAO,MAAM,OAAO,EAAE,EAAE,CAAC,YAAY,CAkOpC,CAAC"}
1
+ {"version":3,"file":"AiPanel.d.ts","sourceRoot":"","sources":["../../../../../src/components/InkEditor/components/AiPanel/AiPanel.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,EAAE,EAAkB,MAAM,OAAO,CAAC;AAY1D,OAAO,KAAK,EAEV,WAAW,EAGZ,MAAM,mBAAmB,CAAC;AAI3B,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,WAAW,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACpC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;CACxC;AAID,eAAO,MAAM,OAAO,EAAE,EAAE,CAAC,YAAY,CAyOpC,CAAC"}
@@ -1,45 +1,46 @@
1
1
  import { jsxs as n, jsx as t, Fragment as P } from "react/jsx-runtime";
2
2
  import { useState as l } from "react";
3
- import { INK_TRANSLATE_LANGUAGES as H, INK_QUICK_ACTIONS as Q } from "../../../../constants/defaults.const.js";
4
- import { INK_AI_DEMO_PROVIDER_ID as U } from "../../../../constants/aiModels.const.js";
3
+ import { INK_AI_TAB_CHAT as Q, INK_AI_TAB_ACTIONS as U, INK_AI_TAB_REVIEW as V, INK_AI_TAB_TRANSLATE as F } from "../../../../constants/generals.const.js";
4
+ import { INK_TRANSLATE_LANGUAGES as L, INK_CLASS_AI_TAB as W, INK_CLASS_AI_TAB_ON as Y, INK_QUICK_ACTIONS as q } from "../../../../constants/defaults.const.js";
5
+ import { INK_AI_DEMO_PROVIDER_ID as z } from "../../../../constants/aiModels.const.js";
5
6
  import "../../../../constants/openai.const.js";
6
- import { createInkId as D } from "../../../../utils/id.utils.js";
7
+ import { createInkId as H } from "../../../../utils/id.utils.js";
7
8
  import "../../../../utils/paste.utils.js";
8
9
  import "react-dom";
9
- import { inkAi as F } from "../../../../plugins/ai/aiPlugin.js";
10
- const te = (L) => {
11
- var y, E, w, C;
12
- const { config: i, documentHtml: p, selectionHtml: v, onApplyHtml: x, onClose: b, onBusyChange: _ } = L, [o, M] = l("chat"), [f, g] = l(""), [r, h] = l([]), [a, R] = l(!1), [c, I] = l(null), [K, O] = l([]), [A, $] = l(H[1]), B = i.providerId || U, j = ((y = i.uiTheme) == null ? void 0 : y.className) || i.className || "", N = (e) => {
13
- R(e), _ == null || _(e);
14
- }, d = async (e, u, m) => {
10
+ import { inkAi as J } from "../../../../plugins/ai/aiPlugin.js";
11
+ const re = (K) => {
12
+ 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) => {
15
16
  var S;
16
- N(!0);
17
+ g(!0);
17
18
  try {
18
- const T = e === "chat" && m ? [
19
- ...r,
19
+ const w = e === "chat" && u ? [
20
+ ...c,
20
21
  {
21
- id: D("turn"),
22
+ id: H("turn"),
22
23
  role: "user",
23
- content: m,
24
+ content: u,
24
25
  timestamp: Date.now(),
25
26
  capability: e
26
27
  }
27
- ] : r;
28
- e === "chat" && m && h(T);
29
- const s = await F.runProvider(B, {
28
+ ] : c;
29
+ e === "chat" && u && h(w);
30
+ const s = await J.runProvider(M, {
30
31
  capability: e,
31
- html: p,
32
- selectionHtml: v || void 0,
33
- prompt: m,
34
- history: T,
35
- options: u,
32
+ html: k,
33
+ selectionHtml: p || void 0,
34
+ prompt: u,
35
+ history: w,
36
+ options: r,
36
37
  modelId: i.modelId,
37
- documentSnapshot: { html: p, selectionHtml: v || void 0 }
38
+ documentSnapshot: { html: k, selectionHtml: p || void 0 }
38
39
  });
39
- (S = s.turns) != null && S.length ? h((k) => [...k, ...s.turns]) : s.text && e !== "chat" && h((k) => [
40
- ...k,
40
+ (S = s.turns) != null && S.length ? h((A) => [...A, ...s.turns]) : s.text && e !== "chat" && h((A) => [
41
+ ...A,
41
42
  {
42
- id: D("turn"),
43
+ id: H("turn"),
43
44
  role: "assistant",
44
45
  content: s.text || "",
45
46
  timestamp: Date.now(),
@@ -47,12 +48,12 @@ const te = (L) => {
47
48
  }
48
49
  ]), s.diff && I(s.diff), s.reviewSuggestions && O(s.reviewSuggestions);
49
50
  } finally {
50
- N(!1);
51
+ g(!1);
51
52
  }
52
53
  }, G = (e) => {
53
54
  e.preventDefault();
54
- const u = f.trim();
55
- !u || a || (g(""), d("chat", void 0, u));
55
+ const r = b.trim();
56
+ !r || a || (N(""), _("chat", void 0, r));
56
57
  };
57
58
  return /* @__PURE__ */ n(
58
59
  "aside",
@@ -60,36 +61,41 @@ const te = (L) => {
60
61
  className: `Ink-Ai ${j}`.trim(),
61
62
  "data-placement": i.placement || "sidebar",
62
63
  style: {
63
- "--ink-ai-accent": (E = i.uiTheme) == null ? void 0 : E.accent,
64
- "--ink-ai-surface": (w = i.uiTheme) == null ? void 0 : w.surface,
65
- "--ink-ai-border": (C = i.uiTheme) == null ? void 0 : C.border
64
+ "--ink-ai-accent": (T = i.uiTheme) == null ? void 0 : T.accent,
65
+ "--ink-ai-surface": (C = i.uiTheme) == null ? void 0 : C.surface,
66
+ "--ink-ai-border": (E = i.uiTheme) == null ? void 0 : E.border
66
67
  },
67
68
  "aria-label": "Ink AI",
68
69
  children: [
69
70
  /* @__PURE__ */ n("div", { className: "Ink-Ai__header", children: [
70
71
  /* @__PURE__ */ t("strong", { children: "Ink AI" }),
71
- b ? /* @__PURE__ */ t("button", { type: "button", className: "Ink-Editor__button", onClick: b, title: "Close AI", children: "×" }) : null
72
+ v ? /* @__PURE__ */ t("button", { type: "button", className: "Ink-Editor__button", onClick: v, title: "Close AI", children: "×" }) : null
72
73
  ] }),
73
- /* @__PURE__ */ t("div", { className: "Ink-Ai__tabs", role: "tablist", children: ["chat", "actions", "review", "translate"].map((e) => /* @__PURE__ */ t(
74
+ /* @__PURE__ */ t("div", { className: "Ink-Ai__tabs", role: "tablist", children: [
75
+ ["chat", Q],
76
+ ["actions", U],
77
+ ["review", V],
78
+ ["translate", F]
79
+ ].map(([e, r]) => /* @__PURE__ */ t(
74
80
  "button",
75
81
  {
76
82
  type: "button",
77
83
  role: "tab",
78
- className: `Ink-Editor__button${o === e ? " Ink-Editor__button--active" : ""}`,
84
+ className: `${W}${o === e ? ` ${Y}` : ""}`,
79
85
  "aria-selected": o === e,
80
- onClick: () => M(e),
81
- children: e
86
+ onClick: () => D(e),
87
+ children: r
82
88
  },
83
89
  e
84
90
  )) }),
85
91
  /* @__PURE__ */ n("div", { className: "Ink-Ai__body", children: [
86
92
  o === "chat" ? /* @__PURE__ */ n(P, { children: [
87
- /* @__PURE__ */ t("div", { className: "Ink-Ai__history", children: r.length === 0 ? /* @__PURE__ */ n("p", { className: "Ink-Ai__empty", children: [
93
+ /* @__PURE__ */ t("div", { className: "Ink-Ai__history", children: c.length === 0 ? /* @__PURE__ */ n("p", { className: "Ink-Ai__empty", children: [
88
94
  "Multi-turn chat with local demo provider. Bring your own LLM via",
89
95
  " ",
90
96
  /* @__PURE__ */ t("code", { children: "inkAi.registerProvider" }),
91
97
  "."
92
- ] }) : r.map((e) => /* @__PURE__ */ n("div", { className: `Ink-Ai__turn Ink-Ai__turn--${e.role}`, children: [
98
+ ] }) : c.map((e) => /* @__PURE__ */ n("div", { className: `Ink-Ai__turn Ink-Ai__turn--${e.role}`, children: [
93
99
  /* @__PURE__ */ t("span", { children: e.role }),
94
100
  /* @__PURE__ */ t("p", { children: e.content })
95
101
  ] }, e.id)) }),
@@ -97,8 +103,8 @@ const te = (L) => {
97
103
  /* @__PURE__ */ t(
98
104
  "input",
99
105
  {
100
- value: f,
101
- onChange: (e) => g(e.target.value),
106
+ value: b,
107
+ onChange: (e) => N(e.target.value),
102
108
  placeholder: "Ask Ink AI…",
103
109
  disabled: a
104
110
  }
@@ -108,13 +114,13 @@ const te = (L) => {
108
114
  ] }) : null,
109
115
  o === "actions" ? /* @__PURE__ */ n("div", { className: "Ink-Ai__actions", children: [
110
116
  /* @__PURE__ */ t("p", { className: "Ink-Ai__hint", children: "Quick actions use the current selection (or full document)." }),
111
- Q.map((e) => /* @__PURE__ */ t(
117
+ q.map((e) => /* @__PURE__ */ t(
112
118
  "button",
113
119
  {
114
120
  type: "button",
115
121
  className: "Ink-Editor__button Ink-Ai__action",
116
122
  disabled: a,
117
- onClick: () => void d(e.capability),
123
+ onClick: () => void _(e.capability),
118
124
  children: e.label
119
125
  },
120
126
  e.id
@@ -127,11 +133,11 @@ const te = (L) => {
127
133
  type: "button",
128
134
  className: "Ink-Editor__button Ink-Editor__button--active",
129
135
  disabled: a,
130
- onClick: () => void d("review"),
136
+ onClick: () => void _("review"),
131
137
  children: "Run grammar & style review"
132
138
  }
133
139
  ),
134
- K.map((e) => /* @__PURE__ */ n("article", { className: `Ink-Ai__suggestion Ink-Ai__suggestion--${e.severity}`, children: [
140
+ R.map((e) => /* @__PURE__ */ n("article", { className: `Ink-Ai__suggestion Ink-Ai__suggestion--${e.severity}`, children: [
135
141
  /* @__PURE__ */ t("strong", { children: e.severity }),
136
142
  /* @__PURE__ */ t("p", { children: e.message }),
137
143
  /* @__PURE__ */ t("code", { children: e.suggestedText })
@@ -140,7 +146,7 @@ const te = (L) => {
140
146
  o === "translate" ? /* @__PURE__ */ n("div", { className: "Ink-Ai__translate", children: [
141
147
  /* @__PURE__ */ n("label", { children: [
142
148
  "Language",
143
- /* @__PURE__ */ t("select", { value: A, onChange: (e) => $(e.target.value), children: H.map((e) => /* @__PURE__ */ t("option", { value: e, children: e }, e)) })
149
+ /* @__PURE__ */ t("select", { value: f, onChange: (e) => $(e.target.value), children: L.map((e) => /* @__PURE__ */ t("option", { value: e, children: e }, e)) })
144
150
  ] }),
145
151
  /* @__PURE__ */ t(
146
152
  "button",
@@ -148,15 +154,15 @@ const te = (L) => {
148
154
  type: "button",
149
155
  className: "Ink-Editor__button Ink-Editor__button--active",
150
156
  disabled: a,
151
- onClick: () => void d("translate", { language: A }),
157
+ onClick: () => void _("translate", { language: f }),
152
158
  children: "Translate"
153
159
  }
154
160
  )
155
161
  ] }) : null,
156
- c ? /* @__PURE__ */ n("div", { className: "Ink-Ai__diff", children: [
162
+ d ? /* @__PURE__ */ n("div", { className: "Ink-Ai__diff", children: [
157
163
  /* @__PURE__ */ t("strong", { children: "Suggested change" }),
158
- /* @__PURE__ */ t("p", { children: c.summary }),
159
- /* @__PURE__ */ t("div", { className: "Ink-Ai__diff-preview", dangerouslySetInnerHTML: { __html: c.suggestedHtml } }),
164
+ /* @__PURE__ */ t("p", { children: d.summary }),
165
+ /* @__PURE__ */ t("div", { className: "Ink-Ai__diff-preview", dangerouslySetInnerHTML: { __html: d.suggestedHtml } }),
160
166
  /* @__PURE__ */ n("div", { className: "Ink-Ai__diff-actions", children: [
161
167
  /* @__PURE__ */ t(
162
168
  "button",
@@ -164,7 +170,7 @@ const te = (L) => {
164
170
  type: "button",
165
171
  className: "Ink-Editor__button Ink-Editor__button--active",
166
172
  onClick: () => {
167
- x(c.suggestedHtml), I(null);
173
+ B(d.suggestedHtml), I(null);
168
174
  },
169
175
  children: "Apply"
170
176
  }
@@ -179,5 +185,5 @@ const te = (L) => {
179
185
  );
180
186
  };
181
187
  export {
182
- te as AiPanel
188
+ re as AiPanel
183
189
  };
@@ -0,0 +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"),a=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 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,i]=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,H=r.length>s.NUMBER_ONE,U=N>s.NUMBER_ONE;E.useEffect(()=>{if(!S)return;const e=()=>{var C;const c=(C=f.current)==null?void 0:C.getBoundingClientRect().height,d=V.getToolbarDropdownMenuPosition(A.current,c&&c>s.NUMBER_ZERO?c:s.INK_EXCEL_MENU_ESTIMATED_HEIGHT_PX);j({top:d.top,left:d.left})};e();const t=window.requestAnimationFrame(e),u=c=>{var C,b;const d=c.target;(C=T.current)!=null&&C.contains(d)||(b=f.current)!=null&&b.contains(d)||L(!1)},_=c=>{c.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 q=e=>{var _;const t=(_=e.target.files)==null?void 0:_[s.NUMBER_ZERO];if(!t)return;const u=new FileReader;u.onload=()=>{i(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:a.INK_EXCEL_TITLE,hint:I,onHint:w,pluginColor:g,disabled:p,onClick:()=>{p||(i(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":a.INK_EXCEL_TITLE,style:{top:M.top,left:M.left},children:[n.jsx("div",{className:o.INK_CLASS_EXCEL_TITLE,children:a.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:c=>i(l.setExcelCell(r,t,_,c.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(),i(l.addExcelRow(r))},children:a.INK_EXCEL_ADD_ROW}),n.jsx("button",{type:"button",disabled:!$,onMouseDown:e=>{e.preventDefault(),i(l.addExcelCol(r))},children:a.INK_EXCEL_ADD_COL}),n.jsx("button",{type:"button",disabled:!H,onMouseDown:e=>{e.preventDefault(),i(l.removeExcelRow(r))},children:a.INK_EXCEL_REMOVE_ROW}),n.jsx("button",{type:"button",disabled:!U,onMouseDown:e=>{e.preventDefault(),i(l.removeExcelCol(r))},children:a.INK_EXCEL_REMOVE_COL}),n.jsx("button",{type:"button",onMouseDown:e=>{e.preventDefault(),i(l.clearExcelGrid(r))},children:a.INK_EXCEL_CLEAR}),n.jsx("button",{type:"button",onMouseDown:e=>{var t;e.preventDefault(),(t=K.current)==null||t.click()},children:a.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:a.INK_EXCEL_INSERT})]}),n.jsx("input",{ref:K,type:"file",accept:l.CSV_ACCEPT,hidden:!0,onChange:q})]}),document.body):null]})};exports.ExcelSheetPanel=F;
@@ -0,0 +1,4 @@
1
+ import { FC } from 'react';
2
+ import { ExcelSheetPanelProps } from './ExcelSheetPanel.types';
3
+ export declare const ExcelSheetPanel: FC<ExcelSheetPanelProps>;
4
+ //# sourceMappingURL=ExcelSheetPanel.d.ts.map
@@ -0,0 +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,CAmNpD,CAAC"}
@@ -0,0 +1,209 @@
1
+ import { jsxs as _, jsx as n } from "react/jsx-runtime";
2
+ import { useState as u, useRef as L, useEffect as j, Fragment as x } from "react";
3
+ import { createPortal as z } from "react-dom";
4
+ import { NUMBER_ZERO as i, NUMBER_ONE as d, INK_EXCEL_SHEET_MAX_ROWS as q, INK_EXCEL_SHEET_MAX_COLS as Z, INK_EXCEL_MENU_ESTIMATED_HEIGHT_PX as J } from "../../../../constants/numbers.js";
5
+ import { INK_EXCEL_TITLE as v, INK_EXCEL_ADD_ROW as Q, INK_EXCEL_ADD_COL as ee, INK_EXCEL_REMOVE_ROW as te, INK_EXCEL_REMOVE_COL as ne, INK_EXCEL_CLEAR as oe, INK_EXCEL_IMPORT as re, INK_EXCEL_INSERT as le } from "../../../../constants/generals.const.js";
6
+ import { COLOR_MODE_LIGHT as se } from "../../../../constants/colorMode.const.js";
7
+ import { KEY_ESCAPE as Ee } from "../../../../constants/keyboard.const.js";
8
+ import { INK_CLASS_STYLE_DD as ie, INK_CLASS_STYLE_MENU as ae, INK_CLASS_STYLE_MENU_PORTAL as ce, INK_CLASS_STYLE_MENU_FORCED as _e, INK_CLASS_EXCEL_PANEL as ue, INK_CLASS_EXCEL_TITLE as de, INK_CLASS_EXCEL_GRID as me, INK_CLASS_EXCEL_CORNER as Ce, EXCEL_COL_LETTERS as Le, INK_CLASS_EXCEL_HEAD as b, INK_CLASS_EXCEL_COL_HOVER as O, INK_CLASS_EXCEL_ROW_HOVER as g, INK_CLASS_EXCEL_CELL as pe, INK_CLASS_EXCEL_ACTIONS as fe, INK_CLASS_EXCEL_INSERT as Ne } from "../../../../constants/defaults.const.js";
9
+ import "../../../../constants/openai.const.js";
10
+ import "../../../../utils/paste.utils.js";
11
+ import { createEmptyExcelGrid as I, setExcelCell as Se, addExcelRow as ve, addExcelCol as Re, removeExcelRow as Ae, removeExcelCol as he, clearExcelGrid as Te, excelGridToTableHtml as Ke, CSV_ACCEPT as De, parseCsvText as Me } from "../../../../plugins/excel/excel.utils.js";
12
+ import { getToolbarDropdownMenuPosition as we } from "../ToolbarDropdown/ToolbarDropdown.utils.js";
13
+ import { ToolbarButton as Xe } from "../ToolbarButton/ToolbarButton.js";
14
+ const Ye = ($) => {
15
+ var w;
16
+ const { icon: y, disabled: R = !1, hint: H, onHint: P, pluginColor: G, onInsert: F } = $, [p, m] = u(!1), [o, s] = u(I), [A, f] = u(null), [h, N] = u(null), [T, U] = u({ top: i, left: i }), K = L(null), D = L(null), S = L(null), M = L(null), C = ((w = o[i]) == null ? void 0 : w.length) ?? d, k = o.length < q, V = C < Z, Y = o.length > d, B = C > d;
17
+ j(() => {
18
+ if (!p) return;
19
+ const e = () => {
20
+ var c;
21
+ const l = (c = S.current) == null ? void 0 : c.getBoundingClientRect().height, a = we(
22
+ D.current,
23
+ l && l > i ? l : J
24
+ );
25
+ U({ top: a.top, left: a.left });
26
+ };
27
+ e();
28
+ const t = window.requestAnimationFrame(e), E = (l) => {
29
+ var c, X;
30
+ const a = l.target;
31
+ (c = K.current) != null && c.contains(a) || (X = S.current) != null && X.contains(a) || m(!1);
32
+ }, r = (l) => {
33
+ l.key === Ee && m(!1);
34
+ };
35
+ return document.addEventListener("mousedown", E), document.addEventListener("keydown", r), window.addEventListener("resize", e), window.addEventListener("scroll", e, !0), () => {
36
+ window.cancelAnimationFrame(t), document.removeEventListener("mousedown", E), document.removeEventListener("keydown", r), window.removeEventListener("resize", e), window.removeEventListener("scroll", e, !0);
37
+ };
38
+ }, [p, o.length, C]);
39
+ const W = (e) => {
40
+ var r;
41
+ const t = (r = e.target.files) == null ? void 0 : r[i];
42
+ if (!t) return;
43
+ const E = new FileReader();
44
+ E.onload = () => {
45
+ s(Me(String(E.result)));
46
+ }, E.readAsText(t);
47
+ };
48
+ return /* @__PURE__ */ _("div", { className: ie, ref: K, children: [
49
+ /* @__PURE__ */ n("div", { ref: D, children: /* @__PURE__ */ n(
50
+ Xe,
51
+ {
52
+ icon: y,
53
+ title: v,
54
+ hint: H,
55
+ onHint: P,
56
+ pluginColor: G,
57
+ disabled: R,
58
+ onClick: () => {
59
+ R || (s(I()), m((e) => !e));
60
+ }
61
+ }
62
+ ) }),
63
+ p ? z(
64
+ /* @__PURE__ */ _(
65
+ "div",
66
+ {
67
+ ref: S,
68
+ className: `${ae} ${ce} ${_e} ${ue}`,
69
+ "data-color-mode": se,
70
+ role: "dialog",
71
+ "aria-label": v,
72
+ style: { top: T.top, left: T.left },
73
+ children: [
74
+ /* @__PURE__ */ n("div", { className: de, children: v }),
75
+ /* @__PURE__ */ _(
76
+ "div",
77
+ {
78
+ className: me,
79
+ style: {
80
+ gridTemplateColumns: `2rem repeat(${C}, minmax(0, 1fr))`
81
+ },
82
+ onMouseLeave: () => {
83
+ f(null), N(null);
84
+ },
85
+ children: [
86
+ /* @__PURE__ */ n("span", { className: Ce }),
87
+ (o[i] ?? []).map((e, t) => /* @__PURE__ */ n(
88
+ "span",
89
+ {
90
+ className: `${b}${A === t ? ` ${O}` : ""}`,
91
+ onMouseEnter: () => f(t),
92
+ children: Le[t] ?? t + d
93
+ },
94
+ `h-${t}`
95
+ )),
96
+ o.map((e, t) => /* @__PURE__ */ _(x, { children: [
97
+ /* @__PURE__ */ n(
98
+ "span",
99
+ {
100
+ className: `${b}${h === t ? ` ${g}` : ""}`,
101
+ onMouseEnter: () => N(t),
102
+ children: t + d
103
+ }
104
+ ),
105
+ e.map((E, r) => /* @__PURE__ */ n(
106
+ "input",
107
+ {
108
+ className: `${pe}${A === r ? ` ${O}` : ""}${h === t ? ` ${g}` : ""}`,
109
+ value: E,
110
+ onMouseEnter: () => {
111
+ f(r), N(t);
112
+ },
113
+ onChange: (l) => s(Se(o, t, r, l.target.value))
114
+ },
115
+ `${t}-${r}`
116
+ ))
117
+ ] }, `row-${t}`))
118
+ ]
119
+ }
120
+ ),
121
+ /* @__PURE__ */ _("div", { className: fe, children: [
122
+ /* @__PURE__ */ n(
123
+ "button",
124
+ {
125
+ type: "button",
126
+ disabled: !k,
127
+ onMouseDown: (e) => {
128
+ e.preventDefault(), s(ve(o));
129
+ },
130
+ children: Q
131
+ }
132
+ ),
133
+ /* @__PURE__ */ n(
134
+ "button",
135
+ {
136
+ type: "button",
137
+ disabled: !V,
138
+ onMouseDown: (e) => {
139
+ e.preventDefault(), s(Re(o));
140
+ },
141
+ children: ee
142
+ }
143
+ ),
144
+ /* @__PURE__ */ n(
145
+ "button",
146
+ {
147
+ type: "button",
148
+ disabled: !Y,
149
+ onMouseDown: (e) => {
150
+ e.preventDefault(), s(Ae(o));
151
+ },
152
+ children: te
153
+ }
154
+ ),
155
+ /* @__PURE__ */ n(
156
+ "button",
157
+ {
158
+ type: "button",
159
+ disabled: !B,
160
+ onMouseDown: (e) => {
161
+ e.preventDefault(), s(he(o));
162
+ },
163
+ children: ne
164
+ }
165
+ ),
166
+ /* @__PURE__ */ n(
167
+ "button",
168
+ {
169
+ type: "button",
170
+ onMouseDown: (e) => {
171
+ e.preventDefault(), s(Te(o));
172
+ },
173
+ children: oe
174
+ }
175
+ ),
176
+ /* @__PURE__ */ n(
177
+ "button",
178
+ {
179
+ type: "button",
180
+ onMouseDown: (e) => {
181
+ var t;
182
+ e.preventDefault(), (t = M.current) == null || t.click();
183
+ },
184
+ children: re
185
+ }
186
+ ),
187
+ /* @__PURE__ */ n(
188
+ "button",
189
+ {
190
+ type: "button",
191
+ className: Ne,
192
+ onMouseDown: (e) => {
193
+ e.preventDefault(), F(Ke(o)), m(!1);
194
+ },
195
+ children: le
196
+ }
197
+ )
198
+ ] }),
199
+ /* @__PURE__ */ n("input", { ref: M, type: "file", accept: De, hidden: !0, onChange: W })
200
+ ]
201
+ }
202
+ ),
203
+ document.body
204
+ ) : null
205
+ ] });
206
+ };
207
+ export {
208
+ Ye as ExcelSheetPanel
209
+ };
@@ -0,0 +1,10 @@
1
+ import { ReactNode } from 'react';
2
+ export type ExcelSheetPanelProps = {
3
+ icon: ReactNode;
4
+ disabled?: boolean;
5
+ hint?: string;
6
+ onHint?: (hint: string) => void;
7
+ pluginColor?: string;
8
+ onInsert: (html: string) => void;
9
+ };
10
+ //# sourceMappingURL=ExcelSheetPanel.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ExcelSheetPanel.types.d.ts","sourceRoot":"","sources":["../../../../../src/components/InkEditor/components/ExcelSheetPanel/ExcelSheetPanel.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,MAAM,MAAM,oBAAoB,GAAG;IACjC,IAAI,EAAE,SAAS,CAAC;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAChC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAClC,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { ExcelSheetPanel } from './ExcelSheetPanel';
2
+ export type { ExcelSheetPanelProps } from './ExcelSheetPanel.types';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/InkEditor/components/ExcelSheetPanel/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,YAAY,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC"}
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),h=require("react"),N=require("@forgedevstack/bear"),s=require("../../../../constants/numbers.cjs"),l=require("../../../../constants/generals.const.cjs");require("../../../../constants/openai.const.cjs");require("../../../../utils/paste.utils.cjs");require("react-dom");const O=require("../../../../plugins/graph/graph.const.cjs"),C=()=>({label:"•",value:s.NUMBER_ONE}),G=j=>{const{open:p,mode:E,points:d,colors:n,onClose:R,onApply:P}=j,[m,_]=h.useState(d),[v,M]=h.useState(n.length>s.NUMBER_ZERO?n:[...O.GRAPH_COLORS]);h.useEffect(()=>{p&&(_(d),M(n.length>s.NUMBER_ZERO?n:[...O.GRAPH_COLORS]))},[p,d,n]);const b=E==="colors"?l.INK_GRAPH_COLORS_TITLE:l.INK_GRAPH_VALUES_TITLE;return e.jsx(N.Modal,{isOpen:p,onClose:R,title:b,size:"md",footer:e.jsxs(e.Fragment,{children:[e.jsx(N.Button,{variant:"outline",onClick:R,children:l.INK_GRAPH_CANCEL}),e.jsx(N.Button,{variant:"primary",onClick:()=>P(m,v),children:l.INK_GRAPH_APPLY})]}),children:E==="values"?e.jsxs("div",{className:"Ink-GraphModal",children:[m.map((r,a)=>e.jsxs("div",{className:"Ink-GraphModal__row",children:[e.jsx("input",{value:r.label,"aria-label":`Label ${a+s.NUMBER_ONE}`,onChange:o=>{const i=o.target.value;_(c=>c.map((t,u)=>u===a?{...t,label:i}:t))}}),e.jsx("input",{type:"number",value:r.value,"aria-label":`Value ${a+s.NUMBER_ONE}`,onChange:o=>{const i=Number(o.target.value)||s.NUMBER_ZERO;_(c=>c.map((t,u)=>u===a?{...t,value:i}:t))}})]},`${r.label}-${a}`)),e.jsx(N.Button,{variant:"outline",size:"sm",onClick:()=>_(r=>[...r,C()]),children:l.INK_GRAPH_ADD_POINT})]}):e.jsx("div",{className:"Ink-GraphModal",children:v.map((r,a)=>e.jsxs("label",{className:"Ink-GraphModal__row",children:[e.jsx("span",{children:a+s.NUMBER_ONE}),e.jsx("input",{type:"color",value:r,onChange:o=>{const i=o.target.value||l.EMPTY_STRING;M(c=>c.map((t,u)=>u===a?i:t))}})]},`${r}-${a}`))})})};exports.GraphEditModal=G;
@@ -0,0 +1,4 @@
1
+ import { FC } from 'react';
2
+ import { GraphEditModalProps } from './GraphEditModal.types';
3
+ export declare const GraphEditModal: FC<GraphEditModalProps>;
4
+ //# sourceMappingURL=GraphEditModal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GraphEditModal.d.ts","sourceRoot":"","sources":["../../../../../src/components/InkEditor/components/GraphEditModal/GraphEditModal.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAuB,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AAcrD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAIlE,eAAO,MAAM,cAAc,EAAE,EAAE,CAAC,mBAAmB,CA4FlD,CAAC"}
@@ -0,0 +1,91 @@
1
+ import { jsx as l, jsxs as c, Fragment as E } from "react/jsx-runtime";
2
+ import { useState as P, useEffect as b } from "react";
3
+ import { Modal as g, Button as h } from "@forgedevstack/bear";
4
+ import { NUMBER_ZERO as d, NUMBER_ONE as m } from "../../../../constants/numbers.js";
5
+ import { INK_GRAPH_COLORS_TITLE as M, INK_GRAPH_VALUES_TITLE as L, INK_GRAPH_ADD_POINT as O, EMPTY_STRING as k, INK_GRAPH_CANCEL as T, INK_GRAPH_APPLY as H } from "../../../../constants/generals.const.js";
6
+ import "../../../../constants/openai.const.js";
7
+ import "../../../../utils/paste.utils.js";
8
+ import "react-dom";
9
+ import { GRAPH_COLORS as G } from "../../../../plugins/graph/graph.const.js";
10
+ const $ = () => ({ label: "•", value: m }), Y = (R) => {
11
+ const { open: u, mode: v, points: _, colors: r, onClose: N, onApply: A } = R, [f, p] = P(_), [C, I] = P(
12
+ r.length > d ? r : [...G]
13
+ );
14
+ return b(() => {
15
+ u && (p(_), I(r.length > d ? r : [...G]));
16
+ }, [u, _, r]), /* @__PURE__ */ l(
17
+ g,
18
+ {
19
+ isOpen: u,
20
+ onClose: N,
21
+ title: v === "colors" ? M : L,
22
+ size: "md",
23
+ footer: /* @__PURE__ */ c(E, { children: [
24
+ /* @__PURE__ */ l(h, { variant: "outline", onClick: N, children: T }),
25
+ /* @__PURE__ */ l(h, { variant: "primary", onClick: () => A(f, C), children: H })
26
+ ] }),
27
+ children: v === "values" ? /* @__PURE__ */ c("div", { className: "Ink-GraphModal", children: [
28
+ f.map((e, a) => /* @__PURE__ */ c("div", { className: "Ink-GraphModal__row", children: [
29
+ /* @__PURE__ */ l(
30
+ "input",
31
+ {
32
+ value: e.label,
33
+ "aria-label": `Label ${a + m}`,
34
+ onChange: (t) => {
35
+ const n = t.target.value;
36
+ p(
37
+ (s) => s.map(
38
+ (o, i) => i === a ? { ...o, label: n } : o
39
+ )
40
+ );
41
+ }
42
+ }
43
+ ),
44
+ /* @__PURE__ */ l(
45
+ "input",
46
+ {
47
+ type: "number",
48
+ value: e.value,
49
+ "aria-label": `Value ${a + m}`,
50
+ onChange: (t) => {
51
+ const n = Number(t.target.value) || d;
52
+ p(
53
+ (s) => s.map(
54
+ (o, i) => i === a ? { ...o, value: n } : o
55
+ )
56
+ );
57
+ }
58
+ }
59
+ )
60
+ ] }, `${e.label}-${a}`)),
61
+ /* @__PURE__ */ l(
62
+ h,
63
+ {
64
+ variant: "outline",
65
+ size: "sm",
66
+ onClick: () => p((e) => [...e, $()]),
67
+ children: O
68
+ }
69
+ )
70
+ ] }) : /* @__PURE__ */ l("div", { className: "Ink-GraphModal", children: C.map((e, a) => /* @__PURE__ */ c("label", { className: "Ink-GraphModal__row", children: [
71
+ /* @__PURE__ */ l("span", { children: a + m }),
72
+ /* @__PURE__ */ l(
73
+ "input",
74
+ {
75
+ type: "color",
76
+ value: e,
77
+ onChange: (t) => {
78
+ const n = t.target.value || k;
79
+ I(
80
+ (s) => s.map((o, i) => i === a ? n : o)
81
+ );
82
+ }
83
+ }
84
+ )
85
+ ] }, `${e}-${a}`)) })
86
+ }
87
+ );
88
+ };
89
+ export {
90
+ Y as GraphEditModal
91
+ };