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
@@ -23,7 +23,7 @@ var WrSkeleton = class WrSkeleton {
23
23
  });
24
24
  lineIndexes = computed(() => Array.from({ length: Math.max(0, Math.floor(this.lines())) }, (_, i) => i), ...ngDevMode ? [{ debugName: "lineIndexes" }] : /* istanbul ignore next */ []);
25
25
  classes = computed(() => {
26
- const parts = ["wr-skeleton"];
26
+ const parts = [];
27
27
  const color = this.color();
28
28
  if (color) parts.push(`wr-skeleton--${color}`);
29
29
  if (this.animated()) parts.push("wr-skeleton--animated");
@@ -72,7 +72,8 @@ var WrSkeleton = class WrSkeleton {
72
72
  "aria-busy": "true",
73
73
  "aria-live": "polite"
74
74
  },
75
- properties: { "class": "classes()" }
75
+ properties: { "class": "classes()" },
76
+ classAttribute: "wr-skeleton"
76
77
  },
77
78
  ngImport: i0,
78
79
  template: "@for (i of lineIndexes(); track i) {\n <span class=\"wr-skeleton__line\"></span>\n}\n",
@@ -92,6 +93,7 @@ i0.ɵɵngDeclareClassMetadata({
92
93
  host: {
93
94
  "aria-busy": "true",
94
95
  "aria-live": "polite",
96
+ class: "wr-skeleton",
95
97
  "[class]": "classes()"
96
98
  },
97
99
  template: "@for (i of lineIndexes(); track i) {\n <span class=\"wr-skeleton__line\"></span>\n}\n"
@@ -1 +1 @@
1
- {"version":3,"file":"ngwr-skeleton.mjs","names":[],"sources":["../../../projects/lib/skeleton/skeleton.ts","../../../projects/lib/skeleton/skeleton.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 { wrNumAttr, wrCheckStyles } from 'ngwr/utils';\n\n/**\n * Placeholder block shown while content is loading.\n *\n * Default sizing fills the parent width and matches the surrounding\n * text height (`1lh`). Override `--wr-skeleton-height` / `width` on the\n * host for custom shapes. `lines` draws a paragraph instead: that many\n * lines, the last one shorter.\n *\n * @example\n * ```html\n * <wr-skeleton />\n * <wr-skeleton color=\"primary\" [animated]=\"false\" />\n * <wr-skeleton [lines]=\"3\" />\n * ```\n *\n * @see https://ngwr.dev/reference/components/skeleton\n */\n@Component({\n selector: 'wr-skeleton',\n templateUrl: './skeleton.html',\n encapsulation: ViewEncapsulation.None,\n host: {\n 'aria-busy': 'true',\n 'aria-live': 'polite',\n '[class]': 'classes()',\n },\n})\nexport class WrSkeleton {\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('skeleton');\n }\n\n /**\n * Intent tint for the placeholder. `null`, the default, paints the neutral\n * gray a placeholder almost always wants.\n *\n * It used to default to the `light` intent, chosen because that one token was\n * theme-stable — slate-300 on white, slate-800 on near-black. The neutral ramp\n * does that job now and does it by construction, so the default is the absence\n * of an intent rather than a particular one. An intent here tints a thing that\n * is not yet content, so reach for it only when the placeholder stands in for\n * something the colour already identifies.\n *\n * @default null\n */\n readonly color = input<WrColor | null>(null);\n\n /**\n * Whether the shimmer animation runs.\n *\n * @default true\n */\n readonly animated = input(true, { transform: coerceBooleanProperty });\n\n /**\n * Draw a paragraph: this many text lines, each `--wr-skeleton-height` tall\n * and `--wr-skeleton-line-gap` apart, the last one `--wr-skeleton-last-line-width`\n * wide. `0`, the default, keeps the one block. The host stays the only thing\n * a screen reader hears: the lines are empty boxes, so `aria-busy` is read\n * once however many there are.\n *\n * @default 0\n */\n readonly lines = input(0, { transform: wrNumAttr(0) });\n\n /** One entry per line, for the template's `@for`. */\n protected readonly lineIndexes = computed(() =>\n Array.from({ length: Math.max(0, Math.floor(this.lines())) }, (_, i) => i)\n );\n\n protected readonly classes = computed(() => {\n const parts = ['wr-skeleton'];\n\n const color = this.color();\n if (color) parts.push(`wr-skeleton--${color}`);\n\n if (this.animated()) parts.push('wr-skeleton--animated');\n if (this.lineIndexes().length > 0) parts.push('wr-skeleton--lines');\n return parts.join(' ');\n });\n}\n","@for (i of lineIndexes(); track i) {\n <span class=\"wr-skeleton__line\"></span>\n}\n"],"mappings":";;;;;;;;;;AAwCA,IAAa,aAAb,MAAa,WAAU;CACrB,cAAA;EACE,IAAI,OAAO,cAAc,eAAe,WAAW,cAAc,UAAU;CAC7E;CAeS,QAAQ,MAAsB,MAAK,GAAA,YAAA,CAAA,EAAA,WAAA,QAAA,CAAA,+BAAA,CAAA,CAAA;CAOnC,WAAW,MAAM,MAAI;EAAA,GAAA,YAAA,EAAA,WAAA,WAAA,+BAAA,CAAA;EAAI,WAAW;CAAqB,CAAA;CAWzD,QAAQ,MAAM,GAAC;EAAA,GAAA,YAAA,EAAA,WAAA,QAAA,+BAAA,CAAA;EAAI,WAAW,UAAU,CAAC;CAAC,CAAA;CAGhC,cAAc,eAC/B,MAAM,KAAK,EAAE,QAAQ,KAAK,IAAI,GAAG,KAAK,MAAM,KAAK,MAAK,CAAE,CA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AER,kBAAkB;GAAI,MAC/B;IACJ,aAAa;IACb,aAAa;IACb,WAAW;GACZ;GAAA,UAAA;EAAA,CAAA"}
1
+ {"version":3,"file":"ngwr-skeleton.mjs","names":[],"sources":["../../../projects/lib/skeleton/skeleton.ts","../../../projects/lib/skeleton/skeleton.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 { wrNumAttr, wrCheckStyles } from 'ngwr/utils';\n\n/**\n * Placeholder block shown while content is loading.\n *\n * Default sizing fills the parent width and matches the surrounding\n * text height (`1lh`). Override `--wr-skeleton-height` / `width` on the\n * host for custom shapes. `lines` draws a paragraph instead: that many\n * lines, the last one shorter.\n *\n * @example\n * ```html\n * <wr-skeleton />\n * <wr-skeleton color=\"primary\" [animated]=\"false\" />\n * <wr-skeleton [lines]=\"3\" />\n * ```\n *\n * @see https://ngwr.dev/reference/components/skeleton\n */\n@Component({\n selector: 'wr-skeleton',\n templateUrl: './skeleton.html',\n encapsulation: ViewEncapsulation.None,\n host: {\n 'aria-busy': 'true',\n 'aria-live': 'polite',\n class: 'wr-skeleton',\n '[class]': 'classes()',\n },\n})\nexport class WrSkeleton {\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('skeleton');\n }\n\n /**\n * Intent tint for the placeholder. `null`, the default, paints the neutral\n * gray a placeholder almost always wants.\n *\n * It used to default to the `light` intent, chosen because that one token was\n * theme-stable — slate-300 on white, slate-800 on near-black. The neutral ramp\n * does that job now and does it by construction, so the default is the absence\n * of an intent rather than a particular one. An intent here tints a thing that\n * is not yet content, so reach for it only when the placeholder stands in for\n * something the colour already identifies.\n *\n * @default null\n */\n readonly color = input<WrColor | null>(null);\n\n /**\n * Whether the shimmer animation runs.\n *\n * @default true\n */\n readonly animated = input(true, { transform: coerceBooleanProperty });\n\n /**\n * Draw a paragraph: this many text lines, each `--wr-skeleton-height` tall\n * and `--wr-skeleton-line-gap` apart, the last one `--wr-skeleton-last-line-width`\n * wide. `0`, the default, keeps the one block. The host stays the only thing\n * a screen reader hears: the lines are empty boxes, so `aria-busy` is read\n * once however many there are.\n *\n * @default 0\n */\n readonly lines = input(0, { transform: wrNumAttr(0) });\n\n /** One entry per line, for the template's `@for`. */\n protected readonly lineIndexes = computed(() =>\n Array.from({ length: Math.max(0, Math.floor(this.lines())) }, (_, i) => i)\n );\n\n protected readonly classes = computed(() => {\n const parts: string[] = [];\n\n const color = this.color();\n if (color) parts.push(`wr-skeleton--${color}`);\n\n if (this.animated()) parts.push('wr-skeleton--animated');\n if (this.lineIndexes().length > 0) parts.push('wr-skeleton--lines');\n return parts.join(' ');\n });\n}\n","@for (i of lineIndexes(); track i) {\n <span class=\"wr-skeleton__line\"></span>\n}\n"],"mappings":";;;;;;;;;;AAyCA,IAAa,aAAb,MAAa,WAAU;CACrB,cAAA;EACE,IAAI,OAAO,cAAc,eAAe,WAAW,cAAc,UAAU;CAC7E;CAeS,QAAQ,MAAsB,MAAK,GAAA,YAAA,CAAA,EAAA,WAAA,QAAA,CAAA,+BAAA,CAAA,CAAA;CAOnC,WAAW,MAAM,MAAI;EAAA,GAAA,YAAA,EAAA,WAAA,WAAA,+BAAA,CAAA;EAAI,WAAW;CAAqB,CAAA;CAWzD,QAAQ,MAAM,GAAC;EAAA,GAAA,YAAA,EAAA,WAAA,QAAA,+BAAA,CAAA;EAAI,WAAW,UAAU,CAAC;CAAC,CAAA;CAGhC,cAAc,eAC/B,MAAM,KAAK,EAAE,QAAQ,KAAK,IAAI,GAAG,KAAK,MAAM,KAAK,MAAK,CAAE,CAAC,EAAC,IAAK,GAAG,MAAM,CAAC,GAC1E,GAAA,YAAA,CAAA,EAAA,WAAA,cAAA,CAAA,+BAAA,CAAA,CAAA;CAEk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
@@ -71,7 +71,7 @@ var WrSlider = class WrSlider {
71
71
  lowThumb = viewChild.required("lowThumb", ...ngDevMode ? [{ debugName: "lowThumb" }] : /* istanbul ignore next */ []);
72
72
  dir = inject(Directionality, { optional: true });
73
73
  classes = computed(() => {
74
- const parts = ["wr-slider"];
74
+ const parts = [];
75
75
  if (this.range()) parts.push("wr-slider--range");
76
76
  if (this.disabled()) parts.push("wr-slider--disabled");
77
77
  else if (this.readonly()) parts.push("wr-slider--readonly");
@@ -321,7 +321,8 @@ var WrSlider = class WrSlider {
321
321
  },
322
322
  host: {
323
323
  listeners: { "focusout": "onFocusOut($event)" },
324
- properties: { "class": "classes()" }
324
+ properties: { "class": "classes()" },
325
+ classAttribute: "wr-slider"
325
326
  },
326
327
  viewQueries: [{
327
328
  propertyName: "track",
@@ -352,6 +353,7 @@ i0.ɵɵngDeclareClassMetadata({
352
353
  selector: "wr-slider",
353
354
  encapsulation: ViewEncapsulation.None,
354
355
  host: {
356
+ class: "wr-slider",
355
357
  "[class]": "classes()",
356
358
  "(focusout)": "onFocusOut($event)"
357
359
  },
@@ -1 +1 @@
1
- {"version":3,"file":"ngwr-slider.mjs","names":[],"sources":["../../../projects/lib/slider/slider.ts","../../../projects/lib/slider/slider.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 { Directionality } from '@angular/cdk/bidi';\nimport { coerceBooleanProperty, coerceNumberProperty } from '@angular/cdk/coercion';\nimport type { ElementRef } from '@angular/core';\nimport {\n Component,\n ViewEncapsulation,\n computed,\n effect,\n inject,\n input,\n model,\n output,\n signal,\n untracked,\n viewChild,\n} from '@angular/core';\nimport type { FormValueControl } from '@angular/forms/signals';\n\nimport { WR_FORM_FIELD, useFormFieldAria } from 'ngwr/form';\nimport { useI18nText } from 'ngwr/i18n';\nimport { wrClamp, wrRound, wrCheckStyles } from 'ngwr/utils';\n\nimport type { WrSliderValue } from './types';\n\n/** Trim float drift from step calculations. */\n\n/**\n * Numeric slider with optional dual-thumb range mode.\n *\n * A signal-forms native control: it implements `FormValueControl<WrSliderValue>`,\n * so `[formField]` binds straight to its `value` model — no\n * `ControlValueAccessor` in between. `[(value)]` works standalone. The value\n * shape depends on `range`: `number` (default) or `[number, number]` when\n * `range=\"true\"`.\n *\n * Keyboard: ← / → adjust by `step`; ↑ / ↓ same; Shift+arrow by `step × 10`;\n * Home / End jump to min / max; PageUp / PageDown by `step × 10`.\n *\n * Reading direction: the arrows follow the VISUAL track, so under `dir=\"rtl\"`\n * → moves toward the lower end and ← toward the higher one, and a drag reads\n * its ratio from the right edge. ↑ / ↓, PageUp / PageDown and Home / End are\n * unchanged — they name a value, not a side of the screen.\n *\n * @example\n * ```html\n * <!-- signal forms -->\n * <wr-slider [formField]=\"form.volume\" min=\"0\" max=\"100\" step=\"5\" />\n *\n * <!-- standalone two-way binding -->\n * <wr-slider [(value)]=\"range\" range min=\"0\" max=\"1000\" step=\"10\" />\n * ```\n *\n * @see https://ngwr.dev/reference/components/slider\n */\n@Component({\n selector: 'wr-slider',\n templateUrl: './slider.html',\n encapsulation: ViewEncapsulation.None,\n host: { '[class]': 'classes()', '(focusout)': 'onFocusOut($event)' },\n})\nexport class WrSlider implements FormValueControl<WrSliderValue> {\n // Typed `WrSliderValue | undefined` (not `number`) to satisfy the reserved\n // `FormUiControl` min/max slots, which are keyed to the control's value type.\n // The transform still coerces to a plain number, so the bounds stay numeric\n // at runtime; `minValue`/`maxValue` narrow them back for arithmetic.\n /** Lower bound. @default 0 */\n readonly min = input<WrSliderValue | undefined>(0, { transform: (v: unknown): number => coerceNumberProperty(v, 0) });\n /** Upper bound. @default 100 */\n readonly max = input<WrSliderValue | undefined>(100, {\n transform: (v: unknown): number => coerceNumberProperty(v, 100),\n });\n\n /** Resolved numeric lower bound for internal arithmetic. */\n private readonly minValue = computed(() => {\n const m = this.min();\n return typeof m === 'number' ? m : 0;\n });\n /** Resolved numeric upper bound for internal arithmetic. */\n private readonly maxValue = computed(() => {\n const m = this.max();\n return typeof m === 'number' ? m : 100;\n });\n\n /** Step size for keyboard and drag. @default 1 */\n readonly step = input(1, { transform: (v: unknown): number => Math.max(0.0001, coerceNumberProperty(v, 1)) });\n /** Render two thumbs and emit `[low, high]`. @default false */\n readonly range = input(false, { transform: coerceBooleanProperty });\n /**\n * Disable interaction. Bound automatically from the field's disabled state\n * when used with `[formField]`.\n *\n * @default false\n */\n readonly disabled = input(false, { transform: coerceBooleanProperty });\n\n /**\n * Refuse value changes while the thumbs stay focusable and the value still\n * submits. Bound automatically from the field's readonly state when used with\n * `[formField]`.\n *\n * The thumbs keep their tab stop and keep announcing their value — arrow keys,\n * Home / End and the pointer simply move nothing — which is the whole\n * difference from `disabled`, where they would leave the tab order entirely.\n * Mirrored as `aria-readonly`, which role `slider` supports.\n *\n * @default false\n */\n readonly readonly = input(false, { transform: coerceBooleanProperty });\n /** Render the current value below the track. @default true */\n readonly showValue = input(true, { transform: coerceBooleanProperty });\n\n /**\n * Maps a value to the text of the value label, and to `aria-valuetext` on\n * the thumb, so a screen reader hears what the label shows. In range mode\n * each end is mapped on its own. Unset, the label prints the number and the\n * thumb announces `aria-valuenow`.\n *\n * @example\n * ```html\n * <wr-slider [max]=\"24\" [labelWith]=\"hour\" [(value)]=\"start\" />\n * ```\n */\n readonly labelWith = input<(value: number) => string>();\n\n /**\n * Accessible name of the thumb — the single one, or the LOWER one in range\n * mode. Falls back to `slider.label` / `slider.lower`.\n */\n readonly ariaLabel = input<string | null>(null);\n\n /** Accessible name of the upper thumb in range mode. Falls back to `slider.upper`. */\n readonly upperLabel = input<string | null>(null);\n\n /**\n * A thumb projects no text, so these ARE the accessible names — and they were\n * hard-coded English with no key behind them, so every slider on a page\n * announced the same untranslated \"Value\" whatever it controlled.\n *\n * Range mode reads `ariaLabel` as the LOWER end rather than as the whole\n * control: a name given once must land on something, and naming both thumbs\n * the same thing would read two different values under one name.\n */\n private readonly singleLabel = useI18nText(this.ariaLabel, 'slider.label', 'Value');\n private readonly lowerLabel = useI18nText(this.ariaLabel, 'slider.lower', 'Lower value');\n protected readonly resolvedUpperLabel = useI18nText(this.upperLabel, 'slider.upper', 'Upper value');\n protected readonly resolvedLowLabel = computed(() => (this.range() ? this.lowerLabel() : this.singleLabel()));\n\n private readonly field = inject(WR_FORM_FIELD, { optional: true });\n\n /**\n * Id the surrounding `<wr-form-field>`'s `<label for>` points at, put on the\n * single thumb — the LOWER one in range mode, the same end `ariaLabel` names.\n *\n * The field renders its label before it can see what was projected into it, so\n * the id travels the other way and the control adopts it, exactly as\n * `[wrInput]` does. Without this the `for` named an element that was nowhere\n * in the document: clicking the label did nothing, and the field's own text\n * reached the thumb through no path at all.\n *\n * It lands on the THUMB rather than on the host because only a labelable\n * element can be a label's target, and `<wr-slider>` is not one — a `for`\n * pointing at the host would resolve and still name nothing. The thumb is a\n * real `<button>`, so it is.\n *\n * What this does NOT change is the thumb's name: an `aria-label` outranks a\n * `<label>` in the accname order, and the thumb keeps its own because the\n * field cannot promise it has one to give — `<wr-form-field>` renders a label\n * only when `label` is set, and a slider that traded a generic name for no\n * name would be the worse bug. Set `[ariaLabel]` to the field's label where\n * the two should read alike.\n */\n protected readonly thumbId = computed(() => this.field?.controlId() ?? null);\n\n /**\n * The field's error message, wired to the thumb the same way `wrInput` wires it\n * to its native element.\n *\n * Without this the messages `<wr-form-field>` renders are visible and nothing\n * else: a screen reader on the thumb never learns the field is invalid, nor\n * what the message says. `aria-invalid` is keyed on the message EXISTING rather\n * than on `errorKeys()`, because the field only publishes an id once it is\n * showing something — announcing \"invalid\" while pointing at nothing is worse\n * than staying quiet.\n */\n // Through the shared helper, not a local pair: the hint is described by\n // `hintId`, which only `useFormFieldAria()` composes, and `aria-invalid` keys\n // on the error COUNT rather than on \"something is described\". Hand-rolled here,\n // these three announced the error and never the hint — and `<input wrInput>` is\n // the control the report was filed against.\n private readonly fieldAria = useFormFieldAria();\n protected readonly describedBy = this.fieldAria.describedBy;\n\n /**\n * The field's own label, when it renders one — `null` otherwise, and `null`\n * when `[ariaLabel]` was set deliberately.\n *\n * `aria-label` outranks a `<label for>` in the accname order, so without this\n * every slider in a form announced the generic `slider.value` default: three\n * sliders under three different labels, all called \"Value\". Nothing catches\n * it — the control HAS a name, so axe is satisfied — and it fails WCAG 2.5.3,\n * where the visible label has to be IN the accessible name.\n *\n * SINGLE thumb only, and deliberately: a range has two, and pointing both at\n * one label would name them identically, which is worse than the generic\n * pair they carry now. Naming a range's thumbs after their field needs\n * `aria-labelledby` to carry two ids — the field's and a hidden one per thumb\n * — which is more machinery than this is worth until someone asks for it.\n */\n protected readonly labelledBy = computed(() =>\n this.ariaLabel() || this.range() ? null : this.fieldAria.labelledBy()\n );\n\n /** `null` once `aria-labelledby` is carrying the name — see {@link labelledBy}. */\n protected readonly lowNameLabel = computed(() => (this.labelledBy() ? null : this.resolvedLowLabel()));\n protected readonly ariaInvalid = this.fieldAria.ariaInvalid;\n\n /**\n * Current value. Bound by `[formField]`, or two-way via `[(value)]`. Shape\n * follows `range`: a plain `number`, or `[low, high]` in range mode.\n */\n readonly value = model<WrSliderValue>(0);\n\n /** Emitted on blur so a bound field can mark itself touched. */\n readonly touch = output<void>();\n\n protected readonly low = signal(0);\n /**\n * The high thumb's cell. Its literal default stands in for `maxValue()`,\n * which cannot be read at field-initialisation time — see `highSeeded` and\n * the constructor effect.\n */\n protected readonly high = signal(100);\n\n /**\n * Whether `high` has ever been told a real value by the model.\n *\n * `<wr-slider range [min]=\"200\" [max]=\"300\" />` binds no value, so the model\n * holds its own scalar default and the tuple branch below never runs: `high`\n * kept the literal 100, which is not inside every `[min, max]`. The thumb\n * rendered off the track and the first interaction committed `[low, 100]` —\n * a value the slider itself calls out of range.\n */\n private highSeeded = false;\n\n protected readonly track = viewChild.required<ElementRef<HTMLElement>>('track');\n private readonly lowThumb = viewChild.required<ElementRef<HTMLButtonElement>>('lowThumb');\n\n /**\n * Ambient reading direction. Optional so a bare `TestBed` — or any consumer\n * that never set a direction — needs no provider; `Directionality` is\n * root-provided, so `null` only ever means \"nobody asked\", which is LTR.\n *\n * Nothing caches a direction-derived value: the thumbs are painted with\n * `inset-inline-start`, so the track mirrors from CSS alone, and `isRtl()` is\n * read inside the event handlers. A runtime flip therefore needs no\n * subscription to `Directionality.change`.\n */\n private readonly dir = inject(Directionality, { optional: true });\n\n protected readonly classes = computed(() => {\n const parts = ['wr-slider'];\n if (this.range()) parts.push('wr-slider--range');\n if (this.disabled()) parts.push('wr-slider--disabled');\n else if (this.readonly()) parts.push('wr-slider--readonly');\n return parts.join(' ');\n });\n\n protected readonly lowPercent = computed(() => this.percentOf(this.low()));\n protected readonly highPercent = computed(() => this.percentOf(this.high()));\n\n /** Offset of the fill from the track's START edge — the left one in LTR, the right one in RTL. */\n protected readonly fillStart = computed(() => (this.range() ? this.lowPercent() : 0));\n protected readonly fillWidth = computed(() =>\n this.range() ? this.highPercent() - this.lowPercent() : this.lowPercent()\n );\n\n /** `aria-valuetext` of the lower thumb: `null` without `labelWith`, so the number announces as is. */\n protected readonly lowText = computed<string | null>(() => this.labelWith()?.(this.low()) ?? null);\n /** `aria-valuetext` of the upper thumb, see {@link lowText}. */\n protected readonly highText = computed<string | null>(() => this.labelWith()?.(this.high()) ?? null);\n\n protected readonly label = computed(() => {\n const low = this.lowText() ?? `${this.low()}`;\n return this.range() ? `${low} – ${this.highText() ?? this.high()}` : low;\n });\n\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('slider');\n // Keep the internal thumbs in sync with external writes to `value`\n // (the old `writeValue`): split the tuple / clamp into the low & high cells.\n // The cells are clamped and the MODEL IS NOT TOUCHED, and the asymmetry is\n // deliberate. A thumb cannot render outside its own track, so the display\n // has no choice — but writing that clamp back into `value` would erase the\n // error it represents: under `[formField]` the bounds reach this component\n // only through the schema's `min()` / `max()` rules (binding `[min]` beside\n // `[formField]` is an NG8022 compile error), so the write-back deleted the\n // out-of-range value those rules exist to report, and marked a pristine\n // form dirty on first paint besides. The first real interaction emits an\n // in-range number through `emitChange` and the two agree from then on.\n effect(() => {\n const v = this.value();\n\n if (Array.isArray(v)) {\n const tuple = v as readonly [number, number];\n const a = this.clampToBounds(tuple[0]);\n const b = this.clampToBounds(tuple[1]);\n // ORDERED, and only for the display — the same asymmetry as the clamp\n // above, for the same reason. An external `[80, 20]` used to seed\n // `low = 80` and `high = 20`, which made each thumb report an\n // `aria-valuenow` outside its OWN `aria-valuemin`/`aria-valuemax` (the\n // two bound each other), and left the fill with a start and no width,\n // so a range that is real simply vanished.\n //\n // This does not contradict the recorded contract that an edit to one\n // end is never reordered: that one is scoped to \"while the user is\n // still on it\", and ordering settles when the interaction ends. An\n // external write IS the end — there is no interaction in progress.\n const lo = Math.min(a, b);\n const hi = Math.max(a, b);\n this.low.set(lo);\n this.high.set(hi);\n this.highSeeded = true;\n return;\n }\n\n if (typeof v !== 'number') return;\n const lo = this.clampToBounds(v);\n this.low.set(lo);\n\n if (!this.range()) return;\n\n // Range mode holding a scalar: the high thumb has never been told\n // anything, and its literal default is not inside every `[min, max]`.\n // Seed it at the top of the range — which is what the 100 meant back when\n // the bounds were 0–100. The MODEL is left alone here too; the shape it\n // holds is the consumer's business until they move a thumb.\n this.high.set(this.highSeeded ? this.clampToBounds(untracked(this.high)) : this.maxValue());\n this.highSeeded = true;\n });\n }\n\n /**\n * Focus the slider — what Signal Forms calls to focus this control, from\n * `focusBoundControl()`. The host carries no tab stop, so the call goes to\n * the thumb, and in range mode to the LOWER one: the first in the tab order,\n * and the one that carries the field's id and error description.\n */\n focus(options?: FocusOptions): void {\n this.lowThumb().nativeElement.focus(options);\n }\n\n // Interaction\n\n protected onPointerDown(event: PointerEvent, thumb: 'low' | 'high'): void {\n if (this.disabled() || this.readonly()) return;\n event.preventDefault();\n const target = event.currentTarget as HTMLElement;\n target.setPointerCapture(event.pointerId);\n // `preventDefault` above also suppresses the default focus, so the arrows\n // did nothing after a mouse drag until the thumb was found again with Tab —\n // while a click on the bare TRACK focused it. Synchronously, not through\n // `focusThumb`: `event.currentTarget` is already the thumb, so that\n // helper's `queueMicrotask` would only defer a focus nothing is waiting on.\n target.focus();\n\n const move = (e: PointerEvent): void => this.updateFromEvent(e, thumb);\n const cleanup = (e: PointerEvent): void => {\n target.releasePointerCapture(e.pointerId);\n target.removeEventListener('pointermove', move);\n target.removeEventListener('pointerup', cleanup);\n target.removeEventListener('pointercancel', cleanup);\n this.touch.emit();\n };\n\n target.addEventListener('pointermove', move);\n target.addEventListener('pointerup', cleanup);\n // `pointercancel` is never followed by a `pointerup`, so without this the\n // move listener outlived the drag: the thumb kept following a pointer that\n // was merely hovering over it, with no button held.\n target.addEventListener('pointercancel', cleanup);\n this.updateFromEvent(event, thumb);\n }\n\n protected onTrackPointerDown(event: PointerEvent): void {\n if (this.disabled() || this.readonly()) return;\n if ((event.target as HTMLElement).closest('.wr-slider__thumb')) return;\n const thumb = this.nearestThumb(event);\n this.updateFromEvent(event, thumb);\n this.focusThumb(thumb);\n }\n\n protected onKey(event: KeyboardEvent, thumb: 'low' | 'high'): void {\n if (this.disabled() || this.readonly()) return;\n const big = event.shiftKey || event.key === 'PageUp' || event.key === 'PageDown' ? 10 : 1;\n const delta = this.step() * big;\n const current = thumb === 'low' ? this.low() : this.high();\n // The horizontal arrows name a SIDE of the track, so they follow the\n // reading direction; every other key names a value and does not.\n const inline = this.isRtl() ? -delta : delta;\n let next: number | null = null;\n\n switch (event.key) {\n case 'ArrowRight':\n next = current + inline;\n break;\n case 'ArrowLeft':\n next = current - inline;\n break;\n case 'ArrowUp':\n case 'PageUp':\n next = current + delta;\n break;\n case 'ArrowDown':\n case 'PageDown':\n next = current - delta;\n break;\n case 'Home':\n next = this.minValue();\n break;\n case 'End':\n next = this.maxValue();\n break;\n }\n\n if (next === null) return;\n event.preventDefault();\n this.setThumb(thumb, next);\n this.emitChange();\n this.touch.emit();\n }\n\n /**\n * A bound field learns it may show its validation copy from `touch`, and\n * pointer-up plus a value-changing keypress cannot be the only sources: a\n * slider tabbed into and out of without an arrow press left the field\n * untouched forever — which is exactly the case `touched` exists for, and\n * what this output has always documented itself as doing. `wr-knob` and\n * `wr-rating` bind `(blur)` on the one element they own; this component has\n * two thumbs, so it listens for the bubbling `focusout` on its host instead\n * — and ignores the one that only moves focus from one thumb to the other.\n */\n protected onFocusOut(event: FocusEvent): void {\n if (this.track().nativeElement.contains(event.relatedTarget as Node | null)) return;\n this.touch.emit();\n }\n\n // Internals\n\n private isRtl(): boolean {\n return this.dir?.value === 'rtl';\n }\n\n /**\n * The value under a pointer, measured along the track's INLINE axis.\n *\n * The offset is taken from whichever edge the track starts at — the left one\n * in LTR, the right one in RTL — so the whole component needs the direction\n * in exactly one place. Measuring from `rect.left` regardless would read 0 at\n * the visual maximum of a mirrored track.\n */\n private valueAt(event: PointerEvent): number {\n const rect = this.track().nativeElement.getBoundingClientRect();\n const offset = this.isRtl() ? rect.right - event.clientX : event.clientX - rect.left;\n const ratio = wrClamp(offset / rect.width, 0, 1);\n return this.minValue() + ratio * (this.maxValue() - this.minValue());\n }\n\n private updateFromEvent(event: PointerEvent, thumb: 'low' | 'high'): void {\n this.setThumb(thumb, this.valueAt(event));\n this.emitChange();\n }\n\n /**\n * Which thumb a track click grabs: the one nearest the pointer ON SCREEN.\n *\n * Value distance is the same thing as visual distance once {@link valueAt}\n * has mirrored the ratio — in RTL the low thumb is the RIGHT one, and a click\n * near the right edge lands close to `low` in value space too.\n */\n private nearestThumb(event: PointerEvent): 'low' | 'high' {\n if (!this.range()) return 'low';\n const raw = this.valueAt(event);\n return Math.abs(raw - this.low()) <= Math.abs(raw - this.high()) ? 'low' : 'high';\n }\n\n private focusThumb(thumb: 'low' | 'high'): void {\n queueMicrotask(() => {\n const root = this.track().nativeElement;\n const el = root.querySelector<HTMLElement>(`.wr-slider__thumb--${thumb}`);\n el?.focus();\n });\n }\n\n private setThumb(thumb: 'low' | 'high', raw: number): void {\n const stepped = this.snap(raw);\n if (thumb === 'low') {\n const next = this.range() ? Math.min(stepped, this.high()) : stepped;\n this.low.set(next);\n } else {\n this.high.set(Math.max(stepped, this.low()));\n }\n }\n\n private snap(value: number): number {\n const stepped = Math.round((value - this.minValue()) / this.step()) * this.step() + this.minValue();\n return this.clampToBounds(wrRound(stepped, 6));\n }\n\n private clampToBounds(v: number): number {\n return wrClamp(v, this.minValue(), this.maxValue());\n }\n\n private percentOf(v: number): number {\n const span = this.maxValue() - this.minValue();\n if (span <= 0) return 0;\n return ((v - this.minValue()) / span) * 100;\n }\n\n private emitChange(): void {\n const value: WrSliderValue = this.range() ? [this.low(), this.high()] : this.low();\n this.value.set(value);\n }\n}\n","<div #track class=\"wr-slider__track\" (pointerdown)=\"onTrackPointerDown($event)\">\n <!--\n Positioned on the INLINE axis, not with `left`: `inset-inline-start` is the\n same edge in LTR and mirrors under `dir=\"rtl\"`, so the track paints itself\n the right way round without the component reading a direction to draw.\n -->\n <span class=\"wr-slider__fill\" [style.inset-inline-start.%]=\"fillStart()\" [style.width.%]=\"fillWidth()\"></span>\n\n <button\n #lowThumb\n type=\"button\"\n class=\"wr-slider__thumb wr-slider__thumb--low\"\n role=\"slider\"\n [attr.id]=\"thumbId()\"\n [style.inset-inline-start.%]=\"lowPercent()\"\n [disabled]=\"disabled()\"\n [attr.aria-valuemin]=\"min()\"\n [attr.aria-valuemax]=\"range() ? high() : max()\"\n [attr.aria-valuenow]=\"low()\"\n [attr.aria-valuetext]=\"lowText()\"\n [attr.aria-label]=\"lowNameLabel()\"\n [attr.aria-labelledby]=\"labelledBy()\"\n [attr.aria-readonly]=\"readonly() || null\"\n [attr.aria-describedby]=\"describedBy()\"\n [attr.aria-invalid]=\"ariaInvalid()\"\n (pointerdown)=\"onPointerDown($event, 'low')\"\n (keydown)=\"onKey($event, 'low')\"\n ></button>\n\n @if (range()) {\n <button\n type=\"button\"\n class=\"wr-slider__thumb wr-slider__thumb--high\"\n role=\"slider\"\n [style.inset-inline-start.%]=\"highPercent()\"\n [disabled]=\"disabled()\"\n [attr.aria-valuemin]=\"low()\"\n [attr.aria-valuemax]=\"max()\"\n [attr.aria-valuenow]=\"high()\"\n [attr.aria-valuetext]=\"highText()\"\n [attr.aria-label]=\"resolvedUpperLabel()\"\n [attr.aria-readonly]=\"readonly() || null\"\n (pointerdown)=\"onPointerDown($event, 'high')\"\n (keydown)=\"onKey($event, 'high')\"\n ></button>\n }\n</div>\n\n@if (showValue()) {\n <div class=\"wr-slider__label\">{{ label() }}</div>\n}\n"],"mappings":";;;;;;;;;;;;;AAmEA,IAAa,WAAb,MAAa,SAAQ;CAMV,MAAM,MAAiC,GAAC;EAAA,GAAA,YAAA,EAAA,WAAA,MAAA,+BAAA,CAAA;EAAI,YAAY,MAAuB,qBAAqB,GAAG,CAAC;CAAC,CAAA;CAEzG,MAAM,MAAiC,KAAG;EAAA,GAAA,YAAA,EAAA,WAAA,MAAA,+BAAA,CAAA;EACjD,YAAY,MAAuB,qBAAqB,GAAG,GAAG;CAAC,CAAA;CAIhD,WAAW,eAAc;EACxC,MAAM,IAAI,KAAK,IAAG;EAClB,OAAO,OAAO,MAAM,WAAW,IAAI;CACrC,GAAE,GAAA,YAAA,CAAA,EAAA,WAAA,WAAA,CAAA,+BAAA,CAAA,CAAA;CAEe,WAAW,eAAc;EACxC,MAAM,IAAI,KAAK,IAAG;EAClB,OAAO,OAAO,MAAM,WAAW,IAAI;CACrC,GAAE,GAAA,YAAA,CAAA,EAAA,WAAA,WAAA,CAAA,+BAAA,CAAA,CAAA;CAGO,OAAO,MAAM,GAAC;EAAA,GAAA,YAAA,EAAA,WAAA,OAAA,+BAAA,CAAA;EAAI,YAAY,MAAuB,KAAK,IAAI,MAAQ,qBAAqB,GAAG,CAAC,CAAC;CAAC,CAAA;CAEjG,QAAQ,MAAM,OAAK;EAAA,GAAA,YAAA,EAAA,WAAA,QAAA,+BAAA,CAAA;EAAI,WAAW;CAAqB,CAAA;CAOvD,WAAW,MAAM,OAAK;EAAA,GAAA,YAAA,E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;EAAA,WAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,YAAA,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,GAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,aAAA;EAAA,CAAA;EAAA,OAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,OAAA;EAAA,CAAA;EAAA,OAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,SAAO,EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;EAAA,UAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CACA,YAAU,EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;CAAA;AAAA,CAAA"}
1
+ {"version":3,"file":"ngwr-slider.mjs","names":[],"sources":["../../../projects/lib/slider/slider.ts","../../../projects/lib/slider/slider.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 { Directionality } from '@angular/cdk/bidi';\nimport { coerceBooleanProperty, coerceNumberProperty } from '@angular/cdk/coercion';\nimport type { ElementRef } from '@angular/core';\nimport {\n Component,\n ViewEncapsulation,\n computed,\n effect,\n inject,\n input,\n model,\n output,\n signal,\n untracked,\n viewChild,\n} from '@angular/core';\nimport type { FormValueControl } from '@angular/forms/signals';\n\nimport { WR_FORM_FIELD, useFormFieldAria } from 'ngwr/form';\nimport { useI18nText } from 'ngwr/i18n';\nimport { wrClamp, wrRound, wrCheckStyles } from 'ngwr/utils';\n\nimport type { WrSliderValue } from './types';\n\n/** Trim float drift from step calculations. */\n\n/**\n * Numeric slider with optional dual-thumb range mode.\n *\n * A signal-forms native control: it implements `FormValueControl<WrSliderValue>`,\n * so `[formField]` binds straight to its `value` model — no\n * `ControlValueAccessor` in between. `[(value)]` works standalone. The value\n * shape depends on `range`: `number` (default) or `[number, number]` when\n * `range=\"true\"`.\n *\n * Keyboard: ← / → adjust by `step`; ↑ / ↓ same; Shift+arrow by `step × 10`;\n * Home / End jump to min / max; PageUp / PageDown by `step × 10`.\n *\n * Reading direction: the arrows follow the VISUAL track, so under `dir=\"rtl\"`\n * → moves toward the lower end and ← toward the higher one, and a drag reads\n * its ratio from the right edge. ↑ / ↓, PageUp / PageDown and Home / End are\n * unchanged — they name a value, not a side of the screen.\n *\n * @example\n * ```html\n * <!-- signal forms -->\n * <wr-slider [formField]=\"form.volume\" min=\"0\" max=\"100\" step=\"5\" />\n *\n * <!-- standalone two-way binding -->\n * <wr-slider [(value)]=\"range\" range min=\"0\" max=\"1000\" step=\"10\" />\n * ```\n *\n * @see https://ngwr.dev/reference/components/slider\n */\n@Component({\n selector: 'wr-slider',\n templateUrl: './slider.html',\n encapsulation: ViewEncapsulation.None,\n host: { class: 'wr-slider', '[class]': 'classes()', '(focusout)': 'onFocusOut($event)' },\n})\nexport class WrSlider implements FormValueControl<WrSliderValue> {\n // Typed `WrSliderValue | undefined` (not `number`) to satisfy the reserved\n // `FormUiControl` min/max slots, which are keyed to the control's value type.\n // The transform still coerces to a plain number, so the bounds stay numeric\n // at runtime; `minValue`/`maxValue` narrow them back for arithmetic.\n /** Lower bound. @default 0 */\n readonly min = input<WrSliderValue | undefined>(0, { transform: (v: unknown): number => coerceNumberProperty(v, 0) });\n /** Upper bound. @default 100 */\n readonly max = input<WrSliderValue | undefined>(100, {\n transform: (v: unknown): number => coerceNumberProperty(v, 100),\n });\n\n /** Resolved numeric lower bound for internal arithmetic. */\n private readonly minValue = computed(() => {\n const m = this.min();\n return typeof m === 'number' ? m : 0;\n });\n /** Resolved numeric upper bound for internal arithmetic. */\n private readonly maxValue = computed(() => {\n const m = this.max();\n return typeof m === 'number' ? m : 100;\n });\n\n /** Step size for keyboard and drag. @default 1 */\n readonly step = input(1, { transform: (v: unknown): number => Math.max(0.0001, coerceNumberProperty(v, 1)) });\n /** Render two thumbs and emit `[low, high]`. @default false */\n readonly range = input(false, { transform: coerceBooleanProperty });\n /**\n * Disable interaction. Bound automatically from the field's disabled state\n * when used with `[formField]`.\n *\n * @default false\n */\n readonly disabled = input(false, { transform: coerceBooleanProperty });\n\n /**\n * Refuse value changes while the thumbs stay focusable and the value still\n * submits. Bound automatically from the field's readonly state when used with\n * `[formField]`.\n *\n * The thumbs keep their tab stop and keep announcing their value — arrow keys,\n * Home / End and the pointer simply move nothing — which is the whole\n * difference from `disabled`, where they would leave the tab order entirely.\n * Mirrored as `aria-readonly`, which role `slider` supports.\n *\n * @default false\n */\n readonly readonly = input(false, { transform: coerceBooleanProperty });\n /** Render the current value below the track. @default true */\n readonly showValue = input(true, { transform: coerceBooleanProperty });\n\n /**\n * Maps a value to the text of the value label, and to `aria-valuetext` on\n * the thumb, so a screen reader hears what the label shows. In range mode\n * each end is mapped on its own. Unset, the label prints the number and the\n * thumb announces `aria-valuenow`.\n *\n * @example\n * ```html\n * <wr-slider [max]=\"24\" [labelWith]=\"hour\" [(value)]=\"start\" />\n * ```\n */\n readonly labelWith = input<(value: number) => string>();\n\n /**\n * Accessible name of the thumb — the single one, or the LOWER one in range\n * mode. Falls back to `slider.label` / `slider.lower`.\n */\n readonly ariaLabel = input<string | null>(null);\n\n /** Accessible name of the upper thumb in range mode. Falls back to `slider.upper`. */\n readonly upperLabel = input<string | null>(null);\n\n /**\n * A thumb projects no text, so these ARE the accessible names — and they were\n * hard-coded English with no key behind them, so every slider on a page\n * announced the same untranslated \"Value\" whatever it controlled.\n *\n * Range mode reads `ariaLabel` as the LOWER end rather than as the whole\n * control: a name given once must land on something, and naming both thumbs\n * the same thing would read two different values under one name.\n */\n private readonly singleLabel = useI18nText(this.ariaLabel, 'slider.label', 'Value');\n private readonly lowerLabel = useI18nText(this.ariaLabel, 'slider.lower', 'Lower value');\n protected readonly resolvedUpperLabel = useI18nText(this.upperLabel, 'slider.upper', 'Upper value');\n protected readonly resolvedLowLabel = computed(() => (this.range() ? this.lowerLabel() : this.singleLabel()));\n\n private readonly field = inject(WR_FORM_FIELD, { optional: true });\n\n /**\n * Id the surrounding `<wr-form-field>`'s `<label for>` points at, put on the\n * single thumb — the LOWER one in range mode, the same end `ariaLabel` names.\n *\n * The field renders its label before it can see what was projected into it, so\n * the id travels the other way and the control adopts it, exactly as\n * `[wrInput]` does. Without this the `for` named an element that was nowhere\n * in the document: clicking the label did nothing, and the field's own text\n * reached the thumb through no path at all.\n *\n * It lands on the THUMB rather than on the host because only a labelable\n * element can be a label's target, and `<wr-slider>` is not one — a `for`\n * pointing at the host would resolve and still name nothing. The thumb is a\n * real `<button>`, so it is.\n *\n * What this does NOT change is the thumb's name: an `aria-label` outranks a\n * `<label>` in the accname order, and the thumb keeps its own because the\n * field cannot promise it has one to give — `<wr-form-field>` renders a label\n * only when `label` is set, and a slider that traded a generic name for no\n * name would be the worse bug. Set `[ariaLabel]` to the field's label where\n * the two should read alike.\n */\n protected readonly thumbId = computed(() => this.field?.controlId() ?? null);\n\n /**\n * The field's error message, wired to the thumb the same way `wrInput` wires it\n * to its native element.\n *\n * Without this the messages `<wr-form-field>` renders are visible and nothing\n * else: a screen reader on the thumb never learns the field is invalid, nor\n * what the message says. `aria-invalid` is keyed on the message EXISTING rather\n * than on `errorKeys()`, because the field only publishes an id once it is\n * showing something — announcing \"invalid\" while pointing at nothing is worse\n * than staying quiet.\n */\n // Through the shared helper, not a local pair: the hint is described by\n // `hintId`, which only `useFormFieldAria()` composes, and `aria-invalid` keys\n // on the error COUNT rather than on \"something is described\". Hand-rolled here,\n // these three announced the error and never the hint — and `<input wrInput>` is\n // the control the report was filed against.\n private readonly fieldAria = useFormFieldAria();\n protected readonly describedBy = this.fieldAria.describedBy;\n\n /**\n * The field's own label, when it renders one — `null` otherwise, and `null`\n * when `[ariaLabel]` was set deliberately.\n *\n * `aria-label` outranks a `<label for>` in the accname order, so without this\n * every slider in a form announced the generic `slider.value` default: three\n * sliders under three different labels, all called \"Value\". Nothing catches\n * it — the control HAS a name, so axe is satisfied — and it fails WCAG 2.5.3,\n * where the visible label has to be IN the accessible name.\n *\n * SINGLE thumb only, and deliberately: a range has two, and pointing both at\n * one label would name them identically, which is worse than the generic\n * pair they carry now. Naming a range's thumbs after their field needs\n * `aria-labelledby` to carry two ids — the field's and a hidden one per thumb\n * — which is more machinery than this is worth until someone asks for it.\n */\n protected readonly labelledBy = computed(() =>\n this.ariaLabel() || this.range() ? null : this.fieldAria.labelledBy()\n );\n\n /** `null` once `aria-labelledby` is carrying the name — see {@link labelledBy}. */\n protected readonly lowNameLabel = computed(() => (this.labelledBy() ? null : this.resolvedLowLabel()));\n protected readonly ariaInvalid = this.fieldAria.ariaInvalid;\n\n /**\n * Current value. Bound by `[formField]`, or two-way via `[(value)]`. Shape\n * follows `range`: a plain `number`, or `[low, high]` in range mode.\n */\n readonly value = model<WrSliderValue>(0);\n\n /** Emitted on blur so a bound field can mark itself touched. */\n readonly touch = output<void>();\n\n protected readonly low = signal(0);\n /**\n * The high thumb's cell. Its literal default stands in for `maxValue()`,\n * which cannot be read at field-initialisation time — see `highSeeded` and\n * the constructor effect.\n */\n protected readonly high = signal(100);\n\n /**\n * Whether `high` has ever been told a real value by the model.\n *\n * `<wr-slider range [min]=\"200\" [max]=\"300\" />` binds no value, so the model\n * holds its own scalar default and the tuple branch below never runs: `high`\n * kept the literal 100, which is not inside every `[min, max]`. The thumb\n * rendered off the track and the first interaction committed `[low, 100]` —\n * a value the slider itself calls out of range.\n */\n private highSeeded = false;\n\n protected readonly track = viewChild.required<ElementRef<HTMLElement>>('track');\n private readonly lowThumb = viewChild.required<ElementRef<HTMLButtonElement>>('lowThumb');\n\n /**\n * Ambient reading direction. Optional so a bare `TestBed` — or any consumer\n * that never set a direction — needs no provider; `Directionality` is\n * root-provided, so `null` only ever means \"nobody asked\", which is LTR.\n *\n * Nothing caches a direction-derived value: the thumbs are painted with\n * `inset-inline-start`, so the track mirrors from CSS alone, and `isRtl()` is\n * read inside the event handlers. A runtime flip therefore needs no\n * subscription to `Directionality.change`.\n */\n private readonly dir = inject(Directionality, { optional: true });\n\n protected readonly classes = computed(() => {\n const parts: string[] = [];\n if (this.range()) parts.push('wr-slider--range');\n if (this.disabled()) parts.push('wr-slider--disabled');\n else if (this.readonly()) parts.push('wr-slider--readonly');\n return parts.join(' ');\n });\n\n protected readonly lowPercent = computed(() => this.percentOf(this.low()));\n protected readonly highPercent = computed(() => this.percentOf(this.high()));\n\n /** Offset of the fill from the track's START edge — the left one in LTR, the right one in RTL. */\n protected readonly fillStart = computed(() => (this.range() ? this.lowPercent() : 0));\n protected readonly fillWidth = computed(() =>\n this.range() ? this.highPercent() - this.lowPercent() : this.lowPercent()\n );\n\n /** `aria-valuetext` of the lower thumb: `null` without `labelWith`, so the number announces as is. */\n protected readonly lowText = computed<string | null>(() => this.labelWith()?.(this.low()) ?? null);\n /** `aria-valuetext` of the upper thumb, see {@link lowText}. */\n protected readonly highText = computed<string | null>(() => this.labelWith()?.(this.high()) ?? null);\n\n protected readonly label = computed(() => {\n const low = this.lowText() ?? `${this.low()}`;\n return this.range() ? `${low} – ${this.highText() ?? this.high()}` : low;\n });\n\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('slider');\n // Keep the internal thumbs in sync with external writes to `value`\n // (the old `writeValue`): split the tuple / clamp into the low & high cells.\n // The cells are clamped and the MODEL IS NOT TOUCHED, and the asymmetry is\n // deliberate. A thumb cannot render outside its own track, so the display\n // has no choice — but writing that clamp back into `value` would erase the\n // error it represents: under `[formField]` the bounds reach this component\n // only through the schema's `min()` / `max()` rules (binding `[min]` beside\n // `[formField]` is an NG8022 compile error), so the write-back deleted the\n // out-of-range value those rules exist to report, and marked a pristine\n // form dirty on first paint besides. The first real interaction emits an\n // in-range number through `emitChange` and the two agree from then on.\n effect(() => {\n const v = this.value();\n\n if (Array.isArray(v)) {\n const tuple = v as readonly [number, number];\n const a = this.clampToBounds(tuple[0]);\n const b = this.clampToBounds(tuple[1]);\n // ORDERED, and only for the display — the same asymmetry as the clamp\n // above, for the same reason. An external `[80, 20]` used to seed\n // `low = 80` and `high = 20`, which made each thumb report an\n // `aria-valuenow` outside its OWN `aria-valuemin`/`aria-valuemax` (the\n // two bound each other), and left the fill with a start and no width,\n // so a range that is real simply vanished.\n //\n // This does not contradict the recorded contract that an edit to one\n // end is never reordered: that one is scoped to \"while the user is\n // still on it\", and ordering settles when the interaction ends. An\n // external write IS the end — there is no interaction in progress.\n const lo = Math.min(a, b);\n const hi = Math.max(a, b);\n this.low.set(lo);\n this.high.set(hi);\n this.highSeeded = true;\n return;\n }\n\n if (typeof v !== 'number') return;\n const lo = this.clampToBounds(v);\n this.low.set(lo);\n\n if (!this.range()) return;\n\n // Range mode holding a scalar: the high thumb has never been told\n // anything, and its literal default is not inside every `[min, max]`.\n // Seed it at the top of the range — which is what the 100 meant back when\n // the bounds were 0–100. The MODEL is left alone here too; the shape it\n // holds is the consumer's business until they move a thumb.\n this.high.set(this.highSeeded ? this.clampToBounds(untracked(this.high)) : this.maxValue());\n this.highSeeded = true;\n });\n }\n\n /**\n * Focus the slider — what Signal Forms calls to focus this control, from\n * `focusBoundControl()`. The host carries no tab stop, so the call goes to\n * the thumb, and in range mode to the LOWER one: the first in the tab order,\n * and the one that carries the field's id and error description.\n */\n focus(options?: FocusOptions): void {\n this.lowThumb().nativeElement.focus(options);\n }\n\n // Interaction\n\n protected onPointerDown(event: PointerEvent, thumb: 'low' | 'high'): void {\n if (this.disabled() || this.readonly()) return;\n event.preventDefault();\n const target = event.currentTarget as HTMLElement;\n target.setPointerCapture(event.pointerId);\n // `preventDefault` above also suppresses the default focus, so the arrows\n // did nothing after a mouse drag until the thumb was found again with Tab —\n // while a click on the bare TRACK focused it. Synchronously, not through\n // `focusThumb`: `event.currentTarget` is already the thumb, so that\n // helper's `queueMicrotask` would only defer a focus nothing is waiting on.\n target.focus();\n\n const move = (e: PointerEvent): void => this.updateFromEvent(e, thumb);\n const cleanup = (e: PointerEvent): void => {\n target.releasePointerCapture(e.pointerId);\n target.removeEventListener('pointermove', move);\n target.removeEventListener('pointerup', cleanup);\n target.removeEventListener('pointercancel', cleanup);\n this.touch.emit();\n };\n\n target.addEventListener('pointermove', move);\n target.addEventListener('pointerup', cleanup);\n // `pointercancel` is never followed by a `pointerup`, so without this the\n // move listener outlived the drag: the thumb kept following a pointer that\n // was merely hovering over it, with no button held.\n target.addEventListener('pointercancel', cleanup);\n this.updateFromEvent(event, thumb);\n }\n\n protected onTrackPointerDown(event: PointerEvent): void {\n if (this.disabled() || this.readonly()) return;\n if ((event.target as HTMLElement).closest('.wr-slider__thumb')) return;\n const thumb = this.nearestThumb(event);\n this.updateFromEvent(event, thumb);\n this.focusThumb(thumb);\n }\n\n protected onKey(event: KeyboardEvent, thumb: 'low' | 'high'): void {\n if (this.disabled() || this.readonly()) return;\n const big = event.shiftKey || event.key === 'PageUp' || event.key === 'PageDown' ? 10 : 1;\n const delta = this.step() * big;\n const current = thumb === 'low' ? this.low() : this.high();\n // The horizontal arrows name a SIDE of the track, so they follow the\n // reading direction; every other key names a value and does not.\n const inline = this.isRtl() ? -delta : delta;\n let next: number | null = null;\n\n switch (event.key) {\n case 'ArrowRight':\n next = current + inline;\n break;\n case 'ArrowLeft':\n next = current - inline;\n break;\n case 'ArrowUp':\n case 'PageUp':\n next = current + delta;\n break;\n case 'ArrowDown':\n case 'PageDown':\n next = current - delta;\n break;\n case 'Home':\n next = this.minValue();\n break;\n case 'End':\n next = this.maxValue();\n break;\n }\n\n if (next === null) return;\n event.preventDefault();\n this.setThumb(thumb, next);\n this.emitChange();\n this.touch.emit();\n }\n\n /**\n * A bound field learns it may show its validation copy from `touch`, and\n * pointer-up plus a value-changing keypress cannot be the only sources: a\n * slider tabbed into and out of without an arrow press left the field\n * untouched forever — which is exactly the case `touched` exists for, and\n * what this output has always documented itself as doing. `wr-knob` and\n * `wr-rating` bind `(blur)` on the one element they own; this component has\n * two thumbs, so it listens for the bubbling `focusout` on its host instead\n * — and ignores the one that only moves focus from one thumb to the other.\n */\n protected onFocusOut(event: FocusEvent): void {\n if (this.track().nativeElement.contains(event.relatedTarget as Node | null)) return;\n this.touch.emit();\n }\n\n // Internals\n\n private isRtl(): boolean {\n return this.dir?.value === 'rtl';\n }\n\n /**\n * The value under a pointer, measured along the track's INLINE axis.\n *\n * The offset is taken from whichever edge the track starts at — the left one\n * in LTR, the right one in RTL — so the whole component needs the direction\n * in exactly one place. Measuring from `rect.left` regardless would read 0 at\n * the visual maximum of a mirrored track.\n */\n private valueAt(event: PointerEvent): number {\n const rect = this.track().nativeElement.getBoundingClientRect();\n const offset = this.isRtl() ? rect.right - event.clientX : event.clientX - rect.left;\n const ratio = wrClamp(offset / rect.width, 0, 1);\n return this.minValue() + ratio * (this.maxValue() - this.minValue());\n }\n\n private updateFromEvent(event: PointerEvent, thumb: 'low' | 'high'): void {\n this.setThumb(thumb, this.valueAt(event));\n this.emitChange();\n }\n\n /**\n * Which thumb a track click grabs: the one nearest the pointer ON SCREEN.\n *\n * Value distance is the same thing as visual distance once {@link valueAt}\n * has mirrored the ratio — in RTL the low thumb is the RIGHT one, and a click\n * near the right edge lands close to `low` in value space too.\n */\n private nearestThumb(event: PointerEvent): 'low' | 'high' {\n if (!this.range()) return 'low';\n const raw = this.valueAt(event);\n return Math.abs(raw - this.low()) <= Math.abs(raw - this.high()) ? 'low' : 'high';\n }\n\n private focusThumb(thumb: 'low' | 'high'): void {\n queueMicrotask(() => {\n const root = this.track().nativeElement;\n const el = root.querySelector<HTMLElement>(`.wr-slider__thumb--${thumb}`);\n el?.focus();\n });\n }\n\n private setThumb(thumb: 'low' | 'high', raw: number): void {\n const stepped = this.snap(raw);\n if (thumb === 'low') {\n const next = this.range() ? Math.min(stepped, this.high()) : stepped;\n this.low.set(next);\n } else {\n this.high.set(Math.max(stepped, this.low()));\n }\n }\n\n private snap(value: number): number {\n const stepped = Math.round((value - this.minValue()) / this.step()) * this.step() + this.minValue();\n return this.clampToBounds(wrRound(stepped, 6));\n }\n\n private clampToBounds(v: number): number {\n return wrClamp(v, this.minValue(), this.maxValue());\n }\n\n private percentOf(v: number): number {\n const span = this.maxValue() - this.minValue();\n if (span <= 0) return 0;\n return ((v - this.minValue()) / span) * 100;\n }\n\n private emitChange(): void {\n const value: WrSliderValue = this.range() ? [this.low(), this.high()] : this.low();\n this.value.set(value);\n }\n}\n","<div #track class=\"wr-slider__track\" (pointerdown)=\"onTrackPointerDown($event)\">\n <!--\n Positioned on the INLINE axis, not with `left`: `inset-inline-start` is the\n same edge in LTR and mirrors under `dir=\"rtl\"`, so the track paints itself\n the right way round without the component reading a direction to draw.\n -->\n <span class=\"wr-slider__fill\" [style.inset-inline-start.%]=\"fillStart()\" [style.width.%]=\"fillWidth()\"></span>\n\n <button\n #lowThumb\n type=\"button\"\n class=\"wr-slider__thumb wr-slider__thumb--low\"\n role=\"slider\"\n [attr.id]=\"thumbId()\"\n [style.inset-inline-start.%]=\"lowPercent()\"\n [disabled]=\"disabled()\"\n [attr.aria-valuemin]=\"min()\"\n [attr.aria-valuemax]=\"range() ? high() : max()\"\n [attr.aria-valuenow]=\"low()\"\n [attr.aria-valuetext]=\"lowText()\"\n [attr.aria-label]=\"lowNameLabel()\"\n [attr.aria-labelledby]=\"labelledBy()\"\n [attr.aria-readonly]=\"readonly() || null\"\n [attr.aria-describedby]=\"describedBy()\"\n [attr.aria-invalid]=\"ariaInvalid()\"\n (pointerdown)=\"onPointerDown($event, 'low')\"\n (keydown)=\"onKey($event, 'low')\"\n ></button>\n\n @if (range()) {\n <button\n type=\"button\"\n class=\"wr-slider__thumb wr-slider__thumb--high\"\n role=\"slider\"\n [style.inset-inline-start.%]=\"highPercent()\"\n [disabled]=\"disabled()\"\n [attr.aria-valuemin]=\"low()\"\n [attr.aria-valuemax]=\"max()\"\n [attr.aria-valuenow]=\"high()\"\n [attr.aria-valuetext]=\"highText()\"\n [attr.aria-label]=\"resolvedUpperLabel()\"\n [attr.aria-readonly]=\"readonly() || null\"\n (pointerdown)=\"onPointerDown($event, 'high')\"\n (keydown)=\"onKey($event, 'high')\"\n ></button>\n }\n</div>\n\n@if (showValue()) {\n <div class=\"wr-slider__label\">{{ label() }}</div>\n}\n"],"mappings":";;;;;;;;;;;;;AAmEA,IAAa,WAAb,MAAa,SAAQ;CAMV,MAAM,MAAiC,GAAC;EAAA,GAAA,YAAA,EAAA,WAAA,MAAA,+BAAA,CAAA;EAAI,YAAY,MAAuB,qBAAqB,GAAG,CAAC;CAAC,CAAA;CAEzG,MAAM,MAAiC,KAAG;EAAA,GAAA,YAAA,EAAA,WAAA,MAAA,+BAAA,CAAA;EACjD,YAAY,MAAuB,qBAAqB,GAAG,GAAG;CAAC,CAAA;CAIhD,WAAW,eAAc;EACxC,MAAM,IAAI,KAAK,IAAG;EAClB,OAAO,OAAO,MAAM,WAAW,IAAI;CACrC,GAAE,GAAA,YAAA,CAAA,EAAA,WAAA,WAAA,CAAA,+BAAA,CAAA,CAAA;CAEe,WAAW,eAAc;EACxC,MAAM,IAAI,KAAK,IAAG;EAClB,OAAO,OAAO,MAAM,WAAW,IAAI;CACrC,GAAE,GAAA,YAAA,CAAA,EAAA,WAAA,WAAA,CAAA,+BAAA,CAAA,CAAA;CAGO,OAAO,MAAM,GAAC;EAAA,GAAA,YAAA,EAAA,WAAA,OAAA,+BAAA,CAAA;EAAI,YAAY,MAAuB,KAAK,IAAI,MAAQ,qBAAqB,GAAG,CAAC,CAAC;CAAC,CAAA;CAEjG,QAAQ,MAAM,OAAK;EAAA,GAAA,YAAA,EAAA,WAAA,QAAA,+BAAA,CAAA;EAAI,WAAW;CAAqB,CAAA;CAOvD,WAAW,MAAM,OAAK;EAAA,GAAA,YAAA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AAA,CAAA;EAAA,CAAA;EAAA,WAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,YAAA,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,GAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,aAAA;EAAA,CAAA;EAAA,OAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,OAAA;EAAA,CAAA;EAAA,OAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,SAAO,EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;EAAA,UAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CACA,YAAU,EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;CAAA;AAAA,CAAA"}
@@ -37,7 +37,7 @@ var WrSpeedDial = class WrSpeedDial {
37
37
  });
38
38
  }
39
39
  classes = computed(() => {
40
- const parts = ["wr-speed-dial", `wr-speed-dial--${this.direction()}`];
40
+ const parts = [`wr-speed-dial--${this.direction()}`];
41
41
  if (this.open()) parts.push("wr-speed-dial--open");
42
42
  if (this.disabled()) parts.push("wr-speed-dial--disabled");
43
43
  if (this.safeArea()) parts.push("wr-speed-dial--safe-area");
@@ -133,7 +133,8 @@ var WrSpeedDial = class WrSpeedDial {
133
133
  },
134
134
  host: {
135
135
  listeners: { "keydown": "onKeydown($event)" },
136
- properties: { "class": "classes()" }
136
+ properties: { "class": "classes()" },
137
+ classAttribute: "wr-speed-dial"
137
138
  },
138
139
  viewQueries: [{
139
140
  propertyName: "triggerEl",
@@ -164,6 +165,7 @@ i0.ɵɵngDeclareClassMetadata({
164
165
  selector: "wr-speed-dial",
165
166
  encapsulation: ViewEncapsulation.None,
166
167
  host: {
168
+ class: "wr-speed-dial",
167
169
  "[class]": "classes()",
168
170
  "(keydown)": "onKeydown($event)"
169
171
  },
@@ -1 +1 @@
1
- {"version":3,"file":"ngwr-speed-dial.mjs","names":[],"sources":["../../../projects/lib/speed-dial/speed-dial.ts","../../../projects/lib/speed-dial/speed-dial.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 ViewEncapsulation,\n computed,\n effect,\n inject,\n input,\n model,\n output,\n viewChild,\n} from '@angular/core';\n\nimport { useI18nText } from 'ngwr/i18n';\nimport { WrIcon, type WrIconName } from 'ngwr/icon';\nimport { wrCheckStyles } from 'ngwr/utils';\n\nimport type { WrSpeedDialAction, WrSpeedDialDirection } from './types';\n\nlet menuUid = 0;\n\n/**\n * Floating action button that expands into a fan of secondary actions on click.\n * Place inside a positioned container or near `position: fixed` — the component\n * itself doesn't pin to the viewport.\n *\n * @example\n * ```html\n * <wr-speed-dial\n * [actions]=\"[\n * { id: 'new', label: 'New', icon: 'add' },\n * { id: 'edit', label: 'Edit', icon: 'cog' }\n * ]\"\n * (pick)=\"onPick($event)\"\n * />\n * ```\n *\n * @see https://ngwr.dev/reference/components/speed-dial\n */\n@Component({\n selector: 'wr-speed-dial',\n templateUrl: './speed-dial.html',\n encapsulation: ViewEncapsulation.None,\n host: { '[class]': 'classes()', '(keydown)': 'onKeydown($event)' },\n imports: [WrIcon],\n})\nexport class WrSpeedDial {\n /**\n * The buttons that fan out when the dial opens, in order from the trigger\n * outwards. Each needs a label: it is the accessible name as well as the tooltip.\n */\n readonly actions = input<readonly WrSpeedDialAction[]>([]);\n\n /**\n * Accessible name of the trigger. Falls back to `speedDial.label`, then\n * `'Actions'` — the trigger is icon-only, so without this it has no name at all.\n */\n readonly triggerLabel = input<string | null>(null);\n\n protected readonly resolvedTriggerLabel = useI18nText(this.triggerLabel, 'speedDial.label', 'Actions');\n\n /** Direction the actions fan out. @default 'up' */\n readonly direction = input<WrSpeedDialDirection>('up');\n\n /** Two-way bindable open state. @default false */\n readonly open = model(false);\n\n /** Icon for the main trigger button. @default 'add' */\n readonly icon = input<WrIconName>('add');\n\n /** Disable interaction. @default false */\n readonly disabled = input(false, { transform: coerceBooleanProperty });\n\n /**\n * Pad the host toward the dial `direction` with `env(safe-area-inset-*)`.\n * Only matters when the consumer pins the dial to that edge of the\n * viewport; otherwise it has no effect. @default false\n */\n readonly safeArea = input(false, { transform: coerceBooleanProperty });\n\n /** Fires when the user picks one of the actions. */\n readonly pick = output<WrSpeedDialAction>();\n\n /** Id the trigger's `aria-controls` points at. */\n protected readonly menuId = `wr-speed-dial-menu-${++menuUid}`;\n\n protected readonly triggerEl = viewChild<ElementRef<HTMLButtonElement>>('trigger');\n\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\n\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('speed-dial');\n // A disabled trigger cannot be pressed, and the trigger is the only way to close\n // the dial — so being disabled while open left it fanned out with no way back.\n effect(() => {\n if (this.disabled() && this.open()) this.open.set(false);\n });\n }\n\n protected readonly classes = computed(() => {\n const parts = ['wr-speed-dial', `wr-speed-dial--${this.direction()}`];\n if (this.open()) parts.push('wr-speed-dial--open');\n if (this.disabled()) parts.push('wr-speed-dial--disabled');\n if (this.safeArea()) parts.push('wr-speed-dial--safe-area');\n return parts.join(' ');\n });\n\n protected onTrigger(): void {\n if (this.disabled()) return;\n this.open.update(v => !v);\n }\n\n protected onPick(action: WrSpeedDialAction): void {\n if (this.disabled()) return;\n this.open.set(false);\n // Take the focus back before the action goes — the collapsed wrapper turns\n // `visibility: hidden`, and a browser blurs an element it hides, so the caret\n // landed on `<body>` and the next Tab restarted at the top of the document.\n // Escape already did this; the SUCCESS path did not.\n //\n // Before the emit, not after: `pick` is where a consumer opens a dialog or\n // navigates, and such a handler moves focus itself — focusing afterwards would\n // yank the caret back onto the trigger. `wr-dropdown` sequences it the same way.\n //\n // Only when the caret is inside the dial: Safari does not focus a button on\n // mouse-down, so an unguarded call would steal it from wherever the user is.\n if (this.host.nativeElement.contains(this.host.nativeElement.ownerDocument.activeElement)) {\n this.triggerEl()?.nativeElement.focus();\n }\n this.pick.emit(action);\n }\n\n /**\n * Escape closes the dial and hands the caret back. The actions are ordinary buttons\n * in the tab order, so without this a keyboard user who opened the dial had to tab\n * through every action to leave it.\n */\n protected onKeydown(event: KeyboardEvent): void {\n if (event.key !== 'Escape' || !this.open()) return;\n event.preventDefault();\n this.open.set(false);\n this.triggerEl()?.nativeElement.focus();\n }\n\n /**\n * First GLYPH of the label, for an action with no icon. `charAt(0)` returns one\n * UTF-16 code unit, which cuts an astral character (an emoji) in half and renders a\n * replacement character.\n */\n protected initial(label: string): string {\n return [...label][0] ?? '';\n }\n}\n\nexport type { WrSpeedDialAction, WrSpeedDialDirection } from './types';\n","<button\n #trigger\n type=\"button\"\n class=\"wr-speed-dial__trigger\"\n [attr.aria-expanded]=\"open()\"\n [attr.aria-controls]=\"menuId\"\n [attr.aria-label]=\"resolvedTriggerLabel()\"\n [disabled]=\"disabled()\"\n (click)=\"onTrigger()\"\n>\n <wr-icon [name]=\"icon()\" />\n</button>\n\n<!--\n A LIST of buttons, deliberately not a `role=\"menu\"`. The dial used to announce\n aria-haspopup=\"menu\" over role=\"menuitem\" buttons while handling no menu key at\n all — no arrows, no Home/End, no focus moving in on open — and the actions were\n N tab stops rather than the pattern's one. That role also puts a screen reader\n into focus mode, so the arrow keys it promises stop reading the page and then do\n nothing here. The structure now says what the component does: a disclosure\n button (aria-expanded / aria-controls) revealing ordinary buttons that Tab\n reaches and Enter activates, with Escape as the way back.\n\n `role=\"list\"` is written out because `list-style: none` (styles/_index.scss)\n drops the implicit list semantics in Safari.\n-->\n<ul class=\"wr-speed-dial__actions\" role=\"list\" [attr.id]=\"menuId\">\n @for (action of actions(); track action.id) {\n <li class=\"wr-speed-dial__action-wrap\" [style.--wr-speed-dial-i]=\"$index + 1\">\n <button\n type=\"button\"\n class=\"wr-speed-dial__action\"\n [attr.aria-label]=\"action.label\"\n [title]=\"action.label\"\n [disabled]=\"disabled()\"\n (click)=\"onPick(action)\"\n >\n @if (action.icon) {\n <wr-icon [name]=\"action.icon\" />\n } @else {\n <span>{{ initial(action.label) }}</span>\n }\n </button>\n </li>\n }\n</ul>\n"],"mappings":";;;;;;;;;;;;AA2BA,IAAI,UAAU;AA2Bd,IAAa,cAAb,MAAa,YAAW;CAKb,UAAU,MAAoC,CAAA,GAAG,GAAA,YAAA,CAAA,EAAA,WAAA,UAAA,CAAA,+BAAA,CAAA,CAAA;CAMjD,eAAe,MAAqB,MAAK,GAAA,YAAA,CAAA,EAAA,WAAA,eAAA,CAAA,+BAAA,CAAA,CAAA;CAE/B,uBAAuB,YAAY,KAAK,cAAc,mBAAmB,SAAS;CAG5F,YAAY,MAA4B,MAAK,GAAA,YAAA,CAAA,EAAA,WAAA,YAAA,CAAA,+BAAA,CAAA,CAAA;CAG7C,OAAO,MAAM,OAAM,GAAA,YAAA,CAAA,EAAA,WAAA,OAAA,CAAA,+BAAA,CAAA,CAAA;CAGnB,OAAO,MAAkB,OAAM,GAAA,YAAA,CAAA,EAAA,WAAA,OAAA,CAAA,+BAAA,CAAA,CAAA;CAG/B,WAAW,MAAM,OAAK;EAAA,GAAA,YAAA,EAAA,WAAA,WAAA,+BAAA,CAAA;EAAI,WAAW;CAAqB,CAAA;CAO1D,WAAW,MAAM,OAAK;EAAA,GAAA,YAAA,EAAA,WAAA,WAAA,+BAAA,CAAA;EAAI,WAAW;CAAqB,CAAA;CAG1D,OAAO,OAAM;CAGH,SAAS,sBAAsB,EAAE;CAEjC,YAAY,UAAyC,WAAU,GAAA,YAAA,CAAA,EAAA,WAAA,YAAA,CAAA,+BA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ed-dial.ts","../../../projects/lib/speed-dial/speed-dial.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 ViewEncapsulation,\n computed,\n effect,\n inject,\n input,\n model,\n output,\n viewChild,\n} from '@angular/core';\n\nimport { useI18nText } from 'ngwr/i18n';\nimport { WrIcon, type WrIconName } from 'ngwr/icon';\nimport { wrCheckStyles } from 'ngwr/utils';\n\nimport type { WrSpeedDialAction, WrSpeedDialDirection } from './types';\n\nlet menuUid = 0;\n\n/**\n * Floating action button that expands into a fan of secondary actions on click.\n * Place inside a positioned container or near `position: fixed` — the component\n * itself doesn't pin to the viewport.\n *\n * @example\n * ```html\n * <wr-speed-dial\n * [actions]=\"[\n * { id: 'new', label: 'New', icon: 'add' },\n * { id: 'edit', label: 'Edit', icon: 'cog' }\n * ]\"\n * (pick)=\"onPick($event)\"\n * />\n * ```\n *\n * @see https://ngwr.dev/reference/components/speed-dial\n */\n@Component({\n selector: 'wr-speed-dial',\n templateUrl: './speed-dial.html',\n encapsulation: ViewEncapsulation.None,\n host: { class: 'wr-speed-dial', '[class]': 'classes()', '(keydown)': 'onKeydown($event)' },\n imports: [WrIcon],\n})\nexport class WrSpeedDial {\n /**\n * The buttons that fan out when the dial opens, in order from the trigger\n * outwards. Each needs a label: it is the accessible name as well as the tooltip.\n */\n readonly actions = input<readonly WrSpeedDialAction[]>([]);\n\n /**\n * Accessible name of the trigger. Falls back to `speedDial.label`, then\n * `'Actions'` — the trigger is icon-only, so without this it has no name at all.\n */\n readonly triggerLabel = input<string | null>(null);\n\n protected readonly resolvedTriggerLabel = useI18nText(this.triggerLabel, 'speedDial.label', 'Actions');\n\n /** Direction the actions fan out. @default 'up' */\n readonly direction = input<WrSpeedDialDirection>('up');\n\n /** Two-way bindable open state. @default false */\n readonly open = model(false);\n\n /** Icon for the main trigger button. @default 'add' */\n readonly icon = input<WrIconName>('add');\n\n /** Disable interaction. @default false */\n readonly disabled = input(false, { transform: coerceBooleanProperty });\n\n /**\n * Pad the host toward the dial `direction` with `env(safe-area-inset-*)`.\n * Only matters when the consumer pins the dial to that edge of the\n * viewport; otherwise it has no effect. @default false\n */\n readonly safeArea = input(false, { transform: coerceBooleanProperty });\n\n /** Fires when the user picks one of the actions. */\n readonly pick = output<WrSpeedDialAction>();\n\n /** Id the trigger's `aria-controls` points at. */\n protected readonly menuId = `wr-speed-dial-menu-${++menuUid}`;\n\n protected readonly triggerEl = viewChild<ElementRef<HTMLButtonElement>>('trigger');\n\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\n\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('speed-dial');\n // A disabled trigger cannot be pressed, and the trigger is the only way to close\n // the dial — so being disabled while open left it fanned out with no way back.\n effect(() => {\n if (this.disabled() && this.open()) this.open.set(false);\n });\n }\n\n protected readonly classes = computed(() => {\n const parts = [`wr-speed-dial--${this.direction()}`];\n if (this.open()) parts.push('wr-speed-dial--open');\n if (this.disabled()) parts.push('wr-speed-dial--disabled');\n if (this.safeArea()) parts.push('wr-speed-dial--safe-area');\n return parts.join(' ');\n });\n\n protected onTrigger(): void {\n if (this.disabled()) return;\n this.open.update(v => !v);\n }\n\n protected onPick(action: WrSpeedDialAction): void {\n if (this.disabled()) return;\n this.open.set(false);\n // Take the focus back before the action goes — the collapsed wrapper turns\n // `visibility: hidden`, and a browser blurs an element it hides, so the caret\n // landed on `<body>` and the next Tab restarted at the top of the document.\n // Escape already did this; the SUCCESS path did not.\n //\n // Before the emit, not after: `pick` is where a consumer opens a dialog or\n // navigates, and such a handler moves focus itself — focusing afterwards would\n // yank the caret back onto the trigger. `wr-dropdown` sequences it the same way.\n //\n // Only when the caret is inside the dial: Safari does not focus a button on\n // mouse-down, so an unguarded call would steal it from wherever the user is.\n if (this.host.nativeElement.contains(this.host.nativeElement.ownerDocument.activeElement)) {\n this.triggerEl()?.nativeElement.focus();\n }\n this.pick.emit(action);\n }\n\n /**\n * Escape closes the dial and hands the caret back. The actions are ordinary buttons\n * in the tab order, so without this a keyboard user who opened the dial had to tab\n * through every action to leave it.\n */\n protected onKeydown(event: KeyboardEvent): void {\n if (event.key !== 'Escape' || !this.open()) return;\n event.preventDefault();\n this.open.set(false);\n this.triggerEl()?.nativeElement.focus();\n }\n\n /**\n * First GLYPH of the label, for an action with no icon. `charAt(0)` returns one\n * UTF-16 code unit, which cuts an astral character (an emoji) in half and renders a\n * replacement character.\n */\n protected initial(label: string): string {\n return [...label][0] ?? '';\n }\n}\n\nexport type { WrSpeedDialAction, WrSpeedDialDirection } from './types';\n","<button\n #trigger\n type=\"button\"\n class=\"wr-speed-dial__trigger\"\n [attr.aria-expanded]=\"open()\"\n [attr.aria-controls]=\"menuId\"\n [attr.aria-label]=\"resolvedTriggerLabel()\"\n [disabled]=\"disabled()\"\n (click)=\"onTrigger()\"\n>\n <wr-icon [name]=\"icon()\" />\n</button>\n\n<!--\n A LIST of buttons, deliberately not a `role=\"menu\"`. The dial used to announce\n aria-haspopup=\"menu\" over role=\"menuitem\" buttons while handling no menu key at\n all — no arrows, no Home/End, no focus moving in on open — and the actions were\n N tab stops rather than the pattern's one. That role also puts a screen reader\n into focus mode, so the arrow keys it promises stop reading the page and then do\n nothing here. The structure now says what the component does: a disclosure\n button (aria-expanded / aria-controls) revealing ordinary buttons that Tab\n reaches and Enter activates, with Escape as the way back.\n\n `role=\"list\"` is written out because `list-style: none` (styles/_index.scss)\n drops the implicit list semantics in Safari.\n-->\n<ul class=\"wr-speed-dial__actions\" role=\"list\" [attr.id]=\"menuId\">\n @for (action of actions(); track action.id) {\n <li class=\"wr-speed-dial__action-wrap\" [style.--wr-speed-dial-i]=\"$index + 1\">\n <button\n type=\"button\"\n class=\"wr-speed-dial__action\"\n [attr.aria-label]=\"action.label\"\n [title]=\"action.label\"\n [disabled]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AA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,cAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,WAAA,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,GAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,YAAA;EAAA,CAAA;EAAA,MAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,UAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,UAAA,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,MAAA;EAAA,CAAA;EAAA,WAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,WAAS,EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;CAAA;AAAA,CAAA"}
@@ -17,7 +17,7 @@ var WrSpinner = class WrSpinner {
17
17
  resolvedAriaLabel = useI18nText(this.ariaLabel, "spinner.label", "Loading");
18
18
  classes = computed(() => {
19
19
  const size = this.size();
20
- return size === "md" ? "wr-spinner" : `wr-spinner wr-spinner--${size}`;
20
+ return size === "md" ? "" : `wr-spinner--${size}`;
21
21
  }, ...ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []);
22
22
  static ɵfac = i0.ɵɵngDeclareFactory({
23
23
  minVersion: "12.0.0",
@@ -54,7 +54,8 @@ var WrSpinner = class WrSpinner {
54
54
  properties: {
55
55
  "attr.aria-label": "resolvedAriaLabel()",
56
56
  "class": "classes()"
57
- }
57
+ },
58
+ classAttribute: "wr-spinner"
58
59
  },
59
60
  ngImport: i0,
60
61
  template: "<svg viewBox=\"0 0 50 50\" aria-hidden=\"true\">\n <circle class=\"wr-spinner__path\" cx=\"25\" cy=\"25\" r=\"20\" fill=\"none\" stroke-width=\"5\" />\n</svg>\n",
@@ -74,6 +75,7 @@ i0.ɵɵngDeclareClassMetadata({
74
75
  host: {
75
76
  role: "status",
76
77
  "[attr.aria-label]": "resolvedAriaLabel()",
78
+ class: "wr-spinner",
77
79
  "[class]": "classes()"
78
80
  },
79
81
  template: "<svg viewBox=\"0 0 50 50\" aria-hidden=\"true\">\n <circle class=\"wr-spinner__path\" cx=\"25\" cy=\"25\" r=\"20\" fill=\"none\" stroke-width=\"5\" />\n</svg>\n"
@@ -1 +1 @@
1
- {"version":3,"file":"ngwr-spinner.mjs","names":[],"sources":["../../../projects/lib/spinner/spinner.ts","../../../projects/lib/spinner/spinner.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 { Component, ViewEncapsulation, computed, input } from '@angular/core';\n\nimport { useI18nText } from 'ngwr/i18n';\nimport { wrCheckStyles } from 'ngwr/utils';\n\nimport type { WrSpinnerSize } from './types';\n\n/**\n * Inline loading indicator.\n *\n * Inherits color from the surrounding text (uses `currentColor`).\n *\n * @example\n * ```html\n * <wr-spinner />\n * <wr-spinner size=\"lg\" />\n * ```\n *\n * @see https://ngwr.dev/reference/components/spinner\n */\n@Component({\n selector: 'wr-spinner',\n templateUrl: './spinner.html',\n encapsulation: ViewEncapsulation.None,\n host: {\n role: 'status',\n '[attr.aria-label]': 'resolvedAriaLabel()',\n '[class]': 'classes()',\n },\n})\nexport class WrSpinner {\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('spinner');\n }\n\n /**\n * Size variant. Em-based — scales with surrounding font-size.\n *\n * @default 'md'\n */\n readonly size = input<WrSpinnerSize>('md');\n\n /**\n * Accessible name for the live region. Falls back to `spinner.label`, then\n * `'Loading'` — which the host used to carry as a hard-coded attribute, while\n * the catalog had the translated key for it all along.\n */\n readonly ariaLabel = input<string | null>(null);\n\n protected readonly resolvedAriaLabel = useI18nText(this.ariaLabel, 'spinner.label', 'Loading');\n\n protected readonly classes = computed(() => {\n const size = this.size();\n return size === 'md' ? 'wr-spinner' : `wr-spinner wr-spinner--${size}`;\n });\n}\n","<svg viewBox=\"0 0 50 50\" aria-hidden=\"true\">\n <circle class=\"wr-spinner__path\" cx=\"25\" cy=\"25\" r=\"20\" fill=\"none\" stroke-width=\"5\" />\n</svg>\n"],"mappings":";;;;;;;;;;AAqCA,IAAa,YAAb,MAAa,UAAS;CACpB,cAAA;EACE,IAAI,OAAO,cAAc,eAAe,WAAW,cAAc,SAAS;CAC5E;CAOS,OAAO,MAAqB,MAAK,GAAA,YAAA,CAAA,EAAA,WAAA,OAAA,CAAA,+BAAA,CAAA,CAAA;CAOjC,YAAY,MAAqB,MAAK,GAAA,YAAA,CAAA,EAAA,WAAA,YAAA,CAAA,+BAAA,CAAA,CAAA;CAE5B,oBAAoB,YAAY,KAAK,WAAW,iBAAiB,SAAS;CAE1E,UAAU,eAAc;EACzC,MAAM,OAAO,KAAK,KAAI;EACtB,OAAO,SAAS,OAAO,eAAe,0BAA0B;CAClE,GAAE,GAAA,YAAA,CAAA,EAAA,WAAA,UAAA,CAAA,+BAAA,CAAA,CAAA;CAxBS,OAAA,OAAA,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,MAAA;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;GAAA,YAAA,EAAA,QAAA,SAAA;GAAA,YAAA;IAAA,mBAAA;IAAA,SAAA;GAAA;EAAA;EAAA,UAAA;EAAA,UCrCtB;EAGA,eAAA,GAAA,kBAAA;CAAA,CAAA;;ADkCa,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAS,YAAA,CAAA;EAVrB,MAAA;EACW,MAAA,CAAA;GAAA,UAAA;GAAY,eAEP,kBAAkB;GAAI,MAC/B;IACJ,MAAM;IACN,qBAAqB;IACrB,WAAW;GACZ;GAAA,UAAA;EAAA,CAAA"}
1
+ {"version":3,"file":"ngwr-spinner.mjs","names":[],"sources":["../../../projects/lib/spinner/spinner.ts","../../../projects/lib/spinner/spinner.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 { Component, ViewEncapsulation, computed, input } from '@angular/core';\n\nimport { useI18nText } from 'ngwr/i18n';\nimport { wrCheckStyles } from 'ngwr/utils';\n\nimport type { WrSpinnerSize } from './types';\n\n/**\n * Inline loading indicator.\n *\n * Inherits color from the surrounding text (uses `currentColor`).\n *\n * @example\n * ```html\n * <wr-spinner />\n * <wr-spinner size=\"lg\" />\n * ```\n *\n * @see https://ngwr.dev/reference/components/spinner\n */\n@Component({\n selector: 'wr-spinner',\n templateUrl: './spinner.html',\n encapsulation: ViewEncapsulation.None,\n host: {\n role: 'status',\n '[attr.aria-label]': 'resolvedAriaLabel()',\n class: 'wr-spinner',\n '[class]': 'classes()',\n },\n})\nexport class WrSpinner {\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('spinner');\n }\n\n /**\n * Size variant. Em-based — scales with surrounding font-size.\n *\n * @default 'md'\n */\n readonly size = input<WrSpinnerSize>('md');\n\n /**\n * Accessible name for the live region. Falls back to `spinner.label`, then\n * `'Loading'` — which the host used to carry as a hard-coded attribute, while\n * the catalog had the translated key for it all along.\n */\n readonly ariaLabel = input<string | null>(null);\n\n protected readonly resolvedAriaLabel = useI18nText(this.ariaLabel, 'spinner.label', 'Loading');\n\n protected readonly classes = computed(() => {\n const size = this.size();\n return size === 'md' ? '' : `wr-spinner--${size}`;\n });\n}\n","<svg viewBox=\"0 0 50 50\" aria-hidden=\"true\">\n <circle class=\"wr-spinner__path\" cx=\"25\" cy=\"25\" r=\"20\" fill=\"none\" stroke-width=\"5\" />\n</svg>\n"],"mappings":";;;;;;;;;;AAsCA,IAAa,YAAb,MAAa,UAAS;CACpB,cAAA;EACE,IAAI,OAAO,cAAc,eAAe,WAAW,cAAc,SAAS;CAC5E;CAOS,OAAO,MAAqB,MAAK,GAAA,YAAA,CAAA,EAAA,WAAA,OAAA,CAAA,+BAAA,CAAA,CAAA;CAOjC,YAAY,MAAqB,MAAK,GAAA,YAAA,CAAA,EAAA,WAAA,YAAA,CAAA,+BAAA,CAAA,CAAA;CAE5B,oBAAoB,YAAY,KAAK,WAAW,iBAAiB,SAAS;CAE1E,UAAU,eAAc;EACzC,MAAM,OAAO,KAAK,KAAI;EACtB,OAAO,SAAS,OAAO,KAAK,eAAe;CAC7C,GAAE,GAAA,YAAA,CAAA,EAAA,WAAA,UAAA,CAAA,+BAAA,CAAA,CAAA;CAxBS,OAAA,OAAA,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,MAAA;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;GAAA,YAAA,EAAA,QAAA,SAAA;GAAA,YAAA;IAAA,mBAAA;IAAA,SAAA;GAAA;GAAA,gBAAA;EAAA;EAAA,UAAA;EAAA,UCtCtB;EAGA,eAAA,GAAA,kBAAA;CAAA,CAAA;;ADmCa,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAS,YAAA,CAAA;EAXrB,MAAA;EACW,MAAA,CAAA;GAAA,UAAA;GAAY,eAEP,kBAAkB;GAAI,MAC/B;IACJ,MAAM;IACN,qBAAqB;IACrB,OAAO;IACP,WAAW;GACZ;GAAA,UAAA;EAAA,CAAA"}
@@ -1,3 +1,4 @@
1
+ import { n as wrEndSeparatorDrag, r as wrSeparatorKeyMove, t as wrBeginSeparatorDrag } from "./internal-CVLvP9b_.mjs";
1
2
  import * as i0 from "@angular/core";
2
3
  import { Component, ElementRef, ViewEncapsulation, computed, effect, inject, input, model } from "@angular/core";
3
4
  import { coerceBooleanProperty, coerceNumberProperty } from "@angular/cdk/coercion";
@@ -46,12 +47,7 @@ var WrSplitter = class WrSplitter {
46
47
  endStyle = computed(() => `${100 - this.position()}%`, ...ngDevMode ? [{ debugName: "endStyle" }] : /* istanbul ignore next */ []);
47
48
  onPointerDown(event) {
48
49
  if (this.disabled()) return;
49
- if (event.button !== 0 || !event.isPrimary) return;
50
- event.preventDefault();
51
- this.dragging = true;
52
- const handle = event.currentTarget;
53
- handle.setPointerCapture(event.pointerId);
54
- handle.focus();
50
+ this.dragging = wrBeginSeparatorDrag(event);
55
51
  }
56
52
  onPointerMove(event) {
57
53
  if (!this.dragging) return;
@@ -62,23 +58,17 @@ var WrSplitter = class WrSplitter {
62
58
  onPointerUp(event) {
63
59
  if (!this.dragging) return;
64
60
  this.dragging = false;
65
- event.currentTarget.releasePointerCapture(event.pointerId);
61
+ wrEndSeparatorDrag(event);
66
62
  }
67
63
  onKeydown(event) {
68
64
  if (this.disabled()) return;
69
- const step = event.shiftKey ? 10 : 1;
70
- const position = wrRound(this.position());
71
- let next = null;
72
- if (this.orientation() === "horizontal") {
73
- const inline = this.isRtl() ? -step : step;
74
- if (event.key === "ArrowLeft") next = position - inline;
75
- else if (event.key === "ArrowRight") next = position + inline;
76
- } else if (event.key === "ArrowUp") next = position - step;
77
- else if (event.key === "ArrowDown") next = position + step;
78
- if (event.key === "Home") next = this.minPosition();
79
- else if (event.key === "End") next = this.maxPosition();
80
- if (next === null) return;
65
+ const move = wrSeparatorKeyMove(event, this.orientation() === "horizontal" ? "inline" : "block", this.isRtl());
66
+ if (move === null) return;
81
67
  event.preventDefault();
68
+ let next;
69
+ if (move === "min") next = this.minPosition();
70
+ else if (move === "max") next = this.maxPosition();
71
+ else next = wrRound(this.position()) + move * (event.shiftKey ? 10 : 1);
82
72
  this.position.set(wrClamp(next, this.minPosition(), this.maxPosition()));
83
73
  }
84
74
  inlineFraction(clientX, rect) {
@@ -146,7 +136,10 @@ var WrSplitter = class WrSplitter {
146
136
  }
147
137
  },
148
138
  outputs: { position: "positionChange" },
149
- host: { properties: { "class": "classes()" } },
139
+ host: {
140
+ properties: { "class": "classes()" },
141
+ classAttribute: "wr-splitter"
142
+ },
150
143
  ngImport: i0,
151
144
  template: "<div class=\"wr-splitter__pane wr-splitter__pane--start\" [style.flex-basis]=\"startStyle()\">\n <ng-content select=\"[wrSplitterStart]\" />\n</div>\n\n<!-- Roving focus + arrow keys for keyboard resizing. -->\n<div\n class=\"wr-splitter__divider\"\n role=\"separator\"\n [attr.aria-label]=\"resolvedDividerLabel()\"\n [attr.aria-orientation]=\"orientation() === 'horizontal' ? 'vertical' : 'horizontal'\"\n [attr.aria-valuemin]=\"minPosition()\"\n [attr.aria-valuemax]=\"maxPosition()\"\n [attr.aria-valuenow]=\"position()\"\n [attr.aria-disabled]=\"disabled() || null\"\n [attr.tabindex]=\"disabled() ? -1 : 0\"\n (pointerdown)=\"onPointerDown($event)\"\n (pointermove)=\"onPointerMove($event)\"\n (pointerup)=\"onPointerUp($event)\"\n (pointercancel)=\"onPointerUp($event)\"\n (keydown)=\"onKeydown($event)\"\n>\n <span class=\"wr-splitter__handle\" aria-hidden=\"true\"></span>\n</div>\n\n<div class=\"wr-splitter__pane wr-splitter__pane--end\" [style.flex-basis]=\"endStyle()\">\n <ng-content select=\"[wrSplitterEnd]\" />\n</div>\n",
152
145
  encapsulation: i0.ViewEncapsulation.None
@@ -162,7 +155,10 @@ i0.ɵɵngDeclareClassMetadata({
162
155
  args: [{
163
156
  selector: "wr-splitter",
164
157
  encapsulation: ViewEncapsulation.None,
165
- host: { "[class]": "classes()" },
158
+ host: {
159
+ class: "wr-splitter",
160
+ "[class]": "classes()"
161
+ },
166
162
  template: "<div class=\"wr-splitter__pane wr-splitter__pane--start\" [style.flex-basis]=\"startStyle()\">\n <ng-content select=\"[wrSplitterStart]\" />\n</div>\n\n<!-- Roving focus + arrow keys for keyboard resizing. -->\n<div\n class=\"wr-splitter__divider\"\n role=\"separator\"\n [attr.aria-label]=\"resolvedDividerLabel()\"\n [attr.aria-orientation]=\"orientation() === 'horizontal' ? 'vertical' : 'horizontal'\"\n [attr.aria-valuemin]=\"minPosition()\"\n [attr.aria-valuemax]=\"maxPosition()\"\n [attr.aria-valuenow]=\"position()\"\n [attr.aria-disabled]=\"disabled() || null\"\n [attr.tabindex]=\"disabled() ? -1 : 0\"\n (pointerdown)=\"onPointerDown($event)\"\n (pointermove)=\"onPointerMove($event)\"\n (pointerup)=\"onPointerUp($event)\"\n (pointercancel)=\"onPointerUp($event)\"\n (keydown)=\"onKeydown($event)\"\n>\n <span class=\"wr-splitter__handle\" aria-hidden=\"true\"></span>\n</div>\n\n<div class=\"wr-splitter__pane wr-splitter__pane--end\" [style.flex-basis]=\"endStyle()\">\n <ng-content select=\"[wrSplitterEnd]\" />\n</div>\n"
167
163
  }]
168
164
  }],
@@ -1 +1 @@
1
- {"version":3,"file":"ngwr-splitter.mjs","names":[],"sources":["../../../projects/lib/splitter/splitter.ts","../../../projects/lib/splitter/splitter.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 { Directionality } from '@angular/cdk/bidi';\nimport { coerceBooleanProperty, coerceNumberProperty } from '@angular/cdk/coercion';\nimport { Component, ElementRef, ViewEncapsulation, computed, effect, inject, input, model } from '@angular/core';\n\nimport { useI18nText } from 'ngwr/i18n';\nimport { wrClamp, wrRound, wrCheckStyles } from 'ngwr/utils';\n\n/**\n * Resizable two-pane splitter. Project two pieces of content via\n * `[wrSplitterStart]` and `[wrSplitterEnd]`; the user drags the divider\n * to reallocate space between them.\n *\n * @example\n * ```html\n * <wr-splitter [(position)]=\"pos\">\n * <div wrSplitterStart>Files</div>\n * <div wrSplitterEnd>Editor</div>\n * </wr-splitter>\n *\n * <wr-splitter orientation=\"vertical\" [minPosition]=\"20\" [maxPosition]=\"80\">\n * <div wrSplitterStart>Preview</div>\n * <div wrSplitterEnd>Logs</div>\n * </wr-splitter>\n * ```\n *\n * @see https://ngwr.dev/reference/components/splitter\n */\n@Component({\n selector: 'wr-splitter',\n templateUrl: './splitter.html',\n encapsulation: ViewEncapsulation.None,\n host: { '[class]': 'classes()' },\n})\nexport class WrSplitter {\n /** Position of the divider as a percentage (0–100). Two-way bindable. @default 50 */\n readonly position = model(50);\n\n /**\n * Divider direction:\n * - `'horizontal'` — vertical divider, drags L/R (panes side by side).\n * - `'vertical'` — horizontal divider, drags U/D (panes stacked).\n * @default 'horizontal'\n */\n readonly orientation = input<'horizontal' | 'vertical'>('horizontal');\n\n /** Minimum allowed position. @default 0 */\n readonly minPosition = input(0, { transform: (v: unknown): number => coerceNumberProperty(v, 0) });\n\n /** Maximum allowed position. @default 100 */\n readonly maxPosition = input(100, { transform: (v: unknown): number => coerceNumberProperty(v, 100) });\n\n /** Disable dragging. @default false */\n readonly disabled = input(false, { transform: coerceBooleanProperty });\n\n /**\n * Accessible name of the divider. A focusable `role=\"separator\"` is an\n * interactive widget, so it needs one — without it a screen reader reaching the\n * divider announces nothing but \"separator\" and its number. Falls back to\n * `splitter.divider`.\n */\n readonly dividerLabel = input<string | null>(null);\n\n protected readonly resolvedDividerLabel = useI18nText(this.dividerLabel, 'splitter.divider', 'Resize panes');\n\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\n // Optional on purpose: `Directionality` is root-provided, so a consumer never has to\n // supply it — and a bare `TestBed` does not either.\n private readonly dir = inject(Directionality, { optional: true });\n private dragging = false;\n\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('splitter');\n // `position` is a `model`, so `[(position)]` and a restored layout write into it\n // directly; only the drag and the arrows clamped. Left alone, an out-of-range\n // write reached the DOM as `aria-valuenow=\"150\"` against a `valuemax` of 100 and\n // sized a pane at `150%`.\n effect(() => {\n const clamped = wrClamp(this.position(), this.minPosition(), this.maxPosition());\n if (clamped !== this.position()) this.position.set(clamped);\n });\n }\n\n protected readonly classes = computed(() => {\n const parts = ['wr-splitter', `wr-splitter--${this.orientation()}`];\n if (this.disabled()) parts.push('wr-splitter--disabled');\n return parts.join(' ');\n });\n\n protected readonly startStyle = computed(() => `${this.position()}%`);\n protected readonly endStyle = computed(() => `${100 - this.position()}%`);\n\n // Drag\n\n protected onPointerDown(event: PointerEvent): void {\n if (this.disabled()) return;\n // Any pointerdown used to start a drag, so holding the RIGHT button over the\n // divider and moving resized the panes; the same guard keeps a second finger\n // from taking over a drag already in progress.\n if (event.button !== 0 || !event.isPrimary) return;\n event.preventDefault();\n this.dragging = true;\n const handle = event.currentTarget as HTMLElement;\n handle.setPointerCapture(event.pointerId);\n // `preventDefault` above also suppresses the click's default focus, so without\n // this the arrows did nothing after a mouse drag until the user found the\n // divider again with Tab. `wr-slider` focuses its thumb for the same reason.\n handle.focus();\n }\n\n protected onPointerMove(event: PointerEvent): void {\n if (!this.dragging) return;\n const rect = this.host.nativeElement.getBoundingClientRect();\n const raw =\n this.orientation() === 'horizontal'\n ? this.inlineFraction(event.clientX, rect) * 100\n : // The vertical split is laid out on the BLOCK axis, which `dir` does not\n // touch — measured from the top in both directions.\n ((event.clientY - rect.top) / rect.height) * 100;\n // To a tenth of a percent — about a pixel on a full-width split. The raw\n // quotient reached `aria-valuenow` and `[(position)]` as `29.99999822054938`,\n // read out digit by digit and handed to the host to persist.\n this.position.set(wrClamp(wrRound(raw, 1), this.minPosition(), this.maxPosition()));\n }\n\n protected onPointerUp(event: PointerEvent): void {\n if (!this.dragging) return;\n this.dragging = false;\n (event.currentTarget as HTMLElement).releasePointerCapture(event.pointerId);\n }\n\n protected onKeydown(event: KeyboardEvent): void {\n if (this.disabled()) return;\n const step = event.shiftKey ? 10 : 1;\n // An arrow step lands on a whole number, so the keys after a drag do not\n // carry the drag's fraction along (`30.4` stepped to `31.4`, `32.4`, …).\n // Home and End below are the bounds themselves, whatever they are.\n const position = wrRound(this.position());\n let next: number | null = null;\n if (this.orientation() === 'horizontal') {\n // Arrows follow the VISUAL axis (WAI-ARIA APG). Under `dir=\"rtl\"` the start pane\n // is the one on the RIGHT, so the visual right is the low end of the range and\n // ArrowRight has to shrink the position rather than grow it — otherwise the\n // divider walks away from the key the user is pressing.\n const inline = this.isRtl() ? -step : step;\n if (event.key === 'ArrowLeft') next = position - inline;\n else if (event.key === 'ArrowRight') next = position + inline;\n } else {\n // Block axis: unaffected by `dir`.\n if (event.key === 'ArrowUp') next = position - step;\n else if (event.key === 'ArrowDown') next = position + step;\n }\n // Home/End are semantic — first/last, not left/right — so they never mirror.\n if (event.key === 'Home') next = this.minPosition();\n else if (event.key === 'End') next = this.maxPosition();\n if (next === null) return;\n event.preventDefault();\n this.position.set(wrClamp(next, this.minPosition(), this.maxPosition()));\n }\n\n /**\n * Fraction of the host's width measured from the INLINE-START edge — the left edge in\n * LTR, the right edge in RTL, which is where `flex-direction: row` puts the start pane\n * whose size `position` is. Counted from `rect.left` in both, a drag under `dir=\"rtl\"`\n * read 0 where the start pane was widest and inverted the whole gesture.\n */\n private inlineFraction(clientX: number, rect: DOMRect): number {\n return this.isRtl() ? (rect.right - clientX) / rect.width : (clientX - rect.left) / rect.width;\n }\n\n /**\n * Read per event rather than cached: nothing this component renders is derived from the\n * direction — `flex-direction: row` mirrors the panes on its own — so there is no stale\n * value for `Directionality.change` to invalidate.\n */\n private isRtl(): boolean {\n return this.dir?.value === 'rtl';\n }\n}\n","<div class=\"wr-splitter__pane wr-splitter__pane--start\" [style.flex-basis]=\"startStyle()\">\n <ng-content select=\"[wrSplitterStart]\" />\n</div>\n\n<!-- Roving focus + arrow keys for keyboard resizing. -->\n<div\n class=\"wr-splitter__divider\"\n role=\"separator\"\n [attr.aria-label]=\"resolvedDividerLabel()\"\n [attr.aria-orientation]=\"orientation() === 'horizontal' ? 'vertical' : 'horizontal'\"\n [attr.aria-valuemin]=\"minPosition()\"\n [attr.aria-valuemax]=\"maxPosition()\"\n [attr.aria-valuenow]=\"position()\"\n [attr.aria-disabled]=\"disabled() || null\"\n [attr.tabindex]=\"disabled() ? -1 : 0\"\n (pointerdown)=\"onPointerDown($event)\"\n (pointermove)=\"onPointerMove($event)\"\n (pointerup)=\"onPointerUp($event)\"\n (pointercancel)=\"onPointerUp($event)\"\n (keydown)=\"onKeydown($event)\"\n>\n <span class=\"wr-splitter__handle\" aria-hidden=\"true\"></span>\n</div>\n\n<div class=\"wr-splitter__pane wr-splitter__pane--end\" [style.flex-basis]=\"endStyle()\">\n <ng-content select=\"[wrSplitterEnd]\" />\n</div>\n"],"mappings":";;;;;;;;;;;;AAwCA,IAAa,aAAb,MAAa,WAAU;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A,YAAA,EAAA,SAAA,YAAA,EAAA;EAAA,UAAA;EAAA,UCxCvB;EA2BA,eAAA,GAAA,kBAAA;CAAA,CAAA;;ADaa,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAU,YAAA,CAAA;EANtB,MAAA;EACW,MAAA,CAAA;GAAA,UAAA;GAAa,eAER,kBAAkB;GAAI,MAC/B,EAAE,WAAW,YAAW;GAAE,UAAA;EAAA,CAAA"}
1
+ {"version":3,"file":"ngwr-splitter.mjs","names":[],"sources":["../../../projects/lib/splitter/splitter.ts","../../../projects/lib/splitter/splitter.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 { Directionality } from '@angular/cdk/bidi';\nimport { coerceBooleanProperty, coerceNumberProperty } from '@angular/cdk/coercion';\nimport { Component, ElementRef, ViewEncapsulation, computed, effect, inject, input, model } from '@angular/core';\n\nimport { useI18nText } from 'ngwr/i18n';\nimport { wrClamp, wrRound, wrCheckStyles } from 'ngwr/utils';\n\nimport { wrBeginSeparatorDrag, wrEndSeparatorDrag, wrSeparatorKeyMove } from './internal';\n\n/**\n * Resizable two-pane splitter. Project two pieces of content via\n * `[wrSplitterStart]` and `[wrSplitterEnd]`; the user drags the divider\n * to reallocate space between them.\n *\n * @example\n * ```html\n * <wr-splitter [(position)]=\"pos\">\n * <div wrSplitterStart>Files</div>\n * <div wrSplitterEnd>Editor</div>\n * </wr-splitter>\n *\n * <wr-splitter orientation=\"vertical\" [minPosition]=\"20\" [maxPosition]=\"80\">\n * <div wrSplitterStart>Preview</div>\n * <div wrSplitterEnd>Logs</div>\n * </wr-splitter>\n * ```\n *\n * @see https://ngwr.dev/reference/components/splitter\n */\n@Component({\n selector: 'wr-splitter',\n templateUrl: './splitter.html',\n encapsulation: ViewEncapsulation.None,\n host: { class: 'wr-splitter', '[class]': 'classes()' },\n})\nexport class WrSplitter {\n /** Position of the divider as a percentage (0–100). Two-way bindable. @default 50 */\n readonly position = model(50);\n\n /**\n * Divider direction:\n * - `'horizontal'` — vertical divider, drags L/R (panes side by side).\n * - `'vertical'` — horizontal divider, drags U/D (panes stacked).\n * @default 'horizontal'\n */\n readonly orientation = input<'horizontal' | 'vertical'>('horizontal');\n\n /** Minimum allowed position. @default 0 */\n readonly minPosition = input(0, { transform: (v: unknown): number => coerceNumberProperty(v, 0) });\n\n /** Maximum allowed position. @default 100 */\n readonly maxPosition = input(100, { transform: (v: unknown): number => coerceNumberProperty(v, 100) });\n\n /** Disable dragging. @default false */\n readonly disabled = input(false, { transform: coerceBooleanProperty });\n\n /**\n * Accessible name of the divider. A focusable `role=\"separator\"` is an\n * interactive widget, so it needs one — without it a screen reader reaching the\n * divider announces nothing but \"separator\" and its number. Falls back to\n * `splitter.divider`.\n */\n readonly dividerLabel = input<string | null>(null);\n\n protected readonly resolvedDividerLabel = useI18nText(this.dividerLabel, 'splitter.divider', 'Resize panes');\n\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\n // Optional on purpose: `Directionality` is root-provided, so a consumer never has to\n // supply it — and a bare `TestBed` does not either.\n private readonly dir = inject(Directionality, { optional: true });\n private dragging = false;\n\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('splitter');\n // `position` is a `model`, so `[(position)]` and a restored layout write into it\n // directly; only the drag and the arrows clamped. Left alone, an out-of-range\n // write reached the DOM as `aria-valuenow=\"150\"` against a `valuemax` of 100 and\n // sized a pane at `150%`.\n effect(() => {\n const clamped = wrClamp(this.position(), this.minPosition(), this.maxPosition());\n if (clamped !== this.position()) this.position.set(clamped);\n });\n }\n\n protected readonly classes = computed(() => {\n const parts = ['wr-splitter', `wr-splitter--${this.orientation()}`];\n if (this.disabled()) parts.push('wr-splitter--disabled');\n return parts.join(' ');\n });\n\n protected readonly startStyle = computed(() => `${this.position()}%`);\n protected readonly endStyle = computed(() => `${100 - this.position()}%`);\n\n // Drag\n\n protected onPointerDown(event: PointerEvent): void {\n if (this.disabled()) return;\n this.dragging = wrBeginSeparatorDrag(event);\n }\n\n protected onPointerMove(event: PointerEvent): void {\n if (!this.dragging) return;\n const rect = this.host.nativeElement.getBoundingClientRect();\n const raw =\n this.orientation() === 'horizontal'\n ? this.inlineFraction(event.clientX, rect) * 100\n : // The vertical split is laid out on the BLOCK axis, which `dir` does not\n // touch — measured from the top in both directions.\n ((event.clientY - rect.top) / rect.height) * 100;\n // To a tenth of a percent — about a pixel on a full-width split. The raw\n // quotient reached `aria-valuenow` and `[(position)]` as `29.99999822054938`,\n // read out digit by digit and handed to the host to persist.\n this.position.set(wrClamp(wrRound(raw, 1), this.minPosition(), this.maxPosition()));\n }\n\n protected onPointerUp(event: PointerEvent): void {\n if (!this.dragging) return;\n this.dragging = false;\n wrEndSeparatorDrag(event);\n }\n\n protected onKeydown(event: KeyboardEvent): void {\n if (this.disabled()) return;\n const move = wrSeparatorKeyMove(event, this.orientation() === 'horizontal' ? 'inline' : 'block', this.isRtl());\n if (move === null) return;\n event.preventDefault();\n let next: number;\n if (move === 'min') next = this.minPosition();\n else if (move === 'max') next = this.maxPosition();\n // An arrow step lands on a whole number, so the keys after a drag do not\n // carry the drag's fraction along (`30.4` stepped to `31.4`, `32.4`, …).\n // Home and End above are the bounds themselves, whatever they are.\n else next = wrRound(this.position()) + move * (event.shiftKey ? 10 : 1);\n this.position.set(wrClamp(next, this.minPosition(), this.maxPosition()));\n }\n\n /**\n * Fraction of the host's width measured from the INLINE-START edge — the left edge in\n * LTR, the right edge in RTL, which is where `flex-direction: row` puts the start pane\n * whose size `position` is. Counted from `rect.left` in both, a drag under `dir=\"rtl\"`\n * read 0 where the start pane was widest and inverted the whole gesture.\n */\n private inlineFraction(clientX: number, rect: DOMRect): number {\n return this.isRtl() ? (rect.right - clientX) / rect.width : (clientX - rect.left) / rect.width;\n }\n\n /**\n * Read per event rather than cached: nothing this component renders is derived from the\n * direction — `flex-direction: row` mirrors the panes on its own — so there is no stale\n * value for `Directionality.change` to invalidate.\n */\n private isRtl(): boolean {\n return this.dir?.value === 'rtl';\n }\n}\n","<div class=\"wr-splitter__pane wr-splitter__pane--start\" [style.flex-basis]=\"startStyle()\">\n <ng-content select=\"[wrSplitterStart]\" />\n</div>\n\n<!-- Roving focus + arrow keys for keyboard resizing. -->\n<div\n class=\"wr-splitter__divider\"\n role=\"separator\"\n [attr.aria-label]=\"resolvedDividerLabel()\"\n [attr.aria-orientation]=\"orientation() === 'horizontal' ? 'vertical' : 'horizontal'\"\n [attr.aria-valuemin]=\"minPosition()\"\n [attr.aria-valuemax]=\"maxPosition()\"\n [attr.aria-valuenow]=\"position()\"\n [attr.aria-disabled]=\"disabled() || null\"\n [attr.tabindex]=\"disabled() ? -1 : 0\"\n (pointerdown)=\"onPointerDown($event)\"\n (pointermove)=\"onPointerMove($event)\"\n (pointerup)=\"onPointerUp($event)\"\n (pointercancel)=\"onPointerUp($event)\"\n (keydown)=\"onKeydown($event)\"\n>\n <span class=\"wr-splitter__handle\" aria-hidden=\"true\"></span>\n</div>\n\n<div class=\"wr-splitter__pane wr-splitter__pane--end\" [style.flex-basis]=\"endStyle()\">\n <ng-content select=\"[wrSplitterEnd]\" />\n</div>\n"],"mappings":";;;;;;;;;;;;;AA0CA,IAAa,aAAb,MAAa,WAAU;CAEZ,WAAW,MAAM,IAAG,GAAA,YAAA,CAAA,EAAA,WAAA,WAAA,CAAA,+BAAA,CAAA,CAAA;CAQpB,cAAc,MAAiC,cAAa,GAAA,YAAA,CAAA,EAAA,WAAA,cAAA,CAAA,+BAAA,CAAA,CAAA;CAG5D,cAAc,MAAM,GAAC;EAAA,GAAA,YAAA,EAAA,WAAA,cAAA,+BAAA,CAAA;EAAI,YAAY,MAAuB,qBAAqB,GAAG,CAAC;CAAC,CAAA;CAGtF,cAAc,MAAM,KAAG;EAAA,GAAA,YAAA,EAAA,WAAA,cAAA,+BAAA,CAAA;EAAI,YAAY,MAAuB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A;IAAA,mBAAA;GAAA;GAAA,aAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;GAAA,aAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;GAAA,aAAA;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,cAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;EAAA;EAAA,SAAA,EAAA,UAAA,iBAAA;EAAA,MAAA;GAAA,YAAA,EAAA,SAAA,YAAA;GAAA,gBAAA;EAAA;EAAA,UAAA;EAAA,UC1CvB;EA2BA,eAAA,GAAA,kBAAA;CAAA,CAAA;;ADea,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAU,YAAA,CAAA;EANtB,MAAA;EACW,MAAA,CAAA;GAAA,UAAA;GAAa,eAER,kBAAkB;GAAI,MAC/B;IAAE,OAAO;IAAe,WAAW;GAAW;GAAE,UAAA;EAAA,CAAA"}
@@ -178,7 +178,7 @@ var WrStepper = class WrStepper {
178
178
  optionalLabel = useI18nText(NO_OVERRIDE, "stepper.optional", "optional");
179
179
  completedLabel = useI18nText(NO_OVERRIDE, "stepper.completed", "completed");
180
180
  classes = computed(() => {
181
- const parts = ["wr-stepper", `wr-stepper--${this.orientation()}`];
181
+ const parts = [`wr-stepper--${this.orientation()}`];
182
182
  if (this.linear()) parts.push("wr-stepper--linear");
183
183
  if (this.responsive()) parts.push("wr-stepper--responsive");
184
184
  return parts.join(" ");
@@ -267,7 +267,10 @@ var WrStepper = class WrStepper {
267
267
  }
268
268
  },
269
269
  outputs: { active: "activeChange" },
270
- host: { properties: { "class": "classes()" } },
270
+ host: {
271
+ properties: { "class": "classes()" },
272
+ classAttribute: "wr-stepper"
273
+ },
271
274
  providers: [{
272
275
  provide: WR_STEPPER,
273
276
  useExisting: forwardRef(() => WrStepper)
@@ -292,7 +295,10 @@ i0.ɵɵngDeclareClassMetadata({
292
295
  args: [{
293
296
  selector: "wr-stepper",
294
297
  encapsulation: ViewEncapsulation.None,
295
- host: { "[class]": "classes()" },
298
+ host: {
299
+ class: "wr-stepper",
300
+ "[class]": "classes()"
301
+ },
296
302
  providers: [{
297
303
  provide: WR_STEPPER,
298
304
  useExisting: forwardRef(() => WrStepper)