mtrl 0.4.4 → 0.5.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 +61 -60
- package/dist/README.md +61 -60
- package/dist/components/chips/chips.d.ts +2 -2
- package/dist/components/chips/config.d.ts +1 -1
- package/dist/components/chips/features/controller.d.ts +1 -1
- package/dist/components/chips/features/dom.d.ts +15 -0
- package/dist/components/chips/features/index.d.ts +5 -4
- package/dist/components/chips/schema.d.ts +2 -2
- package/dist/components/list/api.d.ts +82 -39
- package/dist/components/list/config.d.ts +23 -19
- package/dist/components/list/features/index.d.ts +1 -1
- package/dist/components/list/features/renderer.d.ts +9 -0
- package/dist/components/list/features/selection.d.ts +1 -1
- package/dist/components/list/list.d.ts +3 -2
- package/dist/components/list/types.d.ts +68 -121
- package/dist/components/progress/constants.d.ts +3 -3
- package/dist/components/slider/features/canvas.d.ts +2 -2
- package/dist/components/slider/features/dom.d.ts +21 -0
- package/dist/components/slider/features/index.d.ts +5 -4
- package/dist/components/slider/slider.d.ts +4 -4
- package/dist/components/textfield/api.d.ts +2 -0
- package/dist/components/textfield/features/error.d.ts +54 -0
- package/dist/components/textfield/features/index.d.ts +1 -0
- package/dist/components/textfield/features/placement.d.ts +1 -1
- package/dist/components/textfield/features/supporting-text.d.ts +1 -1
- package/dist/components/textfield/types.d.ts +7 -0
- package/dist/core/compose/features/icon.d.ts +2 -2
- package/dist/core/compose/features/index.d.ts +0 -2
- package/dist/core/compose/features/textinput.d.ts +4 -0
- package/dist/core/compose/features/textlabel.d.ts +2 -2
- package/dist/core/compose/index.d.ts +1 -5
- package/dist/core/dom/attributes.d.ts +32 -2
- package/dist/core/dom/classes.d.ts +15 -13
- package/dist/core/dom/create.d.ts +35 -87
- package/dist/core/dom/index.d.ts +6 -6
- package/dist/core/dom/utils.d.ts +1 -10
- package/dist/core/index.d.ts +18 -22
- package/dist/index.cjs +15 -15
- package/dist/index.cjs.map +36 -74
- package/dist/index.d.ts +1 -6
- package/dist/index.js +15 -15
- package/dist/index.js.map +36 -74
- package/dist/package.json +1 -1
- package/dist/styles.css +2 -2
- package/package.json +4 -3
- package/dist/components/list/features/listmanager.d.ts +0 -9
- package/dist/components/slider/schema.d.ts +0 -65
- package/dist/core/collection/adapters/base.d.ts +0 -47
- package/dist/core/collection/adapters/route.d.ts +0 -149
- package/dist/core/collection/collection.d.ts +0 -131
- package/dist/core/collection/index.d.ts +0 -10
- package/dist/core/collection/list-manager/config.d.ts +0 -29
- package/dist/core/collection/list-manager/dom-elements.d.ts +0 -30
- package/dist/core/collection/list-manager/index.d.ts +0 -61
- package/dist/core/collection/list-manager/item-measurement.d.ts +0 -91
- package/dist/core/collection/list-manager/renderer.d.ts +0 -31
- package/dist/core/collection/list-manager/scroll-tracker.d.ts +0 -20
- package/dist/core/collection/list-manager/state.d.ts +0 -60
- package/dist/core/collection/list-manager/types.d.ts +0 -361
- package/dist/core/collection/list-manager/utils/recycling.d.ts +0 -34
- package/dist/core/collection/list-manager/utils/visibility.d.ts +0 -45
- package/dist/core/compose/features/gestures/longpress.d.ts +0 -85
- package/dist/core/compose/features/gestures/pan.d.ts +0 -108
- package/dist/core/compose/features/gestures/pinch.d.ts +0 -111
- package/dist/core/compose/features/gestures/rotate.d.ts +0 -111
- package/dist/core/compose/features/gestures/swipe.d.ts +0 -149
- package/dist/core/compose/features/gestures/tap.d.ts +0 -79
- package/dist/core/compose/features/gestures.d.ts +0 -86
- package/dist/core/composition/features/dom.d.ts +0 -19
- package/dist/core/composition/features/icon.d.ts +0 -45
- package/dist/core/composition/features/index.d.ts +0 -7
- package/dist/core/composition/features/label.d.ts +0 -49
- package/dist/core/composition/features/layout.d.ts +0 -31
- package/dist/core/composition/index.d.ts +0 -16
- package/dist/core/gestures/index.d.ts +0 -12
- package/dist/core/gestures/longpress.d.ts +0 -23
- package/dist/core/gestures/manager.d.ts +0 -14
- package/dist/core/gestures/pan.d.ts +0 -12
- package/dist/core/gestures/pinch.d.ts +0 -14
- package/dist/core/gestures/rotate.d.ts +0 -14
- package/dist/core/gestures/swipe.d.ts +0 -20
- package/dist/core/gestures/tap.d.ts +0 -12
- package/dist/core/gestures/types.d.ts +0 -320
- package/dist/core/gestures/utils.d.ts +0 -57
- package/dist/core/layout/array.d.ts +0 -20
- package/dist/core/layout/config.d.ts +0 -32
- package/dist/core/layout/create.d.ts +0 -14
- package/dist/core/layout/index.d.ts +0 -13
- package/dist/core/layout/jsx.d.ts +0 -13
- package/dist/core/layout/object.d.ts +0 -14
- package/dist/core/layout/processor.d.ts +0 -28
- package/dist/core/layout/result.d.ts +0 -12
- package/dist/core/layout/template.d.ts +0 -12
- package/dist/core/layout/types.d.ts +0 -137
- package/dist/core/layout/utils.d.ts +0 -38
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { ListManagerElements, ListManagerConfig } from "./types";
|
|
2
|
-
/**
|
|
3
|
-
* Common interface for scroll tracking strategies
|
|
4
|
-
*/
|
|
5
|
-
export interface ScrollTracker {
|
|
6
|
-
setup(): () => void;
|
|
7
|
-
getScrollTop(): number;
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* Factory to create the appropriate scroll tracker based on strategy
|
|
11
|
-
* @param container Container element
|
|
12
|
-
* @param elements DOM elements
|
|
13
|
-
* @param config List manager configuration
|
|
14
|
-
* @param callbacks Callbacks for scroll events
|
|
15
|
-
* @returns ScrollTracker implementation
|
|
16
|
-
*/
|
|
17
|
-
export declare function createScrollTracker(container: HTMLElement, elements: ListManagerElements, config: ListManagerConfig, callbacks: {
|
|
18
|
-
onScroll: (scrollTop: number) => void;
|
|
19
|
-
onLoadMore: () => void;
|
|
20
|
-
}): ScrollTracker;
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { ListManagerState, ListManagerConfig } from './types';
|
|
2
|
-
/**
|
|
3
|
-
* Creates the initial state for a list manager
|
|
4
|
-
* @param config List manager configuration
|
|
5
|
-
* @returns Initialized state object
|
|
6
|
-
*/
|
|
7
|
-
export declare function createInitialState(config: ListManagerConfig): ListManagerState;
|
|
8
|
-
/**
|
|
9
|
-
* Updates the state after a load operation
|
|
10
|
-
* @param state Current state
|
|
11
|
-
* @param newItems New items array
|
|
12
|
-
* @param meta Pagination metadata
|
|
13
|
-
* @param dedupe Whether to deduplicate items
|
|
14
|
-
* @returns Updated state
|
|
15
|
-
*/
|
|
16
|
-
export declare function updateStateAfterLoad(state: ListManagerState, newItems: any[], meta: {
|
|
17
|
-
cursor?: string | null;
|
|
18
|
-
hasNext?: boolean;
|
|
19
|
-
total?: number;
|
|
20
|
-
page?: number;
|
|
21
|
-
}, dedupe?: boolean): Partial<ListManagerState>;
|
|
22
|
-
/**
|
|
23
|
-
* Updates the visible items in state
|
|
24
|
-
* @param state Current state
|
|
25
|
-
* @param visibleItems New visible items array
|
|
26
|
-
* @param visibleRange New visible range
|
|
27
|
-
* @returns Updated state
|
|
28
|
-
*/
|
|
29
|
-
export declare function updateVisibleItems(state: ListManagerState, visibleItems: any[], visibleRange: {
|
|
30
|
-
start: number;
|
|
31
|
-
end: number;
|
|
32
|
-
}): Partial<ListManagerState>;
|
|
33
|
-
/**
|
|
34
|
-
* Updates total height in state
|
|
35
|
-
* @param state Current state
|
|
36
|
-
* @param totalHeight New total height
|
|
37
|
-
* @returns Updated state
|
|
38
|
-
*/
|
|
39
|
-
export declare function updateTotalHeight(state: ListManagerState, totalHeight: number): Partial<ListManagerState>;
|
|
40
|
-
/**
|
|
41
|
-
* Updates loading state
|
|
42
|
-
* @param state Current state
|
|
43
|
-
* @param loading New loading state
|
|
44
|
-
* @returns Updated state
|
|
45
|
-
*/
|
|
46
|
-
export declare function updateLoadingState(state: ListManagerState, loading: boolean): Partial<ListManagerState>;
|
|
47
|
-
/**
|
|
48
|
-
* Resets the state for a refresh operation
|
|
49
|
-
* @param state Current state
|
|
50
|
-
* @param initialItems Initial items array for static mode
|
|
51
|
-
* @returns Reset state
|
|
52
|
-
*/
|
|
53
|
-
export declare function resetState(state: ListManagerState, initialItems?: any[]): Partial<ListManagerState>;
|
|
54
|
-
/**
|
|
55
|
-
* Creates load params for the next page based on pagination strategy
|
|
56
|
-
* @param state Current state
|
|
57
|
-
* @param paginationStrategy Optional pagination strategy override
|
|
58
|
-
* @returns Load parameters object
|
|
59
|
-
*/
|
|
60
|
-
export declare function createLoadParams(state: ListManagerState, paginationStrategy?: string): Record<string, any>;
|
|
@@ -1,361 +0,0 @@
|
|
|
1
|
-
import { Collection } from '../collection';
|
|
2
|
-
/**
|
|
3
|
-
* Configuration for list manager
|
|
4
|
-
*/
|
|
5
|
-
export interface ListManagerConfig {
|
|
6
|
-
/**
|
|
7
|
-
* Transform function for items
|
|
8
|
-
*/
|
|
9
|
-
transform?: (item: any) => any;
|
|
10
|
-
/**
|
|
11
|
-
* Base URL for API requests
|
|
12
|
-
*/
|
|
13
|
-
baseUrl?: string | null;
|
|
14
|
-
/**
|
|
15
|
-
* Function to render an item
|
|
16
|
-
*/
|
|
17
|
-
renderItem: (item: any, index: number, recycledElement?: HTMLElement) => HTMLElement;
|
|
18
|
-
/**
|
|
19
|
-
* Callback after load operations
|
|
20
|
-
*/
|
|
21
|
-
afterLoad?: (result: LoadStatus) => void;
|
|
22
|
-
/**
|
|
23
|
-
* Items for static mode
|
|
24
|
-
*/
|
|
25
|
-
staticItems?: any[] | null;
|
|
26
|
-
/**
|
|
27
|
-
* Number of extra items to render outside viewport
|
|
28
|
-
*/
|
|
29
|
-
renderBufferSize?: number;
|
|
30
|
-
/**
|
|
31
|
-
* Number of items to keep in DOM but invisible
|
|
32
|
-
*/
|
|
33
|
-
overscanCount?: number;
|
|
34
|
-
/**
|
|
35
|
-
* Default height for items
|
|
36
|
-
*/
|
|
37
|
-
itemHeight?: number;
|
|
38
|
-
/**
|
|
39
|
-
* Whether items can have varying heights
|
|
40
|
-
* When false (default), all items use the same height for better performance
|
|
41
|
-
* When true, each item's height is measured individually
|
|
42
|
-
*/
|
|
43
|
-
dynamicItemSize?: boolean;
|
|
44
|
-
/**
|
|
45
|
-
* Whether to measure initial items
|
|
46
|
-
*/
|
|
47
|
-
measureItemsInitially?: boolean;
|
|
48
|
-
/**
|
|
49
|
-
* Number of items per page
|
|
50
|
-
*/
|
|
51
|
-
pageSize?: number;
|
|
52
|
-
/**
|
|
53
|
-
* Threshold for loading more (0.0-1.0)
|
|
54
|
-
*/
|
|
55
|
-
loadThreshold?: number;
|
|
56
|
-
/**
|
|
57
|
-
* Throttle time for scroll events (ms)
|
|
58
|
-
*/
|
|
59
|
-
throttleMs?: number;
|
|
60
|
-
/**
|
|
61
|
-
* Whether to deduplicate items by ID
|
|
62
|
-
*/
|
|
63
|
-
dedupeItems?: boolean;
|
|
64
|
-
/**
|
|
65
|
-
* Scroll detection strategy
|
|
66
|
-
*/
|
|
67
|
-
scrollStrategy?: ScrollStrategy;
|
|
68
|
-
/**
|
|
69
|
-
* Legacy support for static items
|
|
70
|
-
*/
|
|
71
|
-
items?: any[];
|
|
72
|
-
/**
|
|
73
|
-
* Collection name
|
|
74
|
-
*/
|
|
75
|
-
collection?: string;
|
|
76
|
-
/**
|
|
77
|
-
* Pagination configuration
|
|
78
|
-
*/
|
|
79
|
-
pagination?: {
|
|
80
|
-
/**
|
|
81
|
-
* Pagination strategy to use ('cursor', 'page', or 'offset')
|
|
82
|
-
* @default 'cursor'
|
|
83
|
-
*/
|
|
84
|
-
strategy?: 'cursor' | 'page' | 'offset';
|
|
85
|
-
/**
|
|
86
|
-
* Parameter name for page size (for page-based pagination)
|
|
87
|
-
* @default 'per_page'
|
|
88
|
-
*/
|
|
89
|
-
perPageParamName?: string;
|
|
90
|
-
/**
|
|
91
|
-
* Parameter name for limit (for cursor/offset pagination)
|
|
92
|
-
* @default 'limit'
|
|
93
|
-
*/
|
|
94
|
-
limitParamName?: string;
|
|
95
|
-
};
|
|
96
|
-
}
|
|
97
|
-
/**
|
|
98
|
-
* Scroll tracking strategies
|
|
99
|
-
*/
|
|
100
|
-
export type ScrollStrategy = 'scroll' | 'intersection' | 'hybrid';
|
|
101
|
-
/**
|
|
102
|
-
* List manager interface
|
|
103
|
-
*/
|
|
104
|
-
export interface ListManager {
|
|
105
|
-
/**
|
|
106
|
-
* Loads items from API or static data
|
|
107
|
-
*/
|
|
108
|
-
loadItems: (params?: any) => Promise<{
|
|
109
|
-
items: any[];
|
|
110
|
-
meta: PaginationMeta;
|
|
111
|
-
}>;
|
|
112
|
-
/**
|
|
113
|
-
* Loads more items (next page)
|
|
114
|
-
*/
|
|
115
|
-
loadMore: () => Promise<{
|
|
116
|
-
hasNext: boolean;
|
|
117
|
-
items: any[];
|
|
118
|
-
}>;
|
|
119
|
-
/**
|
|
120
|
-
* Refreshes the list
|
|
121
|
-
*/
|
|
122
|
-
refresh: () => Promise<void>;
|
|
123
|
-
/**
|
|
124
|
-
* Updates visible items based on scroll position
|
|
125
|
-
*/
|
|
126
|
-
updateVisibleItems: (scrollTop?: number) => void;
|
|
127
|
-
/**
|
|
128
|
-
* Scrolls to a specific item by ID
|
|
129
|
-
*/
|
|
130
|
-
scrollToItem: (itemId: string, position?: ScrollToPosition) => void;
|
|
131
|
-
/**
|
|
132
|
-
* Sets custom heights for items
|
|
133
|
-
*/
|
|
134
|
-
setItemHeights: (heightsMap: Record<string, number>) => boolean;
|
|
135
|
-
/**
|
|
136
|
-
* Gets the underlying collection
|
|
137
|
-
*/
|
|
138
|
-
getCollection: () => Collection<any>;
|
|
139
|
-
/**
|
|
140
|
-
* Gets currently visible items
|
|
141
|
-
*/
|
|
142
|
-
getVisibleItems: () => any[];
|
|
143
|
-
/**
|
|
144
|
-
* Gets all items
|
|
145
|
-
*/
|
|
146
|
-
getAllItems: () => any[];
|
|
147
|
-
/**
|
|
148
|
-
* Checks if list is loading
|
|
149
|
-
*/
|
|
150
|
-
isLoading: () => boolean;
|
|
151
|
-
/**
|
|
152
|
-
* Checks if there are more items to load
|
|
153
|
-
*/
|
|
154
|
-
hasNextPage: () => boolean;
|
|
155
|
-
/**
|
|
156
|
-
* Checks if list is in API mode
|
|
157
|
-
*/
|
|
158
|
-
isApiMode: () => boolean;
|
|
159
|
-
/**
|
|
160
|
-
* Sets a hook function for rendering
|
|
161
|
-
*/
|
|
162
|
-
setRenderHook?: (hookFn: (item: any, element: HTMLElement) => void) => void;
|
|
163
|
-
/**
|
|
164
|
-
* Destroys the list manager
|
|
165
|
-
*/
|
|
166
|
-
destroy: () => void;
|
|
167
|
-
}
|
|
168
|
-
/**
|
|
169
|
-
* Position for scrolling to an item
|
|
170
|
-
*/
|
|
171
|
-
export type ScrollToPosition = 'start' | 'center' | 'end';
|
|
172
|
-
/**
|
|
173
|
-
* Pagination metadata
|
|
174
|
-
*/
|
|
175
|
-
export interface PaginationMeta {
|
|
176
|
-
cursor: string | null;
|
|
177
|
-
hasNext: boolean;
|
|
178
|
-
total?: number;
|
|
179
|
-
}
|
|
180
|
-
/**
|
|
181
|
-
* Load operation status
|
|
182
|
-
*/
|
|
183
|
-
export interface LoadStatus {
|
|
184
|
-
loading: boolean;
|
|
185
|
-
hasNext: boolean;
|
|
186
|
-
hasPrev: boolean;
|
|
187
|
-
items: any[];
|
|
188
|
-
allItems: any[];
|
|
189
|
-
}
|
|
190
|
-
/**
|
|
191
|
-
* List interface
|
|
192
|
-
*/
|
|
193
|
-
export interface List {
|
|
194
|
-
component: HTMLElement;
|
|
195
|
-
items: any[];
|
|
196
|
-
setItems: (items: any[]) => void;
|
|
197
|
-
}
|
|
198
|
-
/**
|
|
199
|
-
* Page loader configuration
|
|
200
|
-
*/
|
|
201
|
-
export interface PageLoaderConfig {
|
|
202
|
-
onLoad?: (status: LoadStatus) => void;
|
|
203
|
-
pageSize?: number;
|
|
204
|
-
}
|
|
205
|
-
/**
|
|
206
|
-
* Page loader interface
|
|
207
|
-
*/
|
|
208
|
-
export interface PageLoader {
|
|
209
|
-
load: (cursor?: string | null, addToHistory?: boolean) => Promise<{
|
|
210
|
-
hasNext: boolean;
|
|
211
|
-
hasPrev: boolean;
|
|
212
|
-
}>;
|
|
213
|
-
loadNext: () => Promise<{
|
|
214
|
-
hasNext: boolean;
|
|
215
|
-
hasPrev: boolean;
|
|
216
|
-
}>;
|
|
217
|
-
loadPrev: () => Promise<{
|
|
218
|
-
hasNext: boolean;
|
|
219
|
-
hasPrev: boolean;
|
|
220
|
-
}>;
|
|
221
|
-
loading: boolean;
|
|
222
|
-
cursor: string | null;
|
|
223
|
-
}
|
|
224
|
-
/**
|
|
225
|
-
* Item interface
|
|
226
|
-
*/
|
|
227
|
-
export interface ListItem {
|
|
228
|
-
id: string;
|
|
229
|
-
headline: string;
|
|
230
|
-
supportingText: string;
|
|
231
|
-
meta: string;
|
|
232
|
-
}
|
|
233
|
-
/**
|
|
234
|
-
* Internal list manager state
|
|
235
|
-
*/
|
|
236
|
-
/**
|
|
237
|
-
* Internal list manager state
|
|
238
|
-
*/
|
|
239
|
-
export interface ListManagerState {
|
|
240
|
-
/**
|
|
241
|
-
* All items
|
|
242
|
-
*/
|
|
243
|
-
items: any[];
|
|
244
|
-
/**
|
|
245
|
-
* Currently visible items
|
|
246
|
-
*/
|
|
247
|
-
visibleItems: any[];
|
|
248
|
-
/**
|
|
249
|
-
* Visible range indices
|
|
250
|
-
*/
|
|
251
|
-
visibleRange: {
|
|
252
|
-
start: number;
|
|
253
|
-
end: number;
|
|
254
|
-
};
|
|
255
|
-
/**
|
|
256
|
-
* Total height of all items
|
|
257
|
-
*/
|
|
258
|
-
totalHeight: number;
|
|
259
|
-
/**
|
|
260
|
-
* Whether total height needs recalculation
|
|
261
|
-
*/
|
|
262
|
-
totalHeightDirty: boolean;
|
|
263
|
-
/**
|
|
264
|
-
* Map of item heights (legacy - use itemMeasurement)
|
|
265
|
-
*/
|
|
266
|
-
itemHeights: Map<string, number>;
|
|
267
|
-
/**
|
|
268
|
-
* Whether list is currently loading
|
|
269
|
-
*/
|
|
270
|
-
loading: boolean;
|
|
271
|
-
/**
|
|
272
|
-
* Current pagination cursor
|
|
273
|
-
*/
|
|
274
|
-
cursor: string | null;
|
|
275
|
-
/**
|
|
276
|
-
* Current page number (when using page-based pagination)
|
|
277
|
-
*/
|
|
278
|
-
page?: number;
|
|
279
|
-
/**
|
|
280
|
-
* Pagination strategy being used
|
|
281
|
-
*/
|
|
282
|
-
paginationStrategy?: string;
|
|
283
|
-
/**
|
|
284
|
-
* Whether there are more items to load
|
|
285
|
-
*/
|
|
286
|
-
hasNext: boolean;
|
|
287
|
-
/**
|
|
288
|
-
* Map of item elements for DOM recycling
|
|
289
|
-
*/
|
|
290
|
-
itemElements: Map<string, HTMLElement>;
|
|
291
|
-
/**
|
|
292
|
-
* Current scroll position
|
|
293
|
-
*/
|
|
294
|
-
scrollTop: number;
|
|
295
|
-
/**
|
|
296
|
-
* Container height
|
|
297
|
-
*/
|
|
298
|
-
containerHeight: number;
|
|
299
|
-
/**
|
|
300
|
-
* RequestAnimationFrame ID for scroll updates
|
|
301
|
-
*/
|
|
302
|
-
scrollRAF: number | null;
|
|
303
|
-
/**
|
|
304
|
-
* RequestAnimationFrame ID for resize updates
|
|
305
|
-
*/
|
|
306
|
-
resizeRAF: number | null;
|
|
307
|
-
/**
|
|
308
|
-
* Whether component is mounted
|
|
309
|
-
*/
|
|
310
|
-
mounted: boolean;
|
|
311
|
-
/**
|
|
312
|
-
* Total item count (may differ from items.length)
|
|
313
|
-
*/
|
|
314
|
-
itemCount: number;
|
|
315
|
-
/**
|
|
316
|
-
* Whether list is in static mode
|
|
317
|
-
*/
|
|
318
|
-
useStatic: boolean;
|
|
319
|
-
/**
|
|
320
|
-
* Custom render hook function
|
|
321
|
-
*/
|
|
322
|
-
renderHook: ((item: any, element: HTMLElement) => void) | null;
|
|
323
|
-
}
|
|
324
|
-
/**
|
|
325
|
-
* DOM elements used by the list manager
|
|
326
|
-
*/
|
|
327
|
-
export interface ListManagerElements {
|
|
328
|
-
/**
|
|
329
|
-
* Container element
|
|
330
|
-
*/
|
|
331
|
-
container: HTMLElement;
|
|
332
|
-
/**
|
|
333
|
-
* Content container element
|
|
334
|
-
*/
|
|
335
|
-
content: HTMLElement;
|
|
336
|
-
/**
|
|
337
|
-
* Spacer element for scroll height
|
|
338
|
-
*/
|
|
339
|
-
spacer: HTMLElement;
|
|
340
|
-
/**
|
|
341
|
-
* Top sentinel for intersection detection
|
|
342
|
-
*/
|
|
343
|
-
topSentinel?: HTMLElement | null;
|
|
344
|
-
/**
|
|
345
|
-
* Bottom sentinel for intersection detection
|
|
346
|
-
*/
|
|
347
|
-
bottomSentinel?: HTMLElement | null;
|
|
348
|
-
}
|
|
349
|
-
/**
|
|
350
|
-
* Visible range calculation result
|
|
351
|
-
*/
|
|
352
|
-
export interface VisibleRange {
|
|
353
|
-
/**
|
|
354
|
-
* Start index
|
|
355
|
-
*/
|
|
356
|
-
start: number;
|
|
357
|
-
/**
|
|
358
|
-
* End index
|
|
359
|
-
*/
|
|
360
|
-
end: number;
|
|
361
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Creates a recycling pool manager for better performance
|
|
3
|
-
* Reduces DOM creation by reusing elements
|
|
4
|
-
*/
|
|
5
|
-
export declare const createRecyclingPool: () => {
|
|
6
|
-
/**
|
|
7
|
-
* Gets a recycled element of the appropriate type if available
|
|
8
|
-
* @param item Item to get recycled element for
|
|
9
|
-
* @returns Recycled element or null if none available
|
|
10
|
-
*/
|
|
11
|
-
getRecycledElement: (item: any) => HTMLElement | null;
|
|
12
|
-
/**
|
|
13
|
-
* Adds an element to the recycling pool
|
|
14
|
-
* @param element Element to recycle
|
|
15
|
-
* @param forceRecycle Whether to force recycling even for small elements
|
|
16
|
-
*/
|
|
17
|
-
recycleElement: (element: HTMLElement, forceRecycle?: boolean) => void;
|
|
18
|
-
/**
|
|
19
|
-
* Get all recycled elements in a pool
|
|
20
|
-
* @param itemType Type of items to get
|
|
21
|
-
* @returns Array of recycled elements
|
|
22
|
-
*/
|
|
23
|
-
getPool: (itemType: string) => HTMLElement[];
|
|
24
|
-
/**
|
|
25
|
-
* Clears all recycling pools
|
|
26
|
-
*/
|
|
27
|
-
clear: () => void;
|
|
28
|
-
/**
|
|
29
|
-
* Gets the total number of recycled elements
|
|
30
|
-
* @returns Total count of recycled elements
|
|
31
|
-
*/
|
|
32
|
-
getSize: () => number;
|
|
33
|
-
};
|
|
34
|
-
export type RecyclingPool = ReturnType<typeof createRecyclingPool>;
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { ItemMeasurement } from '../item-measurement';
|
|
2
|
-
import { VisibleRange, ListManagerConfig } from '../types';
|
|
3
|
-
/**
|
|
4
|
-
* Optimized visible range calculation for fixed height items
|
|
5
|
-
* Used as a fast path when all items have the same height
|
|
6
|
-
*
|
|
7
|
-
* @param scrollTop Current scroll position
|
|
8
|
-
* @param itemHeight Fixed item height
|
|
9
|
-
* @param containerHeight Container height
|
|
10
|
-
* @param totalItems Total number of items
|
|
11
|
-
* @param config List manager configuration
|
|
12
|
-
* @returns Visible range with start and end indices
|
|
13
|
-
*/
|
|
14
|
-
export declare function calculateVisibleRangeOptimized(scrollTop: number, itemHeight: number, containerHeight: number, totalItems: number, config: ListManagerConfig): VisibleRange;
|
|
15
|
-
/**
|
|
16
|
-
* Determines which items are visible within the viewport
|
|
17
|
-
* @param scrollTop Current scroll position
|
|
18
|
-
* @param items Array of items
|
|
19
|
-
* @param containerHeight Container height
|
|
20
|
-
* @param itemMeasurement Item measurement instance
|
|
21
|
-
* @param config List manager configuration
|
|
22
|
-
* @returns Visible range with start and end indices
|
|
23
|
-
*/
|
|
24
|
-
export declare function calculateVisibleRange(scrollTop: number, items: any[], containerHeight: number, itemMeasurement: ItemMeasurement, config: ListManagerConfig): VisibleRange;
|
|
25
|
-
/**
|
|
26
|
-
* Calculate the position for each visible item
|
|
27
|
-
* @param items All items
|
|
28
|
-
* @param visibleRange Visible range with start and end indices
|
|
29
|
-
* @param itemMeasurement Item measurement instance
|
|
30
|
-
* @returns Array of positions with index, item, and offset
|
|
31
|
-
*/
|
|
32
|
-
export declare function calculateItemPositions(items: any[], visibleRange: VisibleRange, itemMeasurement: ItemMeasurement): Array<{
|
|
33
|
-
index: number;
|
|
34
|
-
item: any;
|
|
35
|
-
offset: number;
|
|
36
|
-
}>;
|
|
37
|
-
/**
|
|
38
|
-
* Checks if load threshold has been reached
|
|
39
|
-
* @param scrollTop Current scroll top position
|
|
40
|
-
* @param containerHeight Container height
|
|
41
|
-
* @param totalHeight Total content height
|
|
42
|
-
* @param loadThreshold Load threshold as fraction (0-1)
|
|
43
|
-
* @returns Whether load threshold has been reached
|
|
44
|
-
*/
|
|
45
|
-
export declare function isLoadThresholdReached(scrollTop: number, containerHeight: number, totalHeight: number, loadThreshold: number): boolean;
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module core/compose/features/gestures
|
|
3
|
-
* @description Adds long press gesture recognition to components
|
|
4
|
-
*/
|
|
5
|
-
import { BaseComponent, ElementComponent } from "../../component";
|
|
6
|
-
import { LongPressEvent, GestureHandler } from "../../../gestures";
|
|
7
|
-
/**
|
|
8
|
-
* Configuration for long press gesture feature
|
|
9
|
-
*/
|
|
10
|
-
export interface LongPressGestureConfig {
|
|
11
|
-
/**
|
|
12
|
-
* Time (in ms) to recognize a long press
|
|
13
|
-
* @default 500
|
|
14
|
-
*/
|
|
15
|
-
longPressTime?: number;
|
|
16
|
-
/**
|
|
17
|
-
* Distance threshold (in pixels) for movement that cancels long press
|
|
18
|
-
* @default 10
|
|
19
|
-
*/
|
|
20
|
-
moveThreshold?: number;
|
|
21
|
-
/**
|
|
22
|
-
* Whether to prevent default behaviors on touch events
|
|
23
|
-
* @default true
|
|
24
|
-
*/
|
|
25
|
-
preventDefault?: boolean;
|
|
26
|
-
/**
|
|
27
|
-
* Handler for long press gesture
|
|
28
|
-
*/
|
|
29
|
-
onLongPress?: GestureHandler;
|
|
30
|
-
/**
|
|
31
|
-
* Whether to enable long press recognition immediately
|
|
32
|
-
* @default true
|
|
33
|
-
*/
|
|
34
|
-
enabled?: boolean;
|
|
35
|
-
[key: string]: any;
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Component with long press gesture recognition capabilities
|
|
39
|
-
*/
|
|
40
|
-
export interface LongPressGestureComponent extends BaseComponent {
|
|
41
|
-
/**
|
|
42
|
-
* Add a long press event handler
|
|
43
|
-
* @param handler - Event handler function
|
|
44
|
-
* @returns Component for chaining
|
|
45
|
-
*/
|
|
46
|
-
onLongPress: (handler: (event: LongPressEvent) => void) => LongPressGestureComponent;
|
|
47
|
-
/**
|
|
48
|
-
* Remove a long press event handler
|
|
49
|
-
* @param handler - Event handler function
|
|
50
|
-
* @returns Component for chaining
|
|
51
|
-
*/
|
|
52
|
-
offLongPress: (handler: (event: LongPressEvent) => void) => LongPressGestureComponent;
|
|
53
|
-
/**
|
|
54
|
-
* Enable long press recognition
|
|
55
|
-
* @returns Component for chaining
|
|
56
|
-
*/
|
|
57
|
-
enableLongPress: () => LongPressGestureComponent;
|
|
58
|
-
/**
|
|
59
|
-
* Disable long press recognition
|
|
60
|
-
* @returns Component for chaining
|
|
61
|
-
*/
|
|
62
|
-
disableLongPress: () => LongPressGestureComponent;
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* Adds long press gesture recognition to a component.
|
|
66
|
-
* This is a lightweight alternative to the full gesture system,
|
|
67
|
-
* focused only on long press detection.
|
|
68
|
-
*
|
|
69
|
-
* @param config - Configuration object containing long press settings
|
|
70
|
-
* @returns Function that enhances a component with long press capabilities
|
|
71
|
-
*
|
|
72
|
-
* @example
|
|
73
|
-
* ```ts
|
|
74
|
-
* // Add long press gesture recognition to a component
|
|
75
|
-
* const component = pipe(
|
|
76
|
-
* createBase,
|
|
77
|
-
* withElement(...),
|
|
78
|
-
* withLongPressGesture({
|
|
79
|
-
* longPressTime: 800,
|
|
80
|
-
* onLongPress: (e) => showContextMenu(e.x, e.y)
|
|
81
|
-
* })
|
|
82
|
-
* )(config);
|
|
83
|
-
* ```
|
|
84
|
-
*/
|
|
85
|
-
export declare const withLongPressGesture: (config?: LongPressGestureConfig) => <C extends ElementComponent>(component: C) => C & LongPressGestureComponent;
|