@bgskinner2/ts-utils 1.0.0 → 1.0.1

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/dist/index.d.cts CHANGED
@@ -1,10 +1,5 @@
1
1
  import * as react from 'react';
2
- import { ElementType, ComponentPropsWithoutRef, ReactElement, MouseEvent, ReactNode, ComponentType, ForwardRefExoticComponent, ReactPortal, Ref, RefObject } from 'react';
3
-
4
- /** @see {@link TypeDocs.TStaticMethods} */
5
- type TStaticMethods<T> = {
6
- [K in keyof T as T[K] extends (...args: any) => any ? K : never]: T[K];
7
- };
2
+ import { ElementType, ComponentPropsWithoutRef, ReactElement, MouseEvent, ReactNode, ComponentType, ForwardRefExoticComponent, ReactPortal, Ref, RefObject, CSSProperties, SyntheticEvent, RefCallback } from 'react';
8
3
 
9
4
  type TArrayLengthMutationKeys = 'splice' | 'push' | 'pop' | 'shift' | 'unshift' | number;
10
5
  type TArrayItems<T extends Array<unknown>> = T extends Array<infer TItems> ? TItems : never;
@@ -61,29 +56,6 @@ type CamelCaseFromArray<WordsArr extends string[], Options extends {
61
56
  ] ? Options['preserveConsecutiveUppercase'] extends true ? `${Capitalize<FirstWord>}${CamelCaseFromArray<Rest, Options>}` : `${Capitalize<Lowercase<FirstWord>>}${CamelCaseFromArray<Rest, Options>}` : OutputString;
62
57
  type TCamelCase<Type, Options extends TDelimiterCaseOptions = object> = Type extends string ? string extends Type ? Type : Uncapitalize<CamelCaseFromArray<TWords<Type extends Uppercase<Type> ? Lowercase<Type> : Type>, TMergeDelimiterCaseOptions<Options>>> : Type;
63
58
 
