@aquera/nile-elements 1.9.8 → 1.9.9

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 (232) hide show
  1. package/README.md +3 -0
  2. package/dist/{index-249de90a.esm.js → index-289706c7.esm.js} +1 -1
  3. package/dist/{index-df196058.cjs.js → index-d7e6f1c6.cjs.js} +2 -2
  4. package/dist/index-d7e6f1c6.cjs.js.map +1 -0
  5. package/dist/index.cjs.js +1 -1
  6. package/dist/index.esm.js +1 -1
  7. package/dist/index.js +1577 -1275
  8. package/dist/katex-44476ab4.esm.js +1 -0
  9. package/dist/katex-f4186f87.cjs.js +2 -0
  10. package/dist/katex-f4186f87.cjs.js.map +1 -0
  11. package/dist/nile-color-picker/index.cjs.js +1 -1
  12. package/dist/nile-color-picker/index.esm.js +1 -1
  13. package/dist/nile-color-picker/nile-color-picker.cjs.js +1 -1
  14. package/dist/nile-color-picker/nile-color-picker.cjs.js.map +1 -1
  15. package/dist/nile-color-picker/nile-color-picker.esm.js +1 -1
  16. package/dist/nile-wysiwyg-editor/engine/commands.cjs.js +1 -1
  17. package/dist/nile-wysiwyg-editor/engine/commands.cjs.js.map +1 -1
  18. package/dist/nile-wysiwyg-editor/engine/commands.esm.js +1 -1
  19. package/dist/nile-wysiwyg-editor/engine/create-state.cjs.js +1 -1
  20. package/dist/nile-wysiwyg-editor/engine/create-state.cjs.js.map +1 -1
  21. package/dist/nile-wysiwyg-editor/engine/create-state.esm.js +1 -1
  22. package/dist/nile-wysiwyg-editor/engine/index.cjs.js +1 -1
  23. package/dist/nile-wysiwyg-editor/engine/index.esm.js +1 -1
  24. package/dist/nile-wysiwyg-editor/engine/inputrules.cjs.js +1 -1
  25. package/dist/nile-wysiwyg-editor/engine/keymap.cjs.js +1 -1
  26. package/dist/nile-wysiwyg-editor/engine/keymap.esm.js +1 -1
  27. package/dist/nile-wysiwyg-editor/engine/plugins/code-highlight.cjs.js +1 -1
  28. package/dist/nile-wysiwyg-editor/engine/plugins/code-highlight.cjs.js.map +1 -1
  29. package/dist/nile-wysiwyg-editor/engine/plugins/code-highlight.esm.js +1 -1
  30. package/dist/nile-wysiwyg-editor/engine/plugins/embed-view.cjs.js +1 -1
  31. package/dist/nile-wysiwyg-editor/engine/plugins/embed-view.cjs.js.map +1 -1
  32. package/dist/nile-wysiwyg-editor/engine/plugins/embed-view.esm.js +1 -1
  33. package/dist/nile-wysiwyg-editor/engine/plugins/embeds.cjs.js +1 -1
  34. package/dist/nile-wysiwyg-editor/engine/plugins/embeds.cjs.js.map +1 -1
  35. package/dist/nile-wysiwyg-editor/engine/plugins/embeds.esm.js +1 -1
  36. package/dist/nile-wysiwyg-editor/engine/plugins/math-view.cjs.js +1 -1
  37. package/dist/nile-wysiwyg-editor/engine/plugins/math-view.cjs.js.map +1 -1
  38. package/dist/nile-wysiwyg-editor/engine/plugins/math-view.esm.js +1 -1
  39. package/dist/nile-wysiwyg-editor/engine/plugins/style-block-view.cjs.js +2 -0
  40. package/dist/nile-wysiwyg-editor/engine/plugins/style-block-view.cjs.js.map +1 -0
  41. package/dist/nile-wysiwyg-editor/engine/plugins/style-block-view.esm.js +1 -0
  42. package/dist/nile-wysiwyg-editor/engine/plugins/tables.cjs.js +1 -1
  43. package/dist/nile-wysiwyg-editor/engine/plugins/tables.cjs.js.map +1 -1
  44. package/dist/nile-wysiwyg-editor/engine/plugins/tables.esm.js +1 -1
  45. package/dist/nile-wysiwyg-editor/engine/sanitize.cjs.js +1 -1
  46. package/dist/nile-wysiwyg-editor/engine/sanitize.cjs.js.map +1 -1
  47. package/dist/nile-wysiwyg-editor/engine/sanitize.esm.js +1 -1
  48. package/dist/nile-wysiwyg-editor/engine/schema.cjs.js +1 -1
  49. package/dist/nile-wysiwyg-editor/engine/schema.cjs.js.map +1 -1
  50. package/dist/nile-wysiwyg-editor/engine/schema.esm.js +1 -1
  51. package/dist/nile-wysiwyg-editor/engine/selection-state.cjs.js +1 -1
  52. package/dist/nile-wysiwyg-editor/engine/selection-state.cjs.js.map +1 -1
  53. package/dist/nile-wysiwyg-editor/engine/selection-state.esm.js +1 -1
  54. package/dist/nile-wysiwyg-editor/index.cjs.js +1 -1
  55. package/dist/nile-wysiwyg-editor/index.esm.js +1 -1
  56. package/dist/nile-wysiwyg-editor/math/katex-renderer.cjs.js +2 -0
  57. package/dist/nile-wysiwyg-editor/math/katex-renderer.cjs.js.map +1 -0
  58. package/dist/nile-wysiwyg-editor/math/katex-renderer.esm.js +1 -0
  59. package/dist/nile-wysiwyg-editor/nile-wysiwyg-editor.cjs.js +1 -1
  60. package/dist/nile-wysiwyg-editor/nile-wysiwyg-editor.cjs.js.map +1 -1
  61. package/dist/nile-wysiwyg-editor/nile-wysiwyg-editor.css.cjs.js +1 -1
  62. package/dist/nile-wysiwyg-editor/nile-wysiwyg-editor.css.cjs.js.map +1 -1
  63. package/dist/nile-wysiwyg-editor/nile-wysiwyg-editor.css.esm.js +22 -3
  64. package/dist/nile-wysiwyg-editor/nile-wysiwyg-editor.esm.js +7 -6
  65. package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/index.cjs.js +1 -1
  66. package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/index.esm.js +1 -1
  67. package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar-item.cjs.js +2 -0
  68. package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar-item.cjs.js.map +1 -0
  69. package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar-item.esm.js +1 -0
  70. package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.cjs.js +1 -1
  71. package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.cjs.js.map +1 -1
  72. package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.css.cjs.js +1 -1
  73. package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.css.cjs.js.map +1 -1
  74. package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.css.esm.js +33 -54
  75. package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.esm.js +83 -95
  76. package/dist/nile-wysiwyg-editor/types.cjs.js +1 -1
  77. package/dist/nile-wysiwyg-editor/types.cjs.js.map +1 -1
  78. package/dist/nile-wysiwyg-editor/types.esm.js +1 -1
  79. package/dist/nile-wysiwyg-editor/ui/bubble-item.cjs.js +2 -0
  80. package/dist/nile-wysiwyg-editor/ui/bubble-item.cjs.js.map +1 -0
  81. package/dist/nile-wysiwyg-editor/ui/bubble-item.esm.js +1 -0
  82. package/dist/nile-wysiwyg-editor/ui/bubble-menu.cjs.js +1 -1
  83. package/dist/nile-wysiwyg-editor/ui/bubble-menu.cjs.js.map +1 -1
  84. package/dist/nile-wysiwyg-editor/ui/bubble-menu.esm.js +23 -15
  85. package/dist/nile-wysiwyg-editor/ui/code-block-menu.cjs.js +1 -1
  86. package/dist/nile-wysiwyg-editor/ui/code-block-menu.cjs.js.map +1 -1
  87. package/dist/nile-wysiwyg-editor/ui/code-block-menu.esm.js +3 -3
  88. package/dist/nile-wysiwyg-editor/ui/embed-panel.cjs.js +1 -1
  89. package/dist/nile-wysiwyg-editor/ui/embed-panel.cjs.js.map +1 -1
  90. package/dist/nile-wysiwyg-editor/ui/embed-panel.esm.js +2 -2
  91. package/dist/nile-wysiwyg-editor/ui/math-panel.cjs.js +1 -1
  92. package/dist/nile-wysiwyg-editor/ui/math-panel.cjs.js.map +1 -1
  93. package/dist/nile-wysiwyg-editor/ui/math-panel.esm.js +0 -3
  94. package/dist/nile-wysiwyg-editor/ui/preview.cjs.js +2 -0
  95. package/dist/nile-wysiwyg-editor/ui/preview.cjs.js.map +1 -0
  96. package/dist/nile-wysiwyg-editor/ui/preview.esm.js +8 -0
  97. package/dist/nile-wysiwyg-editor/ui/source-view.cjs.js +1 -1
  98. package/dist/nile-wysiwyg-editor/ui/source-view.cjs.js.map +1 -1
  99. package/dist/nile-wysiwyg-editor/ui/source-view.esm.js +225 -24
  100. package/dist/nile-wysiwyg-editor/ui/suggest-list.cjs.js +1 -1
  101. package/dist/nile-wysiwyg-editor/ui/suggest-list.cjs.js.map +1 -1
  102. package/dist/nile-wysiwyg-editor/ui/suggest-list.esm.js +9 -9
  103. package/dist/nile-wysiwyg-editor/ui/table-grid-picker.cjs.js +1 -1
  104. package/dist/nile-wysiwyg-editor/ui/table-grid-picker.cjs.js.map +1 -1
  105. package/dist/nile-wysiwyg-editor/ui/table-grid-picker.esm.js +115 -13
  106. package/dist/nile-wysiwyg-editor/ui/table-menu.cjs.js +1 -1
  107. package/dist/nile-wysiwyg-editor/ui/table-menu.cjs.js.map +1 -1
  108. package/dist/nile-wysiwyg-editor/ui/table-menu.esm.js +13 -12
  109. package/dist/src/index.d.ts +5 -0
  110. package/dist/src/index.js +3 -0
  111. package/dist/src/index.js.map +1 -1
  112. package/dist/src/nile-color-picker/nile-color-picker.d.ts +1 -0
  113. package/dist/src/nile-color-picker/nile-color-picker.js +1 -0
  114. package/dist/src/nile-color-picker/nile-color-picker.js.map +1 -1
  115. package/dist/src/nile-wysiwyg-editor/engine/index.d.ts +1 -0
  116. package/dist/src/nile-wysiwyg-editor/engine/index.js +1 -0
  117. package/dist/src/nile-wysiwyg-editor/engine/index.js.map +1 -1
  118. package/dist/src/nile-wysiwyg-editor/engine/plugins/embed-view.js +3 -0
  119. package/dist/src/nile-wysiwyg-editor/engine/plugins/embed-view.js.map +1 -1
  120. package/dist/src/nile-wysiwyg-editor/engine/plugins/embeds.d.ts +19 -4
  121. package/dist/src/nile-wysiwyg-editor/engine/plugins/embeds.js +23 -18
  122. package/dist/src/nile-wysiwyg-editor/engine/plugins/embeds.js.map +1 -1
  123. package/dist/src/nile-wysiwyg-editor/engine/plugins/math-view.d.ts +8 -3
  124. package/dist/src/nile-wysiwyg-editor/engine/plugins/math-view.js +41 -4
  125. package/dist/src/nile-wysiwyg-editor/engine/plugins/math-view.js.map +1 -1
  126. package/dist/src/nile-wysiwyg-editor/engine/plugins/style-block-view.d.ts +17 -0
  127. package/dist/src/nile-wysiwyg-editor/engine/plugins/style-block-view.js +174 -0
  128. package/dist/src/nile-wysiwyg-editor/engine/plugins/style-block-view.js.map +1 -0
  129. package/dist/src/nile-wysiwyg-editor/engine/plugins/tables.js +33 -2
  130. package/dist/src/nile-wysiwyg-editor/engine/plugins/tables.js.map +1 -1
  131. package/dist/src/nile-wysiwyg-editor/engine/pm.test.js +49 -8
  132. package/dist/src/nile-wysiwyg-editor/engine/pm.test.js.map +1 -1
  133. package/dist/src/nile-wysiwyg-editor/engine/sanitize.d.ts +12 -0
  134. package/dist/src/nile-wysiwyg-editor/engine/sanitize.js +76 -8
  135. package/dist/src/nile-wysiwyg-editor/engine/sanitize.js.map +1 -1
  136. package/dist/src/nile-wysiwyg-editor/engine/schema.d.ts +2 -0
  137. package/dist/src/nile-wysiwyg-editor/engine/schema.js +154 -2
  138. package/dist/src/nile-wysiwyg-editor/engine/schema.js.map +1 -1
  139. package/dist/src/nile-wysiwyg-editor/index.d.ts +5 -0
  140. package/dist/src/nile-wysiwyg-editor/index.js +3 -0
  141. package/dist/src/nile-wysiwyg-editor/index.js.map +1 -1
  142. package/dist/src/nile-wysiwyg-editor/math/katex-renderer.d.ts +38 -0
  143. package/dist/src/nile-wysiwyg-editor/math/katex-renderer.js +40 -0
  144. package/dist/src/nile-wysiwyg-editor/math/katex-renderer.js.map +1 -0
  145. package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor.css.js +22 -3
  146. package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor.css.js.map +1 -1
  147. package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor.d.ts +36 -0
  148. package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor.js +125 -8
  149. package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor.js.map +1 -1
  150. package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor.test.js +5 -2
  151. package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor.test.js.map +1 -1
  152. package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/index.d.ts +2 -0
  153. package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/index.js +1 -0
  154. package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/index.js.map +1 -1
  155. package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar-item.d.ts +55 -0
  156. package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar-item.js +79 -0
  157. package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar-item.js.map +1 -0
  158. package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.css.js +33 -54
  159. package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.css.js.map +1 -1
  160. package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.d.ts +50 -2
  161. package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.js +158 -102
  162. package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.js.map +1 -1
  163. package/dist/src/nile-wysiwyg-editor/types.d.ts +4 -2
  164. package/dist/src/nile-wysiwyg-editor/types.js +2 -2
  165. package/dist/src/nile-wysiwyg-editor/types.js.map +1 -1
  166. package/dist/src/nile-wysiwyg-editor/ui/bubble-item.d.ts +48 -0
  167. package/dist/src/nile-wysiwyg-editor/ui/bubble-item.js +69 -0
  168. package/dist/src/nile-wysiwyg-editor/ui/bubble-item.js.map +1 -0
  169. package/dist/src/nile-wysiwyg-editor/ui/bubble-menu.d.ts +17 -2
  170. package/dist/src/nile-wysiwyg-editor/ui/bubble-menu.js +128 -35
  171. package/dist/src/nile-wysiwyg-editor/ui/bubble-menu.js.map +1 -1
  172. package/dist/src/nile-wysiwyg-editor/ui/embed-panel.d.ts +2 -1
  173. package/dist/src/nile-wysiwyg-editor/ui/embed-panel.js +4 -3
  174. package/dist/src/nile-wysiwyg-editor/ui/embed-panel.js.map +1 -1
  175. package/dist/src/nile-wysiwyg-editor/ui/math-panel.js +0 -3
  176. package/dist/src/nile-wysiwyg-editor/ui/math-panel.js.map +1 -1
  177. package/dist/src/nile-wysiwyg-editor/ui/preview.d.ts +20 -0
  178. package/dist/src/nile-wysiwyg-editor/ui/preview.js +44 -0
  179. package/dist/src/nile-wysiwyg-editor/ui/preview.js.map +1 -0
  180. package/dist/src/nile-wysiwyg-editor/ui/source-view.d.ts +35 -3
  181. package/dist/src/nile-wysiwyg-editor/ui/source-view.js +337 -24
  182. package/dist/src/nile-wysiwyg-editor/ui/source-view.js.map +1 -1
  183. package/dist/src/nile-wysiwyg-editor/ui/suggest-list.d.ts +1 -0
  184. package/dist/src/nile-wysiwyg-editor/ui/suggest-list.js +9 -0
  185. package/dist/src/nile-wysiwyg-editor/ui/suggest-list.js.map +1 -1
  186. package/dist/src/nile-wysiwyg-editor/ui/table-grid-picker.d.ts +13 -2
  187. package/dist/src/nile-wysiwyg-editor/ui/table-grid-picker.js +166 -10
  188. package/dist/src/nile-wysiwyg-editor/ui/table-grid-picker.js.map +1 -1
  189. package/dist/src/nile-wysiwyg-editor/ui/table-menu.d.ts +1 -0
  190. package/dist/src/nile-wysiwyg-editor/ui/table-menu.js +10 -8
  191. package/dist/src/nile-wysiwyg-editor/ui/table-menu.js.map +1 -1
  192. package/dist/src/version.js +1 -1
  193. package/dist/src/version.js.map +1 -1
  194. package/dist/tsconfig.tsbuildinfo +1 -1
  195. package/dist/xml-25c4108a.esm.js +1 -0
  196. package/dist/xml-90fd974e.cjs.js +2 -0
  197. package/dist/xml-90fd974e.cjs.js.map +1 -0
  198. package/package.json +2 -1
  199. package/rollup.config.js +1 -0
  200. package/src/index.ts +8 -0
  201. package/src/nile-color-picker/nile-color-picker.ts +1 -0
  202. package/src/nile-wysiwyg-editor/engine/index.ts +1 -0
  203. package/src/nile-wysiwyg-editor/engine/plugins/embed-view.ts +3 -0
  204. package/src/nile-wysiwyg-editor/engine/plugins/embeds.ts +26 -20
  205. package/src/nile-wysiwyg-editor/engine/plugins/math-view.ts +45 -4
  206. package/src/nile-wysiwyg-editor/engine/plugins/style-block-view.ts +178 -0
  207. package/src/nile-wysiwyg-editor/engine/plugins/tables.ts +34 -2
  208. package/src/nile-wysiwyg-editor/engine/pm.test.ts +58 -8
  209. package/src/nile-wysiwyg-editor/engine/sanitize.ts +71 -8
  210. package/src/nile-wysiwyg-editor/engine/schema.ts +158 -7
  211. package/src/nile-wysiwyg-editor/index.ts +5 -0
  212. package/src/nile-wysiwyg-editor/math/katex-renderer.ts +59 -0
  213. package/src/nile-wysiwyg-editor/math/katex.d.ts +17 -0
  214. package/src/nile-wysiwyg-editor/nile-wysiwyg-editor.css.ts +22 -3
  215. package/src/nile-wysiwyg-editor/nile-wysiwyg-editor.test.ts +5 -2
  216. package/src/nile-wysiwyg-editor/nile-wysiwyg-editor.ts +142 -7
  217. package/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/index.ts +2 -0
  218. package/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar-item.ts +68 -0
  219. package/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.css.ts +33 -54
  220. package/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.ts +202 -108
  221. package/src/nile-wysiwyg-editor/types.ts +6 -4
  222. package/src/nile-wysiwyg-editor/ui/bubble-item.ts +60 -0
  223. package/src/nile-wysiwyg-editor/ui/bubble-menu.ts +147 -40
  224. package/src/nile-wysiwyg-editor/ui/embed-panel.ts +4 -3
  225. package/src/nile-wysiwyg-editor/ui/math-panel.ts +0 -3
  226. package/src/nile-wysiwyg-editor/ui/preview.ts +42 -0
  227. package/src/nile-wysiwyg-editor/ui/source-view.ts +339 -31
  228. package/src/nile-wysiwyg-editor/ui/suggest-list.ts +10 -0
  229. package/src/nile-wysiwyg-editor/ui/table-grid-picker.ts +160 -10
  230. package/src/nile-wysiwyg-editor/ui/table-menu.ts +10 -8
  231. package/vscode-html-custom-data.json +75 -6
  232. package/dist/index-df196058.cjs.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"nile-color-picker.js","sourceRoot":"","sources":["../../../src/nile-color-picker/nile-color-picker.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,gCAAgC,CAAC;AACxC,OAAO,wBAAwB,CAAC;AAChC,OAAO,kCAAkC,CAAC;AAO1C,MAAM,CAAC,MAAM,eAAe,GAAmB;IAC7C,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE;IACnC,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,WAAW,EAAE;IACvC,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE;IAClC,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,aAAa,EAAE;IACzC,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,QAAQ,EAAE;IACpC,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,YAAY,EAAE;IACxC,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,WAAW,EAAE;IACvC,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,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AC,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC;wBACxD,IAAI,CAAC,IAAI,OAAO,CAAC,CAAC,KAAK,KAAK,QAAQ;4BAAE,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,KAAK,EAAE,CAAC;wBACzF,OAAO,IAAI,CAAC;oBACd,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAmB,CAAC;gBACvC,CAAC;gBAAC,MAAM,CAAC;oBAAC,OAAO,EAAE,CAAC;gBAAC,CAAC;YACxB,CAAC;YACD,WAAW,EAAE,CAAC,CAAiB,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC;SACtD;KACF,CAAC;gDAC2B;AAGZ;IAAhB,KAAK,EAAE;8CAA6C;AACpC;IAAhB,KAAK,EAAE;sDAA4C;AAGnC;IAAhB,KAAK,EAAE;6CAAoB;AACX;IAAhB,KAAK,EAAE;6CAAoB;AACX;IAAhB,KAAK,EAAE;6CAAqB;AACZ;IAAhB,KAAK,EAAE;mDAA2C;AAClC;IAAhB,KAAK,EAAE;kDAA+B;AACtB;IAAhB,KAAK,EAAE;2CAAiB;AACR;IAAhB,KAAK,EAAE;2CAAkB;AACT;IAAhB,KAAK,EAAE;2CAAkB;AApEf,eAAe;IAD3B,aAAa,CAAC,mBAAmB,CAAC;GACtB,eAAe,CAkc3B","sourcesContent":["import { LitElement, html, nothing } from 'lit';\nimport { customElement, property, state } from 'lit/decorators.js';\nimport { getCssText } from './nile-color-picker.css';\nimport '../nile-dropdown/nile-dropdown';\nimport '../nile-menu/nile-menu';\nimport '../nile-menu-item/nile-menu-item';\n\nexport type ColorPickerType = 'swatches' | 'picker';\nexport type ColorPickerMode = 'inline' | 'popover';\nexport type SwatchTooltip = 'name' | 'value' | 'both';\nexport type PaletteEntry = { color: string; name: string };\n\nexport const DEFAULT_PALETTE: PaletteEntry[] = [\n { color: '#131316', name: 'Black' },\n { color: '#26272B', name: 'Dark Gray' },\n { color: '#525252', name: 'Gray' },\n { color: '#737373', name: 'Medium Gray' },\n { color: '#A3A3A3', name: 'Silver' },\n { color: '#D6D6D6', name: 'Light Gray' },\n { color: '#F5F5F5', name: 'Off White' },\n { color: '#FFFFFF', name: 'White' },\n { color: '#CA8504', name: 'Yellow 3' },\n { color: '#C01048', name: 'Red 3' },\n { color: '#DD2590', name: 'Pink 3' },\n { color: '#155EEF', name: 'Blue Dark 3' },\n { color: '#444CE7', name: 'Indigo 3' },\n { color: '#7A5AF8', name: 'Purple 3' },\n { color: '#3E4784', name: 'Gray Blue 3' },\n { color: '#087443', name: 'Green 3' },\n { color: '#FDE272', name: 'Yellow 2' },\n { color: '#FEA3B4', name: 'Red 2' },\n { color: '#FAA7E0', name: 'Pink 2' },\n { color: '#528BFF', name: 'Blue Dark 2' },\n { color: '#A4BCFD', name: 'Indigo 2' },\n { color: '#BDB4FE', name: 'Purple 2' },\n { color: '#B3B8DB', name: 'Gray Blue 2' },\n { color: '#73E2A3', name: 'Green 2' },\n { color: '#FEFBE8', name: 'Yellow 1' },\n { color: '#FFF1F3', name: 'Red 1' },\n { color: '#FDF2FA', name: 'Pink 1' },\n { color: '#EFF4FF', name: 'Blue Dark 1' },\n { color: '#EEF4FF', name: 'Indigo 1' },\n { color: '#F4F3FF', name: 'Purple 1' },\n { color: '#F8F9FC', name: 'Gray Blue 1' },\n { color: '#EDFCF2', name: 'Green 1' },\n];\n\n/* ── color math helpers ──────────────────────────────────────────────── */\nexport function hexToRgb(hex: string): [number, number, number] {\n const h = hex.replace('#', '');\n return [parseInt(h.slice(0, 2), 16), parseInt(h.slice(2, 4), 16), parseInt(h.slice(4, 6), 16)];\n}\n\nexport function rgbToHex(r: number, g: number, b: number): string {\n return '#' + [r, g, b].map(v => v.toString(16).padStart(2, '0')).join('').toUpperCase();\n}\n\nexport function rgbToHsv(r: number, g: number, b: number): [number, number, number] {\n r /= 255; g /= 255; b /= 255;\n const max = Math.max(r, g, b), min = Math.min(r, g, b), d = max - min;\n let h = 0;\n if (d !== 0) {\n if (max === r) h = ((g - b) / d + 6) % 6;\n else if (max === g) h = (b - r) / d + 2;\n else h = (r - g) / d + 4;\n h *= 60;\n }\n return [h, max === 0 ? 0 : d / max, max];\n}\n\nexport function hsvToRgb(h: number, s: number, v: number): [number, number, number] {\n const c = v * s, x = c * (1 - Math.abs(((h / 60) % 2) - 1)), m = v - c;\n let r = 0, g = 0, b = 0;\n if (h < 60) { r = c; g = x; }\n else if (h < 120) { r = x; g = c; }\n else if (h < 180) { g = c; b = x; }\n else if (h < 240) { g = x; b = c; }\n else if (h < 300) { r = x; b = c; }\n else { r = c; b = x; }\n return [Math.round((r + m) * 255), Math.round((g + m) * 255), Math.round((b + m) * 255)];\n}\n\n@customElement('nile-color-picker')\nexport class NileColorPicker extends LitElement {\n protected createRenderRoot() { return this; }\n\n \n @property({ type: String, attribute: true, reflect: true }) type: ColorPickerType = 'swatches';\n\n /** Currently selected hex color value. */\n @property({ type: String, attribute: true, reflect: true }) value = '#000000';\n\n /** What to show in swatch tooltips. */\n @property({ type: String, reflect: true }) swatchTooltip: SwatchTooltip = 'name';\n\n /** How many recent/custom colors to display. */\n @property({ type: Number, reflect: true }) recentColorsCount = 3;\n\n /** Show a \"No Fill\" button (useful for background-color use cases). */\n @property({ type: Boolean, reflect: true }) noFill = false;\n\n \n @property({ type: String, reflect: true })mode: ColorPickerMode = 'inline';\n\n /** Show the SV gradient canvas (the large colour area). Applies when type=\"picker\". */\n @property({ type: Boolean, reflect: true }) showCanvas = true;\n\n /** Show the hue slider row (rainbow bar + eyedropper). Applies when type=\"picker\". */\n @property({ type: Boolean, reflect: true }) showHue = true;\n\n /** Show the HEX / RGB input row. Applies when type=\"picker\". */\n @property({ type: Boolean, reflect: true }) showInputs = true;\n\n /** Show the Cancel / Okay action buttons. Applies when type=\"picker\". */\n @property({ type: Boolean, reflect: true }) showActions = true;\n\n @property({ type: Boolean, reflect: true, attribute: true}) open = false;\n\n /** Custom palette. Accepts a JSON array of `{ color, name }` objects or plain\n * hex strings. Falls back to the built-in palette when empty. */\n @property({\n attribute: 'palette',\n converter: {\n fromAttribute: (value: string): PaletteEntry[] => {\n try {\n const parsed = JSON.parse(value);\n if (!Array.isArray(parsed)) return [];\n return parsed.map((e: any) => {\n if (typeof e === 'string') return { color: e, name: e };\n if (e && typeof e.color === 'string') return { color: e.color, name: e.name || e.color };\n return null;\n }).filter(Boolean) as PaletteEntry[];\n } catch { return []; }\n },\n toAttribute: (v: PaletteEntry[]) => JSON.stringify(v),\n },\n })\n palette: PaletteEntry[] = [];\n\n /* ── internal state ──────────────────────────────────────────────── */\n @state() private _view: ColorPickerType = 'swatches';\n @state() private _recentColors: PaletteEntry[] = [];\n\n // picker canvas state\n @state() private _hue = 220;\n @state() private _sat = 0.7;\n @state() private _val = 0.93;\n @state() private _colorMode: 'HEX' | 'RGB' = 'HEX';\n @state() private _hexInput = '#366AEE';\n @state() private _r = 54;\n @state() private _g = 106;\n @state() private _b = 238;\n\n private _svCanvas: HTMLCanvasElement | null = null;\n private _hueCanvas: HTMLCanvasElement | null = null;\n private _draggingSV = false;\n private _draggingHue = false;\n private _pendingColor = '#366AEE';\n\n /* ── lifecycle ───────────────────────────────────────────────────── */\n connectedCallback() {\n super.connectedCallback();\n this._view = this.type;\n if (this.type === 'picker') {\n const [r, g, b] = hexToRgb(this._norm(this.value));\n [this._hue, this._sat, this._val] = rgbToHsv(r, g, b);\n this._syncInputs();\n }\n this._injectCss();\n document.addEventListener('mousemove', this._onGlobalMouseMove);\n document.addEventListener('mouseup', this._onGlobalMouseUp);\n }\n\n disconnectedCallback() {\n document.removeEventListener('mousemove', this._onGlobalMouseMove);\n document.removeEventListener('mouseup', this._onGlobalMouseUp);\n super.disconnectedCallback();\n }\n\n protected updated(changed: Map<string, unknown>) {\n if (changed.has('type')) {\n this._view = this.type;\n if (this.type === 'picker') {\n const [r, g, b] = hexToRgb(this._norm(this.value));\n [this._hue, this._sat, this._val] = rgbToHsv(r, g, b);\n this._syncInputs();\n }\n }\n if (changed.has('value') && this.type === 'picker' && this._view === 'picker' &&\n !this._draggingSV && !this._draggingHue) {\n const [r, g, b] = hexToRgb(this._norm(this.value));\n [this._hue, this._sat, this._val] = rgbToHsv(r, g, b);\n this._syncInputs();\n }\n \n if (this._view === 'picker') {\n requestAnimationFrame(() => {\n this._svCanvas = this.querySelector('.ncp-sv-canvas') as HTMLCanvasElement;\n this._hueCanvas = this.querySelector('.ncp-hue-canvas') as HTMLCanvasElement;\n this._drawSV();\n this._drawHue();\n });\n }\n }\n\n /* ── public API ──────────────────────────────────────────────────── */\n /** Reset the view back to the default type (call this when the host popover closes). */\n reset() {\n this._view = this.type;\n }\n\n \n private _injectCss() {\n if (this.querySelector('style[data-nile-color-picker]')) return;\n const style = document.createElement('style');\n style.setAttribute('data-nile-color-picker', '');\n style.textContent = getCssText();\n this.insertBefore(style, this.firstChild);\n }\n\n \n private _norm(hex: string) {\n const t = hex.trim();\n if (/^#[0-9a-f]{6}$/i.test(t)) return t.toUpperCase();\n if (/^#[0-9a-f]{3}$/i.test(t)) {\n const [a, b, c] = t.slice(1).toUpperCase().split('');\n return `#${a}${a}${b}${b}${c}${c}`;\n }\n return '#000000';\n }\n\n private get _paletteColors(): PaletteEntry[] {\n return this.palette.length > 0 ? this.palette : DEFAULT_PALETTE;\n }\n\n \n private _emit(value: string) {\n this.dispatchEvent(new CustomEvent('nile-change', {\n detail: { value },\n bubbles: true,\n composed: true,\n }));\n }\n\n private _apply(color: string) {\n const hex = this._norm(color);\n this.value = hex;\n const entry: PaletteEntry = { color: hex, name: hex };\n this._recentColors = [entry, ...this._recentColors.filter(e => this._norm(e.color) !== hex)].slice(0, this.recentColorsCount);\n this._emit(hex);\n if (this.mode === 'popover' && this._view === 'swatches') {\n this._closePopover();\n }\n }\n\n private _closePopover() {\n const pop = this.querySelector('nile-popover') as any;\n if (pop) pop.isShow = false;\n }\n\n private _openPicker() {\n const [r, g, b] = hexToRgb(this._norm(this.value));\n const [h, s, v] = rgbToHsv(r, g, b);\n this._hue = h; this._sat = s; this._val = v;\n this._syncInputs();\n this._view = 'picker';\n }\n\n private _syncInputs() {\n const [r, g, b] = hsvToRgb(this._hue, this._sat, this._val);\n const hex = rgbToHex(r, g, b);\n this._hexInput = hex; this._r = r; this._g = g; this._b = b;\n this._pendingColor = hex;\n }\n\n private _drawSV() {\n const canvas = this._svCanvas;\n if (!canvas) return;\n const ctx = canvas.getContext('2d');\n if (!ctx) return;\n const { width: w, height: h } = canvas;\n const [hr, hg, hb] = hsvToRgb(this._hue, 1, 1);\n ctx.fillStyle = `rgb(${hr},${hg},${hb})`;\n ctx.fillRect(0, 0, w, h);\n const wg = ctx.createLinearGradient(0, 0, w, 0);\n wg.addColorStop(0, 'rgba(255,255,255,1)'); wg.addColorStop(1, 'rgba(255,255,255,0)');\n ctx.fillStyle = wg; ctx.fillRect(0, 0, w, h);\n const bg = ctx.createLinearGradient(0, 0, 0, h);\n bg.addColorStop(0, 'rgba(0,0,0,0)'); bg.addColorStop(1, 'rgba(0,0,0,1)');\n ctx.fillStyle = bg; ctx.fillRect(0, 0, w, h);\n }\n\n private _drawHue() {\n const canvas = this._hueCanvas;\n if (!canvas) return;\n const ctx = canvas.getContext('2d');\n if (!ctx) return;\n const grad = ctx.createLinearGradient(0, 0, canvas.width, 0);\n ['#FF0000','#FFFF00','#00FF00','#00FFFF','#0000FF','#FF00FF','#FF0000']\n .forEach((c, i, a) => grad.addColorStop(i / (a.length - 1), c));\n ctx.fillStyle = grad; ctx.fillRect(0, 0, canvas.width, canvas.height);\n }\n\n private _onSVMouseDown = (e: MouseEvent) => { e.preventDefault(); this._draggingSV = true; this._updateSV(e); };\n private _onHueMouseDown = (e: MouseEvent) => { e.preventDefault(); this._draggingHue = true; this._updateHue(e); };\n\n private _onGlobalMouseMove = (e: MouseEvent) => {\n if (this._draggingSV) this._updateSV(e);\n if (this._draggingHue) this._updateHue(e);\n };\n private _onGlobalMouseUp = () => {\n const wasDraggingSV = this._draggingSV;\n const wasDraggingHue = this._draggingHue;\n if (!this.showActions && this._view === 'picker' && (wasDraggingSV || wasDraggingHue)) {\n this._commitPickerIfNoActions();\n }\n this._draggingSV = false;\n this._draggingHue = false;\n };\n\n private _commitPickerIfNoActions() {\n if (this.showActions) return;\n this._apply(this._pendingColor);\n if (this.mode === 'popover') {\n if (this.type === 'swatches') this._view = 'swatches';\n this._closePopover();\n }\n }\n\n private _updateSV(e: MouseEvent) {\n const canvas = this._svCanvas; if (!canvas) return;\n const rect = canvas.getBoundingClientRect();\n this._sat = Math.max(0, Math.min(e.clientX - rect.left, rect.width)) / rect.width;\n this._val = 1 - Math.max(0, Math.min(e.clientY - rect.top, rect.height)) / rect.height;\n this._syncInputs();\n }\n\n private _updateHue(e: MouseEvent) {\n const canvas = this._hueCanvas; if (!canvas) return;\n const rect = canvas.getBoundingClientRect();\n this._hue = (Math.max(0, Math.min(e.clientX - rect.left, rect.width)) / rect.width) * 360;\n this._syncInputs();\n }\n\n private _onHexInput = (e: Event) => {\n let val = ((e as CustomEvent).detail?.value ?? (e.target as HTMLInputElement).value ?? '').trim();\n if (!val.startsWith('#')) val = '#' + val;\n if (/^#[0-9a-f]{6}$/i.test(val)) {\n const [r, g, b] = hexToRgb(val);\n [this._hue, this._sat, this._val] = rgbToHsv(r, g, b);\n this._syncInputs();\n if (this._view === 'picker') this._commitPickerIfNoActions();\n }\n };\n\n private _onRgbInput = (ch: 'r' | 'g' | 'b', e: Event) => {\n const raw = (e as CustomEvent).detail?.value ?? (e.target as HTMLInputElement).value;\n const v = Math.max(0, Math.min(255, parseInt(String(raw), 10) || 0));\n if (ch === 'r') this._r = v; else if (ch === 'g') this._g = v; else this._b = v;\n [this._hue, this._sat, this._val] = rgbToHsv(this._r, this._g, this._b);\n this._syncInputs();\n if (this._view === 'picker') this._commitPickerIfNoActions();\n };\n\n private _onColorModeSelect = (e: CustomEvent<{ value: string }>) => {\n e.stopPropagation();\n const v = e.detail?.value;\n if (v === 'HEX' || v === 'RGB') {\n this._colorMode = v;\n }\n };\n\n private _pickEyedropper = async () => {\n const Ctor = (window as any).EyeDropper;\n if (!Ctor) { this._openPicker(); return; }\n try {\n const result = await new Ctor().open();\n if (result?.sRGBHex) this._apply(result.sRGBHex);\n } catch { /* cancelled */ }\n };\n private _renderSwatch(entry: PaletteEntry) {\n const norm = this._norm(entry.color);\n const isActive = this._norm(this.value) === norm;\n const tip = this.swatchTooltip === 'name'\n ? (entry.name || norm)\n : this.swatchTooltip === 'value'\n ? norm\n : entry.name ? `${entry.name} (${norm})` : norm;\n return html`\n <nile-lite-tooltip content=${tip}>\n <nile-color-swatch\n color=${norm}\n ?active=${isActive}\n @click=${() => this._apply(norm)}\n ></nile-color-swatch>\n </nile-lite-tooltip>\n `;\n }\n\n private _renderSwatchesView() {\n const recent = this._recentColors.slice(0, this.recentColorsCount);\n return html`\n <div class=\"ncp-panel\">\n <div class=\"ncp-palette-grid\">\n ${this._paletteColors.map(e => this._renderSwatch(e))}\n </div>\n\n ${this.noFill ? html`\n <button class=\"ncp-no-fill\" @click=${() => this._emit('none')}>\n <nile-glyph name=\"disabled\"></nile-glyph>\n <span>No Fill</span>\n </button>\n ` : nothing}\n\n <div class=\"ncp-custom-section\">\n <p class=\"ncp-custom-title\">Custom</p>\n <div class=\"ncp-custom-row\">\n ${recent.map(e => this._renderSwatch(e))}\n <nile-lite-tooltip content=\"Add custom color\">\n <button class=\"ncp-action-btn\" @click=${() => this._openPicker()}>\n<nile-glyph name=\"plus\"></nile-glyph>\n </button>\n </nile-lite-tooltip>\n <nile-lite-tooltip content=\"Pick from screen\">\n <button class=\"ncp-action-btn\" @click=${this._pickEyedropper}>\n <nile-glyph name=\"colorize\" size=\"12\"></nile-glyph>\n </button>\n </nile-lite-tooltip>\n </div>\n </div>\n </div>\n `;\n }\n\n private _renderPickerView() {\n const svX = this._sat * 100;\n const svY = (1 - this._val) * 100;\n const hueX = (this._hue / 360) * 100;\n\n return html`\n <div class=\"ncp-panel ncp-panel--picker\">\n\n ${this.showCanvas ? html`\n <div class=\"ncp-sv-area\" @mousedown=${this._onSVMouseDown}>\n <canvas class=\"ncp-sv-canvas\" width=\"244\" height=\"130\"></canvas>\n <div class=\"ncp-sv-thumb\" style=\"left:${svX}%;top:${svY}%\">\n <div class=\"ncp-sv-thumb-inner\"></div>\n </div>\n </div>\n ` : nothing}\n\n ${this.showHue ? html`\n <div class=\"ncp-hue-row\">\n <div class=\"ncp-hue-wrap\" @mousedown=${this._onHueMouseDown}>\n <canvas class=\"ncp-hue-canvas\" width=\"244\" height=\"14\"></canvas>\n <div class=\"ncp-hue-thumb\" style=\"left:${hueX}%\"></div>\n </div>\n <button class=\"ncp-eyedropper\" title=\"Pick from screen\" @click=${this._pickEyedropper}>\n <nile-glyph name=\"colorize\" size=\"16\"></nile-glyph>\n </button>\n </div>\n ` : nothing}\n\n ${this.showInputs ? html`\n <div class=\"ncp-input-row\">\n <nile-dropdown class=\"ncp-mode-dropdown\" placement=\"bottom-start\" distance=\"4\" hoist>\n <nile-button slot=\"trigger\" class=\"ncp-mode-btn\" variant=\"tertiary\">\n ${this._colorMode} <nile-icon name=\"arrowdown\" size=\"12\"></nile-icon>\n </nile-button>\n <nile-menu @nile-select=${this._onColorModeSelect}>\n <nile-menu-item value=\"HEX\" ?active=${this._colorMode === 'HEX'}>HEX</nile-menu-item>\n <nile-menu-item value=\"RGB\" ?active=${this._colorMode === 'RGB'}>RGB</nile-menu-item>\n </nile-menu>\n </nile-dropdown>\n ${this._colorMode === 'HEX'\n ? html`<nile-input class=\"ncp-hex\" .value=${this._hexInput} @nile-input=${this._onHexInput}></nile-input>`\n : html`\n <nile-input class=\"ncp-rgb\" type=\"number\" min=\"0\" max=\"255\" .value=${String(this._r)} @nile-input=${(e: Event) => this._onRgbInput('r', e)}></nile-input>\n <nile-input class=\"ncp-rgb\" type=\"number\" min=\"0\" max=\"255\" .value=${String(this._g)} @nile-input=${(e: Event) => this._onRgbInput('g', e)}></nile-input>\n <nile-input class=\"ncp-rgb\" type=\"number\" min=\"0\" max=\"255\" .value=${String(this._b)} @nile-input=${(e: Event) => this._onRgbInput('b', e)}></nile-input>\n `}\n </div>\n ` : nothing}\n\n ${this.showActions ? html`\n <div class=\"ncp-picker-actions\">\n ${this.type === 'swatches'\n ? html`<nile-button variant=\"secondary\" size=\"small\" @click=${() => { this._view = 'swatches'; }}>Cancel</nile-button>`\n : nothing}\n <nile-button variant=\"primary\" size=\"small\" @click=${() => { this._apply(this._pendingColor); if (this.type === 'swatches') this._view = 'swatches'; this._closePopover(); }}>Okay</nile-button>\n </div>\n ` : nothing}\n\n </div>\n `;\n }\n\n private _renderTrigger() {\n const isNoFill = this.value === 'none';\n const displayColor = isNoFill ? null : this._norm(this.value);\n return html`\n <button\n slot=\"anchor\"\n class=\"ncp-trigger${isNoFill ? ' ncp-trigger--no-fill' : ''}\"\n type=\"button\"\n aria-label=${isNoFill ? 'No Fill' : displayColor}\n style=${isNoFill ? '' : `background:${displayColor}`}\n ></button>\n `;\n }\n\n render() {\n const panel = this._view === 'picker' ? this._renderPickerView() : this._renderSwatchesView();\n\n if (this.mode === 'popover') {\n return html`\n <nile-popover\n .arrow=${false}\n flip\n .open=${this.open}\n placement=\"bottom-start\"\n id=\"color-picker-popover\"\n distance=\"8\"\n @nile-hide=${() => this.reset()}\n >\n ${this._renderTrigger()}\n ${panel}\n </nile-popover>\n `;\n }\n\n return panel;\n }\n}\n\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nile-color-picker': NileColorPicker;\n }\n}\n"]}
