selective-ui 1.3.1 → 1.4.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.
Files changed (70) hide show
  1. package/dist/selective-ui.css +0 -6
  2. package/dist/selective-ui.css.map +1 -1
  3. package/dist/selective-ui.esm.js +271 -559
  4. package/dist/selective-ui.esm.js.map +1 -1
  5. package/dist/selective-ui.esm.min.js +2 -2
  6. package/dist/selective-ui.esm.min.js.br +0 -0
  7. package/dist/selective-ui.min.css +1 -1
  8. package/dist/selective-ui.min.css.br +0 -0
  9. package/dist/selective-ui.min.js +2 -2
  10. package/dist/selective-ui.min.js.br +0 -0
  11. package/dist/selective-ui.umd.js +273 -561
  12. package/dist/selective-ui.umd.js.map +1 -1
  13. package/package.json +12 -12
  14. package/src/ts/adapter/mixed-adapter.ts +147 -68
  15. package/src/ts/components/accessorybox.ts +14 -11
  16. package/src/ts/components/directive.ts +1 -1
  17. package/src/ts/components/option-handle.ts +12 -9
  18. package/src/ts/components/placeholder.ts +5 -5
  19. package/src/ts/components/popup/empty-state.ts +5 -5
  20. package/src/ts/components/popup/loading-state.ts +5 -5
  21. package/src/ts/components/popup/popup.ts +138 -76
  22. package/src/ts/components/searchbox.ts +17 -13
  23. package/src/ts/components/selectbox.ts +258 -83
  24. package/src/ts/core/base/adapter.ts +39 -14
  25. package/src/ts/core/base/fenwick.ts +3 -2
  26. package/src/ts/core/base/lifecycle.ts +14 -4
  27. package/src/ts/core/base/model.ts +17 -15
  28. package/src/ts/core/base/recyclerview.ts +7 -5
  29. package/src/ts/core/base/view.ts +10 -5
  30. package/src/ts/core/base/virtual-recyclerview.ts +89 -37
  31. package/src/ts/core/model-manager.ts +48 -21
  32. package/src/ts/core/search-controller.ts +174 -56
  33. package/src/ts/global.ts +5 -8
  34. package/src/ts/index.ts +2 -2
  35. package/src/ts/models/group-model.ts +33 -8
  36. package/src/ts/models/option-model.ts +60 -19
  37. package/src/ts/services/dataset-observer.ts +6 -3
  38. package/src/ts/services/ea-observer.ts +1 -1
  39. package/src/ts/services/effector.ts +22 -12
  40. package/src/ts/services/refresher.ts +7 -3
  41. package/src/ts/services/resize-observer.ts +24 -11
  42. package/src/ts/services/select-observer.ts +2 -2
  43. package/src/ts/types/components/popup.type.ts +18 -1
  44. package/src/ts/types/components/searchbox.type.ts +43 -30
  45. package/src/ts/types/components/state.box.type.ts +1 -1
  46. package/src/ts/types/core/base/adapter.type.ts +13 -5
  47. package/src/ts/types/core/base/lifecycle.type.ts +1 -2
  48. package/src/ts/types/core/base/model.type.ts +3 -3
  49. package/src/ts/types/core/base/recyclerview.type.ts +7 -5
  50. package/src/ts/types/core/base/view.type.ts +6 -6
  51. package/src/ts/types/core/base/virtual-recyclerview.type.ts +45 -46
  52. package/src/ts/types/core/search-controller.type.ts +18 -2
  53. package/src/ts/types/css.d.ts +1 -0
  54. package/src/ts/types/plugins/plugin.type.ts +2 -2
  55. package/src/ts/types/services/effector.type.ts +25 -25
  56. package/src/ts/types/services/resize-observer.type.ts +23 -12
  57. package/src/ts/types/utils/callback-scheduler.type.ts +2 -2
  58. package/src/ts/types/utils/ievents.type.ts +1 -1
  59. package/src/ts/types/utils/istorage.type.ts +62 -60
  60. package/src/ts/types/utils/libs.type.ts +19 -17
  61. package/src/ts/types/utils/selective.type.ts +6 -3
  62. package/src/ts/types/views/view.group.type.ts +9 -5
  63. package/src/ts/types/views/view.option.type.ts +39 -17
  64. package/src/ts/utils/callback-scheduler.ts +12 -7
  65. package/src/ts/utils/ievents.ts +12 -5
  66. package/src/ts/utils/istorage.ts +5 -3
  67. package/src/ts/utils/libs.ts +122 -43
  68. package/src/ts/utils/selective.ts +15 -8
  69. package/src/ts/views/group-view.ts +11 -9
  70. package/src/ts/views/option-view.ts +37 -18
