ngwr 15.8.0 → 16.0.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 (376) hide show
  1. package/animations/aurora/styles/_index.scss +1 -1
  2. package/animations/blur-reveal/styles/_index.scss +1 -1
  3. package/animations/decode/styles/_index.scss +1 -1
  4. package/animations/dot-grid/styles/_index.scss +1 -1
  5. package/animations/flow-lines/styles/_index.scss +1 -1
  6. package/animations/fluid-cursor/styles/_index.scss +1 -1
  7. package/animations/{core → internal}/styles/_mixins.scss +1 -1
  8. package/animations/reveal/styles/_index.scss +1 -1
  9. package/animations/ripple-grid/styles/_index.scss +1 -1
  10. package/animations/rotate-reveal/styles/_index.scss +1 -1
  11. package/animations/thread-lines/styles/_index.scss +1 -1
  12. package/animations/typewriter/styles/_index.scss +1 -1
  13. package/copy-value/styles/_index.scss +104 -0
  14. package/date-picker/styles/_index.scss +117 -0
  15. package/fesm2022/{ngwr-animations-core.mjs → internal-BaQU4t_0.mjs} +6 -49
  16. package/fesm2022/internal-BaQU4t_0.mjs.map +1 -0
  17. package/fesm2022/ngwr-alert.mjs +2 -2
  18. package/fesm2022/ngwr-alert.mjs.map +1 -1
  19. package/fesm2022/ngwr-animations-aurora.mjs +21 -21
  20. package/fesm2022/ngwr-animations-aurora.mjs.map +1 -1
  21. package/fesm2022/ngwr-animations-blur-reveal.mjs +3 -3
  22. package/fesm2022/ngwr-animations-blur-reveal.mjs.map +1 -1
  23. package/fesm2022/ngwr-animations-click-sparks.mjs +2 -2
  24. package/fesm2022/ngwr-animations-click-sparks.mjs.map +1 -1
  25. package/fesm2022/ngwr-animations-confetti.mjs +5 -5
  26. package/fesm2022/ngwr-animations-confetti.mjs.map +1 -1
  27. package/fesm2022/ngwr-animations-decode.mjs +4 -4
  28. package/fesm2022/ngwr-animations-decode.mjs.map +1 -1
  29. package/fesm2022/ngwr-animations-destruct.mjs +5 -5
  30. package/fesm2022/ngwr-animations-destruct.mjs.map +1 -1
  31. package/fesm2022/ngwr-animations-dot-grid.mjs +7 -7
  32. package/fesm2022/ngwr-animations-dot-grid.mjs.map +1 -1
  33. package/fesm2022/ngwr-animations-falling-letters.mjs +3 -3
  34. package/fesm2022/ngwr-animations-falling-letters.mjs.map +1 -1
  35. package/fesm2022/ngwr-animations-flow-lines.mjs +17 -17
  36. package/fesm2022/ngwr-animations-flow-lines.mjs.map +1 -1
  37. package/fesm2022/ngwr-animations-fluid-cursor.mjs +12 -12
  38. package/fesm2022/ngwr-animations-fluid-cursor.mjs.map +1 -1
  39. package/fesm2022/ngwr-animations-glitch.mjs +2 -2
  40. package/fesm2022/ngwr-animations-glitch.mjs.map +1 -1
  41. package/fesm2022/ngwr-animations-marquee.mjs +2 -2
  42. package/fesm2022/ngwr-animations-marquee.mjs.map +1 -1
  43. package/fesm2022/ngwr-animations-orbit.mjs +7 -7
  44. package/fesm2022/ngwr-animations-orbit.mjs.map +1 -1
  45. package/fesm2022/ngwr-animations-reveal.mjs +4 -4
  46. package/fesm2022/ngwr-animations-reveal.mjs.map +1 -1
  47. package/fesm2022/ngwr-animations-ripple-grid.mjs +5 -5
  48. package/fesm2022/ngwr-animations-ripple-grid.mjs.map +1 -1
  49. package/fesm2022/ngwr-animations-rotate-reveal.mjs +4 -4
  50. package/fesm2022/ngwr-animations-rotate-reveal.mjs.map +1 -1
  51. package/fesm2022/ngwr-animations-shimmer.mjs +2 -2
  52. package/fesm2022/ngwr-animations-shimmer.mjs.map +1 -1
  53. package/fesm2022/ngwr-animations-spotlight.mjs +1 -1
  54. package/fesm2022/ngwr-animations-spotlight.mjs.map +1 -1
  55. package/fesm2022/ngwr-animations-thread-lines.mjs +16 -16
  56. package/fesm2022/ngwr-animations-thread-lines.mjs.map +1 -1
  57. package/fesm2022/ngwr-animations-tilt.mjs +3 -3
  58. package/fesm2022/ngwr-animations-tilt.mjs.map +1 -1
  59. package/fesm2022/ngwr-animations-typewriter.mjs +4 -4
  60. package/fesm2022/ngwr-animations-typewriter.mjs.map +1 -1
  61. package/fesm2022/ngwr-avatar.mjs +3 -3
  62. package/fesm2022/ngwr-avatar.mjs.map +1 -1
  63. package/fesm2022/ngwr-badge.mjs.map +1 -1
  64. package/fesm2022/ngwr-cascader.mjs +43 -20
  65. package/fesm2022/ngwr-cascader.mjs.map +1 -1
  66. package/fesm2022/ngwr-charts-bar-chart.mjs +13 -13
  67. package/fesm2022/ngwr-charts-bar-chart.mjs.map +1 -1
  68. package/fesm2022/ngwr-charts-boxplot-chart.mjs +9 -9
  69. package/fesm2022/ngwr-charts-boxplot-chart.mjs.map +1 -1
  70. package/fesm2022/ngwr-charts-bullet-chart.mjs +8 -8
  71. package/fesm2022/ngwr-charts-bullet-chart.mjs.map +1 -1
  72. package/fesm2022/ngwr-charts-candlestick-chart.mjs +11 -11
  73. package/fesm2022/ngwr-charts-candlestick-chart.mjs.map +1 -1
  74. package/fesm2022/ngwr-charts-chart-legend.mjs +2 -2
  75. package/fesm2022/ngwr-charts-chart-legend.mjs.map +1 -1
  76. package/fesm2022/ngwr-charts-core.mjs +20 -20
  77. package/fesm2022/ngwr-charts-core.mjs.map +1 -1
  78. package/fesm2022/ngwr-charts-donut-chart.mjs +2 -2
  79. package/fesm2022/ngwr-charts-donut-chart.mjs.map +1 -1
  80. package/fesm2022/ngwr-charts-funnel-chart.mjs +6 -6
  81. package/fesm2022/ngwr-charts-funnel-chart.mjs.map +1 -1
  82. package/fesm2022/ngwr-charts-gauge.mjs +3 -3
  83. package/fesm2022/ngwr-charts-gauge.mjs.map +1 -1
  84. package/fesm2022/ngwr-charts-heatmap-chart.mjs +3 -3
  85. package/fesm2022/ngwr-charts-heatmap-chart.mjs.map +1 -1
  86. package/fesm2022/ngwr-charts-line-chart.mjs +10 -10
  87. package/fesm2022/ngwr-charts-line-chart.mjs.map +1 -1
  88. package/fesm2022/ngwr-charts-meter-group.mjs +2 -2
  89. package/fesm2022/ngwr-charts-meter-group.mjs.map +1 -1
  90. package/fesm2022/ngwr-charts-radar-chart.mjs +11 -11
  91. package/fesm2022/ngwr-charts-radar-chart.mjs.map +1 -1
  92. package/fesm2022/ngwr-charts-scatter-chart.mjs +10 -10
  93. package/fesm2022/ngwr-charts-scatter-chart.mjs.map +1 -1
  94. package/fesm2022/ngwr-charts-treemap-chart.mjs +4 -4
  95. package/fesm2022/ngwr-charts-treemap-chart.mjs.map +1 -1
  96. package/fesm2022/ngwr-charts-waterfall-chart.mjs +7 -7
  97. package/fesm2022/ngwr-charts-waterfall-chart.mjs.map +1 -1
  98. package/fesm2022/ngwr-checkbox.mjs +2 -2
  99. package/fesm2022/ngwr-checkbox.mjs.map +1 -1
  100. package/fesm2022/ngwr-collapse.mjs +2 -2
  101. package/fesm2022/ngwr-collapse.mjs.map +1 -1
  102. package/fesm2022/ngwr-color-picker.mjs +52 -52
  103. package/fesm2022/ngwr-color-picker.mjs.map +1 -1
  104. package/fesm2022/ngwr-command-palette.mjs +4 -4
  105. package/fesm2022/ngwr-command-palette.mjs.map +1 -1
  106. package/fesm2022/ngwr-comment.mjs +2 -2
  107. package/fesm2022/ngwr-comment.mjs.map +1 -1
  108. package/fesm2022/ngwr-compare.mjs +6 -6
  109. package/fesm2022/ngwr-compare.mjs.map +1 -1
  110. package/fesm2022/ngwr-context-menu.mjs +4 -4
  111. package/fesm2022/ngwr-context-menu.mjs.map +1 -1
  112. package/fesm2022/ngwr-copy-value-testing.mjs +58 -0
  113. package/fesm2022/ngwr-copy-value-testing.mjs.map +1 -0
  114. package/fesm2022/ngwr-copy-value.mjs +196 -0
  115. package/fesm2022/ngwr-copy-value.mjs.map +1 -0
  116. package/fesm2022/ngwr-counter.mjs +3 -3
  117. package/fesm2022/ngwr-counter.mjs.map +1 -1
  118. package/fesm2022/ngwr-date-picker-testing.mjs.map +1 -1
  119. package/fesm2022/ngwr-date-picker.mjs +217 -40
  120. package/fesm2022/ngwr-date-picker.mjs.map +1 -1
  121. package/fesm2022/ngwr-date.mjs +27 -5
  122. package/fesm2022/ngwr-date.mjs.map +1 -1
  123. package/fesm2022/ngwr-dialog.mjs +32 -3
  124. package/fesm2022/ngwr-dialog.mjs.map +1 -1
  125. package/fesm2022/ngwr-directives.mjs +116 -1
  126. package/fesm2022/ngwr-directives.mjs.map +1 -1
  127. package/fesm2022/ngwr-drawer.mjs +3 -3
  128. package/fesm2022/ngwr-drawer.mjs.map +1 -1
  129. package/fesm2022/ngwr-dropdown.mjs +13 -12
  130. package/fesm2022/ngwr-dropdown.mjs.map +1 -1
  131. package/fesm2022/ngwr-editor.mjs +28 -28
  132. package/fesm2022/ngwr-editor.mjs.map +1 -1
  133. package/fesm2022/ngwr-event-calendar.mjs +5 -5
  134. package/fesm2022/ngwr-event-calendar.mjs.map +1 -1
  135. package/fesm2022/ngwr-file-upload.mjs +8 -8
  136. package/fesm2022/ngwr-file-upload.mjs.map +1 -1
  137. package/fesm2022/ngwr-graph.mjs +3 -3
  138. package/fesm2022/ngwr-graph.mjs.map +1 -1
  139. package/fesm2022/ngwr-hotkey.mjs +22 -22
  140. package/fesm2022/ngwr-hotkey.mjs.map +1 -1
  141. package/fesm2022/ngwr-i18n-ar.mjs +5 -0
  142. package/fesm2022/ngwr-i18n-ar.mjs.map +1 -1
  143. package/fesm2022/ngwr-i18n-cs.mjs +5 -0
  144. package/fesm2022/ngwr-i18n-cs.mjs.map +1 -1
  145. package/fesm2022/ngwr-i18n-de.mjs +5 -0
  146. package/fesm2022/ngwr-i18n-de.mjs.map +1 -1
  147. package/fesm2022/ngwr-i18n-en.mjs +5 -0
  148. package/fesm2022/ngwr-i18n-en.mjs.map +1 -1
  149. package/fesm2022/ngwr-i18n-es.mjs +5 -0
  150. package/fesm2022/ngwr-i18n-es.mjs.map +1 -1
  151. package/fesm2022/ngwr-i18n-fr.mjs +5 -0
  152. package/fesm2022/ngwr-i18n-fr.mjs.map +1 -1
  153. package/fesm2022/ngwr-i18n-he.mjs +5 -0
  154. package/fesm2022/ngwr-i18n-he.mjs.map +1 -1
  155. package/fesm2022/ngwr-i18n-hi.mjs +5 -0
  156. package/fesm2022/ngwr-i18n-hi.mjs.map +1 -1
  157. package/fesm2022/ngwr-i18n-id.mjs +5 -0
  158. package/fesm2022/ngwr-i18n-id.mjs.map +1 -1
  159. package/fesm2022/ngwr-i18n-it.mjs +5 -0
  160. package/fesm2022/ngwr-i18n-it.mjs.map +1 -1
  161. package/fesm2022/ngwr-i18n-ja.mjs +5 -0
  162. package/fesm2022/ngwr-i18n-ja.mjs.map +1 -1
  163. package/fesm2022/ngwr-i18n-ko.mjs +5 -0
  164. package/fesm2022/ngwr-i18n-ko.mjs.map +1 -1
  165. package/fesm2022/ngwr-i18n-nl.mjs +5 -0
  166. package/fesm2022/ngwr-i18n-nl.mjs.map +1 -1
  167. package/fesm2022/ngwr-i18n-pl.mjs +5 -0
  168. package/fesm2022/ngwr-i18n-pl.mjs.map +1 -1
  169. package/fesm2022/ngwr-i18n-pt.mjs +5 -0
  170. package/fesm2022/ngwr-i18n-pt.mjs.map +1 -1
  171. package/fesm2022/ngwr-i18n-ru.mjs +5 -0
  172. package/fesm2022/ngwr-i18n-ru.mjs.map +1 -1
  173. package/fesm2022/ngwr-i18n-sv.mjs +5 -0
  174. package/fesm2022/ngwr-i18n-sv.mjs.map +1 -1
  175. package/fesm2022/ngwr-i18n-tr.mjs +5 -0
  176. package/fesm2022/ngwr-i18n-tr.mjs.map +1 -1
  177. package/fesm2022/ngwr-i18n-uk.mjs +5 -0
  178. package/fesm2022/ngwr-i18n-uk.mjs.map +1 -1
  179. package/fesm2022/ngwr-i18n-vi.mjs +5 -0
  180. package/fesm2022/ngwr-i18n-vi.mjs.map +1 -1
  181. package/fesm2022/ngwr-i18n-zh-tw.mjs +5 -0
  182. package/fesm2022/ngwr-i18n-zh-tw.mjs.map +1 -1
  183. package/fesm2022/ngwr-i18n-zh.mjs +5 -0
  184. package/fesm2022/ngwr-i18n-zh.mjs.map +1 -1
  185. package/fesm2022/ngwr-i18n.mjs +2 -2
  186. package/fesm2022/ngwr-i18n.mjs.map +1 -1
  187. package/fesm2022/ngwr-icon.mjs +5 -5
  188. package/fesm2022/ngwr-icon.mjs.map +1 -1
  189. package/fesm2022/ngwr-image-cropper.mjs +11 -11
  190. package/fesm2022/ngwr-image-cropper.mjs.map +1 -1
  191. package/fesm2022/ngwr-input-number.mjs +4 -4
  192. package/fesm2022/ngwr-input-number.mjs.map +1 -1
  193. package/fesm2022/ngwr-input-otp.mjs +2 -2
  194. package/fesm2022/ngwr-input-otp.mjs.map +1 -1
  195. package/fesm2022/ngwr-input.mjs +15 -15
  196. package/fesm2022/ngwr-input.mjs.map +1 -1
  197. package/fesm2022/ngwr-keyboard.mjs +28 -28
  198. package/fesm2022/ngwr-keyboard.mjs.map +1 -1
  199. package/fesm2022/ngwr-knob.mjs +4 -4
  200. package/fesm2022/ngwr-knob.mjs.map +1 -1
  201. package/fesm2022/ngwr-lightbox.mjs +2 -2
  202. package/fesm2022/ngwr-lightbox.mjs.map +1 -1
  203. package/fesm2022/ngwr-load-state.mjs +2 -2
  204. package/fesm2022/ngwr-load-state.mjs.map +1 -1
  205. package/fesm2022/ngwr-mention.mjs +6 -6
  206. package/fesm2022/ngwr-mention.mjs.map +1 -1
  207. package/fesm2022/ngwr-meta.mjs +19 -3
  208. package/fesm2022/ngwr-meta.mjs.map +1 -1
  209. package/fesm2022/ngwr-overlay.mjs +3 -3
  210. package/fesm2022/ngwr-overlay.mjs.map +1 -1
  211. package/fesm2022/ngwr-pagination.mjs +7 -5
  212. package/fesm2022/ngwr-pagination.mjs.map +1 -1
  213. package/fesm2022/ngwr-pipes.mjs +3 -5
  214. package/fesm2022/ngwr-pipes.mjs.map +1 -1
  215. package/fesm2022/ngwr-platform.mjs +4 -1
  216. package/fesm2022/ngwr-platform.mjs.map +1 -1
  217. package/fesm2022/ngwr-popconfirm.mjs +6 -5
  218. package/fesm2022/ngwr-popconfirm.mjs.map +1 -1
  219. package/fesm2022/ngwr-popover.mjs +31 -30
  220. package/fesm2022/ngwr-popover.mjs.map +1 -1
  221. package/fesm2022/ngwr-pull-to-refresh.mjs +2 -2
  222. package/fesm2022/ngwr-pull-to-refresh.mjs.map +1 -1
  223. package/fesm2022/ngwr-qr.mjs +6 -6
  224. package/fesm2022/ngwr-qr.mjs.map +1 -1
  225. package/fesm2022/ngwr-radio.mjs +3 -3
  226. package/fesm2022/ngwr-radio.mjs.map +1 -1
  227. package/fesm2022/ngwr-rating.mjs +10 -10
  228. package/fesm2022/ngwr-rating.mjs.map +1 -1
  229. package/fesm2022/ngwr-schema-form.mjs +15 -5
  230. package/fesm2022/ngwr-schema-form.mjs.map +1 -1
  231. package/fesm2022/ngwr-select.mjs +57 -34
  232. package/fesm2022/ngwr-select.mjs.map +1 -1
  233. package/fesm2022/ngwr-sidebar.mjs +3 -3
  234. package/fesm2022/ngwr-sidebar.mjs.map +1 -1
  235. package/fesm2022/ngwr-skeleton.mjs +2 -2
  236. package/fesm2022/ngwr-skeleton.mjs.map +1 -1
  237. package/fesm2022/ngwr-slider-testing.mjs.map +1 -1
  238. package/fesm2022/ngwr-slider.mjs +13 -13
  239. package/fesm2022/ngwr-slider.mjs.map +1 -1
  240. package/fesm2022/ngwr-sortable-list.mjs +3 -3
  241. package/fesm2022/ngwr-sortable-list.mjs.map +1 -1
  242. package/fesm2022/ngwr-splitter.mjs +5 -5
  243. package/fesm2022/ngwr-splitter.mjs.map +1 -1
  244. package/fesm2022/ngwr-statistic.mjs +5 -3
  245. package/fesm2022/ngwr-statistic.mjs.map +1 -1
  246. package/fesm2022/ngwr-storage.mjs +6 -4
  247. package/fesm2022/ngwr-storage.mjs.map +1 -1
  248. package/fesm2022/ngwr-switch.mjs +2 -2
  249. package/fesm2022/ngwr-switch.mjs.map +1 -1
  250. package/fesm2022/ngwr-table-testing.mjs.map +1 -1
  251. package/fesm2022/ngwr-table.mjs +263 -32
  252. package/fesm2022/ngwr-table.mjs.map +1 -1
  253. package/fesm2022/ngwr-tabs.mjs +2 -2
  254. package/fesm2022/ngwr-tabs.mjs.map +1 -1
  255. package/fesm2022/ngwr-toast-testing.mjs +8 -1
  256. package/fesm2022/ngwr-toast-testing.mjs.map +1 -1
  257. package/fesm2022/ngwr-toast.mjs +63 -20
  258. package/fesm2022/ngwr-toast.mjs.map +1 -1
  259. package/fesm2022/ngwr-tour.mjs +7 -7
  260. package/fesm2022/ngwr-tour.mjs.map +1 -1
  261. package/fesm2022/ngwr-transfer.mjs +20 -9
  262. package/fesm2022/ngwr-transfer.mjs.map +1 -1
  263. package/fesm2022/ngwr-tree.mjs +64 -24
  264. package/fesm2022/ngwr-tree.mjs.map +1 -1
  265. package/fesm2022/ngwr-utils.mjs +98 -55
  266. package/fesm2022/ngwr-utils.mjs.map +1 -1
  267. package/fesm2022/ngwr-validators.mjs +2 -2
  268. package/fesm2022/ngwr-validators.mjs.map +1 -1
  269. package/fesm2022/ngwr-version.mjs +1 -1
  270. package/fesm2022/ngwr-version.mjs.map +1 -1
  271. package/fesm2022/ngwr-window.mjs +26 -26
  272. package/fesm2022/ngwr-window.mjs.map +1 -1
  273. package/fesm2022/ngwr.mjs.map +1 -1
  274. package/i18n/ar.json +5 -0
  275. package/i18n/cs.json +5 -0
  276. package/i18n/de.json +5 -0
  277. package/i18n/en.json +5 -0
  278. package/i18n/es.json +5 -0
  279. package/i18n/fr.json +5 -0
  280. package/i18n/he.json +5 -0
  281. package/i18n/hi.json +5 -0
  282. package/i18n/id.json +5 -0
  283. package/i18n/it.json +5 -0
  284. package/i18n/ja.json +5 -0
  285. package/i18n/ko.json +5 -0
  286. package/i18n/nl.json +5 -0
  287. package/i18n/pl.json +5 -0
  288. package/i18n/pt.json +5 -0
  289. package/i18n/ru.json +5 -0
  290. package/i18n/sv.json +5 -0
  291. package/i18n/tr.json +5 -0
  292. package/i18n/uk.json +5 -0
  293. package/i18n/vi.json +5 -0
  294. package/i18n/zh-TW.json +5 -0
  295. package/i18n/zh.json +5 -0
  296. package/input-number/styles/_index.scss +6 -0
  297. package/llms-full.txt +31 -19
  298. package/llms.txt +37 -19
  299. package/mcp/providers.js +1 -1
  300. package/package.json +15 -10
  301. package/pagination/styles/_index.scss +8 -0
  302. package/schematics/icon-set/index.js +3 -3
  303. package/schematics/migrations/v16/index.js +742 -0
  304. package/schematics/migrations.json +5 -0
  305. package/schematics/ng-add/index.js +4 -4
  306. package/schematics/provider/index.js +4 -4
  307. package/schematics/use/symbol-map.json +2 -0
  308. package/select/styles/_index.scss +1 -1
  309. package/skills/ngwr/SKILL.md +6 -4
  310. package/skills/ngwr/references/catalog.md +4 -2
  311. package/skills/ngwr/references/setup.md +10 -9
  312. package/table/styles/_index.scss +92 -30
  313. package/toast/styles/_index.scss +30 -0
  314. package/tree/styles/_index.scss +17 -0
  315. package/types/index-CXbgza47.d.ts +13 -0
  316. package/types/ngwr-animations-aurora.d.ts +1 -1
  317. package/types/ngwr-animations-blur-reveal.d.ts +2 -2
  318. package/types/ngwr-animations-dot-grid.d.ts +1 -2
  319. package/types/ngwr-animations-flow-lines.d.ts +1 -1
  320. package/types/ngwr-animations-fluid-cursor.d.ts +1 -1
  321. package/types/ngwr-animations-reveal.d.ts +4 -8
  322. package/types/ngwr-animations-ripple-grid.d.ts +1 -1
  323. package/types/ngwr-animations-spotlight.d.ts +1 -1
  324. package/types/ngwr-animations-thread-lines.d.ts +1 -1
  325. package/types/ngwr-animations-tilt.d.ts +1 -1
  326. package/types/ngwr-avatar.d.ts +2 -2
  327. package/types/ngwr-badge.d.ts +1 -1
  328. package/types/ngwr-cascader.d.ts +12 -1
  329. package/types/ngwr-charts-boxplot-chart.d.ts +1 -1
  330. package/types/ngwr-charts-bullet-chart.d.ts +2 -2
  331. package/types/ngwr-charts-candlestick-chart.d.ts +1 -1
  332. package/types/ngwr-charts-core.d.ts +12 -12
  333. package/types/ngwr-charts-line-chart.d.ts +2 -2
  334. package/types/ngwr-charts-radar-chart.d.ts +1 -1
  335. package/types/ngwr-charts-scatter-chart.d.ts +2 -2
  336. package/types/ngwr-charts-waterfall-chart.d.ts +1 -1
  337. package/types/ngwr-color-picker.d.ts +12 -12
  338. package/types/ngwr-copy-value-testing.d.ts +87 -0
  339. package/types/ngwr-copy-value.d.ts +95 -0
  340. package/types/ngwr-date-picker-testing.d.ts +3 -3
  341. package/types/ngwr-date-picker.d.ts +97 -1
  342. package/types/ngwr-date.d.ts +44 -3
  343. package/types/ngwr-dialog.d.ts +50 -3
  344. package/types/ngwr-directives.d.ts +40 -0
  345. package/types/ngwr-drawer.d.ts +1 -1
  346. package/types/ngwr-dropdown.d.ts +3 -2
  347. package/types/ngwr-hotkey.d.ts +5 -5
  348. package/types/ngwr-i18n.d.ts +3 -3
  349. package/types/ngwr-icon.d.ts +26 -26
  350. package/types/ngwr-input-number.d.ts +2 -2
  351. package/types/ngwr-input.d.ts +8 -8
  352. package/types/ngwr-load-state.d.ts +6 -6
  353. package/types/ngwr-meta.d.ts +18 -0
  354. package/types/ngwr-pipes.d.ts +6 -4
  355. package/types/ngwr-platform.d.ts +2 -1
  356. package/types/ngwr-popconfirm.d.ts +3 -2
  357. package/types/ngwr-popover.d.ts +4 -3
  358. package/types/ngwr-select.d.ts +33 -18
  359. package/types/ngwr-slider-testing.d.ts +2 -2
  360. package/types/ngwr-slider.d.ts +3 -3
  361. package/types/ngwr-statistic.d.ts +5 -1
  362. package/types/ngwr-storage.d.ts +1 -1
  363. package/types/ngwr-table-testing.d.ts +2 -1
  364. package/types/ngwr-table.d.ts +155 -18
  365. package/types/ngwr-tabs.d.ts +10 -2
  366. package/types/ngwr-toast-testing.d.ts +6 -2
  367. package/types/ngwr-toast.d.ts +33 -5
  368. package/types/ngwr-transfer.d.ts +5 -0
  369. package/types/ngwr-tree.d.ts +22 -2
  370. package/types/ngwr-utils.d.ts +157 -82
  371. package/types/ngwr-validators.d.ts +4 -2
  372. package/types/ngwr-version.d.ts +1 -1
  373. package/types/ngwr.d.ts +1 -0
  374. package/types/pointer-tracker-D7fXxLQL.d.ts +24 -0
  375. package/fesm2022/ngwr-animations-core.mjs.map +0 -1
  376. package/types/ngwr-animations-core.d.ts +0 -294
