ngwr 15.8.0 → 16.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/animations/aurora/styles/_index.scss +1 -1
- package/animations/blur-reveal/styles/_index.scss +1 -1
- package/animations/decode/styles/_index.scss +1 -1
- package/animations/dot-grid/styles/_index.scss +1 -1
- package/animations/flow-lines/styles/_index.scss +1 -1
- package/animations/fluid-cursor/styles/_index.scss +1 -1
- package/animations/{core → internal}/styles/_mixins.scss +1 -1
- package/animations/reveal/styles/_index.scss +1 -1
- package/animations/ripple-grid/styles/_index.scss +1 -1
- package/animations/rotate-reveal/styles/_index.scss +1 -1
- package/animations/thread-lines/styles/_index.scss +1 -1
- package/animations/typewriter/styles/_index.scss +1 -1
- package/copy-value/styles/_index.scss +104 -0
- package/date-picker/styles/_index.scss +117 -0
- package/fesm2022/{ngwr-animations-core.mjs → internal-BaQU4t_0.mjs} +6 -49
- package/fesm2022/internal-BaQU4t_0.mjs.map +1 -0
- package/fesm2022/ngwr-alert.mjs +2 -2
- package/fesm2022/ngwr-alert.mjs.map +1 -1
- package/fesm2022/ngwr-animations-aurora.mjs +21 -21
- package/fesm2022/ngwr-animations-aurora.mjs.map +1 -1
- package/fesm2022/ngwr-animations-blur-reveal.mjs +3 -3
- package/fesm2022/ngwr-animations-blur-reveal.mjs.map +1 -1
- package/fesm2022/ngwr-animations-click-sparks.mjs +2 -2
- package/fesm2022/ngwr-animations-click-sparks.mjs.map +1 -1
- package/fesm2022/ngwr-animations-confetti.mjs +5 -5
- package/fesm2022/ngwr-animations-confetti.mjs.map +1 -1
- package/fesm2022/ngwr-animations-decode.mjs +4 -4
- package/fesm2022/ngwr-animations-decode.mjs.map +1 -1
- package/fesm2022/ngwr-animations-destruct.mjs +5 -5
- package/fesm2022/ngwr-animations-destruct.mjs.map +1 -1
- package/fesm2022/ngwr-animations-dot-grid.mjs +7 -7
- package/fesm2022/ngwr-animations-dot-grid.mjs.map +1 -1
- package/fesm2022/ngwr-animations-falling-letters.mjs +3 -3
- package/fesm2022/ngwr-animations-falling-letters.mjs.map +1 -1
- package/fesm2022/ngwr-animations-flow-lines.mjs +17 -17
- package/fesm2022/ngwr-animations-flow-lines.mjs.map +1 -1
- package/fesm2022/ngwr-animations-fluid-cursor.mjs +12 -12
- package/fesm2022/ngwr-animations-fluid-cursor.mjs.map +1 -1
- package/fesm2022/ngwr-animations-glitch.mjs +2 -2
- package/fesm2022/ngwr-animations-glitch.mjs.map +1 -1
- package/fesm2022/ngwr-animations-marquee.mjs +2 -2
- package/fesm2022/ngwr-animations-marquee.mjs.map +1 -1
- package/fesm2022/ngwr-animations-orbit.mjs +7 -7
- package/fesm2022/ngwr-animations-orbit.mjs.map +1 -1
- package/fesm2022/ngwr-animations-reveal.mjs +4 -4
- package/fesm2022/ngwr-animations-reveal.mjs.map +1 -1
- package/fesm2022/ngwr-animations-ripple-grid.mjs +5 -5
- package/fesm2022/ngwr-animations-ripple-grid.mjs.map +1 -1
- package/fesm2022/ngwr-animations-rotate-reveal.mjs +4 -4
- package/fesm2022/ngwr-animations-rotate-reveal.mjs.map +1 -1
- package/fesm2022/ngwr-animations-shimmer.mjs +2 -2
- package/fesm2022/ngwr-animations-shimmer.mjs.map +1 -1
- package/fesm2022/ngwr-animations-spotlight.mjs +1 -1
- package/fesm2022/ngwr-animations-spotlight.mjs.map +1 -1
- package/fesm2022/ngwr-animations-thread-lines.mjs +16 -16
- package/fesm2022/ngwr-animations-thread-lines.mjs.map +1 -1
- package/fesm2022/ngwr-animations-tilt.mjs +3 -3
- package/fesm2022/ngwr-animations-tilt.mjs.map +1 -1
- package/fesm2022/ngwr-animations-typewriter.mjs +4 -4
- package/fesm2022/ngwr-animations-typewriter.mjs.map +1 -1
- package/fesm2022/ngwr-avatar.mjs +3 -3
- package/fesm2022/ngwr-avatar.mjs.map +1 -1
- package/fesm2022/ngwr-badge.mjs.map +1 -1
- package/fesm2022/ngwr-cascader.mjs +43 -20
- package/fesm2022/ngwr-cascader.mjs.map +1 -1
- package/fesm2022/ngwr-charts-bar-chart.mjs +13 -13
- package/fesm2022/ngwr-charts-bar-chart.mjs.map +1 -1
- package/fesm2022/ngwr-charts-boxplot-chart.mjs +9 -9
- package/fesm2022/ngwr-charts-boxplot-chart.mjs.map +1 -1
- package/fesm2022/ngwr-charts-bullet-chart.mjs +8 -8
- package/fesm2022/ngwr-charts-bullet-chart.mjs.map +1 -1
- package/fesm2022/ngwr-charts-candlestick-chart.mjs +11 -11
- package/fesm2022/ngwr-charts-candlestick-chart.mjs.map +1 -1
- package/fesm2022/ngwr-charts-chart-legend.mjs +2 -2
- package/fesm2022/ngwr-charts-chart-legend.mjs.map +1 -1
- package/fesm2022/ngwr-charts-core.mjs +20 -20
- package/fesm2022/ngwr-charts-core.mjs.map +1 -1
- package/fesm2022/ngwr-charts-donut-chart.mjs +2 -2
- package/fesm2022/ngwr-charts-donut-chart.mjs.map +1 -1
- package/fesm2022/ngwr-charts-funnel-chart.mjs +6 -6
- package/fesm2022/ngwr-charts-funnel-chart.mjs.map +1 -1
- package/fesm2022/ngwr-charts-gauge.mjs +3 -3
- package/fesm2022/ngwr-charts-gauge.mjs.map +1 -1
- package/fesm2022/ngwr-charts-heatmap-chart.mjs +3 -3
- package/fesm2022/ngwr-charts-heatmap-chart.mjs.map +1 -1
- package/fesm2022/ngwr-charts-line-chart.mjs +10 -10
- package/fesm2022/ngwr-charts-line-chart.mjs.map +1 -1
- package/fesm2022/ngwr-charts-meter-group.mjs +2 -2
- package/fesm2022/ngwr-charts-meter-group.mjs.map +1 -1
- package/fesm2022/ngwr-charts-radar-chart.mjs +11 -11
- package/fesm2022/ngwr-charts-radar-chart.mjs.map +1 -1
- package/fesm2022/ngwr-charts-scatter-chart.mjs +10 -10
- package/fesm2022/ngwr-charts-scatter-chart.mjs.map +1 -1
- package/fesm2022/ngwr-charts-treemap-chart.mjs +4 -4
- package/fesm2022/ngwr-charts-treemap-chart.mjs.map +1 -1
- package/fesm2022/ngwr-charts-waterfall-chart.mjs +7 -7
- package/fesm2022/ngwr-charts-waterfall-chart.mjs.map +1 -1
- package/fesm2022/ngwr-checkbox.mjs +2 -2
- package/fesm2022/ngwr-checkbox.mjs.map +1 -1
- package/fesm2022/ngwr-collapse.mjs +2 -2
- package/fesm2022/ngwr-collapse.mjs.map +1 -1
- package/fesm2022/ngwr-color-picker.mjs +52 -52
- package/fesm2022/ngwr-color-picker.mjs.map +1 -1
- package/fesm2022/ngwr-command-palette.mjs +4 -4
- package/fesm2022/ngwr-command-palette.mjs.map +1 -1
- package/fesm2022/ngwr-comment.mjs +2 -2
- package/fesm2022/ngwr-comment.mjs.map +1 -1
- package/fesm2022/ngwr-compare.mjs +6 -6
- package/fesm2022/ngwr-compare.mjs.map +1 -1
- package/fesm2022/ngwr-context-menu.mjs +4 -4
- package/fesm2022/ngwr-context-menu.mjs.map +1 -1
- package/fesm2022/ngwr-copy-value-testing.mjs +58 -0
- package/fesm2022/ngwr-copy-value-testing.mjs.map +1 -0
- package/fesm2022/ngwr-copy-value.mjs +196 -0
- package/fesm2022/ngwr-copy-value.mjs.map +1 -0
- package/fesm2022/ngwr-counter.mjs +3 -3
- package/fesm2022/ngwr-counter.mjs.map +1 -1
- package/fesm2022/ngwr-date-picker-testing.mjs.map +1 -1
- package/fesm2022/ngwr-date-picker.mjs +217 -40
- package/fesm2022/ngwr-date-picker.mjs.map +1 -1
- package/fesm2022/ngwr-date.mjs +27 -5
- package/fesm2022/ngwr-date.mjs.map +1 -1
- package/fesm2022/ngwr-dialog.mjs +32 -3
- package/fesm2022/ngwr-dialog.mjs.map +1 -1
- package/fesm2022/ngwr-directives.mjs +116 -1
- package/fesm2022/ngwr-directives.mjs.map +1 -1
- package/fesm2022/ngwr-drawer.mjs +3 -3
- package/fesm2022/ngwr-drawer.mjs.map +1 -1
- package/fesm2022/ngwr-dropdown.mjs +13 -12
- package/fesm2022/ngwr-dropdown.mjs.map +1 -1
- package/fesm2022/ngwr-editor.mjs +28 -28
- package/fesm2022/ngwr-editor.mjs.map +1 -1
- package/fesm2022/ngwr-event-calendar.mjs +5 -5
- package/fesm2022/ngwr-event-calendar.mjs.map +1 -1
- package/fesm2022/ngwr-file-upload.mjs +8 -8
- package/fesm2022/ngwr-file-upload.mjs.map +1 -1
- package/fesm2022/ngwr-graph.mjs +3 -3
- package/fesm2022/ngwr-graph.mjs.map +1 -1
- package/fesm2022/ngwr-hotkey.mjs +22 -22
- package/fesm2022/ngwr-hotkey.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-ar.mjs +5 -0
- package/fesm2022/ngwr-i18n-ar.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-cs.mjs +5 -0
- package/fesm2022/ngwr-i18n-cs.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-de.mjs +5 -0
- package/fesm2022/ngwr-i18n-de.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-en.mjs +5 -0
- package/fesm2022/ngwr-i18n-en.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-es.mjs +5 -0
- package/fesm2022/ngwr-i18n-es.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-fr.mjs +5 -0
- package/fesm2022/ngwr-i18n-fr.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-he.mjs +5 -0
- package/fesm2022/ngwr-i18n-he.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-hi.mjs +5 -0
- package/fesm2022/ngwr-i18n-hi.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-id.mjs +5 -0
- package/fesm2022/ngwr-i18n-id.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-it.mjs +5 -0
- package/fesm2022/ngwr-i18n-it.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-ja.mjs +5 -0
- package/fesm2022/ngwr-i18n-ja.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-ko.mjs +5 -0
- package/fesm2022/ngwr-i18n-ko.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-nl.mjs +5 -0
- package/fesm2022/ngwr-i18n-nl.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-pl.mjs +5 -0
- package/fesm2022/ngwr-i18n-pl.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-pt.mjs +5 -0
- package/fesm2022/ngwr-i18n-pt.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-ru.mjs +5 -0
- package/fesm2022/ngwr-i18n-ru.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-sv.mjs +5 -0
- package/fesm2022/ngwr-i18n-sv.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-tr.mjs +5 -0
- package/fesm2022/ngwr-i18n-tr.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-uk.mjs +5 -0
- package/fesm2022/ngwr-i18n-uk.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-vi.mjs +5 -0
- package/fesm2022/ngwr-i18n-vi.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-zh-tw.mjs +5 -0
- package/fesm2022/ngwr-i18n-zh-tw.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-zh.mjs +5 -0
- package/fesm2022/ngwr-i18n-zh.mjs.map +1 -1
- package/fesm2022/ngwr-i18n.mjs +2 -2
- package/fesm2022/ngwr-i18n.mjs.map +1 -1
- package/fesm2022/ngwr-icon.mjs +5 -5
- package/fesm2022/ngwr-icon.mjs.map +1 -1
- package/fesm2022/ngwr-image-cropper.mjs +11 -11
- package/fesm2022/ngwr-image-cropper.mjs.map +1 -1
- package/fesm2022/ngwr-input-number.mjs +4 -4
- package/fesm2022/ngwr-input-number.mjs.map +1 -1
- package/fesm2022/ngwr-input-otp.mjs +2 -2
- package/fesm2022/ngwr-input-otp.mjs.map +1 -1
- package/fesm2022/ngwr-input.mjs +15 -15
- package/fesm2022/ngwr-input.mjs.map +1 -1
- package/fesm2022/ngwr-keyboard.mjs +28 -28
- package/fesm2022/ngwr-keyboard.mjs.map +1 -1
- package/fesm2022/ngwr-knob.mjs +4 -4
- package/fesm2022/ngwr-knob.mjs.map +1 -1
- package/fesm2022/ngwr-lightbox.mjs +2 -2
- package/fesm2022/ngwr-lightbox.mjs.map +1 -1
- package/fesm2022/ngwr-load-state.mjs +2 -2
- package/fesm2022/ngwr-load-state.mjs.map +1 -1
- package/fesm2022/ngwr-mention.mjs +6 -6
- package/fesm2022/ngwr-mention.mjs.map +1 -1
- package/fesm2022/ngwr-meta.mjs +19 -3
- package/fesm2022/ngwr-meta.mjs.map +1 -1
- package/fesm2022/ngwr-overlay.mjs +3 -3
- package/fesm2022/ngwr-overlay.mjs.map +1 -1
- package/fesm2022/ngwr-pagination.mjs +7 -5
- package/fesm2022/ngwr-pagination.mjs.map +1 -1
- package/fesm2022/ngwr-pipes.mjs +3 -5
- package/fesm2022/ngwr-pipes.mjs.map +1 -1
- package/fesm2022/ngwr-platform.mjs +4 -1
- package/fesm2022/ngwr-platform.mjs.map +1 -1
- package/fesm2022/ngwr-popconfirm.mjs +6 -5
- package/fesm2022/ngwr-popconfirm.mjs.map +1 -1
- package/fesm2022/ngwr-popover.mjs +31 -30
- package/fesm2022/ngwr-popover.mjs.map +1 -1
- package/fesm2022/ngwr-pull-to-refresh.mjs +2 -2
- package/fesm2022/ngwr-pull-to-refresh.mjs.map +1 -1
- package/fesm2022/ngwr-qr.mjs +6 -6
- package/fesm2022/ngwr-qr.mjs.map +1 -1
- package/fesm2022/ngwr-radio.mjs +3 -3
- package/fesm2022/ngwr-radio.mjs.map +1 -1
- package/fesm2022/ngwr-rating.mjs +10 -10
- package/fesm2022/ngwr-rating.mjs.map +1 -1
- package/fesm2022/ngwr-schema-form.mjs +15 -5
- package/fesm2022/ngwr-schema-form.mjs.map +1 -1
- package/fesm2022/ngwr-select.mjs +57 -34
- package/fesm2022/ngwr-select.mjs.map +1 -1
- package/fesm2022/ngwr-sidebar.mjs +3 -3
- package/fesm2022/ngwr-sidebar.mjs.map +1 -1
- package/fesm2022/ngwr-skeleton.mjs +2 -2
- package/fesm2022/ngwr-skeleton.mjs.map +1 -1
- package/fesm2022/ngwr-slider-testing.mjs.map +1 -1
- package/fesm2022/ngwr-slider.mjs +13 -13
- package/fesm2022/ngwr-slider.mjs.map +1 -1
- package/fesm2022/ngwr-sortable-list.mjs +3 -3
- package/fesm2022/ngwr-sortable-list.mjs.map +1 -1
- package/fesm2022/ngwr-splitter.mjs +5 -5
- package/fesm2022/ngwr-splitter.mjs.map +1 -1
- package/fesm2022/ngwr-statistic.mjs +5 -3
- package/fesm2022/ngwr-statistic.mjs.map +1 -1
- package/fesm2022/ngwr-storage.mjs +6 -4
- package/fesm2022/ngwr-storage.mjs.map +1 -1
- package/fesm2022/ngwr-switch.mjs +2 -2
- package/fesm2022/ngwr-switch.mjs.map +1 -1
- package/fesm2022/ngwr-table-testing.mjs.map +1 -1
- package/fesm2022/ngwr-table.mjs +263 -32
- package/fesm2022/ngwr-table.mjs.map +1 -1
- package/fesm2022/ngwr-tabs.mjs +2 -2
- package/fesm2022/ngwr-tabs.mjs.map +1 -1
- package/fesm2022/ngwr-toast-testing.mjs +8 -1
- package/fesm2022/ngwr-toast-testing.mjs.map +1 -1
- package/fesm2022/ngwr-toast.mjs +63 -20
- package/fesm2022/ngwr-toast.mjs.map +1 -1
- package/fesm2022/ngwr-tour.mjs +7 -7
- package/fesm2022/ngwr-tour.mjs.map +1 -1
- package/fesm2022/ngwr-transfer.mjs +20 -9
- package/fesm2022/ngwr-transfer.mjs.map +1 -1
- package/fesm2022/ngwr-tree.mjs +64 -24
- package/fesm2022/ngwr-tree.mjs.map +1 -1
- package/fesm2022/ngwr-utils.mjs +98 -55
- package/fesm2022/ngwr-utils.mjs.map +1 -1
- package/fesm2022/ngwr-validators.mjs +2 -2
- package/fesm2022/ngwr-validators.mjs.map +1 -1
- package/fesm2022/ngwr-version.mjs +1 -1
- package/fesm2022/ngwr-version.mjs.map +1 -1
- package/fesm2022/ngwr-window.mjs +26 -26
- package/fesm2022/ngwr-window.mjs.map +1 -1
- package/fesm2022/ngwr.mjs.map +1 -1
- package/i18n/ar.json +5 -0
- package/i18n/cs.json +5 -0
- package/i18n/de.json +5 -0
- package/i18n/en.json +5 -0
- package/i18n/es.json +5 -0
- package/i18n/fr.json +5 -0
- package/i18n/he.json +5 -0
- package/i18n/hi.json +5 -0
- package/i18n/id.json +5 -0
- package/i18n/it.json +5 -0
- package/i18n/ja.json +5 -0
- package/i18n/ko.json +5 -0
- package/i18n/nl.json +5 -0
- package/i18n/pl.json +5 -0
- package/i18n/pt.json +5 -0
- package/i18n/ru.json +5 -0
- package/i18n/sv.json +5 -0
- package/i18n/tr.json +5 -0
- package/i18n/uk.json +5 -0
- package/i18n/vi.json +5 -0
- package/i18n/zh-TW.json +5 -0
- package/i18n/zh.json +5 -0
- package/input-number/styles/_index.scss +6 -0
- package/llms-full.txt +31 -19
- package/llms.txt +37 -19
- package/mcp/providers.js +1 -1
- package/package.json +15 -10
- package/pagination/styles/_index.scss +8 -0
- package/schematics/icon-set/index.js +3 -3
- package/schematics/migrations/v16/index.js +742 -0
- package/schematics/migrations.json +5 -0
- package/schematics/ng-add/index.js +4 -4
- package/schematics/provider/index.js +4 -4
- package/schematics/use/symbol-map.json +2 -0
- package/select/styles/_index.scss +1 -1
- package/skills/ngwr/SKILL.md +6 -4
- package/skills/ngwr/references/catalog.md +4 -2
- package/skills/ngwr/references/setup.md +10 -9
- package/table/styles/_index.scss +92 -30
- package/toast/styles/_index.scss +30 -0
- package/tree/styles/_index.scss +17 -0
- package/types/index-CXbgza47.d.ts +13 -0
- package/types/ngwr-animations-aurora.d.ts +1 -1
- package/types/ngwr-animations-blur-reveal.d.ts +2 -2
- package/types/ngwr-animations-dot-grid.d.ts +1 -2
- package/types/ngwr-animations-flow-lines.d.ts +1 -1
- package/types/ngwr-animations-fluid-cursor.d.ts +1 -1
- package/types/ngwr-animations-reveal.d.ts +4 -8
- package/types/ngwr-animations-ripple-grid.d.ts +1 -1
- package/types/ngwr-animations-spotlight.d.ts +1 -1
- package/types/ngwr-animations-thread-lines.d.ts +1 -1
- package/types/ngwr-animations-tilt.d.ts +1 -1
- package/types/ngwr-avatar.d.ts +2 -2
- package/types/ngwr-badge.d.ts +1 -1
- package/types/ngwr-cascader.d.ts +12 -1
- package/types/ngwr-charts-boxplot-chart.d.ts +1 -1
- package/types/ngwr-charts-bullet-chart.d.ts +2 -2
- package/types/ngwr-charts-candlestick-chart.d.ts +1 -1
- package/types/ngwr-charts-core.d.ts +12 -12
- package/types/ngwr-charts-line-chart.d.ts +2 -2
- package/types/ngwr-charts-radar-chart.d.ts +1 -1
- package/types/ngwr-charts-scatter-chart.d.ts +2 -2
- package/types/ngwr-charts-waterfall-chart.d.ts +1 -1
- package/types/ngwr-color-picker.d.ts +12 -12
- package/types/ngwr-copy-value-testing.d.ts +87 -0
- package/types/ngwr-copy-value.d.ts +95 -0
- package/types/ngwr-date-picker-testing.d.ts +3 -3
- package/types/ngwr-date-picker.d.ts +97 -1
- package/types/ngwr-date.d.ts +44 -3
- package/types/ngwr-dialog.d.ts +50 -3
- package/types/ngwr-directives.d.ts +40 -0
- package/types/ngwr-drawer.d.ts +1 -1
- package/types/ngwr-dropdown.d.ts +3 -2
- package/types/ngwr-hotkey.d.ts +5 -5
- package/types/ngwr-i18n.d.ts +3 -3
- package/types/ngwr-icon.d.ts +26 -26
- package/types/ngwr-input-number.d.ts +2 -2
- package/types/ngwr-input.d.ts +8 -8
- package/types/ngwr-load-state.d.ts +6 -6
- package/types/ngwr-meta.d.ts +18 -0
- package/types/ngwr-pipes.d.ts +6 -4
- package/types/ngwr-platform.d.ts +2 -1
- package/types/ngwr-popconfirm.d.ts +3 -2
- package/types/ngwr-popover.d.ts +4 -3
- package/types/ngwr-select.d.ts +33 -18
- package/types/ngwr-slider-testing.d.ts +2 -2
- package/types/ngwr-slider.d.ts +3 -3
- package/types/ngwr-statistic.d.ts +5 -1
- package/types/ngwr-storage.d.ts +1 -1
- package/types/ngwr-table-testing.d.ts +2 -1
- package/types/ngwr-table.d.ts +155 -18
- package/types/ngwr-tabs.d.ts +10 -2
- package/types/ngwr-toast-testing.d.ts +6 -2
- package/types/ngwr-toast.d.ts +33 -5
- package/types/ngwr-transfer.d.ts +5 -0
- package/types/ngwr-tree.d.ts +22 -2
- package/types/ngwr-utils.d.ts +157 -82
- package/types/ngwr-validators.d.ts +4 -2
- package/types/ngwr-version.d.ts +1 -1
- package/types/ngwr.d.ts +1 -0
- package/types/pointer-tracker-D7fXxLQL.d.ts +24 -0
- package/fesm2022/ngwr-animations-core.mjs.map +0 -1
- package/types/ngwr-animations-core.d.ts +0 -294
package/fesm2022/ngwr-tabs.mjs
CHANGED
|
@@ -2,7 +2,7 @@ import * as i0 from "@angular/core";
|
|
|
2
2
|
import { Component, DestroyRef, InjectionToken, TemplateRef, ViewEncapsulation, afterNextRender, computed, contentChildren, effect, forwardRef, inject, input, model, signal, viewChild } from "@angular/core";
|
|
3
3
|
import { coerceBooleanProperty } from "@angular/cdk/coercion";
|
|
4
4
|
import { NgTemplateOutlet } from "@angular/common";
|
|
5
|
-
import {
|
|
5
|
+
import { wrCheckStyles, wrRandomId } from "ngwr/utils";
|
|
6
6
|
import { Directionality } from "@angular/cdk/bidi";
|
|
7
7
|
/**
|
|
8
8
|
* @license
|
|
@@ -26,7 +26,7 @@ const WR_TABS_ROUTING = new InjectionToken("WR_TABS_ROUTING");
|
|
|
26
26
|
*/
|
|
27
27
|
var WrTab = class WrTab {
|
|
28
28
|
title = input.required(...ngDevMode ? [{ debugName: "title" }] : /* istanbul ignore next */ []);
|
|
29
|
-
key = input(
|
|
29
|
+
key = input(wrRandomId("wr-tab"), ...ngDevMode ? [{ debugName: "key" }] : /* istanbul ignore next */ []);
|
|
30
30
|
routerLink = input(null, ...ngDevMode ? [{ debugName: "routerLink" }] : /* istanbul ignore next */ []);
|
|
31
31
|
disabled = input(false, {
|
|
32
32
|
...ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ngwr-tabs.mjs","names":[],"sources":["../../../projects/lib/tabs/tokens/tabs.token.ts","../../../projects/lib/tabs/tokens/tabs-routing.token.ts","../../../projects/lib/tabs/tab.ts","../../../projects/lib/tabs/tabs.ts","../../../projects/lib/tabs/tabs.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 { InjectionToken } from '@angular/core';\n\nimport type { WrTabsContext } from '../types';\n\n/**\n * Token a `<wr-tab>` injects to register itself with — and read the active\n * key from — its parent `<wr-tabs>` host.\n *\n * @internal\n */\nexport const WR_TABS = new InjectionToken<WrTabsContext>('WR_TABS');\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 { InjectionToken } from '@angular/core';\n\nimport type { WrTabsRoutingAdapter } from '../types';\n\n/**\n * Token a `<wr-tabs>` reads to find out whether router tabs are usable. Provided\n * by the `WrTabsRouting` directive from `ngwr/tabs/router`; absent by default,\n * which is what keeps `@angular/router` out of a content-only strip.\n */\nexport const WR_TABS_ROUTING = new InjectionToken<WrTabsRoutingAdapter>('WR_TABS_ROUTING');\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 } from '@angular/cdk/coercion';\nimport {\n Component,\n DestroyRef,\n TemplateRef,\n ViewEncapsulation,\n computed,\n inject,\n input,\n viewChild,\n} from '@angular/core';\n\nimport { randomId, wrCheckStyles } from 'ngwr/utils';\n\nimport { WR_TABS, WR_TABS_ROUTING } from './tokens';\n\n/**\n * Single tab. Two modes, decided by inputs:\n *\n * - **Content tab** — projected children render in the parent's content\n * panel when this tab is active.\n * - **Router tab** — set `routerLink` and the tab becomes a link; the\n * parent skips its content panel and the consumer drops a\n * `<router-outlet>` below the tab strip. Router mode needs the\n * `WrTabsRouting` directive from `ngwr/tabs/router` in the same\n * `imports: []`; without it a strip carrying a `routerLink` throws.\n */\n@Component({\n selector: 'wr-tab',\n template: `<ng-template><ng-content /></ng-template>`,\n encapsulation: ViewEncapsulation.None,\n // A BOUND display rather than a static `style` attribute: Angular writes a\n // binding through `style.setProperty`, which no CSP governs, while a real\n // `style=\"…\"` attribute is refused under `style-src 'self'` — and this host\n // would then lay out an empty box in the middle of the content.\n // The host is `display: none`, so the tooltip never shows — but a static\n // `title=` still lands on it. See `WrAlert` for the whole shape.\n host: { '[style.display]': \"'none'\", '[attr.title]': 'null' },\n})\nexport class WrTab {\n /** Visible label on the tab strip. */\n readonly title = input.required<string>();\n\n /**\n * Stable identifier used by the parent to track the active tab.\n * Auto-generated if omitted.\n */\n readonly key = input<string>(randomId('wr-tab'));\n\n /** Router target — when set, the tab becomes a `[routerLink]` link. */\n readonly routerLink = input<string | readonly string[] | null>(null);\n\n /** Disable the tab. */\n readonly disabled = input(false, { transform: coerceBooleanProperty });\n\n /** Tab content template; portaled into the parent's panel area. @internal */\n readonly contentTpl = viewChild.required(TemplateRef);\n\n private readonly parent = inject(WR_TABS, { optional: true });\n private readonly destroyRef = inject(DestroyRef);\n\n /**\n * The routing adapter published by `WrTabsRouting` on the parent `<wr-tabs>`\n * element. A `<wr-tab>` is DECLARED inside `<wr-tabs>` in the consumer's\n * template — content projection moves where it renders, not where it injects\n * — so the parent's element injector is this one's, the same walk that\n * resolves `WR_TABS` above.\n */\n private readonly routing = inject(WR_TABS_ROUTING, { optional: true });\n\n protected readonly isRouter = computed(() => this.routerLink() !== null);\n\n /**\n * Resolved href for a router tab — `null` for a content tab, and for a\n * disabled one, which is how the anchor stops navigating at all.\n * @internal\n */\n readonly routerHref = computed(() => {\n const link = this.routerLink();\n if (link === null || this.disabled()) return null;\n return this.routing?.href(link) ?? null;\n });\n\n /**\n * Whether the current route selects this tab. The strip publishes it as BOTH\n * `aria-selected` and the `--active` class, off this one read, so the\n * announced selection and the painted one cannot drift apart.\n * @internal\n */\n readonly routerActive = computed(() => {\n const link = this.routerLink();\n if (link === null || this.disabled()) return false;\n return this.routing?.isActive(link) ?? false;\n });\n\n /** Hand a click on this tab's anchor to the routing adapter. @internal */\n navigate(event: MouseEvent): void {\n const link = this.routerLink();\n if (link === null || this.disabled()) return;\n this.routing?.navigate(link, event);\n }\n\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('tabs');\n if (this.parent) {\n // Both calls run with the input signals still on their defaults — a\n // constructor is too early for `key()` to be the consumer's value. The\n // parent tracks tabs through `contentChildren` and seeds `active` from\n // there; these stay as the declared lifecycle contract.\n this.parent.register({ key: this.key(), routerLink: this.routerLink() });\n this.destroyRef.onDestroy(() => this.parent?.unregister(this.key()));\n }\n }\n}\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { Directionality } from '@angular/cdk/bidi';\nimport { NgTemplateOutlet } from '@angular/common';\nimport {\n Component,\n DestroyRef,\n type ElementRef,\n ViewEncapsulation,\n afterNextRender,\n computed,\n contentChildren,\n effect,\n forwardRef,\n inject,\n input,\n model,\n signal,\n viewChild,\n} from '@angular/core';\n\nimport { wrCheckStyles } from 'ngwr/utils';\n\nimport { WrTab } from './tab';\nimport { WR_TABS, WR_TABS_ROUTING } from './tokens';\nimport type { WrTabsContext } from './types';\n\n/**\n * Instance counter for the header / panel ids. Deterministic under prerender,\n * unlike `randomId()` — the same reason `wr-sidebar` and `wr-mention` count.\n *\n * The ids used to be built from the tab key alone, so two `<wr-tabs>` on one\n * page that both name a tab `key=\"overview\"` emitted the same\n * `wr-tab-overview-header` twice, and the second group's `aria-labelledby`\n * resolved to the FIRST group's tab. A key is documented as parent-scoped, so\n * it is the parent that has to make it unique document-wide.\n */\nlet tabsUid = 0;\n\n/**\n * A tab key as an id fragment: anything outside `[A-Za-z0-9_-]` becomes `-`.\n * These ids land in `aria-controls` / `aria-labelledby`, which are\n * space-separated IDREF lists — `key=\"my tab\"` emitted\n * `aria-controls=\"wr-tab-my tab-panel\"`, two tokens, neither of which resolves.\n *\n * Two keys differing only outside that set collapse to one fragment; the\n * instance counter keeps that inside a single group, where the keys are the\n * consumer's own to keep apart.\n */\nfunction idFragment(key: string): string {\n return key.replace(/[^A-Za-z0-9_-]/g, '-');\n}\n\n/**\n * Tabbed container. Two modes depending on the child `<wr-tab>`\n * definitions:\n *\n * - **Content** — children project body content; the parent renders an\n * active-tab panel automatically.\n * - **Router** — any child with `routerLink` switches the whole strip\n * into router mode; the parent skips its panel so the consumer can\n * drop a `<router-outlet>` after it. That mode needs the `WrTabsRouting`\n * directive from `ngwr/tabs/router` alongside `WrTabs` in `imports: []`\n * — the strip itself names no `@angular/router` symbol, which is what\n * keeps a content-only strip free of the router.\n *\n * @example\n * ```html\n * <!-- content tabs -->\n * <wr-tabs [(active)]=\"key\">\n * <wr-tab key=\"one\" title=\"One\">First panel</wr-tab>\n * <wr-tab key=\"two\" title=\"Two\">Second panel</wr-tab>\n * </wr-tabs>\n *\n * <!-- router tabs: imports: [WrTabs, WrTab, WrTabsRouting] -->\n * <wr-tabs>\n * <wr-tab title=\"Overview\" routerLink=\"overview\" />\n * <wr-tab title=\"Details\" routerLink=\"details\" />\n * </wr-tabs>\n * <router-outlet />\n * ```\n *\n * @see https://ngwr.dev/reference/components/tabs\n */\n@Component({\n selector: 'wr-tabs',\n templateUrl: './tabs.html',\n encapsulation: ViewEncapsulation.None,\n host: {\n class: 'wr-tabs',\n '[class.wr-tabs--fade-start]': 'canScrollStart()',\n '[class.wr-tabs--fade-end]': 'canScrollEnd()',\n '[class.wr-tabs--sm]': \"size() === 'sm'\",\n '[class.wr-tabs--lg]': \"size() === 'lg'\",\n },\n imports: [NgTemplateOutlet],\n providers: [\n {\n provide: WR_TABS,\n // eslint-disable-next-line @angular-eslint/no-forward-ref\n useExisting: forwardRef(() => WrTabs),\n },\n ],\n})\nexport class WrTabs implements WrTabsContext {\n /** Two-way bindable active tab key (content mode). */\n readonly active = model<string | null>(null);\n\n /** Visual size variant. */\n readonly size = input<'sm' | 'md' | 'lg'>('md');\n\n protected readonly tabs = contentChildren(WrTab);\n\n private readonly dir = inject(Directionality, { optional: true });\n\n /**\n * Reading direction of the strip. `Directionality` is root-provided, so this\n * always resolves — `optional` only guards a consumer who has deliberately\n * torn the provider out. It reads the document once at construction; a\n * subtree that overrides the direction does it with the CDK's `Dir`\n * directive, which writes `valueSignal`, so the read stays reactive.\n */\n private readonly isRtl = computed(() => this.dir?.valueSignal() === 'rtl');\n\n /**\n * The routing adapter, when `WrTabsRouting` from `ngwr/tabs/router` is in the\n * consumer's `imports`. `null` is the default and the whole point: the strip\n * has no `@angular/router` import of its own, so a content-only tab strip\n * costs no router bytes.\n */\n private readonly routing = inject(WR_TABS_ROUTING, { optional: true });\n\n /**\n * When any child has a routerLink, the whole strip switches to router mode.\n *\n * Throws rather than degrading when the adapter is missing. Falling back to\n * content mode would render the tabs as `<button>`s that navigate nowhere and\n * open an empty panel — a strip that looks right and does nothing, with the\n * one missing import unnamed. The route is what selects a tab here, so there\n * is no half of this that still works.\n */\n protected readonly isRouter = computed(() => {\n const isRouter = this.tabs().some(t => t.routerLink() !== null);\n if (isRouter && !this.routing) {\n throw new Error(\n '<wr-tabs>: a <wr-tab> sets `routerLink`, but no routing adapter is provided. ' +\n \"Add `WrTabsRouting` from 'ngwr/tabs/router' to the `imports` of the component that \" +\n 'declares this strip.'\n );\n }\n return isRouter;\n });\n\n /** Content-mode: the tab whose key matches `active()` (or the first tab if none yet). */\n protected readonly activeTab = computed(() => {\n const key = this.active();\n const tabs = this.tabs();\n if (tabs.length === 0) return null;\n // Same fallback as the seed: landing on a disabled tab leaves the strip\n // with no tab stop at all.\n return tabs.find(t => t.key() === key) ?? tabs.find(t => !t.disabled()) ?? tabs[0];\n });\n\n /**\n * Router mode: the one tab in the tab order — the tab the route selects, else\n * the first enabled one, so a URL no tab matches still leaves the strip\n * reachable. The roving stop content mode keeps; without it every router tab\n * was a Tab stop of its own.\n */\n protected readonly routerStop = computed(() => {\n const enabled = this.tabs().filter(t => !t.disabled());\n return enabled.find(t => t.routerActive()) ?? enabled[0] ?? null;\n });\n\n // WrTabsContext\n\n activate(key: string): void {\n this.active.set(key);\n }\n\n register(): void {\n // Deliberately a no-op. A `WrTab` calls this from its own constructor,\n // where its `key` signal input is not bound yet — so it would report the\n // generated default and this parent would write THAT into `active`. The\n // effect below seeds from `tabs()`, by which point the inputs are real.\n }\n\n unregister(): void {\n // No-op: contentChildren handles removal.\n }\n\n // Template handlers\n\n protected readonly stripRef = viewChild<ElementRef<HTMLElement>>('strip');\n\n /** Whether the strip is scrolled away from its start / end — drives the edge fades. */\n protected readonly canScrollStart = signal(false);\n protected readonly canScrollEnd = signal(false);\n\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('tabs');\n // Seed `active` with the first tab's key, once the content children exist.\n // Without this the model writes back a generated id like\n // `wr-tab-b1crta5aix0v`: the strip still highlighted the right tab, because\n // `activeTab()` falls back to `tabs[0]`, so the only visible symptom was a\n // two-way binding holding a key the consumer had never heard of.\n //\n // `previousKeys` is what the last run saw. The first runs can see a `[key]`\n // binding still on its generated default — measured with keys bound inside\n // an `@for` — so \"the bound key is not among the tabs\" cannot mean \"removed\"\n // on its own: it would throw away a key the consumer bound before its tab\n // had bound its own. The same memory is what lets a seed that landed on a\n // generated default correct itself once the real keys arrive.\n let previousKeys: ReadonlySet<string> = new Set();\n effect(() => {\n const tabs = this.tabs();\n const keys = tabs.map(t => t.key());\n const key = this.active();\n // Also re-seed when the active tab LEAVES the list. `activeTab()` falls\n // back on its own, so the strip showed the fallback while `[(active)]`\n // kept the gone key: a host persisting the selection saved a tab that no\n // longer existed, and a tab later added under that key took the\n // selection back without anyone asking. A key the list has never held is\n // left alone — that is a tab still on its way, not one that went.\n const removed = key !== null && previousKeys.has(key) && !keys.includes(key);\n previousKeys = new Set(keys);\n // The first ENABLED tab, not the first tab. Every other path already\n // skips a disabled one — `onStripKeydown` filters them out and\n // `onTabClick` returns early — so a strip whose first tab is behind a\n // flag seeded `active` to a key nothing can select: the roving stop is\n // `tab === activeTab() && !tab.disabled()`, which no button then\n // satisfied, and the whole strip left the tab order.\n if (tabs.length > 0 && (key === null || removed)) {\n this.active.set((tabs.find(t => !t.disabled()) ?? tabs[0]).key());\n }\n });\n\n const destroyRef = inject(DestroyRef);\n afterNextRender(() => {\n this.updateFades();\n const el = this.stripRef()?.nativeElement;\n if (!el || typeof ResizeObserver === 'undefined') return;\n // Re-evaluate when the strip's width changes (e.g. the container narrows\n // and the tabs start overflowing).\n const ro = new ResizeObserver(() => this.updateFades());\n ro.observe(el);\n destroyRef.onDestroy(() => ro.disconnect());\n });\n }\n\n /** Recompute which edges can scroll, from the strip's scroll metrics. @internal */\n protected updateFades(): void {\n const el = this.stripRef()?.nativeElement;\n if (!el) return;\n const max = el.scrollWidth - el.clientWidth;\n // Distance from the INLINE start, which is what the two fades mean.\n // `scrollLeft` is 0 at the inline start in BOTH directions and counts away\n // from it — up in LTR, DOWN into negatives under `dir=\"rtl\"` (the CSSOM\n // model every engine Angular 22 supports now implements; the legacy\n // \"reversed\"/\"normal\" RTL conventions are gone). Read raw, the RTL value\n // said \"never scrolled from the start, always more to come\" at every\n // position: the end fade was pinned on and the start fade never appeared.\n //\n // Clamped rather than `Math.abs`, because an elastic overscroll reports a\n // value of the WRONG sign at the start edge — a rubber-band past the start\n // is still the start, and `abs` would light the start fade there in LTR too.\n const scrolled = this.isRtl() ? Math.max(-el.scrollLeft, 0) : Math.max(el.scrollLeft, 0);\n this.canScrollStart.set(scrolled > 1);\n this.canScrollEnd.set(max > 1 && scrolled < max - 1);\n }\n\n protected onTabClick(tab: WrTab): void {\n if (tab.disabled()) return;\n if (!this.isRouter()) this.activate(tab.key());\n }\n\n /**\n * Click on a router tab's anchor. The anchor carries a real `href`, so a\n * modified or middle click is left alone and the browser opens it the way it\n * opens any link; only a plain left click is turned into a navigation.\n */\n protected onRouterTabClick(tab: WrTab, event: MouseEvent): void {\n tab.navigate(event);\n }\n\n /**\n * Space on a router tab. The anchor answers Enter on its own, as a link does,\n * but `role=\"tab\"` promises Space as well (WAI-ARIA APG), and on a bare link\n * Space scrolls the page instead. Routed through a real click so the one\n * navigation path above handles both keys.\n */\n protected onRouterTabSpace(event: Event): void {\n event.preventDefault();\n (event.currentTarget as HTMLElement).click();\n }\n\n /** Per-instance prefix, so keys only have to be unique within one group. */\n private readonly uid = ++tabsUid;\n\n /** Header id for `aria-labelledby` on the panel. @internal */\n headerId(key: string): string {\n return `wr-tabs-${this.uid}-tab-${idFragment(key)}-header`;\n }\n\n /** Panel id for `aria-controls` on the tab header. @internal */\n panelId(key: string): string {\n return `wr-tabs-${this.uid}-tab-${idFragment(key)}-panel`;\n }\n\n /** ArrowLeft/Right/Home/End keyboard navigation on the tab strip. */\n protected onStripKeydown(event: KeyboardEvent): void {\n const tabs = this.tabs().filter(t => !t.disabled());\n if (tabs.length === 0) return;\n\n // Step from where FOCUS is, not from what is active.\n //\n // In router mode nothing ever moves `active` — `onTabClick` and this\n // handler both gate `activate()` on `!isRouter()`, because the route is\n // what selects a tab there. Reading the neighbour off `activeTab()`\n // therefore recomputed the same `idx` on every press, and ArrowRight\n // walked from the first tab to the second and stayed there for the rest of\n // the session. In manual mode focus and activation move together, so the\n // two readings agree and nothing changes.\n const strip = this.stripRef()?.nativeElement;\n const focused = strip?.ownerDocument.activeElement;\n const focusedIdx =\n focused instanceof HTMLElement && strip?.contains(focused)\n ? tabs.findIndex(t => this.headerId(t.key()) === focused.id)\n : -1;\n const active = this.activeTab();\n const idx = focusedIdx >= 0 ? focusedIdx : active ? tabs.indexOf(active) : -1;\n // The two neighbours in DOM order, wrapping at the ends.\n const forward = idx < tabs.length - 1 ? idx + 1 : 0;\n const backward = idx > 0 ? idx - 1 : tabs.length - 1;\n const rtl = this.isRtl();\n let nextIdx: number;\n\n switch (event.key) {\n // Arrow keys follow VISUAL order (WAI-ARIA APG). The strip is mirrored\n // under `dir=\"rtl\"`, so ArrowRight moves toward the visual right, which is\n // the PREVIOUS tab there.\n case 'ArrowRight':\n nextIdx = rtl ? backward : forward;\n break;\n case 'ArrowLeft':\n nextIdx = rtl ? forward : backward;\n break;\n // Home / End name a position in the tab list — first and last — not a\n // physical edge, so they read the same in both directions.\n case 'Home':\n nextIdx = 0;\n break;\n case 'End':\n nextIdx = tabs.length - 1;\n break;\n default:\n return;\n }\n\n event.preventDefault();\n const next = tabs[nextIdx];\n if (!this.isRouter()) this.activate(next.key());\n // Move focus to the corresponding header element.\n const headerEl = this.stripRef()?.nativeElement.querySelector<HTMLElement>(\n `#${CSS.escape(this.headerId(next.key()))}`\n );\n headerEl?.focus();\n }\n}\n","<!-- eslint-disable-next-line @angular-eslint/template/interactive-supports-focus -->\n<div\n #strip\n class=\"wr-tabs__strip\"\n role=\"tablist\"\n aria-orientation=\"horizontal\"\n (keydown)=\"onStripKeydown($event)\"\n (scroll)=\"updateFades()\"\n>\n @for (tab of tabs(); track tab.key()) {\n @if (tab.routerLink() !== null) {\n <!--\n `aria-selected` and `--active` come off the SAME `tab.routerActive()`, so the\n announced state and the painted one can never disagree. Without it a\n `role=\"tablist\"` shipped with no tab selected in any of them: the route decides\n here, and the class it paints is invisible to assistive tech.\n\n A real `href` rather than a `[routerLink]`: the directive would drag\n `@angular/router` into every content-only strip as well (see `WR_TABS_ROUTING`).\n The href, the active match and the click all come from the adapter the\n `ngwr/tabs/router` directive publishes, which is `RouterLink` doing the work.\n -->\n <a\n class=\"wr-tabs__tab\"\n role=\"tab\"\n [attr.id]=\"headerId(tab.key())\"\n [attr.href]=\"tab.routerHref()\"\n [class.wr-tabs__tab--active]=\"tab.routerActive()\"\n [class.wr-tabs__tab--disabled]=\"tab.disabled()\"\n [attr.aria-disabled]=\"tab.disabled() ? true : null\"\n [attr.aria-selected]=\"tab.routerActive()\"\n [attr.tabindex]=\"tab === routerStop() ? 0 : -1\"\n (click)=\"onRouterTabClick(tab, $event)\"\n (keydown.space)=\"onRouterTabSpace($event)\"\n >\n {{ tab.title() }}\n </a>\n } @else {\n <button\n type=\"button\"\n class=\"wr-tabs__tab\"\n role=\"tab\"\n [attr.id]=\"headerId(tab.key())\"\n [attr.aria-controls]=\"panelId(tab.key())\"\n [attr.tabindex]=\"tab === activeTab() && !tab.disabled() ? 0 : -1\"\n [class.wr-tabs__tab--active]=\"tab === activeTab()\"\n [class.wr-tabs__tab--disabled]=\"tab.disabled()\"\n [attr.aria-selected]=\"tab === activeTab()\"\n [disabled]=\"tab.disabled()\"\n (click)=\"onTabClick(tab)\"\n >\n {{ tab.title() }}\n </button>\n }\n }\n</div>\n\n@if (!isRouter() && activeTab(); as tab) {\n <div\n class=\"wr-tabs__panel\"\n role=\"tabpanel\"\n tabindex=\"0\"\n [attr.id]=\"panelId(tab.key())\"\n [attr.aria-labelledby]=\"headerId(tab.key())\"\n >\n <ng-container [ngTemplateOutlet]=\"tab.contentTpl()\" />\n </div>\n}\n"],"mappings":";;;;;;;;;;;;AAiBA,MAAa,UAAU,IAAI,eAA8B,SAAS;;;;;;;ACDlE,MAAa,kBAAkB,IAAI,eAAqC,iBAAiB;;;;;;;AC8BzF,IAAa,QAAb,MAAa,MAAK;CAEP,QAAQ,MAAM,SAAkB,GAAA,YAAA,CAAA,EAAA,WAAA,QAAA,CAAA,+BAAA,CAAA,CAAA;CAMhC,MAAM,MAAc,SAAS,QAAQ,GAAE,GAAA,YAAA,CAAA,EAAA,WAAA,MAAA,CAAA,+BAAA,CAAA,CAAA;CAGvC,aAAa,MAAyC,MAAK,GAAA,YAAA,CAAA,EAAA,WAAA,aAAA,CAAA,+BAAA,CAAA,CAAA;CAG3D,WAAW,MAAM,OAAK;EAAA,GAAA,YAAA,EAAA,WAAA,WAAA,+BAAA,CAAA;EAAI,WAAW;CAAqB,CAAA;CAG1D,aAAa,UAAU,SAAS,aAAY,GAAA,YAAA,CAA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AA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,MAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,GAAA,iBAAA,KAAK,GAAA,EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;EAAA,UAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAkFkB,SAAO,EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;CAAA;AAAA,CAAA"}
|
|
1
|
+
{"version":3,"file":"ngwr-tabs.mjs","names":[],"sources":["../../../projects/lib/tabs/tokens/tabs.token.ts","../../../projects/lib/tabs/tokens/tabs-routing.token.ts","../../../projects/lib/tabs/tab.ts","../../../projects/lib/tabs/tabs.ts","../../../projects/lib/tabs/tabs.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 { InjectionToken } from '@angular/core';\n\nimport type { WrTabsContext } from '../types';\n\n/**\n * Token a `<wr-tab>` injects to register itself with — and read the active\n * key from — its parent `<wr-tabs>` host.\n *\n * @internal\n */\nexport const WR_TABS = new InjectionToken<WrTabsContext>('WR_TABS');\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 { InjectionToken } from '@angular/core';\n\nimport type { WrTabsRoutingAdapter } from '../types';\n\n/**\n * Token a `<wr-tabs>` reads to find out whether router tabs are usable. Provided\n * by the `WrTabsRouting` directive from `ngwr/tabs/router`; absent by default,\n * which is what keeps `@angular/router` out of a content-only strip.\n */\nexport const WR_TABS_ROUTING = new InjectionToken<WrTabsRoutingAdapter>('WR_TABS_ROUTING');\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 } from '@angular/cdk/coercion';\nimport {\n Component,\n DestroyRef,\n TemplateRef,\n ViewEncapsulation,\n computed,\n inject,\n input,\n viewChild,\n} from '@angular/core';\n\nimport { wrRandomId, wrCheckStyles } from 'ngwr/utils';\n\nimport { WR_TABS, WR_TABS_ROUTING } from './tokens';\n\n/**\n * Single tab. Two modes, decided by inputs:\n *\n * - **Content tab** — projected children render in the parent's content\n * panel when this tab is active.\n * - **Router tab** — set `routerLink` and the tab becomes a link; the\n * parent skips its content panel and the consumer drops a\n * `<router-outlet>` below the tab strip. Router mode needs the\n * `WrTabsRouting` directive from `ngwr/tabs/router` in the same\n * `imports: []`; without it a strip carrying a `routerLink` throws.\n */\n@Component({\n selector: 'wr-tab',\n template: `<ng-template><ng-content /></ng-template>`,\n encapsulation: ViewEncapsulation.None,\n // A BOUND display rather than a static `style` attribute: Angular writes a\n // binding through `style.setProperty`, which no CSP governs, while a real\n // `style=\"…\"` attribute is refused under `style-src 'self'` — and this host\n // would then lay out an empty box in the middle of the content.\n // The host is `display: none`, so the tooltip never shows — but a static\n // `title=` still lands on it. See `WrAlert` for the whole shape.\n host: { '[style.display]': \"'none'\", '[attr.title]': 'null' },\n})\nexport class WrTab {\n /** Visible label on the tab strip. */\n readonly title = input.required<string>();\n\n /**\n * Stable identifier used by the parent to track the active tab.\n * Auto-generated if omitted.\n */\n readonly key = input<string>(wrRandomId('wr-tab'));\n\n /** Router target — when set, the tab becomes a `[routerLink]` link. */\n readonly routerLink = input<string | readonly string[] | null>(null);\n\n /** Disable the tab. */\n readonly disabled = input(false, { transform: coerceBooleanProperty });\n\n /** Tab content template; portaled into the parent's panel area. @internal */\n readonly contentTpl = viewChild.required(TemplateRef);\n\n private readonly parent = inject(WR_TABS, { optional: true });\n private readonly destroyRef = inject(DestroyRef);\n\n /**\n * The routing adapter published by `WrTabsRouting` on the parent `<wr-tabs>`\n * element. A `<wr-tab>` is DECLARED inside `<wr-tabs>` in the consumer's\n * template — content projection moves where it renders, not where it injects\n * — so the parent's element injector is this one's, the same walk that\n * resolves `WR_TABS` above.\n */\n private readonly routing = inject(WR_TABS_ROUTING, { optional: true });\n\n protected readonly isRouter = computed(() => this.routerLink() !== null);\n\n /**\n * Resolved href for a router tab — `null` for a content tab, and for a\n * disabled one, which is how the anchor stops navigating at all.\n * @internal\n */\n readonly routerHref = computed(() => {\n const link = this.routerLink();\n if (link === null || this.disabled()) return null;\n return this.routing?.href(link) ?? null;\n });\n\n /**\n * Whether the current route selects this tab. The strip publishes it as BOTH\n * `aria-selected` and the `--active` class, off this one read, so the\n * announced selection and the painted one cannot drift apart.\n * @internal\n */\n readonly routerActive = computed(() => {\n const link = this.routerLink();\n if (link === null || this.disabled()) return false;\n return this.routing?.isActive(link) ?? false;\n });\n\n /** Hand a click on this tab's anchor to the routing adapter. @internal */\n navigate(event: MouseEvent): void {\n const link = this.routerLink();\n if (link === null || this.disabled()) return;\n this.routing?.navigate(link, event);\n }\n\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('tabs');\n if (this.parent) {\n // Both calls run with the input signals still on their defaults — a\n // constructor is too early for `key()` to be the consumer's value. The\n // parent tracks tabs through `contentChildren` and seeds `active` from\n // there; these stay as the declared lifecycle contract.\n this.parent.register({ key: this.key(), routerLink: this.routerLink() });\n this.destroyRef.onDestroy(() => this.parent?.unregister(this.key()));\n }\n }\n}\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { Directionality } from '@angular/cdk/bidi';\nimport { NgTemplateOutlet } from '@angular/common';\nimport {\n Component,\n DestroyRef,\n type ElementRef,\n ViewEncapsulation,\n afterNextRender,\n computed,\n contentChildren,\n effect,\n forwardRef,\n inject,\n input,\n model,\n signal,\n viewChild,\n} from '@angular/core';\n\nimport { wrCheckStyles } from 'ngwr/utils';\n\nimport { WrTab } from './tab';\nimport { WR_TABS, WR_TABS_ROUTING } from './tokens';\nimport type { WrTabsContext, WrTabsSize } from './types';\n\n/**\n * Instance counter for the header / panel ids. Deterministic under prerender,\n * unlike `wrRandomId()` — the same reason `wr-sidebar` and `wr-mention` count.\n *\n * The ids used to be built from the tab key alone, so two `<wr-tabs>` on one\n * page that both name a tab `key=\"overview\"` emitted the same\n * `wr-tab-overview-header` twice, and the second group's `aria-labelledby`\n * resolved to the FIRST group's tab. A key is documented as parent-scoped, so\n * it is the parent that has to make it unique document-wide.\n */\nlet tabsUid = 0;\n\n/**\n * A tab key as an id fragment: anything outside `[A-Za-z0-9_-]` becomes `-`.\n * These ids land in `aria-controls` / `aria-labelledby`, which are\n * space-separated IDREF lists — `key=\"my tab\"` emitted\n * `aria-controls=\"wr-tab-my tab-panel\"`, two tokens, neither of which resolves.\n *\n * Two keys differing only outside that set collapse to one fragment; the\n * instance counter keeps that inside a single group, where the keys are the\n * consumer's own to keep apart.\n */\nfunction idFragment(key: string): string {\n return key.replace(/[^A-Za-z0-9_-]/g, '-');\n}\n\n/**\n * Tabbed container. Two modes depending on the child `<wr-tab>`\n * definitions:\n *\n * - **Content** — children project body content; the parent renders an\n * active-tab panel automatically.\n * - **Router** — any child with `routerLink` switches the whole strip\n * into router mode; the parent skips its panel so the consumer can\n * drop a `<router-outlet>` after it. That mode needs the `WrTabsRouting`\n * directive from `ngwr/tabs/router` alongside `WrTabs` in `imports: []`\n * — the strip itself names no `@angular/router` symbol, which is what\n * keeps a content-only strip free of the router.\n *\n * @example\n * ```html\n * <!-- content tabs -->\n * <wr-tabs [(active)]=\"key\">\n * <wr-tab key=\"one\" title=\"One\">First panel</wr-tab>\n * <wr-tab key=\"two\" title=\"Two\">Second panel</wr-tab>\n * </wr-tabs>\n *\n * <!-- router tabs: imports: [WrTabs, WrTab, WrTabsRouting] -->\n * <wr-tabs>\n * <wr-tab title=\"Overview\" routerLink=\"overview\" />\n * <wr-tab title=\"Details\" routerLink=\"details\" />\n * </wr-tabs>\n * <router-outlet />\n * ```\n *\n * @see https://ngwr.dev/reference/components/tabs\n */\n@Component({\n selector: 'wr-tabs',\n templateUrl: './tabs.html',\n encapsulation: ViewEncapsulation.None,\n host: {\n class: 'wr-tabs',\n '[class.wr-tabs--fade-start]': 'canScrollStart()',\n '[class.wr-tabs--fade-end]': 'canScrollEnd()',\n '[class.wr-tabs--sm]': \"size() === 'sm'\",\n '[class.wr-tabs--lg]': \"size() === 'lg'\",\n },\n imports: [NgTemplateOutlet],\n providers: [\n {\n provide: WR_TABS,\n // eslint-disable-next-line @angular-eslint/no-forward-ref\n useExisting: forwardRef(() => WrTabs),\n },\n ],\n})\nexport class WrTabs implements WrTabsContext {\n /** Two-way bindable active tab key (content mode). */\n readonly active = model<string | null>(null);\n\n /** Visual size variant. */\n readonly size = input<WrTabsSize>('md');\n\n protected readonly tabs = contentChildren(WrTab);\n\n private readonly dir = inject(Directionality, { optional: true });\n\n /**\n * Reading direction of the strip. `Directionality` is root-provided, so this\n * always resolves — `optional` only guards a consumer who has deliberately\n * torn the provider out. It reads the document once at construction; a\n * subtree that overrides the direction does it with the CDK's `Dir`\n * directive, which writes `valueSignal`, so the read stays reactive.\n */\n private readonly isRtl = computed(() => this.dir?.valueSignal() === 'rtl');\n\n /**\n * The routing adapter, when `WrTabsRouting` from `ngwr/tabs/router` is in the\n * consumer's `imports`. `null` is the default and the whole point: the strip\n * has no `@angular/router` import of its own, so a content-only tab strip\n * costs no router bytes.\n */\n private readonly routing = inject(WR_TABS_ROUTING, { optional: true });\n\n /**\n * When any child has a routerLink, the whole strip switches to router mode.\n *\n * Throws rather than degrading when the adapter is missing. Falling back to\n * content mode would render the tabs as `<button>`s that navigate nowhere and\n * open an empty panel — a strip that looks right and does nothing, with the\n * one missing import unnamed. The route is what selects a tab here, so there\n * is no half of this that still works.\n */\n protected readonly isRouter = computed(() => {\n const isRouter = this.tabs().some(t => t.routerLink() !== null);\n if (isRouter && !this.routing) {\n throw new Error(\n '<wr-tabs>: a <wr-tab> sets `routerLink`, but no routing adapter is provided. ' +\n \"Add `WrTabsRouting` from 'ngwr/tabs/router' to the `imports` of the component that \" +\n 'declares this strip.'\n );\n }\n return isRouter;\n });\n\n /** Content-mode: the tab whose key matches `active()` (or the first tab if none yet). */\n protected readonly activeTab = computed(() => {\n const key = this.active();\n const tabs = this.tabs();\n if (tabs.length === 0) return null;\n // Same fallback as the seed: landing on a disabled tab leaves the strip\n // with no tab stop at all.\n return tabs.find(t => t.key() === key) ?? tabs.find(t => !t.disabled()) ?? tabs[0];\n });\n\n /**\n * Router mode: the one tab in the tab order — the tab the route selects, else\n * the first enabled one, so a URL no tab matches still leaves the strip\n * reachable. The roving stop content mode keeps; without it every router tab\n * was a Tab stop of its own.\n */\n protected readonly routerStop = computed(() => {\n const enabled = this.tabs().filter(t => !t.disabled());\n return enabled.find(t => t.routerActive()) ?? enabled[0] ?? null;\n });\n\n // WrTabsContext\n\n activate(key: string): void {\n this.active.set(key);\n }\n\n register(): void {\n // Deliberately a no-op. A `WrTab` calls this from its own constructor,\n // where its `key` signal input is not bound yet — so it would report the\n // generated default and this parent would write THAT into `active`. The\n // effect below seeds from `tabs()`, by which point the inputs are real.\n }\n\n unregister(): void {\n // No-op: contentChildren handles removal.\n }\n\n // Template handlers\n\n protected readonly stripRef = viewChild<ElementRef<HTMLElement>>('strip');\n\n /** Whether the strip is scrolled away from its start / end — drives the edge fades. */\n protected readonly canScrollStart = signal(false);\n protected readonly canScrollEnd = signal(false);\n\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('tabs');\n // Seed `active` with the first tab's key, once the content children exist.\n // Without this the model writes back a generated id like\n // `wr-tab-b1crta5aix0v`: the strip still highlighted the right tab, because\n // `activeTab()` falls back to `tabs[0]`, so the only visible symptom was a\n // two-way binding holding a key the consumer had never heard of.\n //\n // `previousKeys` is what the last run saw. The first runs can see a `[key]`\n // binding still on its generated default — measured with keys bound inside\n // an `@for` — so \"the bound key is not among the tabs\" cannot mean \"removed\"\n // on its own: it would throw away a key the consumer bound before its tab\n // had bound its own. The same memory is what lets a seed that landed on a\n // generated default correct itself once the real keys arrive.\n let previousKeys: ReadonlySet<string> = new Set();\n effect(() => {\n const tabs = this.tabs();\n const keys = tabs.map(t => t.key());\n const key = this.active();\n // Also re-seed when the active tab LEAVES the list. `activeTab()` falls\n // back on its own, so the strip showed the fallback while `[(active)]`\n // kept the gone key: a host persisting the selection saved a tab that no\n // longer existed, and a tab later added under that key took the\n // selection back without anyone asking. A key the list has never held is\n // left alone — that is a tab still on its way, not one that went.\n const removed = key !== null && previousKeys.has(key) && !keys.includes(key);\n previousKeys = new Set(keys);\n // The first ENABLED tab, not the first tab. Every other path already\n // skips a disabled one — `onStripKeydown` filters them out and\n // `onTabClick` returns early — so a strip whose first tab is behind a\n // flag seeded `active` to a key nothing can select: the roving stop is\n // `tab === activeTab() && !tab.disabled()`, which no button then\n // satisfied, and the whole strip left the tab order.\n if (tabs.length > 0 && (key === null || removed)) {\n this.active.set((tabs.find(t => !t.disabled()) ?? tabs[0]).key());\n }\n });\n\n const destroyRef = inject(DestroyRef);\n afterNextRender(() => {\n this.updateFades();\n const el = this.stripRef()?.nativeElement;\n if (!el || typeof ResizeObserver === 'undefined') return;\n // Re-evaluate when the strip's width changes (e.g. the container narrows\n // and the tabs start overflowing).\n const ro = new ResizeObserver(() => this.updateFades());\n ro.observe(el);\n destroyRef.onDestroy(() => ro.disconnect());\n });\n }\n\n /** Recompute which edges can scroll, from the strip's scroll metrics. @internal */\n protected updateFades(): void {\n const el = this.stripRef()?.nativeElement;\n if (!el) return;\n const max = el.scrollWidth - el.clientWidth;\n // Distance from the INLINE start, which is what the two fades mean.\n // `scrollLeft` is 0 at the inline start in BOTH directions and counts away\n // from it — up in LTR, DOWN into negatives under `dir=\"rtl\"` (the CSSOM\n // model every engine Angular 22 supports now implements; the legacy\n // \"reversed\"/\"normal\" RTL conventions are gone). Read raw, the RTL value\n // said \"never scrolled from the start, always more to come\" at every\n // position: the end fade was pinned on and the start fade never appeared.\n //\n // Clamped rather than `Math.abs`, because an elastic overscroll reports a\n // value of the WRONG sign at the start edge — a rubber-band past the start\n // is still the start, and `abs` would light the start fade there in LTR too.\n const scrolled = this.isRtl() ? Math.max(-el.scrollLeft, 0) : Math.max(el.scrollLeft, 0);\n this.canScrollStart.set(scrolled > 1);\n this.canScrollEnd.set(max > 1 && scrolled < max - 1);\n }\n\n protected onTabClick(tab: WrTab): void {\n if (tab.disabled()) return;\n if (!this.isRouter()) this.activate(tab.key());\n }\n\n /**\n * Click on a router tab's anchor. The anchor carries a real `href`, so a\n * modified or middle click is left alone and the browser opens it the way it\n * opens any link; only a plain left click is turned into a navigation.\n */\n protected onRouterTabClick(tab: WrTab, event: MouseEvent): void {\n tab.navigate(event);\n }\n\n /**\n * Space on a router tab. The anchor answers Enter on its own, as a link does,\n * but `role=\"tab\"` promises Space as well (WAI-ARIA APG), and on a bare link\n * Space scrolls the page instead. Routed through a real click so the one\n * navigation path above handles both keys.\n */\n protected onRouterTabSpace(event: Event): void {\n event.preventDefault();\n (event.currentTarget as HTMLElement).click();\n }\n\n /** Per-instance prefix, so keys only have to be unique within one group. */\n private readonly uid = ++tabsUid;\n\n /** Header id for `aria-labelledby` on the panel. @internal */\n headerId(key: string): string {\n return `wr-tabs-${this.uid}-tab-${idFragment(key)}-header`;\n }\n\n /** Panel id for `aria-controls` on the tab header. @internal */\n panelId(key: string): string {\n return `wr-tabs-${this.uid}-tab-${idFragment(key)}-panel`;\n }\n\n /** ArrowLeft/Right/Home/End keyboard navigation on the tab strip. */\n protected onStripKeydown(event: KeyboardEvent): void {\n const tabs = this.tabs().filter(t => !t.disabled());\n if (tabs.length === 0) return;\n\n // Step from where FOCUS is, not from what is active.\n //\n // In router mode nothing ever moves `active` — `onTabClick` and this\n // handler both gate `activate()` on `!isRouter()`, because the route is\n // what selects a tab there. Reading the neighbour off `activeTab()`\n // therefore recomputed the same `idx` on every press, and ArrowRight\n // walked from the first tab to the second and stayed there for the rest of\n // the session. In manual mode focus and activation move together, so the\n // two readings agree and nothing changes.\n const strip = this.stripRef()?.nativeElement;\n const focused = strip?.ownerDocument.activeElement;\n const focusedIdx =\n focused instanceof HTMLElement && strip?.contains(focused)\n ? tabs.findIndex(t => this.headerId(t.key()) === focused.id)\n : -1;\n const active = this.activeTab();\n const idx = focusedIdx >= 0 ? focusedIdx : active ? tabs.indexOf(active) : -1;\n // The two neighbours in DOM order, wrapping at the ends.\n const forward = idx < tabs.length - 1 ? idx + 1 : 0;\n const backward = idx > 0 ? idx - 1 : tabs.length - 1;\n const rtl = this.isRtl();\n let nextIdx: number;\n\n switch (event.key) {\n // Arrow keys follow VISUAL order (WAI-ARIA APG). The strip is mirrored\n // under `dir=\"rtl\"`, so ArrowRight moves toward the visual right, which is\n // the PREVIOUS tab there.\n case 'ArrowRight':\n nextIdx = rtl ? backward : forward;\n break;\n case 'ArrowLeft':\n nextIdx = rtl ? forward : backward;\n break;\n // Home / End name a position in the tab list — first and last — not a\n // physical edge, so they read the same in both directions.\n case 'Home':\n nextIdx = 0;\n break;\n case 'End':\n nextIdx = tabs.length - 1;\n break;\n default:\n return;\n }\n\n event.preventDefault();\n const next = tabs[nextIdx];\n if (!this.isRouter()) this.activate(next.key());\n // Move focus to the corresponding header element.\n const headerEl = this.stripRef()?.nativeElement.querySelector<HTMLElement>(\n `#${CSS.escape(this.headerId(next.key()))}`\n );\n headerEl?.focus();\n }\n}\n","<!-- eslint-disable-next-line @angular-eslint/template/interactive-supports-focus -->\n<div\n #strip\n class=\"wr-tabs__strip\"\n role=\"tablist\"\n aria-orientation=\"horizontal\"\n (keydown)=\"onStripKeydown($event)\"\n (scroll)=\"updateFades()\"\n>\n @for (tab of tabs(); track tab.key()) {\n @if (tab.routerLink() !== null) {\n <!--\n `aria-selected` and `--active` come off the SAME `tab.routerActive()`, so the\n announced state and the painted one can never disagree. Without it a\n `role=\"tablist\"` shipped with no tab selected in any of them: the route decides\n here, and the class it paints is invisible to assistive tech.\n\n A real `href` rather than a `[routerLink]`: the directive would drag\n `@angular/router` into every content-only strip as well (see `WR_TABS_ROUTING`).\n The href, the active match and the click all come from the adapter the\n `ngwr/tabs/router` directive publishes, which is `RouterLink` doing the work.\n -->\n <a\n class=\"wr-tabs__tab\"\n role=\"tab\"\n [attr.id]=\"headerId(tab.key())\"\n [attr.href]=\"tab.routerHref()\"\n [class.wr-tabs__tab--active]=\"tab.routerActive()\"\n [class.wr-tabs__tab--disabled]=\"tab.disabled()\"\n [attr.aria-disabled]=\"tab.disabled() ? true : null\"\n [attr.aria-selected]=\"tab.routerActive()\"\n [attr.tabindex]=\"tab === routerStop() ? 0 : -1\"\n (click)=\"onRouterTabClick(tab, $event)\"\n (keydown.space)=\"onRouterTabSpace($event)\"\n >\n {{ tab.title() }}\n </a>\n } @else {\n <button\n type=\"button\"\n class=\"wr-tabs__tab\"\n role=\"tab\"\n [attr.id]=\"headerId(tab.key())\"\n [attr.aria-controls]=\"panelId(tab.key())\"\n [attr.tabindex]=\"tab === activeTab() && !tab.disabled() ? 0 : -1\"\n [class.wr-tabs__tab--active]=\"tab === activeTab()\"\n [class.wr-tabs__tab--disabled]=\"tab.disabled()\"\n [attr.aria-selected]=\"tab === activeTab()\"\n [disabled]=\"tab.disabled()\"\n (click)=\"onTabClick(tab)\"\n >\n {{ tab.title() }}\n </button>\n }\n }\n</div>\n\n@if (!isRouter() && activeTab(); as tab) {\n <div\n class=\"wr-tabs__panel\"\n role=\"tabpanel\"\n tabindex=\"0\"\n [attr.id]=\"panelId(tab.key())\"\n [attr.aria-labelledby]=\"headerId(tab.key())\"\n >\n <ng-container [ngTemplateOutlet]=\"tab.contentTpl()\" />\n </div>\n}\n"],"mappings":";;;;;;;;;;;;AAiBA,MAAa,UAAU,IAAI,eAA8B,SAAS;;;;;;;ACDlE,MAAa,kBAAkB,IAAI,eAAqC,iBAAiB;;;;;;;AC8BzF,IAAa,QAAb,MAAa,MAAK;CAEP,QAAQ,MAAM,SAAkB,GAAA,YAAA,CAAA,EAAA,WAAA,QAAA,CAAA,+BA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AgB;GAAC,WAChB,CACT;IACE,SAAS;IAET,aAAa,iBAAgB,MAAO;GACrC,CACF;GAAA,UAAA;EAAA,CAAA;CASyC,CAAA;CAAA,sBAAA,CAAA;CAAA,gBAAA;EAAA,QAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,GAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,cAAA;EAAA,CAAA;EAAA,MAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,MAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,GAAA,iBAAA,KAAK,GAAA,EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;EAAA,UAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAkFkB,SAAO,EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;CAAA;AAAA,CAAA"}
|
|
@@ -35,7 +35,7 @@ var WrToastHarness = class WrToastHarness extends ComponentHarness {
|
|
|
35
35
|
async getLiveLevel() {
|
|
36
36
|
return (await this.host()).getAttribute("aria-live");
|
|
37
37
|
}
|
|
38
|
-
async
|
|
38
|
+
async isClosable() {
|
|
39
39
|
return await this.locatorForOptional(".wr-toast__action--close")() !== null;
|
|
40
40
|
}
|
|
41
41
|
async hasCopyAction() {
|
|
@@ -47,6 +47,13 @@ var WrToastHarness = class WrToastHarness extends ComponentHarness {
|
|
|
47
47
|
async copy() {
|
|
48
48
|
await (await this.locatorFor(".wr-toast__action--copy")()).click();
|
|
49
49
|
}
|
|
50
|
+
async getActionLabel() {
|
|
51
|
+
const action = await this.locatorForOptional(".wr-toast__action--run")();
|
|
52
|
+
return action ? action.text() : null;
|
|
53
|
+
}
|
|
54
|
+
async runAction() {
|
|
55
|
+
await (await this.locatorFor(".wr-toast__action--run")()).click();
|
|
56
|
+
}
|
|
50
57
|
async hasProgressBar() {
|
|
51
58
|
return await this.locatorForOptional(".wr-toast__progress")() !== null;
|
|
52
59
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ngwr-toast-testing.mjs","names":[],"sources":["../../../projects/lib/toast/testing/wr-toast-harness.ts"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { ComponentHarness, HarnessPredicate } from '@angular/cdk/testing';\n\nimport type { WrToastType } from 'ngwr/toast';\n\nimport type { WrToastHarnessFilters } from './types';\n\nconst TYPES: readonly WrToastType[] = ['info', 'success', 'warning', 'danger'];\n\n/**\n * Test harness for a toast shown with `WrToast.show()`.\n *\n * Toasts live in the overlay, so load this from\n * `TestbedHarnessEnvironment.documentRootLoader()`. What is worth asserting on a\n * toast is mostly what it ANNOUNCES: `getRole()` and `getLiveLevel()` are how a\n * screen-reader user learns something happened, and they escalate with the\n * intent — a `danger` toast interrupts, an `info` toast waits its turn.\n *\n * @example\n * ```ts\n * const rootLoader = TestbedHarnessEnvironment.documentRootLoader(fixture);\n * const toast = await rootLoader.getHarness(WrToastHarness.with({ type: 'danger' }));\n *\n * expect(await toast.getMessage()).toBe('Could not save');\n * expect(await toast.getRole()).toBe('alert');\n * await toast.dismiss();\n * ```\n *\n * @see https://ngwr.dev/guides/testing\n */\nexport class WrToastHarness extends ComponentHarness {\n static hostSelector = 'wr-toast';\n\n /** Build a predicate that narrows the query — several toasts are usually stacked. */\n static with(options: WrToastHarnessFilters = {}): HarnessPredicate<WrToastHarness> {\n return new HarnessPredicate(WrToastHarness, options)\n .addOption('message', options.message, (harness, message) =>\n HarnessPredicate.stringMatches(harness.getMessage(), message)\n )\n .addOption('title', options.title, (harness, title) => HarnessPredicate.stringMatches(harness.getTitle(), title))\n .addOption('type', options.type, async (harness, type) => (await harness.getType()) === type);\n }\n\n /**\n * The toast's message line, or `''` for a toast shown with a title alone —\n * that one renders no message element, and an empty string is what it was\n * given. Never a throw: `with({ message })` asks every toast on screen, so a\n * throw here would fail the filter for the toasts that do carry one.\n */\n async getMessage(): Promise<string> {\n const message = await this.locatorForOptional('.wr-toast__message')();\n return message ? message.text() : '';\n }\n\n /** The toast's title, or `null` when it was shown without one. */\n async getTitle(): Promise<string | null> {\n const title = await this.locatorForOptional('.wr-toast__title')();\n return title ? title.text() : null;\n }\n\n /** The intent, read from the `wr-toast--*` modifier. */\n async getType(): Promise<WrToastType | null> {\n const host = await this.host();\n for (const type of TYPES) {\n if (await host.hasClass(`wr-toast--${type}`)) return type;\n }\n return null;\n }\n\n /** `'alert'` for a danger toast, `'status'` otherwise — how urgently it interrupts. */\n async getRole(): Promise<string | null> {\n return (await this.host()).getAttribute('role');\n }\n\n /** `'assertive'` for danger and warning, `'polite'` otherwise. */\n async getLiveLevel(): Promise<string | null> {\n return (await this.host()).getAttribute('aria-live');\n }\n\n /** Whether the toast offers a dismiss button. */\n async
|
|
1
|
+
{"version":3,"file":"ngwr-toast-testing.mjs","names":[],"sources":["../../../projects/lib/toast/testing/wr-toast-harness.ts"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { ComponentHarness, HarnessPredicate } from '@angular/cdk/testing';\n\nimport type { WrToastType } from 'ngwr/toast';\n\nimport type { WrToastHarnessFilters } from './types';\n\nconst TYPES: readonly WrToastType[] = ['info', 'success', 'warning', 'danger'];\n\n/**\n * Test harness for a toast shown with `WrToast.show()`.\n *\n * Toasts live in the overlay, so load this from\n * `TestbedHarnessEnvironment.documentRootLoader()`. What is worth asserting on a\n * toast is mostly what it ANNOUNCES: `getRole()` and `getLiveLevel()` are how a\n * screen-reader user learns something happened, and they escalate with the\n * intent — a `danger` toast interrupts, an `info` toast waits its turn.\n *\n * @example\n * ```ts\n * const rootLoader = TestbedHarnessEnvironment.documentRootLoader(fixture);\n * const toast = await rootLoader.getHarness(WrToastHarness.with({ type: 'danger' }));\n *\n * expect(await toast.getMessage()).toBe('Could not save');\n * expect(await toast.getRole()).toBe('alert');\n * await toast.dismiss();\n * ```\n *\n * @see https://ngwr.dev/guides/testing\n */\nexport class WrToastHarness extends ComponentHarness {\n static hostSelector = 'wr-toast';\n\n /** Build a predicate that narrows the query — several toasts are usually stacked. */\n static with(options: WrToastHarnessFilters = {}): HarnessPredicate<WrToastHarness> {\n return new HarnessPredicate(WrToastHarness, options)\n .addOption('message', options.message, (harness, message) =>\n HarnessPredicate.stringMatches(harness.getMessage(), message)\n )\n .addOption('title', options.title, (harness, title) => HarnessPredicate.stringMatches(harness.getTitle(), title))\n .addOption('type', options.type, async (harness, type) => (await harness.getType()) === type);\n }\n\n /**\n * The toast's message line, or `''` for a toast shown with a title alone —\n * that one renders no message element, and an empty string is what it was\n * given. Never a throw: `with({ message })` asks every toast on screen, so a\n * throw here would fail the filter for the toasts that do carry one.\n */\n async getMessage(): Promise<string> {\n const message = await this.locatorForOptional('.wr-toast__message')();\n return message ? message.text() : '';\n }\n\n /** The toast's title, or `null` when it was shown without one. */\n async getTitle(): Promise<string | null> {\n const title = await this.locatorForOptional('.wr-toast__title')();\n return title ? title.text() : null;\n }\n\n /** The intent, read from the `wr-toast--*` modifier. */\n async getType(): Promise<WrToastType | null> {\n const host = await this.host();\n for (const type of TYPES) {\n if (await host.hasClass(`wr-toast--${type}`)) return type;\n }\n return null;\n }\n\n /** `'alert'` for a danger toast, `'status'` otherwise — how urgently it interrupts. */\n async getRole(): Promise<string | null> {\n return (await this.host()).getAttribute('role');\n }\n\n /** `'assertive'` for danger and warning, `'polite'` otherwise. */\n async getLiveLevel(): Promise<string | null> {\n return (await this.host()).getAttribute('aria-live');\n }\n\n /** Whether the toast offers a dismiss button. */\n async isClosable(): Promise<boolean> {\n return (await this.locatorForOptional('.wr-toast__action--close')()) !== null;\n }\n\n /** Whether the toast offers a copy button. */\n async hasCopyAction(): Promise<boolean> {\n return (await this.locatorForOptional('.wr-toast__action--copy')()) !== null;\n }\n\n /** Click the dismiss button. Throws on a toast shown `closable: false`. */\n async dismiss(): Promise<void> {\n await (await this.locatorFor('.wr-toast__action--close')()).click();\n }\n\n /** Click the copy button. Throws unless the toast was shown `showCopy: true`. */\n async copy(): Promise<void> {\n await (await this.locatorFor('.wr-toast__action--copy')()).click();\n }\n\n /** The action button's text, or `null` for a toast shown without an `action`. */\n async getActionLabel(): Promise<string | null> {\n const action = await this.locatorForOptional('.wr-toast__action--run')();\n return action ? action.text() : null;\n }\n\n /** Click the action button. Throws on a toast shown without an `action`. */\n async runAction(): Promise<void> {\n await (await this.locatorFor('.wr-toast__action--run')()).click();\n }\n\n /** Whether the auto-dismiss progress bar is showing. */\n async hasProgressBar(): Promise<boolean> {\n return (await this.locatorForOptional('.wr-toast__progress')()) !== null;\n }\n\n /** Hover the toast — which is what pauses its auto-dismiss timer. */\n async hover(): Promise<void> {\n return (await this.host()).hover();\n }\n\n /** Move the pointer away again, resuming the timer. */\n async mouseAway(): Promise<void> {\n return (await this.host()).mouseAway();\n }\n}\n"],"mappings":";;;;;;;AAaA,MAAM,QAAgC;CAAC;CAAQ;CAAW;CAAW;AAAQ;AAuB7E,IAAa,iBAAb,MAAa,uBAAuB,iBAAgB;CAClD,OAAO,eAAe;CAGtB,OAAO,KAAK,UAAiC,CAAA,GAAE;EAC7C,OAAO,IAAI,iBAAiB,gBAAgB,OAAO,CAAC,CACjD,UAAU,WAAW,QAAQ,UAAU,SAAS,YAC/C,iBAAiB,cAAc,QAAQ,WAAU,GAAI,OAAO,CAAC,CAC9D,CACA,UAAU,SAAS,QAAQ,QAAQ,SAAS,UAAU,iBAAiB,cAAc,QAAQ,SAAQ,GAAI,KAAK,CAAC,CAAC,CAChH,UAAU,QAAQ,QAAQ,MAAM,OAAO,SAAS,SAAU,MAAM,QAAQ,QAAO,MAAQ,IAAI;CAChG;CAQA,MAAM,aAAU;EAC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I,EAAA,CAAI,MAAK;CAClC;CAGA,MAAM,YAAS;EACb,QAAQ,MAAM,KAAK,KAAI,EAAA,CAAI,UAAS;CACtC"}
|
package/fesm2022/ngwr-toast.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as i0 from "@angular/core";
|
|
2
2
|
import { ApplicationRef, Component, DestroyRef, ENVIRONMENT_INITIALIZER, ElementRef, EnvironmentInjector, InjectionToken, Injector, Service, ViewEncapsulation, afterNextRender, computed, effect, inject, input, isDevMode, output, signal, viewChildren } from "@angular/core";
|
|
3
|
-
import {
|
|
3
|
+
import { wrCheckStyles, wrFeature, wrRestoreFocus, wrToClassList } from "ngwr/utils";
|
|
4
4
|
import { useI18nText } from "ngwr/i18n";
|
|
5
5
|
import { Directionality } from "@angular/cdk/bidi";
|
|
6
6
|
import { ComponentPortal } from "@angular/cdk/portal";
|
|
@@ -19,13 +19,15 @@ var WrToastItem = class WrToastItem {
|
|
|
19
19
|
type = input("info", ...ngDevMode ? [{ debugName: "type" }] : /* istanbul ignore next */ []);
|
|
20
20
|
title = input(null, ...ngDevMode ? [{ debugName: "title" }] : /* istanbul ignore next */ []);
|
|
21
21
|
message = input.required(...ngDevMode ? [{ debugName: "message" }] : /* istanbul ignore next */ []);
|
|
22
|
-
|
|
22
|
+
closable = input(true, ...ngDevMode ? [{ debugName: "closable" }] : /* istanbul ignore next */ []);
|
|
23
23
|
showProgress = input(false, ...ngDevMode ? [{ debugName: "showProgress" }] : /* istanbul ignore next */ []);
|
|
24
24
|
showCopy = input(false, ...ngDevMode ? [{ debugName: "showCopy" }] : /* istanbul ignore next */ []);
|
|
25
|
+
actionLabel = input(null, ...ngDevMode ? [{ debugName: "actionLabel" }] : /* istanbul ignore next */ []);
|
|
25
26
|
extraClass = input(null, ...ngDevMode ? [{ debugName: "extraClass" }] : /* istanbul ignore next */ []);
|
|
26
27
|
duration = input(0, ...ngDevMode ? [{ debugName: "duration" }] : /* istanbul ignore next */ []);
|
|
27
28
|
labels = input.required(...ngDevMode ? [{ debugName: "labels" }] : /* istanbul ignore next */ []);
|
|
28
29
|
dismissed = output();
|
|
30
|
+
actionRequested = output();
|
|
29
31
|
pauseRequested = output();
|
|
30
32
|
resumeRequested = output();
|
|
31
33
|
hovered = false;
|
|
@@ -51,7 +53,7 @@ var WrToastItem = class WrToastItem {
|
|
|
51
53
|
}
|
|
52
54
|
justCopied = signal(false, ...ngDevMode ? [{ debugName: "justCopied" }] : /* istanbul ignore next */ []);
|
|
53
55
|
copyResetTimer = null;
|
|
54
|
-
classes = computed(() =>
|
|
56
|
+
classes = computed(() => wrToClassList("wr-toast", `wr-toast--${this.type()}`, this.title() ? null : "wr-toast--untitled", this.extraClass()).join(" "), ...ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []);
|
|
55
57
|
liveRole = computed(() => this.type() === "danger" ? "alert" : "status", ...ngDevMode ? [{ debugName: "liveRole" }] : /* istanbul ignore next */ []);
|
|
56
58
|
liveLevel = computed(() => this.type() === "danger" || this.type() === "warning" ? "assertive" : "polite", ...ngDevMode ? [{ debugName: "liveLevel" }] : /* istanbul ignore next */ []);
|
|
57
59
|
durationMs = computed(() => `${this.duration()}ms`, ...ngDevMode ? [{ debugName: "durationMs" }] : /* istanbul ignore next */ []);
|
|
@@ -76,7 +78,7 @@ var WrToastItem = class WrToastItem {
|
|
|
76
78
|
return dist === 0 ? null : Math.max(0, 1 - dist / (this.swipeWidth || 1));
|
|
77
79
|
}, ...ngDevMode ? [{ debugName: "swipeOpacity" }] : /* istanbul ignore next */ []);
|
|
78
80
|
onSwipeStart(event) {
|
|
79
|
-
if (!this.
|
|
81
|
+
if (!this.closable()) return;
|
|
80
82
|
const touch = event.touches[0];
|
|
81
83
|
if (!touch) return;
|
|
82
84
|
this.swipeStartX = touch.clientX;
|
|
@@ -131,9 +133,9 @@ var WrToastItem = class WrToastItem {
|
|
|
131
133
|
isRequired: true,
|
|
132
134
|
transformFunction: null
|
|
133
135
|
},
|
|
134
|
-
|
|
135
|
-
classPropertyName: "
|
|
136
|
-
publicName: "
|
|
136
|
+
closable: {
|
|
137
|
+
classPropertyName: "closable",
|
|
138
|
+
publicName: "closable",
|
|
137
139
|
isSignal: true,
|
|
138
140
|
isRequired: false,
|
|
139
141
|
transformFunction: null
|
|
@@ -152,6 +154,13 @@ var WrToastItem = class WrToastItem {
|
|
|
152
154
|
isRequired: false,
|
|
153
155
|
transformFunction: null
|
|
154
156
|
},
|
|
157
|
+
actionLabel: {
|
|
158
|
+
classPropertyName: "actionLabel",
|
|
159
|
+
publicName: "actionLabel",
|
|
160
|
+
isSignal: true,
|
|
161
|
+
isRequired: false,
|
|
162
|
+
transformFunction: null
|
|
163
|
+
},
|
|
155
164
|
extraClass: {
|
|
156
165
|
classPropertyName: "extraClass",
|
|
157
166
|
publicName: "extraClass",
|
|
@@ -176,6 +185,7 @@ var WrToastItem = class WrToastItem {
|
|
|
176
185
|
},
|
|
177
186
|
outputs: {
|
|
178
187
|
dismissed: "dismissed",
|
|
188
|
+
actionRequested: "actionRequested",
|
|
179
189
|
pauseRequested: "pauseRequested",
|
|
180
190
|
resumeRequested: "resumeRequested"
|
|
181
191
|
},
|
|
@@ -202,7 +212,7 @@ var WrToastItem = class WrToastItem {
|
|
|
202
212
|
}
|
|
203
213
|
},
|
|
204
214
|
ngImport: i0,
|
|
205
|
-
template: "<!-- A glyph per type, and this is the one channel the toast had none of. Its\n four types differed by `--wr-toast-accent` alone — a 3px inline-start\n border, in four colours that sit within 1.06:1 of each other in relative\n luminance, so `success` and `danger` were the same 3px line to a reader\n who cannot separate hue. The shapes are the ones `wr-alert` and\n `wr-result` already use for the same four meanings: a check in a broken\n circle, a triangle, an octagon, an `i`. Three components agreeing is worth\n more than three components each being locally reasonable.\n\n `aria-hidden`, because the type is already announced: the host takes\n `role=\"alert\"` for danger and `role=\"status\"` otherwise. -->\n<svg\n class=\"wr-toast__icon 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 @switch (type()) {\n @case ('success') {\n <path d=\"M21.801 10A10 10 0 1 1 17 3.335\" />\n <path d=\"m9 11 3 3L22 4\" />\n }\n @case ('warning') {\n <path d=\"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3\" />\n <path d=\"M12 9v4\" />\n <path d=\"M12 17h.01\" />\n }\n @case ('danger') {\n <path\n d=\"M2.586 16.726A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2h6.624a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586z\"\n />\n <path d=\"M12 8v4\" />\n <path d=\"M12 16h.01\" />\n }\n @default {\n <circle cx=\"12\" cy=\"12\" r=\"10\" />\n <path d=\"M12 16v-4\" />\n <path d=\"M12 8h.01\" />\n }\n }\n</svg>\n\n<!-- Each part renders only when it has text. A title-only toast is shown with\n `message: ''`, and the empty `<p>` it used to leave behind kept the title's\n bottom margin under it: 4px of dead space that made the card taller below\n its one line than above it. -->\n<div class=\"wr-toast__body\">\n @if (title(); as text) {\n <p class=\"wr-toast__title\">{{ text }}</p>\n }\n @if (message(); as text) {\n <p class=\"wr-toast__message\">{{ text }}</p>\n }\n</div>\n\n<div class=\"wr-toast__actions\">\n @if (showCopy()) {\n <button\n type=\"button\"\n class=\"wr-toast__action wr-toast__action--copy\"\n [attr.aria-label]=\"justCopied() ? labels().copied : labels().copy\"\n [title]=\"justCopied() ? labels().copied : labels().copy\"\n (click)=\"onCopy()\"\n >\n @if (justCopied()) {\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 d=\"M20 6 9 17l-5-5\" />\n </svg>\n } @else {\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 <rect width=\"14\" height=\"14\" x=\"8\" y=\"8\" rx=\"2\" ry=\"2\" />\n <path d=\"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2\" />\n </svg>\n }\n </button>\n }\n\n @if (
|
|
215
|
+
template: "<!-- A glyph per type, and this is the one channel the toast had none of. Its\n four types differed by `--wr-toast-accent` alone — a 3px inline-start\n border, in four colours that sit within 1.06:1 of each other in relative\n luminance, so `success` and `danger` were the same 3px line to a reader\n who cannot separate hue. The shapes are the ones `wr-alert` and\n `wr-result` already use for the same four meanings: a check in a broken\n circle, a triangle, an octagon, an `i`. Three components agreeing is worth\n more than three components each being locally reasonable.\n\n `aria-hidden`, because the type is already announced: the host takes\n `role=\"alert\"` for danger and `role=\"status\"` otherwise. -->\n<svg\n class=\"wr-toast__icon 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 @switch (type()) {\n @case ('success') {\n <path d=\"M21.801 10A10 10 0 1 1 17 3.335\" />\n <path d=\"m9 11 3 3L22 4\" />\n }\n @case ('warning') {\n <path d=\"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3\" />\n <path d=\"M12 9v4\" />\n <path d=\"M12 17h.01\" />\n }\n @case ('danger') {\n <path\n d=\"M2.586 16.726A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2h6.624a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586z\"\n />\n <path d=\"M12 8v4\" />\n <path d=\"M12 16h.01\" />\n }\n @default {\n <circle cx=\"12\" cy=\"12\" r=\"10\" />\n <path d=\"M12 16v-4\" />\n <path d=\"M12 8h.01\" />\n }\n }\n</svg>\n\n<!-- Each part renders only when it has text. A title-only toast is shown with\n `message: ''`, and the empty `<p>` it used to leave behind kept the title's\n bottom margin under it: 4px of dead space that made the card taller below\n its one line than above it. -->\n<div class=\"wr-toast__body\">\n @if (title(); as text) {\n <p class=\"wr-toast__title\">{{ text }}</p>\n }\n @if (message(); as text) {\n <p class=\"wr-toast__message\">{{ text }}</p>\n }\n</div>\n\n<div class=\"wr-toast__actions\">\n @if (actionLabel(); as label) {\n <button type=\"button\" class=\"wr-toast__action wr-toast__action--run\" (click)=\"actionRequested.emit()\">\n {{ label }}\n </button>\n }\n\n @if (showCopy()) {\n <button\n type=\"button\"\n class=\"wr-toast__action wr-toast__action--copy\"\n [attr.aria-label]=\"justCopied() ? labels().copied : labels().copy\"\n [title]=\"justCopied() ? labels().copied : labels().copy\"\n (click)=\"onCopy()\"\n >\n @if (justCopied()) {\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 d=\"M20 6 9 17l-5-5\" />\n </svg>\n } @else {\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 <rect width=\"14\" height=\"14\" x=\"8\" y=\"8\" rx=\"2\" ry=\"2\" />\n <path d=\"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2\" />\n </svg>\n }\n </button>\n }\n\n @if (closable()) {\n <button\n type=\"button\"\n class=\"wr-toast__action wr-toast__action--close\"\n [attr.aria-label]=\"labels().close\"\n [title]=\"labels().close\"\n (click)=\"dismissed.emit()\"\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 d=\"M18 6 6 18\" />\n <path d=\"m6 6 12 12\" />\n </svg>\n </button>\n }\n</div>\n\n@if (progressVisible()) {\n <span class=\"wr-toast__progress\" aria-hidden=\"true\"></span>\n}\n",
|
|
206
216
|
encapsulation: i0.ViewEncapsulation.None
|
|
207
217
|
});
|
|
208
218
|
};
|
|
@@ -234,7 +244,7 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
234
244
|
"(touchend)": "onSwipeEnd()",
|
|
235
245
|
"(touchcancel)": "onSwipeEnd()"
|
|
236
246
|
},
|
|
237
|
-
template: "<!-- A glyph per type, and this is the one channel the toast had none of. Its\n four types differed by `--wr-toast-accent` alone — a 3px inline-start\n border, in four colours that sit within 1.06:1 of each other in relative\n luminance, so `success` and `danger` were the same 3px line to a reader\n who cannot separate hue. The shapes are the ones `wr-alert` and\n `wr-result` already use for the same four meanings: a check in a broken\n circle, a triangle, an octagon, an `i`. Three components agreeing is worth\n more than three components each being locally reasonable.\n\n `aria-hidden`, because the type is already announced: the host takes\n `role=\"alert\"` for danger and `role=\"status\"` otherwise. -->\n<svg\n class=\"wr-toast__icon 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 @switch (type()) {\n @case ('success') {\n <path d=\"M21.801 10A10 10 0 1 1 17 3.335\" />\n <path d=\"m9 11 3 3L22 4\" />\n }\n @case ('warning') {\n <path d=\"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3\" />\n <path d=\"M12 9v4\" />\n <path d=\"M12 17h.01\" />\n }\n @case ('danger') {\n <path\n d=\"M2.586 16.726A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2h6.624a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586z\"\n />\n <path d=\"M12 8v4\" />\n <path d=\"M12 16h.01\" />\n }\n @default {\n <circle cx=\"12\" cy=\"12\" r=\"10\" />\n <path d=\"M12 16v-4\" />\n <path d=\"M12 8h.01\" />\n }\n }\n</svg>\n\n<!-- Each part renders only when it has text. A title-only toast is shown with\n `message: ''`, and the empty `<p>` it used to leave behind kept the title's\n bottom margin under it: 4px of dead space that made the card taller below\n its one line than above it. -->\n<div class=\"wr-toast__body\">\n @if (title(); as text) {\n <p class=\"wr-toast__title\">{{ text }}</p>\n }\n @if (message(); as text) {\n <p class=\"wr-toast__message\">{{ text }}</p>\n }\n</div>\n\n<div class=\"wr-toast__actions\">\n @if (showCopy()) {\n <button\n type=\"button\"\n class=\"wr-toast__action wr-toast__action--copy\"\n [attr.aria-label]=\"justCopied() ? labels().copied : labels().copy\"\n [title]=\"justCopied() ? labels().copied : labels().copy\"\n (click)=\"onCopy()\"\n >\n @if (justCopied()) {\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 d=\"M20 6 9 17l-5-5\" />\n </svg>\n } @else {\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 <rect width=\"14\" height=\"14\" x=\"8\" y=\"8\" rx=\"2\" ry=\"2\" />\n <path d=\"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2\" />\n </svg>\n }\n </button>\n }\n\n @if (
|
|
247
|
+
template: "<!-- A glyph per type, and this is the one channel the toast had none of. Its\n four types differed by `--wr-toast-accent` alone — a 3px inline-start\n border, in four colours that sit within 1.06:1 of each other in relative\n luminance, so `success` and `danger` were the same 3px line to a reader\n who cannot separate hue. The shapes are the ones `wr-alert` and\n `wr-result` already use for the same four meanings: a check in a broken\n circle, a triangle, an octagon, an `i`. Three components agreeing is worth\n more than three components each being locally reasonable.\n\n `aria-hidden`, because the type is already announced: the host takes\n `role=\"alert\"` for danger and `role=\"status\"` otherwise. -->\n<svg\n class=\"wr-toast__icon 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 @switch (type()) {\n @case ('success') {\n <path d=\"M21.801 10A10 10 0 1 1 17 3.335\" />\n <path d=\"m9 11 3 3L22 4\" />\n }\n @case ('warning') {\n <path d=\"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3\" />\n <path d=\"M12 9v4\" />\n <path d=\"M12 17h.01\" />\n }\n @case ('danger') {\n <path\n d=\"M2.586 16.726A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2h6.624a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586z\"\n />\n <path d=\"M12 8v4\" />\n <path d=\"M12 16h.01\" />\n }\n @default {\n <circle cx=\"12\" cy=\"12\" r=\"10\" />\n <path d=\"M12 16v-4\" />\n <path d=\"M12 8h.01\" />\n }\n }\n</svg>\n\n<!-- Each part renders only when it has text. A title-only toast is shown with\n `message: ''`, and the empty `<p>` it used to leave behind kept the title's\n bottom margin under it: 4px of dead space that made the card taller below\n its one line than above it. -->\n<div class=\"wr-toast__body\">\n @if (title(); as text) {\n <p class=\"wr-toast__title\">{{ text }}</p>\n }\n @if (message(); as text) {\n <p class=\"wr-toast__message\">{{ text }}</p>\n }\n</div>\n\n<div class=\"wr-toast__actions\">\n @if (actionLabel(); as label) {\n <button type=\"button\" class=\"wr-toast__action wr-toast__action--run\" (click)=\"actionRequested.emit()\">\n {{ label }}\n </button>\n }\n\n @if (showCopy()) {\n <button\n type=\"button\"\n class=\"wr-toast__action wr-toast__action--copy\"\n [attr.aria-label]=\"justCopied() ? labels().copied : labels().copy\"\n [title]=\"justCopied() ? labels().copied : labels().copy\"\n (click)=\"onCopy()\"\n >\n @if (justCopied()) {\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 d=\"M20 6 9 17l-5-5\" />\n </svg>\n } @else {\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 <rect width=\"14\" height=\"14\" x=\"8\" y=\"8\" rx=\"2\" ry=\"2\" />\n <path d=\"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2\" />\n </svg>\n }\n </button>\n }\n\n @if (closable()) {\n <button\n type=\"button\"\n class=\"wr-toast__action wr-toast__action--close\"\n [attr.aria-label]=\"labels().close\"\n [title]=\"labels().close\"\n (click)=\"dismissed.emit()\"\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 d=\"M18 6 6 18\" />\n <path d=\"m6 6 12 12\" />\n </svg>\n </button>\n }\n</div>\n\n@if (progressVisible()) {\n <span class=\"wr-toast__progress\" aria-hidden=\"true\"></span>\n}\n"
|
|
238
248
|
}]
|
|
239
249
|
}],
|
|
240
250
|
ctorParameters: () => [],
|
|
@@ -263,11 +273,11 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
263
273
|
required: true
|
|
264
274
|
}]
|
|
265
275
|
}],
|
|
266
|
-
|
|
276
|
+
closable: [{
|
|
267
277
|
type: i0.Input,
|
|
268
278
|
args: [{
|
|
269
279
|
isSignal: true,
|
|
270
|
-
alias: "
|
|
280
|
+
alias: "closable",
|
|
271
281
|
required: false
|
|
272
282
|
}]
|
|
273
283
|
}],
|
|
@@ -287,6 +297,14 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
287
297
|
required: false
|
|
288
298
|
}]
|
|
289
299
|
}],
|
|
300
|
+
actionLabel: [{
|
|
301
|
+
type: i0.Input,
|
|
302
|
+
args: [{
|
|
303
|
+
isSignal: true,
|
|
304
|
+
alias: "actionLabel",
|
|
305
|
+
required: false
|
|
306
|
+
}]
|
|
307
|
+
}],
|
|
290
308
|
extraClass: [{
|
|
291
309
|
type: i0.Input,
|
|
292
310
|
args: [{
|
|
@@ -315,6 +333,10 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
315
333
|
type: i0.Output,
|
|
316
334
|
args: ["dismissed"]
|
|
317
335
|
}],
|
|
336
|
+
actionRequested: [{
|
|
337
|
+
type: i0.Output,
|
|
338
|
+
args: ["actionRequested"]
|
|
339
|
+
}],
|
|
318
340
|
pauseRequested: [{
|
|
319
341
|
type: i0.Output,
|
|
320
342
|
args: ["pauseRequested"]
|
|
@@ -410,11 +432,17 @@ var WrToastHost = class WrToastHost {
|
|
|
410
432
|
this.syncExpanded();
|
|
411
433
|
}
|
|
412
434
|
onItemDismissed(id, index) {
|
|
435
|
+
this.removeItem(index, () => this.dismissed.emit(id));
|
|
436
|
+
}
|
|
437
|
+
onItemAction(id, index) {
|
|
438
|
+
this.removeItem(index, () => this.actionRequested.emit(id));
|
|
439
|
+
}
|
|
440
|
+
removeItem(index, remove) {
|
|
413
441
|
const item = this.items()[index]?.nativeElement;
|
|
414
442
|
const active = item?.ownerDocument.activeElement;
|
|
415
443
|
const hadFocus = !!item?.contains(active ?? null) && hasKeyboardFocus(active);
|
|
416
444
|
const origin = this.focusOrigin;
|
|
417
|
-
|
|
445
|
+
remove();
|
|
418
446
|
if (!hadFocus) return;
|
|
419
447
|
if (this.toasts().length === 0) {
|
|
420
448
|
returnFocus(origin, this.focusMonitor);
|
|
@@ -479,6 +507,7 @@ var WrToastHost = class WrToastHost {
|
|
|
479
507
|
queued = signal(0, ...ngDevMode ? [{ debugName: "queued" }] : /* istanbul ignore next */ []);
|
|
480
508
|
totalCount = computed(() => this.toasts().length + this.queued(), ...ngDevMode ? [{ debugName: "totalCount" }] : /* istanbul ignore next */ []);
|
|
481
509
|
dismissed = output();
|
|
510
|
+
actionRequested = output();
|
|
482
511
|
pauseRequested = output();
|
|
483
512
|
resumeRequested = output();
|
|
484
513
|
holdChange = output();
|
|
@@ -545,6 +574,7 @@ var WrToastHost = class WrToastHost {
|
|
|
545
574
|
},
|
|
546
575
|
outputs: {
|
|
547
576
|
dismissed: "dismissed",
|
|
577
|
+
actionRequested: "actionRequested",
|
|
548
578
|
pauseRequested: "pauseRequested",
|
|
549
579
|
resumeRequested: "resumeRequested",
|
|
550
580
|
holdChange: "holdChange",
|
|
@@ -572,7 +602,7 @@ var WrToastHost = class WrToastHost {
|
|
|
572
602
|
isSignal: true
|
|
573
603
|
}],
|
|
574
604
|
ngImport: i0,
|
|
575
|
-
template: "@if (closeAllVisible()) {\n <button type=\"button\" class=\"wr-toast-host__close-all\" (click)=\"onCloseAll()\">\n {{ closeAllLabel() }} ({{ totalCount() }})\n </button>\n}\n\n@for (toast of toasts(); track toast.id) {\n <wr-toast\n [style.--wr-toast-stack-index]=\"stackIndex($index)\"\n [type]=\"toast.type ?? 'info'\"\n [title]=\"toast.title ?? null\"\n [message]=\"toast.message\"\n [
|
|
605
|
+
template: "@if (closeAllVisible()) {\n <button type=\"button\" class=\"wr-toast-host__close-all\" (click)=\"onCloseAll()\">\n {{ closeAllLabel() }} ({{ totalCount() }})\n </button>\n}\n\n@for (toast of toasts(); track toast.id) {\n <wr-toast\n [style.--wr-toast-stack-index]=\"stackIndex($index)\"\n [type]=\"toast.type ?? 'info'\"\n [title]=\"toast.title ?? null\"\n [message]=\"toast.message\"\n [closable]=\"toast.closable ?? true\"\n [showProgress]=\"showProgressFor(toast)\"\n [showCopy]=\"showCopyFor(toast)\"\n [extraClass]=\"toast.class ?? null\"\n [duration]=\"toast.resolvedDuration\"\n [labels]=\"labels()\"\n [actionLabel]=\"toast.action?.label ?? null\"\n (dismissed)=\"onItemDismissed(toast.id, $index)\"\n (actionRequested)=\"onItemAction(toast.id, $index)\"\n (pauseRequested)=\"pauseRequested.emit(toast.id)\"\n (resumeRequested)=\"resumeRequested.emit(toast.id)\"\n />\n}\n",
|
|
576
606
|
dependencies: [{
|
|
577
607
|
kind: "component",
|
|
578
608
|
type: WrToastItem,
|
|
@@ -581,15 +611,17 @@ var WrToastHost = class WrToastHost {
|
|
|
581
611
|
"type",
|
|
582
612
|
"title",
|
|
583
613
|
"message",
|
|
584
|
-
"
|
|
614
|
+
"closable",
|
|
585
615
|
"showProgress",
|
|
586
616
|
"showCopy",
|
|
617
|
+
"actionLabel",
|
|
587
618
|
"extraClass",
|
|
588
619
|
"duration",
|
|
589
620
|
"labels"
|
|
590
621
|
],
|
|
591
622
|
outputs: [
|
|
592
623
|
"dismissed",
|
|
624
|
+
"actionRequested",
|
|
593
625
|
"pauseRequested",
|
|
594
626
|
"resumeRequested"
|
|
595
627
|
]
|
|
@@ -618,7 +650,7 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
618
650
|
"(focusout)": "onFocusOut($event)"
|
|
619
651
|
},
|
|
620
652
|
imports: [WrToastItem],
|
|
621
|
-
template: "@if (closeAllVisible()) {\n <button type=\"button\" class=\"wr-toast-host__close-all\" (click)=\"onCloseAll()\">\n {{ closeAllLabel() }} ({{ totalCount() }})\n </button>\n}\n\n@for (toast of toasts(); track toast.id) {\n <wr-toast\n [style.--wr-toast-stack-index]=\"stackIndex($index)\"\n [type]=\"toast.type ?? 'info'\"\n [title]=\"toast.title ?? null\"\n [message]=\"toast.message\"\n [
|
|
653
|
+
template: "@if (closeAllVisible()) {\n <button type=\"button\" class=\"wr-toast-host__close-all\" (click)=\"onCloseAll()\">\n {{ closeAllLabel() }} ({{ totalCount() }})\n </button>\n}\n\n@for (toast of toasts(); track toast.id) {\n <wr-toast\n [style.--wr-toast-stack-index]=\"stackIndex($index)\"\n [type]=\"toast.type ?? 'info'\"\n [title]=\"toast.title ?? null\"\n [message]=\"toast.message\"\n [closable]=\"toast.closable ?? true\"\n [showProgress]=\"showProgressFor(toast)\"\n [showCopy]=\"showCopyFor(toast)\"\n [extraClass]=\"toast.class ?? null\"\n [duration]=\"toast.resolvedDuration\"\n [labels]=\"labels()\"\n [actionLabel]=\"toast.action?.label ?? null\"\n (dismissed)=\"onItemDismissed(toast.id, $index)\"\n (actionRequested)=\"onItemAction(toast.id, $index)\"\n (pauseRequested)=\"pauseRequested.emit(toast.id)\"\n (resumeRequested)=\"resumeRequested.emit(toast.id)\"\n />\n}\n"
|
|
622
654
|
}]
|
|
623
655
|
}],
|
|
624
656
|
ctorParameters: () => [],
|
|
@@ -658,6 +690,10 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
658
690
|
type: i0.Output,
|
|
659
691
|
args: ["dismissed"]
|
|
660
692
|
}],
|
|
693
|
+
actionRequested: [{
|
|
694
|
+
type: i0.Output,
|
|
695
|
+
args: ["actionRequested"]
|
|
696
|
+
}],
|
|
661
697
|
pauseRequested: [{
|
|
662
698
|
type: i0.Output,
|
|
663
699
|
args: ["pauseRequested"]
|
|
@@ -701,7 +737,7 @@ var WrToastRef = class {
|
|
|
701
737
|
* Use of this source code is governed by an MIT-style license that can be
|
|
702
738
|
* found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE
|
|
703
739
|
*/
|
|
704
|
-
const
|
|
740
|
+
const DEFAULT_WR_TOAST_CONFIG = {
|
|
705
741
|
position: "top-end",
|
|
706
742
|
mode: "stack",
|
|
707
743
|
duration: 4e3,
|
|
@@ -725,7 +761,7 @@ const DEFAULT_TOAST_CONFIG = {
|
|
|
725
761
|
*/
|
|
726
762
|
const WR_TOAST_CONFIG = new InjectionToken("WR_TOAST_CONFIG", {
|
|
727
763
|
providedIn: "root",
|
|
728
|
-
factory: () =>
|
|
764
|
+
factory: () => DEFAULT_WR_TOAST_CONFIG
|
|
729
765
|
});
|
|
730
766
|
/**
|
|
731
767
|
* @license
|
|
@@ -779,6 +815,12 @@ var WrToast = class WrToast {
|
|
|
779
815
|
this.pushToHost();
|
|
780
816
|
if (this.active.length === 0 && this.queue.length === 0) this.disposeHost();
|
|
781
817
|
}
|
|
818
|
+
runAction(id) {
|
|
819
|
+
const action = this.active.find((t) => t.id === id)?.action;
|
|
820
|
+
if (!action) return;
|
|
821
|
+
this.dismiss(id);
|
|
822
|
+
action.run();
|
|
823
|
+
}
|
|
782
824
|
dismissAll() {
|
|
783
825
|
for (const entry of this.active) if (entry.timer) clearTimeout(entry.timer);
|
|
784
826
|
this.active = [];
|
|
@@ -829,6 +871,7 @@ var WrToast = class WrToast {
|
|
|
829
871
|
this.hostRef.setInput("config", this.config);
|
|
830
872
|
const inst = this.hostRef.instance;
|
|
831
873
|
inst.dismissed.subscribe((id) => this.dismiss(id));
|
|
874
|
+
inst.actionRequested.subscribe((id) => this.runAction(id));
|
|
832
875
|
inst.dismissAllRequested.subscribe(() => this.dismissAll());
|
|
833
876
|
inst.pauseRequested.subscribe((id) => {
|
|
834
877
|
const entry = this.active.find((t) => t.id === id);
|
|
@@ -909,10 +952,10 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
909
952
|
*/
|
|
910
953
|
function withToast(config) {
|
|
911
954
|
const merged = {
|
|
912
|
-
...
|
|
955
|
+
...DEFAULT_WR_TOAST_CONFIG,
|
|
913
956
|
...config,
|
|
914
957
|
labels: {
|
|
915
|
-
...
|
|
958
|
+
...DEFAULT_WR_TOAST_CONFIG.labels,
|
|
916
959
|
...config.labels
|
|
917
960
|
}
|
|
918
961
|
};
|
|
@@ -927,6 +970,6 @@ function withToast(config) {
|
|
|
927
970
|
}
|
|
928
971
|
}] : []]);
|
|
929
972
|
}
|
|
930
|
-
export {
|
|
973
|
+
export { DEFAULT_WR_TOAST_CONFIG, WR_TOAST_CONFIG, WrToast, WrToastRef, withToast };
|
|
931
974
|
|
|
932
975
|
//# sourceMappingURL=ngwr-toast.mjs.map
|