@novaprose/core 0.7.0 → 0.9.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 (347) hide show
  1. package/README.md +15 -2
  2. package/dist/a11y.cjs +314 -0
  3. package/dist/a11y.cjs.map +1 -0
  4. package/dist/a11y.d.cts +51 -0
  5. package/dist/a11y.d.ts +51 -0
  6. package/dist/a11y.js +11 -0
  7. package/dist/a11y.js.map +1 -0
  8. package/dist/a11ychecker-6ES3UMU3.js +449 -0
  9. package/dist/a11ychecker-6ES3UMU3.js.map +1 -0
  10. package/dist/accordion-ui-B4I2FJXE.js +201 -0
  11. package/dist/accordion-ui-B4I2FJXE.js.map +1 -0
  12. package/dist/advcode-7S6N64C7.js +51 -0
  13. package/dist/advcode-7S6N64C7.js.map +1 -0
  14. package/dist/advcode-editor-ENCPFVLO.js +257 -0
  15. package/dist/advcode-editor-ENCPFVLO.js.map +1 -0
  16. package/dist/{advlist-5FNKPLUX.js → advlist-FEDGNLMQ.js} +10 -7
  17. package/dist/advlist-FEDGNLMQ.js.map +1 -0
  18. package/dist/advtable-ui-JAVJY4L4.js +364 -0
  19. package/dist/advtable-ui-JAVJY4L4.js.map +1 -0
  20. package/dist/ai-5KM776QW.js +1485 -0
  21. package/dist/ai-5KM776QW.js.map +1 -0
  22. package/dist/anchor-ui-VPKNKZ7J.js +81 -0
  23. package/dist/anchor-ui-VPKNKZ7J.js.map +1 -0
  24. package/dist/autocorrect-5QLICCRN.js +851 -0
  25. package/dist/autocorrect-5QLICCRN.js.map +1 -0
  26. package/dist/{autolink-45LTODWB.js → autolink-ZYIPRXBA.js} +11 -8
  27. package/dist/autolink-ZYIPRXBA.js.map +1 -0
  28. package/dist/{autoresize-UB3GOA6D.js → autoresize-YRZAVCNO.js} +2 -2
  29. package/dist/autoresize-YRZAVCNO.js.map +1 -0
  30. package/dist/{autosave-GMWJ5BPE.js → autosave-IC7YYG44.js} +7 -7
  31. package/dist/autosave-IC7YYG44.js.map +1 -0
  32. package/dist/casechange-R7IO2APS.js +201 -0
  33. package/dist/casechange-R7IO2APS.js.map +1 -0
  34. package/dist/{charmap-2GC7LF7G.js → charmap-CARYZFKD.js} +7 -7
  35. package/dist/charmap-CARYZFKD.js.map +1 -0
  36. package/dist/checklist-7E47QW6L.js +189 -0
  37. package/dist/checklist-7E47QW6L.js.map +1 -0
  38. package/dist/chunk-23ZLVT5D.js +163 -0
  39. package/dist/chunk-23ZLVT5D.js.map +1 -0
  40. package/dist/{chunk-ND2CWNVG.js → chunk-3BOK3S3T.js} +2 -27
  41. package/dist/chunk-3BOK3S3T.js.map +1 -0
  42. package/dist/chunk-3KBQEAX2.js +926 -0
  43. package/dist/chunk-3KBQEAX2.js.map +1 -0
  44. package/dist/chunk-3NNILZVB.js +259 -0
  45. package/dist/chunk-3NNILZVB.js.map +1 -0
  46. package/dist/{chunk-PVFKXRID.js → chunk-4VPDY3LF.js} +1 -1
  47. package/dist/chunk-4VPDY3LF.js.map +1 -0
  48. package/dist/chunk-53AY5NAF.js +214 -0
  49. package/dist/chunk-53AY5NAF.js.map +1 -0
  50. package/dist/{chunk-5AW2HHG6.js → chunk-5KERLFDD.js} +50 -3
  51. package/dist/chunk-5KERLFDD.js.map +1 -0
  52. package/dist/{chunk-FCMZ7TUQ.js → chunk-6BJEOL5V.js} +296 -43
  53. package/dist/chunk-6BJEOL5V.js.map +1 -0
  54. package/dist/chunk-6LQM7G4V.js +159 -0
  55. package/dist/chunk-6LQM7G4V.js.map +1 -0
  56. package/dist/chunk-AB67XUSR.js +178 -0
  57. package/dist/chunk-AB67XUSR.js.map +1 -0
  58. package/dist/chunk-ANE5ASXG.js +26 -0
  59. package/dist/chunk-ANE5ASXG.js.map +1 -0
  60. package/dist/{chunk-Z3ELZ77W.js → chunk-AP2PJFLB.js} +5 -2
  61. package/dist/chunk-AP2PJFLB.js.map +1 -0
  62. package/dist/chunk-ARBKIZZU.js +137 -0
  63. package/dist/chunk-ARBKIZZU.js.map +1 -0
  64. package/dist/chunk-AUQSATWL.js +322 -0
  65. package/dist/chunk-AUQSATWL.js.map +1 -0
  66. package/dist/chunk-BMCH63QN.js +165 -0
  67. package/dist/chunk-BMCH63QN.js.map +1 -0
  68. package/dist/chunk-BUABAYZL.js +160 -0
  69. package/dist/chunk-BUABAYZL.js.map +1 -0
  70. package/dist/chunk-DCMPJ25E.js +140 -0
  71. package/dist/chunk-DCMPJ25E.js.map +1 -0
  72. package/dist/chunk-DV7TGRU6.js +47 -0
  73. package/dist/chunk-DV7TGRU6.js.map +1 -0
  74. package/dist/chunk-F2WT77ZG.js +163 -0
  75. package/dist/chunk-F2WT77ZG.js.map +1 -0
  76. package/dist/chunk-FNJ7AEJK.js +955 -0
  77. package/dist/chunk-FNJ7AEJK.js.map +1 -0
  78. package/dist/chunk-G74HNSB6.js +9 -0
  79. package/dist/chunk-G74HNSB6.js.map +1 -0
  80. package/dist/chunk-GTLE2HEW.js +108 -0
  81. package/dist/chunk-GTLE2HEW.js.map +1 -0
  82. package/dist/chunk-GUZCRDK6.js +143 -0
  83. package/dist/chunk-GUZCRDK6.js.map +1 -0
  84. package/dist/chunk-HNEAVVBC.js +98 -0
  85. package/dist/chunk-HNEAVVBC.js.map +1 -0
  86. package/dist/chunk-HSVNJGK3.js +1149 -0
  87. package/dist/chunk-HSVNJGK3.js.map +1 -0
  88. package/dist/chunk-IFSD6O5M.js +29 -0
  89. package/dist/chunk-IFSD6O5M.js.map +1 -0
  90. package/dist/{table-SSNABG5W.js → chunk-IO5PU52K.js} +119 -61
  91. package/dist/chunk-IO5PU52K.js.map +1 -0
  92. package/dist/chunk-K4LFGNS7.js +137 -0
  93. package/dist/chunk-K4LFGNS7.js.map +1 -0
  94. package/dist/chunk-KGEHUWGL.js +79 -0
  95. package/dist/chunk-KGEHUWGL.js.map +1 -0
  96. package/dist/chunk-KW6ATQPN.js +151 -0
  97. package/dist/chunk-KW6ATQPN.js.map +1 -0
  98. package/dist/chunk-NX3KWIP5.js +207 -0
  99. package/dist/chunk-NX3KWIP5.js.map +1 -0
  100. package/dist/chunk-OOVNE6MB.js +28 -0
  101. package/dist/chunk-OOVNE6MB.js.map +1 -0
  102. package/dist/chunk-OQMMHWMZ.js +7 -0
  103. package/dist/chunk-OQMMHWMZ.js.map +1 -0
  104. package/dist/{chunk-JPJVTB45.js → chunk-QU3KXMYT.js} +8 -2
  105. package/dist/chunk-QU3KXMYT.js.map +1 -0
  106. package/dist/chunk-QWT56RVG.js +158 -0
  107. package/dist/chunk-QWT56RVG.js.map +1 -0
  108. package/dist/chunk-RJ7T56OH.js +3787 -0
  109. package/dist/chunk-RJ7T56OH.js.map +1 -0
  110. package/dist/{chunk-KWXFL4WS.js → chunk-RPHA4HRX.js} +8 -5
  111. package/dist/chunk-RPHA4HRX.js.map +1 -0
  112. package/dist/chunk-S4DCQA74.js +66 -0
  113. package/dist/chunk-S4DCQA74.js.map +1 -0
  114. package/dist/chunk-SCIRO4XK.js +144 -0
  115. package/dist/chunk-SCIRO4XK.js.map +1 -0
  116. package/dist/chunk-SNVYHGGO.js +127 -0
  117. package/dist/chunk-SNVYHGGO.js.map +1 -0
  118. package/dist/chunk-T4543CB2.js +67 -0
  119. package/dist/chunk-T4543CB2.js.map +1 -0
  120. package/dist/{chunk-T3GY6IVK.js → chunk-UHUOAQA6.js} +71 -9
  121. package/dist/chunk-UHUOAQA6.js.map +1 -0
  122. package/dist/chunk-UTMS2P2K.js +288 -0
  123. package/dist/chunk-UTMS2P2K.js.map +1 -0
  124. package/dist/{chunk-HPLT3XRZ.js → chunk-V7WUHUHM.js} +13 -1
  125. package/dist/chunk-V7WUHUHM.js.map +1 -0
  126. package/dist/chunk-WAOU5NGN.js +430 -0
  127. package/dist/chunk-WAOU5NGN.js.map +1 -0
  128. package/dist/{chunk-R2UMUCVI.js → chunk-XCXJD5DO.js} +53 -8
  129. package/dist/chunk-XCXJD5DO.js.map +1 -0
  130. package/dist/chunk-XIH4SCO6.js +112 -0
  131. package/dist/chunk-XIH4SCO6.js.map +1 -0
  132. package/dist/chunk-XR7CY4NI.js +11 -0
  133. package/dist/chunk-XR7CY4NI.js.map +1 -0
  134. package/dist/chunk-Y2OXWCM7.js +263 -0
  135. package/dist/chunk-Y2OXWCM7.js.map +1 -0
  136. package/dist/chunk-YDF55N6Z.js +164 -0
  137. package/dist/chunk-YDF55N6Z.js.map +1 -0
  138. package/dist/chunk-YOTA26H7.js +373 -0
  139. package/dist/chunk-YOTA26H7.js.map +1 -0
  140. package/dist/chunk-YP7N47QR.js +101 -0
  141. package/dist/chunk-YP7N47QR.js.map +1 -0
  142. package/dist/{chunk-KPE3QRPB.js → chunk-YYCDRUE2.js} +16 -315
  143. package/dist/chunk-YYCDRUE2.js.map +1 -0
  144. package/dist/codesample-FOWXMCTC.js +546 -0
  145. package/dist/codesample-FOWXMCTC.js.map +1 -0
  146. package/dist/{comments-panel-HXMWSRAW.js → comments-panel-SOLBZ46Q.js} +9 -5
  147. package/dist/comments-panel-SOLBZ46Q.js.map +1 -0
  148. package/dist/{directionality-5JLWQGP2.js → directionality-BXWXNPRZ.js} +13 -10
  149. package/dist/directionality-BXWXNPRZ.js.map +1 -0
  150. package/dist/document-B0hLRhuH.d.cts +39 -0
  151. package/dist/document-Dh-jz1SK.d.ts +39 -0
  152. package/dist/docx.cjs +23575 -0
  153. package/dist/docx.cjs.map +1 -0
  154. package/dist/docx.d.cts +83 -0
  155. package/dist/docx.d.ts +83 -0
  156. package/dist/docx.js +1826 -0
  157. package/dist/docx.js.map +1 -0
  158. package/dist/draghandle-3IBHVHDE.js +389 -0
  159. package/dist/draghandle-3IBHVHDE.js.map +1 -0
  160. package/dist/editimage-GTLFGHYU.js +683 -0
  161. package/dist/editimage-GTLFGHYU.js.map +1 -0
  162. package/dist/editor-DnAN9aPd.d.ts +2948 -0
  163. package/dist/editor-S8w_w5W0.d.cts +2948 -0
  164. package/dist/email-FDSENENR.js +177 -0
  165. package/dist/email-FDSENENR.js.map +1 -0
  166. package/dist/email.cjs +588 -0
  167. package/dist/email.cjs.map +1 -0
  168. package/dist/email.d.cts +7 -0
  169. package/dist/email.d.ts +7 -0
  170. package/dist/email.js +21 -0
  171. package/dist/email.js.map +1 -0
  172. package/dist/{emoticons-ZD6ZRIWG.js → emoticons-SHYSAEID.js} +7 -7
  173. package/dist/emoticons-SHYSAEID.js.map +1 -0
  174. package/dist/exportpdf-TEBDQZSN.js +91 -0
  175. package/dist/exportpdf-TEBDQZSN.js.map +1 -0
  176. package/dist/exportword-BGH2CZXO.js +16 -0
  177. package/dist/exportword-BGH2CZXO.js.map +1 -0
  178. package/dist/footnotes-ui-KPKFDSN7.js +449 -0
  179. package/dist/footnotes-ui-KPKFDSN7.js.map +1 -0
  180. package/dist/form-dialog-SNWFPM2K.js +379 -0
  181. package/dist/form-dialog-SNWFPM2K.js.map +1 -0
  182. package/dist/formatpainter-CB4ZTKR5.js +209 -0
  183. package/dist/formatpainter-CB4ZTKR5.js.map +1 -0
  184. package/dist/fullpagehtml-ui-JPGRMXHD.js +220 -0
  185. package/dist/fullpagehtml-ui-JPGRMXHD.js.map +1 -0
  186. package/dist/html-rules-api-BLDDW9MO.d.cts +42 -0
  187. package/dist/html-rules-api-BLDDW9MO.d.ts +42 -0
  188. package/dist/html-rules.cjs +21 -19
  189. package/dist/html-rules.cjs.map +1 -1
  190. package/dist/html-rules.d.cts +37 -35
  191. package/dist/html-rules.d.ts +37 -35
  192. package/dist/html-rules.js +26 -22
  193. package/dist/html-rules.js.map +1 -1
  194. package/dist/i18n/de.cjs +349 -0
  195. package/dist/i18n/de.cjs.map +1 -1
  196. package/dist/i18n/de.d.cts +1 -1
  197. package/dist/i18n/de.d.ts +1 -1
  198. package/dist/i18n/de.js +349 -0
  199. package/dist/i18n/de.js.map +1 -1
  200. package/dist/i18n/es.cjs +349 -0
  201. package/dist/i18n/es.cjs.map +1 -1
  202. package/dist/i18n/es.d.cts +1 -1
  203. package/dist/i18n/es.d.ts +1 -1
  204. package/dist/i18n/es.js +349 -0
  205. package/dist/i18n/es.js.map +1 -1
  206. package/dist/i18n/fr.cjs +349 -0
  207. package/dist/i18n/fr.cjs.map +1 -1
  208. package/dist/i18n/fr.d.cts +1 -1
  209. package/dist/i18n/fr.d.ts +1 -1
  210. package/dist/i18n/fr.js +349 -0
  211. package/dist/i18n/fr.js.map +1 -1
  212. package/dist/i18n/it.cjs +349 -0
  213. package/dist/i18n/it.cjs.map +1 -1
  214. package/dist/i18n/it.d.cts +1 -1
  215. package/dist/i18n/it.d.ts +1 -1
  216. package/dist/i18n/it.js +349 -0
  217. package/dist/i18n/it.js.map +1 -1
  218. package/dist/i18n/pt-BR.cjs +349 -0
  219. package/dist/i18n/pt-BR.cjs.map +1 -1
  220. package/dist/i18n/pt-BR.d.cts +1 -1
  221. package/dist/i18n/pt-BR.d.ts +1 -1
  222. package/dist/i18n/pt-BR.js +349 -0
  223. package/dist/i18n/pt-BR.js.map +1 -1
  224. package/dist/i18n/ru.cjs +349 -0
  225. package/dist/i18n/ru.cjs.map +1 -1
  226. package/dist/i18n/ru.d.cts +3 -3
  227. package/dist/i18n/ru.d.ts +3 -3
  228. package/dist/i18n/ru.js +349 -0
  229. package/dist/i18n/ru.js.map +1 -1
  230. package/dist/importcss-JLNIRKGH.js +127 -0
  231. package/dist/importcss-JLNIRKGH.js.map +1 -0
  232. package/dist/importword-ZOWLUWSN.js +73 -0
  233. package/dist/importword-ZOWLUWSN.js.map +1 -0
  234. package/dist/{index-C603bU6r.d.ts → index-Pb2r0V-S.d.cts} +39 -17
  235. package/dist/{index-C603bU6r.d.cts → index-Pb2r0V-S.d.ts} +39 -17
  236. package/dist/index.cjs +29422 -10640
  237. package/dist/index.cjs.map +1 -1
  238. package/dist/index.d.cts +139 -64
  239. package/dist/index.d.ts +139 -64
  240. package/dist/index.js +204 -1412
  241. package/dist/index.js.map +1 -1
  242. package/dist/{insertdatetime-CRO7TJAQ.js → insertdatetime-BXQ3XXPH.js} +7 -7
  243. package/dist/insertdatetime-BXQ3XXPH.js.map +1 -0
  244. package/dist/linkchecker-JASSETVI.js +287 -0
  245. package/dist/linkchecker-JASSETVI.js.map +1 -0
  246. package/dist/markdown-OTLTCK26.js +136 -0
  247. package/dist/markdown-OTLTCK26.js.map +1 -0
  248. package/dist/markdown.cjs +94 -11
  249. package/dist/markdown.cjs.map +1 -1
  250. package/dist/markdown.d.cts +12 -10
  251. package/dist/markdown.d.ts +12 -10
  252. package/dist/markdown.js +4 -235
  253. package/dist/markdown.js.map +1 -1
  254. package/dist/math-ui-TY4VZF7Q.js +157 -0
  255. package/dist/math-ui-TY4VZF7Q.js.map +1 -0
  256. package/dist/media-ui-IXN4ENVF.js +123 -0
  257. package/dist/media-ui-IXN4ENVF.js.map +1 -0
  258. package/dist/mediaembed-ui-ODX5ECXC.js +207 -0
  259. package/dist/mediaembed-ui-ODX5ECXC.js.map +1 -0
  260. package/dist/mentions-ui-55GCKC6F.js +58 -0
  261. package/dist/mentions-ui-55GCKC6F.js.map +1 -0
  262. package/dist/mergetags-ui-6T7Z7MAZ.js +73 -0
  263. package/dist/mergetags-ui-6T7Z7MAZ.js.map +1 -0
  264. package/dist/{nonbreaking-66LFZV2W.js → nonbreaking-PONHSOMJ.js} +7 -7
  265. package/dist/nonbreaking-PONHSOMJ.js.map +1 -0
  266. package/dist/pagebreak-ui-AKAW7M5I.js +50 -0
  267. package/dist/pagebreak-ui-AKAW7M5I.js.map +1 -0
  268. package/dist/pageembed-ui-GUNPKMBR.js +172 -0
  269. package/dist/pageembed-ui-GUNPKMBR.js.map +1 -0
  270. package/dist/pagelayout-ui-JSFVEMHS.js +236 -0
  271. package/dist/pagelayout-ui-JSFVEMHS.js.map +1 -0
  272. package/dist/{paste-office-F3QW4WWO.js → paste-office-TORLAZ5L.js} +94 -4
  273. package/dist/paste-office-TORLAZ5L.js.map +1 -0
  274. package/dist/permanentpen-EACURV5U.js +206 -0
  275. package/dist/permanentpen-EACURV5U.js.map +1 -0
  276. package/dist/print-4XJCOANX.js +178 -0
  277. package/dist/print-4XJCOANX.js.map +1 -0
  278. package/dist/{quickbars-7E2QRS7J.js → quickbars-BT5PETRX.js} +20 -12
  279. package/dist/quickbars-BT5PETRX.js.map +1 -0
  280. package/dist/{revisionhistory-DXE7KU4R.js → revisionhistory-3FKLMJHJ.js} +42 -153
  281. package/dist/revisionhistory-3FKLMJHJ.js.map +1 -0
  282. package/dist/save-ZHFXH222.js +120 -0
  283. package/dist/save-ZHFXH222.js.map +1 -0
  284. package/dist/search-bar-6MVRMTK6.js +212 -0
  285. package/dist/search-bar-6MVRMTK6.js.map +1 -0
  286. package/dist/spellchecker-JJKA6B4R.js +474 -0
  287. package/dist/spellchecker-JJKA6B4R.js.map +1 -0
  288. package/dist/suggestions-panel-X37NFLXE.js +596 -0
  289. package/dist/suggestions-panel-X37NFLXE.js.map +1 -0
  290. package/dist/suggestions-ui-WN7QNYHB.js +395 -0
  291. package/dist/suggestions-ui-WN7QNYHB.js.map +1 -0
  292. package/dist/table-PEF56QG5.js +54 -0
  293. package/dist/table-PEF56QG5.js.map +1 -0
  294. package/dist/table-dialogs-QS3VFZD2.js +119 -0
  295. package/dist/table-dialogs-QS3VFZD2.js.map +1 -0
  296. package/dist/tableofcontents-ui-U7EV3UU7.js +167 -0
  297. package/dist/tableofcontents-ui-U7EV3UU7.js.map +1 -0
  298. package/dist/template-ZRTKIP2J.js +278 -0
  299. package/dist/template-ZRTKIP2J.js.map +1 -0
  300. package/dist/typography-S7RO54DB.js +399 -0
  301. package/dist/typography-S7RO54DB.js.map +1 -0
  302. package/dist/upload.cjs +160 -0
  303. package/dist/upload.cjs.map +1 -0
  304. package/dist/upload.d.cts +72 -0
  305. package/dist/upload.d.ts +72 -0
  306. package/dist/upload.js +132 -0
  307. package/dist/upload.js.map +1 -0
  308. package/dist/{visualblocks-6DLBXYOA.js → visualblocks-KJYRHF2L.js} +7 -7
  309. package/dist/visualblocks-KJYRHF2L.js.map +1 -0
  310. package/dist/visualchars-TDLZKFXD.js +134 -0
  311. package/dist/visualchars-TDLZKFXD.js.map +1 -0
  312. package/package.json +53 -3
  313. package/src/style.css +376 -550
  314. package/dist/advlist-5FNKPLUX.js.map +0 -1
  315. package/dist/autolink-45LTODWB.js.map +0 -1
  316. package/dist/autoresize-UB3GOA6D.js.map +0 -1
  317. package/dist/autosave-GMWJ5BPE.js.map +0 -1
  318. package/dist/charmap-2GC7LF7G.js.map +0 -1
  319. package/dist/chunk-5AW2HHG6.js.map +0 -1
  320. package/dist/chunk-DWZLSZDG.js +0 -5664
  321. package/dist/chunk-DWZLSZDG.js.map +0 -1
  322. package/dist/chunk-FCMZ7TUQ.js.map +0 -1
  323. package/dist/chunk-HPLT3XRZ.js.map +0 -1
  324. package/dist/chunk-JPJVTB45.js.map +0 -1
  325. package/dist/chunk-KPE3QRPB.js.map +0 -1
  326. package/dist/chunk-KWXFL4WS.js.map +0 -1
  327. package/dist/chunk-ND2CWNVG.js.map +0 -1
  328. package/dist/chunk-PVFKXRID.js.map +0 -1
  329. package/dist/chunk-R2UMUCVI.js.map +0 -1
  330. package/dist/chunk-T3GY6IVK.js.map +0 -1
  331. package/dist/chunk-Z3ELZ77W.js.map +0 -1
  332. package/dist/comments-panel-HXMWSRAW.js.map +0 -1
  333. package/dist/directionality-5JLWQGP2.js.map +0 -1
  334. package/dist/editor-CXkltf1R.d.ts +0 -1886
  335. package/dist/editor-CgSBFTke.d.cts +0 -1886
  336. package/dist/emoticons-ZD6ZRIWG.js.map +0 -1
  337. package/dist/form-dialog-QH6KAERD.js +0 -180
  338. package/dist/form-dialog-QH6KAERD.js.map +0 -1
  339. package/dist/html-rules-api-D3fKQi-R.d.cts +0 -40
  340. package/dist/html-rules-api-D3fKQi-R.d.ts +0 -40
  341. package/dist/insertdatetime-CRO7TJAQ.js.map +0 -1
  342. package/dist/nonbreaking-66LFZV2W.js.map +0 -1
  343. package/dist/paste-office-F3QW4WWO.js.map +0 -1
  344. package/dist/quickbars-7E2QRS7J.js.map +0 -1
  345. package/dist/revisionhistory-DXE7KU4R.js.map +0 -1
  346. package/dist/table-SSNABG5W.js.map +0 -1
  347. package/dist/visualblocks-6DLBXYOA.js.map +0 -1
