ngwr 16.7.1 → 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 (148) 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/command-palette/styles/_index.scss +10 -0
  5. package/fesm2022/ngwr-charts-calendar-heatmap.mjs +3 -1
  6. package/fesm2022/ngwr-charts-calendar-heatmap.mjs.map +1 -1
  7. package/fesm2022/ngwr-charts-core.mjs +17 -0
  8. package/fesm2022/ngwr-charts-core.mjs.map +1 -1
  9. package/fesm2022/ngwr-charts-donut-chart-testing.mjs +27 -0
  10. package/fesm2022/ngwr-charts-donut-chart-testing.mjs.map +1 -1
  11. package/fesm2022/ngwr-charts-donut-chart.mjs +54 -6
  12. package/fesm2022/ngwr-charts-donut-chart.mjs.map +1 -1
  13. package/fesm2022/ngwr-charts-meter-group-testing.mjs +27 -0
  14. package/fesm2022/ngwr-charts-meter-group-testing.mjs.map +1 -1
  15. package/fesm2022/ngwr-charts-meter-group.mjs +54 -6
  16. package/fesm2022/ngwr-charts-meter-group.mjs.map +1 -1
  17. package/fesm2022/ngwr-charts-sparkline-testing.mjs +27 -0
  18. package/fesm2022/ngwr-charts-sparkline-testing.mjs.map +1 -1
  19. package/fesm2022/ngwr-charts-sparkline.mjs +45 -4
  20. package/fesm2022/ngwr-charts-sparkline.mjs.map +1 -1
  21. package/fesm2022/ngwr-checkbox.mjs +38 -3
  22. package/fesm2022/ngwr-checkbox.mjs.map +1 -1
  23. package/fesm2022/ngwr-color-picker-testing.mjs.map +1 -1
  24. package/fesm2022/ngwr-color-picker.mjs +4 -3
  25. package/fesm2022/ngwr-color-picker.mjs.map +1 -1
  26. package/fesm2022/ngwr-command-palette.mjs +39 -19
  27. package/fesm2022/ngwr-command-palette.mjs.map +1 -1
  28. package/fesm2022/ngwr-context-menu.mjs +7 -2
  29. package/fesm2022/ngwr-context-menu.mjs.map +1 -1
  30. package/fesm2022/ngwr-dialog.mjs +10 -7
  31. package/fesm2022/ngwr-dialog.mjs.map +1 -1
  32. package/fesm2022/ngwr-drawer.mjs +14 -8
  33. package/fesm2022/ngwr-drawer.mjs.map +1 -1
  34. package/fesm2022/ngwr-file-upload.mjs +2 -2
  35. package/fesm2022/ngwr-file-upload.mjs.map +1 -1
  36. package/fesm2022/ngwr-i18n-ar.mjs +9 -2
  37. package/fesm2022/ngwr-i18n-ar.mjs.map +1 -1
  38. package/fesm2022/ngwr-i18n-cs.mjs +9 -2
  39. package/fesm2022/ngwr-i18n-cs.mjs.map +1 -1
  40. package/fesm2022/ngwr-i18n-de.mjs +9 -2
  41. package/fesm2022/ngwr-i18n-de.mjs.map +1 -1
  42. package/fesm2022/ngwr-i18n-en.mjs +9 -2
  43. package/fesm2022/ngwr-i18n-en.mjs.map +1 -1
  44. package/fesm2022/ngwr-i18n-es.mjs +9 -2
  45. package/fesm2022/ngwr-i18n-es.mjs.map +1 -1
  46. package/fesm2022/ngwr-i18n-fr.mjs +9 -2
  47. package/fesm2022/ngwr-i18n-fr.mjs.map +1 -1
  48. package/fesm2022/ngwr-i18n-he.mjs +9 -2
  49. package/fesm2022/ngwr-i18n-he.mjs.map +1 -1
  50. package/fesm2022/ngwr-i18n-hi.mjs +9 -2
  51. package/fesm2022/ngwr-i18n-hi.mjs.map +1 -1
  52. package/fesm2022/ngwr-i18n-id.mjs +9 -2
  53. package/fesm2022/ngwr-i18n-id.mjs.map +1 -1
  54. package/fesm2022/ngwr-i18n-it.mjs +9 -2
  55. package/fesm2022/ngwr-i18n-it.mjs.map +1 -1
  56. package/fesm2022/ngwr-i18n-ja.mjs +9 -2
  57. package/fesm2022/ngwr-i18n-ja.mjs.map +1 -1
  58. package/fesm2022/ngwr-i18n-kk.mjs +9 -2
  59. package/fesm2022/ngwr-i18n-kk.mjs.map +1 -1
  60. package/fesm2022/ngwr-i18n-ko.mjs +9 -2
  61. package/fesm2022/ngwr-i18n-ko.mjs.map +1 -1
  62. package/fesm2022/ngwr-i18n-nl.mjs +9 -2
  63. package/fesm2022/ngwr-i18n-nl.mjs.map +1 -1
  64. package/fesm2022/ngwr-i18n-pl.mjs +9 -2
  65. package/fesm2022/ngwr-i18n-pl.mjs.map +1 -1
  66. package/fesm2022/ngwr-i18n-pt.mjs +9 -2
  67. package/fesm2022/ngwr-i18n-pt.mjs.map +1 -1
  68. package/fesm2022/ngwr-i18n-ru.mjs +9 -2
  69. package/fesm2022/ngwr-i18n-ru.mjs.map +1 -1
  70. package/fesm2022/ngwr-i18n-sv.mjs +9 -2
  71. package/fesm2022/ngwr-i18n-sv.mjs.map +1 -1
  72. package/fesm2022/ngwr-i18n-tr.mjs +9 -2
  73. package/fesm2022/ngwr-i18n-tr.mjs.map +1 -1
  74. package/fesm2022/ngwr-i18n-uk.mjs +9 -2
  75. package/fesm2022/ngwr-i18n-uk.mjs.map +1 -1
  76. package/fesm2022/ngwr-i18n-vi.mjs +9 -2
  77. package/fesm2022/ngwr-i18n-vi.mjs.map +1 -1
  78. package/fesm2022/ngwr-i18n-zh-tw.mjs +9 -2
  79. package/fesm2022/ngwr-i18n-zh-tw.mjs.map +1 -1
  80. package/fesm2022/ngwr-i18n-zh.mjs +9 -2
  81. package/fesm2022/ngwr-i18n-zh.mjs.map +1 -1
  82. package/fesm2022/ngwr-input-number.mjs +33 -10
  83. package/fesm2022/ngwr-input-number.mjs.map +1 -1
  84. package/fesm2022/ngwr-input-otp.mjs +24 -10
  85. package/fesm2022/ngwr-input-otp.mjs.map +1 -1
  86. package/fesm2022/ngwr-input.mjs +2 -2
  87. package/fesm2022/ngwr-input.mjs.map +1 -1
  88. package/fesm2022/ngwr-lightbox.mjs +5 -3
  89. package/fesm2022/ngwr-lightbox.mjs.map +1 -1
  90. package/fesm2022/ngwr-overlay.mjs +51 -2
  91. package/fesm2022/ngwr-overlay.mjs.map +1 -1
  92. package/fesm2022/ngwr-popconfirm.mjs +2 -2
  93. package/fesm2022/ngwr-popconfirm.mjs.map +1 -1
  94. package/fesm2022/ngwr-slider.mjs +22 -17
  95. package/fesm2022/ngwr-slider.mjs.map +1 -1
  96. package/fesm2022/ngwr-switch.mjs +33 -3
  97. package/fesm2022/ngwr-switch.mjs.map +1 -1
  98. package/fesm2022/ngwr-tour.mjs +8 -3
  99. package/fesm2022/ngwr-tour.mjs.map +1 -1
  100. package/fesm2022/ngwr-version.mjs +1 -1
  101. package/fesm2022/ngwr-version.mjs.map +1 -1
  102. package/i18n/ar.json +9 -2
  103. package/i18n/cs.json +9 -2
  104. package/i18n/de.json +9 -2
  105. package/i18n/en.json +9 -2
  106. package/i18n/es.json +9 -2
  107. package/i18n/fr.json +9 -2
  108. package/i18n/he.json +9 -2
  109. package/i18n/hi.json +9 -2
  110. package/i18n/id.json +9 -2
  111. package/i18n/it.json +9 -2
  112. package/i18n/ja.json +9 -2
  113. package/i18n/kk.json +9 -2
  114. package/i18n/ko.json +9 -2
  115. package/i18n/nl.json +9 -2
  116. package/i18n/pl.json +9 -2
  117. package/i18n/pt.json +9 -2
  118. package/i18n/ru.json +9 -2
  119. package/i18n/sv.json +9 -2
  120. package/i18n/tr.json +9 -2
  121. package/i18n/uk.json +9 -2
  122. package/i18n/vi.json +9 -2
  123. package/i18n/zh-TW.json +9 -2
  124. package/i18n/zh.json +9 -2
  125. package/llms-full.txt +4 -4
  126. package/package.json +1 -1
  127. package/schematics/use/rule.js +1 -0
  128. package/schematics/use/symbol-map.json +1 -0
  129. package/tour/styles/_index.scss +11 -7
  130. package/types/ngwr-charts-donut-chart-testing.d.ts +32 -3
  131. package/types/ngwr-charts-donut-chart.d.ts +45 -6
  132. package/types/ngwr-charts-meter-group-testing.d.ts +29 -1
  133. package/types/ngwr-charts-meter-group.d.ts +43 -4
  134. package/types/ngwr-charts-sparkline-testing.d.ts +32 -2
  135. package/types/ngwr-charts-sparkline.d.ts +42 -3
  136. package/types/ngwr-checkbox.d.ts +14 -0
  137. package/types/ngwr-color-picker-testing.d.ts +1 -1
  138. package/types/ngwr-command-palette.d.ts +2 -1
  139. package/types/ngwr-dialog.d.ts +11 -6
  140. package/types/ngwr-drawer.d.ts +12 -4
  141. package/types/ngwr-file-upload.d.ts +1 -1
  142. package/types/ngwr-input-number.d.ts +14 -2
  143. package/types/ngwr-input-otp.d.ts +2 -0
  144. package/types/ngwr-lightbox.d.ts +1 -0
  145. package/types/ngwr-overlay.d.ts +20 -1
  146. package/types/ngwr-slider.d.ts +3 -1
  147. package/types/ngwr-switch.d.ts +13 -0
  148. package/types/ngwr-version.d.ts +1 -1
