ngwr 15.9.0 → 16.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/animations/aurora/styles/_index.scss +1 -1
- package/animations/blur-reveal/styles/_index.scss +1 -1
- package/animations/decode/styles/_index.scss +1 -1
- package/animations/dot-grid/styles/_index.scss +1 -1
- package/animations/flow-lines/styles/_index.scss +1 -1
- package/animations/fluid-cursor/styles/_index.scss +1 -1
- package/animations/{core → internal}/styles/_mixins.scss +1 -1
- package/animations/reveal/styles/_index.scss +1 -1
- package/animations/ripple-grid/styles/_index.scss +1 -1
- package/animations/rotate-reveal/styles/_index.scss +1 -1
- package/animations/thread-lines/styles/_index.scss +1 -1
- package/animations/typewriter/styles/_index.scss +1 -1
- package/badge/styles/_tag.scss +8 -4
- package/button/styles/_index.scss +13 -7
- package/cascader/styles/_rules.scss +4 -2
- package/checkbox/styles/_index.scss +4 -2
- package/copy-value/styles/_index.scss +104 -0
- package/date-picker/styles/_index.scss +121 -0
- package/date-stamp/styles/_index.scss +38 -0
- package/dialog/styles/_index.scss +38 -0
- package/fesm2022/{ngwr-animations-core.mjs → internal-BaQU4t_0.mjs} +6 -49
- package/fesm2022/internal-BaQU4t_0.mjs.map +1 -0
- package/fesm2022/internal-CVLvP9b_.mjs +33 -0
- package/fesm2022/internal-CVLvP9b_.mjs.map +1 -0
- package/fesm2022/ngwr-alert.mjs +13 -9
- package/fesm2022/ngwr-alert.mjs.map +1 -1
- package/fesm2022/ngwr-animations-aurora.mjs +21 -21
- package/fesm2022/ngwr-animations-aurora.mjs.map +1 -1
- package/fesm2022/ngwr-animations-blur-reveal.mjs +3 -3
- package/fesm2022/ngwr-animations-blur-reveal.mjs.map +1 -1
- package/fesm2022/ngwr-animations-click-sparks.mjs +2 -2
- package/fesm2022/ngwr-animations-click-sparks.mjs.map +1 -1
- package/fesm2022/ngwr-animations-confetti.mjs +5 -5
- package/fesm2022/ngwr-animations-confetti.mjs.map +1 -1
- package/fesm2022/ngwr-animations-decode.mjs +4 -4
- package/fesm2022/ngwr-animations-decode.mjs.map +1 -1
- package/fesm2022/ngwr-animations-destruct.mjs +5 -5
- package/fesm2022/ngwr-animations-destruct.mjs.map +1 -1
- package/fesm2022/ngwr-animations-dot-grid.mjs +7 -7
- package/fesm2022/ngwr-animations-dot-grid.mjs.map +1 -1
- package/fesm2022/ngwr-animations-falling-letters.mjs +3 -3
- package/fesm2022/ngwr-animations-falling-letters.mjs.map +1 -1
- package/fesm2022/ngwr-animations-flow-lines.mjs +17 -17
- package/fesm2022/ngwr-animations-flow-lines.mjs.map +1 -1
- package/fesm2022/ngwr-animations-fluid-cursor.mjs +12 -12
- package/fesm2022/ngwr-animations-fluid-cursor.mjs.map +1 -1
- package/fesm2022/ngwr-animations-glitch.mjs +2 -2
- package/fesm2022/ngwr-animations-glitch.mjs.map +1 -1
- package/fesm2022/ngwr-animations-marquee.mjs +2 -2
- package/fesm2022/ngwr-animations-marquee.mjs.map +1 -1
- package/fesm2022/ngwr-animations-orbit.mjs +7 -7
- package/fesm2022/ngwr-animations-orbit.mjs.map +1 -1
- package/fesm2022/ngwr-animations-reveal.mjs +4 -4
- package/fesm2022/ngwr-animations-reveal.mjs.map +1 -1
- package/fesm2022/ngwr-animations-ripple-grid.mjs +5 -5
- package/fesm2022/ngwr-animations-ripple-grid.mjs.map +1 -1
- package/fesm2022/ngwr-animations-rotate-reveal.mjs +4 -4
- package/fesm2022/ngwr-animations-rotate-reveal.mjs.map +1 -1
- package/fesm2022/ngwr-animations-shimmer.mjs +2 -2
- package/fesm2022/ngwr-animations-shimmer.mjs.map +1 -1
- package/fesm2022/ngwr-animations-spotlight.mjs +1 -1
- package/fesm2022/ngwr-animations-spotlight.mjs.map +1 -1
- package/fesm2022/ngwr-animations-thread-lines.mjs +16 -16
- package/fesm2022/ngwr-animations-thread-lines.mjs.map +1 -1
- package/fesm2022/ngwr-animations-tilt.mjs +3 -3
- package/fesm2022/ngwr-animations-tilt.mjs.map +1 -1
- package/fesm2022/ngwr-animations-typewriter.mjs +4 -4
- package/fesm2022/ngwr-animations-typewriter.mjs.map +1 -1
- package/fesm2022/ngwr-avatar.mjs +14 -10
- package/fesm2022/ngwr-avatar.mjs.map +1 -1
- package/fesm2022/ngwr-back-top.mjs +10 -6
- package/fesm2022/ngwr-back-top.mjs.map +1 -1
- package/fesm2022/ngwr-badge.mjs +18 -6
- package/fesm2022/ngwr-badge.mjs.map +1 -1
- package/fesm2022/ngwr-burger.mjs +9 -6
- package/fesm2022/ngwr-burger.mjs.map +1 -1
- package/fesm2022/ngwr-button.mjs +8 -4
- package/fesm2022/ngwr-button.mjs.map +1 -1
- package/fesm2022/ngwr-calendar.mjs +19 -8
- package/fesm2022/ngwr-calendar.mjs.map +1 -1
- package/fesm2022/ngwr-card.mjs +9 -5
- package/fesm2022/ngwr-card.mjs.map +1 -1
- package/fesm2022/ngwr-cascader.mjs +54 -25
- package/fesm2022/ngwr-cascader.mjs.map +1 -1
- package/fesm2022/ngwr-charts-bar-chart.mjs +13 -13
- package/fesm2022/ngwr-charts-bar-chart.mjs.map +1 -1
- package/fesm2022/ngwr-charts-boxplot-chart.mjs +9 -9
- package/fesm2022/ngwr-charts-boxplot-chart.mjs.map +1 -1
- package/fesm2022/ngwr-charts-bullet-chart.mjs +8 -8
- package/fesm2022/ngwr-charts-bullet-chart.mjs.map +1 -1
- package/fesm2022/ngwr-charts-calendar-heatmap.mjs +5 -2
- package/fesm2022/ngwr-charts-calendar-heatmap.mjs.map +1 -1
- package/fesm2022/ngwr-charts-candlestick-chart.mjs +11 -11
- package/fesm2022/ngwr-charts-candlestick-chart.mjs.map +1 -1
- package/fesm2022/ngwr-charts-chart-legend.mjs +2 -2
- package/fesm2022/ngwr-charts-chart-legend.mjs.map +1 -1
- package/fesm2022/ngwr-charts-core.mjs +20 -20
- package/fesm2022/ngwr-charts-core.mjs.map +1 -1
- package/fesm2022/ngwr-charts-donut-chart.mjs +2 -2
- package/fesm2022/ngwr-charts-donut-chart.mjs.map +1 -1
- package/fesm2022/ngwr-charts-funnel-chart.mjs +6 -6
- package/fesm2022/ngwr-charts-funnel-chart.mjs.map +1 -1
- package/fesm2022/ngwr-charts-gauge.mjs +3 -3
- package/fesm2022/ngwr-charts-gauge.mjs.map +1 -1
- package/fesm2022/ngwr-charts-heatmap-chart.mjs +3 -3
- package/fesm2022/ngwr-charts-heatmap-chart.mjs.map +1 -1
- package/fesm2022/ngwr-charts-line-chart.mjs +10 -10
- package/fesm2022/ngwr-charts-line-chart.mjs.map +1 -1
- package/fesm2022/ngwr-charts-meter-group.mjs +2 -2
- package/fesm2022/ngwr-charts-meter-group.mjs.map +1 -1
- package/fesm2022/ngwr-charts-radar-chart.mjs +11 -11
- package/fesm2022/ngwr-charts-radar-chart.mjs.map +1 -1
- package/fesm2022/ngwr-charts-scatter-chart.mjs +10 -10
- package/fesm2022/ngwr-charts-scatter-chart.mjs.map +1 -1
- package/fesm2022/ngwr-charts-treemap-chart.mjs +4 -4
- package/fesm2022/ngwr-charts-treemap-chart.mjs.map +1 -1
- package/fesm2022/ngwr-charts-waterfall-chart.mjs +7 -7
- package/fesm2022/ngwr-charts-waterfall-chart.mjs.map +1 -1
- package/fesm2022/ngwr-checkbox.mjs +12 -8
- package/fesm2022/ngwr-checkbox.mjs.map +1 -1
- package/fesm2022/ngwr-clipboard.mjs +2 -1
- package/fesm2022/ngwr-clipboard.mjs.map +1 -1
- package/fesm2022/ngwr-collapse.mjs +11 -7
- package/fesm2022/ngwr-collapse.mjs.map +1 -1
- package/fesm2022/ngwr-color-picker.mjs +56 -54
- package/fesm2022/ngwr-color-picker.mjs.map +1 -1
- package/fesm2022/ngwr-command-palette.mjs +4 -4
- package/fesm2022/ngwr-command-palette.mjs.map +1 -1
- package/fesm2022/ngwr-comment.mjs +15 -9
- package/fesm2022/ngwr-comment.mjs.map +1 -1
- package/fesm2022/ngwr-compare.mjs +15 -9
- package/fesm2022/ngwr-compare.mjs.map +1 -1
- package/fesm2022/ngwr-context-menu.mjs +8 -6
- package/fesm2022/ngwr-context-menu.mjs.map +1 -1
- package/fesm2022/ngwr-copy-value-testing.mjs +58 -0
- package/fesm2022/ngwr-copy-value-testing.mjs.map +1 -0
- package/fesm2022/ngwr-copy-value.mjs +201 -0
- package/fesm2022/ngwr-copy-value.mjs.map +1 -0
- package/fesm2022/ngwr-counter.mjs +3 -3
- package/fesm2022/ngwr-counter.mjs.map +1 -1
- package/fesm2022/ngwr-date-picker-testing.mjs.map +1 -1
- package/fesm2022/ngwr-date-picker.mjs +303 -70
- package/fesm2022/ngwr-date-picker.mjs.map +1 -1
- package/fesm2022/ngwr-date-stamp-testing.mjs +34 -0
- package/fesm2022/ngwr-date-stamp-testing.mjs.map +1 -0
- package/fesm2022/ngwr-date-stamp.mjs +149 -0
- package/fesm2022/ngwr-date-stamp.mjs.map +1 -0
- package/fesm2022/ngwr-date.mjs +304 -53
- package/fesm2022/ngwr-date.mjs.map +1 -1
- package/fesm2022/ngwr-descriptions.mjs +9 -5
- package/fesm2022/ngwr-descriptions.mjs.map +1 -1
- package/fesm2022/ngwr-dialog-testing.mjs +23 -2
- package/fesm2022/ngwr-dialog-testing.mjs.map +1 -1
- package/fesm2022/ngwr-dialog.mjs +77 -19
- package/fesm2022/ngwr-dialog.mjs.map +1 -1
- package/fesm2022/ngwr-directives.mjs +218 -12
- package/fesm2022/ngwr-directives.mjs.map +1 -1
- package/fesm2022/ngwr-divider.mjs +4 -2
- package/fesm2022/ngwr-divider.mjs.map +1 -1
- package/fesm2022/ngwr-drawer.mjs +32 -6
- package/fesm2022/ngwr-drawer.mjs.map +1 -1
- package/fesm2022/ngwr-dropdown.mjs +17 -14
- package/fesm2022/ngwr-dropdown.mjs.map +1 -1
- package/fesm2022/ngwr-editor.mjs +33 -30
- package/fesm2022/ngwr-editor.mjs.map +1 -1
- package/fesm2022/ngwr-event-calendar.mjs +9 -7
- package/fesm2022/ngwr-event-calendar.mjs.map +1 -1
- package/fesm2022/ngwr-file-upload.mjs +17 -11
- package/fesm2022/ngwr-file-upload.mjs.map +1 -1
- package/fesm2022/ngwr-form.mjs +18 -6
- package/fesm2022/ngwr-form.mjs.map +1 -1
- package/fesm2022/ngwr-graph.mjs +3 -3
- package/fesm2022/ngwr-graph.mjs.map +1 -1
- package/fesm2022/ngwr-hotkey.mjs +22 -22
- package/fesm2022/ngwr-hotkey.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-ar.mjs +7 -0
- package/fesm2022/ngwr-i18n-ar.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-cs.mjs +7 -0
- package/fesm2022/ngwr-i18n-cs.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-de.mjs +7 -0
- package/fesm2022/ngwr-i18n-de.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-en.mjs +7 -0
- package/fesm2022/ngwr-i18n-en.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-es.mjs +7 -0
- package/fesm2022/ngwr-i18n-es.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-fr.mjs +7 -0
- package/fesm2022/ngwr-i18n-fr.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-he.mjs +7 -0
- package/fesm2022/ngwr-i18n-he.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-hi.mjs +7 -0
- package/fesm2022/ngwr-i18n-hi.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-id.mjs +7 -0
- package/fesm2022/ngwr-i18n-id.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-it.mjs +7 -0
- package/fesm2022/ngwr-i18n-it.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-ja.mjs +7 -0
- package/fesm2022/ngwr-i18n-ja.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-ko.mjs +7 -0
- package/fesm2022/ngwr-i18n-ko.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-nl.mjs +7 -0
- package/fesm2022/ngwr-i18n-nl.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-pl.mjs +7 -0
- package/fesm2022/ngwr-i18n-pl.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-pt.mjs +7 -0
- package/fesm2022/ngwr-i18n-pt.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-ru.mjs +7 -0
- package/fesm2022/ngwr-i18n-ru.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-sv.mjs +7 -0
- package/fesm2022/ngwr-i18n-sv.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-tr.mjs +7 -0
- package/fesm2022/ngwr-i18n-tr.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-uk.mjs +7 -0
- package/fesm2022/ngwr-i18n-uk.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-vi.mjs +7 -0
- package/fesm2022/ngwr-i18n-vi.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-zh-tw.mjs +7 -0
- package/fesm2022/ngwr-i18n-zh-tw.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-zh.mjs +7 -0
- package/fesm2022/ngwr-i18n-zh.mjs.map +1 -1
- package/fesm2022/ngwr-i18n.mjs +36 -10
- package/fesm2022/ngwr-i18n.mjs.map +1 -1
- package/fesm2022/ngwr-icon.mjs +5 -5
- package/fesm2022/ngwr-icon.mjs.map +1 -1
- package/fesm2022/ngwr-image-cropper.mjs +11 -11
- package/fesm2022/ngwr-image-cropper.mjs.map +1 -1
- package/fesm2022/ngwr-input-number.mjs +13 -7
- package/fesm2022/ngwr-input-number.mjs.map +1 -1
- package/fesm2022/ngwr-input-otp.mjs +6 -4
- package/fesm2022/ngwr-input-otp.mjs.map +1 -1
- package/fesm2022/ngwr-input.mjs +35 -25
- package/fesm2022/ngwr-input.mjs.map +1 -1
- package/fesm2022/ngwr-keyboard.mjs +37 -31
- package/fesm2022/ngwr-keyboard.mjs.map +1 -1
- package/fesm2022/ngwr-knob.mjs +13 -7
- package/fesm2022/ngwr-knob.mjs.map +1 -1
- package/fesm2022/ngwr-layout.mjs +13 -5
- package/fesm2022/ngwr-layout.mjs.map +1 -1
- package/fesm2022/ngwr-lightbox.mjs +11 -7
- package/fesm2022/ngwr-lightbox.mjs.map +1 -1
- package/fesm2022/ngwr-list.mjs +13 -5
- package/fesm2022/ngwr-list.mjs.map +1 -1
- package/fesm2022/ngwr-load-state.mjs +11 -7
- package/fesm2022/ngwr-load-state.mjs.map +1 -1
- package/fesm2022/ngwr-mention.mjs +6 -6
- package/fesm2022/ngwr-mention.mjs.map +1 -1
- package/fesm2022/ngwr-meta.mjs +19 -3
- package/fesm2022/ngwr-meta.mjs.map +1 -1
- package/fesm2022/ngwr-overlay.mjs +87 -4
- package/fesm2022/ngwr-overlay.mjs.map +1 -1
- package/fesm2022/ngwr-pagination.mjs +10 -7
- package/fesm2022/ngwr-pagination.mjs.map +1 -1
- package/fesm2022/ngwr-pipes.mjs +22 -8
- package/fesm2022/ngwr-pipes.mjs.map +1 -1
- package/fesm2022/ngwr-platform.mjs +4 -1
- package/fesm2022/ngwr-platform.mjs.map +1 -1
- package/fesm2022/ngwr-popconfirm.mjs +6 -5
- package/fesm2022/ngwr-popconfirm.mjs.map +1 -1
- package/fesm2022/ngwr-popover.mjs +124 -34
- package/fesm2022/ngwr-popover.mjs.map +1 -1
- package/fesm2022/ngwr-progress.mjs +4 -2
- package/fesm2022/ngwr-progress.mjs.map +1 -1
- package/fesm2022/ngwr-pull-to-refresh.mjs +2 -2
- package/fesm2022/ngwr-pull-to-refresh.mjs.map +1 -1
- package/fesm2022/ngwr-qr.mjs +6 -6
- package/fesm2022/ngwr-qr.mjs.map +1 -1
- package/fesm2022/ngwr-radio.mjs +12 -8
- package/fesm2022/ngwr-radio.mjs.map +1 -1
- package/fesm2022/ngwr-rating.mjs +19 -13
- package/fesm2022/ngwr-rating.mjs.map +1 -1
- package/fesm2022/ngwr-resizable.mjs +503 -0
- package/fesm2022/ngwr-resizable.mjs.map +1 -0
- package/fesm2022/ngwr-result.mjs +9 -5
- package/fesm2022/ngwr-result.mjs.map +1 -1
- package/fesm2022/ngwr-schema-form.mjs +15 -5
- package/fesm2022/ngwr-schema-form.mjs.map +1 -1
- package/fesm2022/ngwr-segmented.mjs +4 -2
- package/fesm2022/ngwr-segmented.mjs.map +1 -1
- package/fesm2022/ngwr-select.mjs +70 -39
- package/fesm2022/ngwr-select.mjs.map +1 -1
- package/fesm2022/ngwr-sidebar.mjs +3 -3
- package/fesm2022/ngwr-sidebar.mjs.map +1 -1
- package/fesm2022/ngwr-skeleton.mjs +6 -4
- package/fesm2022/ngwr-skeleton.mjs.map +1 -1
- package/fesm2022/ngwr-slider-testing.mjs.map +1 -1
- package/fesm2022/ngwr-slider.mjs +17 -15
- package/fesm2022/ngwr-slider.mjs.map +1 -1
- package/fesm2022/ngwr-sortable-list.mjs +3 -3
- package/fesm2022/ngwr-sortable-list.mjs.map +1 -1
- package/fesm2022/ngwr-speed-dial.mjs +4 -2
- package/fesm2022/ngwr-speed-dial.mjs.map +1 -1
- package/fesm2022/ngwr-spinner.mjs +4 -2
- package/fesm2022/ngwr-spinner.mjs.map +1 -1
- package/fesm2022/ngwr-splitter.mjs +21 -25
- package/fesm2022/ngwr-splitter.mjs.map +1 -1
- package/fesm2022/ngwr-statistic.mjs +5 -3
- package/fesm2022/ngwr-statistic.mjs.map +1 -1
- package/fesm2022/ngwr-stepper.mjs +9 -3
- package/fesm2022/ngwr-stepper.mjs.map +1 -1
- package/fesm2022/ngwr-storage.mjs +6 -4
- package/fesm2022/ngwr-storage.mjs.map +1 -1
- package/fesm2022/ngwr-switch.mjs +11 -7
- package/fesm2022/ngwr-switch.mjs.map +1 -1
- package/fesm2022/ngwr-table-testing.mjs +5 -1
- package/fesm2022/ngwr-table-testing.mjs.map +1 -1
- package/fesm2022/ngwr-table.mjs +396 -35
- package/fesm2022/ngwr-table.mjs.map +1 -1
- package/fesm2022/ngwr-tabs.mjs +2 -2
- package/fesm2022/ngwr-tabs.mjs.map +1 -1
- package/fesm2022/ngwr-textarea.mjs +9 -3
- package/fesm2022/ngwr-textarea.mjs.map +1 -1
- package/fesm2022/ngwr-timeline.mjs +18 -8
- package/fesm2022/ngwr-timeline.mjs.map +1 -1
- package/fesm2022/ngwr-toast-testing.mjs +14 -2
- package/fesm2022/ngwr-toast-testing.mjs.map +1 -1
- package/fesm2022/ngwr-toast.mjs +588 -120
- package/fesm2022/ngwr-toast.mjs.map +1 -1
- package/fesm2022/ngwr-tour.mjs +7 -7
- package/fesm2022/ngwr-tour.mjs.map +1 -1
- package/fesm2022/ngwr-transfer.mjs +24 -11
- package/fesm2022/ngwr-transfer.mjs.map +1 -1
- package/fesm2022/ngwr-tree.mjs +68 -26
- package/fesm2022/ngwr-tree.mjs.map +1 -1
- package/fesm2022/ngwr-typography.mjs +9 -3
- package/fesm2022/ngwr-typography.mjs.map +1 -1
- package/fesm2022/ngwr-utils-router.mjs +18 -2
- package/fesm2022/ngwr-utils-router.mjs.map +1 -1
- package/fesm2022/ngwr-utils.mjs +106 -56
- package/fesm2022/ngwr-utils.mjs.map +1 -1
- package/fesm2022/ngwr-validators.mjs +2 -2
- package/fesm2022/ngwr-validators.mjs.map +1 -1
- package/fesm2022/ngwr-version.mjs +1 -1
- package/fesm2022/ngwr-version.mjs.map +1 -1
- package/fesm2022/ngwr-window.mjs +33 -30
- package/fesm2022/ngwr-window.mjs.map +1 -1
- package/fesm2022/ngwr.mjs.map +1 -1
- package/i18n/ar.json +11 -0
- package/i18n/cs.json +11 -0
- package/i18n/de.json +11 -0
- package/i18n/en.json +11 -0
- package/i18n/es.json +11 -0
- package/i18n/fr.json +11 -0
- package/i18n/he.json +11 -0
- package/i18n/hi.json +11 -0
- package/i18n/id.json +11 -0
- package/i18n/it.json +11 -0
- package/i18n/ja.json +11 -0
- package/i18n/ko.json +11 -0
- package/i18n/nl.json +11 -0
- package/i18n/pl.json +11 -0
- package/i18n/pt.json +11 -0
- package/i18n/ru.json +11 -0
- package/i18n/sv.json +11 -0
- package/i18n/tr.json +11 -0
- package/i18n/uk.json +11 -0
- package/i18n/vi.json +11 -0
- package/i18n/zh-TW.json +11 -0
- package/i18n/zh.json +11 -0
- package/input/styles/_index.scss +10 -5
- package/input-number/styles/_index.scss +12 -3
- package/input-otp/styles/_index.scss +4 -2
- package/llms-full.txt +54 -23
- package/llms.txt +45 -23
- package/mcp/providers.js +1 -1
- package/package.json +29 -10
- package/radio/styles/_index.scss +4 -2
- package/resizable/styles/_index.scss +154 -0
- package/schematics/icon-set/index.js +3 -3
- package/schematics/migrations/v16/index.js +742 -0
- package/schematics/migrations.json +5 -0
- package/schematics/ng-add/index.js +4 -4
- package/schematics/provider/index.js +4 -4
- package/schematics/use/rule.js +1 -0
- package/schematics/use/symbol-map.json +6 -0
- package/select/styles/_index.scss +7 -4
- package/skills/ngwr/SKILL.md +6 -4
- package/skills/ngwr/references/catalog.md +8 -3
- package/skills/ngwr/references/setup.md +13 -9
- package/switch/styles/_index.scss +4 -2
- package/table/styles/_index.scss +138 -29
- package/textarea/styles/_index.scss +4 -2
- package/theme/styles/_motion.scss +6 -0
- package/toast/styles/_index.scss +49 -0
- package/tree/styles/_index.scss +17 -0
- package/types/index-CXbgza47.d.ts +13 -0
- package/types/ngwr-animations-aurora.d.ts +1 -1
- package/types/ngwr-animations-blur-reveal.d.ts +2 -2
- package/types/ngwr-animations-dot-grid.d.ts +1 -2
- package/types/ngwr-animations-flow-lines.d.ts +1 -1
- package/types/ngwr-animations-fluid-cursor.d.ts +1 -1
- package/types/ngwr-animations-reveal.d.ts +4 -8
- package/types/ngwr-animations-ripple-grid.d.ts +1 -1
- package/types/ngwr-animations-spotlight.d.ts +1 -1
- package/types/ngwr-animations-thread-lines.d.ts +1 -1
- package/types/ngwr-animations-tilt.d.ts +1 -1
- package/types/ngwr-avatar.d.ts +2 -2
- package/types/ngwr-badge.d.ts +1 -1
- package/types/ngwr-burger.d.ts +0 -1
- package/types/ngwr-calendar.d.ts +7 -0
- package/types/ngwr-cascader.d.ts +12 -1
- package/types/ngwr-charts-boxplot-chart.d.ts +1 -1
- package/types/ngwr-charts-bullet-chart.d.ts +2 -2
- package/types/ngwr-charts-calendar-heatmap.d.ts +2 -1
- package/types/ngwr-charts-candlestick-chart.d.ts +1 -1
- package/types/ngwr-charts-core.d.ts +12 -12
- package/types/ngwr-charts-line-chart.d.ts +2 -2
- package/types/ngwr-charts-radar-chart.d.ts +1 -1
- package/types/ngwr-charts-scatter-chart.d.ts +2 -2
- package/types/ngwr-charts-waterfall-chart.d.ts +1 -1
- package/types/ngwr-clipboard.d.ts +7 -0
- package/types/ngwr-color-picker.d.ts +12 -12
- package/types/ngwr-copy-value-testing.d.ts +87 -0
- package/types/ngwr-copy-value.d.ts +95 -0
- package/types/ngwr-date-picker-testing.d.ts +3 -3
- package/types/ngwr-date-picker.d.ts +106 -3
- package/types/ngwr-date-stamp-testing.d.ts +47 -0
- package/types/ngwr-date-stamp.d.ts +81 -0
- package/types/ngwr-date.d.ts +179 -27
- package/types/ngwr-dialog-testing.d.ts +10 -0
- package/types/ngwr-dialog.d.ts +120 -5
- package/types/ngwr-directives.d.ts +76 -1
- package/types/ngwr-drawer.d.ts +22 -1
- package/types/ngwr-dropdown.d.ts +3 -2
- package/types/ngwr-hotkey.d.ts +5 -5
- package/types/ngwr-i18n.d.ts +47 -17
- package/types/ngwr-icon.d.ts +26 -26
- package/types/ngwr-input-number.d.ts +2 -2
- package/types/ngwr-input.d.ts +8 -8
- package/types/ngwr-load-state.d.ts +6 -6
- package/types/ngwr-meta.d.ts +18 -0
- package/types/ngwr-overlay.d.ts +36 -0
- package/types/ngwr-pipes.d.ts +21 -4
- package/types/ngwr-platform.d.ts +2 -1
- package/types/ngwr-popconfirm.d.ts +3 -2
- package/types/ngwr-popover.d.ts +43 -4
- package/types/ngwr-resizable.d.ts +228 -0
- package/types/ngwr-select.d.ts +33 -18
- package/types/ngwr-slider-testing.d.ts +2 -2
- package/types/ngwr-slider.d.ts +3 -3
- package/types/ngwr-statistic.d.ts +5 -1
- package/types/ngwr-storage.d.ts +1 -1
- package/types/ngwr-table-testing.d.ts +5 -2
- package/types/ngwr-table.d.ts +255 -14
- package/types/ngwr-tabs.d.ts +10 -2
- package/types/ngwr-toast-testing.d.ts +18 -3
- package/types/ngwr-toast.d.ts +248 -23
- package/types/ngwr-transfer.d.ts +5 -0
- package/types/ngwr-tree.d.ts +22 -2
- package/types/ngwr-utils-router.d.ts +22 -0
- package/types/ngwr-utils.d.ts +165 -83
- package/types/ngwr-validators.d.ts +4 -2
- package/types/ngwr-version.d.ts +1 -1
- package/types/ngwr.d.ts +2 -0
- package/types/pointer-tracker-D7fXxLQL.d.ts +24 -0
- package/fesm2022/ngwr-animations-core.mjs.map +0 -1
- package/types/ngwr-animations-core.d.ts +0 -294
|
@@ -3,7 +3,7 @@ import { Component, DestroyRef, ElementRef, ViewEncapsulation, afterNextRender,
|
|
|
3
3
|
import { coerceBooleanProperty } from "@angular/cdk/coercion";
|
|
4
4
|
import { NgTemplateOutlet } from "@angular/common";
|
|
5
5
|
import { wrCheckStyles } from "ngwr/utils";
|
|
6
|
-
import {
|
|
6
|
+
import { useI18nFormatter, useI18nText, wrReadI18nText } from "ngwr/i18n";
|
|
7
7
|
import { WrIcon } from "ngwr/icon";
|
|
8
8
|
import { ActivatedRoute, NavigationEnd, Router, RouterLink, containsTree } from "@angular/router";
|
|
9
9
|
import { toSignal } from "@angular/core/rxjs-interop";
|
|
@@ -67,9 +67,9 @@ var WrSidebar = class WrSidebar {
|
|
|
67
67
|
...ngDevMode ? { debugName: "autoCollapse" } : /* istanbul ignore next */ {},
|
|
68
68
|
transform: coerceBooleanProperty
|
|
69
69
|
});
|
|
70
|
-
containsCurrentLabel =
|
|
70
|
+
containsCurrentLabel = wrReadI18nText("sidebar.containsCurrent", "contains the current page");
|
|
71
71
|
subpagesLabel = useI18nFormatter("sidebar.subpages", "Sub-pages of {{title}}");
|
|
72
|
-
separator =
|
|
72
|
+
separator = wrReadI18nText("sidebar.separator", ",");
|
|
73
73
|
opened = signal(/* @__PURE__ */ new Set(), ...ngDevMode ? [{ debugName: "opened" }] : /* istanbul ignore next */ []);
|
|
74
74
|
seeded = /* @__PURE__ */ new Set();
|
|
75
75
|
uid = ++sidebarUid;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ngwr-sidebar.mjs","names":[],"sources":["../../../projects/lib/sidebar/sidebar.ts","../../../projects/lib/sidebar/sidebar.html"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { coerceBooleanProperty } from '@angular/cdk/coercion';\nimport { NgTemplateOutlet } from '@angular/common';\nimport {\n Component,\n DestroyRef,\n ElementRef,\n ViewEncapsulation,\n afterNextRender,\n afterRenderEffect,\n computed,\n effect,\n inject,\n input,\n isDevMode,\n signal,\n untracked,\n} from '@angular/core';\nimport { toSignal } from '@angular/core/rxjs-interop';\nimport {\n ActivatedRoute,\n type IsActiveMatchOptions,\n NavigationEnd,\n Router,\n RouterLink,\n containsTree,\n} from '@angular/router';\n\nimport { filter, map, startWith } from 'rxjs';\n\nimport { readI18nText, useI18nFormatter, useI18nText } from 'ngwr/i18n';\nimport { WrIcon } from 'ngwr/icon';\nimport { wrCheckStyles } from 'ngwr/utils';\n\nimport type { WrSidebarActiveOptions, WrSidebarBadgeTone, WrSidebarEntry, WrSidebarGroup } from './types';\n\nfunction isGroup(entry: WrSidebarEntry): entry is WrSidebarGroup {\n return 'children' in entry;\n}\n\n/** How deep the design goes. Deeper entries still render, with a dev-mode warning. */\nconst MAX_LEVEL = 3;\n\n/**\n * Joins the titles on a path into the key the open state is stored under. A path\n * rather than a title, so two groups called \"Overview\" in different sections stop\n * opening and closing together; a control character, so no title can forge it.\n */\nconst KEY_SEPARATOR = '\\u001f';\n\n/** `{ exact: true }`, spelled the way `RouterLinkActive` spells it. */\nconst EXACT_MATCH: IsActiveMatchOptions = {\n paths: 'exact',\n queryParams: 'exact',\n matrixParams: 'ignored',\n fragment: 'ignored',\n};\n\n/** `{ exact: false }`, the router's default and this component's. */\nconst SUBSET_MATCH: IsActiveMatchOptions = {\n paths: 'subset',\n queryParams: 'subset',\n matrixParams: 'ignored',\n fragment: 'ignored',\n};\n\n/**\n * A group's own link: the exact path, since the children own the paths below it.\n * A prefix match would mark the group AND its current child as the current page.\n */\nconst GROUP_MATCH: Partial<IsActiveMatchOptions> = { paths: 'exact', queryParams: 'subset' };\n\nfunction matchOptions(options: WrSidebarActiveOptions | undefined): Partial<IsActiveMatchOptions> {\n if (!options) return SUBSET_MATCH;\n if ('exact' in options) return options.exact ? EXACT_MATCH : SUBSET_MATCH;\n return options;\n}\n\n/** A string that says something, or `null`: an empty title part draws nothing. */\nfunction filled(value: string | null | undefined): string | null {\n return value === '' ? null : (value ?? null);\n}\n\n/** The commands an entry links to, or `null` when it renders as text or as a plain toggle. */\nfunction linkOf(entry: WrSidebarEntry): readonly (string | number)[] | null {\n if (isGroup(entry)) return entry.url?.length ? entry.url : null;\n return !entry.disabled && entry.url.length ? entry.url : null;\n}\n\n/**\n * Instance counter for the row ids. Deterministic under prerender, unlike\n * `randomId()`, and unique across sidebars: a title-only id collided between two\n * sidebars on one page, and `aria-controls` then pointed at the wrong body.\n */\nlet sidebarUid = 0;\n\n/**\n * Whether `url` is `route` or something below it. A bare `startsWith` matched a\n * SIBLING whose path merely began the same way, so visiting `/table` expanded the\n * group that owns `/tabs`.\n */\nfunction matchesRoute(url: string, route: string): boolean {\n if (!url.startsWith(route)) return false;\n const rest = url.slice(route.length);\n return rest === '' || rest.startsWith('/') || rest.startsWith('?') || rest.startsWith('#');\n}\n\n/** One rendered row, with everything the template needs already decided. */\ninterface SidebarNode {\n /** The title path: what the open state and `track` key on. */\n readonly key: string;\n /** The group body's id, for `aria-controls`. Unique per sidebar and per position. */\n readonly listId: string;\n /** The subtitle's id, for `aria-describedby`, or `null` with no subtitle. */\n readonly subtitleId: string | null;\n readonly title: string;\n readonly subtitle: string | null;\n readonly icon: string | null;\n readonly badge: { readonly text: string; readonly tone: WrSidebarBadgeTone } | null;\n readonly count: string | null;\n readonly countLabel: string | null;\n /** The hidden separator after the title, the badge and the count, when another piece follows. */\n readonly titleTail: string;\n readonly badgeTail: string;\n readonly countTail: string;\n /** Where the row links to. `null` is plain text for a page, a whole-row toggle for a group. */\n readonly url: readonly (string | number)[] | null;\n readonly children: readonly SidebarNode[] | null;\n readonly open: boolean;\n readonly active: boolean;\n /** A collapsed, visible group with the current page somewhere below it. */\n readonly holdsActive: boolean;\n readonly rowClass: string;\n}\n\n/**\n * Navigation drawn from data: pages, and groups of pages that open and close,\n * three levels deep. Every row can carry a subtitle, a word badge and a count.\n *\n * Each title and subtitle takes one line and ends in an ellipsis when it does\n * not fit; the full text stays the accessible name and becomes a tooltip on the\n * part that was cut, measured after render in the browser. A group is a\n * `<button aria-expanded>` that opens its children, or, when it carries a `url`\n * of its own, a link with a separate arrow button beside it. The current page\n * gets `aria-current=\"page\"`, and a collapsed group holding it shows a dot and\n * says so (`sidebar.containsCurrent`).\n *\n * Rows are 32px. Under a coarse pointer (a phone, a tablet) they grow to 44px,\n * and the split arrow to 44 by 44, with no input: the size follows the pointer\n * rather than the container, so the same sidebar in a drawer on a laptop keeps\n * its 32px rows. To force either size, set `--wr-sidebar-row-height`,\n * `--wr-sidebar-row-padding-y` and `--wr-sidebar-chevron-size` on `.wr-sidebar`.\n *\n * The host pads its rows by `--wr-sidebar-padding` (`0.5rem`), so a hovered or\n * current row's tint stays off the edge of whatever holds the nav. Where the\n * container already supplies the inset, set the hook to `0` on `.wr-sidebar`,\n * not on the container: the host declares its own default, which shadows an\n * inherited one.\n *\n * @example\n * ```html\n * <wr-sidebar [entries]=\"[\n * { title: 'Dashboard', url: ['/dashboard'] },\n * {\n * title: 'Settings',\n * count: 2,\n * countLabel: '2 pages',\n * children: [\n * { title: 'Profile', url: ['/settings', 'profile'] },\n * { title: 'Billing', url: ['/settings', 'billing'], badge: { text: 'New', tone: 'primary' } }\n * ]\n * }\n * ]\" />\n * ```\n *\n * @see https://ngwr.dev/reference/components/sidebar\n */\n@Component({\n selector: 'wr-sidebar',\n templateUrl: './sidebar.html',\n encapsulation: ViewEncapsulation.None,\n host: { class: 'wr-sidebar', role: 'navigation', '[attr.aria-label]': 'resolvedAriaLabel()' },\n imports: [NgTemplateOutlet, RouterLink, WrIcon],\n})\nexport class WrSidebar {\n /**\n * The navigation tree. An entry with `children` is a group, which opens on\n * click and on its own when the current route is below it.\n */\n readonly entries = input<readonly WrSidebarEntry[]>([]);\n\n /**\n * Accessible name for the navigation landmark. Falls back to `sidebar.label`,\n * then `'Sidebar'`: a page with a sidebar AND a table of contents has two\n * navigation landmarks, and an unnamed one is announced as just \"navigation\".\n */\n readonly ariaLabel = input<string | null>(null);\n\n protected readonly resolvedAriaLabel = useI18nText(this.ariaLabel, 'sidebar.label', 'Sidebar');\n\n /** Icon for a group that names none. `null` draws no icon. @default null */\n readonly defaultGroupIcon = input<string | null>(null);\n\n /** Icon for a page that names none. `null` draws no icon. @default null */\n readonly defaultItemIcon = input<string | null>(null);\n\n /**\n * Open every group above the current route, once per navigation: a group the\n * user closes stays closed until the route changes. @default true\n */\n readonly autoExpand = input(true, { transform: coerceBooleanProperty });\n\n /**\n * Close the groups the previous navigation opened when the next one leaves\n * them, so a long nav does not keep every visited section expanded. A group\n * the user opened or closed by hand is never closed for them. Needs\n * `autoExpand`. @default false\n */\n readonly autoCollapse = input(false, { transform: coerceBooleanProperty });\n\n /** Spoken after a collapsed group that holds the current page. */\n protected readonly containsCurrentLabel = readI18nText('sidebar.containsCurrent', 'contains the current page');\n\n /** The split arrow's name: the group's title is the link beside it. */\n protected readonly subpagesLabel = useI18nFormatter('sidebar.subpages', 'Sub-pages of {{title}}');\n\n /** Joins a row's title, badge and count into one name: `،` in Arabic, `、` in Japanese. */\n protected readonly separator = readI18nText('sidebar.separator', ',');\n\n private readonly opened = signal<ReadonlySet<string>>(new Set());\n\n /** Group keys already seeded from `defaultOpen`, so it seeds once and not again. */\n private readonly seeded = new Set<string>();\n\n private readonly uid = ++sidebarUid;\n\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\n private readonly router = inject(Router);\n private readonly route = inject(ActivatedRoute, { optional: true });\n private readonly currentUrl = toSignal(\n this.router.events.pipe(\n filter((e): e is NavigationEnd => e instanceof NavigationEnd),\n map(e => e.urlAfterRedirects),\n startWith(this.router.url)\n ),\n { initialValue: this.router.url }\n );\n\n /**\n * The keys of the entries that are the current page, matched the way\n * `RouterLinkActive` matches: an entry's `activeOptions`, a prefix by default.\n * One computation drives `aria-current`, the bar, the ancestors and the dot,\n * so the four cannot disagree.\n */\n private readonly activeKeys = computed<ReadonlySet<string>>(() => {\n const current = this.router.parseUrl(this.currentUrl());\n const out = new Set<string>();\n const visit = (entries: readonly WrSidebarEntry[], parent: string): void => {\n for (const entry of entries) {\n const key = parent ? `${parent}${KEY_SEPARATOR}${entry.title}` : entry.title;\n const url = linkOf(entry);\n if (url) {\n const tree = this.router.createUrlTree([...url], { relativeTo: this.route });\n const options = isGroup(entry) ? GROUP_MATCH : matchOptions(entry.activeOptions);\n if (containsTree(current, tree, options)) out.add(key);\n }\n if (isGroup(entry)) visit(entry.children, key);\n }\n };\n visit(this.entries(), '');\n return out;\n });\n\n /** The tree as the template draws it. */\n protected readonly nodes = computed<readonly SidebarNode[]>(() => {\n const opened = this.opened();\n const active = this.activeKeys();\n const groupIcon = this.defaultGroupIcon();\n const itemIcon = this.defaultItemIcon();\n const sep = this.separator();\n\n const build = (\n entries: readonly WrSidebarEntry[],\n level: number,\n parentKey: string,\n parentId: string,\n visible: boolean\n ): { nodes: readonly SidebarNode[]; holds: boolean } => {\n let holds = false;\n const nodes = entries.map((entry, index) => {\n const key = parentKey ? `${parentKey}${KEY_SEPARATOR}${entry.title}` : entry.title;\n const id = `${parentId}-${index}`;\n const group = isGroup(entry);\n const open = group && opened.has(key);\n const sub = group ? build(entry.children, level + 1, key, id, visible && open) : null;\n const isActive = active.has(key);\n const below = sub?.holds ?? false;\n holds ||= isActive || below;\n\n const holdsActive = group && !open && below && visible;\n const ancestor = group && open && below;\n const url = linkOf(entry);\n const classes = ['wr-sidebar__row', `wr-sidebar__row--level-${Math.min(level, MAX_LEVEL)}`];\n if (group) classes.push('wr-sidebar__row--group');\n if (!group && !url) classes.push('wr-sidebar__row--disabled');\n if (isActive) classes.push('wr-sidebar__row--active');\n if (ancestor) classes.push('wr-sidebar__row--ancestor');\n if (holdsActive) classes.push('wr-sidebar__row--holds-active');\n\n const raw = entry.count ?? null;\n const count = raw === null ? null : String(raw);\n const subtitle = filled(entry.subtitle);\n const badge = entry.badge?.text ? { text: entry.badge.text, tone: entry.badge.tone ?? 'neutral' } : null;\n return {\n key,\n listId: `${id}-list`,\n subtitleId: subtitle === null ? null : `${id}-subtitle`,\n title: entry.title,\n subtitle,\n icon: filled(entry.icon) ?? filled(group ? groupIcon : itemIcon),\n badge,\n count,\n countLabel: count === null ? null : filled(entry.countLabel),\n titleTail: badge || count !== null || holdsActive ? sep : '',\n badgeTail: badge && (count !== null || holdsActive) ? sep : '',\n countTail: count !== null && holdsActive ? sep : '',\n url,\n children: sub?.nodes ?? null,\n open,\n active: isActive,\n holdsActive,\n rowClass: classes.join(' '),\n } satisfies SidebarNode;\n });\n return { nodes, holds };\n };\n\n return build(this.entries(), 1, '', `wr-sidebar-${this.uid}`, true).nodes;\n });\n\n /**\n * Last URL resolved to a set of groups, so a group the user collapsed is not\n * re-opened on the same route. A URL no group holds clears it rather than\n * being recorded: see the effect below.\n */\n private lastAutoUrl: string | null = null;\n\n /** Groups the last navigation opened, which `autoCollapse` may close again. */\n private autoOpened = new Set<string>();\n\n private warnedDepth = false;\n\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('sidebar');\n // Seed `defaultOpen` groups, once per group and not once per `entries`\n // emission. Re-seeding meant any later change to the array (a count, a\n // filtered list) re-opened a group the user had deliberately collapsed.\n effect(() => {\n const fresh: string[] = [];\n const visit = (entries: readonly WrSidebarEntry[], parent: string): void => {\n for (const entry of entries) {\n if (!isGroup(entry)) continue;\n const key = parent ? `${parent}${KEY_SEPARATOR}${entry.title}` : entry.title;\n if (entry.defaultOpen && !this.seeded.has(key)) {\n this.seeded.add(key);\n fresh.push(key);\n }\n visit(entry.children, key);\n }\n };\n visit(this.entries(), '');\n if (fresh.length > 0) this.opened.update(prev => new Set([...prev, ...fresh]));\n });\n\n // Open every group above the current URL, and with `autoCollapse` close\n // the ones the previous navigation opened and this one leaves.\n effect(() => {\n if (!this.autoExpand()) return;\n const url = this.currentUrl();\n if (url === this.lastAutoUrl) return;\n const keys = this.groupsAbove(url, this.entries());\n const collapse = this.autoCollapse();\n untracked(() => {\n // Latch AFTER the lookup, never before it. `entries` often arrives from\n // an HTTP call, so the first run matches nothing, and latching first told\n // the re-run that landed with the real nav that this URL was already\n // handled: a deep link stayed collapsed, with the current link out of\n // the tab order. A URL no group holds CLEARS the latch instead, or the\n // way back to a page whose group was closed by hand (Back, an in-page\n // link) found the latch still set and left that group closed.\n this.lastAutoUrl = keys.length === 0 ? null : url;\n\n const opened = this.opened();\n const next = new Set(opened);\n if (collapse) {\n for (const key of this.autoOpened) if (!keys.includes(key)) next.delete(key);\n }\n const fresh = keys.filter(key => !opened.has(key));\n for (const key of fresh) next.add(key);\n this.autoOpened = new Set([...fresh, ...[...this.autoOpened].filter(key => keys.includes(key))]);\n\n if (next.size !== opened.size || [...next].some(key => !opened.has(key))) this.opened.set(next);\n });\n });\n\n if (isDevMode()) {\n effect(() => {\n const depth = this.depthOf(this.entries());\n if (depth <= MAX_LEVEL || this.warnedDepth) return;\n this.warnedDepth = true;\n // eslint-disable-next-line no-console -- dev-mode validation\n console.warn(\n `[NGWR] <wr-sidebar>: an entry sits at level ${depth}. The sidebar is designed for ` +\n `${MAX_LEVEL} levels; deeper rows still render, indented once more per level.`\n );\n });\n }\n\n // A tooltip only where the text is actually cut, and on the cut text itself.\n // A `title` on the row would also become the row's description, so a row\n // named \"Charts, 18 pages\" would read its title a second time.\n afterRenderEffect(() => {\n this.nodes();\n this.markCut();\n });\n\n // The width can change with nothing re-rendering: a drawer opening, a\n // resized window, a web font arriving after first paint.\n const destroyRef = inject(DestroyRef);\n afterNextRender(() => {\n if (typeof ResizeObserver !== 'undefined') {\n const observer = new ResizeObserver(() => this.markCut());\n observer.observe(this.host.nativeElement);\n destroyRef.onDestroy(() => observer.disconnect());\n }\n if ('fonts' in document) void document.fonts.ready.then(() => this.markCut());\n });\n }\n\n protected toggle(key: string): void {\n // Opened or closed by hand, so never closed for the user afterwards.\n this.autoOpened.delete(key);\n this.opened.update(prev => {\n const next = new Set(prev);\n if (next.has(key)) next.delete(key);\n else next.add(key);\n return next;\n });\n }\n\n /** Types the template's recursive context, which `ng-template` leaves as `any`. */\n protected asNodes(value: unknown): readonly SidebarNode[] {\n return value as readonly SidebarNode[];\n }\n\n protected asNode(value: unknown): SidebarNode {\n return value as SidebarNode;\n }\n\n /**\n * A `routerLink` command array as the absolute path it navigates to — resolved\n * against the declaring route, the way `[routerLink]` and `activeKeys` resolve\n * it. Joining the segments by hand read a RELATIVE link (`['settings']`) as\n * `/settings`, so on `/admin/settings` the row lit up as the current page while\n * `autoExpand` left the group above it closed.\n */\n private resolve(link: readonly (string | number)[]): string {\n return this.router.serializeUrl(this.router.createUrlTree([...link], { relativeTo: this.route }));\n }\n\n /** Every group whose subtree links to `url` or above it, by path prefix. */\n private groupsAbove(url: string, entries: readonly WrSidebarEntry[]): string[] {\n const out: string[] = [];\n const visit = (list: readonly WrSidebarEntry[], parent: string): boolean => {\n let hit = false;\n for (const entry of list) {\n const key = parent ? `${parent}${KEY_SEPARATOR}${entry.title}` : entry.title;\n const link = linkOf(entry);\n let self = link !== null && matchesRoute(url, this.resolve(link));\n if (isGroup(entry) && visit(entry.children, key)) {\n out.push(key);\n self = true;\n }\n hit ||= self;\n }\n return hit;\n };\n visit(entries, '');\n return out;\n }\n\n private depthOf(entries: readonly WrSidebarEntry[], level = 1): number {\n let deepest = entries.length > 0 ? level : level - 1;\n for (const entry of entries) {\n if (isGroup(entry)) deepest = Math.max(deepest, this.depthOf(entry.children, level + 1));\n }\n return deepest;\n }\n\n private markCut(): void {\n const cuttable = this.host.nativeElement.querySelectorAll<HTMLElement>('.wr-sidebar__title, .wr-sidebar__subtitle');\n for (const el of cuttable) {\n // A pixel of slack: a fractional width rounds the two reads apart. The\n // tooltip is the element's own text, without the hidden comma inside it.\n if (el.scrollWidth > el.clientWidth + 1) {\n el.title = [...el.childNodes]\n .filter(node => node.nodeType === Node.TEXT_NODE)\n .map(node => node.textContent)\n .join('')\n .trim();\n } else {\n el.removeAttribute('title');\n }\n }\n }\n}\n","<!-- A list, not a <nav>: the host already IS the navigation landmark, and two\n nested ones announce the same list twice. -->\n<ul class=\"wr-sidebar__inner\">\n <ng-container [ngTemplateOutlet]=\"rows\" [ngTemplateOutletContext]=\"{ $implicit: nodes() }\" />\n</ul>\n\n<ng-template #rows let-list>\n @for (node of asNodes(list); track node.key) {\n <li\n [class.wr-sidebar__group]=\"!!node.children\"\n [class.wr-sidebar__group--collapsed]=\"!!node.children && !node.open\"\n >\n @if (node.children) {\n @if (node.url) {\n <!-- A group that is also a page: two targets, the title a link and the\n arrow a button of its own. -->\n <div class=\"wr-sidebar__split\">\n <a\n [class]=\"node.rowClass\"\n [routerLink]=\"node.url\"\n [attr.aria-current]=\"node.active ? 'page' : null\"\n [attr.aria-describedby]=\"node.subtitleId\"\n >\n <ng-container [ngTemplateOutlet]=\"row\" [ngTemplateOutletContext]=\"{ $implicit: node }\" />\n </a>\n <button\n type=\"button\"\n class=\"wr-sidebar__toggle\"\n [attr.aria-expanded]=\"node.open\"\n [attr.aria-controls]=\"node.listId\"\n [attr.aria-label]=\"subpagesLabel({ title: node.title })\"\n (click)=\"toggle(node.key)\"\n >\n <ng-container [ngTemplateOutlet]=\"chevron\" />\n </button>\n </div>\n } @else {\n <button\n type=\"button\"\n [class]=\"node.rowClass\"\n [attr.aria-expanded]=\"node.open\"\n [attr.aria-controls]=\"node.listId\"\n [attr.aria-describedby]=\"node.subtitleId\"\n (click)=\"toggle(node.key)\"\n >\n <ng-container [ngTemplateOutlet]=\"row\" [ngTemplateOutletContext]=\"{ $implicit: node }\" />\n </button>\n }\n <div class=\"wr-sidebar__group-wrap\" [id]=\"node.listId\" [attr.inert]=\"node.open ? null : ''\">\n <div class=\"wr-sidebar__group-body\">\n <ul class=\"wr-sidebar__list\" [class.wr-sidebar__list--under-icon]=\"!!node.icon\">\n <ng-container [ngTemplateOutlet]=\"rows\" [ngTemplateOutletContext]=\"{ $implicit: node.children }\" />\n </ul>\n </div>\n </div>\n } @else if (node.url) {\n <a\n [class]=\"node.rowClass\"\n [routerLink]=\"node.url\"\n [attr.aria-current]=\"node.active ? 'page' : null\"\n [attr.aria-describedby]=\"node.subtitleId\"\n >\n <ng-container [ngTemplateOutlet]=\"row\" [ngTemplateOutletContext]=\"{ $implicit: node }\" />\n </a>\n } @else {\n <!-- A span, not a greyed anchor: `pointer-events: none` stops a mouse and\n never the keyboard, so a disabled link stayed a tab stop and Enter\n navigated. An empty `url` is the same case. No `aria-describedby`: a\n span is a nameless generic, so its subtitle is read as plain text. -->\n <span [class]=\"node.rowClass\">\n <ng-container [ngTemplateOutlet]=\"row\" [ngTemplateOutletContext]=\"{ $implicit: node }\" />\n </span>\n }\n </li>\n }\n</ng-template>\n\n<!-- The inside of every row. The accessible name is the title, then the badge,\n then the count, each piece ending in a hidden separator (`sidebar.separator`)\n when another follows; on a link or a button the subtitle is the description,\n and on a disabled row it is read as text. The separator sits INSIDE the piece\n it follows, and inline: a browser puts a space at every block boundary, so a\n comma element of its own was read as \"Guides , 14\". -->\n<ng-template #row let-value>\n @let node = asNode(value);\n @if (node.icon) {\n <wr-icon class=\"wr-sidebar__icon\" [name]=\"node.icon\" />\n }\n <span class=\"wr-sidebar__title\"\n >{{ node.title }}<span class=\"wr-sidebar__comma\">{{ node.titleTail }}</span></span\n >\n @if (node.badge || node.subtitle) {\n <span class=\"wr-sidebar__meta\">\n @if (node.badge; as badge) {\n <small\n class=\"wr-sidebar__badge\"\n [class.wr-sidebar__badge--neutral]=\"badge.tone === 'neutral'\"\n [class.wr-sidebar__badge--primary]=\"badge.tone === 'primary'\"\n [class.wr-sidebar__badge--danger]=\"badge.tone === 'danger'\"\n >{{ badge.text }}<span class=\"wr-sidebar__comma\">{{ node.badgeTail }}</span></small\n >\n }\n @if (node.subtitle) {\n <span\n class=\"wr-sidebar__subtitle\"\n [attr.aria-hidden]=\"node.url || node.children ? 'true' : null\"\n [attr.id]=\"node.subtitleId\"\n >{{ node.subtitle }}</span\n >\n }\n </span>\n }\n @if (node.count !== null || node.holdsActive || (node.children && !node.url)) {\n <span class=\"wr-sidebar__end\">\n @if (node.count !== null) {\n @if (node.countLabel) {\n <small class=\"wr-sidebar__count\" aria-hidden=\"true\">{{ node.count }}</small>\n <span class=\"wr-sidebar__sr\">{{ node.countLabel }}{{ node.countTail }}</span>\n } @else {\n <small class=\"wr-sidebar__count\"\n >{{ node.count }}<span class=\"wr-sidebar__comma\">{{ node.countTail }}</span></small\n >\n }\n }\n @if (node.holdsActive) {\n <span class=\"wr-sidebar__dot\" aria-hidden=\"true\"></span>\n }\n @if (node.children && !node.url) {\n <ng-container [ngTemplateOutlet]=\"chevron\" />\n }\n </span>\n }\n @if (node.holdsActive) {\n <span class=\"wr-sidebar__sr\">{{ containsCurrentLabel() }}</span>\n }\n</ng-template>\n\n<!-- Inline chrome, not user-customisable. Points at the inline end; turns down when open. -->\n<ng-template #chevron>\n <svg\n class=\"wr-sidebar__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=\"m9 18 6-6-6-6\" />\n </svg>\n</ng-template>\n"],"mappings":";;;;;;;;;;;;;;;;AA0CA,SAAS,QAAQ,OAA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,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;GAAA,YAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;GAAA,cAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;EAAA;EAAA,MAAA;GAAA,YAAA,EAAA,QAAA,aAAA;GAAA,YAAA,EAAA,mBAAA,sBAAA;GAAA,gBAAA;EAAA;EAAA,UAAA;EAAA,UC9LtB;EAyJA,cAAA;GAAA;IAAA,MAAA;IAAA,MDmCY;IAAgB,UAAA;IAAA,QAAA;KAAA;KAAA;KAAA;IAAA;GAAA;GAAA;IAAA,MAAA;IAAA,MAAE;IAAU,UAAA;IAAA,QAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;IAAA;GAAA;GAAA;IAAA,MAAA;IAAA,MAAE;IAAM,UAAA;IAAA,QAAA,CAAA,MAAA;GAAA;EAAA;EAAA,eAAA,GAAA,kBAAA;CAAA,CAAA;;AAEnC,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAS,YAAA,CAAA;EAPrB,MAAA;EACW,MAAA,CAAA;GAAA,UAAA;GAAY,eAEP,kBAAkB;GAAI,MAC/B;IAAE,OAAO;IAAc,MAAM;IAAc,qBAAqB;GAAqB;GAAE,SACpF;IAAC;IAAkB;IAAY;GAAM;GAAC,UAAA;EAAA,CAAA"}
|
|
1
|
+
{"version":3,"file":"ngwr-sidebar.mjs","names":[],"sources":["../../../projects/lib/sidebar/sidebar.ts","../../../projects/lib/sidebar/sidebar.html"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { coerceBooleanProperty } from '@angular/cdk/coercion';\nimport { NgTemplateOutlet } from '@angular/common';\nimport {\n Component,\n DestroyRef,\n ElementRef,\n ViewEncapsulation,\n afterNextRender,\n afterRenderEffect,\n computed,\n effect,\n inject,\n input,\n isDevMode,\n signal,\n untracked,\n} from '@angular/core';\nimport { toSignal } from '@angular/core/rxjs-interop';\nimport {\n ActivatedRoute,\n type IsActiveMatchOptions,\n NavigationEnd,\n Router,\n RouterLink,\n containsTree,\n} from '@angular/router';\n\nimport { filter, map, startWith } from 'rxjs';\n\nimport { wrReadI18nText, useI18nFormatter, useI18nText } from 'ngwr/i18n';\nimport { WrIcon } from 'ngwr/icon';\nimport { wrCheckStyles } from 'ngwr/utils';\n\nimport type { WrSidebarActiveOptions, WrSidebarBadgeTone, WrSidebarEntry, WrSidebarGroup } from './types';\n\nfunction isGroup(entry: WrSidebarEntry): entry is WrSidebarGroup {\n return 'children' in entry;\n}\n\n/** How deep the design goes. Deeper entries still render, with a dev-mode warning. */\nconst MAX_LEVEL = 3;\n\n/**\n * Joins the titles on a path into the key the open state is stored under. A path\n * rather than a title, so two groups called \"Overview\" in different sections stop\n * opening and closing together; a control character, so no title can forge it.\n */\nconst KEY_SEPARATOR = '\\u001f';\n\n/** `{ exact: true }`, spelled the way `RouterLinkActive` spells it. */\nconst EXACT_MATCH: IsActiveMatchOptions = {\n paths: 'exact',\n queryParams: 'exact',\n matrixParams: 'ignored',\n fragment: 'ignored',\n};\n\n/** `{ exact: false }`, the router's default and this component's. */\nconst SUBSET_MATCH: IsActiveMatchOptions = {\n paths: 'subset',\n queryParams: 'subset',\n matrixParams: 'ignored',\n fragment: 'ignored',\n};\n\n/**\n * A group's own link: the exact path, since the children own the paths below it.\n * A prefix match would mark the group AND its current child as the current page.\n */\nconst GROUP_MATCH: Partial<IsActiveMatchOptions> = { paths: 'exact', queryParams: 'subset' };\n\nfunction matchOptions(options: WrSidebarActiveOptions | undefined): Partial<IsActiveMatchOptions> {\n if (!options) return SUBSET_MATCH;\n if ('exact' in options) return options.exact ? EXACT_MATCH : SUBSET_MATCH;\n return options;\n}\n\n/** A string that says something, or `null`: an empty title part draws nothing. */\nfunction filled(value: string | null | undefined): string | null {\n return value === '' ? null : (value ?? null);\n}\n\n/** The commands an entry links to, or `null` when it renders as text or as a plain toggle. */\nfunction linkOf(entry: WrSidebarEntry): readonly (string | number)[] | null {\n if (isGroup(entry)) return entry.url?.length ? entry.url : null;\n return !entry.disabled && entry.url.length ? entry.url : null;\n}\n\n/**\n * Instance counter for the row ids. Deterministic under prerender, unlike\n * `wrRandomId()`, and unique across sidebars: a title-only id collided between two\n * sidebars on one page, and `aria-controls` then pointed at the wrong body.\n */\nlet sidebarUid = 0;\n\n/**\n * Whether `url` is `route` or something below it. A bare `startsWith` matched a\n * SIBLING whose path merely began the same way, so visiting `/table` expanded the\n * group that owns `/tabs`.\n */\nfunction matchesRoute(url: string, route: string): boolean {\n if (!url.startsWith(route)) return false;\n const rest = url.slice(route.length);\n return rest === '' || rest.startsWith('/') || rest.startsWith('?') || rest.startsWith('#');\n}\n\n/** One rendered row, with everything the template needs already decided. */\ninterface SidebarNode {\n /** The title path: what the open state and `track` key on. */\n readonly key: string;\n /** The group body's id, for `aria-controls`. Unique per sidebar and per position. */\n readonly listId: string;\n /** The subtitle's id, for `aria-describedby`, or `null` with no subtitle. */\n readonly subtitleId: string | null;\n readonly title: string;\n readonly subtitle: string | null;\n readonly icon: string | null;\n readonly badge: { readonly text: string; readonly tone: WrSidebarBadgeTone } | null;\n readonly count: string | null;\n readonly countLabel: string | null;\n /** The hidden separator after the title, the badge and the count, when another piece follows. */\n readonly titleTail: string;\n readonly badgeTail: string;\n readonly countTail: string;\n /** Where the row links to. `null` is plain text for a page, a whole-row toggle for a group. */\n readonly url: readonly (string | number)[] | null;\n readonly children: readonly SidebarNode[] | null;\n readonly open: boolean;\n readonly active: boolean;\n /** A collapsed, visible group with the current page somewhere below it. */\n readonly holdsActive: boolean;\n readonly rowClass: string;\n}\n\n/**\n * Navigation drawn from data: pages, and groups of pages that open and close,\n * three levels deep. Every row can carry a subtitle, a word badge and a count.\n *\n * Each title and subtitle takes one line and ends in an ellipsis when it does\n * not fit; the full text stays the accessible name and becomes a tooltip on the\n * part that was cut, measured after render in the browser. A group is a\n * `<button aria-expanded>` that opens its children, or, when it carries a `url`\n * of its own, a link with a separate arrow button beside it. The current page\n * gets `aria-current=\"page\"`, and a collapsed group holding it shows a dot and\n * says so (`sidebar.containsCurrent`).\n *\n * Rows are 32px. Under a coarse pointer (a phone, a tablet) they grow to 44px,\n * and the split arrow to 44 by 44, with no input: the size follows the pointer\n * rather than the container, so the same sidebar in a drawer on a laptop keeps\n * its 32px rows. To force either size, set `--wr-sidebar-row-height`,\n * `--wr-sidebar-row-padding-y` and `--wr-sidebar-chevron-size` on `.wr-sidebar`.\n *\n * The host pads its rows by `--wr-sidebar-padding` (`0.5rem`), so a hovered or\n * current row's tint stays off the edge of whatever holds the nav. Where the\n * container already supplies the inset, set the hook to `0` on `.wr-sidebar`,\n * not on the container: the host declares its own default, which shadows an\n * inherited one.\n *\n * @example\n * ```html\n * <wr-sidebar [entries]=\"[\n * { title: 'Dashboard', url: ['/dashboard'] },\n * {\n * title: 'Settings',\n * count: 2,\n * countLabel: '2 pages',\n * children: [\n * { title: 'Profile', url: ['/settings', 'profile'] },\n * { title: 'Billing', url: ['/settings', 'billing'], badge: { text: 'New', tone: 'primary' } }\n * ]\n * }\n * ]\" />\n * ```\n *\n * @see https://ngwr.dev/reference/components/sidebar\n */\n@Component({\n selector: 'wr-sidebar',\n templateUrl: './sidebar.html',\n encapsulation: ViewEncapsulation.None,\n host: { class: 'wr-sidebar', role: 'navigation', '[attr.aria-label]': 'resolvedAriaLabel()' },\n imports: [NgTemplateOutlet, RouterLink, WrIcon],\n})\nexport class WrSidebar {\n /**\n * The navigation tree. An entry with `children` is a group, which opens on\n * click and on its own when the current route is below it.\n */\n readonly entries = input<readonly WrSidebarEntry[]>([]);\n\n /**\n * Accessible name for the navigation landmark. Falls back to `sidebar.label`,\n * then `'Sidebar'`: a page with a sidebar AND a table of contents has two\n * navigation landmarks, and an unnamed one is announced as just \"navigation\".\n */\n readonly ariaLabel = input<string | null>(null);\n\n protected readonly resolvedAriaLabel = useI18nText(this.ariaLabel, 'sidebar.label', 'Sidebar');\n\n /** Icon for a group that names none. `null` draws no icon. @default null */\n readonly defaultGroupIcon = input<string | null>(null);\n\n /** Icon for a page that names none. `null` draws no icon. @default null */\n readonly defaultItemIcon = input<string | null>(null);\n\n /**\n * Open every group above the current route, once per navigation: a group the\n * user closes stays closed until the route changes. @default true\n */\n readonly autoExpand = input(true, { transform: coerceBooleanProperty });\n\n /**\n * Close the groups the previous navigation opened when the next one leaves\n * them, so a long nav does not keep every visited section expanded. A group\n * the user opened or closed by hand is never closed for them. Needs\n * `autoExpand`. @default false\n */\n readonly autoCollapse = input(false, { transform: coerceBooleanProperty });\n\n /** Spoken after a collapsed group that holds the current page. */\n protected readonly containsCurrentLabel = wrReadI18nText('sidebar.containsCurrent', 'contains the current page');\n\n /** The split arrow's name: the group's title is the link beside it. */\n protected readonly subpagesLabel = useI18nFormatter('sidebar.subpages', 'Sub-pages of {{title}}');\n\n /** Joins a row's title, badge and count into one name: `،` in Arabic, `、` in Japanese. */\n protected readonly separator = wrReadI18nText('sidebar.separator', ',');\n\n private readonly opened = signal<ReadonlySet<string>>(new Set());\n\n /** Group keys already seeded from `defaultOpen`, so it seeds once and not again. */\n private readonly seeded = new Set<string>();\n\n private readonly uid = ++sidebarUid;\n\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\n private readonly router = inject(Router);\n private readonly route = inject(ActivatedRoute, { optional: true });\n private readonly currentUrl = toSignal(\n this.router.events.pipe(\n filter((e): e is NavigationEnd => e instanceof NavigationEnd),\n map(e => e.urlAfterRedirects),\n startWith(this.router.url)\n ),\n { initialValue: this.router.url }\n );\n\n /**\n * The keys of the entries that are the current page, matched the way\n * `RouterLinkActive` matches: an entry's `activeOptions`, a prefix by default.\n * One computation drives `aria-current`, the bar, the ancestors and the dot,\n * so the four cannot disagree.\n */\n private readonly activeKeys = computed<ReadonlySet<string>>(() => {\n const current = this.router.parseUrl(this.currentUrl());\n const out = new Set<string>();\n const visit = (entries: readonly WrSidebarEntry[], parent: string): void => {\n for (const entry of entries) {\n const key = parent ? `${parent}${KEY_SEPARATOR}${entry.title}` : entry.title;\n const url = linkOf(entry);\n if (url) {\n const tree = this.router.createUrlTree([...url], { relativeTo: this.route });\n const options = isGroup(entry) ? GROUP_MATCH : matchOptions(entry.activeOptions);\n if (containsTree(current, tree, options)) out.add(key);\n }\n if (isGroup(entry)) visit(entry.children, key);\n }\n };\n visit(this.entries(), '');\n return out;\n });\n\n /** The tree as the template draws it. */\n protected readonly nodes = computed<readonly SidebarNode[]>(() => {\n const opened = this.opened();\n const active = this.activeKeys();\n const groupIcon = this.defaultGroupIcon();\n const itemIcon = this.defaultItemIcon();\n const sep = this.separator();\n\n const build = (\n entries: readonly WrSidebarEntry[],\n level: number,\n parentKey: string,\n parentId: string,\n visible: boolean\n ): { nodes: readonly SidebarNode[]; holds: boolean } => {\n let holds = false;\n const nodes = entries.map((entry, index) => {\n const key = parentKey ? `${parentKey}${KEY_SEPARATOR}${entry.title}` : entry.title;\n const id = `${parentId}-${index}`;\n const group = isGroup(entry);\n const open = group && opened.has(key);\n const sub = group ? build(entry.children, level + 1, key, id, visible && open) : null;\n const isActive = active.has(key);\n const below = sub?.holds ?? false;\n holds ||= isActive || below;\n\n const holdsActive = group && !open && below && visible;\n const ancestor = group && open && below;\n const url = linkOf(entry);\n const classes = ['wr-sidebar__row', `wr-sidebar__row--level-${Math.min(level, MAX_LEVEL)}`];\n if (group) classes.push('wr-sidebar__row--group');\n if (!group && !url) classes.push('wr-sidebar__row--disabled');\n if (isActive) classes.push('wr-sidebar__row--active');\n if (ancestor) classes.push('wr-sidebar__row--ancestor');\n if (holdsActive) classes.push('wr-sidebar__row--holds-active');\n\n const raw = entry.count ?? null;\n const count = raw === null ? null : String(raw);\n const subtitle = filled(entry.subtitle);\n const badge = entry.badge?.text ? { text: entry.badge.text, tone: entry.badge.tone ?? 'neutral' } : null;\n return {\n key,\n listId: `${id}-list`,\n subtitleId: subtitle === null ? null : `${id}-subtitle`,\n title: entry.title,\n subtitle,\n icon: filled(entry.icon) ?? filled(group ? groupIcon : itemIcon),\n badge,\n count,\n countLabel: count === null ? null : filled(entry.countLabel),\n titleTail: badge || count !== null || holdsActive ? sep : '',\n badgeTail: badge && (count !== null || holdsActive) ? sep : '',\n countTail: count !== null && holdsActive ? sep : '',\n url,\n children: sub?.nodes ?? null,\n open,\n active: isActive,\n holdsActive,\n rowClass: classes.join(' '),\n } satisfies SidebarNode;\n });\n return { nodes, holds };\n };\n\n return build(this.entries(), 1, '', `wr-sidebar-${this.uid}`, true).nodes;\n });\n\n /**\n * Last URL resolved to a set of groups, so a group the user collapsed is not\n * re-opened on the same route. A URL no group holds clears it rather than\n * being recorded: see the effect below.\n */\n private lastAutoUrl: string | null = null;\n\n /** Groups the last navigation opened, which `autoCollapse` may close again. */\n private autoOpened = new Set<string>();\n\n private warnedDepth = false;\n\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('sidebar');\n // Seed `defaultOpen` groups, once per group and not once per `entries`\n // emission. Re-seeding meant any later change to the array (a count, a\n // filtered list) re-opened a group the user had deliberately collapsed.\n effect(() => {\n const fresh: string[] = [];\n const visit = (entries: readonly WrSidebarEntry[], parent: string): void => {\n for (const entry of entries) {\n if (!isGroup(entry)) continue;\n const key = parent ? `${parent}${KEY_SEPARATOR}${entry.title}` : entry.title;\n if (entry.defaultOpen && !this.seeded.has(key)) {\n this.seeded.add(key);\n fresh.push(key);\n }\n visit(entry.children, key);\n }\n };\n visit(this.entries(), '');\n if (fresh.length > 0) this.opened.update(prev => new Set([...prev, ...fresh]));\n });\n\n // Open every group above the current URL, and with `autoCollapse` close\n // the ones the previous navigation opened and this one leaves.\n effect(() => {\n if (!this.autoExpand()) return;\n const url = this.currentUrl();\n if (url === this.lastAutoUrl) return;\n const keys = this.groupsAbove(url, this.entries());\n const collapse = this.autoCollapse();\n untracked(() => {\n // Latch AFTER the lookup, never before it. `entries` often arrives from\n // an HTTP call, so the first run matches nothing, and latching first told\n // the re-run that landed with the real nav that this URL was already\n // handled: a deep link stayed collapsed, with the current link out of\n // the tab order. A URL no group holds CLEARS the latch instead, or the\n // way back to a page whose group was closed by hand (Back, an in-page\n // link) found the latch still set and left that group closed.\n this.lastAutoUrl = keys.length === 0 ? null : url;\n\n const opened = this.opened();\n const next = new Set(opened);\n if (collapse) {\n for (const key of this.autoOpened) if (!keys.includes(key)) next.delete(key);\n }\n const fresh = keys.filter(key => !opened.has(key));\n for (const key of fresh) next.add(key);\n this.autoOpened = new Set([...fresh, ...[...this.autoOpened].filter(key => keys.includes(key))]);\n\n if (next.size !== opened.size || [...next].some(key => !opened.has(key))) this.opened.set(next);\n });\n });\n\n if (isDevMode()) {\n effect(() => {\n const depth = this.depthOf(this.entries());\n if (depth <= MAX_LEVEL || this.warnedDepth) return;\n this.warnedDepth = true;\n // eslint-disable-next-line no-console -- dev-mode validation\n console.warn(\n `[NGWR] <wr-sidebar>: an entry sits at level ${depth}. The sidebar is designed for ` +\n `${MAX_LEVEL} levels; deeper rows still render, indented once more per level.`\n );\n });\n }\n\n // A tooltip only where the text is actually cut, and on the cut text itself.\n // A `title` on the row would also become the row's description, so a row\n // named \"Charts, 18 pages\" would read its title a second time.\n afterRenderEffect(() => {\n this.nodes();\n this.markCut();\n });\n\n // The width can change with nothing re-rendering: a drawer opening, a\n // resized window, a web font arriving after first paint.\n const destroyRef = inject(DestroyRef);\n afterNextRender(() => {\n if (typeof ResizeObserver !== 'undefined') {\n const observer = new ResizeObserver(() => this.markCut());\n observer.observe(this.host.nativeElement);\n destroyRef.onDestroy(() => observer.disconnect());\n }\n if ('fonts' in document) void document.fonts.ready.then(() => this.markCut());\n });\n }\n\n protected toggle(key: string): void {\n // Opened or closed by hand, so never closed for the user afterwards.\n this.autoOpened.delete(key);\n this.opened.update(prev => {\n const next = new Set(prev);\n if (next.has(key)) next.delete(key);\n else next.add(key);\n return next;\n });\n }\n\n /** Types the template's recursive context, which `ng-template` leaves as `any`. */\n protected asNodes(value: unknown): readonly SidebarNode[] {\n return value as readonly SidebarNode[];\n }\n\n protected asNode(value: unknown): SidebarNode {\n return value as SidebarNode;\n }\n\n /**\n * A `routerLink` command array as the absolute path it navigates to — resolved\n * against the declaring route, the way `[routerLink]` and `activeKeys` resolve\n * it. Joining the segments by hand read a RELATIVE link (`['settings']`) as\n * `/settings`, so on `/admin/settings` the row lit up as the current page while\n * `autoExpand` left the group above it closed.\n */\n private resolve(link: readonly (string | number)[]): string {\n return this.router.serializeUrl(this.router.createUrlTree([...link], { relativeTo: this.route }));\n }\n\n /** Every group whose subtree links to `url` or above it, by path prefix. */\n private groupsAbove(url: string, entries: readonly WrSidebarEntry[]): string[] {\n const out: string[] = [];\n const visit = (list: readonly WrSidebarEntry[], parent: string): boolean => {\n let hit = false;\n for (const entry of list) {\n const key = parent ? `${parent}${KEY_SEPARATOR}${entry.title}` : entry.title;\n const link = linkOf(entry);\n let self = link !== null && matchesRoute(url, this.resolve(link));\n if (isGroup(entry) && visit(entry.children, key)) {\n out.push(key);\n self = true;\n }\n hit ||= self;\n }\n return hit;\n };\n visit(entries, '');\n return out;\n }\n\n private depthOf(entries: readonly WrSidebarEntry[], level = 1): number {\n let deepest = entries.length > 0 ? level : level - 1;\n for (const entry of entries) {\n if (isGroup(entry)) deepest = Math.max(deepest, this.depthOf(entry.children, level + 1));\n }\n return deepest;\n }\n\n private markCut(): void {\n const cuttable = this.host.nativeElement.querySelectorAll<HTMLElement>('.wr-sidebar__title, .wr-sidebar__subtitle');\n for (const el of cuttable) {\n // A pixel of slack: a fractional width rounds the two reads apart. The\n // tooltip is the element's own text, without the hidden comma inside it.\n if (el.scrollWidth > el.clientWidth + 1) {\n el.title = [...el.childNodes]\n .filter(node => node.nodeType === Node.TEXT_NODE)\n .map(node => node.textContent)\n .join('')\n .trim();\n } else {\n el.removeAttribute('title');\n }\n }\n }\n}\n","<!-- A list, not a <nav>: the host already IS the navigation landmark, and two\n nested ones announce the same list twice. -->\n<ul class=\"wr-sidebar__inner\">\n <ng-container [ngTemplateOutlet]=\"rows\" [ngTemplateOutletContext]=\"{ $implicit: nodes() }\" />\n</ul>\n\n<ng-template #rows let-list>\n @for (node of asNodes(list); track node.key) {\n <li\n [class.wr-sidebar__group]=\"!!node.children\"\n [class.wr-sidebar__group--collapsed]=\"!!node.children && !node.open\"\n >\n @if (node.children) {\n @if (node.url) {\n <!-- A group that is also a page: two targets, the title a link and the\n arrow a button of its own. -->\n <div class=\"wr-sidebar__split\">\n <a\n [class]=\"node.rowClass\"\n [routerLink]=\"node.url\"\n [attr.aria-current]=\"node.active ? 'page' : null\"\n [attr.aria-describedby]=\"node.subtitleId\"\n >\n <ng-container [ngTemplateOutlet]=\"row\" [ngTemplateOutletContext]=\"{ $implicit: node }\" />\n </a>\n <button\n type=\"button\"\n class=\"wr-sidebar__toggle\"\n [attr.aria-expanded]=\"node.open\"\n [attr.aria-controls]=\"node.listId\"\n [attr.aria-label]=\"subpagesLabel({ title: node.title })\"\n (click)=\"toggle(node.key)\"\n >\n <ng-container [ngTemplateOutlet]=\"chevron\" />\n </button>\n </div>\n } @else {\n <button\n type=\"button\"\n [class]=\"node.rowClass\"\n [attr.aria-expanded]=\"node.open\"\n [attr.aria-controls]=\"node.listId\"\n [attr.aria-describedby]=\"node.subtitleId\"\n (click)=\"toggle(node.key)\"\n >\n <ng-container [ngTemplateOutlet]=\"row\" [ngTemplateOutletContext]=\"{ $implicit: node }\" />\n </button>\n }\n <div class=\"wr-sidebar__group-wrap\" [id]=\"node.listId\" [attr.inert]=\"node.open ? null : ''\">\n <div class=\"wr-sidebar__group-body\">\n <ul class=\"wr-sidebar__list\" [class.wr-sidebar__list--under-icon]=\"!!node.icon\">\n <ng-container [ngTemplateOutlet]=\"rows\" [ngTemplateOutletContext]=\"{ $implicit: node.children }\" />\n </ul>\n </div>\n </div>\n } @else if (node.url) {\n <a\n [class]=\"node.rowClass\"\n [routerLink]=\"node.url\"\n [attr.aria-current]=\"node.active ? 'page' : null\"\n [attr.aria-describedby]=\"node.subtitleId\"\n >\n <ng-container [ngTemplateOutlet]=\"row\" [ngTemplateOutletContext]=\"{ $implicit: node }\" />\n </a>\n } @else {\n <!-- A span, not a greyed anchor: `pointer-events: none` stops a mouse and\n never the keyboard, so a disabled link stayed a tab stop and Enter\n navigated. An empty `url` is the same case. No `aria-describedby`: a\n span is a nameless generic, so its subtitle is read as plain text. -->\n <span [class]=\"node.rowClass\">\n <ng-container [ngTemplateOutlet]=\"row\" [ngTemplateOutletContext]=\"{ $implicit: node }\" />\n </span>\n }\n </li>\n }\n</ng-template>\n\n<!-- The inside of every row. The accessible name is the title, then the badge,\n then the count, each piece ending in a hidden separator (`sidebar.separator`)\n when another follows; on a link or a button the subtitle is the description,\n and on a disabled row it is read as text. The separator sits INSIDE the piece\n it follows, and inline: a browser puts a space at every block boundary, so a\n comma element of its own was read as \"Guides , 14\". -->\n<ng-template #row let-value>\n @let node = asNode(value);\n @if (node.icon) {\n <wr-icon class=\"wr-sidebar__icon\" [name]=\"node.icon\" />\n }\n <span class=\"wr-sidebar__title\"\n >{{ node.title }}<span class=\"wr-sidebar__comma\">{{ node.titleTail }}</span></span\n >\n @if (node.badge || node.subtitle) {\n <span class=\"wr-sidebar__meta\">\n @if (node.badge; as badge) {\n <small\n class=\"wr-sidebar__badge\"\n [class.wr-sidebar__badge--neutral]=\"badge.tone === 'neutral'\"\n [class.wr-sidebar__badge--primary]=\"badge.tone === 'primary'\"\n [class.wr-sidebar__badge--danger]=\"badge.tone === 'danger'\"\n >{{ badge.text }}<span class=\"wr-sidebar__comma\">{{ node.badgeTail }}</span></small\n >\n }\n @if (node.subtitle) {\n <span\n class=\"wr-sidebar__subtitle\"\n [attr.aria-hidden]=\"node.url || node.children ? 'true' : null\"\n [attr.id]=\"node.subtitleId\"\n >{{ node.subtitle }}</span\n >\n }\n </span>\n }\n @if (node.count !== null || node.holdsActive || (node.children && !node.url)) {\n <span class=\"wr-sidebar__end\">\n @if (node.count !== null) {\n @if (node.countLabel) {\n <small class=\"wr-sidebar__count\" aria-hidden=\"true\">{{ node.count }}</small>\n <span class=\"wr-sidebar__sr\">{{ node.countLabel }}{{ node.countTail }}</span>\n } @else {\n <small class=\"wr-sidebar__count\"\n >{{ node.count }}<span class=\"wr-sidebar__comma\">{{ node.countTail }}</span></small\n >\n }\n }\n @if (node.holdsActive) {\n <span class=\"wr-sidebar__dot\" aria-hidden=\"true\"></span>\n }\n @if (node.children && !node.url) {\n <ng-container [ngTemplateOutlet]=\"chevron\" />\n }\n </span>\n }\n @if (node.holdsActive) {\n <span class=\"wr-sidebar__sr\">{{ containsCurrentLabel() }}</span>\n }\n</ng-template>\n\n<!-- Inline chrome, not user-customisable. Points at the inline end; turns down when open. -->\n<ng-template #chevron>\n <svg\n class=\"wr-sidebar__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=\"m9 18 6-6-6-6\" />\n </svg>\n</ng-template>\n"],"mappings":";;;;;;;;;;;;;;;;AA0CA,SAAS,QAAQ,OAAqB;CACpC,OAAO,cAAc;AACvB;AAGA,MAAM,YAAY;AAOlB,MAAM,gBAAgB;AAGtB,MAAM,cAAoC;CACxC,OAAO;CACP,aAAa;CACb,cAAc;CACd,UAAU;AACX;AAGD,MAAM,eAAqC;CACzC,OAAO;CACP,aAAa;CACb,cAAc;CACd,UAAU;AACX;AAMD,MAAM,cAA6C;CAAE,OAAO;CAAS,aAAa;AAAQ;AAE1F,SAAS,aAAa,SAA2C;CAC/D,IAAI,CAAC,SAAS,OAAO;CACrB,IAAI,WAAW,SAAS,OAAO,QAAQ,QAAQ,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AAA;GAAA;IAAA,MAAA;IAAA,MDmCY;IAAgB,UAAA;IAAA,QAAA;KAAA;KAAA;KAAA;IAAA;GAAA;GAAA;IAAA,MAAA;IAAA,MAAE;IAAU,UAAA;IAAA,QAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;IAAA;GAAA;GAAA;IAAA,MAAA;IAAA,MAAE;IAAM,UAAA;IAAA,QAAA,CAAA,MAAA;GAAA;EAAA;EAAA,eAAA,GAAA,kBAAA;CAAA,CAAA;;AAEnC,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAS,YAAA,CAAA;EAPrB,MAAA;EACW,MAAA,CAAA;GAAA,UAAA;GAAY,eAEP,kBAAkB;GAAI,MAC/B;IAAE,OAAO;IAAc,MAAM;IAAc,qBAAqB;GAAqB;GAAE,SACpF;IAAC;IAAkB;IAAY;GAAM;GAAC,UAAA;EAAA,CAAA"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as i0 from "@angular/core";
|
|
2
2
|
import { Component, ViewEncapsulation, computed, input } from "@angular/core";
|
|
3
3
|
import { coerceBooleanProperty } from "@angular/cdk/coercion";
|
|
4
|
-
import {
|
|
4
|
+
import { wrCheckStyles, wrNumAttr } from "ngwr/utils";
|
|
5
5
|
/**
|
|
6
6
|
* @license
|
|
7
7
|
*
|
|
@@ -19,11 +19,11 @@ var WrSkeleton = class WrSkeleton {
|
|
|
19
19
|
});
|
|
20
20
|
lines = input(0, {
|
|
21
21
|
...ngDevMode ? { debugName: "lines" } : /* istanbul ignore next */ {},
|
|
22
|
-
transform:
|
|
22
|
+
transform: wrNumAttr(0)
|
|
23
23
|
});
|
|
24
24
|
lineIndexes = computed(() => Array.from({ length: Math.max(0, Math.floor(this.lines())) }, (_, i) => i), ...ngDevMode ? [{ debugName: "lineIndexes" }] : /* istanbul ignore next */ []);
|
|
25
25
|
classes = computed(() => {
|
|
26
|
-
const parts = [
|
|
26
|
+
const parts = [];
|
|
27
27
|
const color = this.color();
|
|
28
28
|
if (color) parts.push(`wr-skeleton--${color}`);
|
|
29
29
|
if (this.animated()) parts.push("wr-skeleton--animated");
|
|
@@ -72,7 +72,8 @@ var WrSkeleton = class WrSkeleton {
|
|
|
72
72
|
"aria-busy": "true",
|
|
73
73
|
"aria-live": "polite"
|
|
74
74
|
},
|
|
75
|
-
properties: { "class": "classes()" }
|
|
75
|
+
properties: { "class": "classes()" },
|
|
76
|
+
classAttribute: "wr-skeleton"
|
|
76
77
|
},
|
|
77
78
|
ngImport: i0,
|
|
78
79
|
template: "@for (i of lineIndexes(); track i) {\n <span class=\"wr-skeleton__line\"></span>\n}\n",
|
|
@@ -92,6 +93,7 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
92
93
|
host: {
|
|
93
94
|
"aria-busy": "true",
|
|
94
95
|
"aria-live": "polite",
|
|
96
|
+
class: "wr-skeleton",
|
|
95
97
|
"[class]": "classes()"
|
|
96
98
|
},
|
|
97
99
|
template: "@for (i of lineIndexes(); track i) {\n <span class=\"wr-skeleton__line\"></span>\n}\n"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ngwr-skeleton.mjs","names":[],"sources":["../../../projects/lib/skeleton/skeleton.ts","../../../projects/lib/skeleton/skeleton.html"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { coerceBooleanProperty } from '@angular/cdk/coercion';\nimport { Component, ViewEncapsulation, computed, input } from '@angular/core';\n\nimport type { WrColor } from 'ngwr/theme';\nimport {
|
|
1
|
+
{"version":3,"file":"ngwr-skeleton.mjs","names":[],"sources":["../../../projects/lib/skeleton/skeleton.ts","../../../projects/lib/skeleton/skeleton.html"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { coerceBooleanProperty } from '@angular/cdk/coercion';\nimport { Component, ViewEncapsulation, computed, input } from '@angular/core';\n\nimport type { WrColor } from 'ngwr/theme';\nimport { wrNumAttr, wrCheckStyles } from 'ngwr/utils';\n\n/**\n * Placeholder block shown while content is loading.\n *\n * Default sizing fills the parent width and matches the surrounding\n * text height (`1lh`). Override `--wr-skeleton-height` / `width` on the\n * host for custom shapes. `lines` draws a paragraph instead: that many\n * lines, the last one shorter.\n *\n * @example\n * ```html\n * <wr-skeleton />\n * <wr-skeleton color=\"primary\" [animated]=\"false\" />\n * <wr-skeleton [lines]=\"3\" />\n * ```\n *\n * @see https://ngwr.dev/reference/components/skeleton\n */\n@Component({\n selector: 'wr-skeleton',\n templateUrl: './skeleton.html',\n encapsulation: ViewEncapsulation.None,\n host: {\n 'aria-busy': 'true',\n 'aria-live': 'polite',\n class: 'wr-skeleton',\n '[class]': 'classes()',\n },\n})\nexport class WrSkeleton {\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('skeleton');\n }\n\n /**\n * Intent tint for the placeholder. `null`, the default, paints the neutral\n * gray a placeholder almost always wants.\n *\n * It used to default to the `light` intent, chosen because that one token was\n * theme-stable — slate-300 on white, slate-800 on near-black. The neutral ramp\n * does that job now and does it by construction, so the default is the absence\n * of an intent rather than a particular one. An intent here tints a thing that\n * is not yet content, so reach for it only when the placeholder stands in for\n * something the colour already identifies.\n *\n * @default null\n */\n readonly color = input<WrColor | null>(null);\n\n /**\n * Whether the shimmer animation runs.\n *\n * @default true\n */\n readonly animated = input(true, { transform: coerceBooleanProperty });\n\n /**\n * Draw a paragraph: this many text lines, each `--wr-skeleton-height` tall\n * and `--wr-skeleton-line-gap` apart, the last one `--wr-skeleton-last-line-width`\n * wide. `0`, the default, keeps the one block. The host stays the only thing\n * a screen reader hears: the lines are empty boxes, so `aria-busy` is read\n * once however many there are.\n *\n * @default 0\n */\n readonly lines = input(0, { transform: wrNumAttr(0) });\n\n /** One entry per line, for the template's `@for`. */\n protected readonly lineIndexes = computed(() =>\n Array.from({ length: Math.max(0, Math.floor(this.lines())) }, (_, i) => i)\n );\n\n protected readonly classes = computed(() => {\n const parts: string[] = [];\n\n const color = this.color();\n if (color) parts.push(`wr-skeleton--${color}`);\n\n if (this.animated()) parts.push('wr-skeleton--animated');\n if (this.lineIndexes().length > 0) parts.push('wr-skeleton--lines');\n return parts.join(' ');\n });\n}\n","@for (i of lineIndexes(); track i) {\n <span class=\"wr-skeleton__line\"></span>\n}\n"],"mappings":";;;;;;;;;;AAyCA,IAAa,aAAb,MAAa,WAAU;CACrB,cAAA;EACE,IAAI,OAAO,cAAc,eAAe,WAAW,cAAc,UAAU;CAC7E;CAeS,QAAQ,MAAsB,MAAK,GAAA,YAAA,CAAA,EAAA,WAAA,QAAA,CAAA,+BAAA,CAAA,CAAA;CAOnC,WAAW,MAAM,MAAI;EAAA,GAAA,YAAA,EAAA,WAAA,WAAA,+BAAA,CAAA;EAAI,WAAW;CAAqB,CAAA;CAWzD,QAAQ,MAAM,GAAC;EAAA,GAAA,YAAA,EAAA,WAAA,QAAA,+BAAA,CAAA;EAAI,WAAW,UAAU,CAAC;CAAC,CAAA;CAGhC,cAAc,eAC/B,MAAM,KAAK,EAAE,QAAQ,KAAK,IAAI,GAAG,KAAK,MAAM,KAAK,MAAK,CAAE,CAAC,EAAC,IAAK,GAAG,MAAM,CAAC,GAC1E,GAAA,YAAA,CAAA,EAAA,WAAA,cAAA,CAAA,+BAAA,CAAA,CAAA;CAEkB,UAAU,eAAc;EACzC,MAAM,QAAkB,CAAA;EAExB,MAAM,QAAQ,KAAK,MAAK;EACxB,IAAI,OAAO,MAAM,KAAK,gBAAgB,OAAO;EAE7C,IAAI,KAAK,SAAQ,GAAI,MAAM,KAAK,uBAAuB;EACvD,IAAI,KAAK,YAAW,CAAE,CAAC,SAAS,GAAG,MAAM,KAAK,oBAAoB;EAClE,OAAO,MAAM,KAAK,GAAG;CACvB,GAAE,GAAA,YAAA,CAAA,EAAA,WAAA,UAAA,CAAA,+BAAA,CAAA,CAAA;CApDS,OAAA,OAAA,GAAA,mBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,UAAA;EAAA,MAAA;EAAU,MAAA,CAAA;EAAA,QAAA,GAAA,gBAAA;CAAA,CAAA;CAAV,OAAA,OAAA,GAAA,qBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,MAAA;EAAU,cAAA;EAAA,UAAA;EAAA,QAAA;GAAA,OAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;GAAA,UAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;GAAA,OAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;EAAA;EAAA,MAAA;GAAA,YAAA;IAAA,aAAA;IAAA,aAAA;GAAA;GAAA,YAAA,EAAA,SAAA,YAAA;GAAA,gBAAA;EAAA;EAAA,UAAA;EAAA,UCzCvB;EAGA,eAAA,GAAA,kBAAA;CAAA,CAAA;;ADsCa,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAU,YAAA,CAAA;EAXtB,MAAA;EACW,MAAA,CAAA;GAAA,UAAA;GAAa,eAER,kBAAkB;GAAI,MAC/B;IACJ,aAAa;IACb,aAAa;IACb,OAAO;IACP,WAAW;GACZ;GAAA,UAAA;EAAA,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ngwr-slider-testing.mjs","names":[],"sources":["../../../projects/lib/slider/testing/wr-slider-thumb-harness.ts","../../../projects/lib/slider/testing/wr-slider-harness.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 { ComponentHarness, HarnessPredicate, TestKey } from '@angular/cdk/testing';\n\nimport type { WrSliderThumbHarnessFilters, WrSliderThumbPosition } from './types';\n\n/** How many key presses {@link WrSliderThumbHarness.setValue} spends before it gives up. */\nconst MAX_PRESSES = 1000;\n\n/**\n * Test harness for one thumb of a `<wr-slider>`.\n *\n * A single-thumb slider has exactly one; a `range` one has two, and each thumb\n * is the other's limit — the lower thumb's `aria-valuemax` is wherever the upper\n * thumb is standing, and vice versa. So {@link getMin} / {@link getMax} answer\n * the room THIS thumb has, not the slider's bounds, which is exactly what a\n * screen reader announces and exactly the window {@link setValue} can reach.\n *\n * Every write here is a KEY PRESS, because a drag is not something a unit test\n * can perform — see {@link setValue}.\n *\n * Every press is on the BLOCK axis — `ArrowUp` / `ArrowDown`, `PageUp` /\n * `PageDown`, `Home` / `End` — so the harness means the same thing in both\n * reading directions. That is not a detail: the component's ← / → follow the\n * VISUAL track, so under `dir=\"rtl\"` a right-arrow LOWERS the value, and a\n * harness that pressed it would have `stepUp()` stepping down while every LTR\n * spec stayed green. It cannot detect the direction to compensate either —\n * `Directionality` is injected, not published to the DOM — so it stays on the\n * axis `dir` does not govern.\n *\n * @example\n * ```ts\n * const upper = await slider.getHighThumb();\n *\n * await upper.setValue(90);\n * expect(await upper.getValue()).toBe(90);\n * ```\n *\n * @see https://ngwr.dev/guides/testing\n */\nexport class WrSliderThumbHarness extends ComponentHarness {\n /**\n * The thumb is a real `<button role=\"slider\">`, so it is focusable without a\n * `tabindex` and leaves the tab order by itself when disabled. Anchored on the\n * BEM class rather than on `[role=\"slider\"]`: the class also carries the\n * `--low` / `--high` modifier this harness reads.\n */\n static hostSelector = '.wr-slider__thumb';\n\n /** Build a predicate that narrows the query — pass to `getHarness` / `getAllHarnesses`. */\n static with(options: WrSliderThumbHarnessFilters = {}): HarnessPredicate<WrSliderThumbHarness> {\n return new HarnessPredicate(WrSliderThumbHarness, options)\n .addOption('position', options.position, async (harness, position) => (await harness.getPosition()) === position)\n .addOption('value', options.value, async (harness, value) => (await harness.getValue()) === value)\n .addOption('label', options.label, (harness, label) => HarnessPredicate.stringMatches(harness.getLabel(), label));\n }\n\n /** Which end this thumb is. A single-thumb slider's thumb is the `'low'` one. */\n async getPosition(): Promise<WrSliderThumbPosition> {\n return (await (await this.host()).hasClass('wr-slider__thumb--high')) ? 'high' : 'low';\n }\n\n /** Where the thumb is standing, from `aria-valuenow` — the number a screen reader reads out. */\n async getValue(): Promise<number> {\n return this.numeric('aria-valuenow');\n }\n\n /**\n * The lowest value THIS thumb can reach (`aria-valuemin`).\n *\n * On a range slider's upper thumb that is the lower thumb, not the slider's\n * `min` — the two cannot cross, so the neighbour is the real floor.\n */\n async getMin(): Promise<number> {\n return this.numeric('aria-valuemin');\n }\n\n /**\n * The highest value THIS thumb can reach (`aria-valuemax`).\n *\n * On a range slider's lower thumb that is the upper thumb, not the slider's\n * `max`.\n */\n async getMax(): Promise<number> {\n return this.numeric('aria-valuemax');\n }\n\n /** The thumb's accessible name — `'Value'`, or `'Lower value'` / `'Upper value'` in range mode. */\n async getLabel(): Promise<string | null> {\n return (await this.host()).getAttribute('aria-label');\n }\n\n /** What a screen reader is told this control is. The role is why the arrows mean anything here. */\n async getRole(): Promise<string | null> {\n return (await this.host()).getAttribute('role');\n }\n\n /** Whether the thumb refuses the keyboard. Read from the button's native `disabled`. */\n async isDisabled(): Promise<boolean> {\n return (await this.host()).getProperty<boolean>('disabled');\n }\n\n async focus(): Promise<void> {\n return (await this.host()).focus();\n }\n\n async isFocused(): Promise<boolean> {\n return (await this.host()).isFocused();\n }\n\n /**\n * One step up (`ArrowUp`). A disabled thumb does not move.\n *\n * `ArrowRight` is the same key press in an LTR slider and the OPPOSITE one in\n * an RTL slider, so the vertical arrow is the one that means \"up\" everywhere.\n */\n async stepUp(): Promise<void> {\n return this.press(TestKey.UP_ARROW);\n }\n\n /** One step down (`ArrowDown`; `ArrowLeft` only agrees in LTR — see {@link stepUp}). */\n async stepDown(): Promise<void> {\n return this.press(TestKey.DOWN_ARROW);\n }\n\n /** Ten steps up (`PageUp`; `Shift`+arrow is the same stride). */\n async largeStepUp(): Promise<void> {\n return this.press(TestKey.PAGE_UP);\n }\n\n /** Ten steps down (`PageDown`; `Shift`+arrow is the same stride). */\n async largeStepDown(): Promise<void> {\n return this.press(TestKey.PAGE_DOWN);\n }\n\n /**\n * `Home` — jump to the lowest value this thumb can reach.\n *\n * On a range slider's UPPER thumb that lands on the lower thumb, not on the\n * slider's `min`: the component asks for `min` and then refuses to let the\n * ends cross, so the range collapses instead of inverting.\n */\n async toMin(): Promise<void> {\n return this.press(TestKey.HOME);\n }\n\n /**\n * `End` — jump to the highest value this thumb can reach.\n *\n * On a range slider's LOWER thumb that lands on the upper thumb, not on the\n * slider's `max`, for the same reason as {@link toMin}.\n */\n async toMax(): Promise<void> {\n return this.press(TestKey.END);\n }\n\n /**\n * Walk the thumb to `value` FROM THE KEYBOARD — `PageUp` / `PageDown` for the\n * distance, arrows for the last stretch, `Home` / `End` for the bounds. That\n * is the accessible path, and the only one a unit test can trust.\n *\n * There is deliberately no drag. jsdom has no layout: the track measures 0×0\n * and `getBoundingClientRect()` answers all zeros, while the component turns a\n * pointer into a value by dividing the offset by the track width. Every\n * positive offset therefore divides by zero, clamps to a ratio of 1 and writes\n * the slider's MAX — quietly, with no error to notice. A coordinate cannot\n * mean anything here.\n *\n * It costs one press per stride, so the walk is not free: crossing most of a\n * 0–100 range costs ~19 presses at `step=\"1\"` and ~109 at `step=\"0.1\"`.\n * Landing exactly on a bound is one press, whatever the step. The walk gives\n * up after 1000 presses — a 0–100 range reaches that at `step=\"0.01\"` or finer\n * — and throws rather than spin.\n *\n * A bound the step grid misses is announced but not reachable: `aria-valuemax`\n * is the `max` input, while the component snaps every key press onto whole\n * steps from `min`, so `max=\"100\" step=\"3\"` stops at 99. That is the off-grid\n * throw, arriving for `setValue(100)`.\n *\n * Either the thumb ends up exactly on `value` or this throws: when `value` is\n * outside the thumb's window (the other thumb is one end of it in range mode),\n * when the thumb is disabled, and when `value` is not on the step grid — on\n * the last one the thumb is left at the nearest value it could reach.\n */\n async setValue(value: number): Promise<void> {\n if (await this.isDisabled()) {\n throw new Error('WrSliderThumbHarness.setValue(): the slider is disabled, so the keyboard cannot move it.');\n }\n\n const [min, max] = [await this.getMin(), await this.getMax()];\n if (value < min || value > max) {\n throw new Error(\n `WrSliderThumbHarness.setValue(): ${value} is outside the [${min}, ${max}] window this thumb can ` +\n 'reach. On a range slider the other thumb is one end of that window — move it first.'\n );\n }\n\n let current = await this.getValue();\n if (current === value) return;\n // The bounds are one key press, and on a range thumb `Home` / `End` stop at\n // the neighbour — which is precisely this window's end. The landing is still\n // checked: a `max` that is not a whole number of steps from `min` is\n // announced by `aria-valuemax` and refused by the component's snapping.\n if (value === min || value === max) {\n await (value === min ? this.toMin() : this.toMax());\n return this.assertSettled(await this.getValue(), value, min);\n }\n\n let presses = 0;\n // Start on the ten-step stride: neither stride is published to the DOM, so\n // the only way to learn one is to take it and look. One overshoot is pressed\n // back off and the rest of the walk goes a single step at a time.\n let striding = true;\n\n while (current !== value) {\n if (presses >= MAX_PRESSES) {\n throw new Error(\n `WrSliderThumbHarness.setValue(): gave up walking to ${value} after ${MAX_PRESSES} key presses ` +\n `(reached ${current}). A step this fine is not something a keyboard reaches — write the ` +\n 'slider through its `[(value)]` model instead.'\n );\n }\n\n // Re-derived every pass so the walk follows wherever the thumb actually\n // landed rather than where a stride aimed. It never has to reverse: the\n // window check above keeps the target inside [min, max], so pressing back\n // off an overshoot lands at or short of where the stride began — on the\n // same side of the target it started on.\n const direction: 1 | -1 = value > current ? 1 : -1;\n await this.press(this.strideKey(direction, striding));\n presses++;\n\n const next = await this.getValue();\n // Nothing moved: the thumb is pinned against a bound or its neighbour, and\n // pressing again would only spin. The final check below reports where.\n if (next === current) break;\n\n const overshot = direction === 1 ? next > value : next < value;\n current = next;\n if (!overshot) continue;\n\n await this.press(this.strideKey(direction === 1 ? -1 : 1, striding));\n presses++;\n current = await this.getValue();\n\n // Single steps straddling the target means it is not on the step grid.\n if (!striding) break;\n striding = false;\n }\n\n this.assertSettled(current, value, min);\n }\n\n /**\n * The landing check every path through {@link setValue} ends on: exactly the\n * value asked for, or an error naming where the thumb stopped instead.\n */\n private assertSettled(current: number, value: number, min: number): void {\n if (current === value) return;\n throw new Error(\n `WrSliderThumbHarness.setValue(): the keyboard settled on ${current} instead of ${value}. The thumb ` +\n `moves in whole steps from ${min}, so only values on that grid are reachable.`\n );\n }\n\n /** The key that moves the thumb one stride in `direction`. */\n private strideKey(direction: 1 | -1, striding: boolean): TestKey {\n if (striding) return direction === 1 ? TestKey.PAGE_UP : TestKey.PAGE_DOWN;\n // The vertical arrows, for the reason {@link stepUp} gives: the horizontal\n // pair swaps meaning under `dir=\"rtl\"`, which would send the fine stretch of\n // the walk away from its target.\n return direction === 1 ? TestKey.UP_ARROW : TestKey.DOWN_ARROW;\n }\n\n /**\n * Press a key on the thumb.\n *\n * `sendKeys` focuses the element first, so this is the whole gesture a user\n * makes — the component listens for `keydown` on the thumb itself.\n */\n private async press(key: TestKey): Promise<void> {\n return (await this.host()).sendKeys(key);\n }\n\n /**\n * One of the ARIA range attributes as a number.\n *\n * Throws instead of handing back `NaN`: a slider whose `aria-valuenow` is not\n * a number is broken in a way every later assertion would describe badly.\n */\n private async numeric(attribute: string): Promise<number> {\n const raw = await (await this.host()).getAttribute(attribute);\n const value = raw === null ? Number.NaN : Number.parseFloat(raw);\n\n if (Number.isNaN(value)) {\n throw new Error(`WrSliderThumbHarness: the thumb's ${attribute} is ${JSON.stringify(raw)}, not a number.`);\n }\n return value;\n }\n}\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { ComponentHarness, HarnessPredicate } from '@angular/cdk/testing';\n\nimport type { WrSliderValue } from 'ngwr/slider';\n\nimport type { WrSliderHarnessFilters, WrSliderThumbHarnessFilters } from './types';\nimport { WrSliderThumbHarness } from './wr-slider-thumb-harness';\n\n/** Element-wise comparison for the `value` filter — a tuple never matches a plain number. */\nfunction sameValue(actual: WrSliderValue, expected: WrSliderValue): boolean {\n if (typeof actual === 'number') return actual === expected;\n if (typeof expected === 'number') return false;\n return actual[0] === expected[0] && actual[1] === expected[1];\n}\n\n/**\n * Test harness for `<wr-slider>` — single-thumb and `range`.\n *\n * Every NUMBER it reads comes off the thumbs' ARIA range trio (`aria-valuenow`,\n * `aria-valuemin`, `aria-valuemax`), which is what a screen reader is told and\n * the only place the slider publishes its value. The mode comes off the host's\n * `wr-slider--range` class and {@link getLabelText} off the rendered text.\n *\n * Everything it WRITES is a key press. A slider is a pointer control, but a\n * pointer control cannot be driven by coordinates in jsdom — there is no layout,\n * so the track measures 0×0 and the component divides every offset by that\n * width: a positive one writes the slider's MAX and `clientX: 0` writes `NaN`,\n * neither of them the value asked for. The keyboard is both the accessible path\n * and the only honest one here; {@link WrSliderThumbHarness.setValue} spells out\n * what the walk costs, and {@link WrSliderThumbHarness} why every one of those\n * presses is on the block axis, which `dir` does not turn around.\n *\n * The `step` is deliberately not readable: the component publishes it nowhere in\n * the DOM (ARIA has no attribute for it), so a spec that needs the number should\n * measure it — `stepUp()` moves by exactly one step.\n *\n * @example\n * ```ts\n * const volume = await loader.getHarness(WrSliderHarness);\n *\n * await volume.setValue(70);\n * expect(await volume.getValue()).toBe(70);\n *\n * const span = await loader.getHarness(WrSliderHarness.with({ range: true }));\n * await span.setRange(30, 60);\n * ```\n *\n * @see https://ngwr.dev/guides/testing\n */\nexport class WrSliderHarness extends ComponentHarness {\n static hostSelector = 'wr-slider';\n\n /** Build a predicate that narrows the query — pass to `getHarness` / `getAllHarnesses`. */\n static with(options: WrSliderHarnessFilters = {}): HarnessPredicate<WrSliderHarness> {\n return new HarnessPredicate(WrSliderHarness, options)\n .addOption('value', options.value, async (harness, value) => sameValue(await harness.getValue(), value))\n .addOption('range', options.range, async (harness, range) => (await harness.isRange()) === range)\n .addOption('disabled', options.disabled, async (harness, disabled) => (await harness.isDisabled()) === disabled)\n .addOption('labelText', options.labelText, (harness, text) =>\n HarnessPredicate.stringMatches(harness.getLabelText(), text)\n );\n }\n\n /** Whether the slider has two thumbs and answers with a `[low, high]` tuple. */\n async isRange(): Promise<boolean> {\n return (await this.host()).hasClass('wr-slider--range');\n }\n\n /**\n * Whether the slider refuses interaction.\n *\n * Read from the thumb's native `disabled` rather than from the\n * `wr-slider--disabled` class: the class is paint, while `disabled` on the\n * button is what takes the thumb out of the tab order and what assistive tech\n * reports.\n */\n async isDisabled(): Promise<boolean> {\n return (await this.getLowThumb()).isDisabled();\n }\n\n /**\n * The current value, in the shape the model uses: a plain number for one\n * thumb, `[low, high]` for two.\n */\n async getValue(): Promise<WrSliderValue> {\n const values = await Promise.all((await this.getThumbs()).map(thumb => thumb.getValue()));\n return values.length > 1 ? ([values[0], values[1]] as const) : values[0];\n }\n\n /** The slider's lower bound. */\n async getMin(): Promise<number> {\n return (await this.getThumbs())[0].getMin();\n }\n\n /**\n * The slider's upper bound.\n *\n * Taken from the LAST thumb, because in range mode the thumbs bound each\n * other: the lower one's `aria-valuemax` is wherever the upper one is\n * standing, so only the upper thumb knows the real ceiling.\n */\n async getMax(): Promise<number> {\n const thumbs = await this.getThumbs();\n return thumbs[thumbs.length - 1].getMax();\n }\n\n /**\n * The text the slider prints under the track, or `null` when `showLabel` is\n * off.\n *\n * A range slider joins its ends with an EN DASH — `'20 – 80'`, U+2013 — so an\n * assertion typed with a hyphen will not match.\n */\n async getLabelText(): Promise<string | null> {\n const label = await this.locatorForOptional('.wr-slider__label')();\n return label ? label.text() : null;\n }\n\n /** The slider's thumbs in DOM order: the lower one first. */\n async getThumbs(filters: WrSliderThumbHarnessFilters = {}): Promise<WrSliderThumbHarness[]> {\n return this.locatorForAll(WrSliderThumbHarness.with(filters))();\n }\n\n /** The only thumb of a single-thumb slider, or the lower one of a range slider. */\n async getLowThumb(): Promise<WrSliderThumbHarness> {\n return this.locatorFor(WrSliderThumbHarness.with({ position: 'low' }))();\n }\n\n /** The upper thumb. Throws on a single-thumb slider, which has no such part. */\n async getHighThumb(): Promise<WrSliderThumbHarness> {\n const thumb = await this.locatorForOptional(WrSliderThumbHarness.with({ position: 'high' }))();\n if (!thumb) {\n throw new Error('WrSliderHarness.getHighThumb(): this slider has one thumb — only a `range` slider has two.');\n }\n return thumb;\n }\n\n /**\n * Walk the slider to `value` from the keyboard.\n *\n * Single-thumb only — {@link setRange} moves both ends. See\n * {@link WrSliderThumbHarness.setValue} for what the walk costs and when it\n * throws.\n */\n async setValue(value: number): Promise<void> {\n return (await this.single('setValue')).setValue(value);\n }\n\n /**\n * Walk both ends of a range slider to `[low, high]`.\n *\n * The far end moves FIRST. The thumbs bound each other, so writing `[90, 95]`\n * over `[20, 80]` lower-end-first would be refused outright — 90 is outside\n * the `[0, 80]` window the upper thumb leaves the lower one.\n */\n async setRange(low: number, high: number): Promise<void> {\n if (!(await this.isRange())) {\n throw new Error('WrSliderHarness.setRange(): this slider has one thumb — add `range` to it, or call setValue().');\n }\n if (low > high) {\n throw new Error(`WrSliderHarness.setRange(): ${low} is above ${high}, and the thumbs cannot cross.`);\n }\n\n const lowThumb = await this.getLowThumb();\n const highThumb = await this.getHighThumb();\n\n if (high >= (await highThumb.getValue())) {\n await highThumb.setValue(high);\n await lowThumb.setValue(low);\n return;\n }\n\n await lowThumb.setValue(low);\n await highThumb.setValue(high);\n }\n\n /** One step up (`ArrowUp`). Single-thumb only. A disabled slider does not move. */\n async stepUp(): Promise<void> {\n return (await this.single('stepUp')).stepUp();\n }\n\n /** One step down (`ArrowDown`). Single-thumb only. A disabled slider does not move. */\n async stepDown(): Promise<void> {\n return (await this.single('stepDown')).stepDown();\n }\n\n /** `Home` — jump to the slider's `min`. Single-thumb only. */\n async toMin(): Promise<void> {\n return (await this.single('toMin')).toMin();\n }\n\n /** `End` — jump to the slider's `max`. Single-thumb only. */\n async toMax(): Promise<void> {\n return (await this.single('toMax')).toMax();\n }\n\n /**\n * Move keyboard focus to the slider's first thumb. A range slider's thumbs are\n * two separate tab stops (both are plain buttons — there is no roving\n * `tabindex`), so reach the other one through {@link getHighThumb}.\n */\n async focus(): Promise<void> {\n return (await this.getLowThumb()).focus();\n }\n\n /** Whether any of the slider's thumbs holds focus. */\n async isFocused(): Promise<boolean> {\n const focused = await Promise.all((await this.getThumbs()).map(thumb => thumb.isFocused()));\n return focused.includes(true);\n }\n\n /**\n * The one thumb a single-thumb convenience call means.\n *\n * Range mode gets an error rather than a guess: \"step this slider up\" has two\n * possible answers there, and picking one silently is how a spec ends up\n * asserting against the end it did not move.\n */\n private async single(caller: string): Promise<WrSliderThumbHarness> {\n if (await this.isRange()) {\n throw new Error(\n `WrSliderHarness.${caller}(): this slider has two thumbs — use setRange(), or reach for one end ` +\n 'with getLowThumb() / getHighThumb().'\n );\n }\n return this.getLowThumb();\n }\n}\n"],"mappings":";;;;;;;AAYA,MAAM,cAAc;AAiCpB,IAAa,uBAAb,MAAa,6BAA6B,iBAAgB;CAOxD,OAAO,eAAe;CAGtB,OAAO,KAAK,UAAuC,CAAA,GAAE;EACnD,OAAO,IAAI,iBAAiB,sBAAsB,OAAO,CAAC,CACvD,UAAU,YAAY,QAAQ,UAAU,OAAO,SAAS,aAAc,MAAM,QAAQ,YAAW,MAAQ,QAAQ,CAAC,CAChH,UAAU,SAAS,QAAQ,OAAO,OAAO,SAAS,UAAW,MAAM,QAAQ,SAAQ,MAAQ,KAAK,CAAC,CACjG,UAAU,SAAS,QAAQ,QAAQ,SAAS,UAAU,iBAAiB,cAAc,QAAQ,SAAQ,GAAI,KAAK,CAAC;CACpH;CAGA,MAAM,cAAW;EACf,OAAQ,OAAO,MAAM,KAAK,KAAI,EAAA,CAAI,SAAS,wBAAwB,IAAK,SAAS;CACnF;CAGA,MAAM,WAAQ;EACZ,OAAO,KAAK,QAAQ,eAAe;CACrC;CAQA,MAAM,SAAM;EACV,OAAO,KAAK,QAAQ,eAAe;CACrC;CAQA,MAAM,SAAM;E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O,UAAU,EAAA,CAAG,SAAQ;CACjD;CAGA,MAAM,QAAK;EACT,QAAQ,MAAM,KAAK,OAAO,OAAO,EAAA,CAAG,MAAK;CAC3C;CAGA,MAAM,QAAK;EACT,QAAQ,MAAM,KAAK,OAAO,OAAO,EAAA,CAAG,MAAK;CAC3C;CAOA,MAAM,QAAK;EACT,QAAQ,MAAM,KAAK,YAAW,EAAA,CAAI,MAAK;CACzC;CAGA,MAAM,YAAS;EAEb,QAAO,MADe,QAAQ,KAAK,MAAM,KAAK,UAAS,EAAA,CAAI,KAAI,UAAS,MAAM,UAAS,CAAE,CAAC,EACnF,CAAQ,SAAS,IAAI;CAC9B;CASQ,MAAM,OAAO,QAAc;EACjC,IAAI,MAAM,KAAK,QAAO,GACpB,MAAM,IAAI,MACR,mBAAmB,OAAM,2GACe;EAG5C,OAAO,KAAK,YAAW;CACzB"}
|
|
1
|
+
{"version":3,"file":"ngwr-slider-testing.mjs","names":[],"sources":["../../../projects/lib/slider/testing/wr-slider-thumb-harness.ts","../../../projects/lib/slider/testing/wr-slider-harness.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 { ComponentHarness, HarnessPredicate, TestKey } from '@angular/cdk/testing';\n\nimport type { WrSliderThumbHarnessFilters, WrSliderThumbPosition } from './types';\n\n/** How many key presses {@link WrSliderThumbHarness.setValue} spends before it gives up. */\nconst MAX_PRESSES = 1000;\n\n/**\n * Test harness for one thumb of a `<wr-slider>`.\n *\n * A single-thumb slider has exactly one; a `range` one has two, and each thumb\n * is the other's limit — the lower thumb's `aria-valuemax` is wherever the upper\n * thumb is standing, and vice versa. So {@link getMin} / {@link getMax} answer\n * the room THIS thumb has, not the slider's bounds, which is exactly what a\n * screen reader announces and exactly the window {@link setValue} can reach.\n *\n * Every write here is a KEY PRESS, because a drag is not something a unit test\n * can perform — see {@link setValue}.\n *\n * Every press is on the BLOCK axis — `ArrowUp` / `ArrowDown`, `PageUp` /\n * `PageDown`, `Home` / `End` — so the harness means the same thing in both\n * reading directions. That is not a detail: the component's ← / → follow the\n * VISUAL track, so under `dir=\"rtl\"` a right-arrow LOWERS the value, and a\n * harness that pressed it would have `stepUp()` stepping down while every LTR\n * spec stayed green. It cannot detect the direction to compensate either —\n * `Directionality` is injected, not published to the DOM — so it stays on the\n * axis `dir` does not govern.\n *\n * @example\n * ```ts\n * const upper = await slider.getHighThumb();\n *\n * await upper.setValue(90);\n * expect(await upper.getValue()).toBe(90);\n * ```\n *\n * @see https://ngwr.dev/guides/testing\n */\nexport class WrSliderThumbHarness extends ComponentHarness {\n /**\n * The thumb is a real `<button role=\"slider\">`, so it is focusable without a\n * `tabindex` and leaves the tab order by itself when disabled. Anchored on the\n * BEM class rather than on `[role=\"slider\"]`: the class also carries the\n * `--low` / `--high` modifier this harness reads.\n */\n static hostSelector = '.wr-slider__thumb';\n\n /** Build a predicate that narrows the query — pass to `getHarness` / `getAllHarnesses`. */\n static with(options: WrSliderThumbHarnessFilters = {}): HarnessPredicate<WrSliderThumbHarness> {\n return new HarnessPredicate(WrSliderThumbHarness, options)\n .addOption('position', options.position, async (harness, position) => (await harness.getPosition()) === position)\n .addOption('value', options.value, async (harness, value) => (await harness.getValue()) === value)\n .addOption('label', options.label, (harness, label) => HarnessPredicate.stringMatches(harness.getLabel(), label));\n }\n\n /** Which end this thumb is. A single-thumb slider's thumb is the `'low'` one. */\n async getPosition(): Promise<WrSliderThumbPosition> {\n return (await (await this.host()).hasClass('wr-slider__thumb--high')) ? 'high' : 'low';\n }\n\n /** Where the thumb is standing, from `aria-valuenow` — the number a screen reader reads out. */\n async getValue(): Promise<number> {\n return this.numeric('aria-valuenow');\n }\n\n /**\n * The lowest value THIS thumb can reach (`aria-valuemin`).\n *\n * On a range slider's upper thumb that is the lower thumb, not the slider's\n * `min` — the two cannot cross, so the neighbour is the real floor.\n */\n async getMin(): Promise<number> {\n return this.numeric('aria-valuemin');\n }\n\n /**\n * The highest value THIS thumb can reach (`aria-valuemax`).\n *\n * On a range slider's lower thumb that is the upper thumb, not the slider's\n * `max`.\n */\n async getMax(): Promise<number> {\n return this.numeric('aria-valuemax');\n }\n\n /** The thumb's accessible name — `'Value'`, or `'Lower value'` / `'Upper value'` in range mode. */\n async getLabel(): Promise<string | null> {\n return (await this.host()).getAttribute('aria-label');\n }\n\n /** What a screen reader is told this control is. The role is why the arrows mean anything here. */\n async getRole(): Promise<string | null> {\n return (await this.host()).getAttribute('role');\n }\n\n /** Whether the thumb refuses the keyboard. Read from the button's native `disabled`. */\n async isDisabled(): Promise<boolean> {\n return (await this.host()).getProperty<boolean>('disabled');\n }\n\n async focus(): Promise<void> {\n return (await this.host()).focus();\n }\n\n async isFocused(): Promise<boolean> {\n return (await this.host()).isFocused();\n }\n\n /**\n * One step up (`ArrowUp`). A disabled thumb does not move.\n *\n * `ArrowRight` is the same key press in an LTR slider and the OPPOSITE one in\n * an RTL slider, so the vertical arrow is the one that means \"up\" everywhere.\n */\n async stepUp(): Promise<void> {\n return this.press(TestKey.UP_ARROW);\n }\n\n /** One step down (`ArrowDown`; `ArrowLeft` only agrees in LTR — see {@link stepUp}). */\n async stepDown(): Promise<void> {\n return this.press(TestKey.DOWN_ARROW);\n }\n\n /** Ten steps up (`PageUp`; `Shift`+arrow is the same stride). */\n async largeStepUp(): Promise<void> {\n return this.press(TestKey.PAGE_UP);\n }\n\n /** Ten steps down (`PageDown`; `Shift`+arrow is the same stride). */\n async largeStepDown(): Promise<void> {\n return this.press(TestKey.PAGE_DOWN);\n }\n\n /**\n * `Home` — jump to the lowest value this thumb can reach.\n *\n * On a range slider's UPPER thumb that lands on the lower thumb, not on the\n * slider's `min`: the component asks for `min` and then refuses to let the\n * ends cross, so the range collapses instead of inverting.\n */\n async toMin(): Promise<void> {\n return this.press(TestKey.HOME);\n }\n\n /**\n * `End` — jump to the highest value this thumb can reach.\n *\n * On a range slider's LOWER thumb that lands on the upper thumb, not on the\n * slider's `max`, for the same reason as {@link toMin}.\n */\n async toMax(): Promise<void> {\n return this.press(TestKey.END);\n }\n\n /**\n * Walk the thumb to `value` FROM THE KEYBOARD — `PageUp` / `PageDown` for the\n * distance, arrows for the last stretch, `Home` / `End` for the bounds. That\n * is the accessible path, and the only one a unit test can trust.\n *\n * There is deliberately no drag. jsdom has no layout: the track measures 0×0\n * and `getBoundingClientRect()` answers all zeros, while the component turns a\n * pointer into a value by dividing the offset by the track width. Every\n * positive offset therefore divides by zero, clamps to a ratio of 1 and writes\n * the slider's MAX — quietly, with no error to notice. A coordinate cannot\n * mean anything here.\n *\n * It costs one press per stride, so the walk is not free: crossing most of a\n * 0–100 range costs ~19 presses at `step=\"1\"` and ~109 at `step=\"0.1\"`.\n * Landing exactly on a bound is one press, whatever the step. The walk gives\n * up after 1000 presses — a 0–100 range reaches that at `step=\"0.01\"` or finer\n * — and throws rather than spin.\n *\n * A bound the step grid misses is announced but not reachable: `aria-valuemax`\n * is the `max` input, while the component snaps every key press onto whole\n * steps from `min`, so `max=\"100\" step=\"3\"` stops at 99. That is the off-grid\n * throw, arriving for `setValue(100)`.\n *\n * Either the thumb ends up exactly on `value` or this throws: when `value` is\n * outside the thumb's window (the other thumb is one end of it in range mode),\n * when the thumb is disabled, and when `value` is not on the step grid — on\n * the last one the thumb is left at the nearest value it could reach.\n */\n async setValue(value: number): Promise<void> {\n if (await this.isDisabled()) {\n throw new Error('WrSliderThumbHarness.setValue(): the slider is disabled, so the keyboard cannot move it.');\n }\n\n const [min, max] = [await this.getMin(), await this.getMax()];\n if (value < min || value > max) {\n throw new Error(\n `WrSliderThumbHarness.setValue(): ${value} is outside the [${min}, ${max}] window this thumb can ` +\n 'reach. On a range slider the other thumb is one end of that window — move it first.'\n );\n }\n\n let current = await this.getValue();\n if (current === value) return;\n // The bounds are one key press, and on a range thumb `Home` / `End` stop at\n // the neighbour — which is precisely this window's end. The landing is still\n // checked: a `max` that is not a whole number of steps from `min` is\n // announced by `aria-valuemax` and refused by the component's snapping.\n if (value === min || value === max) {\n await (value === min ? this.toMin() : this.toMax());\n return this.assertSettled(await this.getValue(), value, min);\n }\n\n let presses = 0;\n // Start on the ten-step stride: neither stride is published to the DOM, so\n // the only way to learn one is to take it and look. One overshoot is pressed\n // back off and the rest of the walk goes a single step at a time.\n let striding = true;\n\n while (current !== value) {\n if (presses >= MAX_PRESSES) {\n throw new Error(\n `WrSliderThumbHarness.setValue(): gave up walking to ${value} after ${MAX_PRESSES} key presses ` +\n `(reached ${current}). A step this fine is not something a keyboard reaches — write the ` +\n 'slider through its `[(value)]` model instead.'\n );\n }\n\n // Re-derived every pass so the walk follows wherever the thumb actually\n // landed rather than where a stride aimed. It never has to reverse: the\n // window check above keeps the target inside [min, max], so pressing back\n // off an overshoot lands at or short of where the stride began — on the\n // same side of the target it started on.\n const direction: 1 | -1 = value > current ? 1 : -1;\n await this.press(this.strideKey(direction, striding));\n presses++;\n\n const next = await this.getValue();\n // Nothing moved: the thumb is pinned against a bound or its neighbour, and\n // pressing again would only spin. The final check below reports where.\n if (next === current) break;\n\n const overshot = direction === 1 ? next > value : next < value;\n current = next;\n if (!overshot) continue;\n\n await this.press(this.strideKey(direction === 1 ? -1 : 1, striding));\n presses++;\n current = await this.getValue();\n\n // Single steps straddling the target means it is not on the step grid.\n if (!striding) break;\n striding = false;\n }\n\n this.assertSettled(current, value, min);\n }\n\n /**\n * The landing check every path through {@link setValue} ends on: exactly the\n * value asked for, or an error naming where the thumb stopped instead.\n */\n private assertSettled(current: number, value: number, min: number): void {\n if (current === value) return;\n throw new Error(\n `WrSliderThumbHarness.setValue(): the keyboard settled on ${current} instead of ${value}. The thumb ` +\n `moves in whole steps from ${min}, so only values on that grid are reachable.`\n );\n }\n\n /** The key that moves the thumb one stride in `direction`. */\n private strideKey(direction: 1 | -1, striding: boolean): TestKey {\n if (striding) return direction === 1 ? TestKey.PAGE_UP : TestKey.PAGE_DOWN;\n // The vertical arrows, for the reason {@link stepUp} gives: the horizontal\n // pair swaps meaning under `dir=\"rtl\"`, which would send the fine stretch of\n // the walk away from its target.\n return direction === 1 ? TestKey.UP_ARROW : TestKey.DOWN_ARROW;\n }\n\n /**\n * Press a key on the thumb.\n *\n * `sendKeys` focuses the element first, so this is the whole gesture a user\n * makes — the component listens for `keydown` on the thumb itself.\n */\n private async press(key: TestKey): Promise<void> {\n return (await this.host()).sendKeys(key);\n }\n\n /**\n * One of the ARIA range attributes as a number.\n *\n * Throws instead of handing back `NaN`: a slider whose `aria-valuenow` is not\n * a number is broken in a way every later assertion would describe badly.\n */\n private async numeric(attribute: string): Promise<number> {\n const raw = await (await this.host()).getAttribute(attribute);\n const value = raw === null ? Number.NaN : Number.parseFloat(raw);\n\n if (Number.isNaN(value)) {\n throw new Error(`WrSliderThumbHarness: the thumb's ${attribute} is ${JSON.stringify(raw)}, not a number.`);\n }\n return value;\n }\n}\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { ComponentHarness, HarnessPredicate } from '@angular/cdk/testing';\n\nimport type { WrSliderValue } from 'ngwr/slider';\n\nimport type { WrSliderHarnessFilters, WrSliderThumbHarnessFilters } from './types';\nimport { WrSliderThumbHarness } from './wr-slider-thumb-harness';\n\n/** Element-wise comparison for the `value` filter — a tuple never matches a plain number. */\nfunction sameValue(actual: WrSliderValue, expected: WrSliderValue): boolean {\n if (typeof actual === 'number') return actual === expected;\n if (typeof expected === 'number') return false;\n return actual[0] === expected[0] && actual[1] === expected[1];\n}\n\n/**\n * Test harness for `<wr-slider>` — single-thumb and `range`.\n *\n * Every NUMBER it reads comes off the thumbs' ARIA range trio (`aria-valuenow`,\n * `aria-valuemin`, `aria-valuemax`), which is what a screen reader is told and\n * the only place the slider publishes its value. The mode comes off the host's\n * `wr-slider--range` class and {@link getLabelText} off the rendered text.\n *\n * Everything it WRITES is a key press. A slider is a pointer control, but a\n * pointer control cannot be driven by coordinates in jsdom — there is no layout,\n * so the track measures 0×0 and the component divides every offset by that\n * width: a positive one writes the slider's MAX and `clientX: 0` writes `NaN`,\n * neither of them the value asked for. The keyboard is both the accessible path\n * and the only honest one here; {@link WrSliderThumbHarness.setValue} spells out\n * what the walk costs, and {@link WrSliderThumbHarness} why every one of those\n * presses is on the block axis, which `dir` does not turn around.\n *\n * The `step` is deliberately not readable: the component publishes it nowhere in\n * the DOM (ARIA has no attribute for it), so a spec that needs the number should\n * measure it — `stepUp()` moves by exactly one step.\n *\n * @example\n * ```ts\n * const volume = await loader.getHarness(WrSliderHarness);\n *\n * await volume.setValue(70);\n * expect(await volume.getValue()).toBe(70);\n *\n * const span = await loader.getHarness(WrSliderHarness.with({ range: true }));\n * await span.setRange(30, 60);\n * ```\n *\n * @see https://ngwr.dev/guides/testing\n */\nexport class WrSliderHarness extends ComponentHarness {\n static hostSelector = 'wr-slider';\n\n /** Build a predicate that narrows the query — pass to `getHarness` / `getAllHarnesses`. */\n static with(options: WrSliderHarnessFilters = {}): HarnessPredicate<WrSliderHarness> {\n return new HarnessPredicate(WrSliderHarness, options)\n .addOption('value', options.value, async (harness, value) => sameValue(await harness.getValue(), value))\n .addOption('range', options.range, async (harness, range) => (await harness.isRange()) === range)\n .addOption('disabled', options.disabled, async (harness, disabled) => (await harness.isDisabled()) === disabled)\n .addOption('labelText', options.labelText, (harness, text) =>\n HarnessPredicate.stringMatches(harness.getLabelText(), text)\n );\n }\n\n /** Whether the slider has two thumbs and answers with a `[low, high]` tuple. */\n async isRange(): Promise<boolean> {\n return (await this.host()).hasClass('wr-slider--range');\n }\n\n /**\n * Whether the slider refuses interaction.\n *\n * Read from the thumb's native `disabled` rather than from the\n * `wr-slider--disabled` class: the class is paint, while `disabled` on the\n * button is what takes the thumb out of the tab order and what assistive tech\n * reports.\n */\n async isDisabled(): Promise<boolean> {\n return (await this.getLowThumb()).isDisabled();\n }\n\n /**\n * The current value, in the shape the model uses: a plain number for one\n * thumb, `[low, high]` for two.\n */\n async getValue(): Promise<WrSliderValue> {\n const values = await Promise.all((await this.getThumbs()).map(thumb => thumb.getValue()));\n return values.length > 1 ? ([values[0], values[1]] as const) : values[0];\n }\n\n /** The slider's lower bound. */\n async getMin(): Promise<number> {\n return (await this.getThumbs())[0].getMin();\n }\n\n /**\n * The slider's upper bound.\n *\n * Taken from the LAST thumb, because in range mode the thumbs bound each\n * other: the lower one's `aria-valuemax` is wherever the upper one is\n * standing, so only the upper thumb knows the real ceiling.\n */\n async getMax(): Promise<number> {\n const thumbs = await this.getThumbs();\n return thumbs[thumbs.length - 1].getMax();\n }\n\n /**\n * The text the slider prints under the track, or `null` when `showValue` is\n * off.\n *\n * A range slider joins its ends with an EN DASH — `'20 – 80'`, U+2013 — so an\n * assertion typed with a hyphen will not match.\n */\n async getLabelText(): Promise<string | null> {\n const label = await this.locatorForOptional('.wr-slider__label')();\n return label ? label.text() : null;\n }\n\n /** The slider's thumbs in DOM order: the lower one first. */\n async getThumbs(filters: WrSliderThumbHarnessFilters = {}): Promise<WrSliderThumbHarness[]> {\n return this.locatorForAll(WrSliderThumbHarness.with(filters))();\n }\n\n /** The only thumb of a single-thumb slider, or the lower one of a range slider. */\n async getLowThumb(): Promise<WrSliderThumbHarness> {\n return this.locatorFor(WrSliderThumbHarness.with({ position: 'low' }))();\n }\n\n /** The upper thumb. Throws on a single-thumb slider, which has no such part. */\n async getHighThumb(): Promise<WrSliderThumbHarness> {\n const thumb = await this.locatorForOptional(WrSliderThumbHarness.with({ position: 'high' }))();\n if (!thumb) {\n throw new Error('WrSliderHarness.getHighThumb(): this slider has one thumb — only a `range` slider has two.');\n }\n return thumb;\n }\n\n /**\n * Walk the slider to `value` from the keyboard.\n *\n * Single-thumb only — {@link setRange} moves both ends. See\n * {@link WrSliderThumbHarness.setValue} for what the walk costs and when it\n * throws.\n */\n async setValue(value: number): Promise<void> {\n return (await this.single('setValue')).setValue(value);\n }\n\n /**\n * Walk both ends of a range slider to `[low, high]`.\n *\n * The far end moves FIRST. The thumbs bound each other, so writing `[90, 95]`\n * over `[20, 80]` lower-end-first would be refused outright — 90 is outside\n * the `[0, 80]` window the upper thumb leaves the lower one.\n */\n async setRange(low: number, high: number): Promise<void> {\n if (!(await this.isRange())) {\n throw new Error('WrSliderHarness.setRange(): this slider has one thumb — add `range` to it, or call setValue().');\n }\n if (low > high) {\n throw new Error(`WrSliderHarness.setRange(): ${low} is above ${high}, and the thumbs cannot cross.`);\n }\n\n const lowThumb = await this.getLowThumb();\n const highThumb = await this.getHighThumb();\n\n if (high >= (await highThumb.getValue())) {\n await highThumb.setValue(high);\n await lowThumb.setValue(low);\n return;\n }\n\n await lowThumb.setValue(low);\n await highThumb.setValue(high);\n }\n\n /** One step up (`ArrowUp`). Single-thumb only. A disabled slider does not move. */\n async stepUp(): Promise<void> {\n return (await this.single('stepUp')).stepUp();\n }\n\n /** One step down (`ArrowDown`). Single-thumb only. A disabled slider does not move. */\n async stepDown(): Promise<void> {\n return (await this.single('stepDown')).stepDown();\n }\n\n /** `Home` — jump to the slider's `min`. Single-thumb only. */\n async toMin(): Promise<void> {\n return (await this.single('toMin')).toMin();\n }\n\n /** `End` — jump to the slider's `max`. Single-thumb only. */\n async toMax(): Promise<void> {\n return (await this.single('toMax')).toMax();\n }\n\n /**\n * Move keyboard focus to the slider's first thumb. A range slider's thumbs are\n * two separate tab stops (both are plain buttons — there is no roving\n * `tabindex`), so reach the other one through {@link getHighThumb}.\n */\n async focus(): Promise<void> {\n return (await this.getLowThumb()).focus();\n }\n\n /** Whether any of the slider's thumbs holds focus. */\n async isFocused(): Promise<boolean> {\n const focused = await Promise.all((await this.getThumbs()).map(thumb => thumb.isFocused()));\n return focused.includes(true);\n }\n\n /**\n * The one thumb a single-thumb convenience call means.\n *\n * Range mode gets an error rather than a guess: \"step this slider up\" has two\n * possible answers there, and picking one silently is how a spec ends up\n * asserting against the end it did not move.\n */\n private async single(caller: string): Promise<WrSliderThumbHarness> {\n if (await this.isRange()) {\n throw new Error(\n `WrSliderHarness.${caller}(): this slider has two thumbs — use setRange(), or reach for one end ` +\n 'with getLowThumb() / getHighThumb().'\n );\n }\n return this.getLowThumb();\n }\n}\n"],"mappings":";;;;;;;AAYA,MAAM,cAAc;AAiCpB,IAAa,uBAAb,MAAa,6BAA6B,iBAAgB;CAOxD,OAAO,eAAe;CAGtB,OAAO,KAAK,UAAuC,CAAA,GAAE;EACnD,OAAO,IAAI,iBAAiB,sBAAsB,OAAO,CAAC,CACvD,UAAU,YAAY,QAAQ,UAAU,OAAO,SAAS,aAAc,MAAM,QAAQ,YAAW,MAAQ,QAAQ,CAAC,CAChH,UAAU,SAAS,QAAQ,OAAO,OAAO,SAAS,UAAW,MAAM,QAAQ,SAAQ,MAAQ,KAAK,CAAC,CACjG,UAAU,SAAS,QAAQ,QAAQ,SAAS,UAAU,iBAAiB,cAAc,QAAQ,SAAQ,GAAI,KAAK,CAAC;CACpH;CAGA,MAAM,cAAW;EACf,OAAQ,OAAO,MAAM,KAAK,KAAI,EAAA,CAAI,SAAS,wBAAwB,IAAK,SAAS;CACnF;CAGA,MAAM,WAAQ;EACZ,OAAO,KAAK,QAAQ,eAAe;CACrC;CAQA,MAAM,SAAM;EACV,OAAO,KAAK,QAAQ,eAAe;CACrC;CAQA,MAAM,SAAM;EACV,OAAO,KAAK,QAAQ,eAAe;CACrC;CAGA,MAAM,WAAQ;EACZ,QAAQ,MAAM,KAAK,KAAI,EAAA,CAAI,aAAa,YAAY;CACtD;CAGA,MAAM,UAAO;EACX,QAAQ,MAAM,KAAK,KAAI,EAAA,CAAI,aAAa,MAAM;CAChD;CAGA,MAAM,aAAU;EACd,QAAQ,MAAM,KAAK,KAAI,EAAA,CAAI,YAAqB,UAAU;CAC5D;CAEA,MAAM,QAAK;EACT,QAAQ,MAAM,KAAK,KAAI,EAAA,CAAI,MAAK;CAClC;CAEA,MAAM,YAAS;EACb,QAAQ,MAAM,KAAK,KAAI,EAAA,CAAI,UAAS;CACtC;CAQA,MAAM,SAAM;EACV,OA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AI,MAAM,KAAK,QAAO,GACpB,MAAM,IAAI,MACR,mBAAmB,OAAM,2GACe;EAG5C,OAAO,KAAK,YAAW;CACzB"}
|
package/fesm2022/ngwr-slider.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as i0 from "@angular/core";
|
|
2
2
|
import { Component, ViewEncapsulation, computed, effect, inject, input, model, output, signal, untracked, viewChild } from "@angular/core";
|
|
3
3
|
import { coerceBooleanProperty, coerceNumberProperty } from "@angular/cdk/coercion";
|
|
4
|
-
import {
|
|
4
|
+
import { wrCheckStyles, wrClamp, wrRound } from "ngwr/utils";
|
|
5
5
|
import { useI18nText } from "ngwr/i18n";
|
|
6
6
|
import { Directionality } from "@angular/cdk/bidi";
|
|
7
7
|
import { WR_FORM_FIELD, useFormFieldAria } from "ngwr/form";
|
|
@@ -44,8 +44,8 @@ var WrSlider = class WrSlider {
|
|
|
44
44
|
...ngDevMode ? { debugName: "readonly" } : /* istanbul ignore next */ {},
|
|
45
45
|
transform: coerceBooleanProperty
|
|
46
46
|
});
|
|
47
|
-
|
|
48
|
-
...ngDevMode ? { debugName: "
|
|
47
|
+
showValue = input(true, {
|
|
48
|
+
...ngDevMode ? { debugName: "showValue" } : /* istanbul ignore next */ {},
|
|
49
49
|
transform: coerceBooleanProperty
|
|
50
50
|
});
|
|
51
51
|
labelWith = input(...ngDevMode ? [void 0, { debugName: "labelWith" }] : /* istanbul ignore next */ []);
|
|
@@ -71,7 +71,7 @@ var WrSlider = class WrSlider {
|
|
|
71
71
|
lowThumb = viewChild.required("lowThumb", ...ngDevMode ? [{ debugName: "lowThumb" }] : /* istanbul ignore next */ []);
|
|
72
72
|
dir = inject(Directionality, { optional: true });
|
|
73
73
|
classes = computed(() => {
|
|
74
|
-
const parts = [
|
|
74
|
+
const parts = [];
|
|
75
75
|
if (this.range()) parts.push("wr-slider--range");
|
|
76
76
|
if (this.disabled()) parts.push("wr-slider--disabled");
|
|
77
77
|
else if (this.readonly()) parts.push("wr-slider--readonly");
|
|
@@ -182,7 +182,7 @@ var WrSlider = class WrSlider {
|
|
|
182
182
|
valueAt(event) {
|
|
183
183
|
const rect = this.track().nativeElement.getBoundingClientRect();
|
|
184
184
|
const offset = this.isRtl() ? rect.right - event.clientX : event.clientX - rect.left;
|
|
185
|
-
const ratio =
|
|
185
|
+
const ratio = wrClamp(offset / rect.width, 0, 1);
|
|
186
186
|
return this.minValue() + ratio * (this.maxValue() - this.minValue());
|
|
187
187
|
}
|
|
188
188
|
updateFromEvent(event, thumb) {
|
|
@@ -208,10 +208,10 @@ var WrSlider = class WrSlider {
|
|
|
208
208
|
}
|
|
209
209
|
snap(value) {
|
|
210
210
|
const stepped = Math.round((value - this.minValue()) / this.step()) * this.step() + this.minValue();
|
|
211
|
-
return this.clampToBounds(
|
|
211
|
+
return this.clampToBounds(wrRound(stepped, 6));
|
|
212
212
|
}
|
|
213
213
|
clampToBounds(v) {
|
|
214
|
-
return
|
|
214
|
+
return wrClamp(v, this.minValue(), this.maxValue());
|
|
215
215
|
}
|
|
216
216
|
percentOf(v) {
|
|
217
217
|
const span = this.maxValue() - this.minValue();
|
|
@@ -279,9 +279,9 @@ var WrSlider = class WrSlider {
|
|
|
279
279
|
isRequired: false,
|
|
280
280
|
transformFunction: null
|
|
281
281
|
},
|
|
282
|
-
|
|
283
|
-
classPropertyName: "
|
|
284
|
-
publicName: "
|
|
282
|
+
showValue: {
|
|
283
|
+
classPropertyName: "showValue",
|
|
284
|
+
publicName: "showValue",
|
|
285
285
|
isSignal: true,
|
|
286
286
|
isRequired: false,
|
|
287
287
|
transformFunction: null
|
|
@@ -321,7 +321,8 @@ var WrSlider = class WrSlider {
|
|
|
321
321
|
},
|
|
322
322
|
host: {
|
|
323
323
|
listeners: { "focusout": "onFocusOut($event)" },
|
|
324
|
-
properties: { "class": "classes()" }
|
|
324
|
+
properties: { "class": "classes()" },
|
|
325
|
+
classAttribute: "wr-slider"
|
|
325
326
|
},
|
|
326
327
|
viewQueries: [{
|
|
327
328
|
propertyName: "track",
|
|
@@ -337,7 +338,7 @@ var WrSlider = class WrSlider {
|
|
|
337
338
|
isSignal: true
|
|
338
339
|
}],
|
|
339
340
|
ngImport: i0,
|
|
340
|
-
template: "<div #track class=\"wr-slider__track\" (pointerdown)=\"onTrackPointerDown($event)\">\n <!--\n Positioned on the INLINE axis, not with `left`: `inset-inline-start` is the\n same edge in LTR and mirrors under `dir=\"rtl\"`, so the track paints itself\n the right way round without the component reading a direction to draw.\n -->\n <span class=\"wr-slider__fill\" [style.inset-inline-start.%]=\"fillStart()\" [style.width.%]=\"fillWidth()\"></span>\n\n <button\n #lowThumb\n type=\"button\"\n class=\"wr-slider__thumb wr-slider__thumb--low\"\n role=\"slider\"\n [attr.id]=\"thumbId()\"\n [style.inset-inline-start.%]=\"lowPercent()\"\n [disabled]=\"disabled()\"\n [attr.aria-valuemin]=\"min()\"\n [attr.aria-valuemax]=\"range() ? high() : max()\"\n [attr.aria-valuenow]=\"low()\"\n [attr.aria-valuetext]=\"lowText()\"\n [attr.aria-label]=\"lowNameLabel()\"\n [attr.aria-labelledby]=\"labelledBy()\"\n [attr.aria-readonly]=\"readonly() || null\"\n [attr.aria-describedby]=\"describedBy()\"\n [attr.aria-invalid]=\"ariaInvalid()\"\n (pointerdown)=\"onPointerDown($event, 'low')\"\n (keydown)=\"onKey($event, 'low')\"\n ></button>\n\n @if (range()) {\n <button\n type=\"button\"\n class=\"wr-slider__thumb wr-slider__thumb--high\"\n role=\"slider\"\n [style.inset-inline-start.%]=\"highPercent()\"\n [disabled]=\"disabled()\"\n [attr.aria-valuemin]=\"low()\"\n [attr.aria-valuemax]=\"max()\"\n [attr.aria-valuenow]=\"high()\"\n [attr.aria-valuetext]=\"highText()\"\n [attr.aria-label]=\"resolvedUpperLabel()\"\n [attr.aria-readonly]=\"readonly() || null\"\n (pointerdown)=\"onPointerDown($event, 'high')\"\n (keydown)=\"onKey($event, 'high')\"\n ></button>\n }\n</div>\n\n@if (
|
|
341
|
+
template: "<div #track class=\"wr-slider__track\" (pointerdown)=\"onTrackPointerDown($event)\">\n <!--\n Positioned on the INLINE axis, not with `left`: `inset-inline-start` is the\n same edge in LTR and mirrors under `dir=\"rtl\"`, so the track paints itself\n the right way round without the component reading a direction to draw.\n -->\n <span class=\"wr-slider__fill\" [style.inset-inline-start.%]=\"fillStart()\" [style.width.%]=\"fillWidth()\"></span>\n\n <button\n #lowThumb\n type=\"button\"\n class=\"wr-slider__thumb wr-slider__thumb--low\"\n role=\"slider\"\n [attr.id]=\"thumbId()\"\n [style.inset-inline-start.%]=\"lowPercent()\"\n [disabled]=\"disabled()\"\n [attr.aria-valuemin]=\"min()\"\n [attr.aria-valuemax]=\"range() ? high() : max()\"\n [attr.aria-valuenow]=\"low()\"\n [attr.aria-valuetext]=\"lowText()\"\n [attr.aria-label]=\"lowNameLabel()\"\n [attr.aria-labelledby]=\"labelledBy()\"\n [attr.aria-readonly]=\"readonly() || null\"\n [attr.aria-describedby]=\"describedBy()\"\n [attr.aria-invalid]=\"ariaInvalid()\"\n (pointerdown)=\"onPointerDown($event, 'low')\"\n (keydown)=\"onKey($event, 'low')\"\n ></button>\n\n @if (range()) {\n <button\n type=\"button\"\n class=\"wr-slider__thumb wr-slider__thumb--high\"\n role=\"slider\"\n [style.inset-inline-start.%]=\"highPercent()\"\n [disabled]=\"disabled()\"\n [attr.aria-valuemin]=\"low()\"\n [attr.aria-valuemax]=\"max()\"\n [attr.aria-valuenow]=\"high()\"\n [attr.aria-valuetext]=\"highText()\"\n [attr.aria-label]=\"resolvedUpperLabel()\"\n [attr.aria-readonly]=\"readonly() || null\"\n (pointerdown)=\"onPointerDown($event, 'high')\"\n (keydown)=\"onKey($event, 'high')\"\n ></button>\n }\n</div>\n\n@if (showValue()) {\n <div class=\"wr-slider__label\">{{ label() }}</div>\n}\n",
|
|
341
342
|
encapsulation: i0.ViewEncapsulation.None
|
|
342
343
|
});
|
|
343
344
|
};
|
|
@@ -352,10 +353,11 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
352
353
|
selector: "wr-slider",
|
|
353
354
|
encapsulation: ViewEncapsulation.None,
|
|
354
355
|
host: {
|
|
356
|
+
class: "wr-slider",
|
|
355
357
|
"[class]": "classes()",
|
|
356
358
|
"(focusout)": "onFocusOut($event)"
|
|
357
359
|
},
|
|
358
|
-
template: "<div #track class=\"wr-slider__track\" (pointerdown)=\"onTrackPointerDown($event)\">\n <!--\n Positioned on the INLINE axis, not with `left`: `inset-inline-start` is the\n same edge in LTR and mirrors under `dir=\"rtl\"`, so the track paints itself\n the right way round without the component reading a direction to draw.\n -->\n <span class=\"wr-slider__fill\" [style.inset-inline-start.%]=\"fillStart()\" [style.width.%]=\"fillWidth()\"></span>\n\n <button\n #lowThumb\n type=\"button\"\n class=\"wr-slider__thumb wr-slider__thumb--low\"\n role=\"slider\"\n [attr.id]=\"thumbId()\"\n [style.inset-inline-start.%]=\"lowPercent()\"\n [disabled]=\"disabled()\"\n [attr.aria-valuemin]=\"min()\"\n [attr.aria-valuemax]=\"range() ? high() : max()\"\n [attr.aria-valuenow]=\"low()\"\n [attr.aria-valuetext]=\"lowText()\"\n [attr.aria-label]=\"lowNameLabel()\"\n [attr.aria-labelledby]=\"labelledBy()\"\n [attr.aria-readonly]=\"readonly() || null\"\n [attr.aria-describedby]=\"describedBy()\"\n [attr.aria-invalid]=\"ariaInvalid()\"\n (pointerdown)=\"onPointerDown($event, 'low')\"\n (keydown)=\"onKey($event, 'low')\"\n ></button>\n\n @if (range()) {\n <button\n type=\"button\"\n class=\"wr-slider__thumb wr-slider__thumb--high\"\n role=\"slider\"\n [style.inset-inline-start.%]=\"highPercent()\"\n [disabled]=\"disabled()\"\n [attr.aria-valuemin]=\"low()\"\n [attr.aria-valuemax]=\"max()\"\n [attr.aria-valuenow]=\"high()\"\n [attr.aria-valuetext]=\"highText()\"\n [attr.aria-label]=\"resolvedUpperLabel()\"\n [attr.aria-readonly]=\"readonly() || null\"\n (pointerdown)=\"onPointerDown($event, 'high')\"\n (keydown)=\"onKey($event, 'high')\"\n ></button>\n }\n</div>\n\n@if (
|
|
360
|
+
template: "<div #track class=\"wr-slider__track\" (pointerdown)=\"onTrackPointerDown($event)\">\n <!--\n Positioned on the INLINE axis, not with `left`: `inset-inline-start` is the\n same edge in LTR and mirrors under `dir=\"rtl\"`, so the track paints itself\n the right way round without the component reading a direction to draw.\n -->\n <span class=\"wr-slider__fill\" [style.inset-inline-start.%]=\"fillStart()\" [style.width.%]=\"fillWidth()\"></span>\n\n <button\n #lowThumb\n type=\"button\"\n class=\"wr-slider__thumb wr-slider__thumb--low\"\n role=\"slider\"\n [attr.id]=\"thumbId()\"\n [style.inset-inline-start.%]=\"lowPercent()\"\n [disabled]=\"disabled()\"\n [attr.aria-valuemin]=\"min()\"\n [attr.aria-valuemax]=\"range() ? high() : max()\"\n [attr.aria-valuenow]=\"low()\"\n [attr.aria-valuetext]=\"lowText()\"\n [attr.aria-label]=\"lowNameLabel()\"\n [attr.aria-labelledby]=\"labelledBy()\"\n [attr.aria-readonly]=\"readonly() || null\"\n [attr.aria-describedby]=\"describedBy()\"\n [attr.aria-invalid]=\"ariaInvalid()\"\n (pointerdown)=\"onPointerDown($event, 'low')\"\n (keydown)=\"onKey($event, 'low')\"\n ></button>\n\n @if (range()) {\n <button\n type=\"button\"\n class=\"wr-slider__thumb wr-slider__thumb--high\"\n role=\"slider\"\n [style.inset-inline-start.%]=\"highPercent()\"\n [disabled]=\"disabled()\"\n [attr.aria-valuemin]=\"low()\"\n [attr.aria-valuemax]=\"max()\"\n [attr.aria-valuenow]=\"high()\"\n [attr.aria-valuetext]=\"highText()\"\n [attr.aria-label]=\"resolvedUpperLabel()\"\n [attr.aria-readonly]=\"readonly() || null\"\n (pointerdown)=\"onPointerDown($event, 'high')\"\n (keydown)=\"onKey($event, 'high')\"\n ></button>\n }\n</div>\n\n@if (showValue()) {\n <div class=\"wr-slider__label\">{{ label() }}</div>\n}\n"
|
|
359
361
|
}]
|
|
360
362
|
}],
|
|
361
363
|
ctorParameters: () => [],
|
|
@@ -408,11 +410,11 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
408
410
|
required: false
|
|
409
411
|
}]
|
|
410
412
|
}],
|
|
411
|
-
|
|
413
|
+
showValue: [{
|
|
412
414
|
type: i0.Input,
|
|
413
415
|
args: [{
|
|
414
416
|
isSignal: true,
|
|
415
|
-
alias: "
|
|
417
|
+
alias: "showValue",
|
|
416
418
|
required: false
|
|
417
419
|
}]
|
|
418
420
|
}],
|