@mk-kit/ui 0.44.0 → 0.45.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.
@@ -1212,21 +1212,37 @@ declare const MK_DEFAULT_I18N: MkI18nStrings;
1212
1212
  */
1213
1213
  declare const MK_I18N: InjectionToken<MkI18nStrings>;
1214
1214
  /**
1215
- * Provide localised strings (merged over the English defaults) — pass any
1216
- * subset. The nested `dateNames`, `blockEditor` and `validation` groups are
1217
- * merged deeply, so partial overrides of those work too.
1215
+ * Any subset of {@link MkI18nStrings}; the nested `dateNames`, `blockEditor`
1216
+ * and `validation` groups may be partial too (they are merged deeply).
1217
+ */
1218
+ type MkI18nOverrides = Partial<Omit<MkI18nStrings, 'dateNames' | 'blockEditor' | 'validation'>> & {
1219
+ dateNames?: Partial<MkDateNames>;
1220
+ blockEditor?: Partial<MkBlockEditorStrings>;
1221
+ validation?: Partial<MkValidationStrings>;
1222
+ };
1223
+ /**
1224
+ * Merges `overrides` over a complete string map — shallow for the top level,
1225
+ * deep for the `dateNames`, `blockEditor` and `validation` groups. Exported
1226
+ * so locale packs and tests can build a map without providing it.
1227
+ */
1228
+ declare function mkMergeI18n(base: MkI18nStrings, overrides: MkI18nOverrides): MkI18nStrings;
1229
+ /**
1230
+ * Provide localised strings — pass any subset, merged over `base` (the
1231
+ * English defaults unless given). The nested `dateNames`, `blockEditor` and
1232
+ * `validation` groups are merged deeply, so partial overrides of those work
1233
+ * too.
1218
1234
  *
1219
1235
  * ```ts
1220
1236
  * bootstrapApplication(App, {
1221
1237
  * providers: [provideMkI18n({ noResults: 'Brak wyników', close: 'Zamknij' })],
1222
1238
  * });
1223
1239
  * ```
1240
+ *
1241
+ * A locale pack is a complete map that serves as the base — either through
1242
+ * its own helper (`provideMkI18nPl(overrides)` from `@mk-kit/ui/locales/pl`)
1243
+ * or explicitly: `provideMkI18n(overrides, MK_PL_I18N)`.
1224
1244
  */
1225
- declare function provideMkI18n(overrides: Partial<Omit<MkI18nStrings, 'dateNames' | 'blockEditor' | 'validation'>> & {
1226
- dateNames?: Partial<MkDateNames>;
1227
- blockEditor?: Partial<MkBlockEditorStrings>;
1228
- validation?: Partial<MkValidationStrings>;
1229
- }): Provider;
1245
+ declare function provideMkI18n(overrides: MkI18nOverrides, base?: MkI18nStrings): Provider;
1230
1246
 
1231
1247
  /**
1232
1248
  * Field context — the contract a field wrapper (`mk-form-field`) exposes to
@@ -1473,5 +1489,5 @@ declare function mkQueryOperatorLabel(op: MkQueryOperator, i18n?: MkI18nStrings)
1473
1489
  */
1474
1490
  declare function mkQueryToText(group: MkQueryGroup, fields?: readonly MkQueryField[], i18n?: MkI18nStrings): string;
1475
1491
 