@@ -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,MAAM,IAAI,KAAK,IAAG;EAClB,OAAO,OAAO,MAAM,WAAW,IAAI;CACrC,GAAE,GAAA,YAAA,CAAA,EAAA,WAAA,WAAA,CAAA,+BAAA,CAAA,CAAA;CAGO,OAAO,MAAM,GAAC;EAAA,GAAA,YAAA,EAAA,WAAA,OAAA,+BAAA,CAAA;EAAI,YAAY,MAAuB,KAAK,IAAI,MAAQ,qBAAqB,GAAG,CAAC,CAAC;CAAC,CAAA;CAEjG,QAAQ,MAAM,OAAK;EAAA,GAAA,YAAA,EAAA,WAAA,QAAA,+BAAA,CAAA;EAAI,WAAW;CAAqB,CAAA;CAOvD,WAAW,MAAM,OAAK;EAAA,GAAA,YAAA,EAAA,WAAA,WAAA,+BAAA,CAAA;EAAI,WAA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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,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, 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,CAA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;EAAA,CAAA;CAqD0E,CAAA;CAAA,sBAAA,CAAA;CAAA,gBAAA;EAAA,WAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,IAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,UAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,UAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,MAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,SAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,GAAA;GAAA,MAAA,GAAA;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,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;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,UAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,UAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,MAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,SAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,GAAA;GAAA,MAAA,GAAA;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;EAAA,QAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CACb,QAAM,EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;CAAA;AAAA,CAAA"}
@@ -1,7 +1,7 @@
1
1
  import * as i0 from "@angular/core";
2
2
  import { Component, DOCUMENT, DestroyRef, EnvironmentInjector, InjectionToken, Injector, PLATFORM_ID, Service, ViewEncapsulation, computed, inject, signal } from "@angular/core";
3
3
  import { Location, isPlatformBrowser } from "@angular/common";
4
- import { wrCheckStyles, wrRandomId, wrRestoreFocus, wrToClassList } from "ngwr/utils";
4
+ import { wrCheckStyles, wrIsComposing, wrRandomId, wrRestoreFocus, wrToClassList } from "ngwr/utils";
5
5
  import { useI18nFormatter, wrReadI18nText } from "ngwr/i18n";
6
6
  import { Directionality } from "@angular/cdk/bidi";
7
7
  import { WrButton } from "ngwr/button";
