ngwr 11.1.0 → 12.0.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/README.md +7 -7
- package/burger/styles/_index.scss +1 -1
- package/button/styles/_index.scss +2 -2
- package/calendar/styles/_index.scss +32 -12
- package/calendar-heatmap/styles/_index.scss +20 -0
- package/carousel/styles/_index.scss +23 -1
- package/cascader/styles/_index.scss +15 -3
- package/checkbox/styles/_index.scss +2 -2
- package/circular-text/styles/_index.scss +11 -0
- package/collapse/styles/_index.scss +2 -2
- package/color-picker/styles/_index.scss +3 -3
- package/command-palette/styles/_index.scss +12 -0
- package/compare/styles/_index.scss +18 -2
- package/context-menu/styles/_index.scss +21 -2
- package/date-picker/styles/_index.scss +5 -5
- package/descriptions/styles/_index.scss +1 -1
- package/drag-drop/styles/_index.scss +28 -1
- package/drawer/styles/_index.scss +37 -0
- package/dropdown/styles/_index.scss +2 -2
- package/event-calendar/styles/_index.scss +67 -10
- package/fesm2022/ngwr-action-sheet-testing.mjs +313 -0
- package/fesm2022/ngwr-action-sheet-testing.mjs.map +1 -0
- package/fesm2022/ngwr-action-sheet.mjs +3 -3
- package/fesm2022/ngwr-affix.mjs +3 -3
- package/fesm2022/ngwr-alert.mjs +3 -3
- package/fesm2022/ngwr-anchor.mjs +3 -3
- package/fesm2022/ngwr-aurora.mjs +3 -3
- package/fesm2022/ngwr-avatar.mjs +3 -3
- package/fesm2022/ngwr-back-top.mjs +3 -3
- package/fesm2022/ngwr-badge.mjs +6 -6
- package/fesm2022/ngwr-bar-chart-testing.mjs +107 -0
- package/fesm2022/ngwr-bar-chart-testing.mjs.map +1 -0
- package/fesm2022/ngwr-bar-chart.mjs +3 -3
- package/fesm2022/ngwr-blur-text-testing.mjs +203 -0
- package/fesm2022/ngwr-blur-text-testing.mjs.map +1 -0
- package/fesm2022/ngwr-blur-text.mjs +18 -4
- package/fesm2022/ngwr-blur-text.mjs.map +1 -1
- package/fesm2022/ngwr-border-glow-testing.mjs +325 -0
- package/fesm2022/ngwr-border-glow-testing.mjs.map +1 -0
- package/fesm2022/ngwr-border-glow.mjs +4 -4
- package/fesm2022/ngwr-border-glow.mjs.map +1 -1
- package/fesm2022/ngwr-breadcrumbs.mjs +29 -17
- package/fesm2022/ngwr-breadcrumbs.mjs.map +1 -1
- package/fesm2022/ngwr-burger.mjs +3 -3
- package/fesm2022/ngwr-button.mjs +6 -6
- package/fesm2022/ngwr-calendar-heatmap-testing.mjs +95 -0
- package/fesm2022/ngwr-calendar-heatmap-testing.mjs.map +1 -0
- package/fesm2022/ngwr-calendar-heatmap.mjs +17 -5
- package/fesm2022/ngwr-calendar-heatmap.mjs.map +1 -1
- package/fesm2022/ngwr-calendar-testing.mjs +368 -0
- package/fesm2022/ngwr-calendar-testing.mjs.map +1 -0
- package/fesm2022/ngwr-calendar.mjs +228 -10
- package/fesm2022/ngwr-calendar.mjs.map +1 -1
- package/fesm2022/ngwr-card.mjs +10 -10
- package/fesm2022/ngwr-card.mjs.map +1 -1
- package/fesm2022/ngwr-carousel.mjs +124 -24
- package/fesm2022/ngwr-carousel.mjs.map +1 -1
- package/fesm2022/ngwr-cascader.mjs +60 -5
- package/fesm2022/ngwr-cascader.mjs.map +1 -1
- package/fesm2022/ngwr-checkbox.mjs +14 -6
- package/fesm2022/ngwr-checkbox.mjs.map +1 -1
- package/fesm2022/ngwr-circular-text-testing.mjs +230 -0
- package/fesm2022/ngwr-circular-text-testing.mjs.map +1 -0
- package/fesm2022/ngwr-circular-text.mjs +4 -4
- package/fesm2022/ngwr-circular-text.mjs.map +1 -1
- package/fesm2022/ngwr-click-spark.mjs +27 -7
- package/fesm2022/ngwr-click-spark.mjs.map +1 -1
- package/fesm2022/ngwr-clipboard.mjs +3 -3
- package/fesm2022/ngwr-collapse.mjs +9 -9
- package/fesm2022/ngwr-color-picker-testing.mjs +452 -0
- package/fesm2022/ngwr-color-picker-testing.mjs.map +1 -0
- package/fesm2022/ngwr-color-picker.mjs +126 -10
- package/fesm2022/ngwr-color-picker.mjs.map +1 -1
- package/fesm2022/ngwr-command-palette.mjs +14 -5
- package/fesm2022/ngwr-command-palette.mjs.map +1 -1
- package/fesm2022/ngwr-compare.mjs +3 -3
- package/fesm2022/ngwr-confetti.mjs +31 -6
- package/fesm2022/ngwr-confetti.mjs.map +1 -1
- package/fesm2022/ngwr-config.mjs +9 -0
- package/fesm2022/ngwr-config.mjs.map +1 -1
- package/fesm2022/ngwr-context-menu-testing.mjs +30 -11
- package/fesm2022/ngwr-context-menu-testing.mjs.map +1 -1
- package/fesm2022/ngwr-context-menu.mjs +358 -48
- package/fesm2022/ngwr-context-menu.mjs.map +1 -1
- package/fesm2022/ngwr-cookie.mjs +3 -3
- package/fesm2022/ngwr-counter.mjs +25 -9
- package/fesm2022/ngwr-counter.mjs.map +1 -1
- package/fesm2022/{ngwr-date-adapter-fns.mjs → ngwr-date-adapters-fns.mjs} +37 -10
- package/fesm2022/ngwr-date-adapters-fns.mjs.map +1 -0
- package/fesm2022/{ngwr-date-adapter-luxon.mjs → ngwr-date-adapters-luxon.mjs} +5 -5
- package/fesm2022/ngwr-date-adapters-luxon.mjs.map +1 -0
- package/fesm2022/ngwr-date-picker-testing.mjs +21 -85
- package/fesm2022/ngwr-date-picker-testing.mjs.map +1 -1
- package/fesm2022/ngwr-date-picker.mjs +119 -37
- package/fesm2022/ngwr-date-picker.mjs.map +1 -1
- package/fesm2022/{ngwr-date-adapter.mjs → ngwr-date.mjs} +36 -10
- package/fesm2022/ngwr-date.mjs.map +1 -0
- package/fesm2022/ngwr-decrypt-text-testing.mjs +261 -0
- package/fesm2022/ngwr-decrypt-text-testing.mjs.map +1 -0
- package/fesm2022/ngwr-decrypt-text.mjs +9 -4
- package/fesm2022/ngwr-decrypt-text.mjs.map +1 -1
- package/fesm2022/ngwr-density.mjs +6 -6
- package/fesm2022/ngwr-descriptions.mjs +6 -6
- package/fesm2022/ngwr-dialog.mjs +73 -18
- package/fesm2022/ngwr-dialog.mjs.map +1 -1
- package/fesm2022/ngwr-directives.mjs +12 -12
- package/fesm2022/ngwr-divider.mjs +52 -5
- package/fesm2022/ngwr-divider.mjs.map +1 -1
- package/fesm2022/ngwr-donut-chart-testing.mjs +97 -0
- package/fesm2022/ngwr-donut-chart-testing.mjs.map +1 -0
- package/fesm2022/ngwr-donut-chart.mjs +7 -7
- package/fesm2022/ngwr-donut-chart.mjs.map +1 -1
- package/fesm2022/ngwr-drag-drop.mjs +160 -11
- package/fesm2022/ngwr-drag-drop.mjs.map +1 -1
- package/fesm2022/ngwr-drawer.mjs +156 -64
- package/fesm2022/ngwr-drawer.mjs.map +1 -1
- package/fesm2022/ngwr-dropdown.mjs +58 -12
- package/fesm2022/ngwr-dropdown.mjs.map +1 -1
- package/fesm2022/ngwr-empty.mjs +3 -3
- package/fesm2022/ngwr-event-calendar-testing.mjs +446 -0
- package/fesm2022/ngwr-event-calendar-testing.mjs.map +1 -0
- package/fesm2022/ngwr-event-calendar.mjs +66 -28
- package/fesm2022/ngwr-event-calendar.mjs.map +1 -1
- package/fesm2022/ngwr-falling-text-testing.mjs +220 -0
- package/fesm2022/ngwr-falling-text-testing.mjs.map +1 -0
- package/fesm2022/ngwr-falling-text.mjs +75 -46
- package/fesm2022/ngwr-falling-text.mjs.map +1 -1
- package/fesm2022/ngwr-file-upload.mjs +3 -3
- package/fesm2022/ngwr-form.mjs +32 -15
- package/fesm2022/ngwr-form.mjs.map +1 -1
- package/fesm2022/ngwr-fuzzy-text-testing.mjs +134 -0
- package/fesm2022/ngwr-fuzzy-text-testing.mjs.map +1 -0
- package/fesm2022/ngwr-fuzzy-text.mjs +21 -11
- package/fesm2022/ngwr-fuzzy-text.mjs.map +1 -1
- package/fesm2022/ngwr-gauge-testing.mjs +86 -0
- package/fesm2022/ngwr-gauge-testing.mjs.map +1 -0
- package/fesm2022/ngwr-gauge.mjs +3 -3
- package/fesm2022/ngwr-glitch-text-testing.mjs +215 -0
- package/fesm2022/ngwr-glitch-text-testing.mjs.map +1 -0
- package/fesm2022/ngwr-glitch-text.mjs +7 -7
- package/fesm2022/ngwr-glitch-text.mjs.map +1 -1
- package/fesm2022/ngwr-gradient-text-testing.mjs +258 -0
- package/fesm2022/ngwr-gradient-text-testing.mjs.map +1 -0
- package/fesm2022/ngwr-gradient-text.mjs +4 -4
- package/fesm2022/ngwr-gradient-text.mjs.map +1 -1
- package/fesm2022/ngwr-hotkey.mjs +24 -9
- package/fesm2022/ngwr-hotkey.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-en.mjs +87 -1
- package/fesm2022/ngwr-i18n-en.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-ru.mjs +69 -1
- package/fesm2022/ngwr-i18n-ru.mjs.map +1 -1
- package/fesm2022/ngwr-i18n.mjs +26 -15
- package/fesm2022/ngwr-i18n.mjs.map +1 -1
- package/fesm2022/ngwr-icon.mjs +6 -6
- package/fesm2022/ngwr-image-cropper-testing.mjs +200 -0
- package/fesm2022/ngwr-image-cropper-testing.mjs.map +1 -0
- package/fesm2022/ngwr-image-cropper.mjs +156 -11
- package/fesm2022/ngwr-image-cropper.mjs.map +1 -1
- package/fesm2022/ngwr-input-number-testing.mjs +15 -10
- package/fesm2022/ngwr-input-number-testing.mjs.map +1 -1
- package/fesm2022/ngwr-input-number.mjs +89 -15
- package/fesm2022/ngwr-input-number.mjs.map +1 -1
- package/fesm2022/ngwr-input-otp-testing.mjs +12 -6
- package/fesm2022/ngwr-input-otp-testing.mjs.map +1 -1
- package/fesm2022/ngwr-input-otp.mjs +24 -5
- package/fesm2022/ngwr-input-otp.mjs.map +1 -1
- package/fesm2022/ngwr-input.mjs +15 -15
- package/fesm2022/ngwr-keyboard.mjs +3 -3
- package/fesm2022/ngwr-knob-testing.mjs +220 -0
- package/fesm2022/ngwr-knob-testing.mjs.map +1 -0
- package/fesm2022/ngwr-knob.mjs +3 -3
- package/fesm2022/ngwr-layout.mjs +15 -15
- package/fesm2022/ngwr-lightbox-testing.mjs +223 -0
- package/fesm2022/ngwr-lightbox-testing.mjs.map +1 -0
- package/fesm2022/ngwr-lightbox.mjs +11 -4
- package/fesm2022/ngwr-lightbox.mjs.map +1 -1
- package/fesm2022/ngwr-line-chart-testing.mjs +119 -0
- package/fesm2022/ngwr-line-chart-testing.mjs.map +1 -0
- package/fesm2022/ngwr-line-chart.mjs +73 -26
- package/fesm2022/ngwr-line-chart.mjs.map +1 -1
- package/fesm2022/ngwr-list.mjs +7 -7
- package/fesm2022/ngwr-list.mjs.map +1 -1
- package/fesm2022/ngwr-loading-bar.mjs +7 -7
- package/fesm2022/ngwr-loading-bar.mjs.map +1 -1
- package/fesm2022/ngwr-markdown.mjs +66 -8
- package/fesm2022/ngwr-markdown.mjs.map +1 -1
- package/fesm2022/ngwr-marquee-testing.mjs +336 -0
- package/fesm2022/ngwr-marquee-testing.mjs.map +1 -0
- package/fesm2022/ngwr-marquee.mjs +4 -4
- package/fesm2022/ngwr-marquee.mjs.map +1 -1
- package/fesm2022/ngwr-media.mjs +3 -3
- package/fesm2022/ngwr-mention.mjs +108 -13
- package/fesm2022/ngwr-mention.mjs.map +1 -1
- package/fesm2022/ngwr-meta.mjs +6 -6
- package/fesm2022/ngwr-meter-group-testing.mjs +100 -0
- package/fesm2022/ngwr-meter-group-testing.mjs.map +1 -0
- package/fesm2022/ngwr-meter-group.mjs +3 -3
- package/fesm2022/ngwr-overlay.mjs +34 -7
- package/fesm2022/ngwr-overlay.mjs.map +1 -1
- package/fesm2022/ngwr-page-header.mjs +3 -3
- package/fesm2022/ngwr-pagination-testing.mjs +6 -6
- package/fesm2022/ngwr-pagination-testing.mjs.map +1 -1
- package/fesm2022/ngwr-pagination.mjs +17 -13
- package/fesm2022/ngwr-pagination.mjs.map +1 -1
- package/fesm2022/ngwr-pipes.mjs +39 -26
- package/fesm2022/ngwr-pipes.mjs.map +1 -1
- package/fesm2022/ngwr-platform.mjs +9 -9
- package/fesm2022/ngwr-popconfirm.mjs +6 -6
- package/fesm2022/ngwr-popover-testing.mjs +7 -2
- package/fesm2022/ngwr-popover-testing.mjs.map +1 -1
- package/fesm2022/ngwr-popover.mjs +169 -33
- package/fesm2022/ngwr-popover.mjs.map +1 -1
- package/fesm2022/ngwr-progress.mjs +3 -3
- package/fesm2022/ngwr-pull-to-refresh.mjs +3 -3
- package/fesm2022/ngwr-qr.mjs +42 -5
- package/fesm2022/ngwr-qr.mjs.map +1 -1
- package/fesm2022/ngwr-radio.mjs +6 -6
- package/fesm2022/ngwr-rating.mjs +3 -3
- package/fesm2022/ngwr-result.mjs +21 -30
- package/fesm2022/ngwr-result.mjs.map +1 -1
- package/fesm2022/ngwr-rotating-text-testing.mjs +220 -0
- package/fesm2022/ngwr-rotating-text-testing.mjs.map +1 -0
- package/fesm2022/ngwr-rotating-text.mjs +4 -4
- package/fesm2022/ngwr-rotating-text.mjs.map +1 -1
- package/fesm2022/ngwr-scroll.mjs +3 -3
- package/fesm2022/ngwr-segmented-testing.mjs +14 -1
- package/fesm2022/ngwr-segmented-testing.mjs.map +1 -1
- package/fesm2022/ngwr-segmented.mjs +29 -6
- package/fesm2022/ngwr-segmented.mjs.map +1 -1
- package/fesm2022/ngwr-select.mjs +227 -43
- package/fesm2022/ngwr-select.mjs.map +1 -1
- package/fesm2022/ngwr-shiny-text-testing.mjs +237 -0
- package/fesm2022/ngwr-shiny-text-testing.mjs.map +1 -0
- package/fesm2022/ngwr-shiny-text.mjs +11 -9
- package/fesm2022/ngwr-shiny-text.mjs.map +1 -1
- package/fesm2022/ngwr-sidebar.mjs +31 -16
- package/fesm2022/ngwr-sidebar.mjs.map +1 -1
- package/fesm2022/ngwr-skeleton.mjs +3 -3
- package/fesm2022/ngwr-slider.mjs +143 -14
- package/fesm2022/ngwr-slider.mjs.map +1 -1
- package/fesm2022/ngwr-sparkline-testing.mjs +76 -0
- package/fesm2022/ngwr-sparkline-testing.mjs.map +1 -0
- package/fesm2022/ngwr-sparkline.mjs +3 -3
- package/fesm2022/ngwr-speed-dial-testing.mjs +281 -0
- package/fesm2022/ngwr-speed-dial-testing.mjs.map +1 -0
- package/fesm2022/ngwr-speed-dial.mjs +27 -12
- package/fesm2022/ngwr-speed-dial.mjs.map +1 -1
- package/fesm2022/ngwr-spinner.mjs +3 -3
- package/fesm2022/ngwr-splash-cursor-testing.mjs +89 -0
- package/fesm2022/ngwr-splash-cursor-testing.mjs.map +1 -0
- package/fesm2022/ngwr-splash-cursor.mjs +3 -3
- package/fesm2022/ngwr-split-text-testing.mjs +224 -0
- package/fesm2022/ngwr-split-text-testing.mjs.map +1 -0
- package/fesm2022/ngwr-split-text.mjs +31 -5
- package/fesm2022/ngwr-split-text.mjs.map +1 -1
- package/fesm2022/ngwr-splitter-testing.mjs +245 -0
- package/fesm2022/ngwr-splitter-testing.mjs.map +1 -0
- package/fesm2022/ngwr-splitter.mjs +3 -3
- package/fesm2022/ngwr-spotlight-card-testing.mjs +368 -0
- package/fesm2022/ngwr-spotlight-card-testing.mjs.map +1 -0
- package/fesm2022/ngwr-spotlight-card.mjs +7 -7
- package/fesm2022/ngwr-spotlight-card.mjs.map +1 -1
- package/fesm2022/ngwr-squircle.mjs +6 -6
- package/fesm2022/ngwr-star-border-testing.mjs +172 -0
- package/fesm2022/ngwr-star-border-testing.mjs.map +1 -0
- package/fesm2022/ngwr-star-border.mjs +4 -4
- package/fesm2022/ngwr-star-border.mjs.map +1 -1
- package/fesm2022/ngwr-statistic.mjs +9 -9
- package/fesm2022/ngwr-stepper-testing.mjs +8 -8
- package/fesm2022/ngwr-stepper-testing.mjs.map +1 -1
- package/fesm2022/ngwr-stepper.mjs +33 -8
- package/fesm2022/ngwr-stepper.mjs.map +1 -1
- package/fesm2022/ngwr-storage.mjs +17 -5
- package/fesm2022/ngwr-storage.mjs.map +1 -1
- package/fesm2022/ngwr-switch.mjs +3 -3
- package/fesm2022/ngwr-table.mjs +110 -40
- package/fesm2022/ngwr-table.mjs.map +1 -1
- package/fesm2022/ngwr-tabs-testing.mjs +11 -10
- package/fesm2022/ngwr-tabs-testing.mjs.map +1 -1
- package/fesm2022/ngwr-tabs.mjs +51 -11
- package/fesm2022/ngwr-tabs.mjs.map +1 -1
- package/fesm2022/ngwr-textarea.mjs +3 -3
- package/fesm2022/ngwr-theme.mjs +181 -4
- package/fesm2022/ngwr-theme.mjs.map +1 -1
- package/fesm2022/ngwr-tilt-card-testing.mjs +190 -0
- package/fesm2022/ngwr-tilt-card-testing.mjs.map +1 -0
- package/fesm2022/ngwr-tilt-card.mjs +26 -8
- package/fesm2022/ngwr-tilt-card.mjs.map +1 -1
- package/fesm2022/ngwr-timeline.mjs +6 -6
- package/fesm2022/ngwr-toast.mjs +44 -15
- package/fesm2022/ngwr-toast.mjs.map +1 -1
- package/fesm2022/ngwr-toolbar.mjs +3 -3
- package/fesm2022/ngwr-tour-testing.mjs +173 -0
- package/fesm2022/ngwr-tour-testing.mjs.map +1 -0
- package/fesm2022/ngwr-tour.mjs +34 -10
- package/fesm2022/ngwr-tour.mjs.map +1 -1
- package/fesm2022/ngwr-transfer.mjs +3 -3
- package/fesm2022/ngwr-tree.mjs +36 -11
- package/fesm2022/ngwr-tree.mjs.map +1 -1
- package/fesm2022/ngwr-typewriter-testing.mjs +242 -0
- package/fesm2022/ngwr-typewriter-testing.mjs.map +1 -0
- package/fesm2022/ngwr-typewriter.mjs +13 -5
- package/fesm2022/ngwr-typewriter.mjs.map +1 -1
- package/fesm2022/ngwr-typography.mjs +3 -3
- package/fesm2022/ngwr-utils.mjs +5 -2
- 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 +4 -4
- package/fesm2022/ngwr-virtual-scroll.mjs.map +1 -1
- package/fesm2022/ngwr-waves-testing.mjs +128 -0
- package/fesm2022/ngwr-waves-testing.mjs.map +1 -0
- package/fesm2022/ngwr-waves.mjs +4 -4
- package/fesm2022/ngwr-waves.mjs.map +1 -1
- package/fesm2022/ngwr-window-testing.mjs +361 -0
- package/fesm2022/ngwr-window-testing.mjs.map +1 -0
- package/fesm2022/ngwr-window.mjs +175 -31
- package/fesm2022/ngwr-window.mjs.map +1 -1
- package/file-upload/styles/_index.scss +2 -2
- package/glitch-text/styles/_index.scss +27 -12
- package/i18n/en.json +71 -7
- package/i18n/ru.json +71 -7
- package/image-cropper/styles/_index.scss +19 -0
- package/input/styles/_index.scss +2 -2
- package/input-number/styles/_index.scss +2 -2
- package/input-otp/styles/_index.scss +9 -2
- package/knob/styles/_index.scss +1 -1
- package/lightbox/styles/_index.scss +16 -2
- package/line-chart/styles/_index.scss +28 -14
- package/list/styles/_index.scss +1 -1
- package/llms-full.txt +161 -19
- package/llms.txt +45 -10
- package/markdown/styles/_index.scss +3 -3
- package/mcp/api.js +6 -4
- package/mcp/catalog.js +40 -3
- package/mcp/providers.js +42 -0
- package/mcp/tools.js +22 -30
- package/meter-group/styles/_index.scss +1 -1
- package/overlay/styles/_index.scss +33 -1
- package/package.json +161 -12
- package/pagination/styles/_index.scss +23 -1
- package/popover/styles/_index.scss +16 -7
- package/progress/styles/_index.scss +1 -1
- package/radio/styles/_index.scss +2 -2
- package/rating/styles/_index.scss +1 -1
- package/schematics/collection.json +1 -1
- package/schematics/migrations/v12/index.js +65 -0
- package/schematics/migrations/v7/index.js +12 -1
- package/schematics/migrations/v8/index.js +10 -1
- package/schematics/migrations.json +5 -0
- package/schematics/ng-add/index.js +8 -3
- package/schematics/provider/index.js +80 -13
- package/schematics/use/index.js +9 -129
- package/schematics/use/rule.js +206 -0
- package/schematics/use/symbol-map.json +4 -4
- package/segmented/styles/_index.scss +14 -3
- package/select/styles/_index.scss +14 -2
- package/sidebar/styles/_index.scss +12 -10
- package/skills/ngwr/SKILL.md +117 -0
- package/skills/ngwr/references/catalog.md +212 -0
- package/skills/ngwr/references/setup.md +78 -0
- package/slider/styles/_index.scss +1 -1
- package/speed-dial/styles/_index.scss +1 -1
- package/stepper/styles/_index.scss +12 -3
- package/switch/styles/_index.scss +2 -2
- package/table/styles/_index.scss +61 -12
- package/tabs/styles/_index.scss +1 -1
- package/textarea/styles/_index.scss +1 -1
- package/theme/styles/_colors.scss +142 -56
- package/theme/styles/_dark.scss +46 -3
- package/theme/styles/_focus.scss +28 -5
- package/theme/styles/_mixins.scss +1 -1
- package/theme/styles/_variables.scss +67 -0
- package/transfer/styles/_index.scss +26 -3
- package/tree/styles/_index.scss +29 -6
- package/types/ngwr-action-sheet-testing.d.ts +260 -0
- package/types/ngwr-bar-chart-testing.d.ts +85 -0
- package/types/ngwr-blur-text-testing.d.ts +180 -0
- package/types/ngwr-blur-text.d.ts +20 -4
- package/types/ngwr-border-glow-testing.d.ts +219 -0
- package/types/ngwr-breadcrumbs.d.ts +17 -10
- package/types/ngwr-calendar-heatmap-testing.d.ts +79 -0
- package/types/ngwr-calendar-testing.d.ts +277 -0
- package/types/ngwr-calendar.d.ts +76 -0
- package/types/ngwr-carousel.d.ts +85 -6
- package/types/ngwr-cascader.d.ts +17 -0
- package/types/ngwr-checkbox.d.ts +13 -0
- package/types/ngwr-circular-text-testing.d.ts +196 -0
- package/types/ngwr-click-spark.d.ts +4 -0
- package/types/ngwr-color-picker-testing.d.ts +299 -0
- package/types/ngwr-color-picker.d.ts +34 -2
- package/types/ngwr-confetti.d.ts +8 -0
- package/types/ngwr-config.d.ts +10 -1
- package/types/ngwr-context-menu-testing.d.ts +24 -11
- package/types/ngwr-context-menu.d.ts +71 -1
- package/types/ngwr-counter.d.ts +1 -0
- package/types/{ngwr-date-adapter-fns.d.ts → ngwr-date-adapters-fns.d.ts} +33 -6
- package/types/{ngwr-date-adapter-luxon.d.ts → ngwr-date-adapters-luxon.d.ts} +1 -1
- package/types/ngwr-date-picker-testing.d.ts +17 -72
- package/types/ngwr-date-picker.d.ts +8 -4
- package/types/{ngwr-date-adapter.d.ts → ngwr-date.d.ts} +24 -5
- package/types/ngwr-decrypt-text-testing.d.ts +222 -0
- package/types/ngwr-dialog.d.ts +38 -1
- package/types/ngwr-divider.d.ts +25 -0
- package/types/ngwr-donut-chart-testing.d.ts +83 -0
- package/types/ngwr-donut-chart.d.ts +3 -3
- package/types/ngwr-drag-drop.d.ts +56 -2
- package/types/ngwr-drawer.d.ts +68 -5
- package/types/ngwr-dropdown.d.ts +9 -0
- package/types/ngwr-event-calendar-testing.d.ts +301 -0
- package/types/ngwr-event-calendar.d.ts +17 -8
- package/types/ngwr-falling-text-testing.d.ts +188 -0
- package/types/ngwr-falling-text.d.ts +1 -1
- package/types/ngwr-form.d.ts +12 -2
- package/types/ngwr-fuzzy-text-testing.d.ts +130 -0
- package/types/ngwr-gauge-testing.d.ts +71 -0
- package/types/ngwr-glitch-text-testing.d.ts +201 -0
- package/types/ngwr-gradient-text-testing.d.ts +186 -0
- package/types/ngwr-i18n.d.ts +13 -4
- package/types/ngwr-image-cropper-testing.d.ts +173 -0
- package/types/ngwr-image-cropper.d.ts +71 -5
- package/types/ngwr-input-number-testing.d.ts +15 -10
- package/types/ngwr-input-number.d.ts +44 -5
- package/types/ngwr-input-otp-testing.d.ts +12 -6
- package/types/ngwr-input-otp.d.ts +15 -1
- package/types/ngwr-knob-testing.d.ts +150 -0
- package/types/ngwr-lightbox-testing.d.ts +154 -0
- package/types/ngwr-lightbox.d.ts +6 -0
- package/types/ngwr-line-chart-testing.d.ts +93 -0
- package/types/ngwr-line-chart.d.ts +20 -3
- package/types/ngwr-markdown.d.ts +11 -0
- package/types/ngwr-marquee-testing.d.ts +280 -0
- package/types/ngwr-mention.d.ts +32 -0
- package/types/ngwr-meter-group-testing.d.ts +77 -0
- package/types/ngwr-overlay.d.ts +20 -1
- package/types/ngwr-pagination-testing.d.ts +4 -4
- package/types/ngwr-pipes.d.ts +1 -1
- package/types/ngwr-popover-testing.d.ts +7 -2
- package/types/ngwr-popover.d.ts +1 -0
- package/types/ngwr-result.d.ts +6 -0
- package/types/ngwr-rotating-text-testing.d.ts +191 -0
- package/types/ngwr-segmented-testing.d.ts +9 -0
- package/types/ngwr-segmented.d.ts +21 -1
- package/types/ngwr-select.d.ts +100 -6
- package/types/ngwr-shiny-text-testing.d.ts +165 -0
- package/types/ngwr-shiny-text.d.ts +4 -2
- package/types/ngwr-sidebar.d.ts +14 -5
- package/types/ngwr-slider.d.ts +84 -1
- package/types/ngwr-sparkline-testing.d.ts +69 -0
- package/types/ngwr-speed-dial-testing.d.ts +199 -0
- package/types/ngwr-speed-dial.d.ts +22 -3
- package/types/ngwr-splash-cursor-testing.d.ts +95 -0
- package/types/ngwr-split-text-testing.d.ts +209 -0
- package/types/ngwr-split-text.d.ts +21 -0
- package/types/ngwr-splitter-testing.d.ts +174 -0
- package/types/ngwr-spotlight-card-testing.d.ts +303 -0
- package/types/ngwr-star-border-testing.d.ts +135 -0
- package/types/ngwr-stepper-testing.d.ts +5 -5
- package/types/ngwr-stepper.d.ts +8 -0
- package/types/ngwr-storage.d.ts +1 -0
- package/types/ngwr-table.d.ts +114 -12
- package/types/ngwr-tabs-testing.d.ts +11 -10
- package/types/ngwr-tabs.d.ts +2 -0
- package/types/ngwr-theme.d.ts +82 -1
- package/types/ngwr-tilt-card-testing.d.ts +158 -0
- package/types/ngwr-tilt-card.d.ts +2 -0
- package/types/ngwr-toast.d.ts +14 -5
- package/types/ngwr-tour-testing.d.ts +143 -0
- package/types/ngwr-tour.d.ts +22 -4
- package/types/ngwr-tree.d.ts +12 -4
- package/types/ngwr-typewriter-testing.d.ts +211 -0
- package/types/ngwr-utils.d.ts +5 -2
- package/types/ngwr-version.d.ts +1 -1
- package/types/ngwr-waves-testing.d.ts +121 -0
- package/types/ngwr-window-testing.d.ts +263 -0
- package/types/ngwr-window.d.ts +66 -21
- package/typography/styles/_index.scss +1 -1
- package/window/styles/_index.scss +116 -42
- package/fesm2022/ngwr-date-adapter-fns.mjs.map +0 -1
- package/fesm2022/ngwr-date-adapter-luxon.mjs.map +0 -1
- package/fesm2022/ngwr-date-adapter.mjs.map +0 -1
|
@@ -0,0 +1,368 @@
|
|
|
1
|
+
import { ComponentHarness, HarnessPredicate } from '@angular/cdk/testing';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @license
|
|
5
|
+
*
|
|
6
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
7
|
+
* found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Split an inline `style` attribute into its declarations.
|
|
11
|
+
*
|
|
12
|
+
* Read from the attribute rather than through `getCssValue()`, and the difference is not
|
|
13
|
+
* cosmetic. `getCssValue()` is `getComputedStyle()`, which in a browser resolves the
|
|
14
|
+
* stylesheet's own `--wr-spotlight-x: 50%` / `--wr-spotlight-color: rgba(…)` defaults —
|
|
15
|
+
* so "the component has written nothing here yet, and the theme decides" would come back
|
|
16
|
+
* as a concrete value and the assertion would invert. jsdom loads no stylesheet, so the
|
|
17
|
+
* computed read happens to agree today and would start lying the moment these harnesses
|
|
18
|
+
* ran anywhere else. The attribute holds what the component or the directive itself
|
|
19
|
+
* wrote, and nothing else.
|
|
20
|
+
*
|
|
21
|
+
* Shared by both harnesses in this entry point because both read the same three
|
|
22
|
+
* variables off their host — in different units. See each class for which.
|
|
23
|
+
*/
|
|
24
|
+
function wrSpotlightInlineVars(style) {
|
|
25
|
+
const declarations = new Map();
|
|
26
|
+
for (const declaration of style.split(';')) {
|
|
27
|
+
const colon = declaration.indexOf(':');
|
|
28
|
+
if (colon === -1)
|
|
29
|
+
continue;
|
|
30
|
+
const name = declaration.slice(0, colon).trim();
|
|
31
|
+
if (name !== '')
|
|
32
|
+
declarations.set(name, declaration.slice(colon + 1).trim());
|
|
33
|
+
}
|
|
34
|
+
return declarations;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* @license
|
|
39
|
+
*
|
|
40
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
41
|
+
* found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE
|
|
42
|
+
*/
|
|
43
|
+
/** `120px` — the card writes its pointer coordinates as a pixel length, always. */
|
|
44
|
+
const PIXEL_LENGTH = /^(-?[\d.]+)px$/;
|
|
45
|
+
/** `80%` — the radius, whose `%` suffix is the half that makes the gradient legal. */
|
|
46
|
+
const PERCENTAGE = /^(-?[\d.]+)%$/;
|
|
47
|
+
/**
|
|
48
|
+
* Test harness for `<wr-spotlight-card>` — a card with a soft radial highlight that
|
|
49
|
+
* follows the cursor.
|
|
50
|
+
*
|
|
51
|
+
* **The component's entire output is three custom properties on its own host, and this
|
|
52
|
+
* harness reads them off the inline declaration.** There is no DOM for the highlight at
|
|
53
|
+
* all: it is a `::before` pseudo-element, painted by the stylesheet from those three
|
|
54
|
+
* values. So the paint is out of reach here and always will be — what is in reach is the
|
|
55
|
+
* arithmetic and the exact spelling that feeds it, which is where this component breaks.
|
|
56
|
+
*
|
|
57
|
+
* **This harness reads PIXELS. {@link WrSpotlightHarness}, the `[wrSpotlight]` directive
|
|
58
|
+
* shipped from the same entry point, reads PERCENTAGES.** Both write
|
|
59
|
+
* `--wr-spotlight-x` / `--wr-spotlight-y`, in different units, off different events —
|
|
60
|
+
* the card listens for `mousemove`, the directive for `pointermove`. That is deliberate
|
|
61
|
+
* and documented, and it is also the mistake waiting to happen: putting `wrSpotlight` on
|
|
62
|
+
* a `<wr-spotlight-card>` gives you two handlers overwriting one variable in units that
|
|
63
|
+
* do not agree. Reach for the harness that matches the thing under test.
|
|
64
|
+
*
|
|
65
|
+
* **{@link movePointerTo} needs the card to have a box, and in a unit test it has none.**
|
|
66
|
+
* The component subtracts its own `getBoundingClientRect()` from the client coordinate,
|
|
67
|
+
* and jsdom answers that with a 0×0 rect at the origin — so the subtraction is a no-op
|
|
68
|
+
* and the coordinate comes back unchanged. No throw here, unlike the directive's version:
|
|
69
|
+
* the answer is degenerate rather than wrong, and it is legitimately what a real card
|
|
70
|
+
* with no box would report. But a spec that asserts `x === clientX` against an unstubbed
|
|
71
|
+
* rect has proved nothing about the box-relative conversion, which is the only thing
|
|
72
|
+
* {@link getSpotlightPosition} is for. Give the host a box first:
|
|
73
|
+
*
|
|
74
|
+
* ```ts
|
|
75
|
+
* const card = fixture.nativeElement.querySelector('wr-spotlight-card');
|
|
76
|
+
* card.getBoundingClientRect = () => ({ left: 40, top: 20, width: 200, height: 100 }) as DOMRect;
|
|
77
|
+
* ```
|
|
78
|
+
*
|
|
79
|
+
* Several plausible methods are deliberately absent. There is no `isSpotlightVisible()`
|
|
80
|
+
* or `getSpotlightOpacity()`: the highlight sits at `opacity: 0` and is lifted to `0.6`
|
|
81
|
+
* only under `:hover` / `:focus-within`, both of which are stylesheet selectors on a
|
|
82
|
+
* pseudo-element — jsdom loads no stylesheet, matches no `:hover`, and cannot read a
|
|
83
|
+
* pseudo-element's style at any time, so any answer would be invented. No `getGradient()`
|
|
84
|
+
* for the same reason. No `hover()` / `mouseAway()` wrappers, which would be worse than
|
|
85
|
+
* missing: the CDK's versions dispatch `mouseenter` / `mouseover` / `mouseleave`, none of
|
|
86
|
+
* which this component listens to and none of which changes a `:hover` match in a test —
|
|
87
|
+
* a spec calling them would look like it exercised the reveal and would have exercised
|
|
88
|
+
* nothing. No `getSpotlightRect()` or `getCardSize()`, which are layout. And no
|
|
89
|
+
* `respectsReducedMotion()`: this is the one animation component in the library that
|
|
90
|
+
* deliberately does not implement the preference — a gradient tracks the cursor and no
|
|
91
|
+
* content moves — so the method would answer identically for a component that honoured it
|
|
92
|
+
* and one that ignored it.
|
|
93
|
+
*
|
|
94
|
+
* @example
|
|
95
|
+
* ```ts
|
|
96
|
+
* const card = await loader.getHarness(WrSpotlightCardHarness.with({ text: 'Hover me' }));
|
|
97
|
+
*
|
|
98
|
+
* expect(await card.getRadiusPercent()).toBe(80);
|
|
99
|
+
* expect(await card.getSpotlightColor()).toBeNull(); // the theme decides
|
|
100
|
+
* expect(await card.getSpotlightPosition()).toBeNull(); // nothing has pointed at it
|
|
101
|
+
* ```
|
|
102
|
+
*
|
|
103
|
+
* @see https://ngwr.dev/guides/testing
|
|
104
|
+
*/
|
|
105
|
+
class WrSpotlightCardHarness extends ComponentHarness {
|
|
106
|
+
static hostSelector = 'wr-spotlight-card';
|
|
107
|
+
/** Build a predicate that narrows the query — pass to `getHarness` / `getAllHarnesses`. */
|
|
108
|
+
static with(options = {}) {
|
|
109
|
+
return new HarnessPredicate(WrSpotlightCardHarness, options).addOption('text', options.text, (harness, text) => HarnessPredicate.stringMatches(harness.getContentText(), text));
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Where the gradient fades out, as a percentage of its own radius.
|
|
113
|
+
*
|
|
114
|
+
* Returns the number, but the assertion it really makes is about the `%` that was
|
|
115
|
+
* stripped to get it — this method refuses a bare `80`. The stylesheet interpolates the
|
|
116
|
+
* variable straight into `transparent var(--wr-spotlight-radius, 80%)`, where a unitless
|
|
117
|
+
* value is not a length, so the whole `radial-gradient()` declaration is dropped and the
|
|
118
|
+
* highlight disappears with nothing in the console to say why. Reading this as a plain
|
|
119
|
+
* number would sail past exactly that.
|
|
120
|
+
*
|
|
121
|
+
* Always present, whatever the input says: a `[radius]` that is not a number coerces
|
|
122
|
+
* back to the default 80 rather than writing nonsense into the sheet.
|
|
123
|
+
*/
|
|
124
|
+
async getRadiusPercent() {
|
|
125
|
+
const raw = (await this.vars()).get('--wr-spotlight-radius') ?? null;
|
|
126
|
+
const match = raw === null ? null : PERCENTAGE.exec(raw);
|
|
127
|
+
if (!match) {
|
|
128
|
+
throw new Error(`WrSpotlightCardHarness.getRadiusPercent(): \`--wr-spotlight-radius\` reads "${raw ?? '(absent)'}" on the ` +
|
|
129
|
+
'host, and the stylesheet needs a percentage there — it drops the whole gradient for a bare number. The ' +
|
|
130
|
+
'card writes this one on every render whatever the input says, so a missing or unsuffixed value means ' +
|
|
131
|
+
'the binding itself stopped reaching the element.');
|
|
132
|
+
}
|
|
133
|
+
return Number.parseFloat(match[1]);
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* The highlight colour the author asked for, or `null` when they left it to the theme.
|
|
137
|
+
*
|
|
138
|
+
* `null` IS the contract for an unset `[spotlightColor]`, not a gap in it. The
|
|
139
|
+
* stylesheet's own default is `rgba(var(--wr-color-on-surface-rgb), .15)`, and that
|
|
140
|
+
* token flips per theme — which is what makes one component read as a dark glow on a
|
|
141
|
+
* light surface and a light beam on a dark one. A card that started writing a concrete
|
|
142
|
+
* colour here would look right in whichever theme it was authored against and wrong in
|
|
143
|
+
* the other, and this is the only method that can tell.
|
|
144
|
+
*/
|
|
145
|
+
async getSpotlightColor() {
|
|
146
|
+
return (await this.vars()).get('--wr-spotlight-color') ?? null;
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Where the highlight last sat, in pixels from the card's own top-left corner. `null`
|
|
150
|
+
* until something has pointed at the card.
|
|
151
|
+
*
|
|
152
|
+
* Pixels, not percentages — see this class's docs for why the distinction matters
|
|
153
|
+
* inside this one entry point.
|
|
154
|
+
*
|
|
155
|
+
* `null` is a state of its own rather than a stand-in for `{ x: 0, y: 0 }`: before the
|
|
156
|
+
* first move the stylesheet's `50% / 50%` default applies, and a pointer at the card's
|
|
157
|
+
* own origin legitimately reports zero, so folding the two together would make an
|
|
158
|
+
* untouched card indistinguishable from one being pointed at in its corner.
|
|
159
|
+
*
|
|
160
|
+
* Note there is no reset when the cursor leaves, and that is not an oversight the
|
|
161
|
+
* harness papers over: the stylesheet fades the whole overlay to `opacity: 0` on leave,
|
|
162
|
+
* so nothing is parked visibly — but the coordinate stays written for the life of the
|
|
163
|
+
* element. `null` therefore means "no pointer has EVER arrived", not "none is here now".
|
|
164
|
+
*/
|
|
165
|
+
async getSpotlightPosition() {
|
|
166
|
+
const vars = await this.vars();
|
|
167
|
+
const x = vars.get('--wr-spotlight-x');
|
|
168
|
+
const y = vars.get('--wr-spotlight-y');
|
|
169
|
+
if (x === undefined || y === undefined)
|
|
170
|
+
return null;
|
|
171
|
+
return { x: this.parsePixels(x, '--wr-spotlight-x'), y: this.parsePixels(y, '--wr-spotlight-y') };
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Point at the card, in client coordinates.
|
|
175
|
+
*
|
|
176
|
+
* A `mousemove`, not a `pointermove` — the component listens for the former, and the
|
|
177
|
+
* directive in the same entry point for the latter, so a pointer event dispatched here
|
|
178
|
+
* is silently ignored. It goes to the host itself, so it needs no hit test and cannot
|
|
179
|
+
* miss in a test that has no layout; the coordinates only ever reach the component's
|
|
180
|
+
* own subtraction.
|
|
181
|
+
*
|
|
182
|
+
* Stub the host's `getBoundingClientRect` before calling this, or the subtraction is
|
|
183
|
+
* invisible — see this class's docs.
|
|
184
|
+
*/
|
|
185
|
+
async movePointerTo(clientX, clientY) {
|
|
186
|
+
await (await this.host()).dispatchEvent('mousemove', { clientX, clientY });
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* The projected content's text, trimmed.
|
|
190
|
+
*
|
|
191
|
+
* Read from the host, which is the whole assertion: the template is a bare
|
|
192
|
+
* `<ng-content />` with no wrapper element, so content lands as a direct child and an
|
|
193
|
+
* interactive one keeps its own name and role. The component adds no ARIA and no node
|
|
194
|
+
* of its own — there is nothing else here for a harness to ask about.
|
|
195
|
+
*/
|
|
196
|
+
async getContentText() {
|
|
197
|
+
return (await this.host()).text();
|
|
198
|
+
}
|
|
199
|
+
/** The host's inline declarations — the component's whole written output. */
|
|
200
|
+
async vars() {
|
|
201
|
+
return wrSpotlightInlineVars((await (await this.host()).getAttribute('style')) ?? '');
|
|
202
|
+
}
|
|
203
|
+
/** One written coordinate, as a number, insisting on the `px` the card promises. */
|
|
204
|
+
parsePixels(raw, name) {
|
|
205
|
+
const match = PIXEL_LENGTH.exec(raw);
|
|
206
|
+
if (!match) {
|
|
207
|
+
throw new Error(`WrSpotlightCardHarness.getSpotlightPosition(): \`${name}\` reads "${raw}", which is not the pixel length ` +
|
|
208
|
+
'the card writes. A percentage here is the tell that `[wrSpotlight]` is on the same element — the two ' +
|
|
209
|
+
'exports of this entry point share these variables and disagree about the unit.');
|
|
210
|
+
}
|
|
211
|
+
return Number.parseFloat(match[1]);
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* @license
|
|
217
|
+
*
|
|
218
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
219
|
+
* found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE
|
|
220
|
+
*/
|
|
221
|
+
/**
|
|
222
|
+
* Test harness for `[wrSpotlight]` — the directive that makes a cursor-following
|
|
223
|
+
* gradient possible on an element the consumer owns.
|
|
224
|
+
*
|
|
225
|
+
* **This harness reads PERCENTAGES. {@link WrSpotlightCardHarness}, shipped from the same
|
|
226
|
+
* entry point, reads PIXELS.** Both write `--wr-spotlight-x` / `--wr-spotlight-y`; the
|
|
227
|
+
* directive writes them as a share of its own box off `pointermove`, the card as a pixel
|
|
228
|
+
* offset off `mousemove`. That is why {@link getSpotlightPosition} hands back raw strings
|
|
229
|
+
* and not numbers — collapsing `'37.5%'` to `37.5` would hide the one thing that decides
|
|
230
|
+
* whether the gradient lands where the cursor is, and would make the two halves of this
|
|
231
|
+
* entry point look interchangeable when they are not.
|
|
232
|
+
*
|
|
233
|
+
* **The directive ships no styles and adds no node.** There is no class to assert, no
|
|
234
|
+
* wrapper, no ARIA: whatever the element announced before the directive applies is
|
|
235
|
+
* exactly what it announces after, and the gradient is entirely the consumer's own CSS.
|
|
236
|
+
* So there is no `isSpotlightVisible()` — there is nothing here to be visible — and no
|
|
237
|
+
* `getResetX()` / `getResetY()`, which would echo the inputs back rather than report the
|
|
238
|
+
* coordinate the directive actually WROTE. The echo would pass while the written value
|
|
239
|
+
* was wrong, which is not hypothetical (see {@link getSpotlightPosition}). And no
|
|
240
|
+
* `respectsReducedMotion()`: neither export in this entry point implements the
|
|
241
|
+
* preference — it is the library's one documented exemption, since a gradient tracks the
|
|
242
|
+
* cursor and no content moves — so the method would answer the same for a directive that
|
|
243
|
+
* honoured it and one that ignored it.
|
|
244
|
+
*
|
|
245
|
+
* @example
|
|
246
|
+
* ```ts
|
|
247
|
+
* const spotlight = await loader.getHarness(WrSpotlightHarness.with({ hostClass: 'card' }));
|
|
248
|
+
*
|
|
249
|
+
* expect(await spotlight.getSpotlightPosition()).toEqual({ x: '50%', y: '50%' });
|
|
250
|
+
* await spotlight.movePointerTo(150, 25); // stub the host's rect first
|
|
251
|
+
* ```
|
|
252
|
+
*
|
|
253
|
+
* @see https://ngwr.dev/guides/testing
|
|
254
|
+
*/
|
|
255
|
+
class WrSpotlightHarness extends ComponentHarness {
|
|
256
|
+
static hostSelector = '[wrSpotlight]';
|
|
257
|
+
/**
|
|
258
|
+
* Build a predicate that narrows the query — pass to `getHarness` / `getAllHarnesses`.
|
|
259
|
+
*
|
|
260
|
+
* Both options describe the HOST rather than the directive, because the directive
|
|
261
|
+
* leaves no mark of its own to match on.
|
|
262
|
+
*/
|
|
263
|
+
static with(options = {}) {
|
|
264
|
+
return new HarnessPredicate(WrSpotlightHarness, options)
|
|
265
|
+
.addOption('text', options.text, async (harness, text) => HarnessPredicate.stringMatches((await harness.host()).text(), text))
|
|
266
|
+
.addOption('hostClass', options.hostClass, async (harness, hostClass) => (await harness.host()).hasClass(hostClass));
|
|
267
|
+
}
|
|
268
|
+
/**
|
|
269
|
+
* The coordinates the directive has written, as the raw strings it wrote them.
|
|
270
|
+
*
|
|
271
|
+
* Strings on purpose — see this class's docs. The values are percentages of the host's
|
|
272
|
+
* own box while a pointer is over it, and whatever `[resetX]` / `[resetY]` say
|
|
273
|
+
* otherwise, so a `px` appearing here means something else is writing these variables.
|
|
274
|
+
*
|
|
275
|
+
* **Present from construction, before any pointer arrives.** The directive seeds the
|
|
276
|
+
* reset coordinates in its constructor, so the first read is `50%` / `50%` on a fresh
|
|
277
|
+
* host — do not mistake that for a pointer having been tracked. Worth knowing that the
|
|
278
|
+
* constructor runs before signal inputs are bound, so a bound (or even a static)
|
|
279
|
+
* `resetX` is NOT what appears here initially: it is honoured from the first
|
|
280
|
+
* {@link leave} onward, and the highlight jumps at that point. Reading the written
|
|
281
|
+
* coordinate rather than the input is what makes that visible at all.
|
|
282
|
+
*
|
|
283
|
+
* Throws once the directive has been destroyed, rather than answering with the last
|
|
284
|
+
* value it happened to leave behind — {@link hasTrackedPointer} is the question to ask
|
|
285
|
+
* when the host may be gone.
|
|
286
|
+
*/
|
|
287
|
+
async getSpotlightPosition() {
|
|
288
|
+
const vars = await this.vars();
|
|
289
|
+
const x = vars.get('--wr-spotlight-x');
|
|
290
|
+
const y = vars.get('--wr-spotlight-y');
|
|
291
|
+
if (x === undefined || y === undefined) {
|
|
292
|
+
throw new Error('WrSpotlightHarness.getSpotlightPosition(): the host carries no `--wr-spotlight-x` / `--wr-spotlight-y`. ' +
|
|
293
|
+
'The directive writes both in its constructor and removes both on destroy, so this is a torn-down ' +
|
|
294
|
+
'directive rather than one that has not started — ask hasTrackedPointer() when the host may be gone.');
|
|
295
|
+
}
|
|
296
|
+
return { x, y };
|
|
297
|
+
}
|
|
298
|
+
/**
|
|
299
|
+
* Point at the host, in client coordinates.
|
|
300
|
+
*
|
|
301
|
+
* **Refuses on a host with no box, which in a unit test is every host.** The directive
|
|
302
|
+
* divides the cursor offset by the element's own width and height, so a 0×0 rect writes
|
|
303
|
+
* literally `Infinity%` or — at the origin — `NaN%` into the style. jsdom accepts either
|
|
304
|
+
* string without complaint, so an unguarded harness would hand back something that looks
|
|
305
|
+
* like a coordinate and describes nothing. Give the host a box first:
|
|
306
|
+
*
|
|
307
|
+
* ```ts
|
|
308
|
+
* const el = fixture.nativeElement.querySelector('[wrSpotlight]');
|
|
309
|
+
* el.getBoundingClientRect = () => ({ left: 0, top: 0, width: 200, height: 100 }) as DOMRect;
|
|
310
|
+
* ```
|
|
311
|
+
*
|
|
312
|
+
* A `pointermove`, not a `mousemove` — the directive listens for the former, and the
|
|
313
|
+
* component in the same entry point for the latter. It is dispatched on the host itself,
|
|
314
|
+
* so it needs no hit test and cannot miss.
|
|
315
|
+
*/
|
|
316
|
+
async movePointerTo(clientX, clientY) {
|
|
317
|
+
const host = await this.host();
|
|
318
|
+
const { width, height } = await host.getDimensions();
|
|
319
|
+
if (!width || !height) {
|
|
320
|
+
throw new Error(`WrSpotlightHarness.movePointerTo(${clientX}, ${clientY}): this host measures ${width}×${height}, so a ` +
|
|
321
|
+
'pointer position over it means nothing — the directive divides the offset by the box, and the result ' +
|
|
322
|
+
'goes into the style as `Infinity%` or `NaN%`. Stub `getBoundingClientRect` on the host first.');
|
|
323
|
+
}
|
|
324
|
+
await host.dispatchEvent('pointermove', { clientX, clientY, pointerId: 1, isPrimary: true });
|
|
325
|
+
}
|
|
326
|
+
/**
|
|
327
|
+
* Take the pointer away.
|
|
328
|
+
*
|
|
329
|
+
* Dispatches `pointerleave` — the directive's reset path, and the only place `[resetX]`
|
|
330
|
+
* / `[resetY]` are read after construction. Needs no box: the handler writes the reset
|
|
331
|
+
* strings straight through without measuring anything, which is why this one does not
|
|
332
|
+
* refuse the way {@link movePointerTo} does.
|
|
333
|
+
*
|
|
334
|
+
* Not the CDK's `mouseAway()`, though that dispatches `pointerleave` too. This says what
|
|
335
|
+
* it does, and it does not also fire the `mouseleave` / `mouseout` that the CDK helper
|
|
336
|
+
* sends alongside it — events this directive ignores, and that would make a spec look
|
|
337
|
+
* like it had covered more than it did.
|
|
338
|
+
*/
|
|
339
|
+
async leave() {
|
|
340
|
+
await (await this.host()).dispatchEvent('pointerleave');
|
|
341
|
+
}
|
|
342
|
+
/**
|
|
343
|
+
* Whether the directive still owns the host's spotlight variables.
|
|
344
|
+
*
|
|
345
|
+
* **This is "the directive is alive", not "a pointer has moved over it".** It is `true`
|
|
346
|
+
* from the moment the directive constructs, because the constructor seeds the reset
|
|
347
|
+
* coordinates — there is no earlier state to catch. What it distinguishes is a live
|
|
348
|
+
* directive from a torn-down one: destroy removes both declarations from the element,
|
|
349
|
+
* and nothing else in the repo asserts that cleanup. A directive that stopped removing
|
|
350
|
+
* them would leave a stale gradient position on an element the consumer went on using,
|
|
351
|
+
* and the only trace would be these two declarations outliving it.
|
|
352
|
+
*/
|
|
353
|
+
async hasTrackedPointer() {
|
|
354
|
+
const vars = await this.vars();
|
|
355
|
+
return vars.has('--wr-spotlight-x') && vars.has('--wr-spotlight-y');
|
|
356
|
+
}
|
|
357
|
+
/** The host's inline declarations — the directive's whole written output. */
|
|
358
|
+
async vars() {
|
|
359
|
+
return wrSpotlightInlineVars((await (await this.host()).getAttribute('style')) ?? '');
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
/**
|
|
364
|
+
* Generated bundle index. Do not edit.
|
|
365
|
+
*/
|
|
366
|
+
|
|
367
|
+
export { WrSpotlightCardHarness, WrSpotlightHarness };
|
|
368
|
+
//# sourceMappingURL=ngwr-spotlight-card-testing.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ngwr-spotlight-card-testing.mjs","sources":["../../../projects/lib/spotlight-card/testing/wr-spotlight-harness-vars.ts","../../../projects/lib/spotlight-card/testing/wr-spotlight-card-harness.ts","../../../projects/lib/spotlight-card/testing/wr-spotlight-harness.ts","../../../projects/lib/spotlight-card/testing/ngwr-spotlight-card-testing.ts"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\n/**\n * Split an inline `style` attribute into its declarations.\n *\n * Read from the attribute rather than through `getCssValue()`, and the difference is not\n * cosmetic. `getCssValue()` is `getComputedStyle()`, which in a browser resolves the\n * stylesheet's own `--wr-spotlight-x: 50%` / `--wr-spotlight-color: rgba(…)` defaults —\n * so \"the component has written nothing here yet, and the theme decides\" would come back\n * as a concrete value and the assertion would invert. jsdom loads no stylesheet, so the\n * computed read happens to agree today and would start lying the moment these harnesses\n * ran anywhere else. The attribute holds what the component or the directive itself\n * wrote, and nothing else.\n *\n * Shared by both harnesses in this entry point because both read the same three\n * variables off their host — in different units. See each class for which.\n */\nexport function wrSpotlightInlineVars(style: string): Map<string, string> {\n const declarations = new Map<string, string>();\n for (const declaration of style.split(';')) {\n const colon = declaration.indexOf(':');\n if (colon === -1) continue;\n const name = declaration.slice(0, colon).trim();\n if (name !== '') declarations.set(name, declaration.slice(colon + 1).trim());\n }\n return declarations;\n}\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { ComponentHarness, HarnessPredicate } from '@angular/cdk/testing';\n\nimport type { WrSpotlightCardHarnessFilters } from './interfaces';\nimport { wrSpotlightInlineVars } from './wr-spotlight-harness-vars';\n\n/** `120px` — the card writes its pointer coordinates as a pixel length, always. */\nconst PIXEL_LENGTH = /^(-?[\\d.]+)px$/;\n\n/** `80%` — the radius, whose `%` suffix is the half that makes the gradient legal. */\nconst PERCENTAGE = /^(-?[\\d.]+)%$/;\n\n/**\n * Test harness for `<wr-spotlight-card>` — a card with a soft radial highlight that\n * follows the cursor.\n *\n * **The component's entire output is three custom properties on its own host, and this\n * harness reads them off the inline declaration.** There is no DOM for the highlight at\n * all: it is a `::before` pseudo-element, painted by the stylesheet from those three\n * values. So the paint is out of reach here and always will be — what is in reach is the\n * arithmetic and the exact spelling that feeds it, which is where this component breaks.\n *\n * **This harness reads PIXELS. {@link WrSpotlightHarness}, the `[wrSpotlight]` directive\n * shipped from the same entry point, reads PERCENTAGES.** Both write\n * `--wr-spotlight-x` / `--wr-spotlight-y`, in different units, off different events —\n * the card listens for `mousemove`, the directive for `pointermove`. That is deliberate\n * and documented, and it is also the mistake waiting to happen: putting `wrSpotlight` on\n * a `<wr-spotlight-card>` gives you two handlers overwriting one variable in units that\n * do not agree. Reach for the harness that matches the thing under test.\n *\n * **{@link movePointerTo} needs the card to have a box, and in a unit test it has none.**\n * The component subtracts its own `getBoundingClientRect()` from the client coordinate,\n * and jsdom answers that with a 0×0 rect at the origin — so the subtraction is a no-op\n * and the coordinate comes back unchanged. No throw here, unlike the directive's version:\n * the answer is degenerate rather than wrong, and it is legitimately what a real card\n * with no box would report. But a spec that asserts `x === clientX` against an unstubbed\n * rect has proved nothing about the box-relative conversion, which is the only thing\n * {@link getSpotlightPosition} is for. Give the host a box first:\n *\n * ```ts\n * const card = fixture.nativeElement.querySelector('wr-spotlight-card');\n * card.getBoundingClientRect = () => ({ left: 40, top: 20, width: 200, height: 100 }) as DOMRect;\n * ```\n *\n * Several plausible methods are deliberately absent. There is no `isSpotlightVisible()`\n * or `getSpotlightOpacity()`: the highlight sits at `opacity: 0` and is lifted to `0.6`\n * only under `:hover` / `:focus-within`, both of which are stylesheet selectors on a\n * pseudo-element — jsdom loads no stylesheet, matches no `:hover`, and cannot read a\n * pseudo-element's style at any time, so any answer would be invented. No `getGradient()`\n * for the same reason. No `hover()` / `mouseAway()` wrappers, which would be worse than\n * missing: the CDK's versions dispatch `mouseenter` / `mouseover` / `mouseleave`, none of\n * which this component listens to and none of which changes a `:hover` match in a test —\n * a spec calling them would look like it exercised the reveal and would have exercised\n * nothing. No `getSpotlightRect()` or `getCardSize()`, which are layout. And no\n * `respectsReducedMotion()`: this is the one animation component in the library that\n * deliberately does not implement the preference — a gradient tracks the cursor and no\n * content moves — so the method would answer identically for a component that honoured it\n * and one that ignored it.\n *\n * @example\n * ```ts\n * const card = await loader.getHarness(WrSpotlightCardHarness.with({ text: 'Hover me' }));\n *\n * expect(await card.getRadiusPercent()).toBe(80);\n * expect(await card.getSpotlightColor()).toBeNull(); // the theme decides\n * expect(await card.getSpotlightPosition()).toBeNull(); // nothing has pointed at it\n * ```\n *\n * @see https://ngwr.dev/guides/testing\n */\nexport class WrSpotlightCardHarness extends ComponentHarness {\n static hostSelector = 'wr-spotlight-card';\n\n /** Build a predicate that narrows the query — pass to `getHarness` / `getAllHarnesses`. */\n static with(options: WrSpotlightCardHarnessFilters = {}): HarnessPredicate<WrSpotlightCardHarness> {\n return new HarnessPredicate(WrSpotlightCardHarness, options).addOption('text', options.text, (harness, text) =>\n HarnessPredicate.stringMatches(harness.getContentText(), text)\n );\n }\n\n /**\n * Where the gradient fades out, as a percentage of its own radius.\n *\n * Returns the number, but the assertion it really makes is about the `%` that was\n * stripped to get it — this method refuses a bare `80`. The stylesheet interpolates the\n * variable straight into `transparent var(--wr-spotlight-radius, 80%)`, where a unitless\n * value is not a length, so the whole `radial-gradient()` declaration is dropped and the\n * highlight disappears with nothing in the console to say why. Reading this as a plain\n * number would sail past exactly that.\n *\n * Always present, whatever the input says: a `[radius]` that is not a number coerces\n * back to the default 80 rather than writing nonsense into the sheet.\n */\n async getRadiusPercent(): Promise<number> {\n const raw = (await this.vars()).get('--wr-spotlight-radius') ?? null;\n const match = raw === null ? null : PERCENTAGE.exec(raw);\n if (!match) {\n throw new Error(\n `WrSpotlightCardHarness.getRadiusPercent(): \\`--wr-spotlight-radius\\` reads \"${raw ?? '(absent)'}\" on the ` +\n 'host, and the stylesheet needs a percentage there — it drops the whole gradient for a bare number. The ' +\n 'card writes this one on every render whatever the input says, so a missing or unsuffixed value means ' +\n 'the binding itself stopped reaching the element.'\n );\n }\n return Number.parseFloat(match[1]);\n }\n\n /**\n * The highlight colour the author asked for, or `null` when they left it to the theme.\n *\n * `null` IS the contract for an unset `[spotlightColor]`, not a gap in it. The\n * stylesheet's own default is `rgba(var(--wr-color-on-surface-rgb), .15)`, and that\n * token flips per theme — which is what makes one component read as a dark glow on a\n * light surface and a light beam on a dark one. A card that started writing a concrete\n * colour here would look right in whichever theme it was authored against and wrong in\n * the other, and this is the only method that can tell.\n */\n async getSpotlightColor(): Promise<string | null> {\n return (await this.vars()).get('--wr-spotlight-color') ?? null;\n }\n\n /**\n * Where the highlight last sat, in pixels from the card's own top-left corner. `null`\n * until something has pointed at the card.\n *\n * Pixels, not percentages — see this class's docs for why the distinction matters\n * inside this one entry point.\n *\n * `null` is a state of its own rather than a stand-in for `{ x: 0, y: 0 }`: before the\n * first move the stylesheet's `50% / 50%` default applies, and a pointer at the card's\n * own origin legitimately reports zero, so folding the two together would make an\n * untouched card indistinguishable from one being pointed at in its corner.\n *\n * Note there is no reset when the cursor leaves, and that is not an oversight the\n * harness papers over: the stylesheet fades the whole overlay to `opacity: 0` on leave,\n * so nothing is parked visibly — but the coordinate stays written for the life of the\n * element. `null` therefore means \"no pointer has EVER arrived\", not \"none is here now\".\n */\n async getSpotlightPosition(): Promise<{ x: number; y: number } | null> {\n const vars = await this.vars();\n const x = vars.get('--wr-spotlight-x');\n const y = vars.get('--wr-spotlight-y');\n if (x === undefined || y === undefined) return null;\n\n return { x: this.parsePixels(x, '--wr-spotlight-x'), y: this.parsePixels(y, '--wr-spotlight-y') };\n }\n\n /**\n * Point at the card, in client coordinates.\n *\n * A `mousemove`, not a `pointermove` — the component listens for the former, and the\n * directive in the same entry point for the latter, so a pointer event dispatched here\n * is silently ignored. It goes to the host itself, so it needs no hit test and cannot\n * miss in a test that has no layout; the coordinates only ever reach the component's\n * own subtraction.\n *\n * Stub the host's `getBoundingClientRect` before calling this, or the subtraction is\n * invisible — see this class's docs.\n */\n async movePointerTo(clientX: number, clientY: number): Promise<void> {\n await (await this.host()).dispatchEvent('mousemove', { clientX, clientY });\n }\n\n /**\n * The projected content's text, trimmed.\n *\n * Read from the host, which is the whole assertion: the template is a bare\n * `<ng-content />` with no wrapper element, so content lands as a direct child and an\n * interactive one keeps its own name and role. The component adds no ARIA and no node\n * of its own — there is nothing else here for a harness to ask about.\n */\n async getContentText(): Promise<string> {\n return (await this.host()).text();\n }\n\n /** The host's inline declarations — the component's whole written output. */\n private async vars(): Promise<Map<string, string>> {\n return wrSpotlightInlineVars((await (await this.host()).getAttribute('style')) ?? '');\n }\n\n /** One written coordinate, as a number, insisting on the `px` the card promises. */\n private parsePixels(raw: string, name: string): number {\n const match = PIXEL_LENGTH.exec(raw);\n if (!match) {\n throw new Error(\n `WrSpotlightCardHarness.getSpotlightPosition(): \\`${name}\\` reads \"${raw}\", which is not the pixel length ` +\n 'the card writes. A percentage here is the tell that `[wrSpotlight]` is on the same element — the two ' +\n 'exports of this entry point share these variables and disagree about the unit.'\n );\n }\n return Number.parseFloat(match[1]);\n }\n}\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { ComponentHarness, HarnessPredicate } from '@angular/cdk/testing';\n\nimport type { WrSpotlightHarnessFilters } from './interfaces';\nimport { wrSpotlightInlineVars } from './wr-spotlight-harness-vars';\n\n/**\n * Test harness for `[wrSpotlight]` — the directive that makes a cursor-following\n * gradient possible on an element the consumer owns.\n *\n * **This harness reads PERCENTAGES. {@link WrSpotlightCardHarness}, shipped from the same\n * entry point, reads PIXELS.** Both write `--wr-spotlight-x` / `--wr-spotlight-y`; the\n * directive writes them as a share of its own box off `pointermove`, the card as a pixel\n * offset off `mousemove`. That is why {@link getSpotlightPosition} hands back raw strings\n * and not numbers — collapsing `'37.5%'` to `37.5` would hide the one thing that decides\n * whether the gradient lands where the cursor is, and would make the two halves of this\n * entry point look interchangeable when they are not.\n *\n * **The directive ships no styles and adds no node.** There is no class to assert, no\n * wrapper, no ARIA: whatever the element announced before the directive applies is\n * exactly what it announces after, and the gradient is entirely the consumer's own CSS.\n * So there is no `isSpotlightVisible()` — there is nothing here to be visible — and no\n * `getResetX()` / `getResetY()`, which would echo the inputs back rather than report the\n * coordinate the directive actually WROTE. The echo would pass while the written value\n * was wrong, which is not hypothetical (see {@link getSpotlightPosition}). And no\n * `respectsReducedMotion()`: neither export in this entry point implements the\n * preference — it is the library's one documented exemption, since a gradient tracks the\n * cursor and no content moves — so the method would answer the same for a directive that\n * honoured it and one that ignored it.\n *\n * @example\n * ```ts\n * const spotlight = await loader.getHarness(WrSpotlightHarness.with({ hostClass: 'card' }));\n *\n * expect(await spotlight.getSpotlightPosition()).toEqual({ x: '50%', y: '50%' });\n * await spotlight.movePointerTo(150, 25); // stub the host's rect first\n * ```\n *\n * @see https://ngwr.dev/guides/testing\n */\nexport class WrSpotlightHarness extends ComponentHarness {\n static hostSelector = '[wrSpotlight]';\n\n /**\n * Build a predicate that narrows the query — pass to `getHarness` / `getAllHarnesses`.\n *\n * Both options describe the HOST rather than the directive, because the directive\n * leaves no mark of its own to match on.\n */\n static with(options: WrSpotlightHarnessFilters = {}): HarnessPredicate<WrSpotlightHarness> {\n return new HarnessPredicate(WrSpotlightHarness, options)\n .addOption('text', options.text, async (harness, text) =>\n HarnessPredicate.stringMatches((await harness.host()).text(), text)\n )\n .addOption('hostClass', options.hostClass, async (harness, hostClass) =>\n (await harness.host()).hasClass(hostClass)\n );\n }\n\n /**\n * The coordinates the directive has written, as the raw strings it wrote them.\n *\n * Strings on purpose — see this class's docs. The values are percentages of the host's\n * own box while a pointer is over it, and whatever `[resetX]` / `[resetY]` say\n * otherwise, so a `px` appearing here means something else is writing these variables.\n *\n * **Present from construction, before any pointer arrives.** The directive seeds the\n * reset coordinates in its constructor, so the first read is `50%` / `50%` on a fresh\n * host — do not mistake that for a pointer having been tracked. Worth knowing that the\n * constructor runs before signal inputs are bound, so a bound (or even a static)\n * `resetX` is NOT what appears here initially: it is honoured from the first\n * {@link leave} onward, and the highlight jumps at that point. Reading the written\n * coordinate rather than the input is what makes that visible at all.\n *\n * Throws once the directive has been destroyed, rather than answering with the last\n * value it happened to leave behind — {@link hasTrackedPointer} is the question to ask\n * when the host may be gone.\n */\n async getSpotlightPosition(): Promise<{ x: string; y: string }> {\n const vars = await this.vars();\n const x = vars.get('--wr-spotlight-x');\n const y = vars.get('--wr-spotlight-y');\n if (x === undefined || y === undefined) {\n throw new Error(\n 'WrSpotlightHarness.getSpotlightPosition(): the host carries no `--wr-spotlight-x` / `--wr-spotlight-y`. ' +\n 'The directive writes both in its constructor and removes both on destroy, so this is a torn-down ' +\n 'directive rather than one that has not started — ask hasTrackedPointer() when the host may be gone.'\n );\n }\n return { x, y };\n }\n\n /**\n * Point at the host, in client coordinates.\n *\n * **Refuses on a host with no box, which in a unit test is every host.** The directive\n * divides the cursor offset by the element's own width and height, so a 0×0 rect writes\n * literally `Infinity%` or — at the origin — `NaN%` into the style. jsdom accepts either\n * string without complaint, so an unguarded harness would hand back something that looks\n * like a coordinate and describes nothing. Give the host a box first:\n *\n * ```ts\n * const el = fixture.nativeElement.querySelector('[wrSpotlight]');\n * el.getBoundingClientRect = () => ({ left: 0, top: 0, width: 200, height: 100 }) as DOMRect;\n * ```\n *\n * A `pointermove`, not a `mousemove` — the directive listens for the former, and the\n * component in the same entry point for the latter. It is dispatched on the host itself,\n * so it needs no hit test and cannot miss.\n */\n async movePointerTo(clientX: number, clientY: number): Promise<void> {\n const host = await this.host();\n const { width, height } = await host.getDimensions();\n if (!width || !height) {\n throw new Error(\n `WrSpotlightHarness.movePointerTo(${clientX}, ${clientY}): this host measures ${width}×${height}, so a ` +\n 'pointer position over it means nothing — the directive divides the offset by the box, and the result ' +\n 'goes into the style as `Infinity%` or `NaN%`. Stub `getBoundingClientRect` on the host first.'\n );\n }\n await host.dispatchEvent('pointermove', { clientX, clientY, pointerId: 1, isPrimary: true });\n }\n\n /**\n * Take the pointer away.\n *\n * Dispatches `pointerleave` — the directive's reset path, and the only place `[resetX]`\n * / `[resetY]` are read after construction. Needs no box: the handler writes the reset\n * strings straight through without measuring anything, which is why this one does not\n * refuse the way {@link movePointerTo} does.\n *\n * Not the CDK's `mouseAway()`, though that dispatches `pointerleave` too. This says what\n * it does, and it does not also fire the `mouseleave` / `mouseout` that the CDK helper\n * sends alongside it — events this directive ignores, and that would make a spec look\n * like it had covered more than it did.\n */\n async leave(): Promise<void> {\n await (await this.host()).dispatchEvent('pointerleave');\n }\n\n /**\n * Whether the directive still owns the host's spotlight variables.\n *\n * **This is \"the directive is alive\", not \"a pointer has moved over it\".** It is `true`\n * from the moment the directive constructs, because the constructor seeds the reset\n * coordinates — there is no earlier state to catch. What it distinguishes is a live\n * directive from a torn-down one: destroy removes both declarations from the element,\n * and nothing else in the repo asserts that cleanup. A directive that stopped removing\n * them would leave a stale gradient position on an element the consumer went on using,\n * and the only trace would be these two declarations outliving it.\n */\n async hasTrackedPointer(): Promise<boolean> {\n const vars = await this.vars();\n return vars.has('--wr-spotlight-x') && vars.has('--wr-spotlight-y');\n }\n\n /** The host's inline declarations — the directive's whole written output. */\n private async vars(): Promise<Map<string, string>> {\n return wrSpotlightInlineVars((await (await this.host()).getAttribute('style')) ?? '');\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;AAAA;;;;;AAKG;AAEH;;;;;;;;;;;;;;AAcG;AACG,SAAU,qBAAqB,CAAC,KAAa,EAAA;AACjD,IAAA,MAAM,YAAY,GAAG,IAAI,GAAG,EAAkB;IAC9C,KAAK,MAAM,WAAW,IAAI,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE;QAC1C,MAAM,KAAK,GAAG,WAAW,CAAC,OAAO,CAAC,GAAG,CAAC;QACtC,IAAI,KAAK,KAAK,CAAC,CAAC;YAAE;AAClB,QAAA,MAAM,IAAI,GAAG,WAAW,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,IAAI,EAAE;QAC/C,IAAI,IAAI,KAAK,EAAE;AAAE,YAAA,YAAY,CAAC,GAAG,CAAC,IAAI,EAAE,WAAW,CAAC,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;IAC9E;AACA,IAAA,OAAO,YAAY;AACrB;;AC/BA;;;;;AAKG;AAOH;AACA,MAAM,YAAY,GAAG,gBAAgB;AAErC;AACA,MAAM,UAAU,GAAG,eAAe;AAElC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyDG;AACG,MAAO,sBAAuB,SAAQ,gBAAgB,CAAA;AAC1D,IAAA,OAAO,YAAY,GAAG,mBAAmB;;AAGzC,IAAA,OAAO,IAAI,CAAC,OAAA,GAAyC,EAAE,EAAA;AAC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