@mk-kit/ui 0.42.0 → 0.43.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.
Files changed (46) hide show
  1. package/README.md +3 -3
  2. package/THIRD_PARTY_NOTICES.md +4 -2
  3. package/fesm2022/mk-kit-ui-block-editor.mjs +4 -2
  4. package/fesm2022/mk-kit-ui-block-editor.mjs.map +1 -1
  5. package/fesm2022/mk-kit-ui-checkbox.mjs +4 -2
  6. package/fesm2022/mk-kit-ui-checkbox.mjs.map +1 -1
  7. package/fesm2022/mk-kit-ui-core.mjs +131 -1
  8. package/fesm2022/mk-kit-ui-core.mjs.map +1 -1
  9. package/fesm2022/mk-kit-ui-data.mjs +437 -7
  10. package/fesm2022/mk-kit-ui-data.mjs.map +1 -1
  11. package/fesm2022/mk-kit-ui-datetime.mjs +88 -50
  12. package/fesm2022/mk-kit-ui-datetime.mjs.map +1 -1
  13. package/fesm2022/mk-kit-ui-dynamic-form.mjs +149 -2
  14. package/fesm2022/mk-kit-ui-dynamic-form.mjs.map +1 -1
  15. package/fesm2022/mk-kit-ui-feedback.mjs +1 -1
  16. package/fesm2022/mk-kit-ui-feedback.mjs.map +1 -1
  17. package/fesm2022/mk-kit-ui-forms.mjs +325 -77
  18. package/fesm2022/mk-kit-ui-forms.mjs.map +1 -1
  19. package/fesm2022/mk-kit-ui-icon-extended.mjs +425 -0
  20. package/fesm2022/mk-kit-ui-icon-extended.mjs.map +1 -0
  21. package/fesm2022/mk-kit-ui-icon.mjs +296 -459
  22. package/fesm2022/mk-kit-ui-icon.mjs.map +1 -1
  23. package/fesm2022/mk-kit-ui-query-builder.mjs +1 -1
  24. package/fesm2022/mk-kit-ui-query-builder.mjs.map +1 -1
  25. package/fesm2022/mk-kit-ui-rich-text.mjs +4 -2
  26. package/fesm2022/mk-kit-ui-rich-text.mjs.map +1 -1
  27. package/fesm2022/mk-kit-ui-table.mjs +10 -2
  28. package/fesm2022/mk-kit-ui-table.mjs.map +1 -1
  29. package/fesm2022/mk-kit-ui.mjs +1 -0
  30. package/fesm2022/mk-kit-ui.mjs.map +1 -1
  31. package/package.json +5 -1
  32. package/schematics/migrate-primeng/transform.js +4 -1
  33. package/schematics/ng-add/index.js +30 -2
  34. package/schematics/ng-add/schema.json +6 -0
  35. package/types/mk-kit-ui-block-editor.d.ts +2 -0
  36. package/types/mk-kit-ui-checkbox.d.ts +2 -0
  37. package/types/mk-kit-ui-core.d.ts +72 -2
  38. package/types/mk-kit-ui-data.d.ts +203 -2
  39. package/types/mk-kit-ui-datetime.d.ts +41 -19
  40. package/types/mk-kit-ui-dynamic-form.d.ts +44 -1
  41. package/types/mk-kit-ui-forms.d.ts +154 -16
  42. package/types/mk-kit-ui-icon-extended.d.ts +83 -0
  43. package/types/mk-kit-ui-icon.d.ts +100 -17
  44. package/types/mk-kit-ui-rich-text.d.ts +2 -0
  45. package/types/mk-kit-ui-table.d.ts +0 -17
  46. package/types/mk-kit-ui.d.ts +1 -0
