@inertiaui/vanilla 1.1.0 → 1.3.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.
- package/README.md +507 -7
- package/dist/index.d.ts +374 -0
- package/dist/index.js +1394 -12
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -13,14 +13,46 @@
|
|
|
13
13
|
*/
|
|
14
14
|
export declare function animate(element: HTMLElement, keyframes: Keyframe[], options?: AnimateOptions): Promise<Animation>;
|
|
15
15
|
|
|
16
|
+
/**
|
|
17
|
+
* Animate elements from a previously captured layout snapshot to their current
|
|
18
|
+
* positions. Only animations started by this helper are cancelled on later runs.
|
|
19
|
+
*/
|
|
20
|
+
export declare function animateFromSnapshot(snapshot: AnimationSnapshot | null, elements: Iterable<HTMLElement | null | undefined>, options?: AnimateFromSnapshotOptions): Animation[];
|
|
21
|
+
|
|
22
|
+
export declare interface AnimateFromSnapshotOptions extends AnimateOptions {
|
|
23
|
+
minimumDelta?: number;
|
|
24
|
+
includeCurrentTransform?: boolean;
|
|
25
|
+
}
|
|
26
|
+
|
|
16
27
|
export declare interface AnimateOptions {
|
|
17
28
|
duration?: number;
|
|
18
29
|
easing?: string | EasingName;
|
|
19
30
|
fill?: FillMode;
|
|
20
31
|
}
|
|
21
32
|
|
|
33
|
+
export declare type AnimationSnapshot = Map<HTMLElement, DOMRect>;
|
|
34
|
+
|
|
35
|
+
export declare type AutoScrollAxis = 'x' | 'y' | 'both';
|
|
36
|
+
|
|
37
|
+
export declare type AutoScrollContainer = Element | Window;
|
|
38
|
+
|
|
39
|
+
export declare interface AutoScrollerOptions {
|
|
40
|
+
/** Edge size in CSS pixels that starts scrolling. Defaults to 48. */
|
|
41
|
+
edgeThreshold?: number;
|
|
42
|
+
/** Maximum scroll speed in CSS pixels per second. Defaults to 720. */
|
|
43
|
+
maxSpeed?: number;
|
|
44
|
+
/** Limit scrolling to one axis. Defaults to both axes. */
|
|
45
|
+
axis?: AutoScrollAxis;
|
|
46
|
+
/** Override scroll containers. Defaults to scrollable ancestors plus window. */
|
|
47
|
+
getScrollContainers?: (element: Element | null) => AutoScrollContainer[];
|
|
48
|
+
/** Called once per animation frame after one or more containers scrolled. */
|
|
49
|
+
onScroll?: () => void;
|
|
50
|
+
}
|
|
51
|
+
|
|
22
52
|
export declare function autoUpdate(reference: HTMLElement, floating: HTMLElement, update: () => void): CleanupFunction;
|
|
23
53
|
|
|
54
|
+
export declare function autoUpdateTopLayerPopover(reference: HTMLElement, floating: HTMLElement, update: () => void): CleanupFunction;
|
|
55
|
+
|
|
24
56
|
/**
|
|
25
57
|
* Port of Laravel's `blank` function.
|
|
26
58
|
* Returns true if the value is "empty" — null, undefined, empty string, empty array/object, etc.
|
|
@@ -32,14 +64,44 @@ export declare function blank(value: unknown): boolean;
|
|
|
32
64
|
*/
|
|
33
65
|
export declare function cancelAnimations(element: HTMLElement): void;
|
|
34
66
|
|
|
67
|
+
/**
|
|
68
|
+
* Capture current element rectangles before a renderer changes their order or
|
|
69
|
+
* position. Pass the snapshot to animateFromSnapshot after the DOM has updated.
|
|
70
|
+
*/
|
|
71
|
+
export declare function captureAnimationSnapshot(elements: Iterable<HTMLElement | null | undefined>): AnimationSnapshot | null;
|
|
72
|
+
|
|
35
73
|
export declare type CleanupFunction = () => void;
|
|
36
74
|
|
|
75
|
+
/**
|
|
76
|
+
* Supported output formats for {@link formatColor}.
|
|
77
|
+
*/
|
|
78
|
+
export declare type ColorFormat = 'hex' | 'rgb' | 'hsl';
|
|
79
|
+
|
|
37
80
|
export declare function computePosition(reference: HTMLElement, floating: HTMLElement, options?: PositionOptions_2): PositionResult;
|
|
38
81
|
|
|
82
|
+
/**
|
|
83
|
+
* Create a {@link Debouncer} with a fixed delay.
|
|
84
|
+
*
|
|
85
|
+
* @param delay - Milliseconds to wait after the latest `schedule()` call.
|
|
86
|
+
*/
|
|
87
|
+
export declare function createDebouncer(delay: number): Debouncer;
|
|
88
|
+
|
|
89
|
+
export declare function createFocusOutDismiss(options: FocusOutDismissOptions): FocusOutDismissController;
|
|
90
|
+
|
|
39
91
|
export declare function createFocusTrap(container: HTMLElement, options?: FocusTrapOptions): CleanupFunction;
|
|
40
92
|
|
|
41
93
|
export declare function createMenuNavigation(container: HTMLElement, options?: MenuNavigationOptions): CleanupFunction;
|
|
42
94
|
|
|
95
|
+
export declare function createNativePopoverDisclosure(options: NativePopoverDisclosureOptions): NativePopoverDisclosureController;
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Framework-neutral list reorder controller. It combines item registration,
|
|
99
|
+
* live pointer preview ordering, keyboard moves, pointer commits, bounds, and
|
|
100
|
+
* cleanup while leaving rendering, announcements, and animation policy to the
|
|
101
|
+
* consuming package.
|
|
102
|
+
*/
|
|
103
|
+
export declare function createReorderableList<T>(options: ReorderableListOptions<T>): ReorderableListController<T>;
|
|
104
|
+
|
|
43
105
|
export declare type DarkModeStrategy = 'auto' | 'class' | 'selector' | 'media' | (() => boolean);
|
|
44
106
|
|
|
45
107
|
/**
|
|
@@ -50,6 +112,17 @@ export declare type DarkModeStrategy = 'auto' | 'class' | 'selector' | 'media' |
|
|
|
50
112
|
*/
|
|
51
113
|
export declare function debounce<T extends (...args: unknown[]) => void>(fn: T): (...args: Parameters<T>) => void;
|
|
52
114
|
|
|
115
|
+
/**
|
|
116
|
+
* A timeout-based debounced scheduler. Each `schedule()` cancels any pending
|
|
117
|
+
* call and queues a fresh one `delay` milliseconds out.
|
|
118
|
+
*/
|
|
119
|
+
export declare interface Debouncer {
|
|
120
|
+
/** Queue `fn` to run after `delay` ms, cancelling any pending call. */
|
|
121
|
+
schedule(fn: () => void): void;
|
|
122
|
+
/** Cancel a pending call, if any. */
|
|
123
|
+
cancel(): void;
|
|
124
|
+
}
|
|
125
|
+
|
|
53
126
|
/**
|
|
54
127
|
* Detect the browser's current framerate.
|
|
55
128
|
* Returns a Promise that resolves with the detected FPS (capped to 30–240 range).
|
|
@@ -69,6 +142,8 @@ export declare const easings: {
|
|
|
69
142
|
readonly inOut: "cubic-bezier(0.4, 0, 0.2, 1)";
|
|
70
143
|
};
|
|
71
144
|
|
|
145
|
+
declare type ElementGetter<T extends HTMLElement = HTMLElement> = () => T | null;
|
|
146
|
+
|
|
72
147
|
export declare interface EscapeKeyOptions {
|
|
73
148
|
preventDefault?: boolean;
|
|
74
149
|
stopPropagation?: boolean;
|
|
@@ -78,12 +153,55 @@ export declare function except<T extends Record<string, unknown>>(target: T, key
|
|
|
78
153
|
|
|
79
154
|
export declare function except(target: string[], keys: string[], ignoreCase?: boolean): string[];
|
|
80
155
|
|
|
156
|
+
export declare function focusFirstEnabledElement(elements: Array<HTMLElement | null | undefined>): boolean;
|
|
157
|
+
|
|
158
|
+
export declare interface FocusOutDismissController {
|
|
159
|
+
markOpen: () => void;
|
|
160
|
+
cancel: () => void;
|
|
161
|
+
schedule: (event: FocusEvent) => void;
|
|
162
|
+
cleanup: CleanupFunction;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
export declare interface FocusOutDismissOptions {
|
|
166
|
+
container: () => HTMLElement | null;
|
|
167
|
+
onDismiss: () => void;
|
|
168
|
+
delay?: number;
|
|
169
|
+
shouldIgnore?: () => boolean;
|
|
170
|
+
}
|
|
171
|
+
|
|
81
172
|
export declare interface FocusTrapOptions {
|
|
82
173
|
initialFocus?: boolean;
|
|
83
174
|
initialFocusElement?: HTMLElement | null;
|
|
84
175
|
returnFocus?: boolean;
|
|
85
176
|
}
|
|
86
177
|
|
|
178
|
+
/**
|
|
179
|
+
* Format an alpha value as a compact decimal string (e.g. `0.5`, `1`),
|
|
180
|
+
* dropping trailing zeros.
|
|
181
|
+
*/
|
|
182
|
+
export declare function formatAlpha(number: number): string;
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* Format a {@link ParsedColor} as a `hex`, `rgb`, or `hsl` string.
|
|
186
|
+
*
|
|
187
|
+
* By default the alpha channel is only included when the color is partially
|
|
188
|
+
* transparent (`alpha < 1`); override with {@link FormatColorOptions.includeAlpha}.
|
|
189
|
+
* Returned values are stable and normalized (hex is lowercase); callers may
|
|
190
|
+
* uppercase for display.
|
|
191
|
+
*/
|
|
192
|
+
export declare function formatColor(color: ParsedColor, format?: ColorFormat, options?: FormatColorOptions): string;
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* Options for {@link formatColor}.
|
|
196
|
+
*/
|
|
197
|
+
export declare interface FormatColorOptions {
|
|
198
|
+
/**
|
|
199
|
+
* Whether to include the alpha channel in the output.
|
|
200
|
+
* Defaults to `true` when the color's alpha is below 1, `false` otherwise.
|
|
201
|
+
*/
|
|
202
|
+
includeAlpha?: boolean;
|
|
203
|
+
}
|
|
204
|
+
|
|
87
205
|
export declare function generateId(prefix?: string): string;
|
|
88
206
|
|
|
89
207
|
/**
|
|
@@ -92,6 +210,12 @@ export declare function generateId(prefix?: string): string;
|
|
|
92
210
|
*/
|
|
93
211
|
export declare function hexToHsl(hex: string): HslColor;
|
|
94
212
|
|
|
213
|
+
/**
|
|
214
|
+
* Convert a hex color string to RGB channels.
|
|
215
|
+
* Accepts any input understood by {@link parseHexColor}; falls back to black on invalid input.
|
|
216
|
+
*/
|
|
217
|
+
export declare function hexToRgb(hex: string): RgbColor;
|
|
218
|
+
|
|
95
219
|
export declare interface HslColor {
|
|
96
220
|
h: number;
|
|
97
221
|
s: number;
|
|
@@ -114,10 +238,25 @@ export declare function isStandardDomEvent(eventName: string): boolean;
|
|
|
114
238
|
|
|
115
239
|
export declare function kebabCase(string: string): string;
|
|
116
240
|
|
|
241
|
+
export declare interface ListboxNavigationOptions<T> {
|
|
242
|
+
items: readonly T[];
|
|
243
|
+
currentIndex: number;
|
|
244
|
+
key: string;
|
|
245
|
+
isItemDisabled?: (item: T, index: number) => boolean;
|
|
246
|
+
fallbackIndex?: number;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
export declare interface ListboxNavigationResult {
|
|
250
|
+
handled: boolean;
|
|
251
|
+
index: number;
|
|
252
|
+
}
|
|
253
|
+
|
|
117
254
|
export declare function lockScroll(): CleanupFunction;
|
|
118
255
|
|
|
119
256
|
export declare function markAriaHidden(elementOrSelector: Element | string): CleanupFunction;
|
|
120
257
|
|
|
258
|
+
export declare function markInert(elementOrSelector: HTMLElement | string): CleanupFunction;
|
|
259
|
+
|
|
121
260
|
export declare interface MenuNavigationOptions {
|
|
122
261
|
itemSelector?: string;
|
|
123
262
|
orientation?: 'vertical' | 'horizontal';
|
|
@@ -126,6 +265,57 @@ export declare interface MenuNavigationOptions {
|
|
|
126
265
|
onActivate?: (item: HTMLElement) => void;
|
|
127
266
|
}
|
|
128
267
|
|
|
268
|
+
export declare interface NativePopoverCloseOptions {
|
|
269
|
+
onClose?: () => void;
|
|
270
|
+
hide?: boolean;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
export declare interface NativePopoverDisclosureController {
|
|
274
|
+
readonly isOpen: boolean;
|
|
275
|
+
openPopover: (options?: NativePopoverOpenOptions) => void;
|
|
276
|
+
closePopover: (options?: NativePopoverCloseOptions) => boolean;
|
|
277
|
+
togglePopover: (open: () => void, close: () => void) => void;
|
|
278
|
+
showPopover: () => void;
|
|
279
|
+
hidePopover: () => void;
|
|
280
|
+
handlePopoverToggle: (event: Event, options?: NativePopoverToggleOptions) => boolean;
|
|
281
|
+
handleFocusOut: (event: FocusEvent) => void;
|
|
282
|
+
updatePosition: () => void;
|
|
283
|
+
startAutoUpdate: () => void;
|
|
284
|
+
cleanupPopover: CleanupFunction;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
export declare interface NativePopoverDisclosureOptions {
|
|
288
|
+
reference: ElementGetter;
|
|
289
|
+
popover: ElementGetter;
|
|
290
|
+
position: TopLayerPopoverPositionOptions;
|
|
291
|
+
enabled?: () => boolean;
|
|
292
|
+
focusOut?: FocusOutDismissOptions;
|
|
293
|
+
onOpenChange?: (isOpen: boolean) => void;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
export declare interface NativePopoverOpenOptions {
|
|
297
|
+
onBeforeOpen?: () => void;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
export declare interface NativePopoverToggleOptions {
|
|
301
|
+
onClose?: () => void;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
/**
|
|
305
|
+
* Clamp an alpha value to the range 0-1. Non-finite input falls back to 1.
|
|
306
|
+
*/
|
|
307
|
+
export declare function normalizeAlpha(number: number): number;
|
|
308
|
+
|
|
309
|
+
/**
|
|
310
|
+
* Normalize a hue to an integer in the range 0-359, wrapping negatives and overflow.
|
|
311
|
+
*/
|
|
312
|
+
export declare function normalizeHue(number: number): number;
|
|
313
|
+
|
|
314
|
+
/**
|
|
315
|
+
* Clamp and round a percentage value to an integer in the range 0-100.
|
|
316
|
+
*/
|
|
317
|
+
export declare function normalizePercent(number: number): number;
|
|
318
|
+
|
|
129
319
|
export declare function onceChildrenRendered(element: Element, callback: () => void): void;
|
|
130
320
|
|
|
131
321
|
export declare function onClickOutside(elements: HTMLElement | HTMLElement[], callback: (event: PointerEvent) => void): CleanupFunction;
|
|
@@ -142,6 +332,71 @@ export declare function only(target: string[], keys: string[], ignoreCase?: bool
|
|
|
142
332
|
*/
|
|
143
333
|
export declare function onRtlChange(callback: (rtl: boolean) => void): CleanupFunction;
|
|
144
334
|
|
|
335
|
+
/**
|
|
336
|
+
* Parse an alpha channel from a raw string as found in rgba()/hsla() notation.
|
|
337
|
+
*
|
|
338
|
+
* - `undefined` or empty means "no alpha specified" and returns 1
|
|
339
|
+
* - Percentages (`50%`) must be within 0-100
|
|
340
|
+
* - Decimals must be within 0-1
|
|
341
|
+
* - Returns `null` for out-of-range or non-numeric input
|
|
342
|
+
*/
|
|
343
|
+
export declare function parseAlphaChannel(rawAlpha: string | undefined): number | null;
|
|
344
|
+
|
|
345
|
+
/**
|
|
346
|
+
* Parse any supported color string (hex, rgb/rgba, hsl/hsla) into a {@link ParsedColor}.
|
|
347
|
+
* Returns `null` for empty or unrecognized input.
|
|
348
|
+
*/
|
|
349
|
+
export declare function parseColorString(input: string | null | undefined): ParsedColor | null;
|
|
350
|
+
|
|
351
|
+
/**
|
|
352
|
+
* A fully normalized color model.
|
|
353
|
+
*
|
|
354
|
+
* - `hex` is lowercase, 6-digit, with a leading '#'
|
|
355
|
+
* - `h` is 0-359, `s`/`l` are 0-100
|
|
356
|
+
* - `alpha` is 0-1
|
|
357
|
+
*/
|
|
358
|
+
export declare interface ParsedColor {
|
|
359
|
+
hex: string;
|
|
360
|
+
h: number;
|
|
361
|
+
s: number;
|
|
362
|
+
l: number;
|
|
363
|
+
alpha: number;
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
/**
|
|
367
|
+
* Build a {@link ParsedColor} from a 6-digit hex string and optional alpha (0-1).
|
|
368
|
+
*/
|
|
369
|
+
export declare function parsedFromHex(hex: string, alphaValue?: number): ParsedColor;
|
|
370
|
+
|
|
371
|
+
/**
|
|
372
|
+
* Parse a hex color string into a {@link ParsedColor}.
|
|
373
|
+
*
|
|
374
|
+
* Accepts 3, 4, 6, or 8 digit hex, with or without a leading '#'.
|
|
375
|
+
* 4/8 digit forms carry an alpha channel. Returns `null` on invalid input.
|
|
376
|
+
*/
|
|
377
|
+
export declare function parseHexColor(input: string): ParsedColor | null;
|
|
378
|
+
|
|
379
|
+
/**
|
|
380
|
+
* Parse an `hsl()`/`hsla()` color string into a {@link ParsedColor}.
|
|
381
|
+
* Saturation and lightness must be percentages within 0-100. Returns `null` on invalid input.
|
|
382
|
+
*/
|
|
383
|
+
export declare function parseHslColor(input: string): ParsedColor | null;
|
|
384
|
+
|
|
385
|
+
/**
|
|
386
|
+
* Parse a single RGB channel from a raw string.
|
|
387
|
+
*
|
|
388
|
+
* - Percentages (`50%`) map 0-100 onto 0-255
|
|
389
|
+
* - Numbers must be within 0-255
|
|
390
|
+
* - Returns `null` for out-of-range or non-numeric input
|
|
391
|
+
*/
|
|
392
|
+
export declare function parseRgbChannel(rawChannel: string): number | null;
|
|
393
|
+
|
|
394
|
+
/**
|
|
395
|
+
* Parse an `rgb()`/`rgba()` color string into a {@link ParsedColor}.
|
|
396
|
+
* Channels may be numeric (0-255) or percentages. Returns `null` on invalid input.
|
|
397
|
+
*/
|
|
398
|
+
export declare function parseRgbColor(input: string): ParsedColor | null;
|
|
399
|
+
|
|
145
400
|
export declare type Placement = 'top' | 'top-start' | 'top-end' | 'bottom' | 'bottom-start' | 'bottom-end' | 'left' | 'left-start' | 'left-end' | 'right' | 'right-start' | 'right-end';
|
|
146
401
|
|
|
147
402
|
declare interface PositionOptions_2 {
|
|
@@ -163,6 +418,8 @@ export declare interface PositionResult {
|
|
|
163
418
|
placement: Placement;
|
|
164
419
|
}
|
|
165
420
|
|
|
421
|
+
export declare function positionTopLayerPopover(reference: HTMLElement, floating: HTMLElement, options?: TopLayerPopoverPositionOptions): PositionResult;
|
|
422
|
+
|
|
166
423
|
/**
|
|
167
424
|
* Detect whether the user prefers dark mode.
|
|
168
425
|
*
|
|
@@ -174,12 +431,129 @@ export declare interface PositionResult {
|
|
|
174
431
|
*/
|
|
175
432
|
export declare function prefersDarkMode(strategy?: DarkModeStrategy): boolean;
|
|
176
433
|
|
|
434
|
+
export declare function prefersReducedMotion(): boolean;
|
|
435
|
+
|
|
177
436
|
export declare function rejectNullValues<T>(target: T[]): Exclude<T, null>[];
|
|
178
437
|
|
|
179
438
|
export declare function rejectNullValues<T extends Record<string, unknown>>(target: T): Partial<T>;
|
|
180
439
|
|
|
440
|
+
/**
|
|
441
|
+
* Attribute a caller places on a drag handle element so the pointer controller
|
|
442
|
+
* can verify that a pointer interaction started on an actual reorder handle.
|
|
443
|
+
*/
|
|
444
|
+
export declare const REORDERABLE_LIST_HANDLE_ATTRIBUTE = "data-reorderable-list-handle";
|
|
445
|
+
|
|
446
|
+
export declare interface ReorderableListController<T> {
|
|
447
|
+
/** Register the outer list element used for default bounds and auto-scroll ancestry. */
|
|
448
|
+
setListElement: (element: HTMLElement | null | undefined) => void;
|
|
449
|
+
/** Register or unregister an item element by source index. */
|
|
450
|
+
setItemElement: (index: number, element: HTMLElement | null | undefined) => void;
|
|
451
|
+
/** Current registered item elements ordered by index. */
|
|
452
|
+
getItemElements: () => HTMLElement[];
|
|
453
|
+
/** Source indices in the order they should render for the live pointer preview. */
|
|
454
|
+
getPreviewOrder: () => number[];
|
|
455
|
+
/** Current items plus source and visual indices for the live pointer preview. */
|
|
456
|
+
getPreviewItems: () => ReorderPreviewItem<T>[];
|
|
457
|
+
/** Commit an up/down keyboard reorder. */
|
|
458
|
+
moveItem: (index: number, direction: ReorderDirection) => ReorderMove<T> | null;
|
|
459
|
+
/** Begin a pointer reorder from a registered handle event. */
|
|
460
|
+
pointerDown: (index: number, event: PointerEvent) => void;
|
|
461
|
+
/** Cancel active pointer work and remove global listeners. Idempotent. */
|
|
462
|
+
cleanup: CleanupFunction;
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
export declare interface ReorderableListOptions<T> {
|
|
466
|
+
/** Return the current ordered items. */
|
|
467
|
+
getItems: () => readonly T[];
|
|
468
|
+
/** Optional writer used by `moveItem` and pointer commits. */
|
|
469
|
+
setItems?: (items: T[]) => void;
|
|
470
|
+
/** Optional guard; reordering is skipped when it returns false. Defaults to true. */
|
|
471
|
+
canReorder?: () => boolean;
|
|
472
|
+
/** Optional outer collision bounds. Defaults to the registered list element rect. */
|
|
473
|
+
getBounds?: () => ReorderBounds | null;
|
|
474
|
+
/** Optional edge auto-scroll while pointer-dragging. Disabled by default. */
|
|
475
|
+
autoScroll?: boolean | AutoScrollerOptions;
|
|
476
|
+
/** Called whenever pointer drag state changes. */
|
|
477
|
+
onChange?: (state: ReorderableListState) => void;
|
|
478
|
+
/** Called immediately before items are written or `onReorder` fires. */
|
|
479
|
+
onBeforeReorder?: (move: ReorderMove<T>, context: ReorderCommitContext) => void;
|
|
480
|
+
/** Called after a valid keyboard or pointer reorder. */
|
|
481
|
+
onReorder?: (move: ReorderMove<T>, context: ReorderCommitContext) => void;
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
export declare type ReorderableListState = {
|
|
485
|
+
draggedIndex: number | null;
|
|
486
|
+
insertionIndex: number | null;
|
|
487
|
+
targetIndex: number | null;
|
|
488
|
+
};
|
|
489
|
+
|
|
490
|
+
export declare type ReorderBounds = {
|
|
491
|
+
left: number;
|
|
492
|
+
top: number;
|
|
493
|
+
right: number;
|
|
494
|
+
bottom: number;
|
|
495
|
+
};
|
|
496
|
+
|
|
497
|
+
export declare type ReorderCommitContext = {
|
|
498
|
+
/**
|
|
499
|
+
* True when a pointer reorder already animated to the committed target
|
|
500
|
+
* while dragging. Consumers can use this to avoid replaying the same
|
|
501
|
+
* reorder animation on release.
|
|
502
|
+
*/
|
|
503
|
+
alreadyPreviewed: boolean;
|
|
504
|
+
};
|
|
505
|
+
|
|
506
|
+
export declare type ReorderDirection = 'up' | 'down';
|
|
507
|
+
|
|
508
|
+
export declare type ReorderMove<T> = {
|
|
509
|
+
item: T;
|
|
510
|
+
fromIndex: number;
|
|
511
|
+
toIndex: number;
|
|
512
|
+
source: ReorderSource;
|
|
513
|
+
};
|
|
514
|
+
|
|
515
|
+
export declare type ReorderPreviewItem<T> = {
|
|
516
|
+
item: T;
|
|
517
|
+
/** Index in the source item array. */
|
|
518
|
+
index: number;
|
|
519
|
+
/** Index where the item is currently previewed visually. */
|
|
520
|
+
visualIndex: number;
|
|
521
|
+
};
|
|
522
|
+
|
|
523
|
+
export declare type ReorderSource = 'keyboard' | 'pointer';
|
|
524
|
+
|
|
525
|
+
export declare function resolveListboxNavigation<T>(options: ListboxNavigationOptions<T>): ListboxNavigationResult;
|
|
526
|
+
|
|
527
|
+
/**
|
|
528
|
+
* An RGB color with 0-255 integer channels.
|
|
529
|
+
*/
|
|
530
|
+
export declare interface RgbColor {
|
|
531
|
+
r: number;
|
|
532
|
+
g: number;
|
|
533
|
+
b: number;
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
/**
|
|
537
|
+
* Convert RGB channels to a lowercase 6-digit hex string with a leading '#'.
|
|
538
|
+
* Channels are clamped to 0-255.
|
|
539
|
+
*/
|
|
540
|
+
export declare function rgbToHex(r: number, g: number, b: number): string;
|
|
541
|
+
|
|
181
542
|
export declare function sameUrlPath(url1: string | URL | undefined | null, url2: string | URL | undefined | null): boolean;
|
|
182
543
|
|
|
183
544
|
export declare function supportsAnchorPositioning(): boolean;
|
|
184
545
|
|
|
546
|
+
export declare function supportsTopLayerAnchorPositioning(): boolean;
|
|
547
|
+
|
|
548
|
+
export declare function supportsWebAnimations(): boolean;
|
|
549
|
+
|
|
550
|
+
export declare interface TopLayerPopoverPositionOptions {
|
|
551
|
+
placement?: Placement;
|
|
552
|
+
offset?: number;
|
|
553
|
+
flip?: boolean;
|
|
554
|
+
matchReferenceWidth?: boolean;
|
|
555
|
+
viewportMargin?: number;
|
|
556
|
+
anchorPositioning?: boolean;
|
|
557
|
+
}
|
|
558
|
+
|
|
185
559
|
export { }
|