@@ -257,15 +257,20 @@ var WrTour = class WrTour {
257
257
  openStep(step, hadFocus) {
258
258
  const target = this.resolve(step);
259
259
  if (!target) return;
260
+ const reduced = this.document.defaultView?.matchMedia?.("(prefers-reduced-motion: reduce)").matches;
260
261
  target.scrollIntoView({
261
262
  block: "center",
262
263
  inline: "nearest",
263
- behavior: "smooth"
264
+ behavior: reduced ? "instant" : "smooth"
264
265
  });
265
266
  const spotlight = this.document.createElement("div");
266
267
  spotlight.className = "wr-tour__spotlight";
267
268
  spotlight.setAttribute("aria-hidden", "true");
268
269
  this.document.body.appendChild(spotlight);
270
+ if (typeof spotlight.showPopover === "function") {
271
+ spotlight.setAttribute("popover", "manual");
272
+ spotlight.showPopover();
273
+ }
269
274
  this.spotlight = spotlight;
270
275
  this.placeSpotlight(target);
271
276
  const placement = step.placement ?? "bottom";
@@ -290,7 +295,7 @@ var WrTour = class WrTour {
290
295
  this.focusTrap = this.focusTrapFactory.create(card);
291
296
  wrFocusOverlay(card, this.focusTrap, this.autoFocus === false && hadFocus ? "dialog" : this.autoFocus, this.injector);
292
297
  const onKey = (event) => {
293
- if (event.key === "Escape" && !event.defaultPrevented) {
298
+ if (event.key === "Escape" && !event.defaultPrevented && !wrIsComposing(event)) {
294
299
  event.preventDefault();
295
300
  this.stop();
296
301
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ngwr-tour.mjs","names":[],"sources":["../../../projects/lib/tour/tour-popup.ts","../../../projects/lib/tour/tour-popup.html","../../../projects/lib/tour/tour.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 { Component, InjectionToken, ViewEncapsulation, computed, inject } from '@angular/core';\n\nimport { WrButton } from 'ngwr/button';\nimport { wrReadI18nText, useI18nFormatter } from 'ngwr/i18n';\nimport { wrCheckStyles, wrRandomId } from 'ngwr/utils';\n\nimport type { WrTourStep } from './types';\n\n/** What the popup needs from the running tour, without importing the service (cycle). */\nexport interface WrTourController {\n readonly index: () => number;\n readonly total: () => number;\n readonly step: () => WrTourStep | null;\n /**\n * Whether this is the last step the user will actually see — the service looks\n * ahead for a reachable one, because a trailing step whose target is missing gets\n * skipped and the raw count would call the final card \"Next\".\n */\n readonly isLast: () => boolean;\n /**\n * Whether this is the first step the user will actually see — the service looks\n * BEHIND for a reachable one, for the mirror reason: a leading step whose target\n * is missing gets skipped, so the tour opens on a later index and the raw one\n * would put a Back button on the very first card.\n */\n readonly isFirst: () => boolean;\n /** Whether the card opens with focus on Next: the tour's `autoFocus` is `'first-tabbable'`. */\n readonly focusNext: () => boolean;\n next(): void;\n prev(): void;\n stop(): void;\n}\n\n/** Provided by `WrTour` when it attaches the popup portal. */\nexport const WR_TOUR_STEP = new InjectionToken<WrTourController>('WR_TOUR_STEP');\n\n/**\n * The card a tour shows next to the spotlit element. Rendered by `WrTour` into\n * a CDK overlay — not something you place yourself.\n *\n * @see https://ngwr.dev/reference/services/tour\n */\n@Component({\n selector: 'wr-tour-popup',\n templateUrl: './tour-popup.html',\n encapsulation: ViewEncapsulation.None,\n host: {\n class: 'wr-tour-popup',\n role: 'dialog',\n 'aria-modal': 'true',\n '[attr.aria-labelledby]': 'labelledBy()',\n '[attr.aria-describedby]': 'contentId',\n },\n imports: [WrButton],\n})\nexport class WrTourPopup {\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('tour');\n }\n\n protected readonly tour = inject(WR_TOUR_STEP);\n\n // `wrReadI18nText`, not `useI18nText`: these have no consumer-facing input to\n // forward. Both helpers are reactive.\n protected readonly nextLabel = wrReadI18nText('tour.next', 'Next');\n protected readonly backLabel = wrReadI18nText('tour.back', 'Back');\n protected readonly doneLabel = wrReadI18nText('tour.done', 'Done');\n protected readonly skipLabel = wrReadI18nText('tour.skip', 'Skip tour');\n\n /** `Step {{current}} of {{total}}`, the second half of the dialog's name. */\n protected readonly progress = useI18nFormatter('tour.progress', 'Step {{current}} of {{total}}');\n\n // From the service, not `index() >= total() - 1`: a trailing step whose target is\n // missing gets skipped, so the raw count called the final card \"Next\" and then\n // ended the tour when it was pressed.\n protected readonly isLast = computed(() => this.tour.isLast());\n // Same story at the other end, and the same fix: `index() <= 0` rendered a Back\n // button on the first card of a tour whose leading step had been skipped, and\n // `prev()` walks off the start and returns — so the button did nothing at all.\n protected readonly isFirst = computed(() => this.tour.isFirst());\n\n protected readonly progressText = computed(() =>\n this.progress({ current: this.tour.index() + 1, total: this.tour.total() })\n );\n\n protected readonly titleId = wrRandomId('wr-tour-title');\n protected readonly progressId = wrRandomId('wr-tour-progress');\n protected readonly contentId = wrRandomId('wr-tour-content');\n\n /**\n * The dialog is named by its title and the progress line, or by the progress\n * line alone for an untitled step, and described by the step's text: a screen\n * reader reads a dialog's name and description when focus enters it, and\n * nothing else of what it holds.\n */\n protected readonly labelledBy = computed(() =>\n this.tour.step()?.title ? `${this.titleId} ${this.progressId}` : this.progressId\n );\n}\n","@let step = tour.step();\n\n<p class=\"wr-tour-popup__progress\" [id]=\"progressId\">{{ progressText() }}</p>\n\n@if (step?.title; as title) {\n <h2 class=\"wr-tour-popup__title\" [id]=\"titleId\">{{ title }}</h2>\n}\n\n<p class=\"wr-tour-popup__content\" [id]=\"contentId\">{{ step?.content }}</p>\n\n<div class=\"wr-tour-popup__actions\">\n <!-- The three buttons are told apart by a class rather than by their position in\n the row: the back button is conditional, so an index means one thing on the\n first step and another everywhere else — and the labels are translated. -->\n <button\n wr-btn\n type=\"button\"\n size=\"sm\"\n outlined\n class=\"wr-tour-popup__action wr-tour-popup__action--skip\"\n (click)=\"tour.stop()\"\n >\n {{ skipLabel() }}\n </button>\n\n <span class=\"wr-tour-popup__spacer\"></span>\n\n @if (!isFirst()) {\n <button\n wr-btn\n type=\"button\"\n size=\"sm\"\n outlined\n class=\"wr-tour-popup__action wr-tour-popup__action--back\"\n (click)=\"tour.prev()\"\n >\n {{ backLabel() }}\n </button>\n }\n <!-- Under `autoFocus: 'first-tabbable'` focus opens on the button that walks the\n tour, not on Skip, the first in the row: the focus trap reads\n `cdkFocusInitial`, as the confirm dialog has it. -->\n <button\n wr-btn\n type=\"button\"\n size=\"sm\"\n color=\"primary\"\n class=\"wr-tour-popup__action wr-tour-popup__action--next\"\n [attr.cdkFocusInitial]=\"tour.focusNext() ? '' : null\"\n (click)=\"tour.next()\"\n >\n {{ isLast() ? doneLabel() : nextLabel() }}\n </button>\n</div>\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 { type ConfigurableFocusTrap, ConfigurableFocusTrapFactory } from '@angular/cdk/a11y';\nimport { Directionality } from '@angular/cdk/bidi';\nimport { type ConnectedPosition, type OverlayRef, ScrollStrategyOptions } from '@angular/cdk/overlay';\nimport { ComponentPortal } from '@angular/cdk/portal';\nimport { Location, isPlatformBrowser } from '@angular/common';\nimport {\n DOCUMENT,\n DestroyRef,\n EnvironmentInjector,\n Injector,\n PLATFORM_ID,\n Service,\n computed,\n inject,\n signal,\n} from '@angular/core';\n\nimport { WR_OVERLAY, type WrOverlayAutoFocus, wrFocusOverlay, wrFollowDirection, wrMirrorOffsets } from 'ngwr/overlay';\nimport { wrRestoreFocus, wrToClassList } from 'ngwr/utils';\n\nimport { WR_TOUR_STEP, WrTourPopup } from './tour-popup';\nimport type { WrTourOptions, WrTourPlacement, WrTourStep } from './types';\n\n/** Fallback order per preferred side — the opposite side first, then the sides. */\nconst FALLBACKS: Record<WrTourPlacement, readonly WrTourPlacement[]> = {\n bottom: ['bottom', 'top', 'right', 'left'],\n top: ['top', 'bottom', 'right', 'left'],\n left: ['left', 'right', 'bottom', 'top'],\n right: ['right', 'left', 'bottom', 'top'],\n};\n\nconst CONNECTED: Record<\n WrTourPlacement,\n {\n originX: 'start' | 'center' | 'end';\n originY: 'top' | 'center' | 'bottom';\n overlayX: 'start' | 'center' | 'end';\n overlayY: 'top' | 'center' | 'bottom';\n }\n> = {\n bottom: { originX: 'center', originY: 'bottom', overlayX: 'center', overlayY: 'top' },\n top: { originX: 'center', originY: 'top', overlayX: 'center', overlayY: 'bottom' },\n left: { originX: 'start', originY: 'center', overlayX: 'end', overlayY: 'center' },\n right: { originX: 'end', originY: 'center', overlayX: 'start', overlayY: 'center' },\n};\n\n/**\n * Guided product tour: a spotlight over one element at a time plus a popup\n * explaining it.\n *\n * Steps are data, not markup — call `start()` with an array and the service owns\n * the overlay, the cut-out, focus and the keyboard. A step whose target is not\n * on the page is skipped rather than shown floating, so a tour survives a\n * feature being hidden behind a flag or a permission.\n *\n * @example\n * ```ts\n * private readonly tour = inject(WrTour);\n *\n * showMeAround(): void {\n * this.tour.start([\n * { target: '[data-tour=\"search\"]', title: 'Search', content: 'Find anything by name.' },\n * { target: '[data-tour=\"filters\"]', content: 'Narrow the list down.', placement: 'right' },\n * ]);\n * }\n * ```\n *\n * @see https://ngwr.dev/reference/services/tour\n */\n@Service()\nexport class WrTour {\n private readonly overlay = inject(WR_OVERLAY);\n private readonly dir = inject(Directionality, { optional: true });\n private readonly scrollStrategies = inject(ScrollStrategyOptions);\n private readonly injector = inject(EnvironmentInjector);\n private readonly focusTrapFactory = inject(ConfigurableFocusTrapFactory);\n private readonly document = inject(DOCUMENT);\n private readonly isBrowser = isPlatformBrowser(inject(PLATFORM_ID));\n private readonly location = inject(Location);\n\n private readonly steps = signal<readonly WrTourStep[]>([]);\n private readonly cursor = signal(-1);\n\n private overlayRef: OverlayRef | null = null;\n private focusTrap: ConfigurableFocusTrap | null = null;\n private spotlight: HTMLElement | null = null;\n private detachKeydown: (() => void) | null = null;\n private detachReposition: (() => void) | null = null;\n private restoreFocus: HTMLElement | null = null;\n private autoFocus: WrOverlayAutoFocus = 'dialog';\n /** `focusNext` for the card, see {@link WrTourController}. */\n readonly focusNext = (): boolean => this.autoFocus === 'first-tabbable';\n private stopWatchingUrl: (() => void) | null = null;\n\n /** Whether a tour is running. */\n readonly active = computed(() => this.cursor() >= 0);\n\n /** Zero-based index of the current step, `-1` when idle. */\n readonly index = computed(() => this.cursor());\n\n /** How many steps this tour has. */\n readonly total = computed(() => this.steps().length);\n\n /** The step being shown, or `null` when idle. */\n readonly step = computed<WrTourStep | null>(() => this.steps()[this.cursor()] ?? null);\n\n // Whether any step AFTER the current one can actually be shown. Settled once per\n // move, in `goTo`, because reachability is a DOM question and not a signal.\n private readonly noStepAfter = signal(false);\n\n // The same question looking the other way. Settled in `goTo` for the same reason.\n //\n // `true` at rest, and the asymmetry with `noStepAfter` is deliberate: with no\n // tour running there is no step, so both questions are vacuous, and the pair\n // is set to whatever keeps a naive template honest. `@if (!tour.isFirst())`\n // around a Back button is the obvious way to write it, and at `false` that\n // button appears with no tour on screen.\n private readonly noStepBefore = signal(true);\n\n /**\n * Whether this is the last step the user will see. Not `index() === total() - 1`:\n * a trailing step whose target is missing is skipped, so comparing against the\n * raw count left the primary button reading \"Next\" on the final card and then\n * ending the tour when it was pressed. `false` while no tour is running.\n */\n readonly isLast = computed(() => this.noStepAfter());\n\n /**\n * Whether this is the first step the user will see. Not `index() === 0`, for the\n * mirror of the reason above: a LEADING step whose target is missing is skipped,\n * so the tour opens on a later index and the raw one put a Back button on the\n * first card — one that did nothing at all, because `prev()` walks off the start\n * and returns without moving. `true` while no tour is running — see the signal\n * it reads.\n */\n readonly isFirst = computed(() => this.noStepBefore());\n\n constructor() {\n // Everything this service owns lives OUTSIDE its own injector: a CDK overlay, a\n // div appended to `document.body`, a document keydown listener and two window\n // listeners. Nothing removes them when the injector goes, so a tour running at\n // teardown left its cut-out on the page.\n inject(DestroyRef).onDestroy(() => this.stop());\n }\n\n /**\n * Begin a tour. Restarts if one is already running. A no-op under SSR — a\n * tour is a client-side affordance and there is nothing to spotlight on the\n * server.\n */\n start(steps: readonly WrTourStep[], options: WrTourOptions = {}): void {\n if (!this.isBrowser || steps.length === 0) return;\n this.stop();\n this.steps.set(steps);\n this.autoFocus = options.autoFocus ?? 'dialog';\n this.restoreFocus = this.document.activeElement as HTMLElement | null;\n // A tour belongs to the page it was started on, the way `WrDialog` and\n // `WrDrawerManager` tie a modal to its URL. Nothing ended it on navigation,\n // so following a link mid-tour left the card pointing at an element the\n // router had just removed — the cut-out collapsed to a 12px box at the\n // corner, its 9999px shadow dimming the whole new page, and focus trapped in\n // a card about the page the user had left. `onUrlChange` rather than\n // `subscribe()`, which hears popstate alone and misses `router.navigate()`.\n this.stopWatchingUrl = this.location.onUrlChange(() => this.stop());\n this.goTo(0, 1);\n }\n\n /** Advance; finishes the tour past the last step. */\n next(): void {\n this.goTo(this.cursor() + 1, 1);\n }\n\n /** Go back; stays put on the first step. */\n prev(): void {\n this.goTo(this.cursor() - 1, -1);\n }\n\n /** End the tour and return focus where it was. */\n stop(): void {\n // Unhooked a microtask late, as `WrDialog` does: `Location` notifies with a\n // `forEach`, and unregistering from inside that notification splices the\n // array it is walking, which would skip the listener after ours.\n const unwatch = this.stopWatchingUrl;\n this.stopWatchingUrl = null;\n if (unwatch) queueMicrotask(unwatch);\n this.teardownStep();\n this.steps.set([]);\n this.cursor.set(-1);\n // Back to their resting answers. Without this a finished tour left both\n // holding whatever its last step said, so `isFirst` and `isLast` were the\n // only two signals here that still described a tour that had ended — while\n // `active`, `index`, `total` and `step` all reported idle.\n this.noStepAfter.set(false);\n this.noStepBefore.set(true);\n if (this.restoreFocus && typeof this.restoreFocus.focus === 'function') wrRestoreFocus(this.restoreFocus);\n this.restoreFocus = null;\n }\n\n /**\n * Move to `index`, skipping steps whose target is not in the DOM. `direction`\n * says which way to keep skipping, so a missing step never traps the tour\n * between two dead ends.\n */\n private goTo(index: number, direction: 1 | -1): void {\n const steps = this.steps();\n let i = index;\n while (i >= 0 && i < steps.length && this.resolve(steps[i]) === null) i += direction;\n\n if (i < 0) {\n // Ran off the start while going back — stay where we were.\n return;\n }\n if (i >= steps.length) {\n this.stop();\n return;\n }\n\n // Focus inside the card that is about to go stays in the tour: the next card\n // takes it, whatever `autoFocus` says about a card opening.\n const active = this.document.activeElement;\n const hadFocus = !!active && !!this.overlayRef?.overlayElement.contains(active);\n this.teardownStep();\n this.cursor.set(i);\n this.noStepAfter.set(!this.anyResolvableAfter(i));\n this.noStepBefore.set(!this.anyResolvableBefore(i));\n this.openStep(steps[i], hadFocus);\n }\n\n /** Whether the tour has a step past `index` that can actually be shown. */\n private anyResolvableAfter(index: number): boolean {\n const steps = this.steps();\n for (let i = index + 1; i < steps.length; i += 1) {\n if (this.resolve(steps[i]) !== null) return true;\n }\n return false;\n }\n\n /** Whether the tour has a step before `index` that can actually be shown. */\n private anyResolvableBefore(index: number): boolean {\n const steps = this.steps();\n for (let i = index - 1; i >= 0; i -= 1) {\n if (this.resolve(steps[i]) !== null) return true;\n }\n return false;\n }\n\n private resolve(step: WrTourStep): HTMLElement | null {\n if (typeof step.target !== 'string') return step.target.isConnected ? step.target : null;\n return this.document.querySelector<HTMLElement>(step.target);\n }\n\n private openStep(step: WrTourStep, hadFocus: boolean): void {\n const target = this.resolve(step);\n if (!target) return;\n\n target.scrollIntoView({ block: 'center', inline: 'nearest', behavior: 'smooth' });\n\n // The cut-out is a bare element sized to the target with an enormous spread\n // shadow: everything outside it dims, the target itself stays untouched.\n // Cheaper and far more robust than a clip-path polygon, and it needs no\n // recompute when the page reflows beyond moving the box.\n const spotlight = this.document.createElement('div');\n spotlight.className = 'wr-tour__spotlight';\n spotlight.setAttribute('aria-hidden', 'true');\n this.document.body.appendChild(spotlight);\n this.spotlight = spotlight;\n this.placeSpotlight(target);\n\n const placement = step.placement ?? 'bottom';\n const positionStrategy = this.overlay\n .position()\n .flexibleConnectedTo(target)\n .withPositions(this.stepPositions(placement, this.isRtl()))\n .withPush(true);\n\n this.overlayRef = this.overlay.create({\n positionStrategy,\n scrollStrategy: this.scrollStrategies.reposition(),\n panelClass: wrToClassList('wr-tour-overlay', step.panelClass),\n });\n\n // The CDK read the direction once, just now. A tour is long-lived by nature\n // — a step can sit on screen while the user changes a language setting — and\n // without this the card keeps the direction the step opened in, with the\n // 12px gap that held it clear of the spotlight now pointing into it.\n // Per step, because every move disposes this ref and builds the next.\n //\n // The cut-out moves with it. The target itself changes place when the page\n // mirrors, and the spotlight is re-measured only on scroll and resize, so a\n // flip left it highlighting empty space while the card, re-placed by the CDK,\n // pointed at the target sitting under the dim. The flip has already been laid\n // out by the time this runs — the CDK measures the same element right after.\n wrFollowDirection(this.overlayRef, this.dir, this.injector, direction => {\n positionStrategy.withPositions(this.stepPositions(placement, direction === 'rtl'));\n this.placeSpotlight(target);\n });\n\n const portal = new ComponentPortal(\n WrTourPopup,\n null,\n Injector.create({ parent: this.injector, providers: [{ provide: WR_TOUR_STEP, useValue: this }] })\n );\n const ref = this.overlayRef.attach(portal);\n\n // Kept on the instance, not in a local: a trap registers with CDK's\n // `FocusTrapManager` and installs a capture-phase document focus listener, so an\n // undestroyed one leaks per STEP and every tour left a stack of them behind.\n const card = ref.location.nativeElement as HTMLElement;\n this.focusTrap = this.focusTrapFactory.create(card);\n // Onto Next only when asked. Otherwise the card itself takes focus, so the\n // keyboard is in the tour and no button is lit; under `false` only when the\n // card before it held focus, which would otherwise fall to `<body>`.\n wrFocusOverlay(\n card,\n this.focusTrap,\n this.autoFocus === false && hadFocus ? 'dialog' : this.autoFocus,\n this.injector\n );\n\n const onKey = (event: KeyboardEvent): void => {\n // The listener is on the document, so a step shown over a dialog would see the\n // Escape that dialog just handled and close the tour too.\n if (event.key === 'Escape' && !event.defaultPrevented) {\n event.preventDefault();\n this.stop();\n }\n };\n this.document.addEventListener('keydown', onKey);\n this.detachKeydown = () => this.document.removeEventListener('keydown', onKey);\n\n const reposition = (): void => this.placeSpotlight(target);\n window.addEventListener('scroll', reposition, true);\n window.addEventListener('resize', reposition);\n this.detachReposition = () => {\n window.removeEventListener('scroll', reposition, true);\n window.removeEventListener('resize', reposition);\n };\n }\n\n /**\n * The card's fallback table for one placement, with its inline offsets already\n * mirrored. Built per call rather than per step: the direction can change while\n * the step is on screen, and a table is what has to be rebuilt when it does.\n */\n private stepPositions(placement: WrTourPlacement, isRtl: boolean): ConnectedPosition[] {\n return wrMirrorOffsets(\n FALLBACKS[placement].map(side => ({\n ...CONNECTED[side],\n offsetY: side === 'bottom' ? 12 : side === 'top' ? -12 : 0,\n offsetX: side === 'right' ? 12 : side === 'left' ? -12 : 0,\n })),\n isRtl\n );\n }\n\n private placeSpotlight(target: HTMLElement): void {\n const el = this.spotlight;\n if (!el) return;\n const r = target.getBoundingClientRect();\n const pad = 6;\n el.style.top = `${r.top - pad}px`;\n el.style.left = `${r.left - pad}px`;\n el.style.width = `${r.width + pad * 2}px`;\n el.style.height = `${r.height + pad * 2}px`;\n }\n\n private teardownStep(): void {\n this.focusTrap?.destroy();\n this.focusTrap = null;\n this.detachKeydown?.();\n this.detachKeydown = null;\n this.detachReposition?.();\n this.detachReposition = null;\n this.overlayRef?.dispose();\n this.overlayRef = null;\n this.spotlight?.remove();\n this.spotlight = null;\n }\n\n /**\n * Whether the app reads right-to-left.\n *\n * Optional inject: `Directionality` is root-provided, so this is never null in\n * an app — but a bare `TestBed` that provides nothing should still get a\n * component that works, and defaulting to LTR is the honest fallback.\n */\n private isRtl(): boolean {\n return this.dir?.value === 'rtl';\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAyCA,MAAa,eAAe,IAAI,eAAiC,cAAc;AAqB/E,IAAa,cAAb,MAAa,YAAW;CACtB,cAAA;EACE,IAAI,OAAO,cAAc,eAAe,WAAW,cAAc,MAAM;CACzE;CAEmB,OAAO,OAAO,YAAY;CAI1B,YAAY,eAAe,aAAa,MAAM;CAC9C,YAAY,eAAe,aAAa,MAAM;CAC9C,YAAY,eAAe,aAAa,MAAM;CAC9C,YAAY,eAAe,aAAa,WAAW;CAGnD,WAAW,iBAAiB,iBAAiB,+BAA+B;CAK5E,SAAS,eAAe,KAAK,KAAK,OAAM,GAAG,GAAA,YAAA,CAAA,EAAA,WAAA,SAAA,CAAA,+BAAA,C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pB,KAAK,gBAAgB;EACrB,KAAK,mBAAkB;EACvB,KAAK,mBAAmB;EACxB,KAAK,YAAY,QAAO;EACxB,KAAK,aAAa;EAClB,KAAK,WAAW,OAAM;EACtB,KAAK,YAAY;CACnB;CASQ,QAAK;EACX,OAAO,KAAK,KAAK,UAAU;CAC7B;CA9TW,OAAA,OAAA,GAAA,mBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,UAAA;EAAA,MAAA;EAAM,MAAA,CAAA;EAAA,QAAA,GAAA,gBAAA;CAAA,CAAA;CAAN,OAAA,QAAA,GAAA,mBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,UAAA;EAAA,MAAA;CAAM,CAAA;;AAAN,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAM,YAAA,CAAA,EADlB,MAAA,Q"}
1
+ {"version":3,"file":"ngwr-tour.mjs","names":[],"sources":["../../../projects/lib/tour/tour-popup.ts","../../../projects/lib/tour/tour-popup.html","../../../projects/lib/tour/tour.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 { Component, InjectionToken, ViewEncapsulation, computed, inject } from '@angular/core';\n\nimport { WrButton } from 'ngwr/button';\nimport { wrReadI18nText, useI18nFormatter } from 'ngwr/i18n';\nimport { wrCheckStyles, wrRandomId } from 'ngwr/utils';\n\nimport type { WrTourStep } from './types';\n\n/** What the popup needs from the running tour, without importing the service (cycle). */\nexport interface WrTourController {\n readonly index: () => number;\n readonly total: () => number;\n readonly step: () => WrTourStep | null;\n /**\n * Whether this is the last step the user will actually see — the service looks\n * ahead for a reachable one, because a trailing step whose target is missing gets\n * skipped and the raw count would call the final card \"Next\".\n */\n readonly isLast: () => boolean;\n /**\n * Whether this is the first step the user will actually see — the service looks\n * BEHIND for a reachable one, for the mirror reason: a leading step whose target\n * is missing gets skipped, so the tour opens on a later index and the raw one\n * would put a Back button on the very first card.\n */\n readonly isFirst: () => boolean;\n /** Whether the card opens with focus on Next: the tour's `autoFocus` is `'first-tabbable'`. */\n readonly focusNext: () => boolean;\n next(): void;\n prev(): void;\n stop(): void;\n}\n\n/** Provided by `WrTour` when it attaches the popup portal. */\nexport const WR_TOUR_STEP = new InjectionToken<WrTourController>('WR_TOUR_STEP');\n\n/**\n * The card a tour shows next to the spotlit element. Rendered by `WrTour` into\n * a CDK overlay — not something you place yourself.\n *\n * @see https://ngwr.dev/reference/services/tour\n */\n@Component({\n selector: 'wr-tour-popup',\n templateUrl: './tour-popup.html',\n encapsulation: ViewEncapsulation.None,\n host: {\n class: 'wr-tour-popup',\n role: 'dialog',\n 'aria-modal': 'true',\n '[attr.aria-labelledby]': 'labelledBy()',\n '[attr.aria-describedby]': 'contentId',\n },\n imports: [WrButton],\n})\nexport class WrTourPopup {\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('tour');\n }\n\n protected readonly tour = inject(WR_TOUR_STEP);\n\n // `wrReadI18nText`, not `useI18nText`: these have no consumer-facing input to\n // forward. Both helpers are reactive.\n protected readonly nextLabel = wrReadI18nText('tour.next', 'Next');\n protected readonly backLabel = wrReadI18nText('tour.back', 'Back');\n protected readonly doneLabel = wrReadI18nText('tour.done', 'Done');\n protected readonly skipLabel = wrReadI18nText('tour.skip', 'Skip tour');\n\n /** `Step {{current}} of {{total}}`, the second half of the dialog's name. */\n protected readonly progress = useI18nFormatter('tour.progress', 'Step {{current}} of {{total}}');\n\n // From the service, not `index() >= total() - 1`: a trailing step whose target is\n // missing gets skipped, so the raw count called the final card \"Next\" and then\n // ended the tour when it was pressed.\n protected readonly isLast = computed(() => this.tour.isLast());\n // Same story at the other end, and the same fix: `index() <= 0` rendered a Back\n // button on the first card of a tour whose leading step had been skipped, and\n // `prev()` walks off the start and returns — so the button did nothing at all.\n protected readonly isFirst = computed(() => this.tour.isFirst());\n\n protected readonly progressText = computed(() =>\n this.progress({ current: this.tour.index() + 1, total: this.tour.total() })\n );\n\n protected readonly titleId = wrRandomId('wr-tour-title');\n protected readonly progressId = wrRandomId('wr-tour-progress');\n protected readonly contentId = wrRandomId('wr-tour-content');\n\n /**\n * The dialog is named by its title and the progress line, or by the progress\n * line alone for an untitled step, and described by the step's text: a screen\n * reader reads a dialog's name and description when focus enters it, and\n * nothing else of what it holds.\n */\n protected readonly labelledBy = computed(() =>\n this.tour.step()?.title ? `${this.titleId} ${this.progressId}` : this.progressId\n );\n}\n","@let step = tour.step();\n\n<p class=\"wr-tour-popup__progress\" [id]=\"progressId\">{{ progressText() }}</p>\n\n@if (step?.title; as title) {\n <h2 class=\"wr-tour-popup__title\" [id]=\"titleId\">{{ title }}</h2>\n}\n\n<p class=\"wr-tour-popup__content\" [id]=\"contentId\">{{ step?.content }}</p>\n\n<div class=\"wr-tour-popup__actions\">\n <!-- The three buttons are told apart by a class rather than by their position in\n the row: the back button is conditional, so an index means one thing on the\n first step and another everywhere else — and the labels are translated. -->\n <button\n wr-btn\n type=\"button\"\n size=\"sm\"\n outlined\n class=\"wr-tour-popup__action wr-tour-popup__action--skip\"\n (click)=\"tour.stop()\"\n >\n {{ skipLabel() }}\n </button>\n\n <span class=\"wr-tour-popup__spacer\"></span>\n\n @if (!isFirst()) {\n <button\n wr-btn\n type=\"button\"\n size=\"sm\"\n outlined\n class=\"wr-tour-popup__action wr-tour-popup__action--back\"\n (click)=\"tour.prev()\"\n >\n {{ backLabel() }}\n </button>\n }\n <!-- Under `autoFocus: 'first-tabbable'` focus opens on the button that walks the\n tour, not on Skip, the first in the row: the focus trap reads\n `cdkFocusInitial`, as the confirm dialog has it. -->\n <button\n wr-btn\n type=\"button\"\n size=\"sm\"\n color=\"primary\"\n class=\"wr-tour-popup__action wr-tour-popup__action--next\"\n [attr.cdkFocusInitial]=\"tour.focusNext() ? '' : null\"\n (click)=\"tour.next()\"\n >\n {{ isLast() ? doneLabel() : nextLabel() }}\n </button>\n</div>\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 { type ConfigurableFocusTrap, ConfigurableFocusTrapFactory } from '@angular/cdk/a11y';\nimport { Directionality } from '@angular/cdk/bidi';\nimport { type ConnectedPosition, type OverlayRef, ScrollStrategyOptions } from '@angular/cdk/overlay';\nimport { ComponentPortal } from '@angular/cdk/portal';\nimport { Location, isPlatformBrowser } from '@angular/common';\nimport {\n DOCUMENT,\n DestroyRef,\n EnvironmentInjector,\n Injector,\n PLATFORM_ID,\n Service,\n computed,\n inject,\n signal,\n} from '@angular/core';\n\nimport { WR_OVERLAY, type WrOverlayAutoFocus, wrFocusOverlay, wrFollowDirection, wrMirrorOffsets } from 'ngwr/overlay';\nimport { wrIsComposing, wrRestoreFocus, wrToClassList } from 'ngwr/utils';\n\nimport { WR_TOUR_STEP, WrTourPopup } from './tour-popup';\nimport type { WrTourOptions, WrTourPlacement, WrTourStep } from './types';\n\n/** Fallback order per preferred side — the opposite side first, then the sides. */\nconst FALLBACKS: Record<WrTourPlacement, readonly WrTourPlacement[]> = {\n bottom: ['bottom', 'top', 'right', 'left'],\n top: ['top', 'bottom', 'right', 'left'],\n left: ['left', 'right', 'bottom', 'top'],\n right: ['right', 'left', 'bottom', 'top'],\n};\n\nconst CONNECTED: Record<\n WrTourPlacement,\n {\n originX: 'start' | 'center' | 'end';\n originY: 'top' | 'center' | 'bottom';\n overlayX: 'start' | 'center' | 'end';\n overlayY: 'top' | 'center' | 'bottom';\n }\n> = {\n bottom: { originX: 'center', originY: 'bottom', overlayX: 'center', overlayY: 'top' },\n top: { originX: 'center', originY: 'top', overlayX: 'center', overlayY: 'bottom' },\n left: { originX: 'start', originY: 'center', overlayX: 'end', overlayY: 'center' },\n right: { originX: 'end', originY: 'center', overlayX: 'start', overlayY: 'center' },\n};\n\n/**\n * Guided product tour: a spotlight over one element at a time plus a popup\n * explaining it.\n *\n * Steps are data, not markup — call `start()` with an array and the service owns\n * the overlay, the cut-out, focus and the keyboard. A step whose target is not\n * on the page is skipped rather than shown floating, so a tour survives a\n * feature being hidden behind a flag or a permission.\n *\n * @example\n * ```ts\n * private readonly tour = inject(WrTour);\n *\n * showMeAround(): void {\n * this.tour.start([\n * { target: '[data-tour=\"search\"]', title: 'Search', content: 'Find anything by name.' },\n * { target: '[data-tour=\"filters\"]', content: 'Narrow the list down.', placement: 'right' },\n * ]);\n * }\n * ```\n *\n * @see https://ngwr.dev/reference/services/tour\n */\n@Service()\nexport class WrTour {\n private readonly overlay = inject(WR_OVERLAY);\n private readonly dir = inject(Directionality, { optional: true });\n private readonly scrollStrategies = inject(ScrollStrategyOptions);\n private readonly injector = inject(EnvironmentInjector);\n private readonly focusTrapFactory = inject(ConfigurableFocusTrapFactory);\n private readonly document = inject(DOCUMENT);\n private readonly isBrowser = isPlatformBrowser(inject(PLATFORM_ID));\n private readonly location = inject(Location);\n\n private readonly steps = signal<readonly WrTourStep[]>([]);\n private readonly cursor = signal(-1);\n\n private overlayRef: OverlayRef | null = null;\n private focusTrap: ConfigurableFocusTrap | null = null;\n private spotlight: HTMLElement | null = null;\n private detachKeydown: (() => void) | null = null;\n private detachReposition: (() => void) | null = null;\n private restoreFocus: HTMLElement | null = null;\n private autoFocus: WrOverlayAutoFocus = 'dialog';\n /** `focusNext` for the card, see {@link WrTourController}. */\n readonly focusNext = (): boolean => this.autoFocus === 'first-tabbable';\n private stopWatchingUrl: (() => void) | null = null;\n\n /** Whether a tour is running. */\n readonly active = computed(() => this.cursor() >= 0);\n\n /** Zero-based index of the current step, `-1` when idle. */\n readonly index = computed(() => this.cursor());\n\n /** How many steps this tour has. */\n readonly total = computed(() => this.steps().length);\n\n /** The step being shown, or `null` when idle. */\n readonly step = computed<WrTourStep | null>(() => this.steps()[this.cursor()] ?? null);\n\n // Whether any step AFTER the current one can actually be shown. Settled once per\n // move, in `goTo`, because reachability is a DOM question and not a signal.\n private readonly noStepAfter = signal(false);\n\n // The same question looking the other way. Settled in `goTo` for the same reason.\n //\n // `true` at rest, and the asymmetry with `noStepAfter` is deliberate: with no\n // tour running there is no step, so both questions are vacuous, and the pair\n // is set to whatever keeps a naive template honest. `@if (!tour.isFirst())`\n // around a Back button is the obvious way to write it, and at `false` that\n // button appears with no tour on screen.\n private readonly noStepBefore = signal(true);\n\n /**\n * Whether this is the last step the user will see. Not `index() === total() - 1`:\n * a trailing step whose target is missing is skipped, so comparing against the\n * raw count left the primary button reading \"Next\" on the final card and then\n * ending the tour when it was pressed. `false` while no tour is running.\n */\n readonly isLast = computed(() => this.noStepAfter());\n\n /**\n * Whether this is the first step the user will see. Not `index() === 0`, for the\n * mirror of the reason above: a LEADING step whose target is missing is skipped,\n * so the tour opens on a later index and the raw one put a Back button on the\n * first card — one that did nothing at all, because `prev()` walks off the start\n * and returns without moving. `true` while no tour is running — see the signal\n * it reads.\n */\n readonly isFirst = computed(() => this.noStepBefore());\n\n constructor() {\n // Everything this service owns lives OUTSIDE its own injector: a CDK overlay, a\n // div appended to `document.body`, a document keydown listener and two window\n // listeners. Nothing removes them when the injector goes, so a tour running at\n // teardown left its cut-out on the page.\n inject(DestroyRef).onDestroy(() => this.stop());\n }\n\n /**\n * Begin a tour. Restarts if one is already running. A no-op under SSR — a\n * tour is a client-side affordance and there is nothing to spotlight on the\n * server.\n */\n start(steps: readonly WrTourStep[], options: WrTourOptions = {}): void {\n if (!this.isBrowser || steps.length === 0) return;\n this.stop();\n this.steps.set(steps);\n this.autoFocus = options.autoFocus ?? 'dialog';\n this.restoreFocus = this.document.activeElement as HTMLElement | null;\n // A tour belongs to the page it was started on, the way `WrDialog` and\n // `WrDrawerManager` tie a modal to its URL. Nothing ended it on navigation,\n // so following a link mid-tour left the card pointing at an element the\n // router had just removed — the cut-out collapsed to a 12px box at the\n // corner, its 9999px shadow dimming the whole new page, and focus trapped in\n // a card about the page the user had left. `onUrlChange` rather than\n // `subscribe()`, which hears popstate alone and misses `router.navigate()`.\n this.stopWatchingUrl = this.location.onUrlChange(() => this.stop());\n this.goTo(0, 1);\n }\n\n /** Advance; finishes the tour past the last step. */\n next(): void {\n this.goTo(this.cursor() + 1, 1);\n }\n\n /** Go back; stays put on the first step. */\n prev(): void {\n this.goTo(this.cursor() - 1, -1);\n }\n\n /** End the tour and return focus where it was. */\n stop(): void {\n // Unhooked a microtask late, as `WrDialog` does: `Location` notifies with a\n // `forEach`, and unregistering from inside that notification splices the\n // array it is walking, which would skip the listener after ours.\n const unwatch = this.stopWatchingUrl;\n this.stopWatchingUrl = null;\n if (unwatch) queueMicrotask(unwatch);\n this.teardownStep();\n this.steps.set([]);\n this.cursor.set(-1);\n // Back to their resting answers. Without this a finished tour left both\n // holding whatever its last step said, so `isFirst` and `isLast` were the\n // only two signals here that still described a tour that had ended — while\n // `active`, `index`, `total` and `step` all reported idle.\n this.noStepAfter.set(false);\n this.noStepBefore.set(true);\n if (this.restoreFocus && typeof this.restoreFocus.focus === 'function') wrRestoreFocus(this.restoreFocus);\n this.restoreFocus = null;\n }\n\n /**\n * Move to `index`, skipping steps whose target is not in the DOM. `direction`\n * says which way to keep skipping, so a missing step never traps the tour\n * between two dead ends.\n */\n private goTo(index: number, direction: 1 | -1): void {\n const steps = this.steps();\n let i = index;\n while (i >= 0 && i < steps.length && this.resolve(steps[i]) === null) i += direction;\n\n if (i < 0) {\n // Ran off the start while going back — stay where we were.\n return;\n }\n if (i >= steps.length) {\n this.stop();\n return;\n }\n\n // Focus inside the card that is about to go stays in the tour: the next card\n // takes it, whatever `autoFocus` says about a card opening.\n const active = this.document.activeElement;\n const hadFocus = !!active && !!this.overlayRef?.overlayElement.contains(active);\n this.teardownStep();\n this.cursor.set(i);\n this.noStepAfter.set(!this.anyResolvableAfter(i));\n this.noStepBefore.set(!this.anyResolvableBefore(i));\n this.openStep(steps[i], hadFocus);\n }\n\n /** Whether the tour has a step past `index` that can actually be shown. */\n private anyResolvableAfter(index: number): boolean {\n const steps = this.steps();\n for (let i = index + 1; i < steps.length; i += 1) {\n if (this.resolve(steps[i]) !== null) return true;\n }\n return false;\n }\n\n /** Whether the tour has a step before `index` that can actually be shown. */\n private anyResolvableBefore(index: number): boolean {\n const steps = this.steps();\n for (let i = index - 1; i >= 0; i -= 1) {\n if (this.resolve(steps[i]) !== null) return true;\n }\n return false;\n }\n\n private resolve(step: WrTourStep): HTMLElement | null {\n if (typeof step.target !== 'string') return step.target.isConnected ? step.target : null;\n return this.document.querySelector<HTMLElement>(step.target);\n }\n\n private openStep(step: WrTourStep, hadFocus: boolean): void {\n const target = this.resolve(step);\n if (!target) return;\n\n const reduced = this.document.defaultView?.matchMedia?.('(prefers-reduced-motion: reduce)').matches;\n target.scrollIntoView({ block: 'center', inline: 'nearest', behavior: reduced ? 'instant' : 'smooth' });\n\n // The cut-out is a bare element sized to the target with an enormous spread\n // shadow: everything outside it dims, the target itself stays untouched.\n // Cheaper and far more robust than a clip-path polygon, and it needs no\n // recompute when the page reflows beyond moving the box.\n const spotlight = this.document.createElement('div');\n spotlight.className = 'wr-tour__spotlight';\n spotlight.setAttribute('aria-hidden', 'true');\n this.document.body.appendChild(spotlight);\n // Into the top layer, where a dialog or a drawer holding the target is. It is\n // promoted before the card's overlay is created, so the card stays above it.\n // Set here and not in a template: a `popover` attribute hides the element\n // until it is shown, which a browser without the API never does.\n if (typeof spotlight.showPopover === 'function') {\n spotlight.setAttribute('popover', 'manual');\n spotlight.showPopover();\n }\n this.spotlight = spotlight;\n this.placeSpotlight(target);\n\n const placement = step.placement ?? 'bottom';\n const positionStrategy = this.overlay\n .position()\n .flexibleConnectedTo(target)\n .withPositions(this.stepPositions(placement, this.isRtl()))\n .withPush(true);\n\n this.overlayRef = this.overlay.create({\n positionStrategy,\n scrollStrategy: this.scrollStrategies.reposition(),\n panelClass: wrToClassList('wr-tour-overlay', step.panelClass),\n });\n\n // The CDK read the direction once, just now. A tour is long-lived by nature\n // — a step can sit on screen while the user changes a language setting — and\n // without this the card keeps the direction the step opened in, with the\n // 12px gap that held it clear of the spotlight now pointing into it.\n // Per step, because every move disposes this ref and builds the next.\n //\n // The cut-out moves with it. The target itself changes place when the page\n // mirrors, and the spotlight is re-measured only on scroll and resize, so a\n // flip left it highlighting empty space while the card, re-placed by the CDK,\n // pointed at the target sitting under the dim. The flip has already been laid\n // out by the time this runs — the CDK measures the same element right after.\n wrFollowDirection(this.overlayRef, this.dir, this.injector, direction => {\n positionStrategy.withPositions(this.stepPositions(placement, direction === 'rtl'));\n this.placeSpotlight(target);\n });\n\n const portal = new ComponentPortal(\n WrTourPopup,\n null,\n Injector.create({ parent: this.injector, providers: [{ provide: WR_TOUR_STEP, useValue: this }] })\n );\n const ref = this.overlayRef.attach(portal);\n\n // Kept on the instance, not in a local: a trap registers with CDK's\n // `FocusTrapManager` and installs a capture-phase document focus listener, so an\n // undestroyed one leaks per STEP and every tour left a stack of them behind.\n const card = ref.location.nativeElement as HTMLElement;\n this.focusTrap = this.focusTrapFactory.create(card);\n // Onto Next only when asked. Otherwise the card itself takes focus, so the\n // keyboard is in the tour and no button is lit; under `false` only when the\n // card before it held focus, which would otherwise fall to `<body>`.\n wrFocusOverlay(\n card,\n this.focusTrap,\n this.autoFocus === false && hadFocus ? 'dialog' : this.autoFocus,\n this.injector\n );\n\n const onKey = (event: KeyboardEvent): void => {\n // The listener is on the document, so a step shown over a dialog would see the\n // Escape that dialog just handled and close the tour too.\n if (event.key === 'Escape' && !event.defaultPrevented && !wrIsComposing(event)) {\n event.preventDefault();\n this.stop();\n }\n };\n this.document.addEventListener('keydown', onKey);\n this.detachKeydown = () => this.document.removeEventListener('keydown', onKey);\n\n const reposition = (): void => this.placeSpotlight(target);\n window.addEventListener('scroll', reposition, true);\n window.addEventListener('resize', reposition);\n this.detachReposition = () => {\n window.removeEventListener('scroll', reposition, true);\n window.removeEventListener('resize', reposition);\n };\n }\n\n /**\n * The card's fallback table for one placement, with its inline offsets already\n * mirrored. Built per call rather than per step: the direction can change while\n * the step is on screen, and a table is what has to be rebuilt when it does.\n */\n private stepPositions(placement: WrTourPlacement, isRtl: boolean): ConnectedPosition[] {\n return wrMirrorOffsets(\n FALLBACKS[placement].map(side => ({\n ...CONNECTED[side],\n offsetY: side === 'bottom' ? 12 : side === 'top' ? -12 : 0,\n offsetX: side === 'right' ? 12 : side === 'left' ? -12 : 0,\n })),\n isRtl\n );\n }\n\n private placeSpotlight(target: HTMLElement): void {\n const el = this.spotlight;\n if (!el) return;\n const r = target.getBoundingClientRect();\n const pad = 6;\n el.style.top = `${r.top - pad}px`;\n el.style.left = `${r.left - pad}px`;\n el.style.width = `${r.width + pad * 2}px`;\n el.style.height = `${r.height + pad * 2}px`;\n }\n\n private teardownStep(): void {\n this.focusTrap?.destroy();\n this.focusTrap = null;\n this.detachKeydown?.();\n this.detachKeydown = null;\n this.detachReposition?.();\n this.detachReposition = null;\n this.overlayRef?.dispose();\n this.overlayRef = null;\n this.spotlight?.remove();\n this.spotlight = null;\n }\n\n /**\n * Whether the app reads right-to-left.\n *\n * Optional inject: `Directionality` is root-provided, so this is never null in\n * an app — but a bare `TestBed` that provides nothing should still get a\n * component that works, and defaulting to LTR is the honest fallback.\n */\n private isRtl(): boolean {\n return this.dir?.value === 'rtl';\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAyCA,MAAa,eAAe,IAAI,eAAiC,cAAc;AAqB/E,IAAa,cAAb,MAAa,YAAW;CACtB,cAAA;EACE,IAAI,OAAO,cAAc,eAAe,WAAW,cAAc,MAAM;CACzE;CAEmB,OAAO,OAAO,YAAY;CAI1B,YAAY,eAAe,aAAa,MAAM;CAC9C,YAAY,eAAe,aAAa,MAAM;CAC9C,YAAY,eAAe,aAAa,MAAM;CAC9C,YAAY,eAAe,aAAa,WAAW;CAGnD,WAAW,iBAAiB,iBAAiB,+BAA+B;CAK5E,SAAS,eAAe,KAAK,KAAK,OAAM,GAAG,GAAA,YAAA,CAAA,EAAA,WAAA,SAAA,CAAA,+BAAA,CAAA,CAAA;CAI3C,UAAU,eAAe,KAAK,KAAK,Q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AG,EAAE,QAAQ,GAAO;EACrC,GAAG,MAAM,SAAS,GAAG,EAAE,SAAS,GAAO;CACzC;CAEQ,eAAY;EAClB,KAAK,WAAW,QAAO;EACvB,KAAK,YAAY;EACjB,KAAK,gBAAe;EACpB,KAAK,gBAAgB;EACrB,KAAK,mBAAkB;EACvB,KAAK,mBAAmB;EACxB,KAAK,YAAY,QAAO;EACxB,KAAK,aAAa;EAClB,KAAK,WAAW,OAAM;EACtB,KAAK,YAAY;CACnB;CASQ,QAAK;EACX,OAAO,KAAK,KAAK,UAAU;CAC7B;CAvUW,OAAA,OAAA,GAAA,mBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,UAAA;EAAA,MAAA;EAAM,MAAA,CAAA;EAAA,QAAA,GAAA,gBAAA;CAAA,CAAA;CAAN,OAAA,QAAA,GAAA,mBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,UAAA;EAAA,MAAA;CAAM,CAAA;;AAAN,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAM,YAAA,CAAA,EADlB,MAAA,Q"}
@@ -5,7 +5,7 @@ import { InjectionToken } from "@angular/core";
5
5
  * Use of this source code is governed by an MIT-style license that can be
6
6
  * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE
7
7
  */
8
- const NGWR_VERSION = "16.7.1";
8
+ const NGWR_VERSION = "16.8.0";
9
9
  /**
10
10
  * @license
11
11
  *
@@ -1 +1 @@
1
- {"version":3,"file":"ngwr-version.mjs","names":[],"sources":["../../../projects/lib/version/version.ts","../../../projects/lib/version/version.token.ts"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\n/**\n * The ngwr library version string, kept in sync with\n * `projects/lib/package.json` by `scripts/release/prepare.ts`.\n *\n * Prefer this over reading `package.json` at runtime — that requires a JSON\n * import or `require`, neither of which tree-shakes well in Angular builds.\n *\n * Distinct from `Version` exported by `@angular/core`, which reports the\n * loaded Angular runtime version (e.g. `'22.0.0'`), not ngwr's.\n */\nexport const NGWR_VERSION = '16.7.1';\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 { InjectionToken } from '@angular/core';\n\nimport { NGWR_VERSION } from './version';\n\n/**\n * Injection token holding the ngwr library version string.\n *\n * Default factory returns {@link NGWR_VERSION}. Override it in tests or in\n * apps that want to surface a custom build identifier.\n *\n * @example\n * ```ts\n * @Component({...})\n * export class FooterComponent {\n * readonly version = inject(NGWR_VERSION_TOKEN);\n * }\n * ```\n */\nexport const NGWR_VERSION_TOKEN = new InjectionToken<string>('NGWR_VERSION_TOKEN', {\n providedIn: 'root',\n factory: () => NGWR_VERSION,\n});\n"],"mappings":";;;;;;;AAiBA,MAAa,eAAe;;;;;;;ACQ5B,MAAa,qBAAqB,IAAI,eAAuB,sBAAsB;CACjF,YAAY;CACZ,eAAe;AAChB,CAAA"}
1
+ {"version":3,"file":"ngwr-version.mjs","names":[],"sources":["../../../projects/lib/version/version.ts","../../../projects/lib/version/version.token.ts"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\n/**\n * The ngwr library version string, kept in sync with\n * `projects/lib/package.json` by `scripts/release/prepare.ts`.\n *\n * Prefer this over reading `package.json` at runtime — that requires a JSON\n * import or `require`, neither of which tree-shakes well in Angular builds.\n *\n * Distinct from `Version` exported by `@angular/core`, which reports the\n * loaded Angular runtime version (e.g. `'22.0.0'`), not ngwr's.\n */\nexport const NGWR_VERSION = '16.8.0';\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 { InjectionToken } from '@angular/core';\n\nimport { NGWR_VERSION } from './version';\n\n/**\n * Injection token holding the ngwr library version string.\n *\n * Default factory returns {@link NGWR_VERSION}. Override it in tests or in\n * apps that want to surface a custom build identifier.\n *\n * @example\n * ```ts\n * @Component({...})\n * export class FooterComponent {\n * readonly version = inject(NGWR_VERSION_TOKEN);\n * }\n * ```\n */\nexport const NGWR_VERSION_TOKEN = new InjectionToken<string>('NGWR_VERSION_TOKEN', {\n providedIn: 'root',\n factory: () => NGWR_VERSION,\n});\n"],"mappings":";;;;;;;AAiBA,MAAa,eAAe;;;;;;;ACQ5B,MAAa,qBAAqB,IAAI,eAAuB,sBAAsB;CACjF,YAAY;CACZ,eAAe;AAChB,CAAA"}
package/i18n/ar.json CHANGED
@@ -265,7 +265,9 @@
265
265
  },
266
266
  "donutChart": {
267
267
  "label": "مخطط دائري مجوف",
268
- "pieLabel": "مخطط دائري"
268
+ "pieLabel": "مخطط دائري",
269
+ "value": "القيمة",
270
+ "share": "الحصة"
269
271
  },
270
272
  "chartLegend": {
271
273
  "toggleLabel": "إظهار السلاسل أو إخفاؤها",
@@ -500,7 +502,12 @@
500
502
  "label": "التقدم"
501
503
  },
502
504
  "meterGroup": {
503
- "label": "مقياس"
505
+ "label": "مقياس",
506
+ "value": "القيمة",
507
+ "share": "الحصة"
508
+ },
509
+ "sparkline": {
510
+ "value": "القيمة"
504
511
  },
505
512
  "knob": {
506
513
  "label": "القيمة"