@jarenjs/collection 0.83.2
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/ARCHITECTURE.md +10 -0
- package/README.md +31 -0
- package/dist/types/collection.d.ts +474 -0
- package/dist/types/component/index.d.ts +1822 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/interaction.d.ts +92 -0
- package/docs/COLLECTION.md +110 -0
- package/docs/MEASUREMENTS.md +62 -0
- package/package.json +59 -0
- package/src/collection.js +134 -0
- package/src/component/index.js +243 -0
- package/src/index.js +4 -0
- package/src/interaction.js +112 -0
- package/styles/collection.css +10 -0
package/ARCHITECTURE.md
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# Collection architecture
|
|
2
|
+
|
|
3
|
+
`@jarenjs/core/virtual` owns DOM-free range and sparse measurement math.
|
|
4
|
+
The collection engine owns vnode projection and key-based interaction, importing
|
|
5
|
+
only core/view. The component entry owns elements, frames and observers and maps
|
|
6
|
+
`dispose` to the view renderer's existing `unmount` hook.
|
|
7
|
+
|
|
8
|
+
The app range coordinator receives a structural provider from the host. Storage
|
|
9
|
+
adapters in linq/db never import app; neither core nor the collection engine
|
|
10
|
+
imports storage or workers. Source resources stay private to the coordinator.
|
package/README.md
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# @jarenjs/collection
|
|
2
|
+
|
|
3
|
+
For a complete storage-to-view application, follow the [public adoption composition](../../docs/ADOPTION-EVIDENCE.md). The injected coordinator owns bounded pages while complete membership and exports belong to the source; AT, physical devices and native OS IME remain separate qualifications.
|
|
4
|
+
|
|
5
|
+
Virtual lists and grids with bounded viewport work, sparse measurements and stable keys.
|
|
6
|
+
The headless engine uses `@jarenjs/core/virtual`; `./component` adapts it to the
|
|
7
|
+
existing view widget lifecycle. Applications inject row access and rendering.
|
|
8
|
+
|
|
9
|
+
```js
|
|
10
|
+
import { createCollection } from '@jarenjs/collection';
|
|
11
|
+
const collection = createCollection({
|
|
12
|
+
count: 1000, keyAt: String, getItem: (index) => ({ label: `Row ${index}` }),
|
|
13
|
+
renderCell: (row) => row.label
|
|
14
|
+
});
|
|
15
|
+
collection.viewport({ width: 320, height: 440 });
|
|
16
|
+
const vnode = collection.view();
|
|
17
|
+
collection.dispose();
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
See [architecture](ARCHITECTURE.md) and [the collection contract](docs/COLLECTION.md).
|
|
21
|
+
|
|
22
|
+
## Public exports
|
|
23
|
+
|
|
24
|
+
<!--fact:exports.collection-->
|
|
25
|
+
| Import | Kind | Declarations |
|
|
26
|
+
|---|---|---|
|
|
27
|
+
| `@jarenjs/collection` | JavaScript | declared |
|
|
28
|
+
| `@jarenjs/collection/component` | JavaScript | declared |
|
|
29
|
+
| `@jarenjs/collection/package.json` | metadata | — |
|
|
30
|
+
| `@jarenjs/collection/styles/collection.css` | asset | — |
|
|
31
|
+
<!--/fact-->
|
|
@@ -0,0 +1,474 @@
|
|
|
1
|
+
/** Stable DOM identity; JSON escaping also supports lone surrogate code units in JSON keys.
|
|
2
|
+
* @param {string} id @param {string} key @param {number} [column] */
|
|
3
|
+
export declare function collectionItemId(id: string, key: string, column?: number): string;
|
|
4
|
+
/**
|
|
5
|
+
* Create a source-independent collection. Accessors run only for credited mounted rows.
|
|
6
|
+
* Measurements and pins have their own finite credits. Oversized DOM extents refuse explicitly.
|
|
7
|
+
* @param {any} options
|
|
8
|
+
*/
|
|
9
|
+
export declare function createCollection(options: any): {
|
|
10
|
+
rowAxis: {
|
|
11
|
+
position: (index: any) => any;
|
|
12
|
+
size: (index: any) => any;
|
|
13
|
+
indexAt: (offset: any) => number;
|
|
14
|
+
extent(): any;
|
|
15
|
+
range({ offset, viewport, overscan }?: {
|
|
16
|
+
offset?: number | undefined;
|
|
17
|
+
overscan?: number | undefined;
|
|
18
|
+
viewport?: number | undefined;
|
|
19
|
+
}): {
|
|
20
|
+
start: number;
|
|
21
|
+
end: number;
|
|
22
|
+
offset: number;
|
|
23
|
+
extent: any;
|
|
24
|
+
};
|
|
25
|
+
measure(index: any, key: any, value: any): {
|
|
26
|
+
state: string;
|
|
27
|
+
reason: string;
|
|
28
|
+
} | {
|
|
29
|
+
reason?: undefined;
|
|
30
|
+
state: string;
|
|
31
|
+
};
|
|
32
|
+
anchor(offset: any, keyAt: any, query?: string): {
|
|
33
|
+
key: string;
|
|
34
|
+
index: number;
|
|
35
|
+
offset: number;
|
|
36
|
+
query: string;
|
|
37
|
+
} | null;
|
|
38
|
+
restore(anchor: any, indexOf: any, query?: string): {
|
|
39
|
+
state: string;
|
|
40
|
+
offset: any;
|
|
41
|
+
fallback: boolean;
|
|
42
|
+
};
|
|
43
|
+
update(next: any): void;
|
|
44
|
+
clear(): void;
|
|
45
|
+
stats(): {
|
|
46
|
+
measurements: number;
|
|
47
|
+
bytes: number;
|
|
48
|
+
summaries: number;
|
|
49
|
+
};
|
|
50
|
+
dispose(): void;
|
|
51
|
+
};
|
|
52
|
+
columnAxis: {
|
|
53
|
+
position: (index: any) => any;
|
|
54
|
+
size: (index: any) => any;
|
|
55
|
+
indexAt: (offset: any) => number;
|
|
56
|
+
extent(): any;
|
|
57
|
+
range({ offset, viewport, overscan }?: {
|
|
58
|
+
offset?: number | undefined;
|
|
59
|
+
overscan?: number | undefined;
|
|
60
|
+
viewport?: number | undefined;
|
|
61
|
+
}): {
|
|
62
|
+
start: number;
|
|
63
|
+
end: number;
|
|
64
|
+
offset: number;
|
|
65
|
+
extent: any;
|
|
66
|
+
};
|
|
67
|
+
measure(index: any, key: any, value: any): {
|
|
68
|
+
state: string;
|
|
69
|
+
reason: string;
|
|
70
|
+
} | {
|
|
71
|
+
reason?: undefined;
|
|
72
|
+
state: string;
|
|
73
|
+
};
|
|
74
|
+
anchor(offset: any, keyAt: any, query?: string): {
|
|
75
|
+
key: string;
|
|
76
|
+
index: number;
|
|
77
|
+
offset: number;
|
|
78
|
+
query: string;
|
|
79
|
+
} | null;
|
|
80
|
+
restore(anchor: any, indexOf: any, query?: string): {
|
|
81
|
+
state: string;
|
|
82
|
+
offset: any;
|
|
83
|
+
fallback: boolean;
|
|
84
|
+
};
|
|
85
|
+
update(next: any): void;
|
|
86
|
+
clear(): void;
|
|
87
|
+
stats(): {
|
|
88
|
+
measurements: number;
|
|
89
|
+
bytes: number;
|
|
90
|
+
summaries: number;
|
|
91
|
+
};
|
|
92
|
+
dispose(): void;
|
|
93
|
+
};
|
|
94
|
+
layout: () => {
|
|
95
|
+
state: any;
|
|
96
|
+
reason: any;
|
|
97
|
+
rows: never[];
|
|
98
|
+
columns: never[];
|
|
99
|
+
} | {
|
|
100
|
+
state: string;
|
|
101
|
+
rowRange: {
|
|
102
|
+
start: number;
|
|
103
|
+
end: number;
|
|
104
|
+
offset: number;
|
|
105
|
+
extent: any;
|
|
106
|
+
};
|
|
107
|
+
columnRange: {
|
|
108
|
+
start: number;
|
|
109
|
+
end: number;
|
|
110
|
+
offset: number;
|
|
111
|
+
extent: any;
|
|
112
|
+
};
|
|
113
|
+
rows: {
|
|
114
|
+
index: number;
|
|
115
|
+
key: any;
|
|
116
|
+
start: any;
|
|
117
|
+
size: any;
|
|
118
|
+
pinned: any;
|
|
119
|
+
}[];
|
|
120
|
+
columns: {
|
|
121
|
+
index: number;
|
|
122
|
+
start: any;
|
|
123
|
+
size: any;
|
|
124
|
+
pinned: any;
|
|
125
|
+
}[];
|
|
126
|
+
};
|
|
127
|
+
options(): any;
|
|
128
|
+
position(): {
|
|
129
|
+
top: number;
|
|
130
|
+
left: number;
|
|
131
|
+
width: number;
|
|
132
|
+
height: number;
|
|
133
|
+
};
|
|
134
|
+
viewport(next: any): {
|
|
135
|
+
state: any;
|
|
136
|
+
reason: any;
|
|
137
|
+
rows: never[];
|
|
138
|
+
columns: never[];
|
|
139
|
+
} | {
|
|
140
|
+
state: string;
|
|
141
|
+
rowRange: {
|
|
142
|
+
start: number;
|
|
143
|
+
end: number;
|
|
144
|
+
offset: number;
|
|
145
|
+
extent: any;
|
|
146
|
+
};
|
|
147
|
+
columnRange: {
|
|
148
|
+
start: number;
|
|
149
|
+
end: number;
|
|
150
|
+
offset: number;
|
|
151
|
+
extent: any;
|
|
152
|
+
};
|
|
153
|
+
rows: {
|
|
154
|
+
index: number;
|
|
155
|
+
key: any;
|
|
156
|
+
start: any;
|
|
157
|
+
size: any;
|
|
158
|
+
pinned: any;
|
|
159
|
+
}[];
|
|
160
|
+
columns: {
|
|
161
|
+
index: number;
|
|
162
|
+
start: any;
|
|
163
|
+
size: any;
|
|
164
|
+
pinned: any;
|
|
165
|
+
}[];
|
|
166
|
+
};
|
|
167
|
+
update(next: any): {
|
|
168
|
+
state: any;
|
|
169
|
+
reason: any;
|
|
170
|
+
rows: never[];
|
|
171
|
+
columns: never[];
|
|
172
|
+
} | {
|
|
173
|
+
state: string;
|
|
174
|
+
rowRange: {
|
|
175
|
+
start: number;
|
|
176
|
+
end: number;
|
|
177
|
+
offset: number;
|
|
178
|
+
extent: any;
|
|
179
|
+
};
|
|
180
|
+
columnRange: {
|
|
181
|
+
start: number;
|
|
182
|
+
end: number;
|
|
183
|
+
offset: number;
|
|
184
|
+
extent: any;
|
|
185
|
+
};
|
|
186
|
+
rows: {
|
|
187
|
+
index: number;
|
|
188
|
+
key: any;
|
|
189
|
+
start: any;
|
|
190
|
+
size: any;
|
|
191
|
+
pinned: any;
|
|
192
|
+
}[];
|
|
193
|
+
columns: {
|
|
194
|
+
index: number;
|
|
195
|
+
start: any;
|
|
196
|
+
size: any;
|
|
197
|
+
pinned: any;
|
|
198
|
+
}[];
|
|
199
|
+
};
|
|
200
|
+
measure(index: any, key: any, size: any, axis?: string): {
|
|
201
|
+
state: string;
|
|
202
|
+
reason: string;
|
|
203
|
+
offset: number;
|
|
204
|
+
} | {
|
|
205
|
+
reason?: undefined;
|
|
206
|
+
state: string;
|
|
207
|
+
offset: number;
|
|
208
|
+
};
|
|
209
|
+
pin(rows?: any[], columns?: any[]): {
|
|
210
|
+
state: any;
|
|
211
|
+
reason: any;
|
|
212
|
+
rows: never[];
|
|
213
|
+
columns: never[];
|
|
214
|
+
} | {
|
|
215
|
+
state: string;
|
|
216
|
+
rowRange: {
|
|
217
|
+
start: number;
|
|
218
|
+
end: number;
|
|
219
|
+
offset: number;
|
|
220
|
+
extent: any;
|
|
221
|
+
};
|
|
222
|
+
columnRange: {
|
|
223
|
+
start: number;
|
|
224
|
+
end: number;
|
|
225
|
+
offset: number;
|
|
226
|
+
extent: any;
|
|
227
|
+
};
|
|
228
|
+
rows: {
|
|
229
|
+
index: number;
|
|
230
|
+
key: any;
|
|
231
|
+
start: any;
|
|
232
|
+
size: any;
|
|
233
|
+
pinned: any;
|
|
234
|
+
}[];
|
|
235
|
+
columns: {
|
|
236
|
+
index: number;
|
|
237
|
+
start: any;
|
|
238
|
+
size: any;
|
|
239
|
+
pinned: any;
|
|
240
|
+
}[];
|
|
241
|
+
};
|
|
242
|
+
restore(value: any): {
|
|
243
|
+
state: any;
|
|
244
|
+
reason: any;
|
|
245
|
+
rows: never[];
|
|
246
|
+
columns: never[];
|
|
247
|
+
} | {
|
|
248
|
+
state: string;
|
|
249
|
+
rowRange: {
|
|
250
|
+
start: number;
|
|
251
|
+
end: number;
|
|
252
|
+
offset: number;
|
|
253
|
+
extent: any;
|
|
254
|
+
};
|
|
255
|
+
columnRange: {
|
|
256
|
+
start: number;
|
|
257
|
+
end: number;
|
|
258
|
+
offset: number;
|
|
259
|
+
extent: any;
|
|
260
|
+
};
|
|
261
|
+
rows: {
|
|
262
|
+
index: number;
|
|
263
|
+
key: any;
|
|
264
|
+
start: any;
|
|
265
|
+
size: any;
|
|
266
|
+
pinned: any;
|
|
267
|
+
}[];
|
|
268
|
+
columns: {
|
|
269
|
+
index: number;
|
|
270
|
+
start: any;
|
|
271
|
+
size: any;
|
|
272
|
+
pinned: any;
|
|
273
|
+
}[];
|
|
274
|
+
} | {
|
|
275
|
+
state: string;
|
|
276
|
+
reason: string;
|
|
277
|
+
offset?: undefined;
|
|
278
|
+
left?: undefined;
|
|
279
|
+
} | {
|
|
280
|
+
reason?: undefined;
|
|
281
|
+
state: string;
|
|
282
|
+
offset: number;
|
|
283
|
+
left: number;
|
|
284
|
+
};
|
|
285
|
+
snapshot(): any;
|
|
286
|
+
scrollToOffset: (offset: any) => {
|
|
287
|
+
state: any;
|
|
288
|
+
reason: any;
|
|
289
|
+
rows: never[];
|
|
290
|
+
columns: never[];
|
|
291
|
+
} | {
|
|
292
|
+
state: string;
|
|
293
|
+
rowRange: {
|
|
294
|
+
start: number;
|
|
295
|
+
end: number;
|
|
296
|
+
offset: number;
|
|
297
|
+
extent: any;
|
|
298
|
+
};
|
|
299
|
+
columnRange: {
|
|
300
|
+
start: number;
|
|
301
|
+
end: number;
|
|
302
|
+
offset: number;
|
|
303
|
+
extent: any;
|
|
304
|
+
};
|
|
305
|
+
rows: {
|
|
306
|
+
index: number;
|
|
307
|
+
key: any;
|
|
308
|
+
start: any;
|
|
309
|
+
size: any;
|
|
310
|
+
pinned: any;
|
|
311
|
+
}[];
|
|
312
|
+
columns: {
|
|
313
|
+
index: number;
|
|
314
|
+
start: any;
|
|
315
|
+
size: any;
|
|
316
|
+
pinned: any;
|
|
317
|
+
}[];
|
|
318
|
+
} | {
|
|
319
|
+
state: string;
|
|
320
|
+
reason: string;
|
|
321
|
+
offset?: undefined;
|
|
322
|
+
left?: undefined;
|
|
323
|
+
} | {
|
|
324
|
+
reason?: undefined;
|
|
325
|
+
state: string;
|
|
326
|
+
offset: number;
|
|
327
|
+
left: number;
|
|
328
|
+
};
|
|
329
|
+
/** @param {number} index @param {number} [column] */
|
|
330
|
+
scrollToIndex(index: number, column?: number): {
|
|
331
|
+
state: any;
|
|
332
|
+
reason: any;
|
|
333
|
+
rows: never[];
|
|
334
|
+
columns: never[];
|
|
335
|
+
} | {
|
|
336
|
+
state: string;
|
|
337
|
+
rowRange: {
|
|
338
|
+
start: number;
|
|
339
|
+
end: number;
|
|
340
|
+
offset: number;
|
|
341
|
+
extent: any;
|
|
342
|
+
};
|
|
343
|
+
columnRange: {
|
|
344
|
+
start: number;
|
|
345
|
+
end: number;
|
|
346
|
+
offset: number;
|
|
347
|
+
extent: any;
|
|
348
|
+
};
|
|
349
|
+
rows: {
|
|
350
|
+
index: number;
|
|
351
|
+
key: any;
|
|
352
|
+
start: any;
|
|
353
|
+
size: any;
|
|
354
|
+
pinned: any;
|
|
355
|
+
}[];
|
|
356
|
+
columns: {
|
|
357
|
+
index: number;
|
|
358
|
+
start: any;
|
|
359
|
+
size: any;
|
|
360
|
+
pinned: any;
|
|
361
|
+
}[];
|
|
362
|
+
} | {
|
|
363
|
+
state: string;
|
|
364
|
+
reason: string;
|
|
365
|
+
offset?: undefined;
|
|
366
|
+
left?: undefined;
|
|
367
|
+
} | {
|
|
368
|
+
reason?: undefined;
|
|
369
|
+
state: string;
|
|
370
|
+
offset: number;
|
|
371
|
+
left: number;
|
|
372
|
+
};
|
|
373
|
+
scrollToKey(key: any): {
|
|
374
|
+
state: any;
|
|
375
|
+
reason: any;
|
|
376
|
+
rows: never[];
|
|
377
|
+
columns: never[];
|
|
378
|
+
} | {
|
|
379
|
+
state: string;
|
|
380
|
+
rowRange: {
|
|
381
|
+
start: number;
|
|
382
|
+
end: number;
|
|
383
|
+
offset: number;
|
|
384
|
+
extent: any;
|
|
385
|
+
};
|
|
386
|
+
columnRange: {
|
|
387
|
+
start: number;
|
|
388
|
+
end: number;
|
|
389
|
+
offset: number;
|
|
390
|
+
extent: any;
|
|
391
|
+
};
|
|
392
|
+
rows: {
|
|
393
|
+
index: number;
|
|
394
|
+
key: any;
|
|
395
|
+
start: any;
|
|
396
|
+
size: any;
|
|
397
|
+
pinned: any;
|
|
398
|
+
}[];
|
|
399
|
+
columns: {
|
|
400
|
+
index: number;
|
|
401
|
+
start: any;
|
|
402
|
+
size: any;
|
|
403
|
+
pinned: any;
|
|
404
|
+
}[];
|
|
405
|
+
} | {
|
|
406
|
+
state: string;
|
|
407
|
+
reason: string;
|
|
408
|
+
offset?: undefined;
|
|
409
|
+
left?: undefined;
|
|
410
|
+
} | {
|
|
411
|
+
reason?: undefined;
|
|
412
|
+
state: string;
|
|
413
|
+
offset: number;
|
|
414
|
+
left: number;
|
|
415
|
+
};
|
|
416
|
+
view(interaction?: null, id?: string): (string | (string | (string | any[] | {
|
|
417
|
+
key: number;
|
|
418
|
+
class: string;
|
|
419
|
+
role: string | undefined;
|
|
420
|
+
id: string | undefined;
|
|
421
|
+
'data-column': number;
|
|
422
|
+
'aria-colindex': number | undefined;
|
|
423
|
+
'aria-selected': any;
|
|
424
|
+
'data-active': boolean;
|
|
425
|
+
style: {
|
|
426
|
+
[x: string]: string | number;
|
|
427
|
+
position: string;
|
|
428
|
+
width: string;
|
|
429
|
+
height: string;
|
|
430
|
+
zIndex: number;
|
|
431
|
+
};
|
|
432
|
+
})[] | {
|
|
433
|
+
key: string;
|
|
434
|
+
'data-row': number;
|
|
435
|
+
'data-key': any;
|
|
436
|
+
role: string;
|
|
437
|
+
id: string | undefined;
|
|
438
|
+
'aria-rowindex': number | undefined;
|
|
439
|
+
'aria-posinset': number | undefined;
|
|
440
|
+
'aria-setsize': any;
|
|
441
|
+
'aria-selected': any;
|
|
442
|
+
class: string;
|
|
443
|
+
style: {
|
|
444
|
+
position: string;
|
|
445
|
+
top: string;
|
|
446
|
+
height: string;
|
|
447
|
+
width: string;
|
|
448
|
+
zIndex: number;
|
|
449
|
+
};
|
|
450
|
+
})[] | {
|
|
451
|
+
class: string;
|
|
452
|
+
style: {
|
|
453
|
+
position: string;
|
|
454
|
+
height: string;
|
|
455
|
+
width: string;
|
|
456
|
+
};
|
|
457
|
+
})[];
|
|
458
|
+
stats(): {
|
|
459
|
+
rows: number;
|
|
460
|
+
columns: number;
|
|
461
|
+
cells: number;
|
|
462
|
+
rowMeasurements: {
|
|
463
|
+
measurements: number;
|
|
464
|
+
bytes: number;
|
|
465
|
+
summaries: number;
|
|
466
|
+
};
|
|
467
|
+
columnMeasurements: {
|
|
468
|
+
measurements: number;
|
|
469
|
+
bytes: number;
|
|
470
|
+
summaries: number;
|
|
471
|
+
};
|
|
472
|
+
};
|
|
473
|
+
dispose(): void;
|
|
474
|
+
};
|