64
- declare const LOG_TYPES: readonly ["log", "warn", "error", "info", "debug", "table"];
65
- declare const REGEX_CONSTANTS: {
66
- readonly isoRegex: RegExp;
67
- readonly camelCase: RegExp;
68
- readonly kebabCase: RegExp;
69
- readonly snakeCase: RegExp;
70
- readonly hexString: RegExp;
71
- readonly hexColor: RegExp;
72
- readonly letterSeparator: RegExp;
73
- readonly camelCaseBoundary: RegExp;
74
- readonly kebabCaseBoundary: RegExp;
75
- readonly whitespace: RegExp;
76
- readonly wordBoundarySplitter: RegExp;
77
- readonly USPhoneNumber: RegExp;
78
- readonly EUPhoneNumber: RegExp;
79
- readonly genericPhoneNumber: RegExp;
80
- readonly genericEmail: RegExp;
81
- readonly emailRegex: RegExp;
82
- readonly imageSrcRegex: RegExp;
83
- readonly singleAlphabetChar: RegExp;
84
- readonly htmlDetection: RegExp;
85
- readonly stackTracePrefix: RegExp;
86
- };
87
59
  declare const ANSI_COLOR_CODES: {
88
60
  readonly reset: "\u001B[0m";
89
61
  readonly black: "\u001B[30m";
@@ -98,426 +70,7 @@ declare const ANSI_COLOR_CODES: {
98
70
  readonly underline: "\u001B[4m";
99
71
  };
100
72
 
101
- declare const VALID_DOM_PROPS: {
102
- abbr: true;
103
- accept: true;
104
- acceptCharset: true;
105
- accessKey: true;
106
- action: true;
107
- allow: true;
108
- allowFullScreen: true;
109
- allowPaymentRequest: true;
110
- alt: true;
111
- async: true;
112
- autoComplete: true;
113
- autoFocus: true;
114
- autoPlay: true;
115
- capture: true;
116
- cellPadding: true;
117
- cellSpacing: true;
118
- challenge: true;
119
- charSet: true;
120
- checked: true;
121
- cite: true;
122
- classID: true;
123
- className: true;
124
- cols: true;
125
- colSpan: true;
126
- content: true;
127
- contentEditable: true;
128
- contextMenu: true;
129
- controls: true;
130
- controlsList: true;
131
- coords: true;
132
- crossOrigin: true;
133
- data: true;
134
- dateTime: true;
135
- decoding: true;
136
- default: true;
137
- defer: true;
138
- dir: true;
139
- disabled: true;
140
- disablePictureInPicture: true;
141
- disableRemotePlayback: true;
142
- download: true;
143
- draggable: true;
144
- encType: true;
145
- enterKeyHint: true;
146
- form: true;
147
- formAction: true;
148
- formEncType: true;
149
- formMethod: true;
150
- formNoValidate: true;
151
- formTarget: true;
152
- frameBorder: true;
153
- headers: true;
154
- height: true;
155
- hidden: true;
156
- high: true;
157
- href: true;
158
- hrefLang: true;
159
- htmlFor: true;
160
- httpEquiv: true;
161
- id: true;
162
- inputMode: true;
163
- integrity: true;
164
- is: true;
165
- keyParams: true;
166
- keyType: true;
167
- kind: true;
168
- label: true;
169
- lang: true;
170
- list: true;
171
- loading: true;
172
- loop: true;
173
- low: true;
174
- marginHeight: true;
175
- marginWidth: true;
176
- max: true;
177
- maxLength: true;
178
- media: true;
179
- mediaGroup: true;
180
- method: true;
181
- min: true;
182
- minLength: true;
183
- multiple: true;
184
- muted: true;
185
- name: true;
186
- nonce: true;
187
- noValidate: true;
188
- open: true;
189
- optimum: true;
190
- pattern: true;
191
- placeholder: true;
192
- playsInline: true;
193
- poster: true;
194
- preload: true;
195
- profile: true;
196
- radioGroup: true;
197
- readOnly: true;
198
- referrerPolicy: true;
199
- rel: true;
200
- required: true;
201
- reversed: true;
202
- role: true;
203
- rows: true;
204
- rowSpan: true;
205
- sandbox: true;
206
- scope: true;
207
- scoped: true;
208
- scrolling: true;
209
- seamless: true;
210
- selected: true;
211
- shape: true;
212
- size: true;
213
- sizes: true;
214
- slot: true;
215
- span: true;
216
- spellCheck: true;
217
- src: true;
218
- srcDoc: true;
219
- srcLang: true;
220
- srcSet: true;
221
- start: true;
222
- step: true;
223
- style: true;
224
- summary: true;
225
- tabIndex: true;
226
- target: true;
227
- title: true;
228
- translate: true;
229
- type: true;
230
- useMap: true;
231
- value: true;
232
- width: true;
233
- wmode: true;
234
- wrap: true;
235
- alignmentBaseline: true;
236
- baselineShift: true;
237
- clip: true;
238
- clipPath: true;
239
- clipRule: true;
240
- color: true;
241
- colorInterpolation: true;
242
- colorInterpolationFilters: true;
243
- colorProfile: true;
244
- colorRendering: true;
245
- cursor: true;
246
- direction: true;
247
- display: true;
248
- dominantBaseline: true;
249
- enableBackground: true;
250
- fill: true;
251
- fillOpacity: true;
252
- fillRule: true;
253
- filter: true;
254
- floodColor: true;
255
- floodOpacity: true;
256
- imageRendering: true;
257
- lightingColor: true;
258
- markerEnd: true;
259
- markerMid: true;
260
- markerStart: true;
261
- mask: true;
262
- opacity: true;
263
- overflow: true;
264
- paintOrder: true;
265
- pointerEvents: true;
266
- shapeRendering: true;
267
- stopColor: true;
268
- stopOpacity: true;
269
- stroke: true;
270
- strokeDasharray: true;
271
- strokeDashoffset: true;
272
- strokeLinecap: true;
273
- strokeLinejoin: true;
274
- strokeMiterlimit: true;
275
- strokeOpacity: true;
276
- strokeWidth: true;
277
- textAnchor: true;
278
- textDecoration: true;
279
- textRendering: true;
280
- unicodeBidi: true;
281
- vectorEffect: true;
282
- visibility: true;
283
- wordSpacing: true;
284
- writingMode: true;
285
- cx: true;
286
- cy: true;
287
- d: true;
288
- dx: true;
289
- dy: true;
290
- fr: true;
291
- fx: true;
292
- fy: true;
293
- points: true;
294
- r: true;
295
- rx: true;
296
- ry: true;
297
- transform: true;
298
- version: true;
299
- viewBox: true;
300
- x: true;
301
- x1: true;
302
- x2: true;
303
- y: true;
304
- y1: true;
305
- y2: true;
306
- z: true;
307
- accumulate: true;
308
- additive: true;
309
- allowReorder: true;
310
- amplitude: true;
311
- attributeName: true;
312
- attributeType: true;
313
- autoReverse: true;
314
- begin: true;
315
- bias: true;
316
- by: true;
317
- calcMode: true;
318
- decelerate: true;
319
- diffuseConstant: true;
320
- divisor: true;
321
- dur: true;
322
- edgeMode: true;
323
- elevation: true;
324
- end: true;
325
- exponent: true;
326
- externalResourcesRequired: true;
327
- filterRes: true;
328
- filterUnits: true;
329
- from: true;
330
- in: true;
331
- in2: true;
332
- intercept: true;
333
- k: true;
334
- k1: true;
335
- k2: true;
336
- k3: true;
337
- k4: true;
338
- kernelMatrix: true;
339
- kernelUnitLength: true;
340
- keyPoints: true;
341
- keySplines: true;
342
- keyTimes: true;
343
- limitingConeAngle: true;
344
- mode: true;
345
- numOctaves: true;
346
- operator: true;
347
- order: true;
348
- orient: true;
349
- orientation: true;
350
- origin: true;
351
- pathLength: true;
352
- primitiveUnits: true;
353
- repeatCount: true;
354
- repeatDur: true;
355
- restart: true;
356
- result: true;
357
- rotate: true;
358
- scale: true;
359
- seed: true;
360
- slope: true;
361
- spacing: true;
362
- specularConstant: true;
363
- specularExponent: true;
364
- speed: true;
365
- spreadMethod: true;
366
- startOffset: true;
367
- stdDeviation: true;
368
- stitchTiles: true;
369
- surfaceScale: true;
370
- targetX: true;
371
- targetY: true;
372
- to: true;
373
- values: true;
374
- xChannelSelector: true;
375
- yChannelSelector: true;
376
- zoomAndPan: true;
377
- accentHeight: true;
378
- alphabetic: true;
379
- arabicForm: true;
380
- ascent: true;
381
- bbox: true;
382
- capHeight: true;
383
- descent: true;
384
- fontFamily: true;
385
- fontSize: true;
386
- fontSizeAdjust: true;
387
- fontStretch: true;
388
- fontStyle: true;
389
- fontVariant: true;
390
- fontWeight: true;
391
- format: true;
392
- g1: true;
393
- g2: true;
394
- glyphName: true;
395
- glyphOrientationHorizontal: true;
396
- glyphOrientationVertical: true;
397
- glyphRef: true;
398
- hanging: true;
399
- horizAdvX: true;
400
- horizOriginX: true;
401
- ideographic: true;
402
- kerning: true;
403
- lengthAdjust: true;
404
- letterSpacing: true;
405
- local: true;
406
- mathematical: true;
407
- overlinePosition: true;
408
- overlineThickness: true;
409
- panose1: true;
410
- refX: true;
411
- refY: true;
412
- renderingIntent: true;
413
- strikethroughPosition: true;
414
- strikethroughThickness: true;
415
- string: true;
416
- systemLanguage: true;
417
- tableValues: true;
418
- textLength: true;
419
- u1: true;
420
- u2: true;
421
- underlinePosition: true;
422
- underlineThickness: true;
423
- unicode: true;
424
- unicodeRange: true;
425
- unitsPerEm: true;
426
- vAlphabetic: true;
427
- vHanging: true;
428
- vIdeographic: true;
429
- vMathematical: true;
430
- vertAdvY: true;
431
- vertOriginX: true;
432
- vertOriginY: true;
433
- widths: true;
434
- xHeight: true;
435
- clipPathUnits: true;
436
- contentScriptType: true;
437
- contentStyleType: true;
438
- gradientTransform: true;
439
- gradientUnits: true;
440
- markerHeight: true;
441
- markerUnits: true;
442
- markerWidth: true;
443
- maskContentUnits: true;
444
- maskUnits: true;
445
- offset: true;
446
- patternContentUnits: true;
447
- patternTransform: true;
448
- patternUnits: true;
449
- preserveAlpha: true;
450
- preserveAspectRatio: true;
451
- requiredExtensions: true;
452
- requiredFeatures: true;
453
- viewTarget: true;
454
- xlinkActuate: true;
455
- xlinkArcrole: true;
456
- xlinkHref: true;
457
- xlinkRole: true;
458
- xlinkShow: true;
459
- xlinkTitle: true;
460
- xlinkType: true;
461
- xmlBase: true;
462
- xmlns: true;
463
- xmlnsXlink: true;
464
- xmlLang: true;
465
- xmlSpace: true;
466
- for: true;
467
- class: true;
468
- autofocus: true;
469
- children: true;
470
- dangerouslySetInnerHTML: true;
471
- key: true;
472
- ref: true;
473
- defaultValue: true;
474
- defaultChecked: true;
475
- innerHTML: true;
476
- suppressContentEditableWarning: true;
477
- suppressHydrationWarning: true;
478
- valueLink: true;
479
- onCaptured: true;
480
- precedence: true;
481
- blocking: true;
482
- autoCorrect: true;
483
- autoCapitalize: true;
484
- popover: true;
485
- popoverTarget: true;
486
- popoverTargetAction: true;
487
- inert: true;
488
- fetchpriority: true;
489
- fetchPriority: true;
490
- shadowRoot: true;
491
- ariaHasPopup: true;
492
- ariaLabel: true;
493
- ariaLabelledBy: true;
494
- about: true;
495
- datatype: true;
496
- inlist: true;
497
- prefix: true;
498
- property: true;
499
- resource: true;
500
- typeof: true;
501
- vocab: true;
502
- itemProp: true;
503
- itemScope: true;
504
- itemType: true;
505
- itemID: true;
506
- itemRef: true;
507
- autoSave: true;
508
- incremental: true;
509
- results: true;
510
- security: true;
511
- unselectable: true;
512
- on: true;
513
- option: true;
514
- fallback: true;
515
- };
516
- declare const VALID_DOM_TESTING_KEYS: string[];
517
-
518
73
  declare const HTML_TAGS: readonly ["div", "span", "a", "p", "ul", "li"];
519
- declare const SAFE_HTML_TAGS: readonly ["b", "i", "p", "ul", "li", "a", "span", "div", "br", "strong", "em", "u", "code", "pre", "blockquote"];
520
- declare const DEFAULT_KEYBOARD_CONFIG: Required<TKeyboardConfig>;
521
74
 
522
75
  declare const __brand: unique symbol;
523
76
  type Branded<T, B> = T & {
@@ -562,20 +115,7 @@ type TGetCallerLocationOptions = {
562
115
  /** Path prefix to strip from the returned line (default: process.cwd()) */
563
116
  stripPathPrefix?: string;
564
117
  };
565
- type TTableItem = {
566
- key?: string;
567
- start?: number;
568
- end?: number;
569
- };
570
- type TProcessedTableItem = {
571
- key: string | number;
572
- duration: string;
573
- };
574
118
 
575
- type TPropMap = Record<string, boolean>;
576
- type TPropCategories = {
577
- readonly [category: string]: TPropMap;
578
- };
579
119
  /**
580
120
  * A structural contract for any React component that might have
581
121
  * identification metadata.
@@ -2543,4 +2083,293 @@ declare class LinkUtils {
2543
2083
  static readonly handleHashScroll: ({ event, href, behavior, block, }: THashScrollOptions) => boolean;
2544
2084
  }
2545
2085
 
2546
- export { ANSI_COLOR_CODES, ArrayUtils, AssertionUtils, type Branded, CollectionTypeGuards, ColorUtils, ComputationUtils, CoreTypeGuards, DEFAULT_KEYBOARD_CONFIG, DebugUtils, DomUtils, FormatTypeGuards, HTML_TAGS, LOG_TYPES, LinkUtils, type ModifierKey, ObjectUtils, REGEX_CONSTANTS, ReactTypeGuards, RenamedArrayMethods, RenamedObjectMethods, SAFE_HTML_TAGS, type TAbsoluteURL, type TAnyFunction, type TArrayItems, type TArrayLengthMutationKeys, type TAssert, type TBaseImageObject, type TBufferLikeObject, type TCamelCase, type TCssRGB, type TElementLike, type TFixedLengthArray, type TGenericUrlObject, type TGetCallerLocationOptions, type THTMLTags, type THashScrollOptions, type THexByteString, type THighlighterMap, type TInternalUrl, type TJSONArrayString, type TJSONDataString, type TJSONObjectString, type TKebabCase, type TKeyboardActionResult, type TKeyboardConfig, type TLogOptions, type TLogType, type TNamedComponent, type TProcessedTableItem, type TPropCategories, type TPropMap, type TRGB, type TShortcutDefinition, type TSnakeCase, type TStaticMethods, type TTableItem, type TTypeGuard, TransformersUtils, VALID_DOM_PROPS, VALID_DOM_TESTING_KEYS, arrayFilter, arrayFilterNonNullable, arrayFlat, arrayFlatMap, arrayForEach, arrayIncludes, arrayMap, arrayReduce, assertIsAbsoluteUrl, assertIsArray, assertIsBigInt, assertIsBoolean, assertIsBufferLikeObject, assertIsCamelCase, assertIsDefined, assertIsFunction, assertIsInteger, assertIsInternalUrl, assertIsJSONArrayString, assertIsJSONObjectString, assertIsJsonString, assertIsMap, assertIsNil, assertIsNonEmptyString, assertIsNull, assertIsNumber, assertIsRGBTuple, assertIsSet, assertIsString, assertIsSymbol, assertIsUndefined, assertIsWeakMap, assertIsWeakSet, assertObject, capitalizeArray, capitalizeString, capitalizedKeys, contrastTextColor, extractRelativePath, generateKeyMap, getCallerLocation, getKeyboardAction, getLuminance, handleInternalHashScroll, hasChildren, hasDefinedKeys, hasNameMetadata, hasOnClick, hexToHSL, hexToNormalizedRGB, hexToRGB, hexToRGBShorthand, highlight, interpolateColor, isAbsoluteUrl, isArray, isArrayOf, isBigInt, isBoolean, isBufferLikeObject, isCamelCase, isComponentType, isDOMEntry, isDOMPropKey, isDarkColor, isDefined, isElementLike, isElementOfType, isEmail, isForwardRef, isFragment, isFunction, isHTMLString, isHexByteString, isInArray, isInstanceOf, isInteger, isInternalUrl, isJSONArrayString, isJSONObjectString, isJsonString, isKebabCase, isKeyInObject, isKeyOfArray, isKeyOfObject, isLumGreaterThan, isLumLessThan, isMap, isNil, isNonEmptyString, isNull, isNumber, isObject, isPhoneNumber, isPrimitive, isPromise, isPropValid, isRGBTuple, isReactElement, isReactPortal, isRecordOf, isRef, isRefObject, isSet, isSnakeCase, isString, isSymbol, isUndefined, isValidReactNode, isWeakMap, isWeakSet, logDev, normalizeImageSrc, normalizeUrl, objectEntries, objectFromEntries, objectGet, objectHas, objectKeys, objectSet, objectValues, preloadImages, serialize, stripHash, toCamelCase, toKebabCase, toKeyByField, toSnakeCase, validateRGB };
2086
+ /**
2087
+ * ## 🌐 fetchJson — Fetch and Parse JSON from a URL
2088
+ *
2089
+ * Performs a `fetch` request and attempts to parse the response as JSON.
2090
+ * Throws a detailed error if the request fails or the response is not valid JSON.
2091
+ *
2092
+ * ---
2093
+ *
2094
+ * ### Example
2095
+ *
2096
+ * ```ts
2097
+ * const data = await fetchJson<{ id: number; name: string }>(
2098
+ * 'https://api.example.com/users/1'
2099
+ * );
2100
+ * console.log(data.id, data.name);
2101
+ * ```
2102
+ *
2103
+ * @template T - Expected type of the JSON response
2104
+ * @param url - URL to fetch JSON from
2105
+ * @returns Parsed JSON data of type `T`
2106
+ * @throws Error if fetch fails or response is invalid JSON
2107
+ */
2108
+ declare function fetchJson<T = unknown>(url: string): Promise<T>;
2109
+ /**
2110
+ * ## ⏱ delay — Pause Execution for a Duration
2111
+ *
2112
+ * Returns a Promise that resolves after a specified number of milliseconds.
2113
+ * Useful for throttling, rate-limiting, or waiting between async operations.
2114
+ *
2115
+ * ---
2116
+ *
2117
+ * ### Example
2118
+ *
2119
+ * ```ts
2120
+ * await delay(1000); // Pause for 1 second
2121
+ * console.log('Done waiting!');
2122
+ * ```
2123
+ *
2124
+ * @param ms - Number of milliseconds to wait
2125
+ * @returns Promise that resolves after `ms` milliseconds
2126
+ */
2127
+ declare const delay: (ms: number) => Promise<void>;
2128
+ /**
2129
+ * ## 🔁 retry — Retry an Async Function with Exponential Backoff
2130
+ *
2131
+ * Executes an async function multiple times if it fails, with an **exponential backoff** strategy.
2132
+ * Automatically handles transient failures or rate-limiting errors.
2133
+ *
2134
+ * ---
2135
+ *
2136
+ * ### Example
2137
+ *
2138
+ * ```ts
2139
+ * const result = await retry(() => fetchJson('/api/data'), 3, 500);
2140
+ * console.log(result);
2141
+ * ```
2142
+ *
2143
+ * @template T - Return type of the async function
2144
+ * @param fn - Async function to retry
2145
+ * @param retries - Maximum number of retry attempts (default: 5)
2146
+ * @param delayMs - Base delay in milliseconds for exponential backoff (default: 500)
2147
+ * @returns Result of the async function if successful
2148
+ * @throws Last encountered error if all retries fail
2149
+ */
2150
+ declare function retry<T>(fn: () => Promise<T>, retries?: number, delayMs?: number): Promise<T>;
2151
+
2152
+ /**
2153
+ * Combines multiple React refs (callback refs or object refs) into a single ref callback.
2154
+ *
2155
+ * This is especially useful when a component needs to:
2156
+ * 1. Forward a ref to its parent via `forwardRef`
2157
+ * 2. Maintain its own internal ref for hooks like `useInView`, animations, or measurements
2158
+ *
2159
+ * The returned callback handles both:
2160
+ * - Function refs (calls the function with the new value)
2161
+ * - Object refs (assigns the `current` property)
2162
+ * - Properly supports `null` for unmounting
2163
+ *
2164
+ * @example
2165
+ * ```ts
2166
+ * const combinedRef = mergeRefs(forwardedRef, internalRef);
2167
+ * <div ref={combinedRef} />
2168
+ * ```
2169
+ *
2170
+ * @param refs - One or more React refs (callback or object refs)
2171
+ * @returns A single callback that updates all provided refs with the same value
2172
+ */
2173
+ declare const mergeRefs: <T>(...refs: (Ref<T> | undefined)[]) => RefCallback<T>;
2174
+ /**
2175
+ * Lazily evaluates the properties of an object that are functions and caches the results.
2176
+ *
2177
+ * This utility is useful when you have an object with expensive-to-compute properties
2178
+ * (functions) that you don’t want to execute until they are actually accessed. It also
2179
+ * ensures that each property is only computed **once**, even if accessed multiple times.
2180
+ *
2181
+ * The original object is **not mutated**; all computed results are stored in an internal cache.
2182
+ *
2183
+ * ### Features
2184
+ * - Lazy evaluation of function properties.
2185
+ * - Caches results for repeated access.
2186
+ * - Safe for shared or frozen objects.
2187
+ * - Works only on original string keys of the object.
2188
+ *
2189
+ * ### Example
2190
+ * ```ts
2191
+ * const config = {
2192
+ * a: 10,
2193
+ * b: () => Math.random() * 100,
2194
+ * c: () => 'computed',
2195
+ * };
2196
+ *
2197
+ * const lazyConfig = lazyProxy(config);
2198
+ *
2199
+ * console.log(lazyConfig.a); // 10
2200
+ * console.log(lazyConfig.b); // e.g., 42.3 (evaluated only once)
2201
+ * console.log(lazyConfig.b); // same value as above (cached)
2202
+ * console.log(lazyConfig.c); // 'computed'
2203
+ * ```
2204
+ *
2205
+ * ### Use Cases
2206
+ * - Configuration objects with expensive default values.
2207
+ * - Large objects where some properties are rarely used.
2208
+ * - Avoiding repeated computation in utility objects or library settings.
2209
+ * - Safe lazy initialization in complex apps without mutating original objects.
2210
+ *
2211
+ * @param obj - The object whose function properties should be lazily evaluated.
2212
+ * @returns A proxied version of the object where function properties are evaluated lazily and cached.
2213
+ */
2214
+ declare function lazyProxy<T extends Record<string, unknown>>(obj: T): T;
2215
+ /**
2216
+ * Merges CSS variables with an optional style object.
2217
+ *
2218
+ * @param vars - An object where keys are CSS variable names (like '--my-var') and values are strings
2219
+ * @param style - Optional existing style object to merge
2220
+ * @returns A CSSProperties object ready to pass to a React component
2221
+ */
2222
+ declare function mergeCssVars<T extends Record<string, string | number | undefined>>(vars: T, style?: CSSProperties): CSSProperties;
2223
+ /**
2224
+ * Merges a user-provided event handler with an internal component handler.
2225
+ *
2226
+ * The `internalHandler` will only execute if the `userHandler` does not call
2227
+ * `event.preventDefault()`. This allows users of your component to opt-out
2228
+ * of default behaviors.
2229
+ *
2230
+ * @template E - The type of the SyntheticEvent (e.g., React.MouseEvent)
2231
+ * @param userHandler - The external handler passed via props
2232
+ * @param internalHandler - The library/internal logic that should run by default
2233
+ * @returns A single function that orchestrates both calls
2234
+ *
2235
+ * @example
2236
+ * ```tsx
2237
+ * const handleClick = mergeEventHandlerClicks<React.MouseEvent>(
2238
+ * props.onClick,
2239
+ * (e) => console.log("Internal logic ran!")
2240
+ * );
2241
+ *
2242
+ * // In the component:
2243
+ * <button onClick={handleClick}>Click Me</button>
2244
+ * ```
2245
+ */
2246
+ declare function mergeEventHandlerClicks<E extends SyntheticEvent>(userHandler?: (event: E) => void, internalHandler?: (event: E) => void): (event: E) => void;
2247
+ /**
2248
+ * Automatically extracts valid DOM props from a combined props object.
2249
+ *
2250
+ * This utility prevents React warnings like: "React does not recognize the `prop` on a DOM element."
2251
+ * It works by filtering the object against a whitelist of valid HTML attributes at runtime,
2252
+ * while maintaining strict TypeScript narrowing so the return type matches the target element.
2253
+ *
2254
+ * ### Features
2255
+ * - **Auto-Filtering**: No need to manually maintain an array of keys to delete.
2256
+ * - **Type Safe**: Automatically narrows the return type to `ComponentPropsWithoutRef<T>`.
2257
+ * - **Standard Compliant**: Supports all standard HTML attributes, `data-*`, and `aria-*` props.
2258
+ *
2259
+ * ### Example
2260
+ * ```tsx
2261
+ * interface MyButtonProps extends ComponentPropsWithoutRef<'button'> {
2262
+ * mainCircleSize: number; // Custom prop: will be stripped
2263
+ * variant: 'primary'; // Custom prop: will be stripped
2264
+ * }
2265
+ *
2266
+ * const MyButton = (props: MyButtonProps) => {
2267
+ * // domProps is automatically inferred as ComponentPropsWithoutRef<'button'>
2268
+ * // 'mainCircleSize' and 'variant' are removed automatically.
2269
+ * const domProps = extractDOMProps<'button', MyButtonProps>(props);
2270
+ *
2271
+ * return <button {...domProps}>Click Me</button>;
2272
+ * };
2273
+ * ```
2274
+ *
2275
+ * @template TElement - The HTML element type (e.g., 'div', 'button', 'span')
2276
+ * @template TFullProps - The combined custom and DOM props interface
2277
+ *
2278
+ * @param props - The full props object containing both custom and DOM-valid keys.
2279
+ * @returns A cleaned object containing only valid DOM properties for the specified element.
2280
+ */
2281
+ declare function extractDOMProps<TElement extends ElementType, TFullProps extends ComponentPropsWithoutRef<TElement>>(props: TFullProps): ComponentPropsWithoutRef<TElement>;
2282
+ /**
2283
+ * Filters React children by a specific component display name.
2284
+ *
2285
+ * This utility iterates over a ReactNode tree and returns only the children
2286
+ * that are valid React elements with a `displayName` matching the provided string.
2287
+ * It is especially useful for composite components like steppers or tabs,
2288
+ * where you want to operate only on specific subcomponents while ignoring others.
2289
+ *
2290
+ * The original `children` array is **not mutated**; a new filtered array is returned.
2291
+ *
2292
+ * ### Features
2293
+ * - Type-safe filtering of React elements.
2294
+ * - Skips non-React elements automatically.
2295
+ * - Returns a typed array of `ReactElement` for further processing.
2296
+ *
2297
+ * ### Example
2298
+ * ```tsx
2299
+ * const steps = filterChildrenByDisplayName(children, 'StepperStep');
2300
+ * steps.forEach(step => console.log(step.props));
2301
+ * ```
2302
+ *
2303
+ * ### Use Cases
2304
+ * - Stepper components: only extract `StepperStep` children for layout/logic.
2305
+ * - Tab components: only process `TabPanel` children.
2306
+ * - Any composite React component requiring selective child processing.
2307
+ *
2308
+ * @param children - The ReactNode children to filter.
2309
+ * @param displayName - The displayName of the component type to include.
2310
+ * @returns An array of ReactElement matching the given displayName.
2311
+ */
2312
+ declare function filterChildrenByDisplayName<T extends ReactNode>(children: T, displayName: string): ReactElement[];
2313
+
2314
+ declare const ProcessorUtils: {
2315
+ readonly fetchJson: typeof fetchJson;
2316
+ readonly delay: (ms: number) => Promise<void>;
2317
+ readonly retry: typeof retry;
2318
+ };
2319
+ declare const ReactProcessorUtils: {
2320
+ readonly mergeRefs: <T>(...refs: (react.Ref<T> | undefined)[]) => react.RefCallback<T>;
2321
+ readonly lazyProxy: typeof lazyProxy;
2322
+ readonly mergeCssVars: typeof mergeCssVars;
2323
+ readonly mergeEventHandlerClicks: typeof mergeEventHandlerClicks;
2324
+ readonly extractDOMProps: typeof extractDOMProps;
2325
+ readonly filterChildrenByDisplayName: typeof filterChildrenByDisplayName;
2326
+ };
2327
+ /**
2328
+ * =============================================================================
2329
+ * Processors Folder / Module
2330
+ * =============================================================================
2331
+ *
2332
+ * ## Role / Purpose
2333
+ *
2334
+ * **Role:**
2335
+ * The `processors/` folder contains reusable functions that process, transform,
2336
+ * or handle data in a meaningful way. These functions are generally stateless,
2337
+ * deterministic, and focused on specific operations or domains.
2338
+ *
2339
+ * - Responsible for handling transformations, computations, and controlled
2340
+ * side-effects (e.g., network calls, React ref handling, HTML processing).
2341
+ * - Exists to provide a centralized, organized toolbox of utility functions
2342
+ * that can be reused across the application.
2343
+ *
2344
+ * ---
2345
+ *
2346
+ * ## Guidelines
2347
+ *
2348
+ * **✅ What goes here:**
2349
+ * - Pure utility functions that transform or process data
2350
+ * - Async helpers and network-related utilities (fetch, retry, delay)
2351
+ * - Domain-specific processors: HTML, strings, URLs, React refs, time/durations
2352
+ * - Example: `function makeStringKebabCase(str: string): string {...}`
2353
+ * - Example: `function extractFirstImageSrc(html: string): string | null {...}`
2354
+ * - Example: `async function fetchJson<T>(url: string): Promise<T> {...}`
2355
+ *
2356
+ * **🚫 What does NOT go here:**
2357
+ * - Runtime assertion functions or validators
2358
+ * - Type guards or type-refinement functions
2359
+ * - Generic array/object helpers (use `common/` instead)
2360
+ *
2361
+ * ---
2362
+ *
2363
+ * ## Benefits
2364
+ *
2365
+ * - Groups all data-processing utilities in one place for discoverability
2366
+ * - Encourages consistent patterns for transformations and side-effect handling
2367
+ * - Improves maintainability by separating processors from guards, assertions,
2368
+ * and generic helpers
2369
+ * - Makes it easier to scale and add new processors without polluting unrelated
2370
+ * folders
2371
+ * - Optional link: Related folders include `guards/`, `common/`, and `transformers/`
2372
+ *
2373
+ */
2374
+
2375
+ export { ArrayUtils, AssertionUtils, CollectionTypeGuards, ColorUtils, ComputationUtils, CoreTypeGuards, DebugUtils, DomUtils, FormatTypeGuards, LinkUtils, ObjectUtils, ProcessorUtils, ReactProcessorUtils, ReactTypeGuards, RenamedArrayMethods, RenamedObjectMethods, TransformersUtils, arrayFilter, arrayFilterNonNullable, arrayFlat, arrayFlatMap, arrayForEach, arrayIncludes, arrayMap, arrayReduce, assertIsAbsoluteUrl, assertIsArray, assertIsBigInt, assertIsBoolean, assertIsBufferLikeObject, assertIsCamelCase, assertIsDefined, assertIsFunction, assertIsInteger, assertIsInternalUrl, assertIsJSONArrayString, assertIsJSONObjectString, assertIsJsonString, assertIsMap, assertIsNil, assertIsNonEmptyString, assertIsNull, assertIsNumber, assertIsRGBTuple, assertIsSet, assertIsString, assertIsSymbol, assertIsUndefined, assertIsWeakMap, assertIsWeakSet, assertObject, capitalizeArray, capitalizeString, capitalizedKeys, contrastTextColor, delay, extractDOMProps, extractRelativePath, fetchJson, filterChildrenByDisplayName, generateKeyMap, getCallerLocation, getKeyboardAction, getLuminance, handleInternalHashScroll, hasChildren, hasDefinedKeys, hasNameMetadata, hasOnClick, hexToHSL, hexToNormalizedRGB, hexToRGB, hexToRGBShorthand, highlight, interpolateColor, isAbsoluteUrl, isArray, isArrayOf, isBigInt, isBoolean, isBufferLikeObject, isCamelCase, isComponentType, isDOMEntry, isDOMPropKey, isDarkColor, isDefined, isElementLike, isElementOfType, isEmail, isForwardRef, isFragment, isFunction, isHTMLString, isHexByteString, isInArray, isInstanceOf, isInteger, isInternalUrl, isJSONArrayString, isJSONObjectString, isJsonString, isKebabCase, isKeyInObject, isKeyOfArray, isKeyOfObject, isLumGreaterThan, isLumLessThan, isMap, isNil, isNonEmptyString, isNull, isNumber, isObject, isPhoneNumber, isPrimitive, isPromise, isPropValid, isRGBTuple, isReactElement, isReactPortal, isRecordOf, isRef, isRefObject, isSet, isSnakeCase, isString, isSymbol, isUndefined, isValidReactNode, isWeakMap, isWeakSet, lazyProxy, logDev, mergeCssVars, mergeEventHandlerClicks, mergeRefs, normalizeImageSrc, normalizeUrl, objectEntries, objectFromEntries, objectGet, objectHas, objectKeys, objectSet, objectValues, preloadImages, retry, serialize, stripHash, toCamelCase, toKebabCase, toKeyByField, toSnakeCase, validateRGB };