@mk-kit/ui 0.41.0 → 0.42.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.
@@ -26,6 +26,18 @@ type MkPlacement = 'top' | 'top-start' | 'top-end' | 'bottom' | 'bottom-start' |
26
26
  * both a mouse-driven admin and a touch-driven screen.
27
27
  */
28
28
  type MkDensity = 'comfortable' | 'compact' | 'touch';
29
+ /**
30
+ * Contrast preference.
31
+ *
32
+ * `high` applies the high-contrast token preset (`data-mk-contrast="high"`):
33
+ * pure text colours, line-like borders, opaque interaction washes, a thicker
34
+ * focus ring. `system` (the default) writes no attribute and lets the
35
+ * stylesheet follow the OS `prefers-contrast: more` setting; `normal` opts
36
+ * out of that even when the OS asks for more contrast.
37
+ */
38
+ type MkContrastPreference = 'normal' | 'high' | 'system';
39
+ /** Concrete resolved contrast (never `system`). */
40
+ type MkResolvedContrast = 'normal' | 'high';
29
41
  /**
30
42
  * Reactive theme controller for mk-kit.
31
43
  *
@@ -61,6 +73,22 @@ declare class MkThemeService {
61
73
  * it.
62
74
  */
63
75
  readonly density: _angular_core.Signal<MkDensity>;
76
+ private readonly _contrast;
77
+ /**
78
+ * The user's contrast preference: `normal`, `high` or `system` (follow the
79
+ * OS `prefers-contrast` setting — the default). Written as
80
+ * `data-mk-contrast` on `<html>` and persisted; `system` removes the
81
+ * attribute so the pure-CSS `prefers-contrast: more` mapping takes over.
82
+ *
83
+ * Like density, the attribute also works per subtree: put
84
+ * `data-mk-contrast="high"` on any element to raise contrast there only.
85
+ */
86
+ readonly contrast: _angular_core.Signal<MkContrastPreference>;
87
+ private readonly _systemPrefersContrast;
88
+ /** The concrete contrast in effect (`normal` or `high`). */
89
+ readonly resolvedContrast: _angular_core.Signal<MkResolvedContrast>;
90
+ /** Convenience boolean for template bindings. */
91
+ readonly isHighContrast: _angular_core.Signal<boolean>;
64
92
  constructor();
65
93
  /** Set the global density mode. */
66
94
  setDensity(density: MkDensity): void;
