@kjun-ui/react 0.20.0 → 0.21.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 (114) hide show
  1. package/dist/index.cjs +3911 -1680
  2. package/dist/index.js +3591 -1360
  3. package/dist/styles.css +1410 -356
  4. package/dist/types/packages/react/src/app-navigation.d.cts +9 -4
  5. package/dist/types/packages/react/src/app-navigation.d.ts +9 -4
  6. package/dist/types/packages/react/src/card-actions-context.d.cts +2 -0
  7. package/dist/types/packages/react/src/card-actions-context.d.ts +2 -0
  8. package/dist/types/packages/react/src/card.d.cts +15 -5
  9. package/dist/types/packages/react/src/card.d.ts +15 -5
  10. package/dist/types/packages/react/src/chip.d.cts +4 -2
  11. package/dist/types/packages/react/src/chip.d.ts +4 -2
  12. package/dist/types/packages/react/src/color-picker-parts.d.cts +58 -0
  13. package/dist/types/packages/react/src/color-picker-parts.d.ts +58 -0
  14. package/dist/types/packages/react/src/color-picker.d.cts +51 -0
  15. package/dist/types/packages/react/src/color-picker.d.ts +51 -0
  16. package/dist/types/packages/react/src/data-state.d.cts +3 -3
  17. package/dist/types/packages/react/src/data-state.d.ts +3 -3
  18. package/dist/types/packages/react/src/display.d.cts +14 -5
  19. package/dist/types/packages/react/src/display.d.ts +14 -5
  20. package/dist/types/packages/react/src/fab.d.cts +16 -7
  21. package/dist/types/packages/react/src/fab.d.ts +16 -7
  22. package/dist/types/packages/react/src/index.d.cts +4 -0
  23. package/dist/types/packages/react/src/index.d.ts +4 -0
  24. package/dist/types/packages/react/src/kpi-hero.d.cts +53 -0
  25. package/dist/types/packages/react/src/kpi-hero.d.ts +53 -0
  26. package/dist/types/packages/react/src/kpi-row.d.cts +41 -0
  27. package/dist/types/packages/react/src/kpi-row.d.ts +41 -0
  28. package/dist/types/packages/react/src/kpi.d.cts +2 -72
  29. package/dist/types/packages/react/src/kpi.d.ts +2 -72
  30. package/dist/types/packages/react/src/list-context.d.cts +8 -0
  31. package/dist/types/packages/react/src/list-context.d.ts +8 -0
  32. package/dist/types/packages/react/src/list.d.cts +50 -8
  33. package/dist/types/packages/react/src/list.d.ts +50 -8
  34. package/dist/types/packages/react/src/modal.d.cts +5 -2
  35. package/dist/types/packages/react/src/modal.d.ts +5 -2
  36. package/dist/types/packages/react/src/navigation.d.cts +2 -1
  37. package/dist/types/packages/react/src/navigation.d.ts +2 -1
  38. package/dist/types/packages/react/src/number-display.d.cts +2 -0
  39. package/dist/types/packages/react/src/number-display.d.ts +2 -0
  40. package/dist/types/packages/react/src/reorder-controls.d.cts +43 -0
  41. package/dist/types/packages/react/src/reorder-controls.d.ts +43 -0
  42. package/dist/types/packages/react/src/skeletons.d.cts +2 -1
  43. package/dist/types/packages/react/src/skeletons.d.ts +2 -1
  44. package/dist/types/packages/react/src/split-pane.d.cts +30 -0
  45. package/dist/types/packages/react/src/split-pane.d.ts +30 -0
  46. package/dist/types/packages/react/src/stacked-bar.d.cts +22 -0
  47. package/dist/types/packages/react/src/stacked-bar.d.ts +22 -0
  48. package/dist/types/packages/react/src/table-grid.d.cts +1 -1
  49. package/dist/types/packages/react/src/table-grid.d.ts +1 -1
  50. package/dist/types/packages/react/src/zone-gauge.d.cts +28 -0
  51. package/dist/types/packages/react/src/zone-gauge.d.ts +28 -0
  52. package/dist/types/shared/package-runtime/alert-action-size.d.cts +1 -0
  53. package/dist/types/shared/package-runtime/alert-action-size.d.ts +1 -0
  54. package/dist/types/shared/package-runtime/bottom-bar.d.cts +15 -0
  55. package/dist/types/shared/package-runtime/bottom-bar.d.ts +15 -0
  56. package/dist/types/shared/package-runtime/bottom-navigation.d.cts +25 -0
  57. package/dist/types/shared/package-runtime/bottom-navigation.d.ts +25 -0
  58. package/dist/types/shared/package-runtime/card-layout.d.cts +34 -0
  59. package/dist/types/shared/package-runtime/card-layout.d.ts +34 -0
  60. package/dist/types/shared/package-runtime/chart-skeleton.d.cts +1 -1
  61. package/dist/types/shared/package-runtime/chart-skeleton.d.ts +1 -1
  62. package/dist/types/shared/package-runtime/chip-size.d.cts +4 -0
  63. package/dist/types/shared/package-runtime/chip-size.d.ts +4 -0
  64. package/dist/types/shared/package-runtime/color-picker-model.d.cts +51 -0
  65. package/dist/types/shared/package-runtime/color-picker-model.d.ts +51 -0
  66. package/dist/types/shared/package-runtime/color-picker.d.cts +92 -0
  67. package/dist/types/shared/package-runtime/color-picker.d.ts +92 -0
  68. package/dist/types/shared/package-runtime/color.d.cts +22 -0
  69. package/dist/types/shared/package-runtime/color.d.ts +22 -0
  70. package/dist/types/shared/package-runtime/distribution.d.cts +133 -0
  71. package/dist/types/shared/package-runtime/distribution.d.ts +133 -0
  72. package/dist/types/shared/package-runtime/empty-geometry.d.cts +19 -0
  73. package/dist/types/shared/package-runtime/empty-geometry.d.ts +19 -0
  74. package/dist/types/shared/package-runtime/kpi.d.cts +89 -0
  75. package/dist/types/shared/package-runtime/kpi.d.ts +89 -0
  76. package/dist/types/shared/package-runtime/layer-state.d.cts +2 -1
  77. package/dist/types/shared/package-runtime/layer-state.d.ts +2 -1
  78. package/dist/types/shared/package-runtime/list-leading.d.cts +38 -0
  79. package/dist/types/shared/package-runtime/list-leading.d.ts +38 -0
  80. package/dist/types/shared/package-runtime/list-row.d.cts +115 -4
  81. package/dist/types/shared/package-runtime/list-row.d.ts +115 -4
  82. package/dist/types/shared/package-runtime/market-layout.d.cts +3 -1
  83. package/dist/types/shared/package-runtime/market-layout.d.ts +3 -1
  84. package/dist/types/shared/package-runtime/market-query.d.cts +15 -0
  85. package/dist/types/shared/package-runtime/market-query.d.ts +15 -0
  86. package/dist/types/shared/package-runtime/messages/ko.d.cts +27 -0
  87. package/dist/types/shared/package-runtime/messages/ko.d.ts +27 -0
  88. package/dist/types/shared/package-runtime/messages-context.d.cts +27 -0
  89. package/dist/types/shared/package-runtime/messages-context.d.ts +27 -0
  90. package/dist/types/shared/package-runtime/number-sign.d.cts +9 -0
  91. package/dist/types/shared/package-runtime/number-sign.d.ts +9 -0
  92. package/dist/types/shared/package-runtime/popover-scroll.d.cts +3 -0
  93. package/dist/types/shared/package-runtime/popover-scroll.d.ts +3 -0
  94. package/dist/types/shared/package-runtime/radio-keyboard.d.cts +2 -0
  95. package/dist/types/shared/package-runtime/radio-keyboard.d.ts +2 -0
  96. package/dist/types/shared/package-runtime/reorder-session.d.cts +62 -0
  97. package/dist/types/shared/package-runtime/reorder-session.d.ts +62 -0
  98. package/dist/types/shared/package-runtime/reorder.d.cts +81 -0
  99. package/dist/types/shared/package-runtime/reorder.d.ts +81 -0
  100. package/dist/types/shared/package-runtime/skeleton-text.d.cts +14 -0
  101. package/dist/types/shared/package-runtime/skeleton-text.d.ts +14 -0
  102. package/dist/types/shared/package-runtime/split-pane.d.cts +46 -0
  103. package/dist/types/shared/package-runtime/split-pane.d.ts +46 -0
  104. package/dist/types/shared/package-runtime/table-columns.d.cts +28 -0
  105. package/dist/types/shared/package-runtime/table-columns.d.ts +28 -0
  106. package/dist/types/shared/package-runtime/table-presentation.d.cts +22 -2
  107. package/dist/types/shared/package-runtime/table-presentation.d.ts +22 -2
  108. package/dist/types/shared/package-runtime/table.d.cts +29 -0
  109. package/dist/types/shared/package-runtime/table.d.ts +29 -0
  110. package/dist/types/shared/package-runtime/use-color-picker.d.cts +51 -0
  111. package/dist/types/shared/package-runtime/use-color-picker.d.ts +51 -0
  112. package/dist/types/shared/package-runtime/use-layer.d.cts +4 -2
  113. package/dist/types/shared/package-runtime/use-layer.d.ts +4 -2
  114. package/package.json +3 -3
