@novaprose/core 0.7.0 → 0.8.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-7KQU7DD3.js +449 -0
  9. package/dist/a11ychecker-7KQU7DD3.js.map +1 -0
  10. package/dist/accordion-ui-FGN3I5UF.js +201 -0
  11. package/dist/accordion-ui-FGN3I5UF.js.map +1 -0
  12. package/dist/advcode-65Z2ELUB.js +51 -0
  13. package/dist/advcode-65Z2ELUB.js.map +1 -0
  14. package/dist/advcode-editor-WIOCY552.js +257 -0
  15. package/dist/advcode-editor-WIOCY552.js.map +1 -0
  16. package/dist/{advlist-5FNKPLUX.js → advlist-CEHE6YXS.js} +10 -7
  17. package/dist/advlist-CEHE6YXS.js.map +1 -0
  18. package/dist/advtable-ui-5CBOPTHW.js +364 -0
  19. package/dist/advtable-ui-5CBOPTHW.js.map +1 -0
  20. package/dist/ai-IRQYZHRK.js +1485 -0
  21. package/dist/ai-IRQYZHRK.js.map +1 -0
  22. package/dist/anchor-ui-NWIIRKGY.js +81 -0
  23. package/dist/anchor-ui-NWIIRKGY.js.map +1 -0
  24. package/dist/autocorrect-6GFLVDPC.js +851 -0
  25. package/dist/autocorrect-6GFLVDPC.js.map +1 -0
  26. package/dist/{autolink-45LTODWB.js → autolink-N427KVQO.js} +11 -8
  27. package/dist/autolink-N427KVQO.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-L7OZ3KLK.js} +7 -7
  31. package/dist/autosave-L7OZ3KLK.js.map +1 -0
  32. package/dist/casechange-5G6RAJ7K.js +201 -0
  33. package/dist/casechange-5G6RAJ7K.js.map +1 -0
  34. package/dist/{charmap-2GC7LF7G.js → charmap-5CBBDWOP.js} +7 -7
  35. package/dist/charmap-5CBBDWOP.js.map +1 -0
  36. package/dist/checklist-HM4VXZKY.js +189 -0
  37. package/dist/checklist-HM4VXZKY.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-4I4AYH2K.js +101 -0
  43. package/dist/chunk-4I4AYH2K.js.map +1 -0
  44. package/dist/{chunk-PVFKXRID.js → chunk-4VPDY3LF.js} +1 -1
  45. package/dist/chunk-4VPDY3LF.js.map +1 -0
  46. package/dist/chunk-53AY5NAF.js +214 -0
  47. package/dist/chunk-53AY5NAF.js.map +1 -0
  48. package/dist/chunk-5VCESSQB.js +137 -0
  49. package/dist/chunk-5VCESSQB.js.map +1 -0
  50. package/dist/chunk-66INZHZ2.js +79 -0
  51. package/dist/chunk-66INZHZ2.js.map +1 -0
  52. package/dist/chunk-6LQM7G4V.js +159 -0
  53. package/dist/chunk-6LQM7G4V.js.map +1 -0
  54. package/dist/chunk-6YSQGFV7.js +893 -0
  55. package/dist/chunk-6YSQGFV7.js.map +1 -0
  56. package/dist/{chunk-T3GY6IVK.js → chunk-AC3YCAX4.js} +71 -9
  57. package/dist/chunk-AC3YCAX4.js.map +1 -0
  58. package/dist/{chunk-5AW2HHG6.js → chunk-ADRPQLZ2.js} +47 -3
  59. package/dist/chunk-ADRPQLZ2.js.map +1 -0
  60. package/dist/chunk-ANE5ASXG.js +26 -0
  61. package/dist/chunk-ANE5ASXG.js.map +1 -0
  62. package/dist/{chunk-Z3ELZ77W.js → chunk-AP2PJFLB.js} +5 -2
  63. package/dist/chunk-AP2PJFLB.js.map +1 -0
  64. package/dist/chunk-AQV6FIKK.js +259 -0
  65. package/dist/chunk-AQV6FIKK.js.map +1 -0
  66. package/dist/chunk-AUQSATWL.js +322 -0
  67. package/dist/chunk-AUQSATWL.js.map +1 -0
  68. package/dist/chunk-C326LHHU.js +143 -0
  69. package/dist/chunk-C326LHHU.js.map +1 -0
  70. package/dist/{chunk-R2UMUCVI.js → chunk-DEYYVZ7O.js} +50 -8
  71. package/dist/chunk-DEYYVZ7O.js.map +1 -0
  72. package/dist/chunk-EOJ5XHKA.js +160 -0
  73. package/dist/chunk-EOJ5XHKA.js.map +1 -0
  74. package/dist/chunk-EXX2S352.js +3642 -0
  75. package/dist/chunk-EXX2S352.js.map +1 -0
  76. package/dist/chunk-FTEA6L2Q.js +47 -0
  77. package/dist/chunk-FTEA6L2Q.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-KWXFL4WS.js → chunk-GHVB6SV4.js} +8 -5
  81. package/dist/chunk-GHVB6SV4.js.map +1 -0
  82. package/dist/chunk-GTLE2HEW.js +108 -0
  83. package/dist/chunk-GTLE2HEW.js.map +1 -0
  84. package/dist/chunk-GXXXLPDQ.js +67 -0
  85. package/dist/chunk-GXXXLPDQ.js.map +1 -0
  86. package/dist/chunk-HC6RMBAD.js +163 -0
  87. package/dist/chunk-HC6RMBAD.js.map +1 -0
  88. package/dist/chunk-HNEAVVBC.js +98 -0
  89. package/dist/chunk-HNEAVVBC.js.map +1 -0
  90. package/dist/chunk-I7Y4KSM2.js +165 -0
  91. package/dist/chunk-I7Y4KSM2.js.map +1 -0
  92. package/dist/chunk-IG2BL4ON.js +127 -0
  93. package/dist/chunk-IG2BL4ON.js.map +1 -0
  94. package/dist/{chunk-KPE3QRPB.js → chunk-J6W2CDRF.js} +16 -315
  95. package/dist/chunk-J6W2CDRF.js.map +1 -0
  96. package/dist/chunk-LVEQBNLX.js +207 -0
  97. package/dist/chunk-LVEQBNLX.js.map +1 -0
  98. package/dist/chunk-MZGNOHSY.js +176 -0
  99. package/dist/chunk-MZGNOHSY.js.map +1 -0
  100. package/dist/chunk-N32H37AJ.js +373 -0
  101. package/dist/chunk-N32H37AJ.js.map +1 -0
  102. package/dist/chunk-NTGEKGXU.js +263 -0
  103. package/dist/chunk-NTGEKGXU.js.map +1 -0
  104. package/dist/chunk-OFHGXYG3.js +140 -0
  105. package/dist/chunk-OFHGXYG3.js.map +1 -0
  106. package/dist/chunk-OOVNE6MB.js +28 -0
  107. package/dist/chunk-OOVNE6MB.js.map +1 -0
  108. package/dist/chunk-OQMMHWMZ.js +7 -0
  109. package/dist/chunk-OQMMHWMZ.js.map +1 -0
  110. package/dist/chunk-P2UU2NLT.js +1149 -0
  111. package/dist/chunk-P2UU2NLT.js.map +1 -0
  112. package/dist/{chunk-JPJVTB45.js → chunk-QU3KXMYT.js} +8 -2
  113. package/dist/chunk-QU3KXMYT.js.map +1 -0
  114. package/dist/chunk-S2XZRKHA.js +29 -0
  115. package/dist/chunk-S2XZRKHA.js.map +1 -0
  116. package/dist/chunk-SCIRO4XK.js +144 -0
  117. package/dist/chunk-SCIRO4XK.js.map +1 -0
  118. package/dist/chunk-T3IRLTKK.js +158 -0
  119. package/dist/chunk-T3IRLTKK.js.map +1 -0
  120. package/dist/chunk-TABIUD2L.js +66 -0
  121. package/dist/chunk-TABIUD2L.js.map +1 -0
  122. package/dist/{chunk-FCMZ7TUQ.js → chunk-TAM2FHKG.js} +172 -43
  123. package/dist/chunk-TAM2FHKG.js.map +1 -0
  124. package/dist/chunk-UTMS2P2K.js +288 -0
  125. package/dist/chunk-UTMS2P2K.js.map +1 -0
  126. package/dist/{chunk-HPLT3XRZ.js → chunk-V7WUHUHM.js} +13 -1
  127. package/dist/chunk-V7WUHUHM.js.map +1 -0
  128. package/dist/{table-SSNABG5W.js → chunk-VK6YF2AA.js} +119 -61
  129. package/dist/chunk-VK6YF2AA.js.map +1 -0
  130. package/dist/chunk-WAOU5NGN.js +430 -0
  131. package/dist/chunk-WAOU5NGN.js.map +1 -0
  132. package/dist/chunk-XIH4SCO6.js +112 -0
  133. package/dist/chunk-XIH4SCO6.js.map +1 -0
  134. package/dist/chunk-XR7CY4NI.js +11 -0
  135. package/dist/chunk-XR7CY4NI.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-YDPZCVXS.js +923 -0
  139. package/dist/chunk-YDPZCVXS.js.map +1 -0
  140. package/dist/chunk-YG5V7POU.js +137 -0
  141. package/dist/chunk-YG5V7POU.js.map +1 -0
  142. package/dist/chunk-YVSUR7E5.js +151 -0
  143. package/dist/chunk-YVSUR7E5.js.map +1 -0
  144. package/dist/codesample-GHWIC7PT.js +546 -0
  145. package/dist/codesample-GHWIC7PT.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-EGQKGDZA.js} +13 -10
  149. package/dist/directionality-EGQKGDZA.js.map +1 -0
  150. package/dist/document-0ft41E6d.d.ts +39 -0
  151. package/dist/document-IQqDDT4v.d.cts +39 -0
  152. package/dist/docx.cjs +23518 -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 +1821 -0
  157. package/dist/docx.js.map +1 -0
  158. package/dist/draghandle-U6CYZHPA.js +389 -0
  159. package/dist/draghandle-U6CYZHPA.js.map +1 -0
  160. package/dist/editimage-5EWPSM22.js +683 -0
  161. package/dist/editimage-5EWPSM22.js.map +1 -0
  162. package/dist/editor-BCMxe1M4.d.cts +2888 -0
  163. package/dist/editor-Dmtwjw2u.d.ts +2888 -0
  164. package/dist/email-ELNMEQ6E.js +177 -0
  165. package/dist/email-ELNMEQ6E.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-EGHNZKSA.js} +7 -7
  173. package/dist/emoticons-EGHNZKSA.js.map +1 -0
  174. package/dist/exportpdf-4P7X3NY2.js +91 -0
  175. package/dist/exportpdf-4P7X3NY2.js.map +1 -0
  176. package/dist/exportword-JFJ3KTYZ.js +16 -0
  177. package/dist/exportword-JFJ3KTYZ.js.map +1 -0
  178. package/dist/footnotes-ui-FV6QRGDA.js +449 -0
  179. package/dist/footnotes-ui-FV6QRGDA.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-IEXX27OJ.js +209 -0
  183. package/dist/formatpainter-IEXX27OJ.js.map +1 -0
  184. package/dist/fullpagehtml-ui-RE4C2NO5.js +220 -0
  185. package/dist/fullpagehtml-ui-RE4C2NO5.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 +19 -17
  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 +24 -20
  193. package/dist/html-rules.js.map +1 -1
  194. package/dist/i18n/de.cjs +346 -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 +346 -0
  199. package/dist/i18n/de.js.map +1 -1
  200. package/dist/i18n/es.cjs +346 -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 +346 -0
  205. package/dist/i18n/es.js.map +1 -1
  206. package/dist/i18n/fr.cjs +346 -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 +346 -0
  211. package/dist/i18n/fr.js.map +1 -1
  212. package/dist/i18n/it.cjs +346 -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 +346 -0
  217. package/dist/i18n/it.js.map +1 -1
  218. package/dist/i18n/pt-BR.cjs +346 -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 +346 -0
  223. package/dist/i18n/pt-BR.js.map +1 -1
  224. package/dist/i18n/ru.cjs +346 -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 +346 -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-D7Z6RXGQ.js +73 -0
  233. package/dist/importword-D7Z6RXGQ.js.map +1 -0
  234. package/dist/{index-C603bU6r.d.ts → index-CZ9yDvmQ.d.cts} +36 -17
  235. package/dist/{index-C603bU6r.d.cts → index-CZ9yDvmQ.d.ts} +36 -17
  236. package/dist/index.cjs +28858 -10442
  237. package/dist/index.cjs.map +1 -1
  238. package/dist/index.d.cts +138 -64
  239. package/dist/index.d.ts +138 -64
  240. package/dist/index.js +199 -1411
  241. package/dist/index.js.map +1 -1
  242. package/dist/{insertdatetime-CRO7TJAQ.js → insertdatetime-YW2VHYZH.js} +7 -7
  243. package/dist/insertdatetime-YW2VHYZH.js.map +1 -0
  244. package/dist/linkchecker-3S3MCPOS.js +287 -0
  245. package/dist/linkchecker-3S3MCPOS.js.map +1 -0
  246. package/dist/markdown-26O3N3T2.js +136 -0
  247. package/dist/markdown-26O3N3T2.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-RUTCHTRY.js +157 -0
  255. package/dist/math-ui-RUTCHTRY.js.map +1 -0
  256. package/dist/media-ui-36TE3CJD.js +123 -0
  257. package/dist/media-ui-36TE3CJD.js.map +1 -0
  258. package/dist/mediaembed-ui-ZNTGZ2SQ.js +207 -0
  259. package/dist/mediaembed-ui-ZNTGZ2SQ.js.map +1 -0
  260. package/dist/mentions-ui-O4IPWQT4.js +58 -0
  261. package/dist/mentions-ui-O4IPWQT4.js.map +1 -0
  262. package/dist/mergetags-ui-HS3Q2R36.js +73 -0
  263. package/dist/mergetags-ui-HS3Q2R36.js.map +1 -0
  264. package/dist/{nonbreaking-66LFZV2W.js → nonbreaking-GYRUH4UO.js} +7 -7
  265. package/dist/nonbreaking-GYRUH4UO.js.map +1 -0
  266. package/dist/pagebreak-ui-I4ZPYK3U.js +50 -0
  267. package/dist/pagebreak-ui-I4ZPYK3U.js.map +1 -0
  268. package/dist/pageembed-ui-WOY6VWRJ.js +172 -0
  269. package/dist/pageembed-ui-WOY6VWRJ.js.map +1 -0
  270. package/dist/pagelayout-ui-Y2IM7FJQ.js +236 -0
  271. package/dist/pagelayout-ui-Y2IM7FJQ.js.map +1 -0
  272. package/dist/{paste-office-F3QW4WWO.js → paste-office-3A6KWKCV.js} +82 -2
  273. package/dist/paste-office-3A6KWKCV.js.map +1 -0
  274. package/dist/permanentpen-6D5LLKFX.js +206 -0
  275. package/dist/permanentpen-6D5LLKFX.js.map +1 -0
  276. package/dist/print-MZMLQIQX.js +178 -0
  277. package/dist/print-MZMLQIQX.js.map +1 -0
  278. package/dist/{quickbars-7E2QRS7J.js → quickbars-UZ2Q67TX.js} +20 -12
  279. package/dist/quickbars-UZ2Q67TX.js.map +1 -0
  280. package/dist/{revisionhistory-DXE7KU4R.js → revisionhistory-ACRB23HL.js} +42 -153
  281. package/dist/revisionhistory-ACRB23HL.js.map +1 -0
  282. package/dist/save-72ZLF6AO.js +120 -0
  283. package/dist/save-72ZLF6AO.js.map +1 -0
  284. package/dist/search-bar-HTZQNPD3.js +212 -0
  285. package/dist/search-bar-HTZQNPD3.js.map +1 -0
  286. package/dist/spellchecker-DJ7SP5JY.js +474 -0
  287. package/dist/spellchecker-DJ7SP5JY.js.map +1 -0
  288. package/dist/suggestions-panel-RJXC4LCM.js +596 -0
  289. package/dist/suggestions-panel-RJXC4LCM.js.map +1 -0
  290. package/dist/suggestions-ui-PODMNH7D.js +395 -0
  291. package/dist/suggestions-ui-PODMNH7D.js.map +1 -0
  292. package/dist/table-OBHE465Y.js +54 -0
  293. package/dist/table-OBHE465Y.js.map +1 -0
  294. package/dist/table-dialogs-UMIIZQYE.js +119 -0
  295. package/dist/table-dialogs-UMIIZQYE.js.map +1 -0
  296. package/dist/tableofcontents-ui-U2PYNPX6.js +167 -0
  297. package/dist/tableofcontents-ui-U2PYNPX6.js.map +1 -0
  298. package/dist/template-YYC2MGVH.js +278 -0
  299. package/dist/template-YYC2MGVH.js.map +1 -0
  300. package/dist/typography-EQUXUXIN.js +399 -0
  301. package/dist/typography-EQUXUXIN.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-O5QW7ZDT.js} +7 -7
  309. package/dist/visualblocks-O5QW7ZDT.js.map +1 -0
  310. package/dist/visualchars-UQFRWQPE.js +134 -0
  311. package/dist/visualchars-UQFRWQPE.js.map +1 -0
  312. package/package.json +53 -3
  313. package/src/style.css +320 -544
  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,851 @@