1476
- export { MK_BREAKPOINTS, MK_DEFAULT_BREAKPOINTS, MK_DEFAULT_DATE_NAMES, MK_DEFAULT_I18N, MK_DEFAULT_VALIDATION, MK_I18N, MK_OVERLAY_DATA, MK_QUERY_OPERATORS, MK_QUERY_UNARY, MkAnchoredPanel, MkBreakpointService, MkFieldContext, MkFocusTrap, MkLiveAnnouncer, MkOverlayRef, MkOverlayService, MkThemeService, mkComputeAnchoredPosition, mkCreateQueryGroup, mkCreateQueryRule, mkFirstErrorMessage, mkGetFocusable, mkHighlight, mkHighlightJson, mkInjectFieldTouched, mkIsQueryGroup, mkIsResponsive, mkQueryCompact, mkQueryIsEmpty, mkQueryOperatorLabel, mkQueryOperatorsFor, mkQueryRuleCount, mkQueryRuleIsComplete, mkQueryRuleMatches, mkQueryToPredicate, mkQueryToText, mkSignalErrorMessage, mkSignalErrorsToValidationErrors, mkUniqueId, mkValidatorChange, provideMkI18n };
1477
- export type { MkAnchoredPosition, MkAnchoredPositionOptions, MkAriaLivePoliteness, MkBlockEditorStrings, MkBreakpoint, MkBreakpoints, MkCodeLanguage, MkContrastPreference, MkDateNames, MkDensity, MkErrorMessages, MkI18nStrings, MkOverlayConfig, MkPlacement, MkQueryCombinator, MkQueryField, MkQueryFieldOption, MkQueryGroup, MkQueryNode, MkQueryOperator, MkQueryRule, MkQueryValueType, MkResolvedContrast, MkResolvedTheme, MkResponsive, MkSignalValidationError, MkSize$1 as MkSize, MkSortAnnounceDirection, MkThemePreference, MkTone, MkValidationStrings, MkValidatorChangeRef, MkVariant };
1492
+ export { MK_BREAKPOINTS, MK_DEFAULT_BREAKPOINTS, MK_DEFAULT_DATE_NAMES, MK_DEFAULT_I18N, MK_DEFAULT_VALIDATION, MK_I18N, MK_OVERLAY_DATA, MK_QUERY_OPERATORS, MK_QUERY_UNARY, MkAnchoredPanel, MkBreakpointService, MkFieldContext, MkFocusTrap, MkLiveAnnouncer, MkOverlayRef, MkOverlayService, MkThemeService, mkComputeAnchoredPosition, mkCreateQueryGroup, mkCreateQueryRule, mkFirstErrorMessage, mkGetFocusable, mkHighlight, mkHighlightJson, mkInjectFieldTouched, mkIsQueryGroup, mkIsResponsive, mkMergeI18n, mkQueryCompact, mkQueryIsEmpty, mkQueryOperatorLabel, mkQueryOperatorsFor, mkQueryRuleCount, mkQueryRuleIsComplete, mkQueryRuleMatches, mkQueryToPredicate, mkQueryToText, mkSignalErrorMessage, mkSignalErrorsToValidationErrors, mkUniqueId, mkValidatorChange, provideMkI18n };
1493
+ export type { MkAnchoredPosition, MkAnchoredPositionOptions, MkAriaLivePoliteness, MkBlockEditorStrings, MkBreakpoint, MkBreakpoints, MkCodeLanguage, MkContrastPreference, MkDateNames, MkDensity, MkErrorMessages, MkI18nOverrides, MkI18nStrings, MkOverlayConfig, MkPlacement, MkQueryCombinator, MkQueryField, MkQueryFieldOption, MkQueryGroup, MkQueryNode, MkQueryOperator, MkQueryRule, MkQueryValueType, MkResolvedContrast, MkResolvedTheme, MkResponsive, MkSignalValidationError, MkSize$1 as MkSize, MkSortAnnounceDirection, MkThemePreference, MkTone, MkValidationStrings, MkValidatorChangeRef, MkVariant };
@@ -0,0 +1,42 @@
1
+ import { Provider } from '@angular/core';
2
+ import { MkBlockEditorStrings, MkDateNames, MkI18nStrings, MkValidationStrings, MkI18nOverrides } from '@mk-kit/ui/core';
3
+
4
+ /**
5
+ * Picks the Polish plural form for a count: `one` for 1, `few` for 2–4
6
+ * (except 12–14), `many` otherwise — CLDR's `pl` rules for integers, which is
7
+ * all the library's counts ever are.
8
+ *
9
+ * ```ts
10
+ * mkPluralPl(1, 'wynik', 'wyniki', 'wyników'); // 'wynik'
11
+ * mkPluralPl(3, 'wynik', 'wyniki', 'wyników'); // 'wyniki'
12
+ * mkPluralPl(12, 'wynik', 'wyniki', 'wyników'); // 'wyników'
13
+ * ```
14
+ */
15
+ declare function mkPluralPl(count: number, one: string, few: string, many: string): string;
16
+ /** Polish month and weekday names (Sunday-first, lowercase as in `Intl`). */
17
+ declare const MK_PL_DATE_NAMES: MkDateNames;
18
+ /** Polish validation messages rendered by `mk-form-field`. */
19
+ declare const MK_PL_VALIDATION: MkValidationStrings;
20
+ /** Polish strings of the block editor's chrome. */
21
+ declare const MK_PL_BLOCK_EDITOR: MkBlockEditorStrings;
22
+ /**
23
+ * The complete Polish string map — every key of {@link MkI18nStrings},
24
+ * `locale: 'pl-PL'` and `currency: 'PLN'` for the formatting pipes.
25
+ * Provide it whole with {@link provideMkI18nPl}, or pass it as the base of
26
+ * `provideMkI18n(overrides, MK_PL_I18N)`.
27
+ */
28
+ declare const MK_PL_I18N: MkI18nStrings;
29
+ /**
30
+ * Provides the Polish strings — {@link MK_PL_I18N} with any `overrides`
31
+ * merged on top (deep for `dateNames`, `blockEditor` and `validation`, like
32
+ * `provideMkI18n`).
33
+ *
34
+ * ```ts
35
+ * bootstrapApplication(App, {
36
+ * providers: [provideMkI18nPl({ noData: 'Nic tu nie ma' })],
37
+ * });
38
+ * ```
39
+ */
40
+ declare function provideMkI18nPl(overrides?: MkI18nOverrides): Provider;
41
+
42
+ export { MK_PL_BLOCK_EDITOR, MK_PL_DATE_NAMES, MK_PL_I18N, MK_PL_VALIDATION, mkPluralPl, provideMkI18nPl };