@@ -0,0 +1,83 @@
1
+ import { MkIconMap } from '@mk-kit/ui/icon';
2
+ import { EnvironmentProviders } from '@angular/core';
3
+
4
+ /**
5
+ * GENERATED by scripts/gen-icons.mjs from scripts/icons.json — do not edit.
6
+ *
7
+ * The opt-in extended icon set: `MK_EXTENDED_ICONS` (everything) and one `MK_EXTENDED_ICONS_<GROUP>` subset per themed group. Every map is built by a call marked pure, so an app pays only for the maps it actually passes to `provideMkIcons()` / `provideMkExtendedIcons()`.
8
+ *
9
+ * Glyphs © Lucide Icons and Contributors, ISC licence (lucide-static
10
+ * v1.34.0); see THIRD_PARTY_NOTICES.md. Bodies only — the registry-facing
11
+ * maps wrap them with the same `<svg>` attributes as the hand-made defaults
12
+ * so both sets render identically.
13
+ */
14
+
15
+ /** `navigation` subset of {@link MK_EXTENDED_ICONS} (34 icons). */
16
+ declare const MK_EXTENDED_ICONS_NAVIGATION: MkIconMap;
17
+ /** `layout` subset of {@link MK_EXTENDED_ICONS} (17 icons). */
18
+ declare const MK_EXTENDED_ICONS_LAYOUT: MkIconMap;
19
+ /** `data` subset of {@link MK_EXTENDED_ICONS} (15 icons). */
20
+ declare const MK_EXTENDED_ICONS_DATA: MkIconMap;
21
+ /** `files` subset of {@link MK_EXTENDED_ICONS} (22 icons). */
22
+ declare const MK_EXTENDED_ICONS_FILES: MkIconMap;
23
+ /** `communication` subset of {@link MK_EXTENDED_ICONS} (15 icons). */
24
+ declare const MK_EXTENDED_ICONS_COMMUNICATION: MkIconMap;
25
+ /** `people` subset of {@link MK_EXTENDED_ICONS} (11 icons). */
26
+ declare const MK_EXTENDED_ICONS_PEOPLE: MkIconMap;
27
+ /** `commerce` subset of {@link MK_EXTENDED_ICONS} (23 icons). */
28
+ declare const MK_EXTENDED_ICONS_COMMERCE: MkIconMap;
29
+ /** `status` subset of {@link MK_EXTENDED_ICONS} (20 icons). */
30
+ declare const MK_EXTENDED_ICONS_STATUS: MkIconMap;
31
+ /** `time` subset of {@link MK_EXTENDED_ICONS} (8 icons). */
32
+ declare const MK_EXTENDED_ICONS_TIME: MkIconMap;
33
+ /** `developer` subset of {@link MK_EXTENDED_ICONS} (23 icons). */
34
+ declare const MK_EXTENDED_ICONS_DEVELOPER: MkIconMap;
35
+ /** `devices` subset of {@link MK_EXTENDED_ICONS} (15 icons). */
36
+ declare const MK_EXTENDED_ICONS_DEVICES: MkIconMap;
37
+ /** `media` subset of {@link MK_EXTENDED_ICONS} (14 icons). */
38
+ declare const MK_EXTENDED_ICONS_MEDIA: MkIconMap;
39
+ /** `editing` subset of {@link MK_EXTENDED_ICONS} (34 icons). */
40
+ declare const MK_EXTENDED_ICONS_EDITING: MkIconMap;
41
+ /** `security` subset of {@link MK_EXTENDED_ICONS} (5 icons). */
42
+ declare const MK_EXTENDED_ICONS_SECURITY: MkIconMap;
43
+ /** `travel` subset of {@link MK_EXTENDED_ICONS} (9 icons). */
44
+ declare const MK_EXTENDED_ICONS_TRAVEL: MkIconMap;
45
+ /** `lifestyle` subset of {@link MK_EXTENDED_ICONS} (40 icons). */
46
+ declare const MK_EXTENDED_ICONS_LIFESTYLE: MkIconMap;
47
+ /**
48
+ * The themed subsets by group name — handy for a picker or for registering
49
+ * several groups at once: `provideMkIcons(MK_EXTENDED_ICON_GROUPS['files'])`.
50
+ */
51
+ declare const MK_EXTENDED_ICON_GROUPS: Readonly<Record<string, MkIconMap>>;
52
+ /**
53
+ * Every Lucide-derived icon (305 glyphs). Not registered by
54
+ * default — install it with `provideMkExtendedIcons()`, pass a themed subset
55
+ * to `provideMkIcons()`, or load it lazily:
56
+ * `provideMkIcons(() => import('@mk-kit/ui/icon/extended').then((m) => m.MK_EXTENDED_ICONS))`.
57
+ */
58
+ declare const MK_EXTENDED_ICONS: MkIconMap;
59
+
60
+ /**
61
+ * Registers the whole Lucide-derived extended set ({@link MK_EXTENDED_ICONS})
62
+ * so every `<mk-icon name="…">` in the catalogue resolves. Opt-in: without
63
+ * it only the hand-made defaults are available and an unknown name warns
64
+ * once in dev mode.
65
+ *
66
+ * ```ts
67
+ * import { provideMkExtendedIcons } from '@mk-kit/ui/icon/extended';
68
+ *
69
+ * bootstrapApplication(App, {
70
+ * providers: [provideMkExtendedIcons()],
71
+ * });
72
+ * ```
73
+ *
74
+ * Size-conscious alternatives (see `provideMkIcons`): register only the
75
+ * themed subsets you use (`provideMkIcons(MK_EXTENDED_ICONS_FILES)`), or load
76
+ * the full set lazily in its own chunk:
77
+ * `provideMkIcons(() => import('@mk-kit/ui/icon/extended').then((m) => m.MK_EXTENDED_ICONS))`.
78
+ * The hand-made defaults keep their names — the generated set never
79
+ * overlaps them.
80
+ */
81
+ declare function provideMkExtendedIcons(): EnvironmentProviders;
82
+
83
+ export { MK_EXTENDED_ICONS, MK_EXTENDED_ICONS_COMMERCE, MK_EXTENDED_ICONS_COMMUNICATION, MK_EXTENDED_ICONS_DATA, MK_EXTENDED_ICONS_DEVELOPER, MK_EXTENDED_ICONS_DEVICES, MK_EXTENDED_ICONS_EDITING, MK_EXTENDED_ICONS_FILES, MK_EXTENDED_ICONS_LAYOUT, MK_EXTENDED_ICONS_LIFESTYLE, MK_EXTENDED_ICONS_MEDIA, MK_EXTENDED_ICONS_NAVIGATION, MK_EXTENDED_ICONS_PEOPLE, MK_EXTENDED_ICONS_SECURITY, MK_EXTENDED_ICONS_STATUS, MK_EXTENDED_ICONS_TIME, MK_EXTENDED_ICONS_TRAVEL, MK_EXTENDED_ICON_GROUPS, provideMkExtendedIcons };
@@ -1,7 +1,7 @@
1
1
  import * as _angular_platform_browser from '@angular/platform-browser';
