@tachui/data 0.8.0-alpha

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/dist/List.js ADDED
@@ -0,0 +1,481 @@
1
+ var L = Object.defineProperty;
2
+ var b = (l, t, e) => t in l ? L(l, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : l[t] = e;
3
+ var a = (l, t, e) => b(l, typeof t != "symbol" ? t + "" : t, e);
4
+ import { createSignal as S, isSignal as f, createEffect as I, h as u, withModifiers as x } from "@tachui/core";
5
+ import { ScrollView as E } from "@tachui/mobile";
6
+ class $ {
7
+ constructor(t) {
8
+ a(this, "type", "component");
9
+ a(this, "id");
10
+ a(this, "mounted", !1);
11
+ a(this, "cleanup", []);
12
+ a(this, "dataSignal");
13
+ a(this, "setData");
14
+ a(this, "sectionsSignal");
15
+ a(this, "setSections");
16
+ a(this, "selectedItemsSignal");
17
+ a(this, "setSelectedItems");
18
+ a(this, "isLoadingSignal");
19
+ a(this, "setIsLoading");
20
+ // Virtual scrolling state
21
+ a(this, "virtualItems", []);
22
+ a(this, "visibleStartIndex", 0);
23
+ a(this, "visibleEndIndex", 0);
24
+ a(this, "scrollOffset", 0);
25
+ a(this, "containerHeight", 0);
26
+ a(this, "totalHeight", 0);
27
+ /**
28
+ * Handle scroll events for virtual scrolling and infinite scroll
29
+ */
30
+ a(this, "handleListScroll", (t) => {
31
+ this.scrollOffset = t.offset.y, this.containerHeight = t.containerSize.height, this.props.virtualScrolling?.enabled && this.calculateVisibleRange(), this.props.onLoadMore && t.edges.bottom && (f(this.props.hasMore) ? this.props.hasMore() : this.props.hasMore) && !this.isLoadingSignal() && (this.setIsLoading(!0), this.props.onLoadMore().finally(() => {
32
+ this.setIsLoading(!1);
33
+ })), this.props.onScroll && this.props.onScroll(t);
34
+ });
35
+ this.props = t, this.id = `list-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
36
+ const [e, n] = S(this.resolveData());
37
+ this.dataSignal = e, this.setData = n;
38
+ const [r, i] = S(
39
+ this.resolveSections()
40
+ );
41
+ this.sectionsSignal = r, this.setSections = i;
42
+ const s = /* @__PURE__ */ new Set(), [o, h] = S(s);
43
+ this.selectedItemsSignal = o, this.setSelectedItems = h;
44
+ const [d, c] = S(
45
+ this.resolveIsLoading()
46
+ );
47
+ this.isLoadingSignal = d, this.setIsLoading = c, this.setupReactiveUpdates(), t.virtualScrolling?.enabled && this.initializeVirtualScrolling();
48
+ }
49
+ /**
50
+ * Helper to flatten render results
51
+ */
52
+ flattenRenderResult(t) {
53
+ return Array.isArray(t) ? t : [t];
54
+ }
55
+ /**
56
+ * Resolve data from various input types
57
+ */
58
+ resolveData() {
59
+ const { data: t } = this.props;
60
+ return Array.isArray(t) ? t : f(t) ? t() : [];
61
+ }
62
+ /**
63
+ * Resolve sections from various input types
64
+ */
65
+ resolveSections() {
66
+ const { sections: t } = this.props;
67
+ return Array.isArray(t) ? t : f(t) ? t() : [];
68
+ }
69
+ /**
70
+ * Resolve loading state
71
+ */
72
+ resolveIsLoading() {
73
+ const { isLoading: t } = this.props;
74
+ return typeof t == "boolean" ? t : f(t) ? t() : !1;
75
+ }
76
+ /**
77
+ * Set up reactive updates for data and state
78
+ */
79
+ setupReactiveUpdates() {
80
+ if (f(this.props.data)) {
81
+ const t = I(() => {
82
+ this.setData(this.resolveData()), this.updateVirtualScrolling();
83
+ });
84
+ this.cleanup.push(() => t.dispose());
85
+ }
86
+ if (f(this.props.sections)) {
87
+ const t = I(() => {
88
+ this.setSections(this.resolveSections()), this.updateVirtualScrolling();
89
+ });
90
+ this.cleanup.push(() => t.dispose());
91
+ }
92
+ if (f(this.props.isLoading)) {
93
+ const t = I(() => {
94
+ this.setIsLoading(this.resolveIsLoading());
95
+ });
96
+ this.cleanup.push(() => t.dispose());
97
+ }
98
+ if (this.props.selectedItems) {
99
+ const t = I(() => {
100
+ this.props.selectedItems && this.setSelectedItems(this.props.selectedItems());
101
+ });
102
+ this.cleanup.push(() => t.dispose());
103
+ }
104
+ }
105
+ /**
106
+ * Initialize virtual scrolling calculations
107
+ */
108
+ initializeVirtualScrolling() {
109
+ const t = this.dataSignal(), n = this.props.virtualScrolling.estimatedItemHeight || 50;
110
+ this.virtualItems = t.map((r, i) => ({
111
+ index: i,
112
+ height: n,
113
+ offset: i * n,
114
+ item: r
115
+ })), this.totalHeight = t.length * n;
116
+ }
117
+ /**
118
+ * Update virtual scrolling calculations
119
+ */
120
+ updateVirtualScrolling() {
121
+ this.props.virtualScrolling?.enabled && (this.initializeVirtualScrolling(), this.calculateVisibleRange());
122
+ }
123
+ /**
124
+ * Calculate visible item range for virtual scrolling
125
+ */
126
+ calculateVisibleRange() {
127
+ if (!this.props.virtualScrolling?.enabled) return;
128
+ const t = this.props.virtualScrolling, e = t.overscan || 5, n = t.threshold || 0;
129
+ let r = 0;
130
+ for (let s = 0; s < this.virtualItems.length; s++)
131
+ if (this.virtualItems[s].offset + this.virtualItems[s].height > this.scrollOffset - n) {
132
+ r = Math.max(0, s - e);
133
+ break;
134
+ }
135
+ let i = this.virtualItems.length - 1;
136
+ for (let s = r; s < this.virtualItems.length; s++)
137
+ if (this.virtualItems[s].offset > this.scrollOffset + this.containerHeight + n) {
138
+ i = Math.min(this.virtualItems.length - 1, s + e);
139
+ break;
140
+ }
141
+ this.visibleStartIndex = r, this.visibleEndIndex = i;
142
+ }
143
+ /**
144
+ * Handle item selection
145
+ */
146
+ handleItemSelection(t, e) {
147
+ const { selectionMode: n, getItemId: r, onSelectionChange: i } = this.props;
148
+ if (n === "none") return;
149
+ const s = r ? r(t, e) : e, o = new Set(this.selectedItemsSignal());
150
+ n === "single" ? (o.clear(), o.add(s)) : n === "multiple" && (o.has(s) ? o.delete(s) : o.add(s)), this.setSelectedItems(o), i && i(o);
151
+ }
152
+ /**
153
+ * Create list item component
154
+ */
155
+ createListItem(t, e, n) {
156
+ const { renderItem: r, style: i, onItemTap: s, onItemLongPress: o } = this.props, h = r(t, e);
157
+ return {
158
+ type: "component",
159
+ id: `${this.id}-item-${e}`,
160
+ mounted: !1,
161
+ cleanup: [],
162
+ props: {},
163
+ render: () => {
164
+ const d = u(
165
+ "div",
166
+ {
167
+ class: `tachui-list-item tachui-list-item-${i || "plain"}`,
168
+ style: {
169
+ display: "flex",
170
+ flexDirection: "column",
171
+ position: "relative",
172
+ backgroundColor: n ? "#e6f3ff" : "transparent",
173
+ transition: "background-color 0.2s ease",
174
+ cursor: s ? "pointer" : "default"
175
+ }
176
+ },
177
+ ...this.flattenRenderResult(h.render())
178
+ );
179
+ if (d.element) {
180
+ const c = d.element;
181
+ if (s && c.addEventListener("click", () => s(t, e)), o) {
182
+ let p;
183
+ const g = () => {
184
+ p = setTimeout(
185
+ () => o(t, e),
186
+ 500
187
+ );
188
+ }, m = () => {
189
+ clearTimeout(p);
190
+ };
191
+ c.addEventListener("mousedown", g), c.addEventListener("mouseup", m), c.addEventListener("mouseleave", m), c.addEventListener("touchstart", g), c.addEventListener("touchend", m);
192
+ }
193
+ this.props.selectionMode !== "none" && c.addEventListener("click", (p) => {
194
+ (p.metaKey || p.ctrlKey || this.props.selectionMode === "multiple") && (p.preventDefault(), this.handleItemSelection(t, e));
195
+ });
196
+ }
197
+ return [d];
198
+ }
199
+ };
200
+ }
201
+ /**
202
+ * Create list separator
203
+ */
204
+ createSeparator() {
205
+ const { separator: t } = this.props;
206
+ return t ? typeof t == "object" && "render" in t ? t : {
207
+ type: "component",
208
+ id: `${this.id}-separator`,
209
+ mounted: !1,
210
+ cleanup: [],
211
+ props: {},
212
+ render: () => [
213
+ u("div", {
214
+ class: "tachui-list-separator",
215
+ style: {
216
+ height: "1px",
217
+ backgroundColor: "#e0e0e0",
218
+ margin: "0 16px"
219
+ }
220
+ })
221
+ ]
222
+ } : null;
223
+ }
224
+ /**
225
+ * Create section header
226
+ */
227
+ createSectionHeader(t, e) {
228
+ return t.header ? typeof t.header == "string" ? {
229
+ type: "component",
230
+ id: `${this.id}-section-header-${e}`,
231
+ mounted: !1,
232
+ cleanup: [],
233
+ props: {},
234
+ render: () => [
235
+ u(
236
+ "div",
237
+ {
238
+ class: "tachui-list-section-header",
239
+ style: {
240
+ padding: "8px 16px",
241
+ backgroundColor: "#f8f9fa",
242
+ fontWeight: "600",
243
+ fontSize: "14px",
244
+ color: "#666",
245
+ textTransform: "uppercase",
246
+ letterSpacing: "0.5px"
247
+ }
248
+ },
249
+ t.header
250
+ )
251
+ ]
252
+ } : this.props.renderSectionHeader ? this.props.renderSectionHeader(t, e) : t.header : null;
253
+ }
254
+ /**
255
+ * Create section footer
256
+ */
257
+ createSectionFooter(t, e) {
258
+ return t.footer ? typeof t.footer == "string" ? {
259
+ type: "component",
260
+ id: `${this.id}-section-footer-${e}`,
261
+ mounted: !1,
262
+ cleanup: [],
263
+ props: {},
264
+ render: () => [
265
+ u(
266
+ "div",
267
+ {
268
+ class: "tachui-list-section-footer",
269
+ style: {
270
+ padding: "8px 16px",
271
+ fontSize: "12px",
272
+ color: "#999"
273
+ }
274
+ },
275
+ t.footer
276
+ )
277
+ ]
278
+ } : this.props.renderSectionFooter ? this.props.renderSectionFooter(t, e) : t.footer : null;
279
+ }
280
+ /**
281
+ * Create empty state component
282
+ */
283
+ createEmptyState() {
284
+ const { emptyState: t } = this.props;
285
+ return t || {
286
+ type: "component",
287
+ id: `${this.id}-empty`,
288
+ mounted: !1,
289
+ cleanup: [],
290
+ props: {},
291
+ render: () => [
292
+ u(
293
+ "div",
294
+ {
295
+ class: "tachui-list-empty",
296
+ style: {
297
+ display: "flex",
298
+ flexDirection: "column",
299
+ alignItems: "center",
300
+ justifyContent: "center",
301
+ padding: "40px 20px",
302
+ color: "#999",
303
+ fontSize: "16px"
304
+ }
305
+ },
306
+ "No items to display"
307
+ )
308
+ ]
309
+ };
310
+ }
311
+ /**
312
+ * Create loading indicator
313
+ */
314
+ createLoadingIndicator() {
315
+ const { loadingIndicator: t } = this.props;
316
+ return t || {
317
+ type: "component",
318
+ id: `${this.id}-loading`,
319
+ mounted: !1,
320
+ cleanup: [],
321
+ props: {},
322
+ render: () => [
323
+ u(
324
+ "div",
325
+ {
326
+ class: "tachui-list-loading",
327
+ style: {
328
+ display: "flex",
329
+ alignItems: "center",
330
+ justifyContent: "center",
331
+ padding: "20px",
332
+ color: "#999"
333
+ }
334
+ },
335
+ "Loading..."
336
+ )
337
+ ]
338
+ };
339
+ }
340
+ /**
341
+ * Render virtual scrolling content
342
+ */
343
+ renderVirtualContent() {
344
+ if (!this.props.virtualScrolling?.enabled)
345
+ return this.renderRegularContent();
346
+ const t = this.dataSignal(), e = this.selectedItemsSignal(), n = this.createSeparator(), r = [];
347
+ if (this.visibleStartIndex > 0) {
348
+ const i = this.virtualItems[this.visibleStartIndex]?.offset || 0;
349
+ r.push({
350
+ type: "component",
351
+ id: `${this.id}-spacer-top`,
352
+ mounted: !1,
353
+ cleanup: [],
354
+ props: {},
355
+ render: () => [
356
+ u("div", {
357
+ style: { height: `${i}px` }
358
+ })
359
+ ]
360
+ });
361
+ }
362
+ for (let i = this.visibleStartIndex; i <= this.visibleEndIndex && i < t.length; i++) {
363
+ const s = t[i], o = this.props.getItemId ? this.props.getItemId(s, i) : i, h = e.has(o);
364
+ r.push(this.createListItem(s, i, h)), n && i < t.length - 1 && r.push(n);
365
+ }
366
+ if (this.visibleEndIndex < t.length - 1) {
367
+ const i = this.totalHeight - (this.virtualItems[this.visibleEndIndex + 1]?.offset || 0);
368
+ r.push({
369
+ type: "component",
370
+ id: `${this.id}-spacer-bottom`,
371
+ mounted: !1,
372
+ cleanup: [],
373
+ props: {},
374
+ render: () => [
375
+ u("div", {
376
+ style: { height: `${i}px` }
377
+ })
378
+ ]
379
+ });
380
+ }
381
+ return r;
382
+ }
383
+ /**
384
+ * Render regular (non-virtual) content
385
+ */
386
+ renderRegularContent() {
387
+ const t = this.dataSignal(), e = this.sectionsSignal(), n = this.selectedItemsSignal(), r = this.createSeparator(), i = [];
388
+ return e.length > 0 ? e.forEach((s, o) => {
389
+ const h = this.createSectionHeader(s, o);
390
+ h && i.push(h), s.items.forEach((c, p) => {
391
+ const g = o * 1e3 + p, m = this.props.getItemId ? this.props.getItemId(c, g) : g, y = n.has(m);
392
+ i.push(this.createListItem(c, g, y)), r && p < s.items.length - 1 && i.push(r);
393
+ });
394
+ const d = this.createSectionFooter(s, o);
395
+ d && i.push(d);
396
+ }) : t.forEach((s, o) => {
397
+ const h = this.props.getItemId ? this.props.getItemId(s, o) : o, d = n.has(h);
398
+ i.push(this.createListItem(s, o, d)), r && o < t.length - 1 && i.push(r);
399
+ }), i;
400
+ }
401
+ /**
402
+ * Render the list component
403
+ */
404
+ render() {
405
+ const t = this.dataSignal(), e = this.isLoadingSignal();
406
+ if (e && t.length === 0) {
407
+ const s = this.createLoadingIndicator();
408
+ return s ? s.render() : [];
409
+ }
410
+ if (t.length === 0 && !e) {
411
+ const s = this.createEmptyState();
412
+ return s ? s.render() : [];
413
+ }
414
+ const n = this.props.virtualScrolling?.enabled ? this.renderVirtualContent() : this.renderRegularContent();
415
+ if (e && t.length > 0) {
416
+ const s = this.createLoadingIndicator();
417
+ s && n.push(s);
418
+ }
419
+ const r = {
420
+ ...this.props,
421
+ children: n,
422
+ onScroll: this.handleListScroll
423
+ };
424
+ return new E(r).render();
425
+ }
426
+ }
427
+ function v(l) {
428
+ const t = new $(l);
429
+ return x(t);
430
+ }
431
+ const C = {
432
+ /**
433
+ * Create a simple list from array
434
+ */
435
+ simple(l, t, e = {}) {
436
+ return v({
437
+ ...e,
438
+ data: l,
439
+ renderItem: t
440
+ });
441
+ },
442
+ /**
443
+ * Create a sectioned list
444
+ */
445
+ sectioned(l, t, e = {}) {
446
+ return v({
447
+ ...e,
448
+ sections: l,
449
+ renderItem: t
450
+ });
451
+ },
452
+ /**
453
+ * Create a virtual scrolling list for large datasets
454
+ */
455
+ virtual(l, t, e, n = {}) {
456
+ return v({
457
+ ...n,
458
+ data: l,
459
+ renderItem: t,
460
+ virtualScrolling: e
461
+ });
462
+ },
463
+ /**
464
+ * Create an infinite scrolling list
465
+ */
466
+ infinite(l, t, e, n, r = {}) {
467
+ return v({
468
+ ...r,
469
+ data: l,
470
+ renderItem: t,
471
+ onLoadMore: e,
472
+ hasMore: n
473
+ });
474
+ }
475
+ };
476
+ export {
477
+ $ as E,
478
+ v as L,
479
+ C as a
480
+ };
481
+ //# sourceMappingURL=List.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"List.js","sources":["../src/list/List.ts"],"sourcesContent":["/**\n * Enhanced List Components (Phase 5.5)\n *\n * SwiftUI-inspired List components with virtual scrolling, ForEach patterns,\n * and high-performance rendering for large datasets.\n */\n\nimport type { ModifiableComponent, ModifierBuilder } from '@tachui/core'\nimport { createEffect, createSignal, isSignal } from '@tachui/core'\nimport type { Signal } from '@tachui/core'\nimport { h } from '@tachui/core'\nimport type { ComponentInstance } from '@tachui/core'\nimport { ScrollView, type ScrollViewProps } from '@tachui/mobile'\nimport { withModifiers } from '@tachui/core'\n\n/**\n * List item selection mode\n */\nexport type SelectionMode = 'none' | 'single' | 'multiple'\n\n/**\n * List style\n */\nexport type ListStyle = 'plain' | 'grouped' | 'inset' | 'sidebar'\n\n/**\n * List item swipe action\n */\nexport interface SwipeAction {\n id: string\n title: string\n backgroundColor?: string\n foregroundColor?: string\n icon?: string\n destructive?: boolean\n onTap: () => void\n}\n\n/**\n * List section header/footer\n */\nexport interface ListSection<T = any> {\n id: string\n header?: string | ComponentInstance\n footer?: string | ComponentInstance\n items: T[]\n}\n\n/**\n * Virtual scrolling configuration\n */\nexport interface VirtualScrollConfig {\n enabled: boolean\n itemHeight?: number | ((index: number, item: any) => number)\n estimatedItemHeight?: number\n overscan?: number\n threshold?: number\n}\n\n/**\n * List component properties\n */\nexport interface ListProps<T = any> extends Omit<ScrollViewProps, 'children'> {\n // Data\n data?: T[] | Signal<T[]>\n sections?: ListSection<T>[] | Signal<ListSection<T>[]>\n\n // Rendering\n renderItem: (item: T, index: number) => ComponentInstance\n renderSectionHeader?: (\n section: ListSection<T>,\n index: number\n ) => ComponentInstance\n renderSectionFooter?: (\n section: ListSection<T>,\n index: number\n ) => ComponentInstance\n\n // Appearance\n style?: ListStyle\n separator?: boolean | ComponentInstance\n\n // Selection\n selectionMode?: SelectionMode\n selectedItems?: Signal<Set<string | number>>\n onSelectionChange?: (selectedItems: Set<string | number>) => void\n\n // Item actions\n leadingSwipeActions?: (item: T, index: number) => SwipeAction[]\n trailingSwipeActions?: (item: T, index: number) => SwipeAction[]\n onItemTap?: (item: T, index: number) => void\n onItemLongPress?: (item: T, index: number) => void\n\n // Virtual scrolling\n virtualScrolling?: VirtualScrollConfig\n\n // Performance\n getItemId?: (item: T, index: number) => string | number\n\n // Empty state\n emptyState?: ComponentInstance\n\n // Loading\n isLoading?: boolean | Signal<boolean>\n loadingIndicator?: ComponentInstance\n\n // Pull to refresh (inherited from ScrollView)\n onRefresh?: () => Promise<void>\n\n // Infinite scroll\n onLoadMore?: () => Promise<void>\n hasMore?: boolean | Signal<boolean>\n}\n\n// ForEach components imported from @tachui/flow-control\n\n/**\n * Virtual scroll item info\n */\ninterface VirtualScrollItem {\n index: number\n height: number\n offset: number\n item: any\n}\n\n/**\n * Enhanced List component class\n */\nexport class EnhancedList<T = any> implements ComponentInstance<ListProps<T>> {\n public readonly type = 'component' as const\n public readonly id: string\n public mounted = false\n public cleanup: (() => void)[] = []\n\n private dataSignal: () => T[]\n private setData: (data: T[]) => void\n private sectionsSignal: () => ListSection<T>[]\n private setSections: (sections: ListSection<T>[]) => void\n private selectedItemsSignal: () => Set<string | number>\n private setSelectedItems: (items: Set<string | number>) => void\n private isLoadingSignal: () => boolean\n private setIsLoading: (loading: boolean) => void\n\n // Virtual scrolling state\n private virtualItems: VirtualScrollItem[] = []\n private visibleStartIndex = 0\n private visibleEndIndex = 0\n private scrollOffset = 0\n private containerHeight = 0\n private totalHeight = 0\n\n constructor(public props: ListProps<T>) {\n this.id = `list-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`\n\n // Create reactive signals\n const [dataSignal, setData] = createSignal<T[]>(this.resolveData())\n this.dataSignal = dataSignal\n this.setData = setData\n\n const [sectionsSignal, setSections] = createSignal<ListSection<T>[]>(\n this.resolveSections()\n )\n this.sectionsSignal = sectionsSignal\n this.setSections = setSections\n\n const initialSelection = new Set<string | number>()\n const [selectedItemsSignal, setSelectedItems] =\n createSignal(initialSelection)\n this.selectedItemsSignal = selectedItemsSignal\n this.setSelectedItems = setSelectedItems\n\n const [isLoadingSignal, setIsLoading] = createSignal(\n this.resolveIsLoading()\n )\n this.isLoadingSignal = isLoadingSignal\n this.setIsLoading = setIsLoading\n\n // Set up reactive data updates\n this.setupReactiveUpdates()\n\n // Initialize virtual scrolling if enabled\n if (props.virtualScrolling?.enabled) {\n this.initializeVirtualScrolling()\n }\n }\n\n /**\n * Helper to flatten render results\n */\n private flattenRenderResult(result: any): any[] {\n return Array.isArray(result) ? result : [result]\n }\n\n /**\n * Resolve data from various input types\n */\n private resolveData(): T[] {\n const { data } = this.props\n\n if (Array.isArray(data)) {\n return data\n } else if (isSignal(data)) {\n return data()\n } else {\n return []\n }\n }\n\n /**\n * Resolve sections from various input types\n */\n private resolveSections(): ListSection<T>[] {\n const { sections } = this.props\n\n if (Array.isArray(sections)) {\n return sections\n } else if (isSignal(sections)) {\n return sections()\n } else {\n return []\n }\n }\n\n /**\n * Resolve loading state\n */\n private resolveIsLoading(): boolean {\n const { isLoading } = this.props\n\n if (typeof isLoading === 'boolean') {\n return isLoading\n } else if (isSignal(isLoading)) {\n return isLoading()\n } else {\n return false\n }\n }\n\n /**\n * Set up reactive updates for data and state\n */\n private setupReactiveUpdates(): void {\n // Data updates\n if (isSignal(this.props.data)) {\n const effect = createEffect(() => {\n this.setData(this.resolveData())\n this.updateVirtualScrolling()\n })\n this.cleanup.push(() => effect.dispose())\n }\n\n // Sections updates\n if (isSignal(this.props.sections)) {\n const effect = createEffect(() => {\n this.setSections(this.resolveSections())\n this.updateVirtualScrolling()\n })\n this.cleanup.push(() => effect.dispose())\n }\n\n // Loading state updates\n if (isSignal(this.props.isLoading)) {\n const effect = createEffect(() => {\n this.setIsLoading(this.resolveIsLoading())\n })\n this.cleanup.push(() => effect.dispose())\n }\n\n // Selection updates\n if (this.props.selectedItems) {\n const effect = createEffect(() => {\n if (this.props.selectedItems) {\n this.setSelectedItems(this.props.selectedItems())\n }\n })\n this.cleanup.push(() => effect.dispose())\n }\n }\n\n /**\n * Initialize virtual scrolling calculations\n */\n private initializeVirtualScrolling(): void {\n const data = this.dataSignal()\n const config = this.props.virtualScrolling!\n const estimatedHeight = config.estimatedItemHeight || 50\n\n this.virtualItems = data.map((item, index) => ({\n index,\n height: estimatedHeight,\n offset: index * estimatedHeight,\n item,\n }))\n\n this.totalHeight = data.length * estimatedHeight\n }\n\n /**\n * Update virtual scrolling calculations\n */\n private updateVirtualScrolling(): void {\n if (!this.props.virtualScrolling?.enabled) return\n\n this.initializeVirtualScrolling()\n this.calculateVisibleRange()\n }\n\n /**\n * Calculate visible item range for virtual scrolling\n */\n private calculateVisibleRange(): void {\n if (!this.props.virtualScrolling?.enabled) return\n\n const config = this.props.virtualScrolling\n const overscan = config.overscan || 5\n const threshold = config.threshold || 0\n\n // Find first visible item\n let startIndex = 0\n for (let i = 0; i < this.virtualItems.length; i++) {\n if (\n this.virtualItems[i].offset + this.virtualItems[i].height >\n this.scrollOffset - threshold\n ) {\n startIndex = Math.max(0, i - overscan)\n break\n }\n }\n\n // Find last visible item\n let endIndex = this.virtualItems.length - 1\n for (let i = startIndex; i < this.virtualItems.length; i++) {\n if (\n this.virtualItems[i].offset >\n this.scrollOffset + this.containerHeight + threshold\n ) {\n endIndex = Math.min(this.virtualItems.length - 1, i + overscan)\n break\n }\n }\n\n this.visibleStartIndex = startIndex\n this.visibleEndIndex = endIndex\n }\n\n /**\n * Handle item selection\n */\n private handleItemSelection(item: T, index: number): void {\n const { selectionMode, getItemId, onSelectionChange } = this.props\n\n if (selectionMode === 'none') return\n\n const itemId = getItemId ? getItemId(item, index) : index\n const currentSelection = new Set(this.selectedItemsSignal())\n\n if (selectionMode === 'single') {\n currentSelection.clear()\n currentSelection.add(itemId)\n } else if (selectionMode === 'multiple') {\n if (currentSelection.has(itemId)) {\n currentSelection.delete(itemId)\n } else {\n currentSelection.add(itemId)\n }\n }\n\n this.setSelectedItems(currentSelection)\n\n if (onSelectionChange) {\n onSelectionChange(currentSelection)\n }\n }\n\n /**\n * Create list item component\n */\n private createListItem(\n item: T,\n index: number,\n isSelected: boolean\n ): ComponentInstance {\n const { renderItem, style, onItemTap, onItemLongPress } = this.props\n\n const itemContent = renderItem(item, index)\n\n // Wrap in interactive container\n return {\n type: 'component',\n id: `${this.id}-item-${index}`,\n mounted: false,\n cleanup: [],\n props: {},\n render: () => {\n const itemElement = h(\n 'div',\n {\n class: `tachui-list-item tachui-list-item-${style || 'plain'}`,\n style: {\n display: 'flex',\n flexDirection: 'column',\n position: 'relative',\n backgroundColor: isSelected ? '#e6f3ff' : 'transparent',\n transition: 'background-color 0.2s ease',\n cursor: onItemTap ? 'pointer' : 'default',\n },\n },\n ...this.flattenRenderResult(itemContent.render())\n )\n\n // Add event handlers\n if (itemElement.element) {\n const element = itemElement.element as HTMLElement\n\n if (onItemTap) {\n element.addEventListener('click', () => onItemTap(item, index))\n }\n\n if (onItemLongPress) {\n let longPressTimer: NodeJS.Timeout\n\n const startLongPress = () => {\n longPressTimer = setTimeout(\n () => onItemLongPress(item, index),\n 500\n )\n }\n\n const cancelLongPress = () => {\n clearTimeout(longPressTimer)\n }\n\n element.addEventListener('mousedown', startLongPress)\n element.addEventListener('mouseup', cancelLongPress)\n element.addEventListener('mouseleave', cancelLongPress)\n element.addEventListener('touchstart', startLongPress)\n element.addEventListener('touchend', cancelLongPress)\n }\n\n // Selection handling\n if (this.props.selectionMode !== 'none') {\n element.addEventListener('click', e => {\n if (\n e.metaKey ||\n e.ctrlKey ||\n this.props.selectionMode === 'multiple'\n ) {\n e.preventDefault()\n this.handleItemSelection(item, index)\n }\n })\n }\n }\n\n return [itemElement]\n },\n }\n }\n\n /**\n * Create list separator\n */\n private createSeparator(): ComponentInstance | null {\n const { separator } = this.props\n\n if (!separator) return null\n\n if (typeof separator === 'object' && 'render' in separator) {\n return separator\n }\n\n return {\n type: 'component',\n id: `${this.id}-separator`,\n mounted: false,\n cleanup: [],\n props: {},\n render: () => [\n h('div', {\n class: 'tachui-list-separator',\n style: {\n height: '1px',\n backgroundColor: '#e0e0e0',\n margin: '0 16px',\n },\n }),\n ],\n }\n }\n\n /**\n * Create section header\n */\n private createSectionHeader(\n section: ListSection<T>,\n index: number\n ): ComponentInstance | null {\n if (!section.header) return null\n\n if (typeof section.header === 'string') {\n return {\n type: 'component',\n id: `${this.id}-section-header-${index}`,\n mounted: false,\n cleanup: [],\n props: {},\n render: () => [\n h(\n 'div',\n {\n class: 'tachui-list-section-header',\n style: {\n padding: '8px 16px',\n backgroundColor: '#f8f9fa',\n fontWeight: '600',\n fontSize: '14px',\n color: '#666',\n textTransform: 'uppercase',\n letterSpacing: '0.5px',\n },\n },\n section.header as string\n ),\n ],\n }\n }\n\n return this.props.renderSectionHeader\n ? this.props.renderSectionHeader(section, index)\n : (section.header as ComponentInstance)\n }\n\n /**\n * Create section footer\n */\n private createSectionFooter(\n section: ListSection<T>,\n index: number\n ): ComponentInstance | null {\n if (!section.footer) return null\n\n if (typeof section.footer === 'string') {\n return {\n type: 'component',\n id: `${this.id}-section-footer-${index}`,\n mounted: false,\n cleanup: [],\n props: {},\n render: () => [\n h(\n 'div',\n {\n class: 'tachui-list-section-footer',\n style: {\n padding: '8px 16px',\n fontSize: '12px',\n color: '#999',\n },\n },\n section.footer as string\n ),\n ],\n }\n }\n\n return this.props.renderSectionFooter\n ? this.props.renderSectionFooter(section, index)\n : (section.footer as ComponentInstance)\n }\n\n /**\n * Create empty state component\n */\n private createEmptyState(): ComponentInstance | null {\n const { emptyState } = this.props\n\n if (!emptyState) {\n return {\n type: 'component',\n id: `${this.id}-empty`,\n mounted: false,\n cleanup: [],\n props: {},\n render: () => [\n h(\n 'div',\n {\n class: 'tachui-list-empty',\n style: {\n display: 'flex',\n flexDirection: 'column',\n alignItems: 'center',\n justifyContent: 'center',\n padding: '40px 20px',\n color: '#999',\n fontSize: '16px',\n },\n },\n 'No items to display'\n ),\n ],\n }\n }\n\n return emptyState\n }\n\n /**\n * Create loading indicator\n */\n private createLoadingIndicator(): ComponentInstance | null {\n const { loadingIndicator } = this.props\n\n if (!loadingIndicator) {\n return {\n type: 'component',\n id: `${this.id}-loading`,\n mounted: false,\n cleanup: [],\n props: {},\n render: () => [\n h(\n 'div',\n {\n class: 'tachui-list-loading',\n style: {\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n padding: '20px',\n color: '#999',\n },\n },\n 'Loading...'\n ),\n ],\n }\n }\n\n return loadingIndicator\n }\n\n /**\n * Render virtual scrolling content\n */\n private renderVirtualContent(): ComponentInstance[] {\n if (!this.props.virtualScrolling?.enabled) {\n return this.renderRegularContent()\n }\n\n const data = this.dataSignal()\n const selectedItems = this.selectedItemsSignal()\n const separator = this.createSeparator()\n\n const visibleItems: ComponentInstance[] = []\n\n // Add spacer for items before visible range\n if (this.visibleStartIndex > 0) {\n const spacerHeight =\n this.virtualItems[this.visibleStartIndex]?.offset || 0\n visibleItems.push({\n type: 'component',\n id: `${this.id}-spacer-top`,\n mounted: false,\n cleanup: [],\n props: {},\n render: () => [\n h('div', {\n style: { height: `${spacerHeight}px` },\n }),\n ],\n })\n }\n\n // Render visible items\n for (\n let i = this.visibleStartIndex;\n i <= this.visibleEndIndex && i < data.length;\n i++\n ) {\n const item = data[i]\n const itemId = this.props.getItemId ? this.props.getItemId(item, i) : i\n const isSelected = selectedItems.has(itemId)\n\n visibleItems.push(this.createListItem(item, i, isSelected))\n\n if (separator && i < data.length - 1) {\n visibleItems.push(separator)\n }\n }\n\n // Add spacer for items after visible range\n if (this.visibleEndIndex < data.length - 1) {\n const remainingHeight =\n this.totalHeight -\n (this.virtualItems[this.visibleEndIndex + 1]?.offset || 0)\n visibleItems.push({\n type: 'component',\n id: `${this.id}-spacer-bottom`,\n mounted: false,\n cleanup: [],\n props: {},\n render: () => [\n h('div', {\n style: { height: `${remainingHeight}px` },\n }),\n ],\n })\n }\n\n return visibleItems\n }\n\n /**\n * Render regular (non-virtual) content\n */\n private renderRegularContent(): ComponentInstance[] {\n const data = this.dataSignal()\n const sections = this.sectionsSignal()\n const selectedItems = this.selectedItemsSignal()\n const separator = this.createSeparator()\n\n const content: ComponentInstance[] = []\n\n // Render sections if available\n if (sections.length > 0) {\n sections.forEach((section, sectionIndex) => {\n // Section header\n const header = this.createSectionHeader(section, sectionIndex)\n if (header) content.push(header)\n\n // Section items\n section.items.forEach((item, itemIndex) => {\n const globalIndex = sectionIndex * 1000 + itemIndex // Simple global index\n const itemId = this.props.getItemId\n ? this.props.getItemId(item, globalIndex)\n : globalIndex\n const isSelected = selectedItems.has(itemId)\n\n content.push(this.createListItem(item, globalIndex, isSelected))\n\n if (separator && itemIndex < section.items.length - 1) {\n content.push(separator)\n }\n })\n\n // Section footer\n const footer = this.createSectionFooter(section, sectionIndex)\n if (footer) content.push(footer)\n })\n } else {\n // Render flat data\n data.forEach((item, index) => {\n const itemId = this.props.getItemId\n ? this.props.getItemId(item, index)\n : index\n const isSelected = selectedItems.has(itemId)\n\n content.push(this.createListItem(item, index, isSelected))\n\n if (separator && index < data.length - 1) {\n content.push(separator)\n }\n })\n }\n\n return content\n }\n\n /**\n * Handle scroll events for virtual scrolling and infinite scroll\n */\n private handleListScroll = (scrollInfo: any) => {\n this.scrollOffset = scrollInfo.offset.y\n this.containerHeight = scrollInfo.containerSize.height\n\n // Update virtual scrolling\n if (this.props.virtualScrolling?.enabled) {\n this.calculateVisibleRange()\n }\n\n // Handle infinite scroll\n if (this.props.onLoadMore && scrollInfo.edges.bottom) {\n const hasMore = isSignal(this.props.hasMore)\n ? this.props.hasMore()\n : this.props.hasMore\n if (hasMore && !this.isLoadingSignal()) {\n this.setIsLoading(true)\n this.props.onLoadMore().finally(() => {\n this.setIsLoading(false)\n })\n }\n }\n\n // Forward to parent scroll handler\n if (this.props.onScroll) {\n this.props.onScroll(scrollInfo)\n }\n }\n\n /**\n * Render the list component\n */\n render() {\n const data = this.dataSignal()\n const isLoading = this.isLoadingSignal()\n\n // Show loading indicator if loading and no data\n if (isLoading && data.length === 0) {\n const loadingIndicator = this.createLoadingIndicator()\n return loadingIndicator ? loadingIndicator.render() : []\n }\n\n // Show empty state if no data\n if (data.length === 0 && !isLoading) {\n const emptyState = this.createEmptyState()\n return emptyState ? emptyState.render() : []\n }\n\n // Render list content\n const content = this.props.virtualScrolling?.enabled\n ? this.renderVirtualContent()\n : this.renderRegularContent()\n\n // Add loading indicator at bottom if loading more\n if (isLoading && data.length > 0) {\n const loadingIndicator = this.createLoadingIndicator()\n if (loadingIndicator) {\n content.push(loadingIndicator)\n }\n }\n\n // Create scroll view props\n const scrollViewProps: ScrollViewProps = {\n ...this.props,\n children: content,\n onScroll: this.handleListScroll,\n }\n\n // Create scroll view\n const scrollView = new (ScrollView as any)(scrollViewProps)\n return scrollView.render()\n }\n}\n\n// ForEach class implementation available from @tachui/flow-control\n\n/**\n * Create enhanced List component with modifier support\n */\nexport function List<T = any>(\n props: ListProps<T>\n): ModifiableComponent<ListProps<T>> & {\n modifier: ModifierBuilder<ModifiableComponent<ListProps<T>>>\n} {\n const component = new EnhancedList(props)\n return withModifiers(component)\n}\n\n// ForEach functions are imported from @tachui/flow-control\n\n/**\n * List utility functions\n */\nexport const ListUtils = {\n /**\n * Create a simple list from array\n */\n simple<T>(\n data: T[] | Signal<T[]>,\n renderItem: (item: T, index: number) => ComponentInstance,\n props: Omit<ListProps<T>, 'data' | 'renderItem'> = {}\n ): ModifiableComponent<ListProps<T>> & {\n modifier: ModifierBuilder<ModifiableComponent<ListProps<T>>>\n } {\n return List({\n ...props,\n data,\n renderItem,\n })\n },\n\n /**\n * Create a sectioned list\n */\n sectioned<T>(\n sections: ListSection<T>[] | Signal<ListSection<T>[]>,\n renderItem: (item: T, index: number) => ComponentInstance,\n props: Omit<ListProps<T>, 'sections' | 'renderItem'> = {}\n ): ModifiableComponent<ListProps<T>> & {\n modifier: ModifierBuilder<ModifiableComponent<ListProps<T>>>\n } {\n return List({\n ...props,\n sections,\n renderItem,\n })\n },\n\n /**\n * Create a virtual scrolling list for large datasets\n */\n virtual<T>(\n data: T[] | Signal<T[]>,\n renderItem: (item: T, index: number) => ComponentInstance,\n virtualConfig: VirtualScrollConfig,\n props: Omit<ListProps<T>, 'data' | 'renderItem' | 'virtualScrolling'> = {}\n ): ModifiableComponent<ListProps<T>> & {\n modifier: ModifierBuilder<ModifiableComponent<ListProps<T>>>\n } {\n return List({\n ...props,\n data,\n renderItem,\n virtualScrolling: virtualConfig,\n })\n },\n\n /**\n * Create an infinite scrolling list\n */\n infinite<T>(\n data: T[] | Signal<T[]>,\n renderItem: (item: T, index: number) => ComponentInstance,\n onLoadMore: () => Promise<void>,\n hasMore: boolean | Signal<boolean>,\n props: Omit<\n ListProps<T>,\n 'data' | 'renderItem' | 'onLoadMore' | 'hasMore'\n > = {}\n ): ModifiableComponent<ListProps<T>> & {\n modifier: ModifierBuilder<ModifiableComponent<ListProps<T>>>\n } {\n return List({\n ...props,\n data,\n renderItem,\n onLoadMore,\n hasMore,\n })\n },\n}\n"],"names":["EnhancedList","props","__publicField","scrollInfo","isSignal","dataSignal","setData","createSignal","sectionsSignal","setSections","initialSelection","selectedItemsSignal","setSelectedItems","isLoadingSignal","setIsLoading","result","data","sections","isLoading","effect","createEffect","estimatedHeight","item","index","config","overscan","threshold","startIndex","i","endIndex","selectionMode","getItemId","onSelectionChange","itemId","currentSelection","isSelected","renderItem","style","onItemTap","onItemLongPress","itemContent","itemElement","h","element","longPressTimer","startLongPress","cancelLongPress","e","separator","section","emptyState","loadingIndicator","selectedItems","visibleItems","spacerHeight","remainingHeight","content","sectionIndex","header","itemIndex","globalIndex","footer","scrollViewProps","ScrollView","List","component","withModifiers","ListUtils","virtual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