@@ -14,8 +14,8 @@ import { OptionModel } from "src/ts/models/option-model";
14
14
  * Represents the DOM elements used in the SearchBox component.
15
15
  */
16
16
  export type SearchBoxTags = {
17
- SearchBox: HTMLDivElement; // Container for the search box
18
- SearchInput: HTMLInputElement; // Input field for search queries
17
+ SearchBox: HTMLDivElement; // Container for the search box
18
+ SearchInput: HTMLInputElement; // Input field for search queries
19
19
  };
20
20
 
21
21
  /**
@@ -35,7 +35,7 @@ export type NavigateHandler = (direction: 1 | -1) => void;
35
35
  * Represents the DOM elements used in the SelectBox component.
36
36
  */
37
37
  export type SelectBoxTags = {
38
- ViewPanel: HTMLDivElement; // Panel that displays selectable options
38
+ ViewPanel: HTMLDivElement; // Panel that displays selectable options
39
39
  };
40
40
 
41
41
  /**
@@ -43,46 +43,46 @@ export type SelectBoxTags = {
43
43
  * Combines mounted view result with additional services and components.
44
44
  */
45
45
  export type ContainerRuntime = MountViewResult<SelectBoxTags> & {
46
- placeholder: PlaceHolder; // Placeholder manager
47
- directive: Directive; // Directive handler for dynamic behavior
48
- searchbox: SearchBox; // Search box component
49
- popup: Popup; // Popup component for dropdown
50
- effector: EffectorInterface; // Effector for state management
51
- targetElement: HTMLSelectElement; // Original select element
52
- accessorybox: AccessoryBox; // Accessory box for extra UI elements
46
+ placeholder: PlaceHolder; // Placeholder manager
47
+ directive: Directive; // Directive handler for dynamic behavior
48
+ searchbox: SearchBox; // Search box component
49
+ popup: Popup; // Popup component for dropdown
50
+ effector: EffectorInterface; // Effector for state management
51
+ targetElement: HTMLSelectElement; // Original select element
52
+ accessorybox: AccessoryBox; // Accessory box for extra UI elements
53
53
  searchController: SearchController; // Controller for search logic
54
- selectObserver: SelectObserver; // Observer for selection changes
55
- datasetObserver: DatasetObserver; // Observer for dataset updates
54
+ selectObserver: SelectObserver; // Observer for selection changes
55
+ datasetObserver: DatasetObserver; // Observer for dataset updates
56
56
  };
57
57
 
58
58
  /**
59
59
  * Interface defining actions and properties for the SelectBox component.
60
60
  */
