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-animations-typewriter.mjs","names":["DOCUMENT"],"sources":["../../../projects/lib/animations/typewriter/typewriter.ts","../../../projects/lib/animations/typewriter/typewriter.html","../../../projects/lib/animations/typewriter/public-api.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 { DOCUMENT, isPlatformBrowser } from '@angular/common';\nimport {\n Component,\n DestroyRef,\n ElementRef,\n PLATFORM_ID,\n ViewEncapsulation,\n afterNextRender,\n booleanAttribute,\n computed,\n effect,\n inject,\n input,\n signal,\n untracked,\n} from '@angular/core';\n\nimport { VIEW_THRESHOLD, graphemes } from 'ngwr/animations/core';\nimport { WrPlatform } from 'ngwr/platform';\nimport { numAttr, wrCheckStyles } from 'ngwr/utils';\n\nimport type { WrTypewriterPhase, WrTypewriterTrigger } from './types';\n\n/** A character takes this long to type, in ms, before the rhythm's own variation. */\nconst TYPEWRITER_TYPE_MIN = 35;\nconst TYPEWRITER_TYPE_MAX = 55;\n\n/** The extra beat after a space and after a punctuation mark, in ms: a hand finding the next word, the next thought. */\nconst TYPEWRITER_SPACE_BEAT = 50;\nconst TYPEWRITER_PUNCT_BEAT = 180;\n\n/** Deleting runs about twice as fast as typing, in ms per character. */\nconst TYPEWRITER_DELETE_MIN = 18;\nconst TYPEWRITER_DELETE_MAX = 28;\n\n/** How long a finished line stands before it is deleted when `hold` is not set, in ms. */\nconst TYPEWRITER_HOLD = 1800;\n\n/** The pause between a line deleted to nothing and the first character of the next, in ms. */\nconst TYPEWRITER_BREATH = 280;\n\n/** One blink of the caret, in ms, and how many it gives after the last line, or on a line that was already in view. */\nconst TYPEWRITER_BLINK = 1000;\nconst TYPEWRITER_END_BLINKS = 3;\nconst TYPEWRITER_BOOT_BLINKS = 2;\n\n/** How long the caret takes to fade after its last blink, in ms. */\nconst TYPEWRITER_FADE = 400;\n\n/** How far below the viewport the host is hidden and armed: a quarter of the viewport's height. */\nconst TYPEWRITER_ARM_MARGIN = '0px 0px 25% 0px';\n\nconst PUNCTUATION = /[.,;:!?…]/;\n\n/* eslint-disable no-bitwise -- the hash and the mixer are defined in 32-bit integer arithmetic */\n/** FNV-1a over the UTF-16 units: one seed per text, the same on the server, in a spec and in every browser. */\nfunction seed(text: string): number {\n let hash = 0x811c9dc5;\n for (let i = 0; i < text.length; i++) {\n hash ^= text.charCodeAt(i);\n hash = Math.imul(hash, 0x01000193);\n }\n return hash >>> 0;\n}\n\n/** A number in [0, 1) for the `i`th character of a text with `seed`: the same every time, with no state between calls. */\nfunction unit(seed: number, i: number): number {\n let hash = (seed ^ Math.imul(i + 1, 0x9e3779b1)) >>> 0;\n hash = Math.imul(hash ^ (hash >>> 16), 0x21f0aaad);\n hash = Math.imul(hash ^ (hash >>> 15), 0x735a2d97);\n hash ^= hash >>> 15;\n return (hash >>> 0) / 0x100000000;\n}\n/* eslint-enable no-bitwise */\n\n/**\n * The wait before each character of `line` appears, in ms: between\n * {@link TYPEWRITER_TYPE_MIN} and {@link TYPEWRITER_TYPE_MAX}, varied per\n * character, plus a beat after a space or a punctuation mark. Seeded from the\n * text, so the same line always types to the same rhythm.\n */\nfunction typewriterTyping(line: string): number[] {\n const chars = graphemes(line);\n const base = seed(line);\n return chars.map((_, i) => {\n let ms = TYPEWRITER_TYPE_MIN + (TYPEWRITER_TYPE_MAX - TYPEWRITER_TYPE_MIN) * unit(base, i);\n const previous = chars[i - 1];\n if (previous !== undefined) {\n if (PUNCTUATION.test(previous)) ms += TYPEWRITER_PUNCT_BEAT;\n else if (/^\\s+$/.test(previous)) ms += TYPEWRITER_SPACE_BEAT;\n }\n return Math.round(ms);\n });\n}\n\n/** The wait before each character of `line` goes, in ms, last character first: about twice the typing pace, no beats. */\nfunction typewriterDeleting(line: string): number[] {\n const chars = graphemes(line);\n const base = seed(line);\n return chars.map((_, i) =>\n Math.round(TYPEWRITER_DELETE_MIN + (TYPEWRITER_DELETE_MAX - TYPEWRITER_DELETE_MIN) * unit(base, chars.length + i))\n );\n}\n\n/**\n * A line typed character by character behind a caret, then held, deleted and\n * followed by the next, or typed once and left standing.\n *\n * Nothing moves around it while it types. The host is an inline grid with\n * every line in the same cell: the lines not on show are laid out but\n * invisible, and the line on show is laid out whole, with its untyped tail\n * hidden rather than absent. The box is as wide and as tall as the longest\n * line wraps to at the current width from the first paint, so what is below\n * never moves and a centred or wrapped line never jitters. The caret is a\n * border on the typed run's trailing edge, so it stands after the last typed\n * character and wraps with it.\n *\n * The server renders the first line whole, readable without script. In a\n * browser the component hides the untyped text before it can be seen: one\n * observer with a margin a quarter of the viewport below it arms the host\n * while it is still under the fold, and another starts the typing once most of\n * the host is in view. A host that is already in view when it boots, above the\n * fold or on a reload mid-page, is never erased: it stands whole, the caret\n * blinks twice and goes. `trigger=\"load\"` types regardless, for a hero.\n *\n * The rhythm is 35 to 55 ms per character, varied per character from a hash\n * of the text, so the same line always types the same way and a spec can sum\n * the waits; a space and a punctuation mark add a beat, and deleting runs\n * about twice as fast. The caret is solid while a character is on its way,\n * blinks while a line holds, and after the last line blinks a few times and\n * fades. The typing pauses when the host leaves the viewport or the document\n * is hidden, and resumes where it was.\n *\n * The box is `aria-hidden` and a visually-hidden copy beside it carries every\n * line once, so a screen reader hears the text, never a letter at a time; the\n * copy is out of the selection, so a copy of the line gives the typed text.\n * Under `prefers-reduced-motion: reduce`, on the server and without\n * `IntersectionObserver` the first line stands whole with no caret: it is what\n * the server sent, so nothing swaps at hydration. Write the first line as the\n * one that stands alone.\n */\n@Component({\n selector: 'wr-typewriter',\n templateUrl: './typewriter.html',\n encapsulation: ViewEncapsulation.None,\n host: {\n class: 'wr-typewriter',\n '[class.wr-typewriter--caret]': 'phase() !== \"idle\"',\n '[class.wr-typewriter--busy]': 'phase() === \"typing\" || phase() === \"deleting\"',\n '[class.wr-typewriter--out]': 'phase() === \"fading\"',\n },\n})\nexport class WrTypewriter {\n /** The lines, in the order they type. The first is what the server and a still page show. */\n readonly lines = input.required<readonly string[]>();\n\n /** Cycle through the lines instead of stopping on the last. @default false */\n readonly loop = input(false, { transform: booleanAttribute });\n\n /** How long a finished line stands before it is deleted for the next, in ms. @default 1800 */\n readonly hold = input(TYPEWRITER_HOLD, { transform: numAttr(TYPEWRITER_HOLD) });\n\n /** Pause before the first character, in ms, from the moment the host is in view: room for the eye to land above it. @default 0 */\n readonly delay = input(0, { transform: numAttr(0) });\n\n /**\n * `view` types once most of the host is in view and leaves a host that was\n * already in view at boot whole. `load` types at once, wherever the host is.\n * @default 'view'\n */\n readonly trigger = input<WrTypewriterTrigger>('view');\n\n protected readonly phase = signal<WrTypewriterPhase>('idle');\n\n /** Which line is on show. */\n protected readonly index = signal(0);\n\n /** How many characters of the line are typed, or `null` for the whole line: at rest and on the server. */\n private readonly count = signal<number | null>(null);\n\n protected readonly line = computed(() => this.lines()[this.index()] ?? '');\n\n private readonly chars = computed(() => graphemes(this.line()));\n\n private readonly shown = computed(() => Math.min(this.count() ?? Infinity, this.chars().length));\n\n protected readonly typed = computed(() => this.chars().slice(0, this.shown()).join(''));\n\n protected readonly rest = computed(() => this.chars().slice(this.shown()).join(''));\n\n /** Every line once, for a screen reader. */\n protected readonly speech = computed(() => this.lines().join(' '));\n\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\n private readonly platform = inject(WrPlatform);\n private readonly doc = inject(DOCUMENT);\n\n private readonly intersecting = signal(false);\n /** `afterNextRender` ran in a browser that can play. */\n private readonly ready = signal(false);\n\n /** The clock runs: in view, page visible, something still to do. */\n private readonly active = computed(\n () => this.ready() && this.phase() !== 'idle' && this.intersecting() && this.platform.pageVisible()\n );\n\n /** Arms the host while it is still under the fold; gone once it has decided. */\n private armer: IntersectionObserver | null = null;\n /** Starts and pauses the typing on most of the host being in view. */\n private viewer: IntersectionObserver | null = null;\n private timer: ReturnType<typeof setTimeout> | null = null;\n /** How many blinks the caret gives in `ending`. */\n private blinks = TYPEWRITER_END_BLINKS;\n /** `delay` is spent once, before the first line. */\n private delayed = false;\n\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('animations/typewriter');\n if (!isPlatformBrowser(inject(PLATFORM_ID))) return;\n\n afterNextRender(() => {\n if (this.platform.prefersReducedMotion() || typeof IntersectionObserver === 'undefined') return;\n const host = this.host.nativeElement;\n // The armer first: its first notification decides before the viewer's reports where the host is.\n if (this.trigger() === 'load') {\n this.arm();\n } else {\n this.armer = new IntersectionObserver(entries => this.decide(entries[entries.length - 1]), {\n rootMargin: TYPEWRITER_ARM_MARGIN,\n threshold: 0,\n });\n this.armer.observe(host);\n }\n this.viewer = new IntersectionObserver(\n entries => this.intersecting.set(entries[entries.length - 1]?.isIntersecting ?? false),\n { threshold: VIEW_THRESHOLD }\n );\n this.viewer.observe(host);\n this.ready.set(true);\n });\n\n // One place decides whether the clock runs. Reduced motion at any moment\n // puts the line on show whole and takes the caret away.\n effect(() => {\n if (this.platform.prefersReducedMotion()) {\n untracked(() => this.still());\n return;\n }\n const on = this.active();\n untracked(() => (on ? this.run() : this.clear()));\n });\n\n inject(DestroyRef).onDestroy(() => {\n this.armer?.disconnect();\n this.armer = null;\n this.viewer?.disconnect();\n this.viewer = null;\n this.clear();\n });\n }\n\n /**\n * The host entered the band under the viewport, or was in it at boot. In\n * the viewport itself, any part of it, it stands whole: erasing it now would\n * be seen. Under the viewport, it is armed while nobody is looking.\n */\n private decide(entry: IntersectionObserverEntry | undefined): void {\n if (!entry?.isIntersecting) return;\n this.armer?.disconnect();\n this.armer = null;\n const rect = entry.boundingClientRect;\n const height = this.doc.defaultView?.innerHeight ?? 0;\n if (rect.top < height && rect.bottom > 0) this.complete();\n else this.arm();\n }\n\n /** Hide the untyped text: the line types from nothing once in view. */\n private arm(): void {\n this.count.set(0);\n this.phase.set('typing');\n }\n\n /** Leave the line whole; the caret blinks twice and goes. */\n private complete(): void {\n this.blinks = TYPEWRITER_BOOT_BLINKS;\n this.phase.set('ending');\n }\n\n /** At rest: the line on show whole, no caret, no clock. */\n private still(): void {\n this.clear();\n this.count.set(null);\n this.phase.set('idle');\n }\n\n /** Start the wait for the next step, unless it already counts. The chain carries itself while the clock runs. */\n private run(): void {\n if (this.timer !== null) return;\n const wait = this.wait();\n this.timer = setTimeout(() => {\n this.timer = null;\n this.step();\n if (this.active()) this.run();\n }, wait);\n }\n\n private clear(): void {\n if (this.timer === null) return;\n clearTimeout(this.timer);\n this.timer = null;\n }\n\n /** How long until the next step, from the phase and the character it waits for. */\n private wait(): number {\n const count = this.count() ?? this.chars().length;\n switch (this.phase()) {\n case 'typing':\n if (count > 0) return typewriterTyping(this.line())[count];\n if (this.delayed) return TYPEWRITER_BREATH;\n this.delayed = true;\n return Math.max(0, this.delay());\n case 'deleting':\n return typewriterDeleting(this.line())[count - 1];\n case 'holding':\n return Math.max(0, this.hold());\n case 'ending':\n return this.blinks * TYPEWRITER_BLINK;\n case 'fading':\n return TYPEWRITER_FADE;\n default:\n return 0;\n }\n }\n\n private step(): void {\n const count = this.count() ?? this.chars().length;\n const last = this.index() >= this.lines().length - 1;\n switch (this.phase()) {\n case 'typing':\n this.count.set(count + 1);\n if (count + 1 < this.chars().length) return;\n if (last && !this.loop()) {\n this.blinks = TYPEWRITER_END_BLINKS;\n this.phase.set('ending');\n } else {\n this.phase.set('holding');\n }\n return;\n case 'holding':\n this.phase.set('deleting');\n return;\n case 'deleting':\n this.count.set(count - 1);\n if (count - 1 > 0) return;\n this.index.set(last ? 0 : this.index() + 1);\n this.phase.set('typing');\n return;\n case 'ending':\n this.phase.set('fading');\n return;\n case 'fading':\n this.still();\n return;\n default:\n return;\n }\n }\n}\n\nexport {\n TYPEWRITER_ARM_MARGIN,\n TYPEWRITER_BLINK,\n TYPEWRITER_BOOT_BLINKS,\n TYPEWRITER_BREATH,\n TYPEWRITER_DELETE_MAX,\n TYPEWRITER_DELETE_MIN,\n TYPEWRITER_END_BLINKS,\n TYPEWRITER_FADE,\n TYPEWRITER_HOLD,\n TYPEWRITER_PUNCT_BEAT,\n TYPEWRITER_SPACE_BEAT,\n TYPEWRITER_TYPE_MAX,\n TYPEWRITER_TYPE_MIN,\n typewriterDeleting,\n typewriterTyping,\n};\n","<span class=\"wr-typewriter__sr\">{{ speech() }}</span>\n<span class=\"wr-typewriter__box\" aria-hidden=\"true\">\n @for (other of lines(); track $index) {\n @if ($index !== index()) {\n <span class=\"wr-typewriter__ghost\">{{ other }}</span>\n }\n }\n <span class=\"wr-typewriter__line\"\n ><span class=\"wr-typewriter__typed\">{{ typed() }}</span\n ><span class=\"wr-typewriter__rest\">{{ rest() }}</span></span\n >\n</span>\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\nexport { WrTypewriter } from './typewriter';\nexport type { WrTypewriterPhase, WrTypewriterTrigger } from './types';\n"],"mappings":";;;;;;;;;;;;AA2CA,MAAM,kBAAkB;AAMxB,MAAM,mBAAmB;AAQzB,MAAM,wBAAwB;AAE9B,MAAM,cAAc;AAIpB,SAAS,KAAK,MAAY;CACxB,IAAI,OAAO;CACX,KAAK,IAAI,IAAI,GAAG,IAAI,KAAK,QAAQ,KAAK;EACpC,QAAQ,KAAK,WAAW,CAAC;EACzB,OAAO,KAAK,KAAK,MAAM,QAAU;CACnC;CACA,OAAO,SAAS;AAClB;AAGA,SAAS,KAAK,MAAc,GAAS;CACnC,IAAI,QAAQ,OAAO,KAAK,KAAK,IAAI,GAAG,UAAU,OAAO;CACrD,OAAO,KAAK,KAAK,OAAQ,SAAS,IAAK,SAAU;CACjD,OAAO,KAAK,KAAK,OAAQ,SAAS,IAAK,UAAU;CACjD,QAAQ,SAAS;CACjB,QAAQ,SAAS,KAAK;AACxB;AASA,SAAS,iBAAiB,MAAY;CACpC,MAAM,QAAQ,UAAU,IAAI;CAC5B,MAAM,OAAO,KAAK,IAAI;CACtB,OAAO,MAAM,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A,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;EAAA;EAAA,MAAA;GAAA,YAAA;IAAA,8BAAA;IAAA,6BAAA;IAAA,4BAAA;GAAA;GAAA,gBAAA;EAAA;EAAA,UAAA;EAAA,UC/JzB;EAYA,eAAA,GAAA,kBAAA;CAAA,CAAA;;ADmJa,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAY,YAAA,CAAA;EAXxB,MAAA;EACW,MAAA,CAAA;GAAA,UAAA;GAAe,eAEV,kBAAkB;GAAI,MAC/B;IACJ,OAAO;IACP,gCAAgC;IAChC,+BAA+B;IAC/B,8BAA8B;GAC/B;GAAA,UAAA;EAAA,CAAA"}
1
+ {"version":3,"file":"ngwr-animations-typewriter.mjs","names":["DOCUMENT"],"sources":["../../../projects/lib/animations/typewriter/typewriter.ts","../../../projects/lib/animations/typewriter/typewriter.html","../../../projects/lib/animations/typewriter/public-api.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 { DOCUMENT, isPlatformBrowser } from '@angular/common';\nimport {\n Component,\n DestroyRef,\n ElementRef,\n PLATFORM_ID,\n ViewEncapsulation,\n afterNextRender,\n booleanAttribute,\n computed,\n effect,\n inject,\n input,\n signal,\n untracked,\n} from '@angular/core';\n\nimport { WrPlatform } from 'ngwr/platform';\nimport { wrNumAttr, wrCheckStyles } from 'ngwr/utils';\n\nimport { VIEW_THRESHOLD, graphemes } from '../internal';\n\nimport type { WrTypewriterPhase, WrTypewriterTrigger } from './types';\n\n/** A character takes this long to type, in ms, before the rhythm's own variation. */\nconst TYPEWRITER_TYPE_MIN = 35;\nconst TYPEWRITER_TYPE_MAX = 55;\n\n/** The extra beat after a space and after a punctuation mark, in ms: a hand finding the next word, the next thought. */\nconst TYPEWRITER_SPACE_BEAT = 50;\nconst TYPEWRITER_PUNCT_BEAT = 180;\n\n/** Deleting runs about twice as fast as typing, in ms per character. */\nconst TYPEWRITER_DELETE_MIN = 18;\nconst TYPEWRITER_DELETE_MAX = 28;\n\n/** How long a finished line stands before it is deleted when `hold` is not set, in ms. */\nconst TYPEWRITER_HOLD = 1800;\n\n/** The pause between a line deleted to nothing and the first character of the next, in ms. */\nconst TYPEWRITER_BREATH = 280;\n\n/** One blink of the caret, in ms, and how many it gives after the last line, or on a line that was already in view. */\nconst TYPEWRITER_BLINK = 1000;\nconst TYPEWRITER_END_BLINKS = 3;\nconst TYPEWRITER_BOOT_BLINKS = 2;\n\n/** How long the caret takes to fade after its last blink, in ms. */\nconst TYPEWRITER_FADE = 400;\n\n/** How far below the viewport the host is hidden and armed: a quarter of the viewport's height. */\nconst TYPEWRITER_ARM_MARGIN = '0px 0px 25% 0px';\n\nconst PUNCTUATION = /[.,;:!?…]/;\n\n/* eslint-disable no-bitwise -- the hash and the mixer are defined in 32-bit integer arithmetic */\n/** FNV-1a over the UTF-16 units: one seed per text, the same on the server, in a spec and in every browser. */\nfunction seed(text: string): number {\n let hash = 0x811c9dc5;\n for (let i = 0; i < text.length; i++) {\n hash ^= text.charCodeAt(i);\n hash = Math.imul(hash, 0x01000193);\n }\n return hash >>> 0;\n}\n\n/** A number in [0, 1) for the `i`th character of a text with `seed`: the same every time, with no state between calls. */\nfunction unit(seed: number, i: number): number {\n let hash = (seed ^ Math.imul(i + 1, 0x9e3779b1)) >>> 0;\n hash = Math.imul(hash ^ (hash >>> 16), 0x21f0aaad);\n hash = Math.imul(hash ^ (hash >>> 15), 0x735a2d97);\n hash ^= hash >>> 15;\n return (hash >>> 0) / 0x100000000;\n}\n/* eslint-enable no-bitwise */\n\n/**\n * The wait before each character of `line` appears, in ms: between\n * {@link TYPEWRITER_TYPE_MIN} and {@link TYPEWRITER_TYPE_MAX}, varied per\n * character, plus a beat after a space or a punctuation mark. Seeded from the\n * text, so the same line always types to the same rhythm.\n */\nfunction typewriterTyping(line: string): number[] {\n const chars = graphemes(line);\n const base = seed(line);\n return chars.map((_, i) => {\n let ms = TYPEWRITER_TYPE_MIN + (TYPEWRITER_TYPE_MAX - TYPEWRITER_TYPE_MIN) * unit(base, i);\n const previous = chars[i - 1];\n if (previous !== undefined) {\n if (PUNCTUATION.test(previous)) ms += TYPEWRITER_PUNCT_BEAT;\n else if (/^\\s+$/.test(previous)) ms += TYPEWRITER_SPACE_BEAT;\n }\n return Math.round(ms);\n });\n}\n\n/** The wait before each character of `line` goes, in ms, last character first: about twice the typing pace, no beats. */\nfunction typewriterDeleting(line: string): number[] {\n const chars = graphemes(line);\n const base = seed(line);\n return chars.map((_, i) =>\n Math.round(TYPEWRITER_DELETE_MIN + (TYPEWRITER_DELETE_MAX - TYPEWRITER_DELETE_MIN) * unit(base, chars.length + i))\n );\n}\n\n/**\n * A line typed character by character behind a caret, then held, deleted and\n * followed by the next, or typed once and left standing.\n *\n * Nothing moves around it while it types. The host is an inline grid with\n * every line in the same cell: the lines not on show are laid out but\n * invisible, and the line on show is laid out whole, with its untyped tail\n * hidden rather than absent. The box is as wide and as tall as the longest\n * line wraps to at the current width from the first paint, so what is below\n * never moves and a centred or wrapped line never jitters. The caret is a\n * border on the typed run's trailing edge, so it stands after the last typed\n * character and wraps with it.\n *\n * The server renders the first line whole, readable without script. In a\n * browser the component hides the untyped text before it can be seen: one\n * observer with a margin a quarter of the viewport below it arms the host\n * while it is still under the fold, and another starts the typing once most of\n * the host is in view. A host that is already in view when it boots, above the\n * fold or on a reload mid-page, is never erased: it stands whole, the caret\n * blinks twice and goes. `trigger=\"load\"` types regardless, for a hero.\n *\n * The rhythm is 35 to 55 ms per character, varied per character from a hash\n * of the text, so the same line always types the same way and a spec can sum\n * the waits; a space and a punctuation mark add a beat, and deleting runs\n * about twice as fast. The caret is solid while a character is on its way,\n * blinks while a line holds, and after the last line blinks a few times and\n * fades. The typing pauses when the host leaves the viewport or the document\n * is hidden, and resumes where it was.\n *\n * The box is `aria-hidden` and a visually-hidden copy beside it carries every\n * line once, so a screen reader hears the text, never a letter at a time; the\n * copy is out of the selection, so a copy of the line gives the typed text.\n * Under `prefers-reduced-motion: reduce`, on the server and without\n * `IntersectionObserver` the first line stands whole with no caret: it is what\n * the server sent, so nothing swaps at hydration. Write the first line as the\n * one that stands alone.\n */\n@Component({\n selector: 'wr-typewriter',\n templateUrl: './typewriter.html',\n encapsulation: ViewEncapsulation.None,\n host: {\n class: 'wr-typewriter',\n '[class.wr-typewriter--caret]': 'phase() !== \"idle\"',\n '[class.wr-typewriter--busy]': 'phase() === \"typing\" || phase() === \"deleting\"',\n '[class.wr-typewriter--out]': 'phase() === \"fading\"',\n },\n})\nexport class WrTypewriter {\n /** The lines, in the order they type. The first is what the server and a still page show. */\n readonly lines = input.required<readonly string[]>();\n\n /** Cycle through the lines instead of stopping on the last. @default false */\n readonly loop = input(false, { transform: booleanAttribute });\n\n /** How long a finished line stands before it is deleted for the next, in ms. @default 1800 */\n readonly hold = input(TYPEWRITER_HOLD, { transform: wrNumAttr(TYPEWRITER_HOLD) });\n\n /** Pause before the first character, in ms, from the moment the host is in view: room for the eye to land above it. @default 0 */\n readonly delay = input(0, { transform: wrNumAttr(0) });\n\n /**\n * `view` types once most of the host is in view and leaves a host that was\n * already in view at boot whole. `load` types at once, wherever the host is.\n * @default 'view'\n */\n readonly trigger = input<WrTypewriterTrigger>('view');\n\n protected readonly phase = signal<WrTypewriterPhase>('idle');\n\n /** Which line is on show. */\n protected readonly index = signal(0);\n\n /** How many characters of the line are typed, or `null` for the whole line: at rest and on the server. */\n private readonly count = signal<number | null>(null);\n\n protected readonly line = computed(() => this.lines()[this.index()] ?? '');\n\n private readonly chars = computed(() => graphemes(this.line()));\n\n private readonly shown = computed(() => Math.min(this.count() ?? Infinity, this.chars().length));\n\n protected readonly typed = computed(() => this.chars().slice(0, this.shown()).join(''));\n\n protected readonly rest = computed(() => this.chars().slice(this.shown()).join(''));\n\n /** Every line once, for a screen reader. */\n protected readonly speech = computed(() => this.lines().join(' '));\n\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\n private readonly platform = inject(WrPlatform);\n private readonly doc = inject(DOCUMENT);\n\n private readonly intersecting = signal(false);\n /** `afterNextRender` ran in a browser that can play. */\n private readonly ready = signal(false);\n\n /** The clock runs: in view, page visible, something still to do. */\n private readonly active = computed(\n () => this.ready() && this.phase() !== 'idle' && this.intersecting() && this.platform.pageVisible()\n );\n\n /** Arms the host while it is still under the fold; gone once it has decided. */\n private armer: IntersectionObserver | null = null;\n /** Starts and pauses the typing on most of the host being in view. */\n private viewer: IntersectionObserver | null = null;\n private timer: ReturnType<typeof setTimeout> | null = null;\n /** How many blinks the caret gives in `ending`. */\n private blinks = TYPEWRITER_END_BLINKS;\n /** `delay` is spent once, before the first line. */\n private delayed = false;\n\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('animations/typewriter');\n if (!isPlatformBrowser(inject(PLATFORM_ID))) return;\n\n afterNextRender(() => {\n if (this.platform.prefersReducedMotion() || typeof IntersectionObserver === 'undefined') return;\n const host = this.host.nativeElement;\n // The armer first: its first notification decides before the viewer's reports where the host is.\n if (this.trigger() === 'load') {\n this.arm();\n } else {\n this.armer = new IntersectionObserver(entries => this.decide(entries[entries.length - 1]), {\n rootMargin: TYPEWRITER_ARM_MARGIN,\n threshold: 0,\n });\n this.armer.observe(host);\n }\n this.viewer = new IntersectionObserver(\n entries => this.intersecting.set(entries[entries.length - 1]?.isIntersecting ?? false),\n { threshold: VIEW_THRESHOLD }\n );\n this.viewer.observe(host);\n this.ready.set(true);\n });\n\n // One place decides whether the clock runs. Reduced motion at any moment\n // puts the line on show whole and takes the caret away.\n effect(() => {\n if (this.platform.prefersReducedMotion()) {\n untracked(() => this.still());\n return;\n }\n const on = this.active();\n untracked(() => (on ? this.run() : this.clear()));\n });\n\n inject(DestroyRef).onDestroy(() => {\n this.armer?.disconnect();\n this.armer = null;\n this.viewer?.disconnect();\n this.viewer = null;\n this.clear();\n });\n }\n\n /**\n * The host entered the band under the viewport, or was in it at boot. In\n * the viewport itself, any part of it, it stands whole: erasing it now would\n * be seen. Under the viewport, it is armed while nobody is looking.\n */\n private decide(entry: IntersectionObserverEntry | undefined): void {\n if (!entry?.isIntersecting) return;\n this.armer?.disconnect();\n this.armer = null;\n const rect = entry.boundingClientRect;\n const height = this.doc.defaultView?.innerHeight ?? 0;\n if (rect.top < height && rect.bottom > 0) this.complete();\n else this.arm();\n }\n\n /** Hide the untyped text: the line types from nothing once in view. */\n private arm(): void {\n this.count.set(0);\n this.phase.set('typing');\n }\n\n /** Leave the line whole; the caret blinks twice and goes. */\n private complete(): void {\n this.blinks = TYPEWRITER_BOOT_BLINKS;\n this.phase.set('ending');\n }\n\n /** At rest: the line on show whole, no caret, no clock. */\n private still(): void {\n this.clear();\n this.count.set(null);\n this.phase.set('idle');\n }\n\n /** Start the wait for the next step, unless it already counts. The chain carries itself while the clock runs. */\n private run(): void {\n if (this.timer !== null) return;\n const wait = this.wait();\n this.timer = setTimeout(() => {\n this.timer = null;\n this.step();\n if (this.active()) this.run();\n }, wait);\n }\n\n private clear(): void {\n if (this.timer === null) return;\n clearTimeout(this.timer);\n this.timer = null;\n }\n\n /** How long until the next step, from the phase and the character it waits for. */\n private wait(): number {\n const count = this.count() ?? this.chars().length;\n switch (this.phase()) {\n case 'typing':\n if (count > 0) return typewriterTyping(this.line())[count];\n if (this.delayed) return TYPEWRITER_BREATH;\n this.delayed = true;\n return Math.max(0, this.delay());\n case 'deleting':\n return typewriterDeleting(this.line())[count - 1];\n case 'holding':\n return Math.max(0, this.hold());\n case 'ending':\n return this.blinks * TYPEWRITER_BLINK;\n case 'fading':\n return TYPEWRITER_FADE;\n default:\n return 0;\n }\n }\n\n private step(): void {\n const count = this.count() ?? this.chars().length;\n const last = this.index() >= this.lines().length - 1;\n switch (this.phase()) {\n case 'typing':\n this.count.set(count + 1);\n if (count + 1 < this.chars().length) return;\n if (last && !this.loop()) {\n this.blinks = TYPEWRITER_END_BLINKS;\n this.phase.set('ending');\n } else {\n this.phase.set('holding');\n }\n return;\n case 'holding':\n this.phase.set('deleting');\n return;\n case 'deleting':\n this.count.set(count - 1);\n if (count - 1 > 0) return;\n this.index.set(last ? 0 : this.index() + 1);\n this.phase.set('typing');\n return;\n case 'ending':\n this.phase.set('fading');\n return;\n case 'fading':\n this.still();\n return;\n default:\n return;\n }\n }\n}\n\nexport {\n TYPEWRITER_ARM_MARGIN,\n TYPEWRITER_BLINK,\n TYPEWRITER_BOOT_BLINKS,\n TYPEWRITER_BREATH,\n TYPEWRITER_DELETE_MAX,\n TYPEWRITER_DELETE_MIN,\n TYPEWRITER_END_BLINKS,\n TYPEWRITER_FADE,\n TYPEWRITER_HOLD,\n TYPEWRITER_PUNCT_BEAT,\n TYPEWRITER_SPACE_BEAT,\n TYPEWRITER_TYPE_MAX,\n TYPEWRITER_TYPE_MIN,\n typewriterDeleting,\n typewriterTyping,\n};\n","<span class=\"wr-typewriter__sr\">{{ speech() }}</span>\n<span class=\"wr-typewriter__box\" aria-hidden=\"true\">\n @for (other of lines(); track $index) {\n @if ($index !== index()) {\n <span class=\"wr-typewriter__ghost\">{{ other }}</span>\n }\n }\n <span class=\"wr-typewriter__line\"\n ><span class=\"wr-typewriter__typed\">{{ typed() }}</span\n ><span class=\"wr-typewriter__rest\">{{ rest() }}</span></span\n >\n</span>\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\nexport { WrTypewriter } from './typewriter';\nexport type { WrTypewriterPhase, WrTypewriterTrigger } from './types';\n"],"mappings":";;;;;;;;;;;;AA4CA,MAAM,kBAAkB;AAMxB,MAAM,mBAAmB;AAQzB,MAAM,wBAAwB;AAE9B,MAAM,cAAc;AAIpB,SAAS,KAAK,MAAY;CACxB,IAAI,OAAO;CACX,KAAK,IAAI,IAAI,GAAG,IAAI,KAAK,QAAQ,KAAK;EACpC,QAAQ,KAA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EAAA,YAAA;EAAA,SAAA;EAAA,MAAA;EAAY,cAAA;EAAA,UAAA;EAAA,QAAA;GAAA,OAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;GAAA,MAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;GAAA,MAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;GAAA,OAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;GAAA,SAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;EAAA;EAAA,MAAA;GAAA,YAAA;IAAA,8BAAA;IAAA,6BAAA;IAAA,4BAAA;GAAA;GAAA,gBAAA;EAAA;EAAA,UAAA;EAAA,UChKzB;EAYA,eAAA,GAAA,kBAAA;CAAA,CAAA;;ADoJa,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAY,YAAA,CAAA;EAXxB,MAAA;EACW,MAAA,CAAA;GAAA,UAAA;GAAe,eAEV,kBAAkB;GAAI,MAC/B;IACJ,OAAO;IACP,gCAAgC;IAChC,+BAA+B;IAC/B,8BAA8B;GAC/B;GAAA,UAAA;EAAA,CAAA"}
@@ -1,7 +1,7 @@
1
1
  import * as i0 from "@angular/core";
2
2
  import { Component, LOCALE_ID, ViewEncapsulation, afterNextRender, computed, effect, inject, input, signal, untracked, viewChild } from "@angular/core";
3
3
  import { coerceBooleanProperty } from "@angular/cdk/coercion";
4
- import { resolveCssSize, wrCheckStyles, wrInitials } from "ngwr/utils";
4
+ import { wrCheckStyles, wrInitials, wrResolveCssSize } from "ngwr/utils";
5
5
  import { useI18nText } from "ngwr/i18n";
6
6
  import { WrSpinner } from "ngwr/spinner";
7
7
  /**
@@ -74,8 +74,8 @@ var WrAvatar = class WrAvatar {
74
74
  if (src !== null) img.setAttribute("src", src);
75
75
  }
76
76
  resolved = computed(() => {
77
- const result = resolveCssSize(this.size(), { defaultValue: DEFAULT_SIZE });
78
- if (result.pxValue == null || result.pxValue <= 0) return resolveCssSize(DEFAULT_SIZE, { defaultValue: DEFAULT_SIZE });
77
+ const result = wrResolveCssSize(this.size(), { defaultValue: DEFAULT_SIZE });
78
+ if (result.pxValue == null || result.pxValue <= 0) return wrResolveCssSize(DEFAULT_SIZE, { defaultValue: DEFAULT_SIZE });
79
79
  return result;
80
80
  }, ...ngDevMode ? [{ debugName: "resolved" }] : /* istanbul ignore next */ []);
81
81
  fallbackHidden = computed(() => !!this.url() && !this.failed() && (this.decorative() || !!this.alt()?.trim() || !!this.name()?.trim()), ...ngDevMode ? [{ debugName: "fallbackHidden" }] : /* istanbul ignore next */ []);
@@ -1 +1 @@
1
- {"version":3,"file":"ngwr-avatar.mjs","names":[],"sources":["../../../projects/lib/avatar/avatar.ts","../../../projects/lib/avatar/avatar.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 { coerceBooleanProperty } from '@angular/cdk/coercion';\nimport {\n Component,\n type ElementRef,\n LOCALE_ID,\n ViewEncapsulation,\n afterNextRender,\n computed,\n effect,\n inject,\n input,\n signal,\n untracked,\n viewChild,\n} from '@angular/core';\n\nimport { useI18nText } from 'ngwr/i18n';\nimport { WrSpinner } from 'ngwr/spinner';\nimport { resolveCssSize, type ResolvedCssSize, wrCheckStyles, wrInitials } from 'ngwr/utils';\n\nimport type { WrAvatarShape, WrAvatarSize } from './types';\n\nconst DEFAULT_SIZE: WrAvatarSize = '6rem';\n\n/**\n * The tints `tint` picks from, each a `-soft` fill under its `-ink` text. Index\n * order is part of the contract: the same name lands on the same tint on every\n * render, server or client, and a reorder would re-colour every avatar.\n */\nconst TINTS = ['primary', 'success', 'warning', 'danger', 'info'] as const;\n\n/** FNV-1a over the UTF-16 units: small, dependency-free and the same everywhere. */\nfunction hash(text: string): number {\n let h = 0x811c9dc5;\n for (let i = 0; i < text.length; i++) {\n // eslint-disable-next-line no-bitwise -- the hash is defined on bits\n h ^= text.charCodeAt(i);\n h = Math.imul(h, 0x01000193);\n }\n // eslint-disable-next-line no-bitwise -- to an unsigned 32-bit integer\n return h >>> 0;\n}\n\n/**\n * Image avatar with configurable corner treatment.\n *\n * Projected content (typically initials) is the FALLBACK: it shows with no\n * `url`, while the image loads and after it fails, and leaves the paint once the\n * image has loaded. It is projected into a `.wr-avatar__content` wrapper, so a\n * `wr-avatar > …` child selector no longer reaches it. While it is there, no\n * spinner is drawn over it; with nothing projected, the spinner marks the\n * loading state instead. See `alt` for what a screen reader hears.\n *\n * `name` is the shorter route to the same avatar: it names the image, draws the\n * person's initials (`wrInitials` from `ngwr/utils`) as the fallback, and with\n * `tint` colours the box from a hash of the name. The fallback order is\n * projected content, then the `name` initials, then the spinner: the initials\n * are drawn only when nothing is projected.\n *\n * Projected initials take the text size around the avatar, capped at\n * `--wr-avatar-initials-scale` (`0.375`) of the box, so they shrink only where\n * they would not fit: a 16px avatar in a 14px chip draws 6px letters, while a\n * `6rem` one keeps the surrounding size up to 36px and is capped only past it.\n * Anything projected that is sized in `em` follows the cap too — a `<wr-icon>`\n * at its default `1.2em` included — so pin a `px` or `rem` size on the projected\n * element, or override the hook, to keep it. A `font-size` rule on the avatar\n * itself still wins, unless it sits in a cascade layer (Tailwind v4's utilities\n * do), which ngwr's unlayered stylesheet beats whatever the selector.\n *\n * The initials are inert: `pointer-events: none` hands a click on them to whatever\n * holds the avatar, and `user-select: none` keeps them out of a text selection.\n *\n * @example\n * ```html\n * <wr-avatar url=\"/me.png\" alt=\"Roman\" size=\"3rem\" shape=\"circle\" />\n * <wr-avatar [url]=\"photo\" alt=\"Roman Khegay\" [size]=\"48\">RK</wr-avatar>\n * <wr-avatar [url]=\"photo\" name=\"Roman Khegay\" [size]=\"48\" tint />\n * ```\n *\n * @see https://ngwr.dev/reference/components/avatar\n */\n@Component({\n selector: 'wr-avatar',\n templateUrl: './avatar.html',\n encapsulation: ViewEncapsulation.None,\n host: {\n '[class]': 'classes()',\n '[style.width]': 'cssSize()',\n '[style.height]': 'cssSize()',\n // What the stylesheet sizes projected initials against. Always px or rem: a\n // value `resolveCssSize` has no pixels for falls back to the default box.\n '[style.--wr-avatar-size]': 'cssSize()',\n },\n imports: [WrSpinner],\n})\nexport class WrAvatar {\n /**\n * Image URL. Projected content (e.g. initials) shows while it is unset,\n * loading or broken, and gives way once the image has loaded.\n *\n * @default null\n */\n readonly url = input<string | null>(null);\n\n /**\n * Alt text for the image. Falls back to `avatar.alt`, then `'Avatar'` — pass\n * the person's name where you have it, since that is what a reader wants.\n *\n * With an `alt`, projected initials are hidden from assistive technology while\n * an image is in play, so the name is announced once. Without one, the image\n * carries only the generic name, so the initials stay announced beside it —\n * visually hidden once it has loaded, never dropped.\n *\n * `alt=\"\"` marks the avatar decorative, as it does on an `<img>`: the image is\n * silent and so are the initials while an image is in play — for an avatar beside\n * a name that is already printed. After a failed load with nothing projected, the\n * `alt` is still announced, so a broken image never leaves the avatar nameless.\n *\n * @default null\n */\n readonly alt = input<string | null>(null);\n\n /**\n * The person's name. It is the image's alt text when `alt` is not given\n * (`alt` wins when both are, `alt=\"\"` included), and its initials are the\n * fallback when nothing is projected: shown with no `url`, while the image\n * loads and after it fails, hidden once the image has loaded. Announced as the\n * name rather than as two letters, and once only beside an image. A name with\n * no initial (`'...'`) draws nothing and leaves the spinner to the image.\n *\n * @default null\n */\n readonly name = input<string | null>(null);\n\n /**\n * Colour the initials avatar from a stable hash of `name`: the same name is\n * the same tint on every render, server and client alike, and a new name is a\n * new tint. Five tints, each an intent's `-soft` fill under its `-ink` text,\n * so the initials reach 4.5:1 in both schemes. Nothing without `name`, and\n * nothing while projected content stands in for the initials.\n *\n * @default false\n */\n readonly tint = input(false, { transform: coerceBooleanProperty });\n\n /** `alt=\"\"`, given on purpose — see `alt`. */\n private readonly decorative = computed(() => this.alt() === '');\n\n private readonly locale = inject(LOCALE_ID);\n\n private readonly namedAlt = useI18nText(\n computed(() => {\n const name = this.name()?.trim();\n // A blank name is no name: the catalog fallback, as with no name at all.\n if (this.alt() === null && !name) return null;\n return this.alt() ?? name;\n }),\n 'avatar.alt',\n 'Avatar'\n );\n\n /** The initials `name` yields, `''` when it yields none. */\n protected readonly initials = computed(() => wrInitials(this.name(), this.locale));\n\n /** The tint modifier's intent, or `null` with `tint` off or no initials to colour. */\n private readonly tintName = computed(() => {\n if (!this.tint() || !this.initials()) return null;\n return TINTS[hash(this.name()!.trim()) % TINTS.length];\n });\n\n /** The image's text alternative: empty when decorative, else the catalog's fallback for an unset one. */\n protected readonly resolvedAlt = computed(() => (this.decorative() ? '' : this.namedAlt()));\n\n /**\n * Corner treatment. `rounded` (default) is a soft rounded square,\n * `circle` is the classic profile avatar, `squircle` is the iOS look.\n *\n * @default 'rounded'\n */\n readonly shape = input<WrAvatarShape>('rounded');\n\n /**\n * Box size. See {@link WrAvatarSize} for accepted values. The resolved value is\n * published on the host as `--wr-avatar-size`.\n *\n * @default '6rem'\n */\n readonly size = input<WrAvatarSize>(DEFAULT_SIZE);\n\n protected readonly loaded = signal(false);\n\n /**\n * Whether the image failed. Without this the spinner spun forever on a broken\n * URL — the one state where an avatar is guaranteed to have projected initials\n * worth showing instead.\n */\n protected readonly failed = signal(false);\n\n private readonly img = viewChild<ElementRef<HTMLImageElement>>('img');\n\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('avatar');\n // A new URL is a new attempt: after a failure the fallback would otherwise\n // stay put for an image that loads perfectly well.\n effect(() => {\n this.url();\n untracked(() => {\n this.loaded.set(false);\n this.failed.set(false);\n });\n });\n\n afterNextRender(() => this.adoptSettledImage());\n }\n\n /**\n * A prerendered `<img>` starts loading when the browser parses the HTML, and\n * `(load)` / `(error)` are only attached at hydration — so on a slow bundle the\n * image settles first, both events go nowhere, and the avatar sits on its\n * fallback over a photo it already has (or names a broken image it never\n * learns about). Only the FIRST render can race: every later `<img>` is\n * created on the client with its listeners in place before `src` is set.\n */\n private adoptSettledImage(): void {\n const img = this.img()?.nativeElement;\n if (!img?.complete || this.loaded() || this.failed()) return;\n\n if (img.naturalWidth > 0) {\n this.loaded.set(true);\n return;\n }\n\n // Zero wide is a broken image, or an SVG with no intrinsic size in an engine\n // that reports it as 0 — only the element can tell. Setting `src` to the\n // value it already has makes it fire `load` or `error` again, to listeners\n // that exist now.\n const src = img.getAttribute('src');\n if (src !== null) img.setAttribute('src', src);\n }\n\n protected readonly resolved = computed<ResolvedCssSize>(() => {\n const result = resolveCssSize(this.size(), { defaultValue: DEFAULT_SIZE });\n if (result.pxValue == null || result.pxValue <= 0) {\n return resolveCssSize(DEFAULT_SIZE, { defaultValue: DEFAULT_SIZE });\n }\n return result;\n });\n\n /**\n * Whether the projected fallback is `aria-hidden`: an `<img>` is in the DOM\n * (loading or loaded) AND the consumer named it, or marked it decorative with\n * `alt=\"\"`. Then the image's `alt` owns the name, announced once and unchanged\n * at the moment the photo arrives. Without a real `alt` the image is only\n * \"Avatar\", and hiding the initials would drop the one thing that says who\n * this is.\n *\n * The stylesheet keys on the same attribute once `--loaded`: a hidden fallback\n * leaves the paint through `visibility`, a named-by-initials one is clipped and\n * stays in the accessibility tree. While loading it is painted either way.\n */\n protected readonly fallbackHidden = computed(\n () => !!this.url() && !this.failed() && (this.decorative() || !!this.alt()?.trim() || !!this.name()?.trim())\n );\n\n /**\n * The `name` initials follow the projected fallback, and go silent for a\n * decorative avatar too: with `alt=\"\"` there is a name printed beside it, and\n * two letters read on top of it would say it twice.\n */\n protected readonly initialsHidden = computed(() => this.fallbackHidden() || this.decorative());\n\n protected readonly cssSize = computed(() => this.resolved().cssValue);\n protected readonly pxSize = computed(() => this.resolved().pxValue);\n\n protected readonly classes = computed(() => {\n const parts = ['wr-avatar'];\n const shape = this.shape();\n if (shape !== 'rounded') parts.push(`wr-avatar--${shape}`);\n if (this.loaded()) parts.push('wr-avatar--loaded');\n const tint = this.tintName();\n if (tint) parts.push(`wr-avatar--tint-${tint}`);\n return parts.join(' ');\n });\n\n protected onImageLoad(): void {\n this.loaded.set(true);\n }\n\n protected onImageError(): void {\n this.failed.set(true);\n }\n}\n","<span class=\"wr-avatar__content\" [attr.aria-hidden]=\"fallbackHidden() ? 'true' : null\"><ng-content /></span>\n\n@if (initials(); as letters) {\n <!--\n The `name` initials. After the projected content, which the stylesheet lets\n win when there is any; named by the person rather than by the letters.\n -->\n <span\n class=\"wr-avatar__initials\"\n role=\"img\"\n [attr.aria-label]=\"resolvedAlt()\"\n [attr.aria-hidden]=\"initialsHidden() ? 'true' : null\"\n >{{ letters }}</span\n >\n}\n\n@if (url(); as src) {\n @if (!failed()) {\n <img\n #img\n class=\"wr-avatar__img\"\n [src]=\"src\"\n [alt]=\"resolvedAlt()\"\n [attr.width]=\"pxSize()\"\n [attr.height]=\"pxSize()\"\n (load)=\"onImageLoad()\"\n (error)=\"onImageError()\"\n decoding=\"async\"\n />\n\n @if (!loaded()) {\n <wr-spinner class=\"wr-avatar__spin\" />\n }\n } @else if (resolvedAlt()) {\n <!--\n The broken <img> is removed so the fallback can show, and its `alt` went with\n it: with no initials projected, the avatar was left with no name at all. With\n initials, the stylesheet hides this and they name the avatar, as before.\n -->\n <span class=\"wr-avatar__alt\" role=\"img\" [attr.aria-label]=\"resolvedAlt()\"></span>\n }\n}\n"],"mappings":";;;;;;;;;;;;AA6BA,MAAM,eAA6B;AAOnC,MAAM,QAAQ;CAAC;CAAW;CAAW;CAAW;CAAU;AAAM;AAGhE,SAAS,KAAK,MAAY;CACxB,IAAI,IAAI;CACR,KAAK,IAAI,IAAI,GAAG,IAAI,KAAK,QAAQ,KAAK;EAEpC,KAAK,KAAK,WAAW,CAAC;EACtB,IAAI,KAAK,KAAK,GAAG,QAAU;CAC7B;CAEA,OAAO,MAAM;AACf;AAsD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UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,KAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,MAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,MAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,OAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,MAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,KAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,OAAK,EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;CAAA;AAAA,CAAA"}
1
+ {"version":3,"file":"ngwr-avatar.mjs","names":[],"sources":["../../../projects/lib/avatar/avatar.ts","../../../projects/lib/avatar/avatar.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 { coerceBooleanProperty } from '@angular/cdk/coercion';\nimport {\n Component,\n type ElementRef,\n LOCALE_ID,\n ViewEncapsulation,\n afterNextRender,\n computed,\n effect,\n inject,\n input,\n signal,\n untracked,\n viewChild,\n} from '@angular/core';\n\nimport { useI18nText } from 'ngwr/i18n';\nimport { WrSpinner } from 'ngwr/spinner';\nimport { wrResolveCssSize, type WrResolvedCssSize, wrCheckStyles, wrInitials } from 'ngwr/utils';\n\nimport type { WrAvatarShape, WrAvatarSize } from './types';\n\nconst DEFAULT_SIZE: WrAvatarSize = '6rem';\n\n/**\n * The tints `tint` picks from, each a `-soft` fill under its `-ink` text. Index\n * order is part of the contract: the same name lands on the same tint on every\n * render, server or client, and a reorder would re-colour every avatar.\n */\nconst TINTS = ['primary', 'success', 'warning', 'danger', 'info'] as const;\n\n/** FNV-1a over the UTF-16 units: small, dependency-free and the same everywhere. */\nfunction hash(text: string): number {\n let h = 0x811c9dc5;\n for (let i = 0; i < text.length; i++) {\n // eslint-disable-next-line no-bitwise -- the hash is defined on bits\n h ^= text.charCodeAt(i);\n h = Math.imul(h, 0x01000193);\n }\n // eslint-disable-next-line no-bitwise -- to an unsigned 32-bit integer\n return h >>> 0;\n}\n\n/**\n * Image avatar with configurable corner treatment.\n *\n * Projected content (typically initials) is the FALLBACK: it shows with no\n * `url`, while the image loads and after it fails, and leaves the paint once the\n * image has loaded. It is projected into a `.wr-avatar__content` wrapper, so a\n * `wr-avatar > …` child selector no longer reaches it. While it is there, no\n * spinner is drawn over it; with nothing projected, the spinner marks the\n * loading state instead. See `alt` for what a screen reader hears.\n *\n * `name` is the shorter route to the same avatar: it names the image, draws the\n * person's initials (`wrInitials` from `ngwr/utils`) as the fallback, and with\n * `tint` colours the box from a hash of the name. The fallback order is\n * projected content, then the `name` initials, then the spinner: the initials\n * are drawn only when nothing is projected.\n *\n * Projected initials take the text size around the avatar, capped at\n * `--wr-avatar-initials-scale` (`0.375`) of the box, so they shrink only where\n * they would not fit: a 16px avatar in a 14px chip draws 6px letters, while a\n * `6rem` one keeps the surrounding size up to 36px and is capped only past it.\n * Anything projected that is sized in `em` follows the cap too — a `<wr-icon>`\n * at its default `1.2em` included — so pin a `px` or `rem` size on the projected\n * element, or override the hook, to keep it. A `font-size` rule on the avatar\n * itself still wins, unless it sits in a cascade layer (Tailwind v4's utilities\n * do), which ngwr's unlayered stylesheet beats whatever the selector.\n *\n * The initials are inert: `pointer-events: none` hands a click on them to whatever\n * holds the avatar, and `user-select: none` keeps them out of a text selection.\n *\n * @example\n * ```html\n * <wr-avatar url=\"/me.png\" alt=\"Roman\" size=\"3rem\" shape=\"circle\" />\n * <wr-avatar [url]=\"photo\" alt=\"Roman Khegay\" [size]=\"48\">RK</wr-avatar>\n * <wr-avatar [url]=\"photo\" name=\"Roman Khegay\" [size]=\"48\" tint />\n * ```\n *\n * @see https://ngwr.dev/reference/components/avatar\n */\n@Component({\n selector: 'wr-avatar',\n templateUrl: './avatar.html',\n encapsulation: ViewEncapsulation.None,\n host: {\n '[class]': 'classes()',\n '[style.width]': 'cssSize()',\n '[style.height]': 'cssSize()',\n // What the stylesheet sizes projected initials against. Always px or rem: a\n // value `wrResolveCssSize` has no pixels for falls back to the default box.\n '[style.--wr-avatar-size]': 'cssSize()',\n },\n imports: [WrSpinner],\n})\nexport class WrAvatar {\n /**\n * Image URL. Projected content (e.g. initials) shows while it is unset,\n * loading or broken, and gives way once the image has loaded.\n *\n * @default null\n */\n readonly url = input<string | null>(null);\n\n /**\n * Alt text for the image. Falls back to `avatar.alt`, then `'Avatar'` — pass\n * the person's name where you have it, since that is what a reader wants.\n *\n * With an `alt`, projected initials are hidden from assistive technology while\n * an image is in play, so the name is announced once. Without one, the image\n * carries only the generic name, so the initials stay announced beside it —\n * visually hidden once it has loaded, never dropped.\n *\n * `alt=\"\"` marks the avatar decorative, as it does on an `<img>`: the image is\n * silent and so are the initials while an image is in play — for an avatar beside\n * a name that is already printed. After a failed load with nothing projected, the\n * `alt` is still announced, so a broken image never leaves the avatar nameless.\n *\n * @default null\n */\n readonly alt = input<string | null>(null);\n\n /**\n * The person's name. It is the image's alt text when `alt` is not given\n * (`alt` wins when both are, `alt=\"\"` included), and its initials are the\n * fallback when nothing is projected: shown with no `url`, while the image\n * loads and after it fails, hidden once the image has loaded. Announced as the\n * name rather than as two letters, and once only beside an image. A name with\n * no initial (`'...'`) draws nothing and leaves the spinner to the image.\n *\n * @default null\n */\n readonly name = input<string | null>(null);\n\n /**\n * Colour the initials avatar from a stable hash of `name`: the same name is\n * the same tint on every render, server and client alike, and a new name is a\n * new tint. Five tints, each an intent's `-soft` fill under its `-ink` text,\n * so the initials reach 4.5:1 in both schemes. Nothing without `name`, and\n * nothing while projected content stands in for the initials.\n *\n * @default false\n */\n readonly tint = input(false, { transform: coerceBooleanProperty });\n\n /** `alt=\"\"`, given on purpose — see `alt`. */\n private readonly decorative = computed(() => this.alt() === '');\n\n private readonly locale = inject(LOCALE_ID);\n\n private readonly namedAlt = useI18nText(\n computed(() => {\n const name = this.name()?.trim();\n // A blank name is no name: the catalog fallback, as with no name at all.\n if (this.alt() === null && !name) return null;\n return this.alt() ?? name;\n }),\n 'avatar.alt',\n 'Avatar'\n );\n\n /** The initials `name` yields, `''` when it yields none. */\n protected readonly initials = computed(() => wrInitials(this.name(), this.locale));\n\n /** The tint modifier's intent, or `null` with `tint` off or no initials to colour. */\n private readonly tintName = computed(() => {\n if (!this.tint() || !this.initials()) return null;\n return TINTS[hash(this.name()!.trim()) % TINTS.length];\n });\n\n /** The image's text alternative: empty when decorative, else the catalog's fallback for an unset one. */\n protected readonly resolvedAlt = computed(() => (this.decorative() ? '' : this.namedAlt()));\n\n /**\n * Corner treatment. `rounded` (default) is a soft rounded square,\n * `circle` is the classic profile avatar, `squircle` is the iOS look.\n *\n * @default 'rounded'\n */\n readonly shape = input<WrAvatarShape>('rounded');\n\n /**\n * Box size. See {@link WrAvatarSize} for accepted values. The resolved value is\n * published on the host as `--wr-avatar-size`.\n *\n * @default '6rem'\n */\n readonly size = input<WrAvatarSize>(DEFAULT_SIZE);\n\n protected readonly loaded = signal(false);\n\n /**\n * Whether the image failed. Without this the spinner spun forever on a broken\n * URL — the one state where an avatar is guaranteed to have projected initials\n * worth showing instead.\n */\n protected readonly failed = signal(false);\n\n private readonly img = viewChild<ElementRef<HTMLImageElement>>('img');\n\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('avatar');\n // A new URL is a new attempt: after a failure the fallback would otherwise\n // stay put for an image that loads perfectly well.\n effect(() => {\n this.url();\n untracked(() => {\n this.loaded.set(false);\n this.failed.set(false);\n });\n });\n\n afterNextRender(() => this.adoptSettledImage());\n }\n\n /**\n * A prerendered `<img>` starts loading when the browser parses the HTML, and\n * `(load)` / `(error)` are only attached at hydration — so on a slow bundle the\n * image settles first, both events go nowhere, and the avatar sits on its\n * fallback over a photo it already has (or names a broken image it never\n * learns about). Only the FIRST render can race: every later `<img>` is\n * created on the client with its listeners in place before `src` is set.\n */\n private adoptSettledImage(): void {\n const img = this.img()?.nativeElement;\n if (!img?.complete || this.loaded() || this.failed()) return;\n\n if (img.naturalWidth > 0) {\n this.loaded.set(true);\n return;\n }\n\n // Zero wide is a broken image, or an SVG with no intrinsic size in an engine\n // that reports it as 0 — only the element can tell. Setting `src` to the\n // value it already has makes it fire `load` or `error` again, to listeners\n // that exist now.\n const src = img.getAttribute('src');\n if (src !== null) img.setAttribute('src', src);\n }\n\n protected readonly resolved = computed<WrResolvedCssSize>(() => {\n const result = wrResolveCssSize(this.size(), { defaultValue: DEFAULT_SIZE });\n if (result.pxValue == null || result.pxValue <= 0) {\n return wrResolveCssSize(DEFAULT_SIZE, { defaultValue: DEFAULT_SIZE });\n }\n return result;\n });\n\n /**\n * Whether the projected fallback is `aria-hidden`: an `<img>` is in the DOM\n * (loading or loaded) AND the consumer named it, or marked it decorative with\n * `alt=\"\"`. Then the image's `alt` owns the name, announced once and unchanged\n * at the moment the photo arrives. Without a real `alt` the image is only\n * \"Avatar\", and hiding the initials would drop the one thing that says who\n * this is.\n *\n * The stylesheet keys on the same attribute once `--loaded`: a hidden fallback\n * leaves the paint through `visibility`, a named-by-initials one is clipped and\n * stays in the accessibility tree. While loading it is painted either way.\n */\n protected readonly fallbackHidden = computed(\n () => !!this.url() && !this.failed() && (this.decorative() || !!this.alt()?.trim() || !!this.name()?.trim())\n );\n\n /**\n * The `name` initials follow the projected fallback, and go silent for a\n * decorative avatar too: with `alt=\"\"` there is a name printed beside it, and\n * two letters read on top of it would say it twice.\n */\n protected readonly initialsHidden = computed(() => this.fallbackHidden() || this.decorative());\n\n protected readonly cssSize = computed(() => this.resolved().cssValue);\n protected readonly pxSize = computed(() => this.resolved().pxValue);\n\n protected readonly classes = computed(() => {\n const parts = ['wr-avatar'];\n const shape = this.shape();\n if (shape !== 'rounded') parts.push(`wr-avatar--${shape}`);\n if (this.loaded()) parts.push('wr-avatar--loaded');\n const tint = this.tintName();\n if (tint) parts.push(`wr-avatar--tint-${tint}`);\n return parts.join(' ');\n });\n\n protected onImageLoad(): void {\n this.loaded.set(true);\n }\n\n protected onImageError(): void {\n this.failed.set(true);\n }\n}\n","<span class=\"wr-avatar__content\" [attr.aria-hidden]=\"fallbackHidden() ? 'true' : null\"><ng-content /></span>\n\n@if (initials(); as letters) {\n <!--\n The `name` initials. After the projected content, which the stylesheet lets\n win when there is any; named by the person rather than by the letters.\n -->\n <span\n class=\"wr-avatar__initials\"\n role=\"img\"\n [attr.aria-label]=\"resolvedAlt()\"\n [attr.aria-hidden]=\"initialsHidden() ? 'true' : null\"\n >{{ letters }}</span\n >\n}\n\n@if (url(); as src) {\n @if (!failed()) {\n <img\n #img\n class=\"wr-avatar__img\"\n [src]=\"src\"\n [alt]=\"resolvedAlt()\"\n [attr.width]=\"pxSize()\"\n [attr.height]=\"pxSize()\"\n (load)=\"onImageLoad()\"\n (error)=\"onImageError()\"\n decoding=\"async\"\n />\n\n @if (!loaded()) {\n <wr-spinner class=\"wr-avatar__spin\" />\n }\n } @else if (resolvedAlt()) {\n <!--\n The broken <img> is removed so the fallback can show, and its `alt` went with\n it: with no initials projected, the avatar was left with no name at all. With\n initials, the stylesheet hides this and they name the avatar, as before.\n -->\n <span class=\"wr-avatar__alt\" role=\"img\" [attr.aria-label]=\"resolvedAlt()\"></span>\n }\n}\n"],"mappings":";;;;;;;;;;;;AA6BA,MAAM,eAA6B;AAOnC,MAAM,QAAQ;CAAC;CAAW;CAAW;CAAW;CAAU;AAAM;A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ACX,iBAAiB;IACjB,kBAAkB;IAGlB,4BAA4B;GAC7B;GAAA,SACQ,CAAC,SAAS;GAAC,UAAA;EAAA,CAAA;CAyG2C,CAAA;CAAA,sBAAA,CAAA;CAAA,gBAAA;EAAA,KAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,KAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,MAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,MAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,OAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,MAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,KAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,OAAK,EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;CAAA;AAAA,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"ngwr-badge.mjs","names":[],"sources":["../../../projects/lib/badge/badge.ts","../../../projects/lib/badge/tag.ts","../../../projects/lib/badge/tag.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 { coerceBooleanProperty } from '@angular/cdk/coercion';\nimport { Component, ViewEncapsulation, computed, input } from '@angular/core';\n\nimport type { WrColor } from 'ngwr/theme';\nimport { wrCheckStyles } from 'ngwr/utils';\n\nimport type { WrBadgeShape, WrBadgeSize } from './types';\n\n/**\n * Lean chip — color, size, rounded/pill. Use for short labels and counts\n * (e.g. \"ONLINE\", \"3 unread\", \"v2.1\"), where the words say the state and the\n * colour decorates it. Reach for `<wr-tag>` when you need icons, loading\n * state, or outlined / transparent styles.\n *\n * @example\n * ```html\n * <wr-badge color=\"success\">Active</wr-badge>\n * <wr-badge color=\"danger\" size=\"sm\">3</wr-badge>\n * <wr-badge color=\"primary\" shape=\"pill\">New</wr-badge>\n * ```\n *\n * @see https://ngwr.dev/reference/components/badge\n */\n@Component({\n selector: 'wr-badge',\n template: '<ng-content />',\n encapsulation: ViewEncapsulation.None,\n host: {\n '[class]': 'classes()',\n },\n})\nexport class WrBadge {\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('badge');\n }\n\n /**\n * Color variant. Maps to `--wr-color-*` CSS variables from the theme. It is\n * decoration or category, never the state on its own: four of the five intents\n * share one lightness and `success` against `danger` is 1.004:1, so the label\n * has to say the state (`Offline`, not a red `Status`). A badge draws no\n * icon — when a chip must stand for a status without words, use `<wr-tag>`\n * with its `icon` input.\n *\n * @default 'primary'\n */\n readonly color = input<WrColor | null>('primary');\n\n /**\n * Size variant.\n *\n * @default 'md'\n */\n readonly size = input<WrBadgeSize>('md');\n\n /**\n * Corner treatment. Mirrors `<wr-btn>` — `rounded` (default) uses the\n * small form-radius; `pill` rounds the ends fully.\n *\n * @default 'rounded'\n */\n readonly shape = input<WrBadgeShape>('rounded');\n\n /**\n * Outlined style — transparent fill, colored border and text.\n *\n * @default false\n */\n readonly outlined = input(false, { transform: coerceBooleanProperty });\n\n protected readonly classes = computed(() => {\n const parts = ['wr-badge'];\n\n const color = this.color();\n if (color) parts.push(`wr-badge--${color}`);\n\n const size = this.size();\n if (size !== 'md') {\n parts.push(`wr-badge--${size}`);\n }\n const shape = this.shape();\n if (shape !== 'rounded') {\n parts.push(`wr-badge--${shape}`);\n }\n if (this.outlined()) {\n parts.push('wr-badge--outlined');\n }\n return parts.join(' ');\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 { coerceBooleanProperty } from '@angular/cdk/coercion';\nimport { Component, ViewEncapsulation, computed, input } from '@angular/core';\n\nimport { WrIcon, type WrIconName } from 'ngwr/icon';\nimport { WrSpinner } from 'ngwr/spinner';\nimport type { WrColor } from 'ngwr/theme';\nimport { wrCheckStyles } from 'ngwr/utils';\n\nimport type { WrTagIconPosition } from './types';\n\n/**\n * Rich inline label — icons, loading state, three visual styles\n * (solid / outlined / transparent). Reach for `<wr-badge>` when all\n * you need is a colored text chip.\n *\n * @example\n * ```html\n * <wr-tag>Default</wr-tag>\n * <wr-tag color=\"success\" icon=\"checkmark\">Done</wr-tag>\n * <wr-tag color=\"primary\" outlined rounded>Beta</wr-tag>\n * <wr-tag color=\"warning\" loading>Saving</wr-tag>\n * ```\n *\n * @see https://ngwr.dev/reference/components/badge\n */\n@Component({\n selector: 'wr-tag',\n templateUrl: './tag.html',\n encapsulation: ViewEncapsulation.None,\n host: { '[class]': 'classes()' },\n imports: [WrIcon, WrSpinner],\n})\nexport class WrTag {\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('badge');\n }\n\n /**\n * Color variant — decoration or category, never the state on its own. The\n * label carries the state (`Failed`, not a red `Build`): four of the five\n * intents share one lightness and `success` against `danger` is 1.004:1, so a\n * reader who cannot separate red from green cannot tell those two tags\n * apart, and `primary` and `info` are the same blue to everyone. When a tag has to stand\n * for a status by itself, give it an `icon` as well — register one with\n * `provideWrIcons(lucideIcons({ 'octagon-alert': OctagonAlert }))`, then write\n * `<wr-tag color=\"danger\" icon=\"octagon-alert\">Failed</wr-tag>`.\n *\n * @default 'primary'\n */\n readonly color = input<WrColor | null>('primary');\n\n /**\n * Icon name shown alongside the content — the one channel besides the label\n * that a tag has, so the one to reach for when colour is carrying a status.\n * Nothing ships built in: register the name through `provideWrIcons` first.\n * The icon is replaced by a spinner when `loading` is true.\n *\n * @default null\n */\n readonly icon = input<WrIconName | null>(null);\n\n /**\n * Where the icon/spinner is rendered.\n *\n * @default 'start'\n */\n readonly iconPosition = input<WrTagIconPosition>('start');\n\n /**\n * Outlined style — colored text and border on a tinted background.\n *\n * @default false\n */\n readonly outlined = input(false, { transform: coerceBooleanProperty });\n\n /**\n * Transparent style — colored text on a low-opacity tint, no border.\n *\n * @default false\n */\n readonly transparent = input(false, { transform: coerceBooleanProperty });\n\n /**\n * Pill-shaped corners.\n *\n * @default false\n */\n readonly rounded = input(false, { transform: coerceBooleanProperty });\n\n /**\n * Adds a hover state — use when the tag is interactive (button/link).\n *\n * @default false\n */\n readonly hoverable = input(false, { transform: coerceBooleanProperty });\n\n /**\n * Show a spinner in place of the icon.\n *\n * @default false\n */\n readonly loading = input(false, { transform: coerceBooleanProperty });\n\n protected readonly classes = computed(() => {\n const parts = ['wr-tag'];\n\n const color = this.color();\n if (color) parts.push(`wr-tag--${color}`);\n\n if (this.outlined()) parts.push('wr-tag--outlined');\n if (this.transparent()) parts.push('wr-tag--transparent');\n if (this.rounded()) parts.push('wr-tag--rounded');\n if (this.hoverable()) parts.push('wr-tag--hoverable');\n if (this.loading()) parts.push('wr-tag--loading');\n\n const hasAdornment = !!this.icon() || this.loading();\n if (hasAdornment) parts.push(`wr-tag--icon-${this.iconPosition()}`);\n\n return parts.join(' ');\n });\n}\n","@if (iconPosition() === 'start') {\n @if (loading()) {\n <wr-spinner class=\"wr-tag__adornment\" size=\"sm\" />\n } @else if (icon(); as name) {\n <wr-icon class=\"wr-tag__adornment\" [name]=\"name\" />\n }\n}\n\n<ng-content />\n\n@if (iconPosition() === 'end') {\n @if (loading()) {\n <wr-spinner class=\"wr-tag__adornment\" size=\"sm\" />\n } @else if (icon(); as name) {\n <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AA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;GAAA,cAAA;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,aAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;GAAA,SAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;GAAA,WAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;GAAA,SAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;EAAA;EAAA,MAAA,EAAA,YAAA,EAAA,SAAA,YAAA,EAAA;EAAA,UAAA;EAAA,UCvClB;EAiBA,cAAA,CAAA;GAAA,MAAA;GAAA,MDoBY;GAAM,UAAA;GAAA,QAAA,CAAA,MAAA;EAAA,GAAA;GAAA,MAAA;GAAA,MAAE;GAAS,UAAA;GAAA,QAAA,CAAA,QAAA,WAAA;EAAA,CAAA;EAAA,eAAA,GAAA,kBAAA;CAAA,CAAA;;AAEhB,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAK,YAAA,CAAA;EAPjB,MAAA;EACW,MAAA,CAAA;GAAA,UAAA;GAAQ,eAEH,kBAAkB;GAAI,MAC/B,EAAE,WAAW,YAAW;GAAE,SACvB,CAAC,QAAQ,SAAS;GAAC,UAAA;EAAA,CAAA"}
1
+ {"version":3,"file":"ngwr-badge.mjs","names":[],"sources":["../../../projects/lib/badge/badge.ts","../../../projects/lib/badge/tag.ts","../../../projects/lib/badge/tag.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 { coerceBooleanProperty } from '@angular/cdk/coercion';\nimport { Component, ViewEncapsulation, computed, input } from '@angular/core';\n\nimport type { WrColor } from 'ngwr/theme';\nimport { wrCheckStyles } from 'ngwr/utils';\n\nimport type { WrBadgeShape, WrBadgeSize } from './types';\n\n/**\n * Lean chip — color, size, rounded/pill. Use for short labels and counts\n * (e.g. \"ONLINE\", \"3 unread\", \"v2.1\"), where the words say the state and the\n * colour decorates it. Reach for `<wr-tag>` when you need icons, loading\n * state, or outlined / transparent styles.\n *\n * @example\n * ```html\n * <wr-badge color=\"success\">Active</wr-badge>\n * <wr-badge color=\"danger\" size=\"sm\">3</wr-badge>\n * <wr-badge color=\"primary\" shape=\"pill\">New</wr-badge>\n * ```\n *\n * @see https://ngwr.dev/reference/components/badge\n */\n@Component({\n selector: 'wr-badge',\n template: '<ng-content />',\n encapsulation: ViewEncapsulation.None,\n host: {\n '[class]': 'classes()',\n },\n})\nexport class WrBadge {\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('badge');\n }\n\n /**\n * Color variant. Maps to `--wr-color-*` CSS variables from the theme. It is\n * decoration or category, never the state on its own: four of the five intents\n * share one lightness and `success` against `danger` is 1.004:1, so the label\n * has to say the state (`Offline`, not a red `Status`). A badge draws no\n * icon — when a chip must stand for a status without words, use `<wr-tag>`\n * with its `icon` input.\n *\n * @default 'primary'\n */\n readonly color = input<WrColor | null>('primary');\n\n /**\n * Size variant.\n *\n * @default 'md'\n */\n readonly size = input<WrBadgeSize>('md');\n\n /**\n * Corner treatment. Mirrors `<wr-btn>` — `rounded` (default) uses the\n * small form-radius; `pill` rounds the ends fully.\n *\n * @default 'rounded'\n */\n readonly shape = input<WrBadgeShape>('rounded');\n\n /**\n * Outlined style — transparent fill, colored border and text.\n *\n * @default false\n */\n readonly outlined = input(false, { transform: coerceBooleanProperty });\n\n protected readonly classes = computed(() => {\n const parts = ['wr-badge'];\n\n const color = this.color();\n if (color) parts.push(`wr-badge--${color}`);\n\n const size = this.size();\n if (size !== 'md') {\n parts.push(`wr-badge--${size}`);\n }\n const shape = this.shape();\n if (shape !== 'rounded') {\n parts.push(`wr-badge--${shape}`);\n }\n if (this.outlined()) {\n parts.push('wr-badge--outlined');\n }\n return parts.join(' ');\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 { coerceBooleanProperty } from '@angular/cdk/coercion';\nimport { Component, ViewEncapsulation, computed, input } from '@angular/core';\n\nimport { WrIcon, type WrIconName } from 'ngwr/icon';\nimport { WrSpinner } from 'ngwr/spinner';\nimport type { WrColor } from 'ngwr/theme';\nimport { wrCheckStyles } from 'ngwr/utils';\n\nimport type { WrTagIconPosition } from './types';\n\n/**\n * Rich inline label — icons, loading state, three visual styles\n * (solid / outlined / transparent). Reach for `<wr-badge>` when all\n * you need is a colored text chip.\n *\n * @example\n * ```html\n * <wr-tag>Default</wr-tag>\n * <wr-tag color=\"success\" icon=\"checkmark\">Done</wr-tag>\n * <wr-tag color=\"primary\" outlined rounded>Beta</wr-tag>\n * <wr-tag color=\"warning\" loading>Saving</wr-tag>\n * ```\n *\n * @see https://ngwr.dev/reference/components/badge\n */\n@Component({\n selector: 'wr-tag',\n templateUrl: './tag.html',\n encapsulation: ViewEncapsulation.None,\n host: { '[class]': 'classes()' },\n imports: [WrIcon, WrSpinner],\n})\nexport class WrTag {\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('badge');\n }\n\n /**\n * Color variant — decoration or category, never the state on its own. The\n * label carries the state (`Failed`, not a red `Build`): four of the five\n * intents share one lightness and `success` against `danger` is 1.004:1, so a\n * reader who cannot separate red from green cannot tell those two tags\n * apart, and `primary` and `info` are the same blue to everyone. When a tag has to stand\n * for a status by itself, give it an `icon` as well — register one with\n * `provideWrIcons(wrLucideIcons({ 'octagon-alert': OctagonAlert }))`, then write\n * `<wr-tag color=\"danger\" icon=\"octagon-alert\">Failed</wr-tag>`.\n *\n * @default 'primary'\n */\n readonly color = input<WrColor | null>('primary');\n\n /**\n * Icon name shown alongside the content — the one channel besides the label\n * that a tag has, so the one to reach for when colour is carrying a status.\n * Nothing ships built in: register the name through `provideWrIcons` first.\n * The icon is replaced by a spinner when `loading` is true.\n *\n * @default null\n */\n readonly icon = input<WrIconName | null>(null);\n\n /**\n * Where the icon/spinner is rendered.\n *\n * @default 'start'\n */\n readonly iconPosition = input<WrTagIconPosition>('start');\n\n /**\n * Outlined style — colored text and border on a tinted background.\n *\n * @default false\n */\n readonly outlined = input(false, { transform: coerceBooleanProperty });\n\n /**\n * Transparent style — colored text on a low-opacity tint, no border.\n *\n * @default false\n */\n readonly transparent = input(false, { transform: coerceBooleanProperty });\n\n /**\n * Pill-shaped corners.\n *\n * @default false\n */\n readonly rounded = input(false, { transform: coerceBooleanProperty });\n\n /**\n * Adds a hover state — use when the tag is interactive (button/link).\n *\n * @default false\n */\n readonly hoverable = input(false, { transform: coerceBooleanProperty });\n\n /**\n * Show a spinner in place of the icon.\n *\n * @default false\n */\n readonly loading = input(false, { transform: coerceBooleanProperty });\n\n protected readonly classes = computed(() => {\n const parts = ['wr-tag'];\n\n const color = this.color();\n if (color) parts.push(`wr-tag--${color}`);\n\n if (this.outlined()) parts.push('wr-tag--outlined');\n if (this.transparent()) parts.push('wr-tag--transparent');\n if (this.rounded()) parts.push('wr-tag--rounded');\n if (this.hoverable()) parts.push('wr-tag--hoverable');\n if (this.loading()) parts.push('wr-tag--loading');\n\n const hasAdornment = !!this.icon() || this.loading();\n if (hasAdornment) parts.push(`wr-tag--icon-${this.iconPosition()}`);\n\n return parts.join(' ');\n });\n}\n","@if (iconPosition() === 'start') {\n @if (loading()) {\n <wr-spinner class=\"wr-tag__adornment\" size=\"sm\" />\n } @else if (icon(); as name) {\n <wr-icon class=\"wr-tag__adornment\" [name]=\"name\" />\n }\n}\n\n<ng-content />\n\n@if (iconPosition() === 'end') {\n @if (loading()) {\n <wr-spinner class=\"wr-tag__adornment\" size=\"sm\" />\n } @else if (icon(); as name) {\n <wr-icon class=\"wr-tag__adornment\" [name]=\"name\" />\n }\n}\n"],"mappings":";;;;;;;;;;;;AAsCA,IAAa,UAAb,MAAa,QAAO;CAClB,cAAA;EACE,IAAI,OAAO,cAAc,eAAe,WAAW,cAAc,OAAO;CAC1E;CAYS,QAAQ,MAAsB,WAAU,GAAA,YAAA,CAAA,EAAA,WAAA,QAAA,CAAA,+BAAA,CAAA,CAAA;CAOxC,OAAO,MAAmB,MAAK,GAAA,YAAA,CAAA,EAAA,WAAA,OAAA,CAAA,+BAAA,CAAA,CAAA;CAQ/B,QAAQ,MAAoB,WAAU,GAAA,YAAA,CAAA,EAAA,WAAA,QAAA,CAAA,+BAAA,CAAA,CAAA;CAOtC,WAAW,MAAM,OAAK;EAAA,GAAA,YAAA,EAAA,WAAA,WAAA,+BAAA,CAAA;EAAI,WAAW;CAAqB,CAAA;CAEhD,UAAU,eAAc;EACzC,MAAM,QAAQ,CAAC,UAAU;EAEzB,MAAM,QAAQ,KAAK,MAAK;EACxB,IAAI,OAAO,MAAM,KAAK,aAAa,OAAO;EAE1C,MAAM,OAAO,KAAK,KAAI;EACtB,IAAI,SAAS,MACX,MAAM,KAAK,aAAa,MAAM;EAEhC,MAAM,QAAQ,KAAK,MAAK;EACxB,IAAI,UAAU,WACZ,MAAM,KAAK,aAAa,OAAO;EAEjC,IAAI,KAAK,SAAQ,GACf,MAAM,KAAK,oBAAoB;EAEjC,OAAO,MAAM,KAAK,GAAG;CACvB,GAAE,GAAA,YAAA,CAAA,EAAA,WAAA,UAAA,CAAA,+BAAA,CAAA,CAAA;CAzDS,OAAA,OAAA,GAAA,mBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,UAAA;EAAA,MAAA;EAAO,MAAA,CAAA;EAAA,QAAA,GAAA,gBAAA;CAAA,CAAA;CAAP,OAAA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  import { Component, DestroyRef, ElementRef, Injector, TemplateRef, ViewContainerRef, ViewEncapsulation, afterNextRender, computed, effect, inject, input, model, output, signal, untracked, viewChild } from "@angular/core";
3
3
  import { coerceBooleanProperty } from "@angular/cdk/coercion";
4
- import { isPrintableKey, toClassList } from "ngwr/utils";
4
+ import { wrIsPrintableKey, wrToClassList } from "ngwr/utils";
5
5
  import { useI18nText } from "ngwr/i18n";
6
6
  import { Directionality } from "@angular/cdk/bidi";
7
7
  import { ScrollStrategyOptions } from "@angular/cdk/overlay";
@@ -59,9 +59,11 @@ var WrCascader = class WrCascader {
59
59
  panelClass = input(null, ...ngDevMode ? [{ debugName: "panelClass" }] : /* istanbul ignore next */ []);
60
60
  value = model([], ...ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []);
61
61
  touch = output();
62
+ opened = output();
63
+ closed = output();
62
64
  path = signal([], ...ngDevMode ? [{ debugName: "path" }] : /* istanbul ignore next */ []);
63
65
  activePath = signal([], ...ngDevMode ? [{ debugName: "activePath" }] : /* istanbul ignore next */ []);
64
- open = signal(false, ...ngDevMode ? [{ debugName: "open" }] : /* istanbul ignore next */ []);
66
+ isOpen = signal(false, ...ngDevMode ? [{ debugName: "isOpen" }] : /* istanbul ignore next */ []);
65
67
  cursor = signal(null, ...ngDevMode ? [{ debugName: "cursor" }] : /* istanbul ignore next */ []);
66
68
  tabStop = computed(() => {
67
69
  const cols = this.columns();
@@ -117,7 +119,7 @@ var WrCascader = class WrCascader {
117
119
  const parts = ["wr-cascader"];
118
120
  const size = this.size();
119
121
  if (size !== "md") parts.push(`wr-cascader--${size}`);
120
- if (this.open()) parts.push("wr-cascader--open");
122
+ if (this.isOpen()) parts.push("wr-cascader--open");
121
123
  if (this.disabled()) parts.push("wr-cascader--disabled");
122
124
  else if (this.readonly()) parts.push("wr-cascader--readonly");
123
125
  return parts.join(" ");
@@ -136,13 +138,13 @@ var WrCascader = class WrCascader {
136
138
  dir = inject(Directionality, { optional: true });
137
139
  overlayRef = null;
138
140
  constructor() {
139
- this.destroyRef.onDestroy(() => this.closeOverlay());
141
+ this.destroyRef.onDestroy(() => this.closeOverlay(false));
140
142
  effect(() => {
141
- if (this.open()) this.openOverlay();
143
+ if (this.isOpen()) this.openOverlay();
142
144
  else this.closeOverlay();
143
145
  });
144
146
  effect(() => {
145
- if (this.disabled() || this.readonly()) this.open.set(false);
147
+ if (this.disabled() || this.readonly()) this.isOpen.set(false);
146
148
  });
147
149
  effect(() => {
148
150
  const value = this.value();
@@ -157,13 +159,21 @@ var WrCascader = class WrCascader {
157
159
  focus(options) {
158
160
  this.host.nativeElement.querySelector(".wr-cascader__trigger")?.focus(options);
159
161
  }
162
+ open() {
163
+ if (this.disabled() || this.readonly() || this.isOpen()) return;
164
+ this.activePath.set(this.path());
165
+ this.isOpen.set(true);
166
+ }
167
+ close() {
168
+ this.isOpen.set(false);
169
+ }
160
170
  onTriggerClick() {
161
171
  if (this.disabled() || this.readonly()) return;
162
- if (!this.open()) this.activePath.set(this.path());
163
- this.open.update((v) => !v);
172
+ if (!this.isOpen()) this.activePath.set(this.path());
173
+ this.isOpen.update((v) => !v);
164
174
  }
165
175
  onTriggerKeydown(event) {
166
- if (this.disabled() || this.readonly() || this.open()) return;
176
+ if (this.disabled() || this.readonly() || this.isOpen()) return;
167
177
  if (event.key === "Backspace") {
168
178
  if (!this.clearable() || !this.hasSelection()) return;
169
179
  event.preventDefault();
@@ -173,7 +183,7 @@ var WrCascader = class WrCascader {
173
183
  if (event.key !== "ArrowDown" && event.key !== "ArrowUp") return;
174
184
  event.preventDefault();
175
185
  this.activePath.set(this.path());
176
- this.open.set(true);
186
+ this.isOpen.set(true);
177
187
  }
178
188
  onOptionClick(colIndex, opt, event) {
179
189
  event.stopPropagation();
@@ -189,14 +199,14 @@ var WrCascader = class WrCascader {
189
199
  this.path.set(newPath);
190
200
  this.value.set(newPath);
191
201
  this.touch.emit();
192
- if (!hasChildren) this.open.set(false);
202
+ if (!hasChildren) this.isOpen.set(false);
193
203
  }
194
204
  }
195
205
  onOptionKeydown(colIndex, opt, event) {
196
206
  const current = event.currentTarget;
197
207
  const column = current.closest("[role=\"group\"]");
198
208
  if (!column) return;
199
- if (isPrintableKey(event) && event.key !== " ") {
209
+ if (wrIsPrintableKey(event) && event.key !== " ") {
200
210
  this.typeAhead(column, current, event.key);
201
211
  event.preventDefault();
202
212
  return;
@@ -312,7 +322,7 @@ var WrCascader = class WrCascader {
312
322
  this.overlayRef = this.overlay.create({
313
323
  positionStrategy,
314
324
  scrollStrategy: this.scrollStrategies.reposition(),
315
- panelClass: toClassList("wr-cascader-overlay", this.panelClass())
325
+ panelClass: wrToClassList("wr-cascader-overlay", this.panelClass())
316
326
  });
317
327
  wrFollowDirection(this.overlayRef, this.dir, this.injector);
318
328
  const portal = new TemplatePortal(this.panelTpl(), this.vcr);
@@ -320,29 +330,32 @@ var WrCascader = class WrCascader {
320
330
  afterNextRender(() => this.focusPanelOption(), { injector: this.injector });
321
331
  this.outsideClick.outsidePointerEvents(this.overlayRef).pipe(takeUntilDestroyed(this.destroyRef)).subscribe((event) => {
322
332
  if (this.host.nativeElement.contains(event.target)) return;
323
- this.open.set(false);
333
+ this.isOpen.set(false);
324
334
  });
325
335
  this.overlayRef.keydownEvents().pipe(takeUntilDestroyed(this.destroyRef)).subscribe((event) => {
326
336
  if (event.key === "Escape") {
327
337
  event.preventDefault();
328
- this.open.set(false);
338
+ this.isOpen.set(false);
329
339
  return;
330
340
  }
331
341
  if (this.overlayRef && tabLeavesPane(this.overlayRef.overlayElement, event)) {
332
342
  this.host.nativeElement.querySelector(".wr-cascader__trigger")?.focus();
333
- this.open.set(false);
343
+ this.isOpen.set(false);
334
344
  }
335
345
  });
346
+ this.opened.emit();
336
347
  }
337
348
  focusPanelOption() {
338
349
  this.overlayRef?.overlayElement.querySelector("[role=\"treeitem\"][tabindex=\"0\"]")?.focus();
339
350
  }
340
- closeOverlay() {
351
+ closeOverlay(notify = true) {
341
352
  if (!this.overlayRef) return;
342
353
  const focusWasInside = this.overlayRef.overlayElement.contains(this.host.nativeElement.ownerDocument.activeElement);
343
354
  this.overlayRef.dispose();
344
355
  this.overlayRef = null;
356
+ if (!notify) return;
345
357
  if (focusWasInside) this.host.nativeElement.querySelector(".wr-cascader__trigger")?.focus();
358
+ this.closed.emit();
346
359
  }
347
360
  static ɵfac = i0.ɵɵngDeclareFactory({
348
361
  minVersion: "12.0.0",
@@ -446,7 +459,9 @@ var WrCascader = class WrCascader {
446
459
  },
447
460
  outputs: {
448
461
  value: "valueChange",
449
- touch: "touch"
462
+ touch: "touch",
463
+ opened: "opened",
464
+ closed: "closed"
450
465
  },
451
466
  host: { properties: { "class": "classes()" } },
452
467
  viewQueries: [{
@@ -458,7 +473,7 @@ var WrCascader = class WrCascader {
458
473
  isSignal: true
459
474
  }],
460
475
  ngImport: i0,
461
- template: "<button\n type=\"button\"\n class=\"wr-cascader__trigger\"\n role=\"combobox\"\n [attr.aria-label]=\"nameLabel()\"\n [attr.aria-labelledby]=\"labelledBy()\"\n [disabled]=\"disabled()\"\n [attr.aria-haspopup]=\"'tree'\"\n [attr.aria-expanded]=\"open()\"\n [attr.aria-controls]=\"panelId\"\n [attr.aria-readonly]=\"readonly() || null\"\n [attr.aria-invalid]=\"fieldAria.ariaInvalid()\"\n [attr.aria-describedby]=\"fieldAria.describedBy()\"\n (click)=\"onTriggerClick()\"\n (keydown)=\"onTriggerKeydown($event)\"\n (blur)=\"touch.emit()\"\n>\n @if (displayLabel(); as label) {\n <span class=\"wr-cascader__value\">{{ label }}</span>\n } @else {\n <span class=\"wr-cascader__placeholder\">{{ placeholder() }}</span>\n }\n\n @if (clearable() && hasSelection() && !disabled() && !readonly()) {\n <span\n class=\"wr-cascader__clear\"\n role=\"button\"\n [attr.aria-label]=\"resolvedClearLabel()\"\n tabindex=\"-1\"\n (click)=\"clearSelection($event)\"\n >\n <svg\n class=\"wr-icon__svg\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n >\n <path d=\"M18 6 6 18\" />\n <path d=\"m6 6 12 12\" />\n </svg>\n </span>\n }\n\n <svg\n class=\"wr-icon__svg wr-cascader__chevron\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n >\n <path d=\"m6 9 6 6 6-6\" />\n </svg>\n</button>\n\n<ng-template #panelTpl>\n <div\n class=\"wr-cascader-panel\"\n [class.wr-cascader-panel--sm]=\"size() === 'sm'\"\n [class.wr-cascader-panel--lg]=\"size() === 'lg'\"\n role=\"tree\"\n [attr.id]=\"panelId\"\n [attr.aria-label]=\"resolvedAriaLabel()\"\n >\n <!--\n tree / group / treeitem, and NOT menu. A combobox's popup may be a listbox,\n a tree, a grid or a dialog and nothing else, so `aria-haspopup=\"menu\"` on\n the trigger was an author error — and a `menu` may own menuitems and\n groups, never other menus, so the columns were a second one. Neither is\n visible to axe: `menu` is a valid token for the global `aria-haspopup`, and\n `aria-required-children` passes a menu-inside-menu (measured against this\n exact fragment). A tree is what this control has always been — the value is\n a PATH, and only `treeitem` supports aria-expanded, aria-level,\n aria-setsize, aria-posinset and aria-selected at once.\n\n The columns stay `group` rather than collapsing to `role=\"presentation\"`,\n which is also axe-clean: the DOM is column-MAJOR, so a flat tree would\n leave level plus document order as the only structure, and \"Germany\"\n (level 2) would read as a child of \"Antarctica\" (level 1, the item\n immediately before it in source order).\n -->\n @for (col of columns(); track $index; let colIndex = $index) {\n <ul\n class=\"wr-cascader__col\"\n role=\"group\"\n [attr.id]=\"columnId(colIndex)\"\n [attr.aria-labelledby]=\"parentOptionId(colIndex)\"\n >\n @for (opt of col; track opt.value; let optIndex = $index) {\n <!--\n `aria-expanded` is exactly `isActiveAt`: `columns()` renders the next\n column for the active option and only when it has children, so the\n state can never claim a column that is not on screen — and\n `aria-controls` rides that same invariant, which is what makes\n \"expanded\" refer to something when the expanded content is a SIBLING\n rather than a descendant. It is emitted only while expanded: a\n reference to an absent id is a violation with `aria-expanded=\"true\"`\n and clean while collapsed.\n\n `aria-level` is load-bearing rather than decorative. The columns are\n siblings, so the DOM ancestry represents no level at all and every\n option would read as level 1. `aria-setsize` / `aria-posinset` are\n not strictly required — each column IS a complete sibling set — and\n are written anyway, because a tree that owns sibling groups is the\n uncommon shape where browser/AT pairs are known to miscompute both.\n\n `aria-selected` is written on every option that can be COMMITTED,\n `false` included, matching `wr-tree`. The alternative a reviewer may\n prefer: only the selected node, leaning on treeitem's implicit false,\n which is quieter in a long column and loses the \"this row is\n selectable\" signal that presence carries.\n\n `tabindex` is a ROVING stop, as in the APG tree pattern: one option\n carries `0` (see `tabStop`) and every other one `-1`, so the panel is\n one Tab to enter and one to leave, and the arrows move between options.\n -->\n <li\n class=\"wr-cascader__opt\"\n role=\"treeitem\"\n [attr.id]=\"optionId(colIndex, optIndex)\"\n [class.wr-cascader__opt--active]=\"isActiveAt(colIndex, opt.value)\"\n [class.wr-cascader__opt--disabled]=\"opt.disabled\"\n [attr.tabindex]=\"isTabStop(colIndex, opt) ? 0 : -1\"\n [attr.aria-disabled]=\"opt.disabled ? true : null\"\n [attr.aria-level]=\"colIndex + 1\"\n [attr.aria-setsize]=\"$count\"\n [attr.aria-posinset]=\"optIndex + 1\"\n [attr.aria-selected]=\"isSelectedAt(colIndex, opt)\"\n [attr.aria-expanded]=\"opt.children?.length ? isActiveAt(colIndex, opt.value) : null\"\n [attr.aria-controls]=\"\n opt.children?.length && isActiveAt(colIndex, opt.value) ? columnId(colIndex + 1) : null\n \"\n (click)=\"onOptionClick(colIndex, opt, $event)\"\n (focus)=\"onOptionFocus(colIndex, opt)\"\n (keydown)=\"onOptionKeydown(colIndex, opt, $event)\"\n (keydown.enter)=\"onOptionClick(colIndex, opt, $event)\"\n (keydown.space)=\"onOptionClick(colIndex, opt, $event)\"\n >\n <span class=\"wr-cascader__opt-label\">{{ opt.label }}</span>\n @if (opt.children?.length) {\n <svg\n class=\"wr-icon__svg wr-cascader__opt-arrow\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n >\n <path d=\"m9 18 6-6-6-6\" />\n </svg>\n }\n </li>\n }\n </ul>\n }\n </div>\n</ng-template>\n",
476
+ template: "<button\n type=\"button\"\n class=\"wr-cascader__trigger\"\n role=\"combobox\"\n [attr.aria-label]=\"nameLabel()\"\n [attr.aria-labelledby]=\"labelledBy()\"\n [disabled]=\"disabled()\"\n [attr.aria-haspopup]=\"'tree'\"\n [attr.aria-expanded]=\"isOpen()\"\n [attr.aria-controls]=\"panelId\"\n [attr.aria-readonly]=\"readonly() || null\"\n [attr.aria-invalid]=\"fieldAria.ariaInvalid()\"\n [attr.aria-describedby]=\"fieldAria.describedBy()\"\n (click)=\"onTriggerClick()\"\n (keydown)=\"onTriggerKeydown($event)\"\n (blur)=\"touch.emit()\"\n>\n @if (displayLabel(); as label) {\n <span class=\"wr-cascader__value\">{{ label }}</span>\n } @else {\n <span class=\"wr-cascader__placeholder\">{{ placeholder() }}</span>\n }\n\n @if (clearable() && hasSelection() && !disabled() && !readonly()) {\n <span\n class=\"wr-cascader__clear\"\n role=\"button\"\n [attr.aria-label]=\"resolvedClearLabel()\"\n tabindex=\"-1\"\n (click)=\"clearSelection($event)\"\n >\n <svg\n class=\"wr-icon__svg\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n >\n <path d=\"M18 6 6 18\" />\n <path d=\"m6 6 12 12\" />\n </svg>\n </span>\n }\n\n <svg\n class=\"wr-icon__svg wr-cascader__chevron\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n >\n <path d=\"m6 9 6 6 6-6\" />\n </svg>\n</button>\n\n<ng-template #panelTpl>\n <div\n class=\"wr-cascader-panel\"\n [class.wr-cascader-panel--sm]=\"size() === 'sm'\"\n [class.wr-cascader-panel--lg]=\"size() === 'lg'\"\n role=\"tree\"\n [attr.id]=\"panelId\"\n [attr.aria-label]=\"resolvedAriaLabel()\"\n >\n <!--\n tree / group / treeitem, and NOT menu. A combobox's popup may be a listbox,\n a tree, a grid or a dialog and nothing else, so `aria-haspopup=\"menu\"` on\n the trigger was an author error — and a `menu` may own menuitems and\n groups, never other menus, so the columns were a second one. Neither is\n visible to axe: `menu` is a valid token for the global `aria-haspopup`, and\n `aria-required-children` passes a menu-inside-menu (measured against this\n exact fragment). A tree is what this control has always been — the value is\n a PATH, and only `treeitem` supports aria-expanded, aria-level,\n aria-setsize, aria-posinset and aria-selected at once.\n\n The columns stay `group` rather than collapsing to `role=\"presentation\"`,\n which is also axe-clean: the DOM is column-MAJOR, so a flat tree would\n leave level plus document order as the only structure, and \"Germany\"\n (level 2) would read as a child of \"Antarctica\" (level 1, the item\n immediately before it in source order).\n -->\n @for (col of columns(); track $index; let colIndex = $index) {\n <ul\n class=\"wr-cascader__col\"\n role=\"group\"\n [attr.id]=\"columnId(colIndex)\"\n [attr.aria-labelledby]=\"parentOptionId(colIndex)\"\n >\n @for (opt of col; track opt.value; let optIndex = $index) {\n <!--\n `aria-expanded` is exactly `isActiveAt`: `columns()` renders the next\n column for the active option and only when it has children, so the\n state can never claim a column that is not on screen — and\n `aria-controls` rides that same invariant, which is what makes\n \"expanded\" refer to something when the expanded content is a SIBLING\n rather than a descendant. It is emitted only while expanded: a\n reference to an absent id is a violation with `aria-expanded=\"true\"`\n and clean while collapsed.\n\n `aria-level` is load-bearing rather than decorative. The columns are\n siblings, so the DOM ancestry represents no level at all and every\n option would read as level 1. `aria-setsize` / `aria-posinset` are\n not strictly required — each column IS a complete sibling set — and\n are written anyway, because a tree that owns sibling groups is the\n uncommon shape where browser/AT pairs are known to miscompute both.\n\n `aria-selected` is written on every option that can be COMMITTED,\n `false` included, matching `wr-tree`. The alternative a reviewer may\n prefer: only the selected node, leaning on treeitem's implicit false,\n which is quieter in a long column and loses the \"this row is\n selectable\" signal that presence carries.\n\n `tabindex` is a ROVING stop, as in the APG tree pattern: one option\n carries `0` (see `tabStop`) and every other one `-1`, so the panel is\n one Tab to enter and one to leave, and the arrows move between options.\n -->\n <li\n class=\"wr-cascader__opt\"\n role=\"treeitem\"\n [attr.id]=\"optionId(colIndex, optIndex)\"\n [class.wr-cascader__opt--active]=\"isActiveAt(colIndex, opt.value)\"\n [class.wr-cascader__opt--disabled]=\"opt.disabled\"\n [attr.tabindex]=\"isTabStop(colIndex, opt) ? 0 : -1\"\n [attr.aria-disabled]=\"opt.disabled ? true : null\"\n [attr.aria-level]=\"colIndex + 1\"\n [attr.aria-setsize]=\"$count\"\n [attr.aria-posinset]=\"optIndex + 1\"\n [attr.aria-selected]=\"isSelectedAt(colIndex, opt)\"\n [attr.aria-expanded]=\"opt.children?.length ? isActiveAt(colIndex, opt.value) : null\"\n [attr.aria-controls]=\"\n opt.children?.length && isActiveAt(colIndex, opt.value) ? columnId(colIndex + 1) : null\n \"\n (click)=\"onOptionClick(colIndex, opt, $event)\"\n (focus)=\"onOptionFocus(colIndex, opt)\"\n (keydown)=\"onOptionKeydown(colIndex, opt, $event)\"\n (keydown.enter)=\"onOptionClick(colIndex, opt, $event)\"\n (keydown.space)=\"onOptionClick(colIndex, opt, $event)\"\n >\n <span class=\"wr-cascader__opt-label\">{{ opt.label }}</span>\n @if (opt.children?.length) {\n <svg\n class=\"wr-icon__svg wr-cascader__opt-arrow\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n >\n <path d=\"m9 18 6-6-6-6\" />\n </svg>\n }\n </li>\n }\n </ul>\n }\n </div>\n</ng-template>\n",
462
477
  styles: [".wr-btn:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-table__sort-btn:focus-visible,.wr-table-filter__trigger:focus-visible,.wr-table__expand-btn:focus-visible,.wr-table__group-toggle:focus-visible,.wr-table__tree-toggle:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-table:has(>.wr-table__scroll:focus-visible){outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-table__scroll:focus-visible{outline:none}.wr-tabs__tab:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo);outline-offset:-2px}.wr-tabs__panel:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-sidebar__row:focus-visible,.wr-sidebar__toggle:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo);outline-offset:-2px}.wr-anchor__link:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-collapse__header:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo);outline-offset:-2px}.wr-collapse--flat .wr-collapse__header:focus-visible{outline-offset:var(--wr-focus-ring-offset)}.wr-command-palette__option:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-mention-panel__option:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-segmented__option:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-back-top:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-carousel__nav:focus-visible,.wr-carousel__dot:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-speed-dial__trigger:focus-visible,.wr-speed-dial__action:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-stepper__header-button:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-window__chrome-action:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-date-picker__trigger:focus-visible,.wr-time-picker__step:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-dropdown-item:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-alert__close:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-graph__viewport:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-chart-legend__toggle:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-pull-to-refresh:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-tree__toggle:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-color-picker__sv:focus-visible,.wr-color-picker__slider:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-input-group__toggle:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo);outline-offset:-2px}.wr-input-number__step:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo);outline-offset:-2px}.wr-file-upload__zone:focus-visible,.wr-file-upload__remove:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-event-calendar__more:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo);position:relative;z-index:1}.wr-cascader{--wr-cascader-color: var(--wr-color-on-surface);--wr-cascader-bg: var(--wr-color-surface);--wr-cascader-border: var(--wr-border-base);--wr-cascader-radius: var(--wr-control-radius-md);--wr-cascader-padding-y: var(--wr-control-padding-y-md);--wr-cascader-padding-x: var(--wr-control-padding-x-md);--wr-cascader-gap: var(--wr-space-sm);--wr-cascader-font-family: var(--wr-font-family-base);--wr-cascader-font-size: var(--wr-control-font-size-md);--wr-cascader-line-height: var(--wr-control-line-height-md);--wr-cascader-clear-radius: var(--wr-border-radius-pill);--wr-cascader-min-width: 12rem;display:inline-grid;grid-template-columns:minmax(0,1fr);grid-template-rows:auto 0;vertical-align:middle}.wr-cascader:after{content:\"\";flex:0 0 0;width:var(--wr-cascader-min-width);max-width:100%;height:0}.wr-cascader--disabled{--wr-cascader-color: var(--wr-color-on-surface-muted);--wr-cascader-bg: var(--wr-color-fill)}.wr-cascader--sm{--wr-cascader-radius: var(--wr-control-radius-sm);--wr-cascader-padding-y: var(--wr-control-padding-y-sm);--wr-cascader-padding-x: var(--wr-control-padding-x-sm);--wr-cascader-font-size: var(--wr-control-font-size-sm);--wr-cascader-line-height: var(--wr-control-line-height-sm)}.wr-cascader--lg{--wr-cascader-radius: var(--wr-control-radius-lg);--wr-cascader-padding-y: var(--wr-control-padding-y-lg);--wr-cascader-padding-x: var(--wr-control-padding-x-lg);--wr-cascader-font-size: var(--wr-control-font-size-lg);--wr-cascader-line-height: var(--wr-control-line-height-lg)}.wr-cascader__trigger{display:inline-flex;align-items:center;gap:var(--wr-cascader-gap);width:100%;min-width:0;appearance:none;background:var(--wr-cascader-bg);color:var(--wr-cascader-color);border:1px solid var(--wr-cascader-border);border-radius:var(--wr-cascader-radius);padding:calc(var(--wr-cascader-padding-y) * var(--wr-density-y, 1)) calc(var(--wr-cascader-padding-x) * var(--wr-density-x, 1));font-family:var(--wr-cascader-font-family);font-size:var(--wr-cascader-font-size);line-height:var(--wr-cascader-line-height);cursor:pointer;text-align:start;transition:border-color var(--wr-transition-base)}.wr-cascader__trigger:focus-visible{border-color:var(--wr-color-primary);outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-cascader__trigger:disabled{cursor:not-allowed}@media(pointer:coarse){.wr-cascader__trigger{overflow-y:clip}}.wr-cascader--readonly .wr-cascader__trigger{cursor:default}.wr-cascader--open .wr-cascader__trigger{border-color:var(--wr-color-primary);box-shadow:0 0 0 3px color-mix(in srgb,var(--wr-color-primary) 15%,transparent)}.wr-cascader__value,.wr-cascader__placeholder{flex:1 1 auto;min-height:1lh;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.wr-cascader__placeholder{color:var(--wr-color-placeholder)}.wr-cascader__chevron{flex:0 0 auto;color:var(--wr-color-on-surface-muted);transition:transform var(--wr-transition-base)}.wr-cascader--open .wr-cascader__chevron{transform:rotate(180deg)}.wr-cascader__clear{display:inline-flex;align-items:center;justify-content:center;width:1.125rem;height:1.125rem;margin-block:-1rem;border-radius:var(--wr-cascader-clear-radius);color:var(--wr-color-on-surface-muted);cursor:pointer;transition:background .12s ease,color .12s ease}.wr-cascader__clear:hover{background:color-mix(in srgb,var(--wr-color-on-surface) 6%,transparent);color:var(--wr-color-on-surface)}@media(pointer:coarse){.wr-cascader__clear{position:relative}.wr-cascader__clear:after{content:\"\";position:absolute;top:50%;left:50%;width:100%;height:100%;min-width:2rem;min-height:2rem;transform:translate(-50%,-50%)}}.wr-cascader-overlay{--wr-cascader-overlay-padding-top: var(--wr-space-xs);padding-top:var(--wr-cascader-overlay-padding-top)}.wr-cascader-panel{--wr-cascader-opt-font: var(--wr-control-font-size-md);--wr-cascader-opt-py: var(--wr-space-sm);--wr-cascader-opt-px: var(--wr-space-md);--wr-cascader-opt-gap: var(--wr-space-sm);--wr-cascader-opt-radius: var(--wr-border-radius-sm);--wr-cascader-opt-active-font-weight: var(--wr-font-weight-medium);--wr-cascader-col-width: 12rem;--wr-cascader-max-height: 16rem;--wr-cascader-col-padding: var(--wr-space-xs);--wr-cascader-col-gap: var(--wr-space-xs);--wr-cascader-col-border: var(--wr-border-base);--wr-cascader-panel-border: var(--wr-border-base);--wr-cascader-panel-radius: var(--wr-border-radius-base);--wr-cascader-panel-font-family: var(--wr-font-family-base);display:flex;background:var(--wr-color-surface);border:1px solid var(--wr-cascader-panel-border);border-radius:var(--wr-cascader-panel-radius);box-shadow:var(--wr-shadow-overlay);font-family:var(--wr-cascader-panel-font-family);font-size:var(--wr-cascader-opt-font);overflow:hidden}.wr-cascader-panel--sm{--wr-cascader-opt-font: var(--wr-control-font-size-sm);--wr-cascader-opt-py: var(--wr-space-xs)}.wr-cascader-panel--lg{--wr-cascader-opt-font: var(--wr-control-font-size-lg);--wr-cascader-opt-py: var(--wr-space-md)}.wr-cascader-panel .wr-cascader__col{list-style:none;margin:0;padding:var(--wr-cascader-col-padding);width:var(--wr-cascader-col-width);max-height:var(--wr-cascader-max-height);overflow-y:auto;display:flex;flex-direction:column;gap:var(--wr-cascader-col-gap)}.wr-cascader-panel .wr-cascader__col+.wr-cascader__col{border-inline-start:1px solid var(--wr-cascader-col-border)}.wr-cascader-panel .wr-cascader__opt{display:flex;align-items:center;gap:var(--wr-cascader-opt-gap);padding:var(--wr-cascader-opt-py) var(--wr-cascader-opt-px);border-radius:var(--wr-cascader-opt-radius);color:var(--wr-color-on-surface);cursor:pointer;transition:background var(--wr-transition-short)}.wr-cascader-panel .wr-cascader__opt:hover{background:var(--wr-color-hover)}.wr-cascader-panel .wr-cascader__opt--active{background:var(--wr-color-primary-soft);color:var(--wr-color-primary-ink);font-weight:var(--wr-cascader-opt-active-font-weight)}.wr-cascader-panel .wr-cascader__opt--disabled{color:var(--wr-color-on-surface-muted);cursor:not-allowed;opacity:var(--wr-disabled-opacity)}.wr-cascader-panel .wr-cascader__opt--disabled:hover{background:transparent}.wr-cascader-panel .wr-cascader__opt-label{flex:1 1 auto;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.wr-cascader-panel .wr-cascader__opt-arrow{flex:0 0 auto;color:var(--wr-color-on-surface-muted)}[dir=rtl] .wr-cascader-panel .wr-cascader__opt-arrow{transform:scaleX(-1)}@media(pointer:coarse){.wr-cascader-panel .wr-cascader__opt{--wr-cascader-opt-py: var(--wr-space-md)}}\n"],
463
478
  encapsulation: i0.ViewEncapsulation.None
464
479
  });
@@ -474,7 +489,7 @@ i0.ɵɵngDeclareClassMetadata({
474
489
  selector: "wr-cascader",
475
490
  encapsulation: ViewEncapsulation.None,
476
491
  host: { "[class]": "classes()" },
477
- template: "<button\n type=\"button\"\n class=\"wr-cascader__trigger\"\n role=\"combobox\"\n [attr.aria-label]=\"nameLabel()\"\n [attr.aria-labelledby]=\"labelledBy()\"\n [disabled]=\"disabled()\"\n [attr.aria-haspopup]=\"'tree'\"\n [attr.aria-expanded]=\"open()\"\n [attr.aria-controls]=\"panelId\"\n [attr.aria-readonly]=\"readonly() || null\"\n [attr.aria-invalid]=\"fieldAria.ariaInvalid()\"\n [attr.aria-describedby]=\"fieldAria.describedBy()\"\n (click)=\"onTriggerClick()\"\n (keydown)=\"onTriggerKeydown($event)\"\n (blur)=\"touch.emit()\"\n>\n @if (displayLabel(); as label) {\n <span class=\"wr-cascader__value\">{{ label }}</span>\n } @else {\n <span class=\"wr-cascader__placeholder\">{{ placeholder() }}</span>\n }\n\n @if (clearable() && hasSelection() && !disabled() && !readonly()) {\n <span\n class=\"wr-cascader__clear\"\n role=\"button\"\n [attr.aria-label]=\"resolvedClearLabel()\"\n tabindex=\"-1\"\n (click)=\"clearSelection($event)\"\n >\n <svg\n class=\"wr-icon__svg\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n >\n <path d=\"M18 6 6 18\" />\n <path d=\"m6 6 12 12\" />\n </svg>\n </span>\n }\n\n <svg\n class=\"wr-icon__svg wr-cascader__chevron\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n >\n <path d=\"m6 9 6 6 6-6\" />\n </svg>\n</button>\n\n<ng-template #panelTpl>\n <div\n class=\"wr-cascader-panel\"\n [class.wr-cascader-panel--sm]=\"size() === 'sm'\"\n [class.wr-cascader-panel--lg]=\"size() === 'lg'\"\n role=\"tree\"\n [attr.id]=\"panelId\"\n [attr.aria-label]=\"resolvedAriaLabel()\"\n >\n <!--\n tree / group / treeitem, and NOT menu. A combobox's popup may be a listbox,\n a tree, a grid or a dialog and nothing else, so `aria-haspopup=\"menu\"` on\n the trigger was an author error — and a `menu` may own menuitems and\n groups, never other menus, so the columns were a second one. Neither is\n visible to axe: `menu` is a valid token for the global `aria-haspopup`, and\n `aria-required-children` passes a menu-inside-menu (measured against this\n exact fragment). A tree is what this control has always been — the value is\n a PATH, and only `treeitem` supports aria-expanded, aria-level,\n aria-setsize, aria-posinset and aria-selected at once.\n\n The columns stay `group` rather than collapsing to `role=\"presentation\"`,\n which is also axe-clean: the DOM is column-MAJOR, so a flat tree would\n leave level plus document order as the only structure, and \"Germany\"\n (level 2) would read as a child of \"Antarctica\" (level 1, the item\n immediately before it in source order).\n -->\n @for (col of columns(); track $index; let colIndex = $index) {\n <ul\n class=\"wr-cascader__col\"\n role=\"group\"\n [attr.id]=\"columnId(colIndex)\"\n [attr.aria-labelledby]=\"parentOptionId(colIndex)\"\n >\n @for (opt of col; track opt.value; let optIndex = $index) {\n <!--\n `aria-expanded` is exactly `isActiveAt`: `columns()` renders the next\n column for the active option and only when it has children, so the\n state can never claim a column that is not on screen — and\n `aria-controls` rides that same invariant, which is what makes\n \"expanded\" refer to something when the expanded content is a SIBLING\n rather than a descendant. It is emitted only while expanded: a\n reference to an absent id is a violation with `aria-expanded=\"true\"`\n and clean while collapsed.\n\n `aria-level` is load-bearing rather than decorative. The columns are\n siblings, so the DOM ancestry represents no level at all and every\n option would read as level 1. `aria-setsize` / `aria-posinset` are\n not strictly required — each column IS a complete sibling set — and\n are written anyway, because a tree that owns sibling groups is the\n uncommon shape where browser/AT pairs are known to miscompute both.\n\n `aria-selected` is written on every option that can be COMMITTED,\n `false` included, matching `wr-tree`. The alternative a reviewer may\n prefer: only the selected node, leaning on treeitem's implicit false,\n which is quieter in a long column and loses the \"this row is\n selectable\" signal that presence carries.\n\n `tabindex` is a ROVING stop, as in the APG tree pattern: one option\n carries `0` (see `tabStop`) and every other one `-1`, so the panel is\n one Tab to enter and one to leave, and the arrows move between options.\n -->\n <li\n class=\"wr-cascader__opt\"\n role=\"treeitem\"\n [attr.id]=\"optionId(colIndex, optIndex)\"\n [class.wr-cascader__opt--active]=\"isActiveAt(colIndex, opt.value)\"\n [class.wr-cascader__opt--disabled]=\"opt.disabled\"\n [attr.tabindex]=\"isTabStop(colIndex, opt) ? 0 : -1\"\n [attr.aria-disabled]=\"opt.disabled ? true : null\"\n [attr.aria-level]=\"colIndex + 1\"\n [attr.aria-setsize]=\"$count\"\n [attr.aria-posinset]=\"optIndex + 1\"\n [attr.aria-selected]=\"isSelectedAt(colIndex, opt)\"\n [attr.aria-expanded]=\"opt.children?.length ? isActiveAt(colIndex, opt.value) : null\"\n [attr.aria-controls]=\"\n opt.children?.length && isActiveAt(colIndex, opt.value) ? columnId(colIndex + 1) : null\n \"\n (click)=\"onOptionClick(colIndex, opt, $event)\"\n (focus)=\"onOptionFocus(colIndex, opt)\"\n (keydown)=\"onOptionKeydown(colIndex, opt, $event)\"\n (keydown.enter)=\"onOptionClick(colIndex, opt, $event)\"\n (keydown.space)=\"onOptionClick(colIndex, opt, $event)\"\n >\n <span class=\"wr-cascader__opt-label\">{{ opt.label }}</span>\n @if (opt.children?.length) {\n <svg\n class=\"wr-icon__svg wr-cascader__opt-arrow\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n >\n <path d=\"m9 18 6-6-6-6\" />\n </svg>\n }\n </li>\n }\n </ul>\n }\n </div>\n</ng-template>\n",
492
+ template: "<button\n type=\"button\"\n class=\"wr-cascader__trigger\"\n role=\"combobox\"\n [attr.aria-label]=\"nameLabel()\"\n [attr.aria-labelledby]=\"labelledBy()\"\n [disabled]=\"disabled()\"\n [attr.aria-haspopup]=\"'tree'\"\n [attr.aria-expanded]=\"isOpen()\"\n [attr.aria-controls]=\"panelId\"\n [attr.aria-readonly]=\"readonly() || null\"\n [attr.aria-invalid]=\"fieldAria.ariaInvalid()\"\n [attr.aria-describedby]=\"fieldAria.describedBy()\"\n (click)=\"onTriggerClick()\"\n (keydown)=\"onTriggerKeydown($event)\"\n (blur)=\"touch.emit()\"\n>\n @if (displayLabel(); as label) {\n <span class=\"wr-cascader__value\">{{ label }}</span>\n } @else {\n <span class=\"wr-cascader__placeholder\">{{ placeholder() }}</span>\n }\n\n @if (clearable() && hasSelection() && !disabled() && !readonly()) {\n <span\n class=\"wr-cascader__clear\"\n role=\"button\"\n [attr.aria-label]=\"resolvedClearLabel()\"\n tabindex=\"-1\"\n (click)=\"clearSelection($event)\"\n >\n <svg\n class=\"wr-icon__svg\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n >\n <path d=\"M18 6 6 18\" />\n <path d=\"m6 6 12 12\" />\n </svg>\n </span>\n }\n\n <svg\n class=\"wr-icon__svg wr-cascader__chevron\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n >\n <path d=\"m6 9 6 6 6-6\" />\n </svg>\n</button>\n\n<ng-template #panelTpl>\n <div\n class=\"wr-cascader-panel\"\n [class.wr-cascader-panel--sm]=\"size() === 'sm'\"\n [class.wr-cascader-panel--lg]=\"size() === 'lg'\"\n role=\"tree\"\n [attr.id]=\"panelId\"\n [attr.aria-label]=\"resolvedAriaLabel()\"\n >\n <!--\n tree / group / treeitem, and NOT menu. A combobox's popup may be a listbox,\n a tree, a grid or a dialog and nothing else, so `aria-haspopup=\"menu\"` on\n the trigger was an author error — and a `menu` may own menuitems and\n groups, never other menus, so the columns were a second one. Neither is\n visible to axe: `menu` is a valid token for the global `aria-haspopup`, and\n `aria-required-children` passes a menu-inside-menu (measured against this\n exact fragment). A tree is what this control has always been — the value is\n a PATH, and only `treeitem` supports aria-expanded, aria-level,\n aria-setsize, aria-posinset and aria-selected at once.\n\n The columns stay `group` rather than collapsing to `role=\"presentation\"`,\n which is also axe-clean: the DOM is column-MAJOR, so a flat tree would\n leave level plus document order as the only structure, and \"Germany\"\n (level 2) would read as a child of \"Antarctica\" (level 1, the item\n immediately before it in source order).\n -->\n @for (col of columns(); track $index; let colIndex = $index) {\n <ul\n class=\"wr-cascader__col\"\n role=\"group\"\n [attr.id]=\"columnId(colIndex)\"\n [attr.aria-labelledby]=\"parentOptionId(colIndex)\"\n >\n @for (opt of col; track opt.value; let optIndex = $index) {\n <!--\n `aria-expanded` is exactly `isActiveAt`: `columns()` renders the next\n column for the active option and only when it has children, so the\n state can never claim a column that is not on screen — and\n `aria-controls` rides that same invariant, which is what makes\n \"expanded\" refer to something when the expanded content is a SIBLING\n rather than a descendant. It is emitted only while expanded: a\n reference to an absent id is a violation with `aria-expanded=\"true\"`\n and clean while collapsed.\n\n `aria-level` is load-bearing rather than decorative. The columns are\n siblings, so the DOM ancestry represents no level at all and every\n option would read as level 1. `aria-setsize` / `aria-posinset` are\n not strictly required — each column IS a complete sibling set — and\n are written anyway, because a tree that owns sibling groups is the\n uncommon shape where browser/AT pairs are known to miscompute both.\n\n `aria-selected` is written on every option that can be COMMITTED,\n `false` included, matching `wr-tree`. The alternative a reviewer may\n prefer: only the selected node, leaning on treeitem's implicit false,\n which is quieter in a long column and loses the \"this row is\n selectable\" signal that presence carries.\n\n `tabindex` is a ROVING stop, as in the APG tree pattern: one option\n carries `0` (see `tabStop`) and every other one `-1`, so the panel is\n one Tab to enter and one to leave, and the arrows move between options.\n -->\n <li\n class=\"wr-cascader__opt\"\n role=\"treeitem\"\n [attr.id]=\"optionId(colIndex, optIndex)\"\n [class.wr-cascader__opt--active]=\"isActiveAt(colIndex, opt.value)\"\n [class.wr-cascader__opt--disabled]=\"opt.disabled\"\n [attr.tabindex]=\"isTabStop(colIndex, opt) ? 0 : -1\"\n [attr.aria-disabled]=\"opt.disabled ? true : null\"\n [attr.aria-level]=\"colIndex + 1\"\n [attr.aria-setsize]=\"$count\"\n [attr.aria-posinset]=\"optIndex + 1\"\n [attr.aria-selected]=\"isSelectedAt(colIndex, opt)\"\n [attr.aria-expanded]=\"opt.children?.length ? isActiveAt(colIndex, opt.value) : null\"\n [attr.aria-controls]=\"\n opt.children?.length && isActiveAt(colIndex, opt.value) ? columnId(colIndex + 1) : null\n \"\n (click)=\"onOptionClick(colIndex, opt, $event)\"\n (focus)=\"onOptionFocus(colIndex, opt)\"\n (keydown)=\"onOptionKeydown(colIndex, opt, $event)\"\n (keydown.enter)=\"onOptionClick(colIndex, opt, $event)\"\n (keydown.space)=\"onOptionClick(colIndex, opt, $event)\"\n >\n <span class=\"wr-cascader__opt-label\">{{ opt.label }}</span>\n @if (opt.children?.length) {\n <svg\n class=\"wr-icon__svg wr-cascader__opt-arrow\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n >\n <path d=\"m9 18 6-6-6-6\" />\n </svg>\n }\n </li>\n }\n </ul>\n }\n </div>\n</ng-template>\n",
478
493
  styles: [".wr-btn:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-table__sort-btn:focus-visible,.wr-table-filter__trigger:focus-visible,.wr-table__expand-btn:focus-visible,.wr-table__group-toggle:focus-visible,.wr-table__tree-toggle:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-table:has(>.wr-table__scroll:focus-visible){outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-table__scroll:focus-visible{outline:none}.wr-tabs__tab:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo);outline-offset:-2px}.wr-tabs__panel:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-sidebar__row:focus-visible,.wr-sidebar__toggle:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo);outline-offset:-2px}.wr-anchor__link:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-collapse__header:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo);outline-offset:-2px}.wr-collapse--flat .wr-collapse__header:focus-visible{outline-offset:var(--wr-focus-ring-offset)}.wr-command-palette__option:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-mention-panel__option:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-segmented__option:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-back-top:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-carousel__nav:focus-visible,.wr-carousel__dot:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-speed-dial__trigger:focus-visible,.wr-speed-dial__action:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-stepper__header-button:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-window__chrome-action:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-date-picker__trigger:focus-visible,.wr-time-picker__step:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-dropdown-item:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-alert__close:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-graph__viewport:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-chart-legend__toggle:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-pull-to-refresh:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-tree__toggle:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-color-picker__sv:focus-visible,.wr-color-picker__slider:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-input-group__toggle:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo);outline-offset:-2px}.wr-input-number__step:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo);outline-offset:-2px}.wr-file-upload__zone:focus-visible,.wr-file-upload__remove:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-event-calendar__more:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo);position:relative;z-index:1}.wr-cascader{--wr-cascader-color: var(--wr-color-on-surface);--wr-cascader-bg: var(--wr-color-surface);--wr-cascader-border: var(--wr-border-base);--wr-cascader-radius: var(--wr-control-radius-md);--wr-cascader-padding-y: var(--wr-control-padding-y-md);--wr-cascader-padding-x: var(--wr-control-padding-x-md);--wr-cascader-gap: var(--wr-space-sm);--wr-cascader-font-family: var(--wr-font-family-base);--wr-cascader-font-size: var(--wr-control-font-size-md);--wr-cascader-line-height: var(--wr-control-line-height-md);--wr-cascader-clear-radius: var(--wr-border-radius-pill);--wr-cascader-min-width: 12rem;display:inline-grid;grid-template-columns:minmax(0,1fr);grid-template-rows:auto 0;vertical-align:middle}.wr-cascader:after{content:\"\";flex:0 0 0;width:var(--wr-cascader-min-width);max-width:100%;height:0}.wr-cascader--disabled{--wr-cascader-color: var(--wr-color-on-surface-muted);--wr-cascader-bg: var(--wr-color-fill)}.wr-cascader--sm{--wr-cascader-radius: var(--wr-control-radius-sm);--wr-cascader-padding-y: var(--wr-control-padding-y-sm);--wr-cascader-padding-x: var(--wr-control-padding-x-sm);--wr-cascader-font-size: var(--wr-control-font-size-sm);--wr-cascader-line-height: var(--wr-control-line-height-sm)}.wr-cascader--lg{--wr-cascader-radius: var(--wr-control-radius-lg);--wr-cascader-padding-y: var(--wr-control-padding-y-lg);--wr-cascader-padding-x: var(--wr-control-padding-x-lg);--wr-cascader-font-size: var(--wr-control-font-size-lg);--wr-cascader-line-height: var(--wr-control-line-height-lg)}.wr-cascader__trigger{display:inline-flex;align-items:center;gap:var(--wr-cascader-gap);width:100%;min-width:0;appearance:none;background:var(--wr-cascader-bg);color:var(--wr-cascader-color);border:1px solid var(--wr-cascader-border);border-radius:var(--wr-cascader-radius);padding:calc(var(--wr-cascader-padding-y) * var(--wr-density-y, 1)) calc(var(--wr-cascader-padding-x) * var(--wr-density-x, 1));font-family:var(--wr-cascader-font-family);font-size:var(--wr-cascader-font-size);line-height:var(--wr-cascader-line-height);cursor:pointer;text-align:start;transition:border-color var(--wr-transition-base)}.wr-cascader__trigger:focus-visible{border-color:var(--wr-color-primary);outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-cascader__trigger:disabled{cursor:not-allowed}@media(pointer:coarse){.wr-cascader__trigger{overflow-y:clip}}.wr-cascader--readonly .wr-cascader__trigger{cursor:default}.wr-cascader--open .wr-cascader__trigger{border-color:var(--wr-color-primary);box-shadow:0 0 0 3px color-mix(in srgb,var(--wr-color-primary) 15%,transparent)}.wr-cascader__value,.wr-cascader__placeholder{flex:1 1 auto;min-height:1lh;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.wr-cascader__placeholder{color:var(--wr-color-placeholder)}.wr-cascader__chevron{flex:0 0 auto;color:var(--wr-color-on-surface-muted);transition:transform var(--wr-transition-base)}.wr-cascader--open .wr-cascader__chevron{transform:rotate(180deg)}.wr-cascader__clear{display:inline-flex;align-items:center;justify-content:center;width:1.125rem;height:1.125rem;margin-block:-1rem;border-radius:var(--wr-cascader-clear-radius);color:var(--wr-color-on-surface-muted);cursor:pointer;transition:background .12s ease,color .12s ease}.wr-cascader__clear:hover{background:color-mix(in srgb,var(--wr-color-on-surface) 6%,transparent);color:var(--wr-color-on-surface)}@media(pointer:coarse){.wr-cascader__clear{position:relative}.wr-cascader__clear:after{content:\"\";position:absolute;top:50%;left:50%;width:100%;height:100%;min-width:2rem;min-height:2rem;transform:translate(-50%,-50%)}}.wr-cascader-overlay{--wr-cascader-overlay-padding-top: var(--wr-space-xs);padding-top:var(--wr-cascader-overlay-padding-top)}.wr-cascader-panel{--wr-cascader-opt-font: var(--wr-control-font-size-md);--wr-cascader-opt-py: var(--wr-space-sm);--wr-cascader-opt-px: var(--wr-space-md);--wr-cascader-opt-gap: var(--wr-space-sm);--wr-cascader-opt-radius: var(--wr-border-radius-sm);--wr-cascader-opt-active-font-weight: var(--wr-font-weight-medium);--wr-cascader-col-width: 12rem;--wr-cascader-max-height: 16rem;--wr-cascader-col-padding: var(--wr-space-xs);--wr-cascader-col-gap: var(--wr-space-xs);--wr-cascader-col-border: var(--wr-border-base);--wr-cascader-panel-border: var(--wr-border-base);--wr-cascader-panel-radius: var(--wr-border-radius-base);--wr-cascader-panel-font-family: var(--wr-font-family-base);display:flex;background:var(--wr-color-surface);border:1px solid var(--wr-cascader-panel-border);border-radius:var(--wr-cascader-panel-radius);box-shadow:var(--wr-shadow-overlay);font-family:var(--wr-cascader-panel-font-family);font-size:var(--wr-cascader-opt-font);overflow:hidden}.wr-cascader-panel--sm{--wr-cascader-opt-font: var(--wr-control-font-size-sm);--wr-cascader-opt-py: var(--wr-space-xs)}.wr-cascader-panel--lg{--wr-cascader-opt-font: var(--wr-control-font-size-lg);--wr-cascader-opt-py: var(--wr-space-md)}.wr-cascader-panel .wr-cascader__col{list-style:none;margin:0;padding:var(--wr-cascader-col-padding);width:var(--wr-cascader-col-width);max-height:var(--wr-cascader-max-height);overflow-y:auto;display:flex;flex-direction:column;gap:var(--wr-cascader-col-gap)}.wr-cascader-panel .wr-cascader__col+.wr-cascader__col{border-inline-start:1px solid var(--wr-cascader-col-border)}.wr-cascader-panel .wr-cascader__opt{display:flex;align-items:center;gap:var(--wr-cascader-opt-gap);padding:var(--wr-cascader-opt-py) var(--wr-cascader-opt-px);border-radius:var(--wr-cascader-opt-radius);color:var(--wr-color-on-surface);cursor:pointer;transition:background var(--wr-transition-short)}.wr-cascader-panel .wr-cascader__opt:hover{background:var(--wr-color-hover)}.wr-cascader-panel .wr-cascader__opt--active{background:var(--wr-color-primary-soft);color:var(--wr-color-primary-ink);font-weight:var(--wr-cascader-opt-active-font-weight)}.wr-cascader-panel .wr-cascader__opt--disabled{color:var(--wr-color-on-surface-muted);cursor:not-allowed;opacity:var(--wr-disabled-opacity)}.wr-cascader-panel .wr-cascader__opt--disabled:hover{background:transparent}.wr-cascader-panel .wr-cascader__opt-label{flex:1 1 auto;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.wr-cascader-panel .wr-cascader__opt-arrow{flex:0 0 auto;color:var(--wr-color-on-surface-muted)}[dir=rtl] .wr-cascader-panel .wr-cascader__opt-arrow{transform:scaleX(-1)}@media(pointer:coarse){.wr-cascader-panel .wr-cascader__opt{--wr-cascader-opt-py: var(--wr-space-md)}}\n"]
479
494
  }]
480
495
  }],
@@ -583,6 +598,14 @@ i0.ɵɵngDeclareClassMetadata({
583
598
  type: i0.Output,
584
599
  args: ["touch"]
585
600
  }],
601
+ opened: [{
602
+ type: i0.Output,
603
+ args: ["opened"]
604
+ }],
605
+ closed: [{
606
+ type: i0.Output,
607
+ args: ["closed"]
608
+ }],
586
609
  panelTpl: [{
587
610
  type: i0.ViewChild,
588
611
  args: ["panelTpl", {