ngwr 15.9.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 +231 -27
- 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/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 +85 -29
- 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 +136 -11
- 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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ngwr-pipes.mjs","names":[],"sources":["../../../projects/lib/pipes/bytes.ts","../../../projects/lib/pipes/date.ts","../../../projects/lib/pipes/duration.ts","../../../projects/lib/pipes/initials.ts","../../../projects/lib/pipes/mark.ts","../../../projects/lib/pipes/number.ts","../../../projects/lib/pipes/plural.ts","../../../projects/lib/pipes/range.ts","../../../projects/lib/pipes/truncate.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 { LOCALE_ID, Pipe, inject } from '@angular/core';\nimport type { PipeTransform } from '@angular/core';\n\n/**\n * Binary magnitudes, as the `Intl` unit that labels each one. The COUNTING is\n * 1024-based and these names are decimal — which is the same thing the old\n * hand-written `['B', 'KB', 'MB', …]` table did, and what almost every file\n * manager does. Strictly, 1024 bytes is a kibibyte; `Intl` has no unit for it.\n */\nconst UNITS = ['byte', 'kilobyte', 'megabyte', 'gigabyte', 'terabyte', 'petabyte'] as const;\n\n/**\n * `Intl`'s NARROW unit, with one space put back between it and the number.\n *\n * Neither display mode is right on its own. `short` spells the smallest unit\n * as a word — \"512 byte\", \"0 byte\" in English, \"0 Byte\" in German — which is\n * both worse copy than the `B` this pipe has always rendered and a bigger\n * change than the fix is worth. `narrow` gives `B` / `Б` / `o` correctly and\n * then closes the gap: \"1.2kB\".\n *\n * So the parts are reassembled rather than the string. Going through\n * `formatToParts` is what keeps the ORDER the locale's own — Hebrew puts the\n * unit first, and hand-joining `${n} ${unit}` would silently straighten every\n * such locale into English order.\n */\nfunction format(locale: string, value: number, unit: number, fractionDigits: number): string {\n const parts = new Intl.NumberFormat(locale, {\n style: 'unit',\n unit: UNITS[unit],\n unitDisplay: 'narrow',\n minimumFractionDigits: fractionDigits,\n maximumFractionDigits: fractionDigits,\n }).formatToParts(value);\n\n const at = parts.findIndex(part => part.type === 'unit');\n if (at === -1) return parts.map(part => part.value).join('');\n\n const out = parts.map(part => part.value);\n // The slot on the number's side of the unit: already a separator in some\n // locales, absent in others.\n const gap = at === 0 ? 1 : at - 1;\n if (parts[gap]?.type === 'literal') out[gap] = ' ';\n else out.splice(at === 0 ? 1 : at, 0, ' ');\n return out.join('');\n}\n\n/**\n * Humanise a byte count using binary (1024-based) units, in the reader's locale.\n *\n * @example\n * ```html\n * {{ 1234 | wrBytes }} <!-- en: \"1.2 kB\" de: \"1,2 kB\" ru: \"1,2 кБ\" -->\n * {{ 1234567 | wrBytes: 0 }} <!-- en: \"1 MB\" fr: \"1 Mo\" -->\n * {{ 0 | wrBytes }} <!-- en: \"0 B\" ru: \"0 Б\" -->\n * ```\n *\n * **Both halves come from `Intl`, and the unit table is not the catalog's.** The\n * number always did need `LOCALE_ID` — it went through `toFixed`, which writes a\n * full stop in every language, so a German page read `1.2 KB` beside its own\n * `1,2` everywhere else — and the three formatting pipes beside this one\n * (`wrDate`, `wrNumber`, `wrPlural`) had injected it since they shipped.\n *\n * The unit could not follow them into `ngwr/i18n`, and the reason is the pipe\n * rather than the strings: a PURE pipe is re-invoked only when its argument\n * changes, so a catalog that lands after the first render — which is every\n * `provideWrI18nHttpLoader` app — would never reach it, and the pipe would be\n * correct under the static loader and silently English under the other one.\n * `LOCALE_ID` is a constant, so `Intl` has no such failure mode, and it knows\n * every locale ICU ships rather than the twenty-two this package translates.\n *\n * One visible change in English and it is the only one: `KB` became `kB`, which\n * is what CLDR calls that unit. `B`, the space before it and every other\n * magnitude read exactly as they did — see `format` for the part of that which\n * is not free.\n *\n * The other consequence, kept here so nobody rediscovers it as a bug:\n * `<wr-file-upload>` prints its own sizes from `fileUpload.unitKb` and friends,\n * which are public catalog keys a consumer may have overridden, so it renders\n * `KB` where this pipe renders `kB`. Retiring those keys would silently break\n * every override that had been translating them, which is a major-version move.\n *\n * {@link wrFormatBytes} is the same output as a function.\n */\n@Pipe({ name: 'wrBytes' })\nexport class WrBytes implements PipeTransform {\n private readonly locale = inject(LOCALE_ID);\n\n transform(value: number | string | null | undefined, decimals = 1): string {\n return wrFormatBytes(value, this.locale, decimals);\n }\n}\n\n/**\n * A byte count in binary (1024-based) units, in the given locale: the same\n * output as the `wrBytes` pipe, for a string built in TypeScript. `null`,\n * `undefined` and an empty string give an empty string; zero, a negative\n * number and a value that is not a number give `0 B`.\n *\n * @example\n * ```ts\n * wrFormatBytes(1234, 'en-US'); // \"1.2 kB\"\n * wrFormatBytes(1234567, 'fr-FR', 0); // \"1 Mo\"\n * ```\n */\nexport function wrFormatBytes(value: number | string | null | undefined, locale: string, decimals = 1): string {\n if (value === null || value === undefined || value === '') return '';\n const n = Number(value);\n if (!Number.isFinite(n) || n <= 0) return format(locale, 0, 0, 0);\n\n // Floored as well as capped: for `0 < n < 1` the log is negative, so an\n // unclamped index reads `UNITS[-1]` (`undefined`) and divides by `1024 ** -1`,\n // which rendered `0.5` as \"512.0 undefined\".\n const i = Math.min(Math.max(0, Math.floor(Math.log(n) / Math.log(1024))), UNITS.length - 1);\n // Whole bytes never show a fractional part.\n return format(locale, n / 1024 ** i, i, i === 0 ? 0 : Math.max(0, decimals));\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 { Pipe, inject } from '@angular/core';\nimport type { PipeTransform } from '@angular/core';\n\nimport { type WrDateFormat, WrDateAdapter, toLocalDate } from 'ngwr/date';\n\n/**\n * A date through a `WrDateAdapter`: the same output as the `wrDate` pipe, for a\n * string built in TypeScript. A date-only string (`'2026-01-01'`) is that day in\n * the local zone, as `DatePipe` reads it. `null`, `undefined`, an empty string\n * and a date the engine refuses give an empty string.\n *\n * The adapter stands where `wrFormatNumber` takes a locale, because the output\n * is the adapter's: the native one formats in `WR_DATE_LOCALE`, and an app's own\n * adapter formats however it formats. Neither can be rebuilt from a locale\n * string, so the caller passes `inject(WrDateAdapter)` once.\n *\n * @example\n * ```ts\n * private readonly dates = inject(WrDateAdapter);\n *\n * wrFormatDate(row.createdAt, this.dates); // shortDate\n * wrFormatDate(row.createdAt, this.dates, 'mediumDateTime'); // named key\n * wrFormatDate(row.createdAt, this.dates, 'dd.MM.yyyy'); // raw token string\n * ```\n */\nexport function wrFormatDate(\n value: Date | string | number | null | undefined,\n adapter: WrDateAdapter<Date>,\n format: WrDateFormat | (string & {}) = 'shortDate'\n): string {\n if (value === null || value === undefined || value === '') return '';\n const date = value instanceof Date ? value : toLocalDate(value);\n if (Number.isNaN(date.getTime())) return '';\n\n return adapter.format(date, format);\n}\n\n/**\n * Locale-aware date formatting. Delegates to `WrDateAdapter` — the native one\n * unless the app provides its own — so both the named format keys\n * (`'shortDate'`, `'longDate'`, …) and raw token strings work with nothing to\n * set up. A date-only string (`'2026-01-01'`) is that day in the local zone,\n * as `DatePipe` reads it, not UTC midnight. {@link wrFormatDate} is the same\n * output as a function.\n *\n * @example\n * ```html\n * {{ now | wrDate }} <!-- shortDate -->\n * {{ now | wrDate: 'mediumDateTime' }} <!-- named key -->\n * {{ now | wrDate: 'dd.MM.yyyy' }} <!-- raw token string -->\n * ```\n */\n@Pipe({ name: 'wrDate' })\nexport class WrDate implements PipeTransform {\n private readonly adapter = inject<WrDateAdapter<Date>>(WrDateAdapter);\n\n transform(\n value: Date | string | number | null | undefined,\n format: WrDateFormat | (string & {}) = 'shortDate'\n ): string {\n return wrFormatDate(value, this.adapter, format);\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 { LOCALE_ID, Pipe, inject } from '@angular/core';\nimport type { PipeTransform } from '@angular/core';\n\nimport type { WrDurationStyle, WrDurationUnit } from './types';\n\n/** Each unit's length in milliseconds, largest first. */\nconst UNIT_MS: readonly (readonly [WrDurationUnit, number])[] = [\n ['day', 86_400_000],\n ['hour', 3_600_000],\n ['minute', 60_000],\n ['second', 1000],\n ['millisecond', 1],\n];\n\nconst CLOCK_UNITS: ReadonlySet<WrDurationUnit> = new Set(['hour', 'minute', 'second']);\nconst LIST_UNITS: ReadonlySet<WrDurationUnit> = new Set(['day', 'hour', 'minute', 'second']);\n\nfunction formatClock(ms: number, locale: string): string {\n const { hour = 0, minute = 0, second = 0 } = wrSplitDuration(ms, CLOCK_UNITS);\n const digits = (n: number, width: number): string =>\n new Intl.NumberFormat(locale, { useGrouping: false, minimumIntegerDigits: width }).format(n);\n const tail = `${digits(minute, hour > 0 ? 2 : 1)}:${digits(second, 2)}`;\n return hour > 0 ? `${digits(hour, 1)}:${tail}` : tail;\n}\n\nfunction formatUnits(ms: number, locale: string): string {\n const parts = wrSplitDuration(ms, LIST_UNITS);\n const unit = (name: WrDurationUnit, n: number): string =>\n new Intl.NumberFormat(locale, { style: 'unit', unit: name, unitDisplay: 'short' }).format(n);\n\n const words = (Object.entries(parts) as [WrDurationUnit, number][])\n .filter(([, n]) => n > 0)\n .map(([name, n]) => unit(name, n));\n if (words.length === 0) return unit('second', 0);\n return new Intl.ListFormat(locale, { style: 'narrow', type: 'unit' }).format(words);\n}\n\n/**\n * Split a span of milliseconds into the units asked for. A unit left out is\n * carried into the next larger one that is kept, so `['hour', 'minute',\n * 'second']` over three days and an hour reads 73 hours; the smallest unit kept\n * floors whatever remains. Shared with `wr-statistic-countdown`, whose format\n * tokens pick the units.\n *\n * @internal\n */\nexport function wrSplitDuration(\n ms: number,\n units: ReadonlySet<WrDurationUnit>\n): Readonly<Partial<Record<WrDurationUnit, number>>> {\n const out: Partial<Record<WrDurationUnit, number>> = {};\n let rest = ms;\n for (const [unit, size] of UNIT_MS) {\n if (!units.has(unit)) continue;\n const n = Math.floor(rest / size);\n out[unit] = n;\n rest -= n * size;\n }\n return out;\n}\n\n/**\n * A span of milliseconds as text, in the given locale.\n *\n * Two styles. `'clock'` is digits and colons: `1:30:00`, and `5:07` under an\n * hour; days are carried into the hours, since a clock has no day digit, so two\n * days read `48:00:00`. `'units'` is every non-zero unit as a word the locale\n * writes, `1 hr 30 min` in English and `1 h 30 min` in French, through\n * `Intl.NumberFormat`'s unit style and `Intl.ListFormat` — `Intl.DurationFormat`\n * is above the browser floor. The digits are the locale's own in both styles.\n *\n * Whole seconds: a fraction of a second is floored in both styles. Zero reads\n * `0:00` and `0 sec`. A negative span is its absolute value with the locale's\n * minus sign in front, `-5:07`. `null`, `undefined`, an empty string and a value\n * that is not a finite number give an empty string, as `wrFormatNumber` does.\n *\n * The same output as the `wrDuration` pipe, for a string built in TypeScript.\n *\n * @example\n * ```ts\n * wrFormatDuration(5_400_000, 'en-US'); // \"1:30:00\"\n * wrFormatDuration(5_400_000, 'en-US', 'units'); // \"1 hr 30 min\"\n * wrFormatDuration(307_000, 'fr-FR', 'units'); // \"5 min 7 s\"\n * ```\n */\nexport function wrFormatDuration(\n value: number | string | null | undefined,\n locale: string,\n style: WrDurationStyle = 'clock'\n): string {\n if (value === null || value === undefined || value === '') return '';\n const ms = Number(typeof value === 'string' ? value.trim() : value);\n if (!Number.isFinite(ms)) return '';\n\n const span = Math.abs(ms);\n const body = style === 'units' ? formatUnits(span, locale) : formatClock(span, locale);\n // A span that floors to zero carries no sign: `-0:00` states nothing.\n if (ms >= 0 || span < 1000) return body;\n\n const minus = new Intl.NumberFormat(locale).formatToParts(-1).find(part => part.type === 'minusSign');\n return `${minus?.value ?? '-'}${body}`;\n}\n\n/**\n * A span of milliseconds as clock digits or as units, in Angular's `LOCALE_ID`.\n * See {@link wrFormatDuration} for the two styles and the edge cases.\n *\n * @example\n * ```html\n * {{ 5400000 | wrDuration }} <!-- \"1:30:00\" -->\n * {{ 5400000 | wrDuration: 'units' }} <!-- \"1 hr 30 min\" -->\n * {{ 307000 | wrDuration }} <!-- \"5:07\" -->\n * ```\n */\n@Pipe({ name: 'wrDuration' })\nexport class WrDuration implements PipeTransform {\n private readonly locale = inject(LOCALE_ID);\n\n transform(value: number | string | null | undefined, style: WrDurationStyle = 'clock'): string {\n return wrFormatDuration(value, this.locale, style);\n }\n}\n\nexport type { WrDurationStyle, WrDurationUnit } from './types';\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 { LOCALE_ID, Pipe, inject } from '@angular/core';\nimport type { PipeTransform } from '@angular/core';\n\nimport { wrInitials } from 'ngwr/utils';\n\n/**\n * Up to two initials of a name: `wrInitials()` from `ngwr/utils`, upper-cased\n * in `LOCALE_ID`.\n *\n * @example\n * ```html\n * {{ 'Roman Khegay' | wrInitials }} <!-- \"RK\" -->\n * {{ 'madonna' | wrInitials }} <!-- \"M\" -->\n * {{ '王小明' | wrInitials }} <!-- \"王\" -->\n * ```\n *\n * @see https://ngwr.dev/reference/pipes/wr-initials\n */\n@Pipe({ name: 'wrInitials' })\nexport class WrInitials implements PipeTransform {\n private readonly locale = inject(LOCALE_ID);\n\n transform(value: string | null | undefined): string {\n return wrInitials(value, this.locale);\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 { Pipe, type PipeTransform, inject } from '@angular/core';\nimport { DomSanitizer, type SafeHtml } from '@angular/platform-browser';\n\n/** Escapes RegExp metacharacters so user input is safe to inline. @internal */\nconst RE_META = /[\\\\^$.*+?()[\\]{}|]/g;\n\n/** HTML-entities for the four chars that matter inside our `<mark>` wrap. @internal */\nfunction escapeHtml(s: string): string {\n return s.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/\"/g, '"');\n}\n\n/**\n * Wrap every occurrence of `query` in `<mark>` tags. Useful for highlighting\n * search-term matches in autocomplete results, lists, and table cells.\n *\n * The output is `SafeHtml` — bind with `[innerHTML]`. Input is escaped first\n * so user-supplied values can't inject markup.\n *\n * @example\n * ```html\n * <span [innerHTML]=\"row.name | wrMark: query()\"></span>\n *\n * <!-- Case-sensitive: -->\n * <span [innerHTML]=\"row.name | wrMark: query() : true\"></span>\n * ```\n */\n@Pipe({ name: 'wrMark' })\nexport class WrMark implements PipeTransform {\n private readonly sanitizer = inject(DomSanitizer);\n\n /**\n * @param value Source text.\n * @param query Search term to highlight. Empty/null skips the wrap.\n * @param caseSensitive Match exactly. @default false\n */\n transform(value: string | null | undefined, query: string | null | undefined, caseSensitive = false): SafeHtml {\n if (value === null || value === undefined) return '';\n const text = String(value);\n // Escaped on this path too. The output is bound with `[innerHTML]`, so\n // handing back the raw string let markup in `value` render as elements the\n // moment the search box was cleared — the same value drawn as text while a\n // query was typed, as an `<img>` when it was not.\n if (!query) return escapeHtml(text);\n\n // Match the RAW text and escape the pieces afterwards, never the other way\n // round. Escaping first rewrites `&` as `&`, and a query of `m` then lands\n // INSIDE that entity: the `<mark>` splits it and the browser paints the\n // entity's own letters, so `Tom & Jerry` renders as `Tom & Jerry`. The\n // mirror failure is a match that can never happen — `<`, `>` and `\"` no longer\n // exist in escaped text. The pipe's promise is untouched: every piece that came\n // from `value` still goes through `escapeHtml`, matched or not, so the only\n // tags in the output are the `<mark>`s built here.\n const pattern = new RegExp(`(${query.replace(RE_META, '\\\\$&')})`, caseSensitive ? 'g' : 'gi');\n const html = text\n .split(pattern)\n .map((part, index) => (index % 2 ? `<mark>${escapeHtml(part)}</mark>` : escapeHtml(part)))\n .join('');\n\n return this.sanitizer.bypassSecurityTrustHtml(html);\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 { LOCALE_ID, Pipe, inject } from '@angular/core';\nimport type { PipeTransform } from '@angular/core';\n\nimport type { WrNumberStyle } from './types';\n\n/** Digits with one optional point and a sign: the form `Intl` reads exactly. */\nconst PLAIN_DECIMAL = /^[+-]?(?:\\d+\\.?\\d*|\\.\\d+)$/;\n\nfunction toOptions(style: WrNumberStyle, currency: string): Intl.NumberFormatOptions {\n switch (style) {\n case 'percent':\n return { style: 'percent', maximumFractionDigits: 2 };\n case 'currency':\n return { style: 'currency', currency };\n case 'decimal':\n default:\n return { style: 'decimal' };\n }\n}\n\n/**\n * A number through `Intl.NumberFormat`, in the given locale: the same output as\n * the `wrNumber` pipe, for a string built in TypeScript. Takes a style shortcut\n * (with an optional currency code) or a full `Intl.NumberFormatOptions` object.\n * `null`, `undefined`, an empty string and a value that is not a finite number\n * give an empty string.\n *\n * @example\n * ```ts\n * wrFormatNumber(1234.5, 'en-US'); // \"1,234.5\"\n * wrFormatNumber(0.875, 'en-US', 'percent'); // \"87.5%\"\n * wrFormatNumber(19.99, 'de-DE', 'currency', 'EUR'); // \"19,99 €\"\n * wrFormatNumber(19.99, 'en-US', { minimumFractionDigits: 2 });\n * ```\n */\nexport function wrFormatNumber(\n value: number | string | null | undefined,\n locale: string,\n styleOrOptions: WrNumberStyle | Intl.NumberFormatOptions = 'decimal',\n currency = 'USD'\n): string {\n if (value === null || value === undefined || value === '') return '';\n const text = typeof value === 'string' ? value.trim() : null;\n const n = Number(text ?? value);\n if (!Number.isFinite(n)) return '';\n\n const options: Intl.NumberFormatOptions =\n typeof styleOrOptions === 'string' ? toOptions(styleOrOptions, currency) : styleOrOptions;\n\n // A plain decimal string goes to `Intl` as it is: through `Number()`,\n // `'12345678901234567.89'` printed as `12,345,678,901,234,568`. Any other\n // form keeps the number, since ICU throws on an exponent of a billion or more.\n // `format()` has read a string since ES2023 (Chrome 106, Firefox 116, Safari\n // 15.4); the ES2022 lib this builds against types it as a number only.\n const exact = text !== null && PLAIN_DECIMAL.test(text) ? (text as unknown as number) : n;\n return new Intl.NumberFormat(locale, options).format(exact);\n}\n\n/**\n * Locale-aware number formatting via `Intl.NumberFormat`. Uses Angular's\n * `LOCALE_ID` as the default locale.\n *\n * Accepts either a style shortcut (with optional currency code) or a full\n * `Intl.NumberFormatOptions` object for fine-grained control.\n * {@link wrFormatNumber} is the same output as a function.\n *\n * @example\n * ```html\n * {{ 1234.5 | wrNumber }} <!-- \"1,234.5\" -->\n * {{ 0.875 | wrNumber: 'percent' }} <!-- \"87.5%\" -->\n * {{ 19.99 | wrNumber: 'currency': 'USD' }} <!-- \"$19.99\" -->\n * {{ 19.99 | wrNumber: { minimumFractionDigits: 2 } }}\n * ```\n */\n@Pipe({ name: 'wrNumber' })\nexport class WrNumber implements PipeTransform {\n private readonly locale = inject(LOCALE_ID);\n\n transform(\n value: number | string | null | undefined,\n styleOrOptions: WrNumberStyle | Intl.NumberFormatOptions = 'decimal',\n currency = 'USD'\n ): string {\n return wrFormatNumber(value, this.locale, styleOrOptions, currency);\n }\n}\n\nexport type { WrNumberStyle } from './types';\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 { LOCALE_ID, Pipe, inject } from '@angular/core';\nimport type { PipeTransform } from '@angular/core';\n\nimport type { WrPluralForms, WrPluralOptions } from './types';\n\n/**\n * A count and its word form through `Intl.PluralRules`, in the given locale:\n * the same output as the `wrPlural` pipe, for a string built in TypeScript.\n * `options.locale` still wins over `locale`, as it wins over `LOCALE_ID` in the\n * pipe. `null`, `undefined` and a value that is not a finite number give an\n * empty string.\n *\n * @example\n * ```ts\n * wrFormatPlural(1, 'en', { one: 'comment', other: 'comments' }); // \"1 comment\"\n * wrFormatPlural(5, 'ru', { one: 'файл', few: 'файла', other: 'файлов' }); // \"5 файлов\"\n * wrFormatPlural(5, 'en', forms, { includeValue: false }); // \"comments\"\n * ```\n */\nexport function wrFormatPlural(\n value: number | null | undefined,\n locale: string,\n forms: WrPluralForms,\n options: WrPluralOptions = {}\n): string {\n if (value === null || value === undefined || !Number.isFinite(value)) return '';\n const tag = options.locale ?? locale;\n const category = new Intl.PluralRules(tag).select(value);\n const word = forms[category] ?? forms.other;\n if (options.includeValue === false) return word;\n return `${new Intl.NumberFormat(tag).format(value)} ${word}`;\n}\n\n/**\n * Locale-aware pluralization via `Intl.PluralRules`. Picks the right word\n * form for the count — including languages with more than two forms\n * (Russian, Polish, Arabic, …) — without hand-rolled `n % 10` rules.\n *\n * Categories follow CLDR: `zero` / `one` / `two` / `few` / `many` /\n * `other`. Missing categories fall back to `other`. {@link wrFormatPlural} is\n * the same output as a function.\n *\n * @example\n * ```html\n * {{ 1 | wrPlural: { one: 'comment', other: 'comments' } }}\n * <!-- \"1 comment\" -->\n *\n * {{ 5 | wrPlural: { one: 'файл', few: 'файла', other: 'файлов' } }}\n * <!-- \"5 файлов\" (with LOCALE_ID = ru) -->\n *\n * {{ count() | wrPlural: forms : { includeValue: false } }}\n * <!-- word only -->\n * ```\n */\n@Pipe({ name: 'wrPlural' })\nexport class WrPlural implements PipeTransform {\n private readonly locale = inject(LOCALE_ID);\n\n transform(value: number | null | undefined, forms: WrPluralForms, options: WrPluralOptions = {}): string {\n return wrFormatPlural(value, this.locale, forms, options);\n }\n}\n\nexport type { WrPluralForms, WrPluralOptions } from './types';\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 { Pipe } from '@angular/core';\nimport type { PipeTransform } from '@angular/core';\n\n/**\n * Creates an array of sequential indices `[0, 1, 2, ..., n-1]`.\n *\n * Useful for repeating template blocks a fixed number of times.\n *\n * @example\n * ```html\n * @for (i of (5 | wrRange); track i) {\n * <div>Item {{ i }}</div>\n * }\n * ```\n */\n@Pipe({ name: 'wrRange' })\nexport class WrRange implements PipeTransform {\n transform(length: number): number[] {\n return Array.from({ length }, (_, i) => i);\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 { Pipe } from '@angular/core';\nimport type { PipeTransform } from '@angular/core';\n\nlet segmenter: Intl.Segmenter | undefined;\n\n/**\n * Clamp a string to `length` characters, appending `ellipsis` when truncated.\n * A character is what a reader sees as one — a grapheme cluster — so an emoji,\n * a flag or a letter with a combining accent is kept whole or dropped whole,\n * never cut into half a surrogate pair that renders as a replacement box.\n *\n * @example\n * ```html\n * {{ 'Hello, world' | wrTruncate: 5 }} <!-- \"Hello…\" -->\n * {{ 'Hello, world' | wrTruncate: 8: '...' }} <!-- \"Hello, w...\" -->\n * ```\n */\n@Pipe({ name: 'wrTruncate' })\nexport class WrTruncate implements PipeTransform {\n transform(value: string | null | undefined, length = 80, ellipsis = '…'): string {\n if (value === null || value === undefined) return '';\n const s = String(value);\n // No more graphemes than UTF-16 units, so a string this short is never cut.\n if (s.length <= length) return s;\n // `slice`'s own coercion of the count, which is what this pipe did before it\n // counted graphemes: a fraction truncates, and NaN or a negative keeps nothing.\n const limit = Math.max(0, Math.trunc(length) || 0);\n segmenter ??= new Intl.Segmenter(undefined, { granularity: 'grapheme' });\n let count = 0;\n for (const { index } of segmenter.segment(s)) {\n if (count === limit) return s.slice(0, index) + ellipsis;\n count++;\n }\n return s;\n }\n}\n"],"mappings":";;;;;;;;;;;AAgBA,MAAM,QAAQ;CAAC;CAAQ;CAAY;CAAY;CAAY;CAAY;AAAU;AAgBjF,SAAS,OAAO,QAAgB,OAAe,MAAc,gBAAsB;CACjF,MAAM,QAAQ,IAAI,KAAK,aAAa,QAAQ;EAC1C,OAAO;EACP,MAAM,MAAM;EACZ,aAAa;EACb,uBAAuB;EACvB,uBAAuB;CACxB,CAAA,CAAC,CAAC,cAAc,KAAK;CAEtB,MAAM,KAAK,MAAM,WAAU,SAAQ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.mjs","names":[],"sources":["../../../projects/lib/pipes/bytes.ts","../../../projects/lib/pipes/date.ts","../../../projects/lib/pipes/duration.ts","../../../projects/lib/pipes/initials.ts","../../../projects/lib/pipes/mark.ts","../../../projects/lib/pipes/number.ts","../../../projects/lib/pipes/plural.ts","../../../projects/lib/pipes/range.ts","../../../projects/lib/pipes/truncate.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 { LOCALE_ID, Pipe, inject } from '@angular/core';\nimport type { PipeTransform } from '@angular/core';\n\n/**\n * Binary magnitudes, as the `Intl` unit that labels each one. The COUNTING is\n * 1024-based and these names are decimal — which is the same thing the old\n * hand-written `['B', 'KB', 'MB', …]` table did, and what almost every file\n * manager does. Strictly, 1024 bytes is a kibibyte; `Intl` has no unit for it.\n */\nconst UNITS = ['byte', 'kilobyte', 'megabyte', 'gigabyte', 'terabyte', 'petabyte'] as const;\n\n/**\n * `Intl`'s NARROW unit, with one space put back between it and the number.\n *\n * Neither display mode is right on its own. `short` spells the smallest unit\n * as a word — \"512 byte\", \"0 byte\" in English, \"0 Byte\" in German — which is\n * both worse copy than the `B` this pipe has always rendered and a bigger\n * change than the fix is worth. `narrow` gives `B` / `Б` / `o` correctly and\n * then closes the gap: \"1.2kB\".\n *\n * So the parts are reassembled rather than the string. Going through\n * `formatToParts` is what keeps the ORDER the locale's own — Hebrew puts the\n * unit first, and hand-joining `${n} ${unit}` would silently straighten every\n * such locale into English order.\n */\nfunction format(locale: string, value: number, unit: number, fractionDigits: number): string {\n const parts = new Intl.NumberFormat(locale, {\n style: 'unit',\n unit: UNITS[unit],\n unitDisplay: 'narrow',\n minimumFractionDigits: fractionDigits,\n maximumFractionDigits: fractionDigits,\n }).formatToParts(value);\n\n const at = parts.findIndex(part => part.type === 'unit');\n if (at === -1) return parts.map(part => part.value).join('');\n\n const out = parts.map(part => part.value);\n // The slot on the number's side of the unit: already a separator in some\n // locales, absent in others.\n const gap = at === 0 ? 1 : at - 1;\n if (parts[gap]?.type === 'literal') out[gap] = ' ';\n else out.splice(at === 0 ? 1 : at, 0, ' ');\n return out.join('');\n}\n\n/**\n * Humanise a byte count using binary (1024-based) units, in the reader's locale.\n *\n * @example\n * ```html\n * {{ 1234 | wrBytes }} <!-- en: \"1.2 kB\" de: \"1,2 kB\" ru: \"1,2 кБ\" -->\n * {{ 1234567 | wrBytes: 0 }} <!-- en: \"1 MB\" fr: \"1 Mo\" -->\n * {{ 0 | wrBytes }} <!-- en: \"0 B\" ru: \"0 Б\" -->\n * ```\n *\n * **Both halves come from `Intl`, and the unit table is not the catalog's.** The\n * number always did need `LOCALE_ID` — it went through `toFixed`, which writes a\n * full stop in every language, so a German page read `1.2 KB` beside its own\n * `1,2` everywhere else — and the three formatting pipes beside this one\n * (`wrDate`, `wrNumber`, `wrPlural`) had injected it since they shipped.\n *\n * The unit could not follow them into `ngwr/i18n`, and the reason is the pipe\n * rather than the strings: a PURE pipe is re-invoked only when its argument\n * changes, so a catalog that lands after the first render — which is every\n * `provideWrI18nHttpLoader` app — would never reach it, and the pipe would be\n * correct under the static loader and silently English under the other one.\n * `LOCALE_ID` is a constant, so `Intl` has no such failure mode, and it knows\n * every locale ICU ships rather than the twenty-two this package translates.\n *\n * One visible change in English and it is the only one: `KB` became `kB`, which\n * is what CLDR calls that unit. `B`, the space before it and every other\n * magnitude read exactly as they did — see `format` for the part of that which\n * is not free.\n *\n * The other consequence, kept here so nobody rediscovers it as a bug:\n * `<wr-file-upload>` prints its own sizes from `fileUpload.unitKb` and friends,\n * which are public catalog keys a consumer may have overridden, so it renders\n * `KB` where this pipe renders `kB`. Retiring those keys would silently break\n * every override that had been translating them, which is a major-version move.\n *\n * {@link wrFormatBytes} is the same output as a function.\n */\n@Pipe({ name: 'wrBytes' })\nexport class WrBytes implements PipeTransform {\n private readonly locale = inject(LOCALE_ID);\n\n transform(value: number | string | null | undefined, decimals = 1): string {\n return wrFormatBytes(value, this.locale, decimals);\n }\n}\n\n/**\n * A byte count in binary (1024-based) units, in the given locale: the same\n * output as the `wrBytes` pipe, for a string built in TypeScript. `null`,\n * `undefined` and an empty string give an empty string; zero, a negative\n * number and a value that is not a number give `0 B`.\n *\n * @example\n * ```ts\n * wrFormatBytes(1234, 'en-US'); // \"1.2 kB\"\n * wrFormatBytes(1234567, 'fr-FR', 0); // \"1 Mo\"\n * ```\n */\nexport function wrFormatBytes(value: number | string | null | undefined, locale: string, decimals = 1): string {\n if (value === null || value === undefined || value === '') return '';\n const n = Number(value);\n if (!Number.isFinite(n) || n <= 0) return format(locale, 0, 0, 0);\n\n // Floored as well as capped: for `0 < n < 1` the log is negative, so an\n // unclamped index reads `UNITS[-1]` (`undefined`) and divides by `1024 ** -1`,\n // which rendered `0.5` as \"512.0 undefined\".\n const i = Math.min(Math.max(0, Math.floor(Math.log(n) / Math.log(1024))), UNITS.length - 1);\n // Whole bytes never show a fractional part.\n return format(locale, n / 1024 ** i, i, i === 0 ? 0 : Math.max(0, decimals));\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 { Pipe, inject } from '@angular/core';\nimport type { PipeTransform } from '@angular/core';\n\nimport { type WrDateFormat, WrDateAdapter, wrParseDate } from 'ngwr/date';\n\n/**\n * A date through a `WrDateAdapter`: the same output as the `wrDate` pipe, for a\n * string built in TypeScript. A date-only string (`'2026-01-01'`) is that day in\n * the local zone, as `DatePipe` reads it, and `'2026-01-01 14:30:00'` is read\n * as its `T` form: the value goes through `wrParseDate`. `null`, `undefined`,\n * an empty string and a date the engine refuses give an empty string.\n *\n * The adapter stands where `wrFormatNumber` takes a locale, because the output\n * is the adapter's: the native one formats in `WR_DATE_LOCALE`, and an app's own\n * adapter formats however it formats. Neither can be rebuilt from a locale\n * string, so the caller passes `inject(WrDateAdapter)` once.\n *\n * @example\n * ```ts\n * private readonly dates = inject(WrDateAdapter);\n *\n * wrFormatDate(row.createdAt, this.dates); // shortDate\n * wrFormatDate(row.createdAt, this.dates, 'mediumDateTime'); // named key\n * wrFormatDate(row.createdAt, this.dates, 'dd.MM.yyyy'); // raw token string\n * ```\n */\nexport function wrFormatDate(\n value: Date | string | number | null | undefined,\n adapter: WrDateAdapter<Date>,\n format: WrDateFormat | (string & {}) = 'shortDate'\n): string {\n const date = wrParseDate(value);\n return date === null ? '' : adapter.format(date, format);\n}\n\n/**\n * Locale-aware date formatting. Delegates to `WrDateAdapter` — the native one\n * unless the app provides its own — so both the named format keys\n * (`'shortDate'`, `'longDate'`, …) and raw token strings work with nothing to\n * set up. A date-only string (`'2026-01-01'`) is that day in the local zone,\n * as `DatePipe` reads it, not UTC midnight, and a backend's\n * `'2026-01-01 14:30:00'` is read as its `T` form. {@link wrFormatDate} is the\n * same output as a function.\n *\n * @example\n * ```html\n * {{ now | wrDate }} <!-- shortDate -->\n * {{ now | wrDate: 'mediumDateTime' }} <!-- named key -->\n * {{ now | wrDate: 'dd.MM.yyyy' }} <!-- raw token string -->\n * ```\n */\n@Pipe({ name: 'wrDate' })\nexport class WrDate implements PipeTransform {\n private readonly adapter = inject<WrDateAdapter<Date>>(WrDateAdapter);\n\n transform(\n value: Date | string | number | null | undefined,\n format: WrDateFormat | (string & {}) = 'shortDate'\n ): string {\n return wrFormatDate(value, this.adapter, format);\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 { LOCALE_ID, Pipe, inject } from '@angular/core';\nimport type { PipeTransform } from '@angular/core';\n\nimport type { WrDurationStyle, WrDurationUnit } from './types';\n\n/** Each unit's length in milliseconds, largest first. */\nconst UNIT_MS: readonly (readonly [WrDurationUnit, number])[] = [\n ['day', 86_400_000],\n ['hour', 3_600_000],\n ['minute', 60_000],\n ['second', 1000],\n ['millisecond', 1],\n];\n\nconst CLOCK_UNITS: ReadonlySet<WrDurationUnit> = new Set(['hour', 'minute', 'second']);\nconst LIST_UNITS: ReadonlySet<WrDurationUnit> = new Set(['day', 'hour', 'minute', 'second']);\n\nfunction formatClock(ms: number, locale: string): string {\n const { hour = 0, minute = 0, second = 0 } = wrSplitDuration(ms, CLOCK_UNITS);\n const digits = (n: number, width: number): string =>\n new Intl.NumberFormat(locale, { useGrouping: false, minimumIntegerDigits: width }).format(n);\n const tail = `${digits(minute, hour > 0 ? 2 : 1)}:${digits(second, 2)}`;\n return hour > 0 ? `${digits(hour, 1)}:${tail}` : tail;\n}\n\nfunction formatUnits(ms: number, locale: string): string {\n const parts = wrSplitDuration(ms, LIST_UNITS);\n const unit = (name: WrDurationUnit, n: number): string =>\n new Intl.NumberFormat(locale, { style: 'unit', unit: name, unitDisplay: 'short' }).format(n);\n\n const words = (Object.entries(parts) as [WrDurationUnit, number][])\n .filter(([, n]) => n > 0)\n .map(([name, n]) => unit(name, n));\n if (words.length === 0) return unit('second', 0);\n return new Intl.ListFormat(locale, { style: 'narrow', type: 'unit' }).format(words);\n}\n\n/**\n * Split a span of milliseconds into the units asked for. A unit left out is\n * carried into the next larger one that is kept, so `['hour', 'minute',\n * 'second']` over three days and an hour reads 73 hours; the smallest unit kept\n * floors whatever remains. Shared with `wr-statistic-countdown`, whose format\n * tokens pick the units.\n *\n * @internal\n */\nexport function wrSplitDuration(\n ms: number,\n units: ReadonlySet<WrDurationUnit>\n): Readonly<Partial<Record<WrDurationUnit, number>>> {\n const out: Partial<Record<WrDurationUnit, number>> = {};\n let rest = ms;\n for (const [unit, size] of UNIT_MS) {\n if (!units.has(unit)) continue;\n const n = Math.floor(rest / size);\n out[unit] = n;\n rest -= n * size;\n }\n return out;\n}\n\n/**\n * A span of milliseconds as text, in the given locale.\n *\n * Two styles. `'clock'` is digits and colons: `1:30:00`, and `5:07` under an\n * hour; days are carried into the hours, since a clock has no day digit, so two\n * days read `48:00:00`. `'units'` is every non-zero unit as a word the locale\n * writes, `1 hr 30 min` in English and `1 h 30 min` in French, through\n * `Intl.NumberFormat`'s unit style and `Intl.ListFormat` — `Intl.DurationFormat`\n * is above the browser floor. The digits are the locale's own in both styles.\n *\n * Whole seconds: a fraction of a second is floored in both styles. Zero reads\n * `0:00` and `0 sec`. A negative span is its absolute value with the locale's\n * minus sign in front, `-5:07`. `null`, `undefined`, an empty string and a value\n * that is not a finite number give an empty string, as `wrFormatNumber` does.\n *\n * The same output as the `wrDuration` pipe, for a string built in TypeScript.\n *\n * @example\n * ```ts\n * wrFormatDuration(5_400_000, 'en-US'); // \"1:30:00\"\n * wrFormatDuration(5_400_000, 'en-US', 'units'); // \"1 hr 30 min\"\n * wrFormatDuration(307_000, 'fr-FR', 'units'); // \"5 min 7 s\"\n * ```\n */\nexport function wrFormatDuration(\n value: number | string | null | undefined,\n locale: string,\n style: WrDurationStyle = 'clock'\n): string {\n if (value === null || value === undefined || value === '') return '';\n const ms = Number(typeof value === 'string' ? value.trim() : value);\n if (!Number.isFinite(ms)) return '';\n\n const span = Math.abs(ms);\n const body = style === 'units' ? formatUnits(span, locale) : formatClock(span, locale);\n // A span that floors to zero carries no sign: `-0:00` states nothing.\n if (ms >= 0 || span < 1000) return body;\n\n const minus = new Intl.NumberFormat(locale).formatToParts(-1).find(part => part.type === 'minusSign');\n return `${minus?.value ?? '-'}${body}`;\n}\n\n/**\n * A span of milliseconds as clock digits or as units, in Angular's `LOCALE_ID`.\n * See {@link wrFormatDuration} for the two styles and the edge cases.\n *\n * @example\n * ```html\n * {{ 5400000 | wrDuration }} <!-- \"1:30:00\" -->\n * {{ 5400000 | wrDuration: 'units' }} <!-- \"1 hr 30 min\" -->\n * {{ 307000 | wrDuration }} <!-- \"5:07\" -->\n * ```\n */\n@Pipe({ name: 'wrDuration' })\nexport class WrDuration implements PipeTransform {\n private readonly locale = inject(LOCALE_ID);\n\n transform(value: number | string | null | undefined, style: WrDurationStyle = 'clock'): string {\n return wrFormatDuration(value, this.locale, style);\n }\n}\n\nexport type { WrDurationStyle, WrDurationUnit } from './types';\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 { LOCALE_ID, Pipe, inject } from '@angular/core';\nimport type { PipeTransform } from '@angular/core';\n\nimport { wrInitials } from 'ngwr/utils';\n\n/**\n * Up to two initials of a name: `wrInitials()` from `ngwr/utils`, upper-cased\n * in `LOCALE_ID`.\n *\n * @example\n * ```html\n * {{ 'Roman Khegay' | wrInitials }} <!-- \"RK\" -->\n * {{ 'madonna' | wrInitials }} <!-- \"M\" -->\n * {{ '王小明' | wrInitials }} <!-- \"王\" -->\n * ```\n *\n * @see https://ngwr.dev/reference/pipes/wr-initials\n */\n@Pipe({ name: 'wrInitials' })\nexport class WrInitials implements PipeTransform {\n private readonly locale = inject(LOCALE_ID);\n\n transform(value: string | null | undefined): string {\n return wrInitials(value, this.locale);\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 { Pipe, type PipeTransform, inject } from '@angular/core';\nimport { DomSanitizer, type SafeHtml } from '@angular/platform-browser';\n\n/** Escapes RegExp metacharacters so user input is safe to inline. @internal */\nconst RE_META = /[\\\\^$.*+?()[\\]{}|]/g;\n\n/** HTML-entities for the four chars that matter inside our `<mark>` wrap. @internal */\nfunction escapeHtml(s: string): string {\n return s.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/\"/g, '"');\n}\n\n/**\n * Wrap every occurrence of `query` in `<mark>` tags. Useful for highlighting\n * search-term matches in autocomplete results, lists, and table cells.\n *\n * The output is `SafeHtml` — bind with `[innerHTML]`. Input is escaped first\n * so user-supplied values can't inject markup.\n *\n * @example\n * ```html\n * <span [innerHTML]=\"row.name | wrMark: query()\"></span>\n *\n * <!-- Case-sensitive: -->\n * <span [innerHTML]=\"row.name | wrMark: query() : true\"></span>\n * ```\n */\n@Pipe({ name: 'wrMark' })\nexport class WrMark implements PipeTransform {\n private readonly sanitizer = inject(DomSanitizer);\n\n /**\n * @param value Source text.\n * @param query Search term to highlight. Empty/null skips the wrap.\n * @param caseSensitive Match exactly. @default false\n */\n transform(value: string | null | undefined, query: string | null | undefined, caseSensitive = false): SafeHtml {\n if (value === null || value === undefined) return '';\n const text = String(value);\n // Escaped on this path too. The output is bound with `[innerHTML]`, so\n // handing back the raw string let markup in `value` render as elements the\n // moment the search box was cleared — the same value drawn as text while a\n // query was typed, as an `<img>` when it was not.\n if (!query) return escapeHtml(text);\n\n // Match the RAW text and escape the pieces afterwards, never the other way\n // round. Escaping first rewrites `&` as `&`, and a query of `m` then lands\n // INSIDE that entity: the `<mark>` splits it and the browser paints the\n // entity's own letters, so `Tom & Jerry` renders as `Tom & Jerry`. The\n // mirror failure is a match that can never happen — `<`, `>` and `\"` no longer\n // exist in escaped text. The pipe's promise is untouched: every piece that came\n // from `value` still goes through `escapeHtml`, matched or not, so the only\n // tags in the output are the `<mark>`s built here.\n const pattern = new RegExp(`(${query.replace(RE_META, '\\\\$&')})`, caseSensitive ? 'g' : 'gi');\n const html = text\n .split(pattern)\n .map((part, index) => (index % 2 ? `<mark>${escapeHtml(part)}</mark>` : escapeHtml(part)))\n .join('');\n\n return this.sanitizer.bypassSecurityTrustHtml(html);\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 { LOCALE_ID, Pipe, inject } from '@angular/core';\nimport type { PipeTransform } from '@angular/core';\n\nimport type { WrNumberStyle } from './types';\n\n/** Digits with one optional point and a sign: the form `Intl` reads exactly. */\nconst PLAIN_DECIMAL = /^[+-]?(?:\\d+\\.?\\d*|\\.\\d+)$/;\n\nfunction toOptions(style: WrNumberStyle, currency: string): Intl.NumberFormatOptions {\n switch (style) {\n case 'percent':\n return { style: 'percent', maximumFractionDigits: 2 };\n case 'currency':\n return { style: 'currency', currency };\n case 'decimal':\n default:\n return { style: 'decimal' };\n }\n}\n\n/**\n * A number through `Intl.NumberFormat`, in the given locale: the same output as\n * the `wrNumber` pipe, for a string built in TypeScript. Takes a style shortcut\n * (with an optional currency code) or a full `Intl.NumberFormatOptions` object.\n * `null`, `undefined`, an empty string and a value that is not a finite number\n * give an empty string.\n *\n * @example\n * ```ts\n * wrFormatNumber(1234.5, 'en-US'); // \"1,234.5\"\n * wrFormatNumber(0.875, 'en-US', 'percent'); // \"87.5%\"\n * wrFormatNumber(19.99, 'de-DE', 'currency', 'EUR'); // \"19,99 €\"\n * wrFormatNumber(19.99, 'en-US', { minimumFractionDigits: 2 });\n * ```\n */\nexport function wrFormatNumber(\n value: number | string | null | undefined,\n locale: string,\n styleOrOptions: WrNumberStyle | Intl.NumberFormatOptions = 'decimal',\n currency = 'USD'\n): string {\n if (value === null || value === undefined || value === '') return '';\n const text = typeof value === 'string' ? value.trim() : null;\n const n = Number(text ?? value);\n if (!Number.isFinite(n)) return '';\n\n const options: Intl.NumberFormatOptions =\n typeof styleOrOptions === 'string' ? toOptions(styleOrOptions, currency) : styleOrOptions;\n\n // A plain decimal string goes to `Intl` as it is: through `Number()`,\n // `'12345678901234567.89'` printed as `12,345,678,901,234,568`. Any other\n // form keeps the number, since ICU throws on an exponent of a billion or more.\n // `format()` has read a string since ES2023 (Chrome 106, Firefox 116, Safari\n // 15.4); the ES2022 lib this builds against types it as a number only.\n const exact = text !== null && PLAIN_DECIMAL.test(text) ? (text as unknown as number) : n;\n return new Intl.NumberFormat(locale, options).format(exact);\n}\n\n/**\n * Locale-aware number formatting via `Intl.NumberFormat`. Uses Angular's\n * `LOCALE_ID` as the default locale.\n *\n * Accepts either a style shortcut (with optional currency code) or a full\n * `Intl.NumberFormatOptions` object for fine-grained control.\n * {@link wrFormatNumber} is the same output as a function.\n *\n * @example\n * ```html\n * {{ 1234.5 | wrNumber }} <!-- \"1,234.5\" -->\n * {{ 0.875 | wrNumber: 'percent' }} <!-- \"87.5%\" -->\n * {{ 19.99 | wrNumber: 'currency': 'USD' }} <!-- \"$19.99\" -->\n * {{ 19.99 | wrNumber: { minimumFractionDigits: 2 } }}\n * ```\n */\n@Pipe({ name: 'wrNumber' })\nexport class WrNumber implements PipeTransform {\n private readonly locale = inject(LOCALE_ID);\n\n transform(\n value: number | string | null | undefined,\n styleOrOptions: WrNumberStyle | Intl.NumberFormatOptions = 'decimal',\n currency = 'USD'\n ): string {\n return wrFormatNumber(value, this.locale, styleOrOptions, currency);\n }\n}\n\nexport type { WrNumberStyle } from './types';\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 { LOCALE_ID, Pipe, inject } from '@angular/core';\nimport type { PipeTransform } from '@angular/core';\n\nimport type { WrPluralForms, WrPluralOptions } from './types';\n\n/**\n * A count and its word form through `Intl.PluralRules`, in the given locale:\n * the same output as the `wrPlural` pipe, for a string built in TypeScript.\n * `options.locale` still wins over `locale`, as it wins over `LOCALE_ID` in the\n * pipe. `null`, `undefined` and a value that is not a finite number give an\n * empty string.\n *\n * @example\n * ```ts\n * wrFormatPlural(1, 'en', { one: 'comment', other: 'comments' }); // \"1 comment\"\n * wrFormatPlural(5, 'ru', { one: 'файл', few: 'файла', other: 'файлов' }); // \"5 файлов\"\n * wrFormatPlural(5, 'en', forms, { includeValue: false }); // \"comments\"\n * ```\n */\nexport function wrFormatPlural(\n value: number | null | undefined,\n locale: string,\n forms: WrPluralForms,\n options: WrPluralOptions = {}\n): string {\n if (value === null || value === undefined || !Number.isFinite(value)) return '';\n const tag = options.locale ?? locale;\n const category = new Intl.PluralRules(tag).select(value);\n const word = forms[category] ?? forms.other;\n if (options.includeValue === false) return word;\n return `${new Intl.NumberFormat(tag).format(value)} ${word}`;\n}\n\n/**\n * Locale-aware pluralization via `Intl.PluralRules`. Picks the right word\n * form for the count — including languages with more than two forms\n * (Russian, Polish, Arabic, …) — without hand-rolled `n % 10` rules.\n *\n * Categories follow CLDR: `zero` / `one` / `two` / `few` / `many` /\n * `other`. Missing categories fall back to `other`. {@link wrFormatPlural} is\n * the same output as a function.\n *\n * @example\n * ```html\n * {{ 1 | wrPlural: { one: 'comment', other: 'comments' } }}\n * <!-- \"1 comment\" -->\n *\n * {{ 5 | wrPlural: { one: 'файл', few: 'файла', other: 'файлов' } }}\n * <!-- \"5 файлов\" (with LOCALE_ID = ru) -->\n *\n * {{ count() | wrPlural: forms : { includeValue: false } }}\n * <!-- word only -->\n * ```\n */\n@Pipe({ name: 'wrPlural' })\nexport class WrPlural implements PipeTransform {\n private readonly locale = inject(LOCALE_ID);\n\n transform(value: number | null | undefined, forms: WrPluralForms, options: WrPluralOptions = {}): string {\n return wrFormatPlural(value, this.locale, forms, options);\n }\n}\n\nexport type { WrPluralForms, WrPluralOptions } from './types';\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 { Pipe } from '@angular/core';\nimport type { PipeTransform } from '@angular/core';\n\n/**\n * Creates an array of sequential indices `[0, 1, 2, ..., n-1]`.\n *\n * Useful for repeating template blocks a fixed number of times.\n *\n * @example\n * ```html\n * @for (i of (5 | wrRange); track i) {\n * <div>Item {{ i }}</div>\n * }\n * ```\n */\n@Pipe({ name: 'wrRange' })\nexport class WrRange implements PipeTransform {\n transform(length: number): number[] {\n return Array.from({ length }, (_, i) => i);\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 { Pipe } from '@angular/core';\nimport type { PipeTransform } from '@angular/core';\n\nlet segmenter: Intl.Segmenter | undefined;\n\n/**\n * Clamp a string to `length` characters, appending `ellipsis` when truncated.\n * A character is what a reader sees as one — a grapheme cluster — so an emoji,\n * a flag or a letter with a combining accent is kept whole or dropped whole,\n * never cut into half a surrogate pair that renders as a replacement box.\n *\n * @example\n * ```html\n * {{ 'Hello, world' | wrTruncate: 5 }} <!-- \"Hello…\" -->\n * {{ 'Hello, world' | wrTruncate: 8: '...' }} <!-- \"Hello, w...\" -->\n * ```\n */\n@Pipe({ name: 'wrTruncate' })\nexport class WrTruncate implements PipeTransform {\n transform(value: string | null | undefined, length = 80, ellipsis = '…'): string {\n if (value === null || value === undefined) return '';\n const s = String(value);\n // No more graphemes than UTF-16 units, so a string this short is never cut.\n if (s.length <= length) return s;\n // `slice`'s own coercion of the count, which is what this pipe did before it\n // counted graphemes: a fraction truncates, and NaN or a negative keeps nothing.\n const limit = Math.max(0, Math.trunc(length) || 0);\n segmenter ??= new Intl.Segmenter(undefined, { granularity: 'grapheme' });\n let count = 0;\n for (const { index } of segmenter.segment(s)) {\n if (count === limit) return s.slice(0, index) + ellipsis;\n count++;\n }\n return s;\n }\n}\n"],"mappings":";;;;;;;;;;;AAgBA,MAAM,QAAQ;CAAC;CAAQ;CAAY;CAAY;CAAY;CAAY;AAAU;AAgBjF,SAAS,OAAO,QAAgB,OAAe,MAAc,gBAAsB;CACjF,MAAM,QAAQ,IAAI,KAAK,aAAa,QAAQ;EAC1C,OAAO;EACP,MAAM,MAAM;EACZ,aAAa;EACb,uBAAuB;EACvB,uBAAuB;CACxB,CAAA,CAAC,CAAC,cAAc,KAAK;CAEtB,MAAM,KAAK,MAAM,WAAU,SAAQ,KAAK,SAAS,MAAM;CACvD,IAAI,OAAO,IAAI,OAAO,MAAM,KAAI,SAAQ,KAAK,KAAK,CAAC,CAAC,KAAK,EAAE;CAE3D,MAAM,MAAM,MAAM,KAAI,SAAQ,KAAK,KAAK;CAGxC,MAAM,MAAM,OAAO,IAAI,IAAI,KAAK;CAChC,IAAI,MAAM,IAAI,EAAE,SAAS,WAAW,IAAI,OAAO;MAC1C,IAAI,OAAO,OAAO,IAAI,IAAI,IAAI,GAAG,GAAG;CACzC,OAAO,IAAI,KAAK,EAA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AAM,IAAI,OAAO,KAAK;EAEtB,IAAI,EAAE,UAAU,QAAQ,OAAO;EAG/B,MAAM,QAAQ,KAAK,IAAI,GAAG,KAAK,MAAM,MAAM,KAAK,CAAC;EACjD,cAAc,IAAI,KAAK,UAAU,QAAW,EAAE,aAAa,WAAU,CAAE;EACvE,IAAI,QAAQ;EACZ,KAAK,MAAM,EAAE,WAAW,UAAU,QAAQ,CAAC,GAAG;GAC5C,IAAI,UAAU,OAAO,OAAO,EAAE,MAAM,GAAG,KAAK,IAAI;GAChD;EACF;EACA,OAAO;CACT;CAhBW,OAAA,OAAA,GAAA,mBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,UAAA;EAAA,MAAA;EAAU,MAAA,CAAA;EAAA,QAAA,GAAA,gBAAA;CAAA,CAAA;CAAV,OAAA,QAAA,GAAA,gBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,UAAA;EAAA,MAAA;EAAU,cAAA;EAAA,MAAA;CAAA,CAAA;;AAAV,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAU,YAAA,CAAA;EADtB,MAAA;EAAK,MAAA,CAAA,EAAE,MAAM,aAAY,CAAE"}
|
|
@@ -251,7 +251,10 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
251
251
|
});
|
|
252
252
|
function wrPoll(resource, intervalMs) {
|
|
253
253
|
assertInInjectionContext(wrPoll);
|
|
254
|
-
if (
|
|
254
|
+
if (!(intervalMs > 0) || !Number.isFinite(intervalMs)) {
|
|
255
|
+
if (isDevMode()) throw new Error(`wrPoll: intervalMs must be a positive number, got ${String(intervalMs)}`);
|
|
256
|
+
return;
|
|
257
|
+
}
|
|
255
258
|
const stop = inject(WrPollTicker).add({
|
|
256
259
|
resource,
|
|
257
260
|
intervalMs,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ngwr-platform.mjs","names":["DOCUMENT","DOCUMENT"],"sources":["../../../projects/lib/platform/wr-platform.ts","../../../projects/lib/platform/wr-haptics.ts","../../../projects/lib/platform/wr-poll.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, Service, PLATFORM_ID, type Signal, inject, signal } from '@angular/core';\n\n/** Options for {@link WrPlatform.onReturn}. */\ninterface WrReturnOptions {\n /** How long the page must have been hidden, in ms, before coming back counts. Defaults to one minute. */\n readonly after?: number;\n}\n\ninterface ReturnListener {\n readonly after: number;\n readonly callback: () => void;\n}\n\n/** A tab flick is seconds; a real absence is a meeting, a lunch, a closed lid. */\nconst RETURN_AFTER = 60_000;\n\n/**\n * SSR-safe environment probes. Use to gate browser-only code paths and\n * react to user preferences and page state without scattering `matchMedia`\n * and event listeners around.\n *\n * - `isBrowser` / `isServer`: synchronous platform check.\n * - `userAgent`: `navigator.userAgent` or `null` on the server.\n * - `prefersDark`: signal mirroring `(prefers-color-scheme: dark)`.\n * - `prefersReducedMotion`: signal mirroring `(prefers-reduced-motion: reduce)`.\n * - `pageVisible`: signal following `visibilitychange`; `true` on the server.\n * - `online`: signal following `online` / `offline`; `true` on the server.\n * - `onReturn()`: a callback for the page becoming visible after a real absence.\n *\n * @example\n * ```ts\n * private readonly platform = inject(WrPlatform);\n * if (this.platform.isBrowser) {\n * localStorage.setItem('theme', 'dark');\n * }\n *\n * protected readonly dark = this.platform.prefersDark;\n * ```\n *\n * @see https://ngwr.dev/reference/services/platform\n */\n@Service()\nexport class WrPlatform {\n private readonly destroyRef = inject(DestroyRef);\n private readonly doc = inject(DOCUMENT);\n\n readonly isBrowser = isPlatformBrowser(inject(PLATFORM_ID));\n readonly isServer = !this.isBrowser;\n readonly userAgent: string | null = this.isBrowser ? (this.doc.defaultView?.navigator?.userAgent ?? null) : null;\n\n private readonly returnListeners = new Set<ReturnListener>();\n // Above `pageVisible`, whose initializer sets it when the page boots hidden.\n private hiddenSince: number | null = null;\n\n readonly prefersDark: Signal<boolean> = this.mediaSignal('(prefers-color-scheme: dark)');\n readonly prefersReducedMotion: Signal<boolean> = this.mediaSignal('(prefers-reduced-motion: reduce)');\n\n /** Whether the page is visible: `document.visibilityState` is not `hidden`. `true` on the server. */\n readonly pageVisible: Signal<boolean> = this.visibilitySignal();\n /** Whether the browser reports a network: `navigator.onLine`. `true` on the server. */\n readonly online: Signal<boolean> = this.onlineSignal();\n\n /**\n * Calls `callback` when the page becomes visible again after being hidden\n * for at least `after` ms (one minute by default): the user came back from\n * a meeting, a lunch, a closed lid. A quick flick to another tab and back\n * fires nothing. Only visibility counts: a network that comes back while\n * the page stays visible is read from `online`.\n *\n * Needs an injection context and stops with it. Returns a function that\n * stops it early.\n *\n * @example\n * ```ts\n * constructor() {\n * inject(WrPlatform).onReturn(() => this.users.reload(), { after: 30_000 });\n * }\n * ```\n *\n * @param callback - Runs once per return, after the threshold.\n * @param options - `after`, the threshold in ms.\n * @returns A function that stops listening early.\n */\n onReturn(callback: () => void, options: WrReturnOptions = {}): () => void {\n const owner = inject(DestroyRef);\n const listener: ReturnListener = { after: options.after ?? RETURN_AFTER, callback };\n this.returnListeners.add(listener);\n const stop = (): void => {\n this.returnListeners.delete(listener);\n };\n owner.onDestroy(stop);\n return stop;\n }\n\n private mediaSignal(query: string): Signal<boolean> {\n if (!this.isBrowser || !this.doc.defaultView?.matchMedia) return signal(false).asReadonly();\n const mql = this.doc.defaultView.matchMedia(query);\n const sig = signal(mql.matches);\n const handler = (event: MediaQueryListEvent): void => sig.set(event.matches);\n mql.addEventListener('change', handler);\n this.destroyRef.onDestroy(() => mql.removeEventListener('change', handler));\n return sig.asReadonly();\n }\n\n private visibilitySignal(): Signal<boolean> {\n if (!this.isBrowser) return signal(true).asReadonly();\n const visible = (): boolean => this.doc.visibilityState !== 'hidden';\n const sig = signal(visible());\n if (!sig()) this.hiddenSince = Date.now();\n const handler = (): void => {\n const next = visible();\n sig.set(next);\n if (!next) {\n this.hiddenSince ??= Date.now();\n return;\n }\n if (this.hiddenSince === null) return;\n const away = Date.now() - this.hiddenSince;\n this.hiddenSince = null;\n for (const { after, callback } of this.returnListeners) {\n if (away >= after) callback();\n }\n };\n this.doc.addEventListener('visibilitychange', handler);\n this.destroyRef.onDestroy(() => this.doc.removeEventListener('visibilitychange', handler));\n return sig.asReadonly();\n }\n\n private onlineSignal(): Signal<boolean> {\n const view = this.isBrowser ? this.doc.defaultView : null;\n if (!view) return signal(true).asReadonly();\n const sig = signal(view.navigator?.onLine ?? true);\n const handler = (event: Event): void => sig.set(event.type === 'online');\n view.addEventListener('online', handler);\n view.addEventListener('offline', handler);\n this.destroyRef.onDestroy(() => {\n view.removeEventListener('online', handler);\n view.removeEventListener('offline', handler);\n });\n return sig.asReadonly();\n }\n}\n\nexport type { WrReturnOptions };\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 { DOCUMENT, isPlatformBrowser } from '@angular/common';\nimport { PLATFORM_ID, Service, inject } from '@angular/core';\n\n/** Impact weight for {@link WrHaptics.impact}. */\ntype WrHapticImpact = 'light' | 'medium' | 'heavy';\n\n/**\n * Vibration patterns (ms, or `[buzz, pause, buzz, …]`) behind the semantic\n * presets — loosely modelled on iOS's impact / notification feedback.\n */\nconst PATTERNS = {\n light: 10,\n medium: 20,\n heavy: 40,\n selection: 5,\n success: [15, 60, 30],\n warning: [30, 40, 30],\n error: [40, 60, 40, 60, 40],\n} as const;\n\n/**\n * SSR-safe wrapper around the Vibration API for tactile feedback on touch\n * devices. Semantic presets (`impact`, `selection`, `success`, `warning`,\n * `error`) map to sensible vibration patterns so call sites stay readable.\n *\n * Every method is a no-op — returning `false` — when there is no support:\n * on the server, in browsers without `navigator.vibrate`, and notably on\n * **iOS Safari**, which does not expose the Vibration API at all (its\n * haptics are native-only). Check {@link supported} to branch UI on it.\n *\n * Haptics are best paired with a real user gesture (tap) — some browsers\n * ignore `vibrate()` calls that aren't triggered by one. This service does\n * not gate on `prefers-reduced-motion`; read {@link WrPlatform.prefersReducedMotion}\n * at the call site if you want to suppress feedback for those users.\n *\n * @example\n * ```ts\n * private readonly haptics = inject(WrHaptics);\n *\n * onDelete(): void {\n * this.haptics.warning(); // buzz before a destructive confirm\n * }\n *\n * onToggle(): void {\n * this.haptics.selection(); // subtle tick on a switch / segmented change\n * }\n * ```\n *\n * @see https://ngwr.dev/reference/services/platform\n */\n@Service()\nexport class WrHaptics {\n private readonly isBrowser = isPlatformBrowser(inject(PLATFORM_ID));\n private readonly nav = this.isBrowser ? (inject(DOCUMENT).defaultView?.navigator ?? null) : null;\n\n /** Whether the Vibration API is available (browser + `navigator.vibrate`). */\n readonly supported: boolean = !!this.nav && typeof this.nav.vibrate === 'function';\n\n /**\n * Fire a raw vibration pattern — a single duration in ms, or an alternating\n * `[buzz, pause, buzz, …]` array. Returns whether it was dispatched; passing\n * `0` / `[]` cancels any ongoing vibration.\n */\n vibrate(pattern: number | readonly number[]): boolean {\n if (!this.supported) return false;\n try {\n // `VibratePattern` is `number | number[]`; readonly arrays are accepted\n // at runtime, so clone to satisfy the mutable-array signature.\n return this.nav!.vibrate(typeof pattern === 'number' ? pattern : [...pattern]);\n } catch {\n return false;\n }\n }\n\n /** A physical \"tap\" — `light`, `medium` (default), or `heavy`. */\n impact(strength: WrHapticImpact = 'medium'): boolean {\n return this.vibrate(PATTERNS[strength]);\n }\n\n /** A subtle tick for a discrete change (switch, segmented, stepper). */\n selection(): boolean {\n return this.vibrate(PATTERNS.selection);\n }\n\n /** A confirming pulse for a completed action. */\n success(): boolean {\n return this.vibrate(PATTERNS.success);\n }\n\n /** A cautioning pulse before a risky or destructive action. */\n warning(): boolean {\n return this.vibrate(PATTERNS.warning);\n }\n\n /** A buzzing pulse for a failure or rejected action. */\n error(): boolean {\n return this.vibrate(PATTERNS.error);\n }\n\n /** Cancel any in-progress vibration. */\n stop(): void {\n this.vibrate(0);\n }\n}\n\nexport type { WrHapticImpact };\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 {\n DestroyRef,\n type WritableResource,\n Service,\n assertInInjectionContext,\n effect,\n inject,\n isDevMode,\n untracked,\n} from '@angular/core';\n\nimport { WrPlatform } from './wr-platform';\n\ninterface PollEntry {\n readonly resource: WritableResource<unknown>;\n readonly intervalMs: number;\n /** When the resource last had its turn, due or skipped. */\n last: number;\n}\n\n/**\n * The one timer behind every {@link wrPoll}: a `setTimeout` aimed at the\n * earliest due resource, re-aimed after each tick, so two resources on\n * different intervals share it. Cleared while the page is hidden and while\n * nothing polls; never created on the server.\n */\n@Service()\nclass WrPollTicker {\n private readonly platform = inject(WrPlatform);\n private readonly entries = new Set<PollEntry>();\n private timer: ReturnType<typeof setTimeout> | null = null;\n\n constructor() {\n if (!this.platform.isBrowser) return;\n effect(() => {\n if (this.platform.pageVisible()) untracked(() => this.tick());\n else this.clear();\n });\n }\n\n add(entry: PollEntry): () => void {\n if (!this.platform.isBrowser) return () => undefined;\n this.entries.add(entry);\n this.schedule();\n return () => {\n this.entries.delete(entry);\n this.schedule();\n };\n }\n\n private tick(): void {\n const now = Date.now();\n for (const entry of this.entries) {\n if (now - entry.last < entry.intervalMs) continue;\n // A skipped turn is spent too: the resource waits a full interval again.\n entry.last = now;\n if (!untracked(entry.resource.isLoading)) entry.resource.reload();\n }\n this.schedule();\n }\n\n private schedule(): void {\n this.clear();\n if (this.entries.size === 0 || !untracked(this.platform.pageVisible)) return;\n let due = Infinity;\n for (const entry of this.entries) due = Math.min(due, entry.last + entry.intervalMs);\n this.timer = setTimeout(() => this.tick(), Math.max(0, due - Date.now()));\n }\n\n private clear(): void {\n if (this.timer === null) return;\n clearTimeout(this.timer);\n this.timer = null;\n }\n}\n\n/**\n * Reloads a resource every `intervalMs` while the page is visible, on one\n * timer shared by every polled resource in the app. Takes `resource()`,\n * `rxResource()` and `httpResource()` alike.\n *\n * - The tab goes hidden: polling pauses. It comes back: a resource overdue\n * by its interval reloads once, not once per missed turn.\n * - A resource still loading or reloading is skipped on its turn and waits\n * a full interval again, so a slow request never piles up.\n * - A resource in the `error` state keeps polling: that is how it recovers.\n * - On the server nothing is scheduled, so prerender never waits on it.\n *\n * Needs an injection context and stops with it.\n *\n * @example\n * ```ts\n * readonly orders = httpResource<Order[]>(() => '/api/orders');\n *\n * constructor() {\n * wrPoll(this.orders, 15_000);\n * }\n * ```\n *\n * @param resource - The resource to reload.\n * @param intervalMs - How often, in ms. Must be positive.\n */\nexport function wrPoll<T>(resource: WritableResource<T>, intervalMs: number): void {\n assertInInjectionContext(wrPoll);\n if (isDevMode() && !(intervalMs > 0)) {\n throw new Error(`wrPoll: intervalMs must be a positive number, got ${String(intervalMs)}`);\n }\n const stop = inject(WrPollTicker).add({ resource, intervalMs, last: Date.now() });\n inject(DestroyRef).onDestroy(stop);\n}\n"],"mappings":";;;;;;;;;AAsBA,MAAM,eAAe;AA4BrB,IAAa,aAAb,MAAa,WAAU;CACJ,aAAa,OAAO,UAAU;CAC9B,MAAM,OAAOA,UAAQ;CAE7B,YAAY,kBAAkB,OAAO,WAAW,CAAC;CACjD,WAAW,CAAC,KAAK;CACjB,YAA2B,KAAK,YAAa,KAAK,IAAI,aAAa,WAAW,aAAa,OAAQ;CAE3F,kCAAkB,IAAI,IAAG;CAElC,cAA6B;CAE5B,cAA+B,KAAK,YAAY,8BAA8B;CAC9E,uBAAwC,KAAK,YAAY,kCAAkC;CAG3F,cAA+B,KAAK,iBAAgB;CAEpD,SAA0B,KAAK,aAAY;CAuBpD,SAAS,UAAsB,UAA2B,CAAA,GAAE;EAC1D,MAAM,QAAQ,OAAO,UAAU;EAC/B,MAAM,WAA2B;GAAE,OAAO,QAAQ,SAAS;GAAc;EAAQ;EACjF,KAAK,gBAAgB,IAAI,QAAQ;EACjC,MAAM,aAAkB;GACtB,KAA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E,CAAE;CAChF,OAAO,UAAU,CAAC,CAAC,UAAU,IAAI;AACnC"}
|
|
1
|
+
{"version":3,"file":"ngwr-platform.mjs","names":["DOCUMENT","DOCUMENT"],"sources":["../../../projects/lib/platform/wr-platform.ts","../../../projects/lib/platform/wr-haptics.ts","../../../projects/lib/platform/wr-poll.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, Service, PLATFORM_ID, type Signal, inject, signal } from '@angular/core';\n\n/** Options for {@link WrPlatform.onReturn}. */\ninterface WrReturnOptions {\n /** How long the page must have been hidden, in ms, before coming back counts. Defaults to one minute. */\n readonly after?: number;\n}\n\ninterface ReturnListener {\n readonly after: number;\n readonly callback: () => void;\n}\n\n/** A tab flick is seconds; a real absence is a meeting, a lunch, a closed lid. */\nconst RETURN_AFTER = 60_000;\n\n/**\n * SSR-safe environment probes. Use to gate browser-only code paths and\n * react to user preferences and page state without scattering `matchMedia`\n * and event listeners around.\n *\n * - `isBrowser` / `isServer`: synchronous platform check.\n * - `userAgent`: `navigator.userAgent` or `null` on the server.\n * - `prefersDark`: signal mirroring `(prefers-color-scheme: dark)`.\n * - `prefersReducedMotion`: signal mirroring `(prefers-reduced-motion: reduce)`.\n * - `pageVisible`: signal following `visibilitychange`; `true` on the server.\n * - `online`: signal following `online` / `offline`; `true` on the server.\n * - `onReturn()`: a callback for the page becoming visible after a real absence.\n *\n * @example\n * ```ts\n * private readonly platform = inject(WrPlatform);\n * if (this.platform.isBrowser) {\n * localStorage.setItem('theme', 'dark');\n * }\n *\n * protected readonly dark = this.platform.prefersDark;\n * ```\n *\n * @see https://ngwr.dev/reference/services/platform\n */\n@Service()\nexport class WrPlatform {\n private readonly destroyRef = inject(DestroyRef);\n private readonly doc = inject(DOCUMENT);\n\n readonly isBrowser = isPlatformBrowser(inject(PLATFORM_ID));\n readonly isServer = !this.isBrowser;\n readonly userAgent: string | null = this.isBrowser ? (this.doc.defaultView?.navigator?.userAgent ?? null) : null;\n\n private readonly returnListeners = new Set<ReturnListener>();\n // Above `pageVisible`, whose initializer sets it when the page boots hidden.\n private hiddenSince: number | null = null;\n\n readonly prefersDark: Signal<boolean> = this.mediaSignal('(prefers-color-scheme: dark)');\n readonly prefersReducedMotion: Signal<boolean> = this.mediaSignal('(prefers-reduced-motion: reduce)');\n\n /** Whether the page is visible: `document.visibilityState` is not `hidden`. `true` on the server. */\n readonly pageVisible: Signal<boolean> = this.visibilitySignal();\n /** Whether the browser reports a network: `navigator.onLine`. `true` on the server. */\n readonly online: Signal<boolean> = this.onlineSignal();\n\n /**\n * Calls `callback` when the page becomes visible again after being hidden\n * for at least `after` ms (one minute by default): the user came back from\n * a meeting, a lunch, a closed lid. A quick flick to another tab and back\n * fires nothing. Only visibility counts: a network that comes back while\n * the page stays visible is read from `online`.\n *\n * Needs an injection context and stops with it. Returns a function that\n * stops it early.\n *\n * @example\n * ```ts\n * constructor() {\n * inject(WrPlatform).onReturn(() => this.users.reload(), { after: 30_000 });\n * }\n * ```\n *\n * @param callback - Runs once per return, after the threshold.\n * @param options - `after`, the threshold in ms.\n * @returns A function that stops listening early.\n */\n onReturn(callback: () => void, options: WrReturnOptions = {}): () => void {\n const owner = inject(DestroyRef);\n const listener: ReturnListener = { after: options.after ?? RETURN_AFTER, callback };\n this.returnListeners.add(listener);\n const stop = (): void => {\n this.returnListeners.delete(listener);\n };\n owner.onDestroy(stop);\n return stop;\n }\n\n private mediaSignal(query: string): Signal<boolean> {\n if (!this.isBrowser || !this.doc.defaultView?.matchMedia) return signal(false).asReadonly();\n const mql = this.doc.defaultView.matchMedia(query);\n const sig = signal(mql.matches);\n const handler = (event: MediaQueryListEvent): void => sig.set(event.matches);\n mql.addEventListener('change', handler);\n this.destroyRef.onDestroy(() => mql.removeEventListener('change', handler));\n return sig.asReadonly();\n }\n\n private visibilitySignal(): Signal<boolean> {\n if (!this.isBrowser) return signal(true).asReadonly();\n const visible = (): boolean => this.doc.visibilityState !== 'hidden';\n const sig = signal(visible());\n if (!sig()) this.hiddenSince = Date.now();\n const handler = (): void => {\n const next = visible();\n sig.set(next);\n if (!next) {\n this.hiddenSince ??= Date.now();\n return;\n }\n if (this.hiddenSince === null) return;\n const away = Date.now() - this.hiddenSince;\n this.hiddenSince = null;\n for (const { after, callback } of this.returnListeners) {\n if (away >= after) callback();\n }\n };\n this.doc.addEventListener('visibilitychange', handler);\n this.destroyRef.onDestroy(() => this.doc.removeEventListener('visibilitychange', handler));\n return sig.asReadonly();\n }\n\n private onlineSignal(): Signal<boolean> {\n const view = this.isBrowser ? this.doc.defaultView : null;\n if (!view) return signal(true).asReadonly();\n const sig = signal(view.navigator?.onLine ?? true);\n const handler = (event: Event): void => sig.set(event.type === 'online');\n view.addEventListener('online', handler);\n view.addEventListener('offline', handler);\n this.destroyRef.onDestroy(() => {\n view.removeEventListener('online', handler);\n view.removeEventListener('offline', handler);\n });\n return sig.asReadonly();\n }\n}\n\nexport type { WrReturnOptions };\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 { DOCUMENT, isPlatformBrowser } from '@angular/common';\nimport { PLATFORM_ID, Service, inject } from '@angular/core';\n\n/** Impact weight for {@link WrHaptics.impact}. */\ntype WrHapticImpact = 'light' | 'medium' | 'heavy';\n\n/**\n * Vibration patterns (ms, or `[buzz, pause, buzz, …]`) behind the semantic\n * presets — loosely modelled on iOS's impact / notification feedback.\n */\nconst PATTERNS = {\n light: 10,\n medium: 20,\n heavy: 40,\n selection: 5,\n success: [15, 60, 30],\n warning: [30, 40, 30],\n error: [40, 60, 40, 60, 40],\n} as const;\n\n/**\n * SSR-safe wrapper around the Vibration API for tactile feedback on touch\n * devices. Semantic presets (`impact`, `selection`, `success`, `warning`,\n * `error`) map to sensible vibration patterns so call sites stay readable.\n *\n * Every method is a no-op — returning `false` — when there is no support:\n * on the server, in browsers without `navigator.vibrate`, and notably on\n * **iOS Safari**, which does not expose the Vibration API at all (its\n * haptics are native-only). Check {@link supported} to branch UI on it.\n *\n * Haptics are best paired with a real user gesture (tap) — some browsers\n * ignore `vibrate()` calls that aren't triggered by one. This service does\n * not gate on `prefers-reduced-motion`; read {@link WrPlatform.prefersReducedMotion}\n * at the call site if you want to suppress feedback for those users.\n *\n * @example\n * ```ts\n * private readonly haptics = inject(WrHaptics);\n *\n * onDelete(): void {\n * this.haptics.warning(); // buzz before a destructive confirm\n * }\n *\n * onToggle(): void {\n * this.haptics.selection(); // subtle tick on a switch / segmented change\n * }\n * ```\n *\n * @see https://ngwr.dev/reference/services/platform\n */\n@Service()\nexport class WrHaptics {\n private readonly isBrowser = isPlatformBrowser(inject(PLATFORM_ID));\n private readonly nav = this.isBrowser ? (inject(DOCUMENT).defaultView?.navigator ?? null) : null;\n\n /** Whether the Vibration API is available (browser + `navigator.vibrate`). */\n readonly supported: boolean = !!this.nav && typeof this.nav.vibrate === 'function';\n\n /**\n * Fire a raw vibration pattern — a single duration in ms, or an alternating\n * `[buzz, pause, buzz, …]` array. Returns whether it was dispatched; passing\n * `0` / `[]` cancels any ongoing vibration.\n */\n vibrate(pattern: number | readonly number[]): boolean {\n if (!this.supported) return false;\n try {\n // `VibratePattern` is `number | number[]`; readonly arrays are accepted\n // at runtime, so clone to satisfy the mutable-array signature.\n return this.nav!.vibrate(typeof pattern === 'number' ? pattern : [...pattern]);\n } catch {\n return false;\n }\n }\n\n /** A physical \"tap\" — `light`, `medium` (default), or `heavy`. */\n impact(strength: WrHapticImpact = 'medium'): boolean {\n return this.vibrate(PATTERNS[strength]);\n }\n\n /** A subtle tick for a discrete change (switch, segmented, stepper). */\n selection(): boolean {\n return this.vibrate(PATTERNS.selection);\n }\n\n /** A confirming pulse for a completed action. */\n success(): boolean {\n return this.vibrate(PATTERNS.success);\n }\n\n /** A cautioning pulse before a risky or destructive action. */\n warning(): boolean {\n return this.vibrate(PATTERNS.warning);\n }\n\n /** A buzzing pulse for a failure or rejected action. */\n error(): boolean {\n return this.vibrate(PATTERNS.error);\n }\n\n /** Cancel any in-progress vibration. */\n stop(): void {\n this.vibrate(0);\n }\n}\n\nexport type { WrHapticImpact };\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 {\n DestroyRef,\n type WritableResource,\n Service,\n assertInInjectionContext,\n effect,\n inject,\n isDevMode,\n untracked,\n} from '@angular/core';\n\nimport { WrPlatform } from './wr-platform';\n\ninterface PollEntry {\n readonly resource: WritableResource<unknown>;\n readonly intervalMs: number;\n /** When the resource last had its turn, due or skipped. */\n last: number;\n}\n\n/**\n * The one timer behind every {@link wrPoll}: a `setTimeout` aimed at the\n * earliest due resource, re-aimed after each tick, so two resources on\n * different intervals share it. Cleared while the page is hidden and while\n * nothing polls; never created on the server.\n */\n@Service()\nclass WrPollTicker {\n private readonly platform = inject(WrPlatform);\n private readonly entries = new Set<PollEntry>();\n private timer: ReturnType<typeof setTimeout> | null = null;\n\n constructor() {\n if (!this.platform.isBrowser) return;\n effect(() => {\n if (this.platform.pageVisible()) untracked(() => this.tick());\n else this.clear();\n });\n }\n\n add(entry: PollEntry): () => void {\n if (!this.platform.isBrowser) return () => undefined;\n this.entries.add(entry);\n this.schedule();\n return () => {\n this.entries.delete(entry);\n this.schedule();\n };\n }\n\n private tick(): void {\n const now = Date.now();\n for (const entry of this.entries) {\n if (now - entry.last < entry.intervalMs) continue;\n // A skipped turn is spent too: the resource waits a full interval again.\n entry.last = now;\n if (!untracked(entry.resource.isLoading)) entry.resource.reload();\n }\n this.schedule();\n }\n\n private schedule(): void {\n this.clear();\n if (this.entries.size === 0 || !untracked(this.platform.pageVisible)) return;\n let due = Infinity;\n for (const entry of this.entries) due = Math.min(due, entry.last + entry.intervalMs);\n this.timer = setTimeout(() => this.tick(), Math.max(0, due - Date.now()));\n }\n\n private clear(): void {\n if (this.timer === null) return;\n clearTimeout(this.timer);\n this.timer = null;\n }\n}\n\n/**\n * Reloads a resource every `intervalMs` while the page is visible, on one\n * timer shared by every polled resource in the app. Takes `resource()`,\n * `rxResource()` and `httpResource()` alike.\n *\n * - The tab goes hidden: polling pauses. It comes back: a resource overdue\n * by its interval reloads once, not once per missed turn.\n * - A resource still loading or reloading is skipped on its turn and waits\n * a full interval again, so a slow request never piles up.\n * - A resource in the `error` state keeps polling: that is how it recovers.\n * - On the server nothing is scheduled, so prerender never waits on it.\n *\n * Needs an injection context and stops with it.\n *\n * @example\n * ```ts\n * readonly orders = httpResource<Order[]>(() => '/api/orders');\n *\n * constructor() {\n * wrPoll(this.orders, 15_000);\n * }\n * ```\n *\n * @param resource - The resource to reload.\n * @param intervalMs - How often, in ms. Must be positive and finite: anything\n * else throws in dev mode and polls nothing in production.\n */\nexport function wrPoll<T>(resource: WritableResource<T>, intervalMs: number): void {\n assertInInjectionContext(wrPoll);\n if (!(intervalMs > 0) || !Number.isFinite(intervalMs)) {\n if (isDevMode()) throw new Error(`wrPoll: intervalMs must be a positive number, got ${String(intervalMs)}`);\n // Never reaches the ticker: its timer would re-arm at 0 ms for ever.\n return;\n }\n const stop = inject(WrPollTicker).add({ resource, intervalMs, last: Date.now() });\n inject(DestroyRef).onDestroy(stop);\n}\n"],"mappings":";;;;;;;;;AAsBA,MAAM,eAAe;AA4BrB,IAAa,aAAb,MAAa,WAAU;CACJ,aAAa,OAAO,UAAU;CAC9B,MAAM,OAAOA,UAAQ;CAE7B,YAAY,kBAAkB,OAAO,WAAW,CAAC;CACjD,WAAW,CAAC,KAAK;CACjB,YAA2B,KAAK,YAAa,KAAK,IAAI,aAAa,WAAW,aAAa,OAAQ;CAE3F,kCAAkB,IAAI,IAAG;CAElC,cAA6B;CAE5B,cAA+B,KAAK,YAAY,8BAA8B;CAC9E,uBAAwC,KAAK,YAAY,kCAAkC;CAG3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,MAAA,Q;;;AA6ED,SAAgB,OAAU,UAA+B,YAAkB;CACzE,yBAAyB,MAAM;CAC/B,IAAI,EAAE,aAAa,MAAM,CAAC,OAAO,SAAS,UAAU,GAAG;EACrD,IAAI,UAAS,GAAI,MAAM,IAAI,MAAM,qDAAqD,OAAO,UAAU,GAAG;EAE1G;CACF;CACA,MAAM,OAAO,OAAO,YAAY,CAAC,CAAC,IAAI;EAAE;EAAU;EAAY,MAAM,KAAK,IAAG;CAAE,CAAE;CAChF,OAAO,UAAU,CAAC,CAAC,UAAU,IAAI;AACnC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as i0 from "@angular/core";
|
|
2
2
|
import { Component, DestroyRef, Directive, ElementRef, Injector, ViewContainerRef, ViewEncapsulation, inject, input, output, signal } from "@angular/core";
|
|
3
|
-
import {
|
|
3
|
+
import { wrCheckStyles, wrRestoreFocus, wrToClassList } from "ngwr/utils";
|
|
4
4
|
import { useI18nText } from "ngwr/i18n";
|
|
5
5
|
import { Directionality } from "@angular/cdk/bidi";
|
|
6
6
|
import { WrButton } from "ngwr/button";
|
|
@@ -262,7 +262,8 @@ var WrPopconfirm = class WrPopconfirm {
|
|
|
262
262
|
scrollStrategies = inject(ScrollStrategyOptions);
|
|
263
263
|
injector = inject(Injector);
|
|
264
264
|
destroyRef = inject(DestroyRef);
|
|
265
|
-
|
|
265
|
+
openState = signal(false, ...ngDevMode ? [{ debugName: "openState" }] : /* istanbul ignore next */ []);
|
|
266
|
+
isOpen = this.openState.asReadonly();
|
|
266
267
|
overlayRef = null;
|
|
267
268
|
uid = ++popconfirmUid;
|
|
268
269
|
panelId = `wr-popconfirm-${this.uid}`;
|
|
@@ -283,7 +284,7 @@ var WrPopconfirm = class WrPopconfirm {
|
|
|
283
284
|
this.overlayRef = this.overlay.create({
|
|
284
285
|
positionStrategy,
|
|
285
286
|
scrollStrategy: this.scrollStrategies.reposition(),
|
|
286
|
-
panelClass:
|
|
287
|
+
panelClass: wrToClassList("wr-popconfirm-overlay", this.panelClass())
|
|
287
288
|
});
|
|
288
289
|
wrFollowDirection(this.overlayRef, this.dir, this.injector, (direction) => positionStrategy.withPositions(wrMirrorOffsets(positions, direction === "rtl")));
|
|
289
290
|
const pane = this.overlayRef.overlayElement;
|
|
@@ -303,7 +304,7 @@ var WrPopconfirm = class WrPopconfirm {
|
|
|
303
304
|
pane.querySelector(".wr-popconfirm__actions wr-btn")?.focus();
|
|
304
305
|
pane.addEventListener("keydown", this.onPaneKeydown);
|
|
305
306
|
pane.addEventListener("focusout", this.onPaneFocusOut);
|
|
306
|
-
this.
|
|
307
|
+
this.openState.set(true);
|
|
307
308
|
ref.instance.confirmed.subscribe(() => {
|
|
308
309
|
this.confirmed.emit();
|
|
309
310
|
this.close();
|
|
@@ -336,7 +337,7 @@ var WrPopconfirm = class WrPopconfirm {
|
|
|
336
337
|
pane.removeEventListener("focusout", this.onPaneFocusOut);
|
|
337
338
|
this.overlayRef.dispose();
|
|
338
339
|
this.overlayRef = null;
|
|
339
|
-
this.
|
|
340
|
+
this.openState.set(false);
|
|
340
341
|
if (returnFocus) wrRestoreFocus(this.host.nativeElement, this.focusMonitor);
|
|
341
342
|
}
|
|
342
343
|
onPaneKeydown = (event) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ngwr-popconfirm.mjs","names":[],"sources":["../../../projects/lib/popconfirm/popconfirm-panel.ts","../../../projects/lib/popconfirm/popconfirm-panel.html","../../../projects/lib/popconfirm/types/popconfirm-position.ts","../../../projects/lib/popconfirm/popconfirm.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 { Component, ViewEncapsulation, input, output } from '@angular/core';\n\nimport { WrButton } from 'ngwr/button';\nimport type { WrColor } from 'ngwr/theme';\nimport { wrCheckStyles } from 'ngwr/utils';\n\n/**\n * Confirmation panel rendered inside the popconfirm overlay. Not part\n * of the public template API — use `[wrPopconfirm]` instead.\n *\n * @internal\n */\n@Component({\n selector: 'wr-popconfirm',\n templateUrl: './popconfirm-panel.html',\n encapsulation: ViewEncapsulation.None,\n host: { class: 'wr-popconfirm' },\n imports: [WrButton],\n})\nexport class WrPopconfirmPanel {\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('popconfirm');\n }\n\n readonly message = input.required<string>();\n\n /** Id the anchoring directive points `aria-describedby` at. */\n readonly messageId = input<string | null>(null);\n readonly confirmText = input<string>('Confirm');\n readonly cancelText = input<string>('Cancel');\n readonly confirmColor = input<WrColor>('primary');\n\n readonly confirmed = output<void>();\n readonly cancelled = output<void>();\n}\n","<p class=\"wr-popconfirm__message\" [attr.id]=\"messageId()\">{{ message() }}</p>\n\n<div class=\"wr-popconfirm__actions\">\n <wr-btn class=\"wr-popconfirm__action wr-popconfirm__action--cancel\" size=\"sm\" (click)=\"cancelled.emit()\">\n {{ cancelText() }}\n </wr-btn>\n <wr-btn\n class=\"wr-popconfirm__action wr-popconfirm__action--confirm\"\n size=\"sm\"\n [color]=\"confirmColor()\"\n (click)=\"confirmed.emit()\"\n >\n {{ confirmText() }}\n </wr-btn>\n</div>\n","/**\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 type { ConnectedPosition } from '@angular/cdk/overlay';\n\nexport type WrPopconfirmPosition = 'top' | 'bottom' | 'left' | 'right';\n\n/**\n * The CDK geometry for each placement — one position each. The 8px offset is\n * the gap between the trigger and the panel, the same one `wr-popover` keeps.\n *\n * @internal\n */\nexport const WR_POPCONFIRM_POSITIONS: Record<WrPopconfirmPosition, ConnectedPosition> = {\n top: { originX: 'center', originY: 'top', overlayX: 'center', overlayY: 'bottom', offsetY: -8 },\n bottom: { originX: 'center', originY: 'bottom', overlayX: 'center', overlayY: 'top', offsetY: 8 },\n left: { originX: 'start', originY: 'center', overlayX: 'end', overlayY: 'center', offsetX: -8 },\n right: { originX: 'end', originY: 'center', overlayX: 'start', overlayY: 'center', offsetX: 8 },\n};\n\n/**\n * What each placement may flip to when it does not fit, best first — the chains\n * `wr-popover` uses for the same four sides, for the same reasons. The requested\n * placement leads, so a panel that fits never moves; a side placement may also\n * fall below or above, because on a phone neither side of a mid-page trigger has\n * the room.\n *\n * Each list used to hold ONE position, with `withPush(true)` and nothing to fall\n * back to. A `top` panel opened 60px under the top of a 1440×900 viewport was\n * pushed back down over its own trigger, by 20px, and a `right` panel on a 390px\n * phone ran off the edge with its Confirm button clipped — the panel covering the\n * control it was asking about, while the docs said it flips.\n *\n * @internal\n */\nexport const WR_POPCONFIRM_FALLBACKS: Record<WrPopconfirmPosition, readonly WrPopconfirmPosition[]> = {\n top: ['top', 'bottom'],\n bottom: ['bottom', 'top'],\n left: ['left', 'right', 'bottom', 'top'],\n right: ['right', 'left', 'bottom', 'top'],\n};\n\n/**\n * The list `withPositions()` wants, every link tagged with the pane class of the\n * side it puts the panel on, so the arrow (`.wr-popconfirm-overlay--<side>`)\n * follows a flip. The CDK applies a position's own `panelClass` when it lands on\n * it and clears it on the next one; the gap is an offset rather than padding, so\n * taking the class off before it measures changes nothing.\n *\n * @internal\n */\nexport function wrPopconfirmPositions(position: WrPopconfirmPosition): ConnectedPosition[] {\n return WR_POPCONFIRM_FALLBACKS[position].map(name => ({\n ...WR_POPCONFIRM_POSITIONS[name],\n panelClass: `wr-popconfirm-overlay--${name}`,\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 { FocusMonitor } from '@angular/cdk/a11y';\nimport { Directionality } from '@angular/cdk/bidi';\nimport { type OverlayRef, ScrollStrategyOptions } from '@angular/cdk/overlay';\nimport { ComponentPortal } from '@angular/cdk/portal';\nimport {\n DestroyRef,\n Directive,\n ElementRef,\n Injector,\n ViewContainerRef,\n inject,\n input,\n output,\n signal,\n} from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\n\nimport { useI18nText } from 'ngwr/i18n';\nimport { WR_OVERLAY, WrOutsideClick, wrFollowDirection, wrMirrorOffsets } from 'ngwr/overlay';\nimport type { WrColor } from 'ngwr/theme';\nimport { toClassList, wrCheckStyles, type WrClassInput, wrRestoreFocus } from 'ngwr/utils';\n\nimport { WrPopconfirmPanel } from './popconfirm-panel';\nimport { type WrPopconfirmPosition, wrPopconfirmPositions } from './types';\n\n/**\n * How close, in px, `withPush` may park the panel to the viewport edge — the\n * `--wr-space-sm` step, and the value `wr-popover` uses.\n */\nconst VIEWPORT_MARGIN = 8;\n\n/**\n * Small \"Are you sure?\" panel anchored to its trigger. Fires `confirmed`\n * or `cancelled` and closes automatically. Built on CDK Overlay.\n *\n * @example\n * ```html\n * <wr-btn\n * color=\"danger\"\n * [wrPopconfirm]=\"'Delete this item?'\"\n * confirmColor=\"danger\"\n * confirmText=\"Delete\"\n * (confirmed)=\"remove()\"\n * >Delete</wr-btn>\n * ```\n *\n * @see https://ngwr.dev/reference/components/popconfirm\n */\nlet popconfirmUid = 0;\n\n@Directive({\n selector: '[wrPopconfirm]',\n exportAs: 'wrPopconfirm',\n host: {\n // Marks the trigger the way `[wrPopover]` and `[wrDropdown]` mark theirs. The\n // question is normally BOUND (`[wrPopconfirm]=\"question\"`), which leaves no\n // attribute in the DOM at all, so without this there is nothing to find a\n // trigger by once the panel is shut.\n class: 'wr-popconfirm-trigger',\n '(click)': 'toggle($event)',\n '[attr.aria-haspopup]': '\"dialog\"',\n '[attr.aria-expanded]': 'isOpen()',\n // Names the dialog this trigger opened, as every other overlay trigger in the\n // catalog does. `aria-haspopup=\"dialog\"` promises a dialog and `aria-expanded`\n // says it is showing; without the id, which one is left to guess.\n '[attr.aria-controls]': 'isOpen() ? panelId : null',\n },\n})\nexport class WrPopconfirm {\n /** Confirmation message. */\n readonly message = input.required<string>({ alias: 'wrPopconfirm' });\n\n /** Anchor side; the panel flips to another side when this one has no room. @default 'top' */\n readonly position = input<WrPopconfirmPosition>('top');\n\n /** Label for the confirm button. @default 'Confirm' */\n /** Confirm button text. Falls back to `popconfirm.confirm`. */\n readonly confirmText = input<string | null>(null);\n\n /** Label for the cancel button. @default 'Cancel' */\n /** Cancel button text. Falls back to `popconfirm.cancel`. */\n readonly cancelText = input<string | null>(null);\n\n /**\n * Accessible name of the confirmation dialog. `role=\"dialog\"` with no name\n * announces as a bare \"dialog\". Falls back to `popconfirm.label`.\n */\n readonly ariaLabel = input<string | null>(null);\n\n // The catalog has carried these translated for as long as the component has\n // existed; the labels were hard-coded English defaults, so a localized app got\n // English buttons with the right strings sitting one file away.\n private readonly resolvedConfirm = useI18nText(this.confirmText, 'popconfirm.confirm', 'Confirm');\n private readonly resolvedCancel = useI18nText(this.cancelText, 'popconfirm.cancel', 'Cancel');\n private readonly resolvedAriaLabel = useI18nText(this.ariaLabel, 'popconfirm.label', 'Confirm action');\n\n /** Color of the confirm button. @default 'primary' */\n readonly confirmColor = input<WrColor>('primary');\n\n /**\n * Extra CSS classes for the confirmation bubble's overlay pane.\n *\n * The pane is appended to the overlay container, not to this component, so\n * nothing in the consumer's own template encloses it and no descendant rule\n * written around the trigger can reach it. This input is the only per-instance\n * handle on it. A space-separated string works as well as an array.\n */\n readonly panelClass = input<WrClassInput>(null);\n\n /** Fires when the user clicks confirm. */\n readonly confirmed = output<void>();\n\n /** Fires when the user clicks cancel or dismisses the overlay. */\n readonly cancelled = output<void>();\n\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\n private readonly focusMonitor = inject(FocusMonitor);\n private readonly overlay = inject(WR_OVERLAY);\n private readonly dir = inject(Directionality, { optional: true });\n private readonly outsideClick = inject(WrOutsideClick);\n private readonly vcr = inject(ViewContainerRef);\n private readonly scrollStrategies = inject(ScrollStrategyOptions);\n private readonly injector = inject(Injector);\n private readonly destroyRef = inject(DestroyRef);\n\n /** @internal Public so the host bindings can read it. */\n readonly isOpen = signal(false);\n\n private overlayRef: OverlayRef | null = null;\n\n private readonly uid = ++popconfirmUid;\n\n /** @internal Public so the host binding can read it. */\n protected readonly panelId = `wr-popconfirm-${this.uid}`;\n\n private readonly messageId = `wr-popconfirm-message-${this.uid}`;\n\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('popconfirm');\n this.destroyRef.onDestroy(() => this.dispose());\n }\n\n /** @internal */\n protected toggle(event: MouseEvent): void {\n event.stopPropagation();\n if (this.overlayRef) {\n this.close();\n } else {\n this.open();\n }\n }\n\n open(): void {\n if (this.overlayRef) return;\n\n // Read ONCE, here, and mirror this list rather than the input: the side is\n // chosen at open and a later `position` write moves nothing, so a follower\n // that re-read the signal would let a direction flip quietly adopt a\n // position the panel never opened with.\n //\n // The list is a fallback CHAIN, each link tagged with its own\n // `wr-popconfirm-overlay--<side>` class, so the panel flips when the side\n // asked for has no room and the arrow names the side it landed on. The\n // viewport margin is `wr-popover`'s, for the same reason: without it a pushed\n // panel parks its border on the glass.\n const positions = wrPopconfirmPositions(this.position());\n\n const positionStrategy = this.overlay\n .position()\n .flexibleConnectedTo(this.host)\n .withPositions(wrMirrorOffsets(positions, this.isRtl()))\n .withPush(true)\n .withViewportMargin(VIEWPORT_MARGIN);\n\n this.overlayRef = this.overlay.create({\n positionStrategy,\n scrollStrategy: this.scrollStrategies.reposition(),\n panelClass: toClassList('wr-popconfirm-overlay', this.panelClass()),\n });\n\n // `isRtl()` above answered once, at `create()`, and so did the CDK's own\n // capture of the direction — neither is revisited if the app flips while the\n // question is still on screen. Both halves have to move: the `dir` on the\n // host, so `start` / `end` resolve to the other edge, and the mirrored list,\n // because `offsetX` is added to the final PHYSICAL x. Leave the list behind\n // and the 8px gap on `left` / `right` becomes an 8px overlap over the very\n // control the panel is asking about.\n wrFollowDirection(this.overlayRef, this.dir, this.injector, direction =>\n positionStrategy.withPositions(wrMirrorOffsets(positions, direction === 'rtl'))\n );\n\n // Non-modal by choice, like `wr-popover`: an outside click or Escape closes it,\n // so trapping focus would only make it harder to leave. It still needs a role, a\n // name and the question read out as its description.\n const pane = this.overlayRef.overlayElement;\n pane.id = this.panelId;\n pane.setAttribute('role', 'dialog');\n pane.setAttribute('aria-modal', 'false');\n pane.setAttribute('aria-label', this.resolvedAriaLabel());\n pane.setAttribute('aria-describedby', this.messageId);\n\n const portal = new ComponentPortal(WrPopconfirmPanel, this.vcr);\n const ref = this.overlayRef.attach(portal);\n ref.setInput('message', this.message());\n ref.setInput('messageId', this.messageId);\n ref.setInput('confirmText', this.resolvedConfirm());\n ref.setInput('cancelText', this.resolvedCancel());\n ref.setInput('confirmColor', this.confirmColor());\n // Render now rather than next frame: the buttons have to exist before focus can\n // move to one, and a deferred focus is the class of bug this repo keeps finding.\n ref.changeDetectorRef.detectChanges();\n // Focus has to enter the panel — the overlay container sits at the end of\n // `<body>`, so Tab from the trigger went to the next thing on the PAGE and the\n // only way to confirm was unreachable. Cancel first: the action being confirmed\n // is usually the destructive one.\n pane.querySelector<HTMLElement>('.wr-popconfirm__actions wr-btn')?.focus();\n // And it has to LEAVE with the panel: Tab past Confirm went on to the end of\n // `<body>` and Shift+Tab before Cancel to the foot of the page, each with the\n // question still on screen and `aria-expanded` still true. See `onPaneKeydown`.\n pane.addEventListener('keydown', this.onPaneKeydown);\n pane.addEventListener('focusout', this.onPaneFocusOut);\n this.isOpen.set(true);\n\n ref.instance.confirmed.subscribe(() => {\n this.confirmed.emit();\n this.close();\n });\n ref.instance.cancelled.subscribe(() => this.dismiss());\n\n this.outsideClick\n .outsidePointerEvents(this.overlayRef)\n .pipe(takeUntilDestroyed(this.destroyRef))\n .subscribe(event => {\n if (this.host.nativeElement.contains(event.target as Node)) return;\n this.dismiss();\n });\n\n this.overlayRef\n .keydownEvents()\n .pipe(takeUntilDestroyed(this.destroyRef))\n .subscribe(event => {\n if (event.key === 'Escape') {\n event.preventDefault();\n this.dismiss();\n }\n });\n }\n\n close(): void {\n this.dispose();\n }\n\n private dismiss(): void {\n if (!this.overlayRef) return;\n this.cancelled.emit();\n this.dispose();\n }\n\n private dispose(): void {\n if (!this.overlayRef) return;\n // Focus lives inside the panel while it is open, and removing the panel would\n // drop it to `<body>` — hand it back to the trigger instead, as `wr-dropdown`\n // does on Escape. Only when focus is still IN there: if the user has already\n // clicked elsewhere, taking it back would be stealing.\n const pane = this.overlayRef.overlayElement;\n const returnFocus = pane.contains(document.activeElement);\n // Before the dispose: Chromium fires `focusout` for a focused node as it is\n // removed, and the pane is about to be.\n pane.removeEventListener('keydown', this.onPaneKeydown);\n pane.removeEventListener('focusout', this.onPaneFocusOut);\n this.overlayRef.dispose();\n this.overlayRef = null;\n this.isOpen.set(false);\n if (returnFocus) wrRestoreFocus(this.host.nativeElement, this.focusMonitor);\n }\n\n /**\n * Tab off either end of the panel dismisses it and takes focus back to the\n * trigger — `wr-popover`'s disclosure behaviour, for a non-modal panel whose\n * DOM sits nowhere near its trigger. Leaving is a dismissal, so `cancelled`\n * fires, as it does for Escape and an outside click.\n *\n * Forward, the trigger is focused WITHOUT `preventDefault`, so the browser's\n * own Tab runs on from there and lands on whatever follows the trigger, where a\n * panel rendered in place would have let it go. Backward, the trigger itself is\n * the destination, so the default is stopped. The panel holds two stops, Cancel\n * and Confirm, in that order.\n */\n private readonly onPaneKeydown = (event: KeyboardEvent): void => {\n const pane = this.overlayRef?.overlayElement;\n if (!pane || event.key !== 'Tab' || event.defaultPrevented) return;\n const stops = [...pane.querySelectorAll<HTMLElement>('.wr-popconfirm__action')];\n const active = document.activeElement;\n if (event.shiftKey) {\n if (active !== stops[0]) return;\n event.preventDefault();\n } else if (active !== stops.at(-1)) {\n return;\n }\n wrRestoreFocus(this.host.nativeElement, this.focusMonitor);\n this.dismiss();\n };\n\n /**\n * Focus that leaves the panel by any other road (a click on something\n * focusable elsewhere) dismisses it too, and is left where it went. A `null`\n * destination is the window losing focus or a focused node being removed,\n * neither of which is leaving.\n */\n private readonly onPaneFocusOut = (event: FocusEvent): void => {\n const next = event.relatedTarget as Node | null;\n if (!next || this.holdsFocus(next)) return;\n this.dismiss();\n };\n\n /**\n * Whether focus on `node` still belongs to this panel: inside the pane, on the\n * trigger (a press there is about to toggle it), or in an overlay opened AFTER\n * this one — the stacking `wr-popover` and `WrOutsideClick` honour, so a\n * second panel raised by `open()` does not dismiss the first by taking focus.\n */\n private holdsFocus(node: Node): boolean {\n const ref = this.overlayRef;\n if (!ref) return false;\n if (ref.overlayElement.contains(node) || this.host.nativeElement.contains(node)) return true;\n const box = ref.hostElement;\n return (\n (box.parentElement?.contains(node) ?? false) &&\n // eslint-disable-next-line no-bitwise -- compareDocumentPosition answers with a bitmask\n (box.compareDocumentPosition(node) & Node.DOCUMENT_POSITION_FOLLOWING) !== 0\n );\n }\n\n /**\n * Whether the app reads right-to-left.\n *\n * Optional inject: `Directionality` is root-provided, so this is never null in\n * an app — but a bare `TestBed` that provides nothing should still get a\n * component that works, and defaulting to LTR is the honest fallback.\n */\n private isRtl(): boolean {\n return this.dir?.value === 'rtl';\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AA0BA,IAAa,oBAAb,MAAa,kBAAiB;CAC5B,cAAA;EACE,IAAI,OAAO,cAAc,eAAe,WAAW,cAAc,YAAY;CAC/E;CAES,UAAU,MAAM,SAAkB,GAAA,YAAA,CAAA,EAAA,WAAA,UAAA,CAAA,+BAAA,CAAA,CAAA;CAGlC,YAAY,MAAqB,MAAK,GAAA,YAAA,CAAA,EAAA,WAAA,YAAA,CAAA,+BAAA,CAAA,CAAA;CACtC,cAAc,MAAc,WAAU,GAAA,YAAA,CAAA,EAAA,WAAA,cAAA,CAAA,+BAAA,CAAA,CAAA;CACtC,aAAa,MAAc,UAAS,GAAA,YAAA,CAAA,EAAA,WAAA,aAAA,CAAA,+BAAA,CAAA,CAAA;CACpC,eAAe,MAAe,WAAU,GAAA,YAAA,CAAA,EAAA,WAAA,eAAA,CAAA,+BAAA,CAAA,CAAA;CAExC,YAAY,OAAM;CAClB,YAAY,OAAM;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EAAA,UAAA,CAAA,cAAA;EAAA,UAAA;CAAA,CAAA;;AAAZ,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAY,YAAA,CAAA;EAlBxB,MAAA;EAAU,MAAA,CAAA;GACT,UAAU;GACV,UAAU;GACV,MAAM;IAKJ,OAAO;IACP,WAAW;IACX,wBAAwB;IACxB,wBAAwB;IAIxB,wBAAwB;GACzB;EACF,CAAA"}
|
|
1
|
+
{"version":3,"file":"ngwr-popconfirm.mjs","names":[],"sources":["../../../projects/lib/popconfirm/popconfirm-panel.ts","../../../projects/lib/popconfirm/popconfirm-panel.html","../../../projects/lib/popconfirm/types/popconfirm-position.ts","../../../projects/lib/popconfirm/popconfirm.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 { Component, ViewEncapsulation, input, output } from '@angular/core';\n\nimport { WrButton } from 'ngwr/button';\nimport type { WrColor } from 'ngwr/theme';\nimport { wrCheckStyles } from 'ngwr/utils';\n\n/**\n * Confirmation panel rendered inside the popconfirm overlay. Not part\n * of the public template API — use `[wrPopconfirm]` instead.\n *\n * @internal\n */\n@Component({\n selector: 'wr-popconfirm',\n templateUrl: './popconfirm-panel.html',\n encapsulation: ViewEncapsulation.None,\n host: { class: 'wr-popconfirm' },\n imports: [WrButton],\n})\nexport class WrPopconfirmPanel {\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('popconfirm');\n }\n\n readonly message = input.required<string>();\n\n /** Id the anchoring directive points `aria-describedby` at. */\n readonly messageId = input<string | null>(null);\n readonly confirmText = input<string>('Confirm');\n readonly cancelText = input<string>('Cancel');\n readonly confirmColor = input<WrColor>('primary');\n\n readonly confirmed = output<void>();\n readonly cancelled = output<void>();\n}\n","<p class=\"wr-popconfirm__message\" [attr.id]=\"messageId()\">{{ message() }}</p>\n\n<div class=\"wr-popconfirm__actions\">\n <wr-btn class=\"wr-popconfirm__action wr-popconfirm__action--cancel\" size=\"sm\" (click)=\"cancelled.emit()\">\n {{ cancelText() }}\n </wr-btn>\n <wr-btn\n class=\"wr-popconfirm__action wr-popconfirm__action--confirm\"\n size=\"sm\"\n [color]=\"confirmColor()\"\n (click)=\"confirmed.emit()\"\n >\n {{ confirmText() }}\n </wr-btn>\n</div>\n","/**\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 type { ConnectedPosition } from '@angular/cdk/overlay';\n\nexport type WrPopconfirmPosition = 'top' | 'bottom' | 'left' | 'right';\n\n/**\n * The CDK geometry for each placement — one position each. The 8px offset is\n * the gap between the trigger and the panel, the same one `wr-popover` keeps.\n *\n * @internal\n */\nexport const WR_POPCONFIRM_POSITIONS: Record<WrPopconfirmPosition, ConnectedPosition> = {\n top: { originX: 'center', originY: 'top', overlayX: 'center', overlayY: 'bottom', offsetY: -8 },\n bottom: { originX: 'center', originY: 'bottom', overlayX: 'center', overlayY: 'top', offsetY: 8 },\n left: { originX: 'start', originY: 'center', overlayX: 'end', overlayY: 'center', offsetX: -8 },\n right: { originX: 'end', originY: 'center', overlayX: 'start', overlayY: 'center', offsetX: 8 },\n};\n\n/**\n * What each placement may flip to when it does not fit, best first — the chains\n * `wr-popover` uses for the same four sides, for the same reasons. The requested\n * placement leads, so a panel that fits never moves; a side placement may also\n * fall below or above, because on a phone neither side of a mid-page trigger has\n * the room.\n *\n * Each list used to hold ONE position, with `withPush(true)` and nothing to fall\n * back to. A `top` panel opened 60px under the top of a 1440×900 viewport was\n * pushed back down over its own trigger, by 20px, and a `right` panel on a 390px\n * phone ran off the edge with its Confirm button clipped — the panel covering the\n * control it was asking about, while the docs said it flips.\n *\n * @internal\n */\nexport const WR_POPCONFIRM_FALLBACKS: Record<WrPopconfirmPosition, readonly WrPopconfirmPosition[]> = {\n top: ['top', 'bottom'],\n bottom: ['bottom', 'top'],\n left: ['left', 'right', 'bottom', 'top'],\n right: ['right', 'left', 'bottom', 'top'],\n};\n\n/**\n * The list `withPositions()` wants, every link tagged with the pane class of the\n * side it puts the panel on, so the arrow (`.wr-popconfirm-overlay--<side>`)\n * follows a flip. The CDK applies a position's own `panelClass` when it lands on\n * it and clears it on the next one; the gap is an offset rather than padding, so\n * taking the class off before it measures changes nothing.\n *\n * @internal\n */\nexport function wrPopconfirmPositions(position: WrPopconfirmPosition): ConnectedPosition[] {\n return WR_POPCONFIRM_FALLBACKS[position].map(name => ({\n ...WR_POPCONFIRM_POSITIONS[name],\n panelClass: `wr-popconfirm-overlay--${name}`,\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 { FocusMonitor } from '@angular/cdk/a11y';\nimport { Directionality } from '@angular/cdk/bidi';\nimport { type OverlayRef, ScrollStrategyOptions } from '@angular/cdk/overlay';\nimport { ComponentPortal } from '@angular/cdk/portal';\nimport {\n DestroyRef,\n Directive,\n ElementRef,\n Injector,\n ViewContainerRef,\n inject,\n input,\n output,\n signal,\n} from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\n\nimport { useI18nText } from 'ngwr/i18n';\nimport { WR_OVERLAY, WrOutsideClick, wrFollowDirection, wrMirrorOffsets } from 'ngwr/overlay';\nimport type { WrColor } from 'ngwr/theme';\nimport { wrToClassList, wrCheckStyles, type WrClassInput, wrRestoreFocus } from 'ngwr/utils';\n\nimport { WrPopconfirmPanel } from './popconfirm-panel';\nimport { type WrPopconfirmPosition, wrPopconfirmPositions } from './types';\n\n/**\n * How close, in px, `withPush` may park the panel to the viewport edge — the\n * `--wr-space-sm` step, and the value `wr-popover` uses.\n */\nconst VIEWPORT_MARGIN = 8;\n\n/**\n * Small \"Are you sure?\" panel anchored to its trigger. Fires `confirmed`\n * or `cancelled` and closes automatically. Built on CDK Overlay.\n *\n * @example\n * ```html\n * <wr-btn\n * color=\"danger\"\n * [wrPopconfirm]=\"'Delete this item?'\"\n * confirmColor=\"danger\"\n * confirmText=\"Delete\"\n * (confirmed)=\"remove()\"\n * >Delete</wr-btn>\n * ```\n *\n * @see https://ngwr.dev/reference/components/popconfirm\n */\nlet popconfirmUid = 0;\n\n@Directive({\n selector: '[wrPopconfirm]',\n exportAs: 'wrPopconfirm',\n host: {\n // Marks the trigger the way `[wrPopover]` and `[wrDropdown]` mark theirs. The\n // question is normally BOUND (`[wrPopconfirm]=\"question\"`), which leaves no\n // attribute in the DOM at all, so without this there is nothing to find a\n // trigger by once the panel is shut.\n class: 'wr-popconfirm-trigger',\n '(click)': 'toggle($event)',\n '[attr.aria-haspopup]': '\"dialog\"',\n '[attr.aria-expanded]': 'isOpen()',\n // Names the dialog this trigger opened, as every other overlay trigger in the\n // catalog does. `aria-haspopup=\"dialog\"` promises a dialog and `aria-expanded`\n // says it is showing; without the id, which one is left to guess.\n '[attr.aria-controls]': 'isOpen() ? panelId : null',\n },\n})\nexport class WrPopconfirm {\n /** Confirmation message. */\n readonly message = input.required<string>({ alias: 'wrPopconfirm' });\n\n /** Anchor side; the panel flips to another side when this one has no room. @default 'top' */\n readonly position = input<WrPopconfirmPosition>('top');\n\n /** Label for the confirm button. @default 'Confirm' */\n /** Confirm button text. Falls back to `popconfirm.confirm`. */\n readonly confirmText = input<string | null>(null);\n\n /** Label for the cancel button. @default 'Cancel' */\n /** Cancel button text. Falls back to `popconfirm.cancel`. */\n readonly cancelText = input<string | null>(null);\n\n /**\n * Accessible name of the confirmation dialog. `role=\"dialog\"` with no name\n * announces as a bare \"dialog\". Falls back to `popconfirm.label`.\n */\n readonly ariaLabel = input<string | null>(null);\n\n // The catalog has carried these translated for as long as the component has\n // existed; the labels were hard-coded English defaults, so a localized app got\n // English buttons with the right strings sitting one file away.\n private readonly resolvedConfirm = useI18nText(this.confirmText, 'popconfirm.confirm', 'Confirm');\n private readonly resolvedCancel = useI18nText(this.cancelText, 'popconfirm.cancel', 'Cancel');\n private readonly resolvedAriaLabel = useI18nText(this.ariaLabel, 'popconfirm.label', 'Confirm action');\n\n /** Color of the confirm button. @default 'primary' */\n readonly confirmColor = input<WrColor>('primary');\n\n /**\n * Extra CSS classes for the confirmation bubble's overlay pane.\n *\n * The pane is appended to the overlay container, not to this component, so\n * nothing in the consumer's own template encloses it and no descendant rule\n * written around the trigger can reach it. This input is the only per-instance\n * handle on it. A space-separated string works as well as an array.\n */\n readonly panelClass = input<WrClassInput>(null);\n\n /** Fires when the user clicks confirm. */\n readonly confirmed = output<void>();\n\n /** Fires when the user clicks cancel or dismisses the overlay. */\n readonly cancelled = output<void>();\n\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\n private readonly focusMonitor = inject(FocusMonitor);\n private readonly overlay = inject(WR_OVERLAY);\n private readonly dir = inject(Directionality, { optional: true });\n private readonly outsideClick = inject(WrOutsideClick);\n private readonly vcr = inject(ViewContainerRef);\n private readonly scrollStrategies = inject(ScrollStrategyOptions);\n private readonly injector = inject(Injector);\n private readonly destroyRef = inject(DestroyRef);\n\n private readonly openState = signal(false);\n\n /** Whether the popconfirm is open. Read-only: `open()` and `close()` change it. */\n readonly isOpen = this.openState.asReadonly();\n\n private overlayRef: OverlayRef | null = null;\n\n private readonly uid = ++popconfirmUid;\n\n /** @internal Public so the host binding can read it. */\n protected readonly panelId = `wr-popconfirm-${this.uid}`;\n\n private readonly messageId = `wr-popconfirm-message-${this.uid}`;\n\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('popconfirm');\n this.destroyRef.onDestroy(() => this.dispose());\n }\n\n /** @internal */\n protected toggle(event: MouseEvent): void {\n event.stopPropagation();\n if (this.overlayRef) {\n this.close();\n } else {\n this.open();\n }\n }\n\n open(): void {\n if (this.overlayRef) return;\n\n // Read ONCE, here, and mirror this list rather than the input: the side is\n // chosen at open and a later `position` write moves nothing, so a follower\n // that re-read the signal would let a direction flip quietly adopt a\n // position the panel never opened with.\n //\n // The list is a fallback CHAIN, each link tagged with its own\n // `wr-popconfirm-overlay--<side>` class, so the panel flips when the side\n // asked for has no room and the arrow names the side it landed on. The\n // viewport margin is `wr-popover`'s, for the same reason: without it a pushed\n // panel parks its border on the glass.\n const positions = wrPopconfirmPositions(this.position());\n\n const positionStrategy = this.overlay\n .position()\n .flexibleConnectedTo(this.host)\n .withPositions(wrMirrorOffsets(positions, this.isRtl()))\n .withPush(true)\n .withViewportMargin(VIEWPORT_MARGIN);\n\n this.overlayRef = this.overlay.create({\n positionStrategy,\n scrollStrategy: this.scrollStrategies.reposition(),\n panelClass: wrToClassList('wr-popconfirm-overlay', this.panelClass()),\n });\n\n // `isRtl()` above answered once, at `create()`, and so did the CDK's own\n // capture of the direction — neither is revisited if the app flips while the\n // question is still on screen. Both halves have to move: the `dir` on the\n // host, so `start` / `end` resolve to the other edge, and the mirrored list,\n // because `offsetX` is added to the final PHYSICAL x. Leave the list behind\n // and the 8px gap on `left` / `right` becomes an 8px overlap over the very\n // control the panel is asking about.\n wrFollowDirection(this.overlayRef, this.dir, this.injector, direction =>\n positionStrategy.withPositions(wrMirrorOffsets(positions, direction === 'rtl'))\n );\n\n // Non-modal by choice, like `wr-popover`: an outside click or Escape closes it,\n // so trapping focus would only make it harder to leave. It still needs a role, a\n // name and the question read out as its description.\n const pane = this.overlayRef.overlayElement;\n pane.id = this.panelId;\n pane.setAttribute('role', 'dialog');\n pane.setAttribute('aria-modal', 'false');\n pane.setAttribute('aria-label', this.resolvedAriaLabel());\n pane.setAttribute('aria-describedby', this.messageId);\n\n const portal = new ComponentPortal(WrPopconfirmPanel, this.vcr);\n const ref = this.overlayRef.attach(portal);\n ref.setInput('message', this.message());\n ref.setInput('messageId', this.messageId);\n ref.setInput('confirmText', this.resolvedConfirm());\n ref.setInput('cancelText', this.resolvedCancel());\n ref.setInput('confirmColor', this.confirmColor());\n // Render now rather than next frame: the buttons have to exist before focus can\n // move to one, and a deferred focus is the class of bug this repo keeps finding.\n ref.changeDetectorRef.detectChanges();\n // Focus has to enter the panel — the overlay container sits at the end of\n // `<body>`, so Tab from the trigger went to the next thing on the PAGE and the\n // only way to confirm was unreachable. Cancel first: the action being confirmed\n // is usually the destructive one.\n pane.querySelector<HTMLElement>('.wr-popconfirm__actions wr-btn')?.focus();\n // And it has to LEAVE with the panel: Tab past Confirm went on to the end of\n // `<body>` and Shift+Tab before Cancel to the foot of the page, each with the\n // question still on screen and `aria-expanded` still true. See `onPaneKeydown`.\n pane.addEventListener('keydown', this.onPaneKeydown);\n pane.addEventListener('focusout', this.onPaneFocusOut);\n this.openState.set(true);\n\n ref.instance.confirmed.subscribe(() => {\n this.confirmed.emit();\n this.close();\n });\n ref.instance.cancelled.subscribe(() => this.dismiss());\n\n this.outsideClick\n .outsidePointerEvents(this.overlayRef)\n .pipe(takeUntilDestroyed(this.destroyRef))\n .subscribe(event => {\n if (this.host.nativeElement.contains(event.target as Node)) return;\n this.dismiss();\n });\n\n this.overlayRef\n .keydownEvents()\n .pipe(takeUntilDestroyed(this.destroyRef))\n .subscribe(event => {\n if (event.key === 'Escape') {\n event.preventDefault();\n this.dismiss();\n }\n });\n }\n\n close(): void {\n this.dispose();\n }\n\n private dismiss(): void {\n if (!this.overlayRef) return;\n this.cancelled.emit();\n this.dispose();\n }\n\n private dispose(): void {\n if (!this.overlayRef) return;\n // Focus lives inside the panel while it is open, and removing the panel would\n // drop it to `<body>` — hand it back to the trigger instead, as `wr-dropdown`\n // does on Escape. Only when focus is still IN there: if the user has already\n // clicked elsewhere, taking it back would be stealing.\n const pane = this.overlayRef.overlayElement;\n const returnFocus = pane.contains(document.activeElement);\n // Before the dispose: Chromium fires `focusout` for a focused node as it is\n // removed, and the pane is about to be.\n pane.removeEventListener('keydown', this.onPaneKeydown);\n pane.removeEventListener('focusout', this.onPaneFocusOut);\n this.overlayRef.dispose();\n this.overlayRef = null;\n this.openState.set(false);\n if (returnFocus) wrRestoreFocus(this.host.nativeElement, this.focusMonitor);\n }\n\n /**\n * Tab off either end of the panel dismisses it and takes focus back to the\n * trigger — `wr-popover`'s disclosure behaviour, for a non-modal panel whose\n * DOM sits nowhere near its trigger. Leaving is a dismissal, so `cancelled`\n * fires, as it does for Escape and an outside click.\n *\n * Forward, the trigger is focused WITHOUT `preventDefault`, so the browser's\n * own Tab runs on from there and lands on whatever follows the trigger, where a\n * panel rendered in place would have let it go. Backward, the trigger itself is\n * the destination, so the default is stopped. The panel holds two stops, Cancel\n * and Confirm, in that order.\n */\n private readonly onPaneKeydown = (event: KeyboardEvent): void => {\n const pane = this.overlayRef?.overlayElement;\n if (!pane || event.key !== 'Tab' || event.defaultPrevented) return;\n const stops = [...pane.querySelectorAll<HTMLElement>('.wr-popconfirm__action')];\n const active = document.activeElement;\n if (event.shiftKey) {\n if (active !== stops[0]) return;\n event.preventDefault();\n } else if (active !== stops.at(-1)) {\n return;\n }\n wrRestoreFocus(this.host.nativeElement, this.focusMonitor);\n this.dismiss();\n };\n\n /**\n * Focus that leaves the panel by any other road (a click on something\n * focusable elsewhere) dismisses it too, and is left where it went. A `null`\n * destination is the window losing focus or a focused node being removed,\n * neither of which is leaving.\n */\n private readonly onPaneFocusOut = (event: FocusEvent): void => {\n const next = event.relatedTarget as Node | null;\n if (!next || this.holdsFocus(next)) return;\n this.dismiss();\n };\n\n /**\n * Whether focus on `node` still belongs to this panel: inside the pane, on the\n * trigger (a press there is about to toggle it), or in an overlay opened AFTER\n * this one — the stacking `wr-popover` and `WrOutsideClick` honour, so a\n * second panel raised by `open()` does not dismiss the first by taking focus.\n */\n private holdsFocus(node: Node): boolean {\n const ref = this.overlayRef;\n if (!ref) return false;\n if (ref.overlayElement.contains(node) || this.host.nativeElement.contains(node)) return true;\n const box = ref.hostElement;\n return (\n (box.parentElement?.contains(node) ?? false) &&\n // eslint-disable-next-line no-bitwise -- compareDocumentPosition answers with a bitmask\n (box.compareDocumentPosition(node) & Node.DOCUMENT_POSITION_FOLLOWING) !== 0\n );\n }\n\n /**\n * Whether the app reads right-to-left.\n *\n * Optional inject: `Directionality` is root-provided, so this is never null in\n * an app — but a bare `TestBed` that provides nothing should still get a\n * component that works, and defaulting to LTR is the honest fallback.\n */\n private isRtl(): boolean {\n return this.dir?.value === 'rtl';\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AA0BA,IAAa,oBAAb,MAAa,kBAAiB;CAC5B,cAAA;EACE,IAAI,OAAO,cAAc,eAAe,WAAW,cAAc,YAAY;CAC/E;CAES,UAAU,MAAM,SAAkB,GAAA,YAAA,CAAA,EAAA,WAAA,UAAA,CAAA,+BAAA,CAAA,CAAA;CAGlC,YAAY,MAAqB,MAAK,GAAA,YAAA,CAAA,EAAA,WAAA,YAAA,CAAA,+BAAA,CAAA,CAAA;CACtC,cAAc,MAAc,WAAU,GAAA,YAAA,CAAA,EAAA,WAAA,cAAA,CAAA,+BAAA,CAAA,CAAA;CACtC,aAAa,MAAc,UAAS,GAAA,YAAA,CAAA,EAAA,WAAA,aAAA,CAAA,+BAAA,CAAA,CAAA;CACpC,eAAe,MAAe,WAAU,GAAA,YAAA,CAAA,EAAA,WAAA,eAAA,CAAA,+BAAA,CAAA,CAAA;CAExC,YAAY,OAAM;CAClB,YAAY,OAAM;CAdhB,OAAA,OAAA,GAAA,mBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,UAAA;EAAA,MAAA;EAAiB,MAAA,CAAA;EAAA,QAAA,GAAA,gBAAA;CAAA,CAAA;CAAjB,OAAA,OAAA,GAAA,qBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,MAAA;EAAiB,cAAA;EAAA,UAAA;EAAA,QAAA;GAAA,SAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;GAAA,WAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;GAAA,aAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IA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