61
61
  export interface SelectBoxAction {
62
- targetElement: HTMLSelectElement; // Target Select element
62
+ targetElement: HTMLSelectElement; // Target Select element
63
63
 
64
- placeholder: string; // Placeholder text
65
- oldValue: unknown; // Previous value before change
64
+ placeholder: string; // Placeholder text
65
+ oldValue: unknown; // Previous value before change
66
66
 
67
- value: string | string[]; // Current selected value(s)
68
- valueArray: string[]; // Selected values as an array
69
- valueString: string; // Selected values as a single string
67
+ value: string | string[]; // Current selected value(s)
68
+ valueArray: string[]; // Selected values as an array
69
+ valueString: string; // Selected values as a single string
70
70
 
71
- valueOptions: OptionModel[]; // Selected option models
72
- mask: string[]; // Masked values for filtering
73
- valueText: string | string[]; // Display text for selected values
71
+ valueOptions: OptionModel[]; // Selected option models
72
+ mask: string[]; // Masked values for filtering
73
+ valueText: string | string[]; // Display text for selected values
74
74
 
75
- isOpen: boolean; // Indicates if the dropdown is open
75
+ isOpen: boolean; // Indicates if the dropdown is open
76
76
 
77
- disabled: boolean; // Indicates if the component is disabled
78
- readonly: boolean; // Indicates if the component is read-only
79
- visible: boolean; // Indicates if the component is visible
77
+ disabled: boolean; // Indicates if the component is disabled
78
+ readonly: boolean; // Indicates if the component is read-only
79
+ visible: boolean; // Indicates if the component is visible
80
80
 
81
81
  /**
82
82
  * Get parent of self
83
83
  * @param evtToken - Optional event token for tracking.
84
84
  */
85
- getParent(evtToken?: unknown): HTMLElement
85
+ getParent(evtToken?: unknown): HTMLElement;
86
86
 
87
87
  /**
88
88
  * Get dataset from selected options
@@ -90,7 +90,11 @@ export interface SelectBoxAction {
90
90
  * @param strDataset - Property to find
91
91
  * @param isArray - Keep array or return once
92
92
  */
93
- valueDataset(evtToken?: unknown, strDataset?: string, isArray?: boolean): any[] | string
93
+ valueDataset(
94
+ evtToken?: unknown,
95
+ strDataset?: string,
96
+ isArray?: boolean,
97
+ ): any[] | string;
94
98
 
95
99
  /**
96
100
  * Select all available options.
@@ -113,7 +117,12 @@ export interface SelectBoxAction {
113
117
  * @param trigger - Whether to trigger change events.
114
118
  * @param force - Whether to force the update.
115
119
  */
116
- setValue(evtToken: unknown | null, value: unknown, trigger?: boolean, force?: boolean): void;
120
+ setValue(
121
+ evtToken?: unknown,
122
+ value?: unknown,
123
+ trigger?: boolean,
124
+ force?: boolean,
125
+ ): void;
117
126
 
118
127
  /**
119
128
  * Load options for the SelectBox, typically from an AJAX source.
@@ -156,7 +165,11 @@ export interface SelectBoxAction {
156
165
  * @param evtName - Name of the event.
157
166
  * @param handle - Callback function for the event.
158
167
  */
159
- on(evtToken: unknown, evtName: string, handle: (...args: any[]) => any): void;
168
+ on(
169
+ evtToken: unknown,
170
+ evtName: string,
171
+ handle: (...args: any[]) => any,
172
+ ): void;
160
173
 
161
174
  /**
162
175
  * Perform an AJAX request.
@@ -170,4 +183,4 @@ export interface SelectBoxAction {
170
183
  * @param evtToken - Event token for tracking.
171
184
  */
172
185
  loadAjax(evtToken: unknown, obj: unknown): void;
173
- }
186
+ }
@@ -3,4 +3,4 @@
3
3
  * - "notfound": No matching results found.
4
4
  * - "nodata": No data available to display.
5
5
  */
6
- export type EmptyStateType = "notfound" | "nodata";
6
+ export type EmptyStateType = "notfound" | "nodata";
@@ -6,7 +6,9 @@ import type { ModelContract } from "./model.type";
6
6
  *
7
7
  * @template TItem - A model type that implements ModelContract.
8
8
  */
9
- export interface AdapterContract<TItem extends ModelContract<any, any>> extends Lifecycle {
9
+ export interface AdapterContract<
10
+ TItem extends ModelContract<any, any>,
11
+ > extends Lifecycle {
10
12
  /**
11
13
  * List of items managed by the adapter.
12
14
  * These items are rendered or updated in the associated container.
@@ -64,7 +66,7 @@ export interface AdapterContract<TItem extends ModelContract<any, any>> extends
64
66
  * @param item - The item for which the viewer is being created.
65
67
  * @returns An adapter-specific viewer instance.
66
68
  */
67
- viewHolder(parent: HTMLElement, item: TItem): unknown;
69
+ viewHolder?(parent: HTMLElement, item: TItem): unknown;
68
70
 
69
71
  /**
70
72
  * Bind an item to its viewer at a given position.
@@ -83,7 +85,10 @@ export interface AdapterContract<TItem extends ModelContract<any, any>> extends
83
85
  * @param propName - The name of the property being changed.
84
86
  * @param callback - The handler invoked with change context/args.
85
87
  */
86
- onPropChanging(propName: string, callback: (...args: unknown[]) => void): void;
88
+ onPropChanging(
89
+ propName: string,
90
+ callback: (...args: unknown[]) => void,
91
+ ): void;
87
92
 
88
93
  /**
89
94
  * Register a post-change callback for a given property.
@@ -92,7 +97,10 @@ export interface AdapterContract<TItem extends ModelContract<any, any>> extends
92
97
  * @param propName - The name of the property that changed.
93
98
  * @param callback - The handler invoked with change context/args.
94
99
  */
95
- onPropChanged(propName: string, callback: (...args: unknown[]) => void): void;
100
+ onPropChanged(
101
+ propName: string,
102
+ callback: (...args: unknown[]) => void,
103
+ ): void;
96
104
 
97
105
  /**
98
106
  * Trigger the post-change pipeline for a property.
@@ -127,4 +135,4 @@ export interface AdapterContract<TItem extends ModelContract<any, any>> extends
127
135
  * @param items - The incoming items to process/update.
128
136
  */
129
137
  updateData(items: TItem[]): void;
130
- }
138
+ }
@@ -1,4 +1,3 @@
1
-
2
1
  /**
3
2
  * Enumerates the finite lifecycle states used across core classes (e.g., View/Model).
4
3
  *
@@ -59,4 +58,4 @@ export interface LifecycleHooks {
59
58
  export type LifecycleHookContext = {
60
59
  state: LifecycleState;
61
60
  prevState: LifecycleState;
62
- };
61
+ };
@@ -11,13 +11,13 @@ export interface ModelContract<TTarget, TView> extends Lifecycle {
11
11
  * The target element that this model is bound to.
12
12
  * Can be null if not yet initialized.
13
13
  */
