ngwr 16.0.0 → 16.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (295) hide show
  1. package/badge/styles/_tag.scss +8 -4
  2. package/button/styles/_index.scss +13 -7
  3. package/cascader/styles/_rules.scss +4 -2
  4. package/checkbox/styles/_index.scss +4 -2
  5. package/date-picker/styles/_index.scss +95 -3
  6. package/date-stamp/styles/_index.scss +38 -0
  7. package/dialog/styles/_index.scss +38 -0
  8. package/dropdown/styles/_index.scss +37 -1
  9. package/fesm2022/internal-CVLvP9b_.mjs +33 -0
  10. package/fesm2022/internal-CVLvP9b_.mjs.map +1 -0
  11. package/fesm2022/ngwr-alert.mjs +11 -7
  12. package/fesm2022/ngwr-alert.mjs.map +1 -1
  13. package/fesm2022/ngwr-avatar.mjs +11 -7
  14. package/fesm2022/ngwr-avatar.mjs.map +1 -1
  15. package/fesm2022/ngwr-back-top.mjs +10 -6
  16. package/fesm2022/ngwr-back-top.mjs.map +1 -1
  17. package/fesm2022/ngwr-badge.mjs +18 -6
  18. package/fesm2022/ngwr-badge.mjs.map +1 -1
  19. package/fesm2022/ngwr-burger.mjs +9 -6
  20. package/fesm2022/ngwr-burger.mjs.map +1 -1
  21. package/fesm2022/ngwr-button.mjs +8 -4
  22. package/fesm2022/ngwr-button.mjs.map +1 -1
  23. package/fesm2022/ngwr-calendar.mjs +19 -8
  24. package/fesm2022/ngwr-calendar.mjs.map +1 -1
  25. package/fesm2022/ngwr-card.mjs +9 -5
  26. package/fesm2022/ngwr-card.mjs.map +1 -1
  27. package/fesm2022/ngwr-cascader.mjs +11 -5
  28. package/fesm2022/ngwr-cascader.mjs.map +1 -1
  29. package/fesm2022/ngwr-charts-calendar-heatmap.mjs +5 -2
  30. package/fesm2022/ngwr-charts-calendar-heatmap.mjs.map +1 -1
  31. package/fesm2022/ngwr-checkbox.mjs +10 -6
  32. package/fesm2022/ngwr-checkbox.mjs.map +1 -1
  33. package/fesm2022/ngwr-clipboard.mjs +2 -1
  34. package/fesm2022/ngwr-clipboard.mjs.map +1 -1
  35. package/fesm2022/ngwr-collapse.mjs +9 -5
  36. package/fesm2022/ngwr-collapse.mjs.map +1 -1
  37. package/fesm2022/ngwr-color-picker.mjs +4 -2
  38. package/fesm2022/ngwr-color-picker.mjs.map +1 -1
  39. package/fesm2022/ngwr-comment.mjs +13 -7
  40. package/fesm2022/ngwr-comment.mjs.map +1 -1
  41. package/fesm2022/ngwr-compare.mjs +9 -3
  42. package/fesm2022/ngwr-compare.mjs.map +1 -1
  43. package/fesm2022/ngwr-context-menu.mjs +4 -2
  44. package/fesm2022/ngwr-context-menu.mjs.map +1 -1
  45. package/fesm2022/ngwr-copy-value.mjs +11 -6
  46. package/fesm2022/ngwr-copy-value.mjs.map +1 -1
  47. package/fesm2022/ngwr-date-picker-testing.mjs +18 -0
  48. package/fesm2022/ngwr-date-picker-testing.mjs.map +1 -1
  49. package/fesm2022/ngwr-date-picker.mjs +238 -38
  50. package/fesm2022/ngwr-date-picker.mjs.map +1 -1
  51. package/fesm2022/ngwr-date-stamp-testing.mjs +34 -0
  52. package/fesm2022/ngwr-date-stamp-testing.mjs.map +1 -0
  53. package/fesm2022/ngwr-date-stamp.mjs +213 -0
  54. package/fesm2022/ngwr-date-stamp.mjs.map +1 -0
  55. package/fesm2022/ngwr-date.mjs +364 -54
  56. package/fesm2022/ngwr-date.mjs.map +1 -1
  57. package/fesm2022/ngwr-descriptions.mjs +9 -5
  58. package/fesm2022/ngwr-descriptions.mjs.map +1 -1
  59. package/fesm2022/ngwr-dialog-testing.mjs +23 -2
  60. package/fesm2022/ngwr-dialog-testing.mjs.map +1 -1
  61. package/fesm2022/ngwr-dialog.mjs +45 -16
  62. package/fesm2022/ngwr-dialog.mjs.map +1 -1
  63. package/fesm2022/ngwr-directives.mjs +102 -11
  64. package/fesm2022/ngwr-directives.mjs.map +1 -1
  65. package/fesm2022/ngwr-divider.mjs +4 -2
  66. package/fesm2022/ngwr-divider.mjs.map +1 -1
  67. package/fesm2022/ngwr-drawer.mjs +29 -3
  68. package/fesm2022/ngwr-drawer.mjs.map +1 -1
  69. package/fesm2022/ngwr-dropdown-testing.mjs +38 -3
  70. package/fesm2022/ngwr-dropdown-testing.mjs.map +1 -1
  71. package/fesm2022/ngwr-dropdown.mjs +362 -26
  72. package/fesm2022/ngwr-dropdown.mjs.map +1 -1
  73. package/fesm2022/ngwr-editor.mjs +5 -2
  74. package/fesm2022/ngwr-editor.mjs.map +1 -1
  75. package/fesm2022/ngwr-event-calendar.mjs +4 -2
  76. package/fesm2022/ngwr-event-calendar.mjs.map +1 -1
  77. package/fesm2022/ngwr-file-upload.mjs +9 -3
  78. package/fesm2022/ngwr-file-upload.mjs.map +1 -1
  79. package/fesm2022/ngwr-form.mjs +18 -6
  80. package/fesm2022/ngwr-form.mjs.map +1 -1
  81. package/fesm2022/ngwr-i18n-ar.mjs +9 -2
  82. package/fesm2022/ngwr-i18n-ar.mjs.map +1 -1
  83. package/fesm2022/ngwr-i18n-cs.mjs +9 -2
  84. package/fesm2022/ngwr-i18n-cs.mjs.map +1 -1
  85. package/fesm2022/ngwr-i18n-de.mjs +9 -2
  86. package/fesm2022/ngwr-i18n-de.mjs.map +1 -1
  87. package/fesm2022/ngwr-i18n-en.mjs +9 -2
  88. package/fesm2022/ngwr-i18n-en.mjs.map +1 -1
  89. package/fesm2022/ngwr-i18n-es.mjs +9 -2
  90. package/fesm2022/ngwr-i18n-es.mjs.map +1 -1
  91. package/fesm2022/ngwr-i18n-fr.mjs +9 -2
  92. package/fesm2022/ngwr-i18n-fr.mjs.map +1 -1
  93. package/fesm2022/ngwr-i18n-he.mjs +9 -2
  94. package/fesm2022/ngwr-i18n-he.mjs.map +1 -1
  95. package/fesm2022/ngwr-i18n-hi.mjs +9 -2
  96. package/fesm2022/ngwr-i18n-hi.mjs.map +1 -1
  97. package/fesm2022/ngwr-i18n-id.mjs +9 -2
  98. package/fesm2022/ngwr-i18n-id.mjs.map +1 -1
  99. package/fesm2022/ngwr-i18n-it.mjs +9 -2
  100. package/fesm2022/ngwr-i18n-it.mjs.map +1 -1
  101. package/fesm2022/ngwr-i18n-ja.mjs +9 -2
  102. package/fesm2022/ngwr-i18n-ja.mjs.map +1 -1
  103. package/fesm2022/ngwr-i18n-ko.mjs +9 -2
  104. package/fesm2022/ngwr-i18n-ko.mjs.map +1 -1
  105. package/fesm2022/ngwr-i18n-nl.mjs +9 -2
  106. package/fesm2022/ngwr-i18n-nl.mjs.map +1 -1
  107. package/fesm2022/ngwr-i18n-pl.mjs +9 -2
  108. package/fesm2022/ngwr-i18n-pl.mjs.map +1 -1
  109. package/fesm2022/ngwr-i18n-pt.mjs +9 -2
  110. package/fesm2022/ngwr-i18n-pt.mjs.map +1 -1
  111. package/fesm2022/ngwr-i18n-ru.mjs +9 -2
  112. package/fesm2022/ngwr-i18n-ru.mjs.map +1 -1
  113. package/fesm2022/ngwr-i18n-sv.mjs +9 -2
  114. package/fesm2022/ngwr-i18n-sv.mjs.map +1 -1
  115. package/fesm2022/ngwr-i18n-tr.mjs +9 -2
  116. package/fesm2022/ngwr-i18n-tr.mjs.map +1 -1
  117. package/fesm2022/ngwr-i18n-uk.mjs +9 -2
  118. package/fesm2022/ngwr-i18n-uk.mjs.map +1 -1
  119. package/fesm2022/ngwr-i18n-vi.mjs +9 -2
  120. package/fesm2022/ngwr-i18n-vi.mjs.map +1 -1
  121. package/fesm2022/ngwr-i18n-zh-tw.mjs +9 -2
  122. package/fesm2022/ngwr-i18n-zh-tw.mjs.map +1 -1
  123. package/fesm2022/ngwr-i18n-zh.mjs +9 -2
  124. package/fesm2022/ngwr-i18n-zh.mjs.map +1 -1
  125. package/fesm2022/ngwr-i18n.mjs +34 -8
  126. package/fesm2022/ngwr-i18n.mjs.map +1 -1
  127. package/fesm2022/ngwr-input-number.mjs +9 -3
  128. package/fesm2022/ngwr-input-number.mjs.map +1 -1
  129. package/fesm2022/ngwr-input-otp.mjs +4 -2
  130. package/fesm2022/ngwr-input-otp.mjs.map +1 -1
  131. package/fesm2022/ngwr-input.mjs +20 -10
  132. package/fesm2022/ngwr-input.mjs.map +1 -1
  133. package/fesm2022/ngwr-keyboard.mjs +9 -3
  134. package/fesm2022/ngwr-keyboard.mjs.map +1 -1
  135. package/fesm2022/ngwr-knob.mjs +9 -3
  136. package/fesm2022/ngwr-knob.mjs.map +1 -1
  137. package/fesm2022/ngwr-layout.mjs +13 -5
  138. package/fesm2022/ngwr-layout.mjs.map +1 -1
  139. package/fesm2022/ngwr-lightbox-testing.mjs +26 -0
  140. package/fesm2022/ngwr-lightbox-testing.mjs.map +1 -1
  141. package/fesm2022/ngwr-lightbox.mjs +255 -15
  142. package/fesm2022/ngwr-lightbox.mjs.map +1 -1
  143. package/fesm2022/ngwr-list.mjs +13 -5
  144. package/fesm2022/ngwr-list.mjs.map +1 -1
  145. package/fesm2022/ngwr-load-state.mjs +9 -5
  146. package/fesm2022/ngwr-load-state.mjs.map +1 -1
  147. package/fesm2022/ngwr-overlay.mjs +84 -1
  148. package/fesm2022/ngwr-overlay.mjs.map +1 -1
  149. package/fesm2022/ngwr-pagination.mjs +3 -2
  150. package/fesm2022/ngwr-pagination.mjs.map +1 -1
  151. package/fesm2022/ngwr-pipes.mjs +47 -9
  152. package/fesm2022/ngwr-pipes.mjs.map +1 -1
  153. package/fesm2022/ngwr-popover.mjs +93 -4
  154. package/fesm2022/ngwr-popover.mjs.map +1 -1
  155. package/fesm2022/ngwr-progress.mjs +4 -2
  156. package/fesm2022/ngwr-progress.mjs.map +1 -1
  157. package/fesm2022/ngwr-radio.mjs +9 -5
  158. package/fesm2022/ngwr-radio.mjs.map +1 -1
  159. package/fesm2022/ngwr-rating.mjs +9 -3
  160. package/fesm2022/ngwr-rating.mjs.map +1 -1
  161. package/fesm2022/ngwr-resizable.mjs +503 -0
  162. package/fesm2022/ngwr-resizable.mjs.map +1 -0
  163. package/fesm2022/ngwr-result.mjs +9 -5
  164. package/fesm2022/ngwr-result.mjs.map +1 -1
  165. package/fesm2022/ngwr-schema-form.mjs +3 -0
  166. package/fesm2022/ngwr-schema-form.mjs.map +1 -1
  167. package/fesm2022/ngwr-segmented.mjs +4 -2
  168. package/fesm2022/ngwr-segmented.mjs.map +1 -1
  169. package/fesm2022/ngwr-select.mjs +13 -5
  170. package/fesm2022/ngwr-select.mjs.map +1 -1
  171. package/fesm2022/ngwr-skeleton.mjs +4 -2
  172. package/fesm2022/ngwr-skeleton.mjs.map +1 -1
  173. package/fesm2022/ngwr-slider-testing.mjs +17 -0
  174. package/fesm2022/ngwr-slider-testing.mjs.map +1 -1
  175. package/fesm2022/ngwr-slider.mjs +91 -13
  176. package/fesm2022/ngwr-slider.mjs.map +1 -1
  177. package/fesm2022/ngwr-sortable-list-testing.mjs +103 -0
  178. package/fesm2022/ngwr-sortable-list-testing.mjs.map +1 -0
  179. package/fesm2022/ngwr-sortable-list.mjs +257 -53
  180. package/fesm2022/ngwr-sortable-list.mjs.map +1 -1
  181. package/fesm2022/ngwr-speed-dial.mjs +4 -2
  182. package/fesm2022/ngwr-speed-dial.mjs.map +1 -1
  183. package/fesm2022/ngwr-spinner.mjs +4 -2
  184. package/fesm2022/ngwr-spinner.mjs.map +1 -1
  185. package/fesm2022/ngwr-splitter.mjs +17 -21
  186. package/fesm2022/ngwr-splitter.mjs.map +1 -1
  187. package/fesm2022/ngwr-stepper.mjs +9 -3
  188. package/fesm2022/ngwr-stepper.mjs.map +1 -1
  189. package/fesm2022/ngwr-switch.mjs +9 -5
  190. package/fesm2022/ngwr-switch.mjs.map +1 -1
  191. package/fesm2022/ngwr-table-testing.mjs +5 -1
  192. package/fesm2022/ngwr-table-testing.mjs.map +1 -1
  193. package/fesm2022/ngwr-table.mjs +167 -10
  194. package/fesm2022/ngwr-table.mjs.map +1 -1
  195. package/fesm2022/ngwr-textarea.mjs +9 -3
  196. package/fesm2022/ngwr-textarea.mjs.map +1 -1
  197. package/fesm2022/ngwr-timeline.mjs +18 -8
  198. package/fesm2022/ngwr-timeline.mjs.map +1 -1
  199. package/fesm2022/ngwr-toast-testing.mjs +6 -1
  200. package/fesm2022/ngwr-toast-testing.mjs.map +1 -1
  201. package/fesm2022/ngwr-toast.mjs +529 -104
  202. package/fesm2022/ngwr-toast.mjs.map +1 -1
  203. package/fesm2022/ngwr-transfer.mjs +4 -2
  204. package/fesm2022/ngwr-transfer.mjs.map +1 -1
  205. package/fesm2022/ngwr-tree.mjs +4 -2
  206. package/fesm2022/ngwr-tree.mjs.map +1 -1
  207. package/fesm2022/ngwr-typography.mjs +9 -3
  208. package/fesm2022/ngwr-typography.mjs.map +1 -1
  209. package/fesm2022/ngwr-utils-router.mjs +18 -2
  210. package/fesm2022/ngwr-utils-router.mjs.map +1 -1
  211. package/fesm2022/ngwr-utils.mjs +9 -2
  212. package/fesm2022/ngwr-utils.mjs.map +1 -1
  213. package/fesm2022/ngwr-version.mjs +1 -1
  214. package/fesm2022/ngwr-version.mjs.map +1 -1
  215. package/fesm2022/ngwr-window.mjs +7 -4
  216. package/fesm2022/ngwr-window.mjs.map +1 -1
  217. package/fesm2022/ngwr.mjs.map +1 -1
  218. package/i18n/ar.json +13 -2
  219. package/i18n/cs.json +13 -2
  220. package/i18n/de.json +13 -2
  221. package/i18n/en.json +13 -2
  222. package/i18n/es.json +13 -2
  223. package/i18n/fr.json +13 -2
  224. package/i18n/he.json +13 -2
  225. package/i18n/hi.json +13 -2
  226. package/i18n/id.json +13 -2
  227. package/i18n/it.json +13 -2
  228. package/i18n/ja.json +13 -2
  229. package/i18n/ko.json +13 -2
  230. package/i18n/nl.json +13 -2
  231. package/i18n/pl.json +13 -2
  232. package/i18n/pt.json +13 -2
  233. package/i18n/ru.json +13 -2
  234. package/i18n/sv.json +13 -2
  235. package/i18n/tr.json +13 -2
  236. package/i18n/uk.json +13 -2
  237. package/i18n/vi.json +13 -2
  238. package/i18n/zh-TW.json +13 -2
  239. package/i18n/zh.json +13 -2
  240. package/input/styles/_index.scss +10 -5
  241. package/input-number/styles/_index.scss +6 -3
  242. package/input-otp/styles/_index.scss +4 -2
  243. package/lightbox/styles/_rules.scss +96 -0
  244. package/llms-full.txt +40 -17
  245. package/llms.txt +20 -4
  246. package/package.json +19 -1
  247. package/radio/styles/_index.scss +4 -2
  248. package/resizable/styles/_index.scss +154 -0
  249. package/schematics/use/rule.js +1 -0
  250. package/schematics/use/symbol-map.json +5 -0
  251. package/select/styles/_index.scss +6 -3
  252. package/skills/ngwr/SKILL.md +1 -1
  253. package/skills/ngwr/references/catalog.md +6 -2
  254. package/skills/ngwr/references/setup.md +3 -0
  255. package/slider/styles/_index.scss +106 -0
  256. package/sortable-list/styles/_rules.scss +23 -1
  257. package/switch/styles/_index.scss +4 -2
  258. package/table/styles/_index.scss +53 -0
  259. package/textarea/styles/_index.scss +4 -2
  260. package/theme/styles/_motion.scss +6 -0
  261. package/toast/styles/_index.scss +19 -0
  262. package/types/ngwr-burger.d.ts +0 -1
  263. package/types/ngwr-calendar.d.ts +7 -0
  264. package/types/ngwr-charts-calendar-heatmap.d.ts +2 -1
  265. package/types/ngwr-clipboard.d.ts +7 -0
  266. package/types/ngwr-date-picker-testing.d.ts +17 -0
  267. package/types/ngwr-date-picker.d.ts +88 -4
  268. package/types/ngwr-date-stamp-testing.d.ts +47 -0
  269. package/types/ngwr-date-stamp.d.ts +127 -0
  270. package/types/ngwr-date.d.ts +251 -37
  271. package/types/ngwr-dialog-testing.d.ts +10 -0
  272. package/types/ngwr-dialog.d.ts +72 -4
  273. package/types/ngwr-directives.d.ts +36 -1
  274. package/types/ngwr-drawer.d.ts +21 -0
  275. package/types/ngwr-dropdown-testing.d.ts +53 -5
  276. package/types/ngwr-dropdown.d.ts +100 -0
  277. package/types/ngwr-i18n.d.ts +44 -14
  278. package/types/ngwr-lightbox-testing.d.ts +27 -0
  279. package/types/ngwr-lightbox.d.ts +71 -6
  280. package/types/ngwr-overlay.d.ts +36 -0
  281. package/types/ngwr-pipes.d.ts +48 -13
  282. package/types/ngwr-popover.d.ts +39 -1
  283. package/types/ngwr-resizable.d.ts +228 -0
  284. package/types/ngwr-slider-testing.d.ts +8 -1
  285. package/types/ngwr-slider.d.ts +89 -3
  286. package/types/ngwr-sortable-list-testing.d.ts +79 -0
  287. package/types/ngwr-sortable-list.d.ts +113 -10
  288. package/types/ngwr-table-testing.d.ts +3 -1
  289. package/types/ngwr-table.d.ts +120 -4
  290. package/types/ngwr-toast-testing.d.ts +12 -1
  291. package/types/ngwr-toast.d.ts +215 -18
  292. package/types/ngwr-utils-router.d.ts +22 -0
  293. package/types/ngwr-utils.d.ts +8 -1
  294. package/types/ngwr-version.d.ts +1 -1
  295. package/types/ngwr.d.ts +1 -0
