advanced-filter-system 1.6.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.
- package/README.md +1 -1
- package/dist/afs.legacy.js +1 -1
- package/dist/afs.legacy.js.map +1 -1
- package/dist/afs.modern.js +1 -1
- package/dist/afs.modern.js.map +1 -1
- package/package.json +1 -1
- package/src/types/core.d.ts +20 -5
- package/src/types/features.d.ts +48 -52
- package/src/types/index.d.ts +115 -45
- package/src/types/pagination.ts +0 -5
- package/src/types/utils.d.ts +17 -110
package/src/types/utils.d.ts
CHANGED
|
@@ -1,128 +1,35 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Utility Types for Advanced Filter System
|
|
3
|
-
* @fileoverview TypeScript definitions for
|
|
3
|
+
* @fileoverview TypeScript definitions for the helpers exported from src/utils
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
|
|
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
|
-
|
|
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
|
-
|
|
16
|
+
limit: number
|
|
15
17
|
): (...args: Parameters<T>) => void;
|
|
16
18
|
|
|
17
|
-
|
|
19
|
+
/** Parse a date string (optionally with a format hint). */
|
|
20
|
+
export declare function parseDate(dateStr: string, format?: string): Date | null;
|
|
18
21
|
|
|
19
|
-
|
|
20
|
-
|
|
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
|
-
|
|
25
|
-
|
|
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
|
-
|
|
68
|
-
|
|
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
|
-
|
|
126
|
-
|
|
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>;
|