@@ -0,0 +1,51 @@
1
+ import { type ColorSwatchInput } from "./color-picker.js";
2
+ /** One pick that may span many changes (a drag, typing in a field). begin remembers the value once; end says whether it moved. */
3
+ export declare function createCommitSession(read: () => string | null): {
4
+ begin(): void;
5
+ end(): boolean;
6
+ };
7
+ /** #RRGGBB of a value. */
8
+ export declare const colorRgb: (value: string) => string;
9
+ /** The AA of a value, FF when it has none. */
10
+ export declare const colorAlphaHex: (value: string | null) => string;
11
+ /** 0–100 opacity as two hex digits. */
12
+ export declare const alphaPercentHex: (percent: number) => string;
13
+ /** What the hex field shows: six digits without #. */
14
+ export declare const hexFieldText: (value: string | null) => string;
15
+ /** What the hex field keeps of typed or pasted text: no #, and at most the 6 digits (8 with alpha) a code holds.
16
+ * The fields' maxLength leaves room for a pasted #, so the extra digit is cut here. */
17
+ export declare const hexFieldClean: (text: string, alpha: boolean) => string;
18
+ /** A change while typing in the hex field: only a complete code (6 digits, or 8 with alpha); 6 digits keep the current opacity. */
19
+ export declare function hexFieldLive(text: string, alpha: boolean, value: string | null): string | null;
20
+ /** Enter or leaving the hex field: the value to keep, or "revert". A short code expands; empty is null only when clearable. */
21
+ export declare function hexFieldCommit(text: string, alpha: boolean, value: string | null, clearable: boolean): string | null | "revert";
22
+ /** A change while typing in the % field: a whole 0–100 on a color. */
23
+ export declare const alphaFieldLive: (text: string, value: string | null) => string | null;
24
+ /** Recent colors fill one swatch row. */
25
+ export declare const recentColorLimit = 8;
26
+ /** The recent row: invalid entries, repeats and colors the swatches already offer left out, at most one row.
27
+ * Only the row hides them; the app's list keeps every color. */
28
+ export declare const recentColorItems: (list: ColorSwatchInput[] | undefined, alpha: boolean, swatches?: {
29
+ value: string;
30
+ }[]) => {
31
+ value: string;
32
+ label: string;
33
+ }[];
34
+ /** The list after the panel closes on a new value: that value first, once, at most one row; null if nothing changes. */
35
+ export declare function nextRecentColors(list: ColorSwatchInput[] | undefined, value: string | null, alpha: boolean): string[] | null;
36
+ /** The browser's EyeDropper (Chromium desktop). Elsewhere the picker draws no eyedropper button. */
37
+ export declare const eyeDropperSupported: () => boolean;
38
+ /** Opens the screen eyedropper; resolves the color as #RRGGBB (the current opacity kept with alpha), or null when cancelled. */
39
+ export declare function pickScreenColor(alpha: boolean, value: string | null): Promise<string | null>;
40
+ /** Screen reader actions of the area: swipe up/down moves saturation; named actions move brightness (Native devices have no arrow keys). */
41
+ export declare function colorAreaActions(m: {
42
+ increaseSaturation: string;
43
+ decreaseSaturation: string;
44
+ increaseBrightness: string;
45
+ decreaseBrightness: string;
46
+ }): {
47
+ name: string;
48
+ label: string;
49
+ }[];
50
+ /** The key an area action stands for, so it moves exactly like the keyboard. */
51
+ export declare const colorAreaActionKey: (name: string) => string | null;
@@ -0,0 +1,92 @@
1
+ import { type Hsv } from "./color.cjs";
2
+ export type PickerState = {
3
+ hsv: Hsv;
4
+ a: number;
5
+ };
6
+ export declare const initialPickerState: PickerState;
7
+ /** Swatches take this many fixed columns (web CSS repeat(8); Native divides the measured width). */
8
+ export declare const colorSwatchColumns = 8;
9
+ /** A thumb never leaves its track: at fraction p its center sits p of the way from half a thumb in to half a thumb before the end.
10
+ * Placed at left p × 100%, the thumb moves back by p of its own size (a CSS translate of -p × 100%, a Native margin). */
11
+ export declare const thumbOffset: (p: number, thumb: number) => number;
12
+ /** The fraction a pointer at `at` picks on a track starting at `start`, `length` long, whose ends lie half a thumb in. */
13
+ export declare function trackFraction(at: number, start: number, length: number, thumb: number): number;
14
+ /** A touch screen: the web panel then follows the trigger width (up to touchMaxWidth) so swatches and tracks grow under a finger. */
15
+ export declare const coarsePointer: () => boolean;
16
+ /** Square swatch size for a row of `width` with `gap` between the fixed columns. */
17
+ export declare const colorSwatchSize: (width: number, gap: number) => number;
18
+ export declare function warnColorPicker(message: string): void;
19
+ export declare function stateToValue(s: PickerState, alpha: boolean): string;
20
+ /** Follows an outside value without losing hue or saturation: a value that the current HSV already draws keeps it, and null keeps the last state. */
21
+ export declare function syncHsv(prev: PickerState, value: string | null, alpha: boolean): PickerState;
22
+ /** Arrows move saturation (left/right) and brightness (up/down) 1%, 10% with Shift; Home/End set saturation, PageUp/PageDown brightness. */
23
+ export declare function colorAreaKey(key: string, shift: boolean, hsv: Hsv): Hsv | null;
24
+ /** One step of a hue (0–360) or alpha (0–100) slider. */
25
+ export declare function channelKey(key: string, shift: boolean, value: number, max: number): number | null;
26
+ /** With alpha on, a 3- or 6-digit code keeps the current opacity (AA) instead of resetting it to 100%. Other text passes through. */
27
+ export declare function hexWithAlpha(text: string, alpha: boolean, currentAlpha: string): string;
28
+ /** The hex field: live only once all 6 (or 8 with alpha) digits are typed, so "3B8" never jumps to #33BB88 mid-typing; commit expands short forms. */
29
+ export declare function hexDraft(text: string, alpha: boolean): {
30
+ live: string | null;
31
+ commit: string | null | "revert";
32
+ };
33
+ export type ColorSwatchInput = string | {
34
+ value: string;
35
+ label?: string;
36
+ };
37
+ /** How many swatches are not hex colors; the picker warns once about them (normalizing runs on every render and stays quiet). */
38
+ export declare function invalidSwatchCount(list: unknown[]): number;
39
+ export declare function normalizeSwatches(list: unknown[], alpha: boolean): {
40
+ value: string;
41
+ label: string;
42
+ }[];
43
+ export declare function initialFocus(o: {
44
+ selectedSwatch: boolean;
45
+ custom: boolean;
46
+ input: boolean;
47
+ }): "swatch" | "area" | "hex" | "first-swatch";
48
+ /** The control the panel focuses when it opens, from the elements each platform registered. */
49
+ export declare function initialFocusTarget<T>(targets: {
50
+ swatches: (T | null)[];
51
+ area: T | null;
52
+ hex: T | null;
53
+ }, o: {
54
+ selected: number;
55
+ custom: boolean;
56
+ input: boolean;
57
+ }): T | null;
58
+ /** The swatch row's items: "no color" first when clearable. */
59
+ export declare const swatchItems: (swatches: {
60
+ value: string;
61
+ label: string;
62
+ }[], clearable: boolean, noneLabel: string) => {
63
+ value: string | null;
64
+ label: string;
65
+ }[];
66
+ /** Which item of swatchItems the value selects, or -1. */
67
+ export declare function selectedSwatchIndex(value: string | null, swatches: {
68
+ value: string;
69
+ }[], clearable: boolean): number;
70
+ /** The name the app gave the value in one of the lists (swatches, recent colors); a label that only repeats the code is no name. */
71
+ export declare function colorName(value: string | null, lists: {
72
+ value: string;
73
+ label: string;
74
+ }[][]): string | undefined;
75
+ /** What the trigger shows and says: the swatch name when it has one, #RRGGBB, the opacity % with alpha, and the spoken value. */
76
+ export declare function pickerSummary(value: string | null, alpha: boolean, m: {
77
+ colorValue: (hex: string, alpha?: number) => string;
78
+ colorNone: string;
79
+ }, name?: string): {
80
+ hex: string;
81
+ percent: number | undefined;
82
+ opacity: number;
83
+ name: string | undefined;
84
+ spoken: string;
85
+ };
86
+ /** Development warnings, each said once per picker. */
87
+ export declare function createPickerWarnings(): (o: {
88
+ raw: unknown;
89
+ alpha: boolean;
90
+ swatches: unknown[] | undefined;
91
+ nothing: boolean;
92
+ }) => void;
@@ -0,0 +1,92 @@
1
+ import { type Hsv } from "./color.js";
2
+ export type PickerState = {
3
+ hsv: Hsv;
4
+ a: number;
5
+ };
6
+ export declare const initialPickerState: PickerState;
7
+ /** Swatches take this many fixed columns (web CSS repeat(8); Native divides the measured width). */
8
+ export declare const colorSwatchColumns = 8;
9
+ /** A thumb never leaves its track: at fraction p its center sits p of the way from half a thumb in to half a thumb before the end.
10
+ * Placed at left p × 100%, the thumb moves back by p of its own size (a CSS translate of -p × 100%, a Native margin). */
11
+ export declare const thumbOffset: (p: number, thumb: number) => number;
12
+ /** The fraction a pointer at `at` picks on a track starting at `start`, `length` long, whose ends lie half a thumb in. */
13
+ export declare function trackFraction(at: number, start: number, length: number, thumb: number): number;
14
+ /** A touch screen: the web panel then follows the trigger width (up to touchMaxWidth) so swatches and tracks grow under a finger. */
15
+ export declare const coarsePointer: () => boolean;
16
+ /** Square swatch size for a row of `width` with `gap` between the fixed columns. */
17
+ export declare const colorSwatchSize: (width: number, gap: number) => number;
18
+ export declare function warnColorPicker(message: string): void;
19
+ export declare function stateToValue(s: PickerState, alpha: boolean): string;
20
+ /** Follows an outside value without losing hue or saturation: a value that the current HSV already draws keeps it, and null keeps the last state. */
21
+ export declare function syncHsv(prev: PickerState, value: string | null, alpha: boolean): PickerState;
22
+ /** Arrows move saturation (left/right) and brightness (up/down) 1%, 10% with Shift; Home/End set saturation, PageUp/PageDown brightness. */
23
+ export declare function colorAreaKey(key: string, shift: boolean, hsv: Hsv): Hsv | null;
24
+ /** One step of a hue (0–360) or alpha (0–100) slider. */
25
+ export declare function channelKey(key: string, shift: boolean, value: number, max: number): number | null;
26
+ /** With alpha on, a 3- or 6-digit code keeps the current opacity (AA) instead of resetting it to 100%. Other text passes through. */
27
+ export declare function hexWithAlpha(text: string, alpha: boolean, currentAlpha: string): string;
28
+ /** The hex field: live only once all 6 (or 8 with alpha) digits are typed, so "3B8" never jumps to #33BB88 mid-typing; commit expands short forms. */
29
+ export declare function hexDraft(text: string, alpha: boolean): {
30
+ live: string | null;
31
+ commit: string | null | "revert";
32
+ };
33
+ export type ColorSwatchInput = string | {
34
+ value: string;
35
+ label?: string;
36
+ };
37
+ /** How many swatches are not hex colors; the picker warns once about them (normalizing runs on every render and stays quiet). */
38
+ export declare function invalidSwatchCount(list: unknown[]): number;
39
+ export declare function normalizeSwatches(list: unknown[], alpha: boolean): {
40
+ value: string;
41
+ label: string;
42
+ }[];
43
+ export declare function initialFocus(o: {
44
+ selectedSwatch: boolean;
45
+ custom: boolean;
46
+ input: boolean;
47
+ }): "swatch" | "area" | "hex" | "first-swatch";
48
+ /** The control the panel focuses when it opens, from the elements each platform registered. */
49
+ export declare function initialFocusTarget<T>(targets: {
50
+ swatches: (T | null)[];
51
+ area: T | null;
52
+ hex: T | null;
53
+ }, o: {
54
+ selected: number;
55
+ custom: boolean;
56
+ input: boolean;
57
+ }): T | null;
58
+ /** The swatch row's items: "no color" first when clearable. */
59
+ export declare const swatchItems: (swatches: {
60
+ value: string;
61
+ label: string;
62
+ }[], clearable: boolean, noneLabel: string) => {
63
+ value: string | null;
64
+ label: string;
65
+ }[];
66
+ /** Which item of swatchItems the value selects, or -1. */
67
+ export declare function selectedSwatchIndex(value: string | null, swatches: {
68
+ value: string;
69
+ }[], clearable: boolean): number;
70
+ /** The name the app gave the value in one of the lists (swatches, recent colors); a label that only repeats the code is no name. */
71
+ export declare function colorName(value: string | null, lists: {
72
+ value: string;
73
+ label: string;
74
+ }[][]): string | undefined;
75
+ /** What the trigger shows and says: the swatch name when it has one, #RRGGBB, the opacity % with alpha, and the spoken value. */
76
+ export declare function pickerSummary(value: string | null, alpha: boolean, m: {
77
+ colorValue: (hex: string, alpha?: number) => string;
78
+ colorNone: string;
79
+ }, name?: string): {
80
+ hex: string;
81
+ percent: number | undefined;
82
+ opacity: number;
83
+ name: string | undefined;
84
+ spoken: string;
85
+ };
86
+ /** Development warnings, each said once per picker. */
87
+ export declare function createPickerWarnings(): (o: {
88
+ raw: unknown;
89
+ alpha: boolean;
90
+ swatches: unknown[] | undefined;
91
+ nothing: boolean;
92
+ }) => void;
@@ -0,0 +1,22 @@
1
+ export type Rgba = {
2
+ r: number;
3
+ g: number;
4
+ b: number;
5
+ a: number;
6
+ };
7
+ export type Hsv = {
8
+ h: number;
9
+ s: number;
10
+ v: number;
11
+ };
12
+ /** Reads #RGB, #RGBA, #RRGGBB or #RRGGBBAA, with or without #, in any case. */
13
+ export declare function parseColor(text: string): Rgba | null;
14
+ /** Uppercase #RRGGBB, or #RRGGBBAA when alpha is on. */
15
+ export declare function formatColor(c: Rgba, alpha: boolean): string;
16
+ /** The picker's value form of anything, or null for an invalid or empty value. */
17
+ export declare function normalizeColor(value: unknown, alpha: boolean): string | null;
18
+ export declare function sameColor(a: string | null, b: string | null, alpha: boolean): boolean;
19
+ export declare function rgbToHsv({ r, g, b }: Rgba): Hsv;
20
+ export declare function hsvToRgb({ h, s, v }: Hsv, a?: number): Rgba;
21
+ /** Which ink reads on a color: dark on light colors, light on dark ones (WCAG relative luminance). Mostly transparent colors take dark ink over the light checkerboard. */
22
+ export declare function readableInk(value: string): "light" | "dark";
@@ -0,0 +1,22 @@
1
+ export type Rgba = {
2
+ r: number;
3
+ g: number;
4
+ b: number;
5
+ a: number;
6
+ };
7
+ export type Hsv = {
8
+ h: number;
9
+ s: number;
10
+ v: number;
11
+ };
12
+ /** Reads #RGB, #RGBA, #RRGGBB or #RRGGBBAA, with or without #, in any case. */
13
+ export declare function parseColor(text: string): Rgba | null;
14
+ /** Uppercase #RRGGBB, or #RRGGBBAA when alpha is on. */
15
+ export declare function formatColor(c: Rgba, alpha: boolean): string;
16
+ /** The picker's value form of anything, or null for an invalid or empty value. */
17
+ export declare function normalizeColor(value: unknown, alpha: boolean): string | null;
18
+ export declare function sameColor(a: string | null, b: string | null, alpha: boolean): boolean;
19
+ export declare function rgbToHsv({ r, g, b }: Rgba): Hsv;
20
+ export declare function hsvToRgb({ h, s, v }: Hsv, a?: number): Rgba;
21
+ /** Which ink reads on a color: dark on light colors, light on dark ones (WCAG relative luminance). Mostly transparent colors take dark ink over the light checkerboard. */
22
+ export declare function readableInk(value: string): "light" | "dark";
@@ -0,0 +1,133 @@
1
+ export interface GaugeZone {
2
+ /** Where the zone ends on the axis; it starts where the previous zone ended (or at min). */
3
+ to: number;
4
+ label?: string;
5
+ /** The app's colour for this zone; without one the zone takes the neutral track colour. */
6
+ color?: string;
7
+ }
8
+ export interface GaugeSegment {
9
+ from: number;
10
+ to: number;
11
+ share: number;
12
+ label?: string;
13
+ color?: string;
14
+ }
15
+ export interface StackedItem {
16
+ key?: string;
17
+ label: string;
18
+ /** null, undefined and non-finite numbers are missing; negative numbers count as zero. */
19
+ value: number | null | undefined;
20
+ /** The app's colour for this part; without one it takes the neutral track colour. */
21
+ color?: string;
22
+ }
23
+ export interface StackedLegendEntry {
24
+ label: string;
25
+ value: string;
26
+ percent: string;
27
+ present: boolean;
28
+ drawn: boolean;
29
+ }
30
+ export type StackedState = "missing" | "empty" | "ready";
31
+ /** Locale grouping with up to two decimals; never prints -0. Formatters are cached per locale. */
32
+ export declare function distributionNumber(value: number, locale?: string): string;
33
+ /** The marker's place as a percentage of the axis; values past an end stay on that end. */
34
+ export declare function gaugePosition(value: number, min: number, max: number): number;
35
+ /**
36
+ * Zones as drawn: ordered by their end, clipped to the axis, each sized by its span. A zone that ends at or before the
37
+ * previous one is dropped, and an axis the zones do not reach ends in an unnamed neutral segment.
38
+ */
39
+ export declare function gaugeSegments(zones: readonly GaugeZone[], min: number, max: number): GaugeSegment[];
40
+ /** The segment a value falls in: a boundary belongs to the upper zone, and values past an end to the nearest. */
41
+ export declare function gaugeZoneIndex(value: number, segments: readonly GaugeSegment[]): number;
42
+ export interface GaugeBoundary {
43
+ /** The share of the axis (0–1) before the boundary. */
44
+ cut: number;
45
+ /** How many gaps come before the boundary's own. */
46
+ gaps: number;
47
+ }
48
+ /** The zone boundaries on each side of a marker at `position` (0–100): the last at or before it and the first after it. */
49
+ export declare function gaugeNeighbours(position: number, segments: readonly GaugeSegment[]): {
50
+ before?: GaugeBoundary;
51
+ after?: GaugeBoundary;
52
+ };
53
+ export interface GaugeGeometry {
54
+ segmentGap: number;
55
+ markerWidth: number;
56
+ markerRing: number;
57
+ minSliver: number;
58
+ }
59
+ /**
60
+ * The sliver of a zone left between a boundary and the marker's ring, in the axis's own length units: where it starts
61
+ * and how long it is. null unless it is thinner than the minimum, which is when it is covered.
62
+ */
63
+ export declare function gaugeSliver(width: number, position: number, count: number, boundary: GaugeBoundary | undefined, side: "before" | "after", geometry: GaugeGeometry): {
64
+ start: number;
65
+ size: number;
66
+ } | null;
67
+ export declare function gaugeSpoken(label: string | undefined, valueText: string, zoneLabel?: string): string;
68
+ /** missing: nothing to show; empty: real values that add up to nothing; ready: at least one part to draw. */
69
+ export declare function stackedState(items: readonly StackedItem[] | null | undefined): StackedState;
70
+ /**
71
+ * Each item's exact percentage of the whole (0 for a part that is not drawn): the segment lengths. Amounts are scaled
72
+ * by the largest first, so counts too large to add up still share out, and fractions fill the whole bar.
73
+ */
74
+ export declare function stackedWeights(items: readonly StackedItem[]): number[];
75
+ /**
76
+ * Whole percents that add up to 100 (or are all 0 for an empty total). The leftover points go by largest remainder to
77
+ * the parts that already reach 1%: a part under 1% stays at 0 and reads "<1%", so equal small parts never read differently.
78
+ */
79
+ export declare function stackedShares(items: readonly StackedItem[]): number[];
80
+ /** One entry per item, in order: the legend's text, and whether the bar draws a segment for it. A drawn part never reads as 0%. */
81
+ export declare function stackedLegend(items: readonly StackedItem[], formatValue: ((value: number) => string) | undefined, locale: string | undefined, missingText: string): StackedLegendEntry[];
82
+ export declare function stackedSpoken(label: string | undefined, legend: readonly StackedLegendEntry[]): string;
83
+ export interface GaugeInput {
84
+ value: number | null | undefined;
85
+ min: number;
86
+ max: number;
87
+ zones: readonly GaugeZone[];
88
+ label?: string;
89
+ ariaLabel?: string;
90
+ formatValue?: (value: number) => string;
91
+ missingText?: string;
92
+ /** The sentence read for a missing value when there is no missingText. */
93
+ noData: string;
94
+ locale?: string;
95
+ }
96
+ /** Everything a gauge draws and says, worked out once for React, Vue and Native. */
97
+ export declare function gaugeModel(input: GaugeInput): {
98
+ segments: GaugeSegment[];
99
+ ready: boolean;
100
+ zone: GaugeSegment | undefined;
101
+ position: number;
102
+ /** The caption's end: the value and the zone it falls in. */
103
+ caption: string;
104
+ /** The zone boundaries beside the marker, for the sliver covers; none without a value. */
105
+ near: ReturnType<typeof gaugeNeighbours>;
106
+ /** One image for screen readers: the name, the value and the zone it falls in. */
107
+ spoken: string;
108
+ };
109
+ export interface StackedInput {
110
+ items: readonly StackedItem[] | null | undefined;
111
+ label?: string;
112
+ ariaLabel?: string;
113
+ formatValue?: (value: number) => string;
114
+ missingText?: string;
115
+ noData: string;
116
+ locale?: string;
117
+ }
118
+ /** Everything a stacked bar draws and says, worked out once for React, Vue and Native. */
119
+ export declare function stackedModel(input: StackedInput): {
120
+ state: StackedState;
121
+ missing: boolean;
122
+ mark: string;
123
+ /** One per item, in order: its key, its length on the bar (when drawn) and its legend line. */
124
+ parts: {
125
+ item: StackedItem;
126
+ key: string;
127
+ weight: number;
128
+ drawn: boolean;
129
+ text: string;
130
+ }[];
131
+ /** One image for screen readers: the name, then each part with its value and share. */
132
+ spoken: string;
133
+ };
@@ -0,0 +1,133 @@
1
+ export interface GaugeZone {
2
+ /** Where the zone ends on the axis; it starts where the previous zone ended (or at min). */
3
+ to: number;
4
+ label?: string;
5
+ /** The app's colour for this zone; without one the zone takes the neutral track colour. */
6
+ color?: string;
7
+ }
8
+ export interface GaugeSegment {
9
+ from: number;
10
+ to: number;
11
+ share: number;
12
+ label?: string;
13
+ color?: string;
14
+ }
15
+ export interface StackedItem {
16
+ key?: string;
17
+ label: string;
18
+ /** null, undefined and non-finite numbers are missing; negative numbers count as zero. */
19
+ value: number | null | undefined;
20
+ /** The app's colour for this part; without one it takes the neutral track colour. */
21
+ color?: string;
22
+ }
23
+ export interface StackedLegendEntry {
24
+ label: string;
25
+ value: string;
26
+ percent: string;
27
+ present: boolean;
28
+ drawn: boolean;
29
+ }
30
+ export type StackedState = "missing" | "empty" | "ready";
31
+ /** Locale grouping with up to two decimals; never prints -0. Formatters are cached per locale. */
32
+ export declare function distributionNumber(value: number, locale?: string): string;
33
+ /** The marker's place as a percentage of the axis; values past an end stay on that end. */
34
+ export declare function gaugePosition(value: number, min: number, max: number): number;
35
+ /**
36
+ * Zones as drawn: ordered by their end, clipped to the axis, each sized by its span. A zone that ends at or before the
37
+ * previous one is dropped, and an axis the zones do not reach ends in an unnamed neutral segment.
38
+ */
39
+ export declare function gaugeSegments(zones: readonly GaugeZone[], min: number, max: number): GaugeSegment[];
40
+ /** The segment a value falls in: a boundary belongs to the upper zone, and values past an end to the nearest. */
41
+ export declare function gaugeZoneIndex(value: number, segments: readonly GaugeSegment[]): number;
42
+ export interface GaugeBoundary {
43
+ /** The share of the axis (0–1) before the boundary. */
44
+ cut: number;
45
+ /** How many gaps come before the boundary's own. */
46
+ gaps: number;
47
+ }
48
+ /** The zone boundaries on each side of a marker at `position` (0–100): the last at or before it and the first after it. */
49
+ export declare function gaugeNeighbours(position: number, segments: readonly GaugeSegment[]): {
50
+ before?: GaugeBoundary;
51
+ after?: GaugeBoundary;
52
+ };
53
+ export interface GaugeGeometry {
54
+ segmentGap: number;
55
+ markerWidth: number;
56
+ markerRing: number;
57
+ minSliver: number;
58
+ }
59
+ /**
60
+ * The sliver of a zone left between a boundary and the marker's ring, in the axis's own length units: where it starts
61
+ * and how long it is. null unless it is thinner than the minimum, which is when it is covered.
62
+ */
63
+ export declare function gaugeSliver(width: number, position: number, count: number, boundary: GaugeBoundary | undefined, side: "before" | "after", geometry: GaugeGeometry): {
64
+ start: number;
65
+ size: number;
66
+ } | null;
67
+ export declare function gaugeSpoken(label: string | undefined, valueText: string, zoneLabel?: string): string;
68
+ /** missing: nothing to show; empty: real values that add up to nothing; ready: at least one part to draw. */
69
+ export declare function stackedState(items: readonly StackedItem[] | null | undefined): StackedState;
70
+ /**
71
+ * Each item's exact percentage of the whole (0 for a part that is not drawn): the segment lengths. Amounts are scaled
72
+ * by the largest first, so counts too large to add up still share out, and fractions fill the whole bar.
73
+ */
74
+ export declare function stackedWeights(items: readonly StackedItem[]): number[];
75
+ /**
76
+ * Whole percents that add up to 100 (or are all 0 for an empty total). The leftover points go by largest remainder to
77
+ * the parts that already reach 1%: a part under 1% stays at 0 and reads "<1%", so equal small parts never read differently.
78
+ */
79
+ export declare function stackedShares(items: readonly StackedItem[]): number[];
80
+ /** One entry per item, in order: the legend's text, and whether the bar draws a segment for it. A drawn part never reads as 0%. */
81
+ export declare function stackedLegend(items: readonly StackedItem[], formatValue: ((value: number) => string) | undefined, locale: string | undefined, missingText: string): StackedLegendEntry[];
82
+ export declare function stackedSpoken(label: string | undefined, legend: readonly StackedLegendEntry[]): string;
83
+ export interface GaugeInput {
84
+ value: number | null | undefined;
85
+ min: number;
86
+ max: number;
87
+ zones: readonly GaugeZone[];
88
+ label?: string;
89
+ ariaLabel?: string;
90
+ formatValue?: (value: number) => string;
91
+ missingText?: string;
92
+ /** The sentence read for a missing value when there is no missingText. */
93
+ noData: string;
94
+ locale?: string;
95
+ }
96
+ /** Everything a gauge draws and says, worked out once for React, Vue and Native. */
97
+ export declare function gaugeModel(input: GaugeInput): {
98
+ segments: GaugeSegment[];
99
+ ready: boolean;
100
+ zone: GaugeSegment | undefined;
101
+ position: number;
102
+ /** The caption's end: the value and the zone it falls in. */
103
+ caption: string;
104
+ /** The zone boundaries beside the marker, for the sliver covers; none without a value. */
105
+ near: ReturnType<typeof gaugeNeighbours>;
106
+ /** One image for screen readers: the name, the value and the zone it falls in. */
107
+ spoken: string;
108
+ };
109
+ export interface StackedInput {
110
+ items: readonly StackedItem[] | null | undefined;
111
+ label?: string;
112
+ ariaLabel?: string;
113
+ formatValue?: (value: number) => string;
114
+ missingText?: string;
115
+ noData: string;
116
+ locale?: string;
117
+ }
118
+ /** Everything a stacked bar draws and says, worked out once for React, Vue and Native. */
119
+ export declare function stackedModel(input: StackedInput): {
120
+ state: StackedState;
121
+ missing: boolean;
122
+ mark: string;
123
+ /** One per item, in order: its key, its length on the bar (when drawn) and its legend line. */
124
+ parts: {
125
+ item: StackedItem;
126
+ key: string;
127
+ weight: number;
128
+ drawn: boolean;
129
+ text: string;
130
+ }[];
131
+ /** One image for screen readers: the name, then each part with its value and share. */
132
+ spoken: string;
133
+ };
@@ -0,0 +1,19 @@
1
+ export type EmptySize = "sm" | "md";
2
+ /** KjunEmpty's per-size geometry. The icon stroke is in the 24-unit viewBox, so every size paints iconStroke px. */
3
+ export declare function emptyGeometry(size: EmptySize): {
4
+ iconSize: 24 | 32;
5
+ iconStroke: number;
6
+ iconGap: 16 | 12;
7
+ titleSize: 16 | 14;
8
+ titleLineHeight: 20 | 24;
9
+ paddingY: 24 | 32;
10
+ actionGap: 20 | 16;
11
+ };
12
+ /**
13
+ * Vertical padding, by who owns the space: a list section keeps the empty note one row tall,
14
+ * a data state supplies its own size padding, and only a free-standing empty uses its size.
15
+ */
16
+ export declare function emptyPaddingY(size: EmptySize, owner: {
17
+ list: false | "default" | "compact";
18
+ state: boolean;
19
+ }): 0 | 12 | 24 | 32;
@@ -0,0 +1,19 @@
1
+ export type EmptySize = "sm" | "md";
2
+ /** KjunEmpty's per-size geometry. The icon stroke is in the 24-unit viewBox, so every size paints iconStroke px. */
3
+ export declare function emptyGeometry(size: EmptySize): {
4
+ iconSize: 24 | 32;
5
+ iconStroke: number;
6
+ iconGap: 16 | 12;
7
+ titleSize: 16 | 14;
8
+ titleLineHeight: 20 | 24;
9
+ paddingY: 24 | 32;
10
+ actionGap: 20 | 16;
11
+ };
12
+ /**
13
+ * Vertical padding, by who owns the space: a list section keeps the empty note one row tall,
14
+ * a data state supplies its own size padding, and only a free-standing empty uses its size.
15
+ */
16
+ export declare function emptyPaddingY(size: EmptySize, owner: {
17
+ list: false | "default" | "compact";
18
+ state: boolean;
19
+ }): 0 | 12 | 24 | 32;