@aquera/nile-elements 1.9.7 → 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 (244) hide show
  1. package/README.md +6 -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 +1587 -1276
  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-select/virtual-scroll-helper.cjs.js +1 -1
  17. package/dist/nile-select/virtual-scroll-helper.cjs.js.map +1 -1
  18. package/dist/nile-select/virtual-scroll-helper.esm.js +52 -44
  19. package/dist/nile-virtual-select/renderer.cjs.js +1 -1
  20. package/dist/nile-virtual-select/renderer.cjs.js.map +1 -1
  21. package/dist/nile-virtual-select/renderer.esm.js +23 -22
  22. package/dist/nile-wysiwyg-editor/engine/commands.cjs.js +1 -1
  23. package/dist/nile-wysiwyg-editor/engine/commands.cjs.js.map +1 -1
  24. package/dist/nile-wysiwyg-editor/engine/commands.esm.js +1 -1
  25. package/dist/nile-wysiwyg-editor/engine/create-state.cjs.js +1 -1
  26. package/dist/nile-wysiwyg-editor/engine/create-state.cjs.js.map +1 -1
  27. package/dist/nile-wysiwyg-editor/engine/create-state.esm.js +1 -1
  28. package/dist/nile-wysiwyg-editor/engine/index.cjs.js +1 -1
  29. package/dist/nile-wysiwyg-editor/engine/index.esm.js +1 -1
  30. package/dist/nile-wysiwyg-editor/engine/inputrules.cjs.js +1 -1
  31. package/dist/nile-wysiwyg-editor/engine/keymap.cjs.js +1 -1
  32. package/dist/nile-wysiwyg-editor/engine/keymap.esm.js +1 -1
  33. package/dist/nile-wysiwyg-editor/engine/plugins/code-highlight.cjs.js +1 -1
  34. package/dist/nile-wysiwyg-editor/engine/plugins/code-highlight.cjs.js.map +1 -1
  35. package/dist/nile-wysiwyg-editor/engine/plugins/code-highlight.esm.js +1 -1
  36. package/dist/nile-wysiwyg-editor/engine/plugins/embed-view.cjs.js +1 -1
  37. package/dist/nile-wysiwyg-editor/engine/plugins/embed-view.cjs.js.map +1 -1
  38. package/dist/nile-wysiwyg-editor/engine/plugins/embed-view.esm.js +1 -1
  39. package/dist/nile-wysiwyg-editor/engine/plugins/embeds.cjs.js +1 -1
  40. package/dist/nile-wysiwyg-editor/engine/plugins/embeds.cjs.js.map +1 -1
  41. package/dist/nile-wysiwyg-editor/engine/plugins/embeds.esm.js +1 -1
  42. package/dist/nile-wysiwyg-editor/engine/plugins/math-view.cjs.js +1 -1
  43. package/dist/nile-wysiwyg-editor/engine/plugins/math-view.cjs.js.map +1 -1
  44. package/dist/nile-wysiwyg-editor/engine/plugins/math-view.esm.js +1 -1
  45. package/dist/nile-wysiwyg-editor/engine/plugins/style-block-view.cjs.js +2 -0
  46. package/dist/nile-wysiwyg-editor/engine/plugins/style-block-view.cjs.js.map +1 -0
  47. package/dist/nile-wysiwyg-editor/engine/plugins/style-block-view.esm.js +1 -0
  48. package/dist/nile-wysiwyg-editor/engine/plugins/tables.cjs.js +1 -1
  49. package/dist/nile-wysiwyg-editor/engine/plugins/tables.cjs.js.map +1 -1
  50. package/dist/nile-wysiwyg-editor/engine/plugins/tables.esm.js +1 -1
  51. package/dist/nile-wysiwyg-editor/engine/sanitize.cjs.js +1 -1
  52. package/dist/nile-wysiwyg-editor/engine/sanitize.cjs.js.map +1 -1
  53. package/dist/nile-wysiwyg-editor/engine/sanitize.esm.js +1 -1
  54. package/dist/nile-wysiwyg-editor/engine/schema.cjs.js +1 -1
  55. package/dist/nile-wysiwyg-editor/engine/schema.cjs.js.map +1 -1
  56. package/dist/nile-wysiwyg-editor/engine/schema.esm.js +1 -1
  57. package/dist/nile-wysiwyg-editor/engine/selection-state.cjs.js +1 -1
  58. package/dist/nile-wysiwyg-editor/engine/selection-state.cjs.js.map +1 -1
  59. package/dist/nile-wysiwyg-editor/engine/selection-state.esm.js +1 -1
  60. package/dist/nile-wysiwyg-editor/index.cjs.js +1 -1
  61. package/dist/nile-wysiwyg-editor/index.esm.js +1 -1
  62. package/dist/nile-wysiwyg-editor/math/katex-renderer.cjs.js +2 -0
  63. package/dist/nile-wysiwyg-editor/math/katex-renderer.cjs.js.map +1 -0
  64. package/dist/nile-wysiwyg-editor/math/katex-renderer.esm.js +1 -0
  65. package/dist/nile-wysiwyg-editor/nile-wysiwyg-editor.cjs.js +1 -1
  66. package/dist/nile-wysiwyg-editor/nile-wysiwyg-editor.cjs.js.map +1 -1
  67. package/dist/nile-wysiwyg-editor/nile-wysiwyg-editor.css.cjs.js +1 -1
  68. package/dist/nile-wysiwyg-editor/nile-wysiwyg-editor.css.cjs.js.map +1 -1
  69. package/dist/nile-wysiwyg-editor/nile-wysiwyg-editor.css.esm.js +22 -3
  70. package/dist/nile-wysiwyg-editor/nile-wysiwyg-editor.esm.js +7 -6
  71. package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/index.cjs.js +1 -1
  72. package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/index.esm.js +1 -1
  73. package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar-item.cjs.js +2 -0
  74. package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar-item.cjs.js.map +1 -0
  75. package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar-item.esm.js +1 -0
  76. package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.cjs.js +1 -1
  77. package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.cjs.js.map +1 -1
  78. package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.css.cjs.js +1 -1
  79. package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.css.cjs.js.map +1 -1
  80. package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.css.esm.js +33 -54
  81. package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.esm.js +83 -95
  82. package/dist/nile-wysiwyg-editor/types.cjs.js +1 -1
  83. package/dist/nile-wysiwyg-editor/types.cjs.js.map +1 -1
  84. package/dist/nile-wysiwyg-editor/types.esm.js +1 -1
  85. package/dist/nile-wysiwyg-editor/ui/bubble-item.cjs.js +2 -0
  86. package/dist/nile-wysiwyg-editor/ui/bubble-item.cjs.js.map +1 -0
  87. package/dist/nile-wysiwyg-editor/ui/bubble-item.esm.js +1 -0
  88. package/dist/nile-wysiwyg-editor/ui/bubble-menu.cjs.js +1 -1
  89. package/dist/nile-wysiwyg-editor/ui/bubble-menu.cjs.js.map +1 -1
  90. package/dist/nile-wysiwyg-editor/ui/bubble-menu.esm.js +23 -15
  91. package/dist/nile-wysiwyg-editor/ui/code-block-menu.cjs.js +1 -1
  92. package/dist/nile-wysiwyg-editor/ui/code-block-menu.cjs.js.map +1 -1
  93. package/dist/nile-wysiwyg-editor/ui/code-block-menu.esm.js +3 -3
  94. package/dist/nile-wysiwyg-editor/ui/embed-panel.cjs.js +1 -1
  95. package/dist/nile-wysiwyg-editor/ui/embed-panel.cjs.js.map +1 -1
  96. package/dist/nile-wysiwyg-editor/ui/embed-panel.esm.js +2 -2
  97. package/dist/nile-wysiwyg-editor/ui/math-panel.cjs.js +1 -1
  98. package/dist/nile-wysiwyg-editor/ui/math-panel.cjs.js.map +1 -1
  99. package/dist/nile-wysiwyg-editor/ui/math-panel.esm.js +0 -3
  100. package/dist/nile-wysiwyg-editor/ui/preview.cjs.js +2 -0
  101. package/dist/nile-wysiwyg-editor/ui/preview.cjs.js.map +1 -0
  102. package/dist/nile-wysiwyg-editor/ui/preview.esm.js +8 -0
  103. package/dist/nile-wysiwyg-editor/ui/source-view.cjs.js +1 -1
  104. package/dist/nile-wysiwyg-editor/ui/source-view.cjs.js.map +1 -1
  105. package/dist/nile-wysiwyg-editor/ui/source-view.esm.js +225 -24
  106. package/dist/nile-wysiwyg-editor/ui/suggest-list.cjs.js +1 -1
  107. package/dist/nile-wysiwyg-editor/ui/suggest-list.cjs.js.map +1 -1
  108. package/dist/nile-wysiwyg-editor/ui/suggest-list.esm.js +9 -9
  109. package/dist/nile-wysiwyg-editor/ui/table-grid-picker.cjs.js +1 -1
  110. package/dist/nile-wysiwyg-editor/ui/table-grid-picker.cjs.js.map +1 -1
  111. package/dist/nile-wysiwyg-editor/ui/table-grid-picker.esm.js +115 -13
  112. package/dist/nile-wysiwyg-editor/ui/table-menu.cjs.js +1 -1
  113. package/dist/nile-wysiwyg-editor/ui/table-menu.cjs.js.map +1 -1
  114. package/dist/nile-wysiwyg-editor/ui/table-menu.esm.js +13 -12
  115. package/dist/src/index.d.ts +5 -0
  116. package/dist/src/index.js +3 -0
  117. package/dist/src/index.js.map +1 -1
  118. package/dist/src/nile-color-picker/nile-color-picker.d.ts +1 -0
  119. package/dist/src/nile-color-picker/nile-color-picker.js +1 -0
  120. package/dist/src/nile-color-picker/nile-color-picker.js.map +1 -1
  121. package/dist/src/nile-select/virtual-scroll-helper.js +9 -1
  122. package/dist/src/nile-select/virtual-scroll-helper.js.map +1 -1
  123. package/dist/src/nile-virtual-select/renderer.js +1 -0
  124. package/dist/src/nile-virtual-select/renderer.js.map +1 -1
  125. package/dist/src/nile-wysiwyg-editor/engine/index.d.ts +1 -0
  126. package/dist/src/nile-wysiwyg-editor/engine/index.js +1 -0
  127. package/dist/src/nile-wysiwyg-editor/engine/index.js.map +1 -1
  128. package/dist/src/nile-wysiwyg-editor/engine/plugins/embed-view.js +3 -0
  129. package/dist/src/nile-wysiwyg-editor/engine/plugins/embed-view.js.map +1 -1
  130. package/dist/src/nile-wysiwyg-editor/engine/plugins/embeds.d.ts +19 -4
  131. package/dist/src/nile-wysiwyg-editor/engine/plugins/embeds.js +23 -18
  132. package/dist/src/nile-wysiwyg-editor/engine/plugins/embeds.js.map +1 -1
  133. package/dist/src/nile-wysiwyg-editor/engine/plugins/math-view.d.ts +8 -3
  134. package/dist/src/nile-wysiwyg-editor/engine/plugins/math-view.js +41 -4
  135. package/dist/src/nile-wysiwyg-editor/engine/plugins/math-view.js.map +1 -1
  136. package/dist/src/nile-wysiwyg-editor/engine/plugins/style-block-view.d.ts +17 -0
  137. package/dist/src/nile-wysiwyg-editor/engine/plugins/style-block-view.js +174 -0
  138. package/dist/src/nile-wysiwyg-editor/engine/plugins/style-block-view.js.map +1 -0
  139. package/dist/src/nile-wysiwyg-editor/engine/plugins/tables.js +33 -2
  140. package/dist/src/nile-wysiwyg-editor/engine/plugins/tables.js.map +1 -1
  141. package/dist/src/nile-wysiwyg-editor/engine/pm.test.js +49 -8
  142. package/dist/src/nile-wysiwyg-editor/engine/pm.test.js.map +1 -1
  143. package/dist/src/nile-wysiwyg-editor/engine/sanitize.d.ts +12 -0
  144. package/dist/src/nile-wysiwyg-editor/engine/sanitize.js +76 -8
  145. package/dist/src/nile-wysiwyg-editor/engine/sanitize.js.map +1 -1
  146. package/dist/src/nile-wysiwyg-editor/engine/schema.d.ts +2 -0
  147. package/dist/src/nile-wysiwyg-editor/engine/schema.js +154 -2
  148. package/dist/src/nile-wysiwyg-editor/engine/schema.js.map +1 -1
  149. package/dist/src/nile-wysiwyg-editor/index.d.ts +5 -0
  150. package/dist/src/nile-wysiwyg-editor/index.js +3 -0
  151. package/dist/src/nile-wysiwyg-editor/index.js.map +1 -1
  152. package/dist/src/nile-wysiwyg-editor/math/katex-renderer.d.ts +38 -0
  153. package/dist/src/nile-wysiwyg-editor/math/katex-renderer.js +40 -0
  154. package/dist/src/nile-wysiwyg-editor/math/katex-renderer.js.map +1 -0
  155. package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor.css.js +22 -3
  156. package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor.css.js.map +1 -1
  157. package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor.d.ts +36 -0
  158. package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor.js +125 -8
  159. package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor.js.map +1 -1
  160. package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor.test.js +5 -2
  161. package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor.test.js.map +1 -1
  162. package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/index.d.ts +2 -0
  163. package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/index.js +1 -0
  164. package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/index.js.map +1 -1
  165. package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar-item.d.ts +55 -0
  166. package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar-item.js +79 -0
  167. package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar-item.js.map +1 -0
  168. package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.css.js +33 -54
  169. package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.css.js.map +1 -1
  170. package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.d.ts +50 -2
  171. package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.js +158 -102
  172. package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.js.map +1 -1
  173. package/dist/src/nile-wysiwyg-editor/types.d.ts +4 -2
  174. package/dist/src/nile-wysiwyg-editor/types.js +2 -2
  175. package/dist/src/nile-wysiwyg-editor/types.js.map +1 -1
  176. package/dist/src/nile-wysiwyg-editor/ui/bubble-item.d.ts +48 -0
  177. package/dist/src/nile-wysiwyg-editor/ui/bubble-item.js +69 -0
  178. package/dist/src/nile-wysiwyg-editor/ui/bubble-item.js.map +1 -0
  179. package/dist/src/nile-wysiwyg-editor/ui/bubble-menu.d.ts +17 -2
  180. package/dist/src/nile-wysiwyg-editor/ui/bubble-menu.js +128 -35
  181. package/dist/src/nile-wysiwyg-editor/ui/bubble-menu.js.map +1 -1
  182. package/dist/src/nile-wysiwyg-editor/ui/embed-panel.d.ts +2 -1
  183. package/dist/src/nile-wysiwyg-editor/ui/embed-panel.js +4 -3
  184. package/dist/src/nile-wysiwyg-editor/ui/embed-panel.js.map +1 -1
  185. package/dist/src/nile-wysiwyg-editor/ui/math-panel.js +0 -3
  186. package/dist/src/nile-wysiwyg-editor/ui/math-panel.js.map +1 -1
  187. package/dist/src/nile-wysiwyg-editor/ui/preview.d.ts +20 -0
  188. package/dist/src/nile-wysiwyg-editor/ui/preview.js +44 -0
  189. package/dist/src/nile-wysiwyg-editor/ui/preview.js.map +1 -0
  190. package/dist/src/nile-wysiwyg-editor/ui/source-view.d.ts +35 -3
  191. package/dist/src/nile-wysiwyg-editor/ui/source-view.js +337 -24
  192. package/dist/src/nile-wysiwyg-editor/ui/source-view.js.map +1 -1
  193. package/dist/src/nile-wysiwyg-editor/ui/suggest-list.d.ts +1 -0
  194. package/dist/src/nile-wysiwyg-editor/ui/suggest-list.js +9 -0
  195. package/dist/src/nile-wysiwyg-editor/ui/suggest-list.js.map +1 -1
  196. package/dist/src/nile-wysiwyg-editor/ui/table-grid-picker.d.ts +13 -2
  197. package/dist/src/nile-wysiwyg-editor/ui/table-grid-picker.js +166 -10
  198. package/dist/src/nile-wysiwyg-editor/ui/table-grid-picker.js.map +1 -1
  199. package/dist/src/nile-wysiwyg-editor/ui/table-menu.d.ts +1 -0
  200. package/dist/src/nile-wysiwyg-editor/ui/table-menu.js +10 -8
  201. package/dist/src/nile-wysiwyg-editor/ui/table-menu.js.map +1 -1
  202. package/dist/src/version.js +1 -1
  203. package/dist/src/version.js.map +1 -1
  204. package/dist/tsconfig.tsbuildinfo +1 -1
  205. package/dist/xml-25c4108a.esm.js +1 -0
  206. package/dist/xml-90fd974e.cjs.js +2 -0
  207. package/dist/xml-90fd974e.cjs.js.map +1 -0
  208. package/package.json +2 -1
  209. package/rollup.config.js +1 -0
  210. package/src/index.ts +8 -0
  211. package/src/nile-color-picker/nile-color-picker.ts +1 -0
  212. package/src/nile-select/virtual-scroll-helper.ts +9 -1
  213. package/src/nile-virtual-select/renderer.ts +1 -1
  214. package/src/nile-wysiwyg-editor/engine/index.ts +1 -0
  215. package/src/nile-wysiwyg-editor/engine/plugins/embed-view.ts +3 -0
  216. package/src/nile-wysiwyg-editor/engine/plugins/embeds.ts +26 -20
  217. package/src/nile-wysiwyg-editor/engine/plugins/math-view.ts +45 -4
  218. package/src/nile-wysiwyg-editor/engine/plugins/style-block-view.ts +178 -0
  219. package/src/nile-wysiwyg-editor/engine/plugins/tables.ts +34 -2
  220. package/src/nile-wysiwyg-editor/engine/pm.test.ts +58 -8
  221. package/src/nile-wysiwyg-editor/engine/sanitize.ts +71 -8
  222. package/src/nile-wysiwyg-editor/engine/schema.ts +158 -7
  223. package/src/nile-wysiwyg-editor/index.ts +5 -0
  224. package/src/nile-wysiwyg-editor/math/katex-renderer.ts +59 -0
  225. package/src/nile-wysiwyg-editor/math/katex.d.ts +17 -0
  226. package/src/nile-wysiwyg-editor/nile-wysiwyg-editor.css.ts +22 -3
  227. package/src/nile-wysiwyg-editor/nile-wysiwyg-editor.test.ts +5 -2
  228. package/src/nile-wysiwyg-editor/nile-wysiwyg-editor.ts +142 -7
  229. package/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/index.ts +2 -0
  230. package/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar-item.ts +68 -0
  231. package/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.css.ts +33 -54
  232. package/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.ts +202 -108
  233. package/src/nile-wysiwyg-editor/types.ts +6 -4
  234. package/src/nile-wysiwyg-editor/ui/bubble-item.ts +60 -0
  235. package/src/nile-wysiwyg-editor/ui/bubble-menu.ts +147 -40
  236. package/src/nile-wysiwyg-editor/ui/embed-panel.ts +4 -3
  237. package/src/nile-wysiwyg-editor/ui/math-panel.ts +0 -3
  238. package/src/nile-wysiwyg-editor/ui/preview.ts +42 -0
  239. package/src/nile-wysiwyg-editor/ui/source-view.ts +339 -31
  240. package/src/nile-wysiwyg-editor/ui/suggest-list.ts +10 -0
  241. package/src/nile-wysiwyg-editor/ui/table-grid-picker.ts +160 -10
  242. package/src/nile-wysiwyg-editor/ui/table-menu.ts +10 -8
  243. package/vscode-html-custom-data.json +75 -6
  244. package/dist/index-df196058.cjs.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"nile-wysiwyg-toolbar.css.js","sourceRoot":"","sources":["../../../../src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.css.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B;;;;GAIG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmPxB,CAAC","sourcesContent":["import { css } from 'lit';\n\n/**\n * Toolbar styled to match nile-rich-text-editor: white toolbar, 32×32\n * borderless buttons, dropdown-button selects with menu panels,\n * swatch-palette color pickers, 24px dividers.\n */\nexport const styles = css`\n :host {\n display: block;\n font-family: var(\n --nile-font-family-sans-serif,\n var(--ng-font-family-body, system-ui, -apple-system, sans-serif)\n );\n }\n\n .toolbar {\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n gap: 6px;\n padding: 8px;\n border-bottom: 1px solid\n var(--nile-colors-neutral-400, var(--ng-colors-border-neutral, #d0d5dd));\n background: var(--nile-colors-white-base, var(--ng-colors-bg-primary, #ffffff));\n border-radius: 8px 8px 0 0;\n box-sizing: border-box;\n }\n\n .toolbar__divider {\n width: 1px;\n height: 24px;\n margin: 0 4px;\n background: var(--nile-colors-neutral-400, var(--ng-colors-border-neutral, #d0d5dd));\n }\n\n button.toolbar__button {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 32px;\n height: 32px;\n padding: 0 6px;\n box-sizing: border-box;\n border: none;\n background: transparent;\n border-radius: var(--nile-radius-radius-lg, var(--ng-radius-md, 8px));\n cursor: pointer;\n color: var(--nile-colors-dark-900, var(--ng-colors-text-primary-900, #101828));\n font-family: inherit;\n font-size: 14px;\n font-weight: 600;\n }\n\n button.toolbar__button:hover:not(:disabled) {\n background: var(--nile-colors-neutral-100, var(--ng-colors-bg-secondary, #f2f4f7));\n }\n\n button.toolbar__button[data-active] {\n background: var(--nile-colors-primary-50, var(--ng-componentcolors-utility-blue-50, #eff4ff));\n }\n\n button.toolbar__button:disabled {\n opacity: 0.4;\n cursor: not-allowed;\n }\n\n /* --- Dropdown selects (heading / font / size), nile-rte-select style --- */\n .toolbar__dropdown {\n position: relative;\n display: inline-flex;\n }\n\n button.toolbar__dd-trigger {\n display: inline-flex;\n align-items: center;\n gap: 4px;\n min-width: 32px;\n height: 32px;\n padding: 0 6px 0 10px;\n box-sizing: border-box;\n border: none;\n background: transparent;\n border-radius: var(--nile-radius-radius-lg, var(--ng-radius-md, 8px));\n cursor: pointer;\n color: var(--nile-colors-dark-900, var(--ng-colors-text-primary-900, #101828));\n font-family: inherit;\n font-size: 13px;\n white-space: nowrap;\n }\n\n button.toolbar__dd-trigger:hover:not(:disabled) {\n background: var(--nile-colors-neutral-100, var(--ng-colors-bg-secondary, #f2f4f7));\n }\n\n button.toolbar__dd-trigger:disabled {\n opacity: 0.4;\n cursor: not-allowed;\n }\n\n .toolbar__dd-menu {\n position: absolute;\n top: calc(100% + 4px);\n left: 0;\n z-index: 30;\n min-width: 140px;\n max-height: 260px;\n overflow-y: auto;\n padding: 4px;\n background: var(--nile-colors-white-base, var(--ng-colors-bg-primary, #ffffff));\n border: 1px solid\n var(--nile-colors-neutral-300, var(--ng-colors-border-secondary, #e4e7ec));\n border-radius: 8px;\n box-shadow: 0 4px 12px rgba(16, 24, 40, 0.12);\n box-sizing: border-box;\n }\n\n .toolbar__dd-item {\n display: flex;\n align-items: center;\n padding: 6px 10px;\n border-radius: 6px;\n cursor: pointer;\n font-size: 13px;\n color: var(--nile-colors-dark-900, var(--ng-colors-text-primary-900, #101828));\n white-space: nowrap;\n }\n\n .toolbar__dd-item:hover {\n background: var(--nile-colors-neutral-100, var(--ng-colors-bg-secondary, #f2f4f7));\n }\n\n .toolbar__dd-item[data-active] {\n background: var(\n --nile-colors-primary-50,\n var(--ng-componentcolors-utility-blue-50, #eff4ff)\n );\n color: var(--nile-colors-primary-700, #1d4ed8);\n }\n\n /* --- Color pickers, nile-rte-color style --- */\n .toolbar__color {\n position: relative;\n display: inline-flex;\n }\n\n .toolbar__color .glyph-stack {\n display: grid;\n align-items: center;\n justify-items: center;\n line-height: 1;\n pointer-events: none;\n }\n\n .toolbar__color .glyph {\n font-size: 14px;\n margin-bottom: 2px;\n font-weight: 400;\n }\n\n .toolbar__color .underline {\n width: 18px;\n height: 3px;\n border-radius: 2px;\n }\n\n .toolbar__color .swatch-box {\n width: 18px;\n height: 16px;\n border-radius: 4px;\n border: 1px solid rgba(0, 0, 0, 0.35);\n pointer-events: none;\n box-sizing: border-box;\n }\n\n .toolbar__swatch-panel {\n position: absolute;\n top: calc(100% + 6px);\n left: 0;\n z-index: 30;\n width: 235px;\n padding: 12px;\n background: var(--nile-colors-white-base, #ffffff);\n border: 1px solid\n var(--nile-colors-neutral-300, var(--ng-colors-border-secondary, #e4e7ec));\n border-radius: 8px;\n box-shadow: 0 4px 12px rgba(16, 24, 40, 0.12);\n box-sizing: border-box;\n }\n\n .toolbar__swatch-panel .title {\n font-size: 13px;\n font-weight: 600;\n margin-bottom: 8px;\n color: var(--nile-colors-dark-900, #111);\n }\n\n .toolbar__swatch-panel .section {\n margin-bottom: 12px;\n }\n\n .toolbar__swatch-panel .section:last-child {\n margin-bottom: 0;\n }\n\n .toolbar__swatch-panel .swatches {\n display: grid;\n grid-template-columns: repeat(auto-fill, 24px);\n gap: 8px;\n }\n\n .toolbar__swatch-panel .swatch {\n width: 24px;\n height: 24px;\n border-radius: 50%;\n border: 1px solid rgba(0, 0, 0, 0.25);\n cursor: pointer;\n position: relative;\n padding: 0;\n background-clip: content-box;\n }\n\n .toolbar__swatch-panel .swatch .checkmark {\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n font-size: 13px;\n color: white;\n text-shadow: 0 0 2px rgba(0, 0, 0, 0.6);\n }\n\n .toolbar__swatch-panel .swatch.add {\n display: flex;\n align-items: center;\n justify-content: center;\n font-weight: bold;\n font-size: 16px;\n background: #fff;\n }\n\n .toolbar__color input[type='color'] {\n position: absolute;\n opacity: 0;\n pointer-events: none;\n width: 0;\n height: 0;\n border: 0;\n padding: 0;\n }\n`;\n"]}
