@aquera/nile-elements 0.1.75-beta-1.1 → 0.1.75-beta-2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (491) hide show
  1. package/README.md +3 -0
  2. package/demo/index.html +121 -181
  3. package/dist/index.cjs.js +1 -1
  4. package/dist/index.esm.js +1 -1
  5. package/dist/index.js +724 -271
  6. package/dist/nile-avatar/nile-avatar.test.cjs.js +1 -1
  7. package/dist/nile-avatar/nile-avatar.test.cjs.js.map +1 -1
  8. package/dist/nile-avatar/nile-avatar.test.esm.js +1 -1
  9. package/dist/nile-badge/index.cjs.js +1 -1
  10. package/dist/nile-badge/index.esm.js +1 -1
  11. package/dist/nile-badge/nile-badge.cjs.js +1 -1
  12. package/dist/nile-badge/nile-badge.cjs.js.map +1 -1
  13. package/dist/nile-badge/nile-badge.esm.js +1 -1
  14. package/dist/nile-badge/nile-badge.test.cjs.js +1 -1
  15. package/dist/nile-badge/nile-badge.test.cjs.js.map +1 -1
  16. package/dist/nile-badge/nile-badge.test.esm.js +1 -1
  17. package/dist/nile-button/index.cjs.js +1 -1
  18. package/dist/nile-button/index.esm.js +1 -1
  19. package/dist/nile-button/nile-button.cjs.js +1 -1
  20. package/dist/nile-button/nile-button.cjs.js.map +1 -1
  21. package/dist/nile-button/nile-button.esm.js +1 -1
  22. package/dist/nile-button/nile-button.test.cjs.js +1 -1
  23. package/dist/nile-button/nile-button.test.cjs.js.map +1 -1
  24. package/dist/nile-button/nile-button.test.esm.js +1 -1
  25. package/dist/nile-calendar/nile-calendar.test.cjs.js +1 -1
  26. package/dist/nile-calendar/nile-calendar.test.cjs.js.map +1 -1
  27. package/dist/nile-calendar/nile-calendar.test.esm.js +1 -1
  28. package/dist/nile-chip/nile-chip.test.cjs.js +1 -1
  29. package/dist/nile-chip/nile-chip.test.cjs.js.map +1 -1
  30. package/dist/nile-chip/nile-chip.test.esm.js +1 -1
  31. package/dist/nile-code-editor/backup_nile-code-editor copy.cjs.js +2 -0
  32. package/dist/nile-code-editor/backup_nile-code-editor copy.cjs.js.map +1 -0
  33. package/dist/nile-code-editor/backup_nile-code-editor copy.esm.js +1 -0
  34. package/dist/nile-code-editor/extensionSetup.cjs.js +6 -6
  35. package/dist/nile-code-editor/extensionSetup.cjs.js.map +1 -1
  36. package/dist/nile-code-editor/extensionSetup.esm.js +1 -1
  37. package/dist/nile-code-editor/nile-code-editor.cjs.js +2 -2
  38. package/dist/nile-code-editor/nile-code-editor.cjs.js.map +1 -1
  39. package/dist/nile-code-editor/nile-code-editor.esm.js +3 -3
  40. package/dist/nile-dialog/index.cjs.js +1 -1
  41. package/dist/nile-dialog/index.esm.js +1 -1
  42. package/dist/nile-dialog/nile-dialog.cjs.js +1 -1
  43. package/dist/nile-dialog/nile-dialog.cjs.js.map +1 -1
  44. package/dist/nile-dialog/nile-dialog.esm.js +2 -2
  45. package/dist/nile-dialog/nile-dialog.test.cjs.js +1 -1
  46. package/dist/nile-dialog/nile-dialog.test.cjs.js.map +1 -1
  47. package/dist/nile-dialog/nile-dialog.test.esm.js +1 -1
  48. package/dist/nile-drawer/index.cjs.js +1 -1
  49. package/dist/nile-drawer/index.esm.js +1 -1
  50. package/dist/nile-drawer/nile-drawer.cjs.js +1 -1
  51. package/dist/nile-drawer/nile-drawer.cjs.js.map +1 -1
  52. package/dist/nile-drawer/nile-drawer.esm.js +2 -2
  53. package/dist/nile-drawer/nile-drawer.test.cjs.js +1 -1
  54. package/dist/nile-drawer/nile-drawer.test.cjs.js.map +1 -1
  55. package/dist/nile-drawer/nile-drawer.test.esm.js +1 -1
  56. package/dist/nile-grid/index.cjs.js +2 -0
  57. package/dist/nile-grid/index.cjs.js.map +1 -0
  58. package/dist/nile-grid/index.esm.js +1 -0
  59. package/dist/nile-grid/nile-grid.cjs.js +2 -0
  60. package/dist/nile-grid/nile-grid.cjs.js.map +1 -0
  61. package/dist/nile-grid/nile-grid.css.cjs.js +2 -0
  62. package/dist/nile-grid/nile-grid.css.cjs.js.map +1 -0
  63. package/dist/nile-grid/nile-grid.css.esm.js +32 -0
  64. package/dist/nile-grid/nile-grid.esm.js +7 -0
  65. package/dist/nile-grid/nile-grid.utils.cjs.js +2 -0
  66. package/dist/nile-grid/nile-grid.utils.cjs.js.map +1 -0
  67. package/dist/nile-grid/nile-grid.utils.esm.js +1 -0
  68. package/dist/nile-grid-body/index.cjs.js +2 -0
  69. package/dist/nile-grid-body/index.cjs.js.map +1 -0
  70. package/dist/nile-grid-body/index.esm.js +1 -0
  71. package/dist/nile-grid-body/nile-grid-body.cjs.js +2 -0
  72. package/dist/nile-grid-body/nile-grid-body.cjs.js.map +1 -0
  73. package/dist/nile-grid-body/nile-grid-body.css.cjs.js +2 -0
  74. package/dist/nile-grid-body/nile-grid-body.css.cjs.js.map +1 -0
  75. package/dist/nile-grid-body/nile-grid-body.css.esm.js +10 -0
  76. package/dist/nile-grid-body/nile-grid-body.esm.js +5 -0
  77. package/dist/nile-grid-cell-item/index.cjs.js +2 -0
  78. package/dist/nile-grid-cell-item/index.cjs.js.map +1 -0
  79. package/dist/nile-grid-cell-item/index.esm.js +1 -0
  80. package/dist/nile-grid-cell-item/nile-grid-cell-item.cjs.js +2 -0
  81. package/dist/nile-grid-cell-item/nile-grid-cell-item.cjs.js.map +1 -0
  82. package/dist/nile-grid-cell-item/nile-grid-cell-item.css.cjs.js +2 -0
  83. package/dist/nile-grid-cell-item/nile-grid-cell-item.css.cjs.js.map +1 -0
  84. package/dist/nile-grid-cell-item/nile-grid-cell-item.css.esm.js +35 -0
  85. package/dist/nile-grid-cell-item/nile-grid-cell-item.esm.js +12 -0
  86. package/dist/nile-grid-cell-item/nile-grid-cell-item.utils.cjs.js +2 -0
  87. package/dist/nile-grid-cell-item/nile-grid-cell-item.utils.cjs.js.map +1 -0
  88. package/dist/nile-grid-cell-item/nile-grid-cell-item.utils.esm.js +1 -0
  89. package/dist/nile-grid-head/index.cjs.js +2 -0
  90. package/dist/nile-grid-head/index.cjs.js.map +1 -0
  91. package/dist/nile-grid-head/index.esm.js +1 -0
  92. package/dist/nile-grid-head/nile-grid-head.cjs.js +2 -0
  93. package/dist/nile-grid-head/nile-grid-head.cjs.js.map +1 -0
  94. package/dist/nile-grid-head/nile-grid-head.css.cjs.js +2 -0
  95. package/dist/nile-grid-head/nile-grid-head.css.cjs.js.map +1 -0
  96. package/dist/nile-grid-head/nile-grid-head.css.esm.js +7 -0
  97. package/dist/nile-grid-head/nile-grid-head.esm.js +5 -0
  98. package/dist/nile-grid-head-item/index.cjs.js +2 -0
  99. package/dist/nile-grid-head-item/index.cjs.js.map +1 -0
  100. package/dist/nile-grid-head-item/index.esm.js +1 -0
  101. package/dist/nile-grid-head-item/nile-grid-head-item.cjs.js +2 -0
  102. package/dist/nile-grid-head-item/nile-grid-head-item.cjs.js.map +1 -0
  103. package/dist/nile-grid-head-item/nile-grid-head-item.css.cjs.js +2 -0
  104. package/dist/nile-grid-head-item/nile-grid-head-item.css.cjs.js.map +1 -0
  105. package/dist/nile-grid-head-item/nile-grid-head-item.css.esm.js +34 -0
  106. package/dist/nile-grid-head-item/nile-grid-head-item.esm.js +12 -0
  107. package/dist/nile-grid-head-item/nile-grid-head-item.utils.cjs.js +2 -0
  108. package/dist/nile-grid-head-item/nile-grid-head-item.utils.cjs.js.map +1 -0
  109. package/dist/nile-grid-head-item/nile-grid-head-item.utils.esm.js +1 -0
  110. package/dist/nile-grid-row/index.cjs.js +2 -0
  111. package/dist/nile-grid-row/index.cjs.js.map +1 -0
  112. package/dist/nile-grid-row/index.esm.js +1 -0
  113. package/dist/nile-grid-row/nile-grid-row.cjs.js +2 -0
  114. package/dist/nile-grid-row/nile-grid-row.cjs.js.map +1 -0
  115. package/dist/nile-grid-row/nile-grid-row.css.cjs.js +2 -0
  116. package/dist/nile-grid-row/nile-grid-row.css.cjs.js.map +1 -0
  117. package/dist/nile-grid-row/nile-grid-row.css.esm.js +15 -0
  118. package/dist/nile-grid-row/nile-grid-row.esm.js +7 -0
  119. package/dist/nile-icon/icons/svg/format_align_justify.cjs.js +2 -0
  120. package/dist/nile-icon/icons/svg/format_align_justify.cjs.js.map +1 -0
  121. package/dist/nile-icon/icons/svg/format_align_justify.esm.js +1 -0
  122. package/dist/nile-icon/icons/svg/format_align_left.cjs.js +2 -0
  123. package/dist/nile-icon/icons/svg/format_align_left.cjs.js.map +1 -0
  124. package/dist/nile-icon/icons/svg/format_align_left.esm.js +1 -0
  125. package/dist/nile-icon/icons/svg/format_align_middle.cjs.js +2 -0
  126. package/dist/nile-icon/icons/svg/format_align_middle.cjs.js.map +1 -0
  127. package/dist/nile-icon/icons/svg/format_align_middle.esm.js +1 -0
  128. package/dist/nile-icon/icons/svg/format_align_right.cjs.js +2 -0
  129. package/dist/nile-icon/icons/svg/format_align_right.cjs.js.map +1 -0
  130. package/dist/nile-icon/icons/svg/format_align_right.esm.js +1 -0
  131. package/dist/nile-icon/icons/svg/format_bold.cjs.js +2 -0
  132. package/dist/nile-icon/icons/svg/format_bold.cjs.js.map +1 -0
  133. package/dist/nile-icon/icons/svg/format_bold.esm.js +1 -0
  134. package/dist/nile-icon/icons/svg/format_clear.cjs.js +2 -0
  135. package/dist/nile-icon/icons/svg/format_clear.cjs.js.map +1 -0
  136. package/dist/nile-icon/icons/svg/format_clear.esm.js +1 -0
  137. package/dist/nile-icon/icons/svg/format_italic.cjs.js +2 -0
  138. package/dist/nile-icon/icons/svg/format_italic.cjs.js.map +1 -0
  139. package/dist/nile-icon/icons/svg/format_italic.esm.js +1 -0
  140. package/dist/nile-icon/icons/svg/format_list_bulleted.cjs.js +2 -0
  141. package/dist/nile-icon/icons/svg/format_list_bulleted.cjs.js.map +1 -0
  142. package/dist/nile-icon/icons/svg/format_list_bulleted.esm.js +1 -0
  143. package/dist/nile-icon/icons/svg/format_list_numbered.cjs.js +2 -0
  144. package/dist/nile-icon/icons/svg/format_list_numbered.cjs.js.map +1 -0
  145. package/dist/nile-icon/icons/svg/format_list_numbered.esm.js +1 -0
  146. package/dist/nile-icon/icons/svg/format_underline.cjs.js +2 -0
  147. package/dist/nile-icon/icons/svg/format_underline.cjs.js.map +1 -0
  148. package/dist/nile-icon/icons/svg/format_underline.esm.js +1 -0
  149. package/dist/nile-icon/icons/svg/image_2.cjs.js +2 -0
  150. package/dist/nile-icon/icons/svg/image_2.cjs.js.map +1 -0
  151. package/dist/nile-icon/icons/svg/image_2.esm.js +1 -0
  152. package/dist/nile-icon/icons/svg/index.cjs.js +1 -1
  153. package/dist/nile-icon/icons/svg/index.esm.js +1 -1
  154. package/dist/nile-icon/icons/svg/link_2.cjs.js +2 -0
  155. package/dist/nile-icon/icons/svg/link_2.cjs.js.map +1 -0
  156. package/dist/nile-icon/icons/svg/link_2.esm.js +1 -0
  157. package/dist/nile-icon/index.cjs.js +1 -1
  158. package/dist/nile-icon/index.cjs.js.map +1 -1
  159. package/dist/nile-icon/index.esm.js +2 -2
  160. package/dist/nile-icon/nile-icon.test.cjs.js +1 -1
  161. package/dist/nile-icon/nile-icon.test.cjs.js.map +1 -1
  162. package/dist/nile-icon/nile-icon.test.esm.js +1 -1
  163. package/dist/nile-icon-button/index.cjs.js +1 -1
  164. package/dist/nile-icon-button/index.esm.js +1 -1
  165. package/dist/nile-icon-button/nile-icon-button.cjs.js +1 -1
  166. package/dist/nile-icon-button/nile-icon-button.cjs.js.map +1 -1
  167. package/dist/nile-icon-button/nile-icon-button.esm.js +1 -1
  168. package/dist/nile-input/index.cjs.js +1 -1
  169. package/dist/nile-input/index.esm.js +1 -1
  170. package/dist/nile-input/nile-input.cjs.js +1 -1
  171. package/dist/nile-input/nile-input.cjs.js.map +1 -1
  172. package/dist/nile-input/nile-input.esm.js +1 -1
  173. package/dist/nile-input/nile-input.test.cjs.js +1 -1
  174. package/dist/nile-input/nile-input.test.cjs.js.map +1 -1
  175. package/dist/nile-input/nile-input.test.esm.js +1 -1
  176. package/dist/nile-link/nile-link.css.cjs.js +1 -1
  177. package/dist/nile-link/nile-link.css.cjs.js.map +1 -1
  178. package/dist/nile-link/nile-link.css.esm.js +1 -0
  179. package/dist/nile-menu-item/index.cjs.js +1 -1
  180. package/dist/nile-menu-item/index.esm.js +1 -1
  181. package/dist/nile-menu-item/nile-menu-item.cjs.js +1 -1
  182. package/dist/nile-menu-item/nile-menu-item.cjs.js.map +1 -1
  183. package/dist/nile-menu-item/nile-menu-item.esm.js +1 -1
  184. package/dist/nile-option/index.cjs.js +1 -1
  185. package/dist/nile-option/index.esm.js +1 -1
  186. package/dist/nile-option/nile-option.cjs.js +1 -1
  187. package/dist/nile-option/nile-option.cjs.js.map +1 -1
  188. package/dist/nile-option/nile-option.esm.js +2 -2
  189. package/dist/nile-rich-text-editor/index.cjs.js +2 -0
  190. package/dist/nile-rich-text-editor/index.cjs.js.map +1 -0
  191. package/dist/nile-rich-text-editor/index.esm.js +1 -0
  192. package/dist/nile-rich-text-editor/nile-rich-text-editor.cjs.js +2 -0
  193. package/dist/nile-rich-text-editor/nile-rich-text-editor.cjs.js.map +1 -0
  194. package/dist/nile-rich-text-editor/nile-rich-text-editor.css.cjs.js +2 -0
  195. package/dist/nile-rich-text-editor/nile-rich-text-editor.css.cjs.js.map +1 -0
  196. package/dist/nile-rich-text-editor/nile-rich-text-editor.css.esm.js +149 -0
  197. package/dist/nile-rich-text-editor/nile-rich-text-editor.esm.js +1 -0
  198. package/dist/nile-rich-text-editor/nile-rte-color.cjs.js +2 -0
  199. package/dist/nile-rich-text-editor/nile-rte-color.cjs.js.map +1 -0
  200. package/dist/nile-rich-text-editor/nile-rte-color.esm.js +53 -0
  201. package/dist/nile-rich-text-editor/nile-rte-divider.cjs.js +2 -0
  202. package/dist/nile-rich-text-editor/nile-rte-divider.cjs.js.map +1 -0
  203. package/dist/nile-rich-text-editor/nile-rte-divider.esm.js +1 -0
  204. package/dist/nile-rich-text-editor/nile-rte-link.cjs.js +2 -0
  205. package/dist/nile-rich-text-editor/nile-rte-link.cjs.js.map +1 -0
  206. package/dist/nile-rich-text-editor/nile-rte-link.esm.js +19 -0
  207. package/dist/nile-rich-text-editor/nile-rte-mentions-item.cjs.js +2 -0
  208. package/dist/nile-rich-text-editor/nile-rte-mentions-item.cjs.js.map +1 -0
  209. package/dist/nile-rich-text-editor/nile-rte-mentions-item.esm.js +1 -0
  210. package/dist/nile-rich-text-editor/nile-rte-mentions.cjs.js +3 -0
  211. package/dist/nile-rich-text-editor/nile-rte-mentions.cjs.js.map +1 -0
  212. package/dist/nile-rich-text-editor/nile-rte-mentions.esm.js +1 -0
  213. package/dist/nile-rich-text-editor/nile-rte-preview.cjs.js +2 -0
  214. package/dist/nile-rich-text-editor/nile-rte-preview.cjs.js.map +1 -0
  215. package/dist/nile-rich-text-editor/nile-rte-preview.esm.js +1 -0
  216. package/dist/nile-rich-text-editor/nile-rte-select.cjs.js +2 -0
  217. package/dist/nile-rich-text-editor/nile-rte-select.cjs.js.map +1 -0
  218. package/dist/nile-rich-text-editor/nile-rte-select.esm.js +66 -0
  219. package/dist/nile-rich-text-editor/nile-rte-toolbar-item.cjs.js +2 -0
  220. package/dist/nile-rich-text-editor/nile-rte-toolbar-item.cjs.js.map +1 -0
  221. package/dist/nile-rich-text-editor/nile-rte-toolbar-item.esm.js +1 -0
  222. package/dist/nile-rich-text-editor/nile-rte-toolbar.cjs.js +2 -0
  223. package/dist/nile-rich-text-editor/nile-rte-toolbar.cjs.js.map +1 -0
  224. package/dist/nile-rich-text-editor/nile-rte-toolbar.esm.js +1 -0
  225. package/dist/nile-rich-text-editor/utils.cjs.js +2 -0
  226. package/dist/nile-rich-text-editor/utils.cjs.js.map +1 -0
  227. package/dist/nile-rich-text-editor/utils.esm.js +1 -0
  228. package/dist/nile-select/index.cjs.js +1 -1
  229. package/dist/nile-select/index.esm.js +1 -1
  230. package/dist/nile-select/nile-select.cjs.js +1 -1
  231. package/dist/nile-select/nile-select.cjs.js.map +1 -1
  232. package/dist/nile-select/nile-select.esm.js +1 -1
  233. package/dist/nile-select/nile-select.test.cjs.js +1 -1
  234. package/dist/nile-select/nile-select.test.cjs.js.map +1 -1
  235. package/dist/nile-select/nile-select.test.esm.js +1 -1
  236. package/dist/nile-tab/index.cjs.js +1 -1
  237. package/dist/nile-tab/index.esm.js +1 -1
  238. package/dist/nile-tab/nile-tab.cjs.js +1 -1
  239. package/dist/nile-tab/nile-tab.cjs.js.map +1 -1
  240. package/dist/nile-tab/nile-tab.esm.js +1 -1
  241. package/dist/nile-tab-group/index.cjs.js +1 -1
  242. package/dist/nile-tab-group/index.esm.js +1 -1
  243. package/dist/nile-tab-group/nile-tab-group.cjs.js +1 -1
  244. package/dist/nile-tab-group/nile-tab-group.cjs.js.map +1 -1
  245. package/dist/nile-tab-group/nile-tab-group.esm.js +1 -1
  246. package/dist/nile-tab-group/nile-tab-group.test.cjs.js +1 -1
  247. package/dist/nile-tab-group/nile-tab-group.test.cjs.js.map +1 -1
  248. package/dist/nile-tab-group/nile-tab-group.test.esm.js +1 -1
  249. package/dist/nile-tag/index.cjs.js +1 -1
  250. package/dist/nile-tag/index.esm.js +1 -1
  251. package/dist/nile-tag/nile-tag.cjs.js +1 -1
  252. package/dist/nile-tag/nile-tag.cjs.js.map +1 -1
  253. package/dist/nile-tag/nile-tag.esm.js +1 -1
  254. package/dist/nile-toast/index.cjs.js +1 -1
  255. package/dist/nile-toast/index.esm.js +1 -1
  256. package/dist/nile-toast/nile-toast.cjs.js +1 -1
  257. package/dist/nile-toast/nile-toast.cjs.js.map +1 -1
  258. package/dist/nile-toast/nile-toast.esm.js +1 -1
  259. package/dist/nile-tree/index.cjs.js +1 -1
  260. package/dist/nile-tree/index.esm.js +1 -1
  261. package/dist/nile-tree/nile-tree.cjs.js +1 -1
  262. package/dist/nile-tree/nile-tree.cjs.js.map +1 -1
  263. package/dist/nile-tree/nile-tree.esm.js +1 -1
  264. package/dist/nile-tree-item/index.cjs.js +1 -1
  265. package/dist/nile-tree-item/index.esm.js +1 -1
  266. package/dist/nile-tree-item/nile-tree-item.cjs.js +1 -1
  267. package/dist/nile-tree-item/nile-tree-item.cjs.js.map +1 -1
  268. package/dist/nile-tree-item/nile-tree-item.esm.js +1 -1
  269. package/dist/nile-virtual-select/index.cjs.js +1 -1
  270. package/dist/nile-virtual-select/index.esm.js +1 -1
  271. package/dist/nile-virtual-select/nile-virtual-select.cjs.js +2 -2
  272. package/dist/nile-virtual-select/nile-virtual-select.cjs.js.map +1 -1
  273. package/dist/nile-virtual-select/nile-virtual-select.esm.js +3 -3
  274. package/dist/src/index.d.ts +7 -0
  275. package/dist/src/index.js +8 -1
  276. package/dist/src/index.js.map +1 -1
  277. package/dist/src/nile-code-editor/Old_theme copy.d.ts +191 -0
  278. package/dist/src/nile-code-editor/Old_theme copy.js +193 -0
  279. package/dist/src/nile-code-editor/Old_theme copy.js.map +1 -0
  280. package/dist/src/nile-code-editor/backup_nile-code-editor copy.d.ts +0 -0
  281. package/dist/src/nile-code-editor/backup_nile-code-editor copy.js +675 -0
  282. package/dist/src/nile-code-editor/backup_nile-code-editor copy.js.map +1 -0
  283. package/dist/src/nile-code-editor/nile-code-editor.d.ts +6 -3
  284. package/dist/src/nile-code-editor/nile-code-editor.js +44 -22
  285. package/dist/src/nile-code-editor/nile-code-editor.js.map +1 -1
  286. package/dist/src/nile-code-editor/theme copy.d.ts +191 -0
  287. package/dist/src/nile-code-editor/theme copy.js +193 -0
  288. package/dist/src/nile-code-editor/theme copy.js.map +1 -0
  289. package/dist/src/nile-grid/index.d.ts +0 -4
  290. package/dist/src/nile-grid/index.js +0 -4
  291. package/dist/src/nile-grid/index.js.map +1 -1
  292. package/dist/src/nile-grid/nile-grid.css.d.ts +8 -0
  293. package/dist/src/nile-grid/nile-grid.css.js +27 -106
  294. package/dist/src/nile-grid/nile-grid.css.js.map +1 -1
  295. package/dist/src/nile-grid/nile-grid.d.ts +37 -26
  296. package/dist/src/nile-grid/nile-grid.js +96 -148
  297. package/dist/src/nile-grid/nile-grid.js.map +1 -1
  298. package/dist/src/nile-grid/nile-grid.utils.d.ts +9 -0
  299. package/dist/src/nile-grid/nile-grid.utils.js +170 -0
  300. package/dist/src/nile-grid/nile-grid.utils.js.map +1 -0
  301. package/dist/src/nile-grid-body/index.d.ts +1 -0
  302. package/dist/src/nile-grid-body/index.js +2 -0
  303. package/dist/src/nile-grid-body/index.js.map +1 -0
  304. package/dist/src/nile-grid-body/nile-grid-body.css.d.ts +12 -0
  305. package/dist/src/nile-grid-body/nile-grid-body.css.js +22 -0
  306. package/dist/src/nile-grid-body/nile-grid-body.css.js.map +1 -0
  307. package/dist/src/nile-grid-body/nile-grid-body.d.ts +29 -0
  308. package/dist/src/nile-grid-body/nile-grid-body.js +43 -0
  309. package/dist/src/nile-grid-body/nile-grid-body.js.map +1 -0
  310. package/dist/src/nile-grid-cell-item/index.d.ts +1 -0
  311. package/dist/src/nile-grid-cell-item/index.js +2 -0
  312. package/dist/src/nile-grid-cell-item/index.js.map +1 -0
  313. package/dist/src/nile-grid-cell-item/nile-grid-cell-item.css.d.ts +12 -0
  314. package/dist/src/nile-grid-cell-item/nile-grid-cell-item.css.js +47 -0
  315. package/dist/src/nile-grid-cell-item/nile-grid-cell-item.css.js.map +1 -0
  316. package/dist/src/nile-grid-cell-item/nile-grid-cell-item.d.ts +36 -0
  317. package/dist/src/nile-grid-cell-item/nile-grid-cell-item.js +93 -0
  318. package/dist/src/nile-grid-cell-item/nile-grid-cell-item.js.map +1 -0
  319. package/dist/src/nile-grid-cell-item/nile-grid-cell-item.utils.d.ts +10 -0
  320. package/dist/src/nile-grid-cell-item/nile-grid-cell-item.utils.js +34 -0
  321. package/dist/src/nile-grid-cell-item/nile-grid-cell-item.utils.js.map +1 -0
  322. package/dist/src/nile-grid-head/index.d.ts +1 -0
  323. package/dist/src/nile-grid-head/index.js +2 -0
  324. package/dist/src/nile-grid-head/index.js.map +1 -0
  325. package/dist/src/nile-grid-head/nile-grid-head.css.d.ts +12 -0
  326. package/dist/src/nile-grid-head/nile-grid-head.css.js +19 -0
  327. package/dist/src/nile-grid-head/nile-grid-head.css.js.map +1 -0
  328. package/dist/src/nile-grid-head/nile-grid-head.d.ts +28 -0
  329. package/dist/src/nile-grid-head/nile-grid-head.js +41 -0
  330. package/dist/src/nile-grid-head/nile-grid-head.js.map +1 -0
  331. package/dist/src/nile-grid-head-item/index.d.ts +1 -0
  332. package/dist/src/nile-grid-head-item/index.js +2 -0
  333. package/dist/src/nile-grid-head-item/index.js.map +1 -0
  334. package/dist/src/nile-grid-head-item/nile-grid-head-item.css.d.ts +12 -0
  335. package/dist/src/nile-grid-head-item/nile-grid-head-item.css.js +46 -0
  336. package/dist/src/nile-grid-head-item/nile-grid-head-item.css.js.map +1 -0
  337. package/dist/src/nile-grid-head-item/nile-grid-head-item.d.ts +37 -0
  338. package/dist/src/nile-grid-head-item/nile-grid-head-item.js +100 -0
  339. package/dist/src/nile-grid-head-item/nile-grid-head-item.js.map +1 -0
  340. package/dist/src/nile-grid-head-item/nile-grid-head-item.utils.d.ts +10 -0
  341. package/dist/src/nile-grid-head-item/nile-grid-head-item.utils.js +34 -0
  342. package/dist/src/nile-grid-head-item/nile-grid-head-item.utils.js.map +1 -0
  343. package/dist/src/nile-grid-row/index.d.ts +1 -0
  344. package/dist/src/nile-grid-row/index.js +2 -0
  345. package/dist/src/nile-grid-row/index.js.map +1 -0
  346. package/dist/src/nile-grid-row/nile-grid-row.css.d.ts +12 -0
  347. package/dist/src/nile-grid-row/nile-grid-row.css.js +27 -0
  348. package/dist/src/nile-grid-row/nile-grid-row.css.js.map +1 -0
  349. package/dist/src/nile-grid-row/nile-grid-row.d.ts +29 -0
  350. package/dist/src/nile-grid-row/nile-grid-row.js +45 -0
  351. package/dist/src/nile-grid-row/nile-grid-row.js.map +1 -0
  352. package/dist/src/nile-icon/icons/svg/format_align_justify.d.ts +5 -0
  353. package/dist/src/nile-icon/icons/svg/format_align_justify.js +5 -0
  354. package/dist/src/nile-icon/icons/svg/format_align_justify.js.map +1 -0
  355. package/dist/src/nile-icon/icons/svg/format_align_left.d.ts +5 -0
  356. package/dist/src/nile-icon/icons/svg/format_align_left.js +5 -0
  357. package/dist/src/nile-icon/icons/svg/format_align_left.js.map +1 -0
  358. package/dist/src/nile-icon/icons/svg/format_align_middle.d.ts +5 -0
  359. package/dist/src/nile-icon/icons/svg/format_align_middle.js +5 -0
  360. package/dist/src/nile-icon/icons/svg/format_align_middle.js.map +1 -0
  361. package/dist/src/nile-icon/icons/svg/format_align_right.d.ts +5 -0
  362. package/dist/src/nile-icon/icons/svg/format_align_right.js +5 -0
  363. package/dist/src/nile-icon/icons/svg/format_align_right.js.map +1 -0
  364. package/dist/src/nile-icon/icons/svg/format_bold.d.ts +5 -0
  365. package/dist/src/nile-icon/icons/svg/format_bold.js +5 -0
  366. package/dist/src/nile-icon/icons/svg/format_bold.js.map +1 -0
  367. package/dist/src/nile-icon/icons/svg/format_clear.d.ts +5 -0
  368. package/dist/src/nile-icon/icons/svg/format_clear.js +5 -0
  369. package/dist/src/nile-icon/icons/svg/format_clear.js.map +1 -0
  370. package/dist/src/nile-icon/icons/svg/format_italic.d.ts +5 -0
  371. package/dist/src/nile-icon/icons/svg/format_italic.js +5 -0
  372. package/dist/src/nile-icon/icons/svg/format_italic.js.map +1 -0
  373. package/dist/src/nile-icon/icons/svg/format_list_bulleted.d.ts +5 -0
  374. package/dist/src/nile-icon/icons/svg/format_list_bulleted.js +5 -0
  375. package/dist/src/nile-icon/icons/svg/format_list_bulleted.js.map +1 -0
  376. package/dist/src/nile-icon/icons/svg/format_list_numbered.d.ts +5 -0
  377. package/dist/src/nile-icon/icons/svg/format_list_numbered.js +5 -0
  378. package/dist/src/nile-icon/icons/svg/format_list_numbered.js.map +1 -0
  379. package/dist/src/nile-icon/icons/svg/format_underline.d.ts +5 -0
  380. package/dist/src/nile-icon/icons/svg/format_underline.js +5 -0
  381. package/dist/src/nile-icon/icons/svg/format_underline.js.map +1 -0
  382. package/dist/src/nile-icon/icons/svg/image_2.d.ts +5 -0
  383. package/dist/src/nile-icon/icons/svg/image_2.js +5 -0
  384. package/dist/src/nile-icon/icons/svg/image_2.js.map +1 -0
  385. package/dist/src/nile-icon/icons/svg/index.d.ts +12 -0
  386. package/dist/src/nile-icon/icons/svg/index.js +12 -0
  387. package/dist/src/nile-icon/icons/svg/index.js.map +1 -1
  388. package/dist/src/nile-icon/icons/svg/link_2.d.ts +5 -0
  389. package/dist/src/nile-icon/icons/svg/link_2.js +5 -0
  390. package/dist/src/nile-icon/icons/svg/link_2.js.map +1 -0
  391. package/dist/src/nile-link/nile-link.css.js +1 -0
  392. package/dist/src/nile-link/nile-link.css.js.map +1 -1
  393. package/dist/src/nile-option/nile-option.js +1 -1
  394. package/dist/src/nile-option/nile-option.js.map +1 -1
  395. package/dist/src/nile-rich-text-editor/index.d.ts +1 -0
  396. package/dist/src/nile-rich-text-editor/index.js +2 -0
  397. package/dist/src/nile-rich-text-editor/index.js.map +1 -0
  398. package/dist/src/nile-rich-text-editor/nile-rich-text-editor.css.d.ts +3 -0
  399. package/dist/src/nile-rich-text-editor/nile-rich-text-editor.css.js +152 -0
  400. package/dist/src/nile-rich-text-editor/nile-rich-text-editor.css.js.map +1 -0
  401. package/dist/src/nile-rich-text-editor/nile-rich-text-editor.d.ts +63 -0
  402. package/dist/src/nile-rich-text-editor/nile-rich-text-editor.js +735 -0
  403. package/dist/src/nile-rich-text-editor/nile-rich-text-editor.js.map +1 -0
  404. package/dist/src/nile-rich-text-editor/nile-rte-color.d.ts +20 -0
  405. package/dist/src/nile-rich-text-editor/nile-rte-color.js +188 -0
  406. package/dist/src/nile-rich-text-editor/nile-rte-color.js.map +1 -0
  407. package/dist/src/nile-rich-text-editor/nile-rte-divider.d.ts +10 -0
  408. package/dist/src/nile-rich-text-editor/nile-rte-divider.js +12 -0
  409. package/dist/src/nile-rich-text-editor/nile-rte-divider.js.map +1 -0
  410. package/dist/src/nile-rich-text-editor/nile-rte-link.d.ts +19 -0
  411. package/dist/src/nile-rich-text-editor/nile-rte-link.js +169 -0
  412. package/dist/src/nile-rich-text-editor/nile-rte-link.js.map +1 -0
  413. package/dist/src/nile-rich-text-editor/nile-rte-mentions-item.d.ts +18 -0
  414. package/dist/src/nile-rich-text-editor/nile-rte-mentions-item.js +53 -0
  415. package/dist/src/nile-rich-text-editor/nile-rte-mentions-item.js.map +1 -0
  416. package/dist/src/nile-rich-text-editor/nile-rte-mentions.d.ts +64 -0
  417. package/dist/src/nile-rich-text-editor/nile-rte-mentions.js +544 -0
  418. package/dist/src/nile-rich-text-editor/nile-rte-mentions.js.map +1 -0
  419. package/dist/src/nile-rich-text-editor/nile-rte-preview.d.ts +10 -0
  420. package/dist/src/nile-rich-text-editor/nile-rte-preview.js +12 -0
  421. package/dist/src/nile-rich-text-editor/nile-rte-preview.js.map +1 -0
  422. package/dist/src/nile-rich-text-editor/nile-rte-select.d.ts +33 -0
  423. package/dist/src/nile-rich-text-editor/nile-rte-select.js +228 -0
  424. package/dist/src/nile-rich-text-editor/nile-rte-select.js.map +1 -0
  425. package/dist/src/nile-rich-text-editor/nile-rte-toolbar-item.d.ts +12 -0
  426. package/dist/src/nile-rich-text-editor/nile-rte-toolbar-item.js +23 -0
  427. package/dist/src/nile-rich-text-editor/nile-rte-toolbar-item.js.map +1 -0
  428. package/dist/src/nile-rich-text-editor/nile-rte-toolbar.d.ts +10 -0
  429. package/dist/src/nile-rich-text-editor/nile-rte-toolbar.js +12 -0
  430. package/dist/src/nile-rich-text-editor/nile-rte-toolbar.js.map +1 -0
  431. package/dist/src/nile-rich-text-editor/utils.d.ts +13 -0
  432. package/dist/src/nile-rich-text-editor/utils.js +538 -0
  433. package/dist/src/nile-rich-text-editor/utils.js.map +1 -0
  434. package/dist/src/version.js +1 -1
  435. package/dist/src/version.js.map +1 -1
  436. package/dist/tsconfig.tsbuildinfo +1 -1
  437. package/package.json +9 -3
  438. package/rollup.config.js +1 -3
  439. package/src/index.ts +8 -1
  440. package/src/nile-code-editor/backup_nile-code-editor copy.ts +763 -0
  441. package/src/nile-code-editor/nile-code-editor.ts +44 -20
  442. package/src/nile-grid/index.ts +1 -0
  443. package/src/nile-grid/nile-grid.css.ts +43 -0
  444. package/src/nile-grid/nile-grid.ts +185 -0
  445. package/src/nile-grid/nile-grid.utils.ts +252 -0
  446. package/src/nile-grid-body/index.ts +1 -0
  447. package/src/nile-grid-body/nile-grid-body.css.ts +24 -0
  448. package/src/nile-grid-body/nile-grid-body.ts +51 -0
  449. package/src/nile-grid-cell-item/index.ts +1 -0
  450. package/src/nile-grid-cell-item/nile-grid-cell-item.css.ts +49 -0
  451. package/src/nile-grid-cell-item/nile-grid-cell-item.ts +98 -0
  452. package/src/nile-grid-cell-item/nile-grid-cell-item.utils.ts +65 -0
  453. package/src/nile-grid-head/index.ts +1 -0
  454. package/src/nile-grid-head/nile-grid-head.css.ts +21 -0
  455. package/src/nile-grid-head/nile-grid-head.ts +50 -0
  456. package/src/nile-grid-head-item/index.ts +1 -0
  457. package/src/nile-grid-head-item/nile-grid-head-item.css.ts +48 -0
  458. package/src/nile-grid-head-item/nile-grid-head-item.ts +111 -0
  459. package/src/nile-grid-head-item/nile-grid-head-item.utils.ts +66 -0
  460. package/src/nile-grid-row/index.ts +1 -0
  461. package/src/nile-grid-row/nile-grid-row.css.ts +29 -0
  462. package/src/nile-grid-row/nile-grid-row.ts +53 -0
  463. package/src/nile-icon/icons/svg/format_align_justify.ts +5 -0
  464. package/src/nile-icon/icons/svg/format_align_left.ts +5 -0
  465. package/src/nile-icon/icons/svg/format_align_middle.ts +5 -0
  466. package/src/nile-icon/icons/svg/format_align_right.ts +5 -0
  467. package/src/nile-icon/icons/svg/format_bold.ts +5 -0
  468. package/src/nile-icon/icons/svg/format_clear.ts +5 -0
  469. package/src/nile-icon/icons/svg/format_italic.ts +5 -0
  470. package/src/nile-icon/icons/svg/format_list_bulleted.ts +5 -0
  471. package/src/nile-icon/icons/svg/format_list_numbered.ts +5 -0
  472. package/src/nile-icon/icons/svg/format_underline.ts +5 -0
  473. package/src/nile-icon/icons/svg/image_2.ts +5 -0
  474. package/src/nile-icon/icons/svg/index.ts +12 -0
  475. package/src/nile-icon/icons/svg/link_2.ts +5 -0
  476. package/src/nile-link/nile-link.css.ts +1 -0
  477. package/src/nile-option/nile-option.ts +1 -1
  478. package/src/nile-rich-text-editor/index.ts +1 -0
  479. package/src/nile-rich-text-editor/nile-rich-text-editor.css.ts +154 -0
  480. package/src/nile-rich-text-editor/nile-rich-text-editor.ts +836 -0
  481. package/src/nile-rich-text-editor/nile-rte-color.ts +189 -0
  482. package/src/nile-rich-text-editor/nile-rte-divider.ts +9 -0
  483. package/src/nile-rich-text-editor/nile-rte-link.ts +161 -0
  484. package/src/nile-rich-text-editor/nile-rte-mentions-item.ts +46 -0
  485. package/src/nile-rich-text-editor/nile-rte-mentions.ts +618 -0
  486. package/src/nile-rich-text-editor/nile-rte-preview.ts +9 -0
  487. package/src/nile-rich-text-editor/nile-rte-select.ts +249 -0
  488. package/src/nile-rich-text-editor/nile-rte-toolbar-item.ts +13 -0
  489. package/src/nile-rich-text-editor/nile-rte-toolbar.ts +9 -0
  490. package/src/nile-rich-text-editor/utils.ts +643 -0
  491. package/vscode-html-custom-data.json +309 -7