2
2
  import { SafeHtml } from '@angular/platform-browser';
3
3
  import * as _angular_core from '@angular/core';
4
- import { EnvironmentProviders } from '@angular/core';
4
+ import { Signal, EnvironmentProviders } from '@angular/core';
5
5
  import { MkSize } from '@mk-kit/ui/core';
6
6
 
7
7
  /**
@@ -29,18 +29,31 @@ declare class MkIcon {
29
29
  readonly label: _angular_core.InputSignal<string>;
30
30
  /** CSS length for the icon box (width = height = font-size). */
31
31
  protected readonly dimension: _angular_core.Signal<string>;
32
- /** Sanitized SVG for the named icon, or `null` (falls back to projection). */
32
+ /**
33
+ * Sanitized SVG for the named icon, or `null` (falls back to projection).
34
+ * Tracks the registry's `changes` so a late registration (lazy-loaded set,
35
+ * runtime `register()`) fills the icon in without re-binding `name`.
36
+ */
33
37
  protected readonly svg: _angular_core.Signal<_angular_platform_browser.SafeHtml | null>;
34
38
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<MkIcon, never>;
35
39
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<MkIcon, "mk-icon", never, { "name": { "alias": "name"; "required": false; "isSignal": true; }; "size": { "alias": "size"; "required": false; "isSignal": true; }; "label": { "alias": "label"; "required": false; "isSignal": true; }; }, {}, never, ["*"], true, never>;
36
40
  }