1
+ {"version":3,"file":"nile-wysiwyg-toolbar.css.js","sourceRoot":"","sources":["../../../../src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.css.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B;;;;GAIG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8NxB,CAAC","sourcesContent":["import { css } from 'lit';\n\n/**\n * Toolbar styled to match nile-rich-text-editor: white toolbar, 32×32\n * borderless buttons, dropdown-button selects with menu panels,\n * swatch-palette color pickers, 24px dividers.\n */\nexport const styles = css`\n :host {\n display: block;\n font-family: var(\n --nile-font-family-sans-serif,\n var(--ng-font-family-body, system-ui, -apple-system, sans-serif)\n );\n }\n\n .toolbar {\n position: relative;\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n gap: 6px;\n padding: 8px;\n border-bottom: 1px solid\n var(--nile-colors-neutral-400, var(--ng-colors-border-neutral, #d0d5dd));\n background: var(--nile-colors-white-base, var(--ng-colors-bg-primary, #ffffff));\n border-radius: 8px 8px 0 0;\n box-sizing: border-box;\n }\n\n .toolbar__divider {\n width: 1px;\n height: 24px;\n margin: 0 4px;\n background: var(--nile-colors-neutral-400, var(--ng-colors-border-neutral, #d0d5dd));\n }\n\n button.toolbar__button {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 32px;\n height: 32px;\n padding: 0 6px;\n box-sizing: border-box;\n border: none;\n background: transparent;\n border-radius: var(--nile-radius-radius-lg, var(--ng-radius-md, 8px));\n cursor: pointer;\n color: var(--nile-colors-dark-900, var(--ng-colors-text-primary-900, #101828));\n font-family: inherit;\n font-size: 14px;\n font-weight: 600;\n }\n\n button.toolbar__button:hover:not(:disabled) {\n background: var(--nile-colors-neutral-100, var(--ng-colors-bg-secondary, #f2f4f7));\n }\n\n button.toolbar__button[data-active] {\n background: var(--nile-colors-primary-50, var(--ng-componentcolors-utility-blue-50, #eff4ff));\n }\n\n button.toolbar__button:disabled {\n opacity: 0.4;\n cursor: not-allowed;\n }\n\n /* --- Dropdown selects (heading / font / size), nile-rte-select style --- */\n .toolbar__dropdown {\n position: relative;\n display: inline-flex;\n }\n\n button.toolbar__dd-trigger {\n display: inline-flex;\n align-items: center;\n gap: 4px;\n min-width: 32px;\n height: 32px;\n padding: 0 6px 0 10px;\n box-sizing: border-box;\n border: none;\n background: transparent;\n border-radius: var(--nile-radius-radius-lg, var(--ng-radius-md, 8px));\n cursor: pointer;\n color: var(--nile-colors-dark-900, var(--ng-colors-text-primary-900, #101828));\n font-family: inherit;\n font-size: 13px;\n white-space: nowrap;\n }\n\n button.toolbar__dd-trigger:hover:not(:disabled) {\n background: var(--nile-colors-neutral-100, var(--ng-colors-bg-secondary, #f2f4f7));\n }\n\n button.toolbar__dd-trigger:disabled {\n opacity: 0.4;\n cursor: not-allowed;\n }\n\n .toolbar__dd-menu {\n position: absolute;\n top: calc(100% + 4px);\n left: 0;\n z-index: 30;\n min-width: 140px;\n max-height: 260px;\n overflow-y: auto;\n padding: 4px;\n background: var(--nile-colors-white-base, var(--ng-colors-bg-primary, #ffffff));\n border: 1px solid\n var(--nile-colors-neutral-300, var(--ng-colors-border-secondary, #e4e7ec));\n border-radius: 8px;\n box-shadow: 0 4px 12px rgba(16, 24, 40, 0.12);\n box-sizing: border-box;\n }\n\n .toolbar__dd-item {\n display: flex;\n align-items: center;\n padding: 6px 10px;\n border-radius: 6px;\n cursor: pointer;\n font-size: 13px;\n color: var(--nile-colors-dark-900, var(--ng-colors-text-primary-900, #101828));\n white-space: nowrap;\n }\n\n .toolbar__dd-item:hover {\n background: var(--nile-colors-neutral-100, var(--ng-colors-bg-secondary, #f2f4f7));\n }\n\n .toolbar__dd-item[data-active] {\n background: var(\n --nile-colors-primary-50,\n var(--ng-componentcolors-utility-blue-50, #eff4ff)\n );\n color: var(--nile-colors-primary-700, #1d4ed8);\n }\n\n /* --- Color pickers, nile-rte-color style --- */\n .toolbar__color {\n position: relative;\n display: inline-flex;\n }\n\n .toolbar__color .glyph-stack {\n display: grid;\n align-items: center;\n justify-items: center;\n line-height: 1;\n pointer-events: none;\n }\n\n .toolbar__color .glyph {\n font-size: 14px;\n margin-bottom: 2px;\n font-weight: 400;\n }\n\n .toolbar__color .underline {\n width: 18px;\n height: 3px;\n border-radius: 2px;\n }\n\n .toolbar__color .swatch-box {\n width: 18px;\n height: 16px;\n border-radius: 4px;\n border: 1px solid rgba(0, 0, 0, 0.35);\n pointer-events: none;\n box-sizing: border-box;\n }\n\n /* Floating panel that hosts the inline nile-color-picker. */\n .toolbar__color-panel {\n position: absolute;\n top: calc(100% + 6px);\n left: 0;\n z-index: 30;\n background: var(--nile-colors-white-base, #ffffff);\n border: 1px solid\n var(--nile-colors-neutral-300, var(--ng-colors-border-secondary, #e4e7ec));\n border-radius: 8px;\n box-shadow: 0 4px 12px rgba(16, 24, 40, 0.12);\n box-sizing: border-box;\n }\n\n /* --- Overflow (\"more\" / 3-dot) menu --- */\n /* The 3-dot button stays in its normal place in the toolbar flow. */\n .toolbar__overflow {\n position: relative;\n display: inline-flex;\n }\n\n /* Panel drops directly beneath the 3-dot button, aligned to its left edge and\n extending right, so it opens wherever the button sits. width:max-content\n sizes it to exactly its controls (rather than collapsing to the 32px\n button's shrink-to-fit width); the max-width cap wraps a full menu onto\n multiple rows instead of running off-screen. */\n .toolbar__overflow-panel {\n position: absolute;\n top: calc(100% + 6px);\n left: 0;\n right: auto;\n width: max-content;\n max-width: min(360px, calc(100vw - 32px));\n z-index: 31;\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n gap: 6px;\n padding: 8px;\n background: var(--nile-colors-white-base, var(--ng-colors-bg-primary, #ffffff));\n border: 1px solid\n var(--nile-colors-neutral-300, var(--ng-colors-border-secondary, #e4e7ec));\n border-radius: 8px;\n box-shadow: 0 4px 12px rgba(16, 24, 40, 0.12);\n box-sizing: border-box;\n }\n\n .toolbar__overflow-divider {\n width: 1px;\n height: 24px;\n margin: 0 4px;\n background: var(--nile-colors-neutral-400, var(--ng-colors-border-neutral, #d0d5dd));\n }\n`;\n"]}
@@ -2,6 +2,21 @@ import { TemplateResult, CSSResultArray } from 'lit';
2
2
  import NileElement from '../../internal/nile-element';
3
3
  import type { ToolbarState } from '../engine/selection-state';
4
4
  import '../ui/table-grid-picker';
5
+ import '../../nile-color-picker/nile-color-picker';
6
+ /**
7
+ * A single control in an author-supplied (light-DOM) toolbar. `name` is a
8
+ * built-in control key (the same names the `config` string accepts) or `'|'`
9
+ * for a group divider; `label`/`icon` optionally override the built-in
10
+ * tooltip/glyph. Produced by the editor from `<nile-wysiwyg-toolbar-item>`
11
+ * children.
12
+ */
13
+ export interface AuthoredToolbarItem {
14
+ name: string;
15
+ label?: string;
16
+ icon?: string;
17
+ /** When true, the control is placed in the 3-dot overflow menu. */
18
+ overflow?: boolean;
19
+ }
5
20
  /**
6
21
  * Config-driven toolbar. Renders from a single immutable ToolbarState
7
22
  * snapshot; every interaction is dispatched to the host as a
@@ -12,17 +27,35 @@ import '../ui/table-grid-picker';
12
27
  export declare class NileWysiwygToolbar extends NileElement {
13
28
  /** Space-separated item names; `|` inserts a divider. */
14
29
  config: string;
30
+ /**
31
+ * Structured item list authored in light DOM (from
32
+ * `<nile-wysiwyg-toolbar-item>` children). When set and non-empty it takes
33
+ * precedence over `config`, and each item may override the built-in
34
+ * label/icon.
35
+ */
36
+ items?: AuthoredToolbarItem[];
15
37
  disabled: boolean;
16
38
  toolbarState?: ToolbarState;
17
39
  /** Which dropdown/color panel is open (item name), if any. */
18
40
  private openMenu;
19
- /** Recently used colors per color command, like nile-rte-color. */
20
- private recentColors;
41
+ /** Whether the overflow ("more" / 3-dot) menu panel is open. */
42
+ private overflowOpen;
21
43
  static get styles(): CSSResultArray;
44
+ /**
45
+ * True when this instance is an author's declarative `<nile-wysiwyg-toolbar>`
46
+ * container sitting in an editor's light DOM (holding
47
+ * `<nile-wysiwyg-toolbar-item>` children). Such an instance renders nothing
48
+ * and wires up no listeners — the editor reads the items and renders the real
49
+ * toolbar in its own shadow DOM. The editor's internal instance lives inside
50
+ * a shadow root, so `closest` (which stops at shadow boundaries) never
51
+ * matches it; a standalone toolbar on a page has no editor ancestor either.
52
+ */
53
+ private get isAuthoringContainer();
22
54
  connectedCallback(): void;
23
55
  disconnectedCallback(): void;
24
56
  private handleOutsideClick;
25
57
  private toggleMenu;
58
+ private toggleOverflow;
26
59
  private dispatchCommand;
27
60
  /** Wraps a control in the design system's lightweight tooltip (same as
28
61
  * the legacy rich text editor's toolbar). */
@@ -32,6 +65,21 @@ export declare class NileWysiwygToolbar extends NileElement {
32
65
  private setColor;
33
66
  private renderColor;
34
67
  private renderItem;
68
+ /** Parses the `config` string into a flat token list, keeping the `|`
69
+ * (divider) and `>>` (overflow) markers as items. */
70
+ private itemsFromConfig;
71
+ /** Splits a flat item list into groups, breaking on `'|'` dividers. */
72
+ private groupItems;
73
+ /** Partitions the flat item list into the always-visible main groups and the
74
+ * overflow (3-dot menu) groups. Two forms are supported: a positional `>>`
75
+ * token in the `config` string (everything after it overflows), or a
76
+ * per-item `overflow` flag on authored items (each flagged item overflows,
77
+ * wherever it sits). Without either, everything stays on the main bar. */
78
+ private partitionGroups;
79
+ /** Renders the trailing 3-dot "more" button and its collapsible panel that
80
+ * hosts the overflow groups (everything after `>>` in the config). The panel
81
+ * drops directly beneath the button, wherever the button sits in the bar. */
82
+ private renderOverflow;
35
83
  render(): TemplateResult;
36
84
  }
37
85
  declare global {
@@ -6,6 +6,7 @@ import { renderGlyph } from '../../internal/glyph';
6
6
  import { styles } from './nile-wysiwyg-toolbar.css';
7
7
  import { DEFAULT_TOOLBAR } from '../types';
8
8
  import '../ui/table-grid-picker';
9
+ import '../../nile-color-picker/nile-color-picker';
9
10
  const FONT_FAMILIES = [
10
11
  'Arial',
11
12
  'Georgia',
@@ -16,12 +17,6 @@ const FONT_FAMILIES = [
16
17
  'Courier New',
17
18
  ];
18
19
  const FONT_SIZES = ['10px', '12px', '14px', '16px', '18px', '20px', '24px', '28px', '32px', '48px'];
19
- /** Same default palette as nile-rte-color. */
20
- const COLOR_PALETTE = [
21
- '#000000', '#444444', '#666666', '#999999', '#cccccc', '#eeeeee', '#ffffff',
22
- '#d32f2f', '#f44336', '#ff9800', '#ffeb3b', '#4caf50', '#2196f3', '#3f51b5', '#9c27b0',
23
- '#03a9f4', '#00bcd4', '#009688', '#8bc34a', '#cddc39', '#ffc107', '#ff5722',
24
- ];
25
20
  const ITEMS = {
26
21
  undo: {
27
22
  kind: 'button',
@@ -436,18 +431,38 @@ let NileWysiwygToolbar = class NileWysiwygToolbar extends NileElement {
436
431
  this.disabled = false;
437
432
  /** Which dropdown/color panel is open (item name), if any. */
438
433
  this.openMenu = null;
439
- /** Recently used colors per color command, like nile-rte-color. */
440
- this.recentColors = {};
434
+ /** Whether the overflow ("more" / 3-dot) menu panel is open. */
435
+ this.overflowOpen = false;
441
436
  this.handleOutsideClick = (event) => {
442
- if (this.openMenu && !event.composedPath().includes(this))
437
+ if ((this.openMenu || this.overflowOpen) && !event.composedPath().includes(this)) {
443
438
  this.openMenu = null;
439
+ this.overflowOpen = false;
440
+ }
441
+ };
442
+ this.toggleOverflow = () => {
443
+ this.overflowOpen = !this.overflowOpen;
444
+ this.openMenu = null;
444
445
  };
445
446
  }
446
447
  static get styles() {
447
448
  return [styles];
448
449
  }
450
+ /**
451
+ * True when this instance is an author's declarative `<nile-wysiwyg-toolbar>`
452
+ * container sitting in an editor's light DOM (holding
453
+ * `<nile-wysiwyg-toolbar-item>` children). Such an instance renders nothing
454
+ * and wires up no listeners — the editor reads the items and renders the real
455
+ * toolbar in its own shadow DOM. The editor's internal instance lives inside
456
+ * a shadow root, so `closest` (which stops at shadow boundaries) never
457
+ * matches it; a standalone toolbar on a page has no editor ancestor either.
458
+ */
459
+ get isAuthoringContainer() {
460
+ return !!this.closest('nile-wysiwyg-editor');
461
+ }
449
462
  connectedCallback() {
450
463
  super.connectedCallback();
464
+ if (this.isAuthoringContainer)
465
+ return;
451
466
  document.addEventListener('mousedown', this.handleOutsideClick);
452
467
  }
453
468
  disconnectedCallback() {
@@ -458,26 +473,32 @@ let NileWysiwygToolbar = class NileWysiwygToolbar extends NileElement {
458
473
  this.openMenu = this.openMenu === name ? null : name;
459
474
  }
460
475
  dispatchCommand(name, attrs) {
476
+ // A dispatched command means the user picked an action, so collapse the
477
+ // overflow "more" panel (a select/color trigger only opens a submenu — it
478
+ // doesn't dispatch — so it leaves the panel open until a value is chosen).
479
+ this.overflowOpen = false;
461
480
  this.emit('wysiwyg-command', { name, attrs });
462
481
  }
463
482
  /** Wraps a control in the design system's lightweight tooltip (same as
464
483
  * the legacy rich text editor's toolbar). */
465
484
  withTooltip(label, control) {
466
485
  return html `
467
- <nile-lite-tooltip content=${label} placement="bottom">${control}</nile-lite-tooltip>
486
+ <nile-lite-tooltip content=${label} placement="top">${control}</nile-lite-tooltip>
468
487
  `;
469
488
  }
470
- renderButton(def) {
489
+ renderButton(def, overrides) {
471
490
  const state = this.toolbarState;
472
491
  const isActive = state && def.active ? def.active(state) : false;
473
492
  const isDisabled = this.disabled || (state && def.disabled ? def.disabled(state) : false);
474
- const icon = isActive && def.iconActive ? def.iconActive : def.icon;
475
- return this.withTooltip(def.label, html `
493
+ const label = overrides?.label ?? def.label;
494
+ const baseIcon = overrides?.icon ?? def.icon;
495
+ const icon = isActive && def.iconActive ? def.iconActive : baseIcon;
496
+ return this.withTooltip(label, html `
476
497
  <button
477
498
  type="button"
478
499
  class="toolbar__button"
479
500
  part="button"
480
- aria-label=${def.label}
501
+ aria-label=${label}
481
502
  aria-pressed=${isActive ? 'true' : 'false'}
482
503
  ?data-active=${isActive}
483
504
  ?disabled=${isDisabled}
@@ -488,20 +509,21 @@ let NileWysiwygToolbar = class NileWysiwygToolbar extends NileElement {
488
509
  </button>
489
510
  `);
490
511
  }
491
- renderSelect(name, def) {
512
+ renderSelect(name, def, overrides) {
492
513
  const value = this.toolbarState ? def.value(this.toolbarState) : '';
493
514
  const options = typeof def.options === 'function' ? def.options(this.toolbarState) : def.options;
494
515
  const current = options.find(opt => opt.value === value) ?? options[0];
495
516
  const isDisabled = this.disabled ||
496
517
  (this.toolbarState && def.disabled ? def.disabled(this.toolbarState) : false);
497
518
  const isFont = name === 'fontFamily';
519
+ const label = overrides?.label ?? def.label;
498
520
  return html `
499
521
  <span class="toolbar__dropdown" part="select">
500
- ${this.withTooltip(def.label, html `
522
+ ${this.withTooltip(label, html `
501
523
  <button
502
524
  type="button"
503
525
  class="toolbar__dd-trigger"
504
- aria-label=${def.label}
526
+ aria-label=${label}
505
527
  aria-expanded=${this.openMenu === name ? 'true' : 'false'}
506
528
  ?disabled=${isDisabled}
507
529
  style=${isFont && value ? `font-family: ${value}` : ''}
@@ -535,27 +557,23 @@ let NileWysiwygToolbar = class NileWysiwygToolbar extends NileElement {
535
557
  </span>
536
558
  `;
537
559
  }
538
- setColor(name, def, color) {
539
- this.openMenu = null;
540
- const recent = this.recentColors[name] ?? [];
541
- this.recentColors = {
542
- ...this.recentColors,
543
- [name]: [color, ...recent.filter(c => c !== color)].slice(0, 8),
544
- };
545
- this.dispatchCommand(def.command, { color });
560
+ setColor(def, color) {
561
+ // nile-color-picker emits 'none' for the "No Fill" action; an empty color
562
+ // clears the mark in the command engine.
563
+ this.dispatchCommand(def.command, { color: color === 'none' ? '' : color });
546
564
  }
547
- renderColor(name, def) {
565
+ renderColor(name, def, overrides) {
548
566
  const current = this.toolbarState ? def.value(this.toolbarState) : null;
549
567
  const shown = current ?? '#000000';
550
- const recent = this.recentColors[name] ?? [];
551
568
  const isBg = def.command === 'bgColor';
569
+ const label = overrides?.label ?? def.label;
552
570
  return html `
553
571
  <span class="toolbar__color" part="color">
554
- ${this.withTooltip(def.label, html `
572
+ ${this.withTooltip(label, html `
555
573
  <button
556
574
  type="button"
557
575
  class="toolbar__button"
558
- aria-label=${def.label}
576
+ aria-label=${label}
559
577
  aria-expanded=${this.openMenu === name ? 'true' : 'false'}
560
578
  ?disabled=${this.disabled}
561
579
  @mousedown=${(e) => e.preventDefault()}
@@ -573,76 +591,23 @@ let NileWysiwygToolbar = class NileWysiwygToolbar extends NileElement {
573
591
  `)}
574
592
  ${this.openMenu === name
575
593
  ? html `
576
- <div class="toolbar__swatch-panel" @mousedown=${(e) => e.preventDefault()}>
577
- <div class="section">
578
- <div class="title">Default</div>
579
- <div class="swatches">
580
- ${COLOR_PALETTE.map(color => html `
581
- <button
582
- type="button"
583
- class="swatch"
584
- style="background: ${color}"
585
- title=${color}
586
- @click=${() => this.setColor(name, def, color)}
587
- >
588
- ${current === color
589
- ? html `<span class="checkmark">✓</span>`
590
- : nothing}
591
- </button>
592
- `)}
593
- </div>
594
- </div>
595
- ${recent.length
596
- ? html `
597
- <div class="section">
598
- <div class="title">Recently Used</div>
599
- <div class="swatches">
600
- ${recent.map(color => html `
601
- <button
602
- type="button"
603
- class="swatch"
604
- style="background: ${color}"
605
- title=${color}
606
- @click=${() => this.setColor(name, def, color)}
607
- ></button>
608
- `)}
609
- </div>
610
- </div>
611
- `
612
- : nothing}
613
- <div class="section">
614
- <div class="title">Custom</div>
615
- <div class="swatches">
616
- <button
617
- type="button"
618
- class="swatch add"
619
- @click=${(e) => {
620
- const input = e.currentTarget
621
- .closest('.toolbar__color')
622
- .querySelector('input[type="color"]');
623
- input?.click();
624
- }}
625
- >
626
- +
627
- </button>
628
- </div>
629
- </div>
594
+ <div class="toolbar__color-panel">
595
+ <nile-color-picker
596
+ mode="inline"
597
+ type="swatches"
598
+ .noFill=${isBg}
599
+ .value=${shown}
600
+ @nile-change=${(e) => this.setColor(def, e.detail.value)}
601
+ ></nile-color-picker>
630
602
  </div>
631
603
  `
632
604
  : nothing}
633
- <input
634
- type="color"
635
- tabindex="-1"
636
- aria-hidden="true"
637
- .value=${shown}
638
- @input=${(e) => this.setColor(name, def, e.target.value)}
639
- />
640
605
  </span>
641
606
  `;
642
607
  }
643
- renderItem(name) {
608
+ renderItem(name, overrides) {
644
609
  if (name === 'table') {
645
- return this.withTooltip('Insert table', html `
610
+ return this.withTooltip(overrides?.label ?? 'Insert table', html `
646
611
  <nile-wysiwyg-table-picker
647
612
  part="button"
648
613
  ?disabled=${this.disabled}
@@ -654,26 +619,114 @@ let NileWysiwygToolbar = class NileWysiwygToolbar extends NileElement {
654
619
  return nothing;
655
620
  switch (def.kind) {
656
621
  case 'button':
657
- return this.renderButton(def);
622
+ return this.renderButton(def, overrides);
658
623
  case 'select':
659
- return this.renderSelect(name, def);
624
+ return this.renderSelect(name, def, overrides);
660
625
  case 'color':
661
- return this.renderColor(name, def);
626
+ return this.renderColor(name, def, overrides);
662
627
  default:
663
628
  return nothing;
664
629
  }
665
630
  }
631
+ /** Parses the `config` string into a flat token list, keeping the `|`
632
+ * (divider) and `>>` (overflow) markers as items. */
633
+ itemsFromConfig(config) {
634
+ return config
635
+ .trim()
636
+ .split(/\s+/)
637
+ .filter(Boolean)
638
+ .map(name => ({ name }));
639
+ }
640
+ /** Splits a flat item list into groups, breaking on `'|'` dividers. */
641
+ groupItems(items) {
642
+ const groups = [[]];
643
+ for (const item of items) {
644
+ if (item.name === '|') {
645
+ if (groups[groups.length - 1].length)
646
+ groups.push([]);
647
+ continue;
648
+ }
649
+ groups[groups.length - 1].push(item);
650
+ }
651
+ return groups.filter(group => group.length > 0);
652
+ }
653
+ /** Partitions the flat item list into the always-visible main groups and the
654
+ * overflow (3-dot menu) groups. Two forms are supported: a positional `>>`
655
+ * token in the `config` string (everything after it overflows), or a
656
+ * per-item `overflow` flag on authored items (each flagged item overflows,
657
+ * wherever it sits). Without either, everything stays on the main bar. */
658
+ partitionGroups(items) {
659
+ const at = items.findIndex(item => item.name === '>>');
660
+ if (at !== -1) {
661
+ return {
662
+ main: this.groupItems(items.slice(0, at)),
663
+ overflow: this.groupItems(items.slice(at + 1)),
664
+ };
665
+ }
666
+ if (!items.some(item => item.overflow)) {
667
+ return { main: this.groupItems(items), overflow: [] };
668
+ }
669
+ return {
670
+ main: this.groupItems(items.filter(item => !item.overflow)),
671
+ overflow: this.groupItems(items.filter(item => item.overflow)),
672
+ };
673
+ }
674
+ /** Renders the trailing 3-dot "more" button and its collapsible panel that
675
+ * hosts the overflow groups (everything after `>>` in the config). The panel
676
+ * drops directly beneath the button, wherever the button sits in the bar. */
677
+ renderOverflow(hasMain, groups) {
678
+ const open = this.overflowOpen;
679
+ return html `
680
+ ${hasMain ? html `<span class="toolbar__divider"></span>` : nothing}
681
+ <span class="toolbar__overflow" part="overflow">
682
+ ${this.withTooltip('More', html `
683
+ <button
684
+ type="button"
685
+ class="toolbar__button"
686
+ aria-label="More"
687
+ aria-haspopup="true"
688
+ aria-expanded=${open ? 'true' : 'false'}
689
+ ?data-active=${open}
690
+ ?disabled=${this.disabled}
691
+ @mousedown=${(e) => e.preventDefault()}
692
+ @click=${this.toggleOverflow}
693
+ >
694
+ ${renderGlyph('ng-dots-vertical', 18)}
695
+ </button>
696
+ `)}
697
+ ${open
698
+ ? html `
699
+ <div
700
+ class="toolbar__overflow-panel"
701
+ part="overflow-panel"
702
+ @mousedown=${(e) => e.preventDefault()}
703
+ >
704
+ ${groups.map((group, index) => html `
705
+ ${index > 0
706
+ ? html `<span class="toolbar__overflow-divider"></span>`
707
+ : nothing}
708
+ ${group.map(item => this.renderItem(item.name, { label: item.label, icon: item.icon }))}
709
+ `)}
710
+ </div>
711
+ `
712
+ : nothing}
713
+ </span>
714
+ `;
715
+ }
666
716
  render() {
667
- const groups = this.config
668
- .split('|')
669
- .map(group => group.trim().split(/\s+/).filter(Boolean))
670
- .filter(group => group.length > 0);
717
+ // A declarative container in an editor's light DOM only carries authored
718
+ // <nile-wysiwyg-toolbar-item> children; the editor renders the real bar.
719
+ if (this.isAuthoringContainer)
720
+ return html ``;
721
+ const items = this.items && this.items.length ? this.items : this.itemsFromConfig(this.config);
722
+ const { main, overflow } = this.partitionGroups(items);
671
723
  return html `
672
724
  <div class="toolbar" part="toolbar" role="toolbar" aria-label="Text formatting">
673
- ${groups.map((group, index) => html `
725
+ ${main.map((group, index) => html `
674
726
  ${index > 0 ? html `<span class="toolbar__divider"></span>` : nothing}
675
- ${group.map(name => this.renderItem(name))}
727
+ ${group.map(item => this.renderItem(item.name, { label: item.label, icon: item.icon }))}
676
728
  `)}
729
+ ${overflow.length ? this.renderOverflow(main.length > 0, overflow) : nothing}
677
730
  </div>
678
731
  `;
679
732
  }
@@ -681,6 +734,9 @@ let NileWysiwygToolbar = class NileWysiwygToolbar extends NileElement {
681
734
  __decorate([
682
735
  property({ type: String })
683
736
  ], NileWysiwygToolbar.prototype, "config", void 0);
737
+ __decorate([
738
+ property({ attribute: false })
739
+ ], NileWysiwygToolbar.prototype, "items", void 0);
684
740
  __decorate([
685
741
  property({ type: Boolean, reflect: true })
686
742
  ], NileWysiwygToolbar.prototype, "disabled", void 0);
@@ -692,7 +748,7 @@ __decorate([
692
748
  ], NileWysiwygToolbar.prototype, "openMenu", void 0);
693
749
  __decorate([
694
750
  state()
695
- ], NileWysiwygToolbar.prototype, "recentColors", void 0);
751
+ ], NileWysiwygToolbar.prototype, "overflowOpen", void 0);
696
752
  NileWysiwygToolbar = __decorate([
697
753
  customElement('nile-wysiwyg-toolbar')
698
754
  ], NileWysiwygToolbar);