@mk-kit/ui 0.55.1 → 0.57.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.
@@ -0,0 +1,76 @@
1
+ import * as _angular_core from '@angular/core';
2
+ import * as _mk_kit_ui_core from '@mk-kit/ui/core';
3
+ import { MkTableColumn } from '@mk-kit/ui/table';
4
+ import { MkFlatTranslations } from '@mk-kit/ui/translate';
5
+
6
+ /** One edit made in the editor. `value: null` clears the override. */
7
+ interface MkTranslationChange {
8
+ locale: string;
9
+ key: string;
10
+ value: string | null;
11
+ /** The text shown before the edit (override, or the base string). */
12
+ previous: string | null;
13
+ }
14
+ /** A row of the editor: the key plus the effective text per locale. */
15
+ interface MkTranslationRow {
16
+ key: string;
17
+ [locale: string]: string;
18
+ }
19
+ type Filter = 'all' | 'overridden' | `missing:${string}`;
20
+ /**
21
+ * Translation editor — keys as rows, locales as columns, click a cell to
22
+ * edit. The base strings are your bundled files; edits are **overrides**
23
+ * kept apart from them, so a rebuild never loses them and a cell can be
24
+ * restored to the file text. Search by key or text, filter to the keys a
25
+ * locale is missing or the ones already edited, export the grid as CSV.
26
+ * Persistence is yours: every edit is emitted as `changed`, feed the result
27
+ * back through `overrides`.
28
+ *
29
+ * ```html
30
+ * <mk-translation-editor
31
+ * [locales]="['pl', 'en', 'ru']"
32
+ * [base]="base()"
33
+ * [overrides]="overrides()"
34
+ * (changed)="save($event)" />
35
+ * ```
36
+ */
37
+ declare class MkTranslationEditor {
38
+ protected readonly i18n: _mk_kit_ui_core.MkI18nStrings;
39
+ /** Locale codes, in column order. The first one is the reference language. */
40
+ readonly locales: _angular_core.InputSignal<string[]>;
41
+ /** Bundled strings per locale, flat (`'a.b.c': 'text'`) or nested. */
42
+ readonly base: _angular_core.InputSignal<Record<string, MkFlatTranslations>>;
43
+ /** Edits per locale, flat. Missing locales are fine. */
44
+ readonly overrides: _angular_core.InputSignal<Record<string, MkFlatTranslations>>;
45
+ /** Show but do not edit. */
46
+ readonly readonly: _angular_core.InputSignal<boolean>;
47
+ /** File name of the CSV export. */
48
+ readonly exportFilename: _angular_core.InputSignal<string>;
49
+ /** An edit or a restore; persist it and update `overrides`. */
50
+ readonly changed: _angular_core.OutputEmitterRef<MkTranslationChange>;
51
+ protected readonly query: _angular_core.WritableSignal<string>;
52
+ protected readonly filter: _angular_core.WritableSignal<Filter>;
53
+ /** Every key any locale knows, sorted. */
54
+ protected readonly keys: _angular_core.Signal<string[]>;
55
+ /** Per-locale counts shown as filter chips. */
56
+ protected readonly stats: _angular_core.Signal<{
57
+ locale: string;
58
+ missing: number;
59
+ overridden: number;
60
+ }[]>;
61
+ protected readonly overriddenTotal: _angular_core.Signal<number>;
62
+ protected readonly rows: _angular_core.Signal<MkTranslationRow[]>;
63
+ protected readonly columns: _angular_core.Signal<MkTableColumn<MkTranslationRow>[]>;
64
+ protected effective(locale: string, key: string): string | null;
65
+ protected hasOverride(locale: string, key: string): boolean;
66
+ protected isMissing(locale: string, key: string): boolean;
67
+ protected onSaved(locale: string, key: string, value: string): void;
68
+ protected reset(locale: string, key: string): void;
69
+ protected setFilter(next: string): void;
70
+ protected exportCsv(): void;
71
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<MkTranslationEditor, never>;
72
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<MkTranslationEditor, "mk-translation-editor", never, { "locales": { "alias": "locales"; "required": true; "isSignal": true; }; "base": { "alias": "base"; "required": true; "isSignal": true; }; "overrides": { "alias": "overrides"; "required": false; "isSignal": true; }; "readonly": { "alias": "readonly"; "required": false; "isSignal": true; }; "exportFilename": { "alias": "exportFilename"; "required": false; "isSignal": true; }; }, { "changed": "changed"; }, never, never, true, never>;
73
+ }
74
+
75
+ export { MkTranslationEditor };
76
+ export type { MkTranslationChange, MkTranslationRow };
@@ -15,6 +15,7 @@ export * from '@mk-kit/ui/status';
15
15
  export * from '@mk-kit/ui/data';
16
16
  export * from '@mk-kit/ui/kanban';
17
17
  export * from '@mk-kit/ui/translate';
18
+ export * from '@mk-kit/ui/attention';
18
19
  export * from '@mk-kit/ui/feedback';
19
20
  export * from '@mk-kit/ui/rich-text';
20
21
  export * from '@mk-kit/ui/block-editor';