@@ -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 { 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;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;AAsDA,IAAa,WAAb,MAAa,SAAQ;CAOV,MAAM,MAAqB,MAAK,GAAA,YAAA,CAAA,EAAA,WAAA,MAAA,CAAA,+BAAA,CAAA,CA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AA;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: 'wr-avatar',\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: string[] = [];\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,KAA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C,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"}
@@ -28,7 +28,7 @@ var WrBackTop = class WrBackTop {
28
28
  zone = inject(NgZone);
29
29
  destroyRef = inject(DestroyRef);
30
30
  classes = computed(() => {
31
- const parts = ["wr-back-top"];
31
+ const parts = [];
32
32
  if (this.visible()) parts.push("wr-back-top--visible");
33
33
  return parts.join(" ");
34
34
  }, ...ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []);
@@ -83,11 +83,14 @@ var WrBackTop = class WrBackTop {
83
83
  transformFunction: null
84
84
  }
85
85
  },
86
- host: { properties: {
87
- "class": "classes()",
88
- "attr.aria-hidden": "!visible()",
89
- "attr.inert": "visible() ? null : ''"
90
- } },
86
+ host: {
87
+ properties: {
88
+ "class": "classes()",
89
+ "attr.aria-hidden": "!visible()",
90
+ "attr.inert": "visible() ? null : ''"
91
+ },
92
+ classAttribute: "wr-back-top"
93
+ },
91
94
  ngImport: i0,
92
95
  template: "<button type=\"button\" class=\"wr-back-top__button\" [attr.aria-label]=\"resolvedAriaLabel()\" (click)=\"onClick()\">\n <!-- The arrow is FALLBACK content: rendered next to a projected icon rather\n than instead of it, the documented custom-icon example put two glyphs in\n one 44px circle. -->\n <ng-content>\n <svg width=\"18\" height=\"18\" viewBox=\"0 0 18 18\" aria-hidden=\"true\">\n <path\n d=\"M9 4 L9 14 M4 9 L9 4 L14 9\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n />\n </svg>\n </ng-content>\n</button>\n",
93
96
  encapsulation: i0.ViewEncapsulation.None
@@ -104,6 +107,7 @@ i0.ɵɵngDeclareClassMetadata({
104
107
  selector: "wr-back-top",
105
108
  encapsulation: ViewEncapsulation.None,
106
109
  host: {
110
+ class: "wr-back-top",
107
111
  "[class]": "classes()",
108
112
  "[attr.aria-hidden]": "!visible()",
109
113
  "[attr.inert]": "visible() ? null : ''"
@@ -1 +1 @@
1
- {"version":3,"file":"ngwr-back-top.mjs","names":[],"sources":["../../../projects/lib/back-top/back-top.ts","../../../projects/lib/back-top/back-top.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 { coerceNumberProperty } from '@angular/cdk/coercion';\nimport { Component, DestroyRef, NgZone, ViewEncapsulation, computed, inject, input, signal } from '@angular/core';\n\nimport { useI18nText } from 'ngwr/i18n';\nimport { WrPlatform } from 'ngwr/platform';\nimport { WrScroll } from 'ngwr/scroll';\nimport { wrCheckStyles } from 'ngwr/utils';\n\n/**\n * Pinned floating button that scrolls the page back to the top. Appears\n * once the user has scrolled past `visibilityThreshold` pixels.\n *\n * @example\n * ```html\n * <wr-back-top />\n *\n * <wr-back-top visibilityThreshold=\"600\" [offset]=\"80\">\n * <svg>…custom icon…</svg>\n * </wr-back-top>\n * ```\n *\n * @see https://ngwr.dev/reference/components/back-top\n */\n@Component({\n selector: 'wr-back-top',\n templateUrl: './back-top.html',\n encapsulation: ViewEncapsulation.None,\n host: {\n '[class]': 'classes()',\n '[attr.aria-hidden]': '!visible()',\n // `aria-hidden` alone left a 44px button that focus still landed on: invisible\n // (opacity 0) but in the tab order, and unannounceable once it got there.\n // `inert` is what actually takes it out of both.\n '[attr.inert]': \"visible() ? null : ''\",\n },\n})\nexport class WrBackTop {\n /** Show the button once `window.scrollY` exceeds this many pixels. @default 400 */\n readonly visibilityThreshold = input(400, {\n transform: (v: unknown): number => Math.max(0, coerceNumberProperty(v, 400)),\n });\n\n /** Pixel offset subtracted from the scroll target — for sticky headers. @default 0 */\n readonly offset = input(0, { transform: (v: unknown): number => Math.max(0, coerceNumberProperty(v, 0)) });\n\n /** Accessible label for the button. Falls back to `backTop.label`, then `'Back to top'`. */\n readonly ariaLabel = input<string | null>(null);\n\n protected readonly resolvedAriaLabel = useI18nText(this.ariaLabel, 'backTop.label', 'Back to top');\n\n protected readonly visible = signal(false);\n\n private readonly scroll = inject(WrScroll);\n private readonly platform = inject(WrPlatform);\n private readonly zone = inject(NgZone);\n private readonly destroyRef = inject(DestroyRef);\n\n protected readonly classes = computed(() => {\n const parts = ['wr-back-top'];\n if (this.visible()) parts.push('wr-back-top--visible');\n return parts.join(' ');\n });\n\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('back-top');\n if (!this.platform.isBrowser) return;\n const handler = (): void => {\n const should = window.scrollY > this.visibilityThreshold();\n if (should !== this.visible()) this.zone.run(() => this.visible.set(should));\n };\n this.zone.runOutsideAngular(() => window.addEventListener('scroll', handler, { passive: true }));\n // Initial check (page might already be scrolled), and it is SYNCHRONOUS on\n // purpose. `window.scrollY` forces a style + layout flush, which is what\n // makes constructing N of these quadratic — 1000 instances cost 90ms and\n // 5000 cost 1640ms, of which ~95% is the flush: replacing `scrollY` with a\n // plain property drops 5000 to 83ms with all 5000 scroll listeners still\n // registered, so the per-instance listener is not the cost it looks like.\n // The bulk figure is nobody's bill — a page has one back-to-top button, and\n // one instance measures 0.03ms over an equivalent component. Deferring to\n // `afterNextRender` would land the signal a change-detection pass later, so\n // a page restored part way down would fade the button in from `opacity: 0`\n // instead of painting it in place. That first paint is the contract.\n handler();\n this.destroyRef.onDestroy(() => window.removeEventListener('scroll', handler));\n }\n\n protected onClick(): void {\n this.scroll.toTop({ offset: this.offset() });\n }\n}\n","<button type=\"button\" class=\"wr-back-top__button\" [attr.aria-label]=\"resolvedAriaLabel()\" (click)=\"onClick()\">\n <!-- The arrow is FALLBACK content: rendered next to a projected icon rather\n than instead of it, the documented custom-icon example put two glyphs in\n one 44px circle. -->\n <ng-content>\n <svg width=\"18\" height=\"18\" viewBox=\"0 0 18 18\" aria-hidden=\"true\">\n <path\n d=\"M9 4 L9 14 M4 9 L9 4 L14 9\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n />\n </svg>\n </ng-content>\n</button>\n"],"mappings":";;;;;;;;;;;;;AA2CA,IAAa,YAAb,MAAa,UAAS;CAEX,sBAAsB,MAAM,KAAG;EAAA,GAAA,YAAA,EAAA,WAAA,sBAAA,+BAAA,CAAA;EACtC,YAAY,MAAuB,KAAK,IAAI,GAAG,qBAAqB,GAAG,GAAG,CAAC;CAAC,CAAA;CAIrE,SAAS,MAAM,GAAC;EAAA,GAAA,YAAA,EAAA,WAAA,SAAA,+BAAA,CAAA;EAAI,YAAY,MAAuB,KAAK,IAAI,GAAG,qBAAqB,GAAG,CAAC,CAAC;CAAC,CAAA;CAG9F,YAAY,MAAqB,MAAK,GAAA,Y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,qBAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;GAAA,QAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;GAAA,WAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;EAAA;EAAA,MAAA,EAAA,YAAA;GAAA,SAAA;GAAA,oBAAA;GAAA,cAAA;EAAA,EAAA;EAAA,UAAA;EAAA,UC3CtB;EAiBA,eAAA,GAAA,kBAAA;CAAA,CAAA;;AD0Ba,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAS,YAAA,CAAA;EAbrB,MAAA;EACW,MAAA,CAAA;GAAA,UAAA;GAAa,eAER,kBAAkB;GAAI,MAC/B;IACJ,WAAW;IACX,sBAAsB;IAItB,gBAAgB;GACjB;GAAA,UAAA;EAAA,CAAA"}
1
+ {"version":3,"file":"ngwr-back-top.mjs","names":[],"sources":["../../../projects/lib/back-top/back-top.ts","../../../projects/lib/back-top/back-top.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 { coerceNumberProperty } from '@angular/cdk/coercion';\nimport { Component, DestroyRef, NgZone, ViewEncapsulation, computed, inject, input, signal } from '@angular/core';\n\nimport { useI18nText } from 'ngwr/i18n';\nimport { WrPlatform } from 'ngwr/platform';\nimport { WrScroll } from 'ngwr/scroll';\nimport { wrCheckStyles } from 'ngwr/utils';\n\n/**\n * Pinned floating button that scrolls the page back to the top. Appears\n * once the user has scrolled past `visibilityThreshold` pixels.\n *\n * @example\n * ```html\n * <wr-back-top />\n *\n * <wr-back-top visibilityThreshold=\"600\" [offset]=\"80\">\n * <svg>…custom icon…</svg>\n * </wr-back-top>\n * ```\n *\n * @see https://ngwr.dev/reference/components/back-top\n */\n@Component({\n selector: 'wr-back-top',\n templateUrl: './back-top.html',\n encapsulation: ViewEncapsulation.None,\n host: {\n class: 'wr-back-top',\n '[class]': 'classes()',\n '[attr.aria-hidden]': '!visible()',\n // `aria-hidden` alone left a 44px button that focus still landed on: invisible\n // (opacity 0) but in the tab order, and unannounceable once it got there.\n // `inert` is what actually takes it out of both.\n '[attr.inert]': \"visible() ? null : ''\",\n },\n})\nexport class WrBackTop {\n /** Show the button once `window.scrollY` exceeds this many pixels. @default 400 */\n readonly visibilityThreshold = input(400, {\n transform: (v: unknown): number => Math.max(0, coerceNumberProperty(v, 400)),\n });\n\n /** Pixel offset subtracted from the scroll target — for sticky headers. @default 0 */\n readonly offset = input(0, { transform: (v: unknown): number => Math.max(0, coerceNumberProperty(v, 0)) });\n\n /** Accessible label for the button. Falls back to `backTop.label`, then `'Back to top'`. */\n readonly ariaLabel = input<string | null>(null);\n\n protected readonly resolvedAriaLabel = useI18nText(this.ariaLabel, 'backTop.label', 'Back to top');\n\n protected readonly visible = signal(false);\n\n private readonly scroll = inject(WrScroll);\n private readonly platform = inject(WrPlatform);\n private readonly zone = inject(NgZone);\n private readonly destroyRef = inject(DestroyRef);\n\n protected readonly classes = computed(() => {\n const parts: string[] = [];\n if (this.visible()) parts.push('wr-back-top--visible');\n return parts.join(' ');\n });\n\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('back-top');\n if (!this.platform.isBrowser) return;\n const handler = (): void => {\n const should = window.scrollY > this.visibilityThreshold();\n if (should !== this.visible()) this.zone.run(() => this.visible.set(should));\n };\n this.zone.runOutsideAngular(() => window.addEventListener('scroll', handler, { passive: true }));\n // Initial check (page might already be scrolled), and it is SYNCHRONOUS on\n // purpose. `window.scrollY` forces a style + layout flush, which is what\n // makes constructing N of these quadratic — 1000 instances cost 90ms and\n // 5000 cost 1640ms, of which ~95% is the flush: replacing `scrollY` with a\n // plain property drops 5000 to 83ms with all 5000 scroll listeners still\n // registered, so the per-instance listener is not the cost it looks like.\n // The bulk figure is nobody's bill — a page has one back-to-top button, and\n // one instance measures 0.03ms over an equivalent component. Deferring to\n // `afterNextRender` would land the signal a change-detection pass later, so\n // a page restored part way down would fade the button in from `opacity: 0`\n // instead of painting it in place. That first paint is the contract.\n handler();\n this.destroyRef.onDestroy(() => window.removeEventListener('scroll', handler));\n }\n\n protected onClick(): void {\n this.scroll.toTop({ offset: this.offset() });\n }\n}\n","<button type=\"button\" class=\"wr-back-top__button\" [attr.aria-label]=\"resolvedAriaLabel()\" (click)=\"onClick()\">\n <!-- The arrow is FALLBACK content: rendered next to a projected icon rather\n than instead of it, the documented custom-icon example put two glyphs in\n one 44px circle. -->\n <ng-content>\n <svg width=\"18\" height=\"18\" viewBox=\"0 0 18 18\" aria-hidden=\"true\">\n <path\n d=\"M9 4 L9 14 M4 9 L9 4 L14 9\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n />\n </svg>\n </ng-content>\n</button>\n"],"mappings":";;;;;;;;;;;;;AA4CA,IAAa,YAAb,MAAa,UAAS;CAEX,sBAAsB,MAAM,KAAG;EAAA,GAAA,YAAA,EAAA,WAAA,sBAAA,+BAAA,CAAA;EACtC,YAAY,MAAuB,KAAK,IAAI,GAAG,qBAAqB,GAAG,GAAG,CAAC;CAAC,CAAA;CAIrE,SAAS,MAAM,GAAC;EAAA,GAAA,YAAA,EAAA,WAAA,SAAA,+BAAA,CAAA;EAAI,YAAY,MAAuB,KAAK,IAAI,GAAG,qBAAqB,GAAG,CAAC,CAAC;CAAC,CAAA;CAG9F,YAAY,MAAqB,MAAK,GAAA,YAAA,CAAA,EAAA,WAAA,YAAA,CAAA,+BAAA,CAAA,CAAA;CAE5B,oBAAoB,YAAY,KAAK,WAAW,iBAAiB,aAAa;CAE9E,UAAU,OAAO,OAAM,GAAA,YAAA,CAAA,EAAA,WAAA,UAAA,CAAA,+BAAA,CAAA,CAAA;CA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A,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;EAAA;EAAA,MAAA;GAAA,YAAA;IAAA,SAAA;IAAA,oBAAA;IAAA,cAAA;GAAA;GAAA,gBAAA;EAAA;EAAA,UAAA;EAAA,UC5CtB;EAiBA,eAAA,GAAA,kBAAA;CAAA,CAAA;;AD2Ba,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAS,YAAA,CAAA;EAdrB,MAAA;EACW,MAAA,CAAA;GAAA,UAAA;GAAa,eAER,kBAAkB;GAAI,MAC/B;IACJ,OAAO;IACP,WAAW;IACX,sBAAsB;IAItB,gBAAgB;GACjB;GAAA,UAAA;EAAA,CAAA"}
@@ -22,7 +22,7 @@ var WrBadge = class WrBadge {
22
22
  transform: coerceBooleanProperty
23
23
  });
24
24
  classes = computed(() => {
25
- const parts = ["wr-badge"];
25
+ const parts = [];
26
26
  const color = this.color();
27
27
  if (color) parts.push(`wr-badge--${color}`);
28
28
  const size = this.size();
@@ -76,7 +76,10 @@ var WrBadge = class WrBadge {
76
76
  transformFunction: null
77
77
  }
78
78
  },
79
- host: { properties: { "class": "classes()" } },
79
+ host: {
80
+ properties: { "class": "classes()" },
81
+ classAttribute: "wr-badge"
82
+ },
80
83
  ngImport: i0,
81
84
  template: "<ng-content />",
82
85
  isInline: true,
@@ -94,7 +97,10 @@ i0.ɵɵngDeclareClassMetadata({
94
97
  selector: "wr-badge",
95
98
  template: "<ng-content />",
96
99
  encapsulation: ViewEncapsulation.None,
97
- host: { "[class]": "classes()" }
100
+ host: {
101
+ class: "wr-badge",
102
+ "[class]": "classes()"
103
+ }
98
104
  }]
99
105
  }],
100
106
  ctorParameters: () => [],
@@ -167,7 +173,7 @@ var WrTag = class WrTag {
167
173
  transform: coerceBooleanProperty
168
174
  });
169
175
  classes = computed(() => {
170
- const parts = ["wr-tag"];
176
+ const parts = [];
171
177
  const color = this.color();
172
178
  if (color) parts.push(`wr-tag--${color}`);
173
179
  if (this.outlined()) parts.push("wr-tag--outlined");
@@ -250,7 +256,10 @@ var WrTag = class WrTag {
250
256
  transformFunction: null
251
257
  }
252
258
  },
253
- host: { properties: { "class": "classes()" } },
259
+ host: {
260
+ properties: { "class": "classes()" },
261
+ classAttribute: "wr-tag"
262
+ },
254
263
  ngImport: i0,
255
264
  template: "@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",
256
265
  dependencies: [{
@@ -277,7 +286,10 @@ i0.ɵɵngDeclareClassMetadata({
277
286
  args: [{
278
287
  selector: "wr-tag",
279
288
  encapsulation: ViewEncapsulation.None,
280
- host: { "[class]": "classes()" },
289
+ host: {
290
+ class: "wr-tag",
291
+ "[class]": "classes()"
292
+ },
281
293
  imports: [WrIcon, WrSpinner],
282
294
  template: "@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"
283
295
  }]
@@ -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(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,OAAA,GAAA,qBAAA;EAAA,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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: 'wr-badge',\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: string[] = [];\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: 'wr-tag', '[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: string[] = [];\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":";;;;;;;;;;;;AAuCA,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,QAAkB,CAAA;EAExB,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;EAA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AC/B;IAAE,OAAO;IAAU,WAAW;GAAW;GAAE,SACxC,CAAC,QAAQ,SAAS;GAAC,UAAA;EAAA,CAAA"}
@@ -20,10 +20,7 @@ var WrBurger = class WrBurger {
20
20
  ...ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {},
21
21
  transform: coerceBooleanProperty
22
22
  });
23
- classes = computed(() => ({
24
- "wr-burger": true,
25
- "wr-burger--opened": this.open()
26
- }), ...ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []);
23
+ classes = computed(() => ({ "wr-burger--opened": this.open() }), ...ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []);
27
24
  toggle() {
28
25
  if (this.disabled()) return;
29
26
  this.open.set(!this.open());
@@ -66,7 +63,10 @@ var WrBurger = class WrBurger {
66
63
  }
67
64
  },
68
65
  outputs: { open: "openChange" },
69
- host: { properties: { "class": "classes()" } },
66
+ host: {
67
+ properties: { "class": "classes()" },
68
+ classAttribute: "wr-burger"
69
+ },
70
70
  ngImport: i0,
71
71
  template: "<button\n type=\"button\"\n class=\"wr-burger__btn\"\n [attr.aria-expanded]=\"open()\"\n [attr.aria-label]=\"resolvedLabel()\"\n [disabled]=\"disabled()\"\n (click)=\"toggle()\"\n>\n <svg class=\"wr-burger__icon\" viewBox=\"0 0 100 100\" xmlns=\"http://www.w3.org/2000/svg\" aria-hidden=\"true\">\n <path\n class=\"wr-burger__line wr-burger__line--1\"\n d=\"M 20,29 H 80 C 80,29 94.5,28.8 94.5,66.7 94.5,78 91,81.7 85.3,81.7 79.6,81.7 75,75 75,75 L 25,25\"\n />\n <path class=\"wr-burger__line wr-burger__line--2\" d=\"M 20,50 H 80\" />\n <path\n class=\"wr-burger__line wr-burger__line--3\"\n d=\"M 20,71 H 80 C 80,71 94.5,71.2 94.5,33.3 94.5,22 91,18.3 85.3,18.3 79.6,18.3 75,25 75,25 L 25,75\"\n />\n </svg>\n</button>\n",
72
72
  encapsulation: i0.ViewEncapsulation.None
@@ -82,7 +82,10 @@ i0.ɵɵngDeclareClassMetadata({
82
82
  args: [{
83
83
  selector: "wr-burger",
84
84
  encapsulation: ViewEncapsulation.None,
85
- host: { "[class]": "classes()" },
85
+ host: {
86
+ class: "wr-burger",
87
+ "[class]": "classes()"
88
+ },
86
89
  template: "<button\n type=\"button\"\n class=\"wr-burger__btn\"\n [attr.aria-expanded]=\"open()\"\n [attr.aria-label]=\"resolvedLabel()\"\n [disabled]=\"disabled()\"\n (click)=\"toggle()\"\n>\n <svg class=\"wr-burger__icon\" viewBox=\"0 0 100 100\" xmlns=\"http://www.w3.org/2000/svg\" aria-hidden=\"true\">\n <path\n class=\"wr-burger__line wr-burger__line--1\"\n d=\"M 20,29 H 80 C 80,29 94.5,28.8 94.5,66.7 94.5,78 91,81.7 85.3,81.7 79.6,81.7 75,75 75,75 L 25,25\"\n />\n <path class=\"wr-burger__line wr-burger__line--2\" d=\"M 20,50 H 80\" />\n <path\n class=\"wr-burger__line wr-burger__line--3\"\n d=\"M 20,71 H 80 C 80,71 94.5,71.2 94.5,33.3 94.5,22 91,18.3 85.3,18.3 79.6,18.3 75,25 75,25 L 25,75\"\n />\n </svg>\n</button>\n"
87
90
  }]
88
91
  }],
@@ -1 +1 @@
1
- {"version":3,"file":"ngwr-burger.mjs","names":[],"sources":["../../../projects/lib/burger/burger.ts","../../../projects/lib/burger/burger.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, model } from '@angular/core';\n\nimport { useI18nText } from 'ngwr/i18n';\nimport { wrCheckStyles } from 'ngwr/utils';\n\n/**\n * Animated menu toggle — three SVG strokes morph between a hamburger and a\n * close mark on `open`. Two-way bindable, so it pairs naturally with a\n * `<wr-drawer>` or any disclosure.\n *\n * The morph is pure CSS (`stroke-dasharray` / `stroke-dashoffset` tweens),\n * so it stays smooth without JS and collapses to its end state under\n * `prefers-reduced-motion`.\n *\n * @example Toggle a drawer\n * ```html\n * <wr-burger [(open)]=\"menuOpen\" />\n * <wr-drawer [(open)]=\"menuOpen\" position=\"right\">…</wr-drawer>\n * ```\n *\n * @see https://ngwr.dev/reference/components/burger\n */\n@Component({\n selector: 'wr-burger',\n templateUrl: './burger.html',\n encapsulation: ViewEncapsulation.None,\n host: { '[class]': 'classes()' },\n})\nexport class WrBurger {\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('burger');\n }\n\n /** Two-way bindable open state. Drives the hamburger ↔ close morph. @default false */\n readonly open = model(false);\n\n /**\n * Accessible name for the toggle button. Falls back to `burger.label`, then\n * `'Toggle menu'`.\n */\n readonly label = input<string | null>(null);\n\n protected readonly resolvedLabel = useI18nText(this.label, 'burger.label', 'Toggle menu');\n\n /** Disable the toggle. @default false */\n readonly disabled = input(false, { transform: coerceBooleanProperty });\n\n protected readonly classes = computed(() => ({\n 'wr-burger': true,\n 'wr-burger--opened': this.open(),\n }));\n\n protected toggle(): void {\n if (this.disabled()) return;\n this.open.set(!this.open());\n }\n}\n","<button\n type=\"button\"\n class=\"wr-burger__btn\"\n [attr.aria-expanded]=\"open()\"\n [attr.aria-label]=\"resolvedLabel()\"\n [disabled]=\"disabled()\"\n (click)=\"toggle()\"\n>\n <svg class=\"wr-burger__icon\" viewBox=\"0 0 100 100\" xmlns=\"http://www.w3.org/2000/svg\" aria-hidden=\"true\">\n <path\n class=\"wr-burger__line wr-burger__line--1\"\n d=\"M 20,29 H 80 C 80,29 94.5,28.8 94.5,66.7 94.5,78 91,81.7 85.3,81.7 79.6,81.7 75,75 75,75 L 25,25\"\n />\n <path class=\"wr-burger__line wr-burger__line--2\" d=\"M 20,50 H 80\" />\n <path\n class=\"wr-burger__line wr-burger__line--3\"\n d=\"M 20,71 H 80 C 80,71 94.5,71.2 94.5,33.3 94.5,22 91,18.3 85.3,18.3 79.6,18.3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;EAAA,MAAA,EAAA,YAAA,EAAA,SAAA,YAAA,EAAA;EAAA,UAAA;EAAA,UCpCrB;EAoBA,eAAA,GAAA,kBAAA;CAAA,CAAA;;ADgBa,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAQ,YAAA,CAAA;EANpB,MAAA;EACW,MAAA,CAAA;GAAA,UAAA;GAAW,eAEN,kBAAkB;GAAI,MAC/B,EAAE,WAAW,YAAW;GAAE,UAAA;EAAA,CAAA"}
1
+ {"version":3,"file":"ngwr-burger.mjs","names":[],"sources":["../../../projects/lib/burger/burger.ts","../../../projects/lib/burger/burger.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, model } from '@angular/core';\n\nimport { useI18nText } from 'ngwr/i18n';\nimport { wrCheckStyles } from 'ngwr/utils';\n\n/**\n * Animated menu toggle — three SVG strokes morph between a hamburger and a\n * close mark on `open`. Two-way bindable, so it pairs naturally with a\n * `<wr-drawer>` or any disclosure.\n *\n * The morph is pure CSS (`stroke-dasharray` / `stroke-dashoffset` tweens),\n * so it stays smooth without JS and collapses to its end state under\n * `prefers-reduced-motion`.\n *\n * @example Toggle a drawer\n * ```html\n * <wr-burger [(open)]=\"menuOpen\" />\n * <wr-drawer [(open)]=\"menuOpen\" position=\"right\">…</wr-drawer>\n * ```\n *\n * @see https://ngwr.dev/reference/components/burger\n */\n@Component({\n selector: 'wr-burger',\n templateUrl: './burger.html',\n encapsulation: ViewEncapsulation.None,\n host: { class: 'wr-burger', '[class]': 'classes()' },\n})\nexport class WrBurger {\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('burger');\n }\n\n /** Two-way bindable open state. Drives the hamburger ↔ close morph. @default false */\n readonly open = model(false);\n\n /**\n * Accessible name for the toggle button. Falls back to `burger.label`, then\n * `'Toggle menu'`.\n */\n readonly label = input<string | null>(null);\n\n protected readonly resolvedLabel = useI18nText(this.label, 'burger.label', 'Toggle menu');\n\n /** Disable the toggle. @default false */\n readonly disabled = input(false, { transform: coerceBooleanProperty });\n\n protected readonly classes = computed(() => ({\n 'wr-burger--opened': this.open(),\n }));\n\n protected toggle(): void {\n if (this.disabled()) return;\n this.open.set(!this.open());\n }\n}\n","<button\n type=\"button\"\n class=\"wr-burger__btn\"\n [attr.aria-expanded]=\"open()\"\n [attr.aria-label]=\"resolvedLabel()\"\n [disabled]=\"disabled()\"\n (click)=\"toggle()\"\n>\n <svg class=\"wr-burger__icon\" viewBox=\"0 0 100 100\" xmlns=\"http://www.w3.org/2000/svg\" aria-hidden=\"true\">\n <path\n class=\"wr-burger__line wr-burger__line--1\"\n d=\"M 20,29 H 80 C 80,29 94.5,28.8 94.5,66.7 94.5,78 91,81.7 85.3,81.7 79.6,81.7 75,75 75,75 L 25,25\"\n />\n <path class=\"wr-burger__line wr-burger__line--2\" d=\"M 20,50 H 80\" />\n <path\n class=\"wr-burger__line wr-burger__line--3\"\n d=\"M 20,71 H 80 C 80,71 94.5,71.2 94.5,33.3 94.5,22 91,18.3 85.3,18.3 79.6,18.3 75,25 75,25 L 25,75\"\n />\n </svg>\n</button>\n"],"mappings":";;;;;;;;;;;AAoCA,IAAa,WAAb,MAAa,SAAQ;CACnB,cAAA;EACE,IAAI,OAAO,cAAc,eAAe,WAAW,cAAc,QAAQ;CAC3E;CAGS,OAAO,MAAM,OAAM,GAAA,YAAA,CAAA,EAAA,WAAA,OAAA,CAAA,+BAAA,CAAA,CAAA;CAMnB,QAAQ,MAAqB,MAAK,GAAA,YAAA,CAAA,EAAA,WAAA,QAAA,CAAA,+BAAA,CAAA,CAAA;CAExB,gBAAgB,YAAY,KAAK,OAAO,gBAAgB,aAAa;CAG/E,WAAW,MAAM,OAAK;EAAA,GAAA,YAAA,EAAA,WAAA,WAAA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
106
  const color = this.color();
107
107
  if (color) parts.push(`wr-btn--${color}`);
108
108
  const size = this.size();
@@ -214,7 +214,8 @@ var WrButton = class WrButton {
214
214
  "attr.role": "hostRole()",
215
215
  "attr.tabindex": "hostTabIndex()",
216
216
  "attr.aria-disabled": "hostAriaDisabled()"
217
- }
217
+ },
218
+ classAttribute: "wr-btn"
218
219
  },
219
220
  ngImport: i0,
220
221
  template: "<!--\n `aria-hidden`: the spinner is a `role=\"status\"` region named \"Loading\", and inside\n the button it became the button's whole name while the label was hidden. The\n button already says it is busy with `aria-busy`.\n-->\n@if (loading()) {\n <wr-spinner class=\"wr-btn__spin\" size=\"sm\" aria-hidden=\"true\" />\n}\n\n@if (icon(); as name) {\n <wr-icon class=\"wr-btn__icon\" [name]=\"name\" />\n}\n\n<span class=\"wr-btn__label\">\n <ng-content />\n</span>\n",
@@ -243,6 +244,7 @@ i0.ɵɵngDeclareClassMetadata({
243
244
  selector: "wr-btn, button[wr-btn], a[wr-btn]",
244
245
  encapsulation: ViewEncapsulation.None,
245
246
  host: {
247
+ class: "wr-btn",
246
248
  "[class]": "classes()",
247
249
  "[attr.disabled]": "nativeDisabled()",
248
250
  "[attr.aria-busy]": "loading() ? \"true\" : null",
@@ -353,7 +355,7 @@ var WrButtonGroup = class WrButtonGroup {
353
355
  }
354
356
  shape = input(null, ...ngDevMode ? [{ debugName: "shape" }] : /* istanbul ignore next */ []);
355
357
  hostClasses = computed(() => {
356
- const parts = ["wr-btn-group"];
358
+ const parts = [];
357
359
  const s = this.shape();
358
360
  if (s) parts.push(`wr-btn-group--${s}`);
359
361
  return parts.join(" ");
@@ -381,7 +383,8 @@ var WrButtonGroup = class WrButtonGroup {
381
383
  } },
382
384
  host: {
383
385
  attributes: { "role": "group" },
384
- properties: { "class": "hostClasses()" }
386
+ properties: { "class": "hostClasses()" },
387
+ classAttribute: "wr-btn-group"
385
388
  },
386
389
  providers: [{
387
390
  provide: WR_BUTTON_GROUP,
@@ -405,6 +408,7 @@ i0.ɵɵngDeclareClassMetadata({
405
408
  template: "<ng-content />",
406
409
  encapsulation: ViewEncapsulation.None,
407
410
  host: {
411
+ class: "wr-btn-group",
408
412
  "[class]": "hostClasses()",
409
413
  role: "group"
410
414
  },
@@ -1 +1 @@
1
- {"version":3,"file":"ngwr-button.mjs","names":[],"sources":["../../../projects/lib/button/tokens/button-group.token.ts","../../../projects/lib/button/button.ts","../../../projects/lib/button/button.html","../../../projects/lib/button/button-group.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 { InjectionToken } from '@angular/core';\n\nimport type { WrButtonGroupContext } from '../types';\n\n/**\n * Token a `<wr-btn>` injects to discover its parent `<wr-btn-group>`. The\n * group provides itself via this token so children can react to the\n * group's `shape` cascade.\n *\n * @internal\n */\nexport const WR_BUTTON_GROUP = new InjectionToken<WrButtonGroupContext>('WR_BUTTON_GROUP');\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 {\n Component,\n DestroyRef,\n ElementRef,\n Injector,\n Renderer2,\n ViewEncapsulation,\n afterNextRender,\n computed,\n effect,\n inject,\n input,\n} 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 { WR_BUTTON_GROUP } from './tokens';\nimport type { WrButtonIconPosition, WrButtonShape, WrButtonSize } from './types';\n\n/**\n * Trigger an action. Renders as a `<wr-btn>` element, or attach to a\n * native `<button>` / `<a>` via the `wr-btn` attribute selector.\n *\n * @example\n * ```html\n * <button wr-btn color=\"primary\">Save</button>\n * <a wr-btn color=\"primary\" outlined>Cancel</a>\n * <wr-btn color=\"danger\" icon=\"trash\">Delete</wr-btn>\n * <wr-btn color=\"primary\" shape=\"pill\">Pill</wr-btn>\n * ```\n *\n * Inside a `<wr-btn-group shape=\"…\">`, the group's shape is enforced on\n * every child — child `[shape]` inputs are ignored so the group reads as\n * one coherent control.\n *\n * **Inside a `<form>`, use the native form.** `<wr-btn>` is a custom element\n * carrying `role=\"button\"`, and no custom element submits a form — the platform\n * submits for `<button>`, `<input type=\"submit\">` and `<input type=\"image\">`\n * and nothing else. That is why there is no `type` input: it would look like it\n * worked. Implicit submission (Enter in a text field) does not reach it either.\n *\n * ```html\n * <button wr-btn type=\"submit\" color=\"primary\">Save</button>\n * ```\n *\n * @see https://ngwr.dev/reference/components/button\n */\n@Component({\n selector: 'wr-btn, button[wr-btn], a[wr-btn]',\n templateUrl: './button.html',\n encapsulation: ViewEncapsulation.None,\n host: {\n '[class]': 'classes()',\n '[attr.disabled]': 'nativeDisabled()',\n '[attr.aria-busy]': 'loading() ? \"true\" : null',\n // The role applies ONLY to the `<wr-btn>` element form — see `isCustomHost`.\n // The tab stop and `aria-disabled` apply to it and to `<a wr-btn>`, where\n // `disabled` is just as inert. A native `<button>` already has all of it.\n '[attr.role]': 'hostRole()',\n '[attr.tabindex]': 'hostTabIndex()',\n '[attr.aria-disabled]': 'hostAriaDisabled()',\n '(keydown)': 'onHostKeydown($event)',\n '(focus)': 'onHostFocus()',\n '(blur)': 'onHostBlur()',\n },\n imports: [WrIcon, WrSpinner],\n})\nexport class WrButton {\n /**\n * Color variant. Omit for the neutral default style.\n *\n * @default null\n */\n readonly color = input<WrColor | null>(null);\n\n /** Size variant. @default 'md' */\n readonly size = input<WrButtonSize>('md');\n\n /**\n * Corner treatment — `rounded`, `pill` or `squircle`. `null` (default) falls\n * back to `rounded`. Inside a `<wr-btn-group shape=\"…\">`, the group's shape\n * ALWAYS wins over this input — the group enforces a consistent corner\n * treatment across its members.\n *\n * @default null\n */\n readonly shape = input<WrButtonShape | null>(null);\n\n /**\n * Icon name to render alongside the label. The icon is hidden while\n * `loading` is `true` so the spinner can take its place.\n *\n * @default null\n */\n readonly icon = input<WrIconName | null>(null);\n\n /** Position of the icon relative to the label. @default 'start' */\n readonly iconPosition = input<WrButtonIconPosition>('start');\n\n /** Disable the button. @default false */\n readonly disabled = input(false, { transform: coerceBooleanProperty });\n\n /** Outlined variant — colored text and border on a transparent background. @default false */\n readonly outlined = input(false, { transform: coerceBooleanProperty });\n\n /** Stretch the button to fill its parent's width. @default false */\n readonly block = input(false, { transform: coerceBooleanProperty });\n\n /** Show a spinner overlaying the label. Layout is preserved. @default false */\n readonly loading = input(false, { transform: coerceBooleanProperty });\n\n /**\n * When `loading` is `true` and this is also `true`, pointer events are\n * suppressed and the button reports as disabled to assistive tech.\n *\n * @default true\n */\n readonly disabledWhenLoading = input(true, { transform: coerceBooleanProperty });\n\n private readonly group = inject(WR_BUTTON_GROUP, { optional: true });\n\n /**\n * Resolved shape. Inside a `<wr-btn-group>`, the group ALWAYS wins — child\n * `[shape]` is ignored entirely so the group reads as one coherent control.\n * Outside a group, the button's own `[shape]` is used, falling back to\n * `rounded`.\n */\n protected readonly resolvedShape = computed<WrButtonShape>(() =>\n this.group ? (this.group.shape() ?? 'rounded') : (this.shape() ?? 'rounded')\n );\n\n private readonly hostEl = inject<ElementRef<HTMLElement>>(ElementRef);\n\n /**\n * Whether this instance is the `<wr-btn>` ELEMENT rather than the attribute\n * form on a native `<button>` / `<a>`.\n *\n * The element form is documented as first-class and is what the pagination,\n * event-calendar and popconfirm chrome use — but a custom element has no\n * button semantics of its own. It was rendering with no `role`, no\n * `tabindex` and no keyboard activation, so it was invisible to assistive\n * tech and unreachable by Tab. Measured in Chromium against the built site:\n * the whole `wr-pagination` subtree, 26 elements, contained ZERO focusable\n * nodes and sixty Tab presses never entered it. axe cannot see this — an\n * unknown element with no role simply is not an interactive control to it,\n * which is the same blind spot that lets `disabled` pass unnoticed on a\n * custom element.\n */\n private readonly isCustomHost = this.hostEl.nativeElement.tagName === 'WR-BTN';\n\n /**\n * Whether this instance is on an `<a>`. The `disabled` attribute means nothing\n * there either: a disabled or loading `<a wr-btn href>` kept its tab stop, was\n * announced as an enabled link and followed its `href` on Enter — only the mouse\n * was stopped, by `pointer-events: none`.\n */\n private readonly isAnchorHost = this.hostEl.nativeElement.tagName === 'A';\n\n private readonly isOff = computed(() => this.disabled() || (this.loading() && this.disabledWhenLoading()));\n\n protected readonly nativeDisabled = computed<'' | null>(() => (this.isOff() ? '' : null));\n\n protected readonly hostRole = computed<'button' | null>(() => (this.isCustomHost ? 'button' : null));\n\n /**\n * Out of the tab order while off — `disabled` is inert on a custom element and on\n * an `<a>`. The element form drops its stop; a link has one of its own, which `-1`\n * takes away.\n */\n protected readonly hostTabIndex = computed<'0' | '-1' | null>(() => {\n if (this.isCustomHost) return this.isOff() ? null : '0';\n return this.isAnchorHost && this.isOff() ? '-1' : null;\n });\n\n protected readonly hostAriaDisabled = computed<'true' | null>(() =>\n (this.isCustomHost || this.isAnchorHost) && this.isOff() ? 'true' : null\n );\n\n /**\n * Enter and Space activate a button. A native one does this for free; a\n * custom element does not, so without this the element form could be focused\n * (once it had a tabindex) and still not be operable.\n *\n * `preventDefault` on Space is not optional — it scrolls the page otherwise.\n * The pointer path needs no guard here: `.wr-btn[disabled]` already sets\n * `pointer-events: none`.\n */\n protected onHostKeydown(event: KeyboardEvent): void {\n // A link activates on Enter, which out of the tab order it can still receive\n // from a script or a screen reader's focus.\n if (this.isAnchorHost && this.isOff() && event.key === 'Enter') {\n event.preventDefault();\n return;\n }\n if (!this.isCustomHost) return;\n if (event.key !== 'Enter' && event.key !== ' ') return;\n\n event.preventDefault();\n if (this.isOff()) return;\n this.hostEl.nativeElement.click();\n }\n\n /**\n * A disabled `<a wr-btn>` activates nothing: no navigation, and no other click\n * listener on it — the `(click)` of the template and a `routerLink` included,\n * the same silence a disabled `<button>` keeps. The pointer never gets here past\n * `pointer-events: none`; a screen reader's activation and `.click()` do.\n *\n * A CAPTURE listener, because a host listener is registered after the\n * template's own `(click)` on the same element and could not stop it; at the\n * target, capture listeners run first.\n */\n private readonly onAnchorClick = (event: MouseEvent): void => {\n if (!this.isOff()) return;\n event.preventDefault();\n event.stopImmediatePropagation();\n };\n\n private readonly injector = inject(Injector);\n\n /**\n * Whether this button is the one the caret was on, so it can be handed back\n * the focus that goes missing while it is off.\n *\n * A control that becomes `disabled` while focused stops being a focusable\n * area, and the browser runs the unfocusing steps: nothing else is nominated,\n * so the caret lands on `<body>`. With `disabledWhenLoading` on by default\n * that happens on EVERY async button — a keyboard user presses Enter on\n * \"Save\" and the next Tab restarts from the top of the document, while a\n * screen-reader user is told neither that the wait began nor that it ended,\n * because the element they were on has left the a11y tree. The `<wr-btn>`\n * element form loses its `tabindex` instead of gaining `disabled` and is\n * unfocused for the same reason.\n *\n * Deliberately NOT keyed on reading `activeElement` when `isOff()` flips: an\n * effect in this component's own view runs AFTER the parent has applied this\n * directive's host bindings, so by then the attribute has landed and the\n * browser has already moved the caret — the read would answer `<body>` on\n * every real browser and the button on jsdom, which is the worst of both.\n *\n * The flag is written by the focus listeners instead, and a `blur` fired\n * WHILE off keeps it set rather than clearing it: that blur is the browser\n * taking the caret away, not the user leaving. A browser that fires no blur\n * on disable at all is covered too — the flag simply stays as `focus` left it,\n * and the `<body>` test below is what decides whether the focus is orphaned.\n */\n private hadFocus = false;\n\n /** @internal Host `focus` — see `hadFocus`. */\n protected onHostFocus(): void {\n this.hadFocus = true;\n }\n\n /** @internal Host `blur` — see `hadFocus`. */\n protected onHostBlur(): void {\n this.hadFocus = this.isOff();\n }\n\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('button');\n if (this.isAnchorHost) {\n const stop = inject(Renderer2).listen(this.hostEl.nativeElement, 'click', this.onAnchorClick, { capture: true });\n inject(DestroyRef).onDestroy(stop);\n }\n\n effect(() => {\n if (this.isOff()) return;\n if (!this.hadFocus) return;\n const el = this.hostEl.nativeElement;\n\n // Deferred: the host binding that drops `disabled` (or restores the\n // `tabindex`) has not necessarily run yet, and `focus()` on a still\n // disabled element is a silent no-op — the exact failure this is here to\n // fix.\n afterNextRender(\n () => {\n if (!this.hadFocus || this.isOff()) return;\n const doc = el.ownerDocument;\n const active = doc?.activeElement ?? null;\n // Still ours — nothing was ever taken away, so keep the flag for the\n // cycle that does take it.\n if (active === el) return;\n // Someone else owns the caret now: a user who tabbed on while the\n // request was in flight must not be yanked back to a button they have\n // finished with.\n this.hadFocus = false;\n if (active && doc && active !== doc.body) return;\n el.focus();\n },\n { injector: this.injector }\n );\n });\n }\n\n protected readonly classes = computed(() => {\n const parts = ['wr-btn'];\n\n const color = this.color();\n if (color) parts.push(`wr-btn--${color}`);\n\n const size = this.size();\n if (size !== 'md') parts.push(`wr-btn--${size}`);\n\n const shape = this.resolvedShape();\n if (shape !== 'rounded') parts.push(`wr-btn--${shape}`);\n\n if (this.outlined()) parts.push('wr-btn--outlined');\n if (this.block()) parts.push('wr-btn--block');\n if (this.loading()) parts.push('wr-btn--loading');\n\n const hasAdornment = !!this.icon() || this.loading();\n if (hasAdornment) parts.push(`wr-btn--icon-${this.iconPosition()}`);\n\n return parts.join(' ');\n });\n}\n","<!--\n `aria-hidden`: the spinner is a `role=\"status\"` region named \"Loading\", and inside\n the button it became the button's whole name while the label was hidden. The\n button already says it is busy with `aria-busy`.\n-->\n@if (loading()) {\n <wr-spinner class=\"wr-btn__spin\" size=\"sm\" aria-hidden=\"true\" />\n}\n\n@if (icon(); as name) {\n <wr-icon class=\"wr-btn__icon\" [name]=\"name\" />\n}\n\n<span class=\"wr-btn__label\">\n <ng-content />\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\nimport { Component, ViewEncapsulation, computed, forwardRef, input } from '@angular/core';\n\nimport { wrCheckStyles } from 'ngwr/utils';\n\nimport { WR_BUTTON_GROUP } from './tokens';\nimport type { WrButtonShape, WrButtonGroupContext } from './types';\n\n/**\n * Visually group buttons by merging their borders. Optionally enforce a\n * single corner treatment across every child via `[shape]` — child\n * `<wr-btn>` `[shape]` inputs are ignored when set on the group.\n *\n * @example\n * ```html\n * <wr-btn-group>\n * <button wr-btn>Left</button>\n * <button wr-btn>Middle</button>\n * <button wr-btn>Right</button>\n * </wr-btn-group>\n *\n * <wr-btn-group shape=\"pill\">\n * <button wr-btn>One</button>\n * <button wr-btn>Two</button>\n * <button wr-btn>Three</button>\n * </wr-btn-group>\n * ```\n *\n * @see https://ngwr.dev/reference/components/button-group\n */\n@Component({\n selector: 'wr-btn-group',\n template: '<ng-content />',\n encapsulation: ViewEncapsulation.None,\n host: {\n '[class]': 'hostClasses()',\n role: 'group',\n },\n // forwardRef required: WrButtonGroup is self-referenced before its declaration ends.\n // eslint-disable-next-line @angular-eslint/no-forward-ref\n providers: [{ provide: WR_BUTTON_GROUP, useExisting: forwardRef(() => WrButtonGroup) }],\n})\nexport class WrButtonGroup implements WrButtonGroupContext {\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('button');\n }\n\n /**\n * Corner treatment enforced on every child `<wr-btn>`. Child `[shape]`\n * inputs are ignored when this is set — the group exists to make a\n * uniform control. `null` (default) leaves children alone.\n *\n * @default null\n */\n readonly shape = input<WrButtonShape | null>(null);\n\n protected readonly hostClasses = computed(() => {\n const parts = ['wr-btn-group'];\n const s = this.shape();\n if (s) parts.push(`wr-btn-group--${s}`);\n return parts.join(' ');\n });\n}\n"],"mappings":";;;;;;;;;;;;AAkBA,MAAa,kBAAkB,IAAI,eAAqC,iBAAiB;;;;;;;AC4DzF,IAAa,WAAb,MAAa,SAAQ;CAMV,QAAQ,MAAsB,MAAK,GAAA,YAAA,CAAA,EAAA,WAAA,QAAA,CAAA,+BAAA,CAAA,CAAA;CAGnC,OAAO,MAAoB,MAAK,GAAA,YAAA,CAAA,EAAA,WAAA,OAAA,CAAA,+BAAA,CAAA,CAAA;CAUhC,QAAQ,MAA4B,M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A,mBAAA;EAAA,EAAA;EAAA,MAAA;GAAA,YAAA,EAAA,QAAA,QAAA;GAAA,YAAA,EAAA,SAAA,gBAAA;EAAA;EAAA,WAFb,CAAC;GAAE,SAAS;GAAiB,aAAa,iBAAiB,aAAa;EAAC,CAAE;EAAC,UAAA;EAAA,UAR7E;EAAgB,UAAA;EAAA,eAAA,GAAA,kBAAA;CAAA,CAAA;;AAUf,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAa,YAAA,CAAA;EAZzB,MAAA;EAAU,MAAA,CAAA;GACT,UAAU;GACV,UAAU;GACV,eAAe,kBAAkB;GACjC,MAAM;IACJ,WAAW;IACX,MAAM;GACP;GAGD,WAAW,CAAC;IAAE,SAAS;IAAiB,aAAa,iBAAgB,aAAc;GAAC,CAAE;EACvF,CAAA"}
1
+ {"version":3,"file":"ngwr-button.mjs","names":[],"sources":["../../../projects/lib/button/tokens/button-group.token.ts","../../../projects/lib/button/button.ts","../../../projects/lib/button/button.html","../../../projects/lib/button/button-group.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 { InjectionToken } from '@angular/core';\n\nimport type { WrButtonGroupContext } from '../types';\n\n/**\n * Token a `<wr-btn>` injects to discover its parent `<wr-btn-group>`. The\n * group provides itself via this token so children can react to the\n * group's `shape` cascade.\n *\n * @internal\n */\nexport const WR_BUTTON_GROUP = new InjectionToken<WrButtonGroupContext>('WR_BUTTON_GROUP');\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 {\n Component,\n DestroyRef,\n ElementRef,\n Injector,\n Renderer2,\n ViewEncapsulation,\n afterNextRender,\n computed,\n effect,\n inject,\n input,\n} 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 { WR_BUTTON_GROUP } from './tokens';\nimport type { WrButtonIconPosition, WrButtonShape, WrButtonSize } from './types';\n\n/**\n * Trigger an action. Renders as a `<wr-btn>` element, or attach to a\n * native `<button>` / `<a>` via the `wr-btn` attribute selector.\n *\n * @example\n * ```html\n * <button wr-btn color=\"primary\">Save</button>\n * <a wr-btn color=\"primary\" outlined>Cancel</a>\n * <wr-btn color=\"danger\" icon=\"trash\">Delete</wr-btn>\n * <wr-btn color=\"primary\" shape=\"pill\">Pill</wr-btn>\n * ```\n *\n * Inside a `<wr-btn-group shape=\"…\">`, the group's shape is enforced on\n * every child — child `[shape]` inputs are ignored so the group reads as\n * one coherent control.\n *\n * **Inside a `<form>`, use the native form.** `<wr-btn>` is a custom element\n * carrying `role=\"button\"`, and no custom element submits a form — the platform\n * submits for `<button>`, `<input type=\"submit\">` and `<input type=\"image\">`\n * and nothing else. That is why there is no `type` input: it would look like it\n * worked. Implicit submission (Enter in a text field) does not reach it either.\n *\n * ```html\n * <button wr-btn type=\"submit\" color=\"primary\">Save</button>\n * ```\n *\n * @see https://ngwr.dev/reference/components/button\n */\n@Component({\n selector: 'wr-btn, button[wr-btn], a[wr-btn]',\n templateUrl: './button.html',\n encapsulation: ViewEncapsulation.None,\n host: {\n class: 'wr-btn',\n '[class]': 'classes()',\n '[attr.disabled]': 'nativeDisabled()',\n '[attr.aria-busy]': 'loading() ? \"true\" : null',\n // The role applies ONLY to the `<wr-btn>` element form — see `isCustomHost`.\n // The tab stop and `aria-disabled` apply to it and to `<a wr-btn>`, where\n // `disabled` is just as inert. A native `<button>` already has all of it.\n '[attr.role]': 'hostRole()',\n '[attr.tabindex]': 'hostTabIndex()',\n '[attr.aria-disabled]': 'hostAriaDisabled()',\n '(keydown)': 'onHostKeydown($event)',\n '(focus)': 'onHostFocus()',\n '(blur)': 'onHostBlur()',\n },\n imports: [WrIcon, WrSpinner],\n})\nexport class WrButton {\n /**\n * Color variant. Omit for the neutral default style.\n *\n * @default null\n */\n readonly color = input<WrColor | null>(null);\n\n /** Size variant. @default 'md' */\n readonly size = input<WrButtonSize>('md');\n\n /**\n * Corner treatment — `rounded`, `pill` or `squircle`. `null` (default) falls\n * back to `rounded`. Inside a `<wr-btn-group shape=\"…\">`, the group's shape\n * ALWAYS wins over this input — the group enforces a consistent corner\n * treatment across its members.\n *\n * @default null\n */\n readonly shape = input<WrButtonShape | null>(null);\n\n /**\n * Icon name to render alongside the label. The icon is hidden while\n * `loading` is `true` so the spinner can take its place.\n *\n * @default null\n */\n readonly icon = input<WrIconName | null>(null);\n\n /** Position of the icon relative to the label. @default 'start' */\n readonly iconPosition = input<WrButtonIconPosition>('start');\n\n /** Disable the button. @default false */\n readonly disabled = input(false, { transform: coerceBooleanProperty });\n\n /** Outlined variant — colored text and border on a transparent background. @default false */\n readonly outlined = input(false, { transform: coerceBooleanProperty });\n\n /** Stretch the button to fill its parent's width. @default false */\n readonly block = input(false, { transform: coerceBooleanProperty });\n\n /** Show a spinner overlaying the label. Layout is preserved. @default false */\n readonly loading = input(false, { transform: coerceBooleanProperty });\n\n /**\n * When `loading` is `true` and this is also `true`, pointer events are\n * suppressed and the button reports as disabled to assistive tech.\n *\n * @default true\n */\n readonly disabledWhenLoading = input(true, { transform: coerceBooleanProperty });\n\n private readonly group = inject(WR_BUTTON_GROUP, { optional: true });\n\n /**\n * Resolved shape. Inside a `<wr-btn-group>`, the group ALWAYS wins — child\n * `[shape]` is ignored entirely so the group reads as one coherent control.\n * Outside a group, the button's own `[shape]` is used, falling back to\n * `rounded`.\n */\n protected readonly resolvedShape = computed<WrButtonShape>(() =>\n this.group ? (this.group.shape() ?? 'rounded') : (this.shape() ?? 'rounded')\n );\n\n private readonly hostEl = inject<ElementRef<HTMLElement>>(ElementRef);\n\n /**\n * Whether this instance is the `<wr-btn>` ELEMENT rather than the attribute\n * form on a native `<button>` / `<a>`.\n *\n * The element form is documented as first-class and is what the pagination,\n * event-calendar and popconfirm chrome use — but a custom element has no\n * button semantics of its own. It was rendering with no `role`, no\n * `tabindex` and no keyboard activation, so it was invisible to assistive\n * tech and unreachable by Tab. Measured in Chromium against the built site:\n * the whole `wr-pagination` subtree, 26 elements, contained ZERO focusable\n * nodes and sixty Tab presses never entered it. axe cannot see this — an\n * unknown element with no role simply is not an interactive control to it,\n * which is the same blind spot that lets `disabled` pass unnoticed on a\n * custom element.\n */\n private readonly isCustomHost = this.hostEl.nativeElement.tagName === 'WR-BTN';\n\n /**\n * Whether this instance is on an `<a>`. The `disabled` attribute means nothing\n * there either: a disabled or loading `<a wr-btn href>` kept its tab stop, was\n * announced as an enabled link and followed its `href` on Enter — only the mouse\n * was stopped, by `pointer-events: none`.\n */\n private readonly isAnchorHost = this.hostEl.nativeElement.tagName === 'A';\n\n private readonly isOff = computed(() => this.disabled() || (this.loading() && this.disabledWhenLoading()));\n\n protected readonly nativeDisabled = computed<'' | null>(() => (this.isOff() ? '' : null));\n\n protected readonly hostRole = computed<'button' | null>(() => (this.isCustomHost ? 'button' : null));\n\n /**\n * Out of the tab order while off — `disabled` is inert on a custom element and on\n * an `<a>`. The element form drops its stop; a link has one of its own, which `-1`\n * takes away.\n */\n protected readonly hostTabIndex = computed<'0' | '-1' | null>(() => {\n if (this.isCustomHost) return this.isOff() ? null : '0';\n return this.isAnchorHost && this.isOff() ? '-1' : null;\n });\n\n protected readonly hostAriaDisabled = computed<'true' | null>(() =>\n (this.isCustomHost || this.isAnchorHost) && this.isOff() ? 'true' : null\n );\n\n /**\n * Enter and Space activate a button. A native one does this for free; a\n * custom element does not, so without this the element form could be focused\n * (once it had a tabindex) and still not be operable.\n *\n * `preventDefault` on Space is not optional — it scrolls the page otherwise.\n * The pointer path needs no guard here: `.wr-btn[disabled]` already sets\n * `pointer-events: none`.\n */\n protected onHostKeydown(event: KeyboardEvent): void {\n // A link activates on Enter, which out of the tab order it can still receive\n // from a script or a screen reader's focus.\n if (this.isAnchorHost && this.isOff() && event.key === 'Enter') {\n event.preventDefault();\n return;\n }\n if (!this.isCustomHost) return;\n if (event.key !== 'Enter' && event.key !== ' ') return;\n\n event.preventDefault();\n if (this.isOff()) return;\n this.hostEl.nativeElement.click();\n }\n\n /**\n * A disabled `<a wr-btn>` activates nothing: no navigation, and no other click\n * listener on it — the `(click)` of the template and a `routerLink` included,\n * the same silence a disabled `<button>` keeps. The pointer never gets here past\n * `pointer-events: none`; a screen reader's activation and `.click()` do.\n *\n * A CAPTURE listener, because a host listener is registered after the\n * template's own `(click)` on the same element and could not stop it; at the\n * target, capture listeners run first.\n */\n private readonly onAnchorClick = (event: MouseEvent): void => {\n if (!this.isOff()) return;\n event.preventDefault();\n event.stopImmediatePropagation();\n };\n\n private readonly injector = inject(Injector);\n\n /**\n * Whether this button is the one the caret was on, so it can be handed back\n * the focus that goes missing while it is off.\n *\n * A control that becomes `disabled` while focused stops being a focusable\n * area, and the browser runs the unfocusing steps: nothing else is nominated,\n * so the caret lands on `<body>`. With `disabledWhenLoading` on by default\n * that happens on EVERY async button — a keyboard user presses Enter on\n * \"Save\" and the next Tab restarts from the top of the document, while a\n * screen-reader user is told neither that the wait began nor that it ended,\n * because the element they were on has left the a11y tree. The `<wr-btn>`\n * element form loses its `tabindex` instead of gaining `disabled` and is\n * unfocused for the same reason.\n *\n * Deliberately NOT keyed on reading `activeElement` when `isOff()` flips: an\n * effect in this component's own view runs AFTER the parent has applied this\n * directive's host bindings, so by then the attribute has landed and the\n * browser has already moved the caret — the read would answer `<body>` on\n * every real browser and the button on jsdom, which is the worst of both.\n *\n * The flag is written by the focus listeners instead, and a `blur` fired\n * WHILE off keeps it set rather than clearing it: that blur is the browser\n * taking the caret away, not the user leaving. A browser that fires no blur\n * on disable at all is covered too — the flag simply stays as `focus` left it,\n * and the `<body>` test below is what decides whether the focus is orphaned.\n */\n private hadFocus = false;\n\n /** @internal Host `focus` — see `hadFocus`. */\n protected onHostFocus(): void {\n this.hadFocus = true;\n }\n\n /** @internal Host `blur` — see `hadFocus`. */\n protected onHostBlur(): void {\n this.hadFocus = this.isOff();\n }\n\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('button');\n if (this.isAnchorHost) {\n const stop = inject(Renderer2).listen(this.hostEl.nativeElement, 'click', this.onAnchorClick, { capture: true });\n inject(DestroyRef).onDestroy(stop);\n }\n\n effect(() => {\n if (this.isOff()) return;\n if (!this.hadFocus) return;\n const el = this.hostEl.nativeElement;\n\n // Deferred: the host binding that drops `disabled` (or restores the\n // `tabindex`) has not necessarily run yet, and `focus()` on a still\n // disabled element is a silent no-op — the exact failure this is here to\n // fix.\n afterNextRender(\n () => {\n if (!this.hadFocus || this.isOff()) return;\n const doc = el.ownerDocument;\n const active = doc?.activeElement ?? null;\n // Still ours — nothing was ever taken away, so keep the flag for the\n // cycle that does take it.\n if (active === el) return;\n // Someone else owns the caret now: a user who tabbed on while the\n // request was in flight must not be yanked back to a button they have\n // finished with.\n this.hadFocus = false;\n if (active && doc && active !== doc.body) return;\n el.focus();\n },\n { injector: this.injector }\n );\n });\n }\n\n protected readonly classes = computed(() => {\n const parts: string[] = [];\n\n const color = this.color();\n if (color) parts.push(`wr-btn--${color}`);\n\n const size = this.size();\n if (size !== 'md') parts.push(`wr-btn--${size}`);\n\n const shape = this.resolvedShape();\n if (shape !== 'rounded') parts.push(`wr-btn--${shape}`);\n\n if (this.outlined()) parts.push('wr-btn--outlined');\n if (this.block()) parts.push('wr-btn--block');\n if (this.loading()) parts.push('wr-btn--loading');\n\n const hasAdornment = !!this.icon() || this.loading();\n if (hasAdornment) parts.push(`wr-btn--icon-${this.iconPosition()}`);\n\n return parts.join(' ');\n });\n}\n","<!--\n `aria-hidden`: the spinner is a `role=\"status\"` region named \"Loading\", and inside\n the button it became the button's whole name while the label was hidden. The\n button already says it is busy with `aria-busy`.\n-->\n@if (loading()) {\n <wr-spinner class=\"wr-btn__spin\" size=\"sm\" aria-hidden=\"true\" />\n}\n\n@if (icon(); as name) {\n <wr-icon class=\"wr-btn__icon\" [name]=\"name\" />\n}\n\n<span class=\"wr-btn__label\">\n <ng-content />\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\nimport { Component, ViewEncapsulation, computed, forwardRef, input } from '@angular/core';\n\nimport { wrCheckStyles } from 'ngwr/utils';\n\nimport { WR_BUTTON_GROUP } from './tokens';\nimport type { WrButtonShape, WrButtonGroupContext } from './types';\n\n/**\n * Visually group buttons by merging their borders. Optionally enforce a\n * single corner treatment across every child via `[shape]` — child\n * `<wr-btn>` `[shape]` inputs are ignored when set on the group.\n *\n * @example\n * ```html\n * <wr-btn-group>\n * <button wr-btn>Left</button>\n * <button wr-btn>Middle</button>\n * <button wr-btn>Right</button>\n * </wr-btn-group>\n *\n * <wr-btn-group shape=\"pill\">\n * <button wr-btn>One</button>\n * <button wr-btn>Two</button>\n * <button wr-btn>Three</button>\n * </wr-btn-group>\n * ```\n *\n * @see https://ngwr.dev/reference/components/button-group\n */\n@Component({\n selector: 'wr-btn-group',\n template: '<ng-content />',\n encapsulation: ViewEncapsulation.None,\n host: {\n class: 'wr-btn-group',\n '[class]': 'hostClasses()',\n role: 'group',\n },\n // forwardRef required: WrButtonGroup is self-referenced before its declaration ends.\n // eslint-disable-next-line @angular-eslint/no-forward-ref\n providers: [{ provide: WR_BUTTON_GROUP, useExisting: forwardRef(() => WrButtonGroup) }],\n})\nexport class WrButtonGroup implements WrButtonGroupContext {\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('button');\n }\n\n /**\n * Corner treatment enforced on every child `<wr-btn>`. Child `[shape]`\n * inputs are ignored when this is set — the group exists to make a\n * uniform control. `null` (default) leaves children alone.\n *\n * @default null\n */\n readonly shape = input<WrButtonShape | null>(null);\n\n protected readonly hostClasses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