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
|
@@ -104,9 +104,34 @@ class WrSplitText {
|
|
|
104
104
|
isBrowser = isPlatformBrowser(inject(PLATFORM_ID));
|
|
105
105
|
platform = inject(WrPlatform);
|
|
106
106
|
hasAnimated = false;
|
|
107
|
+
/**
|
|
108
|
+
* The ONE observer, replaced rather than stacked.
|
|
109
|
+
*
|
|
110
|
+
* `startObserver()` used to `new IntersectionObserver(…)` and register its own
|
|
111
|
+
* `destroyRef.onDestroy` every time, and the effect below calls it on every
|
|
112
|
+
* `text` change after setting `hasAnimated = false` — so the guard at the top
|
|
113
|
+
* of `startObserver` never blocked that path. An off-screen element (the only
|
|
114
|
+
* case where the observer does not immediately disconnect itself) therefore
|
|
115
|
+
* leaked one live observer AND one destroy callback per change, all of them
|
|
116
|
+
* watching the same host and all of them able to fire `animate()`.
|
|
117
|
+
*/
|
|
118
|
+
observer = null;
|
|
119
|
+
/**
|
|
120
|
+
* `startObserver()` builds its observer inside a `document.fonts.ready`
|
|
121
|
+
* continuation, so the component can be destroyed while it is awaiting. At
|
|
122
|
+
* that moment `observer` is still null, so the destroy hook below disconnects
|
|
123
|
+
* nothing — and the continuation then starts an observer on a host Angular
|
|
124
|
+
* has already detached, which nothing is left to disconnect. Same hazard, and
|
|
125
|
+
* same flag, as `wr-fuzzy-text`.
|
|
126
|
+
*/
|
|
127
|
+
destroyed = false;
|
|
107
128
|
constructor() {
|
|
108
129
|
if (!this.isBrowser)
|
|
109
130
|
return;
|
|
131
|
+
this.destroyRef.onDestroy(() => {
|
|
132
|
+
this.destroyed = true;
|
|
133
|
+
this.observer?.disconnect();
|
|
134
|
+
});
|
|
110
135
|
afterNextRender(() => this.startObserver());
|
|
111
136
|
// Re-run animation if `text` (and therefore the split pieces) changes.
|
|
112
137
|
effect(() => {
|
|
@@ -121,8 +146,9 @@ class WrSplitText {
|
|
|
121
146
|
const fonts = document.fonts;
|
|
122
147
|
const ready = fonts?.status === 'loaded' ? Promise.resolve() : (fonts?.ready ?? Promise.resolve());
|
|
123
148
|
const observe = () => {
|
|
124
|
-
if (this.hasAnimated)
|
|
149
|
+
if (this.destroyed || this.hasAnimated)
|
|
125
150
|
return;
|
|
151
|
+
this.observer?.disconnect();
|
|
126
152
|
const io = new IntersectionObserver((entries, obs) => {
|
|
127
153
|
for (const e of entries) {
|
|
128
154
|
if (e.isIntersecting) {
|
|
@@ -132,8 +158,8 @@ class WrSplitText {
|
|
|
132
158
|
}
|
|
133
159
|
}
|
|
134
160
|
}, { threshold: this.threshold(), rootMargin: this.rootMargin() });
|
|
161
|
+
this.observer = io;
|
|
135
162
|
io.observe(host);
|
|
136
|
-
this.destroyRef.onDestroy(() => io.disconnect());
|
|
137
163
|
};
|
|
138
164
|
void ready.then(observe);
|
|
139
165
|
}
|
|
@@ -184,10 +210,10 @@ class WrSplitText {
|
|
|
184
210
|
};
|
|
185
211
|
});
|
|
186
212
|
}
|
|
187
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.
|
|
188
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.
|
|
213
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.2", ngImport: i0, type: WrSplitText, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
214
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.2", type: WrSplitText, isStandalone: true, selector: "wr-split-text", inputs: { text: { classPropertyName: "text", publicName: "text", isSignal: true, isRequired: true, transformFunction: null }, splitType: { classPropertyName: "splitType", publicName: "splitType", isSignal: true, isRequired: false, transformFunction: null }, delay: { classPropertyName: "delay", publicName: "delay", isSignal: true, isRequired: false, transformFunction: null }, duration: { classPropertyName: "duration", publicName: "duration", isSignal: true, isRequired: false, transformFunction: null }, easing: { classPropertyName: "easing", publicName: "easing", isSignal: true, isRequired: false, transformFunction: null }, from: { classPropertyName: "from", publicName: "from", isSignal: true, isRequired: false, transformFunction: null }, to: { classPropertyName: "to", publicName: "to", isSignal: true, isRequired: false, transformFunction: null }, threshold: { classPropertyName: "threshold", publicName: "threshold", isSignal: true, isRequired: false, transformFunction: null }, rootMargin: { classPropertyName: "rootMargin", publicName: "rootMargin", isSignal: true, isRequired: false, transformFunction: null }, textAlign: { classPropertyName: "textAlign", publicName: "textAlign", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { animationComplete: "animationComplete" }, host: { properties: { "style.text-align": "textAlign()" }, classAttribute: "wr-split-text" }, ngImport: i0, template: "<!-- The readable text, once: the pieces below are per-character spans. -->\n<span class=\"wr-split-text__sr-only\">{{ text() }}</span>\n@for (p of pieces(); track $index) {\n @if (p.kind === 'piece') {\n <span class=\"wr-split-text__piece\" aria-hidden=\"true\">{{ p.text }}</span>\n } @else {\n <span class=\"wr-split-text__space\" aria-hidden=\"true\">{{ p.text }}</span>\n }\n}\n", styles: [".wr-split-text{display:inline-block;overflow:hidden;padding-bottom:.15em;margin-bottom:-.15em;white-space:normal;overflow-wrap:break-word;will-change:transform,opacity}.wr-split-text__sr-only{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);clip-path:inset(50%);white-space:nowrap}.wr-split-text__piece{display:inline-block;will-change:transform,opacity}.wr-split-text__space{display:inline;white-space:pre}\n"], encapsulation: i0.ViewEncapsulation.None });
|
|
189
215
|
}
|
|
190
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.
|
|
216
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.2", ngImport: i0, type: WrSplitText, decorators: [{
|
|
191
217
|
type: Component,
|
|
192
218
|
args: [{ selector: 'wr-split-text', encapsulation: ViewEncapsulation.None, host: { class: 'wr-split-text', '[style.text-align]': 'textAlign()' }, template: "<!-- The readable text, once: the pieces below are per-character spans. -->\n<span class=\"wr-split-text__sr-only\">{{ text() }}</span>\n@for (p of pieces(); track $index) {\n @if (p.kind === 'piece') {\n <span class=\"wr-split-text__piece\" aria-hidden=\"true\">{{ p.text }}</span>\n } @else {\n <span class=\"wr-split-text__space\" aria-hidden=\"true\">{{ p.text }}</span>\n }\n}\n", styles: [".wr-split-text{display:inline-block;overflow:hidden;padding-bottom:.15em;margin-bottom:-.15em;white-space:normal;overflow-wrap:break-word;will-change:transform,opacity}.wr-split-text__sr-only{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);clip-path:inset(50%);white-space:nowrap}.wr-split-text__piece{display:inline-block;will-change:transform,opacity}.wr-split-text__space{display:inline;white-space:pre}\n"] }]
|
|
193
219
|
}], ctorParameters: () => [], propDecorators: { text: [{ type: i0.Input, args: [{ isSignal: true, alias: "text", required: true }] }], splitType: [{ type: i0.Input, args: [{ isSignal: true, alias: "splitType", required: false }] }], delay: [{ type: i0.Input, args: [{ isSignal: true, alias: "delay", required: false }] }], duration: [{ type: i0.Input, args: [{ isSignal: true, alias: "duration", required: false }] }], easing: [{ type: i0.Input, args: [{ isSignal: true, alias: "easing", required: false }] }], from: [{ type: i0.Input, args: [{ isSignal: true, alias: "from", required: false }] }], to: [{ type: i0.Input, args: [{ isSignal: true, alias: "to", required: false }] }], threshold: [{ type: i0.Input, args: [{ isSignal: true, alias: "threshold", required: false }] }], rootMargin: [{ type: i0.Input, args: [{ isSignal: true, alias: "rootMargin", required: false }] }], textAlign: [{ type: i0.Input, args: [{ isSignal: true, alias: "textAlign", required: false }] }], animationComplete: [{ type: i0.Output, args: ["animationComplete"] }] } });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ngwr-split-text.mjs","sources":["../../../projects/lib/split-text/split-text.ts","../../../projects/lib/split-text/split-text.html","../../../projects/lib/split-text/ngwr-split-text.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 * Angular adaptation of the SplitText effect by David Haz / reactbits.dev.\n * Original: https://www.reactbits.dev/text-animations/split-text\n *\n * The reactbits version uses GSAP's paid `SplitText` plugin. This port is\n * GSAP-free — splits via plain DOM spans, animates via the Web Animations\n * API, triggers on viewport entry via `IntersectionObserver`.\n */\n\nimport { isPlatformBrowser } from '@angular/common';\nimport {\n Component,\n DestroyRef,\n ElementRef,\n PLATFORM_ID,\n ViewEncapsulation,\n afterNextRender,\n computed,\n effect,\n inject,\n input,\n output,\n} from '@angular/core';\n\nimport { WrPlatform } from 'ngwr/platform';\nimport { numAttr } from 'ngwr/utils';\n\nimport type { WrSplitTextUnit, WrSplitTextMotion } from './interfaces';\n\ntype Piece = { readonly kind: 'piece'; readonly text: string } | { readonly kind: 'space'; readonly text: string };\n\n/** Split `text` into render pieces, preserving whitespace as `kind: 'space'`. */\nfunction splitPieces(text: string, unit: WrSplitTextUnit): readonly Piece[] {\n if (!text) return [];\n if (unit === 'words') {\n // Split on whitespace, keeping spaces as separate pieces.\n return text.split(/(\\s+)/).flatMap<Piece>(seg => {\n if (seg.length === 0) return [];\n if (/^\\s+$/.test(seg)) return [{ kind: 'space', text: seg } as const];\n return [{ kind: 'piece', text: seg } as const];\n });\n }\n // chars: each character is its own piece; whitespace becomes 'space'.\n return [...text].map<Piece>(ch => (/\\s/.test(ch) ? { kind: 'space', text: ch } : { kind: 'piece', text: ch }));\n}\n\nfunction motionToStyle(m: WrSplitTextMotion): { opacity: number; transform: string } {\n const opacity = m.opacity ?? 1;\n const parts: string[] = [];\n if (m.x !== undefined || m.y !== undefined) {\n parts.push(`translate3d(${m.x ?? 0}px, ${m.y ?? 0}px, 0)`);\n }\n if (m.scale !== undefined) parts.push(`scale(${m.scale})`);\n if (m.rotate !== undefined) parts.push(`rotate(${m.rotate}deg)`);\n return { opacity, transform: parts.length ? parts.join(' ') : 'none' };\n}\n\n/**\n * Animated text reveal — splits the input string into chars or words and\n * staggers each piece in from a `from` motion state to a `to` motion\n * state when the host scrolls into view. Whitespace is preserved.\n *\n * @example\n * ```html\n * <wr-split-text\n * text=\"Hello, ngwr!\"\n * splitType=\"chars\"\n * [delay]=\"40\"\n * [duration]=\"1.2\"\n * [from]=\"{ opacity: 0, y: 40 }\"\n * [to]=\"{ opacity: 1, y: 0 }\"\n * (animationComplete)=\"onDone()\"\n * />\n * ```\n *\n * @see https://www.reactbits.dev/text-animations/split-text\n */\n@Component({\n selector: 'wr-split-text',\n templateUrl: './split-text.html',\n styleUrl: './split-text.scss',\n encapsulation: ViewEncapsulation.None,\n host: { class: 'wr-split-text', '[style.text-align]': 'textAlign()' },\n})\nexport class WrSplitText {\n /** Text to animate. Required. */\n readonly text = input.required<string>();\n\n /** Split granularity. @default 'chars' */\n readonly splitType = input<WrSplitTextUnit>('chars');\n\n /** Stagger delay between pieces in ms. @default 50 */\n readonly delay = input(50, { transform: numAttr(50) });\n\n /** Animation duration in seconds (matches reactbits' API). @default 1.25 */\n readonly duration = input(1.25, { transform: numAttr(1.25) });\n\n /** CSS easing function. @default 'cubic-bezier(0.16, 1, 0.3, 1)' (~power3.out) */\n readonly easing = input('cubic-bezier(0.16, 1, 0.3, 1)');\n\n /** Start state for each piece. @default { opacity: 0, y: 40 } */\n readonly from = input<WrSplitTextMotion>({ opacity: 0, y: 40 });\n\n /** End state for each piece. @default { opacity: 1, y: 0 } */\n readonly to = input<WrSplitTextMotion>({ opacity: 1, y: 0 });\n\n /** `IntersectionObserver.threshold` — 0..1. @default 0.1 */\n readonly threshold = input(0.1, { transform: numAttr(0.1) });\n\n /** `IntersectionObserver.rootMargin`. @default '-100px' */\n readonly rootMargin = input('-100px');\n\n /** Text alignment of the host. @default 'center' */\n readonly textAlign = input<'left' | 'center' | 'right' | 'justify'>('center');\n\n /** Emitted once all pieces finish animating. */\n readonly animationComplete = output<void>();\n\n /** Pieces to render. Each piece is `{ kind: 'piece', text }` or `{ kind: 'space' }`. */\n protected readonly pieces = computed(() => splitPieces(this.text(), this.splitType()));\n\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\n private readonly destroyRef = inject(DestroyRef);\n private readonly isBrowser = isPlatformBrowser(inject(PLATFORM_ID));\n private readonly platform = inject(WrPlatform);\n\n private hasAnimated = false;\n\n constructor() {\n if (!this.isBrowser) return;\n\n afterNextRender(() => this.startObserver());\n\n // Re-run animation if `text` (and therefore the split pieces) changes.\n effect(() => {\n this.text();\n this.splitType();\n this.hasAnimated = false;\n queueMicrotask(() => this.startObserver());\n });\n }\n\n private startObserver(): void {\n const host = this.host.nativeElement;\n const fonts = (document as Document & { fonts?: FontFaceSet }).fonts;\n const ready = fonts?.status === 'loaded' ? Promise.resolve() : (fonts?.ready ?? Promise.resolve());\n\n const observe = (): void => {\n if (this.hasAnimated) return;\n const io = new IntersectionObserver(\n (entries, obs) => {\n for (const e of entries) {\n if (e.isIntersecting) {\n obs.disconnect();\n this.animate();\n break;\n }\n }\n },\n { threshold: this.threshold(), rootMargin: this.rootMargin() }\n );\n io.observe(host);\n this.destroyRef.onDestroy(() => io.disconnect());\n };\n\n void ready.then(observe);\n }\n\n private animate(): void {\n if (this.hasAnimated) return;\n this.hasAnimated = true;\n\n // Reduced motion: pieces already render at their natural (final)\n // state — skip the tween and report completion right away.\n if (this.platform.prefersReducedMotion()) {\n this.animationComplete.emit();\n return;\n }\n\n const host = this.host.nativeElement;\n const targets = host.querySelectorAll<HTMLElement>('.wr-split-text__piece');\n if (targets.length === 0) {\n this.animationComplete.emit();\n return;\n }\n\n const fromStyle = motionToStyle(this.from());\n const toStyle = motionToStyle(this.to());\n const durationMs = this.duration() * 1000;\n const stagger = this.delay();\n const easing = this.easing();\n\n let remaining = targets.length;\n targets.forEach((el, i) => {\n // Set initial state immediately so there's no flash of final state\n // before the animation kicks in.\n el.style.opacity = String(fromStyle.opacity);\n el.style.transform = fromStyle.transform;\n const animation = el.animate(\n [\n { opacity: fromStyle.opacity, transform: fromStyle.transform },\n { opacity: toStyle.opacity, transform: toStyle.transform },\n ],\n { duration: durationMs, delay: i * stagger, easing, fill: 'forwards' }\n );\n animation.onfinish = (): void => {\n // Commit final styles + clean up the WAAPI tween.\n el.style.opacity = String(toStyle.opacity);\n el.style.transform = toStyle.transform;\n try {\n animation.cancel();\n } catch {\n /* noop */\n }\n remaining -= 1;\n if (remaining === 0) this.animationComplete.emit();\n };\n });\n }\n}\n\nexport type { WrSplitTextUnit, WrSplitTextMotion } from './interfaces';\n","<!-- The readable text, once: the pieces below are per-character spans. -->\n<span class=\"wr-split-text__sr-only\">{{ text() }}</span>\n@for (p of pieces(); track $index) {\n @if (p.kind === 'piece') {\n <span class=\"wr-split-text__piece\" aria-hidden=\"true\">{{ p.text }}</span>\n } @else {\n <span class=\"wr-split-text__space\" aria-hidden=\"true\">{{ p.text }}</span>\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;AAAA;;;;;;;;;;;;AAYG;AAwBH;AACA,SAAS,WAAW,CAAC,IAAY,EAAE,IAAqB,EAAA;AACtD,IAAA,IAAI,CAAC,IAAI;AAAE,QAAA,OAAO,EAAE;AACpB,IAAA,IAAI,IAAI,KAAK,OAAO,EAAE;;QAEpB,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,OAAO,CAAQ,GAAG,IAAG;AAC9C,YAAA,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC;AAAE,gBAAA,OAAO,EAAE;AAC/B,YAAA,IAAI,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC;gBAAE,OAAO,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,EAAW,CAAC;YACrE,OAAO,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,EAAW,CAAC;AAChD,QAAA,CAAC,CAAC;IACJ;;IAEA,OAAO,CAAC,GAAG,IAAI,CAAC,CAAC,GAAG,CAAQ,EAAE,KAAK,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,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K,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC;gBAC1C,EAAE,CAAC,KAAK,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS;AACtC,gBAAA,IAAI;oBACF,SAAS,CAAC,MAAM,EAAE;gBACpB;AAAE,gBAAA,MAAM;;gBAER;gBACA,SAAS,IAAI,CAAC;gBACd,IAAI,SAAS,KAAK,CAAC;AAAE,oBAAA,IAAI,CAAC,iBAAiB,CAAC,IAAI,EAAE;AACpD,YAAA,CAAC;AACH,QAAA,CAAC,CAAC;IACJ;uGAtIW,WAAW,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;AAAX,IAAA,OAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,WAAW,u8CCzFxB,0YASA,EAAA,MAAA,EAAA,CAAA,obAAA,CAAA,EAAA,aAAA,EAAA,EAAA,CAAA,iBAAA,CAAA,IAAA,EAAA,CAAA;;2FDgFa,WAAW,EAAA,UAAA,EAAA,CAAA;kBAPvB,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,eAAe,EAAA,aAAA,EAGV,iBAAiB,CAAC,IAAI,EAAA,IAAA,EAC/B,EAAE,KAAK,EAAE,eAAe,EAAE,oBAAoB,EAAE,aAAa,EAAE,EAAA,QAAA,EAAA,0YAAA,EAAA,MAAA,EAAA,CAAA,obAAA,CAAA,EAAA;;;AEvFvE;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"ngwr-split-text.mjs","sources":["../../../projects/lib/split-text/split-text.ts","../../../projects/lib/split-text/split-text.html","../../../projects/lib/split-text/ngwr-split-text.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 * Angular adaptation of the SplitText effect by David Haz / reactbits.dev.\n * Original: https://www.reactbits.dev/text-animations/split-text\n *\n * The reactbits version uses GSAP's paid `SplitText` plugin. This port is\n * GSAP-free — splits via plain DOM spans, animates via the Web Animations\n * API, triggers on viewport entry via `IntersectionObserver`.\n */\n\nimport { isPlatformBrowser } from '@angular/common';\nimport {\n Component,\n DestroyRef,\n ElementRef,\n PLATFORM_ID,\n ViewEncapsulation,\n afterNextRender,\n computed,\n effect,\n inject,\n input,\n output,\n} from '@angular/core';\n\nimport { WrPlatform } from 'ngwr/platform';\nimport { numAttr } from 'ngwr/utils';\n\nimport type { WrSplitTextUnit, WrSplitTextMotion } from './interfaces';\n\ntype Piece = { readonly kind: 'piece'; readonly text: string } | { readonly kind: 'space'; readonly text: string };\n\n/** Split `text` into render pieces, preserving whitespace as `kind: 'space'`. */\nfunction splitPieces(text: string, unit: WrSplitTextUnit): readonly Piece[] {\n if (!text) return [];\n if (unit === 'words') {\n // Split on whitespace, keeping spaces as separate pieces.\n return text.split(/(\\s+)/).flatMap<Piece>(seg => {\n if (seg.length === 0) return [];\n if (/^\\s+$/.test(seg)) return [{ kind: 'space', text: seg } as const];\n return [{ kind: 'piece', text: seg } as const];\n });\n }\n // chars: each character is its own piece; whitespace becomes 'space'.\n return [...text].map<Piece>(ch => (/\\s/.test(ch) ? { kind: 'space', text: ch } : { kind: 'piece', text: ch }));\n}\n\nfunction motionToStyle(m: WrSplitTextMotion): { opacity: number; transform: string } {\n const opacity = m.opacity ?? 1;\n const parts: string[] = [];\n if (m.x !== undefined || m.y !== undefined) {\n parts.push(`translate3d(${m.x ?? 0}px, ${m.y ?? 0}px, 0)`);\n }\n if (m.scale !== undefined) parts.push(`scale(${m.scale})`);\n if (m.rotate !== undefined) parts.push(`rotate(${m.rotate}deg)`);\n return { opacity, transform: parts.length ? parts.join(' ') : 'none' };\n}\n\n/**\n * Animated text reveal — splits the input string into chars or words and\n * staggers each piece in from a `from` motion state to a `to` motion\n * state when the host scrolls into view. Whitespace is preserved.\n *\n * @example\n * ```html\n * <wr-split-text\n * text=\"Hello, ngwr!\"\n * splitType=\"chars\"\n * [delay]=\"40\"\n * [duration]=\"1.2\"\n * [from]=\"{ opacity: 0, y: 40 }\"\n * [to]=\"{ opacity: 1, y: 0 }\"\n * (animationComplete)=\"onDone()\"\n * />\n * ```\n *\n * @see https://www.reactbits.dev/text-animations/split-text\n */\n@Component({\n selector: 'wr-split-text',\n templateUrl: './split-text.html',\n styleUrl: './split-text.scss',\n encapsulation: ViewEncapsulation.None,\n host: { class: 'wr-split-text', '[style.text-align]': 'textAlign()' },\n})\nexport class WrSplitText {\n /** Text to animate. Required. */\n readonly text = input.required<string>();\n\n /** Split granularity. @default 'chars' */\n readonly splitType = input<WrSplitTextUnit>('chars');\n\n /** Stagger delay between pieces in ms. @default 50 */\n readonly delay = input(50, { transform: numAttr(50) });\n\n /** Animation duration in seconds (matches reactbits' API). @default 1.25 */\n readonly duration = input(1.25, { transform: numAttr(1.25) });\n\n /** CSS easing function. @default 'cubic-bezier(0.16, 1, 0.3, 1)' (~power3.out) */\n readonly easing = input('cubic-bezier(0.16, 1, 0.3, 1)');\n\n /** Start state for each piece. @default { opacity: 0, y: 40 } */\n readonly from = input<WrSplitTextMotion>({ opacity: 0, y: 40 });\n\n /** End state for each piece. @default { opacity: 1, y: 0 } */\n readonly to = input<WrSplitTextMotion>({ opacity: 1, y: 0 });\n\n /** `IntersectionObserver.threshold` — 0..1. @default 0.1 */\n readonly threshold = input(0.1, { transform: numAttr(0.1) });\n\n /** `IntersectionObserver.rootMargin`. @default '-100px' */\n readonly rootMargin = input('-100px');\n\n /** Text alignment of the host. @default 'center' */\n readonly textAlign = input<'left' | 'center' | 'right' | 'justify'>('center');\n\n /** Emitted once all pieces finish animating. */\n readonly animationComplete = output<void>();\n\n /** Pieces to render. Each piece is `{ kind: 'piece', text }` or `{ kind: 'space' }`. */\n protected readonly pieces = computed(() => splitPieces(this.text(), this.splitType()));\n\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\n private readonly destroyRef = inject(DestroyRef);\n private readonly isBrowser = isPlatformBrowser(inject(PLATFORM_ID));\n private readonly platform = inject(WrPlatform);\n\n private hasAnimated = false;\n\n /**\n * The ONE observer, replaced rather than stacked.\n *\n * `startObserver()` used to `new IntersectionObserver(…)` and register its own\n * `destroyRef.onDestroy` every time, and the effect below calls it on every\n * `text` change after setting `hasAnimated = false` — so the guard at the top\n * of `startObserver` never blocked that path. An off-screen element (the only\n * case where the observer does not immediately disconnect itself) therefore\n * leaked one live observer AND one destroy callback per change, all of them\n * watching the same host and all of them able to fire `animate()`.\n */\n private observer: IntersectionObserver | null = null;\n\n /**\n * `startObserver()` builds its observer inside a `document.fonts.ready`\n * continuation, so the component can be destroyed while it is awaiting. At\n * that moment `observer` is still null, so the destroy hook below disconnects\n * nothing — and the continuation then starts an observer on a host Angular\n * has already detached, which nothing is left to disconnect. Same hazard, and\n * same flag, as `wr-fuzzy-text`.\n */\n private destroyed = false;\n\n constructor() {\n if (!this.isBrowser) return;\n this.destroyRef.onDestroy(() => {\n this.destroyed = true;\n this.observer?.disconnect();\n });\n\n afterNextRender(() => this.startObserver());\n\n // Re-run animation if `text` (and therefore the split pieces) changes.\n effect(() => {\n this.text();\n this.splitType();\n this.hasAnimated = false;\n queueMicrotask(() => this.startObserver());\n });\n }\n\n private startObserver(): void {\n const host = this.host.nativeElement;\n const fonts = (document as Document & { fonts?: FontFaceSet }).fonts;\n const ready = fonts?.status === 'loaded' ? Promise.resolve() : (fonts?.ready ?? Promise.resolve());\n\n const observe = (): void => {\n if (this.destroyed || this.hasAnimated) return;\n this.observer?.disconnect();\n const io = new IntersectionObserver(\n (entries, obs) => {\n for (const e of entries) {\n if (e.isIntersecting) {\n obs.disconnect();\n this.animate();\n break;\n }\n }\n },\n { threshold: this.threshold(), rootMargin: this.rootMargin() }\n );\n this.observer = io;\n io.observe(host);\n };\n\n void ready.then(observe);\n }\n\n private animate(): void {\n if (this.hasAnimated) return;\n this.hasAnimated = true;\n\n // Reduced motion: pieces already render at their natural (final)\n // state — skip the tween and report completion right away.\n if (this.platform.prefersReducedMotion()) {\n this.animationComplete.emit();\n return;\n }\n\n const host = this.host.nativeElement;\n const targets = host.querySelectorAll<HTMLElement>('.wr-split-text__piece');\n if (targets.length === 0) {\n this.animationComplete.emit();\n return;\n }\n\n const fromStyle = motionToStyle(this.from());\n const toStyle = motionToStyle(this.to());\n const durationMs = this.duration() * 1000;\n const stagger = this.delay();\n const easing = this.easing();\n\n let remaining = targets.length;\n targets.forEach((el, i) => {\n // Set initial state immediately so there's no flash of final state\n // before the animation kicks in.\n el.style.opacity = String(fromStyle.opacity);\n el.style.transform = fromStyle.transform;\n const animation = el.animate(\n [\n { opacity: fromStyle.opacity, transform: fromStyle.transform },\n { opacity: toStyle.opacity, transform: toStyle.transform },\n ],\n { duration: durationMs, delay: i * stagger, easing, fill: 'forwards' }\n );\n animation.onfinish = (): void => {\n // Commit final styles + clean up the WAAPI tween.\n el.style.opacity = String(toStyle.opacity);\n el.style.transform = toStyle.transform;\n try {\n animation.cancel();\n } catch {\n /* noop */\n }\n remaining -= 1;\n if (remaining === 0) this.animationComplete.emit();\n };\n });\n }\n}\n\nexport type { WrSplitTextUnit, WrSplitTextMotion } from './interfaces';\n","<!-- The readable text, once: the pieces below are per-character spans. -->\n<span class=\"wr-split-text__sr-only\">{{ text() }}</span>\n@for (p of pieces(); track $index) {\n @if (p.kind === 'piece') {\n <span class=\"wr-split-text__piece\" aria-hidden=\"true\">{{ p.text }}</span>\n } @else {\n <span class=\"wr-split-text__space\" aria-hidden=\"true\">{{ p.text }}</span>\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;AAAA;;;;;;;;;;;;AAYG;AAwBH;AACA,SAAS,WAAW,CAAC,IAAY,EAAE,IAAqB,EAAA;AACtD,IAAA,IAAI,CAAC,IAAI;AAAE,QAAA,OAAO,EAAE;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I,CAAC,iBAAiB,CAAC,IAAI,EAAE;AACpD,YAAA,CAAC;AACH,QAAA,CAAC,CAAC;IACJ;uGAlKW,WAAW,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;AAAX,IAAA,OAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,WAAW,u8CCzFxB,0YASA,EAAA,MAAA,EAAA,CAAA,obAAA,CAAA,EAAA,aAAA,EAAA,EAAA,CAAA,iBAAA,CAAA,IAAA,EAAA,CAAA;;2FDgFa,WAAW,EAAA,UAAA,EAAA,CAAA;kBAPvB,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,eAAe,EAAA,aAAA,EAGV,iBAAiB,CAAC,IAAI,EAAA,IAAA,EAC/B,EAAE,KAAK,EAAE,eAAe,EAAE,oBAAoB,EAAE,aAAa,EAAE,EAAA,QAAA,EAAA,0YAAA,EAAA,MAAA,EAAA,CAAA,obAAA,CAAA,EAAA;;;AEvFvE;;AAEG;;;;"}
|
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
import { TestKey, 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
|
+
const ARROWS = {
|
|
10
|
+
left: TestKey.LEFT_ARROW,
|
|
11
|
+
right: TestKey.RIGHT_ARROW,
|
|
12
|
+
up: TestKey.UP_ARROW,
|
|
13
|
+
down: TestKey.DOWN_ARROW,
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Test harness for `<wr-splitter>` — two panes and the divider between them.
|
|
17
|
+
*
|
|
18
|
+
* **Everything here is the keyboard, and that is not a workaround.** The divider is
|
|
19
|
+
* dragged with a pointer in a browser, but the drag reads
|
|
20
|
+
* `getBoundingClientRect()` and turns a client coordinate into a percentage; jsdom
|
|
21
|
+
* lays nothing out, so every rect is 0×0 and a synthetic drag writes `NaN` into the
|
|
22
|
+
* position. The arrow keys reach the same state, are the accessible path anyway, and
|
|
23
|
+
* are what the WAI-ARIA separator pattern is judged on.
|
|
24
|
+
*
|
|
25
|
+
* **Two words for the axis, and they are opposites.** The component's
|
|
26
|
+
* `orientation="horizontal"` means the panes sit side by side, which needs a
|
|
27
|
+
* VERTICAL divider — so that is what `aria-orientation` says. {@link getOrientation}
|
|
28
|
+
* answers the component's word and {@link getDividerOrientation} the divider's; both
|
|
29
|
+
* are here because a spec that conflated them would look right and assert nothing.
|
|
30
|
+
*
|
|
31
|
+
* **Arrows follow the VISUAL axis.** Under `dir="rtl"` the start pane is the one on
|
|
32
|
+
* the right, so ArrowRight SHRINKS the position. {@link pressArrow} takes the key a
|
|
33
|
+
* user presses rather than a semantic direction, which is the only way a spec can
|
|
34
|
+
* pin that mirroring; {@link setPosition} walks with whichever key currently grows
|
|
35
|
+
* the number, and reports where it landed.
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```ts
|
|
39
|
+
* const splitter = await loader.getHarness(WrSplitterHarness);
|
|
40
|
+
*
|
|
41
|
+
* expect(await splitter.getPosition()).toBe(50);
|
|
42
|
+
* await splitter.setPosition(70);
|
|
43
|
+
* expect(await splitter.getPaneSizes()).toEqual({ start: 70, end: 30 });
|
|
44
|
+
* ```
|
|
45
|
+
*
|
|
46
|
+
* @see https://ngwr.dev/guides/testing
|
|
47
|
+
*/
|
|
48
|
+
class WrSplitterHarness extends ComponentHarness {
|
|
49
|
+
static hostSelector = 'wr-splitter';
|
|
50
|
+
/** Build a predicate that narrows the query — pass to `getHarness` / `getAllHarnesses`. */
|
|
51
|
+
static with(options = {}) {
|
|
52
|
+
return new HarnessPredicate(WrSplitterHarness, options)
|
|
53
|
+
.addOption('orientation', options.orientation, async (harness, orientation) => (await harness.getOrientation()) === orientation)
|
|
54
|
+
.addOption('dividerLabel', options.dividerLabel, (harness, label) => HarnessPredicate.stringMatches(harness.getDividerLabel(), label))
|
|
55
|
+
.addOption('disabled', options.disabled, async (harness, disabled) => (await harness.isDisabled()) === disabled);
|
|
56
|
+
}
|
|
57
|
+
divider = this.locatorFor('.wr-splitter__divider');
|
|
58
|
+
/**
|
|
59
|
+
* The splitter's own axis: `horizontal` when the panes sit side by side.
|
|
60
|
+
*
|
|
61
|
+
* Read from the host modifier rather than from `aria-orientation`, which says the
|
|
62
|
+
* opposite thing about the same layout — see {@link getDividerOrientation}.
|
|
63
|
+
*/
|
|
64
|
+
async getOrientation() {
|
|
65
|
+
return (await (await this.host()).hasClass('wr-splitter--vertical')) ? 'vertical' : 'horizontal';
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* What the divider announces — the INVERSE of {@link getOrientation}, and correct:
|
|
69
|
+
* a separator's orientation is the line it draws, not the axis it travels along.
|
|
70
|
+
*/
|
|
71
|
+
async getDividerOrientation() {
|
|
72
|
+
return (await this.divider()).getAttribute('aria-orientation');
|
|
73
|
+
}
|
|
74
|
+
/** The divider's position as a percentage, from `aria-valuenow`. */
|
|
75
|
+
async getPosition() {
|
|
76
|
+
return this.numeric('aria-valuenow');
|
|
77
|
+
}
|
|
78
|
+
/** The lowest position the divider will accept, from `aria-valuemin`. */
|
|
79
|
+
async getMinPosition() {
|
|
80
|
+
return this.numeric('aria-valuemin');
|
|
81
|
+
}
|
|
82
|
+
/** The highest position the divider will accept, from `aria-valuemax`. */
|
|
83
|
+
async getMaxPosition() {
|
|
84
|
+
return this.numeric('aria-valuemax');
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* What each pane is asking for, in percent, from the `flex-basis` the component
|
|
88
|
+
* writes inline.
|
|
89
|
+
*
|
|
90
|
+
* This is the only evidence a spec without layout has that the panes followed the
|
|
91
|
+
* divider — a measured width is zero for both. They should always sum to 100:
|
|
92
|
+
* the end pane is `100 - position`, so a pair that does not is a component bug
|
|
93
|
+
* rather than a rounding artefact.
|
|
94
|
+
*/
|
|
95
|
+
async getPaneSizes() {
|
|
96
|
+
const start = await this.locatorFor('.wr-splitter__pane--start')();
|
|
97
|
+
const end = await this.locatorFor('.wr-splitter__pane--end')();
|
|
98
|
+
return {
|
|
99
|
+
start: Number.parseFloat(await start.getCssValue('flex-basis')),
|
|
100
|
+
end: Number.parseFloat(await end.getCssValue('flex-basis')),
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
/** The start pane's projected text, trimmed. */
|
|
104
|
+
async getStartText() {
|
|
105
|
+
return (await this.locatorFor('.wr-splitter__pane--start')()).text();
|
|
106
|
+
}
|
|
107
|
+
/** The end pane's projected text, trimmed. */
|
|
108
|
+
async getEndText() {
|
|
109
|
+
return (await this.locatorFor('.wr-splitter__pane--end')()).text();
|
|
110
|
+
}
|
|
111
|
+
/** The divider's accessible name — a focusable separator is a widget and needs one. */
|
|
112
|
+
async getDividerLabel() {
|
|
113
|
+
return (await this.divider()).getAttribute('aria-label');
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Whether the splitter refuses to resize.
|
|
117
|
+
*
|
|
118
|
+
* From the divider's `aria-disabled`, which is the half a screen reader acts on.
|
|
119
|
+
* The component also drops the divider out of the tab order and paints a modifier
|
|
120
|
+
* on the host, and {@link isDividerFocusable} answers the first of those — worth
|
|
121
|
+
* asking separately, because a divider that is announced as disabled and still a
|
|
122
|
+
* tab stop is a control the keyboard can reach and not use.
|
|
123
|
+
*/
|
|
124
|
+
async isDisabled() {
|
|
125
|
+
return (await (await this.divider()).getAttribute('aria-disabled')) === 'true';
|
|
126
|
+
}
|
|
127
|
+
/** Whether the divider is a tab stop (`tabindex="0"`). */
|
|
128
|
+
async isDividerFocusable() {
|
|
129
|
+
return (await (await this.divider()).getAttribute('tabindex')) === '0';
|
|
130
|
+
}
|
|
131
|
+
/** Move keyboard focus to the divider. */
|
|
132
|
+
async focusDivider() {
|
|
133
|
+
return (await this.divider()).focus();
|
|
134
|
+
}
|
|
135
|
+
/** Whether the divider currently holds focus. */
|
|
136
|
+
async isDividerFocused() {
|
|
137
|
+
return (await this.divider()).isFocused();
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Press one arrow key on the divider.
|
|
141
|
+
*
|
|
142
|
+
* The key rather than a direction, deliberately: which way the position moves is a
|
|
143
|
+
* function of the key AND the reading direction, and a `grow()` / `shrink()` pair
|
|
144
|
+
* would hide exactly the behaviour worth asserting. An arrow off the splitter's own
|
|
145
|
+
* axis does nothing at all — the horizontal splitter ignores Up and Down.
|
|
146
|
+
*
|
|
147
|
+
* `shift` is the coarse step: 10 instead of 1.
|
|
148
|
+
*/
|
|
149
|
+
async pressArrow(arrow, options = {}) {
|
|
150
|
+
const divider = await this.divider();
|
|
151
|
+
await (options.shift ? divider.sendKeys({ shift: true }, ARROWS[arrow]) : divider.sendKeys(ARROWS[arrow]));
|
|
152
|
+
}
|
|
153
|
+
/** Press Home — jumping to `minPosition`, whatever the reading direction. */
|
|
154
|
+
async pressHome() {
|
|
155
|
+
return (await this.divider()).sendKeys(TestKey.HOME);
|
|
156
|
+
}
|
|
157
|
+
/** Press End — jumping to `maxPosition`. Semantic, so it never mirrors under RTL. */
|
|
158
|
+
async pressEnd() {
|
|
159
|
+
return (await this.divider()).sendKeys(TestKey.END);
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Walk the divider to a position with the keyboard, and assert it landed there.
|
|
163
|
+
*
|
|
164
|
+
* Ten-unit hops first, then single steps — the same two strides a user has. It
|
|
165
|
+
* walks rather than assigning, because assigning would prove the harness can write
|
|
166
|
+
* a signal and nothing about the component: the clamp, the min / max and the
|
|
167
|
+
* mirroring all live on this path.
|
|
168
|
+
*
|
|
169
|
+
* Throws rather than half-arriving. A target outside `[min, max]` is unreachable by
|
|
170
|
+
* construction, and so is any target the walk cannot hit exactly — the position is a
|
|
171
|
+
* float that a previous drag may have left mid-step, and whole-unit keys cannot get
|
|
172
|
+
* off a fractional offset. Both say so, with where it actually stopped.
|
|
173
|
+
*/
|
|
174
|
+
async setPosition(target) {
|
|
175
|
+
const [min, max] = [await this.getMinPosition(), await this.getMaxPosition()];
|
|
176
|
+
if (target < min || target > max) {
|
|
177
|
+
throw new Error(`WrSplitterHarness.setPosition(${target}): out of range — this splitter accepts ${min}–${max}. ` +
|
|
178
|
+
'The component clamps, so the walk would stop at the bound and never reach the number asked for.');
|
|
179
|
+
}
|
|
180
|
+
if (target === min)
|
|
181
|
+
return this.pressHome();
|
|
182
|
+
if (target === max)
|
|
183
|
+
return this.pressEnd();
|
|
184
|
+
await this.focusDivider();
|
|
185
|
+
// The block axis never mirrors, so only the horizontal splitter needs the probe.
|
|
186
|
+
const vertical = (await this.getOrientation()) === 'vertical';
|
|
187
|
+
const [grow, shrink] = vertical
|
|
188
|
+
? ['down', 'up']
|
|
189
|
+
: (await this.growsWithRight())
|
|
190
|
+
? ['right', 'left']
|
|
191
|
+
: ['left', 'right'];
|
|
192
|
+
for (const shift of [true, false]) {
|
|
193
|
+
const step = shift ? 10 : 1;
|
|
194
|
+
// Recomputed each pass: the coarse hops clamp at the bounds, so the remaining
|
|
195
|
+
// distance is not what simple arithmetic on the starting point would predict.
|
|
196
|
+
let delta = target - (await this.getPosition());
|
|
197
|
+
while (Math.abs(delta) >= step) {
|
|
198
|
+
const before = await this.getPosition();
|
|
199
|
+
await this.pressArrow(delta > 0 ? grow : shrink, { shift });
|
|
200
|
+
const now = await this.getPosition();
|
|
201
|
+
if (now === before) {
|
|
202
|
+
throw new Error(`WrSplitterHarness.setPosition(${target}): the divider stopped moving at ${now}. A disabled ` +
|
|
203
|
+
'splitter ignores its arrows, which is the usual reason this happens.');
|
|
204
|
+
}
|
|
205
|
+
delta = target - now;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
const landed = await this.getPosition();
|
|
209
|
+
if (landed !== target) {
|
|
210
|
+
throw new Error(`WrSplitterHarness.setPosition(${target}): the walk stopped at ${landed}. The arrows move in whole ` +
|
|
211
|
+
'units, so a position left on a fraction by a drag cannot be walked onto a whole number.');
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* Whether ArrowRight is currently the key that GROWS the position — true in LTR,
|
|
216
|
+
* false in RTL, where the start pane is the one on the right.
|
|
217
|
+
*
|
|
218
|
+
* Probed rather than read off `Directionality`, which a harness has no access to:
|
|
219
|
+
* press, look, and put it back. At the top of the range a growing press is clamped
|
|
220
|
+
* and would prove nothing, so the probe presses the other way there instead. The
|
|
221
|
+
* undo is conditional — a press that moved nothing has nothing to undo, and undoing
|
|
222
|
+
* it anyway would move the divider by one in the direction the probe was testing.
|
|
223
|
+
*/
|
|
224
|
+
async growsWithRight() {
|
|
225
|
+
const before = await this.getPosition();
|
|
226
|
+
const atCeiling = before >= (await this.getMaxPosition());
|
|
227
|
+
const [probe, undo] = atCeiling ? ['left', 'right'] : ['right', 'left'];
|
|
228
|
+
await this.pressArrow(probe);
|
|
229
|
+
const after = await this.getPosition();
|
|
230
|
+
if (after !== before)
|
|
231
|
+
await this.pressArrow(undo);
|
|
232
|
+
return atCeiling ? after < before : after > before;
|
|
233
|
+
}
|
|
234
|
+
async numeric(attribute) {
|
|
235
|
+
const raw = await (await this.divider()).getAttribute(attribute);
|
|
236
|
+
return raw === null ? Number.NaN : Number(raw);
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
/**
|
|
241
|
+
* Generated bundle index. Do not edit.
|
|
242
|
+
*/
|
|
243
|
+
|
|
244
|
+
export { WrSplitterHarness };
|
|
245
|
+
//# sourceMappingURL=ngwr-splitter-testing.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ngwr-splitter-testing.mjs","sources":["../../../projects/lib/splitter/testing/wr-splitter-harness.ts","../../../projects/lib/splitter/testing/ngwr-splitter-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 { ComponentHarness, HarnessPredicate, TestKey } from '@angular/cdk/testing';\n\nimport type { WrSplitterHarnessFilters, WrSplitterPaneSizes } from './interfaces';\n\n/** The four arrow keys, by the direction a user would say out loud. */\ntype Arrow = 'left' | 'right' | 'up' | 'down';\n\nconst ARROWS: Record<Arrow, TestKey> = {\n left: TestKey.LEFT_ARROW,\n right: TestKey.RIGHT_ARROW,\n up: TestKey.UP_ARROW,\n down: TestKey.DOWN_ARROW,\n};\n\n/**\n * Test harness for `<wr-splitter>` — two panes and the divider between them.\n *\n * **Everything here is the keyboard, and that is not a workaround.** The divider is\n * dragged with a pointer in a browser, but the drag reads\n * `getBoundingClientRect()` and turns a client coordinate into a percentage; jsdom\n * lays nothing out, so every rect is 0×0 and a synthetic drag writes `NaN` into the\n * position. The arrow keys reach the same state, are the accessible path anyway, and\n * are what the WAI-ARIA separator pattern is judged on.\n *\n * **Two words for the axis, and they are opposites.** The component's\n * `orientation=\"horizontal\"` means the panes sit side by side, which needs a\n * VERTICAL divider — so that is what `aria-orientation` says. {@link getOrientation}\n * answers the component's word and {@link getDividerOrientation} the divider's; both\n * are here because a spec that conflated them would look right and assert nothing.\n *\n * **Arrows follow the VISUAL axis.** Under `dir=\"rtl\"` the start pane is the one on\n * the right, so ArrowRight SHRINKS the position. {@link pressArrow} takes the key a\n * user presses rather than a semantic direction, which is the only way a spec can\n * pin that mirroring; {@link setPosition} walks with whichever key currently grows\n * the number, and reports where it landed.\n *\n * @example\n * ```ts\n * const splitter = await loader.getHarness(WrSplitterHarness);\n *\n * expect(await splitter.getPosition()).toBe(50);\n * await splitter.setPosition(70);\n * expect(await splitter.getPaneSizes()).toEqual({ start: 70, end: 30 });\n * ```\n *\n * @see https://ngwr.dev/guides/testing\n */\nexport class WrSplitterHarness extends ComponentHarness {\n static hostSelector = 'wr-splitter';\n\n /** Build a predicate that narrows the query — pass to `getHarness` / `getAllHarnesses`. */\n static with(options: WrSplitterHarnessFilters = {}): HarnessPredicate<WrSplitterHarness> {\n return new HarnessPredicate(WrSplitterHarness, options)\n .addOption(\n 'orientation',\n options.orientation,\n async (harness, orientation) => (await harness.getOrientation()) === orientation\n )\n .addOption('dividerLabel', options.dividerLabel, (harness, label) =>\n HarnessPredicate.stringMatches(harness.getDividerLabel(), label)\n )\n .addOption('disabled', options.disabled, async (harness, disabled) => (await harness.isDisabled()) === disabled);\n }\n\n private readonly divider = this.locatorFor('.wr-splitter__divider');\n\n /**\n * The splitter's own axis: `horizontal` when the panes sit side by side.\n *\n * Read from the host modifier rather than from `aria-orientation`, which says the\n * opposite thing about the same layout — see {@link getDividerOrientation}.\n */\n async getOrientation(): Promise<'horizontal' | 'vertical'> {\n return (await (await this.host()).hasClass('wr-splitter--vertical')) ? 'vertical' : 'horizontal';\n }\n\n /**\n * What the divider announces — the INVERSE of {@link getOrientation}, and correct:\n * a separator's orientation is the line it draws, not the axis it travels along.\n */\n async getDividerOrientation(): Promise<string | null> {\n return (await this.divider()).getAttribute('aria-orientation');\n }\n\n /** The divider's position as a percentage, from `aria-valuenow`. */\n async getPosition(): Promise<number> {\n return this.numeric('aria-valuenow');\n }\n\n /** The lowest position the divider will accept, from `aria-valuemin`. */\n async getMinPosition(): Promise<number> {\n return this.numeric('aria-valuemin');\n }\n\n /** The highest position the divider will accept, from `aria-valuemax`. */\n async getMaxPosition(): Promise<number> {\n return this.numeric('aria-valuemax');\n }\n\n /**\n * What each pane is asking for, in percent, from the `flex-basis` the component\n * writes inline.\n *\n * This is the only evidence a spec without layout has that the panes followed the\n * divider — a measured width is zero for both. They should always sum to 100:\n * the end pane is `100 - position`, so a pair that does not is a component bug\n * rather than a rounding artefact.\n */\n async getPaneSizes(): Promise<WrSplitterPaneSizes> {\n const start = await this.locatorFor('.wr-splitter__pane--start')();\n const end = await this.locatorFor('.wr-splitter__pane--end')();\n\n return {\n start: Number.parseFloat(await start.getCssValue('flex-basis')),\n end: Number.parseFloat(await end.getCssValue('flex-basis')),\n };\n }\n\n /** The start pane's projected text, trimmed. */\n async getStartText(): Promise<string> {\n return (await this.locatorFor('.wr-splitter__pane--start')()).text();\n }\n\n /** The end pane's projected text, trimmed. */\n async getEndText(): Promise<string> {\n return (await this.locatorFor('.wr-splitter__pane--end')()).text();\n }\n\n /** The divider's accessible name — a focusable separator is a widget and needs one. */\n async getDividerLabel(): Promise<string | null> {\n return (await this.divider()).getAttribute('aria-label');\n }\n\n /**\n * Whether the splitter refuses to resize.\n *\n * From the divider's `aria-disabled`, which is the half a screen reader acts on.\n * The component also drops the divider out of the tab order and paints a modifier\n * on the host, and {@link isDividerFocusable} answers the first of those — worth\n * asking separately, because a divider that is announced as disabled and still a\n * tab stop is a control the keyboard can reach and not use.\n */\n async isDisabled(): Promise<boolean> {\n return (await (await this.divider()).getAttribute('aria-disabled')) === 'true';\n }\n\n /** Whether the divider is a tab stop (`tabindex=\"0\"`). */\n async isDividerFocusable(): Promise<boolean> {\n return (await (await this.divider()).getAttribute('tabindex')) === '0';\n }\n\n /** Move keyboard focus to the divider. */\n async focusDivider(): Promise<void> {\n return (await this.divider()).focus();\n }\n\n /** Whether the divider currently holds focus. */\n async isDividerFocused(): Promise<boolean> {\n return (await this.divider()).isFocused();\n }\n\n /**\n * Press one arrow key on the divider.\n *\n * The key rather than a direction, deliberately: which way the position moves is a\n * function of the key AND the reading direction, and a `grow()` / `shrink()` pair\n * would hide exactly the behaviour worth asserting. An arrow off the splitter's own\n * axis does nothing at all — the horizontal splitter ignores Up and Down.\n *\n * `shift` is the coarse step: 10 instead of 1.\n */\n async pressArrow(arrow: Arrow, options: { shift?: boolean } = {}): Promise<void> {\n const divider = await this.divider();\n await (options.shift ? divider.sendKeys({ shift: true }, ARROWS[arrow]) : divider.sendKeys(ARROWS[arrow]));\n }\n\n /** Press Home — jumping to `minPosition`, whatever the reading direction. */\n async pressHome(): Promise<void> {\n return (await this.divider()).sendKeys(TestKey.HOME);\n }\n\n /** Press End — jumping to `maxPosition`. Semantic, so it never mirrors under RTL. */\n async pressEnd(): Promise<void> {\n return (await this.divider()).sendKeys(TestKey.END);\n }\n\n /**\n * Walk the divider to a position with the keyboard, and assert it landed there.\n *\n * Ten-unit hops first, then single steps — the same two strides a user has. It\n * walks rather than assigning, because assigning would prove the harness can write\n * a signal and nothing about the component: the clamp, the min / max and the\n * mirroring all live on this path.\n *\n * Throws rather than half-arriving. A target outside `[min, max]` is unreachable by\n * construction, and so is any target the walk cannot hit exactly — the position is a\n * float that a previous drag may have left mid-step, and whole-unit keys cannot get\n * off a fractional offset. Both say so, with where it actually stopped.\n */\n async setPosition(target: number): Promise<void> {\n const [min, max] = [await this.getMinPosition(), await this.getMaxPosition()];\n if (target < min || target > max) {\n throw new Error(\n `WrSplitterHarness.setPosition(${target}): out of range — this splitter accepts ${min}–${max}. ` +\n 'The component clamps, so the walk would stop at the bound and never reach the number asked for.'\n );\n }\n\n if (target === min) return this.pressHome();\n if (target === max) return this.pressEnd();\n\n await this.focusDivider();\n // The block axis never mirrors, so only the horizontal splitter needs the probe.\n const vertical = (await this.getOrientation()) === 'vertical';\n const [grow, shrink]: [Arrow, Arrow] = vertical\n ? ['down', 'up']\n : (await this.growsWithRight())\n ? ['right', 'left']\n : ['left', 'right'];\n\n for (const shift of [true, false]) {\n const step = shift ? 10 : 1;\n // Recomputed each pass: the coarse hops clamp at the bounds, so the remaining\n // distance is not what simple arithmetic on the starting point would predict.\n let delta = target - (await this.getPosition());\n\n while (Math.abs(delta) >= step) {\n const before = await this.getPosition();\n await this.pressArrow(delta > 0 ? grow : shrink, { shift });\n const now = await this.getPosition();\n\n if (now === before) {\n throw new Error(\n `WrSplitterHarness.setPosition(${target}): the divider stopped moving at ${now}. A disabled ` +\n 'splitter ignores its arrows, which is the usual reason this happens.'\n );\n }\n delta = target - now;\n }\n }\n\n const landed = await this.getPosition();\n if (landed !== target) {\n throw new Error(\n `WrSplitterHarness.setPosition(${target}): the walk stopped at ${landed}. The arrows move in whole ` +\n 'units, so a position left on a fraction by a drag cannot be walked onto a whole number.'\n );\n }\n }\n\n /**\n * Whether ArrowRight is currently the key that GROWS the position — true in LTR,\n * false in RTL, where the start pane is the one on the right.\n *\n * Probed rather than read off `Directionality`, which a harness has no access to:\n * press, look, and put it back. At the top of the range a growing press is clamped\n * and would prove nothing, so the probe presses the other way there instead. The\n * undo is conditional — a press that moved nothing has nothing to undo, and undoing\n * it anyway would move the divider by one in the direction the probe was testing.\n */\n private async growsWithRight(): Promise<boolean> {\n const before = await this.getPosition();\n const atCeiling = before >= (await this.getMaxPosition());\n const [probe, undo]: [Arrow, Arrow] = atCeiling ? ['left', 'right'] : ['right', 'left'];\n\n await this.pressArrow(probe);\n const after = await this.getPosition();\n if (after !== before) await this.pressArrow(undo);\n\n return atCeiling ? after < before : after > before;\n }\n\n private async numeric(attribute: string): Promise<number> {\n const raw = await (await this.divider()).getAttribute(attribute);\n return raw === null ? Number.NaN : Number(raw);\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;AAAA;;;;;AAKG;AASH,MAAM,MAAM,GAA2B;IACrC,IAAI,EAAE,OAAO,CAAC,UAAU;IACxB,KAAK,EAAE,OAAO,CAAC,WAAW;IAC1B,EAAE,EAAE,OAAO,CAAC,QAAQ;IACpB,IAAI,EAAE,OAAO,CAAC,UAAU;CACzB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgCG;AACG,MAAO,iBAAkB,SAAQ,gBAAgB,CAAA;AACrD,IAAA,OAAO,YAAY,GAAG,aAAa;;AAGnC,IAAA,OAAO,IAAI,CAAC,OAAA,GAAoC,EAAE,EAAA;AAChD,QAAA,OAAO,IAAI,gBAAgB,CAAC,iBAAiB,EAAE,OAAO;aACnD,SAAS,CACR,aAAa,EACb,OAAO,CAAC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M,IAAI,CAAC,WAAW,EAAE;QACvC,MAAM,SAAS,GAAG,MAAM,KAAK,MAAM,IAAI,CAAC,cAAc,EAAE,CAAC;QACzD,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,GAAmB,SAAS,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,OAAO,EAAE,MAAM,CAAC;AAEvF,QAAA,MAAM,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC;AAC5B,QAAA,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,WAAW,EAAE;QACtC,IAAI,KAAK,KAAK,MAAM;AAAE,YAAA,MAAM,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC;AAEjD,QAAA,OAAO,SAAS,GAAG,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,MAAM;IACpD;IAEQ,MAAM,OAAO,CAAC,SAAiB,EAAA;AACrC,QAAA,MAAM,GAAG,GAAG,MAAM,CAAC,MAAM,IAAI,CAAC,OAAO,EAAE,EAAE,YAAY,CAAC,SAAS,CAAC;AAChE,QAAA,OAAO,GAAG,KAAK,IAAI,GAAG,MAAM,CAAC,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC;IAChD;;;AC1RF;;AAEG;;;;"}
|
|
@@ -170,10 +170,10 @@ class WrSplitter {
|
|
|
170
170
|
isRtl() {
|
|
171
171
|
return this.dir?.value === 'rtl';
|
|
172
172
|
}
|
|
173
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.
|
|
174
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.1.
|
|
173
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.2", ngImport: i0, type: WrSplitter, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
174
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.1.2", type: WrSplitter, isStandalone: true, selector: "wr-splitter", inputs: { position: { classPropertyName: "position", publicName: "position", isSignal: true, isRequired: false, transformFunction: null }, orientation: { classPropertyName: "orientation", publicName: "orientation", isSignal: true, isRequired: false, transformFunction: null }, minPosition: { classPropertyName: "minPosition", publicName: "minPosition", isSignal: true, isRequired: false, transformFunction: null }, maxPosition: { classPropertyName: "maxPosition", publicName: "maxPosition", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, dividerLabel: { classPropertyName: "dividerLabel", publicName: "dividerLabel", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { position: "positionChange" }, host: { properties: { "class": "classes()" } }, ngImport: i0, template: "<div class=\"wr-splitter__pane wr-splitter__pane--start\" [style.flex-basis]=\"startStyle()\">\n <ng-content select=\"[wrSplitterStart]\" />\n</div>\n\n<!-- Roving focus + arrow keys for keyboard resizing. -->\n<div\n class=\"wr-splitter__divider\"\n role=\"separator\"\n [attr.aria-label]=\"resolvedDividerLabel()\"\n [attr.aria-orientation]=\"orientation() === 'horizontal' ? 'vertical' : 'horizontal'\"\n [attr.aria-valuemin]=\"minPosition()\"\n [attr.aria-valuemax]=\"maxPosition()\"\n [attr.aria-valuenow]=\"position()\"\n [attr.aria-disabled]=\"disabled() || null\"\n [attr.tabindex]=\"disabled() ? -1 : 0\"\n (pointerdown)=\"onPointerDown($event)\"\n (pointermove)=\"onPointerMove($event)\"\n (pointerup)=\"onPointerUp($event)\"\n (pointercancel)=\"onPointerUp($event)\"\n (keydown)=\"onKeydown($event)\"\n>\n <span class=\"wr-splitter__handle\" aria-hidden=\"true\"></span>\n</div>\n\n<div class=\"wr-splitter__pane wr-splitter__pane--end\" [style.flex-basis]=\"endStyle()\">\n <ng-content select=\"[wrSplitterEnd]\" />\n</div>\n", encapsulation: i0.ViewEncapsulation.None });
|
|
175
175
|
}
|
|
176
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.
|
|
176
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.2", ngImport: i0, type: WrSplitter, decorators: [{
|
|
177
177
|
type: Component,
|
|
178
178
|
args: [{ selector: 'wr-splitter', encapsulation: ViewEncapsulation.None, host: { '[class]': 'classes()' }, template: "<div class=\"wr-splitter__pane wr-splitter__pane--start\" [style.flex-basis]=\"startStyle()\">\n <ng-content select=\"[wrSplitterStart]\" />\n</div>\n\n<!-- Roving focus + arrow keys for keyboard resizing. -->\n<div\n class=\"wr-splitter__divider\"\n role=\"separator\"\n [attr.aria-label]=\"resolvedDividerLabel()\"\n [attr.aria-orientation]=\"orientation() === 'horizontal' ? 'vertical' : 'horizontal'\"\n [attr.aria-valuemin]=\"minPosition()\"\n [attr.aria-valuemax]=\"maxPosition()\"\n [attr.aria-valuenow]=\"position()\"\n [attr.aria-disabled]=\"disabled() || null\"\n [attr.tabindex]=\"disabled() ? -1 : 0\"\n (pointerdown)=\"onPointerDown($event)\"\n (pointermove)=\"onPointerMove($event)\"\n (pointerup)=\"onPointerUp($event)\"\n (pointercancel)=\"onPointerUp($event)\"\n (keydown)=\"onKeydown($event)\"\n>\n <span class=\"wr-splitter__handle\" aria-hidden=\"true\"></span>\n</div>\n\n<div class=\"wr-splitter__pane wr-splitter__pane--end\" [style.flex-basis]=\"endStyle()\">\n <ng-content select=\"[wrSplitterEnd]\" />\n</div>\n" }]
|
|
179
179
|
}], ctorParameters: () => [], propDecorators: { position: [{ type: i0.Input, args: [{ isSignal: true, alias: "position", required: false }] }, { type: i0.Output, args: ["positionChange"] }], orientation: [{ type: i0.Input, args: [{ isSignal: true, alias: "orientation", required: false }] }], minPosition: [{ type: i0.Input, args: [{ isSignal: true, alias: "minPosition", required: false }] }], maxPosition: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxPosition", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], dividerLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "dividerLabel", required: false }] }] } });
|