ngwr 16.0.0 → 16.1.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 (268) 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 +6 -2
  6. package/date-stamp/styles/_index.scss +38 -0
  7. package/dialog/styles/_index.scss +38 -0
  8. package/fesm2022/internal-CVLvP9b_.mjs +33 -0
  9. package/fesm2022/internal-CVLvP9b_.mjs.map +1 -0
  10. package/fesm2022/ngwr-alert.mjs +11 -7
  11. package/fesm2022/ngwr-alert.mjs.map +1 -1
  12. package/fesm2022/ngwr-avatar.mjs +11 -7
  13. package/fesm2022/ngwr-avatar.mjs.map +1 -1
  14. package/fesm2022/ngwr-back-top.mjs +10 -6
  15. package/fesm2022/ngwr-back-top.mjs.map +1 -1
  16. package/fesm2022/ngwr-badge.mjs +18 -6
  17. package/fesm2022/ngwr-badge.mjs.map +1 -1
  18. package/fesm2022/ngwr-burger.mjs +9 -6
  19. package/fesm2022/ngwr-burger.mjs.map +1 -1
  20. package/fesm2022/ngwr-button.mjs +8 -4
  21. package/fesm2022/ngwr-button.mjs.map +1 -1
  22. package/fesm2022/ngwr-calendar.mjs +19 -8
  23. package/fesm2022/ngwr-calendar.mjs.map +1 -1
  24. package/fesm2022/ngwr-card.mjs +9 -5
  25. package/fesm2022/ngwr-card.mjs.map +1 -1
  26. package/fesm2022/ngwr-cascader.mjs +11 -5
  27. package/fesm2022/ngwr-cascader.mjs.map +1 -1
  28. package/fesm2022/ngwr-charts-calendar-heatmap.mjs +5 -2
  29. package/fesm2022/ngwr-charts-calendar-heatmap.mjs.map +1 -1
  30. package/fesm2022/ngwr-checkbox.mjs +10 -6
  31. package/fesm2022/ngwr-checkbox.mjs.map +1 -1
  32. package/fesm2022/ngwr-clipboard.mjs +2 -1
  33. package/fesm2022/ngwr-clipboard.mjs.map +1 -1
  34. package/fesm2022/ngwr-collapse.mjs +9 -5
  35. package/fesm2022/ngwr-collapse.mjs.map +1 -1
  36. package/fesm2022/ngwr-color-picker.mjs +4 -2
  37. package/fesm2022/ngwr-color-picker.mjs.map +1 -1
  38. package/fesm2022/ngwr-comment.mjs +13 -7
  39. package/fesm2022/ngwr-comment.mjs.map +1 -1
  40. package/fesm2022/ngwr-compare.mjs +9 -3
  41. package/fesm2022/ngwr-compare.mjs.map +1 -1
  42. package/fesm2022/ngwr-context-menu.mjs +4 -2
  43. package/fesm2022/ngwr-context-menu.mjs.map +1 -1
  44. package/fesm2022/ngwr-copy-value.mjs +11 -6
  45. package/fesm2022/ngwr-copy-value.mjs.map +1 -1
  46. package/fesm2022/ngwr-date-picker.mjs +86 -30
  47. package/fesm2022/ngwr-date-picker.mjs.map +1 -1
  48. package/fesm2022/ngwr-date-stamp-testing.mjs +34 -0
  49. package/fesm2022/ngwr-date-stamp-testing.mjs.map +1 -0
  50. package/fesm2022/ngwr-date-stamp.mjs +149 -0
  51. package/fesm2022/ngwr-date-stamp.mjs.map +1 -0
  52. package/fesm2022/ngwr-date.mjs +279 -50
  53. package/fesm2022/ngwr-date.mjs.map +1 -1
  54. package/fesm2022/ngwr-descriptions.mjs +9 -5
  55. package/fesm2022/ngwr-descriptions.mjs.map +1 -1
  56. package/fesm2022/ngwr-dialog-testing.mjs +23 -2
  57. package/fesm2022/ngwr-dialog-testing.mjs.map +1 -1
  58. package/fesm2022/ngwr-dialog.mjs +45 -16
  59. package/fesm2022/ngwr-dialog.mjs.map +1 -1
  60. package/fesm2022/ngwr-directives.mjs +102 -11
  61. package/fesm2022/ngwr-directives.mjs.map +1 -1
  62. package/fesm2022/ngwr-divider.mjs +4 -2
  63. package/fesm2022/ngwr-divider.mjs.map +1 -1
  64. package/fesm2022/ngwr-drawer.mjs +29 -3
  65. package/fesm2022/ngwr-drawer.mjs.map +1 -1
  66. package/fesm2022/ngwr-dropdown.mjs +4 -2
  67. package/fesm2022/ngwr-dropdown.mjs.map +1 -1
  68. package/fesm2022/ngwr-editor.mjs +5 -2
  69. package/fesm2022/ngwr-editor.mjs.map +1 -1
  70. package/fesm2022/ngwr-event-calendar.mjs +4 -2
  71. package/fesm2022/ngwr-event-calendar.mjs.map +1 -1
  72. package/fesm2022/ngwr-file-upload.mjs +9 -3
  73. package/fesm2022/ngwr-file-upload.mjs.map +1 -1
  74. package/fesm2022/ngwr-form.mjs +18 -6
  75. package/fesm2022/ngwr-form.mjs.map +1 -1
  76. package/fesm2022/ngwr-i18n-ar.mjs +2 -0
  77. package/fesm2022/ngwr-i18n-ar.mjs.map +1 -1
  78. package/fesm2022/ngwr-i18n-cs.mjs +2 -0
  79. package/fesm2022/ngwr-i18n-cs.mjs.map +1 -1
  80. package/fesm2022/ngwr-i18n-de.mjs +2 -0
  81. package/fesm2022/ngwr-i18n-de.mjs.map +1 -1
  82. package/fesm2022/ngwr-i18n-en.mjs +2 -0
  83. package/fesm2022/ngwr-i18n-en.mjs.map +1 -1
  84. package/fesm2022/ngwr-i18n-es.mjs +2 -0
  85. package/fesm2022/ngwr-i18n-es.mjs.map +1 -1
  86. package/fesm2022/ngwr-i18n-fr.mjs +2 -0
  87. package/fesm2022/ngwr-i18n-fr.mjs.map +1 -1
  88. package/fesm2022/ngwr-i18n-he.mjs +2 -0
  89. package/fesm2022/ngwr-i18n-he.mjs.map +1 -1
  90. package/fesm2022/ngwr-i18n-hi.mjs +2 -0
  91. package/fesm2022/ngwr-i18n-hi.mjs.map +1 -1
  92. package/fesm2022/ngwr-i18n-id.mjs +2 -0
  93. package/fesm2022/ngwr-i18n-id.mjs.map +1 -1
  94. package/fesm2022/ngwr-i18n-it.mjs +2 -0
  95. package/fesm2022/ngwr-i18n-it.mjs.map +1 -1
  96. package/fesm2022/ngwr-i18n-ja.mjs +2 -0
  97. package/fesm2022/ngwr-i18n-ja.mjs.map +1 -1
  98. package/fesm2022/ngwr-i18n-ko.mjs +2 -0
  99. package/fesm2022/ngwr-i18n-ko.mjs.map +1 -1
  100. package/fesm2022/ngwr-i18n-nl.mjs +2 -0
  101. package/fesm2022/ngwr-i18n-nl.mjs.map +1 -1
  102. package/fesm2022/ngwr-i18n-pl.mjs +2 -0
  103. package/fesm2022/ngwr-i18n-pl.mjs.map +1 -1
  104. package/fesm2022/ngwr-i18n-pt.mjs +2 -0
  105. package/fesm2022/ngwr-i18n-pt.mjs.map +1 -1
  106. package/fesm2022/ngwr-i18n-ru.mjs +2 -0
  107. package/fesm2022/ngwr-i18n-ru.mjs.map +1 -1
  108. package/fesm2022/ngwr-i18n-sv.mjs +2 -0
  109. package/fesm2022/ngwr-i18n-sv.mjs.map +1 -1
  110. package/fesm2022/ngwr-i18n-tr.mjs +2 -0
  111. package/fesm2022/ngwr-i18n-tr.mjs.map +1 -1
  112. package/fesm2022/ngwr-i18n-uk.mjs +2 -0
  113. package/fesm2022/ngwr-i18n-uk.mjs.map +1 -1
  114. package/fesm2022/ngwr-i18n-vi.mjs +2 -0
  115. package/fesm2022/ngwr-i18n-vi.mjs.map +1 -1
  116. package/fesm2022/ngwr-i18n-zh-tw.mjs +2 -0
  117. package/fesm2022/ngwr-i18n-zh-tw.mjs.map +1 -1
  118. package/fesm2022/ngwr-i18n-zh.mjs +2 -0
  119. package/fesm2022/ngwr-i18n-zh.mjs.map +1 -1
  120. package/fesm2022/ngwr-i18n.mjs +34 -8
  121. package/fesm2022/ngwr-i18n.mjs.map +1 -1
  122. package/fesm2022/ngwr-input-number.mjs +9 -3
  123. package/fesm2022/ngwr-input-number.mjs.map +1 -1
  124. package/fesm2022/ngwr-input-otp.mjs +4 -2
  125. package/fesm2022/ngwr-input-otp.mjs.map +1 -1
  126. package/fesm2022/ngwr-input.mjs +20 -10
  127. package/fesm2022/ngwr-input.mjs.map +1 -1
  128. package/fesm2022/ngwr-keyboard.mjs +9 -3
  129. package/fesm2022/ngwr-keyboard.mjs.map +1 -1
  130. package/fesm2022/ngwr-knob.mjs +9 -3
  131. package/fesm2022/ngwr-knob.mjs.map +1 -1
  132. package/fesm2022/ngwr-layout.mjs +13 -5
  133. package/fesm2022/ngwr-layout.mjs.map +1 -1
  134. package/fesm2022/ngwr-lightbox.mjs +9 -5
  135. package/fesm2022/ngwr-lightbox.mjs.map +1 -1
  136. package/fesm2022/ngwr-list.mjs +13 -5
  137. package/fesm2022/ngwr-list.mjs.map +1 -1
  138. package/fesm2022/ngwr-load-state.mjs +9 -5
  139. package/fesm2022/ngwr-load-state.mjs.map +1 -1
  140. package/fesm2022/ngwr-overlay.mjs +84 -1
  141. package/fesm2022/ngwr-overlay.mjs.map +1 -1
  142. package/fesm2022/ngwr-pagination.mjs +3 -2
  143. package/fesm2022/ngwr-pagination.mjs.map +1 -1
  144. package/fesm2022/ngwr-pipes.mjs +21 -5
  145. package/fesm2022/ngwr-pipes.mjs.map +1 -1
  146. package/fesm2022/ngwr-popover.mjs +93 -4
  147. package/fesm2022/ngwr-popover.mjs.map +1 -1
  148. package/fesm2022/ngwr-progress.mjs +4 -2
  149. package/fesm2022/ngwr-progress.mjs.map +1 -1
  150. package/fesm2022/ngwr-radio.mjs +9 -5
  151. package/fesm2022/ngwr-radio.mjs.map +1 -1
  152. package/fesm2022/ngwr-rating.mjs +9 -3
  153. package/fesm2022/ngwr-rating.mjs.map +1 -1
  154. package/fesm2022/ngwr-resizable.mjs +503 -0
  155. package/fesm2022/ngwr-resizable.mjs.map +1 -0
  156. package/fesm2022/ngwr-result.mjs +9 -5
  157. package/fesm2022/ngwr-result.mjs.map +1 -1
  158. package/fesm2022/ngwr-segmented.mjs +4 -2
  159. package/fesm2022/ngwr-segmented.mjs.map +1 -1
  160. package/fesm2022/ngwr-select.mjs +13 -5
  161. package/fesm2022/ngwr-select.mjs.map +1 -1
  162. package/fesm2022/ngwr-skeleton.mjs +4 -2
  163. package/fesm2022/ngwr-skeleton.mjs.map +1 -1
  164. package/fesm2022/ngwr-slider.mjs +4 -2
  165. package/fesm2022/ngwr-slider.mjs.map +1 -1
  166. package/fesm2022/ngwr-speed-dial.mjs +4 -2
  167. package/fesm2022/ngwr-speed-dial.mjs.map +1 -1
  168. package/fesm2022/ngwr-spinner.mjs +4 -2
  169. package/fesm2022/ngwr-spinner.mjs.map +1 -1
  170. package/fesm2022/ngwr-splitter.mjs +17 -21
  171. package/fesm2022/ngwr-splitter.mjs.map +1 -1
  172. package/fesm2022/ngwr-stepper.mjs +9 -3
  173. package/fesm2022/ngwr-stepper.mjs.map +1 -1
  174. package/fesm2022/ngwr-switch.mjs +9 -5
  175. package/fesm2022/ngwr-switch.mjs.map +1 -1
  176. package/fesm2022/ngwr-table-testing.mjs +5 -1
  177. package/fesm2022/ngwr-table-testing.mjs.map +1 -1
  178. package/fesm2022/ngwr-table.mjs +167 -10
  179. package/fesm2022/ngwr-table.mjs.map +1 -1
  180. package/fesm2022/ngwr-textarea.mjs +9 -3
  181. package/fesm2022/ngwr-textarea.mjs.map +1 -1
  182. package/fesm2022/ngwr-timeline.mjs +18 -8
  183. package/fesm2022/ngwr-timeline.mjs.map +1 -1
  184. package/fesm2022/ngwr-toast-testing.mjs +6 -1
  185. package/fesm2022/ngwr-toast-testing.mjs.map +1 -1
  186. package/fesm2022/ngwr-toast.mjs +529 -104
  187. package/fesm2022/ngwr-toast.mjs.map +1 -1
  188. package/fesm2022/ngwr-transfer.mjs +4 -2
  189. package/fesm2022/ngwr-transfer.mjs.map +1 -1
  190. package/fesm2022/ngwr-tree.mjs +4 -2
  191. package/fesm2022/ngwr-tree.mjs.map +1 -1
  192. package/fesm2022/ngwr-typography.mjs +9 -3
  193. package/fesm2022/ngwr-typography.mjs.map +1 -1
  194. package/fesm2022/ngwr-utils-router.mjs +18 -2
  195. package/fesm2022/ngwr-utils-router.mjs.map +1 -1
  196. package/fesm2022/ngwr-utils.mjs +9 -2
  197. package/fesm2022/ngwr-utils.mjs.map +1 -1
  198. package/fesm2022/ngwr-version.mjs +1 -1
  199. package/fesm2022/ngwr-version.mjs.map +1 -1
  200. package/fesm2022/ngwr-window.mjs +7 -4
  201. package/fesm2022/ngwr-window.mjs.map +1 -1
  202. package/fesm2022/ngwr.mjs.map +1 -1
  203. package/i18n/ar.json +6 -0
  204. package/i18n/cs.json +6 -0
  205. package/i18n/de.json +6 -0
  206. package/i18n/en.json +6 -0
  207. package/i18n/es.json +6 -0
  208. package/i18n/fr.json +6 -0
  209. package/i18n/he.json +6 -0
  210. package/i18n/hi.json +6 -0
  211. package/i18n/id.json +6 -0
  212. package/i18n/it.json +6 -0
  213. package/i18n/ja.json +6 -0
  214. package/i18n/ko.json +6 -0
  215. package/i18n/nl.json +6 -0
  216. package/i18n/pl.json +6 -0
  217. package/i18n/pt.json +6 -0
  218. package/i18n/ru.json +6 -0
  219. package/i18n/sv.json +6 -0
  220. package/i18n/tr.json +6 -0
  221. package/i18n/uk.json +6 -0
  222. package/i18n/vi.json +6 -0
  223. package/i18n/zh-TW.json +6 -0
  224. package/i18n/zh.json +6 -0
  225. package/input/styles/_index.scss +10 -5
  226. package/input-number/styles/_index.scss +6 -3
  227. package/input-otp/styles/_index.scss +4 -2
  228. package/llms-full.txt +29 -10
  229. package/llms.txt +8 -4
  230. package/package.json +15 -1
  231. package/radio/styles/_index.scss +4 -2
  232. package/resizable/styles/_index.scss +154 -0
  233. package/schematics/use/rule.js +1 -0
  234. package/schematics/use/symbol-map.json +4 -0
  235. package/select/styles/_index.scss +6 -3
  236. package/skills/ngwr/SKILL.md +1 -1
  237. package/skills/ngwr/references/catalog.md +4 -1
  238. package/skills/ngwr/references/setup.md +3 -0
  239. package/switch/styles/_index.scss +4 -2
  240. package/table/styles/_index.scss +53 -0
  241. package/textarea/styles/_index.scss +4 -2
  242. package/theme/styles/_motion.scss +6 -0
  243. package/toast/styles/_index.scss +19 -0
  244. package/types/ngwr-burger.d.ts +0 -1
  245. package/types/ngwr-calendar.d.ts +7 -0
  246. package/types/ngwr-charts-calendar-heatmap.d.ts +2 -1
  247. package/types/ngwr-clipboard.d.ts +7 -0
  248. package/types/ngwr-date-picker.d.ts +9 -2
  249. package/types/ngwr-date-stamp-testing.d.ts +47 -0
  250. package/types/ngwr-date-stamp.d.ts +81 -0
  251. package/types/ngwr-date.d.ts +135 -24
  252. package/types/ngwr-dialog-testing.d.ts +10 -0
  253. package/types/ngwr-dialog.d.ts +72 -4
  254. package/types/ngwr-directives.d.ts +36 -1
  255. package/types/ngwr-drawer.d.ts +21 -0
  256. package/types/ngwr-i18n.d.ts +44 -14
  257. package/types/ngwr-overlay.d.ts +36 -0
  258. package/types/ngwr-pipes.d.ts +15 -0
  259. package/types/ngwr-popover.d.ts +39 -1
  260. package/types/ngwr-resizable.d.ts +228 -0
  261. package/types/ngwr-table-testing.d.ts +3 -1
  262. package/types/ngwr-table.d.ts +120 -4
  263. package/types/ngwr-toast-testing.d.ts +12 -1
  264. package/types/ngwr-toast.d.ts +215 -18
  265. package/types/ngwr-utils-router.d.ts +22 -0
  266. package/types/ngwr-utils.d.ts +8 -1
  267. package/types/ngwr-version.d.ts +1 -1
  268. package/types/ngwr.d.ts +1 -0
