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-image-cropper.mjs","names":[],"sources":["../../../projects/lib/image-cropper/image-cropper.ts","../../../projects/lib/image-cropper/image-cropper.html"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { coerceNumberProperty } from '@angular/cdk/coercion';\nimport {\n Component,\n DestroyRef,\n type ElementRef,\n ViewEncapsulation,\n computed,\n effect,\n inject,\n input,\n isDevMode,\n output,\n signal,\n viewChild,\n} from '@angular/core';\n\nimport { useI18nText } from 'ngwr/i18n';\nimport { clamp, randomId, wrCheckStyles } from 'ngwr/utils';\n\nimport type { WrCropHandle, WrCropRect, WrImageCropperStatus, WrImageLoadError, WrImageOutputType } from './types';\n\n/**\n * `[maxOutputSize]`'s transform. Anything that is not a positive, finite number —\n * `null`, an empty attribute, `0`, a typo — means \"no cap\" rather than a 1px export:\n * a bad config should cost resolution nobody asked to lose, not the whole image.\n */\nfunction coerceMaxOutputSize(value: unknown): number | null {\n if (value === null || value === undefined || value === '') return null;\n const n = coerceNumberProperty(value, Number.NaN);\n return Number.isFinite(n) && n > 0 ? n : null;\n}\n\n/**\n * Stands in for the consumer input `useI18nText` expects. None of this\n * component's three strings has a `*Label` input behind it — the catalog is the\n * override channel — so they share one empty override.\n */\nconst NO_OVERRIDE = signal<string | null>(null).asReadonly();\n\n/** Keyboard step in display pixels, and what Shift promotes it to. */\nconst KEY_STEP = 1;\nconst KEY_STEP_COARSE = 10;\n\ninterface RectPx {\n x: number;\n y: number;\n w: number;\n h: number;\n}\n\ninterface SizePx {\n w: number;\n h: number;\n}\n\n/** Distances, in CSS pixels, past each side of a box. */\ninterface SidesPx {\n left: number;\n top: number;\n right: number;\n bottom: number;\n}\n\nconst NO_SIDES: SidesPx = { left: 0, top: 0, right: 0, bottom: 0 };\n\n/**\n * The rect a resize gesture produces: a pure function of the rect the gesture started\n * from and the TOTAL pointer offset, so the same pointer position always gives the same\n * rect however the pointer got there.\n *\n * The anchor never moves. It is the edge or corner opposite the handle — for `se` the\n * top-left corner, for `e` the west edge's line. The old version clamped `x`, `y`, `w`\n * and `h` one at a time after deriving the second axis, so once the derived axis ran\n * into the image edge the rect slid AWAY from its anchor and, past the far bound, off\n * the image entirely.\n *\n * With a ratio the size is the largest along that ratio which fits from the anchor —\n * the smaller of the width-limited and height-limited sizes — and no smaller than both\n * minimums allow. Where the image cannot fit the minimum from this anchor, the bound\n * wins: a crop past the edge of the image is worse than one under the minimum.\n *\n * An edge handle with a ratio also sizes the axis it does not drive, and that axis has\n * the image's WHOLE extent to grow into: the rect stays centred on its old midline where\n * it can and slides along that axis only as far as it must to stay on the image. Capping\n * the size at twice the distance from the midline to the nearer side instead would leave\n * a square crop resting against the top edge unable to widen at all.\n */\nfunction resizeFrom(\n r: RectPx,\n handle: WrCropHandle,\n dx: number,\n dy: number,\n bounds: SizePx,\n min: SizePx,\n ratio: number | null\n): RectPx {\n const east = handle.includes('e');\n const west = handle.includes('w');\n const south = handle.includes('s');\n const north = handle.includes('n');\n const right = r.x + r.w;\n const bottom = r.y + r.h;\n\n if (!ratio || ratio <= 0) {\n let { x, y, w, h } = r;\n if (east) w = clamp(r.w + dx, min.w, bounds.w - r.x);\n if (west) {\n w = clamp(r.w - dx, min.w, right);\n x = right - w;\n }\n if (south) h = clamp(r.h + dy, min.h, bounds.h - r.y);\n if (north) {\n h = clamp(r.h - dy, min.h, bottom);\n y = bottom - h;\n }\n return { x, y, w, h };\n }\n\n // Room from the anchor to the image edge on each axis the handle drives; the whole\n // image on an axis it does not.\n const roomW = east ? bounds.w - r.x : west ? right : bounds.w;\n const roomH = south ? bounds.h - r.y : north ? bottom : bounds.h;\n // Corners follow the horizontal delta, as they always have; `n` / `s` the vertical one.\n const wanted = east ? r.w + dx : west ? r.w - dx : (south ? r.h + dy : r.h - dy) * ratio;\n const w = clamp(wanted, Math.max(min.w, min.h * ratio), Math.min(roomW, roomH * ratio));\n const h = w / ratio;\n\n return {\n x: east ? r.x : west ? right - w : clamp(r.x + r.w / 2 - w / 2, 0, bounds.w - w),\n y: south ? r.y : north ? bottom - h : clamp(r.y + r.h / 2 - h / 2, 0, bounds.h - h),\n w,\n h,\n };\n}\n\n/**\n * Image crop UI. Pass `[src]` (URL, `File`, or `Blob`); the user drags\n * the crop window or any of its eight handles. Optionally lock the crop\n * to a fixed `[aspectRatio]`.\n *\n * The crop window is also the one tab stop: arrow keys move it, Alt with an\n * arrow key resizes it, and Shift makes either step ten pixels instead of one.\n *\n * `(cropped)` fires after each drag end — or each run of arrow keys — with a\n * freshly-rendered `Blob` of the cropped region. For one-off reads use\n * `toBlob()` / `toDataUrl()`.\n *\n * A source the browser cannot decode fires `(loadError)` once, sets `status()` to\n * `'failed'` and puts `wr-image-cropper--failed` on the host. The component renders\n * no message of its own for it — what went wrong and what to do next is the host's\n * to say.\n *\n * The image is requested with `crossorigin=\"anonymous\"`, because a canvas will not\n * export pixels from another origin otherwise. A URL on another origin therefore has\n * to be served with `Access-Control-Allow-Origin`; one that is not fails to load and\n * fires `(loadError)`, where it used to show and then refuse every export.\n *\n * @example\n * ```html\n * <wr-image-cropper\n * [src]=\"file\"\n * [aspectRatio]=\"1\"\n * (cropped)=\"onBlob($event)\"\n * (loadError)=\"onUnreadable($event)\"\n * />\n * ```\n *\n * @see https://ngwr.dev/reference/components/image-cropper\n */\n@Component({\n selector: 'wr-image-cropper',\n templateUrl: './image-cropper.html',\n encapsulation: ViewEncapsulation.None,\n host: {\n class: 'wr-image-cropper',\n '[class.wr-image-cropper--failed]': \"status() === 'failed'\",\n },\n})\nexport class WrImageCropper {\n /** Image source — URL string, `File`, or `Blob`. */\n readonly src = input<string | File | Blob | null>(null);\n\n /** Aspect ratio (width / height). `null` = free. @default null */\n readonly aspectRatio = input<number | null>(null);\n\n /** Minimum crop width in display pixels. @default 32 */\n readonly minWidth = input(32, { transform: (v: unknown): number => Math.max(8, coerceNumberProperty(v, 32)) });\n\n /** Minimum crop height in display pixels. @default 32 */\n readonly minHeight = input(32, { transform: (v: unknown): number => Math.max(8, coerceNumberProperty(v, 32)) });\n\n /** Default output type for `(cropped)`. @default 'image/png' */\n readonly outputType = input<WrImageOutputType>('image/png');\n\n /** JPEG / WebP quality for `(cropped)` in [0, 1]. @default 0.92 */\n readonly outputQuality = input(0.92);\n\n /**\n * Longest side of the exported image, in pixels — for `(cropped)`, `toBlob()` and\n * `toDataUrl()` alike. A crop larger than this is scaled down to fit, keeping its\n * aspect ratio; a smaller one is exported as it is, never upscaled. The crop itself\n * — `cropRect()`, in source pixels — is not affected. `null` (or anything that is\n * not a positive number) exports at the source image's own resolution.\n * @default null\n */\n readonly maxOutputSize = input<number | null>(null, { transform: coerceMaxOutputSize });\n\n /** Emits a Blob after each drag end. */\n readonly cropped = output<Blob>();\n\n /**\n * Fires once when the browser cannot decode the current `src` — a format it does\n * not support, a broken file, a URL that fails. Nothing is rendered for it; show\n * your own message. A new `src` clears the failure.\n */\n readonly loadError = output<WrImageLoadError>();\n\n protected readonly imgEl = viewChild.required<ElementRef<HTMLImageElement>>('img');\n\n /** Resolved object URL for `src` (so File / Blob render in `<img>`). */\n protected readonly emptyText = useI18nText(NO_OVERRIDE, 'imageCropper.empty', 'No image');\n\n /** Accessible name of the crop window — the component's only tab stop. */\n protected readonly resolvedWindowLabel = useI18nText(NO_OVERRIDE, 'imageCropper.window', 'Crop region');\n\n /** The key model, referenced by the window's `aria-describedby`. */\n protected readonly resolvedKeyHelp = useI18nText(\n NO_OVERRIDE,\n 'imageCropper.keyHelp',\n 'Arrow keys move the crop. Hold Alt with an arrow key to resize it, and Shift for larger steps. ' +\n 'The crop is announced as left, top, width and height in image pixels.'\n );\n\n /** Id linking the crop window to the help text. Random rather than counted:\n * the crop UI only exists after a real image load, so it never prerenders. */\n protected readonly helpId = randomId('wr-image-cropper-help');\n\n /** Live-region text — written by the keyboard path only (see `onWindowKeydown`). */\n protected readonly announcement = signal<string>('');\n\n protected readonly objectUrl = signal<string | null>(null);\n\n /** Previous object URL we created — kept off-signal so the resolve\n * effect doesn't depend on its own writes (which would loop). */\n private previousObjectUrl: string | null = null;\n\n /** Natural (source) pixel dimensions. */\n protected readonly natural = signal<{ w: number; h: number }>({ w: 0, h: 0 });\n\n /** Display (rendered) pixel dimensions. */\n protected readonly display = signal<{ w: number; h: number }>({ w: 0, h: 0 });\n\n /** Crop rect in display coordinates. */\n protected readonly cropDisplay = signal<RectPx>({ x: 0, y: 0, w: 0, h: 0 });\n\n /** Watches the rendered image box — see `watchResize`. */\n private resizeObserver: ResizeObserver | null = null;\n\n /** Currently active drag handle. */\n private active: WrCropHandle | null = null;\n private startPointer: { x: number; y: number } = { x: 0, y: 0 };\n private startRect: RectPx = { x: 0, y: 0, w: 0, h: 0 };\n\n /** The element the live drag set pointer capture on, so the end releases that one. */\n private captureTarget: HTMLElement | null = null;\n\n /** The pointer the live drag belongs to. Every other pointer's events are ignored. */\n private pointerId: number | null = null;\n\n /** How far past each side of the crop the live resize was pressed — see `onPointerMove`. */\n private overhang: SidesPx = NO_SIDES;\n\n private readonly destroyRef = inject(DestroyRef);\n\n private readonly statusState = signal<WrImageCropperStatus>('empty');\n\n /**\n * Where the source stands: `'empty'`, `'loading'`, `'loaded'` or `'failed'`. Reset\n * to `'loading'` (or `'empty'`) whenever `src` changes, so a failure never outlives\n * the source that caused it.\n */\n readonly status = this.statusState.asReadonly();\n\n /** Resolved crop rect in natural (source) pixel coordinates. */\n readonly cropRect = computed<WrCropRect>(() => {\n const display = this.display();\n const natural = this.natural();\n const c = this.cropDisplay();\n if (display.w === 0 || display.h === 0) return { x: 0, y: 0, width: 0, height: 0 };\n const sx = natural.w / display.w;\n const sy = natural.h / display.h;\n return {\n x: Math.round(c.x * sx),\n y: Math.round(c.y * sy),\n width: Math.round(c.w * sx),\n height: Math.round(c.h * sy),\n };\n });\n\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('image-cropper');\n // Resolve the source into a usable URL the <img> can render.\n // We only read `src()` here — `previousObjectUrl` is a plain field, so\n // writing to `objectUrl` doesn't re-trigger this effect (and hang the\n // tab on file upload).\n effect(() => {\n const src = this.src();\n if (this.previousObjectUrl) {\n URL.revokeObjectURL(this.previousObjectUrl);\n this.previousObjectUrl = null;\n }\n // The crop is measured against the image that WAS showing, and `cropRect` is a\n // public signal a consumer can read at any moment. Left in place it kept\n // reporting a rect scaled to the previous image for the whole gap between a new\n // `src` and its load event — long enough to crop the wrong thing.\n this.resetGeometry();\n if (!src) {\n this.objectUrl.set(null);\n this.statusState.set('empty');\n return;\n }\n // A new source starts over: a failure belongs to the source that caused it, and\n // left in place it would mark a perfectly good next image as broken until the\n // browser answered for that one too.\n this.statusState.set('loading');\n if (typeof src === 'string') {\n this.objectUrl.set(src);\n } else {\n const url = URL.createObjectURL(src);\n this.previousObjectUrl = url;\n this.objectUrl.set(url);\n }\n });\n\n this.destroyRef.onDestroy(() => {\n if (this.previousObjectUrl) URL.revokeObjectURL(this.previousObjectUrl);\n this.resizeObserver?.disconnect();\n });\n }\n\n // Image load\n\n /**\n * Back to \"nothing measured yet\", which is also what an absent `src` means.\n *\n * `display` is the field that gates everything downstream — the crop UI renders on\n * `display().w > 0` and `cropRect` returns zeros without it — so it is the only one\n * a test can observe. The other two are reset for coherence: the resize observer\n * below also writes `display`, and left alone they would resurrect a crop measured\n * against the previous image (which is why `onResize` refuses to run on a zeroed\n * `display` — see there).\n */\n private resetGeometry(): void {\n this.natural.set({ w: 0, h: 0 });\n this.display.set({ w: 0, h: 0 });\n this.cropDisplay.set({ x: 0, y: 0, w: 0, h: 0 });\n }\n\n protected onImageLoad(): void {\n const img = this.imgEl().nativeElement;\n const rect = img.getBoundingClientRect();\n const display = { w: rect.width, h: rect.height };\n // Some SVGs and odd images report zero natural dimensions — fall back\n // to the rendered size so the crop math stays well-defined.\n const natural = {\n w: img.naturalWidth || display.w,\n h: img.naturalHeight || display.h,\n };\n this.statusState.set('loaded');\n this.natural.set(natural);\n this.display.set(display);\n this.cropDisplay.set(this.initialCrop(display));\n this.watchResize(img);\n }\n\n /**\n * The `<img>` could not decode its source.\n *\n * Before this handler existed a failed decode left the component exactly as it\n * looks while loading — an image with no size, no crop window, nothing emitted —\n * so a host had no way to tell \"still decoding\" from \"never going to\", and a user\n * who picked a `.heic` the browser cannot read saw an empty box and no reason.\n *\n * Once per source: `status` is reset by a new `src` and by nothing else, so a\n * second `error` for the same source says nothing new and is not re-emitted.\n */\n protected onImageError(): void {\n const url = this.objectUrl();\n if (!url || this.statusState() === 'failed') return;\n this.statusState.set('failed');\n this.resetGeometry();\n\n const src = this.src();\n const isBlob = typeof src !== 'string' && src !== null;\n this.loadError.emit({\n url,\n name: typeof File !== 'undefined' && src instanceof File ? src.name : null,\n type: isBlob ? src.type : null,\n size: isBlob ? src.size : null,\n });\n }\n\n /**\n * Keep `display` on the box the image is actually rendered at.\n *\n * The stylesheet sizes the image responsively — `max-width: 100%`,\n * `max-height: 70dvh`, `height: auto` — so the single measurement taken in the\n * `(load)` handler stops being true as soon as the container or the viewport\n * changes. Everything the user sees and touches is in DISPLAY pixels: the crop\n * window's inline `left` / `top` / `width` / `height`, the backdrop cut-out, and\n * the bounds `applyMove` / `applyResize` clamp against. Measured once, a narrowed\n * window leaves the crop painted past the edge of the image and draggable off it.\n *\n * Re-observed per load rather than once, because a new `src` may mount a new\n * `<img>`; the old observation would then be on a detached element.\n */\n private watchResize(el: HTMLImageElement): void {\n if (typeof ResizeObserver === 'undefined') return;\n this.resizeObserver?.disconnect();\n // Re-read the same way `onImageLoad` does rather than take the entry's\n // `contentRect`, so the two measurements can't disagree about the box.\n const ro = new ResizeObserver(() => this.onResize(el));\n ro.observe(el);\n this.resizeObserver = ro;\n }\n\n /**\n * Rescale the crop by however much the image did, so the user keeps the region\n * they picked instead of having it re-centred: `cropRect()` — the source-pixel\n * value a consumer acts on — comes out the same across the resize.\n */\n private onResize(el: HTMLImageElement): void {\n const previous = this.display();\n // Nothing measured yet, or measured and then dropped by `resetGeometry` while a\n // new `src` loads. There is no crop to carry over, and the load will measure.\n if (previous.w === 0 || previous.h === 0) return;\n const rect = el.getBoundingClientRect();\n // A hidden image (a closed tab, `display: none`) reports zeros. Scaling by that\n // would collapse the crop and there would be nothing to scale back from, so hold\n // the last real box until it is shown again.\n if (rect.width === 0 || rect.height === 0) return;\n if (rect.width === previous.w && rect.height === previous.h) return;\n\n const sx = rect.width / previous.w;\n const sy = rect.height / previous.h;\n const c = this.cropDisplay();\n this.display.set({ w: rect.width, h: rect.height });\n this.cropDisplay.set({ x: c.x * sx, y: c.y * sy, w: c.w * sx, h: c.h * sy });\n }\n\n /** Compute a sensible initial crop — centered, respecting aspectRatio. */\n private initialCrop(display: { w: number; h: number }): RectPx {\n const ratio = this.aspectRatio();\n let w = display.w * 0.6;\n let h = display.h * 0.6;\n if (ratio && ratio > 0) {\n const candidate = w / ratio;\n if (candidate > h) w = h * ratio;\n else h = w / ratio;\n }\n return {\n x: (display.w - w) / 2,\n y: (display.h - h) / 2,\n w,\n h,\n };\n }\n\n // Drag handlers\n\n protected readonly handles: readonly WrCropHandle[] = ['n', 's', 'e', 'w', 'ne', 'nw', 'se', 'sw'];\n\n protected onPointerDown(handle: WrCropHandle, event: PointerEvent): void {\n // Any pointerdown used to start a drag, so the right button moved the crop window and\n // a second finger could take over a drag already in progress.\n if (event.button !== 0 || !event.isPrimary) return;\n event.preventDefault();\n event.stopPropagation();\n this.active = handle;\n this.pointerId = event.pointerId;\n this.startPointer = { x: event.clientX, y: event.clientY };\n this.startRect = { ...this.cropDisplay() };\n this.captureTarget = event.currentTarget as HTMLElement;\n this.captureTarget.setPointerCapture(event.pointerId);\n this.overhang = handle === 'move' ? NO_SIDES : this.pastCrop(event);\n }\n\n /**\n * A resize ENDS when the pointer leaves the image, exactly as `pointerup` would end it:\n * the move that carried it out is applied — clamped to the image like any other — and\n * then the drag is over. Nothing after that resumes it or changes the crop, pointer\n * back over the image or not, until a new `pointerdown`. A move drag is not affected:\n * its size is fixed, so it simply rests against the edge.\n *\n * The move that leaves is applied rather than dropped because pointer moves are\n * SAMPLES. Dropped, a quick drag toward a corner would stop wherever its last sample\n * inside happened to fall — a single move from a handle to past the image would change\n * nothing at all — and even a slow one would stop a fraction of a pixel short of the\n * edge. A drag that leaves across one edge still ends there: heading for a corner at a\n * slant that crosses the bottom first, the crop's right edge stays where it was then.\n *\n * \"The image\" is the `<img>`'s own box — the bounds `applyMove` / `applyResize` clamp\n * the crop to — with its edges counting as inside, since the crop may reach them. The\n * box is re-measured on every move and compared with `clientX` / `clientY`: both are\n * viewport coordinates, so a scroll mid-drag cannot put them out of step. The moves\n * outside reach this handler at all only because the drag holds pointer capture.\n *\n * One allowance, fixed at `pointerdown`: the box is widened on each side by however far\n * past that side of the CROP the press landed — at most as far as the pressed handle\n * reaches past it. Half of an edge handle, and three quarters of a corner handle, lies\n * outside the crop, so a press there already has the pointer ahead of the edge it drags.\n * Measured without the allowance, that pointer would leave the image while the crop was\n * still short of the image's edge by the same distance, with nothing able to close the\n * gap; and a handle resting on the image's edge, pressed on its outer part, would begin\n * its drag already outside. A press on a handle's inner part widens nothing.\n */\n protected onPointerMove(event: PointerEvent): void {\n if (!this.active || event.pointerId !== this.pointerId) return;\n const dx = event.clientX - this.startPointer.x;\n const dy = event.clientY - this.startPointer.y;\n if (this.active === 'move') {\n this.applyMove(dx, dy);\n return;\n }\n this.applyResize(this.active, dx, dy);\n if (!this.withinImage(event)) this.onPointerUp(event);\n }\n\n /**\n * Ends the drag — for `pointerup`, `pointercancel`, a capture lost to something else,\n * and a resize whose pointer left the image. Once per drag: the capture released here\n * fires `lostpointercapture` afterwards, and by then there is nothing left to end.\n *\n * Only for the pointer that started it. A second finger is refused a drag of its own at\n * `pointerdown`, but its moves and its lifting reach these handlers all the same, and\n * would otherwise drive or end the first finger's drag.\n */\n protected onPointerUp(event: PointerEvent): void {\n if (!this.active || event.pointerId !== this.pointerId) return;\n const target = this.captureTarget;\n this.active = null;\n this.pointerId = null;\n this.captureTarget = null;\n this.overhang = NO_SIDES;\n // Asked first: a capture that is already gone has nothing to release, and releasing\n // one for a pointer that is no longer active throws.\n if (target?.hasPointerCapture(event.pointerId)) target.releasePointerCapture(event.pointerId);\n void this.emitCropped();\n }\n\n /** How far past each side of the crop window the pointer is, in CSS pixels. */\n private pastCrop(event: PointerEvent): SidesPx {\n const box = this.imgEl().nativeElement.getBoundingClientRect();\n const c = this.startRect;\n return {\n left: Math.max(0, box.left + c.x - event.clientX),\n top: Math.max(0, box.top + c.y - event.clientY),\n right: Math.max(0, event.clientX - (box.left + c.x + c.w)),\n bottom: Math.max(0, event.clientY - (box.top + c.y + c.h)),\n };\n }\n\n /** Whether the pointer is on the image, edges and the press's `overhang` included. */\n private withinImage(event: PointerEvent): boolean {\n const box = this.imgEl().nativeElement.getBoundingClientRect();\n const o = this.overhang;\n return (\n event.clientX >= box.left - o.left &&\n event.clientX <= box.right + o.right &&\n event.clientY >= box.top - o.top &&\n event.clientY <= box.bottom + o.bottom\n );\n }\n\n // Keyboard\n\n /** Whether a key has moved the crop since the last `keyup`. */\n private keyboardDirty = false;\n\n /**\n * The component's only keyboard path. Arrow keys move the crop window; Alt\n * with an arrow key resizes it from the east / south edge; Shift makes either\n * one ten display pixels instead of one — the coarse modifier `wr-slider`,\n * `wr-knob` and `wr-splitter` all use, which is why Alt and not Shift carries\n * the mode switch here.\n *\n * Nothing mirrors under `dir=\"rtl\"`: the image is not flipped and the window\n * is placed with a physical `left`, so ArrowLeft moves the crop visually left\n * in both directions.\n *\n * Both branches go through `applyMove` / `applyResize`, so the `aspectRatio`\n * lock, the `minWidth` / `minHeight` floors and the canvas bounds hold for a\n * keystroke exactly as they do for a drag. Those two measure from `startRect`\n * rather than from the live rect, so it is re-seeded per keystroke — a 1px\n * delta against the rect from the first press would make a held arrow stall\n * after one pixel instead of accumulating.\n */\n protected onWindowKeydown(event: KeyboardEvent): void {\n const step = event.shiftKey ? KEY_STEP_COARSE : KEY_STEP;\n let dx = 0;\n let dy = 0;\n switch (event.key) {\n case 'ArrowLeft':\n dx = -step;\n break;\n case 'ArrowRight':\n dx = step;\n break;\n case 'ArrowUp':\n dy = -step;\n break;\n case 'ArrowDown':\n dy = step;\n break;\n default:\n return;\n }\n\n event.preventDefault();\n this.startRect = { ...this.cropDisplay() };\n if (event.altKey) this.applyResize(dx !== 0 ? 'e' : 's', dx, dy);\n else this.applyMove(dx, dy);\n\n this.keyboardDirty = true;\n const c = this.cropRect();\n // Bare numbers on purpose — `resolvedKeyHelp` has already told the reader\n // what the four are, and a sentence here would be a translated string.\n this.announcement.set(`${c.x}, ${c.y}, ${c.width} × ${c.height}`);\n }\n\n /**\n * Emit once per gesture, not once per keystroke. A held arrow repeats its\n * keydown many times a second and each `emitCropped` renders a canvas and\n * encodes a Blob; `keyup` fires once when the run ends, which is the keyboard's\n * equivalent of the `pointerup` the drag path emits on.\n */\n protected onWindowKeyup(): void {\n if (!this.keyboardDirty) return;\n this.keyboardDirty = false;\n void this.emitCropped();\n }\n\n private applyMove(dx: number, dy: number): void {\n const display = this.display();\n const r = this.startRect;\n const next = {\n x: clamp(r.x + dx, 0, display.w - r.w),\n y: clamp(r.y + dy, 0, display.h - r.h),\n w: r.w,\n h: r.h,\n };\n this.cropDisplay.set(next);\n }\n\n private applyResize(handle: WrCropHandle, dx: number, dy: number): void {\n const min = { w: this.minWidth(), h: this.minHeight() };\n this.cropDisplay.set(resizeFrom(this.startRect, handle, dx, dy, this.display(), min, this.aspectRatio()));\n }\n\n // Public API\n\n /**\n * Render the current crop as a Blob. Rejects while `status()` is anything but\n * `'loaded'`, since there is no image to draw.\n */\n async toBlob(type: WrImageOutputType = this.outputType(), quality: number = this.outputQuality()): Promise<Blob> {\n const canvas = this.toCanvas();\n return new Promise<Blob>((resolve, reject) => {\n canvas.toBlob(\n blob => {\n if (blob) resolve(blob);\n else reject(new Error('toBlob returned null'));\n },\n type,\n quality\n );\n });\n }\n\n /**\n * Render the current crop as a data URL. Throws while `status()` is anything but\n * `'loaded'`, since there is no image to draw.\n */\n toDataUrl(type: WrImageOutputType = this.outputType(), quality: number = this.outputQuality()): string {\n return this.toCanvas().toDataURL(type, quality);\n }\n\n /** Re-emit the crop without waiting for a drag (e.g. after a programmatic change). */\n async refresh(): Promise<void> {\n await this.emitCropped();\n }\n\n // Internals\n\n /**\n * The exported image's pixel size: the crop in source pixels, scaled down so its\n * longer side fits `maxOutputSize`. `Math.min(1, …)` is the never-upscale rule — a\n * crop already inside the cap keeps its own size, which is also the whole of the\n * uncapped path.\n */\n private outputSize(c: WrCropRect): { width: number; height: number } {\n const cap = this.maxOutputSize();\n const longest = Math.max(c.width, c.height);\n const scale = cap === null || longest === 0 ? 1 : Math.min(1, cap / longest);\n return {\n width: Math.max(1, Math.round(c.width * scale)),\n height: Math.max(1, Math.round(c.height * scale)),\n };\n }\n\n private toCanvas(): HTMLCanvasElement {\n // Without this, no image threw NG0951 from the required `imgEl` query, and a\n // `'failed'` one the canvas's own complaint about a broken image: two internals\n // messages for one plain fact.\n const status = this.status();\n if (status !== 'loaded') {\n throw new Error(`[NGWR] <wr-image-cropper>: there is no loaded image to export (status \"${status}\").`);\n }\n const img = this.imgEl().nativeElement;\n const c = this.cropRect();\n const canvas = document.createElement('canvas');\n const size = this.outputSize(c);\n canvas.width = size.width;\n canvas.height = size.height;\n // The SOURCE rect stays the whole crop and the destination is the canvas, so a\n // capped export is the same region drawn smaller rather than a smaller region.\n const ctx = canvas.getContext('2d');\n if (ctx) ctx.drawImage(img, c.x, c.y, c.width, c.height, 0, 0, canvas.width, canvas.height);\n return canvas;\n }\n\n private async emitCropped(): Promise<void> {\n if (this.status() !== 'loaded') return;\n try {\n const blob = await this.toBlob();\n this.cropped.emit(blob);\n } catch (error) {\n // An image IS loaded, so a failure here is the browser refusing to encode it,\n // and `(cropped)` not firing has to be visible to the developer. It used to be\n // swallowed, which is how a tainted cross-origin canvas went unnoticed.\n if (isDevMode()) {\n // eslint-disable-next-line no-console -- dev-mode diagnostics\n console.warn('[NGWR] <wr-image-cropper>: the crop could not be encoded, so (cropped) did not fire.', error);\n }\n }\n }\n}\n","@if (objectUrl(); as url) {\n <div class=\"wr-image-cropper__canvas\">\n <!--\n `crossorigin` is what lets a URL on another origin be exported at all: an image\n fetched without it taints the canvas `toCanvas` draws into, even when the server\n sends CORS headers, and every export then throws a SecurityError. It is static\n so it is in place before `src` starts the request.\n -->\n <img\n #img\n class=\"wr-image-cropper__image\"\n crossorigin=\"anonymous\"\n [src]=\"url\"\n alt=\"\"\n draggable=\"false\"\n (load)=\"onImageLoad()\"\n (error)=\"onImageError()\"\n />\n\n @if (display().w > 0) {\n <!-- Semi-transparent backdrop with a cut-out for the crop window. -->\n <div\n class=\"wr-image-cropper__backdrop\"\n [style.clip-path]=\"`polygon(0 0, 100% 0, 100% 100%, 0 100%, 0 ${cropDisplay().y}px, ${cropDisplay().x}px ${cropDisplay().y}px, ${cropDisplay().x}px ${cropDisplay().y + cropDisplay().h}px, ${cropDisplay().x + cropDisplay().w}px ${cropDisplay().y + cropDisplay().h}px, ${cropDisplay().x + cropDisplay().w}px ${cropDisplay().y}px, 0 ${cropDisplay().y}px)`\"\n ></div>\n\n <!--\n Crop window — drag to move, with eight resize handles, and the ONE\n keyboard control the component has (see `onWindowKeydown`). The eight\n handles stay pointer-only and `aria-hidden`: eight extra tab stops per\n cropper would be hostile. The keys resize from the east and south edges\n only, so a west or north drag comes out as a resize plus a move rather\n than as one gesture.\n\n `role=\"group\"` rather than no role at all, because `aria-label` is\n prohibited on a roleless `<div>` and this needs a name; and rather than\n `role=\"application\"`, which would switch the reader out of its own\n browse mode for the whole subtree — far more than one rectangle is worth.\n -->\n <div\n class=\"wr-image-cropper__window\"\n role=\"group\"\n tabindex=\"0\"\n [attr.aria-label]=\"resolvedWindowLabel()\"\n [attr.aria-describedby]=\"helpId\"\n [style.left.px]=\"cropDisplay().x\"\n [style.top.px]=\"cropDisplay().y\"\n [style.width.px]=\"cropDisplay().w\"\n [style.height.px]=\"cropDisplay().h\"\n (pointerdown)=\"onPointerDown('move', $event)\"\n (pointermove)=\"onPointerMove($event)\"\n (pointerup)=\"onPointerUp($event)\"\n (pointercancel)=\"onPointerUp($event)\"\n (lostpointercapture)=\"onPointerUp($event)\"\n (keydown)=\"onWindowKeydown($event)\"\n (keyup)=\"onWindowKeyup()\"\n >\n @for (h of handles; track h) {\n <span\n aria-hidden=\"true\"\n [class]=\"`wr-image-cropper__handle wr-image-cropper__handle--${h}`\"\n (pointerdown)=\"onPointerDown(h, $event)\"\n (pointermove)=\"onPointerMove($event)\"\n (pointerup)=\"onPointerUp($event)\"\n (pointercancel)=\"onPointerUp($event)\"\n (lostpointercapture)=\"onPointerUp($event)\"\n ></span>\n }\n </div>\n\n <p class=\"wr-image-cropper__sr-only\" [id]=\"helpId\">{{ resolvedKeyHelp() }}</p>\n\n <!--\n The crop rect in SOURCE pixels, announced after a keyboard change only —\n a pointer drag already gives sighted feedback and would flood the region,\n and the initial crop is not news. Deliberately bare numbers: a sentence\n here would be a translated string the catalog does not carry, and the\n reader has just been told what the four numbers mean by `helpId`.\n -->\n <p class=\"wr-image-cropper__sr-only\" role=\"status\">{{ announcement() }}</p>\n }\n </div>\n} @else {\n <div class=\"wr-image-cropper__empty\">{{ emptyText() }}</div>\n}\n"],"mappings":";;;;;;;;;;;AAiCA,SAAS,oBAAoB,OAAc;CACzC,IAAI,UAAU,QAAQ,UAAU,UAAa,UA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,CAAA;EAAA,CAAA;EAAA,SAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,SAAA;EAAA,CAAA;EAAA,WAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,WAAA;EAAA,CAAA;EAAA,OAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,OAAK,EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;CAAA;AAAA,CAAA"}
|
|
1
|
+
{"version":3,"file":"ngwr-image-cropper.mjs","names":[],"sources":["../../../projects/lib/image-cropper/image-cropper.ts","../../../projects/lib/image-cropper/image-cropper.html"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { coerceNumberProperty } from '@angular/cdk/coercion';\nimport {\n Component,\n DestroyRef,\n type ElementRef,\n ViewEncapsulation,\n computed,\n effect,\n inject,\n input,\n isDevMode,\n output,\n signal,\n viewChild,\n} from '@angular/core';\n\nimport { useI18nText } from 'ngwr/i18n';\nimport { wrClamp, wrRandomId, wrCheckStyles } from 'ngwr/utils';\n\nimport type { WrCropHandle, WrCropRect, WrImageCropperStatus, WrImageLoadError, WrImageOutputType } from './types';\n\n/**\n * `[maxOutputSize]`'s transform. Anything that is not a positive, finite number —\n * `null`, an empty attribute, `0`, a typo — means \"no cap\" rather than a 1px export:\n * a bad config should cost resolution nobody asked to lose, not the whole image.\n */\nfunction coerceMaxOutputSize(value: unknown): number | null {\n if (value === null || value === undefined || value === '') return null;\n const n = coerceNumberProperty(value, Number.NaN);\n return Number.isFinite(n) && n > 0 ? n : null;\n}\n\n/**\n * Stands in for the consumer input `useI18nText` expects. None of this\n * component's three strings has a `*Label` input behind it — the catalog is the\n * override channel — so they share one empty override.\n */\nconst NO_OVERRIDE = signal<string | null>(null).asReadonly();\n\n/** Keyboard step in display pixels, and what Shift promotes it to. */\nconst KEY_STEP = 1;\nconst KEY_STEP_COARSE = 10;\n\ninterface RectPx {\n x: number;\n y: number;\n w: number;\n h: number;\n}\n\ninterface SizePx {\n w: number;\n h: number;\n}\n\n/** Distances, in CSS pixels, past each side of a box. */\ninterface SidesPx {\n left: number;\n top: number;\n right: number;\n bottom: number;\n}\n\nconst NO_SIDES: SidesPx = { left: 0, top: 0, right: 0, bottom: 0 };\n\n/**\n * The rect a resize gesture produces: a pure function of the rect the gesture started\n * from and the TOTAL pointer offset, so the same pointer position always gives the same\n * rect however the pointer got there.\n *\n * The anchor never moves. It is the edge or corner opposite the handle — for `se` the\n * top-left corner, for `e` the west edge's line. The old version clamped `x`, `y`, `w`\n * and `h` one at a time after deriving the second axis, so once the derived axis ran\n * into the image edge the rect slid AWAY from its anchor and, past the far bound, off\n * the image entirely.\n *\n * With a ratio the size is the largest along that ratio which fits from the anchor —\n * the smaller of the width-limited and height-limited sizes — and no smaller than both\n * minimums allow. Where the image cannot fit the minimum from this anchor, the bound\n * wins: a crop past the edge of the image is worse than one under the minimum.\n *\n * An edge handle with a ratio also sizes the axis it does not drive, and that axis has\n * the image's WHOLE extent to grow into: the rect stays centred on its old midline where\n * it can and slides along that axis only as far as it must to stay on the image. Capping\n * the size at twice the distance from the midline to the nearer side instead would leave\n * a square crop resting against the top edge unable to widen at all.\n */\nfunction resizeFrom(\n r: RectPx,\n handle: WrCropHandle,\n dx: number,\n dy: number,\n bounds: SizePx,\n min: SizePx,\n ratio: number | null\n): RectPx {\n const east = handle.includes('e');\n const west = handle.includes('w');\n const south = handle.includes('s');\n const north = handle.includes('n');\n const right = r.x + r.w;\n const bottom = r.y + r.h;\n\n if (!ratio || ratio <= 0) {\n let { x, y, w, h } = r;\n if (east) w = wrClamp(r.w + dx, min.w, bounds.w - r.x);\n if (west) {\n w = wrClamp(r.w - dx, min.w, right);\n x = right - w;\n }\n if (south) h = wrClamp(r.h + dy, min.h, bounds.h - r.y);\n if (north) {\n h = wrClamp(r.h - dy, min.h, bottom);\n y = bottom - h;\n }\n return { x, y, w, h };\n }\n\n // Room from the anchor to the image edge on each axis the handle drives; the whole\n // image on an axis it does not.\n const roomW = east ? bounds.w - r.x : west ? right : bounds.w;\n const roomH = south ? bounds.h - r.y : north ? bottom : bounds.h;\n // Corners follow the horizontal delta, as they always have; `n` / `s` the vertical one.\n const wanted = east ? r.w + dx : west ? r.w - dx : (south ? r.h + dy : r.h - dy) * ratio;\n const w = wrClamp(wanted, Math.max(min.w, min.h * ratio), Math.min(roomW, roomH * ratio));\n const h = w / ratio;\n\n return {\n x: east ? r.x : west ? right - w : wrClamp(r.x + r.w / 2 - w / 2, 0, bounds.w - w),\n y: south ? r.y : north ? bottom - h : wrClamp(r.y + r.h / 2 - h / 2, 0, bounds.h - h),\n w,\n h,\n };\n}\n\n/**\n * Image crop UI. Pass `[src]` (URL, `File`, or `Blob`); the user drags\n * the crop window or any of its eight handles. Optionally lock the crop\n * to a fixed `[aspectRatio]`.\n *\n * The crop window is also the one tab stop: arrow keys move it, Alt with an\n * arrow key resizes it, and Shift makes either step ten pixels instead of one.\n *\n * `(cropped)` fires after each drag end — or each run of arrow keys — with a\n * freshly-rendered `Blob` of the cropped region. For one-off reads use\n * `toBlob()` / `toDataUrl()`.\n *\n * A source the browser cannot decode fires `(loadError)` once, sets `status()` to\n * `'failed'` and puts `wr-image-cropper--failed` on the host. The component renders\n * no message of its own for it — what went wrong and what to do next is the host's\n * to say.\n *\n * The image is requested with `crossorigin=\"anonymous\"`, because a canvas will not\n * export pixels from another origin otherwise. A URL on another origin therefore has\n * to be served with `Access-Control-Allow-Origin`; one that is not fails to load and\n * fires `(loadError)`, where it used to show and then refuse every export.\n *\n * @example\n * ```html\n * <wr-image-cropper\n * [src]=\"file\"\n * [aspectRatio]=\"1\"\n * (cropped)=\"onBlob($event)\"\n * (loadError)=\"onUnreadable($event)\"\n * />\n * ```\n *\n * @see https://ngwr.dev/reference/components/image-cropper\n */\n@Component({\n selector: 'wr-image-cropper',\n templateUrl: './image-cropper.html',\n encapsulation: ViewEncapsulation.None,\n host: {\n class: 'wr-image-cropper',\n '[class.wr-image-cropper--failed]': \"status() === 'failed'\",\n },\n})\nexport class WrImageCropper {\n /** Image source — URL string, `File`, or `Blob`. */\n readonly src = input<string | File | Blob | null>(null);\n\n /** Aspect ratio (width / height). `null` = free. @default null */\n readonly aspectRatio = input<number | null>(null);\n\n /** Minimum crop width in display pixels. @default 32 */\n readonly minWidth = input(32, { transform: (v: unknown): number => Math.max(8, coerceNumberProperty(v, 32)) });\n\n /** Minimum crop height in display pixels. @default 32 */\n readonly minHeight = input(32, { transform: (v: unknown): number => Math.max(8, coerceNumberProperty(v, 32)) });\n\n /** Default output type for `(cropped)`. @default 'image/png' */\n readonly outputType = input<WrImageOutputType>('image/png');\n\n /** JPEG / WebP quality for `(cropped)` in [0, 1]. @default 0.92 */\n readonly outputQuality = input(0.92);\n\n /**\n * Longest side of the exported image, in pixels — for `(cropped)`, `toBlob()` and\n * `toDataUrl()` alike. A crop larger than this is scaled down to fit, keeping its\n * aspect ratio; a smaller one is exported as it is, never upscaled. The crop itself\n * — `cropRect()`, in source pixels — is not affected. `null` (or anything that is\n * not a positive number) exports at the source image's own resolution.\n * @default null\n */\n readonly maxOutputSize = input<number | null>(null, { transform: coerceMaxOutputSize });\n\n /** Emits a Blob after each drag end. */\n readonly cropped = output<Blob>();\n\n /**\n * Fires once when the browser cannot decode the current `src` — a format it does\n * not support, a broken file, a URL that fails. Nothing is rendered for it; show\n * your own message. A new `src` clears the failure.\n */\n readonly loadError = output<WrImageLoadError>();\n\n protected readonly imgEl = viewChild.required<ElementRef<HTMLImageElement>>('img');\n\n /** Resolved object URL for `src` (so File / Blob render in `<img>`). */\n protected readonly emptyText = useI18nText(NO_OVERRIDE, 'imageCropper.empty', 'No image');\n\n /** Accessible name of the crop window — the component's only tab stop. */\n protected readonly resolvedWindowLabel = useI18nText(NO_OVERRIDE, 'imageCropper.window', 'Crop region');\n\n /** The key model, referenced by the window's `aria-describedby`. */\n protected readonly resolvedKeyHelp = useI18nText(\n NO_OVERRIDE,\n 'imageCropper.keyHelp',\n 'Arrow keys move the crop. Hold Alt with an arrow key to resize it, and Shift for larger steps. ' +\n 'The crop is announced as left, top, width and height in image pixels.'\n );\n\n /** Id linking the crop window to the help text. Random rather than counted:\n * the crop UI only exists after a real image load, so it never prerenders. */\n protected readonly helpId = wrRandomId('wr-image-cropper-help');\n\n /** Live-region text — written by the keyboard path only (see `onWindowKeydown`). */\n protected readonly announcement = signal<string>('');\n\n protected readonly objectUrl = signal<string | null>(null);\n\n /** Previous object URL we created — kept off-signal so the resolve\n * effect doesn't depend on its own writes (which would loop). */\n private previousObjectUrl: string | null = null;\n\n /** Natural (source) pixel dimensions. */\n protected readonly natural = signal<{ w: number; h: number }>({ w: 0, h: 0 });\n\n /** Display (rendered) pixel dimensions. */\n protected readonly display = signal<{ w: number; h: number }>({ w: 0, h: 0 });\n\n /** Crop rect in display coordinates. */\n protected readonly cropDisplay = signal<RectPx>({ x: 0, y: 0, w: 0, h: 0 });\n\n /** Watches the rendered image box — see `watchResize`. */\n private resizeObserver: ResizeObserver | null = null;\n\n /** Currently active drag handle. */\n private active: WrCropHandle | null = null;\n private startPointer: { x: number; y: number } = { x: 0, y: 0 };\n private startRect: RectPx = { x: 0, y: 0, w: 0, h: 0 };\n\n /** The element the live drag set pointer capture on, so the end releases that one. */\n private captureTarget: HTMLElement | null = null;\n\n /** The pointer the live drag belongs to. Every other pointer's events are ignored. */\n private pointerId: number | null = null;\n\n /** How far past each side of the crop the live resize was pressed — see `onPointerMove`. */\n private overhang: SidesPx = NO_SIDES;\n\n private readonly destroyRef = inject(DestroyRef);\n\n private readonly statusState = signal<WrImageCropperStatus>('empty');\n\n /**\n * Where the source stands: `'empty'`, `'loading'`, `'loaded'` or `'failed'`. Reset\n * to `'loading'` (or `'empty'`) whenever `src` changes, so a failure never outlives\n * the source that caused it.\n */\n readonly status = this.statusState.asReadonly();\n\n /** Resolved crop rect in natural (source) pixel coordinates. */\n readonly cropRect = computed<WrCropRect>(() => {\n const display = this.display();\n const natural = this.natural();\n const c = this.cropDisplay();\n if (display.w === 0 || display.h === 0) return { x: 0, y: 0, width: 0, height: 0 };\n const sx = natural.w / display.w;\n const sy = natural.h / display.h;\n return {\n x: Math.round(c.x * sx),\n y: Math.round(c.y * sy),\n width: Math.round(c.w * sx),\n height: Math.round(c.h * sy),\n };\n });\n\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('image-cropper');\n // Resolve the source into a usable URL the <img> can render.\n // We only read `src()` here — `previousObjectUrl` is a plain field, so\n // writing to `objectUrl` doesn't re-trigger this effect (and hang the\n // tab on file upload).\n effect(() => {\n const src = this.src();\n if (this.previousObjectUrl) {\n URL.revokeObjectURL(this.previousObjectUrl);\n this.previousObjectUrl = null;\n }\n // The crop is measured against the image that WAS showing, and `cropRect` is a\n // public signal a consumer can read at any moment. Left in place it kept\n // reporting a rect scaled to the previous image for the whole gap between a new\n // `src` and its load event — long enough to crop the wrong thing.\n this.resetGeometry();\n if (!src) {\n this.objectUrl.set(null);\n this.statusState.set('empty');\n return;\n }\n // A new source starts over: a failure belongs to the source that caused it, and\n // left in place it would mark a perfectly good next image as broken until the\n // browser answered for that one too.\n this.statusState.set('loading');\n if (typeof src === 'string') {\n this.objectUrl.set(src);\n } else {\n const url = URL.createObjectURL(src);\n this.previousObjectUrl = url;\n this.objectUrl.set(url);\n }\n });\n\n this.destroyRef.onDestroy(() => {\n if (this.previousObjectUrl) URL.revokeObjectURL(this.previousObjectUrl);\n this.resizeObserver?.disconnect();\n });\n }\n\n // Image load\n\n /**\n * Back to \"nothing measured yet\", which is also what an absent `src` means.\n *\n * `display` is the field that gates everything downstream — the crop UI renders on\n * `display().w > 0` and `cropRect` returns zeros without it — so it is the only one\n * a test can observe. The other two are reset for coherence: the resize observer\n * below also writes `display`, and left alone they would resurrect a crop measured\n * against the previous image (which is why `onResize` refuses to run on a zeroed\n * `display` — see there).\n */\n private resetGeometry(): void {\n this.natural.set({ w: 0, h: 0 });\n this.display.set({ w: 0, h: 0 });\n this.cropDisplay.set({ x: 0, y: 0, w: 0, h: 0 });\n }\n\n protected onImageLoad(): void {\n const img = this.imgEl().nativeElement;\n const rect = img.getBoundingClientRect();\n const display = { w: rect.width, h: rect.height };\n // Some SVGs and odd images report zero natural dimensions — fall back\n // to the rendered size so the crop math stays well-defined.\n const natural = {\n w: img.naturalWidth || display.w,\n h: img.naturalHeight || display.h,\n };\n this.statusState.set('loaded');\n this.natural.set(natural);\n this.display.set(display);\n this.cropDisplay.set(this.initialCrop(display));\n this.watchResize(img);\n }\n\n /**\n * The `<img>` could not decode its source.\n *\n * Before this handler existed a failed decode left the component exactly as it\n * looks while loading — an image with no size, no crop window, nothing emitted —\n * so a host had no way to tell \"still decoding\" from \"never going to\", and a user\n * who picked a `.heic` the browser cannot read saw an empty box and no reason.\n *\n * Once per source: `status` is reset by a new `src` and by nothing else, so a\n * second `error` for the same source says nothing new and is not re-emitted.\n */\n protected onImageError(): void {\n const url = this.objectUrl();\n if (!url || this.statusState() === 'failed') return;\n this.statusState.set('failed');\n this.resetGeometry();\n\n const src = this.src();\n const isBlob = typeof src !== 'string' && src !== null;\n this.loadError.emit({\n url,\n name: typeof File !== 'undefined' && src instanceof File ? src.name : null,\n type: isBlob ? src.type : null,\n size: isBlob ? src.size : null,\n });\n }\n\n /**\n * Keep `display` on the box the image is actually rendered at.\n *\n * The stylesheet sizes the image responsively — `max-width: 100%`,\n * `max-height: 70dvh`, `height: auto` — so the single measurement taken in the\n * `(load)` handler stops being true as soon as the container or the viewport\n * changes. Everything the user sees and touches is in DISPLAY pixels: the crop\n * window's inline `left` / `top` / `width` / `height`, the backdrop cut-out, and\n * the bounds `applyMove` / `applyResize` clamp against. Measured once, a narrowed\n * window leaves the crop painted past the edge of the image and draggable off it.\n *\n * Re-observed per load rather than once, because a new `src` may mount a new\n * `<img>`; the old observation would then be on a detached element.\n */\n private watchResize(el: HTMLImageElement): void {\n if (typeof ResizeObserver === 'undefined') return;\n this.resizeObserver?.disconnect();\n // Re-read the same way `onImageLoad` does rather than take the entry's\n // `contentRect`, so the two measurements can't disagree about the box.\n const ro = new ResizeObserver(() => this.onResize(el));\n ro.observe(el);\n this.resizeObserver = ro;\n }\n\n /**\n * Rescale the crop by however much the image did, so the user keeps the region\n * they picked instead of having it re-centred: `cropRect()` — the source-pixel\n * value a consumer acts on — comes out the same across the resize.\n */\n private onResize(el: HTMLImageElement): void {\n const previous = this.display();\n // Nothing measured yet, or measured and then dropped by `resetGeometry` while a\n // new `src` loads. There is no crop to carry over, and the load will measure.\n if (previous.w === 0 || previous.h === 0) return;\n const rect = el.getBoundingClientRect();\n // A hidden image (a closed tab, `display: none`) reports zeros. Scaling by that\n // would collapse the crop and there would be nothing to scale back from, so hold\n // the last real box until it is shown again.\n if (rect.width === 0 || rect.height === 0) return;\n if (rect.width === previous.w && rect.height === previous.h) return;\n\n const sx = rect.width / previous.w;\n const sy = rect.height / previous.h;\n const c = this.cropDisplay();\n this.display.set({ w: rect.width, h: rect.height });\n this.cropDisplay.set({ x: c.x * sx, y: c.y * sy, w: c.w * sx, h: c.h * sy });\n }\n\n /** Compute a sensible initial crop — centered, respecting aspectRatio. */\n private initialCrop(display: { w: number; h: number }): RectPx {\n const ratio = this.aspectRatio();\n let w = display.w * 0.6;\n let h = display.h * 0.6;\n if (ratio && ratio > 0) {\n const candidate = w / ratio;\n if (candidate > h) w = h * ratio;\n else h = w / ratio;\n }\n return {\n x: (display.w - w) / 2,\n y: (display.h - h) / 2,\n w,\n h,\n };\n }\n\n // Drag handlers\n\n protected readonly handles: readonly WrCropHandle[] = ['n', 's', 'e', 'w', 'ne', 'nw', 'se', 'sw'];\n\n protected onPointerDown(handle: WrCropHandle, event: PointerEvent): void {\n // Any pointerdown used to start a drag, so the right button moved the crop window and\n // a second finger could take over a drag already in progress.\n if (event.button !== 0 || !event.isPrimary) return;\n event.preventDefault();\n event.stopPropagation();\n this.active = handle;\n this.pointerId = event.pointerId;\n this.startPointer = { x: event.clientX, y: event.clientY };\n this.startRect = { ...this.cropDisplay() };\n this.captureTarget = event.currentTarget as HTMLElement;\n this.captureTarget.setPointerCapture(event.pointerId);\n this.overhang = handle === 'move' ? NO_SIDES : this.pastCrop(event);\n }\n\n /**\n * A resize ENDS when the pointer leaves the image, exactly as `pointerup` would end it:\n * the move that carried it out is applied — clamped to the image like any other — and\n * then the drag is over. Nothing after that resumes it or changes the crop, pointer\n * back over the image or not, until a new `pointerdown`. A move drag is not affected:\n * its size is fixed, so it simply rests against the edge.\n *\n * The move that leaves is applied rather than dropped because pointer moves are\n * SAMPLES. Dropped, a quick drag toward a corner would stop wherever its last sample\n * inside happened to fall — a single move from a handle to past the image would change\n * nothing at all — and even a slow one would stop a fraction of a pixel short of the\n * edge. A drag that leaves across one edge still ends there: heading for a corner at a\n * slant that crosses the bottom first, the crop's right edge stays where it was then.\n *\n * \"The image\" is the `<img>`'s own box — the bounds `applyMove` / `applyResize` clamp\n * the crop to — with its edges counting as inside, since the crop may reach them. The\n * box is re-measured on every move and compared with `clientX` / `clientY`: both are\n * viewport coordinates, so a scroll mid-drag cannot put them out of step. The moves\n * outside reach this handler at all only because the drag holds pointer capture.\n *\n * One allowance, fixed at `pointerdown`: the box is widened on each side by however far\n * past that side of the CROP the press landed — at most as far as the pressed handle\n * reaches past it. Half of an edge handle, and three quarters of a corner handle, lies\n * outside the crop, so a press there already has the pointer ahead of the edge it drags.\n * Measured without the allowance, that pointer would leave the image while the crop was\n * still short of the image's edge by the same distance, with nothing able to close the\n * gap; and a handle resting on the image's edge, pressed on its outer part, would begin\n * its drag already outside. A press on a handle's inner part widens nothing.\n */\n protected onPointerMove(event: PointerEvent): void {\n if (!this.active || event.pointerId !== this.pointerId) return;\n const dx = event.clientX - this.startPointer.x;\n const dy = event.clientY - this.startPointer.y;\n if (this.active === 'move') {\n this.applyMove(dx, dy);\n return;\n }\n this.applyResize(this.active, dx, dy);\n if (!this.withinImage(event)) this.onPointerUp(event);\n }\n\n /**\n * Ends the drag — for `pointerup`, `pointercancel`, a capture lost to something else,\n * and a resize whose pointer left the image. Once per drag: the capture released here\n * fires `lostpointercapture` afterwards, and by then there is nothing left to end.\n *\n * Only for the pointer that started it. A second finger is refused a drag of its own at\n * `pointerdown`, but its moves and its lifting reach these handlers all the same, and\n * would otherwise drive or end the first finger's drag.\n */\n protected onPointerUp(event: PointerEvent): void {\n if (!this.active || event.pointerId !== this.pointerId) return;\n const target = this.captureTarget;\n this.active = null;\n this.pointerId = null;\n this.captureTarget = null;\n this.overhang = NO_SIDES;\n // Asked first: a capture that is already gone has nothing to release, and releasing\n // one for a pointer that is no longer active throws.\n if (target?.hasPointerCapture(event.pointerId)) target.releasePointerCapture(event.pointerId);\n void this.emitCropped();\n }\n\n /** How far past each side of the crop window the pointer is, in CSS pixels. */\n private pastCrop(event: PointerEvent): SidesPx {\n const box = this.imgEl().nativeElement.getBoundingClientRect();\n const c = this.startRect;\n return {\n left: Math.max(0, box.left + c.x - event.clientX),\n top: Math.max(0, box.top + c.y - event.clientY),\n right: Math.max(0, event.clientX - (box.left + c.x + c.w)),\n bottom: Math.max(0, event.clientY - (box.top + c.y + c.h)),\n };\n }\n\n /** Whether the pointer is on the image, edges and the press's `overhang` included. */\n private withinImage(event: PointerEvent): boolean {\n const box = this.imgEl().nativeElement.getBoundingClientRect();\n const o = this.overhang;\n return (\n event.clientX >= box.left - o.left &&\n event.clientX <= box.right + o.right &&\n event.clientY >= box.top - o.top &&\n event.clientY <= box.bottom + o.bottom\n );\n }\n\n // Keyboard\n\n /** Whether a key has moved the crop since the last `keyup`. */\n private keyboardDirty = false;\n\n /**\n * The component's only keyboard path. Arrow keys move the crop window; Alt\n * with an arrow key resizes it from the east / south edge; Shift makes either\n * one ten display pixels instead of one — the coarse modifier `wr-slider`,\n * `wr-knob` and `wr-splitter` all use, which is why Alt and not Shift carries\n * the mode switch here.\n *\n * Nothing mirrors under `dir=\"rtl\"`: the image is not flipped and the window\n * is placed with a physical `left`, so ArrowLeft moves the crop visually left\n * in both directions.\n *\n * Both branches go through `applyMove` / `applyResize`, so the `aspectRatio`\n * lock, the `minWidth` / `minHeight` floors and the canvas bounds hold for a\n * keystroke exactly as they do for a drag. Those two measure from `startRect`\n * rather than from the live rect, so it is re-seeded per keystroke — a 1px\n * delta against the rect from the first press would make a held arrow stall\n * after one pixel instead of accumulating.\n */\n protected onWindowKeydown(event: KeyboardEvent): void {\n const step = event.shiftKey ? KEY_STEP_COARSE : KEY_STEP;\n let dx = 0;\n let dy = 0;\n switch (event.key) {\n case 'ArrowLeft':\n dx = -step;\n break;\n case 'ArrowRight':\n dx = step;\n break;\n case 'ArrowUp':\n dy = -step;\n break;\n case 'ArrowDown':\n dy = step;\n break;\n default:\n return;\n }\n\n event.preventDefault();\n this.startRect = { ...this.cropDisplay() };\n if (event.altKey) this.applyResize(dx !== 0 ? 'e' : 's', dx, dy);\n else this.applyMove(dx, dy);\n\n this.keyboardDirty = true;\n const c = this.cropRect();\n // Bare numbers on purpose — `resolvedKeyHelp` has already told the reader\n // what the four are, and a sentence here would be a translated string.\n this.announcement.set(`${c.x}, ${c.y}, ${c.width} × ${c.height}`);\n }\n\n /**\n * Emit once per gesture, not once per keystroke. A held arrow repeats its\n * keydown many times a second and each `emitCropped` renders a canvas and\n * encodes a Blob; `keyup` fires once when the run ends, which is the keyboard's\n * equivalent of the `pointerup` the drag path emits on.\n */\n protected onWindowKeyup(): void {\n if (!this.keyboardDirty) return;\n this.keyboardDirty = false;\n void this.emitCropped();\n }\n\n private applyMove(dx: number, dy: number): void {\n const display = this.display();\n const r = this.startRect;\n const next = {\n x: wrClamp(r.x + dx, 0, display.w - r.w),\n y: wrClamp(r.y + dy, 0, display.h - r.h),\n w: r.w,\n h: r.h,\n };\n this.cropDisplay.set(next);\n }\n\n private applyResize(handle: WrCropHandle, dx: number, dy: number): void {\n const min = { w: this.minWidth(), h: this.minHeight() };\n this.cropDisplay.set(resizeFrom(this.startRect, handle, dx, dy, this.display(), min, this.aspectRatio()));\n }\n\n // Public API\n\n /**\n * Render the current crop as a Blob. Rejects while `status()` is anything but\n * `'loaded'`, since there is no image to draw.\n */\n async toBlob(type: WrImageOutputType = this.outputType(), quality: number = this.outputQuality()): Promise<Blob> {\n const canvas = this.toCanvas();\n return new Promise<Blob>((resolve, reject) => {\n canvas.toBlob(\n blob => {\n if (blob) resolve(blob);\n else reject(new Error('toBlob returned null'));\n },\n type,\n quality\n );\n });\n }\n\n /**\n * Render the current crop as a data URL. Throws while `status()` is anything but\n * `'loaded'`, since there is no image to draw.\n */\n toDataUrl(type: WrImageOutputType = this.outputType(), quality: number = this.outputQuality()): string {\n return this.toCanvas().toDataURL(type, quality);\n }\n\n /** Re-emit the crop without waiting for a drag (e.g. after a programmatic change). */\n async refresh(): Promise<void> {\n await this.emitCropped();\n }\n\n // Internals\n\n /**\n * The exported image's pixel size: the crop in source pixels, scaled down so its\n * longer side fits `maxOutputSize`. `Math.min(1, …)` is the never-upscale rule — a\n * crop already inside the cap keeps its own size, which is also the whole of the\n * uncapped path.\n */\n private outputSize(c: WrCropRect): { width: number; height: number } {\n const cap = this.maxOutputSize();\n const longest = Math.max(c.width, c.height);\n const scale = cap === null || longest === 0 ? 1 : Math.min(1, cap / longest);\n return {\n width: Math.max(1, Math.round(c.width * scale)),\n height: Math.max(1, Math.round(c.height * scale)),\n };\n }\n\n private toCanvas(): HTMLCanvasElement {\n // Without this, no image threw NG0951 from the required `imgEl` query, and a\n // `'failed'` one the canvas's own complaint about a broken image: two internals\n // messages for one plain fact.\n const status = this.status();\n if (status !== 'loaded') {\n throw new Error(`[NGWR] <wr-image-cropper>: there is no loaded image to export (status \"${status}\").`);\n }\n const img = this.imgEl().nativeElement;\n const c = this.cropRect();\n const canvas = document.createElement('canvas');\n const size = this.outputSize(c);\n canvas.width = size.width;\n canvas.height = size.height;\n // The SOURCE rect stays the whole crop and the destination is the canvas, so a\n // capped export is the same region drawn smaller rather than a smaller region.\n const ctx = canvas.getContext('2d');\n if (ctx) ctx.drawImage(img, c.x, c.y, c.width, c.height, 0, 0, canvas.width, canvas.height);\n return canvas;\n }\n\n private async emitCropped(): Promise<void> {\n if (this.status() !== 'loaded') return;\n try {\n const blob = await this.toBlob();\n this.cropped.emit(blob);\n } catch (error) {\n // An image IS loaded, so a failure here is the browser refusing to encode it,\n // and `(cropped)` not firing has to be visible to the developer. It used to be\n // swallowed, which is how a tainted cross-origin canvas went unnoticed.\n if (isDevMode()) {\n // eslint-disable-next-line no-console -- dev-mode diagnostics\n console.warn('[NGWR] <wr-image-cropper>: the crop could not be encoded, so (cropped) did not fire.', error);\n }\n }\n }\n}\n","@if (objectUrl(); as url) {\n <div class=\"wr-image-cropper__canvas\">\n <!--\n `crossorigin` is what lets a URL on another origin be exported at all: an image\n fetched without it taints the canvas `toCanvas` draws into, even when the server\n sends CORS headers, and every export then throws a SecurityError. It is static\n so it is in place before `src` starts the request.\n -->\n <img\n #img\n class=\"wr-image-cropper__image\"\n crossorigin=\"anonymous\"\n [src]=\"url\"\n alt=\"\"\n draggable=\"false\"\n (load)=\"onImageLoad()\"\n (error)=\"onImageError()\"\n />\n\n @if (display().w > 0) {\n <!-- Semi-transparent backdrop with a cut-out for the crop window. -->\n <div\n class=\"wr-image-cropper__backdrop\"\n [style.clip-path]=\"`polygon(0 0, 100% 0, 100% 100%, 0 100%, 0 ${cropDisplay().y}px, ${cropDisplay().x}px ${cropDisplay().y}px, ${cropDisplay().x}px ${cropDisplay().y + cropDisplay().h}px, ${cropDisplay().x + cropDisplay().w}px ${cropDisplay().y + cropDisplay().h}px, ${cropDisplay().x + cropDisplay().w}px ${cropDisplay().y}px, 0 ${cropDisplay().y}px)`\"\n ></div>\n\n <!--\n Crop window — drag to move, with eight resize handles, and the ONE\n keyboard control the component has (see `onWindowKeydown`). The eight\n handles stay pointer-only and `aria-hidden`: eight extra tab stops per\n cropper would be hostile. The keys resize from the east and south edges\n only, so a west or north drag comes out as a resize plus a move rather\n than as one gesture.\n\n `role=\"group\"` rather than no role at all, because `aria-label` is\n prohibited on a roleless `<div>` and this needs a name; and rather than\n `role=\"application\"`, which would switch the reader out of its own\n browse mode for the whole subtree — far more than one rectangle is worth.\n -->\n <div\n class=\"wr-image-cropper__window\"\n role=\"group\"\n tabindex=\"0\"\n [attr.aria-label]=\"resolvedWindowLabel()\"\n [attr.aria-describedby]=\"helpId\"\n [style.left.px]=\"cropDisplay().x\"\n [style.top.px]=\"cropDisplay().y\"\n [style.width.px]=\"cropDisplay().w\"\n [style.height.px]=\"cropDisplay().h\"\n (pointerdown)=\"onPointerDown('move', $event)\"\n (pointermove)=\"onPointerMove($event)\"\n (pointerup)=\"onPointerUp($event)\"\n (pointercancel)=\"onPointerUp($event)\"\n (lostpointercapture)=\"onPointerUp($event)\"\n (keydown)=\"onWindowKeydown($event)\"\n (keyup)=\"onWindowKeyup()\"\n >\n @for (h of handles; track h) {\n <span\n aria-hidden=\"true\"\n [class]=\"`wr-image-cropper__handle wr-image-cropper__handle--${h}`\"\n (pointerdown)=\"onPointerDown(h, $event)\"\n (pointermove)=\"onPointerMove($event)\"\n (pointerup)=\"onPointerUp($event)\"\n (pointercancel)=\"onPointerUp($event)\"\n (lostpointercapture)=\"onPointerUp($event)\"\n ></span>\n }\n </div>\n\n <p class=\"wr-image-cropper__sr-only\" [id]=\"helpId\">{{ resolvedKeyHelp() }}</p>\n\n <!--\n The crop rect in SOURCE pixels, announced after a keyboard change only —\n a pointer drag already gives sighted feedback and would flood the region,\n and the initial crop is not news. Deliberately bare numbers: a sentence\n here would be a translated string the catalog does not carry, and the\n reader has just been told what the four numbers mean by `helpId`.\n -->\n <p class=\"wr-image-cropper__sr-only\" role=\"status\">{{ announcement() }}</p>\n }\n </div>\n} @else {\n <div class=\"wr-image-cropper__empty\">{{ emptyText() }}</div>\n}\n"],"mappings":";;;;;;;;;;;AAiCA,SAAS,oBAAoB,OAAc;CACzC,IAAI,UAAU,QAAQ,UAAU,UAAa,UAAU,IAAI,OAAO;CAClE,MAA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AA;EAAA,SAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,SAAA;EAAA,CAAA;EAAA,WAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,WAAA;EAAA,CAAA;EAAA,OAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,OAAK,EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;CAAA;AAAA,CAAA"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as i0 from "@angular/core";
|
|
2
2
|
import { Component, LOCALE_ID, ViewEncapsulation, computed, effect, inject, input, model, output, signal, viewChild } from "@angular/core";
|
|
3
3
|
import { coerceBooleanProperty, coerceNumberProperty } from "@angular/cdk/coercion";
|
|
4
|
-
import {
|
|
4
|
+
import { wrCheckStyles, wrClamp, wrDecimal, wrDecimalAdd, wrDecimalCompare, wrDecimalMultiply, wrDecimalRound, wrRound } from "ngwr/utils";
|
|
5
5
|
import { useI18nText } from "ngwr/i18n";
|
|
6
6
|
import { WrInput, WrInputGroup, WrInputPrefix, WrInputSuffix } from "ngwr/input";
|
|
7
7
|
/**
|
|
@@ -202,7 +202,7 @@ var WrInputNumber = class WrInputNumber {
|
|
|
202
202
|
}
|
|
203
203
|
const raw = (this.value() ?? this.fallbackBase()) + units * stepSize;
|
|
204
204
|
const correctable = Math.abs(raw) < WrInputNumber.SAFE_ROUND_MAGNITUDE && Math.abs(stepSize) >= WrInputNumber.SAFE_ROUND_STEP;
|
|
205
|
-
const next = this.constrain(correctable ?
|
|
205
|
+
const next = this.constrain(correctable ? wrRound(raw, WrInputNumber.STEP_PRECISION) : raw);
|
|
206
206
|
this.commit(next);
|
|
207
207
|
this.text.set(this.format(next));
|
|
208
208
|
}
|
|
@@ -212,9 +212,9 @@ var WrInputNumber = class WrInputNumber {
|
|
|
212
212
|
return 0;
|
|
213
213
|
}
|
|
214
214
|
constrain(v) {
|
|
215
|
-
let next =
|
|
215
|
+
let next = wrClamp(v, this.minValue(), this.maxValue());
|
|
216
216
|
const d = this.decimals();
|
|
217
|
-
if (d !== null) next =
|
|
217
|
+
if (d !== null) next = wrRound(next, d);
|
|
218
218
|
return next;
|
|
219
219
|
}
|
|
220
220
|
constrainDecimal(v) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ngwr-input-number.mjs","names":[],"sources":["../../../projects/lib/input-number/input-number.ts","../../../projects/lib/input-number/input-number.html"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { coerceBooleanProperty, coerceNumberProperty } from '@angular/cdk/coercion';\nimport {\n Component,\n type ElementRef,\n LOCALE_ID,\n ViewEncapsulation,\n computed,\n effect,\n inject,\n input,\n model,\n output,\n signal,\n viewChild,\n} from '@angular/core';\nimport type { FormValueControl } from '@angular/forms/signals';\n\nimport { useI18nText } from 'ngwr/i18n';\nimport { WrInput, WrInputGroup, WrInputPrefix, WrInputSuffix, type WrInputSize } from 'ngwr/input';\nimport {\n clamp,\n round,\n wrCheckStyles,\n wrDecimal,\n wrDecimalAdd,\n wrDecimalCompare,\n wrDecimalMultiply,\n wrDecimalRound,\n} from 'ngwr/utils';\n\nimport type { WrInputNumberMode, WrInputNumberValue } from './types';\n\n/** Resolve the locale's decimal + grouping separators from `Intl.NumberFormat`. */\nfunction resolveSeparators(locale: string): { decimal: string; group: string } {\n const parts = new Intl.NumberFormat(locale).formatToParts(12345.6);\n const decimal = parts.find(p => p.type === 'decimal')?.value ?? '.';\n const group = parts.find(p => p.type === 'group')?.value ?? '';\n return { decimal, group };\n}\n\n/**\n * The ten digits `locale` writes, index 0 to 9 — empty when the system is\n * algorithmic. ar-EG prints `١٬٢٣٤٫٥`, and `Number()` reads none of those digits,\n * so an edit to the field's own display could never commit. A copy of the time\n * panel's helper in `ngwr/date-picker`, kept a copy for the reason given there.\n */\nfunction resolveNumerals(locale: string): readonly string[] {\n try {\n const formatter = new Intl.NumberFormat(locale, { useGrouping: false });\n const digits: string[] = [];\n for (let i = 0; i < 10; i++) {\n const digit = formatter.format(i);\n if ([...digit].length !== 1 || digits.includes(digit)) return [];\n digits.push(digit);\n }\n return digits;\n } catch {\n return [];\n }\n}\n\n/**\n * Characters a user types for a separator the locale prints as something else:\n * a keyboard sends a plain space where ru / uk / kk group with U+00A0 and fr with\n * U+202F, and a plain apostrophe where de-CH groups with U+2019.\n */\nfunction groupPattern(group: string): RegExp | null {\n if (!group) return null;\n if (/\\s/.test(group)) return /\\s/g;\n if (/['\\u2019]/.test(group)) return /['\\u2019]/g;\n return new RegExp(group.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&'), 'g');\n}\n\n/** A finite `min` / `max` as a decimal; an infinite one is no bound. */\nfunction decimalBound(bound: number): string | null {\n return Number.isFinite(bound) ? wrDecimal(bound) : null;\n}\n\n/**\n * `min` / `max` are numbers at runtime in either mode. The declared type is\n * `FormValueControl`'s, which names the bound after the value, so the number\n * is cast into it here and read back out in `minValue` / `maxValue`.\n */\nfunction asBound<M extends WrInputNumberMode>(bound: number): NonNullable<WrInputNumberValue<M>> {\n return bound as unknown as NonNullable<WrInputNumberValue<M>>;\n}\n\n/**\n * Numeric input with locale-aware formatting + ▲▼ stepper buttons.\n *\n * A signal-forms native control: it implements `FormValueControl`, so\n * `[formField]` binds straight to its `value` model — no\n * `ControlValueAccessor` in between. `[(value)]` works standalone.\n *\n * Parses leniently while typing (allows partial input like `\"1.\"` or `\"-\"`),\n * re-formats with grouping + fixed decimals on blur.\n *\n * `M` is the `mode`, and it decides what `value` holds: `number | null` by\n * default, `string | null` under `mode=\"decimal\"`, where the digits are kept\n * exact (see `WrInputNumberValue`).\n *\n * Locale comes from Angular's `LOCALE_ID` — input-number intentionally does\n * NOT depend on `ngwr/date` so it can be used in date-free apps.\n *\n * @example\n * ```html\n * <!-- signal forms -->\n * <wr-input-number [formField]=\"form.qty\" [min]=\"0\" [max]=\"100\" />\n *\n * <!-- standalone two-way binding -->\n * <wr-input-number [(value)]=\"price\" [decimals]=\"2\" suffix=\"USD\" />\n *\n * <!-- exact decimals: `amount` is a `string | null` such as '1234.56' -->\n * <wr-input-number mode=\"decimal\" [(value)]=\"amount\" [decimals]=\"2\" />\n * ```\n *\n * @see https://ngwr.dev/reference/components/input-number\n */\n@Component({\n selector: 'wr-input-number',\n templateUrl: './input-number.html',\n encapsulation: ViewEncapsulation.None,\n host: { '[class]': 'classes()' },\n imports: [WrInput, WrInputGroup, WrInputPrefix, WrInputSuffix],\n})\nexport class WrInputNumber<M extends WrInputNumberMode = 'number'> implements FormValueControl<WrInputNumberValue<M>> {\n /**\n * What `value` holds. `'number'` is the engine's double. `'decimal'` keeps\n * the typed digits exact as a canonical string (`'1234.56'`: a `.` for the\n * point, no grouping), reads a decimal comma and pasted spaces, and steps,\n * clamps and rounds through `wrDecimal` from `ngwr/utils`, so `0.2` stepped\n * by `0.1` is `'0.3'`. A lone `.` or `,` is read in the locale's role: its\n * decimal separator is a point, its grouping character is grouping when\n * exactly three digits follow it (`1,234` in en-US is `'1234'`, but `0,125`\n * is `'0.125'`) and a point otherwise. With both present,\n * the last one is the point: `1,234.56` and `1.234,56` are `'1234.56'`.\n * Grouping comes in threes, so `1.2.3` is unreadable and the committed\n * value stays, as it does for any text the field cannot read.\n *\n * @default 'number'\n */\n readonly mode = input<M>('number' as M);\n\n private readonly decimal = computed(() => this.mode() === 'decimal');\n\n /** Minimum allowed value, a number in either mode. @default -Infinity */\n readonly min = input<NonNullable<WrInputNumberValue<M>> | undefined, unknown>(asBound<M>(Number.NEGATIVE_INFINITY), {\n transform: (v: unknown) => asBound<M>(coerceNumberProperty(v, Number.NEGATIVE_INFINITY)),\n });\n\n /** Maximum allowed value, a number in either mode. @default Infinity */\n readonly max = input<NonNullable<WrInputNumberValue<M>> | undefined, unknown>(asBound<M>(Number.POSITIVE_INFINITY), {\n transform: (v: unknown) => asBound<M>(coerceNumberProperty(v, Number.POSITIVE_INFINITY)),\n });\n\n private readonly minValue = computed(() => (this.min() as number | undefined) ?? Number.NEGATIVE_INFINITY);\n private readonly maxValue = computed(() => (this.max() as number | undefined) ?? Number.POSITIVE_INFINITY);\n\n /** Step used by stepper buttons + arrow keys. @default 1 */\n readonly step = input(1, { transform: (v: unknown): number => Math.max(0, coerceNumberProperty(v, 1)) });\n\n /**\n * Fixed number of decimals. Rounds the value as it is COMMITTED, and fixes the\n * digits shown once the field reformats on blur. `null` keeps the entered\n * precision and formats with up to 20.\n *\n * Clamped to 0–100, the range `Intl.NumberFormat`'s `minimumFractionDigits` /\n * `maximumFractionDigits` accept — because it is the one numeric input on this\n * component that had no transform, and the value goes straight into the\n * formatter, which THROWS a `RangeError` outside that range rather than\n * degrading. A `[decimals]=\"-1\"` bound from a config object took the whole\n * component down on blur.\n *\n * @default null\n */\n readonly decimals = input<number | null, unknown>(null, {\n transform: (v: unknown): number | null =>\n v === null || v === undefined ? null : Math.min(100, Math.max(0, Math.trunc(coerceNumberProperty(v, 0)))),\n });\n\n /** Render the ▲▼ stepper column. @default true */\n readonly showSteppers = input(true, { transform: coerceBooleanProperty });\n\n /**\n * Control size — forwarded to the field's `[size]`, and shares the\n * `--wr-control-*` contract. @default 'md'\n */\n readonly size = input<WrInputSize>('md');\n\n /** Pill-shaped corners — forwarded to the group AND the field. @default false */\n readonly rounded = input(false, { transform: coerceBooleanProperty });\n\n /** Optional prefix label (e.g. `\"$\"`). */\n readonly prefix = input<string>('');\n\n /** Optional suffix label (e.g. `\"kg\"`). */\n readonly suffix = input<string>('');\n\n /** Placeholder shown when the input is empty. */\n readonly placeholder = input<string>('');\n\n /**\n * Accessible name for the field. Unset, the field is named by whatever labels\n * it — there is deliberately no fallback here.\n *\n * It used to mirror the `placeholder`, and an `aria-label` OUTRANKS a\n * `<label>` in the accname order: inside a `<wr-form-field label=\"Quantity\">`\n * the very input that adopts the field's id announced the placeholder (\"0\")\n * instead, and a placeholder disappears as soon as the user types. Standalone\n * nothing was lost by dropping it — an input with no other name already falls\n * back to its own `placeholder` attribute, which is the name axe's `label`\n * rule accepts too.\n */\n readonly ariaLabel = input<string | null>(null);\n\n protected readonly resolvedAriaLabel = computed(() => {\n // Not `??`: an empty binding is no name at all, and an empty `aria-label` is\n // worse than none — it still wins the accname order, and announces nothing.\n const explicit = this.ariaLabel();\n if (explicit) return explicit;\n return null;\n });\n\n /** Increment button aria-label. Falls back to `inputNumber.increment`. */\n readonly incrementLabel = input<string | null>(null);\n\n /** Decrement button aria-label. Falls back to `inputNumber.decrement`. */\n readonly decrementLabel = input<string | null>(null);\n\n /**\n * The steppers are icon-only buttons, so these ARE their accessible names.\n * They were hard-coded English while the catalog carried the keys for them\n * unread — a Russian app announced \"Increment\".\n */\n protected readonly resolvedIncrement = useI18nText(this.incrementLabel, 'inputNumber.increment', 'Increment');\n protected readonly resolvedDecrement = useI18nText(this.decrementLabel, 'inputNumber.decrement', 'Decrement');\n\n /** Disable interaction. @default false */\n readonly disabled = input(false, { transform: coerceBooleanProperty });\n\n /** Read-only — values cannot be changed (steppers + typing disabled). @default false */\n readonly readonly = input(false, { transform: coerceBooleanProperty });\n\n /**\n * The value, `null` when empty: a `number` in `'number'` mode, a canonical\n * decimal string in `'decimal'` mode. Bound by `[formField]`, or two-way via\n * `[(value)]`.\n */\n readonly value = model<WrInputNumberValue<M>>(null);\n\n /** Emitted on blur so a bound field can mark itself touched. */\n readonly touch = output<void>();\n\n private readonly locale = inject(LOCALE_ID);\n private readonly separators = resolveSeparators(this.locale);\n private readonly numerals = resolveNumerals(this.locale);\n private readonly group = groupPattern(this.separators.group);\n\n /** Text currently in the input (may be partial / invalid mid-type). */\n protected readonly text = signal<string>('');\n\n /** Whether the input is focused. While true, the input handlers own `text`. */\n protected readonly focused = signal(false);\n\n private readonly field = viewChild.required<ElementRef<HTMLInputElement>>('input');\n\n protected readonly interactive = computed(() => !this.disabled() && !this.readonly());\n\n /** The value as the decimal core reads it; `null` when empty or unreadable. */\n private readonly decimalValue = computed(() => {\n const v = this.value();\n return v === null ? null : wrDecimal(v);\n });\n\n protected readonly atMin = computed(() => {\n if (this.decimal()) return this.atDecimalBound(this.minValue(), -1);\n const v = this.value() as number | null;\n return v !== null && v <= this.minValue();\n });\n\n protected readonly atMax = computed(() => {\n if (this.decimal()) return this.atDecimalBound(this.maxValue(), 1);\n const v = this.value() as number | null;\n return v !== null && v >= this.maxValue();\n });\n\n private atDecimalBound(bound: number, side: -1 | 1): boolean {\n const v = this.decimalValue();\n const limit = decimalBound(bound);\n if (v === null || limit === null) return false;\n const order = wrDecimalCompare(v, limit);\n return order !== null && order * side >= 0;\n }\n\n /**\n * The size and pill modifiers mirror what is bound down to the chrome, because\n * the stepper column belongs to neither half of it: the field carries\n * `wr-input--<size>`, the column is its SIBLING, and the group carries no size\n * at all. Without a modifier of its own the column drew one 10x6 chevron at\n * every size and ran its dividers into a pill's rounded end.\n */\n protected readonly classes = computed(() => {\n const parts = ['wr-input-number'];\n const size = this.size();\n if (size !== 'md') parts.push(`wr-input-number--${size}`);\n if (this.rounded()) parts.push('wr-input-number--rounded');\n if (this.disabled()) parts.push('wr-input-number--disabled');\n return parts.join(' ');\n });\n\n /**\n * Fraction digits the stepper rounds its arithmetic to when `decimals` says\n * nothing. High enough to leave a real value alone, low enough to erase the\n * binary-float tail that repeated stepping accumulates.\n */\n private static readonly STEP_PRECISION = 10;\n\n /**\n * Above this, the anti-drift round is skipped — it would MANUFACTURE drift.\n *\n * `round(v, 10)` is `Math.round((v + EPSILON) * 1e10) / 1e10`, and the scale\n * factor is only exact while `v * 1e10` stays inside 2^53, i.e. |v| under\n * about 900,720. In practice the round-trip still recovers up to ~9.2e8 and\n * then breaks: `round(1000000001, 10)` is `1000000000.9999999`, and since\n * `format` prints up to 20 fraction digits that tail reaches the screen —\n * and compounds, because the next press starts from it. Integer stepping at\n * that magnitude is exact in IEEE754 and needed no help; the only thing this\n * rounding exists to defend is `0.1 + 0.1 + 0.1`.\n */\n private static readonly SAFE_ROUND_MAGNITUDE = 1e6;\n\n /** Steps finer than this would be rounded away by {@link STEP_PRECISION}. */\n private static readonly SAFE_ROUND_STEP = 1e-9;\n\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('input-number');\n // Keep the display `text` in sync with external writes to `value` (via\n // `[formField]` / `[(value)]`). While the user is editing, the input\n // handlers own `text`, so skip re-formatting to avoid clobbering partial\n // input (e.g. mid-typed grouping or a value that is still being clamped).\n effect(() => {\n const v = this.value();\n if (this.focused()) return;\n if (v === null || Number.isNaN(v)) {\n this.text.set('');\n return;\n }\n // SHOW WHAT THE MODEL HOLDS. It used to format `constrain(v)`, so a\n // `[max]=\"10\"` field handed 500 drew \"10\" over a model that still said\n // 500 — the display was the thing lying, not the model.\n //\n // The tempting repair is to write the clamp back so the two agree, and\n // that is worse: under `[formField]` the bounds arrive ONLY through the\n // schema's `min()` / `max()` rules (binding `[min]` next to `[formField]`\n // is an NG8022 compile error), so overwriting the value ERASES the very\n // error those rules exist to raise — and the write marks a pristine form\n // dirty, tripping unsaved-changes guards and opening every other\n // validator's message on first paint.\n //\n // So: `min` / `max` bound what this component's own edits may produce,\n // and a value written from outside is displayed as it is and left for\n // validation to judge.\n this.text.set(this.format(v));\n });\n }\n\n /**\n * Focus the text field — what Signal Forms calls to focus this control, from\n * `focusBoundControl()`. The host is a plain element, so without this the\n * call landed on something that cannot take focus and nothing moved.\n */\n focus(options?: FocusOptions): void {\n this.field().nativeElement.focus(options);\n }\n\n // Template handlers\n\n protected onInput(event: Event): void {\n const raw = (event.target as HTMLInputElement).value;\n this.text.set(raw);\n if (!raw.trim()) {\n this.commit(null);\n return;\n }\n if (this.decimal()) {\n const parsed = this.parseDecimal(raw);\n if (parsed === null) return; // partial or unreadable - the committed value stays\n this.commit(this.constrainDecimal(parsed));\n return;\n }\n const parsed = this.parse(raw);\n if (parsed === null) return; // partial input — wait for more\n const next = this.constrain(parsed);\n this.commit(next);\n }\n\n protected onFocus(): void {\n this.focused.set(true);\n }\n\n protected onBlur(): void {\n // Flipping `focused` false lets the sync effect re-format `text` from the\n // committed `value` (e.g. `\"1.\"` → `\"1\"`, or grouping the final number).\n this.focused.set(false);\n this.touch.emit();\n }\n\n protected onKeydown(event: KeyboardEvent): void {\n if (!this.interactive()) return;\n if (event.key !== 'ArrowUp' && event.key !== 'ArrowDown') return;\n event.preventDefault();\n const direction = event.key === 'ArrowUp' ? 1 : -1;\n const multiplier = event.shiftKey ? 10 : 1;\n this.bump(direction * multiplier);\n }\n\n protected stepBy(direction: 1 | -1): void {\n if (!this.interactive()) return;\n this.bump(direction);\n }\n\n // Internals\n\n /** The one write to `value`: what a mode holds is decided above, not here. */\n private commit(next: number | string | null): void {\n this.value.set(next as WrInputNumberValue<M>);\n }\n\n private bump(units: number): void {\n const stepSize = this.step() || 1;\n if (this.decimal()) {\n const base = this.decimalValue() ?? wrDecimal(this.fallbackBase()) ?? '0';\n const next = this.constrainDecimal(wrDecimalAdd(base, wrDecimalMultiply(stepSize, units)) ?? base);\n this.commit(next);\n this.text.set(this.format(next));\n return;\n }\n const base = (this.value() as number | null) ?? this.fallbackBase();\n // `round` before `constrain`, and only on the stepped ARITHMETIC. Binary\n // floats do not add: three presses of a `step=\"0.1\"` stepper produced\n // 0.30000000000000004, `constrain` only rounds when `decimals` is set, and\n // `format` prints up to 20 fraction digits — so the drift went into the\n // model AND onto the screen. Ten digits erases IEEE noise without\n // quantising a value the user typed (0.15000000000000002 stays 0.15, it\n // does not snap to the step grid).\n //\n // Guarded on BOTH ends, because outside them the correction is the thing\n // that corrupts: see SAFE_ROUND_MAGNITUDE, and a step finer than 1e-9 would\n // simply be rounded away to nothing.\n const raw = base + units * stepSize;\n const correctable =\n Math.abs(raw) < WrInputNumber.SAFE_ROUND_MAGNITUDE && Math.abs(stepSize) >= WrInputNumber.SAFE_ROUND_STEP;\n const next = this.constrain(correctable ? round(raw, WrInputNumber.STEP_PRECISION) : raw);\n this.commit(next);\n this.text.set(this.format(next));\n }\n\n /** Choose a sensible starting point when bumping from `null`. */\n private fallbackBase(): number {\n if (Number.isFinite(this.minValue()) && this.minValue() > 0) return this.minValue();\n if (Number.isFinite(this.maxValue()) && this.maxValue() < 0) return this.maxValue();\n return 0;\n }\n\n private constrain(v: number): number {\n let next = clamp(v, this.minValue(), this.maxValue());\n const d = this.decimals();\n if (d !== null) next = round(next, d);\n return next;\n }\n\n /** `constrain` for a decimal string: the bounds and `decimals` through the decimal core. */\n private constrainDecimal(v: string): string {\n let next = v;\n const min = decimalBound(this.minValue());\n const max = decimalBound(this.maxValue());\n if (min !== null && wrDecimalCompare(next, min) === -1) next = min;\n if (max !== null && wrDecimalCompare(next, max) === 1) next = max;\n const d = this.decimals();\n if (d !== null) next = wrDecimalRound(next, d) ?? next;\n return next;\n }\n\n /**\n * The locale's digits to ASCII, its minus sign (U+2212 in sv, fi, …) to a\n * hyphen, and the bidi marks it puts around a negative number dropped — every\n * one of them is in the text this field formats, and neither `Number()` nor\n * `wrDecimal` reads them.\n */\n private toAscii(text: string): string {\n return [...text]\n .map(ch => {\n const digit = this.numerals.indexOf(ch);\n return digit < 0 ? ch : String(digit);\n })\n .join('')\n .replace(/[\\u200e\\u200f\\u061c]/g, '')\n .replace(/\\u2212/g, '-');\n }\n\n /**\n * Decimal-mode parse: a canonical decimal string, or `null` for partial or\n * unreadable text. Spaces of every width and the Swiss apostrophe are\n * grouping; `.` and `,` are read by the rule on `mode`, and a separator read\n * as grouping has to come in threes, so `1.2.3` is unreadable rather than 123.\n */\n private parseDecimal(raw: string): string | null {\n // fa and ar-EG write U+066B and U+066C, which the `.` and `,` rule never sees.\n const { decimal, group } = this.separators;\n const ownMarks = decimal !== '.' && decimal !== ',';\n let text = this.toAscii(raw.trim()).replace(/[\\s'\\u2019]/g, '');\n if (ownMarks) text = text.replaceAll(group, '').replaceAll(decimal, '.');\n const separators = [...text.matchAll(/[.,]/g)];\n if (separators.length) {\n const last = separators[separators.length - 1];\n let point: number | null = last.index;\n if (separators.length === 1) {\n // Three digits after the locale's grouping character is grouping,\n // unless nothing or a lone zero precedes it: `0,125` is a fraction.\n const after = text.length - last.index - 1;\n const lead = text.slice(0, last.index);\n if (last[0] !== (ownMarks ? '.' : decimal) && after === 3 && !/^-?0?$/.test(lead)) point = null;\n } else if (separators.every(s => s[0] === last[0])) {\n point = null;\n }\n const groups = (point === null ? text : text.slice(0, point)).split(/[.,]/);\n if (groups.slice(1).some(group => group.length !== 3)) return null;\n text = point === null ? groups.join('') : `${groups.join('')}.${text.slice(point + 1)}`;\n }\n if (/^-?\\.?$/.test(text) || text.endsWith('.')) return null;\n return wrDecimal(text);\n }\n\n /** Parse a locale-formatted string. Returns `null` for partial / not-yet-numeric input. */\n private parse(raw: string): number | null {\n const trimmed = raw.trim();\n if (!trimmed) return null;\n let normalised = this.toAscii(trimmed);\n // Strip group separators, normalise the decimal separator to `.`.\n if (this.group) {\n normalised = normalised.replace(this.group, '');\n }\n if (this.separators.decimal !== '.') {\n normalised = normalised.split(this.separators.decimal).join('.');\n }\n // Partial inputs we don't want to clobber while the user is still typing:\n // `-`, `-.`, `.`, `1.`, `-1.` etc.\n if (/^-?\\.?$/.test(normalised) || normalised.endsWith('.')) return null;\n const n = Number(normalised);\n return Number.isFinite(n) ? n : null;\n }\n\n /** Format a value using `Intl.NumberFormat` for the active locale. */\n private format(v: number | string): string {\n const d = this.decimals();\n if (this.decimal()) {\n const canonical = wrDecimal(v);\n if (canonical === null) return String(v);\n // The string's own places, so `'1.50'` shows as typed; `decimals` fixes them.\n const point = canonical.indexOf('.');\n const places = d ?? Math.min(100, point < 0 ? 0 : canonical.length - point - 1);\n const formatter = new Intl.NumberFormat(this.locale, {\n minimumFractionDigits: places,\n maximumFractionDigits: places,\n useGrouping: true,\n });\n // ES2023 formats a decimal string exactly; the lib typings here stop at ES2022.\n return formatter.format(canonical as unknown as number);\n }\n const formatter = new Intl.NumberFormat(this.locale, {\n minimumFractionDigits: d ?? 0,\n maximumFractionDigits: d ?? 20,\n useGrouping: true,\n });\n return formatter.format(v as number);\n }\n}\n","<wr-input-group [rounded]=\"rounded()\">\n @if (prefix(); as p) {\n <span wrInputPrefix>{{ p }}</span>\n }\n <input\n #input\n wrInput\n type=\"text\"\n inputmode=\"decimal\"\n autocomplete=\"off\"\n [size]=\"size()\"\n [rounded]=\"rounded()\"\n [attr.aria-label]=\"resolvedAriaLabel()\"\n spellcheck=\"false\"\n [value]=\"text()\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"disabled()\"\n [readonly]=\"readonly()\"\n (input)=\"onInput($event)\"\n (focus)=\"onFocus()\"\n (blur)=\"onBlur()\"\n (keydown)=\"onKeydown($event)\"\n />\n @if (suffix(); as s) {\n <span wrInputSuffix>{{ s }}</span>\n }\n @if (showSteppers()) {\n <div class=\"wr-input-number__steppers\" wrInputSuffix>\n <button\n type=\"button\"\n class=\"wr-input-number__step\"\n tabindex=\"-1\"\n [attr.aria-label]=\"resolvedIncrement()\"\n [disabled]=\"!interactive() || atMax()\"\n (click)=\"stepBy(1)\"\n >\n <svg\n class=\"wr-icon__svg\"\n width=\"14\"\n height=\"14\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n >\n <path d=\"m18 15-6-6-6 6\" />\n </svg>\n </button>\n <button\n type=\"button\"\n class=\"wr-input-number__step\"\n tabindex=\"-1\"\n [attr.aria-label]=\"resolvedDecrement()\"\n [disabled]=\"!interactive() || atMin()\"\n (click)=\"stepBy(-1)\"\n >\n <svg\n class=\"wr-icon__svg\"\n width=\"14\"\n height=\"14\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n >\n <path d=\"m6 9 6 6 6-6\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AA,MAAA,CAAA,aAAA;EAAA,CAAA;EAAA,OAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,OAAA;EAAA,CAAA;EAAA,OAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,SAAO,EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;CAAA;AAAA,CAAA"}
|
|
1
|
+
{"version":3,"file":"ngwr-input-number.mjs","names":[],"sources":["../../../projects/lib/input-number/input-number.ts","../../../projects/lib/input-number/input-number.html"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { coerceBooleanProperty, coerceNumberProperty } from '@angular/cdk/coercion';\nimport {\n Component,\n type ElementRef,\n LOCALE_ID,\n ViewEncapsulation,\n computed,\n effect,\n inject,\n input,\n model,\n output,\n signal,\n viewChild,\n} from '@angular/core';\nimport type { FormValueControl } from '@angular/forms/signals';\n\nimport { useI18nText } from 'ngwr/i18n';\nimport { WrInput, WrInputGroup, WrInputPrefix, WrInputSuffix, type WrInputSize } from 'ngwr/input';\nimport {\n wrClamp,\n wrRound,\n wrCheckStyles,\n wrDecimal,\n wrDecimalAdd,\n wrDecimalCompare,\n wrDecimalMultiply,\n wrDecimalRound,\n} from 'ngwr/utils';\n\nimport type { WrInputNumberMode, WrInputNumberValue } from './types';\n\n/** Resolve the locale's decimal + grouping separators from `Intl.NumberFormat`. */\nfunction resolveSeparators(locale: string): { decimal: string; group: string } {\n const parts = new Intl.NumberFormat(locale).formatToParts(12345.6);\n const decimal = parts.find(p => p.type === 'decimal')?.value ?? '.';\n const group = parts.find(p => p.type === 'group')?.value ?? '';\n return { decimal, group };\n}\n\n/**\n * The ten digits `locale` writes, index 0 to 9 — empty when the system is\n * algorithmic. ar-EG prints `١٬٢٣٤٫٥`, and `Number()` reads none of those digits,\n * so an edit to the field's own display could never commit. A copy of the time\n * panel's helper in `ngwr/date-picker`, kept a copy for the reason given there.\n */\nfunction resolveNumerals(locale: string): readonly string[] {\n try {\n const formatter = new Intl.NumberFormat(locale, { useGrouping: false });\n const digits: string[] = [];\n for (let i = 0; i < 10; i++) {\n const digit = formatter.format(i);\n if ([...digit].length !== 1 || digits.includes(digit)) return [];\n digits.push(digit);\n }\n return digits;\n } catch {\n return [];\n }\n}\n\n/**\n * Characters a user types for a separator the locale prints as something else:\n * a keyboard sends a plain space where ru / uk / kk group with U+00A0 and fr with\n * U+202F, and a plain apostrophe where de-CH groups with U+2019.\n */\nfunction groupPattern(group: string): RegExp | null {\n if (!group) return null;\n if (/\\s/.test(group)) return /\\s/g;\n if (/['\\u2019]/.test(group)) return /['\\u2019]/g;\n return new RegExp(group.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&'), 'g');\n}\n\n/** A finite `min` / `max` as a decimal; an infinite one is no bound. */\nfunction decimalBound(bound: number): string | null {\n return Number.isFinite(bound) ? wrDecimal(bound) : null;\n}\n\n/**\n * `min` / `max` are numbers at runtime in either mode. The declared type is\n * `FormValueControl`'s, which names the bound after the value, so the number\n * is cast into it here and read back out in `minValue` / `maxValue`.\n */\nfunction asBound<M extends WrInputNumberMode>(bound: number): NonNullable<WrInputNumberValue<M>> {\n return bound as unknown as NonNullable<WrInputNumberValue<M>>;\n}\n\n/**\n * Numeric input with locale-aware formatting + ▲▼ stepper buttons.\n *\n * A signal-forms native control: it implements `FormValueControl`, so\n * `[formField]` binds straight to its `value` model — no\n * `ControlValueAccessor` in between. `[(value)]` works standalone.\n *\n * Parses leniently while typing (allows partial input like `\"1.\"` or `\"-\"`),\n * re-formats with grouping + fixed decimals on blur.\n *\n * `M` is the `mode`, and it decides what `value` holds: `number | null` by\n * default, `string | null` under `mode=\"decimal\"`, where the digits are kept\n * exact (see `WrInputNumberValue`).\n *\n * Locale comes from Angular's `LOCALE_ID` — input-number intentionally does\n * NOT depend on `ngwr/date` so it can be used in date-free apps.\n *\n * @example\n * ```html\n * <!-- signal forms -->\n * <wr-input-number [formField]=\"form.qty\" [min]=\"0\" [max]=\"100\" />\n *\n * <!-- standalone two-way binding -->\n * <wr-input-number [(value)]=\"price\" [decimals]=\"2\" suffix=\"USD\" />\n *\n * <!-- exact decimals: `amount` is a `string | null` such as '1234.56' -->\n * <wr-input-number mode=\"decimal\" [(value)]=\"amount\" [decimals]=\"2\" />\n * ```\n *\n * @see https://ngwr.dev/reference/components/input-number\n */\n@Component({\n selector: 'wr-input-number',\n templateUrl: './input-number.html',\n encapsulation: ViewEncapsulation.None,\n host: { '[class]': 'classes()' },\n imports: [WrInput, WrInputGroup, WrInputPrefix, WrInputSuffix],\n})\nexport class WrInputNumber<M extends WrInputNumberMode = 'number'> implements FormValueControl<WrInputNumberValue<M>> {\n /**\n * What `value` holds. `'number'` is the engine's double. `'decimal'` keeps\n * the typed digits exact as a canonical string (`'1234.56'`: a `.` for the\n * point, no grouping), reads a decimal comma and pasted spaces, and steps,\n * clamps and rounds through `wrDecimal` from `ngwr/utils`, so `0.2` stepped\n * by `0.1` is `'0.3'`. A lone `.` or `,` is read in the locale's role: its\n * decimal separator is a point, its grouping character is grouping when\n * exactly three digits follow it (`1,234` in en-US is `'1234'`, but `0,125`\n * is `'0.125'`) and a point otherwise. With both present,\n * the last one is the point: `1,234.56` and `1.234,56` are `'1234.56'`.\n * Grouping comes in threes, so `1.2.3` is unreadable and the committed\n * value stays, as it does for any text the field cannot read.\n *\n * @default 'number'\n */\n readonly mode = input<M>('number' as M);\n\n private readonly decimal = computed(() => this.mode() === 'decimal');\n\n /** Minimum allowed value, a number in either mode. @default -Infinity */\n readonly min = input<NonNullable<WrInputNumberValue<M>> | undefined, unknown>(asBound<M>(Number.NEGATIVE_INFINITY), {\n transform: (v: unknown) => asBound<M>(coerceNumberProperty(v, Number.NEGATIVE_INFINITY)),\n });\n\n /** Maximum allowed value, a number in either mode. @default Infinity */\n readonly max = input<NonNullable<WrInputNumberValue<M>> | undefined, unknown>(asBound<M>(Number.POSITIVE_INFINITY), {\n transform: (v: unknown) => asBound<M>(coerceNumberProperty(v, Number.POSITIVE_INFINITY)),\n });\n\n private readonly minValue = computed(() => (this.min() as number | undefined) ?? Number.NEGATIVE_INFINITY);\n private readonly maxValue = computed(() => (this.max() as number | undefined) ?? Number.POSITIVE_INFINITY);\n\n /** Step used by stepper buttons + arrow keys. @default 1 */\n readonly step = input(1, { transform: (v: unknown): number => Math.max(0, coerceNumberProperty(v, 1)) });\n\n /**\n * Fixed number of decimals. Rounds the value as it is COMMITTED, and fixes the\n * digits shown once the field reformats on blur. `null` keeps the entered\n * precision and formats with up to 20.\n *\n * Clamped to 0–100, the range `Intl.NumberFormat`'s `minimumFractionDigits` /\n * `maximumFractionDigits` accept — because it is the one numeric input on this\n * component that had no transform, and the value goes straight into the\n * formatter, which THROWS a `RangeError` outside that range rather than\n * degrading. A `[decimals]=\"-1\"` bound from a config object took the whole\n * component down on blur.\n *\n * @default null\n */\n readonly decimals = input<number | null, unknown>(null, {\n transform: (v: unknown): number | null =>\n v === null || v === undefined ? null : Math.min(100, Math.max(0, Math.trunc(coerceNumberProperty(v, 0)))),\n });\n\n /** Render the ▲▼ stepper column. @default true */\n readonly showSteppers = input(true, { transform: coerceBooleanProperty });\n\n /**\n * Control size — forwarded to the field's `[size]`, and shares the\n * `--wr-control-*` contract. @default 'md'\n */\n readonly size = input<WrInputSize>('md');\n\n /** Pill-shaped corners — forwarded to the group AND the field. @default false */\n readonly rounded = input(false, { transform: coerceBooleanProperty });\n\n /** Optional prefix label (e.g. `\"$\"`). */\n readonly prefix = input<string>('');\n\n /** Optional suffix label (e.g. `\"kg\"`). */\n readonly suffix = input<string>('');\n\n /** Placeholder shown when the input is empty. */\n readonly placeholder = input<string>('');\n\n /**\n * Accessible name for the field. Unset, the field is named by whatever labels\n * it — there is deliberately no fallback here.\n *\n * It used to mirror the `placeholder`, and an `aria-label` OUTRANKS a\n * `<label>` in the accname order: inside a `<wr-form-field label=\"Quantity\">`\n * the very input that adopts the field's id announced the placeholder (\"0\")\n * instead, and a placeholder disappears as soon as the user types. Standalone\n * nothing was lost by dropping it — an input with no other name already falls\n * back to its own `placeholder` attribute, which is the name axe's `label`\n * rule accepts too.\n */\n readonly ariaLabel = input<string | null>(null);\n\n protected readonly resolvedAriaLabel = computed(() => {\n // Not `??`: an empty binding is no name at all, and an empty `aria-label` is\n // worse than none — it still wins the accname order, and announces nothing.\n const explicit = this.ariaLabel();\n if (explicit) return explicit;\n return null;\n });\n\n /** Increment button aria-label. Falls back to `inputNumber.increment`. */\n readonly incrementLabel = input<string | null>(null);\n\n /** Decrement button aria-label. Falls back to `inputNumber.decrement`. */\n readonly decrementLabel = input<string | null>(null);\n\n /**\n * The steppers are icon-only buttons, so these ARE their accessible names.\n * They were hard-coded English while the catalog carried the keys for them\n * unread — a Russian app announced \"Increment\".\n */\n protected readonly resolvedIncrement = useI18nText(this.incrementLabel, 'inputNumber.increment', 'Increment');\n protected readonly resolvedDecrement = useI18nText(this.decrementLabel, 'inputNumber.decrement', 'Decrement');\n\n /** Disable interaction. @default false */\n readonly disabled = input(false, { transform: coerceBooleanProperty });\n\n /** Read-only — values cannot be changed (steppers + typing disabled). @default false */\n readonly readonly = input(false, { transform: coerceBooleanProperty });\n\n /**\n * The value, `null` when empty: a `number` in `'number'` mode, a canonical\n * decimal string in `'decimal'` mode. Bound by `[formField]`, or two-way via\n * `[(value)]`.\n */\n readonly value = model<WrInputNumberValue<M>>(null);\n\n /** Emitted on blur so a bound field can mark itself touched. */\n readonly touch = output<void>();\n\n private readonly locale = inject(LOCALE_ID);\n private readonly separators = resolveSeparators(this.locale);\n private readonly numerals = resolveNumerals(this.locale);\n private readonly group = groupPattern(this.separators.group);\n\n /** Text currently in the input (may be partial / invalid mid-type). */\n protected readonly text = signal<string>('');\n\n /** Whether the input is focused. While true, the input handlers own `text`. */\n protected readonly focused = signal(false);\n\n private readonly field = viewChild.required<ElementRef<HTMLInputElement>>('input');\n\n protected readonly interactive = computed(() => !this.disabled() && !this.readonly());\n\n /** The value as the decimal core reads it; `null` when empty or unreadable. */\n private readonly decimalValue = computed(() => {\n const v = this.value();\n return v === null ? null : wrDecimal(v);\n });\n\n protected readonly atMin = computed(() => {\n if (this.decimal()) return this.atDecimalBound(this.minValue(), -1);\n const v = this.value() as number | null;\n return v !== null && v <= this.minValue();\n });\n\n protected readonly atMax = computed(() => {\n if (this.decimal()) return this.atDecimalBound(this.maxValue(), 1);\n const v = this.value() as number | null;\n return v !== null && v >= this.maxValue();\n });\n\n private atDecimalBound(bound: number, side: -1 | 1): boolean {\n const v = this.decimalValue();\n const limit = decimalBound(bound);\n if (v === null || limit === null) return false;\n const order = wrDecimalCompare(v, limit);\n return order !== null && order * side >= 0;\n }\n\n /**\n * The size and pill modifiers mirror what is bound down to the chrome, because\n * the stepper column belongs to neither half of it: the field carries\n * `wr-input--<size>`, the column is its SIBLING, and the group carries no size\n * at all. Without a modifier of its own the column drew one 10x6 chevron at\n * every size and ran its dividers into a pill's rounded end.\n */\n protected readonly classes = computed(() => {\n const parts = ['wr-input-number'];\n const size = this.size();\n if (size !== 'md') parts.push(`wr-input-number--${size}`);\n if (this.rounded()) parts.push('wr-input-number--rounded');\n if (this.disabled()) parts.push('wr-input-number--disabled');\n return parts.join(' ');\n });\n\n /**\n * Fraction digits the stepper rounds its arithmetic to when `decimals` says\n * nothing. High enough to leave a real value alone, low enough to erase the\n * binary-float tail that repeated stepping accumulates.\n */\n private static readonly STEP_PRECISION = 10;\n\n /**\n * Above this, the anti-drift round is skipped — it would MANUFACTURE drift.\n *\n * `wrRound(v, 10)` is `Math.round((v + EPSILON) * 1e10) / 1e10`, and the scale\n * factor is only exact while `v * 1e10` stays inside 2^53, i.e. |v| under\n * about 900,720. In practice the round-trip still recovers up to ~9.2e8 and\n * then breaks: `wrRound(1000000001, 10)` is `1000000000.9999999`, and since\n * `format` prints up to 20 fraction digits that tail reaches the screen —\n * and compounds, because the next press starts from it. Integer stepping at\n * that magnitude is exact in IEEE754 and needed no help; the only thing this\n * rounding exists to defend is `0.1 + 0.1 + 0.1`.\n */\n private static readonly SAFE_ROUND_MAGNITUDE = 1e6;\n\n /** Steps finer than this would be rounded away by {@link STEP_PRECISION}. */\n private static readonly SAFE_ROUND_STEP = 1e-9;\n\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('input-number');\n // Keep the display `text` in sync with external writes to `value` (via\n // `[formField]` / `[(value)]`). While the user is editing, the input\n // handlers own `text`, so skip re-formatting to avoid clobbering partial\n // input (e.g. mid-typed grouping or a value that is still being clamped).\n effect(() => {\n const v = this.value();\n if (this.focused()) return;\n if (v === null || Number.isNaN(v)) {\n this.text.set('');\n return;\n }\n // SHOW WHAT THE MODEL HOLDS. It used to format `constrain(v)`, so a\n // `[max]=\"10\"` field handed 500 drew \"10\" over a model that still said\n // 500 — the display was the thing lying, not the model.\n //\n // The tempting repair is to write the clamp back so the two agree, and\n // that is worse: under `[formField]` the bounds arrive ONLY through the\n // schema's `min()` / `max()` rules (binding `[min]` next to `[formField]`\n // is an NG8022 compile error), so overwriting the value ERASES the very\n // error those rules exist to raise — and the write marks a pristine form\n // dirty, tripping unsaved-changes guards and opening every other\n // validator's message on first paint.\n //\n // So: `min` / `max` bound what this component's own edits may produce,\n // and a value written from outside is displayed as it is and left for\n // validation to judge.\n this.text.set(this.format(v));\n });\n }\n\n /**\n * Focus the text field — what Signal Forms calls to focus this control, from\n * `focusBoundControl()`. The host is a plain element, so without this the\n * call landed on something that cannot take focus and nothing moved.\n */\n focus(options?: FocusOptions): void {\n this.field().nativeElement.focus(options);\n }\n\n // Template handlers\n\n protected onInput(event: Event): void {\n const raw = (event.target as HTMLInputElement).value;\n this.text.set(raw);\n if (!raw.trim()) {\n this.commit(null);\n return;\n }\n if (this.decimal()) {\n const parsed = this.parseDecimal(raw);\n if (parsed === null) return; // partial or unreadable - the committed value stays\n this.commit(this.constrainDecimal(parsed));\n return;\n }\n const parsed = this.parse(raw);\n if (parsed === null) return; // partial input — wait for more\n const next = this.constrain(parsed);\n this.commit(next);\n }\n\n protected onFocus(): void {\n this.focused.set(true);\n }\n\n protected onBlur(): void {\n // Flipping `focused` false lets the sync effect re-format `text` from the\n // committed `value` (e.g. `\"1.\"` → `\"1\"`, or grouping the final number).\n this.focused.set(false);\n this.touch.emit();\n }\n\n protected onKeydown(event: KeyboardEvent): void {\n if (!this.interactive()) return;\n if (event.key !== 'ArrowUp' && event.key !== 'ArrowDown') return;\n event.preventDefault();\n const direction = event.key === 'ArrowUp' ? 1 : -1;\n const multiplier = event.shiftKey ? 10 : 1;\n this.bump(direction * multiplier);\n }\n\n protected stepBy(direction: 1 | -1): void {\n if (!this.interactive()) return;\n this.bump(direction);\n }\n\n // Internals\n\n /** The one write to `value`: what a mode holds is decided above, not here. */\n private commit(next: number | string | null): void {\n this.value.set(next as WrInputNumberValue<M>);\n }\n\n private bump(units: number): void {\n const stepSize = this.step() || 1;\n if (this.decimal()) {\n const base = this.decimalValue() ?? wrDecimal(this.fallbackBase()) ?? '0';\n const next = this.constrainDecimal(wrDecimalAdd(base, wrDecimalMultiply(stepSize, units)) ?? base);\n this.commit(next);\n this.text.set(this.format(next));\n return;\n }\n const base = (this.value() as number | null) ?? this.fallbackBase();\n // `wrRound` before `constrain`, and only on the stepped ARITHMETIC. Binary\n // floats do not add: three presses of a `step=\"0.1\"` stepper produced\n // 0.30000000000000004, `constrain` only rounds when `decimals` is set, and\n // `format` prints up to 20 fraction digits — so the drift went into the\n // model AND onto the screen. Ten digits erases IEEE noise without\n // quantising a value the user typed (0.15000000000000002 stays 0.15, it\n // does not snap to the step grid).\n //\n // Guarded on BOTH ends, because outside them the correction is the thing\n // that corrupts: see SAFE_ROUND_MAGNITUDE, and a step finer than 1e-9 would\n // simply be rounded away to nothing.\n const raw = base + units * stepSize;\n const correctable =\n Math.abs(raw) < WrInputNumber.SAFE_ROUND_MAGNITUDE && Math.abs(stepSize) >= WrInputNumber.SAFE_ROUND_STEP;\n const next = this.constrain(correctable ? wrRound(raw, WrInputNumber.STEP_PRECISION) : raw);\n this.commit(next);\n this.text.set(this.format(next));\n }\n\n /** Choose a sensible starting point when bumping from `null`. */\n private fallbackBase(): number {\n if (Number.isFinite(this.minValue()) && this.minValue() > 0) return this.minValue();\n if (Number.isFinite(this.maxValue()) && this.maxValue() < 0) return this.maxValue();\n return 0;\n }\n\n private constrain(v: number): number {\n let next = wrClamp(v, this.minValue(), this.maxValue());\n const d = this.decimals();\n if (d !== null) next = wrRound(next, d);\n return next;\n }\n\n /** `constrain` for a decimal string: the bounds and `decimals` through the decimal core. */\n private constrainDecimal(v: string): string {\n let next = v;\n const min = decimalBound(this.minValue());\n const max = decimalBound(this.maxValue());\n if (min !== null && wrDecimalCompare(next, min) === -1) next = min;\n if (max !== null && wrDecimalCompare(next, max) === 1) next = max;\n const d = this.decimals();\n if (d !== null) next = wrDecimalRound(next, d) ?? next;\n return next;\n }\n\n /**\n * The locale's digits to ASCII, its minus sign (U+2212 in sv, fi, …) to a\n * hyphen, and the bidi marks it puts around a negative number dropped — every\n * one of them is in the text this field formats, and neither `Number()` nor\n * `wrDecimal` reads them.\n */\n private toAscii(text: string): string {\n return [...text]\n .map(ch => {\n const digit = this.numerals.indexOf(ch);\n return digit < 0 ? ch : String(digit);\n })\n .join('')\n .replace(/[\\u200e\\u200f\\u061c]/g, '')\n .replace(/\\u2212/g, '-');\n }\n\n /**\n * Decimal-mode parse: a canonical decimal string, or `null` for partial or\n * unreadable text. Spaces of every width and the Swiss apostrophe are\n * grouping; `.` and `,` are read by the rule on `mode`, and a separator read\n * as grouping has to come in threes, so `1.2.3` is unreadable rather than 123.\n */\n private parseDecimal(raw: string): string | null {\n // fa and ar-EG write U+066B and U+066C, which the `.` and `,` rule never sees.\n const { decimal, group } = this.separators;\n const ownMarks = decimal !== '.' && decimal !== ',';\n let text = this.toAscii(raw.trim()).replace(/[\\s'\\u2019]/g, '');\n if (ownMarks) text = text.replaceAll(group, '').replaceAll(decimal, '.');\n const separators = [...text.matchAll(/[.,]/g)];\n if (separators.length) {\n const last = separators[separators.length - 1];\n let point: number | null = last.index;\n if (separators.length === 1) {\n // Three digits after the locale's grouping character is grouping,\n // unless nothing or a lone zero precedes it: `0,125` is a fraction.\n const after = text.length - last.index - 1;\n const lead = text.slice(0, last.index);\n if (last[0] !== (ownMarks ? '.' : decimal) && after === 3 && !/^-?0?$/.test(lead)) point = null;\n } else if (separators.every(s => s[0] === last[0])) {\n point = null;\n }\n const groups = (point === null ? text : text.slice(0, point)).split(/[.,]/);\n if (groups.slice(1).some(group => group.length !== 3)) return null;\n text = point === null ? groups.join('') : `${groups.join('')}.${text.slice(point + 1)}`;\n }\n if (/^-?\\.?$/.test(text) || text.endsWith('.')) return null;\n return wrDecimal(text);\n }\n\n /** Parse a locale-formatted string. Returns `null` for partial / not-yet-numeric input. */\n private parse(raw: string): number | null {\n const trimmed = raw.trim();\n if (!trimmed) return null;\n let normalised = this.toAscii(trimmed);\n // Strip group separators, normalise the decimal separator to `.`.\n if (this.group) {\n normalised = normalised.replace(this.group, '');\n }\n if (this.separators.decimal !== '.') {\n normalised = normalised.split(this.separators.decimal).join('.');\n }\n // Partial inputs we don't want to clobber while the user is still typing:\n // `-`, `-.`, `.`, `1.`, `-1.` etc.\n if (/^-?\\.?$/.test(normalised) || normalised.endsWith('.')) return null;\n const n = Number(normalised);\n return Number.isFinite(n) ? n : null;\n }\n\n /** Format a value using `Intl.NumberFormat` for the active locale. */\n private format(v: number | string): string {\n const d = this.decimals();\n if (this.decimal()) {\n const canonical = wrDecimal(v);\n if (canonical === null) return String(v);\n // The string's own places, so `'1.50'` shows as typed; `decimals` fixes them.\n const point = canonical.indexOf('.');\n const places = d ?? Math.min(100, point < 0 ? 0 : canonical.length - point - 1);\n const formatter = new Intl.NumberFormat(this.locale, {\n minimumFractionDigits: places,\n maximumFractionDigits: places,\n useGrouping: true,\n });\n // ES2023 formats a decimal string exactly; the lib typings here stop at ES2022.\n return formatter.format(canonical as unknown as number);\n }\n const formatter = new Intl.NumberFormat(this.locale, {\n minimumFractionDigits: d ?? 0,\n maximumFractionDigits: d ?? 20,\n useGrouping: true,\n });\n return formatter.format(v as number);\n }\n}\n","<wr-input-group [rounded]=\"rounded()\">\n @if (prefix(); as p) {\n <span wrInputPrefix>{{ p }}</span>\n }\n <input\n #input\n wrInput\n type=\"text\"\n inputmode=\"decimal\"\n autocomplete=\"off\"\n [size]=\"size()\"\n [rounded]=\"rounded()\"\n [attr.aria-label]=\"resolvedAriaLabel()\"\n spellcheck=\"false\"\n [value]=\"text()\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"disabled()\"\n [readonly]=\"readonly()\"\n (input)=\"onInput($event)\"\n (focus)=\"onFocus()\"\n (blur)=\"onBlur()\"\n (keydown)=\"onKeydown($event)\"\n />\n @if (suffix(); as s) {\n <span wrInputSuffix>{{ s }}</span>\n }\n @if (showSteppers()) {\n <div class=\"wr-input-number__steppers\" wrInputSuffix>\n <button\n type=\"button\"\n class=\"wr-input-number__step\"\n tabindex=\"-1\"\n [attr.aria-label]=\"resolvedIncrement()\"\n [disabled]=\"!interactive() || atMax()\"\n (click)=\"stepBy(1)\"\n >\n <svg\n class=\"wr-icon__svg\"\n width=\"14\"\n height=\"14\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n >\n <path d=\"m18 15-6-6-6 6\" />\n </svg>\n </button>\n <button\n type=\"button\"\n class=\"wr-input-number__step\"\n tabindex=\"-1\"\n [attr.aria-label]=\"resolvedDecrement()\"\n [disabled]=\"!interactive() || atMin()\"\n (click)=\"stepBy(-1)\"\n >\n <svg\n class=\"wr-icon__svg\"\n width=\"14\"\n height=\"14\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stro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A;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,GAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,aAAA;EAAA,CAAA;EAAA,OAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,OAAA;EAAA,CAAA;EAAA,OAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,SAAO,EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;CAAA;AAAA,CAAA"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as i0 from "@angular/core";
|
|
2
2
|
import { Component, Injector, ViewEncapsulation, afterNextRender, computed, effect, inject, input, model, output, signal, untracked, viewChildren } from "@angular/core";
|
|
3
3
|
import { coerceBooleanProperty, coerceNumberProperty } from "@angular/cdk/coercion";
|
|
4
|
-
import {
|
|
4
|
+
import { wrCheckStyles, wrIsComposing } from "ngwr/utils";
|
|
5
5
|
import { useI18nFormatter, useI18nText } from "ngwr/i18n";
|
|
6
6
|
import { Directionality } from "@angular/cdk/bidi";
|
|
7
7
|
import { useFormFieldAria } from "ngwr/form";
|
|
@@ -100,7 +100,7 @@ var WrInputOtp = class WrInputOtp {
|
|
|
100
100
|
if (char) this.focusCell(index + 1);
|
|
101
101
|
}
|
|
102
102
|
onKeyDown(event, index) {
|
|
103
|
-
if (
|
|
103
|
+
if (wrIsComposing(event)) return;
|
|
104
104
|
const target = event.target;
|
|
105
105
|
switch (this.inlineKey(event.key)) {
|
|
106
106
|
case "Backspace":
|