@@ -72,6 +100,13 @@ declare class MkThemeService {
72
100
  */
73
101
  toggleDensity(): void;
74
102
  private readInitialDensity;
103
+ /** Set the contrast preference explicitly. */
104
+ setContrast(contrast: MkContrastPreference): void;
105
+ /** Toggle between normal and high contrast (resolving `system` first). */
106
+ toggleContrast(): void;
107
+ private readInitialContrast;
108
+ private readSystemContrast;
109
+ private watchSystemContrast;
75
110
  /** Set the theme preference explicitly. */
76
111
  setTheme(preference: MkThemePreference): void;
77
112
  /** Toggle between light and dark (resolving `system` first). */
@@ -712,6 +747,18 @@ interface MkValidationStrings {
712
747
  * strings are functions so translators control word order.
713
748
  */
714
749
  interface MkI18nStrings {
750
+ /**
751
+ * BCP 47 locale tag (`'pl-PL'`, `'de'`) used by the formatting pipes
752
+ * (`mkCurrency`, `mkRelativeTime`, `mkFileSize`, `mkPluralize`) and any
753
+ * other `Intl`-based formatting that has no explicit locale of its own.
754
+ * Unset → the runtime (browser / Node) default locale.
755
+ */
756
+ locale?: string;
757
+ /**
758
+ * ISO 4217 currency code the `mkCurrency` pipe falls back to when the
759
+ * template passes none. Unset → `'USD'`.
760
+ */
761
+ currency?: string;
715
762
  /** Validation messages (deep-merged by provideMkI18n). */
716
763
  validation: MkValidationStrings;
717
764
  /** Generic "Close" control (dialog, drawer, bottom-sheet). */
@@ -1347,4 +1394,4 @@ declare function mkQueryOperatorLabel(op: MkQueryOperator, i18n?: MkI18nStrings)
1347
1394
  declare function mkQueryToText(group: MkQueryGroup, fields?: readonly MkQueryField[], i18n?: MkI18nStrings): string;
1348
1395
 
1349
1396
  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, mkIsQueryGroup, mkIsResponsive, mkQueryCompact, mkQueryIsEmpty, mkQueryOperatorLabel, mkQueryOperatorsFor, mkQueryRuleCount, mkQueryRuleIsComplete, mkQueryRuleMatches, mkQueryToPredicate, mkQueryToText, mkUniqueId, mkValidatorChange, provideMkI18n };
1350
- export type { MkAnchoredPosition, MkAnchoredPositionOptions, MkAriaLivePoliteness, MkBlockEditorStrings, MkBreakpoint, MkBreakpoints, MkCodeLanguage, MkDateNames, MkDensity, MkErrorMessages, MkI18nStrings, MkOverlayConfig, MkPlacement, MkQueryCombinator, MkQueryField, MkQueryFieldOption, MkQueryGroup, MkQueryNode, MkQueryOperator, MkQueryRule, MkQueryValueType, MkResolvedTheme, MkResponsive, MkSize$1 as MkSize, MkSortAnnounceDirection, MkThemePreference, MkTone, MkValidationStrings, MkValidatorChangeRef, MkVariant };
1397
+ 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, MkSize$1 as MkSize, MkSortAnnounceDirection, MkThemePreference, MkTone, MkValidationStrings, MkValidatorChangeRef, MkVariant };
@@ -107,6 +107,81 @@ declare class MkBadge {
107
107
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<MkBadge, "mk-badge", never, { "tone": { "alias": "tone"; "required": false; "isSignal": true; }; "variant": { "alias": "variant"; "required": false; "isSignal": true; }; "size": { "alias": "size"; "required": false; "isSignal": true; }; "dot": { "alias": "dot"; "required": false; "isSignal": true; }; }, {}, never, ["*"], true, never>;
108
108
  }
109
109
 
110
+ /** Corner of the host an {@link MkBadgeOverlay} is anchored to. */
111
+ type MkBadgeOverlayPosition = 'top-end' | 'top-start' | 'bottom-end' | 'bottom-start';
112
+ /**
113
+ * Badge overlay — anchors a small badge (count, dot or short text) to a corner
114
+ * of ANY element: an icon button, an avatar, a tab label. The host stays a
115
+ * single tab stop; the badge is a decorative, non-focusable child.
116
+ *
117
+ * - Numbers above `mkBadgeOverlayMax` (default 99) collapse to `99+`.
118
+ * - `mkBadgeOverlayDot` renders a textless dot ("something is new").
119
+ * - `mkBadgeOverlayAriaLabel` is the screen-reader text ("3 unread"). It is
120
+ * rendered in a visually hidden span and wired to the host with
121
+ * `aria-describedby`, so it is announced after the host's own name even
122
+ * when the host has an `aria-label`. When it is given, the visible badge is
123
+ * `aria-hidden` so the count is not read twice.
124
+ * - Positions use logical insets, so `top-end` sits at the top-right in LTR
125
+ * and the top-left in RTL.
126
+ *
127
+ * The badge is painted with the global `.mk-badge-overlay` styles from
128
+ * `@mk-kit/ui/styles.css` and follows the `--mk-*` tone tokens.
129
+ *
130
+ * ```html
131
+ * <button mkButton iconOnly aria-label="Notifications"
132
+ * [mkBadgeOverlay]="unread()" mkBadgeOverlayTone="danger"
133
+ * [mkBadgeOverlayAriaLabel]="unread() + ' unread'">
134
+ * <mk-icon name="bell" />
135
+ * </button>
136
+ *
137
+ * <mk-avatar name="Ada Lovelace" mkBadgeOverlay mkBadgeOverlayDot
138
+ * mkBadgeOverlayTone="success" mkBadgeOverlayPosition="bottom-end" />
139
+ * ```
140
+ */
141
+ declare class MkBadgeOverlay {
142
+ private readonly host;
143
+ private readonly renderer;
144
+ private readonly document;
145
+ private readonly isBrowser;
146
+ /**
147
+ * Badge content — a count or a short label. `null` / empty hides the badge
148
+ * unless `mkBadgeOverlayDot` is set. Numeric strings are treated as numbers
149
+ * so `mkBadgeOverlay="120"` also collapses to `99+`.
150
+ */
151
+ readonly content: _angular_core.InputSignal<string | number | null | undefined>;
152
+ /** Corner the badge is anchored to (logical: `end` flips in RTL). */
153
+ readonly position: _angular_core.InputSignal<MkBadgeOverlayPosition>;
154
+ /** Semantic color tone (same scale as `mk-badge`). */
155
+ readonly tone: _angular_core.InputSignal<MkTone>;
156
+ /** Render a textless dot instead of the content. */
157
+ readonly dot: _angular_core.InputSignalWithTransform<boolean, unknown>;
158
+ /** Numbers above this render as `<max>+`. `0` disables the cap. */
159
+ readonly max: _angular_core.InputSignalWithTransform<number, unknown>;
160
+ /** Hide the badge while keeping the directive (and its aria wiring) in place. */
161
+ readonly hidden: _angular_core.InputSignalWithTransform<boolean, unknown>;
162
+ /**
163
+ * Screen-reader text for the badge, e.g. `"3 unread"`. Announced as the
164
+ * host's description; the visible badge becomes `aria-hidden`.
165
+ */
166
+ readonly ariaLabel: _angular_core.InputSignal<string>;
167
+ /** The text painted in the badge (`''` in dot mode). */
168
+ readonly label: _angular_core.Signal<string>;
169
+ /** Whether the badge is currently rendered. */
170
+ readonly visible: _angular_core.Signal<boolean>;
171
+ private readonly srId;
172
+ private badge;
173
+ private sr;
174
+ /** Set when WE made the host positioned, so we can undo it on removal. */
175
+ private positionedHost;
176
+ constructor();
177
+ private attach;
178
+ private detach;
179
+ /** Create / update / remove the hidden description and its aria-describedby link. */
180
+ private syncSr;
181
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<MkBadgeOverlay, never>;
182
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<MkBadgeOverlay, "[mkBadgeOverlay]", never, { "content": { "alias": "mkBadgeOverlay"; "required": false; "isSignal": true; }; "position": { "alias": "mkBadgeOverlayPosition"; "required": false; "isSignal": true; }; "tone": { "alias": "mkBadgeOverlayTone"; "required": false; "isSignal": true; }; "dot": { "alias": "mkBadgeOverlayDot"; "required": false; "isSignal": true; }; "max": { "alias": "mkBadgeOverlayMax"; "required": false; "isSignal": true; }; "hidden": { "alias": "mkBadgeOverlayHidden"; "required": false; "isSignal": true; }; "ariaLabel": { "alias": "mkBadgeOverlayAriaLabel"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
183
+ }
184
+
110
185
  /** Visual treatment for a {@link MkTag}. */
111
186
  type MkTagVariant = 'solid' | 'soft' | 'outline';
112
187
  /**
@@ -1191,24 +1266,81 @@ interface HeatCell {
1191
1266
  display: string;
1192
1267
  xLabel: string;
1193
1268
  bg: string;
1194
- strong: boolean;
1269
+ /** Draw the value with `--mk-text-inverse` (else `--mk-text`). */
1270
+ inverse: boolean;
1195
1271
  }
1196
1272
  interface HeatRow {
1197
1273
  label: string;
1198
1274
  cells: HeatCell[];
1199
1275
  }
1276
+ /** An sRGB colour as 0–255 channels. */
1277
+ type MkRgb = readonly [number, number, number];
1278
+ /** The resolved colours a heatmap picks its cell text against. */
1279
+ interface MkHeatmapPalette {
1280
+ /** The `accent` input, resolved to sRGB. */
1281
+ accent: MkRgb;
1282
+ /** `--mk-surface-2` — the zero-intensity cell colour. */
1283
+ surface: MkRgb;
1284
+ /** `--mk-text`. */
1285
+ text: MkRgb;
1286
+ /** `--mk-text-inverse`. */
1287
+ textInverse: MkRgb;
1288
+ }
1289
+ /** Which text token a cell value is drawn with, and the intensity to paint the cell at. */
1290
+ interface MkHeatmapCellColors {
1291
+ /** Accent share of the cell background, 0–1. */
1292
+ intensity: number;
1293
+ /** `true` → `--mk-text-inverse`, `false` → `--mk-text`. */
1294
+ inverse: boolean;
1295
+ /** Contrast ratio of the chosen text against the cell background (1–21). */
1296
+ contrast: number;
1297
+ }
1298
+ /** WCAG AA minimum contrast for normal text — what cell values are held to. */
1299
+ declare const MK_HEATMAP_MIN_CONTRAST = 4.5;
1300
+ /** WCAG 2.x relative luminance of an sRGB colour. */
1301
+ declare function mkRelativeLuminance([r, g, b]: MkRgb): number;
1302
+ /** WCAG 2.x contrast ratio (1–21) between two colours. */
1303
+ declare function mkContrastRatio(a: MkRgb, b: MkRgb): number;
1304
+ /** What `color-mix(in srgb, a t%, b)` yields: a linear blend in gamma-encoded sRGB. */
1305
+ declare function mkMixRgb(a: MkRgb, b: MkRgb, t: number): MkRgb;
1306
+ /**
1307
+ * Parse a CSS colour as the CSSOM serialises it — `rgb(r, g, b)` /
1308
+ * `rgba(r, g, b, a)` — or a `#rgb` / `#rrggbb` literal. `null` for anything
1309
+ * else (an unresolved `var()`, `color(...)`, …).
1310
+ */
1311
+ declare function mkParseRgb(text: string | null | undefined): MkRgb | null;
1312
+ /**
1313
+ * Choose the text token for a cell at intensity `t` (0–1) — light text on
1314
+ * dark cells, dark text on light cells, decided by contrast against the
1315
+ * actual blend rather than a fixed threshold.
1316
+ *
1317
+ * Every accent ramp has a crossover band where neither `--mk-text` nor
1318
+ * `--mk-text-inverse` reaches 4.5:1 (the cell is mid-luminance). When values
1319
+ * are printed in the cells, a cell in that band is painted at the nearest
1320
+ * intensity just outside it, so its value stays readable; the shift is a few
1321
+ * percent of the ramp and the cell keeps its order relative to its
1322
+ * neighbours. Without a resolved palette (server rendering, tests) a plain
1323
+ * threshold is used.
1324
+ */
1325
+ declare function mkHeatmapCellColors(t: number, palette: MkHeatmapPalette | null, showValues: boolean): MkHeatmapCellColors;
1200
1326
  /**
1201
1327
  * Heatmap — a matrix of cells shaded by value intensity, for correlation
1202
1328
  * grids, activity-by-time tables and the like. Rendered as a semantic
1203
1329
  * `<table>` (so it is inherently screen-reader friendly) with cell colours
1204
1330
  * mixed from `accent` over the surface via `color-mix`, so it tracks the theme.
1205
1331
  *
1332
+ * Printed values (`showValues`) pick `--mk-text` or `--mk-text-inverse` per
1333
+ * cell by contrast against that cell's actual colour, in both themes — see
1334
+ * {@link mkHeatmapCellColors}.
1335
+ *
1206
1336
  * ```html
1207
1337
  * <mk-heatmap
1208
1338
  * [xLabels]="hours" [yLabels]="days" [data]="matrix()" showValues />
1209
1339
  * ```
1210
1340
  */
1211
1341
  declare class MkHeatmap {
1342
+ private readonly doc;
1343
+ private readonly host;
1212
1344
  /** Column labels (x axis). */
1213
1345
  readonly xLabels: _angular_core.InputSignal<readonly string[]>;
1214
1346
  /** Row labels (y axis). */
@@ -1229,9 +1361,21 @@ declare class MkHeatmap {
1229
1361
  readonly format: _angular_core.InputSignal<(value: number) => string>;
1230
1362
  /** Accessible summary; generated from the data when omitted. */
1231
1363
  readonly label: _angular_core.InputSignal<string>;
1364
+ /**
1365
+ * The accent and the text/surface tokens resolved through the CSSOM, so
1366
+ * each cell can pick a text colour that actually contrasts with its blend.
1367
+ * `null` until resolved (server, jsdom) — the cells then fall back to a
1368
+ * threshold.
1369
+ */
1370
+ protected readonly palette: _angular_core.WritableSignal<MkHeatmapPalette | null>;
1371
+ /** Bumped when the document theme changes so the palette is re-resolved. */
1372
+ private readonly themeTick;
1373
+ constructor();
1232
1374
  private readonly domain;
1233
1375
  /** Fraction (0–1) of the domain a value sits at. */
1234
1376
  private ratio;
1377
+ /** The `color-mix()` expression painting a cell at intensity `t`. */
1378
+ private cellBackground;
1235
1379
  protected readonly rows: _angular_core.Signal<HeatRow[]>;
1236
1380
  /** Legend swatches from 0 → 1 intensity. */
1237
1381
  protected readonly scaleStops: _angular_core.Signal<{
@@ -1240,6 +1384,17 @@ declare class MkHeatmap {
1240
1384
  swatches: string[];
1241
1385
  }>;
1242
1386
  protected readonly resolvedLabel: _angular_core.Signal<string>;
1387
+ /**
1388
+ * Resolve the accent and the tokens to sRGB through a hidden probe: the
1389
+ * probe's computed `color` is what the browser would paint, `var()`s and
1390
+ * `color-mix()` included. `null` when the environment cannot resolve them.
1391
+ */
1392
+ protected resolvePalette(): MkHeatmapPalette | null;
1393
+ /**
1394
+ * Re-resolve when the theme flips: `data-theme` / class changes on the root
1395
+ * element (MkThemeService and most hand-rolled toggles) and the OS scheme.
1396
+ */
1397
+ private watchTheme;
1243
1398
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<MkHeatmap, never>;
1244
1399
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<MkHeatmap, "mk-heatmap", never, { "xLabels": { "alias": "xLabels"; "required": false; "isSignal": true; }; "yLabels": { "alias": "yLabels"; "required": false; "isSignal": true; }; "data": { "alias": "data"; "required": false; "isSignal": true; }; "min": { "alias": "min"; "required": false; "isSignal": true; }; "max": { "alias": "max"; "required": false; "isSignal": true; }; "accent": { "alias": "accent"; "required": false; "isSignal": true; }; "showValues": { "alias": "showValues"; "required": false; "isSignal": true; }; "showScale": { "alias": "showScale"; "required": false; "isSignal": true; }; "format": { "alias": "format"; "required": false; "isSignal": true; }; "label": { "alias": "label"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
1245
1400
  }
@@ -2622,5 +2777,5 @@ declare function mkParseMarkdown(src: string, options?: MkMarkdownParseOptions):
2622
2777
  */
2623
2778
  declare function mkRenderMarkdown(blocks: MkMarkdownBlock[], options?: MkMarkdownRenderOptions): string;
2624
2779
 
2625
- export { MK_CHART_PALETTE_SIZE, MkAvatar, MkAvatarGroup, MkBadge, MkBarChart, MkCalendarHeatmap, MkCard, MkCardFooter, MkCardHeader, MkCardTitle, MkCarousel, MkCarouselSlide, MkCode, MkCountdown, MkDescItem, MkDescriptionList, MkDiff, MkDivider, MkDonutChart, MkEmptyState, MkFunnelChart, MkGauge, MkHeatmap, MkInlineEdit, MkJsonViewer, MkKanban, MkLineChart, MkList, MkListItem, MkLogViewer, MkMarkdown, MkProfileActions, MkProfileCard, MkProfileMeta, MkProgressBar, MkProgressRing, MkQrCode, MkRadarChart, MkScatterChart, MkSkeleton, MkSkeletonPreset, MkSparkline, MkSpinner, MkStatCard, MkTag, MkTimeline, MkTimelineItem, MkTreemap, MkVirtualScroll, mkArcPath, mkAreaPath, mkBuildJsonTree, mkChartColor, mkComputeDiff, mkDiffStats, mkEncodeQr, mkFormatCompact, mkLinePath, mkLinearScale, mkNiceTicks, mkParseAnsi, mkParseMarkdown, mkRenderMarkdown, mkSplitDuration, mkSquarify, mkStripAnsi };
2626
- export type { MkAnsiSpan, MkAvatarShape, MkAvatarStatus, MkBadgeVariant, MkBarOrientation, MkCalendarHeatmapCell, MkCalendarHeatmapEntry, MkCardPadding, MkCardVariant, MkChartSeries, MkChartSlice, MkDescriptionLayout, MkDiffMode, MkDiffOp, MkDiffOptions, MkDiffRow, MkDiffSegment, MkDiffStats, MkDividerOrientation, MkDurationParts, MkFunnelSegment, MkJsonNode, MkKanbanCard, MkKanbanCardMovedEvent, MkKanbanColumn, MkLogToken, MkMarkdownAlign, MkMarkdownBlock, MkMarkdownInline, MkMarkdownList, MkMarkdownListItem, MkMarkdownParseOptions, MkMarkdownRenderOptions, MkPoint, MkProfileCardOrientation, MkQrEcc, MkScatterPoint, MkScatterSeries, MkSkeletonPresetKind, MkSkeletonShape, MkSparklineType, MkStatTrend, MkTagVariant, MkTreemapItem, MkTreemapRect };
2780
+ export { MK_CHART_PALETTE_SIZE, MK_HEATMAP_MIN_CONTRAST, MkAvatar, MkAvatarGroup, MkBadge, MkBadgeOverlay, MkBarChart, MkCalendarHeatmap, MkCard, MkCardFooter, MkCardHeader, MkCardTitle, MkCarousel, MkCarouselSlide, MkCode, MkCountdown, MkDescItem, MkDescriptionList, MkDiff, MkDivider, MkDonutChart, MkEmptyState, MkFunnelChart, MkGauge, MkHeatmap, MkInlineEdit, MkJsonViewer, MkKanban, MkLineChart, MkList, MkListItem, MkLogViewer, MkMarkdown, MkProfileActions, MkProfileCard, MkProfileMeta, MkProgressBar, MkProgressRing, MkQrCode, MkRadarChart, MkScatterChart, MkSkeleton, MkSkeletonPreset, MkSparkline, MkSpinner, MkStatCard, MkTag, MkTimeline, MkTimelineItem, MkTreemap, MkVirtualScroll, mkArcPath, mkAreaPath, mkBuildJsonTree, mkChartColor, mkComputeDiff, mkContrastRatio, mkDiffStats, mkEncodeQr, mkFormatCompact, mkHeatmapCellColors, mkLinePath, mkLinearScale, mkMixRgb, mkNiceTicks, mkParseAnsi, mkParseMarkdown, mkParseRgb, mkRelativeLuminance, mkRenderMarkdown, mkSplitDuration, mkSquarify, mkStripAnsi };
2781
+ export type { MkAnsiSpan, MkAvatarShape, MkAvatarStatus, MkBadgeOverlayPosition, MkBadgeVariant, MkBarOrientation, MkCalendarHeatmapCell, MkCalendarHeatmapEntry, MkCardPadding, MkCardVariant, MkChartSeries, MkChartSlice, MkDescriptionLayout, MkDiffMode, MkDiffOp, MkDiffOptions, MkDiffRow, MkDiffSegment, MkDiffStats, MkDividerOrientation, MkDurationParts, MkFunnelSegment, MkHeatmapCellColors, MkHeatmapPalette, MkJsonNode, MkKanbanCard, MkKanbanCardMovedEvent, MkKanbanColumn, MkLogToken, MkMarkdownAlign, MkMarkdownBlock, MkMarkdownInline, MkMarkdownList, MkMarkdownListItem, MkMarkdownParseOptions, MkMarkdownRenderOptions, MkPoint, MkProfileCardOrientation, MkQrEcc, MkRgb, MkScatterPoint, MkScatterSeries, MkSkeletonPresetKind, MkSkeletonShape, MkSparklineType, MkStatTrend, MkTagVariant, MkTreemapItem, MkTreemapRect };
@@ -1,5 +1,5 @@
1
1
  import * as _angular_core from '@angular/core';
2
- import { Signal, TemplateRef } from '@angular/core';
2
+ import { Signal, TemplateRef, PipeTransform } from '@angular/core';
3
3
 
4
4
  /**
5
5
  * Emits when a pointer press lands outside the host element — the building block
@@ -803,5 +803,236 @@ declare class MkCanDisable {
803
803
  static ɵdir: _angular_core.ɵɵDirectiveDeclaration<MkCanDisable, "[mkCanDisable]", never, { "permission": { "alias": "mkCanDisable"; "required": true; "isSignal": true; }; }, {}, never, never, true, never>;
804
804
  }
805
805
 
806
- export { MK_FIELD_PRESETS, MkAutofocus, MkAutosize, MkCan, MkCanDisable, MkCannot, MkClickOutside, MkCopyToClipboard, MkField, MkHistoryService, MkHistoryStack, MkHotkey, MkHotkeysService, MkInfiniteScroll, MkIntersect, MkMask, MkPermissionPolicy, MkRipple, MkScrollspy, mkApplyMask, mkMaskCaret, mkMatchesHotkey, mkParseHotkey, mkPermissionGranted, registerHistoryHotkeys };
807
- export type { MkFieldKind, MkFieldPreset, MkHistoryEntry, MkHotkeyOptions, MkMaskResult, MkParsedHotkey };
806
+ /**
807
+ * Options accepted by {@link MkCurrencyPipe}. They map onto
808
+ * `Intl.NumberFormat` currency options; `locale` overrides the i18n /
809
+ * runtime locale for this call only.
810
+ */
811
+ interface MkCurrencyOptions {
812
+ /** BCP 47 locale for this call; defaults to `provideMkI18n({ locale })`, then the runtime locale. */
813
+ locale?: string;
814
+ /** How the currency is shown. Default `'symbol'` (`€`, `$`, `zł`). */
815
+ display?: 'symbol' | 'narrowSymbol' | 'code' | 'name';
816
+ /** Fraction digits; both default to the currency's own (2 for EUR, 0 for JPY). */
817
+ minimumFractionDigits?: number;
818
+ maximumFractionDigits?: number;
819
+ /** Sign display, e.g. `'always'` for `+€10.00` or `'exceptZero'`. */
820
+ signDisplay?: 'auto' | 'never' | 'always' | 'exceptZero';
821
+ /** Compact notation for dashboards (`$1.2M`). Default `'standard'`. */
822
+ notation?: 'standard' | 'compact';
823
+ /** Thousands grouping; default `true`. */
824
+ useGrouping?: boolean;
825
+ }
826
+ /**
827
+ * `mkCurrency` — format a number as money with `Intl.NumberFormat`, honouring
828
+ * the locale and default currency from `provideMkI18n({ locale, currency })`.
829
+ * No Angular locale data is needed. Pure: `null`, `undefined`, `''` and
830
+ * non-numeric input render as `''`.
831
+ *
832
+ * ```html
833
+ * {{ 1234.5 | mkCurrency }} <!-- $1,234.50 (i18n currency, default USD) -->
834
+ * {{ 1234.5 | mkCurrency:'EUR' }} <!-- €1,234.50 -->
835
+ * {{ 1234.5 | mkCurrency:'PLN':{ locale: 'pl-PL' } }} <!-- 1234,50 zł -->
836
+ * {{ 1234567 | mkCurrency:'USD':{ notation: 'compact' } }} <!-- $1.2M -->
837
+ * {{ total() | mkCurrency:'GBP':{ signDisplay: 'always' } }} <!-- signals work as-is -->
838
+ * ```
839
+ */
840
+ declare class MkCurrencyPipe implements PipeTransform {
841
+ private readonly i18n;
842
+ /**
843
+ * @param value Amount in major units (`12.5` → `$12.50`).
844
+ * @param currency ISO 4217 code; defaults to `provideMkI18n({ currency })`, then `'USD'`.
845
+ * @param options Locale and `Intl.NumberFormat` currency options.
846
+ */
847
+ transform(value: number | string | null | undefined, currency?: string | null, options?: MkCurrencyOptions): string;
848
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<MkCurrencyPipe, never>;
849
+ static ɵpipe: _angular_core.ɵɵPipeDeclaration<MkCurrencyPipe, "mkCurrency", true>;
850
+ }
851
+
852
+ /** Options accepted by {@link MkRelativeTimePipe}. */
853
+ interface MkRelativeTimeOptions {
854
+ /** BCP 47 locale for this call; defaults to `provideMkI18n({ locale })`, then the runtime locale. */
855
+ locale?: string;
856
+ /**
857
+ * `'auto'` (default) uses phrases like "yesterday" / "now" where the locale
858
+ * has them; `'always'` sticks to "1 day ago" / "in 0 seconds".
859
+ */
860
+ numeric?: 'always' | 'auto';
861
+ /** Length of the unit word: `'long'` (default, "minutes"), `'short'` ("min."), `'narrow'` ("m"). */
862
+ style?: 'long' | 'short' | 'narrow';
863
+ /**
864
+ * Largest unit to use. Default `'year'`; e.g. `'day'` keeps "45 days ago"
865
+ * instead of "1 month ago".
866
+ */
867
+ maxUnit?: Intl.RelativeTimeFormatUnit;
868
+ }
869
+ /**
870
+ * `mkRelativeTime` — "3 minutes ago" / "in 2 days" / "yesterday" from a
871
+ * `Date`, timestamp or ISO string, via `Intl.RelativeTimeFormat` in the
872
+ * `provideMkI18n` locale (no Angular locale data). Pure: `null`, `undefined`
873
+ * and unparsable input render as `''`.
874
+ *
875
+ * The pipe picks the largest unit whose magnitude is at least 1 (seconds →
876
+ * minutes → hours → days → weeks → months → years) and rounds. Pass `now`
877
+ * for deterministic output in tests, or bind a ticking signal to keep a
878
+ * list live — a pure pipe only re-runs when an argument changes:
879
+ *
880
+ * ```html
881
+ * {{ comment.createdAt | mkRelativeTime }} <!-- 3 minutes ago -->
882
+ * {{ due | mkRelativeTime:now() }} <!-- in 2 days (now() ticks) -->
883
+ * {{ due | mkRelativeTime:null:{ style: 'short' } }} <!-- in 2 days -->
884
+ * {{ ts | mkRelativeTime:null:{ locale: 'pl', numeric: 'always' } }} <!-- 3 minuty temu -->
885
+ * ```
886
+ */
887
+ declare class MkRelativeTimePipe implements PipeTransform {
888
+ private readonly i18n;
889
+ /**
890
+ * @param value The instant to describe.
891
+ * @param now Reference instant; defaults to `Date.now()` at call time.
892
+ * @param options Locale, numeric mode, style and unit cap.
893
+ */
894
+ transform(value: Date | number | string | null | undefined, now?: Date | number | string | null, options?: MkRelativeTimeOptions): string;
895
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<MkRelativeTimePipe, never>;
896
+ static ɵpipe: _angular_core.ɵɵPipeDeclaration<MkRelativeTimePipe, "mkRelativeTime", true>;
897
+ }
898
+
899
+ /** Options accepted by {@link MkFileSizePipe}. */
900
+ interface MkFileSizeOptions {
901
+ /** BCP 47 locale for the number part (decimal separator); defaults to the i18n / runtime locale. */
902
+ locale?: string;
903
+ /**
904
+ * `'decimal'` (default) divides by 1000 and labels `kB MB GB …` (what
905
+ * operating systems and file dialogs show); `'binary'` divides by 1024
906
+ * and labels `KiB MiB GiB …`.
907
+ */
908
+ base?: 'decimal' | 'binary';
909
+ /** Maximum fraction digits. Default `1`; bytes never get fractions. */
910
+ digits?: number;
911
+ }
912
+ /**
913
+ * `mkFileSize` — bytes → a human-readable size such as `1.2 MB`, with the
914
+ * number formatted by `Intl.NumberFormat` in the `provideMkI18n` locale.
915
+ * Pure: `null`, `undefined`, `''` and non-numeric input render as `''`.
916
+ *
917
+ * ```html
918
+ * {{ 1_234_567 | mkFileSize }} <!-- 1.2 MB -->
919
+ * {{ 1_234_567 | mkFileSize:{ base: 'binary' } }} <!-- 1.2 MiB -->
920
+ * {{ 1_234_567 | mkFileSize:{ digits: 2, locale: 'de' } }} <!-- 1,23 MB -->
921
+ * {{ 512 | mkFileSize }} <!-- 512 B -->
922
+ * ```
923
+ */
924
+ declare class MkFileSizePipe implements PipeTransform {
925
+ private readonly i18n;
926
+ transform(value: number | string | null | undefined, options?: MkFileSizeOptions): string;
927
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<MkFileSizePipe, never>;
928
+ static ɵpipe: _angular_core.ɵɵPipeDeclaration<MkFileSizePipe, "mkFileSize", true>;
929
+ }
930
+
931
+ /**
932
+ * `mkInitials` — "Ada Lovelace" → "AL", the same rule `mk-avatar` uses for
933
+ * its fallback: first letter of the first and last word, upper-cased. A
934
+ * single word yields its first `max` letters ("Ada" → "AD"); more than two
935
+ * words with `max` > 2 take one letter per word from the start ("Jean
936
+ * Luc Picard" with `max: 3` → "JLP"). Leading/trailing/duplicate whitespace
937
+ * is ignored, and grapheme-aware slicing keeps emoji and accents intact.
938
+ * Pure: `null`, `undefined` and blank input render as `''`.
939
+ *
940
+ * ```html
941
+ * {{ user.name | mkInitials }} <!-- Grace Hopper → GH -->
942
+ * {{ user.name | mkInitials:1 }} <!-- Grace Hopper → G -->
943
+ * {{ 'Jean Luc Picard' | mkInitials:3 }} <!-- JLP -->
944
+ * ```
945
+ */
946
+ declare class MkInitialsPipe implements PipeTransform {
947
+ /**
948
+ * @param value Full name.
949
+ * @param max Maximum number of letters; default `2`, minimum `1`.
950
+ */
951
+ transform(value: string | null | undefined, max?: number): string;
952
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<MkInitialsPipe, never>;
953
+ static ɵpipe: _angular_core.ɵɵPipeDeclaration<MkInitialsPipe, "mkInitials", true>;
954
+ }
955
+
956
+ /** Options accepted by {@link MkTruncatePipe}. */
957
+ interface MkTruncateOptions {
958
+ /** Suffix appended when text is cut. Default `'…'` (a single ellipsis character). */
959
+ ellipsis?: string;
960
+ /**
961
+ * Cut at the last whitespace before the limit instead of mid-word
962
+ * (falls back to a hard cut when the first word alone is longer).
963
+ * Default `false`.
964
+ */
965
+ wordBoundary?: boolean;
966
+ }
967
+ /**
968
+ * `mkTruncate` — shorten text to `length` characters and append an ellipsis.
969
+ * The ellipsis counts toward the limit, so the output never exceeds
970
+ * `length` characters; counting is grapheme-aware (emoji and accented
971
+ * letters are one character). Text that already fits is returned as-is.
972
+ * Pure: `null` and `undefined` render as `''`.
973
+ *
974
+ * ```html
975
+ * {{ post.body | mkTruncate:80 }} <!-- hard cut at 80 -->
976
+ * {{ post.body | mkTruncate:80:{ wordBoundary: true } }} <!-- cut at the last space -->
977
+ * {{ hash | mkTruncate:12:{ ellipsis: '...' } }}
978
+ * ```
979
+ */
980
+ declare class MkTruncatePipe implements PipeTransform {
981
+ /**
982
+ * @param value Text to shorten.
983
+ * @param length Maximum characters in the output, ellipsis included. Default `50`.
984
+ * @param options Ellipsis string and word-boundary mode.
985
+ */
986
+ transform(value: string | null | undefined, length?: number, options?: MkTruncateOptions): string;
987
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<MkTruncatePipe, never>;
988
+ static ɵpipe: _angular_core.ɵɵPipeDeclaration<MkTruncatePipe, "mkTruncate", true>;
989
+ }
990
+
991
+ /**
992
+ * Per-category word forms for {@link MkPluralizePipe}, keyed by the CLDR
993
+ * plural categories `Intl.PluralRules` returns. `other` is required; the
994
+ * pipe falls back to it for any category you leave out.
995
+ *
996
+ * ```ts
997
+ * const files: MkPluralForms = { one: 'plik', few: 'pliki', many: 'plików', other: 'pliku' };
998
+ * ```
999
+ */
1000
+ type MkPluralForms = {
1001
+ other: string;
1002
+ } & Partial<Record<Intl.LDMLPluralRule, string>>;
1003
+ /** Options accepted by {@link MkPluralizePipe}. */
1004
+ interface MkPluralizeOptions {
1005
+ /** BCP 47 locale for the plural rules and number; defaults to the i18n / runtime locale. */
1006
+ locale?: string;
1007
+ /** Prefix the formatted count (`"3 items"`); `false` gives just the word. Default `true`. */
1008
+ withCount?: boolean;
1009
+ }
1010
+ /**
1011
+ * `mkPluralize` — pick the right word for a count using the locale's plural
1012
+ * rules (`Intl.PluralRules`), optionally prefixed with the formatted count.
1013
+ * The English shorthand takes a singular and an optional plural (default
1014
+ * `singular + 's'`); other languages pass a {@link MkPluralForms} map.
1015
+ * Pure: `null`, `undefined`, `''` and non-numeric counts render as `''`.
1016
+ *
1017
+ * ```html
1018
+ * {{ count | mkPluralize:'item' }} <!-- 1 item / 3 items -->
1019
+ * {{ count | mkPluralize:'entry':'entries' }} <!-- 1 entry / 2 entries -->
1020
+ * {{ count | mkPluralize:'file':null:{ withCount: false } }} <!-- files -->
1021
+ * {{ n | mkPluralize:{ one: 'plik', few: 'pliki', many: 'plików', other: 'pliku' }:null:{ locale: 'pl' } }}
1022
+ * ```
1023
+ */
1024
+ declare class MkPluralizePipe implements PipeTransform {
1025
+ private readonly i18n;
1026
+ /**
1027
+ * @param value The count.
1028
+ * @param singular Singular word, or a full {@link MkPluralForms} map.
1029
+ * @param plural Plural word for the shorthand form; default `singular + 's'`. Ignored with a map.
1030
+ * @param options Locale and whether to prefix the count.
1031
+ */
1032
+ transform(value: number | string | null | undefined, singular: string | MkPluralForms, plural?: string | null, options?: MkPluralizeOptions): string;
1033
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<MkPluralizePipe, never>;
1034
+ static ɵpipe: _angular_core.ɵɵPipeDeclaration<MkPluralizePipe, "mkPluralize", true>;
1035
+ }
1036
+
1037
+ export { MK_FIELD_PRESETS, MkAutofocus, MkAutosize, MkCan, MkCanDisable, MkCannot, MkClickOutside, MkCopyToClipboard, MkCurrencyPipe, MkField, MkFileSizePipe, MkHistoryService, MkHistoryStack, MkHotkey, MkHotkeysService, MkInfiniteScroll, MkInitialsPipe, MkIntersect, MkMask, MkPermissionPolicy, MkPluralizePipe, MkRelativeTimePipe, MkRipple, MkScrollspy, MkTruncatePipe, mkApplyMask, mkMaskCaret, mkMatchesHotkey, mkParseHotkey, mkPermissionGranted, registerHistoryHotkeys };
1038
+ export type { MkCurrencyOptions, MkFieldKind, MkFieldPreset, MkFileSizeOptions, MkHistoryEntry, MkHotkeyOptions, MkMaskResult, MkParsedHotkey, MkPluralForms, MkPluralizeOptions, MkRelativeTimeOptions, MkTruncateOptions };