ngwr 15.8.0 → 16.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/animations/aurora/styles/_index.scss +1 -1
- package/animations/blur-reveal/styles/_index.scss +1 -1
- package/animations/decode/styles/_index.scss +1 -1
- package/animations/dot-grid/styles/_index.scss +1 -1
- package/animations/flow-lines/styles/_index.scss +1 -1
- package/animations/fluid-cursor/styles/_index.scss +1 -1
- package/animations/{core → internal}/styles/_mixins.scss +1 -1
- package/animations/reveal/styles/_index.scss +1 -1
- package/animations/ripple-grid/styles/_index.scss +1 -1
- package/animations/rotate-reveal/styles/_index.scss +1 -1
- package/animations/thread-lines/styles/_index.scss +1 -1
- package/animations/typewriter/styles/_index.scss +1 -1
- package/copy-value/styles/_index.scss +104 -0
- package/date-picker/styles/_index.scss +117 -0
- package/fesm2022/{ngwr-animations-core.mjs → internal-BaQU4t_0.mjs} +6 -49
- package/fesm2022/internal-BaQU4t_0.mjs.map +1 -0
- package/fesm2022/ngwr-alert.mjs +2 -2
- package/fesm2022/ngwr-alert.mjs.map +1 -1
- package/fesm2022/ngwr-animations-aurora.mjs +21 -21
- package/fesm2022/ngwr-animations-aurora.mjs.map +1 -1
- package/fesm2022/ngwr-animations-blur-reveal.mjs +3 -3
- package/fesm2022/ngwr-animations-blur-reveal.mjs.map +1 -1
- package/fesm2022/ngwr-animations-click-sparks.mjs +2 -2
- package/fesm2022/ngwr-animations-click-sparks.mjs.map +1 -1
- package/fesm2022/ngwr-animations-confetti.mjs +5 -5
- package/fesm2022/ngwr-animations-confetti.mjs.map +1 -1
- package/fesm2022/ngwr-animations-decode.mjs +4 -4
- package/fesm2022/ngwr-animations-decode.mjs.map +1 -1
- package/fesm2022/ngwr-animations-destruct.mjs +5 -5
- package/fesm2022/ngwr-animations-destruct.mjs.map +1 -1
- package/fesm2022/ngwr-animations-dot-grid.mjs +7 -7
- package/fesm2022/ngwr-animations-dot-grid.mjs.map +1 -1
- package/fesm2022/ngwr-animations-falling-letters.mjs +3 -3
- package/fesm2022/ngwr-animations-falling-letters.mjs.map +1 -1
- package/fesm2022/ngwr-animations-flow-lines.mjs +17 -17
- package/fesm2022/ngwr-animations-flow-lines.mjs.map +1 -1
- package/fesm2022/ngwr-animations-fluid-cursor.mjs +12 -12
- package/fesm2022/ngwr-animations-fluid-cursor.mjs.map +1 -1
- package/fesm2022/ngwr-animations-glitch.mjs +2 -2
- package/fesm2022/ngwr-animations-glitch.mjs.map +1 -1
- package/fesm2022/ngwr-animations-marquee.mjs +2 -2
- package/fesm2022/ngwr-animations-marquee.mjs.map +1 -1
- package/fesm2022/ngwr-animations-orbit.mjs +7 -7
- package/fesm2022/ngwr-animations-orbit.mjs.map +1 -1
- package/fesm2022/ngwr-animations-reveal.mjs +4 -4
- package/fesm2022/ngwr-animations-reveal.mjs.map +1 -1
- package/fesm2022/ngwr-animations-ripple-grid.mjs +5 -5
- package/fesm2022/ngwr-animations-ripple-grid.mjs.map +1 -1
- package/fesm2022/ngwr-animations-rotate-reveal.mjs +4 -4
- package/fesm2022/ngwr-animations-rotate-reveal.mjs.map +1 -1
- package/fesm2022/ngwr-animations-shimmer.mjs +2 -2
- package/fesm2022/ngwr-animations-shimmer.mjs.map +1 -1
- package/fesm2022/ngwr-animations-spotlight.mjs +1 -1
- package/fesm2022/ngwr-animations-spotlight.mjs.map +1 -1
- package/fesm2022/ngwr-animations-thread-lines.mjs +16 -16
- package/fesm2022/ngwr-animations-thread-lines.mjs.map +1 -1
- package/fesm2022/ngwr-animations-tilt.mjs +3 -3
- package/fesm2022/ngwr-animations-tilt.mjs.map +1 -1
- package/fesm2022/ngwr-animations-typewriter.mjs +4 -4
- package/fesm2022/ngwr-animations-typewriter.mjs.map +1 -1
- package/fesm2022/ngwr-avatar.mjs +3 -3
- package/fesm2022/ngwr-avatar.mjs.map +1 -1
- package/fesm2022/ngwr-badge.mjs.map +1 -1
- package/fesm2022/ngwr-cascader.mjs +43 -20
- package/fesm2022/ngwr-cascader.mjs.map +1 -1
- package/fesm2022/ngwr-charts-bar-chart.mjs +13 -13
- package/fesm2022/ngwr-charts-bar-chart.mjs.map +1 -1
- package/fesm2022/ngwr-charts-boxplot-chart.mjs +9 -9
- package/fesm2022/ngwr-charts-boxplot-chart.mjs.map +1 -1
- package/fesm2022/ngwr-charts-bullet-chart.mjs +8 -8
- package/fesm2022/ngwr-charts-bullet-chart.mjs.map +1 -1
- package/fesm2022/ngwr-charts-candlestick-chart.mjs +11 -11
- package/fesm2022/ngwr-charts-candlestick-chart.mjs.map +1 -1
- package/fesm2022/ngwr-charts-chart-legend.mjs +2 -2
- package/fesm2022/ngwr-charts-chart-legend.mjs.map +1 -1
- package/fesm2022/ngwr-charts-core.mjs +20 -20
- package/fesm2022/ngwr-charts-core.mjs.map +1 -1
- package/fesm2022/ngwr-charts-donut-chart.mjs +2 -2
- package/fesm2022/ngwr-charts-donut-chart.mjs.map +1 -1
- package/fesm2022/ngwr-charts-funnel-chart.mjs +6 -6
- package/fesm2022/ngwr-charts-funnel-chart.mjs.map +1 -1
- package/fesm2022/ngwr-charts-gauge.mjs +3 -3
- package/fesm2022/ngwr-charts-gauge.mjs.map +1 -1
- package/fesm2022/ngwr-charts-heatmap-chart.mjs +3 -3
- package/fesm2022/ngwr-charts-heatmap-chart.mjs.map +1 -1
- package/fesm2022/ngwr-charts-line-chart.mjs +10 -10
- package/fesm2022/ngwr-charts-line-chart.mjs.map +1 -1
- package/fesm2022/ngwr-charts-meter-group.mjs +2 -2
- package/fesm2022/ngwr-charts-meter-group.mjs.map +1 -1
- package/fesm2022/ngwr-charts-radar-chart.mjs +11 -11
- package/fesm2022/ngwr-charts-radar-chart.mjs.map +1 -1
- package/fesm2022/ngwr-charts-scatter-chart.mjs +10 -10
- package/fesm2022/ngwr-charts-scatter-chart.mjs.map +1 -1
- package/fesm2022/ngwr-charts-treemap-chart.mjs +4 -4
- package/fesm2022/ngwr-charts-treemap-chart.mjs.map +1 -1
- package/fesm2022/ngwr-charts-waterfall-chart.mjs +7 -7
- package/fesm2022/ngwr-charts-waterfall-chart.mjs.map +1 -1
- package/fesm2022/ngwr-checkbox.mjs +2 -2
- package/fesm2022/ngwr-checkbox.mjs.map +1 -1
- package/fesm2022/ngwr-collapse.mjs +2 -2
- package/fesm2022/ngwr-collapse.mjs.map +1 -1
- package/fesm2022/ngwr-color-picker.mjs +52 -52
- package/fesm2022/ngwr-color-picker.mjs.map +1 -1
- package/fesm2022/ngwr-command-palette.mjs +4 -4
- package/fesm2022/ngwr-command-palette.mjs.map +1 -1
- package/fesm2022/ngwr-comment.mjs +2 -2
- package/fesm2022/ngwr-comment.mjs.map +1 -1
- package/fesm2022/ngwr-compare.mjs +6 -6
- package/fesm2022/ngwr-compare.mjs.map +1 -1
- package/fesm2022/ngwr-context-menu.mjs +4 -4
- package/fesm2022/ngwr-context-menu.mjs.map +1 -1
- package/fesm2022/ngwr-copy-value-testing.mjs +58 -0
- package/fesm2022/ngwr-copy-value-testing.mjs.map +1 -0
- package/fesm2022/ngwr-copy-value.mjs +196 -0
- package/fesm2022/ngwr-copy-value.mjs.map +1 -0
- package/fesm2022/ngwr-counter.mjs +3 -3
- package/fesm2022/ngwr-counter.mjs.map +1 -1
- package/fesm2022/ngwr-date-picker-testing.mjs.map +1 -1
- package/fesm2022/ngwr-date-picker.mjs +217 -40
- package/fesm2022/ngwr-date-picker.mjs.map +1 -1
- package/fesm2022/ngwr-date.mjs +27 -5
- package/fesm2022/ngwr-date.mjs.map +1 -1
- package/fesm2022/ngwr-dialog.mjs +32 -3
- package/fesm2022/ngwr-dialog.mjs.map +1 -1
- package/fesm2022/ngwr-directives.mjs +116 -1
- package/fesm2022/ngwr-directives.mjs.map +1 -1
- package/fesm2022/ngwr-drawer.mjs +3 -3
- package/fesm2022/ngwr-drawer.mjs.map +1 -1
- package/fesm2022/ngwr-dropdown.mjs +13 -12
- package/fesm2022/ngwr-dropdown.mjs.map +1 -1
- package/fesm2022/ngwr-editor.mjs +28 -28
- package/fesm2022/ngwr-editor.mjs.map +1 -1
- package/fesm2022/ngwr-event-calendar.mjs +5 -5
- package/fesm2022/ngwr-event-calendar.mjs.map +1 -1
- package/fesm2022/ngwr-file-upload.mjs +8 -8
- package/fesm2022/ngwr-file-upload.mjs.map +1 -1
- package/fesm2022/ngwr-graph.mjs +3 -3
- package/fesm2022/ngwr-graph.mjs.map +1 -1
- package/fesm2022/ngwr-hotkey.mjs +22 -22
- package/fesm2022/ngwr-hotkey.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-ar.mjs +5 -0
- package/fesm2022/ngwr-i18n-ar.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-cs.mjs +5 -0
- package/fesm2022/ngwr-i18n-cs.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-de.mjs +5 -0
- package/fesm2022/ngwr-i18n-de.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-en.mjs +5 -0
- package/fesm2022/ngwr-i18n-en.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-es.mjs +5 -0
- package/fesm2022/ngwr-i18n-es.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-fr.mjs +5 -0
- package/fesm2022/ngwr-i18n-fr.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-he.mjs +5 -0
- package/fesm2022/ngwr-i18n-he.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-hi.mjs +5 -0
- package/fesm2022/ngwr-i18n-hi.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-id.mjs +5 -0
- package/fesm2022/ngwr-i18n-id.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-it.mjs +5 -0
- package/fesm2022/ngwr-i18n-it.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-ja.mjs +5 -0
- package/fesm2022/ngwr-i18n-ja.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-ko.mjs +5 -0
- package/fesm2022/ngwr-i18n-ko.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-nl.mjs +5 -0
- package/fesm2022/ngwr-i18n-nl.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-pl.mjs +5 -0
- package/fesm2022/ngwr-i18n-pl.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-pt.mjs +5 -0
- package/fesm2022/ngwr-i18n-pt.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-ru.mjs +5 -0
- package/fesm2022/ngwr-i18n-ru.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-sv.mjs +5 -0
- package/fesm2022/ngwr-i18n-sv.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-tr.mjs +5 -0
- package/fesm2022/ngwr-i18n-tr.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-uk.mjs +5 -0
- package/fesm2022/ngwr-i18n-uk.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-vi.mjs +5 -0
- package/fesm2022/ngwr-i18n-vi.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-zh-tw.mjs +5 -0
- package/fesm2022/ngwr-i18n-zh-tw.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-zh.mjs +5 -0
- package/fesm2022/ngwr-i18n-zh.mjs.map +1 -1
- package/fesm2022/ngwr-i18n.mjs +2 -2
- package/fesm2022/ngwr-i18n.mjs.map +1 -1
- package/fesm2022/ngwr-icon.mjs +5 -5
- package/fesm2022/ngwr-icon.mjs.map +1 -1
- package/fesm2022/ngwr-image-cropper.mjs +11 -11
- package/fesm2022/ngwr-image-cropper.mjs.map +1 -1
- package/fesm2022/ngwr-input-number.mjs +4 -4
- package/fesm2022/ngwr-input-number.mjs.map +1 -1
- package/fesm2022/ngwr-input-otp.mjs +2 -2
- package/fesm2022/ngwr-input-otp.mjs.map +1 -1
- package/fesm2022/ngwr-input.mjs +15 -15
- package/fesm2022/ngwr-input.mjs.map +1 -1
- package/fesm2022/ngwr-keyboard.mjs +28 -28
- package/fesm2022/ngwr-keyboard.mjs.map +1 -1
- package/fesm2022/ngwr-knob.mjs +4 -4
- package/fesm2022/ngwr-knob.mjs.map +1 -1
- package/fesm2022/ngwr-lightbox.mjs +2 -2
- package/fesm2022/ngwr-lightbox.mjs.map +1 -1
- package/fesm2022/ngwr-load-state.mjs +2 -2
- package/fesm2022/ngwr-load-state.mjs.map +1 -1
- package/fesm2022/ngwr-mention.mjs +6 -6
- package/fesm2022/ngwr-mention.mjs.map +1 -1
- package/fesm2022/ngwr-meta.mjs +19 -3
- package/fesm2022/ngwr-meta.mjs.map +1 -1
- package/fesm2022/ngwr-overlay.mjs +3 -3
- package/fesm2022/ngwr-overlay.mjs.map +1 -1
- package/fesm2022/ngwr-pagination.mjs +7 -5
- package/fesm2022/ngwr-pagination.mjs.map +1 -1
- package/fesm2022/ngwr-pipes.mjs +3 -5
- package/fesm2022/ngwr-pipes.mjs.map +1 -1
- package/fesm2022/ngwr-platform.mjs +4 -1
- package/fesm2022/ngwr-platform.mjs.map +1 -1
- package/fesm2022/ngwr-popconfirm.mjs +6 -5
- package/fesm2022/ngwr-popconfirm.mjs.map +1 -1
- package/fesm2022/ngwr-popover.mjs +31 -30
- package/fesm2022/ngwr-popover.mjs.map +1 -1
- package/fesm2022/ngwr-pull-to-refresh.mjs +2 -2
- package/fesm2022/ngwr-pull-to-refresh.mjs.map +1 -1
- package/fesm2022/ngwr-qr.mjs +6 -6
- package/fesm2022/ngwr-qr.mjs.map +1 -1
- package/fesm2022/ngwr-radio.mjs +3 -3
- package/fesm2022/ngwr-radio.mjs.map +1 -1
- package/fesm2022/ngwr-rating.mjs +10 -10
- package/fesm2022/ngwr-rating.mjs.map +1 -1
- package/fesm2022/ngwr-schema-form.mjs +15 -5
- package/fesm2022/ngwr-schema-form.mjs.map +1 -1
- package/fesm2022/ngwr-select.mjs +57 -34
- package/fesm2022/ngwr-select.mjs.map +1 -1
- package/fesm2022/ngwr-sidebar.mjs +3 -3
- package/fesm2022/ngwr-sidebar.mjs.map +1 -1
- package/fesm2022/ngwr-skeleton.mjs +2 -2
- package/fesm2022/ngwr-skeleton.mjs.map +1 -1
- package/fesm2022/ngwr-slider-testing.mjs.map +1 -1
- package/fesm2022/ngwr-slider.mjs +13 -13
- package/fesm2022/ngwr-slider.mjs.map +1 -1
- package/fesm2022/ngwr-sortable-list.mjs +3 -3
- package/fesm2022/ngwr-sortable-list.mjs.map +1 -1
- package/fesm2022/ngwr-splitter.mjs +5 -5
- package/fesm2022/ngwr-splitter.mjs.map +1 -1
- package/fesm2022/ngwr-statistic.mjs +5 -3
- package/fesm2022/ngwr-statistic.mjs.map +1 -1
- package/fesm2022/ngwr-storage.mjs +6 -4
- package/fesm2022/ngwr-storage.mjs.map +1 -1
- package/fesm2022/ngwr-switch.mjs +2 -2
- package/fesm2022/ngwr-switch.mjs.map +1 -1
- package/fesm2022/ngwr-table-testing.mjs.map +1 -1
- package/fesm2022/ngwr-table.mjs +263 -32
- package/fesm2022/ngwr-table.mjs.map +1 -1
- package/fesm2022/ngwr-tabs.mjs +2 -2
- package/fesm2022/ngwr-tabs.mjs.map +1 -1
- package/fesm2022/ngwr-toast-testing.mjs +8 -1
- package/fesm2022/ngwr-toast-testing.mjs.map +1 -1
- package/fesm2022/ngwr-toast.mjs +63 -20
- package/fesm2022/ngwr-toast.mjs.map +1 -1
- package/fesm2022/ngwr-tour.mjs +7 -7
- package/fesm2022/ngwr-tour.mjs.map +1 -1
- package/fesm2022/ngwr-transfer.mjs +20 -9
- package/fesm2022/ngwr-transfer.mjs.map +1 -1
- package/fesm2022/ngwr-tree.mjs +64 -24
- package/fesm2022/ngwr-tree.mjs.map +1 -1
- package/fesm2022/ngwr-utils.mjs +98 -55
- package/fesm2022/ngwr-utils.mjs.map +1 -1
- package/fesm2022/ngwr-validators.mjs +2 -2
- package/fesm2022/ngwr-validators.mjs.map +1 -1
- package/fesm2022/ngwr-version.mjs +1 -1
- package/fesm2022/ngwr-version.mjs.map +1 -1
- package/fesm2022/ngwr-window.mjs +26 -26
- package/fesm2022/ngwr-window.mjs.map +1 -1
- package/fesm2022/ngwr.mjs.map +1 -1
- package/i18n/ar.json +5 -0
- package/i18n/cs.json +5 -0
- package/i18n/de.json +5 -0
- package/i18n/en.json +5 -0
- package/i18n/es.json +5 -0
- package/i18n/fr.json +5 -0
- package/i18n/he.json +5 -0
- package/i18n/hi.json +5 -0
- package/i18n/id.json +5 -0
- package/i18n/it.json +5 -0
- package/i18n/ja.json +5 -0
- package/i18n/ko.json +5 -0
- package/i18n/nl.json +5 -0
- package/i18n/pl.json +5 -0
- package/i18n/pt.json +5 -0
- package/i18n/ru.json +5 -0
- package/i18n/sv.json +5 -0
- package/i18n/tr.json +5 -0
- package/i18n/uk.json +5 -0
- package/i18n/vi.json +5 -0
- package/i18n/zh-TW.json +5 -0
- package/i18n/zh.json +5 -0
- package/input-number/styles/_index.scss +6 -0
- package/llms-full.txt +31 -19
- package/llms.txt +37 -19
- package/mcp/providers.js +1 -1
- package/package.json +15 -10
- package/pagination/styles/_index.scss +8 -0
- package/schematics/icon-set/index.js +3 -3
- package/schematics/migrations/v16/index.js +742 -0
- package/schematics/migrations.json +5 -0
- package/schematics/ng-add/index.js +4 -4
- package/schematics/provider/index.js +4 -4
- package/schematics/use/symbol-map.json +2 -0
- package/select/styles/_index.scss +1 -1
- package/skills/ngwr/SKILL.md +6 -4
- package/skills/ngwr/references/catalog.md +4 -2
- package/skills/ngwr/references/setup.md +10 -9
- package/table/styles/_index.scss +92 -30
- package/toast/styles/_index.scss +30 -0
- package/tree/styles/_index.scss +17 -0
- package/types/index-CXbgza47.d.ts +13 -0
- package/types/ngwr-animations-aurora.d.ts +1 -1
- package/types/ngwr-animations-blur-reveal.d.ts +2 -2
- package/types/ngwr-animations-dot-grid.d.ts +1 -2
- package/types/ngwr-animations-flow-lines.d.ts +1 -1
- package/types/ngwr-animations-fluid-cursor.d.ts +1 -1
- package/types/ngwr-animations-reveal.d.ts +4 -8
- package/types/ngwr-animations-ripple-grid.d.ts +1 -1
- package/types/ngwr-animations-spotlight.d.ts +1 -1
- package/types/ngwr-animations-thread-lines.d.ts +1 -1
- package/types/ngwr-animations-tilt.d.ts +1 -1
- package/types/ngwr-avatar.d.ts +2 -2
- package/types/ngwr-badge.d.ts +1 -1
- package/types/ngwr-cascader.d.ts +12 -1
- package/types/ngwr-charts-boxplot-chart.d.ts +1 -1
- package/types/ngwr-charts-bullet-chart.d.ts +2 -2
- package/types/ngwr-charts-candlestick-chart.d.ts +1 -1
- package/types/ngwr-charts-core.d.ts +12 -12
- package/types/ngwr-charts-line-chart.d.ts +2 -2
- package/types/ngwr-charts-radar-chart.d.ts +1 -1
- package/types/ngwr-charts-scatter-chart.d.ts +2 -2
- package/types/ngwr-charts-waterfall-chart.d.ts +1 -1
- package/types/ngwr-color-picker.d.ts +12 -12
- package/types/ngwr-copy-value-testing.d.ts +87 -0
- package/types/ngwr-copy-value.d.ts +95 -0
- package/types/ngwr-date-picker-testing.d.ts +3 -3
- package/types/ngwr-date-picker.d.ts +97 -1
- package/types/ngwr-date.d.ts +44 -3
- package/types/ngwr-dialog.d.ts +50 -3
- package/types/ngwr-directives.d.ts +40 -0
- package/types/ngwr-drawer.d.ts +1 -1
- package/types/ngwr-dropdown.d.ts +3 -2
- package/types/ngwr-hotkey.d.ts +5 -5
- package/types/ngwr-i18n.d.ts +3 -3
- package/types/ngwr-icon.d.ts +26 -26
- package/types/ngwr-input-number.d.ts +2 -2
- package/types/ngwr-input.d.ts +8 -8
- package/types/ngwr-load-state.d.ts +6 -6
- package/types/ngwr-meta.d.ts +18 -0
- package/types/ngwr-pipes.d.ts +6 -4
- package/types/ngwr-platform.d.ts +2 -1
- package/types/ngwr-popconfirm.d.ts +3 -2
- package/types/ngwr-popover.d.ts +4 -3
- package/types/ngwr-select.d.ts +33 -18
- package/types/ngwr-slider-testing.d.ts +2 -2
- package/types/ngwr-slider.d.ts +3 -3
- package/types/ngwr-statistic.d.ts +5 -1
- package/types/ngwr-storage.d.ts +1 -1
- package/types/ngwr-table-testing.d.ts +2 -1
- package/types/ngwr-table.d.ts +155 -18
- package/types/ngwr-tabs.d.ts +10 -2
- package/types/ngwr-toast-testing.d.ts +6 -2
- package/types/ngwr-toast.d.ts +33 -5
- package/types/ngwr-transfer.d.ts +5 -0
- package/types/ngwr-tree.d.ts +22 -2
- package/types/ngwr-utils.d.ts +157 -82
- package/types/ngwr-validators.d.ts +4 -2
- package/types/ngwr-version.d.ts +1 -1
- package/types/ngwr.d.ts +1 -0
- package/types/pointer-tracker-D7fXxLQL.d.ts +24 -0
- package/fesm2022/ngwr-animations-core.mjs.map +0 -1
- package/types/ngwr-animations-core.d.ts +0 -294
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ngwr-validators.mjs","names":[],"sources":["../../../projects/lib/validators/wr-validators.ts"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { isDevMode } from '@angular/core';\nimport { type AbstractControl, type ValidationErrors, type ValidatorFn } from '@angular/forms';\n\nimport { toLocalDate } from 'ngwr/date';\n\nfunction stringValue(control: AbstractControl): string {\n const v: unknown = control.value;\n if (v == null) return '';\n if (typeof v === 'string') return v.trim();\n if (typeof v === 'number' || typeof v === 'boolean') return String(v).trim();\n return '';\n}\n\n/** Like {@link stringValue} but preserves whitespace — for checks that inspect spacing. */\nfunction rawStringValue(control: AbstractControl): string {\n const v: unknown = control.value;\n if (v == null) return '';\n if (typeof v === 'string') return v;\n if (typeof v === 'number' || typeof v === 'boolean') return String(v);\n return '';\n}\n\n/**\n * `localhost` or a dotted name, then a port: a host the user typed without a\n * scheme, not a scheme of that name. A one-label name (`tel:911`) is left a\n * scheme, since nothing in the text tells the two apart; so is `myhost:8080`.\n */\nconst HOST_WITH_PORT = /^(?:localhost|[a-z0-9-]+(?:\\.[a-z0-9-]+)+):\\d+(?:[/?#]|$)/i;\n\n/** Luhn checksum. Returns true when the digit string is a valid card number. */\nfunction luhn(digits: string): boolean {\n let sum = 0;\n let dbl = false;\n for (let i = digits.length - 1; i >= 0; i--) {\n let d = digits.charCodeAt(i) - 48;\n if (dbl) {\n d *= 2;\n if (d > 9) d -= 9;\n }\n sum += d;\n dbl = !dbl;\n }\n return sum % 10 === 0;\n}\n\n/** ISO 13616 mod-97 check for IBANs. Returns the remainder; valid IBANs yield 1. */\nfunction mod97(iban: string): number {\n // Move first 4 chars to the end + convert letters to digits (A=10..Z=35).\n const rearranged = iban.slice(4) + iban.slice(0, 4);\n let expanded = '';\n for (let i = 0; i < rearranged.length; i++) {\n const code = rearranged.charCodeAt(i);\n if (code >= 65 && code <= 90) expanded += (code - 55).toString();\n else expanded += rearranged.charAt(i);\n }\n // Apply mod 97 in chunks — BigInt isn't necessary.\n let remainder = 0;\n for (let i = 0; i < expanded.length; i += 7) {\n const slice = remainder.toString() + expanded.substring(i, i + 7);\n remainder = Number.parseInt(slice, 10) % 97;\n }\n return remainder;\n}\n\n/**\n * A bound or a value as milliseconds. A date-only string (`'2026-01-01'`) is that\n * day's LOCAL midnight — see `toLocalDate` — so `minDate('2026-01-01')` accepts the\n * 1 January a date picker emits, in every zone.\n */\nfunction toMs(value: unknown): number {\n if (value instanceof Date) return value.getTime();\n if (typeof value !== 'string' && typeof value !== 'number') return Number.NaN;\n return toLocalDate(value).getTime();\n}\n\n/**\n * Bundled `ValidatorFn`s — pure functions, no DOM, no DI. (`matchFields` keeps\n * one bit of per-instance state, a latch so its dev-mode misconfiguration\n * warning fires once rather than on every validation run; it is never read as\n * part of the result.) Mirrors the API shape of Angular's built-in\n * `Validators` so it composes cleanly:\n *\n * ```ts\n * import { Validators } from '@angular/forms';\n * import { WrValidators } from 'ngwr/validators';\n *\n * new FormControl('', [\n * Validators.required,\n * WrValidators.cardNumber,\n * WrValidators.cvc(3),\n * WrValidators.match('password'),\n * WrValidators.oneOf(['xs', 'sm', 'md', 'lg', 'xl']),\n * ]);\n * ```\n *\n * Each error is keyed under the validator name (e.g. `cardNumber`,\n * `cvc`, `iban`) so consumers can branch in templates.\n *\n * Anything Angular already ships (`required`, `email`, `min`, `max`,\n * `pattern`, …) is deliberately NOT duplicated here.\n *\n * @see https://ngwr.dev/reference/validators\n */\nexport const WrValidators = {\n // String shape\n\n /** No whitespace anywhere in the value. */\n noWhitespace: (control: AbstractControl): ValidationErrors | null => {\n const v = rawStringValue(control);\n if (v === '') return null;\n return /\\s/.test(v) ? { noWhitespace: true } : null;\n },\n\n /** 3, 4, 6, or 8-digit hex colour (`#abc`, `#1a2b3c`, `#1a2b3c4d`). */\n hexColor: (control: AbstractControl): ValidationErrors | null => {\n const v = stringValue(control);\n if (v === '') return null;\n return /^#([0-9a-f]{3}|[0-9a-f]{4}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(v) ? null : { hexColor: true };\n },\n\n // Network / payments\n\n /**\n * Valid URL. Accepts any scheme by default; pass `{ protocols: ['https'] }`\n * to restrict. A scheme is required by default; pass `{ requireProtocol: false }`\n * to also accept bare domains (e.g. `ngwr.dev`), assuming `https`. `localhost`\n * or a dotted name followed by a port (`ngwr.dev:8080`) is a bare domain, not a\n * scheme called `ngwr.dev`.\n */\n url: (options: { readonly protocols?: readonly string[]; readonly requireProtocol?: boolean } = {}): ValidatorFn => {\n const allow = options.protocols?.map(p => p.replace(/:$/, '').toLowerCase());\n const requireProtocol = options.requireProtocol ?? true;\n return (control: AbstractControl): ValidationErrors | null => {\n const v = stringValue(control);\n if (v === '') return null;\n // Without a scheme `new URL()` always throws, so this is the input it\n // cannot take — plus a host with a port. `localhost:4200` and\n // `ngwr.dev:443/docs` PARSE, the name before the colon being a legal\n // scheme and the port a legal path, and nobody typing one meant a scheme\n // called `localhost`.\n if (HOST_WITH_PORT.test(v) || !/^[a-z][a-z0-9+.-]*:/i.test(v)) {\n if (requireProtocol) return { url: true };\n // Bare domain support: when protocols aren't required, retry assuming\n // `https://`.\n let retried: URL;\n try {\n retried = new URL(`https://${v}`);\n } catch {\n return { url: true };\n }\n // Unreachable, and kept as a guard rather than deleted. `https` is a\n // WHATWG \"special\" scheme, which may not have an empty host, so\n // `new URL('https://' + v)` either threw above or produced one —\n // there is no `v` that lands here (checked by brute force over\n // two-character ASCII as well as by the spec). It stays because the\n // line above is the only thing making that true, and a future retry\n // through a non-special scheme would need it back.\n if (retried.host === '') {\n return { url: true };\n }\n if (allow && !allow.includes('https')) {\n return { url: { allowed: allow } };\n }\n return null;\n }\n let parsed: URL;\n try {\n parsed = new URL(v);\n } catch {\n return { url: true };\n }\n const protocol = parsed.protocol.replace(/:$/, '').toLowerCase();\n // WHATWG auto-inserts the authority for \"special\" schemes, so `http:host`\n // (missing `//`) still parses. Require the explicit `//` for those.\n const needsAuthority = ['http', 'https', 'ws', 'wss', 'ftp', 'file'].includes(protocol);\n if (needsAuthority && !/^[a-z][a-z0-9+.-]*:\\/\\//i.test(v)) {\n return { url: true };\n }\n if (allow && !allow.includes(protocol)) {\n return { url: { allowed: allow } };\n }\n return null;\n };\n },\n\n /** Credit card number — Luhn check + 13-19 digit length. Spaces and dashes are stripped first. */\n cardNumber: (control: AbstractControl): ValidationErrors | null => {\n const raw = stringValue(control).replace(/[\\s-]/g, '');\n if (raw === '') return null;\n if (!/^\\d{13,19}$/.test(raw)) return { cardNumber: true };\n return luhn(raw) ? null : { cardNumber: true };\n },\n\n /** CVC / CVV — N digits (default 3). Common: 3 for Visa/MC, 4 for Amex. */\n cvc: (length = 3): ValidatorFn => {\n const re = new RegExp(`^\\\\d{${length}}$`);\n return (control: AbstractControl): ValidationErrors | null => {\n const v = stringValue(control);\n if (v === '') return null;\n return re.test(v) ? null : { cvc: { length } };\n };\n },\n\n /**\n * IBAN — basic structure (CC + 2 digits + up to 30 alphanumerics) +\n * the mod-97 check. Country-length tables not enforced.\n */\n iban: (control: AbstractControl): ValidationErrors | null => {\n const raw = stringValue(control).replace(/\\s/g, '').toUpperCase();\n if (raw === '') return null;\n if (!/^[A-Z]{2}\\d{2}[A-Z0-9]{4,30}$/.test(raw)) return { iban: true };\n return mod97(raw) === 1 ? null : { iban: true };\n },\n\n // Cross-field\n\n /**\n * Value must equal a sibling control's value (e.g. confirm-password).\n * The target lookup uses `control.parent.get(name)`, so it works\n * inside `FormGroup` and nested groups.\n *\n * **It cannot report a mismatch until something revalidates the control.**\n * Angular runs a control's validators inside the control's own constructor,\n * before the control has a parent — so the lookup finds nothing and this\n * returns `null`, and attaching the control to a group does not re-run it.\n *\n * `formControlName` revalidates when it binds, so a group rendered through\n * the reactive-forms directives corrects itself on its first change\n * detection. The window is open for everything that reads validity BEFORE\n * that: a route guard or resolver checking `form.valid`, a form built and\n * submitted from a service, a unit test. Such a group reports itself valid\n * with two values that plainly disagree.\n *\n * Put {@link WrValidators.matchFields} on the group to close it, and keep\n * this one on the child for the per-field message. They do not conflict —\n * different error keys, different hosts.\n *\n * @see WrValidators.matchFields\n */\n match: (targetName: string): ValidatorFn => {\n return (control: AbstractControl): ValidationErrors | null => {\n const target = control.parent?.get(targetName);\n if (!target) return null;\n return control.value === target.value ? null : { match: { target: targetName } };\n };\n },\n\n /**\n * Every named control must hold the same value — the group-level counterpart\n * to {@link WrValidators.match}. Attach it to the group that OWNS the fields,\n * not to one of its children.\n *\n * Unlike `match` this has no ordering hole: Angular attaches the children and\n * aggregates their values BEFORE it runs the group's own validators, so a\n * group built from a record whose fields already disagree is invalid the\n * moment it exists — no revalidation step, and nothing that depends on the\n * form having been rendered.\n *\n * Names are `AbstractControl.get()` paths, so `'billing.zip'` reaches into a\n * nested group. `null`, `undefined` and `''` all count as the same empty\n * value; everything else is compared with `===`, so two equal `Date`s are NOT\n * equal — compare a derived primitive instead. **Disabled controls are\n * skipped**, which makes the rule compare exactly what `group.value`\n * contains, and the error names only the controls it actually compared.\n *\n * A name that resolves to nothing, or to a group or an array rather than a\n * leaf control, turns the whole check off and warns once per validator\n * instance in dev — never a partial comparison of the names that did\n * resolve, and never an error the user has no way to satisfy.\n *\n * The error lands on the GROUP, and `<wr-form-field>` only reads the one\n * control projected into it — so pair this with `match` for a per-field\n * message, or render it yourself from `form.hasError('matchFields')`.\n *\n * @example\n * ```ts\n * new FormGroup(\n * {\n * password: new FormControl(''),\n * confirm: new FormControl('', [WrValidators.match('password')]),\n * },\n * { validators: [WrValidators.matchFields('password', 'confirm')] },\n * );\n * ```\n */\n matchFields: (first: string, second: string, ...rest: readonly string[]): ValidatorFn => {\n // Frozen because the payload hands these names out: a consumer who mutated\n // the array would be editing the validator's own configuration, and a\n // `push` of a name that resolves to nothing switches the check OFF — the\n // form then goes valid with two values that plainly disagree.\n const fields: readonly string[] = Object.freeze([first, second, ...rest]);\n\n // Per-instance, never module-level: a shared latch is process-wide state\n // under SSR, where one request's warning would silence every later one.\n let warned = false;\n\n const warn = (message: string): void => {\n if (!isDevMode() || warned) return;\n warned = true;\n // `warn`, not `error`: a prerender worker forwards app console errors as\n // `ERROR …` and `scripts/build/showcase-app.ts` fails the build on them —\n // and adding the control later is a legitimate pattern, not a red build.\n // Reported rather than thrown for the same reason.\n // eslint-disable-next-line no-console -- a silent pass is the very bug this validator removes\n console.warn(`[NGWR] matchFields: ${message} — the check did not run.`);\n };\n\n return (group: AbstractControl): ValidationErrors | null => {\n const compared: string[] = [];\n const values: unknown[] = [];\n\n for (const name of fields) {\n const found = group.get(name);\n if (!found) {\n warn(`no control at \"${name}\". Names are AbstractControl.get() paths, relative to this group`);\n return null;\n }\n\n // A group or an array RESOLVES, so it slips past the check above and\n // would then be compared by reference against another container —\n // never equal, whatever the user types. `'billing'` instead of\n // `'billing.zip'` is the easy mistake, and it makes a form that can\n // never be submitted and says nothing about why.\n if ('controls' in found) {\n warn(`\"${name}\" is a group or an array; name a leaf control, e.g. \"${name}.<field>\"`);\n return null;\n }\n\n // A disabled control is absent from `group.value` and its own\n // validators do not run; blocking a form on a value the user cannot\n // edit is not a rule anyone can satisfy.\n if (found.disabled) continue;\n\n compared.push(name);\n values.push((found.value as unknown) ?? '');\n }\n\n if (values.length < 2) return null;\n // A fresh array, and only the names that actually took part: naming a\n // disabled control would point the reader at something they cannot edit.\n // No control VALUES — this guards passwords, and error objects reach the\n // DOM, logs and error reporters.\n return values.every(v => v === values[0]) ? null : { matchFields: { fields: [...compared] } };\n };\n },\n\n // Choice\n\n /** Value must be one of the allowed entries (strict equality). */\n oneOf: <T>(allowed: readonly T[]): ValidatorFn => {\n return (control: AbstractControl): ValidationErrors | null => {\n const v = control.value as T;\n if (v == null || (v as unknown) === '') return null;\n return allowed.includes(v) ? null : { oneOf: { allowed } };\n };\n },\n\n // Date bounds\n\n /**\n * Value (Date | parseable) must be ≥ `min`. A date-only string (`'2026-01-01'`),\n * as the bound or the value, is that day's LOCAL midnight.\n */\n minDate: (min: Date | string | number): ValidatorFn => {\n const minMs = toMs(min);\n return (control: AbstractControl): ValidationErrors | null => {\n const v: unknown = control.value;\n if (v == null || v === '') return null;\n const got = toMs(v);\n if (Number.isNaN(got)) return { minDate: { min } };\n return got >= minMs ? null : { minDate: { min } };\n };\n },\n\n /**\n * Value (Date | parseable) must be ≤ `max`. A date-only string (`'2026-12-31'`),\n * as the bound or the value, is that day's LOCAL midnight.\n */\n maxDate: (max: Date | string | number): ValidatorFn => {\n const maxMs = toMs(max);\n return (control: AbstractControl): ValidationErrors | null => {\n const v: unknown = control.value;\n if (v == null || v === '') return null;\n const got = toMs(v);\n if (Number.isNaN(got)) return { maxDate: { max } };\n return got <= maxMs ? null : { maxDate: { max } };\n };\n },\n};\n"],"mappings":";;;;;;;;AAYA,SAAS,YAAY,SAAwB;CAC3C,MAAM,IAAa,QAAQ;CAC3B,IAAI,KAAK,MAAM,OAAO;CACtB,IAAI,OAAO,MAAM,UAAU,OAAO,EAAE,KAAI;CACxC,IAAI,OAAO,MAAM,YAAY,OAAO,MAAM,WAAW,OAAO,OAAO,CAAC,CAAC,CAAC,KAAI;CAC1E,OAAO;AACT;AAGA,SAAS,eAAe,SAAwB;CAC9C,MAAM,IAAa,QAAQ;CAC3B,IAAI,KAAK,MAAM,OAAO;CACtB,IAAI,OAAO,MAAM,UAAU,OAAO;CAClC,IAAI,OAAO,M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AO,MAAM,GAAG,GAAG,OAAO,EAAE,SAAS,EAAE,IAAG,EAAE;GAChD,OAAO,OAAO,QAAQ,OAAO,EAAE,SAAS,EAAE,IAAG,EAAE;EACjD;CACF;AACD"}
|
|
1
|
+
{"version":3,"file":"ngwr-validators.mjs","names":[],"sources":["../../../projects/lib/validators/wr-validators.ts"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { isDevMode } from '@angular/core';\nimport { type AbstractControl, type ValidationErrors, type ValidatorFn } from '@angular/forms';\n\nimport { wrParseDate } from 'ngwr/date';\n\nfunction stringValue(control: AbstractControl): string {\n const v: unknown = control.value;\n if (v == null) return '';\n if (typeof v === 'string') return v.trim();\n if (typeof v === 'number' || typeof v === 'boolean') return String(v).trim();\n return '';\n}\n\n/** Like {@link stringValue} but preserves whitespace — for checks that inspect spacing. */\nfunction rawStringValue(control: AbstractControl): string {\n const v: unknown = control.value;\n if (v == null) return '';\n if (typeof v === 'string') return v;\n if (typeof v === 'number' || typeof v === 'boolean') return String(v);\n return '';\n}\n\n/**\n * `localhost` or a dotted name, then a port: a host the user typed without a\n * scheme, not a scheme of that name. A one-label name (`tel:911`) is left a\n * scheme, since nothing in the text tells the two apart; so is `myhost:8080`.\n */\nconst HOST_WITH_PORT = /^(?:localhost|[a-z0-9-]+(?:\\.[a-z0-9-]+)+):\\d+(?:[/?#]|$)/i;\n\n/** Luhn checksum. Returns true when the digit string is a valid card number. */\nfunction luhn(digits: string): boolean {\n let sum = 0;\n let dbl = false;\n for (let i = digits.length - 1; i >= 0; i--) {\n let d = digits.charCodeAt(i) - 48;\n if (dbl) {\n d *= 2;\n if (d > 9) d -= 9;\n }\n sum += d;\n dbl = !dbl;\n }\n return sum % 10 === 0;\n}\n\n/** ISO 13616 mod-97 check for IBANs. Returns the remainder; valid IBANs yield 1. */\nfunction mod97(iban: string): number {\n // Move first 4 chars to the end + convert letters to digits (A=10..Z=35).\n const rearranged = iban.slice(4) + iban.slice(0, 4);\n let expanded = '';\n for (let i = 0; i < rearranged.length; i++) {\n const code = rearranged.charCodeAt(i);\n if (code >= 65 && code <= 90) expanded += (code - 55).toString();\n else expanded += rearranged.charAt(i);\n }\n // Apply mod 97 in chunks — BigInt isn't necessary.\n let remainder = 0;\n for (let i = 0; i < expanded.length; i += 7) {\n const slice = remainder.toString() + expanded.substring(i, i + 7);\n remainder = Number.parseInt(slice, 10) % 97;\n }\n return remainder;\n}\n\n/**\n * A bound or a value as milliseconds, read as `wrParseDate` reads it. A date-only\n * string (`'2026-01-01'`) is that day's LOCAL midnight, so `minDate('2026-01-01')`\n * accepts the 1 January a date picker emits, in every zone, and a backend's\n * `'2026-01-01 14:30:00'` is the instant its `T` form names.\n */\nfunction toMs(value: unknown): number {\n if (value instanceof Date) return value.getTime();\n if (typeof value !== 'string' && typeof value !== 'number') return Number.NaN;\n return wrParseDate(value)?.getTime() ?? Number.NaN;\n}\n\n/**\n * Bundled `ValidatorFn`s — pure functions, no DOM, no DI. (`matchFields` keeps\n * one bit of per-instance state, a latch so its dev-mode misconfiguration\n * warning fires once rather than on every validation run; it is never read as\n * part of the result.) Mirrors the API shape of Angular's built-in\n * `Validators` so it composes cleanly:\n *\n * ```ts\n * import { Validators } from '@angular/forms';\n * import { WrValidators } from 'ngwr/validators';\n *\n * new FormControl('', [\n * Validators.required,\n * WrValidators.cardNumber,\n * WrValidators.cvc(3),\n * WrValidators.match('password'),\n * WrValidators.oneOf(['xs', 'sm', 'md', 'lg', 'xl']),\n * ]);\n * ```\n *\n * Each error is keyed under the validator name (e.g. `cardNumber`,\n * `cvc`, `iban`) so consumers can branch in templates.\n *\n * Anything Angular already ships (`required`, `email`, `min`, `max`,\n * `pattern`, …) is deliberately NOT duplicated here.\n *\n * @see https://ngwr.dev/reference/validators\n */\nexport const WrValidators = {\n // String shape\n\n /** No whitespace anywhere in the value. */\n noWhitespace: (control: AbstractControl): ValidationErrors | null => {\n const v = rawStringValue(control);\n if (v === '') return null;\n return /\\s/.test(v) ? { noWhitespace: true } : null;\n },\n\n /** 3, 4, 6, or 8-digit hex colour (`#abc`, `#1a2b3c`, `#1a2b3c4d`). */\n hexColor: (control: AbstractControl): ValidationErrors | null => {\n const v = stringValue(control);\n if (v === '') return null;\n return /^#([0-9a-f]{3}|[0-9a-f]{4}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(v) ? null : { hexColor: true };\n },\n\n // Network / payments\n\n /**\n * Valid URL. Accepts any scheme by default; pass `{ protocols: ['https'] }`\n * to restrict. A scheme is required by default; pass `{ requireProtocol: false }`\n * to also accept bare domains (e.g. `ngwr.dev`), assuming `https`. `localhost`\n * or a dotted name followed by a port (`ngwr.dev:8080`) is a bare domain, not a\n * scheme called `ngwr.dev`.\n */\n url: (options: { readonly protocols?: readonly string[]; readonly requireProtocol?: boolean } = {}): ValidatorFn => {\n const allow = options.protocols?.map(p => p.replace(/:$/, '').toLowerCase());\n const requireProtocol = options.requireProtocol ?? true;\n return (control: AbstractControl): ValidationErrors | null => {\n const v = stringValue(control);\n if (v === '') return null;\n // Without a scheme `new URL()` always throws, so this is the input it\n // cannot take — plus a host with a port. `localhost:4200` and\n // `ngwr.dev:443/docs` PARSE, the name before the colon being a legal\n // scheme and the port a legal path, and nobody typing one meant a scheme\n // called `localhost`.\n if (HOST_WITH_PORT.test(v) || !/^[a-z][a-z0-9+.-]*:/i.test(v)) {\n if (requireProtocol) return { url: true };\n // Bare domain support: when protocols aren't required, retry assuming\n // `https://`.\n let retried: URL;\n try {\n retried = new URL(`https://${v}`);\n } catch {\n return { url: true };\n }\n // Unreachable, and kept as a guard rather than deleted. `https` is a\n // WHATWG \"special\" scheme, which may not have an empty host, so\n // `new URL('https://' + v)` either threw above or produced one —\n // there is no `v` that lands here (checked by brute force over\n // two-character ASCII as well as by the spec). It stays because the\n // line above is the only thing making that true, and a future retry\n // through a non-special scheme would need it back.\n if (retried.host === '') {\n return { url: true };\n }\n if (allow && !allow.includes('https')) {\n return { url: { allowed: allow } };\n }\n return null;\n }\n let parsed: URL;\n try {\n parsed = new URL(v);\n } catch {\n return { url: true };\n }\n const protocol = parsed.protocol.replace(/:$/, '').toLowerCase();\n // WHATWG auto-inserts the authority for \"special\" schemes, so `http:host`\n // (missing `//`) still parses. Require the explicit `//` for those.\n const needsAuthority = ['http', 'https', 'ws', 'wss', 'ftp', 'file'].includes(protocol);\n if (needsAuthority && !/^[a-z][a-z0-9+.-]*:\\/\\//i.test(v)) {\n return { url: true };\n }\n if (allow && !allow.includes(protocol)) {\n return { url: { allowed: allow } };\n }\n return null;\n };\n },\n\n /** Credit card number — Luhn check + 13-19 digit length. Spaces and dashes are stripped first. */\n cardNumber: (control: AbstractControl): ValidationErrors | null => {\n const raw = stringValue(control).replace(/[\\s-]/g, '');\n if (raw === '') return null;\n if (!/^\\d{13,19}$/.test(raw)) return { cardNumber: true };\n return luhn(raw) ? null : { cardNumber: true };\n },\n\n /** CVC / CVV — N digits (default 3). Common: 3 for Visa/MC, 4 for Amex. */\n cvc: (length = 3): ValidatorFn => {\n const re = new RegExp(`^\\\\d{${length}}$`);\n return (control: AbstractControl): ValidationErrors | null => {\n const v = stringValue(control);\n if (v === '') return null;\n return re.test(v) ? null : { cvc: { length } };\n };\n },\n\n /**\n * IBAN — basic structure (CC + 2 digits + up to 30 alphanumerics) +\n * the mod-97 check. Country-length tables not enforced.\n */\n iban: (control: AbstractControl): ValidationErrors | null => {\n const raw = stringValue(control).replace(/\\s/g, '').toUpperCase();\n if (raw === '') return null;\n if (!/^[A-Z]{2}\\d{2}[A-Z0-9]{4,30}$/.test(raw)) return { iban: true };\n return mod97(raw) === 1 ? null : { iban: true };\n },\n\n // Cross-field\n\n /**\n * Value must equal a sibling control's value (e.g. confirm-password).\n * The target lookup uses `control.parent.get(name)`, so it works\n * inside `FormGroup` and nested groups.\n *\n * **It cannot report a mismatch until something revalidates the control.**\n * Angular runs a control's validators inside the control's own constructor,\n * before the control has a parent — so the lookup finds nothing and this\n * returns `null`, and attaching the control to a group does not re-run it.\n *\n * `formControlName` revalidates when it binds, so a group rendered through\n * the reactive-forms directives corrects itself on its first change\n * detection. The window is open for everything that reads validity BEFORE\n * that: a route guard or resolver checking `form.valid`, a form built and\n * submitted from a service, a unit test. Such a group reports itself valid\n * with two values that plainly disagree.\n *\n * Put {@link WrValidators.matchFields} on the group to close it, and keep\n * this one on the child for the per-field message. They do not conflict —\n * different error keys, different hosts.\n *\n * @see WrValidators.matchFields\n */\n match: (targetName: string): ValidatorFn => {\n return (control: AbstractControl): ValidationErrors | null => {\n const target = control.parent?.get(targetName);\n if (!target) return null;\n return control.value === target.value ? null : { match: { target: targetName } };\n };\n },\n\n /**\n * Every named control must hold the same value — the group-level counterpart\n * to {@link WrValidators.match}. Attach it to the group that OWNS the fields,\n * not to one of its children.\n *\n * Unlike `match` this has no ordering hole: Angular attaches the children and\n * aggregates their values BEFORE it runs the group's own validators, so a\n * group built from a record whose fields already disagree is invalid the\n * moment it exists — no revalidation step, and nothing that depends on the\n * form having been rendered.\n *\n * Names are `AbstractControl.get()` paths, so `'billing.zip'` reaches into a\n * nested group. `null`, `undefined` and `''` all count as the same empty\n * value; everything else is compared with `===`, so two equal `Date`s are NOT\n * equal — compare a derived primitive instead. **Disabled controls are\n * skipped**, which makes the rule compare exactly what `group.value`\n * contains, and the error names only the controls it actually compared.\n *\n * A name that resolves to nothing, or to a group or an array rather than a\n * leaf control, turns the whole check off and warns once per validator\n * instance in dev — never a partial comparison of the names that did\n * resolve, and never an error the user has no way to satisfy.\n *\n * The error lands on the GROUP, and `<wr-form-field>` only reads the one\n * control projected into it — so pair this with `match` for a per-field\n * message, or render it yourself from `form.hasError('matchFields')`.\n *\n * @example\n * ```ts\n * new FormGroup(\n * {\n * password: new FormControl(''),\n * confirm: new FormControl('', [WrValidators.match('password')]),\n * },\n * { validators: [WrValidators.matchFields('password', 'confirm')] },\n * );\n * ```\n */\n matchFields: (first: string, second: string, ...rest: readonly string[]): ValidatorFn => {\n // Frozen because the payload hands these names out: a consumer who mutated\n // the array would be editing the validator's own configuration, and a\n // `push` of a name that resolves to nothing switches the check OFF — the\n // form then goes valid with two values that plainly disagree.\n const fields: readonly string[] = Object.freeze([first, second, ...rest]);\n\n // Per-instance, never module-level: a shared latch is process-wide state\n // under SSR, where one request's warning would silence every later one.\n let warned = false;\n\n const warn = (message: string): void => {\n if (!isDevMode() || warned) return;\n warned = true;\n // `warn`, not `error`: a prerender worker forwards app console errors as\n // `ERROR …` and `scripts/build/showcase-app.ts` fails the build on them —\n // and adding the control later is a legitimate pattern, not a red build.\n // Reported rather than thrown for the same reason.\n // eslint-disable-next-line no-console -- a silent pass is the very bug this validator removes\n console.warn(`[NGWR] matchFields: ${message} — the check did not run.`);\n };\n\n return (group: AbstractControl): ValidationErrors | null => {\n const compared: string[] = [];\n const values: unknown[] = [];\n\n for (const name of fields) {\n const found = group.get(name);\n if (!found) {\n warn(`no control at \"${name}\". Names are AbstractControl.get() paths, relative to this group`);\n return null;\n }\n\n // A group or an array RESOLVES, so it slips past the check above and\n // would then be compared by reference against another container —\n // never equal, whatever the user types. `'billing'` instead of\n // `'billing.zip'` is the easy mistake, and it makes a form that can\n // never be submitted and says nothing about why.\n if ('controls' in found) {\n warn(`\"${name}\" is a group or an array; name a leaf control, e.g. \"${name}.<field>\"`);\n return null;\n }\n\n // A disabled control is absent from `group.value` and its own\n // validators do not run; blocking a form on a value the user cannot\n // edit is not a rule anyone can satisfy.\n if (found.disabled) continue;\n\n compared.push(name);\n values.push((found.value as unknown) ?? '');\n }\n\n if (values.length < 2) return null;\n // A fresh array, and only the names that actually took part: naming a\n // disabled control would point the reader at something they cannot edit.\n // No control VALUES — this guards passwords, and error objects reach the\n // DOM, logs and error reporters.\n return values.every(v => v === values[0]) ? null : { matchFields: { fields: [...compared] } };\n };\n },\n\n // Choice\n\n /** Value must be one of the allowed entries (strict equality). */\n oneOf: <T>(allowed: readonly T[]): ValidatorFn => {\n return (control: AbstractControl): ValidationErrors | null => {\n const v = control.value as T;\n if (v == null || (v as unknown) === '') return null;\n return allowed.includes(v) ? null : { oneOf: { allowed } };\n };\n },\n\n // Date bounds\n\n /**\n * Value (Date | parseable) must be ≥ `min`. A date-only string (`'2026-01-01'`),\n * as the bound or the value, is that day's LOCAL midnight, and a backend's\n * `'2026-01-01 14:30:00'` is read as its `T` form.\n */\n minDate: (min: Date | string | number): ValidatorFn => {\n const minMs = toMs(min);\n return (control: AbstractControl): ValidationErrors | null => {\n const v: unknown = control.value;\n if (v == null || v === '') return null;\n const got = toMs(v);\n if (Number.isNaN(got)) return { minDate: { min } };\n return got >= minMs ? null : { minDate: { min } };\n };\n },\n\n /**\n * Value (Date | parseable) must be ≤ `max`. A date-only string (`'2026-12-31'`),\n * as the bound or the value, is that day's LOCAL midnight, and a backend's\n * `'2026-12-31 14:30:00'` is read as its `T` form.\n */\n maxDate: (max: Date | string | number): ValidatorFn => {\n const maxMs = toMs(max);\n return (control: AbstractControl): ValidationErrors | null => {\n const v: unknown = control.value;\n if (v == null || v === '') return null;\n const got = toMs(v);\n if (Number.isNaN(got)) return { maxDate: { max } };\n return got <= maxMs ? null : { maxDate: { max } };\n };\n },\n};\n"],"mappings":";;;;;;;;AAYA,SAAS,YAAY,SAAwB;CAC3C,MAAM,IAAa,QAAQ;CAC3B,IAAI,KAAK,MAAM,OAAO;CACtB,IAAI,OAAO,MAAM,UAAU,OAAO,EAAE,KAAI;CACxC,IAAI,OAAO,MAAM,YAAY,OAAO,MAAM,WAAW,OAAO,OAAO,CAAC,CAAC,CAAC,KAAI;CAC1E,OAAO;AACT;AAGA,SAAS,eAAe,SAAwB;CAC9C,MAAM,IAAa,QAAQ;CAC3B,IAAI,KAAK,MAAM,OAAO;CACtB,IAAI,OAAO,MAAM,UAAU,OAAO;CAClC,IAAI,OAAO,MAAM,YAAY,OAAO,MAAM,WAAW,OAAO,OAAO,CAAC;CACpE,OAAO;AACT;AAOA,MAAM,iBAAiB;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AQ,OAAO,EAAE,SAAS,EAAE,IAAG,EAAE;EACjD;CACF;AACD"}
|
|
@@ -5,7 +5,7 @@ import { InjectionToken } from "@angular/core";
|
|
|
5
5
|
* Use of this source code is governed by an MIT-style license that can be
|
|
6
6
|
* found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE
|
|
7
7
|
*/
|
|
8
|
-
const NGWR_VERSION = "
|
|
8
|
+
const NGWR_VERSION = "16.0.0";
|
|
9
9
|
/**
|
|
10
10
|
* @license
|
|
11
11
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ngwr-version.mjs","names":[],"sources":["../../../projects/lib/version/version.ts","../../../projects/lib/version/version.token.ts"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\n/**\n * The ngwr library version string, kept in sync with\n * `projects/lib/package.json` by `scripts/release/prepare.ts`.\n *\n * Prefer this over reading `package.json` at runtime — that requires a JSON\n * import or `require`, neither of which tree-shakes well in Angular builds.\n *\n * Distinct from `Version` exported by `@angular/core`, which reports the\n * loaded Angular runtime version (e.g. `'22.0.0'`), not ngwr's.\n */\nexport const NGWR_VERSION = '
|
|
1
|
+
{"version":3,"file":"ngwr-version.mjs","names":[],"sources":["../../../projects/lib/version/version.ts","../../../projects/lib/version/version.token.ts"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\n/**\n * The ngwr library version string, kept in sync with\n * `projects/lib/package.json` by `scripts/release/prepare.ts`.\n *\n * Prefer this over reading `package.json` at runtime — that requires a JSON\n * import or `require`, neither of which tree-shakes well in Angular builds.\n *\n * Distinct from `Version` exported by `@angular/core`, which reports the\n * loaded Angular runtime version (e.g. `'22.0.0'`), not ngwr's.\n */\nexport const NGWR_VERSION = '16.0.0';\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { InjectionToken } from '@angular/core';\n\nimport { NGWR_VERSION } from './version';\n\n/**\n * Injection token holding the ngwr library version string.\n *\n * Default factory returns {@link NGWR_VERSION}. Override it in tests or in\n * apps that want to surface a custom build identifier.\n *\n * @example\n * ```ts\n * @Component({...})\n * export class FooterComponent {\n * readonly version = inject(NGWR_VERSION_TOKEN);\n * }\n * ```\n */\nexport const NGWR_VERSION_TOKEN = new InjectionToken<string>('NGWR_VERSION_TOKEN', {\n providedIn: 'root',\n factory: () => NGWR_VERSION,\n});\n"],"mappings":";;;;;;;AAiBA,MAAa,eAAe;;;;;;;ACQ5B,MAAa,qBAAqB,IAAI,eAAuB,sBAAsB;CACjF,YAAY;CACZ,eAAe;AAChB,CAAA"}
|
package/fesm2022/ngwr-window.mjs
CHANGED
|
@@ -2,7 +2,7 @@ import * as i0 from "@angular/core";
|
|
|
2
2
|
import { ChangeDetectionStrategy, Component, DestroyRef, ElementRef, EnvironmentInjector, InjectionToken, Injector, PLATFORM_ID, Service, TemplateRef, ViewContainerRef, ViewEncapsulation, afterNextRender, afterRenderEffect, computed, effect, inject, input, output, runInInjectionContext, signal, untracked, viewChild, viewChildren } from "@angular/core";
|
|
3
3
|
import { coerceNumberProperty } from "@angular/cdk/coercion";
|
|
4
4
|
import { NgComponentOutlet, NgTemplateOutlet, isPlatformBrowser } from "@angular/common";
|
|
5
|
-
import {
|
|
5
|
+
import { wrCheckStyles, wrClamp, wrFeature, wrRandomId, wrRestoreFocus, wrToClassList } from "ngwr/utils";
|
|
6
6
|
import { useI18nFormatter, useI18nText } from "ngwr/i18n";
|
|
7
7
|
import { Directionality } from "@angular/cdk/bidi";
|
|
8
8
|
import { ComponentPortal } from "@angular/cdk/portal";
|
|
@@ -58,7 +58,7 @@ var WrWindow = class WrWindow {
|
|
|
58
58
|
titleExtra = input(null, ...ngDevMode ? [{ debugName: "titleExtra" }] : /* istanbul ignore next */ []);
|
|
59
59
|
statusBar = input(null, ...ngDevMode ? [{ debugName: "statusBar" }] : /* istanbul ignore next */ []);
|
|
60
60
|
closed = output();
|
|
61
|
-
titleId =
|
|
61
|
+
titleId = wrRandomId("wr-window-title");
|
|
62
62
|
closeLabel = useI18nText(NO_OVERRIDE$1, "window.close", "Close");
|
|
63
63
|
minimizeLabel = useI18nText(NO_OVERRIDE$1, "window.minimize", "Minimize");
|
|
64
64
|
maximizeLabel = useI18nText(NO_OVERRIDE$1, "window.maximize", "Maximize");
|
|
@@ -888,8 +888,8 @@ function seedGeometry(seed) {
|
|
|
888
888
|
const preset = SIZE_PRESETS[seed.size ?? "md"];
|
|
889
889
|
const keep = o.keepInViewport;
|
|
890
890
|
const fit = (size, room) => keep ? Math.min(size, room) : size;
|
|
891
|
-
const width = Math.round(
|
|
892
|
-
const height = Math.round(
|
|
891
|
+
const width = Math.round(wrClamp(fit(seed.width ?? preset.width, wa.width), o.minWidth, o.maxWidth));
|
|
892
|
+
const height = Math.round(wrClamp(fit(seed.height ?? preset.height, wa.height), o.minHeight, o.maxHeight));
|
|
893
893
|
let x = seed.x;
|
|
894
894
|
let y = seed.y;
|
|
895
895
|
let cascaded = false;
|
|
@@ -900,8 +900,8 @@ function seedGeometry(seed) {
|
|
|
900
900
|
y ??= wa.top + offset.y;
|
|
901
901
|
}
|
|
902
902
|
const into = cascaded || !!seed.restored;
|
|
903
|
-
if (keep && (into || seed.x == null)) x =
|
|
904
|
-
if (keep && (into || seed.y == null)) y =
|
|
903
|
+
if (keep && (into || seed.x == null)) x = wrClamp(x, wa.left, Math.max(wa.left, wa.left + wa.width - width));
|
|
904
|
+
if (keep && (into || seed.y == null)) y = wrClamp(y, wa.top, Math.max(wa.top, wa.top + wa.height - height));
|
|
905
905
|
return {
|
|
906
906
|
x: Math.round(x),
|
|
907
907
|
y: Math.round(y),
|
|
@@ -1035,8 +1035,8 @@ var WrWindowModel = class {
|
|
|
1035
1035
|
this.unsnapInPlace();
|
|
1036
1036
|
const o = this.options();
|
|
1037
1037
|
this.setRaw({
|
|
1038
|
-
width:
|
|
1039
|
-
height:
|
|
1038
|
+
width: wrClamp(width, o.minWidth, o.maxWidth),
|
|
1039
|
+
height: wrClamp(height, o.minHeight, o.maxHeight)
|
|
1040
1040
|
});
|
|
1041
1041
|
this.clamp();
|
|
1042
1042
|
}
|
|
@@ -1052,8 +1052,8 @@ var WrWindowModel = class {
|
|
|
1052
1052
|
if (!this.options().keepInViewport) return;
|
|
1053
1053
|
const wa = this.workArea();
|
|
1054
1054
|
const w = this.width();
|
|
1055
|
-
this.x.set(Math.round(
|
|
1056
|
-
this.y.set(Math.round(
|
|
1055
|
+
this.x.set(Math.round(wrClamp(this.x(), wa.left + 24 - w, wa.left + wa.width - 24)));
|
|
1056
|
+
this.y.set(Math.round(wrClamp(this.y(), wa.top, wa.top + wa.height - 24)));
|
|
1057
1057
|
}
|
|
1058
1058
|
update(patch) {
|
|
1059
1059
|
const { title, ...rest } = patch;
|
|
@@ -1073,8 +1073,8 @@ var WrWindowModel = class {
|
|
|
1073
1073
|
].some((key) => key in defined)) {
|
|
1074
1074
|
const o = this.options();
|
|
1075
1075
|
this.setRaw({
|
|
1076
|
-
width:
|
|
1077
|
-
height:
|
|
1076
|
+
width: wrClamp(this.width(), o.minWidth, o.maxWidth),
|
|
1077
|
+
height: wrClamp(this.height(), o.minHeight, o.maxHeight)
|
|
1078
1078
|
});
|
|
1079
1079
|
this.clamp();
|
|
1080
1080
|
}
|
|
@@ -1103,13 +1103,13 @@ var WrWindowModel = class {
|
|
|
1103
1103
|
const regionH = quarter ? bottom ? wa.height - halfH : halfH : wa.height;
|
|
1104
1104
|
const regionL = wa.left + (right ? halfW : 0);
|
|
1105
1105
|
const regionT = wa.top + (bottom ? halfH : 0);
|
|
1106
|
-
const width =
|
|
1107
|
-
const height =
|
|
1106
|
+
const width = wrClamp(regionW, o.minWidth, o.maxWidth);
|
|
1107
|
+
const height = wrClamp(regionH, o.minHeight, o.maxHeight);
|
|
1108
1108
|
const left = right ? regionL + regionW - width : regionL;
|
|
1109
1109
|
const top = bottom ? regionT + regionH - height : regionT;
|
|
1110
1110
|
return {
|
|
1111
|
-
left:
|
|
1112
|
-
top:
|
|
1111
|
+
left: wrClamp(left, wa.left, Math.max(wa.left, wa.left + wa.width - width)),
|
|
1112
|
+
top: wrClamp(top, wa.top, Math.max(wa.top, wa.top + wa.height - height)),
|
|
1113
1113
|
width,
|
|
1114
1114
|
height
|
|
1115
1115
|
};
|
|
@@ -1151,8 +1151,8 @@ var WrWindowModel = class {
|
|
|
1151
1151
|
}
|
|
1152
1152
|
grow(dw, dh, rtl) {
|
|
1153
1153
|
const o = this.options();
|
|
1154
|
-
const width =
|
|
1155
|
-
const height =
|
|
1154
|
+
const width = wrClamp(this.width() + dw, o.minWidth, o.maxWidth);
|
|
1155
|
+
const height = wrClamp(this.height() + dh, o.minHeight, o.maxHeight);
|
|
1156
1156
|
const x = rtl ? this.x() - (width - this.width()) : this.x();
|
|
1157
1157
|
this.setRaw({
|
|
1158
1158
|
x,
|
|
@@ -1456,14 +1456,14 @@ var WrWindowManager = class WrWindowManager {
|
|
|
1456
1456
|
let self = null;
|
|
1457
1457
|
const overlayRef = this.overlay.create({
|
|
1458
1458
|
positionStrategy: this.overlay.position().global(),
|
|
1459
|
-
panelClass:
|
|
1459
|
+
panelClass: wrToClassList("wr-window-overlay", config.panelClass),
|
|
1460
1460
|
hasBackdrop: false,
|
|
1461
1461
|
eventPredicate: () => self === null || this.ownsKeyboard(self),
|
|
1462
1462
|
usePopover: false
|
|
1463
1463
|
});
|
|
1464
1464
|
overlayRef.hostElement.style.zIndex = String(model.z());
|
|
1465
1465
|
wrFollowDirection(overlayRef, this.dir, this.parentInjector);
|
|
1466
|
-
const ref = new WrWindowRef(config.id ??
|
|
1466
|
+
const ref = new WrWindowRef(config.id ?? wrRandomId("wr-window"), overlayRef, model);
|
|
1467
1467
|
const any = ref;
|
|
1468
1468
|
self = any;
|
|
1469
1469
|
ref._host = this;
|
|
@@ -1682,14 +1682,14 @@ var WrWindowManager = class WrWindowManager {
|
|
|
1682
1682
|
const wa = m.workArea();
|
|
1683
1683
|
const o = m.options();
|
|
1684
1684
|
const fit = (size, room) => o.keepInViewport ? Math.min(size, room) : size;
|
|
1685
|
-
const width =
|
|
1686
|
-
const height =
|
|
1685
|
+
const width = wrClamp(fit(m.width(), wa.width), o.minWidth, o.maxWidth);
|
|
1686
|
+
const height = wrClamp(fit(m.height(), wa.height), o.minHeight, o.maxHeight);
|
|
1687
1687
|
const offset = cascadeOffset(index);
|
|
1688
1688
|
const x = rtl ? wa.left + wa.width - width - offset.x : wa.left + offset.x;
|
|
1689
1689
|
const y = wa.top + offset.y;
|
|
1690
1690
|
m.setRaw({
|
|
1691
|
-
x:
|
|
1692
|
-
y:
|
|
1691
|
+
x: wrClamp(x, wa.left, Math.max(wa.left, wa.left + wa.width - width)),
|
|
1692
|
+
y: wrClamp(y, wa.top, Math.max(wa.top, wa.top + wa.height - height)),
|
|
1693
1693
|
width,
|
|
1694
1694
|
height
|
|
1695
1695
|
});
|
|
@@ -1719,8 +1719,8 @@ var WrWindowManager = class WrWindowManager {
|
|
|
1719
1719
|
m.setRaw({
|
|
1720
1720
|
x: x0,
|
|
1721
1721
|
y: y0,
|
|
1722
|
-
width:
|
|
1723
|
-
height:
|
|
1722
|
+
width: wrClamp(x1 - x0, o.minWidth, o.maxWidth),
|
|
1723
|
+
height: wrClamp(y1 - y0, o.minHeight, o.maxHeight)
|
|
1724
1724
|
});
|
|
1725
1725
|
m.clamp();
|
|
1726
1726
|
});
|