ngwr 16.2.0 → 16.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/badge/styles/_tag.scss +73 -1
- package/calendar/styles/_index.scss +22 -0
- package/carousel/styles/_index.scss +53 -1
- package/cascader/styles/_rules.scss +7 -0
- package/color-picker/styles/_index.scss +21 -0
- package/date-picker/styles/_index.scss +19 -0
- package/dropdown/styles/_index.scss +13 -19
- package/fesm2022/ngwr-affix.mjs +3 -3
- package/fesm2022/ngwr-alert-testing.mjs +70 -0
- package/fesm2022/ngwr-alert-testing.mjs.map +1 -0
- package/fesm2022/ngwr-alert.mjs +3 -3
- package/fesm2022/ngwr-anchor.mjs +17 -6
- package/fesm2022/ngwr-anchor.mjs.map +1 -1
- package/fesm2022/ngwr-animations-aurora.mjs +3 -3
- package/fesm2022/ngwr-animations-blur-reveal.mjs +3 -3
- package/fesm2022/ngwr-animations-click-sparks.mjs +3 -3
- package/fesm2022/ngwr-animations-confetti.mjs +3 -3
- package/fesm2022/ngwr-animations-decode.mjs +3 -3
- package/fesm2022/ngwr-animations-destruct.mjs +3 -3
- package/fesm2022/ngwr-animations-dot-grid.mjs +3 -3
- package/fesm2022/ngwr-animations-falling-letters.mjs +3 -3
- package/fesm2022/ngwr-animations-flow-lines.mjs +3 -3
- package/fesm2022/ngwr-animations-fluid-cursor.mjs +3 -3
- package/fesm2022/ngwr-animations-glitch.mjs +3 -3
- package/fesm2022/ngwr-animations-glow-border.mjs +3 -3
- package/fesm2022/ngwr-animations-gradient-flow.mjs +3 -3
- package/fesm2022/ngwr-animations-marquee.mjs +3 -3
- package/fesm2022/ngwr-animations-orbit.mjs +3 -3
- package/fesm2022/ngwr-animations-reveal.mjs +3 -3
- package/fesm2022/ngwr-animations-ripple-grid.mjs +3 -3
- package/fesm2022/ngwr-animations-rotate-reveal.mjs +3 -3
- package/fesm2022/ngwr-animations-shimmer.mjs +3 -3
- package/fesm2022/ngwr-animations-spotlight.mjs +3 -3
- package/fesm2022/ngwr-animations-thread-lines.mjs +3 -3
- package/fesm2022/ngwr-animations-tilt.mjs +3 -3
- package/fesm2022/ngwr-animations-typewriter.mjs +3 -3
- package/fesm2022/ngwr-avatar.mjs +3 -3
- package/fesm2022/ngwr-back-top.mjs +3 -3
- package/fesm2022/ngwr-badge.mjs +129 -11
- package/fesm2022/ngwr-badge.mjs.map +1 -1
- package/fesm2022/ngwr-breadcrumbs-testing.mjs +83 -0
- package/fesm2022/ngwr-breadcrumbs-testing.mjs.map +1 -0
- package/fesm2022/ngwr-breadcrumbs.mjs +8 -8
- package/fesm2022/ngwr-breadcrumbs.mjs.map +1 -1
- package/fesm2022/ngwr-burger-testing.mjs +45 -0
- package/fesm2022/ngwr-burger-testing.mjs.map +1 -0
- package/fesm2022/ngwr-burger.mjs +3 -3
- package/fesm2022/ngwr-button.mjs +6 -6
- package/fesm2022/ngwr-calendar-testing.mjs +18 -0
- package/fesm2022/ngwr-calendar-testing.mjs.map +1 -1
- package/fesm2022/ngwr-calendar.mjs +500 -73
- package/fesm2022/ngwr-calendar.mjs.map +1 -1
- package/fesm2022/ngwr-card.mjs +9 -9
- package/fesm2022/ngwr-carousel-testing.mjs +24 -1
- package/fesm2022/ngwr-carousel-testing.mjs.map +1 -1
- package/fesm2022/ngwr-carousel.mjs +73 -10
- package/fesm2022/ngwr-carousel.mjs.map +1 -1
- package/fesm2022/ngwr-cascader.mjs +45 -37
- package/fesm2022/ngwr-cascader.mjs.map +1 -1
- package/fesm2022/ngwr-charts-bar-chart.mjs +5 -4
- package/fesm2022/ngwr-charts-bar-chart.mjs.map +1 -1
- package/fesm2022/ngwr-charts-boxplot-chart.mjs +3 -3
- package/fesm2022/ngwr-charts-bullet-chart.mjs +3 -3
- package/fesm2022/ngwr-charts-calendar-heatmap.mjs +3 -3
- package/fesm2022/ngwr-charts-candlestick-chart.mjs +3 -3
- package/fesm2022/ngwr-charts-chart-legend.mjs +26 -11
- package/fesm2022/ngwr-charts-chart-legend.mjs.map +1 -1
- package/fesm2022/ngwr-charts-core.mjs +3 -3
- package/fesm2022/ngwr-charts-donut-chart.mjs +5 -4
- package/fesm2022/ngwr-charts-donut-chart.mjs.map +1 -1
- package/fesm2022/ngwr-charts-funnel-chart.mjs +3 -3
- package/fesm2022/ngwr-charts-gauge.mjs +3 -3
- package/fesm2022/ngwr-charts-heatmap-chart.mjs +3 -3
- package/fesm2022/ngwr-charts-line-chart-testing.mjs +3 -2
- package/fesm2022/ngwr-charts-line-chart-testing.mjs.map +1 -1
- package/fesm2022/ngwr-charts-line-chart.mjs +17 -7
- package/fesm2022/ngwr-charts-line-chart.mjs.map +1 -1
- package/fesm2022/ngwr-charts-meter-group.mjs +5 -4
- package/fesm2022/ngwr-charts-meter-group.mjs.map +1 -1
- package/fesm2022/ngwr-charts-radar-chart.mjs +5 -4
- package/fesm2022/ngwr-charts-radar-chart.mjs.map +1 -1
- package/fesm2022/ngwr-charts-scatter-chart.mjs +5 -4
- package/fesm2022/ngwr-charts-scatter-chart.mjs.map +1 -1
- package/fesm2022/ngwr-charts-sparkline.mjs +3 -3
- package/fesm2022/ngwr-charts-treemap-chart.mjs +3 -3
- package/fesm2022/ngwr-charts-waterfall-chart.mjs +3 -3
- package/fesm2022/ngwr-checkbox.mjs +6 -6
- package/fesm2022/ngwr-clipboard.mjs +3 -3
- package/fesm2022/ngwr-collapse.mjs +9 -9
- package/fesm2022/ngwr-color-picker-testing.mjs +11 -1
- package/fesm2022/ngwr-color-picker-testing.mjs.map +1 -1
- package/fesm2022/ngwr-color-picker.mjs +153 -37
- package/fesm2022/ngwr-color-picker.mjs.map +1 -1
- package/fesm2022/ngwr-command-palette.mjs +3 -3
- package/fesm2022/ngwr-comment.mjs +10 -6
- package/fesm2022/ngwr-comment.mjs.map +1 -1
- package/fesm2022/ngwr-compare-testing.mjs +84 -0
- package/fesm2022/ngwr-compare-testing.mjs.map +1 -0
- package/fesm2022/ngwr-compare.mjs +3 -3
- package/fesm2022/ngwr-context-menu.mjs +28 -13
- package/fesm2022/ngwr-context-menu.mjs.map +1 -1
- package/fesm2022/ngwr-cookie.mjs +3 -3
- package/fesm2022/ngwr-copy-value.mjs +3 -3
- package/fesm2022/ngwr-counter.mjs +6 -6
- package/fesm2022/ngwr-date-picker-testing.mjs +30 -4
- package/fesm2022/ngwr-date-picker-testing.mjs.map +1 -1
- package/fesm2022/ngwr-date-picker.mjs +342 -69
- package/fesm2022/ngwr-date-picker.mjs.map +1 -1
- package/fesm2022/ngwr-date-stamp.mjs +3 -3
- package/fesm2022/ngwr-date.mjs +59 -8
- package/fesm2022/ngwr-date.mjs.map +1 -1
- package/fesm2022/ngwr-density.mjs +6 -6
- package/fesm2022/ngwr-descriptions.mjs +6 -6
- package/fesm2022/ngwr-dialog.mjs +18 -18
- package/fesm2022/ngwr-directives.mjs +15 -15
- package/fesm2022/ngwr-divider.mjs +3 -3
- package/fesm2022/ngwr-drawer.mjs +51 -29
- package/fesm2022/ngwr-drawer.mjs.map +1 -1
- package/fesm2022/ngwr-dropdown-testing.mjs +11 -3
- package/fesm2022/ngwr-dropdown-testing.mjs.map +1 -1
- package/fesm2022/ngwr-dropdown.mjs +70 -99
- package/fesm2022/ngwr-dropdown.mjs.map +1 -1
- package/fesm2022/ngwr-editor.mjs +4 -3
- package/fesm2022/ngwr-editor.mjs.map +1 -1
- package/fesm2022/ngwr-empty.mjs +3 -3
- package/fesm2022/ngwr-event-calendar.mjs +186 -33
- package/fesm2022/ngwr-event-calendar.mjs.map +1 -1
- package/fesm2022/ngwr-file-upload-testing.mjs +34 -2
- package/fesm2022/ngwr-file-upload-testing.mjs.map +1 -1
- package/fesm2022/ngwr-file-upload.mjs +279 -16
- package/fesm2022/ngwr-file-upload.mjs.map +1 -1
- package/fesm2022/ngwr-form.mjs +9 -9
- package/fesm2022/ngwr-form.mjs.map +1 -1
- package/fesm2022/ngwr-graph-testing.mjs +30 -0
- package/fesm2022/ngwr-graph-testing.mjs.map +1 -1
- package/fesm2022/ngwr-graph.mjs +664 -43
- package/fesm2022/ngwr-graph.mjs.map +1 -1
- package/fesm2022/ngwr-hotkey.mjs +6 -6
- package/fesm2022/ngwr-i18n-ar.mjs +27 -8
- package/fesm2022/ngwr-i18n-ar.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-cs.mjs +27 -8
- package/fesm2022/ngwr-i18n-cs.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-de.mjs +27 -8
- package/fesm2022/ngwr-i18n-de.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-en.mjs +27 -8
- package/fesm2022/ngwr-i18n-en.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-es.mjs +27 -8
- package/fesm2022/ngwr-i18n-es.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-fr.mjs +27 -8
- package/fesm2022/ngwr-i18n-fr.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-he.mjs +27 -8
- package/fesm2022/ngwr-i18n-he.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-hi.mjs +27 -8
- package/fesm2022/ngwr-i18n-hi.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-id.mjs +27 -8
- package/fesm2022/ngwr-i18n-id.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-it.mjs +27 -8
- package/fesm2022/ngwr-i18n-it.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-ja.mjs +27 -8
- package/fesm2022/ngwr-i18n-ja.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-ko.mjs +27 -8
- package/fesm2022/ngwr-i18n-ko.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-nl.mjs +27 -8
- package/fesm2022/ngwr-i18n-nl.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-pl.mjs +27 -8
- package/fesm2022/ngwr-i18n-pl.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-pt.mjs +27 -8
- package/fesm2022/ngwr-i18n-pt.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-ru.mjs +27 -8
- package/fesm2022/ngwr-i18n-ru.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-sv.mjs +27 -8
- package/fesm2022/ngwr-i18n-sv.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-tr.mjs +27 -8
- package/fesm2022/ngwr-i18n-tr.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-uk.mjs +27 -8
- package/fesm2022/ngwr-i18n-uk.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-vi.mjs +27 -8
- package/fesm2022/ngwr-i18n-vi.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-zh-tw.mjs +27 -8
- package/fesm2022/ngwr-i18n-zh-tw.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-zh.mjs +27 -8
- package/fesm2022/ngwr-i18n-zh.mjs.map +1 -1
- package/fesm2022/ngwr-i18n.mjs +9 -9
- package/fesm2022/ngwr-icon.mjs +6 -6
- package/fesm2022/ngwr-image-cropper.mjs +3 -3
- package/fesm2022/ngwr-input-number-testing.mjs +11 -0
- package/fesm2022/ngwr-input-number-testing.mjs.map +1 -1
- package/fesm2022/ngwr-input-number.mjs +68 -7
- package/fesm2022/ngwr-input-number.mjs.map +1 -1
- package/fesm2022/ngwr-input-otp.mjs +23 -3
- package/fesm2022/ngwr-input-otp.mjs.map +1 -1
- package/fesm2022/ngwr-input-testing.mjs +24 -1
- package/fesm2022/ngwr-input-testing.mjs.map +1 -1
- package/fesm2022/ngwr-input.mjs +152 -36
- package/fesm2022/ngwr-input.mjs.map +1 -1
- package/fesm2022/ngwr-keyboard.mjs +3 -3
- package/fesm2022/ngwr-knob.mjs +3 -3
- package/fesm2022/ngwr-layout.mjs +15 -15
- package/fesm2022/ngwr-lightbox.mjs +8 -8
- package/fesm2022/ngwr-lightbox.mjs.map +1 -1
- package/fesm2022/ngwr-list.mjs +8 -8
- package/fesm2022/ngwr-list.mjs.map +1 -1
- package/fesm2022/ngwr-load-state.mjs +15 -15
- package/fesm2022/ngwr-loading-bar.mjs +6 -6
- package/fesm2022/ngwr-mention.mjs +6 -6
- package/fesm2022/ngwr-meta.mjs +6 -6
- package/fesm2022/ngwr-overlay.mjs +175 -13
- package/fesm2022/ngwr-overlay.mjs.map +1 -1
- package/fesm2022/ngwr-page-header.mjs +3 -3
- package/fesm2022/ngwr-pagination.mjs +6 -3
- package/fesm2022/ngwr-pagination.mjs.map +1 -1
- package/fesm2022/ngwr-pipes.mjs +31 -29
- package/fesm2022/ngwr-pipes.mjs.map +1 -1
- package/fesm2022/ngwr-platform.mjs +9 -9
- package/fesm2022/ngwr-popconfirm-testing.mjs +5 -2
- package/fesm2022/ngwr-popconfirm-testing.mjs.map +1 -1
- package/fesm2022/ngwr-popconfirm.mjs +44 -63
- package/fesm2022/ngwr-popconfirm.mjs.map +1 -1
- package/fesm2022/ngwr-popover-testing.mjs +7 -1
- package/fesm2022/ngwr-popover-testing.mjs.map +1 -1
- package/fesm2022/ngwr-popover.mjs +58 -156
- package/fesm2022/ngwr-popover.mjs.map +1 -1
- package/fesm2022/ngwr-progress.mjs +50 -9
- package/fesm2022/ngwr-progress.mjs.map +1 -1
- package/fesm2022/ngwr-pull-to-refresh-testing.mjs +57 -0
- package/fesm2022/ngwr-pull-to-refresh-testing.mjs.map +1 -0
- package/fesm2022/ngwr-pull-to-refresh.mjs +3 -3
- package/fesm2022/ngwr-qr.mjs +3 -3
- package/fesm2022/ngwr-radio.mjs +6 -6
- package/fesm2022/ngwr-rating.mjs +3 -3
- package/fesm2022/ngwr-resizable-testing.mjs +113 -0
- package/fesm2022/ngwr-resizable-testing.mjs.map +1 -0
- package/fesm2022/ngwr-resizable.mjs +3 -3
- package/fesm2022/ngwr-result.mjs +12 -12
- package/fesm2022/ngwr-schema-form-testing.mjs +336 -0
- package/fesm2022/ngwr-schema-form-testing.mjs.map +1 -0
- package/fesm2022/ngwr-schema-form.mjs +416 -19
- package/fesm2022/ngwr-schema-form.mjs.map +1 -1
- package/fesm2022/ngwr-scroll.mjs +3 -3
- package/fesm2022/ngwr-segmented.mjs +3 -3
- package/fesm2022/ngwr-select-testing.mjs +19 -0
- package/fesm2022/ngwr-select-testing.mjs.map +1 -1
- package/fesm2022/ngwr-select.mjs +361 -84
- package/fesm2022/ngwr-select.mjs.map +1 -1
- package/fesm2022/ngwr-sidebar-testing.mjs +176 -0
- package/fesm2022/ngwr-sidebar-testing.mjs.map +1 -0
- package/fesm2022/ngwr-sidebar.mjs +3 -3
- package/fesm2022/ngwr-skeleton.mjs +3 -3
- package/fesm2022/ngwr-slider-testing.mjs +6 -0
- package/fesm2022/ngwr-slider-testing.mjs.map +1 -1
- package/fesm2022/ngwr-slider.mjs +21 -3
- package/fesm2022/ngwr-slider.mjs.map +1 -1
- package/fesm2022/ngwr-sortable-list.mjs +29 -12
- package/fesm2022/ngwr-sortable-list.mjs.map +1 -1
- package/fesm2022/ngwr-speed-dial.mjs +3 -3
- package/fesm2022/ngwr-spinner.mjs +3 -3
- package/fesm2022/ngwr-splitter.mjs +3 -3
- package/fesm2022/ngwr-statistic.mjs +9 -9
- package/fesm2022/ngwr-stepper.mjs +42 -11
- package/fesm2022/ngwr-stepper.mjs.map +1 -1
- package/fesm2022/ngwr-storage.mjs +3 -3
- package/fesm2022/ngwr-switch.mjs +3 -3
- package/fesm2022/ngwr-table-testing.mjs +157 -3
- package/fesm2022/ngwr-table-testing.mjs.map +1 -1
- package/fesm2022/ngwr-table.mjs +1051 -74
- package/fesm2022/ngwr-table.mjs.map +1 -1
- package/fesm2022/ngwr-tabs-router.mjs +3 -3
- package/fesm2022/ngwr-tabs-testing.mjs +1 -1
- package/fesm2022/ngwr-tabs-testing.mjs.map +1 -1
- package/fesm2022/ngwr-tabs.mjs +15 -10
- package/fesm2022/ngwr-tabs.mjs.map +1 -1
- package/fesm2022/ngwr-textarea-testing.mjs +11 -0
- package/fesm2022/ngwr-textarea-testing.mjs.map +1 -1
- package/fesm2022/ngwr-textarea.mjs +128 -16
- package/fesm2022/ngwr-textarea.mjs.map +1 -1
- package/fesm2022/ngwr-theme.mjs +3 -3
- package/fesm2022/ngwr-timeline.mjs +6 -6
- package/fesm2022/ngwr-toast.mjs +40 -19
- package/fesm2022/ngwr-toast.mjs.map +1 -1
- package/fesm2022/ngwr-toolbar.mjs +3 -3
- package/fesm2022/ngwr-tour-testing.mjs +13 -1
- package/fesm2022/ngwr-tour-testing.mjs.map +1 -1
- package/fesm2022/ngwr-tour.mjs +19 -15
- package/fesm2022/ngwr-tour.mjs.map +1 -1
- package/fesm2022/ngwr-transfer-testing.mjs +6 -0
- package/fesm2022/ngwr-transfer-testing.mjs.map +1 -1
- package/fesm2022/ngwr-transfer.mjs +24 -5
- package/fesm2022/ngwr-transfer.mjs.map +1 -1
- package/fesm2022/ngwr-tree-testing.mjs +62 -2
- package/fesm2022/ngwr-tree-testing.mjs.map +1 -1
- package/fesm2022/ngwr-tree.mjs +978 -79
- package/fesm2022/ngwr-tree.mjs.map +1 -1
- package/fesm2022/ngwr-typography.mjs +3 -3
- package/fesm2022/ngwr-utils-router.mjs +3 -3
- package/fesm2022/ngwr-utils.mjs +97 -1
- package/fesm2022/ngwr-utils.mjs.map +1 -1
- package/fesm2022/ngwr-version.mjs +1 -1
- package/fesm2022/ngwr-version.mjs.map +1 -1
- package/fesm2022/ngwr-virtual-scroll.mjs +3 -3
- package/fesm2022/ngwr-window.mjs +33 -22
- package/fesm2022/ngwr-window.mjs.map +1 -1
- package/file-upload/styles/_index.scss +156 -0
- package/graph/styles/_index.scss +87 -0
- package/i18n/ar.json +29 -8
- package/i18n/cs.json +29 -8
- package/i18n/de.json +29 -8
- package/i18n/en.json +29 -8
- package/i18n/es.json +29 -8
- package/i18n/fr.json +29 -8
- package/i18n/he.json +29 -8
- package/i18n/hi.json +29 -8
- package/i18n/id.json +29 -8
- package/i18n/it.json +29 -8
- package/i18n/ja.json +29 -8
- package/i18n/ko.json +29 -8
- package/i18n/nl.json +29 -8
- package/i18n/pl.json +29 -8
- package/i18n/pt.json +29 -8
- package/i18n/ru.json +29 -8
- package/i18n/sv.json +29 -8
- package/i18n/tr.json +29 -8
- package/i18n/uk.json +29 -8
- package/i18n/vi.json +29 -8
- package/i18n/zh-TW.json +29 -8
- package/i18n/zh.json +29 -8
- package/input/styles/_index.scss +68 -1
- package/input-otp/styles/_index.scss +14 -0
- package/llms-full.txt +53 -21
- package/llms.txt +57 -24
- package/overlay/styles/_arrow.scss +4 -4
- package/package.json +33 -1
- package/popconfirm/styles/_index.scss +3 -11
- package/progress/styles/_index.scss +32 -0
- package/schema-form/styles/_index.scss +78 -0
- package/schematics/collection.json +5 -0
- package/schematics/eject/index.js +158 -0
- package/schematics/eject/schema.js +8 -0
- package/schematics/eject/schema.json +24 -0
- package/schematics/eject/source.js +295 -0
- package/schematics/use/rule.js +2 -0
- package/schematics/use/symbol-map.json +5 -0
- package/select/styles/_index.scss +127 -22
- package/skills/ngwr/SKILL.md +31 -4
- package/skills/ngwr/references/catalog.md +9 -1
- package/slider/styles/_index.scss +22 -0
- package/table/styles/_index.scss +191 -3
- package/textarea/styles/_index.scss +80 -0
- package/theme/styles/_focus.scss +16 -1
- package/theme/styles/_motion.scss +5 -0
- package/transfer/styles/_index.scss +84 -0
- package/tree/styles/_index.scss +138 -5
- package/types/ngwr-alert-testing.d.ts +88 -0
- package/types/ngwr-badge.d.ts +72 -2
- package/types/ngwr-breadcrumbs-testing.d.ts +92 -0
- package/types/ngwr-burger-testing.d.ts +51 -0
- package/types/ngwr-calendar-testing.d.ts +18 -6
- package/types/ngwr-calendar.d.ts +272 -22
- package/types/ngwr-carousel-testing.d.ts +27 -6
- package/types/ngwr-carousel.d.ts +42 -6
- package/types/ngwr-cascader.d.ts +13 -6
- package/types/ngwr-charts-chart-legend.d.ts +9 -4
- package/types/ngwr-charts-line-chart-testing.d.ts +4 -1
- package/types/ngwr-charts-line-chart.d.ts +7 -4
- package/types/ngwr-color-picker-testing.d.ts +15 -4
- package/types/ngwr-color-picker.d.ts +76 -6
- package/types/ngwr-compare-testing.d.ts +72 -0
- package/types/ngwr-context-menu.d.ts +2 -0
- package/types/ngwr-date-picker-testing.d.ts +23 -8
- package/types/ngwr-date-picker.d.ts +100 -9
- package/types/ngwr-date.d.ts +71 -1
- package/types/ngwr-drawer.d.ts +9 -0
- package/types/ngwr-dropdown-testing.d.ts +20 -0
- package/types/ngwr-dropdown.d.ts +26 -6
- package/types/ngwr-event-calendar.d.ts +66 -8
- package/types/ngwr-file-upload-testing.d.ts +31 -2
- package/types/ngwr-file-upload.d.ts +156 -3
- package/types/ngwr-form.d.ts +47 -3
- package/types/ngwr-graph-testing.d.ts +36 -3
- package/types/ngwr-graph.d.ts +309 -13
- package/types/ngwr-input-number-testing.d.ts +10 -0
- package/types/ngwr-input-number.d.ts +30 -1
- package/types/ngwr-input-otp.d.ts +10 -0
- package/types/ngwr-input-testing.d.ts +30 -0
- package/types/ngwr-input.d.ts +54 -3
- package/types/ngwr-overlay.d.ts +84 -5
- package/types/ngwr-pipes.d.ts +2 -1
- package/types/ngwr-popconfirm-testing.d.ts +12 -3
- package/types/ngwr-popconfirm.d.ts +28 -3
- package/types/ngwr-popover-testing.d.ts +19 -2
- package/types/ngwr-popover.d.ts +22 -2
- package/types/ngwr-progress.d.ts +29 -1
- package/types/ngwr-pull-to-refresh-testing.d.ts +83 -0
- package/types/ngwr-resizable-testing.d.ts +116 -0
- package/types/ngwr-schema-form-testing.d.ts +260 -0
- package/types/ngwr-schema-form.d.ts +76 -6
- package/types/ngwr-select-testing.d.ts +20 -0
- package/types/ngwr-select.d.ts +149 -11
- package/types/ngwr-sidebar-testing.d.ts +176 -0
- package/types/ngwr-slider-testing.d.ts +3 -1
- package/types/ngwr-slider.d.ts +21 -1
- package/types/ngwr-sortable-list.d.ts +6 -0
- package/types/ngwr-stepper.d.ts +20 -11
- package/types/ngwr-table-testing.d.ts +122 -7
- package/types/ngwr-table.d.ts +572 -50
- package/types/ngwr-tabs-testing.d.ts +14 -17
- package/types/ngwr-tabs.d.ts +6 -0
- package/types/ngwr-textarea-testing.d.ts +10 -0
- package/types/ngwr-textarea.d.ts +48 -2
- package/types/ngwr-toast.d.ts +8 -1
- package/types/ngwr-tour-testing.d.ts +10 -0
- package/types/ngwr-tour.d.ts +11 -2
- package/types/ngwr-transfer-testing.d.ts +3 -0
- package/types/ngwr-transfer.d.ts +24 -1
- package/types/ngwr-tree-testing.d.ts +65 -1
- package/types/ngwr-tree.d.ts +335 -12
- package/types/ngwr-utils.d.ts +107 -1
- package/types/ngwr-version.d.ts +1 -1
- package/types/ngwr-window.d.ts +7 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ngwr-comment.mjs","names":[],"sources":["../../../projects/lib/comment/comment.ts","../../../projects/lib/comment/comment.html","../../../projects/lib/comment/comment-composer.ts","../../../projects/lib/comment/comment-composer.html"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { Component, ViewEncapsulation, computed, input } from '@angular/core';\n\nimport { useI18nText } from 'ngwr/i18n';\nimport { wrCheckStyles } from 'ngwr/utils';\n\nimport type { WrCommentSide, WrCommentVariant } from './types';\n\n/**\n * One entry in a discussion or a chat: avatar, author, time, body, actions and\n * nested replies. The data stays with the app: the component takes no array,\n * fetches nothing and sorts nothing. Everything is projected or passed as a\n * string, and the app formats the time itself (`wrDate` is the usual route).\n *\n * Slots, each optional:\n *\n * - `<wr-avatar>` or `[wrCommentAvatar]` for the avatar column\n * - `[wrCommentAuthor]` for an author drawn by the app (a profile link) in\n * place of the `author` input\n * - default content for the body\n * - `[wrCommentActions]` for the action row under the body\n * - nested `<wr-comment>` elements, or a `[wrCommentReplies]` wrapper, for\n * replies; they indent twice, and deeper levels sit flush with their parent\n * so a phone keeps room for the body\n *\n * The host is an `article` named after the author, replies sit in a `group`\n * named by `repliesLabel`, and no heading level is assumed: the page owns the\n * outline. Wrap a thread in a list and a chat in `role=\"log\"`.\n *\n * `variant=\"bubble\"` draws the body as a chat bubble; `side=\"end\"` puts it on\n * the reader's own side of the log.\n *\n * @example\n * ```html\n * <wr-comment author=\"Ann\" time=\"2 hours ago\" [datetime]=\"posted\">\n * <wr-avatar size=\"2.5rem\" alt=\"\">AN</wr-avatar>\n * Looks good to me.\n * <div wrCommentActions><button wr-btn size=\"sm\">Reply</button></div>\n * <wr-comment author=\"Bob\" time=\"an hour ago\">Thanks!</wr-comment>\n * </wr-comment>\n *\n * <wr-comment variant=\"bubble\" side=\"end\" time=\"09:41\">On my way.</wr-comment>\n * ```\n *\n * @see https://ngwr.dev/reference/components/comment\n */\n@Component({\n selector: 'wr-comment',\n templateUrl: './comment.html',\n encapsulation: ViewEncapsulation.None,\n host: {\n class: 'wr-comment',\n '[class]': 'classes()',\n role: 'article',\n '[attr.aria-label]': 'author() || null',\n },\n})\nexport class WrComment {\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('comment');\n }\n\n /**\n * Who wrote it. Also the article's accessible name. Leave it empty when a\n * `[wrCommentAuthor]` element draws the name instead.\n *\n * @default ''\n */\n readonly author = input<string>('');\n\n /**\n * When it was written, already formatted: the component does no date\n * formatting. Run a `Date` through the `wrDate` pipe on the way in.\n *\n * @default ''\n */\n readonly time = input<string>('');\n\n /**\n * The same moment, machine-readable. With it the time renders as a\n * `<time datetime>`: a `Date` is written as ISO 8601, a string as given.\n *\n * @default null\n */\n readonly datetime = input<Date | string | null>(null);\n\n /**\n * `row` is a discussion entry; `bubble` is a chat message, which takes no replies.\n *\n * @default 'row'\n */\n readonly variant = input<WrCommentVariant>('row');\n\n /**\n * Which inline side a bubble sits on. `end` is the reader's own message.\n * Ignored by the `row` variant.\n *\n * @default 'start'\n */\n readonly side = input<WrCommentSide>('start');\n\n /** Accessible name of the replies group. Falls back to `comment.replies`, then `'Replies'`. */\n readonly repliesLabel = input<string | null>(null);\n\n protected readonly resolvedRepliesLabel = useI18nText(this.repliesLabel, 'comment.replies', 'Replies');\n\n protected readonly isoDatetime = computed(() => {\n const value = this.datetime();\n if (value === null) return null;\n if (value instanceof Date) return Number.isNaN(value.getTime()) ? null : value.toISOString();\n return value || null;\n });\n\n protected readonly classes = computed(() => {\n const parts: string[] = [];\n if (this.variant() === 'bubble') parts.push('wr-comment--bubble', `wr-comment--${this.side()}`);\n return parts.join(' ');\n });\n}\n","<div class=\"wr-comment__avatar\">\n <ng-content select=\"wr-avatar, [wrCommentAvatar]\" />\n</div>\n\n<div class=\"wr-comment__main\">\n <div class=\"wr-comment__head\">\n @if (author(); as name) {\n <span class=\"wr-comment__author\">{{ name }}</span>\n }\n <ng-content select=\"[wrCommentAuthor]\" />\n @if (time(); as printed) {\n @if (isoDatetime(); as iso) {\n <time class=\"wr-comment__time\" [attr.datetime]=\"iso\">{{ printed }}</time>\n } @else {\n <span class=\"wr-comment__time\">{{ printed }}</span>\n }\n }\n </div>\n\n <div class=\"wr-comment__body\"><ng-content /></div>\n\n <div class=\"wr-comment__actions\">\n <ng-content select=\"[wrCommentActions]\" />\n </div>\n</div>\n\n<div class=\"wr-comment__replies\" role=\"group\" [attr.aria-label]=\"resolvedRepliesLabel()\">\n <ng-content select=\"wr-comment, [wrCommentReplies]\" />\n</div>\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { coerceBooleanProperty, coerceNumberProperty } from '@angular/cdk/coercion';\nimport {\n Component,\n ElementRef,\n ViewEncapsulation,\n computed,\n inject,\n input,\n model,\n output,\n viewChild,\n} from '@angular/core';\nimport type { FormValueControl } from '@angular/forms/signals';\n\nimport { WrButton } from 'ngwr/button';\nimport { useI18nText } from 'ngwr/i18n';\nimport { WrTextarea } from 'ngwr/textarea';\nimport { wrIsComposing, WR_KEYS, wrCheckStyles } from 'ngwr/utils';\n\n/**\n * A chat composer: an autosizing field with a send button. Enter sends,\n * Shift+Enter adds a line, Ctrl+Enter and Cmd+Enter always send. The text is\n * emitted through `send` and the composer decides nothing about where it goes.\n *\n * A signal-forms native control: it implements `FormValueControl<string>`, so\n * `[formField]` binds straight to its `value` model. `[(value)]` works\n * standalone.\n *\n * What sends and what does not:\n *\n * - Whitespace-only text never sends; the button is disabled until there is\n * something to send, and Enter does nothing.\n * - `disabled`, `readonly` and `sending` all block sending and keep the text.\n * `sending` also marks the composer `aria-busy`; the field stays editable so\n * the next message can be typed.\n * - An Enter that confirms an IME composition never sends. Both signals are\n * read, `isComposing` and `keyCode === 229`, because Safari fires\n * `compositionend` before the keydown, so `isComposing` is already `false`\n * on the committing keystroke.\n *\n * The text is trimmed and, with `clearOnSend` (the default), the field is\n * cleared BEFORE `send` emits: an app whose request fails puts the text back\n * through the composer's own model, `composer.value.set(text)`, at any time,\n * and nothing overwrites it. A model bound with `[(value)]` takes that write\n * only once change detection has run in between: written back synchronously\n * from the handler, the bound expression still holds the value Angular last\n * bound, so the input is skipped. An app that would rather keep the text until\n * the request succeeds sets `[clearOnSend]=\"false\"` and clears the model\n * itself. Focus stays in the field after sending, unless the `send` handler\n * moved it.\n *\n * @example\n * ```html\n * <wr-comment-composer placeholder=\"Message\" [(value)]=\"draft\" (send)=\"post($event)\" />\n *\n * <wr-comment-composer [sending]=\"posting()\" [clearOnSend]=\"false\" (send)=\"post($event)\">\n * <button wrComposerActions wr-btn size=\"sm\">Attach</button>\n * </wr-comment-composer>\n * ```\n *\n * @see https://ngwr.dev/reference/components/comment\n */\n@Component({\n selector: 'wr-comment-composer',\n templateUrl: './comment-composer.html',\n imports: [WrButton, WrTextarea],\n encapsulation: ViewEncapsulation.None,\n host: {\n class: 'wr-comment-composer',\n '[class]': 'classes()',\n '[attr.aria-busy]': 'sending() ? \"true\" : null',\n },\n})\nexport class WrCommentComposer implements FormValueControl<string> {\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('comment');\n }\n\n /** Native placeholder text. @default '' */\n readonly placeholder = input<string>('');\n\n /**\n * Accessible name for the field. Falls back to the placeholder: the native\n * `<textarea>` lives inside the component, so a `<label for>` outside cannot\n * reach it.\n */\n readonly ariaLabel = input<string | null>(null);\n\n /** Accessible name of the send button. Falls back to `comment.send`, then `'Send'`. */\n readonly sendLabel = input<string | null>(null);\n\n /** Visible row count while the field is empty. @default 1 */\n readonly rows = input(1, { transform: (v: unknown): number => coerceNumberProperty(v, 1) });\n\n /** Rows the field grows to before it scrolls on its own. @default 6 */\n readonly maxRows = input(6, { transform: (v: unknown): number => coerceNumberProperty(v, 6) });\n\n /**\n * Disable the field and the button. Bound automatically from the field's\n * disabled state when used with `[formField]`. The text is kept.\n *\n * @default false\n */\n readonly disabled = input(false, { transform: coerceBooleanProperty });\n\n /**\n * Read-only state: the text is shown and announced, keeps its tab stop and\n * cannot be edited or sent.\n *\n * @default false\n */\n readonly readonly = input(false, { transform: coerceBooleanProperty });\n\n /**\n * A send is in flight: the button is disabled, the host is `aria-busy` and\n * Enter does nothing. The field stays editable and the text is kept.\n *\n * @default false\n */\n readonly sending = input(false, { transform: coerceBooleanProperty });\n\n /**\n * `true`: Enter sends and Shift+Enter adds a line. `false`: Enter adds a line\n * and only Ctrl+Enter or Cmd+Enter sends.\n *\n * @default true\n */\n readonly enterSends = input(true, { transform: coerceBooleanProperty });\n\n /**\n * Clear the field before `send` emits. With `false` the text stays until the\n * app clears the model itself.\n *\n * @default true\n */\n readonly clearOnSend = input(true, { transform: coerceBooleanProperty });\n\n /** The draft. Bound by `[formField]`, or two-way via `[(value)]`. */\n readonly value = model<string>('');\n\n /** Emitted on blur so a bound field can mark itself touched. */\n readonly touch = output<void>();\n\n /** The trimmed text, once per send. Where it goes is the app's business. */\n readonly send = output<string>();\n\n protected readonly resolvedSendLabel = useI18nText(this.sendLabel, 'comment.send', 'Send');\n\n /** Whether a send would go through right now. */\n protected readonly canSend = computed(\n () => this.value().trim() !== '' && !this.disabled() && !this.readonly() && !this.sending()\n );\n\n protected readonly classes = computed(() => {\n const parts: string[] = [];\n if (this.disabled()) parts.push('wr-comment-composer--disabled');\n if (this.readonly()) parts.push('wr-comment-composer--readonly');\n if (this.sending()) parts.push('wr-comment-composer--sending');\n return parts.join(' ');\n });\n\n private readonly field = viewChild.required(WrTextarea);\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\n\n /** Focus the field, which is what Signal Forms calls to focus this control. */\n focus(options?: FocusOptions): void {\n this.field().focus(options);\n }\n\n /**\n * Send the current text, exactly as the button and Enter do: nothing happens\n * for whitespace-only text or while `disabled`, `readonly` or `sending`.\n */\n submit(): void {\n if (!this.canSend()) return;\n const text = this.value().trim();\n const hadFocus = this.host.nativeElement.contains(this.host.nativeElement.ownerDocument.activeElement);\n if (this.clearOnSend()) this.value.set('');\n this.send.emit(text);\n // A keyboard user is on the button, which sending just disabled: hand focus\n // back unless the handler moved it. A pointer never took it (see the template).\n if (hadFocus && this.host.nativeElement.contains(this.host.nativeElement.ownerDocument.activeElement)) {\n this.focus();\n }\n }\n\n protected onKeydown(event: KeyboardEvent): void {\n if (event.key !== WR_KEYS.ENTER || wrIsComposing(event)) return;\n const modifier = event.ctrlKey || event.metaKey;\n if (!modifier && (event.shiftKey || event.altKey || !this.enterSends())) return;\n // A sending Enter never reaches the field: on empty text it would only add\n // blank lines that the next send trims away.\n event.preventDefault();\n this.submit();\n }\n}\n","<wr-textarea\n class=\"wr-comment-composer__field\"\n autosize\n [rows]=\"rows()\"\n [maxRows]=\"maxRows()\"\n [resizable]=\"false\"\n [placeholder]=\"placeholder()\"\n [ariaLabel]=\"ariaLabel()\"\n [disabled]=\"disabled()\"\n [readonly]=\"readonly()\"\n [(value)]=\"value\"\n (touch)=\"touch.emit()\"\n (keydown)=\"onKeydown($event)\"\n/>\n\n<div class=\"wr-comment-composer__actions\">\n <ng-content select=\"[wrComposerActions]\" />\n</div>\n\n<button\n wr-btn\n type=\"button\"\n color=\"primary\"\n shape=\"pill\"\n class=\"wr-comment-composer__send\"\n [attr.aria-label]=\"resolvedSendLabel()\"\n [disabled]=\"!canSend()\"\n (mousedown)=\"$event.preventDefault()\"\n (click)=\"submit()\"\n>\n <svg\n class=\"wr-icon__svg\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n >\n <path\n d=\"M3.714 3.048a.498.498 0 0 0-.683.627l2.843 7.627a2 2 0 0 1 0 1.396l-2.842 7.627a.498.498 0 0 0 .682.627l18-8.5a.5.5 0 0 0 0-.904z\"\n />\n <path d=\"M6 12h16\" />\n </svg>\n</button>\n"],"mappings":";;;;;;;;;;;;;AA+DA,IAAa,YAAb,MAAa,UAAS;CACpB,cAAA;EACE,IAAI,OAAO,cAAc,eAAe,WAAW,cAAc,SAAS;CAC5E;CAQS,SAAS,MAAc,IAAG,GAAA,YAAA,CAAA,EAAA,WAAA,SAAA,CAAA,+BAAA,CAAA,CAAA;CAQ1B,OAAO,MAAc,IAAG,GAAA,YAAA,CAAA,EAAA,WAAA,OAAA,CAAA,+BAAA,CAAA,CAAA;CAQxB,WAAW,MAA4B,MAAK,GAAA,YAAA,CAAA,EAAA,WAAA,WAAA,CAAA,+BAAA,CAAA,CAAA;CAO5C,UAAU,MAAwB,OAAM,GAAA,YAAA,CAAA,EAAA,WAAA,UAAA,CAAA,+BAAA,CAAA,CAAA;CAQxC,OAAO,MAAqB,SAAQ,GAAA,YAAA,CAAA,EAAA,WAAA,OAAA,CAAA,+BAAA,CAAA,CAAA;CAGpC,eAAe,MAAqB,MAAK,GAAA,YAAA,CAAA,EAAA,WAAA,eAAA,CAAA,+BAAA,CAAA,CAAA;CAE/B,uBAAuB,YAAY,KAAK,cAAc,mBAAmB,SAAS;CAElF,cAAc,eAAc;EAC7C,MAAM,QAAQ,KAAK,SAAQ;EAC3B,IAAI,UAAU,MAAM,OAAO;EAC3B,IAAI,iBAAiB,MAAM,OAAO,OAAO,MAAM,MAAM,QAAO,CAAE,IAAI,O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;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,aAAA;EAAA,CAAA;EAAA,OAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,OAAA;EAAA,CAAA;EAAA,MAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,MAAA;EAAA,CAAA;EAAA,OAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,GAAA,iBAAA,UAAU,GAAA,EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;CAAA;AAAA,CAAA"}
|
|
1
|
+
{"version":3,"file":"ngwr-comment.mjs","names":[],"sources":["../../../projects/lib/comment/comment.ts","../../../projects/lib/comment/comment.html","../../../projects/lib/comment/comment-composer.ts","../../../projects/lib/comment/comment-composer.html"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { Component, ViewEncapsulation, computed, input } from '@angular/core';\n\nimport { useI18nText } from 'ngwr/i18n';\nimport { wrCheckStyles } from 'ngwr/utils';\n\nimport type { WrCommentSide, WrCommentVariant } from './types';\n\n/**\n * One entry in a discussion or a chat: avatar, author, time, body, actions and\n * nested replies. The data stays with the app: the component takes no array,\n * fetches nothing and sorts nothing. Everything is projected or passed as a\n * string, and the app formats the time itself (`wrDate` is the usual route).\n *\n * Slots, each optional:\n *\n * - `<wr-avatar>` or `[wrCommentAvatar]` for the avatar column\n * - `[wrCommentAuthor]` for an author drawn by the app (a profile link) in\n * place of the `author` input\n * - default content for the body\n * - `[wrCommentActions]` for the action row under the body\n * - nested `<wr-comment>` elements, or a `[wrCommentReplies]` wrapper, for\n * replies; they indent twice, and deeper levels sit flush with their parent\n * so a phone keeps room for the body\n *\n * The host is an `article` named after the author, replies sit in a `group`\n * named by `repliesLabel`, and no heading level is assumed: the page owns the\n * outline. Wrap a thread in a list and a chat in `role=\"log\"`.\n *\n * `variant=\"bubble\"` draws the body as a chat bubble; `side=\"end\"` puts it on\n * the reader's own side of the log.\n *\n * @example\n * ```html\n * <wr-comment author=\"Ann\" time=\"2 hours ago\" [datetime]=\"posted\">\n * <wr-avatar size=\"2.5rem\" alt=\"\">AN</wr-avatar>\n * Looks good to me.\n * <div wrCommentActions><button wr-btn size=\"sm\">Reply</button></div>\n * <wr-comment author=\"Bob\" time=\"an hour ago\">Thanks!</wr-comment>\n * </wr-comment>\n *\n * <wr-comment variant=\"bubble\" side=\"end\" time=\"09:41\">On my way.</wr-comment>\n * ```\n *\n * @see https://ngwr.dev/reference/components/comment\n */\n@Component({\n selector: 'wr-comment',\n templateUrl: './comment.html',\n encapsulation: ViewEncapsulation.None,\n host: {\n class: 'wr-comment',\n '[class]': 'classes()',\n role: 'article',\n '[attr.aria-label]': 'author() || null',\n },\n})\nexport class WrComment {\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('comment');\n }\n\n /**\n * Who wrote it. Also the article's accessible name. Leave it empty when a\n * `[wrCommentAuthor]` element draws the name instead.\n *\n * @default ''\n */\n readonly author = input<string>('');\n\n /**\n * When it was written, already formatted: the component does no date\n * formatting. Run a `Date` through the `wrDate` pipe on the way in.\n *\n * @default ''\n */\n readonly time = input<string>('');\n\n /**\n * The same moment, machine-readable. With it the time renders as a\n * `<time datetime>`: a `Date` is written as ISO 8601, a string as given.\n *\n * @default null\n */\n readonly datetime = input<Date | string | null>(null);\n\n /**\n * `row` is a discussion entry; `bubble` is a chat message, which takes no replies.\n *\n * @default 'row'\n */\n readonly variant = input<WrCommentVariant>('row');\n\n /**\n * Which inline side a bubble sits on. `end` is the reader's own message.\n * Ignored by the `row` variant.\n *\n * @default 'start'\n */\n readonly side = input<WrCommentSide>('start');\n\n /** Accessible name of the replies group. Falls back to `comment.replies`, then `'Replies'`. */\n readonly repliesLabel = input<string | null>(null);\n\n protected readonly resolvedRepliesLabel = useI18nText(this.repliesLabel, 'comment.replies', 'Replies');\n\n protected readonly isoDatetime = computed(() => {\n const value = this.datetime();\n if (value === null) return null;\n if (value instanceof Date) return Number.isNaN(value.getTime()) ? null : value.toISOString();\n return value || null;\n });\n\n protected readonly classes = computed(() => {\n const parts: string[] = [];\n if (this.variant() === 'bubble') parts.push('wr-comment--bubble', `wr-comment--${this.side()}`);\n return parts.join(' ');\n });\n}\n","<div class=\"wr-comment__avatar\">\n <ng-content select=\"wr-avatar, [wrCommentAvatar]\" />\n</div>\n\n<div class=\"wr-comment__main\">\n <div class=\"wr-comment__head\">\n @if (author(); as name) {\n <span class=\"wr-comment__author\">{{ name }}</span>\n }\n <ng-content select=\"[wrCommentAuthor]\" />\n @if (time(); as printed) {\n @if (isoDatetime(); as iso) {\n <time class=\"wr-comment__time\" [attr.datetime]=\"iso\">{{ printed }}</time>\n } @else {\n <span class=\"wr-comment__time\">{{ printed }}</span>\n }\n }\n </div>\n\n <div class=\"wr-comment__body\"><ng-content /></div>\n\n <div class=\"wr-comment__actions\">\n <ng-content select=\"[wrCommentActions]\" />\n </div>\n</div>\n\n<div class=\"wr-comment__replies\" role=\"group\" [attr.aria-label]=\"resolvedRepliesLabel()\">\n <ng-content select=\"wr-comment, [wrCommentReplies]\" />\n</div>\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { coerceBooleanProperty, coerceNumberProperty } from '@angular/cdk/coercion';\nimport {\n Component,\n ElementRef,\n ViewEncapsulation,\n computed,\n inject,\n input,\n model,\n output,\n viewChild,\n} from '@angular/core';\nimport type { FormValueControl } from '@angular/forms/signals';\n\nimport { WrButton } from 'ngwr/button';\nimport { useI18nText } from 'ngwr/i18n';\nimport { WrTextarea } from 'ngwr/textarea';\nimport { wrIsComposing, WR_KEYS, wrCheckStyles } from 'ngwr/utils';\n\n/**\n * A chat composer: an autosizing field with a send button. Enter sends,\n * Shift+Enter adds a line, Ctrl+Enter and Cmd+Enter always send. The text is\n * emitted through `send` and the composer decides nothing about where it goes.\n *\n * A signal-forms native control: it implements `FormValueControl<string>`, so\n * `[formField]` binds straight to its `value` model. `[(value)]` works\n * standalone.\n *\n * What sends and what does not:\n *\n * - Whitespace-only text never sends; the button is disabled until there is\n * something to send, and Enter does nothing.\n * - `disabled`, `readonly` and `sending` all block sending and keep the text.\n * `sending` also marks the composer `aria-busy`; the field stays editable so\n * the next message can be typed.\n * - An Enter that confirms an IME composition never sends. Both signals are\n * read, `isComposing` and `keyCode === 229`, because Safari fires\n * `compositionend` before the keydown, so `isComposing` is already `false`\n * on the committing keystroke.\n *\n * The text is trimmed and, with `clearOnSend` (the default), the field is\n * cleared BEFORE `send` emits: an app whose request fails puts the text back\n * through the composer's own model, `composer.value.set(text)`, at any time,\n * and nothing overwrites it. A model bound with `[(value)]` takes that write\n * only once change detection has run in between: written back synchronously\n * from the handler, the bound expression still holds the value Angular last\n * bound, so the input is skipped. An app that would rather keep the text until\n * the request succeeds sets `[clearOnSend]=\"false\"` and clears the model\n * itself. Focus stays in the field after sending, unless the `send` handler\n * moved it.\n *\n * @example\n * ```html\n * <wr-comment-composer placeholder=\"Message\" [(value)]=\"draft\" (send)=\"post($event)\" />\n *\n * <wr-comment-composer [sending]=\"posting()\" [clearOnSend]=\"false\" (send)=\"post($event)\">\n * <button wrComposerActions wr-btn size=\"sm\">Attach</button>\n * </wr-comment-composer>\n * ```\n *\n * @see https://ngwr.dev/reference/components/comment\n */\n@Component({\n selector: 'wr-comment-composer',\n templateUrl: './comment-composer.html',\n imports: [WrButton, WrTextarea],\n encapsulation: ViewEncapsulation.None,\n host: {\n class: 'wr-comment-composer',\n '[class]': 'classes()',\n '[attr.aria-busy]': 'sending() ? \"true\" : null',\n },\n})\nexport class WrCommentComposer implements FormValueControl<string> {\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('comment');\n }\n\n /** Native placeholder text. @default '' */\n readonly placeholder = input<string>('');\n\n /**\n * Accessible name for the field. Falls back to the placeholder: the native\n * `<textarea>` lives inside the component, so a `<label for>` outside cannot\n * reach it.\n */\n readonly ariaLabel = input<string | null>(null);\n\n /** Accessible name of the send button. Falls back to `comment.send`, then `'Send'`. */\n readonly sendLabel = input<string | null>(null);\n\n /** Visible row count while the field is empty. @default 1 */\n readonly rows = input(1, { transform: (v: unknown): number => coerceNumberProperty(v, 1) });\n\n /** Rows the field grows to before it scrolls on its own. @default 6 */\n readonly maxRows = input(6, { transform: (v: unknown): number => coerceNumberProperty(v, 6) });\n\n /**\n * Disable the field and the button. Bound automatically from the field's\n * disabled state when used with `[formField]`. The text is kept.\n *\n * @default false\n */\n readonly disabled = input(false, { transform: coerceBooleanProperty });\n\n /**\n * Read-only state: the text is shown and announced, keeps its tab stop and\n * cannot be edited or sent.\n *\n * @default false\n */\n readonly readonly = input(false, { transform: coerceBooleanProperty });\n\n /**\n * A send is in flight: the button is disabled, the host is `aria-busy` and\n * Enter does nothing. The field stays editable and the text is kept.\n *\n * @default false\n */\n readonly sending = input(false, { transform: coerceBooleanProperty });\n\n /**\n * `true`: Enter sends and Shift+Enter adds a line. `false`: Enter adds a line\n * and only Ctrl+Enter or Cmd+Enter sends.\n *\n * @default true\n */\n readonly enterSends = input(true, { transform: coerceBooleanProperty });\n\n /**\n * Clear the field before `send` emits. With `false` the text stays until the\n * app clears the model itself.\n *\n * @default true\n */\n readonly clearOnSend = input(true, { transform: coerceBooleanProperty });\n\n /** The draft. Bound by `[formField]`, or two-way via `[(value)]`. */\n readonly value = model<string>('');\n\n /** Emitted on blur so a bound field can mark itself touched. */\n readonly touch = output<void>();\n\n /** The trimmed text, once per send. Where it goes is the app's business. */\n readonly send = output<string>();\n\n protected readonly resolvedSendLabel = useI18nText(this.sendLabel, 'comment.send', 'Send');\n\n /** Whether a send would go through right now. */\n protected readonly canSend = computed(\n () => this.value().trim() !== '' && !this.disabled() && !this.readonly() && !this.sending()\n );\n\n protected readonly classes = computed(() => {\n const parts: string[] = [];\n if (this.disabled()) parts.push('wr-comment-composer--disabled');\n if (this.readonly()) parts.push('wr-comment-composer--readonly');\n if (this.sending()) parts.push('wr-comment-composer--sending');\n return parts.join(' ');\n });\n\n private readonly field = viewChild.required(WrTextarea);\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\n\n /** Focus the field, which is what Signal Forms calls to focus this control. */\n focus(options?: FocusOptions): void {\n this.field().focus(options);\n }\n\n /**\n * Send the current text, exactly as the button and Enter do: nothing happens\n * for whitespace-only text or while `disabled`, `readonly` or `sending`.\n */\n submit(): void {\n if (!this.canSend()) return;\n const text = this.value().trim();\n const hadFocus = this.host.nativeElement.contains(this.host.nativeElement.ownerDocument.activeElement);\n if (this.clearOnSend()) this.value.set('');\n this.send.emit(text);\n // A keyboard user is on the button, which sending just disabled: hand focus\n // back unless the handler moved it. A pointer never took it (see the template).\n if (hadFocus && this.host.nativeElement.contains(this.host.nativeElement.ownerDocument.activeElement)) {\n this.focus();\n }\n }\n\n protected onKeydown(event: KeyboardEvent): void {\n if (event.key !== WR_KEYS.ENTER || wrIsComposing(event)) return;\n const modifier = event.ctrlKey || event.metaKey;\n if (!modifier && (event.shiftKey || event.altKey || !this.enterSends())) return;\n // A sending Enter never reaches the field: on empty text it would only add\n // blank lines that the next send trims away.\n event.preventDefault();\n this.submit();\n }\n}\n","<wr-textarea\n class=\"wr-comment-composer__field\"\n autosize\n [rows]=\"rows()\"\n [maxRows]=\"maxRows()\"\n [resizable]=\"false\"\n [placeholder]=\"placeholder()\"\n [ariaLabel]=\"ariaLabel()\"\n [disabled]=\"disabled()\"\n [readonly]=\"readonly()\"\n [(value)]=\"value\"\n (touch)=\"touch.emit()\"\n (keydown)=\"onKeydown($event)\"\n/>\n\n<div class=\"wr-comment-composer__actions\">\n <ng-content select=\"[wrComposerActions]\" />\n</div>\n\n<button\n wr-btn\n type=\"button\"\n color=\"primary\"\n shape=\"pill\"\n class=\"wr-comment-composer__send\"\n [attr.aria-label]=\"resolvedSendLabel()\"\n [disabled]=\"!canSend()\"\n (mousedown)=\"$event.preventDefault()\"\n (click)=\"submit()\"\n>\n <svg\n class=\"wr-icon__svg\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n >\n <path\n d=\"M3.714 3.048a.498.498 0 0 0-.683.627l2.843 7.627a2 2 0 0 1 0 1.396l-2.842 7.627a.498.498 0 0 0 .682.627l18-8.5a.5.5 0 0 0 0-.904z\"\n />\n <path d=\"M6 12h16\" />\n </svg>\n</button>\n"],"mappings":";;;;;;;;;;;;;AA+DA,IAAa,YAAb,MAAa,UAAS;CACpB,cAAA;EACE,IAAI,OAAO,cAAc,eAAe,WAAW,cAAc,SAAS;CAC5E;CAQS,SAAS,MAAc,IAAG,GAAA,YAAA,CAAA,EAAA,WAAA,SAAA,CAAA,+BAAA,CAAA,CAAA;CAQ1B,OAAO,MAAc,IAAG,GAAA,YAAA,CAAA,EAAA,WAAA,OAAA,CAAA,+BAAA,CAAA,CAAA;CAQxB,WAAW,MAA4B,MAAK,GAAA,YAAA,CAAA,EAAA,WAAA,WAAA,CAAA,+BAAA,CAAA,CAAA;CAO5C,UAAU,MAAwB,OAAM,GAAA,YAAA,CAAA,EAAA,WAAA,UAAA,CAAA,+BAAA,CAAA,CAAA;CAQxC,OAAO,MAAqB,SAAQ,GAAA,YAAA,CAAA,EAAA,WAAA,OAAA,CAAA,+BAAA,CAAA,CAAA;CAGpC,eAAe,MAAqB,MAAK,GAAA,YAAA,CAAA,EAAA,WAAA,eAAA,CAAA,+BAAA,CAAA,CAAA;CAE/B,uBAAuB,YAAY,KAAK,cAAc,mBAAmB,SAAS;CAElF,cAAc,eAAc;EAC7C,MAAM,QAAQ,KAAK,SAAQ;EAC3B,IAAI,UAAU,MAAM,OAAO;EAC3B,IAAI,iBAAiB,MAAM,OAAO,OAAO,MAAM,MAAM,QAAO,CAAE,IAAI,O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;GAAA,CAAA;EAAA,GAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,aAAA;EAAA,CAAA;EAAA,OAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,OAAA;EAAA,CAAA;EAAA,MAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,MAAA;EAAA,CAAA;EAAA,OAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,GAAA,iBAAA,UAAU,GAAA,EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;CAAA;AAAA,CAAA"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { ComponentHarness, HarnessPredicate, TestKey } from "@angular/cdk/testing";
|
|
2
|
+
/**
|
|
3
|
+
* @license
|
|
4
|
+
*
|
|
5
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
+
* found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE
|
|
7
|
+
*/
|
|
8
|
+
var WrCompareHarness = class WrCompareHarness extends ComponentHarness {
|
|
9
|
+
static hostSelector = "wr-compare";
|
|
10
|
+
static with(options = {}) {
|
|
11
|
+
return new HarnessPredicate(WrCompareHarness, options).addOption("label", options.label, (harness, label) => HarnessPredicate.stringMatches(harness.getLabel(), label)).addOption("orientation", options.orientation, async (harness, orientation) => await harness.getOrientation() === orientation).addOption("disabled", options.disabled, async (harness, disabled) => await harness.isDisabled() === disabled);
|
|
12
|
+
}
|
|
13
|
+
slider = this.locatorFor(".wr-compare__surface[role=\"slider\"]");
|
|
14
|
+
async getPosition() {
|
|
15
|
+
return this.numeric("aria-valuenow");
|
|
16
|
+
}
|
|
17
|
+
async getMinPosition() {
|
|
18
|
+
return this.numeric("aria-valuemin");
|
|
19
|
+
}
|
|
20
|
+
async getMaxPosition() {
|
|
21
|
+
return this.numeric("aria-valuemax");
|
|
22
|
+
}
|
|
23
|
+
async getOrientation() {
|
|
24
|
+
return await (await this.slider()).getAttribute("aria-orientation") === "vertical" ? "vertical" : "horizontal";
|
|
25
|
+
}
|
|
26
|
+
async getLabel() {
|
|
27
|
+
return (await this.slider()).getAttribute("aria-label");
|
|
28
|
+
}
|
|
29
|
+
async isDisabled() {
|
|
30
|
+
return await (await this.slider()).getAttribute("aria-disabled") === "true";
|
|
31
|
+
}
|
|
32
|
+
async hasHandle() {
|
|
33
|
+
return await this.locatorForOptional(".wr-compare__handle")() !== null;
|
|
34
|
+
}
|
|
35
|
+
async getBeforeText() {
|
|
36
|
+
return (await this.locatorFor(".wr-compare__layer--before")()).text();
|
|
37
|
+
}
|
|
38
|
+
async getAfterText() {
|
|
39
|
+
return (await this.locatorFor(".wr-compare__layer--after")()).text();
|
|
40
|
+
}
|
|
41
|
+
async focus() {
|
|
42
|
+
return (await this.slider()).focus();
|
|
43
|
+
}
|
|
44
|
+
async isFocused() {
|
|
45
|
+
return (await this.slider()).isFocused();
|
|
46
|
+
}
|
|
47
|
+
async setPosition(target) {
|
|
48
|
+
const [min, max] = [await this.getMinPosition(), await this.getMaxPosition()];
|
|
49
|
+
if (target < min || target > max || !Number.isInteger(target)) throw new Error(`WrCompareHarness.setPosition(${target}): unreachable. This slider accepts whole percents in ${min}–${max}.`);
|
|
50
|
+
const slider = await this.slider();
|
|
51
|
+
const before = await this.getPosition();
|
|
52
|
+
if (target === min) await slider.sendKeys(TestKey.HOME);
|
|
53
|
+
else if (target === max) await slider.sendKeys(TestKey.END);
|
|
54
|
+
else {
|
|
55
|
+
let [grow, shrink] = await this.getOrientation() === "vertical" ? [TestKey.DOWN_ARROW, TestKey.UP_ARROW] : [TestKey.RIGHT_ARROW, TestKey.LEFT_ARROW];
|
|
56
|
+
let now = before;
|
|
57
|
+
let turned = false;
|
|
58
|
+
for (let press = 0; now !== target && press < 64; press++) {
|
|
59
|
+
const gap = target - now;
|
|
60
|
+
const [key, back] = gap > 0 ? [grow, shrink] : [shrink, grow];
|
|
61
|
+
await (Math.abs(gap) >= 10 ? slider.sendKeys({ shift: true }, key) : slider.sendKeys(key));
|
|
62
|
+
const next = await this.getPosition();
|
|
63
|
+
if (Math.sign(next - now) === Math.sign(gap)) {
|
|
64
|
+
now = next;
|
|
65
|
+
continue;
|
|
66
|
+
}
|
|
67
|
+
if (next !== now) await (Math.abs(gap) >= 10 ? slider.sendKeys({ shift: true }, back) : slider.sendKeys(back));
|
|
68
|
+
now = await this.getPosition();
|
|
69
|
+
if (turned) break;
|
|
70
|
+
turned = true;
|
|
71
|
+
[grow, shrink] = [shrink, grow];
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
const landed = await this.getPosition();
|
|
75
|
+
if (landed !== target) throw new Error(`WrCompareHarness.setPosition(${target}): the divider stopped at ${landed}, from ${before}. A disabled slider ignores its keys, which is the usual reason.`);
|
|
76
|
+
}
|
|
77
|
+
async numeric(attribute) {
|
|
78
|
+
const raw = await (await this.slider()).getAttribute(attribute);
|
|
79
|
+
return raw === null ? NaN : Number(raw);
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
export { WrCompareHarness };
|
|
83
|
+
|
|
84
|
+
//# sourceMappingURL=ngwr-compare-testing.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ngwr-compare-testing.mjs","names":[],"sources":["../../../projects/lib/compare/testing/wr-compare-harness.ts"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { ComponentHarness, HarnessPredicate, TestKey } from '@angular/cdk/testing';\n\nimport type { WrCompareHarnessFilters } from './types';\n\n/**\n * Test harness for `<wr-compare>`, the before/after slider.\n *\n * The position is read from the slider's `aria-valuenow`, in whole percent,\n * and written with the keyboard. There is no `dragTo()`: a drag divides the\n * pointer's offset by the host's measured width, a unit test has no layout, and\n * the component keeps its position when the host measures zero, so a dragging\n * method would resolve having moved nothing.\n *\n * @example\n * ```ts\n * const compare = await loader.getHarness(WrCompareHarness);\n *\n * await compare.setPosition(30);\n * expect(await compare.getPosition()).toBe(30);\n * ```\n *\n * @see https://ngwr.dev/guides/testing\n */\nexport class WrCompareHarness extends ComponentHarness {\n static hostSelector = 'wr-compare';\n\n /** Build a predicate that narrows the query — pass to `getHarness` / `getAllHarnesses`. */\n static with(options: WrCompareHarnessFilters = {}): HarnessPredicate<WrCompareHarness> {\n return new HarnessPredicate(WrCompareHarness, options)\n .addOption('label', options.label, (harness, label) => HarnessPredicate.stringMatches(harness.getLabel(), label))\n .addOption(\n 'orientation',\n options.orientation,\n async (harness, orientation) => (await harness.getOrientation()) === orientation\n )\n .addOption('disabled', options.disabled, async (harness, disabled) => (await harness.isDisabled()) === disabled);\n }\n\n private readonly slider = this.locatorFor('.wr-compare__surface[role=\"slider\"]');\n\n /** The divider position in whole percent, from `aria-valuenow`. */\n async getPosition(): Promise<number> {\n return this.numeric('aria-valuenow');\n }\n\n /** The lowest position the divider may reach, from `aria-valuemin`. */\n async getMinPosition(): Promise<number> {\n return this.numeric('aria-valuemin');\n }\n\n /** The highest position the divider may reach, from `aria-valuemax`. */\n async getMaxPosition(): Promise<number> {\n return this.numeric('aria-valuemax');\n }\n\n /** The axis the divider moves along, from `aria-orientation`. */\n async getOrientation(): Promise<'horizontal' | 'vertical'> {\n return (await (await this.slider()).getAttribute('aria-orientation')) === 'vertical' ? 'vertical' : 'horizontal';\n }\n\n /** The slider's accessible name. */\n async getLabel(): Promise<string | null> {\n return (await this.slider()).getAttribute('aria-label');\n }\n\n /** Whether the slider refuses interaction, from `aria-disabled`. */\n async isDisabled(): Promise<boolean> {\n return (await (await this.slider()).getAttribute('aria-disabled')) === 'true';\n }\n\n /** Whether the round drag handle is drawn on the divider (`showHandle`). */\n async hasHandle(): Promise<boolean> {\n return (await this.locatorForOptional('.wr-compare__handle')()) !== null;\n }\n\n /** The text of the \"before\" layer, trimmed. */\n async getBeforeText(): Promise<string> {\n return (await this.locatorFor('.wr-compare__layer--before')()).text();\n }\n\n /** The text of the \"after\" layer, trimmed. */\n async getAfterText(): Promise<string> {\n return (await this.locatorFor('.wr-compare__layer--after')()).text();\n }\n\n /** Move keyboard focus to the slider. */\n async focus(): Promise<void> {\n return (await this.slider()).focus();\n }\n\n /** Whether the slider holds focus. */\n async isFocused(): Promise<boolean> {\n return (await this.slider()).isFocused();\n }\n\n /**\n * Walk the divider to `target` with the keys a user has: Home and End for the\n * bounds, Shift+arrow for tens, an arrow for ones.\n *\n * Which arrow grows the position depends on the orientation and on the reading\n * direction, which a harness cannot read, so the walk watches where each press\n * lands and turns around when the first one went the wrong way.\n *\n * Throws for a target outside `[min, max]`, for a fractional one (a key lands\n * on a whole percent) and when the divider stops moving, which is what a\n * disabled slider does.\n */\n async setPosition(target: number): Promise<void> {\n const [min, max] = [await this.getMinPosition(), await this.getMaxPosition()];\n if (target < min || target > max || !Number.isInteger(target)) {\n throw new Error(\n `WrCompareHarness.setPosition(${target}): unreachable. This slider accepts whole percents in ${min}–${max}.`\n );\n }\n\n const slider = await this.slider();\n const before = await this.getPosition();\n if (target === min) await slider.sendKeys(TestKey.HOME);\n else if (target === max) await slider.sendKeys(TestKey.END);\n else {\n const vertical = (await this.getOrientation()) === 'vertical';\n let [grow, shrink] = vertical\n ? [TestKey.DOWN_ARROW, TestKey.UP_ARROW]\n : [TestKey.RIGHT_ARROW, TestKey.LEFT_ARROW];\n\n let now = before;\n let turned = false;\n // Bounded: the range is 101 values wide, and a turn costs two presses.\n for (let press = 0; now !== target && press < 64; press++) {\n const gap = target - now;\n const [key, back] = gap > 0 ? [grow, shrink] : [shrink, grow];\n await (Math.abs(gap) >= 10 ? slider.sendKeys({ shift: true }, key) : slider.sendKeys(key));\n const next = await this.getPosition();\n\n if (Math.sign(next - now) === Math.sign(gap)) {\n now = next;\n continue;\n }\n // Nothing moved, or it moved away: the page reads right to left, or the\n // slider is inert. Put a wrong step back, and turn around once.\n if (next !== now) await (Math.abs(gap) >= 10 ? slider.sendKeys({ shift: true }, back) : slider.sendKeys(back));\n now = await this.getPosition();\n if (turned) break;\n turned = true;\n [grow, shrink] = [shrink, grow];\n }\n }\n\n const landed = await this.getPosition();\n if (landed !== target) {\n throw new Error(\n `WrCompareHarness.setPosition(${target}): the divider stopped at ${landed}, from ${before}. A disabled ` +\n 'slider ignores its keys, which is the usual reason.'\n );\n }\n }\n\n private async numeric(attribute: string): Promise<number> {\n const raw = await (await this.slider()).getAttribute(attribute);\n return raw === null ? Number.NaN : Number(raw);\n }\n}\n"],"mappings":";;;;;;;AA8BA,IAAa,mBAAb,MAAa,yBAAyB,iBAAgB;CACpD,OAAO,eAAe;CAGtB,OAAO,KAAK,UAAmC,CAAA,GAAE;EAC/C,OAAO,IAAI,iBAAiB,kBAAkB,OAAO,CAAC,CACnD,UAAU,SAAS,QAAQ,QAAQ,SAAS,UAAU,iBAAiB,cAAc,QAAQ,SAAQ,GAAI,KAAK,CAAC,CAAC,CAChH,UACC,eACA,QAAQ,aACR,OAAO,SAAS,gBAAiB,MAAM,QAAQ,eAAc,MAAQ,WAAW,CACjF,CACA,UAAU,YAAY,QAAQ,UAAU,OAAO,SAAS,aAAc,MAAM,QAAQ,WAAU,MAAQ,QAAQ;CACnH;CAEiB,SAAS,KAAK,WAAW,uCAAqC;CAG/E,MAAM,cAAW;EACf,OAAO,KAAK,QAAQ,eAAe;CACrC;CAGA,MAAM,iBAAc;EAClB,OAAO,KAAK,QAAQ,eAAe;CACrC;CAGA,MAAM,iBAAc;EAClB,OAAO,KAAK,QAAQ,eAAe;CACrC;CAGA,MAAM,iBAAc;EAClB,OAAQ,OAAO,MAAM,KAAK,OAAM,EAAA,CAAI,aAAa,kBAAkB,MAAO,aAAa,aAAa;CACtG;CAGA,MAAM,WAAQ;EACZ,QAAQ,MAAM,KAAK,OAAM,EAAA,CAAI,aAAa,YAAY;CACxD;CAGA,MAAM,aAAU;EACd,OAAQ,OAAO,MAAM,KAAK,OAAM,EAAA,CAAI,aAAa,eAAe,MAAO;CACzE;CAGA,MAAM,YAAS;EACb,OAA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O,KAAI,GAAI,GAAG,IAAI,OAAO,SAAS,GAAG;IACxF,MAAM,OAAO,MAAM,KAAK,YAAW;IAEnC,IAAI,KAAK,KAAK,OAAO,GAAG,MAAM,KAAK,KAAK,GAAG,GAAG;KAC5C,MAAM;KACN;IACF;IAGA,IAAI,SAAS,KAAK,OAAO,KAAK,IAAI,GAAG,KAAK,KAAK,OAAO,SAAS,EAAE,OAAO,KAAI,GAAI,IAAI,IAAI,OAAO,SAAS,IAAI;IAC5G,MAAM,MAAM,KAAK,YAAW;IAC5B,IAAI,QAAQ;IACZ,SAAS;IACT,CAAC,MAAM,UAAU,CAAC,QAAQ,IAAI;GAChC;EACF;EAEA,MAAM,SAAS,MAAM,KAAK,YAAW;EACrC,IAAI,WAAW,QACb,MAAM,IAAI,MACR,gCAAgC,OAAM,4BAA6B,OAAM,SAAU,OAAM,iEAClC;CAG7D;CAEQ,MAAM,QAAQ,WAAiB;EACrC,MAAM,MAAM,OAAO,MAAM,KAAK,OAAM,EAAA,CAAI,aAAa,SAAS;EAC9D,OAAO,QAAQ,OAAO,MAAa,OAAO,GAAG;CAC/C"}
|
|
@@ -115,7 +115,7 @@ var WrCompare = class WrCompare {
|
|
|
115
115
|
}
|
|
116
116
|
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
117
117
|
minVersion: "12.0.0",
|
|
118
|
-
version: "22.2.
|
|
118
|
+
version: "22.2.6",
|
|
119
119
|
ngImport: i0,
|
|
120
120
|
type: WrCompare,
|
|
121
121
|
deps: [],
|
|
@@ -123,7 +123,7 @@ var WrCompare = class WrCompare {
|
|
|
123
123
|
});
|
|
124
124
|
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
125
125
|
minVersion: "17.0.0",
|
|
126
|
-
version: "22.2.
|
|
126
|
+
version: "22.2.6",
|
|
127
127
|
type: WrCompare,
|
|
128
128
|
isStandalone: true,
|
|
129
129
|
selector: "wr-compare",
|
|
@@ -190,7 +190,7 @@ var WrCompare = class WrCompare {
|
|
|
190
190
|
};
|
|
191
191
|
i0.ɵɵngDeclareClassMetadata({
|
|
192
192
|
minVersion: "12.0.0",
|
|
193
|
-
version: "22.2.
|
|
193
|
+
version: "22.2.6",
|
|
194
194
|
ngImport: i0,
|
|
195
195
|
type: WrCompare,
|
|
196
196
|
decorators: [{
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as i0 from "@angular/core";
|
|
2
2
|
import { Component, DestroyRef, Directive, ElementRef, Injector, TemplateRef, ViewContainerRef, ViewEncapsulation, computed, inject, input, signal, viewChild } from "@angular/core";
|
|
3
3
|
import { coerceBooleanProperty } from "@angular/cdk/coercion";
|
|
4
|
-
import { wrCheckStyles, wrRandomId, wrRestoreFocus, wrToClassList } from "ngwr/utils";
|
|
4
|
+
import { WR_LIVE_LOCALE, wrCheckStyles, wrRandomId, wrRestoreFocus, wrToClassList, wrTypeahead } from "ngwr/utils";
|
|
5
5
|
import { WrIcon } from "ngwr/icon";
|
|
6
6
|
import { Directionality } from "@angular/cdk/bidi";
|
|
7
7
|
import { ScrollStrategyOptions } from "@angular/cdk/overlay";
|
|
@@ -46,6 +46,17 @@ function wrHandleMenuNavigation(pane, event) {
|
|
|
46
46
|
event.preventDefault();
|
|
47
47
|
return true;
|
|
48
48
|
}
|
|
49
|
+
function wrListenForMenuTypeahead(pane, locale) {
|
|
50
|
+
const typeahead = wrTypeahead({ locale });
|
|
51
|
+
pane.addEventListener("keydown", (event) => {
|
|
52
|
+
const items = wrMenuItems(pane);
|
|
53
|
+
const index = typeahead.handleKey(event, items.map((item) => item.querySelector(".wr-context-menu-item__label")?.textContent ?? ""), items.indexOf(document.activeElement));
|
|
54
|
+
if (index === null) return;
|
|
55
|
+
event.preventDefault();
|
|
56
|
+
if (event.key === " ") event.stopPropagation();
|
|
57
|
+
items[index]?.focus();
|
|
58
|
+
}, true);
|
|
59
|
+
}
|
|
49
60
|
/**
|
|
50
61
|
* @license
|
|
51
62
|
*
|
|
@@ -75,6 +86,7 @@ var WrContextMenuItem = class WrContextMenuItem {
|
|
|
75
86
|
scrollStrategies = inject(ScrollStrategyOptions);
|
|
76
87
|
injector = inject(Injector);
|
|
77
88
|
destroyRef = inject(DestroyRef);
|
|
89
|
+
liveLocale = inject(WR_LIVE_LOCALE, { optional: true });
|
|
78
90
|
submenuRef = null;
|
|
79
91
|
submenuKeys = null;
|
|
80
92
|
openTimer = null;
|
|
@@ -193,6 +205,7 @@ var WrContextMenuItem = class WrContextMenuItem {
|
|
|
193
205
|
scrollStrategy: this.scrollStrategies.reposition(),
|
|
194
206
|
panelClass: ["wr-context-menu-overlay", "wr-context-menu-overlay--submenu"]
|
|
195
207
|
});
|
|
208
|
+
wrListenForMenuTypeahead(this.submenuRef.overlayElement, () => this.liveLocale?.());
|
|
196
209
|
wrFollowDirection(this.submenuRef, this.dir, this.injector, (direction) => positionStrategy.withPositions(wrMirrorOffsets(positions, direction === "rtl")));
|
|
197
210
|
const portal = new TemplatePortal(panel.contentTpl(), this.vcr);
|
|
198
211
|
this.submenuRef.attach(portal);
|
|
@@ -281,7 +294,7 @@ var WrContextMenuItem = class WrContextMenuItem {
|
|
|
281
294
|
}
|
|
282
295
|
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
283
296
|
minVersion: "12.0.0",
|
|
284
|
-
version: "22.2.
|
|
297
|
+
version: "22.2.6",
|
|
285
298
|
ngImport: i0,
|
|
286
299
|
type: WrContextMenuItem,
|
|
287
300
|
deps: [],
|
|
@@ -289,7 +302,7 @@ var WrContextMenuItem = class WrContextMenuItem {
|
|
|
289
302
|
});
|
|
290
303
|
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
291
304
|
minVersion: "17.0.0",
|
|
292
|
-
version: "22.2.
|
|
305
|
+
version: "22.2.6",
|
|
293
306
|
type: WrContextMenuItem,
|
|
294
307
|
isStandalone: true,
|
|
295
308
|
selector: "wr-context-menu-item",
|
|
@@ -350,7 +363,7 @@ var WrContextMenuItem = class WrContextMenuItem {
|
|
|
350
363
|
};
|
|
351
364
|
i0.ɵɵngDeclareClassMetadata({
|
|
352
365
|
minVersion: "12.0.0",
|
|
353
|
-
version: "22.2.
|
|
366
|
+
version: "22.2.6",
|
|
354
367
|
ngImport: i0,
|
|
355
368
|
type: WrContextMenuItem,
|
|
356
369
|
decorators: [{
|
|
@@ -465,6 +478,7 @@ var WrContextMenu = class WrContextMenu {
|
|
|
465
478
|
scrollStrategies = inject(ScrollStrategyOptions);
|
|
466
479
|
injector = inject(Injector);
|
|
467
480
|
destroyRef = inject(DestroyRef);
|
|
481
|
+
liveLocale = inject(WR_LIVE_LOCALE, { optional: true });
|
|
468
482
|
openMenuId = signal(null, ...ngDevMode ? [{ debugName: "openMenuId" }] : /* istanbul ignore next */ []);
|
|
469
483
|
overlayRef = null;
|
|
470
484
|
rootKeys = null;
|
|
@@ -558,6 +572,7 @@ var WrContextMenu = class WrContextMenu {
|
|
|
558
572
|
scrollStrategy: this.scrollStrategies.noop(),
|
|
559
573
|
panelClass: ["wr-context-menu-overlay"]
|
|
560
574
|
});
|
|
575
|
+
wrListenForMenuTypeahead(this.overlayRef.overlayElement, () => this.liveLocale?.());
|
|
561
576
|
wrFollowDirection(this.overlayRef, this.dir, this.injector);
|
|
562
577
|
const portal = new TemplatePortal(this.menu().contentTpl(), this.vcr);
|
|
563
578
|
this.overlayRef.attach(portal);
|
|
@@ -660,7 +675,7 @@ var WrContextMenu = class WrContextMenu {
|
|
|
660
675
|
}
|
|
661
676
|
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
662
677
|
minVersion: "12.0.0",
|
|
663
|
-
version: "22.2.
|
|
678
|
+
version: "22.2.6",
|
|
664
679
|
ngImport: i0,
|
|
665
680
|
type: WrContextMenu,
|
|
666
681
|
deps: [],
|
|
@@ -668,7 +683,7 @@ var WrContextMenu = class WrContextMenu {
|
|
|
668
683
|
});
|
|
669
684
|
static ɵdir = i0.ɵɵngDeclareDirective({
|
|
670
685
|
minVersion: "17.1.0",
|
|
671
|
-
version: "22.2.
|
|
686
|
+
version: "22.2.6",
|
|
672
687
|
type: WrContextMenu,
|
|
673
688
|
isStandalone: true,
|
|
674
689
|
selector: "[wrContextMenu]",
|
|
@@ -696,7 +711,7 @@ var WrContextMenu = class WrContextMenu {
|
|
|
696
711
|
};
|
|
697
712
|
i0.ɵɵngDeclareClassMetadata({
|
|
698
713
|
minVersion: "12.0.0",
|
|
699
|
-
version: "22.2.
|
|
714
|
+
version: "22.2.6",
|
|
700
715
|
ngImport: i0,
|
|
701
716
|
type: WrContextMenu,
|
|
702
717
|
decorators: [{
|
|
@@ -743,7 +758,7 @@ var WrContextMenuPanel = class WrContextMenuPanel {
|
|
|
743
758
|
contentTpl = viewChild.required(TemplateRef, ...ngDevMode ? [{ debugName: "contentTpl" }] : /* istanbul ignore next */ []);
|
|
744
759
|
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
745
760
|
minVersion: "12.0.0",
|
|
746
|
-
version: "22.2.
|
|
761
|
+
version: "22.2.6",
|
|
747
762
|
ngImport: i0,
|
|
748
763
|
type: WrContextMenuPanel,
|
|
749
764
|
deps: [],
|
|
@@ -751,7 +766,7 @@ var WrContextMenuPanel = class WrContextMenuPanel {
|
|
|
751
766
|
});
|
|
752
767
|
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
753
768
|
minVersion: "17.2.0",
|
|
754
|
-
version: "22.2.
|
|
769
|
+
version: "22.2.6",
|
|
755
770
|
type: WrContextMenuPanel,
|
|
756
771
|
isStandalone: true,
|
|
757
772
|
selector: "wr-context-menu",
|
|
@@ -779,7 +794,7 @@ var WrContextMenuPanel = class WrContextMenuPanel {
|
|
|
779
794
|
};
|
|
780
795
|
i0.ɵɵngDeclareClassMetadata({
|
|
781
796
|
minVersion: "12.0.0",
|
|
782
|
-
version: "22.2.
|
|
797
|
+
version: "22.2.6",
|
|
783
798
|
ngImport: i0,
|
|
784
799
|
type: WrContextMenuPanel,
|
|
785
800
|
decorators: [{
|
|
@@ -820,7 +835,7 @@ var WrContextMenuDivider = class WrContextMenuDivider {
|
|
|
820
835
|
}
|
|
821
836
|
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
822
837
|
minVersion: "12.0.0",
|
|
823
|
-
version: "22.2.
|
|
838
|
+
version: "22.2.6",
|
|
824
839
|
ngImport: i0,
|
|
825
840
|
type: WrContextMenuDivider,
|
|
826
841
|
deps: [],
|
|
@@ -828,7 +843,7 @@ var WrContextMenuDivider = class WrContextMenuDivider {
|
|
|
828
843
|
});
|
|
829
844
|
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
830
845
|
minVersion: "14.0.0",
|
|
831
|
-
version: "22.2.
|
|
846
|
+
version: "22.2.6",
|
|
832
847
|
type: WrContextMenuDivider,
|
|
833
848
|
isStandalone: true,
|
|
834
849
|
selector: "wr-context-menu-divider",
|
|
@@ -847,7 +862,7 @@ var WrContextMenuDivider = class WrContextMenuDivider {
|
|
|
847
862
|
};
|
|
848
863
|
i0.ɵɵngDeclareClassMetadata({
|
|
849
864
|
minVersion: "12.0.0",
|
|
850
|
-
version: "22.2.
|
|
865
|
+
version: "22.2.6",
|
|
851
866
|
ngImport: i0,
|
|
852
867
|
type: WrContextMenuDivider,
|
|
853
868
|
decorators: [{
|