37
41
 
42
+ /** A `{ name: '<svg …>…</svg>' }` map — what every registration API accepts. */
43
+ type MkIconMap = Readonly<Record<string, string>>;
44
+ /**
45
+ * Loads an icon map on demand — typically a dynamic import of the extended
46
+ * set: `() => import('@mk-kit/ui/icon/extended').then((m) => m.MK_EXTENDED_ICONS)`.
47
+ */
48
+ type MkIconLoader = () => Promise<MkIconMap>;
38
49
  /**
39
- * IconRegistry — the name → SVG store behind `<mk-icon name="…">`. The built-in
40
- * sets — the hand-made {@link MK_DEFAULT_ICONS} and the Lucide-derived
41
- * {@link MK_EXTENDED_ICONS} are registered on construction; add your own SVGs
42
- * (from a sprite, a design export, anything) with {@link register} /
43
- * {@link registerIcons}.
50
+ * IconRegistry — the name → SVG store behind `<mk-icon name="…">`. The
51
+ * hand-made {@link MK_DEFAULT_ICONS} are registered on construction and ship
52
+ * with every app. Everything else is opt-in and tree-shakeable: the
53
+ * Lucide-derived extended set via `provideMkExtendedIcons()` (from
54
+ * `@mk-kit/ui/icon/extended`), a themed subset or your own SVGs (from a
55
+ * sprite, a design export, anything) via `provideMkIcons()`, or at runtime
56
+ * with {@link register} / {@link registerIcons} / {@link load}.
44
57
  *
45
58
  * SVG markup is trusted verbatim (bypassed through `DomSanitizer`), so only
46
59
  * register icons from sources you control — never user input.
@@ -49,35 +62,72 @@ declare class MkIcon {
49
62
  * const reg = inject(MkIconRegistry);
50
63
  * reg.register('logo', '<svg viewBox="0 0 24 24">…</svg>');
51
64
  * reg.registerIcons({ save: '<svg…>', share: '<svg…>' });
65
+ * reg.load(() => import('@mk-kit/ui/icon/extended').then((m) => m.MK_EXTENDED_ICONS_FILES));
52
66
  * ```
53
67
  */
54
68
  declare class MkIconRegistry {
55
69
  private readonly sanitizer;
70
+ private readonly pendingTasks;
56
71
  private readonly icons;
57
72
  private readonly aliases;
73
+ private readonly version;
74
+ private readonly loads;
75
+ private readonly warned;
76
+ /**
77
+ * Bumps on every registration. `<mk-icon>` reads it, so an icon that
78
+ * arrives late (a lazy {@link load}, a runtime {@link register}) renders in
79
+ * place without any re-binding.
80
+ */
81
+ readonly changes: Signal<number>;
82
+ /** Whether a lazy {@link load} is still in flight. */
83
+ readonly pending: Signal<boolean>;
58
84
  constructor();
59
85
  /** Register (or overwrite) a single named icon from raw SVG markup. */
60
86
  register(name: string, svg: string): this;
61
- /** Register many icons at once from a `{ name: svg }` map. */
62
- registerIcons(icons: Readonly<Record<string, string>>): this;
87
+ /**
88
+ * Register many icons at once from a `{ name: svg }` map — a whole set, a
89
+ * themed subset (`MK_EXTENDED_ICONS_FILES`) or a hand-picked few. Later
90
+ * registrations overwrite earlier ones on a shared name.
91
+ */
92
+ registerIcons(icons: MkIconMap): this;
63
93
  /**
64
94
  * Register alternative names that resolve to existing icons — e.g. map
65
95
  * Material Symbols ligature names onto the built-in set
66
96
  * (`{ delete: 'trash', expand_more: 'chevron-down' }`). A real icon
67
- * registered under an alias name always wins over the alias.
97
+ * registered under an alias name always wins over the alias; an alias
98
+ * whose target is not registered resolves to nothing (and, in dev mode,
99
+ * warns once naming the missing target).
68
100
  */
69
101
  registerAliases(aliases: Readonly<Record<string, string>>): this;
102
+ /**
103
+ * Load an icon map asynchronously and register it once it arrives. Icons
104
+ * already on screen fill in when the map lands (see {@link changes}); the
105
+ * missing-icon warning stays quiet while a load is pending. Server-side
106
+ * rendering waits for it (Angular's `PendingTasks`), so the HTML ships with
107
+ * the icons in place.
108
+ *
109
+ * ```ts
110
+ * registry.load(() => import('@mk-kit/ui/icon/extended').then((m) => m.MK_EXTENDED_ICONS));
111
+ * ```
112
+ */
113
+ load(loader: MkIconLoader): Promise<void>;
70
114
  /** Sanitized SVG for a name (aliases resolved), or `null` when unknown. */
71
115
  get(name: string): SafeHtml | null;
72
116
  /** Whether an icon with this name (or alias) is registered. */
73
117
  has(name: string): boolean;
74
118
  /** All registered icon names (useful for a picker / catalogue). */
75
119
  names(): string[];
120
+ /**
121
+ * Dev-mode only: warn once per unknown name with a hint about the opt-in
122
+ * extended set. Silent in production builds and while a {@link load} is
123
+ * pending (the name may be on its way). Called by `<mk-icon>`.
124
+ */
125
+ warnMissing(name: string): void;
76
126
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<MkIconRegistry, never>;
77
127
  static ɵprov: _angular_core.ɵɵInjectableDeclaration<MkIconRegistry>;
78
128
  }