1
+ {"version":3,"file":"nile-color-picker.js","sourceRoot":"","sources":["../../../src/nile-color-picker/nile-color-picker.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACnE,OA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AGnC;IAAhB,KAAK,EAAE;6CAAoB;AACX;IAAhB,KAAK,EAAE;6CAAoB;AACX;IAAhB,KAAK,EAAE;6CAAqB;AACZ;IAAhB,KAAK,EAAE;mDAA2C;AAClC;IAAhB,KAAK,EAAE;kDAA+B;AACtB;IAAhB,KAAK,EAAE;2CAAiB;AACR;IAAhB,KAAK,EAAE;2CAAkB;AACT;IAAhB,KAAK,EAAE;2CAAkB;AApEf,eAAe;IAD3B,aAAa,CAAC,mBAAmB,CAAC;GACtB,eAAe,CAkc3B","sourcesContent":["import { LitElement, html, nothing } from 'lit';\nimport { customElement, property, state } from 'lit/decorators.js';\nimport { getCssText } from './nile-color-picker.css';\nimport '../nile-dropdown/nile-dropdown';\nimport '../nile-menu/nile-menu';\nimport '../nile-menu-item/nile-menu-item';\nimport '../nile-color-swatch/nile-color-swatch';\n\nexport type ColorPickerType = 'swatches' | 'picker';\nexport type ColorPickerMode = 'inline' | 'popover';\nexport type SwatchTooltip = 'name' | 'value' | 'both';\nexport type PaletteEntry = { color: string; name: string };\n\nexport const DEFAULT_PALETTE: PaletteEntry[] = [\n { color: '#131316', name: 'Black' },\n { color: '#26272B', name: 'Dark Gray' },\n { color: '#525252', name: 'Gray' },\n { color: '#737373', name: 'Medium Gray' },\n { color: '#A3A3A3', name: 'Silver' },\n { color: '#D6D6D6', name: 'Light Gray' },\n { color: '#F5F5F5', name: 'Off White' },\n { color: '#FFFFFF', name: 'White' },\n { color: '#CA8504', name: 'Yellow 3' },\n { color: '#C01048', name: 'Red 3' },\n { color: '#DD2590', name: 'Pink 3' },\n { color: '#155EEF', name: 'Blue Dark 3' },\n { color: '#444CE7', name: 'Indigo 3' },\n { color: '#7A5AF8', name: 'Purple 3' },\n { color: '#3E4784', name: 'Gray Blue 3' },\n { color: '#087443', name: 'Green 3' },\n { color: '#FDE272', name: 'Yellow 2' },\n { color: '#FEA3B4', name: 'Red 2' },\n { color: '#FAA7E0', name: 'Pink 2' },\n { color: '#528BFF', name: 'Blue Dark 2' },\n { color: '#A4BCFD', name: 'Indigo 2' },\n { color: '#BDB4FE', name: 'Purple 2' },\n { color: '#B3B8DB', name: 'Gray Blue 2' },\n { color: '#73E2A3', name: 'Green 2' },\n { color: '#FEFBE8', name: 'Yellow 1' },\n { color: '#FFF1F3', name: 'Red 1' },\n { color: '#FDF2FA', name: 'Pink 1' },\n { color: '#EFF4FF', name: 'Blue Dark 1' },\n { color: '#EEF4FF', name: 'Indigo 1' },\n { color: '#F4F3FF', name: 'Purple 1' },\n { color: '#F8F9FC', name: 'Gray Blue 1' },\n { color: '#EDFCF2', name: 'Green 1' },\n];\n\n/* ── color math helpers ──────────────────────────────────────────────── */\nexport function hexToRgb(hex: string): [number, number, number] {\n const h = hex.replace('#', '');\n return [parseInt(h.slice(0, 2), 16), parseInt(h.slice(2, 4), 16), parseInt(h.slice(4, 6), 16)];\n}\n\nexport function rgbToHex(r: number, g: number, b: number): string {\n return '#' + [r, g, b].map(v => v.toString(16).padStart(2, '0')).join('').toUpperCase();\n}\n\nexport function rgbToHsv(r: number, g: number, b: number): [number, number, number] {\n r /= 255; g /= 255; b /= 255;\n const max = Math.max(r, g, b), min = Math.min(r, g, b), d = max - min;\n let h = 0;\n if (d !== 0) {\n if (max === r) h = ((g - b) / d + 6) % 6;\n else if (max === g) h = (b - r) / d + 2;\n else h = (r - g) / d + 4;\n h *= 60;\n }\n return [h, max === 0 ? 0 : d / max, max];\n}\n\nexport function hsvToRgb(h: number, s: number, v: number): [number, number, number] {\n const c = v * s, x = c * (1 - Math.abs(((h / 60) % 2) - 1)), m = v - c;\n let r = 0, g = 0, b = 0;\n if (h < 60) { r = c; g = x; }\n else if (h < 120) { r = x; g = c; }\n else if (h < 180) { g = c; b = x; }\n else if (h < 240) { g = x; b = c; }\n else if (h < 300) { r = x; b = c; }\n else { r = c; b = x; }\n return [Math.round((r + m) * 255), Math.round((g + m) * 255), Math.round((b + m) * 255)];\n}\n\n@customElement('nile-color-picker')\nexport class NileColorPicker extends LitElement {\n protected createRenderRoot() { return this; }\n\n \n @property({ type: String, attribute: true, reflect: true }) type: ColorPickerType = 'swatches';\n\n /** Currently selected hex color value. */\n @property({ type: String, attribute: true, reflect: true }) value = '#000000';\n\n /** What to show in swatch tooltips. */\n @property({ type: String, reflect: true }) swatchTooltip: SwatchTooltip = 'name';\n\n /** How many recent/custom colors to display. */\n @property({ type: Number, reflect: true }) recentColorsCount = 3;\n\n /** Show a \"No Fill\" button (useful for background-color use cases). */\n @property({ type: Boolean, reflect: true }) noFill = false;\n\n \n @property({ type: String, reflect: true })mode: ColorPickerMode = 'inline';\n\n /** Show the SV gradient canvas (the large colour area). Applies when type=\"picker\". */\n @property({ type: Boolean, reflect: true }) showCanvas = true;\n\n /** Show the hue slider row (rainbow bar + eyedropper). Applies when type=\"picker\". */\n @property({ type: Boolean, reflect: true }) showHue = true;\n\n /** Show the HEX / RGB input row. Applies when type=\"picker\". */\n @property({ type: Boolean, reflect: true }) showInputs = true;\n\n /** Show the Cancel / Okay action buttons. Applies when type=\"picker\". */\n @property({ type: Boolean, reflect: true }) showActions = true;\n\n @property({ type: Boolean, reflect: true, attribute: true}) open = false;\n\n /** Custom palette. Accepts a JSON array of `{ color, name }` objects or plain\n * hex strings. Falls back to the built-in palette when empty. */\n @property({\n attribute: 'palette',\n converter: {\n fromAttribute: (value: string): PaletteEntry[] => {\n try {\n const parsed = JSON.parse(value);\n if (!Array.isArray(parsed)) return [];\n return parsed.map((e: any) => {\n if (typeof e === 'string') return { color: e, name: e };\n if (e && typeof e.color === 'string') return { color: e.color, name: e.name || e.color };\n return null;\n }).filter(Boolean) as PaletteEntry[];\n } catch { return []; }\n },\n toAttribute: (v: PaletteEntry[]) => JSON.stringify(v),\n },\n })\n palette: PaletteEntry[] = [];\n\n /* ── internal state ──────────────────────────────────────────────── */\n @state() private _view: ColorPickerType = 'swatches';\n @state() private _recentColors: PaletteEntry[] = [];\n\n // picker canvas state\n @state() private _hue = 220;\n @state() private _sat = 0.7;\n @state() private _val = 0.93;\n @state() private _colorMode: 'HEX' | 'RGB' = 'HEX';\n @state() private _hexInput = '#366AEE';\n @state() private _r = 54;\n @state() private _g = 106;\n @state() private _b = 238;\n\n private _svCanvas: HTMLCanvasElement | null = null;\n private _hueCanvas: HTMLCanvasElement | null = null;\n private _draggingSV = false;\n private _draggingHue = false;\n private _pendingColor = '#366AEE';\n\n /* ── lifecycle ───────────────────────────────────────────────────── */\n connectedCallback() {\n super.connectedCallback();\n this._view = this.type;\n if (this.type === 'picker') {\n const [r, g, b] = hexToRgb(this._norm(this.value));\n [this._hue, this._sat, this._val] = rgbToHsv(r, g, b);\n this._syncInputs();\n }\n this._injectCss();\n document.addEventListener('mousemove', this._onGlobalMouseMove);\n document.addEventListener('mouseup', this._onGlobalMouseUp);\n }\n\n disconnectedCallback() {\n document.removeEventListener('mousemove', this._onGlobalMouseMove);\n document.removeEventListener('mouseup', this._onGlobalMouseUp);\n super.disconnectedCallback();\n }\n\n protected updated(changed: Map<string, unknown>) {\n if (changed.has('type')) {\n this._view = this.type;\n if (this.type === 'picker') {\n const [r, g, b] = hexToRgb(this._norm(this.value));\n [this._hue, this._sat, this._val] = rgbToHsv(r, g, b);\n this._syncInputs();\n }\n }\n if (changed.has('value') && this.type === 'picker' && this._view === 'picker' &&\n !this._draggingSV && !this._draggingHue) {\n const [r, g, b] = hexToRgb(this._norm(this.value));\n [this._hue, this._sat, this._val] = rgbToHsv(r, g, b);\n this._syncInputs();\n }\n \n if (this._view === 'picker') {\n requestAnimationFrame(() => {\n this._svCanvas = this.querySelector('.ncp-sv-canvas') as HTMLCanvasElement;\n this._hueCanvas = this.querySelector('.ncp-hue-canvas') as HTMLCanvasElement;\n this._drawSV();\n this._drawHue();\n });\n }\n }\n\n /* ── public API ──────────────────────────────────────────────────── */\n /** Reset the view back to the default type (call this when the host popover closes). */\n reset() {\n this._view = this.type;\n }\n\n \n private _injectCss() {\n if (this.querySelector('style[data-nile-color-picker]')) return;\n const style = document.createElement('style');\n style.setAttribute('data-nile-color-picker', '');\n style.textContent = getCssText();\n this.insertBefore(style, this.firstChild);\n }\n\n \n private _norm(hex: string) {\n const t = hex.trim();\n if (/^#[0-9a-f]{6}$/i.test(t)) return t.toUpperCase();\n if (/^#[0-9a-f]{3}$/i.test(t)) {\n const [a, b, c] = t.slice(1).toUpperCase().split('');\n return `#${a}${a}${b}${b}${c}${c}`;\n }\n return '#000000';\n }\n\n private get _paletteColors(): PaletteEntry[] {\n return this.palette.length > 0 ? this.palette : DEFAULT_PALETTE;\n }\n\n \n private _emit(value: string) {\n this.dispatchEvent(new CustomEvent('nile-change', {\n detail: { value },\n bubbles: true,\n composed: true,\n }));\n }\n\n private _apply(color: string) {\n const hex = this._norm(color);\n this.value = hex;\n const entry: PaletteEntry = { color: hex, name: hex };\n this._recentColors = [entry, ...this._recentColors.filter(e => this._norm(e.color) !== hex)].slice(0, this.recentColorsCount);\n this._emit(hex);\n if (this.mode === 'popover' && this._view === 'swatches') {\n this._closePopover();\n }\n }\n\n private _closePopover() {\n const pop = this.querySelector('nile-popover') as any;\n if (pop) pop.isShow = false;\n }\n\n private _openPicker() {\n const [r, g, b] = hexToRgb(this._norm(this.value));\n const [h, s, v] = rgbToHsv(r, g, b);\n this._hue = h; this._sat = s; this._val = v;\n this._syncInputs();\n this._view = 'picker';\n }\n\n private _syncInputs() {\n const [r, g, b] = hsvToRgb(this._hue, this._sat, this._val);\n const hex = rgbToHex(r, g, b);\n this._hexInput = hex; this._r = r; this._g = g; this._b = b;\n this._pendingColor = hex;\n }\n\n private _drawSV() {\n const canvas = this._svCanvas;\n if (!canvas) return;\n const ctx = canvas.getContext('2d');\n if (!ctx) return;\n const { width: w, height: h } = canvas;\n const [hr, hg, hb] = hsvToRgb(this._hue, 1, 1);\n ctx.fillStyle = `rgb(${hr},${hg},${hb})`;\n ctx.fillRect(0, 0, w, h);\n const wg = ctx.createLinearGradient(0, 0, w, 0);\n wg.addColorStop(0, 'rgba(255,255,255,1)'); wg.addColorStop(1, 'rgba(255,255,255,0)');\n ctx.fillStyle = wg; ctx.fillRect(0, 0, w, h);\n const bg = ctx.createLinearGradient(0, 0, 0, h);\n bg.addColorStop(0, 'rgba(0,0,0,0)'); bg.addColorStop(1, 'rgba(0,0,0,1)');\n ctx.fillStyle = bg; ctx.fillRect(0, 0, w, h);\n }\n\n private _drawHue() {\n const canvas = this._hueCanvas;\n if (!canvas) return;\n const ctx = canvas.getContext('2d');\n if (!ctx) return;\n const grad = ctx.createLinearGradient(0, 0, canvas.width, 0);\n ['#FF0000','#FFFF00','#00FF00','#00FFFF','#0000FF','#FF00FF','#FF0000']\n .forEach((c, i, a) => grad.addColorStop(i / (a.length - 1), c));\n ctx.fillStyle = grad; ctx.fillRect(0, 0, canvas.width, canvas.height);\n }\n\n private _onSVMouseDown = (e: MouseEvent) => { e.preventDefault(); this._draggingSV = true; this._updateSV(e); };\n private _onHueMouseDown = (e: MouseEvent) => { e.preventDefault(); this._draggingHue = true; this._updateHue(e); };\n\n private _onGlobalMouseMove = (e: MouseEvent) => {\n if (this._draggingSV) this._updateSV(e);\n if (this._draggingHue) this._updateHue(e);\n };\n private _onGlobalMouseUp = () => {\n const wasDraggingSV = this._draggingSV;\n const wasDraggingHue = this._draggingHue;\n if (!this.showActions && this._view === 'picker' && (wasDraggingSV || wasDraggingHue)) {\n this._commitPickerIfNoActions();\n }\n this._draggingSV = false;\n this._draggingHue = false;\n };\n\n private _commitPickerIfNoActions() {\n if (this.showActions) return;\n this._apply(this._pendingColor);\n if (this.mode === 'popover') {\n if (this.type === 'swatches') this._view = 'swatches';\n this._closePopover();\n }\n }\n\n private _updateSV(e: MouseEvent) {\n const canvas = this._svCanvas; if (!canvas) return;\n const rect = canvas.getBoundingClientRect();\n this._sat = Math.max(0, Math.min(e.clientX - rect.left, rect.width)) / rect.width;\n this._val = 1 - Math.max(0, Math.min(e.clientY - rect.top, rect.height)) / rect.height;\n this._syncInputs();\n }\n\n private _updateHue(e: MouseEvent) {\n const canvas = this._hueCanvas; if (!canvas) return;\n const rect = canvas.getBoundingClientRect();\n this._hue = (Math.max(0, Math.min(e.clientX - rect.left, rect.width)) / rect.width) * 360;\n this._syncInputs();\n }\n\n private _onHexInput = (e: Event) => {\n let val = ((e as CustomEvent).detail?.value ?? (e.target as HTMLInputElement).value ?? '').trim();\n if (!val.startsWith('#')) val = '#' + val;\n if (/^#[0-9a-f]{6}$/i.test(val)) {\n const [r, g, b] = hexToRgb(val);\n [this._hue, this._sat, this._val] = rgbToHsv(r, g, b);\n this._syncInputs();\n if (this._view === 'picker') this._commitPickerIfNoActions();\n }\n };\n\n private _onRgbInput = (ch: 'r' | 'g' | 'b', e: Event) => {\n const raw = (e as CustomEvent).detail?.value ?? (e.target as HTMLInputElement).value;\n const v = Math.max(0, Math.min(255, parseInt(String(raw), 10) || 0));\n if (ch === 'r') this._r = v; else if (ch === 'g') this._g = v; else this._b = v;\n [this._hue, this._sat, this._val] = rgbToHsv(this._r, this._g, this._b);\n this._syncInputs();\n if (this._view === 'picker') this._commitPickerIfNoActions();\n };\n\n private _onColorModeSelect = (e: CustomEvent<{ value: string }>) => {\n e.stopPropagation();\n const v = e.detail?.value;\n if (v === 'HEX' || v === 'RGB') {\n this._colorMode = v;\n }\n };\n\n private _pickEyedropper = async () => {\n const Ctor = (window as any).EyeDropper;\n if (!Ctor) { this._openPicker(); return; }\n try {\n const result = await new Ctor().open();\n if (result?.sRGBHex) this._apply(result.sRGBHex);\n } catch { /* cancelled */ }\n };\n private _renderSwatch(entry: PaletteEntry) {\n const norm = this._norm(entry.color);\n const isActive = this._norm(this.value) === norm;\n const tip = this.swatchTooltip === 'name'\n ? (entry.name || norm)\n : this.swatchTooltip === 'value'\n ? norm\n : entry.name ? `${entry.name} (${norm})` : norm;\n return html`\n <nile-lite-tooltip content=${tip}>\n <nile-color-swatch\n color=${norm}\n ?active=${isActive}\n @click=${() => this._apply(norm)}\n ></nile-color-swatch>\n </nile-lite-tooltip>\n `;\n }\n\n private _renderSwatchesView() {\n const recent = this._recentColors.slice(0, this.recentColorsCount);\n return html`\n <div class=\"ncp-panel\">\n <div class=\"ncp-palette-grid\">\n ${this._paletteColors.map(e => this._renderSwatch(e))}\n </div>\n\n ${this.noFill ? html`\n <button class=\"ncp-no-fill\" @click=${() => this._emit('none')}>\n <nile-glyph name=\"disabled\"></nile-glyph>\n <span>No Fill</span>\n </button>\n ` : nothing}\n\n <div class=\"ncp-custom-section\">\n <p class=\"ncp-custom-title\">Custom</p>\n <div class=\"ncp-custom-row\">\n ${recent.map(e => this._renderSwatch(e))}\n <nile-lite-tooltip content=\"Add custom color\">\n <button class=\"ncp-action-btn\" @click=${() => this._openPicker()}>\n<nile-glyph name=\"plus\"></nile-glyph>\n </button>\n </nile-lite-tooltip>\n <nile-lite-tooltip content=\"Pick from screen\">\n <button class=\"ncp-action-btn\" @click=${this._pickEyedropper}>\n <nile-glyph name=\"colorize\" size=\"12\"></nile-glyph>\n </button>\n </nile-lite-tooltip>\n </div>\n </div>\n </div>\n `;\n }\n\n private _renderPickerView() {\n const svX = this._sat * 100;\n const svY = (1 - this._val) * 100;\n const hueX = (this._hue / 360) * 100;\n\n return html`\n <div class=\"ncp-panel ncp-panel--picker\">\n\n ${this.showCanvas ? html`\n <div class=\"ncp-sv-area\" @mousedown=${this._onSVMouseDown}>\n <canvas class=\"ncp-sv-canvas\" width=\"244\" height=\"130\"></canvas>\n <div class=\"ncp-sv-thumb\" style=\"left:${svX}%;top:${svY}%\">\n <div class=\"ncp-sv-thumb-inner\"></div>\n </div>\n </div>\n ` : nothing}\n\n ${this.showHue ? html`\n <div class=\"ncp-hue-row\">\n <div class=\"ncp-hue-wrap\" @mousedown=${this._onHueMouseDown}>\n <canvas class=\"ncp-hue-canvas\" width=\"244\" height=\"14\"></canvas>\n <div class=\"ncp-hue-thumb\" style=\"left:${hueX}%\"></div>\n </div>\n <button class=\"ncp-eyedropper\" title=\"Pick from screen\" @click=${this._pickEyedropper}>\n <nile-glyph name=\"colorize\" size=\"16\"></nile-glyph>\n </button>\n </div>\n ` : nothing}\n\n ${this.showInputs ? html`\n <div class=\"ncp-input-row\">\n <nile-dropdown class=\"ncp-mode-dropdown\" placement=\"bottom-start\" distance=\"4\" hoist>\n <nile-button slot=\"trigger\" class=\"ncp-mode-btn\" variant=\"tertiary\">\n ${this._colorMode} <nile-icon name=\"arrowdown\" size=\"12\"></nile-icon>\n </nile-button>\n <nile-menu @nile-select=${this._onColorModeSelect}>\n <nile-menu-item value=\"HEX\" ?active=${this._colorMode === 'HEX'}>HEX</nile-menu-item>\n <nile-menu-item value=\"RGB\" ?active=${this._colorMode === 'RGB'}>RGB</nile-menu-item>\n </nile-menu>\n </nile-dropdown>\n ${this._colorMode === 'HEX'\n ? html`<nile-input class=\"ncp-hex\" .value=${this._hexInput} @nile-input=${this._onHexInput}></nile-input>`\n : html`\n <nile-input class=\"ncp-rgb\" type=\"number\" min=\"0\" max=\"255\" .value=${String(this._r)} @nile-input=${(e: Event) => this._onRgbInput('r', e)}></nile-input>\n <nile-input class=\"ncp-rgb\" type=\"number\" min=\"0\" max=\"255\" .value=${String(this._g)} @nile-input=${(e: Event) => this._onRgbInput('g', e)}></nile-input>\n <nile-input class=\"ncp-rgb\" type=\"number\" min=\"0\" max=\"255\" .value=${String(this._b)} @nile-input=${(e: Event) => this._onRgbInput('b', e)}></nile-input>\n `}\n </div>\n ` : nothing}\n\n ${this.showActions ? html`\n <div class=\"ncp-picker-actions\">\n ${this.type === 'swatches'\n ? html`<nile-button variant=\"secondary\" size=\"small\" @click=${() => { this._view = 'swatches'; }}>Cancel</nile-button>`\n : nothing}\n <nile-button variant=\"primary\" size=\"small\" @click=${() => { this._apply(this._pendingColor); if (this.type === 'swatches') this._view = 'swatches'; this._closePopover(); }}>Okay</nile-button>\n </div>\n ` : nothing}\n\n </div>\n `;\n }\n\n private _renderTrigger() {\n const isNoFill = this.value === 'none';\n const displayColor = isNoFill ? null : this._norm(this.value);\n return html`\n <button\n slot=\"anchor\"\n class=\"ncp-trigger${isNoFill ? ' ncp-trigger--no-fill' : ''}\"\n type=\"button\"\n aria-label=${isNoFill ? 'No Fill' : displayColor}\n style=${isNoFill ? '' : `background:${displayColor}`}\n ></button>\n `;\n }\n\n render() {\n const panel = this._view === 'picker' ? this._renderPickerView() : this._renderSwatchesView();\n\n if (this.mode === 'popover') {\n return html`\n <nile-popover\n .arrow=${false}\n flip\n .open=${this.open}\n placement=\"bottom-start\"\n id=\"color-picker-popover\"\n distance=\"8\"\n @nile-hide=${() => this.reset()}\n >\n ${this._renderTrigger()}\n ${panel}\n </nile-popover>\n `;\n }\n\n return panel;\n }\n}\n\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nile-color-picker': NileColorPicker;\n }\n}\n"]}
@@ -12,6 +12,7 @@ export type { PrintOptions } from './export';
12
12
  export { selectedImageInfo } from './commands';
13
13
  export { ImageView, FigureView } from './plugins/image-view';
14
14
  export { EmbedView } from './plugins/embed-view';
15
+ export { StyleBlockView } from './plugins/style-block-view';
15
16
  export { MathView } from './plugins/math-view';
16
17
  export type { MathRenderer } from './plugins/math-view';
17
18
  export { INDENT_STEP_PX, MAX_INDENT, BULLET_STYLES, ORDERED_STYLES } from './schema';
@@ -9,6 +9,7 @@ export { toInlineStyledHtml, buildWordDocument, buildPrintDocument, } from './ex
9
9
  export { selectedImageInfo } from './commands';
10
10
  export { ImageView, FigureView } from './plugins/image-view';
11
11
  export { EmbedView } from './plugins/embed-view';
12
+ export { StyleBlockView } from './plugins/style-block-view';
12
13
  export { MathView } from './plugins/math-view';
13
14
  export { INDENT_STEP_PX, MAX_INDENT, BULLET_STYLES, ORDERED_STYLES } from './schema';
14
15
  export { computeToolbarState } from './selection-state';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/nile-wysiwyg-editor/engine/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEvD,OAAO,EAAE,YAAY,EAAE,SAA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EACd,YAAY,EACZ,QAAQ,EACR,UAAU,EACV,WAAW,EACX,eAAe,EACf,YAAY,GACb,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EACL,mBAAmB,EACnB,gBAAgB,EAChB,oBAAoB,EACpB,gBAAgB,EAChB,mBAAmB,EACnB,kBAAkB,GACnB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAC;AACnF,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC7E,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC","sourcesContent":["export { createSchema, defaultSchema } from './schema';\nexport type { Alignment } from './schema';\nexport { sanitizeHtml, isSafeUrl } from './sanitize';\nexport {\n htmlToDoc,\n htmlToSlice,\n docToHtml,\n docToText,\n docToJson,\n jsonToDoc,\n isDocEmpty,\n} from './serializer';\nexport { getCommand, getMarkRange } from './commands';\nexport type { CommandName, CommandAttrs } from './commands';\nexport { docToMarkdown } from './markdown';\nexport { markdownToHtml, looksLikeMarkdown } from './markdown-parse';\nexport { isOfficeHtml, isExcelHtml, cleanOfficeHtml } from './office-paste';\nexport {\n toInlineStyledHtml,\n buildWordDocument,\n buildPrintDocument,\n} from './export';\nexport type { PrintOptions } from './export';\nexport { selectedImageInfo } from './commands';\nexport { ImageView, FigureView } from './plugins/image-view';\nexport { EmbedView } from './plugins/embed-view';\nexport { MathView } from './plugins/math-view';\nexport type { MathRenderer } from './plugins/math-view';\nexport { INDENT_STEP_PX, MAX_INDENT, BULLET_STYLES, ORDERED_STYLES } from './schema';\nexport { computeToolbarState } from './selection-state';\nexport type { ToolbarState } from './selection-state';\nexport {\n createEditorState,\n mentionSuggestKey,\n slashSuggestKey,\n emojiSuggestKey,\n} from './create-state';\nexport { maxLengthPlugin } from './plugins/max-length';\nexport { TaskItemView } from './plugins/task-list';\nexport { codeHighlightPlugin, CODE_LANGUAGES } from './plugins/code-highlight';\nexport { toEmbedUrl, isAllowedEmbedSrc, embedPastePlugin } from './plugins/embeds';\nexport type { EmbedTarget } from './plugins/embeds';\nexport type { CreateStateOptions } from './create-state';\nexport { countWords } from './serializer';\nexport type { SuggestionMatch, SuggestionOptions } from './plugins/suggestions';\nexport {\n findReplaceKey,\n getFindState,\n searchTr,\n findStepTr,\n clearFindTr,\n replaceActiveTr,\n replaceAllTr,\n} from './plugins/find-replace';\nexport type { FindState, FindMatch } from './plugins/find-replace';\nexport { placeholderPlugin } from './plugins/placeholder';\nexport {\n formatPainterPlugin,\n formatPainterKey,\n isFormatPainterArmed,\n armFormatPainter,\n disarmFormatPainter,\n applyFormatPainter,\n} from './plugins/format-painter';\nexport { linkPlugin } from './plugins/link';\nexport { singleLinePlugin, flattenToSingleParagraph } from './plugins/single-line';\nexport { tablePlugins } from './plugins/tables';\nexport { imagePlugin, imageUploadKey, findUploadPos } from './plugins/image';\nexport { pastePlugin, plainTextSlice, stripSliceFormatting } from './plugins/paste';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/nile-wysiwyg-editor/engine/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEvD,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACrD,OAAO,EACL,SAAS,EACT,WAAW,EACX,SAAS,EACT,SAAS,EACT,SAAS,EACT,SAAS,EACT,UAAU,GACX,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAEtD,OAAO,EAAE,aAAa,EAAE,MAAM,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AgB,EAChB,oBAAoB,EACpB,gBAAgB,EAChB,mBAAmB,EACnB,kBAAkB,GACnB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAC;AACnF,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC7E,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC","sourcesContent":["export { createSchema, defaultSchema } from './schema';\nexport type { Alignment } from './schema';\nexport { sanitizeHtml, isSafeUrl } from './sanitize';\nexport {\n htmlToDoc,\n htmlToSlice,\n docToHtml,\n docToText,\n docToJson,\n jsonToDoc,\n isDocEmpty,\n} from './serializer';\nexport { getCommand, getMarkRange } from './commands';\nexport type { CommandName, CommandAttrs } from './commands';\nexport { docToMarkdown } from './markdown';\nexport { markdownToHtml, looksLikeMarkdown } from './markdown-parse';\nexport { isOfficeHtml, isExcelHtml, cleanOfficeHtml } from './office-paste';\nexport {\n toInlineStyledHtml,\n buildWordDocument,\n buildPrintDocument,\n} from './export';\nexport type { PrintOptions } from './export';\nexport { selectedImageInfo } from './commands';\nexport { ImageView, FigureView } from './plugins/image-view';\nexport { EmbedView } from './plugins/embed-view';\nexport { StyleBlockView } from './plugins/style-block-view';\nexport { MathView } from './plugins/math-view';\nexport type { MathRenderer } from './plugins/math-view';\nexport { INDENT_STEP_PX, MAX_INDENT, BULLET_STYLES, ORDERED_STYLES } from './schema';\nexport { computeToolbarState } from './selection-state';\nexport type { ToolbarState } from './selection-state';\nexport {\n createEditorState,\n mentionSuggestKey,\n slashSuggestKey,\n emojiSuggestKey,\n} from './create-state';\nexport { maxLengthPlugin } from './plugins/max-length';\nexport { TaskItemView } from './plugins/task-list';\nexport { codeHighlightPlugin, CODE_LANGUAGES } from './plugins/code-highlight';\nexport { toEmbedUrl, isAllowedEmbedSrc, embedPastePlugin } from './plugins/embeds';\nexport type { EmbedTarget } from './plugins/embeds';\nexport type { CreateStateOptions } from './create-state';\nexport { countWords } from './serializer';\nexport type { SuggestionMatch, SuggestionOptions } from './plugins/suggestions';\nexport {\n findReplaceKey,\n getFindState,\n searchTr,\n findStepTr,\n clearFindTr,\n replaceActiveTr,\n replaceAllTr,\n} from './plugins/find-replace';\nexport type { FindState, FindMatch } from './plugins/find-replace';\nexport { placeholderPlugin } from './plugins/placeholder';\nexport {\n formatPainterPlugin,\n formatPainterKey,\n isFormatPainterArmed,\n armFormatPainter,\n disarmFormatPainter,\n applyFormatPainter,\n} from './plugins/format-painter';\nexport { linkPlugin } from './plugins/link';\nexport { singleLinePlugin, flattenToSingleParagraph } from './plugins/single-line';\nexport { tablePlugins } from './plugins/tables';\nexport { imagePlugin, imageUploadKey, findUploadPos } from './plugins/image';\nexport { pastePlugin, plainTextSlice, stripSliceFormatting } from './plugins/paste';\n"]}
@@ -1,4 +1,5 @@
1
1
  import { attachResizeHandles, isResizeEvent } from './image-view';
2
+ import { EMBED_SANDBOX, EMBED_REFERRER_POLICY } from './embeds';
2
3
  /** Below this a 16:9 player is unusable and its own controls stop fitting. */
3
4
  const MIN_EMBED_WIDTH = 160;
4
5
  /**
@@ -15,6 +16,8 @@ export class EmbedView {
15
16
  this.iframe.setAttribute('frameborder', '0');
16
17
  this.iframe.setAttribute('allowfullscreen', 'true');
17
18
  this.iframe.setAttribute('allow', 'accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture');
19
+ this.iframe.setAttribute('sandbox', EMBED_SANDBOX);
20
+ this.iframe.setAttribute('referrerpolicy', EMBED_REFERRER_POLICY);
18
21
  this.dom.appendChild(this.iframe);
19
22
  this.applyAttrs(node);
20
23
  attachResizeHandles(this.dom, this.dom, width => {
@@ -1 +1 @@
1
- {"version":3,"file":"embed-view.js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K,CAAC,UAAU,GAAG,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;QAClF,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,WAAW,GAAG,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;IAChE,CAAC;IAED,MAAM,CAAC,IAAY;QACjB,IAAI,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC,IAAI,CAAC,IAAI;YAAE,OAAO,KAAK,CAAC;QAC/C,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;QACtB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,SAAS,CAAC,KAAY;QACpB,OAAO,aAAa,CAAC,KAAK,CAAC,CAAC;IAC9B,CAAC;IAED,cAAc;QACZ,OAAO,IAAI,CAAC;IACd,CAAC;CACF","sourcesContent":["import { Node as PMNode } from 'prosemirror-model';\nimport { EditorView, NodeView } from 'prosemirror-view';\nimport { attachResizeHandles, isResizeEvent } from './image-view';\n\n/** Below this a 16:9 player is unusable and its own controls stop fitting. */\nconst MIN_EMBED_WIDTH = 160;\n\n/**\n * Video embed (YouTube/Vimeo/Loom) with the same corner drag-resize handles\n * as images. Only the width is dragged; the 16:9 aspect ratio comes from CSS,\n * so the height follows automatically.\n */\nexport class EmbedView implements NodeView {\n dom: HTMLDivElement;\n\n private iframe: HTMLIFrameElement;\n\n constructor(\n private node: PMNode,\n view: EditorView,\n getPos: () => number | undefined\n ) {\n this.dom = document.createElement('div');\n this.dom.className = 'nile-wysiwyg__embed';\n this.iframe = document.createElement('iframe');\n this.iframe.setAttribute('frameborder', '0');\n this.iframe.setAttribute('allowfullscreen', 'true');\n this.iframe.setAttribute(\n 'allow',\n 'accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture'\n );\n this.dom.appendChild(this.iframe);\n this.applyAttrs(node);\n\n attachResizeHandles(\n this.dom,\n this.dom,\n width => {\n const pos = getPos();\n if (pos === undefined || !view.editable) return;\n const current = view.state.doc.nodeAt(pos);\n if (!current) return;\n view.dispatch(\n view.state.tr.setNodeMarkup(pos, undefined, { ...current.attrs, width })\n );\n },\n MIN_EMBED_WIDTH\n );\n }\n\n private applyAttrs(node: PMNode): void {\n const { src, provider, title, width, align } = node.attrs;\n if (this.iframe.getAttribute('src') !== src) this.iframe.setAttribute('src', src);\n this.dom.setAttribute('data-embed-provider', provider ?? 'generic');\n if (title) this.iframe.title = title;\n else this.iframe.removeAttribute('title');\n if (width) {\n this.dom.setAttribute('data-width', String(width));\n this.dom.style.width = `${width}px`;\n } else {\n this.dom.removeAttribute('data-width');\n this.dom.style.width = '';\n }\n // Block alignment via auto margins (mirrors the image figure).\n if (align) this.dom.setAttribute('data-align', align);\n else this.dom.removeAttribute('data-align');\n this.dom.style.marginLeft = align === 'center' || align === 'right' ? 'auto' : '';\n this.dom.style.marginRight = align === 'center' ? 'auto' : '';\n }\n\n update(node: PMNode): boolean {\n if (node.type !== this.node.type) return false;\n this.node = node;\n this.applyAttrs(node);\n return true;\n }\n\n stopEvent(event: Event): boolean {\n return isResizeEvent(event);\n }\n\n ignoreMutation(): boolean {\n return true;\n }\n}\n"]}
1
+ {"version":3,"file":"embed-view.js","sourceRoot":"","sources":["../../../../../src/nile-wysiwyg-editor/engine/plugins/embed-view.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAClE,OAAO,EAAE,aAAa,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAEhE,8EAA8E;AAC9E,MAAM,eAAe,GAAG,GAAG,CAAC;AAE5B;;;;GAIG;AACH,MAAM,OAAO,SAAS;IAKpB,YACU,IAAY,EACpB,IAAgB,EAChB,MAAgC;QAFxB,SAAI,GAAJ,IAAI,CAAQ;QAIpB,IAAI,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G,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;IAChE,CAAC;IAED,MAAM,CAAC,IAAY;QACjB,IAAI,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC,IAAI,CAAC,IAAI;YAAE,OAAO,KAAK,CAAC;QAC/C,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;QACtB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,SAAS,CAAC,KAAY;QACpB,OAAO,aAAa,CAAC,KAAK,CAAC,CAAC;IAC9B,CAAC;IAED,cAAc;QACZ,OAAO,IAAI,CAAC;IACd,CAAC;CACF","sourcesContent":["import { Node as PMNode } from 'prosemirror-model';\nimport { EditorView, NodeView } from 'prosemirror-view';\nimport { attachResizeHandles, isResizeEvent } from './image-view';\nimport { EMBED_SANDBOX, EMBED_REFERRER_POLICY } from './embeds';\n\n/** Below this a 16:9 player is unusable and its own controls stop fitting. */\nconst MIN_EMBED_WIDTH = 160;\n\n/**\n * Video embed (YouTube/Vimeo/Loom) with the same corner drag-resize handles\n * as images. Only the width is dragged; the 16:9 aspect ratio comes from CSS,\n * so the height follows automatically.\n */\nexport class EmbedView implements NodeView {\n dom: HTMLDivElement;\n\n private iframe: HTMLIFrameElement;\n\n constructor(\n private node: PMNode,\n view: EditorView,\n getPos: () => number | undefined\n ) {\n this.dom = document.createElement('div');\n this.dom.className = 'nile-wysiwyg__embed';\n this.iframe = document.createElement('iframe');\n this.iframe.setAttribute('frameborder', '0');\n this.iframe.setAttribute('allowfullscreen', 'true');\n this.iframe.setAttribute(\n 'allow',\n 'accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture'\n );\n this.iframe.setAttribute('sandbox', EMBED_SANDBOX);\n this.iframe.setAttribute('referrerpolicy', EMBED_REFERRER_POLICY);\n this.dom.appendChild(this.iframe);\n this.applyAttrs(node);\n\n attachResizeHandles(\n this.dom,\n this.dom,\n width => {\n const pos = getPos();\n if (pos === undefined || !view.editable) return;\n const current = view.state.doc.nodeAt(pos);\n if (!current) return;\n view.dispatch(\n view.state.tr.setNodeMarkup(pos, undefined, { ...current.attrs, width })\n );\n },\n MIN_EMBED_WIDTH\n );\n }\n\n private applyAttrs(node: PMNode): void {\n const { src, provider, title, width, align } = node.attrs;\n if (this.iframe.getAttribute('src') !== src) this.iframe.setAttribute('src', src);\n this.dom.setAttribute('data-embed-provider', provider ?? 'generic');\n if (title) this.iframe.title = title;\n else this.iframe.removeAttribute('title');\n if (width) {\n this.dom.setAttribute('data-width', String(width));\n this.dom.style.width = `${width}px`;\n } else {\n this.dom.removeAttribute('data-width');\n this.dom.style.width = '';\n }\n // Block alignment via auto margins (mirrors the image figure).\n if (align) this.dom.setAttribute('data-align', align);\n else this.dom.removeAttribute('data-align');\n this.dom.style.marginLeft = align === 'center' || align === 'right' ? 'auto' : '';\n this.dom.style.marginRight = align === 'center' ? 'auto' : '';\n }\n\n update(node: PMNode): boolean {\n if (node.type !== this.node.type) return false;\n this.node = node;\n this.applyAttrs(node);\n return true;\n }\n\n stopEvent(event: Event): boolean {\n return isResizeEvent(event);\n }\n\n ignoreMutation(): boolean {\n return true;\n }\n}\n"]}
@@ -1,14 +1,29 @@
1
1
  import { Plugin } from 'prosemirror-state';
2
2
  export interface EmbedTarget {
3
3
  src: string;
4
- provider: 'youtube' | 'vimeo' | 'loom';
4
+ provider: 'youtube' | 'vimeo' | 'loom' | 'generic';
5
5
  }
6
6
  /**
7
- * Converts share/watch URLs from supported providers into their embed URLs.
8
- * Returns null for anything unrecognized only these providers are allowed.
7
+ * Sandbox tokens applied to every embed iframe. Notably this OMITS
8
+ * `allow-top-navigation`, so a framed page cannot redirect the whole tab
9
+ * (the main clickjacking/phishing vector); scripts and same-origin are
10
+ * allowed so third-party players still run. Kept in sync with the sanitizer.
11
+ */
12
+ export declare const EMBED_SANDBOX = "allow-scripts allow-same-origin allow-presentation allow-popups";
13
+ /** Limits the referrer leaked to the embedded third-party host. */
14
+ export declare const EMBED_REFERRER_POLICY = "strict-origin-when-cross-origin";
15
+ /**
16
+ * Converts a URL into an embed target. Known providers (YouTube/Vimeo/Loom)
17
+ * are canonicalized to their dedicated embed URLs; any other `https://` URL
18
+ * is accepted as a `generic` embed. The iframe is always sandboxed on render
19
+ * (see EMBED_SANDBOX), so untrusted hosts cannot navigate the top window.
20
+ * Returns null only for non-https or unparseable URLs.
9
21
  */
10
22
  export declare function toEmbedUrl(url: string): EmbedTarget | null;
11
- /** True when a URL is already a permitted embed src (sanitizer check). */
23
+ /**
24
+ * True when a URL is permitted as an embed src (sanitizer check). Any
25
+ * `https://` URL is allowed; the iframe is sandboxed at render time.
26
+ */
12
27
  export declare function isAllowedEmbedSrc(src: string): boolean;
13
28
  /**
14
29
  * Pasting a bare provider URL onto an empty selection inserts an embed
@@ -1,7 +1,19 @@
1
1
  import { Plugin } from 'prosemirror-state';
2
2
  /**
3
- * Converts share/watch URLs from supported providers into their embed URLs.
4
- * Returns null for anything unrecognized only these providers are allowed.
3
+ * Sandbox tokens applied to every embed iframe. Notably this OMITS
4
+ * `allow-top-navigation`, so a framed page cannot redirect the whole tab
5
+ * (the main clickjacking/phishing vector); scripts and same-origin are
6
+ * allowed so third-party players still run. Kept in sync with the sanitizer.
7
+ */
8
+ export const EMBED_SANDBOX = 'allow-scripts allow-same-origin allow-presentation allow-popups';
9
+ /** Limits the referrer leaked to the embedded third-party host. */
10
+ export const EMBED_REFERRER_POLICY = 'strict-origin-when-cross-origin';
11
+ /**
12
+ * Converts a URL into an embed target. Known providers (YouTube/Vimeo/Loom)
13
+ * are canonicalized to their dedicated embed URLs; any other `https://` URL
14
+ * is accepted as a `generic` embed. The iframe is always sandboxed on render
15
+ * (see EMBED_SANDBOX), so untrusted hosts cannot navigate the top window.
16
+ * Returns null only for non-https or unparseable URLs.
5
17
  */
6
18
  export function toEmbedUrl(url) {
7
19
  let parsed;
@@ -29,42 +41,35 @@ export function toEmbedUrl(url) {
29
41
  if (/^[\w-]{6,20}$/.test(id)) {
30
42
  return { src: `https://www.youtube-nocookie.com/embed/${id}`, provider: 'youtube' };
31
43
  }
32
- return null;
33
44
  }
34
45
  // Vimeo: vimeo.com/123456789, player.vimeo.com/video/123456789
35
- if (host === 'vimeo.com' || host === 'player.vimeo.com') {
46
+ else if (host === 'vimeo.com' || host === 'player.vimeo.com') {
36
47
  const match = /\/(?:video\/)?(\d{6,12})(?:$|[/?])/.exec(parsed.pathname);
37
48
  if (match) {
38
49
  return { src: `https://player.vimeo.com/video/${match[1]}`, provider: 'vimeo' };
39
50
  }
40
- return null;
41
51
  }
42
52
  // Loom: loom.com/share/ID or loom.com/embed/ID
43
- if (host === 'loom.com') {
53
+ else if (host === 'loom.com') {
44
54
  const match = /^\/(share|embed)\/([0-9a-f]{16,40})/.exec(parsed.pathname);
45
55
  if (match) {
46
56
  return { src: `https://www.loom.com/embed/${match[2]}`, provider: 'loom' };
47
57
  }
48
- return null;
49
58
  }
50
- return null;
59
+ // Any other https URL: embed as-is, sandboxed.
60
+ return { src: parsed.href, provider: 'generic' };
51
61
  }
52
- /** True when a URL is already a permitted embed src (sanitizer check). */
62
+ /**
63
+ * True when a URL is permitted as an embed src (sanitizer check). Any
64
+ * `https://` URL is allowed; the iframe is sandboxed at render time.
65
+ */
53
66
  export function isAllowedEmbedSrc(src) {
54
- let parsed;
55
67
  try {
56
- parsed = new URL(src.trim());
68
+ return new URL(src.trim()).protocol === 'https:';
57
69
  }
58
70
  catch {
59
71
  return false;
60
72
  }
61
- if (parsed.protocol !== 'https:')
62
- return false;
63
- const host = parsed.hostname.replace(/^www\./, '');
64
- return (((host === 'youtube.com' || host === 'youtube-nocookie.com') &&
65
- parsed.pathname.startsWith('/embed/')) ||
66
- (host === 'player.vimeo.com' && parsed.pathname.startsWith('/video/')) ||
67
- (host === 'loom.com' && parsed.pathname.startsWith('/embed/')));
68
73
  }
69
74
  /**
70
75
  * Pasting a bare provider URL onto an empty selection inserts an embed
@@ -1 +1 @@
1
- {"version":3,"file":"embeds.js","sourceRoot":"","sources":["../../../../../src/nile-wysiwyg-editor/engine/plugins/embeds.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAO3C;;;GAGG;AACH,MAAM,UAAU,UAAU,CAAC,GAAW;IACpC,IAAI,MAAW,CAAC;IAChB,IAAI,CAAC;QACH,MAAM,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC;IAC/B,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IAAI,MAAM,CAAC,QAAQ,KAAK,QAAQ;QAAE,OAAO,IAAI,CAAC;IAC9C,MAAM,IAAI,GAAG,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;IAEnD,wDAAwD;IACxD,IAAI,IAAI,KAAK,aAAa,IAAI,IAAI,KAAK,sBAAsB,IAAI,IAAI,KAAK,UAAU,EAAE,CAAC;QACrF,IAAI,EAAE,GAAG,EAAE,CAAC;QACZ,IAAI,IAAI,KAAK,UAAU;YAAE,EAAE,GAAG,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;aAChE,IAAI,MAAM,CAAC,QAAQ,KAAK,QAAQ;YAAE,EAAE,GAAG,MAAM,CAAC,YAAY,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;aAC1E,CAAC;YACJ,MAAM,KAAK,GAAG,6BAA6B,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;YAClE,IAAI,KAAK;gBAAE,EAAE,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;QAC3B,CAAC;QACD,IAAI,eAAe,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC;YAC7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AC,CAAC;AACL,CAAC","sourcesContent":["import { Plugin } from 'prosemirror-state';\n\nexport interface EmbedTarget {\n src: string;\n provider: 'youtube' | 'vimeo' | 'loom';\n}\n\n/**\n * Converts share/watch URLs from supported providers into their embed URLs.\n * Returns null for anything unrecognized only these providers are allowed.\n */\nexport function toEmbedUrl(url: string): EmbedTarget | null {\n let parsed: URL;\n try {\n parsed = new URL(url.trim());\n } catch {\n return null;\n }\n if (parsed.protocol !== 'https:') return null;\n const host = parsed.hostname.replace(/^www\\./, '');\n\n // YouTube: watch?v=ID, youtu.be/ID, shorts/ID, embed/ID\n if (host === 'youtube.com' || host === 'youtube-nocookie.com' || host === 'youtu.be') {\n let id = '';\n if (host === 'youtu.be') id = parsed.pathname.slice(1).split('/')[0];\n else if (parsed.pathname === '/watch') id = parsed.searchParams.get('v') ?? '';\n else {\n const match = /^\\/(embed|shorts)\\/([\\w-]+)/.exec(parsed.pathname);\n if (match) id = match[2];\n }\n if (/^[\\w-]{6,20}$/.test(id)) {\n return { src: `https://www.youtube-nocookie.com/embed/${id}`, provider: 'youtube' };\n }\n return null;\n }\n\n // Vimeo: vimeo.com/123456789, player.vimeo.com/video/123456789\n if (host === 'vimeo.com' || host === 'player.vimeo.com') {\n const match = /\\/(?:video\\/)?(\\d{6,12})(?:$|[/?])/.exec(parsed.pathname);\n if (match) {\n return { src: `https://player.vimeo.com/video/${match[1]}`, provider: 'vimeo' };\n }\n return null;\n }\n\n // Loom: loom.com/share/ID or loom.com/embed/ID\n if (host === 'loom.com') {\n const match = /^\\/(share|embed)\\/([0-9a-f]{16,40})/.exec(parsed.pathname);\n if (match) {\n return { src: `https://www.loom.com/embed/${match[2]}`, provider: 'loom' };\n }\n return null;\n }\n\n return null;\n}\n\n/** True when a URL is already a permitted embed src (sanitizer check). */\nexport function isAllowedEmbedSrc(src: string): boolean {\n let parsed: URL;\n try {\n parsed = new URL(src.trim());\n } catch {\n return false;\n }\n if (parsed.protocol !== 'https:') return false;\n const host = parsed.hostname.replace(/^www\\./, '');\n return (\n ((host === 'youtube.com' || host === 'youtube-nocookie.com') &&\n parsed.pathname.startsWith('/embed/')) ||\n (host === 'player.vimeo.com' && parsed.pathname.startsWith('/video/')) ||\n (host === 'loom.com' && parsed.pathname.startsWith('/embed/'))\n );\n}\n\n/**\n * Pasting a bare provider URL onto an empty selection inserts an embed\n * instead of plain text. (Pasting over selected text still creates a link.)\n */\nexport function embedPastePlugin(): Plugin {\n return new Plugin({\n props: {\n handlePaste(view, event) {\n const { state } = view;\n if (!state.selection.empty) return false;\n const text = event.clipboardData?.getData('text/plain')?.trim();\n if (!text || /\\s/.test(text)) return false;\n const target = toEmbedUrl(text);\n if (!target) return false;\n const embed = state.schema.nodes.embed.create({\n src: target.src,\n provider: target.provider,\n });\n view.dispatch(state.tr.replaceSelectionWith(embed).scrollIntoView());\n return true;\n },\n },\n });\n}\n"]}
1
+ {"version":3,"file":"embeds.js","sourceRoot":"","sources":["../../../../../src/nile-wysiwyg-editor/engine/plugins/embeds.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAO3C;;;;;GAKG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,iEAAiE,CAAC;AAE/F,mEAAmE;AACnE,MAAM,CAAC,MAAM,qBAAqB,GAAG,iCAAiC,CAAC;AAEvE;;;;;;GAMG;AACH,MAAM,UAAU,UAAU,CAAC,GAAW;IACpC,IAAI,MAAW,CAAC;IAChB,IAAI,CAAC;QACH,MAAM,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC;IAC/B,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IAAI,MAAM,CAAC,QAAQ,KAAK,QAAQ;QAAE,OAAO,IAAI,CAAC;IAC9C,MAAM,IAAI,GAAG,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;IAEnD,wDA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,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC,oBAAoB,CAAC,KAAK,CAAC,CAAC,cAAc,EAAE,CAAC,CAAC;gBACrE,OAAO,IAAI,CAAC;YACd,CAAC;SACF;KACF,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { Plugin } from 'prosemirror-state';\n\nexport interface EmbedTarget {\n src: string;\n provider: 'youtube' | 'vimeo' | 'loom' | 'generic';\n}\n\n/**\n * Sandbox tokens applied to every embed iframe. Notably this OMITS\n * `allow-top-navigation`, so a framed page cannot redirect the whole tab\n * (the main clickjacking/phishing vector); scripts and same-origin are\n * allowed so third-party players still run. Kept in sync with the sanitizer.\n */\nexport const EMBED_SANDBOX = 'allow-scripts allow-same-origin allow-presentation allow-popups';\n\n/** Limits the referrer leaked to the embedded third-party host. */\nexport const EMBED_REFERRER_POLICY = 'strict-origin-when-cross-origin';\n\n/**\n * Converts a URL into an embed target. Known providers (YouTube/Vimeo/Loom)\n * are canonicalized to their dedicated embed URLs; any other `https://` URL\n * is accepted as a `generic` embed. The iframe is always sandboxed on render\n * (see EMBED_SANDBOX), so untrusted hosts cannot navigate the top window.\n * Returns null only for non-https or unparseable URLs.\n */\nexport function toEmbedUrl(url: string): EmbedTarget | null {\n let parsed: URL;\n try {\n parsed = new URL(url.trim());\n } catch {\n return null;\n }\n if (parsed.protocol !== 'https:') return null;\n const host = parsed.hostname.replace(/^www\\./, '');\n\n // YouTube: watch?v=ID, youtu.be/ID, shorts/ID, embed/ID\n if (host === 'youtube.com' || host === 'youtube-nocookie.com' || host === 'youtu.be') {\n let id = '';\n if (host === 'youtu.be') id = parsed.pathname.slice(1).split('/')[0];\n else if (parsed.pathname === '/watch') id = parsed.searchParams.get('v') ?? '';\n else {\n const match = /^\\/(embed|shorts)\\/([\\w-]+)/.exec(parsed.pathname);\n if (match) id = match[2];\n }\n if (/^[\\w-]{6,20}$/.test(id)) {\n return { src: `https://www.youtube-nocookie.com/embed/${id}`, provider: 'youtube' };\n }\n }\n\n // Vimeo: vimeo.com/123456789, player.vimeo.com/video/123456789\n else if (host === 'vimeo.com' || host === 'player.vimeo.com') {\n const match = /\\/(?:video\\/)?(\\d{6,12})(?:$|[/?])/.exec(parsed.pathname);\n if (match) {\n return { src: `https://player.vimeo.com/video/${match[1]}`, provider: 'vimeo' };\n }\n }\n\n // Loom: loom.com/share/ID or loom.com/embed/ID\n else if (host === 'loom.com') {\n const match = /^\\/(share|embed)\\/([0-9a-f]{16,40})/.exec(parsed.pathname);\n if (match) {\n return { src: `https://www.loom.com/embed/${match[2]}`, provider: 'loom' };\n }\n }\n\n // Any other https URL: embed as-is, sandboxed.\n return { src: parsed.href, provider: 'generic' };\n}\n\n/**\n * True when a URL is permitted as an embed src (sanitizer check). Any\n * `https://` URL is allowed; the iframe is sandboxed at render time.\n */\nexport function isAllowedEmbedSrc(src: string): boolean {\n try {\n return new URL(src.trim()).protocol === 'https:';\n } catch {\n return false;\n }\n}\n\n/**\n * Pasting a bare provider URL onto an empty selection inserts an embed\n * instead of plain text. (Pasting over selected text still creates a link.)\n */\nexport function embedPastePlugin(): Plugin {\n return new Plugin({\n props: {\n handlePaste(view, event) {\n const { state } = view;\n if (!state.selection.empty) return false;\n const text = event.clipboardData?.getData('text/plain')?.trim();\n if (!text || /\\s/.test(text)) return false;\n const target = toEmbedUrl(text);\n if (!target) return false;\n const embed = state.schema.nodes.embed.create({\n src: target.src,\n provider: target.provider,\n });\n view.dispatch(state.tr.replaceSelectionWith(embed).scrollIntoView());\n return true;\n },\n },\n });\n}\n"]}
@@ -3,13 +3,18 @@ import { NodeView } from 'prosemirror-view';
3
3
  /** Turns a LaTeX string into HTML (KaTeX/MathJax/MathML). Host-provided. */
4
4
  export type MathRenderer = (latex: string, display: 'inline' | 'block') => string;
5
5
  /**
6
- * Inline atom rendering a math formula. When the host supplies a renderer the
7
- * formula is drawn with it; otherwise the raw LaTeX is shown in a math chip so
8
- * the content is still visible and editable without a math engine.
6
+ * Inline atom rendering a math formula. Precedence:
7
+ * 1. A host-supplied `mathRenderer` (full control e.g. KaTeX HTML, MathJax).
8
+ * 2. The built-in default: KaTeX compiled to **MathML**, which browsers render
9
+ * natively with no stylesheet or web fonts (works cleanly inside the
10
+ * editor's shadow root).
11
+ * 3. If KaTeX can't load / parse, the raw LaTeX stays visible.
9
12
  */
10
13
  export declare class MathView implements NodeView {
11
14
  dom: HTMLSpanElement;
12
15
  private renderer?;
16
+ /** Bumps on every render so a slow async KaTeX result for a stale node is dropped. */
17
+ private token;
13
18
  constructor(node: PMNode, renderer?: MathRenderer);
14
19
  private render;
15
20
  update(node: PMNode): boolean;
@@ -1,10 +1,26 @@
1
1
  /**
2
- * Inline atom rendering a math formula. When the host supplies a renderer the
3
- * formula is drawn with it; otherwise the raw LaTeX is shown in a math chip so
4
- * the content is still visible and editable without a math engine.
2
+ * Lazy-loaded KaTeX module (loaded once, only when the first formula renders,
3
+ * so editors without math pay nothing). Resolves to the katex default export.
4
+ */
5
+ let katexPromise = null;
6
+ function loadKatex() {
7
+ if (!katexPromise) {
8
+ katexPromise = import('katex').then(m => m.default);
9
+ }
10
+ return katexPromise;
11
+ }
12
+ /**
13
+ * Inline atom rendering a math formula. Precedence:
14
+ * 1. A host-supplied `mathRenderer` (full control — e.g. KaTeX HTML, MathJax).
15
+ * 2. The built-in default: KaTeX compiled to **MathML**, which browsers render
16
+ * natively with no stylesheet or web fonts (works cleanly inside the
17
+ * editor's shadow root).
18
+ * 3. If KaTeX can't load / parse, the raw LaTeX stays visible.
5
19
  */
6
20
  export class MathView {
7
21
  constructor(node, renderer) {
22
+ /** Bumps on every render so a slow async KaTeX result for a stale node is dropped. */
23
+ this.token = 0;
8
24
  this.renderer = renderer;
9
25
  this.dom = document.createElement('span');
10
26
  this.dom.contentEditable = 'false';
@@ -20,6 +36,8 @@ export class MathView {
20
36
  this.dom.setAttribute('data-math', latex);
21
37
  this.dom.setAttribute('data-math-display', display);
22
38
  this.dom.title = latex;
39
+ const token = ++this.token;
40
+ // 1. Host renderer wins.
23
41
  if (this.renderer) {
24
42
  try {
25
43
  // Host renderer output is trusted (same trust level as uploadHandler).
@@ -27,10 +45,29 @@ export class MathView {
27
45
  return;
28
46
  }
29
47
  catch {
30
- // Fall back to raw LaTeX if the renderer throws.
48
+ // Fall through to the built-in renderer.
31
49
  }
32
50
  }
51
+ // 2. Built-in KaTeX → MathML. Show raw LaTeX until the (lazy) engine loads.
33
52
  this.dom.textContent = latex;
53
+ loadKatex()
54
+ .then(katex => {
55
+ if (token !== this.token)
56
+ return; // node changed while loading
57
+ try {
58
+ this.dom.innerHTML = katex.renderToString(latex, {
59
+ output: 'mathml',
60
+ displayMode: display === 'block',
61
+ throwOnError: false,
62
+ });
63
+ }
64
+ catch {
65
+ this.dom.textContent = latex;
66
+ }
67
+ })
68
+ .catch(() => {
69
+ /* KaTeX unavailable — keep the raw LaTeX already shown. */
70
+ });
34
71
  }
35
72
  update(node) {
36
73
  if (node.type.name !== 'math')
@@ -1 +1 @@
1
- {"version":3,"file":"math-view.js","sourceRoot":"","sources":["../../../../../src/nile-wysiwyg-editor/engine/plugins/math-view.ts"],"names":[],"mappings":"AAMA;;;;GAIG;AACH,MAAM,OAAO,QAAQ;IAKnB,YAAY,IAAY,EAAE,QAAuB;QAC/C,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,GAAG,GAAG,QAAQ,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;QAC1C,IAAI,CAAC,GAAG,CAAC,eAAe,GAAG,OAAO,CAAC;QACnC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACpB,CAAC;IAEO,MAAM,CAAC,IAAY;QACzB,MAAM,KAAK,GAAI,IAAI,CAAC,KAAK,CAAC,KAAgB,IAAI,EAAE,CAAC;QACjD,MAAM,OAAO,GAAI,IAAI,CAAC,KAAK,CAAC,OAA8B,IAAI,QAAQ,CAAC;QACvE,IAAI,CAAC,GAAG,CAAC,SAAS;YAChB,OAAO,KAAK,OAAO;gBACjB,CAAC,CAAC,8CAA8C;gBAChD,CAAC,CAAC,oBAAoB,CAAC;QAC3B,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC;QAC1C,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,mBAAmB,EAAE,OAAO,CAAC,CAAC;QACpD,IAAI,CAAC,GAAG,CAAC,KAAK,GAAG,KAAK,CAAC;QACvB,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YAClB,IAAI,CAAC;gBACH,uEAAuE;gBACvE,IAAI,CAAC,GAAG,CAAC,SAAS,GAAG,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;gBACnD,OAAO;YACT,CAAC;YAAC,MAAM,CAAC;gBACP,iDAAiD;YACnD,CAAC;QACH,CAAC;QACD,IAAI,CAAC,GAAG,CAAC,WAAW,GAAG,KAAK,CAAC;IAC/B,CAAC;IAED,MAAM,CAAC,IAAY;QACjB,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,KAAK,MAAM;YAAE,OAAO,KAAK,CAAC;QAC5C,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAClB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,0EAA0E;IAC1E,cAAc;QACZ,OAAO,IAAI,CAAC;IACd,CAAC;CACF","sourcesContent":["import { Node as PMNode } from 'prosemirror-model';\nimport { NodeView } from 'prosemirror-view';\n\n/** Turns a LaTeX string into HTML (KaTeX/MathJax/MathML). Host-provided. */\nexport type MathRenderer = (latex: string, display: 'inline' | 'block') => string;\n\n/**\n * Inline atom rendering a math formula. When the host supplies a renderer the\n * formula is drawn with it; otherwise the raw LaTeX is shown in a math chip so\n * the content is still visible and editable without a math engine.\n */\nexport class MathView implements NodeView {\n dom: HTMLSpanElement;\n\n private renderer?: MathRenderer;\n\n constructor(node: PMNode, renderer?: MathRenderer) {\n this.renderer = renderer;\n this.dom = document.createElement('span');\n this.dom.contentEditable = 'false';\n this.render(node);\n }\n\n private render(node: PMNode): void {\n const latex = (node.attrs.latex as string) ?? '';\n const display = (node.attrs.display as 'inline' | 'block') ?? 'inline';\n this.dom.className =\n display === 'block'\n ? 'nile-wysiwyg__math nile-wysiwyg__math--block'\n : 'nile-wysiwyg__math';\n this.dom.setAttribute('data-math', latex);\n this.dom.setAttribute('data-math-display', display);\n this.dom.title = latex;\n if (this.renderer) {\n try {\n // Host renderer output is trusted (same trust level as uploadHandler).\n this.dom.innerHTML = this.renderer(latex, display);\n return;\n } catch {\n // Fall back to raw LaTeX if the renderer throws.\n }\n }\n this.dom.textContent = latex;\n }\n\n update(node: PMNode): boolean {\n if (node.type.name !== 'math') return false;\n this.render(node);\n return true;\n }\n\n /** Atom node: ProseMirror owns selection; never read our subtree back. */\n ignoreMutation(): boolean {\n return true;\n }\n}\n"]}
1
+ {"version":3,"file":"math-view.js","sourceRoot":"","sources":["../../../../../src/nile-wysiwyg-editor/engine/plugins/math-view.ts"],"names":[],"mappings":"AAMA;;;GAGG;AACH,IAAI,YAAY,GACd,IAAI,CAAC;AACP,SAAS,SAAS;IAChB,IAAI,CAAC,YAAY,EAAE,CAAC;QAClB,YAAY,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;IACtD,CAAC;IACD,OAAO,YAAY,CAAC;AACtB,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,OAAO,QAAQ;IAQnB,YAAY,IAAY,EAAE,QAAuB;QAHjD,sFAAsF;QAC9E,UAAK,GAAG,CAAC,CAAC;QAGhB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,GAAG,GAAG,QAAQ,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;QAC1C,IAAI,CAAC,GAAG,CAAC,eAAe,GAAG,OAAO,CAAC;QACnC,IAAI,CAAC,MAAM,CAAC,IAAI,C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,CAAC,CAAC;YACL,CAAC;YAAC,MAAM,CAAC;gBACP,IAAI,CAAC,GAAG,CAAC,WAAW,GAAG,KAAK,CAAC;YAC/B,CAAC;QACH,CAAC,CAAC;aACD,KAAK,CAAC,GAAG,EAAE;YACV,2DAA2D;QAC7D,CAAC,CAAC,CAAC;IACP,CAAC;IAED,MAAM,CAAC,IAAY;QACjB,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,KAAK,MAAM;YAAE,OAAO,KAAK,CAAC;QAC5C,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAClB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,0EAA0E;IAC1E,cAAc;QACZ,OAAO,IAAI,CAAC;IACd,CAAC;CACF","sourcesContent":["import { Node as PMNode } from 'prosemirror-model';\nimport { NodeView } from 'prosemirror-view';\n\n/** Turns a LaTeX string into HTML (KaTeX/MathJax/MathML). Host-provided. */\nexport type MathRenderer = (latex: string, display: 'inline' | 'block') => string;\n\n/**\n * Lazy-loaded KaTeX module (loaded once, only when the first formula renders,\n * so editors without math pay nothing). Resolves to the katex default export.\n */\nlet katexPromise: Promise<{ renderToString(tex: string, opts?: Record<string, unknown>): string }> | null =\n null;\nfunction loadKatex() {\n if (!katexPromise) {\n katexPromise = import('katex').then(m => m.default);\n }\n return katexPromise;\n}\n\n/**\n * Inline atom rendering a math formula. Precedence:\n * 1. A host-supplied `mathRenderer` (full control — e.g. KaTeX HTML, MathJax).\n * 2. The built-in default: KaTeX compiled to **MathML**, which browsers render\n * natively with no stylesheet or web fonts (works cleanly inside the\n * editor's shadow root).\n * 3. If KaTeX can't load / parse, the raw LaTeX stays visible.\n */\nexport class MathView implements NodeView {\n dom: HTMLSpanElement;\n\n private renderer?: MathRenderer;\n\n /** Bumps on every render so a slow async KaTeX result for a stale node is dropped. */\n private token = 0;\n\n constructor(node: PMNode, renderer?: MathRenderer) {\n this.renderer = renderer;\n this.dom = document.createElement('span');\n this.dom.contentEditable = 'false';\n this.render(node);\n }\n\n private render(node: PMNode): void {\n const latex = (node.attrs.latex as string) ?? '';\n const display = (node.attrs.display as 'inline' | 'block') ?? 'inline';\n this.dom.className =\n display === 'block'\n ? 'nile-wysiwyg__math nile-wysiwyg__math--block'\n : 'nile-wysiwyg__math';\n this.dom.setAttribute('data-math', latex);\n this.dom.setAttribute('data-math-display', display);\n this.dom.title = latex;\n\n const token = ++this.token;\n\n // 1. Host renderer wins.\n if (this.renderer) {\n try {\n // Host renderer output is trusted (same trust level as uploadHandler).\n this.dom.innerHTML = this.renderer(latex, display);\n return;\n } catch {\n // Fall through to the built-in renderer.\n }\n }\n\n // 2. Built-in KaTeX → MathML. Show raw LaTeX until the (lazy) engine loads.\n this.dom.textContent = latex;\n loadKatex()\n .then(katex => {\n if (token !== this.token) return; // node changed while loading\n try {\n this.dom.innerHTML = katex.renderToString(latex, {\n output: 'mathml',\n displayMode: display === 'block',\n throwOnError: false,\n });\n } catch {\n this.dom.textContent = latex;\n }\n })\n .catch(() => {\n /* KaTeX unavailable — keep the raw LaTeX already shown. */\n });\n }\n\n update(node: PMNode): boolean {\n if (node.type.name !== 'math') return false;\n this.render(node);\n return true;\n }\n\n /** Atom node: ProseMirror owns selection; never read our subtree back. */\n ignoreMutation(): boolean {\n return true;\n }\n}\n"]}
@@ -0,0 +1,17 @@
1
+ import { Node as PMNode } from 'prosemirror-model';
2
+ import { NodeView } from 'prosemirror-view';
3
+ /**
4
+ * Node view for an author `<style>` block. It injects the CSS live — scoped to
5
+ * the content root — so the styles apply to the document as authored, with no
6
+ * visible chip. The block itself renders nothing (a hidden `<style>` host); it
7
+ * round-trips to `<style>` in the output via the schema's toDOM, and the same
8
+ * raw CSS is what the HTML-source preview renders.
9
+ */
10
+ export declare class StyleBlockView implements NodeView {
11
+ private node;
12
+ dom: HTMLElement;
13
+ private styleEl;
14
+ constructor(node: PMNode);
15
+ update(node: PMNode): boolean;
16
+ ignoreMutation(): boolean;
17
+ }