@@ -0,0 +1,683 @@
1
+ import {
2
+ dataUrlToFile,
3
+ getSelectedImage
4
+ } from "./chunk-YYCDRUE2.js";
5
+ import "./chunk-DV7TGRU6.js";
6
+ import "./chunk-AB67XUSR.js";
7
+ import {
8
+ nodesOf
9
+ } from "./chunk-UHUOAQA6.js";
10
+ import "./chunk-HNEAVVBC.js";
11
+ import "./chunk-6BJEOL5V.js";
12
+ import "./chunk-XR7CY4NI.js";
13
+ import "./chunk-5KERLFDD.js";
14
+ import {
15
+ pickLabels
16
+ } from "./chunk-XCXJD5DO.js";
17
+ import {
18
+ definePlugin
19
+ } from "./chunk-V7WUHUHM.js";
20
+ import {
21
+ h,
22
+ icon
23
+ } from "./chunk-QU3KXMYT.js";
24
+ import "./chunk-G74HNSB6.js";
25
+ import {
26
+ isSafeImageUrl
27
+ } from "./chunk-4VPDY3LF.js";
28
+
29
+ // src/plugins/editimage.ts
30
+ import { closeHistory } from "prosemirror-history";
31
+ import { NodeSelection } from "prosemirror-state";
32
+
33
+ // nova-raw-css:/home/runner/work/novaprose/novaprose/packages/core/src/plugins/editimage.css?raw
34
+ var editimage_default = ".nova-editimage{display:flex;flex-direction:column;gap:10px}.nova-editimage-tools{display:flex;align-items:center;gap:2px}.nova-editimage-tools .nova-button{margin-inline-start:6px}.nova-editimage-stage{position:relative;align-self:center;max-width:100%;overflow:hidden;line-height:0;background:repeating-conic-gradient(var(--nova-hover) 0 25%,transparent 0 50%) 0 0 / 16px 16px;cursor:crosshair;touch-action:none;user-select:none}.nova-editimage-canvas{display:block;max-width:100%}.nova-editimage-crop{position:absolute;box-sizing:border-box;border:2px solid #ffffff;outline:1px solid rgb(0 0 0 / .6);box-shadow:0 0 0 9999px #00000073;cursor:move;pointer-events:none}.nova-editimage-crop[hidden]{display:none}.nova-editimage-group{display:flex;flex-wrap:wrap;align-items:flex-end;gap:8px 12px;margin:0;padding:8px 0 0;border:0;border-top:1px solid var(--nova-border)}.nova-editimage-group legend{padding:0 0 4px;font-weight:600}.nova-editimage-field{display:flex;flex-direction:column;gap:4px;font-size:13px}.nova-editimage-field .nova-input{width:96px}.nova-editimage-field select.nova-input{width:140px}.nova-editimage-range{flex-direction:row;flex-wrap:wrap;align-items:center;column-gap:8px}.nova-editimage-range span{flex-basis:100%}.nova-editimage-range input{width:150px;accent-color:var(--nova-accent)}.nova-editimage-value{min-width:3ch;color:var(--nova-muted);font-variant-numeric:tabular-nums}.nova-editimage-check{display:flex;align-items:center;gap:6px;padding-bottom:8px;font-size:13px}";
35
+
36
+ // src/plugins/editimage-pixels.ts
37
+ var NO_EDIT = {
38
+ rotate: 0,
39
+ flipH: false,
40
+ flipV: false,
41
+ crop: null,
42
+ width: null,
43
+ height: null,
44
+ brightness: 0,
45
+ contrast: 0,
46
+ saturation: 0
47
+ };
48
+ function rotatedSize(width, height, rotate) {
49
+ return rotate % 180 === 0 ? [width, height] : [height, width];
50
+ }
51
+ function turn(rotate, by) {
52
+ return ((rotate + by) % 360 + 360) % 360;
53
+ }
54
+ function clampRect(rect, width, height) {
55
+ const x = Math.min(Math.max(0, Math.round(rect.x)), width - 1);
56
+ const y = Math.min(Math.max(0, Math.round(rect.y)), height - 1);
57
+ return {
58
+ x,
59
+ y,
60
+ width: Math.min(Math.max(1, Math.round(rect.width)), width - x),
61
+ height: Math.min(Math.max(1, Math.round(rect.height)), height - y)
62
+ };
63
+ }
64
+ function rectOfRatio(width, height, ratio) {
65
+ if (!ratio || !Number.isFinite(ratio) || ratio <= 0) return { x: 0, y: 0, width, height };
66
+ let w = width;
67
+ let h2 = Math.round(width / ratio);
68
+ if (h2 > height) {
69
+ h2 = height;
70
+ w = Math.round(height * ratio);
71
+ }
72
+ return { x: Math.round((width - w) / 2), y: Math.round((height - h2) / 2), width: w, height: h2 };
73
+ }
74
+ function editGeometry(sourceWidth, sourceHeight, edit) {
75
+ const [w, h2] = rotatedSize(sourceWidth, sourceHeight, edit.rotate);
76
+ const crop = edit.crop ? clampRect(edit.crop, w, h2) : { x: 0, y: 0, width: w, height: h2 };
77
+ const size = (value, fallback) => value && Number.isFinite(value) ? Math.min(1e4, Math.max(1, Math.round(value))) : fallback;
78
+ return { crop, width: size(edit.width, crop.width), height: size(edit.height, crop.height) };
79
+ }
80
+ function hasColorEdit(edit) {
81
+ return edit.brightness !== 0 || edit.contrast !== 0 || edit.saturation !== 0;
82
+ }
83
+ function adjustPixels(data, { brightness, contrast, saturation }) {
84
+ const b = 1 + clamp100(brightness) / 100;
85
+ const c = 1 + clamp100(contrast) / 100;
86
+ const s = 1 + clamp100(saturation) / 100;
87
+ for (let i = 0; i < data.length; i += 4) {
88
+ let r = data[i] * b;
89
+ let g = data[i + 1] * b;
90
+ let bl = data[i + 2] * b;
91
+ r = (r - 128) * c + 128;
92
+ g = (g - 128) * c + 128;
93
+ bl = (bl - 128) * c + 128;
94
+ const gray = 0.2126 * r + 0.7152 * g + 0.0722 * bl;
95
+ data[i] = gray + (r - gray) * s;
96
+ data[i + 1] = gray + (g - gray) * s;
97
+ data[i + 2] = gray + (bl - gray) * s;
98
+ }
99
+ }
100
+ function clamp100(value) {
101
+ return Number.isFinite(value) ? Math.min(100, Math.max(-100, value)) : 0;
102
+ }
103
+ function outputType(type) {
104
+ return type === "image/jpeg" || type === "image/webp" ? type : "image/png";
105
+ }
106
+ function editedName(src, type) {
107
+ const ext = type === "image/jpeg" ? "jpg" : type.split("/")[1] ?? "png";
108
+ let base = "image";
109
+ try {
110
+ const path = new URL(src, "https://x.invalid/").pathname;
111
+ const last = decodeURIComponent(path.split("/").pop() ?? "").replace(/\.[a-z0-9]{1,5}$/i, "");
112
+ if (/^[\w.-]{1,80}$/.test(last) && !src.startsWith("data:") && !src.startsWith("blob:"))
113
+ base = last;
114
+ } catch {
115
+ }
116
+ return `${base.replace(/-edited$/, "")}-edited.${ext}`;
117
+ }
118
+
119
+ // src/plugins/editimage.ts
120
+ var LABELS = {
121
+ en: {
122
+ rotateLeft: "Rotate left",
123
+ rotateRight: "Rotate right",
124
+ flipH: "Flip horizontally",
125
+ flipV: "Flip vertically",
126
+ edit: "Edit image",
127
+ reset: "Start over",
128
+ apply: "Apply",
129
+ preview: "The image with the changes",
130
+ crop: "Crop",
131
+ shape: "Shape",
132
+ free: "Free",
133
+ original: "As the image",
134
+ square: "Square",
135
+ left: "Left, px",
136
+ top: "Top, px",
137
+ width: "Width, px",
138
+ height: "Height, px",
139
+ size: "Size",
140
+ keepRatio: "Keep the proportions",
141
+ colors: "Colors",
142
+ brightness: "Brightness",
143
+ contrast: "Contrast",
144
+ saturation: "Saturation",
145
+ working: "Editing the image\u2026",
146
+ unreadable: "This image is on a site that doesn\u2019t allow editing it here. Save it and insert it again to edit it.",
147
+ unsupported: "Only PNG, JPEG, WebP, GIF, AVIF and BMP images can be edited.",
148
+ failed: "The edited image couldn\u2019t be saved."
149
+ }
150
+ };
151
+ var svg = (paths) => `<svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${paths}</svg>`;
152
+ var ICONS = {
153
+ rotateLeft: svg('<path d="M3 4v5h5"/><path d="M3.5 9A8.5 8.5 0 1 1 6 16.5"/>'),
154
+ rotateRight: svg('<path d="M21 4v5h-5"/><path d="M20.5 9A8.5 8.5 0 1 0 18 16.5"/>'),
155
+ flipH: svg('<path d="M12 3v18"/><path d="M9 7 4 12l5 5V7Z"/><path d="M15 7v10l5-5-5-5Z"/>'),
156
+ flipV: svg('<path d="M3 12h18"/><path d="M7 9l5-5 5 5H7Z"/><path d="M7 15h10l-5 5-5-5Z"/>'),
157
+ edit: svg(
158
+ '<rect x="3" y="3" width="18" height="18" rx="2"/><circle cx="9" cy="9" r="2"/><path d="m21 15-3.1-3.1a2 2 0 0 0-2.8 0L6 21"/><path d="M14 3v4"/><path d="M12 5h4"/>'
159
+ )
160
+ };
161
+ var EDITABLE = /^image\/(png|jpe?g|gif|webp|avif|bmp)$/;
162
+ var UnreadableImage = class extends Error {
163
+ };
164
+ var UnsupportedImage = class extends Error {
165
+ };
166
+ var isBlob = (value) => !!value && typeof value === "object" && typeof value.slice === "function" && typeof value.type === "string" && typeof value.size === "number";
167
+ async function sniffType(blob) {
168
+ const bytes = new Uint8Array(await blob.slice(0, 12).arrayBuffer());
169
+ const at = (i, ...values) => values.every((v, k) => bytes[i + k] === v);
170
+ if (at(0, 137, 80, 78, 71)) return "image/png";
171
+ if (at(0, 255, 216, 255)) return "image/jpeg";
172
+ if (at(0, 71, 73, 70, 56)) return "image/gif";
173
+ if (at(0, 82, 73, 70, 70) && at(8, 87, 69, 66, 80)) return "image/webp";
174
+ if (at(0, 66, 77)) return "image/bmp";
175
+ if (at(4, 102, 116, 121, 112, 97, 118, 105, 102)) return "image/avif";
176
+ return "";
177
+ }
178
+ async function loadImage(src, options) {
179
+ let blob;
180
+ if (typeof options.fetchImage === "function") {
181
+ blob = await options.fetchImage(src);
182
+ } else if (/^data:/i.test(src)) {
183
+ const file = dataUrlToFile(src);
184
+ if (!file) throw new UnsupportedImage("not an editable data: image");
185
+ blob = file;
186
+ } else {
187
+ let url;
188
+ try {
189
+ url = new URL(src, document.baseURI);
190
+ } catch {
191
+ throw new UnsupportedImage("a malformed address");
192
+ }
193
+ if (!["http:", "https:", "blob:"].includes(url.protocol)) throw new UnsupportedImage(src);
194
+ const own = url.origin === location.origin || url.protocol === "blob:";
195
+ const hosts = Array.isArray(options.credentialsHosts) ? options.credentialsHosts : [];
196
+ const credentials = own ? "same-origin" : hosts.includes(url.hostname) ? "include" : "omit";
197
+ let response;
198
+ try {
199
+ response = await fetch(url.href, { credentials });
200
+ } catch (error) {
201
+ throw new UnreadableImage(String(error));
202
+ }
203
+ if (!response.ok) throw new UnreadableImage(`${response.status}`);
204
+ blob = await response.blob();
205
+ }
206
+ if (!isBlob(blob)) throw new UnreadableImage("no file");
207
+ const declared = blob.type.toLowerCase();
208
+ if (declared.includes("svg")) throw new UnsupportedImage("svg");
209
+ const type = EDITABLE.test(declared) ? declared : await sniffType(blob);
210
+ if (!EDITABLE.test(type)) throw new UnsupportedImage(type || "unknown");
211
+ return type === declared ? blob : new Blob([blob], { type });
212
+ }
213
+ function drawTurned(bitmap, edit, scale = 1) {
214
+ const [w, h2] = rotatedSize(bitmap.width, bitmap.height, edit.rotate);
215
+ const canvas = document.createElement("canvas");
216
+ canvas.width = Math.max(1, Math.round(w * scale));
217
+ canvas.height = Math.max(1, Math.round(h2 * scale));
218
+ const ctx = canvas.getContext("2d");
219
+ ctx.translate(canvas.width / 2, canvas.height / 2);
220
+ ctx.scale(edit.flipH ? -1 : 1, edit.flipV ? -1 : 1);
221
+ ctx.rotate(edit.rotate * Math.PI / 180);
222
+ ctx.scale(scale, scale);
223
+ ctx.drawImage(bitmap, -bitmap.width / 2, -bitmap.height / 2);
224
+ return canvas;
225
+ }
226
+ async function renderEdit(bitmap, edit, type, quality) {
227
+ const { crop, width, height } = editGeometry(bitmap.width, bitmap.height, edit);
228
+ const turned = drawTurned(bitmap, edit);
229
+ const out = document.createElement("canvas");
230
+ out.width = width;
231
+ out.height = height;
232
+ const ctx = out.getContext("2d");
233
+ ctx.imageSmoothingQuality = "high";
234
+ ctx.drawImage(turned, crop.x, crop.y, crop.width, crop.height, 0, 0, width, height);
235
+ if (hasColorEdit(edit)) {
236
+ const pixels = ctx.getImageData(0, 0, width, height);
237
+ adjustPixels(pixels.data, edit);
238
+ ctx.putImageData(pixels, 0, 0);
239
+ }
240
+ return new Promise(
241
+ (resolve, reject) => out.toBlob(
242
+ (blob) => blob ? resolve(blob) : reject(new Error("the canvas gave no file")),
243
+ type,
244
+ quality
245
+ )
246
+ );
247
+ }
248
+ function readAsDataUrl(file) {
249
+ return new Promise((resolve, reject) => {
250
+ const reader = new FileReader();
251
+ reader.onload = () => resolve(String(reader.result));
252
+ reader.onerror = () => reject(reader.error ?? new Error("FileReader failed"));
253
+ reader.readAsDataURL(file);
254
+ });
255
+ }
256
+ function findImageNode(editor, src, near) {
257
+ const { doc } = editor.view.state;
258
+ const nodes = nodesOf(editor.view.state);
259
+ const isImage = (node) => !!node && (node.type === nodes.image || node.type === nodes.figure_image) && node.attrs.src === src;
260
+ if (near !== void 0 && near >= 0 && near < doc.content.size && isImage(doc.nodeAt(near)))
261
+ return near;
262
+ let found = null;
263
+ doc.descendants((node, pos) => {
264
+ if (found !== null) return false;
265
+ if (isImage(node)) found = pos;
266
+ return true;
267
+ });
268
+ return found;
269
+ }
270
+ function selectedImageNode(editor) {
271
+ const selected = getSelectedImage(editor.view.state);
272
+ if (!selected) return null;
273
+ const nodes = nodesOf(editor.view.state);
274
+ if (selected.node.type === nodes.figure) {
275
+ const inner = selected.node.firstChild;
276
+ return inner ? { pos: selected.pos + 1, node: inner } : null;
277
+ }
278
+ return { pos: selected.pos, node: selected.node };
279
+ }
280
+ function setAttrs(editor, pos, attrs, history, select) {
281
+ const { state } = editor.view;
282
+ const node = state.doc.nodeAt(pos);
283
+ if (!node) return;
284
+ const tr = state.tr.setNodeMarkup(pos, void 0, { ...node.attrs, ...attrs });
285
+ if (select && node.type === nodesOf(state).image)
286
+ tr.setSelection(NodeSelection.create(tr.doc, pos));
287
+ if (history) closeHistory(tr);
288
+ else tr.setMeta("addToHistory", false);
289
+ editor.view.dispatch(tr);
290
+ }
291
+ async function replaceImage(editor, labels, at, file, size) {
292
+ const original = {
293
+ src: at.node.attrs.src,
294
+ width: at.node.attrs.width,
295
+ height: at.node.attrs.height
296
+ };
297
+ const handler = editor.options.uploadImage;
298
+ const embedded = handler ? null : await readAsDataUrl(file);
299
+ const pos = findImageNode(editor, String(original.src), at.pos);
300
+ if (pos === null) return;
301
+ if (!handler) {
302
+ setAttrs(editor, pos, { src: embedded, ...size }, true, true);
303
+ editor.focus();
304
+ return;
305
+ }
306
+ const local = URL.createObjectURL(file);
307
+ setAttrs(editor, pos, { src: local, ...size }, true, true);
308
+ editor.focus();
309
+ try {
310
+ const url = await handler(file, () => {
311
+ });
312
+ if (!isSafeImageUrl(url)) throw new Error(`Unsafe image URL returned: ${url}`);
313
+ const now = findImageNode(editor, local);
314
+ if (now !== null) setAttrs(editor, now, { src: url }, false, false);
315
+ } catch (error) {
316
+ console.error("[nova] editimage: the upload failed", error);
317
+ const now = findImageNode(editor, local);
318
+ if (now !== null) setAttrs(editor, now, original, false, false);
319
+ editor.ui.notify({ text: labels.failed, type: "error" });
320
+ } finally {
321
+ URL.revokeObjectURL(local);
322
+ }
323
+ }
324
+ function displaySize(node, bitmap, edit) {
325
+ const { width, height } = editGeometry(bitmap.width, bitmap.height, edit);
326
+ const shown = Number(node.attrs.width);
327
+ if (!shown || edit.width !== null || edit.height !== null) return { width: null, height: null };
328
+ const scale = shown / bitmap.width;
329
+ return {
330
+ width: Math.max(1, Math.round(width * scale)),
331
+ height: node.attrs.height ? Math.max(1, Math.round(height * scale)) : null
332
+ };
333
+ }
334
+ function problem(error, labels) {
335
+ if (error instanceof UnsupportedImage) return labels.unsupported;
336
+ if (error instanceof UnreadableImage) return labels.unreadable;
337
+ return labels.failed;
338
+ }
339
+ var editimage_default2 = definePlugin({
340
+ name: "editimage",
341
+ setup(editor) {
342
+ const labels = pickLabels(editor, "editimage", LABELS);
343
+ const options = editor.options.pluginOptions?.editimage ?? {};
344
+ const quality = Number.isFinite(options.quality) ? Math.min(1, Math.max(0.1, options.quality)) : 0.92;
345
+ editor.ui.addStyles("nova-editimage", editimage_default);
346
+ const apply = async (edit, read) => {
347
+ const at = read?.at ?? selectedImageNode(editor);
348
+ if (!at) return;
349
+ const notice = editor.ui.notify({ text: labels.working, timeout: 0 });
350
+ try {
351
+ const blob = read?.blob ?? await loadImage(String(at.node.attrs.src), options);
352
+ const bitmap = read?.bitmap ?? await createImageBitmap(blob);
353
+ const type = outputType(blob.type);
354
+ const result = await renderEdit(bitmap, edit, type, quality);
355
+ const file = new File([result], editedName(String(at.node.attrs.src), type), { type });
356
+ await replaceImage(editor, labels, at, file, displaySize(at.node, bitmap, edit));
357
+ } catch (error) {
358
+ console.warn("[nova] editimage:", error);
359
+ editor.ui.notify({ text: problem(error, labels), type: "error" });
360
+ } finally {
361
+ notice.close();
362
+ }
363
+ };
364
+ const quick = (name, label, svgIcon, edit) => {
365
+ editor.ui.registry.addButton(name, {
366
+ icon: svgIcon,
367
+ tooltip: label,
368
+ isEnabled: (e) => e.isEditable() && !!selectedImageNode(e),
369
+ onAction: () => void apply({ ...NO_EDIT, ...edit })
370
+ });
371
+ };
372
+ quick("rotateleft", labels.rotateLeft, ICONS.rotateLeft, { rotate: 270 });
373
+ quick("rotateright", labels.rotateRight, ICONS.rotateRight, { rotate: 90 });
374
+ quick("fliph", labels.flipH, ICONS.flipH, { flipH: true });
375
+ quick("flipv", labels.flipV, ICONS.flipV, { flipV: true });
376
+ const openEditor = async () => {
377
+ const at = selectedImageNode(editor);
378
+ if (!at) return;
379
+ let blob;
380
+ let bitmap;
381
+ try {
382
+ blob = await loadImage(String(at.node.attrs.src), options);
383
+ bitmap = await createImageBitmap(blob);
384
+ } catch (error) {
385
+ console.warn("[nova] editimage:", error);
386
+ editor.ui.notify({ text: problem(error, labels), type: "error" });
387
+ return;
388
+ }
389
+ openEditDialog(editor, labels, bitmap, (edit) => void apply(edit, { blob, bitmap, at }));
390
+ };
391
+ editor.ui.registry.addButton("editimage", {
392
+ icon: ICONS.edit,
393
+ tooltip: labels.edit,
394
+ isEnabled: (e) => e.isEditable() && !!selectedImageNode(e),
395
+ onAction: () => void openEditor()
396
+ });
397
+ const toolbar = typeof options.toolbar === "string" ? options.toolbar : "rotateleft rotateright | flipv fliph | editimage";
398
+ const image = editor.ui.registry.getContextToolbars().find(([name]) => name === "image")?.[1];
399
+ if (image && toolbar.trim())
400
+ editor.ui.registry.addContextToolbar("image", {
401
+ ...image,
402
+ items: `${image.items} | ${toolbar}`
403
+ });
404
+ }
405
+ });
406
+ function openEditDialog(editor, labels, bitmap, onApply) {
407
+ let edit = { ...NO_EDIT };
408
+ let ratio = null;
409
+ const MAX_W = 620;
410
+ const MAX_H = 320;
411
+ const canvas = h("canvas", { className: "nova-editimage-canvas" });
412
+ const cropBox = h("div", { className: "nova-editimage-crop", "aria-hidden": "true" });
413
+ const stage = h(
414
+ "div",
415
+ { className: "nova-editimage-stage", role: "img", "aria-label": labels.preview },
416
+ canvas,
417
+ cropBox
418
+ );
419
+ const num = (label, min = 0) => {
420
+ const input = h("input", {
421
+ type: "number",
422
+ className: "nova-input",
423
+ min: String(min),
424
+ step: "1",
425
+ inputmode: "numeric"
426
+ });
427
+ const field = h("label", { className: "nova-editimage-field" }, h("span", {}, label), input);
428
+ return { input, field };
429
+ };
430
+ const range = (label) => {
431
+ const input = h("input", { type: "range", min: "-100", max: "100", step: "1", value: "0" });
432
+ const output = h("output", { className: "nova-editimage-value" }, "0");
433
+ const field = h(
434
+ "label",
435
+ { className: "nova-editimage-field nova-editimage-range" },
436
+ h("span", {}, label),
437
+ input,
438
+ output
439
+ );
440
+ return { input, output, field };
441
+ };
442
+ const shape = h(
443
+ "select",
444
+ { className: "nova-input" },
445
+ ...[
446
+ ["", labels.free],
447
+ ["original", labels.original],
448
+ ["1", labels.square],
449
+ [String(4 / 3), "4:3"],
450
+ [String(3 / 2), "3:2"],
451
+ [String(16 / 9), "16:9"]
452
+ ].map(([value, text]) => h("option", { value }, text))
453
+ );
454
+ const x = num(labels.left);
455
+ const y = num(labels.top);
456
+ const cw = num(labels.width, 1);
457
+ const ch = num(labels.height, 1);
458
+ const ow = num(labels.width, 1);
459
+ const oh = num(labels.height, 1);
460
+ const keep = h("input", {
461
+ type: "checkbox",
462
+ className: "nova-checkbox",
463
+ checked: true
464
+ });
465
+ const brightness = range(labels.brightness);
466
+ const contrast = range(labels.contrast);
467
+ const saturation = range(labels.saturation);
468
+ const tool = (svgIcon, label, run) => {
469
+ const button = h(
470
+ "button",
471
+ { type: "button", className: "nova-btn", "aria-label": label, "data-tooltip": label },
472
+ icon(svgIcon)
473
+ );
474
+ button.addEventListener("click", run);
475
+ editor.ui.tooltip.attach(button);
476
+ return button;
477
+ };
478
+ const reset = h("button", { type: "button", className: "nova-button" }, labels.reset);
479
+ const turned = () => rotatedSize(bitmap.width, bitmap.height, edit.rotate);
480
+ const currentCrop = () => {
481
+ const [w, hgt] = turned();
482
+ return edit.crop ? clampRect(edit.crop, w, hgt) : { x: 0, y: 0, width: w, height: hgt };
483
+ };
484
+ let scale = 1;
485
+ let frame = 0;
486
+ const draw = () => {
487
+ cancelAnimationFrame(frame);
488
+ frame = requestAnimationFrame(() => {
489
+ const [w, hgt] = turned();
490
+ const room = Math.min(MAX_W, stage.parentElement?.clientWidth || MAX_W);
491
+ scale = Math.min(1, room / w, MAX_H / hgt);
492
+ const preview = drawTurned(bitmap, edit, scale);
493
+ canvas.width = preview.width;
494
+ canvas.height = preview.height;
495
+ const ctx = canvas.getContext("2d");
496
+ ctx.drawImage(preview, 0, 0);
497
+ if (hasColorEdit(edit)) {
498
+ const pixels = ctx.getImageData(0, 0, canvas.width, canvas.height);
499
+ adjustPixels(pixels.data, edit);
500
+ ctx.putImageData(pixels, 0, 0);
501
+ }
502
+ const crop = currentCrop();
503
+ cropBox.hidden = !edit.crop;
504
+ cropBox.style.left = `${crop.x * scale}px`;
505
+ cropBox.style.top = `${crop.y * scale}px`;
506
+ cropBox.style.width = `${crop.width * scale}px`;
507
+ cropBox.style.height = `${crop.height * scale}px`;
508
+ });
509
+ };
510
+ const fill = () => {
511
+ const crop = currentCrop();
512
+ x.input.value = String(crop.x);
513
+ y.input.value = String(crop.y);
514
+ cw.input.value = String(crop.width);
515
+ ch.input.value = String(crop.height);
516
+ const { width, height } = editGeometry(bitmap.width, bitmap.height, edit);
517
+ ow.input.value = String(width);
518
+ oh.input.value = String(height);
519
+ for (const [r, value] of [
520
+ [brightness, edit.brightness],
521
+ [contrast, edit.contrast],
522
+ [saturation, edit.saturation]
523
+ ]) {
524
+ r.input.value = String(value);
525
+ r.output.textContent = String(value);
526
+ }
527
+ draw();
528
+ };
529
+ const setCrop = (rect) => {
530
+ const [w, hgt] = turned();
531
+ const crop = rect ? clampRect(rect, w, hgt) : null;
532
+ const whole = crop && crop.x === 0 && crop.y === 0 && crop.width === w && crop.height === hgt;
533
+ edit = { ...edit, crop: whole ? null : crop, width: null, height: null };
534
+ fill();
535
+ };
536
+ const shapeRatio = () => {
537
+ if (!shape.value) return null;
538
+ if (shape.value === "original") {
539
+ const [w, hgt] = turned();
540
+ return w / hgt;
541
+ }
542
+ return Number(shape.value) || null;
543
+ };
544
+ const tools = h(
545
+ "div",
546
+ { className: "nova-editimage-tools", role: "toolbar", "aria-label": labels.edit },
547
+ tool(ICONS.rotateLeft, labels.rotateLeft, () => {
548
+ edit = { ...edit, rotate: turn(edit.rotate, -90), crop: null, width: null, height: null };
549
+ fill();
550
+ }),
551
+ tool(ICONS.rotateRight, labels.rotateRight, () => {
552
+ edit = { ...edit, rotate: turn(edit.rotate, 90), crop: null, width: null, height: null };
553
+ fill();
554
+ }),
555
+ tool(ICONS.flipH, labels.flipH, () => {
556
+ edit = { ...edit, flipH: !edit.flipH, crop: null, width: null, height: null };
557
+ fill();
558
+ }),
559
+ tool(ICONS.flipV, labels.flipV, () => {
560
+ edit = { ...edit, flipV: !edit.flipV, crop: null, width: null, height: null };
561
+ fill();
562
+ }),
563
+ h("span", { className: "nova-bubble-sep", role: "separator" }),
564
+ reset
565
+ );
566
+ reset.addEventListener("click", () => {
567
+ edit = { ...NO_EDIT };
568
+ shape.value = "";
569
+ ratio = null;
570
+ fill();
571
+ });
572
+ shape.addEventListener("change", () => {
573
+ ratio = shapeRatio();
574
+ const [w, hgt] = turned();
575
+ setCrop(ratio ? rectOfRatio(w, hgt, ratio) : null);
576
+ });
577
+ const fromCropFields = () => {
578
+ const width = Number(cw.input.value) || 1;
579
+ const height = ratio ? Math.round(width / ratio) : Number(ch.input.value) || 1;
580
+ setCrop({ x: Number(x.input.value) || 0, y: Number(y.input.value) || 0, width, height });
581
+ };
582
+ for (const field of [x, y, cw, ch]) field.input.addEventListener("change", fromCropFields);
583
+ ow.input.addEventListener("change", () => {
584
+ const crop = currentCrop();
585
+ const width = Math.max(1, Number(ow.input.value) || crop.width);
586
+ const height = keep.checked ? Math.max(1, Math.round(width * crop.height / crop.width)) : Number(oh.input.value) || crop.height;
587
+ edit = { ...edit, width, height };
588
+ fill();
589
+ });
590
+ oh.input.addEventListener("change", () => {
591
+ const crop = currentCrop();
592
+ const height = Math.max(1, Number(oh.input.value) || crop.height);
593
+ const width = keep.checked ? Math.max(1, Math.round(height * crop.width / crop.height)) : Number(ow.input.value) || crop.width;
594
+ edit = { ...edit, width, height };
595
+ fill();
596
+ });
597
+ for (const [r, key] of [
598
+ [brightness, "brightness"],
599
+ [contrast, "contrast"],
600
+ [saturation, "saturation"]
601
+ ]) {
602
+ r.input.addEventListener("input", () => {
603
+ edit = { ...edit, [key]: Number(r.input.value) || 0 };
604
+ r.output.textContent = r.input.value;
605
+ draw();
606
+ });
607
+ }
608
+ stage.addEventListener("pointerdown", (event) => {
609
+ if (event.button !== 0) return;
610
+ const box = canvas.getBoundingClientRect();
611
+ const toImage = (e) => ({
612
+ x: Math.min(Math.max(0, (e.clientX - box.left) / scale), turned()[0]),
613
+ y: Math.min(Math.max(0, (e.clientY - box.top) / scale), turned()[1])
614
+ });
615
+ const start = toImage(event);
616
+ const crop = currentCrop();
617
+ const moving = !!edit.crop && start.x >= crop.x && start.x <= crop.x + crop.width && start.y >= crop.y && start.y <= crop.y + crop.height;
618
+ stage.setPointerCapture(event.pointerId);
619
+ event.preventDefault();
620
+ const onMove = (e) => {
621
+ const p = toImage(e);
622
+ if (moving) {
623
+ setCrop({ ...crop, x: crop.x + p.x - start.x, y: crop.y + p.y - start.y });
624
+ return;
625
+ }
626
+ const width = Math.abs(p.x - start.x);
627
+ const height = ratio ? width / ratio : Math.abs(p.y - start.y);
628
+ if (width < 4 || height < 4) return;
629
+ setCrop({
630
+ x: p.x < start.x ? start.x - width : start.x,
631
+ y: p.y < start.y ? start.y - height : start.y,
632
+ width,
633
+ height
634
+ });
635
+ };
636
+ const onUp = () => {
637
+ stage.removeEventListener("pointermove", onMove);
638
+ stage.removeEventListener("pointerup", onUp);
639
+ stage.removeEventListener("pointercancel", onUp);
640
+ };
641
+ stage.addEventListener("pointermove", onMove);
642
+ stage.addEventListener("pointerup", onUp);
643
+ stage.addEventListener("pointercancel", onUp);
644
+ });
645
+ const group = (title, ...children) => h("fieldset", { className: "nova-editimage-group" }, h("legend", {}, title), ...children);
646
+ const body = h(
647
+ "div",
648
+ { className: "nova-editimage" },
649
+ tools,
650
+ stage,
651
+ group(
652
+ labels.crop,
653
+ h("label", { className: "nova-editimage-field" }, h("span", {}, labels.shape), shape),
654
+ x.field,
655
+ y.field,
656
+ cw.field,
657
+ ch.field
658
+ ),
659
+ group(
660
+ labels.size,
661
+ ow.field,
662
+ oh.field,
663
+ h("label", { className: "nova-editimage-check" }, keep, h("span", {}, labels.keepRatio))
664
+ ),
665
+ group(labels.colors, brightness.field, contrast.field, saturation.field)
666
+ );
667
+ editor.ui.openDialog({
668
+ title: labels.edit,
669
+ body,
670
+ size: "large",
671
+ submitLabel: labels.apply,
672
+ onSubmit: () => {
673
+ onApply({ ...edit });
674
+ return true;
675
+ }
676
+ });
677
+ fill();
678
+ }
679
+ export {
680
+ LABELS,
681
+ editimage_default2 as default
682
+ };
683
+ //# sourceMappingURL=editimage-GTLFGHYU.js.map