79
129
 
80
- /** Name → SVG markup map of the default icons. */
130
+ /** Name → SVG markup map of the default icons (registered by {@link MkIconRegistry} on construction). */
81
131
  declare const MK_DEFAULT_ICONS: Readonly<Record<string, string>>;
82
132
 
83
133
  /**
@@ -87,9 +137,13 @@ declare const MK_DEFAULT_ICONS: Readonly<Record<string, string>>;
87
137
  * glyph once {@link provideMkMaterialIcons} is installed.
88
138
  *
89
139
  * Several Material names intentionally collapse onto one mk glyph (all the
90
- * calendar variants → `calendar`, the delete variants → `trash`, …). Names
91
- * not listed here have no sensible built-in equivalent register your own
92
- * SVG under the Material name via `MkIconRegistry.register`.
140
+ * calendar variants → `calendar`, the delete variants → `trash`, …). Every
141
+ * target is a default icon, so the aliases work without the opt-in extended
142
+ * set. Names not listed here have no sensible built-in equivalent — register
143
+ * your own SVG under the Material name via `MkIconRegistry.register`, or
144
+ * alias it onto an extended glyph with `registerAliases` once
145
+ * `provideMkExtendedIcons()` is installed (an alias whose target is missing
146
+ * renders nothing and warns once in dev mode).
93
147
  */
94
148
  declare const MK_MATERIAL_ICON_ALIASES: Readonly<Record<string, string>>;
95
149
  /**
@@ -106,7 +160,36 @@ declare const MK_MATERIAL_ICON_ALIASES: Readonly<Record<string, string>>;
106
160
  */
107
161
  declare function provideMkMaterialIcons(): EnvironmentProviders;
108
162
 
