ngwr 16.5.0 → 16.6.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/back-top/styles/_index.scss +6 -0
- package/breadcrumbs/styles/_rules.scss +34 -0
- package/cascader/styles/_rules.scss +7 -0
- package/charts/chart-legend/styles/_index.scss +1 -9
- package/counter/styles/_index.scss +1 -8
- package/date-picker/styles/_index.scss +15 -9
- package/dialog/styles/_index.scss +37 -0
- package/editor/styles/_index.scss +1 -8
- package/event-calendar/styles/_index.scss +2 -6
- package/fesm2022/ngwr-affix.mjs +1 -1
- package/fesm2022/ngwr-affix.mjs.map +1 -1
- package/fesm2022/ngwr-anchor.mjs +9 -2
- package/fesm2022/ngwr-anchor.mjs.map +1 -1
- package/fesm2022/ngwr-animations-aurora.mjs.map +1 -1
- package/fesm2022/ngwr-animations-blur-reveal.mjs.map +1 -1
- package/fesm2022/ngwr-animations-click-sparks.mjs.map +1 -1
- package/fesm2022/ngwr-animations-confetti.mjs.map +1 -1
- package/fesm2022/ngwr-animations-decode.mjs.map +1 -1
- package/fesm2022/ngwr-animations-destruct.mjs.map +1 -1
- package/fesm2022/ngwr-animations-dot-grid.mjs.map +1 -1
- package/fesm2022/ngwr-animations-falling-letters.mjs.map +1 -1
- package/fesm2022/ngwr-animations-flow-lines.mjs.map +1 -1
- package/fesm2022/ngwr-animations-fluid-cursor.mjs.map +1 -1
- package/fesm2022/ngwr-animations-glitch.mjs.map +1 -1
- package/fesm2022/ngwr-animations-glow-border.mjs.map +1 -1
- package/fesm2022/ngwr-animations-gradient-flow.mjs.map +1 -1
- package/fesm2022/ngwr-animations-marquee.mjs.map +1 -1
- package/fesm2022/ngwr-animations-orbit.mjs.map +1 -1
- package/fesm2022/ngwr-animations-reveal.mjs.map +1 -1
- package/fesm2022/ngwr-animations-ripple-grid.mjs.map +1 -1
- package/fesm2022/ngwr-animations-rotate-reveal.mjs.map +1 -1
- package/fesm2022/ngwr-animations-shimmer.mjs.map +1 -1
- package/fesm2022/ngwr-animations-spotlight.mjs.map +1 -1
- package/fesm2022/ngwr-animations-thread-lines.mjs.map +1 -1
- package/fesm2022/ngwr-animations-tilt.mjs +20 -13
- package/fesm2022/ngwr-animations-tilt.mjs.map +1 -1
- package/fesm2022/ngwr-animations-typewriter.mjs.map +1 -1
- package/fesm2022/ngwr-breadcrumbs.mjs +40 -7
- package/fesm2022/ngwr-breadcrumbs.mjs.map +1 -1
- package/fesm2022/ngwr-button.mjs +12 -3
- package/fesm2022/ngwr-button.mjs.map +1 -1
- package/fesm2022/ngwr-carousel.mjs +8 -2
- package/fesm2022/ngwr-carousel.mjs.map +1 -1
- package/fesm2022/ngwr-cascader.mjs +24 -4
- package/fesm2022/ngwr-cascader.mjs.map +1 -1
- package/fesm2022/ngwr-charts-core.mjs +12 -5
- package/fesm2022/ngwr-charts-core.mjs.map +1 -1
- package/fesm2022/ngwr-charts-meter-group.mjs +4 -2
- package/fesm2022/ngwr-charts-meter-group.mjs.map +1 -1
- package/fesm2022/ngwr-checkbox.mjs +3 -2
- package/fesm2022/ngwr-checkbox.mjs.map +1 -1
- package/fesm2022/ngwr-color-picker.mjs +21 -1
- package/fesm2022/ngwr-color-picker.mjs.map +1 -1
- package/fesm2022/ngwr-context-menu.mjs +4 -5
- package/fesm2022/ngwr-context-menu.mjs.map +1 -1
- package/fesm2022/ngwr-date-picker-testing.mjs.map +1 -1
- package/fesm2022/ngwr-date-picker.mjs +49 -1
- package/fesm2022/ngwr-date-picker.mjs.map +1 -1
- package/fesm2022/ngwr-dialog.mjs +16 -6
- package/fesm2022/ngwr-dialog.mjs.map +1 -1
- package/fesm2022/ngwr-directives.mjs +9 -6
- package/fesm2022/ngwr-directives.mjs.map +1 -1
- package/fesm2022/ngwr-event-calendar.mjs +20 -9
- package/fesm2022/ngwr-event-calendar.mjs.map +1 -1
- package/fesm2022/ngwr-form.mjs +170 -3
- package/fesm2022/ngwr-form.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-ar.mjs +15 -0
- package/fesm2022/ngwr-i18n-ar.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-cs.mjs +15 -0
- package/fesm2022/ngwr-i18n-cs.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-de.mjs +15 -0
- package/fesm2022/ngwr-i18n-de.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-en.mjs +15 -0
- package/fesm2022/ngwr-i18n-en.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-es.mjs +15 -0
- package/fesm2022/ngwr-i18n-es.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-fr.mjs +15 -0
- package/fesm2022/ngwr-i18n-fr.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-he.mjs +15 -0
- package/fesm2022/ngwr-i18n-he.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-hi.mjs +15 -0
- package/fesm2022/ngwr-i18n-hi.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-id.mjs +15 -0
- package/fesm2022/ngwr-i18n-id.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-it.mjs +15 -0
- package/fesm2022/ngwr-i18n-it.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-ja.mjs +15 -0
- package/fesm2022/ngwr-i18n-ja.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-ko.mjs +15 -0
- package/fesm2022/ngwr-i18n-ko.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-nl.mjs +15 -0
- package/fesm2022/ngwr-i18n-nl.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-pl.mjs +15 -0
- package/fesm2022/ngwr-i18n-pl.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-pt.mjs +15 -0
- package/fesm2022/ngwr-i18n-pt.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-ru.mjs +15 -0
- package/fesm2022/ngwr-i18n-ru.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-sv.mjs +15 -0
- package/fesm2022/ngwr-i18n-sv.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-tr.mjs +15 -0
- package/fesm2022/ngwr-i18n-tr.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-uk.mjs +15 -0
- package/fesm2022/ngwr-i18n-uk.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-vi.mjs +15 -0
- package/fesm2022/ngwr-i18n-vi.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-zh-tw.mjs +15 -0
- package/fesm2022/ngwr-i18n-zh-tw.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-zh.mjs +15 -0
- package/fesm2022/ngwr-i18n-zh.mjs.map +1 -1
- package/fesm2022/ngwr-i18n.mjs +82 -11
- package/fesm2022/ngwr-i18n.mjs.map +1 -1
- package/fesm2022/ngwr-input-number.mjs +24 -1
- 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 +10 -2
- package/fesm2022/ngwr-input.mjs.map +1 -1
- package/fesm2022/ngwr-layout.mjs.map +1 -1
- package/fesm2022/ngwr-list.mjs +1 -1
- package/fesm2022/ngwr-list.mjs.map +1 -1
- package/fesm2022/ngwr-loading-bar-router.mjs.map +1 -1
- package/fesm2022/ngwr-loading-bar.mjs +2 -2
- package/fesm2022/ngwr-loading-bar.mjs.map +1 -1
- package/fesm2022/ngwr-mention.mjs +8 -0
- package/fesm2022/ngwr-mention.mjs.map +1 -1
- package/fesm2022/ngwr-meta.mjs +9 -6
- package/fesm2022/ngwr-meta.mjs.map +1 -1
- package/fesm2022/ngwr-page-header.mjs +21 -0
- package/fesm2022/ngwr-page-header.mjs.map +1 -1
- package/fesm2022/ngwr-pagination.mjs +2 -0
- package/fesm2022/ngwr-pagination.mjs.map +1 -1
- package/fesm2022/ngwr-pipes.mjs +8 -1
- package/fesm2022/ngwr-pipes.mjs.map +1 -1
- package/fesm2022/ngwr-popconfirm.mjs +2 -1
- package/fesm2022/ngwr-popconfirm.mjs.map +1 -1
- package/fesm2022/ngwr-popover.mjs +47 -3
- package/fesm2022/ngwr-popover.mjs.map +1 -1
- package/fesm2022/ngwr-qr.mjs +6 -2
- package/fesm2022/ngwr-qr.mjs.map +1 -1
- package/fesm2022/ngwr-radio.mjs +71 -5
- package/fesm2022/ngwr-radio.mjs.map +1 -1
- package/fesm2022/ngwr-schema-form.mjs +10 -1
- package/fesm2022/ngwr-schema-form.mjs.map +1 -1
- package/fesm2022/ngwr-scroll.mjs +1 -3
- package/fesm2022/ngwr-scroll.mjs.map +1 -1
- package/fesm2022/ngwr-segmented.mjs +20 -0
- package/fesm2022/ngwr-segmented.mjs.map +1 -1
- package/fesm2022/ngwr-select.mjs +80 -9
- package/fesm2022/ngwr-select.mjs.map +1 -1
- package/fesm2022/ngwr-sortable-list.mjs +16 -4
- package/fesm2022/ngwr-sortable-list.mjs.map +1 -1
- package/fesm2022/ngwr-storage.mjs +1 -1
- 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.mjs +41 -7
- package/fesm2022/ngwr-table.mjs.map +1 -1
- package/fesm2022/ngwr-tabs-router.mjs.map +1 -1
- package/fesm2022/ngwr-textarea.mjs +2 -2
- package/fesm2022/ngwr-textarea.mjs.map +1 -1
- package/fesm2022/ngwr-toast.mjs +28 -0
- package/fesm2022/ngwr-toast.mjs.map +1 -1
- package/fesm2022/ngwr-tour.mjs +2 -2
- package/fesm2022/ngwr-tour.mjs.map +1 -1
- package/fesm2022/ngwr-typography.mjs +20 -0
- package/fesm2022/ngwr-typography.mjs.map +1 -1
- package/fesm2022/ngwr-utils-router.mjs.map +1 -1
- package/fesm2022/ngwr-utils.mjs +46 -4
- package/fesm2022/ngwr-utils.mjs.map +1 -1
- package/fesm2022/ngwr-validators.mjs +33 -1
- package/fesm2022/ngwr-validators.mjs.map +1 -1
- package/fesm2022/ngwr-version.mjs +1 -1
- package/fesm2022/ngwr-version.mjs.map +1 -1
- package/form/styles/_index.scss +37 -0
- package/graph/styles/_index.scss +1 -9
- package/i18n/ar.json +15 -0
- package/i18n/cs.json +15 -0
- package/i18n/de.json +15 -0
- package/i18n/en.json +15 -0
- package/i18n/es.json +15 -0
- package/i18n/fr.json +15 -0
- package/i18n/he.json +15 -0
- package/i18n/hi.json +15 -0
- package/i18n/id.json +15 -0
- package/i18n/it.json +15 -0
- package/i18n/ja.json +15 -0
- package/i18n/ko.json +15 -0
- package/i18n/nl.json +15 -0
- package/i18n/pl.json +15 -0
- package/i18n/pt.json +15 -0
- package/i18n/ru.json +15 -0
- package/i18n/sv.json +15 -0
- package/i18n/tr.json +15 -0
- package/i18n/uk.json +15 -0
- package/i18n/vi.json +15 -0
- package/i18n/zh-TW.json +15 -0
- package/i18n/zh.json +15 -0
- package/image-cropper/styles/_index.scss +1 -9
- package/input-number/styles/_index.scss +7 -0
- package/layout/styles/_index.scss +13 -1
- package/llms-full.txt +10 -10
- package/loading-bar/styles/_rules.scss +6 -0
- package/package.json +2 -2
- package/page-header/styles/_index.scss +18 -0
- package/popover/styles/_index.scss +7 -0
- package/schematics/use/symbol-map.json +2 -0
- package/segmented/styles/_index.scss +7 -0
- package/select/styles/_index.scss +7 -0
- package/sidebar/styles/_index.scss +6 -0
- package/skills/ngwr/references/catalog.md +1 -1
- package/sortable-list/styles/_rules.scss +1 -9
- package/speed-dial/styles/_index.scss +6 -0
- package/stepper/styles/_index.scss +1 -9
- package/table/styles/_index.scss +49 -0
- package/theme/_index.scss +12 -1
- package/theme/styles/_colors.scss +11 -0
- package/theme/styles/_contrast.scss +6 -0
- package/theme/styles/_index.scss +1 -0
- package/theme/styles/_mixins.scss +45 -0
- package/theme/styles/_print.scss +17 -0
- package/toast/styles/_index.scss +7 -0
- package/tour/styles/_index.scss +8 -0
- package/tree/styles/_index.scss +1 -9
- package/types/ngwr-anchor.d.ts +3 -0
- package/types/ngwr-animations-aurora.d.ts +6 -0
- package/types/ngwr-animations-blur-reveal.d.ts +6 -0
- package/types/ngwr-animations-click-sparks.d.ts +6 -0
- package/types/ngwr-animations-confetti.d.ts +6 -0
- package/types/ngwr-animations-decode.d.ts +6 -0
- package/types/ngwr-animations-destruct.d.ts +6 -0
- package/types/ngwr-animations-dot-grid.d.ts +6 -0
- package/types/ngwr-animations-falling-letters.d.ts +6 -0
- package/types/ngwr-animations-flow-lines.d.ts +6 -0
- package/types/ngwr-animations-fluid-cursor.d.ts +6 -0
- package/types/ngwr-animations-glitch.d.ts +6 -0
- package/types/ngwr-animations-glow-border.d.ts +6 -0
- package/types/ngwr-animations-gradient-flow.d.ts +6 -0
- package/types/ngwr-animations-marquee.d.ts +6 -0
- package/types/ngwr-animations-orbit.d.ts +6 -0
- package/types/ngwr-animations-reveal.d.ts +6 -0
- package/types/ngwr-animations-ripple-grid.d.ts +6 -0
- package/types/ngwr-animations-rotate-reveal.d.ts +6 -0
- package/types/ngwr-animations-shimmer.d.ts +6 -0
- package/types/ngwr-animations-spotlight.d.ts +6 -0
- package/types/ngwr-animations-thread-lines.d.ts +6 -0
- package/types/ngwr-animations-tilt.d.ts +10 -0
- package/types/ngwr-animations-typewriter.d.ts +6 -0
- package/types/ngwr-breadcrumbs.d.ts +25 -0
- package/types/ngwr-button.d.ts +23 -3
- package/types/ngwr-carousel.d.ts +2 -0
- package/types/ngwr-cascader.d.ts +7 -0
- package/types/ngwr-charts-core.d.ts +16 -0
- package/types/ngwr-charts-meter-group.d.ts +2 -0
- package/types/ngwr-checkbox.d.ts +1 -0
- package/types/ngwr-color-picker.d.ts +1 -0
- package/types/ngwr-context-menu.d.ts +1 -1
- package/types/ngwr-date-picker.d.ts +19 -0
- package/types/ngwr-dialog.d.ts +39 -8
- package/types/ngwr-directives.d.ts +12 -4
- package/types/ngwr-drawer.d.ts +1 -1
- package/types/ngwr-dropdown.d.ts +1 -1
- package/types/ngwr-event-calendar.d.ts +4 -0
- package/types/ngwr-form.d.ts +85 -1
- package/types/ngwr-i18n.d.ts +65 -5
- package/types/ngwr-input-number.d.ts +8 -0
- package/types/ngwr-input.d.ts +7 -0
- package/types/ngwr-layout.d.ts +1 -1
- package/types/ngwr-loading-bar-router.d.ts +6 -0
- package/types/ngwr-page-header.d.ts +23 -1
- package/types/ngwr-popconfirm.d.ts +1 -1
- package/types/ngwr-popover.d.ts +28 -4
- package/types/ngwr-radio.d.ts +47 -5
- package/types/ngwr-segmented.d.ts +7 -0
- package/types/ngwr-select.d.ts +57 -13
- package/types/ngwr-sortable-list.d.ts +20 -7
- package/types/ngwr-table.d.ts +58 -5
- package/types/ngwr-tabs-router.d.ts +6 -0
- package/types/ngwr-toast.d.ts +11 -0
- package/types/ngwr-tour.d.ts +0 -1
- package/types/ngwr-typography.d.ts +7 -0
- package/types/ngwr-utils-router.d.ts +6 -0
- package/types/ngwr-utils.d.ts +56 -2
- package/types/ngwr-validators.d.ts +49 -1
- package/types/ngwr-version.d.ts +1 -1
- package/typography/styles/_index.scss +4 -0
- package/window/styles/_index.scss +1 -9
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ngwr-i18n.mjs","names":[],"sources":["../../../projects/lib/i18n/i18n-base-catalogs.ts","../../../projects/lib/i18n/i18n-config.ts","../../../projects/lib/i18n/i18n-loader.ts","../../../projects/lib/i18n/i18n.ts","../../../projects/lib/i18n/t.pipe.ts","../../../projects/lib/i18n/t.directive.ts","../../../projects/lib/i18n/loaders/static-loader.ts","../../../projects/lib/i18n/loaders/http-loader.ts","../../../projects/lib/i18n/provide-wr-i18n.ts","../../../projects/lib/i18n/util.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 { InjectionToken } from '@angular/core';\n\nimport { type WrI18nCatalog } from './i18n-config';\n\n/** Base catalogs keyed by locale, contributed by {@link provideWrI18nBaseCatalogs}. */\nexport type WrI18nBaseCatalogs = Readonly<Record<string, WrI18nCatalog>>;\n\n/**\n * Catalogs consulted *underneath* whatever the loader returned — the place for\n * ngwr's own built-in strings.\n *\n * A loader **replaces** the catalog for a locale rather than extending it, so an\n * app whose JSON holds only its own keys used to lose every built-in label to\n * its hardcoded English fallback, silently. Registering `wrRu` / `wrEn` here\n * puts them back without the app having to merge anything itself.\n *\n * `multi`, so several features can each contribute; later contributions win on\n * a key collision, and anything the loader returned still wins over all of them.\n *\n * It has to be handed in by the consumer rather than wired up inside\n * `provideWrI18n()`: the catalogs are their own entry points (`ngwr/i18n/ru`)\n * and they already import from `ngwr/i18n`, so importing them back here would\n * be a circular dependency between entry points. Passing them in also keeps\n * the locales you don't ship out of your bundle.\n */\nexport const WR_I18N_BASE_CATALOGS = new InjectionToken<readonly WrI18nBaseCatalogs[]>('WR_I18N_BASE_CATALOGS');\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, LOCALE_ID, inject } from '@angular/core';\n\n/** Translation catalog — flat or nested record of strings. */\nexport interface WrI18nCatalog {\n readonly [key: string]: string | WrI18nCatalog;\n}\n\n/** Parameters passed to interpolation — coerced to strings via `String(v)`. */\nexport type WrI18nParams = Readonly<Record<string, unknown>>;\n\n/**\n * The third argument of `WrI18n.t()`, `WrI18n.translate()` and the `wrT` pipe,\n * where a bare string is the scope.\n */\nexport interface WrI18nTranslateOptions {\n /** Scoped lookup first, then the root catalog. */\n readonly scope?: string;\n\n /**\n * Returned as is when the key is missing: no interpolation, no\n * `missingHandler` call. `null` and `undefined` mean no fallback.\n */\n readonly fallback?: string | null;\n}\n\n/** Hook called once on every key that resolves to nothing. */\nexport type WrI18nMissingHandler = (key: string, locale: string) => string;\n\n/** User-facing config for {@link provideWrI18n}. */\nexport interface WrI18nConfig {\n /**\n * BCP-47 tag used until the user calls `use()`.\n *\n * Omitted, it is Angular's own `LOCALE_ID` — the app already states its\n * locale there, and ngwr having a second, unrelated default is how a fully\n * Russian app came to render an English calendar inside itself. See\n * {@link WrI18n} for the whole precedence.\n *\n * @default LOCALE_ID\n */\n readonly defaultLocale?: string;\n\n /**\n * Whitelisted locales — `use()` ignores anything outside this list. Omitted,\n * it is `[defaultLocale]`: it used to be a hardcoded `['en']`, so\n * `provideWrI18n({ defaultLocale: 'ru' })` produced a service whose own\n * default locale was not switchable back to.\n *\n * @default [defaultLocale]\n */\n readonly availableLocales?: readonly string[];\n\n /**\n * Storage key for persisting the active locale (via `WrStorage`).\n * Set to `null` to disable persistence. @default 'wr:i18n:locale'\n */\n readonly storageKey?: string | null;\n\n /** Called when a key is missing. Default returns the key itself. */\n readonly missingHandler?: WrI18nMissingHandler;\n}\n\n/** Resolved config — every field non-optional. @internal */\nexport interface WrI18nConfigResolved {\n readonly defaultLocale: string;\n readonly availableLocales: readonly string[];\n readonly storageKey: string | null;\n readonly missingHandler: WrI18nMissingHandler;\n}\n\n/**\n * Everything but the locale, which cannot be a constant: it is resolved from\n * `LOCALE_ID` in an injection context. @internal\n */\nexport const DEFAULT_WR_I18N_CONFIG: Omit<WrI18nConfigResolved, 'defaultLocale' | 'availableLocales'> = {\n storageKey: 'wr:i18n:locale',\n missingHandler: key => key,\n};\n\n/**\n * Resolve the locale half of the config. Callable only from an injection\n * context, because the seed is `LOCALE_ID`. @internal\n */\nexport function resolveWrI18nLocales(\n config: WrI18nConfig\n): Pick<WrI18nConfigResolved, 'defaultLocale' | 'availableLocales'> {\n const defaultLocale = config.defaultLocale ?? inject(LOCALE_ID);\n return { defaultLocale, availableLocales: config.availableLocales ?? [defaultLocale] };\n}\n\nexport const WR_I18N_CONFIG = new InjectionToken<WrI18nConfigResolved>('WR_I18N_CONFIG', {\n factory: () => ({ ...DEFAULT_WR_I18N_CONFIG, ...resolveWrI18nLocales({}) }),\n});\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { InjectionToken } from '@angular/core';\n\nimport { of, type Observable } from 'rxjs';\n\nimport { type WrI18nCatalog } from './i18n-config';\n\n/**\n * Loads a catalog for a `(locale, scope)` pair. `scope` is `null` for the\n * root catalog. Implementations may return the catalog synchronously\n * (via `of(...)`) for static catalogs or asynchronously (via HTTP) for\n * lazy fetches.\n */\nexport interface WrI18nLoader {\n load(locale: string, scope: string | null): Observable<WrI18nCatalog>;\n}\n\n/**\n * The active loader.\n *\n * Defaults to one that serves an empty catalog, which is what makes\n * `provideWrI18n()` genuinely optional: every ngwr component routes its\n * built-in strings through `useI18nText` / `wrReadI18nText`, those inject\n * `WrI18n` optionally — and because `WrI18n` is `providedIn: 'root'`, an\n * optional inject still CONSTRUCTS it. Without a default here that construction\n * threw `NG0201: No provider found for WR_I18N_LOADER`, so an app that had\n * simply not configured i18n could not render `<wr-alert>` at all.\n *\n * With the empty catalog, every lookup misses, `t()` hands back the key, and\n * the helpers fall through to the component's own English default — the\n * documented no-i18n behaviour.\n */\nexport const WR_I18N_LOADER = new InjectionToken<WrI18nLoader>('WR_I18N_LOADER', {\n providedIn: 'root',\n factory: () => ({ load: () => of({}) }),\n});\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { LOCALE_ID, Service, type Signal, computed, effect, inject, isDevMode, signal } from '@angular/core';\n\nimport { type Observable, firstValueFrom } from 'rxjs';\n\nimport { WrStorage } from 'ngwr/storage';\n\nimport { WR_I18N_BASE_CATALOGS } from './i18n-base-catalogs';\nimport { WR_I18N_CONFIG, type WrI18nCatalog, type WrI18nParams, type WrI18nTranslateOptions } from './i18n-config';\nimport { WR_I18N_LOADER } from './i18n-loader';\n\n/** Cache key shape: `<locale>::<scope|''>`. @internal */\nfunction cacheKey(locale: string, scope: string | null): string {\n return `${locale}::${scope ?? ''}`;\n}\n\n/**\n * A locale and the language under it: `'ru-RU'` gives `['ru-RU', 'ru']`.\n *\n * Every lookup and every load walks this, so a catalog registered as `ru`\n * answers an app running `ru-RU`. Without it the two spellings are unrelated\n * strings, and the miss is silent — `t()` returns the key, `useI18nText` reads\n * that as \"missing\" and serves the English fallback, so a fully translated app\n * renders English with nothing logged. It only ever truncates: an `en` lookup\n * never reaches an `en-US` catalog, because a language is not a region.\n *\n * @internal\n */\nfunction localeChain(locale: string): readonly string[] {\n const dash = locale.indexOf('-');\n return dash > 0 ? [locale, locale.slice(0, dash)] : [locale];\n}\n\n/** Walk a dotted path through a catalog tree. Returns string | null. @internal */\nfunction walk(cat: WrI18nCatalog | null, key: string): string | null {\n if (!cat) return null;\n let node: string | WrI18nCatalog | undefined = cat;\n for (const part of key.split('.')) {\n if (node === undefined || typeof node === 'string') return null;\n node = node[part];\n }\n return typeof node === 'string' ? node : null;\n}\n\n/**\n * `{{name}}` interpolation. Missing params resolve to `''`. Exported so\n * helpers in `util.ts` can interpolate the fallback template when no\n * `WrI18n` provider is wired up.\n *\n * @internal\n */\nexport function wrInterpolate(template: string, params: WrI18nParams | undefined): string {\n if (!params) return template;\n return template.replace(/\\{\\{\\s*([\\w.-]+)\\s*\\}\\}/g, (_match, name: string) => {\n const v = params[name];\n if (v === undefined || v === null) return '';\n if (typeof v === 'string') return v;\n if (typeof v === 'number' || typeof v === 'boolean') return String(v);\n try {\n return JSON.stringify(v);\n } catch {\n return '';\n }\n });\n}\n\n/**\n * Reactive i18n service. Holds:\n *\n * - the active locale as a `Signal<string>`\n * - per-`(locale, scope)` catalogs in a `Map` (loaded once, then cached)\n * - a per-locale signal counter so every `translate()` reading the signal\n * re-evaluates the moment a new catalog finishes loading\n *\n * Translations are looked up scope-first then root, per locale, and the locale\n * itself is tried as the full tag before the bare language underneath it — so\n * an app running `ru-RU` resolves against a catalog registered as `ru`, and a\n * regional catalog is never shadowed by a scope in the base language. For an\n * app that spells its locale one way, which is every app that existed before\n * the chain, the order is exactly what it always was.\n *\n * ## Which locale wins\n *\n * ngwr has three locale inputs and they used to be three unrelated answers — an\n * app that set `LOCALE_ID: 'ru-RU'` correctly still rendered an English\n * calendar, because the date token defaulted to `navigator.language`. The\n * precedence is now stated, highest first:\n *\n * 1. **A subsystem's own explicit option.** `withDates({ locale })` pins\n * dates; `provideWrI18n({ defaultLocale })` pins the catalog. The most\n * specific statement wins, because it can only have been deliberate.\n * 2. **`WrI18n.locale()` — the runtime value.** The only one of the three that\n * can change without a reload, so it is what a language switcher writes.\n * With `provideWrI18n()` in the app, dates are written in it.\n * 3. **`LOCALE_ID`.** Angular's app-wide constant, and the seed for both of the\n * above when neither was given. One statement, one answer.\n * 4. `'en-US'`, which is what `LOCALE_ID` itself falls back to.\n *\n * `navigator.language` is deliberately NOT in that list. It is the browser's\n * preference, not the application's, and reading it made prerendered output and\n * the hydrated page disagree.\n *\n * **What a runtime switch reaches, and what it does not.** `use()` repaints\n * every catalog string, and every date: the date adapter, and so\n * `wr-calendar`, `wr-date-picker`, `wrDate` and `wr-date-stamp`, formats in\n * this locale unless `withDates({ locale })` pinned another. It does not move\n * `LOCALE_ID`, which is a constant, so anything keyed on it — `wrNumber` /\n * `wrPlural`, `wr-input-number`, `wr-statistic`, `wr-counter` — stays where it\n * was. `use()` says so once in dev mode rather than leaving it to be\n * discovered.\n *\n * @example\n * ```ts\n * const i18n = inject(WrI18n);\n * i18n.use('ru'); // switch locale\n * i18n.t('cart.checkout'); // → 'Оформить заказ'\n * i18n.t('greeting', { name: 'Ada' }); // → 'Hello, Ada!'\n * i18n.t(`types.${type}`, undefined, { fallback: type }); // → type, when no key\n *\n * effect(() => console.log(i18n.translate('hi')())); // re-runs on locale change\n * ```\n *\n * @see https://ngwr.dev/reference/services/i18n\n */\n@Service()\nexport class WrI18n {\n private readonly config = inject(WR_I18N_CONFIG);\n private readonly loader = inject(WR_I18N_LOADER);\n private readonly storage = inject(WrStorage);\n\n /**\n * Angular's own locale. Read for the dev-mode drift warning only — the\n * resolved default already folded it in through `WR_I18N_CONFIG`. @internal\n */\n private readonly localeId = inject(LOCALE_ID);\n\n /**\n * Catalogs registered via `provideWrI18nBaseCatalogs()` — the floor under the\n * loader's own catalogs, so ngwr's built-in strings survive an app that only\n * ships its own keys. @internal\n */\n private readonly baseCatalogs = inject(WR_I18N_BASE_CATALOGS, { optional: true }) ?? [];\n\n /** Per-(locale,scope) catalogs, populated by `loadCatalog`. @internal */\n private readonly catalogs = new Map<string, WrI18nCatalog>();\n\n /** Bumped after each catalog write so reactive translates recompute. @internal */\n private readonly revision = signal(0);\n\n /** In-flight load promises — dedupes parallel `t()` callers. @internal */\n private readonly inflight = new Map<string, Promise<WrI18nCatalog>>();\n\n /** Registered scopes — auto-loaded whenever the locale changes. @internal */\n private readonly scopes = new Set<string>();\n\n /** Active locale. Writes go through `use()` so storage stays in sync. */\n private readonly _locale = signal<string>(this.initialLocale());\n readonly locale: Signal<string> = this._locale.asReadonly();\n\n constructor() {\n // Eagerly load the root catalog + every registered scope for the\n // current locale. Subsequent locale changes refire the same effect.\n effect(() => {\n const lc = this._locale();\n void this.loadChain(lc, null);\n for (const sc of this.scopes) void this.loadChain(lc, sc);\n });\n }\n\n // Locale\n\n /**\n * Switch active locale. Ignored when not whitelisted.\n *\n * Text and dates — see the class docs for what a runtime switch cannot reach. The\n * dev-mode warning below is the whole reporting of that limit; without it the\n * failure is a screen showing German labels beside `1,234.5`, with nothing\n * anywhere saying why.\n */\n use(locale: string): void {\n if (!this.config.availableLocales.includes(locale)) return;\n const previous = this._locale();\n this._locale.set(locale);\n if (this.config.storageKey) this.storage.set(this.config.storageKey, locale);\n if (isDevMode() && previous !== locale) this.warnOnLocaleIdDrift(locale);\n }\n\n /** Available locales — pass-through from config. */\n available(): readonly string[] {\n return this.config.availableLocales;\n }\n\n // Scopes\n\n /**\n * Register a scope so its catalog loads alongside the root one. Idempotent.\n * Returns a promise resolving once the current locale's scope catalog is in\n * the cache — handy for feature `canActivate` guards.\n */\n registerScope(scope: string): Promise<WrI18nCatalog> {\n this.scopes.add(scope);\n const lc = this._locale();\n // Resolve on the exact tag: the promise is what a `canActivate` waits on,\n // and the base-language catalog is only ever a fallback under it.\n const exact = this.loadCatalog(lc, scope);\n void this.loadChain(lc, scope);\n return exact;\n }\n\n // Translate\n\n /**\n * Eager translate — returns the current value or the missing-handler\n * fallback. Does NOT auto-load missing catalogs; combine with the\n * reactive `translate(...)` if you want load-on-demand.\n *\n * The third argument is a scope, or `{ scope, fallback }`. With a `fallback`\n * a missing key returns it as is, not interpolated, and `missingHandler` is\n * not called: for a key built from a server value that may have no\n * translation.\n */\n t(key: string, params?: WrI18nParams, scopeOrOptions?: string | WrI18nTranslateOptions): string {\n // Read revision so callers inside computed/effect re-run on updates.\n this.revision();\n const lc = this._locale();\n const options = typeof scopeOrOptions === 'string' ? { scope: scopeOrOptions } : scopeOrOptions;\n const scope = options?.scope;\n\n const chain = localeChain(lc);\n let hit: string | null = null;\n for (const candidate of chain) {\n if (scope) hit = walk(this.catalogs.get(cacheKey(candidate, scope)) ?? null, key);\n hit ??= walk(this.catalogs.get(cacheKey(candidate, null)) ?? null, key);\n if (hit !== null) break;\n }\n // Base catalogs are the floor: consulted only once the loader's own catalogs\n // have missed, so an app's keys always win, but ngwr's built-in strings are\n // still there when the app's catalog doesn't carry them.\n hit ??= this.walkBase(chain, key);\n\n if (hit === null) {\n // Fire a background load so a future read can resolve it.\n void this.loadChain(lc, scope ?? null);\n return options?.fallback ?? this.config.missingHandler(key, lc);\n }\n return wrInterpolate(hit, params);\n }\n\n /** Reactive translate — re-evaluates on locale or catalog updates. */\n translate(key: string, params?: WrI18nParams, scopeOrOptions?: string | WrI18nTranslateOptions): Signal<string> {\n return computed(() => this.t(key, params, scopeOrOptions));\n }\n\n // Internals\n\n /**\n * Look a key up in the registered base catalogs, later contributions first so\n * a feature can shadow an earlier one.\n */\n private walkBase(chain: readonly string[], key: string): string | null {\n for (const locale of chain) {\n for (let i = this.baseCatalogs.length - 1; i >= 0; i--) {\n const hit = walk(this.baseCatalogs[i][locale] ?? null, key);\n if (hit !== null) return hit;\n }\n }\n return null;\n }\n\n private initialLocale(): string {\n if (this.config.storageKey) {\n const saved = this.storage.get<string>(this.config.storageKey);\n if (saved && this.config.availableLocales.includes(saved)) return saved;\n }\n return this.config.defaultLocale;\n }\n\n /**\n * Load a `(locale, scope)` catalog and, when the locale carries a region, the\n * bare-language one under it. Both go in the cache; `t()` reads them in that\n * order.\n */\n private loadChain(locale: string, scope: string | null): Promise<unknown> {\n return Promise.all(localeChain(locale).map(candidate => this.loadCatalog(candidate, scope)));\n }\n\n /** One warning per service, not one per switch. @internal */\n private warnedLocaleIdDrift = false;\n\n /**\n * Say once, in dev, that a runtime switch moved the text and nothing else.\n *\n * The mismatch is otherwise invisible in the way that costs the most time:\n * the catalog strings and the dates all change, which reads as \"the switch\n * worked\", and the numbers beside them are still correct-looking output in\n * the old locale. Silent when the new locale IS `LOCALE_ID`, because then nothing is\n * out of step and a warning that fires when everything agrees is one people\n * learn to ignore. Production builds drop the call entirely via `isDevMode()`\n * tree-shaking.\n */\n private warnOnLocaleIdDrift(locale: string): void {\n if (this.warnedLocaleIdDrift || locale === this.localeId) return;\n this.warnedLocaleIdDrift = true;\n // eslint-disable-next-line no-console -- dev-mode validation\n console.warn(\n `[NGWR] WrI18n.use('${locale}') switched the catalog, but LOCALE_ID is still '${this.localeId}'. ` +\n `Dates follow the switch (wrDate, wr-calendar, wr-date-picker), unless withDates({ locale }) pinned ` +\n `them. LOCALE_ID is an Angular constant, so formatted numbers do not and stay on '${this.localeId}': ` +\n `the wrNumber / wrPlural pipes, wr-input-number, wr-statistic, wr-counter, wr-pagination's total ` +\n `and wr-file-upload's sizes. Reload the app with the new LOCALE_ID to move those.`\n );\n }\n\n private loadCatalog(locale: string, scope: string | null): Promise<WrI18nCatalog> {\n const ck = cacheKey(locale, scope);\n const cached = this.catalogs.get(ck);\n if (cached) return Promise.resolve(cached);\n\n const pending = this.inflight.get(ck);\n if (pending) return pending;\n\n const stream: Observable<WrI18nCatalog> = this.loader.load(locale, scope);\n const promise = firstValueFrom(stream)\n .then(catalog => {\n this.catalogs.set(ck, catalog);\n this.revision.update(v => v + 1);\n return catalog;\n })\n .catch((err: unknown) => {\n // eslint-disable-next-line no-console -- intentional diagnostic for missing catalog\n console.warn(`[ngwr/i18n] failed to load (${locale}, ${scope ?? 'root'})`, err);\n const empty: WrI18nCatalog = {};\n this.catalogs.set(ck, empty);\n return empty;\n })\n .finally(() => {\n this.inflight.delete(ck);\n });\n\n this.inflight.set(ck, promise);\n return promise;\n }\n}\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { Pipe, type PipeTransform, inject } from '@angular/core';\n\nimport { WrI18n } from './i18n';\nimport { type WrI18nParams, type WrI18nTranslateOptions } from './i18n-config';\n\n/**\n * Translate a key. Impure — re-evaluates on every CD so locale switches\n * and catalog loads propagate without a manual refresh.\n *\n * @example\n * ```html\n * <h1>{{ 'home.title' | wrT }}</h1>\n * <p>{{ 'greeting' | wrT: { name: user().name } }}</p>\n * <button>{{ 'forms.save' | wrT: null : 'checkout' }}</button>\n * <span>{{ 'types.' + type | wrT: null : { fallback: type } }}</span>\n * ```\n */\n// eslint-disable-next-line @angular-eslint/no-pipe-impure -- intentional: locale + catalog updates must propagate even when args are stable\n@Pipe({ name: 'wrT', pure: false })\nexport class WrTPipe implements PipeTransform {\n private readonly i18n = inject(WrI18n);\n\n transform(key: string, params?: WrI18nParams | null, scopeOrOptions?: string | WrI18nTranslateOptions): string {\n return this.i18n.t(key, params ?? undefined, scopeOrOptions);\n }\n}\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { Directive, ElementRef, computed, effect, inject, input } from '@angular/core';\n\nimport { WrI18n } from './i18n';\nimport { type WrI18nParams } from './i18n-config';\n\n/**\n * Attribute directive that sets `textContent` of its host to the translation\n * of the bound key. Reactive — re-renders on locale + catalog changes.\n *\n * @example\n * ```html\n * <span [wrT]=\"'home.title'\"></span>\n * <span [wrT]=\"'greeting'\" [wrTParams]=\"{ name: user().name }\"></span>\n * <span [wrT]=\"'forms.save'\" wrTScope=\"checkout\"></span>\n * <span [wrT]=\"'types.' + type\" [wrTFallback]=\"type\"></span>\n * ```\n */\n@Directive({\n selector: '[wrT]',\n})\nexport class WrTDirective {\n /** Translation key. Required. */\n readonly wrT = input.required<string>();\n\n /** Interpolation params for `{{name}}` tokens. */\n readonly wrTParams = input<WrI18nParams | null>(null);\n\n /** Optional scope — scoped lookup first, then root fallback. */\n readonly wrTScope = input<string | null>(null);\n\n /** Text shown as is when the key is missing; `missingHandler` is not called. */\n readonly wrTFallback = input<string | null>(null);\n\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\n private readonly i18n = inject(WrI18n);\n\n private readonly text = computed(() =>\n this.i18n.t(this.wrT(), this.wrTParams() ?? undefined, {\n scope: this.wrTScope() ?? undefined,\n fallback: this.wrTFallback(),\n })\n );\n\n constructor() {\n effect(() => {\n this.host.nativeElement.textContent = this.text();\n });\n }\n}\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { type Observable, of } from 'rxjs';\n\nimport { type WrI18nCatalog } from '../i18n-config';\nimport { type WrI18nLoader } from '../i18n-loader';\n\n/** Root catalogs keyed by locale: `{ en: catalog, ru: catalog, … }`. */\nexport type WrI18nStaticCatalogs = Readonly<Record<string, WrI18nCatalog>>;\n\n/** Per-scope catalogs: `{ checkout: { en: catalog, ru: catalog }, … }`. */\nexport type WrI18nStaticScopedCatalogs = Readonly<Record<string, WrI18nStaticCatalogs>>;\n\n/**\n * Loader for catalogs already in memory (imported from JSON or generated).\n *\n * - Pass `catalogs` for the root catalog of every locale.\n * - Pass `scopes` if you ship per-feature catalogs the loader should serve\n * to `WrI18n.registerScope(name)` calls.\n *\n * Missing locale or scope resolves to `{}` — the missing-key handler then\n * decides what to render.\n */\nexport class WrI18nStaticLoader implements WrI18nLoader {\n constructor(\n private readonly catalogs: WrI18nStaticCatalogs,\n private readonly scopes: WrI18nStaticScopedCatalogs = {}\n ) {}\n\n load(locale: string, scope: string | null): Observable<WrI18nCatalog> {\n if (scope === null) return of(this.catalogs[locale] ?? {});\n return of(this.scopes[scope]?.[locale] ?? {});\n }\n}\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { HttpClient } from '@angular/common/http';\nimport { inject } from '@angular/core';\n\nimport { type Observable, catchError, of } from 'rxjs';\n\nimport { type WrI18nCatalog } from '../i18n-config';\nimport { type WrI18nLoader } from '../i18n-loader';\n\n/** Configuration for {@link WrI18nHttpLoader}. */\nexport interface WrI18nHttpLoaderConfig {\n /**\n * URL template. Tokens:\n * - `{locale}` — required, BCP-47 tag (e.g. `en`).\n * - `{scope}` — optional, scope name. Use the `rootPath` if you need a\n * different path entirely for the root catalog.\n *\n * @example\n * ```ts\n * { path: '/assets/i18n/{locale}.json' } // root only\n * { path: '/assets/i18n/{scope}/{locale}.json',\n * rootPath: '/assets/i18n/{locale}.json' } // root + scopes\n * ```\n */\n readonly path: string;\n /** Path template for the root catalog. Defaults to `path`. */\n readonly rootPath?: string;\n}\n\n/**\n * Loader that fetches catalogs via `HttpClient`. Failures resolve to `{}`\n * (logged once at the service layer) so a missing file never throws into\n * user code.\n */\nexport class WrI18nHttpLoader implements WrI18nLoader {\n private readonly http = inject(HttpClient);\n\n constructor(private readonly config: WrI18nHttpLoaderConfig) {}\n\n load(locale: string, scope: string | null): Observable<WrI18nCatalog> {\n const template = scope === null ? (this.config.rootPath ?? this.config.path) : this.config.path;\n const url = template.replace('{locale}', locale).replace('{scope}', scope ?? '');\n return this.http.get<WrI18nCatalog>(url).pipe(catchError(() => of<WrI18nCatalog>({})));\n }\n}\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport {\n ApplicationRef,\n EnvironmentInjector,\n type EnvironmentProviders,\n type Provider,\n inject,\n makeEnvironmentProviders,\n provideEnvironmentInitializer,\n} from '@angular/core';\n\nimport { WR_LIVE_LOCALE } from 'ngwr/utils';\n\nimport { WrI18n } from './i18n';\nimport { WR_I18N_BASE_CATALOGS, type WrI18nBaseCatalogs } from './i18n-base-catalogs';\nimport {\n DEFAULT_WR_I18N_CONFIG,\n WR_I18N_CONFIG,\n type WrI18nConfig,\n type WrI18nConfigResolved,\n resolveWrI18nLocales,\n} from './i18n-config';\nimport { WR_I18N_LOADER, type WrI18nLoader } from './i18n-loader';\nimport { WrI18nHttpLoader, type WrI18nHttpLoaderConfig } from './loaders/http-loader';\nimport {\n WrI18nStaticLoader,\n type WrI18nStaticCatalogs,\n type WrI18nStaticScopedCatalogs,\n} from './loaders/static-loader';\n\n/**\n * Configure {@link WrI18n}. Either pass a `loader` directly, or use the\n * `provideWrI18nHttpLoader` / `provideWrI18nStaticLoader` helpers in the\n * same providers array.\n */\nexport interface ProvideWrI18nOptions extends WrI18nConfig {\n readonly loader?: WrI18nLoader;\n}\n\n/**\n * Configure {@link WrI18n} for the application.\n *\n * Call it in the application's root providers (`bootstrapApplication` or\n * `ApplicationConfig`), together with {@link provideWrI18nBaseCatalogs} and the\n * loader. `WrI18n` is a root service: a route's `providers` or a lazy module\n * never reach it, so a locale or catalogs given there do nothing, and dev mode\n * warns. A lazy area switches the language at runtime with\n * `inject(WrI18n).use('de')`, for example in its resolver. The switch is\n * app-wide, and the locale must be in the root `availableLocales`. The area's\n * own keys load with `registerScope()`.\n */\nexport function provideWrI18n(options: ProvideWrI18nOptions = {}): EnvironmentProviders {\n const { loader, ...config } = options;\n\n const providers: (Provider | EnvironmentProviders)[] = [\n {\n provide: WR_I18N_CONFIG,\n // A factory rather than a value: `defaultLocale` falls back to `LOCALE_ID`,\n // which only an injection context can read.\n useFactory: (): WrI18nConfigResolved => ({\n ...DEFAULT_WR_I18N_CONFIG,\n ...config,\n ...resolveWrI18nLocales(config),\n }),\n },\n ];\n if (loader) providers.push({ provide: WR_I18N_LOADER, useValue: loader });\n // What `ngwr/date` formats in, so dates follow `use()` without importing this entry point.\n providers.push({ provide: WR_LIVE_LOCALE, useFactory: () => inject(WrI18n).locale });\n\n if (typeof ngDevMode === 'undefined' || ngDevMode) {\n providers.push(\n provideEnvironmentInitializer(() => {\n const here = inject(EnvironmentInjector);\n if (here === inject(ApplicationRef, { optional: true })?.injector) return;\n // An injector that lists WrI18n itself owns an instance that does read this config.\n if (here.get(WrI18n, null, { self: true })) return;\n // eslint-disable-next-line no-console -- dev-mode validation\n console.warn(\n '[NGWR] provideWrI18n() is in a route or child injector. WrI18n is a root service, so this ' +\n \"configuration is ignored. Move provideWrI18n() and the catalogs to the application's root \" +\n 'providers, and switch a lazy area with inject(WrI18n).use(locale).'\n );\n })\n );\n }\n\n return makeEnvironmentProviders(providers);\n}\n\n/**\n * Provide a static loader — catalogs already in memory.\n *\n * A loader serves only the catalog you pass it, and ngwr registers none of its\n * own. Pass only your own keys here and register ngwr's catalogs with\n * {@link provideWrI18nBaseCatalogs} — not `{ ...wrRu, ...yours }`. A spread is\n * shallow, so any namespace you share with ngwr, e.g. `common`, `form`,\n * `table`, keeps only the keys of the side spread last, and the other side's\n * keys stop resolving with nothing logged: ngwr's components fall back to their\n * English defaults, and a `wrT` read of a lost key renders the raw key under the\n * default missing handler.\n *\n * @param catalogs Root catalogs keyed by locale.\n * @param scopes Optional per-scope catalogs served to `registerScope(name)`.\n */\nexport function provideWrI18nStaticLoader(\n catalogs: WrI18nStaticCatalogs,\n scopes?: WrI18nStaticScopedCatalogs\n): Provider {\n return { provide: WR_I18N_LOADER, useValue: new WrI18nStaticLoader(catalogs, scopes) };\n}\n\n/**\n * Register catalogs consulted *underneath* the loader — this is how ngwr's own\n * built-in strings survive when you supply your own catalogs.\n *\n * A loader replaces the catalog for a locale instead of extending it, so a JSON\n * file holding only your keys leaves every built-in label on its hardcoded\n * English fallback, with nothing logged. One line fixes it, on either loader:\n *\n * @example\n * ```ts\n * import { wrRu } from 'ngwr/i18n/ru';\n *\n * providers: [\n * provideWrI18n({ defaultLocale: 'ru', availableLocales: ['ru'] }),\n * provideWrI18nBaseCatalogs({ ru: wrRu }),\n * provideWrI18nHttpLoader({ path: '/assets/i18n/{locale}.json' }),\n * ]\n * ```\n *\n * Pass only the locales you ship — the ones you leave out stay out of the\n * bundle. Your own keys always win; this is a floor, not an override.\n *\n * Use it instead of spreading `wrRu` into your own catalog, too: the lookup\n * walks these key by key after the loader's catalog misses, so a namespace both\n * define keeps both halves, where a shallow spread keeps only one.\n */\nexport function provideWrI18nBaseCatalogs(catalogs: WrI18nBaseCatalogs): Provider {\n return { provide: WR_I18N_BASE_CATALOGS, useValue: catalogs, multi: true };\n}\n\n/** Provide an HTTP loader — catalogs fetched from URLs. Requires `provideHttpClient`. */\nexport function provideWrI18nHttpLoader(config: WrI18nHttpLoaderConfig): Provider {\n return { provide: WR_I18N_LOADER, useFactory: () => new WrI18nHttpLoader(config) };\n}\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { type Signal, computed, inject, signal } from '@angular/core';\n\nimport { WrI18n, wrInterpolate } from './i18n';\nimport type { WrI18nParams } from './i18n-config';\n\n/**\n * Helper for component default text. Returns a reactive string that:\n *\n * 1. Prefers the consumer's override (an `input<string | null>()` value).\n * 2. Falls back to the i18n catalog under `key` — re-renders on locale\n * change so a switcher updates the DOM live.\n * 3. Falls back to `fallback` when no `WrI18n` is provided OR the catalog\n * is missing the key.\n *\n * Components don't need a hard dependency on `provideWrI18n` — without it,\n * the fallback is returned and everything still works.\n *\n * @example\n * ```ts\n * readonly emptyText = input<string | null>(null);\n * protected readonly empty = useI18nText(this.emptyText, 'table.empty', 'No data');\n *\n * // In template: <div>{{ empty() }}</div>\n * ```\n */\nexport function useI18nText(binding: Signal<string | null | undefined>, key: string, fallback: string): Signal<string> {\n const i18n = inject(WrI18n, { optional: true });\n if (!i18n) {\n return computed(() => {\n const v = binding();\n return v ?? fallback;\n });\n }\n\n return computed(() => {\n const v = binding();\n if (v !== null && v !== undefined && v !== '') return v;\n const translated = i18n.t(key);\n // Default missing handler returns the key itself — treat that as \"missing\"\n // and use our explicit fallback.\n return translated === key ? fallback : translated;\n });\n}\n\n/**\n * {@link useI18nText} without a binding to forward — for a built-in string the\n * component exposes no override input for. Same reactivity, same fallback\n * rules; the only difference is the missing first argument.\n *\n * It used to return a plain `string`, resolved once at injection time, and\n * that was wrong in the ordinary case rather than an edge one: `WrI18n` writes\n * every loader-backed catalog from `firstValueFrom(...).then(...)`, so even a\n * static loader serving an object literal lands a microtask AFTER the first\n * change-detection pass. Every component built in that pass read an empty\n * catalog and froze its English fallback for the life of the app — in one\n * `<wr-date-picker>` the field said \"Открыть календарь\" and the calendar\n * button beside it \"Open calendar\", off the same key.\n */\nexport function wrReadI18nText(key: string, fallback: string): Signal<string> {\n const i18n = inject(WrI18n, { optional: true });\n if (!i18n) return computed(() => fallback);\n\n return computed(() => {\n const v = i18n.t(key);\n return v === key ? fallback : v;\n });\n}\n\n/** Tiny shim — useful when the caller doesn't have an `input` to forward. */\nexport function nullSignal(): Signal<null> {\n return signal(null).asReadonly();\n}\n\n/**\n * Build a per-call formatter for parametrized labels (e.g. ARIA labels\n * that interpolate a per-row value: `\"Remove {{label}}\"`). Returns a\n * function the template calls with the params for the current item.\n *\n * The returned function:\n * - Re-resolves the i18n catalog on every call (live locale switches just\n * work — re-rendered templates pick up new strings).\n * - Falls back to the literal `fallback` template with the same\n * `{{name}}` syntax when no `WrI18n` provider is present, or when the\n * key is missing.\n *\n * Use this for labels that vary per row. For static labels, prefer\n * {@link useI18nText} or {@link wrReadI18nText}.\n *\n * @example\n * ```ts\n * protected readonly removeChipLabel = useI18nFormatter('select.removeItem', 'Remove {{label}}');\n *\n * // In template:\n * // [attr.aria-label]=\"removeChipLabel({ label: chip.label })\"\n * ```\n */\nexport function useI18nFormatter(key: string, fallback: string): (params?: WrI18nParams) => string {\n const i18n = inject(WrI18n, { optional: true });\n if (!i18n) {\n return (params?: WrI18nParams) => wrInterpolate(fallback, params);\n }\n return (params?: WrI18nParams) => {\n const v = i18n.t(key, params);\n return v === key ? wrInterpolate(fallback, params) : v;\n };\n}\n"],"mappings":";;;;;;;;;;;;AAgCA,MAAa,wBAAwB,IAAI,eAA8C,uBAAuB;;;;;;;ACiD9G,MAAa,yBAA2F;CACtG,YAAY;CACZ,iBAAgB,QAAO;AACxB;AAMD,SAAgB,qBACd,QAAoB;CAEpB,MAAM,gBAAgB,OAAO,iBAAiB,OAAO,SAAS;CAC9D,OAAO;EAAE;EAAe,kBAAkB,OAAO,oBAAoB,CAAC,aAAa;CAAC;AACtF;AAEA,MAAa,iBAAiB,IAAI,eAAqC,kBAAkB,EACvF,gBAAgB;CAAE,GAAG;CAAwB,GAAG,qBAAqB,CAAA,CAAE;AAAC,GACzE,CAAA;;;;;;;AC7DD,MAAa,iBAAiB,IAAI,eAA6B,kBAAkB;CAC/E,YAAY;CACZ,gBAAgB,EAAE,YAAY,GAAG,CAAA,CAAE,EAAC;AACrC,CAAA;;;;;;;ACvBD,SAAS,SAAS,QAAgB,OAAoB;CACpD,OAAO,GAAG,OAAM,IAAK,SAAS;AAChC;AAcA,SAAS,YAAY,QAAc;CACjC,MAAM,OAAO,OAAO,QAAQ,GAAG;CAC/B,OAAO,OAAO,IAAI,CAAC,QAAQ,OAAO,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM;AAC7D;AAGA,SAAS,KAAK,KAA2B,KAAW;CAClD,IAAI,CAAC,KAAK,OAAO;CACjB,IAAI,OAA2C;CAC/C,KAAK,MAAM,QAAQ,IAAI,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,EAAE,UAAU,KAAI,CAAE;CAC9C,IAAI,CAAC,MACH,QAAQ,WAA0B,cAAc,UAAU,MAAM;CAElE,QAAQ,WAAyB;EAC/B,MAAM,IAAI,KAAK,EAAE,KAAK,MAAM;EAC5B,OAAO,MAAM,MAAM,cAAc,UAAU,MAAM,IAAI;CACvD;AACF"}
|
|
1
|
+
{"version":3,"file":"ngwr-i18n.mjs","names":[],"sources":["../../../projects/lib/i18n/i18n-base-catalogs.ts","../../../projects/lib/i18n/i18n-config.ts","../../../projects/lib/i18n/i18n-loader.ts","../../../projects/lib/i18n/i18n.ts","../../../projects/lib/i18n/t.pipe.ts","../../../projects/lib/i18n/t.directive.ts","../../../projects/lib/i18n/loaders/static-loader.ts","../../../projects/lib/i18n/loaders/http-loader.ts","../../../projects/lib/i18n/provide-wr-i18n.ts","../../../projects/lib/i18n/util.ts","../../../projects/lib/i18n/http-error.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 { InjectionToken } from '@angular/core';\n\nimport { type WrI18nCatalog } from './i18n-config';\n\n/** Base catalogs keyed by locale, contributed by {@link provideWrI18nBaseCatalogs}. */\nexport type WrI18nBaseCatalogs = Readonly<Record<string, WrI18nCatalog>>;\n\n/**\n * Catalogs consulted *underneath* whatever the loader returned — the place for\n * ngwr's own built-in strings.\n *\n * A loader **replaces** the catalog for a locale rather than extending it, so an\n * app whose JSON holds only its own keys used to lose every built-in label to\n * its hardcoded English fallback, silently. Registering `wrRu` / `wrEn` here\n * puts them back without the app having to merge anything itself.\n *\n * `multi`, so several features can each contribute; later contributions win on\n * a key collision, and anything the loader returned still wins over all of them.\n *\n * It has to be handed in by the consumer rather than wired up inside\n * `provideWrI18n()`: the catalogs are their own entry points (`ngwr/i18n/ru`)\n * and they already import from `ngwr/i18n`, so importing them back here would\n * be a circular dependency between entry points. Passing them in also keeps\n * the locales you don't ship out of your bundle.\n */\nexport const WR_I18N_BASE_CATALOGS = new InjectionToken<readonly WrI18nBaseCatalogs[]>('WR_I18N_BASE_CATALOGS');\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, LOCALE_ID, inject } from '@angular/core';\n\n/** Translation catalog — flat or nested record of strings. */\nexport interface WrI18nCatalog {\n readonly [key: string]: string | WrI18nCatalog;\n}\n\n/** Parameters passed to interpolation — coerced to strings via `String(v)`. */\nexport type WrI18nParams = Readonly<Record<string, unknown>>;\n\n/**\n * The third argument of `WrI18n.t()`, `WrI18n.translate()` and the `wrT` pipe,\n * where a bare string is the scope.\n */\nexport interface WrI18nTranslateOptions {\n /** Scoped lookup first, then the root catalog. */\n readonly scope?: string;\n\n /**\n * Returned as is when the key is missing: no interpolation, no\n * `missingHandler` call. `null` and `undefined` mean no fallback.\n */\n readonly fallback?: string | null;\n}\n\n/** Hook called once on every key that resolves to nothing. */\nexport type WrI18nMissingHandler = (key: string, locale: string) => string;\n\n/** User-facing config for {@link provideWrI18n}. */\nexport interface WrI18nConfig {\n /**\n * BCP-47 tag used until the user calls `use()`.\n *\n * Omitted, it is Angular's own `LOCALE_ID` — the app already states its\n * locale there, and ngwr having a second, unrelated default is how a fully\n * Russian app came to render an English calendar inside itself. See\n * {@link WrI18n} for the whole precedence.\n *\n * @default LOCALE_ID\n */\n readonly defaultLocale?: string;\n\n /**\n * Whitelisted locales — `use()` ignores anything outside this list. Omitted,\n * it is `[defaultLocale]`: it used to be a hardcoded `['en']`, so\n * `provideWrI18n({ defaultLocale: 'ru' })` produced a service whose own\n * default locale was not switchable back to.\n *\n * @default [defaultLocale]\n */\n readonly availableLocales?: readonly string[];\n\n /**\n * Storage key for persisting the active locale (via `WrStorage`).\n * Set to `null` to disable persistence. @default 'wr:i18n:locale'\n */\n readonly storageKey?: string | null;\n\n /** Called when a key is missing. Default returns the key itself. */\n readonly missingHandler?: WrI18nMissingHandler;\n}\n\n/** Resolved config — every field non-optional. @internal */\nexport interface WrI18nConfigResolved {\n readonly defaultLocale: string;\n readonly availableLocales: readonly string[];\n readonly storageKey: string | null;\n readonly missingHandler: WrI18nMissingHandler;\n}\n\n/**\n * Everything but the locale, which cannot be a constant: it is resolved from\n * `LOCALE_ID` in an injection context. @internal\n */\nexport const DEFAULT_WR_I18N_CONFIG: Omit<WrI18nConfigResolved, 'defaultLocale' | 'availableLocales'> = {\n storageKey: 'wr:i18n:locale',\n missingHandler: key => key,\n};\n\n/**\n * Resolve the locale half of the config. Callable only from an injection\n * context, because the seed is `LOCALE_ID`. @internal\n */\nexport function resolveWrI18nLocales(\n config: WrI18nConfig\n): Pick<WrI18nConfigResolved, 'defaultLocale' | 'availableLocales'> {\n const defaultLocale = config.defaultLocale ?? inject(LOCALE_ID);\n return { defaultLocale, availableLocales: config.availableLocales ?? [defaultLocale] };\n}\n\nexport const WR_I18N_CONFIG = new InjectionToken<WrI18nConfigResolved>('WR_I18N_CONFIG', {\n factory: () => ({ ...DEFAULT_WR_I18N_CONFIG, ...resolveWrI18nLocales({}) }),\n});\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { InjectionToken } from '@angular/core';\n\nimport { of, type Observable } from 'rxjs';\n\nimport { type WrI18nCatalog } from './i18n-config';\n\n/**\n * Loads a catalog for a `(locale, scope)` pair. `scope` is `null` for the\n * root catalog. Implementations may return the catalog synchronously\n * (via `of(...)`) for static catalogs or asynchronously (via HTTP) for\n * lazy fetches.\n */\nexport interface WrI18nLoader {\n load(locale: string, scope: string | null): Observable<WrI18nCatalog>;\n}\n\n/**\n * The active loader.\n *\n * Defaults to one that serves an empty catalog, which is what makes\n * `provideWrI18n()` genuinely optional: every ngwr component routes its\n * built-in strings through `useI18nText` / `wrReadI18nText`, those inject\n * `WrI18n` optionally — and because `WrI18n` is `providedIn: 'root'`, an\n * optional inject still CONSTRUCTS it. Without a default here that construction\n * threw `NG0201: No provider found for WR_I18N_LOADER`, so an app that had\n * simply not configured i18n could not render `<wr-alert>` at all.\n *\n * With the empty catalog, every lookup misses, `t()` hands back the key, and\n * the helpers fall through to the component's own English default — the\n * documented no-i18n behaviour.\n */\nexport const WR_I18N_LOADER = new InjectionToken<WrI18nLoader>('WR_I18N_LOADER', {\n providedIn: 'root',\n factory: () => ({ load: () => of({}) }),\n});\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { LOCALE_ID, Service, type Signal, computed, effect, inject, isDevMode, signal } from '@angular/core';\n\nimport { type Observable, firstValueFrom } from 'rxjs';\n\nimport { WrStorage } from 'ngwr/storage';\n\nimport { WR_I18N_BASE_CATALOGS } from './i18n-base-catalogs';\nimport { WR_I18N_CONFIG, type WrI18nCatalog, type WrI18nParams, type WrI18nTranslateOptions } from './i18n-config';\nimport { WR_I18N_LOADER } from './i18n-loader';\n\n/** Cache key shape: `<locale>::<scope|''>`. @internal */\nfunction cacheKey(locale: string, scope: string | null): string {\n return `${locale}::${scope ?? ''}`;\n}\n\n/**\n * A locale and the language under it: `'ru-RU'` gives `['ru-RU', 'ru']`.\n *\n * Every lookup and every load walks this, so a catalog registered as `ru`\n * answers an app running `ru-RU`. Without it the two spellings are unrelated\n * strings, and the miss is silent — `t()` returns the key, `useI18nText` reads\n * that as \"missing\" and serves the English fallback, so a fully translated app\n * renders English with nothing logged. It only ever truncates: an `en` lookup\n * never reaches an `en-US` catalog, because a language is not a region.\n *\n * @internal\n */\nfunction localeChain(locale: string): readonly string[] {\n const dash = locale.indexOf('-');\n return dash > 0 ? [locale, locale.slice(0, dash)] : [locale];\n}\n\n/** Walk a dotted path through a catalog tree. Returns string | null. @internal */\nfunction walk(cat: WrI18nCatalog | null, key: string): string | null {\n if (!cat) return null;\n let node: string | WrI18nCatalog | undefined = cat;\n for (const part of key.split('.')) {\n if (node === undefined || typeof node === 'string') return null;\n node = node[part];\n }\n return typeof node === 'string' ? node : null;\n}\n\n/**\n * `{{name}}` interpolation. Missing params resolve to `''`. Exported so\n * helpers in `util.ts` can interpolate the fallback template when no\n * `WrI18n` provider is wired up.\n *\n * @internal\n */\nexport function wrInterpolate(template: string, params: WrI18nParams | undefined): string {\n if (!params) return template;\n return template.replace(/\\{\\{\\s*([\\w.-]+)\\s*\\}\\}/g, (_match, name: string) => {\n const v = params[name];\n if (v === undefined || v === null) return '';\n if (typeof v === 'string') return v;\n if (typeof v === 'number' || typeof v === 'boolean') return String(v);\n try {\n return JSON.stringify(v);\n } catch {\n return '';\n }\n });\n}\n\n/**\n * Reactive i18n service. Holds:\n *\n * - the active locale as a `Signal<string>`\n * - per-`(locale, scope)` catalogs in a `Map` (loaded once, then cached)\n * - a per-locale signal counter so every `translate()` reading the signal\n * re-evaluates the moment a new catalog finishes loading\n *\n * Translations are looked up scope-first then root, per locale, and the locale\n * itself is tried as the full tag before the bare language underneath it — so\n * an app running `ru-RU` resolves against a catalog registered as `ru`, and a\n * regional catalog is never shadowed by a scope in the base language. For an\n * app that spells its locale one way, which is every app that existed before\n * the chain, the order is exactly what it always was.\n *\n * ## Which locale wins\n *\n * ngwr has three locale inputs and they used to be three unrelated answers — an\n * app that set `LOCALE_ID: 'ru-RU'` correctly still rendered an English\n * calendar, because the date token defaulted to `navigator.language`. The\n * precedence is now stated, highest first:\n *\n * 1. **A subsystem's own explicit option.** `withDates({ locale })` pins\n * dates; `provideWrI18n({ defaultLocale })` pins the catalog. The most\n * specific statement wins, because it can only have been deliberate.\n * 2. **`WrI18n.locale()` — the runtime value.** The only one of the three that\n * can change without a reload, so it is what a language switcher writes.\n * With `provideWrI18n()` in the app, dates are written in it.\n * 3. **`LOCALE_ID`.** Angular's app-wide constant, and the seed for both of the\n * above when neither was given. One statement, one answer.\n * 4. `'en-US'`, which is what `LOCALE_ID` itself falls back to.\n *\n * `navigator.language` is deliberately NOT in that list. It is the browser's\n * preference, not the application's, and reading it made prerendered output and\n * the hydrated page disagree.\n *\n * **What a runtime switch reaches, and what it does not.** `use()` repaints\n * every catalog string, and every date: the date adapter, and so\n * `wr-calendar`, `wr-date-picker`, `wrDate` and `wr-date-stamp`, formats in\n * this locale unless `withDates({ locale })` pinned another. It does not move\n * `LOCALE_ID`, which is a constant, so anything keyed on it — `wrNumber` /\n * `wrPlural`, `wr-input-number`, `wr-statistic`, `wr-counter` — stays where it\n * was. `use()` says so once in dev mode rather than leaving it to be\n * discovered.\n *\n * @example\n * ```ts\n * const i18n = inject(WrI18n);\n * i18n.use('ru'); // switch locale\n * i18n.t('cart.checkout'); // → 'Оформить заказ'\n * i18n.t('greeting', { name: 'Ada' }); // → 'Hello, Ada!'\n * i18n.t(`types.${type}`, undefined, { fallback: type }); // → type, when no key\n *\n * effect(() => console.log(i18n.translate('hi')())); // re-runs on locale change\n * ```\n *\n * @see https://ngwr.dev/reference/services/i18n\n */\n@Service()\nexport class WrI18n {\n private readonly config = inject(WR_I18N_CONFIG);\n private readonly loader = inject(WR_I18N_LOADER);\n private readonly storage = inject(WrStorage);\n\n /**\n * Angular's own locale. Read for the dev-mode drift warning only — the\n * resolved default already folded it in through `WR_I18N_CONFIG`. @internal\n */\n private readonly localeId = inject(LOCALE_ID);\n\n /**\n * Catalogs registered via `provideWrI18nBaseCatalogs()` — the floor under the\n * loader's own catalogs, so ngwr's built-in strings survive an app that only\n * ships its own keys. @internal\n */\n private readonly baseCatalogs = inject(WR_I18N_BASE_CATALOGS, { optional: true }) ?? [];\n\n /** Per-(locale,scope) catalogs, populated by `loadCatalog`. @internal */\n private readonly catalogs = new Map<string, WrI18nCatalog>();\n\n /** Bumped after each catalog write so reactive translates recompute. @internal */\n private readonly revision = signal(0);\n\n /** In-flight load promises — dedupes parallel `t()` callers. @internal */\n private readonly inflight = new Map<string, Promise<WrI18nCatalog>>();\n\n /** Keys whose last load failed: `t()` does not retry them, `use()` and `registerScope()` do. @internal */\n private readonly failed = new Set<string>();\n\n /** Registered scopes — auto-loaded whenever the locale changes. @internal */\n private readonly scopes = new Set<string>();\n\n /** Active locale. Writes go through `use()` so storage stays in sync. */\n private readonly _locale = signal<string>(this.initialLocale());\n readonly locale: Signal<string> = this._locale.asReadonly();\n\n constructor() {\n // Eagerly load the root catalog + every registered scope for the\n // current locale. Subsequent locale changes refire the same effect.\n effect(() => {\n const lc = this._locale();\n void this.loadChain(lc, null);\n for (const sc of this.scopes) void this.loadChain(lc, sc);\n });\n }\n\n // Locale\n\n /**\n * Switch active locale. Ignored when not whitelisted.\n *\n * Text and dates — see the class docs for what a runtime switch cannot reach. The\n * dev-mode warning below is the whole reporting of that limit; without it the\n * failure is a screen showing German labels beside `1,234.5`, with nothing\n * anywhere saying why.\n */\n use(locale: string): void {\n if (!this.config.availableLocales.includes(locale)) return;\n const previous = this._locale();\n this._locale.set(locale);\n if (this.config.storageKey) this.storage.set(this.config.storageKey, locale);\n void this.loadChain(locale, null);\n for (const sc of this.scopes) void this.loadChain(locale, sc);\n if (isDevMode() && previous !== locale) this.warnOnLocaleIdDrift(locale);\n }\n\n /** Available locales — pass-through from config. */\n available(): readonly string[] {\n return this.config.availableLocales;\n }\n\n // Scopes\n\n /**\n * Register a scope so its catalog loads alongside the root one. Idempotent.\n * Returns a promise resolving once the current locale's scope catalog is in\n * the cache — handy for feature `canActivate` guards.\n */\n registerScope(scope: string): Promise<WrI18nCatalog> {\n this.scopes.add(scope);\n const lc = this._locale();\n // Resolve on the exact tag: the promise is what a `canActivate` waits on,\n // and the base-language catalog is only ever a fallback under it.\n const exact = this.loadCatalog(lc, scope);\n void this.loadChain(lc, scope);\n return exact;\n }\n\n // Translate\n\n /**\n * Eager translate — returns the current value or the missing-handler\n * fallback. Does NOT auto-load missing catalogs; combine with the\n * reactive `translate(...)` if you want load-on-demand.\n *\n * The third argument is a scope, or `{ scope, fallback }`. With a `fallback`\n * a missing key returns it as is, not interpolated, and `missingHandler` is\n * not called: for a key built from a server value that may have no\n * translation.\n */\n t(key: string, params?: WrI18nParams, scopeOrOptions?: string | WrI18nTranslateOptions): string {\n // Read revision so callers inside computed/effect re-run on updates.\n this.revision();\n const lc = this._locale();\n const options = typeof scopeOrOptions === 'string' ? { scope: scopeOrOptions } : scopeOrOptions;\n const scope = options?.scope;\n\n const chain = localeChain(lc);\n let hit: string | null = null;\n for (const candidate of chain) {\n if (scope) hit = walk(this.catalogs.get(cacheKey(candidate, scope)) ?? null, key);\n hit ??= walk(this.catalogs.get(cacheKey(candidate, null)) ?? null, key);\n if (hit !== null) break;\n }\n // Base catalogs are the floor: consulted only once the loader's own catalogs\n // have missed, so an app's keys always win, but ngwr's built-in strings are\n // still there when the app's catalog doesn't carry them.\n hit ??= this.walkBase(chain, key);\n\n if (hit === null) {\n // Fire a background load so a future read can resolve it.\n void this.loadChain(lc, scope ?? null, true);\n return options?.fallback ?? this.config.missingHandler(key, lc);\n }\n return wrInterpolate(hit, params);\n }\n\n /** Reactive translate — re-evaluates on locale or catalog updates. */\n translate(key: string, params?: WrI18nParams, scopeOrOptions?: string | WrI18nTranslateOptions): Signal<string> {\n return computed(() => this.t(key, params, scopeOrOptions));\n }\n\n // Internals\n\n /**\n * Look a key up in the registered base catalogs, later contributions first so\n * a feature can shadow an earlier one.\n */\n private walkBase(chain: readonly string[], key: string): string | null {\n for (const locale of chain) {\n for (let i = this.baseCatalogs.length - 1; i >= 0; i--) {\n const hit = walk(this.baseCatalogs[i][locale] ?? null, key);\n if (hit !== null) return hit;\n }\n }\n return null;\n }\n\n private initialLocale(): string {\n if (this.config.storageKey) {\n const saved = this.storage.get<string>(this.config.storageKey);\n if (saved && this.config.availableLocales.includes(saved)) return saved;\n }\n return this.config.defaultLocale;\n }\n\n /**\n * Load a `(locale, scope)` catalog and, when the locale carries a region, the\n * bare-language one under it. Both go in the cache; `t()` reads them in that\n * order.\n */\n private loadChain(locale: string, scope: string | null, auto = false): Promise<unknown> {\n return Promise.all(localeChain(locale).map(candidate => this.loadCatalog(candidate, scope, auto)));\n }\n\n /** One warning per service, not one per switch. @internal */\n private warnedLocaleIdDrift = false;\n\n /**\n * Say once, in dev, that a runtime switch moved the text and nothing else.\n *\n * The mismatch is otherwise invisible in the way that costs the most time:\n * the catalog strings and the dates all change, which reads as \"the switch\n * worked\", and the numbers beside them are still correct-looking output in\n * the old locale. Silent when the new locale IS `LOCALE_ID`, because then nothing is\n * out of step and a warning that fires when everything agrees is one people\n * learn to ignore. Production builds drop the call entirely via `isDevMode()`\n * tree-shaking.\n */\n private warnOnLocaleIdDrift(locale: string): void {\n if (this.warnedLocaleIdDrift || locale === this.localeId) return;\n this.warnedLocaleIdDrift = true;\n // eslint-disable-next-line no-console -- dev-mode validation\n console.warn(\n `[NGWR] WrI18n.use('${locale}') switched the catalog, but LOCALE_ID is still '${this.localeId}'. ` +\n `Dates follow the switch (wrDate, wr-calendar, wr-date-picker), unless withDates({ locale }) pinned ` +\n `them. LOCALE_ID is an Angular constant, so formatted numbers do not and stay on '${this.localeId}': ` +\n `the wrNumber / wrPlural pipes, wr-input-number, wr-statistic, wr-counter, wr-pagination's total ` +\n `and wr-file-upload's sizes. Reload the app with the new LOCALE_ID to move those.`\n );\n }\n\n private loadCatalog(locale: string, scope: string | null, auto = false): Promise<WrI18nCatalog> {\n const ck = cacheKey(locale, scope);\n const cached = this.catalogs.get(ck);\n if (cached) return Promise.resolve(cached);\n if (auto && this.failed.has(ck)) return Promise.resolve({});\n\n const pending = this.inflight.get(ck);\n if (pending) return pending;\n\n const stream: Observable<WrI18nCatalog> = this.loader.load(locale, scope);\n const promise = firstValueFrom(stream)\n .then(catalog => {\n this.failed.delete(ck);\n this.catalogs.set(ck, catalog);\n this.revision.update(v => v + 1);\n return catalog;\n })\n .catch((err: unknown) => {\n // eslint-disable-next-line no-console -- intentional diagnostic for missing catalog\n console.warn(`[ngwr/i18n] failed to load (${locale}, ${scope ?? 'root'})`, err);\n this.failed.add(ck);\n const empty: WrI18nCatalog = {};\n return empty;\n })\n .finally(() => {\n this.inflight.delete(ck);\n });\n\n this.inflight.set(ck, promise);\n return promise;\n }\n}\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { Pipe, type PipeTransform, inject } from '@angular/core';\n\nimport { WrI18n } from './i18n';\nimport { type WrI18nParams, type WrI18nTranslateOptions } from './i18n-config';\n\n/**\n * Translate a key. Impure — re-evaluates on every CD so locale switches\n * and catalog loads propagate without a manual refresh.\n *\n * @example\n * ```html\n * <h1>{{ 'home.title' | wrT }}</h1>\n * <p>{{ 'greeting' | wrT: { name: user().name } }}</p>\n * <button>{{ 'forms.save' | wrT: null : 'checkout' }}</button>\n * <span>{{ 'types.' + type | wrT: null : { fallback: type } }}</span>\n * ```\n */\n// eslint-disable-next-line @angular-eslint/no-pipe-impure -- intentional: locale + catalog updates must propagate even when args are stable\n@Pipe({ name: 'wrT', pure: false })\nexport class WrTPipe implements PipeTransform {\n private readonly i18n = inject(WrI18n);\n\n transform(key: string, params?: WrI18nParams | null, scopeOrOptions?: string | WrI18nTranslateOptions): string {\n return this.i18n.t(key, params ?? undefined, scopeOrOptions);\n }\n}\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { Directive, ElementRef, computed, effect, inject, input } from '@angular/core';\n\nimport { WrI18n } from './i18n';\nimport { type WrI18nParams } from './i18n-config';\n\n/**\n * Attribute directive that sets `textContent` of its host to the translation\n * of the bound key. Reactive — re-renders on locale + catalog changes.\n *\n * @example\n * ```html\n * <span [wrT]=\"'home.title'\"></span>\n * <span [wrT]=\"'greeting'\" [wrTParams]=\"{ name: user().name }\"></span>\n * <span [wrT]=\"'forms.save'\" wrTScope=\"checkout\"></span>\n * <span [wrT]=\"'types.' + type\" [wrTFallback]=\"type\"></span>\n * ```\n */\n@Directive({\n selector: '[wrT]',\n})\nexport class WrTDirective {\n /** Translation key. Required. */\n readonly wrT = input.required<string>();\n\n /** Interpolation params for `{{name}}` tokens. */\n readonly wrTParams = input<WrI18nParams | null>(null);\n\n /** Optional scope — scoped lookup first, then root fallback. */\n readonly wrTScope = input<string | null>(null);\n\n /** Text shown as is when the key is missing; `missingHandler` is not called. */\n readonly wrTFallback = input<string | null>(null);\n\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\n private readonly i18n = inject(WrI18n);\n\n private readonly text = computed(() =>\n this.i18n.t(this.wrT(), this.wrTParams() ?? undefined, {\n scope: this.wrTScope() ?? undefined,\n fallback: this.wrTFallback(),\n })\n );\n\n constructor() {\n effect(() => {\n this.host.nativeElement.textContent = this.text();\n });\n }\n}\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { type Observable, of } from 'rxjs';\n\nimport { type WrI18nCatalog } from '../i18n-config';\nimport { type WrI18nLoader } from '../i18n-loader';\n\n/** Root catalogs keyed by locale: `{ en: catalog, ru: catalog, … }`. */\nexport type WrI18nStaticCatalogs = Readonly<Record<string, WrI18nCatalog>>;\n\n/** Per-scope catalogs: `{ checkout: { en: catalog, ru: catalog }, … }`. */\nexport type WrI18nStaticScopedCatalogs = Readonly<Record<string, WrI18nStaticCatalogs>>;\n\n/**\n * Loader for catalogs already in memory (imported from JSON or generated).\n *\n * - Pass `catalogs` for the root catalog of every locale.\n * - Pass `scopes` if you ship per-feature catalogs the loader should serve\n * to `WrI18n.registerScope(name)` calls.\n *\n * Missing locale or scope resolves to `{}` — the missing-key handler then\n * decides what to render.\n */\nexport class WrI18nStaticLoader implements WrI18nLoader {\n constructor(\n private readonly catalogs: WrI18nStaticCatalogs,\n private readonly scopes: WrI18nStaticScopedCatalogs = {}\n ) {}\n\n load(locale: string, scope: string | null): Observable<WrI18nCatalog> {\n if (scope === null) return of(this.catalogs[locale] ?? {});\n return of(this.scopes[scope]?.[locale] ?? {});\n }\n}\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { HttpClient } from '@angular/common/http';\nimport { inject } from '@angular/core';\n\nimport { type Observable } from 'rxjs';\n\nimport { type WrI18nCatalog } from '../i18n-config';\nimport { type WrI18nLoader } from '../i18n-loader';\n\n/** Configuration for {@link WrI18nHttpLoader}. */\nexport interface WrI18nHttpLoaderConfig {\n /**\n * URL template. Tokens:\n * - `{locale}` — required, BCP-47 tag (e.g. `en`).\n * - `{scope}` — optional, scope name. Use the `rootPath` if you need a\n * different path entirely for the root catalog.\n *\n * @example\n * ```ts\n * { path: '/assets/i18n/{locale}.json' } // root only\n * { path: '/assets/i18n/{scope}/{locale}.json',\n * rootPath: '/assets/i18n/{locale}.json' } // root + scopes\n * ```\n */\n readonly path: string;\n /** Path template for the root catalog. Defaults to `path`. */\n readonly rootPath?: string;\n}\n\n/**\n * Loader that fetches catalogs via `HttpClient`. A failure errors the stream;\n * the service logs it, serves the key and retries on the next `use()`.\n */\nexport class WrI18nHttpLoader implements WrI18nLoader {\n private readonly http = inject(HttpClient);\n\n constructor(private readonly config: WrI18nHttpLoaderConfig) {}\n\n load(locale: string, scope: string | null): Observable<WrI18nCatalog> {\n const template = scope === null ? (this.config.rootPath ?? this.config.path) : this.config.path;\n const url = template.replaceAll('{locale}', locale).replaceAll('{scope}', scope ?? '');\n return this.http.get<WrI18nCatalog>(url);\n }\n}\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport {\n ApplicationRef,\n EnvironmentInjector,\n type EnvironmentProviders,\n type Provider,\n inject,\n makeEnvironmentProviders,\n provideEnvironmentInitializer,\n} from '@angular/core';\n\nimport { WR_LIVE_LOCALE } from 'ngwr/utils';\n\nimport { WrI18n } from './i18n';\nimport { WR_I18N_BASE_CATALOGS, type WrI18nBaseCatalogs } from './i18n-base-catalogs';\nimport {\n DEFAULT_WR_I18N_CONFIG,\n WR_I18N_CONFIG,\n type WrI18nConfig,\n type WrI18nConfigResolved,\n resolveWrI18nLocales,\n} from './i18n-config';\nimport { WR_I18N_LOADER, type WrI18nLoader } from './i18n-loader';\nimport { WrI18nHttpLoader, type WrI18nHttpLoaderConfig } from './loaders/http-loader';\nimport {\n WrI18nStaticLoader,\n type WrI18nStaticCatalogs,\n type WrI18nStaticScopedCatalogs,\n} from './loaders/static-loader';\n\n/**\n * Configure {@link WrI18n}. Either pass a `loader` directly, or use the\n * `provideWrI18nHttpLoader` / `provideWrI18nStaticLoader` helpers in the\n * same providers array.\n */\nexport interface ProvideWrI18nOptions extends WrI18nConfig {\n readonly loader?: WrI18nLoader;\n}\n\n/**\n * Configure {@link WrI18n} for the application.\n *\n * Call it in the application's root providers (`bootstrapApplication` or\n * `ApplicationConfig`), together with {@link provideWrI18nBaseCatalogs} and the\n * loader. `WrI18n` is a root service: a route's `providers` or a lazy module\n * never reach it, so a locale or catalogs given there do nothing, and dev mode\n * warns. A lazy area switches the language at runtime with\n * `inject(WrI18n).use('de')`, for example in its resolver. The switch is\n * app-wide, and the locale must be in the root `availableLocales`. The area's\n * own keys load with `registerScope()`.\n */\nexport function provideWrI18n(options: ProvideWrI18nOptions = {}): EnvironmentProviders {\n const { loader, ...config } = options;\n\n const providers: (Provider | EnvironmentProviders)[] = [\n {\n provide: WR_I18N_CONFIG,\n // A factory rather than a value: `defaultLocale` falls back to `LOCALE_ID`,\n // which only an injection context can read.\n useFactory: (): WrI18nConfigResolved => ({\n ...DEFAULT_WR_I18N_CONFIG,\n ...config,\n ...resolveWrI18nLocales(config),\n }),\n },\n ];\n if (loader) providers.push({ provide: WR_I18N_LOADER, useValue: loader });\n // What `ngwr/date` formats in, so dates follow `use()` without importing this entry point.\n providers.push({ provide: WR_LIVE_LOCALE, useFactory: () => inject(WrI18n).locale });\n\n if (typeof ngDevMode === 'undefined' || ngDevMode) {\n providers.push(\n provideEnvironmentInitializer(() => {\n const here = inject(EnvironmentInjector);\n if (here === inject(ApplicationRef, { optional: true })?.injector) return;\n // An injector that lists WrI18n itself owns an instance that does read this config.\n if (here.get(WrI18n, null, { self: true })) return;\n // eslint-disable-next-line no-console -- dev-mode validation\n console.warn(\n '[NGWR] provideWrI18n() is in a route or child injector. WrI18n is a root service, so this ' +\n \"configuration is ignored. Move provideWrI18n() and the catalogs to the application's root \" +\n 'providers, and switch a lazy area with inject(WrI18n).use(locale).'\n );\n })\n );\n }\n\n return makeEnvironmentProviders(providers);\n}\n\n/**\n * Provide a static loader — catalogs already in memory.\n *\n * A loader serves only the catalog you pass it, and ngwr registers none of its\n * own. Pass only your own keys here and register ngwr's catalogs with\n * {@link provideWrI18nBaseCatalogs} — not `{ ...wrRu, ...yours }`. A spread is\n * shallow, so any namespace you share with ngwr, e.g. `common`, `form`,\n * `table`, keeps only the keys of the side spread last, and the other side's\n * keys stop resolving with nothing logged: ngwr's components fall back to their\n * English defaults, and a `wrT` read of a lost key renders the raw key under the\n * default missing handler.\n *\n * @param catalogs Root catalogs keyed by locale.\n * @param scopes Optional per-scope catalogs served to `registerScope(name)`.\n */\nexport function provideWrI18nStaticLoader(\n catalogs: WrI18nStaticCatalogs,\n scopes?: WrI18nStaticScopedCatalogs\n): Provider {\n return { provide: WR_I18N_LOADER, useValue: new WrI18nStaticLoader(catalogs, scopes) };\n}\n\n/**\n * Register catalogs consulted *underneath* the loader — this is how ngwr's own\n * built-in strings survive when you supply your own catalogs.\n *\n * A loader replaces the catalog for a locale instead of extending it, so a JSON\n * file holding only your keys leaves every built-in label on its hardcoded\n * English fallback, with nothing logged. One line fixes it, on either loader:\n *\n * @example\n * ```ts\n * import { wrRu } from 'ngwr/i18n/ru';\n *\n * providers: [\n * provideWrI18n({ defaultLocale: 'ru', availableLocales: ['ru'] }),\n * provideWrI18nBaseCatalogs({ ru: wrRu }),\n * provideWrI18nHttpLoader({ path: '/assets/i18n/{locale}.json' }),\n * ]\n * ```\n *\n * Pass only the locales you ship — the ones you leave out stay out of the\n * bundle. Your own keys always win; this is a floor, not an override.\n *\n * Use it instead of spreading `wrRu` into your own catalog, too: the lookup\n * walks these key by key after the loader's catalog misses, so a namespace both\n * define keeps both halves, where a shallow spread keeps only one.\n */\nexport function provideWrI18nBaseCatalogs(catalogs: WrI18nBaseCatalogs): Provider {\n return { provide: WR_I18N_BASE_CATALOGS, useValue: catalogs, multi: true };\n}\n\n/** Provide an HTTP loader — catalogs fetched from URLs. Requires `provideHttpClient`. */\nexport function provideWrI18nHttpLoader(config: WrI18nHttpLoaderConfig): Provider {\n return { provide: WR_I18N_LOADER, useFactory: () => new WrI18nHttpLoader(config) };\n}\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { type Signal, computed, inject, signal } from '@angular/core';\n\nimport { WrI18n, wrInterpolate } from './i18n';\nimport type { WrI18nParams } from './i18n-config';\n\n/**\n * Helper for component default text. Returns a reactive string that:\n *\n * 1. Prefers the consumer's override (an `input<string | null>()` value).\n * 2. Falls back to the i18n catalog under `key` — re-renders on locale\n * change so a switcher updates the DOM live.\n * 3. Falls back to `fallback` when no `WrI18n` is provided OR the catalog\n * is missing the key.\n *\n * Components don't need a hard dependency on `provideWrI18n` — without it,\n * the fallback is returned and everything still works.\n *\n * @example\n * ```ts\n * readonly emptyText = input<string | null>(null);\n * protected readonly empty = useI18nText(this.emptyText, 'table.empty', 'No data');\n *\n * // In template: <div>{{ empty() }}</div>\n * ```\n */\nexport function useI18nText(binding: Signal<string | null | undefined>, key: string, fallback: string): Signal<string> {\n const i18n = inject(WrI18n, { optional: true });\n if (!i18n) {\n return computed(() => {\n const v = binding();\n return v ?? fallback;\n });\n }\n\n return computed(() => {\n const v = binding();\n if (v !== null && v !== undefined && v !== '') return v;\n const translated = i18n.t(key);\n // Default missing handler returns the key itself — treat that as \"missing\"\n // and use our explicit fallback.\n return translated === key ? fallback : translated;\n });\n}\n\n/**\n * {@link useI18nText} without a binding to forward — for a built-in string the\n * component exposes no override input for. Same reactivity, same fallback\n * rules; the only difference is the missing first argument.\n *\n * It used to return a plain `string`, resolved once at injection time, and\n * that was wrong in the ordinary case rather than an edge one: `WrI18n` writes\n * every loader-backed catalog from `firstValueFrom(...).then(...)`, so even a\n * static loader serving an object literal lands a microtask AFTER the first\n * change-detection pass. Every component built in that pass read an empty\n * catalog and froze its English fallback for the life of the app — in one\n * `<wr-date-picker>` the field said \"Открыть календарь\" and the calendar\n * button beside it \"Open calendar\", off the same key.\n */\nexport function wrReadI18nText(key: string, fallback: string): Signal<string> {\n const i18n = inject(WrI18n, { optional: true });\n if (!i18n) return computed(() => fallback);\n\n return computed(() => {\n const v = i18n.t(key);\n return v === key ? fallback : v;\n });\n}\n\n/** Tiny shim — useful when the caller doesn't have an `input` to forward. */\nexport function nullSignal(): Signal<null> {\n return signal(null).asReadonly();\n}\n\n/**\n * Build a per-call formatter for parametrized labels (e.g. ARIA labels\n * that interpolate a per-row value: `\"Remove {{label}}\"`). Returns a\n * function the template calls with the params for the current item.\n *\n * The returned function:\n * - Re-resolves the i18n catalog on every call (live locale switches just\n * work — re-rendered templates pick up new strings).\n * - Falls back to the literal `fallback` template with the same\n * `{{name}}` syntax when no `WrI18n` provider is present, or when the\n * key is missing.\n *\n * Use this for labels that vary per row. For static labels, prefer\n * {@link useI18nText} or {@link wrReadI18nText}.\n *\n * @example\n * ```ts\n * protected readonly removeChipLabel = useI18nFormatter('select.removeItem', 'Remove {{label}}');\n *\n * // In template:\n * // [attr.aria-label]=\"removeChipLabel({ label: chip.label })\"\n * ```\n */\nexport function useI18nFormatter(key: string, fallback: string): (params?: WrI18nParams) => string {\n const i18n = inject(WrI18n, { optional: true });\n if (!i18n) {\n return (params?: WrI18nParams) => wrInterpolate(fallback, params);\n }\n return (params?: WrI18nParams) => {\n const v = i18n.t(key, params);\n return v === key ? wrInterpolate(fallback, params) : v;\n };\n}\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { type Injector, inject } from '@angular/core';\n\nimport { WrI18n, wrInterpolate } from './i18n';\n\n/** The English catalog's `httpError`, for an app with no catalog registered. */\nconst FALLBACK: Readonly<Record<string, string>> = {\n network: 'No connection to the server. Check your network and try again.',\n 400: 'The server did not accept the data. Check the fields.',\n 401: 'Your session has ended. Sign in again.',\n 403: 'You do not have permission for this action.',\n 404: 'Not found. It may have been deleted.',\n 409: 'This conflicts with existing data. Refresh the page and try again.',\n 413: 'The data is too large to send.',\n 422: 'Some of the data is not valid. Check the fields.',\n 429: 'Too many requests. Try again in a moment.',\n 503: 'The server is unavailable. Try again in a minute.',\n '4xx': 'The request was refused. Error code: {{status}}.',\n '5xx': 'The server failed. Try again later. Error code: {{status}}.',\n unknown: 'Something went wrong. Try again later.',\n};\n\n/** Most specific first. */\nfunction catalogKeys(status: number | null): readonly string[] {\n if (status === null) return ['unknown'];\n if (status === 0) return ['network'];\n if (status >= 400 && status < 500) return [String(status), '4xx', 'unknown'];\n if (status >= 500 && status < 600) return [String(status), '5xx', 'unknown'];\n return [String(status), 'unknown'];\n}\n\nfunction serverMessage(error: unknown): string | null {\n const body = (error as { error?: unknown } | null | undefined)?.error;\n if (typeof body === 'string') {\n const text = body.trim();\n // A proxy answers with an HTML page, which is a string body too.\n return text === '' || text.startsWith('<') ? null : text;\n }\n const message = (body as { message?: unknown } | null | undefined)?.message;\n return typeof message === 'string' && message.trim() !== '' ? message.trim() : null;\n}\n\n/** A screen's own sentence for one status: the text, or a function of the error. */\nexport type WrHttpErrorOverride = string | ((error: unknown) => string);\n\n/** Options of {@link wrHttpErrorText}. */\nexport interface WrHttpErrorTextOptions {\n /** The screen's own sentence per status, `0` being a network failure. Wins over everything else. */\n readonly overrides?: Readonly<Partial<Record<number, WrHttpErrorOverride>>>;\n /**\n * Prefer the sentence the server put in the body: `error.error.message`, or\n * a body that is a plain string. For an API that writes its errors for the\n * person at the screen.\n * @default false\n */\n readonly serverMessage?: boolean;\n /** Where to read `WrI18n` from when the call is outside an injection context, such as a `catch`. */\n readonly injector?: Injector;\n}\n\n/**\n * The HTTP status of a failed request: of an `HttpErrorResponse`, a `Response`\n * or anything else carrying a numeric `status`. `0` is a request nothing\n * answered (offline, CORS, a dropped connection); `null` is a value that is not\n * an HTTP error at all.\n *\n * @example\n * ```ts\n * if (wrHttpStatus(error) === 401) void router.navigate(['/login']);\n * ```\n *\n * @see https://ngwr.dev/reference/utils/wr-http-error-text\n */\nexport function wrHttpStatus(error: unknown): number | null {\n const status = (error as { status?: unknown } | null | undefined)?.status;\n return typeof status === 'number' && Number.isInteger(status) && status >= 0 ? status : null;\n}\n\n/**\n * A sentence for a failed request, in the active language. Highest first:\n *\n * 1. `overrides[status]`, the screen's own wording.\n * 2. With `serverMessage`, the sentence in the response body.\n * 3. The catalog: `httpError.<status>`, then `httpError.4xx` / `httpError.5xx`\n * (both take `{{status}}`), `httpError.network` for status `0`, and\n * `httpError.unknown` for the rest. An app's own catalog wins over ngwr's,\n * and English is the floor when neither has the key.\n *\n * Call it in an injection context, or pass `injector` from a `catch` or a\n * callback.\n *\n * @example\n * ```ts\n * private readonly injector = inject(Injector);\n *\n * try {\n * await this.api.save(order);\n * } catch (error) {\n * this.toast.danger(\n * wrHttpErrorText(error, { injector: this.injector, overrides: { 409: 'This name is taken.' } })\n * );\n * }\n * ```\n *\n * @see https://ngwr.dev/reference/utils/wr-http-error-text\n */\nexport function wrHttpErrorText(error: unknown, options: WrHttpErrorTextOptions = {}): string {\n const status = wrHttpStatus(error);\n\n const override = status === null ? undefined : options.overrides?.[status];\n if (override !== undefined) return typeof override === 'function' ? override(error) : override;\n\n if (options.serverMessage && status !== null) {\n const said = serverMessage(error);\n if (said !== null) return said;\n }\n\n const i18n = options.injector ? options.injector.get(WrI18n, null) : inject(WrI18n, { optional: true });\n const keys = catalogKeys(status);\n const params = { status };\n\n for (const key of keys) {\n const hit = i18n?.t(`httpError.${key}`, params, { fallback: '' });\n if (hit) return hit;\n }\n for (const key of keys) {\n if (key in FALLBACK) return wrInterpolate(FALLBACK[key], params);\n }\n return FALLBACK['unknown'];\n}\n"],"mappings":";;;;;;;;;;;;AAgCA,MAAa,wBAAwB,IAAI,eAA8C,uBAAuB;;;;;;;ACiD9G,MAAa,yBAA2F;CACtG,YAAY;CACZ,iBAAgB,QAAO;AACxB;AAMD,SAAgB,qBACd,QAAoB;CAEpB,MAAM,gBAAgB,OAAO,iBAAiB,OAAO,SAAS;CAC9D,OAAO;EAAE;EAAe,kBAAkB,OAAO,oBAAoB,CAAC,aAAa;CAAC;AACtF;AAEA,MAAa,iBAAiB,IAAI,eAAqC,kBAAkB,EACvF,gBAAgB;CAAE,GAAG;CAAwB,GAAG,qBAAqB,CAAA,CAAE;AAAC,GACzE,CAAA;;;;;;;AC7DD,MAAa,iBAAiB,IAAI,eAA6B,kBAAkB;CAC/E,YAAY;CACZ,gBAAgB,EAAE,YAAY,GAAG,CAAA,CAAE,EAAC;AACrC,CAAA;;;;;;;ACvBD,SAAS,SAAS,QAAgB,OAAoB;CACpD,OAAO,GAAG,OAAM,IAAK,SAAS;AAChC;AAcA,SAAS,YAAY,QAAc;CACjC,MAAM,OAAO,OAAO,QAAQ,GAAG;CAC/B,OAAO,OAAO,IAAI,CAAC,QAAQ,OAAO,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM;AAC7D;AAGA,SAAS,KAAK,KAA2B,KAAW;CAClD,IAAI,CAAC,KAAK,OAAO;CACjB,IAAI,OAA2C;CAC/C,KAAK,MAAM,QAAQ,IAAI,MAAM,GAAG,GAAG;EACjC,IAAI,SAAS,UAAa,OAAO,SAAS,UAAU,OAAO;EAC3D,OAAO,KAAK;CACd;CACA,OAAO,OAAO,SAAS,WAAW,OAAO;AAC3C;AASA,SAAgB,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K;CAEjC,MAAM,WAAW,WAAW,OAAO,SAAY,QAAQ,YAAY;CACnE,IAAI,aAAa,QAAW,OAAO,OAAO,aAAa,aAAa,SAAS,KAAK,IAAI;CAEtF,IAAI,QAAQ,iBAAiB,WAAW,MAAM;EAC5C,MAAM,OAAO,cAAc,KAAK;EAChC,IAAI,SAAS,MAAM,OAAO;CAC5B;CAEA,MAAM,OAAO,QAAQ,WAAW,QAAQ,SAAS,IAAI,QAAQ,IAAI,IAAI,OAAO,QAAQ,EAAE,UAAU,KAAI,CAAE;CACtG,MAAM,OAAO,YAAY,MAAM;CAC/B,MAAM,SAAS,EAAE,OAAM;CAEvB,KAAK,MAAM,OAAO,MAAM;EACtB,MAAM,MAAM,MAAM,EAAE,aAAa,OAAO,QAAQ,EAAE,UAAU,GAAE,CAAE;EAChE,IAAI,KAAK,OAAO;CAClB;CACA,KAAK,MAAM,OAAO,MAChB,IAAI,OAAO,UAAU,OAAO,cAAc,SAAS,MAAM,MAAM;CAEjE,OAAO,SAAS;AAClB"}
|
|
@@ -69,6 +69,10 @@ var WrInputNumber = class WrInputNumber {
|
|
|
69
69
|
transform: coerceBooleanProperty
|
|
70
70
|
});
|
|
71
71
|
size = input("md", ...ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []);
|
|
72
|
+
block = input(false, {
|
|
73
|
+
...ngDevMode ? { debugName: "block" } : /* istanbul ignore next */ {},
|
|
74
|
+
transform: coerceBooleanProperty
|
|
75
|
+
});
|
|
72
76
|
rounded = input(false, {
|
|
73
77
|
...ngDevMode ? { debugName: "rounded" } : /* istanbul ignore next */ {},
|
|
74
78
|
transform: coerceBooleanProperty
|
|
@@ -110,6 +114,7 @@ var WrInputNumber = class WrInputNumber {
|
|
|
110
114
|
numerals = resolveNumerals(this.locale);
|
|
111
115
|
group = groupPattern(this.separators.group);
|
|
112
116
|
text = signal("", ...ngDevMode ? [{ debugName: "text" }] : /* istanbul ignore next */ []);
|
|
117
|
+
lastCommitted = void 0;
|
|
113
118
|
focused = signal(false, ...ngDevMode ? [{ debugName: "focused" }] : /* istanbul ignore next */ []);
|
|
114
119
|
field = viewChild.required("input", ...ngDevMode ? [{ debugName: "field" }] : /* istanbul ignore next */ []);
|
|
115
120
|
interactive = computed(() => !this.disabled() && !this.readonly(), ...ngDevMode ? [{ debugName: "interactive" }] : /* istanbul ignore next */ []);
|
|
@@ -139,6 +144,7 @@ var WrInputNumber = class WrInputNumber {
|
|
|
139
144
|
const size = this.size();
|
|
140
145
|
if (size !== "md") parts.push(`wr-input-number--${size}`);
|
|
141
146
|
if (this.rounded()) parts.push("wr-input-number--rounded");
|
|
147
|
+
if (this.block()) parts.push("wr-input-number--block");
|
|
142
148
|
if (this.disabled()) parts.push("wr-input-number--disabled");
|
|
143
149
|
return parts.join(" ");
|
|
144
150
|
}, ...ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []);
|
|
@@ -149,7 +155,8 @@ var WrInputNumber = class WrInputNumber {
|
|
|
149
155
|
if (typeof ngDevMode === "undefined" || ngDevMode) wrCheckStyles("input-number");
|
|
150
156
|
effect(() => {
|
|
151
157
|
const v = this.value();
|
|
152
|
-
if (this.focused()) return;
|
|
158
|
+
if (this.focused() && Object.is(v, this.lastCommitted)) return;
|
|
159
|
+
this.lastCommitted = v;
|
|
153
160
|
if (v === null || Number.isNaN(v)) {
|
|
154
161
|
this.text.set("");
|
|
155
162
|
return;
|
|
@@ -198,6 +205,7 @@ var WrInputNumber = class WrInputNumber {
|
|
|
198
205
|
this.bump(direction);
|
|
199
206
|
}
|
|
200
207
|
commit(next) {
|
|
208
|
+
this.lastCommitted = next;
|
|
201
209
|
this.value.set(next);
|
|
202
210
|
}
|
|
203
211
|
bump(units) {
|
|
@@ -357,6 +365,13 @@ var WrInputNumber = class WrInputNumber {
|
|
|
357
365
|
isRequired: false,
|
|
358
366
|
transformFunction: null
|
|
359
367
|
},
|
|
368
|
+
block: {
|
|
369
|
+
classPropertyName: "block",
|
|
370
|
+
publicName: "block",
|
|
371
|
+
isSignal: true,
|
|
372
|
+
isRequired: false,
|
|
373
|
+
transformFunction: null
|
|
374
|
+
},
|
|
360
375
|
rounded: {
|
|
361
376
|
classPropertyName: "rounded",
|
|
362
377
|
publicName: "rounded",
|
|
@@ -580,6 +595,14 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
580
595
|
required: false
|
|
581
596
|
}]
|
|
582
597
|
}],
|
|
598
|
+
block: [{
|
|
599
|
+
type: i0.Input,
|
|
600
|
+
args: [{
|
|
601
|
+
isSignal: true,
|
|
602
|
+
alias: "block",
|
|
603
|
+
required: false
|
|
604
|
+
}]
|
|
605
|
+
}],
|
|
583
606
|
rounded: [{
|
|
584
607
|
type: i0.Input,
|
|
585
608
|
args: [{
|
|
@@ -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 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: 'wr-input-number', '[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 /**\n * Show a clear (×) button while the field holds text and is neither disabled\n * nor read-only. Clearing sets `value` to `null`, emits `touch` and puts focus\n * back in the field. It is a pointer control: from the keyboard, emptying the\n * field clears the value. @default false\n */\n readonly clearable = input(false, { transform: coerceBooleanProperty });\n\n /** Clear (×) button aria-label. Falls back to `common.clear`. */\n readonly clearLabel = input<string | null>(null);\n\n /**\n * Show a spinner after the field and mark the field `aria-busy`. The field\n * stays editable. @default false\n */\n readonly loading = input(false, { transform: coerceBooleanProperty });\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, and by the clear (×) button, 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: string[] = [];\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 current = this.value() as number | null;\n // A non-finite value gives no number to step from, so it steps like an empty field.\n const base = current !== null && Number.isFinite(current) ? current : 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\n [rounded]=\"rounded()\"\n [clearable]=\"clearable()\"\n [clearLabel]=\"clearLabel()\"\n [loading]=\"loading()\"\n (cleared)=\"touch.emit()\"\n>\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\" />\n </svg>\n </button>\n </div>\n }\n</wr-input-group>\n"],"mappings":";;;;;;;;;;;;AAwCA,SAAS,kBAAkB,QAAc;CACvC,MAAM,QAAQ,IAAI,KAAK,aAAa,MAAM,CAAC,CAAC,cAAc,OAAO;CAGjE,OAAO;EAAE,SAFO,MAAM,MAAK,MAAK,EAAE,SAAS,SAAS,CAAC,EAAE,SAAS;EAE9C,OADJ,MAAM,MAAK,MAAK,EAAE,SAAS,OAAO,CAAC,EAAE,SAAS;CACrC;AACzB;AAQA,SAAS,gBAAgB,QAAc;CACrC,IAAI;EACF,MAAM,YAAY,IAAI,KAAK,aAAa,QAAQ,EAAE,aAAa,MAAK,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GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,SAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,UAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,UAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,OAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;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
|
+
{"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: 'wr-input-number', '[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 /** Stretch the field to fill its parent's width. @default false */\n readonly block = input(false, { transform: coerceBooleanProperty });\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 /**\n * Show a clear (×) button while the field holds text and is neither disabled\n * nor read-only. Clearing sets `value` to `null`, emits `touch` and puts focus\n * back in the field. It is a pointer control: from the keyboard, emptying the\n * field clears the value. @default false\n */\n readonly clearable = input(false, { transform: coerceBooleanProperty });\n\n /** Clear (×) button aria-label. Falls back to `common.clear`. */\n readonly clearLabel = input<string | null>(null);\n\n /**\n * Show a spinner after the field and mark the field `aria-busy`. The field\n * stays editable. @default false\n */\n readonly loading = input(false, { transform: coerceBooleanProperty });\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, and by the clear (×) button, 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 private lastCommitted: unknown = undefined;\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: string[] = [];\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.block()) parts.push('wr-input-number--block');\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 their own commits 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 // While focused only this component's own edits are left alone; a model\n // that differs from the last one it committed was written from outside.\n if (this.focused() && Object.is(v, this.lastCommitted)) return;\n this.lastCommitted = v;\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.lastCommitted = next;\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 current = this.value() as number | null;\n // A non-finite value gives no number to step from, so it steps like an empty field.\n const base = current !== null && Number.isFinite(current) ? current : 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\n [rounded]=\"rounded()\"\n [clearable]=\"clearable()\"\n [clearLabel]=\"clearLabel()\"\n [loading]=\"loading()\"\n (cleared)=\"touch.emit()\"\n>\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\" />\n </svg>\n </button>\n </div>\n }\n</wr-input-group>\n"],"mappings":";;;;;;;;;;;;AAwCA,SAAS,kBAAkB,QAAc;CACvC,MAAM,QAAQ,IAAI,KAAK,aAAa,MAAM,CAAC,CAAC,cAAc,OAAO;CAGjE,OAAO;EAAE,SAFO,MAAM,MAAK,MAAK,EAAE,SAAS,SAAS,CAAC,EAAE,SAAS;EAE9C,OADJ,MAAM,MAAK,MAAK,EAAE,SAAS,OAAO,CAAC,EAAE,SAAS;CACrC;AACzB;AAQA,SAAS,gBAAgB,QAAc;CACrC,IAAI;EACF,MAAM,YAAY,IAAI,KAAK,aAAa,QAAQ,EAAE,aAAa,MAAK,CAAE;EACtE,MAAM,SAAmB,CAAA;EACzB,KAAK,IAAI,IAAI,GAAG,IAAI,IAAI,KAAK;GAC3B,MAAM,QAAQ,UAAU,OAAO,CAAC;GAChC,IAAI,CAAC,GAAG,KAAK,CAAC,CAAC,WAAW,KAAK,OAAO,SAAS,KAAK,GAAG,OAAO,CAAA;GAC9D,OAAO,KAAK,KAAK;EACnB;EACA,OAAO;CACT,QAAQ;EACN,OAAO,CAAA;CACT;AACF;AAOA,SAAS,aAAa,OAAa;CACjC,IAAI,CAAC,OAAO,OAAO;CACnB,IAAI,KAAK,KAAK,KAAK,GAAG,OAAO;CAC7B,IAAI,YAAY,KAAK,KAAK,GAAG,OAAO;CACpC,OAAO,IAAI,OAAO,MAAM,QAAQ,uBAAuB,MAAM,GAAG,GAAG;AACrE;AAGA,SAAS,aAAa,OAAa;CACjC,OAAO,OAAO,SAAS,KAAK,IAAI,UAAU,KAAK,IAAI;AACrD;AAOA,SAAS,QAAqC,OAAa;CACzD,OAAO;AACT;AAwCA,IAAa,gBAAb,MAAa,cAAa;CAgBf,OAAO,MAAS,UAAc,GAAA,YAAA,CAAA,E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AA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,UAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,OAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;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"}
|
|
@@ -301,7 +301,7 @@ var WrInputOtp = class WrInputOtp {
|
|
|
301
301
|
isSignal: true
|
|
302
302
|
}],
|
|
303
303
|
ngImport: i0,
|
|
304
|
-
template: "@for (cell of cells(); track trackIndex($index)) {\n <input\n #cell\n class=\"wr-input-otp__cell\"\n [type]=\"cellType()\"\n [attr.inputmode]=\"cellInputMode()\"\n maxlength=\"1\"\n autocomplete=\"one-time-code\"\n autocapitalize=\"off\"\n spellcheck=\"false\"\n [value]=\"cell\"\n [disabled]=\"disabled()\"\n [readonly]=\"readonly()\"\n [placeholder]=\"placeholder()\"\n [attr.aria-label]=\"cellLabel($index)\"\n [attr.aria-invalid]=\"fieldAria.ariaInvalid()\"\n [attr.aria-describedby]=\"fieldAria.describedBy()\"\n (input)=\"onInput($event, $index)\"\n (keydown)=\"onKeyDown($event, $index)\"\n (compositionend)=\"onCompositionEnd($event, $index)\"\n (paste)=\"onPaste($event)\"\n (click)=\"onClick($event)\"\n (blur)=\"onBlur()\"\n />\n}\n",
|
|
304
|
+
template: "@for (cell of cells(); track trackIndex($index)) {\n <input\n #cell\n class=\"wr-input-otp__cell\"\n [type]=\"cellType()\"\n [attr.inputmode]=\"cellInputMode()\"\n maxlength=\"1\"\n autocomplete=\"one-time-code\"\n autocapitalize=\"off\"\n spellcheck=\"false\"\n [value]=\"cell\"\n [disabled]=\"disabled()\"\n [readonly]=\"readonly()\"\n [placeholder]=\"placeholder()\"\n [attr.aria-label]=\"cellLabel($index)\"\n [attr.aria-invalid]=\"fieldAria.ariaInvalid()\"\n [attr.aria-required]=\"fieldAria.ariaRequired()\"\n [attr.aria-describedby]=\"fieldAria.describedBy()\"\n (input)=\"onInput($event, $index)\"\n (keydown)=\"onKeyDown($event, $index)\"\n (compositionend)=\"onCompositionEnd($event, $index)\"\n (paste)=\"onPaste($event)\"\n (click)=\"onClick($event)\"\n (blur)=\"onBlur()\"\n />\n}\n",
|
|
305
305
|
encapsulation: i0.ViewEncapsulation.None
|
|
306
306
|
});
|
|
307
307
|
};
|
|
@@ -322,7 +322,7 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
322
322
|
"[attr.aria-label]": "groupName()",
|
|
323
323
|
"[attr.aria-labelledby]": "labelledBy()"
|
|
324
324
|
},
|
|
325
|
-
template: "@for (cell of cells(); track trackIndex($index)) {\n <input\n #cell\n class=\"wr-input-otp__cell\"\n [type]=\"cellType()\"\n [attr.inputmode]=\"cellInputMode()\"\n maxlength=\"1\"\n autocomplete=\"one-time-code\"\n autocapitalize=\"off\"\n spellcheck=\"false\"\n [value]=\"cell\"\n [disabled]=\"disabled()\"\n [readonly]=\"readonly()\"\n [placeholder]=\"placeholder()\"\n [attr.aria-label]=\"cellLabel($index)\"\n [attr.aria-invalid]=\"fieldAria.ariaInvalid()\"\n [attr.aria-describedby]=\"fieldAria.describedBy()\"\n (input)=\"onInput($event, $index)\"\n (keydown)=\"onKeyDown($event, $index)\"\n (compositionend)=\"onCompositionEnd($event, $index)\"\n (paste)=\"onPaste($event)\"\n (click)=\"onClick($event)\"\n (blur)=\"onBlur()\"\n />\n}\n"
|
|
325
|
+
template: "@for (cell of cells(); track trackIndex($index)) {\n <input\n #cell\n class=\"wr-input-otp__cell\"\n [type]=\"cellType()\"\n [attr.inputmode]=\"cellInputMode()\"\n maxlength=\"1\"\n autocomplete=\"one-time-code\"\n autocapitalize=\"off\"\n spellcheck=\"false\"\n [value]=\"cell\"\n [disabled]=\"disabled()\"\n [readonly]=\"readonly()\"\n [placeholder]=\"placeholder()\"\n [attr.aria-label]=\"cellLabel($index)\"\n [attr.aria-invalid]=\"fieldAria.ariaInvalid()\"\n [attr.aria-required]=\"fieldAria.ariaRequired()\"\n [attr.aria-describedby]=\"fieldAria.describedBy()\"\n (input)=\"onInput($event, $index)\"\n (keydown)=\"onKeyDown($event, $index)\"\n (compositionend)=\"onCompositionEnd($event, $index)\"\n (paste)=\"onPaste($event)\"\n (click)=\"onClick($event)\"\n (blur)=\"onBlur()\"\n />\n}\n"
|
|
326
326
|
}]
|
|
327
327
|
}],
|
|
328
328
|
ctorParameters: () => [],
|