ngwr 11.2.0 → 12.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +85 -26
- 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/collapse/styles/_index.scss +2 -2
- package/color-picker/styles/_index.scss +3 -3
- 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.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 +20 -2
- package/fesm2022/ngwr-bar-chart-testing.mjs.map +1 -1
- package/fesm2022/ngwr-bar-chart.mjs +3 -3
- package/fesm2022/ngwr-blur-text.mjs +3 -3
- package/fesm2022/ngwr-blur-text.mjs.map +1 -1
- 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.mjs +17 -5
- package/fesm2022/ngwr-calendar-heatmap.mjs.map +1 -1
- package/fesm2022/ngwr-calendar-testing.mjs +1 -1
- package/fesm2022/ngwr-calendar-testing.mjs.map +1 -1
- package/fesm2022/ngwr-calendar.mjs +187 -9
- 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 +48 -5
- package/fesm2022/ngwr-cascader.mjs.map +1 -1
- package/fesm2022/ngwr-checkbox.mjs +6 -6
- 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 +26 -6
- package/fesm2022/ngwr-color-picker-testing.mjs.map +1 -1
- package/fesm2022/ngwr-color-picker.mjs +98 -8
- 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 +333 -43
- 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 +11 -6
- 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.mjs +3 -3
- 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 +8 -4
- package/fesm2022/ngwr-donut-chart-testing.mjs.map +1 -1
- 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 +121 -58
- package/fesm2022/ngwr-drawer.mjs.map +1 -1
- package/fesm2022/ngwr-dropdown.mjs +26 -10
- package/fesm2022/ngwr-dropdown.mjs.map +1 -1
- package/fesm2022/ngwr-empty.mjs +3 -3
- package/fesm2022/ngwr-event-calendar.mjs +28 -15
- package/fesm2022/ngwr-event-calendar.mjs.map +1 -1
- package/fesm2022/ngwr-falling-text-testing.mjs +5 -3
- package/fesm2022/ngwr-falling-text-testing.mjs.map +1 -1
- 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.mjs +21 -11
- package/fesm2022/ngwr-fuzzy-text.mjs.map +1 -1
- package/fesm2022/ngwr-gauge.mjs +3 -3
- package/fesm2022/ngwr-glitch-text-testing.mjs +51 -17
- package/fesm2022/ngwr-glitch-text-testing.mjs.map +1 -1
- package/fesm2022/ngwr-glitch-text.mjs +7 -7
- package/fesm2022/ngwr-glitch-text.mjs.map +1 -1
- package/fesm2022/ngwr-gradient-text-testing.mjs +46 -11
- package/fesm2022/ngwr-gradient-text-testing.mjs.map +1 -1
- 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 +73 -1
- package/fesm2022/ngwr-i18n-en.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-ru.mjs +55 -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 +53 -9
- package/fesm2022/ngwr-image-cropper-testing.mjs.map +1 -1
- package/fesm2022/ngwr-image-cropper.mjs +150 -12
- 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 +17 -10
- 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.mjs +3 -3
- package/fesm2022/ngwr-layout.mjs +15 -15
- package/fesm2022/ngwr-lightbox.mjs +4 -4
- package/fesm2022/ngwr-lightbox.mjs.map +1 -1
- 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.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 +26 -6
- package/fesm2022/ngwr-meter-group-testing.mjs.map +1 -1
- package/fesm2022/ngwr-meter-group.mjs +3 -3
- package/fesm2022/ngwr-overlay.mjs +6 -6
- 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 +83 -16
- 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 +155 -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.mjs +3 -3
- package/fesm2022/ngwr-scroll.mjs +3 -3
- package/fesm2022/ngwr-segmented-testing.mjs +85 -1
- package/fesm2022/ngwr-segmented-testing.mjs.map +1 -1
- package/fesm2022/ngwr-segmented.mjs +123 -10
- package/fesm2022/ngwr-segmented.mjs.map +1 -1
- package/fesm2022/ngwr-select.mjs +159 -34
- package/fesm2022/ngwr-select.mjs.map +1 -1
- 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 +100 -9
- package/fesm2022/ngwr-slider.mjs.map +1 -1
- package/fesm2022/ngwr-sparkline.mjs +3 -3
- package/fesm2022/ngwr-speed-dial-testing.mjs +15 -13
- package/fesm2022/ngwr-speed-dial-testing.mjs.map +1 -1
- 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.mjs +3 -3
- package/fesm2022/ngwr-split-text.mjs +17 -5
- package/fesm2022/ngwr-split-text.mjs.map +1 -1
- package/fesm2022/ngwr-splitter.mjs +3 -3
- 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.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 +99 -39
- 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 +36 -10
- 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.mjs +7 -7
- package/fesm2022/ngwr-tilt-card.mjs.map +1 -1
- package/fesm2022/ngwr-timeline.mjs +6 -6
- package/fesm2022/ngwr-toast.mjs +9 -9
- package/fesm2022/ngwr-toolbar.mjs +3 -3
- 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 +28 -10
- package/fesm2022/ngwr-tree.mjs.map +1 -1
- package/fesm2022/ngwr-typewriter-testing.mjs +15 -1
- package/fesm2022/ngwr-typewriter-testing.mjs.map +1 -1
- 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.mjs +4 -4
- package/fesm2022/ngwr-waves.mjs.map +1 -1
- package/fesm2022/ngwr-window.mjs +94 -24
- 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 +56 -6
- package/i18n/ru.json +56 -6
- 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 +19 -24
- package/llms.txt +46 -8
- package/markdown/styles/_index.scss +3 -3
- package/mcp/api.js +6 -4
- package/mcp/catalog.js +40 -3
- package/mcp/providers.js +16 -3
- package/mcp/tools.js +21 -1
- package/meter-group/styles/_index.scss +1 -1
- package/overlay/styles/_index.scss +33 -1
- package/package.json +17 -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 +7 -5
- package/skills/ngwr/references/catalog.md +9 -9
- package/skills/ngwr/references/setup.md +10 -5
- 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-bar-chart-testing.d.ts +9 -1
- package/types/ngwr-blur-text.d.ts +8 -4
- package/types/ngwr-breadcrumbs.d.ts +17 -10
- package/types/ngwr-calendar-testing.d.ts +1 -1
- package/types/ngwr-calendar.d.ts +66 -0
- package/types/ngwr-carousel.d.ts +85 -6
- package/types/ngwr-cascader.d.ts +17 -0
- package/types/ngwr-click-spark.d.ts +4 -0
- package/types/ngwr-color-picker-testing.d.ts +8 -0
- package/types/ngwr-color-picker.d.ts +21 -1
- 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 +56 -0
- 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 +11 -6
- 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-dialog.d.ts +38 -1
- package/types/ngwr-divider.d.ts +25 -0
- package/types/ngwr-donut-chart-testing.d.ts +7 -3
- package/types/ngwr-donut-chart.d.ts +3 -3
- package/types/ngwr-drag-drop.d.ts +56 -2
- package/types/ngwr-drawer.d.ts +56 -5
- package/types/ngwr-event-calendar.d.ts +8 -2
- package/types/ngwr-falling-text-testing.d.ts +5 -3
- package/types/ngwr-falling-text.d.ts +1 -1
- package/types/ngwr-form.d.ts +12 -2
- package/types/ngwr-glitch-text-testing.d.ts +37 -8
- package/types/ngwr-gradient-text-testing.d.ts +16 -3
- package/types/ngwr-i18n.d.ts +13 -4
- package/types/ngwr-image-cropper-testing.d.ts +49 -10
- package/types/ngwr-image-cropper.d.ts +70 -5
- package/types/ngwr-input-number-testing.d.ts +15 -10
- package/types/ngwr-input-number.d.ts +11 -4
- package/types/ngwr-input-otp-testing.d.ts +12 -6
- package/types/ngwr-input-otp.d.ts +15 -1
- package/types/ngwr-line-chart.d.ts +20 -3
- package/types/ngwr-markdown.d.ts +11 -0
- package/types/ngwr-mention.d.ts +32 -0
- package/types/ngwr-meter-group-testing.d.ts +12 -2
- package/types/ngwr-overlay.d.ts +1 -0
- package/types/ngwr-pagination-testing.d.ts +4 -4
- package/types/ngwr-pagination.d.ts +11 -0
- 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-segmented-testing.d.ts +53 -0
- package/types/ngwr-segmented.d.ts +107 -5
- package/types/ngwr-select.d.ts +68 -6
- package/types/ngwr-shiny-text.d.ts +4 -2
- package/types/ngwr-sidebar.d.ts +14 -5
- package/types/ngwr-slider.d.ts +69 -1
- package/types/ngwr-speed-dial-testing.d.ts +15 -11
- package/types/ngwr-speed-dial.d.ts +22 -3
- package/types/ngwr-split-text.d.ts +9 -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 +104 -11
- 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-tour.d.ts +22 -4
- package/types/ngwr-tree.d.ts +5 -4
- package/types/ngwr-typewriter-testing.d.ts +10 -0
- package/types/ngwr-utils.d.ts +5 -2
- package/types/ngwr-version.d.ts +1 -1
- package/types/ngwr-window.d.ts +39 -11
- package/typography/styles/_index.scss +1 -1
- package/window/styles/_index.scss +72 -26
- 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
|
@@ -48,10 +48,10 @@ class WrPopconfirmPanel {
|
|
|
48
48
|
...(ngDevMode ? [{ debugName: "confirmColor" }] : /* istanbul ignore next */ []));
|
|
49
49
|
confirmed = output();
|
|
50
50
|
cancelled = output();
|
|
51
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.
|
|
52
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.1.
|
|
51
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: WrPopconfirmPanel, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
52
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.1.4", type: WrPopconfirmPanel, isStandalone: true, selector: "wr-popconfirm", inputs: { message: { classPropertyName: "message", publicName: "message", isSignal: true, isRequired: true, transformFunction: null }, messageId: { classPropertyName: "messageId", publicName: "messageId", isSignal: true, isRequired: false, transformFunction: null }, confirmText: { classPropertyName: "confirmText", publicName: "confirmText", isSignal: true, isRequired: false, transformFunction: null }, cancelText: { classPropertyName: "cancelText", publicName: "cancelText", isSignal: true, isRequired: false, transformFunction: null }, confirmColor: { classPropertyName: "confirmColor", publicName: "confirmColor", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { confirmed: "confirmed", cancelled: "cancelled" }, host: { classAttribute: "wr-popconfirm" }, ngImport: i0, template: "<p class=\"wr-popconfirm__message\" [attr.id]=\"messageId()\">{{ message() }}</p>\n\n<div class=\"wr-popconfirm__actions\">\n <wr-btn class=\"wr-popconfirm__action wr-popconfirm__action--cancel\" size=\"sm\" (click)=\"cancelled.emit()\">\n {{ cancelText() }}\n </wr-btn>\n <wr-btn\n class=\"wr-popconfirm__action wr-popconfirm__action--confirm\"\n size=\"sm\"\n [color]=\"confirmColor()\"\n (click)=\"confirmed.emit()\"\n >\n {{ confirmText() }}\n </wr-btn>\n</div>\n", dependencies: [{ kind: "component", type: WrButton, selector: "wr-btn, button[wr-btn], a[wr-btn]", inputs: ["color", "size", "shape", "icon", "iconPosition", "disabled", "outlined", "block", "loading", "isDisabledWhenLoading"] }], encapsulation: i0.ViewEncapsulation.None });
|
|
53
53
|
}
|
|
54
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.
|
|
54
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: WrPopconfirmPanel, decorators: [{
|
|
55
55
|
type: Component,
|
|
56
56
|
args: [{ selector: 'wr-popconfirm', encapsulation: ViewEncapsulation.None, host: { class: 'wr-popconfirm' }, imports: [WrButton], template: "<p class=\"wr-popconfirm__message\" [attr.id]=\"messageId()\">{{ message() }}</p>\n\n<div class=\"wr-popconfirm__actions\">\n <wr-btn class=\"wr-popconfirm__action wr-popconfirm__action--cancel\" size=\"sm\" (click)=\"cancelled.emit()\">\n {{ cancelText() }}\n </wr-btn>\n <wr-btn\n class=\"wr-popconfirm__action wr-popconfirm__action--confirm\"\n size=\"sm\"\n [color]=\"confirmColor()\"\n (click)=\"confirmed.emit()\"\n >\n {{ confirmText() }}\n </wr-btn>\n</div>\n" }]
|
|
57
57
|
}], propDecorators: { message: [{ type: i0.Input, args: [{ isSignal: true, alias: "message", required: true }] }], messageId: [{ type: i0.Input, args: [{ isSignal: true, alias: "messageId", required: false }] }], confirmText: [{ type: i0.Input, args: [{ isSignal: true, alias: "confirmText", required: false }] }], cancelText: [{ type: i0.Input, args: [{ isSignal: true, alias: "cancelText", required: false }] }], confirmColor: [{ type: i0.Input, args: [{ isSignal: true, alias: "confirmColor", required: false }] }], confirmed: [{ type: i0.Output, args: ["confirmed"] }], cancelled: [{ type: i0.Output, args: ["cancelled"] }] } });
|
|
@@ -235,10 +235,10 @@ class WrPopconfirm {
|
|
|
235
235
|
isRtl() {
|
|
236
236
|
return this.dir?.value === 'rtl';
|
|
237
237
|
}
|
|
238
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.
|
|
239
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.1.
|
|
238
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: WrPopconfirm, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
239
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.1.4", type: WrPopconfirm, isStandalone: true, selector: "[wrPopconfirm]", inputs: { message: { classPropertyName: "message", publicName: "wrPopconfirm", isSignal: true, isRequired: true, transformFunction: null }, position: { classPropertyName: "position", publicName: "position", isSignal: true, isRequired: false, transformFunction: null }, confirmText: { classPropertyName: "confirmText", publicName: "confirmText", isSignal: true, isRequired: false, transformFunction: null }, cancelText: { classPropertyName: "cancelText", publicName: "cancelText", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null }, confirmColor: { classPropertyName: "confirmColor", publicName: "confirmColor", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { confirmed: "confirmed", cancelled: "cancelled" }, host: { listeners: { "click": "toggle($event)" }, properties: { "attr.aria-haspopup": "\"dialog\"", "attr.aria-expanded": "isOpen()", "attr.aria-controls": "isOpen() ? panelId : null" }, classAttribute: "wr-popconfirm-trigger" }, ngImport: i0 });
|
|
240
240
|
}
|
|
241
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.
|
|
241
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: WrPopconfirm, decorators: [{
|
|
242
242
|
type: Directive,
|
|
243
243
|
args: [{
|
|
244
244
|
selector: '[wrPopconfirm]',
|
|
@@ -240,8 +240,13 @@ class WrPopoverHarness extends ContentContainerComponentHarness {
|
|
|
240
240
|
* Where the panel sits relative to the trigger, or `null` when it is presented
|
|
241
241
|
* as a sheet and has no anchor.
|
|
242
242
|
*
|
|
243
|
-
* The
|
|
244
|
-
*
|
|
243
|
+
* The APPLIED position, not the requested one: CDK flips a placement that does
|
|
244
|
+
* not fit to the next in its fallback chain and swaps the modifier class with
|
|
245
|
+
* it. Under a unit test that is always the requested placement — jsdom measures
|
|
246
|
+
* every box as 0×0, so the first candidate always "fits" — but in a browser the
|
|
247
|
+
* two can differ, and this answers what is on screen. The directive defaults
|
|
248
|
+
* the request per mode (`bottom` for a popover, `top` for a tooltip).
|
|
249
|
+
*
|
|
245
250
|
* The arrow itself is a `::after` pseudo-element, so it exists for no DOM query
|
|
246
251
|
* at all; this class is the placement, and it is what the arrow's own CSS keys
|
|
247
252
|
* off.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ngwr-popover-testing.mjs","sources":["../../../projects/lib/popover/testing/wr-popover-harness.ts","../../../projects/lib/popover/testing/ngwr-popover-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\nimport {\n ContentContainerComponentHarness,\n type HarnessLoader,\n HarnessPredicate,\n TestKey,\n type TestElement,\n} from '@angular/cdk/testing';\n\nimport type { WrPopoverPosition } from 'ngwr/popover';\n\nimport type { WrPopoverHarnessFilters } from './interfaces';\n\n/** How long the waiters poll before giving up, in ms. Generous next to the 120ms default delays. */\nconst DEFAULT_TIMEOUT = 1000;\n\n/** How often they re-check, in ms. */\nconst POLL_STEP = 10;\n\n/**\n * The real `setTimeout`, captured at module load — before a spec can install\n * fake timers.\n *\n * The waiters have to let REAL time pass: the show / hide delays are plain\n * `setTimeout`s inside the directive, and under zoneless change detection\n * `whenStable()` resolves without waiting for a macrotask. Reading the faked\n * global instead would mean the sleep never fires at all, and the harness would\n * hang where it should fail with the message it prepared.\n */\nconst realSetTimeout = globalThis.setTimeout;\n\nfunction sleep(ms: number): Promise<void> {\n return new Promise(resolve => {\n realSetTimeout(resolve, ms);\n });\n}\n\n/**\n * Test harness for `[wrPopover]` — both shapes the one directive ships:\n *\n * - **popover** — template content, opens on click (or hover), announces\n * `role=\"dialog\"` and is what the trigger's `aria-expanded` describes;\n * - **tooltip** — string content, opens on hover AND focus after a delay,\n * announces `role=\"tooltip\"` and DESCRIBES its trigger instead of being\n * owned by it.\n *\n * The panel is never inside the trigger: it is a portal in the overlay\n * container, a sibling of the whole app. It is reached through the document\n * root, scoped by the id the trigger publishes while the panel is showing —\n * `aria-controls` in popover mode, `aria-describedby` in tooltip mode. That id\n * is what lets two popovers be open at once without reading each other's\n * content, and it is why every panel reader throws while the panel is shut:\n * there is no element to answer about.\n *\n * Being a CONTENT CONTAINER is the point in popover mode — the panel holds the\n * consumer's own components, so `popover.getHarness(WrButtonHarness…)` reaches\n * them without the spec ever touching the overlay.\n *\n * **Timing.** A tooltip opens on `showDelay` and hides on `hideDelay`; a hover\n * popover hides 120ms after the pointer leaves. `open()`, `close()` and the two\n * waiters sit out that REAL time, so a spec that installs fake timers should\n * drive the clock itself and read `isOpen()` rather than call them.\n *\n * @example\n * ```ts\n * const loader = TestbedHarnessEnvironment.loader(fixture);\n * const details = await loader.getHarness(WrPopoverHarness.with({ triggerText: 'Details' }));\n *\n * await details.open();\n * expect(await details.getRole()).toBe('dialog');\n * await (await details.getHarness(WrButtonHarness.with({ text: 'Confirm' }))).click();\n * ```\n *\n * @see https://ngwr.dev/guides/testing\n */\nexport class WrPopoverHarness extends ContentContainerComponentHarness {\n /**\n * The directive's host — whatever element the consumer put `[wrPopover]` on.\n *\n * Matched by the marker class, not by `[wrPopover]`: popover-mode content is a\n * `TemplateRef` and so is always BOUND (`[wrPopover]=\"tpl\"`), which leaves no\n * attribute in the DOM at all, and a CLOSED tooltip publishes no ARIA either.\n * (A tooltip written with the static string form, `wrPopover=\"Save changes\"`,\n * does keep the attribute — but only that one shape would be findable by it.)\n * Same shape as `.wr-dropdown-trigger`.\n */\n static hostSelector = '.wr-popover-trigger';\n\n /** Build a predicate that narrows the query — pass to `getHarness` / `getAllHarnesses`. */\n static with(options: WrPopoverHarnessFilters = {}): HarnessPredicate<WrPopoverHarness> {\n return new HarnessPredicate(WrPopoverHarness, options)\n .addOption('triggerText', options.triggerText, (harness, text) =>\n HarnessPredicate.stringMatches(harness.getTriggerText(), text)\n )\n .addOption('mode', options.mode, async (harness, mode) => (await harness.getMode()) === mode)\n .addOption('open', options.open, async (harness, open) => (await harness.isOpen()) === open);\n }\n\n /**\n * Which shape this trigger carries.\n *\n * Read from the ARIA contract, not from the `mode` input: a bound `[mode]`\n * never reaches the DOM, while `aria-haspopup=\"dialog\"` is on every popover\n * trigger and on no tooltip trigger — a tooltip is a description of the\n * control, not a popup it owns.\n */\n async getMode(): Promise<'popover' | 'tooltip'> {\n return (await (await this.host()).getAttribute('aria-haspopup')) === 'dialog' ? 'popover' : 'tooltip';\n }\n\n /** The trigger's own visible text. The panel's content is `getContentText()`. */\n async getTriggerText(): Promise<string> {\n return (await this.host()).text();\n }\n\n /**\n * Whether the panel is showing.\n *\n * Two different signals because the two modes advertise different things: a\n * popover flips `aria-expanded` on its trigger, a tooltip has none at all and\n * links its description instead. So a tooltip's answer is only as good as the\n * directive's claim on `aria-describedby` — put the tooltip on a control that\n * is ALSO described by something else (a `<wr-form-field>` hint, say) and the\n * two bindings fight over one attribute.\n */\n async isOpen(): Promise<boolean> {\n const host = await this.host();\n return (await this.getMode()) === 'popover'\n ? (await host.getAttribute('aria-expanded')) === 'true'\n : (await host.getAttribute('aria-describedby')) !== null;\n }\n\n /**\n * Open the panel with the gesture this trigger actually answers to, and wait\n * until it is showing.\n *\n * `trigger` is an input, so the DOM does not say which gesture this popover\n * wants — the harness moves the pointer on first and falls back to a click.\n * Hover leads because a click is an outside pointer event for every OTHER open\n * panel, so leading with it would dismiss someone else's popover on the way to\n * opening this one; a click-driven popover ignores the hover outright. A\n * tooltip is never clicked at all — hover and focus are its only gestures.\n *\n * Throws when nothing appears: a tooltip with an empty string never opens, and\n * a spec on fake timers has to advance the clock itself.\n */\n async open(timeout = DEFAULT_TIMEOUT): Promise<void> {\n if (await this.isOpen()) return;\n\n const host = await this.host();\n await host.hover();\n if ((await this.getMode()) === 'tooltip') return this.waitUntilOpen(timeout);\n\n if (await this.isOpen()) return;\n await host.click();\n return this.waitUntilOpen(timeout);\n }\n\n /**\n * Dismiss the panel and wait until it is gone.\n *\n * Escape, because it is the one gesture both modes honour immediately: a\n * popover is closed by the overlay's keyboard dispatcher, a tooltip by the\n * directive's own binding — no delay in either. To exercise the delayed\n * pointer path instead, call `mouseAway()` and then `waitUntilClosed()`.\n */\n async close(timeout = DEFAULT_TIMEOUT): Promise<void> {\n if (!(await this.isOpen())) return;\n\n await this.sendEscape();\n return this.waitUntilClosed(timeout);\n }\n\n /** Click the trigger. Opens a click-driven popover, toggles it shut again, and does nothing else. */\n async click(): Promise<void> {\n return (await this.host()).click();\n }\n\n /** Move the pointer onto the trigger — opens a hover popover at once, a tooltip after `showDelay`. */\n async hover(): Promise<void> {\n return (await this.host()).hover();\n }\n\n /** Move the pointer off the trigger. The panel goes after the grace period, not instantly. */\n async mouseAway(): Promise<void> {\n return (await this.host()).mouseAway();\n }\n\n /** Focus the trigger — a tooltip's other opening gesture, so keyboard users get the hint too. */\n async focus(): Promise<void> {\n return (await this.host()).focus();\n }\n\n /** Blur the trigger, which hides a tooltip after `hideDelay`. */\n async blur(): Promise<void> {\n return (await this.host()).blur();\n }\n\n /** Press Escape on the trigger. Both modes dismiss on it, and neither moves focus. */\n async sendEscape(): Promise<void> {\n return (await this.host()).sendKeys(TestKey.ESCAPE);\n }\n\n /** Wait out a pending show. Resolves at once when the panel is already up. */\n async waitUntilOpen(timeout = DEFAULT_TIMEOUT): Promise<void> {\n if (await this.settled(true, timeout)) return;\n\n throw new Error(\n `WrPopoverHarness.waitUntilOpen(): nothing opened within ${timeout}ms. A tooltip waits out its ` +\n 'showDelay (and never opens at all for an empty string); this wait uses real time, so a spec on ' +\n 'fake timers has to advance the clock itself and read isOpen().'\n );\n }\n\n /** Wait out a pending hide. Resolves at once when the panel is already gone. */\n async waitUntilClosed(timeout = DEFAULT_TIMEOUT): Promise<void> {\n if (await this.settled(false, timeout)) return;\n\n throw new Error(\n `WrPopoverHarness.waitUntilClosed(): still showing after ${timeout}ms. A hover popover closes 120ms ` +\n 'after the pointer leaves — and only if it left at all, since a mouseleave INTO that panel is ' +\n 'deliberately not a leave. A tooltip closes on its hideDelay after mouseleave or blur.'\n );\n }\n\n /**\n * The panel's text.\n *\n * In tooltip mode that is the string itself, rendered into the small text\n * panel; in popover mode it is everything the projected template renders.\n */\n async getContentText(): Promise<string> {\n return (await this.panel()).text();\n }\n\n /**\n * The role the open panel announces: `'dialog'` for a popover, `'tooltip'` for\n * a tooltip.\n *\n * Worth asserting rather than assuming, twice over: the directive sets it on\n * the OVERLAY PANE, not on the content a consumer wrote, and in tooltip mode\n * the pane is deliberately the only element carrying it — the text panel\n * inside has none, or the description would nest a tooltip in a tooltip.\n */\n async getRole(): Promise<string | null> {\n return (await this.panel()).getAttribute('role');\n }\n\n /**\n * The panel's accessible name — `null` in tooltip mode.\n *\n * A popover is a named `role=\"dialog\"`: the `ariaLabel` input, or the i18n\n * catalog's `popover.label` when the consumer says nothing, because an unnamed\n * dialog announces as \"dialog\" and nothing else. A tooltip has no name of its\n * own; it IS the trigger's description, which is `getDescriptionText()`.\n */\n async getLabel(): Promise<string | null> {\n return (await this.panel()).getAttribute('aria-label');\n }\n\n /**\n * Whether the panel claims modality.\n *\n * `false`, deliberately, and worth pinning: the popover sets\n * `aria-modal=\"false\"` because focus is NOT trapped and the panel dismisses on\n * outside click / Escape rather than blocking the page.\n */\n async isModal(): Promise<boolean> {\n return (await (await this.panel()).getAttribute('aria-modal')) === 'true';\n }\n\n /**\n * Where the panel sits relative to the trigger, or `null` when it is presented\n * as a sheet and has no anchor.\n *\n * The resolved position — the directive defaults it per mode (`bottom` for a\n * popover, `top` for a tooltip) — read off the pane's public modifier class.\n * The arrow itself is a `::after` pseudo-element, so it exists for no DOM query\n * at all; this class is the placement, and it is what the arrow's own CSS keys\n * off.\n */\n async getPosition(): Promise<WrPopoverPosition | null> {\n const classes = (await (await this.panel()).getAttribute('class')) ?? '';\n const modifier = /wr-(?:popover|tooltip)-overlay--([a-z-]+)/.exec(classes);\n return modifier ? (modifier[1] as WrPopoverPosition) : null;\n }\n\n /** Whether the popover is presented as a full-width bottom sheet instead of an anchored panel. */\n async isSheet(): Promise<boolean> {\n return (await this.panel()).hasClass('wr-overlay-sheet');\n }\n\n /**\n * The text a screen reader reads as the TRIGGER'S DESCRIPTION, or `null` when\n * it describes nothing.\n *\n * This resolves `aria-describedby` the way an assistive technology would, so\n * it answers the whole of tooltip mode's naming contract in one call. Always\n * `null` for a popover, open or shut — a popover is a thing the trigger owns\n * (`aria-haspopup` / `aria-expanded`), never a description of it.\n */\n async getDescriptionText(): Promise<string | null> {\n const id = await (await this.host()).getAttribute('aria-describedby');\n if (!id) return null;\n\n const described = await this.documentRootLocatorFactory().locatorForOptional(`#${id}`)();\n return described ? described.text() : null;\n }\n\n /**\n * Harnesses for the consumer's own components are resolved inside THIS\n * instance's panel.\n *\n * Scoped by the published id rather than by `.wr-popover-overlay`: the overlay\n * container is shared, so a class query would answer with whichever popover\n * opened first.\n */\n protected override async getRootHarnessLoader(): Promise<HarnessLoader> {\n return this.documentRootLocatorFactory().harnessLoaderFor(`#${await this.panelId()}`);\n }\n\n /** Poll until `isOpen()` reports `open`, and say whether it did. */\n private async settled(open: boolean, timeout: number): Promise<boolean> {\n for (let waited = 0; waited <= timeout; waited += POLL_STEP) {\n if ((await this.isOpen()) === open) return true;\n\n await sleep(POLL_STEP);\n await this.forceStabilize();\n }\n return false;\n }\n\n /** This instance's overlay pane. */\n private async panel(): Promise<TestElement> {\n return this.documentRootLocatorFactory().locatorFor(`#${await this.panelId()}`)();\n }\n\n /** The id the trigger publishes for its panel, which only exists while the panel does. */\n private async panelId(): Promise<string> {\n const attribute = (await this.getMode()) === 'popover' ? 'aria-controls' : 'aria-describedby';\n const id = await (await this.host()).getAttribute(attribute);\n\n if (!id) {\n throw new Error(\n `WrPopoverHarness: nothing is showing. The trigger publishes its panel id as ${attribute} only ` +\n 'while the panel is open — call open() first (a tooltip also has to wait out its showDelay).'\n );\n }\n return id;\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;AAAA;;;;;AAKG;AAcH;AACA,MAAM,eAAe,GAAG,IAAI;AAE5B;AACA,MAAM,SAAS,GAAG,EAAE;AAEpB;;;;;;;;;AASG;AACH,MAAM,cAAc,GAAG,UAAU,CAAC,UAAU;AAE5C,SAAS,KAAK,CAAC,EAAU,EAAA;AACvB,IAAA,OAAO,IAAI,OAAO,CAAC,OAAO,IAAG;AAC3B,QAAA,cAAc,CAAC,OAAO,EAAE,EAAE,CAAC;AAC7B,IAAA,CAAC,CAAC;AACJ;AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqCG;AACG,MAAO,gBAAiB,SAAQ,gCAAgC,CAAA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AAAE,gBAAA,OAAO,IAAI;AAE/C,YAAA,MAAM,KAAK,CAAC,SAAS,CAAC;AACtB,YAAA,MAAM,IAAI,CAAC,cAAc,EAAE;QAC7B;AACA,QAAA,OAAO,KAAK;IACd;;AAGQ,IAAA,MAAM,KAAK,GAAA;AACjB,QAAA,OAAO,IAAI,CAAC,0BAA0B,EAAE,CAAC,UAAU,CAAC,CAAA,CAAA,EAAI,MAAM,IAAI,CAAC,OAAO,EAAE,CAAA,CAAE,CAAC,EAAE;IACnF;;AAGQ,IAAA,MAAM,OAAO,GAAA;AACnB,QAAA,MAAM,SAAS,GAAG,CAAC,MAAM,IAAI,CAAC,OAAO,EAAE,MAAM,SAAS,GAAG,eAAe,GAAG,kBAAkB;AAC7F,QAAA,MAAM,EAAE,GAAG,MAAM,CAAC,MAAM,IAAI,CAAC,IAAI,EAAE,EAAE,YAAY,CAAC,SAAS,CAAC;QAE5D,IAAI,CAAC,EAAE,EAAE;AACP,YAAA,MAAM,IAAI,KAAK,CACb,CAAA,4EAAA,EAA+E,SAAS,CAAA,MAAA,CAAQ;AAC9F,gBAAA,6FAA6F,CAChG;QACH;AACA,QAAA,OAAO,EAAE;IACX;;;ACnWF;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"ngwr-popover-testing.mjs","sources":["../../../projects/lib/popover/testing/wr-popover-harness.ts","../../../projects/lib/popover/testing/ngwr-popover-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\nimport {\n ContentContainerComponentHarness,\n type HarnessLoader,\n HarnessPredicate,\n TestKey,\n type TestElement,\n} from '@angular/cdk/testing';\n\nimport type { WrPopoverPosition } from 'ngwr/popover';\n\nimport type { WrPopoverHarnessFilters } from './interfaces';\n\n/** How long the waiters poll before giving up, in ms. Generous next to the 120ms default delays. */\nconst DEFAULT_TIMEOUT = 1000;\n\n/** How often they re-check, in ms. */\nconst POLL_STEP = 10;\n\n/**\n * The real `setTimeout`, captured at module load — before a spec can install\n * fake timers.\n *\n * The waiters have to let REAL time pass: the show / hide delays are plain\n * `setTimeout`s inside the directive, and under zoneless change detection\n * `whenStable()` resolves without waiting for a macrotask. Reading the faked\n * global instead would mean the sleep never fires at all, and the harness would\n * hang where it should fail with the message it prepared.\n */\nconst realSetTimeout = globalThis.setTimeout;\n\nfunction sleep(ms: number): Promise<void> {\n return new Promise(resolve => {\n realSetTimeout(resolve, ms);\n });\n}\n\n/**\n * Test harness for `[wrPopover]` — both shapes the one directive ships:\n *\n * - **popover** — template content, opens on click (or hover), announces\n * `role=\"dialog\"` and is what the trigger's `aria-expanded` describes;\n * - **tooltip** — string content, opens on hover AND focus after a delay,\n * announces `role=\"tooltip\"` and DESCRIBES its trigger instead of being\n * owned by it.\n *\n * The panel is never inside the trigger: it is a portal in the overlay\n * container, a sibling of the whole app. It is reached through the document\n * root, scoped by the id the trigger publishes while the panel is showing —\n * `aria-controls` in popover mode, `aria-describedby` in tooltip mode. That id\n * is what lets two popovers be open at once without reading each other's\n * content, and it is why every panel reader throws while the panel is shut:\n * there is no element to answer about.\n *\n * Being a CONTENT CONTAINER is the point in popover mode — the panel holds the\n * consumer's own components, so `popover.getHarness(WrButtonHarness…)` reaches\n * them without the spec ever touching the overlay.\n *\n * **Timing.** A tooltip opens on `showDelay` and hides on `hideDelay`; a hover\n * popover hides 120ms after the pointer leaves. `open()`, `close()` and the two\n * waiters sit out that REAL time, so a spec that installs fake timers should\n * drive the clock itself and read `isOpen()` rather than call them.\n *\n * @example\n * ```ts\n * const loader = TestbedHarnessEnvironment.loader(fixture);\n * const details = await loader.getHarness(WrPopoverHarness.with({ triggerText: 'Details' }));\n *\n * await details.open();\n * expect(await details.getRole()).toBe('dialog');\n * await (await details.getHarness(WrButtonHarness.with({ text: 'Confirm' }))).click();\n * ```\n *\n * @see https://ngwr.dev/guides/testing\n */\nexport class WrPopoverHarness extends ContentContainerComponentHarness {\n /**\n * The directive's host — whatever element the consumer put `[wrPopover]` on.\n *\n * Matched by the marker class, not by `[wrPopover]`: popover-mode content is a\n * `TemplateRef` and so is always BOUND (`[wrPopover]=\"tpl\"`), which leaves no\n * attribute in the DOM at all, and a CLOSED tooltip publishes no ARIA either.\n * (A tooltip written with the static string form, `wrPopover=\"Save changes\"`,\n * does keep the attribute — but only that one shape would be findable by it.)\n * Same shape as `.wr-dropdown-trigger`.\n */\n static hostSelector = '.wr-popover-trigger';\n\n /** Build a predicate that narrows the query — pass to `getHarness` / `getAllHarnesses`. */\n static with(options: WrPopoverHarnessFilters = {}): HarnessPredicate<WrPopoverHarness> {\n return new HarnessPredicate(WrPopoverHarness, options)\n .addOption('triggerText', options.triggerText, (harness, text) =>\n HarnessPredicate.stringMatches(harness.getTriggerText(), text)\n )\n .addOption('mode', options.mode, async (harness, mode) => (await harness.getMode()) === mode)\n .addOption('open', options.open, async (harness, open) => (await harness.isOpen()) === open);\n }\n\n /**\n * Which shape this trigger carries.\n *\n * Read from the ARIA contract, not from the `mode` input: a bound `[mode]`\n * never reaches the DOM, while `aria-haspopup=\"dialog\"` is on every popover\n * trigger and on no tooltip trigger — a tooltip is a description of the\n * control, not a popup it owns.\n */\n async getMode(): Promise<'popover' | 'tooltip'> {\n return (await (await this.host()).getAttribute('aria-haspopup')) === 'dialog' ? 'popover' : 'tooltip';\n }\n\n /** The trigger's own visible text. The panel's content is `getContentText()`. */\n async getTriggerText(): Promise<string> {\n return (await this.host()).text();\n }\n\n /**\n * Whether the panel is showing.\n *\n * Two different signals because the two modes advertise different things: a\n * popover flips `aria-expanded` on its trigger, a tooltip has none at all and\n * links its description instead. So a tooltip's answer is only as good as the\n * directive's claim on `aria-describedby` — put the tooltip on a control that\n * is ALSO described by something else (a `<wr-form-field>` hint, say) and the\n * two bindings fight over one attribute.\n */\n async isOpen(): Promise<boolean> {\n const host = await this.host();\n return (await this.getMode()) === 'popover'\n ? (await host.getAttribute('aria-expanded')) === 'true'\n : (await host.getAttribute('aria-describedby')) !== null;\n }\n\n /**\n * Open the panel with the gesture this trigger actually answers to, and wait\n * until it is showing.\n *\n * `trigger` is an input, so the DOM does not say which gesture this popover\n * wants — the harness moves the pointer on first and falls back to a click.\n * Hover leads because a click is an outside pointer event for every OTHER open\n * panel, so leading with it would dismiss someone else's popover on the way to\n * opening this one; a click-driven popover ignores the hover outright. A\n * tooltip is never clicked at all — hover and focus are its only gestures.\n *\n * Throws when nothing appears: a tooltip with an empty string never opens, and\n * a spec on fake timers has to advance the clock itself.\n */\n async open(timeout = DEFAULT_TIMEOUT): Promise<void> {\n if (await this.isOpen()) return;\n\n const host = await this.host();\n await host.hover();\n if ((await this.getMode()) === 'tooltip') return this.waitUntilOpen(timeout);\n\n if (await this.isOpen()) return;\n await host.click();\n return this.waitUntilOpen(timeout);\n }\n\n /**\n * Dismiss the panel and wait until it is gone.\n *\n * Escape, because it is the one gesture both modes honour immediately: a\n * popover is closed by the overlay's keyboard dispatcher, a tooltip by the\n * directive's own binding — no delay in either. To exercise the delayed\n * pointer path instead, call `mouseAway()` and then `waitUntilClosed()`.\n */\n async close(timeout = DEFAULT_TIMEOUT): Promise<void> {\n if (!(await this.isOpen())) return;\n\n await this.sendEscape();\n return this.waitUntilClosed(timeout);\n }\n\n /** Click the trigger. Opens a click-driven popover, toggles it shut again, and does nothing else. */\n async click(): Promise<void> {\n return (await this.host()).click();\n }\n\n /** Move the pointer onto the trigger — opens a hover popover at once, a tooltip after `showDelay`. */\n async hover(): Promise<void> {\n return (await this.host()).hover();\n }\n\n /** Move the pointer off the trigger. The panel goes after the grace period, not instantly. */\n async mouseAway(): Promise<void> {\n return (await this.host()).mouseAway();\n }\n\n /** Focus the trigger — a tooltip's other opening gesture, so keyboard users get the hint too. */\n async focus(): Promise<void> {\n return (await this.host()).focus();\n }\n\n /** Blur the trigger, which hides a tooltip after `hideDelay`. */\n async blur(): Promise<void> {\n return (await this.host()).blur();\n }\n\n /** Press Escape on the trigger. Both modes dismiss on it, and neither moves focus. */\n async sendEscape(): Promise<void> {\n return (await this.host()).sendKeys(TestKey.ESCAPE);\n }\n\n /** Wait out a pending show. Resolves at once when the panel is already up. */\n async waitUntilOpen(timeout = DEFAULT_TIMEOUT): Promise<void> {\n if (await this.settled(true, timeout)) return;\n\n throw new Error(\n `WrPopoverHarness.waitUntilOpen(): nothing opened within ${timeout}ms. A tooltip waits out its ` +\n 'showDelay (and never opens at all for an empty string); this wait uses real time, so a spec on ' +\n 'fake timers has to advance the clock itself and read isOpen().'\n );\n }\n\n /** Wait out a pending hide. Resolves at once when the panel is already gone. */\n async waitUntilClosed(timeout = DEFAULT_TIMEOUT): Promise<void> {\n if (await this.settled(false, timeout)) return;\n\n throw new Error(\n `WrPopoverHarness.waitUntilClosed(): still showing after ${timeout}ms. A hover popover closes 120ms ` +\n 'after the pointer leaves — and only if it left at all, since a mouseleave INTO that panel is ' +\n 'deliberately not a leave. A tooltip closes on its hideDelay after mouseleave or blur.'\n );\n }\n\n /**\n * The panel's text.\n *\n * In tooltip mode that is the string itself, rendered into the small text\n * panel; in popover mode it is everything the projected template renders.\n */\n async getContentText(): Promise<string> {\n return (await this.panel()).text();\n }\n\n /**\n * The role the open panel announces: `'dialog'` for a popover, `'tooltip'` for\n * a tooltip.\n *\n * Worth asserting rather than assuming, twice over: the directive sets it on\n * the OVERLAY PANE, not on the content a consumer wrote, and in tooltip mode\n * the pane is deliberately the only element carrying it — the text panel\n * inside has none, or the description would nest a tooltip in a tooltip.\n */\n async getRole(): Promise<string | null> {\n return (await this.panel()).getAttribute('role');\n }\n\n /**\n * The panel's accessible name — `null` in tooltip mode.\n *\n * A popover is a named `role=\"dialog\"`: the `ariaLabel` input, or the i18n\n * catalog's `popover.label` when the consumer says nothing, because an unnamed\n * dialog announces as \"dialog\" and nothing else. A tooltip has no name of its\n * own; it IS the trigger's description, which is `getDescriptionText()`.\n */\n async getLabel(): Promise<string | null> {\n return (await this.panel()).getAttribute('aria-label');\n }\n\n /**\n * Whether the panel claims modality.\n *\n * `false`, deliberately, and worth pinning: the popover sets\n * `aria-modal=\"false\"` because focus is NOT trapped and the panel dismisses on\n * outside click / Escape rather than blocking the page.\n */\n async isModal(): Promise<boolean> {\n return (await (await this.panel()).getAttribute('aria-modal')) === 'true';\n }\n\n /**\n * Where the panel sits relative to the trigger, or `null` when it is presented\n * as a sheet and has no anchor.\n *\n * The APPLIED position, not the requested one: CDK flips a placement that does\n * not fit to the next in its fallback chain and swaps the modifier class with\n * it. Under a unit test that is always the requested placement — jsdom measures\n * every box as 0×0, so the first candidate always \"fits\" — but in a browser the\n * two can differ, and this answers what is on screen. The directive defaults\n * the request per mode (`bottom` for a popover, `top` for a tooltip).\n *\n * The arrow itself is a `::after` pseudo-element, so it exists for no DOM query\n * at all; this class is the placement, and it is what the arrow's own CSS keys\n * off.\n */\n async getPosition(): Promise<WrPopoverPosition | null> {\n const classes = (await (await this.panel()).getAttribute('class')) ?? '';\n const modifier = /wr-(?:popover|tooltip)-overlay--([a-z-]+)/.exec(classes);\n return modifier ? (modifier[1] as WrPopoverPosition) : null;\n }\n\n /** Whether the popover is presented as a full-width bottom sheet instead of an anchored panel. */\n async isSheet(): Promise<boolean> {\n return (await this.panel()).hasClass('wr-overlay-sheet');\n }\n\n /**\n * The text a screen reader reads as the TRIGGER'S DESCRIPTION, or `null` when\n * it describes nothing.\n *\n * This resolves `aria-describedby` the way an assistive technology would, so\n * it answers the whole of tooltip mode's naming contract in one call. Always\n * `null` for a popover, open or shut — a popover is a thing the trigger owns\n * (`aria-haspopup` / `aria-expanded`), never a description of it.\n */\n async getDescriptionText(): Promise<string | null> {\n const id = await (await this.host()).getAttribute('aria-describedby');\n if (!id) return null;\n\n const described = await this.documentRootLocatorFactory().locatorForOptional(`#${id}`)();\n return described ? described.text() : null;\n }\n\n /**\n * Harnesses for the consumer's own components are resolved inside THIS\n * instance's panel.\n *\n * Scoped by the published id rather than by `.wr-popover-overlay`: the overlay\n * container is shared, so a class query would answer with whichever popover\n * opened first.\n */\n protected override async getRootHarnessLoader(): Promise<HarnessLoader> {\n return this.documentRootLocatorFactory().harnessLoaderFor(`#${await this.panelId()}`);\n }\n\n /** Poll until `isOpen()` reports `open`, and say whether it did. */\n private async settled(open: boolean, timeout: number): Promise<boolean> {\n for (let waited = 0; waited <= timeout; waited += POLL_STEP) {\n if ((await this.isOpen()) === open) return true;\n\n await sleep(POLL_STEP);\n await this.forceStabilize();\n }\n return false;\n }\n\n /** This instance's overlay pane. */\n private async panel(): Promise<TestElement> {\n return this.documentRootLocatorFactory().locatorFor(`#${await this.panelId()}`)();\n }\n\n /** The id the trigger publishes for its panel, which only exists while the panel does. */\n private async panelId(): Promise<string> {\n const attribute = (await this.getMode()) === 'popover' ? 'aria-controls' : 'aria-describedby';\n const id = await (await this.host()).getAttribute(attribute);\n\n if (!id) {\n throw new Error(\n `WrPopoverHarness: nothing is showing. The trigger publishes its panel id as ${attribute} only ` +\n 'while the panel is open — call open() first (a tooltip also has to wait out its showDelay).'\n );\n }\n return id;\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;AAAA;;;;;AAKG;AAcH;AACA,MAAM,eAAe,GAAG,IAAI;AAE5B;AACA,MAAM,SAAS,GAAG,EAAE;AAEpB;;;;;;;;;AASG;AACH,MAAM,cAAc,GAAG,UAAU,CAAC,UAAU;AAE5C,SAAS,KAAK,CAAC,EAAU,EAAA;AACvB,IAAA,OAAO,IAAI,OAAO,CAAC,OAAO,IAAG;AAC3B,QAAA,cAAc,CAAC,OAAO,EAAE,EAAE,CAAC;AAC7B,IAAA,CAAC,CAAC;AACJ;AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqCG;AACG,MAAO,gBAAiB,SAAQ,gCAAgC,CAAA;AACpE;;;;;;;;;AASG;AACH,IAAA,OAAO,YAAY,GAAG,qBAAqB;;AAG3C,IAAA,OAAO,IAAI,CAAC,OAAA,GAAmC,EAAE,EAAA;AAC/C,QA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ACA,QAAA,OAAO,KAAK;IACd;;AAGQ,IAAA,MAAM,KAAK,GAAA;AACjB,QAAA,OAAO,IAAI,CAAC,0BAA0B,EAAE,CAAC,UAAU,CAAC,CAAA,CAAA,EAAI,MAAM,IAAI,CAAC,OAAO,EAAE,CAAA,CAAE,CAAC,EAAE;IACnF;;AAGQ,IAAA,MAAM,OAAO,GAAA;AACnB,QAAA,MAAM,SAAS,GAAG,CAAC,MAAM,IAAI,CAAC,OAAO,EAAE,MAAM,SAAS,GAAG,eAAe,GAAG,kBAAkB;AAC7F,QAAA,MAAM,EAAE,GAAG,MAAM,CAAC,MAAM,IAAI,CAAC,IAAI,EAAE,EAAE,YAAY,CAAC,SAAS,CAAC;QAE5D,IAAI,CAAC,EAAE,EAAE;AACP,YAAA,MAAM,IAAI,KAAK,CACb,CAAA,4EAAA,EAA+E,SAAS,CAAA,MAAA,CAAQ;AAC9F,gBAAA,6FAA6F,CAChG;QACH;AACA,QAAA,OAAO,EAAE;IACX;;;ACxWF;;AAEG;;;;"}
|
|
@@ -15,21 +15,88 @@ import { numAttr } from 'ngwr/utils';
|
|
|
15
15
|
* Use of this source code is governed by an MIT-style license that can be
|
|
16
16
|
* found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE
|
|
17
17
|
*/
|
|
18
|
-
/**
|
|
18
|
+
/**
|
|
19
|
+
* The CDK geometry for each placement — one position, no fallbacks.
|
|
20
|
+
*
|
|
21
|
+
* The 8px offset is the gap between the trigger and the panel, and it is the
|
|
22
|
+
* reason a flip list matters rather than being a nicety: the flexible strategy
|
|
23
|
+
* emits `offsetX` as a `transform` on the pane, AFTER `withPush` has already
|
|
24
|
+
* decided the coordinate. Push therefore parks a right-anchored panel flush
|
|
25
|
+
* against the viewport edge and the offset then shoves it 8px back out, so a
|
|
26
|
+
* side placement that does not fit loses its border and corner off-screen no
|
|
27
|
+
* matter how hard push works. Flipping to a placement that fits is the only
|
|
28
|
+
* recovery, which is what `WR_POPOVER_FALLBACKS` is for.
|
|
29
|
+
*
|
|
30
|
+
* @internal
|
|
31
|
+
*/
|
|
19
32
|
const WR_POPOVER_POSITIONS = {
|
|
20
|
-
top:
|
|
21
|
-
'top-start':
|
|
22
|
-
'top-end':
|
|
23
|
-
bottom:
|
|
24
|
-
'bottom-start':
|
|
25
|
-
'bottom-end':
|
|
26
|
-
left:
|
|
27
|
-
'left-start':
|
|
28
|
-
'left-end':
|
|
29
|
-
right:
|
|
30
|
-
'right-start':
|
|
31
|
-
'right-end':
|
|
33
|
+
top: { originX: 'center', originY: 'top', overlayX: 'center', overlayY: 'bottom', offsetY: -8 },
|
|
34
|
+
'top-start': { originX: 'start', originY: 'top', overlayX: 'start', overlayY: 'bottom', offsetY: -8 },
|
|
35
|
+
'top-end': { originX: 'end', originY: 'top', overlayX: 'end', overlayY: 'bottom', offsetY: -8 },
|
|
36
|
+
bottom: { originX: 'center', originY: 'bottom', overlayX: 'center', overlayY: 'top', offsetY: 8 },
|
|
37
|
+
'bottom-start': { originX: 'start', originY: 'bottom', overlayX: 'start', overlayY: 'top', offsetY: 8 },
|
|
38
|
+
'bottom-end': { originX: 'end', originY: 'bottom', overlayX: 'end', overlayY: 'top', offsetY: 8 },
|
|
39
|
+
left: { originX: 'start', originY: 'center', overlayX: 'end', overlayY: 'center', offsetX: -8 },
|
|
40
|
+
'left-start': { originX: 'start', originY: 'top', overlayX: 'end', overlayY: 'top', offsetX: -8 },
|
|
41
|
+
'left-end': { originX: 'start', originY: 'bottom', overlayX: 'end', overlayY: 'bottom', offsetX: -8 },
|
|
42
|
+
right: { originX: 'end', originY: 'center', overlayX: 'start', overlayY: 'center', offsetX: 8 },
|
|
43
|
+
'right-start': { originX: 'end', originY: 'top', overlayX: 'start', overlayY: 'top', offsetX: 8 },
|
|
44
|
+
'right-end': { originX: 'end', originY: 'bottom', overlayX: 'start', overlayY: 'bottom', offsetX: 8 },
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* What each placement is allowed to flip to when it does not fit, best first.
|
|
48
|
+
* The requested placement always leads, so a panel that fits never moves.
|
|
49
|
+
*
|
|
50
|
+
* Alignment is preserved down the whole chain — a `-start` popover stays
|
|
51
|
+
* `-start` — because the alignment is the author's answer to "which end of the
|
|
52
|
+
* trigger does this belong to", and a flip is about the side, not about that.
|
|
53
|
+
*
|
|
54
|
+
* The two axes are deliberately NOT symmetric. A block-axis placement (`top*` /
|
|
55
|
+
* `bottom*`) flips only to its opposite, the classic behaviour, so a dropdown-ish
|
|
56
|
+
* panel can never surprise anyone by appearing beside its trigger. An inline-axis
|
|
57
|
+
* one (`left*` / `right*`) also gets the two block-axis sides, because on a phone
|
|
58
|
+
* NEITHER side fits: at 375px a 233px panel beside a mid-page trigger overflows
|
|
59
|
+
* by 109px to the right and 97px to the left, and only below/above has room.
|
|
60
|
+
*
|
|
61
|
+
* @internal
|
|
62
|
+
*/
|
|
63
|
+
const WR_POPOVER_FALLBACKS = {
|
|
64
|
+
top: ['top', 'bottom'],
|
|
65
|
+
'top-start': ['top-start', 'bottom-start'],
|
|
66
|
+
'top-end': ['top-end', 'bottom-end'],
|
|
67
|
+
bottom: ['bottom', 'top'],
|
|
68
|
+
'bottom-start': ['bottom-start', 'top-start'],
|
|
69
|
+
'bottom-end': ['bottom-end', 'top-end'],
|
|
70
|
+
left: ['left', 'right', 'bottom', 'top'],
|
|
71
|
+
'left-start': ['left-start', 'right-start', 'bottom-start', 'top-start'],
|
|
72
|
+
'left-end': ['left-end', 'right-end', 'bottom-end', 'top-end'],
|
|
73
|
+
right: ['right', 'left', 'bottom', 'top'],
|
|
74
|
+
'right-start': ['right-start', 'left-start', 'bottom-start', 'top-start'],
|
|
75
|
+
'right-end': ['right-end', 'left-end', 'bottom-end', 'top-end'],
|
|
32
76
|
};
|
|
77
|
+
/**
|
|
78
|
+
* The list `withPositions()` wants, with every link tagged so the pane names the
|
|
79
|
+
* placement it ACTUALLY took rather than the one that was asked for.
|
|
80
|
+
*
|
|
81
|
+
* The tag is what keeps the arrow honest. It is drawn by
|
|
82
|
+
* `.wr-popover-overlay--<placement> > *::after`, so a panel that flipped while
|
|
83
|
+
* the class stayed put would point at a side it no longer sits on. CDK applies a
|
|
84
|
+
* position's own `panelClass` in `_applyPosition` and clears it again on the next
|
|
85
|
+
* one, which is exactly the bookkeeping this needs — hence the class rather than
|
|
86
|
+
* a `positionChanges` subscription.
|
|
87
|
+
*
|
|
88
|
+
* @param paneClass The pane's base class: `wr-popover-overlay` or
|
|
89
|
+
* `wr-tooltip-overlay`. The two modes key their arrows off different
|
|
90
|
+
* selectors, so the prefix cannot live in the table.
|
|
91
|
+
*
|
|
92
|
+
* @internal
|
|
93
|
+
*/
|
|
94
|
+
function wrPopoverPositions(position, paneClass) {
|
|
95
|
+
return WR_POPOVER_FALLBACKS[position].map(name => ({
|
|
96
|
+
...WR_POPOVER_POSITIONS[name],
|
|
97
|
+
panelClass: `${paneClass}--${name}`,
|
|
98
|
+
}));
|
|
99
|
+
}
|
|
33
100
|
|
|
34
101
|
/**
|
|
35
102
|
* @license
|
|
@@ -47,10 +114,10 @@ const WR_POPOVER_POSITIONS = {
|
|
|
47
114
|
class WrPopoverTextPanel {
|
|
48
115
|
text = input.required(/* @ts-ignore */
|
|
49
116
|
...(ngDevMode ? [{ debugName: "text" }] : /* istanbul ignore next */ []));
|
|
50
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.
|
|
51
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.1.
|
|
117
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: WrPopoverTextPanel, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
118
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.1.4", type: WrPopoverTextPanel, isStandalone: true, selector: "wr-popover-text", inputs: { text: { classPropertyName: "text", publicName: "text", isSignal: true, isRequired: true, transformFunction: null } }, host: { classAttribute: "wr-tooltip" }, ngImport: i0, template: '{{ text() }}', isInline: true, encapsulation: i0.ViewEncapsulation.None });
|
|
52
119
|
}
|
|
53
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.
|
|
120
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: WrPopoverTextPanel, decorators: [{
|
|
54
121
|
type: Component,
|
|
55
122
|
args: [{
|
|
56
123
|
selector: 'wr-popover-text',
|
|
@@ -169,6 +236,7 @@ class WrPopover {
|
|
|
169
236
|
resolvedPosition = computed(() => this.position() ?? (this.isTooltip() ? 'top' : 'bottom'), /* @ts-ignore */
|
|
170
237
|
...(ngDevMode ? [{ debugName: "resolvedPosition" }] : /* istanbul ignore next */ []));
|
|
171
238
|
overlayRef = null;
|
|
239
|
+
textPanelRef = null;
|
|
172
240
|
hoverCloseTimer = null;
|
|
173
241
|
showTimer = null;
|
|
174
242
|
hideTimer = null;
|
|
@@ -181,6 +249,16 @@ class WrPopover {
|
|
|
181
249
|
this.closeOverlay();
|
|
182
250
|
}
|
|
183
251
|
});
|
|
252
|
+
// The tooltip string is pushed into the panel when the panel is created, and
|
|
253
|
+
// `openOverlay()` returns early while one is already up — so a `content()`
|
|
254
|
+
// change with the tooltip on screen never reached it and the label stayed on
|
|
255
|
+
// the string it opened with (hover a Copy button, click it, it still reads
|
|
256
|
+
// "Copy"). Keeping the ref and pushing from an effect is how `wr-date-picker`
|
|
257
|
+
// feeds its own panel refs.
|
|
258
|
+
effect(() => {
|
|
259
|
+
const content = this.content();
|
|
260
|
+
this.textPanelRef?.setInput('text', typeof content === 'string' ? content : '');
|
|
261
|
+
});
|
|
184
262
|
this.destroyRef.onDestroy(() => {
|
|
185
263
|
this.clearTimers();
|
|
186
264
|
this.closeOverlay();
|
|
@@ -216,13 +294,19 @@ class WrPopover {
|
|
|
216
294
|
}
|
|
217
295
|
/** @internal */
|
|
218
296
|
onMouseLeave(event) {
|
|
297
|
+
const related = event.relatedTarget;
|
|
219
298
|
if (this.isTooltip()) {
|
|
299
|
+
// Crossing straight from the trigger onto the panel does not even arm the
|
|
300
|
+
// hide, the same bail-out the popover arm below has had. The panel's own
|
|
301
|
+
// `mouseenter` would cancel it a moment later anyway; not arming it is
|
|
302
|
+
// what removes the race.
|
|
303
|
+
if (related && this.overlayRef?.overlayElement.contains(related))
|
|
304
|
+
return;
|
|
220
305
|
this.scheduleHide();
|
|
221
306
|
return;
|
|
222
307
|
}
|
|
223
308
|
if (this.trigger() !== 'hover')
|
|
224
309
|
return;
|
|
225
|
-
const related = event.relatedTarget;
|
|
226
310
|
if (related && this.overlayRef?.overlayElement.contains(related))
|
|
227
311
|
return;
|
|
228
312
|
// Delay so the pointer can cross the gap between trigger and panel —
|
|
@@ -284,18 +368,19 @@ class WrPopover {
|
|
|
284
368
|
// never dock to the bottom. On small viewports (when opted in) detach
|
|
285
369
|
// from the trigger and slide the panel up from the bottom edge.
|
|
286
370
|
const asSheet = !tooltip && wrPresentAsSheet(this.responsive(), this.responsiveConfig);
|
|
371
|
+
const paneClass = tooltip ? 'wr-tooltip-overlay' : 'wr-popover-overlay';
|
|
287
372
|
const positionStrategy = asSheet
|
|
288
373
|
? this.overlay.position().global().centerHorizontally().bottom('0')
|
|
289
374
|
: this.overlay
|
|
290
375
|
.position()
|
|
291
376
|
.flexibleConnectedTo(this.host)
|
|
292
|
-
.withPositions(wrMirrorOffsets(
|
|
377
|
+
.withPositions(wrMirrorOffsets(wrPopoverPositions(position, paneClass), this.isRtl()))
|
|
293
378
|
.withPush(true);
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
379
|
+
// The `--<placement>` half is no longer set here: each fallback position
|
|
380
|
+
// carries its own, so the pane names the placement it landed on instead of
|
|
381
|
+
// the one that was requested, and the arrow follows a flip. A sheet has no
|
|
382
|
+
// anchor and so no placement class at all.
|
|
383
|
+
const overlayClass = asSheet ? [paneClass, 'wr-overlay-sheet'] : [paneClass];
|
|
299
384
|
this.overlayRef = this.overlay.create({
|
|
300
385
|
positionStrategy,
|
|
301
386
|
scrollStrategy: asSheet ? this.scrollStrategies.block() : this.scrollStrategies.reposition(),
|
|
@@ -317,6 +402,7 @@ class WrPopover {
|
|
|
317
402
|
const text = typeof content === 'string' ? content : '';
|
|
318
403
|
const ref = this.overlayRef.attach(new ComponentPortal(WrPopoverTextPanel, this.vcr));
|
|
319
404
|
ref.setInput('text', text);
|
|
405
|
+
this.textPanelRef = ref;
|
|
320
406
|
// The pane is the element `aria-describedby` points at (it carries
|
|
321
407
|
// `panelId`), so this is the role that has to be `tooltip` — the inner
|
|
322
408
|
// `wr-popover-text` host deliberately carries none, or the description
|
|
@@ -324,16 +410,37 @@ class WrPopover {
|
|
|
324
410
|
this.overlayRef.overlayElement.setAttribute('role', 'tooltip');
|
|
325
411
|
}
|
|
326
412
|
else if (typeof content !== 'string') {
|
|
327
|
-
this.overlayRef.attach(new TemplatePortal(content, this.vcr));
|
|
413
|
+
const view = this.overlayRef.attach(new TemplatePortal(content, this.vcr));
|
|
414
|
+
const pane = this.overlayRef.overlayElement;
|
|
328
415
|
// Popover mode is a non-modal dialog: the docstring promised dialog
|
|
329
416
|
// semantics but nothing ever set a role, so a screen reader met an
|
|
330
417
|
// unnamed generic container. `aria-modal="false"` is explicit — focus is
|
|
331
418
|
// deliberately NOT trapped, the panel closes on outside click / Escape.
|
|
332
|
-
|
|
333
|
-
|
|
419
|
+
pane.setAttribute('role', 'dialog');
|
|
420
|
+
pane.setAttribute('aria-modal', 'false');
|
|
334
421
|
// A named dialog: `role="dialog"` with no name announces as a bare
|
|
335
422
|
// "dialog" and trips axe's `aria-dialog-name`.
|
|
336
|
-
|
|
423
|
+
pane.setAttribute('aria-label', this.resolvedAriaLabel());
|
|
424
|
+
if (this.trigger() === 'click') {
|
|
425
|
+
// Render the projected content before focus moves, the way
|
|
426
|
+
// `wr-popconfirm` does — a reader announcing the dialog reads what is in
|
|
427
|
+
// it, and on an empty pane that is nothing.
|
|
428
|
+
view.detectChanges();
|
|
429
|
+
// Focus has to ENTER the panel. The overlay container sits at the end of
|
|
430
|
+
// `<body>`, so Tab from the trigger went to the next control on the page
|
|
431
|
+
// and left the dialog stranded behind it (WCAG F85). The pane takes it
|
|
432
|
+
// rather than the first control inside: a popover's content is
|
|
433
|
+
// arbitrary, and landing on a text field would raise the on-screen
|
|
434
|
+
// keyboard and skip whatever the panel says above it. Tab from the pane
|
|
435
|
+
// reaches that first control anyway, since the pane precedes its own
|
|
436
|
+
// content in document order.
|
|
437
|
+
//
|
|
438
|
+
// Click-triggered only — a hover popover must not pull the caret out of
|
|
439
|
+
// what the user is typing in, and `scheduleHoverClose()` would then
|
|
440
|
+
// dispose the pane out from under the focused element.
|
|
441
|
+
pane.tabIndex = -1;
|
|
442
|
+
pane.focus();
|
|
443
|
+
}
|
|
337
444
|
}
|
|
338
445
|
this.overlayRef.overlayElement.id = this.panelId;
|
|
339
446
|
this.outsideClick
|
|
@@ -353,7 +460,10 @@ class WrPopover {
|
|
|
353
460
|
this.isOpen.set(false);
|
|
354
461
|
}
|
|
355
462
|
});
|
|
356
|
-
|
|
463
|
+
// Both hover shapes keep the panel up while the pointer is on it: for a
|
|
464
|
+
// popover so the pointer can cross the gap, for a tooltip because WCAG
|
|
465
|
+
// 1.4.13 requires it (Hoverable).
|
|
466
|
+
if (tooltip || this.trigger() === 'hover') {
|
|
357
467
|
this.overlayRef.overlayElement.addEventListener('mouseenter', this.onOverlayEnter);
|
|
358
468
|
this.overlayRef.overlayElement.addEventListener('mouseleave', this.onOverlayLeave);
|
|
359
469
|
}
|
|
@@ -362,7 +472,7 @@ class WrPopover {
|
|
|
362
472
|
closeOverlay() {
|
|
363
473
|
if (!this.overlayRef)
|
|
364
474
|
return;
|
|
365
|
-
if (
|
|
475
|
+
if (this.isTooltip() || this.trigger() === 'hover') {
|
|
366
476
|
this.overlayRef.overlayElement.removeEventListener('mouseenter', this.onOverlayEnter);
|
|
367
477
|
this.overlayRef.overlayElement.removeEventListener('mouseleave', this.onOverlayLeave);
|
|
368
478
|
}
|
|
@@ -381,6 +491,8 @@ class WrPopover {
|
|
|
381
491
|
const focusWasInside = pane.contains(this.host.nativeElement.ownerDocument.activeElement);
|
|
382
492
|
this.overlayRef.dispose();
|
|
383
493
|
this.overlayRef = null;
|
|
494
|
+
// Disposing destroys the panel component; a retained ref would pin its view.
|
|
495
|
+
this.textPanelRef = null;
|
|
384
496
|
if (focusWasInside)
|
|
385
497
|
this.host.nativeElement.focus();
|
|
386
498
|
this.closed.emit();
|
|
@@ -389,9 +501,19 @@ class WrPopover {
|
|
|
389
501
|
const related = event.relatedTarget;
|
|
390
502
|
if (related && this.host.nativeElement.contains(related))
|
|
391
503
|
return;
|
|
392
|
-
|
|
504
|
+
// A tooltip leaves on its own `hideDelay`, the same one the trigger uses; a
|
|
505
|
+
// hover popover has the longer grace period for crossing the gap back.
|
|
506
|
+
if (this.isTooltip())
|
|
507
|
+
this.scheduleHide();
|
|
508
|
+
else
|
|
509
|
+
this.scheduleHoverClose();
|
|
393
510
|
};
|
|
394
511
|
onOverlayEnter = () => {
|
|
512
|
+
// Two different timers can be in flight: `hideTimer`, armed by the trigger's
|
|
513
|
+
// own `mouseleave` in tooltip mode, and `hoverCloseTimer` in popover mode.
|
|
514
|
+
// Cancelling only the second would leave a tooltip disappearing `hideDelay`
|
|
515
|
+
// after the pointer arrived on it.
|
|
516
|
+
this.clearTimers();
|
|
395
517
|
this.clearHoverClose();
|
|
396
518
|
};
|
|
397
519
|
scheduleHoverClose() {
|
|
@@ -414,10 +536,10 @@ class WrPopover {
|
|
|
414
536
|
isRtl() {
|
|
415
537
|
return this.dir?.value === 'rtl';
|
|
416
538
|
}
|
|
417
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.
|
|
418
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.1.
|
|
539
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: WrPopover, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
540
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.1.4", type: WrPopover, isStandalone: true, selector: "[wrPopover]", inputs: { content: { classPropertyName: "content", publicName: "wrPopover", isSignal: true, isRequired: true, transformFunction: null }, mode: { classPropertyName: "mode", publicName: "mode", isSignal: true, isRequired: false, transformFunction: null }, trigger: { classPropertyName: "trigger", publicName: "trigger", isSignal: true, isRequired: false, transformFunction: null }, position: { classPropertyName: "position", publicName: "position", isSignal: true, isRequired: false, transformFunction: null }, showDelay: { classPropertyName: "showDelay", publicName: "showDelay", isSignal: true, isRequired: false, transformFunction: null }, hideDelay: { classPropertyName: "hideDelay", publicName: "hideDelay", isSignal: true, isRequired: false, transformFunction: null }, responsive: { classPropertyName: "responsive", publicName: "responsive", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { opened: "opened", closed: "closed" }, host: { listeners: { "click": "onClick($event)", "mouseenter": "onMouseEnter()", "mouseleave": "onMouseLeave($event)", "focus": "onFocus()", "blur": "onBlur()", "keydown.escape": "onEscape()" }, properties: { "attr.aria-haspopup": "isTooltip() ? null : \"dialog\"", "attr.aria-expanded": "isTooltip() ? null : isOpen()", "attr.aria-controls": "!isTooltip() && isOpen() ? panelId : null", "attr.aria-describedby": "isTooltip() && isOpen() ? panelId : null" }, classAttribute: "wr-popover-trigger" }, ngImport: i0 });
|
|
419
541
|
}
|
|
420
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.
|
|
542
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: WrPopover, decorators: [{
|
|
421
543
|
type: Directive,
|
|
422
544
|
args: [{
|
|
423
545
|
selector: '[wrPopover]',
|