@@ -0,0 +1 @@
1
+ import{__decorate as t}from"tslib";import{LitElement as i}from"lit";import{property as s,state as e,customElement as n}from"lit/decorators.js";import"./nile-rte-toolbar.esm.js";import"./nile-rte-toolbar-item.esm.js";import"./nile-rte-select.esm.js";import"./nile-rte-color.esm.js";import"./nile-rte-divider.esm.js";import"./nile-rte-preview.esm.js";import"./nile-rte-mentions.esm.js";import"./nile-rte-link.esm.js";import{t as o,s as r,a as h,b as l,c,d as a,e as u,n as d,f,r as m}from"./utils.esm.js";import{s as p}from"./nile-rich-text-editor.css.esm.js";const b={bold:"format_bold",italic:"format_italic",underline:"format_underline",link:"link_2",left:"format_align_left",center:"format_align_middle",right:"format_align_right",justify:"format_align_justify",ul:"format_list_bulleted",ol:"format_list_numbered",clear:"format_clear"};let g=class extends i{constructor(){super(...arguments),this.value="",this.singleLineEditor=!1,this.mentions={},this.content="",this.previewEl=null,this.toolbarEl=null,this.lastRange=null,this.buttonMap=new Map,this.headingSelect=null,this.fontSelect=null,this.colorInput=null,this.bgColorInput=null,this.colorSwatchEl=null,this.bgSwatchEl=null,this.containerEl=null,this.mentionsEl=null,this.onEditorKeydown=t=>{if(this.singleLineEditor&&"Enter"===t.key&&t.shiftKey)return void t.preventDefault();if(t.ctrlKey&&"i"===t.key.toLowerCase()&&(t.preventDefault(),o(this.editorEl,"em"),this.updateContent(),this.updateToolbarState()),this.singleLineEditor&&"Enter"===t.key)return void t.preventDefault();if("Tab"!==t.key)return;t.preventDefault(),this.focusAndRestore();const i=window.getSelection();if(!i||0===i.rangeCount)return;const s=i.getRangeAt(0);if(t.shiftKey){if(s.collapsed&&s.startContainer.nodeType===Node.TEXT_NODE){const t=s.startContainer,e=s.startOffset,n=t.data.slice(0,e),o=n.replace(/(\t|[ \u00a0]{2})$/,"");if(o.length!==n.length){t.data=o+t.data.slice(e);const s=document.createRange();s.setStart(t,o.length),s.collapse(!0),i.removeAllRanges(),i.addRange(s),this.updateContent(),this.updateToolbarState()}}return}s.deleteContents();const e=document.createTextNode("\t");s.insertNode(e);const n=document.createRange();n.setStartAfter(e),n.collapse(!0),i.removeAllRanges(),i.addRange(n),this.updateContent(),this.updateToolbarState()},this.onSelectionChange=()=>{if(!this.editorEl)return;const t=document.getSelection();if(!t||0===t.rangeCount)return;const i=t.getRangeAt(0);this.editorEl.contains(i.commonAncestorContainer)&&(this.lastRange=i.cloneRange(),this.updateToolbarState())}}createRenderRoot(){return this}injectCss(t){if(this.querySelector("style[data-rte-style]"))return;const i=document.createElement("style");i.setAttribute("data-rte-style","true"),i.textContent=t,this.insertBefore(i,this.firstChild)}connectedCallback(){super.connectedCallback(),this.injectCss(p.cssText),this.ensureStructure(),this.value&&!this.editorEl.innerHTML.trim()&&(this.editorEl.innerHTML=this.value),this.content=this.editorEl.innerHTML,this.toolbarEl&&this.wireAuthoredToolbar(this.toolbarEl),this.mentionsEl=this.querySelector("nile-rte-mentions"),this.mentionsEl&&(this.mentionsEl.attach?.(this.editorEl,this),this.mentionsEl.setExternalConfig?.(this.mentions)),this.wireEditor(),document.addEventListener("selectionchange",this.onSelectionChange,{passive:!0}),this.updateToolbarState(),this.syncPreview()}ensureStructure(){this.toolbarEl=this.querySelector("nile-rte-toolbar"),this.previewEl=this.querySelector("nile-rte-preview"),this.containerEl=this.querySelector(".rte-container"),this.containerEl||(this.containerEl=document.createElement("div"),this.containerEl.className="rte-container",this.appendChild(this.containerEl)),this.ensureEditor(),this.toolbarEl&&this.toolbarEl.parentElement!==this.containerEl&&this.containerEl.appendChild(this.toolbarEl),this.editorEl.parentElement!==this.containerEl&&this.containerEl.appendChild(this.editorEl),this.previewEl&&(this.previewEl.parentElement!==this&&this.appendChild(this.previewEl),this.previewEl.previousElementSibling!==this.containerEl&&this.insertBefore(this.previewEl,this.containerEl.nextSibling))}updateContentWithMention(t){this.updateContent(),this.dispatchEvent(new CustomEvent("nile-change",{detail:{content:this.content,mention:t},bubbles:!0,composed:!0}))}disconnectedCallback(){document.removeEventListener("selectionchange",this.onSelectionChange),this.mentionsEl&&this.mentionsEl.detach&&this.mentionsEl.detach(),super.disconnectedCallback()}updated(t){t.has("value")&&this.editorEl&&this.value!==this.editorEl.innerHTML&&(this.editorEl.innerHTML=this.value||"<p><br></p>",this.content=this.editorEl.innerHTML,this.syncPreview()),t.has("singleLineEditor")&&(this.editorEl&&this.editorEl.classList.toggle("single-line",this.singleLineEditor),this.previewEl&&this.previewEl.classList.toggle("single-line",this.singleLineEditor))}ensureEditor(){if(this.editorEl=this.querySelector(".editor"),!this.editorEl){const t=document.createElement("article");t.className="editor",t.setAttribute("contenteditable","true"),this.editorEl=t}this.editorEl.innerHTML.trim()||(this.editorEl.innerHTML="<p><br></p>")}unwrapMention(t,i=!0){const s=t.parentNode;if(!s)return;const e=i?(t.textContent??"").replace(/\u200B/g,""):"",n=document.createTextNode(e);s.insertBefore(n,t),s.removeChild(t);const o=document.createRange();o.setStartAfter(n),o.collapse(!0);const r=window.getSelection();r?.removeAllRanges(),r?.addRange(o)}scrubBrokenMentions(){if(!this.editorEl)return;this.editorEl.querySelectorAll("span.mention").forEach((t=>{const i=t,s=i.getAttribute("data-mention-key"),e=i.getAttribute("data-mention-label"),n=i.getAttribute("data-mention-trigger")||"",o=(i.textContent??"").replace(/\u200B/g,"").trim(),r=!!s&&!!e&&o.length>0&&o.startsWith(n)&&o.includes(e);o&&r||this.unwrapMention(i,!0)}))}wireEditor(){this.editorEl.addEventListener("input",(()=>{this.ensureAtLeastOneParagraph(),this.scrubBrokenMentions(),this.updateContent(),this.updateToolbarState()})),this.editorEl.addEventListener("mouseup",(()=>{this.saveSelection(),this.updateToolbarState()})),this.editorEl.addEventListener("keyup",(t=>{this.saveSelection(),["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End"].includes(t.key)&&this.updateToolbarState()})),this.editorEl.addEventListener("keydown",this.onEditorKeydown)}wireAuthoredToolbar(t){this.buttonMap.clear(),this.headingSelect=null,this.fontSelect=null,this.colorInput=null,Array.from(t.children).forEach((t=>{const i=t.tagName.toLowerCase();if("nile-rte-select"!==i||"align"!==t.getAttribute("type")){if("nile-rte-link"===i)return t.editorEl=this.editorEl,void t.addEventListener("link-changed",(()=>{this.updateContent(),this.updateToolbarState()}));if("nile-rte-toolbar-item"===i){let i=t.querySelector(":scope > nile-button");const s=t.getAttribute("name")||"",e=t.getAttribute("label")||s,n=t.getAttribute("icon"),o=t.innerHTML.trim().length>0;if(i||(i=document.createElement("nile-button"),i.variant="tertiary",i.size="small"),n)i.innerHTML=`<nile-icon name="${n}" aria-label="${e}"></nile-icon>`,t.innerHTML="";else if(o)i.innerHTML=t.innerHTML,t.innerHTML="";else{const n=b[s];n?i.innerHTML=`<nile-icon name="${n}" size="20" color="black" aria-label="${e}"></nile-icon>`:i.textContent=e||s,t.innerHTML=""}if(!i.isConnected){const s=document.createElement("nile-tooltip");s.setAttribute("content",e),s.appendChild(i),t.appendChild(s)}i.setAttribute("aria-label",e),i.addEventListener("mousedown",(t=>t.preventDefault())),i.addEventListener("click",(()=>this.onToolbarCommand(s)));const r=this.buttonMap.get(s)??[];return r.push(i),void this.buttonMap.set(s,r)}if("nile-rte-select"!==i)"nile-rte-color"!==i||t.addEventListener("change",(t=>{this.focusAndRestore();const{mode:i,value:s}=t.detail;"backColor"===i?c(this.editorEl,s):a(this.editorEl,s),this.updateContent(),this.updateToolbarState()}));else{const i=t.getAttribute("type")||"";t.addEventListener("change",(t=>{this.focusAndRestore();const s=t.detail;"heading"===i?h(this.editorEl,s):"font"===i&&l(this.editorEl,s),this.updateContent(),this.updateToolbarState()}))}}else t.addEventListener("change",(t=>{this.focusAndRestore();const i=t.detail;r(this.editorEl,i),this.updateContent(),this.updateToolbarState()}))}))}saveSelection(){const t=window.getSelection();t&&t.rangeCount&&(this.lastRange=t.getRangeAt(0).cloneRange())}restoreSelection(){if(!this.lastRange)return;const t=document.getSelection();t&&(t.removeAllRanges(),t.addRange(this.lastRange))}focusAndRestore(){this.editorEl?.focus(),this.restoreSelection()}insertList(t){if(this.restoreSelection(),!this.lastRange)return;const i=document.createElement(t),s=this.lastRange.extractContents(),e=document.createElement("div");e.appendChild(s),Array.from(e.childNodes).forEach((t=>{if(t.nodeType===Node.TEXT_NODE&&!t.textContent?.trim())return;const s=document.createElement("li");s.appendChild(t),i.appendChild(s)})),this.lastRange.insertNode(i),this.afterListEdit(i)}afterListEdit(t){const i=document.createRange();i.setStartAfter(t),i.collapse(!0);const s=window.getSelection();s?.removeAllRanges(),s?.addRange(i),this.saveSelection(),this.updateContent(),this.updateToolbarState()}ensureAtLeastOneParagraph(){const t=this.editorEl;if(!t)return;const i=""===(t.textContent??"").replace(/\u200B/g,"").trim();if(0===t.childNodes.length||i)return void(t.innerHTML="<p><br></p>");if(!t.querySelector("p,h1,h2,h3,h4,h5,h6,ul,ol,table,blockquote,pre")){const i=document.createElement("p");for(;t.firstChild;)i.appendChild(t.firstChild);return i.hasChildNodes()||i.appendChild(document.createElement("br")),void t.appendChild(i)}t.querySelectorAll("p").forEach((t=>{""===(t.textContent??"").replace(/\u200B/g,"")&&(t.innerHTML.toLowerCase().includes("<br")||(t.innerHTML="<br>"))}))}onToolbarCommand(t){switch(this.focusAndRestore(),t){case"bold":o(this.editorEl,"strong");break;case"italic":o(this.editorEl,"em");break;case"underline":o(this.editorEl,"u");break;case"left":r(this.editorEl,"left");break;case"center":r(this.editorEl,"center");break;case"right":r(this.editorEl,"right");break;case"justify":r(this.editorEl,"justify");break;case"ul":u(this.editorEl,"ul"),this.updateContent(),this.updateToolbarState();break;case"ol":u(this.editorEl,"ol"),this.updateContent(),this.updateToolbarState();break;case"link":break;case"clear":const t=document.createTreeWalker(this.editorEl,NodeFilter.SHOW_ELEMENT),i=[];for(;t.nextNode();){const s=t.currentNode;s.removeAttribute("style"),["B","STRONG","I","EM","U","SPAN","FONT"].includes(s.tagName)&&i.push(s)}for(const t of i){for(;t.firstChild;)t.parentNode?.insertBefore(t.firstChild,t);t.remove()}this.ensureAtLeastOneParagraph()}this.updateContent(),this.updateToolbarState()}setBtnActive(t,i){const s=this.buttonMap.get(t);if(s)for(const t of s)t.toggleAttribute("data-active",!!i)}updateToolbarState(){if(!this.editorEl)return;const t=document.getSelection();if(!t||0===t.rangeCount)return;const i=t.getRangeAt(0);if(!this.editorEl.contains(i.commonAncestorContainer))return;const s=d(i.startContainer)||this.editorEl,e=getComputedStyle(s),n=f(i.startContainer,this.editorEl)||this.editorEl,o=(()=>{let t=s;for(;t&&t!==this.editorEl;){if(t instanceof HTMLElement){const i=t.tagName.toLowerCase();if("strong"===i||"b"===i)return!0;const s=getComputedStyle(t).fontWeight;if(parseInt(s,10)>=600)return!0}t=t.parentNode}return!1})(),r=(()=>{let t=s;for(;t&&t!==this.editorEl;){if(t instanceof HTMLElement){const i=t.tagName.toLowerCase();if("em"===i||"i"===i)return!0;if("italic"===getComputedStyle(t).fontStyle)return!0}t=t.parentNode}return!1})(),h=(()=>{let t=s;for(;t&&t!==this.editorEl;){if(t instanceof HTMLElement){const i=getComputedStyle(t).textDecorationLine;if(i&&i.includes("underline"))return!0;if("u"===t.tagName.toLowerCase())return!0}t=t.parentNode}return!1})(),l=!!s.closest("a"),c=n.style.textAlign||getComputedStyle(n).textAlign||"start",a="start"===c?"left":c,u=!!s.closest("li")&&s.closest("ul,ol")?.tagName.toLowerCase()||"";if(this.setBtnActive("bold",o),this.setBtnActive("italic",r),this.setBtnActive("underline",h),this.setBtnActive("link",l),this.setBtnActive("left","left"===a&&!["center","right","justify"].includes(a)),this.setBtnActive("center","center"===a),this.setBtnActive("right","right"===a),this.setBtnActive("justify","justify"===a),this.setBtnActive("ul","ul"===u),this.setBtnActive("ol","ol"===u),this.headingSelect){const t=n.tagName.toLowerCase(),i=["h1","h2","h3"].includes(t)?t:"p";this.headingSelect.value!==i&&(this.headingSelect.value=i)}if(this.fontSelect){const t=(e.fontFamily||"").replace(/["']/g,"").split(",")[0].trim().toLowerCase();if(t)for(const i of Array.from(this.fontSelect.options))if(i.value.toLowerCase()===t){this.fontSelect.value=i.value;break}}if(this.colorInput){const t=m(e.color);t&&this.colorInput.value.toLowerCase()!==t.toLowerCase()&&(this.colorInput.value=t),this.colorSwatchEl&&(this.colorSwatchEl.style.backgroundColor=this.colorInput.value)}if(this.bgColorInput){const t=getComputedStyle(s).backgroundColor;if(t&&!/transparent|rgba\(\s*0\s*,\s*0\s*,\s*0\s*,\s*0\s*\)/i.test(t)){const i=m(t);i&&this.bgColorInput.value.toLowerCase()!==i.toLowerCase()&&(this.bgColorInput.value=i)}this.bgSwatchEl&&(this.bgSwatchEl.style.backgroundColor=this.bgColorInput.value)}}syncPreview(){this.updateContent()}updateContent(){if(!this.editorEl)return;this.ensureAtLeastOneParagraph();const t=this.editorEl.cloneNode(!0),i=document.createTreeWalker(this.editorEl,NodeFilter.SHOW_ELEMENT),s=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT),e=["font-weight","font-style","text-decoration","color","background-color","font-size","font-family","text-align","line-height","letter-spacing","white-space","vertical-align","list-style-position","padding-inline-start"];for(;i.nextNode()&&s.nextNode();){const t=i.currentNode,n=s.currentNode,o=window.getComputedStyle(t),r=e.map((t=>`${t}:${o.getPropertyValue(t)}`)).join(";");r.trim()&&n.setAttribute("style",r)}this.content=t.innerHTML,this.previewEl&&(this.previewEl.innerHTML=this.content),this.dispatchEvent(new CustomEvent("nile-change",{detail:{content:this.content},bubbles:!0,composed:!0}))}};t([s({type:String,attribute:!0,reflect:!0})],g.prototype,"value",void 0),t([s({type:Boolean,attribute:"singlelineeditor",reflect:!0})],g.prototype,"singleLineEditor",void 0),t([s({attribute:"mentions",reflect:!0,converter:{fromAttribute:t=>{try{const i=JSON.parse(t),s={};for(const t of Object.keys(i)){const e=i[t];Array.isArray(e)&&(s[t]=e.filter((t=>t&&"string"==typeof t.key&&"string"==typeof t.label)).map((t=>({key:t.key,label:t.label}))))}return s}catch{return{}}},toAttribute:t=>JSON.stringify(t)}})],g.prototype,"mentions",void 0),t([e()],g.prototype,"content",void 0),g=t([n("nile-rich-text-editor")],g);export{g as N};
@@ -0,0 +1,2 @@
1
+ function _typeof(o){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(o){return typeof o;}:function(o){return o&&"function"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o;},_typeof(o);}System.register(["tslib","lit","lit/decorators.js"],function(_export,_context){"use strict";var t,e,s,i,n,o,_templateObject,_templateObject2,_templateObject3,_templateObject4,_templateObject5,_templateObject6,_templateObject7,r;function _taggedTemplateLiteral(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}));}function _toConsumableArray(r){return _arrayWithoutHoles(r)||_iterableToArray(r)||_unsupportedIterableToArray(r)||_nonIterableSpread();}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _unsupportedIterableToArray(r,a){if(r){if("string"==typeof r)return _arrayLikeToArray(r,a);var t={}.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(r,a):void 0;}}function _iterableToArray(r){if("undefined"!=typeof Symbol&&null!=r[Symbol.iterator]||null!=r["@@iterator"])return Array.from(r);}function _arrayWithoutHoles(r){if(Array.isArray(r))return _arrayLikeToArray(r);}function _arrayLikeToArray(r,a){(null==a||a>r.length)&&(a=r.length);for(var e=0,n=Array(a);e<a;e++)n[e]=r[e];return n;}function _classCallCheck(a,n){if(!(a instanceof n))throw new TypeError("Cannot call a class as a function");}function _defineProperties(e,r){for(var t=0;t<r.length;t++){var o=r[t];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,_toPropertyKey(o.key),o);}}function _createClass(e,r,t){return r&&_defineProperties(e.prototype,r),t&&_defineProperties(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e;}function _toPropertyKey(t){var i=_toPrimitive(t,"string");return"symbol"==_typeof(i)?i:i+"";}function _toPrimitive(t,r){if("object"!=_typeof(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,r||"default");if("object"!=_typeof(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.");}return("string"===r?String:Number)(t);}function _callSuper(t,o,e){return o=_getPrototypeOf(o),_possibleConstructorReturn(t,_isNativeReflectConstruct()?Reflect.construct(o,e||[],_getPrototypeOf(t).constructor):o.apply(t,e));}function _possibleConstructorReturn(t,e){if(e&&("object"==_typeof(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized(t);}function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e;}function _isNativeReflectConstruct(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));}catch(t){}return(_isNativeReflectConstruct=function _isNativeReflectConstruct(){return!!t;})();}function _superPropGet(t,o,e,r){var p=_get(_getPrototypeOf(1&r?t.prototype:t),o,e);return 2&r&&"function"==typeof p?function(t){return p.apply(e,t);}:p;}function _get(){return _get="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,r){var p=_superPropBase(e,t);if(p){var n=Object.getOwnPropertyDescriptor(p,t);return n.get?n.get.call(arguments.length<3?e:r):n.value;}},_get.apply(null,arguments);}function _superPropBase(t,o){for(;!{}.hasOwnProperty.call(t,o)&&null!==(t=_getPrototypeOf(t)););return t;}function _getPrototypeOf(t){return _getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t);},_getPrototypeOf(t);}function _inherits(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&_setPrototypeOf(t,e);}function _setPrototypeOf(t,e){return _setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t;},_setPrototypeOf(t,e);}return{setters:[function(_tslib){t=_tslib.__decorate;},function(_lit){e=_lit.LitElement;s=_lit.html;},function(_litDecoratorsJs){i=_litDecoratorsJs.property;n=_litDecoratorsJs.state;o=_litDecoratorsJs.customElement;}],execute:function execute(){r=/*#__PURE__*/function(_e){function r(){var _this;_classCallCheck(this,r);_this=_callSuper(this,r,arguments),_this.mode="foreColor",_this.label="Text Color",_this.value="#000000",_this.palette=["#000000","#444444","#666666","#999999","#cccccc","#eeeeee","#ffffff","#d32f2f","#f44336","#ff9800","#ffeb3b","#4caf50","#2196f3","#3f51b5","#9c27b0","#03a9f4","#00bcd4","#009688","#8bc34a","#cddc39","#ffc107","#ff5722"],_this.recentColors=[],_this.pickCustom=function(){return _this.inputEl.click();};return _this;}_inherits(r,_e);return _createClass(r,[{key:"createRenderRoot",value:function createRenderRoot(){return this;}},{key:"connectedCallback",value:function connectedCallback(){var _this2=this;_superPropGet(r,"connectedCallback",this,3)([]),this.injectCss("\n nile-button.rte-color-trigger::part(base){\n width:32px; height:32px; padding:0px 6px;\n }\n\n .glyph-stack { display:grid; align-items:center; justify-items:center; line-height:1; }\n .glyph { font-size:14px; margin-bottom:2px; }\n .underline { width:18px; height:3px; border-radius:2px; }\n .swatch-box { width:18px; height:16px; border-radius:4px; border:1px solid rgba(0,0,0,0.35); }\n\n nile-popover::part(popover) {\n min-width: 225px;\n height: 250px;\n padding: 0px;\n gap: 0px;\n }\n\n .swatch-dropdown {\n height: 245px;\n width: 275px;\n padding: 12px;\n background: #fff;\n border-radius: 8px;\n box-sizing: border-box;\n overflow-y: auto;\n }\n\n .section { margin-bottom: 12px; }\n .title { font-size: 13px; font-weight: 600; margin-bottom: 8px; color:#111; }\n\n .swatches {\n display: grid;\n grid-template-columns: repeat(auto-fill, 24px);\n gap: 8px;\n }\n\n .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 background-clip: content-box;\n }\n\n .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 .checkmark {\n position: absolute;\n top: 50%; 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 "),this.inputEl=document.createElement("input"),this.inputEl.type="color",this.inputEl.style.position="absolute",this.inputEl.style.opacity="0",this.inputEl.style.pointerEvents="none",this.inputEl.value=this.value,this.appendChild(this.inputEl),this.inputEl.addEventListener("input",function(){return _this2.setColor(_this2.inputEl.value);});}},{key:"injectCss",value:function injectCss(t){if(this.querySelector("style[data-rte-color-style]"))return;var e=document.createElement("style");e.setAttribute("data-rte-color-style","true"),e.textContent=t,this.insertBefore(e,this.firstChild);}},{key:"setColor",value:function setColor(t){this.value=t,this.recentColors=[t].concat(_toConsumableArray(this.recentColors.filter(function(e){return e!==t;}))).slice(0,8),this.dispatchEvent(new CustomEvent("change",{detail:{mode:this.mode,value:t},bubbles:!0,composed:!0}));}},{key:"render",value:function render(){var _this3=this;return s(_templateObject||(_templateObject=_taggedTemplateLiteral(["\n <nile-popover placement=\"bottom-start\" distance=\"6\" .arrow=",">\n <nile-button\n slot=\"anchor\"\n variant=\"ghost\"\n aria-label=","\n class=\"rte-color-trigger\"\n >\n ","\n </nile-button>\n\n <div part=\"base\" class=\"swatch-dropdown\">\n <div class=\"section\">\n <div class=\"title\">Default</div>\n <div class=\"swatches\">\n ","\n </div>\n </div>\n\n ","\n\n <div class=\"section\">\n <div class=\"title\">Custom</div>\n <div class=\"swatches\">\n <button class=\"swatch add\" @click=",">+</button>\n <nile-icon name=\"eyedropper\"></nile-icon>\n </div>\n </div>\n </div>\n </nile-popover>\n "])),!1,this.label,"backColor"===this.mode?s(_templateObject2||(_templateObject2=_taggedTemplateLiteral(["<span class=\"swatch-box\" style=\"background:","\"></span>"])),this.value):s(_templateObject3||(_templateObject3=_taggedTemplateLiteral(["\n <span class=\"glyph-stack\">\n <span class=\"glyph\">A</span>\n <span class=\"underline\" style=\"background:","\"></span>\n </span>\n "])),this.value),this.palette.map(function(t){return s(_templateObject4||(_templateObject4=_taggedTemplateLiteral(["\n <button class=\"swatch\" style=\"background:","\"\n @click=","\n title=",">\n ","\n </button>\n "])),t,function(){return _this3.setColor(t);},t,_this3.value===t?s(_templateObject5||(_templateObject5=_taggedTemplateLiteral(["<span class=\"checkmark\">\u2713</span>"]))):"");}),this.recentColors.length>0?s(_templateObject6||(_templateObject6=_taggedTemplateLiteral(["\n <div class=\"section\">\n <div class=\"title\">Recently Used</div>\n <div class=\"swatches\">\n ","\n </div>\n </div>\n "])),this.recentColors.map(function(t){return s(_templateObject7||(_templateObject7=_taggedTemplateLiteral(["\n <button class=\"swatch\" style=\"background:","\"\n @click=","\n title=","></button>\n "])),t,function(){return _this3.setColor(t);},t);})):"",this.pickCustom);}}]);}(e);t([i({type:String,attribute:!0,reflect:!0})],r.prototype,"mode",void 0),t([i({type:String,attribute:!0,reflect:!0})],r.prototype,"label",void 0),t([i({type:String,attribute:!0,reflect:!0})],r.prototype,"value",void 0),t([i({type:Array,attribute:!0,reflect:!0})],r.prototype,"palette",void 0),t([n()],r.prototype,"recentColors",void 0),r=t([o("nile-rte-color")],r);}};});
2
+ //# sourceMappingURL=nile-rte-color.cjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nile-rte-color.cjs.js","sources":["../../../src/nile-rich-text-editor/nile-rte-color.ts"],"sourcesContent":["import { LitElement, html } from 'lit';\nimport { customElement, property, state } from 'lit/decorators.js';\n\n@customElement('nile-rte-color')\nexport class NileRteColor extends LitElement {\n protected createRenderRoot() { return this; }\n\n \n @property({ type: String, attribute: true, reflect: true }) mode: 'foreColor' | 'backColor' = 'foreColor';\n @property({ type: String, attribute: true, reflect: true }) label = 'Text Color';\n @property({ type: String, attribute: true, reflect: true }) value = '#000000';\n\n \n @property({ type: Array, attribute: true, reflect: true })\n palette: string[] = [\n '#000000','#444444','#666666','#999999','#cccccc','#eeeeee','#ffffff',\n '#d32f2f','#f44336','#ff9800','#ffeb3b','#4caf50','#2196f3','#3f51b5','#9c27b0',\n '#03a9f4','#00bcd4','#009688','#8bc34a','#cddc39','#ffc107','#ff5722'\n ];\n\n @state() private recentColors: string[] = [];\n private inputEl!: HTMLInputElement;\n\n connectedCallback() {\n super.connectedCallback();\n\n \n this.injectCss(`\n nile-button.rte-color-trigger::part(base){\n width:32px; height:32px; padding:0px 6px;\n }\n\n .glyph-stack { display:grid; align-items:center; justify-items:center; line-height:1; }\n .glyph { font-size:14px; margin-bottom:2px; }\n .underline { width:18px; height:3px; border-radius:2px; }\n .swatch-box { width:18px; height:16px; border-radius:4px; border:1px solid rgba(0,0,0,0.35); }\n\n nile-popover::part(popover) {\n min-width: 225px;\n height: 250px;\n padding: 0px;\n gap: 0px;\n }\n\n .swatch-dropdown {\n height: 245px;\n width: 275px;\n padding: 12px;\n background: #fff;\n border-radius: 8px;\n box-sizing: border-box;\n overflow-y: auto;\n }\n\n .section { margin-bottom: 12px; }\n .title { font-size: 13px; font-weight: 600; margin-bottom: 8px; color:#111; }\n\n .swatches {\n display: grid;\n grid-template-columns: repeat(auto-fill, 24px);\n gap: 8px;\n }\n\n .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 background-clip: content-box;\n }\n\n .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 .checkmark {\n position: absolute;\n top: 50%; 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\n \n this.inputEl = document.createElement('input');\n this.inputEl.type = 'color';\n this.inputEl.style.position = 'absolute';\n this.inputEl.style.opacity = '0';\n this.inputEl.style.pointerEvents = 'none';\n this.inputEl.value = this.value;\n this.appendChild(this.inputEl);\n\n this.inputEl.addEventListener('input', () => this.setColor(this.inputEl.value));\n }\n\n private injectCss(cssText: string) {\n if (this.querySelector('style[data-rte-color-style]')) return;\n const style = document.createElement('style');\n style.setAttribute('data-rte-color-style', 'true');\n style.textContent = cssText;\n this.insertBefore(style, this.firstChild);\n }\n\n private setColor(color: string) {\n this.value = color;\n this.recentColors = [color, ...this.recentColors.filter(c => c !== color)].slice(0, 8);\n\n this.dispatchEvent(new CustomEvent('change', {\n detail: { mode: this.mode, value: color },\n bubbles: true,\n composed: true\n }));\n }\n\n private pickCustom = () => this.inputEl.click();\n\n render() {\n return html`\n <nile-popover placement=\"bottom-start\" distance=\"6\" .arrow=${false}>\n <nile-button\n slot=\"anchor\"\n variant=\"ghost\"\n aria-label=${this.label}\n class=\"rte-color-trigger\"\n >\n ${this.mode === 'backColor'\n ? html`<span class=\"swatch-box\" style=\"background:${this.value}\"></span>`\n : html`\n <span class=\"glyph-stack\">\n <span class=\"glyph\">A</span>\n <span class=\"underline\" style=\"background:${this.value}\"></span>\n </span>\n `}\n </nile-button>\n\n <div part=\"base\" class=\"swatch-dropdown\">\n <div class=\"section\">\n <div class=\"title\">Default</div>\n <div class=\"swatches\">\n ${this.palette.map(c => html`\n <button class=\"swatch\" style=\"background:${c}\"\n @click=${() => this.setColor(c)}\n title=${c}>\n ${this.value === c ? html`<span class=\"checkmark\">✓</span>` : ''}\n </button>\n `)}\n </div>\n </div>\n\n ${this.recentColors.length > 0 ? html`\n <div class=\"section\">\n <div class=\"title\">Recently Used</div>\n <div class=\"swatches\">\n ${this.recentColors.map(c => html`\n <button class=\"swatch\" style=\"background:${c}\"\n @click=${() => this.setColor(c)}\n title=${c}></button>\n `)}\n </div>\n </div>\n ` : ''}\n\n <div class=\"section\">\n <div class=\"title\">Custom</div>\n <div class=\"swatches\">\n <button class=\"swatch add\" @click=${this.pickCustom}>+</button>\n <nile-icon name=\"eyedropper\"></nile-icon>\n </div>\n </div>\n </div>\n </nile-popover>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nile-rte-color': NileRteColor;\n }\n}\n"],"names":["NileRteColor","r","this","mode","label","value","palette","recentColors","pickCustom","inputEl","click","_this","_inherits","_e","_createClass","key","createRenderRoot","connectedCallback","super","injectCss","document","createElement","type","style","position","opacity","pointerEvents","appendChild","addEventListener","setColor","cssText","querySelector","setAttribute","textContent","insertBefore","firstChild","color","filter","c","slice","dispatchEvent","CustomEvent","detail","bubbles","composed","render","html","_templateObject","_taggedTemplateLiteral","_templateObject2","_templateObject3","map","_templateObject4","_templateObject5","length","_templateObject6","_templateObject7","LitElement","__decorate","property","String","attribute","reflect","prototype","Array","state","customElement"],"mappings":"2iJAIaA,4BAAN,SA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S,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAA6B9D,CAAA+D,CAAAA,SAAAA,CAAA,OAAA,CAAA,IAAA,EAAA,CAAA,CACrBL,CAAA,CAAA,CAA3DC,EAAS,CAAErC,IAAAA,CAAMsC,MAAQC,CAAAA,SAAAA,CAAAA,CAAW,CAAMC,CAAAA,OAAAA,CAAAA,CAAS,CAA0B9D,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAA+D,UAAA,OAAA,CAAA,IAAA,EAAA,CAAA,CAI9EL,CAAA,CAAA,CADCC,CAAS,CAAA,CAAErC,IAAM0C,CAAAA,KAAAA,CAAOH,WAAW,CAAMC,CAAAA,OAAAA,CAAAA,CAAS,CAKjD9D,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAA+D,SAAA,CAAA,SAAA,CAAA,IAAA,EAEeL,CAAAA,CAAAA,CAAAA,CAAA,CAAhBO,CAA4CjE,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAA+D,SAAA,CAAA,cAAA,CAAA,IAAA,EAhBlC/D,CAAAA,CAAAA,CAAAA,CAAY0D,CAAA,CAAA,CADxBQ,EAAc,gBACFlE,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA"}
@@ -0,0 +1,53 @@
1
+ import{__decorate as t}from"tslib";import{LitElement as e,html as s}from"lit";import{property as i,state as n,customElement as o}from"lit/decorators.js";let r=class extends e{constructor(){super(...arguments),this.mode="foreColor",this.label="Text Color",this.value="#000000",this.palette=["#000000","#444444","#666666","#999999","#cccccc","#eeeeee","#ffffff","#d32f2f","#f44336","#ff9800","#ffeb3b","#4caf50","#2196f3","#3f51b5","#9c27b0","#03a9f4","#00bcd4","#009688","#8bc34a","#cddc39","#ffc107","#ff5722"],this.recentColors=[],this.pickCustom=()=>this.inputEl.click()}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),this.injectCss("\n nile-button.rte-color-trigger::part(base){\n width:32px; height:32px; padding:0px 6px;\n }\n\n .glyph-stack { display:grid; align-items:center; justify-items:center; line-height:1; }\n .glyph { font-size:14px; margin-bottom:2px; }\n .underline { width:18px; height:3px; border-radius:2px; }\n .swatch-box { width:18px; height:16px; border-radius:4px; border:1px solid rgba(0,0,0,0.35); }\n\n nile-popover::part(popover) {\n min-width: 225px;\n height: 250px;\n padding: 0px;\n gap: 0px;\n }\n\n .swatch-dropdown {\n height: 245px;\n width: 275px;\n padding: 12px;\n background: #fff;\n border-radius: 8px;\n box-sizing: border-box;\n overflow-y: auto;\n }\n\n .section { margin-bottom: 12px; }\n .title { font-size: 13px; font-weight: 600; margin-bottom: 8px; color:#111; }\n\n .swatches {\n display: grid;\n grid-template-columns: repeat(auto-fill, 24px);\n gap: 8px;\n }\n\n .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 background-clip: content-box;\n }\n\n .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 .checkmark {\n position: absolute;\n top: 50%; 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 "),this.inputEl=document.createElement("input"),this.inputEl.type="color",this.inputEl.style.position="absolute",this.inputEl.style.opacity="0",this.inputEl.style.pointerEvents="none",this.inputEl.value=this.value,this.appendChild(this.inputEl),this.inputEl.addEventListener("input",(()=>this.setColor(this.inputEl.value)))}injectCss(t){if(this.querySelector("style[data-rte-color-style]"))return;const e=document.createElement("style");e.setAttribute("data-rte-color-style","true"),e.textContent=t,this.insertBefore(e,this.firstChild)}setColor(t){this.value=t,this.recentColors=[t,...this.recentColors.filter((e=>e!==t))].slice(0,8),this.dispatchEvent(new CustomEvent("change",{detail:{mode:this.mode,value:t},bubbles:!0,composed:!0}))}render(){return s`
2
+ <nile-popover placement="bottom-start" distance="6" .arrow=${!1}>
3
+ <nile-button
4
+ slot="anchor"
5
+ variant="ghost"
6
+ aria-label=${this.label}
7
+ class="rte-color-trigger"
8
+ >
9
+ ${"backColor"===this.mode?s`<span class="swatch-box" style="background:${this.value}"></span>`:s`
10
+ <span class="glyph-stack">
11
+ <span class="glyph">A</span>
12
+ <span class="underline" style="background:${this.value}"></span>
13
+ </span>
14
+ `}
15
+ </nile-button>
16
+
17
+ <div part="base" class="swatch-dropdown">
18
+ <div class="section">
19
+ <div class="title">Default</div>
20
+ <div class="swatches">
21
+ ${this.palette.map((t=>s`
22
+ <button class="swatch" style="background:${t}"
23
+ @click=${()=>this.setColor(t)}
24
+ title=${t}>
25
+ ${this.value===t?s`<span class="checkmark">✓</span>`:""}
26
+ </button>
27
+ `))}
28
+ </div>
29
+ </div>
30
+
31
+ ${this.recentColors.length>0?s`
32
+ <div class="section">
33
+ <div class="title">Recently Used</div>
34
+ <div class="swatches">
35
+ ${this.recentColors.map((t=>s`
36
+ <button class="swatch" style="background:${t}"
37
+ @click=${()=>this.setColor(t)}
38
+ title=${t}></button>
39
+ `))}
40
+ </div>
41
+ </div>
42
+ `:""}
43
+
44
+ <div class="section">
45
+ <div class="title">Custom</div>
46
+ <div class="swatches">
47
+ <button class="swatch add" @click=${this.pickCustom}>+</button>
48
+ <nile-icon name="eyedropper"></nile-icon>
49
+ </div>
50
+ </div>
51
+ </div>
52
+ </nile-popover>
53
+ `}};t([i({type:String,attribute:!0,reflect:!0})],r.prototype,"mode",void 0),t([i({type:String,attribute:!0,reflect:!0})],r.prototype,"label",void 0),t([i({type:String,attribute:!0,reflect:!0})],r.prototype,"value",void 0),t([i({type:Array,attribute:!0,reflect:!0})],r.prototype,"palette",void 0),t([n()],r.prototype,"recentColors",void 0),r=t([o("nile-rte-color")],r);
@@ -0,0 +1,2 @@
1
+ function _typeof(o){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(o){return typeof o;}:function(o){return o&&"function"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o;},_typeof(o);}System.register(["tslib","lit","lit/decorators.js"],function(_export,_context){"use strict";var r,t,e,o;function _classCallCheck(a,n){if(!(a instanceof n))throw new TypeError("Cannot call a class as a function");}function _defineProperties(e,r){for(var t=0;t<r.length;t++){var o=r[t];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,_toPropertyKey(o.key),o);}}function _createClass(e,r,t){return r&&_defineProperties(e.prototype,r),t&&_defineProperties(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e;}function _toPropertyKey(t){var i=_toPrimitive(t,"string");return"symbol"==_typeof(i)?i:i+"";}function _toPrimitive(t,r){if("object"!=_typeof(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,r||"default");if("object"!=_typeof(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.");}return("string"===r?String:Number)(t);}function _callSuper(t,o,e){return o=_getPrototypeOf(o),_possibleConstructorReturn(t,_isNativeReflectConstruct()?Reflect.construct(o,e||[],_getPrototypeOf(t).constructor):o.apply(t,e));}function _possibleConstructorReturn(t,e){if(e&&("object"==_typeof(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized(t);}function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e;}function _isNativeReflectConstruct(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));}catch(t){}return(_isNativeReflectConstruct=function _isNativeReflectConstruct(){return!!t;})();}function _getPrototypeOf(t){return _getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t);},_getPrototypeOf(t);}function _inherits(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&_setPrototypeOf(t,e);}function _setPrototypeOf(t,e){return _setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t;},_setPrototypeOf(t,e);}return{setters:[function(_tslib){r=_tslib.__decorate;},function(_lit){t=_lit.LitElement;},function(_litDecoratorsJs){e=_litDecoratorsJs.customElement;}],execute:function execute(){o=/*#__PURE__*/function(_t){function o(){_classCallCheck(this,o);return _callSuper(this,o,arguments);}_inherits(o,_t);return _createClass(o,[{key:"createRenderRoot",value:function createRenderRoot(){return this;}},{key:"shouldUpdate",value:function shouldUpdate(){return!1;}}]);}(t);o=r([e("nile-rte-divider")],o);}};});
2
+ //# sourceMappingURL=nile-rte-divider.cjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nile-rte-divider.cjs.js","sources":["../../../src/nile-rich-text-editor/nile-rte-divider.ts"],"sourcesContent":["import { LitElement } from 'lit';\nimport { customElement } from 'lit/decorators.js';\n\n@customElement('nile-rte-divider')\nexport class NileRteDivider extends LitElement {\n protected createRenderRoot() { return this; }\n protected shouldUpdate() { return false; }\n}\ndeclare global { interface HTMLElementTagNameMap { 'nile-rte-divider': NileRteDivider; } }\n"],"names":["NileRteDivider","createRenderRoot","this","key","value","shouldUpdate","LitElement","__decorate","customElement"],"mappings":"kwFAIaA,CAAAA,uBAAAA,EAAAA,WAAAA,EAAAA,EAAAA,eAAAA,MAAAA,CAAAA,SAAAA,UAAAA,MAAAA,CAAAA,CAAAA,SAAAA,GAAAA,SAAAA,CAAAA,CAAAA,CAAAA,EAAAA,SAAAA,YAAAA,CAAAA,CAAAA,GAAAA,GAAAA,oBAAAA,KAAAA,CACD,SAAAC,gBAAAA,CAAAA,CAAAA,CAAqB,MAAOC,KAAO,EACnC,GAAAC,GAAA,gBAAAC,KAAA,UAAAC,YAAAA,CAAAA,CAAAA,CAAiB,MAAO,CAAA,CAAQ,QAFRC,CAAAA,EAAvBN,CAAcO,CAAAA,CAAAA,CAAA,CAD1BC,CAAAA,CAAc,kBACFR,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA"}
@@ -0,0 +1 @@
1
+ import{__decorate as r}from"tslib";import{LitElement as t}from"lit";import{customElement as e}from"lit/decorators.js";let o=class extends t{createRenderRoot(){return this}shouldUpdate(){return!1}};o=r([e("nile-rte-divider")],o);
@@ -0,0 +1,2 @@
1
+ function _typeof(o){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(o){return typeof o;}:function(o){return o&&"function"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o;},_typeof(o);}System.register(["tslib","lit","lit/decorators.js"],function(_export,_context){"use strict";var t,n,e,i,r,s,_templateObject,o;function _taggedTemplateLiteral(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}));}function _classCallCheck(a,n){if(!(a instanceof n))throw new TypeError("Cannot call a class as a function");}function _defineProperties(e,r){for(var t=0;t<r.length;t++){var o=r[t];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,_toPropertyKey(o.key),o);}}function _createClass(e,r,t){return r&&_defineProperties(e.prototype,r),t&&_defineProperties(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e;}function _toPropertyKey(t){var i=_toPrimitive(t,"string");return"symbol"==_typeof(i)?i:i+"";}function _toPrimitive(t,r){if("object"!=_typeof(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,r||"default");if("object"!=_typeof(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.");}return("string"===r?String:Number)(t);}function _callSuper(t,o,e){return o=_getPrototypeOf(o),_possibleConstructorReturn(t,_isNativeReflectConstruct()?Reflect.construct(o,e||[],_getPrototypeOf(t).constructor):o.apply(t,e));}function _possibleConstructorReturn(t,e){if(e&&("object"==_typeof(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized(t);}function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e;}function _isNativeReflectConstruct(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));}catch(t){}return(_isNativeReflectConstruct=function _isNativeReflectConstruct(){return!!t;})();}function _superPropGet(t,o,e,r){var p=_get(_getPrototypeOf(1&r?t.prototype:t),o,e);return 2&r&&"function"==typeof p?function(t){return p.apply(e,t);}:p;}function _get(){return _get="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,r){var p=_superPropBase(e,t);if(p){var n=Object.getOwnPropertyDescriptor(p,t);return n.get?n.get.call(arguments.length<3?e:r):n.value;}},_get.apply(null,arguments);}function _superPropBase(t,o){for(;!{}.hasOwnProperty.call(t,o)&&null!==(t=_getPrototypeOf(t)););return t;}function _getPrototypeOf(t){return _getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t);},_getPrototypeOf(t);}function _inherits(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&_setPrototypeOf(t,e);}function _setPrototypeOf(t,e){return _setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t;},_setPrototypeOf(t,e);}return{setters:[function(_tslib){t=_tslib.__decorate;},function(_lit){n=_lit.LitElement;e=_lit.html;},function(_litDecoratorsJs){i=_litDecoratorsJs.property;r=_litDecoratorsJs.state;s=_litDecoratorsJs.customElement;}],execute:function execute(){o=/*#__PURE__*/function(_n){function o(){var _this;_classCallCheck(this,o);_this=_callSuper(this,o,arguments),_this.placeholder="https://",_this.linkValue="",_this.selectionRange=null;return _this;}_inherits(o,_n);return _createClass(o,[{key:"createRenderRoot",value:function createRenderRoot(){return this;}},{key:"connectedCallback",value:function connectedCallback(){_superPropGet(o,"connectedCallback",this,3)([]),this.injectCss("\n nile-rte-link nile-button.rte-link-trigger::part(base) {\n width: 32px;\n height: 32px;\n padding: 0;\n border: none;\n border-radius: 6px;\n }\n .link-popup {\n display: flex;\n gap: 6px;\n padding: 6px 8px;\n align-items: center;\n background: white;\n }\n .link-input {\n flex: 1;\n padding: 6px 8px;\n font-size: 14px;\n border: 1px solid #ccc;\n border-radius: 4px;\n }\n nile-popover.rte-link-popover::part(popover) {\n min-width: 250px;\n height: 44px;\n padding: 0px;\n gap: 0px;\n }\n ");}},{key:"injectCss",value:function injectCss(t){if(this.querySelector("style[data-rte-link-style]"))return;var n=document.createElement("style");n.setAttribute("data-rte-link-style","true"),n.textContent=t,this.insertBefore(n,this.firstChild);}},{key:"onOpen",value:function onOpen(){var _e,_this2=this;if(!this.editorEl)return;var t=document.getSelection();if(!t||0===t.rangeCount)return;this.selectionRange=t.getRangeAt(0).cloneRange();var n=t.anchorNode,e=null;for(;n&&n!==this.editorEl;){if(n instanceof HTMLAnchorElement){e=n;break;}n=n.parentNode;}this.linkValue=((_e=e)===null||_e===void 0?void 0:_e.href)||"",setTimeout(function(){var _this2$querySelector;(_this2$querySelector=_this2.querySelector(".link-input"))===null||_this2$querySelector===void 0||_this2$querySelector.focus();},0);}},{key:"onApply",value:function onApply(){if(!this.editorEl||!this.selectionRange)return;var t=this.linkValue.trim();if(!t)return;var n=document.getSelection();if(!n)return;n.removeAllRanges(),n.addRange(this.selectionRange);var e=this.selectionRange.startContainer,i=null;for(;e&&e!==this.editorEl;){if(e instanceof HTMLAnchorElement){i=e;break;}e=e.parentNode;}if(i)i.href=t;else{var _n2=document.createElement("a");if(_n2.href=t,this.selectionRange.collapsed)_n2.textContent=t,this.selectionRange.insertNode(_n2);else try{this.selectionRange.surroundContents(_n2);}catch(_unused){var _t=this.selectionRange.extractContents();_n2.appendChild(_t),this.selectionRange.insertNode(_n2);}}this.emit(t);var r=this.querySelector("nile-popover");r&&(r.isShow=!1);}},{key:"emit",value:function emit(t){this.dispatchEvent(new CustomEvent("link-changed",{detail:{href:t},bubbles:!0,composed:!0}));}},{key:"render",value:function render(){var _this3=this;return e(_templateObject||(_templateObject=_taggedTemplateLiteral(["\n <nile-popover placement=\"bottom-start\" class=\"rte-link-popover\" distance=\"10\" .arrow=",">\n <nile-button class=\"rte-link-trigger\" slot=\"anchor\" variant=\"tertiary\" size=\"small\" @click=",">\n <nile-icon name=\"link_2\" aria-label=\"Insert/Edit Link\"></nile-icon>\n </nile-button>\n\n <div class=\"link-popup\">\n <input\n class=\"link-input\"\n type=\"text\"\n placeholder=\"Type or paste link here\"\n .value=","\n @input=","\n @keydown=","\n />\n <nile-button @click=",">Apply</nile-button>\n </div>\n </nile-popover>\n "])),!1,function(){return _this3.onOpen();},this.linkValue,function(t){return _this3.linkValue=t.target.value;},function(t){if("Enter"===t.key&&_this3.onApply(),"Escape"===t.key){var _t2=_this3.querySelector("nile-popover");_t2&&(_t2.isShow=!1);}},function(){return _this3.onApply();});}}]);}(n);t([i({attribute:!1})],o.prototype,"editorEl",void 0),t([i({type:String})],o.prototype,"placeholder",void 0),t([r()],o.prototype,"linkValue",void 0),o=t([s("nile-rte-link")],o);}};});
2
+ //# sourceMappingURL=nile-rte-link.cjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nile-rte-link.cjs.js","sources":["../../../src/nile-rich-text-editor/nile-rte-link.ts"],"sourcesContent":["import { LitElement, html } from 'lit';\nimport { customElement, property, state } from 'lit/decorators.js';\n\n@customElement('nile-rte-link')\nexport class NileRteLink extends LitElement {\n protected createRenderRoot() { return this; }\n\n @property({ attribute: false }) editorEl!: HTMLElement;\n @property({ type: String }) placeholder = 'https://';\n\n @state() private linkValue = '';\n private selectionRange: Range | null = null;\n\n connectedCallback() {\n super.connectedCallback();\n this.injectCss(`\n nile-rte-link nile-button.rte-link-trigger::part(base) {\n width: 32px;\n height: 32px;\n padding: 0;\n border: none;\n border-radius: 6px;\n }\n .link-popup {\n display: flex;\n gap: 6px;\n padding: 6px 8px;\n align-items: center;\n background: white;\n }\n .link-input {\n flex: 1;\n padding: 6px 8px;\n font-size: 14px;\n border: 1px solid #ccc;\n border-radius: 4px;\n }\n nile-popover.rte-link-popover::part(popover) {\n min-width: 250px;\n height: 44px;\n padding: 0px;\n gap: 0px;\n }\n `);\n }\n\n private injectCss(cssText: string) {\n if (this.querySelector('style[data-rte-link-style]')) return;\n const style = document.createElement('style');\n style.setAttribute('data-rte-link-style', 'true');\n style.textContent = cssText;\n this.insertBefore(style, this.firstChild);\n }\n\n private onOpen() {\n if (!this.editorEl) return;\n const sel = document.getSelection();\n if (!sel || sel.rangeCount === 0) return;\n\n this.selectionRange = sel.getRangeAt(0).cloneRange();\n\n \n let n: Node | null = sel.anchorNode;\n let a: HTMLAnchorElement | null = null;\n while (n && n !== this.editorEl) {\n if (n instanceof HTMLAnchorElement) { a = n; break; }\n n = n.parentNode;\n }\n this.linkValue = a?.href || '';\n\n setTimeout(() => {\n this.querySelector<HTMLInputElement>('.link-input')?.focus();\n }, 0);\n }\n\n private onApply() {\n if (!this.editorEl || !this.selectionRange) return;\n const url = this.linkValue.trim();\n if (!url) return;\n\n const sel = document.getSelection();\n if (!sel) return;\n sel.removeAllRanges();\n sel.addRange(this.selectionRange);\n\n \n let n: Node | null = this.selectionRange.startContainer;\n let a: HTMLAnchorElement | null = null;\n while (n && n !== this.editorEl) {\n if (n instanceof HTMLAnchorElement) { a = n; break; }\n n = n.parentNode;\n }\n\n if (a) {\n a.href = url;\n } else {\n const link = document.createElement('a');\n link.href = url;\n if (this.selectionRange.collapsed) {\n link.textContent = url;\n this.selectionRange.insertNode(link);\n } else {\n try {\n this.selectionRange.surroundContents(link);\n } catch {\n const frag = this.selectionRange.extractContents();\n link.appendChild(frag);\n this.selectionRange.insertNode(link);\n }\n }\n }\n\n this.emit(url);\n\n \n const pop = this.querySelector('nile-popover');\n if (pop) (pop as any).isShow = false;\n }\n\n private emit(href: string) {\n this.dispatchEvent(new CustomEvent('link-changed', {\n detail: { href },\n bubbles: true,\n composed: true\n }));\n }\n\n render() {\n return html`\n <nile-popover placement=\"bottom-start\" class=\"rte-link-popover\" distance=\"10\" .arrow=${false}>\n <nile-button class=\"rte-link-trigger\" slot=\"anchor\" variant=\"tertiary\" size=\"small\" @click=${() => this.onOpen()}>\n <nile-icon name=\"link_2\" aria-label=\"Insert/Edit Link\"></nile-icon>\n </nile-button>\n\n <div class=\"link-popup\">\n <input\n class=\"link-input\"\n type=\"text\"\n placeholder=\"Type or paste link here\"\n .value=${this.linkValue}\n @input=${(e: any) => this.linkValue = e.target.value}\n @keydown=${(e: KeyboardEvent) => {\n if (e.key === 'Enter') this.onApply();\n if (e.key === 'Escape') {\n const pop = this.querySelector('nile-popover');\n if (pop) (pop as any).isShow = false;\n }\n }}\n />\n <nile-button @click=${() => this.onApply()}>Apply</nile-button>\n </div>\n </nile-popover>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nile-rte-link': NileRteLink;\n }\n}\n"],"names":["NileRteLink","o","constructor","this","placeholder","linkValue","selectionRange","_this","_inherits","_n","_createClass","key","value","createRenderRoot","connectedCallback","super","injectCss","cssText","querySelector","style","document","createElement","setAttribute","textContent","insertBefore","firstChild","onOpen","editorEl","sel","getSelection","rangeCount","getRangeAt","cloneRange","n","anchorNode","a","HTMLAnchorElement","parentNode","href","setTimeout","_this2$querySelector","focus","onApply","url","trim","removeAllRanges","addRange","startContainer","link","collapsed","insertNode","surroundContents","_unused","frag","extractContents","appendChild","emit","pop","isShow","dispatchEvent","CustomEvent","detail","bubbles","composed","render","html","_templateObject","_taggedTemplateLiteral","e","target","LitElement","__decorate","property","attribute","prototype","type","String","state","customElement"],"mappings":"8+GAIaA,CAAAA,uBAAAA,EAAAA,EAAN,SAAAC,EAAA,CAAAC,KAAAA,KAAAA,CAAAA,eAAAA,MAAAA,CAAAA,qCAIuBC,KAAAA,CAAWC,WAAAA,CAAG,UAEzBD,C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AAA,CADvBO,EAAc,eACF9E,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA"}
@@ -0,0 +1,19 @@
1
+ import{__decorate as t}from"tslib";import{LitElement as n,html as e}from"lit";import{property as i,state as r,customElement as s}from"lit/decorators.js";let o=class extends n{constructor(){super(...arguments),this.placeholder="https://",this.linkValue="",this.selectionRange=null}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),this.injectCss("\n nile-rte-link nile-button.rte-link-trigger::part(base) {\n width: 32px;\n height: 32px;\n padding: 0;\n border: none;\n border-radius: 6px;\n }\n .link-popup {\n display: flex;\n gap: 6px;\n padding: 6px 8px;\n align-items: center;\n background: white;\n }\n .link-input {\n flex: 1;\n padding: 6px 8px;\n font-size: 14px;\n border: 1px solid #ccc;\n border-radius: 4px;\n }\n nile-popover.rte-link-popover::part(popover) {\n min-width: 250px;\n height: 44px;\n padding: 0px;\n gap: 0px;\n }\n ")}injectCss(t){if(this.querySelector("style[data-rte-link-style]"))return;const n=document.createElement("style");n.setAttribute("data-rte-link-style","true"),n.textContent=t,this.insertBefore(n,this.firstChild)}onOpen(){if(!this.editorEl)return;const t=document.getSelection();if(!t||0===t.rangeCount)return;this.selectionRange=t.getRangeAt(0).cloneRange();let n=t.anchorNode,e=null;for(;n&&n!==this.editorEl;){if(n instanceof HTMLAnchorElement){e=n;break}n=n.parentNode}this.linkValue=e?.href||"",setTimeout((()=>{this.querySelector(".link-input")?.focus()}),0)}onApply(){if(!this.editorEl||!this.selectionRange)return;const t=this.linkValue.trim();if(!t)return;const n=document.getSelection();if(!n)return;n.removeAllRanges(),n.addRange(this.selectionRange);let e=this.selectionRange.startContainer,i=null;for(;e&&e!==this.editorEl;){if(e instanceof HTMLAnchorElement){i=e;break}e=e.parentNode}if(i)i.href=t;else{const n=document.createElement("a");if(n.href=t,this.selectionRange.collapsed)n.textContent=t,this.selectionRange.insertNode(n);else try{this.selectionRange.surroundContents(n)}catch{const t=this.selectionRange.extractContents();n.appendChild(t),this.selectionRange.insertNode(n)}}this.emit(t);const r=this.querySelector("nile-popover");r&&(r.isShow=!1)}emit(t){this.dispatchEvent(new CustomEvent("link-changed",{detail:{href:t},bubbles:!0,composed:!0}))}render(){return e`
2
+ <nile-popover placement="bottom-start" class="rte-link-popover" distance="10" .arrow=${!1}>
3
+ <nile-button class="rte-link-trigger" slot="anchor" variant="tertiary" size="small" @click=${()=>this.onOpen()}>
4
+ <nile-icon name="link_2" aria-label="Insert/Edit Link"></nile-icon>
5
+ </nile-button>
6
+
7
+ <div class="link-popup">
8
+ <input
9
+ class="link-input"
10
+ type="text"
11
+ placeholder="Type or paste link here"
12
+ .value=${this.linkValue}
13
+ @input=${t=>this.linkValue=t.target.value}
14
+ @keydown=${t=>{if("Enter"===t.key&&this.onApply(),"Escape"===t.key){const t=this.querySelector("nile-popover");t&&(t.isShow=!1)}}}
15
+ />
16
+ <nile-button @click=${()=>this.onApply()}>Apply</nile-button>
17
+ </div>
18
+ </nile-popover>
19
+ `}};t([i({attribute:!1})],o.prototype,"editorEl",void 0),t([i({type:String})],o.prototype,"placeholder",void 0),t([r()],o.prototype,"linkValue",void 0),o=t([s("nile-rte-link")],o);
@@ -0,0 +1,2 @@
1
+ function _typeof(o){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(o){return typeof o;}:function(o){return o&&"function"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o;},_typeof(o);}System.register(["tslib","lit","lit/decorators.js"],function(_export,_context){"use strict";var t,e,r,i,o;function _classCallCheck(a,n){if(!(a instanceof n))throw new TypeError("Cannot call a class as a function");}function _defineProperties(e,r){for(var t=0;t<r.length;t++){var o=r[t];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,_toPropertyKey(o.key),o);}}function _createClass(e,r,t){return r&&_defineProperties(e.prototype,r),t&&_defineProperties(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e;}function _toPropertyKey(t){var i=_toPrimitive(t,"string");return"symbol"==_typeof(i)?i:i+"";}function _toPrimitive(t,r){if("object"!=_typeof(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,r||"default");if("object"!=_typeof(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.");}return("string"===r?String:Number)(t);}function _callSuper(t,o,e){return o=_getPrototypeOf(o),_possibleConstructorReturn(t,_isNativeReflectConstruct()?Reflect.construct(o,e||[],_getPrototypeOf(t).constructor):o.apply(t,e));}function _possibleConstructorReturn(t,e){if(e&&("object"==_typeof(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized(t);}function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e;}function _isNativeReflectConstruct(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));}catch(t){}return(_isNativeReflectConstruct=function _isNativeReflectConstruct(){return!!t;})();}function _getPrototypeOf(t){return _getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t);},_getPrototypeOf(t);}function _inherits(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&_setPrototypeOf(t,e);}function _setPrototypeOf(t,e){return _setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t;},_setPrototypeOf(t,e);}return{setters:[function(_tslib){t=_tslib.__decorate;},function(_lit){e=_lit.LitElement;},function(_litDecoratorsJs){r=_litDecoratorsJs.property;i=_litDecoratorsJs.customElement;}],execute:function execute(){o=/*#__PURE__*/function(_e){function o(){var _this;_classCallCheck(this,o);_this=_callSuper(this,o,arguments),_this.mentionsCharacter="",_this.mentionsColor="",_this.mentionsPrefix="",_this.mentionsSuffix="",_this.mentionsData=[];return _this;}_inherits(o,_e);return _createClass(o,[{key:"createRenderRoot",value:function createRenderRoot(){return this;}}]);}(e);t([r({attribute:"mentionscharacter",reflect:!0})],o.prototype,"mentionsCharacter",void 0),t([r({attribute:"mentionscolor",reflect:!0})],o.prototype,"mentionsColor",void 0),t([r({attribute:"mentionsprefix",reflect:!0})],o.prototype,"mentionsPrefix",void 0),t([r({attribute:"mentionssuffix",reflect:!0})],o.prototype,"mentionsSuffix",void 0),t([r({attribute:"mentionsdata",reflect:!0,converter:{fromAttribute:function fromAttribute(t){if(!t)return[];try{var _e2=JSON.parse(t);return Array.isArray(_e2)?_e2.filter(function(t){return t&&"string"==typeof t.key&&"string"==typeof t.label;}):[];}catch(_unused){return[];}},toAttribute:function toAttribute(t){return JSON.stringify(t!==null&&t!==void 0?t:[]);}}})],o.prototype,"mentionsData",void 0),o=t([i("nile-rte-mentions-item")],o);}};});
2
+ //# sourceMappingURL=nile-rte-mentions-item.cjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nile-rte-mentions-item.cjs.js","sources":["../../../src/nile-rich-text-editor/nile-rte-mentions-item.ts"],"sourcesContent":["import { LitElement } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\n\nexport type MentionItem = { key: string; label: string };\n\n@customElement('nile-rte-mentions-item')\nexport class NileRteMentionsItem extends LitElement {\n protected createRenderRoot() { return this; } \n\n \n @property({ attribute: 'mentionscharacter', reflect: true })\n mentionsCharacter: string = '';\n\n \n @property({ attribute: 'mentionscolor', reflect: true })\n mentionsColor: string = ''; \n \n\n@property({ attribute: 'mentionsprefix', reflect: true }) mentionsPrefix: string = '';\n@property({ attribute: 'mentionssuffix', reflect: true }) mentionsSuffix: string = '';\n\n\n @property({\n attribute: 'mentionsdata',\n reflect: true,\n converter: {\n fromAttribute: (value: string | null): MentionItem[] => {\n if (!value) return [];\n try {\n const parsed = JSON.parse(value);\n return Array.isArray(parsed)\n ? parsed.filter(i => i && typeof i.key === 'string' && typeof i.label === 'string')\n : [];\n } catch { return []; }\n },\n toAttribute: (v: MentionItem[]) => JSON.stringify(v ?? []),\n }\n })\n mentionsData: MentionItem[] = [];\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nile-rte-mentions-item': NileRteMentionsItem;\n }\n}\n"],"names":["NileRteMentionsItem","o","constructor","this","mentionsCharacter","mentionsColor","mentionsPrefix","mentionsSuffix","mentionsData","_this","_inherits","_e","_createClass","key","value","createRenderRoot","LitElement","__decorate","property","attribute","reflect","prototype","converter","fromAttribute","parsed","JSON","parse","Array","isArray","filter","i","label","_unused","toAttribute","v","stringify","customElement"],"mappings":"gyFAMaA,CAAAA,uBAAAA,EAAAA,EAAN,SAAAC,EAAA,CAAAC,KAAAA,KAAAA,CAAAA,eAAAA,MAAAA,CAAAA,mCAKLC,EAAAA,KAAAA,CAAiBC,iBAAW,CAAA,EAAA,CAI5BD,KAAAA,CAAaE,aAAAA,CAAW,EAGiCF,CAAAA,KAAAA,CAAcG,eAAW,EACzBH,CAAAA,KAAAA,CAAcI,cAAW,CAAA,EAAA,CAmBlFJ,KAAAA,CAAYK,YAAAA,CAAkB,EAC/B,QAAAC,KAAA,EAhCWC,SAAA,CAAAT,CAAA,CAAAU,EAAA,SAAAC,YAAA,CAAAX,CAAA,GAAAY,GAAA,oBAAAC,KAAA,UAAAC,gBAAAA,CAAAA,CAAqB,CAAA,MAAOZ,KAAO,EAAA,MADNa,CAAAA,EAKvCC,CAAA,CAAA,CADCC,CAAS,CAAA,CAAEC,UAAW,mBAAqBC,CAAAA,OAAAA,CAAAA,CAAS,CACtBpB,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAqB,SAAA,CAAA,mBAAA,CAAA,IAAA,EAI/BJ,CAAAA,CAAAA,CAAAA,CAAA,CADCC,CAAS,CAAA,CAAEC,SAAW,CAAA,eAAA,CAAiBC,OAAS,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CACtBpB,CAAAqB,CA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AA,IAAA,EAhCtBrB,CAAAA,CAAAA,CAAAA,CAAmBiB,CAAA,CAAA,CAD/BmB,EAAc,wBACFpC,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA"}
@@ -0,0 +1 @@
1
+ import{__decorate as t}from"tslib";import{LitElement as e}from"lit";import{property as r,customElement as i}from"lit/decorators.js";let o=class extends e{constructor(){super(...arguments),this.mentionsCharacter="",this.mentionsColor="",this.mentionsPrefix="",this.mentionsSuffix="",this.mentionsData=[]}createRenderRoot(){return this}};t([r({attribute:"mentionscharacter",reflect:!0})],o.prototype,"mentionsCharacter",void 0),t([r({attribute:"mentionscolor",reflect:!0})],o.prototype,"mentionsColor",void 0),t([r({attribute:"mentionsprefix",reflect:!0})],o.prototype,"mentionsPrefix",void 0),t([r({attribute:"mentionssuffix",reflect:!0})],o.prototype,"mentionsSuffix",void 0),t([r({attribute:"mentionsdata",reflect:!0,converter:{fromAttribute:t=>{if(!t)return[];try{const e=JSON.parse(t);return Array.isArray(e)?e.filter((t=>t&&"string"==typeof t.key&&"string"==typeof t.label)):[]}catch{return[]}},toAttribute:t=>JSON.stringify(t??[])}})],o.prototype,"mentionsData",void 0),o=t([i("nile-rte-mentions-item")],o);
@@ -0,0 +1,3 @@
1
+ System.register(["tslib","lit","lit/decorators.js"],function(_export,_context){"use strict";var t,i,s,e,n,o;function _typeof(o){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(o){return typeof o;}:function(o){return o&&"function"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o;},_typeof(o);}function ownKeys(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);r&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable;})),t.push.apply(t,o);}return t;}function _objectSpread(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?ownKeys(Object(t),!0).forEach(function(r){_defineProperty(e,r,t[r]);}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):ownKeys(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r));});}return e;}function _defineProperty(e,r,t){return(r=_toPropertyKey(r))in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e;}function _classCallCheck(a,n){if(!(a instanceof n))throw new TypeError("Cannot call a class as a function");}function _defineProperties(e,r){for(var t=0;t<r.length;t++){var o=r[t];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,_toPropertyKey(o.key),o);}}function _createClass(e,r,t){return r&&_defineProperties(e.prototype,r),t&&_defineProperties(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e;}function _toPropertyKey(t){var i=_toPrimitive(t,"string");return"symbol"==_typeof(i)?i:i+"";}function _toPrimitive(t,r){if("object"!=_typeof(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,r||"default");if("object"!=_typeof(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.");}return("string"===r?String:Number)(t);}function _callSuper(t,o,e){return o=_getPrototypeOf(o),_possibleConstructorReturn(t,_isNativeReflectConstruct()?Reflect.construct(o,e||[],_getPrototypeOf(t).constructor):o.apply(t,e));}function _possibleConstructorReturn(t,e){if(e&&("object"==_typeof(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized(t);}function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e;}function _isNativeReflectConstruct(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));}catch(t){}return(_isNativeReflectConstruct=function _isNativeReflectConstruct(){return!!t;})();}function _superPropGet(t,o,e,r){var p=_get(_getPrototypeOf(1&r?t.prototype:t),o,e);return 2&r&&"function"==typeof p?function(t){return p.apply(e,t);}:p;}function _get(){return _get="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,r){var p=_superPropBase(e,t);if(p){var n=Object.getOwnPropertyDescriptor(p,t);return n.get?n.get.call(arguments.length<3?e:r):n.value;}},_get.apply(null,arguments);}function _superPropBase(t,o){for(;!{}.hasOwnProperty.call(t,o)&&null!==(t=_getPrototypeOf(t)););return t;}function _getPrototypeOf(t){return _getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t);},_getPrototypeOf(t);}function _inherits(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&_setPrototypeOf(t,e);}function _setPrototypeOf(t,e){return _setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t;},_setPrototypeOf(t,e);}return{setters:[function(_tslib){t=_tslib.__decorate;},function(_lit){i=_lit.LitElement;},function(_litDecoratorsJs){s=_litDecoratorsJs.property;e=_litDecoratorsJs.state;n=_litDecoratorsJs.customElement;}],execute:function execute(){o=/*#__PURE__*/function(_i){function o(){var _this;_classCallCheck(this,o);_this=_callSuper(this,o,arguments),_this.displayFormat=!1,_this.mentions={},_this.mentionFormat={},_this.itemsFormats={},_this.mentionColors={},_this.externalConfig={},_this.itemsConfig={},_this.mentionActiveIndex=-1,_this.itemsColors={},_this.editorEl=null,_this.hostEl=null,_this.dropdownEl=null,_this.menuEl=null,_this.lastRange=null,_this.mentionOpen=!1,_this.mentionTrigger=null,_this.mentionQuery="",_this.mentionSuggestions=[],_this.mentionFiltered=[],_this.mentionX=0,_this.mentionY=0,_this.triggerBtn=null,_this.mo=null,_this.onSelectionChange=function(){if(!_this.editorEl)return;var t=document.getSelection();if(!t||0===t.rangeCount)return;var i=t.getRangeAt(0);_this.editorEl.contains(i.commonAncestorContainer)&&(_this.lastRange=i.cloneRange());},_this.saveSelection=function(){var t=window.getSelection();t&&t.rangeCount&&(_this.lastRange=t.getRangeAt(0).cloneRange());},_this.onEditorInput=function(){_this.mentionOpen&&_this.handleMention();},_this.onEditorKeyUp=function(t){_this.saveSelection();var i=t.key,s=_this.config;!_this.mentionOpen&&i&&s[i]?_this.openMention(i):_this.mentionOpen&&_this.handleMention();},_this.onEditorKeyDown=function(t){if(!_this.mentionOpen)return;var i=t.key;if("ArrowDown"===i||"ArrowUp"===i){if(t.preventDefault(),!_this.mentionFiltered.length)return;_this.mentionActiveIndex="ArrowDown"===i?(_this.mentionActiveIndex+1)%_this.mentionFiltered.length:(_this.mentionActiveIndex-1+_this.mentionFiltered.length)%_this.mentionFiltered.length,_this.renderMentionList();}else"Enter"===i?_this.mentionActiveIndex>=0&&_this.mentionFiltered[_this.mentionActiveIndex]&&(t.preventDefault(),_this.selectMention(_this.mentionFiltered[_this.mentionActiveIndex])):"Escape"===i&&(t.preventDefault(),_this.closeMention());},_this.repositionMention=function(){if(!_this.mentionOpen||!_this.hostEl||!_this.triggerBtn)return;var t=_this.getCaretClientRect();if(!t)return;var i=_this.hostEl.getBoundingClientRect();_this.mentionX=t.left-i.left,_this.mentionY=t.bottom-i.top,_this.triggerBtn.style.left="".concat(_this.mentionX,"px"),_this.triggerBtn.style.top="".concat(_this.mentionY,"px");};return _this;}_inherits(o,_i);return _createClass(o,[{key:"createRenderRoot",value:function createRenderRoot(){return this;}},{key:"getTriggerFormat",value:function getTriggerFormat(t){var _ref,_i$prefix,_ref2,_i$suffix;var i=this.itemsFormats[t]||{},s=this.mentionFormat[t]||{};return{prefix:(_ref=(_i$prefix=i.prefix)!==null&&_i$prefix!==void 0?_i$prefix:s.prefix)!==null&&_ref!==void 0?_ref:"",suffix:(_ref2=(_i$suffix=i.suffix)!==null&&_i$suffix!==void 0?_i$suffix:s.suffix)!==null&&_ref2!==void 0?_ref2:""};}},{key:"formatLabel",value:function formatLabel(t,i){var _this$getTriggerForma=this.getTriggerFormat(t),s=_this$getTriggerForma.prefix,e=_this$getTriggerForma.suffix;return"".concat(s!==null&&s!==void 0?s:"").concat(i).concat(e!==null&&e!==void 0?e:"");}},{key:"config",get:function get(){return _objectSpread(_objectSpread(_objectSpread({},this.externalConfig),this.mentions),this.itemsConfig);}},{key:"attach",value:function attach(t,i){var _this2=this;this.editorEl=t,this.hostEl=i,this.injectStyles(),this.ensureMentionDropdown(),this.rebuildConfigFromChildren(),this.mo=new MutationObserver(function(){return _this2.rebuildConfigFromChildren();}),this.mo.observe(this,{childList:!0,subtree:!0,attributes:!0}),this.editorEl.addEventListener("input",this.onEditorInput),this.editorEl.addEventListener("mouseup",this.saveSelection),this.editorEl.addEventListener("keyup",this.onEditorKeyUp),this.editorEl.addEventListener("keydown",this.onEditorKeyDown),this.editorEl.addEventListener("scroll",this.repositionMention),document.addEventListener("selectionchange",this.onSelectionChange,!0);}},{key:"detach",value:function detach(){this.mo&&(this.mo.disconnect(),this.mo=null),this.editorEl&&(this.editorEl.removeEventListener("input",this.onEditorInput),this.editorEl.removeEventListener("mouseup",this.saveSelection),this.editorEl.removeEventListener("keyup",this.onEditorKeyUp),this.editorEl.removeEventListener("keydown",this.onEditorKeyDown),this.editorEl.removeEventListener("scroll",this.repositionMention)),document.removeEventListener("selectionchange",this.onSelectionChange,!0);}},{key:"setExternalConfig",value:function setExternalConfig(t){this.externalConfig=t||{};}},{key:"disconnectedCallback",value:function disconnectedCallback(){this.detach(),_superPropGet(o,"disconnectedCallback",this,3)([]);}},{key:"rebuildConfigFromChildren",value:function rebuildConfigFromChildren(){var t={},i={},s={},e=Array.from(this.querySelectorAll("nile-rte-mentions-item"));var _loop=function _loop(){var _ref3,_n$mentionsCharacter,_n$mentionsData,_ref4,_n$mentionsColor,_ref5,_n$mentionsPrefix,_ref6,_n$mentionsSuffix;var n=_e[_i2];var e=(_ref3=(_n$mentionsCharacter=n.mentionsCharacter)!==null&&_n$mentionsCharacter!==void 0?_n$mentionsCharacter:n.getAttribute("mentionscharacter"))!==null&&_ref3!==void 0?_ref3:"";if(!e||"string"!=typeof e)return 1;// continue
2
+ var _o=(_n$mentionsData=n.mentionsData)!==null&&_n$mentionsData!==void 0?_n$mentionsData:function(){var t=n.getAttribute("mentionsdata");if(!t)return null;try{var _i3=JSON.parse(t);return Array.isArray(_i3)?_i3.filter(function(t){return t&&"string"==typeof t.key&&"string"==typeof t.label;}):[];}catch(_unused){return[];}}();var h=(_ref4=(_n$mentionsColor=n.mentionsColor)!==null&&_n$mentionsColor!==void 0?_n$mentionsColor:n.getAttribute("mentionscolor"))!==null&&_ref4!==void 0?_ref4:"",r=(_ref5=(_n$mentionsPrefix=n.mentionsPrefix)!==null&&_n$mentionsPrefix!==void 0?_n$mentionsPrefix:n.getAttribute("mentionsprefix"))!==null&&_ref5!==void 0?_ref5:"",u=(_ref6=(_n$mentionsSuffix=n.mentionsSuffix)!==null&&_n$mentionsSuffix!==void 0?_n$mentionsSuffix:n.getAttribute("mentionssuffix"))!==null&&_ref6!==void 0?_ref6:"";Array.isArray(_o)||(_o=[]),t[e]=_o,h&&(i[e]=String(h)),(r||u)&&(s[e]={prefix:r,suffix:u});};for(var _i2=0,_e=e;_i2<_e.length;_i2++){if(_loop())continue;}this.itemsConfig=t,this.itemsColors=i,this.itemsFormats=s;}},{key:"injectStyles",value:function injectStyles(){if(this.querySelector("style[data-mentions-style]"))return;var t=document.createElement("style");t.setAttribute("data-mentions-style","true"),t.textContent="\n .mention-dropdown {\n position: absolute; z-index: 1000; list-style: none; margin: 0; padding: 4px;\n border: 1px solid #e5e7eb; border-radius: 6px; background: #fff;\n box-shadow: 0 4px 10px rgba(0,0,0,.08); max-height: 180px; overflow: auto; font-size: 14px;\n }\n .mention-dropdown li { padding: 6px 8px; cursor: pointer; border-radius: 4px; }\n .mention-dropdown li:hover { background: #f1f5f9; }\n .mention { background: #eef2ff; padding: 0 3px; border-radius: 3px; }\n nile-menu.mentions-menu::part(menu__items-wrapper){\n max-height: 260px;\n overflow-y: auto;\n }\n .mentions-menu nile-menu-item.active {\n background: #dbeafe; /* highlight */\n outline: none;\n}\n\n\n ",this.insertBefore(t,this.firstChild);}},{key:"getTriggerColor",value:function getTriggerColor(t){var _this$itemsColors$t;return(_this$itemsColors$t=this.itemsColors[t])!==null&&_this$itemsColors$t!==void 0?_this$itemsColors$t:this.mentionColors[t];}},{key:"ensureMentionDropdown",value:function ensureMentionDropdown(){if(this.dropdownEl||!this.hostEl)return;var t=document.createElement("nile-dropdown");t.style.zIndex="1000";var i=document.createElement("nile-button");i.setAttribute("slot","trigger"),i.style.position="absolute",i.style.width="1px",i.style.height="1px",i.style.border="0",i.style.padding="0",i.style.opacity="0",i.style.pointerEvents="none",t.appendChild(i),this.triggerBtn=i;var s=document.createElement("nile-menu");s.classList.add("mentions-menu"),t.appendChild(s),this.hostEl.appendChild(t),this.dropdownEl=t,this.menuEl=s;}},{key:"restoreSelection",value:function restoreSelection(){if(!this.lastRange)return;var t=document.getSelection();t&&(t.removeAllRanges(),t.addRange(this.lastRange));}},{key:"focusAndRestore",value:function focusAndRestore(){var _this$editorEl;(_this$editorEl=this.editorEl)!==null&&_this$editorEl!==void 0&&_this$editorEl.focus(),this.restoreSelection();}},{key:"getCaretClientRect",value:function getCaretClientRect(){var t=document.getSelection();if(!t||0===t.rangeCount)return null;var i=t.getRangeAt(0).cloneRange();i.collapse(!1);var s=i.getClientRects();if(s&&s.length>0)return s[0];var e=document.createElement("span");e.setAttribute("data-caret-marker","1"),e.textContent="​",i.insertNode(e);var n=e.getBoundingClientRect(),_o2=document.createRange();return _o2.setStartAfter(e),_o2.collapse(!0),t.removeAllRanges(),t.addRange(_o2),e.remove(),n||null;}},{key:"openMention",value:function openMention(t){if(this.saveSelection(),!this.editorEl||!this.dropdownEl||!this.hostEl)return;var i=this.getCaretClientRect();if(!i)return;var s=this.hostEl.getBoundingClientRect();this.mentionX=i.left-s.left,this.mentionY=i.bottom-s.top,this.mentionTrigger=t,this.mentionSuggestions=this.config[t]||[],this.mentionQuery="",this.updateMentionFiltered(),this.mentionActiveIndex=this.mentionFiltered.length?0:-1,this.mentionOpen=!0,this.renderMentionList(),this.dispatchEvent(new CustomEvent("nile-mention-opened",{detail:{trigger:t,suggestions:this.mentionSuggestions},bubbles:!0,composed:!0}));}},{key:"closeMention",value:function closeMention(){var _this$dropdownEl;this.mentionOpen=!1,this.mentionTrigger=null,this.mentionQuery="",this.mentionFiltered=[],(_this$dropdownEl=this.dropdownEl)===null||_this$dropdownEl===void 0?void 0:_this$dropdownEl.removeAttribute("open");}},{key:"handleMention",value:function handleMention(){if(!this.mentionOpen||!this.mentionTrigger)return;var t=window.getSelection();if(!t||!t.anchorNode)return;var i=t.anchorNode;if(i.nodeType!==Node.TEXT_NODE){var _i$childNodes;var _s=((_i$childNodes=i.childNodes)===null||_i$childNodes===void 0?void 0:_i$childNodes[t.anchorOffset])||i.firstChild;(_s===null||_s===void 0?void 0:_s.nodeType)===Node.TEXT_NODE&&(i=_s);}var s=i&&i.nodeType===Node.TEXT_NODE&&i.textContent||"",e=s.lastIndexOf(this.mentionTrigger);e>=0?(this.mentionQuery=s.substring(e+1),this.updateMentionFiltered(),this.renderMentionList()):this.closeMention();}},{key:"updateMentionFiltered",value:function updateMentionFiltered(){var t=this.mentionQuery.toLowerCase();this.mentionFiltered=(this.mentionSuggestions||[]).filter(function(i){return i.label.toLowerCase().startsWith(t);});}},{key:"renderMentionList",value:function renderMentionList(){var _this3=this;this.dropdownEl&&this.menuEl&&this.triggerBtn&&(this.triggerBtn.style.left="".concat(this.mentionX,"px"),this.triggerBtn.style.top="".concat(this.mentionY,"px"),this.menuEl.innerHTML="",this.mentionOpen&&this.mentionFiltered.length?(this.mentionFiltered.forEach(function(t,i){var _this3$menuEl;var s=document.createElement("nile-menu-item");s.textContent=t.label,s.setAttribute("role","option"),i===_this3.mentionActiveIndex?(s.classList.add("active"),s.setAttribute("aria-selected","true")):(s.classList.remove("active"),s.removeAttribute("aria-selected")),s.addEventListener("mouseenter",function(){_this3.mentionActiveIndex=i,_this3.renderMentionList();}),s.addEventListener("mousedown",function(i){i.preventDefault(),_this3.selectMention(t);}),(_this3$menuEl=_this3.menuEl)===null||_this3$menuEl===void 0?void 0:_this3$menuEl.appendChild(s);}),this.dropdownEl.setAttribute("open","")):this.dropdownEl.removeAttribute("open"));}},{key:"selectMention",value:function selectMention(t){var _c$prefix,_c$suffix,_c$prefix2,_c$suffix2;if(this.restoreSelection(),!this.lastRange||!this.mentionTrigger||!this.editorEl)return;var i=this.mentionTrigger;var s=this.lastRange.startContainer,e=this.lastRange.startOffset;if(s.nodeType!==Node.TEXT_NODE){var _t=s.childNodes[e];if((_t===null||_t===void 0?void 0:_t.nodeType)!==Node.TEXT_NODE)return;s=_t,e=0;}var n=s,_o3=(n.textContent||"").lastIndexOf(this.mentionTrigger,e);if(_o3<0)return;var h=_o3+1+this.mentionQuery.length,r=document.createRange();r.setStart(n,_o3),r.setEnd(n,h),r.deleteContents();var u=document.createElement("span");u.classList.add("mention");var c=this.getTriggerFormat(this.mentionTrigger);this.displayFormat?u.textContent="".concat((_c$prefix=c.prefix)!==null&&_c$prefix!==void 0?_c$prefix:"").concat(t.label).concat((_c$suffix=c.suffix)!==null&&_c$suffix!==void 0?_c$suffix:""):(u.textContent="".concat(this.mentionTrigger).concat(t.label),c.prefix&&u.setAttribute("data-mention-prefix",c.prefix),c.suffix&&u.setAttribute("data-mention-suffix",c.suffix)),u.setAttribute("data-mention-key",t.key),u.setAttribute("data-mention-label",t.label),u.setAttribute("data-mention-trigger",this.mentionTrigger);var l=this.getTriggerColor(this.mentionTrigger);l&&(u.style.backgroundColor=l),r.insertNode(u);var d=document.createTextNode(" ");u.after(d);var a=window.getSelection(),m=document.createRange();m.setStartAfter(d),m.collapse(!0),a!==null&&a!==void 0&&a.removeAllRanges(),a!==null&&a!==void 0&&a.addRange(m),this.lastRange=m.cloneRange(),this.closeMention(),this.dispatchEvent(new CustomEvent("nile-mention-selected",{detail:{trigger:i,key:t.key,label:t.label,prefix:(_c$prefix2=c.prefix)!==null&&_c$prefix2!==void 0?_c$prefix2:"",suffix:(_c$suffix2=c.suffix)!==null&&_c$suffix2!==void 0?_c$suffix2:""},bubbles:!0,composed:!0})),this.editorEl.dispatchEvent(new InputEvent("input",{bubbles:!0}));}}]);}(i);t([s({type:Boolean,attribute:"displayformat",reflect:!0})],o.prototype,"displayFormat",void 0),t([s({attribute:"mentions",converter:{fromAttribute:function fromAttribute(t){try{var _i4=JSON.parse(t),_s2={};for(var _i5=0,_Object$keys=Object.keys(_i4);_i5<_Object$keys.length;_i5++){var _t2=_Object$keys[_i5];var _e2=_i4[_t2];Array.isArray(_e2)&&(_s2[_t2]=_e2.filter(function(t){return t&&"string"==typeof t.key&&"string"==typeof t.label;}).map(function(t){return{key:t.key,label:t.label};}));}return _s2;}catch(_unused2){return{};}},toAttribute:function toAttribute(t){return JSON.stringify(t);}}})],o.prototype,"mentions",void 0),t([s({attribute:"mentionformat",converter:{fromAttribute:function fromAttribute(t){try{var _i6=JSON.parse(t);return _i6&&"object"==_typeof(_i6)?_i6:{};}catch(_unused3){return{};}},toAttribute:function toAttribute(t){return JSON.stringify(t!==null&&t!==void 0?t:{});}}})],o.prototype,"mentionFormat",void 0),t([e()],o.prototype,"itemsFormats",void 0),t([s({attribute:"mentioncolors",converter:{fromAttribute:function fromAttribute(t){try{var _i7=JSON.parse(t);return _i7&&"object"==_typeof(_i7)?_i7:{};}catch(_unused4){return{};}},toAttribute:function toAttribute(t){return JSON.stringify(t!==null&&t!==void 0?t:{});}}})],o.prototype,"mentionColors",void 0),t([e()],o.prototype,"externalConfig",void 0),t([e()],o.prototype,"itemsConfig",void 0),t([e()],o.prototype,"mentionActiveIndex",void 0),t([e()],o.prototype,"itemsColors",void 0),o=t([n("nile-rte-mentions")],o);}};});
3
+ //# sourceMappingURL=nile-rte-mentions.cjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nile-rte-mentions.cjs.js","sources":["../../../src/nile-rich-text-editor/nile-rte-mentions.ts"],"sourcesContent":["import { LitElement } from 'lit';\nimport { customElement, property, state } from 'lit/decorators.js';\nimport type { MentionItem } from './nile-rte-mentions-item';\n\ntype MentionsConfig = Record<string, MentionItem[]>;\n\n@customElement('nile-rte-mentions')\nexport class NileRteMentions extends LitElement {\n protected createRenderRoot() {\n return this;\n }\n\n @property({ type: Boolean, attribute: 'displayformat' , reflect: true})\n displayFormat = false;\n\n @property({\n attribute: 'mentions',\n converter: {\n fromAttribute: (value: string): MentionsConfig => {\n try {\n const parsed = JSON.parse(value);\n const out: MentionsConfig = {};\n for (const trig of Object.keys(parsed)) {\n const arr = parsed[trig];\n if (Array.isArray(arr)) {\n out[trig] = arr\n .filter(\n i =>\n i &&\n typeof i.key === 'string' &&\n typeof i.label === 'string'\n )\n .map(i => ({ key: i.key, label: i.label }));\n }\n }\n return out;\n } catch {\n return {};\n }\n },\n toAttribute: (v: MentionsConfig) => JSON.stringify(v),\n },\n })\n mentions: MentionsConfig = {};\n\n // nile-rte-mentions.ts (inside class)\n\n @property({\n attribute: 'mentionformat',\n converter: {\n fromAttribute: (\n v: string\n ): Record<string, { prefix?: string; suffix?: string }> => {\n try {\n const o = JSON.parse(v);\n return o && typeof o === 'object' ? o : {};\n } catch {\n return {};\n }\n },\n toAttribute: (v: Record<string, { prefix?: string; suffix?: string }>) =>\n JSON.stringify(v ?? {}),\n },\n })\n mentionFormat: Record<string, { prefix?: string; suffix?: string }> = {};\n\n @state() private itemsFormats: Record<\n string,\n { prefix?: string; suffix?: string }\n > = {};\n\n private getTriggerFormat(trigger: string): {\n prefix: string;\n suffix: string;\n } {\n const fromItems = this.itemsFormats[trigger] || {};\n const fromAttr = this.mentionFormat[trigger] || {};\n return {\n prefix: fromItems.prefix ?? fromAttr.prefix ?? '',\n suffix: fromItems.suffix ?? fromAttr.suffix ?? '',\n };\n }\n\n private formatLabel(trigger: string, rawLabel: string): string {\n const { prefix, suffix } = this.getTriggerFormat(trigger);\n return `${prefix ?? ''}${rawLabel}${suffix ?? ''}`;\n }\n\n @property({\n attribute: 'mentioncolors',\n converter: {\n fromAttribute: (value: string): Record<string, string> => {\n try {\n const o = JSON.parse(value);\n return o && typeof o === 'object' ? o : {};\n } catch {\n return {};\n }\n },\n toAttribute: (v: Record<string, string>) => JSON.stringify(v ?? {}),\n },\n })\n mentionColors: Record<string, string> = {};\n\n @state() private externalConfig: MentionsConfig = {};\n\n @state() private itemsConfig: MentionsConfig = {};\n\n @state() private mentionActiveIndex: number = -1;\n\n @state() private itemsColors: Record<string, string> = {};\n\n private get config(): MentionsConfig {\n return { ...this.externalConfig, ...this.mentions, ...this.itemsConfig };\n }\n\n // wired from editor\n private editorEl: HTMLElement | null = null;\n private hostEl: HTMLElement | null = null;\n\n private dropdownEl: HTMLElement | null = null;\n private menuEl: HTMLElement | null = null;\n\n private lastRange: Range | null = null;\n\n private mentionOpen = false;\n private mentionTrigger: string | null = null;\n private mentionQuery = '';\n private mentionSuggestions: MentionItem[] = [];\n private mentionFiltered: MentionItem[] = [];\n private mentionX = 0;\n private mentionY = 0;\n private triggerBtn: HTMLElement | null = null;\n\n private mo: MutationObserver | null = null;\n\n attach(editorEl: HTMLElement, hostEl: HTMLElement) {\n this.editorEl = editorEl;\n this.hostEl = hostEl;\n\n this.injectStyles();\n this.ensureMentionDropdown();\n this.rebuildConfigFromChildren();\n\n this.mo = new MutationObserver(() => this.rebuildConfigFromChildren());\n this.mo.observe(this, { childList: true, subtree: true, attributes: true });\n\n this.editorEl.addEventListener('input', this.onEditorInput);\n this.editorEl.addEventListener('mouseup', this.saveSelection);\n this.editorEl.addEventListener('keyup', this.onEditorKeyUp);\n this.editorEl.addEventListener('keydown', this.onEditorKeyDown);\n this.editorEl.addEventListener('scroll', this.repositionMention);\n\n document.addEventListener('selectionchange', this.onSelectionChange, true);\n }\n\n detach() {\n if (this.mo) {\n this.mo.disconnect();\n this.mo = null;\n }\n if (this.editorEl) {\n this.editorEl.removeEventListener('input', this.onEditorInput);\n this.editorEl.removeEventListener('mouseup', this.saveSelection);\n this.editorEl.removeEventListener('keyup', this.onEditorKeyUp);\n this.editorEl.removeEventListener('keydown', this.onEditorKeyDown);\n this.editorEl.removeEventListener('scroll', this.repositionMention);\n }\n document.removeEventListener(\n 'selectionchange',\n this.onSelectionChange,\n true\n );\n }\n\n setExternalConfig(cfg: MentionsConfig) {\n this.externalConfig = cfg || {};\n }\n\n disconnectedCallback(): void {\n this.detach();\n super.disconnectedCallback();\n }\n\n private rebuildConfigFromChildren() {\n const cfg: MentionsConfig = {};\n const colors: Record<string, string> = {};\n const formats: Record<string, { prefix?: string; suffix?: string }> = {};\n\n const items = Array.from(\n this.querySelectorAll('nile-rte-mentions-item')\n ) as Array<\n HTMLElement & {\n mentionsCharacter?: string;\n mentionsData?: MentionItem[];\n mentionsColor?: string;\n }\n >;\n\n for (const item of items) {\n const trig =\n (item as any).mentionsCharacter ??\n item.getAttribute('mentionscharacter') ??\n '';\n\n if (!trig || typeof trig !== 'string') continue;\n\n let data: MentionItem[] | null =\n (item as any).mentionsData ??\n (() => {\n const raw = item.getAttribute('mentionsdata');\n if (!raw) return null;\n try {\n const parsed = JSON.parse(raw);\n return Array.isArray(parsed)\n ? parsed.filter(\n i =>\n i &&\n typeof i.key === 'string' &&\n typeof i.label === 'string'\n )\n : [];\n } catch {\n return [];\n }\n })();\n\n const color =\n (item as any).mentionsColor ?? item.getAttribute('mentionscolor') ?? '';\n\n const prefix =\n (item as any).mentionsPrefix ??\n item.getAttribute('mentionsprefix') ??\n '';\n const suffix =\n (item as any).mentionsSuffix ??\n item.getAttribute('mentionssuffix') ??\n '';\n\n if (!Array.isArray(data)) data = [];\n cfg[trig] = data;\n if (color) colors[trig] = String(color);\n if (prefix || suffix) formats[trig] = { prefix, suffix };\n }\n\n this.itemsConfig = cfg;\n this.itemsColors = colors;\n this.itemsFormats = formats;\n }\n\n private injectStyles() {\n if (this.querySelector('style[data-mentions-style]')) return;\n const style = document.createElement('style');\n style.setAttribute('data-mentions-style', 'true');\n style.textContent = `\n .mention-dropdown {\n position: absolute; z-index: 1000; list-style: none; margin: 0; padding: 4px;\n border: 1px solid #e5e7eb; border-radius: 6px; background: #fff;\n box-shadow: 0 4px 10px rgba(0,0,0,.08); max-height: 180px; overflow: auto; font-size: 14px;\n }\n .mention-dropdown li { padding: 6px 8px; cursor: pointer; border-radius: 4px; }\n .mention-dropdown li:hover { background: #f1f5f9; }\n .mention { background: #eef2ff; padding: 0 3px; border-radius: 3px; }\n nile-menu.mentions-menu::part(menu__items-wrapper){\n max-height: 260px;\n overflow-y: auto;\n }\n .mentions-menu nile-menu-item.active {\n background: #dbeafe; /* highlight */\n outline: none;\n}\n\n\n `;\n this.insertBefore(style, this.firstChild);\n }\n\n private getTriggerColor(trigger: string): string | undefined {\n return this.itemsColors[trigger] ?? this.mentionColors[trigger];\n }\n\n private ensureMentionDropdown() {\n if (this.dropdownEl || !this.hostEl) return;\n\n const dd = document.createElement('nile-dropdown');\n dd.style.zIndex = '1000';\n\n const btn = document.createElement('nile-button');\n btn.setAttribute('slot', 'trigger');\n btn.style.position = 'absolute';\n btn.style.width = '1px';\n btn.style.height = '1px';\n btn.style.border = '0';\n btn.style.padding = '0';\n btn.style.opacity = '0';\n btn.style.pointerEvents = 'none';\n dd.appendChild(btn);\n this.triggerBtn = btn;\n const menu = document.createElement('nile-menu');\n menu.classList.add('mentions-menu');\n dd.appendChild(menu);\n\n this.hostEl.appendChild(dd);\n this.dropdownEl = dd;\n this.menuEl = menu;\n }\n\n private onSelectionChange = () => {\n if (!this.editorEl) return;\n const sel = document.getSelection();\n if (!sel || sel.rangeCount === 0) return;\n const range = sel.getRangeAt(0);\n if (this.editorEl.contains(range.commonAncestorContainer)) {\n this.lastRange = range.cloneRange();\n }\n };\n private saveSelection = () => {\n const sel = window.getSelection();\n if (sel && sel.rangeCount) this.lastRange = sel.getRangeAt(0).cloneRange();\n };\n private restoreSelection() {\n if (!this.lastRange) return;\n const sel = document.getSelection();\n if (!sel) return;\n sel.removeAllRanges();\n sel.addRange(this.lastRange);\n }\n private focusAndRestore() {\n this.editorEl?.focus();\n this.restoreSelection();\n }\n\n private getCaretClientRect(): DOMRect | null {\n const sel = document.getSelection();\n if (!sel || sel.rangeCount === 0) return null;\n\n const range = sel.getRangeAt(0).cloneRange();\n range.collapse(false);\n\n const rects = range.getClientRects();\n if (rects && rects.length > 0) return rects[0];\n\n const marker = document.createElement('span');\n marker.setAttribute('data-caret-marker', '1');\n marker.textContent = '\\u200B';\n range.insertNode(marker);\n\n const rect = marker.getBoundingClientRect();\n\n const after = document.createRange();\n after.setStartAfter(marker);\n after.collapse(true);\n sel.removeAllRanges();\n sel.addRange(after);\n marker.remove();\n\n return rect || null;\n }\n\n private onEditorInput = () => {\n if (this.mentionOpen) this.handleMention();\n };\n\n private onEditorKeyUp = (e: KeyboardEvent) => {\n this.saveSelection();\n const key = e.key;\n const cfg = this.config;\n if (!this.mentionOpen && key && cfg[key]) {\n this.openMention(key);\n return;\n }\n if (this.mentionOpen) this.handleMention();\n };\n\n private onEditorKeyDown = (e: KeyboardEvent) => {\n if (!this.mentionOpen) return;\n const key = e.key;\n\n if (key === 'ArrowDown' || key === 'ArrowUp') {\n e.preventDefault();\n if (!this.mentionFiltered.length) return;\n\n if (key === 'ArrowDown') {\n this.mentionActiveIndex =\n (this.mentionActiveIndex + 1) % this.mentionFiltered.length;\n } else {\n this.mentionActiveIndex =\n (this.mentionActiveIndex - 1 + this.mentionFiltered.length) %\n this.mentionFiltered.length;\n }\n\n this.renderMentionList();\n } else if (key === 'Enter') {\n if (\n this.mentionActiveIndex >= 0 &&\n this.mentionFiltered[this.mentionActiveIndex]\n ) {\n e.preventDefault();\n this.selectMention(this.mentionFiltered[this.mentionActiveIndex]);\n }\n } else if (key === 'Escape') {\n e.preventDefault();\n this.closeMention();\n }\n };\n\n private openMention(trigger: string) {\n this.saveSelection();\n if (!this.editorEl || !this.dropdownEl || !this.hostEl) return;\n\n const caretRect = this.getCaretClientRect();\n if (!caretRect) return;\n\n const hostRect = this.hostEl.getBoundingClientRect();\n\n this.mentionX = caretRect.left - hostRect.left;\n this.mentionY = caretRect.bottom - hostRect.top;\n\n this.mentionTrigger = trigger;\n this.mentionSuggestions = this.config[trigger] || [];\n this.mentionQuery = '';\n this.updateMentionFiltered();\n\n this.mentionActiveIndex = this.mentionFiltered.length ? 0 : -1;\n this.mentionOpen = true;\n this.renderMentionList();\n\n this.dispatchEvent(\n new CustomEvent('nile-mention-opened', {\n detail: { trigger, suggestions: this.mentionSuggestions },\n bubbles: true,\n composed: true,\n })\n );\n }\n\n private closeMention() {\n this.mentionOpen = false;\n this.mentionTrigger = null;\n this.mentionQuery = '';\n this.mentionFiltered = [];\n // hide dropdown\n this.dropdownEl?.removeAttribute('open');\n }\n\n private handleMention() {\n if (!this.mentionOpen || !this.mentionTrigger) return;\n const sel = window.getSelection();\n if (!sel || !sel.anchorNode) return;\n\n let node: Node | null = sel.anchorNode;\n if (node.nodeType !== Node.TEXT_NODE) {\n const c =\n (node as HTMLElement).childNodes?.[sel.anchorOffset] || node.firstChild;\n if (c?.nodeType === Node.TEXT_NODE) node = c;\n }\n const text =\n node && node.nodeType === Node.TEXT_NODE ? node.textContent || '' : '';\n const idx = text.lastIndexOf(this.mentionTrigger);\n if (idx >= 0) {\n this.mentionQuery = text.substring(idx + 1);\n this.updateMentionFiltered();\n this.renderMentionList();\n } else {\n this.closeMention();\n }\n }\n\n private updateMentionFiltered() {\n const q = this.mentionQuery.toLowerCase();\n this.mentionFiltered = (this.mentionSuggestions || []).filter(item =>\n item.label.toLowerCase().startsWith(q)\n );\n }\n\n private renderMentionList() {\n if (!this.dropdownEl || !this.menuEl) return;\n if (!this.triggerBtn) return;\n\n this.triggerBtn.style.left = `${this.mentionX}px`;\n this.triggerBtn.style.top = `${this.mentionY}px`;\n\n this.menuEl.innerHTML = '';\n\n if (!this.mentionOpen || !this.mentionFiltered.length) {\n this.dropdownEl.removeAttribute('open');\n return;\n }\n\n this.mentionFiltered.forEach((item, idx) => {\n const mi = document.createElement('nile-menu-item');\n mi.textContent = item.label;\n\n mi.setAttribute('role', 'option');\n if (idx === this.mentionActiveIndex) {\n mi.classList.add('active');\n mi.setAttribute('aria-selected', 'true');\n } else {\n mi.classList.remove('active');\n mi.removeAttribute('aria-selected');\n }\n\n mi.addEventListener('mouseenter', () => {\n this.mentionActiveIndex = idx;\n this.renderMentionList();\n });\n\n mi.addEventListener('mousedown', e => {\n e.preventDefault();\n this.selectMention(item);\n });\n\n this.menuEl?.appendChild(mi);\n });\n\n this.dropdownEl.setAttribute('open', '');\n }\n\n private repositionMention = () => {\n if (!this.mentionOpen || !this.hostEl || !this.triggerBtn) return;\n\n const caretRect = this.getCaretClientRect();\n if (!caretRect) return;\n\n const hostRect = this.hostEl.getBoundingClientRect();\n\n this.mentionX = caretRect.left - hostRect.left;\n this.mentionY = caretRect.bottom - hostRect.top;\n\n this.triggerBtn.style.left = `${this.mentionX}px`;\n this.triggerBtn.style.top = `${this.mentionY}px`;\n };\n\n private selectMention(item: MentionItem) {\n this.restoreSelection();\n if (!this.lastRange || !this.mentionTrigger || !this.editorEl) return;\n\n const trigger = this.mentionTrigger;\n\n let node: Node = this.lastRange.startContainer;\n let offset = this.lastRange.startOffset;\n if (node.nodeType !== Node.TEXT_NODE) {\n const child = node.childNodes[offset];\n if (child?.nodeType === Node.TEXT_NODE) {\n node = child;\n offset = 0;\n } else return;\n }\n\n const textNode = node as Text;\n const text = textNode.textContent || '';\n const atIndex = text.lastIndexOf(this.mentionTrigger, offset);\n if (atIndex < 0) return;\n\n const endIndex = atIndex + 1 + this.mentionQuery.length;\n const mentionRange = document.createRange();\n mentionRange.setStart(textNode, atIndex);\n mentionRange.setEnd(textNode, endIndex);\n mentionRange.deleteContents();\n\n const span = document.createElement('span');\n span.classList.add('mention');\n\n const fmt = this.getTriggerFormat(this.mentionTrigger);\n\n if (this.displayFormat) {\n span.textContent = `${fmt.prefix ?? ''}${item.label}${fmt.suffix ?? ''}`;\n } else {\n span.textContent = `${this.mentionTrigger}${item.label}`;\n if (fmt.prefix) span.setAttribute('data-mention-prefix', fmt.prefix);\n if (fmt.suffix) span.setAttribute('data-mention-suffix', fmt.suffix);\n }\n\n span.setAttribute('data-mention-key', item.key);\n span.setAttribute('data-mention-label', item.label);\n span.setAttribute('data-mention-trigger', this.mentionTrigger!);\n\n const bg = this.getTriggerColor(this.mentionTrigger);\n if (bg) span.style.backgroundColor = bg;\n\n mentionRange.insertNode(span);\n\n const spaceNode = document.createTextNode('\\u00A0');\n span.after(spaceNode);\n\n const sel = window.getSelection();\n const afterRange = document.createRange();\n afterRange.setStartAfter(spaceNode);\n afterRange.collapse(true);\n sel?.removeAllRanges();\n sel?.addRange(afterRange);\n this.lastRange = afterRange.cloneRange();\n\n this.closeMention();\n\n this.dispatchEvent(\n new CustomEvent('nile-mention-selected', {\n detail: {\n trigger,\n key: item.key,\n label: item.label,\n prefix: fmt.prefix ?? '',\n suffix: fmt.suffix ?? '',\n },\n bubbles: true,\n composed: true,\n })\n );\n\n this.editorEl.dispatchEvent(new InputEvent('input', { bubbles: true }));\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nile-rte-mentions': NileRteMentions;\n }\n}\n"],"names":["NileRteMentions","_i","o","constructor","this","displayFormat","mentions","mentionFormat","itemsFormats","mentionColors","externalConfig","itemsConfig","mentionActiveIndex","itemsColors","editorEl","hostEl","dropdownEl","menuEl","lastRange","mentionOpen","mentionTrigger","mentionQuery","mentionSuggestions","mentionFiltered","mentionX","mentionY","triggerBtn","mo","onSelectionChange","sel","document","getSelection","rangeCount","range","getRangeAt","contains","commonAncestorContainer","cloneRange","saveSelection","window","onEditorInput","handleMention","onEditorKeyUp","e","key","cfg","config","openMention","onEditorKeyDown","preventDefault","length","renderMentionList","selectMention","closeMention","repositionMention","caretRect","getCaretClientRect","hostRect","getBoundingClientRect","left","bottom","top","style","concat","_this","_inherits","_createClass","value","createRenderRoot","getTriggerFormat","trigger","fromItems","fromAttr","prefix","_ref","suffix","_ref2","formatLabel","rawLabel","_this$getTriggerForma","get","_objectSpread","attach","injectStyles","ensureMentionDropdown","rebuildConfigFromChildren","MutationObserver","observe","childList","subtree","attributes","addEventListener","detach","disconnect","removeEventListener","setExternalConfig","disconnectedCallback","colors","formats","items","Array","from","querySelectorAll","_loop","_ref3","_n$mentionsCharacter","_n$mentionsData","_ref4","_n$mentionsColor","_ref5","_n$mentionsPrefix","_ref6","_n$mentionsSuffix","item","trig","mentionsCharacter","getAttribute","data","mentionsData","raw","parsed","JSON","parse","isArray","filter","i","label","_unused","color","mentionsColor","mentionsPrefix","mentionsSuffix","String","_i2","_e","querySelector","createElement","setAttribute","textContent","insertBefore","firstChild","getTriggerColor","_this$itemsColors$t","dd","zIndex","btn","position","width","height","border","padding","opacity","pointerEvents","appendChild","menu","classList","add","restoreSelection","removeAllRanges","addRange","focusAndRestore","focus","collapse","rects","getClientRects","marker","insertNode","rect","after","createRange","setStartAfter","remove","updateMentionFiltered","dispatchEvent","CustomEvent","detail","suggestions","bubbles","composed","_this$dropdownEl","removeAttribute","anchorNode","node","nodeType","Node","TEXT_NODE","_i$childNodes","c","childNodes","anchorOffset","text","idx","lastIndexOf","substring","q","toLowerCase","startsWith","innerHTML","forEach","mi","_this3$menuEl","_c$prefix","_c$suffix","_c$prefix2","_c$suffix2","startContainer","offset","startOffset","child","textNode","atIndex","endIndex","mentionRange","setStart","setEnd","deleteContents","span","fmt","bg","backgroundColor","spaceNode","createTextNode","afterRange","InputEvent","LitElement","__decorate","property","type","Boolean","attribute","reflect","prototype","converter","fromAttribute","out","_i5","_Object$keys","Object","keys","arr","map","_unused2","toAttribute","v","stringify","_unused3","state","_unused4","customElement"],"mappings":"6kIAOaA,CAAN,uBAAAC,EAAA,EAAA,SAAAC,EAAA,CAAAC,KAAAA,KAAAA,CAAAA,eAAAA,MAAAA,CAAAA,mCAMLC,EAAAA,KAAAA,CAAaC,eAAG,CA8BhBD,CAA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IAvG/CvO,CAAeiO,CAAAA,CAAAA,CAAA,CAD3BuB,CAAAA,CAAc,mBACFxP,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA"}
@@ -0,0 +1 @@
1
+ import{__decorate as t}from"tslib";import{LitElement as i}from"lit";import{property as s,state as e,customElement as n}from"lit/decorators.js";let o=class extends i{constructor(){super(...arguments),this.displayFormat=!1,this.mentions={},this.mentionFormat={},this.itemsFormats={},this.mentionColors={},this.externalConfig={},this.itemsConfig={},this.mentionActiveIndex=-1,this.itemsColors={},this.editorEl=null,this.hostEl=null,this.dropdownEl=null,this.menuEl=null,this.lastRange=null,this.mentionOpen=!1,this.mentionTrigger=null,this.mentionQuery="",this.mentionSuggestions=[],this.mentionFiltered=[],this.mentionX=0,this.mentionY=0,this.triggerBtn=null,this.mo=null,this.onSelectionChange=()=>{if(!this.editorEl)return;const t=document.getSelection();if(!t||0===t.rangeCount)return;const i=t.getRangeAt(0);this.editorEl.contains(i.commonAncestorContainer)&&(this.lastRange=i.cloneRange())},this.saveSelection=()=>{const t=window.getSelection();t&&t.rangeCount&&(this.lastRange=t.getRangeAt(0).cloneRange())},this.onEditorInput=()=>{this.mentionOpen&&this.handleMention()},this.onEditorKeyUp=t=>{this.saveSelection();const i=t.key,s=this.config;!this.mentionOpen&&i&&s[i]?this.openMention(i):this.mentionOpen&&this.handleMention()},this.onEditorKeyDown=t=>{if(!this.mentionOpen)return;const i=t.key;if("ArrowDown"===i||"ArrowUp"===i){if(t.preventDefault(),!this.mentionFiltered.length)return;this.mentionActiveIndex="ArrowDown"===i?(this.mentionActiveIndex+1)%this.mentionFiltered.length:(this.mentionActiveIndex-1+this.mentionFiltered.length)%this.mentionFiltered.length,this.renderMentionList()}else"Enter"===i?this.mentionActiveIndex>=0&&this.mentionFiltered[this.mentionActiveIndex]&&(t.preventDefault(),this.selectMention(this.mentionFiltered[this.mentionActiveIndex])):"Escape"===i&&(t.preventDefault(),this.closeMention())},this.repositionMention=()=>{if(!this.mentionOpen||!this.hostEl||!this.triggerBtn)return;const t=this.getCaretClientRect();if(!t)return;const i=this.hostEl.getBoundingClientRect();this.mentionX=t.left-i.left,this.mentionY=t.bottom-i.top,this.triggerBtn.style.left=`${this.mentionX}px`,this.triggerBtn.style.top=`${this.mentionY}px`}}createRenderRoot(){return this}getTriggerFormat(t){const i=this.itemsFormats[t]||{},s=this.mentionFormat[t]||{};return{prefix:i.prefix??s.prefix??"",suffix:i.suffix??s.suffix??""}}formatLabel(t,i){const{prefix:s,suffix:e}=this.getTriggerFormat(t);return`${s??""}${i}${e??""}`}get config(){return{...this.externalConfig,...this.mentions,...this.itemsConfig}}attach(t,i){this.editorEl=t,this.hostEl=i,this.injectStyles(),this.ensureMentionDropdown(),this.rebuildConfigFromChildren(),this.mo=new MutationObserver((()=>this.rebuildConfigFromChildren())),this.mo.observe(this,{childList:!0,subtree:!0,attributes:!0}),this.editorEl.addEventListener("input",this.onEditorInput),this.editorEl.addEventListener("mouseup",this.saveSelection),this.editorEl.addEventListener("keyup",this.onEditorKeyUp),this.editorEl.addEventListener("keydown",this.onEditorKeyDown),this.editorEl.addEventListener("scroll",this.repositionMention),document.addEventListener("selectionchange",this.onSelectionChange,!0)}detach(){this.mo&&(this.mo.disconnect(),this.mo=null),this.editorEl&&(this.editorEl.removeEventListener("input",this.onEditorInput),this.editorEl.removeEventListener("mouseup",this.saveSelection),this.editorEl.removeEventListener("keyup",this.onEditorKeyUp),this.editorEl.removeEventListener("keydown",this.onEditorKeyDown),this.editorEl.removeEventListener("scroll",this.repositionMention)),document.removeEventListener("selectionchange",this.onSelectionChange,!0)}setExternalConfig(t){this.externalConfig=t||{}}disconnectedCallback(){this.detach(),super.disconnectedCallback()}rebuildConfigFromChildren(){const t={},i={},s={},e=Array.from(this.querySelectorAll("nile-rte-mentions-item"));for(const n of e){const e=n.mentionsCharacter??n.getAttribute("mentionscharacter")??"";if(!e||"string"!=typeof e)continue;let o=n.mentionsData??(()=>{const t=n.getAttribute("mentionsdata");if(!t)return null;try{const i=JSON.parse(t);return Array.isArray(i)?i.filter((t=>t&&"string"==typeof t.key&&"string"==typeof t.label)):[]}catch{return[]}})();const h=n.mentionsColor??n.getAttribute("mentionscolor")??"",r=n.mentionsPrefix??n.getAttribute("mentionsprefix")??"",u=n.mentionsSuffix??n.getAttribute("mentionssuffix")??"";Array.isArray(o)||(o=[]),t[e]=o,h&&(i[e]=String(h)),(r||u)&&(s[e]={prefix:r,suffix:u})}this.itemsConfig=t,this.itemsColors=i,this.itemsFormats=s}injectStyles(){if(this.querySelector("style[data-mentions-style]"))return;const t=document.createElement("style");t.setAttribute("data-mentions-style","true"),t.textContent="\n .mention-dropdown {\n position: absolute; z-index: 1000; list-style: none; margin: 0; padding: 4px;\n border: 1px solid #e5e7eb; border-radius: 6px; background: #fff;\n box-shadow: 0 4px 10px rgba(0,0,0,.08); max-height: 180px; overflow: auto; font-size: 14px;\n }\n .mention-dropdown li { padding: 6px 8px; cursor: pointer; border-radius: 4px; }\n .mention-dropdown li:hover { background: #f1f5f9; }\n .mention { background: #eef2ff; padding: 0 3px; border-radius: 3px; }\n nile-menu.mentions-menu::part(menu__items-wrapper){\n max-height: 260px;\n overflow-y: auto;\n }\n .mentions-menu nile-menu-item.active {\n background: #dbeafe; /* highlight */\n outline: none;\n}\n\n\n ",this.insertBefore(t,this.firstChild)}getTriggerColor(t){return this.itemsColors[t]??this.mentionColors[t]}ensureMentionDropdown(){if(this.dropdownEl||!this.hostEl)return;const t=document.createElement("nile-dropdown");t.style.zIndex="1000";const i=document.createElement("nile-button");i.setAttribute("slot","trigger"),i.style.position="absolute",i.style.width="1px",i.style.height="1px",i.style.border="0",i.style.padding="0",i.style.opacity="0",i.style.pointerEvents="none",t.appendChild(i),this.triggerBtn=i;const s=document.createElement("nile-menu");s.classList.add("mentions-menu"),t.appendChild(s),this.hostEl.appendChild(t),this.dropdownEl=t,this.menuEl=s}restoreSelection(){if(!this.lastRange)return;const t=document.getSelection();t&&(t.removeAllRanges(),t.addRange(this.lastRange))}focusAndRestore(){this.editorEl?.focus(),this.restoreSelection()}getCaretClientRect(){const t=document.getSelection();if(!t||0===t.rangeCount)return null;const i=t.getRangeAt(0).cloneRange();i.collapse(!1);const s=i.getClientRects();if(s&&s.length>0)return s[0];const e=document.createElement("span");e.setAttribute("data-caret-marker","1"),e.textContent="​",i.insertNode(e);const n=e.getBoundingClientRect(),o=document.createRange();return o.setStartAfter(e),o.collapse(!0),t.removeAllRanges(),t.addRange(o),e.remove(),n||null}openMention(t){if(this.saveSelection(),!this.editorEl||!this.dropdownEl||!this.hostEl)return;const i=this.getCaretClientRect();if(!i)return;const s=this.hostEl.getBoundingClientRect();this.mentionX=i.left-s.left,this.mentionY=i.bottom-s.top,this.mentionTrigger=t,this.mentionSuggestions=this.config[t]||[],this.mentionQuery="",this.updateMentionFiltered(),this.mentionActiveIndex=this.mentionFiltered.length?0:-1,this.mentionOpen=!0,this.renderMentionList(),this.dispatchEvent(new CustomEvent("nile-mention-opened",{detail:{trigger:t,suggestions:this.mentionSuggestions},bubbles:!0,composed:!0}))}closeMention(){this.mentionOpen=!1,this.mentionTrigger=null,this.mentionQuery="",this.mentionFiltered=[],this.dropdownEl?.removeAttribute("open")}handleMention(){if(!this.mentionOpen||!this.mentionTrigger)return;const t=window.getSelection();if(!t||!t.anchorNode)return;let i=t.anchorNode;if(i.nodeType!==Node.TEXT_NODE){const s=i.childNodes?.[t.anchorOffset]||i.firstChild;s?.nodeType===Node.TEXT_NODE&&(i=s)}const s=i&&i.nodeType===Node.TEXT_NODE&&i.textContent||"",e=s.lastIndexOf(this.mentionTrigger);e>=0?(this.mentionQuery=s.substring(e+1),this.updateMentionFiltered(),this.renderMentionList()):this.closeMention()}updateMentionFiltered(){const t=this.mentionQuery.toLowerCase();this.mentionFiltered=(this.mentionSuggestions||[]).filter((i=>i.label.toLowerCase().startsWith(t)))}renderMentionList(){this.dropdownEl&&this.menuEl&&this.triggerBtn&&(this.triggerBtn.style.left=`${this.mentionX}px`,this.triggerBtn.style.top=`${this.mentionY}px`,this.menuEl.innerHTML="",this.mentionOpen&&this.mentionFiltered.length?(this.mentionFiltered.forEach(((t,i)=>{const s=document.createElement("nile-menu-item");s.textContent=t.label,s.setAttribute("role","option"),i===this.mentionActiveIndex?(s.classList.add("active"),s.setAttribute("aria-selected","true")):(s.classList.remove("active"),s.removeAttribute("aria-selected")),s.addEventListener("mouseenter",(()=>{this.mentionActiveIndex=i,this.renderMentionList()})),s.addEventListener("mousedown",(i=>{i.preventDefault(),this.selectMention(t)})),this.menuEl?.appendChild(s)})),this.dropdownEl.setAttribute("open","")):this.dropdownEl.removeAttribute("open"))}selectMention(t){if(this.restoreSelection(),!this.lastRange||!this.mentionTrigger||!this.editorEl)return;const i=this.mentionTrigger;let s=this.lastRange.startContainer,e=this.lastRange.startOffset;if(s.nodeType!==Node.TEXT_NODE){const t=s.childNodes[e];if(t?.nodeType!==Node.TEXT_NODE)return;s=t,e=0}const n=s,o=(n.textContent||"").lastIndexOf(this.mentionTrigger,e);if(o<0)return;const h=o+1+this.mentionQuery.length,r=document.createRange();r.setStart(n,o),r.setEnd(n,h),r.deleteContents();const u=document.createElement("span");u.classList.add("mention");const c=this.getTriggerFormat(this.mentionTrigger);this.displayFormat?u.textContent=`${c.prefix??""}${t.label}${c.suffix??""}`:(u.textContent=`${this.mentionTrigger}${t.label}`,c.prefix&&u.setAttribute("data-mention-prefix",c.prefix),c.suffix&&u.setAttribute("data-mention-suffix",c.suffix)),u.setAttribute("data-mention-key",t.key),u.setAttribute("data-mention-label",t.label),u.setAttribute("data-mention-trigger",this.mentionTrigger);const l=this.getTriggerColor(this.mentionTrigger);l&&(u.style.backgroundColor=l),r.insertNode(u);const d=document.createTextNode(" ");u.after(d);const a=window.getSelection(),m=document.createRange();m.setStartAfter(d),m.collapse(!0),a?.removeAllRanges(),a?.addRange(m),this.lastRange=m.cloneRange(),this.closeMention(),this.dispatchEvent(new CustomEvent("nile-mention-selected",{detail:{trigger:i,key:t.key,label:t.label,prefix:c.prefix??"",suffix:c.suffix??""},bubbles:!0,composed:!0})),this.editorEl.dispatchEvent(new InputEvent("input",{bubbles:!0}))}};t([s({type:Boolean,attribute:"displayformat",reflect:!0})],o.prototype,"displayFormat",void 0),t([s({attribute:"mentions",converter:{fromAttribute:t=>{try{const i=JSON.parse(t),s={};for(const t of Object.keys(i)){const e=i[t];Array.isArray(e)&&(s[t]=e.filter((t=>t&&"string"==typeof t.key&&"string"==typeof t.label)).map((t=>({key:t.key,label:t.label}))))}return s}catch{return{}}},toAttribute:t=>JSON.stringify(t)}})],o.prototype,"mentions",void 0),t([s({attribute:"mentionformat",converter:{fromAttribute:t=>{try{const i=JSON.parse(t);return i&&"object"==typeof i?i:{}}catch{return{}}},toAttribute:t=>JSON.stringify(t??{})}})],o.prototype,"mentionFormat",void 0),t([e()],o.prototype,"itemsFormats",void 0),t([s({attribute:"mentioncolors",converter:{fromAttribute:t=>{try{const i=JSON.parse(t);return i&&"object"==typeof i?i:{}}catch{return{}}},toAttribute:t=>JSON.stringify(t??{})}})],o.prototype,"mentionColors",void 0),t([e()],o.prototype,"externalConfig",void 0),t([e()],o.prototype,"itemsConfig",void 0),t([e()],o.prototype,"mentionActiveIndex",void 0),t([e()],o.prototype,"itemsColors",void 0),o=t([n("nile-rte-mentions")],o);
@@ -0,0 +1,2 @@
1
+ function _typeof(o){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(o){return typeof o;}:function(o){return o&&"function"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o;},_typeof(o);}System.register(["tslib","lit","lit/decorators.js"],function(_export,_context){"use strict";var r,t,e,o;function _classCallCheck(a,n){if(!(a instanceof n))throw new TypeError("Cannot call a class as a function");}function _defineProperties(e,r){for(var t=0;t<r.length;t++){var o=r[t];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,_toPropertyKey(o.key),o);}}function _createClass(e,r,t){return r&&_defineProperties(e.prototype,r),t&&_defineProperties(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e;}function _toPropertyKey(t){var i=_toPrimitive(t,"string");return"symbol"==_typeof(i)?i:i+"";}function _toPrimitive(t,r){if("object"!=_typeof(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,r||"default");if("object"!=_typeof(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.");}return("string"===r?String:Number)(t);}function _callSuper(t,o,e){return o=_getPrototypeOf(o),_possibleConstructorReturn(t,_isNativeReflectConstruct()?Reflect.construct(o,e||[],_getPrototypeOf(t).constructor):o.apply(t,e));}function _possibleConstructorReturn(t,e){if(e&&("object"==_typeof(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized(t);}function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e;}function _isNativeReflectConstruct(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));}catch(t){}return(_isNativeReflectConstruct=function _isNativeReflectConstruct(){return!!t;})();}function _getPrototypeOf(t){return _getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t);},_getPrototypeOf(t);}function _inherits(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&_setPrototypeOf(t,e);}function _setPrototypeOf(t,e){return _setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t;},_setPrototypeOf(t,e);}return{setters:[function(_tslib){r=_tslib.__decorate;},function(_lit){t=_lit.LitElement;},function(_litDecoratorsJs){e=_litDecoratorsJs.customElement;}],execute:function execute(){o=/*#__PURE__*/function(_t){function o(){_classCallCheck(this,o);return _callSuper(this,o,arguments);}_inherits(o,_t);return _createClass(o,[{key:"createRenderRoot",value:function createRenderRoot(){return this;}},{key:"shouldUpdate",value:function shouldUpdate(){return!1;}}]);}(t);o=r([e("nile-rte-preview")],o);}};});
2
+ //# sourceMappingURL=nile-rte-preview.cjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nile-rte-preview.cjs.js","sources":["../../../src/nile-rich-text-editor/nile-rte-preview.ts"],"sourcesContent":["import { LitElement } from 'lit';\nimport { customElement } from 'lit/decorators.js';\n\n@customElement('nile-rte-preview')\nexport class NileRtePreview extends LitElement {\n protected createRenderRoot() { return this; }\n protected shouldUpdate() { return false; }\n}\ndeclare global { interface HTMLElementTagNameMap { 'nile-rte-preview': NileRtePreview; } }\n"],"names":["NileRtePreview","createRenderRoot","this","key","value","shouldUpdate","LitElement","__decorate","customElement"],"mappings":"kwFAIaA,CAAAA,uBAAAA,EAAAA,WAAAA,EAAAA,EAAAA,eAAAA,MAAAA,CAAAA,SAAAA,UAAAA,MAAAA,CAAAA,CAAAA,SAAAA,GAAAA,SAAAA,CAAAA,CAAAA,CAAAA,EAAAA,SAAAA,YAAAA,CAAAA,CAAAA,GAAAA,GAAAA,oBAAAA,KAAAA,CACD,SAAAC,gBAAAA,CAAAA,CAAAA,CAAqB,MAAOC,KAAO,EACnC,GAAAC,GAAA,gBAAAC,KAAA,UAAAC,YAAAA,CAAAA,CAAAA,CAAiB,MAAO,CAAA,CAAQ,QAFRC,CAAAA,EAAvBN,CAAcO,CAAAA,CAAAA,CAAA,CAD1BC,CAAAA,CAAc,kBACFR,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA"}
@@ -0,0 +1 @@
1
+ import{__decorate as r}from"tslib";import{LitElement as t}from"lit";import{customElement as e}from"lit/decorators.js";let o=class extends t{createRenderRoot(){return this}shouldUpdate(){return!1}};o=r([e("nile-rte-preview")],o);
@@ -0,0 +1,2 @@
1
+ function _typeof(o){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(o){return typeof o;}:function(o){return o&&"function"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o;},_typeof(o);}System.register(["tslib","lit","lit/decorators.js"],function(_export,_context){"use strict";var t,e,n,i,l,r,_templateObject,_templateObject2,_templateObject3,_templateObject4,_templateObject5,_templateObject6,_templateObject7,s,o;function _taggedTemplateLiteral(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}));}function _classCallCheck(a,n){if(!(a instanceof n))throw new TypeError("Cannot call a class as a function");}function _defineProperties(e,r){for(var t=0;t<r.length;t++){var o=r[t];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,_toPropertyKey(o.key),o);}}function _createClass(e,r,t){return r&&_defineProperties(e.prototype,r),t&&_defineProperties(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e;}function _toPropertyKey(t){var i=_toPrimitive(t,"string");return"symbol"==_typeof(i)?i:i+"";}function _toPrimitive(t,r){if("object"!=_typeof(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,r||"default");if("object"!=_typeof(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.");}return("string"===r?String:Number)(t);}function _callSuper(t,o,e){return o=_getPrototypeOf(o),_possibleConstructorReturn(t,_isNativeReflectConstruct()?Reflect.construct(o,e||[],_getPrototypeOf(t).constructor):o.apply(t,e));}function _possibleConstructorReturn(t,e){if(e&&("object"==_typeof(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized(t);}function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e;}function _isNativeReflectConstruct(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));}catch(t){}return(_isNativeReflectConstruct=function _isNativeReflectConstruct(){return!!t;})();}function _superPropGet(t,o,e,r){var p=_get(_getPrototypeOf(1&r?t.prototype:t),o,e);return 2&r&&"function"==typeof p?function(t){return p.apply(e,t);}:p;}function _get(){return _get="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,r){var p=_superPropBase(e,t);if(p){var n=Object.getOwnPropertyDescriptor(p,t);return n.get?n.get.call(arguments.length<3?e:r):n.value;}},_get.apply(null,arguments);}function _superPropBase(t,o){for(;!{}.hasOwnProperty.call(t,o)&&null!==(t=_getPrototypeOf(t)););return t;}function _getPrototypeOf(t){return _getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t);},_getPrototypeOf(t);}function _inherits(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&_setPrototypeOf(t,e);}function _setPrototypeOf(t,e){return _setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t;},_setPrototypeOf(t,e);}function a(t){return s.has(t);}return{setters:[function(_tslib){t=_tslib.__decorate;},function(_lit){e=_lit.LitElement;n=_lit.html;},function(_litDecoratorsJs){i=_litDecoratorsJs.property;l=_litDecoratorsJs.state;r=_litDecoratorsJs.customElement;}],execute:function execute(){s=new Set(["p","h1","h2","h3","h4","h5","h6"]);o=/*#__PURE__*/function(_e){function o(){var _this;_classCallCheck(this,o);_this=_callSuper(this,o,arguments),_this.type="",_this.options="[]",_this.label="",_this.selectedValue="";return _this;}_inherits(o,_e);return _createClass(o,[{key:"createRenderRoot",value:function createRenderRoot(){return this;}},{key:"mapAlignIcon",value:function mapAlignIcon(t){return{left:"format_align_left",center:"format_align_middle",right:"format_align_right",justify:"format_align_justify"}[t]||"format_align_left";}},{key:"parsedOptions",get:function get(){var _this$optionsObj,_this2=this;var t=(_this$optionsObj=this.optionsObj)!==null&&_this$optionsObj!==void 0?_this$optionsObj:this.options;var e=function(){if(Array.isArray(t))return t;try{return JSON.parse(String(t));}catch(_unused){return[];}}();"align"===this.type&&0===e.length&&(e=[{value:"left",label:"Align Left"},{value:"center",label:"Align Center"},{value:"right",label:"Align Right"},{value:"justify",label:"Justify"}]);var n=e.map(function(t){var _t$value,_ref,_t$label,_t$icon;var e=(_t$value=t===null||t===void 0?void 0:t.value)!==null&&_t$value!==void 0?_t$value:t;return{value:e,label:(_ref=(_t$label=t===null||t===void 0?void 0:t.label)!==null&&_t$label!==void 0?_t$label:t===null||t===void 0?void 0:t.value)!==null&&_ref!==void 0?_ref:t,icon:(_t$icon=t===null||t===void 0?void 0:t.icon)!==null&&_t$icon!==void 0?_t$icon:"align"===_this2.type?_this2.mapAlignIcon(String(e)):void 0};});if("heading"===this.type){n.length;n=n.filter(function(t){return a(t.value);}),n.length,this.selectedValue&&!a(this.selectedValue)&&(this.selectedValue="");}return n;}},{key:"ensureDefault",value:function ensureDefault(){if(!this.selectedValue){var _t=this.parsedOptions[0];_t&&(this.selectedValue=_t.value);}}},{key:"onSelect",value:function onSelect(t){"heading"!==this.type||a(t)?(this.selectedValue=t,this.dispatchEvent(new CustomEvent("change",{detail:t,bubbles:!0,composed:!0}))):console.warn("[nile-rte-select] Ignoring invalid heading value: ".concat(t));}},{key:"connectedCallback",value:function connectedCallback(){_superPropGet(o,"connectedCallback",this,3)([]),this.injectLocalStyles();}},{key:"injectLocalStyles",value:function injectLocalStyles(){if(this.querySelector("style[data-rte-select-style]"))return;var t=document.createElement("style");t.setAttribute("data-rte-select-style","true"),t.textContent="\n nile-menu.rte-align-menu::part(menu__items-wrapper) {\n display: flex;\n }\n nile-menu.rte-align-menu,\n nile-menu.rte-default-menu {\n margin-top: 0px;\n }\n nile-button.rte-align-trigger::part(base),\n nile-button.rte-default-trigger::part(base) {\n min-width: 32px;\n height: 32px;\n padding: 0px 6px;\n box-shadow: none;\n }\n nile-button.rte-align-trigger::part(base) {\n\n border: none;\n}\n\n \n ",this.insertBefore(t,this.firstChild);}},{key:"render",value:function render(){var _this3=this;var t=this.parsedOptions;this.ensureDefault();var e=t.find(function(t){return t.value===_this3.selectedValue;});if("align"===this.type){var _i=e!==null&&e!==void 0&&e.icon?n(_templateObject||(_templateObject=_taggedTemplateLiteral(["<nile-icon name=\"","\"></nile-icon>"])),e.icon):this.label||"Align";return n(_templateObject2||(_templateObject2=_taggedTemplateLiteral(["\n <nile-dropdown class=\"rte-align-dd\">\n <nile-button\n slot=\"trigger\"\n variant=\"tertiary\"\n class=\"rte-align-trigger\"\n >\n ","\n </nile-button>\n <nile-menu class=\"rte-align-menu\">\n ","\n </nile-menu>\n </nile-dropdown>\n "])),_i,t.map(function(t){return n(_templateObject3||(_templateObject3=_taggedTemplateLiteral(["\n <nile-menu-item\n class=\"rte-align-item\"\n ?active=","\n @click=","\n >\n <nile-tooltip hoist content=\"","\">\n <nile-icon name=\"","\"></nile-icon>\n </nile-tooltip>\n </nile-menu-item>\n "])),t.value===_this3.selectedValue,function(){return _this3.onSelect(t.value);},t.label,t.icon);}));}if("font"===this.type){var _i2=(e===null||e===void 0?void 0:e.label)||this.label||"Font";return n(_templateObject4||(_templateObject4=_taggedTemplateLiteral(["\n <nile-dropdown class=\"rte-default-dd\">\n <nile-button\n slot=\"trigger\"\n variant=\"tertiary\"\n class=\"rte-default-trigger\"\n style=\"font-family: ","\"\n >\n "," <nile-icon name=\"arrowdown\"></nile-icon>\n </nile-button>\n <nile-menu class=\"rte-default-menu\">\n ","\n </nile-menu>\n </nile-dropdown>\n "])),(e===null||e===void 0?void 0:e.value)||"inherit",_i2,t.map(function(t){return n(_templateObject5||(_templateObject5=_taggedTemplateLiteral(["\n <nile-menu-item\n style=\"font-family: ","\"\n ?active=","\n @click=","\n >\n ","\n </nile-menu-item>\n "])),t.value,t.value===_this3.selectedValue,function(){return _this3.onSelect(t.value);},t.label);}));}var i=(e===null||e===void 0?void 0:e.label)||this.label||"Select";return n(_templateObject6||(_templateObject6=_taggedTemplateLiteral(["\n <nile-dropdown class=\"rte-default-dd\">\n <nile-button\n slot=\"trigger\"\n variant=\"tertiary\"\n class=\"rte-default-trigger\"\n >\n "," <nile-icon name=\"arrowdown\"></nile-icon>\n </nile-button>\n <nile-menu class=\"rte-default-menu\">\n ","\n </nile-menu>\n </nile-dropdown>\n "])),i,t.map(function(t){return n(_templateObject7||(_templateObject7=_taggedTemplateLiteral(["\n <nile-menu-item\n ?active=","\n @click=","\n >\n ","\n </nile-menu-item>\n "])),t.value===_this3.selectedValue,function(){return _this3.onSelect(t.value);},t.label);}));}}]);}(e);t([i({type:String,attribute:!0,reflect:!0})],o.prototype,"type",void 0),t([i({type:String,attribute:!0,reflect:!0})],o.prototype,"options",void 0),t([i({attribute:!1})],o.prototype,"optionsObj",void 0),t([i({type:String,attribute:!0,reflect:!0})],o.prototype,"label",void 0),t([l()],o.prototype,"selectedValue",void 0),o=t([r("nile-rte-select")],o);}};});
2
+ //# sourceMappingURL=nile-rte-select.cjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nile-rte-select.cjs.js","sources":["../../../src/nile-rich-text-editor/nile-rte-select.ts"],"sourcesContent":["import { LitElement, html } from 'lit';\nimport { customElement, property, state } from 'lit/decorators.js';\n\ntype HeadingTag = 'p' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';\ntype GenericOption = { value: string; label?: string; icon?: string };\ntype HeadingOption = { value: HeadingTag; label?: string; icon?: string };\ntype NormalizedOption = { value: string; label: string; icon?: string };\n\nconst HEADING_ALLOWLIST: ReadonlySet<HeadingTag> = new Set([\n 'p',\n 'h1',\n 'h2',\n 'h3',\n 'h4',\n 'h5',\n 'h6',\n]);\n\nfunction isHeadingTag(v: string): v is HeadingTag {\n return HEADING_ALLOWLIST.has(v as HeadingTag);\n}\n\n@customElement('nile-rte-select')\nexport class NileRteSelect extends LitElement {\n protected createRenderRoot() {\n return this;\n }\n\n @property({ type: String, attribute: true, reflect: true }) type = '';\n\n @property({ type: String, attribute: true, reflect: true }) options = '[]';\n\n @property({ attribute: false })\n optionsObj?: Array<GenericOption | HeadingOption>;\n\n @property({ type: String, attribute: true, reflect: true }) label = '';\n\n @state() private selectedValue = '';\n\n private mapAlignIcon(v: string) {\n const map: Record<string, string> = {\n left: 'format_align_left',\n center: 'format_align_middle',\n right: 'format_align_right',\n justify: 'format_align_justify',\n };\n return map[v] || 'format_align_left';\n }\n private get parsedOptions(): NormalizedOption[] {\n const source: unknown = this.optionsObj ?? this.options;\n\n let rawArray: any[] = (() => {\n if (Array.isArray(source)) return source;\n try {\n return JSON.parse(String(source));\n } catch {\n return [];\n }\n })();\n\n if (this.type === 'align' && rawArray.length === 0) {\n rawArray = [\n { value: 'left', label: 'Align Left' },\n { value: 'center', label: 'Align Center' },\n { value: 'right', label: 'Align Right' },\n { value: 'justify', label: 'Justify' },\n ];\n }\n\n let items: NormalizedOption[] = rawArray.map((o: any) => {\n const value: string = o?.value ?? o;\n const label: string = o?.label ?? o?.value ?? o;\n const icon: string | undefined =\n o?.icon ??\n (this.type === 'align' ? this.mapAlignIcon(String(value)) : undefined);\n return { value, label, icon };\n });\n\n if (this.type === 'heading') {\n const before = items.length;\n items = items.filter(i => isHeadingTag(i.value));\n if (items.length !== before) {\n }\n if (this.selectedValue && !isHeadingTag(this.selectedValue)) {\n this.selectedValue = '';\n }\n }\n\n return items;\n }\n\n private ensureDefault() {\n if (!this.selectedValue) {\n const first = this.parsedOptions[0];\n if (first) this.selectedValue = first.value;\n }\n }\n\n private onSelect(value: string) {\n if (this.type === 'heading' && !isHeadingTag(value)) {\n console.warn(\n `[nile-rte-select] Ignoring invalid heading value: ${value}`\n );\n return;\n }\n this.selectedValue = value;\n this.dispatchEvent(\n new CustomEvent('change', {\n detail: value,\n bubbles: true,\n composed: true,\n })\n );\n }\n\n connectedCallback(): void {\n super.connectedCallback();\n this.injectLocalStyles();\n }\n\n private injectLocalStyles() {\n if (this.querySelector('style[data-rte-select-style]')) return;\n\n const style = document.createElement('style');\n style.setAttribute('data-rte-select-style', 'true');\n style.textContent = `\n nile-menu.rte-align-menu::part(menu__items-wrapper) {\n display: flex;\n }\n nile-menu.rte-align-menu,\n nile-menu.rte-default-menu {\n margin-top: 0px;\n }\n nile-button.rte-align-trigger::part(base),\n nile-button.rte-default-trigger::part(base) {\n min-width: 32px;\n height: 32px;\n padding: 0px 6px;\n box-shadow: none;\n }\n nile-button.rte-align-trigger::part(base) {\n\n border: none;\n}\n\n \n `;\n this.insertBefore(style, this.firstChild);\n }\n\n render() {\n const opts = this.parsedOptions;\n this.ensureDefault();\n const current = opts.find(o => o.value === this.selectedValue);\n\n if (this.type === 'align') {\n const trigger = current?.icon\n ? html`<nile-icon name=\"${current.icon}\"></nile-icon>`\n : this.label || 'Align';\n\n return html`\n <nile-dropdown class=\"rte-align-dd\">\n <nile-button\n slot=\"trigger\"\n variant=\"tertiary\"\n class=\"rte-align-trigger\"\n >\n ${trigger}\n </nile-button>\n <nile-menu class=\"rte-align-menu\">\n ${opts.map(\n o => html`\n <nile-menu-item\n class=\"rte-align-item\"\n ?active=${o.value === this.selectedValue}\n @click=${() => this.onSelect(o.value)}\n >\n <nile-tooltip hoist content=\"${o.label}\">\n <nile-icon name=\"${o.icon}\"></nile-icon>\n </nile-tooltip>\n </nile-menu-item>\n `\n )}\n </nile-menu>\n </nile-dropdown>\n `;\n }\n\n if (this.type === 'font') {\n const triggerText = current?.label || this.label || 'Font';\n return html`\n <nile-dropdown class=\"rte-default-dd\">\n <nile-button\n slot=\"trigger\"\n variant=\"tertiary\"\n class=\"rte-default-trigger\"\n style=\"font-family: ${current?.value || 'inherit'}\"\n >\n ${triggerText} <nile-icon name=\"arrowdown\"></nile-icon>\n </nile-button>\n <nile-menu class=\"rte-default-menu\">\n ${opts.map(\n o => html`\n <nile-menu-item\n style=\"font-family: ${o.value}\"\n ?active=${o.value === this.selectedValue}\n @click=${() => this.onSelect(o.value)}\n >\n ${o.label}\n </nile-menu-item>\n `\n )}\n </nile-menu>\n </nile-dropdown>\n `;\n }\n\n const triggerText = current?.label || this.label || 'Select';\n return html`\n <nile-dropdown class=\"rte-default-dd\">\n <nile-button\n slot=\"trigger\"\n variant=\"tertiary\"\n class=\"rte-default-trigger\"\n >\n ${triggerText} <nile-icon name=\"arrowdown\"></nile-icon>\n </nile-button>\n <nile-menu class=\"rte-default-menu\">\n ${opts.map(\n o => html`\n <nile-menu-item\n ?active=${o.value === this.selectedValue}\n @click=${() => this.onSelect(o.value)}\n >\n ${o.label}\n </nile-menu-item>\n `\n )}\n </nile-menu>\n </nile-dropdown>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nile-rte-select': NileRteSelect;\n }\n}\n"],"names":["isHeadingTag","v","HEADING_ALLOWLIST","has","setters","_tslib","Set","NileRteSelect","o","this","type","options","label","selectedValue","_this","_inherits","_e","_createClass","key","value","createRenderRoot","mapAlignIcon","left","center","right","justify","get","_this$optionsObj","_this2","source","optionsObj","rawArray","Array","isArray","JSON","parse","String","_unused","length","items","map","_t$value","_ref","_t$label","_t$icon","icon","undefined","filter","i","ensureDefault","first","parsedOptions","onSelect","dispatchEvent","CustomEvent","detail","bubbles","composed","console","warn","concat","connectedCallback","super","injectLocalStyles","querySelector","style","document","createElement","setAttribute","textContent","insertBefore","firstChild","render","opts","current","find","trigger","html","_templateObject","_taggedTemplateLiteral","_templateObject2","_templateObject3","triggerText","_templateObject4","_templateObject5","_templateObject6","_templateObject7","LitElement","__decorate","property","attribute","reflect","prototype","state","customElement"],"mappings":"i2GAkBA,QAASA,CAAAA,CAAAA,CAAaC,GACpB,MAAOC,CAAAA,CAAAA,CAAkBC,GAAIF,CAAAA,CAAAA,CAC/B,EAGO,OAAAG,OAAA,WAAAC,MAAA,sNAfDH,CAA6C,CAAA,GAAII,CAAAA,GAAI,CAAA,CACzD,IACA,IACA,CAAA,IAAA,CACA,IACA,CAAA,IAAA,CACA,IACA,CAAA,IAAA,CAAA,CAAA,CAQWC,CAAA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