1
+ import {
2
+ pickLabels
3
+ } from "./chunk-DEYYVZ7O.js";
4
+ import {
5
+ definePlugin
6
+ } from "./chunk-V7WUHUHM.js";
7
+ import "./chunk-QU3KXMYT.js";
8
+
9
+ // src/plugins/autocorrect.ts
10
+ import { closeHistory } from "prosemirror-history";
11
+ import { Plugin, PluginKey } from "prosemirror-state";
12
+ import { Decoration, DecorationSet } from "prosemirror-view";
13
+
14
+ // nova-raw-css:/home/runner/work/novaprose/novaprose/packages/core/src/plugins/autocorrect.css?raw
15
+ var autocorrect_default = ".nova-autocorrected{text-decoration:underline dotted var(--nova-accent);text-decoration-thickness:2px;text-underline-offset:3px}@media(forced-colors:active){.nova-autocorrected{text-decoration-color:Highlight}}";
16
+
17
+ // src/plugins/autocorrect-rules.ts
18
+ var ENGLISH_LIST = {
19
+ // Letters swapped while typing fast.
20
+ teh: "the",
21
+ hte: "the",
22
+ tje: "the",
23
+ tyhe: "the",
24
+ adn: "and",
25
+ taht: "that",
26
+ thta: "that",
27
+ waht: "what",
28
+ whta: "what",
29
+ wiht: "with",
30
+ wtih: "with",
31
+ thsi: "this",
32
+ tihs: "this",
33
+ htis: "this",
34
+ thier: "their",
35
+ theri: "their",
36
+ jsut: "just",
37
+ konw: "know",
38
+ knwo: "know",
39
+ nkow: "know",
40
+ wnat: "want",
41
+ watn: "want",
42
+ woudl: "would",
43
+ wuold: "would",
44
+ owuld: "would",
45
+ coudl: "could",
46
+ cuold: "could",
47
+ shoudl: "should",
48
+ shuold: "should",
49
+ becuase: "because",
50
+ becasue: "because",
51
+ beacuse: "because",
52
+ bceause: "because",
53
+ abotu: "about",
54
+ aobut: "about",
55
+ baout: "about",
56
+ abuot: "about",
57
+ yuo: "you",
58
+ oyu: "you",
59
+ yuor: "your",
60
+ yoru: "your",
61
+ frmo: "from",
62
+ thne: "then",
63
+ tehn: "then",
64
+ tehm: "them",
65
+ thme: "them",
66
+ htem: "them",
67
+ wehn: "when",
68
+ whne: "when",
69
+ hwen: "when",
70
+ whihc: "which",
71
+ whcih: "which",
72
+ wihch: "which",
73
+ agian: "again",
74
+ aginst: "against",
75
+ againt: "against",
76
+ alwasy: "always",
77
+ alwyas: "always",
78
+ anohter: "another",
79
+ anwser: "answer",
80
+ asnwer: "answer",
81
+ befroe: "before",
82
+ beofre: "before",
83
+ brigde: "bridge",
84
+ certian: "certain",
85
+ chnage: "change",
86
+ comapny: "company",
87
+ compnay: "company",
88
+ comptuer: "computer",
89
+ contian: "contain",
90
+ doign: "doing",
91
+ eariler: "earlier",
92
+ everythign: "everything",
93
+ exmaple: "example",
94
+ exapmle: "example",
95
+ fianlly: "finally",
96
+ fisrt: "first",
97
+ gerat: "great",
98
+ goign: "going",
99
+ gonig: "going",
100
+ haev: "have",
101
+ hvae: "have",
102
+ ahve: "have",
103
+ hting: "thing",
104
+ htink: "think",
105
+ idae: "idea",
106
+ improtant: "important",
107
+ importnat: "important",
108
+ informatoin: "information",
109
+ langauge: "language",
110
+ liek: "like",
111
+ likley: "likely",
112
+ littel: "little",
113
+ lookign: "looking",
114
+ mkae: "make",
115
+ mroe: "more",
116
+ mysefl: "myself",
117
+ ohter: "other",
118
+ otehr: "other",
119
+ onyl: "only",
120
+ olny: "only",
121
+ peopel: "people",
122
+ poeple: "people",
123
+ pepole: "people",
124
+ perhpas: "perhaps",
125
+ porblem: "problem",
126
+ probelm: "problem",
127
+ problme: "problem",
128
+ questoin: "question",
129
+ raelly: "really",
130
+ rememebr: "remember",
131
+ restuarant: "restaurant",
132
+ rigth: "right",
133
+ rihgt: "right",
134
+ smae: "same",
135
+ soem: "some",
136
+ somethign: "something",
137
+ sotry: "story",
138
+ studnet: "student",
139
+ systme: "system",
140
+ tahn: "than",
141
+ thna: "than",
142
+ thign: "thing",
143
+ thigns: "things",
144
+ thikn: "think",
145
+ thoguht: "thought",
146
+ thougth: "thought",
147
+ throuhg: "through",
148
+ tiem: "time",
149
+ togehter: "together",
150
+ tonigth: "tonight",
151
+ udpate: "update",
152
+ uesd: "used",
153
+ veyr: "very",
154
+ vrey: "very",
155
+ wokr: "work",
156
+ wrok: "work",
157
+ wrogn: "wrong",
158
+ yera: "year",
159
+ yeras: "years",
160
+ // Letters missing, doubled or out of order.
161
+ accomodate: "accommodate",
162
+ accomodation: "accommodation",
163
+ acommodate: "accommodate",
164
+ accross: "across",
165
+ acess: "access",
166
+ acheive: "achieve",
167
+ acheived: "achieved",
168
+ acheivement: "achievement",
169
+ adress: "address",
170
+ allready: "already",
171
+ alredy: "already",
172
+ allways: "always",
173
+ apparant: "apparent",
174
+ apparantly: "apparently",
175
+ appearence: "appearance",
176
+ arguement: "argument",
177
+ basicly: "basically",
178
+ beatiful: "beautiful",
179
+ beautifull: "beautiful",
180
+ begining: "beginning",
181
+ beggining: "beginning",
182
+ beleive: "believe",
183
+ belive: "believe",
184
+ beleif: "belief",
185
+ buisness: "business",
186
+ bussiness: "business",
187
+ carribean: "Caribbean",
188
+ cemetary: "cemetery",
189
+ changable: "changeable",
190
+ cheif: "chief",
191
+ choosen: "chosen",
192
+ cieling: "ceiling",
193
+ collegue: "colleague",
194
+ comming: "coming",
195
+ commited: "committed",
196
+ commitee: "committee",
197
+ comittee: "committee",
198
+ completly: "completely",
199
+ concensus: "consensus",
200
+ concieve: "conceive",
201
+ concious: "conscious",
202
+ decieve: "deceive",
203
+ definately: "definitely",
204
+ definatly: "definitely",
205
+ definetly: "definitely",
206
+ definitly: "definitely",
207
+ diffrent: "different",
208
+ differnt: "different",
209
+ dilemna: "dilemma",
210
+ dissapear: "disappear",
211
+ dissapoint: "disappoint",
212
+ dissapointed: "disappointed",
213
+ embarass: "embarrass",
214
+ embarassed: "embarrassed",
215
+ embarassing: "embarrassing",
216
+ enviroment: "environment",
217
+ enviromental: "environmental",
218
+ excercise: "exercise",
219
+ exersize: "exercise",
220
+ existance: "existence",
221
+ expecially: "especially",
222
+ experiance: "experience",
223
+ evrything: "everything",
224
+ familar: "familiar",
225
+ finaly: "finally",
226
+ flourescent: "fluorescent",
227
+ folowing: "following",
228
+ follwing: "following",
229
+ foriegn: "foreign",
230
+ fourty: "forty",
231
+ foward: "forward",
232
+ freind: "friend",
233
+ freinds: "friends",
234
+ feild: "field",
235
+ garantee: "guarantee",
236
+ guarentee: "guarantee",
237
+ gaurd: "guard",
238
+ geting: "getting",
239
+ goverment: "government",
240
+ grammer: "grammar",
241
+ hapen: "happen",
242
+ hapened: "happened",
243
+ happend: "happened",
244
+ harrass: "harass",
245
+ harrased: "harassed",
246
+ helpfull: "helpful",
247
+ hieght: "height",
248
+ humourous: "humorous",
249
+ ignorence: "ignorance",
250
+ imediately: "immediately",
251
+ immediatly: "immediately",
252
+ immediatley: "immediately",
253
+ imporant: "important",
254
+ independant: "independent",
255
+ infomation: "information",
256
+ interupt: "interrupt",
257
+ intresting: "interesting",
258
+ intrest: "interest",
259
+ knowlege: "knowledge",
260
+ laguage: "language",
261
+ lenght: "length",
262
+ liason: "liaison",
263
+ libary: "library",
264
+ liesure: "leisure",
265
+ maintainance: "maintenance",
266
+ maintenence: "maintenance",
267
+ makeing: "making",
268
+ millenium: "millennium",
269
+ minature: "miniature",
270
+ mischievious: "mischievous",
271
+ mispell: "misspell",
272
+ mispelled: "misspelled",
273
+ necesarily: "necessarily",
274
+ necesary: "necessary",
275
+ neccesary: "necessary",
276
+ neccessary: "necessary",
277
+ neice: "niece",
278
+ nieghbor: "neighbor",
279
+ nieghbour: "neighbour",
280
+ noticable: "noticeable",
281
+ occassion: "occasion",
282
+ occassionally: "occasionally",
283
+ ocassion: "occasion",
284
+ occured: "occurred",
285
+ occurence: "occurrence",
286
+ occurance: "occurrence",
287
+ occuring: "occurring",
288
+ oportunity: "opportunity",
289
+ oppurtunity: "opportunity",
290
+ paralel: "parallel",
291
+ parliment: "parliament",
292
+ peice: "piece",
293
+ percieve: "perceive",
294
+ posess: "possess",
295
+ posession: "possession",
296
+ potatos: "potatoes",
297
+ preceeding: "preceding",
298
+ prefered: "preferred",
299
+ presense: "presence",
300
+ privelege: "privilege",
301
+ priviledge: "privilege",
302
+ probaly: "probably",
303
+ probly: "probably",
304
+ propably: "probably",
305
+ proffesional: "professional",
306
+ progam: "program",
307
+ pronounciation: "pronunciation",
308
+ publically: "publicly",
309
+ questionaire: "questionnaire",
310
+ realy: "really",
311
+ reciept: "receipt",
312
+ recieve: "receive",
313
+ recieved: "received",
314
+ recieving: "receiving",
315
+ recomend: "recommend",
316
+ reccomend: "recommend",
317
+ reccommend: "recommend",
318
+ recomendation: "recommendation",
319
+ recurrance: "recurrence",
320
+ refered: "referred",
321
+ refering: "referring",
322
+ relevent: "relevant",
323
+ religous: "religious",
324
+ remeber: "remember",
325
+ rember: "remember",
326
+ repitition: "repetition",
327
+ resistence: "resistance",
328
+ resturant: "restaurant",
329
+ rythm: "rhythm",
330
+ saftey: "safety",
331
+ scedule: "schedule",
332
+ schedual: "schedule",
333
+ seige: "siege",
334
+ sentance: "sentence",
335
+ seperate: "separate",
336
+ seperated: "separated",
337
+ seperately: "separately",
338
+ sieze: "seize",
339
+ similiar: "similar",
340
+ simliar: "similar",
341
+ sincerly: "sincerely",
342
+ somthing: "something",
343
+ speach: "speech",
344
+ stoped: "stopped",
345
+ strenght: "strength",
346
+ succeded: "succeeded",
347
+ succesful: "successful",
348
+ succesfully: "successfully",
349
+ sucessful: "successful",
350
+ successfull: "successful",
351
+ sucess: "success",
352
+ sucessfully: "successfully",
353
+ supose: "suppose",
354
+ suprise: "surprise",
355
+ sytem: "system",
356
+ temperture: "temperature",
357
+ tendancy: "tendency",
358
+ theif: "thief",
359
+ threshhold: "threshold",
360
+ toghether: "together",
361
+ tommorow: "tomorrow",
362
+ tomorow: "tomorrow",
363
+ tommorrow: "tomorrow",
364
+ tounge: "tongue",
365
+ truely: "truly",
366
+ twelth: "twelfth",
367
+ tyrany: "tyranny",
368
+ unforseen: "unforeseen",
369
+ unfortunatly: "unfortunately",
370
+ unfortunatley: "unfortunately",
371
+ unneccessary: "unnecessary",
372
+ untill: "until",
373
+ upate: "update",
374
+ usally: "usually",
375
+ usualy: "usually",
376
+ vaccum: "vacuum",
377
+ vacume: "vacuum",
378
+ vehical: "vehicle",
379
+ visable: "visible",
380
+ wierd: "weird",
381
+ withold: "withhold",
382
+ writen: "written",
383
+ writting: "writing",
384
+ yeild: "yield",
385
+ // Two words written as one.
386
+ alot: "a lot",
387
+ aswell: "as well",
388
+ atleast: "at least",
389
+ eachother: "each other",
390
+ everytime: "every time",
391
+ infact: "in fact",
392
+ inspite: "in spite",
393
+ noone: "no one",
394
+ ofcourse: "of course",
395
+ thankyou: "thank you",
396
+ // Apostrophes left out (only where the word without one doesn't exist).
397
+ arent: "aren't",
398
+ couldnt: "couldn't",
399
+ couldve: "could've",
400
+ didnt: "didn't",
401
+ doesnt: "doesn't",
402
+ dosent: "doesn't",
403
+ hadnt: "hadn't",
404
+ hasnt: "hasn't",
405
+ havent: "haven't",
406
+ heres: "here's",
407
+ isnt: "isn't",
408
+ itll: "it'll",
409
+ mustnt: "mustn't",
410
+ neednt: "needn't",
411
+ shes: "she's",
412
+ shouldnt: "shouldn't",
413
+ shouldve: "should've",
414
+ thatll: "that'll",
415
+ thats: "that's",
416
+ theres: "there's",
417
+ theyd: "they'd",
418
+ theyll: "they'll",
419
+ theyre: "they're",
420
+ theyve: "they've",
421
+ wasnt: "wasn't",
422
+ werent: "weren't",
423
+ weve: "we've",
424
+ whats: "what's",
425
+ wheres: "where's",
426
+ wouldnt: "wouldn't",
427
+ wouldve: "would've",
428
+ youd: "you'd",
429
+ youll: "you'll",
430
+ youre: "you're",
431
+ youve: "you've",
432
+ "dosen't": "doesn't",
433
+ "coudn't": "couldn't",
434
+ // The pronoun I, and names of days and months (not "may", "march" or "august": they are words too).
435
+ i: "I",
436
+ ive: "I've",
437
+ "i'm": "I'm",
438
+ "i've": "I've",
439
+ "i'll": "I'll",
440
+ "i'd": "I'd",
441
+ monday: "Monday",
442
+ tuesday: "Tuesday",
443
+ wednesday: "Wednesday",
444
+ thursday: "Thursday",
445
+ friday: "Friday",
446
+ saturday: "Saturday",
447
+ sunday: "Sunday",
448
+ january: "January",
449
+ february: "February",
450
+ april: "April",
451
+ june: "June",
452
+ july: "July",
453
+ september: "September",
454
+ october: "October",
455
+ november: "November",
456
+ december: "December"
457
+ };
458
+ var ENGLISH = new Map(Object.entries(ENGLISH_LIST));
459
+ var TWO_CAPITALS_KEPT = /* @__PURE__ */ new Set([
460
+ "MHz",
461
+ "GHz",
462
+ "THz",
463
+ "KHz",
464
+ "MBps",
465
+ "KBps",
466
+ "GBps",
467
+ "TBps",
468
+ "MSc",
469
+ "BSc",
470
+ "DSc",
471
+ "MSci",
472
+ "OAuth",
473
+ "IPsec",
474
+ "VMware",
475
+ "CMake",
476
+ "MPlayer",
477
+ "DBeaver",
478
+ "GHub",
479
+ "PEFTs",
480
+ "SQLite"
481
+ ]);
482
+ var ABBREVIATIONS = new Set(
483
+ "mr mrs ms dr prof sr jr st vs etc cf al approx incl excl no nos fig figs vol vols ch sec p pp ed eds dept est inc ltd co corp jan feb mar apr jun jul aug sep sept oct nov dec mon tue tues wed thu thur thurs fri sat sun min max avg tel ext ca resp ref nr bzw usw vgl ggf evtl sra srta pag pags mme mlle".split(" ")
484
+ );
485
+ var WORD = "([\\p{L}\\p{M}]+(?:['\u2019][\\p{L}\\p{M}]+)*)";
486
+ var ENDS = `[\\s.,;:!?\u2026)\\]}"'\u201D\u2019\xBB]`;
487
+ var WORD_THEN_END = new RegExp(`${WORD}(${ENDS}{1,4})$`, "u");
488
+ var WORD_AT_END = new RegExp(`${WORD}$`, "u");
489
+ var BEFORE_WORD = /[\s(«"'“‘„¿¡—–]/u;
490
+ var SENTENCE_END = /([.!?]+)[)\]"'”’»]*\s+[(«"'“‘„¿¡]*$/u;
491
+ var BLOCK_START = /^[\s(«"'“‘„¿¡]*$/u;
492
+ function wordKey(word) {
493
+ return word.toLowerCase().replace(/’/g, "'");
494
+ }
495
+ function matchCase(typed, target) {
496
+ const letters = typed.replace(/[^\p{L}]/gu, "");
497
+ if (letters.length > 1 && letters === letters.toUpperCase() && letters !== letters.toLowerCase())
498
+ return target.toUpperCase();
499
+ const first = Array.from(typed)[0] ?? "";
500
+ if (first !== first.toLowerCase()) return capitalizeFirst(target);
501
+ return target;
502
+ }
503
+ function capitalizeFirst(word) {
504
+ const [first = "", ...rest] = Array.from(word);
505
+ return first.toUpperCase() + rest.join("");
506
+ }
507
+ function twoCapitals(word) {
508
+ if (!/^\p{Lu}\p{Lu}\p{Ll}+$/u.test(word)) return false;
509
+ const rest = Array.from(word).slice(2).join("");
510
+ return rest !== "s" && rest !== "es" && !TWO_CAPITALS_KEPT.has(word);
511
+ }
512
+ function canCapitalize(word) {
513
+ const first = Array.from(word)[0] ?? "";
514
+ return first !== first.toUpperCase() && word === word.toLowerCase();
515
+ }
516
+ function sentenceStart(before, blockStart, learned) {
517
+ if (BLOCK_START.test(before)) return blockStart ? {} : null;
518
+ const end = SENTENCE_END.exec(before);
519
+ if (!end) return null;
520
+ const marks = end[1];
521
+ if (marks.includes("!") || marks.includes("?")) return {};
522
+ if (marks.length > 1) return null;
523
+ const token = /(\S*)$/u.exec(before.slice(0, end.index))[1].replace(/^[(«"'“‘„¿¡]+/u, "");
524
+ if (!token || token.includes(".") || Array.from(token).length === 1) return null;
525
+ const key2 = token.toLowerCase();
526
+ if (ABBREVIATIONS.has(key2) || learned.has(key2)) return null;
527
+ return { after: token };
528
+ }
529
+ function findCorrection(text, settings, { blockStart = true, trailer = true } = {}) {
530
+ if (!settings.autocorrect && !settings.capitalize) return null;
531
+ const match = (trailer ? WORD_THEN_END : WORD_AT_END).exec(text);
532
+ if (!match) return null;
533
+ const word = match[1];
534
+ const start = match.index;
535
+ if (start > 0 && !BEFORE_WORD.test(text[start - 1])) return null;
536
+ const key2 = wordKey(word);
537
+ if (settings.ignore.has(key2)) return null;
538
+ let replacement = word;
539
+ let kind = null;
540
+ let after;
541
+ const shouted = Array.from(word).length > 1 && word === word.toUpperCase() && word !== key2;
542
+ if (settings.autocorrect && !shouted) {
543
+ const listed = settings.replacements.get(key2) ?? (settings.english ? ENGLISH.get(key2) : void 0);
544
+ if (listed !== void 0) {
545
+ const fixed = apostrophes(matchCase(word, listed), word, text);
546
+ if (fixed !== word) {
547
+ replacement = fixed;
548
+ kind = "typo";
549
+ }
550
+ } else if (twoCapitals(word)) {
551
+ replacement = Array.from(word)[0] + Array.from(word).slice(1).join("").toLowerCase();
552
+ kind = "capitals";
553
+ }
554
+ }
555
+ if (settings.capitalize && canCapitalize(replacement)) {
556
+ const sentence = sentenceStart(text.slice(0, start), blockStart, settings.abbreviations);
557
+ if (sentence) {
558
+ replacement = capitalizeFirst(replacement);
559
+ kind ??= "sentence";
560
+ after = sentence.after;
561
+ }
562
+ }
563
+ if (!kind || replacement === word) return null;
564
+ return { start, end: start + word.length, word, replacement, kind, ...after ? { after } : {} };
565
+ }
566
+ function apostrophes(replacement, word, text) {
567
+ if (!replacement.includes("'")) return replacement;
568
+ const curly = word.includes("\u2019") || !word.includes("'") && text.includes("\u2019");
569
+ return curly ? replacement.replace(/'/g, "\u2019") : replacement;
570
+ }
571
+
572
+ // src/plugins/autocorrect.ts
573
+ var LABELS = {
574
+ en: {
575
+ title: "Autocorrect",
576
+ spelling: "Correct typos as you type",
577
+ capitalize: "Capitalize the first letter of sentences",
578
+ changed: "{word} changed to {replacement}",
579
+ reverted: "{word} put back"
580
+ }
581
+ };
582
+ var key = new PluginKey("nova-autocorrect");
583
+ var STORAGE = "novaprose-autocorrect";
584
+ var leafText = (node) => node.type.name === "hard_break" ? "\n" : "\uFFFC";
585
+ var CONTEXT = 400;
586
+ var ENDS_WORD = /[\s.,;:!?…)\]}"'”’»]$/u;
587
+ var ICON = '<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"><path d="m3 18 5-13 5 13"/><path d="M5 13h6"/><path d="m19 4-3 7h4l-3 7"/></svg>';
588
+ var editors = /* @__PURE__ */ new WeakMap();
589
+ var autocorrect_default2 = definePlugin({
590
+ name: "autocorrect",
591
+ // A button to switch it off, with the capitals option in its menu.
592
+ toolbar: "autocorrect",
593
+ prosemirrorPlugins: (editor) => {
594
+ const ac = editors.get(editor) ?? createAutocorrect(editor);
595
+ editors.set(editor, ac);
596
+ return [ac.plugin];
597
+ },
598
+ setup(editor) {
599
+ const ac = editors.get(editor);
600
+ const { labels } = ac;
601
+ editor.ui.addStyles("nova-autocorrect", autocorrect_default);
602
+ const toggles = () => [
603
+ {
604
+ id: "autocorrect",
605
+ label: labels.spelling,
606
+ checkbox: true,
607
+ active: ac.settings.autocorrect,
608
+ onSelect: () => ac.set("autocorrect", !ac.settings.autocorrect)
609
+ },
610
+ {
611
+ id: "capitalize",
612
+ label: labels.capitalize,
613
+ checkbox: true,
614
+ active: ac.settings.capitalize,
615
+ onSelect: () => ac.set("capitalize", !ac.settings.capitalize)
616
+ }
617
+ ];
618
+ editor.ui.registry.addSplitButton("autocorrect", {
619
+ icon: ICON,
620
+ tooltip: labels.title,
621
+ isActive: () => ac.settings.autocorrect,
622
+ onAction: () => ac.set("autocorrect", !ac.settings.autocorrect),
623
+ items: toggles
624
+ });
625
+ editor.ui.registry.addMenuItem("autocorrect", {
626
+ text: labels.spelling,
627
+ icon: ICON,
628
+ isActive: () => ac.settings.autocorrect,
629
+ onAction: () => ac.set("autocorrect", !ac.settings.autocorrect)
630
+ });
631
+ editor.ui.registry.addMenuItem("capitalization", {
632
+ text: labels.capitalize,
633
+ isActive: () => ac.settings.capitalize,
634
+ onAction: () => ac.set("capitalize", !ac.settings.capitalize)
635
+ });
636
+ }
637
+ });
638
+ function createAutocorrect(editor) {
639
+ const options = editor.options.pluginOptions?.autocorrect ?? {};
640
+ const labels = pickLabels(editor, "autocorrect", LABELS);
641
+ const remember = options.remember !== false;
642
+ const saved = remember ? readSaved() : {};
643
+ const settings = {
644
+ autocorrect: saved.autocorrect ?? options.autocorrect !== false,
645
+ capitalize: saved.capitalize ?? options.capitalize === true
646
+ };
647
+ const replacements = /* @__PURE__ */ new Map();
648
+ if (options.replacements && typeof options.replacements === "object") {
649
+ for (const [typo, right] of Object.entries(options.replacements)) {
650
+ if (typeof right === "string" && right && typo.trim()) replacements.set(wordKey(typo), right);
651
+ }
652
+ }
653
+ const spellIgnore = editor.options.pluginOptions?.spellchecker?.ignore;
654
+ const ignore = new Set(
655
+ [options.ignore, spellIgnore].flatMap((list) => Array.isArray(list) ? list : []).filter((word) => typeof word === "string").map(wordKey)
656
+ );
657
+ const abbreviations = /* @__PURE__ */ new Set();
658
+ let pending = null;
659
+ const english = () => {
660
+ const spell = editor.options.pluginOptions?.spellchecker?.language;
661
+ let language = options.language ?? (typeof spell === "string" && spell !== "auto" ? spell : "");
662
+ if (!language) {
663
+ const dom = editor.view?.dom;
664
+ language = dom?.closest("[lang]")?.getAttribute("lang") ?? dom?.ownerDocument.documentElement.lang ?? "";
665
+ }
666
+ return !language || /^en\b/i.test(language);
667
+ };
668
+ const rules = () => ({
669
+ autocorrect: settings.autocorrect,
670
+ capitalize: settings.capitalize,
671
+ replacements,
672
+ english: options.builtInList !== false && english(),
673
+ ignore,
674
+ abbreviations
675
+ });
676
+ const correct = (view, trailer) => {
677
+ if (view.isDestroyed || !editor.isEditable()) return;
678
+ const { state } = view;
679
+ const { selection } = state;
680
+ if (!selection.empty) return;
681
+ const $head = selection.$head;
682
+ const block = $head.parent;
683
+ if (!block.isTextblock || block.type.spec.code) return;
684
+ const offset = $head.parentOffset;
685
+ const start = Math.max(0, offset - CONTEXT);
686
+ const text = block.textBetween(start, offset, void 0, leafText);
687
+ const found = findCorrection(text, rules(), { blockStart: start === 0, trailer });
688
+ if (!found) return;
689
+ const from = $head.pos - (text.length - found.start);
690
+ const to = from + found.word.length;
691
+ if (from < $head.start() || state.doc.textBetween(from, to) !== found.word) return;
692
+ let code = false;
693
+ state.doc.nodesBetween(from, to, (node) => {
694
+ if (node.isInline && node.marks.some((mark) => mark.type.spec.code)) code = true;
695
+ });
696
+ if (code) return;
697
+ const tr = replaceChanged(state.tr, from, found.word, found.replacement);
698
+ closeHistory(tr);
699
+ const last = {
700
+ from,
701
+ to: from + found.replacement.length,
702
+ word: found.word,
703
+ replacement: found.replacement,
704
+ kind: found.kind,
705
+ ...found.after ? { after: found.after } : {},
706
+ cursor: tr.selection.head
707
+ };
708
+ view.dispatch(tr.setMeta(key, last));
709
+ view.dispatch(closeHistory(view.state.tr));
710
+ editor.ui.announce(
711
+ labels.changed.replace("{word}", found.word).replace("{replacement}", found.replacement)
712
+ );
713
+ notify(last, false);
714
+ };
715
+ const revert = (view) => {
716
+ const last = key.getState(view.state);
717
+ const { selection, doc } = view.state;
718
+ if (!last || !selection.empty || selection.head !== last.cursor) return false;
719
+ if (doc.textBetween(last.from, last.to) !== last.replacement) return false;
720
+ view.dispatch(
721
+ replaceChanged(view.state.tr, last.from, last.replacement, last.word).setMeta(key, null).scrollIntoView()
722
+ );
723
+ if (last.kind === "sentence" && last.after) abbreviations.add(last.after.toLowerCase());
724
+ else ignore.add(wordKey(last.word));
725
+ editor.ui.announce(labels.reverted.replace("{word}", last.word));
726
+ notify(last, true);
727
+ return true;
728
+ };
729
+ const notify = (last, reverted) => {
730
+ if (typeof options.onCorrect !== "function") return;
731
+ try {
732
+ options.onCorrect({
733
+ word: last.word,
734
+ replacement: last.replacement,
735
+ kind: last.kind,
736
+ reverted
737
+ });
738
+ } catch (error) {
739
+ console.error("[novaprose] autocorrect onCorrect failed", error);
740
+ }
741
+ };
742
+ const plugin = new Plugin({
743
+ key,
744
+ state: {
745
+ init: () => null,
746
+ apply(tr, last) {
747
+ const meta = tr.getMeta(key);
748
+ if (meta !== void 0) return meta;
749
+ return tr.docChanged || tr.selectionSet ? null : last;
750
+ }
751
+ },
752
+ props: {
753
+ handleTextInput(view, _from, _to, text) {
754
+ if (!view.composing && ENDS_WORD.test(text)) pending = text;
755
+ return false;
756
+ },
757
+ handleDOMEvents: {
758
+ keydown(view, event) {
759
+ if (event.ctrlKey || event.metaKey || event.altKey || event.isComposing) return false;
760
+ if (event.key === "Backspace" && !event.shiftKey) {
761
+ if (!revert(view)) return false;
762
+ event.preventDefault();
763
+ return true;
764
+ }
765
+ if (event.key === "Enter" && !view.dom.hasAttribute("aria-activedescendant"))
766
+ correct(view, false);
767
+ return false;
768
+ },
769
+ compositionend(view) {
770
+ setTimeout(() => {
771
+ if (!view.isDestroyed && ENDS_WORD.test(textBeforeCursor(view))) correct(view, true);
772
+ });
773
+ return false;
774
+ }
775
+ },
776
+ decorations(state) {
777
+ const last = key.getState(state);
778
+ if (!last) return null;
779
+ return DecorationSet.create(state.doc, [
780
+ Decoration.inline(last.from, last.to, { class: "nova-autocorrected" })
781
+ ]);
782
+ }
783
+ },
784
+ view: () => ({
785
+ update(view, previous) {
786
+ if (pending === null) return;
787
+ const typed = pending;
788
+ pending = null;
789
+ if (view.state.doc === previous.doc || !textBeforeCursor(view).endsWith(typed.slice(-1)))
790
+ return;
791
+ queueMicrotask(() => correct(view, true));
792
+ }
793
+ })
794
+ });
795
+ const set = (feature, on) => {
796
+ settings[feature] = on;
797
+ if (remember) save(settings);
798
+ editor.ui.announce(
799
+ editor.ui.t(on ? "announce.on" : "announce.off").replace("{name}", feature === "autocorrect" ? labels.spelling : labels.capitalize)
800
+ );
801
+ editor.root.dispatchEvent(
802
+ new CustomEvent("nova-autocorrect-toggle", { detail: { feature, on } })
803
+ );
804
+ editor.updateUI();
805
+ };
806
+ return { plugin, labels, settings, set };
807
+ }
808
+ function textBeforeCursor(view) {
809
+ const { $head } = view.state.selection;
810
+ return $head.parent.textBetween(
811
+ Math.max(0, $head.parentOffset - 8),
812
+ $head.parentOffset,
813
+ void 0,
814
+ leafText
815
+ );
816
+ }
817
+ function replaceChanged(tr, from, before, after) {
818
+ let head = 0;
819
+ while (head < before.length && head < after.length && before[head] === after[head]) head++;
820
+ let tail = 0;
821
+ while (tail < before.length - head && tail < after.length - head && before[before.length - 1 - tail] === after[after.length - 1 - tail])
822
+ tail++;
823
+ const start = from + head;
824
+ const end = from + before.length - tail;
825
+ const text = after.slice(head, after.length - tail);
826
+ return text ? tr.insertText(text, start, end) : tr.delete(start, end);
827
+ }
828
+ function readSaved() {
829
+ try {
830
+ const value = JSON.parse(globalThis.localStorage?.getItem(STORAGE) ?? "{}");
831
+ if (!value || typeof value !== "object") return {};
832
+ const { autocorrect, capitalize } = value;
833
+ return {
834
+ ...typeof autocorrect === "boolean" ? { autocorrect } : {},
835
+ ...typeof capitalize === "boolean" ? { capitalize } : {}
836
+ };
837
+ } catch {
838
+ return {};
839
+ }
840
+ }
841
+ function save(settings) {
842
+ try {
843
+ globalThis.localStorage?.setItem(STORAGE, JSON.stringify(settings));
844
+ } catch {
845
+ }
846
+ }
847
+ export {
848
+ LABELS,
849
+ autocorrect_default2 as default
850
+ };
851
+ //# sourceMappingURL=autocorrect-6GFLVDPC.js.map