@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,923 @@
1
+ import {
2
+ HTMLSerializer
3
+ } from "./chunk-53AY5NAF.js";
4
+ import {
5
+ marksOf,
6
+ nodesOf
7
+ } from "./chunk-AC3YCAX4.js";
8
+ import {
9
+ ALIGNMENTS,
10
+ createSchema,
11
+ cssValue
12
+ } from "./chunk-TAM2FHKG.js";
13
+ import {
14
+ orderPlugins,
15
+ pageHandlerOf,
16
+ resolveEntries
17
+ } from "./chunk-V7WUHUHM.js";
18
+ import {
19
+ htmlRulesFor
20
+ } from "./chunk-OOVNE6MB.js";
21
+
22
+ // src/formats.ts
23
+ import { NodeSelection } from "prosemirror-state";
24
+ import { lift, wrapIn } from "prosemirror-commands";
25
+ var INLINE_MARKS = {
26
+ strong: "bold",
27
+ b: "bold",
28
+ em: "italic",
29
+ i: "italic",
30
+ u: "underline",
31
+ s: "strike",
32
+ strike: "strike",
33
+ del: "strike",
34
+ code: "code",
35
+ sub: "subscript",
36
+ sup: "superscript"
37
+ };
38
+ var INLINE_STYLES = {
39
+ color: { mark: "color", read: cssValue.color },
40
+ "background-color": { mark: "background", read: cssValue.color },
41
+ "font-family": { mark: "font_family", read: cssValue.fontFamily },
42
+ "font-size": { mark: "font_size", read: cssValue.length }
43
+ };
44
+ var BLOCK_TAGS = {
45
+ p: (n) => n.type.name === "paragraph",
46
+ h1: (n) => n.type.name === "heading" && n.attrs.level === 1,
47
+ h2: (n) => n.type.name === "heading" && n.attrs.level === 2,
48
+ h3: (n) => n.type.name === "heading" && n.attrs.level === 3,
49
+ h4: (n) => n.type.name === "heading" && n.attrs.level === 4,
50
+ h5: (n) => n.type.name === "heading" && n.attrs.level === 5,
51
+ h6: (n) => n.type.name === "heading" && n.attrs.level === 6,
52
+ blockquote: (n) => n.type.name === "blockquote",
53
+ pre: (n) => n.type.name === "code_block",
54
+ img: (n) => n.type.name === "image"
55
+ };
56
+ var warned = /* @__PURE__ */ new Set();
57
+ function warnOnce(message) {
58
+ if (warned.has(message)) return;
59
+ warned.add(message);
60
+ console.warn(`[nova] formats: ${message}`);
61
+ }
62
+ function classList(value) {
63
+ if (Array.isArray(value)) return value.flatMap(classList);
64
+ return typeof value === "string" ? value.split(/\s+/).filter(Boolean) : [];
65
+ }
66
+ function formatClasses(specs) {
67
+ const out = [];
68
+ for (const spec of specs) {
69
+ out.push(...classList(spec.classes));
70
+ if ("items" in spec && spec.items) out.push(...formatClasses(spec.items));
71
+ }
72
+ return out;
73
+ }
74
+ var hasClasses = (value, wanted) => {
75
+ const have = classList(value);
76
+ return wanted.every((c) => have.includes(c));
77
+ };
78
+ var withClasses = (value, add) => {
79
+ const merged = [.../* @__PURE__ */ new Set([...classList(value), ...add])];
80
+ return merged.length ? merged.join(" ") : null;
81
+ };
82
+ var withoutClasses = (value, drop) => {
83
+ const rest = classList(value).filter((c) => !drop.includes(c));
84
+ return rest.length ? rest.join(" ") : null;
85
+ };
86
+ function blockStyles(spec) {
87
+ const out = {};
88
+ for (const [prop, value] of Object.entries(spec.styles ?? {})) {
89
+ if (prop === "text-align" && ALIGNMENTS.includes(value))
90
+ out.align = value;
91
+ else if (prop === "line-height" && cssValue.lineHeight(value))
92
+ out.lineHeight = cssValue.lineHeight(value);
93
+ else warnOnce(`style "${prop}" is not supported on blocks`);
94
+ }
95
+ return out;
96
+ }
97
+ function inlineMarks(state, spec) {
98
+ const marks = marksOf(state);
99
+ const out = [];
100
+ if (spec.inline && spec.inline !== "span") {
101
+ const type = marks[INLINE_MARKS[spec.inline]];
102
+ if (type) out.push(type.create());
103
+ }
104
+ const classes = classList(spec.classes);
105
+ if (classes.length && marks.span_class)
106
+ out.push(marks.span_class.create({ class: classes.join(" ") }));
107
+ for (const [prop, raw] of Object.entries(spec.styles ?? {})) {
108
+ const style = INLINE_STYLES[prop];
109
+ const value = style?.read(raw);
110
+ const type = style ? marks[style.mark] : void 0;
111
+ if (type && value) out.push(type.create({ value }));
112
+ else warnOnce(`style "${prop}: ${raw}" is not supported on text`);
113
+ }
114
+ return out;
115
+ }
116
+ var selectorTags = (spec) => (spec.selector ?? "").split(",").map((s) => s.trim().toLowerCase()).filter((tag) => {
117
+ if (BLOCK_TAGS[tag]) return true;
118
+ warnOnce(`selector "${tag}" is not supported`);
119
+ return false;
120
+ });
121
+ function selectedNodes(state, tags) {
122
+ const out = [];
123
+ const matches = (node) => tags.some((tag) => BLOCK_TAGS[tag](node));
124
+ const { selection } = state;
125
+ if (selection instanceof NodeSelection && matches(selection.node)) {
126
+ return [{ node: selection.node, pos: selection.from }];
127
+ }
128
+ const { $from, from, to } = selection;
129
+ for (let depth = $from.depth; depth > 0; depth--) {
130
+ const node = $from.node(depth);
131
+ if (matches(node)) out.push({ node, pos: $from.before(depth) });
132
+ }
133
+ state.doc.nodesBetween(from, to, (node, pos) => {
134
+ if (matches(node) && !out.some((o) => o.pos === pos)) out.push({ node, pos });
135
+ });
136
+ return out;
137
+ }
138
+ function textBlocks(state) {
139
+ const out = [];
140
+ const { from, to } = state.selection;
141
+ state.doc.nodesBetween(from, to, (node, pos) => {
142
+ if (node.isTextblock) {
143
+ out.push({ node, pos });
144
+ return false;
145
+ }
146
+ return true;
147
+ });
148
+ return out;
149
+ }
150
+ function blockquoteAt(state) {
151
+ const { $from } = state.selection;
152
+ for (let depth = $from.depth; depth > 0; depth--) {
153
+ const node = $from.node(depth);
154
+ if (node.type.name === "blockquote") return { node, pos: $from.before(depth) };
155
+ }
156
+ return null;
157
+ }
158
+ function keepBlockStyle(attrs) {
159
+ return {
160
+ align: attrs.align ?? null,
161
+ lineHeight: attrs.lineHeight ?? null,
162
+ dir: attrs.dir ?? null
163
+ };
164
+ }
165
+ var Formatter = class {
166
+ constructor(editor, allowedClasses) {
167
+ this.editor = editor;
168
+ this.allowedClasses = allowedClasses;
169
+ }
170
+ editor;
171
+ allowedClasses;
172
+ registry = /* @__PURE__ */ new Map();
173
+ /** Register a named format (one description or several variants). */
174
+ register(name, spec) {
175
+ const specs = Array.isArray(spec) ? spec : [spec];
176
+ this.registry.set(name, specs);
177
+ formatClasses(specs).forEach((c) => this.allowedClasses.add(c));
178
+ }
179
+ unregister(name) {
180
+ this.registry.delete(name);
181
+ }
182
+ has(name) {
183
+ return this.registry.has(name);
184
+ }
185
+ get(name) {
186
+ return this.registry.get(name);
187
+ }
188
+ resolve(format) {
189
+ if (typeof format !== "string") return [format];
190
+ const specs = this.registry.get(format);
191
+ if (!specs) warnOnce(`unknown format "${format}"`);
192
+ return specs ?? [];
193
+ }
194
+ /** Whether the format can apply to the selection (for selector: whether there are matching elements). */
195
+ canApply(format) {
196
+ if (!this.editor.isEditable()) return false;
197
+ const state = this.editor.view.state;
198
+ return this.resolve(format).some((spec) => canApply(state, spec));
199
+ }
200
+ /** Whether the selection matches the format. */
201
+ match(format) {
202
+ const state = this.editor.view.state;
203
+ return this.resolve(format).some((spec) => matchSpec(state, spec));
204
+ }
205
+ apply(format) {
206
+ if (!this.editor.isEditable()) return false;
207
+ const specs = this.resolve(format);
208
+ if (!specs.length) return false;
209
+ const spec = specs.find((s) => canApply(this.editor.view.state, s)) ?? specs[0];
210
+ return this.run((state, tr) => applySpec(state, tr, spec));
211
+ }
212
+ remove(format) {
213
+ if (!this.editor.isEditable()) return false;
214
+ const specs = this.resolve(format);
215
+ if (!specs.length) return false;
216
+ return this.run((state, tr) => specs.forEach((spec) => removeSpec(state, tr, spec)));
217
+ }
218
+ toggle(format) {
219
+ return this.match(format) ? this.remove(format) : this.apply(format);
220
+ }
221
+ run(fn) {
222
+ const { view } = this.editor;
223
+ const tr = view.state.tr;
224
+ const result = fn(view.state, tr);
225
+ if (result === false) return false;
226
+ if (tr.docChanged || tr.storedMarksSet) view.dispatch(tr.scrollIntoView());
227
+ view.focus();
228
+ return true;
229
+ }
230
+ };
231
+ function canApply(state, spec) {
232
+ if (spec.selector) return selectedNodes(state, selectorTags(spec)).length > 0;
233
+ return true;
234
+ }
235
+ function hasBlockStyles(node, spec) {
236
+ if (node.type.name === "image") return true;
237
+ return Object.entries(blockStyles(spec)).every(([key2, value]) => node.attrs[key2] === value);
238
+ }
239
+ function matchSpec(state, spec) {
240
+ const classes = classList(spec.classes);
241
+ if (spec.block) {
242
+ if (spec.block === "blockquote") {
243
+ const quote = blockquoteAt(state);
244
+ return !!quote && hasClasses(quote.node.attrs.class, classes);
245
+ }
246
+ const node = state.selection.$from.parent;
247
+ return BLOCK_TAGS[spec.block](node) && hasClasses(node.attrs.class, classes) && hasBlockStyles(node, spec);
248
+ }
249
+ if (spec.selector) {
250
+ const nodes = selectedNodes(state, selectorTags(spec));
251
+ return nodes.length > 0 && nodes.some(({ node }) => hasClasses(node.attrs.class, classes) && hasBlockStyles(node, spec));
252
+ }
253
+ if (spec.inline) {
254
+ const wanted = inlineMarks(state, spec);
255
+ if (!wanted.length) return false;
256
+ const { $from, empty, from, to } = state.selection;
257
+ if (empty) {
258
+ const marks = state.storedMarks ?? $from.marks();
259
+ return wanted.every((mark) => marks.some((m) => markCovers(m, mark)));
260
+ }
261
+ let found = false;
262
+ let all = true;
263
+ state.doc.nodesBetween(from, to, (node) => {
264
+ if (!node.isText) return;
265
+ found = true;
266
+ if (!wanted.every((mark) => node.marks.some((m) => markCovers(m, mark)))) all = false;
267
+ });
268
+ return found && all;
269
+ }
270
+ return false;
271
+ }
272
+ function markCovers(m, mark) {
273
+ if (m.type !== mark.type) return false;
274
+ if (mark.type.name === "span_class")
275
+ return hasClasses(m.attrs.class, classList(mark.attrs.class));
276
+ return mark.attrs.value === void 0 || m.attrs.value === mark.attrs.value;
277
+ }
278
+ function applySpec(state, tr, spec) {
279
+ const classes = classList(spec.classes);
280
+ const nodes = nodesOf(state);
281
+ if (spec.block === "blockquote") {
282
+ const quote = blockquoteAt(state);
283
+ if (quote) {
284
+ tr.setNodeMarkup(quote.pos, void 0, {
285
+ ...quote.node.attrs,
286
+ class: withClasses(quote.node.attrs.class, classes)
287
+ });
288
+ return true;
289
+ }
290
+ return wrapIn(nodes.blockquote, { class: withClasses(null, classes) })(
291
+ state,
292
+ (wrapped) => wrapped.steps.forEach((step) => tr.step(step))
293
+ );
294
+ }
295
+ if (spec.block === "pre") {
296
+ for (const { node, pos } of textBlocks(state)) {
297
+ if (node.type !== nodes.code_block)
298
+ tr.setNodeMarkup(pos, nodes.code_block, { language: null });
299
+ }
300
+ return true;
301
+ }
302
+ if (spec.block) {
303
+ const level = spec.block === "p" ? 0 : Number(spec.block.slice(1));
304
+ const type = level ? nodes.heading : nodes.paragraph;
305
+ const styles = blockStyles(spec);
306
+ for (const { node, pos } of textBlocks(state)) {
307
+ if (node.type === nodes.code_block && node.textContent.includes("\n")) continue;
308
+ const sameType = node.type === type && (!level || node.attrs.level === level);
309
+ tr.setNodeMarkup(pos, type, {
310
+ ...keepBlockStyle(node.attrs),
311
+ ...level ? { level } : {},
312
+ ...styles,
313
+ class: withClasses(sameType ? node.attrs.class : null, classes)
314
+ });
315
+ }
316
+ return true;
317
+ }
318
+ if (spec.selector) {
319
+ const styles = blockStyles(spec);
320
+ const targets = selectedNodes(state, selectorTags(spec));
321
+ if (!targets.length) return false;
322
+ for (const { node, pos } of targets) {
323
+ const extra = node.type.name === "image" ? {} : styles;
324
+ tr.setNodeMarkup(pos, void 0, {
325
+ ...node.attrs,
326
+ ...extra,
327
+ class: withClasses(node.attrs.class, classes)
328
+ });
329
+ }
330
+ if (state.selection instanceof NodeSelection)
331
+ tr.setSelection(NodeSelection.create(tr.doc, state.selection.from));
332
+ return true;
333
+ }
334
+ if (spec.inline) {
335
+ const marks = inlineMarks(state, spec);
336
+ if (!marks.length) return false;
337
+ const { empty, ranges } = state.selection;
338
+ if (empty) {
339
+ let stored = state.storedMarks ?? state.selection.$from.marks();
340
+ for (const mark of marks) stored = mark.addToSet(stored);
341
+ tr.setStoredMarks(stored);
342
+ return true;
343
+ }
344
+ for (const { $from, $to } of ranges) {
345
+ for (const mark of marks) tr.addMark($from.pos, $to.pos, mark);
346
+ }
347
+ return true;
348
+ }
349
+ return false;
350
+ }
351
+ function removeSpec(state, tr, spec) {
352
+ const classes = classList(spec.classes);
353
+ const nodes = nodesOf(state);
354
+ if (spec.block === "blockquote") {
355
+ const quote = blockquoteAt(state);
356
+ if (!quote) return;
357
+ const rest = withoutClasses(quote.node.attrs.class, classes);
358
+ if (classes.length && rest !== null) {
359
+ tr.setNodeMarkup(quote.pos, void 0, { ...quote.node.attrs, class: rest });
360
+ return;
361
+ }
362
+ lift(state, (lifted) => lifted.steps.forEach((step) => tr.step(step)));
363
+ return;
364
+ }
365
+ if (spec.block) {
366
+ for (const { node, pos } of textBlocks(state)) {
367
+ if (!BLOCK_TAGS[spec.block](node)) continue;
368
+ tr.setNodeMarkup(pos, nodes.paragraph, {
369
+ ...keepBlockStyle(node.attrs),
370
+ class: spec.block === "p" ? withoutClasses(node.attrs.class, classes) : null
371
+ });
372
+ }
373
+ return;
374
+ }
375
+ if (spec.selector) {
376
+ const styles = blockStyles(spec);
377
+ for (const { node, pos } of selectedNodes(state, selectorTags(spec))) {
378
+ const reset = {};
379
+ if (node.type.name !== "image") {
380
+ if ("align" in styles && node.attrs.align === styles.align) reset.align = null;
381
+ if ("lineHeight" in styles && node.attrs.lineHeight === styles.lineHeight)
382
+ reset.lineHeight = null;
383
+ }
384
+ tr.setNodeMarkup(pos, void 0, {
385
+ ...node.attrs,
386
+ ...reset,
387
+ class: withoutClasses(node.attrs.class, classes)
388
+ });
389
+ }
390
+ if (state.selection instanceof NodeSelection)
391
+ tr.setSelection(NodeSelection.create(tr.doc, state.selection.from));
392
+ return;
393
+ }
394
+ if (spec.inline) {
395
+ const marks = inlineMarks(state, spec);
396
+ const { empty, from, to, $from } = state.selection;
397
+ if (empty) {
398
+ const stored = (state.storedMarks ?? $from.marks()).filter(
399
+ (m) => !marks.some((mark) => markCovers(m, mark))
400
+ );
401
+ tr.setStoredMarks(stored);
402
+ return;
403
+ }
404
+ for (const mark of marks) {
405
+ if (mark.type.name !== "span_class") {
406
+ tr.removeMark(from, to, mark.type);
407
+ continue;
408
+ }
409
+ state.doc.nodesBetween(from, to, (node, pos) => {
410
+ if (!node.isText) return;
411
+ const current = node.marks.find((m) => m.type === mark.type);
412
+ if (!current) return;
413
+ const start = Math.max(pos, from);
414
+ const end = Math.min(pos + node.nodeSize, to);
415
+ tr.removeMark(start, end, mark.type);
416
+ const rest = withoutClasses(current.attrs.class, classList(mark.attrs.class));
417
+ if (rest) tr.addMark(start, end, mark.type.create({ class: rest }));
418
+ });
419
+ }
420
+ }
421
+ }
422
+
423
+ // src/document.ts
424
+ import { Node as PMNode } from "prosemirror-model";
425
+
426
+ // src/content-rules.ts
427
+ import { Fragment } from "prosemirror-model";
428
+ import { Plugin, PluginKey } from "prosemirror-state";
429
+ var ALIASES = {
430
+ b: "strong",
431
+ i: "em",
432
+ strike: "s",
433
+ del: "s",
434
+ tbody: "table",
435
+ thead: "table",
436
+ tfoot: "table",
437
+ caption: "table",
438
+ colgroup: "table",
439
+ col: "table",
440
+ figcaption: "figure"
441
+ };
442
+ var KNOWN_TAGS = [
443
+ "p",
444
+ "h1",
445
+ "h2",
446
+ "h3",
447
+ "h4",
448
+ "h5",
449
+ "h6",
450
+ "blockquote",
451
+ "pre",
452
+ "hr",
453
+ "ul",
454
+ "ol",
455
+ "li",
456
+ "img",
457
+ "figure",
458
+ "br",
459
+ "table",
460
+ "tr",
461
+ "td",
462
+ "th",
463
+ "strong",
464
+ "em",
465
+ "u",
466
+ "s",
467
+ "code",
468
+ "a",
469
+ "sub",
470
+ "sup",
471
+ "span"
472
+ ];
473
+ var REQUIREMENTS = {
474
+ bold: ["strong"],
475
+ italic: ["em"],
476
+ underline: ["u"],
477
+ strikethrough: ["s"],
478
+ strike: ["s"],
479
+ inlinecode: ["code"],
480
+ code: ["code"],
481
+ subscript: ["sub"],
482
+ superscript: ["sup"],
483
+ link: ["a"],
484
+ unlink: ["a"],
485
+ quicklink: ["a"],
486
+ image: ["img"],
487
+ quickimage: ["img"],
488
+ table: ["table"],
489
+ quicktable: ["table"],
490
+ inserttable: ["table"],
491
+ tableinsertrowbefore: ["table"],
492
+ tableinsertrowafter: ["table"],
493
+ tabledeleterow: ["table"],
494
+ tableinsertcolbefore: ["table"],
495
+ tableinsertcolafter: ["table"],
496
+ tabledeletecol: ["table"],
497
+ tablemergecells: ["table"],
498
+ tablesplitcells: ["table"],
499
+ tabledelete: ["table"],
500
+ tablerowheader: ["th"],
501
+ tablecolheader: ["th"],
502
+ tablecellbackground: ["style:background-color"],
503
+ bullist: ["ul"],
504
+ checklist: ["ul"],
505
+ accordion: ["details"],
506
+ bulletlist: ["ul"],
507
+ numlist: ["ol"],
508
+ orderedlist: ["ol"],
509
+ blockquote: ["blockquote"],
510
+ codeblock: ["pre"],
511
+ hr: ["hr"],
512
+ horizontalrule: ["hr"],
513
+ h1: ["h1"],
514
+ h2: ["h2"],
515
+ h3: ["h3"],
516
+ h4: ["h4"],
517
+ h5: ["h5"],
518
+ h6: ["h6"],
519
+ forecolor: ["span", "style:color"],
520
+ backcolor: ["span", "style:background-color"],
521
+ fontfamily: ["span", "style:font-family"],
522
+ fontsize: ["span", "style:font-size"],
523
+ lineheight: ["style:line-height"],
524
+ align: ["style:text-align"],
525
+ alignleft: ["style:text-align"],
526
+ aligncenter: ["style:text-align"],
527
+ alignright: ["style:text-align"],
528
+ alignjustify: ["style:text-align"],
529
+ imagealignleft: ["style:float"],
530
+ imagealigncenter: ["style:float"],
531
+ imagealignright: ["style:float"]
532
+ };
533
+ function parseList(value) {
534
+ if (value === void 0) return null;
535
+ const set = /* @__PURE__ */ new Set();
536
+ for (const raw of value.split(",")) {
537
+ const item = raw.trim().replace(/^[-#+!]+/, "").replace(/\[.*$/, "").toLowerCase();
538
+ for (const name of item.split("/")) {
539
+ const tag = name.trim();
540
+ if (tag) set.add(ALIASES[tag] ?? tag);
541
+ }
542
+ }
543
+ return set;
544
+ }
545
+ function parseStyles(value) {
546
+ if (value === void 0) return null;
547
+ const text = typeof value === "string" ? value : Object.values(value).join(",");
548
+ return new Set(
549
+ text.split(",").map((s) => s.trim().toLowerCase()).filter(Boolean)
550
+ );
551
+ }
552
+ var ContentRules = class {
553
+ tags;
554
+ styles;
555
+ constructor(options) {
556
+ const valid = parseList(options.validElements);
557
+ const invalid = parseList(options.invalidElements) ?? /* @__PURE__ */ new Set();
558
+ const tags = new Set(valid ?? KNOWN_TAGS);
559
+ if (valid) for (const tag of parseList(options.extendedValidElements) ?? []) tags.add(tag);
560
+ if (tags.has("ul") || tags.has("ol")) tags.add("li");
561
+ if (tags.has("table")) {
562
+ tags.add("tr");
563
+ tags.add("td");
564
+ }
565
+ for (const tag of invalid) tags.delete(tag);
566
+ tags.add("p");
567
+ this.tags = tags;
568
+ this.styles = parseStyles(options.validStyles);
569
+ }
570
+ isTagAllowed(tag) {
571
+ const t = tag.toLowerCase();
572
+ return this.tags.has(ALIASES[t] ?? t);
573
+ }
574
+ isStyleAllowed(property) {
575
+ return !this.styles || this.styles.has(property.toLowerCase());
576
+ }
577
+ /** Whether a control, menu item or slash command is available (by name). Unknown names are allowed. */
578
+ isAllowed(name) {
579
+ const req = REQUIREMENTS[name.toLowerCase()];
580
+ if (!req) return true;
581
+ return req.every(
582
+ (r) => r.startsWith("style:") ? this.isStyleAllowed(r.slice(6)) : this.isTagAllowed(r)
583
+ );
584
+ }
585
+ markAllowed(mark) {
586
+ switch (mark.type.name) {
587
+ case "bold":
588
+ return this.isTagAllowed("strong");
589
+ case "italic":
590
+ return this.isTagAllowed("em");
591
+ case "underline":
592
+ return this.isTagAllowed("u");
593
+ case "strike":
594
+ return this.isTagAllowed("s");
595
+ case "code":
596
+ return this.isTagAllowed("code");
597
+ case "link":
598
+ return this.isTagAllowed("a");
599
+ case "subscript":
600
+ return this.isTagAllowed("sub");
601
+ case "superscript":
602
+ return this.isTagAllowed("sup");
603
+ case "color":
604
+ return this.isTagAllowed("span") && this.isStyleAllowed("color");
605
+ case "background":
606
+ return this.isTagAllowed("span") && this.isStyleAllowed("background-color");
607
+ case "font_family":
608
+ return this.isTagAllowed("span") && this.isStyleAllowed("font-family");
609
+ case "font_size":
610
+ return this.isTagAllowed("span") && this.isStyleAllowed("font-size");
611
+ default:
612
+ return true;
613
+ }
614
+ }
615
+ /** Block attributes without disallowed styles. */
616
+ blockAttrs(attrs) {
617
+ return {
618
+ ...attrs,
619
+ ...this.isStyleAllowed("text-align") ? {} : { align: null },
620
+ ...this.isStyleAllowed("line-height") ? {} : { lineHeight: null },
621
+ ...this.isStyleAllowed("margin-left") ? {} : { indent: 0 }
622
+ };
623
+ }
624
+ /** Bring a node in line with the rules. Returns 0…n nodes (a disallowed block can dissolve). */
625
+ normalize(node) {
626
+ const schema = node.type.schema;
627
+ const { nodes } = schema;
628
+ if (node.isText) {
629
+ const marks2 = node.marks.filter((m) => this.markAllowed(m));
630
+ return [marks2.length === node.marks.length ? node : node.mark(marks2)];
631
+ }
632
+ const marks = node.marks.filter((m) => this.markAllowed(m));
633
+ switch (node.type) {
634
+ case nodes.image:
635
+ if (!this.isTagAllowed("img")) return [];
636
+ return [
637
+ nodes.image.create(
638
+ { ...node.attrs, ...this.isStyleAllowed("float") ? {} : { align: null } },
639
+ null,
640
+ marks
641
+ )
642
+ ];
643
+ case nodes.figure: {
644
+ const caption = node.childCount > 1 ? node.child(1).content : null;
645
+ const captionBlocks = caption?.size ? [nodes.paragraph.create(null, this.normalizeChildren(caption))] : [];
646
+ const image = node.firstChild;
647
+ if (!this.isTagAllowed("img") || !image) return captionBlocks;
648
+ const align = this.isStyleAllowed("float") ? node.attrs.align : null;
649
+ if (!this.isTagAllowed("figure")) {
650
+ const inline = nodes.image.create({ ...image.attrs, align });
651
+ return [nodes.paragraph.create(null, inline), ...captionBlocks];
652
+ }
653
+ return [nodes.figure.create({ ...node.attrs, align }, node.content)];
654
+ }
655
+ case nodes.hard_break:
656
+ return this.isTagAllowed("br") ? [node.mark(marks)] : [schema.text(" ", marks)];
657
+ case nodes.horizontal_rule:
658
+ return this.isTagAllowed("hr") ? [node] : [];
659
+ }
660
+ const children = this.normalizeChildren(node.content);
661
+ const make = (type = node.type, attrs = node.attrs) => {
662
+ try {
663
+ return [type.createChecked(attrs, children, node.marks)];
664
+ } catch {
665
+ const filled = type.createAndFill(attrs, children, node.marks);
666
+ return filled ? [filled] : children.content.length ? asBlocks(children) : [];
667
+ }
668
+ };
669
+ if (node.type.name === "details" && !this.isTagAllowed("details")) {
670
+ const out = [];
671
+ children.forEach((child) => {
672
+ if (child.type.name !== "details_summary") out.push(child);
673
+ else if (child.content.size) out.push(nodes.paragraph.create(null, child.content));
674
+ });
675
+ return out;
676
+ }
677
+ switch (node.type) {
678
+ case nodes.paragraph:
679
+ return make(nodes.paragraph, this.blockAttrs(node.attrs));
680
+ case nodes.heading:
681
+ return this.isTagAllowed(`h${node.attrs.level}`) ? make(nodes.heading, this.blockAttrs(node.attrs)) : make(
682
+ nodes.paragraph,
683
+ this.blockAttrs({ align: node.attrs.align, lineHeight: node.attrs.lineHeight })
684
+ );
685
+ case nodes.blockquote:
686
+ return this.isTagAllowed("blockquote") ? make() : asBlocks(children);
687
+ case nodes.code_block:
688
+ if (this.isTagAllowed("pre")) return make();
689
+ return node.textContent.split("\n").map((line) => nodes.paragraph.create(null, line ? schema.text(line) : null));
690
+ case nodes.bullet_list:
691
+ case nodes.ordered_list:
692
+ if (!this.isTagAllowed(node.type === nodes.bullet_list ? "ul" : "ol"))
693
+ return flattenItems(children);
694
+ return make(node.type, {
695
+ ...node.attrs,
696
+ ...this.isStyleAllowed("list-style-type") ? {} : { listStyle: null }
697
+ });
698
+ case nodes.table:
699
+ return this.isTagAllowed("table") ? make() : flattenTable(children);
700
+ case nodes.table_header:
701
+ return this.isTagAllowed("th") ? make() : make(nodes.table_cell, node.attrs);
702
+ case nodes.table_cell:
703
+ return make(nodes.table_cell, {
704
+ ...node.attrs,
705
+ ...this.isStyleAllowed("background-color") ? {} : { background: null }
706
+ });
707
+ default:
708
+ return make();
709
+ }
710
+ }
711
+ normalizeChildren(fragment) {
712
+ const out = [];
713
+ fragment.forEach((child) => out.push(...this.normalize(child)));
714
+ return Fragment.from(out);
715
+ }
716
+ /** Normalize the whole document (the initial content). */
717
+ normalizeDoc(doc) {
718
+ const content = this.normalizeChildren(doc.content);
719
+ const schema = doc.type.schema;
720
+ return doc.type.createAndFill(
721
+ doc.attrs,
722
+ content.size ? content : schema.nodes.paragraph.create()
723
+ );
724
+ }
725
+ };
726
+ function asBlocks(fragment) {
727
+ const out = [];
728
+ let inline = [];
729
+ const flush = () => {
730
+ if (inline.length)
731
+ out.push(inline[0].type.schema.nodes.paragraph.create(null, inline));
732
+ inline = [];
733
+ };
734
+ fragment.forEach((child) => {
735
+ if (child.isInline) inline.push(child);
736
+ else {
737
+ flush();
738
+ out.push(child);
739
+ }
740
+ });
741
+ flush();
742
+ return out;
743
+ }
744
+ function flattenItems(fragment) {
745
+ const out = [];
746
+ fragment.forEach((item) => {
747
+ if (item.type === item.type.schema.nodes.list_item)
748
+ item.content.forEach((block) => out.push(block));
749
+ else out.push(...asBlocks(Fragment.from(item)));
750
+ });
751
+ return out;
752
+ }
753
+ function flattenTable(fragment) {
754
+ const out = [];
755
+ fragment.forEach((row) => row.forEach((cell) => cell.forEach((block) => out.push(block))));
756
+ return out;
757
+ }
758
+ var key = new PluginKey("nova-content-rules");
759
+ function contentRulesPlugin(rules) {
760
+ return new Plugin({
761
+ key,
762
+ appendTransaction(transactions, oldState, newState) {
763
+ if (!transactions.some((tr2) => tr2.docChanged)) return null;
764
+ const start = oldState.doc.content.findDiffStart(newState.doc.content);
765
+ if (start === null) return null;
766
+ const end = oldState.doc.content.findDiffEnd(newState.doc.content)?.b ?? newState.doc.content.size;
767
+ const doc = newState.doc;
768
+ const replacements = [];
769
+ doc.forEach((child, offset) => {
770
+ const from = offset;
771
+ const to = offset + child.nodeSize;
772
+ if (to < start || from > Math.max(start, end)) return;
773
+ const normalized = rules.normalize(child);
774
+ if (normalized.length === 1 && normalized[0].eq(child)) return;
775
+ replacements.push({ from, to, nodes: normalized });
776
+ });
777
+ if (!replacements.length) return null;
778
+ const tr = newState.tr;
779
+ for (const { from, to, nodes } of replacements.reverse()) {
780
+ if (nodes.length) tr.replaceWith(from, to, nodes);
781
+ else if (tr.doc.childCount > 1) tr.delete(from, to);
782
+ else tr.replaceWith(from, to, newState.schema.nodes.paragraph.create());
783
+ }
784
+ return tr.setMeta(
785
+ "addToHistory",
786
+ transactions.every((t) => t.getMeta("addToHistory") !== false)
787
+ );
788
+ }
789
+ });
790
+ }
791
+
792
+ // src/document.ts
793
+ var htmlSerializer = new HTMLSerializer();
794
+ var RTL_LANGUAGES = /* @__PURE__ */ new Set(["ar", "he", "iw", "fa", "ur", "ps", "sd", "ug", "yi", "dv", "ckb"]);
795
+ function isRtlLanguage(language) {
796
+ return !!language && RTL_LANGUAGES.has(language.toLowerCase().split(/[-_]/)[0]);
797
+ }
798
+ function report(message, error) {
799
+ console.error(`[nova] ${message}`, ...error === void 0 ? [] : [error]);
800
+ }
801
+ function schemaFromOptions(options, plugins, direction, context) {
802
+ const allowedClasses = /* @__PURE__ */ new Set([
803
+ ...formatClasses(Object.values(options.formats ?? {}).flat()),
804
+ ...formatClasses(options.styleFormats ?? []),
805
+ ...Array.isArray(options.validClasses) ? options.validClasses : [],
806
+ ...[...options.tableClassList ?? [], ...options.tableCellClassList ?? []].flatMap(
807
+ (o) => o.value.split(/\s+/).filter(Boolean)
808
+ )
809
+ ]);
810
+ const htmlRules = htmlRulesFor(options);
811
+ const allClasses = options.validClasses === true || options.validClasses === void 0 && !!htmlRules?.classOnBuiltIn;
812
+ const classFilter = allClasses ? () => true : (name) => allowedClasses.has(name);
813
+ const nodes = {};
814
+ const marks = {};
815
+ const attributes = {};
816
+ for (const plugin of plugins) {
817
+ Object.assign(attributes, plugin.nodeAttributes);
818
+ let pluginNodes;
819
+ try {
820
+ pluginNodes = typeof plugin.nodes === "function" ? plugin.nodes(context) : plugin.nodes;
821
+ } catch (error) {
822
+ report(`Plugin "${plugin.name}" failed to define its nodes`, error);
823
+ }
824
+ for (const [name, spec] of Object.entries(pluginNodes ?? {})) {
825
+ if (name in nodes) report(`Node "${name}" is defined by several plugins`);
826
+ else nodes[name] = spec;
827
+ }
828
+ for (const [name, spec] of Object.entries(plugin.marks ?? {})) {
829
+ if (name in marks) report(`Mark "${name}" is defined by several plugins`);
830
+ else marks[name] = spec;
831
+ }
832
+ }
833
+ try {
834
+ return {
835
+ schema: createSchema({ nodes, marks, attributes }, classFilter, htmlRules, direction),
836
+ allowedClasses
837
+ };
838
+ } catch (error) {
839
+ report("Failed to build the document schema from plugins", error);
840
+ return { schema: createSchema({}, classFilter, htmlRules, direction), allowedClasses };
841
+ }
842
+ }
843
+ function attrValid(spec, value) {
844
+ const validate = spec?.validate;
845
+ if (!validate) return true;
846
+ if (typeof validate === "function") {
847
+ try {
848
+ validate(value);
849
+ return true;
850
+ } catch {
851
+ return false;
852
+ }
853
+ }
854
+ const type = value === null ? "null" : typeof value;
855
+ return validate.split("|").includes(type);
856
+ }
857
+ function sanitizeAttrs(specs, attrs) {
858
+ if (!attrs || typeof attrs !== "object" || !specs) return attrs;
859
+ return Object.fromEntries(
860
+ Object.entries(attrs).filter(([name, value]) => attrValid(specs[name], value))
861
+ );
862
+ }
863
+ function sanitizeJSON(schema, json) {
864
+ const type = schema.nodes[json.type];
865
+ const out = { ...json };
866
+ if (type) out.attrs = sanitizeAttrs(type.spec.attrs, json.attrs);
867
+ if (Array.isArray(json.marks)) {
868
+ out.marks = json.marks.map((mark) => {
869
+ const markType = mark && schema.marks[mark.type];
870
+ return markType ? { ...mark, attrs: sanitizeAttrs(markType.spec.attrs, mark.attrs) } : mark;
871
+ });
872
+ }
873
+ if (Array.isArray(json.content)) {
874
+ out.content = json.content.map(
875
+ (child) => child && typeof child === "object" ? sanitizeJSON(schema, child) : child
876
+ );
877
+ }
878
+ return out;
879
+ }
880
+ function createRenderer(options = {}) {
881
+ const resolved = resolveEntries(options.plugins ?? []);
882
+ resolved.errors.forEach((message) => report(message));
883
+ const { ordered, errors } = orderPlugins(resolved.plugins);
884
+ errors.forEach((message) => report(message));
885
+ const direction = options.direction ?? (isRtlLanguage(options.language) ? "rtl" : "ltr");
886
+ const { schema } = schemaFromOptions(options, ordered, direction, { options });
887
+ const hasRules = options.validElements !== void 0 || options.invalidElements !== void 0 || options.validStyles !== void 0;
888
+ const rules = hasRules ? new ContentRules(options) : null;
889
+ const doc = (json) => {
890
+ const node = PMNode.fromJSON(schema, sanitizeJSON(schema, json));
891
+ return rules ? rules.normalizeDoc(node) : node;
892
+ };
893
+ const page = pageHandlerOf(ordered, { options });
894
+ return {
895
+ schema,
896
+ doc,
897
+ html: (json, { fullPage = true } = {}) => {
898
+ const node = doc(json);
899
+ const content = htmlSerializer.serializeFragment(node.content);
900
+ return page && fullPage ? page.write(content, node.attrs) : content;
901
+ },
902
+ text: (json) => {
903
+ const node = doc(json);
904
+ return node.textBetween(0, node.content.size, "\n\n");
905
+ }
906
+ };
907
+ }
908
+ function renderHTML(json, options = {}) {
909
+ return createRenderer(options).html(json);
910
+ }
911
+
912
+ export {
913
+ Formatter,
914
+ ContentRules,
915
+ contentRulesPlugin,
916
+ htmlSerializer,
917
+ isRtlLanguage,
918
+ schemaFromOptions,
919
+ sanitizeJSON,
920
+ createRenderer,
921
+ renderHTML
922
+ };
923
+ //# sourceMappingURL=chunk-YDPZCVXS.js.map