ngwr 16.2.0 → 16.4.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/badge/styles/_tag.scss +73 -1
- package/calendar/styles/_index.scss +22 -0
- package/carousel/styles/_index.scss +53 -1
- package/cascader/styles/_rules.scss +7 -0
- package/color-picker/styles/_index.scss +21 -0
- package/date-picker/styles/_index.scss +19 -0
- package/dropdown/styles/_index.scss +13 -19
- package/fesm2022/ngwr-affix.mjs +3 -3
- package/fesm2022/ngwr-alert-testing.mjs +70 -0
- package/fesm2022/ngwr-alert-testing.mjs.map +1 -0
- package/fesm2022/ngwr-alert.mjs +3 -3
- package/fesm2022/ngwr-anchor.mjs +17 -6
- package/fesm2022/ngwr-anchor.mjs.map +1 -1
- package/fesm2022/ngwr-animations-aurora.mjs +3 -3
- package/fesm2022/ngwr-animations-blur-reveal.mjs +3 -3
- package/fesm2022/ngwr-animations-click-sparks.mjs +3 -3
- package/fesm2022/ngwr-animations-confetti.mjs +3 -3
- package/fesm2022/ngwr-animations-decode.mjs +3 -3
- package/fesm2022/ngwr-animations-destruct.mjs +3 -3
- package/fesm2022/ngwr-animations-dot-grid.mjs +3 -3
- package/fesm2022/ngwr-animations-falling-letters.mjs +3 -3
- package/fesm2022/ngwr-animations-flow-lines.mjs +3 -3
- package/fesm2022/ngwr-animations-fluid-cursor.mjs +3 -3
- package/fesm2022/ngwr-animations-glitch.mjs +3 -3
- package/fesm2022/ngwr-animations-glow-border.mjs +3 -3
- package/fesm2022/ngwr-animations-gradient-flow.mjs +3 -3
- package/fesm2022/ngwr-animations-marquee.mjs +3 -3
- package/fesm2022/ngwr-animations-orbit.mjs +3 -3
- package/fesm2022/ngwr-animations-reveal.mjs +3 -3
- package/fesm2022/ngwr-animations-ripple-grid.mjs +3 -3
- package/fesm2022/ngwr-animations-rotate-reveal.mjs +3 -3
- package/fesm2022/ngwr-animations-shimmer.mjs +3 -3
- package/fesm2022/ngwr-animations-spotlight.mjs +3 -3
- package/fesm2022/ngwr-animations-thread-lines.mjs +3 -3
- package/fesm2022/ngwr-animations-tilt.mjs +3 -3
- package/fesm2022/ngwr-animations-typewriter.mjs +3 -3
- package/fesm2022/ngwr-avatar.mjs +3 -3
- package/fesm2022/ngwr-back-top.mjs +3 -3
- package/fesm2022/ngwr-badge.mjs +129 -11
- package/fesm2022/ngwr-badge.mjs.map +1 -1
- package/fesm2022/ngwr-breadcrumbs-testing.mjs +83 -0
- package/fesm2022/ngwr-breadcrumbs-testing.mjs.map +1 -0
- package/fesm2022/ngwr-breadcrumbs.mjs +8 -8
- package/fesm2022/ngwr-breadcrumbs.mjs.map +1 -1
- package/fesm2022/ngwr-burger-testing.mjs +45 -0
- package/fesm2022/ngwr-burger-testing.mjs.map +1 -0
- package/fesm2022/ngwr-burger.mjs +3 -3
- package/fesm2022/ngwr-button.mjs +6 -6
- package/fesm2022/ngwr-calendar-testing.mjs +18 -0
- package/fesm2022/ngwr-calendar-testing.mjs.map +1 -1
- package/fesm2022/ngwr-calendar.mjs +500 -73
- package/fesm2022/ngwr-calendar.mjs.map +1 -1
- package/fesm2022/ngwr-card.mjs +9 -9
- package/fesm2022/ngwr-carousel-testing.mjs +24 -1
- package/fesm2022/ngwr-carousel-testing.mjs.map +1 -1
- package/fesm2022/ngwr-carousel.mjs +73 -10
- package/fesm2022/ngwr-carousel.mjs.map +1 -1
- package/fesm2022/ngwr-cascader.mjs +45 -37
- package/fesm2022/ngwr-cascader.mjs.map +1 -1
- package/fesm2022/ngwr-charts-bar-chart.mjs +5 -4
- package/fesm2022/ngwr-charts-bar-chart.mjs.map +1 -1
- package/fesm2022/ngwr-charts-boxplot-chart.mjs +3 -3
- package/fesm2022/ngwr-charts-bullet-chart.mjs +3 -3
- package/fesm2022/ngwr-charts-calendar-heatmap.mjs +3 -3
- package/fesm2022/ngwr-charts-candlestick-chart.mjs +3 -3
- package/fesm2022/ngwr-charts-chart-legend.mjs +26 -11
- package/fesm2022/ngwr-charts-chart-legend.mjs.map +1 -1
- package/fesm2022/ngwr-charts-core.mjs +3 -3
- package/fesm2022/ngwr-charts-donut-chart.mjs +5 -4
- package/fesm2022/ngwr-charts-donut-chart.mjs.map +1 -1
- package/fesm2022/ngwr-charts-funnel-chart.mjs +3 -3
- package/fesm2022/ngwr-charts-gauge.mjs +3 -3
- package/fesm2022/ngwr-charts-heatmap-chart.mjs +3 -3
- package/fesm2022/ngwr-charts-line-chart-testing.mjs +3 -2
- package/fesm2022/ngwr-charts-line-chart-testing.mjs.map +1 -1
- package/fesm2022/ngwr-charts-line-chart.mjs +17 -7
- package/fesm2022/ngwr-charts-line-chart.mjs.map +1 -1
- package/fesm2022/ngwr-charts-meter-group.mjs +5 -4
- package/fesm2022/ngwr-charts-meter-group.mjs.map +1 -1
- package/fesm2022/ngwr-charts-radar-chart.mjs +5 -4
- package/fesm2022/ngwr-charts-radar-chart.mjs.map +1 -1
- package/fesm2022/ngwr-charts-scatter-chart.mjs +5 -4
- package/fesm2022/ngwr-charts-scatter-chart.mjs.map +1 -1
- package/fesm2022/ngwr-charts-sparkline.mjs +3 -3
- package/fesm2022/ngwr-charts-treemap-chart.mjs +3 -3
- package/fesm2022/ngwr-charts-waterfall-chart.mjs +3 -3
- package/fesm2022/ngwr-checkbox.mjs +6 -6
- package/fesm2022/ngwr-clipboard.mjs +3 -3
- package/fesm2022/ngwr-collapse.mjs +9 -9
- package/fesm2022/ngwr-color-picker-testing.mjs +11 -1
- package/fesm2022/ngwr-color-picker-testing.mjs.map +1 -1
- package/fesm2022/ngwr-color-picker.mjs +153 -37
- package/fesm2022/ngwr-color-picker.mjs.map +1 -1
- package/fesm2022/ngwr-command-palette.mjs +3 -3
- package/fesm2022/ngwr-comment.mjs +10 -6
- package/fesm2022/ngwr-comment.mjs.map +1 -1
- package/fesm2022/ngwr-compare-testing.mjs +84 -0
- package/fesm2022/ngwr-compare-testing.mjs.map +1 -0
- package/fesm2022/ngwr-compare.mjs +3 -3
- package/fesm2022/ngwr-context-menu.mjs +28 -13
- package/fesm2022/ngwr-context-menu.mjs.map +1 -1
- package/fesm2022/ngwr-cookie.mjs +3 -3
- package/fesm2022/ngwr-copy-value.mjs +3 -3
- package/fesm2022/ngwr-counter.mjs +6 -6
- package/fesm2022/ngwr-date-picker-testing.mjs +30 -4
- package/fesm2022/ngwr-date-picker-testing.mjs.map +1 -1
- package/fesm2022/ngwr-date-picker.mjs +342 -69
- package/fesm2022/ngwr-date-picker.mjs.map +1 -1
- package/fesm2022/ngwr-date-stamp.mjs +3 -3
- package/fesm2022/ngwr-date.mjs +59 -8
- package/fesm2022/ngwr-date.mjs.map +1 -1
- package/fesm2022/ngwr-density.mjs +6 -6
- package/fesm2022/ngwr-descriptions.mjs +6 -6
- package/fesm2022/ngwr-dialog.mjs +18 -18
- package/fesm2022/ngwr-directives.mjs +15 -15
- package/fesm2022/ngwr-divider.mjs +3 -3
- package/fesm2022/ngwr-drawer.mjs +51 -29
- package/fesm2022/ngwr-drawer.mjs.map +1 -1
- package/fesm2022/ngwr-dropdown-testing.mjs +11 -3
- package/fesm2022/ngwr-dropdown-testing.mjs.map +1 -1
- package/fesm2022/ngwr-dropdown.mjs +70 -99
- package/fesm2022/ngwr-dropdown.mjs.map +1 -1
- package/fesm2022/ngwr-editor.mjs +4 -3
- package/fesm2022/ngwr-editor.mjs.map +1 -1
- package/fesm2022/ngwr-empty.mjs +3 -3
- package/fesm2022/ngwr-event-calendar.mjs +186 -33
- package/fesm2022/ngwr-event-calendar.mjs.map +1 -1
- package/fesm2022/ngwr-file-upload-testing.mjs +34 -2
- package/fesm2022/ngwr-file-upload-testing.mjs.map +1 -1
- package/fesm2022/ngwr-file-upload.mjs +279 -16
- package/fesm2022/ngwr-file-upload.mjs.map +1 -1
- package/fesm2022/ngwr-form.mjs +9 -9
- package/fesm2022/ngwr-form.mjs.map +1 -1
- package/fesm2022/ngwr-graph-testing.mjs +30 -0
- package/fesm2022/ngwr-graph-testing.mjs.map +1 -1
- package/fesm2022/ngwr-graph.mjs +664 -43
- package/fesm2022/ngwr-graph.mjs.map +1 -1
- package/fesm2022/ngwr-hotkey.mjs +6 -6
- package/fesm2022/ngwr-i18n-ar.mjs +27 -8
- package/fesm2022/ngwr-i18n-ar.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-cs.mjs +27 -8
- package/fesm2022/ngwr-i18n-cs.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-de.mjs +27 -8
- package/fesm2022/ngwr-i18n-de.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-en.mjs +27 -8
- package/fesm2022/ngwr-i18n-en.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-es.mjs +27 -8
- package/fesm2022/ngwr-i18n-es.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-fr.mjs +27 -8
- package/fesm2022/ngwr-i18n-fr.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-he.mjs +27 -8
- package/fesm2022/ngwr-i18n-he.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-hi.mjs +27 -8
- package/fesm2022/ngwr-i18n-hi.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-id.mjs +27 -8
- package/fesm2022/ngwr-i18n-id.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-it.mjs +27 -8
- package/fesm2022/ngwr-i18n-it.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-ja.mjs +27 -8
- package/fesm2022/ngwr-i18n-ja.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-ko.mjs +27 -8
- package/fesm2022/ngwr-i18n-ko.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-nl.mjs +27 -8
- package/fesm2022/ngwr-i18n-nl.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-pl.mjs +27 -8
- package/fesm2022/ngwr-i18n-pl.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-pt.mjs +27 -8
- package/fesm2022/ngwr-i18n-pt.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-ru.mjs +27 -8
- package/fesm2022/ngwr-i18n-ru.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-sv.mjs +27 -8
- package/fesm2022/ngwr-i18n-sv.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-tr.mjs +27 -8
- package/fesm2022/ngwr-i18n-tr.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-uk.mjs +27 -8
- package/fesm2022/ngwr-i18n-uk.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-vi.mjs +27 -8
- package/fesm2022/ngwr-i18n-vi.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-zh-tw.mjs +27 -8
- package/fesm2022/ngwr-i18n-zh-tw.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-zh.mjs +27 -8
- package/fesm2022/ngwr-i18n-zh.mjs.map +1 -1
- package/fesm2022/ngwr-i18n.mjs +9 -9
- package/fesm2022/ngwr-icon.mjs +6 -6
- package/fesm2022/ngwr-image-cropper.mjs +3 -3
- package/fesm2022/ngwr-input-number-testing.mjs +11 -0
- package/fesm2022/ngwr-input-number-testing.mjs.map +1 -1
- package/fesm2022/ngwr-input-number.mjs +68 -7
- package/fesm2022/ngwr-input-number.mjs.map +1 -1
- package/fesm2022/ngwr-input-otp.mjs +23 -3
- package/fesm2022/ngwr-input-otp.mjs.map +1 -1
- package/fesm2022/ngwr-input-testing.mjs +24 -1
- package/fesm2022/ngwr-input-testing.mjs.map +1 -1
- package/fesm2022/ngwr-input.mjs +152 -36
- package/fesm2022/ngwr-input.mjs.map +1 -1
- package/fesm2022/ngwr-keyboard.mjs +3 -3
- package/fesm2022/ngwr-knob.mjs +3 -3
- package/fesm2022/ngwr-layout.mjs +15 -15
- package/fesm2022/ngwr-lightbox.mjs +8 -8
- package/fesm2022/ngwr-lightbox.mjs.map +1 -1
- package/fesm2022/ngwr-list.mjs +8 -8
- package/fesm2022/ngwr-list.mjs.map +1 -1
- package/fesm2022/ngwr-load-state.mjs +15 -15
- package/fesm2022/ngwr-loading-bar.mjs +6 -6
- package/fesm2022/ngwr-mention.mjs +6 -6
- package/fesm2022/ngwr-meta.mjs +6 -6
- package/fesm2022/ngwr-overlay.mjs +175 -13
- package/fesm2022/ngwr-overlay.mjs.map +1 -1
- package/fesm2022/ngwr-page-header.mjs +3 -3
- package/fesm2022/ngwr-pagination.mjs +6 -3
- package/fesm2022/ngwr-pagination.mjs.map +1 -1
- package/fesm2022/ngwr-pipes.mjs +31 -29
- package/fesm2022/ngwr-pipes.mjs.map +1 -1
- package/fesm2022/ngwr-platform.mjs +9 -9
- package/fesm2022/ngwr-popconfirm-testing.mjs +5 -2
- package/fesm2022/ngwr-popconfirm-testing.mjs.map +1 -1
- package/fesm2022/ngwr-popconfirm.mjs +44 -63
- package/fesm2022/ngwr-popconfirm.mjs.map +1 -1
- package/fesm2022/ngwr-popover-testing.mjs +7 -1
- package/fesm2022/ngwr-popover-testing.mjs.map +1 -1
- package/fesm2022/ngwr-popover.mjs +58 -156
- package/fesm2022/ngwr-popover.mjs.map +1 -1
- package/fesm2022/ngwr-progress.mjs +50 -9
- package/fesm2022/ngwr-progress.mjs.map +1 -1
- package/fesm2022/ngwr-pull-to-refresh-testing.mjs +57 -0
- package/fesm2022/ngwr-pull-to-refresh-testing.mjs.map +1 -0
- package/fesm2022/ngwr-pull-to-refresh.mjs +3 -3
- package/fesm2022/ngwr-qr.mjs +3 -3
- package/fesm2022/ngwr-radio.mjs +6 -6
- package/fesm2022/ngwr-rating.mjs +3 -3
- package/fesm2022/ngwr-resizable-testing.mjs +113 -0
- package/fesm2022/ngwr-resizable-testing.mjs.map +1 -0
- package/fesm2022/ngwr-resizable.mjs +3 -3
- package/fesm2022/ngwr-result.mjs +12 -12
- package/fesm2022/ngwr-schema-form-testing.mjs +336 -0
- package/fesm2022/ngwr-schema-form-testing.mjs.map +1 -0
- package/fesm2022/ngwr-schema-form.mjs +416 -19
- package/fesm2022/ngwr-schema-form.mjs.map +1 -1
- package/fesm2022/ngwr-scroll.mjs +3 -3
- package/fesm2022/ngwr-segmented.mjs +3 -3
- package/fesm2022/ngwr-select-testing.mjs +19 -0
- package/fesm2022/ngwr-select-testing.mjs.map +1 -1
- package/fesm2022/ngwr-select.mjs +361 -84
- package/fesm2022/ngwr-select.mjs.map +1 -1
- package/fesm2022/ngwr-sidebar-testing.mjs +176 -0
- package/fesm2022/ngwr-sidebar-testing.mjs.map +1 -0
- package/fesm2022/ngwr-sidebar.mjs +3 -3
- package/fesm2022/ngwr-skeleton.mjs +3 -3
- package/fesm2022/ngwr-slider-testing.mjs +6 -0
- package/fesm2022/ngwr-slider-testing.mjs.map +1 -1
- package/fesm2022/ngwr-slider.mjs +21 -3
- package/fesm2022/ngwr-slider.mjs.map +1 -1
- package/fesm2022/ngwr-sortable-list.mjs +29 -12
- package/fesm2022/ngwr-sortable-list.mjs.map +1 -1
- package/fesm2022/ngwr-speed-dial.mjs +3 -3
- package/fesm2022/ngwr-spinner.mjs +3 -3
- package/fesm2022/ngwr-splitter.mjs +3 -3
- package/fesm2022/ngwr-statistic.mjs +9 -9
- package/fesm2022/ngwr-stepper.mjs +42 -11
- package/fesm2022/ngwr-stepper.mjs.map +1 -1
- package/fesm2022/ngwr-storage.mjs +3 -3
- package/fesm2022/ngwr-switch.mjs +3 -3
- package/fesm2022/ngwr-table-testing.mjs +157 -3
- package/fesm2022/ngwr-table-testing.mjs.map +1 -1
- package/fesm2022/ngwr-table.mjs +1051 -74
- package/fesm2022/ngwr-table.mjs.map +1 -1
- package/fesm2022/ngwr-tabs-router.mjs +3 -3
- package/fesm2022/ngwr-tabs-testing.mjs +1 -1
- package/fesm2022/ngwr-tabs-testing.mjs.map +1 -1
- package/fesm2022/ngwr-tabs.mjs +15 -10
- package/fesm2022/ngwr-tabs.mjs.map +1 -1
- package/fesm2022/ngwr-textarea-testing.mjs +11 -0
- package/fesm2022/ngwr-textarea-testing.mjs.map +1 -1
- package/fesm2022/ngwr-textarea.mjs +128 -16
- package/fesm2022/ngwr-textarea.mjs.map +1 -1
- package/fesm2022/ngwr-theme.mjs +3 -3
- package/fesm2022/ngwr-timeline.mjs +6 -6
- package/fesm2022/ngwr-toast.mjs +40 -19
- package/fesm2022/ngwr-toast.mjs.map +1 -1
- package/fesm2022/ngwr-toolbar.mjs +3 -3
- package/fesm2022/ngwr-tour-testing.mjs +13 -1
- package/fesm2022/ngwr-tour-testing.mjs.map +1 -1
- package/fesm2022/ngwr-tour.mjs +19 -15
- package/fesm2022/ngwr-tour.mjs.map +1 -1
- package/fesm2022/ngwr-transfer-testing.mjs +6 -0
- package/fesm2022/ngwr-transfer-testing.mjs.map +1 -1
- package/fesm2022/ngwr-transfer.mjs +24 -5
- package/fesm2022/ngwr-transfer.mjs.map +1 -1
- package/fesm2022/ngwr-tree-testing.mjs +62 -2
- package/fesm2022/ngwr-tree-testing.mjs.map +1 -1
- package/fesm2022/ngwr-tree.mjs +978 -79
- package/fesm2022/ngwr-tree.mjs.map +1 -1
- package/fesm2022/ngwr-typography.mjs +3 -3
- package/fesm2022/ngwr-utils-router.mjs +3 -3
- package/fesm2022/ngwr-utils.mjs +97 -1
- package/fesm2022/ngwr-utils.mjs.map +1 -1
- package/fesm2022/ngwr-version.mjs +1 -1
- package/fesm2022/ngwr-version.mjs.map +1 -1
- package/fesm2022/ngwr-virtual-scroll.mjs +3 -3
- package/fesm2022/ngwr-window.mjs +33 -22
- package/fesm2022/ngwr-window.mjs.map +1 -1
- package/file-upload/styles/_index.scss +156 -0
- package/graph/styles/_index.scss +87 -0
- package/i18n/ar.json +29 -8
- package/i18n/cs.json +29 -8
- package/i18n/de.json +29 -8
- package/i18n/en.json +29 -8
- package/i18n/es.json +29 -8
- package/i18n/fr.json +29 -8
- package/i18n/he.json +29 -8
- package/i18n/hi.json +29 -8
- package/i18n/id.json +29 -8
- package/i18n/it.json +29 -8
- package/i18n/ja.json +29 -8
- package/i18n/ko.json +29 -8
- package/i18n/nl.json +29 -8
- package/i18n/pl.json +29 -8
- package/i18n/pt.json +29 -8
- package/i18n/ru.json +29 -8
- package/i18n/sv.json +29 -8
- package/i18n/tr.json +29 -8
- package/i18n/uk.json +29 -8
- package/i18n/vi.json +29 -8
- package/i18n/zh-TW.json +29 -8
- package/i18n/zh.json +29 -8
- package/input/styles/_index.scss +68 -1
- package/input-otp/styles/_index.scss +14 -0
- package/llms-full.txt +53 -21
- package/llms.txt +57 -24
- package/overlay/styles/_arrow.scss +4 -4
- package/package.json +33 -1
- package/popconfirm/styles/_index.scss +3 -11
- package/progress/styles/_index.scss +32 -0
- package/schema-form/styles/_index.scss +78 -0
- package/schematics/collection.json +5 -0
- package/schematics/eject/index.js +158 -0
- package/schematics/eject/schema.js +8 -0
- package/schematics/eject/schema.json +24 -0
- package/schematics/eject/source.js +295 -0
- package/schematics/use/rule.js +2 -0
- package/schematics/use/symbol-map.json +5 -0
- package/select/styles/_index.scss +127 -22
- package/skills/ngwr/SKILL.md +31 -4
- package/skills/ngwr/references/catalog.md +9 -1
- package/slider/styles/_index.scss +22 -0
- package/table/styles/_index.scss +191 -3
- package/textarea/styles/_index.scss +80 -0
- package/theme/styles/_focus.scss +16 -1
- package/theme/styles/_motion.scss +5 -0
- package/transfer/styles/_index.scss +84 -0
- package/tree/styles/_index.scss +138 -5
- package/types/ngwr-alert-testing.d.ts +88 -0
- package/types/ngwr-badge.d.ts +72 -2
- package/types/ngwr-breadcrumbs-testing.d.ts +92 -0
- package/types/ngwr-burger-testing.d.ts +51 -0
- package/types/ngwr-calendar-testing.d.ts +18 -6
- package/types/ngwr-calendar.d.ts +272 -22
- package/types/ngwr-carousel-testing.d.ts +27 -6
- package/types/ngwr-carousel.d.ts +42 -6
- package/types/ngwr-cascader.d.ts +13 -6
- package/types/ngwr-charts-chart-legend.d.ts +9 -4
- package/types/ngwr-charts-line-chart-testing.d.ts +4 -1
- package/types/ngwr-charts-line-chart.d.ts +7 -4
- package/types/ngwr-color-picker-testing.d.ts +15 -4
- package/types/ngwr-color-picker.d.ts +76 -6
- package/types/ngwr-compare-testing.d.ts +72 -0
- package/types/ngwr-context-menu.d.ts +2 -0
- package/types/ngwr-date-picker-testing.d.ts +23 -8
- package/types/ngwr-date-picker.d.ts +100 -9
- package/types/ngwr-date.d.ts +71 -1
- package/types/ngwr-drawer.d.ts +9 -0
- package/types/ngwr-dropdown-testing.d.ts +20 -0
- package/types/ngwr-dropdown.d.ts +26 -6
- package/types/ngwr-event-calendar.d.ts +66 -8
- package/types/ngwr-file-upload-testing.d.ts +31 -2
- package/types/ngwr-file-upload.d.ts +156 -3
- package/types/ngwr-form.d.ts +47 -3
- package/types/ngwr-graph-testing.d.ts +36 -3
- package/types/ngwr-graph.d.ts +309 -13
- package/types/ngwr-input-number-testing.d.ts +10 -0
- package/types/ngwr-input-number.d.ts +30 -1
- package/types/ngwr-input-otp.d.ts +10 -0
- package/types/ngwr-input-testing.d.ts +30 -0
- package/types/ngwr-input.d.ts +54 -3
- package/types/ngwr-overlay.d.ts +84 -5
- package/types/ngwr-pipes.d.ts +2 -1
- package/types/ngwr-popconfirm-testing.d.ts +12 -3
- package/types/ngwr-popconfirm.d.ts +28 -3
- package/types/ngwr-popover-testing.d.ts +19 -2
- package/types/ngwr-popover.d.ts +22 -2
- package/types/ngwr-progress.d.ts +29 -1
- package/types/ngwr-pull-to-refresh-testing.d.ts +83 -0
- package/types/ngwr-resizable-testing.d.ts +116 -0
- package/types/ngwr-schema-form-testing.d.ts +260 -0
- package/types/ngwr-schema-form.d.ts +76 -6
- package/types/ngwr-select-testing.d.ts +20 -0
- package/types/ngwr-select.d.ts +149 -11
- package/types/ngwr-sidebar-testing.d.ts +176 -0
- package/types/ngwr-slider-testing.d.ts +3 -1
- package/types/ngwr-slider.d.ts +21 -1
- package/types/ngwr-sortable-list.d.ts +6 -0
- package/types/ngwr-stepper.d.ts +20 -11
- package/types/ngwr-table-testing.d.ts +122 -7
- package/types/ngwr-table.d.ts +572 -50
- package/types/ngwr-tabs-testing.d.ts +14 -17
- package/types/ngwr-tabs.d.ts +6 -0
- package/types/ngwr-textarea-testing.d.ts +10 -0
- package/types/ngwr-textarea.d.ts +48 -2
- package/types/ngwr-toast.d.ts +8 -1
- package/types/ngwr-tour-testing.d.ts +10 -0
- package/types/ngwr-tour.d.ts +11 -2
- package/types/ngwr-transfer-testing.d.ts +3 -0
- package/types/ngwr-transfer.d.ts +24 -1
- package/types/ngwr-tree-testing.d.ts +65 -1
- package/types/ngwr-tree.d.ts +335 -12
- package/types/ngwr-utils.d.ts +107 -1
- package/types/ngwr-version.d.ts +1 -1
- package/types/ngwr-window.d.ts +7 -4
|
@@ -18,7 +18,7 @@ var WrToolbar = class WrToolbar {
|
|
|
18
18
|
});
|
|
19
19
|
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
20
20
|
minVersion: "12.0.0",
|
|
21
|
-
version: "22.2.
|
|
21
|
+
version: "22.2.6",
|
|
22
22
|
ngImport: i0,
|
|
23
23
|
type: WrToolbar,
|
|
24
24
|
deps: [],
|
|
@@ -26,7 +26,7 @@ var WrToolbar = class WrToolbar {
|
|
|
26
26
|
});
|
|
27
27
|
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
28
28
|
minVersion: "17.1.0",
|
|
29
|
-
version: "22.2.
|
|
29
|
+
version: "22.2.6",
|
|
30
30
|
type: WrToolbar,
|
|
31
31
|
isStandalone: true,
|
|
32
32
|
selector: "wr-toolbar",
|
|
@@ -49,7 +49,7 @@ var WrToolbar = class WrToolbar {
|
|
|
49
49
|
};
|
|
50
50
|
i0.ɵɵngDeclareClassMetadata({
|
|
51
51
|
minVersion: "12.0.0",
|
|
52
|
-
version: "22.2.
|
|
52
|
+
version: "22.2.6",
|
|
53
53
|
ngImport: i0,
|
|
54
54
|
type: WrToolbar,
|
|
55
55
|
decorators: [{
|
|
@@ -33,7 +33,19 @@ var WrTourHarness = class WrTourHarness extends ComponentHarness {
|
|
|
33
33
|
};
|
|
34
34
|
}
|
|
35
35
|
async getAccessibleName() {
|
|
36
|
-
return
|
|
36
|
+
return this.referenced("aria-labelledby");
|
|
37
|
+
}
|
|
38
|
+
async getDescription() {
|
|
39
|
+
return this.referenced("aria-describedby");
|
|
40
|
+
}
|
|
41
|
+
async referenced(attribute) {
|
|
42
|
+
const ids = (await (await this.host()).getAttribute(attribute) ?? "").split(/\s+/).filter(Boolean);
|
|
43
|
+
const texts = [];
|
|
44
|
+
for (const id of ids) {
|
|
45
|
+
const element = await this.locatorForOptional(`[id="${id}"]`)();
|
|
46
|
+
if (element) texts.push(await element.text());
|
|
47
|
+
}
|
|
48
|
+
return texts.length ? texts.join(" ") : null;
|
|
37
49
|
}
|
|
38
50
|
async isModal() {
|
|
39
51
|
const host = await this.host();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ngwr-tour-testing.mjs","names":[],"sources":["../../../projects/lib/tour/testing/wr-tour-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 } from '@angular/cdk/testing';\n\nimport { WrButtonHarness } from 'ngwr/button/testing';\n\nimport type { WrTourHarnessFilters, WrTourProgress } from './types';\n\n/**\n * Test harness for the card `WrTour` shows beside the spotlit element.\n *\n * `WrTour` is a service with no element of its own, so there is nothing in your\n * fixture to load: the popup is a portal in the NGWR overlay container, and this\n * comes from `TestbedHarnessEnvironment.documentRootLoader()`. **One card exists at\n * a time** — the service tears the whole step down before opening the next — so a\n * harness held across {@link next} is pointed at a detached element, and a fresh one\n * has to be fetched per step.\n *\n * **The card is rebuilt per step, and that is what makes `getHarnessOrNull` the way\n * to ask whether a tour is running.** There is no \"closed\" state to read: the popup,\n * the overlay and the spotlight all go away together.\n *\n * **What \"last\" means here is not `current === total`.** A step whose target is not\n * on the page is skipped, so a tour of three steps can show two, and the service\n * looks AHEAD for a reachable one to decide what the primary button says.\n * {@link getProgress} reports the printed count, {@link getPrimaryLabel} what the\n * button actually reads — asserting the second is what catches a card that says\n * \"Next\" and then ends the tour.\n *\n * @example\n * ```ts\n * const rootLoader = TestbedHarnessEnvironment.documentRootLoader(fixture);\n * tour.start(steps);\n * await fixture.whenStable();\n *\n * const card = await rootLoader.getHarness(WrTourHarness);\n * expect(await card.getTitle()).toBe('Search');\n * await card.next();\n * ```\n *\n * @see https://ngwr.dev/guides/testing\n */\nexport class WrTourHarness extends ComponentHarness {\n static hostSelector = '.wr-tour-popup';\n\n /** Build a predicate that narrows the query — pass to `getHarness` / `getAllHarnesses`. */\n static with(options: WrTourHarnessFilters = {}): HarnessPredicate<WrTourHarness> {\n return new HarnessPredicate(WrTourHarness, options)\n .addOption('title', options.title, (harness, title) => HarnessPredicate.stringMatches(harness.getTitle(), title))\n .addOption('content', options.content, (harness, content) =>\n HarnessPredicate.stringMatches(harness.getContent(), content)\n );\n }\n\n /**\n * Whether this card is still on the page.\n *\n * For a harness you are already HOLDING: moving to another step disposes the\n * overlay, so this flips to `false` where a fresh `getHarnessOrNull()` answers\n * with the NEW card rather than with nothing.\n */\n async isShowing(): Promise<boolean> {\n return (await this.host()).matchesSelector('body .wr-tour-popup');\n }\n\n /** The step's heading, or `null` for a step given no `title`. */\n async getTitle(): Promise<string | null> {\n const title = await this.locatorForOptional('.wr-tour-popup__title')();\n return title ? title.text() : null;\n }\n\n /** The step's body copy. */\n async getContent(): Promise<string> {\n return (await this.locatorFor('.wr-tour-popup__content')()).text();\n }\n\n /** The progress line as printed, e.g. `Step 2 of 4`. */\n async getProgressText(): Promise<string> {\n return (await this.locatorFor('.wr-tour-popup__progress')()).text();\n }\n\n /**\n * The two numbers out of the progress line, or `null` when it does not hold two.\n *\n * Parsed from the rendered string rather than asked of the service, because the\n * service is not something a harness can reach — and the string is what the user\n * actually gets. A catalog that spells the numbers as words, or reverses them,\n * makes this `null` instead of a wrong answer; assert {@link getProgressText} in\n * that case.\n *\n * `total` is how many steps the tour was STARTED with, not how many it will show:\n * a step whose target is missing is skipped and still counted here, which is the\n * component's own choice and worth knowing before writing an assertion on it.\n */\n async getProgress(): Promise<WrTourProgress | null> {\n const digits = (await this.getProgressText()).match(/\\d+/g);\n if (!digits || digits.length < 2) return null;\n return { current: Number(digits[0]), total: Number(digits[1]) };\n }\n\n /**\n * The name the card announces — its title and the progress line, or just the\n * progress line for an untitled step.\n *\n * The card is an `aria-modal` dialog, so it needs a name; the progress line is\n * what an untitled step has instead of one.\n */\n async getAccessibleName(): Promise<string | null> {\n return (await this.host()).getAttribute('aria-label');\n }\n\n /** Whether the card announces itself as a modal dialog. */\n async isModal(): Promise<boolean> {\n const host = await this.host();\n return (await host.getAttribute('role')) === 'dialog' && (await host.getAttribute('aria-modal')) === 'true';\n }\n\n /**\n * Whether the card offers a Back button — which is the same question as \"is this\n * the first step\", since the button is only rendered past it.\n */\n async hasBack(): Promise<boolean> {\n return (await this.locatorForOptional('.wr-tour-popup__action--back')()) !== null;\n }\n\n /**\n * What the primary button READS — the \"next\" label, or the \"done\" one on the last\n * step the user will see.\n *\n * The assertion worth writing, and not derivable from the count: the service looks\n * ahead for a step whose target is still on the page, so a tour whose last step is\n * hidden ends one card early and this is the only place that shows.\n */\n async getPrimaryLabel(): Promise<string> {\n return (await this.primary()).getText();\n }\n\n /** The Skip button's label. */\n async getSkipLabel(): Promise<string> {\n return (await this.skip()).getText();\n }\n\n /** The Back button's label. Throws on the first step, where there is none. */\n async getBackLabel(): Promise<string> {\n return (await this.backButton('getBackLabel')).getText();\n }\n\n /**\n * Press the primary button — the next step, or the end of the tour.\n *\n * Composed through {@link WrButtonHarness} rather than clicking an element: these\n * are `wr-btn`s, and that harness already knows how one reports being off.\n */\n async next(): Promise<void> {\n await (await this.primary()).click();\n }\n\n /** Press Back. Throws on the first step, where the button is not rendered. */\n async back(): Promise<void> {\n await (await this.backButton('back')).click();\n }\n\n /** Press Skip — ending the tour without finishing it. */\n async skipTour(): Promise<void> {\n await (await this.skip()).click();\n }\n\n private async primary(): Promise<WrButtonHarness> {\n return this.locatorFor(WrButtonHarness.with({ selector: '.wr-tour-popup__action--next' }))();\n }\n\n private async skip(): Promise<WrButtonHarness> {\n return this.locatorFor(WrButtonHarness.with({ selector: '.wr-tour-popup__action--skip' }))();\n }\n\n private async backButton(method: string): Promise<WrButtonHarness> {\n const button = await this.locatorForOptional(WrButtonHarness.with({ selector: '.wr-tour-popup__action--back' }))();\n if (!button) {\n throw new Error(\n `WrTourHarness.${method}(): this card has no Back button — the tour is on its first step, where it is ` +\n 'not rendered at all.'\n );\n }\n return button;\n }\n}\n"],"mappings":";;;;;;;;AA+CA,IAAa,gBAAb,MAAa,sBAAsB,iBAAgB;CACjD,OAAO,eAAe;CAGtB,OAAO,KAAK,UAAgC,CAAA,GAAE;EAC5C,OAAO,IAAI,iBAAiB,eAAe,OAAO,CAAC,CAChD,UAAU,SAAS,QAAQ,QAAQ,SAAS,UAAU,iBAAiB,cAAc,QAAQ,SAAQ,GAAI,KAAK,CAAC,CAAC,CAChH,UAAU,WAAW,QAAQ,UAAU,SAAS,YAC/C,iBAAiB,cAAc,QAAQ,WAAU,GAAI,OAAO,CAAC;CAEnE;CASA,MAAM,YAAS;EACb,QAAQ,MAAM,KAAK,KAAI,EAAA,CAAI,gBAAgB,qBAAqB;CAClE;CAGA,MAAM,WAAQ;EACZ,MAAM,QAAQ,MAAM,KAAK,mBAAmB,uBAAuB,CAAC,CAAA;EACpE,OAAO,QAAQ,MAAM,KAAI,IAAK;CAChC;CAGA,MAAM,aAAU;EACd,QAAQ,MAAM,KAAK,WAAW,yBAAyB,CAAC,CAAA,EAAA,CAAI,KAAI;CAClE;CAGA,MAAM,kBAAe;EACnB,QAAQ,MAAM,KAAK,WAAW,0BAA0B,CAAC,CAAA,EAAA,CAAI,KAAI;CACnE;CAeA,MAAM,cAAW;EACf,MAAM,UAAU,MAAM,KAAK,gBAAe,EAAA,CAAI,MAAM,MAAM;EAC1D,IAAI,CAAC,UAAU,OAAO,SAAS,GAAG,OAAO;EACzC,OAAO;GAAE,SAAS,OAAO,OAAO,EAAE;GAAG,OAAO,OAAO,OAAO,E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.mjs","names":[],"sources":["../../../projects/lib/tour/testing/wr-tour-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 } from '@angular/cdk/testing';\n\nimport { WrButtonHarness } from 'ngwr/button/testing';\n\nimport type { WrTourHarnessFilters, WrTourProgress } from './types';\n\n/**\n * Test harness for the card `WrTour` shows beside the spotlit element.\n *\n * `WrTour` is a service with no element of its own, so there is nothing in your\n * fixture to load: the popup is a portal in the NGWR overlay container, and this\n * comes from `TestbedHarnessEnvironment.documentRootLoader()`. **One card exists at\n * a time** — the service tears the whole step down before opening the next — so a\n * harness held across {@link next} is pointed at a detached element, and a fresh one\n * has to be fetched per step.\n *\n * **The card is rebuilt per step, and that is what makes `getHarnessOrNull` the way\n * to ask whether a tour is running.** There is no \"closed\" state to read: the popup,\n * the overlay and the spotlight all go away together.\n *\n * **What \"last\" means here is not `current === total`.** A step whose target is not\n * on the page is skipped, so a tour of three steps can show two, and the service\n * looks AHEAD for a reachable one to decide what the primary button says.\n * {@link getProgress} reports the printed count, {@link getPrimaryLabel} what the\n * button actually reads — asserting the second is what catches a card that says\n * \"Next\" and then ends the tour.\n *\n * @example\n * ```ts\n * const rootLoader = TestbedHarnessEnvironment.documentRootLoader(fixture);\n * tour.start(steps);\n * await fixture.whenStable();\n *\n * const card = await rootLoader.getHarness(WrTourHarness);\n * expect(await card.getTitle()).toBe('Search');\n * await card.next();\n * ```\n *\n * @see https://ngwr.dev/guides/testing\n */\nexport class WrTourHarness extends ComponentHarness {\n static hostSelector = '.wr-tour-popup';\n\n /** Build a predicate that narrows the query — pass to `getHarness` / `getAllHarnesses`. */\n static with(options: WrTourHarnessFilters = {}): HarnessPredicate<WrTourHarness> {\n return new HarnessPredicate(WrTourHarness, options)\n .addOption('title', options.title, (harness, title) => HarnessPredicate.stringMatches(harness.getTitle(), title))\n .addOption('content', options.content, (harness, content) =>\n HarnessPredicate.stringMatches(harness.getContent(), content)\n );\n }\n\n /**\n * Whether this card is still on the page.\n *\n * For a harness you are already HOLDING: moving to another step disposes the\n * overlay, so this flips to `false` where a fresh `getHarnessOrNull()` answers\n * with the NEW card rather than with nothing.\n */\n async isShowing(): Promise<boolean> {\n return (await this.host()).matchesSelector('body .wr-tour-popup');\n }\n\n /** The step's heading, or `null` for a step given no `title`. */\n async getTitle(): Promise<string | null> {\n const title = await this.locatorForOptional('.wr-tour-popup__title')();\n return title ? title.text() : null;\n }\n\n /** The step's body copy. */\n async getContent(): Promise<string> {\n return (await this.locatorFor('.wr-tour-popup__content')()).text();\n }\n\n /** The progress line as printed, e.g. `Step 2 of 4`. */\n async getProgressText(): Promise<string> {\n return (await this.locatorFor('.wr-tour-popup__progress')()).text();\n }\n\n /**\n * The two numbers out of the progress line, or `null` when it does not hold two.\n *\n * Parsed from the rendered string rather than asked of the service, because the\n * service is not something a harness can reach — and the string is what the user\n * actually gets. A catalog that spells the numbers as words, or reverses them,\n * makes this `null` instead of a wrong answer; assert {@link getProgressText} in\n * that case.\n *\n * `total` is how many steps the tour was STARTED with, not how many it will show:\n * a step whose target is missing is skipped and still counted here, which is the\n * component's own choice and worth knowing before writing an assertion on it.\n */\n async getProgress(): Promise<WrTourProgress | null> {\n const digits = (await this.getProgressText()).match(/\\d+/g);\n if (!digits || digits.length < 2) return null;\n return { current: Number(digits[0]), total: Number(digits[1]) };\n }\n\n /**\n * The name the card announces — its title and the progress line, or just the\n * progress line for an untitled step.\n *\n * The card is an `aria-modal` dialog, so it needs a name; the progress line is\n * what an untitled step has instead of one.\n */\n async getAccessibleName(): Promise<string | null> {\n return this.referenced('aria-labelledby');\n }\n\n /**\n * What the card is described by, which is what a screen reader reads after the\n * name when focus enters the dialog: the step's text.\n */\n async getDescription(): Promise<string | null> {\n return this.referenced('aria-describedby');\n }\n\n /**\n * The text of the elements an id-list attribute of the card names, joined by a\n * space, or `null` when the attribute is absent or names nothing in the card.\n */\n private async referenced(attribute: string): Promise<string | null> {\n const ids = ((await (await this.host()).getAttribute(attribute)) ?? '').split(/\\s+/).filter(Boolean);\n const texts: string[] = [];\n for (const id of ids) {\n const element = await this.locatorForOptional(`[id=\"${id}\"]`)();\n if (element) texts.push(await element.text());\n }\n return texts.length ? texts.join(' ') : null;\n }\n\n /** Whether the card announces itself as a modal dialog. */\n async isModal(): Promise<boolean> {\n const host = await this.host();\n return (await host.getAttribute('role')) === 'dialog' && (await host.getAttribute('aria-modal')) === 'true';\n }\n\n /**\n * Whether the card offers a Back button — which is the same question as \"is this\n * the first step\", since the button is only rendered past it.\n */\n async hasBack(): Promise<boolean> {\n return (await this.locatorForOptional('.wr-tour-popup__action--back')()) !== null;\n }\n\n /**\n * What the primary button READS — the \"next\" label, or the \"done\" one on the last\n * step the user will see.\n *\n * The assertion worth writing, and not derivable from the count: the service looks\n * ahead for a step whose target is still on the page, so a tour whose last step is\n * hidden ends one card early and this is the only place that shows.\n */\n async getPrimaryLabel(): Promise<string> {\n return (await this.primary()).getText();\n }\n\n /** The Skip button's label. */\n async getSkipLabel(): Promise<string> {\n return (await this.skip()).getText();\n }\n\n /** The Back button's label. Throws on the first step, where there is none. */\n async getBackLabel(): Promise<string> {\n return (await this.backButton('getBackLabel')).getText();\n }\n\n /**\n * Press the primary button — the next step, or the end of the tour.\n *\n * Composed through {@link WrButtonHarness} rather than clicking an element: these\n * are `wr-btn`s, and that harness already knows how one reports being off.\n */\n async next(): Promise<void> {\n await (await this.primary()).click();\n }\n\n /** Press Back. Throws on the first step, where the button is not rendered. */\n async back(): Promise<void> {\n await (await this.backButton('back')).click();\n }\n\n /** Press Skip — ending the tour without finishing it. */\n async skipTour(): Promise<void> {\n await (await this.skip()).click();\n }\n\n private async primary(): Promise<WrButtonHarness> {\n return this.locatorFor(WrButtonHarness.with({ selector: '.wr-tour-popup__action--next' }))();\n }\n\n private async skip(): Promise<WrButtonHarness> {\n return this.locatorFor(WrButtonHarness.with({ selector: '.wr-tour-popup__action--skip' }))();\n }\n\n private async backButton(method: string): Promise<WrButtonHarness> {\n const button = await this.locatorForOptional(WrButtonHarness.with({ selector: '.wr-tour-popup__action--back' }))();\n if (!button) {\n throw new Error(\n `WrTourHarness.${method}(): this card has no Back button — the tour is on its first step, where it is ` +\n 'not rendered at all.'\n );\n }\n return button;\n }\n}\n"],"mappings":";;;;;;;;AA+CA,IAAa,gBAAb,MAAa,sBAAsB,iBAAgB;CACjD,OAAO,eAAe;CAGtB,OAAO,KAAK,UAAgC,CAAA,GAAE;EAC5C,OAAO,IAAI,iBAAiB,eAAe,OAAO,CAAC,CAChD,UAAU,SAAS,QAAQ,QAAQ,SAAS,UAAU,iBAAiB,cAAc,QAAQ,SAAQ,GAAI,KAAK,CAAC,CAAC,CAChH,UAAU,WAAW,QAAQ,UAAU,SAAS,YAC/C,iBAAiB,cAAc,QAAQ,WAAU,GAAI,OAAO,CAAC;CAEnE;CASA,MAAM,YAAS;EACb,QAAQ,MAAM,KAAK,KAAI,EAAA,CAAI,gBAAgB,qBAAqB;CAClE;CAGA,MAAM,WAAQ;EACZ,MAAM,QAAQ,MAAM,KAAK,mBAAmB,uBAAuB,CAAC,CAAA;EACpE,OAAO,QAAQ,MAAM,KAAI,IAAK;CAChC;CAGA,MAAM,aAAU;EACd,QAAQ,MAAM,KAAK,WAAW,yBAAyB,CAAC,CAAA,EAAA,CAAI,KAAI;CAClE;CAGA,MAAM,kBAAe;EACnB,QAAQ,MAAM,KAAK,WAAW,0BAA0B,CAAC,CAAA,EAAA,CAAI,KAAI;CACnE;CAeA,MAAM,cAAW;EACf,MAAM,UAAU,MAAM,KAAK,gBAAe,EAAA,CAAI,MAAM,MAAM;EAC1D,IAAI,CAAC,UAAU,OAAO,SAAS,GAAG,OAAO;EACzC,OAAO;GAAE,SAAS,OAAO,OAAO,EAAE;GAAG,OAAO,OAAO,OAAO,EAAE;EAAC;CAC/D;CASA,MAAM,oBAAiB;EACrB,OAAO,KAAK,WAA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,CAAC,CAAA;CAC5F;CAEQ,MAAM,OAAI;EAChB,OAAO,KAAK,WAAW,gBAAgB,KAAK,EAAE,UAAU,+BAA8B,CAAE,CAAC,CAAC,CAAA;CAC5F;CAEQ,MAAM,WAAW,QAAc;EACrC,MAAM,SAAS,MAAM,KAAK,mBAAmB,gBAAgB,KAAK,EAAE,UAAU,+BAA8B,CAAE,CAAC,CAAC,CAAA;EAChH,IAAI,CAAC,QACH,MAAM,IAAI,MACR,iBAAiB,OAAM,mGACC;EAG5B,OAAO;CACT"}
|
package/fesm2022/ngwr-tour.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as i0 from "@angular/core";
|
|
2
2
|
import { Component, DOCUMENT, DestroyRef, EnvironmentInjector, InjectionToken, Injector, PLATFORM_ID, Service, ViewEncapsulation, computed, inject, signal } from "@angular/core";
|
|
3
3
|
import { Location, isPlatformBrowser } from "@angular/common";
|
|
4
|
-
import { wrCheckStyles, wrToClassList } from "ngwr/utils";
|
|
4
|
+
import { wrCheckStyles, wrRandomId, wrToClassList } from "ngwr/utils";
|
|
5
5
|
import { useI18nFormatter, wrReadI18nText } from "ngwr/i18n";
|
|
6
6
|
import { Directionality } from "@angular/cdk/bidi";
|
|
7
7
|
import { WrButton } from "ngwr/button";
|
|
@@ -32,13 +32,13 @@ var WrTourPopup = class WrTourPopup {
|
|
|
32
32
|
current: this.tour.index() + 1,
|
|
33
33
|
total: this.tour.total()
|
|
34
34
|
}), ...ngDevMode ? [{ debugName: "progressText" }] : /* istanbul ignore next */ []);
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}, ...ngDevMode ? [{ debugName: "
|
|
35
|
+
titleId = wrRandomId("wr-tour-title");
|
|
36
|
+
progressId = wrRandomId("wr-tour-progress");
|
|
37
|
+
contentId = wrRandomId("wr-tour-content");
|
|
38
|
+
labelledBy = computed(() => this.tour.step()?.title ? `${this.titleId} ${this.progressId}` : this.progressId, ...ngDevMode ? [{ debugName: "labelledBy" }] : /* istanbul ignore next */ []);
|
|
39
39
|
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
40
40
|
minVersion: "12.0.0",
|
|
41
|
-
version: "22.2.
|
|
41
|
+
version: "22.2.6",
|
|
42
42
|
ngImport: i0,
|
|
43
43
|
type: WrTourPopup,
|
|
44
44
|
deps: [],
|
|
@@ -46,7 +46,7 @@ var WrTourPopup = class WrTourPopup {
|
|
|
46
46
|
});
|
|
47
47
|
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
48
48
|
minVersion: "17.0.0",
|
|
49
|
-
version: "22.2.
|
|
49
|
+
version: "22.2.6",
|
|
50
50
|
type: WrTourPopup,
|
|
51
51
|
isStandalone: true,
|
|
52
52
|
selector: "wr-tour-popup",
|
|
@@ -55,11 +55,14 @@ var WrTourPopup = class WrTourPopup {
|
|
|
55
55
|
"role": "dialog",
|
|
56
56
|
"aria-modal": "true"
|
|
57
57
|
},
|
|
58
|
-
properties: {
|
|
58
|
+
properties: {
|
|
59
|
+
"attr.aria-labelledby": "labelledBy()",
|
|
60
|
+
"attr.aria-describedby": "contentId"
|
|
61
|
+
},
|
|
59
62
|
classAttribute: "wr-tour-popup"
|
|
60
63
|
},
|
|
61
64
|
ngImport: i0,
|
|
62
|
-
template: "@let step = tour.step();\n\n<p class=\"wr-tour-popup__progress\">{{ progressText() }}</p>\n\n@if (step?.title; as title) {\n <h2 class=\"wr-tour-popup__title\">{{ title }}</h2>\n}\n\n<p class=\"wr-tour-popup__content\">{{ step?.content }}</p>\n\n<div class=\"wr-tour-popup__actions\">\n <!-- The three buttons are told apart by a class rather than by their position in\n the row: the back button is conditional, so an index means one thing on the\n first step and another everywhere else — and the labels are translated. -->\n <button\n wr-btn\n type=\"button\"\n size=\"sm\"\n outlined\n class=\"wr-tour-popup__action wr-tour-popup__action--skip\"\n (click)=\"tour.stop()\"\n >\n {{ skipLabel() }}\n </button>\n\n <span class=\"wr-tour-popup__spacer\"></span>\n\n @if (!isFirst()) {\n <button\n wr-btn\n type=\"button\"\n size=\"sm\"\n outlined\n class=\"wr-tour-popup__action wr-tour-popup__action--back\"\n (click)=\"tour.prev()\"\n >\n {{ backLabel() }}\n </button>\n }\n <button\n wr-btn\n type=\"button\"\n size=\"sm\"\n color=\"primary\"\n class=\"wr-tour-popup__action wr-tour-popup__action--next\"\n (click)=\"tour.next()\"\n >\n {{ isLast() ? doneLabel() : nextLabel() }}\n </button>\n</div>\n",
|
|
65
|
+
template: "@let step = tour.step();\n\n<p class=\"wr-tour-popup__progress\" [id]=\"progressId\">{{ progressText() }}</p>\n\n@if (step?.title; as title) {\n <h2 class=\"wr-tour-popup__title\" [id]=\"titleId\">{{ title }}</h2>\n}\n\n<p class=\"wr-tour-popup__content\" [id]=\"contentId\">{{ step?.content }}</p>\n\n<div class=\"wr-tour-popup__actions\">\n <!-- The three buttons are told apart by a class rather than by their position in\n the row: the back button is conditional, so an index means one thing on the\n first step and another everywhere else — and the labels are translated. -->\n <button\n wr-btn\n type=\"button\"\n size=\"sm\"\n outlined\n class=\"wr-tour-popup__action wr-tour-popup__action--skip\"\n (click)=\"tour.stop()\"\n >\n {{ skipLabel() }}\n </button>\n\n <span class=\"wr-tour-popup__spacer\"></span>\n\n @if (!isFirst()) {\n <button\n wr-btn\n type=\"button\"\n size=\"sm\"\n outlined\n class=\"wr-tour-popup__action wr-tour-popup__action--back\"\n (click)=\"tour.prev()\"\n >\n {{ backLabel() }}\n </button>\n }\n <!-- Focus opens on the button that walks the tour, not on Skip, the first in the\n row: the focus trap reads `cdkFocusInitial`, as the confirm dialog has it. -->\n <button\n wr-btn\n type=\"button\"\n size=\"sm\"\n color=\"primary\"\n class=\"wr-tour-popup__action wr-tour-popup__action--next\"\n [attr.cdkFocusInitial]=\"''\"\n (click)=\"tour.next()\"\n >\n {{ isLast() ? doneLabel() : nextLabel() }}\n </button>\n</div>\n",
|
|
63
66
|
dependencies: [{
|
|
64
67
|
kind: "component",
|
|
65
68
|
type: WrButton,
|
|
@@ -82,7 +85,7 @@ var WrTourPopup = class WrTourPopup {
|
|
|
82
85
|
};
|
|
83
86
|
i0.ɵɵngDeclareClassMetadata({
|
|
84
87
|
minVersion: "12.0.0",
|
|
85
|
-
version: "22.2.
|
|
88
|
+
version: "22.2.6",
|
|
86
89
|
ngImport: i0,
|
|
87
90
|
type: WrTourPopup,
|
|
88
91
|
decorators: [{
|
|
@@ -94,10 +97,11 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
94
97
|
class: "wr-tour-popup",
|
|
95
98
|
role: "dialog",
|
|
96
99
|
"aria-modal": "true",
|
|
97
|
-
"[attr.aria-
|
|
100
|
+
"[attr.aria-labelledby]": "labelledBy()",
|
|
101
|
+
"[attr.aria-describedby]": "contentId"
|
|
98
102
|
},
|
|
99
103
|
imports: [WrButton],
|
|
100
|
-
template: "@let step = tour.step();\n\n<p class=\"wr-tour-popup__progress\">{{ progressText() }}</p>\n\n@if (step?.title; as title) {\n <h2 class=\"wr-tour-popup__title\">{{ title }}</h2>\n}\n\n<p class=\"wr-tour-popup__content\">{{ step?.content }}</p>\n\n<div class=\"wr-tour-popup__actions\">\n <!-- The three buttons are told apart by a class rather than by their position in\n the row: the back button is conditional, so an index means one thing on the\n first step and another everywhere else — and the labels are translated. -->\n <button\n wr-btn\n type=\"button\"\n size=\"sm\"\n outlined\n class=\"wr-tour-popup__action wr-tour-popup__action--skip\"\n (click)=\"tour.stop()\"\n >\n {{ skipLabel() }}\n </button>\n\n <span class=\"wr-tour-popup__spacer\"></span>\n\n @if (!isFirst()) {\n <button\n wr-btn\n type=\"button\"\n size=\"sm\"\n outlined\n class=\"wr-tour-popup__action wr-tour-popup__action--back\"\n (click)=\"tour.prev()\"\n >\n {{ backLabel() }}\n </button>\n }\n <button\n wr-btn\n type=\"button\"\n size=\"sm\"\n color=\"primary\"\n class=\"wr-tour-popup__action wr-tour-popup__action--next\"\n (click)=\"tour.next()\"\n >\n {{ isLast() ? doneLabel() : nextLabel() }}\n </button>\n</div>\n"
|
|
104
|
+
template: "@let step = tour.step();\n\n<p class=\"wr-tour-popup__progress\" [id]=\"progressId\">{{ progressText() }}</p>\n\n@if (step?.title; as title) {\n <h2 class=\"wr-tour-popup__title\" [id]=\"titleId\">{{ title }}</h2>\n}\n\n<p class=\"wr-tour-popup__content\" [id]=\"contentId\">{{ step?.content }}</p>\n\n<div class=\"wr-tour-popup__actions\">\n <!-- The three buttons are told apart by a class rather than by their position in\n the row: the back button is conditional, so an index means one thing on the\n first step and another everywhere else — and the labels are translated. -->\n <button\n wr-btn\n type=\"button\"\n size=\"sm\"\n outlined\n class=\"wr-tour-popup__action wr-tour-popup__action--skip\"\n (click)=\"tour.stop()\"\n >\n {{ skipLabel() }}\n </button>\n\n <span class=\"wr-tour-popup__spacer\"></span>\n\n @if (!isFirst()) {\n <button\n wr-btn\n type=\"button\"\n size=\"sm\"\n outlined\n class=\"wr-tour-popup__action wr-tour-popup__action--back\"\n (click)=\"tour.prev()\"\n >\n {{ backLabel() }}\n </button>\n }\n <!-- Focus opens on the button that walks the tour, not on Skip, the first in the\n row: the focus trap reads `cdkFocusInitial`, as the confirm dialog has it. -->\n <button\n wr-btn\n type=\"button\"\n size=\"sm\"\n color=\"primary\"\n class=\"wr-tour-popup__action wr-tour-popup__action--next\"\n [attr.cdkFocusInitial]=\"''\"\n (click)=\"tour.next()\"\n >\n {{ isLast() ? doneLabel() : nextLabel() }}\n </button>\n</div>\n"
|
|
101
105
|
}]
|
|
102
106
|
}],
|
|
103
107
|
ctorParameters: () => []
|
|
@@ -329,7 +333,7 @@ var WrTour = class WrTour {
|
|
|
329
333
|
}
|
|
330
334
|
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
331
335
|
minVersion: "12.0.0",
|
|
332
|
-
version: "22.2.
|
|
336
|
+
version: "22.2.6",
|
|
333
337
|
ngImport: i0,
|
|
334
338
|
type: WrTour,
|
|
335
339
|
deps: [],
|
|
@@ -337,14 +341,14 @@ var WrTour = class WrTour {
|
|
|
337
341
|
});
|
|
338
342
|
static ɵprov = i0.ɵɵngDeclareService({
|
|
339
343
|
minVersion: "22.0.0",
|
|
340
|
-
version: "22.2.
|
|
344
|
+
version: "22.2.6",
|
|
341
345
|
ngImport: i0,
|
|
342
346
|
type: WrTour
|
|
343
347
|
});
|
|
344
348
|
};
|
|
345
349
|
i0.ɵɵngDeclareClassMetadata({
|
|
346
350
|
minVersion: "12.0.0",
|
|
347
|
-
version: "22.2.
|
|
351
|
+
version: "22.2.6",
|
|
348
352
|
ngImport: i0,
|
|
349
353
|
type: WrTour,
|
|
350
354
|
decorators: [{ type: Service }],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ngwr-tour.mjs","names":[],"sources":["../../../projects/lib/tour/tour-popup.ts","../../../projects/lib/tour/tour-popup.html","../../../projects/lib/tour/tour.ts"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { Component, InjectionToken, ViewEncapsulation, computed, inject } from '@angular/core';\n\nimport { WrButton } from 'ngwr/button';\nimport { wrReadI18nText, useI18nFormatter } from 'ngwr/i18n';\nimport { wrCheckStyles } from 'ngwr/utils';\n\nimport type { WrTourStep } from './types';\n\n/** What the popup needs from the running tour, without importing the service (cycle). */\nexport interface WrTourController {\n readonly index: () => number;\n readonly total: () => number;\n readonly step: () => WrTourStep | null;\n /**\n * Whether this is the last step the user will actually see — the service looks\n * ahead for a reachable one, because a trailing step whose target is missing gets\n * skipped and the raw count would call the final card \"Next\".\n */\n readonly isLast: () => boolean;\n /**\n * Whether this is the first step the user will actually see — the service looks\n * BEHIND for a reachable one, for the mirror reason: a leading step whose target\n * is missing gets skipped, so the tour opens on a later index and the raw one\n * would put a Back button on the very first card.\n */\n readonly isFirst: () => boolean;\n next(): void;\n prev(): void;\n stop(): void;\n}\n\n/** Provided by `WrTour` when it attaches the popup portal. */\nexport const WR_TOUR_STEP = new InjectionToken<WrTourController>('WR_TOUR_STEP');\n\n/**\n * The card a tour shows next to the spotlit element. Rendered by `WrTour` into\n * a CDK overlay — not something you place yourself.\n *\n * @see https://ngwr.dev/reference/services/tour\n */\n@Component({\n selector: 'wr-tour-popup',\n templateUrl: './tour-popup.html',\n encapsulation: ViewEncapsulation.None,\n host: { class: 'wr-tour-popup', role: 'dialog', 'aria-modal': 'true', '[attr.aria-label]': 'ariaLabel()' },\n imports: [WrButton],\n})\nexport class WrTourPopup {\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('tour');\n }\n\n protected readonly tour = inject(WR_TOUR_STEP);\n\n // `wrReadI18nText`, not `useI18nText`: these have no consumer-facing input to\n // forward. Both helpers are reactive.\n protected readonly nextLabel = wrReadI18nText('tour.next', 'Next');\n protected readonly backLabel = wrReadI18nText('tour.back', 'Back');\n protected readonly doneLabel = wrReadI18nText('tour.done', 'Done');\n protected readonly skipLabel = wrReadI18nText('tour.skip', 'Skip tour');\n\n /** `Step {{current}} of {{total}}` — also the dialog's accessible name. */\n protected readonly progress = useI18nFormatter('tour.progress', 'Step {{current}} of {{total}}');\n\n // From the service, not `index() >= total() - 1`: a trailing step whose target is\n // missing gets skipped, so the raw count called the final card \"Next\" and then\n // ended the tour when it was pressed.\n protected readonly isLast = computed(() => this.tour.isLast());\n // Same story at the other end, and the same fix: `index() <= 0` rendered a Back\n // button on the first card of a tour whose leading step had been skipped, and\n // `prev()` walks off the start and returns — so the button did nothing at all.\n protected readonly isFirst = computed(() => this.tour.isFirst());\n\n protected readonly progressText = computed(() =>\n this.progress({ current: this.tour.index() + 1, total: this.tour.total() })\n );\n\n protected readonly ariaLabel = computed(() => {\n const title = this.tour.step()?.title;\n return title ? `${title} — ${this.progressText()}` : this.progressText();\n });\n}\n","@let step = tour.step();\n\n<p class=\"wr-tour-popup__progress\">{{ progressText() }}</p>\n\n@if (step?.title; as title) {\n <h2 class=\"wr-tour-popup__title\">{{ title }}</h2>\n}\n\n<p class=\"wr-tour-popup__content\">{{ step?.content }}</p>\n\n<div class=\"wr-tour-popup__actions\">\n <!-- The three buttons are told apart by a class rather than by their position in\n the row: the back button is conditional, so an index means one thing on the\n first step and another everywhere else — and the labels are translated. -->\n <button\n wr-btn\n type=\"button\"\n size=\"sm\"\n outlined\n class=\"wr-tour-popup__action wr-tour-popup__action--skip\"\n (click)=\"tour.stop()\"\n >\n {{ skipLabel() }}\n </button>\n\n <span class=\"wr-tour-popup__spacer\"></span>\n\n @if (!isFirst()) {\n <button\n wr-btn\n type=\"button\"\n size=\"sm\"\n outlined\n class=\"wr-tour-popup__action wr-tour-popup__action--back\"\n (click)=\"tour.prev()\"\n >\n {{ backLabel() }}\n </button>\n }\n <button\n wr-btn\n type=\"button\"\n size=\"sm\"\n color=\"primary\"\n class=\"wr-tour-popup__action wr-tour-popup__action--next\"\n (click)=\"tour.next()\"\n >\n {{ isLast() ? doneLabel() : nextLabel() }}\n </button>\n</div>\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { type ConfigurableFocusTrap, ConfigurableFocusTrapFactory } from '@angular/cdk/a11y';\nimport { Directionality } from '@angular/cdk/bidi';\nimport { type ConnectedPosition, type OverlayRef, ScrollStrategyOptions } from '@angular/cdk/overlay';\nimport { ComponentPortal } from '@angular/cdk/portal';\nimport { Location, isPlatformBrowser } from '@angular/common';\nimport {\n DOCUMENT,\n DestroyRef,\n EnvironmentInjector,\n Injector,\n PLATFORM_ID,\n Service,\n computed,\n inject,\n signal,\n} from '@angular/core';\n\nimport { WR_OVERLAY, wrFollowDirection, wrMirrorOffsets } from 'ngwr/overlay';\nimport { wrToClassList } from 'ngwr/utils';\n\nimport { WR_TOUR_STEP, WrTourPopup } from './tour-popup';\nimport type { WrTourPlacement, WrTourStep } from './types';\n\n/** Fallback order per preferred side — the opposite side first, then the sides. */\nconst FALLBACKS: Record<WrTourPlacement, readonly WrTourPlacement[]> = {\n bottom: ['bottom', 'top', 'right', 'left'],\n top: ['top', 'bottom', 'right', 'left'],\n left: ['left', 'right', 'bottom', 'top'],\n right: ['right', 'left', 'bottom', 'top'],\n};\n\nconst CONNECTED: Record<\n WrTourPlacement,\n {\n originX: 'start' | 'center' | 'end';\n originY: 'top' | 'center' | 'bottom';\n overlayX: 'start' | 'center' | 'end';\n overlayY: 'top' | 'center' | 'bottom';\n }\n> = {\n bottom: { originX: 'center', originY: 'bottom', overlayX: 'center', overlayY: 'top' },\n top: { originX: 'center', originY: 'top', overlayX: 'center', overlayY: 'bottom' },\n left: { originX: 'start', originY: 'center', overlayX: 'end', overlayY: 'center' },\n right: { originX: 'end', originY: 'center', overlayX: 'start', overlayY: 'center' },\n};\n\n/**\n * Guided product tour: a spotlight over one element at a time plus a popup\n * explaining it.\n *\n * Steps are data, not markup — call `start()` with an array and the service owns\n * the overlay, the cut-out, focus and the keyboard. A step whose target is not\n * on the page is skipped rather than shown floating, so a tour survives a\n * feature being hidden behind a flag or a permission.\n *\n * @example\n * ```ts\n * private readonly tour = inject(WrTour);\n *\n * showMeAround(): void {\n * this.tour.start([\n * { target: '[data-tour=\"search\"]', title: 'Search', content: 'Find anything by name.' },\n * { target: '[data-tour=\"filters\"]', content: 'Narrow the list down.', placement: 'right' },\n * ]);\n * }\n * ```\n *\n * @see https://ngwr.dev/reference/services/tour\n */\n@Service()\nexport class WrTour {\n private readonly overlay = inject(WR_OVERLAY);\n private readonly dir = inject(Directionality, { optional: true });\n private readonly scrollStrategies = inject(ScrollStrategyOptions);\n private readonly injector = inject(EnvironmentInjector);\n private readonly focusTrapFactory = inject(ConfigurableFocusTrapFactory);\n private readonly document = inject(DOCUMENT);\n private readonly isBrowser = isPlatformBrowser(inject(PLATFORM_ID));\n private readonly location = inject(Location);\n\n private readonly steps = signal<readonly WrTourStep[]>([]);\n private readonly cursor = signal(-1);\n\n private overlayRef: OverlayRef | null = null;\n private focusTrap: ConfigurableFocusTrap | null = null;\n private spotlight: HTMLElement | null = null;\n private detachKeydown: (() => void) | null = null;\n private detachReposition: (() => void) | null = null;\n private restoreFocus: HTMLElement | null = null;\n private stopWatchingUrl: (() => void) | null = null;\n\n /** Whether a tour is running. */\n readonly active = computed(() => this.cursor() >= 0);\n\n /** Zero-based index of the current step, `-1` when idle. */\n readonly index = computed(() => this.cursor());\n\n /** How many steps this tour has. */\n readonly total = computed(() => this.steps().length);\n\n /** The step being shown, or `null` when idle. */\n readonly step = computed<WrTourStep | null>(() => this.steps()[this.cursor()] ?? null);\n\n // Whether any step AFTER the current one can actually be shown. Settled once per\n // move, in `goTo`, because reachability is a DOM question and not a signal.\n private readonly noStepAfter = signal(false);\n\n // The same question looking the other way. Settled in `goTo` for the same reason.\n //\n // `true` at rest, and the asymmetry with `noStepAfter` is deliberate: with no\n // tour running there is no step, so both questions are vacuous, and the pair\n // is set to whatever keeps a naive template honest. `@if (!tour.isFirst())`\n // around a Back button is the obvious way to write it, and at `false` that\n // button appears with no tour on screen.\n private readonly noStepBefore = signal(true);\n\n /**\n * Whether this is the last step the user will see. Not `index() === total() - 1`:\n * a trailing step whose target is missing is skipped, so comparing against the\n * raw count left the primary button reading \"Next\" on the final card and then\n * ending the tour when it was pressed. `false` while no tour is running.\n */\n readonly isLast = computed(() => this.noStepAfter());\n\n /**\n * Whether this is the first step the user will see. Not `index() === 0`, for the\n * mirror of the reason above: a LEADING step whose target is missing is skipped,\n * so the tour opens on a later index and the raw one put a Back button on the\n * first card — one that did nothing at all, because `prev()` walks off the start\n * and returns without moving. `true` while no tour is running — see the signal\n * it reads.\n */\n readonly isFirst = computed(() => this.noStepBefore());\n\n constructor() {\n // Everything this service owns lives OUTSIDE its own injector: a CDK overlay, a\n // div appended to `document.body`, a document keydown listener and two window\n // listeners. Nothing removes them when the injector goes, so a tour running at\n // teardown left its cut-out on the page.\n inject(DestroyRef).onDestroy(() => this.stop());\n }\n\n /**\n * Begin a tour. Restarts if one is already running. A no-op under SSR — a\n * tour is a client-side affordance and there is nothing to spotlight on the\n * server.\n */\n start(steps: readonly WrTourStep[]): void {\n if (!this.isBrowser || steps.length === 0) return;\n this.stop();\n this.steps.set(steps);\n this.restoreFocus = this.document.activeElement as HTMLElement | null;\n // A tour belongs to the page it was started on, the way `WrDialog` and\n // `WrDrawerManager` tie a modal to its URL. Nothing ended it on navigation,\n // so following a link mid-tour left the card pointing at an element the\n // router had just removed — the cut-out collapsed to a 12px box at the\n // corner, its 9999px shadow dimming the whole new page, and focus trapped in\n // a card about the page the user had left. `onUrlChange` rather than\n // `subscribe()`, which hears popstate alone and misses `router.navigate()`.\n this.stopWatchingUrl = this.location.onUrlChange(() => this.stop());\n this.goTo(0, 1);\n }\n\n /** Advance; finishes the tour past the last step. */\n next(): void {\n this.goTo(this.cursor() + 1, 1);\n }\n\n /** Go back; stays put on the first step. */\n prev(): void {\n this.goTo(this.cursor() - 1, -1);\n }\n\n /** End the tour and return focus where it was. */\n stop(): void {\n // Unhooked a microtask late, as `WrDialog` does: `Location` notifies with a\n // `forEach`, and unregistering from inside that notification splices the\n // array it is walking, which would skip the listener after ours.\n const unwatch = this.stopWatchingUrl;\n this.stopWatchingUrl = null;\n if (unwatch) queueMicrotask(unwatch);\n this.teardownStep();\n this.steps.set([]);\n this.cursor.set(-1);\n // Back to their resting answers. Without this a finished tour left both\n // holding whatever its last step said, so `isFirst` and `isLast` were the\n // only two signals here that still described a tour that had ended — while\n // `active`, `index`, `total` and `step` all reported idle.\n this.noStepAfter.set(false);\n this.noStepBefore.set(true);\n this.restoreFocus?.focus?.();\n this.restoreFocus = null;\n }\n\n /**\n * Move to `index`, skipping steps whose target is not in the DOM. `direction`\n * says which way to keep skipping, so a missing step never traps the tour\n * between two dead ends.\n */\n private goTo(index: number, direction: 1 | -1): void {\n const steps = this.steps();\n let i = index;\n while (i >= 0 && i < steps.length && this.resolve(steps[i]) === null) i += direction;\n\n if (i < 0) {\n // Ran off the start while going back — stay where we were.\n return;\n }\n if (i >= steps.length) {\n this.stop();\n return;\n }\n\n this.teardownStep();\n this.cursor.set(i);\n this.noStepAfter.set(!this.anyResolvableAfter(i));\n this.noStepBefore.set(!this.anyResolvableBefore(i));\n this.openStep(steps[i]);\n }\n\n /** Whether the tour has a step past `index` that can actually be shown. */\n private anyResolvableAfter(index: number): boolean {\n const steps = this.steps();\n for (let i = index + 1; i < steps.length; i += 1) {\n if (this.resolve(steps[i]) !== null) return true;\n }\n return false;\n }\n\n /** Whether the tour has a step before `index` that can actually be shown. */\n private anyResolvableBefore(index: number): boolean {\n const steps = this.steps();\n for (let i = index - 1; i >= 0; i -= 1) {\n if (this.resolve(steps[i]) !== null) return true;\n }\n return false;\n }\n\n private resolve(step: WrTourStep): HTMLElement | null {\n if (typeof step.target !== 'string') return step.target.isConnected ? step.target : null;\n return this.document.querySelector<HTMLElement>(step.target);\n }\n\n private openStep(step: WrTourStep): void {\n const target = this.resolve(step);\n if (!target) return;\n\n target.scrollIntoView({ block: 'center', inline: 'nearest', behavior: 'smooth' });\n\n // The cut-out is a bare element sized to the target with an enormous spread\n // shadow: everything outside it dims, the target itself stays untouched.\n // Cheaper and far more robust than a clip-path polygon, and it needs no\n // recompute when the page reflows beyond moving the box.\n const spotlight = this.document.createElement('div');\n spotlight.className = 'wr-tour__spotlight';\n spotlight.setAttribute('aria-hidden', 'true');\n this.document.body.appendChild(spotlight);\n this.spotlight = spotlight;\n this.placeSpotlight(target);\n\n const placement = step.placement ?? 'bottom';\n const positionStrategy = this.overlay\n .position()\n .flexibleConnectedTo(target)\n .withPositions(this.stepPositions(placement, this.isRtl()))\n .withPush(true);\n\n this.overlayRef = this.overlay.create({\n positionStrategy,\n scrollStrategy: this.scrollStrategies.reposition(),\n panelClass: wrToClassList('wr-tour-overlay', step.panelClass),\n });\n\n // The CDK read the direction once, just now. A tour is long-lived by nature\n // — a step can sit on screen while the user changes a language setting — and\n // without this the card keeps the direction the step opened in, with the\n // 12px gap that held it clear of the spotlight now pointing into it.\n // Per step, because every move disposes this ref and builds the next.\n //\n // The cut-out moves with it. The target itself changes place when the page\n // mirrors, and the spotlight is re-measured only on scroll and resize, so a\n // flip left it highlighting empty space while the card, re-placed by the CDK,\n // pointed at the target sitting under the dim. The flip has already been laid\n // out by the time this runs — the CDK measures the same element right after.\n wrFollowDirection(this.overlayRef, this.dir, this.injector, direction => {\n positionStrategy.withPositions(this.stepPositions(placement, direction === 'rtl'));\n this.placeSpotlight(target);\n });\n\n const portal = new ComponentPortal(\n WrTourPopup,\n null,\n Injector.create({ parent: this.injector, providers: [{ provide: WR_TOUR_STEP, useValue: this }] })\n );\n const ref = this.overlayRef.attach(portal);\n\n // Kept on the instance, not in a local: a trap registers with CDK's\n // `FocusTrapManager` and installs a capture-phase document focus listener, so an\n // undestroyed one leaks per STEP and every tour left a stack of them behind.\n this.focusTrap = this.focusTrapFactory.create(ref.location.nativeElement as HTMLElement);\n void this.focusTrap.focusInitialElementWhenReady();\n\n const onKey = (event: KeyboardEvent): void => {\n // The listener is on the document, so a step shown over a dialog would see the\n // Escape that dialog just handled and close the tour too.\n if (event.key === 'Escape' && !event.defaultPrevented) {\n event.preventDefault();\n this.stop();\n }\n };\n this.document.addEventListener('keydown', onKey);\n this.detachKeydown = () => this.document.removeEventListener('keydown', onKey);\n\n const reposition = (): void => this.placeSpotlight(target);\n window.addEventListener('scroll', reposition, true);\n window.addEventListener('resize', reposition);\n this.detachReposition = () => {\n window.removeEventListener('scroll', reposition, true);\n window.removeEventListener('resize', reposition);\n };\n }\n\n /**\n * The card's fallback table for one placement, with its inline offsets already\n * mirrored. Built per call rather than per step: the direction can change while\n * the step is on screen, and a table is what has to be rebuilt when it does.\n */\n private stepPositions(placement: WrTourPlacement, isRtl: boolean): ConnectedPosition[] {\n return wrMirrorOffsets(\n FALLBACKS[placement].map(side => ({\n ...CONNECTED[side],\n offsetY: side === 'bottom' ? 12 : side === 'top' ? -12 : 0,\n offsetX: side === 'right' ? 12 : side === 'left' ? -12 : 0,\n })),\n isRtl\n );\n }\n\n private placeSpotlight(target: HTMLElement): void {\n const el = this.spotlight;\n if (!el) return;\n const r = target.getBoundingClientRect();\n const pad = 6;\n el.style.top = `${r.top - pad}px`;\n el.style.left = `${r.left - pad}px`;\n el.style.width = `${r.width + pad * 2}px`;\n el.style.height = `${r.height + pad * 2}px`;\n }\n\n private teardownStep(): void {\n this.focusTrap?.destroy();\n this.focusTrap = null;\n this.detachKeydown?.();\n this.detachKeydown = null;\n this.detachReposition?.();\n this.detachReposition = null;\n this.overlayRef?.dispose();\n this.overlayRef = null;\n this.spotlight?.remove();\n this.spotlight = null;\n }\n\n /**\n * Whether the app reads right-to-left.\n *\n * Optional inject: `Directionality` is root-provided, so this is never null in\n * an app — but a bare `TestBed` that provides nothing should still get a\n * component that works, and defaulting to LTR is the honest fallback.\n */\n private isRtl(): boolean {\n return this.dir?.value === 'rtl';\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAuCA,MAAa,eAAe,IAAI,eAAiC,cAAc;AAe/E,IAAa,cAAb,MAAa,YAAW;CACtB,cAAA;EACE,IAAI,OAAO,cAAc,eAAe,WAAW,cAAc,MAAM;CACzE;CAEmB,OAAO,OAAO,YAAY;CAI1B,YAAY,eAAe,aAAa,MAAM;CAC9C,YAAY,eAAe,aAAa,MAAM;CAC9C,YAAY,eAAe,aAAa,MAAM;CAC9C,YAAY,eAAe,aAAa,WAAW;CAGnD,WAAW,iBAAiB,iBAAiB,+BAA+B;CAK5E,SAAS,eAAe,KAAK,KAAK,OAAM,GAAG,GAAA,YAAA,CAAA,EAAA,WAAA,SAAA,CAAA,+BAAA,CAAA,CAAA;CAI3C,UAAU,eAAe,KAAK,KAAK,QAAO,GAAG,GAAA,YAAA,CAAA,EAAA,WAAA,UAAA,CAAA,+BAAA,CAAA,CAAA;CAE7C,eAAe,eAChC,KAAK,SAAS;EAAE,SAAS,KAAK,KAAK,MAAK,IAAK;EAAG,OAAO,KAAK,KAAK,MAAK;CAAE,CAAE,GAC3E,GAAA,YAAA,CAAA,EAAA,WA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,OAAO,gBACL,UAAU,UAAU,CAAC,KAAI,UAAS;GAChC,GAAG,UAAU;GACb,SAAS,SAAS,WAAW,KAAK,SAAS,QAAQ,MAAM;GACzD,SAAS,SAAS,UAAU,KAAK,SAAS,SAAS,MAAM;EAC1D,EAAC,GACF,KAAK;CAET;CAEQ,eAAe,QAAmB;EACxC,MAAM,KAAK,KAAK;EAChB,IAAI,CAAC,IAAI;EACT,MAAM,IAAI,OAAO,sBAAqB;EACtC,MAAM,MAAM;EACZ,GAAG,MAAM,MAAM,GAAG,EAAE,MAAM,IAAG;EAC7B,GAAG,MAAM,OAAO,GAAG,EAAE,OAAO,IAAG;EAC/B,GAAG,MAAM,QAAQ,GAAG,EAAE,QAAQ,GAAO;EACrC,GAAG,MAAM,SAAS,GAAG,EAAE,SAAS,GAAO;CACzC;CAEQ,eAAY;EAClB,KAAK,WAAW,QAAO;EACvB,KAAK,YAAY;EACjB,KAAK,gBAAe;EACpB,KAAK,gBAAgB;EACrB,KAAK,mBAAkB;EACvB,KAAK,mBAAmB;EACxB,KAAK,YAAY,QAAO;EACxB,KAAK,aAAa;EAClB,KAAK,WAAW,OAAM;EACtB,KAAK,YAAY;CACnB;CASQ,QAAK;EACX,OAAO,KAAK,KAAK,UAAU;CAC7B;CA7SW,OAAA,OAAA,GAAA,mBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,UAAA;EAAA,MAAA;EAAM,MAAA,CAAA;EAAA,QAAA,GAAA,gBAAA;CAAA,CAAA;CAAN,OAAA,QAAA,GAAA,mBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,UAAA;EAAA,MAAA;CAAM,CAAA;;AAAN,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAM,YAAA,CAAA,EADlB,MAAA,Q"}
|
|
1
|
+
{"version":3,"file":"ngwr-tour.mjs","names":[],"sources":["../../../projects/lib/tour/tour-popup.ts","../../../projects/lib/tour/tour-popup.html","../../../projects/lib/tour/tour.ts"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { Component, InjectionToken, ViewEncapsulation, computed, inject } from '@angular/core';\n\nimport { WrButton } from 'ngwr/button';\nimport { wrReadI18nText, useI18nFormatter } from 'ngwr/i18n';\nimport { wrCheckStyles, wrRandomId } from 'ngwr/utils';\n\nimport type { WrTourStep } from './types';\n\n/** What the popup needs from the running tour, without importing the service (cycle). */\nexport interface WrTourController {\n readonly index: () => number;\n readonly total: () => number;\n readonly step: () => WrTourStep | null;\n /**\n * Whether this is the last step the user will actually see — the service looks\n * ahead for a reachable one, because a trailing step whose target is missing gets\n * skipped and the raw count would call the final card \"Next\".\n */\n readonly isLast: () => boolean;\n /**\n * Whether this is the first step the user will actually see — the service looks\n * BEHIND for a reachable one, for the mirror reason: a leading step whose target\n * is missing gets skipped, so the tour opens on a later index and the raw one\n * would put a Back button on the very first card.\n */\n readonly isFirst: () => boolean;\n next(): void;\n prev(): void;\n stop(): void;\n}\n\n/** Provided by `WrTour` when it attaches the popup portal. */\nexport const WR_TOUR_STEP = new InjectionToken<WrTourController>('WR_TOUR_STEP');\n\n/**\n * The card a tour shows next to the spotlit element. Rendered by `WrTour` into\n * a CDK overlay — not something you place yourself.\n *\n * @see https://ngwr.dev/reference/services/tour\n */\n@Component({\n selector: 'wr-tour-popup',\n templateUrl: './tour-popup.html',\n encapsulation: ViewEncapsulation.None,\n host: {\n class: 'wr-tour-popup',\n role: 'dialog',\n 'aria-modal': 'true',\n '[attr.aria-labelledby]': 'labelledBy()',\n '[attr.aria-describedby]': 'contentId',\n },\n imports: [WrButton],\n})\nexport class WrTourPopup {\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('tour');\n }\n\n protected readonly tour = inject(WR_TOUR_STEP);\n\n // `wrReadI18nText`, not `useI18nText`: these have no consumer-facing input to\n // forward. Both helpers are reactive.\n protected readonly nextLabel = wrReadI18nText('tour.next', 'Next');\n protected readonly backLabel = wrReadI18nText('tour.back', 'Back');\n protected readonly doneLabel = wrReadI18nText('tour.done', 'Done');\n protected readonly skipLabel = wrReadI18nText('tour.skip', 'Skip tour');\n\n /** `Step {{current}} of {{total}}`, the second half of the dialog's name. */\n protected readonly progress = useI18nFormatter('tour.progress', 'Step {{current}} of {{total}}');\n\n // From the service, not `index() >= total() - 1`: a trailing step whose target is\n // missing gets skipped, so the raw count called the final card \"Next\" and then\n // ended the tour when it was pressed.\n protected readonly isLast = computed(() => this.tour.isLast());\n // Same story at the other end, and the same fix: `index() <= 0` rendered a Back\n // button on the first card of a tour whose leading step had been skipped, and\n // `prev()` walks off the start and returns — so the button did nothing at all.\n protected readonly isFirst = computed(() => this.tour.isFirst());\n\n protected readonly progressText = computed(() =>\n this.progress({ current: this.tour.index() + 1, total: this.tour.total() })\n );\n\n protected readonly titleId = wrRandomId('wr-tour-title');\n protected readonly progressId = wrRandomId('wr-tour-progress');\n protected readonly contentId = wrRandomId('wr-tour-content');\n\n /**\n * The dialog is named by its title and the progress line, or by the progress\n * line alone for an untitled step, and described by the step's text: a screen\n * reader reads a dialog's name and description when focus enters it, and\n * nothing else of what it holds.\n */\n protected readonly labelledBy = computed(() =>\n this.tour.step()?.title ? `${this.titleId} ${this.progressId}` : this.progressId\n );\n}\n","@let step = tour.step();\n\n<p class=\"wr-tour-popup__progress\" [id]=\"progressId\">{{ progressText() }}</p>\n\n@if (step?.title; as title) {\n <h2 class=\"wr-tour-popup__title\" [id]=\"titleId\">{{ title }}</h2>\n}\n\n<p class=\"wr-tour-popup__content\" [id]=\"contentId\">{{ step?.content }}</p>\n\n<div class=\"wr-tour-popup__actions\">\n <!-- The three buttons are told apart by a class rather than by their position in\n the row: the back button is conditional, so an index means one thing on the\n first step and another everywhere else — and the labels are translated. -->\n <button\n wr-btn\n type=\"button\"\n size=\"sm\"\n outlined\n class=\"wr-tour-popup__action wr-tour-popup__action--skip\"\n (click)=\"tour.stop()\"\n >\n {{ skipLabel() }}\n </button>\n\n <span class=\"wr-tour-popup__spacer\"></span>\n\n @if (!isFirst()) {\n <button\n wr-btn\n type=\"button\"\n size=\"sm\"\n outlined\n class=\"wr-tour-popup__action wr-tour-popup__action--back\"\n (click)=\"tour.prev()\"\n >\n {{ backLabel() }}\n </button>\n }\n <!-- Focus opens on the button that walks the tour, not on Skip, the first in the\n row: the focus trap reads `cdkFocusInitial`, as the confirm dialog has it. -->\n <button\n wr-btn\n type=\"button\"\n size=\"sm\"\n color=\"primary\"\n class=\"wr-tour-popup__action wr-tour-popup__action--next\"\n [attr.cdkFocusInitial]=\"''\"\n (click)=\"tour.next()\"\n >\n {{ isLast() ? doneLabel() : nextLabel() }}\n </button>\n</div>\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { type ConfigurableFocusTrap, ConfigurableFocusTrapFactory } from '@angular/cdk/a11y';\nimport { Directionality } from '@angular/cdk/bidi';\nimport { type ConnectedPosition, type OverlayRef, ScrollStrategyOptions } from '@angular/cdk/overlay';\nimport { ComponentPortal } from '@angular/cdk/portal';\nimport { Location, isPlatformBrowser } from '@angular/common';\nimport {\n DOCUMENT,\n DestroyRef,\n EnvironmentInjector,\n Injector,\n PLATFORM_ID,\n Service,\n computed,\n inject,\n signal,\n} from '@angular/core';\n\nimport { WR_OVERLAY, wrFollowDirection, wrMirrorOffsets } from 'ngwr/overlay';\nimport { wrToClassList } from 'ngwr/utils';\n\nimport { WR_TOUR_STEP, WrTourPopup } from './tour-popup';\nimport type { WrTourPlacement, WrTourStep } from './types';\n\n/** Fallback order per preferred side — the opposite side first, then the sides. */\nconst FALLBACKS: Record<WrTourPlacement, readonly WrTourPlacement[]> = {\n bottom: ['bottom', 'top', 'right', 'left'],\n top: ['top', 'bottom', 'right', 'left'],\n left: ['left', 'right', 'bottom', 'top'],\n right: ['right', 'left', 'bottom', 'top'],\n};\n\nconst CONNECTED: Record<\n WrTourPlacement,\n {\n originX: 'start' | 'center' | 'end';\n originY: 'top' | 'center' | 'bottom';\n overlayX: 'start' | 'center' | 'end';\n overlayY: 'top' | 'center' | 'bottom';\n }\n> = {\n bottom: { originX: 'center', originY: 'bottom', overlayX: 'center', overlayY: 'top' },\n top: { originX: 'center', originY: 'top', overlayX: 'center', overlayY: 'bottom' },\n left: { originX: 'start', originY: 'center', overlayX: 'end', overlayY: 'center' },\n right: { originX: 'end', originY: 'center', overlayX: 'start', overlayY: 'center' },\n};\n\n/**\n * Guided product tour: a spotlight over one element at a time plus a popup\n * explaining it.\n *\n * Steps are data, not markup — call `start()` with an array and the service owns\n * the overlay, the cut-out, focus and the keyboard. A step whose target is not\n * on the page is skipped rather than shown floating, so a tour survives a\n * feature being hidden behind a flag or a permission.\n *\n * @example\n * ```ts\n * private readonly tour = inject(WrTour);\n *\n * showMeAround(): void {\n * this.tour.start([\n * { target: '[data-tour=\"search\"]', title: 'Search', content: 'Find anything by name.' },\n * { target: '[data-tour=\"filters\"]', content: 'Narrow the list down.', placement: 'right' },\n * ]);\n * }\n * ```\n *\n * @see https://ngwr.dev/reference/services/tour\n */\n@Service()\nexport class WrTour {\n private readonly overlay = inject(WR_OVERLAY);\n private readonly dir = inject(Directionality, { optional: true });\n private readonly scrollStrategies = inject(ScrollStrategyOptions);\n private readonly injector = inject(EnvironmentInjector);\n private readonly focusTrapFactory = inject(ConfigurableFocusTrapFactory);\n private readonly document = inject(DOCUMENT);\n private readonly isBrowser = isPlatformBrowser(inject(PLATFORM_ID));\n private readonly location = inject(Location);\n\n private readonly steps = signal<readonly WrTourStep[]>([]);\n private readonly cursor = signal(-1);\n\n private overlayRef: OverlayRef | null = null;\n private focusTrap: ConfigurableFocusTrap | null = null;\n private spotlight: HTMLElement | null = null;\n private detachKeydown: (() => void) | null = null;\n private detachReposition: (() => void) | null = null;\n private restoreFocus: HTMLElement | null = null;\n private stopWatchingUrl: (() => void) | null = null;\n\n /** Whether a tour is running. */\n readonly active = computed(() => this.cursor() >= 0);\n\n /** Zero-based index of the current step, `-1` when idle. */\n readonly index = computed(() => this.cursor());\n\n /** How many steps this tour has. */\n readonly total = computed(() => this.steps().length);\n\n /** The step being shown, or `null` when idle. */\n readonly step = computed<WrTourStep | null>(() => this.steps()[this.cursor()] ?? null);\n\n // Whether any step AFTER the current one can actually be shown. Settled once per\n // move, in `goTo`, because reachability is a DOM question and not a signal.\n private readonly noStepAfter = signal(false);\n\n // The same question looking the other way. Settled in `goTo` for the same reason.\n //\n // `true` at rest, and the asymmetry with `noStepAfter` is deliberate: with no\n // tour running there is no step, so both questions are vacuous, and the pair\n // is set to whatever keeps a naive template honest. `@if (!tour.isFirst())`\n // around a Back button is the obvious way to write it, and at `false` that\n // button appears with no tour on screen.\n private readonly noStepBefore = signal(true);\n\n /**\n * Whether this is the last step the user will see. Not `index() === total() - 1`:\n * a trailing step whose target is missing is skipped, so comparing against the\n * raw count left the primary button reading \"Next\" on the final card and then\n * ending the tour when it was pressed. `false` while no tour is running.\n */\n readonly isLast = computed(() => this.noStepAfter());\n\n /**\n * Whether this is the first step the user will see. Not `index() === 0`, for the\n * mirror of the reason above: a LEADING step whose target is missing is skipped,\n * so the tour opens on a later index and the raw one put a Back button on the\n * first card — one that did nothing at all, because `prev()` walks off the start\n * and returns without moving. `true` while no tour is running — see the signal\n * it reads.\n */\n readonly isFirst = computed(() => this.noStepBefore());\n\n constructor() {\n // Everything this service owns lives OUTSIDE its own injector: a CDK overlay, a\n // div appended to `document.body`, a document keydown listener and two window\n // listeners. Nothing removes them when the injector goes, so a tour running at\n // teardown left its cut-out on the page.\n inject(DestroyRef).onDestroy(() => this.stop());\n }\n\n /**\n * Begin a tour. Restarts if one is already running. A no-op under SSR — a\n * tour is a client-side affordance and there is nothing to spotlight on the\n * server.\n */\n start(steps: readonly WrTourStep[]): void {\n if (!this.isBrowser || steps.length === 0) return;\n this.stop();\n this.steps.set(steps);\n this.restoreFocus = this.document.activeElement as HTMLElement | null;\n // A tour belongs to the page it was started on, the way `WrDialog` and\n // `WrDrawerManager` tie a modal to its URL. Nothing ended it on navigation,\n // so following a link mid-tour left the card pointing at an element the\n // router had just removed — the cut-out collapsed to a 12px box at the\n // corner, its 9999px shadow dimming the whole new page, and focus trapped in\n // a card about the page the user had left. `onUrlChange` rather than\n // `subscribe()`, which hears popstate alone and misses `router.navigate()`.\n this.stopWatchingUrl = this.location.onUrlChange(() => this.stop());\n this.goTo(0, 1);\n }\n\n /** Advance; finishes the tour past the last step. */\n next(): void {\n this.goTo(this.cursor() + 1, 1);\n }\n\n /** Go back; stays put on the first step. */\n prev(): void {\n this.goTo(this.cursor() - 1, -1);\n }\n\n /** End the tour and return focus where it was. */\n stop(): void {\n // Unhooked a microtask late, as `WrDialog` does: `Location` notifies with a\n // `forEach`, and unregistering from inside that notification splices the\n // array it is walking, which would skip the listener after ours.\n const unwatch = this.stopWatchingUrl;\n this.stopWatchingUrl = null;\n if (unwatch) queueMicrotask(unwatch);\n this.teardownStep();\n this.steps.set([]);\n this.cursor.set(-1);\n // Back to their resting answers. Without this a finished tour left both\n // holding whatever its last step said, so `isFirst` and `isLast` were the\n // only two signals here that still described a tour that had ended — while\n // `active`, `index`, `total` and `step` all reported idle.\n this.noStepAfter.set(false);\n this.noStepBefore.set(true);\n this.restoreFocus?.focus?.();\n this.restoreFocus = null;\n }\n\n /**\n * Move to `index`, skipping steps whose target is not in the DOM. `direction`\n * says which way to keep skipping, so a missing step never traps the tour\n * between two dead ends.\n */\n private goTo(index: number, direction: 1 | -1): void {\n const steps = this.steps();\n let i = index;\n while (i >= 0 && i < steps.length && this.resolve(steps[i]) === null) i += direction;\n\n if (i < 0) {\n // Ran off the start while going back — stay where we were.\n return;\n }\n if (i >= steps.length) {\n this.stop();\n return;\n }\n\n this.teardownStep();\n this.cursor.set(i);\n this.noStepAfter.set(!this.anyResolvableAfter(i));\n this.noStepBefore.set(!this.anyResolvableBefore(i));\n this.openStep(steps[i]);\n }\n\n /** Whether the tour has a step past `index` that can actually be shown. */\n private anyResolvableAfter(index: number): boolean {\n const steps = this.steps();\n for (let i = index + 1; i < steps.length; i += 1) {\n if (this.resolve(steps[i]) !== null) return true;\n }\n return false;\n }\n\n /** Whether the tour has a step before `index` that can actually be shown. */\n private anyResolvableBefore(index: number): boolean {\n const steps = this.steps();\n for (let i = index - 1; i >= 0; i -= 1) {\n if (this.resolve(steps[i]) !== null) return true;\n }\n return false;\n }\n\n private resolve(step: WrTourStep): HTMLElement | null {\n if (typeof step.target !== 'string') return step.target.isConnected ? step.target : null;\n return this.document.querySelector<HTMLElement>(step.target);\n }\n\n private openStep(step: WrTourStep): void {\n const target = this.resolve(step);\n if (!target) return;\n\n target.scrollIntoView({ block: 'center', inline: 'nearest', behavior: 'smooth' });\n\n // The cut-out is a bare element sized to the target with an enormous spread\n // shadow: everything outside it dims, the target itself stays untouched.\n // Cheaper and far more robust than a clip-path polygon, and it needs no\n // recompute when the page reflows beyond moving the box.\n const spotlight = this.document.createElement('div');\n spotlight.className = 'wr-tour__spotlight';\n spotlight.setAttribute('aria-hidden', 'true');\n this.document.body.appendChild(spotlight);\n this.spotlight = spotlight;\n this.placeSpotlight(target);\n\n const placement = step.placement ?? 'bottom';\n const positionStrategy = this.overlay\n .position()\n .flexibleConnectedTo(target)\n .withPositions(this.stepPositions(placement, this.isRtl()))\n .withPush(true);\n\n this.overlayRef = this.overlay.create({\n positionStrategy,\n scrollStrategy: this.scrollStrategies.reposition(),\n panelClass: wrToClassList('wr-tour-overlay', step.panelClass),\n });\n\n // The CDK read the direction once, just now. A tour is long-lived by nature\n // — a step can sit on screen while the user changes a language setting — and\n // without this the card keeps the direction the step opened in, with the\n // 12px gap that held it clear of the spotlight now pointing into it.\n // Per step, because every move disposes this ref and builds the next.\n //\n // The cut-out moves with it. The target itself changes place when the page\n // mirrors, and the spotlight is re-measured only on scroll and resize, so a\n // flip left it highlighting empty space while the card, re-placed by the CDK,\n // pointed at the target sitting under the dim. The flip has already been laid\n // out by the time this runs — the CDK measures the same element right after.\n wrFollowDirection(this.overlayRef, this.dir, this.injector, direction => {\n positionStrategy.withPositions(this.stepPositions(placement, direction === 'rtl'));\n this.placeSpotlight(target);\n });\n\n const portal = new ComponentPortal(\n WrTourPopup,\n null,\n Injector.create({ parent: this.injector, providers: [{ provide: WR_TOUR_STEP, useValue: this }] })\n );\n const ref = this.overlayRef.attach(portal);\n\n // Kept on the instance, not in a local: a trap registers with CDK's\n // `FocusTrapManager` and installs a capture-phase document focus listener, so an\n // undestroyed one leaks per STEP and every tour left a stack of them behind.\n this.focusTrap = this.focusTrapFactory.create(ref.location.nativeElement as HTMLElement);\n void this.focusTrap.focusInitialElementWhenReady();\n\n const onKey = (event: KeyboardEvent): void => {\n // The listener is on the document, so a step shown over a dialog would see the\n // Escape that dialog just handled and close the tour too.\n if (event.key === 'Escape' && !event.defaultPrevented) {\n event.preventDefault();\n this.stop();\n }\n };\n this.document.addEventListener('keydown', onKey);\n this.detachKeydown = () => this.document.removeEventListener('keydown', onKey);\n\n const reposition = (): void => this.placeSpotlight(target);\n window.addEventListener('scroll', reposition, true);\n window.addEventListener('resize', reposition);\n this.detachReposition = () => {\n window.removeEventListener('scroll', reposition, true);\n window.removeEventListener('resize', reposition);\n };\n }\n\n /**\n * The card's fallback table for one placement, with its inline offsets already\n * mirrored. Built per call rather than per step: the direction can change while\n * the step is on screen, and a table is what has to be rebuilt when it does.\n */\n private stepPositions(placement: WrTourPlacement, isRtl: boolean): ConnectedPosition[] {\n return wrMirrorOffsets(\n FALLBACKS[placement].map(side => ({\n ...CONNECTED[side],\n offsetY: side === 'bottom' ? 12 : side === 'top' ? -12 : 0,\n offsetX: side === 'right' ? 12 : side === 'left' ? -12 : 0,\n })),\n isRtl\n );\n }\n\n private placeSpotlight(target: HTMLElement): void {\n const el = this.spotlight;\n if (!el) return;\n const r = target.getBoundingClientRect();\n const pad = 6;\n el.style.top = `${r.top - pad}px`;\n el.style.left = `${r.left - pad}px`;\n el.style.width = `${r.width + pad * 2}px`;\n el.style.height = `${r.height + pad * 2}px`;\n }\n\n private teardownStep(): void {\n this.focusTrap?.destroy();\n this.focusTrap = null;\n this.detachKeydown?.();\n this.detachKeydown = null;\n this.detachReposition?.();\n this.detachReposition = null;\n this.overlayRef?.dispose();\n this.overlayRef = null;\n this.spotlight?.remove();\n this.spotlight = null;\n }\n\n /**\n * Whether the app reads right-to-left.\n *\n * Optional inject: `Directionality` is root-provided, so this is never null in\n * an app — but a bare `TestBed` that provides nothing should still get a\n * component that works, and defaulting to LTR is the honest fallback.\n */\n private isRtl(): boolean {\n return this.dir?.value === 'rtl';\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAuCA,MAAa,eAAe,IAAI,eAAiC,cAAc;AAqB/E,IAAa,cAAb,MAAa,YAAW;CACtB,cAAA;EACE,IAAI,OAAO,cAAc,eAAe,WAAW,cAAc,MAAM;CACzE;CAEmB,OAAO,OAAO,YAAY;CAI1B,YAAY,eAAe,aAAa,MAAM;CAC9C,YAAY,eAAe,aAAa,MAAM;CAC9C,YAAY,eAAe,aAAa,MAAM;CAC9C,YAAY,eAAe,aAAa,WAAW;CAGnD,WAAW,iBAAiB,iBAAiB,+BAA+B;CAK5E,SAAS,eAAe,KAAK,KAAK,OAAM,GAAG,GAAA,YAAA,CAAA,EAAA,WAAA,SAAA,CAAA,+BAAA,CAAA,CAAA;CAI3C,UAAU,eAAe,KAAK,KAAK,QAAO,GAAG,GAAA,YAAA,CAAA,EAAA,WAAA,UAAA,CAAA,+BAAA,CAAA,CAAA;CAE7C,eAAe,eAChC,KAAK,SAAS;EAAE,SAAS,KAAK,KAAK,MAAK,IAAK;EAAG,OAAO,KAAK,KAAK,MAAK;CAAE,CAAE,GAC3E,GAAA,YAAA,CAAA,EAAA,WAAA,eAAA,CAAA,+BAAA,CAAA,CAAA;CAEkB,UAAU,WAAW,eAAe;CACpC,aAAa,WAAW,kBAAkB;CAC1C,YAAY,WAAW,iBAAiB;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G,UAAU;GACb,SAAS,SAAS,WAAW,KAAK,SAAS,QAAQ,MAAM;GACzD,SAAS,SAAS,UAAU,KAAK,SAAS,SAAS,MAAM;EAC1D,EAAC,GACF,KAAK;CAET;CAEQ,eAAe,QAAmB;EACxC,MAAM,KAAK,KAAK;EAChB,IAAI,CAAC,IAAI;EACT,MAAM,IAAI,OAAO,sBAAqB;EACtC,MAAM,MAAM;EACZ,GAAG,MAAM,MAAM,GAAG,EAAE,MAAM,IAAG;EAC7B,GAAG,MAAM,OAAO,GAAG,EAAE,OAAO,IAAG;EAC/B,GAAG,MAAM,QAAQ,GAAG,EAAE,QAAQ,GAAO;EACrC,GAAG,MAAM,SAAS,GAAG,EAAE,SAAS,GAAO;CACzC;CAEQ,eAAY;EAClB,KAAK,WAAW,QAAO;EACvB,KAAK,YAAY;EACjB,KAAK,gBAAe;EACpB,KAAK,gBAAgB;EACrB,KAAK,mBAAkB;EACvB,KAAK,mBAAmB;EACxB,KAAK,YAAY,QAAO;EACxB,KAAK,aAAa;EAClB,KAAK,WAAW,OAAM;EACtB,KAAK,YAAY;CACnB;CASQ,QAAK;EACX,OAAO,KAAK,KAAK,UAAU;CAC7B;CA7SW,OAAA,OAAA,GAAA,mBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,UAAA;EAAA,MAAA;EAAM,MAAA,CAAA;EAAA,QAAA,GAAA,gBAAA;CAAA,CAAA;CAAN,OAAA,QAAA,GAAA,mBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,UAAA;EAAA,MAAA;CAAM,CAAA;;AAAN,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAM,YAAA,CAAA,EADlB,MAAA,Q"}
|
|
@@ -163,6 +163,12 @@ var WrTransferHarness = class WrTransferHarness extends ComponentHarness {
|
|
|
163
163
|
async getPane(side) {
|
|
164
164
|
return this.locatorFor(WrTransferPaneHarness.with({ side }))();
|
|
165
165
|
}
|
|
166
|
+
async getSize() {
|
|
167
|
+
const host = await this.host();
|
|
168
|
+
if (await host.hasClass("wr-transfer--sm")) return "sm";
|
|
169
|
+
if (await host.hasClass("wr-transfer--lg")) return "lg";
|
|
170
|
+
return "md";
|
|
171
|
+
}
|
|
166
172
|
async isDisabled() {
|
|
167
173
|
return (await this.host()).hasClass("wr-transfer--disabled");
|
|
168
174
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ngwr-transfer-testing.mjs","names":[],"sources":["../../../projects/lib/transfer/testing/wr-transfer-item-harness.ts","../../../projects/lib/transfer/testing/wr-transfer-pane-harness.ts","../../../projects/lib/transfer/testing/wr-transfer-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 } from '@angular/cdk/testing';\n\nimport type { WrTransferItemHarnessFilters } from './types';\n\n/**\n * Test harness for one row of a `<wr-transfer>` pane.\n *\n * A row is a `<li>` holding a `<wr-checkbox>`, and the checkbox is the thing the\n * user operates — so the state is read from the native `<input type=\"checkbox\">`\n * inside it, and {@link toggle} clicks that. The pane is deliberately NOT a\n * `role=\"listbox\"` of `role=\"option\"` rows (an option may not contain an\n * interactive control, and the axe gate says so), which is why there is no\n * `aria-selected` here to read: the checkbox's own state IS the announcement.\n *\n * **Checked is not the value.** A tick stages the row for the next move and\n * nothing more; which pane the row sits in is what `[(value)]` carries. Staging is\n * spent — and cleared — by the move that commits it.\n *\n * @example\n * ```ts\n * const source = await transfer.getPane('source');\n * await (await source.getItem({ label: 'Read' })).check();\n *\n * await transfer.moveTo('target');\n * ```\n *\n * @see https://ngwr.dev/guides/testing\n */\nexport class WrTransferItemHarness extends ComponentHarness {\n /**\n * `.wr-transfer__item` is a DATA row and nothing else.\n *\n * An empty pane renders an `<li class=\"wr-transfer__empty\">` for its placeholder,\n * so querying `li` would hand that back as a row with no checkbox to read.\n */\n static hostSelector = '.wr-transfer__item';\n\n /** Build a predicate that narrows the query — pass to `getHarness` / `getAllHarnesses`. */\n static with(options: WrTransferItemHarnessFilters = {}): HarnessPredicate<WrTransferItemHarness> {\n return new HarnessPredicate(WrTransferItemHarness, options)\n .addOption('label', options.label, (harness, label) => HarnessPredicate.stringMatches(harness.getLabel(), label))\n .addOption('checked', options.checked, async (harness, checked) => (await harness.isChecked()) === checked)\n .addOption('disabled', options.disabled, async (harness, disabled) => (await harness.isDisabled()) === disabled);\n }\n\n private readonly input = this.locatorFor('input.wr-checkbox__input');\n\n /** The row's label, trimmed — the `WrTransferItem.label` the pane shows and the search matches. */\n async getLabel(): Promise<string> {\n return (await this.locatorFor('.wr-checkbox__text')()).text();\n }\n\n /**\n * Whether the row is STAGED for the next move.\n *\n * Not \"selected\": a row's pane is what the value says, and the tick is transient\n * staging the move spends. `WrTransferPaneHarness.getCheckedLabels()` reads the\n * whole staged set of a pane.\n */\n async isChecked(): Promise<boolean> {\n return (await this.input()).getProperty<boolean>('checked');\n }\n\n /**\n * Whether the row refuses staging.\n *\n * The native input's `disabled` — the state a screen reader is given and the one\n * that decides whether a click does anything. It answers `true` for BOTH reasons a\n * row can be inert: the item's own `disabled` flag, and a disabled transfer, which\n * disables every row. The `wr-transfer__item--disabled` modifier only marks the\n * first of those, so it is the narrower question and not the one that predicts\n * behaviour.\n */\n async isDisabled(): Promise<boolean> {\n return (await this.input()).getProperty<boolean>('disabled');\n }\n\n /**\n * Flip the row's staging.\n *\n * Refuses a disabled row rather than clicking into the void: the component drops\n * the toggle outright, so the click would resolve having changed nothing and the\n * failure would surface as an unexplained empty move two assertions later.\n */\n async toggle(): Promise<void> {\n if (await this.isDisabled()) {\n const label = await this.getLabel();\n throw new Error(\n `WrTransferItemHarness.toggle(): \"${label}\" is disabled and the component refuses to stage it. ` +\n 'Either the item carries `disabled`, or the whole transfer does — check isDisabled() on the transfer too.'\n );\n }\n await (await this.input()).click();\n }\n\n /** Stage the row if it is not already staged. */\n async check(): Promise<void> {\n if (!(await this.isChecked())) await this.toggle();\n }\n\n /** Unstage the row if it is staged. */\n async uncheck(): Promise<void> {\n if (await this.isChecked()) await this.toggle();\n }\n\n /** Move keyboard focus onto the row's checkbox — the row's only tab stop. */\n async focus(): Promise<void> {\n return (await this.input()).focus();\n }\n\n /** Whether the row's checkbox has focus. */\n async isFocused(): Promise<boolean> {\n return (await this.input()).isFocused();\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, type TestElement } from '@angular/cdk/testing';\n\nimport type { WrTransferItemHarnessFilters, WrTransferPaneHarnessFilters, WrTransferSide } from './types';\nimport { WrTransferItemHarness } from './wr-transfer-item-harness';\n\n/**\n * Test harness for ONE pane of a `<wr-transfer>` — reached with\n * `WrTransferHarness.getPane('source' | 'target')`.\n *\n * The two panes are the same block rendered twice (the component's template\n * iterates them), so they are one harness class keyed by side rather than two sets\n * of `…Source` / `…Target` methods: the side is named once, at `getPane()`, and\n * every question after that is asked of a pane without repeating which one. It also\n * means the symmetry cannot rot — a method that only works on the left is\n * impossible to write here.\n *\n * What a pane SHOWS is the honest scope of everything below. `[items]` minus the\n * value on the left, the value on the right, and then the pane's own filter on top:\n * rows a filter has hidden are not rendered at all, are not counted by the header,\n * and — the component's own rule — are not moved either, however they were staged.\n *\n * @example\n * ```ts\n * const source = await transfer.getPane('source');\n *\n * await source.search('adm');\n * await source.checkAll();\n * expect(await source.getCheckedLabels()).toEqual(['Admin']);\n * ```\n *\n * @see https://ngwr.dev/guides/testing\n */\nexport class WrTransferPaneHarness extends ComponentHarness {\n /**\n * The pane is a plain `<div>` with no role of its own — the heading names the\n * list, and the checkbox in each row carries the semantics — so its BEM class is\n * the only handle, and being `ViewEncapsulation.None` that class is public API.\n */\n static hostSelector = '.wr-transfer__pane';\n\n /** Build a predicate that narrows the query — pass to `getHarness` / `getAllHarnesses`. */\n static with(options: WrTransferPaneHarnessFilters = {}): HarnessPredicate<WrTransferPaneHarness> {\n return new HarnessPredicate(WrTransferPaneHarness, options)\n .addOption('side', options.side, async (harness, side) => (await harness.getSide()) === side)\n .addOption('title', options.title, (harness, title) => HarnessPredicate.stringMatches(harness.getTitle(), title));\n }\n\n private readonly list = this.locatorFor('ul.wr-transfer__list');\n private readonly selectAllBox = this.locatorFor('.wr-transfer__head input.wr-checkbox__input');\n private readonly searchBox = this.locatorForOptional('.wr-transfer__search input');\n\n /**\n * Which side this pane is.\n *\n * From the `--target` modifier rather than from DOM order: order is a layout fact\n * that `dir=\"rtl\"` and any future reflow are free to change, while the modifier is\n * what the component says the pane MEANS.\n */\n async getSide(): Promise<WrTransferSide> {\n return (await (await this.host()).hasClass('wr-transfer__pane--target')) ? 'target' : 'source';\n }\n\n /** The pane's heading — `[sourceTitle]` / `[targetTitle]`, or the i18n fallback. */\n async getTitle(): Promise<string> {\n return (await this.locatorFor('.wr-transfer__title')()).text();\n }\n\n /**\n * The count beside the heading, verbatim — `'1 / 4'` with the built-in copy.\n *\n * Deliberately not parsed into numbers: it is an i18n FORMAT\n * (`transfer.count`) a consuming app can replace wholesale, so a harness that\n * split it on `/` would answer for the default catalog and break on a translated\n * one. Its two numbers are `(await getCheckedLabels()).length` and\n * `(await getItems()).length` — both of which this harness reads from the rendered\n * rows, so a spec can assert the header agrees with them.\n */\n async getCountText(): Promise<string> {\n return (await this.locatorFor('.wr-transfer__count')()).text();\n }\n\n /**\n * The list's accessible name — the `aria-label` on the `<ul>`, which repeats the\n * heading so that a row announced in isolation still says which pane it is in.\n */\n async getListLabel(): Promise<string | null> {\n return (await this.list()).getAttribute('aria-label');\n }\n\n /**\n * The explicit `role` on the pane's list, which is `null` — and that `null` is the\n * ANSWER, not a gap worth fixing.\n *\n * The pane is a plain `<ul>` of checkboxes on purpose. Dressing it as a\n * `role=\"listbox\"` of `role=\"option\"` rows reads better in the abstract but is\n * invalid: an option may not contain an interactive control, and the axe gate\n * rejects it. Pinning this is what keeps that \"improvement\" from looking like a\n * win.\n */\n async getListRole(): Promise<string | null> {\n return (await this.list()).getAttribute('role');\n }\n\n /** The rows the pane is showing, in render order. */\n async getItems(filters: WrTransferItemHarnessFilters = {}): Promise<WrTransferItemHarness[]> {\n return this.locatorForAll(WrTransferItemHarness.with(filters))();\n }\n\n /**\n * The labels the pane is showing, in render order.\n *\n * On the right that is the value, in the order the user built it — not `[items]`\n * order, which the component deliberately does not impose.\n */\n async getItemLabels(): Promise<string[]> {\n const items = await this.getItems();\n return Promise.all(items.map(item => item.getLabel()));\n }\n\n /** The first row matching the filters, or a failure that says what the pane is showing. */\n async getItem(filters: WrTransferItemHarnessFilters): Promise<WrTransferItemHarness> {\n const [item] = await this.getItems(filters);\n if (!item) {\n const showing = await this.getItemLabels();\n const side = await this.getSide();\n throw new Error(\n `WrTransferPaneHarness.getItem(): no row matched ${JSON.stringify(filters)} in the ${side} pane, ` +\n `which is showing [${showing.join(', ')}]. A row in the other pane, or one this pane's search has ` +\n 'filtered out, is not here.'\n );\n }\n return item;\n }\n\n /**\n * The labels of the rows STAGED for the next move, in render order.\n *\n * The staged set and the value are different things, and this is the one the pane\n * shows: read from the rendered rows, so a row staged before a search hid it is\n * absent — exactly as the header count and the move itself treat it.\n */\n async getCheckedLabels(): Promise<string[]> {\n const items = await this.getItems({ checked: true });\n return Promise.all(items.map(item => item.getLabel()));\n }\n\n /** The placeholder shown in a pane with no rows, or `null` while it has some. */\n async getEmptyText(): Promise<string | null> {\n const empty = await this.locatorForOptional('.wr-transfer__empty')();\n return empty ? empty.text() : null;\n }\n\n /** Whether this pane has a filter box — `[searchable]` puts one above both panes. */\n async hasSearch(): Promise<boolean> {\n return (await this.searchBox()) !== null;\n }\n\n /**\n * Type into the pane's filter box, narrowing it to the rows whose label contains\n * the query (case-insensitively).\n *\n * Pass `''` to clear it. No `change` is dispatched — `input` is the event the\n * component listens for, and the one a real keystroke carries; a browser defers\n * `change` on a text field to the commit, so nothing here depends on it. (The\n * keystrokes themselves come with the `keydown` / `keypress` / `keyup` the CDK\n * sends alongside, which this component ignores.)\n */\n async search(query: string): Promise<void> {\n const box = await this.searchBox();\n if (!box) {\n throw new Error(\n `WrTransferPaneHarness.search(): the ${await this.getSide()} pane has no filter box — ` +\n '`searchable` is off on the transfer, and it turns them on for both panes at once.'\n );\n }\n\n // `clear()` dispatches `input` on its own, and `sendKeys('')` throws, so an empty\n // query is the clear and nothing else.\n await box.clear();\n if (query.length > 0) await box.sendKeys(query);\n }\n\n /** What is currently typed in the pane's filter box, or `''`. Throws when there is none. */\n async getSearchValue(): Promise<string> {\n return (await this.searchOrThrow('getSearchValue')).getProperty<string>('value');\n }\n\n /** The filter box's placeholder — `[searchPlaceholder]`, or the i18n fallback. */\n async getSearchPlaceholder(): Promise<string> {\n return (await this.searchOrThrow('getSearchPlaceholder')).getProperty<string>('placeholder');\n }\n\n /**\n * The filter box's accessible name.\n *\n * Composed with the pane heading by the component, and it has to be: both panes\n * carry the same placeholder, so an unnamed pair announces as two identical\n * \"Search\" fields with no way to tell which list either one filters.\n */\n async getSearchLabel(): Promise<string | null> {\n return (await this.searchOrThrow('getSearchLabel')).getAttribute('aria-label');\n }\n\n /**\n * The select-all box's accessible name.\n *\n * It has one of its own — the heading names the LIST, so reusing it here would\n * leave a screen reader announcing two different controls identically.\n */\n async getSelectAllLabel(): Promise<string | null> {\n return (await this.selectAllBox()).getAttribute('aria-label');\n }\n\n /** Whether every row the pane is showing that CAN be staged is staged. */\n async isAllChecked(): Promise<boolean> {\n return (await this.selectAllBox()).getProperty<boolean>('checked');\n }\n\n /**\n * Whether some of the pane's stageable rows are staged and others are not.\n *\n * `indeterminate` is a DOM PROPERTY, not an attribute — reading the attribute\n * would report `null` for a box that is visibly dashed.\n */\n async isPartiallyChecked(): Promise<boolean> {\n return (await this.selectAllBox()).getProperty<boolean>('indeterminate');\n }\n\n /**\n * Whether the select-all box refuses interaction — a disabled transfer, or a pane\n * with nothing stageable in it (empty, filtered to nothing, or showing only\n * disabled rows).\n */\n async isSelectAllDisabled(): Promise<boolean> {\n return (await this.selectAllBox()).getProperty<boolean>('disabled');\n }\n\n /**\n * Click the select-all box once.\n *\n * Its scope is the rows the pane is SHOWING and can stage: a filtered-out row and\n * a disabled row are both outside it. Worth knowing before asserting on a partial\n * pane — the box reads UNchecked while the staging is partial, so one click there\n * stages everything rather than clearing it. {@link uncheckAll} handles that.\n */\n async toggleSelectAll(): Promise<void> {\n if (await this.isSelectAllDisabled()) {\n throw new Error(\n `WrTransferPaneHarness.toggleSelectAll(): the ${await this.getSide()} pane's select-all is disabled, ` +\n 'so the click would change nothing — the transfer is disabled, or this pane shows no row that can be ' +\n 'staged (empty, filtered to nothing, or every row disabled).'\n );\n }\n await (await this.selectAllBox()).click();\n }\n\n /** Stage every row the pane shows that can be staged. A pane already fully staged is left alone. */\n async checkAll(): Promise<void> {\n if (!(await this.isAllChecked())) await this.toggleSelectAll();\n }\n\n /** Clear the pane's staging. */\n async uncheckAll(): Promise<void> {\n if (await this.isAllChecked()) {\n await this.toggleSelectAll();\n return;\n }\n // Two clicks from a partial pane, and there is no shortcut: the box is UNchecked\n // there, so the first click stages the rest and only the second clears the lot.\n if (await this.isPartiallyChecked()) {\n await this.toggleSelectAll();\n await this.toggleSelectAll();\n }\n }\n\n /** The filter box, or a failure naming the input that turns it on. */\n private async searchOrThrow(method: string): Promise<TestElement> {\n const box = await this.searchBox();\n if (!box) {\n throw new Error(\n `WrTransferPaneHarness.${method}(): the ${await this.getSide()} pane has no filter box — ` +\n '`searchable` is off on the transfer.'\n );\n }\n return box;\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, type TestElement } from '@angular/cdk/testing';\n\nimport type { WrTransferHarnessFilters, WrTransferSide } from './types';\nimport { WrTransferItemHarness } from './wr-transfer-item-harness';\nimport { WrTransferPaneHarness } from './wr-transfer-pane-harness';\n\n/**\n * Test harness for `<wr-transfer>` — the root of a small family, since a dual\n * listbox is three things and not one control: {@link WrTransferPaneHarness} for one\n * pane and {@link WrTransferItemHarness} for one row inside it.\n *\n * **Everything is keyed by SIDE, never duplicated per pane.** The two panes are the\n * same block rendered twice, so a `…Source` / `…Target` method pair for each\n * question would double the surface and let the halves drift; instead\n * {@link getPane} takes the side once and the pane answers, and the two whole-\n * control operations that are inherently directional — the move buttons — take the\n * side they move rows INTO. `moveTo('target')` is the right-facing button in an LTR\n * layout, and stays the correct one under `dir=\"rtl\"`, where \"right\" is not.\n *\n * **The staged ticks are not the value.** `[(value)]` is the RIGHT pane's\n * membership; a tick inside either pane is transient staging that the next move\n * spends and clears. Conflating them is the failure this component invites, so the\n * two are separate questions here: {@link WrTransferPaneHarness.getItemLabels} is\n * what a pane HOLDS (the value, on the right) and\n * {@link WrTransferPaneHarness.getCheckedLabels} is what it has STAGED.\n *\n * Both are scoped to what a pane is showing, which is also the component's own rule\n * for a move: a row staged before a search hid it is no longer counted, no longer\n * ticked, and does not travel.\n *\n * @example\n * ```ts\n * const transfer = await loader.getHarness(WrTransferHarness);\n * const source = await transfer.getPane('source');\n *\n * await (await source.getItem({ label: 'Read' })).check();\n * await transfer.moveTo('target');\n *\n * expect(await (await transfer.getPane('target')).getItemLabels()).toEqual(['Read']);\n * ```\n *\n * @see https://ngwr.dev/guides/testing\n */\nexport class WrTransferHarness extends ComponentHarness {\n static hostSelector = 'wr-transfer';\n\n /** Build a predicate that narrows the query — pass to `getHarness` / `getAllHarnesses`. */\n static with(options: WrTransferHarnessFilters = {}): HarnessPredicate<WrTransferHarness> {\n return new HarnessPredicate(WrTransferHarness, options)\n .addOption('sourceTitle', options.sourceTitle, (harness, title) =>\n HarnessPredicate.stringMatches(harness.paneTitle('source'), title)\n )\n .addOption('targetTitle', options.targetTitle, (harness, title) =>\n HarnessPredicate.stringMatches(harness.paneTitle('target'), title)\n )\n .addOption('itemLabel', options.itemLabel, async (harness, label) => {\n for (const shown of await harness.shownLabels()) {\n if (await HarnessPredicate.stringMatches(shown, label)) return true;\n }\n return false;\n })\n .addOption(\n 'searchable',\n options.searchable,\n async (harness, searchable) => (await harness.isSearchable()) === searchable\n )\n .addOption('disabled', options.disabled, async (harness, disabled) => (await harness.isDisabled()) === disabled);\n }\n\n /**\n * One of the two panes — `'source'` is the left one (the rows outside the value),\n * `'target'` the right one (the value).\n *\n * The side is named here and nowhere else; see the class note.\n */\n async getPane(side: WrTransferSide): Promise<WrTransferPaneHarness> {\n return this.locatorFor(WrTransferPaneHarness.with({ side }))();\n }\n\n /**\n * Whether the whole control refuses interaction.\n *\n * From the host modifier, which is the only signal the host itself carries: a\n * `<wr-transfer>` element is not a control and publishes no `aria-disabled` of its\n * own — the state reaches assistive tech through the checkboxes, the buttons and\n * the filter boxes it disables, which is where\n * {@link WrTransferItemHarness.isDisabled} and {@link canMoveTo} read it.\n */\n async isDisabled(): Promise<boolean> {\n return (await this.host()).hasClass('wr-transfer--disabled');\n }\n\n /** Whether the panes have filter boxes — `[searchable]` gives both one or neither. */\n async isSearchable(): Promise<boolean> {\n return (await this.host()).hasClass('wr-transfer--searchable');\n }\n\n /**\n * Whether the button that moves rows INTO `side` is offering itself.\n *\n * It is enabled only while the OTHER pane has something staged and showing, so\n * this is also the readable way to assert that staging landed — and that a search\n * which hid a staged row took the move away again.\n *\n * Read from the native `disabled` attribute: these are `button[wr-btn]`, the\n * native shape, where that attribute is the state. (`wr-btn` adds `aria-disabled`\n * only for its custom-element shape, on which `disabled` is inert.)\n */\n async canMoveTo(side: WrTransferSide): Promise<boolean> {\n return (await (await this.moveButton(side)).getAttribute('disabled')) === null;\n }\n\n /**\n * The accessible name of the button that moves rows INTO `side` —\n * `[toTargetLabel]` / `[toSourceLabel]`, or the i18n fallback.\n *\n * Worth pinning: the button's only content is an `aria-hidden` chevron, so this\n * `aria-label` is the entire announcement. Lose it and the pair becomes two\n * unnamed buttons.\n */\n async getMoveLabel(side: WrTransferSide): Promise<string | null> {\n return (await this.moveButton(side)).getAttribute('aria-label');\n }\n\n /**\n * Press the button that moves the staged rows INTO `side`, committing them to the\n * value.\n *\n * Only the rows the other pane is SHOWING as staged travel, and the staging is\n * cleared afterwards — the component's rule, not this harness's.\n *\n * Refuses a disabled button rather than pressing it: a native disabled `<button>`\n * swallows the click before Angular's listener sees it, so the call would resolve\n * having moved nothing at all.\n */\n async moveTo(side: WrTransferSide): Promise<void> {\n if (!(await this.canMoveTo(side))) {\n const from: WrTransferSide = side === 'target' ? 'source' : 'target';\n throw new Error(\n `WrTransferHarness.moveTo('${side}'): the button is disabled, so nothing would move. The ${from} pane ` +\n 'has nothing staged and showing — a row staged before a search hid it no longer counts — or the whole ' +\n 'transfer is disabled.'\n );\n }\n await (await this.moveButton(side)).click();\n }\n\n /**\n * Stage everything the other pane can stage, then move it INTO `side`.\n *\n * \"Everything\" is the pane's own scope: the rows it is SHOWING, disabled ones\n * excluded. A search narrows it, and with a filter typed this moves what is\n * visible rather than the whole pane.\n */\n async moveAllTo(side: WrTransferSide): Promise<void> {\n const from = await this.getPane(side === 'target' ? 'source' : 'target');\n await from.checkAll();\n await this.moveTo(side);\n }\n\n /** The heading of one pane — the `sourceTitle` / `targetTitle` filters run through this. */\n private async paneTitle(side: WrTransferSide): Promise<string> {\n return (await this.getPane(side)).getTitle();\n }\n\n /** Every label rendered in either pane, for the `itemLabel` filter. */\n private async shownLabels(): Promise<string[]> {\n const items = await this.locatorForAll(WrTransferItemHarness)();\n return Promise.all(items.map(item => item.getLabel()));\n }\n\n /**\n * The move button for a direction, addressed by its `--to-source` / `--to-target`\n * modifier.\n *\n * Not by DOM order, and that is the point: two identically classed buttons whose\n * only difference was their position would let a template reshuffle silently\n * reverse every `moveTo()` in every consumer's suite, with both directions still\n * green. Not by the `aria-label` either — that string is localizable.\n */\n private async moveButton(side: WrTransferSide): Promise<TestElement> {\n return this.locatorFor(`.wr-transfer__move--to-${side}`)();\n }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EAC7D,OAAO,QAAQ,IAAI,MAAM,KAAI,SAAQ,KAAK,SAAQ,CAAE,CAAC;CACvD;CAWQ,MAAM,WAAW,MAAoB;EAC3C,OAAO,KAAK,WAAW,0BAA0B,MAAM,CAAC,CAAA;CAC1D"}
|
|
1
|
+
{"version":3,"file":"ngwr-transfer-testing.mjs","names":[],"sources":["../../../projects/lib/transfer/testing/wr-transfer-item-harness.ts","../../../projects/lib/transfer/testing/wr-transfer-pane-harness.ts","../../../projects/lib/transfer/testing/wr-transfer-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 } from '@angular/cdk/testing';\n\nimport type { WrTransferItemHarnessFilters } from './types';\n\n/**\n * Test harness for one row of a `<wr-transfer>` pane.\n *\n * A row is a `<li>` holding a `<wr-checkbox>`, and the checkbox is the thing the\n * user operates — so the state is read from the native `<input type=\"checkbox\">`\n * inside it, and {@link toggle} clicks that. The pane is deliberately NOT a\n * `role=\"listbox\"` of `role=\"option\"` rows (an option may not contain an\n * interactive control, and the axe gate says so), which is why there is no\n * `aria-selected` here to read: the checkbox's own state IS the announcement.\n *\n * **Checked is not the value.** A tick stages the row for the next move and\n * nothing more; which pane the row sits in is what `[(value)]` carries. Staging is\n * spent — and cleared — by the move that commits it.\n *\n * @example\n * ```ts\n * const source = await transfer.getPane('source');\n * await (await source.getItem({ label: 'Read' })).check();\n *\n * await transfer.moveTo('target');\n * ```\n *\n * @see https://ngwr.dev/guides/testing\n */\nexport class WrTransferItemHarness extends ComponentHarness {\n /**\n * `.wr-transfer__item` is a DATA row and nothing else.\n *\n * An empty pane renders an `<li class=\"wr-transfer__empty\">` for its placeholder,\n * so querying `li` would hand that back as a row with no checkbox to read.\n */\n static hostSelector = '.wr-transfer__item';\n\n /** Build a predicate that narrows the query — pass to `getHarness` / `getAllHarnesses`. */\n static with(options: WrTransferItemHarnessFilters = {}): HarnessPredicate<WrTransferItemHarness> {\n return new HarnessPredicate(WrTransferItemHarness, options)\n .addOption('label', options.label, (harness, label) => HarnessPredicate.stringMatches(harness.getLabel(), label))\n .addOption('checked', options.checked, async (harness, checked) => (await harness.isChecked()) === checked)\n .addOption('disabled', options.disabled, async (harness, disabled) => (await harness.isDisabled()) === disabled);\n }\n\n private readonly input = this.locatorFor('input.wr-checkbox__input');\n\n /** The row's label, trimmed — the `WrTransferItem.label` the pane shows and the search matches. */\n async getLabel(): Promise<string> {\n return (await this.locatorFor('.wr-checkbox__text')()).text();\n }\n\n /**\n * Whether the row is STAGED for the next move.\n *\n * Not \"selected\": a row's pane is what the value says, and the tick is transient\n * staging the move spends. `WrTransferPaneHarness.getCheckedLabels()` reads the\n * whole staged set of a pane.\n */\n async isChecked(): Promise<boolean> {\n return (await this.input()).getProperty<boolean>('checked');\n }\n\n /**\n * Whether the row refuses staging.\n *\n * The native input's `disabled` — the state a screen reader is given and the one\n * that decides whether a click does anything. It answers `true` for BOTH reasons a\n * row can be inert: the item's own `disabled` flag, and a disabled transfer, which\n * disables every row. The `wr-transfer__item--disabled` modifier only marks the\n * first of those, so it is the narrower question and not the one that predicts\n * behaviour.\n */\n async isDisabled(): Promise<boolean> {\n return (await this.input()).getProperty<boolean>('disabled');\n }\n\n /**\n * Flip the row's staging.\n *\n * Refuses a disabled row rather than clicking into the void: the component drops\n * the toggle outright, so the click would resolve having changed nothing and the\n * failure would surface as an unexplained empty move two assertions later.\n */\n async toggle(): Promise<void> {\n if (await this.isDisabled()) {\n const label = await this.getLabel();\n throw new Error(\n `WrTransferItemHarness.toggle(): \"${label}\" is disabled and the component refuses to stage it. ` +\n 'Either the item carries `disabled`, or the whole transfer does — check isDisabled() on the transfer too.'\n );\n }\n await (await this.input()).click();\n }\n\n /** Stage the row if it is not already staged. */\n async check(): Promise<void> {\n if (!(await this.isChecked())) await this.toggle();\n }\n\n /** Unstage the row if it is staged. */\n async uncheck(): Promise<void> {\n if (await this.isChecked()) await this.toggle();\n }\n\n /** Move keyboard focus onto the row's checkbox — the row's only tab stop. */\n async focus(): Promise<void> {\n return (await this.input()).focus();\n }\n\n /** Whether the row's checkbox has focus. */\n async isFocused(): Promise<boolean> {\n return (await this.input()).isFocused();\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, type TestElement } from '@angular/cdk/testing';\n\nimport type { WrTransferItemHarnessFilters, WrTransferPaneHarnessFilters, WrTransferSide } from './types';\nimport { WrTransferItemHarness } from './wr-transfer-item-harness';\n\n/**\n * Test harness for ONE pane of a `<wr-transfer>` — reached with\n * `WrTransferHarness.getPane('source' | 'target')`.\n *\n * The two panes are the same block rendered twice (the component's template\n * iterates them), so they are one harness class keyed by side rather than two sets\n * of `…Source` / `…Target` methods: the side is named once, at `getPane()`, and\n * every question after that is asked of a pane without repeating which one. It also\n * means the symmetry cannot rot — a method that only works on the left is\n * impossible to write here.\n *\n * What a pane SHOWS is the honest scope of everything below. `[items]` minus the\n * value on the left, the value on the right, and then the pane's own filter on top:\n * rows a filter has hidden are not rendered at all, are not counted by the header,\n * and — the component's own rule — are not moved either, however they were staged.\n *\n * @example\n * ```ts\n * const source = await transfer.getPane('source');\n *\n * await source.search('adm');\n * await source.checkAll();\n * expect(await source.getCheckedLabels()).toEqual(['Admin']);\n * ```\n *\n * @see https://ngwr.dev/guides/testing\n */\nexport class WrTransferPaneHarness extends ComponentHarness {\n /**\n * The pane is a plain `<div>` with no role of its own — the heading names the\n * list, and the checkbox in each row carries the semantics — so its BEM class is\n * the only handle, and being `ViewEncapsulation.None` that class is public API.\n */\n static hostSelector = '.wr-transfer__pane';\n\n /** Build a predicate that narrows the query — pass to `getHarness` / `getAllHarnesses`. */\n static with(options: WrTransferPaneHarnessFilters = {}): HarnessPredicate<WrTransferPaneHarness> {\n return new HarnessPredicate(WrTransferPaneHarness, options)\n .addOption('side', options.side, async (harness, side) => (await harness.getSide()) === side)\n .addOption('title', options.title, (harness, title) => HarnessPredicate.stringMatches(harness.getTitle(), title));\n }\n\n private readonly list = this.locatorFor('ul.wr-transfer__list');\n private readonly selectAllBox = this.locatorFor('.wr-transfer__head input.wr-checkbox__input');\n private readonly searchBox = this.locatorForOptional('.wr-transfer__search input');\n\n /**\n * Which side this pane is.\n *\n * From the `--target` modifier rather than from DOM order: order is a layout fact\n * that `dir=\"rtl\"` and any future reflow are free to change, while the modifier is\n * what the component says the pane MEANS.\n */\n async getSide(): Promise<WrTransferSide> {\n return (await (await this.host()).hasClass('wr-transfer__pane--target')) ? 'target' : 'source';\n }\n\n /** The pane's heading — `[sourceTitle]` / `[targetTitle]`, or the i18n fallback. */\n async getTitle(): Promise<string> {\n return (await this.locatorFor('.wr-transfer__title')()).text();\n }\n\n /**\n * The count beside the heading, verbatim — `'1 / 4'` with the built-in copy.\n *\n * Deliberately not parsed into numbers: it is an i18n FORMAT\n * (`transfer.count`) a consuming app can replace wholesale, so a harness that\n * split it on `/` would answer for the default catalog and break on a translated\n * one. Its two numbers are `(await getCheckedLabels()).length` and\n * `(await getItems()).length` — both of which this harness reads from the rendered\n * rows, so a spec can assert the header agrees with them.\n */\n async getCountText(): Promise<string> {\n return (await this.locatorFor('.wr-transfer__count')()).text();\n }\n\n /**\n * The list's accessible name — the `aria-label` on the `<ul>`, which repeats the\n * heading so that a row announced in isolation still says which pane it is in.\n */\n async getListLabel(): Promise<string | null> {\n return (await this.list()).getAttribute('aria-label');\n }\n\n /**\n * The explicit `role` on the pane's list, which is `null` — and that `null` is the\n * ANSWER, not a gap worth fixing.\n *\n * The pane is a plain `<ul>` of checkboxes on purpose. Dressing it as a\n * `role=\"listbox\"` of `role=\"option\"` rows reads better in the abstract but is\n * invalid: an option may not contain an interactive control, and the axe gate\n * rejects it. Pinning this is what keeps that \"improvement\" from looking like a\n * win.\n */\n async getListRole(): Promise<string | null> {\n return (await this.list()).getAttribute('role');\n }\n\n /** The rows the pane is showing, in render order. */\n async getItems(filters: WrTransferItemHarnessFilters = {}): Promise<WrTransferItemHarness[]> {\n return this.locatorForAll(WrTransferItemHarness.with(filters))();\n }\n\n /**\n * The labels the pane is showing, in render order.\n *\n * On the right that is the value, in the order the user built it — not `[items]`\n * order, which the component deliberately does not impose.\n */\n async getItemLabels(): Promise<string[]> {\n const items = await this.getItems();\n return Promise.all(items.map(item => item.getLabel()));\n }\n\n /** The first row matching the filters, or a failure that says what the pane is showing. */\n async getItem(filters: WrTransferItemHarnessFilters): Promise<WrTransferItemHarness> {\n const [item] = await this.getItems(filters);\n if (!item) {\n const showing = await this.getItemLabels();\n const side = await this.getSide();\n throw new Error(\n `WrTransferPaneHarness.getItem(): no row matched ${JSON.stringify(filters)} in the ${side} pane, ` +\n `which is showing [${showing.join(', ')}]. A row in the other pane, or one this pane's search has ` +\n 'filtered out, is not here.'\n );\n }\n return item;\n }\n\n /**\n * The labels of the rows STAGED for the next move, in render order.\n *\n * The staged set and the value are different things, and this is the one the pane\n * shows: read from the rendered rows, so a row staged before a search hid it is\n * absent — exactly as the header count and the move itself treat it.\n */\n async getCheckedLabels(): Promise<string[]> {\n const items = await this.getItems({ checked: true });\n return Promise.all(items.map(item => item.getLabel()));\n }\n\n /** The placeholder shown in a pane with no rows, or `null` while it has some. */\n async getEmptyText(): Promise<string | null> {\n const empty = await this.locatorForOptional('.wr-transfer__empty')();\n return empty ? empty.text() : null;\n }\n\n /** Whether this pane has a filter box — `[searchable]` puts one above both panes. */\n async hasSearch(): Promise<boolean> {\n return (await this.searchBox()) !== null;\n }\n\n /**\n * Type into the pane's filter box, narrowing it to the rows whose label contains\n * the query (case-insensitively).\n *\n * Pass `''` to clear it. No `change` is dispatched — `input` is the event the\n * component listens for, and the one a real keystroke carries; a browser defers\n * `change` on a text field to the commit, so nothing here depends on it. (The\n * keystrokes themselves come with the `keydown` / `keypress` / `keyup` the CDK\n * sends alongside, which this component ignores.)\n */\n async search(query: string): Promise<void> {\n const box = await this.searchBox();\n if (!box) {\n throw new Error(\n `WrTransferPaneHarness.search(): the ${await this.getSide()} pane has no filter box — ` +\n '`searchable` is off on the transfer, and it turns them on for both panes at once.'\n );\n }\n\n // `clear()` dispatches `input` on its own, and `sendKeys('')` throws, so an empty\n // query is the clear and nothing else.\n await box.clear();\n if (query.length > 0) await box.sendKeys(query);\n }\n\n /** What is currently typed in the pane's filter box, or `''`. Throws when there is none. */\n async getSearchValue(): Promise<string> {\n return (await this.searchOrThrow('getSearchValue')).getProperty<string>('value');\n }\n\n /** The filter box's placeholder — `[searchPlaceholder]`, or the i18n fallback. */\n async getSearchPlaceholder(): Promise<string> {\n return (await this.searchOrThrow('getSearchPlaceholder')).getProperty<string>('placeholder');\n }\n\n /**\n * The filter box's accessible name.\n *\n * Composed with the pane heading by the component, and it has to be: both panes\n * carry the same placeholder, so an unnamed pair announces as two identical\n * \"Search\" fields with no way to tell which list either one filters.\n */\n async getSearchLabel(): Promise<string | null> {\n return (await this.searchOrThrow('getSearchLabel')).getAttribute('aria-label');\n }\n\n /**\n * The select-all box's accessible name.\n *\n * It has one of its own — the heading names the LIST, so reusing it here would\n * leave a screen reader announcing two different controls identically.\n */\n async getSelectAllLabel(): Promise<string | null> {\n return (await this.selectAllBox()).getAttribute('aria-label');\n }\n\n /** Whether every row the pane is showing that CAN be staged is staged. */\n async isAllChecked(): Promise<boolean> {\n return (await this.selectAllBox()).getProperty<boolean>('checked');\n }\n\n /**\n * Whether some of the pane's stageable rows are staged and others are not.\n *\n * `indeterminate` is a DOM PROPERTY, not an attribute — reading the attribute\n * would report `null` for a box that is visibly dashed.\n */\n async isPartiallyChecked(): Promise<boolean> {\n return (await this.selectAllBox()).getProperty<boolean>('indeterminate');\n }\n\n /**\n * Whether the select-all box refuses interaction — a disabled transfer, or a pane\n * with nothing stageable in it (empty, filtered to nothing, or showing only\n * disabled rows).\n */\n async isSelectAllDisabled(): Promise<boolean> {\n return (await this.selectAllBox()).getProperty<boolean>('disabled');\n }\n\n /**\n * Click the select-all box once.\n *\n * Its scope is the rows the pane is SHOWING and can stage: a filtered-out row and\n * a disabled row are both outside it. Worth knowing before asserting on a partial\n * pane — the box reads UNchecked while the staging is partial, so one click there\n * stages everything rather than clearing it. {@link uncheckAll} handles that.\n */\n async toggleSelectAll(): Promise<void> {\n if (await this.isSelectAllDisabled()) {\n throw new Error(\n `WrTransferPaneHarness.toggleSelectAll(): the ${await this.getSide()} pane's select-all is disabled, ` +\n 'so the click would change nothing — the transfer is disabled, or this pane shows no row that can be ' +\n 'staged (empty, filtered to nothing, or every row disabled).'\n );\n }\n await (await this.selectAllBox()).click();\n }\n\n /** Stage every row the pane shows that can be staged. A pane already fully staged is left alone. */\n async checkAll(): Promise<void> {\n if (!(await this.isAllChecked())) await this.toggleSelectAll();\n }\n\n /** Clear the pane's staging. */\n async uncheckAll(): Promise<void> {\n if (await this.isAllChecked()) {\n await this.toggleSelectAll();\n return;\n }\n // Two clicks from a partial pane, and there is no shortcut: the box is UNchecked\n // there, so the first click stages the rest and only the second clears the lot.\n if (await this.isPartiallyChecked()) {\n await this.toggleSelectAll();\n await this.toggleSelectAll();\n }\n }\n\n /** The filter box, or a failure naming the input that turns it on. */\n private async searchOrThrow(method: string): Promise<TestElement> {\n const box = await this.searchBox();\n if (!box) {\n throw new Error(\n `WrTransferPaneHarness.${method}(): the ${await this.getSide()} pane has no filter box — ` +\n '`searchable` is off on the transfer.'\n );\n }\n return box;\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, type TestElement } from '@angular/cdk/testing';\n\nimport type { WrTransferSize } from 'ngwr/transfer';\n\nimport type { WrTransferHarnessFilters, WrTransferSide } from './types';\nimport { WrTransferItemHarness } from './wr-transfer-item-harness';\nimport { WrTransferPaneHarness } from './wr-transfer-pane-harness';\n\n/**\n * Test harness for `<wr-transfer>` — the root of a small family, since a dual\n * listbox is three things and not one control: {@link WrTransferPaneHarness} for one\n * pane and {@link WrTransferItemHarness} for one row inside it.\n *\n * **Everything is keyed by SIDE, never duplicated per pane.** The two panes are the\n * same block rendered twice, so a `…Source` / `…Target` method pair for each\n * question would double the surface and let the halves drift; instead\n * {@link getPane} takes the side once and the pane answers, and the two whole-\n * control operations that are inherently directional — the move buttons — take the\n * side they move rows INTO. `moveTo('target')` is the right-facing button in an LTR\n * layout, and stays the correct one under `dir=\"rtl\"`, where \"right\" is not.\n *\n * **The staged ticks are not the value.** `[(value)]` is the RIGHT pane's\n * membership; a tick inside either pane is transient staging that the next move\n * spends and clears. Conflating them is the failure this component invites, so the\n * two are separate questions here: {@link WrTransferPaneHarness.getItemLabels} is\n * what a pane HOLDS (the value, on the right) and\n * {@link WrTransferPaneHarness.getCheckedLabels} is what it has STAGED.\n *\n * Both are scoped to what a pane is showing, which is also the component's own rule\n * for a move: a row staged before a search hid it is no longer counted, no longer\n * ticked, and does not travel.\n *\n * @example\n * ```ts\n * const transfer = await loader.getHarness(WrTransferHarness);\n * const source = await transfer.getPane('source');\n *\n * await (await source.getItem({ label: 'Read' })).check();\n * await transfer.moveTo('target');\n *\n * expect(await (await transfer.getPane('target')).getItemLabels()).toEqual(['Read']);\n * ```\n *\n * @see https://ngwr.dev/guides/testing\n */\nexport class WrTransferHarness extends ComponentHarness {\n static hostSelector = 'wr-transfer';\n\n /** Build a predicate that narrows the query — pass to `getHarness` / `getAllHarnesses`. */\n static with(options: WrTransferHarnessFilters = {}): HarnessPredicate<WrTransferHarness> {\n return new HarnessPredicate(WrTransferHarness, options)\n .addOption('sourceTitle', options.sourceTitle, (harness, title) =>\n HarnessPredicate.stringMatches(harness.paneTitle('source'), title)\n )\n .addOption('targetTitle', options.targetTitle, (harness, title) =>\n HarnessPredicate.stringMatches(harness.paneTitle('target'), title)\n )\n .addOption('itemLabel', options.itemLabel, async (harness, label) => {\n for (const shown of await harness.shownLabels()) {\n if (await HarnessPredicate.stringMatches(shown, label)) return true;\n }\n return false;\n })\n .addOption(\n 'searchable',\n options.searchable,\n async (harness, searchable) => (await harness.isSearchable()) === searchable\n )\n .addOption('disabled', options.disabled, async (harness, disabled) => (await harness.isDisabled()) === disabled);\n }\n\n /**\n * One of the two panes — `'source'` is the left one (the rows outside the value),\n * `'target'` the right one (the value).\n *\n * The side is named here and nowhere else; see the class note.\n */\n async getPane(side: WrTransferSide): Promise<WrTransferPaneHarness> {\n return this.locatorFor(WrTransferPaneHarness.with({ side }))();\n }\n\n /** The control size. `'md'` is the default and paints no modifier of its own. */\n async getSize(): Promise<WrTransferSize> {\n const host = await this.host();\n if (await host.hasClass('wr-transfer--sm')) return 'sm';\n if (await host.hasClass('wr-transfer--lg')) return 'lg';\n return 'md';\n }\n\n /**\n * Whether the whole control refuses interaction.\n *\n * From the host modifier, which is the only signal the host itself carries: a\n * `<wr-transfer>` element is not a control and publishes no `aria-disabled` of its\n * own — the state reaches assistive tech through the checkboxes, the buttons and\n * the filter boxes it disables, which is where\n * {@link WrTransferItemHarness.isDisabled} and {@link canMoveTo} read it.\n */\n async isDisabled(): Promise<boolean> {\n return (await this.host()).hasClass('wr-transfer--disabled');\n }\n\n /** Whether the panes have filter boxes — `[searchable]` gives both one or neither. */\n async isSearchable(): Promise<boolean> {\n return (await this.host()).hasClass('wr-transfer--searchable');\n }\n\n /**\n * Whether the button that moves rows INTO `side` is offering itself.\n *\n * It is enabled only while the OTHER pane has something staged and showing, so\n * this is also the readable way to assert that staging landed — and that a search\n * which hid a staged row took the move away again.\n *\n * Read from the native `disabled` attribute: these are `button[wr-btn]`, the\n * native shape, where that attribute is the state. (`wr-btn` adds `aria-disabled`\n * only for its custom-element shape, on which `disabled` is inert.)\n */\n async canMoveTo(side: WrTransferSide): Promise<boolean> {\n return (await (await this.moveButton(side)).getAttribute('disabled')) === null;\n }\n\n /**\n * The accessible name of the button that moves rows INTO `side` —\n * `[toTargetLabel]` / `[toSourceLabel]`, or the i18n fallback.\n *\n * Worth pinning: the button's only content is an `aria-hidden` chevron, so this\n * `aria-label` is the entire announcement. Lose it and the pair becomes two\n * unnamed buttons.\n */\n async getMoveLabel(side: WrTransferSide): Promise<string | null> {\n return (await this.moveButton(side)).getAttribute('aria-label');\n }\n\n /**\n * Press the button that moves the staged rows INTO `side`, committing them to the\n * value.\n *\n * Only the rows the other pane is SHOWING as staged travel, and the staging is\n * cleared afterwards — the component's rule, not this harness's.\n *\n * Refuses a disabled button rather than pressing it: a native disabled `<button>`\n * swallows the click before Angular's listener sees it, so the call would resolve\n * having moved nothing at all.\n */\n async moveTo(side: WrTransferSide): Promise<void> {\n if (!(await this.canMoveTo(side))) {\n const from: WrTransferSide = side === 'target' ? 'source' : 'target';\n throw new Error(\n `WrTransferHarness.moveTo('${side}'): the button is disabled, so nothing would move. The ${from} pane ` +\n 'has nothing staged and showing — a row staged before a search hid it no longer counts — or the whole ' +\n 'transfer is disabled.'\n );\n }\n await (await this.moveButton(side)).click();\n }\n\n /**\n * Stage everything the other pane can stage, then move it INTO `side`.\n *\n * \"Everything\" is the pane's own scope: the rows it is SHOWING, disabled ones\n * excluded. A search narrows it, and with a filter typed this moves what is\n * visible rather than the whole pane.\n */\n async moveAllTo(side: WrTransferSide): Promise<void> {\n const from = await this.getPane(side === 'target' ? 'source' : 'target');\n await from.checkAll();\n await this.moveTo(side);\n }\n\n /** The heading of one pane — the `sourceTitle` / `targetTitle` filters run through this. */\n private async paneTitle(side: WrTransferSide): Promise<string> {\n return (await this.getPane(side)).getTitle();\n }\n\n /** Every label rendered in either pane, for the `itemLabel` filter. */\n private async shownLabels(): Promise<string[]> {\n const items = await this.locatorForAll(WrTransferItemHarness)();\n return Promise.all(items.map(item => item.getLabel()));\n }\n\n /**\n * The move button for a direction, addressed by its `--to-source` / `--to-target`\n * modifier.\n *\n * Not by DOM order, and that is the point: two identically classed buttons whose\n * only difference was their position would let a template reshuffle silently\n * reverse every `moveTo()` in every consumer's suite, with both directions still\n * green. Not by the `aria-label` either — that string is localizable.\n */\n private async moveButton(side: WrTransferSide): Promise<TestElement> {\n return this.locatorFor(`.wr-transfer__move--to-${side}`)();\n }\n}\n"],"mappings":";;;;;;;AAmCA,IAAa,wBAAb,MAAa,8BAA8B,iBAAgB;CAOzD,OAAO,eAAe;CAGtB,OAAO,KAAK,UAAwC,CAAA,GAAE;EACpD,OAAO,IAAI,iBAAiB,uBAAuB,OAAO,CAAC,CACxD,UAAU,SAAS,QAAQ,QAAQ,SAAS,UAAU,iBAAiB,cAAc,QAAQ,SAAQ,GAAI,KAAK,CAAC,CAAC,CAChH,UAAU,WAAW,QAAQ,SAAS,OAAO,SAAS,YAAa,MAAM,QAAQ,UAAS,MAAQ,OAAO,CAAC,CAC1G,UAAU,YAAY,QAAQ,UAAU,OAAO,SAAS,aAAc,MAAM,QAAQ,WAAU,MAAQ,QAAQ;CACnH;CAEiB,QAAQ,KAAK,WAAW,0BAA0B;CAGnE,MAAM,WAAQ;EACZ,QAAQ,MAAM,KAAK,WAAW,oBAAoB,CAAC,CAAA,EAAA,CAAI,KAAI;CAC7D;CASA,MAAM,YAAS;EACb,QAAQ,MAAM,KAAK,MAAK,EAAA,CAAI,YAAqB,SAAS;CAC5D;CAYA,MAAM,aAAU;EACd,QAAQ,MAAM,KAAK,MAAK,EAAA,CAAI,YAAqB,UAAU;CAC7D;CASA,MAAM,SAAM;EACV,IAAI,MAAM,KAAK,WAAU,GAAI;GAC3B,MAAM,QAAQ,MAAM,KAAK,SAAQ;GACjC,MAAM,IAAI,MACR,oCAAoC,MAAK,gKACmE;EAEhH;EACA,OAAO,MAAM,KAAK,MAAK,EAAA,CAAI,MAAK;CAClC;CAGA,MAAM,QAAK;EACT,IAAI,CAAE,MAAM,KAAK,UAAS,GAAK,MAAM,KAAK,OAAM;CAClD;CAGA,MAAM,UAAO;EACX,IAAI,MAAM,KAAK,UAAS,GAAI,MAAM,KAAK,OAAM;CAC/C;CAGA,MAAM,QAAK;EACT,Q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