@@ -1 +1 @@
1
- {"version":3,"file":"ngwr-color-picker.mjs","names":[],"sources":["../../../projects/lib/color-picker/color/rgb-to-hsv.ts","../../../projects/lib/color-picker/color/hsv-to-rgb.ts","../../../projects/lib/color-picker/color/rgb-to-hsl.ts","../../../projects/lib/color-picker/color/hsl-to-rgb.ts","../../../projects/lib/color-picker/color/parse-hex.ts","../../../projects/lib/color-picker/color/to-hex.ts","../../../projects/lib/color-picker/color/parse-color.ts","../../../projects/lib/color-picker/color/format-color.ts","../../../projects/lib/color-picker/color-picker.ts","../../../projects/lib/color-picker/color-picker.html","../../../projects/lib/color-picker/color-picker-trigger.ts"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport type { WrHsv } from './wr-hsv';\nimport type { WrRgb } from './wr-rgb';\n\n/**\n * Convert sRGB to HSV. Preserves alpha.\n */\nexport function rgbToHsv(rgb: WrRgb): WrHsv {\n const r = rgb.r / 255;\n const g = rgb.g / 255;\n const b = rgb.b / 255;\n const max = Math.max(r, g, b);\n const min = Math.min(r, g, b);\n const d = max - min;\n\n let h = 0;\n if (d !== 0) {\n if (max === r) h = ((g - b) / d) % 6;\n else if (max === g) h = (b - r) / d + 2;\n else h = (r - g) / d + 4;\n h *= 60;\n if (h < 0) h += 360;\n }\n\n const s = max === 0 ? 0 : d / max;\n const v = max;\n\n return { h, s, v, a: rgb.a };\n}\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport type { WrHsv } from './wr-hsv';\nimport type { WrRgb } from './wr-rgb';\n\n/**\n * Convert HSV to sRGB. Preserves alpha. Returns integer channels in `[0, 255]`.\n */\nexport function hsvToRgb(hsv: WrHsv): WrRgb {\n const { h, s, v } = hsv;\n const c = v * s;\n const x = c * (1 - Math.abs(((h / 60) % 2) - 1));\n const m = v - c;\n\n let r = 0;\n let g = 0;\n let b = 0;\n\n if (h < 60) {\n r = c;\n g = x;\n } else if (h < 120) {\n r = x;\n g = c;\n } else if (h < 180) {\n g = c;\n b = x;\n } else if (h < 240) {\n g = x;\n b = c;\n } else if (h < 300) {\n r = x;\n b = c;\n } else {\n r = c;\n b = x;\n }\n\n return {\n r: Math.round((r + m) * 255),\n g: Math.round((g + m) * 255),\n b: Math.round((b + m) * 255),\n a: hsv.a,\n };\n}\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport type { WrHsl } from './wr-hsl';\nimport type { WrRgb } from './wr-rgb';\n\n/**\n * Convert sRGB to HSL. Preserves alpha.\n */\nexport function rgbToHsl(rgb: WrRgb): WrHsl {\n const r = rgb.r / 255;\n const g = rgb.g / 255;\n const b = rgb.b / 255;\n const max = Math.max(r, g, b);\n const min = Math.min(r, g, b);\n const d = max - min;\n const l = (max + min) / 2;\n\n let h = 0;\n let s = 0;\n\n if (d !== 0) {\n s = l > 0.5 ? d / (2 - max - min) : d / (max + min);\n\n if (max === r) h = (g - b) / d + (g < b ? 6 : 0);\n else if (max === g) h = (b - r) / d + 2;\n else h = (r - g) / d + 4;\n\n h *= 60;\n }\n\n return { h, s, l, a: rgb.a };\n}\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport type { WrHsl } from './wr-hsl';\nimport type { WrRgb } from './wr-rgb';\n\nfunction hueToChannel(p: number, q: number, t: number): number {\n let x = t;\n if (x < 0) x += 1;\n if (x > 1) x -= 1;\n if (x < 1 / 6) return p + (q - p) * 6 * x;\n if (x < 1 / 2) return q;\n if (x < 2 / 3) return p + (q - p) * (2 / 3 - x) * 6;\n return p;\n}\n\n/**\n * Convert HSL to sRGB. Preserves alpha. Returns integer channels in `[0, 255]`.\n */\nexport function hslToRgb(hsl: WrHsl): WrRgb {\n const h = hsl.h / 360;\n const { s, l } = hsl;\n\n let r: number;\n let g: number;\n let b: number;\n\n if (s === 0) {\n r = l;\n g = l;\n b = l;\n } else {\n const q = l < 0.5 ? l * (1 + s) : l + s - l * s;\n const p = 2 * l - q;\n r = hueToChannel(p, q, h + 1 / 3);\n g = hueToChannel(p, q, h);\n b = hueToChannel(p, q, h - 1 / 3);\n }\n\n return {\n r: Math.round(r * 255),\n g: Math.round(g * 255),\n b: Math.round(b * 255),\n a: hsl.a,\n };\n}\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport type { WrRgb } from './wr-rgb';\n\n/**\n * Parse a CSS hex colour into {@link WrRgb}. Accepts 3, 4, 6, or 8 digit\n * forms with or without a leading `#`. Returns `null` for anything that\n * isn't a valid hex string.\n *\n * @example\n * ```ts\n * parseHex('#f00'); // { r: 255, g: 0, b: 0, a: 1 }\n * parseHex('3969e2'); // { r: 57, g: 105, b: 226, a: 1 }\n * parseHex('#3969e2ff'); // { r: 57, g: 105, b: 226, a: 1 }\n * parseHex('nope'); // null\n * ```\n */\nexport function parseHex(input: string): WrRgb | null {\n if (typeof input !== 'string') return null;\n\n let str = input.trim().replace(/^#/, '').toLowerCase();\n\n // Expand shorthand: rgb → rrggbb, rgba → rrggbbaa\n if (str.length === 3 || str.length === 4) {\n str = str\n .split('')\n .map(c => c + c)\n .join('');\n }\n\n if (str.length !== 6 && str.length !== 8) return null;\n if (!/^[0-9a-f]+$/.test(str)) return null;\n\n const r = parseInt(str.slice(0, 2), 16);\n const g = parseInt(str.slice(2, 4), 16);\n const b = parseInt(str.slice(4, 6), 16);\n const a = str.length === 8 ? parseInt(str.slice(6, 8), 16) / 255 : 1;\n\n return { r, g, b, a };\n}\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport type { WrRgb } from './wr-rgb';\n\nfunction channelToHex(n: number): string {\n const clamped = Math.max(0, Math.min(255, Math.round(n)));\n return clamped.toString(16).padStart(2, '0');\n}\n\n/**\n * Format a {@link WrRgb} as a CSS hex string with a leading `#`. When\n * `withAlpha` is `true` the result is 8 digits (`#rrggbbaa`); otherwise\n * 6 digits.\n *\n * @example\n * ```ts\n * toHex({ r: 57, g: 105, b: 226, a: 1 }); // '#3969e2'\n * toHex({ r: 57, g: 105, b: 226, a: 0.5 }, true); // '#3969e280'\n * ```\n */\nexport function toHex(rgb: WrRgb, withAlpha = false): string {\n const r = channelToHex(rgb.r);\n const g = channelToHex(rgb.g);\n const b = channelToHex(rgb.b);\n if (withAlpha) {\n const a = channelToHex(rgb.a * 255);\n return `#${r}${g}${b}${a}`;\n }\n return `#${r}${g}${b}`;\n}\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { clamp } from 'ngwr/utils';\n\nimport { hslToRgb } from './hsl-to-rgb';\nimport { parseHex } from './parse-hex';\nimport type { WrRgb } from './wr-rgb';\n\n/**\n * `rgb(…)` / `rgba(…)`, comma- or space-separated, with an optional `/ alpha`.\n * Signs are accepted so an out-of-range channel CLAMPS the way CSS clamps it,\n * rather than failing to parse and reading as black.\n */\nconst RGB_RE = /^rgba?\\(\\s*(-?[\\d.]+)\\s*[,\\s]\\s*(-?[\\d.]+)\\s*[,\\s]\\s*(-?[\\d.]+)\\s*(?:[,/]\\s*(-?[\\d.]+%?)\\s*)?\\)$/i;\n\n/** `hsl(…)` / `hsla(…)`, with `%` optional on saturation and lightness. */\nconst HSL_RE =\n /^hsla?\\(\\s*(-?[\\d.]+)(?:deg)?\\s*[,\\s]\\s*(-?[\\d.]+)%?\\s*[,\\s]\\s*(-?[\\d.]+)%?\\s*(?:[,/]\\s*(-?[\\d.]+%?)\\s*)?\\)$/i;\n\n/** `0.5` and `50%` are the same alpha; anything absent is fully opaque. */\nfunction alphaOf(raw: string | undefined): number {\n if (raw === undefined) return 1;\n const value = raw.endsWith('%') ? Number(raw.slice(0, -1)) / 100 : Number(raw);\n return Number.isFinite(value) ? clamp(value, 0, 1) : 1;\n}\n\nfunction channel(raw: string): number {\n return clamp(Math.round(Number(raw)), 0, 255);\n}\n\n/**\n * Read a colour written in any format `<wr-color-picker>` can emit — hex,\n * `rgb()` / `rgba()`, `hsl()` / `hsla()` — or `null` when it is none of them.\n *\n * The picker emits in whichever format it was given, so a `[(value)]` binding\n * hands its own output straight back on the next external write. Accepting only\n * hex there (which is what it used to do) turned every non-hex value into black.\n *\n * `null` rather than a throw or a black fallback: the caller is often a text\n * field mid-typing, where \"not valid yet\" is the normal state.\n */\nexport function parseColor(input: string): WrRgb | null {\n const value = input.trim();\n if (value === '') return null;\n\n const hex = parseHex(value);\n if (hex) return hex;\n\n const rgb = RGB_RE.exec(value);\n if (rgb) {\n return { r: channel(rgb[1]), g: channel(rgb[2]), b: channel(rgb[3]), a: alphaOf(rgb[4]) };\n }\n\n const hsl = HSL_RE.exec(value);\n if (hsl) {\n return hslToRgb({\n // Normalised here rather than trusted downstream: `hslToRgb` happens to\n // absorb one negative turn inside `hueToChannel`, which is an internal\n // detail this function should not be leaning on.\n h: ((Number(hsl[1]) % 360) + 360) % 360,\n s: clamp(Number(hsl[2]) / 100, 0, 1),\n l: clamp(Number(hsl[3]) / 100, 0, 1),\n a: alphaOf(hsl[4]),\n });\n }\n\n return null;\n}\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport type { WrColorFormat } from '../types';\n\nimport { rgbToHsl } from './rgb-to-hsl';\nimport { toHex } from './to-hex';\nimport type { WrRgb } from './wr-rgb';\n\n/** Alpha with at most two decimals, and no trailing zeroes: `0.5`, not `0.50`. */\nfunction alphaText(a: number): string {\n return String(Math.round(a * 100) / 100);\n}\n\n/**\n * Render a colour in the format a `<wr-color-picker>` was asked for.\n *\n * `withAlpha` follows the picker's own `alpha` input, so each format has an\n * opaque and a translucent spelling — `#3969e2` / `#3969e2ff`,\n * `rgb(…)` / `rgba(…)`, `hsl(…)` / `hsla(…)` — and a picker with the alpha\n * slider turned off never emits a channel the caller cannot see or edit.\n */\nexport function formatColor(rgb: WrRgb, format: WrColorFormat, withAlpha: boolean): string {\n if (format === 'hex') return toHex(rgb, withAlpha);\n\n if (format === 'rgba') {\n const { r, g, b } = rgb;\n return withAlpha ? `rgba(${r}, ${g}, ${b}, ${alphaText(rgb.a)})` : `rgb(${r}, ${g}, ${b})`;\n }\n\n const { h, s, l } = rgbToHsl(rgb);\n const parts = `${Math.round(h)}, ${Math.round(s * 100)}%, ${Math.round(l * 100)}%`;\n return withAlpha ? `hsla(${parts}, ${alphaText(rgb.a)})` : `hsl(${parts})`;\n}\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { Directionality } from '@angular/cdk/bidi';\nimport { coerceBooleanProperty } from '@angular/cdk/coercion';\nimport { DecimalPipe } from '@angular/common';\nimport {\n Component,\n type ElementRef,\n HostAttributeToken,\n ViewEncapsulation,\n computed,\n effect,\n inject,\n input,\n model,\n output,\n signal,\n viewChild,\n} from '@angular/core';\nimport type { FormValueControl } from '@angular/forms/signals';\n\nimport { WR_FORM_FIELD, useFormFieldAria } from 'ngwr/form';\nimport { readI18nText, useI18nFormatter } from 'ngwr/i18n';\nimport { WrSegmented, type WrSegmentedOption } from 'ngwr/segmented';\nimport { clamp, wrCheckStyles } from 'ngwr/utils';\n\nimport {\n formatColor,\n hsvToRgb,\n parseColor,\n parseHex,\n rgbToHsl,\n rgbToHsv,\n toHex,\n type WrHsl,\n type WrRgb,\n} from './color';\nimport type { WrColorFormat } from './types';\n\ntype Tab = 'hex' | 'rgb' | 'hsl';\n\ntype Edges = 'sv' | 'hue' | 'alpha';\n\n/** Arrow step, in each surface's own unit: degrees of hue, percent everywhere else. */\nconst KEY_STEP = 1;\nconst KEY_STEP_COARSE = 10;\n\n/** Whether a hex string carries its own alpha (`#rgba` or `#rrggbbaa`). */\nfunction hasAlphaDigits(hex: string): boolean {\n const digits = hex.trim().replace(/^#/, '').length;\n return digits === 4 || digits === 8;\n}\n\n/**\n * Inline colour picker — HSV canvas, hue slider, optional alpha slider, HEX\n * input.\n *\n * A signal-forms native control: it implements `FormValueControl<string>`, so\n * `[formField]` binds straight to its `value` model — no\n * `ControlValueAccessor` in between. `[(value)]` works standalone. Output is\n * always a hex string.\n *\n * @example\n * ```html\n * <!-- signal forms -->\n * <wr-color-picker [formField]=\"form.brandColor\" />\n *\n * <!-- standalone two-way binding -->\n * <wr-color-picker [(value)]=\"brandColor\" [alpha]=\"false\" />\n * ```\n *\n * @see https://ngwr.dev/reference/components/color-picker\n */\n@Component({\n selector: 'wr-color-picker',\n templateUrl: './color-picker.html',\n encapsulation: ViewEncapsulation.None,\n host: {\n '[class]': 'classes()',\n // `role=\"group\"` so the field's label has somewhere to land: the picker is\n // a composite with no single element carrying its semantics, and its parts\n // name themselves — \"Saturation and brightness\", \"Hue\", \"Opacity\". Two\n // colour fields on one form announced the same three names twice, with\n // nothing saying which colour either belonged to. Same call `wr-transfer`\n // makes one directory over, for the same reason.\n role: 'group',\n '[attr.aria-labelledby]': 'labelledBy()',\n '[style.--wr-color-picker-hue]': 'hueCss()',\n '[style.--wr-color-picker-color]': 'opaqueCss()',\n },\n // The picker is the control a `<wr-form-field>` wraps; the `<wr-segmented>` tab\n // strip in its own template is a part, not a control. Without this shield the\n // tab strip found the field's token and announced the colour field's error as\n // its own — which is why `fieldAria` below reads the field with `skipSelf`.\n providers: [{ provide: WR_FORM_FIELD, useValue: null }],\n imports: [DecimalPipe, WrSegmented],\n})\nexport class WrColorPicker implements FormValueControl<string> {\n /** Render the alpha slider and emit 8-digit hex / `rgba()`. @default true */\n readonly alpha = input(true, { transform: coerceBooleanProperty });\n\n /** Disable interaction. @default false */\n readonly disabled = input(false, { transform: coerceBooleanProperty });\n\n /**\n * Refuse changes while every surface stays focusable and the colour still\n * submits. Bound automatically from the field's readonly state when used with\n * `[formField]`.\n *\n * The two sliders keep their tab stop and keep announcing `aria-valuenow` —\n * they simply do not move — the hex / channel fields take the native\n * `readonly` attribute, and the swatches go inert. Switching TABS still works:\n * that changes which notation is displayed, not the colour. `aria-readonly` is\n * mirrored on the sliders, which support it; the saturation surface is a\n * `role=\"group\"`, which does not, so it carries nothing.\n *\n * @default false\n */\n readonly readonly = input(false, { transform: coerceBooleanProperty });\n\n /** The surrounding `<wr-form-field>`'s error state. @internal */\n protected readonly fieldAria = useFormFieldAria({ skipSelf: true });\n /**\n * The author's own `aria-labelledby`, read as a static host attribute.\n *\n * A host binding WRITES the attribute, so binding the field's label\n * unconditionally would REMOVE a reference the consumer put there by hand:\n * `<wr-segmented aria-labelledby=\"range-question\">` went nameless the moment\n * the field's label was `null`, which a harness spec caught one commit after\n * it was introduced. `HostAttributeToken` reads it at construction without\n * touching the DOM, so this stays SSR-safe, and the author's own reference\n * wins — the same precedence `[ariaLabel]` has everywhere else.\n */\n private readonly ownLabelledBy = inject(new HostAttributeToken('aria-labelledby'), { optional: true });\n\n /** The surrounding field's label, unless the author named the control. */\n protected readonly labelledBy = computed(() => this.ownLabelledBy ?? this.fieldAria.labelledBy());\n\n /**\n * Format the control writes into `value`. See {@link WrColorFormat} — all\n * three are accepted on the way in whichever one is set. @default 'hex'\n */\n readonly format = input<WrColorFormat>('hex');\n\n /** Preset hex colours rendered as a clickable row beneath the inputs. Empty = no row. @default [] */\n readonly swatches = input<readonly string[]>([]);\n\n /** The selected colour as a string. Bound by `[formField]`, or two-way via `[(value)]`. */\n readonly value = model<string>('');\n\n /** Emitted on blur so a bound field can mark itself touched. */\n readonly touch = output<void>();\n\n // Source of truth: HSV + alpha\n\n protected readonly h = signal(0);\n protected readonly s = signal(0);\n protected readonly v = signal(0);\n protected readonly a = signal(1);\n\n // Derived values\n\n /** RGB view of the current colour, computed lazily. */\n protected readonly rgb = computed<WrRgb>(() => hsvToRgb({ h: this.h(), s: this.s(), v: this.v(), a: this.a() }));\n\n /** Canonical hex — what the HEX field shows, whatever `format` emits. */\n protected readonly hex = computed(() => toHex(this.rgb(), this.alpha()));\n\n /** The colour as the consumer asked for it; this is what `value` receives. */\n protected readonly formatted = computed(() => formatColor(this.rgb(), this.format(), this.alpha()));\n\n /** SV canvas background colour (full-saturation hue). */\n protected readonly hueCss = computed(() => `hsl(${this.h()}, 100%, 50%)`);\n\n /**\n * The current colour at full opacity, the far end of the alpha slider's ramp.\n * A whole colour rather than a channel list, so the stylesheet fades it with\n * `transparent` instead of splicing channels into `rgba()`.\n */\n protected readonly opaqueCss = computed(() => {\n const { r, g, b } = this.rgb();\n return `rgb(${r} ${g} ${b})`;\n });\n\n /**\n * Ambient reading direction, for the two SLIDERS only — see `updateFromEvent`\n * for why the SV canvas is not in that set.\n *\n * Optional so a bare `TestBed` — or any consumer that never set a direction —\n * needs no provider; `Directionality` is root-provided, so `null` only ever\n * means \"nobody asked\", which is LTR. Read inside the handlers rather than\n * cached: the thumbs are placed with `inset-inline-start`, so the tracks mirror\n * from CSS alone and a runtime flip needs no subscription to\n * `Directionality.change`.\n */\n private readonly dir = inject(Directionality, { optional: true });\n\n /** Thumb positions in % for each surface. */\n protected readonly svThumbX = computed(() => this.s() * 100);\n protected readonly svThumbY = computed(() => (1 - this.v()) * 100);\n protected readonly hueThumbX = computed(() => (this.h() / 360) * 100);\n protected readonly alphaThumbX = computed(() => this.a() * 100);\n\n /** Mirror of the canonical hex, edited by the user via the input field. */\n protected readonly hexInput = signal('');\n\n /** Active tab in the input switcher. */\n protected readonly activeTab = signal<Tab>('hex');\n\n /**\n * The HSL last typed into the HSL boxes, with the value it produced.\n *\n * HSL read back off a colour has no hue at grey and no saturation at black or\n * white, so the boxes re-derived after `L` = 0 came back `0, 0, 0`, and the next\n * keystroke built on that: retyping the lightness turned any colour grey for\n * good. Kept only while `value` is still the one it produced — a drag, a swatch\n * or an outside write reads the colour again.\n */\n private readonly typedHsl = signal<{ readonly hsl: WrHsl; readonly value: string } | null>(null);\n\n /** HSL view of the current colour, computed lazily — see {@link typedHsl}. */\n protected readonly hslView = computed<WrHsl>(() => {\n const typed = this.typedHsl();\n if (typed?.value === this.value()) return typed.hsl;\n // The hue the surfaces hold, not the one RGB reports — which is 0 at every grey.\n return { ...rgbToHsl(this.rgb()), h: this.h() };\n });\n\n /** Alpha as integer percent — the numeric tabs and the alpha slider's `aria-valuenow`. */\n protected readonly alphaPercent = computed(() => Math.round(this.a() * 100));\n\n /** Hue in whole degrees, for the hue slider's `aria-valuenow`. */\n protected readonly hueValue = computed(() => Math.round(this.h()));\n\n private readonly areaLabel = useI18nFormatter(\n 'colorPicker.area',\n 'Saturation and brightness, {{saturation}}% and {{brightness}}%'\n );\n\n /** Name of the SV surface, carrying the two values a `role=\"group\"` cannot. */\n protected readonly resolvedAreaLabel = computed(() =>\n this.areaLabel({ saturation: Math.round(this.s() * 100), brightness: Math.round(this.v() * 100) })\n );\n\n protected readonly resolvedHueLabel = readI18nText('colorPicker.hue', 'Hue');\n protected readonly resolvedAlphaLabel = readI18nText('colorPicker.alpha', 'Opacity');\n\n /**\n * Every visible word in this component that is not a slider name.\n *\n * The format strip and the nine channel captions were literals — three in\n * TypeScript, the rest in the template — beside a `colorPicker` catalog\n * section that already existed and held the slider names. So the section was\n * there and these had simply not been put in it, which is why a fully Russian\n * picker still read `HEX RGB HSL` over `R G B`. Each caption is one string\n * INCLUDING its `%`, because a locale that spaces the sign differently has to\n * move the letter and the sign together.\n *\n * Signals, not strings: they follow a locale switch, and a catalog that lands\n * a microtask after the first change-detection pass.\n */\n protected readonly channelHexLabel = readI18nText('colorPicker.channelHex', 'HEX');\n protected readonly channelRedLabel = readI18nText('colorPicker.channelRed', 'R');\n protected readonly channelGreenLabel = readI18nText('colorPicker.channelGreen', 'G');\n protected readonly channelBlueLabel = readI18nText('colorPicker.channelBlue', 'B');\n protected readonly channelHueLabel = readI18nText('colorPicker.channelHue', 'H');\n protected readonly channelSaturationLabel = readI18nText('colorPicker.channelSaturation', 'S%');\n protected readonly channelLightnessLabel = readI18nText('colorPicker.channelLightness', 'L%');\n protected readonly channelAlphaLabel = readI18nText('colorPicker.channelAlpha', 'A%');\n\n private readonly formatHexLabel = readI18nText('colorPicker.formatHex', 'HEX');\n private readonly formatRgbLabel = readI18nText('colorPicker.formatRgb', 'RGB');\n private readonly formatHslLabel = readI18nText('colorPicker.formatHsl', 'HSL');\n\n /** A `computed`, because `WrSegmentedOption.label` is a plain string. */\n protected readonly tabOptions = computed<readonly WrSegmentedOption<Tab>[]>(() => [\n { value: 'hex', label: this.formatHexLabel() },\n { value: 'rgb', label: this.formatRgbLabel() },\n { value: 'hsl', label: this.formatHslLabel() },\n ]);\n\n protected readonly classes = computed(() => {\n const parts = ['wr-color-picker'];\n if (this.alpha()) parts.push('wr-color-picker--alpha');\n if (this.disabled()) parts.push('wr-color-picker--disabled');\n else if (this.readonly()) parts.push('wr-color-picker--readonly');\n return parts.join(' ');\n });\n\n /**\n * The one write we just made, held only until the sync effect has seen it.\n *\n * It exists so a drag keeps its continuous HSV values instead of being\n * re-quantised through its own hex round-trip. It used to be set and never\n * cleared, which turned \"ignore this write\" into \"ignore this STRING,\n * forever\": after the picker emitted `#ff0000` once, an app writing\n * `#ff0000` back — a reset button, a form patch, an undo — was silently\n * dropped for the rest of the component's life, and the surface kept\n * whatever colour the user had dragged to.\n */\n private lastEmitted: string | null = null;\n\n private readonly area = viewChild.required<ElementRef<HTMLElement>>('area');\n\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('color-picker');\n // External writes (via `[formField]` / `[(value)]`) flow the incoming hex\n // string back into the HSV source of truth. Our own emits are skipped via\n // `lastEmitted` so dragging keeps its continuous (unquantised) values.\n effect(() => {\n const value = this.value();\n if (value === this.lastEmitted) {\n // Ours, and now observed. Release the guard so the NEXT write of the\n // same string — which can only come from outside — is honoured.\n this.lastEmitted = null;\n return;\n }\n const rgb = parseColor(value) ?? { r: 0, g: 0, b: 0, a: 1 };\n const hsv = rgbToHsv(rgb);\n this.h.set(hsv.h);\n this.s.set(hsv.s);\n this.v.set(hsv.v);\n this.a.set(hsv.a);\n this.hexInput.set(toHex(rgb, this.alpha()));\n });\n }\n\n /**\n * Focus the picker — what Signal Forms calls to focus this control, from\n * `focusBoundControl()`. The host carries no tab stop, so the call goes to the\n * saturation surface: the first stop in the tab order, always rendered\n * whichever notation tab is showing, and it announces the field's error\n * description with it. A disabled picker is left alone, since its surfaces\n * drop to `tabindex=\"-1\"`, which a script could still focus.\n */\n focus(options?: FocusOptions): void {\n if (!this.disabled()) this.area().nativeElement.focus(options);\n }\n\n // Drag handlers\n\n protected onPointerDown(event: PointerEvent, surface: Edges): void {\n if (this.disabled() || this.readonly()) return;\n // Primary button, primary pointer: a right-click used to open the context\n // menu AND start a drag, and a second finger used to fight the first one.\n if (event.button !== 0 || !event.isPrimary) return;\n event.preventDefault();\n const target = event.currentTarget as HTMLElement;\n target.setPointerCapture(event.pointerId);\n\n const update = (e: PointerEvent): void => this.updateFromEvent(e, target, surface);\n const cleanup = (e: PointerEvent): void => {\n target.releasePointerCapture(e.pointerId);\n target.removeEventListener('pointermove', update);\n target.removeEventListener('pointerup', cleanup);\n target.removeEventListener('pointercancel', cleanup);\n this.touch.emit();\n };\n\n target.addEventListener('pointermove', update);\n target.addEventListener('pointerup', cleanup);\n // `pointercancel` never sends a `pointerup` after it, so without this the\n // move listener outlived the drag: a cancelled gesture left the surface\n // repainting the colour under a pointer that was only hovering.\n target.addEventListener('pointercancel', cleanup);\n this.updateFromEvent(event, target, surface);\n }\n\n // Keyboard handlers\n //\n // The three surfaces used to be bare `<div>`s carrying nothing but\n // `(pointerdown)` — no role, no name, no tab stop, no key handler — so the\n // control the component is built around was operable by pointer only. The\n // numeric HEX / RGB / HSL fields could always reach the same values, which is\n // why this is 4.1.2 rather than a total loss of keyboard access, but a\n // roleless div driving a colour is WCAG F59 either way.\n\n /**\n * Hue and alpha are real one-value sliders, so they take the APG slider keys —\n * the same set `wr-knob` and `wr-slider` implement, including Home / End.\n *\n * The horizontal arrows name a SIDE of the track and so follow the reading\n * direction, exactly as `wr-slider`'s do; the vertical pair names a value's\n * direction and never mirrors.\n */\n protected onSliderKeydown(event: KeyboardEvent, surface: 'hue' | 'alpha'): void {\n if (this.disabled() || this.readonly()) return;\n const step = event.shiftKey ? KEY_STEP_COARSE : KEY_STEP;\n const inline = this.dir?.value === 'rtl' ? -step : step;\n const max = surface === 'hue' ? 360 : 100;\n const current = surface === 'hue' ? this.h() : this.a() * 100;\n let next: number;\n switch (event.key) {\n case 'ArrowRight':\n next = current + inline;\n break;\n case 'ArrowUp':\n next = current + step;\n break;\n case 'ArrowLeft':\n next = current - inline;\n break;\n case 'ArrowDown':\n next = current - step;\n break;\n case 'Home':\n next = 0;\n break;\n case 'End':\n next = max;\n break;\n default:\n return;\n }\n event.preventDefault();\n const value = clamp(next, 0, max);\n if (surface === 'hue') this.h.set(value);\n else this.a.set(value / 100);\n this.emit();\n }\n\n /**\n * The SV canvas is two axes at once, so the keys follow the picture: left and\n * right run along saturation, up and down along brightness — the directions\n * the thumb visibly moves. Shift takes ten percent at a time.\n *\n * Not mirrored under `dir=\"rtl\"`, unlike the two sliders above, and for the\n * reason given on `fraction()`: the canvas is a picture rather than a track, so\n * its gradient does not flip and neither may the keys that walk it.\n */\n protected onAreaKeydown(event: KeyboardEvent): void {\n if (this.disabled() || this.readonly()) return;\n const step = (event.shiftKey ? KEY_STEP_COARSE : KEY_STEP) / 100;\n switch (event.key) {\n case 'ArrowRight':\n this.s.set(clamp(this.s() + step, 0, 1));\n break;\n case 'ArrowLeft':\n this.s.set(clamp(this.s() - step, 0, 1));\n break;\n case 'ArrowUp':\n this.v.set(clamp(this.v() + step, 0, 1));\n break;\n case 'ArrowDown':\n this.v.set(clamp(this.v() - step, 0, 1));\n break;\n default:\n return;\n }\n event.preventDefault();\n this.emit();\n }\n\n /** Leaving a surface is what \"touched\" means, the same as leaving the hex field. */\n protected onSurfaceBlur(): void {\n this.touch.emit();\n }\n\n /**\n * The pointer's position along a surface, as a 0–1 fraction.\n *\n * Measured from whichever edge the surface STARTS at, and the two surfaces do\n * not agree on what that means — deliberately.\n *\n * The hue and alpha bars are one-value tracks with `role=\"slider\"`, the same\n * widget `wr-slider` is, so they mirror: their thumbs are placed with\n * `inset-inline-start` and their gradients are flipped by a `[dir='rtl']` rule,\n * which makes the reader's start the physical right edge under `dir=\"rtl\"`.\n * Opacity 100% used to sit at the physical right in both directions, i.e. at\n * the reader's START in RTL, while the format strip in the same panel mirrored\n * correctly.\n *\n * The SV canvas does NOT mirror, and stays measured from `rect.left`. It is a\n * two-axis colour FIELD, not a track — the component says so itself by giving\n * it `role=\"group\"` rather than `role=\"slider\"`, because it carries two values\n * and a slider has one. A picture with no start and no end has nothing to\n * mirror, and flipping it would only move white to the other side of an image\n * every colour picker in the world draws the same way.\n */\n private fraction(event: PointerEvent, rect: DOMRect, surface: Edges): number {\n const offset =\n surface !== 'sv' && this.dir?.value === 'rtl' ? rect.right - event.clientX : event.clientX - rect.left;\n return clamp(offset / rect.width, 0, 1);\n }\n\n private updateFromEvent(event: PointerEvent, target: HTMLElement, surface: Edges): void {\n const rect = target.getBoundingClientRect();\n const x = this.fraction(event, rect, surface);\n\n if (surface === 'sv') {\n const y = clamp((event.clientY - rect.top) / rect.height, 0, 1);\n this.s.set(x);\n this.v.set(1 - y);\n } else if (surface === 'hue') {\n this.h.set(x * 360);\n } else {\n this.a.set(x);\n }\n this.emit();\n }\n\n // Hex input handlers\n\n protected onHexInput(event: Event): void {\n if (this.disabled() || this.readonly()) return;\n const raw = (event.target as HTMLInputElement).value;\n this.hexInput.set(raw);\n const rgb = parseHex(raw);\n if (!rgb) return;\n const hsv = rgbToHsv(rgb);\n this.h.set(hsv.h);\n this.s.set(hsv.s);\n this.v.set(hsv.v);\n this.a.set(hsv.a);\n this.emitWithoutHexSync();\n }\n\n protected onHexBlur(): void {\n // Re-sync the input with the canonical value (in case the user typed invalid).\n this.hexInput.set(this.hex());\n this.touch.emit();\n }\n\n // Emission\n\n private emit(): void {\n this.emitWithoutHexSync();\n this.hexInput.set(this.hex());\n }\n\n private emitWithoutHexSync(): void {\n const next = this.formatted();\n this.lastEmitted = next;\n this.value.set(next);\n }\n\n // Tab + channel handlers\n\n protected onTabChange(tab: Tab | null): void {\n if (tab) this.activeTab.set(tab);\n }\n\n /**\n * The number in a channel box, or `null` while there is none. An emptied box is\n * someone mid-retype, not a request for zero: `Number('')` is 0, so committing it\n * turned the colour black — or, for the alpha box, fully transparent.\n */\n private channelValue(event: Event): number | null {\n const raw = (event.target as HTMLInputElement).value;\n if (!raw.trim()) return null;\n const n = Number(raw);\n return Number.isNaN(n) ? null : n;\n }\n\n protected onRgbChannel(channel: 'r' | 'g' | 'b', event: Event): void {\n if (this.disabled() || this.readonly()) return;\n const typed = this.channelValue(event);\n if (typed === null) return;\n const n = clamp(typed, 0, 255);\n const current = this.rgb();\n const next: WrRgb = { ...current, [channel]: n };\n this.applyRgb(next);\n }\n\n protected onHslChannel(channel: 'h' | 's' | 'l', event: Event): void {\n if (this.disabled() || this.readonly()) return;\n const n = this.channelValue(event);\n if (n === null) return;\n const current = this.hslView();\n const next: WrHsl =\n channel === 'h' ? { ...current, h: clamp(n, 0, 360) } : { ...current, [channel]: clamp(n, 0, 100) / 100 };\n // Straight into HSV rather than through RGB, which has no hue to hand back at grey.\n const v = next.l + next.s * Math.min(next.l, 1 - next.l);\n this.h.set(next.h);\n this.s.set(v === 0 ? 0 : 2 * (1 - next.l / v));\n this.v.set(v);\n this.emit();\n this.typedHsl.set({ hsl: next, value: this.value() });\n }\n\n protected onAlphaPercent(event: Event): void {\n if (this.disabled() || this.readonly()) return;\n const typed = this.channelValue(event);\n if (typed === null) return;\n this.a.set(clamp(typed, 0, 100) / 100);\n this.emit();\n }\n\n protected onSwatchClick(hex: string): void {\n if (this.disabled() || this.readonly()) return;\n const rgb = parseHex(hex);\n if (!rgb) return;\n // A 6-digit swatch says nothing about alpha, and `parseHex` reports the\n // absence as `1` — so picking a preset used to silently snap a translucent\n // colour back to fully opaque.\n this.applyRgb(hasAlphaDigits(hex) ? rgb : { ...rgb, a: this.a() });\n }\n\n /** Push an RGB triple into the HSV source of truth. */\n private applyRgb(rgb: WrRgb): void {\n const hsv = rgbToHsv(rgb);\n this.h.set(hsv.h);\n this.s.set(hsv.s);\n this.v.set(hsv.v);\n this.a.set(hsv.a);\n this.emit();\n }\n}\n","<!--\n `role=\"group\"` rather than `role=\"slider\"`, because this surface holds TWO\n values and a slider has one `aria-valuenow`; and rather than\n `role=\"application\"`, which would switch the reader out of its own browse mode\n for the whole subtree — the call `wr-image-cropper` already made. A group has\n no value of its own, so the two percentages ride in its accessible name, which\n is where a reader querying the focused element finds them.\n-->\n<div\n #area\n class=\"wr-color-picker__sv\"\n role=\"group\"\n [attr.aria-label]=\"resolvedAreaLabel()\"\n [attr.aria-disabled]=\"disabled() || null\"\n [attr.aria-invalid]=\"fieldAria.ariaInvalid()\"\n [attr.aria-describedby]=\"fieldAria.describedBy()\"\n [attr.tabindex]=\"disabled() ? -1 : 0\"\n (pointerdown)=\"onPointerDown($event, 'sv')\"\n (keydown)=\"onAreaKeydown($event)\"\n (blur)=\"onSurfaceBlur()\"\n>\n <span class=\"wr-color-picker__thumb\" [style.left.%]=\"svThumbX()\" [style.top.%]=\"svThumbY()\"></span>\n</div>\n\n<div\n class=\"wr-color-picker__slider wr-color-picker__slider--hue\"\n role=\"slider\"\n aria-valuemin=\"0\"\n aria-valuemax=\"360\"\n [attr.aria-label]=\"resolvedHueLabel()\"\n [attr.aria-valuenow]=\"hueValue()\"\n [attr.aria-disabled]=\"disabled() || null\"\n [attr.aria-readonly]=\"readonly() || null\"\n [attr.aria-invalid]=\"fieldAria.ariaInvalid()\"\n [attr.aria-describedby]=\"fieldAria.describedBy()\"\n [attr.tabindex]=\"disabled() ? -1 : 0\"\n (pointerdown)=\"onPointerDown($event, 'hue')\"\n (keydown)=\"onSliderKeydown($event, 'hue')\"\n (blur)=\"onSurfaceBlur()\"\n>\n <!--\n `inset-inline-start`, not `left`: this is a one-value track, so it mirrors\n under `dir=\"rtl\"` the way `wr-slider` does. The SV thumb above keeps `left` —\n the canvas is a picture and does not flip.\n -->\n <span class=\"wr-color-picker__thumb wr-color-picker__thumb--slider\" [style.inset-inline-start.%]=\"hueThumbX()\"></span>\n</div>\n\n@if (alpha()) {\n <div\n class=\"wr-color-picker__slider wr-color-picker__slider--alpha\"\n role=\"slider\"\n aria-valuemin=\"0\"\n aria-valuemax=\"100\"\n [attr.aria-label]=\"resolvedAlphaLabel()\"\n [attr.aria-valuenow]=\"alphaPercent()\"\n [attr.aria-valuetext]=\"`${alphaPercent()}%`\"\n [attr.aria-disabled]=\"disabled() || null\"\n [attr.aria-readonly]=\"readonly() || null\"\n [attr.aria-invalid]=\"fieldAria.ariaInvalid()\"\n [attr.aria-describedby]=\"fieldAria.describedBy()\"\n [attr.tabindex]=\"disabled() ? -1 : 0\"\n (pointerdown)=\"onPointerDown($event, 'alpha')\"\n (keydown)=\"onSliderKeydown($event, 'alpha')\"\n (blur)=\"onSurfaceBlur()\"\n >\n <span\n class=\"wr-color-picker__thumb wr-color-picker__thumb--slider\"\n [style.inset-inline-start.%]=\"alphaThumbX()\"\n ></span>\n </div>\n}\n\n<div class=\"wr-color-picker__chrome\">\n <span class=\"wr-color-picker__preview\" [style.background]=\"hex()\"></span>\n <wr-segmented\n class=\"wr-color-picker__tabs\"\n [options]=\"tabOptions()\"\n [value]=\"activeTab()\"\n (valueChange)=\"onTabChange($event)\"\n />\n</div>\n\n@switch (activeTab()) {\n @case ('hex') {\n <div class=\"wr-color-picker__inputs wr-color-picker__inputs--hex\">\n <label class=\"wr-color-picker__field wr-color-picker__field--wide\">\n <input\n type=\"text\"\n spellcheck=\"false\"\n autocomplete=\"off\"\n [value]=\"hexInput()\"\n [disabled]=\"disabled()\"\n [readonly]=\"readonly()\"\n (input)=\"onHexInput($event)\"\n (blur)=\"onHexBlur()\"\n />\n <span class=\"wr-color-picker__field-label\">{{ channelHexLabel() }}</span>\n </label>\n </div>\n }\n @case ('rgb') {\n <div class=\"wr-color-picker__inputs\">\n <label class=\"wr-color-picker__field\">\n <input\n type=\"number\"\n min=\"0\"\n max=\"255\"\n [value]=\"rgb().r\"\n [disabled]=\"disabled()\"\n [readonly]=\"readonly()\"\n (input)=\"onRgbChannel('r', $event)\"\n />\n <span class=\"wr-color-picker__field-label\">{{ channelRedLabel() }}</span>\n </label>\n <label class=\"wr-color-picker__field\">\n <input\n type=\"number\"\n min=\"0\"\n max=\"255\"\n [value]=\"rgb().g\"\n [disabled]=\"disabled()\"\n [readonly]=\"readonly()\"\n (input)=\"onRgbChannel('g', $event)\"\n />\n <span class=\"wr-color-picker__field-label\">{{ channelGreenLabel() }}</span>\n </label>\n <label class=\"wr-color-picker__field\">\n <input\n type=\"number\"\n min=\"0\"\n max=\"255\"\n [value]=\"rgb().b\"\n [disabled]=\"disabled()\"\n [readonly]=\"readonly()\"\n (input)=\"onRgbChannel('b', $event)\"\n />\n <span class=\"wr-color-picker__field-label\">{{ channelBlueLabel() }}</span>\n </label>\n @if (alpha()) {\n <label class=\"wr-color-picker__field\">\n <input\n type=\"number\"\n min=\"0\"\n max=\"100\"\n [value]=\"alphaPercent()\"\n [disabled]=\"disabled()\"\n [readonly]=\"readonly()\"\n (input)=\"onAlphaPercent($event)\"\n />\n <span class=\"wr-color-picker__field-label\">{{ channelAlphaLabel() }}</span>\n </label>\n }\n </div>\n }\n @case ('hsl') {\n <div class=\"wr-color-picker__inputs\">\n <label class=\"wr-color-picker__field\">\n <input\n type=\"number\"\n min=\"0\"\n max=\"360\"\n [value]=\"hslView().h | number: '1.0-0'\"\n [disabled]=\"disabled()\"\n [readonly]=\"readonly()\"\n (input)=\"onHslChannel('h', $event)\"\n />\n <span class=\"wr-color-picker__field-label\">{{ channelHueLabel() }}</span>\n </label>\n <label class=\"wr-color-picker__field\">\n <input\n type=\"number\"\n min=\"0\"\n max=\"100\"\n [value]=\"hslView().s * 100 | number: '1.0-0'\"\n [disabled]=\"disabled()\"\n [readonly]=\"readonly()\"\n (input)=\"onHslChannel('s', $event)\"\n />\n <span class=\"wr-color-picker__field-label\">{{ channelSaturationLabel() }}</span>\n </label>\n <label class=\"wr-color-picker__field\">\n <input\n type=\"number\"\n min=\"0\"\n max=\"100\"\n [value]=\"hslView().l * 100 | number: '1.0-0'\"\n [disabled]=\"disabled()\"\n [readonly]=\"readonly()\"\n (input)=\"onHslChannel('l', $event)\"\n />\n <span class=\"wr-color-picker__field-label\">{{ channelLightnessLabel() }}</span>\n </label>\n @if (alpha()) {\n <label class=\"wr-color-picker__field\">\n <input\n type=\"number\"\n min=\"0\"\n max=\"100\"\n [value]=\"alphaPercent()\"\n [disabled]=\"disabled()\"\n [readonly]=\"readonly()\"\n (input)=\"onAlphaPercent($event)\"\n />\n <span class=\"wr-color-picker__field-label\">{{ channelAlphaLabel() }}</span>\n </label>\n }\n </div>\n }\n}\n\n@if (swatches().length > 0) {\n <div class=\"wr-color-picker__swatches\">\n @for (color of swatches(); track color) {\n <button\n type=\"button\"\n class=\"wr-color-picker__swatch\"\n [style.background]=\"color\"\n [attr.aria-label]=\"color\"\n [disabled]=\"disabled() || readonly()\"\n (click)=\"onSwatchClick(color)\"\n ></button>\n }\n </div>\n}\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { FocusMonitor } from '@angular/cdk/a11y';\nimport { Directionality } from '@angular/cdk/bidi';\nimport { coerceBooleanProperty } from '@angular/cdk/coercion';\nimport { type OverlayRef, ScrollStrategyOptions } from '@angular/cdk/overlay';\nimport { ComponentPortal } from '@angular/cdk/portal';\nimport {\n DestroyRef,\n Directive,\n ElementRef,\n Injector,\n ViewContainerRef,\n inject,\n input,\n model,\n output,\n signal,\n} from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\n\nimport { WR_OVERLAY, WrOutsideClick, wrFollowDirection } from 'ngwr/overlay';\nimport { getFocusableElements, toClassList, wrCheckStyles, type WrClassInput, wrRestoreFocus } from 'ngwr/utils';\n\nimport { WrColorPicker } from './color-picker';\nimport type { WrColorFormat } from './types';\n\nlet triggerUid = 0;\n\n/**\n * Whether a keydown is a Tab that takes focus out past either end of the open\n * panel. The pane lives in the overlay container at the end of `<body>`, so the\n * browser's own Tab out of its last stop went to `<body>` — the top of the page —\n * with the panel left standing. The caller focuses the trigger synchronously and\n * does NOT `preventDefault`, so the browser's Tab carries on from there to the\n * trigger's real neighbour — the move `wr-dropdown` makes for its menu. The same\n * check lives beside `wr-date-picker`, which cannot share it across entry points.\n */\nfunction tabLeavesPane(pane: HTMLElement, event: KeyboardEvent): boolean {\n if (event.key !== 'Tab' || event.defaultPrevented || event.altKey || event.ctrlKey || event.metaKey) return false;\n const active = pane.ownerDocument.activeElement;\n if (!active || !pane.contains(active)) return false;\n const all = getFocusableElements(pane);\n const at = all.indexOf(active as HTMLElement);\n if (at < 0) return false;\n const beyond = event.shiftKey ? all.slice(0, at) : all.slice(at + 1);\n return !beyond.some(el => el.tabIndex >= 0);\n}\n\n/**\n * Opens a `<wr-color-picker>` in an overlay anchored to the host element.\n *\n * Apply to any clickable element (typically a button). Two-way binds the\n * current colour through `[(value)]`; forwards `alpha` / `format` /\n * `swatches` / `disabled` to the inner picker.\n *\n * Same overlay isolation as the rest of the lib — uses {@link WR_OVERLAY},\n * not CDK's root container.\n *\n * @example\n * ```html\n * <button wrColorPickerTrigger\n * [(value)]=\"brandColor\"\n * [swatches]=\"palette\">\n * <span class=\"swatch\" [style.background]=\"brandColor\"></span>\n * {{ brandColor }}\n * </button>\n * ```\n *\n * @see https://ngwr.dev/reference/components/color-picker\n */\n@Directive({\n selector: '[wrColorPickerTrigger]',\n exportAs: 'wrColorPickerTrigger',\n host: {\n '(click)': 'toggle()',\n // The same two attributes `<wr-popover>`'s trigger carries: without them the\n // button gave no hint that it opens anything, and never said it was open.\n '[attr.aria-haspopup]': '\"dialog\"',\n '[attr.aria-expanded]': 'isOpen()',\n // Which panel, and only while there is one — the same pairing `[wrPopconfirm]`\n // publishes. Without it nothing on the page connects the trigger to the picker\n // it opened, so a second trigger's panel is indistinguishable from this one's.\n '[attr.aria-controls]': 'isOpen() ? panelId : null',\n // The directive's own `disabled` never reached the DOM: it gates `toggle()` and\n // is forwarded to the inner picker, so the button looked live to a screen\n // reader and did nothing when pressed.\n '[attr.aria-disabled]': 'disabled() ? true : null',\n },\n})\nexport class WrColorPickerTrigger {\n /** Two-way bindable colour value (hex string). */\n readonly value = model<string>('');\n\n /** Forwarded to the inner picker. @default true */\n readonly alpha = input(true, { transform: coerceBooleanProperty });\n\n /** Forwarded to the inner picker. @default 'hex' */\n readonly format = input<WrColorFormat>('hex');\n\n /** Forwarded to the inner picker. @default [] */\n readonly swatches = input<readonly string[]>([]);\n\n /** Disable the trigger entirely. @default false */\n readonly disabled = input(false, { transform: coerceBooleanProperty });\n\n /**\n * Extra CSS classes for the picker panel's overlay pane.\n *\n * The pane is appended to the overlay container, not to this component, so\n * nothing in the consumer's own template encloses it and no descendant rule\n * written around the trigger can reach it. This input is the only per-instance\n * handle on it. A space-separated string works as well as an array.\n */\n readonly panelClass = input<WrClassInput>(null);\n\n /** Fires after the picker opens. */\n readonly opened = output<void>();\n\n /** Fires after the picker closes. */\n readonly closed = output<void>();\n\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\n private readonly focusMonitor = inject(FocusMonitor);\n private readonly overlay = inject(WR_OVERLAY);\n private readonly outsideClick = inject(WrOutsideClick);\n private readonly vcr = inject(ViewContainerRef);\n private readonly scrollStrategies = inject(ScrollStrategyOptions);\n private readonly destroyRef = inject(DestroyRef);\n private readonly injector = inject(Injector);\n /**\n * Ambient reading direction, for the open panel alone — nothing in this\n * directive reads it directly. Optional so a bare `TestBed` needs no\n * provider; `Directionality` is root-provided anyway, and a missing one\n * simply reads as `ltr`.\n */\n private readonly dir = inject(Directionality, { optional: true });\n\n protected readonly isOpen = signal(false);\n private overlayRef: OverlayRef | null = null;\n\n /** @internal Public so the host binding can read it. */\n protected readonly panelId = `wr-color-picker-panel-${++triggerUid}`;\n\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('color-picker');\n this.destroyRef.onDestroy(() => this.dispose());\n }\n\n /** Toggle the picker. Open if closed, close if open. */\n toggle(): void {\n if (this.disabled()) return;\n if (this.isOpen()) {\n this.close();\n } else {\n this.open();\n }\n }\n\n /** Open the picker. No-op if already open. */\n open(): void {\n if (this.isOpen() || this.disabled()) return;\n\n const positionStrategy = this.overlay\n .position()\n .flexibleConnectedTo(this.host)\n .withPositions([\n { originX: 'start', originY: 'bottom', overlayX: 'start', overlayY: 'top', offsetY: 4 },\n { originX: 'start', originY: 'top', overlayX: 'start', overlayY: 'bottom', offsetY: -4 },\n { originX: 'end', originY: 'bottom', overlayX: 'end', overlayY: 'top', offsetY: 4 },\n { originX: 'end', originY: 'top', overlayX: 'end', overlayY: 'bottom', offsetY: -4 },\n ])\n .withPush(true);\n\n this.overlayRef = this.overlay.create({\n positionStrategy,\n scrollStrategy: this.scrollStrategies.reposition(),\n panelClass: toClassList('wr-color-picker-overlay', this.panelClass()),\n });\n this.overlayRef.overlayElement.id = this.panelId;\n\n // Two of the four fallbacks anchor on `end`, and the CDK resolves start /\n // end against the direction it captured when this ref was created. The\n // `<wr-segmented>` the picker draws its HEX / RGB / HSL tabs with is the\n // visible half: its thumb reads `Directionality` LIVE, so a flip while this\n // panel was open slid the thumb to the other slot inside a pane still drawn\n // `ltr` — parked under the wrong tab, which is the symptom that started all\n // of this.\n wrFollowDirection(this.overlayRef, this.dir, this.injector);\n\n const portal = new ComponentPortal(WrColorPicker, this.vcr);\n const ref = this.overlayRef.attach(portal);\n\n ref.setInput('alpha', this.alpha());\n ref.setInput('format', this.format());\n ref.setInput('swatches', this.swatches());\n ref.setInput('disabled', this.disabled());\n ref.setInput('value', this.value());\n\n // Render now rather than next frame: the picker's surfaces have to exist\n // before focus can move to one, and a deferred focus is the class of bug\n // this repo keeps finding.\n ref.changeDetectorRef.detectChanges();\n // Focus has to ENTER the panel. The overlay container sits at the end of\n // `<body>`, so a Tab from the trigger went to the next thing on the PAGE and\n // the saturation surface and both sliders — all `tabindex=\"0\"`, all\n // `role=\"slider\"` or `role=\"group\"` — were unreachable from the keyboard for\n // as long as the picker was open. The saturation surface is the first stop\n // and the one that carries the colour's two main values.\n //\n // Deliberately NOT a focus trap, matching `wr-popover` / `[wrPopconfirm]`:\n // this popup is non-modal, an outside click or Escape closes it, and\n // trapping would only make it harder to leave.\n this.overlayRef.overlayElement.querySelector<HTMLElement>('.wr-color-picker__sv')?.focus();\n\n // Bridge the inner picker's `value` model back to our two-way [(value)].\n ref.instance.value.subscribe((next: string) => this.value.set(next));\n\n // Outside-click → close (the source only filters out the overlay pane, so\n // the re-click on our own trigger still arrives here and has to be ignored).\n this.outsideClick\n .outsidePointerEvents(this.overlayRef)\n .pipe(takeUntilDestroyed(this.destroyRef))\n .subscribe(event => {\n if (this.host.nativeElement.contains(event.target as Node)) return;\n this.close();\n });\n\n // Escape → close; Tab past either end → close, leaving from the trigger.\n this.overlayRef\n .keydownEvents()\n .pipe(takeUntilDestroyed(this.destroyRef))\n .subscribe(event => {\n if (event.key === 'Escape') {\n event.preventDefault();\n this.close();\n return;\n }\n if (this.overlayRef && tabLeavesPane(this.overlayRef.overlayElement, event)) {\n wrRestoreFocus(this.host.nativeElement, this.focusMonitor);\n this.close();\n }\n });\n\n this.isOpen.set(true);\n this.opened.emit();\n }\n\n /** Close the picker. No-op if already closed. */\n close(): void {\n if (!this.isOpen()) return;\n // Focus lives inside the panel while it is open, and removing the panel\n // would drop it to `<body>` — hand it back to the trigger instead, the way\n // `[wrPopconfirm]` does. Only when focus is still IN there: if the user has\n // already clicked elsewhere, taking it back would be stealing.\n const returnFocus = !!this.overlayRef?.overlayElement.contains(document.activeElement);\n this.dispose();\n this.isOpen.set(false);\n this.closed.emit();\n if (returnFocus) wrRestoreFocus(this.host.nativeElement, this.focusMonitor);\n }\n\n private dispose(): void {\n if (this.overlayRef) {\n this.overlayRef.dispose();\n this.overlayRef = null;\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAaA,SAAgB,SAAS,KAAU;CACjC,MAAM,IAAI,IAAI,IAAI;CAClB,MAAM,IAAI,IAAI,IAAI;CAClB,MAAM,IAAI,IAAI,IAAI;CAClB,MAAM,MAAM,KAAK,IAAI,GAAG,GAAG,CAAC;CAE5B,MAAM,IAAI,MADE,KAAK,IAAI,GAAG,GAAG,CACX;CAEhB,IAAI,IAAI;CACR,IAAI,MAAM,GAAG;EACX,IAAI,QAAQ,GAAG,KAAM,IAAI,KAAK,IAAK;OAC9B,IAAI,QAAQ,GAAG,KAAK,IAAI,KAAK,IAAI;OACjC,KAAK,IAAI,KAAK,IAAI;EACvB,KAAK;EACL,IAAI,IAAI,GAAG,KAAK;CAClB;CAEA,MAAM,IAAI,QAAQ,IAAI,IAAI,IAAI;CAG9B,OAAO;EAAE;EAAG;EAAG;EAAG,GAAG,IAAI;CAAC;AAC5B;;;;;;;ACrBA,SAAgB,SAAS,KAAU;CACjC,MAAM,EAAE,GAAG,GAAG,MAAM;CACpB,MAAM,IAAI,IAAI;CACd,MAAM,IAAI,KAAK,IAAI,KAAK,IAAM,IAAI,KAAM,IAAK,CAAC;CAC9C,MAAM,IAAI,IAAI;CAEd,IAAI,IAAI;CACR,IAAI,IAAI;CACR,IAAI,IAAI;CAER,IAAI,IAAI,IAAI;EACV,IAAI;EACJ,IAAI;CACN,OAAO,IAAI,IAAI,KAAK;EAClB,IAAI;EACJ,IAAI;CACN,OAA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A;IAAA,sBAAA;IAAA,sBAAA;GAAA;EAAA;EAAA,UAAA,CAAA,sBAAA;EAAA,UAAA;CAAA,CAAA;;AAApB,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAoB,YAAA,CAAA;EAnBhC,MAAA;EAAU,MAAA,CAAA;GACT,UAAU;GACV,UAAU;GACV,MAAM;IACJ,WAAW;IAGX,wBAAwB;IACxB,wBAAwB;IAIxB,wBAAwB;IAIxB,wBAAwB;GACzB;EACF,CAAA"}
1
+ {"version":3,"file":"ngwr-color-picker.mjs","names":[],"sources":["../../../projects/lib/color-picker/color/rgb-to-hsv.ts","../../../projects/lib/color-picker/color/hsv-to-rgb.ts","../../../projects/lib/color-picker/color/rgb-to-hsl.ts","../../../projects/lib/color-picker/color/hsl-to-rgb.ts","../../../projects/lib/color-picker/color/parse-hex.ts","../../../projects/lib/color-picker/color/to-hex.ts","../../../projects/lib/color-picker/color/parse-color.ts","../../../projects/lib/color-picker/color/format-color.ts","../../../projects/lib/color-picker/color-picker.ts","../../../projects/lib/color-picker/color-picker.html","../../../projects/lib/color-picker/color-picker-trigger.ts"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport type { WrHsv } from './wr-hsv';\nimport type { WrRgb } from './wr-rgb';\n\n/**\n * Convert sRGB to HSV. Preserves alpha.\n */\nexport function wrRgbToHsv(rgb: WrRgb): WrHsv {\n const r = rgb.r / 255;\n const g = rgb.g / 255;\n const b = rgb.b / 255;\n const max = Math.max(r, g, b);\n const min = Math.min(r, g, b);\n const d = max - min;\n\n let h = 0;\n if (d !== 0) {\n if (max === r) h = ((g - b) / d) % 6;\n else if (max === g) h = (b - r) / d + 2;\n else h = (r - g) / d + 4;\n h *= 60;\n if (h < 0) h += 360;\n }\n\n const s = max === 0 ? 0 : d / max;\n const v = max;\n\n return { h, s, v, a: rgb.a };\n}\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport type { WrHsv } from './wr-hsv';\nimport type { WrRgb } from './wr-rgb';\n\n/**\n * Convert HSV to sRGB. Preserves alpha. Returns integer channels in `[0, 255]`.\n */\nexport function wrHsvToRgb(hsv: WrHsv): WrRgb {\n const { h, s, v } = hsv;\n const c = v * s;\n const x = c * (1 - Math.abs(((h / 60) % 2) - 1));\n const m = v - c;\n\n let r = 0;\n let g = 0;\n let b = 0;\n\n if (h < 60) {\n r = c;\n g = x;\n } else if (h < 120) {\n r = x;\n g = c;\n } else if (h < 180) {\n g = c;\n b = x;\n } else if (h < 240) {\n g = x;\n b = c;\n } else if (h < 300) {\n r = x;\n b = c;\n } else {\n r = c;\n b = x;\n }\n\n return {\n r: Math.round((r + m) * 255),\n g: Math.round((g + m) * 255),\n b: Math.round((b + m) * 255),\n a: hsv.a,\n };\n}\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport type { WrHsl } from './wr-hsl';\nimport type { WrRgb } from './wr-rgb';\n\n/**\n * Convert sRGB to HSL. Preserves alpha.\n */\nexport function wrRgbToHsl(rgb: WrRgb): WrHsl {\n const r = rgb.r / 255;\n const g = rgb.g / 255;\n const b = rgb.b / 255;\n const max = Math.max(r, g, b);\n const min = Math.min(r, g, b);\n const d = max - min;\n const l = (max + min) / 2;\n\n let h = 0;\n let s = 0;\n\n if (d !== 0) {\n s = l > 0.5 ? d / (2 - max - min) : d / (max + min);\n\n if (max === r) h = (g - b) / d + (g < b ? 6 : 0);\n else if (max === g) h = (b - r) / d + 2;\n else h = (r - g) / d + 4;\n\n h *= 60;\n }\n\n return { h, s, l, a: rgb.a };\n}\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport type { WrHsl } from './wr-hsl';\nimport type { WrRgb } from './wr-rgb';\n\nfunction hueToChannel(p: number, q: number, t: number): number {\n let x = t;\n if (x < 0) x += 1;\n if (x > 1) x -= 1;\n if (x < 1 / 6) return p + (q - p) * 6 * x;\n if (x < 1 / 2) return q;\n if (x < 2 / 3) return p + (q - p) * (2 / 3 - x) * 6;\n return p;\n}\n\n/**\n * Convert HSL to sRGB. Preserves alpha. Returns integer channels in `[0, 255]`.\n */\nexport function wrHslToRgb(hsl: WrHsl): WrRgb {\n const h = hsl.h / 360;\n const { s, l } = hsl;\n\n let r: number;\n let g: number;\n let b: number;\n\n if (s === 0) {\n r = l;\n g = l;\n b = l;\n } else {\n const q = l < 0.5 ? l * (1 + s) : l + s - l * s;\n const p = 2 * l - q;\n r = hueToChannel(p, q, h + 1 / 3);\n g = hueToChannel(p, q, h);\n b = hueToChannel(p, q, h - 1 / 3);\n }\n\n return {\n r: Math.round(r * 255),\n g: Math.round(g * 255),\n b: Math.round(b * 255),\n a: hsl.a,\n };\n}\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport type { WrRgb } from './wr-rgb';\n\n/**\n * Parse a CSS hex colour into {@link WrRgb}. Accepts 3, 4, 6, or 8 digit\n * forms with or without a leading `#`. Returns `null` for anything that\n * isn't a valid hex string.\n *\n * @example\n * ```ts\n * wrParseHex('#f00'); // { r: 255, g: 0, b: 0, a: 1 }\n * wrParseHex('3969e2'); // { r: 57, g: 105, b: 226, a: 1 }\n * wrParseHex('#3969e2ff'); // { r: 57, g: 105, b: 226, a: 1 }\n * wrParseHex('nope'); // null\n * ```\n */\nexport function wrParseHex(input: string): WrRgb | null {\n if (typeof input !== 'string') return null;\n\n let str = input.trim().replace(/^#/, '').toLowerCase();\n\n // Expand shorthand: rgb → rrggbb, rgba → rrggbbaa\n if (str.length === 3 || str.length === 4) {\n str = str\n .split('')\n .map(c => c + c)\n .join('');\n }\n\n if (str.length !== 6 && str.length !== 8) return null;\n if (!/^[0-9a-f]+$/.test(str)) return null;\n\n const r = parseInt(str.slice(0, 2), 16);\n const g = parseInt(str.slice(2, 4), 16);\n const b = parseInt(str.slice(4, 6), 16);\n const a = str.length === 8 ? parseInt(str.slice(6, 8), 16) / 255 : 1;\n\n return { r, g, b, a };\n}\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport type { WrRgb } from './wr-rgb';\n\nfunction channelToHex(n: number): string {\n const clamped = Math.max(0, Math.min(255, Math.round(n)));\n return clamped.toString(16).padStart(2, '0');\n}\n\n/**\n * Format a {@link WrRgb} as a CSS hex string with a leading `#`. When\n * `withAlpha` is `true` the result is 8 digits (`#rrggbbaa`); otherwise\n * 6 digits.\n *\n * @example\n * ```ts\n * wrToHex({ r: 57, g: 105, b: 226, a: 1 }); // '#3969e2'\n * wrToHex({ r: 57, g: 105, b: 226, a: 0.5 }, true); // '#3969e280'\n * ```\n */\nexport function wrToHex(rgb: WrRgb, withAlpha = false): string {\n const r = channelToHex(rgb.r);\n const g = channelToHex(rgb.g);\n const b = channelToHex(rgb.b);\n if (withAlpha) {\n const a = channelToHex(rgb.a * 255);\n return `#${r}${g}${b}${a}`;\n }\n return `#${r}${g}${b}`;\n}\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { wrClamp } from 'ngwr/utils';\n\nimport { wrHslToRgb } from './hsl-to-rgb';\nimport { wrParseHex } from './parse-hex';\nimport type { WrRgb } from './wr-rgb';\n\n/**\n * `rgb(…)` / `rgba(…)`, comma- or space-separated, with an optional `/ alpha`.\n * Signs are accepted so an out-of-range channel CLAMPS the way CSS clamps it,\n * rather than failing to parse and reading as black.\n */\nconst RGB_RE = /^rgba?\\(\\s*(-?[\\d.]+)\\s*[,\\s]\\s*(-?[\\d.]+)\\s*[,\\s]\\s*(-?[\\d.]+)\\s*(?:[,/]\\s*(-?[\\d.]+%?)\\s*)?\\)$/i;\n\n/** `hsl(…)` / `hsla(…)`, with `%` optional on saturation and lightness. */\nconst HSL_RE =\n /^hsla?\\(\\s*(-?[\\d.]+)(?:deg)?\\s*[,\\s]\\s*(-?[\\d.]+)%?\\s*[,\\s]\\s*(-?[\\d.]+)%?\\s*(?:[,/]\\s*(-?[\\d.]+%?)\\s*)?\\)$/i;\n\n/** `0.5` and `50%` are the same alpha; anything absent is fully opaque. */\nfunction alphaOf(raw: string | undefined): number {\n if (raw === undefined) return 1;\n const value = raw.endsWith('%') ? Number(raw.slice(0, -1)) / 100 : Number(raw);\n return Number.isFinite(value) ? wrClamp(value, 0, 1) : 1;\n}\n\nfunction channel(raw: string): number {\n return wrClamp(Math.round(Number(raw)), 0, 255);\n}\n\n/**\n * Read a colour written in any format `<wr-color-picker>` can emit — hex,\n * `rgb()` / `rgba()`, `hsl()` / `hsla()` — or `null` when it is none of them.\n *\n * The picker emits in whichever format it was given, so a `[(value)]` binding\n * hands its own output straight back on the next external write. Accepting only\n * hex there (which is what it used to do) turned every non-hex value into black.\n *\n * `null` rather than a throw or a black fallback: the caller is often a text\n * field mid-typing, where \"not valid yet\" is the normal state.\n */\nexport function parseColor(input: string): WrRgb | null {\n const value = input.trim();\n if (value === '') return null;\n\n const hex = wrParseHex(value);\n if (hex) return hex;\n\n const rgb = RGB_RE.exec(value);\n if (rgb) {\n return { r: channel(rgb[1]), g: channel(rgb[2]), b: channel(rgb[3]), a: alphaOf(rgb[4]) };\n }\n\n const hsl = HSL_RE.exec(value);\n if (hsl) {\n return wrHslToRgb({\n // Normalised here rather than trusted downstream: `wrHslToRgb` happens to\n // absorb one negative turn inside `hueToChannel`, which is an internal\n // detail this function should not be leaning on.\n h: ((Number(hsl[1]) % 360) + 360) % 360,\n s: wrClamp(Number(hsl[2]) / 100, 0, 1),\n l: wrClamp(Number(hsl[3]) / 100, 0, 1),\n a: alphaOf(hsl[4]),\n });\n }\n\n return null;\n}\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport type { WrColorFormat } from '../types';\n\nimport { wrRgbToHsl } from './rgb-to-hsl';\nimport { wrToHex } from './to-hex';\nimport type { WrRgb } from './wr-rgb';\n\n/** Alpha with at most two decimals, and no trailing zeroes: `0.5`, not `0.50`. */\nfunction alphaText(a: number): string {\n return String(Math.round(a * 100) / 100);\n}\n\n/**\n * Render a colour in the format a `<wr-color-picker>` was asked for.\n *\n * `withAlpha` follows the picker's own `alpha` input, so each format has an\n * opaque and a translucent spelling — `#3969e2` / `#3969e2ff`,\n * `rgb(…)` / `rgba(…)`, `hsl(…)` / `hsla(…)` — and a picker with the alpha\n * slider turned off never emits a channel the caller cannot see or edit.\n */\nexport function formatColor(rgb: WrRgb, format: WrColorFormat, withAlpha: boolean): string {\n if (format === 'hex') return wrToHex(rgb, withAlpha);\n\n if (format === 'rgba') {\n const { r, g, b } = rgb;\n return withAlpha ? `rgba(${r}, ${g}, ${b}, ${alphaText(rgb.a)})` : `rgb(${r}, ${g}, ${b})`;\n }\n\n const { h, s, l } = wrRgbToHsl(rgb);\n const parts = `${Math.round(h)}, ${Math.round(s * 100)}%, ${Math.round(l * 100)}%`;\n return withAlpha ? `hsla(${parts}, ${alphaText(rgb.a)})` : `hsl(${parts})`;\n}\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { Directionality } from '@angular/cdk/bidi';\nimport { coerceBooleanProperty } from '@angular/cdk/coercion';\nimport { DecimalPipe } from '@angular/common';\nimport {\n Component,\n type ElementRef,\n HostAttributeToken,\n ViewEncapsulation,\n computed,\n effect,\n inject,\n input,\n model,\n output,\n signal,\n viewChild,\n} from '@angular/core';\nimport type { FormValueControl } from '@angular/forms/signals';\n\nimport { WR_FORM_FIELD, useFormFieldAria } from 'ngwr/form';\nimport { wrReadI18nText, useI18nFormatter } from 'ngwr/i18n';\nimport { WrSegmented, type WrSegmentedOption } from 'ngwr/segmented';\nimport { wrClamp, wrCheckStyles } from 'ngwr/utils';\n\nimport {\n formatColor,\n wrHsvToRgb,\n parseColor,\n wrParseHex,\n wrRgbToHsl,\n wrRgbToHsv,\n wrToHex,\n type WrHsl,\n type WrRgb,\n} from './color';\nimport type { WrColorFormat } from './types';\n\ntype Tab = 'hex' | 'rgb' | 'hsl';\n\ntype Edges = 'sv' | 'hue' | 'alpha';\n\n/** Arrow step, in each surface's own unit: degrees of hue, percent everywhere else. */\nconst KEY_STEP = 1;\nconst KEY_STEP_COARSE = 10;\n\n/** Whether a hex string carries its own alpha (`#rgba` or `#rrggbbaa`). */\nfunction hasAlphaDigits(hex: string): boolean {\n const digits = hex.trim().replace(/^#/, '').length;\n return digits === 4 || digits === 8;\n}\n\n/**\n * Inline colour picker — HSV canvas, hue slider, optional alpha slider, HEX\n * input.\n *\n * A signal-forms native control: it implements `FormValueControl<string>`, so\n * `[formField]` binds straight to its `value` model — no\n * `ControlValueAccessor` in between. `[(value)]` works standalone. Output is\n * always a hex string.\n *\n * @example\n * ```html\n * <!-- signal forms -->\n * <wr-color-picker [formField]=\"form.brandColor\" />\n *\n * <!-- standalone two-way binding -->\n * <wr-color-picker [(value)]=\"brandColor\" [alpha]=\"false\" />\n * ```\n *\n * @see https://ngwr.dev/reference/components/color-picker\n */\n@Component({\n selector: 'wr-color-picker',\n templateUrl: './color-picker.html',\n encapsulation: ViewEncapsulation.None,\n host: {\n '[class]': 'classes()',\n // `role=\"group\"` so the field's label has somewhere to land: the picker is\n // a composite with no single element carrying its semantics, and its parts\n // name themselves — \"Saturation and brightness\", \"Hue\", \"Opacity\". Two\n // colour fields on one form announced the same three names twice, with\n // nothing saying which colour either belonged to. Same call `wr-transfer`\n // makes one directory over, for the same reason.\n role: 'group',\n '[attr.aria-labelledby]': 'labelledBy()',\n '[style.--wr-color-picker-hue]': 'hueCss()',\n '[style.--wr-color-picker-color]': 'opaqueCss()',\n },\n // The picker is the control a `<wr-form-field>` wraps; the `<wr-segmented>` tab\n // strip in its own template is a part, not a control. Without this shield the\n // tab strip found the field's token and announced the colour field's error as\n // its own — which is why `fieldAria` below reads the field with `skipSelf`.\n providers: [{ provide: WR_FORM_FIELD, useValue: null }],\n imports: [DecimalPipe, WrSegmented],\n})\nexport class WrColorPicker implements FormValueControl<string> {\n /** Render the alpha slider and emit 8-digit hex / `rgba()`. @default true */\n readonly alpha = input(true, { transform: coerceBooleanProperty });\n\n /** Disable interaction. @default false */\n readonly disabled = input(false, { transform: coerceBooleanProperty });\n\n /**\n * Refuse changes while every surface stays focusable and the colour still\n * submits. Bound automatically from the field's readonly state when used with\n * `[formField]`.\n *\n * The two sliders keep their tab stop and keep announcing `aria-valuenow` —\n * they simply do not move — the hex / channel fields take the native\n * `readonly` attribute, and the swatches go inert. Switching TABS still works:\n * that changes which notation is displayed, not the colour. `aria-readonly` is\n * mirrored on the sliders, which support it; the saturation surface is a\n * `role=\"group\"`, which does not, so it carries nothing.\n *\n * @default false\n */\n readonly readonly = input(false, { transform: coerceBooleanProperty });\n\n /** The surrounding `<wr-form-field>`'s error state. @internal */\n protected readonly fieldAria = useFormFieldAria({ skipSelf: true });\n /**\n * The author's own `aria-labelledby`, read as a static host attribute.\n *\n * A host binding WRITES the attribute, so binding the field's label\n * unconditionally would REMOVE a reference the consumer put there by hand:\n * `<wr-segmented aria-labelledby=\"range-question\">` went nameless the moment\n * the field's label was `null`, which a harness spec caught one commit after\n * it was introduced. `HostAttributeToken` reads it at construction without\n * touching the DOM, so this stays SSR-safe, and the author's own reference\n * wins — the same precedence `[ariaLabel]` has everywhere else.\n */\n private readonly ownLabelledBy = inject(new HostAttributeToken('aria-labelledby'), { optional: true });\n\n /** The surrounding field's label, unless the author named the control. */\n protected readonly labelledBy = computed(() => this.ownLabelledBy ?? this.fieldAria.labelledBy());\n\n /**\n * Format the control writes into `value`. See {@link WrColorFormat} — all\n * three are accepted on the way in whichever one is set. @default 'hex'\n */\n readonly format = input<WrColorFormat>('hex');\n\n /** Preset hex colours rendered as a clickable row beneath the inputs. Empty = no row. @default [] */\n readonly swatches = input<readonly string[]>([]);\n\n /** The selected colour as a string. Bound by `[formField]`, or two-way via `[(value)]`. */\n readonly value = model<string>('');\n\n /** Emitted on blur so a bound field can mark itself touched. */\n readonly touch = output<void>();\n\n // Source of truth: HSV + alpha\n\n protected readonly h = signal(0);\n protected readonly s = signal(0);\n protected readonly v = signal(0);\n protected readonly a = signal(1);\n\n // Derived values\n\n /** RGB view of the current colour, computed lazily. */\n protected readonly rgb = computed<WrRgb>(() => wrHsvToRgb({ h: this.h(), s: this.s(), v: this.v(), a: this.a() }));\n\n /** Canonical hex — what the HEX field shows, whatever `format` emits. */\n protected readonly hex = computed(() => wrToHex(this.rgb(), this.alpha()));\n\n /** The colour as the consumer asked for it; this is what `value` receives. */\n protected readonly formatted = computed(() => formatColor(this.rgb(), this.format(), this.alpha()));\n\n /** SV canvas background colour (full-saturation hue). */\n protected readonly hueCss = computed(() => `hsl(${this.h()}, 100%, 50%)`);\n\n /**\n * The current colour at full opacity, the far end of the alpha slider's ramp.\n * A whole colour rather than a channel list, so the stylesheet fades it with\n * `transparent` instead of splicing channels into `rgba()`.\n */\n protected readonly opaqueCss = computed(() => {\n const { r, g, b } = this.rgb();\n return `rgb(${r} ${g} ${b})`;\n });\n\n /**\n * Ambient reading direction, for the two SLIDERS only — see `updateFromEvent`\n * for why the SV canvas is not in that set.\n *\n * Optional so a bare `TestBed` — or any consumer that never set a direction —\n * needs no provider; `Directionality` is root-provided, so `null` only ever\n * means \"nobody asked\", which is LTR. Read inside the handlers rather than\n * cached: the thumbs are placed with `inset-inline-start`, so the tracks mirror\n * from CSS alone and a runtime flip needs no subscription to\n * `Directionality.change`.\n */\n private readonly dir = inject(Directionality, { optional: true });\n\n /** Thumb positions in % for each surface. */\n protected readonly svThumbX = computed(() => this.s() * 100);\n protected readonly svThumbY = computed(() => (1 - this.v()) * 100);\n protected readonly hueThumbX = computed(() => (this.h() / 360) * 100);\n protected readonly alphaThumbX = computed(() => this.a() * 100);\n\n /** Mirror of the canonical hex, edited by the user via the input field. */\n protected readonly hexInput = signal('');\n\n /** Active tab in the input switcher. */\n protected readonly activeTab = signal<Tab>('hex');\n\n /**\n * The HSL last typed into the HSL boxes, with the value it produced.\n *\n * HSL read back off a colour has no hue at grey and no saturation at black or\n * white, so the boxes re-derived after `L` = 0 came back `0, 0, 0`, and the next\n * keystroke built on that: retyping the lightness turned any colour grey for\n * good. Kept only while `value` is still the one it produced — a drag, a swatch\n * or an outside write reads the colour again.\n */\n private readonly typedHsl = signal<{ readonly hsl: WrHsl; readonly value: string } | null>(null);\n\n /** HSL view of the current colour, computed lazily — see {@link typedHsl}. */\n protected readonly hslView = computed<WrHsl>(() => {\n const typed = this.typedHsl();\n if (typed?.value === this.value()) return typed.hsl;\n // The hue the surfaces hold, not the one RGB reports — which is 0 at every grey.\n return { ...wrRgbToHsl(this.rgb()), h: this.h() };\n });\n\n /** Alpha as integer percent — the numeric tabs and the alpha slider's `aria-valuenow`. */\n protected readonly alphaPercent = computed(() => Math.round(this.a() * 100));\n\n /** Hue in whole degrees, for the hue slider's `aria-valuenow`. */\n protected readonly hueValue = computed(() => Math.round(this.h()));\n\n private readonly areaLabel = useI18nFormatter(\n 'colorPicker.area',\n 'Saturation and brightness, {{saturation}}% and {{brightness}}%'\n );\n\n /** Name of the SV surface, carrying the two values a `role=\"group\"` cannot. */\n protected readonly resolvedAreaLabel = computed(() =>\n this.areaLabel({ saturation: Math.round(this.s() * 100), brightness: Math.round(this.v() * 100) })\n );\n\n protected readonly resolvedHueLabel = wrReadI18nText('colorPicker.hue', 'Hue');\n protected readonly resolvedAlphaLabel = wrReadI18nText('colorPicker.alpha', 'Opacity');\n\n /**\n * Every visible word in this component that is not a slider name.\n *\n * The format strip and the nine channel captions were literals — three in\n * TypeScript, the rest in the template — beside a `colorPicker` catalog\n * section that already existed and held the slider names. So the section was\n * there and these had simply not been put in it, which is why a fully Russian\n * picker still read `HEX RGB HSL` over `R G B`. Each caption is one string\n * INCLUDING its `%`, because a locale that spaces the sign differently has to\n * move the letter and the sign together.\n *\n * Signals, not strings: they follow a locale switch, and a catalog that lands\n * a microtask after the first change-detection pass.\n */\n protected readonly channelHexLabel = wrReadI18nText('colorPicker.channelHex', 'HEX');\n protected readonly channelRedLabel = wrReadI18nText('colorPicker.channelRed', 'R');\n protected readonly channelGreenLabel = wrReadI18nText('colorPicker.channelGreen', 'G');\n protected readonly channelBlueLabel = wrReadI18nText('colorPicker.channelBlue', 'B');\n protected readonly channelHueLabel = wrReadI18nText('colorPicker.channelHue', 'H');\n protected readonly channelSaturationLabel = wrReadI18nText('colorPicker.channelSaturation', 'S%');\n protected readonly channelLightnessLabel = wrReadI18nText('colorPicker.channelLightness', 'L%');\n protected readonly channelAlphaLabel = wrReadI18nText('colorPicker.channelAlpha', 'A%');\n\n private readonly formatHexLabel = wrReadI18nText('colorPicker.formatHex', 'HEX');\n private readonly formatRgbLabel = wrReadI18nText('colorPicker.formatRgb', 'RGB');\n private readonly formatHslLabel = wrReadI18nText('colorPicker.formatHsl', 'HSL');\n\n /** A `computed`, because `WrSegmentedOption.label` is a plain string. */\n protected readonly tabOptions = computed<readonly WrSegmentedOption<Tab>[]>(() => [\n { value: 'hex', label: this.formatHexLabel() },\n { value: 'rgb', label: this.formatRgbLabel() },\n { value: 'hsl', label: this.formatHslLabel() },\n ]);\n\n protected readonly classes = computed(() => {\n const parts = ['wr-color-picker'];\n if (this.alpha()) parts.push('wr-color-picker--alpha');\n if (this.disabled()) parts.push('wr-color-picker--disabled');\n else if (this.readonly()) parts.push('wr-color-picker--readonly');\n return parts.join(' ');\n });\n\n /**\n * The one write we just made, held only until the sync effect has seen it.\n *\n * It exists so a drag keeps its continuous HSV values instead of being\n * re-quantised through its own hex round-trip. It used to be set and never\n * cleared, which turned \"ignore this write\" into \"ignore this STRING,\n * forever\": after the picker emitted `#ff0000` once, an app writing\n * `#ff0000` back — a reset button, a form patch, an undo — was silently\n * dropped for the rest of the component's life, and the surface kept\n * whatever colour the user had dragged to.\n */\n private lastEmitted: string | null = null;\n\n private readonly area = viewChild.required<ElementRef<HTMLElement>>('area');\n\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('color-picker');\n // External writes (via `[formField]` / `[(value)]`) flow the incoming hex\n // string back into the HSV source of truth. Our own emits are skipped via\n // `lastEmitted` so dragging keeps its continuous (unquantised) values.\n effect(() => {\n const value = this.value();\n if (value === this.lastEmitted) {\n // Ours, and now observed. Release the guard so the NEXT write of the\n // same string — which can only come from outside — is honoured.\n this.lastEmitted = null;\n return;\n }\n const rgb = parseColor(value) ?? { r: 0, g: 0, b: 0, a: 1 };\n const hsv = wrRgbToHsv(rgb);\n this.h.set(hsv.h);\n this.s.set(hsv.s);\n this.v.set(hsv.v);\n this.a.set(hsv.a);\n this.hexInput.set(wrToHex(rgb, this.alpha()));\n });\n }\n\n /**\n * Focus the picker — what Signal Forms calls to focus this control, from\n * `focusBoundControl()`. The host carries no tab stop, so the call goes to the\n * saturation surface: the first stop in the tab order, always rendered\n * whichever notation tab is showing, and it announces the field's error\n * description with it. A disabled picker is left alone, since its surfaces\n * drop to `tabindex=\"-1\"`, which a script could still focus.\n */\n focus(options?: FocusOptions): void {\n if (!this.disabled()) this.area().nativeElement.focus(options);\n }\n\n // Drag handlers\n\n protected onPointerDown(event: PointerEvent, surface: Edges): void {\n if (this.disabled() || this.readonly()) return;\n // Primary button, primary pointer: a right-click used to open the context\n // menu AND start a drag, and a second finger used to fight the first one.\n if (event.button !== 0 || !event.isPrimary) return;\n event.preventDefault();\n const target = event.currentTarget as HTMLElement;\n target.setPointerCapture(event.pointerId);\n\n const update = (e: PointerEvent): void => this.updateFromEvent(e, target, surface);\n const cleanup = (e: PointerEvent): void => {\n target.releasePointerCapture(e.pointerId);\n target.removeEventListener('pointermove', update);\n target.removeEventListener('pointerup', cleanup);\n target.removeEventListener('pointercancel', cleanup);\n this.touch.emit();\n };\n\n target.addEventListener('pointermove', update);\n target.addEventListener('pointerup', cleanup);\n // `pointercancel` never sends a `pointerup` after it, so without this the\n // move listener outlived the drag: a cancelled gesture left the surface\n // repainting the colour under a pointer that was only hovering.\n target.addEventListener('pointercancel', cleanup);\n this.updateFromEvent(event, target, surface);\n }\n\n // Keyboard handlers\n //\n // The three surfaces used to be bare `<div>`s carrying nothing but\n // `(pointerdown)` — no role, no name, no tab stop, no key handler — so the\n // control the component is built around was operable by pointer only. The\n // numeric HEX / RGB / HSL fields could always reach the same values, which is\n // why this is 4.1.2 rather than a total loss of keyboard access, but a\n // roleless div driving a colour is WCAG F59 either way.\n\n /**\n * Hue and alpha are real one-value sliders, so they take the APG slider keys —\n * the same set `wr-knob` and `wr-slider` implement, including Home / End.\n *\n * The horizontal arrows name a SIDE of the track and so follow the reading\n * direction, exactly as `wr-slider`'s do; the vertical pair names a value's\n * direction and never mirrors.\n */\n protected onSliderKeydown(event: KeyboardEvent, surface: 'hue' | 'alpha'): void {\n if (this.disabled() || this.readonly()) return;\n const step = event.shiftKey ? KEY_STEP_COARSE : KEY_STEP;\n const inline = this.dir?.value === 'rtl' ? -step : step;\n const max = surface === 'hue' ? 360 : 100;\n const current = surface === 'hue' ? this.h() : this.a() * 100;\n let next: number;\n switch (event.key) {\n case 'ArrowRight':\n next = current + inline;\n break;\n case 'ArrowUp':\n next = current + step;\n break;\n case 'ArrowLeft':\n next = current - inline;\n break;\n case 'ArrowDown':\n next = current - step;\n break;\n case 'Home':\n next = 0;\n break;\n case 'End':\n next = max;\n break;\n default:\n return;\n }\n event.preventDefault();\n const value = wrClamp(next, 0, max);\n if (surface === 'hue') this.h.set(value);\n else this.a.set(value / 100);\n this.emit();\n }\n\n /**\n * The SV canvas is two axes at once, so the keys follow the picture: left and\n * right run along saturation, up and down along brightness — the directions\n * the thumb visibly moves. Shift takes ten percent at a time.\n *\n * Not mirrored under `dir=\"rtl\"`, unlike the two sliders above, and for the\n * reason given on `fraction()`: the canvas is a picture rather than a track, so\n * its gradient does not flip and neither may the keys that walk it.\n */\n protected onAreaKeydown(event: KeyboardEvent): void {\n if (this.disabled() || this.readonly()) return;\n const step = (event.shiftKey ? KEY_STEP_COARSE : KEY_STEP) / 100;\n switch (event.key) {\n case 'ArrowRight':\n this.s.set(wrClamp(this.s() + step, 0, 1));\n break;\n case 'ArrowLeft':\n this.s.set(wrClamp(this.s() - step, 0, 1));\n break;\n case 'ArrowUp':\n this.v.set(wrClamp(this.v() + step, 0, 1));\n break;\n case 'ArrowDown':\n this.v.set(wrClamp(this.v() - step, 0, 1));\n break;\n default:\n return;\n }\n event.preventDefault();\n this.emit();\n }\n\n /** Leaving a surface is what \"touched\" means, the same as leaving the hex field. */\n protected onSurfaceBlur(): void {\n this.touch.emit();\n }\n\n /**\n * The pointer's position along a surface, as a 0–1 fraction.\n *\n * Measured from whichever edge the surface STARTS at, and the two surfaces do\n * not agree on what that means — deliberately.\n *\n * The hue and alpha bars are one-value tracks with `role=\"slider\"`, the same\n * widget `wr-slider` is, so they mirror: their thumbs are placed with\n * `inset-inline-start` and their gradients are flipped by a `[dir='rtl']` rule,\n * which makes the reader's start the physical right edge under `dir=\"rtl\"`.\n * Opacity 100% used to sit at the physical right in both directions, i.e. at\n * the reader's START in RTL, while the format strip in the same panel mirrored\n * correctly.\n *\n * The SV canvas does NOT mirror, and stays measured from `rect.left`. It is a\n * two-axis colour FIELD, not a track — the component says so itself by giving\n * it `role=\"group\"` rather than `role=\"slider\"`, because it carries two values\n * and a slider has one. A picture with no start and no end has nothing to\n * mirror, and flipping it would only move white to the other side of an image\n * every colour picker in the world draws the same way.\n */\n private fraction(event: PointerEvent, rect: DOMRect, surface: Edges): number {\n const offset =\n surface !== 'sv' && this.dir?.value === 'rtl' ? rect.right - event.clientX : event.clientX - rect.left;\n return wrClamp(offset / rect.width, 0, 1);\n }\n\n private updateFromEvent(event: PointerEvent, target: HTMLElement, surface: Edges): void {\n const rect = target.getBoundingClientRect();\n const x = this.fraction(event, rect, surface);\n\n if (surface === 'sv') {\n const y = wrClamp((event.clientY - rect.top) / rect.height, 0, 1);\n this.s.set(x);\n this.v.set(1 - y);\n } else if (surface === 'hue') {\n this.h.set(x * 360);\n } else {\n this.a.set(x);\n }\n this.emit();\n }\n\n // Hex input handlers\n\n protected onHexInput(event: Event): void {\n if (this.disabled() || this.readonly()) return;\n const raw = (event.target as HTMLInputElement).value;\n this.hexInput.set(raw);\n const rgb = wrParseHex(raw);\n if (!rgb) return;\n const hsv = wrRgbToHsv(rgb);\n this.h.set(hsv.h);\n this.s.set(hsv.s);\n this.v.set(hsv.v);\n this.a.set(hsv.a);\n this.emitWithoutHexSync();\n }\n\n protected onHexBlur(): void {\n // Re-sync the input with the canonical value (in case the user typed invalid).\n this.hexInput.set(this.hex());\n this.touch.emit();\n }\n\n // Emission\n\n private emit(): void {\n this.emitWithoutHexSync();\n this.hexInput.set(this.hex());\n }\n\n private emitWithoutHexSync(): void {\n const next = this.formatted();\n this.lastEmitted = next;\n this.value.set(next);\n }\n\n // Tab + channel handlers\n\n protected onTabChange(tab: Tab | null): void {\n if (tab) this.activeTab.set(tab);\n }\n\n /**\n * The number in a channel box, or `null` while there is none. An emptied box is\n * someone mid-retype, not a request for zero: `Number('')` is 0, so committing it\n * turned the colour black — or, for the alpha box, fully transparent.\n */\n private channelValue(event: Event): number | null {\n const raw = (event.target as HTMLInputElement).value;\n if (!raw.trim()) return null;\n const n = Number(raw);\n return Number.isNaN(n) ? null : n;\n }\n\n protected onRgbChannel(channel: 'r' | 'g' | 'b', event: Event): void {\n if (this.disabled() || this.readonly()) return;\n const typed = this.channelValue(event);\n if (typed === null) return;\n const n = wrClamp(typed, 0, 255);\n const current = this.rgb();\n const next: WrRgb = { ...current, [channel]: n };\n this.applyRgb(next);\n }\n\n protected onHslChannel(channel: 'h' | 's' | 'l', event: Event): void {\n if (this.disabled() || this.readonly()) return;\n const n = this.channelValue(event);\n if (n === null) return;\n const current = this.hslView();\n const next: WrHsl =\n channel === 'h' ? { ...current, h: wrClamp(n, 0, 360) } : { ...current, [channel]: wrClamp(n, 0, 100) / 100 };\n // Straight into HSV rather than through RGB, which has no hue to hand back at grey.\n const v = next.l + next.s * Math.min(next.l, 1 - next.l);\n this.h.set(next.h);\n this.s.set(v === 0 ? 0 : 2 * (1 - next.l / v));\n this.v.set(v);\n this.emit();\n this.typedHsl.set({ hsl: next, value: this.value() });\n }\n\n protected onAlphaPercent(event: Event): void {\n if (this.disabled() || this.readonly()) return;\n const typed = this.channelValue(event);\n if (typed === null) return;\n this.a.set(wrClamp(typed, 0, 100) / 100);\n this.emit();\n }\n\n protected onSwatchClick(hex: string): void {\n if (this.disabled() || this.readonly()) return;\n const rgb = wrParseHex(hex);\n if (!rgb) return;\n // A 6-digit swatch says nothing about alpha, and `wrParseHex` reports the\n // absence as `1` — so picking a preset used to silently snap a translucent\n // colour back to fully opaque.\n this.applyRgb(hasAlphaDigits(hex) ? rgb : { ...rgb, a: this.a() });\n }\n\n /** Push an RGB triple into the HSV source of truth. */\n private applyRgb(rgb: WrRgb): void {\n const hsv = wrRgbToHsv(rgb);\n this.h.set(hsv.h);\n this.s.set(hsv.s);\n this.v.set(hsv.v);\n this.a.set(hsv.a);\n this.emit();\n }\n}\n","<!--\n `role=\"group\"` rather than `role=\"slider\"`, because this surface holds TWO\n values and a slider has one `aria-valuenow`; and rather than\n `role=\"application\"`, which would switch the reader out of its own browse mode\n for the whole subtree — the call `wr-image-cropper` already made. A group has\n no value of its own, so the two percentages ride in its accessible name, which\n is where a reader querying the focused element finds them.\n-->\n<div\n #area\n class=\"wr-color-picker__sv\"\n role=\"group\"\n [attr.aria-label]=\"resolvedAreaLabel()\"\n [attr.aria-disabled]=\"disabled() || null\"\n [attr.aria-invalid]=\"fieldAria.ariaInvalid()\"\n [attr.aria-describedby]=\"fieldAria.describedBy()\"\n [attr.tabindex]=\"disabled() ? -1 : 0\"\n (pointerdown)=\"onPointerDown($event, 'sv')\"\n (keydown)=\"onAreaKeydown($event)\"\n (blur)=\"onSurfaceBlur()\"\n>\n <span class=\"wr-color-picker__thumb\" [style.left.%]=\"svThumbX()\" [style.top.%]=\"svThumbY()\"></span>\n</div>\n\n<div\n class=\"wr-color-picker__slider wr-color-picker__slider--hue\"\n role=\"slider\"\n aria-valuemin=\"0\"\n aria-valuemax=\"360\"\n [attr.aria-label]=\"resolvedHueLabel()\"\n [attr.aria-valuenow]=\"hueValue()\"\n [attr.aria-disabled]=\"disabled() || null\"\n [attr.aria-readonly]=\"readonly() || null\"\n [attr.aria-invalid]=\"fieldAria.ariaInvalid()\"\n [attr.aria-describedby]=\"fieldAria.describedBy()\"\n [attr.tabindex]=\"disabled() ? -1 : 0\"\n (pointerdown)=\"onPointerDown($event, 'hue')\"\n (keydown)=\"onSliderKeydown($event, 'hue')\"\n (blur)=\"onSurfaceBlur()\"\n>\n <!--\n `inset-inline-start`, not `left`: this is a one-value track, so it mirrors\n under `dir=\"rtl\"` the way `wr-slider` does. The SV thumb above keeps `left` —\n the canvas is a picture and does not flip.\n -->\n <span class=\"wr-color-picker__thumb wr-color-picker__thumb--slider\" [style.inset-inline-start.%]=\"hueThumbX()\"></span>\n</div>\n\n@if (alpha()) {\n <div\n class=\"wr-color-picker__slider wr-color-picker__slider--alpha\"\n role=\"slider\"\n aria-valuemin=\"0\"\n aria-valuemax=\"100\"\n [attr.aria-label]=\"resolvedAlphaLabel()\"\n [attr.aria-valuenow]=\"alphaPercent()\"\n [attr.aria-valuetext]=\"`${alphaPercent()}%`\"\n [attr.aria-disabled]=\"disabled() || null\"\n [attr.aria-readonly]=\"readonly() || null\"\n [attr.aria-invalid]=\"fieldAria.ariaInvalid()\"\n [attr.aria-describedby]=\"fieldAria.describedBy()\"\n [attr.tabindex]=\"disabled() ? -1 : 0\"\n (pointerdown)=\"onPointerDown($event, 'alpha')\"\n (keydown)=\"onSliderKeydown($event, 'alpha')\"\n (blur)=\"onSurfaceBlur()\"\n >\n <span\n class=\"wr-color-picker__thumb wr-color-picker__thumb--slider\"\n [style.inset-inline-start.%]=\"alphaThumbX()\"\n ></span>\n </div>\n}\n\n<div class=\"wr-color-picker__chrome\">\n <span class=\"wr-color-picker__preview\" [style.background]=\"hex()\"></span>\n <wr-segmented\n class=\"wr-color-picker__tabs\"\n [options]=\"tabOptions()\"\n [value]=\"activeTab()\"\n (valueChange)=\"onTabChange($event)\"\n />\n</div>\n\n@switch (activeTab()) {\n @case ('hex') {\n <div class=\"wr-color-picker__inputs wr-color-picker__inputs--hex\">\n <label class=\"wr-color-picker__field wr-color-picker__field--wide\">\n <input\n type=\"text\"\n spellcheck=\"false\"\n autocomplete=\"off\"\n [value]=\"hexInput()\"\n [disabled]=\"disabled()\"\n [readonly]=\"readonly()\"\n (input)=\"onHexInput($event)\"\n (blur)=\"onHexBlur()\"\n />\n <span class=\"wr-color-picker__field-label\">{{ channelHexLabel() }}</span>\n </label>\n </div>\n }\n @case ('rgb') {\n <div class=\"wr-color-picker__inputs\">\n <label class=\"wr-color-picker__field\">\n <input\n type=\"number\"\n min=\"0\"\n max=\"255\"\n [value]=\"rgb().r\"\n [disabled]=\"disabled()\"\n [readonly]=\"readonly()\"\n (input)=\"onRgbChannel('r', $event)\"\n />\n <span class=\"wr-color-picker__field-label\">{{ channelRedLabel() }}</span>\n </label>\n <label class=\"wr-color-picker__field\">\n <input\n type=\"number\"\n min=\"0\"\n max=\"255\"\n [value]=\"rgb().g\"\n [disabled]=\"disabled()\"\n [readonly]=\"readonly()\"\n (input)=\"onRgbChannel('g', $event)\"\n />\n <span class=\"wr-color-picker__field-label\">{{ channelGreenLabel() }}</span>\n </label>\n <label class=\"wr-color-picker__field\">\n <input\n type=\"number\"\n min=\"0\"\n max=\"255\"\n [value]=\"rgb().b\"\n [disabled]=\"disabled()\"\n [readonly]=\"readonly()\"\n (input)=\"onRgbChannel('b', $event)\"\n />\n <span class=\"wr-color-picker__field-label\">{{ channelBlueLabel() }}</span>\n </label>\n @if (alpha()) {\n <label class=\"wr-color-picker__field\">\n <input\n type=\"number\"\n min=\"0\"\n max=\"100\"\n [value]=\"alphaPercent()\"\n [disabled]=\"disabled()\"\n [readonly]=\"readonly()\"\n (input)=\"onAlphaPercent($event)\"\n />\n <span class=\"wr-color-picker__field-label\">{{ channelAlphaLabel() }}</span>\n </label>\n }\n </div>\n }\n @case ('hsl') {\n <div class=\"wr-color-picker__inputs\">\n <label class=\"wr-color-picker__field\">\n <input\n type=\"number\"\n min=\"0\"\n max=\"360\"\n [value]=\"hslView().h | number: '1.0-0'\"\n [disabled]=\"disabled()\"\n [readonly]=\"readonly()\"\n (input)=\"onHslChannel('h', $event)\"\n />\n <span class=\"wr-color-picker__field-label\">{{ channelHueLabel() }}</span>\n </label>\n <label class=\"wr-color-picker__field\">\n <input\n type=\"number\"\n min=\"0\"\n max=\"100\"\n [value]=\"hslView().s * 100 | number: '1.0-0'\"\n [disabled]=\"disabled()\"\n [readonly]=\"readonly()\"\n (input)=\"onHslChannel('s', $event)\"\n />\n <span class=\"wr-color-picker__field-label\">{{ channelSaturationLabel() }}</span>\n </label>\n <label class=\"wr-color-picker__field\">\n <input\n type=\"number\"\n min=\"0\"\n max=\"100\"\n [value]=\"hslView().l * 100 | number: '1.0-0'\"\n [disabled]=\"disabled()\"\n [readonly]=\"readonly()\"\n (input)=\"onHslChannel('l', $event)\"\n />\n <span class=\"wr-color-picker__field-label\">{{ channelLightnessLabel() }}</span>\n </label>\n @if (alpha()) {\n <label class=\"wr-color-picker__field\">\n <input\n type=\"number\"\n min=\"0\"\n max=\"100\"\n [value]=\"alphaPercent()\"\n [disabled]=\"disabled()\"\n [readonly]=\"readonly()\"\n (input)=\"onAlphaPercent($event)\"\n />\n <span class=\"wr-color-picker__field-label\">{{ channelAlphaLabel() }}</span>\n </label>\n }\n </div>\n }\n}\n\n@if (swatches().length > 0) {\n <div class=\"wr-color-picker__swatches\">\n @for (color of swatches(); track color) {\n <button\n type=\"button\"\n class=\"wr-color-picker__swatch\"\n [style.background]=\"color\"\n [attr.aria-label]=\"color\"\n [disabled]=\"disabled() || readonly()\"\n (click)=\"onSwatchClick(color)\"\n ></button>\n }\n </div>\n}\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { FocusMonitor } from '@angular/cdk/a11y';\nimport { Directionality } from '@angular/cdk/bidi';\nimport { coerceBooleanProperty } from '@angular/cdk/coercion';\nimport { type OverlayRef, ScrollStrategyOptions } from '@angular/cdk/overlay';\nimport { ComponentPortal } from '@angular/cdk/portal';\nimport {\n DestroyRef,\n Directive,\n ElementRef,\n Injector,\n ViewContainerRef,\n inject,\n input,\n model,\n output,\n signal,\n} from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\n\nimport { WR_OVERLAY, WrOutsideClick, wrFollowDirection } from 'ngwr/overlay';\nimport { wrGetFocusableElements, wrToClassList, wrCheckStyles, type WrClassInput, wrRestoreFocus } from 'ngwr/utils';\n\nimport { WrColorPicker } from './color-picker';\nimport type { WrColorFormat } from './types';\n\nlet triggerUid = 0;\n\n/**\n * Whether a keydown is a Tab that takes focus out past either end of the open\n * panel. The pane lives in the overlay container at the end of `<body>`, so the\n * browser's own Tab out of its last stop went to `<body>` — the top of the page —\n * with the panel left standing. The caller focuses the trigger synchronously and\n * does NOT `preventDefault`, so the browser's Tab carries on from there to the\n * trigger's real neighbour — the move `wr-dropdown` makes for its menu. The same\n * check lives beside `wr-date-picker`, which cannot share it across entry points.\n */\nfunction tabLeavesPane(pane: HTMLElement, event: KeyboardEvent): boolean {\n if (event.key !== 'Tab' || event.defaultPrevented || event.altKey || event.ctrlKey || event.metaKey) return false;\n const active = pane.ownerDocument.activeElement;\n if (!active || !pane.contains(active)) return false;\n const all = wrGetFocusableElements(pane);\n const at = all.indexOf(active as HTMLElement);\n if (at < 0) return false;\n const beyond = event.shiftKey ? all.slice(0, at) : all.slice(at + 1);\n return !beyond.some(el => el.tabIndex >= 0);\n}\n\n/**\n * Opens a `<wr-color-picker>` in an overlay anchored to the host element.\n *\n * Apply to any clickable element (typically a button). Two-way binds the\n * current colour through `[(value)]`; forwards `alpha` / `format` /\n * `swatches` / `disabled` to the inner picker.\n *\n * Same overlay isolation as the rest of the lib — uses {@link WR_OVERLAY},\n * not CDK's root container.\n *\n * @example\n * ```html\n * <button wrColorPickerTrigger\n * [(value)]=\"brandColor\"\n * [swatches]=\"palette\">\n * <span class=\"swatch\" [style.background]=\"brandColor\"></span>\n * {{ brandColor }}\n * </button>\n * ```\n *\n * @see https://ngwr.dev/reference/components/color-picker\n */\n@Directive({\n selector: '[wrColorPickerTrigger]',\n exportAs: 'wrColorPickerTrigger',\n host: {\n '(click)': 'toggle()',\n // The same two attributes `<wr-popover>`'s trigger carries: without them the\n // button gave no hint that it opens anything, and never said it was open.\n '[attr.aria-haspopup]': '\"dialog\"',\n '[attr.aria-expanded]': 'isOpen()',\n // Which panel, and only while there is one — the same pairing `[wrPopconfirm]`\n // publishes. Without it nothing on the page connects the trigger to the picker\n // it opened, so a second trigger's panel is indistinguishable from this one's.\n '[attr.aria-controls]': 'isOpen() ? panelId : null',\n // The directive's own `disabled` never reached the DOM: it gates `toggle()` and\n // is forwarded to the inner picker, so the button looked live to a screen\n // reader and did nothing when pressed.\n '[attr.aria-disabled]': 'disabled() ? true : null',\n },\n})\nexport class WrColorPickerTrigger {\n /** Two-way bindable colour value (hex string). */\n readonly value = model<string>('');\n\n /** Forwarded to the inner picker. @default true */\n readonly alpha = input(true, { transform: coerceBooleanProperty });\n\n /** Forwarded to the inner picker. @default 'hex' */\n readonly format = input<WrColorFormat>('hex');\n\n /** Forwarded to the inner picker. @default [] */\n readonly swatches = input<readonly string[]>([]);\n\n /** Disable the trigger entirely. @default false */\n readonly disabled = input(false, { transform: coerceBooleanProperty });\n\n /**\n * Extra CSS classes for the picker panel's overlay pane.\n *\n * The pane is appended to the overlay container, not to this component, so\n * nothing in the consumer's own template encloses it and no descendant rule\n * written around the trigger can reach it. This input is the only per-instance\n * handle on it. A space-separated string works as well as an array.\n */\n readonly panelClass = input<WrClassInput>(null);\n\n /** Fires after the picker opens. */\n readonly opened = output<void>();\n\n /** Fires after the picker closes. */\n readonly closed = output<void>();\n\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\n private readonly focusMonitor = inject(FocusMonitor);\n private readonly overlay = inject(WR_OVERLAY);\n private readonly outsideClick = inject(WrOutsideClick);\n private readonly vcr = inject(ViewContainerRef);\n private readonly scrollStrategies = inject(ScrollStrategyOptions);\n private readonly destroyRef = inject(DestroyRef);\n private readonly injector = inject(Injector);\n /**\n * Ambient reading direction, for the open panel alone — nothing in this\n * directive reads it directly. Optional so a bare `TestBed` needs no\n * provider; `Directionality` is root-provided anyway, and a missing one\n * simply reads as `ltr`.\n */\n private readonly dir = inject(Directionality, { optional: true });\n\n protected readonly isOpen = signal(false);\n private overlayRef: OverlayRef | null = null;\n\n /** @internal Public so the host binding can read it. */\n protected readonly panelId = `wr-color-picker-panel-${++triggerUid}`;\n\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('color-picker');\n this.destroyRef.onDestroy(() => this.dispose());\n }\n\n /** Toggle the picker. Open if closed, close if open. */\n toggle(): void {\n if (this.disabled()) return;\n if (this.isOpen()) {\n this.close();\n } else {\n this.open();\n }\n }\n\n /** Open the picker. No-op if already open. */\n open(): void {\n if (this.isOpen() || this.disabled()) return;\n\n const positionStrategy = this.overlay\n .position()\n .flexibleConnectedTo(this.host)\n .withPositions([\n { originX: 'start', originY: 'bottom', overlayX: 'start', overlayY: 'top', offsetY: 4 },\n { originX: 'start', originY: 'top', overlayX: 'start', overlayY: 'bottom', offsetY: -4 },\n { originX: 'end', originY: 'bottom', overlayX: 'end', overlayY: 'top', offsetY: 4 },\n { originX: 'end', originY: 'top', overlayX: 'end', overlayY: 'bottom', offsetY: -4 },\n ])\n .withPush(true);\n\n this.overlayRef = this.overlay.create({\n positionStrategy,\n scrollStrategy: this.scrollStrategies.reposition(),\n panelClass: wrToClassList('wr-color-picker-overlay', this.panelClass()),\n });\n this.overlayRef.overlayElement.id = this.panelId;\n\n // Two of the four fallbacks anchor on `end`, and the CDK resolves start /\n // end against the direction it captured when this ref was created. The\n // `<wr-segmented>` the picker draws its HEX / RGB / HSL tabs with is the\n // visible half: its thumb reads `Directionality` LIVE, so a flip while this\n // panel was open slid the thumb to the other slot inside a pane still drawn\n // `ltr` — parked under the wrong tab, which is the symptom that started all\n // of this.\n wrFollowDirection(this.overlayRef, this.dir, this.injector);\n\n const portal = new ComponentPortal(WrColorPicker, this.vcr);\n const ref = this.overlayRef.attach(portal);\n\n ref.setInput('alpha', this.alpha());\n ref.setInput('format', this.format());\n ref.setInput('swatches', this.swatches());\n ref.setInput('disabled', this.disabled());\n ref.setInput('value', this.value());\n\n // Render now rather than next frame: the picker's surfaces have to exist\n // before focus can move to one, and a deferred focus is the class of bug\n // this repo keeps finding.\n ref.changeDetectorRef.detectChanges();\n // Focus has to ENTER the panel. The overlay container sits at the end of\n // `<body>`, so a Tab from the trigger went to the next thing on the PAGE and\n // the saturation surface and both sliders — all `tabindex=\"0\"`, all\n // `role=\"slider\"` or `role=\"group\"` — were unreachable from the keyboard for\n // as long as the picker was open. The saturation surface is the first stop\n // and the one that carries the colour's two main values.\n //\n // Deliberately NOT a focus trap, matching `wr-popover` / `[wrPopconfirm]`:\n // this popup is non-modal, an outside click or Escape closes it, and\n // trapping would only make it harder to leave.\n this.overlayRef.overlayElement.querySelector<HTMLElement>('.wr-color-picker__sv')?.focus();\n\n // Bridge the inner picker's `value` model back to our two-way [(value)].\n ref.instance.value.subscribe((next: string) => this.value.set(next));\n\n // Outside-click → close (the source only filters out the overlay pane, so\n // the re-click on our own trigger still arrives here and has to be ignored).\n this.outsideClick\n .outsidePointerEvents(this.overlayRef)\n .pipe(takeUntilDestroyed(this.destroyRef))\n .subscribe(event => {\n if (this.host.nativeElement.contains(event.target as Node)) return;\n this.close();\n });\n\n // Escape → close; Tab past either end → close, leaving from the trigger.\n this.overlayRef\n .keydownEvents()\n .pipe(takeUntilDestroyed(this.destroyRef))\n .subscribe(event => {\n if (event.key === 'Escape') {\n event.preventDefault();\n this.close();\n return;\n }\n if (this.overlayRef && tabLeavesPane(this.overlayRef.overlayElement, event)) {\n wrRestoreFocus(this.host.nativeElement, this.focusMonitor);\n this.close();\n }\n });\n\n this.isOpen.set(true);\n this.opened.emit();\n }\n\n /** Close the picker. No-op if already closed. */\n close(): void {\n if (!this.isOpen()) return;\n // Focus lives inside the panel while it is open, and removing the panel\n // would drop it to `<body>` — hand it back to the trigger instead, the way\n // `[wrPopconfirm]` does. Only when focus is still IN there: if the user has\n // already clicked elsewhere, taking it back would be stealing.\n const returnFocus = !!this.overlayRef?.overlayElement.contains(document.activeElement);\n this.dispose();\n this.isOpen.set(false);\n this.closed.emit();\n if (returnFocus) wrRestoreFocus(this.host.nativeElement, this.focusMonitor);\n }\n\n private dispose(): void {\n if (this.overlayRef) {\n this.overlayRef.dispose();\n this.overlayRef = null;\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAaA,SAAgB,WAAW,KAAU;CACnC,MAAM,IAAI,IAAI,IAAI;CAClB,MAAM,IAAI,IAAI,IAAI;CAClB,MAAM,IAAI,IAAI,IAAI;CAClB,MAAM,MAAM,KAAK,IAAI,GAAG,GAAG,CAAC;CAE5B,MAAM,IAAI,MADE,KAAK,IAAI,GAAG,GAAG,CACX;CAEhB,IAAI,IAAI;CACR,IAAI,MAAM,GAAG;EACX,IAAI,QAAQ,GAAG,KAAM,IAAI,KAAK,IAAK;OAC9B,IAAI,QAAQ,GAAG,KAAK,IAAI,KAAK,IAAI;OACjC,KAAK,IAAI,KAAK,IAAI;EACvB,KAAK;E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AAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;GAAA,QAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;GAAA,UAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;GAAA,UAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;GAAA,YAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;EAAA;EAAA,SAAA;GAAA,OAAA;GAAA,QAAA;GAAA,QAAA;EAAA;EAAA,MAAA;GAAA,WAAA,EAAA,SAAA,WAAA;GAAA,YAAA;IAAA,sBAAA;IAAA,sBAAA;IAAA,sBAAA;IAAA,sBAAA;GAAA;EAAA;EAAA,UAAA,CAAA,sBAAA;EAAA,UAAA;CAAA,CAAA;;AAApB,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAoB,YAAA,CAAA;EAnBhC,MAAA;EAAU,MAAA,CAAA;GACT,UAAU;GACV,UAAU;GACV,MAAM;IACJ,WAAW;IAGX,wBAAwB;IACxB,wBAAwB;IAIxB,wBAAwB;IAIxB,wBAAwB;GACzB;EACF,CAAA"}
@@ -2,8 +2,8 @@ import * as i0 from "@angular/core";
2
2
  import { Component, DestroyRef, PLATFORM_ID, ViewEncapsulation, afterNextRender, computed, effect, inject, input, model, output, signal, viewChild } from "@angular/core";
3
3
  import { coerceBooleanProperty } from "@angular/cdk/coercion";
4
4
  import { isPlatformBrowser } from "@angular/common";
5
- import { isComposing, wrCheckStyles, wrRestoreFocus } from "ngwr/utils";
6
- import { readI18nText, useI18nText } from "ngwr/i18n";
5
+ import { wrCheckStyles, wrIsComposing, wrRestoreFocus } from "ngwr/utils";
6
+ import { useI18nText, wrReadI18nText } from "ngwr/i18n";
7
7
  import { WrIcon } from "ngwr/icon";
8
8
  import { ScrollStrategyOptions } from "@angular/cdk/overlay";
9
9
  import { takeUntilDestroyed, toObservable } from "@angular/core/rxjs-interop";
@@ -52,7 +52,7 @@ var WrCommandPalette = class WrCommandPalette {
52
52
  resolvedPlaceholder = useI18nText(this.placeholder, "commandPalette.placeholder", "Type a command or search…");
53
53
  resolvedEmpty = useI18nText(this.emptyText, "commandPalette.noResults", "No results");
54
54
  resolvedLoading = useI18nText(this.loadingText, "commandPalette.loading", "Searching…");
55
- resolvedEscHint = readI18nText("commandPalette.escHint", "esc");
55
+ resolvedEscHint = wrReadI18nText("commandPalette.escHint", "esc");
56
56
  closeOnPick = input(true, {
57
57
  ...ngDevMode ? { debugName: "closeOnPick" } : /* istanbul ignore next */ {},
58
58
  transform: coerceBooleanProperty
@@ -170,7 +170,7 @@ var WrCommandPalette = class WrCommandPalette {
170
170
  if (body) body.scrollTop = 0;
171
171
  }
172
172
  onKeydown(event) {
173
- if (isComposing(event)) return;
173
+ if (wrIsComposing(event)) return;
174
174
  const list = this.filtered();
175
175
  switch (event.key) {
176
176
  case "ArrowDown":
@@ -1 +1 @@
1
- {"version":3,"file":"ngwr-command-palette.mjs","names":[],"sources":["../../../projects/lib/command-palette/command-palette.ts","../../../projects/lib/command-palette/command-palette.html"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { type ConfigurableFocusTrap, ConfigurableFocusTrapFactory, FocusMonitor } from '@angular/cdk/a11y';\nimport { coerceBooleanProperty } from '@angular/cdk/coercion';\nimport { type BlockScrollStrategy, ScrollStrategyOptions } from '@angular/cdk/overlay';\nimport { isPlatformBrowser } from '@angular/common';\nimport {\n Component,\n DestroyRef,\n type ElementRef,\n PLATFORM_ID,\n ViewEncapsulation,\n afterNextRender,\n computed,\n effect,\n inject,\n input,\n model,\n output,\n signal,\n viewChild,\n} from '@angular/core';\nimport { takeUntilDestroyed, toObservable } from '@angular/core/rxjs-interop';\n\nimport { debounce, skip, timer } from 'rxjs';\n\nimport { WrHotkey, type WrHotkeyHandle, type WrHotkeySpec } from 'ngwr/hotkey';\nimport { readI18nText, useI18nText } from 'ngwr/i18n';\nimport { WrIcon } from 'ngwr/icon';\nimport { WR_OVERLAY_CONTAINER } from 'ngwr/overlay';\nimport { isComposing, wrCheckStyles, wrRestoreFocus } from 'ngwr/utils';\n\nimport type { WrCommandItem } from './types';\n\ninterface Bucket {\n readonly title: string | null;\n readonly items: readonly WrCommandItem[];\n}\n\nlet listboxUid = 0;\n\nfunction bucketize(items: readonly WrCommandItem[]): readonly Bucket[] {\n const map = new Map<string | null, WrCommandItem[]>();\n for (const item of items) {\n const key = item.group ?? null;\n const bucket = map.get(key);\n if (bucket) bucket.push(item);\n else map.set(key, [item]);\n }\n return [...map.entries()].map(([title, items]) => ({ title, items }));\n}\n\nfunction matches(item: WrCommandItem, query: string): boolean {\n if (!query) return true;\n const q = query.toLowerCase();\n if (item.label.toLowerCase().includes(q)) return true;\n if (item.description?.toLowerCase().includes(q)) return true;\n if (item.group?.toLowerCase().includes(q)) return true;\n if (item.keywords?.some(k => k.toLowerCase().includes(q))) return true;\n return false;\n}\n\n/**\n * `⌘K`-style command palette — a centred modal with a search input and\n * filtered list of actions. Items can be grouped, have icons, descriptions,\n * and visual shortcut hints.\n *\n * Drop one at the root of the app, pass it the list of commands, and bind\n * a global hotkey (default `'mod+k'`). Use `[(open)]` for controlled\n * visibility, or let it manage itself.\n *\n * @example\n * ```html\n * <wr-command-palette [items]=\"commands\" trigger=\"mod+k\" (picked)=\"onPicked($event)\" />\n * ```\n *\n * @see https://ngwr.dev/reference/components/command-palette\n */\n@Component({\n selector: 'wr-command-palette',\n templateUrl: './command-palette.html',\n encapsulation: ViewEncapsulation.None,\n imports: [WrIcon],\n})\nexport class WrCommandPalette {\n /** Accessible name. Falls back to `commandPalette.label`, then `'Command palette'`. */\n readonly paletteLabel = input<string | null>(null);\n\n protected readonly resolvedPaletteLabel = useI18nText(this.paletteLabel, 'commandPalette.label', 'Command palette');\n\n /** Items shown in the palette. */\n readonly items = input<readonly WrCommandItem[]>([]);\n\n /** Controlled open state (two-way bindable). @default false */\n readonly open = model(false);\n\n /** Global hotkey that opens the palette. `null` disables auto-binding. @default 'mod+k' */\n readonly trigger = input<WrHotkeySpec | null>('mod+k');\n\n /** Search input placeholder. Falls back to `commandPalette.placeholder`. */\n readonly placeholder = input<string | null>(null);\n\n /** Text shown when no items match. Falls back to `commandPalette.noResults`. */\n readonly emptyText = input<string | null>(null);\n\n /**\n * Overrides the `commandPalette.loading` catalog string, shown instead of\n * {@link emptyText} while {@link loading} is true.\n */\n readonly loadingText = input<string | null>(null);\n\n protected readonly resolvedPlaceholder = useI18nText(\n this.placeholder,\n 'commandPalette.placeholder',\n 'Type a command or search…'\n );\n protected readonly resolvedEmpty = useI18nText(this.emptyText, 'commandPalette.noResults', 'No results');\n protected readonly resolvedLoading = useI18nText(this.loadingText, 'commandPalette.loading', 'Searching…');\n\n /**\n * The key-cap chip beside the search field. It was the literal `esc` in the\n * template — the one string on this component no catalog could reach, so a\n * fully Russian palette still hinted in English.\n */\n protected readonly resolvedEscHint = readI18nText('commandPalette.escHint', 'esc');\n\n /** Auto-close on `(picked)`. Set false to keep open. @default true */\n readonly closeOnPick = input(true, { transform: coerceBooleanProperty });\n\n /** Fires when the user commits an item (Enter / click). */\n readonly picked = output<WrCommandItem>();\n\n /**\n * The search text. Two-way, so a host can seed it, clear it, or read what the\n * user is looking for — the palette used to keep this to itself, which is what\n * made it impossible to back with anything but a static `items` array.\n *\n * Writing it does NOT re-run a host's search on its own: the debounced\n * {@link searchChange} output is what fires, on exactly the cadence\n * {@link debounceMs} sets.\n */\n readonly query = model('');\n\n /**\n * The item list is already scoped to the query upstream — skip the built-in\n * client-side filter. Set it when `[items]` is fed from a server via the\n * {@link searchChange} output.\n *\n * Without this, a backend that ranks or tolerates typos (returning rows whose\n * labels do not literally contain the query) would have those rows hidden\n * again on the client — the same rule `wr-select` follows, and the same\n * reason. @default false\n */\n readonly serverSearch = input(false, { transform: coerceBooleanProperty });\n\n /**\n * A host-driven search is in flight. Swaps the empty row for\n * {@link loadingText} — an async palette that says \"No results\" between every\n * keystroke and its answer is stating something false. @default false\n */\n readonly loading = input(false, { transform: coerceBooleanProperty });\n\n /**\n * How long the query must settle before {@link searchChange} fires, in ms.\n * A search request per keystroke is what exhausts a metered search backend:\n * typing `select` is six requests at 0 and roughly one at 250. @default 250\n */\n readonly debounceMs = input(250, { transform: (v: unknown): number => Math.max(0, Number(v) || 0) });\n\n /**\n * The settled query. This is the hook for a server-backed palette: dispatch\n * on it, then feed the result into `[items]` with `[serverSearch]` set.\n *\n * Fires on the {@link debounceMs} cadence, NOT per keystroke — `queryChange`\n * is the per-keystroke signal if that is what you want.\n */\n readonly searchChange = output<string>();\n\n protected readonly activeIndex = signal(0);\n\n protected readonly inputEl = viewChild<ElementRef<HTMLInputElement>>('input');\n protected readonly panelEl = viewChild<ElementRef<HTMLElement>>('panel');\n\n /** Listbox id (referenced by the input's `aria-controls`). */\n protected readonly listboxId = `wr-command-palette-listbox-${++listboxUid}`;\n\n /** @internal Build a stable option id for a given flat index. */\n protected optionId(i: number): string {\n return `${this.listboxId}-opt-${i}`;\n }\n\n /**\n * A `role=\"listbox\"` may only own `option` and `group` children, so a titled\n * bucket becomes a labelled group and an untitled one drops out of the tree\n * entirely — leaving its options as the listbox's own children rather than as\n * role-less wrappers ARIA has no rule for.\n */\n protected groupTitleId(index: number): string {\n return `${this.listboxId}-group-${index}`;\n }\n\n /** Id of the active option for `aria-activedescendant`. */\n protected readonly activeOptionId = computed<string | null>(() => {\n const i = this.activeIndex();\n return i >= 0 && i < this.filtered().length ? this.optionId(i) : null;\n });\n\n private readonly focusMonitor = inject(FocusMonitor);\n private readonly hotkeys = inject(WrHotkey);\n private readonly destroyRef = inject(DestroyRef);\n private readonly focusTrapFactory = inject(ConfigurableFocusTrapFactory);\n private readonly isBrowser = isPlatformBrowser(inject(PLATFORM_ID));\n private readonly scrollStrategies = inject(ScrollStrategyOptions);\n private readonly overlayContainer = inject(WR_OVERLAY_CONTAINER);\n private bindingHandle: WrHotkeyHandle | null = null;\n private focusTrap: ConfigurableFocusTrap | null = null;\n /**\n * The page behind a modal does not scroll, and this one announces\n * `aria-modal=\"true\"` over a backdrop: wheeling over that backdrop scrolled the\n * document 500px while the palette stayed open. The palette renders in place\n * rather than through an overlay, so it borrows the CDK's own block strategy —\n * the one `WrDialog` gets from its overlay.\n */\n private scrollBlock: BlockScrollStrategy | null = null;\n private previouslyFocused: HTMLElement | null = null;\n\n /**\n * The open branch below builds the trap inside a `queueMicrotask`, so a\n * palette destroyed while open — in the same task that opened it — runs its\n * destroy hook first and then constructs a fresh trap nothing will ever\n * destroy. A `ConfigurableFocusTrap` plants two anchor elements in the panel\n * and holds it, so that is retained DOM, not just a stray object.\n */\n private destroyed = false;\n\n /** Whether this palette filters `items` itself. */\n protected readonly clientFilter = computed(() => !this.serverSearch());\n\n /**\n * Nothing has been asked yet, so there is nothing to report as missing.\n *\n * A client-filtered palette cannot reach this state — an empty query matches\n * every item, so the list is never empty on open. A server-backed one opens\n * with no items by construction, and saying \"No results\" before a single\n * keystroke answers a question nobody asked.\n */\n protected readonly awaitingQuery = computed(() => this.serverSearch() && this.query().trim().length === 0);\n\n /** Grouped view — what the template renders. */\n protected readonly buckets = computed<readonly Bucket[]>(() =>\n bucketize(this.clientFilter() ? this.items().filter(item => matches(item, this.query())) : this.items())\n );\n\n /**\n * Flat list in RENDER order — what keyboard navigation walks, and what every\n * index in this component means. Derived FROM the buckets rather than from the\n * filter: `bucketize` collects each group as it first appears, so a flat\n * source-order list disagrees with the screen the moment two groups interleave.\n * It did, and one ArrowDown moved the highlight two rows while Enter fired the\n * command below the one that looked selected.\n */\n protected readonly filtered = computed<readonly WrCommandItem[]>(() =>\n this.buckets().flatMap(bucket => bucket.items)\n );\n\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('command-palette');\n // The settled query, for a host-driven search. `debounce(() => timer(...))`\n // rather than `debounceTime(this.debounceMs())`: this runs in the\n // constructor, where inputs are not bound yet, so reading the input eagerly\n // would pin the delay to the default and ignore `[debounceMs]` for good.\n //\n // `skip(1)` sits BEFORE the debounce so it drops the mount-time replay of\n // the empty query and nothing else. Downstream it would instead drop the\n // first SETTLED emission — and when a fast typist's opening keystrokes\n // coalesce with that initial `''`, the dropped emission is their query.\n //\n // Both rules are `wr-select`'s, arrived at there the hard way; this is the\n // same pipeline minus the async loader, which the palette does not own.\n toObservable(this.query)\n .pipe(\n skip(1),\n debounce(() => timer(this.debounceMs())),\n takeUntilDestroyed(this.destroyRef)\n )\n .subscribe(query => this.searchChange.emit(query));\n\n // Bind / re-bind the global trigger whenever the spec changes.\n effect(() => {\n this.bindingHandle?.unbind();\n const spec = this.trigger();\n if (!spec) return;\n this.bindingHandle = this.hotkeys.bind(\n spec,\n event => {\n // CLAIM the chord, and the distinction is the whole point: the\n // `preventDefault` OPTION suppresses the browser, while a handler\n // calling `preventDefault()` is how `WrHotkey` is documented to learn\n // that a binding took the chord and the lower-priority ones should be\n // skipped. A palette that only toggled left the chord unclaimed, so\n // two palettes on one page would both open on `mod+k`.\n event.preventDefault();\n this.open.update(v => !v);\n },\n { allowInInput: true }\n );\n });\n\n // Reset query + active index whenever we open.\n effect(() => {\n if (!this.open()) return;\n this.query.set('');\n this.activeIndex.set(0);\n });\n\n // Focus trap + restore.\n effect(() => {\n if (!this.isBrowser) return;\n if (this.open()) {\n const active = document.activeElement;\n this.previouslyFocused = active instanceof HTMLElement ? active : null;\n // The strategy's `cdk-global-scrollblock` class is styled by the CDK's\n // structural sheet, which the overlay container loads — and an app may\n // open this before it has ever opened an overlay.\n this.overlayContainer.getContainerElement();\n this.scrollBlock ??= this.scrollStrategies.block();\n this.scrollBlock.enable();\n queueMicrotask(() => {\n if (this.destroyed) return;\n const host = this.panelEl()?.nativeElement;\n if (!host) return;\n this.focusTrap?.destroy();\n this.focusTrap = this.focusTrapFactory.create(host);\n void this.focusTrap.focusInitialElementWhenReady();\n });\n } else {\n this.scrollBlock?.disable();\n this.focusTrap?.destroy();\n this.focusTrap = null;\n const restore = this.previouslyFocused;\n this.previouslyFocused = null;\n if (restore && typeof restore.focus === 'function') wrRestoreFocus(restore, this.focusMonitor);\n }\n });\n\n afterNextRender(() => {\n if (this.open()) this.inputEl()?.nativeElement.focus();\n });\n\n // Auto-focus the input when opened.\n effect(() => {\n if (!this.open()) return;\n queueMicrotask(() => this.inputEl()?.nativeElement.focus());\n });\n\n // Clamp the active index when the filtered list shrinks.\n effect(() => {\n const max = Math.max(0, this.filtered().length - 1);\n if (this.activeIndex() > max) this.activeIndex.set(max);\n });\n\n this.destroyRef.onDestroy(() => {\n this.destroyed = true;\n this.bindingHandle?.unbind();\n // The trap is torn down in the close branch of the effect above, which never\n // runs when the component itself goes away while still open — leaving a live\n // trap holding the removed panel and its document listeners.\n this.focusTrap?.destroy();\n this.focusTrap = null;\n // Same reason: the close branch never runs for a palette destroyed open.\n this.scrollBlock?.disable();\n });\n }\n\n // Template handlers\n\n protected onQueryInput(event: Event): void {\n this.query.set((event.target as HTMLInputElement).value);\n this.activeIndex.set(0);\n // The highlight goes back to the first row, and the SCROLLER has to go with\n // it. Nothing moved it otherwise: the options are not focusable, so the\n // browser scrolls nothing on its own, and `revealActive` is called only from\n // the arrow keys. Edit the query after arrowing down a long list and the\n // highlight sat at the top, out of sight, while the rows on screen were\n // something else — and Enter ran the command the user could not see.\n //\n // `scrollTop = 0` rather than `revealActive()`: the list has just been\n // re-filtered, so under zoneless CD the row at index 0 is still the OLD one\n // until change detection runs, and the destination is the top either way.\n const body = this.panelEl()?.nativeElement.querySelector<HTMLElement>('.wr-command-palette__body');\n if (body) body.scrollTop = 0;\n }\n\n protected onKeydown(event: KeyboardEvent): void {\n // Every key below belongs to the input method while it is converting: Enter\n // accepts a candidate, Escape cancels the conversion, the arrows walk the\n // candidate list. Acting on them closed the palette — and threw the query\n // away — the first time a Japanese user pressed Escape to undo a reading.\n if (isComposing(event)) return;\n\n const list = this.filtered();\n switch (event.key) {\n case 'ArrowDown':\n event.preventDefault();\n if (list.length > 0) this.activeIndex.set((this.activeIndex() + 1) % list.length);\n this.revealActive();\n break;\n case 'ArrowUp':\n event.preventDefault();\n if (list.length > 0) this.activeIndex.set((this.activeIndex() - 1 + list.length) % list.length);\n this.revealActive();\n break;\n case 'Home':\n event.preventDefault();\n this.activeIndex.set(0);\n this.revealActive();\n break;\n case 'End':\n event.preventDefault();\n this.activeIndex.set(Math.max(0, list.length - 1));\n this.revealActive();\n break;\n case 'Enter': {\n event.preventDefault();\n const item = list[this.activeIndex()];\n if (item) this.commit(item);\n break;\n }\n case 'Escape':\n event.preventDefault();\n this.close();\n break;\n default:\n break;\n }\n }\n\n protected onBackdropClick(): void {\n this.close();\n }\n\n protected onItemClick(item: WrCommandItem, event: MouseEvent): void {\n event.preventDefault();\n this.commit(item);\n }\n\n protected onItemHover(item: WrCommandItem): void {\n const i = this.filtered().indexOf(item);\n if (i >= 0) this.activeIndex.set(i);\n }\n\n /** Flat index of an item within the filtered list — for highlight checks. */\n protected indexOf(item: WrCommandItem): number {\n return this.filtered().indexOf(item);\n }\n\n // Public API\n\n /** Open the palette. */\n show(): void {\n this.open.set(true);\n }\n\n /** Close the palette. */\n close(): void {\n this.open.set(false);\n }\n\n // Internals\n\n /**\n * Keep the highlighted option on screen. The body is a fixed-height scroller and\n * the options are not focusable, so nothing moves it on the browser's behalf —\n * arrow keys walked the highlight straight off the bottom and out of sight.\n * Keyboard only: doing it on hover would fight the pointer that caused it.\n * `wr-select` and `wr-tree` keep the same promise through their own\n * `ensureVisible`; theirs is index maths because they are virtualized.\n */\n private revealActive(): void {\n if (!this.isBrowser) return;\n const id = this.activeOptionId();\n if (!id) return;\n // Ids are position-based and stable, so the element is findable straight away —\n // no need to wait for change detection to re-mark the active row.\n this.panelEl()?.nativeElement.querySelector<HTMLElement>(`#${id}`)?.scrollIntoView({ block: 'nearest' });\n }\n\n private commit(item: WrCommandItem): void {\n // Let the page go BEFORE the command runs when the pick also closes the\n // palette. A command commonly opens a dialog, and the CDK block strategy will\n // not engage while the page is already blocked — so the dialog would open\n // unblocked, and the palette's own release a moment later would leave the\n // page scrolling behind it.\n if (this.closeOnPick()) this.scrollBlock?.disable();\n item.action?.();\n this.picked.emit(item);\n if (this.closeOnPick()) this.close();\n }\n}\n","@if (open()) {\n <div class=\"wr-command-palette\" role=\"dialog\" aria-modal=\"true\" [attr.aria-label]=\"resolvedPaletteLabel()\">\n <!-- Backdrop captures clicks to close. Not focusable — keyboard users use\n Esc on the panel below. -->\n\n <div class=\"wr-command-palette__backdrop\" aria-hidden=\"true\" (click)=\"onBackdropClick()\"></div>\n\n <!-- Keydown is delegated from the search input; tabindex enables Esc when\n the input is unfocused. -->\n <div #panel class=\"wr-command-palette__panel\" tabindex=\"-1\" (keydown)=\"onKeydown($event)\">\n <div class=\"wr-command-palette__search\">\n <svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" aria-hidden=\"true\">\n <circle cx=\"7\" cy=\"7\" r=\"5\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.5\" />\n <path d=\"M11 11 L14 14\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" />\n </svg>\n <input\n #input\n type=\"text\"\n role=\"combobox\"\n autocomplete=\"off\"\n spellcheck=\"false\"\n aria-autocomplete=\"list\"\n [attr.aria-controls]=\"listboxId\"\n [attr.aria-expanded]=\"true\"\n [attr.aria-activedescendant]=\"activeOptionId() || null\"\n [placeholder]=\"resolvedPlaceholder()\"\n [value]=\"query()\"\n (input)=\"onQueryInput($event)\"\n />\n <kbd class=\"wr-command-palette__hint\">{{ resolvedEscHint() }}</kbd>\n </div>\n\n <!-- The empty row sits OUTSIDE the listbox below, and is a live region.\n A listbox may only own `option` and `group` children — the same rule\n the buckets already follow — so this row inside it was an\n `aria-required-children` critical for every query that matched\n nothing, and an empty listbox on its own is not. `role=\"status\"` also\n gets the message spoken while focus stays in the search input. -->\n @if (loading()) {\n <div class=\"wr-command-palette__empty\" role=\"status\">{{ resolvedLoading() }}</div>\n } @else if (filtered().length === 0 && !awaitingQuery()) {\n <div class=\"wr-command-palette__empty\" role=\"status\">{{ resolvedEmpty() }}</div>\n }\n\n <div class=\"wr-command-palette__body\" role=\"listbox\" [attr.id]=\"listboxId\">\n @for (bucket of buckets(); track bucket.title; let groupIndex = $index) {\n <!-- A listbox may only own `option` and `group` children, so a titled\n bucket is a labelled group and an untitled one leaves the tree with\n `role=\"none\"`, promoting its options to the listbox's own. -->\n <div\n class=\"wr-command-palette__group\"\n [attr.role]=\"bucket.title ? 'group' : 'none'\"\n [attr.aria-labelledby]=\"bucket.title ? groupTitleId(groupIndex) : null\"\n >\n @if (bucket.title) {\n <div class=\"wr-command-palette__group-title\" [attr.id]=\"groupTitleId(groupIndex)\">\n {{ bucket.title }}\n </div>\n }\n @for (item of bucket.items; track item.id) {\n <div\n class=\"wr-command-palette__option\"\n role=\"option\"\n [attr.id]=\"optionId(indexOf(item))\"\n [class.wr-command-palette__option--active]=\"indexOf(item) === activeIndex()\"\n [attr.aria-selected]=\"indexOf(item) === activeIndex()\"\n (mouseenter)=\"onItemHover(item)\"\n (mousedown)=\"onItemClick(item, $event)\"\n >\n @if (item.icon) {\n <wr-icon class=\"wr-command-palette__option-icon\" [name]=\"item.icon\" size=\"16\" />\n } @else {\n <span class=\"wr-command-palette__option-icon\" aria-hidden=\"true\"></span>\n }\n <div class=\"wr-command-palette__option-body\">\n <div class=\"wr-command-palette__option-label\">{{ item.label }}</div>\n @if (item.description) {\n <div class=\"wr-command-palette__option-description\">{{ item.description }}</div>\n }\n </div>\n @if (item.shortcut) {\n <kbd class=\"wr-command-palette__option-shortcut\">{{ item.shortcut }}</kbd>\n }\n </div>\n }\n </div>\n }\n </div>\n\n <!-- Footer slot. A real palette carries something under the list — a key\n legend, a result count, a provider's required attribution — and there\n was nowhere to put it. Projected rather than an input, because the\n content is markup (a link, a logo) rather than a string.\n\n Outside the listbox on purpose: a `role=\"listbox\"` may own only\n `option` and `group` children, the same rule the buckets and the empty\n row already follow. -->\n <div class=\"wr-command-palette__footer\">\n <ng-content select=\"[wrCommandPaletteFooter]\" />\n </div>\n </div>\n </div>\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AA4CA,IAAI,aAAa;AAEjB,SAAS,UAAU,OAA+B;CAChD,MAAM,sBAAM,IAAI,IAAG;CACnB,KAAK,MAAM,QAAQ,OAAO;EACxB,MAAM,MAAM,KAAK,SAAS;EAC1B,MAAM,SAAS,IAAI,IAAI,GAAG;EAC1B,IAAI,QAAQ,OAAO,KAAK,IAAI;OACvB,IAAI,IAAI,KAAK,CAAC,IAAI,CAAC;CAC1B;CACA,OAAO,CAAC,GAAG,IAAI,QAAO,CAAE,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY;EAAE;EAAO;CAAK,EAAG;AACtE;AAEA,SAAS,QAAQ,MAAqB,OAAa;CACjD,IAAI,CAAC,OAAO,OAAO;CACnB,MAAM,IAAI,MAAM,YAAW;CAC3B,IAAI,KAAK,MAAM,YAAW,CAAE,CAAC,SAAS,CAAC,GAAG,OAAO;CACjD,IAAI,KAAK,aAAa,YAAW,CAAE,CAAC,SAAS,CAAC,GAAG,OAAO;CACxD,IAAI,KAAK,OAAO,YAAW,CAAE,CAAC,SAAS,CAAC,GAAG,OAAO;CAClD,IAAI,KAAK,UAAU,MAAK,MAAK,EAAE,YAAW,CAAE,CAAC,SAAS,CAAC,CAAC,GAAG,OAAO;CAClE,OAAO;AACT;AAwBA,IAAa,mBAAb,MAAa,iBAAgB;CAElB,eAAe,MAAqB,MAAK,GAAA,YAAA,CAAA,EAAA,WAAA,eAAA,CAAA,+BAAA,CAAA,CAAA;CAE/B,uBAAuB,YAAY,KAAK,cAAc,wBAAwB,iBAAiB;CAGzG,QAAQ,MAAgC,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AAA,UAAA,KAAA,CAAA;EAAA,CAAA;EAAA,SAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CACZ,SAAO,EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;CAAA;AAAA,CAAA"}
1
+ {"version":3,"file":"ngwr-command-palette.mjs","names":[],"sources":["../../../projects/lib/command-palette/command-palette.ts","../../../projects/lib/command-palette/command-palette.html"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { type ConfigurableFocusTrap, ConfigurableFocusTrapFactory, FocusMonitor } from '@angular/cdk/a11y';\nimport { coerceBooleanProperty } from '@angular/cdk/coercion';\nimport { type BlockScrollStrategy, ScrollStrategyOptions } from '@angular/cdk/overlay';\nimport { isPlatformBrowser } from '@angular/common';\nimport {\n Component,\n DestroyRef,\n type ElementRef,\n PLATFORM_ID,\n ViewEncapsulation,\n afterNextRender,\n computed,\n effect,\n inject,\n input,\n model,\n output,\n signal,\n viewChild,\n} from '@angular/core';\nimport { takeUntilDestroyed, toObservable } from '@angular/core/rxjs-interop';\n\nimport { debounce, skip, timer } from 'rxjs';\n\nimport { WrHotkey, type WrHotkeyHandle, type WrHotkeySpec } from 'ngwr/hotkey';\nimport { wrReadI18nText, useI18nText } from 'ngwr/i18n';\nimport { WrIcon } from 'ngwr/icon';\nimport { WR_OVERLAY_CONTAINER } from 'ngwr/overlay';\nimport { wrIsComposing, wrCheckStyles, wrRestoreFocus } from 'ngwr/utils';\n\nimport type { WrCommandItem } from './types';\n\ninterface Bucket {\n readonly title: string | null;\n readonly items: readonly WrCommandItem[];\n}\n\nlet listboxUid = 0;\n\nfunction bucketize(items: readonly WrCommandItem[]): readonly Bucket[] {\n const map = new Map<string | null, WrCommandItem[]>();\n for (const item of items) {\n const key = item.group ?? null;\n const bucket = map.get(key);\n if (bucket) bucket.push(item);\n else map.set(key, [item]);\n }\n return [...map.entries()].map(([title, items]) => ({ title, items }));\n}\n\nfunction matches(item: WrCommandItem, query: string): boolean {\n if (!query) return true;\n const q = query.toLowerCase();\n if (item.label.toLowerCase().includes(q)) return true;\n if (item.description?.toLowerCase().includes(q)) return true;\n if (item.group?.toLowerCase().includes(q)) return true;\n if (item.keywords?.some(k => k.toLowerCase().includes(q))) return true;\n return false;\n}\n\n/**\n * `⌘K`-style command palette — a centred modal with a search input and\n * filtered list of actions. Items can be grouped, have icons, descriptions,\n * and visual shortcut hints.\n *\n * Drop one at the root of the app, pass it the list of commands, and bind\n * a global hotkey (default `'mod+k'`). Use `[(open)]` for controlled\n * visibility, or let it manage itself.\n *\n * @example\n * ```html\n * <wr-command-palette [items]=\"commands\" trigger=\"mod+k\" (picked)=\"onPicked($event)\" />\n * ```\n *\n * @see https://ngwr.dev/reference/components/command-palette\n */\n@Component({\n selector: 'wr-command-palette',\n templateUrl: './command-palette.html',\n encapsulation: ViewEncapsulation.None,\n imports: [WrIcon],\n})\nexport class WrCommandPalette {\n /** Accessible name. Falls back to `commandPalette.label`, then `'Command palette'`. */\n readonly paletteLabel = input<string | null>(null);\n\n protected readonly resolvedPaletteLabel = useI18nText(this.paletteLabel, 'commandPalette.label', 'Command palette');\n\n /** Items shown in the palette. */\n readonly items = input<readonly WrCommandItem[]>([]);\n\n /** Controlled open state (two-way bindable). @default false */\n readonly open = model(false);\n\n /** Global hotkey that opens the palette. `null` disables auto-binding. @default 'mod+k' */\n readonly trigger = input<WrHotkeySpec | null>('mod+k');\n\n /** Search input placeholder. Falls back to `commandPalette.placeholder`. */\n readonly placeholder = input<string | null>(null);\n\n /** Text shown when no items match. Falls back to `commandPalette.noResults`. */\n readonly emptyText = input<string | null>(null);\n\n /**\n * Overrides the `commandPalette.loading` catalog string, shown instead of\n * {@link emptyText} while {@link loading} is true.\n */\n readonly loadingText = input<string | null>(null);\n\n protected readonly resolvedPlaceholder = useI18nText(\n this.placeholder,\n 'commandPalette.placeholder',\n 'Type a command or search…'\n );\n protected readonly resolvedEmpty = useI18nText(this.emptyText, 'commandPalette.noResults', 'No results');\n protected readonly resolvedLoading = useI18nText(this.loadingText, 'commandPalette.loading', 'Searching…');\n\n /**\n * The key-cap chip beside the search field. It was the literal `esc` in the\n * template — the one string on this component no catalog could reach, so a\n * fully Russian palette still hinted in English.\n */\n protected readonly resolvedEscHint = wrReadI18nText('commandPalette.escHint', 'esc');\n\n /** Auto-close on `(picked)`. Set false to keep open. @default true */\n readonly closeOnPick = input(true, { transform: coerceBooleanProperty });\n\n /** Fires when the user commits an item (Enter / click). */\n readonly picked = output<WrCommandItem>();\n\n /**\n * The search text. Two-way, so a host can seed it, clear it, or read what the\n * user is looking for — the palette used to keep this to itself, which is what\n * made it impossible to back with anything but a static `items` array.\n *\n * Writing it does NOT re-run a host's search on its own: the debounced\n * {@link searchChange} output is what fires, on exactly the cadence\n * {@link debounceMs} sets.\n */\n readonly query = model('');\n\n /**\n * The item list is already scoped to the query upstream — skip the built-in\n * client-side filter. Set it when `[items]` is fed from a server via the\n * {@link searchChange} output.\n *\n * Without this, a backend that ranks or tolerates typos (returning rows whose\n * labels do not literally contain the query) would have those rows hidden\n * again on the client — the same rule `wr-select` follows, and the same\n * reason. @default false\n */\n readonly serverSearch = input(false, { transform: coerceBooleanProperty });\n\n /**\n * A host-driven search is in flight. Swaps the empty row for\n * {@link loadingText} — an async palette that says \"No results\" between every\n * keystroke and its answer is stating something false. @default false\n */\n readonly loading = input(false, { transform: coerceBooleanProperty });\n\n /**\n * How long the query must settle before {@link searchChange} fires, in ms.\n * A search request per keystroke is what exhausts a metered search backend:\n * typing `select` is six requests at 0 and roughly one at 250. @default 250\n */\n readonly debounceMs = input(250, { transform: (v: unknown): number => Math.max(0, Number(v) || 0) });\n\n /**\n * The settled query. This is the hook for a server-backed palette: dispatch\n * on it, then feed the result into `[items]` with `[serverSearch]` set.\n *\n * Fires on the {@link debounceMs} cadence, NOT per keystroke — `queryChange`\n * is the per-keystroke signal if that is what you want.\n */\n readonly searchChange = output<string>();\n\n protected readonly activeIndex = signal(0);\n\n protected readonly inputEl = viewChild<ElementRef<HTMLInputElement>>('input');\n protected readonly panelEl = viewChild<ElementRef<HTMLElement>>('panel');\n\n /** Listbox id (referenced by the input's `aria-controls`). */\n protected readonly listboxId = `wr-command-palette-listbox-${++listboxUid}`;\n\n /** @internal Build a stable option id for a given flat index. */\n protected optionId(i: number): string {\n return `${this.listboxId}-opt-${i}`;\n }\n\n /**\n * A `role=\"listbox\"` may only own `option` and `group` children, so a titled\n * bucket becomes a labelled group and an untitled one drops out of the tree\n * entirely — leaving its options as the listbox's own children rather than as\n * role-less wrappers ARIA has no rule for.\n */\n protected groupTitleId(index: number): string {\n return `${this.listboxId}-group-${index}`;\n }\n\n /** Id of the active option for `aria-activedescendant`. */\n protected readonly activeOptionId = computed<string | null>(() => {\n const i = this.activeIndex();\n return i >= 0 && i < this.filtered().length ? this.optionId(i) : null;\n });\n\n private readonly focusMonitor = inject(FocusMonitor);\n private readonly hotkeys = inject(WrHotkey);\n private readonly destroyRef = inject(DestroyRef);\n private readonly focusTrapFactory = inject(ConfigurableFocusTrapFactory);\n private readonly isBrowser = isPlatformBrowser(inject(PLATFORM_ID));\n private readonly scrollStrategies = inject(ScrollStrategyOptions);\n private readonly overlayContainer = inject(WR_OVERLAY_CONTAINER);\n private bindingHandle: WrHotkeyHandle | null = null;\n private focusTrap: ConfigurableFocusTrap | null = null;\n /**\n * The page behind a modal does not scroll, and this one announces\n * `aria-modal=\"true\"` over a backdrop: wheeling over that backdrop scrolled the\n * document 500px while the palette stayed open. The palette renders in place\n * rather than through an overlay, so it borrows the CDK's own block strategy —\n * the one `WrDialog` gets from its overlay.\n */\n private scrollBlock: BlockScrollStrategy | null = null;\n private previouslyFocused: HTMLElement | null = null;\n\n /**\n * The open branch below builds the trap inside a `queueMicrotask`, so a\n * palette destroyed while open — in the same task that opened it — runs its\n * destroy hook first and then constructs a fresh trap nothing will ever\n * destroy. A `ConfigurableFocusTrap` plants two anchor elements in the panel\n * and holds it, so that is retained DOM, not just a stray object.\n */\n private destroyed = false;\n\n /** Whether this palette filters `items` itself. */\n protected readonly clientFilter = computed(() => !this.serverSearch());\n\n /**\n * Nothing has been asked yet, so there is nothing to report as missing.\n *\n * A client-filtered palette cannot reach this state — an empty query matches\n * every item, so the list is never empty on open. A server-backed one opens\n * with no items by construction, and saying \"No results\" before a single\n * keystroke answers a question nobody asked.\n */\n protected readonly awaitingQuery = computed(() => this.serverSearch() && this.query().trim().length === 0);\n\n /** Grouped view — what the template renders. */\n protected readonly buckets = computed<readonly Bucket[]>(() =>\n bucketize(this.clientFilter() ? this.items().filter(item => matches(item, this.query())) : this.items())\n );\n\n /**\n * Flat list in RENDER order — what keyboard navigation walks, and what every\n * index in this component means. Derived FROM the buckets rather than from the\n * filter: `bucketize` collects each group as it first appears, so a flat\n * source-order list disagrees with the screen the moment two groups interleave.\n * It did, and one ArrowDown moved the highlight two rows while Enter fired the\n * command below the one that looked selected.\n */\n protected readonly filtered = computed<readonly WrCommandItem[]>(() =>\n this.buckets().flatMap(bucket => bucket.items)\n );\n\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('command-palette');\n // The settled query, for a host-driven search. `debounce(() => timer(...))`\n // rather than `debounceTime(this.debounceMs())`: this runs in the\n // constructor, where inputs are not bound yet, so reading the input eagerly\n // would pin the delay to the default and ignore `[debounceMs]` for good.\n //\n // `skip(1)` sits BEFORE the debounce so it drops the mount-time replay of\n // the empty query and nothing else. Downstream it would instead drop the\n // first SETTLED emission — and when a fast typist's opening keystrokes\n // coalesce with that initial `''`, the dropped emission is their query.\n //\n // Both rules are `wr-select`'s, arrived at there the hard way; this is the\n // same pipeline minus the async loader, which the palette does not own.\n toObservable(this.query)\n .pipe(\n skip(1),\n debounce(() => timer(this.debounceMs())),\n takeUntilDestroyed(this.destroyRef)\n )\n .subscribe(query => this.searchChange.emit(query));\n\n // Bind / re-bind the global trigger whenever the spec changes.\n effect(() => {\n this.bindingHandle?.unbind();\n const spec = this.trigger();\n if (!spec) return;\n this.bindingHandle = this.hotkeys.bind(\n spec,\n event => {\n // CLAIM the chord, and the distinction is the whole point: the\n // `preventDefault` OPTION suppresses the browser, while a handler\n // calling `preventDefault()` is how `WrHotkey` is documented to learn\n // that a binding took the chord and the lower-priority ones should be\n // skipped. A palette that only toggled left the chord unclaimed, so\n // two palettes on one page would both open on `mod+k`.\n event.preventDefault();\n this.open.update(v => !v);\n },\n { allowInInput: true }\n );\n });\n\n // Reset query + active index whenever we open.\n effect(() => {\n if (!this.open()) return;\n this.query.set('');\n this.activeIndex.set(0);\n });\n\n // Focus trap + restore.\n effect(() => {\n if (!this.isBrowser) return;\n if (this.open()) {\n const active = document.activeElement;\n this.previouslyFocused = active instanceof HTMLElement ? active : null;\n // The strategy's `cdk-global-scrollblock` class is styled by the CDK's\n // structural sheet, which the overlay container loads — and an app may\n // open this before it has ever opened an overlay.\n this.overlayContainer.getContainerElement();\n this.scrollBlock ??= this.scrollStrategies.block();\n this.scrollBlock.enable();\n queueMicrotask(() => {\n if (this.destroyed) return;\n const host = this.panelEl()?.nativeElement;\n if (!host) return;\n this.focusTrap?.destroy();\n this.focusTrap = this.focusTrapFactory.create(host);\n void this.focusTrap.focusInitialElementWhenReady();\n });\n } else {\n this.scrollBlock?.disable();\n this.focusTrap?.destroy();\n this.focusTrap = null;\n const restore = this.previouslyFocused;\n this.previouslyFocused = null;\n if (restore && typeof restore.focus === 'function') wrRestoreFocus(restore, this.focusMonitor);\n }\n });\n\n afterNextRender(() => {\n if (this.open()) this.inputEl()?.nativeElement.focus();\n });\n\n // Auto-focus the input when opened.\n effect(() => {\n if (!this.open()) return;\n queueMicrotask(() => this.inputEl()?.nativeElement.focus());\n });\n\n // Clamp the active index when the filtered list shrinks.\n effect(() => {\n const max = Math.max(0, this.filtered().length - 1);\n if (this.activeIndex() > max) this.activeIndex.set(max);\n });\n\n this.destroyRef.onDestroy(() => {\n this.destroyed = true;\n this.bindingHandle?.unbind();\n // The trap is torn down in the close branch of the effect above, which never\n // runs when the component itself goes away while still open — leaving a live\n // trap holding the removed panel and its document listeners.\n this.focusTrap?.destroy();\n this.focusTrap = null;\n // Same reason: the close branch never runs for a palette destroyed open.\n this.scrollBlock?.disable();\n });\n }\n\n // Template handlers\n\n protected onQueryInput(event: Event): void {\n this.query.set((event.target as HTMLInputElement).value);\n this.activeIndex.set(0);\n // The highlight goes back to the first row, and the SCROLLER has to go with\n // it. Nothing moved it otherwise: the options are not focusable, so the\n // browser scrolls nothing on its own, and `revealActive` is called only from\n // the arrow keys. Edit the query after arrowing down a long list and the\n // highlight sat at the top, out of sight, while the rows on screen were\n // something else — and Enter ran the command the user could not see.\n //\n // `scrollTop = 0` rather than `revealActive()`: the list has just been\n // re-filtered, so under zoneless CD the row at index 0 is still the OLD one\n // until change detection runs, and the destination is the top either way.\n const body = this.panelEl()?.nativeElement.querySelector<HTMLElement>('.wr-command-palette__body');\n if (body) body.scrollTop = 0;\n }\n\n protected onKeydown(event: KeyboardEvent): void {\n // Every key below belongs to the input method while it is converting: Enter\n // accepts a candidate, Escape cancels the conversion, the arrows walk the\n // candidate list. Acting on them closed the palette — and threw the query\n // away — the first time a Japanese user pressed Escape to undo a reading.\n if (wrIsComposing(event)) return;\n\n const list = this.filtered();\n switch (event.key) {\n case 'ArrowDown':\n event.preventDefault();\n if (list.length > 0) this.activeIndex.set((this.activeIndex() + 1) % list.length);\n this.revealActive();\n break;\n case 'ArrowUp':\n event.preventDefault();\n if (list.length > 0) this.activeIndex.set((this.activeIndex() - 1 + list.length) % list.length);\n this.revealActive();\n break;\n case 'Home':\n event.preventDefault();\n this.activeIndex.set(0);\n this.revealActive();\n break;\n case 'End':\n event.preventDefault();\n this.activeIndex.set(Math.max(0, list.length - 1));\n this.revealActive();\n break;\n case 'Enter': {\n event.preventDefault();\n const item = list[this.activeIndex()];\n if (item) this.commit(item);\n break;\n }\n case 'Escape':\n event.preventDefault();\n this.close();\n break;\n default:\n break;\n }\n }\n\n protected onBackdropClick(): void {\n this.close();\n }\n\n protected onItemClick(item: WrCommandItem, event: MouseEvent): void {\n event.preventDefault();\n this.commit(item);\n }\n\n protected onItemHover(item: WrCommandItem): void {\n const i = this.filtered().indexOf(item);\n if (i >= 0) this.activeIndex.set(i);\n }\n\n /** Flat index of an item within the filtered list — for highlight checks. */\n protected indexOf(item: WrCommandItem): number {\n return this.filtered().indexOf(item);\n }\n\n // Public API\n\n /** Open the palette. */\n show(): void {\n this.open.set(true);\n }\n\n /** Close the palette. */\n close(): void {\n this.open.set(false);\n }\n\n // Internals\n\n /**\n * Keep the highlighted option on screen. The body is a fixed-height scroller and\n * the options are not focusable, so nothing moves it on the browser's behalf —\n * arrow keys walked the highlight straight off the bottom and out of sight.\n * Keyboard only: doing it on hover would fight the pointer that caused it.\n * `wr-select` and `wr-tree` keep the same promise through their own\n * `ensureVisible`; theirs is index maths because they are virtualized.\n */\n private revealActive(): void {\n if (!this.isBrowser) return;\n const id = this.activeOptionId();\n if (!id) return;\n // Ids are position-based and stable, so the element is findable straight away —\n // no need to wait for change detection to re-mark the active row.\n this.panelEl()?.nativeElement.querySelector<HTMLElement>(`#${id}`)?.scrollIntoView({ block: 'nearest' });\n }\n\n private commit(item: WrCommandItem): void {\n // Let the page go BEFORE the command runs when the pick also closes the\n // palette. A command commonly opens a dialog, and the CDK block strategy will\n // not engage while the page is already blocked — so the dialog would open\n // unblocked, and the palette's own release a moment later would leave the\n // page scrolling behind it.\n if (this.closeOnPick()) this.scrollBlock?.disable();\n item.action?.();\n this.picked.emit(item);\n if (this.closeOnPick()) this.close();\n }\n}\n","@if (open()) {\n <div class=\"wr-command-palette\" role=\"dialog\" aria-modal=\"true\" [attr.aria-label]=\"resolvedPaletteLabel()\">\n <!-- Backdrop captures clicks to close. Not focusable — keyboard users use\n Esc on the panel below. -->\n\n <div class=\"wr-command-palette__backdrop\" aria-hidden=\"true\" (click)=\"onBackdropClick()\"></div>\n\n <!-- Keydown is delegated from the search input; tabindex enables Esc when\n the input is unfocused. -->\n <div #panel class=\"wr-command-palette__panel\" tabindex=\"-1\" (keydown)=\"onKeydown($event)\">\n <div class=\"wr-command-palette__search\">\n <svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" aria-hidden=\"true\">\n <circle cx=\"7\" cy=\"7\" r=\"5\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.5\" />\n <path d=\"M11 11 L14 14\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" />\n </svg>\n <input\n #input\n type=\"text\"\n role=\"combobox\"\n autocomplete=\"off\"\n spellcheck=\"false\"\n aria-autocomplete=\"list\"\n [attr.aria-controls]=\"listboxId\"\n [attr.aria-expanded]=\"true\"\n [attr.aria-activedescendant]=\"activeOptionId() || null\"\n [placeholder]=\"resolvedPlaceholder()\"\n [value]=\"query()\"\n (input)=\"onQueryInput($event)\"\n />\n <kbd class=\"wr-command-palette__hint\">{{ resolvedEscHint() }}</kbd>\n </div>\n\n <!-- The empty row sits OUTSIDE the listbox below, and is a live region.\n A listbox may only own `option` and `group` children — the same rule\n the buckets already follow — so this row inside it was an\n `aria-required-children` critical for every query that matched\n nothing, and an empty listbox on its own is not. `role=\"status\"` also\n gets the message spoken while focus stays in the search input. -->\n @if (loading()) {\n <div class=\"wr-command-palette__empty\" role=\"status\">{{ resolvedLoading() }}</div>\n } @else if (filtered().length === 0 && !awaitingQuery()) {\n <div class=\"wr-command-palette__empty\" role=\"status\">{{ resolvedEmpty() }}</div>\n }\n\n <div class=\"wr-command-palette__body\" role=\"listbox\" [attr.id]=\"listboxId\">\n @for (bucket of buckets(); track bucket.title; let groupIndex = $index) {\n <!-- A listbox may only own `option` and `group` children, so a titled\n bucket is a labelled group and an untitled one leaves the tree with\n `role=\"none\"`, promoting its options to the listbox's own. -->\n <div\n class=\"wr-command-palette__group\"\n [attr.role]=\"bucket.title ? 'group' : 'none'\"\n [attr.aria-labelledby]=\"bucket.title ? groupTitleId(groupIndex) : null\"\n >\n @if (bucket.title) {\n <div class=\"wr-command-palette__group-title\" [attr.id]=\"groupTitleId(groupIndex)\">\n {{ bucket.title }}\n </div>\n }\n @for (item of bucket.items; track item.id) {\n <div\n class=\"wr-command-palette__option\"\n role=\"option\"\n [attr.id]=\"optionId(indexOf(item))\"\n [class.wr-command-palette__option--active]=\"indexOf(item) === activeIndex()\"\n [attr.aria-selected]=\"indexOf(item) === activeIndex()\"\n (mouseenter)=\"onItemHover(item)\"\n (mousedown)=\"onItemClick(item, $event)\"\n >\n @if (item.icon) {\n <wr-icon class=\"wr-command-palette__option-icon\" [name]=\"item.icon\" size=\"16\" />\n } @else {\n <span class=\"wr-command-palette__option-icon\" aria-hidden=\"true\"></span>\n }\n <div class=\"wr-command-palette__option-body\">\n <div class=\"wr-command-palette__option-label\">{{ item.label }}</div>\n @if (item.description) {\n <div class=\"wr-command-palette__option-description\">{{ item.description }}</div>\n }\n </div>\n @if (item.shortcut) {\n <kbd class=\"wr-command-palette__option-shortcut\">{{ item.shortcut }}</kbd>\n }\n </div>\n }\n </div>\n }\n </div>\n\n <!-- Footer slot. A real palette carries something under the list — a key\n legend, a result count, a provider's required attribution — and there\n was nowhere to put it. Projected rather than an input, because the\n content is markup (a link, a logo) rather than a string.\n\n Outside the listbox on purpose: a `role=\"listbox\"` may own only\n `option` and `group` children, the same rule the buckets and the empty\n row already follow. -->\n <div class=\"wr-command-palette__footer\">\n <ng-content select=\"[wrCommandPaletteFooter]\" />\n </div>\n </div>\n </div>\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AA4CA,IAAI,aAAa;AAEjB,SAAS,UAAU,OAA+B;CAChD,MAAM,sBAAM,IAAI,IAAG;CACnB,KAAK,MAAM,QAAQ,OAAO;EACxB,MAAM,MAAM,KAAK,SAAS;EAC1B,MAAM,SAAS,IAAI,IAAI,GAAG;EAC1B,IAAI,QAAQ,OAAO,KAAK,IAAI;OACvB,IAAI,IAAI,KAAK,CAAC,IAAI,CAAC;CAC1B;CACA,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