ngwr 16.7.0 → 16.8.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 (167) hide show
  1. package/charts/donut-chart/styles/_index.scss +9 -3
  2. package/charts/meter-group/styles/_index.scss +8 -1
  3. package/charts/sparkline/styles/_index.scss +6 -3
  4. package/checkbox/styles/_index.scss +4 -0
  5. package/command-palette/styles/_index.scss +10 -0
  6. package/fesm2022/ngwr-charts-calendar-heatmap.mjs +3 -1
  7. package/fesm2022/ngwr-charts-calendar-heatmap.mjs.map +1 -1
  8. package/fesm2022/ngwr-charts-core.mjs +17 -0
  9. package/fesm2022/ngwr-charts-core.mjs.map +1 -1
  10. package/fesm2022/ngwr-charts-donut-chart-testing.mjs +27 -0
  11. package/fesm2022/ngwr-charts-donut-chart-testing.mjs.map +1 -1
  12. package/fesm2022/ngwr-charts-donut-chart.mjs +54 -6
  13. package/fesm2022/ngwr-charts-donut-chart.mjs.map +1 -1
  14. package/fesm2022/ngwr-charts-meter-group-testing.mjs +27 -0
  15. package/fesm2022/ngwr-charts-meter-group-testing.mjs.map +1 -1
  16. package/fesm2022/ngwr-charts-meter-group.mjs +54 -6
  17. package/fesm2022/ngwr-charts-meter-group.mjs.map +1 -1
  18. package/fesm2022/ngwr-charts-sparkline-testing.mjs +27 -0
  19. package/fesm2022/ngwr-charts-sparkline-testing.mjs.map +1 -1
  20. package/fesm2022/ngwr-charts-sparkline.mjs +45 -4
  21. package/fesm2022/ngwr-charts-sparkline.mjs.map +1 -1
  22. package/fesm2022/ngwr-checkbox.mjs +38 -3
  23. package/fesm2022/ngwr-checkbox.mjs.map +1 -1
  24. package/fesm2022/ngwr-color-picker-testing.mjs.map +1 -1
  25. package/fesm2022/ngwr-color-picker.mjs +4 -3
  26. package/fesm2022/ngwr-color-picker.mjs.map +1 -1
  27. package/fesm2022/ngwr-command-palette.mjs +39 -19
  28. package/fesm2022/ngwr-command-palette.mjs.map +1 -1
  29. package/fesm2022/ngwr-context-menu.mjs +7 -2
  30. package/fesm2022/ngwr-context-menu.mjs.map +1 -1
  31. package/fesm2022/ngwr-date-picker.mjs +1 -0
  32. package/fesm2022/ngwr-date-picker.mjs.map +1 -1
  33. package/fesm2022/ngwr-dialog.mjs +10 -7
  34. package/fesm2022/ngwr-dialog.mjs.map +1 -1
  35. package/fesm2022/ngwr-drawer.mjs +14 -8
  36. package/fesm2022/ngwr-drawer.mjs.map +1 -1
  37. package/fesm2022/ngwr-file-upload.mjs +2 -2
  38. package/fesm2022/ngwr-file-upload.mjs.map +1 -1
  39. package/fesm2022/ngwr-i18n-ar.mjs +9 -2
  40. package/fesm2022/ngwr-i18n-ar.mjs.map +1 -1
  41. package/fesm2022/ngwr-i18n-cs.mjs +9 -2
  42. package/fesm2022/ngwr-i18n-cs.mjs.map +1 -1
  43. package/fesm2022/ngwr-i18n-de.mjs +9 -2
  44. package/fesm2022/ngwr-i18n-de.mjs.map +1 -1
  45. package/fesm2022/ngwr-i18n-en.mjs +9 -2
  46. package/fesm2022/ngwr-i18n-en.mjs.map +1 -1
  47. package/fesm2022/ngwr-i18n-es.mjs +9 -2
  48. package/fesm2022/ngwr-i18n-es.mjs.map +1 -1
  49. package/fesm2022/ngwr-i18n-fr.mjs +9 -2
  50. package/fesm2022/ngwr-i18n-fr.mjs.map +1 -1
  51. package/fesm2022/ngwr-i18n-he.mjs +9 -2
  52. package/fesm2022/ngwr-i18n-he.mjs.map +1 -1
  53. package/fesm2022/ngwr-i18n-hi.mjs +9 -2
  54. package/fesm2022/ngwr-i18n-hi.mjs.map +1 -1
  55. package/fesm2022/ngwr-i18n-id.mjs +9 -2
  56. package/fesm2022/ngwr-i18n-id.mjs.map +1 -1
  57. package/fesm2022/ngwr-i18n-it.mjs +9 -2
  58. package/fesm2022/ngwr-i18n-it.mjs.map +1 -1
  59. package/fesm2022/ngwr-i18n-ja.mjs +9 -2
  60. package/fesm2022/ngwr-i18n-ja.mjs.map +1 -1
  61. package/fesm2022/ngwr-i18n-kk.mjs +9 -2
  62. package/fesm2022/ngwr-i18n-kk.mjs.map +1 -1
  63. package/fesm2022/ngwr-i18n-ko.mjs +9 -2
  64. package/fesm2022/ngwr-i18n-ko.mjs.map +1 -1
  65. package/fesm2022/ngwr-i18n-nl.mjs +9 -2
  66. package/fesm2022/ngwr-i18n-nl.mjs.map +1 -1
  67. package/fesm2022/ngwr-i18n-pl.mjs +9 -2
  68. package/fesm2022/ngwr-i18n-pl.mjs.map +1 -1
  69. package/fesm2022/ngwr-i18n-pt.mjs +9 -2
  70. package/fesm2022/ngwr-i18n-pt.mjs.map +1 -1
  71. package/fesm2022/ngwr-i18n-ru.mjs +9 -2
  72. package/fesm2022/ngwr-i18n-ru.mjs.map +1 -1
  73. package/fesm2022/ngwr-i18n-sv.mjs +9 -2
  74. package/fesm2022/ngwr-i18n-sv.mjs.map +1 -1
  75. package/fesm2022/ngwr-i18n-tr.mjs +9 -2
  76. package/fesm2022/ngwr-i18n-tr.mjs.map +1 -1
  77. package/fesm2022/ngwr-i18n-uk.mjs +9 -2
  78. package/fesm2022/ngwr-i18n-uk.mjs.map +1 -1
  79. package/fesm2022/ngwr-i18n-vi.mjs +9 -2
  80. package/fesm2022/ngwr-i18n-vi.mjs.map +1 -1
  81. package/fesm2022/ngwr-i18n-zh-tw.mjs +9 -2
  82. package/fesm2022/ngwr-i18n-zh-tw.mjs.map +1 -1
  83. package/fesm2022/ngwr-i18n-zh.mjs +9 -2
  84. package/fesm2022/ngwr-i18n-zh.mjs.map +1 -1
  85. package/fesm2022/ngwr-input-number.mjs +33 -10
  86. package/fesm2022/ngwr-input-number.mjs.map +1 -1
  87. package/fesm2022/ngwr-input-otp.mjs +24 -10
  88. package/fesm2022/ngwr-input-otp.mjs.map +1 -1
  89. package/fesm2022/ngwr-input.mjs +2 -2
  90. package/fesm2022/ngwr-input.mjs.map +1 -1
  91. package/fesm2022/ngwr-lightbox.mjs +5 -3
  92. package/fesm2022/ngwr-lightbox.mjs.map +1 -1
  93. package/fesm2022/ngwr-overlay.mjs +51 -2
  94. package/fesm2022/ngwr-overlay.mjs.map +1 -1
  95. package/fesm2022/ngwr-popconfirm.mjs +2 -2
  96. package/fesm2022/ngwr-popconfirm.mjs.map +1 -1
  97. package/fesm2022/ngwr-popover.mjs +11 -1
  98. package/fesm2022/ngwr-popover.mjs.map +1 -1
  99. package/fesm2022/ngwr-scroll.mjs +39 -16
  100. package/fesm2022/ngwr-scroll.mjs.map +1 -1
  101. package/fesm2022/ngwr-slider.mjs +22 -17
  102. package/fesm2022/ngwr-slider.mjs.map +1 -1
  103. package/fesm2022/ngwr-switch.mjs +33 -3
  104. package/fesm2022/ngwr-switch.mjs.map +1 -1
  105. package/fesm2022/ngwr-table.mjs +17 -4
  106. package/fesm2022/ngwr-table.mjs.map +1 -1
  107. package/fesm2022/ngwr-tabs-router.mjs +3 -3
  108. package/fesm2022/ngwr-tabs-router.mjs.map +1 -1
  109. package/fesm2022/ngwr-tour.mjs +8 -3
  110. package/fesm2022/ngwr-tour.mjs.map +1 -1
  111. package/fesm2022/ngwr-version.mjs +1 -1
  112. package/fesm2022/ngwr-version.mjs.map +1 -1
  113. package/i18n/ar.json +9 -2
  114. package/i18n/cs.json +9 -2
  115. package/i18n/de.json +9 -2
  116. package/i18n/en.json +9 -2
  117. package/i18n/es.json +9 -2
  118. package/i18n/fr.json +9 -2
  119. package/i18n/he.json +9 -2
  120. package/i18n/hi.json +9 -2
  121. package/i18n/id.json +9 -2
  122. package/i18n/it.json +9 -2
  123. package/i18n/ja.json +9 -2
  124. package/i18n/kk.json +9 -2
  125. package/i18n/ko.json +9 -2
  126. package/i18n/nl.json +9 -2
  127. package/i18n/pl.json +9 -2
  128. package/i18n/pt.json +9 -2
  129. package/i18n/ru.json +9 -2
  130. package/i18n/sv.json +9 -2
  131. package/i18n/tr.json +9 -2
  132. package/i18n/uk.json +9 -2
  133. package/i18n/vi.json +9 -2
  134. package/i18n/zh-TW.json +9 -2
  135. package/i18n/zh.json +9 -2
  136. package/llms-full.txt +4 -4
  137. package/package.json +1 -1
  138. package/radio/styles/_index.scss +4 -0
  139. package/schematics/use/rule.js +1 -0
  140. package/schematics/use/symbol-map.json +1 -0
  141. package/switch/styles/_index.scss +4 -0
  142. package/table/styles/_index.scss +7 -0
  143. package/tour/styles/_index.scss +11 -7
  144. package/types/ngwr-charts-donut-chart-testing.d.ts +32 -3
  145. package/types/ngwr-charts-donut-chart.d.ts +45 -6
  146. package/types/ngwr-charts-meter-group-testing.d.ts +29 -1
  147. package/types/ngwr-charts-meter-group.d.ts +43 -4
  148. package/types/ngwr-charts-sparkline-testing.d.ts +32 -2
  149. package/types/ngwr-charts-sparkline.d.ts +42 -3
  150. package/types/ngwr-checkbox.d.ts +14 -0
  151. package/types/ngwr-color-picker-testing.d.ts +1 -1
  152. package/types/ngwr-command-palette.d.ts +2 -1
  153. package/types/ngwr-date-picker.d.ts +8 -2
  154. package/types/ngwr-dialog.d.ts +11 -6
  155. package/types/ngwr-drawer.d.ts +12 -4
  156. package/types/ngwr-file-upload.d.ts +1 -1
  157. package/types/ngwr-input-number.d.ts +14 -2
  158. package/types/ngwr-input-otp.d.ts +2 -0
  159. package/types/ngwr-lightbox.d.ts +1 -0
  160. package/types/ngwr-overlay.d.ts +20 -1
  161. package/types/ngwr-popover.d.ts +3 -3
  162. package/types/ngwr-scroll.d.ts +11 -2
  163. package/types/ngwr-slider.d.ts +3 -1
  164. package/types/ngwr-switch.d.ts +13 -0
  165. package/types/ngwr-table.d.ts +1 -0
  166. package/types/ngwr-tabs-router.d.ts +3 -4
  167. package/types/ngwr-version.d.ts +1 -1
