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
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
// `<wr-aurora />`: a curtain of light hanging from one edge of a section,
|
|
5
5
|
// like an aurora, behind the section's content. The component paints one
|
|
6
6
|
// WebGL canvas and reads its three stops and the surface back from the hooks
|
|
7
|
-
// below through `
|
|
7
|
+
// below through `wrResolveCssColorChannels`, so a retheme and a scheme switch
|
|
8
8
|
// both reach the pixels. How bright it is, how far it reaches and how it
|
|
9
9
|
// moves are inputs and the shader's numbers, not the sheet's.
|
|
10
10
|
.wr-aurora {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
// `<wr-dot-grid />`: an even field of small, faint dots behind a section's
|
|
5
5
|
// content. The component paints one canvas and reads its two colours back
|
|
6
|
-
// from the hooks below through `
|
|
6
|
+
// from the hooks below through `wrResolveCssColorChannels`, so a retheme and a
|
|
7
7
|
// scheme switch both reach the pixels. The strengths (how much of each colour
|
|
8
8
|
// a dot shows at rest and lit) and the dot sizes live in `dot-grid.ts`: they
|
|
9
9
|
// are the canvas's numbers, not the sheet's.
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
// `<wr-flow-lines />`: a dense field of thin parallel lines behind a section's
|
|
5
5
|
// content, bent in slow waves and pushed aside round the pointer. The component
|
|
6
6
|
// paints one WebGL canvas and reads its two colours and the surface back from
|
|
7
|
-
// the hooks below through `
|
|
7
|
+
// the hooks below through `wrResolveCssColorChannels`, so a retheme and a scheme
|
|
8
8
|
// switch both reach the pixels. How much of a colour a line lays and its
|
|
9
9
|
// thickness live in the component and its shader: they are the canvas's
|
|
10
10
|
// numbers, not the sheet's.
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
// `<wr-fluid-cursor />`: coloured ink behind a region's content, stirred by
|
|
5
5
|
// the pointer and gone a few seconds later. The component paints one WebGL
|
|
6
6
|
// canvas and reads its palette back from the hooks below through
|
|
7
|
-
// `
|
|
7
|
+
// `wrResolveCssColorChannels`, so a retheme and a scheme switch both reach the
|
|
8
8
|
// pixels. How the ink covers the surface (as ink on a light one, lifted on a
|
|
9
9
|
// dark one) and the splat sizes live in the component and its model: they
|
|
10
10
|
// are the canvas's numbers, not the sheet's.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Sass shared by the animation sheets. Not a public entry: there is no
|
|
2
|
-
// `styles/_index.scss` here, so `@use 'ngwr/animations/
|
|
2
|
+
// `styles/_index.scss` here, so `@use 'ngwr/animations/internal'` resolves to
|
|
3
3
|
// nothing and the manifest carries no `sass` condition for it. An effect's own
|
|
4
4
|
// `_index.scss` loads this file by its relative path.
|
|
5
5
|
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
// `<wr-ripple-grid />`: a faint square grid of thin lines behind a page's
|
|
5
5
|
// content, that ripples out from a click. The component paints one canvas and
|
|
6
6
|
// reads its two colours back from the hooks below through
|
|
7
|
-
// `
|
|
7
|
+
// `wrResolveCssColorChannels`, so a retheme and a scheme switch both reach the
|
|
8
8
|
// pixels. The strengths (how much of each colour a line shows at rest and lit)
|
|
9
9
|
// and the line width live in `ripple-grid.ts`: they are the canvas's numbers,
|
|
10
10
|
// not the sheet's.
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
// a cord at one end and frayed apart at the other, riding slow waves and
|
|
6
6
|
// parting round the pointer. The component paints one WebGL canvas and reads
|
|
7
7
|
// its two colours and the surface back from the hooks below through
|
|
8
|
-
// `
|
|
8
|
+
// `wrResolveCssColorChannels`, so a retheme and a scheme switch both reach the
|
|
9
9
|
// pixels. How much of a colour a strand lays, its glow and its thickness live
|
|
10
10
|
// in the component and its shader: they are the canvas's numbers, not the
|
|
11
11
|
// sheet's.
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
@use '../../theme/styles' as theme;
|
|
2
|
+
|
|
3
|
+
@include theme.loaded('copy-value');
|
|
4
|
+
|
|
5
|
+
.wr-copy-value {
|
|
6
|
+
--wr-copy-value-gap: var(--wr-space-xs);
|
|
7
|
+
--wr-copy-value-empty-color: var(--wr-color-on-surface-muted);
|
|
8
|
+
--wr-copy-value-button-color: var(--wr-color-on-surface-muted);
|
|
9
|
+
--wr-copy-value-button-hover-color: var(--wr-color-on-surface);
|
|
10
|
+
--wr-copy-value-button-hover-bg: var(--wr-color-hover);
|
|
11
|
+
// A graphic, so the bare intent: `-ink` is for text.
|
|
12
|
+
--wr-copy-value-button-copied-color: var(--wr-color-success);
|
|
13
|
+
--wr-copy-value-button-padding: var(--wr-space-xs);
|
|
14
|
+
--wr-copy-value-button-radius: var(--wr-border-radius-sm);
|
|
15
|
+
|
|
16
|
+
// Relative, so the visually hidden status stays inside the host's box.
|
|
17
|
+
position: relative;
|
|
18
|
+
display: inline-flex;
|
|
19
|
+
align-items: center;
|
|
20
|
+
gap: var(--wr-copy-value-gap);
|
|
21
|
+
// Both, so the text can shrink below its content inside a flex or grid cell
|
|
22
|
+
// and never runs past the cell it sits in.
|
|
23
|
+
min-width: 0;
|
|
24
|
+
max-width: 100%;
|
|
25
|
+
vertical-align: bottom;
|
|
26
|
+
|
|
27
|
+
&__text {
|
|
28
|
+
flex: 0 1 auto;
|
|
29
|
+
min-width: 0;
|
|
30
|
+
overflow: hidden;
|
|
31
|
+
text-overflow: ellipsis;
|
|
32
|
+
white-space: nowrap;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
&__empty {
|
|
36
|
+
color: var(--wr-copy-value-empty-color);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
&__button {
|
|
40
|
+
flex: 0 0 auto;
|
|
41
|
+
display: inline-flex;
|
|
42
|
+
align-items: center;
|
|
43
|
+
justify-content: center;
|
|
44
|
+
appearance: none;
|
|
45
|
+
margin: 0;
|
|
46
|
+
padding: var(--wr-copy-value-button-padding);
|
|
47
|
+
border: 0;
|
|
48
|
+
border-radius: var(--wr-copy-value-button-radius);
|
|
49
|
+
background: transparent;
|
|
50
|
+
color: var(--wr-copy-value-button-color);
|
|
51
|
+
cursor: pointer;
|
|
52
|
+
// The glyph is `1em`, and a `<button>` takes the browser's control font
|
|
53
|
+
// unless the app resets it. The size only, never the `font` shorthand.
|
|
54
|
+
font-size: inherit;
|
|
55
|
+
transition:
|
|
56
|
+
color var(--wr-transition-base),
|
|
57
|
+
background-color var(--wr-transition-base);
|
|
58
|
+
|
|
59
|
+
@include theme.touch-target; // glyph -> 44px tap area on touch
|
|
60
|
+
|
|
61
|
+
&:hover {
|
|
62
|
+
color: var(--wr-copy-value-button-hover-color);
|
|
63
|
+
background: var(--wr-copy-value-button-hover-bg);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
&:focus-visible {
|
|
67
|
+
@include theme.focus-ring;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
&__icon {
|
|
72
|
+
display: block;
|
|
73
|
+
width: 1em;
|
|
74
|
+
height: 1em;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
&__status {
|
|
78
|
+
position: absolute;
|
|
79
|
+
width: 1px;
|
|
80
|
+
height: 1px;
|
|
81
|
+
margin: -1px;
|
|
82
|
+
padding: 0;
|
|
83
|
+
overflow: hidden;
|
|
84
|
+
clip: rect(0, 0, 0, 0);
|
|
85
|
+
border: 0;
|
|
86
|
+
white-space: nowrap;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
&--copied &__button,
|
|
90
|
+
&--copied &__button:hover {
|
|
91
|
+
color: var(--wr-copy-value-button-copied-color);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
&--wrap {
|
|
95
|
+
// The button stays on the first line of a value that runs over several.
|
|
96
|
+
align-items: flex-start;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
&--wrap &__text {
|
|
100
|
+
overflow: visible;
|
|
101
|
+
white-space: normal;
|
|
102
|
+
overflow-wrap: anywhere;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
@@ -34,8 +34,18 @@
|
|
|
34
34
|
.wr-date-picker {
|
|
35
35
|
display: inline-block;
|
|
36
36
|
|
|
37
|
+
// A form field stretches the host, and the group is the box the user sees.
|
|
38
|
+
// Alone, the host shrink-wraps, so 100% is the group's content width again.
|
|
39
|
+
> .wr-input-group {
|
|
40
|
+
width: 100%;
|
|
41
|
+
}
|
|
42
|
+
|
|
37
43
|
// Inner button — same affix sizing rules as wr-input-group's toggle.
|
|
38
44
|
&__trigger {
|
|
45
|
+
// Box of the calendar / clock glyph. It follows the control's font size, the
|
|
46
|
+
// way the select chevron and the input-number steppers do.
|
|
47
|
+
--wr-date-picker-trigger-icon-size: var(--wr-control-font-size-md);
|
|
48
|
+
|
|
39
49
|
appearance: none;
|
|
40
50
|
background: transparent;
|
|
41
51
|
border: 0;
|
|
@@ -55,12 +65,102 @@
|
|
|
55
65
|
cursor: not-allowed;
|
|
56
66
|
opacity: var(--wr-disabled-opacity);
|
|
57
67
|
}
|
|
68
|
+
|
|
69
|
+
// CSS size, so it beats the markup's `width` / `height` attributes.
|
|
70
|
+
svg {
|
|
71
|
+
width: var(--wr-date-picker-trigger-icon-size);
|
|
72
|
+
height: var(--wr-date-picker-trigger-icon-size);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// The clear (×) both pickers draw between the last field and the trigger — the
|
|
78
|
+
// select's, in a group instead of a button.
|
|
79
|
+
.wr-date-picker__clear {
|
|
80
|
+
--wr-date-picker-clear-radius: var(--wr-border-radius-pill);
|
|
81
|
+
// The glyph is a bare `.wr-icon__svg`, which is `1em`.
|
|
82
|
+
--wr-date-picker-clear-icon-size: var(--wr-control-font-size-md);
|
|
83
|
+
|
|
84
|
+
flex: 0 0 auto;
|
|
85
|
+
align-self: center;
|
|
86
|
+
display: inline-flex;
|
|
87
|
+
align-items: center;
|
|
88
|
+
justify-content: center;
|
|
89
|
+
width: 1.125rem;
|
|
90
|
+
height: 1.125rem;
|
|
91
|
+
border-radius: var(--wr-date-picker-clear-radius);
|
|
92
|
+
color: var(--wr-color-on-surface-muted);
|
|
93
|
+
font-size: var(--wr-date-picker-clear-icon-size);
|
|
94
|
+
cursor: pointer;
|
|
95
|
+
transition:
|
|
96
|
+
background 0.12s ease,
|
|
97
|
+
color 0.12s ease;
|
|
98
|
+
|
|
99
|
+
&:hover {
|
|
100
|
+
background: color-mix(in srgb, var(--wr-color-on-surface) 6%, transparent);
|
|
101
|
+
color: var(--wr-color-on-surface);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// Touch pointers get a wider × that fills the field's height instead of growing it.
|
|
106
|
+
@media (pointer: coarse) {
|
|
107
|
+
.wr-date-picker__clear {
|
|
108
|
+
align-self: stretch;
|
|
109
|
+
width: 2rem;
|
|
110
|
+
height: auto;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
// The field keeps the affix gutter when the × sits between it and the trigger,
|
|
115
|
+
// so the text does not move as the × comes and goes.
|
|
116
|
+
.wr-date-picker .wr-input:has(+ .wr-date-picker__clear),
|
|
117
|
+
.wr-date-range-picker .wr-input:has(+ .wr-date-picker__clear) {
|
|
118
|
+
padding-inline-end: var(--wr-input-group-affix-gap);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
// Sizes — share the `--wr-control-*` contract (22 / 30 / 36 px). The fields carry
|
|
122
|
+
// `wr-input--<size>` themselves; the group and the trigger are their siblings and
|
|
123
|
+
// read the size from the host. Both pickers draw the same trigger.
|
|
124
|
+
.wr-date-picker--sm,
|
|
125
|
+
.wr-date-range-picker--sm {
|
|
126
|
+
> .wr-input-group {
|
|
127
|
+
--wr-input-group-radius: var(--wr-control-radius-sm);
|
|
128
|
+
--wr-input-group-padding-x: var(--wr-control-padding-x-sm);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.wr-date-picker__trigger {
|
|
132
|
+
--wr-date-picker-trigger-icon-size: var(--wr-control-font-size-sm);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
.wr-date-picker__clear {
|
|
136
|
+
--wr-date-picker-clear-icon-size: var(--wr-control-font-size-sm);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
.wr-date-picker--lg,
|
|
141
|
+
.wr-date-range-picker--lg {
|
|
142
|
+
> .wr-input-group {
|
|
143
|
+
--wr-input-group-radius: var(--wr-control-radius-lg);
|
|
144
|
+
--wr-input-group-padding-x: var(--wr-control-padding-x-lg);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
.wr-date-picker__trigger {
|
|
148
|
+
--wr-date-picker-trigger-icon-size: var(--wr-control-font-size-lg);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
.wr-date-picker__clear {
|
|
152
|
+
--wr-date-picker-clear-icon-size: var(--wr-control-font-size-lg);
|
|
58
153
|
}
|
|
59
154
|
}
|
|
60
155
|
|
|
61
156
|
.wr-date-range-picker {
|
|
62
157
|
display: inline-block;
|
|
63
158
|
|
|
159
|
+
// As `.wr-date-picker` above.
|
|
160
|
+
> .wr-input-group {
|
|
161
|
+
width: 100%;
|
|
162
|
+
}
|
|
163
|
+
|
|
64
164
|
// Each end shares the group's width so the pair reads as one control.
|
|
65
165
|
&__input {
|
|
66
166
|
flex: 1 1 0;
|
|
@@ -69,14 +169,31 @@
|
|
|
69
169
|
|
|
70
170
|
&__separator {
|
|
71
171
|
--wr-date-range-picker-separator-padding-x: var(--wr-space-xs);
|
|
172
|
+
// The page's text at md, as it has always been. `sm` and `lg` take the
|
|
173
|
+
// control's: the page's line box is taller than an `sm` field and stretched
|
|
174
|
+
// the group past 22px.
|
|
175
|
+
--wr-date-range-picker-separator-font-size: inherit;
|
|
176
|
+
--wr-date-range-picker-separator-line-height: inherit;
|
|
72
177
|
|
|
73
178
|
display: inline-flex;
|
|
74
179
|
align-items: center;
|
|
75
180
|
padding: 0 var(--wr-date-range-picker-separator-padding-x);
|
|
76
181
|
color: var(--wr-color-on-surface-muted);
|
|
182
|
+
font-size: var(--wr-date-range-picker-separator-font-size);
|
|
183
|
+
line-height: var(--wr-date-range-picker-separator-line-height);
|
|
77
184
|
user-select: none;
|
|
78
185
|
}
|
|
79
186
|
|
|
187
|
+
&--sm &__separator {
|
|
188
|
+
--wr-date-range-picker-separator-font-size: var(--wr-control-font-size-sm);
|
|
189
|
+
--wr-date-range-picker-separator-line-height: var(--wr-control-line-height-sm);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
&--lg &__separator {
|
|
193
|
+
--wr-date-range-picker-separator-font-size: var(--wr-control-font-size-lg);
|
|
194
|
+
--wr-date-range-picker-separator-line-height: var(--wr-control-line-height-lg);
|
|
195
|
+
}
|
|
196
|
+
|
|
80
197
|
&--disabled {
|
|
81
198
|
.wr-date-range-picker__separator {
|
|
82
199
|
opacity: var(--wr-disabled-opacity);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DestroyRef, ElementRef, Injector, PLATFORM_ID, afterNextRender, effect, inject } from "@angular/core";
|
|
2
2
|
import { DOCUMENT as DOCUMENT$1, isPlatformBrowser } from "@angular/common";
|
|
3
|
-
import {
|
|
3
|
+
import { wrClamp, wrNumAttr, wrWatchColorScheme } from "ngwr/utils";
|
|
4
4
|
import { WrPlatform } from "ngwr/platform";
|
|
5
5
|
/**
|
|
6
6
|
* @license
|
|
@@ -52,7 +52,7 @@ var Backdrop = class {
|
|
|
52
52
|
});
|
|
53
53
|
this.viewObserver.observe(host);
|
|
54
54
|
}
|
|
55
|
-
|
|
55
|
+
wrWatchColorScheme(() => {
|
|
56
56
|
this.scene.colors(canvas);
|
|
57
57
|
if (!this.running) this.draw();
|
|
58
58
|
}, { injector });
|
|
@@ -127,7 +127,7 @@ var Backdrop = class {
|
|
|
127
127
|
this.rafId = requestAnimationFrame(this.frame);
|
|
128
128
|
return;
|
|
129
129
|
}
|
|
130
|
-
const dt =
|
|
130
|
+
const dt = wrClamp(now - this.lastFrame, 0, 50);
|
|
131
131
|
this.lastFrame = now;
|
|
132
132
|
this.scene.advance(dt);
|
|
133
133
|
this.draw();
|
|
@@ -138,10 +138,7 @@ var Backdrop = class {
|
|
|
138
138
|
this.rafId = requestAnimationFrame(this.frame);
|
|
139
139
|
};
|
|
140
140
|
};
|
|
141
|
-
const MAX_DPR = 2;
|
|
142
141
|
const MAX_PIXELS = 4e6;
|
|
143
|
-
const MAX_FRAME_MS = 50;
|
|
144
|
-
const FRAME_FLOOR_SLACK = 2;
|
|
145
142
|
function canvasBackdropRatio(width, height, devicePixelRatio) {
|
|
146
143
|
const budget = Math.sqrt(MAX_PIXELS / (width * height));
|
|
147
144
|
return Math.max(1, Math.min(2, devicePixelRatio, budget));
|
|
@@ -180,9 +177,6 @@ function roundTo(value, digits) {
|
|
|
180
177
|
* Use of this source code is governed by an MIT-style license that can be
|
|
181
178
|
* found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE
|
|
182
179
|
*/
|
|
183
|
-
const wrap = (n) => (n % 256 + 256) % 256;
|
|
184
|
-
const fade = (t) => t * t * (3 - 2 * t);
|
|
185
|
-
const lerp = (a, b, t) => a + (b - a) * t;
|
|
186
180
|
function seededRandom(seed) {
|
|
187
181
|
let state = seed % 4294967296;
|
|
188
182
|
return () => {
|
|
@@ -190,37 +184,6 @@ function seededRandom(seed) {
|
|
|
190
184
|
return state / 4294967296;
|
|
191
185
|
};
|
|
192
186
|
}
|
|
193
|
-
function createNoise(seed) {
|
|
194
|
-
const random = seededRandom(seed);
|
|
195
|
-
const order = Array.from({ length: 256 }, (_, i) => i);
|
|
196
|
-
for (let i = 255; i > 0; i--) {
|
|
197
|
-
const j = Math.floor(random() * (i + 1));
|
|
198
|
-
[order[i], order[j]] = [order[j], order[i]];
|
|
199
|
-
}
|
|
200
|
-
const perm = /* @__PURE__ */ new Uint8Array(512);
|
|
201
|
-
const values = /* @__PURE__ */ new Float32Array(512);
|
|
202
|
-
for (let i = 0; i < 512; i++) {
|
|
203
|
-
perm[i] = order[wrap(i)];
|
|
204
|
-
values[i] = random() * 2 - 1;
|
|
205
|
-
}
|
|
206
|
-
return (x, y, z) => {
|
|
207
|
-
const xi = Math.floor(x);
|
|
208
|
-
const yi = Math.floor(y);
|
|
209
|
-
const zi = Math.floor(z);
|
|
210
|
-
const u = fade(x - xi);
|
|
211
|
-
const v = fade(y - yi);
|
|
212
|
-
const w = fade(z - zi);
|
|
213
|
-
const yw = wrap(yi);
|
|
214
|
-
const zw = wrap(zi);
|
|
215
|
-
const a = perm[wrap(xi)] + yw;
|
|
216
|
-
const b = perm[wrap(xi + 1)] + yw;
|
|
217
|
-
const aa = perm[a] + zw;
|
|
218
|
-
const ab = perm[a + 1] + zw;
|
|
219
|
-
const ba = perm[b] + zw;
|
|
220
|
-
const bb = perm[b + 1] + zw;
|
|
221
|
-
return lerp(lerp(lerp(values[aa], values[ba], u), lerp(values[ab], values[bb], u), v), lerp(lerp(values[aa + 1], values[ba + 1], u), lerp(values[ab + 1], values[bb + 1], u), v), w);
|
|
222
|
-
};
|
|
223
|
-
}
|
|
224
187
|
/**
|
|
225
188
|
* @license
|
|
226
189
|
*
|
|
@@ -331,13 +294,7 @@ function graphemes(text) {
|
|
|
331
294
|
function staggerGap(by, count, stagger = null) {
|
|
332
295
|
return Math.min(Math.max(0, stagger ?? STAGGER_GAP[by]), STAGGER_SPREAD_MAX / Math.max(1, count - 1));
|
|
333
296
|
}
|
|
334
|
-
const optionalMs = (value) => value == null || value === "" ? null :
|
|
335
|
-
|
|
336
|
-
* @license
|
|
337
|
-
*
|
|
338
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
339
|
-
* found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE
|
|
340
|
-
*/
|
|
341
|
-
export { BREAKING_SPACES, FOCUSABLE, FRAME_FLOOR_SLACK, MAX_DPR, MAX_FRAME_MS, MAX_PIXELS, STAGGER_GAP, STAGGER_SPREAD_MAX, VIEW_THRESHOLD, WrPointerTracker, canvasBackdropRatio, createCanvasBackdrop, createNoise, graphemes, optionalMs, optionalSelector, roundTo, seededRandom, staggerGap };
|
|
297
|
+
const optionalMs = (value) => value == null || value === "" ? null : wrNumAttr(0)(value);
|
|
298
|
+
export { staggerGap as a, FOCUSABLE as c, MAX_PIXELS as d, canvasBackdropRatio as f, optionalMs as i, optionalSelector as l, VIEW_THRESHOLD as n, WrPointerTracker as o, createCanvasBackdrop as p, graphemes as r, seededRandom as s, BREAKING_SPACES as t, roundTo as u };
|
|
342
299
|
|
|
343
|
-
//# sourceMappingURL=
|
|
300
|
+
//# sourceMappingURL=internal-BaQU4t_0.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"internal-BaQU4t_0.mjs","names":["DOCUMENT"],"sources":["../../../projects/lib/animations/internal/canvas-backdrop.ts","../../../projects/lib/animations/internal/dom.ts","../../../projects/lib/animations/internal/noise.ts","../../../projects/lib/animations/internal/pointer-tracker.ts","../../../projects/lib/animations/internal/stagger.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 { DOCUMENT, isPlatformBrowser } from '@angular/common';\nimport { DestroyRef, ElementRef, Injector, PLATFORM_ID, afterNextRender, effect, inject } from '@angular/core';\n\nimport { WrPlatform } from 'ngwr/platform';\nimport { wrClamp, wrWatchColorScheme } from 'ngwr/utils';\n\nclass Backdrop implements WrCanvasBackdrop {\n ctx: CanvasRenderingContext2D | null = null;\n width = 0;\n height = 0;\n running = false;\n\n private platform: WrPlatform | null = null;\n private view: (Window & typeof globalThis) | null = null;\n private inView = false;\n private rafId: number | null = null;\n private resizeRafId: number | null = null;\n private pendingWidth = 0;\n private pendingHeight = 0;\n private lastFrame = 0;\n private resizeObserver: ResizeObserver | null = null;\n private viewObserver: IntersectionObserver | null = null;\n\n constructor(\n private readonly canvas: () => HTMLCanvasElement,\n private readonly scene: WrCanvasBackdropScene\n ) {}\n\n mount(host: HTMLElement, doc: Document, platform: WrPlatform, injector: Injector): void {\n // Nothing drawn under forced colours: the stylesheet hides the host too.\n if (doc.defaultView?.matchMedia?.('(forced-colors: active)').matches) return;\n const canvas = this.canvas();\n const ctx = canvas.getContext('2d');\n if (!ctx) return;\n this.ctx = ctx;\n this.platform = platform;\n this.view = doc.defaultView;\n this.scene.colors(canvas);\n\n if (typeof ResizeObserver !== 'undefined') {\n this.resizeObserver = new ResizeObserver(entries => {\n const rect = entries[entries.length - 1]?.contentRect;\n this.scheduleResize(rect?.width ?? host.clientWidth, rect?.height ?? host.clientHeight);\n });\n this.resizeObserver.observe(host);\n } else {\n this.resize(host.clientWidth, host.clientHeight);\n }\n\n if (typeof IntersectionObserver !== 'undefined') {\n this.viewObserver = new IntersectionObserver(entries => {\n this.inView = entries[entries.length - 1]?.isIntersecting ?? false;\n this.sync();\n });\n this.viewObserver.observe(host);\n }\n\n wrWatchColorScheme(\n () => {\n this.scene.colors(canvas);\n if (!this.running) this.draw();\n },\n { injector }\n );\n\n this.scene.mounted?.();\n }\n\n unmount(): void {\n this.running = false;\n this.stopLoop();\n if (this.resizeRafId !== null) cancelAnimationFrame(this.resizeRafId);\n this.resizeRafId = null;\n this.resizeObserver?.disconnect();\n this.resizeObserver = null;\n this.viewObserver?.disconnect();\n this.viewObserver = null;\n this.ctx = null;\n }\n\n /** Folds a burst of resize notifications into one layout, on the next frame. */\n private scheduleResize(width: number, height: number): void {\n this.pendingWidth = width;\n this.pendingHeight = height;\n if (this.resizeRafId !== null) return;\n this.resizeRafId = requestAnimationFrame(() => {\n this.resizeRafId = null;\n this.resize(this.pendingWidth, this.pendingHeight);\n });\n }\n\n private resize(width: number, height: number): void {\n if (!this.ctx || width <= 0 || height <= 0) return;\n const canvas = this.canvas();\n const dpr = canvasBackdropRatio(width, height, this.view?.devicePixelRatio ?? 1);\n this.width = width;\n this.height = height;\n canvas.width = Math.round(width * dpr);\n canvas.height = Math.round(height * dpr);\n this.ctx.setTransform(dpr, 0, 0, dpr, 0, 0);\n this.scene.layout(width, height);\n this.draw();\n this.sync();\n }\n\n sync(): void {\n const platform = this.platform;\n if (!platform) return;\n const reduced = platform.prefersReducedMotion();\n const allowed = this.ctx !== null && this.width > 0 && this.inView && platform.pageVisible() && !reduced;\n const active = this.scene.active();\n if (!allowed && reduced && active) {\n this.scene.rest();\n this.draw();\n }\n const run = allowed && active;\n if (run === this.running) return;\n this.running = run;\n if (run) {\n this.lastFrame = performance.now();\n this.rafId = requestAnimationFrame(this.frame);\n return;\n }\n this.stopLoop();\n }\n\n draw(): void {\n if (!this.ctx || this.width === 0) return;\n this.scene.draw(this.ctx, this.width, this.height);\n }\n\n private stopLoop(): void {\n if (this.rafId !== null) cancelAnimationFrame(this.rafId);\n this.rafId = null;\n }\n\n private readonly frame = (now: number): void => {\n this.rafId = null;\n if (!this.running) return;\n // A scene with a frame floor waits for it: the early frame is skipped\n // whole, and the one that is drawn gets the time of both.\n const floor = this.scene.frameMs ?? 0;\n if (floor > 0 && now - this.lastFrame + FRAME_FLOOR_SLACK < floor) {\n this.rafId = requestAnimationFrame(this.frame);\n return;\n }\n const dt = wrClamp(now - this.lastFrame, 0, MAX_FRAME_MS);\n this.lastFrame = now;\n this.scene.advance(dt);\n this.draw();\n if (!this.scene.active()) {\n this.running = false;\n return;\n }\n this.rafId = requestAnimationFrame(this.frame);\n };\n}\n\n/**\n * The device ratio is never followed past this: a third pixel per axis buys\n * nothing a faint backdrop shows.\n *\n * @internal\n */\nexport const MAX_DPR = 2;\n\n/**\n * The backing store's pixel budget. A section stacked on a phone runs to\n * thousands of CSS pixels tall; past this the ratio drops (never below 1), so\n * the canvas stays a few megabytes instead of tens.\n *\n * @internal\n */\nexport const MAX_PIXELS = 4_000_000;\n\n/**\n * A tab that was throttled comes back with one huge frame; a scene moves at\n * most this far at once.\n *\n * @internal\n */\nexport const MAX_FRAME_MS = 50;\n\n/**\n * How much short of its `frameMs` a frame may fall and still be drawn: a 60Hz\n * screen's second frame lands at 33.3ms, not at the 33 a scene asks for, and\n * without the slack it would wait for the third and run at 20fps.\n *\n * @internal\n */\nexport const FRAME_FLOOR_SLACK = 2;\n\n/**\n * The ratio to draw a `width` by `height` box at: the device's, capped at\n * {@link MAX_DPR} and by {@link MAX_PIXELS}, never under one.\n *\n * @internal\n */\nexport function canvasBackdropRatio(width: number, height: number, devicePixelRatio: number): number {\n const budget = Math.sqrt(MAX_PIXELS / (width * height));\n return Math.max(1, Math.min(MAX_DPR, devicePixelRatio, budget));\n}\n\n/**\n * What a canvas backdrop draws and moves. The plumbing around it (sizing,\n * colours, gates, the frame loop) is {@link createCanvasBackdrop}'s.\n *\n * @internal\n */\nexport interface WrCanvasBackdropScene {\n /** Reads the scene's colours against `canvas`, at mount and whenever the colour scheme changes. */\n colors(canvas: HTMLCanvasElement): void;\n /** Lays the scene out for a new CSS size; the backing store and its transform are already set. */\n layout(width: number, height: number): void;\n /** Whether anything is left to move: the loop runs while this holds and the gates allow. */\n active(): boolean;\n /** Moves the scene `dt` ms on, before a frame's draw. */\n advance(dt: number): void;\n /** Paints the scene on `ctx`, in CSS px. */\n draw(ctx: CanvasRenderingContext2D, width: number, height: number): void;\n /** Snaps the scene to its still state, when motion was reduced mid-flight; a draw follows. */\n rest(): void;\n /** Runs once the canvas has a context and is watched, after the first `colors`; for the scene's own listeners. */\n mounted?(): void;\n /**\n * The shortest frame the scene wants, in ms: a frame that comes sooner is\n * skipped and its time rolls into the next. For a scene that never rests,\n * where slow motion needs no more than 30fps; unset, every frame is drawn.\n */\n readonly frameMs?: number;\n}\n\n/**\n * The plumbing side of a canvas backdrop, as the component sees it.\n *\n * @internal\n */\nexport interface WrCanvasBackdrop {\n /** The drawing context while mounted, `null` on the server, under forced colours and after destroy. */\n readonly ctx: CanvasRenderingContext2D | null;\n /** The canvas's CSS size, zero until the first layout. */\n readonly width: number;\n readonly height: number;\n /** Whether the frame loop is on. */\n readonly running: boolean;\n /** Starts or stops the loop after the scene changed: the gates, then `scene.active()`. */\n sync(): void;\n /** Paints the scene once, outside the loop. */\n draw(): void;\n}\n\n/**\n * The plumbing every canvas backdrop needs: one canvas at the device ratio\n * capped at two and by a pixel budget, a `ResizeObserver` folded into one\n * frame, colours re-read when the scheme changes, and a frame loop that runs\n * only while the scene is `active()`, the host is on screen and the document is\n * visible, and that stops on its own at rest; a scene that sets `frameMs` is\n * drawn no more often than that. Under `prefers-reduced-motion:\n * reduce` the loop never runs and a scene caught moving is put to `rest()`;\n * under `forced-colors: active` nothing mounts; on the server nothing happens.\n *\n * Call it in a component's constructor: it injects the host, the platform and\n * the destroy hook, mounts after the first render and cleans up on destroy.\n * `canvas` is read at mount, so a `viewChild` works. The scene's own pointer\n * listeners go in `mounted`, their removal in the component's `DestroyRef`.\n *\n * @internal\n */\nexport function createCanvasBackdrop(canvas: () => HTMLCanvasElement, scene: WrCanvasBackdropScene): WrCanvasBackdrop {\n const backdrop = new Backdrop(canvas, scene);\n if (!isPlatformBrowser(inject(PLATFORM_ID))) return backdrop;\n\n const platform = inject(WrPlatform);\n const doc = inject(DOCUMENT);\n const injector = inject(Injector);\n const host = inject<ElementRef<HTMLElement>>(ElementRef).nativeElement;\n\n effect(() => {\n platform.pageVisible();\n platform.prefersReducedMotion();\n backdrop.sync();\n });\n\n afterNextRender(() => backdrop.mount(host, doc, platform, injector));\n inject(DestroyRef).onDestroy(() => backdrop.unmount());\n\n return backdrop;\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\n/**\n * What a keyboard can reach: the element an effect reads hover and focus on is\n * the host's closest match, so a label inside a button behaves the same for a\n * pointer and for Tab.\n *\n * @internal\n */\nexport const FOCUSABLE = 'a[href], button, input, select, textarea, summary, [tabindex]';\n\n/**\n * An optional CSS selector written as a directive's own value: a bare\n * attribute is the empty string, and means \"the host\".\n *\n * @internal\n */\nexport const optionalSelector = (value: unknown): string | null =>\n typeof value === 'string' && value.trim() !== '' ? value : null;\n\n/**\n * `value` rounded to `digits` decimals, for a number written into the DOM every\n * frame: a transform of `12.34px` repaints the same as one of `12.3400000001px`\n * and is a tenth of the string.\n *\n * @internal\n */\nexport function roundTo(value: number, digits: number): number {\n const factor = 10 ** digits;\n return Math.round(value * factor) / factor;\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\n/** `n` folded into the lattice's 0..255, for any integer. */\nconst wrap = (n: number): number => ((n % 256) + 256) % 256;\nconst fade = (t: number): number => t * t * (3 - 2 * t);\nconst lerp = (a: number, b: number, t: number): number => a + (b - a) * t;\n\n/**\n * Smooth noise in -1..1, continuous in all three arguments.\n *\n * @internal\n */\nexport type WrNoise = (x: number, y: number, z: number) => number;\n\n/**\n * A small generator in 0..1, the same run for the same seed: a linear\n * congruence on 2^32, in plain arithmetic, which stays exact under 2^53.\n *\n * @internal\n */\nexport function seededRandom(seed: number): () => number {\n let state = seed % 4294967296;\n return () => {\n state = (state * 1664525 + 1013904223) % 4294967296;\n return state / 4294967296;\n };\n}\n\n/**\n * Value noise on a lattice shuffled from `seed`: smooth, in -1..1, and the\n * same function every time for the same seed, so a spec can pin a frame. A\n * backdrop that should differ from one page load to the next passes a random\n * seed.\n *\n * @internal\n */\nexport function createNoise(seed: number): WrNoise {\n const random = seededRandom(seed);\n const order = Array.from({ length: 256 }, (_, i) => i);\n for (let i = 255; i > 0; i--) {\n const j = Math.floor(random() * (i + 1));\n [order[i], order[j]] = [order[j], order[i]];\n }\n const perm = new Uint8Array(512);\n const values = new Float32Array(512);\n for (let i = 0; i < 512; i++) {\n perm[i] = order[wrap(i)];\n values[i] = random() * 2 - 1;\n }\n return (x, y, z) => {\n const xi = Math.floor(x);\n const yi = Math.floor(y);\n const zi = Math.floor(z);\n const u = fade(x - xi);\n const v = fade(y - yi);\n const w = fade(z - zi);\n const yw = wrap(yi);\n const zw = wrap(zi);\n const a = perm[wrap(xi)] + yw;\n const b = perm[wrap(xi + 1)] + yw;\n const aa = perm[a] + zw;\n const ab = perm[a + 1] + zw;\n const ba = perm[b] + zw;\n const bb = perm[b + 1] + zw;\n return lerp(\n lerp(lerp(values[aa], values[ba], u), lerp(values[ab], values[bb], u), v),\n lerp(lerp(values[aa + 1], values[ba + 1], u), lerp(values[ab + 1], values[bb + 1], u), v),\n w\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\n/**\n * What an effect does with the hovering pointer a {@link WrPointerTracker} follows.\n *\n * @internal\n */\nexport interface WrPointerFollower {\n /** The first hovering pointer came in. The host is measured: `rect` is set. */\n enter(): void;\n /**\n * One animation frame, for any number of moves since the last. `clientX`,\n * `clientY` and `rect` hold the latest point and box. `time` is the frame's\n * timestamp, for a follower that eases toward the point over several frames.\n */\n frame(time: number): void;\n /** The pointer left, or the tracker stopped while it was inside. A pending frame is cancelled first; `rect` is `null`. */\n leave(): void;\n}\n\n/**\n * The pointer-tracking plumbing shared by the card effects: `[wrSpotlight]`\n * and `[wrTilt]`. It listens on the host for a hovering pointer, hands the\n * follower one `enter`, then one `frame` per animation frame however many\n * moves came in, and one `leave`; the follower paints.\n *\n * The host's rect is read once at enter, and again on a window `scroll` or\n * `resize` while the pointer is inside (the card moved under a still pointer:\n * one more frame is scheduled), never per move. A touch pointer is ignored: it\n * has no hover, and a tap would leave the effect on. A move with no enter\n * before it (the directive attached under a resting pointer) counts as the\n * enter. Nothing here decides about reduced motion, forced colours or the\n * server: the directive does, and simply never calls `start()`.\n *\n * `schedule()` is public so a follower that needs more frames after the\n * pointer left (an ease back to rest) can ask for them: it is not tied to the\n * pointer being inside. `stop()` cancels whatever is pending.\n *\n * @internal\n */\nexport class WrPointerTracker {\n /** The last client point seen. */\n clientX = 0;\n clientY = 0;\n /** The host's border box, measured at enter; `null` while no pointer is inside. */\n rect: DOMRect | null = null;\n\n private listeners: AbortController | null = null;\n /** Window `scroll` and `resize`, alive only while the pointer is inside. */\n private tracking: AbortController | null = null;\n /** The pending frame's id, `0` when none is pending. */\n private frame = 0;\n\n constructor(\n private readonly host: HTMLElement,\n private readonly view: Window,\n private readonly follower: WrPointerFollower\n ) {}\n\n /** Whether a hovering pointer is inside the host. */\n get inside(): boolean {\n return this.rect !== null;\n }\n\n start(): void {\n if (this.listeners) return;\n this.listeners = new AbortController();\n const options = { signal: this.listeners.signal, passive: true };\n this.host.addEventListener('pointerenter', event => this.follow(event), options);\n this.host.addEventListener('pointermove', event => this.follow(event), options);\n this.host.addEventListener('pointerleave', () => this.off(), options);\n }\n\n /** Drops every listener and the pending frame; a pointer still inside leaves first. */\n stop(): void {\n this.listeners?.abort();\n this.listeners = null;\n if (this.rect !== null) this.off();\n this.cancel();\n }\n\n /** One frame for any number of calls. */\n schedule(): void {\n if (this.frame !== 0) return;\n this.frame = this.view.requestAnimationFrame(time => {\n this.frame = 0;\n this.follower.frame(time);\n });\n }\n\n private follow(event: PointerEvent): void {\n if (event.pointerType === 'touch') return;\n this.clientX = event.clientX;\n this.clientY = event.clientY;\n if (this.rect === null) this.on();\n this.schedule();\n }\n\n private on(): void {\n this.rect = this.host.getBoundingClientRect();\n this.tracking = new AbortController();\n const options = { signal: this.tracking.signal, passive: true };\n const refresh = (): void => {\n this.rect = this.host.getBoundingClientRect();\n this.schedule();\n };\n this.view.addEventListener('scroll', refresh, { ...options, capture: true });\n this.view.addEventListener('resize', refresh, options);\n this.follower.enter();\n }\n\n private off(): void {\n this.tracking?.abort();\n this.tracking = null;\n this.rect = null;\n this.cancel();\n this.follower.leave();\n }\n\n private cancel(): void {\n if (this.frame === 0) return;\n this.view.cancelAnimationFrame(this.frame);\n this.frame = 0;\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 { wrNumAttr } from 'ngwr/utils';\n\nimport type { WrStaggerBy } from './types';\n\nlet segmenter: Intl.Segmenter | undefined;\n\n/**\n * How far the start of the last piece may sit from the start of the first, in ms.\n *\n * @internal\n */\nexport const STAGGER_SPREAD_MAX = 1200;\n\n/**\n * The gap between two pieces when an effect's `stagger` is not set, in ms.\n *\n * @internal\n */\nexport const STAGGER_GAP: Readonly<Record<WrStaggerBy, number>> = { words: 70, letters: 28 };\n\n/**\n * How much of a host has to be in the viewport before an effect plays: most\n * of it, not the first pixel of a heading peeking in at the bottom edge.\n *\n * @internal\n */\nexport const VIEW_THRESHOLD = 0.6;\n\n/**\n * A run of breaking spaces, captured so `split` keeps it. U+00A0 and the other\n * no-break spaces are not in it: a word pair the author glued together stays one\n * piece, so the lines break exactly where they did before the split.\n *\n * @internal\n */\nexport const BREAKING_SPACES = /([ \\t\\n\\r\\f]+)/;\n\n/**\n * What a reader sees as one character, so an emoji or an accented letter is never cut in two.\n *\n * @internal\n */\nexport function graphemes(text: string): string[] {\n if (typeof Intl !== 'undefined' && 'Segmenter' in Intl) {\n segmenter ??= new Intl.Segmenter(undefined, { granularity: 'grapheme' });\n return [...segmenter.segment(text)].map(s => s.segment);\n }\n // Code points: a surrogate pair stays whole, a combining mark becomes its own piece.\n return [...text];\n}\n\n/**\n * The gap between the start of one piece and the next, in ms: `stagger` when\n * set, else the mode's, and never more than lets the last of `count` pieces\n * start by {@link STAGGER_SPREAD_MAX}.\n *\n * @internal\n */\nexport function staggerGap(by: WrStaggerBy, count: number, stagger: number | null = null): number {\n return Math.min(Math.max(0, stagger ?? STAGGER_GAP[by]), STAGGER_SPREAD_MAX / Math.max(1, count - 1));\n}\n\n/**\n * An optional count in ms: `null`, `undefined` or an empty attribute means \"the mode's default\".\n *\n * @internal\n */\nexport const optionalMs = (value: unknown): number | null =>\n value == null || value === '' ? null : wrNumAttr(0)(value);\n"],"mappings":";;;;;;;;;;AAaA,IAAM,WAAN,MAAc;CAkBO;CACA;CAlBnB,MAAuC;CACvC,QAAQ;CACR,SAAS;CACT,UAAU;CAEF,WAA8B;CAC9B,OAA4C;CAC5C,SAAS;CACT,QAAuB;CACvB,cAA6B;CAC7B,eAAe;CACf,gBAAgB;CAChB,YAAY;CACZ,iBAAwC;CACxC,eAA4C;CAEpD,YACmB,QACA,OAA4B;EAD5B,KAAA,SAAA;EACA,KAAA,QAAA;CAChB;CAEH,MAAM,MAAmB,KAAe,UAAsB,UAAkB;EAE9E,IAAI,IAAI,aAAa,aAAa,yBAAyB,CAAC,CAAC,SAAS;EACtE,MAAM,SAAS,KAAK,OAAM;EAC1B,MAAM,MAAM,OAAO,WAAW,IAAI;EAClC,IAAI,CAAC,KAAK;EACV,KAAK,MAAM;EACX,KAAK,WAAW;EAChB,KAAK,OAAO,IAAI;EAChB,KAAK,MAAM,OAAO,MAAM;EAExB,IAAI,OAAO,mBAAmB,aAAa;GACzC,KAAK,iBAAiB,IAAI,gBAAe,YAAU;IACjD,MAAM,OAAO,QAAQ,QAAQ,SAAS,EAAE,EAAE;IAC1C,KAAK,eAAe,MAAM,SAAS,KAAK,aAAa,MAAM,UAAU,KAAK,YAAY;GACxF,CAAC;GACD,KAAK,eAAe,QAAQ,IAAI;EAClC,OACE,KAAK,OAAO,KAAK,aAAa,KAAK,YAAY;EAGjD,IAAI,OAAO,yBAAyB,aAAa;GAC/C,KAAK,eAAe,IAAI,sBAAqB,YAAU;IACrD,KAAK,SAAS,QAAQ,QAAQ,SAAS,EAAE,EAAE,kBAAkB;IAC7D,KAAK,KAAI;GACX,CAAC;GACD,KAAK,aAAa,QAAQ,IAAI;EAChC;EAEA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CAAI,SAAS;AAAE;AAQ1F,MAAa,iBAAiB;AAS9B,MAAa,kBAAkB;AAO/B,SAAgB,UAAU,MAAY;CACpC,IAAI,OAAO,SAAS,eAAe,eAAe,MAAM;EACtD,cAAc,IAAI,KAAK,UAAU,QAAW,EAAE,aAAa,WAAU,CAAE;EACvE,OAAO,CAAC,GAAG,UAAU,QAAQ,IAAI,CAAC,CAAC,CAAC,KAAI,MAAK,EAAE,OAAO;CACxD;CAEA,OAAO,CAAC,GAAG,IAAI;AACjB;AASA,SAAgB,WAAW,IAAiB,OAAe,UAAyB,MAAI;CACtF,OAAO,KAAK,IAAI,KAAK,IAAI,GAAG,WAAW,YAAY,GAAG,GAAG,qBAAqB,KAAK,IAAI,GAAG,QAAQ,CAAC,CAAC;AACtG;AAOA,MAAa,cAAc,UACzB,SAAS,QAAQ,UAAU,KAAK,OAAO,UAAU,CAAC,CAAC,CAAC,KAAK"}
|
package/fesm2022/ngwr-alert.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as i0 from "@angular/core";
|
|
2
2
|
import { Component, ElementRef, Injector, ViewEncapsulation, afterNextRender, computed, inject, input, output, signal } from "@angular/core";
|
|
3
3
|
import { coerceBooleanProperty } from "@angular/cdk/coercion";
|
|
4
|
-
import {
|
|
4
|
+
import { wrCheckStyles, wrGetFocusableElements } from "ngwr/utils";
|
|
5
5
|
import { useI18nText } from "ngwr/i18n";
|
|
6
6
|
import { WrIcon } from "ngwr/icon";
|
|
7
7
|
/**
|
|
@@ -51,7 +51,7 @@ var WrAlert = class WrAlert {
|
|
|
51
51
|
const doc = host.ownerDocument;
|
|
52
52
|
const active = doc.activeElement;
|
|
53
53
|
if (active && active !== doc.body) return;
|
|
54
|
-
const stops =
|
|
54
|
+
const stops = wrGetFocusableElements(doc.body).filter((el) => el.tabIndex >= 0);
|
|
55
55
|
const after = stops.findIndex((el) => (host.compareDocumentPosition(el) & Node.DOCUMENT_POSITION_FOLLOWING) !== 0);
|
|
56
56
|
(after >= 0 ? stops[after] : stops.at(-1))?.focus();
|
|
57
57
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ngwr-alert.mjs","names":[],"sources":["../../../projects/lib/alert/alert.ts","../../../projects/lib/alert/alert.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 { coerceBooleanProperty } from '@angular/cdk/coercion';\nimport {\n Component,\n ElementRef,\n Injector,\n ViewEncapsulation,\n afterNextRender,\n computed,\n inject,\n input,\n output,\n signal,\n} from '@angular/core';\n\nimport { useI18nText } from 'ngwr/i18n';\nimport { WrIcon, type WrIconName } from 'ngwr/icon';\nimport { getFocusableElements, wrCheckStyles } from 'ngwr/utils';\n\nimport type { WrAlertType } from './types';\n\n/**\n * Inline status banner. Use for feedback messages — saved/failed/notice etc.\n * Content placed inside renders below the message, in `.wr-alert__content`.\n *\n * Slots:\n *\n * - **Default** — text under the message.\n * - **`[wrAlertActions]`** — buttons under the message, in a row that wraps.\n *\n * @example\n * ```html\n * <wr-alert title=\"Saved\" message=\"Your changes are live.\" type=\"success\" />\n * <wr-alert title=\"Failed\" type=\"danger\" closable (closed)=\"onClose()\" />\n * <wr-alert title=\"Sync failed\" type=\"danger\">Request <code>8f2c41</code> timed out.</wr-alert>\n * <wr-alert title=\"Update available\" type=\"info\">\n * <wr-btn wrAlertActions size=\"sm\" (click)=\"update()\">Install</wr-btn>\n * </wr-alert>\n * ```\n *\n * @see https://ngwr.dev/reference/components/alert\n */\n@Component({\n selector: 'wr-alert',\n templateUrl: './alert.html',\n imports: [WrIcon],\n encapsulation: ViewEncapsulation.None,\n host: {\n // `title` is an input, and a static attribute that feeds an input is ALSO\n // written onto the host — where the browser shows it as a native tooltip\n // over the whole component, and where it feeds the accessible name of any\n // element that has a role. `<wr-alert title=\"Heads up\">` is the documented\n // spelling, so every page writing it shipped both. A bound `[title]` never\n // did this, which is why the two forms behaved differently for no reason a\n // reader could see.\n '[attr.title]': 'null',\n '[class]': 'classes()',\n '[attr.role]': 'liveRole()',\n '[attr.aria-live]': 'liveLevel()',\n },\n})\nexport class WrAlert {\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('alert');\n }\n\n /** Accessible name. Falls back to `alert.close`, then `'Close alert'`. */\n readonly closeLabel = input<string | null>(null);\n\n protected readonly resolvedCloseLabel = useI18nText(this.closeLabel, 'alert.close', 'Close alert');\n\n /**\n * Optional headline shown at the top of the alert.\n *\n * @default null\n */\n readonly title = input<string | null>(null);\n\n /**\n * Visual variant.\n *\n * @default 'info'\n */\n readonly type = input<WrAlertType>('info');\n\n /**\n * Override the default per-type icon with any ngwr icon name.\n *\n * @default null\n */\n readonly iconName = input<WrIconName | null>(null);\n\n /**\n * Optional secondary message rendered below the title.\n *\n * @default null\n */\n readonly message = input<string | null>(null);\n\n /**\n * When `true`, renders a leading status icon matching the `type`.\n * Pass `false` to hide. Ignored when `iconName` is set.\n *\n * @default true\n */\n readonly icon = input(true, { transform: coerceBooleanProperty });\n\n /**\n * When `true`, renders a close button.\n *\n * @default false\n */\n readonly closable = input(false, { transform: coerceBooleanProperty });\n\n /**\n * Emitted when the user dismisses the alert via the close button. If the close\n * button had focus, focus moves on to the next focusable element after the alert\n * (or the one before it, when nothing follows) — unless a `(closed)` handler has\n * placed it somewhere itself.\n */\n readonly closed = output<void>();\n\n protected readonly dismissed = signal(false);\n\n protected readonly classes = computed(() => {\n const parts = ['wr-alert', `wr-alert--${this.type()}`];\n if (this.dismissed()) parts.push('wr-alert--dismissed');\n return parts.join(' ');\n });\n\n /** Escalate role/aria-live for danger/warning alerts. */\n protected readonly liveRole = computed(() =>\n this.dismissed() ? null : this.type() === 'danger' ? 'alert' : 'status'\n );\n protected readonly liveLevel = computed(() =>\n this.dismissed() ? null : this.type() === 'danger' || this.type() === 'warning' ? 'assertive' : 'polite'\n );\n\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\n private readonly injector = inject(Injector);\n\n protected onClose(): void {\n const host = this.host.nativeElement;\n const hadFocus = host.contains(host.ownerDocument.activeElement);\n this.dismissed.set(true);\n this.closed.emit();\n if (hadFocus) afterNextRender(() => this.handOnFocus(), { injector: this.injector });\n }\n\n /**\n * The close button is removed with the rest of the content, and a focused element\n * that leaves the DOM drops the caret on `<body>`: a keyboard user's next Tab, and\n * a screen reader's reading position, started over from the top of the page. Run\n * after the render that removed it, so a `(closed)` handler that moved focus on\n * purpose is seen and left alone.\n */\n private handOnFocus(): void {\n const host = this.host.nativeElement;\n const doc = host.ownerDocument;\n const active = doc.activeElement;\n if (active && active !== doc.body) return;\n // Tab stops only: a roving composite parks its other items at -1. The host has\n // nothing focusable left inside it, so every stop is either before or after it.\n const stops = getFocusableElements(doc.body).filter(el => el.tabIndex >= 0);\n // eslint-disable-next-line no-bitwise -- compareDocumentPosition answers with a bitmask\n const after = stops.findIndex(el => (host.compareDocumentPosition(el) & Node.DOCUMENT_POSITION_FOLLOWING) !== 0);\n (after >= 0 ? stops[after] : stops.at(-1))?.focus();\n }\n}\n","@if (!dismissed()) {\n @if (iconName(); as n) {\n <wr-icon class=\"wr-alert__icon\" [name]=\"n\" />\n } @else if (icon()) {\n <svg\n class=\"wr-alert__icon\"\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 <!-- An OCTAGON, and the shape is the point. `danger` used to be a\n circle holding a bar over a dot, which is the vertical mirror of\n the `i` the @default branch draws — at the rendered 18px the two\n differ only by where a 1.5px gap sits. The stop-sign silhouette\n reads at that size and survives greyscale, which a mirrored gap\n does not. -->\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 <!-- A bar, not the exclamation mark `danger` used to carry: `neutral`\n emitted that glyph byte for byte. The icon is the whole difference\n between these two, because what the component actually paints —\n `danger-ink` #a32a33 (L 0.0968) against `on-surface-muted` #5f6c7d\n (L 0.1464) on tints 1.036:1 apart — is a hue difference and little\n else. -->\n @case ('neutral') {\n <circle cx=\"12\" cy=\"12\" r=\"10\" />\n <path d=\"M8 12h8\" />\n }\n @case ('offline') {\n <circle cx=\"12\" cy=\"12\" r=\"10\" />\n <path d=\"m4.9 4.9 14.2 14.2\" />\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\n <div class=\"wr-alert__body\">\n @if (title(); as t) {\n <p class=\"wr-alert__title\">{{ t }}</p>\n @if (message(); as m) {\n <p class=\"wr-alert__message\">{{ m }}</p>\n }\n } @else if (message(); as m) {\n <p class=\"wr-alert__title\">{{ m }}</p>\n }\n <div class=\"wr-alert__content\"><ng-content /></div>\n <div class=\"wr-alert__actions\"><ng-content select=\"[wrAlertActions]\" /></div>\n </div>\n\n @if (closable()) {\n <button type=\"button\" class=\"wr-alert__close\" [attr.aria-label]=\"resolvedCloseLabel()\" (click)=\"onClose()\">\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}\n"],"mappings":";;;;;;;;;;;;AAmEA,IAAa,UAAb,MAAa,QAAO;CAClB,cAAA;EACE,IAAI,OAAO,cAAc,eAAe,WAAW,cAAc,OAAO;CAC1E;CAGS,aAAa,MAAqB,MAAK,GAAA,YAAA,CAAA,EAAA,WAAA,aAAA,CAAA,+BAAA,CAAA,CAAA;CAE7B,qBAAqB,YAAY,KAAK,YAAY,eAAe,aAAa;CAOxF,QAAQ,MAAqB,MAAK,GAAA,YAAA,CAAA,EAAA,WAAA,QAAA,CAAA,+BAAA,CAAA,CAAA;CAOlC,OAAO,MAAmB,QAAO,GAAA,YAAA,CAAA,EAAA,WAAA,OAAA,CAAA,+BAAA,CAAA,CAAA;CAOjC,WAAW,MAAyB,MAAK,GAAA,YAAA,CAAA,EAAA,WAAA,WAAA,CAAA,+BAAA,CAAA,CAAA;CAOzC,UAAU,MAAqB,MAAK,GAAA,YAAA,CAAA,EAAA,WAAA,UAAA,CAAA,+BAAA,CAAA,CAAA;CAQpC,OAAO,MAAM,MAAI;EAAA,GAAA,YAAA,EAAA,WAAA,OAAA,+BAAA,CAAA;EAAI,WAAW;CAAqB,CAAA;CAOrD,WAAW,MAAM,OAAK;EAAA,GAAA,YAAA,EAAA,WAAA,WAAA,+BAAA,CAAA;EAAI,WAAW;CAAqB,CAAA;CAQ1D,SAAS,OAAM;CAEL,YAAY,OAAO,OAAM,GAAA,YAAA,CAAA,EAAA,WAAA,YAAA,CAAA,+BAAA,CAAA,CAAA;CAEzB,UAAU,eAAc;EACzC,MAAM,QAAQ,CAAC,YAAY,aAAa,KAAK,KAAI,GAAI;EACrD,IAAI,KAAK,U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":3,"file":"ngwr-alert.mjs","names":[],"sources":["../../../projects/lib/alert/alert.ts","../../../projects/lib/alert/alert.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 { coerceBooleanProperty } from '@angular/cdk/coercion';\nimport {\n Component,\n ElementRef,\n Injector,\n ViewEncapsulation,\n afterNextRender,\n computed,\n inject,\n input,\n output,\n signal,\n} from '@angular/core';\n\nimport { useI18nText } from 'ngwr/i18n';\nimport { WrIcon, type WrIconName } from 'ngwr/icon';\nimport { wrGetFocusableElements, wrCheckStyles } from 'ngwr/utils';\n\nimport type { WrAlertType } from './types';\n\n/**\n * Inline status banner. Use for feedback messages — saved/failed/notice etc.\n * Content placed inside renders below the message, in `.wr-alert__content`.\n *\n * Slots:\n *\n * - **Default** — text under the message.\n * - **`[wrAlertActions]`** — buttons under the message, in a row that wraps.\n *\n * @example\n * ```html\n * <wr-alert title=\"Saved\" message=\"Your changes are live.\" type=\"success\" />\n * <wr-alert title=\"Failed\" type=\"danger\" closable (closed)=\"onClose()\" />\n * <wr-alert title=\"Sync failed\" type=\"danger\">Request <code>8f2c41</code> timed out.</wr-alert>\n * <wr-alert title=\"Update available\" type=\"info\">\n * <wr-btn wrAlertActions size=\"sm\" (click)=\"update()\">Install</wr-btn>\n * </wr-alert>\n * ```\n *\n * @see https://ngwr.dev/reference/components/alert\n */\n@Component({\n selector: 'wr-alert',\n templateUrl: './alert.html',\n imports: [WrIcon],\n encapsulation: ViewEncapsulation.None,\n host: {\n // `title` is an input, and a static attribute that feeds an input is ALSO\n // written onto the host — where the browser shows it as a native tooltip\n // over the whole component, and where it feeds the accessible name of any\n // element that has a role. `<wr-alert title=\"Heads up\">` is the documented\n // spelling, so every page writing it shipped both. A bound `[title]` never\n // did this, which is why the two forms behaved differently for no reason a\n // reader could see.\n '[attr.title]': 'null',\n '[class]': 'classes()',\n '[attr.role]': 'liveRole()',\n '[attr.aria-live]': 'liveLevel()',\n },\n})\nexport class WrAlert {\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('alert');\n }\n\n /** Accessible name. Falls back to `alert.close`, then `'Close alert'`. */\n readonly closeLabel = input<string | null>(null);\n\n protected readonly resolvedCloseLabel = useI18nText(this.closeLabel, 'alert.close', 'Close alert');\n\n /**\n * Optional headline shown at the top of the alert.\n *\n * @default null\n */\n readonly title = input<string | null>(null);\n\n /**\n * Visual variant.\n *\n * @default 'info'\n */\n readonly type = input<WrAlertType>('info');\n\n /**\n * Override the default per-type icon with any ngwr icon name.\n *\n * @default null\n */\n readonly iconName = input<WrIconName | null>(null);\n\n /**\n * Optional secondary message rendered below the title.\n *\n * @default null\n */\n readonly message = input<string | null>(null);\n\n /**\n * When `true`, renders a leading status icon matching the `type`.\n * Pass `false` to hide. Ignored when `iconName` is set.\n *\n * @default true\n */\n readonly icon = input(true, { transform: coerceBooleanProperty });\n\n /**\n * When `true`, renders a close button.\n *\n * @default false\n */\n readonly closable = input(false, { transform: coerceBooleanProperty });\n\n /**\n * Emitted when the user dismisses the alert via the close button. If the close\n * button had focus, focus moves on to the next focusable element after the alert\n * (or the one before it, when nothing follows) — unless a `(closed)` handler has\n * placed it somewhere itself.\n */\n readonly closed = output<void>();\n\n protected readonly dismissed = signal(false);\n\n protected readonly classes = computed(() => {\n const parts = ['wr-alert', `wr-alert--${this.type()}`];\n if (this.dismissed()) parts.push('wr-alert--dismissed');\n return parts.join(' ');\n });\n\n /** Escalate role/aria-live for danger/warning alerts. */\n protected readonly liveRole = computed(() =>\n this.dismissed() ? null : this.type() === 'danger' ? 'alert' : 'status'\n );\n protected readonly liveLevel = computed(() =>\n this.dismissed() ? null : this.type() === 'danger' || this.type() === 'warning' ? 'assertive' : 'polite'\n );\n\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\n private readonly injector = inject(Injector);\n\n protected onClose(): void {\n const host = this.host.nativeElement;\n const hadFocus = host.contains(host.ownerDocument.activeElement);\n this.dismissed.set(true);\n this.closed.emit();\n if (hadFocus) afterNextRender(() => this.handOnFocus(), { injector: this.injector });\n }\n\n /**\n * The close button is removed with the rest of the content, and a focused element\n * that leaves the DOM drops the caret on `<body>`: a keyboard user's next Tab, and\n * a screen reader's reading position, started over from the top of the page. Run\n * after the render that removed it, so a `(closed)` handler that moved focus on\n * purpose is seen and left alone.\n */\n private handOnFocus(): void {\n const host = this.host.nativeElement;\n const doc = host.ownerDocument;\n const active = doc.activeElement;\n if (active && active !== doc.body) return;\n // Tab stops only: a roving composite parks its other items at -1. The host has\n // nothing focusable left inside it, so every stop is either before or after it.\n const stops = wrGetFocusableElements(doc.body).filter(el => el.tabIndex >= 0);\n // eslint-disable-next-line no-bitwise -- compareDocumentPosition answers with a bitmask\n const after = stops.findIndex(el => (host.compareDocumentPosition(el) & Node.DOCUMENT_POSITION_FOLLOWING) !== 0);\n (after >= 0 ? stops[after] : stops.at(-1))?.focus();\n }\n}\n","@if (!dismissed()) {\n @if (iconName(); as n) {\n <wr-icon class=\"wr-alert__icon\" [name]=\"n\" />\n } @else if (icon()) {\n <svg\n class=\"wr-alert__icon\"\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 <!-- An OCTAGON, and the shape is the point. `danger` used to be a\n circle holding a bar over a dot, which is the vertical mirror of\n the `i` the @default branch draws — at the rendered 18px the two\n differ only by where a 1.5px gap sits. The stop-sign silhouette\n reads at that size and survives greyscale, which a mirrored gap\n does not. -->\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 <!-- A bar, not the exclamation mark `danger` used to carry: `neutral`\n emitted that glyph byte for byte. The icon is the whole difference\n between these two, because what the component actually paints —\n `danger-ink` #a32a33 (L 0.0968) against `on-surface-muted` #5f6c7d\n (L 0.1464) on tints 1.036:1 apart — is a hue difference and little\n else. -->\n @case ('neutral') {\n <circle cx=\"12\" cy=\"12\" r=\"10\" />\n <path d=\"M8 12h8\" />\n }\n @case ('offline') {\n <circle cx=\"12\" cy=\"12\" r=\"10\" />\n <path d=\"m4.9 4.9 14.2 14.2\" />\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\n <div class=\"wr-alert__body\">\n @if (title(); as t) {\n <p class=\"wr-alert__title\">{{ t }}</p>\n @if (message(); as m) {\n <p class=\"wr-alert__message\">{{ m }}</p>\n }\n } @else if (message(); as m) {\n <p class=\"wr-alert__title\">{{ m }}</p>\n }\n <div class=\"wr-alert__content\"><ng-content /></div>\n <div class=\"wr-alert__actions\"><ng-content select=\"[wrAlertActions]\" /></div>\n </div>\n\n @if (closable()) {\n <button type=\"button\" class=\"wr-alert__close\" [attr.aria-label]=\"resolvedCloseLabel()\" (click)=\"onClose()\">\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\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