14
- targetElement: TTarget | null;
14
+ targetElement?: TTarget;
15
15
 
16
16
  /**
17
17
  * The view associated with the target element.
18
18
  * Can be null if the view is not yet created.
19
19
  */
20
- view: TView | null;
20
+ view?: TView;
21
21
 
22
22
  /**
23
23
  * The value represented by this model.
@@ -39,4 +39,4 @@ export interface ModelContract<TTarget, TView> extends Lifecycle {
39
39
  * Indicates whether the model has been vissibly.
40
40
  */
41
41
  visible?: boolean;
42
- }
42
+ }
@@ -6,18 +6,20 @@ import { AdapterContract } from "./adapter.type";
6
6
  *
7
7
  * @template TAdapter - A concrete adapter type that implements AdapterContract.
8
8
  */
9
- export interface RecyclerViewContract<TAdapter extends AdapterContract<any>> extends Lifecycle {
9
+ export interface RecyclerViewContract<
10
+ TAdapter extends AdapterContract<any>,
11
+ > extends Lifecycle {
10
12
  /**
11
13
  * The container element that hosts all item views.
12
14
  * Can be null until `setView` is called.
13
15
  */
14
- viewElement: HTMLElement | null;
16
+ viewElement?: HTMLElement;
15
17
 
16
18
  /**
17
19
  * The adapter instance responsible for providing and binding item views.
18
20
  * Can be null until `setAdapter` is called.
19
21
  */
20
- adapter: TAdapter | null;
22
+ adapter?: TAdapter;
21
23
 
22
24
  /**
23
25
  * Attach an adapter and refresh the view accordingly.
@@ -42,8 +44,8 @@ export interface RecyclerViewContract<TAdapter extends AdapterContract<any>> ext
42
44
  /**
43
45
  * Refresh the rendered views to reflect current adapter data/state.
44
46
  * May perform diffing, partial updates, or full re-binding.
45
- *
47
+ *
46
48
  * @param isUpdate - Indicates if this refresh is due to an update operation.
47
49
  */
48
50
  refresh(isUpdate: boolean): void;
49
- }
51
+ }
@@ -1,4 +1,3 @@
1
-
2
1
  import { Lifecycle } from "src/ts/core/base/lifecycle";
3
2
  import { MountViewResult } from "../../utils/libs.type";
4
3
 
@@ -20,8 +19,9 @@ import { MountViewResult } from "../../utils/libs.type";
20
19
  * }