@@ -182,7 +182,7 @@ var WrScrollFollow = class WrScrollFollow {
182
182
  read(scrolled) {
183
183
  const top = this.el.nativeElement.scrollTop;
184
184
  const distance = this.distance();
185
- if (top < this.lastTop && distance > 1) this.atEnd.set(false);
185
+ if (top < this.lastTop) this.atEnd.set(distance <= 1);
186
186
  else if (scrolled && top > this.lastTop && distance <= this.wrScrollFollowThreshold()) this.atEnd.set(true);
187
187
  this.lastTop = top;
188
188
  }
@@ -214,26 +214,49 @@ var WrScrollFollow = class WrScrollFollow {
214
214
  const anchors = [];
215
215
  let parent = host;
216
216
  for (let depth = 0; depth < WRAPPER_DEPTH; depth++) {
217
- let found = null;
218
- let boxes = 0;
219
- for (let child = parent.lastElementChild; child; child = child.previousElementSibling) {
220
- const rect = child.getBoundingClientRect();
221
- if (!rect.width && !rect.height) continue;
222
- boxes++;
223
- if (!found && rect.top < box.bottom) found = {
224
- node: child,
225
- offset: rect.top - box.top
226
- };
227
- if (found && boxes > 1) break;
228
- }
217
+ const found = this.lowestInView(parent, box);
229
218
  if (!found) break;
230
- anchors.push(found);
231
- if (boxes > 1) break;
232
- parent = found.node;
219
+ anchors.push(found.anchor);
220
+ if (found.others) break;
221
+ parent = found.anchor.node;
233
222
  }
234
223
  this.anchors = anchors;
235
224
  this.anchorsTop = host.scrollTop;
236
225
  }
226
+ lowestInView(parent, box) {
227
+ const children = parent.children;
228
+ const sized = (index) => {
229
+ const rect = children[index].getBoundingClientRect();
230
+ return rect.width || rect.height ? rect : null;
231
+ };
232
+ let found = -1;
233
+ let foundRect = null;
234
+ let low = 0;
235
+ let high = children.length - 1;
236
+ while (low <= high) {
237
+ const mid = Math.floor((low + high) / 2);
238
+ let probe = mid;
239
+ let rect = sized(probe);
240
+ while (!rect && probe > low) rect = sized(--probe);
241
+ if (!rect) low = mid + 1;
242
+ else if (rect.top < box.bottom) {
243
+ found = probe;
244
+ foundRect = rect;
245
+ low = mid + 1;
246
+ } else high = probe - 1;
247
+ }
248
+ if (!foundRect) return null;
249
+ let others = false;
250
+ for (let i = found - 1; i >= 0 && !others; i--) others = sized(i) !== null;
251
+ for (let i = found + 1; i < children.length && !others; i++) others = sized(i) !== null;
252
+ return {
253
+ anchor: {
254
+ node: children[found],
255
+ offset: foundRect.top - box.top
256
+ },
257
+ others
258
+ };
259
+ }
237
260
  restore() {
238
261
  const host = this.el.nativeElement;
239
262
  const scrolledSince = host.scrollTop - this.anchorsTop;
@@ -1 +1 @@
1
- {"version":3,"file":"ngwr-scroll.mjs","names":["DOCUMENT"],"sources":["../../../projects/lib/scroll/wr-scroll.ts","../../../projects/lib/scroll/scroll-follow.ts"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { DOCUMENT } from '@angular/common';\nimport { Service, inject } from '@angular/core';\n\nimport { WrPlatform } from 'ngwr/platform';\n\nimport type { WrScrollOptions, WrScrollTarget } from './types';\n\n/**\n * Smooth-scroll utility. Resolves `id` / selector / element / coords\n * targets; subtracts an `offset` (for sticky headers); respects\n * `prefers-reduced-motion` — automatically falls back to instant\n * scrolling when the user has opted out.\n *\n * SSR-safe — all methods no-op on the server.\n *\n * @example\n * ```ts\n * const scroll = inject(WrScroll);\n * scroll.to('#section-three', { offset: 80 });\n * scroll.toTop({ smooth: false });\n * scroll.intoView(myEl, { offset: 64 });\n * ```\n *\n * @see https://ngwr.dev/reference/services/scroll\n */\n@Service()\nexport class WrScroll {\n private readonly doc = inject(DOCUMENT);\n private readonly platform = inject(WrPlatform);\n\n /** Scroll to an arbitrary target. */\n to(target: WrScrollTarget, options: WrScrollOptions = {}): void {\n if (!this.platform.isBrowser) return;\n const win = this.doc.defaultView;\n if (!win) return;\n\n const offset = options.offset ?? 0;\n const behavior = this.behavior(options.smooth);\n const container = options.container ?? win;\n\n if (typeof target === 'object' && 'top' in target) {\n this.scroll(container, {\n top: target.top - offset,\n ...(target.left === undefined ? {} : { left: target.left }),\n behavior,\n });\n return;\n }\n\n const el = typeof target === 'string' ? this.resolveSelector(target) : target;\n if (!el) return;\n\n const rect = el.getBoundingClientRect();\n if (container === win) {\n const top = rect.top + win.scrollY - offset;\n this.scroll(container, { top, behavior });\n } else {\n const ctx = container as Element;\n const ctxRect = ctx.getBoundingClientRect();\n const top = rect.top - ctxRect.top + ctx.scrollTop - offset;\n this.scroll(container, { top, behavior });\n }\n }\n\n /** Convenience for an element — accepts the same options. */\n intoView(el: Element, options: WrScrollOptions = {}): void {\n this.to(el, options);\n }\n\n /** Scroll the page (or container) to the top. */\n toTop(options: WrScrollOptions = {}): void {\n this.to({ top: 0 }, options);\n }\n\n // Internals\n\n private resolveSelector(value: string): Element | null {\n if (value.startsWith('#')) {\n return this.doc.getElementById(value.slice(1));\n }\n try {\n return this.doc.querySelector(value);\n } catch {\n return null;\n }\n }\n\n /** `instant`, not `auto`: `auto` follows the container's `scroll-behavior`, which may be smooth. */\n private behavior(requested: boolean | undefined): ScrollBehavior {\n if (requested === false) return 'instant';\n if (this.platform.prefersReducedMotion()) return 'instant';\n return 'smooth';\n }\n\n private scroll(container: Window | Element, options: ScrollToOptions): void {\n if (container instanceof Window) container.scrollTo(options);\n else container.scrollTo(options);\n }\n}\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { coerceBooleanProperty, coerceNumberProperty } from '@angular/cdk/coercion';\nimport {\n DestroyRef,\n Directive,\n ElementRef,\n type Signal,\n afterNextRender,\n computed,\n effect,\n inject,\n input,\n signal,\n untracked,\n} from '@angular/core';\n\nimport type { WrScrollOptions } from './types';\nimport { WrScroll } from './wr-scroll';\n\n/** A row the view is held to, and where its top edge sat under the container's. */\ninterface Anchor {\n readonly node: Element;\n readonly offset: number;\n}\n\n/** A wrapper around the rows is looked through this many levels deep. */\nconst WRAPPER_DEPTH = 3;\n\n/**\n * Keeps a scroll container at its end while content grows, and holds the\n * reader's place while they are somewhere else.\n *\n * The container starts at its end and stays there as rows are added, as a row\n * grows (streamed text, an image that loads) and as the container is resized.\n * Scrolling up stops the following at once; scrolling back to within\n * `wrScrollFollowThreshold` of the end resumes it. While it is not following,\n * the lowest row in view keeps its place when content above it changes, so\n * older rows loaded at the top do not push the page down.\n *\n * `following` says which of the two it is doing, for a \"jump to latest\" button,\n * and `toEnd()` is what that button calls.\n *\n * The rows are the container's children, or the children of its only child.\n * The container scrolls vertically in the normal direction: RTL changes\n * nothing, and a `column-reverse` container is not supported. Nothing runs on\n * the server.\n *\n * @example\n * ```html\n * <div class=\"log\" wrScrollFollow #log=\"wrScrollFollow\">\n * @for (message of messages(); track message.id) {\n * <p>{{ message.text }}</p>\n * }\n * </div>\n * @if (!log.following()) {\n * <button type=\"button\" (click)=\"log.toEnd()\">Jump to latest</button>\n * }\n * ```\n *\n * @see https://ngwr.dev/reference/services/scroll\n */\n@Directive({\n selector: '[wrScrollFollow]',\n exportAs: 'wrScrollFollow',\n host: {\n // The browser's own scroll anchoring would move the view a second time.\n '[style.overflow-anchor]': 'wrScrollFollow() ? \"none\" : null',\n },\n})\nexport class WrScrollFollow {\n /** `false` switches it off and hands scroll anchoring back to the browser. Bare `wrScrollFollow` is on. */\n readonly wrScrollFollow = input(true, { transform: coerceBooleanProperty });\n\n /** How close to the end, in pixels, the reader has to scroll back for the following to resume. */\n readonly wrScrollFollowThreshold = input(80, {\n transform: (value: unknown) => Math.max(0, coerceNumberProperty(value, 80)),\n });\n\n private readonly el = inject<ElementRef<HTMLElement>>(ElementRef);\n private readonly scroll = inject(WrScroll);\n\n private readonly atEnd = signal(true);\n\n /** Whether the container is held at its end. `false` once the reader scrolls up, and while switched off. */\n readonly following: Signal<boolean> = computed(() => this.wrScrollFollow() && this.atEnd());\n\n private started = false;\n private lastTop = 0;\n private anchors: Anchor[] = [];\n /** `scrollTop` when `anchors` was measured, so a scroll since then is not undone. */\n private anchorsTop = 0;\n\n constructor() {\n const destroyRef = inject(DestroyRef);\n\n afterNextRender(() => {\n const host = this.el.nativeElement;\n const onScroll = (): void => this.onScroll();\n const resize = typeof ResizeObserver === 'undefined' ? null : new ResizeObserver(() => this.sync());\n const mutation = new MutationObserver(records => {\n for (const record of records) {\n if (record.target !== host) continue;\n for (const node of record.addedNodes) if (node instanceof Element) resize?.observe(node);\n for (const node of record.removedNodes) if (node instanceof Element) resize?.unobserve(node);\n }\n this.sync();\n });\n\n host.addEventListener('scroll', onScroll, { passive: true });\n // The host for its own height, its children for growth no mutation reports (an image, a font).\n resize?.observe(host);\n for (const child of host.children) resize?.observe(child);\n mutation.observe(host, { childList: true, characterData: true, subtree: true });\n\n this.started = true;\n this.sync();\n\n destroyRef.onDestroy(() => {\n host.removeEventListener('scroll', onScroll);\n resize?.disconnect();\n mutation.disconnect();\n });\n });\n\n effect(() => {\n const on = this.wrScrollFollow();\n if (!this.started) return;\n untracked(() => {\n if (on) this.atEnd.set(this.distance() <= this.wrScrollFollowThreshold());\n this.sync();\n });\n });\n }\n\n /**\n * Scroll to the end and follow again. Smooth unless `smooth` is `false` or\n * the reader prefers reduced motion.\n */\n toEnd(options: Pick<WrScrollOptions, 'smooth'> = {}): void {\n if (!this.started) return;\n const host = this.el.nativeElement;\n this.atEnd.set(true);\n this.anchors = [];\n this.scroll.to({ top: host.scrollHeight }, { ...options, container: host });\n }\n\n private distance(): number {\n const host = this.el.nativeElement;\n return host.scrollHeight - host.scrollTop - host.clientHeight;\n }\n\n private onScroll(): void {\n this.read(true);\n if (this.following()) {\n this.anchors = [];\n return;\n }\n if (!this.wrScrollFollow()) return;\n // A row above may have changed size with its resize callback still to come\n // (scroll events run first): correct for it before the anchor is replaced.\n this.restore();\n this.lastTop = this.el.nativeElement.scrollTop;\n this.capture();\n }\n\n /**\n * Any move up stops the following, so a reader can leave while text streams\n * in; within a pixel of the end it is the browser clamping to shorter content.\n * Only a move down resumes it: the directive's own writes are never read as one.\n */\n private read(scrolled: boolean): void {\n const top = this.el.nativeElement.scrollTop;\n const distance = this.distance();\n\n if (top < this.lastTop && distance > 1) this.atEnd.set(false);\n else if (scrolled && top > this.lastTop && distance <= this.wrScrollFollowThreshold()) this.atEnd.set(true);\n\n this.lastTop = top;\n }\n\n /** Content or the container changed size: hold the end, or hold the reader's place. */\n private sync(): void {\n const host = this.el.nativeElement;\n // A scroll whose event is still on its way must not be pinned over, and a\n // move down into the threshold resumes following here, before `lastTop`\n // moves past it and the scroll event finds nothing to read.\n this.read(true);\n\n if (!this.wrScrollFollow()) {\n this.anchors = [];\n return;\n }\n\n if (this.atEnd()) {\n this.move(host.scrollHeight);\n this.anchors = [];\n } else {\n this.restore();\n this.capture();\n }\n this.lastTop = host.scrollTop;\n }\n\n /** Instant whatever `scroll-behavior` the container has: an animated correction is a visible jump. */\n private move(top: number): void {\n this.el.nativeElement.scrollTo({ top, behavior: 'instant' });\n }\n\n /** Remember the lowest row in view. A row at the top would be the \"load older\" button. */\n private capture(): void {\n const host = this.el.nativeElement;\n const box = host.getBoundingClientRect();\n const anchors: Anchor[] = [];\n\n let parent: Element = host;\n for (let depth = 0; depth < WRAPPER_DEPTH; depth++) {\n let found: Anchor | null = null;\n let boxes = 0;\n for (let child = parent.lastElementChild; child; child = child.previousElementSibling) {\n const rect = child.getBoundingClientRect();\n // `display: none` and `display: contents` have no box to hold on to.\n if (!rect.width && !rect.height) continue;\n boxes++;\n if (!found && rect.top < box.bottom) found = { node: child, offset: rect.top - box.top };\n if (found && boxes > 1) break;\n }\n if (!found) break;\n anchors.push(found);\n // An only child is a wrapper, and its top does not move when rows are added inside it.\n if (boxes > 1) break;\n parent = found.node;\n }\n\n this.anchors = anchors;\n this.anchorsTop = host.scrollTop;\n }\n\n /** Put the remembered row back where it was. */\n private restore(): void {\n const host = this.el.nativeElement;\n const scrolledSince = host.scrollTop - this.anchorsTop;\n\n for (let i = this.anchors.length - 1; i >= 0; i--) {\n const { node, offset } = this.anchors[i];\n if (!host.contains(node)) continue;\n const rect = node.getBoundingClientRect();\n if (!rect.width && !rect.height) continue;\n\n const delta = rect.top - host.getBoundingClientRect().top - (offset - scrolledSince);\n if (Math.abs(delta) >= 1) this.move(host.scrollTop + delta);\n return;\n }\n }\n}\n"],"mappings":";;;;;;;;;;;AAiCA,IAAa,WAAb,MAAa,SAAQ;CACF,MAAM,OAAOA,UAAQ;CACrB,WAAW,OAAO,UAAU;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;EAAA;EAAA,MAAA,EAAA,YAAA,EAAA,yBAAA,qCAAA,EAAA;EAAA,UAAA,CAAA,gBAAA;EAAA,UAAA;CAAA,CAAA;;AAAd,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAc,YAAA,CAAA;EAR1B,MAAA;EAAU,MAAA,CAAA;GACT,UAAU;GACV,UAAU;GACV,MAAM,EAEJ,2BAA2B,qCAC5B;EACF,CAAA"}
1
+ {"version":3,"file":"ngwr-scroll.mjs","names":["DOCUMENT"],"sources":["../../../projects/lib/scroll/wr-scroll.ts","../../../projects/lib/scroll/scroll-follow.ts"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { DOCUMENT } from '@angular/common';\nimport { Service, inject } from '@angular/core';\n\nimport { WrPlatform } from 'ngwr/platform';\n\nimport type { WrScrollOptions, WrScrollTarget } from './types';\n\n/**\n * Smooth-scroll utility. Resolves `id` / selector / element / coords\n * targets; subtracts an `offset` (for sticky headers); respects\n * `prefers-reduced-motion` — automatically falls back to instant\n * scrolling when the user has opted out.\n *\n * SSR-safe — all methods no-op on the server.\n *\n * @example\n * ```ts\n * const scroll = inject(WrScroll);\n * scroll.to('#section-three', { offset: 80 });\n * scroll.toTop({ smooth: false });\n * scroll.intoView(myEl, { offset: 64 });\n * ```\n *\n * @see https://ngwr.dev/reference/services/scroll\n */\n@Service()\nexport class WrScroll {\n private readonly doc = inject(DOCUMENT);\n private readonly platform = inject(WrPlatform);\n\n /** Scroll to an arbitrary target. */\n to(target: WrScrollTarget, options: WrScrollOptions = {}): void {\n if (!this.platform.isBrowser) return;\n const win = this.doc.defaultView;\n if (!win) return;\n\n const offset = options.offset ?? 0;\n const behavior = this.behavior(options.smooth);\n const container = options.container ?? win;\n\n if (typeof target === 'object' && 'top' in target) {\n this.scroll(container, {\n top: target.top - offset,\n ...(target.left === undefined ? {} : { left: target.left }),\n behavior,\n });\n return;\n }\n\n const el = typeof target === 'string' ? this.resolveSelector(target) : target;\n if (!el) return;\n\n const rect = el.getBoundingClientRect();\n if (container === win) {\n const top = rect.top + win.scrollY - offset;\n this.scroll(container, { top, behavior });\n } else {\n const ctx = container as Element;\n const ctxRect = ctx.getBoundingClientRect();\n const top = rect.top - ctxRect.top + ctx.scrollTop - offset;\n this.scroll(container, { top, behavior });\n }\n }\n\n /** Convenience for an element — accepts the same options. */\n intoView(el: Element, options: WrScrollOptions = {}): void {\n this.to(el, options);\n }\n\n /** Scroll the page (or container) to the top. */\n toTop(options: WrScrollOptions = {}): void {\n this.to({ top: 0 }, options);\n }\n\n // Internals\n\n private resolveSelector(value: string): Element | null {\n if (value.startsWith('#')) {\n return this.doc.getElementById(value.slice(1));\n }\n try {\n return this.doc.querySelector(value);\n } catch {\n return null;\n }\n }\n\n /** `instant`, not `auto`: `auto` follows the container's `scroll-behavior`, which may be smooth. */\n private behavior(requested: boolean | undefined): ScrollBehavior {\n if (requested === false) return 'instant';\n if (this.platform.prefersReducedMotion()) return 'instant';\n return 'smooth';\n }\n\n private scroll(container: Window | Element, options: ScrollToOptions): void {\n if (container instanceof Window) container.scrollTo(options);\n else container.scrollTo(options);\n }\n}\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { coerceBooleanProperty, coerceNumberProperty } from '@angular/cdk/coercion';\nimport {\n DestroyRef,\n Directive,\n ElementRef,\n type Signal,\n afterNextRender,\n computed,\n effect,\n inject,\n input,\n signal,\n untracked,\n} from '@angular/core';\n\nimport type { WrScrollOptions } from './types';\nimport { WrScroll } from './wr-scroll';\n\n/** A row the view is held to, and where its top edge sat under the container's. */\ninterface Anchor {\n readonly node: Element;\n readonly offset: number;\n}\n\n/** A wrapper around the rows is looked through this many levels deep. */\nconst WRAPPER_DEPTH = 3;\n\n/**\n * Keeps a scroll container at its end while content grows, and holds the\n * reader's place while they are somewhere else.\n *\n * The container starts at its end and stays there as rows are added, as a row\n * grows (streamed text, an image that loads) and as the container is resized.\n * Scrolling up stops the following at once; scrolling back to within\n * `wrScrollFollowThreshold` of the end resumes it. While it is not following,\n * the lowest row in view keeps its place when content above it changes, so\n * older rows loaded at the top do not push the page down.\n *\n * `following` says which of the two it is doing, for a \"jump to latest\" button,\n * and `toEnd()` is what that button calls.\n *\n * The rows are the container's children, or the children of its only child.\n * The container scrolls vertically in the normal direction: RTL changes\n * nothing, and a `column-reverse` container is not supported. Nothing runs on\n * the server.\n *\n * @example\n * ```html\n * <div class=\"log\" wrScrollFollow #log=\"wrScrollFollow\">\n * @for (message of messages(); track message.id) {\n * <p>{{ message.text }}</p>\n * }\n * </div>\n * @if (!log.following()) {\n * <button type=\"button\" (click)=\"log.toEnd()\">Jump to latest</button>\n * }\n * ```\n *\n * @see https://ngwr.dev/reference/services/scroll\n */\n@Directive({\n selector: '[wrScrollFollow]',\n exportAs: 'wrScrollFollow',\n host: {\n // The browser's own scroll anchoring would move the view a second time.\n '[style.overflow-anchor]': 'wrScrollFollow() ? \"none\" : null',\n },\n})\nexport class WrScrollFollow {\n /** `false` switches it off and hands scroll anchoring back to the browser. Bare `wrScrollFollow` is on. */\n readonly wrScrollFollow = input(true, { transform: coerceBooleanProperty });\n\n /** How close to the end, in pixels, the reader has to scroll back for the following to resume. */\n readonly wrScrollFollowThreshold = input(80, {\n transform: (value: unknown) => Math.max(0, coerceNumberProperty(value, 80)),\n });\n\n private readonly el = inject<ElementRef<HTMLElement>>(ElementRef);\n private readonly scroll = inject(WrScroll);\n\n private readonly atEnd = signal(true);\n\n /** Whether the container is held at its end. `false` once the reader scrolls up, and while switched off. */\n readonly following: Signal<boolean> = computed(() => this.wrScrollFollow() && this.atEnd());\n\n private started = false;\n private lastTop = 0;\n private anchors: Anchor[] = [];\n /** `scrollTop` when `anchors` was measured, so a scroll since then is not undone. */\n private anchorsTop = 0;\n\n constructor() {\n const destroyRef = inject(DestroyRef);\n\n afterNextRender(() => {\n const host = this.el.nativeElement;\n const onScroll = (): void => this.onScroll();\n const resize = typeof ResizeObserver === 'undefined' ? null : new ResizeObserver(() => this.sync());\n const mutation = new MutationObserver(records => {\n for (const record of records) {\n if (record.target !== host) continue;\n for (const node of record.addedNodes) if (node instanceof Element) resize?.observe(node);\n for (const node of record.removedNodes) if (node instanceof Element) resize?.unobserve(node);\n }\n this.sync();\n });\n\n host.addEventListener('scroll', onScroll, { passive: true });\n // The host for its own height, its children for growth no mutation reports (an image, a font).\n resize?.observe(host);\n for (const child of host.children) resize?.observe(child);\n mutation.observe(host, { childList: true, characterData: true, subtree: true });\n\n this.started = true;\n this.sync();\n\n destroyRef.onDestroy(() => {\n host.removeEventListener('scroll', onScroll);\n resize?.disconnect();\n mutation.disconnect();\n });\n });\n\n effect(() => {\n const on = this.wrScrollFollow();\n if (!this.started) return;\n untracked(() => {\n if (on) this.atEnd.set(this.distance() <= this.wrScrollFollowThreshold());\n this.sync();\n });\n });\n }\n\n /**\n * Scroll to the end and follow again. Smooth unless `smooth` is `false` or\n * the reader prefers reduced motion.\n */\n toEnd(options: Pick<WrScrollOptions, 'smooth'> = {}): void {\n if (!this.started) return;\n const host = this.el.nativeElement;\n this.atEnd.set(true);\n this.anchors = [];\n this.scroll.to({ top: host.scrollHeight }, { ...options, container: host });\n }\n\n private distance(): number {\n const host = this.el.nativeElement;\n return host.scrollHeight - host.scrollTop - host.clientHeight;\n }\n\n private onScroll(): void {\n this.read(true);\n if (this.following()) {\n this.anchors = [];\n return;\n }\n if (!this.wrScrollFollow()) return;\n // A row above may have changed size with its resize callback still to come\n // (scroll events run first): correct for it before the anchor is replaced.\n this.restore();\n this.lastTop = this.el.nativeElement.scrollTop;\n this.capture();\n }\n\n /**\n * Any move up stops the following, so a reader can leave while text streams\n * in; one that lands within a pixel of the end is the browser clamping to\n * shorter content, and it follows again, since nothing is left to scroll back\n * to. Only a move down resumes it: the directive's own writes are never read as one.\n */\n private read(scrolled: boolean): void {\n const top = this.el.nativeElement.scrollTop;\n const distance = this.distance();\n\n if (top < this.lastTop) this.atEnd.set(distance <= 1);\n else if (scrolled && top > this.lastTop && distance <= this.wrScrollFollowThreshold()) this.atEnd.set(true);\n\n this.lastTop = top;\n }\n\n /** Content or the container changed size: hold the end, or hold the reader's place. */\n private sync(): void {\n const host = this.el.nativeElement;\n // A scroll whose event is still on its way must not be pinned over, and a\n // move down into the threshold resumes following here, before `lastTop`\n // moves past it and the scroll event finds nothing to read.\n this.read(true);\n\n if (!this.wrScrollFollow()) {\n this.anchors = [];\n return;\n }\n\n if (this.atEnd()) {\n this.move(host.scrollHeight);\n this.anchors = [];\n } else {\n this.restore();\n this.capture();\n }\n this.lastTop = host.scrollTop;\n }\n\n /** Instant whatever `scroll-behavior` the container has: an animated correction is a visible jump. */\n private move(top: number): void {\n this.el.nativeElement.scrollTo({ top, behavior: 'instant' });\n }\n\n /** Remember the lowest row in view. A row at the top would be the \"load older\" button. */\n private capture(): void {\n const host = this.el.nativeElement;\n const box = host.getBoundingClientRect();\n const anchors: Anchor[] = [];\n\n let parent: Element = host;\n for (let depth = 0; depth < WRAPPER_DEPTH; depth++) {\n const found = this.lowestInView(parent, box);\n if (!found) break;\n anchors.push(found.anchor);\n // An only child is a wrapper, and its top does not move when rows are added inside it.\n if (found.others) break;\n parent = found.anchor.node;\n }\n\n this.anchors = anchors;\n this.anchorsTop = host.scrollTop;\n }\n\n /**\n * The last child of `parent` that starts above the bottom of `box`, found by\n * bisection: rows stack top to bottom, so only the ones around the view are\n * measured, not every row below it. A child without a box (`display: none`,\n * `display: contents`) has nothing to hold on to and is stepped over.\n * `others` is whether `parent` has a second child with a box.\n */\n private lowestInView(parent: Element, box: DOMRect): { anchor: Anchor; others: boolean } | null {\n const children = parent.children;\n const sized = (index: number): DOMRect | null => {\n const rect = children[index].getBoundingClientRect();\n return rect.width || rect.height ? rect : null;\n };\n\n let found = -1;\n let foundRect: DOMRect | null = null;\n let low = 0;\n let high = children.length - 1;\n while (low <= high) {\n const mid = Math.floor((low + high) / 2);\n let probe = mid;\n let rect = sized(probe);\n while (!rect && probe > low) rect = sized(--probe);\n if (!rect) {\n low = mid + 1;\n } else if (rect.top < box.bottom) {\n found = probe;\n foundRect = rect;\n low = mid + 1;\n } else {\n high = probe - 1;\n }\n }\n if (!foundRect) return null;\n\n let others = false;\n for (let i = found - 1; i >= 0 && !others; i--) others = sized(i) !== null;\n for (let i = found + 1; i < children.length && !others; i++) others = sized(i) !== null;\n return { anchor: { node: children[found], offset: foundRect.top - box.top }, others };\n }\n\n /** Put the remembered row back where it was. */\n private restore(): void {\n const host = this.el.nativeElement;\n const scrolledSince = host.scrollTop - this.anchorsTop;\n\n for (let i = this.anchors.length - 1; i >= 0; i--) {\n const { node, offset } = this.anchors[i];\n if (!host.contains(node)) continue;\n const rect = node.getBoundingClientRect();\n if (!rect.width && !rect.height) continue;\n\n const delta = rect.top - host.getBoundingClientRect().top - (offset - scrolledSince);\n if (Math.abs(delta) >= 1) this.move(host.scrollTop + delta);\n return;\n }\n }\n}\n"],"mappings":";;;;;;;;;;;AAiCA,IAAa,WAAb,MAAa,SAAQ;CACF,MAAM,OAAOA,UAAQ;CACrB,WAAW,OAAO,UAAU;CAG7C,GAAG,QAAwB,UAA2B,CAAA,GAAE;EACtD,IAAI,CAAC,KAAK,SAAS,WAAW;EAC9B,MAAM,MAAM,KAAK,IAAI;EACrB,IAAI,CAAC,KAAK;EAEV,MAAM,SAAS,QAAQ,UAAU;EACjC,MAAM,WAAW,KAAK,SAAS,QAAQ,MAAM;EAC7C,MAAM,YAAY,QAAQ,aAAa;EAEvC,IAAI,OAAO,WAAW,YAAY,SAAS,QAAQ;GACjD,KAAK,OAAO,WAAW;IACrB,KAAK,OAAO,MAAM;IAClB,GAAI,OAAO,SAAS,SAAY,CAAA,IAAK,EAAE,MAAM,OAAO,KAAI;IACxD;GACD,CAAA;GACD;EACF;EAEA,MAAM,KAAK,O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EAAc,cAAA;EAAA,UAAA;EAAA,QAAA;GAAA,gBAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;GAAA,yBAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;EAAA;EAAA,MAAA,EAAA,YAAA,EAAA,yBAAA,qCAAA,EAAA;EAAA,UAAA,CAAA,gBAAA;EAAA,UAAA;CAAA,CAAA;;AAAd,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAc,YAAA,CAAA;EAR1B,MAAA;EAAU,MAAA,CAAA;GACT,UAAU;GACV,UAAU;GACV,MAAM,EAEJ,2BAA2B,qCAC5B;EACF,CAAA"}
@@ -132,14 +132,31 @@ var WrSlider = class WrSlider {
132
132
  this.lowThumb().nativeElement.focus(options);
133
133
  }
134
134
  onPointerDown(event, thumb) {
135
- if (this.disabled() || this.readonly()) return;
135
+ this.startDrag(event, event.currentTarget, thumb);
136
+ }
137
+ onTrackPointerDown(event) {
138
+ if (this.disabled() || this.readonly() || !this.isPrimaryPress(event)) return;
139
+ if (event.target.closest(".wr-slider__thumb")) return;
140
+ const thumb = this.nearestThumb(event);
141
+ const el = this.track().nativeElement.querySelector(`.wr-slider__thumb--${thumb}`);
142
+ if (el) this.startDrag(event, el, thumb);
143
+ }
144
+ isPrimaryPress(event) {
145
+ return event.button === 0 && event.isPrimary !== false;
146
+ }
147
+ startDrag(event, target, thumb) {
148
+ if (this.disabled() || this.readonly() || !this.isPrimaryPress(event)) return;
136
149
  event.preventDefault();
137
- const target = event.currentTarget;
138
- target.setPointerCapture(event.pointerId);
150
+ target.setPointerCapture?.(event.pointerId);
139
151
  target.focus();
140
- const move = (e) => this.updateFromEvent(e, thumb);
152
+ const move = (e) => {
153
+ if (e.pointerId !== event.pointerId) return;
154
+ if (this.disabled() || this.readonly()) return;
155
+ this.updateFromEvent(e, thumb);
156
+ };
141
157
  const cleanup = (e) => {
142
- target.releasePointerCapture(e.pointerId);
158
+ if (e.pointerId !== event.pointerId) return;
159
+ target.releasePointerCapture?.(e.pointerId);
143
160
  target.removeEventListener("pointermove", move);
144
161
  target.removeEventListener("pointerup", cleanup);
145
162
  target.removeEventListener("pointercancel", cleanup);
@@ -150,13 +167,6 @@ var WrSlider = class WrSlider {
150
167
  target.addEventListener("pointercancel", cleanup);
151
168
  this.updateFromEvent(event, thumb);
152
169
  }
153
- onTrackPointerDown(event) {
154
- if (this.disabled() || this.readonly()) return;
155
- if (event.target.closest(".wr-slider__thumb")) return;
156
- const thumb = this.nearestThumb(event);
157
- this.updateFromEvent(event, thumb);
158
- this.focusThumb(thumb);
159
- }
160
170
  onKey(event, thumb) {
161
171
  if (this.disabled() || this.readonly()) return;
162
172
  const big = event.shiftKey || event.key === "PageUp" || event.key === "PageDown" ? 10 : 1;
@@ -214,11 +224,6 @@ var WrSlider = class WrSlider {
214
224
  const raw = this.valueAt(event);
215
225
  return Math.abs(raw - this.low()) <= Math.abs(raw - this.high()) ? "low" : "high";
216
226
  }
217
- focusThumb(thumb) {
218
- queueMicrotask(() => {
219
- this.track().nativeElement.querySelector(`.wr-slider__thumb--${thumb}`)?.focus();
220
- });
221
- }
222
227
  setThumb(thumb, raw) {
223
228
  const stepped = this.snap(raw);
224
229
  if (thumb === "low") {
@@ -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 { WrSliderMark, WrSliderSize, 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 * With `snapToMarks` every one of those keys moves one mark instead, and\n * Home / End land on the first and the last mark.\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 * `orientation=\"vertical\"` runs the track from the bottom (min) to the top\n * (max). → then raises the value like ↑ and ← lowers it like ↓, in both\n * reading directions.\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 * Stops drawn on the track: a tick at each `value`, and its `label` under the\n * track when it has one. A mark outside `[min, max]` is not drawn. The thumb\n * announces the label of the mark it stands on as `aria-valuetext`, ahead of\n * `labelWith`.\n *\n * @example\n * ```html\n * <wr-slider [marks]=\"[{ value: 0, label: 'Low' }, { value: 50 }, { value: 100, label: 'High' }]\" />\n * ```\n */\n readonly marks = input<readonly WrSliderMark[]>([]);\n\n /**\n * Restrict the value to the marks: a drag lands on the nearest one and the\n * keyboard moves from mark to mark, whatever `step` says. Without marks it\n * does nothing.\n *\n * @default false\n */\n readonly snapToMarks = input(false, { transform: coerceBooleanProperty });\n\n /**\n * Axis of the track. `vertical` runs from the bottom (min) to the top (max),\n * as tall as `--wr-slider-vertical-height`, with the value and the marks'\n * labels beside it.\n *\n * @default 'horizontal'\n */\n readonly orientation = input<'horizontal' | 'vertical'>('horizontal');\n\n /**\n * Control size: the track's thickness, the thumb, the marks and both kinds\n * of label text.\n *\n * @default 'md'\n */\n readonly size = input<WrSliderSize>('md');\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 const size = this.size();\n if (size !== 'md') parts.push(`wr-slider--${size}`);\n if (this.range()) parts.push('wr-slider--range');\n if (this.vertical()) parts.push('wr-slider--vertical');\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 vertical = computed(() => this.orientation() === 'vertical');\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 /** The marks inside the bounds, in value order: what is drawn and what `snapToMarks` walks. */\n protected readonly visibleMarks = computed(() =>\n this.marks()\n .filter(mark => mark.value >= this.minValue() && mark.value <= this.maxValue())\n .sort((a, b) => a.value - b.value)\n .map(mark => ({ ...mark, percent: this.percentOf(mark.value) }))\n );\n protected readonly labelledMarks = computed(() => this.visibleMarks().filter(mark => !!mark.label));\n\n private readonly snapping = computed(() => this.snapToMarks() && this.visibleMarks().length > 0);\n\n /**\n * `aria-valuetext` of the lower thumb: the label of the mark it stands on,\n * else `labelWith`, else `null` so the number announces as is.\n */\n protected readonly lowText = computed<string | null>(() => this.textOf(this.low()));\n /** `aria-valuetext` of the upper thumb, see {@link lowText}. */\n protected readonly highText = computed<string | null>(() => this.textOf(this.high()));\n\n /** Where the value label sits along a vertical track: beside the thumb, or midway between two. */\n protected readonly labelPercent = computed(() =>\n this.range() ? (this.lowPercent() + this.highPercent()) / 2 : this.lowPercent()\n );\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. A\n // vertical track has no inline side to name.\n const inline = this.isRtl() && !this.vertical() ? -1 : 1;\n let direction = 0;\n let next: number | null = null;\n\n switch (event.key) {\n case 'ArrowRight':\n direction = inline;\n break;\n case 'ArrowLeft':\n direction = -inline;\n break;\n case 'ArrowUp':\n case 'PageUp':\n direction = 1;\n break;\n case 'ArrowDown':\n case 'PageDown':\n direction = -1;\n break;\n case 'Home':\n next = this.minValue();\n break;\n case 'End':\n next = this.maxValue();\n break;\n }\n\n if (direction) next = this.snapping() ? this.adjacentMark(current, direction) : current + direction * delta;\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, or up\n * from its bottom edge when vertical.\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 inline = this.isRtl() ? rect.right - event.clientX : event.clientX - rect.left;\n const ratio = wrClamp(this.vertical() ? (rect.bottom - event.clientY) / rect.height : inline / 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 if (this.snapping()) return this.nearestMark(value);\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 nearestMark(value: number): number {\n return this.visibleMarks().reduce((best, mark) =>\n Math.abs(mark.value - value) < Math.abs(best.value - value) ? mark : best\n ).value;\n }\n\n /** The next mark above or below `value`; `value` itself when there is none, which `snap` then settles. */\n private adjacentMark(value: number, direction: number): number {\n const marks = this.visibleMarks();\n const next =\n direction > 0 ? marks.find(mark => mark.value > value) : [...marks].reverse().find(mark => mark.value < value);\n return next?.value ?? value;\n }\n\n private textOf(value: number): string | null {\n const mark = this.labelledMarks().find(({ value: at }) => at === value);\n return mark?.label ?? this.labelWith()?.(value) ?? null;\n }\n\n protected isActiveMark(value: number): boolean {\n return this.range() ? value >= this.low() && value <= this.high() : value <= this.low();\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 A vertical track measures every part up from `bottom` instead.\n -->\n <span\n class=\"wr-slider__fill\"\n [style.inset-inline-start.%]=\"vertical() ? null : fillStart()\"\n [style.width.%]=\"vertical() ? null : fillWidth()\"\n [style.bottom.%]=\"vertical() ? fillStart() : null\"\n [style.height.%]=\"vertical() ? fillWidth() : null\"\n ></span>\n\n @for (mark of visibleMarks(); track $index) {\n <span\n class=\"wr-slider__mark\"\n [class.wr-slider__mark--active]=\"isActiveMark(mark.value)\"\n [attr.data-value]=\"mark.value\"\n [style.inset-inline-start.%]=\"vertical() ? null : mark.percent\"\n [style.bottom.%]=\"vertical() ? mark.percent : null\"\n ></span>\n }\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.%]=\"vertical() ? null : lowPercent()\"\n [style.bottom.%]=\"vertical() ? lowPercent() : null\"\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-orientation]=\"vertical() ? 'vertical' : null\"\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.%]=\"vertical() ? null : highPercent()\"\n [style.bottom.%]=\"vertical() ? highPercent() : null\"\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-orientation]=\"vertical() ? 'vertical' : null\"\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 (labelledMarks().length) {\n <!-- Hidden from assistive tech: the thumb announces the label of the mark it stands on. -->\n <div class=\"wr-slider__mark-labels\" aria-hidden=\"true\">\n @for (mark of labelledMarks(); track $index) {\n <span\n class=\"wr-slider__mark-label\"\n [attr.data-value]=\"mark.value\"\n [style.inset-inline-start.%]=\"vertical() ? null : mark.percent\"\n [style.bottom.%]=\"vertical() ? mark.percent : null\"\n >{{ mark.label }}</span\n >\n }\n </div>\n}\n\n@if (showValue()) {\n <div class=\"wr-slider__label\" [style.bottom.%]=\"vertical() ? labelPercent() : null\">{{ label() }}</div>\n}\n"],"mappings":";;;;;;;;;;;;;AAyEA,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,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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 { WrSliderMark, WrSliderSize, 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 * With `snapToMarks` every one of those keys moves one mark instead, and\n * Home / End land on the first and the last mark.\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 * `orientation=\"vertical\"` runs the track from the bottom (min) to the top\n * (max). → then raises the value like ↑ and ← lowers it like ↓, in both\n * reading directions.\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 * Stops drawn on the track: a tick at each `value`, and its `label` under the\n * track when it has one. A mark outside `[min, max]` is not drawn. The thumb\n * announces the label of the mark it stands on as `aria-valuetext`, ahead of\n * `labelWith`.\n *\n * @example\n * ```html\n * <wr-slider [marks]=\"[{ value: 0, label: 'Low' }, { value: 50 }, { value: 100, label: 'High' }]\" />\n * ```\n */\n readonly marks = input<readonly WrSliderMark[]>([]);\n\n /**\n * Restrict the value to the marks: a drag lands on the nearest one and the\n * keyboard moves from mark to mark, whatever `step` says. Without marks it\n * does nothing.\n *\n * @default false\n */\n readonly snapToMarks = input(false, { transform: coerceBooleanProperty });\n\n /**\n * Axis of the track. `vertical` runs from the bottom (min) to the top (max),\n * as tall as `--wr-slider-vertical-height`, with the value and the marks'\n * labels beside it.\n *\n * @default 'horizontal'\n */\n readonly orientation = input<'horizontal' | 'vertical'>('horizontal');\n\n /**\n * Control size: the track's thickness, the thumb, the marks and both kinds\n * of label text.\n *\n * @default 'md'\n */\n readonly size = input<WrSliderSize>('md');\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 const size = this.size();\n if (size !== 'md') parts.push(`wr-slider--${size}`);\n if (this.range()) parts.push('wr-slider--range');\n if (this.vertical()) parts.push('wr-slider--vertical');\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 vertical = computed(() => this.orientation() === 'vertical');\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 /** The marks inside the bounds, in value order: what is drawn and what `snapToMarks` walks. */\n protected readonly visibleMarks = computed(() =>\n this.marks()\n .filter(mark => mark.value >= this.minValue() && mark.value <= this.maxValue())\n .sort((a, b) => a.value - b.value)\n .map(mark => ({ ...mark, percent: this.percentOf(mark.value) }))\n );\n protected readonly labelledMarks = computed(() => this.visibleMarks().filter(mark => !!mark.label));\n\n private readonly snapping = computed(() => this.snapToMarks() && this.visibleMarks().length > 0);\n\n /**\n * `aria-valuetext` of the lower thumb: the label of the mark it stands on,\n * else `labelWith`, else `null` so the number announces as is.\n */\n protected readonly lowText = computed<string | null>(() => this.textOf(this.low()));\n /** `aria-valuetext` of the upper thumb, see {@link lowText}. */\n protected readonly highText = computed<string | null>(() => this.textOf(this.high()));\n\n /** Where the value label sits along a vertical track: beside the thumb, or midway between two. */\n protected readonly labelPercent = computed(() =>\n this.range() ? (this.lowPercent() + this.highPercent()) / 2 : this.lowPercent()\n );\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 this.startDrag(event, event.currentTarget as HTMLElement, thumb);\n }\n\n protected onTrackPointerDown(event: PointerEvent): void {\n if (this.disabled() || this.readonly() || !this.isPrimaryPress(event)) return;\n if ((event.target as HTMLElement).closest('.wr-slider__thumb')) return;\n const thumb = this.nearestThumb(event);\n const el = this.track().nativeElement.querySelector<HTMLElement>(`.wr-slider__thumb--${thumb}`);\n if (el) this.startDrag(event, el, thumb);\n }\n\n /** Primary button of the primary pointer: a right-click or a second finger starts nothing. */\n private isPrimaryPress(event: PointerEvent): boolean {\n return event.button === 0 && event.isPrimary !== false;\n }\n\n private startDrag(event: PointerEvent, target: HTMLElement, thumb: 'low' | 'high'): void {\n if (this.disabled() || this.readonly() || !this.isPrimaryPress(event)) return;\n event.preventDefault();\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 target.focus();\n\n const move = (e: PointerEvent): void => {\n if (e.pointerId !== event.pointerId) return;\n if (this.disabled() || this.readonly()) return;\n this.updateFromEvent(e, thumb);\n };\n const cleanup = (e: PointerEvent): void => {\n if (e.pointerId !== event.pointerId) return;\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 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. A\n // vertical track has no inline side to name.\n const inline = this.isRtl() && !this.vertical() ? -1 : 1;\n let direction = 0;\n let next: number | null = null;\n\n switch (event.key) {\n case 'ArrowRight':\n direction = inline;\n break;\n case 'ArrowLeft':\n direction = -inline;\n break;\n case 'ArrowUp':\n case 'PageUp':\n direction = 1;\n break;\n case 'ArrowDown':\n case 'PageDown':\n direction = -1;\n break;\n case 'Home':\n next = this.minValue();\n break;\n case 'End':\n next = this.maxValue();\n break;\n }\n\n if (direction) next = this.snapping() ? this.adjacentMark(current, direction) : current + direction * delta;\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, or up\n * from its bottom edge when vertical.\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 inline = this.isRtl() ? rect.right - event.clientX : event.clientX - rect.left;\n const ratio = wrClamp(this.vertical() ? (rect.bottom - event.clientY) / rect.height : inline / 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 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 if (this.snapping()) return this.nearestMark(value);\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 nearestMark(value: number): number {\n return this.visibleMarks().reduce((best, mark) =>\n Math.abs(mark.value - value) < Math.abs(best.value - value) ? mark : best\n ).value;\n }\n\n /** The next mark above or below `value`; `value` itself when there is none, which `snap` then settles. */\n private adjacentMark(value: number, direction: number): number {\n const marks = this.visibleMarks();\n const next =\n direction > 0 ? marks.find(mark => mark.value > value) : [...marks].reverse().find(mark => mark.value < value);\n return next?.value ?? value;\n }\n\n private textOf(value: number): string | null {\n const mark = this.labelledMarks().find(({ value: at }) => at === value);\n return mark?.label ?? this.labelWith()?.(value) ?? null;\n }\n\n protected isActiveMark(value: number): boolean {\n return this.range() ? value >= this.low() && value <= this.high() : value <= this.low();\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 A vertical track measures every part up from `bottom` instead.\n -->\n <span\n class=\"wr-slider__fill\"\n [style.inset-inline-start.%]=\"vertical() ? null : fillStart()\"\n [style.width.%]=\"vertical() ? null : fillWidth()\"\n [style.bottom.%]=\"vertical() ? fillStart() : null\"\n [style.height.%]=\"vertical() ? fillWidth() : null\"\n ></span>\n\n @for (mark of visibleMarks(); track $index) {\n <span\n class=\"wr-slider__mark\"\n [class.wr-slider__mark--active]=\"isActiveMark(mark.value)\"\n [attr.data-value]=\"mark.value\"\n [style.inset-inline-start.%]=\"vertical() ? null : mark.percent\"\n [style.bottom.%]=\"vertical() ? mark.percent : null\"\n ></span>\n }\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.%]=\"vertical() ? null : lowPercent()\"\n [style.bottom.%]=\"vertical() ? lowPercent() : null\"\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-orientation]=\"vertical() ? 'vertical' : null\"\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.%]=\"vertical() ? null : highPercent()\"\n [style.bottom.%]=\"vertical() ? highPercent() : null\"\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-orientation]=\"vertical() ? 'vertical' : null\"\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 (labelledMarks().length) {\n <!-- Hidden from assistive tech: the thumb announces the label of the mark it stands on. -->\n <div class=\"wr-slider__mark-labels\" aria-hidden=\"true\">\n @for (mark of labelledMarks(); track $index) {\n <span\n class=\"wr-slider__mark-label\"\n [attr.data-value]=\"mark.value\"\n [style.inset-inline-start.%]=\"vertical() ? null : mark.percent\"\n [style.bottom.%]=\"vertical() ? mark.percent : null\"\n >{{ mark.label }}</span\n >\n }\n </div>\n}\n\n@if (showValue()) {\n <div class=\"wr-slider__label\" [style.bottom.%]=\"vertical() ? labelPercent() : null\">{{ label() }}</div>\n}\n"],"mappings":";;;;;;;;;;;;;AAyEA,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,OA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AA;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,5 +1,5 @@
1
1
  import * as i0 from "@angular/core";
2
- import { Component, ViewEncapsulation, computed, input, model, output, viewChild } from "@angular/core";
2
+ import { Component, DestroyRef, ViewEncapsulation, afterNextRender, computed, inject, input, model, output, signal, viewChild } from "@angular/core";
3
3
  import { coerceBooleanProperty } from "@angular/cdk/coercion";
4
4
  import { wrCheckStyles, wrRandomId } from "ngwr/utils";
5
5
  import { useFormFieldAria } from "ngwr/form";
@@ -9,9 +9,25 @@ import { useFormFieldAria } from "ngwr/form";
9
9
  * Use of this source code is governed by an MIT-style license that can be
10
10
  * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE
11
11
  */
12
+ function hasNamingText(el) {
13
+ return (el.textContent ?? "").trim() !== "" || el.querySelector("[aria-label], img[alt]:not([alt=\"\"])") !== null;
14
+ }
12
15
  var WrSwitch = class WrSwitch {
13
16
  constructor() {
14
17
  if (typeof ngDevMode === "undefined" || ngDevMode) wrCheckStyles("switch");
18
+ afterNextRender(() => {
19
+ const text = this.textEl().nativeElement;
20
+ const sync = () => this.hasText.set(hasNamingText(text));
21
+ sync();
22
+ if (typeof MutationObserver === "undefined") return;
23
+ const observer = new MutationObserver(sync);
24
+ observer.observe(text, {
25
+ childList: true,
26
+ characterData: true,
27
+ subtree: true
28
+ });
29
+ this.destroyRef.onDestroy(() => observer.disconnect());
30
+ });
15
31
  }
16
32
  ariaLabel = input(null, ...ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []);
17
33
  id = input(wrRandomId("wr-switch"), ...ngDevMode ? [{ debugName: "id" }] : /* istanbul ignore next */ []);
@@ -28,6 +44,10 @@ var WrSwitch = class WrSwitch {
28
44
  checked = model(false, ...ngDevMode ? [{ debugName: "checked" }] : /* istanbul ignore next */ []);
29
45
  touch = output();
30
46
  native = viewChild.required("native", ...ngDevMode ? [{ debugName: "native" }] : /* istanbul ignore next */ []);
47
+ textEl = viewChild.required("text", ...ngDevMode ? [{ debugName: "textEl" }] : /* istanbul ignore next */ []);
48
+ destroyRef = inject(DestroyRef);
49
+ hasText = signal(true, ...ngDevMode ? [{ debugName: "hasText" }] : /* istanbul ignore next */ []);
50
+ labelledBy = computed(() => this.hasText() || this.ariaLabel() ? null : this.fieldAria.labelledBy(), ...ngDevMode ? [{ debugName: "labelledBy" }] : /* istanbul ignore next */ []);
31
51
  classes = computed(() => {
32
52
  const parts = [];
33
53
  const size = this.size();
@@ -128,9 +148,15 @@ var WrSwitch = class WrSwitch {
128
148
  predicate: ["native"],
129
149
  descendants: true,
130
150
  isSignal: true
151
+ }, {
152
+ propertyName: "textEl",
153
+ first: true,
154
+ predicate: ["text"],
155
+ descendants: true,
156
+ isSignal: true
131
157
  }],
132
158
  ngImport: i0,
133
- template: "<label class=\"wr-switch__label\" [for]=\"id()\">\n <input\n #native\n class=\"wr-switch__input\"\n type=\"checkbox\"\n role=\"switch\"\n [id]=\"id()\"\n [attr.aria-label]=\"ariaLabel()\"\n [checked]=\"checked()\"\n [disabled]=\"disabled()\"\n [attr.aria-readonly]=\"readonly() || null\"\n [attr.aria-invalid]=\"fieldAria.ariaInvalid()\"\n [attr.aria-required]=\"fieldAria.ariaRequired()\"\n [attr.aria-describedby]=\"fieldAria.describedBy()\"\n (click)=\"onInputClick($event)\"\n (change)=\"onInputChange($event)\"\n (blur)=\"onInputBlur()\"\n />\n\n <span class=\"wr-switch__track\" aria-hidden=\"true\">\n <span class=\"wr-switch__thumb\"></span>\n </span>\n\n <span class=\"wr-switch__text\">\n <ng-content />\n </span>\n</label>\n",
159
+ template: "<label class=\"wr-switch__label\" [for]=\"id()\">\n <input\n #native\n class=\"wr-switch__input\"\n type=\"checkbox\"\n role=\"switch\"\n [id]=\"id()\"\n [attr.aria-label]=\"ariaLabel()\"\n [attr.aria-labelledby]=\"labelledBy()\"\n [checked]=\"checked()\"\n [disabled]=\"disabled()\"\n [attr.aria-readonly]=\"readonly() || null\"\n [attr.aria-invalid]=\"fieldAria.ariaInvalid()\"\n [attr.aria-required]=\"fieldAria.ariaRequired()\"\n [attr.aria-describedby]=\"fieldAria.describedBy()\"\n (click)=\"onInputClick($event)\"\n (change)=\"onInputChange($event)\"\n (blur)=\"onInputBlur()\"\n />\n\n <span class=\"wr-switch__track\" aria-hidden=\"true\">\n <span class=\"wr-switch__thumb\"></span>\n </span>\n\n <span #text class=\"wr-switch__text\">\n <ng-content />\n </span>\n</label>\n",
134
160
  encapsulation: i0.ViewEncapsulation.None
135
161
  });
136
162
  };
@@ -149,7 +175,7 @@ i0.ɵɵngDeclareClassMetadata({
149
175
  "[class]": "classes()",
150
176
  "[attr.id]": "null"
151
177
  },
152
- template: "<label class=\"wr-switch__label\" [for]=\"id()\">\n <input\n #native\n class=\"wr-switch__input\"\n type=\"checkbox\"\n role=\"switch\"\n [id]=\"id()\"\n [attr.aria-label]=\"ariaLabel()\"\n [checked]=\"checked()\"\n [disabled]=\"disabled()\"\n [attr.aria-readonly]=\"readonly() || null\"\n [attr.aria-invalid]=\"fieldAria.ariaInvalid()\"\n [attr.aria-required]=\"fieldAria.ariaRequired()\"\n [attr.aria-describedby]=\"fieldAria.describedBy()\"\n (click)=\"onInputClick($event)\"\n (change)=\"onInputChange($event)\"\n (blur)=\"onInputBlur()\"\n />\n\n <span class=\"wr-switch__track\" aria-hidden=\"true\">\n <span class=\"wr-switch__thumb\"></span>\n </span>\n\n <span class=\"wr-switch__text\">\n <ng-content />\n </span>\n</label>\n"
178
+ template: "<label class=\"wr-switch__label\" [for]=\"id()\">\n <input\n #native\n class=\"wr-switch__input\"\n type=\"checkbox\"\n role=\"switch\"\n [id]=\"id()\"\n [attr.aria-label]=\"ariaLabel()\"\n [attr.aria-labelledby]=\"labelledBy()\"\n [checked]=\"checked()\"\n [disabled]=\"disabled()\"\n [attr.aria-readonly]=\"readonly() || null\"\n [attr.aria-invalid]=\"fieldAria.ariaInvalid()\"\n [attr.aria-required]=\"fieldAria.ariaRequired()\"\n [attr.aria-describedby]=\"fieldAria.describedBy()\"\n (click)=\"onInputClick($event)\"\n (change)=\"onInputChange($event)\"\n (blur)=\"onInputBlur()\"\n />\n\n <span class=\"wr-switch__track\" aria-hidden=\"true\">\n <span class=\"wr-switch__thumb\"></span>\n </span>\n\n <span #text class=\"wr-switch__text\">\n <ng-content />\n </span>\n</label>\n"
153
179
  }]
154
180
  }],
155
181
  ctorParameters: () => [],
@@ -212,6 +238,10 @@ i0.ɵɵngDeclareClassMetadata({
212
238
  native: [{
213
239
  type: i0.ViewChild,
214
240
  args: ["native", { isSignal: true }]
241
+ }],
242
+ textEl: [{
243
+ type: i0.ViewChild,
244
+ args: ["text", { isSignal: true }]
215
245
  }]
216
246
  }
217
247
  });
@@ -1 +1 @@
1
- {"version":3,"file":"ngwr-switch.mjs","names":[],"sources":["../../../projects/lib/switch/switch.ts","../../../projects/lib/switch/switch.html"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { coerceBooleanProperty } from '@angular/cdk/coercion';\nimport {\n Component,\n type ElementRef,\n ViewEncapsulation,\n computed,\n input,\n model,\n output,\n viewChild,\n} from '@angular/core';\nimport type { FormCheckboxControl } from '@angular/forms/signals';\n\nimport { useFormFieldAria } from 'ngwr/form';\nimport { wrRandomId, wrCheckStyles } from 'ngwr/utils';\n\n/**\n * Boolean toggle with an iOS-style slider.\n *\n * A signal-forms native control: it implements `FormCheckboxControl`, so\n * `[formField]` binds straight to its `checked` model — no\n * `ControlValueAccessor` in between. `[(checked)]` works standalone.\n *\n * @example\n * ```html\n * <!-- signal forms -->\n * <wr-switch [formField]=\"form.notifications\">Notifications</wr-switch>\n *\n * <!-- standalone two-way binding -->\n * <wr-switch [(checked)]=\"enabled\">Notifications</wr-switch>\n * ```\n *\n * @see https://ngwr.dev/reference/components/switch\n */\nexport type WrSwitchSize = 'sm' | 'md' | 'lg';\n\n@Component({\n selector: 'wr-switch',\n templateUrl: './switch.html',\n encapsulation: ViewEncapsulation.None,\n host: {\n class: 'wr-switch',\n '[class]': 'classes()',\n // The `id` input belongs to the native input, not to this element — a static\n // `id=\"x\"` would otherwise be written here too and leave the document with\n // two elements sharing it, which is what broke `<label for>`.\n '[attr.id]': 'null',\n },\n})\nexport class WrSwitch implements FormCheckboxControl {\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('switch');\n }\n\n /**\n * Accessible name for a switch used WITHOUT projected text. The wrapping\n * `<label>` names the control whenever content is projected; with none, the\n * label is empty and the input has no name at all.\n */\n readonly ariaLabel = input<string | null>(null);\n\n /**\n * Stable id used to associate the native input with its label. Lands on the\n * inner `<input>`; the host never keeps it.\n */\n readonly id = input<string>(wrRandomId('wr-switch'));\n\n /**\n * Disable the switch. 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 edits while staying focusable and submittable. Bound automatically\n * from the field's readonly state when used with `[formField]`.\n *\n * A native checkbox ignores the `readonly` attribute, so this cancels the\n * click's activation behaviour instead — which covers Space too, since the key\n * arrives as a click — and mirrors the state as `aria-readonly`, which role\n * `switch` supports.\n *\n * @default false\n */\n readonly readonly = input(false, { transform: coerceBooleanProperty });\n\n /** The surrounding `<wr-form-field>`'s error state. @internal */\n protected readonly fieldAria = useFormFieldAria();\n\n /** Control size — shares the `--wr-control-*` contract. @default 'md' */\n readonly size = input<WrSwitchSize>('md');\n\n /** On / off state. Bound by `[formField]`, or two-way via `[(checked)]`. */\n readonly checked = model<boolean>(false);\n\n /** Emitted on blur so a bound field can mark itself touched. */\n readonly touch = output<void>();\n\n private readonly native = viewChild.required<ElementRef<HTMLInputElement>>('native');\n\n protected readonly classes = computed(() => {\n const parts: string[] = [];\n const size = this.size();\n if (size !== 'md') parts.push(`wr-switch--${size}`);\n if (this.checked()) parts.push('wr-switch--checked');\n if (this.disabled()) parts.push('wr-switch--disabled');\n else if (this.readonly()) parts.push('wr-switch--readonly');\n return parts.join(' ');\n });\n\n /**\n * Focus the switch — what Signal Forms calls to focus this control. The native\n * input takes it, since the host has no tab stop of its own; a disabled switch\n * refuses, as a disabled input always does.\n */\n focus(options?: FocusOptions): void {\n this.native().nativeElement.focus(options);\n }\n\n // Template handlers\n\n /**\n * Cancel the toggle while readonly. `change` never fires for a click whose\n * default was prevented, so this is the only guard the pointer and Space paths\n * need; `onInputChange` keeps its own for a synthetic `change`.\n */\n protected onInputClick(event: Event): void {\n if (this.readonly()) event.preventDefault();\n }\n\n protected onInputChange(event: Event): void {\n if (this.readonly()) {\n // A synthetic `change` cannot be prevented — put the DOM back instead.\n (event.target as HTMLInputElement).checked = this.checked();\n return;\n }\n this.checked.set((event.target as HTMLInputElement).checked);\n }\n\n protected onInputBlur(): void {\n this.touch.emit();\n }\n}\n","<label class=\"wr-switch__label\" [for]=\"id()\">\n <input\n #native\n class=\"wr-switch__input\"\n type=\"checkbox\"\n role=\"switch\"\n [id]=\"id()\"\n [attr.aria-label]=\"ariaLabel()\"\n [checked]=\"checked()\"\n [disabled]=\"disabled()\"\n [attr.aria-readonly]=\"readonly() || null\"\n [attr.aria-invalid]=\"fieldAria.ariaInvalid()\"\n [attr.aria-required]=\"fieldAria.ariaRequired()\"\n [attr.aria-describedby]=\"fieldAria.describedBy()\"\n (click)=\"onInputClick($event)\"\n (change)=\"onInputChange($event)\"\n (blur)=\"onInputBlur()\"\n />\n\n <span class=\"wr-switch__track\" aria-hidden=\"true\">\n <span class=\"wr-switch__thumb\"></span>\n </span>\n\n <span class=\"wr-switch__text\">\n <ng-content />\n </span>\n</label>\n"],"mappings":";;;;;;;;;;;AAwDA,IAAa,WAAb,MAAa,SAAQ;CACnB,cAAA;EACE,IAAI,OAAO,cAAc,eAAe,WAAW,cAAc,QAAQ;CAC3E;CAOS,YAAY,MAAqB,MAAK,GAAA,YAAA,CAAA,EAAA,WAAA,YAAA,CAAA,+BAAA,CAAA,CAAA;CAMtC,KAAK,MAAc,WAAW,WAAW,GAAE,GAAA,YAAA,CAAA,EAAA,WAAA,KAAA,CAAA,+BAAA,CAAA,CAAA;CAQ3C,WAAW,MAAM,OAAK;EAAA,GAAA,YAAA,EAAA,WAAA,WAAA,+BAAA,CAAA;EAAI,WAAW;CAAqB,CAAA;CAa1D,WAAW,MAAM,OAAK;EAAA,GAAA,YAAA,EAAA,WAAA,WAAA,+BAAA,CAAA;EAAI,WAAW;CAAqB,CAAA;CAGhD,YAAY,iBAAgB;CAGtC,OAAO,MAAoB,MAAK,GAAA,YAAA,CAAA,EAAA,WAAA,OAAA,CAAA,+BAAA,CAAA,CAAA;CAGhC,UAAU,MAAe,OAAM,GAAA,YAAA,CAAA,EAAA,WAAA,UAAA,CAAA,+BAAA,CAAA,CAAA;CAG/B,QAAQ,OAAM;CAEN,SAAS,UAAU,SAAuC,UAAS,GAAA,YAAA,CAAA,EAAA,WAAA,SAAA,CAAA,+BAAA,CAAA,CAAA;CAEjE,UAAU,eAAc;EACzC,MAAM,QAAkB,CAAA;EACxB,MAAM,OAAO,KAAK,KAAI;EACtB,IAAI,SAAS,MAAM,MAAM,KAAK,cAAc,MAAM;EAClD,IAAI,KAAK,QAAO,GAAI,MAAM,KAAK,oBAAoB;EACnD,IAAI,KAAK,SAAQ,GAAI,MAAM,KAAK,qBAAqB;OAChD,IAAI,KAAK,S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;GAAA,MAAA,CAAA,eAAA;EAAA,CAAA;EAAA,OAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,OAAA;EAAA,CAAA;EAAA,QAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,UAAQ,EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;CAAA;AAAA,CAAA"}
1
+ {"version":3,"file":"ngwr-switch.mjs","names":[],"sources":["../../../projects/lib/switch/switch.ts","../../../projects/lib/switch/switch.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 DestroyRef,\n type ElementRef,\n ViewEncapsulation,\n afterNextRender,\n computed,\n inject,\n input,\n model,\n output,\n signal,\n viewChild,\n} from '@angular/core';\nimport type { FormCheckboxControl } from '@angular/forms/signals';\n\nimport { useFormFieldAria } from 'ngwr/form';\nimport { wrRandomId, wrCheckStyles } from 'ngwr/utils';\n\n/** Whether `el` holds text, or an element with a name of its own, that can label a control. */\nfunction hasNamingText(el: HTMLElement): boolean {\n return (el.textContent ?? '').trim() !== '' || el.querySelector('[aria-label], img[alt]:not([alt=\"\"])') !== null;\n}\n\n/**\n * Boolean toggle with an iOS-style slider.\n *\n * A signal-forms native control: it implements `FormCheckboxControl`, so\n * `[formField]` binds straight to its `checked` model — no\n * `ControlValueAccessor` in between. `[(checked)]` works standalone.\n *\n * @example\n * ```html\n * <!-- signal forms -->\n * <wr-switch [formField]=\"form.notifications\">Notifications</wr-switch>\n *\n * <!-- standalone two-way binding -->\n * <wr-switch [(checked)]=\"enabled\">Notifications</wr-switch>\n * ```\n *\n * @see https://ngwr.dev/reference/components/switch\n */\nexport type WrSwitchSize = 'sm' | 'md' | 'lg';\n\n@Component({\n selector: 'wr-switch',\n templateUrl: './switch.html',\n encapsulation: ViewEncapsulation.None,\n host: {\n class: 'wr-switch',\n '[class]': 'classes()',\n // The `id` input belongs to the native input, not to this element — a static\n // `id=\"x\"` would otherwise be written here too and leave the document with\n // two elements sharing it, which is what broke `<label for>`.\n '[attr.id]': 'null',\n },\n})\nexport class WrSwitch implements FormCheckboxControl {\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('switch');\n\n afterNextRender(() => {\n const text = this.textEl().nativeElement;\n const sync = (): void => this.hasText.set(hasNamingText(text));\n sync();\n if (typeof MutationObserver === 'undefined') return;\n const observer = new MutationObserver(sync);\n observer.observe(text, { childList: true, characterData: true, subtree: true });\n this.destroyRef.onDestroy(() => observer.disconnect());\n });\n }\n\n /**\n * Accessible name for a switch used WITHOUT projected text. The wrapping\n * `<label>` names the control whenever content is projected; with none, the\n * label is empty and the input has no name at all.\n */\n readonly ariaLabel = input<string | null>(null);\n\n /**\n * Stable id used to associate the native input with its label. Lands on the\n * inner `<input>`; the host never keeps it.\n */\n readonly id = input<string>(wrRandomId('wr-switch'));\n\n /**\n * Disable the switch. 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 edits while staying focusable and submittable. Bound automatically\n * from the field's readonly state when used with `[formField]`.\n *\n * A native checkbox ignores the `readonly` attribute, so this cancels the\n * click's activation behaviour instead — which covers Space too, since the key\n * arrives as a click — and mirrors the state as `aria-readonly`, which role\n * `switch` supports.\n *\n * @default false\n */\n readonly readonly = input(false, { transform: coerceBooleanProperty });\n\n /** The surrounding `<wr-form-field>`'s error state. @internal */\n protected readonly fieldAria = useFormFieldAria();\n\n /** Control size — shares the `--wr-control-*` contract. @default 'md' */\n readonly size = input<WrSwitchSize>('md');\n\n /** On / off state. Bound by `[formField]`, or two-way via `[(checked)]`. */\n readonly checked = model<boolean>(false);\n\n /** Emitted on blur so a bound field can mark itself touched. */\n readonly touch = output<void>();\n\n private readonly native = viewChild.required<ElementRef<HTMLInputElement>>('native');\n private readonly textEl = viewChild.required<ElementRef<HTMLElement>>('text');\n private readonly destroyRef = inject(DestroyRef);\n\n /**\n * Whether the projected content names the switch. Assumed `true` until the\n * first render has looked, so the server renders the own-label path.\n */\n private readonly hasText = signal(true);\n\n /**\n * The input's `aria-labelledby`: the surrounding field's label, only for a\n * switch with no text of its own and no `ariaLabel`. With text, that text is\n * the name and the field's label is not joined to it.\n */\n protected readonly labelledBy = computed(() =>\n this.hasText() || this.ariaLabel() ? null : this.fieldAria.labelledBy()\n );\n\n protected readonly classes = computed(() => {\n const parts: string[] = [];\n const size = this.size();\n if (size !== 'md') parts.push(`wr-switch--${size}`);\n if (this.checked()) parts.push('wr-switch--checked');\n if (this.disabled()) parts.push('wr-switch--disabled');\n else if (this.readonly()) parts.push('wr-switch--readonly');\n return parts.join(' ');\n });\n\n /**\n * Focus the switch — what Signal Forms calls to focus this control. The native\n * input takes it, since the host has no tab stop of its own; a disabled switch\n * refuses, as a disabled input always does.\n */\n focus(options?: FocusOptions): void {\n this.native().nativeElement.focus(options);\n }\n\n // Template handlers\n\n /**\n * Cancel the toggle while readonly. `change` never fires for a click whose\n * default was prevented, so this is the only guard the pointer and Space paths\n * need; `onInputChange` keeps its own for a synthetic `change`.\n */\n protected onInputClick(event: Event): void {\n if (this.readonly()) event.preventDefault();\n }\n\n protected onInputChange(event: Event): void {\n if (this.readonly()) {\n // A synthetic `change` cannot be prevented — put the DOM back instead.\n (event.target as HTMLInputElement).checked = this.checked();\n return;\n }\n this.checked.set((event.target as HTMLInputElement).checked);\n }\n\n protected onInputBlur(): void {\n this.touch.emit();\n }\n}\n","<label class=\"wr-switch__label\" [for]=\"id()\">\n <input\n #native\n class=\"wr-switch__input\"\n type=\"checkbox\"\n role=\"switch\"\n [id]=\"id()\"\n [attr.aria-label]=\"ariaLabel()\"\n [attr.aria-labelledby]=\"labelledBy()\"\n [checked]=\"checked()\"\n [disabled]=\"disabled()\"\n [attr.aria-readonly]=\"readonly() || null\"\n [attr.aria-invalid]=\"fieldAria.ariaInvalid()\"\n [attr.aria-required]=\"fieldAria.ariaRequired()\"\n [attr.aria-describedby]=\"fieldAria.describedBy()\"\n (click)=\"onInputClick($event)\"\n (change)=\"onInputChange($event)\"\n (blur)=\"onInputBlur()\"\n />\n\n <span class=\"wr-switch__track\" aria-hidden=\"true\">\n <span class=\"wr-switch__thumb\"></span>\n </span>\n\n <span #text class=\"wr-switch__text\">\n <ng-content />\n </span>\n</label>\n"],"mappings":";;;;;;;;;;;AA4BA,SAAS,cAAc,IAAe;CACpC,QAAQ,GAAG,eAAe,GAAA,CAAI,KAAI,MAAO,MAAM,GAAG,cAAc,wCAAsC,MAAM;AAC9G;AAmCA,IAAa,WAAb,MAAa,SAAQ;CACnB,cAAA;EACE,IAAI,OAAO,cAAc,eAAe,WAAW,cAAc,QAAQ;EAEzE,sBAAqB;GACnB,MAAM,OAAO,KAAK,OAAM,CAAE,CAAC;GAC3B,MAAM,aAAmB,KAAK,QAAQ,IAAI,cAAc,IAAI,CAAC;GAC7D,KAAI;GACJ,IAAI,OAAO,qBAAqB,aAAa;GAC7C,MAAM,WAAW,IAAI,iBAAiB,IAAI;GAC1C,SAAS,QAAQ,MAAM;IAAE,WAAW;IAAM,eAAe;IAAM,SAAS;GAAI,CAAE;GAC9E,KAAK,WAAW,gBAAgB,SAAS,WAAU,CAAE;EACvD,CAAC;CACH;CAOS,YAAY,MAAqB,MAAK,GAAA,YAAA,CAAA,EAAA,WAAA,YAAA,CAAA,+BAAA,CAAA,CAAA;CAMtC,KAAK,MAAc,WAAW,WAAW,GAAE,GAAA,YAAA,CAAA,EAAA,WAAA,KAAA,CAAA,+BAAA,CAAA,CAAA;CAQ3C,WAAW,MAAM,OAAK;EAAA,GAAA,YAAA,EAAA,WAAA,WAAA,+BAAA,CAAA;EAAI,WAAW;CAAqB,CAAA;CAa1D,WAAW,MAAM,OAAK;EAAA,GAAA,YAAA,EAAA,WAAA,WAAA,+BAAA,CAAA;EAAI,WAAW;CAAqB,C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