ngwr 16.5.0 → 16.6.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.
- package/back-top/styles/_index.scss +6 -0
- package/breadcrumbs/styles/_rules.scss +34 -0
- package/cascader/styles/_rules.scss +7 -0
- package/charts/chart-legend/styles/_index.scss +1 -9
- package/counter/styles/_index.scss +1 -8
- package/date-picker/styles/_index.scss +15 -9
- package/dialog/styles/_index.scss +37 -0
- package/editor/styles/_index.scss +1 -8
- package/event-calendar/styles/_index.scss +2 -6
- package/fesm2022/ngwr-affix.mjs +1 -1
- package/fesm2022/ngwr-affix.mjs.map +1 -1
- package/fesm2022/ngwr-anchor.mjs +9 -2
- package/fesm2022/ngwr-anchor.mjs.map +1 -1
- package/fesm2022/ngwr-animations-aurora.mjs.map +1 -1
- package/fesm2022/ngwr-animations-blur-reveal.mjs.map +1 -1
- package/fesm2022/ngwr-animations-click-sparks.mjs.map +1 -1
- package/fesm2022/ngwr-animations-confetti.mjs.map +1 -1
- package/fesm2022/ngwr-animations-decode.mjs.map +1 -1
- package/fesm2022/ngwr-animations-destruct.mjs.map +1 -1
- package/fesm2022/ngwr-animations-dot-grid.mjs.map +1 -1
- package/fesm2022/ngwr-animations-falling-letters.mjs.map +1 -1
- package/fesm2022/ngwr-animations-flow-lines.mjs.map +1 -1
- package/fesm2022/ngwr-animations-fluid-cursor.mjs.map +1 -1
- package/fesm2022/ngwr-animations-glitch.mjs.map +1 -1
- package/fesm2022/ngwr-animations-glow-border.mjs.map +1 -1
- package/fesm2022/ngwr-animations-gradient-flow.mjs.map +1 -1
- package/fesm2022/ngwr-animations-marquee.mjs.map +1 -1
- package/fesm2022/ngwr-animations-orbit.mjs.map +1 -1
- package/fesm2022/ngwr-animations-reveal.mjs.map +1 -1
- package/fesm2022/ngwr-animations-ripple-grid.mjs.map +1 -1
- package/fesm2022/ngwr-animations-rotate-reveal.mjs.map +1 -1
- package/fesm2022/ngwr-animations-shimmer.mjs.map +1 -1
- package/fesm2022/ngwr-animations-spotlight.mjs.map +1 -1
- package/fesm2022/ngwr-animations-thread-lines.mjs.map +1 -1
- package/fesm2022/ngwr-animations-tilt.mjs +20 -13
- package/fesm2022/ngwr-animations-tilt.mjs.map +1 -1
- package/fesm2022/ngwr-animations-typewriter.mjs.map +1 -1
- package/fesm2022/ngwr-breadcrumbs.mjs +40 -7
- package/fesm2022/ngwr-breadcrumbs.mjs.map +1 -1
- package/fesm2022/ngwr-button.mjs +12 -3
- package/fesm2022/ngwr-button.mjs.map +1 -1
- package/fesm2022/ngwr-carousel.mjs +8 -2
- package/fesm2022/ngwr-carousel.mjs.map +1 -1
- package/fesm2022/ngwr-cascader.mjs +24 -4
- package/fesm2022/ngwr-cascader.mjs.map +1 -1
- package/fesm2022/ngwr-charts-core.mjs +12 -5
- package/fesm2022/ngwr-charts-core.mjs.map +1 -1
- package/fesm2022/ngwr-charts-meter-group.mjs +4 -2
- package/fesm2022/ngwr-charts-meter-group.mjs.map +1 -1
- package/fesm2022/ngwr-checkbox.mjs +3 -2
- package/fesm2022/ngwr-checkbox.mjs.map +1 -1
- package/fesm2022/ngwr-color-picker.mjs +21 -1
- package/fesm2022/ngwr-color-picker.mjs.map +1 -1
- package/fesm2022/ngwr-context-menu.mjs +4 -5
- package/fesm2022/ngwr-context-menu.mjs.map +1 -1
- package/fesm2022/ngwr-date-picker-testing.mjs.map +1 -1
- package/fesm2022/ngwr-date-picker.mjs +49 -1
- package/fesm2022/ngwr-date-picker.mjs.map +1 -1
- package/fesm2022/ngwr-dialog.mjs +16 -6
- package/fesm2022/ngwr-dialog.mjs.map +1 -1
- package/fesm2022/ngwr-directives.mjs +9 -6
- package/fesm2022/ngwr-directives.mjs.map +1 -1
- package/fesm2022/ngwr-event-calendar.mjs +20 -9
- package/fesm2022/ngwr-event-calendar.mjs.map +1 -1
- package/fesm2022/ngwr-form.mjs +170 -3
- package/fesm2022/ngwr-form.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-ar.mjs +15 -0
- package/fesm2022/ngwr-i18n-ar.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-cs.mjs +15 -0
- package/fesm2022/ngwr-i18n-cs.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-de.mjs +15 -0
- package/fesm2022/ngwr-i18n-de.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-en.mjs +15 -0
- package/fesm2022/ngwr-i18n-en.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-es.mjs +15 -0
- package/fesm2022/ngwr-i18n-es.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-fr.mjs +15 -0
- package/fesm2022/ngwr-i18n-fr.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-he.mjs +15 -0
- package/fesm2022/ngwr-i18n-he.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-hi.mjs +15 -0
- package/fesm2022/ngwr-i18n-hi.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-id.mjs +15 -0
- package/fesm2022/ngwr-i18n-id.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-it.mjs +15 -0
- package/fesm2022/ngwr-i18n-it.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-ja.mjs +15 -0
- package/fesm2022/ngwr-i18n-ja.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-ko.mjs +15 -0
- package/fesm2022/ngwr-i18n-ko.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-nl.mjs +15 -0
- package/fesm2022/ngwr-i18n-nl.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-pl.mjs +15 -0
- package/fesm2022/ngwr-i18n-pl.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-pt.mjs +15 -0
- package/fesm2022/ngwr-i18n-pt.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-ru.mjs +15 -0
- package/fesm2022/ngwr-i18n-ru.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-sv.mjs +15 -0
- package/fesm2022/ngwr-i18n-sv.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-tr.mjs +15 -0
- package/fesm2022/ngwr-i18n-tr.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-uk.mjs +15 -0
- package/fesm2022/ngwr-i18n-uk.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-vi.mjs +15 -0
- package/fesm2022/ngwr-i18n-vi.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-zh-tw.mjs +15 -0
- package/fesm2022/ngwr-i18n-zh-tw.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-zh.mjs +15 -0
- package/fesm2022/ngwr-i18n-zh.mjs.map +1 -1
- package/fesm2022/ngwr-i18n.mjs +82 -11
- package/fesm2022/ngwr-i18n.mjs.map +1 -1
- package/fesm2022/ngwr-input-number.mjs +24 -1
- package/fesm2022/ngwr-input-number.mjs.map +1 -1
- package/fesm2022/ngwr-input-otp.mjs +2 -2
- package/fesm2022/ngwr-input-otp.mjs.map +1 -1
- package/fesm2022/ngwr-input.mjs +10 -2
- package/fesm2022/ngwr-input.mjs.map +1 -1
- package/fesm2022/ngwr-layout.mjs.map +1 -1
- package/fesm2022/ngwr-list.mjs +1 -1
- package/fesm2022/ngwr-list.mjs.map +1 -1
- package/fesm2022/ngwr-loading-bar-router.mjs.map +1 -1
- package/fesm2022/ngwr-loading-bar.mjs +2 -2
- package/fesm2022/ngwr-loading-bar.mjs.map +1 -1
- package/fesm2022/ngwr-mention.mjs +8 -0
- package/fesm2022/ngwr-mention.mjs.map +1 -1
- package/fesm2022/ngwr-meta.mjs +9 -6
- package/fesm2022/ngwr-meta.mjs.map +1 -1
- package/fesm2022/ngwr-page-header.mjs +21 -0
- package/fesm2022/ngwr-page-header.mjs.map +1 -1
- package/fesm2022/ngwr-pagination.mjs +2 -0
- package/fesm2022/ngwr-pagination.mjs.map +1 -1
- package/fesm2022/ngwr-pipes.mjs +8 -1
- package/fesm2022/ngwr-pipes.mjs.map +1 -1
- package/fesm2022/ngwr-popconfirm.mjs +2 -1
- package/fesm2022/ngwr-popconfirm.mjs.map +1 -1
- package/fesm2022/ngwr-popover.mjs +47 -3
- package/fesm2022/ngwr-popover.mjs.map +1 -1
- package/fesm2022/ngwr-qr.mjs +6 -2
- package/fesm2022/ngwr-qr.mjs.map +1 -1
- package/fesm2022/ngwr-radio.mjs +71 -5
- package/fesm2022/ngwr-radio.mjs.map +1 -1
- package/fesm2022/ngwr-schema-form.mjs +10 -1
- package/fesm2022/ngwr-schema-form.mjs.map +1 -1
- package/fesm2022/ngwr-scroll.mjs +1 -3
- package/fesm2022/ngwr-scroll.mjs.map +1 -1
- package/fesm2022/ngwr-segmented.mjs +20 -0
- package/fesm2022/ngwr-segmented.mjs.map +1 -1
- package/fesm2022/ngwr-select.mjs +80 -9
- package/fesm2022/ngwr-select.mjs.map +1 -1
- package/fesm2022/ngwr-sortable-list.mjs +16 -4
- package/fesm2022/ngwr-sortable-list.mjs.map +1 -1
- package/fesm2022/ngwr-storage.mjs +1 -1
- package/fesm2022/ngwr-storage.mjs.map +1 -1
- package/fesm2022/ngwr-switch.mjs +2 -2
- package/fesm2022/ngwr-switch.mjs.map +1 -1
- package/fesm2022/ngwr-table.mjs +41 -7
- package/fesm2022/ngwr-table.mjs.map +1 -1
- package/fesm2022/ngwr-tabs-router.mjs.map +1 -1
- package/fesm2022/ngwr-textarea.mjs +2 -2
- package/fesm2022/ngwr-textarea.mjs.map +1 -1
- package/fesm2022/ngwr-toast.mjs +28 -0
- package/fesm2022/ngwr-toast.mjs.map +1 -1
- package/fesm2022/ngwr-tour.mjs +2 -2
- package/fesm2022/ngwr-tour.mjs.map +1 -1
- package/fesm2022/ngwr-typography.mjs +20 -0
- package/fesm2022/ngwr-typography.mjs.map +1 -1
- package/fesm2022/ngwr-utils-router.mjs.map +1 -1
- package/fesm2022/ngwr-utils.mjs +46 -4
- package/fesm2022/ngwr-utils.mjs.map +1 -1
- package/fesm2022/ngwr-validators.mjs +33 -1
- package/fesm2022/ngwr-validators.mjs.map +1 -1
- package/fesm2022/ngwr-version.mjs +1 -1
- package/fesm2022/ngwr-version.mjs.map +1 -1
- package/form/styles/_index.scss +37 -0
- package/graph/styles/_index.scss +1 -9
- package/i18n/ar.json +15 -0
- package/i18n/cs.json +15 -0
- package/i18n/de.json +15 -0
- package/i18n/en.json +15 -0
- package/i18n/es.json +15 -0
- package/i18n/fr.json +15 -0
- package/i18n/he.json +15 -0
- package/i18n/hi.json +15 -0
- package/i18n/id.json +15 -0
- package/i18n/it.json +15 -0
- package/i18n/ja.json +15 -0
- package/i18n/ko.json +15 -0
- package/i18n/nl.json +15 -0
- package/i18n/pl.json +15 -0
- package/i18n/pt.json +15 -0
- package/i18n/ru.json +15 -0
- package/i18n/sv.json +15 -0
- package/i18n/tr.json +15 -0
- package/i18n/uk.json +15 -0
- package/i18n/vi.json +15 -0
- package/i18n/zh-TW.json +15 -0
- package/i18n/zh.json +15 -0
- package/image-cropper/styles/_index.scss +1 -9
- package/input-number/styles/_index.scss +7 -0
- package/layout/styles/_index.scss +13 -1
- package/llms-full.txt +10 -10
- package/loading-bar/styles/_rules.scss +6 -0
- package/package.json +2 -2
- package/page-header/styles/_index.scss +18 -0
- package/popover/styles/_index.scss +7 -0
- package/schematics/use/symbol-map.json +2 -0
- package/segmented/styles/_index.scss +7 -0
- package/select/styles/_index.scss +7 -0
- package/sidebar/styles/_index.scss +6 -0
- package/skills/ngwr/references/catalog.md +1 -1
- package/sortable-list/styles/_rules.scss +1 -9
- package/speed-dial/styles/_index.scss +6 -0
- package/stepper/styles/_index.scss +1 -9
- package/table/styles/_index.scss +49 -0
- package/theme/_index.scss +12 -1
- package/theme/styles/_colors.scss +11 -0
- package/theme/styles/_contrast.scss +6 -0
- package/theme/styles/_index.scss +1 -0
- package/theme/styles/_mixins.scss +45 -0
- package/theme/styles/_print.scss +17 -0
- package/toast/styles/_index.scss +7 -0
- package/tour/styles/_index.scss +8 -0
- package/tree/styles/_index.scss +1 -9
- package/types/ngwr-anchor.d.ts +3 -0
- package/types/ngwr-animations-aurora.d.ts +6 -0
- package/types/ngwr-animations-blur-reveal.d.ts +6 -0
- package/types/ngwr-animations-click-sparks.d.ts +6 -0
- package/types/ngwr-animations-confetti.d.ts +6 -0
- package/types/ngwr-animations-decode.d.ts +6 -0
- package/types/ngwr-animations-destruct.d.ts +6 -0
- package/types/ngwr-animations-dot-grid.d.ts +6 -0
- package/types/ngwr-animations-falling-letters.d.ts +6 -0
- package/types/ngwr-animations-flow-lines.d.ts +6 -0
- package/types/ngwr-animations-fluid-cursor.d.ts +6 -0
- package/types/ngwr-animations-glitch.d.ts +6 -0
- package/types/ngwr-animations-glow-border.d.ts +6 -0
- package/types/ngwr-animations-gradient-flow.d.ts +6 -0
- package/types/ngwr-animations-marquee.d.ts +6 -0
- package/types/ngwr-animations-orbit.d.ts +6 -0
- package/types/ngwr-animations-reveal.d.ts +6 -0
- package/types/ngwr-animations-ripple-grid.d.ts +6 -0
- package/types/ngwr-animations-rotate-reveal.d.ts +6 -0
- package/types/ngwr-animations-shimmer.d.ts +6 -0
- package/types/ngwr-animations-spotlight.d.ts +6 -0
- package/types/ngwr-animations-thread-lines.d.ts +6 -0
- package/types/ngwr-animations-tilt.d.ts +10 -0
- package/types/ngwr-animations-typewriter.d.ts +6 -0
- package/types/ngwr-breadcrumbs.d.ts +25 -0
- package/types/ngwr-button.d.ts +23 -3
- package/types/ngwr-carousel.d.ts +2 -0
- package/types/ngwr-cascader.d.ts +7 -0
- package/types/ngwr-charts-core.d.ts +16 -0
- package/types/ngwr-charts-meter-group.d.ts +2 -0
- package/types/ngwr-checkbox.d.ts +1 -0
- package/types/ngwr-color-picker.d.ts +1 -0
- package/types/ngwr-context-menu.d.ts +1 -1
- package/types/ngwr-date-picker.d.ts +19 -0
- package/types/ngwr-dialog.d.ts +39 -8
- package/types/ngwr-directives.d.ts +12 -4
- package/types/ngwr-drawer.d.ts +1 -1
- package/types/ngwr-dropdown.d.ts +1 -1
- package/types/ngwr-event-calendar.d.ts +4 -0
- package/types/ngwr-form.d.ts +85 -1
- package/types/ngwr-i18n.d.ts +65 -5
- package/types/ngwr-input-number.d.ts +8 -0
- package/types/ngwr-input.d.ts +7 -0
- package/types/ngwr-layout.d.ts +1 -1
- package/types/ngwr-loading-bar-router.d.ts +6 -0
- package/types/ngwr-page-header.d.ts +23 -1
- package/types/ngwr-popconfirm.d.ts +1 -1
- package/types/ngwr-popover.d.ts +28 -4
- package/types/ngwr-radio.d.ts +47 -5
- package/types/ngwr-segmented.d.ts +7 -0
- package/types/ngwr-select.d.ts +57 -13
- package/types/ngwr-sortable-list.d.ts +20 -7
- package/types/ngwr-table.d.ts +58 -5
- package/types/ngwr-tabs-router.d.ts +6 -0
- package/types/ngwr-toast.d.ts +11 -0
- package/types/ngwr-tour.d.ts +0 -1
- package/types/ngwr-typography.d.ts +7 -0
- package/types/ngwr-utils-router.d.ts +6 -0
- package/types/ngwr-utils.d.ts +56 -2
- package/types/ngwr-validators.d.ts +49 -1
- package/types/ngwr-version.d.ts +1 -1
- package/typography/styles/_index.scss +4 -0
- package/window/styles/_index.scss +1 -9
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ngwr-cascader.mjs","names":[],"sources":["../../../projects/lib/cascader/cascader.ts","../../../projects/lib/cascader/cascader.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 } from '@angular/cdk/coercion';\nimport { type OverlayRef, ScrollStrategyOptions } from '@angular/cdk/overlay';\nimport { TemplatePortal } from '@angular/cdk/portal';\nimport {\n Component,\n DestroyRef,\n ElementRef,\n Injector,\n TemplateRef,\n ViewContainerRef,\n ViewEncapsulation,\n afterNextRender,\n computed,\n effect,\n inject,\n input,\n model,\n output,\n signal,\n untracked,\n viewChild,\n} from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport type { FormValueControl } from '@angular/forms/signals';\n\nimport { useFormFieldAria } from 'ngwr/form';\nimport { useI18nText } from 'ngwr/i18n';\nimport { WR_OVERLAY, WrOutsideClick, wrFollowDirection } from 'ngwr/overlay';\nimport { WR_LIVE_LOCALE, wrIsPrintableKey, wrToClassList, wrTypeahead, type WrClassInput } from 'ngwr/utils';\n\nimport type { WrCascaderOption } from './types';\n\nlet panelUid = 0;\n\n/**\n * Whether a keydown is a Tab that takes focus out of the open panel. The pane\n * lives in the overlay container at the end of `<body>`, so the browser's own Tab\n * out of it went to `<body>` — the top of the page — with the panel left standing.\n * The caller focuses the trigger synchronously and does NOT `preventDefault`, so\n * the browser's Tab carries on from there to the trigger's real neighbour — the\n * move `wr-dropdown` makes for its menu.\n *\n * Every Tab inside the pane leaves it, in either direction: the panel holds ONE\n * tab stop (the roving one, see `tabStop`), so there is nowhere else inside it for\n * Tab to go. Asking \"is there a later stop\" instead would also answer wrongly for\n * the moment between an arrow key moving focus and the render that moves the\n * `tabindex=\"0\"` after it.\n */\nfunction tabLeavesPane(pane: HTMLElement, event: KeyboardEvent): boolean {\n if (event.key !== 'Tab' || event.defaultPrevented || event.altKey || event.ctrlKey || event.metaKey) return false;\n const active = pane.ownerDocument.activeElement;\n return !!active && pane.contains(active);\n}\n\n/**\n * Multi-level select — drills down through hierarchical categories\n * (e.g. country → state → city). Each level renders as a column; clicks\n * advance to the next column. Selecting a leaf (no children) commits\n * the full path.\n *\n * A signal-forms native control: it implements `FormValueControl<unknown>`,\n * so `[formField]` binds straight to its `value` model — no\n * `ControlValueAccessor` in between. `[(value)]` works standalone. The value\n * is the path through the tree (an array from root to leaf).\n *\n * @example\n * ```html\n * <!-- signal forms -->\n * <wr-cascader [options]=\"locations\" [formField]=\"form.path\" placeholder=\"Pick a location\" />\n *\n * <!-- standalone two-way binding -->\n * <wr-cascader [options]=\"locations\" [(value)]=\"path\" placeholder=\"Pick a location\" />\n * ```\n *\n * ```ts\n * locations: WrCascaderOption[] = [\n * {\n * value: 'us', label: 'United States', children: [\n * { value: 'ny', label: 'New York', children: [\n * { value: 'nyc', label: 'NYC' },\n * { value: 'buf', label: 'Buffalo' },\n * ] },\n * ],\n * },\n * ];\n * ```\n *\n * @see https://ngwr.dev/reference/components/cascader\n */\nexport type WrCascaderSize = 'sm' | 'md' | 'lg';\n\n@Component({\n selector: 'wr-cascader',\n templateUrl: './cascader.html',\n styleUrl: './cascader.scss',\n encapsulation: ViewEncapsulation.None,\n host: { class: 'wr-cascader', '[class]': 'classes()' },\n})\nexport class WrCascader<T = string> implements FormValueControl<unknown> {\n /** Accessible name. Falls back to `select.clearSelection`, then `'Clear selection'`. */\n readonly clearLabel = input<string | null>(null);\n\n protected readonly resolvedClearLabel = useI18nText(this.clearLabel, 'select.clearSelection', 'Clear selection');\n\n /** Root-level options. Each may have `children` for deeper levels. */\n readonly options = input.required<readonly WrCascaderOption<T>[]>();\n\n /** Placeholder shown when no path is selected. @default '' */\n readonly placeholder = input<string>('');\n\n /**\n * Accessible name of the trigger. Falls back to the placeholder, then to\n * `select.label` — a `role=\"combobox\"` with nothing selected and no\n * placeholder otherwise has no name at all.\n */\n readonly ariaLabel = input<string | null>(null);\n\n private readonly labelText = useI18nText(this.ariaLabel, 'select.label', 'Select');\n protected readonly resolvedAriaLabel = computed(() => {\n // Not `??`: an empty placeholder must fall through to the catalog string.\n const explicit = this.ariaLabel();\n if (explicit) return explicit;\n const placeholder = this.placeholder();\n return placeholder ? placeholder : this.labelText();\n });\n\n /**\n * Disable the cascader. 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 changes while the trigger stays focusable and the path still submits.\n * Bound automatically from the field's readonly state when used with\n * `[formField]`.\n *\n * The panel is where every edit happens, so a read-only cascader simply does\n * not open — there is nothing to browse that is not already on the trigger —\n * and the clear button goes away with it. Mirrored as `aria-readonly`, which\n * role `combobox` 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 /**\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 * a cascader inside `<wr-form-field label=\"Region\">` announced its\n * PLACEHOLDER, or the generic `select.label` default, and the visible label\n * reached nobody. Nothing catches it: the control has a name, so axe is\n * satisfied, and the name is plausible, so a reader is too — it fails WCAG\n * 2.5.3, where the visible label has to be IN the accessible name. Same call\n * `wr-rating` and `wr-knob` already make.\n */\n protected readonly labelledBy = computed(() => (this.ariaLabel() ? null : this.fieldAria.labelledBy()));\n\n /** `null` once `aria-labelledby` is carrying the name — see {@link labelledBy}. */\n protected readonly nameLabel = computed(() => (this.labelledBy() ? null : this.resolvedAriaLabel()));\n\n /** Control size — shares the `--wr-control-*` contract. @default 'md' */\n readonly size = input<WrCascaderSize>('md');\n\n /** Pill-shaped corners on the trigger. @default false */\n readonly rounded = input(false, { transform: coerceBooleanProperty });\n\n /** Show a clear-all (×) button on the trigger when a path is selected. @default true */\n readonly clearable = input(true, { transform: coerceBooleanProperty });\n\n /**\n * Allow selecting non-leaf (parent) nodes. When `false`, only leaves\n * (nodes without children) commit a selection. @default false\n */\n readonly changeOnSelect = input(false, { transform: coerceBooleanProperty });\n\n /** Separator between labels in the trigger display. @default '/' */\n readonly separator = input<string>('/');\n\n /**\n * Focus the selected option, or the first one, when the panel opens. Off,\n * focus stays on the trigger: ArrowDown, ArrowUp or Tab there move into the\n * panel, and a letter jumps to the option it starts.\n *\n * @default false\n */\n readonly autoFocus = input(false, { transform: coerceBooleanProperty });\n\n /**\n * Extra CSS classes for the column panel's overlay pane.\n *\n * The pane is appended to the overlay container, not to this component, so\n * nothing in the consumer's own template encloses it and no descendant rule\n * written around the trigger can reach it. This input is the only per-instance\n * handle on it. A space-separated string works as well as an array.\n */\n readonly panelClass = input<WrClassInput>(null);\n\n /**\n * Committed selection path (full array from root to leaf). Bound by\n * `[formField]`, or two-way via `[(value)]`.\n */\n readonly value = model<unknown>([]);\n\n /** Emitted on blur / commit so a bound field can mark itself touched. */\n readonly touch = output<void>();\n\n /** Fires after the panel opens. */\n readonly opened = output<void>();\n\n /** Fires after the panel closes. */\n readonly closed = output<void>();\n\n /** Committed selection path (full T[] from root to leaf). @internal */\n protected readonly path = signal<readonly T[]>([]);\n\n /** Currently-expanded column path — drives which columns the panel shows. @internal */\n protected readonly activePath = signal<readonly T[]>([]);\n\n private readonly openState = signal(false);\n\n /** Whether the panel is open. Read-only: `open()` and `close()` change it. */\n readonly isOpen = this.openState.asReadonly();\n\n /**\n * The option the user last moved to inside the open panel — `null` until they\n * move, and again on every open. Written by an option's `focus` event, so\n * whatever moved the caret (an arrow, a click, a harness, a type-ahead letter)\n * moves the tab stop with it.\n */\n private readonly cursor = signal<{ readonly col: number; readonly value: T } | null>(null);\n\n /**\n * The panel's ONE tab stop, as in the APG tree pattern: the option the user\n * moved to, else the selected path's leaf, else the first enabled root. Every\n * other option carries `tabindex=\"-1\"` and is reached with the arrows, so a\n * deep tree is one Tab to enter and one to leave instead of a stop per option.\n *\n * Validated against what is ON SCREEN rather than trusted: choosing a sibling\n * prunes the deeper columns, and a value written from outside replaces the\n * path, so a remembered position can name an option that is gone. A disabled\n * option is never the stop — `focus()` would land on a choice nobody can make.\n * When the leaf itself is not on screen or is disabled, the deepest ancestor on\n * the path that is takes its place.\n */\n protected readonly tabStop = computed<{ readonly col: number; readonly value: T } | null>(() => {\n const cols = this.columns();\n const enabledAt = (col: number, value: T): boolean => !!cols[col]?.some(o => o.value === value && !o.disabled);\n\n const at = this.cursor();\n if (at && enabledAt(at.col, at.value)) return at;\n\n const path = this.path();\n const active = this.activePath();\n for (let col = Math.min(path.length, cols.length) - 1; col >= 0; col--) {\n // Column `col` lists the children of the ACTIVE path above it, so the path's\n // node at that depth is on screen only while the two agree that far down.\n if (!this.pathsEqual(path.slice(0, col), active.slice(0, col))) continue;\n if (enabledAt(col, path[col])) return { col, value: path[col] };\n }\n\n const first = cols[0]?.find(o => !o.disabled);\n return first ? { col: 0, value: first.value } : null;\n });\n\n private readonly liveLocale = inject(WR_LIVE_LOCALE, { optional: true });\n /** Letters typed in quick succession, for type-ahead. */\n private readonly typeahead = wrTypeahead({ locale: () => this.liveLocale?.() });\n\n /** Panel id used by the trigger's `aria-controls`. */\n protected readonly panelId = `wr-cascader-panel-${++panelUid}`;\n\n /**\n * Columns visible in the panel. Each column shows the children of the\n * preceding activePath entry. Column 0 = root options. The last\n * column is whatever the deepest active node's children resolve to —\n * we only render a column when there are children to show.\n */\n protected readonly columns = computed<readonly (readonly WrCascaderOption<T>[])[]>(() => {\n const cols: (readonly WrCascaderOption<T>[])[] = [this.options()];\n const trail = this.activePath();\n let list: readonly WrCascaderOption<T>[] = this.options();\n for (const v of trail) {\n const node = list.find(o => o.value === v);\n if (!node?.children?.length) break;\n cols.push(node.children);\n list = node.children;\n }\n return cols;\n });\n\n /** Label trail joined by `separator()` — what the trigger shows. */\n protected readonly displayLabel = computed(() => {\n const p = this.path();\n if (p.length === 0) return null;\n const labels: string[] = [];\n let list: readonly WrCascaderOption<T>[] = this.options();\n for (const v of p) {\n const node = list.find(o => o.value === v);\n if (!node) return null;\n labels.push(node.label);\n list = node.children ?? [];\n }\n const sep = ` ${this.separator()} `;\n return labels.join(sep);\n });\n\n protected readonly hasSelection = computed(() => this.path().length > 0);\n\n protected readonly classes = computed(() => {\n const parts: string[] = [];\n const size = this.size();\n if (size !== 'md') parts.push(`wr-cascader--${size}`);\n if (this.rounded()) parts.push('wr-cascader--rounded');\n if (this.isOpen()) parts.push('wr-cascader--open');\n if (this.disabled()) parts.push('wr-cascader--disabled');\n else if (this.readonly()) parts.push('wr-cascader--readonly');\n return parts.join(' ');\n });\n\n protected readonly panelTpl = viewChild.required('panelTpl', { read: TemplateRef });\n\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\n private readonly overlay = inject(WR_OVERLAY);\n private readonly outsideClick = inject(WrOutsideClick);\n private readonly vcr = inject(ViewContainerRef);\n private readonly scrollStrategies = inject(ScrollStrategyOptions);\n private readonly destroyRef = inject(DestroyRef);\n private readonly injector = inject(Injector);\n /**\n * Ambient reading direction, for the open panel alone — nothing in this\n * component reads it directly. Optional so a bare `TestBed` needs no\n * provider; `Directionality` is root-provided anyway, and a missing one\n * simply reads as `ltr`.\n */\n private readonly dir = inject(Directionality, { optional: true });\n private overlayRef: OverlayRef | null = null;\n\n constructor() {\n // Same contract as wr-select / wr-dropdown / wr-lightbox: an overlay lives in\n // the CDK container, not in this component's view, so destroying the\n // component while the panel is open would strand the pane and its scroll\n // strategy.\n this.destroyRef.onDestroy(() => this.closeOverlay(false));\n\n effect(() => {\n if (this.isOpen()) {\n this.openOverlay();\n } else {\n this.closeOverlay();\n }\n });\n\n // Close the panel if the control becomes disabled or read-only while open.\n effect(() => {\n if (this.disabled() || this.readonly()) this.openState.set(false);\n });\n\n // Mirror an external `value` write into the internal path/activePath\n // (the old `writeValue`). Skipped when the write merely echoes the\n // committed path, so a live drill-down can never be clobbered.\n effect(() => {\n // Coerce null/undefined/non-array to an empty path — a classic-forms\n // binding can write null, which the old `writeValue(value: unknown)`\n // treated as \"no selection\" too.\n const value = this.value();\n untracked(() => {\n const next: readonly T[] = Array.isArray(value) ? (value as readonly T[]) : [];\n if (this.pathsEqual(this.path(), next)) return;\n this.path.set(next);\n this.activePath.set(next);\n });\n });\n }\n\n /**\n * Focus the trigger — what Signal Forms calls to focus this control. The\n * panel stays shut: ArrowDown or a click opens it, the way it does after Tab.\n */\n focus(options?: FocusOptions): void {\n this.host.nativeElement.querySelector<HTMLElement>('.wr-cascader__trigger')?.focus(options);\n }\n\n /** Open the panel on the selected path, as the trigger does. Refused while disabled or read-only. */\n open(): void {\n if (this.disabled() || this.readonly() || this.isOpen()) return;\n this.activePath.set(this.path());\n this.openState.set(true);\n }\n\n /** Close the panel. */\n close(): void {\n this.openState.set(false);\n }\n\n // Template handlers\n\n protected onTriggerClick(): void {\n if (this.disabled() || this.readonly()) return;\n if (!this.isOpen()) this.activePath.set(this.path());\n this.openState.update(v => !v);\n }\n\n /**\n * ArrowDown / ArrowUp open the panel, Alt+ArrowDown included — the combobox way in,\n * and the shape `wr-dropdown`'s trigger uses. Enter and Space need no branch: the\n * trigger is a real `<button>`, so the browser turns them into the click above.\n *\n * Opening leaves the caret here unless `autoFocus` asks, so while the panel is\n * up the trigger is the way in: see {@link enterPanelFromTrigger}.\n */\n protected onTriggerKeydown(event: KeyboardEvent): void {\n if (this.disabled() || this.readonly()) return;\n if (this.isOpen()) {\n this.enterPanelFromTrigger(event);\n return;\n }\n\n // Backspace is the × from the keyboard, and it has to be: the × is a\n // `tabindex=\"-1\"` span INSIDE this button, and a keydown goes to the focused\n // element, so the `(keydown.enter)` / `(keydown.space)` it used to carry could\n // never fire. Clearing was reachable by pointer alone — a WCAG 2.1.1 failure,\n // not a missing convenience. The span stays unfocusable, because a focusable\n // child of a button is `nested-interactive`. Same key, same gating as\n // `wr-select`: `clearable()` IS the clear control, so a consumer who turned\n // the × off did not ask for a keyboard twin of it.\n if (event.key === 'Backspace') {\n if (!this.clearable() || !this.hasSelection()) return;\n event.preventDefault();\n this.clearSelection(event);\n return;\n }\n\n if (event.key !== 'ArrowDown' && event.key !== 'ArrowUp') return;\n event.preventDefault();\n this.activePath.set(this.path());\n this.openState.set(true);\n }\n\n /**\n * Keys on the trigger while the panel is open. The arrows and Tab move to the\n * panel's tab stop: the pane sits at the end of `<body>`, where the browser's\n * own Tab would not find it. A letter jumps to the option of that column it\n * starts. Shift+Tab, or Tab with nothing to land on, closes the panel and\n * moves on through the page.\n */\n private enterPanelFromTrigger(event: KeyboardEvent): void {\n const pane = this.overlayRef?.overlayElement;\n if (!pane || event.defaultPrevented) return;\n const stop = pane.querySelector<HTMLElement>('[role=\"treeitem\"][tabindex=\"0\"]');\n\n if (wrIsPrintableKey(event) && event.key !== ' ') {\n const column = stop?.closest<HTMLElement>('[role=\"group\"]');\n if (column && this.typeAhead(column, null, event)) event.preventDefault();\n return;\n }\n if (event.altKey || event.ctrlKey || event.metaKey) return;\n if (event.key === 'Tab') {\n if (event.shiftKey || !stop) {\n this.openState.set(false);\n return;\n }\n } else if (event.shiftKey || (event.key !== 'ArrowDown' && event.key !== 'ArrowUp')) {\n return;\n }\n event.preventDefault();\n stop?.focus();\n }\n\n protected onOptionClick(colIndex: number, opt: WrCascaderOption<T>, event: Event): void {\n event.stopPropagation();\n if (opt.disabled || this.disabled() || this.readonly()) return;\n\n const head = this.activePath().slice(0, colIndex);\n const newPath = [...head, opt.value];\n\n const hasChildren = !!opt.children?.length;\n\n // Always update active column for visual feedback / next column.\n this.activePath.set(newPath);\n // A pointer click focuses the option anyway (see `onOptionFocus`); a scripted\n // `click()` does not, and the tab stop belongs where the choice was made.\n this.cursor.set({ col: colIndex, value: opt.value });\n\n // Commit when we've reached a leaf, or when changeOnSelect is on.\n if (!hasChildren || this.changeOnSelect()) {\n this.path.set(newPath);\n this.value.set(newPath);\n this.touch.emit();\n // Close once we hit a true leaf — parent commits keep the panel open.\n if (!hasChildren) this.openState.set(false);\n }\n }\n\n /**\n * The tree keys the panel's roles promise, per the APG tree pattern: Up / Down\n * within a column, Home / End to its ends, the inline-end arrow into a branch's\n * children — opening the next column on the way — and the inline-start arrow back\n * to the option the column belongs to, or, from a root, closing the column it\n * opened. A letter moves to the next option in the column whose label starts with\n * what was typed. Enter and Space stay the commit.\n *\n * These are the ONLY way between options: the panel holds one tab stop (see\n * {@link tabStop}), and Tab leaves it.\n */\n protected onOptionKeydown(colIndex: number, opt: WrCascaderOption<T>, event: KeyboardEvent): void {\n const current = event.currentTarget as HTMLElement;\n const column = current.closest<HTMLElement>('[role=\"group\"]');\n if (!column) return;\n // Before the modifier check, because Shift is how a capital letter is typed.\n if (wrIsPrintableKey(event) && event.key !== ' ') {\n this.typeAhead(column, current, event);\n event.preventDefault();\n return;\n }\n if (event.altKey || event.ctrlKey || event.metaKey || event.shiftKey) return;\n const rtl = this.dir?.value === 'rtl';\n const inward = rtl ? 'ArrowLeft' : 'ArrowRight';\n const outward = rtl ? 'ArrowRight' : 'ArrowLeft';\n const enabled = [...column.querySelectorAll<HTMLElement>('[role=\"treeitem\"]')].filter(\n o => o.getAttribute('aria-disabled') !== 'true'\n );\n const at = enabled.indexOf(current);\n\n switch (event.key) {\n case 'ArrowDown':\n enabled[at + 1]?.focus();\n break;\n case 'ArrowUp':\n if (at > 0) enabled[at - 1].focus();\n break;\n case 'Home':\n enabled[0]?.focus();\n break;\n case 'End':\n enabled[enabled.length - 1]?.focus();\n break;\n case inward: {\n if (opt.disabled || !opt.children?.length || this.disabled() || this.readonly()) break;\n this.activePath.set([...this.activePath().slice(0, colIndex), opt.value]);\n // The column is not in the DOM until the render this write schedules.\n afterNextRender(\n () =>\n this.overlayRef?.overlayElement\n .querySelector<HTMLElement>(\n `#${this.columnId(colIndex + 1)} [role=\"treeitem\"]:not([aria-disabled=\"true\"])`\n )\n ?.focus(),\n { injector: this.injector }\n );\n break;\n }\n case outward: {\n if (colIndex > 0) {\n const parent = this.parentOptionId(colIndex);\n if (parent) this.overlayRef?.overlayElement.querySelector<HTMLElement>(`#${parent}`)?.focus();\n } else if (opt.children?.length && this.isActiveAt(colIndex, opt.value)) {\n this.activePath.set([]);\n }\n break;\n }\n case ' ':\n // The commit is `(keydown.space)`'s; the page scrolling a screen under the\n // panel is the browser's, and it went with every Space on an option.\n break;\n default:\n return;\n }\n event.preventDefault();\n }\n\n /** The caret reached an option, by whatever route — the tab stop follows it. */\n protected onOptionFocus(colIndex: number, opt: WrCascaderOption<T>): void {\n if (opt.disabled) return;\n this.cursor.set({ col: colIndex, value: opt.value });\n }\n\n /** Whether this option is the panel's one `tabindex=\"0\"`. */\n protected isTabStop(colIndex: number, opt: WrCascaderOption<T>): boolean {\n const stop = this.tabStop();\n return !opt.disabled && stop !== null && stop.col === colIndex && stop.value === opt.value;\n }\n\n /**\n * Move to the next enabled option in `column` whose label starts with the letters\n * typed so far: {@link wrTypeahead} over the column's labels. `current` is\n * `null` when the caret is not in the column yet.\n *\n * @returns whether the caret moved.\n */\n private typeAhead(column: HTMLElement, current: HTMLElement | null, event: KeyboardEvent): boolean {\n const enabled = [...column.querySelectorAll<HTMLElement>('[role=\"treeitem\"]')].filter(\n o => o.getAttribute('aria-disabled') !== 'true'\n );\n const labels = enabled.map(o => o.querySelector('.wr-cascader__opt-label')?.textContent ?? '');\n const index = this.typeahead.handleKey(event, labels, current ? enabled.indexOf(current) : -1);\n if (index === null || index < 0) return false;\n enabled[index].focus();\n return true;\n }\n\n protected clearSelection(event: Event): void {\n event.stopPropagation();\n if (this.disabled() || this.readonly()) return;\n this.path.set([]);\n this.activePath.set([]);\n this.value.set([]);\n this.touch.emit();\n }\n\n protected isActiveAt(colIndex: number, value: T): boolean {\n return this.activePath()[colIndex] === value;\n }\n\n /**\n * Whether this option is the committed choice — `null` when it is not a\n * choice at all.\n *\n * Two questions the panel has to keep apart, and `--active` answers only the\n * first: `activePath()` is where the user has NAVIGATED to, `path()` is what\n * they have COMMITTED. They agree once a leaf is picked and diverge for the\n * whole walk down.\n *\n * `null` — the attribute absent — on a branch while `changeOnSelect` is off,\n * because such a branch genuinely cannot be chosen; ARIA reads a missing\n * `aria-selected` as \"not selectable\", which is exactly true here. That makes\n * this binding the first expression the `changeOnSelect` contract has ever had\n * in ARIA, in both directions.\n */\n protected isSelectedAt(colIndex: number, opt: WrCascaderOption<T>): boolean | null {\n const committable = !opt.children?.length || this.changeOnSelect();\n if (!committable) return null;\n const path = this.path();\n return colIndex === path.length - 1 && path[colIndex] === opt.value;\n }\n\n /** Stable id for one option — what a column's `aria-labelledby` points at. */\n protected optionId(colIndex: number, optIndex: number): string {\n return `${this.panelId}-opt-${colIndex}-${optIndex}`;\n }\n\n /** Stable id for one column — what an expanded branch's `aria-controls` points at. */\n protected columnId(colIndex: number): string {\n return `${this.panelId}-col-${colIndex}`;\n }\n\n /**\n * The option whose children a column holds, by id — its accessible name.\n *\n * The columns are DOM SIBLINGS, so nothing in the markup says the second one\n * belongs to \"Europe\". Column 0 has no parent and stays unnamed; the tree\n * itself already carries the control's name.\n */\n protected parentOptionId(colIndex: number): string | null {\n if (colIndex === 0) return null;\n const parent = this.columns()[colIndex - 1] ?? [];\n const index = parent.findIndex(o => this.isActiveAt(colIndex - 1, o.value));\n return index < 0 ? null : this.optionId(colIndex - 1, index);\n }\n\n private pathsEqual(a: readonly T[], b: readonly T[]): boolean {\n return a.length === b.length && a.every((v, i) => v === b[i]);\n }\n\n // Overlay\n\n private openOverlay(): void {\n if (this.overlayRef) return;\n // Each open starts from the selected path, not from where the last visit ended.\n this.cursor.set(null);\n\n const positionStrategy = this.overlay\n .position()\n .flexibleConnectedTo(this.host)\n .withPositions([\n { originX: 'start', originY: 'bottom', overlayX: 'start', overlayY: 'top' },\n { originX: 'start', originY: 'top', overlayX: 'start', overlayY: 'bottom' },\n ])\n .withPush(true);\n\n this.overlayRef = this.overlay.create({\n positionStrategy,\n scrollStrategy: this.scrollStrategies.reposition(),\n panelClass: wrToClassList('wr-cascader-overlay', this.panelClass()),\n });\n\n // The columns cascade inline-wards, and the CDK captured the direction as a\n // string when this ref was created — so a flip while the panel is open left\n // the whole cascade running the other way from the page around it.\n wrFollowDirection(this.overlayRef, this.dir, this.injector);\n\n const portal = new TemplatePortal(this.panelTpl(), this.vcr);\n this.overlayRef.attach(portal);\n\n // Opening moves no focus unless `autoFocus` asks. The pane is appended to\n // `<body>`, where Tab from the trigger would not find it, so the trigger's\n // own arrows and Tab walk in: see `enterPanelFromTrigger`.\n //\n // `afterNextRender`, NOT `queueMicrotask`: under zoneless CD change detection runs\n // in a macrotask, so a microtask queued here fires before the columns are in the\n // DOM — the trap that once left `wr-calendar`'s ring and its real focus on\n // different days.\n if (this.autoFocus()) afterNextRender(() => this.focusPanelOption(), { injector: this.injector });\n\n this.outsideClick\n .outsidePointerEvents(this.overlayRef)\n .pipe(takeUntilDestroyed(this.destroyRef))\n .subscribe(event => {\n if (this.host.nativeElement.contains(event.target as Node)) return;\n this.openState.set(false);\n });\n\n this.overlayRef\n .keydownEvents()\n .pipe(takeUntilDestroyed(this.destroyRef))\n .subscribe(event => {\n if (event.key === 'Escape') {\n event.preventDefault();\n this.openState.set(false);\n return;\n }\n if (this.overlayRef && tabLeavesPane(this.overlayRef.overlayElement, event)) {\n this.host.nativeElement.querySelector<HTMLElement>('.wr-cascader__trigger')?.focus();\n this.openState.set(false);\n }\n });\n\n this.opened.emit();\n }\n\n /**\n * The option the panel opens on: its tab stop, which on open is the selected path's\n * leaf, else the first enabled root (see {@link tabStop}). A disabled option is\n * never the stop, so `focus()` cannot land on a choice nobody can make.\n */\n private focusPanelOption(): void {\n this.overlayRef?.overlayElement.querySelector<HTMLElement>('[role=\"treeitem\"][tabindex=\"0\"]')?.focus();\n }\n\n /** `notify: false` is the destroy path: an output cannot emit from a destroyed view. */\n private closeOverlay(notify = true): void {\n if (!this.overlayRef) return;\n // Every option commits on Enter, so on the keyboard the caret is INSIDE the\n // pane when a choice is made — and the ordinary way to finish choosing (`onOptionClick` on a leaf) closes it.\n // Disposing without handing focus back dropped it on `<body>` on the SUCCESS\n // path, not merely on dismissal: a keyboard user who had just picked a value\n // then had to Tab from the top of the document to get back to the control.\n // Untouched when focus had already moved elsewhere — that click is usually\n // what closed us, and stealing the caret back would fight the user for it.\n const pane = this.overlayRef.overlayElement;\n const focusWasInside = pane.contains(this.host.nativeElement.ownerDocument.activeElement);\n this.overlayRef.dispose();\n this.overlayRef = null;\n if (!notify) return;\n if (focusWasInside) this.host.nativeElement.querySelector<HTMLElement>('.wr-cascader__trigger')?.focus();\n this.closed.emit();\n }\n}\n\nexport type { WrCascaderOption } from './types';\n","<button\n type=\"button\"\n class=\"wr-cascader__trigger\"\n role=\"combobox\"\n [attr.aria-label]=\"nameLabel()\"\n [attr.aria-labelledby]=\"labelledBy()\"\n [disabled]=\"disabled()\"\n [attr.aria-haspopup]=\"'tree'\"\n [attr.aria-expanded]=\"isOpen()\"\n [attr.aria-controls]=\"panelId\"\n [attr.aria-readonly]=\"readonly() || null\"\n [attr.aria-invalid]=\"fieldAria.ariaInvalid()\"\n [attr.aria-describedby]=\"fieldAria.describedBy()\"\n (click)=\"onTriggerClick()\"\n (keydown)=\"onTriggerKeydown($event)\"\n (blur)=\"touch.emit()\"\n>\n @if (displayLabel(); as label) {\n <span class=\"wr-cascader__value\">{{ label }}</span>\n } @else {\n <span class=\"wr-cascader__placeholder\">{{ placeholder() }}</span>\n }\n\n @if (clearable() && hasSelection() && !disabled() && !readonly()) {\n <span\n class=\"wr-cascader__clear\"\n role=\"button\"\n [attr.aria-label]=\"resolvedClearLabel()\"\n tabindex=\"-1\"\n (click)=\"clearSelection($event)\"\n >\n <svg\n class=\"wr-icon__svg\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n >\n <path d=\"M18 6 6 18\" />\n <path d=\"m6 6 12 12\" />\n </svg>\n </span>\n }\n\n <svg\n class=\"wr-icon__svg wr-cascader__chevron\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n >\n <path d=\"m6 9 6 6 6-6\" />\n </svg>\n</button>\n\n<ng-template #panelTpl>\n <div\n class=\"wr-cascader-panel\"\n [class.wr-cascader-panel--sm]=\"size() === 'sm'\"\n [class.wr-cascader-panel--lg]=\"size() === 'lg'\"\n role=\"tree\"\n [attr.id]=\"panelId\"\n [attr.aria-label]=\"resolvedAriaLabel()\"\n >\n <!--\n tree / group / treeitem, and NOT menu. A combobox's popup may be a listbox,\n a tree, a grid or a dialog and nothing else, so `aria-haspopup=\"menu\"` on\n the trigger was an author error — and a `menu` may own menuitems and\n groups, never other menus, so the columns were a second one. Neither is\n visible to axe: `menu` is a valid token for the global `aria-haspopup`, and\n `aria-required-children` passes a menu-inside-menu (measured against this\n exact fragment). A tree is what this control has always been — the value is\n a PATH, and only `treeitem` supports aria-expanded, aria-level,\n aria-setsize, aria-posinset and aria-selected at once.\n\n The columns stay `group` rather than collapsing to `role=\"presentation\"`,\n which is also axe-clean: the DOM is column-MAJOR, so a flat tree would\n leave level plus document order as the only structure, and \"Germany\"\n (level 2) would read as a child of \"Antarctica\" (level 1, the item\n immediately before it in source order).\n -->\n @for (col of columns(); track $index; let colIndex = $index) {\n <ul\n class=\"wr-cascader__col\"\n role=\"group\"\n [attr.id]=\"columnId(colIndex)\"\n [attr.aria-labelledby]=\"parentOptionId(colIndex)\"\n >\n @for (opt of col; track opt.value; let optIndex = $index) {\n <!--\n `aria-expanded` is exactly `isActiveAt`: `columns()` renders the next\n column for the active option and only when it has children, so the\n state can never claim a column that is not on screen — and\n `aria-controls` rides that same invariant, which is what makes\n \"expanded\" refer to something when the expanded content is a SIBLING\n rather than a descendant. It is emitted only while expanded: a\n reference to an absent id is a violation with `aria-expanded=\"true\"`\n and clean while collapsed.\n\n `aria-level` is load-bearing rather than decorative. The columns are\n siblings, so the DOM ancestry represents no level at all and every\n option would read as level 1. `aria-setsize` / `aria-posinset` are\n not strictly required — each column IS a complete sibling set — and\n are written anyway, because a tree that owns sibling groups is the\n uncommon shape where browser/AT pairs are known to miscompute both.\n\n `aria-selected` is written on every option that can be COMMITTED,\n `false` included, matching `wr-tree`. The alternative a reviewer may\n prefer: only the selected node, leaning on treeitem's implicit false,\n which is quieter in a long column and loses the \"this row is\n selectable\" signal that presence carries.\n\n `tabindex` is a ROVING stop, as in the APG tree pattern: one option\n carries `0` (see `tabStop`) and every other one `-1`, so the panel is\n one Tab to enter and one to leave, and the arrows move between options.\n -->\n <li\n class=\"wr-cascader__opt\"\n role=\"treeitem\"\n [attr.id]=\"optionId(colIndex, optIndex)\"\n [class.wr-cascader__opt--active]=\"isActiveAt(colIndex, opt.value)\"\n [class.wr-cascader__opt--disabled]=\"opt.disabled\"\n [attr.tabindex]=\"isTabStop(colIndex, opt) ? 0 : -1\"\n [attr.aria-disabled]=\"opt.disabled ? true : null\"\n [attr.aria-level]=\"colIndex + 1\"\n [attr.aria-setsize]=\"$count\"\n [attr.aria-posinset]=\"optIndex + 1\"\n [attr.aria-selected]=\"isSelectedAt(colIndex, opt)\"\n [attr.aria-expanded]=\"opt.children?.length ? isActiveAt(colIndex, opt.value) : null\"\n [attr.aria-controls]=\"\n opt.children?.length && isActiveAt(colIndex, opt.value) ? columnId(colIndex + 1) : null\n \"\n (click)=\"onOptionClick(colIndex, opt, $event)\"\n (focus)=\"onOptionFocus(colIndex, opt)\"\n (keydown)=\"onOptionKeydown(colIndex, opt, $event)\"\n (keydown.enter)=\"onOptionClick(colIndex, opt, $event)\"\n (keydown.space)=\"onOptionClick(colIndex, opt, $event)\"\n >\n <span class=\"wr-cascader__opt-label\">{{ opt.label }}</span>\n @if (opt.children?.length) {\n <svg\n class=\"wr-icon__svg wr-cascader__opt-arrow\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n >\n <path d=\"m9 18 6-6-6-6\" />\n </svg>\n }\n </li>\n }\n </ul>\n }\n </div>\n</ng-template>\n"],"mappings":";;;;;;;;;;;;;;;;;AAwCA,IAAI,WAAW;AAgBf,SAAS,cAAc,MAAmB,OAAoB;CAC5D,IAAI,MAAM,QAAQ,SAAS,MAAM,oBAAoB,MAAM,UAAU,MAAM,WAAW,MAAM,SAAS,OAAO;CAC5G,MAAM,SAAS,KAAK,cAAc;CAClC,OAAO,CAAC,CAAC,UAAU,KAAK,SAAS,MAAM;AACzC;AA8CA,I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AA,CAAA;EAAA,OAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,OAAA;EAAA,CAAA;EAAA,QAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,QAAA;EAAA,CAAA;EAAA,QAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,QAAA;EAAA,CAAA;EAAA,UAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,YAAU;IAAI,MAAM;IAAa,UAAA;GAAA,CAAA;EAAA,CAAA;CAAA;AAAA,CAAA"}
|
|
1
|
+
{"version":3,"file":"ngwr-cascader.mjs","names":[],"sources":["../../../projects/lib/cascader/cascader.ts","../../../projects/lib/cascader/cascader.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 } from '@angular/cdk/coercion';\nimport { type OverlayRef, ScrollStrategyOptions } from '@angular/cdk/overlay';\nimport { TemplatePortal } from '@angular/cdk/portal';\nimport {\n Component,\n DestroyRef,\n ElementRef,\n Injector,\n TemplateRef,\n ViewContainerRef,\n ViewEncapsulation,\n afterNextRender,\n computed,\n effect,\n inject,\n input,\n model,\n output,\n signal,\n untracked,\n viewChild,\n} from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport type { FormValueControl } from '@angular/forms/signals';\n\nimport { useFormFieldAria } from 'ngwr/form';\nimport { useI18nText } from 'ngwr/i18n';\nimport { WR_OVERLAY, WrOutsideClick, wrFollowDirection } from 'ngwr/overlay';\nimport { WR_LIVE_LOCALE, wrIsPrintableKey, wrToClassList, wrTypeahead, type WrClassInput } from 'ngwr/utils';\n\nimport type { WrCascaderOption } from './types';\n\nlet panelUid = 0;\n\n/**\n * Whether a keydown is a Tab that takes focus out of the open panel. The pane\n * lives in the overlay container at the end of `<body>`, so the browser's own Tab\n * out of it went to `<body>` — the top of the page — with the panel left standing.\n * The caller focuses the trigger synchronously and does NOT `preventDefault`, so\n * the browser's Tab carries on from there to the trigger's real neighbour — the\n * move `wr-dropdown` makes for its menu.\n *\n * Every Tab inside the pane leaves it, in either direction: the panel holds ONE\n * tab stop (the roving one, see `tabStop`), so there is nowhere else inside it for\n * Tab to go. Asking \"is there a later stop\" instead would also answer wrongly for\n * the moment between an arrow key moving focus and the render that moves the\n * `tabindex=\"0\"` after it.\n */\nfunction tabLeavesPane(pane: HTMLElement, event: KeyboardEvent): boolean {\n if (event.key !== 'Tab' || event.defaultPrevented || event.altKey || event.ctrlKey || event.metaKey) return false;\n const active = pane.ownerDocument.activeElement;\n return !!active && pane.contains(active);\n}\n\n/**\n * Multi-level select — drills down through hierarchical categories\n * (e.g. country → state → city). Each level renders as a column; clicks\n * advance to the next column. Selecting a leaf (no children) commits\n * the full path.\n *\n * A signal-forms native control: it implements `FormValueControl<unknown>`,\n * so `[formField]` binds straight to its `value` model — no\n * `ControlValueAccessor` in between. `[(value)]` works standalone. The value\n * is the path through the tree (an array from root to leaf).\n *\n * @example\n * ```html\n * <!-- signal forms -->\n * <wr-cascader [options]=\"locations\" [formField]=\"form.path\" placeholder=\"Pick a location\" />\n *\n * <!-- standalone two-way binding -->\n * <wr-cascader [options]=\"locations\" [(value)]=\"path\" placeholder=\"Pick a location\" />\n * ```\n *\n * ```ts\n * locations: WrCascaderOption[] = [\n * {\n * value: 'us', label: 'United States', children: [\n * { value: 'ny', label: 'New York', children: [\n * { value: 'nyc', label: 'NYC' },\n * { value: 'buf', label: 'Buffalo' },\n * ] },\n * ],\n * },\n * ];\n * ```\n *\n * @see https://ngwr.dev/reference/components/cascader\n */\nexport type WrCascaderSize = 'sm' | 'md' | 'lg';\n\n@Component({\n selector: 'wr-cascader',\n templateUrl: './cascader.html',\n styleUrl: './cascader.scss',\n encapsulation: ViewEncapsulation.None,\n host: { class: 'wr-cascader', '[class]': 'classes()' },\n})\nexport class WrCascader<T = string> implements FormValueControl<unknown> {\n /** Accessible name. Falls back to `select.clearSelection`, then `'Clear selection'`. */\n readonly clearLabel = input<string | null>(null);\n\n protected readonly resolvedClearLabel = useI18nText(this.clearLabel, 'select.clearSelection', 'Clear selection');\n\n /** Root-level options. Each may have `children` for deeper levels. */\n readonly options = input.required<readonly WrCascaderOption<T>[]>();\n\n /** Placeholder shown when no path is selected. @default '' */\n readonly placeholder = input<string>('');\n\n /**\n * Accessible name of the trigger. Falls back to the placeholder, then to\n * `select.label` — a `role=\"combobox\"` with nothing selected and no\n * placeholder otherwise has no name at all.\n */\n readonly ariaLabel = input<string | null>(null);\n\n private readonly labelText = useI18nText(this.ariaLabel, 'select.label', 'Select');\n protected readonly resolvedAriaLabel = computed(() => {\n // Not `??`: an empty placeholder must fall through to the catalog string.\n const explicit = this.ariaLabel();\n if (explicit) return explicit;\n const placeholder = this.placeholder();\n return placeholder ? placeholder : this.labelText();\n });\n\n /**\n * Disable the cascader. 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 changes while the trigger stays focusable and the path still submits.\n * Bound automatically from the field's readonly state when used with\n * `[formField]`.\n *\n * The panel is where every edit happens, so a read-only cascader simply does\n * not open — there is nothing to browse that is not already on the trigger —\n * and the clear button goes away with it. Mirrored as `aria-readonly`, which\n * role `combobox` 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 /**\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 * a cascader inside `<wr-form-field label=\"Region\">` announced its\n * PLACEHOLDER, or the generic `select.label` default, and the visible label\n * reached nobody. Nothing catches it: the control has a name, so axe is\n * satisfied, and the name is plausible, so a reader is too — it fails WCAG\n * 2.5.3, where the visible label has to be IN the accessible name. Same call\n * `wr-rating` and `wr-knob` already make.\n */\n protected readonly labelledBy = computed(() => (this.ariaLabel() ? null : this.fieldAria.labelledBy()));\n\n /** `null` once `aria-labelledby` is carrying the name — see {@link labelledBy}. */\n protected readonly nameLabel = computed(() => (this.labelledBy() ? null : this.resolvedAriaLabel()));\n\n /** Control size — shares the `--wr-control-*` contract. @default 'md' */\n readonly size = input<WrCascaderSize>('md');\n\n /** Stretch the cascader to fill its parent's width. @default false */\n readonly block = input(false, { transform: coerceBooleanProperty });\n\n /** Pill-shaped corners on the trigger. @default false */\n readonly rounded = input(false, { transform: coerceBooleanProperty });\n\n /** Show a clear-all (×) button on the trigger when a path is selected. @default true */\n readonly clearable = input(true, { transform: coerceBooleanProperty });\n\n /**\n * Allow selecting non-leaf (parent) nodes. When `false`, only leaves\n * (nodes without children) commit a selection. @default false\n */\n readonly changeOnSelect = input(false, { transform: coerceBooleanProperty });\n\n /** Separator between labels in the trigger display. @default '/' */\n readonly separator = input<string>('/');\n\n /**\n * Focus the selected option, or the first one, when the panel opens. Off,\n * focus stays on the trigger: ArrowDown, ArrowUp or Tab there move into the\n * panel, and a letter jumps to the option it starts.\n *\n * @default false\n */\n readonly autoFocus = input(false, { transform: coerceBooleanProperty });\n\n /**\n * Extra CSS classes for the column panel's overlay pane.\n *\n * The pane is appended to the overlay container, not to this component, so\n * nothing in the consumer's own template encloses it and no descendant rule\n * written around the trigger can reach it. This input is the only per-instance\n * handle on it. A space-separated string works as well as an array.\n */\n readonly panelClass = input<WrClassInput>(null);\n\n /**\n * Committed selection path (full array from root to leaf). Bound by\n * `[formField]`, or two-way via `[(value)]`.\n */\n readonly value = model<unknown>([]);\n\n /** Emitted on blur / commit so a bound field can mark itself touched. */\n readonly touch = output<void>();\n\n /** Fires after the panel opens. */\n readonly opened = output<void>();\n\n /** Fires after the panel closes. */\n readonly closed = output<void>();\n\n /** Committed selection path (full T[] from root to leaf). @internal */\n protected readonly path = signal<readonly T[]>([]);\n\n /** Currently-expanded column path — drives which columns the panel shows. @internal */\n protected readonly activePath = signal<readonly T[]>([]);\n\n private readonly openState = signal(false);\n\n /** Whether the panel is open. Read-only: `open()` and `close()` change it. */\n readonly isOpen = this.openState.asReadonly();\n\n /**\n * The option the user last moved to inside the open panel — `null` until they\n * move, and again on every open. Written by an option's `focus` event, so\n * whatever moved the caret (an arrow, a click, a harness, a type-ahead letter)\n * moves the tab stop with it.\n */\n private readonly cursor = signal<{ readonly col: number; readonly value: T } | null>(null);\n\n /**\n * The panel's ONE tab stop, as in the APG tree pattern: the option the user\n * moved to, else the selected path's leaf, else the first enabled root. Every\n * other option carries `tabindex=\"-1\"` and is reached with the arrows, so a\n * deep tree is one Tab to enter and one to leave instead of a stop per option.\n *\n * Validated against what is ON SCREEN rather than trusted: choosing a sibling\n * prunes the deeper columns, and a value written from outside replaces the\n * path, so a remembered position can name an option that is gone. A disabled\n * option is never the stop — `focus()` would land on a choice nobody can make.\n * When the leaf itself is not on screen or is disabled, the deepest ancestor on\n * the path that is takes its place.\n */\n protected readonly tabStop = computed<{ readonly col: number; readonly value: T } | null>(() => {\n const cols = this.columns();\n const enabledAt = (col: number, value: T): boolean => !!cols[col]?.some(o => o.value === value && !o.disabled);\n\n const at = this.cursor();\n if (at && enabledAt(at.col, at.value)) return at;\n\n const path = this.path();\n const active = this.activePath();\n for (let col = Math.min(path.length, cols.length) - 1; col >= 0; col--) {\n // Column `col` lists the children of the ACTIVE path above it, so the path's\n // node at that depth is on screen only while the two agree that far down.\n if (!this.pathsEqual(path.slice(0, col), active.slice(0, col))) continue;\n if (enabledAt(col, path[col])) return { col, value: path[col] };\n }\n\n const first = cols[0]?.find(o => !o.disabled);\n return first ? { col: 0, value: first.value } : null;\n });\n\n private readonly liveLocale = inject(WR_LIVE_LOCALE, { optional: true });\n /** Letters typed in quick succession, for type-ahead. */\n private readonly typeahead = wrTypeahead({ locale: () => this.liveLocale?.() });\n\n /** Panel id used by the trigger's `aria-controls`. */\n protected readonly panelId = `wr-cascader-panel-${++panelUid}`;\n\n /**\n * Columns visible in the panel. Each column shows the children of the\n * preceding activePath entry. Column 0 = root options. The last\n * column is whatever the deepest active node's children resolve to —\n * we only render a column when there are children to show.\n */\n protected readonly columns = computed<readonly (readonly WrCascaderOption<T>[])[]>(() => {\n const cols: (readonly WrCascaderOption<T>[])[] = [this.options()];\n const trail = this.activePath();\n let list: readonly WrCascaderOption<T>[] = this.options();\n for (const v of trail) {\n const node = list.find(o => o.value === v);\n if (!node?.children?.length) break;\n cols.push(node.children);\n list = node.children;\n }\n return cols;\n });\n\n /** Label trail joined by `separator()` — what the trigger shows. */\n protected readonly displayLabel = computed(() => {\n const p = this.path();\n if (p.length === 0) return null;\n const labels: string[] = [];\n let list: readonly WrCascaderOption<T>[] = this.options();\n for (const v of p) {\n const node = list.find(o => o.value === v);\n if (!node) return null;\n labels.push(node.label);\n list = node.children ?? [];\n }\n const sep = ` ${this.separator()} `;\n return labels.join(sep);\n });\n\n protected readonly hasSelection = computed(() => this.path().length > 0);\n\n protected readonly classes = computed(() => {\n const parts: string[] = [];\n const size = this.size();\n if (size !== 'md') parts.push(`wr-cascader--${size}`);\n if (this.rounded()) parts.push('wr-cascader--rounded');\n if (this.block()) parts.push('wr-cascader--block');\n if (this.isOpen()) parts.push('wr-cascader--open');\n if (this.disabled()) parts.push('wr-cascader--disabled');\n else if (this.readonly()) parts.push('wr-cascader--readonly');\n return parts.join(' ');\n });\n\n protected readonly panelTpl = viewChild.required('panelTpl', { read: TemplateRef });\n\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\n private readonly overlay = inject(WR_OVERLAY);\n private readonly outsideClick = inject(WrOutsideClick);\n private readonly vcr = inject(ViewContainerRef);\n private readonly scrollStrategies = inject(ScrollStrategyOptions);\n private readonly destroyRef = inject(DestroyRef);\n private readonly injector = inject(Injector);\n /**\n * Ambient reading direction, for the open panel alone — nothing in this\n * component reads it directly. Optional so a bare `TestBed` needs no\n * provider; `Directionality` is root-provided anyway, and a missing one\n * simply reads as `ltr`.\n */\n private readonly dir = inject(Directionality, { optional: true });\n private overlayRef: OverlayRef | null = null;\n\n constructor() {\n // Same contract as wr-select / wr-dropdown / wr-lightbox: an overlay lives in\n // the CDK container, not in this component's view, so destroying the\n // component while the panel is open would strand the pane and its scroll\n // strategy.\n this.destroyRef.onDestroy(() => this.closeOverlay(false));\n\n effect(() => {\n if (this.isOpen()) {\n this.openOverlay();\n } else {\n this.closeOverlay();\n }\n });\n\n // Close the panel if the control becomes disabled or read-only while open.\n effect(() => {\n if (this.disabled() || this.readonly()) this.openState.set(false);\n });\n\n // Mirror an external `value` write into the internal path/activePath\n // (the old `writeValue`). Skipped when the write merely echoes the\n // committed path, so a live drill-down can never be clobbered.\n effect(() => {\n // Coerce null/undefined/non-array to an empty path — a classic-forms\n // binding can write null, which the old `writeValue(value: unknown)`\n // treated as \"no selection\" too.\n const value = this.value();\n untracked(() => {\n const next: readonly T[] = Array.isArray(value) ? (value as readonly T[]) : [];\n if (this.pathsEqual(this.path(), next)) return;\n this.path.set(next);\n this.activePath.set(next);\n });\n });\n }\n\n /**\n * Focus the trigger — what Signal Forms calls to focus this control. The\n * panel stays shut: ArrowDown or a click opens it, the way it does after Tab.\n */\n focus(options?: FocusOptions): void {\n this.host.nativeElement.querySelector<HTMLElement>('.wr-cascader__trigger')?.focus(options);\n }\n\n /** Open the panel on the selected path, as the trigger does. Refused while disabled or read-only. */\n open(): void {\n if (this.disabled() || this.readonly() || this.isOpen()) return;\n this.activePath.set(this.path());\n this.openState.set(true);\n }\n\n /** Close the panel. */\n close(): void {\n this.openState.set(false);\n }\n\n // Template handlers\n\n protected onTriggerClick(): void {\n if (this.disabled() || this.readonly()) return;\n if (!this.isOpen()) this.activePath.set(this.path());\n this.openState.update(v => !v);\n }\n\n /**\n * ArrowDown / ArrowUp open the panel, Alt+ArrowDown included — the combobox way in,\n * and the shape `wr-dropdown`'s trigger uses. Enter and Space need no branch: the\n * trigger is a real `<button>`, so the browser turns them into the click above.\n *\n * Opening leaves the caret here unless `autoFocus` asks, so while the panel is\n * up the trigger is the way in: see {@link enterPanelFromTrigger}.\n */\n protected onTriggerKeydown(event: KeyboardEvent): void {\n if (this.disabled() || this.readonly()) return;\n if (this.isOpen()) {\n this.enterPanelFromTrigger(event);\n return;\n }\n\n // Backspace is the × from the keyboard, and it has to be: the × is a\n // `tabindex=\"-1\"` span INSIDE this button, and a keydown goes to the focused\n // element, so the `(keydown.enter)` / `(keydown.space)` it used to carry could\n // never fire. Clearing was reachable by pointer alone — a WCAG 2.1.1 failure,\n // not a missing convenience. The span stays unfocusable, because a focusable\n // child of a button is `nested-interactive`. Same key, same gating as\n // `wr-select`: `clearable()` IS the clear control, so a consumer who turned\n // the × off did not ask for a keyboard twin of it.\n if (event.key === 'Backspace') {\n if (!this.clearable() || !this.hasSelection()) return;\n event.preventDefault();\n this.clearSelection(event);\n return;\n }\n\n if (event.key !== 'ArrowDown' && event.key !== 'ArrowUp') return;\n event.preventDefault();\n this.activePath.set(this.path());\n this.openState.set(true);\n }\n\n /**\n * Keys on the trigger while the panel is open. The arrows and Tab move to the\n * panel's tab stop: the pane sits at the end of `<body>`, where the browser's\n * own Tab would not find it. A letter jumps to the option of that column it\n * starts. Shift+Tab, or Tab with nothing to land on, closes the panel and\n * moves on through the page.\n */\n private enterPanelFromTrigger(event: KeyboardEvent): void {\n const pane = this.overlayRef?.overlayElement;\n if (!pane || event.defaultPrevented) return;\n const stop = pane.querySelector<HTMLElement>('[role=\"treeitem\"][tabindex=\"0\"]');\n\n if (wrIsPrintableKey(event) && event.key !== ' ') {\n const column = stop?.closest<HTMLElement>('[role=\"group\"]');\n if (column && this.typeAhead(column, null, event)) event.preventDefault();\n return;\n }\n if (event.altKey || event.ctrlKey || event.metaKey) return;\n if (event.key === 'Tab') {\n if (event.shiftKey || !stop) {\n this.openState.set(false);\n return;\n }\n } else if (event.shiftKey || (event.key !== 'ArrowDown' && event.key !== 'ArrowUp')) {\n return;\n }\n event.preventDefault();\n stop?.focus();\n }\n\n protected onOptionClick(colIndex: number, opt: WrCascaderOption<T>, event: Event): void {\n event.stopPropagation();\n if (opt.disabled || this.disabled() || this.readonly()) return;\n\n const head = this.activePath().slice(0, colIndex);\n const newPath = [...head, opt.value];\n\n const hasChildren = !!opt.children?.length;\n\n // Always update active column for visual feedback / next column.\n this.activePath.set(newPath);\n // A pointer click focuses the option anyway (see `onOptionFocus`); a scripted\n // `click()` does not, and the tab stop belongs where the choice was made.\n this.cursor.set({ col: colIndex, value: opt.value });\n\n // Commit when we've reached a leaf, or when changeOnSelect is on.\n if (!hasChildren || this.changeOnSelect()) {\n this.path.set(newPath);\n this.value.set(newPath);\n this.touch.emit();\n // Close once we hit a true leaf — parent commits keep the panel open.\n if (!hasChildren) this.openState.set(false);\n }\n }\n\n /**\n * The tree keys the panel's roles promise, per the APG tree pattern: Up / Down\n * within a column, Home / End to its ends, the inline-end arrow into a branch's\n * children — opening the next column on the way — and the inline-start arrow back\n * to the option the column belongs to, or, from a root, closing the column it\n * opened. A letter moves to the next option in the column whose label starts with\n * what was typed. Enter and Space stay the commit.\n *\n * These are the ONLY way between options: the panel holds one tab stop (see\n * {@link tabStop}), and Tab leaves it.\n */\n protected onOptionKeydown(colIndex: number, opt: WrCascaderOption<T>, event: KeyboardEvent): void {\n const current = event.currentTarget as HTMLElement;\n const column = current.closest<HTMLElement>('[role=\"group\"]');\n if (!column) return;\n // Before the modifier check, because Shift is how a capital letter is typed.\n if (wrIsPrintableKey(event) && event.key !== ' ') {\n this.typeAhead(column, current, event);\n event.preventDefault();\n return;\n }\n if (event.altKey || event.ctrlKey || event.metaKey || event.shiftKey) return;\n const rtl = this.dir?.value === 'rtl';\n const inward = rtl ? 'ArrowLeft' : 'ArrowRight';\n const outward = rtl ? 'ArrowRight' : 'ArrowLeft';\n const enabled = [...column.querySelectorAll<HTMLElement>('[role=\"treeitem\"]')].filter(\n o => o.getAttribute('aria-disabled') !== 'true'\n );\n const at = enabled.indexOf(current);\n\n switch (event.key) {\n case 'ArrowDown':\n enabled[at + 1]?.focus();\n break;\n case 'ArrowUp':\n if (at > 0) enabled[at - 1].focus();\n break;\n case 'Home':\n enabled[0]?.focus();\n break;\n case 'End':\n enabled[enabled.length - 1]?.focus();\n break;\n case inward: {\n if (opt.disabled || !opt.children?.length || this.disabled() || this.readonly()) break;\n this.activePath.set([...this.activePath().slice(0, colIndex), opt.value]);\n // The column is not in the DOM until the render this write schedules.\n afterNextRender(\n () =>\n this.overlayRef?.overlayElement\n .querySelector<HTMLElement>(\n `#${this.columnId(colIndex + 1)} [role=\"treeitem\"]:not([aria-disabled=\"true\"])`\n )\n ?.focus(),\n { injector: this.injector }\n );\n break;\n }\n case outward: {\n if (colIndex > 0) {\n const parent = this.parentOptionId(colIndex);\n if (parent) this.overlayRef?.overlayElement.querySelector<HTMLElement>(`#${parent}`)?.focus();\n } else if (opt.children?.length && this.isActiveAt(colIndex, opt.value)) {\n this.activePath.set([]);\n }\n break;\n }\n case ' ':\n // The commit is `(keydown.space)`'s; the page scrolling a screen under the\n // panel is the browser's, and it went with every Space on an option.\n break;\n default:\n return;\n }\n event.preventDefault();\n }\n\n /** The caret reached an option, by whatever route — the tab stop follows it. */\n protected onOptionFocus(colIndex: number, opt: WrCascaderOption<T>): void {\n if (opt.disabled) return;\n this.cursor.set({ col: colIndex, value: opt.value });\n }\n\n /** Whether this option is the panel's one `tabindex=\"0\"`. */\n protected isTabStop(colIndex: number, opt: WrCascaderOption<T>): boolean {\n const stop = this.tabStop();\n return !opt.disabled && stop !== null && stop.col === colIndex && stop.value === opt.value;\n }\n\n /**\n * Move to the next enabled option in `column` whose label starts with the letters\n * typed so far: {@link wrTypeahead} over the column's labels. `current` is\n * `null` when the caret is not in the column yet.\n *\n * @returns whether the caret moved.\n */\n private typeAhead(column: HTMLElement, current: HTMLElement | null, event: KeyboardEvent): boolean {\n const enabled = [...column.querySelectorAll<HTMLElement>('[role=\"treeitem\"]')].filter(\n o => o.getAttribute('aria-disabled') !== 'true'\n );\n const labels = enabled.map(o => o.querySelector('.wr-cascader__opt-label')?.textContent ?? '');\n const index = this.typeahead.handleKey(event, labels, current ? enabled.indexOf(current) : -1);\n if (index === null || index < 0) return false;\n enabled[index].focus();\n return true;\n }\n\n protected clearSelection(event: Event): void {\n event.stopPropagation();\n if (this.disabled() || this.readonly()) return;\n this.path.set([]);\n this.activePath.set([]);\n this.value.set([]);\n this.touch.emit();\n }\n\n protected isActiveAt(colIndex: number, value: T): boolean {\n return this.activePath()[colIndex] === value;\n }\n\n /**\n * Whether this option is the committed choice — `null` when it is not a\n * choice at all.\n *\n * Two questions the panel has to keep apart, and `--active` answers only the\n * first: `activePath()` is where the user has NAVIGATED to, `path()` is what\n * they have COMMITTED. They agree once a leaf is picked and diverge for the\n * whole walk down.\n *\n * `null` — the attribute absent — on a branch while `changeOnSelect` is off,\n * because such a branch genuinely cannot be chosen; ARIA reads a missing\n * `aria-selected` as \"not selectable\", which is exactly true here. That makes\n * this binding the first expression the `changeOnSelect` contract has ever had\n * in ARIA, in both directions.\n */\n protected isSelectedAt(colIndex: number, opt: WrCascaderOption<T>): boolean | null {\n const committable = !opt.children?.length || this.changeOnSelect();\n if (!committable) return null;\n const path = this.path();\n return colIndex === path.length - 1 && path[colIndex] === opt.value;\n }\n\n /** Stable id for one option — what a column's `aria-labelledby` points at. */\n protected optionId(colIndex: number, optIndex: number): string {\n return `${this.panelId}-opt-${colIndex}-${optIndex}`;\n }\n\n /** Stable id for one column — what an expanded branch's `aria-controls` points at. */\n protected columnId(colIndex: number): string {\n return `${this.panelId}-col-${colIndex}`;\n }\n\n /**\n * The option whose children a column holds, by id — its accessible name.\n *\n * The columns are DOM SIBLINGS, so nothing in the markup says the second one\n * belongs to \"Europe\". Column 0 has no parent and stays unnamed; the tree\n * itself already carries the control's name.\n */\n protected parentOptionId(colIndex: number): string | null {\n if (colIndex === 0) return null;\n const parent = this.columns()[colIndex - 1] ?? [];\n const index = parent.findIndex(o => this.isActiveAt(colIndex - 1, o.value));\n return index < 0 ? null : this.optionId(colIndex - 1, index);\n }\n\n private pathsEqual(a: readonly T[], b: readonly T[]): boolean {\n return a.length === b.length && a.every((v, i) => v === b[i]);\n }\n\n // Overlay\n\n private openOverlay(): void {\n if (this.overlayRef) return;\n // Each open starts from the selected path, not from where the last visit ended.\n this.cursor.set(null);\n\n const positionStrategy = this.overlay\n .position()\n .flexibleConnectedTo(this.host)\n .withPositions([\n { originX: 'start', originY: 'bottom', overlayX: 'start', overlayY: 'top' },\n { originX: 'start', originY: 'top', overlayX: 'start', overlayY: 'bottom' },\n ])\n .withPush(true);\n\n this.overlayRef = this.overlay.create({\n positionStrategy,\n scrollStrategy: this.scrollStrategies.reposition(),\n panelClass: wrToClassList('wr-cascader-overlay', this.panelClass()),\n });\n\n // The columns cascade inline-wards, and the CDK captured the direction as a\n // string when this ref was created — so a flip while the panel is open left\n // the whole cascade running the other way from the page around it.\n wrFollowDirection(this.overlayRef, this.dir, this.injector);\n\n const portal = new TemplatePortal(this.panelTpl(), this.vcr);\n this.overlayRef.attach(portal);\n\n // Opening moves no focus unless `autoFocus` asks. The pane is appended to\n // `<body>`, where Tab from the trigger would not find it, so the trigger's\n // own arrows and Tab walk in: see `enterPanelFromTrigger`.\n //\n // `afterNextRender`, NOT `queueMicrotask`: under zoneless CD change detection runs\n // in a macrotask, so a microtask queued here fires before the columns are in the\n // DOM — the trap that once left `wr-calendar`'s ring and its real focus on\n // different days.\n if (this.autoFocus()) afterNextRender(() => this.focusPanelOption(), { injector: this.injector });\n\n this.outsideClick\n .outsidePointerEvents(this.overlayRef)\n .pipe(takeUntilDestroyed(this.destroyRef))\n .subscribe(event => {\n if (this.host.nativeElement.contains(event.target as Node)) return;\n this.openState.set(false);\n });\n\n this.overlayRef\n .keydownEvents()\n .pipe(takeUntilDestroyed(this.destroyRef))\n .subscribe(event => {\n if (event.key === 'Escape') {\n event.preventDefault();\n this.openState.set(false);\n return;\n }\n if (this.overlayRef && tabLeavesPane(this.overlayRef.overlayElement, event)) {\n this.host.nativeElement.querySelector<HTMLElement>('.wr-cascader__trigger')?.focus();\n this.openState.set(false);\n }\n });\n\n this.opened.emit();\n }\n\n /**\n * The option the panel opens on: its tab stop, which on open is the selected path's\n * leaf, else the first enabled root (see {@link tabStop}). A disabled option is\n * never the stop, so `focus()` cannot land on a choice nobody can make.\n */\n private focusPanelOption(): void {\n this.overlayRef?.overlayElement.querySelector<HTMLElement>('[role=\"treeitem\"][tabindex=\"0\"]')?.focus();\n }\n\n /** `notify: false` is the destroy path: an output cannot emit from a destroyed view. */\n private closeOverlay(notify = true): void {\n if (!this.overlayRef) return;\n // Every option commits on Enter, so on the keyboard the caret is INSIDE the\n // pane when a choice is made — and the ordinary way to finish choosing (`onOptionClick` on a leaf) closes it.\n // Disposing without handing focus back dropped it on `<body>` on the SUCCESS\n // path, not merely on dismissal: a keyboard user who had just picked a value\n // then had to Tab from the top of the document to get back to the control.\n // Untouched when focus had already moved elsewhere — that click is usually\n // what closed us, and stealing the caret back would fight the user for it.\n const pane = this.overlayRef.overlayElement;\n const focusWasInside = pane.contains(this.host.nativeElement.ownerDocument.activeElement);\n this.overlayRef.dispose();\n this.overlayRef = null;\n if (!notify) return;\n if (focusWasInside) this.host.nativeElement.querySelector<HTMLElement>('.wr-cascader__trigger')?.focus();\n this.closed.emit();\n }\n}\n\nexport type { WrCascaderOption } from './types';\n","<button\n type=\"button\"\n class=\"wr-cascader__trigger\"\n role=\"combobox\"\n [attr.aria-label]=\"nameLabel()\"\n [attr.aria-labelledby]=\"labelledBy()\"\n [disabled]=\"disabled()\"\n [attr.aria-haspopup]=\"'tree'\"\n [attr.aria-expanded]=\"isOpen()\"\n [attr.aria-controls]=\"panelId\"\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)=\"onTriggerClick()\"\n (keydown)=\"onTriggerKeydown($event)\"\n (blur)=\"touch.emit()\"\n>\n @if (displayLabel(); as label) {\n <span class=\"wr-cascader__value\">{{ label }}</span>\n } @else {\n <span class=\"wr-cascader__placeholder\">{{ placeholder() }}</span>\n }\n\n @if (clearable() && hasSelection() && !disabled() && !readonly()) {\n <span\n class=\"wr-cascader__clear\"\n role=\"button\"\n [attr.aria-label]=\"resolvedClearLabel()\"\n tabindex=\"-1\"\n (click)=\"clearSelection($event)\"\n >\n <svg\n class=\"wr-icon__svg\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n >\n <path d=\"M18 6 6 18\" />\n <path d=\"m6 6 12 12\" />\n </svg>\n </span>\n }\n\n <svg\n class=\"wr-icon__svg wr-cascader__chevron\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n >\n <path d=\"m6 9 6 6 6-6\" />\n </svg>\n</button>\n\n<ng-template #panelTpl>\n <div\n class=\"wr-cascader-panel\"\n [class.wr-cascader-panel--sm]=\"size() === 'sm'\"\n [class.wr-cascader-panel--lg]=\"size() === 'lg'\"\n role=\"tree\"\n [attr.id]=\"panelId\"\n [attr.aria-label]=\"resolvedAriaLabel()\"\n >\n <!--\n tree / group / treeitem, and NOT menu. A combobox's popup may be a listbox,\n a tree, a grid or a dialog and nothing else, so `aria-haspopup=\"menu\"` on\n the trigger was an author error — and a `menu` may own menuitems and\n groups, never other menus, so the columns were a second one. Neither is\n visible to axe: `menu` is a valid token for the global `aria-haspopup`, and\n `aria-required-children` passes a menu-inside-menu (measured against this\n exact fragment). A tree is what this control has always been — the value is\n a PATH, and only `treeitem` supports aria-expanded, aria-level,\n aria-setsize, aria-posinset and aria-selected at once.\n\n The columns stay `group` rather than collapsing to `role=\"presentation\"`,\n which is also axe-clean: the DOM is column-MAJOR, so a flat tree would\n leave level plus document order as the only structure, and \"Germany\"\n (level 2) would read as a child of \"Antarctica\" (level 1, the item\n immediately before it in source order).\n -->\n @for (col of columns(); track $index; let colIndex = $index) {\n <ul\n class=\"wr-cascader__col\"\n role=\"group\"\n [attr.id]=\"columnId(colIndex)\"\n [attr.aria-labelledby]=\"parentOptionId(colIndex)\"\n >\n @for (opt of col; track opt.value; let optIndex = $index) {\n <!--\n `aria-expanded` is exactly `isActiveAt`: `columns()` renders the next\n column for the active option and only when it has children, so the\n state can never claim a column that is not on screen — and\n `aria-controls` rides that same invariant, which is what makes\n \"expanded\" refer to something when the expanded content is a SIBLING\n rather than a descendant. It is emitted only while expanded: a\n reference to an absent id is a violation with `aria-expanded=\"true\"`\n and clean while collapsed.\n\n `aria-level` is load-bearing rather than decorative. The columns are\n siblings, so the DOM ancestry represents no level at all and every\n option would read as level 1. `aria-setsize` / `aria-posinset` are\n not strictly required — each column IS a complete sibling set — and\n are written anyway, because a tree that owns sibling groups is the\n uncommon shape where browser/AT pairs are known to miscompute both.\n\n `aria-selected` is written on every option that can be COMMITTED,\n `false` included, matching `wr-tree`. The alternative a reviewer may\n prefer: only the selected node, leaning on treeitem's implicit false,\n which is quieter in a long column and loses the \"this row is\n selectable\" signal that presence carries.\n\n `tabindex` is a ROVING stop, as in the APG tree pattern: one option\n carries `0` (see `tabStop`) and every other one `-1`, so the panel is\n one Tab to enter and one to leave, and the arrows move between options.\n -->\n <li\n class=\"wr-cascader__opt\"\n role=\"treeitem\"\n [attr.id]=\"optionId(colIndex, optIndex)\"\n [class.wr-cascader__opt--active]=\"isActiveAt(colIndex, opt.value)\"\n [class.wr-cascader__opt--disabled]=\"opt.disabled\"\n [attr.tabindex]=\"isTabStop(colIndex, opt) ? 0 : -1\"\n [attr.aria-disabled]=\"opt.disabled ? true : null\"\n [attr.aria-level]=\"colIndex + 1\"\n [attr.aria-setsize]=\"$count\"\n [attr.aria-posinset]=\"optIndex + 1\"\n [attr.aria-selected]=\"isSelectedAt(colIndex, opt)\"\n [attr.aria-expanded]=\"opt.children?.length ? isActiveAt(colIndex, opt.value) : null\"\n [attr.aria-controls]=\"\n opt.children?.length && isActiveAt(colIndex, opt.value) ? columnId(colIndex + 1) : null\n \"\n (click)=\"onOptionClick(colIndex, opt, $event)\"\n (focus)=\"onOptionFocus(colIndex, opt)\"\n (keydown)=\"onOptionKeydown(colIndex, opt, $event)\"\n (keydown.enter)=\"onOptionClick(colIndex, opt, $event)\"\n (keydown.space)=\"onOptionClick(colIndex, opt, $event)\"\n >\n <span class=\"wr-cascader__opt-label\">{{ opt.label }}</span>\n @if (opt.children?.length) {\n <svg\n class=\"wr-icon__svg wr-cascader__opt-arrow\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n >\n <path d=\"m9 18 6-6-6-6\" />\n </svg>\n }\n </li>\n }\n </ul>\n }\n </div>\n</ng-template>\n"],"mappings":";;;;;;;;;;;;;;;;;AAwCA,IAAI,WAAW;AAgBf,SAAS,cAAc,MAAmB,OAAoB;CAC5D,IAAI,MAAM,QAAQ,SAAS,MAAM,oBAAoB,MAAM,UAAU,MAAM,WAAW,MAAM,SAAS,OAAO;CAC5G,MAAM,SAAS,KAAK,cAAc;CAClC,OAAO,CAAC,CAAC,UAAU,KAAK,SAAS,MAAM;AACzC;AA8CA,IAAa,aAAb,MAAa,WAAU;CAEZ,aAAa,MAAqB,MAAK,GAAA,YAAA,CAAA,EAAA,WAAA,aAAA,CAAA,+BAAA,CAAA,CAAA;CAE7B,qBAAqB,YAAY,KAAK,YAAY,yBAAyB,iBAAiB;CAGtG,UAAU,MAAM,SAA0C,GAAA,YAA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A,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,GAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,aAAA;EAAA,CAAA;EAAA,OAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,OAAA;EAAA,CAAA;EAAA,QAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,QAAA;EAAA,CAAA;EAAA,QAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,QAAA;EAAA,CAAA;EAAA,UAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,YAAU;IAAI,MAAM;IAAa,UAAA;GAAA,CAAA;EAAA,CAAA;CAAA;AAAA,CAAA"}
|
|
@@ -72,12 +72,19 @@ function wrChartAxis(min, max, options = {}) {
|
|
|
72
72
|
if (options.symmetric && lo === hi) return centredAxis(lo);
|
|
73
73
|
const count = options.tickCount !== void 0 && options.tickCount >= 1 ? Math.round(options.tickCount) : TICK_COUNT;
|
|
74
74
|
const step = niceStep((hi - lo || Math.abs(hi) || 1) / count);
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
const
|
|
75
|
+
const snap = (value) => {
|
|
76
|
+
const q = value / step;
|
|
77
|
+
return Math.abs(q - Math.round(q)) <= 1e-9 * Math.max(1, Math.abs(q)) ? Math.round(q) : q;
|
|
78
|
+
};
|
|
79
|
+
const near = (a, b) => Math.abs(a - b) <= step * 1e-9;
|
|
80
|
+
let bottomStep = Math.floor(snap(lo));
|
|
81
|
+
let topStep = Math.ceil(snap(hi));
|
|
82
|
+
if (near(topStep * step, dataHi)) topStep += 1;
|
|
83
|
+
if (options.symmetric && near(bottomStep * step, dataLo)) bottomStep -= 1;
|
|
84
|
+
const bottom = bottomStep * step;
|
|
85
|
+
const top = topStep * step;
|
|
80
86
|
const digits = tickDigits(step);
|
|
87
|
+
const gaps = Math.round((top - bottom) / step);
|
|
81
88
|
const ticks = [];
|
|
82
89
|
for (let i = 0; i <= gaps; i++) ticks.push(wrRound(top - i * step, digits));
|
|
83
90
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ngwr-charts-core.mjs","names":[],"sources":["../../../projects/lib/charts/core/axis.ts","../../../projects/lib/charts/core/chart-state.ts","../../../projects/lib/charts/core/chart-state.html","../../../projects/lib/charts/core/chart-table.ts","../../../projects/lib/charts/core/chart-table.html","../../../projects/lib/charts/core/interaction.ts","../../../projects/lib/charts/core/labels.ts","../../../projects/lib/charts/core/palette.ts","../../../projects/lib/charts/core/markers.ts","../../../projects/lib/charts/core/numbers.ts","../../../projects/lib/charts/core/round.ts","../../../projects/lib/charts/core/public-api.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 { wrRound } from 'ngwr/utils';\n\nimport type { WrChartAxis, WrChartAxisOptions } from './types';\n\n/** How many gaps an axis aims for by default. Five labels, four gaps. */\nconst TICK_COUNT = 4;\n\n/** The axis drawn when there is no data to fit: 0 to 1 in quarters, the line chart's empty frame. */\nconst EMPTY: WrChartAxis = { min: 0, max: 1, step: 0.25, ticks: [1, 0.75, 0.5, 0.25, 0] };\n\n/** The rungs of the {@link niceStep} ladder within one decade, from the top: 1, 0.5, 0.25 and 0.2 of it. */\nconst LADDER = [1, 0.5, 0.25, 0.2] as const;\n\n/**\n * How many fraction digits a tick on an axis stepping by `step` is rounded to: two past\n * the step's own leading digit, and never fewer than six or more than fifteen.\n *\n * It was a fixed six, which cannot write a tick finer than a millionth: an axis stepping\n * by 2.5e-7 — a micro-priced asset — came back as five ticks of `0.000013` and\n * `0.000012`, one stepping by 5e-10 as five zeros, and one stepping by 2.5e-6 put two of\n * its gridlines at the wrong height. Every tick is a whole multiple of the step, whose\n * last digit is at most one place past its leading one (2.5, and 0.25 on the\n * centred axis' ladder, two), so two past the leading digit writes every tick exactly.\n * The floor of six keeps every axis that was already exact bit for bit what it was,\n * and keeps a step no rung divides — a third, centred — at the six it always had.\n */\nfunction tickDigits(step: number): number {\n return Math.min(15, Math.max(6, Math.ceil(-Math.log10(step)) + 2));\n}\n\n/**\n * The `symmetric` axis for data with no span: the value in the MIDDLE, as a tick of\n * its own, with one step either side.\n *\n * Snapped outward, a flat range keeps its value inside the frame but not at its\n * centre: a lone 120 lands on an axis from 100 to 150, two fifths of the way up. The\n * step here is the largest rung of the same ladder that is at most a quarter of the\n * value and divides it exactly, so all three ticks are round: 100 / 120 / 140,\n * 4 / 5 / 6, 1234 / 1234.5 / 1235. Zero has no magnitude to take a quarter of, and\n * reads −1 / 0 / 1; a value no rung divides within twelve decades takes a quarter\n * of itself.\n */\nfunction centredAxis(value: number): WrChartAxis {\n const magnitude = Math.abs(value);\n let step = magnitude === 0 ? 1 : magnitude / 4;\n if (magnitude > 0) {\n const top = Math.ceil(Math.log10(magnitude / 4));\n search: for (let exponent = top; exponent > top - 12; exponent--) {\n for (const rung of LADDER) {\n const candidate = rung * 10 ** exponent;\n if (candidate > magnitude / 4) continue;\n const ratio = value / candidate;\n if (Math.abs(ratio - Math.round(ratio)) < 1e-9) {\n step = candidate;\n break search;\n }\n }\n }\n }\n const digits = tickDigits(step);\n return {\n min: value - step,\n max: value + step,\n step,\n ticks: [wrRound(value + step, digits), value, wrRound(value - step, digits)],\n };\n}\n\n/**\n * The smallest 1 / 2 / 2.5 / 5 × 10ⁿ at or above `raw` — the conventional\n * nice-number ladder every plotting library uses to pick an axis step.\n *\n * `2.5` earns its place on the small end: without it a span that wants a step\n * of 2.1 jumps to 5 and the axis loses half its labels.\n */\nexport function niceStep(raw: number): number {\n if (!Number.isFinite(raw) || raw <= 0) return 1;\n const magnitude = 10 ** Math.floor(Math.log10(raw));\n const normalised = raw / magnitude;\n const nice = normalised <= 1 ? 1 : normalised <= 2 ? 2 : normalised <= 2.5 ? 2.5 : normalised <= 5 ? 5 : 10;\n return nice * magnitude;\n}\n\n/**\n * A value axis for data running from `min` to `max`, SNAPPED to a readable step —\n * and the snapping is the point.\n *\n * The line chart's axis used to be \"the data's max plus 10%, divided into four\",\n * which lands on a round number almost never: seven integers between 3 and 35 gave\n * an axis reading 38.2 / 28.7 / 19.1 / 9.6 / 0. A chart's axis is the one part of it\n * a reader is supposed to do arithmetic against.\n *\n * So the step is rounded UP to the nearest 1, 2, 2.5 or 5 times a power of ten —\n * the conventional nice-number ladder — and the bounds are then snapped outward to\n * whole multiples of it. The same 3..35 reads 0 / 10 / 20 / 30 / 40. Snapping\n * outward replaces the old 10% padding, and where the peak still lands exactly on\n * the top it is lifted a step, since a line that ends on the frame reads as clipped.\n * `symmetric` does the same at the bottom.\n *\n * A flat range has no span to divide, so it is given its own magnitude as one (or 1,\n * at zero). With `symmetric` it is centred instead: the value is the middle of three\n * ticks, a round step on either side, whatever `tickCount` asks for. Non-finite\n * bounds, the `Math.min()` / `Math.max()` of no data, give the empty frame from 0 to\n * 1. Bounds handed in the wrong order are swapped.\n *\n * The line chart's own rule, which floors its axis at zero and never lifts it to\n * zero from below, is `wrChartAxis(Math.min(0, min), max)`: an all-negative series\n * keeps an axis that ends just above its peak. `includeZero` is the other reading,\n * zero inside the range on either side, which an area needs for its baseline.\n *\n * @internal\n */\nexport function wrChartAxis(min: number, max: number, options: WrChartAxisOptions = {}): WrChartAxis {\n if (!Number.isFinite(min) || !Number.isFinite(max)) return EMPTY;\n const dataLo = Math.min(min, max);\n const dataHi = Math.max(min, max);\n const lo = options.includeZero ? Math.min(0, dataLo) : dataLo;\n const hi = options.includeZero ? Math.max(0, dataHi) : dataHi;\n // A scale with no baseline has no reason to put a lone value anywhere but the middle.\n if (options.symmetric && lo === hi) return centredAxis(lo);\n\n const count = options.tickCount !== undefined && options.tickCount >= 1 ? Math.round(options.tickCount) : TICK_COUNT;\n // A flat series has no span to divide, so give it one rather than a zero step.\n const span = hi - lo || Math.abs(hi) || 1;\n const step = niceStep(span / count);\n let bottom = Math.floor(lo / step) * step;\n let top = Math.ceil(hi / step) * step;\n // The data's peak sitting exactly on the frame reads as clipped, so lift the\n // ceiling by one step when the snap did not already do it. Measured against the\n // DATA, so a zero that only `includeZero` put at the top is not lifted: nothing\n // sits on it. `symmetric` holds the bottom to the same rule.\n if (top === dataHi) top += step;\n if (options.symmetric && bottom === dataLo) bottom -= step;\n\n // Floating-point: 0.1 + 0.2 walks past an exact bound, so count in integers and\n // multiply, and stop on the count rather than on `value >= min`.\n const gaps = Math.round((top - bottom) / step);\n const digits = tickDigits(step);\n const ticks: number[] = [];\n for (let i = 0; i <= gaps; i++) ticks.push(wrRound(top - i * step, digits));\n return { min: bottom, max: top, step, ticks };\n}\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { Component, type Signal, ViewEncapsulation, computed, input } from '@angular/core';\n\nimport { useI18nText } from 'ngwr/i18n';\n\n/**\n * What a chart shows in place of its marks.\n *\n * @internal\n */\nexport type WrChartStateKind = 'empty' | 'loading' | 'error';\n\n/**\n * The state a chart is in, with the message it shows for it.\n *\n * @internal\n */\nexport interface WrChartStateView {\n readonly kind: WrChartStateKind;\n readonly label: string;\n}\n\n/**\n * The inputs a chart hands {@link useChartState}.\n *\n * @internal\n */\nexport interface WrChartStateOptions {\n /** The chart's `loading` input. */\n readonly loading: Signal<boolean>;\n /** The chart's `error` input. */\n readonly error: Signal<boolean>;\n /** Whether the chart has nothing to draw. */\n readonly empty: Signal<boolean>;\n /** The chart's `emptyLabel`, `loadingLabel` and `errorLabel` inputs: `null` takes the catalog's. */\n readonly emptyLabel: Signal<string | null>;\n readonly loadingLabel: Signal<string | null>;\n readonly errorLabel: Signal<string | null>;\n}\n\n/**\n * The state a chart shows instead of its marks, or `null` while it draws them: loading\n * first, then a failed load, then no data. Each message is the chart's own `*Label`\n * input, then the catalog's `chart.loading` / `chart.error` / `chart.empty`, then\n * English. Call in an injection context.\n *\n * One rule for every chart, so a dashboard whose requests are in flight reads the same\n * in every tile, and a chart with no data is a framed \"No data\" rather than a blank box\n * of whatever height its markup collapses to.\n *\n * @internal\n */\nexport function useChartState(options: WrChartStateOptions): Signal<WrChartStateView | null> {\n const loading = useI18nText(options.loadingLabel, 'chart.loading', 'Loading…');\n const error = useI18nText(options.errorLabel, 'chart.error', 'Could not load');\n const empty = useI18nText(options.emptyLabel, 'chart.empty', 'No data');\n return computed<WrChartStateView | null>(() => {\n if (options.loading()) return { kind: 'loading', label: loading() };\n if (options.error()) return { kind: 'error', label: error() };\n if (options.empty()) return { kind: 'empty', label: empty() };\n return null;\n });\n}\n\n/**\n * The message a chart shows in place of its marks, centred over the frame it keeps.\n *\n * A live region: `role=\"status\"`, so a screen reader hears \"Loading…\" when a chart\n * starts a request and \"No data\" when it comes back with none, without the chart taking\n * focus. A failed load is `role=\"alert\"`, which interrupts, since it is the one of the\n * three a reader has to act on. The chart renders it inside the box its marks are drawn\n * in, which it positions; the grid and the axis under it stay.\n *\n * @example\n * ```html\n * @if (state(); as shown) {\n * <wr-chart-state [kind]=\"shown.kind\" [label]=\"shown.label\" />\n * }\n * ```\n *\n * @internal\n */\n@Component({\n selector: 'wr-chart-state',\n templateUrl: './chart-state.html',\n encapsulation: ViewEncapsulation.None,\n host: {\n class: 'wr-chart-state',\n '[class.wr-chart-state--empty]': \"kind() === 'empty'\",\n '[class.wr-chart-state--loading]': \"kind() === 'loading'\",\n '[class.wr-chart-state--error]': \"kind() === 'error'\",\n '[attr.role]': \"kind() === 'error' ? 'alert' : 'status'\",\n },\n})\nexport class WrChartState {\n /** Which of the three states this is. */\n readonly kind = input.required<WrChartStateKind>();\n\n /** The message, already translated. */\n readonly label = input.required<string>();\n}\n","<span class=\"wr-chart-state__plate\">\n @if (kind() === 'loading') {\n <!-- Decoration: the word beside it carries the state. -->\n <span class=\"wr-chart-state__spinner\" aria-hidden=\"true\"></span>\n }\n <span class=\"wr-chart-state__label\">{{ label() }}</span>\n</span>\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { Component, ViewEncapsulation, computed, input } from '@angular/core';\n\nimport type { WrChartTableData } from './types';\n\n/**\n * The figures a chart draws, as a table that only assistive technology reaches.\n *\n * A chart's drawing is one named `role=\"img\"`, and `img` makes everything inside it\n * presentational: the name is announced and the numbers are nowhere a screen reader\n * can walk. This renders them as a real `<table>` — a caption, column headers, row\n * headers, and a `<tbody>` per group headed by a `<th scope=\"rowgroup\">` down its rows\n * — so a reader can move cell by cell and hear each value with its row and column.\n *\n * **Beside the image, never inside it.** Inside, `img` would hide it with the rest of\n * the drawing. A chart renders `<wr-chart-table>` as a sibling of the element that\n * carries `role=\"img\"`, and only while its `dataTable` input asks for it. **The chart's\n * host has to be positioned** (`position: relative`): the table is out of flow, and\n * against a static host it resolves to an ancestor outside the chart and keeps its place\n * in an unpositioned scroller's content, which grew one page by 1600px of blank scroll.\n *\n * **Hidden by clipping, not by `display` or `hidden`**, which would take it out of the\n * accessibility tree as well: the host is clipped to nothing and taken out of flow, so\n * it costs the chart no layout and still reads in full. The table inside keeps its own\n * layout, because a `<table>` will not shrink to a clip box of its own — it grows to\n * fit its cells whatever its width says. Nothing in it is focusable, so no tab stop\n * lands on something that cannot be seen.\n *\n * No ids: the headers are tied to their cells by `scope`, which needs none, and an id\n * minted on the server would not match the client's.\n *\n * @example\n * ```html\n * <div class=\"wr-line-chart__plot\" role=\"img\" [attr.aria-label]=\"label()\">…</div>\n * @if (dataTable()) {\n * <wr-chart-table [data]=\"table()\" />\n * }\n * ```\n *\n * @internal\n */\n@Component({\n selector: 'wr-chart-table',\n templateUrl: './chart-table.html',\n encapsulation: ViewEncapsulation.None,\n host: { class: 'wr-chart-table' },\n})\nexport class WrChartTable {\n /** The caption, the column headings and the rows, every string already written. */\n readonly data = input.required<WrChartTableData>();\n\n /** Whether any group is headed, which gives every row a leading group column. */\n protected readonly hasGroupHeaders = computed(() => this.data().groups.some(group => !!group.header));\n}\n","@let d = data();\n@let grouped = hasGroupHeaders();\n<!-- Every section is written out, `<thead>` and each `<tbody>` included: the HTML\n parser inserts a `<tbody>` the template left out, and hydration would then meet\n a tree it did not render. -->\n<table class=\"wr-chart-table__table\">\n <caption>\n {{\n d.caption\n }}\n </caption>\n <thead>\n <tr>\n <!-- Over the group headers' column, then the row headers' one. -->\n @if (grouped && !d.corner) {\n <td colspan=\"2\"></td>\n } @else {\n @if (grouped) {\n <td></td>\n }\n @if (d.corner) {\n <th scope=\"col\">{{ d.corner }}</th>\n } @else {\n <td></td>\n }\n }\n @for (column of d.columns; track $index) {\n <th scope=\"col\">{{ column }}</th>\n }\n </tr>\n </thead>\n @for (group of d.groups; track $index) {\n @if (group.rows.length > 0) {\n <tbody>\n @for (row of group.rows; track $index; let first = $first, count = $count) {\n <tr>\n <!-- The group's header in a column of its own, down every row of the group:\n the shape the HTML table algorithm and every checker read as heading the\n cells beside it. A full-width row above the group heads nothing by axe's\n reading. -->\n @if (grouped && first) {\n @if (group.header) {\n <th scope=\"rowgroup\" [attr.rowspan]=\"count\">{{ group.header }}</th>\n } @else {\n <td [attr.rowspan]=\"count\"></td>\n }\n }\n <th scope=\"row\">{{ row.header }}</th>\n @for (cell of row.cells; track $index) {\n <td>{{ cell }}</td>\n }\n </tr>\n }\n </tbody>\n }\n }\n</table>\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 { DestroyRef, ElementRef, type Signal, afterNextRender, afterRenderEffect, inject, signal } from '@angular/core';\n\nconst UNMEASURED: WrChartSize = { width: 0, height: 0 };\n\n/** What each observed element reports to, on the one observer every chart shares. */\nconst listeners = new WeakMap<Element, (size: WrChartSize) => void>();\n\n/** The marks {@link wrChartDim} lit last, per host, so the next call clears them without a scan. */\nconst litMarks = new WeakMap<Element, Element[]>();\n\nlet observer: ResizeObserver | null = null;\n\n/** The constructor `observer` was built with: a page has one, a test suite swaps it. */\nlet observerType: typeof ResizeObserver | null = null;\n\n/**\n * The box a chart measures, in px. Both are 0 until it is laid out.\n *\n * @internal\n */\nexport interface WrChartSize {\n readonly width: number;\n readonly height: number;\n}\n\n/**\n * Reports `element`'s content box to `listener` whenever it changes, through ONE\n * `ResizeObserver` for every chart on the page. Returns the function that stops it.\n *\n * Seven charts each made an observer of their own, so a dashboard of forty tiles ran\n * forty. An observer is built to watch many targets and delivers them in one callback\n * per frame. One listener per element: observing an element again replaces its listener.\n * Where there is no `ResizeObserver` (a server, an old test environment) nothing is\n * observed and the returned function does nothing.\n *\n * @internal\n */\nexport function wrChartObserveSize(element: Element, listener: (size: WrChartSize) => void): () => void {\n if (typeof ResizeObserver === 'undefined') return () => undefined;\n if (!observer || observerType !== ResizeObserver) {\n observerType = ResizeObserver;\n observer = new ResizeObserver(entries => {\n for (const entry of entries) {\n const { width, height } = entry.contentRect;\n listeners.get(entry.target)?.({ width, height });\n }\n });\n }\n const shared = observer;\n listeners.set(element, listener);\n shared.observe(element);\n return () => {\n listeners.delete(element);\n shared.unobserve(element);\n };\n}\n\n/**\n * The size of the element `target` holds, as a signal that follows it: `0 × 0` until the\n * element is rendered and laid out, and again once it is gone. On the shared observer of\n * {@link wrChartObserveSize}. Call in an injection context.\n *\n * @internal\n */\nexport function useChartSize(target: Signal<ElementRef<Element> | Element | undefined>): Signal<WrChartSize> {\n const size = signal<WrChartSize>(UNMEASURED);\n let stop: (() => void) | null = null;\n let observed: Element | null = null;\n\n afterRenderEffect(() => {\n const held = target();\n const element = held instanceof ElementRef ? held.nativeElement : (held ?? null);\n if (element === observed) return;\n stop?.();\n observed = element;\n stop = null;\n if (!element) {\n size.set(UNMEASURED);\n return;\n }\n stop = wrChartObserveSize(element, next => {\n const current = size();\n if (current.width !== next.width || current.height !== next.height) size.set(next);\n });\n });\n inject(DestroyRef).onDestroy(() => stop?.());\n return size.asReadonly();\n}\n\n/**\n * What {@link useChartHover} tells a chart.\n *\n * @internal\n */\nexport interface WrChartHoverHandlers {\n /** The pointer is over the section whose `data-wr-index` is `index`. Not repeated while it stays there. */\n enter(index: number): void;\n /** The pointer left the sections: for the chart's box, or for a part of it that is no section. */\n leave(event: MouseEvent): void;\n}\n\n/**\n * Dims every mark of `host` but the ones of series `key`, or none for `null`: the chart\n * takes `wr-chart--dim` and the series' own marks `wr-chart-mark--on`, and the shared\n * stylesheet fades the rest to `--wr-chart-dim`. A mark is anything carrying\n * `data-wr-series`, a legend row included.\n *\n * Classes set by hand rather than bound: a binding on every mark is re-evaluated for\n * every mark on each hover change, and this touches the marks of two series.\n *\n * @internal\n */\nexport function wrChartDim(host: Element, key: string | null): void {\n for (const mark of litMarks.get(host) ?? []) mark.classList.remove('wr-chart-mark--on');\n host.classList.toggle('wr-chart--dim', key !== null);\n if (key === null) {\n litMarks.delete(host);\n return;\n }\n const marks = [...host.querySelectorAll(`[data-wr-series=\"${CSS.escape(key)}\"]`)];\n for (const mark of marks) mark.classList.add('wr-chart-mark--on');\n litMarks.set(host, marks);\n}\n\n/**\n * A chart's hover, from ONE pair of listeners on its host however many sections it draws.\n *\n * A section is any element carrying `data-wr-index`: the listener finds the nearest one\n * above whatever the pointer is on and reports its index, once per section entered. A\n * listener pair on every bar was two per bar, and each one a change detection pass over\n * the whole chart for every bar the pointer crossed; these are native listeners, so a\n * move runs no pass at all unless the chart's own handler writes a signal.\n *\n * A gap the chart marks with `data-wr-hold` keeps the section and the dim as they are, so\n * crossing from one bar to the next does not close and reopen the tooltip; a section in\n * such an area takes `wr-chart-section--on`, so a band the chart paints on it stays too.\n *\n * It also drives the shared hover-dim: the nearest element carrying `data-wr-series`\n * names the series under the pointer, and {@link wrChartDim} fades the rest. Legend rows\n * carry the attribute too, so hovering a row dims the chart the same way.\n *\n * Registered after the first render, in the browser only. Call in an injection context.\n *\n * @internal\n */\nexport function useChartHover(handlers: WrChartHoverHandlers): void {\n const host = inject(ElementRef).nativeElement as HTMLElement;\n const destroyRef = inject(DestroyRef);\n let index: number | null = null;\n let series: string | null = null;\n\n const dim = (key: string | null): void => {\n if (key === series) return;\n series = key;\n wrChartDim(host, key);\n };\n\n let current: Element | null = null;\n const band = (section: Element | null): void => {\n current?.classList.remove('wr-chart-section--on');\n current = section?.closest('[data-wr-hold]') ? section : null;\n current?.classList.add('wr-chart-section--on');\n };\n\n const inHost = (el: Element | null | undefined): el is Element => !!el && host.contains(el);\n\n const over = (event: MouseEvent): void => {\n const target = event.target instanceof Element ? event.target : null;\n const section = target?.closest('[data-wr-index]');\n const series = target?.closest('[data-wr-series]');\n // In the room a chart holds open between its marks (`data-wr-hold`, the gaps between\n // its bars), the pointer is still on the drawing: what it last pointed at stays,\n // rather than closing and reopening a few pixels on.\n const held = !inHost(series) && inHost(target?.closest('[data-wr-hold]'));\n if (!held) dim(inHost(series) ? series.getAttribute('data-wr-series') : null);\n if (held && !inHost(section)) return;\n\n const next = inHost(section) ? Number(section.getAttribute('data-wr-index')) : null;\n if (next === index) return;\n index = next;\n if (next === null || !Number.isFinite(next)) {\n band(null);\n handlers.leave(event);\n } else {\n band(section ?? null);\n handlers.enter(next);\n }\n };\n\n const leave = (event: MouseEvent): void => {\n dim(null);\n if (index === null) return;\n index = null;\n band(null);\n handlers.leave(event);\n };\n\n afterNextRender(() => {\n host.addEventListener('mouseover', over);\n host.addEventListener('mouseleave', leave);\n destroyRef.onDestroy(() => {\n host.removeEventListener('mouseover', over);\n host.removeEventListener('mouseleave', leave);\n });\n });\n}\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\n/**\n * The `limit` longest of `labels`, each once, longest first: the strings worth measuring.\n *\n * A chart sizes a gutter or keeps room past a bar from a hidden copy of the text that goes\n * there. Copying every label made ten thousand hidden spans for ten thousand bars, to learn\n * the width of one. The widest label is almost always among the longest few by character\n * count - a proportional font can put `1,111` under `999`, which is why this returns a few\n * and not one - so a chart renders these and reads the widest.\n *\n * @internal\n */\nexport function wrChartLongest(labels: readonly string[], limit = 3): string[] {\n const longest: string[] = [];\n for (const label of new Set(labels)) {\n if (longest.length === limit && label.length <= longest[longest.length - 1].length) continue;\n let at = longest.findIndex(kept => kept.length < label.length);\n if (at < 0) at = longest.length;\n longest.splice(at, 0, label);\n if (longest.length > limit) longest.pop();\n }\n return longest;\n}\n\n/**\n * How many categories each printed label stands for, so no two labels along an axis run\n * into each other: 1 while every label fits its own band, 2 to print every second one,\n * and so on.\n *\n * `extent` is the axis' length and `count` how many bands share it; `labelSize` is the\n * longest label along the axis, and `gap` the least room between two labels. All in the\n * same unit, px in practice. With nothing measured yet - a server render, a chart not\n * laid out - the answer is 1: every label, as the markup had before it was measured.\n *\n * @internal\n */\nexport function wrChartLabelStep(count: number, extent: number, labelSize: number, gap = 8): number {\n if (!(count > 1) || !(extent > 0) || !(labelSize > 0)) return 1;\n const band = extent / count;\n return Math.max(1, Math.min(count, Math.ceil((labelSize + gap) / band)));\n}\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\n/**\n * Default series colours, in order: what a series, a slice or a segment with no\n * `color` of its own takes. Each is a token of the chart theme (`--wr-chart-1` to\n * `--wr-chart-8`, declared by `ngwr/charts/core`'s stylesheet), so an app retints\n * every chart by setting the tokens and a chart's markup never names a hex.\n *\n * The palette is not the status intents: a second series is not a success and a\n * fourth is not a danger. The first is the brand colour and the last the neutral\n * role; neighbours alternate between a deep and a mid tone, so two series next to\n * each other differ in lightness as well as in hue. The stylesheet carries the\n * measured contrast of each.\n *\n * A chart that draws lines still pairs each with a dash (`WR_CHART_DASHES`), and\n * one that draws points with a shape (`WR_CHART_MARKERS`): colour is never the\n * only thing that tells two series apart.\n *\n * @internal\n */\nexport const WR_CHART_PALETTE: readonly string[] = [\n 'var(--wr-chart-1)',\n 'var(--wr-chart-2)',\n 'var(--wr-chart-3)',\n 'var(--wr-chart-4)',\n 'var(--wr-chart-5)',\n 'var(--wr-chart-6)',\n 'var(--wr-chart-7)',\n 'var(--wr-chart-8)',\n];\n\n/**\n * The palette colour for the series at `index`, wrapping past the end.\n *\n * @internal\n */\nexport function wrChartColor(index: number): string {\n return WR_CHART_PALETTE[wrap(index, WR_CHART_PALETTE.length)];\n}\n\n/**\n * The series colours every chart took before the chart theme: four status intents and\n * the neutral role. Kept for the charts that have not moved onto `--wr-chart-*` yet,\n * so each keeps its look until it does; a chart on the theme reads\n * {@link WR_CHART_PALETTE}.\n *\n * `warning` measures 1.71:1 on a white surface, under the 3:1 a graphic needs, which\n * is one of the reasons the theme's palette replaced it.\n *\n * @internal\n */\nexport const WR_CHART_LEGACY_PALETTE: readonly string[] = [\n 'var(--wr-color-primary)',\n 'var(--wr-color-success)',\n 'var(--wr-color-warning)',\n 'var(--wr-color-danger)',\n 'var(--wr-color-on-surface-muted)',\n];\n\n/**\n * The {@link WR_CHART_LEGACY_PALETTE} colour for the series at `index`, wrapping past\n * the end.\n *\n * @internal\n */\nexport function wrChartLegacyColor(index: number): string {\n return WR_CHART_LEGACY_PALETTE[wrap(index, WR_CHART_LEGACY_PALETTE.length)];\n}\n\n/**\n * A dash pattern per series, so lines are told apart by SHAPE and not only by hue.\n *\n * A reader with red-green colour blindness can see two strokes of similar lightness\n * as one grey, and a legend that pairs a coloured dot with a name does not rescue it:\n * matching the dot to the line is exactly the step that needs hue. Distinguishing\n * series by dash is the standard remedy and the only one that survives greyscale,\n * printing and a monochrome display.\n *\n * The FIRST entry is solid on purpose. A single-series chart is the common case\n * and there is nothing to tell apart in it; the patterns only appear once a second\n * series does. Each value is an SVG `stroke-dasharray`, `''` meaning none.\n *\n * @internal\n */\nexport const WR_CHART_DASHES: readonly string[] = ['', '7 4', '2 3', '10 4 2 4', '1 4', '6 3 2 3'];\n\n/**\n * The dash pattern for the series at `index`, wrapping past the end.\n *\n * @internal\n */\nexport function wrChartDash(index: number): string {\n return WR_CHART_DASHES[wrap(index, WR_CHART_DASHES.length)];\n}\n\n/** `index` folded into `[0, length)`, negatives included, so a bad index still picks an entry. */\nexport function wrap(index: number, length: number): number {\n const i = Number.isFinite(index) ? Math.trunc(index) : 0;\n return ((i % length) + length) % length;\n}\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { wrap } from './palette';\nimport type { WrChartMarkerExtent, WrChartMarkerShape } from './types';\n\n/** Half the side of a square with the area of a circle of radius 1: √π / 2. */\nconst SQUARE = Math.sqrt(Math.PI) / 2;\n\n/** Half the diagonal of that square, standing on a corner. */\nconst DIAMOND = SQUARE * Math.SQRT2;\n\n/** The side of an equilateral triangle with the area of a circle of radius 1: √(4π / √3). */\nconst TRIANGLE_SIDE = Math.sqrt((4 * Math.PI) / Math.sqrt(3));\n\n/** The distance from that triangle's centroid to a corner (two thirds of its height). */\nconst TRIANGLE_APEX = (TRIANGLE_SIDE * Math.sqrt(3)) / 3;\n\n/**\n * A plus with arms 0.35 of their length thick, half-length `L` and half-thickness\n * `0.35 L`, has an area of `8·0.35·L² − 4·0.35²·L²`; this is the `L` that makes it π.\n */\nconst CROSS_ARM = Math.sqrt(Math.PI / (8 * 0.35 - 4 * 0.35 ** 2));\nconst CROSS_THICKNESS = CROSS_ARM * 0.35;\n\n/**\n * How far each shape reaches from its centre at `r = 1`, read off the corners\n * {@link wrChartMarkerPath} draws: up, down, to either side, and to the farthest\n * corner.\n */\nconst EXTENTS: Readonly<Record<WrChartMarkerShape, WrChartMarkerExtent>> = {\n circle: { top: 1, bottom: 1, side: 1, radius: 1 },\n square: { top: SQUARE, bottom: SQUARE, side: SQUARE, radius: SQUARE * Math.SQRT2 },\n diamond: { top: DIAMOND, bottom: DIAMOND, side: DIAMOND, radius: DIAMOND },\n triangle: { top: TRIANGLE_APEX, bottom: TRIANGLE_APEX / 2, side: TRIANGLE_SIDE / 2, radius: TRIANGLE_APEX },\n 'triangle-down': { top: TRIANGLE_APEX / 2, bottom: TRIANGLE_APEX, side: TRIANGLE_SIDE / 2, radius: TRIANGLE_APEX },\n cross: { top: CROSS_ARM, bottom: CROSS_ARM, side: CROSS_ARM, radius: Math.hypot(CROSS_ARM, CROSS_THICKNESS) },\n};\n\n/** A coordinate to three decimals, without trailing zeros, so a path stays short. */\nconst n = (value: number): string => String(Math.round(value * 1000) / 1000 || 0);\n\n/** `M x y L … Z` through the given corners. */\nconst polygon = (points: readonly (readonly [number, number])[]): string =>\n `M ${points.map(([x, y]) => `${n(x)} ${n(y)}`).join(' L ')} Z`;\n\n/**\n * A marker shape per series, so points are told apart by SHAPE and not only by\n * hue — the dash list's job, for a chart that draws points rather than lines.\n *\n * The circle comes first for the reason the solid dash does: a single-series chart\n * has nothing to tell apart. The order then alternates corners and points, so two\n * neighbouring series never differ by a rotation alone (a square beside a diamond\n * is the pair a small marker blurs into one).\n *\n * @internal\n */\nexport const WR_CHART_MARKERS: readonly WrChartMarkerShape[] = [\n 'circle',\n 'square',\n 'triangle',\n 'diamond',\n 'cross',\n 'triangle-down',\n];\n\n/**\n * The marker shape for the series at `index`, wrapping past the end.\n *\n * @internal\n */\nexport function wrChartMarker(index: number): WrChartMarkerShape {\n return WR_CHART_MARKERS[wrap(index, WR_CHART_MARKERS.length)];\n}\n\n/**\n * The SVG path `d` of a marker centred on the origin, as large as a circle of\n * radius `r` — every shape has that circle's area, so a triangle reaches past it\n * and a square stays inside it, and the eye weighs them the same.\n *\n * Drawn about the origin so a chart can place it with a `transform`, or inside a\n * nested `<svg x y overflow=\"visible\">`, and size it in pixels whatever the plot's\n * own scale. A non-finite or negative `r` draws nothing rather than a path of\n * `NaN`.\n *\n * @internal\n */\nexport function wrChartMarkerPath(shape: WrChartMarkerShape, r: number): string {\n if (!Number.isFinite(r) || r <= 0) return '';\n switch (shape) {\n case 'square': {\n const h = r * SQUARE;\n return polygon([\n [-h, -h],\n [h, -h],\n [h, h],\n [-h, h],\n ]);\n }\n case 'diamond': {\n const d = r * DIAMOND;\n return polygon([\n [0, -d],\n [d, 0],\n [0, d],\n [-d, 0],\n ]);\n }\n case 'triangle':\n case 'triangle-down': {\n // Centred on the centroid, not on the box, so a triangle sits on the same\n // point a circle would.\n const flip = shape === 'triangle' ? 1 : -1;\n const apex = r * TRIANGLE_APEX;\n const half = (r * TRIANGLE_SIDE) / 2;\n return polygon([\n [0, -apex * flip],\n [half, (apex / 2) * flip],\n [-half, (apex / 2) * flip],\n ]);\n }\n case 'cross': {\n const a = r * CROSS_ARM;\n const t = r * CROSS_THICKNESS;\n return polygon([\n [-t, -a],\n [t, -a],\n [t, -t],\n [a, -t],\n [a, t],\n [t, t],\n [t, a],\n [-t, a],\n [-t, t],\n [-a, t],\n [-a, -t],\n [-t, -t],\n ]);\n }\n case 'circle':\n default:\n // Two arcs, since one arc from a point back to itself draws nothing.\n return `M ${n(-r)} 0 A ${n(r)} ${n(r)} 0 1 0 ${n(r)} 0 A ${n(r)} ${n(r)} 0 1 0 ${n(-r)} 0 Z`;\n }\n}\n\n/**\n * How far the marker {@link wrChartMarkerPath} draws at `r` reaches from its centre,\n * in px, before any stroke: up, down, to either side, and to its farthest corner.\n *\n * Every shape has the circle's AREA, so `r` is not how far a marker reaches: a\n * triangle's point stands 1.56 r above its centroid, a diamond's tips 1.25 r out\n * and a cross's corners 1.24 r, while a square's sides sit 0.89 r in. A box, a hit\n * area or a margin sized by `r` alone cuts the tips off. A non-finite or negative\n * `r` reaches nowhere, as it draws nothing.\n *\n * @internal\n */\nexport function wrChartMarkerExtent(shape: WrChartMarkerShape, r: number): WrChartMarkerExtent {\n const size = Number.isFinite(r) && r > 0 ? r : 0;\n const unit = EXTENTS[shape] ?? EXTENTS.circle;\n return { top: unit.top * size, bottom: unit.bottom * size, side: unit.side * size, radius: unit.radius * size };\n}\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { LOCALE_ID, type Signal, inject } from '@angular/core';\n\nimport { wrClamp } from 'ngwr/utils';\n\nimport type { WrChartNumbers } from './types';\n\n/**\n * The fewest fraction digits that write `value` exactly, up to six: the precision of a\n * step no power of ten divides, such as the third a flat range is centred with.\n */\nfunction fractionDigits(value: number): number {\n for (let d = 0; d <= 6; d++) if (Math.abs(value * 10 ** d - Math.round(value * 10 ** d)) < 1e-9) return d;\n return 6;\n}\n\n/** The power of ten of `value`'s leading digit: 2 for 750, -2 for 0.025. */\nfunction magnitude(value: number): number {\n const abs = Math.abs(value);\n let m = Math.floor(Math.log10(abs));\n // `log10` is a float: guard the exact powers of ten from landing one off.\n if (10 ** (m + 1) <= abs) m++;\n if (10 ** m > abs) m--;\n return m;\n}\n\n/**\n * The power of ten of `step`'s LAST significant digit: 1 for 250, -1 for 2.5. Every tick\n * is a whole multiple of the step, so no tick has a digit below it, and a tick written to\n * that digit is written exactly.\n */\nfunction lastDigit(step: number): number {\n for (let e = magnitude(step); e > -21; e--) {\n const scaled = step / 10 ** e;\n if (Math.abs(scaled - Math.round(scaled)) < 1e-6) return e;\n }\n return -21;\n}\n\n/** Every formatter the charts have asked for, by locale and options. */\nconst FORMATTERS = new Map<string, Intl.NumberFormat>();\n\n/**\n * The `Intl.NumberFormat` for `locale` and `options`, built once for the page and shared\n * by every chart on it.\n *\n * Building one costs about a tenth of a millisecond, and the charts built them freely:\n * three per chart instance, and one per tick on every pass over an axis, so a table of a\n * hundred sparklines paid for three hundred identical formatters. A formatter holds no\n * state, so one per distinct key serves them all. The key is the locale and the options\n * in the order given; the charts ask with a handful of shapes, so the map stays small.\n *\n * @internal\n */\nexport function wrChartNumberFormat(locale: string, options?: Intl.NumberFormatOptions): Intl.NumberFormat {\n const key = options ? `${locale}|${JSON.stringify(options)}` : locale;\n let format = FORMATTERS.get(key);\n if (!format) {\n format = new Intl.NumberFormat(locale, options);\n FORMATTERS.set(key, format);\n }\n return format;\n}\n\n/**\n * The number writers of one chart: its axis ticks, the labels it prints in tight\n * spaces, and the figures of its tooltip and its accessible names — every one\n * through the chart's `valueFormat` when it has one, else through `Intl` in\n * `locale`.\n *\n * Seven charts kept their own copy of the `Intl` half until 15.1, each with the\n * same two formatters and the same `formatValue`, and the line chart a second,\n * axis-wide copy for its ticks. The rules are theirs, unchanged:\n *\n * - `value` is never compact, and is `Intl`'s default otherwise: up to three\n * fraction digits, and below one three SIGNIFICANT digits, since three fraction\n * digits write a reading of 0.0004 as `0`. It is not the exact figure: 1.08345\n * is `1.083`, and an axis stepping by 0.00025 is finer than it. A chart that has\n * to write a figure to a known precision asks `exact`.\n * - `label` is compact from a thousand up, where a bar is too narrow for\n * `1,234,567`, and below a thousand it is `value`: compact rounding would print\n * 12.5 as `13`, and there is nothing to abbreviate.\n * - `ticks` is decided for the AXIS. Compact, through `Intl` (`1.2K`, `3.4M`,\n * `4 Mio.`, `5 тыс.`), with each tick to exactly the significant digits the step\n * needs — a fixed count printed 1250 beside 1000 as `1.3k` and `1k` on an axis\n * stepping by 250. And when abbreviating would make the labels LONGER (a fine\n * step on large numbers, where `-1.025K` is wider than `-1,025`) the whole axis\n * is written in full instead, so no axis mixes `-1K` with `-1,025`. Written in\n * full, a tick has as many fraction digits as the step's last digit needs, however\n * fine: they stopped at six, so an axis stepping by 2.5e-7 printed `0.000013` twice.\n * - `exact` writes a figure to a precision the chart decides — the step of its axis,\n * a price's tick size — never compact, through `valueFormat` when there is one.\n *\n * `valueFormat` takes whatever extra arguments the chart passes it, so a chart can\n * tell its formatter which axis a number is for while a `(value) => string`\n * written for another chart still fits. Call in an injection context: `locale`\n * defaults to `LOCALE_ID`.\n *\n * @internal\n */\nexport function useChartNumbers<A extends readonly unknown[] = []>(\n valueFormat: Signal<((value: number, ...args: A) => string) | null | undefined>,\n locale: string = inject(LOCALE_ID)\n): WrChartNumbers<A> {\n const numbers = wrChartNumberFormat(locale);\n /** Below one, by significant digits, which keep 0.0004 from rounding to `0`. */\n const smallNumbers = wrChartNumberFormat(locale, { maximumSignificantDigits: 3 });\n const compactNumbers = wrChartNumberFormat(locale, { notation: 'compact' });\n\n const value = (v: number, ...args: A): string => {\n const custom = valueFormat();\n if (custom) return custom(v, ...args);\n return (v !== 0 && Math.abs(v) < 1 ? smallNumbers : numbers).format(v);\n };\n\n const label = (v: number, ...args: A): string => {\n if (valueFormat() || Math.abs(v) < 1000) return value(v, ...args);\n return compactNumbers.format(v);\n };\n\n const ticks = (values: readonly number[], step: number, ...args: A): string[] => {\n const custom = valueFormat();\n if (custom) return values.map(v => custom(v, ...args));\n if (values.length === 0) return [];\n\n const last = lastDigit(step);\n // A CEILING rather than a fixed count, so trailing zeros are dropped: a 0.25 step\n // wants two digits on 0.25 and none on 1, and `1.00` beside `0.25` reads as\n // spurious precision. Down to the step's last digit, however fine — the six digits\n // `fractionDigits` stops at printed a 2.5e-7 step as `0.000013` twice, and called\n // a step below 1e-9 whole. A step with no last digit (a third) keeps those six.\n const digits = last <= -21 ? fractionDigits(step) : wrClamp(-last, 0, 20);\n const full = wrChartNumberFormat(locale, { maximumFractionDigits: digits });\n const plain = values.map(v => full.format(v));\n const compact = values.map(v =>\n v === 0\n ? full.format(0)\n : wrChartNumberFormat(locale, {\n notation: 'compact',\n maximumSignificantDigits: wrClamp(magnitude(v) - last + 1, 1, 21),\n }).format(v)\n );\n const longest = (labels: readonly string[]): number => Math.max(...labels.map(text => text.length));\n return longest(compact) <= longest(plain) ? compact : plain;\n };\n\n const exact = (v: number, fractionDigits: number, ...args: A): string => {\n const custom = valueFormat();\n if (custom) return custom(v, ...args);\n const digits = Number.isFinite(fractionDigits) ? wrClamp(Math.round(fractionDigits), 0, 20) : 3;\n return wrChartNumberFormat(locale, { maximumFractionDigits: digits }).format(v);\n };\n\n return { value, label, ticks, exact };\n}\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\n/**\n * `value` rounded to `digits` decimals for an inline style or an SVG attribute, with\n * `-0` folded to `0`: a share of an axis, a percentage, a coordinate.\n *\n * Eleven charts each kept a copy of this under another name (`short`, `percent`,\n * `fixed`), at three precisions. A written geometry value wants few digits - every one\n * past the fourth is bytes in the DOM and a different string for the same pixel - and\n * never `-0`, which `Math.round` produces for a small negative and which prints as `-0`.\n *\n * Not `wrRound` from `ngwr/utils`, which nudges by `Number.EPSILON` to round a decimal\n * tie the way a person expects and keeps the sign of a zero.\n *\n * @internal\n */\nexport function wrChartRound(value: number, digits = 4): number {\n const factor = 10 ** digits;\n return Math.round(value * factor) / factor || 0;\n}\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\n/**\n * The helpers ngwr's charts share: the series palette, dashes and marker shapes,\n * the number writers, the nice-number axis, rounding, label thinning, one hover and\n * one resize listener, the empty / loading / error state, and the data table a chart\n * renders beside its drawing. The chart theme itself, `--wr-chart-*`, is this entry\n * point's stylesheet. Every export is `@internal` - an entry point of its own so\n * that the charts and the legend can all import it without one chart importing\n * another, and not a public API: nothing here carries a stability promise, and an\n * app imports a chart instead.\n */\nexport { wrChartAxis } from './axis';\nexport { WrChartState, useChartState } from './chart-state';\nexport type { WrChartStateKind, WrChartStateOptions, WrChartStateView } from './chart-state';\nexport { WrChartTable } from './chart-table';\nexport { useChartHover, useChartSize, wrChartDim, wrChartObserveSize } from './interaction';\nexport type { WrChartHoverHandlers, WrChartSize } from './interaction';\nexport { wrChartLabelStep, wrChartLongest } from './labels';\nexport { WR_CHART_MARKERS, wrChartMarker, wrChartMarkerExtent, wrChartMarkerPath } from './markers';\nexport { useChartNumbers, wrChartNumberFormat } from './numbers';\nexport {\n WR_CHART_DASHES,\n WR_CHART_LEGACY_PALETTE,\n WR_CHART_PALETTE,\n wrChartColor,\n wrChartDash,\n wrChartLegacyColor,\n} from './palette';\nexport { wrChartRound } from './round';\nexport type {\n WrChartAxis,\n WrChartAxisOptions,\n WrChartMarkerExtent,\n WrChartMarkerShape,\n WrChartNumbers,\n WrChartTableData,\n WrChartTableGroup,\n WrChartTableRow,\n} from './types';\n"],"mappings":";;;;;;;;;;AAYA,MAAM,aAAa;AAGnB,MAAM,QAAqB;CAAE,KAAK;CAAG,KAAK;CAAG,MAAM;CAAM,OAAO;EAAC;EAAG;EAAM;EAAK;EAAM;CAAC;AAAC;AAGvF,MAAM,SAAS;CAAC;CAAG;CAAK;CAAM;AAAG;AAejC,SAAS,WAAW,MAAY;CAC9B,OAAO,KAAK,IAAI,IAAI,KAAK,IAAI,GAAG,KAAK,KAAK,CAAC,KAAK,MAAM,IAAI,CAAC,IAAI,CAAC,CAAC;AACnE;AAcA,SAAS,YAAY,OAAa;CAChC,MAAM,YAAY,KAAK,IAAI,KAAK;CAChC,IAAI,OAAO,cAAc,IAAI,IAAI,YAAY;CAC7C,IAAI,YAAY,GAAG;EACjB,MAAM,MAAM,KAAK,KAAK,KAAK,MAAM,YAAY,CAAC,CAAC;EAC/C,QAAQ,KAAK,IAAI,WAAW,KAAK,WAAW,MAAM,IAAI,YACpD,KAAK,MAAM,QAAQ,QAAQ;GACzB,MAAM,YAAY,OAAO,MAAM;GAC/B,IAAI,YAAY,YAAY,GAAG;GAC/B,MAAM,QAAQ,QAAQ;GACtB,IAAI,KAAK,IAAI,QAAQ,KAAK,MAAM,KAAK,CAAC,IAAI,MAAM;IAC9C,OAAO;IACP,MAAM;GACR;EACF;CAEJ;CACA,MAAM,SAAS,WAAW,IAAI;CAC9B,OAAO;EACL,KAAK,QAAQ;EACb,KAAK,QAAQ;EACb;EACA,OAAO;GAAC,QAAQ,QAAQ,MAAM,MAAM;GAAG;GAAO,QAAQ,QAAQ,MAAM,MAAM;EAAC;CAC5E;AACH;AASA,SAAgB,SAAS,KAAW;CAClC,IAAI,CAAC,OAAO,SAAS,GAAG,KAAK,OAAO,G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ts","../../../projects/lib/charts/core/chart-state.html","../../../projects/lib/charts/core/chart-table.ts","../../../projects/lib/charts/core/chart-table.html","../../../projects/lib/charts/core/interaction.ts","../../../projects/lib/charts/core/labels.ts","../../../projects/lib/charts/core/palette.ts","../../../projects/lib/charts/core/markers.ts","../../../projects/lib/charts/core/numbers.ts","../../../projects/lib/charts/core/round.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 { wrRound } from 'ngwr/utils';\n\nimport type { WrChartAxis, WrChartAxisOptions } from './types';\n\n/** How many gaps an axis aims for by default. Five labels, four gaps. */\nconst TICK_COUNT = 4;\n\n/** The axis drawn when there is no data to fit: 0 to 1 in quarters, the line chart's empty frame. */\nconst EMPTY: WrChartAxis = { min: 0, max: 1, step: 0.25, ticks: [1, 0.75, 0.5, 0.25, 0] };\n\n/** The rungs of the {@link niceStep} ladder within one decade, from the top: 1, 0.5, 0.25 and 0.2 of it. */\nconst LADDER = [1, 0.5, 0.25, 0.2] as const;\n\n/**\n * How many fraction digits a tick on an axis stepping by `step` is rounded to: two past\n * the step's own leading digit, and never fewer than six or more than fifteen.\n *\n * It was a fixed six, which cannot write a tick finer than a millionth: an axis stepping\n * by 2.5e-7 — a micro-priced asset — came back as five ticks of `0.000013` and\n * `0.000012`, one stepping by 5e-10 as five zeros, and one stepping by 2.5e-6 put two of\n * its gridlines at the wrong height. Every tick is a whole multiple of the step, whose\n * last digit is at most one place past its leading one (2.5, and 0.25 on the\n * centred axis' ladder, two), so two past the leading digit writes every tick exactly.\n * The floor of six keeps every axis that was already exact bit for bit what it was,\n * and keeps a step no rung divides — a third, centred — at the six it always had.\n */\nfunction tickDigits(step: number): number {\n return Math.min(15, Math.max(6, Math.ceil(-Math.log10(step)) + 2));\n}\n\n/**\n * The `symmetric` axis for data with no span: the value in the MIDDLE, as a tick of\n * its own, with one step either side.\n *\n * Snapped outward, a flat range keeps its value inside the frame but not at its\n * centre: a lone 120 lands on an axis from 100 to 150, two fifths of the way up. The\n * step here is the largest rung of the same ladder that is at most a quarter of the\n * value and divides it exactly, so all three ticks are round: 100 / 120 / 140,\n * 4 / 5 / 6, 1234 / 1234.5 / 1235. Zero has no magnitude to take a quarter of, and\n * reads −1 / 0 / 1; a value no rung divides within twelve decades takes a quarter\n * of itself.\n */\nfunction centredAxis(value: number): WrChartAxis {\n const magnitude = Math.abs(value);\n let step = magnitude === 0 ? 1 : magnitude / 4;\n if (magnitude > 0) {\n const top = Math.ceil(Math.log10(magnitude / 4));\n search: for (let exponent = top; exponent > top - 12; exponent--) {\n for (const rung of LADDER) {\n const candidate = rung * 10 ** exponent;\n if (candidate > magnitude / 4) continue;\n const ratio = value / candidate;\n if (Math.abs(ratio - Math.round(ratio)) < 1e-9) {\n step = candidate;\n break search;\n }\n }\n }\n }\n const digits = tickDigits(step);\n return {\n min: value - step,\n max: value + step,\n step,\n ticks: [wrRound(value + step, digits), value, wrRound(value - step, digits)],\n };\n}\n\n/**\n * The smallest 1 / 2 / 2.5 / 5 × 10ⁿ at or above `raw` — the conventional\n * nice-number ladder every plotting library uses to pick an axis step.\n *\n * `2.5` earns its place on the small end: without it a span that wants a step\n * of 2.1 jumps to 5 and the axis loses half its labels.\n */\nexport function niceStep(raw: number): number {\n if (!Number.isFinite(raw) || raw <= 0) return 1;\n const magnitude = 10 ** Math.floor(Math.log10(raw));\n const normalised = raw / magnitude;\n const nice = normalised <= 1 ? 1 : normalised <= 2 ? 2 : normalised <= 2.5 ? 2.5 : normalised <= 5 ? 5 : 10;\n return nice * magnitude;\n}\n\n/**\n * A value axis for data running from `min` to `max`, SNAPPED to a readable step —\n * and the snapping is the point.\n *\n * The line chart's axis used to be \"the data's max plus 10%, divided into four\",\n * which lands on a round number almost never: seven integers between 3 and 35 gave\n * an axis reading 38.2 / 28.7 / 19.1 / 9.6 / 0. A chart's axis is the one part of it\n * a reader is supposed to do arithmetic against.\n *\n * So the step is rounded UP to the nearest 1, 2, 2.5 or 5 times a power of ten —\n * the conventional nice-number ladder — and the bounds are then snapped outward to\n * whole multiples of it. The same 3..35 reads 0 / 10 / 20 / 30 / 40. Snapping\n * outward replaces the old 10% padding, and where the peak still lands exactly on\n * the top it is lifted a step, since a line that ends on the frame reads as clipped.\n * `symmetric` does the same at the bottom.\n *\n * A flat range has no span to divide, so it is given its own magnitude as one (or 1,\n * at zero). With `symmetric` it is centred instead: the value is the middle of three\n * ticks, a round step on either side, whatever `tickCount` asks for. Non-finite\n * bounds, the `Math.min()` / `Math.max()` of no data, give the empty frame from 0 to\n * 1. Bounds handed in the wrong order are swapped.\n *\n * The line chart's own rule, which floors its axis at zero and never lifts it to\n * zero from below, is `wrChartAxis(Math.min(0, min), max)`: an all-negative series\n * keeps an axis that ends just above its peak. `includeZero` is the other reading,\n * zero inside the range on either side, which an area needs for its baseline.\n *\n * @internal\n */\nexport function wrChartAxis(min: number, max: number, options: WrChartAxisOptions = {}): WrChartAxis {\n if (!Number.isFinite(min) || !Number.isFinite(max)) return EMPTY;\n const dataLo = Math.min(min, max);\n const dataHi = Math.max(min, max);\n const lo = options.includeZero ? Math.min(0, dataLo) : dataLo;\n const hi = options.includeZero ? Math.max(0, dataHi) : dataHi;\n // A scale with no baseline has no reason to put a lone value anywhere but the middle.\n if (options.symmetric && lo === hi) return centredAxis(lo);\n\n const count = options.tickCount !== undefined && options.tickCount >= 1 ? Math.round(options.tickCount) : TICK_COUNT;\n // A flat series has no span to divide, so give it one rather than a zero step.\n const span = hi - lo || Math.abs(hi) || 1;\n const step = niceStep(span / count);\n // A quotient a hair off a whole number (0.3 / 0.025 is 11.999999999999998) is that number.\n const snap = (value: number): number => {\n const q = value / step;\n return Math.abs(q - Math.round(q)) <= 1e-9 * Math.max(1, Math.abs(q)) ? Math.round(q) : q;\n };\n const near = (a: number, b: number): boolean => Math.abs(a - b) <= step * 1e-9;\n let bottomStep = Math.floor(snap(lo));\n let topStep = Math.ceil(snap(hi));\n // The data's peak sitting exactly on the frame reads as clipped, so lift the\n // ceiling by one step when the snap did not already do it. Measured against the\n // DATA, so a zero that only `includeZero` put at the top is not lifted: nothing\n // sits on it. `symmetric` holds the bottom to the same rule.\n if (near(topStep * step, dataHi)) topStep += 1;\n if (options.symmetric && near(bottomStep * step, dataLo)) bottomStep -= 1;\n const bottom = bottomStep * step;\n const top = topStep * step;\n\n // Floating-point: 0.1 + 0.2 walks past an exact bound, so count in integers and\n // multiply, and stop on the count rather than on `value >= min`.\n const digits = tickDigits(step);\n const gaps = Math.round((top - bottom) / step);\n const ticks: number[] = [];\n for (let i = 0; i <= gaps; i++) ticks.push(wrRound(top - i * step, digits));\n return { min: bottom, max: top, step, ticks };\n}\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { Component, type Signal, ViewEncapsulation, computed, input } from '@angular/core';\n\nimport { useI18nText } from 'ngwr/i18n';\n\n/**\n * What a chart shows in place of its marks.\n *\n * @internal\n */\nexport type WrChartStateKind = 'empty' | 'loading' | 'error';\n\n/**\n * The state a chart is in, with the message it shows for it.\n *\n * @internal\n */\nexport interface WrChartStateView {\n readonly kind: WrChartStateKind;\n readonly label: string;\n}\n\n/**\n * The inputs a chart hands {@link useChartState}.\n *\n * @internal\n */\nexport interface WrChartStateOptions {\n /** The chart's `loading` input. */\n readonly loading: Signal<boolean>;\n /** The chart's `error` input. */\n readonly error: Signal<boolean>;\n /** Whether the chart has nothing to draw. */\n readonly empty: Signal<boolean>;\n /** The chart's `emptyLabel`, `loadingLabel` and `errorLabel` inputs: `null` takes the catalog's. */\n readonly emptyLabel: Signal<string | null>;\n readonly loadingLabel: Signal<string | null>;\n readonly errorLabel: Signal<string | null>;\n}\n\n/**\n * The state a chart shows instead of its marks, or `null` while it draws them: loading\n * first, then a failed load, then no data. Each message is the chart's own `*Label`\n * input, then the catalog's `chart.loading` / `chart.error` / `chart.empty`, then\n * English. Call in an injection context.\n *\n * One rule for every chart, so a dashboard whose requests are in flight reads the same\n * in every tile, and a chart with no data is a framed \"No data\" rather than a blank box\n * of whatever height its markup collapses to.\n *\n * @internal\n */\nexport function useChartState(options: WrChartStateOptions): Signal<WrChartStateView | null> {\n const loading = useI18nText(options.loadingLabel, 'chart.loading', 'Loading…');\n const error = useI18nText(options.errorLabel, 'chart.error', 'Could not load');\n const empty = useI18nText(options.emptyLabel, 'chart.empty', 'No data');\n return computed<WrChartStateView | null>(() => {\n if (options.loading()) return { kind: 'loading', label: loading() };\n if (options.error()) return { kind: 'error', label: error() };\n if (options.empty()) return { kind: 'empty', label: empty() };\n return null;\n });\n}\n\n/**\n * The message a chart shows in place of its marks, centred over the frame it keeps.\n *\n * A live region: `role=\"status\"`, so a screen reader hears \"Loading…\" when a chart\n * starts a request and \"No data\" when it comes back with none, without the chart taking\n * focus. A failed load is `role=\"alert\"`, which interrupts, since it is the one of the\n * three a reader has to act on. The chart renders it inside the box its marks are drawn\n * in, which it positions; the grid and the axis under it stay.\n *\n * @example\n * ```html\n * @if (state(); as shown) {\n * <wr-chart-state [kind]=\"shown.kind\" [label]=\"shown.label\" />\n * }\n * ```\n *\n * @internal\n */\n@Component({\n selector: 'wr-chart-state',\n templateUrl: './chart-state.html',\n encapsulation: ViewEncapsulation.None,\n host: {\n class: 'wr-chart-state',\n '[class.wr-chart-state--empty]': \"kind() === 'empty'\",\n '[class.wr-chart-state--loading]': \"kind() === 'loading'\",\n '[class.wr-chart-state--error]': \"kind() === 'error'\",\n '[attr.role]': \"kind() === 'error' ? 'alert' : 'status'\",\n },\n})\nexport class WrChartState {\n /** Which of the three states this is. */\n readonly kind = input.required<WrChartStateKind>();\n\n /** The message, already translated. */\n readonly label = input.required<string>();\n}\n","<span class=\"wr-chart-state__plate\">\n @if (kind() === 'loading') {\n <!-- Decoration: the word beside it carries the state. -->\n <span class=\"wr-chart-state__spinner\" aria-hidden=\"true\"></span>\n }\n <span class=\"wr-chart-state__label\">{{ label() }}</span>\n</span>\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { Component, ViewEncapsulation, computed, input } from '@angular/core';\n\nimport type { WrChartTableData } from './types';\n\n/**\n * The figures a chart draws, as a table that only assistive technology reaches.\n *\n * A chart's drawing is one named `role=\"img\"`, and `img` makes everything inside it\n * presentational: the name is announced and the numbers are nowhere a screen reader\n * can walk. This renders them as a real `<table>` — a caption, column headers, row\n * headers, and a `<tbody>` per group headed by a `<th scope=\"rowgroup\">` down its rows\n * — so a reader can move cell by cell and hear each value with its row and column.\n *\n * **Beside the image, never inside it.** Inside, `img` would hide it with the rest of\n * the drawing. A chart renders `<wr-chart-table>` as a sibling of the element that\n * carries `role=\"img\"`, and only while its `dataTable` input asks for it. **The chart's\n * host has to be positioned** (`position: relative`): the table is out of flow, and\n * against a static host it resolves to an ancestor outside the chart and keeps its place\n * in an unpositioned scroller's content, which grew one page by 1600px of blank scroll.\n *\n * **Hidden by clipping, not by `display` or `hidden`**, which would take it out of the\n * accessibility tree as well: the host is clipped to nothing and taken out of flow, so\n * it costs the chart no layout and still reads in full. The table inside keeps its own\n * layout, because a `<table>` will not shrink to a clip box of its own — it grows to\n * fit its cells whatever its width says. Nothing in it is focusable, so no tab stop\n * lands on something that cannot be seen.\n *\n * No ids: the headers are tied to their cells by `scope`, which needs none, and an id\n * minted on the server would not match the client's.\n *\n * @example\n * ```html\n * <div class=\"wr-line-chart__plot\" role=\"img\" [attr.aria-label]=\"label()\">…</div>\n * @if (dataTable()) {\n * <wr-chart-table [data]=\"table()\" />\n * }\n * ```\n *\n * @internal\n */\n@Component({\n selector: 'wr-chart-table',\n templateUrl: './chart-table.html',\n encapsulation: ViewEncapsulation.None,\n host: { class: 'wr-chart-table' },\n})\nexport class WrChartTable {\n /** The caption, the column headings and the rows, every string already written. */\n readonly data = input.required<WrChartTableData>();\n\n /** Whether any group is headed, which gives every row a leading group column. */\n protected readonly hasGroupHeaders = computed(() => this.data().groups.some(group => !!group.header));\n}\n","@let d = data();\n@let grouped = hasGroupHeaders();\n<!-- Every section is written out, `<thead>` and each `<tbody>` included: the HTML\n parser inserts a `<tbody>` the template left out, and hydration would then meet\n a tree it did not render. -->\n<table class=\"wr-chart-table__table\">\n <caption>\n {{\n d.caption\n }}\n </caption>\n <thead>\n <tr>\n <!-- Over the group headers' column, then the row headers' one. -->\n @if (grouped && !d.corner) {\n <td colspan=\"2\"></td>\n } @else {\n @if (grouped) {\n <td></td>\n }\n @if (d.corner) {\n <th scope=\"col\">{{ d.corner }}</th>\n } @else {\n <td></td>\n }\n }\n @for (column of d.columns; track $index) {\n <th scope=\"col\">{{ column }}</th>\n }\n </tr>\n </thead>\n @for (group of d.groups; track $index) {\n @if (group.rows.length > 0) {\n <tbody>\n @for (row of group.rows; track $index; let first = $first, count = $count) {\n <tr>\n <!-- The group's header in a column of its own, down every row of the group:\n the shape the HTML table algorithm and every checker read as heading the\n cells beside it. A full-width row above the group heads nothing by axe's\n reading. -->\n @if (grouped && first) {\n @if (group.header) {\n <th scope=\"rowgroup\" [attr.rowspan]=\"count\">{{ group.header }}</th>\n } @else {\n <td [attr.rowspan]=\"count\"></td>\n }\n }\n <th scope=\"row\">{{ row.header }}</th>\n @for (cell of row.cells; track $index) {\n <td>{{ cell }}</td>\n }\n </tr>\n }\n </tbody>\n }\n }\n</table>\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 { DestroyRef, ElementRef, type Signal, afterNextRender, afterRenderEffect, inject, signal } from '@angular/core';\n\nconst UNMEASURED: WrChartSize = { width: 0, height: 0 };\n\n/** What each observed element reports to, on the one observer every chart shares. */\nconst listeners = new WeakMap<Element, (size: WrChartSize) => void>();\n\n/** The marks {@link wrChartDim} lit last, per host, so the next call clears them without a scan. */\nconst litMarks = new WeakMap<Element, Element[]>();\n\nlet observer: ResizeObserver | null = null;\n\n/** The constructor `observer` was built with: a page has one, a test suite swaps it. */\nlet observerType: typeof ResizeObserver | null = null;\n\n/**\n * The box a chart measures, in px. Both are 0 until it is laid out.\n *\n * @internal\n */\nexport interface WrChartSize {\n readonly width: number;\n readonly height: number;\n}\n\n/**\n * Reports `element`'s content box to `listener` whenever it changes, through ONE\n * `ResizeObserver` for every chart on the page. Returns the function that stops it.\n *\n * Seven charts each made an observer of their own, so a dashboard of forty tiles ran\n * forty. An observer is built to watch many targets and delivers them in one callback\n * per frame. One listener per element: observing an element again replaces its listener.\n * Where there is no `ResizeObserver` (a server, an old test environment) nothing is\n * observed and the returned function does nothing.\n *\n * @internal\n */\nexport function wrChartObserveSize(element: Element, listener: (size: WrChartSize) => void): () => void {\n if (typeof ResizeObserver === 'undefined') return () => undefined;\n if (!observer || observerType !== ResizeObserver) {\n observerType = ResizeObserver;\n observer = new ResizeObserver(entries => {\n for (const entry of entries) {\n const { width, height } = entry.contentRect;\n listeners.get(entry.target)?.({ width, height });\n }\n });\n }\n const shared = observer;\n listeners.set(element, listener);\n shared.observe(element);\n return () => {\n listeners.delete(element);\n shared.unobserve(element);\n };\n}\n\n/**\n * The size of the element `target` holds, as a signal that follows it: `0 × 0` until the\n * element is rendered and laid out, and again once it is gone. On the shared observer of\n * {@link wrChartObserveSize}. Call in an injection context.\n *\n * @internal\n */\nexport function useChartSize(target: Signal<ElementRef<Element> | Element | undefined>): Signal<WrChartSize> {\n const size = signal<WrChartSize>(UNMEASURED);\n let stop: (() => void) | null = null;\n let observed: Element | null = null;\n\n afterRenderEffect(() => {\n const held = target();\n const element = held instanceof ElementRef ? held.nativeElement : (held ?? null);\n if (element === observed) return;\n stop?.();\n observed = element;\n stop = null;\n if (!element) {\n size.set(UNMEASURED);\n return;\n }\n stop = wrChartObserveSize(element, next => {\n const current = size();\n if (current.width !== next.width || current.height !== next.height) size.set(next);\n });\n });\n inject(DestroyRef).onDestroy(() => stop?.());\n return size.asReadonly();\n}\n\n/**\n * What {@link useChartHover} tells a chart.\n *\n * @internal\n */\nexport interface WrChartHoverHandlers {\n /** The pointer is over the section whose `data-wr-index` is `index`. Not repeated while it stays there. */\n enter(index: number): void;\n /** The pointer left the sections: for the chart's box, or for a part of it that is no section. */\n leave(event: MouseEvent): void;\n}\n\n/**\n * Dims every mark of `host` but the ones of series `key`, or none for `null`: the chart\n * takes `wr-chart--dim` and the series' own marks `wr-chart-mark--on`, and the shared\n * stylesheet fades the rest to `--wr-chart-dim`. A mark is anything carrying\n * `data-wr-series`, a legend row included.\n *\n * Classes set by hand rather than bound: a binding on every mark is re-evaluated for\n * every mark on each hover change, and this touches the marks of two series.\n *\n * @internal\n */\nexport function wrChartDim(host: Element, key: string | null): void {\n for (const mark of litMarks.get(host) ?? []) mark.classList.remove('wr-chart-mark--on');\n host.classList.toggle('wr-chart--dim', key !== null);\n if (key === null) {\n litMarks.delete(host);\n return;\n }\n const marks = [...host.querySelectorAll(`[data-wr-series=\"${CSS.escape(key)}\"]`)];\n for (const mark of marks) mark.classList.add('wr-chart-mark--on');\n litMarks.set(host, marks);\n}\n\n/**\n * A chart's hover, from ONE pair of listeners on its host however many sections it draws.\n *\n * A section is any element carrying `data-wr-index`: the listener finds the nearest one\n * above whatever the pointer is on and reports its index, once per section entered. A\n * listener pair on every bar was two per bar, and each one a change detection pass over\n * the whole chart for every bar the pointer crossed; these are native listeners, so a\n * move runs no pass at all unless the chart's own handler writes a signal.\n *\n * A gap the chart marks with `data-wr-hold` keeps the section and the dim as they are, so\n * crossing from one bar to the next does not close and reopen the tooltip; a section in\n * such an area takes `wr-chart-section--on`, so a band the chart paints on it stays too.\n *\n * It also drives the shared hover-dim: the nearest element carrying `data-wr-series`\n * names the series under the pointer, and {@link wrChartDim} fades the rest. Legend rows\n * carry the attribute too, so hovering a row dims the chart the same way.\n *\n * Registered after the first render, in the browser only. Call in an injection context.\n *\n * @internal\n */\nexport function useChartHover(handlers: WrChartHoverHandlers): void {\n const host = inject(ElementRef).nativeElement as HTMLElement;\n const destroyRef = inject(DestroyRef);\n let index: number | null = null;\n let series: string | null = null;\n\n const dim = (key: string | null): void => {\n if (key === series) return;\n series = key;\n wrChartDim(host, key);\n };\n\n let current: Element | null = null;\n const band = (section: Element | null): void => {\n current?.classList.remove('wr-chart-section--on');\n current = section?.closest('[data-wr-hold]') ? section : null;\n current?.classList.add('wr-chart-section--on');\n };\n\n const inHost = (el: Element | null | undefined): el is Element => !!el && host.contains(el);\n\n const over = (event: MouseEvent): void => {\n const target = event.target instanceof Element ? event.target : null;\n const section = target?.closest('[data-wr-index]');\n const series = target?.closest('[data-wr-series]');\n // In the room a chart holds open between its marks (`data-wr-hold`, the gaps between\n // its bars), the pointer is still on the drawing: what it last pointed at stays,\n // rather than closing and reopening a few pixels on.\n const held = !inHost(series) && inHost(target?.closest('[data-wr-hold]'));\n if (!held) dim(inHost(series) ? series.getAttribute('data-wr-series') : null);\n if (held && !inHost(section)) return;\n\n const next = inHost(section) ? Number(section.getAttribute('data-wr-index')) : null;\n if (next === index) return;\n index = next;\n if (next === null || !Number.isFinite(next)) {\n band(null);\n handlers.leave(event);\n } else {\n band(section ?? null);\n handlers.enter(next);\n }\n };\n\n const leave = (event: MouseEvent): void => {\n dim(null);\n if (index === null) return;\n index = null;\n band(null);\n handlers.leave(event);\n };\n\n afterNextRender(() => {\n host.addEventListener('mouseover', over);\n host.addEventListener('mouseleave', leave);\n destroyRef.onDestroy(() => {\n host.removeEventListener('mouseover', over);\n host.removeEventListener('mouseleave', leave);\n });\n });\n}\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\n/**\n * The `limit` longest of `labels`, each once, longest first: the strings worth measuring.\n *\n * A chart sizes a gutter or keeps room past a bar from a hidden copy of the text that goes\n * there. Copying every label made ten thousand hidden spans for ten thousand bars, to learn\n * the width of one. The widest label is almost always among the longest few by character\n * count - a proportional font can put `1,111` under `999`, which is why this returns a few\n * and not one - so a chart renders these and reads the widest.\n *\n * @internal\n */\nexport function wrChartLongest(labels: readonly string[], limit = 3): string[] {\n const longest: string[] = [];\n for (const label of new Set(labels)) {\n if (longest.length === limit && label.length <= longest[longest.length - 1].length) continue;\n let at = longest.findIndex(kept => kept.length < label.length);\n if (at < 0) at = longest.length;\n longest.splice(at, 0, label);\n if (longest.length > limit) longest.pop();\n }\n return longest;\n}\n\n/**\n * How many categories each printed label stands for, so no two labels along an axis run\n * into each other: 1 while every label fits its own band, 2 to print every second one,\n * and so on.\n *\n * `extent` is the axis' length and `count` how many bands share it; `labelSize` is the\n * longest label along the axis, and `gap` the least room between two labels. All in the\n * same unit, px in practice. With nothing measured yet - a server render, a chart not\n * laid out - the answer is 1: every label, as the markup had before it was measured.\n *\n * @internal\n */\nexport function wrChartLabelStep(count: number, extent: number, labelSize: number, gap = 8): number {\n if (!(count > 1) || !(extent > 0) || !(labelSize > 0)) return 1;\n const band = extent / count;\n return Math.max(1, Math.min(count, Math.ceil((labelSize + gap) / band)));\n}\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\n/**\n * Default series colours, in order: what a series, a slice or a segment with no\n * `color` of its own takes. Each is a token of the chart theme (`--wr-chart-1` to\n * `--wr-chart-8`, declared by `ngwr/charts/core`'s stylesheet), so an app retints\n * every chart by setting the tokens and a chart's markup never names a hex.\n *\n * The palette is not the status intents: a second series is not a success and a\n * fourth is not a danger. The first is the brand colour and the last the neutral\n * role; neighbours alternate between a deep and a mid tone, so two series next to\n * each other differ in lightness as well as in hue. The stylesheet carries the\n * measured contrast of each.\n *\n * A chart that draws lines still pairs each with a dash (`WR_CHART_DASHES`), and\n * one that draws points with a shape (`WR_CHART_MARKERS`): colour is never the\n * only thing that tells two series apart.\n *\n * @internal\n */\nexport const WR_CHART_PALETTE: readonly string[] = [\n 'var(--wr-chart-1)',\n 'var(--wr-chart-2)',\n 'var(--wr-chart-3)',\n 'var(--wr-chart-4)',\n 'var(--wr-chart-5)',\n 'var(--wr-chart-6)',\n 'var(--wr-chart-7)',\n 'var(--wr-chart-8)',\n];\n\n/**\n * The palette colour for the series at `index`, wrapping past the end.\n *\n * @internal\n */\nexport function wrChartColor(index: number): string {\n return WR_CHART_PALETTE[wrap(index, WR_CHART_PALETTE.length)];\n}\n\n/**\n * The series colours every chart took before the chart theme: four status intents and\n * the neutral role. Kept for the charts that have not moved onto `--wr-chart-*` yet,\n * so each keeps its look until it does; a chart on the theme reads\n * {@link WR_CHART_PALETTE}.\n *\n * `warning` measures 1.71:1 on a white surface, under the 3:1 a graphic needs, which\n * is one of the reasons the theme's palette replaced it.\n *\n * @internal\n */\nexport const WR_CHART_LEGACY_PALETTE: readonly string[] = [\n 'var(--wr-color-primary)',\n 'var(--wr-color-success)',\n 'var(--wr-color-warning)',\n 'var(--wr-color-danger)',\n 'var(--wr-color-on-surface-muted)',\n];\n\n/**\n * The {@link WR_CHART_LEGACY_PALETTE} colour for the series at `index`, wrapping past\n * the end.\n *\n * @internal\n */\nexport function wrChartLegacyColor(index: number): string {\n return WR_CHART_LEGACY_PALETTE[wrap(index, WR_CHART_LEGACY_PALETTE.length)];\n}\n\n/**\n * A dash pattern per series, so lines are told apart by SHAPE and not only by hue.\n *\n * A reader with red-green colour blindness can see two strokes of similar lightness\n * as one grey, and a legend that pairs a coloured dot with a name does not rescue it:\n * matching the dot to the line is exactly the step that needs hue. Distinguishing\n * series by dash is the standard remedy and the only one that survives greyscale,\n * printing and a monochrome display.\n *\n * The FIRST entry is solid on purpose. A single-series chart is the common case\n * and there is nothing to tell apart in it; the patterns only appear once a second\n * series does. Each value is an SVG `stroke-dasharray`, `''` meaning none.\n *\n * @internal\n */\nexport const WR_CHART_DASHES: readonly string[] = ['', '7 4', '2 3', '10 4 2 4', '1 4', '6 3 2 3'];\n\n/**\n * The dash pattern for the series at `index`, wrapping past the end.\n *\n * @internal\n */\nexport function wrChartDash(index: number): string {\n return WR_CHART_DASHES[wrap(index, WR_CHART_DASHES.length)];\n}\n\n/** `index` folded into `[0, length)`, negatives included, so a bad index still picks an entry. */\nexport function wrap(index: number, length: number): number {\n const i = Number.isFinite(index) ? Math.trunc(index) : 0;\n return ((i % length) + length) % length;\n}\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { wrap } from './palette';\nimport type { WrChartMarkerExtent, WrChartMarkerShape } from './types';\n\n/** Half the side of a square with the area of a circle of radius 1: √π / 2. */\nconst SQUARE = Math.sqrt(Math.PI) / 2;\n\n/** Half the diagonal of that square, standing on a corner. */\nconst DIAMOND = SQUARE * Math.SQRT2;\n\n/** The side of an equilateral triangle with the area of a circle of radius 1: √(4π / √3). */\nconst TRIANGLE_SIDE = Math.sqrt((4 * Math.PI) / Math.sqrt(3));\n\n/** The distance from that triangle's centroid to a corner (two thirds of its height). */\nconst TRIANGLE_APEX = (TRIANGLE_SIDE * Math.sqrt(3)) / 3;\n\n/**\n * A plus with arms 0.35 of their length thick, half-length `L` and half-thickness\n * `0.35 L`, has an area of `8·0.35·L² − 4·0.35²·L²`; this is the `L` that makes it π.\n */\nconst CROSS_ARM = Math.sqrt(Math.PI / (8 * 0.35 - 4 * 0.35 ** 2));\nconst CROSS_THICKNESS = CROSS_ARM * 0.35;\n\n/**\n * How far each shape reaches from its centre at `r = 1`, read off the corners\n * {@link wrChartMarkerPath} draws: up, down, to either side, and to the farthest\n * corner.\n */\nconst EXTENTS: Readonly<Record<WrChartMarkerShape, WrChartMarkerExtent>> = {\n circle: { top: 1, bottom: 1, side: 1, radius: 1 },\n square: { top: SQUARE, bottom: SQUARE, side: SQUARE, radius: SQUARE * Math.SQRT2 },\n diamond: { top: DIAMOND, bottom: DIAMOND, side: DIAMOND, radius: DIAMOND },\n triangle: { top: TRIANGLE_APEX, bottom: TRIANGLE_APEX / 2, side: TRIANGLE_SIDE / 2, radius: TRIANGLE_APEX },\n 'triangle-down': { top: TRIANGLE_APEX / 2, bottom: TRIANGLE_APEX, side: TRIANGLE_SIDE / 2, radius: TRIANGLE_APEX },\n cross: { top: CROSS_ARM, bottom: CROSS_ARM, side: CROSS_ARM, radius: Math.hypot(CROSS_ARM, CROSS_THICKNESS) },\n};\n\n/** A coordinate to three decimals, without trailing zeros, so a path stays short. */\nconst n = (value: number): string => String(Math.round(value * 1000) / 1000 || 0);\n\n/** `M x y L … Z` through the given corners. */\nconst polygon = (points: readonly (readonly [number, number])[]): string =>\n `M ${points.map(([x, y]) => `${n(x)} ${n(y)}`).join(' L ')} Z`;\n\n/**\n * A marker shape per series, so points are told apart by SHAPE and not only by\n * hue — the dash list's job, for a chart that draws points rather than lines.\n *\n * The circle comes first for the reason the solid dash does: a single-series chart\n * has nothing to tell apart. The order then alternates corners and points, so two\n * neighbouring series never differ by a rotation alone (a square beside a diamond\n * is the pair a small marker blurs into one).\n *\n * @internal\n */\nexport const WR_CHART_MARKERS: readonly WrChartMarkerShape[] = [\n 'circle',\n 'square',\n 'triangle',\n 'diamond',\n 'cross',\n 'triangle-down',\n];\n\n/**\n * The marker shape for the series at `index`, wrapping past the end.\n *\n * @internal\n */\nexport function wrChartMarker(index: number): WrChartMarkerShape {\n return WR_CHART_MARKERS[wrap(index, WR_CHART_MARKERS.length)];\n}\n\n/**\n * The SVG path `d` of a marker centred on the origin, as large as a circle of\n * radius `r` — every shape has that circle's area, so a triangle reaches past it\n * and a square stays inside it, and the eye weighs them the same.\n *\n * Drawn about the origin so a chart can place it with a `transform`, or inside a\n * nested `<svg x y overflow=\"visible\">`, and size it in pixels whatever the plot's\n * own scale. A non-finite or negative `r` draws nothing rather than a path of\n * `NaN`.\n *\n * @internal\n */\nexport function wrChartMarkerPath(shape: WrChartMarkerShape, r: number): string {\n if (!Number.isFinite(r) || r <= 0) return '';\n switch (shape) {\n case 'square': {\n const h = r * SQUARE;\n return polygon([\n [-h, -h],\n [h, -h],\n [h, h],\n [-h, h],\n ]);\n }\n case 'diamond': {\n const d = r * DIAMOND;\n return polygon([\n [0, -d],\n [d, 0],\n [0, d],\n [-d, 0],\n ]);\n }\n case 'triangle':\n case 'triangle-down': {\n // Centred on the centroid, not on the box, so a triangle sits on the same\n // point a circle would.\n const flip = shape === 'triangle' ? 1 : -1;\n const apex = r * TRIANGLE_APEX;\n const half = (r * TRIANGLE_SIDE) / 2;\n return polygon([\n [0, -apex * flip],\n [half, (apex / 2) * flip],\n [-half, (apex / 2) * flip],\n ]);\n }\n case 'cross': {\n const a = r * CROSS_ARM;\n const t = r * CROSS_THICKNESS;\n return polygon([\n [-t, -a],\n [t, -a],\n [t, -t],\n [a, -t],\n [a, t],\n [t, t],\n [t, a],\n [-t, a],\n [-t, t],\n [-a, t],\n [-a, -t],\n [-t, -t],\n ]);\n }\n case 'circle':\n default:\n // Two arcs, since one arc from a point back to itself draws nothing.\n return `M ${n(-r)} 0 A ${n(r)} ${n(r)} 0 1 0 ${n(r)} 0 A ${n(r)} ${n(r)} 0 1 0 ${n(-r)} 0 Z`;\n }\n}\n\n/**\n * How far the marker {@link wrChartMarkerPath} draws at `r` reaches from its centre,\n * in px, before any stroke: up, down, to either side, and to its farthest corner.\n *\n * Every shape has the circle's AREA, so `r` is not how far a marker reaches: a\n * triangle's point stands 1.56 r above its centroid, a diamond's tips 1.25 r out\n * and a cross's corners 1.24 r, while a square's sides sit 0.89 r in. A box, a hit\n * area or a margin sized by `r` alone cuts the tips off. A non-finite or negative\n * `r` reaches nowhere, as it draws nothing.\n *\n * @internal\n */\nexport function wrChartMarkerExtent(shape: WrChartMarkerShape, r: number): WrChartMarkerExtent {\n const size = Number.isFinite(r) && r > 0 ? r : 0;\n const unit = EXTENTS[shape] ?? EXTENTS.circle;\n return { top: unit.top * size, bottom: unit.bottom * size, side: unit.side * size, radius: unit.radius * size };\n}\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { LOCALE_ID, type Signal, inject } from '@angular/core';\n\nimport { wrClamp } from 'ngwr/utils';\n\nimport type { WrChartNumbers } from './types';\n\n/**\n * The fewest fraction digits that write `value` exactly, up to six: the precision of a\n * step no power of ten divides, such as the third a flat range is centred with.\n */\nfunction fractionDigits(value: number): number {\n for (let d = 0; d <= 6; d++) if (Math.abs(value * 10 ** d - Math.round(value * 10 ** d)) < 1e-9) return d;\n return 6;\n}\n\n/** The power of ten of `value`'s leading digit: 2 for 750, -2 for 0.025. */\nfunction magnitude(value: number): number {\n const abs = Math.abs(value);\n let m = Math.floor(Math.log10(abs));\n // `log10` is a float: guard the exact powers of ten from landing one off.\n if (10 ** (m + 1) <= abs) m++;\n if (10 ** m > abs) m--;\n return m;\n}\n\n/**\n * The power of ten of `step`'s LAST significant digit: 1 for 250, -1 for 2.5. Every tick\n * is a whole multiple of the step, so no tick has a digit below it, and a tick written to\n * that digit is written exactly.\n */\nfunction lastDigit(step: number): number {\n for (let e = magnitude(step); e > -21; e--) {\n const scaled = step / 10 ** e;\n if (Math.abs(scaled - Math.round(scaled)) < 1e-6) return e;\n }\n return -21;\n}\n\n/** Every formatter the charts have asked for, by locale and options. */\nconst FORMATTERS = new Map<string, Intl.NumberFormat>();\n\n/**\n * The `Intl.NumberFormat` for `locale` and `options`, built once for the page and shared\n * by every chart on it.\n *\n * Building one costs about a tenth of a millisecond, and the charts built them freely:\n * three per chart instance, and one per tick on every pass over an axis, so a table of a\n * hundred sparklines paid for three hundred identical formatters. A formatter holds no\n * state, so one per distinct key serves them all. The key is the locale and the options\n * in the order given; the charts ask with a handful of shapes, so the map stays small.\n *\n * @internal\n */\nexport function wrChartNumberFormat(locale: string, options?: Intl.NumberFormatOptions): Intl.NumberFormat {\n const key = options ? `${locale}|${JSON.stringify(options)}` : locale;\n let format = FORMATTERS.get(key);\n if (!format) {\n format = new Intl.NumberFormat(locale, options);\n FORMATTERS.set(key, format);\n }\n return format;\n}\n\n/**\n * The number writers of one chart: its axis ticks, the labels it prints in tight\n * spaces, and the figures of its tooltip and its accessible names — every one\n * through the chart's `valueFormat` when it has one, else through `Intl` in\n * `locale`.\n *\n * Seven charts kept their own copy of the `Intl` half until 15.1, each with the\n * same two formatters and the same `formatValue`, and the line chart a second,\n * axis-wide copy for its ticks. The rules are theirs, unchanged:\n *\n * - `value` is never compact, and is `Intl`'s default otherwise: up to three\n * fraction digits, and below one three SIGNIFICANT digits, since three fraction\n * digits write a reading of 0.0004 as `0`. It is not the exact figure: 1.08345\n * is `1.083`, and an axis stepping by 0.00025 is finer than it. A chart that has\n * to write a figure to a known precision asks `exact`.\n * - `label` is compact from a thousand up, where a bar is too narrow for\n * `1,234,567`, and below a thousand it is `value`: compact rounding would print\n * 12.5 as `13`, and there is nothing to abbreviate.\n * - `ticks` is decided for the AXIS. Compact, through `Intl` (`1.2K`, `3.4M`,\n * `4 Mio.`, `5 тыс.`), with each tick to exactly the significant digits the step\n * needs — a fixed count printed 1250 beside 1000 as `1.3k` and `1k` on an axis\n * stepping by 250. And when abbreviating would make the labels LONGER (a fine\n * step on large numbers, where `-1.025K` is wider than `-1,025`) the whole axis\n * is written in full instead, so no axis mixes `-1K` with `-1,025`. Written in\n * full, a tick has as many fraction digits as the step's last digit needs, however\n * fine: they stopped at six, so an axis stepping by 2.5e-7 printed `0.000013` twice.\n * - `exact` writes a figure to a precision the chart decides — the step of its axis,\n * a price's tick size — never compact, through `valueFormat` when there is one.\n *\n * `valueFormat` takes whatever extra arguments the chart passes it, so a chart can\n * tell its formatter which axis a number is for while a `(value) => string`\n * written for another chart still fits. Call in an injection context: `locale`\n * defaults to `LOCALE_ID`.\n *\n * @internal\n */\nexport function useChartNumbers<A extends readonly unknown[] = []>(\n valueFormat: Signal<((value: number, ...args: A) => string) | null | undefined>,\n locale: string = inject(LOCALE_ID)\n): WrChartNumbers<A> {\n const numbers = wrChartNumberFormat(locale);\n /** Below one, by significant digits, which keep 0.0004 from rounding to `0`. */\n const smallNumbers = wrChartNumberFormat(locale, { maximumSignificantDigits: 3 });\n const compactNumbers = wrChartNumberFormat(locale, { notation: 'compact' });\n\n const value = (v: number, ...args: A): string => {\n const custom = valueFormat();\n if (custom) return custom(v, ...args);\n return (v !== 0 && Math.abs(v) < 1 ? smallNumbers : numbers).format(v);\n };\n\n const label = (v: number, ...args: A): string => {\n if (valueFormat() || Math.abs(v) < 1000) return value(v, ...args);\n return compactNumbers.format(v);\n };\n\n const ticks = (values: readonly number[], step: number, ...args: A): string[] => {\n const custom = valueFormat();\n if (custom) return values.map(v => custom(v, ...args));\n if (values.length === 0) return [];\n\n const last = lastDigit(step);\n // A CEILING rather than a fixed count, so trailing zeros are dropped: a 0.25 step\n // wants two digits on 0.25 and none on 1, and `1.00` beside `0.25` reads as\n // spurious precision. Down to the step's last digit, however fine — the six digits\n // `fractionDigits` stops at printed a 2.5e-7 step as `0.000013` twice, and called\n // a step below 1e-9 whole. A step with no last digit (a third) keeps those six.\n const digits = last <= -21 ? fractionDigits(step) : wrClamp(-last, 0, 20);\n const full = wrChartNumberFormat(locale, { maximumFractionDigits: digits });\n const plain = values.map(v => full.format(v));\n const compact = values.map(v =>\n v === 0\n ? full.format(0)\n : wrChartNumberFormat(locale, {\n notation: 'compact',\n maximumSignificantDigits: wrClamp(magnitude(v) - last + 1, 1, 21),\n }).format(v)\n );\n const longest = (labels: readonly string[]): number => Math.max(...labels.map(text => text.length));\n return longest(compact) <= longest(plain) ? compact : plain;\n };\n\n const exact = (v: number, fractionDigits: number, ...args: A): string => {\n const custom = valueFormat();\n if (custom) return custom(v, ...args);\n const digits = Number.isFinite(fractionDigits) ? wrClamp(Math.round(fractionDigits), 0, 20) : 3;\n return wrChartNumberFormat(locale, { maximumFractionDigits: digits }).format(v);\n };\n\n return { value, label, ticks, exact };\n}\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\n/**\n * `value` rounded to `digits` decimals for an inline style or an SVG attribute, with\n * `-0` folded to `0`: a share of an axis, a percentage, a coordinate.\n *\n * Eleven charts each kept a copy of this under another name (`short`, `percent`,\n * `fixed`), at three precisions. A written geometry value wants few digits - every one\n * past the fourth is bytes in the DOM and a different string for the same pixel - and\n * never `-0`, which `Math.round` produces for a small negative and which prints as `-0`.\n *\n * Not `wrRound` from `ngwr/utils`, which nudges by `Number.EPSILON` to round a decimal\n * tie the way a person expects and keeps the sign of a zero.\n *\n * @internal\n */\nexport function wrChartRound(value: number, digits = 4): number {\n const factor = 10 ** digits;\n return Math.round(value * factor) / factor || 0;\n}\n"],"mappings":";;;;;;;;;;AAYA,MAAM,aAAa;AAGnB,MAAM,QAAqB;CAAE,KAAK;CAAG,KAAK;CAAG,MAAM;CAAM,OAAO;EAAC;EAAG;EAAM;EAAK;EAAM;CAAC;AAAC;AAGvF,MAAM,SAAS;CAAC;CAAG;CAAK;CAAM;AAAG;AAejC,SAAS,WAAW,MAAY;CAC9B,OAAO,KAAK,IAAI,IAAI,KAAK,IAAI,GAAG,KAAK,KAAK,CAAC,KAAK,MAAM,IAAI,CAAC,IAAI,CAAC,CAAC;AACnE;AAcA,SAAS,YAAY,OAAa;CAChC,MAAM,YAAY,KAAK,IAAI,KAAK;CAChC,IAAI,OAAO,cAAc,IAAI,IAAI,YAAY;CAC7C,IAAI,YAAY,GAAG;EACjB,MAAM,MAAM,KAAK,KAAK,KAAK,MAAM,YAAY,CAAC,CAAC;EAC/C,QAAQ,KAAK,IAAI,WAAW,KAAK,WAAW,MAAM,IAAI,YACpD,KAAK,MAAM,QAAQ,QAAQ;GACzB,MAAM,YAAY,OAAO,MAAM;GAC/B,IAAI,YAAY,YAAY,GAAG;GAC/B,MAAM,QAAQ,QAAQ;GACtB,IAAI,KAAK,IAAI,QAAQ,KAAK,MAAM,KAAK,CAAC,IAAI,MAAM;IAC9C,OAAO;IACP,MAAM;GACR;EACF;CAEJ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