@@ -50,7 +50,8 @@
50
50
  transition: var(--wr-transition-base);
51
51
 
52
52
  // Shape
53
- &--rounded {
53
+ &--rounded,
54
+ &:where([rounded]:not([rounded='false'])) {
54
55
  --wr-tag-radius: var(--wr-border-radius-pill);
55
56
  --wr-tag-padding-x: var(--wr-space-md);
56
57
  }
@@ -77,7 +78,8 @@
77
78
 
78
79
  // Colored variants
79
80
  @each $name in theme.$colors {
80
- &--#{$name} {
81
+ &--#{$name},
82
+ &:where([color='#{$name}']) {
81
83
  --wr-tag-color: var(--wr-color-#{$name}-contrast);
82
84
  --wr-tag-bg: var(--wr-color-#{$name});
83
85
  --wr-tag-border: var(--wr-color-#{$name});
@@ -88,13 +90,15 @@
88
90
  // whole visual change here. The 6% fill stays, and that is the one place
89
91
  // the two deliberately differ: a tag is a chip you can click, hover and
90
92
  // dismiss, so it keeps a body the badge has none of.
91
- &.wr-tag--outlined {
93
+ &.wr-tag--outlined,
94
+ &:where([outlined]:not([outlined='false'])) {
92
95
  --wr-tag-color: var(--wr-color-#{$name}-ink);
93
96
  --wr-tag-bg: color-mix(in srgb, var(--wr-color-#{$name}) 6%, transparent);
94
97
  --wr-tag-border: var(--wr-color-#{$name}-soft-border);
95
98
  }
96
99
 
97
- &.wr-tag--transparent {
100
+ &.wr-tag--transparent,
101
+ &:where([transparent]:not([transparent='false'])) {
98
102
  --wr-tag-color: var(--wr-color-#{$name}-ink);
99
103
  --wr-tag-bg: color-mix(in srgb, var(--wr-color-#{$name}) 10%, transparent);
100
104
  --wr-tag-border: transparent;
@@ -141,7 +141,7 @@
141
141
  //
142
142
  // `block` is excluded — it is width:100% by contract, and squaring it would
143
143
  // turn a full-width button into a giant tile.
144
- &:has(> &__label:empty):not(&--block) {
144
+ &:has(> &__label:empty):not(&--block, &:where([block]:not([block='false']))) {
145
145
  padding-inline: calc(var(--wr-btn-padding-y) * var(--wr-density-y, 1));
146
146
 
147
147
  .wr-btn__icon {
@@ -175,7 +175,8 @@
175
175
  // three `--wr-control-*-sm` tokens are shared so button, input and select line
176
176
  // up in a row, and 22px is the number `/guides/tokens/sizing` publishes.
177
177
  // Space the targets, or use `md` where they sit together.
178
- &--sm {
178
+ &--sm,
179
+ &:where([size='sm']) {
179
180
  --wr-btn-radius: var(--wr-control-radius-sm);
180
181
  --wr-btn-gap: var(--wr-space-xs);
181
182
  --wr-btn-padding-y: var(--wr-control-padding-y-sm);
@@ -185,7 +186,8 @@
185
186
  --wr-btn-icon-size: 0.875rem; // 14px
186
187
  }
187
188
 
188
- &--lg {
189
+ &--lg,
190
+ &:where([size='lg']) {
189
191
  --wr-btn-radius: var(--wr-control-radius-lg);
190
192
  --wr-btn-gap: var(--wr-space-md);
191
193
  --wr-btn-padding-y: var(--wr-control-padding-y-lg);
@@ -217,7 +219,8 @@
217
219
  }
218
220
 
219
221
  // Layout
220
- &--block {
222
+ &--block,
223
+ &:where([block]:not([block='false'])) {
221
224
  display: flex;
222
225
  width: 100%;
223
226
  }
@@ -249,7 +252,8 @@
249
252
  // wherever a removed intent had been, and the docs page put the two side by
250
253
  // side. Transparent rather than a tint: the border is the whole of what
251
254
  // outlined means here, and the surface behind it belongs to the host.
252
- &--outlined {
255
+ &--outlined,
256
+ &:where([outlined]:not([outlined='false'])) {
253
257
  --wr-btn-bg: transparent;
254
258
 
255
259
  &:hover {
@@ -263,7 +267,8 @@
263
267
 
264
268
  // Color variants
265
269
  @each $name in theme.$colors {
266
- &--#{$name} {
270
+ &--#{$name},
271
+ &:where([color='#{$name}']) {
267
272
  --wr-btn-color: var(--wr-color-#{$name}-contrast);
268
273
  --wr-btn-bg: var(--wr-color-#{$name});
269
274
  --wr-btn-border: var(--wr-color-#{$name});
@@ -278,7 +283,8 @@
278
283
  --wr-btn-border: var(--wr-color-#{$name}-darker);
279
284
  }
280
285
 
281
- &.wr-btn--outlined {
286
+ &.wr-btn--outlined,
287
+ &:where([outlined]:not([outlined='false'])) {
282
288
  // `-ink`, not the bare intent. The label is TEXT on whatever surface the
283
289
  // host gives the transparent button, and the bare token does not clear
284
290
  // AA there: `#3567ff` on the dark canvas measures 4.06:1, and in light
@@ -73,7 +73,8 @@
73
73
  }
74
74
 
75
75
  // Sizes — trigger on the control contract (sm 22 / md 30 / lg 36).
76
- &--sm {
76
+ &--sm,
77
+ &:where([size='sm']) {
77
78
  --wr-cascader-radius: var(--wr-control-radius-sm);
78
79
  --wr-cascader-padding-y: var(--wr-control-padding-y-sm);
79
80
  --wr-cascader-padding-x: var(--wr-control-padding-x-sm);
@@ -81,7 +82,8 @@
81
82
  --wr-cascader-line-height: var(--wr-control-line-height-sm);
82
83
  }
83
84
 
84
- &--lg {
85
+ &--lg,
86
+ &:where([size='lg']) {
85
87
  --wr-cascader-radius: var(--wr-control-radius-lg);
86
88
  --wr-cascader-padding-y: var(--wr-control-padding-y-lg);
87
89
  --wr-cascader-padding-x: var(--wr-control-padding-x-lg);
@@ -100,14 +100,16 @@
100
100
  }
101
101
 
102
102
  // Sizes — box, radius, label font + line-height scale together.
103
- &--sm {
103
+ &--sm,
104
+ &:where([size='sm']) {
104
105
  --wr-checkbox-size: 1rem; // 16px
105
106
  --wr-checkbox-radius: var(--wr-control-radius-sm);
106
107
  --wr-checkbox-font-size: var(--wr-text-xs);
107
108
  --wr-checkbox-line-height: var(--wr-control-line-height-sm);
108
109
  }
109
110
 
110
- &--lg {
111
+ &--lg,
112
+ &:where([size='lg']) {
111
113
  --wr-checkbox-size: 1.25rem; // 20px
112
114
  --wr-checkbox-radius: var(--wr-control-radius-lg);
113
115
  --wr-checkbox-font-size: var(--wr-text-base);
@@ -122,7 +122,9 @@
122
122
  // `wr-input--<size>` themselves; the group and the trigger are their siblings and
123
123
  // read the size from the host. Both pickers draw the same trigger.
124
124
  .wr-date-picker--sm,
125
- .wr-date-range-picker--sm {
125
+ .wr-date-picker:where([size='sm']),
126
+ .wr-date-range-picker--sm,
127
+ .wr-date-range-picker:where([size='sm']) {
126
128
  > .wr-input-group {
127
129
  --wr-input-group-radius: var(--wr-control-radius-sm);
128
130
  --wr-input-group-padding-x: var(--wr-control-padding-x-sm);
@@ -138,7 +140,9 @@
138
140
  }
139
141
 
140
142
  .wr-date-picker--lg,
141
- .wr-date-range-picker--lg {
143
+ .wr-date-picker:where([size='lg']),
144
+ .wr-date-range-picker--lg,
145
+ .wr-date-range-picker:where([size='lg']) {
142
146
  > .wr-input-group {
143
147
  --wr-input-group-radius: var(--wr-control-radius-lg);
144
148
  --wr-input-group-padding-x: var(--wr-control-padding-x-lg);
@@ -0,0 +1,38 @@
1
+ @use '../../theme/styles' as theme;
2
+
3
+ @include theme.loaded('date-stamp');
4
+
5
+ .wr-date-stamp {
6
+ --wr-date-stamp-gap: 0;
7
+ --wr-date-stamp-line-height: var(--wr-text-sm-leading);
8
+ --wr-date-stamp-date-color: inherit;
9
+ --wr-date-stamp-time-color: var(--wr-color-on-surface-muted);
10
+ --wr-date-stamp-time-font-size: var(--wr-text-sm);
11
+ --wr-date-stamp-empty-color: var(--wr-color-on-surface-muted);
12
+
13
+ display: inline-block;
14
+ // A column of stamps lines up digit under digit.
15
+ font-variant-numeric: tabular-nums;
16
+ line-height: var(--wr-date-stamp-line-height);
17
+ white-space: nowrap;
18
+ vertical-align: middle;
19
+
20
+ &__value {
21
+ display: inline-flex;
22
+ flex-direction: column;
23
+ gap: var(--wr-date-stamp-gap);
24
+ }
25
+
26
+ &__date {
27
+ color: var(--wr-date-stamp-date-color);
28
+ }
29
+
30
+ &__time {
31
+ color: var(--wr-date-stamp-time-color);
32
+ font-size: var(--wr-date-stamp-time-font-size);
33
+ }
34
+
35
+ &__empty {
36
+ color: var(--wr-date-stamp-empty-color);
37
+ }
38
+ }
@@ -86,6 +86,12 @@
86
86
  --wr-dialog-close-radius: var(--wr-border-radius-sm);
87
87
  --wr-dialog-close-font-size: var(--wr-text-base);
88
88
  --wr-dialog-footer-gap: var(--wr-space-sm);
89
+ --wr-dialog-intent-size: 1.25rem;
90
+ --wr-dialog-intent-gap: var(--wr-space-sm);
91
+ --wr-dialog-intent-info: var(--wr-color-info);
92
+ --wr-dialog-intent-success: var(--wr-color-success);
93
+ --wr-dialog-intent-warning: var(--wr-color-warning);
94
+ --wr-dialog-intent-danger: var(--wr-color-danger);
89
95
 
90
96
  display: flex;
91
97
  flex-direction: column;
@@ -248,6 +254,38 @@
248
254
  }
249
255
  }
250
256
 
257
+ // `confirm()` and `alert()`: the intent icon sits before the title as a flex
258
+ // item, so a title that wraps keeps its lines clear of the icon.
259
+ .wr-dialog-confirm {
260
+ .wr-dialog__title {
261
+ display: flex;
262
+ align-items: flex-start;
263
+ gap: var(--wr-dialog-intent-gap);
264
+ }
265
+
266
+ &__icon {
267
+ flex: 0 0 auto;
268
+ width: var(--wr-dialog-intent-size);
269
+ height: var(--wr-dialog-intent-size);
270
+ // Centred on the title's first line.
271
+ margin-block-start: calc((var(--wr-dialog-title-line-height) - var(--wr-dialog-intent-size)) / 2);
272
+
273
+ // Written out, not looped: `gen:css-vars` reads the hooks from the source.
274
+ &--info {
275
+ color: var(--wr-dialog-intent-info);
276
+ }
277
+ &--success {
278
+ color: var(--wr-dialog-intent-success);
279
+ }
280
+ &--warning {
281
+ color: var(--wr-dialog-intent-warning);
282
+ }
283
+ &--danger {
284
+ color: var(--wr-dialog-intent-danger);
285
+ }
286
+ }
287
+ }
288
+
251
289
  @keyframes wr-dialog-enter {
252
290
  from {
253
291
  opacity: 0;
@@ -0,0 +1,33 @@
1
+ /**
2
+ * @license
3
+ *
4
+ * Use of this source code is governed by an MIT-style license that can be
5
+ * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE
6
+ */
7
+ function wrSeparatorKeyMove(event, axis, rtl) {
8
+ if (event.key === "Home") return "min";
9
+ if (event.key === "End") return "max";
10
+ if (axis === "inline") {
11
+ const forward = rtl ? -1 : 1;
12
+ if (event.key === "ArrowLeft") return -forward;
13
+ if (event.key === "ArrowRight") return forward;
14
+ return null;
15
+ }
16
+ if (event.key === "ArrowUp") return -1;
17
+ if (event.key === "ArrowDown") return 1;
18
+ return null;
19
+ }
20
+ function wrBeginSeparatorDrag(event) {
21
+ if (event.button !== 0 || !event.isPrimary) return false;
22
+ event.preventDefault();
23
+ const separator = event.currentTarget;
24
+ separator.setPointerCapture(event.pointerId);
25
+ separator.focus();
26
+ return true;
27
+ }
28
+ function wrEndSeparatorDrag(event) {
29
+ event.currentTarget.releasePointerCapture(event.pointerId);
30
+ }
31
+ export { wrEndSeparatorDrag as n, wrSeparatorKeyMove as r, wrBeginSeparatorDrag as t };
32
+
33
+ //# sourceMappingURL=internal-CVLvP9b_.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"internal-CVLvP9b_.mjs","names":[],"sources":["../../../projects/lib/splitter/internal/separator.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\n/**\n * Where a key sends a focusable `role=\"separator\"`: one step toward the low\n * (`-1`) or the high (`1`) end of its axis, or straight to a bound.\n *\n * @internal\n */\nexport type WrSeparatorKeyMove = -1 | 1 | 'min' | 'max';\n\n/**\n * Reads a `keydown` on a separator. `axis` is the one the separator MOVES\n * along: `inline` for a vertical separator, `block` for a horizontal one.\n *\n * Arrows follow the VISUAL axis (WAI-ARIA APG). Under `dir=\"rtl\"` the inline\n * axis starts on the right, so the visual right is its low end and ArrowRight\n * answers `-1`: otherwise the separator walks away from the key being pressed.\n * The block axis is unaffected by `dir`. Home and End are semantic (first and\n * last, not left and right), so they never mirror. The arrows of the other axis\n * and every other key answer `null`, and the caller leaves the event alone.\n *\n * @internal\n */\nexport function wrSeparatorKeyMove(\n event: KeyboardEvent,\n axis: 'inline' | 'block',\n rtl: boolean\n): WrSeparatorKeyMove | null {\n if (event.key === 'Home') return 'min';\n if (event.key === 'End') return 'max';\n if (axis === 'inline') {\n const forward = rtl ? -1 : 1;\n if (event.key === 'ArrowLeft') return -forward as -1 | 1;\n if (event.key === 'ArrowRight') return forward;\n return null;\n }\n if (event.key === 'ArrowUp') return -1;\n if (event.key === 'ArrowDown') return 1;\n return null;\n}\n\n/**\n * Starts a drag from a `pointerdown` on a separator, and answers whether it did.\n *\n * Only the primary button of the primary pointer drags: holding the right\n * button over the separator and moving used to resize, and the same guard keeps\n * a second finger from taking over a drag in progress. The pointer is captured\n * so the drag survives leaving the separator, an iframe and a canvas included.\n * `preventDefault` also suppresses the press's default focus, so the separator\n * is focused by hand: without it the arrows do nothing after a mouse drag until\n * the user finds the separator again with Tab.\n *\n * @internal\n */\nexport function wrBeginSeparatorDrag(event: PointerEvent): boolean {\n if (event.button !== 0 || !event.isPrimary) return false;\n event.preventDefault();\n const separator = event.currentTarget as HTMLElement;\n separator.setPointerCapture(event.pointerId);\n separator.focus();\n return true;\n}\n\n/**\n * Ends the drag {@link wrBeginSeparatorDrag} started, from the `pointerup` or\n * `pointercancel` that closes it.\n *\n * @internal\n */\nexport function wrEndSeparatorDrag(event: PointerEvent): void {\n (event.currentTarget as HTMLElement).releasePointerCapture(event.pointerId);\n}\n"],"mappings":";;;;;;AA4BA,SAAgB,mBACd,OACA,MACA,KAAY;CAEZ,IAAI,MAAM,QAAQ,QAAQ,OAAO;CACjC,IAAI,MAAM,QAAQ,OAAO,OAAO;CAChC,IAAI,SAAS,UAAU;EACrB,MAAM,UAAU,MAAM,KAAK;EAC3B,IAAI,MAAM,QAAQ,aAAa,OAAO,CAAC;EACvC,IAAI,MAAM,QAAQ,cAAc,OAAO;EACvC,OAAO;CACT;CACA,IAAI,MAAM,QAAQ,WAAW,OAAO;CACpC,IAAI,MAAM,QAAQ,aAAa,OAAO;CACtC,OAAO;AACT;AAeA,SAAgB,qBAAqB,OAAmB;CACtD,IAAI,MAAM,WAAW,KAAK,CAAC,MAAM,WAAW,OAAO;CACnD,MAAM,eAAc;CACpB,MAAM,YAAY,MAAM;CACxB,UAAU,kBAAkB,MAAM,SAAS;CAC3C,UAAU,MAAK;CACf,OAAO;AACT;AAQA,SAAgB,mBAAmB,OAAmB;CACnD,MAAM,cAA8B,sBAAsB,MAAM,SAAS;AAC5E"}
@@ -31,7 +31,7 @@ var WrAlert = class WrAlert {
31
31
  closed = output();
32
32
  dismissed = signal(false, ...ngDevMode ? [{ debugName: "dismissed" }] : /* istanbul ignore next */ []);
33
33
  classes = computed(() => {
34
- const parts = ["wr-alert", `wr-alert--${this.type()}`];
34
+ const parts = [`wr-alert--${this.type()}`];
35
35
  if (this.dismissed()) parts.push("wr-alert--dismissed");
36
36
  return parts.join(" ");
37
37
  }, ...ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []);
@@ -121,12 +121,15 @@ var WrAlert = class WrAlert {
121
121
  }
122
122
  },
123
123
  outputs: { closed: "closed" },
124
- host: { properties: {
125
- "attr.title": "null",
126
- "class": "classes()",
127
- "attr.role": "liveRole()",
128
- "attr.aria-live": "liveLevel()"
129
- } },
124
+ host: {
125
+ properties: {
126
+ "attr.title": "null",
127
+ "class": "classes()",
128
+ "attr.role": "liveRole()",
129
+ "attr.aria-live": "liveLevel()"
130
+ },
131
+ classAttribute: "wr-alert"
132
+ },
130
133
  ngImport: i0,
131
134
  template: "@if (!dismissed()) {\n @if (iconName(); as n) {\n <wr-icon class=\"wr-alert__icon\" [name]=\"n\" />\n } @else if (icon()) {\n <svg\n class=\"wr-alert__icon\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n >\n @switch (type()) {\n @case ('success') {\n <path d=\"M21.801 10A10 10 0 1 1 17 3.335\" />\n <path d=\"m9 11 3 3L22 4\" />\n }\n @case ('warning') {\n <path d=\"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3\" />\n <path d=\"M12 9v4\" />\n <path d=\"M12 17h.01\" />\n }\n <!-- An OCTAGON, and the shape is the point. `danger` used to be a\n circle holding a bar over a dot, which is the vertical mirror of\n the `i` the @default branch draws — at the rendered 18px the two\n differ only by where a 1.5px gap sits. The stop-sign silhouette\n reads at that size and survives greyscale, which a mirrored gap\n does not. -->\n @case ('danger') {\n <path\n d=\"M2.586 16.726A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2h6.624a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586z\"\n />\n <path d=\"M12 8v4\" />\n <path d=\"M12 16h.01\" />\n }\n <!-- A bar, not the exclamation mark `danger` used to carry: `neutral`\n emitted that glyph byte for byte. The icon is the whole difference\n between these two, because what the component actually paints —\n `danger-ink` #a32a33 (L 0.0968) against `on-surface-muted` #5f6c7d\n (L 0.1464) on tints 1.036:1 apart — is a hue difference and little\n else. -->\n @case ('neutral') {\n <circle cx=\"12\" cy=\"12\" r=\"10\" />\n <path d=\"M8 12h8\" />\n }\n @case ('offline') {\n <circle cx=\"12\" cy=\"12\" r=\"10\" />\n <path d=\"m4.9 4.9 14.2 14.2\" />\n }\n @default {\n <circle cx=\"12\" cy=\"12\" r=\"10\" />\n <path d=\"M12 16v-4\" />\n <path d=\"M12 8h.01\" />\n }\n }\n </svg>\n }\n\n <div class=\"wr-alert__body\">\n @if (title(); as t) {\n <p class=\"wr-alert__title\">{{ t }}</p>\n @if (message(); as m) {\n <p class=\"wr-alert__message\">{{ m }}</p>\n }\n } @else if (message(); as m) {\n <p class=\"wr-alert__title\">{{ m }}</p>\n }\n <div class=\"wr-alert__content\"><ng-content /></div>\n <div class=\"wr-alert__actions\"><ng-content select=\"[wrAlertActions]\" /></div>\n </div>\n\n @if (closable()) {\n <button type=\"button\" class=\"wr-alert__close\" [attr.aria-label]=\"resolvedCloseLabel()\" (click)=\"onClose()\">\n <svg\n class=\"wr-icon__svg\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n >\n <path d=\"M18 6 6 18\" />\n <path d=\"m6 6 12 12\" />\n </svg>\n </button>\n }\n}\n",
132
135
  dependencies: [{
@@ -151,6 +154,7 @@ i0.ɵɵngDeclareClassMetadata({
151
154
  encapsulation: ViewEncapsulation.None,
152
155
  host: {
153
156
  "[attr.title]": "null",
157
+ class: "wr-alert",
154
158
  "[class]": "classes()",
155
159
  "[attr.role]": "liveRole()",
156
160
  "[attr.aria-live]": "liveLevel()"
@@ -1 +1 @@
1
- {"version":3,"file":"ngwr-alert.mjs","names":[],"sources":["../../../projects/lib/alert/alert.ts","../../../projects/lib/alert/alert.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 ElementRef,\n Injector,\n ViewEncapsulation,\n afterNextRender,\n computed,\n inject,\n input,\n output,\n signal,\n} from '@angular/core';\n\nimport { useI18nText } from 'ngwr/i18n';\nimport { WrIcon, type WrIconName } from 'ngwr/icon';\nimport { wrGetFocusableElements, wrCheckStyles } from 'ngwr/utils';\n\nimport type { WrAlertType } from './types';\n\n/**\n * Inline status banner. Use for feedback messages — saved/failed/notice etc.\n * Content placed inside renders below the message, in `.wr-alert__content`.\n *\n * Slots:\n *\n * - **Default** — text under the message.\n * - **`[wrAlertActions]`** — buttons under the message, in a row that wraps.\n *\n * @example\n * ```html\n * <wr-alert title=\"Saved\" message=\"Your changes are live.\" type=\"success\" />\n * <wr-alert title=\"Failed\" type=\"danger\" closable (closed)=\"onClose()\" />\n * <wr-alert title=\"Sync failed\" type=\"danger\">Request <code>8f2c41</code> timed out.</wr-alert>\n * <wr-alert title=\"Update available\" type=\"info\">\n * <wr-btn wrAlertActions size=\"sm\" (click)=\"update()\">Install</wr-btn>\n * </wr-alert>\n * ```\n *\n * @see https://ngwr.dev/reference/components/alert\n */\n@Component({\n selector: 'wr-alert',\n templateUrl: './alert.html',\n imports: [WrIcon],\n encapsulation: ViewEncapsulation.None,\n host: {\n // `title` is an input, and a static attribute that feeds an input is ALSO\n // written onto the host — where the browser shows it as a native tooltip\n // over the whole component, and where it feeds the accessible name of any\n // element that has a role. `<wr-alert title=\"Heads up\">` is the documented\n // spelling, so every page writing it shipped both. A bound `[title]` never\n // did this, which is why the two forms behaved differently for no reason a\n // reader could see.\n '[attr.title]': 'null',\n '[class]': 'classes()',\n '[attr.role]': 'liveRole()',\n '[attr.aria-live]': 'liveLevel()',\n },\n})\nexport class WrAlert {\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('alert');\n }\n\n /** Accessible name. Falls back to `alert.close`, then `'Close alert'`. */\n readonly closeLabel = input<string | null>(null);\n\n protected readonly resolvedCloseLabel = useI18nText(this.closeLabel, 'alert.close', 'Close alert');\n\n /**\n * Optional headline shown at the top of the alert.\n *\n * @default null\n */\n readonly title = input<string | null>(null);\n\n /**\n * Visual variant.\n *\n * @default 'info'\n */\n readonly type = input<WrAlertType>('info');\n\n /**\n * Override the default per-type icon with any ngwr icon name.\n *\n * @default null\n */\n readonly iconName = input<WrIconName | null>(null);\n\n /**\n * Optional secondary message rendered below the title.\n *\n * @default null\n */\n readonly message = input<string | null>(null);\n\n /**\n * When `true`, renders a leading status icon matching the `type`.\n * Pass `false` to hide. Ignored when `iconName` is set.\n *\n * @default true\n */\n readonly icon = input(true, { transform: coerceBooleanProperty });\n\n /**\n * When `true`, renders a close button.\n *\n * @default false\n */\n readonly closable = input(false, { transform: coerceBooleanProperty });\n\n /**\n * Emitted when the user dismisses the alert via the close button. If the close\n * button had focus, focus moves on to the next focusable element after the alert\n * (or the one before it, when nothing follows) — unless a `(closed)` handler has\n * placed it somewhere itself.\n */\n readonly closed = output<void>();\n\n protected readonly dismissed = signal(false);\n\n protected readonly classes = computed(() => {\n const parts = ['wr-alert', `wr-alert--${this.type()}`];\n if (this.dismissed()) parts.push('wr-alert--dismissed');\n return parts.join(' ');\n });\n\n /** Escalate role/aria-live for danger/warning alerts. */\n protected readonly liveRole = computed(() =>\n this.dismissed() ? null : this.type() === 'danger' ? 'alert' : 'status'\n );\n protected readonly liveLevel = computed(() =>\n this.dismissed() ? null : this.type() === 'danger' || this.type() === 'warning' ? 'assertive' : 'polite'\n );\n\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\n private readonly injector = inject(Injector);\n\n protected onClose(): void {\n const host = this.host.nativeElement;\n const hadFocus = host.contains(host.ownerDocument.activeElement);\n this.dismissed.set(true);\n this.closed.emit();\n if (hadFocus) afterNextRender(() => this.handOnFocus(), { injector: this.injector });\n }\n\n /**\n * The close button is removed with the rest of the content, and a focused element\n * that leaves the DOM drops the caret on `<body>`: a keyboard user's next Tab, and\n * a screen reader's reading position, started over from the top of the page. Run\n * after the render that removed it, so a `(closed)` handler that moved focus on\n * purpose is seen and left alone.\n */\n private handOnFocus(): void {\n const host = this.host.nativeElement;\n const doc = host.ownerDocument;\n const active = doc.activeElement;\n if (active && active !== doc.body) return;\n // Tab stops only: a roving composite parks its other items at -1. The host has\n // nothing focusable left inside it, so every stop is either before or after it.\n const stops = wrGetFocusableElements(doc.body).filter(el => el.tabIndex >= 0);\n // eslint-disable-next-line no-bitwise -- compareDocumentPosition answers with a bitmask\n const after = stops.findIndex(el => (host.compareDocumentPosition(el) & Node.DOCUMENT_POSITION_FOLLOWING) !== 0);\n (after >= 0 ? stops[after] : stops.at(-1))?.focus();\n }\n}\n","@if (!dismissed()) {\n @if (iconName(); as n) {\n <wr-icon class=\"wr-alert__icon\" [name]=\"n\" />\n } @else if (icon()) {\n <svg\n class=\"wr-alert__icon\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n >\n @switch (type()) {\n @case ('success') {\n <path d=\"M21.801 10A10 10 0 1 1 17 3.335\" />\n <path d=\"m9 11 3 3L22 4\" />\n }\n @case ('warning') {\n <path d=\"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3\" />\n <path d=\"M12 9v4\" />\n <path d=\"M12 17h.01\" />\n }\n <!-- An OCTAGON, and the shape is the point. `danger` used to be a\n circle holding a bar over a dot, which is the vertical mirror of\n the `i` the @default branch draws — at the rendered 18px the two\n differ only by where a 1.5px gap sits. The stop-sign silhouette\n reads at that size and survives greyscale, which a mirrored gap\n does not. -->\n @case ('danger') {\n <path\n d=\"M2.586 16.726A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2h6.624a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586z\"\n />\n <path d=\"M12 8v4\" />\n <path d=\"M12 16h.01\" />\n }\n <!-- A bar, not the exclamation mark `danger` used to carry: `neutral`\n emitted that glyph byte for byte. The icon is the whole difference\n between these two, because what the component actually paints —\n `danger-ink` #a32a33 (L 0.0968) against `on-surface-muted` #5f6c7d\n (L 0.1464) on tints 1.036:1 apart — is a hue difference and little\n else. -->\n @case ('neutral') {\n <circle cx=\"12\" cy=\"12\" r=\"10\" />\n <path d=\"M8 12h8\" />\n }\n @case ('offline') {\n <circle cx=\"12\" cy=\"12\" r=\"10\" />\n <path d=\"m4.9 4.9 14.2 14.2\" />\n }\n @default {\n <circle cx=\"12\" cy=\"12\" r=\"10\" />\n <path d=\"M12 16v-4\" />\n <path d=\"M12 8h.01\" />\n }\n }\n </svg>\n }\n\n <div class=\"wr-alert__body\">\n @if (title(); as t) {\n <p class=\"wr-alert__title\">{{ t }}</p>\n @if (message(); as m) {\n <p class=\"wr-alert__message\">{{ m }}</p>\n }\n } @else if (message(); as m) {\n <p class=\"wr-alert__title\">{{ m }}</p>\n }\n <div class=\"wr-alert__content\"><ng-content /></div>\n <div class=\"wr-alert__actions\"><ng-content select=\"[wrAlertActions]\" /></div>\n </div>\n\n @if (closable()) {\n <button type=\"button\" class=\"wr-alert__close\" [attr.aria-label]=\"resolvedCloseLabel()\" (click)=\"onClose()\">\n <svg\n class=\"wr-icon__svg\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n >\n <path d=\"M18 6 6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;GAAA;GAAA,OAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;GAAA,MAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;GAAA,UAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;GAAA,SAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;GAAA,MAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;GAAA,UAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;EAAA;EAAA,SAAA,EAAA,QAAA,SAAA;EAAA,MAAA,EAAA,YAAA;GAAA,cAAA;GAAA,SAAA;GAAA,aAAA;GAAA,kBAAA;EAAA,EAAA;EAAA,UAAA;EAAA,UCnEpB;EA6FA,cAAA,CAAA;GAAA,MAAA;GAAA,MD1CY;GAAM,UAAA;GAAA,QAAA,CAAA,MAAA;EAAA,CAAA;EAAA,eAAA,GAAA,kBAAA;CAAA,CAAA;;AAgBL,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAO,YAAA,CAAA;EAnBnB,MAAA;EACW,MAAA,CAAA;GAAA,UAAA;GAAU,SAEX,CAAC,MAAM;GAAC,eACF,kBAAkB;GAAI,MAC/B;IAQJ,gBAAgB;IAChB,WAAW;IACX,eAAe;IACf,oBAAoB;GACrB;GAAA,UAAA;EAAA,CAAA"}
1
+ {"version":3,"file":"ngwr-alert.mjs","names":[],"sources":["../../../projects/lib/alert/alert.ts","../../../projects/lib/alert/alert.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 ElementRef,\n Injector,\n ViewEncapsulation,\n afterNextRender,\n computed,\n inject,\n input,\n output,\n signal,\n} from '@angular/core';\n\nimport { useI18nText } from 'ngwr/i18n';\nimport { WrIcon, type WrIconName } from 'ngwr/icon';\nimport { wrGetFocusableElements, wrCheckStyles } from 'ngwr/utils';\n\nimport type { WrAlertType } from './types';\n\n/**\n * Inline status banner. Use for feedback messages — saved/failed/notice etc.\n * Content placed inside renders below the message, in `.wr-alert__content`.\n *\n * Slots:\n *\n * - **Default** — text under the message.\n * - **`[wrAlertActions]`** — buttons under the message, in a row that wraps.\n *\n * @example\n * ```html\n * <wr-alert title=\"Saved\" message=\"Your changes are live.\" type=\"success\" />\n * <wr-alert title=\"Failed\" type=\"danger\" closable (closed)=\"onClose()\" />\n * <wr-alert title=\"Sync failed\" type=\"danger\">Request <code>8f2c41</code> timed out.</wr-alert>\n * <wr-alert title=\"Update available\" type=\"info\">\n * <wr-btn wrAlertActions size=\"sm\" (click)=\"update()\">Install</wr-btn>\n * </wr-alert>\n * ```\n *\n * @see https://ngwr.dev/reference/components/alert\n */\n@Component({\n selector: 'wr-alert',\n templateUrl: './alert.html',\n imports: [WrIcon],\n encapsulation: ViewEncapsulation.None,\n host: {\n // `title` is an input, and a static attribute that feeds an input is ALSO\n // written onto the host — where the browser shows it as a native tooltip\n // over the whole component, and where it feeds the accessible name of any\n // element that has a role. `<wr-alert title=\"Heads up\">` is the documented\n // spelling, so every page writing it shipped both. A bound `[title]` never\n // did this, which is why the two forms behaved differently for no reason a\n // reader could see.\n '[attr.title]': 'null',\n class: 'wr-alert',\n '[class]': 'classes()',\n '[attr.role]': 'liveRole()',\n '[attr.aria-live]': 'liveLevel()',\n },\n})\nexport class WrAlert {\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('alert');\n }\n\n /** Accessible name. Falls back to `alert.close`, then `'Close alert'`. */\n readonly closeLabel = input<string | null>(null);\n\n protected readonly resolvedCloseLabel = useI18nText(this.closeLabel, 'alert.close', 'Close alert');\n\n /**\n * Optional headline shown at the top of the alert.\n *\n * @default null\n */\n readonly title = input<string | null>(null);\n\n /**\n * Visual variant.\n *\n * @default 'info'\n */\n readonly type = input<WrAlertType>('info');\n\n /**\n * Override the default per-type icon with any ngwr icon name.\n *\n * @default null\n */\n readonly iconName = input<WrIconName | null>(null);\n\n /**\n * Optional secondary message rendered below the title.\n *\n * @default null\n */\n readonly message = input<string | null>(null);\n\n /**\n * When `true`, renders a leading status icon matching the `type`.\n * Pass `false` to hide. Ignored when `iconName` is set.\n *\n * @default true\n */\n readonly icon = input(true, { transform: coerceBooleanProperty });\n\n /**\n * When `true`, renders a close button.\n *\n * @default false\n */\n readonly closable = input(false, { transform: coerceBooleanProperty });\n\n /**\n * Emitted when the user dismisses the alert via the close button. If the close\n * button had focus, focus moves on to the next focusable element after the alert\n * (or the one before it, when nothing follows) — unless a `(closed)` handler has\n * placed it somewhere itself.\n */\n readonly closed = output<void>();\n\n protected readonly dismissed = signal(false);\n\n protected readonly classes = computed(() => {\n const parts = [`wr-alert--${this.type()}`];\n if (this.dismissed()) parts.push('wr-alert--dismissed');\n return parts.join(' ');\n });\n\n /** Escalate role/aria-live for danger/warning alerts. */\n protected readonly liveRole = computed(() =>\n this.dismissed() ? null : this.type() === 'danger' ? 'alert' : 'status'\n );\n protected readonly liveLevel = computed(() =>\n this.dismissed() ? null : this.type() === 'danger' || this.type() === 'warning' ? 'assertive' : 'polite'\n );\n\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\n private readonly injector = inject(Injector);\n\n protected onClose(): void {\n const host = this.host.nativeElement;\n const hadFocus = host.contains(host.ownerDocument.activeElement);\n this.dismissed.set(true);\n this.closed.emit();\n if (hadFocus) afterNextRender(() => this.handOnFocus(), { injector: this.injector });\n }\n\n /**\n * The close button is removed with the rest of the content, and a focused element\n * that leaves the DOM drops the caret on `<body>`: a keyboard user's next Tab, and\n * a screen reader's reading position, started over from the top of the page. Run\n * after the render that removed it, so a `(closed)` handler that moved focus on\n * purpose is seen and left alone.\n */\n private handOnFocus(): void {\n const host = this.host.nativeElement;\n const doc = host.ownerDocument;\n const active = doc.activeElement;\n if (active && active !== doc.body) return;\n // Tab stops only: a roving composite parks its other items at -1. The host has\n // nothing focusable left inside it, so every stop is either before or after it.\n const stops = wrGetFocusableElements(doc.body).filter(el => el.tabIndex >= 0);\n // eslint-disable-next-line no-bitwise -- compareDocumentPosition answers with a bitmask\n const after = stops.findIndex(el => (host.compareDocumentPosition(el) & Node.DOCUMENT_POSITION_FOLLOWING) !== 0);\n (after >= 0 ? stops[after] : stops.at(-1))?.focus();\n }\n}\n","@if (!dismissed()) {\n @if (iconName(); as n) {\n <wr-icon class=\"wr-alert__icon\" [name]=\"n\" />\n } @else if (icon()) {\n <svg\n class=\"wr-alert__icon\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n >\n @switch (type()) {\n @case ('success') {\n <path d=\"M21.801 10A10 10 0 1 1 17 3.335\" />\n <path d=\"m9 11 3 3L22 4\" />\n }\n @case ('warning') {\n <path d=\"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3\" />\n <path d=\"M12 9v4\" />\n <path d=\"M12 17h.01\" />\n }\n <!-- An OCTAGON, and the shape is the point. `danger` used to be a\n circle holding a bar over a dot, which is the vertical mirror of\n the `i` the @default branch draws — at the rendered 18px the two\n differ only by where a 1.5px gap sits. The stop-sign silhouette\n reads at that size and survives greyscale, which a mirrored gap\n does not. -->\n @case ('danger') {\n <path\n d=\"M2.586 16.726A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2h6.624a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586z\"\n />\n <path d=\"M12 8v4\" />\n <path d=\"M12 16h.01\" />\n }\n <!-- A bar, not the exclamation mark `danger` used to carry: `neutral`\n emitted that glyph byte for byte. The icon is the whole difference\n between these two, because what the component actually paints —\n `danger-ink` #a32a33 (L 0.0968) against `on-surface-muted` #5f6c7d\n (L 0.1464) on tints 1.036:1 apart — is a hue difference and little\n else. -->\n @case ('neutral') {\n <circle cx=\"12\" cy=\"12\" r=\"10\" />\n <path d=\"M8 12h8\" />\n }\n @case ('offline') {\n <circle cx=\"12\" cy=\"12\" r=\"10\" />\n <path d=\"m4.9 4.9 14.2 14.2\" />\n }\n @default {\n <circle cx=\"12\" cy=\"12\" r=\"10\" />\n <path d=\"M12 16v-4\" />\n <path d=\"M12 8h.01\" />\n }\n }\n </svg>\n }\n\n <div class=\"wr-alert__body\">\n @if (title(); as t) {\n <p class=\"wr-alert__title\">{{ t }}</p>\n @if (message(); as m) {\n <p class=\"wr-alert__message\">{{ m }}</p>\n }\n } @else if (message(); as m) {\n <p class=\"wr-alert__title\">{{ m }}</p>\n }\n <div class=\"wr-alert__content\"><ng-content /></div>\n <div class=\"wr-alert__actions\"><ng-content select=\"[wrAlertActions]\" /></div>\n </div>\n\n @if (closable()) {\n <button type=\"button\" class=\"wr-alert__close\" [attr.aria-label]=\"resolvedCloseLabel()\" (click)=\"onClose()\">\n <svg\n class=\"wr-icon__svg\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n >\n <path d=\"M18 6 6 18\" />\n <path d=\"m6 6 12 12\" />\n </svg>\n </button>\n }\n}\n"],"mappings":";;;;;;;;;;;;AAoEA,IAA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A,MAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;GAAA,UAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;GAAA,SAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;GAAA,MAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;GAAA,UAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;EAAA;EAAA,SAAA,EAAA,QAAA,SAAA;EAAA,MAAA;GAAA,YAAA;IAAA,cAAA;IAAA,SAAA;IAAA,aAAA;IAAA,kBAAA;GAAA;GAAA,gBAAA;EAAA;EAAA,UAAA;EAAA,UCpEpB;EA6FA,cAAA,CAAA;GAAA,MAAA;GAAA,MD1CY;GAAM,UAAA;GAAA,QAAA,CAAA,MAAA;EAAA,CAAA;EAAA,eAAA,GAAA,kBAAA;CAAA,CAAA;;AAiBL,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAO,YAAA,CAAA;EApBnB,MAAA;EACW,MAAA,CAAA;GAAA,UAAA;GAAU,SAEX,CAAC,MAAM;GAAC,eACF,kBAAkB;GAAI,MAC/B;IAQJ,gBAAgB;IAChB,OAAO;IACP,WAAW;IACX,eAAe;IACf,oBAAoB;GACrB;GAAA,UAAA;EAAA,CAAA"}
@@ -83,7 +83,7 @@ var WrAvatar = class WrAvatar {
83
83
  cssSize = computed(() => this.resolved().cssValue, ...ngDevMode ? [{ debugName: "cssSize" }] : /* istanbul ignore next */ []);
84
84
  pxSize = computed(() => this.resolved().pxValue, ...ngDevMode ? [{ debugName: "pxSize" }] : /* istanbul ignore next */ []);
85
85
  classes = computed(() => {
86
- const parts = ["wr-avatar"];
86
+ const parts = [];
87
87
  const shape = this.shape();
88
88
  if (shape !== "rounded") parts.push(`wr-avatar--${shape}`);
89
89
  if (this.loaded()) parts.push("wr-avatar--loaded");
@@ -155,12 +155,15 @@ var WrAvatar = class WrAvatar {
155
155
  transformFunction: null
156
156
  }
157
157
  },
158
- host: { properties: {
159
- "class": "classes()",
160
- "style.width": "cssSize()",
161
- "style.height": "cssSize()",
162
- "style.--wr-avatar-size": "cssSize()"
163
- } },
158
+ host: {
159
+ properties: {
160
+ "class": "classes()",
161
+ "style.width": "cssSize()",
162
+ "style.height": "cssSize()",
163
+ "style.--wr-avatar-size": "cssSize()"
164
+ },
165
+ classAttribute: "wr-avatar"
166
+ },
164
167
  viewQueries: [{
165
168
  propertyName: "img",
166
169
  first: true,
@@ -190,6 +193,7 @@ i0.ɵɵngDeclareClassMetadata({
190
193
  selector: "wr-avatar",
191
194
  encapsulation: ViewEncapsulation.None,
192
195
  host: {
196
+ class: "wr-avatar",
193
197
  "[class]": "classes()",
194
198
  "[style.width]": "cssSize()",
195
199
  "[style.height]": "cssSize()",
@@ -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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AA;EAAA,CAAA;CAyG2C,CAAA;CAAA,sBAAA,CAAA;CAAA,gBAAA;EAAA,KAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,KAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,MAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,MAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,OAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,MAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,KAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,OAAK,EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;CAAA;AAAA,CAAA"}
1
+ {"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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= [];
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,G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A,GAAA,mBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,UAAA;EAAA,MAAA;EAAS,MAAA,CAAA;EAAA,QAAA,GAAA,gBAAA;CAAA,CAAA;CAAT,OAAA,OAAA,GAAA,qBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,MAAA;EAAS,cAAA;EAAA,UAAA;EAAA,QAAA;GAAA,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,CAA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