21
20
  * ```
22
21
  */
23
- export interface ViewContract<TTags extends Record<string, HTMLElement>> extends Lifecycle {
24
-
22
+ export interface ViewContract<
23
+ TTags extends Record<string, HTMLElement>,
24
+ > extends Lifecycle {
25
25
  /**
26
26
  * The parent DOM element into which the view is mounted.
27
27
  *
@@ -29,7 +29,7 @@ export interface ViewContract<TTags extends Record<string, HTMLElement>> extends
29
29
  * - `null` before the view is mounted
30
30
  * - Set once the view is attached to the DOM
31
31
  */
32
- parent: HTMLElement | null;
32
+ parent?: HTMLElement;
33
33
 
34
34
  /**
35
35
  * Internal representation of the mounted view returned by `mountNode`.
@@ -40,7 +40,7 @@ export interface ViewContract<TTags extends Record<string, HTMLElement>> extends
40
40
  *
41
41
  * Will be `null` if the view has not been mounted yet.
42
42
  */
43
- view: MountViewResult<TTags> | null;
43
+ view?: MountViewResult<TTags>;
44
44
 
45
45
  /**
46
46
  * Returns the root HTMLElement of the mounted view.
@@ -52,4 +52,4 @@ export interface ViewContract<TTags extends Record<string, HTMLElement>> extends
52
52
  * @throws {Error} If the view has not been mounted or initialized.
53
53
  */
54
54
  getView(): HTMLElement;
55
- }
55
+ }
@@ -1,43 +1,42 @@
1
-
2
1
  /**
3
2
  * Configuration options for the virtualized recycler view.
4
3
  * Controls which element is used for scrolling, sizing heuristics, and how many
5
4
  * extra items are rendered outside the viewport to reduce popping.
6
5
  */
7
6
  export type VirtualOptions = {
8
- /**
9
- * The scroll container element used to measure scroll position and viewport.
10
- * If omitted, the implementation may default to the nearest scrollable parent
11
- * or the window (depending on your mount strategy).
12
- */
13
- scrollEl?: HTMLElement;
7
+ /**
8
+ * The scroll container element used to measure scroll position and viewport.
9
+ * If omitted, the implementation may default to the nearest scrollable parent
10
+ * or the window (depending on your mount strategy).
11
+ */
12
+ scrollEl?: HTMLElement;
14
13
 
15
- /**
16
- * Estimated height (in pixels) for a single item.
17
- * Used as a heuristic before real measurements are available (especially when
18
- * `dynamicHeights` is enabled) to compute the total scrollable size.
19
- */
20
- estimateItemHeight?: number;
14
+ /**
15
+ * Estimated height (in pixels) for a single item.
16
+ * Used as a heuristic before real measurements are available (especially when
17
+ * `dynamicHeights` is enabled) to compute the total scrollable size.
18
+ */
19
+ estimateItemHeight?: number;
21
20
 
22
- /**
23
- * Number of extra items to render above and below the visible range.
24
- * Higher values reduce blanking during fast scroll at the cost of more DOM work.
25
- */
26
- overscan?: number;
21
+ /**
22
+ * Number of extra items to render above and below the visible range.
23
+ * Higher values reduce blanking during fast scroll at the cost of more DOM work.
24
+ */
25
+ overscan?: number;
27
26
 
28
- /**
29
- * Enables measuring and caching actual item heights.
30
- * When `true`, the recycler view supports variable-height items instead of
31
- * assuming a fixed height for all items.
32
- */
33
- dynamicHeights?: boolean;
27
+ /**
28
+ * Enables measuring and caching actual item heights.
29
+ * When `true`, the recycler view supports variable-height items instead of
30
+ * assuming a fixed height for all items.
31
+ */
32
+ dynamicHeights?: boolean;
34
33
 
35
- /**
36
- * Enables adaptive estimation based on observed item measurements.
37
- * When `true`, `estimateItemHeight` may be refined over time to improve
38
- * scrollbar accuracy and reduce layout jumps.
39
- */
40
- adaptiveEstimate?: boolean;
34
+ /**
35
+ * Enables adaptive estimation based on observed item measurements.
36
+ * When `true`, `estimateItemHeight` may be refined over time to improve
37
+ * scrollbar accuracy and reduce layout jumps.
38
+ */
39
+ adaptiveEstimate?: boolean;
41
40
  };
42
41
 
43
42
  /**
@@ -46,21 +45,21 @@ export type VirtualOptions = {
46
45
  * manipulate padding and host the rendered item elements.
47
46
  */
48
47
  export type VirtualRecyclerViewTags = {
49
- /**
50
- * Top spacer element that simulates the height of items scrolled past.
51
- * Its height is adjusted to keep the visible items aligned with the scroll offset.
52
- */
53
- PadTop: HTMLDivElement;
48
+ /**
49
+ * Top spacer element that simulates the height of items scrolled past.
50
+ * Its height is adjusted to keep the visible items aligned with the scroll offset.
51
+ */
52
+ PadTop: HTMLDivElement;
54
53
 
55
- /**
56
- * Container that hosts the currently rendered (visible + overscan) item elements.
57
- * Items are inserted/updated within this element during virtualization.
58
- */
59
- ItemsHost: HTMLDivElement;
54
+ /**
55
+ * Container that hosts the currently rendered (visible + overscan) item elements.
56
+ * Items are inserted/updated within this element during virtualization.
57
+ */
58
+ ItemsHost: HTMLDivElement;
60
59
 
61
- /**
62
- * Bottom spacer element that simulates the height of items not yet rendered.
63
- * Its height is adjusted to represent remaining content below the visible range.
64
- */
65
- PadBottom: HTMLDivElement;
66
- };
60
+ /**
61
+ * Bottom spacer element that simulates the height of items not yet rendered.
62
+ * Its height is adjusted to represent remaining content below the visible range.
63
+ */
64
+ PadBottom: HTMLDivElement;
65
+ };
@@ -87,8 +87,24 @@ export type AjaxOptGroupItem = {
87
87
  export type NormalizedAjaxItem =
88
88
  | HTMLOptionElement
89
89
  | HTMLOptGroupElement
90
- | { type: "option"; value: string; text: string; selected?: boolean; data?: Record<string, any> }
91
- | { type: "optgroup"; label: string; data?: Record<string, any>; options: Array<{ value: string; text: string; selected?: boolean; data?: Record<string, any> }> };
90
+ | {
91
+ type: "option";
92
+ value: string;
93
+ text: string;
94
+ selected?: boolean;
95
+ data?: Record<string, any>;
96
+ }
97
+ | {
98
+ type: "optgroup";
99
+ label: string;
100
+ data?: Record<string, any>;
101
+ options: Array<{
102
+ value: string;
103
+ text: string;
104
+ selected?: boolean;
105
+ data?: Record<string, any>;
106
+ }>;
107
+ };
92
108
 
93
109
  /**
94
110
  * Represents the result of parsing an AJAX response.
@@ -0,0 +1 @@
1
+ declare module "*.css";
@@ -10,8 +10,8 @@ import { SelectiveOptions } from "../utils/selective.type";
10
10
  export interface PluginContext<TTags extends Record<string, HTMLElement>> {
11
11
  selectBox: SelectBox;
12
12
  options: SelectiveOptions;
13
- adapter: AdapterContract<any> | null;
14
- recycler: RecyclerViewContract<AdapterContract<any>> | null;
13
+ adapter?: AdapterContract<any>;
14
+ recycler?: RecyclerViewContract<AdapterContract<any>>;
15
15
  viewTags: TTags & { id: string };
16
16
  actions: SelectBoxAction;
17
17
  }
@@ -3,7 +3,7 @@
3
3
  * Typically includes width and height of an element.
4
4
  */
5
5
  export interface SizeObject {
6
- width: number; // Element width in pixels
6
+ width: number; // Element width in pixels
7
7
  height: number; // Element height in pixels
8
8
  }
9
9
 
@@ -12,8 +12,8 @@ export interface SizeObject {
12
12
  * Includes scrollable height for overflow calculations.
13
13
  */
14
14
  export interface DimensionObject {
15
- width: number; // Element width in pixels
16
- height: number; // Element height in pixels
15
+ width: number; // Element width in pixels
16
+ height: number; // Element height in pixels
17
17
  scrollHeight: number; // Total scrollable height of the element
18
18
  }
19
19
 
@@ -87,45 +87,45 @@ export interface EffectorInterface {
87
87
  * Configuration options for expanding an element.
88
88
  */
89
89
  export type ExpandConfig = {
90
- duration?: number; // Animation duration in milliseconds
91
- display?: string; // CSS display property during expansion
92
- width: number; // Target width in pixels
93
- left: number; // Target left position
94
- top: number; // Target top position
95
- maxHeight: number; // Maximum height allowed
96
- realHeight: number; // Actual height of the content
90
+ duration?: number; // Animation duration in milliseconds
91
+ display?: string; // CSS display property during expansion
92
+ width: number; // Target width in pixels
93
+ left: number; // Target left position
94
+ top: number; // Target top position
95
+ maxHeight: number; // Maximum height allowed
96
+ realHeight: number; // Actual height of the content
97
97
  position?: "top" | "bottom"; // Positioning reference
98
- onComplete?: () => void; // Callback after expansion completes
98
+ onComplete?: () => void; // Callback after expansion completes
99
99
  };
100
100
 
101
101
  /**
102
102
  * Configuration options for collapsing an element.
103
103
  */
104
104
  export type CollapseConfig = {
105
- duration?: number; // Animation duration in milliseconds
106
- onComplete?: () => void; // Callback after collapse completes
105
+ duration?: number; // Animation duration in milliseconds
106
+ onComplete?: () => void; // Callback after collapse completes
107
107
  };
108
108
 
109
109
  /**
110
110
  * Configuration options for swipe animations.
111
111
  */
112
112
  export type SwipeConfig = {
113
- duration?: number; // Animation duration in milliseconds
114
- display?: string; // CSS display property during swipe
115
- onComplete?: () => void; // Callback after swipe completes
113
+ duration?: number; // Animation duration in milliseconds
114
+ display?: string; // CSS display property during swipe
115
+ onComplete?: () => void; // Callback after swipe completes
116
116
  };
117
117
 
118
118
  /**
119
119
  * Configuration options for resizing an element.
120
120
  */
121
121
  export type ResizeConfig = {
122
- duration?: number; // Animation duration in milliseconds
123
- width: number; // Target width in pixels
124
- left: number; // Target left position
125
- top: number; // Target top position
126
- maxHeight: number; // Maximum height allowed
127
- realHeight: number; // Actual height of the content
122
+ duration?: number; // Animation duration in milliseconds
123
+ width: number; // Target width in pixels
124
+ left: number; // Target left position
125
+ top: number; // Target top position
126
+ maxHeight: number; // Maximum height allowed
127
+ realHeight: number; // Actual height of the content
128
128
  position?: "top" | "bottom"; // Positioning reference
129
- animate?: boolean; // Whether to animate the resize
130
- onComplete?: () => void; // Callback after resize completes
131
- };
129
+ animate?: boolean; // Whether to animate the resize
130
+ onComplete?: () => void; // Callback after resize completes
131
+ };
@@ -2,10 +2,14 @@
2
2
  * Represents the measurements for each side of a box (padding, border, or margin).
3
3
  */
4
4
  export interface BoxSides {
5
- top: number; // Size of the top side in pixels
6
- right: number; // Size of the right side in pixels
7
- bottom: number; // Size of the bottom side in pixels
8
- left: number; // Size of the left side in pixels
5
+ /** Size of the top side in pixels */
6
+ top: number;
7
+ /** Size of the right side in pixels */
8
+ right: number;
9
+ /** Size of the bottom side in pixels */
10
+ bottom: number;
11
+ /** Size of the left side in pixels */
12
+ left: number;
9
13
  }
10
14
 
11
15
  /**
@@ -13,11 +17,18 @@ export interface BoxSides {
13
17
  * and box model properties (padding, border, margin).
14
18
  */
15
19
  export interface ElementMetrics {
16
- width: number; // Element width in pixels
17
- height: number; // Element height in pixels
18
- top: number; // Distance from the top of the parent/container
19
- left: number; // Distance from the left of the parent/container
20
- padding: BoxSides; // Padding values for all sides
21
- border: BoxSides; // Border thickness values for all sides
22
- margin: BoxSides; // Margin values for all sides
23
- }
20
+ /** Element width in pixels */
21
+ width: number;
22
+ /** Element height in pixels */
23
+ height: number;
24
+ /** Distance from the top of the parent/container */
25
+ top: number;
26
+ /** Distance from the left of the parent/container */
27
+ left: number;
28
+ /** Padding values for all sides */
29
+ padding: BoxSides;
30
+ /** Border thickness values for all sides */
31
+ border: BoxSides;
32
+ /** Margin values for all sides */
33
+ margin: BoxSides;
34
+ }
@@ -63,7 +63,7 @@ export interface TimerEntry<T extends any[] = any[]> {
63
63
  * - `null` when `run()` is called without parameters
64
64
  */
65
65
  export type StoredEntry = {
66
- callback: (payload: any[] | null) => void;
66
+ callback: (payload?: any[]) => void;
67
67
  timeout: number;
68
68
  once: boolean;
69
- };
69
+ };
@@ -37,4 +37,4 @@ export interface IEventToken {
37
37
  export type IEventHandler<TParams extends unknown[] = []> = (
38
38
  cb: IEventCallback,
39
39
  ...params: TParams
40
- ) => void;
40
+ ) => void;