@notectl/core 2.4.2 → 2.5.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 (415) hide show
  1. package/dist/chunks/AlignmentPlugin-C26pIVcw.mjs +2 -0
  2. package/dist/chunks/{AlignmentPlugin-Cp7HYGaH.mjs.map → AlignmentPlugin-C26pIVcw.mjs.map} +1 -1
  3. package/dist/chunks/BidiIsolationPlugin-nWd1NEF-.mjs +2 -0
  4. package/dist/chunks/{BidiIsolationPlugin-GWukKdgJ.mjs.map → BidiIsolationPlugin-nWd1NEF-.mjs.map} +1 -1
  5. package/dist/chunks/BlockquotePlugin-Bag42Zc0.mjs +2 -0
  6. package/dist/chunks/{BlockquotePlugin-CSL_7Yit.mjs.map → BlockquotePlugin-Bag42Zc0.mjs.map} +1 -1
  7. package/dist/chunks/CaretNavigationPlugin-DUAoHygg.mjs +2 -0
  8. package/dist/chunks/{CaretNavigationPlugin-BQPqqK4n.mjs.map → CaretNavigationPlugin-DUAoHygg.mjs.map} +1 -1
  9. package/dist/chunks/CodeBlockPlugin-Dk_J8NAl.mjs +2 -0
  10. package/dist/chunks/{CodeBlockPlugin-B4AcDJRK.mjs.map → CodeBlockPlugin-Dk_J8NAl.mjs.map} +1 -1
  11. package/dist/chunks/Commands-vqbwh6Ic.mjs +2 -0
  12. package/dist/chunks/{Commands-Bk7Cl1nH.mjs.map → Commands-vqbwh6Ic.mjs.map} +1 -1
  13. package/dist/chunks/DocumentParser-D4g5npEi.mjs +2 -0
  14. package/dist/chunks/DocumentParser-D4g5npEi.mjs.map +1 -0
  15. package/dist/chunks/EditorUI-DrQI95FW.mjs +2 -0
  16. package/dist/chunks/EditorUI-DrQI95FW.mjs.map +1 -0
  17. package/dist/chunks/FontPlugin-Bzlluh1_.mjs +2 -0
  18. package/dist/chunks/{FontPlugin-BcXNFqqO.mjs.map → FontPlugin-Bzlluh1_.mjs.map} +1 -1
  19. package/dist/chunks/FontSizePlugin-kv3zHG0f.mjs +2 -0
  20. package/dist/chunks/{FontSizePlugin-Dswra3oU.mjs.map → FontSizePlugin-kv3zHG0f.mjs.map} +1 -1
  21. package/dist/chunks/FormulaPlugin-20vW4Gge.mjs +2 -0
  22. package/dist/chunks/{FormulaPlugin-DVpLaKi5.mjs.map → FormulaPlugin-20vW4Gge.mjs.map} +1 -1
  23. package/dist/chunks/GapCursorPlugin-BPyNXY4H.mjs +2 -0
  24. package/dist/chunks/{GapCursorPlugin-QDGwnaRR.mjs.map → GapCursorPlugin-BPyNXY4H.mjs.map} +1 -1
  25. package/dist/chunks/HTMLSanitization-BRipXyhI.mjs +2 -0
  26. package/dist/chunks/HTMLSanitization-BRipXyhI.mjs.map +1 -0
  27. package/dist/chunks/{HardBreakPlugin-gjCq8prD.mjs → HardBreakPlugin-lo8Mcg9G.mjs} +2 -2
  28. package/dist/chunks/{HardBreakPlugin-gjCq8prD.mjs.map → HardBreakPlugin-lo8Mcg9G.mjs.map} +1 -1
  29. package/dist/chunks/HeadingPlugin-CEZF5DBM.mjs +2 -0
  30. package/dist/chunks/{HeadingPlugin-B7EfynaH.mjs.map → HeadingPlugin-CEZF5DBM.mjs.map} +1 -1
  31. package/dist/chunks/HighlightPlugin-yH44UWoe.mjs +2 -0
  32. package/dist/chunks/{HighlightPlugin-LdO0INtJ.mjs.map → HighlightPlugin-yH44UWoe.mjs.map} +1 -1
  33. package/dist/chunks/HorizontalRulePlugin-SNNum-9V.mjs +2 -0
  34. package/dist/chunks/{HorizontalRulePlugin-YywXVZYr.mjs.map → HorizontalRulePlugin-SNNum-9V.mjs.map} +1 -1
  35. package/dist/chunks/ImagePlugin-aeqHr5zx.mjs +2 -0
  36. package/dist/chunks/{ImagePlugin-BAhZuVdE.mjs.map → ImagePlugin-aeqHr5zx.mjs.map} +1 -1
  37. package/dist/chunks/InlineCodePlugin-CIks06ti.mjs +2 -0
  38. package/dist/chunks/{InlineCodePlugin-Bu9-rE4B.mjs.map → InlineCodePlugin-CIks06ti.mjs.map} +1 -1
  39. package/dist/chunks/LinkPlugin-CFw22a9X.mjs +2 -0
  40. package/dist/chunks/LinkPlugin-CFw22a9X.mjs.map +1 -0
  41. package/dist/chunks/ListPlugin-ZNEx8pvk.mjs +2 -0
  42. package/dist/chunks/{ListPlugin-U1r4p_fE.mjs.map → ListPlugin-ZNEx8pvk.mjs.map} +1 -1
  43. package/dist/chunks/LocaleLoader-DEpTFuVc.mjs +2 -0
  44. package/dist/chunks/LocaleLoader-DEpTFuVc.mjs.map +1 -0
  45. package/dist/chunks/{MarkdownHTMLRegistry-BunUDiza.mjs → MarkdownHTMLRegistry-Cj7N2wqs.mjs} +2 -2
  46. package/dist/chunks/{MarkdownHTMLRegistry-BunUDiza.mjs.map → MarkdownHTMLRegistry-Cj7N2wqs.mjs.map} +1 -1
  47. package/dist/chunks/{MarkdownParser-uX1p_GQk.mjs → MarkdownParser-JOfPSvGv.mjs} +2 -2
  48. package/dist/chunks/{MarkdownParser-uX1p_GQk.mjs.map → MarkdownParser-JOfPSvGv.mjs.map} +1 -1
  49. package/dist/chunks/{MarkdownSerializer--MrgJTdJ.mjs → MarkdownSerializer-Y6saYClE.mjs} +2 -2
  50. package/dist/chunks/{MarkdownSerializer--MrgJTdJ.mjs.map → MarkdownSerializer-Y6saYClE.mjs.map} +1 -1
  51. package/dist/chunks/PopupManager-DpxoBl54.mjs +2 -0
  52. package/dist/chunks/PopupManager-DpxoBl54.mjs.map +1 -0
  53. package/dist/chunks/PopupPositioning-CIqgpqlW.mjs.map +1 -1
  54. package/dist/chunks/PrintPlugin-CYkdUy-m.mjs +2 -0
  55. package/dist/chunks/{PrintPlugin-DAEiEyKQ.mjs.map → PrintPlugin-CYkdUy-m.mjs.map} +1 -1
  56. package/dist/chunks/{SchemaRegistry-Cs7rxafF.mjs → SchemaRegistry-CT3T7S1i.mjs} +2 -2
  57. package/dist/chunks/{SchemaRegistry-Cs7rxafF.mjs.map → SchemaRegistry-CT3T7S1i.mjs.map} +1 -1
  58. package/dist/chunks/{SelectionReplacement-vC1xhFS0.mjs → SelectionReplacement-Cj4FLlPz.mjs} +2 -2
  59. package/dist/chunks/{SelectionReplacement-vC1xhFS0.mjs.map → SelectionReplacement-Cj4FLlPz.mjs.map} +1 -1
  60. package/dist/chunks/{SelectionSync-BkjCwGp-.mjs → SelectionSync-8y0nbBHZ.mjs} +2 -2
  61. package/dist/chunks/{SelectionSync-BkjCwGp-.mjs.map → SelectionSync-8y0nbBHZ.mjs.map} +1 -1
  62. package/dist/chunks/SimpleMark-DPTsIl9w.mjs +2 -0
  63. package/dist/chunks/{SimpleMark-D6vz3Nfd.mjs.map → SimpleMark-DPTsIl9w.mjs.map} +1 -1
  64. package/dist/chunks/SmartPastePlugin-BSMHDDQ2.mjs +2 -0
  65. package/dist/chunks/{SmartPastePlugin-BHsYKbgd.mjs.map → SmartPastePlugin-BSMHDDQ2.mjs.map} +1 -1
  66. package/dist/chunks/StrikethroughPlugin-CqqIF3Zk.mjs +2 -0
  67. package/dist/chunks/{StrikethroughPlugin-v-VJZzUZ.mjs.map → StrikethroughPlugin-CqqIF3Zk.mjs.map} +1 -1
  68. package/dist/chunks/SuperSubPlugin-5ZFM6wdU.mjs +2 -0
  69. package/dist/chunks/{SuperSubPlugin-x1iPnZyt.mjs.map → SuperSubPlugin-5ZFM6wdU.mjs.map} +1 -1
  70. package/dist/chunks/{TableDimensions-BSEOEox2.mjs → TableDimensions-B-OWjTuW.mjs} +2 -2
  71. package/dist/chunks/{TableDimensions-BSEOEox2.mjs.map → TableDimensions-B-OWjTuW.mjs.map} +1 -1
  72. package/dist/chunks/TablePlugin-D1Wg-pjl.mjs +2 -0
  73. package/dist/chunks/TablePlugin-D1Wg-pjl.mjs.map +1 -0
  74. package/dist/chunks/TableSelectionTypes-t2cLhe16.mjs +2 -0
  75. package/dist/chunks/TableSelectionTypes-t2cLhe16.mjs.map +1 -0
  76. package/dist/chunks/TextColorPlugin-Dwp7eW7F.mjs +2 -0
  77. package/dist/chunks/{TextColorPlugin-Bnl9of9E.mjs.map → TextColorPlugin-Dwp7eW7F.mjs.map} +1 -1
  78. package/dist/chunks/{TextDirectionAutoPlugin-DOH5cfyy.mjs → TextDirectionAutoPlugin-CkIETM5n.mjs} +2 -2
  79. package/dist/chunks/{TextDirectionAutoPlugin-DOH5cfyy.mjs.map → TextDirectionAutoPlugin-CkIETM5n.mjs.map} +1 -1
  80. package/dist/chunks/TextDirectionPlugin-DAcPR5Qc.mjs +2 -0
  81. package/dist/chunks/{TextDirectionPlugin-JwlR-R-b.mjs.map → TextDirectionPlugin-DAcPR5Qc.mjs.map} +1 -1
  82. package/dist/chunks/TextDirectionService-OFOU6r_s.mjs +2 -0
  83. package/dist/chunks/{TextDirectionService-BcX07mw2.mjs.map → TextDirectionService-OFOU6r_s.mjs.map} +1 -1
  84. package/dist/chunks/TextFormattingPlugin-vml-lduV.mjs +2 -0
  85. package/dist/chunks/{TextFormattingPlugin-Kc_UNoOz.mjs.map → TextFormattingPlugin-vml-lduV.mjs.map} +1 -1
  86. package/dist/chunks/ToolbarPlugin-Cxmb0MFr.mjs +2 -0
  87. package/dist/chunks/ToolbarPlugin-Cxmb0MFr.mjs.map +1 -0
  88. package/dist/chunks/VideoPlugin-lZCBlIon.mjs +2 -0
  89. package/dist/chunks/{VideoPlugin-DJXfuNA9.mjs.map → VideoPlugin-lZCBlIon.mjs.map} +1 -1
  90. package/dist/chunks/ar-Dp1oBWyG.mjs +2 -0
  91. package/dist/chunks/ar-Dp1oBWyG.mjs.map +1 -0
  92. package/dist/chunks/de-D3J8XPCR.mjs +2 -0
  93. package/dist/chunks/de-D3J8XPCR.mjs.map +1 -0
  94. package/dist/chunks/es-Bbz885DZ.mjs +2 -0
  95. package/dist/chunks/es-Bbz885DZ.mjs.map +1 -0
  96. package/dist/chunks/fr-GEgM1j3w.mjs +2 -0
  97. package/dist/chunks/fr-GEgM1j3w.mjs.map +1 -0
  98. package/dist/chunks/full-wDTdOuGt.mjs +2 -0
  99. package/dist/chunks/{full-BsWAZr1w.mjs.map → full-wDTdOuGt.mjs.map} +1 -1
  100. package/dist/chunks/hi-CKg8i4Mm.mjs +2 -0
  101. package/dist/chunks/hi-CKg8i4Mm.mjs.map +1 -0
  102. package/dist/chunks/minimal-FfmHwMGU.mjs +2 -0
  103. package/dist/chunks/{minimal-DO7LiFTa.mjs.map → minimal-FfmHwMGU.mjs.map} +1 -1
  104. package/dist/chunks/nl-2IdjTNeJ.mjs +2 -0
  105. package/dist/chunks/nl-2IdjTNeJ.mjs.map +1 -0
  106. package/dist/chunks/nl-B1i04NvZ.mjs +2 -0
  107. package/dist/chunks/nl-B1i04NvZ.mjs.map +1 -0
  108. package/dist/chunks/nl-BEmzpzKO.mjs +2 -0
  109. package/dist/chunks/nl-BEmzpzKO.mjs.map +1 -0
  110. package/dist/chunks/nl-B_U0D3Qq.mjs +2 -0
  111. package/dist/chunks/nl-B_U0D3Qq.mjs.map +1 -0
  112. package/dist/chunks/nl-C437Xz6z.mjs +2 -0
  113. package/dist/chunks/nl-C437Xz6z.mjs.map +1 -0
  114. package/dist/chunks/nl-C5P8Fogm.mjs +2 -0
  115. package/dist/chunks/nl-C5P8Fogm.mjs.map +1 -0
  116. package/dist/chunks/nl-CST62bzx.mjs +2 -0
  117. package/dist/chunks/nl-CST62bzx.mjs.map +1 -0
  118. package/dist/chunks/nl-CWQT-W-6.mjs +2 -0
  119. package/dist/chunks/nl-CWQT-W-6.mjs.map +1 -0
  120. package/dist/chunks/nl-CdpcDkbM.mjs +2 -0
  121. package/dist/chunks/nl-CdpcDkbM.mjs.map +1 -0
  122. package/dist/chunks/nl-CgYWZnga.mjs +2 -0
  123. package/dist/chunks/nl-CgYWZnga.mjs.map +1 -0
  124. package/dist/chunks/nl-Cr--x8bX.mjs +2 -0
  125. package/dist/chunks/nl-Cr--x8bX.mjs.map +1 -0
  126. package/dist/chunks/nl-Cwl5dxFZ.mjs +2 -0
  127. package/dist/chunks/nl-Cwl5dxFZ.mjs.map +1 -0
  128. package/dist/chunks/nl-Czjd9Bw9.mjs +2 -0
  129. package/dist/chunks/nl-Czjd9Bw9.mjs.map +1 -0
  130. package/dist/chunks/nl-DUOT2ZMQ.mjs +2 -0
  131. package/dist/chunks/nl-DUOT2ZMQ.mjs.map +1 -0
  132. package/dist/chunks/nl-DYnRYvZ5.mjs +2 -0
  133. package/dist/chunks/nl-DYnRYvZ5.mjs.map +1 -0
  134. package/dist/chunks/nl-DaNJ-ffX.mjs +2 -0
  135. package/dist/chunks/nl-DaNJ-ffX.mjs.map +1 -0
  136. package/dist/chunks/nl-DeOJ64xy.mjs +2 -0
  137. package/dist/chunks/nl-DeOJ64xy.mjs.map +1 -0
  138. package/dist/chunks/nl-DwZajfpP.mjs +2 -0
  139. package/dist/chunks/nl-DwZajfpP.mjs.map +1 -0
  140. package/dist/chunks/nl-Dyjc9M7o.mjs +2 -0
  141. package/dist/chunks/nl-Dyjc9M7o.mjs.map +1 -0
  142. package/dist/chunks/nl-GBpv7W4L.mjs +2 -0
  143. package/dist/chunks/nl-GBpv7W4L.mjs.map +1 -0
  144. package/dist/chunks/nl-HFfWJOEo.mjs +2 -0
  145. package/dist/chunks/nl-HFfWJOEo.mjs.map +1 -0
  146. package/dist/chunks/nl-KqmiCeD7.mjs +2 -0
  147. package/dist/chunks/nl-KqmiCeD7.mjs.map +1 -0
  148. package/dist/chunks/nl-_QT7e2Qt.mjs +2 -0
  149. package/dist/chunks/nl-_QT7e2Qt.mjs.map +1 -0
  150. package/dist/chunks/nl-i79IajbC.mjs +2 -0
  151. package/dist/chunks/nl-i79IajbC.mjs.map +1 -0
  152. package/dist/chunks/nl-lcZvrAz6.mjs +2 -0
  153. package/dist/chunks/nl-lcZvrAz6.mjs.map +1 -0
  154. package/dist/chunks/nl-tWJ2imhe.mjs +2 -0
  155. package/dist/chunks/nl-tWJ2imhe.mjs.map +1 -0
  156. package/dist/chunks/nl-xfiNOCgg.mjs +2 -0
  157. package/dist/chunks/nl-xfiNOCgg.mjs.map +1 -0
  158. package/dist/chunks/pt-DP5c76Vo.mjs +2 -0
  159. package/dist/chunks/pt-DP5c76Vo.mjs.map +1 -0
  160. package/dist/chunks/register-DSRtHVkk.mjs +3 -0
  161. package/dist/chunks/register-DSRtHVkk.mjs.map +1 -0
  162. package/dist/chunks/ru--iYEtsT5.mjs +2 -0
  163. package/dist/chunks/ru--iYEtsT5.mjs.map +1 -0
  164. package/dist/chunks/src-DDkRstYh.mjs +2 -0
  165. package/dist/chunks/src-DDkRstYh.mjs.map +1 -0
  166. package/dist/chunks/zh-DUS7JduA.mjs +2 -0
  167. package/dist/chunks/zh-DUS7JduA.mjs.map +1 -0
  168. package/dist/commands/Commands.d.ts +3 -0
  169. package/dist/commands/Commands.d.ts.map +1 -1
  170. package/dist/commands/CompositionCommands.d.ts +14 -8
  171. package/dist/commands/CompositionCommands.d.ts.map +1 -1
  172. package/dist/commands/CompositionFallback.d.ts +13 -0
  173. package/dist/commands/CompositionFallback.d.ts.map +1 -0
  174. package/dist/commands/CompositionRebase.d.ts +17 -10
  175. package/dist/commands/CompositionRebase.d.ts.map +1 -1
  176. package/dist/editor/locales/nl.d.ts +4 -0
  177. package/dist/editor/locales/nl.d.ts.map +1 -0
  178. package/dist/editor/styles/link.d.ts +2 -2
  179. package/dist/editor/styles/link.d.ts.map +1 -1
  180. package/dist/fonts.mjs +1 -1
  181. package/dist/full.mjs +1 -1
  182. package/dist/html.mjs +1 -1
  183. package/dist/i18n/Locale.d.ts +1 -0
  184. package/dist/i18n/Locale.d.ts.map +1 -1
  185. package/dist/input/CompositionController.d.ts.map +1 -1
  186. package/dist/input/HTMLLineBreaks.d.ts +14 -0
  187. package/dist/input/HTMLLineBreaks.d.ts.map +1 -0
  188. package/dist/input/HTMLParser.d.ts +1 -7
  189. package/dist/input/HTMLParser.d.ts.map +1 -1
  190. package/dist/input/PasteHTMLHandler.d.ts +0 -1
  191. package/dist/input/PasteHTMLHandler.d.ts.map +1 -1
  192. package/dist/markdown.mjs +1 -1
  193. package/dist/notectl-core.mjs +1 -1
  194. package/dist/notectl-core.umd.js +1 -1
  195. package/dist/notectl-core.umd.js.map +1 -1
  196. package/dist/plugins/PluginContextFactory.d.ts +1 -0
  197. package/dist/plugins/PluginContextFactory.d.ts.map +1 -1
  198. package/dist/plugins/PluginManager.d.ts +5 -0
  199. package/dist/plugins/PluginManager.d.ts.map +1 -1
  200. package/dist/plugins/alignment/locales/nl.d.ts +4 -0
  201. package/dist/plugins/alignment/locales/nl.d.ts.map +1 -0
  202. package/dist/plugins/alignment.mjs +1 -1
  203. package/dist/plugins/bidi-isolation/locales/nl.d.ts +4 -0
  204. package/dist/plugins/bidi-isolation/locales/nl.d.ts.map +1 -0
  205. package/dist/plugins/bidi-isolation.mjs +1 -1
  206. package/dist/plugins/blockquote/locales/nl.d.ts +4 -0
  207. package/dist/plugins/blockquote/locales/nl.d.ts.map +1 -0
  208. package/dist/plugins/blockquote.mjs +1 -1
  209. package/dist/plugins/caret-navigation/locales/nl.d.ts +4 -0
  210. package/dist/plugins/caret-navigation/locales/nl.d.ts.map +1 -0
  211. package/dist/plugins/caret-navigation.mjs +1 -1
  212. package/dist/plugins/code-block/locales/nl.d.ts +4 -0
  213. package/dist/plugins/code-block/locales/nl.d.ts.map +1 -0
  214. package/dist/plugins/code-block.mjs +1 -1
  215. package/dist/plugins/editor-ui/EditorUI.d.ts +50 -0
  216. package/dist/plugins/editor-ui/EditorUI.d.ts.map +1 -0
  217. package/dist/plugins/editor-ui/EditorUIRuntime.d.ts +44 -0
  218. package/dist/plugins/editor-ui/EditorUIRuntime.d.ts.map +1 -0
  219. package/dist/plugins/editor-ui/index.d.ts +6 -0
  220. package/dist/plugins/editor-ui/index.d.ts.map +1 -0
  221. package/dist/plugins/font/locales/nl.d.ts +4 -0
  222. package/dist/plugins/font/locales/nl.d.ts.map +1 -0
  223. package/dist/plugins/font-size/locales/nl.d.ts +4 -0
  224. package/dist/plugins/font-size/locales/nl.d.ts.map +1 -0
  225. package/dist/plugins/font-size.mjs +1 -1
  226. package/dist/plugins/font.mjs +1 -1
  227. package/dist/plugins/formula/locales/nl.d.ts +4 -0
  228. package/dist/plugins/formula/locales/nl.d.ts.map +1 -0
  229. package/dist/plugins/formula.mjs +1 -1
  230. package/dist/plugins/gap-cursor/locales/nl.d.ts +4 -0
  231. package/dist/plugins/gap-cursor/locales/nl.d.ts.map +1 -0
  232. package/dist/plugins/gap-cursor.mjs +1 -1
  233. package/dist/plugins/hard-break.mjs +1 -1
  234. package/dist/plugins/heading/locales/nl.d.ts +4 -0
  235. package/dist/plugins/heading/locales/nl.d.ts.map +1 -0
  236. package/dist/plugins/heading.mjs +1 -1
  237. package/dist/plugins/highlight/locales/nl.d.ts +4 -0
  238. package/dist/plugins/highlight/locales/nl.d.ts.map +1 -0
  239. package/dist/plugins/highlight.mjs +1 -1
  240. package/dist/plugins/horizontal-rule/locales/nl.d.ts +4 -0
  241. package/dist/plugins/horizontal-rule/locales/nl.d.ts.map +1 -0
  242. package/dist/plugins/horizontal-rule.mjs +1 -1
  243. package/dist/plugins/image/locales/nl.d.ts +4 -0
  244. package/dist/plugins/image/locales/nl.d.ts.map +1 -0
  245. package/dist/plugins/image.mjs +1 -1
  246. package/dist/plugins/inline-code/locales/nl.d.ts +4 -0
  247. package/dist/plugins/inline-code/locales/nl.d.ts.map +1 -0
  248. package/dist/plugins/inline-code.mjs +1 -1
  249. package/dist/plugins/link/{LinkPreview.d.ts → LinkBubble.d.ts} +10 -7
  250. package/dist/plugins/link/LinkBubble.d.ts.map +1 -0
  251. package/dist/plugins/link/LinkBubbleContent.d.ts +4 -0
  252. package/dist/plugins/link/LinkBubbleContent.d.ts.map +1 -0
  253. package/dist/plugins/link/LinkInteractionController.d.ts +17 -3
  254. package/dist/plugins/link/LinkInteractionController.d.ts.map +1 -1
  255. package/dist/plugins/link/LinkLocale.d.ts +3 -0
  256. package/dist/plugins/link/LinkLocale.d.ts.map +1 -1
  257. package/dist/plugins/link/LinkPlugin.d.ts +0 -1
  258. package/dist/plugins/link/LinkPlugin.d.ts.map +1 -1
  259. package/dist/plugins/link/LinkRange.d.ts +12 -0
  260. package/dist/plugins/link/LinkRange.d.ts.map +1 -0
  261. package/dist/plugins/link/locales/ar.d.ts.map +1 -1
  262. package/dist/plugins/link/locales/de.d.ts.map +1 -1
  263. package/dist/plugins/link/locales/es.d.ts.map +1 -1
  264. package/dist/plugins/link/locales/fr.d.ts.map +1 -1
  265. package/dist/plugins/link/locales/hi.d.ts.map +1 -1
  266. package/dist/plugins/link/locales/nl.d.ts +4 -0
  267. package/dist/plugins/link/locales/nl.d.ts.map +1 -0
  268. package/dist/plugins/link/locales/pt.d.ts.map +1 -1
  269. package/dist/plugins/link/locales/ru.d.ts.map +1 -1
  270. package/dist/plugins/link/locales/zh.d.ts.map +1 -1
  271. package/dist/plugins/link.mjs +1 -1
  272. package/dist/plugins/list/locales/nl.d.ts +4 -0
  273. package/dist/plugins/list/locales/nl.d.ts.map +1 -0
  274. package/dist/plugins/list.mjs +1 -1
  275. package/dist/plugins/print/locales/nl.d.ts +4 -0
  276. package/dist/plugins/print/locales/nl.d.ts.map +1 -0
  277. package/dist/plugins/print.mjs +1 -1
  278. package/dist/plugins/shared/PopupManager.d.ts +15 -2
  279. package/dist/plugins/shared/PopupManager.d.ts.map +1 -1
  280. package/dist/plugins/shared/PopupPositioning.d.ts +2 -6
  281. package/dist/plugins/shared/PopupPositioning.d.ts.map +1 -1
  282. package/dist/plugins/shared/index.d.ts +1 -1
  283. package/dist/plugins/shared/index.d.ts.map +1 -1
  284. package/dist/plugins/shared.mjs +1 -1
  285. package/dist/plugins/smart-paste/locales/nl.d.ts +4 -0
  286. package/dist/plugins/smart-paste/locales/nl.d.ts.map +1 -0
  287. package/dist/plugins/smart-paste.mjs +1 -1
  288. package/dist/plugins/strikethrough/locales/nl.d.ts +4 -0
  289. package/dist/plugins/strikethrough/locales/nl.d.ts.map +1 -0
  290. package/dist/plugins/strikethrough.mjs +1 -1
  291. package/dist/plugins/super-sub/locales/nl.d.ts +4 -0
  292. package/dist/plugins/super-sub/locales/nl.d.ts.map +1 -0
  293. package/dist/plugins/super-sub.mjs +1 -1
  294. package/dist/plugins/table/TableContextMenu.d.ts.map +1 -1
  295. package/dist/plugins/table/TableSelection.d.ts +4 -20
  296. package/dist/plugins/table/TableSelection.d.ts.map +1 -1
  297. package/dist/plugins/table/TableSelectionTypes.d.ts +21 -0
  298. package/dist/plugins/table/TableSelectionTypes.d.ts.map +1 -0
  299. package/dist/plugins/table/locales/nl.d.ts +4 -0
  300. package/dist/plugins/table/locales/nl.d.ts.map +1 -0
  301. package/dist/plugins/table.mjs +1 -1
  302. package/dist/plugins/text-color/locales/nl.d.ts +4 -0
  303. package/dist/plugins/text-color/locales/nl.d.ts.map +1 -0
  304. package/dist/plugins/text-color.mjs +1 -1
  305. package/dist/plugins/text-direction/locales/nl.d.ts +4 -0
  306. package/dist/plugins/text-direction/locales/nl.d.ts.map +1 -0
  307. package/dist/plugins/text-direction-auto.mjs +1 -1
  308. package/dist/plugins/text-direction.mjs +1 -1
  309. package/dist/plugins/text-formatting/locales/nl.d.ts +4 -0
  310. package/dist/plugins/text-formatting/locales/nl.d.ts.map +1 -0
  311. package/dist/plugins/text-formatting.mjs +1 -1
  312. package/dist/plugins/toolbar/ToolbarOverflowController.d.ts +2 -2
  313. package/dist/plugins/toolbar/ToolbarOverflowController.d.ts.map +1 -1
  314. package/dist/plugins/toolbar/ToolbarPlugin.d.ts +2 -1
  315. package/dist/plugins/toolbar/ToolbarPlugin.d.ts.map +1 -1
  316. package/dist/plugins/toolbar/ToolbarPopupController.d.ts +8 -3
  317. package/dist/plugins/toolbar/ToolbarPopupController.d.ts.map +1 -1
  318. package/dist/plugins/toolbar/ToolbarRegistry.d.ts +4 -0
  319. package/dist/plugins/toolbar/ToolbarRegistry.d.ts.map +1 -1
  320. package/dist/plugins/toolbar/locales/nl.d.ts +4 -0
  321. package/dist/plugins/toolbar/locales/nl.d.ts.map +1 -0
  322. package/dist/plugins/toolbar.mjs +1 -1
  323. package/dist/plugins/video/locales/nl.d.ts +4 -0
  324. package/dist/plugins/video/locales/nl.d.ts.map +1 -0
  325. package/dist/plugins/video.mjs +1 -1
  326. package/dist/presets/full.mjs +1 -1
  327. package/dist/presets/minimal.mjs +1 -1
  328. package/dist/presets.mjs +1 -1
  329. package/dist/register.mjs +1 -1
  330. package/dist/serialization/DocumentParser.d.ts +2 -2
  331. package/dist/serialization/DocumentParser.d.ts.map +1 -1
  332. package/dist/serialization/HTMLParseRules.d.ts.map +1 -1
  333. package/dist/serialization/HTMLSanitization.d.ts +6 -0
  334. package/dist/serialization/HTMLSanitization.d.ts.map +1 -1
  335. package/dist/serialization/PreformattedText.d.ts +3 -0
  336. package/dist/serialization/PreformattedText.d.ts.map +1 -0
  337. package/dist/state/RangeMapping.d.ts +10 -0
  338. package/dist/state/RangeMapping.d.ts.map +1 -0
  339. package/dist/ui.d.ts +3 -0
  340. package/dist/ui.d.ts.map +1 -0
  341. package/dist/ui.mjs +1 -0
  342. package/dist/view/EditorInteraction.d.ts +23 -0
  343. package/dist/view/EditorInteraction.d.ts.map +1 -0
  344. package/dist/view/EditorView.d.ts +2 -0
  345. package/dist/view/EditorView.d.ts.map +1 -1
  346. package/dist/view/SelectionGeometry.d.ts +29 -0
  347. package/dist/view/SelectionGeometry.d.ts.map +1 -0
  348. package/dist/view/SelectionObserver.d.ts +19 -0
  349. package/dist/view/SelectionObserver.d.ts.map +1 -0
  350. package/dist/view/SelectionSync.d.ts +7 -0
  351. package/dist/view/SelectionSync.d.ts.map +1 -1
  352. package/package.json +6 -2
  353. package/dist/chunks/AlignmentPlugin-Cp7HYGaH.mjs +0 -2
  354. package/dist/chunks/BidiIsolationPlugin-GWukKdgJ.mjs +0 -2
  355. package/dist/chunks/BlockquotePlugin-CSL_7Yit.mjs +0 -2
  356. package/dist/chunks/CaretNavigationPlugin-BQPqqK4n.mjs +0 -2
  357. package/dist/chunks/CodeBlockPlugin-B4AcDJRK.mjs +0 -2
  358. package/dist/chunks/Commands-Bk7Cl1nH.mjs +0 -2
  359. package/dist/chunks/DocumentParser-C99N0MWF.mjs +0 -2
  360. package/dist/chunks/DocumentParser-C99N0MWF.mjs.map +0 -1
  361. package/dist/chunks/FontPlugin-BcXNFqqO.mjs +0 -2
  362. package/dist/chunks/FontSizePlugin-Dswra3oU.mjs +0 -2
  363. package/dist/chunks/FormulaPlugin-DVpLaKi5.mjs +0 -2
  364. package/dist/chunks/GapCursorPlugin-QDGwnaRR.mjs +0 -2
  365. package/dist/chunks/HTMLSanitization-Ce9dVT1q.mjs +0 -2
  366. package/dist/chunks/HTMLSanitization-Ce9dVT1q.mjs.map +0 -1
  367. package/dist/chunks/HeadingPlugin-B7EfynaH.mjs +0 -2
  368. package/dist/chunks/HighlightPlugin-LdO0INtJ.mjs +0 -2
  369. package/dist/chunks/HorizontalRulePlugin-YywXVZYr.mjs +0 -2
  370. package/dist/chunks/ImagePlugin-BAhZuVdE.mjs +0 -2
  371. package/dist/chunks/InlineCodePlugin-Bu9-rE4B.mjs +0 -2
  372. package/dist/chunks/LinkPlugin-CAUaWW5-.mjs +0 -2
  373. package/dist/chunks/LinkPlugin-CAUaWW5-.mjs.map +0 -1
  374. package/dist/chunks/ListPlugin-U1r4p_fE.mjs +0 -2
  375. package/dist/chunks/PluginHelpers-B3gk3VB3.mjs +0 -2
  376. package/dist/chunks/PluginHelpers-B3gk3VB3.mjs.map +0 -1
  377. package/dist/chunks/PopupManager-Dxv0OVMo.mjs +0 -2
  378. package/dist/chunks/PopupManager-Dxv0OVMo.mjs.map +0 -1
  379. package/dist/chunks/PrintPlugin-DAEiEyKQ.mjs +0 -2
  380. package/dist/chunks/SimpleMark-D6vz3Nfd.mjs +0 -2
  381. package/dist/chunks/SmartPastePlugin-BHsYKbgd.mjs +0 -2
  382. package/dist/chunks/StrikethroughPlugin-v-VJZzUZ.mjs +0 -2
  383. package/dist/chunks/SuperSubPlugin-x1iPnZyt.mjs +0 -2
  384. package/dist/chunks/TablePlugin-CjKThPug.mjs +0 -2
  385. package/dist/chunks/TablePlugin-CjKThPug.mjs.map +0 -1
  386. package/dist/chunks/TextColorPlugin-Bnl9of9E.mjs +0 -2
  387. package/dist/chunks/TextDirectionPlugin-JwlR-R-b.mjs +0 -2
  388. package/dist/chunks/TextDirectionService-BcX07mw2.mjs +0 -2
  389. package/dist/chunks/TextFormattingPlugin-Kc_UNoOz.mjs +0 -2
  390. package/dist/chunks/ToolbarPlugin-CgZA2hz8.mjs +0 -2
  391. package/dist/chunks/ToolbarPlugin-CgZA2hz8.mjs.map +0 -1
  392. package/dist/chunks/VideoPlugin-DJXfuNA9.mjs +0 -2
  393. package/dist/chunks/ar-DhwCFHql.mjs +0 -2
  394. package/dist/chunks/ar-DhwCFHql.mjs.map +0 -1
  395. package/dist/chunks/de-CjLUbQmg.mjs +0 -2
  396. package/dist/chunks/de-CjLUbQmg.mjs.map +0 -1
  397. package/dist/chunks/es-CMSzvjOT.mjs +0 -2
  398. package/dist/chunks/es-CMSzvjOT.mjs.map +0 -1
  399. package/dist/chunks/fr-DB_OvHWH.mjs +0 -2
  400. package/dist/chunks/fr-DB_OvHWH.mjs.map +0 -1
  401. package/dist/chunks/full-BsWAZr1w.mjs +0 -2
  402. package/dist/chunks/hi-ChNQZZ1z.mjs +0 -2
  403. package/dist/chunks/hi-ChNQZZ1z.mjs.map +0 -1
  404. package/dist/chunks/minimal-DO7LiFTa.mjs +0 -2
  405. package/dist/chunks/pt-CI8t6oul.mjs +0 -2
  406. package/dist/chunks/pt-CI8t6oul.mjs.map +0 -1
  407. package/dist/chunks/register-DXLu8Njp.mjs +0 -3
  408. package/dist/chunks/register-DXLu8Njp.mjs.map +0 -1
  409. package/dist/chunks/ru-9WtNGZtl.mjs +0 -2
  410. package/dist/chunks/ru-9WtNGZtl.mjs.map +0 -1
  411. package/dist/chunks/src-5GKFQ2mQ.mjs +0 -2
  412. package/dist/chunks/src-5GKFQ2mQ.mjs.map +0 -1
  413. package/dist/chunks/zh-BrqJ4ywP.mjs +0 -2
  414. package/dist/chunks/zh-BrqJ4ywP.mjs.map +0 -1
  415. package/dist/plugins/link/LinkPreview.d.ts.map +0 -1