109
- /** Name → SVG markup map of the Lucide-derived icons registered by default. */
110
- declare const MK_EXTENDED_ICONS: Readonly<Record<string, string>>;
163
+ /**
164
+ * Registers extra icons at bootstrap — a themed subset of the extended set,
165
+ * a hand-picked few, your own SVGs, or a lazily loaded map. Call it as many
166
+ * times as you like; each call adds to the {@link MkIconRegistry}. The
167
+ * hand-made defaults are always there; this is for everything else.
168
+ *
169
+ * ```ts
170
+ * import { provideMkIcons } from '@mk-kit/ui/icon';
171
+ * import { MK_EXTENDED_ICONS_FILES, MK_EXTENDED_ICONS_DATA } from '@mk-kit/ui/icon/extended';
172
+ *
173
+ * bootstrapApplication(App, {
174
+ * providers: [
175
+ * // themed subsets — only these glyphs end up in the bundle
176
+ * provideMkIcons(MK_EXTENDED_ICONS_FILES),
177
+ * provideMkIcons(MK_EXTENDED_ICONS_DATA),
178
+ * // your own
179
+ * provideMkIcons({ logo: '<svg viewBox="0 0 24 24">…</svg>' }),
180
+ * // or the whole extended set in its own lazy chunk, off the critical path
181
+ * provideMkIcons(() => import('@mk-kit/ui/icon/extended').then((m) => m.MK_EXTENDED_ICONS)),
182
+ * ],
183
+ * });
184
+ * ```
185
+ *
186
+ * A loader runs once at bootstrap without blocking it: icons already on
187
+ * screen fill in when the chunk lands, and server-side rendering waits for
188
+ * it. Picking single names out of the full map
189
+ * (`{ receipt: MK_EXTENDED_ICONS['receipt'] }`) works but still bundles the
190
+ * whole map — use a subset or copy the SVG when size matters.
191
+ */
192
+ declare function provideMkIcons(icons: MkIconMap | MkIconLoader): EnvironmentProviders;
111
193
 
112
- export { MK_DEFAULT_ICONS, MK_EXTENDED_ICONS, MK_MATERIAL_ICON_ALIASES, MkIcon, MkIconRegistry, provideMkMaterialIcons };
194
+ export { MK_DEFAULT_ICONS, MK_MATERIAL_ICON_ALIASES, MkIcon, MkIconRegistry, provideMkIcons, provideMkMaterialIcons };
195
+ export type { MkIconLoader, MkIconMap };
@@ -23,6 +23,8 @@ import * as _mk_kit_ui_core from '@mk-kit/ui/core';
23
23
  */
24
24
  declare class MkRichText implements ControlValueAccessor {
25
25
  private readonly field;
26
+ /** Signal Forms: gates `invalid` until the bound field is touched or dirty. */
27
+ private readonly fieldTouched;
26
28
  private readonly i18n;
27
29
  /** Two-way HTML string value (sanitised; `''` when visually empty). */
28
30
  readonly value: _angular_core.ModelSignal<string>;
@@ -218,22 +218,6 @@ type MkTableItem<T> = {
218
218
  /** Whether its children are currently shown (tree mode). */
219
219
  expanded: boolean;
220
220
  };
221
- /**
222
- * Table — a themed data table built on a native `<table>` for accessibility.
223
- * Supply `columns` and `data`; opt into sortable columns, sticky header,
224
- * zebra striping, hover and density. Sorting is fully keyboard operable
225
- * (Enter/Space on a header) and announces changes via {@link MkLiveAnnouncer}.
226
- *
227
- * ```html
228
- * <mk-table
229
- * [columns]="columns"
230
- * [data]="rows()"
231
- * stickyHeader
232
- * zebra
233
- * (sortChange)="onSort($event)"
234
- * (rowClick)="open($event)" />
235
- * ```
236
- */
237
221
  declare class MkTable<T = Record<string, unknown>> {
238
222
  private readonly announcer;
239
223
  protected readonly i18n: _mk_kit_ui_core.MkI18nStrings;
@@ -448,7 +432,6 @@ declare class MkTable<T = Record<string, unknown>> {
448
432
  * re-resolves locale data on every call; one cached `Intl.Collator` makes
449
433
  * large-table sorts several-fold faster with the same default-locale order.
450
434
  */
451
- private static readonly sortCollator;
452
435
  /** Data sorted by the active column, or the input order when unsorted. */
453
436
  protected readonly sortedData: _angular_core.Signal<T[]>;
454
437
  /** Sort one sibling group by the active column (input order when unsorted). */
@@ -1,5 +1,6 @@
1
1
  export * from '@mk-kit/ui/core';
2
2
  export * from '@mk-kit/ui/icon';
3
+ export * from '@mk-kit/ui/icon/extended';
3
4
  export * from '@mk-kit/ui/chip';
4
5
  export * from '@mk-kit/ui/checkbox';
5
6
  export * from '@mk-kit/ui/button';