advanced-filter-system 1.7.0 → 1.8.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.
@@ -1,128 +1,35 @@
1
1
  /**
2
2
  * Utility Types for Advanced Filter System
3
- * @fileoverview TypeScript definitions for utility functions
3
+ * @fileoverview TypeScript definitions for the helpers exported from src/utils
4
4
  */
5
5
 
6
- // Utility Functions
6
+ /** Debounce a function; with immediate=true it fires on the leading edge. */
7
7
  export declare function debounce<T extends (...args: any[]) => any>(
8
8
  func: T,
9
- delay: number
9
+ wait: number,
10
+ immediate?: boolean
10
11
  ): (...args: Parameters<T>) => void;
11
12
 
13
+ /** Throttle a function to at most once per `limit` ms. */
12
14
  export declare function throttle<T extends (...args: any[]) => any>(
13
15
  func: T,
14
- delay: number
16
+ limit: number
15
17
  ): (...args: Parameters<T>) => void;
16
18
 
17
- export declare function normalizeText(text: string): string;
19
+ /** Parse a date string (optionally with a format hint). */
20
+ export declare function parseDate(dateStr: string, format?: string): Date | null;
18
21
 
19
- export declare function getDataAttribute(
20
- element: HTMLElement,
21
- key: string
22
- ): string | null;
22
+ /** Read a computed style property from an element. */
23
+ export declare function getStyle(element: HTMLElement, property: string): string;
23
24
 
24
- export declare function setDataAttribute(
25
- element: HTMLElement,
26
- key: string,
27
- value: string
28
- ): void;
29
-
30
- export declare function parseDate(
31
- dateString: string,
32
- format?: string
33
- ): Date | null;
34
-
35
- export declare function formatDate(
36
- date: Date,
37
- format?: string
38
- ): string;
39
-
40
- export declare function parseNumber(
41
- value: string | number
42
- ): number | null;
43
-
44
- export declare function escapeRegExp(string: string): string;
45
-
46
- export declare function createElementFromHTML(html: string): HTMLElement;
47
-
48
- export declare function getElementPosition(element: HTMLElement): {
49
- top: number;
50
- left: number;
51
- width: number;
52
- height: number;
53
- };
54
-
55
- export declare function isElementVisible(element: HTMLElement): boolean;
56
-
57
- export declare function scrollToElement(
58
- element: HTMLElement,
59
- options?: {
60
- behavior?: 'smooth' | 'auto';
61
- offset?: number;
62
- }
63
- ): void;
25
+ /** Whether an element matches a CSS selector. */
26
+ export declare function matches(element: HTMLElement, selector: string): boolean;
64
27
 
28
+ /** Deep-clone a plain value/object. */
65
29
  export declare function deepClone<T>(obj: T): T;
66
30
 
67
- export declare function deepMerge<T extends object>(
68
- target: T,
69
- source: Partial<T>
70
- ): T;
71
-
72
- export declare function generateId(prefix?: string): string;
73
-
74
- export declare function removeElement(element: HTMLElement): void;
75
-
76
- export declare function addClass(
77
- element: HTMLElement,
78
- className: string
79
- ): void;
80
-
81
- export declare function removeClass(
82
- element: HTMLElement,
83
- className: string
84
- ): void;
85
-
86
- export declare function toggleClass(
87
- element: HTMLElement,
88
- className: string,
89
- force?: boolean
90
- ): void;
91
-
92
- export declare function hasClass(
93
- element: HTMLElement,
94
- className: string
95
- ): boolean;
96
-
97
- // Type Guards
98
- export declare function isString(value: any): value is string;
99
- export declare function isNumber(value: any): value is number;
100
- export declare function isBoolean(value: any): value is boolean;
101
- export declare function isFunction(value: any): value is Function;
102
- export declare function isObject(value: any): value is object;
103
- export declare function isArray(value: any): value is Array<any>;
104
- export declare function isDate(value: any): value is Date;
105
- export declare function isHTMLElement(value: any): value is HTMLElement;
106
- export declare function isNodeList(value: any): value is NodeList;
107
-
108
- // Constants
109
- export declare const DEFAULT_DEBOUNCE_TIME: number;
110
- export declare const DEFAULT_ANIMATION_DURATION: number;
111
- export declare const DEFAULT_DATE_FORMAT: string;
112
- export declare const CSS_CLASS_PREFIX: string;
113
-
114
- // Error Classes
115
- export declare class AFSError extends Error {
116
- constructor(message: string, code?: string);
117
- readonly code?: string;
118
- }
119
-
120
- export declare class ValidationError extends AFSError {
121
- constructor(message: string, field?: string);
122
- readonly field?: string;
123
- }
31
+ /** Generate a unique id, optionally prefixed. */
32
+ export declare function uniqueId(prefix?: string): string;
124
33
 
125
- export declare class ConfigurationError extends AFSError {
126
- constructor(message: string, option?: string);
127
- readonly option?: string;
128
- }
34
+ /** Type guard for plain objects (not arrays, not class instances). */
35
+ export declare function isPlainObject(value: any): value is Record<string, any>;