@@ -24,4 +24,10 @@ export declare function preserveHTMLIdSanitizeConfig(...additionalForbiddenAttrs
24
24
  * plugin policy into that invocation.
25
25
  */
26
26
  export declare function sanitizeHTML(html: string, config: Config, registry?: SchemaRegistry): string;
27
+ /**
28
+ * Keeps sanitized input as DOM instead of serializing and reparsing it. Each
29
+ * HTML parse discards a leading newline in `<pre>`, so import/paste must only
30
+ * parse the original string once. Subsequent sanitization can consume the DOM.
31
+ */
32
+ export declare function sanitizeHTMLFragment(html: string | DocumentFragment, config: Config, registry?: SchemaRegistry): DocumentFragment;
27
33
  //# sourceMappingURL=HTMLSanitization.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"HTMLSanitization.d.ts","sourceRoot":"","sources":["../../src/serialization/HTMLSanitization.ts"],"names":[],"mappings":"AAAA,OAAwB,EAAE,KAAK,MAAM,EAAkB,MAAM,WAAW,CAAC;AAEzE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAEjE,gEAAgE;AAChE,MAAM,WAAW,oBAAoB;IACpC,QAAQ,CAAC,YAAY,EAAE,KAAK,CAAC;IAC7B,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;CAChC;AAED;;;;;;;GAOG;AACH,wBAAgB,4BAA4B,CAC3C,GAAG,wBAAwB,EAAE,SAAS,MAAM,EAAE,GAC5C,oBAAoB,CAItB;AAED;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,cAAc,GAAG,MAAM,CA4B5F"}
1
+ {"version":3,"file":"HTMLSanitization.d.ts","sourceRoot":"","sources":["../../src/serialization/HTMLSanitization.ts"],"names":[],"mappings":"AAAA,OAAwB,EAAE,KAAK,MAAM,EAAkB,MAAM,WAAW,CAAC;AAEzE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAEjE,gEAAgE;AAChE,MAAM,WAAW,oBAAoB;IACpC,QAAQ,CAAC,YAAY,EAAE,KAAK,CAAC;IAC7B,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;CAChC;AAED;;;;;;;GAOG;AACH,wBAAgB,4BAA4B,CAC3C,GAAG,wBAAwB,EAAE,SAAS,MAAM,EAAE,GAC5C,oBAAoB,CAItB;AAED;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,cAAc,GAAG,MAAM,CAE5F;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CACnC,IAAI,EAAE,MAAM,GAAG,gBAAgB,EAC/B,MAAM,EAAE,MAAM,EACd,QAAQ,CAAC,EAAE,cAAc,GACvB,gBAAgB,CAElB"}
@@ -0,0 +1,3 @@
1
+ /** Reads preformatted text without marks, retaining both literal newlines and `<br>` lines. */
2
+ export declare function readPreformattedText(element: HTMLElement): string;
3
+ //# sourceMappingURL=PreformattedText.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PreformattedText.d.ts","sourceRoot":"","sources":["../../src/serialization/PreformattedText.ts"],"names":[],"mappings":"AAAA,+FAA+F;AAC/F,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,WAAW,GAAG,MAAM,CAUjE"}
@@ -0,0 +1,10 @@
1
+ import { BlockId } from '../model/TypeBrands.js';
2
+ import { MappedInBlockRange, Mapping } from './Mapping.js';
3
+ /**
4
+ * Returns where the content of `(blockId, [from, to))` lives after `mapping`.
5
+ *
6
+ * @returns Non-empty in-block ranges in the order of the original content;
7
+ * empty when the range was empty or all its content was deleted.
8
+ */
9
+ export declare function mapRangeContent(blockId: BlockId, from: number, to: number, mapping: Mapping): readonly MappedInBlockRange[];
10
+ //# sourceMappingURL=RangeMapping.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RangeMapping.d.ts","sourceRoot":"","sources":["../../src/state/RangeMapping.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,KAAK,EACX,kBAAkB,EAClB,OAAO,EAKP,MAAM,cAAc,CAAC;AAEtB;;;;;GAKG;AACH,wBAAgB,eAAe,CAC9B,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,MAAM,EACV,OAAO,EAAE,OAAO,GACd,SAAS,kBAAkB,EAAE,CAM/B"}
package/dist/ui.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ /** Public, renderer-independent editor UI contracts. */
2
+ export * from './plugins/editor-ui/index.js';
3
+ //# sourceMappingURL=ui.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ui.d.ts","sourceRoot":"","sources":["../src/ui.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,cAAc,8BAA8B,CAAC"}
package/dist/ui.mjs ADDED
@@ -0,0 +1 @@
1
+ import{n as r}from"./chunks/PopupManager-DpxoBl54.mjs";import{t as o}from"./chunks/EditorUI-DrQI95FW.mjs";export{o as EditorUIServiceKey,r as PopupServiceKey};
@@ -0,0 +1,23 @@
1
+ import { CompositionState } from '../model/CompositionState.js';
2
+ import { EditorState } from '../state/EditorState.js';
3
+ export declare class EditorInteraction {
4
+ private readonly container;
5
+ private readonly getState;
6
+ private readonly composition;
7
+ private readonly elements;
8
+ private destroyed;
9
+ private ready;
10
+ private readonly onFocus;
11
+ constructor(container: HTMLElement, getState: () => EditorState, composition: () => CompositionState);
12
+ start(): void;
13
+ register(element: HTMLElement): () => void;
14
+ contains(node: Node | null): boolean;
15
+ focus(element: HTMLElement): boolean;
16
+ focusEditor(): boolean;
17
+ /** Updates may render while an input or another editor owns the browser selection. */
18
+ shouldSyncSelection(): boolean;
19
+ destroy(): void;
20
+ private activeElement;
21
+ private restoreSelection;
22
+ }
23
+ //# sourceMappingURL=EditorInteraction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EditorInteraction.d.ts","sourceRoot":"","sources":["../../src/view/EditorInteraction.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAG3D,qBAAa,iBAAiB;IAS5B,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,QAAQ;IACzB,OAAO,CAAC,QAAQ,CAAC,WAAW;IAV7B,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAkC;IAC3D,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,KAAK,CAAS;IACtB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAEtB;gBAGgB,SAAS,EAAE,WAAW,EACtB,QAAQ,EAAE,MAAM,WAAW,EAC3B,WAAW,EAAE,MAAM,gBAAgB;IAKrD,KAAK,IAAI,IAAI;IAIb,QAAQ,CAAC,OAAO,EAAE,WAAW,GAAG,MAAM,IAAI;IAa1C,QAAQ,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,GAAG,OAAO;IAapC,KAAK,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO;IAYpC,WAAW,IAAI,OAAO;IAQtB,sFAAsF;IACtF,mBAAmB,IAAI,OAAO;IAO9B,OAAO,IAAI,IAAI;IAMf,OAAO,CAAC,aAAa;IAMrB,OAAO,CAAC,gBAAgB;CAKxB"}
@@ -30,6 +30,7 @@ export interface EditorViewOptions {
30
30
  compositionState?: CompositionState;
31
31
  /** Shared plugin callback error boundary supplied by PluginManager. */
32
32
  callbackExecutor?: PluginCallbackExecutor;
33
+ shouldSyncSelection?: () => boolean;
33
34
  }
34
35
  export declare class EditorView {
35
36
  private state;
@@ -52,6 +53,7 @@ export declare class EditorView {
52
53
  private readonly getDecorations?;
53
54
  private readonly isReadOnly;
54
55
  private readonly isReadonlyBypassed;
56
+ private readonly shouldSyncSelection;
55
57
  private readonly compositionState;
56
58
  private readonly cursorWrapper;
57
59
  private readonly navigation;
@@ -1 +1 @@
1
- {"version":3,"file":"EditorView.d.ts","sourceRoot":"","sources":["../../src/view/EditorView.ts"],"names":[],"mappings":"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"}
1
+ {"version":3,"file":"EditorView.d.ts","sourceRoot":"","sources":["../../src/view/EditorView.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,29 @@
1
+ import { EditorSelection } from '../model/Selection.js';
2
+ import { BlockId } from '../model/TypeBrands.js';
3
+ /** Immutable CSS pixel rectangle in viewport coordinates. */
4
+ export interface ViewportRect {
5
+ readonly x: number;
6
+ readonly y: number;
7
+ readonly top: number;
8
+ readonly right: number;
9
+ readonly bottom: number;
10
+ readonly left: number;
11
+ readonly width: number;
12
+ readonly height: number;
13
+ }
14
+ export interface SelectionGeometry {
15
+ readonly bounds: ViewportRect;
16
+ readonly rects: readonly ViewportRect[];
17
+ /** Directional endpoints, including backward text selections. */
18
+ readonly anchor: ViewportRect;
19
+ readonly focus: ViewportRect;
20
+ }
21
+ export interface SelectionView {
22
+ readonly type: 'text' | 'node' | 'gap' | 'cell';
23
+ readonly collapsed: boolean;
24
+ /** Null while hidden, detached, composing, or before the selection can be mapped. */
25
+ readonly geometry: SelectionGeometry | null;
26
+ }
27
+ export declare function snapshotRect(rect: ViewportRect): ViewportRect;
28
+ export declare function measureSelection(container: HTMLElement, selection: EditorSelection, cellIds?: readonly BlockId[], composing?: boolean): SelectionView;
29
+ //# sourceMappingURL=SelectionGeometry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SelectionGeometry.d.ts","sourceRoot":"","sources":["../../src/view/SelectionGeometry.ts"],"names":[],"mappings":"AAAA,oFAAoF;AACpF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAE7D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAKtD,6DAA6D;AAC7D,MAAM,WAAW,YAAY;IAC5B,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,iBAAiB;IACjC,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAC9B,QAAQ,CAAC,KAAK,EAAE,SAAS,YAAY,EAAE,CAAC;IACxC,iEAAiE;IACjE,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAC9B,QAAQ,CAAC,KAAK,EAAE,YAAY,CAAC;CAC7B;AAED,MAAM,WAAW,aAAa;IAC7B,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,KAAK,GAAG,MAAM,CAAC;IAChD,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAC5B,qFAAqF;IACrF,QAAQ,CAAC,QAAQ,EAAE,iBAAiB,GAAG,IAAI,CAAC;CAC5C;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,YAAY,GAAG,YAAY,CAG7D;AAyFD,wBAAgB,gBAAgB,CAC/B,SAAS,EAAE,WAAW,EACtB,SAAS,EAAE,eAAe,EAC1B,OAAO,GAAE,SAAS,OAAO,EAAO,EAChC,SAAS,UAAQ,GACf,aAAa,CAsBf"}
@@ -0,0 +1,19 @@
1
+ import { SelectionView } from './SelectionGeometry.js';
2
+ export declare class SelectionObserver {
3
+ private readonly container;
4
+ private readonly measure;
5
+ private readonly reportError;
6
+ private readonly listeners;
7
+ private cleanups;
8
+ private frame;
9
+ private destroyed;
10
+ private previous;
11
+ constructor(container: HTMLElement, measure: () => SelectionView, reportError: (error: unknown) => void);
12
+ subscribe(listener: (view: SelectionView) => void): () => void;
13
+ readonly invalidate: () => void;
14
+ destroy(): void;
15
+ private deliver;
16
+ private observe;
17
+ private stop;
18
+ }
19
+ //# sourceMappingURL=SelectionObserver.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SelectionObserver.d.ts","sourceRoot":"","sources":["../../src/view/SelectionObserver.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAE5D,qBAAa,iBAAiB;IAQ5B,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,WAAW;IAT7B,OAAO,CAAC,QAAQ,CAAC,SAAS,CAA4C;IACtE,OAAO,CAAC,QAAQ,CAAsB;IACtC,OAAO,CAAC,KAAK,CAAuB;IACpC,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,QAAQ,CAAM;gBAGJ,SAAS,EAAE,WAAW,EACtB,OAAO,EAAE,MAAM,aAAa,EAC5B,WAAW,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI;IAGvD,SAAS,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,aAAa,KAAK,IAAI,GAAG,MAAM,IAAI;IAW9D,QAAQ,CAAC,UAAU,QAAO,IAAI,CAY5B;IAEF,OAAO,IAAI,IAAI;IAMf,OAAO,CAAC,OAAO;IAQf,OAAO,CAAC,OAAO;IAgDf,OAAO,CAAC,IAAI;CAOZ"}
@@ -1,4 +1,8 @@
1
1
  import { EditorSelection, Position, Selection } from '../model/Selection.js';
2
+ interface DOMPosition {
3
+ node: Node;
4
+ offset: number;
5
+ }
2
6
  /** Gets the selection object for writing (collapse, setBaseAndExtent). */
3
7
  export declare function getSelection(): globalThis.Selection | null;
4
8
  /**
@@ -50,6 +54,9 @@ export declare function readSelectionFromDOM(container: HTMLElement): Selection
50
54
  * container or cannot be mapped to a block position.
51
55
  */
52
56
  export declare function domRangeToState(container: HTMLElement, range: AbstractRange): Selection | null;
57
+ /** Converts a state position (blockId + offset) to a DOM position (node + offset). */
58
+ export declare function statePositionToDOM(container: HTMLElement, pos: Position): DOMPosition | null;
53
59
  /** Converts a DOM position to a state position, including nested path. */
54
60
  export declare function domPositionToState(container: HTMLElement, node: Node, domOffset: number): Position | null;
61
+ export {};
55
62
  //# sourceMappingURL=SelectionSync.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"SelectionSync.d.ts","sourceRoot":"","sources":["../../src/view/SelectionSync.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAuClF,0EAA0E;AAC1E,wBAAgB,YAAY,IAAI,UAAU,CAAC,SAAS,GAAG,IAAI,CAE1D;AAED;;;;GAIG;AACH,MAAM,WAAW,kBAAkB;IAClC,UAAU,EAAE,IAAI,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,IAAI,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,qBAAqB,CACpC,SAAS,EAAE,WAAW,EACtB,GAAG,EAAE,UAAU,CAAC,SAAS,GACvB,kBAAkB,GAAG,IAAI,CAsC3B;AAED;;;;;;;;;GASG;AACH,wBAAgB,yBAAyB,CACxC,SAAS,EAAE,WAAW,EACtB,MAAM,EAAE,UAAU,CAAC,SAAS,GAC1B,kBAAkB,GAAG,IAAI,CAe3B;AAED,mDAAmD;AACnD,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,WAAW,EAAE,SAAS,EAAE,eAAe,GAAG,IAAI,CAmC3F;AAED,4EAA4E;AAC5E,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,WAAW,GAAG,SAAS,GAAG,IAAI,CAiB7E;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,SAAS,EAAE,WAAW,EAAE,KAAK,EAAE,aAAa,GAAG,SAAS,GAAG,IAAI,CAU9F;AAsED,0EAA0E;AAC1E,wBAAgB,kBAAkB,CACjC,SAAS,EAAE,WAAW,EACtB,IAAI,EAAE,IAAI,EACV,SAAS,EAAE,MAAM,GACf,QAAQ,GAAG,IAAI,CA+DjB"}
1
+ {"version":3,"file":"SelectionSync.d.ts","sourceRoot":"","sources":["../../src/view/SelectionSync.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAgBlF,UAAU,WAAW;IACpB,IAAI,EAAE,IAAI,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;CACf;AAoBD,0EAA0E;AAC1E,wBAAgB,YAAY,IAAI,UAAU,CAAC,SAAS,GAAG,IAAI,CAE1D;AAED;;;;GAIG;AACH,MAAM,WAAW,kBAAkB;IAClC,UAAU,EAAE,IAAI,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,IAAI,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,qBAAqB,CACpC,SAAS,EAAE,WAAW,EACtB,GAAG,EAAE,UAAU,CAAC,SAAS,GACvB,kBAAkB,GAAG,IAAI,CAsC3B;AAED;;;;;;;;;GASG;AACH,wBAAgB,yBAAyB,CACxC,SAAS,EAAE,WAAW,EACtB,MAAM,EAAE,UAAU,CAAC,SAAS,GAC1B,kBAAkB,GAAG,IAAI,CAe3B;AAED,mDAAmD;AACnD,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,WAAW,EAAE,SAAS,EAAE,eAAe,GAAG,IAAI,CAmC3F;AAED,4EAA4E;AAC5E,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,WAAW,GAAG,SAAS,GAAG,IAAI,CAiB7E;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,SAAS,EAAE,WAAW,EAAE,KAAK,EAAE,aAAa,GAAG,SAAS,GAAG,IAAI,CAU9F;AAED,sFAAsF;AACtF,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,WAAW,EAAE,GAAG,EAAE,QAAQ,GAAG,WAAW,GAAG,IAAI,CAiE5F;AAED,0EAA0E;AAC1E,wBAAgB,kBAAkB,CACjC,SAAS,EAAE,WAAW,EACtB,IAAI,EAAE,IAAI,EACV,SAAS,EAAE,MAAM,GACf,QAAQ,GAAG,IAAI,CA+DjB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@notectl/core",
3
- "version": "2.4.2",
3
+ "version": "2.5.0",
4
4
  "description": "A modern and accessible rich text editor shipped as a single Web Component. Immutable state, transaction-based architecture, and a plugin system that powers every feature.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -36,6 +36,10 @@
36
36
  "types": "./dist/markdown.d.ts",
37
37
  "import": "./dist/markdown.mjs"
38
38
  },
39
+ "./ui": {
40
+ "types": "./dist/ui.d.ts",
41
+ "import": "./dist/ui.mjs"
42
+ },
39
43
  "./presets": {
40
44
  "types": "./dist/presets.d.ts",
41
45
  "import": "./dist/presets.mjs"
@@ -224,7 +228,7 @@
224
228
  "lightningcss": "^1.33.0",
225
229
  "rollup-plugin-visualizer": "^7.1.1",
226
230
  "terser": "^5.51.2",
227
- "vite": "^8.3.5",
231
+ "vite": "^8.3.6",
228
232
  "vite-plugin-dts": "^4.5.4",
229
233
  "vitest": "^4.1.12"
230
234
  }
@@ -1,2 +0,0 @@
1
- import{n as t,r as e,t as s}from"./BlockAlignment-BqyBQ4uV.mjs";import{a as i,c as n,n as a,o as l,r as o,t as r}from"./PluginHelpers-B3gk3VB3.mjs";import{c as g}from"./StyleRuntime-C0RSqKzG.mjs";import{t as m}from"./StyleClassNames-BsAx7k5T.mjs";import{t as c}from"./NodeSpecPatching-BrjPAbqe.mjs";var h={alignStart:"Align Start",alignCenter:"Align Center",alignEnd:"Align End",justify:"Justify",toolbarLabel:"Alignment",toolbarTooltip:"Alignment"},p=/* #__PURE__ */Object.assign({"./locales/ar.ts":()=>import("./ar-Bdmunk5h.mjs"),"./locales/de.ts":()=>import("./de-B8-w9gPi.mjs"),"./locales/es.ts":()=>import("./es-B8K3Yvf3.mjs"),"./locales/fr.ts":()=>import("./fr-BeRlON1t.mjs"),"./locales/hi.ts":()=>import("./hi-Bl-yeeOI.mjs"),"./locales/pt.ts":()=>import("./pt-5VeuNDd2.mjs"),"./locales/ru.ts":()=>import("./ru-Yngw7nFP.mjs"),"./locales/zh.ts":()=>import("./zh-BvuAbM2S.mjs")});async function f(t){return n(p,t,h)}var d={alignments:["start","center","end","justify"],alignableTypes:["paragraph","heading","title","subtitle","table_cell","image"],defaults:{image:"center"}},u={start:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M15 15H3v2h12v-2zm0-8H3v2h12V7zM3 13h18v-2H3v2zm0 8h18v-2H3v2zM3 3v2h18V3H3z"/></svg>',center:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M7 15v2h10v-2H7zm-4 6h18v-2H3v2zm0-8h18v-2H3v2zm4-6v2h10V7H7zM3 3v2h18V3H3z"/></svg>',end:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3 21h18v-2H3v2zm6-4h12v-2H9v2zm-6-4h18v-2H3v2zm6-4h12V7H9v2zM3 3v2h18V3H3z"/></svg>',justify:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3 21h18v-2H3v2zm0-4h18v-2H3v2zm0-4h18v-2H3v2zm0-4h18V7H3v2zM3 3v2h18V3H3z"/></svg>'},v=class{id="alignment";name="Alignment";priority=90;config;locale;alignableTypes;constructor(t){this.config={...d,...t,defaults:{...d.defaults,...t?.defaults}}}async init(t){this.locale=await l(t,this.config.locale,h,f),this.alignableTypes=new Set(this.config.alignableTypes),this.patchNodeSpecs(t),this.registerStyleClasses(t),this.registerCommands(t),this.registerKeymaps(t),this.registerToolbarItem(t),this.registerMiddleware(t)}patchNodeSpecs(t){c(t,this.config.alignableTypes,{attrName:"align",getDefault:t=>this.config.defaults[t]??"start",applyToDOM:y})}registerStyleClasses(i){m(i,"AlignmentPlugin",this.config.styleClasses,i=>t(function(t){if(e(t))return t;const i=b.get(t),n=i?` Alignment is logical: "${i}" is ${t} in left-to-right text.`:"";throw new TypeError(`Unknown alignment "${t}"; use ${s.join(", ")}.${n}`)}(i)))}registerCommands(t){for(const e of this.config.alignments)t.registerCommand(`align${r(e)}`,()=>this.setAlignment(t,e))}registerKeymaps(t){const e={};this.config.alignments.includes("start")&&(e["Mod-Shift-L"]=()=>t.executeCommand("alignStart")),this.config.alignments.includes("center")&&(e["Mod-Shift-E"]=()=>t.executeCommand("alignCenter")),this.config.alignments.includes("end")&&(e["Mod-Shift-R"]=()=>t.executeCommand("alignEnd")),this.config.alignments.includes("justify")&&(e["Mod-Shift-J"]=()=>t.executeCommand("alignJustify")),Object.keys(e).length>0&&t.registerKeymap(e)}registerToolbarItem(t){const e=this.config.alignments.map(t=>({label:this.getAlignmentLabel(t),command:`align${r(t)}`,icon:u[t]}));t.registerToolbarItem({id:"alignment",group:"block",icon:u.start,label:this.locale.toolbarLabel,tooltip:this.locale.toolbarTooltip,command:"alignStart",popupType:"dropdown",popupConfig:{items:e},isActive:t=>this.isNonDefaultAlignment(t),isEnabled:t=>this.isAlignable(t)})}getAlignmentLabel(t){return{start:this.locale.alignStart,center:this.locale.alignCenter,end:this.locale.alignEnd,justify:this.locale.justify}[t]}registerMiddleware(t){t.registerMiddleware((t,e,s)=>{let i=!1;const n=t.steps.map(t=>{if("setBlockType"!==t.type)return t;if(!this.alignableTypes.has(t.nodeType))return t;if(void 0!==t.attrs?.align)return t;const e=t.previousAttrs?.align;return e?(i=!0,{...t,attrs:{...t.attrs,align:e}}):t});s(i?{...t,steps:n}:t)},{name:"alignment:preserve-align"})}setAlignment(t,e){const s=t.getState(),n=i(s);if(0===n.length)return!1;const l=s.transaction("command");let o=!1;for(const i of n){const t=s.getBlock(i);if(!t||!this.alignableTypes.has(t.type))continue;const n=s.getNodePath(i);n&&(l.setNodeAttr(n,{...t.attrs,align:e}),o=!0)}return!!o&&a(t,l.setSelection(s.selection).build())}isNonDefaultAlignment(t){const e=o(t);if(!e||!this.alignableTypes.has(e.type))return!1;const s=e.attrs?.align,i=this.config.defaults[e.type]??"start";return null!=s&&s!==i}isAlignable(t){const e=o(t);return null!=e&&this.alignableTypes.has(e.type)}};function y(t,e){const s=e.attrs?.align;"string"==typeof s&&g(t,"textAlign",s)}var b=/* @__PURE__ */new Map([["left","start"],["right","end"]]);export{f as i,v as n,h as r,u as t};
2
- //# sourceMappingURL=AlignmentPlugin-Cp7HYGaH.mjs.map
@@ -1,2 +0,0 @@
1
- import{i}from"./HTMLUtils-DTpsjZyK.mjs";import{c as t,f as e}from"./Selection-DC6AOGgF.mjs";import{i as o}from"./TypeBrands-Ch9856Gb.mjs";import{i as n,r,t as s}from"./AttributedMarkCommands-DKHuhZA7.mjs";import{c as l,n as a,o as m,r as c}from"./PluginHelpers-B3gk3VB3.mjs";import{t as d}from"./ShortcutFormatting-TwiufqeV.mjs";import{t as g}from"./DirectionIcons-Bbawl9ei.mjs";import{t as p}from"./TextDirectionService-BcX07mw2.mjs";var u={inlineLTR:"Inline LTR",inlineRTL:"Inline RTL",inlineAuto:"Inline Auto",inlineLabel:"Inline Direction",inlineTooltip:"Inline Direction",announceRemoveBidi:"Inline direction isolation removed"},h=/* #__PURE__ */Object.assign({"./locales/ar.ts":()=>import("./ar-B03uY4xr.mjs"),"./locales/de.ts":()=>import("./de-XCCpWyg0.mjs"),"./locales/es.ts":()=>import("./es-B0Za939C.mjs"),"./locales/fr.ts":()=>import("./fr-DciSEykY.mjs"),"./locales/hi.ts":()=>import("./hi-j3TDLMYd.mjs"),"./locales/pt.ts":()=>import("./pt-CEUgbrii.mjs"),"./locales/ru.ts":()=>import("./ru-BNPUT-3S.mjs"),"./locales/zh.ts":()=>import("./zh-Oj-qSUEp.mjs")});async function B(i){return l(h,i,u)}var b=class{id="bidi-isolation";name="Bidi Isolation";priority=92;config;locale;constructor(i){this.config={...i}}async init(i){this.locale=await m(i,this.config.locale,u,B),this.registerBdiMark(i),this.registerCommands(i),this.registerKeymaps(i),this.registerInlineToolbarItem(i)}registerBdiMark(t){t.registerMarkSpec({type:"bdi",rank:10,attrs:{dir:{default:"auto"}},toDOM(i){const t=document.createElement("bdi"),e=String(i.attrs?.dir??"auto");return t.setAttribute("dir",e),t},toHTMLString:(t,e)=>`<bdi dir="${i(String(t.attrs?.dir??"auto"))}">${e}</bdi>`,parseHTML:[{tag:"bdi",getAttrs:i=>{const t=i.getAttribute("dir");return"ltr"===t||"rtl"===t?{dir:t}:{dir:"auto"}}}],sanitize:{tags:["bdi"],attrs:["dir"]}})}registerCommands(i){i.registerCommand("toggleBidiLTR",()=>{const t=this.applyBdi(i,"ltr");return t&&i.announce(this.locale.inlineLTR),t}),i.registerCommand("toggleBidiRTL",()=>{const t=this.applyBdi(i,"rtl");return t&&i.announce(this.locale.inlineRTL),t}),i.registerCommand("toggleBidiAuto",()=>{const t=this.applyBdi(i,"auto");return t&&i.announce(this.locale.inlineAuto),t}),i.registerCommand("removeBidi",()=>{const t=this.removeBdi(i);return t&&i.announce(this.locale.announceRemoveBidi),t}),i.registerCommand("toggleBidiIsolation",()=>this.toggleBidiIsolation(i))}registerKeymaps(i){i.registerKeymap({"Mod-Shift-B":()=>i.executeCommand("toggleBidiIsolation")})}registerInlineToolbarItem(i){const o=[{label:this.locale.inlineLTR,command:"toggleBidiLTR",icon:g.ltr},{label:this.locale.inlineRTL,command:"toggleBidiRTL",icon:g.rtl},{label:this.locale.inlineAuto,command:"toggleBidiAuto",icon:g.auto},{label:this.locale.announceRemoveBidi,command:"removeBidi"}];i.registerToolbarItem({id:"inline-direction",group:"format",icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M10 4v7h2V4h2v7h2V4h1V2H10a3 3 0 1 0 0 6zm-3.5 9.5L3 17l3.5 3.5V18h3v-2h-3v-2.5zm14 0L17 17l3.5 3.5V18h-3v-2h3v-2.5zM11 16h2v6h-2z"/></svg>',label:this.locale.inlineLabel,tooltip:`${this.locale.inlineTooltip} (${d("Mod-Shift-B")})`,command:"toggleBidiIsolation",popupType:"dropdown",popupConfig:{items:o},isActive:i=>r(i,"bdi"),isEnabled:i=>{const o=i.selection;return e(o)&&!t(o)}})}toggleBidiIsolation(i){const t=i.getState();if(r(t,"bdi")){const t=this.removeBdi(i);return t&&i.announce(this.locale.announceRemoveBidi),t}const e=c(t),o=i.getService(p),n="rtl"===(e&&o?o.getBlockDir(e):"auto")?"ltr":"rtl",s=this.applyBdi(i,n);if(s){const t="ltr"===n?this.locale.inlineLTR:this.locale.inlineRTL;i.announce(t)}return s}applyBdi(i,t){const e=i.getState(),n={type:o("bdi"),attrs:{dir:t}};return a(i,s(e,n))}removeBdi(i){const t=i.getState();return a(i,n(t,o("bdi")))}};export{u as n,B as r,b as t};
2
- //# sourceMappingURL=BidiIsolationPlugin-GWukKdgJ.mjs.map
@@ -1,2 +0,0 @@
1
- import{D as t,E as e,h as o,k as r,p as n}from"./Document-ssR6hBzG.mjs";import{a as i,l as c,t as s}from"./NodeResolver-F4RtpoEd.mjs";import{c as l,f as a,n as u,p as d}from"./Selection-DC6AOGgF.mjs";import{a as h}from"./TypeBrands-Ch9856Gb.mjs";import{c as m,o as p}from"./PluginHelpers-B3gk3VB3.mjs";import{n as g}from"./DomUtils-Bf7JLFlx.mjs";import{t as f}from"./ShortcutFormatting-TwiufqeV.mjs";function b(t,e){const o=t.getNodePath(e)?.[0];return o?t.doc.children.findIndex(t=>t.id===o):-1}function k(t,o,r,i){const c=d(r,t.getBlockOrder()),s=b(t,c.from.blockId),l=b(t,c.to.blockId);if(s<0||l<0)return null;const a=Math.min(s,l),u=Math.max(s,l),h=t.doc.children.slice(a,u+1),m=i??(()=>!0),p=[];let g=[],f=!1;const k=()=>{0!==g.length&&(p.push(n(o,g,e())),f=!0,g=[])};for(const e of h)m(e)?g.push(e):(k(),p.push(e));if(k(),!f)return null;const q=t.transaction("command");for(let e=u;e>=a;e--)q.removeNode([],e);return p.forEach((t,e)=>{q.insertNode([],a+e,t)}),q.setSelection(r),q.build()}function q(e,o){const r=e.getState();if(!a(r.selection))return!1;const n=r.selection;if(!l(n))return!1;const i=n.anchor.blockId,s=r.getParent(i);if(!s||"blockquote"!==s.type)return!1;const u=r.getBlock(i);if(!u)return!1;const d=r.getNodePath(s.id);if(!d)return!1;const h=c(r.doc,d);if(!h)return!1;const m=t(s),p=m.findIndex(t=>t.id===i);return!(p<0)&&o({state:r,quotePath:d,quoteParentPath:d.slice(0,-1),quoteIndex:h.index,child:u,childIndex:p,childCount:m.length,offset:n.anchor.offset})}var I={label:"Blockquote",tooltip:t=>`Blockquote (${t})`},x=/* #__PURE__ */Object.assign({"./locales/ar.ts":()=>import("./ar-sGZ-oZqB.mjs"),"./locales/de.ts":()=>import("./de-uKR7koQe.mjs"),"./locales/es.ts":()=>import("./es-DrJyl38L.mjs"),"./locales/fr.ts":()=>import("./fr-BRXUnq3R.mjs"),"./locales/hi.ts":()=>import("./hi-SECtQQzq.mjs"),"./locales/pt.ts":()=>import("./pt-Cv6q7x5x.mjs"),"./locales/ru.ts":()=>import("./ru-DSRv3_Rg.mjs"),"./locales/zh.ts":()=>import("./zh-DYD476c5.mjs")});async function v(t){return m(x,t,I)}var N={},S=class{id="blockquote";name="Blockquote";priority=35;config;locale;constructor(t){this.config={...N,...t}}async init(t){this.locale=await p(t,this.config.locale,I,v),t.registerStyleSheet(".notectl-content blockquote{padding:2px 0;border-inline-start:3px solid var(--notectl-blockquote-border,var(--notectl-border));background:var(--notectl-blockquote-bg,transparent);color:var(--notectl-blockquote-fg,inherit);min-height:1.6em;margin:0;padding-inline-start:16px}"),this.registerNodeSpec(t),this.registerCommands(t),this.registerKeymap(t),!1!==this.config.inputRule&&this.registerInputRule(t),this.registerToolbarItem(t)}registerNodeSpec(t){t.registerNodeSpec({type:"blockquote",group:"block",content:{allow:["paragraph","heading","list_item","blockquote","horizontal_rule","code_block"],min:1},toDOM(t){const e=g("blockquote",t.id);return e.setAttribute("part","blockquote"),e},toHTML:(t,e)=>`<blockquote>${e||"<br>"}</blockquote>`,parseHTML:[{tag:"blockquote"}],sanitize:{tags:["blockquote"]}})}registerCommands(t){t.registerCommand("toggleBlockquote",()=>this.toggleBlockquote(t)),t.registerCommand("setBlockquote",()=>this.wrapInBlockquote(t))}registerKeymap(t){t.registerKeymap({"Mod-Shift->":()=>t.executeCommand("toggleBlockquote")}),function(t){t.registerKeymap({Enter:()=>function(t){return q(t,e=>{if("list_item"===e.child.type)return!1;if(e.childIndex!==e.childCount-1||r(e.child)>0)return!1;const n=o(),i=e.state.transaction("input");return 1===e.childCount?(i.removeNode(e.quoteParentPath,e.quoteIndex),i.insertNode(e.quoteParentPath,e.quoteIndex,n)):(i.removeNode(e.quotePath,e.childIndex),i.insertNode(e.quoteParentPath,e.quoteIndex+1,n)),i.setSelection(u(n.id,0)),t.dispatch(i.build()),!0})}(t),Backspace:()=>function(t){return q(t,e=>{if(0!==e.offset||0!==e.childIndex)return!1;if("list_item"===e.child.type)return!1;const o=e.state.transaction("input");return 1===e.childCount?(o.removeNode(e.quoteParentPath,e.quoteIndex),o.insertNode(e.quoteParentPath,e.quoteIndex,e.child)):(o.removeNode(e.quotePath,0),o.insertNode(e.quoteParentPath,e.quoteIndex,e.child)),o.setSelection(u(e.child.id,0)),t.dispatch(o.build()),!0})}(t)},{priority:"context"})}(t)}registerInputRule(t){t.registerInputRule({pattern:/^> $/,handler(t,o,r,i){const c=t.selection;if(!a(c))return null;if(!l(c))return null;const s=t.getBlock(c.anchor.blockId);if(!s||"paragraph"!==s.type)return null;const u=t.doc.children.findIndex(t=>t.id===s.id);if(u<0)return null;const d=n(h("blockquote"),[s],e());return t.transaction("input").removeNode([],u).insertNode([],u,d).deleteTextAt(c.anchor.blockId,r,r+2).setSelection(c).build()}})}registerToolbarItem(t){t.registerToolbarItem({id:"blockquote",group:"block",icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M6 17h3l2-4V7H5v6h3zm8 0h3l2-4V7h-6v6h3z"/></svg>',label:this.locale.label,tooltip:this.locale.tooltip(f("Mod-Shift->")),command:"toggleBlockquote",isActive:t=>!!a(t.selection)&&i(t.doc,t.selection.anchor.blockId,"blockquote")})}toggleBlockquote(e){const o=e.getState(),r=o.selection;if(!a(r))return!1;const n=i(o.doc,r.anchor.blockId,"blockquote")?function(e,o,r){const n=s(e.doc,r.anchor.blockId,o);if(!n||1!==n.path.length)return null;const i=e.doc.children.findIndex(t=>t.id===n.node.id);if(i<0)return null;const c=t(n.node),l=e.transaction("command");return l.removeNode([],i),c.forEach((t,e)=>{l.insertNode([],i+e,t)}),l.setSelection(r),l.build()}(o,h("blockquote"),r):k(o,h("blockquote"),r,this.isQuoteChild(e));return!!n&&(e.dispatch(n),!0)}wrapInBlockquote(t){const e=t.getState(),o=e.selection;if(!a(o))return!1;const r=k(e,h("blockquote"),o,this.isQuoteChild(t));return!!r&&(t.dispatch(r),!0)}isQuoteChild(t){const e=t.getSchemaRegistry(),o=new Set(e.getNodeSpec(h("blockquote"))?.content?.allow??[]);return t=>{if(o.has(t.type))return!0;const r=e.getNodeSpec(t.type)?.group;return void 0!==r&&o.has(r)}}};export{I as n,v as r,S as t};
2
- //# sourceMappingURL=BlockquotePlugin-CSL_7Yit.mjs.map
@@ -1,2 +0,0 @@
1
- import{M as n,i as t,j as o,k as e}from"./Document-ssR6hBzG.mjs";import{c as r,f as i}from"./Selection-DC6AOGgF.mjs";import{a as l,i as c,t as s}from"./NavigationQueries-CaKfccu7.mjs";import{c as a,o as u}from"./PluginHelpers-B3gk3VB3.mjs";import{r as f,t as d}from"./Platform-ByobkiCc.mjs";import{n as h,r as m,t as g}from"./SelectionTransactions-mQ1NfMEg.mjs";import{r as k}from"./DomUtils-Bf7JLFlx.mjs";import{a as w,o as b,r as I,t as p}from"./SelectionSync-BkjCwGp-.mjs";var v="undefined"!=typeof Intl&&"Segmenter"in Intl?new Intl.Segmenter(void 0,{granularity:"grapheme"}):null;function x(n,t){if(t>=n.length||0===n.length)return 0;if(v){for(const o of v.segment(n)){const n=o.index+o.segment.length;if(n>t)return n-t}return 0}return 1}function y(n,t){if(t<=0||0===n.length)return 0;if(v){let o=1;for(const e of v.segment(n)){if(e.index+e.segment.length>=t){o=e.segment.length;break}o=e.segment.length}return o}return 1}function B(t,o){let e=o-1;for(;e>=0;){const o=n(t,e);if(!o||"inline"===o.kind)break;if(!/\s/.test(o.char))break;e--}if(e>=0&&"inline"===n(t,e)?.kind)return e;for(;e>=0;){const o=n(t,e);if(!o||"inline"===o.kind)break;if(/\s/.test(o.char))break;e--}return e+1}function C(t,o){const r=e(t);let i=o;for(;i<r;){const o=n(t,i);if(!o||"inline"===o.kind)break;if(/\s/.test(o.char))break;i++}if(i===o&&i<r&&"inline"===n(t,i)?.kind)return i+1;for(;i<r;){const o=n(t,i);if(!o||"inline"===o.kind)break;if(!/\s/.test(o.char))break;i++}return i}function M(n,t,o){if("caretPositionFromPoint"in n){const e=n.caretPositionFromPoint(t,o);if(e)return{node:e.offsetNode,offset:e.offset}}if("caretRangeFromPoint"in n){const e=n.caretRangeFromPoint(t,o);if(e)return{node:e.startContainer,offset:e.startOffset}}return null}function A(n,t,o,e){return M(n,t,o)??(e&&n!==e?M(e,t,o):null)}function S(n,t,o,l){const c=t.selection;if(!i(c))return!1;if(!r(c))return!1;const s=t.getBlock(c.anchor.blockId);if(!s)return!1;const a=c.anchor.offset,u=e(s),f=n.querySelector(`[data-block-id="${c.anchor.blockId}"]`),h=f instanceof HTMLElement&&"rtl"===d(f);if("left"===o)return h?a===u:0===a;if("right"===o)return h?0===a:a===u;if("up"===o&&0===a)return!0;if("down"===o&&a===u)return!0;const m=I();return m&&m.modify?function(n,t,o,e){const r=w(n,t);if(!r)return!1;const i=e??R(t,n),l="up"===o?"backward":"forward";try{t.modify("move",l,"line");const o=w(n,t);if(!o)return!1;if(k(n,r.focusNode)!==k(n,o.focusNode))return!0;if(o.anchorNode===r.anchorNode&&o.anchorOffset===r.anchorOffset&&o.focusNode===r.focusNode&&o.focusOffset===r.focusOffset)return!0;if(i){const o=R(t,n);if(o&&Math.abs(o.top-i.top)<1)return!0}return!1}finally{try{t.setBaseAndExtent(r.anchorNode,r.anchorOffset,r.focusNode,r.focusOffset)}catch{}}}(n,m,o,l):"up"===o?0===a:a===u}function E(n,t){const o=j(n,t);if(!o)return null;if(o.isVoid)return m(n,o.targetId);const r=n.getBlock(o.targetId);if(!r)return null;const i="right"===t||"down"===t?0:e(r);return h(n,o.targetId,i)}function V(n,t,o,l){const c=j(t,o);if(!c)return null;if(c.isVoid)return m(t,c.targetId);const s=t.getBlock(c.targetId);if(!s)return null;const a=e(s);if(null!==l){const e=function(n,t,o,e){const r=n.querySelector(`[data-block-id="${t}"]`);if(!r)return null;const i=r.getBoundingClientRect(),l=function(n,t,o){if(!(n instanceof HTMLElement))return"down"===o?t.top+2:t.bottom-2;const e=getComputedStyle(n),r=Number.parseFloat(e.paddingTop)||0,i=Number.parseFloat(e.paddingBottom)||0;return"down"===o?t.top+r+2:t.bottom-i-2}(r,i,o),c=Math.min(Math.max(e,i.left),i.right-1),s=A(n.getRootNode(),c,l,n.ownerDocument);if(!s)return null;if(!r.contains(s.node))return null;const a=p(n,s.node,s.offset);return a?a.blockId!==t?null:a:null}(n,c.targetId,o,l);if(e)return h(t,e.blockId,e.offset)}if(i(t.selection)&&r(t.selection)){const n=t.selection.anchor.offset,o=Math.min(n,a);return h(t,c.targetId,o)}const u="down"===o?0:a;return h(t,c.targetId,u)}function T(t,o){if("up"===o||"down"===o)return null;const e=t.selection;if(!i(e))return null;if(!r(e))return null;const l=e.anchor.blockId,c=t.getBlock(l);if(!c)return null;const s=e.anchor.offset;return"right"===o?function(t,o,e,r){const i=n(e,r);return i&&"inline"===i.kind?h(t,o,r+1):null}(t,l,c,s):function(t,o,e,r){if(0===r)return null;const i=n(e,r-1);return i&&"inline"===i.kind?h(t,o,r-1):null}(t,l,c,s)}function R(n,t){if(n.rangeCount>0){const o=n.getRangeAt(0);if(!t||t.contains(o.startContainer)){const n=o.getClientRects();if(n.length>0)return n[0]??null;const t=o.getBoundingClientRect();if(t.height>0)return t}}if(t){const o=w(t,n);if(o)try{const n=document.createRange();n.setStart(o.anchorNode,o.anchorOffset),n.setEnd(o.focusNode,o.focusOffset);const t=n.getClientRects();return t.length>0?t[0]??null:n.getBoundingClientRect()}catch{}}return null}function j(n,t){const o=n.selection;if(!i(o))return null;const e="right"===t||"down"===t;return l(n,o.anchor.blockId,e)}function H(n){const t=n.selection;if(!i(t))return null;const o=r(t)?t.anchor.blockId:t.head.blockId;return 0===(r(t)?t.anchor.offset:t.head.offset)?null:h(n,o,0)}function N(n){const t=n.selection;if(!i(t))return null;const o=r(t)?t.anchor.blockId:t.head.blockId,l=n.getBlock(o);if(!l)return null;const c=e(l);return(r(t)?t.anchor.offset:t.head.offset)===c?null:h(n,o,c)}function O(n){const t=n.selection;return i(t)?{blockId:t.head.blockId,offset:t.head.offset}:null}function L(n,t,o){const e=n.getBlockOrder(),r=e.indexOf(t);if(r<0)return null;const i="forward"===o?r+1:r-1;return i<0||i>=e.length?null:e[i]??null}function z(l){const a=l.selection;if(!i(a))return null;if(!r(a))return h(l,a.head.blockId,a.head.offset);const u=a.anchor.blockId,f=l.getBlock(u);if(!f)return null;const d=a.anchor.offset;if(d<e(f)){if("inline"===n(f,d)?.kind)return h(l,u,d+1);const e=x(o(f),t(f,d))||1;return h(l,u,d+e)}const g=L(l,u,"forward");return g&&s(l,u,g)?c(l,g)?m(l,g):h(l,g,0):null}function D(l){const a=l.selection;if(!i(a))return null;if(!r(a))return h(l,a.head.blockId,a.head.offset);const u=a.anchor.blockId,f=l.getBlock(u);if(!f)return null;const d=a.anchor.offset;if(d>0){if("inline"===n(f,d-1)?.kind)return h(l,u,d-1);const e=y(o(f),t(f,d))||1;return h(l,u,d-e)}const g=L(l,u,"backward");if(!g)return null;if(!s(l,u,g))return null;if(c(l,g))return m(l,g);const k=l.getBlock(g);return k?h(l,g,e(k)):null}function P(n){const t=n.selection;if(!i(t))return null;const o=n.getBlockOrder()[0];return o?c(n,o)?m(n,o):h(n,o,0):null}function F(n){const t=n.selection;if(!i(t))return null;const o=n.getBlockOrder(),r=o[o.length-1];if(!r)return null;if(c(n,r))return m(n,r);const l=n.getBlock(r);return l?h(n,r,e(l)):null}function $(r){const l=O(r);if(!l)return null;const c=r.selection;if(!i(c))return null;const a=r.getBlock(l.blockId);if(!a)return null;const u=e(a);if(l.offset<u){const e="inline"===n(a,l.offset)?.kind?1:x(o(a),t(a,l.offset))||1;return g(r,c.anchor.blockId,c.anchor.offset,l.blockId,l.offset+e)}const f=L(r,l.blockId,"forward");return f&&s(r,l.blockId,f)?g(r,c.anchor.blockId,c.anchor.offset,f,0):null}function q(r){const l=O(r);if(!l)return null;const c=r.selection;if(!i(c))return null;if(l.offset>0){const e=r.getBlock(l.blockId);if(!e)return null;const i="inline"===n(e,l.offset-1)?.kind?1:y(o(e),t(e,l.offset))||1;return g(r,c.anchor.blockId,c.anchor.offset,l.blockId,l.offset-i)}const a=L(r,l.blockId,"backward");if(!a)return null;if(!s(r,l.blockId,a))return null;const u=r.getBlock(a);return u?g(r,c.anchor.blockId,c.anchor.offset,a,e(u)):null}function _(n){const t=O(n);if(!t)return null;const o=n.selection;return i(o)?0===t.offset?null:g(n,o.anchor.blockId,o.anchor.offset,t.blockId,0):null}function U(n){const t=O(n);if(!t)return null;const o=n.selection;if(!i(o))return null;const r=n.getBlock(t.blockId);if(!r)return null;const l=e(r);return t.offset===l?null:g(n,o.anchor.blockId,o.anchor.offset,t.blockId,l)}function Q(n){const t=n.selection;if(!i(t))return null;const o=n.getBlockOrder()[0];return o?t.head.blockId===o&&0===t.head.offset?null:g(n,t.anchor.blockId,t.anchor.offset,o,0):null}function K(n){const t=n.selection;if(!i(t))return null;const o=n.getBlockOrder(),r=o[o.length-1];if(!r)return null;const l=n.getBlock(r);if(!l)return null;const c=e(l);return t.head.blockId===r&&t.head.offset===c?null:g(n,t.anchor.blockId,t.anchor.offset,r,c)}function Z(n,t,o,e){return J(n,t,"move",o,e)}function G(n,t,o,e){return J(n,t,"extend",o,e)}function J(t,o,r,l,a){const u=o.selection;if(!i(u))return null;const f="move"===r?W:X,d=I();if(!d?.modify)return f(o,l,a);const k=w(t,d);if(!k)return f(o,l,a);try{d.modify(r,l,a);const i=b(t);if(!i)return null;const f="move"===r?u.anchor.blockId:u.head.blockId,k="move"===r?i.anchor:i.head,w=k.blockId;if(w!==f&&!s(o,f,w))return null;let I=k.offset;const p=o.getBlock(w);return p&&"inline"===n(p,I)?.kind&&"forward"===l&&(I=Math.min(I+1,e(p))),"move"===r?c(o,w)?m(o,w):h(o,w,I):g(o,u.anchor.blockId,u.anchor.offset,w,I)}finally{try{d.setBaseAndExtent(k.anchorNode,k.anchorOffset,k.focusNode,k.focusOffset)}catch{}}}function W(n,t,o){return"word"===o?function(n,t){const o=n.selection;if(!i(o))return null;const c=r(o)?o.anchor.blockId:o.head.blockId,s=r(o)?o.anchor.offset:o.head.offset,a=n.getBlock(c);if(!a)return null;const u="forward"===t?C(a,s):B(a,s);return u===s?function(n,t,o){const r=l(n,t,"forward"===o);if(!r)return null;if(r.isVoid)return m(n,r.targetId);const i=n.getBlock(r.targetId);if(!i)return null;const c="forward"===o?0:e(i);return h(n,r.targetId,c)}(n,c,t):h(n,c,u)}(n,t):"lineboundary"===o?"forward"===t?N(n):H(n):E(n,"forward"===t?"down":"up")}function X(n,t,o){const r=n.selection;if(!i(r))return null;const c=r.head,s=n.getBlock(c.blockId);if(!s)return null;let a=c.offset;if("word"===o)a="forward"===t?C(s,c.offset):B(s,c.offset);else{if("lineboundary"!==o){const o=l(n,c.blockId,"forward"===t);if(!o)return null;if(o.isVoid)return null;const i=n.getBlock(o.targetId);if(!i)return null;const s="forward"===t?0:e(i);return g(n,r.anchor.blockId,r.anchor.offset,o.targetId,s)}a="forward"===t?e(s):0}return g(n,r.anchor.blockId,r.anchor.offset,c.blockId,a)}function Y(n,t){return Z(n,t,"forward","word")}function nn(n,t){return Z(n,t,"backward","word")}function tn(n,t){return Z(n,t,"backward","lineboundary")}function on(n,t){return Z(n,t,"forward","lineboundary")}function en(n,t){return Z(n,t,"backward","line")}function rn(n,t){return Z(n,t,"forward","line")}function ln(n,t){return G(n,t,"forward","word")}function cn(n,t){return G(n,t,"backward","word")}function sn(n,t){return G(n,t,"backward","lineboundary")}function an(n,t){return G(n,t,"forward","lineboundary")}function un(n,t){return G(n,t,"backward","line")}function fn(n,t){return G(n,t,"forward","line")}var dn={paragraph:"Paragraph",heading1:"Heading 1",heading2:"Heading 2",heading3:"Heading 3",heading4:"Heading 4",heading5:"Heading 5",heading6:"Heading 6",codeBlock:"Code Block",blockquote:"Block Quote",listItem:"List Item",horizontalRule:"Horizontal Rule",image:"Image",table:"Table"},hn={paragraph:"paragraph",code_block:"codeBlock",blockquote:"blockquote",list_item:"listItem",horizontal_rule:"horizontalRule",image:"image",table:"table"},mn=/* #__PURE__ */Object.assign({"./locales/ar.ts":()=>import("./ar-BRX5E_Pw.mjs"),"./locales/de.ts":()=>import("./de-B9zSHWqY.mjs"),"./locales/es.ts":()=>import("./es-CgMfhkJJ.mjs"),"./locales/fr.ts":()=>import("./fr-0qEo3bRP.mjs"),"./locales/hi.ts":()=>import("./hi-CoclKAUM.mjs"),"./locales/pt.ts":()=>import("./pt-CMx2wPPY.mjs"),"./locales/ru.ts":()=>import("./ru-QGX8lOTs.mjs"),"./locales/zh.ts":()=>import("./zh-YfuE_m2y.mjs")});async function gn(n){return a(mn,n,dn)}var kn={"word:forward":Y,"word:backward":nn,"lineboundary:forward":on,"lineboundary:backward":tn,"line:forward":rn,"line:backward":en},wn={"word:forward":ln,"word:backward":cn,"lineboundary:forward":an,"lineboundary:backward":sn,"line:forward":fn,"line:backward":un},bn=class{id="caret-navigation";name="Caret Navigation";priority=4;context=null;lastAnnouncedBlockId=null;announceTimer=null;announce=null;locale=dn;async init(n){this.locale=await u(n,void 0,dn,gn),this.context=n,this.announce=t=>n.announce(t);const t=f(),o={"Shift-ArrowRight":()=>this.extendCharacterVisual("right"),"Shift-ArrowLeft":()=>this.extendCharacterVisual("left"),"Shift-ArrowUp":()=>this.viewExtendCommand("backward","line"),"Shift-ArrowDown":()=>this.viewExtendCommand("forward","line"),...t?{"Alt-ArrowRight":()=>this.viewMoveVisual("right","word"),"Alt-ArrowLeft":()=>this.viewMoveVisual("left","word"),"Shift-Alt-ArrowRight":()=>this.viewExtendVisual("right","word"),"Shift-Alt-ArrowLeft":()=>this.viewExtendVisual("left","word")}:{"Mod-ArrowRight":()=>this.viewMoveVisual("right","word"),"Mod-ArrowLeft":()=>this.viewMoveVisual("left","word"),"Mod-Shift-ArrowRight":()=>this.viewExtendVisual("right","word"),"Mod-Shift-ArrowLeft":()=>this.viewExtendVisual("left","word")},...t?{"Mod-ArrowLeft":()=>this.viewMoveVisual("left","lineboundary"),"Mod-ArrowRight":()=>this.viewMoveVisual("right","lineboundary"),"Mod-Shift-ArrowLeft":()=>this.viewExtendVisual("left","lineboundary"),"Mod-Shift-ArrowRight":()=>this.viewExtendVisual("right","lineboundary")}:{Home:()=>this.viewMoveCommand("backward","lineboundary"),End:()=>this.viewMoveCommand("forward","lineboundary"),"Shift-Home":()=>this.viewExtendCommand("backward","lineboundary"),"Shift-End":()=>this.viewExtendCommand("forward","lineboundary")},...t?{"Mod-ArrowUp":()=>this.modelCommand(P),"Mod-ArrowDown":()=>this.modelCommand(F),"Mod-Shift-ArrowUp":()=>this.modelCommand(Q),"Mod-Shift-ArrowDown":()=>this.modelCommand(K)}:{"Mod-Home":()=>this.modelCommand(P),"Mod-End":()=>this.modelCommand(F),"Mod-Shift-Home":()=>this.modelCommand(Q),"Mod-Shift-End":()=>this.modelCommand(K)}};n.registerKeymap(o,{priority:"navigation"})}onStateChange(n,t,o){const e=t.selection;if(!r(e)||!i(e))return null!==this.announceTimer&&(clearTimeout(this.announceTimer),this.announceTimer=null),void(this.lastAnnouncedBlockId=null);const l=e.anchor.blockId;l!==this.lastAnnouncedBlockId&&(null!==this.lastAnnouncedBlockId?(this.lastAnnouncedBlockId=l,null!==this.announceTimer&&clearTimeout(this.announceTimer),this.announceTimer=setTimeout(()=>{if(this.announceTimer=null,this.context?.hasAnnouncement())return;const n=t.getBlock(l);if(!n)return;const o=function(n,t,o){if("heading"===t&&o?.level){const t=`heading${o.level}`;if(t in n)return n[t]}const e=hn[t];return e?n[e]:t}(this.locale,n.type,n.attrs);this.announce?.(o)},150)):this.lastAnnouncedBlockId=l)}destroy(){null!==this.announceTimer&&clearTimeout(this.announceTimer),this.announceTimer=null,this.announce=null,this.context=null}modelCommand(n){if(!this.context)return!1;const t=n(this.context.getState());return!!t&&(this.context.dispatch(t),!0)}extendCharacterVisual(n){if(!this.context)return!1;const t=this.context.getState(),o="forward"===this.resolveLogicalHorizontalDirection(t,n)?$(t):q(t);return!!o&&(this.context.dispatch(o),!0)}viewMoveCommand(n,t){return this.dispatchViewCommand(kn,n,t)}viewMoveVisual(n,t){if(!this.context)return!1;const o=this.resolveLogicalHorizontalDirection(this.context.getState(),n);return this.viewMoveCommand(o,t)}viewExtendCommand(n,t){return this.dispatchViewCommand(wn,n,t)}dispatchViewCommand(n,t,o){if(!this.context)return!1;const e=n[`${o}:${t}`];if(!e)return!1;const r=e(this.context.getContainer(),this.context.getState());return!!r&&(this.context.dispatch(r),!0)}viewExtendVisual(n,t){if(!this.context)return!1;const o=this.resolveLogicalHorizontalDirection(this.context.getState(),n);return this.viewExtendCommand(o,t)}resolveLogicalHorizontalDirection(n,t){const o=n.selection;if(!i(o))return"left"===t?"backward":"forward";const e=this.context?.getContainer();if(!e)return"left"===t?"backward":"forward";const r=e.querySelector(`[data-block-id="${o.head.blockId}"]`);return r instanceof HTMLElement&&"rtl"===d(r)?"left"===t?"forward":"backward":"left"===t?"backward":"forward"}};export{S as A,Q as C,P as D,F as E,A as F,B as I,C as L,E as M,V as N,N as O,T as P,x as R,K as S,z as T,Z as _,un as a,U as b,cn as c,en as d,on as f,G as g,Y as h,fn as i,R as j,H as k,ln as l,nn as m,dn as n,an as o,tn as p,gn as r,sn as s,bn as t,rn as u,q as v,D as w,_ as x,$ as y,y as z};
2
- //# sourceMappingURL=CaretNavigationPlugin-BQPqqK4n.mjs.map
@@ -1,2 +0,0 @@
1
- import{i as t,s as e,u as n}from"./HTMLUtils-DTpsjZyK.mjs";import{E as o,P as r,R as c,V as s,h as i,j as a,k as l}from"./Document-ssR6hBzG.mjs";import{r as d}from"./NodeResolver-F4RtpoEd.mjs";import{a as u,c as g,f as p,l as f,n as h,o as k,p as b}from"./Selection-DC6AOGgF.mjs";import{a as m}from"./TypeBrands-Ch9856Gb.mjs";import{S as v,_ as x,g as y,v as C,x as S}from"./BlockInsertion-CXfXqUZl.mjs";import{a as w,i as _,t as I}from"./Decoration-BoFcdSXk.mjs";import{t as B}from"./SyntaxTokenTypes-BUCOMtL8.mjs";import{n as A}from"./TypedKeys-CA4bfw9O.mjs";import{c as T,o as L}from"./PluginHelpers-B3gk3VB3.mjs";import{n as M,t as O}from"./SelectionReplacement-vC1xhFS0.mjs";import{c as P}from"./StyleRuntime-C0RSqKzG.mjs";import{n as N}from"./DomUtils-Bf7JLFlx.mjs";import{t as E}from"./ShortcutFormatting-TwiufqeV.mjs";import{t as j}from"./PopupManager-Dxv0OVMo.mjs";import{a as z,i as $,n as q,o as D,r as H,t as R}from"./xml-BsV44TrJ.mjs";import{n as V}from"./PopupKeyboardPatterns-BcwdDxRq.mjs";var F=`\n/* Code Block — uses theme custom properties */\n.notectl-code-block {\n\tposition: relative;\n\tmargin: 8px 0;\n\tborder-radius: 6px;\n\tbackground: var(--notectl-code-block-bg);\n\tcolor: var(--notectl-code-block-color);\n\tfont-family: 'SF Mono', 'Fira Code', 'Cascadia Code', Menlo, Consolas, monospace;\n\tfont-size: 14px;\n\tline-height: 1.5;\n\toverflow: hidden;\n}\n\n.notectl-code-block__header {\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: space-between;\n\tpadding: 6px 12px;\n\tbackground: var(--notectl-code-block-header-bg);\n\tborder-bottom: 1px solid var(--notectl-code-block-header-border);\n\tfont-size: 12px;\n\tcolor: var(--notectl-code-block-header-color);\n\tuser-select: none;\n}\n\n.notectl-code-block__language-btn {\n\tdisplay: inline-flex;\n\talign-items: center;\n\tgap: 4px;\n\tborder: none;\n\tborder-radius: 4px;\n\tbackground: transparent;\n\tcolor: var(--notectl-code-block-header-color);\n\tcursor: pointer;\n\tpadding: 2px 6px;\n\tfont-size: inherit;\n\tfont-family: inherit;\n\ttransition: background 0.15s;\n}\n\n.notectl-code-block__language-btn:hover {\n\tbackground: rgba(128, 128, 128, 0.15);\n}\n\n.notectl-code-block__language-btn:focus-visible {\n\toutline: 2px solid var(--notectl-primary);\n\toutline-offset: 1px;\n}\n\n.notectl-code-block__language {\n\tfont-weight: 500;\n\tletter-spacing: 0.02em;\n}\n\n.notectl-code-block__chevron {\n\tdisplay: inline-flex;\n\talign-items: center;\n\topacity: 0.6;\n}\n\n.notectl-code-block__actions {\n\tdisplay: flex;\n\talign-items: center;\n\tgap: 2px;\n}\n\n.notectl-code-block__copy,\n.notectl-code-block__delete {\n\tdisplay: inline-flex;\n\talign-items: center;\n\tjustify-content: center;\n\twidth: 24px;\n\theight: 24px;\n\tborder: none;\n\tborder-radius: 4px;\n\tbackground: transparent;\n\tcolor: var(--notectl-code-block-header-color);\n\tcursor: pointer;\n\tpadding: 0;\n\ttransition: background 0.15s, color 0.15s;\n}\n\n.notectl-code-block__copy:hover,\n.notectl-code-block__delete:hover {\n\tbackground: rgba(128, 128, 128, 0.15);\n\tcolor: var(--notectl-code-block-color);\n}\n\n.notectl-code-block__copy svg,\n.notectl-code-block__delete svg {\n\tfill: currentColor;\n}\n\n.notectl-code-block__content {\n\tdisplay: block;\n\tpadding: 12px 16px;\n\twhite-space: pre-wrap;\n\tword-wrap: break-word;\n\ttab-size: 4;\n\t-moz-tab-size: 4;\n\toutline: none;\n\tmin-height: 1.5em;\n}\n\n.notectl-code-block--selected {\n\toutline: 2px solid var(--notectl-primary);\n\toutline-offset: 2px;\n}\n\n.notectl-code-block__esc-hint {\n\tdisplay: none;\n\tposition: absolute;\n\tbottom: 4px;\n\tinset-inline-end: 8px;\n\tfont-size: 11px;\n\tcolor: var(--notectl-code-block-header-color);\n\topacity: 0.5;\n\tpointer-events: none;\n\tuser-select: none;\n\tfont-family: system-ui, sans-serif;\n}\n\n.notectl-code-block--focused .notectl-code-block__esc-hint {\n\tdisplay: block;\n}\n\n/* Language picker popup */\n.notectl-language-picker {\n\tmin-width: 120px;\n\tmax-height: 200px;\n\toverflow-y: auto;\n\tpadding: 4px;\n\tbackground: var(--notectl-surface-raised, #fff);\n\tborder: 1px solid var(--notectl-border, #e0e0e0);\n\tborder-radius: 6px;\n\tbox-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);\n}\n\n.notectl-language-picker__option {\n\tpadding: 6px 10px;\n\tborder-radius: 4px;\n\tcursor: pointer;\n\tfont-size: 13px;\n\tcolor: var(--notectl-fg, #333);\n\twhite-space: nowrap;\n}\n\n.notectl-language-picker__option:hover {\n\tbackground: rgba(128, 128, 128, 0.1);\n}\n\n.notectl-language-picker__option:focus {\n\toutline: none;\n\tbackground: rgba(128, 128, 128, 0.15);\n}\n\n.notectl-language-picker__option[aria-selected="true"] {\n\tfont-weight: 600;\n\tcolor: var(--notectl-primary, #2563eb);\n}\n\n/* Syntax highlighting token classes — generated from canonical token type list */\n${B.map(t=>`.notectl-token--${t} {\n\tcolor: var(--notectl-code-token-${t});\n\tfont-style: var(--notectl-code-token-${t}-font-style, inherit);\n\tfont-weight: var(--notectl-code-token-${t}-font-weight, inherit);\n}`).join("\n")}\n`,K=[{open:"(",close:")",kind:"bracket"},{open:"[",close:"]",kind:"bracket"},{open:"{",close:"}",kind:"bracket"},{open:'"',close:'"',kind:"quote"},{open:"'",close:"'",kind:"quote"},{open:"`",close:"`",kind:"quote"}],W=new Map(K.map(t=>[t.open,t])),J=new Map(K.filter(t=>"bracket"===t.kind).map(t=>[t.close,t]));var U=/* @__PURE__ */new Set(["{","[","("]),X={"}":"{","]":"[",")":"("};function Z(t,e){const n=t.lastIndexOf("\n",e-1)+1,o=t.indexOf("\n",e);return{start:n,end:-1===o?t.length:o}}function G(t,e){const{start:n,end:o}=Z(t,e);let r=n;for(;r<o;){const e=t[r];if(" "!==e&&"\t"!==e)break;r++}return t.slice(n,r)}function Q(t,e){return t?" ".repeat(e):"\t"}function Y(t,e,n){if(0===t.length)return{removed:"",rest:t};if(!e&&"\t"===t[0])return{removed:"\t",rest:t.slice(1)};let o=0;for(;o<n&&" "===t[o];)o++;return{removed:t.slice(0,o),rest:t.slice(o)}}var tt=class{buckets=/* @__PURE__ */new Map;push(t,e){const n=this.buckets.get(t.blockId)??[];n.push({pos:t,char:e}),this.buckets.set(t.blockId,n)}take(t,e){const n=this.buckets.get(t);if(n)for(let o=n.length-1;o>=0;o--){const r=n[o];if(r&&r.pos.offset===e)return n.splice(o,1),0===n.length&&this.buckets.delete(t),r}}peek(t,e){const n=this.buckets.get(t);if(n)for(let o=n.length-1;o>=0;o--){const t=n[o];if(t&&t.pos.offset===e)return t}}clearBlock(t){this.buckets.delete(t)}clear(){this.buckets.clear()}sizeForBlock(t){return this.buckets.get(t)?.length??0}get size(){let t=0;for(const e of this.buckets.values())t+=e.length;return t}migrate(t){if(t.isEmpty)return;const e=/* @__PURE__ */new Map;for(const n of this.buckets.values())for(const o of n){const n=t.mapResult(o.pos,1);if(n.deleted)continue;const r={pos:n.pos,char:o.char},c=n.pos.blockId,s=e.get(c)??[];s.push(r),e.set(c,s)}this.buckets.clear();for(const[n,o]of e)this.buckets.set(n,o)}static makePos(t,e){return u(t,e)}},et=class{resolvedIndent;resolvedPairing;getTokenAt;getCompositionState;pairs=new tt;pendingPairOps=[];constructor(t){this.resolvedIndent=t.resolvedIndent,this.resolvedPairing=t.resolvedPairing,this.getTokenAt=t.getTokenAt,this.getCompositionState=t.getCompositionState}get pairStack(){return this.pairs}clear(){this.pairs.clear(),this.pendingPairOps.length=0}syncOnStateChange(t,e){this.pairs.size>0&&!e.mapping.isEmpty&&this.pairs.migrate(e.mapping);for(const n of this.pendingPairOps)"push"===n.kind?this.pairs.push(u(n.blockId,n.offset),n.char):this.pairs.take(n.blockId,n.offset);this.pendingPairOps.length=0;for(const n of e.steps){if("setBlockType"!==n.type)continue;const e=t.getBlock(n.blockId);e&&"code_block"===e.type||this.pairs.clearBlock(n.blockId)}}handleTextInput=(t,e)=>{this.pendingPairOps.length=0;const n=this.getCompositionState();if(!n)return null;if(n.isComposing)return null;if(!p(e.selection))return null;if(1!==t.length)return null;const o=e.selection,r=e.getBlock(o.anchor.blockId);if(!r||"code_block"!==r.type)return null;const c=this.tryDedentOnCloseBracket(e,r,t);if(c)return c;const s=function(t){const{state:e,char:n,config:o}=t;if(!p(e.selection))return{kind:"passthrough"};const r=e.selection,c=W.get(n);if(c&&!g(r)&&function(t,e){switch(e.surround){case"never":return!1;case"brackets":return"bracket"===t.kind;case"quotes":return"quote"===t.kind;case"languageDefined":return!0}}(c,o)){const e=function(t,e,n){const{state:o}=n,r=o.getBlockOrder(),c=b(e,r);return c.from.blockId!==c.to.blockId||c.from.blockId!==n.blockId?null:{kind:"wrap",open:t.open,close:t.close}}(c,r,t);if(e)return e}return g(r)?o.overtype&&function(t,e){if(!function(t){const e=W.get(t);return"quote"===e?.kind?e:J.get(t)}(e))return!1;const n=t.state.selection;if(!p(n))return!1;const o=a(t.block),r=n.anchor.offset;if(o[r]!==e)return!1;const c=t.pairStack.peek(t.blockId,r);return Boolean(c&&c.char===e)}(t,n)?{kind:"overtype"}:c&&function(t,e){const n="quote"===t.kind?e.config.quotes:e.config.brackets;if("never"===n)return!1;const o=e.state.selection;if(!p(o))return!0;const r=a(e.block),c=o.anchor.offset;if("quote"===t.kind&&"'"===t.open&&function(t,e){if(e<=0)return!1;const n=t[e-1];return!!n&&/[A-Za-z0-9_]/.test(n)}(r,c))return!1;if("always"===n)return!0;if("beforeWhitespace"===n)return function(t,e){if(e>=t.length)return!0;const n=t[e];return!n||!!/\s/.test(n)||!!J.has(n)}(r,c);if("quote"===t.kind){const t=e.getTokenAt(e.blockId,c);return!t||"string"!==t.type&&"comment"!==t.type}return!0}(c,t)?{kind:"pair",close:c.close}:{kind:"passthrough"}:{kind:"passthrough"}}({state:e,block:r,blockId:o.anchor.blockId,char:t,config:this.resolvedPairing,pairStack:this.pairs,getTokenAt:this.getTokenAt});switch(s.kind){case"pair":return this.buildAutoPairTransaction(e,o.anchor.blockId,s.close,t);case"overtype":return this.buildOvertypeTransaction(e,o.anchor.blockId);case"wrap":return this.buildWrapTransaction(e,o.anchor.blockId,s.open,s.close);case"passthrough":return null}};tryDedentOnCloseBracket(t,e,n){if("brackets"!==this.resolvedIndent.mode)return null;if("}"!==n&&"]"!==n&&")"!==n)return null;const o=t.selection;if(!p(o)||!g(o))return null;const r=a(e),c=o.anchor.offset;if(!function(t,e){const{start:n}=Z(t,e);for(let o=n;o<e;o++){const e=t[o];if(" "!==e&&"\t"!==e)return!1}return!0}(r,c))return null;const{start:s}=Z(r,c);if(s===c)return null;const i=o.anchor.blockId,l=this.findTrackedCloseAfter(r,c,n,i);if(null!==l)return t.transaction("input").deleteTextAt(i,s,l).setSelection(h(i,s+1)).build();const d=Y(r.slice(s,c),this.resolvedIndent.useSpaces,this.resolvedIndent.spaceCount);if(0===d.removed.length)return null;const u=c-d.removed.length;return t.transaction("input").deleteTextAt(i,u,c).insertText(i,u,n,[]).setSelection(h(i,u+1)).build()}findTrackedCloseAfter(t,e,n,o){for(let r=e;r<t.length;r++){const e=t[r];if(" "!==e&&"\t"!==e&&"\n"!==e){if(e===n){const t=this.pairs.peek(o,r);if(t&&t.char===n)return r}return null}}return null}buildAutoPairTransaction(t,e,n,o){const r=t.selection;if(!p(r))throw new Error("buildAutoPairTransaction requires a text selection");const c=r.anchor.offset,s=`${o}${n}`,i=t.transaction("input").insertText(e,c,s,[]).setSelection(h(e,c+1)).build();return this.pendingPairOps.push({kind:"push",blockId:e,offset:c+1,char:n}),i}buildOvertypeTransaction(t,e){const n=t.selection;if(!p(n))throw new Error("buildOvertypeTransaction requires a text selection");const o=n.anchor.offset;return this.pendingPairOps.push({kind:"take",blockId:e,offset:o}),t.transaction("input").setSelection(h(e,o+1)).build()}buildWrapTransaction(t,e,n,o){const r=t.selection;if(!p(r))throw new Error("buildWrapTransaction requires a text selection");const c=function(t,e){const n=b(t,e);return{fromOffset:n.from.offset,toOffset:n.to.offset}}(r,t.getBlockOrder()),s=b(r,t.getBlockOrder()).from===r.anchor,i=c.fromOffset+1,a=c.toOffset+1,l=s?i:a,d=s?a:i;return t.transaction("input").insertText(e,c.toOffset,o,[]).insertText(e,c.fromOffset,n,[]).setSelection({anchor:{blockId:e,offset:l},head:{blockId:e,offset:d}}).build()}};function nt(t,e){const n=t.getState();if(!p(n.selection))return!1;const o=n.selection,r=n.getBlock(o.anchor.blockId);return!(!r||"code_block"!==r.type)&&e({state:n,sel:o,block:r,blockId:o.anchor.blockId,offset:o.anchor.offset})}function ot(t,e,n,r){const c={Enter:()=>function(t,e){return nt(t,({state:n,block:r,blockId:c,offset:s})=>{if(!g(n.selection))return!1;const i=a(r);if(i.endsWith("\n")&&s===i.length)return function(t,e,n){const r=t.getState(),c=n.length-1,s=o(),i=r.transaction("input").deleteTextAt(e,c,n.length).splitBlock(e,c,s).setBlockType(s,m("paragraph")).setSelection(h(s,0)).build();return t.dispatch(i),!0}(t,c,i);const l=Q(e.indent.useSpaces,e.indent.spaceCount);if("brackets"===e.indent.mode&&function(t,e){return function(t,e){if(e<=0||e>=t.length)return!1;const n=t[e-1],o=t[e];return!(!n||!o)&&X[o]===n}(t,e)}(i,s)){const e=G(i,s),o=`\n${e}${l}\n${e}`,r=s+1+e.length+l.length,a=n.transaction("input").insertText(c,s,o,[]).setSelection(h(c,r)).build();return t.dispatch(a),!0}const d=`\n${function(t,e,n,o){if("none"===n)return"";const r=G(t,e);return"keep"===n?r:function(t,e){const n=function(t,e){const{start:n}=Z(t,e);for(let o=e-1;o>=n;o--){const e=t[o];if(e&&" "!==e&&"\t"!==e)return e}return""}(t,e);return U.has(n)}(t,e)?r+o:r}(i,s,e.indent.mode,l)}`,u=n.transaction("input").insertText(c,s,d,[]).setSelection(h(c,s+d.length)).build();return t.dispatch(u),!0})}(t,r),Backspace:()=>function(t,e){return nt(t,({state:n,block:o,blockId:r,offset:c})=>{if(!g(n.selection))return!1;if(e.pairing.deletePair&&c>0){const s=a(o),i=s[c-1],l=s[c];if(i&&l&&function(t,e){switch(t){case"(":return")"===e;case"[":return"]"===e;case"{":return"}"===e;case'"':case"'":case"`":return e===t;default:return!1}}(i,l)){const o=e.pairStack.peek(r,c);if(o&&o.char===l){const e=n.transaction("input").deleteTextAt(r,c-1,c+1).setSelection(h(r,c-1)).build();return t.dispatch(e),!0}}}if(0!==c)return!1;const s=n.transaction("input").setBlockType(r,m("paragraph")).setSelection(n.selection).build();return t.dispatch(s),!0})}(t,r),Tab:()=>function(t,e){return nt(t,({state:n,sel:o,block:r,blockId:c,offset:s})=>{const i=Q(e.indent.useSpaces,e.indent.spaceCount);if(g(o)){const e=n.transaction("input").insertText(c,s,i,[]).setSelection(h(c,s+i.length)).build();return t.dispatch(e),!0}if(o.anchor.blockId!==c||o.head.blockId!==c)return!1;const l=a(r),d=b(o,n.getBlockOrder()),u=d.from.offset,p=d.to.offset;if(!l.slice(u,p).includes("\n")){const e=n.transaction("input").deleteTextAt(c,u,p).insertText(c,u,i,[]).setSelection(h(c,u+i.length)).build();return t.dispatch(e),!0}const m=function(t,e,n,o){const r=t.lastIndexOf("\n",e-1)+1,c=[];let s=0,i=r;for(;i<n;){c.push({offset:i,text:o}),s++;const e=t.indexOf("\n",i);if(-1===e||e>=n)break;i=e+1}return{inserts:c,totalInserted:s*o.length,lineCount:s,lineStart:r}}(l,u,p,i),v=n.transaction("input");for(let t=m.inserts.length-1;t>=0;t--){const e=m.inserts[t];e&&v.insertText(c,e.offset,e.text,[])}const x=f(o,n.getBlockOrder()),y=m.lineStart,C=p+m.totalInserted,S=x?y:C,w=x?C:y;return v.setSelection(k({blockId:c,offset:S},{blockId:c,offset:w})),t.dispatch(v.build()),m.lineCount>=2&&t.announce(e.locale().indentedNLines(m.lineCount)),!0})}(t,r),"Shift-Tab":()=>function(t,e){return nt(t,({state:n,sel:o,block:r,blockId:c,offset:s})=>{const i=a(r);if(g(o))return rt(t,n,c,s,i,e);if(o.anchor.blockId!==c||o.head.blockId!==c)return!1;const l=b(o,n.getBlockOrder()),d=l.from.offset,u=l.to.offset;if(!i.slice(d,u).includes("\n"))return rt(t,n,c,s,i,e);const p=function(t,e,n,o,r){const c=t.lastIndexOf("\n",e-1)+1,s=[];let i=0,a=0,l=c;for(;l<n;){a++;const e=Y(t.slice(l),o,r);e.removed.length>0&&(s.push({from:l,to:l+e.removed.length}),i+=e.removed.length);const c=t.indexOf("\n",l);if(-1===c||c>=n)break;l=c+1}return{deletes:s,totalRemoved:i,lineCount:a,lineStart:c}}(i,d,u,e.indent.useSpaces,e.indent.spaceCount);if(0===p.totalRemoved)return!0;const h=n.transaction("input");for(let t=p.deletes.length-1;t>=0;t--){const e=p.deletes[t];e&&h.deleteTextAt(c,e.from,e.to)}const m=f(o,n.getBlockOrder()),v=p.lineStart,x=u-p.totalRemoved,y=m?v:Math.max(v,x),C=m?Math.max(v,x):v;return h.setSelection(k({blockId:c,offset:y},{blockId:c,offset:C})),t.dispatch(h.build()),p.lineCount>=2&&t.announce(e.locale().dedentedNLines(p.lineCount)),!0})}(t,r),Escape:()=>ct(t),ArrowDown:()=>function(t){return nt(t,({state:e,block:n,blockId:o,offset:r})=>!!g(e.selection)&&-1===a(n).indexOf("\n",r)&&(it(t,e,o),!0))}(t),ArrowUp:()=>function(t){return nt(t,({state:e,block:n,blockId:o,offset:r})=>{if(!g(e.selection))return!1;const c=a(n).indexOf("\n");return!(-1!==c&&r>c)&&at(t,e,o)})}(t),ArrowRight:()=>function(t){return nt(t,({state:e,block:n,blockId:o,offset:r})=>!!g(e.selection)&&r===a(n).length&&(it(t,e,o),!0))}(t),ArrowLeft:()=>function(t){return nt(t,({state:e,blockId:n,offset:o})=>!!g(e.selection)&&0===o&&at(t,e,n))}(t)},{insertAfter:s,toggle:i}=n;s&&(c[s]=()=>function(t){return nt(t,({blockId:e})=>(st(t,e),!0))}(t)),i&&(c[i]=()=>t.executeCommand("toggleCodeBlock")),t.registerKeymap(c,{priority:"context"})}function rt(t,e,n,o,r,c){const{start:s}=Z(r,o),i=Y(r.slice(s),c.indent.useSpaces,c.indent.spaceCount);if(0===i.removed.length)return!0;const a=e.transaction("input").deleteTextAt(n,s,s+i.removed.length).setSelection(h(n,Math.max(s,o-i.removed.length))).build();return t.dispatch(a),!0}function ct(t){return nt(t,({state:e,blockId:n})=>(it(t,e,n),!0))}function st(t,e){const n=t.getState(),r=n.getBlock(e);if(!r)return;const c=l(r),s=o(),i=n.transaction("command").splitBlock(e,c,s).setBlockType(s,m("paragraph")).setSelection(h(s,0)).build();t.dispatch(i)}function it(t,e,n){const o=e.getBlockOrder(),r=o.indexOf(n);if(r<o.length-1){const n=o[r+1],c=e.transaction("command").setSelection(h(n,0)).build();return void t.dispatch(c)}st(t,n)}function at(t,e,n){const o=e.getBlockOrder(),r=o.indexOf(n);if(r<=0)return!1;const c=o[r-1],s=e.getBlock(c),i=s?l(s):0,a=e.transaction("command").setSelection(h(c,i)).build();return t.dispatch(a),!0}function lt(t,e){const n=t.getState(),o=n.selection;if(!p(o))return!1;const c=n.getBlock(o.anchor.blockId);if(!c||"code_block"===c.type)return!1;const i={language:e.defaultLanguage??"",backgroundColor:""},a=n.transaction("command");return function(t,e){if(0===l(e))return;const n=r(e);let o=0;for(const r of n)if(s(r)){if(r.text.length>0)for(const n of r.marks)t.removeMark(e.id,o,o+r.text.length,n);o+=r.text.length}else o+=1}(a,c),a.setBlockType(o.anchor.blockId,m("code_block"),i).setSelection(h(o.anchor.blockId,0)),t.dispatch(a.build()),!0}function dt(t,e){const n=d(t.doc,e);if(!n)return null;const r=C(n),s=v(t,r),a=S(s,e);if(a<0)return null;const l=t.transaction("command");if(1===s.length){const t=o();return l.insertNode(r,0,i(t)),l.removeNode(r,1),l.setSelection(h(t,0)),l.build()}l.removeNode(r,a);const u=function(t,e,n,r){const s=n[r-1];if(s&&c(s)){const e=y(t,s.id,"end");if(e)return e}const a=n[r+1];if(a&&c(a)){const e=y(t,a.id,"start");if(e)return e}const l=n[r],d=l&&c(l)?l.id:void 0,u=x(t,"start",d);if(u)return u;const g=o();return e.insertNode([],0,i(g)),h(g,0)}(t,l,s,a);return l.setSelection(u),l.build()}var ut=class{bundles=/* @__PURE__ */new Map;listeners=[];register(t){this.bundles.set(t.id,t);for(const e of this.listeners)e(t)}onRegister(t){this.listeners.push(t);for(const e of this.bundles.values())t(e)}get(t){return this.bundles.get(t)}getAll(){return[...this.bundles.values()]}},gt={insertAfter:"Mod-Enter",toggle:"Mod-Shift-M"},pt={defaultLanguage:"",useSpaces:!1,spaceCount:2,showCopyButton:!0},ft=new A("codeBlock"),ht=new A("syntaxHighlighter"),kt=class{languageMap=/* @__PURE__ */new Map;constructor(t){if(t)for(const e of t)this.registerLanguageInternal(e)}registerLanguage(t){this.registerLanguageInternal(t)}tokenize(t,e){const n=this.languageMap.get(e.toLowerCase());if(!n)return[];const o=[];for(const r of z(t,n))o.push({from:r.from,to:r.to,type:r.type});return o}getSupportedLanguages(){const t=/* @__PURE__ */new Set;for(const e of this.languageMap.values()){t.add(e.name);for(const n of e.aliases)t.add(n)}return[...t]}registerLanguageInternal(t){this.languageMap.set(t.name.toLowerCase(),t);for(const e of t.aliases)this.languageMap.set(e.toLowerCase(),t)}},bt=[{id:$.name,displayName:"Java",aliases:$.aliases,highlighting:$},{id:H.name,displayName:"JSON",aliases:H.aliases,highlighting:H},{id:q.name,displayName:"TypeScript",aliases:q.aliases,highlighting:q},{id:R.name,displayName:"XML",aliases:R.aliases,highlighting:R}],mt={label:"Code Block",tooltip:t=>t?`Code Block (${t})`:"Code Block",enteredCodeBlock:"Entered code block. Press Escape to exit.",leftCodeBlock:"Left code block.",copyCodeAria:"Copy code",escToExit:"Esc to exit",codeBlockAriaLabel:t=>`${t} code block. Press Escape to exit.`,copiedToClipboard:"Copied to clipboard",copyFailed:"Failed to copy code",deleteCodeBlockAria:"Delete code block",deletedCodeBlock:"Code block deleted",selectLanguageAria:"Select language",languageChanged:t=>`Language changed to ${t}`,plainText:"plain",indentedNLines:t=>1===t?"1 line indented":`${t} lines indented`,dedentedNLines:t=>1===t?"1 line dedented":`${t} lines dedented`},vt=/* #__PURE__ */Object.assign({"./locales/ar.ts":()=>import("./ar--Isa9OHJ.mjs"),"./locales/de.ts":()=>import("./de-Dl4QFHMa.mjs"),"./locales/es.ts":()=>import("./es-DD01rZ6N.mjs"),"./locales/fr.ts":()=>import("./fr-CfhyYN-t.mjs"),"./locales/hi.ts":()=>import("./hi-B2YB3Bo4.mjs"),"./locales/pt.ts":()=>import("./pt-DYMyMgKQ.mjs"),"./locales/ru.ts":()=>import("./ru-l73diFXn.mjs"),"./locales/zh.ts":()=>import("./zh-Baxh6v0j.mjs")});async function xt(t){return T(vt,t,mt)}var yt='[role="option"]';function Ct(t,e,n,o){const r=document.createElement("div");r.className="notectl-language-picker__option",r.setAttribute("role","option"),r.setAttribute("data-language",n),r.setAttribute("aria-selected",String(o)),r.setAttribute("tabindex",o?"0":"-1"),r.textContent=e,t.appendChild(r)}function St(t,e,n,o){const r=t.getState(),c=r.getBlock(e);if(!c||"code_block"!==c.type)return;const s=r.getNodePath(e);if(!s)return;const i={...c.attrs,[n]:o},a=r.transaction("command").setNodeAttr(s,i).build();t.dispatch(a)}var wt=class{entries=/* @__PURE__ */new Map;getTokens(t,e,n,o){const r=this.entries.get(t);if(r&&r.text===e&&r.language===n)return r.tokens;const c=o?.tokenize(e,n)??[];return this.entries.set(t,{text:e,language:n,tokens:c}),c}findTokenAt(t,e){const n=this.entries.get(t);if(!n)return;const o=n.tokens;let r=0,c=o.length-1;for(;r<=c;){const t=r+c>>>1,n=o[t];if(!n)return;if(e<n.from)c=t-1;else{if(!(e>=n.to))return n;r=t+1}}}retain(t){for(const e of this.entries.keys())t.has(e)||this.entries.delete(e)}clear(){this.entries.clear()}},_t=class{id="code-block";name="Code Block";priority=36;config;resolvedIndent;resolvedPairing;resolvedKeymap;context=null;locale;highlighter=null;tokenCache=new wt;autoPair;constructor(t){this.config={...pt,...t},this.resolvedIndent=function(t){const e=t.indent?.useSpaces??t.useSpaces??false,n=t.indent?.spaceCount??t.spaceCount??2,o=Math.max(1,Math.min(16,Math.trunc(n)));return{mode:t.indent?.mode??"brackets",useSpaces:e,spaceCount:o}}(this.config),this.resolvedPairing=function(t){const e=t.pairing;return{brackets:e?.brackets??"languageDefined",quotes:e?.quotes??"languageDefined",overtype:e?.overtype??true,deletePair:e?.deletePair??true,surround:e?.surround??"languageDefined"}}(this.config),this.resolvedKeymap={...gt,...t?.keymap},this.autoPair=new et({resolvedIndent:this.resolvedIndent,resolvedPairing:this.resolvedPairing,getTokenAt:(t,e)=>this.tokenCache.findTokenAt(t,e),getCompositionState:()=>this.context?.getCompositionState()??null})}async init(o){this.locale=await L(o,this.config.locale,mt,xt),o.registerStyleSheet(F),this.context=o,this.highlighter=function(t,e,n){const o=e.highlighter??new kt,r=/* @__PURE__ */new Map,c=new ut;c.onRegister(t=>{const e=t.highlighting;e&&o.registerLanguage&&r.get(t.id)!==e&&(o.registerLanguage(e),r.set(t.id,e),n.clear())}),t.registerService(D,c);for(const s of bt)c.register(s);return t.registerService(ht,{registerLanguage:t=>{o.registerLanguage?.(t),n.clear()},getSupportedLanguages:()=>o.getSupportedLanguages(),tokenize:(t,e)=>o.tokenize(t,e),getTokenAt:(t,e)=>n.findTokenAt(t,e)}),o}(o,this.config,this.tokenCache),function(o){o.registerNodeSpec({type:"code_block",group:"block",content:{allow:["text"]},selectable:!0,attrs:{language:{default:""},backgroundColor:{default:""}},toDOM(t){const e=N("pre",t.id);e.className="notectl-code-block",e.setAttribute("dir","ltr"),e.setAttribute("part","code-block");const n=document.createElement("code");return n.className="notectl-code-block__content",n.setAttribute("part","code-block-content"),e.appendChild(n),e},toHTML(o,r,c){const s=t(o.attrs?.language??""),i=String(o.attrs?.backgroundColor??""),a=s?` class="language-${s}"`:"";return`<pre dir="ltr"${e(i)?n(`background-color: ${i}`,c):""}><code${a}>${r||""}</code></pre>`},parseHTML:[{tag:"pre",getAttrs(t){const e=t.querySelector("code"),n=e?.className.match(/language-(\S+)/)?.[1]??"";return{language:(e?.getAttribute("data-language")??"")||n}}}],sanitize:{tags:["pre","code"],attrs:["data-language","class","style"]}})}(o),this.registerNodeView(o),function(t,e){t.registerCommand("toggleCodeBlock",()=>function(t,e){const n=t.getState();if(!p(n.selection))return!1;const o=n.getBlock(n.selection.anchor.blockId);if(!o)return!1;if("code_block"===o.type){const e=n.transaction("command").setBlockType(n.selection.anchor.blockId,m("paragraph")).setSelection(n.selection).build();return t.dispatch(e),!0}return lt(t,e)}(t,e)),t.registerCommand("insertCodeBlock",()=>lt(t,e)),t.registerCommand("setCodeBlockLanguage",()=>!1),t.registerCommand("setCodeBlockBackground",()=>!1),t.registerCommand("exitCodeBlock",()=>ct(t)),t.registerCommand("deleteCodeBlock",()=>function(t){const e=t.getState();if(!p(e.selection))return!1;const n=e.getBlock(e.selection.anchor.blockId);if(!n||"code_block"!==n.type)return!1;const o=dt(e,n.id);return!!o&&(t.dispatch(o),!0)}(t))}(o,this.config),ot(o,this.config,this.resolvedKeymap,{indent:this.resolvedIndent,pairing:this.resolvedPairing,pairStack:this.autoPair.pairStack,locale:()=>this.locale}),!1!==this.config.inputRule&&function(t){t.registerInputRule({pattern:/^```(\w*) $/,handler:(t,e,n,o)=>{const r=t.selection;if(!p(r))return null;if(!g(r))return null;const c=t.getBlock(r.anchor.blockId);if(!c||"paragraph"!==c.type)return null;const s={language:e[1]??"",backgroundColor:""};return t.transaction("input").deleteTextAt(r.anchor.blockId,n,n+e[0].length).setBlockType(r.anchor.blockId,m("code_block"),s).setSelection(h(r.anchor.blockId,0)).build()}})}(o),function(t,e,n){t.registerToolbarItem({id:"code_block",group:"block",icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H5V5h14v14z"/><path d="M11 14.17L8.83 12 11 9.83 9.59 8.41 6 12l3.59 3.59L11 14.17zm3.41 1.42L18 12l-3.59-3.59L13 9.83 15.17 12 13 14.17l1.41 1.42z"/></svg>',label:e.label,tooltip:e.tooltip(n?E(n):void 0),command:"toggleCodeBlock",isActive:t=>!!p(t.selection)&&"code_block"===t.getBlock(t.selection.anchor.blockId)?.type})}(o,this.locale,this.resolvedKeymap.toggle),function(t){t.registerMiddleware((t,e,n)=>{if(!t.steps.some(t=>"addMark"===t.type&&"code_block"===e.getBlock(t.blockId)?.type))return void n(t);const o=t.steps.filter(t=>"addMark"!==t.type||"code_block"!==e.getBlock(t.blockId)?.type);n({...t,steps:o})},{name:"code-block:mark-guard",priority:50})}(o),function(t,e,n){t.registerService(ft,{setLanguage(e,n){St(t,e,"language",n)},getLanguage(t){const e=n();if(!e)return"";const o=e.getState().getBlock(t);return o&&"code_block"===o.type?o.attrs?.language??"":""},setBackground(e,n){St(t,e,"backgroundColor",n)},getBackground(t){const e=n();if(!e)return"";const o=e.getState().getBlock(t);return o&&"code_block"===o.type?o.attrs?.backgroundColor??"":""},isCodeBlock(t){const e=n();return!!e&&"code_block"===e.getState().getBlock(t)?.type},getSupportedLanguages(){const t=e();return t?t.getSupportedLanguages():[]}})}(o,()=>this.highlighter,()=>this.context),function(t){t.registerPasteInterceptor((t,e,n)=>{if(!t)return null;const o=n.transaction("paste"),r=M(n,o);if("code_block"!==O(r)?.type)return null;const{blockId:c,offset:s}=r;return o.insertText(c,s,t,[]),o.setSelection(h(c,s+t.length)),o.build()},{name:"code-block:paste",priority:10})}(o),o.registerTextInputInterceptor(this.autoPair.handleTextInput,{name:"code-block:auto-pair",priority:10}),function(t){t.registerNodeSpecExtension("table_cell",t=>!t.content||t.content.allow.includes("code_block")?t:{...t,content:{...t.content,allow:[...t.content.allow,"code_block"]}})}(o)}destroy(){this.context=null,this.highlighter=null,this.tokenCache.clear(),this.autoPair.clear()}onStateChange(t,e,n){if(this.autoPair.syncOnStateChange(e,n),!this.context)return;const o=p(t.selection)?t.selection.anchor.blockId:null,r=p(e.selection)?e.selection.anchor.blockId:null,c=o?t.getBlock(o):void 0,s=r?e.getBlock(r):void 0,i="code_block"===c?.type,a="code_block"===s?.type;!i&&a?this.context.announce(this.locale.enteredCodeBlock):i&&!a&&this.context.announce(this.locale.leftCodeBlock)}decorations(t){return function(t,e){const n=[],o=function(t){if(!p(t.selection))return null;const e=t.selection.anchor.blockId;return"code_block"===t.getBlock(e)?.type?e:null}(t);if(o&&n.push(w(o,{class:"notectl-code-block--focused"})),e.highlighter){const o=/* @__PURE__ */new Set;for(const r of t.getBlockOrder()){const c=t.getBlock(r);if(!c||"code_block"!==c.type)continue;const s=c.attrs?.language??"";if(!s)continue;const i=a(c);if(!i)continue;o.add(r);const l=e.tokenCache.getTokens(r,i,s,e.highlighter);for(const t of l)n.push(_(r,t.from,t.to,{class:`notectl-token--${t.type}`}))}e.tokenCache.retain(o)}return 0===n.length?I.empty:I.create(n)}(t,{highlighter:this.highlighter,tokenCache:this.tokenCache})}registerNodeView(t){const e=new j(t.getContainer()),n=this.highlighter,o={popupManager:e,getSupportedLanguages:()=>n?.getSupportedLanguages()??[]};t.registerNodeView("code_block",function(t,e=mt,n){return(o,r,c)=>{const s=document.createElement("pre");s.className="notectl-code-block",s.setAttribute("data-block-id",o.id),s.setAttribute("dir","ltr"),s.setAttribute("role","group"),s.setAttribute("aria-roledescription","code block"),s.setAttribute("part","code-block");const i=document.createElement("div");i.className="notectl-code-block__header",i.setAttribute("contenteditable","false"),i.setAttribute("part","code-block-header");const l=document.createElement("button");l.className="notectl-code-block__language-btn",l.type="button",l.setAttribute("aria-haspopup","listbox"),l.setAttribute("aria-expanded","false"),l.setAttribute("aria-label",e.selectLanguageAria);let d=null;!1!==t.showCopyButton&&(d=document.createElement("button"),d.className="notectl-code-block__copy",d.setAttribute("aria-label",e.copyCodeAria),d.setAttribute("data-notectl-no-print",""),d.type="button",d.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="14" height="14"><path d="M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z"/></svg>');const u=document.createElement("button");u.className="notectl-code-block__delete",u.setAttribute("aria-label",e.deleteCodeBlockAria),u.title=e.deleteCodeBlockAria,u.setAttribute("data-notectl-no-print",""),u.type="button",u.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="14" height="14"><path d="M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z"/></svg>';const g=document.createElement("span");g.className="notectl-sr-only",g.setAttribute("aria-live","assertive"),g.setAttribute("aria-atomic","true");const p=document.createElement("div");p.className="notectl-code-block__actions",d&&p.appendChild(d),p.appendChild(u),i.appendChild(l),i.appendChild(p),i.appendChild(g);const f=document.createElement("code");f.className="notectl-code-block__content",f.setAttribute("part","code-block-content");const h=document.createElement("div");h.className="notectl-code-block__esc-hint",h.setAttribute("contenteditable","false"),h.setAttribute("aria-hidden","true"),h.setAttribute("data-notectl-no-print",""),h.textContent=e.escToExit,s.appendChild(i),s.appendChild(f),s.appendChild(h),t.background&&P(s,"--notectl-code-block-bg",t.background),t.headerBackground&&P(s,"--notectl-code-block-header-bg",t.headerBackground),t.textColor&&P(s,"--notectl-code-block-color",t.textColor),t.headerColor&&P(s,"--notectl-code-block-header-color",t.headerColor);let k=o.id;function b(t){const o=t.attrs?.language??"",r=o||e.plainText;l.innerHTML="";const c=document.createElement("span");if(c.className="notectl-code-block__language",c.textContent=r,l.appendChild(c),n){const t=document.createElement("span");t.className="notectl-code-block__chevron",t.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="10" height="10"><path d="M4 6l4 4 4-4" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg>',l.appendChild(t)}s.setAttribute("aria-label",e.codeBlockAriaLabel(r)),o?f.setAttribute("data-language",o):f.removeAttribute("data-language");const i=t.attrs?.backgroundColor??"";P(s,"backgroundColor",i||"")}function m(t){g.textContent=t,setTimeout(()=>{g.textContent=""},1e3)}return b(o),d&&d.addEventListener("click",t=>{t.preventDefault(),t.stopPropagation();const n=r().getBlock(k);n&&function(t){const e=globalThis.navigator?.clipboard;return e&&"function"==typeof e.writeText?e.writeText(t):Promise.reject(/* @__PURE__ */new Error("Clipboard API unavailable"))}(a(n)).then(()=>m(e.copiedToClipboard),()=>m(e.copyFailed))}),u.addEventListener("click",t=>{t.preventDefault(),t.stopPropagation();const n=dt(r(),k);n&&(g.textContent=e.deletedCodeBlock,c(n))}),n&&l.addEventListener("click",t=>{t.preventDefault(),t.stopPropagation();const o=r().getBlock(k);if(!o)return;const s=o.attrs?.language??"";!function(t){const{anchor:e,languages:n,currentLanguage:o,onSelect:r,popupManager:c,locale:s}=t;c.open({anchor:e,ariaRole:"listbox",ariaLabel:s.selectLanguageAria,className:"notectl-language-picker",position:"below-start",restoreFocusTo:e,content(t,e){const c=o.toLowerCase();Ct(t,s.plainText,"",""===c);const i=[...n].sort((t,e)=>t.localeCompare(e));for(const n of i)Ct(t,n,n,c===n.toLowerCase());V({container:t,itemSelector:yt,onSelect(t){const n=t.getAttribute("data-language")??"";r(n),e()},onClose(){e()}}),t.addEventListener("click",t=>{const n=t.target.closest(yt);if(!n)return;const o=n.getAttribute("data-language")??"";r(o),e()})},onClose(){e.setAttribute("aria-expanded","false")}}),e.setAttribute("aria-expanded","true")}({anchor:l,languages:n.getSupportedLanguages(),currentLanguage:s,locale:e,popupManager:n.popupManager,onSelect(t){if(t===s)return;const n=r(),o=n.getBlock(k);if(!o)return;const i=n.getNodePath(k);if(!i)return;const a={...o.attrs,language:t};c(n.transaction("command").setNodeAttr(i,a).build());const l=t||e.plainText;m(e.languageChanged(l))}})}),{dom:s,contentDOM:f,update:t=>"code_block"===t.type&&(k=t.id,s.setAttribute("data-block-id",t.id),b(t),!0),selectNode(){s.classList.add("notectl-code-block--selected")},deselectNode(){s.classList.remove("notectl-code-block--selected")},destroy(){}}}}(this.config,this.locale,o))}};export{ft as a,kt as i,mt as n,ht as o,xt as r,_t as t};
2
- //# sourceMappingURL=CodeBlockPlugin-B4AcDJRK.mjs.map
@@ -1,2 +0,0 @@
1
- import{A as t,B as n,D as o,E as e,N as r,g as c,h as i,k as s}from"./Document-ssR6hBzG.mjs";import{r as l}from"./NodeResolver-F4RtpoEd.mjs";import{c as f,d as u,f as d,i as a,n as k,o as b,p as m,u as h}from"./Selection-DC6AOGgF.mjs";import{r as I}from"./TypeBrands-Ch9856Gb.mjs";import{i as g,n as p,o as B,r as x}from"./NavigationQueries-CaKfccu7.mjs";import{C as N,b as S,c as v,w as O,y as j}from"./BlockInsertion-CXfXqUZl.mjs";import{t as A}from"./CursorMarks-CqHLzGNI.mjs";import{t as T}from"./ContentModel-dkGOh3N7.mjs";import{n as w,r as M,t as y}from"./NodeSelectionCommands-CAqIHW_6.mjs";function C(t,n){if("after"===n.side)return D(t,n);const o=t.getBlockOrder(),e=o.indexOf(n.blockId);if(e<=0)return null;const r=o[e-1];if(!r)return null;if(g(t,r)){const n=l(t.doc,r)??[];return t.transaction("input").setSelection(a(r,n)).build()}const c=t.getBlock(r);if(!c)return null;const i=s(c);return t.transaction("input").setSelection(k(r,i)).build()}function P(t,n){if("before"===n.side)return D(t,n);const o=t.getBlockOrder(),e=o.indexOf(n.blockId);if(e>=o.length-1)return null;const r=o[e+1];if(!r)return null;if(g(t,r)){const n=l(t.doc,r)??[];return t.transaction("input").setSelection(a(r,n)).build()}return t.transaction("input").setSelection(k(r,0)).build()}function D(t,n){const o=l(t.doc,n.blockId)??[],e=a(n.blockId,o);return y(t,e)}function _(t,n){const o=l(t.doc,n);if(!o||0===o.length)return-1;const e=o[0];return t.doc.children.findIndex(t=>t.id===e)}function E(t,n,o){const e=s(n),r=n.id===o.from.blockId?o.from.offset:0,c=n.id===o.to.blockId?o.to.offset:e;r<c&&t.deleteTextAt(n.id,r,c)}function Q(t,n,o){const r=/* @__PURE__ */new Map;let c;for(let s=o.length-1;s>=0;s--){const{parentPath:l,siblings:f,index:u}=O(t,o[s]);if(u<0)continue;const d=l.join("/"),a=r.get(d)??0;if(r.set(d,a+1),f.length-a>1){n.removeNode(l,u);continue}const k=e();n.insertNode(l,0,i(k)),n.removeNode(l,1),0===s&&(c=k)}return c}function R(t,o){return n(o)&&!g(t,o.id)}function q(t,o,r,c,f){const u=t.doc.children[c],d=t.doc.children[f];if(!u||!d)return;const a=t.getBlock(r.to.blockId);if(!a)return;const k=R(t,u),b=R(t,d),m=0===r.from.offset&&z(u)===r.from.blockId,h=r.to.offset===s(a)&&F(d)===r.to.blockId,I=!k&&(n(u)||m),g=!b&&(n(d)||h);let p;k?E(o,u,r):I||L(t,o,[u.id],u,l(t.doc,r.from.blockId)??[],r.from.blockId,r.from.offset),b?E(o,d,r):g||U(t,o,[d.id],d,l(t.doc,r.to.blockId)??[],r.to.blockId,r.to.offset);let B=0;I&&b?p=r.to.blockId:I&&(p=e(),o.insertNode([],c,i(p)),B=1);const x=[];I&&x.push(c);for(let n=c+1;n<f;n++)x.push(n);g&&x.push(f);for(let n=x.length-1;n>=0;n--)o.removeNode([],x[n]+B);return k&&b&&o.mergeBlocksAt(r.from.blockId,r.to.blockId),p}function z(t){if(n(t))return t.id;const e=o(t)[0];return e?z(e):t.id}function F(t){if(n(t))return t.id;const e=o(t),r=e[e.length-1];return r?F(r):t.id}function G(t,n){return!!t.schema.getNodeSpec?.(n.type)?.content&&T(t.schema,n.type,"paragraph")}function H(t,n,e,r,c,i){const s=o(r),l=G(t,r);for(let o=i-1;o>=c;o--){const r=s[o];r&&(l?n.removeNode(e,o):J(t,n,[...e,r.id],r))}}function J(t,r,c,l){if(n(l)){const t=s(l);return void(t>0&&r.deleteTextAt(l.id,0,t))}const f=o(l);if(!G(t,l))return void H(t,r,c,l,0,f.length);const u=1===f.length?f[0]:void 0;if(!u||!v(u)){for(let t=f.length-1;t>=0;t--)r.removeNode(c,t);r.insertNode(c,0,i(e()))}}function K(t,n){const e=n.indexOf(t.id),r=e>=0?n[e+1]:void 0;return o(t).findIndex(t=>t.id===r)}function L(t,n,e,r,c,i,l){const f=o(r),u=K(r,c);if(u<0)return;H(t,n,e,r,u+1,f.length);const d=f[u];if(d.id===i){const t=s(d);return void(l<t&&n.deleteTextAt(i,l,t))}L(t,n,[...e,d.id],d,c,i,l)}function U(t,n,e,r,c,i,s){const l=o(r),f=K(r,c);if(f<0)return;H(t,n,e,r,0,f);const u=l[f];u.id!==i?U(t,n,[...e,u.id],u,c,i,s):s>0&&n.deleteTextAt(i,0,s)}function V(n,o,c="input"){const s=n.selection;if(u(s))return M(n,s,o,c);if(h(s))return function(t,n,o,r){const{parentPath:c,siblings:s,index:l}=O(t,n.blockId),f="before"===n.side?Math.max(l,0):l>=0?l+1:s.length,u=e(),d=t.transaction(r);return d.insertNode(c,f,i(u)),d.insertText(u,0,o,[]),d.setSelection(k(u,o.length)),d.build()}(n,s,o,c);const l=n.transaction(c),a=function(n){if(n.storedMarks)return n.storedMarks;const o=n.selection;if(!d(o))return[];const e=n.getBlock(o.anchor.blockId);return e?f(o)?r(e,o.anchor.offset,t=>A(n.schema,t)):t(e,o.anchor.offset):[]}(n);let b;f(s)||(b=et(n,l));const m=N(s,n.getBlockOrder()),I=b??m.blockId,g=b?0:m.offset;return l.insertText(I,g,o,a),l.setSelection(k(I,g+o.length)),l.build()}function W(t){if(u(t.selection))return y(t,t.selection);if(h(t.selection))return null;if(f(t.selection))return null;if(function(t){if(!d(t.selection))return!1;const n=ot(t);if(!n)return!1;const o=m(t.selection,t.getBlockOrder());return o.from.blockId===n.from.blockId&&o.from.offset===n.from.offset&&o.to.blockId===n.to.blockId&&o.to.offset===n.to.offset}(t))return function(t){const n=e(),o=t.transaction("input"),r=t.doc.children.length;o.insertNode([],0,i(n));for(let e=r;e>=1;e--)o.removeNode([],e);return o.setSelection(k(n,0)),o.build()}(t);const n=t.transaction("input"),o=et(t,n),r=m(t.selection,t.getBlockOrder()),c=o??r.from.blockId,s=o?0:r.from.offset;return n.setSelection(k(c,s)),n.build()}function X(t){const n=t.selection;if(u(n))return w(t,n);if(h(n))return function(t,n){const{parentPath:o,index:r}=O(t,n.blockId);if(r<0)return null;const c="before"===n.side?r:r+1,s=e(),l=t.transaction("input");return l.insertNode(o,c,i(s)),l.setSelection(k(s,0)),l.build()}(t,n);const o=t.transaction("input");let r;f(n)||(r=et(t,o));const c=N(n,t.getBlockOrder()),s=r??c.blockId,l=r?0:c.offset,d=e();return o.splitBlock(s,l,d),o.setSelection(k(d,0)),o.build()}function Y(t){const n=t.selection;if(!d(n))return null;const o=t.transaction("input");let e;if(f(n)||(e=et(t,o)),e)o.insertInlineNode(e,0,c(I("hard_break"))),o.setSelection(k(e,1));else{const{blockId:e,offset:r}=N(n,t.getBlockOrder());o.insertInlineNode(e,r,c(I("hard_break"))),o.setSelection(k(e,r+1))}return o.build()}function Z(t){return tt(t,"backward")}function $(t){return tt(t,"forward")}function tt(t,n){const o=t.selection;if(!d(o))return null;const e=t.getBlockOrder(),r=e.indexOf(o.anchor.blockId),c="backward"===n?r-1:r+1;if(c<0||c>=e.length)return null;const i=e[c];if(!i)return null;if(x(t,o.anchor.blockId)||x(t,i))return null;const f=B(t,o.anchor.blockId,i);if(!f&&p(t,o.anchor.blockId))return null;if(g(t,i)){const n=l(t.doc,i)??[];return t.transaction("input").setSelection(a(i,n)).build()}if(!f)return null;if("backward"===n){const n=t.getBlock(i);if(!n)return null;const e=s(n);return t.transaction("input").mergeBlocksAt(i,o.anchor.blockId).setSelection(k(i,e)).build()}return t.transaction("input").mergeBlocksAt(o.anchor.blockId,i).setSelection(k(o.anchor.blockId,o.anchor.offset)).build()}function nt(t){const n=ot(t);return n?t.transaction("command").setSelection(b(n.from,n.to)).build():t.transaction("command").setSelection(t.selection).build()}function ot(t){const n=t.doc.children,o=n[0],e=n[n.length-1];if(!o||!e)return null;const r=j(o),c=S(e),i=t.getBlock(c);return{from:{blockId:r,offset:0},to:{blockId:c,offset:i?s(i):0}}}function et(t,n){if(!d(t.selection))return;const o=t.getBlockOrder(),r=m(t.selection,o),c=o.indexOf(r.from.blockId),s=o.indexOf(r.to.blockId);if(c===s)return void n.deleteTextAt(r.from.blockId,r.from.offset,r.to.offset);const l=_(t,r.from.blockId),f=_(t,r.to.blockId);return l===f||l<0||f<0?function(t,n,o,r,c,s){const l=o.slice(c,s+1),f=l.findIndex(n=>!g(t,n));if(f<0)return function(t,n,o){const r=o[0];if(!r)return;const{parentPath:c,index:s}=O(t,r);if(s<0)return;const l=Q(t,n,o);if(l)return l;const f=e();return n.insertNode(c,s,i(f)),f}(t,n,l);const u=l[f],d=[];let a,k=[];for(const e of l){a&&B(t,a,e)||(k=[],d.push(k)),g(t,e)||k.push(e),a=e;const o=t.getBlock(e);o&&E(n,o,r)}Q(t,n,l.filter(n=>g(t,n)));for(const[e,...i]of d)if(e)for(const t of i)n.mergeBlocksAt(e,t);return 0===f?void 0:u}(t,n,o,r,c,s):q(t,n,r,l,f)}export{Z as a,X as c,V as i,C as l,W as n,$ as o,Y as r,nt as s,et as t,P as u};
2
- //# sourceMappingURL=Commands-Bk7Cl1nH.mjs.map
@@ -1,2 +0,0 @@
1
- import{c as t,n as e}from"./HTMLUtils-DTpsjZyK.mjs";import{P as n,_ as o,g as r,m as s,p as a,z as i}from"./Document-ssR6hBzG.mjs";import{a as c,i as l,r as u}from"./TypeBrands-Ch9856Gb.mjs";import{n as f}from"./ContentModel-dkGOh3N7.mjs";import{C as d,S as p,T as h,c as g,f as m,g as y,h as N,n as T,o as E,r as A,s as b,t as L}from"./TableDimensions-BSEOEox2.mjs";import{n as k,t as w}from"./HTMLSanitization-Ce9dVT1q.mjs";var O=/* @__PURE__ */new Set(["p","div","ul","ol","table","blockquote"]);function D(t,e){const n=t.tagName.toLowerCase();for(const{rule:o,type:r}of e){if(o.tag!==n)continue;const e=o.getAttrs?.(t);if(!1!==e)return{type:r,...e?{attrs:e}:{}}}return null}function v(t,e,n){const o=t.tagName.toLowerCase(),r=[...e];for(const{rule:s,type:a}of n){if(s.tag!==o||r.some(t=>t.type===a))continue;const e=s.getAttrs?.(t);!1!==e&&r.push({type:l(a),...e&&Object.keys(e).length>0?{attrs:e}:{}})}return r}function C(t,e,n,o=O){return!D(t,n)&&(o.has(t.tagName.toLowerCase())||null!==D(t,e))}function _(t,e,n,o=O){return R(e,n,o)(t)}function R(t,e,n=O){const o=/* @__PURE__ */new WeakMap,r=s=>{const a=o.get(s);if(void 0!==a)return a;const i=!D(s,e)&&Array.from(s.children).some(o=>{const s=o;return C(s,t,e,n)||r(s)});return o.set(s,i),i};return r}var M=/[ \t\n\r\f]+/g,I=/* @__PURE__ */new Set(["P","DIV","H1","H2","H3","H4","H5","H6","BLOCKQUOTE","UL","OL","LI","TABLE","THEAD","TBODY","TFOOT","TR","TD","TH","HR","FIGURE","FIGCAPTION","SECTION","ARTICLE","HEADER","FOOTER","MAIN","ASIDE","NAV","DL","DT","DD"]),x=/* @__PURE__ */new Set(["PRE","TEXTAREA"]),S=/* @__PURE__ */new Set(["pre","pre-wrap","pre-line","break-spaces"]);function H(t){P(t)}function P(t){const e={lastTextNode:null,collapsePending:!0};for(const n of Array.from(t.childNodes))j(n,e);B(e.lastTextNode)}function j(t,e){if(t.nodeType===Node.TEXT_NODE)return void function(t,e){let n=t.data.replace(M," ");e.collapsePending&&n.startsWith(" ")&&(n=n.slice(1)),t.data=n,0!==n.length&&(e.collapsePending=n.endsWith(" "),e.lastTextNode=t)}(t,e);if(t.nodeType!==Node.ELEMENT_NODE)return;const n=t;if(function(t){if(x.has(t.tagName))return!0;const e=(t.style?.whiteSpace??"").toLowerCase();return S.has(e)}(n))W(e);else{if(function(t){return I.has(t.tagName)}(n))return W(e),void P(n);for(const t of Array.from(n.childNodes))j(t,e)}}function W(t){B(t.lastTextNode),t.lastTextNode=null,t.collapsePending=!0}function B(t){t?.data.endsWith(" ")&&(t.data=t.data.slice(0,-1))}function X(t,e){!function(t){for(const e of Array.from(t.querySelectorAll("[style]"))){const t=q(e);if(!t||t.length>0)continue;const n=e.getAttribute("style")??"";p(n).length>256||(t.cssText=n)}}(t),y(t,e,256)}function q(t){return t.style}function F(t,n,o){const r=n?n.getAllowedTags():["p","br","div","span"],a=n?n.getAllowedAttrs():["style","dir","id"];a.includes("data-block-id")||a.push("data-block-id"),o?.styleMap&&!a.includes("class")&&a.push("class");const i=document.createElement("template");i.innerHTML=k(t,{ALLOWED_TAGS:r,ALLOWED_ATTR:a,ALLOWED_URI_REGEXP:e,...w()},n);const c=i.content;X(c,N(n,o?.styleMap)),H(c);const l=function(t){const e=t?.getBlockParseRules()??[],n=t?.getInlineParseRules()??[],o=t?.getMarkParseRules()??[],r=/* @__PURE__ */new WeakMap,s=t=>{const e=r.get(t);if(e)return e;const n=t.parentElement,a=v(t,n?s(n):[],o);return r.set(t,a),a};return{registry:t,blockRules:e,inlineRules:n,markRules:o,adoptedIds:/* @__PURE__ */new Set,hasBlockDescendants:R(e,n),ancestorMarks:t=>t.parentElement?s(t.parentElement):[]}}(n),u=[];for(const e of Array.from(c.childNodes))U(e,u,l);if(0===u.length)return s();const d=s(u);return n?f(d,n):d}function U(t,e,n){const{adoptedIds:r,registry:s}=n;if(t.nodeType===Node.ELEMENT_NODE){const i=t,l=i.tagName.toLowerCase();if("ul"===l||"ol"===l){const t="ol"===l?"ordered":"bullet",o=i.getAttribute("dir");return void G(i,t,0,e,n,o&&m.has(o)?o:void 0)}if("table"===l)return void function(t,e,n){const{adoptedIds:o,registry:r}=n,s=[],i=function(t){const e=[];for(const n of Array.from(t.children)){const t=n.tagName.toLowerCase();if("col"===t){z(n,void 0,e);continue}if("colgroup"!==t)continue;const o=n,r=Q(o),s=Array.from(o.children).filter(t=>"col"===t.tagName.toLowerCase());if(0!==s.length)for(const n of s)z(n,r,e);else K(r,b(o.getAttribute("span")),e)}return E(e)}(t),l=!r||!!r.getNodeSpec("table_cell")?.attrs?.align,u=function(t){const e=[];for(const n of Array.from(t.children)){const t=n.tagName.toLowerCase();if("tr"===t)e.push(n);else if("thead"===t||"tbody"===t||"tfoot"===t)for(const o of Array.from(n.children))"tr"===o.tagName.toLowerCase()&&e.push(o)}return e}(t);for(const f of u){const t=[];for(const r of Array.from(f.children)){const e=r.tagName.toLowerCase();if("td"!==e&&"th"!==e)continue;const s=r,i=$(s,n),u={};Z(s,u),l&&ct(s,u);const f=a(c("table_cell"),i,d(s,o),Object.keys(u).length>0?u:void 0,it(s));t.push(f)}const e={};Y(f,e),s.push(a(c("table_row"),t,d(f,o),Object.keys(e).length>0?e:void 0,it(f)))}if(s.length>0){const n={};!function(t,e){const n=t.getAttribute("style")??"",o=J.exec(n);o?.[1]&&(e.borderColor="transparent"===o[1]?"none":o[1])}(t,n),i&&(n.columnWidthsPx=i),e.push(a(c("table"),s,d(t,o),Object.keys(n).length>0?n:void 0,it(t)))}}(i,e,n);if("blockquote"===l)return void function(t,e,n){const r=tt(t,n);0===r.length&&r.push(a(c("paragraph"),[o("")]));const s={};ct(t,s),at(t,s),e.push(a(c("blockquote"),r,d(t,n.adoptedIds),Object.keys(s).length>0?s:void 0,it(t)))}(i,e,n);const u=D(i,n.blockRules);if("paragraph"===(u?.type??"paragraph")&&n.hasBlockDescendants(i))return void function(t,e,n){const o={};ct(t,o),at(t,o);const r=tt(t,n);for(const s of r)e.push(nt(s,o,n.registry))}(i,e,n);const f=u?s?.getNodeSpec(u.type):void 0,p=f?.isVoid?[o("")]:ot(i,n),h={...u?.attrs};u&&!f?.attrs?.align||ct(i,h),u&&!f?.attrs?.dir||at(i,h),e.push(a(c(u?.type??"paragraph"),p,d(i,r),Object.keys(h).length>0?h:void 0,it(i)))}else t.nodeType===Node.TEXT_NODE&&t.textContent?.trim()&&e.push(a(c("paragraph"),[o(t.textContent.trim())]))}function G(t,e,n,o,r,s){for(const a of Array.from(t.children)){const t=a.tagName.toLowerCase();if("li"===t){const t=a,i=t.querySelector(':scope > input[type="checkbox"]'),c={listType:null!==i?"checklist":e,indent:n,checked:i?.hasAttribute("checked")??!1},l=t.getAttribute("dir"),u=l&&m.has(l)?l:s;u&&(c.dir=u),o.push(V(t,c,i,r));for(const e of Array.from(t.children)){const t=e.tagName.toLowerCase();if("ul"===t||"ol"===t){const s="ol"===t?"ordered":"bullet",a=e.getAttribute("dir");G(e,s,n+1,o,r,a&&m.has(a)?a:u)}}}else if("ul"===t||"ol"===t){const e="ol"===t?"ordered":"bullet",i=a.getAttribute("dir");G(a,e,n+1,o,r,i&&m.has(i)?i:s)}}}function V(t,e,r,s){const{adoptedIds:i}=s,l=it(t),u=t=>{if(t.nodeType!==Node.ELEMENT_NODE)return!1;const e=t.tagName.toLowerCase();return"ul"===e||"ol"===e};if(!Array.from(t.childNodes).some(t=>!u(t)&&et(t,s))){const n=ot(t,s,!0);return a(c("list_item"),n,d(t,i),e,l)}const f=tt(t,s,t=>u(t)||t===r),p=1===f.length?f[0]:void 0;return!p||"paragraph"!==p.type||p.attrs||p.htmlId?0===f.length?a(c("list_item"),[o("")],d(t,i),e,l):a(c("list_item"),f,d(t,i),e,l):a(c("list_item"),n(p),d(t,i),e,l)}function z(t,e,n){K(Q(t)??e,b(t.getAttribute("span")),n)}function K(t,e,n){const o=L-n.length,r=Math.min(e,Math.max(0,o));for(let s=0;s<r;s++)n.push(t??null)}function Q(t){return g(t,T,["width"],"width")}function Y(t,e){const n=g(t,A,["min-height","height"],"height");void 0!==n&&(e.minHeightPx=n)}var J=/--ntbl-bc:\s*(#[0-9a-fA-F]{3,8}|transparent)/;function Z(t,e){const n=t.getAttribute("colspan");if(n){const t=b(n);t>1&&(e.colspan=t)}const o=t.getAttribute("rowspan");if(o){const t=b(o);t>1&&(e.rowspan=t)}}function $(t,e){const n=tt(t,e);return 0===n.length&&n.push(a(c("paragraph"),[o("")])),n}function tt(t,e,n){const o=[];let r=[];const s=()=>{(function(t){for(const e of t){if(e.nodeType===Node.ELEMENT_NODE)return!0;if(e.nodeType===Node.TEXT_NODE&&e.textContent?.trim())return!0}return!1})(r)&&o.push(a(c("paragraph"),rt(r,e))),r=[]};for(const a of Array.from(t.childNodes))n?.(a)||(et(a,e)?(s(),U(a,o,e)):r.push(a));return s(),o}function et(t,e){if(t.nodeType!==Node.ELEMENT_NODE)return!1;const n=t;return C(n,e.blockRules,e.inlineRules)||e.hasBlockDescendants(n)}function nt(t,e,n){const o=n?.getNodeSpec(t.type),r={...t.attrs};let s=!1;for(const[a,i]of Object.entries(e))void 0===r[a]&&(n&&!o?.attrs?.[a]||(r[a]=i,s=!0));return s?a(t.type,t.children,t.id,r,t.htmlId):t}function ot(t,e,n){return rt([t],e,n)}function rt(t,e,n){const r=[];for(const o of t)st(o,e.ancestorMarks(o),r,e.markRules,e.inlineRules,n);return 1===r.length&&i(r[0])&&"hard_break"===r[0].inlineType?[o("")]:r.length>0?r:[o("")]}function st(t,e,n,s,a,i){if(t.nodeType===Node.TEXT_NODE){const r=t.textContent??"";return void(r&&n.push(o(r,[...e])))}if(t.nodeType!==Node.ELEMENT_NODE)return;const c=t,l=c.tagName.toLowerCase();if(i&&("ul"===l||"ol"===l))return;if(i&&"input"===l&&"checkbox"===c.getAttribute("type"))return;const f=D(c,a);if(f)return void n.push(r(u(f.type),f.attrs,e));const d=v(c,e,s);for(const o of Array.from(c.childNodes))st(o,d,n,s,a,i)}function at(t,e){const n=t.getAttribute("dir");if(n&&m.has(n))return void(e.dir=n);const o=t.style?.direction??"";o&&m.has(o)&&(e.dir=o)}function it(e){return t(e.getAttribute("id"))}function ct(t,e){const n=h(t);n&&(e.align=n)}export{_ as a,v as c,R as i,X as n,C as o,H as r,D as s,F as t};
2
- //# sourceMappingURL=DocumentParser-C99N0MWF.mjs.map