@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
@@ -83,6 +83,7 @@ export declare const kjunMessagesKo: {
83
83
  increaseQuantity: string;
84
84
  decreaseQuantity: string;
85
85
  quantity: string;
86
+ hiddenValue: string;
86
87
  relativeTimeFallback: (amount: number, unit: string) => string;
87
88
  copy: string;
88
89
  copied: string;
@@ -133,6 +134,32 @@ export declare const kjunMessagesKo: {
133
134
  nextSlide: string;
134
135
  goToSlide: (slide: number) => string;
135
136
  slideOf: (slide: number, total: number) => string;
137
+ moveUp: (name: string) => string;
138
+ moveDown: (name: string) => string;
139
+ reorderMoved: (name: string, position: number, total: number) => string;
140
+ reorderHandle: (name: string) => string;
141
+ reorderGrabbed: (name: string) => string;
142
+ reorderDropped: (name: string, position: number, total: number) => string;
143
+ reorderCancelled: (name: string) => string;
144
+ tableReorderLocked: string;
145
+ colorPlaceholder: string;
146
+ colorPicker: string;
147
+ colorArea: string;
148
+ colorAreaValue: (saturation: number, brightness: number) => string;
149
+ hue: string;
150
+ hueValue: (degrees: number) => string;
151
+ alpha: string;
152
+ hex: string;
153
+ swatches: string;
154
+ colorNone: string;
155
+ colorValue: (hex: string, alpha?: number) => string;
156
+ increaseSaturation: string;
157
+ decreaseSaturation: string;
158
+ increaseBrightness: string;
159
+ decreaseBrightness: string;
160
+ recentColors: string;
161
+ eyeDropper: string;
162
+ colorAreaHint: string;
136
163
  marketData: string;
137
164
  metrics: string;
138
165
  watchToggle: (name: string, active: boolean) => string;
@@ -92,6 +92,7 @@ export declare const useKjunMessages: () => {
92
92
  increaseQuantity: string;
93
93
  decreaseQuantity: string;
94
94
  quantity: string;
95
+ hiddenValue: string;
95
96
  relativeTimeFallback: (amount: number, unit: string) => string;
96
97
  copy: string;
97
98
  copied: string;
@@ -142,6 +143,32 @@ export declare const useKjunMessages: () => {
142
143
  nextSlide: string;
143
144
  goToSlide: (slide: number) => string;
144
145
  slideOf: (slide: number, total: number) => string;
146
+ moveUp: (name: string) => string;
147
+ moveDown: (name: string) => string;
148
+ reorderMoved: (name: string, position: number, total: number) => string;
149
+ reorderHandle: (name: string) => string;
150
+ reorderGrabbed: (name: string) => string;
151
+ reorderDropped: (name: string, position: number, total: number) => string;
152
+ reorderCancelled: (name: string) => string;
153
+ tableReorderLocked: string;
154
+ colorPlaceholder: string;
155
+ colorPicker: string;
156
+ colorArea: string;
157
+ colorAreaValue: (saturation: number, brightness: number) => string;
158
+ hue: string;
159
+ hueValue: (degrees: number) => string;
160
+ alpha: string;
161
+ hex: string;
162
+ swatches: string;
163
+ colorNone: string;
164
+ colorValue: (hex: string, alpha?: number) => string;
165
+ increaseSaturation: string;
166
+ decreaseSaturation: string;
167
+ increaseBrightness: string;
168
+ decreaseBrightness: string;
169
+ recentColors: string;
170
+ eyeDropper: string;
171
+ colorAreaHint: string;
145
172
  marketData: string;
146
173
  metrics: string;
147
174
  watchToggle: (name: string, active: boolean) => string;
@@ -92,6 +92,7 @@ export declare const useKjunMessages: () => {
92
92
  increaseQuantity: string;
93
93
  decreaseQuantity: string;
94
94
  quantity: string;
95
+ hiddenValue: string;
95
96
  relativeTimeFallback: (amount: number, unit: string) => string;
96
97
  copy: string;
97
98
  copied: string;
@@ -142,6 +143,32 @@ export declare const useKjunMessages: () => {
142
143
  nextSlide: string;
143
144
  goToSlide: (slide: number) => string;
144
145
  slideOf: (slide: number, total: number) => string;
146
+ moveUp: (name: string) => string;
147
+ moveDown: (name: string) => string;
148
+ reorderMoved: (name: string, position: number, total: number) => string;
149
+ reorderHandle: (name: string) => string;
150
+ reorderGrabbed: (name: string) => string;
151
+ reorderDropped: (name: string, position: number, total: number) => string;
152
+ reorderCancelled: (name: string) => string;
153
+ tableReorderLocked: string;
154
+ colorPlaceholder: string;
155
+ colorPicker: string;
156
+ colorArea: string;
157
+ colorAreaValue: (saturation: number, brightness: number) => string;
158
+ hue: string;
159
+ hueValue: (degrees: number) => string;
160
+ alpha: string;
161
+ hex: string;
162
+ swatches: string;
163
+ colorNone: string;
164
+ colorValue: (hex: string, alpha?: number) => string;
165
+ increaseSaturation: string;
166
+ decreaseSaturation: string;
167
+ increaseBrightness: string;
168
+ decreaseBrightness: string;
169
+ recentColors: string;
170
+ eyeDropper: string;
171
+ colorAreaHint: string;
145
172
  marketData: string;
146
173
  metrics: string;
147
174
  watchToggle: (name: string, active: boolean) => string;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Tabular figures give a leading + or - a whole figure's width (Inter's tnum does), so the sign floats apart
3
+ * from the digits ("- 1.25%"). The sign is split off and drawn with proportional figures, tight to the number,
4
+ * while the digits keep their tabular widths. The text itself is unchanged.
5
+ */
6
+ export declare function splitNumberSign(value: unknown): [
7
+ sign: string,
8
+ rest: string
9
+ ] | null;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Tabular figures give a leading + or - a whole figure's width (Inter's tnum does), so the sign floats apart
3
+ * from the digits ("- 1.25%"). The sign is split off and drawn with proportional figures, tight to the number,
4
+ * while the digits keep their tabular widths. The text itself is unchanged.
5
+ */
6
+ export declare function splitNumberSign(value: unknown): [
7
+ sign: string,
8
+ rest: string
9
+ ] | null;
@@ -0,0 +1,3 @@
1
+ /** Marks a Popover body with where it can still scroll: `data-scrolled` once it has left the top
2
+ * (the fixed header then draws a divider) and `data-more` while content remains below (the body fades out). */
3
+ export declare function trackPopoverScroll(body: HTMLElement): () => void;
@@ -0,0 +1,3 @@
1
+ /** Marks a Popover body with where it can still scroll: `data-scrolled` once it has left the top
2
+ * (the fixed header then draws a divider) and `data-more` while content remains below (the body fades out). */
3
+ export declare function trackPopoverScroll(body: HTMLElement): () => void;
@@ -0,0 +1,2 @@
1
+ /** Wires the keyboard to a `role="radiogroup"` element; returns the cleanup. */
2
+ export declare function bindRadioKeyboard(group: HTMLElement): () => void;
@@ -0,0 +1,2 @@
1
+ /** Wires the keyboard to a `role="radiogroup"` element; returns the cleanup. */
2
+ export declare function bindRadioKeyboard(group: HTMLElement): () => void;
@@ -0,0 +1,62 @@
1
+ import { type ReorderKey, type ReorderMove } from "./reorder.cjs";
2
+ export interface ReorderHost {
3
+ order: () => readonly ReorderKey[] | undefined;
4
+ disabled: () => boolean;
5
+ /** The section's list element. */
6
+ list: () => HTMLElement | null;
7
+ /** Selects the movable rows' control groups inside list(); a list section's own rows by default. */
8
+ controls?: string;
9
+ /** Selects the root that owns a control group: one whose nearest such root is not list() belongs to a nested table or list. */
10
+ owner?: string;
11
+ text: () => {
12
+ moved: (name: string, position: number, total: number) => string;
13
+ grabbed: (name: string) => string;
14
+ dropped: (name: string, position: number, total: number) => string;
15
+ cancelled: (name: string) => string;
16
+ };
17
+ /** Sets the live region's text. */
18
+ say: (text: string) => void;
19
+ /** The row whose handle holds it (keyboard grab or pointer drag), or null. */
20
+ grabbed: (value: ReorderKey | null) => void;
21
+ /** Asks the app for this order. */
22
+ change: (order: ReorderKey[]) => void;
23
+ /** A finished move: one button press, or a whole grab or drag from where it started to where it ended. */
24
+ moved: (move: ReorderMove) => void;
25
+ }
26
+ interface KeyEvent {
27
+ key: string;
28
+ repeat?: boolean;
29
+ preventDefault: () => void;
30
+ }
31
+ interface PressEvent {
32
+ pointerId: number;
33
+ button: number;
34
+ clientY: number;
35
+ preventDefault: () => void;
36
+ }
37
+ export declare function createReorderSession(host: ReorderHost): {
38
+ /** An up or down button: one step, one finished move. */
39
+ press(value: ReorderKey, direction: -1 | 1, name: string): void;
40
+ /** A key on a row's handle. */
41
+ key(event: KeyEvent, value: ReorderKey, name: string, target?: Element | null): void;
42
+ /** The key press that grabbed or dropped is over; the click a browser may still send for it is ignored. */
43
+ keyUp(): void;
44
+ /** A click without a pointer (a screen reader's press): grabs the row, or drops it when it is held. */
45
+ click(event: {
46
+ detail: number;
47
+ }, value: ReorderKey, name: string, target?: Element | null): void;
48
+ /** A pointer pressing a row's handle starts a drag; the row steps as the pointer passes its neighbours. */
49
+ pointerDown(event: PressEvent, value: ReorderKey, name: string): void;
50
+ /** Called once the DOM shows an order: confirms the pending step, if this order is it. */
51
+ confirm(order: readonly ReorderKey[] | undefined): void;
52
+ /**
53
+ * Moving was turned off. A held row is let go where it is: the app that turned moving off (often to save a step)
54
+ * is not asked for another order. Nothing stays pending.
55
+ */
56
+ reset(): void;
57
+ /** Moving is on again and its controls are drawn: focus goes to the moved row's control if it could not before. */
58
+ resume(): void;
59
+ dispose(): void;
60
+ };
61
+ export type ReorderSession = ReturnType<typeof createReorderSession>;
62
+ export {};
@@ -0,0 +1,62 @@
1
+ import { type ReorderKey, type ReorderMove } from "./reorder.js";
2
+ export interface ReorderHost {
3
+ order: () => readonly ReorderKey[] | undefined;
4
+ disabled: () => boolean;
5
+ /** The section's list element. */
6
+ list: () => HTMLElement | null;
7
+ /** Selects the movable rows' control groups inside list(); a list section's own rows by default. */
8
+ controls?: string;
9
+ /** Selects the root that owns a control group: one whose nearest such root is not list() belongs to a nested table or list. */
10
+ owner?: string;
11
+ text: () => {
12
+ moved: (name: string, position: number, total: number) => string;
13
+ grabbed: (name: string) => string;
14
+ dropped: (name: string, position: number, total: number) => string;
15
+ cancelled: (name: string) => string;
16
+ };
17
+ /** Sets the live region's text. */
18
+ say: (text: string) => void;
19
+ /** The row whose handle holds it (keyboard grab or pointer drag), or null. */
20
+ grabbed: (value: ReorderKey | null) => void;
21
+ /** Asks the app for this order. */
22
+ change: (order: ReorderKey[]) => void;
23
+ /** A finished move: one button press, or a whole grab or drag from where it started to where it ended. */
24
+ moved: (move: ReorderMove) => void;
25
+ }
26
+ interface KeyEvent {
27
+ key: string;
28
+ repeat?: boolean;
29
+ preventDefault: () => void;
30
+ }
31
+ interface PressEvent {
32
+ pointerId: number;
33
+ button: number;
34
+ clientY: number;
35
+ preventDefault: () => void;
36
+ }
37
+ export declare function createReorderSession(host: ReorderHost): {
38
+ /** An up or down button: one step, one finished move. */
39
+ press(value: ReorderKey, direction: -1 | 1, name: string): void;
40
+ /** A key on a row's handle. */
41
+ key(event: KeyEvent, value: ReorderKey, name: string, target?: Element | null): void;
42
+ /** The key press that grabbed or dropped is over; the click a browser may still send for it is ignored. */
43
+ keyUp(): void;
44
+ /** A click without a pointer (a screen reader's press): grabs the row, or drops it when it is held. */
45
+ click(event: {
46
+ detail: number;
47
+ }, value: ReorderKey, name: string, target?: Element | null): void;
48
+ /** A pointer pressing a row's handle starts a drag; the row steps as the pointer passes its neighbours. */
49
+ pointerDown(event: PressEvent, value: ReorderKey, name: string): void;
50
+ /** Called once the DOM shows an order: confirms the pending step, if this order is it. */
51
+ confirm(order: readonly ReorderKey[] | undefined): void;
52
+ /**
53
+ * Moving was turned off. A held row is let go where it is: the app that turned moving off (often to save a step)
54
+ * is not asked for another order. Nothing stays pending.
55
+ */
56
+ reset(): void;
57
+ /** Moving is on again and its controls are drawn: focus goes to the moved row's control if it could not before. */
58
+ resume(): void;
59
+ dispose(): void;
60
+ };
61
+ export type ReorderSession = ReturnType<typeof createReorderSession>;
62
+ export {};
@@ -0,0 +1,81 @@
1
+ export type ReorderKey = string | number;
2
+ export interface ReorderPlace {
3
+ index: number;
4
+ total: number;
5
+ up: boolean;
6
+ down: boolean;
7
+ }
8
+ export interface ReorderMove<T extends ReorderKey = ReorderKey> {
9
+ value: T;
10
+ from: number;
11
+ to: number;
12
+ order: T[];
13
+ }
14
+ /** A copy with the item at `from` moved to `to`; the same array when nothing moves. */
15
+ export declare function reorderMove<T>(order: readonly T[], from: number, to: number): T[];
16
+ /** Where a row sits and which way it can go; null for a row the order does not list. */
17
+ export declare function reorderPlace(order: readonly ReorderKey[] | undefined, value: ReorderKey | undefined): ReorderPlace | null;
18
+ /** One step up (-1) or down (1); null at an end or for an unknown row. */
19
+ export declare function reorderStep<T extends ReorderKey>(order: readonly T[] | undefined, value: T, step: -1 | 1): ReorderMove<T> | null;
20
+ /** The button to focus after a move: the one pressed while it is still usable, else the other; null when neither is. */
21
+ export declare function reorderFocus(order: readonly ReorderKey[] | undefined, value: ReorderKey, step: -1 | 1): "up" | "down" | null;
22
+ /** A move waiting for the app to apply it: the row, where it should land and when it was pressed (ms). */
23
+ export interface ReorderPending {
24
+ value: ReorderKey;
25
+ to: number;
26
+ at: number;
27
+ }
28
+ /** How long a pressed move may wait for its order; after that an order change is someone else's. */
29
+ export declare const REORDER_CONFIRM_MS = 10000;
30
+ /**
31
+ * Whether an order is the pressed move, applied: it shows the row at the place it was sent to, soon enough after the
32
+ * press. An order the app drew again unchanged, or changed for another reason, confirms nothing.
33
+ */
34
+ export declare function reorderConfirmed(order: readonly ReorderKey[] | undefined, pending: ReorderPending | null, now: number): boolean;
35
+ /** True when a value appears twice: such rows would share one place. */
36
+ export declare function reorderDuplicates(order: readonly ReorderKey[] | undefined): boolean;
37
+ /**
38
+ * Which way a dragged row steps for a pointer position: up once the pointer is above the middle of the row before
39
+ * it, down once it is below the middle of the row after it. `rows` are the movable rows' boxes in their current order.
40
+ */
41
+ export declare function reorderDragStep(pointer: number, rows: readonly {
42
+ top: number;
43
+ height: number;
44
+ }[], index: number): -1 | 0 | 1;
45
+ export type ReorderKeyAction = "grab" | "drop" | "cancel" | "up" | "down" | "leave";
46
+ /** Keys on a row's handle. "leave" (Tab) drops the row and must not be prevented. */
47
+ export declare function reorderKeyAction(key: string, grabbed: boolean): ReorderKeyAction | null;
48
+ /**
49
+ * A row's place for its buttons when only some of the order is on screen (a table page, a filtered list): a step
50
+ * that would pass a row that is not shown is off, so a move never takes the row out of sight.
51
+ */
52
+ export declare function reorderPlaceAmong(order: readonly ReorderKey[] | undefined, value: ReorderKey | undefined, shown?: ReadonlySet<ReorderKey> | null): ReorderPlace | null;
53
+ /** What is wrong with a reorderable section's `order`, for the console; `model` names the platform's way to receive it. */
54
+ export declare function reorderWarning(order: readonly ReorderKey[] | undefined, model: string): string | null;
55
+ /** A requested step: `focus` is where focus goes once it is applied, and `quiet` skips the sentence. */
56
+ export interface ReorderRequest extends ReorderPending {
57
+ name: string;
58
+ focus: -1 | 1 | "handle";
59
+ quiet: boolean;
60
+ }
61
+ export interface ReorderMovesHost {
62
+ order: () => readonly ReorderKey[] | undefined;
63
+ disabled: () => boolean;
64
+ /** Says a sentence to screen readers; an empty one clears the last. */
65
+ say: (text: string) => void;
66
+ moved: (name: string, position: number, total: number) => string;
67
+ /** Asks the app for this order. */
68
+ change: (order: ReorderKey[]) => void;
69
+ }
70
+ /**
71
+ * The part of reordering every platform shares. The app owns the order, so a step is a request: it waits until an
72
+ * order shows the row at its new place, and only then is it announced. A request the app never applies stops waiting.
73
+ */
74
+ export declare function createReorderMoves(host: ReorderMovesHost): {
75
+ waiting: () => ReorderRequest | null;
76
+ /** Waits for this request (an order the caller asked for itself), or for nothing. */
77
+ expect(request: ReorderRequest | null): void;
78
+ step(value: ReorderKey, direction: -1 | 1, name: string, focus?: -1 | 1 | "handle", quiet?: boolean): ReorderMove<ReorderKey> | null;
79
+ /** The request this order confirms, announced unless it is quiet or `announce` is off; null when it confirms none. */
80
+ confirm(order: readonly ReorderKey[] | undefined, announce?: boolean): ReorderRequest | null;
81
+ };
@@ -0,0 +1,81 @@
1
+ export type ReorderKey = string | number;
2
+ export interface ReorderPlace {
3
+ index: number;
4
+ total: number;
5
+ up: boolean;
6
+ down: boolean;
7
+ }
8
+ export interface ReorderMove<T extends ReorderKey = ReorderKey> {
9
+ value: T;
10
+ from: number;
11
+ to: number;
12
+ order: T[];
13
+ }
14
+ /** A copy with the item at `from` moved to `to`; the same array when nothing moves. */
15
+ export declare function reorderMove<T>(order: readonly T[], from: number, to: number): T[];
16
+ /** Where a row sits and which way it can go; null for a row the order does not list. */
17
+ export declare function reorderPlace(order: readonly ReorderKey[] | undefined, value: ReorderKey | undefined): ReorderPlace | null;
18
+ /** One step up (-1) or down (1); null at an end or for an unknown row. */
19
+ export declare function reorderStep<T extends ReorderKey>(order: readonly T[] | undefined, value: T, step: -1 | 1): ReorderMove<T> | null;
20
+ /** The button to focus after a move: the one pressed while it is still usable, else the other; null when neither is. */
21
+ export declare function reorderFocus(order: readonly ReorderKey[] | undefined, value: ReorderKey, step: -1 | 1): "up" | "down" | null;
22
+ /** A move waiting for the app to apply it: the row, where it should land and when it was pressed (ms). */
23
+ export interface ReorderPending {
24
+ value: ReorderKey;
25
+ to: number;
26
+ at: number;
27
+ }
28
+ /** How long a pressed move may wait for its order; after that an order change is someone else's. */
29
+ export declare const REORDER_CONFIRM_MS = 10000;
30
+ /**
31
+ * Whether an order is the pressed move, applied: it shows the row at the place it was sent to, soon enough after the
32
+ * press. An order the app drew again unchanged, or changed for another reason, confirms nothing.
33
+ */
34
+ export declare function reorderConfirmed(order: readonly ReorderKey[] | undefined, pending: ReorderPending | null, now: number): boolean;
35
+ /** True when a value appears twice: such rows would share one place. */
36
+ export declare function reorderDuplicates(order: readonly ReorderKey[] | undefined): boolean;
37
+ /**
38
+ * Which way a dragged row steps for a pointer position: up once the pointer is above the middle of the row before
39
+ * it, down once it is below the middle of the row after it. `rows` are the movable rows' boxes in their current order.
40
+ */
41
+ export declare function reorderDragStep(pointer: number, rows: readonly {
42
+ top: number;
43
+ height: number;
44
+ }[], index: number): -1 | 0 | 1;
45
+ export type ReorderKeyAction = "grab" | "drop" | "cancel" | "up" | "down" | "leave";
46
+ /** Keys on a row's handle. "leave" (Tab) drops the row and must not be prevented. */
47
+ export declare function reorderKeyAction(key: string, grabbed: boolean): ReorderKeyAction | null;
48
+ /**
49
+ * A row's place for its buttons when only some of the order is on screen (a table page, a filtered list): a step
50
+ * that would pass a row that is not shown is off, so a move never takes the row out of sight.
51
+ */
52
+ export declare function reorderPlaceAmong(order: readonly ReorderKey[] | undefined, value: ReorderKey | undefined, shown?: ReadonlySet<ReorderKey> | null): ReorderPlace | null;
53
+ /** What is wrong with a reorderable section's `order`, for the console; `model` names the platform's way to receive it. */
54
+ export declare function reorderWarning(order: readonly ReorderKey[] | undefined, model: string): string | null;
55
+ /** A requested step: `focus` is where focus goes once it is applied, and `quiet` skips the sentence. */
56
+ export interface ReorderRequest extends ReorderPending {
57
+ name: string;
58
+ focus: -1 | 1 | "handle";
59
+ quiet: boolean;
60
+ }
61
+ export interface ReorderMovesHost {
62
+ order: () => readonly ReorderKey[] | undefined;
63
+ disabled: () => boolean;
64
+ /** Says a sentence to screen readers; an empty one clears the last. */
65
+ say: (text: string) => void;
66
+ moved: (name: string, position: number, total: number) => string;
67
+ /** Asks the app for this order. */
68
+ change: (order: ReorderKey[]) => void;
69
+ }
70
+ /**
71
+ * The part of reordering every platform shares. The app owns the order, so a step is a request: it waits until an
72
+ * order shows the row at its new place, and only then is it announced. A request the app never applies stops waiting.
73
+ */
74
+ export declare function createReorderMoves(host: ReorderMovesHost): {
75
+ waiting: () => ReorderRequest | null;
76
+ /** Waits for this request (an order the caller asked for itself), or for nothing. */
77
+ expect(request: ReorderRequest | null): void;
78
+ step(value: ReorderKey, direction: -1 | 1, name: string, focus?: -1 | 1 | "handle", quiet?: boolean): ReorderMove<ReorderKey> | null;
79
+ /** The request this order confirms, announced unless it is quiet or `announce` is off; null when it confirms none. */
80
+ confirm(order: readonly ReorderKey[] | undefined, announce?: boolean): ReorderRequest | null;
81
+ };
@@ -2,6 +2,20 @@ import { type TypographyRole } from "@kjun-ui/tokens";
2
2
  type Percent = `${number}%`;
3
3
  /** A paragraph that does not look like every other one, with a short last line. */
4
4
  export declare function skeletonTextWidths(rows: number): Percent[];
5
+ /** Rows drawn for a count that may come from data: floored, never negative, and at most 100. */
6
+ export declare function skeletonCount(value: number): number;
7
+ /**
8
+ * Line widths for row `index` of a list skeleton, so neighbouring rows differ like real names do.
9
+ * `wide` is for rows whose label column is narrow (market, compact, notification, the market table's identity).
10
+ */
11
+ export declare function skeletonRowWidths(index: number, wide?: boolean): {
12
+ title: `${number}%`;
13
+ detail: `${number}%`;
14
+ };
15
+ /** A factor for a fixed-width bar (a value, a label), so a column of them does not read as stripes. */
16
+ export declare function skeletonWidthScale(index: number): number;
17
+ /** Bar width for a cell of the table skeleton; row 0 is the header. The first column reads as names, the rest as values. */
18
+ export declare function skeletonTableWidth(row: number, column: number): Percent;
5
19
  /** The web line box of a type role; without a role the line takes the surrounding text's line height. */
6
20
  export declare function skeletonLineBox(role?: TypographyRole): string;
7
21
  /**
@@ -2,6 +2,20 @@ import { type TypographyRole } from "@kjun-ui/tokens";
2
2
  type Percent = `${number}%`;
3
3
  /** A paragraph that does not look like every other one, with a short last line. */
4
4
  export declare function skeletonTextWidths(rows: number): Percent[];
5
+ /** Rows drawn for a count that may come from data: floored, never negative, and at most 100. */
6
+ export declare function skeletonCount(value: number): number;
7
+ /**
8
+ * Line widths for row `index` of a list skeleton, so neighbouring rows differ like real names do.
9
+ * `wide` is for rows whose label column is narrow (market, compact, notification, the market table's identity).
10
+ */
11
+ export declare function skeletonRowWidths(index: number, wide?: boolean): {
12
+ title: `${number}%`;
13
+ detail: `${number}%`;
14
+ };
15
+ /** A factor for a fixed-width bar (a value, a label), so a column of them does not read as stripes. */
16
+ export declare function skeletonWidthScale(index: number): number;
17
+ /** Bar width for a cell of the table skeleton; row 0 is the header. The first column reads as names, the rest as values. */
18
+ export declare function skeletonTableWidth(row: number, column: number): Percent;
5
19
  /** The web line box of a type role; without a role the line takes the surrounding text's line height. */
6
20
  export declare function skeletonLineBox(role?: TypographyRole): string;
7
21
  /**
@@ -0,0 +1,46 @@
1
+ export type SplitDirection = "horizontal" | "vertical";
2
+ export type SplitMin = readonly [
3
+ number,
4
+ number
5
+ ];
6
+ export type SplitMax = readonly [
7
+ number | null,
8
+ number | null
9
+ ];
10
+ export interface SplitLimits {
11
+ low: number;
12
+ high: number;
13
+ }
14
+ export type SplitKeyAction = "decrease" | "increase" | "min" | "max" | "reset";
15
+ /** Pixels one arrow key press moves the handle. */
16
+ export declare const SPLIT_KEY_STEP = 16;
17
+ /**
18
+ * The first pane's allowed pixels. Minimums beat maximums, and when the container is narrower than both minimums the
19
+ * first pane keeps its minimum (or all the room, if even that does not fit), so panes never overlap or go negative.
20
+ */
21
+ export declare function splitLimits(total: number, handle: number, min?: SplitMin, max?: SplitMax): SplitLimits;
22
+ export declare function splitClamp(px: number, limits: SplitLimits): number;
23
+ export declare function splitFromRatio(ratio: number, total: number, handle: number): number;
24
+ /** Four decimals: enough for a pixel on any screen, and stable to store. */
25
+ export declare function splitToRatio(px: number, total: number, handle: number): number;
26
+ /** The wanted ratio as the first pane's pixels inside the limits. */
27
+ export declare function splitResolve(ratio: number, total: number, handle: number, min?: SplitMin, max?: SplitMax): number;
28
+ /** A whole percent for aria-valuenow, aria-valuemin and aria-valuemax. */
29
+ export declare function splitPercent(px: number, total: number, handle: number): number;
30
+ /**
31
+ * The first pane's pixels during a drag: where it started plus how far the pointer has moved. scale is layout pixels
32
+ * per viewport pixel (1 unless an ancestor is transformed), and right to left the pane grows as the pointer moves left.
33
+ */
34
+ export declare function splitDrag(startPx: number, startPointer: number, pointer: number, scale: number, rtl: boolean | undefined): number;
35
+ /** A usable share: a missing or non-finite size falls back, and the rest is kept inside 0–1. */
36
+ export declare function splitShare(size: number | undefined, fallback?: number): number;
37
+ /** Browser shortcuts (Alt+Left, Ctrl+Home) keep their meaning on a focused handle. */
38
+ export declare function splitKeyHeld(event: {
39
+ altKey?: boolean;
40
+ ctrlKey?: boolean;
41
+ metaKey?: boolean;
42
+ }): boolean;
43
+ /** rtl is read by truth: Native Web has no reading direction to report and passes undefined. */
44
+ export declare function splitKeyAction(key: string, direction: SplitDirection, rtl: boolean | undefined): SplitKeyAction | null;
45
+ /** The first pane's pixels after a key action; resetPx is the default size in pixels. */
46
+ export declare function splitKeyTarget(action: SplitKeyAction, px: number, limits: SplitLimits, resetPx: number): number;
@@ -0,0 +1,46 @@
1
+ export type SplitDirection = "horizontal" | "vertical";
2
+ export type SplitMin = readonly [
3
+ number,
4
+ number
5
+ ];
6
+ export type SplitMax = readonly [
7
+ number | null,
8
+ number | null
9
+ ];
10
+ export interface SplitLimits {
11
+ low: number;
12
+ high: number;
13
+ }
14
+ export type SplitKeyAction = "decrease" | "increase" | "min" | "max" | "reset";
15
+ /** Pixels one arrow key press moves the handle. */
16
+ export declare const SPLIT_KEY_STEP = 16;
17
+ /**
18
+ * The first pane's allowed pixels. Minimums beat maximums, and when the container is narrower than both minimums the
19
+ * first pane keeps its minimum (or all the room, if even that does not fit), so panes never overlap or go negative.
20
+ */
21
+ export declare function splitLimits(total: number, handle: number, min?: SplitMin, max?: SplitMax): SplitLimits;
22
+ export declare function splitClamp(px: number, limits: SplitLimits): number;
23
+ export declare function splitFromRatio(ratio: number, total: number, handle: number): number;
24
+ /** Four decimals: enough for a pixel on any screen, and stable to store. */
25
+ export declare function splitToRatio(px: number, total: number, handle: number): number;
26
+ /** The wanted ratio as the first pane's pixels inside the limits. */
27
+ export declare function splitResolve(ratio: number, total: number, handle: number, min?: SplitMin, max?: SplitMax): number;
28
+ /** A whole percent for aria-valuenow, aria-valuemin and aria-valuemax. */
29
+ export declare function splitPercent(px: number, total: number, handle: number): number;
30
+ /**
31
+ * The first pane's pixels during a drag: where it started plus how far the pointer has moved. scale is layout pixels
32
+ * per viewport pixel (1 unless an ancestor is transformed), and right to left the pane grows as the pointer moves left.
33
+ */
34
+ export declare function splitDrag(startPx: number, startPointer: number, pointer: number, scale: number, rtl: boolean | undefined): number;
35
+ /** A usable share: a missing or non-finite size falls back, and the rest is kept inside 0–1. */
36
+ export declare function splitShare(size: number | undefined, fallback?: number): number;
37
+ /** Browser shortcuts (Alt+Left, Ctrl+Home) keep their meaning on a focused handle. */
38
+ export declare function splitKeyHeld(event: {
39
+ altKey?: boolean;
40
+ ctrlKey?: boolean;
41
+ metaKey?: boolean;
42
+ }): boolean;
43
+ /** rtl is read by truth: Native Web has no reading direction to report and passes undefined. */
44
+ export declare function splitKeyAction(key: string, direction: SplitDirection, rtl: boolean | undefined): SplitKeyAction | null;
45
+ /** The first pane's pixels after a key action; resetPx is the default size in pixels. */
46
+ export declare function splitKeyTarget(action: SplitKeyAction, px: number, limits: SplitLimits, resetPx: number): number;
@@ -0,0 +1,28 @@
1
+ export interface TableColumnGroup {
2
+ /** The label over the group's columns. */
3
+ label: string;
4
+ /** Keys of the columns it spans; they are drawn where `columns` puts them. */
5
+ columns: string[];
6
+ }
7
+ export type TableHeaderCell<Column> = {
8
+ kind: "group";
9
+ key: string;
10
+ label: string;
11
+ span: number;
12
+ columns: Column[];
13
+ } | {
14
+ kind: "column";
15
+ column: Column;
16
+ };
17
+ /**
18
+ * The header's top row when groups apply: a group over each run of its shown columns, and the other columns standing
19
+ * alone across both rows. null when no group holds a shown column, so the header stays one row.
20
+ */
21
+ export declare function tableHeaderRows<Column extends {
22
+ key: string;
23
+ }>(visible: readonly Column[], groups?: readonly TableColumnGroup[] | null): TableHeaderCell<Column>[] | null;
24
+ /**
25
+ * Each shown column's span in one row: a number above zero draws the cell over that many columns (never past the
26
+ * row's end), 0 marks a column a previous cell covers. A span that is not a whole number above one counts as 1.
27
+ */
28
+ export declare function tableSpans<Column>(columns: readonly Column[], span?: ((column: Column) => number | null | undefined) | null): number[];
@@ -0,0 +1,28 @@
1
+ export interface TableColumnGroup {
2
+ /** The label over the group's columns. */
3
+ label: string;
4
+ /** Keys of the columns it spans; they are drawn where `columns` puts them. */
5
+ columns: string[];
6
+ }
7
+ export type TableHeaderCell<Column> = {
8
+ kind: "group";
9
+ key: string;
10
+ label: string;
11
+ span: number;
12
+ columns: Column[];
13
+ } | {
14
+ kind: "column";
15
+ column: Column;
16
+ };
17
+ /**
18
+ * The header's top row when groups apply: a group over each run of its shown columns, and the other columns standing
19
+ * alone across both rows. null when no group holds a shown column, so the header stays one row.
20
+ */
21
+ export declare function tableHeaderRows<Column extends {
22
+ key: string;
23
+ }>(visible: readonly Column[], groups?: readonly TableColumnGroup[] | null): TableHeaderCell<Column>[] | null;
24
+ /**
25
+ * Each shown column's span in one row: a number above zero draws the cell over that many columns (never past the
26
+ * row's end), 0 marks a column a previous cell covers. A span that is not a whole number above one counts as 1.
27
+ */
28
+ export declare function tableSpans<Column>(columns: readonly Column[], span?: ((column: Column) => number | null | undefined) | null): number[];