react-native-gtkx 0.1.0-alpha.2 → 0.1.0-alpha.4

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 (105) hide show
  1. package/README.md +41 -8
  2. package/dist/animated/create-animated.js +1 -1
  3. package/dist/animated/create-animated.js.map +1 -1
  4. package/dist/animated/index.js +3 -3
  5. package/dist/animated/index.js.map +1 -1
  6. package/dist/apis/back-handler.d.ts +9 -0
  7. package/dist/apis/back-handler.js +30 -0
  8. package/dist/apis/back-handler.js.map +1 -0
  9. package/dist/apis/host.d.ts +7 -1
  10. package/dist/apis/host.gtkx.js +12 -1
  11. package/dist/apis/host.gtkx.js.map +1 -1
  12. package/dist/apis/host.js.map +1 -1
  13. package/dist/apis/i18n-manager.d.ts +14 -0
  14. package/dist/apis/i18n-manager.js +20 -0
  15. package/dist/apis/i18n-manager.js.map +1 -0
  16. package/dist/apis/index.d.ts +17 -0
  17. package/dist/apis/index.js +5 -0
  18. package/dist/apis/index.js.map +1 -1
  19. package/dist/apis/interaction-manager.d.ts +16 -0
  20. package/dist/apis/interaction-manager.js +96 -0
  21. package/dist/apis/interaction-manager.js.map +1 -0
  22. package/dist/apis/linking.d.ts +4 -0
  23. package/dist/apis/linking.js +9 -0
  24. package/dist/apis/linking.js.map +1 -1
  25. package/dist/components/app-registry.d.ts +2 -0
  26. package/dist/components/app-registry.js +19 -2
  27. package/dist/components/app-registry.js.map +1 -1
  28. package/dist/components/flat-list.d.ts +2 -0
  29. package/dist/components/flat-list.js.map +1 -1
  30. package/dist/components/index.d.ts +1 -1
  31. package/dist/components/index.js +1 -1
  32. package/dist/components/index.js.map +1 -1
  33. package/dist/components/modal.d.ts +1 -1
  34. package/dist/components/pressable.js +4 -4
  35. package/dist/components/pressable.js.map +1 -1
  36. package/dist/components/root.d.ts +10 -1
  37. package/dist/components/root.js +39 -1
  38. package/dist/components/root.js.map +1 -1
  39. package/dist/components/scroll-view.js +58 -5
  40. package/dist/components/scroll-view.js.map +1 -1
  41. package/dist/components/text-input.d.ts +1 -0
  42. package/dist/components/text-input.js +34 -5
  43. package/dist/components/text-input.js.map +1 -1
  44. package/dist/components/use-layout-child.d.ts +1 -1
  45. package/dist/components/use-layout-child.js +22 -2
  46. package/dist/components/use-layout-child.js.map +1 -1
  47. package/dist/components/virtualized-list.d.ts +2 -0
  48. package/dist/components/virtualized-list.js +132 -10
  49. package/dist/components/virtualized-list.js.map +1 -1
  50. package/dist/contracts.js +2 -3
  51. package/dist/contracts.js.map +1 -1
  52. package/dist/gtkx/bridge/index.d.ts +4 -2
  53. package/dist/gtkx/bridge/index.js +7 -3
  54. package/dist/gtkx/bridge/index.js.map +1 -1
  55. package/dist/gtkx/bridge/measure.js +5 -0
  56. package/dist/gtkx/bridge/measure.js.map +1 -1
  57. package/dist/gtkx/bridge/theme.js +1 -1
  58. package/dist/gtkx/bridge/theme.js.map +1 -1
  59. package/dist/gtkx/bridge/use-signal.d.ts +2 -0
  60. package/dist/gtkx/bridge/use-signal.js +31 -0
  61. package/dist/gtkx/bridge/use-signal.js.map +1 -0
  62. package/dist/index.d.ts +2 -2
  63. package/dist/index.js +3 -3
  64. package/dist/index.js.map +1 -1
  65. package/dist/layout/engine.d.ts +4 -0
  66. package/dist/layout/engine.js +97 -5
  67. package/dist/layout/engine.js.map +1 -1
  68. package/dist/layout/node.d.ts +1 -1
  69. package/dist/layout/node.js +8 -5
  70. package/dist/layout/node.js.map +1 -1
  71. package/dist/metro/index.js +1 -0
  72. package/dist/metro/index.js.map +1 -1
  73. package/dist/navigation/index.d.ts +44 -0
  74. package/dist/navigation/index.js +216 -0
  75. package/dist/navigation/index.js.map +1 -0
  76. package/dist/navigation/option-warnings.d.ts +2 -0
  77. package/dist/navigation/option-warnings.js +61 -0
  78. package/dist/navigation/option-warnings.js.map +1 -0
  79. package/dist/navigation/sidebar.d.ts +37 -0
  80. package/dist/navigation/sidebar.js +71 -0
  81. package/dist/navigation/sidebar.js.map +1 -0
  82. package/dist/perf.d.ts +9 -0
  83. package/dist/perf.js +156 -0
  84. package/dist/perf.js.map +1 -0
  85. package/dist/runner/host-dev.js +15 -6
  86. package/dist/runner/host-dev.js.map +1 -1
  87. package/dist/runner/host.js +24 -9
  88. package/dist/runner/host.js.map +1 -1
  89. package/dist/runner/index.js +7 -3
  90. package/dist/runner/index.js.map +1 -1
  91. package/dist/style/colors.js +3 -1
  92. package/dist/style/colors.js.map +1 -1
  93. package/dist/style/index.js +2 -2
  94. package/dist/style/index.js.map +1 -1
  95. package/dist/style/registry.gtkx.js +1 -1
  96. package/dist/style/registry.gtkx.js.map +1 -1
  97. package/dist/style/split-style.js +1 -1
  98. package/dist/style/split-style.js.map +1 -1
  99. package/dist/style/text-align.js +1 -1
  100. package/dist/style/text-align.js.map +1 -1
  101. package/dist/vite/index.d.ts +5 -4
  102. package/dist/vite/index.js +42 -7
  103. package/dist/vite/index.js.map +1 -1
  104. package/package.json +18 -10
  105. package/types.d.ts +13 -0
@@ -7,6 +7,7 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
7
7
  // first visible row are anchored by compensating the scroll offset in the
8
8
  // same commit (docs/research/list-window.md).
9
9
  import { forwardRef, useEffect, useImperativeHandle, useLayoutEffect, useMemo, useRef, useState, } from "react";
10
+ import { perfAddTime, perfBurst, perfCount, perfEnabled, perfNow, } from "../perf";
10
11
  import { ActivityIndicator } from "./activity-indicator";
11
12
  import { ScrollView, StickySlot, } from "./scroll-view";
12
13
  import { View } from "./view";
@@ -36,7 +37,26 @@ const indexAt = (offsets, target) => {
36
37
  }
37
38
  return low;
38
39
  };
39
- const VirtualizedListInner = forwardRef(({ data, renderItem, keyExtractor, estimatedItemSize = 44, getItemLayout, windowSize = 5, initialNumToRender = 10, extraData, inverted = false, refreshing = false, onRefresh, ItemSeparatorComponent, ListHeaderComponent, ListFooterComponent, ListEmptyComponent, onEndReached, onEndReachedThreshold = 0.1, onViewableItemsChanged, viewabilityConfig, onScroll, onContentSizeChange, onLayout, horizontal = false, stickyHeaderIndices, ...scrollProps }, ref) => {
40
+ // Overscan default. RN ships 5 because a phone pays for mounted rows in
41
+ // memory; a desktop app does not, and here the mounted set is what costs
42
+ // frames: every window boundary crossing is a mount + Yoga reflow + GTK
43
+ // allocate burst, so a WIDER window means fewer crossings per scrolled pixel.
44
+ // Measured (docs/research/scroll-performance.md): 11 instead of 5 cuts
45
+ // mount/unmount churn by ~21% and late frames from ~10/s to ~7.7/s.
46
+ const DEFAULT_WINDOW_SIZE = 11;
47
+ // Perf: counts real React mounts/unmounts of windowed cells (rendered as a
48
+ // null child inside each cell only when GTKX_PERF=1).
49
+ const CellMountProbe = () => {
50
+ useLayoutEffect(() => {
51
+ perfCount("vl.cellMount");
52
+ perfBurst("vl.mountsPerFrame");
53
+ return () => {
54
+ perfCount("vl.cellUnmount");
55
+ };
56
+ }, []);
57
+ return null;
58
+ };
59
+ const VirtualizedListInner = forwardRef(({ data, renderItem, keyExtractor, estimatedItemSize = 44, getItemLayout, windowSize = DEFAULT_WINDOW_SIZE, initialNumToRender = 10, maxToRenderPerBatch = 10, updateCellsBatchingPeriod = 50, extraData, inverted = false, refreshing = false, onRefresh, ItemSeparatorComponent, ListHeaderComponent, ListFooterComponent, ListEmptyComponent, onEndReached, onEndReachedThreshold = 0.1, onViewableItemsChanged, viewabilityConfig, onScroll, onContentSizeChange, onLayout, horizontal = false, stickyHeaderIndices, ...scrollProps }, ref) => {
40
60
  const count = data.length;
41
61
  const scrollRef = useRef(null);
42
62
  const measured = useRef([]);
@@ -98,9 +118,24 @@ const VirtualizedListInner = forwardRef(({ data, renderItem, keyExtractor, estim
98
118
  first: 0,
99
119
  last: Math.min(count, initialNumToRender) - 1,
100
120
  }));
101
- const updateRange = () => {
102
- const overscan = Math.max(1, (windowSize - 1) / 2) * viewportH.current;
103
- // Window in visual (scroll) coordinates.
121
+ // Mirror of `range` for event-time math: several scroll events (and a
122
+ // batch timer) can run before React re-renders, and each needs the range
123
+ // the previous one asked for, not the one currently rendered.
124
+ const rangeRef = useRef(range);
125
+ const batchTimer = useRef(null);
126
+ // Mount allowance as a token bucket: maxToRenderPerBatch rows per
127
+ // updateCellsBatchingPeriod, NOT per pass. One frame can run several passes
128
+ // (scroll event, content-size report, measurement version bump) and a
129
+ // per-pass cap would let them stack back into the burst we are avoiding.
130
+ // A steady scroll needs about one row per frame, far under the refill, so
131
+ // its window still follows the offset exactly.
132
+ const batchTokens = useRef(0);
133
+ const batchFilledAt = useRef(0);
134
+ // The batch timer must call the LATEST closure (offsets/data may change).
135
+ const updateRangeRef = useRef(() => { });
136
+ // Index range covering the visual window grown by `overscan` px on both
137
+ // sides (0 → exactly the visible rows).
138
+ const rangeFor = (overscan) => {
104
139
  let start = scrollY.current - overscan;
105
140
  let end = scrollY.current + viewportH.current + overscan;
106
141
  if (inverted) {
@@ -110,12 +145,89 @@ const VirtualizedListInner = forwardRef(({ data, renderItem, keyExtractor, estim
110
145
  const extent = offsets[count];
111
146
  [start, end] = [extent - end, extent - start];
112
147
  }
113
- const first = indexAt(offsets, Math.max(0, start));
114
- const last = Math.min(count - 1, indexAt(offsets, end));
115
- setRange((current) => current.first === first && current.last === last
116
- ? current
117
- : { first, last });
148
+ return {
149
+ first: indexAt(offsets, Math.max(0, start)),
150
+ last: Math.min(count - 1, indexAt(offsets, end)),
151
+ };
152
+ };
153
+ const updateRange = () => {
154
+ perfCount("vl.updateRange");
155
+ const target = rangeFor(Math.max(1, (windowSize - 1) / 2) * viewportH.current);
156
+ const current = rangeRef.current;
157
+ // MOUNT BUDGET (RN maxToRenderPerBatch). A flick or a scrollToOffset
158
+ // moves the offset by whole viewports in a single frame, so the target
159
+ // window can be an almost entirely new set of rows — mounting it in one
160
+ // go is a burst of cell mounts + Yoga reflow + GTK allocate that shows
161
+ // up as a visible mid-flick stall (docs/research/scroll-performance.md).
162
+ // The VISIBLE rows are always mounted at once (a blank row is worse than
163
+ // a late one); the overscan beyond them fills in over the following
164
+ // batches.
165
+ const visible = rangeFor(0);
166
+ // Reuse the mounted set only when it still covers what is on screen.
167
+ // The mounted set is ONE contiguous range, so keeping a window that no
168
+ // longer reaches the visible rows would mean mounting the whole gap
169
+ // between them in this pass — the burst, by another route. Overlapping
170
+ // the target window is not enough: with a wide windowSize a jump of
171
+ // several viewports still overlaps it.
172
+ const reusable = current.last >= visible.first && current.first <= visible.last;
173
+ // Keep what is both mounted and still wanted, always covering the
174
+ // visible rows; after a teleport nothing is reusable and the visible
175
+ // rows are the whole starting window.
176
+ let first = reusable
177
+ ? Math.min(Math.max(current.first, target.first), visible.first)
178
+ : visible.first;
179
+ let last = reusable
180
+ ? Math.max(Math.min(current.last, target.last), visible.last)
181
+ : visible.last;
182
+ // Rows the visible set already costs this pass count against the batch:
183
+ // after a teleport they ARE the batch.
184
+ const kept = reusable
185
+ ? Math.max(0, Math.min(last, current.last) - Math.max(first, current.first) + 1)
186
+ : 0;
187
+ const now = Date.now();
188
+ if (now - batchFilledAt.current >= updateCellsBatchingPeriod) {
189
+ batchTokens.current = maxToRenderPerBatch;
190
+ batchFilledAt.current = now;
191
+ }
192
+ let budget = Math.max(0, batchTokens.current - (last - first + 1 - kept));
193
+ while (budget > 0 && (first > target.first || last < target.last)) {
194
+ if (last < target.last) {
195
+ last += 1;
196
+ budget -= 1;
197
+ }
198
+ if (budget > 0 && first > target.first) {
199
+ first -= 1;
200
+ budget -= 1;
201
+ }
202
+ }
203
+ batchTokens.current = budget;
204
+ if (first !== current.first || last !== current.last) {
205
+ perfCount("vl.rangeChange");
206
+ rangeRef.current = { first, last };
207
+ setRange({ first, last });
208
+ }
209
+ // Still short of the full window: continue on the next batch tick.
210
+ if (first > target.first || last < target.last) {
211
+ perfCount("vl.rangePending");
212
+ if (batchTimer.current === null) {
213
+ batchTimer.current = setTimeout(() => {
214
+ batchTimer.current = null;
215
+ updateRangeRef.current();
216
+ }, updateCellsBatchingPeriod);
217
+ }
218
+ }
118
219
  };
220
+ useLayoutEffect(() => {
221
+ updateRangeRef.current = updateRange;
222
+ });
223
+ useEffect(() => {
224
+ return () => {
225
+ if (batchTimer.current !== null) {
226
+ clearTimeout(batchTimer.current);
227
+ batchTimer.current = null;
228
+ }
229
+ };
230
+ }, []);
119
231
  // Clamp a scroll target to the valid range of the axis.
120
232
  const clampOffset = (target) => {
121
233
  const max = Math.max(0, offsets[count] - viewportH.current);
@@ -227,6 +339,8 @@ const VirtualizedListInner = forwardRef(({ data, renderItem, keyExtractor, estim
227
339
  return;
228
340
  }
229
341
  measured.current[index] = size;
342
+ perfCount("vl.versionBump");
343
+ perfBurst("vl.bumpsPerFrame");
230
344
  // A size change shifts every cell BEFORE the changed one in visual
231
345
  // order — for a normal list that is cells above the window (index <
232
346
  // first), compensated by the anchor. Inverted lists skip the anchor
@@ -487,13 +601,14 @@ const VirtualizedListInner = forwardRef(({ data, renderItem, keyExtractor, estim
487
601
  const measure = (event) => onItemLayout(index, horizontal
488
602
  ? event.nativeEvent.layout.width
489
603
  : event.nativeEvent.layout.height);
490
- const body = (_jsxs(_Fragment, { children: [renderItem({ item, index }), index < count - 1 && ItemSeparatorComponent ? (_jsx(ItemSeparatorComponent, {})) : null] }));
604
+ const body = (_jsxs(_Fragment, { children: [perfEnabled ? _jsx(CellMountProbe, {}) : null, renderItem({ item, index }), index < count - 1 && ItemSeparatorComponent ? (_jsx(ItemSeparatorComponent, {})) : null] }));
491
605
  if (stickySorted.includes(index)) {
492
606
  return (_jsx(StickySlot, { stickyKey: `cell-${key}`, top: cellStart(index), style: cellStyle, onLayout: measure, children: body }, key));
493
607
  }
494
608
  return (_jsx(View, { style: cellStyle, onLayout: measure, children: body }, key));
495
609
  };
496
610
  const cells = [];
611
+ const renderStart = perfEnabled ? perfNow() : 0;
497
612
  if (count > 0) {
498
613
  if (activeStickyIndex >= 0 && activeStickyIndex < range.first) {
499
614
  cells.push(renderCell(activeStickyIndex));
@@ -503,6 +618,13 @@ const VirtualizedListInner = forwardRef(({ data, renderItem, keyExtractor, estim
503
618
  cells.push(renderCell(index));
504
619
  }
505
620
  }
621
+ if (perfEnabled) {
622
+ // Element construction only — reconciliation and host mutations happen
623
+ // inside React afterwards; those are visible in engine.flush and the
624
+ // mount counters instead.
625
+ perfAddTime("vl.renderCells", perfNow() - renderStart);
626
+ perfCount("vl.render");
627
+ }
506
628
  // extraData participates in identity so memoized parents re-render rows.
507
629
  void extraData;
508
630
  // Accepted for RN parity only; no desktop gesture ever calls it.
@@ -1 +1 @@
1
- {"version":3,"file":"virtualized-list.js","sourceRoot":"","sources":["../../src/components/virtualized-list.tsx"],"names":[],"mappings":";AAAA,2EAA2E;AAC3E,2EAA2E;AAC3E,sEAAsE;AACtE,+EAA+E;AAC/E,2EAA2E;AAC3E,0EAA0E;AAC1E,8CAA8C;AAC9C,OAAO,EACL,UAAU,EACV,SAAS,EACT,mBAAmB,EACnB,eAAe,EACf,OAAO,EACP,MAAM,EACN,QAAQ,GAIT,MAAM,OAAO,CAAA;AAEd,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAA;AACxD,OAAO,EACL,UAAU,EACV,UAAU,GAIX,MAAM,eAAe,CAAA;AAEtB,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AA8E7B,MAAM,SAAS,GAAG,CAChB,SAA0D,EAC/C,EAAE;IACb,IAAI,SAAS,KAAK,IAAI,IAAI,SAAS,KAAK,SAAS,EAAE,CAAC;QAClD,OAAO,IAAI,CAAA;IACb,CAAC;IACD,IAAI,OAAO,SAAS,KAAK,UAAU,EAAE,CAAC;QACpC,MAAM,GAAG,GAAG,SAAS,CAAA;QACrB,OAAO,KAAC,GAAG,KAAG,CAAA;IAChB,CAAC;IACD,OAAO,SAAS,CAAA;AAClB,CAAC,CAAA;AAED,2EAA2E;AAC3E,sCAAsC;AACtC,MAAM,OAAO,GAAG,CAAC,OAAiB,EAAE,MAAc,EAAU,EAAE;IAC5D,IAAI,GAAG,GAAG,CAAC,CAAA;IACX,IAAI,IAAI,GAAG,OAAO,C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,KAAK,CAAE,EAAE;oBAC5B,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,KAAK,CAAE,EAAE,YAGhC,KAAK,GACD,CACR,EACA,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,mBAAmB,CAAC,IACrD,CACd,CAAA;AACH,CAAC,CACF,CAAA;AACD,oBAAoB,CAAC,WAAW,GAAG,iBAAiB,CAAA;AAEpD,MAAM,CAAC,MAAM,eAAe,GAAG,oBAEd,CAAA","sourcesContent":["// The windowed list core (RN VirtualizedList model, leaner): only the rows\n// around the viewport are mounted; the content View carries the prefix-sum\n// height so the ScrollView gets the full range; every mounted cell is\n// absolutely positioned at its offset. Heights come from getItemLayout (exact)\n// or estimatedItemSize refined by per-cell onLayout; corrections above the\n// first visible row are anchored by compensating the scroll offset in the\n// same commit (docs/research/list-window.md).\nimport {\n forwardRef,\n useEffect,\n useImperativeHandle,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n type ComponentType,\n type ReactElement,\n type ReactNode,\n} from \"react\"\nimport type { StyleProp } from \"../contracts\"\nimport { ActivityIndicator } from \"./activity-indicator\"\nimport {\n ScrollView,\n StickySlot,\n type ScrollEvent,\n type ScrollViewHandle,\n type ScrollViewProps,\n} from \"./scroll-view\"\nimport type { LayoutEvent } from \"./use-layout-child\"\nimport { View } from \"./view\"\n\nexport type ListRenderItemInfo<T> = { item: T; index: number }\n\nexport type ItemLayout = { length: number; offset: number; index: number }\n\n// RN ViewToken: one entry per item in the viewability report.\nexport type ViewToken<T = unknown> = {\n item: T\n key: string\n index: number\n isViewable: boolean\n}\n\nexport type ViewabilityConfig = {\n // Percent (0..100) of the ITEM that must be visible. A fully visible item\n // always counts, even when it covers less than the threshold.\n itemVisiblePercentThreshold?: number\n // Percent (0..100) of the VIEWPORT the item must cover. Takes precedence\n // over itemVisiblePercentThreshold when both are set (RN ViewabilityHelper).\n viewAreaCoveragePercentThreshold?: number\n // The item must stay continuously visible this many ms before it is\n // reported viewable; scrolling out before that cancels the report.\n minimumViewTime?: number\n}\n\n// RN FlatList scroll surface on top of ScrollViewHandle. The handle is not\n// generic: scrollToItem takes the item as unknown and resolves the index with\n// indexOf on the latest data.\nexport type VirtualizedListHandle = ScrollViewHandle & {\n scrollToIndex(params: {\n index: number\n viewPosition?: number\n animated?: boolean\n }): void\n scrollToItem(params: {\n item: unknown\n viewPosition?: number\n animated?: boolean\n }): void\n scrollToOffset(params: { offset: number; animated?: boolean }): void\n}\n\nexport type VirtualizedListProps<T> = Omit<ScrollViewProps, \"children\"> & {\n data: readonly T[]\n renderItem: (info: ListRenderItemInfo<T>) => ReactElement | null\n keyExtractor?: (item: T, index: number) => string\n estimatedItemSize?: number\n getItemLayout?: (data: readonly T[], index: number) => ItemLayout\n // Overscan in viewport multiples (RN semantics, default 5: two viewports\n // above, two below, one visible).\n windowSize?: number\n initialNumToRender?: number\n extraData?: unknown\n // RN inverted semantics: the list opens at the START of the data (visually\n // at the far end — a chat's latest message sits at the bottom), and\n // contentOffset counts from that end. See the projection math below.\n inverted?: boolean\n // RefreshControl parity. Desktop has no pull gesture: `refreshing` renders\n // a spinner row above the content; `onRefresh` is accepted for RN API\n // compatibility but is never triggered by a gesture — app code must call\n // it itself (e.g. from a toolbar button or a keyboard shortcut).\n refreshing?: boolean\n onRefresh?: () => void\n ItemSeparatorComponent?: ComponentType | null\n ListHeaderComponent?: ComponentType | ReactElement | null\n ListFooterComponent?: ComponentType | ReactElement | null\n ListEmptyComponent?: ComponentType | ReactElement | null\n onEndReached?: () => void\n onEndReachedThreshold?: number\n onViewableItemsChanged?: (info: {\n viewableItems: ViewToken<T>[]\n changed: ViewToken<T>[]\n }) => void\n viewabilityConfig?: ViewabilityConfig\n style?: StyleProp\n}\n\nconst renderAux = (\n component: ComponentType | ReactElement | null | undefined,\n): ReactNode => {\n if (component === null || component === undefined) {\n return null\n }\n if (typeof component === \"function\") {\n const Aux = component\n return <Aux />\n }\n return component\n}\n\n// First index whose offset-end is past `target` (binary search over prefix\n// sums; offsets has count+1 entries).\nconst indexAt = (offsets: number[], target: number): number => {\n let low = 0\n let high = offsets.length - 2\n while (low < high) {\n const mid = (low + high) >> 1\n if (offsets[mid + 1]! <= target) {\n low = mid + 1\n } else {\n high = mid\n }\n }\n return low\n}\n\nconst VirtualizedListInner = forwardRef(\n <T,>(\n {\n data,\n renderItem,\n keyExtractor,\n estimatedItemSize = 44,\n getItemLayout,\n windowSize = 5,\n initialNumToRender = 10,\n extraData,\n inverted = false,\n refreshing = false,\n onRefresh,\n ItemSeparatorComponent,\n ListHeaderComponent,\n ListFooterComponent,\n ListEmptyComponent,\n onEndReached,\n onEndReachedThreshold = 0.1,\n onViewableItemsChanged,\n viewabilityConfig,\n onScroll,\n onContentSizeChange,\n onLayout,\n horizontal = false,\n stickyHeaderIndices,\n ...scrollProps\n }: VirtualizedListProps<T>,\n ref: React.Ref<VirtualizedListHandle>,\n ) => {\n const count = data.length\n const scrollRef = useRef<ScrollViewHandle>(null)\n\n const measured = useRef<(number | undefined)[]>([])\n const [version, setVersion] = useState(0)\n // Scroll position along the main axis (contentOffset.x when horizontal).\n // Always in RAW adjustment space — all windowing math below is raw.\n const scrollY = useRef(0)\n // Viewport extent along the main axis (width when horizontal).\n const viewportH = useRef(0)\n // RN-space offset for inverted lists. RN's scaleY(-1) flip puts\n // contentOffset 0 at the far (raw) end of the content, so the exposed\n // offset counts from there: exposed = maxRaw - raw. It is the pinned\n // source of truth across content growth — restoring raw from it is what\n // keeps an inverted chat glued to its latest message on prepend.\n const exposedOffset = useRef(0)\n // Main-axis content size as GTK last reported it (the adjustment range).\n // The raw scroll maximum is contentMain - viewport; before the first\n // report it falls back to the list extent (header/footer not yet known).\n const contentMain = useRef(0)\n const pendingAnchor = useRef(0)\n // scrollToIndex issued while sizes were still estimates: re-run the\n // positioning once after the remount measures real sizes (≤2 scrollTo\n // corrections in total).\n const pendingScrollIndex = useRef<{\n index: number\n viewPosition: number\n animated?: boolean\n } | null>(null)\n const endReachedForSize = useRef(-1)\n // Currently reported viewable tokens keyed by item key (isViewable true).\n const viewableTokens = useRef(new Map<string, ViewToken<T>>())\n // Items meeting the viewability criteria but still waiting out\n // minimumViewTime; cancelled if they leave the viewport first.\n const viewabilityTimers = useRef(\n new Map<string, ReturnType<typeof setTimeout>>(),\n )\n // Keys whose minimumViewTime elapsed while continuously visible.\n const maturedKeys = useRef(new Set<string>())\n // Timers must call the LATEST closure (data may change while pending).\n const recomputeViewabilityRef = useRef<() => void>(() => {})\n\n // Prefix sums; rebuilt on any size correction (O(N) — cheap even at\n // 10k, see the spike). getItemLayout skips measuring entirely.\n const offsets = useMemo(() => {\n const out = new Array<number>(count + 1)\n out[0] = 0\n for (let index = 0; index < count; index += 1) {\n const size = getItemLayout\n ? getItemLayout(data, index).length\n : (measured.current[index] ?? estimatedItemSize)\n out[index + 1] = out[index]! + size\n }\n return out\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [count, version, estimatedItemSize, getItemLayout, data])\n\n // INVERTED PROJECTION. RN implements inverted as a scaleY(-1) flip of\n // the scroller and every cell; the net layout is the data mirrored\n // around the content extent C = offsets[count]: data index i occupies\n // [C - offsets[i+1], C - offsets[i]) in raw scroll space, so data index\n // 0 sits at the far end. The flip also reverses the scroll axis: RN's\n // contentOffset counts from that far end, so the raw GTK offset and the\n // exposed RN offset are complements (exposed = maxRaw - raw).\n const cellStart = (index: number): number =>\n inverted ? offsets[count]! - offsets[index + 1]! : offsets[index]!\n\n const keyOf = (item: T, index: number): string =>\n keyExtractor ? keyExtractor(item, index) : String(index)\n\n const [range, setRange] = useState(() => ({\n first: 0,\n last: Math.min(count, initialNumToRender) - 1,\n }))\n\n const updateRange = (): void => {\n const overscan = Math.max(1, (windowSize - 1) / 2) * viewportH.current\n // Window in visual (scroll) coordinates.\n let start = scrollY.current - overscan\n let end = scrollY.current + viewportH.current + overscan\n if (inverted) {\n // Map the visual window back to data-offset space: visual position v\n // covers data offsets C - v (mirror around the extent), so the\n // visual window [start, end] covers data offsets [C - end, C - start].\n const extent = offsets[count]!\n ;[start, end] = [extent - end, extent - start]\n }\n const first = indexAt(offsets, Math.max(0, start))\n const last = Math.min(count - 1, indexAt(offsets, end))\n setRange((current) =>\n current.first === first && current.last === last\n ? current\n : { first, last },\n )\n }\n\n // Clamp a scroll target to the valid range of the axis.\n const clampOffset = (target: number): number => {\n const max = Math.max(0, offsets[count]! - viewportH.current)\n return Math.min(max, Math.max(0, target))\n }\n\n // Raw scroll maximum along the main axis (adjustment upper - page).\n const maxRawScroll = (): number =>\n Math.max(0, (contentMain.current || offsets[count]!) - viewportH.current)\n\n // Translate an RN-space main-axis offset into raw adjustment space (and\n // back — the mapping is its own inverse).\n const toRaw = (offset: number): number =>\n Math.max(0, maxRawScroll() - offset)\n\n // Raw scroll offset that places `index` in the viewport: viewPosition 0\n // aligns the cell start with the viewport start, 0.5 centers it, 1\n // aligns the cell end with the viewport end. Inverted flips which edge\n // viewPosition 0 means: RN computes the target in data space and the\n // scaleY(-1) flip shows it from the other end, so 0 aligns the cell\n // with the visual BOTTOM — in mirrored raw coordinates that is the\n // complementary alignment.\n const offsetForIndex = (index: number, viewPosition: number): number => {\n const size = offsets[index + 1]! - offsets[index]!\n const align = inverted ? 1 - viewPosition : viewPosition\n return clampOffset(cellStart(index) - align * (viewportH.current - size))\n }\n\n const scrollToAxis = (offset: number, animated?: boolean): void => {\n scrollRef.current?.scrollTo(\n horizontal ? { x: offset, animated } : { y: offset, animated },\n )\n }\n\n const scrollToIndex = (params: {\n index: number\n viewPosition?: number\n animated?: boolean\n }): void => {\n if (count === 0) {\n return\n }\n const index = Math.min(count - 1, Math.max(0, Math.trunc(params.index)))\n const viewPosition = params.viewPosition ?? 0\n // Without getItemLayout the target may rest on estimates: remember the\n // request so the version effect can re-run the positioning once the\n // remounted cells have measured (the ≤2-corrections convergence).\n pendingScrollIndex.current = getItemLayout\n ? null\n : { index, viewPosition, animated: params.animated }\n scrollToAxis(offsetForIndex(index, viewPosition), params.animated)\n }\n\n useImperativeHandle(ref, () => ({\n // Any direct scroll cancels a pending scrollToIndex correction. The\n // caller always speaks RN-space offsets; inverted translates the main\n // axis into raw adjustment space.\n scrollTo: (options) => {\n pendingScrollIndex.current = null\n const main = horizontal ? options.x : options.y\n if (!inverted || main === undefined) {\n scrollRef.current?.scrollTo(options)\n return\n }\n scrollRef.current?.scrollTo({\n ...options,\n ...(horizontal ? { x: toRaw(main) } : { y: toRaw(main) }),\n })\n },\n scrollToEnd: (options) => {\n pendingScrollIndex.current = null\n // Inverted: the END of the data sits at raw offset 0 (visual top).\n if (inverted) {\n scrollToAxis(0, options?.animated)\n return\n }\n scrollRef.current?.scrollToEnd(options)\n },\n scrollToOffset: ({ offset, animated }) => {\n pendingScrollIndex.current = null\n scrollToAxis(inverted ? toRaw(offset) : offset, animated)\n },\n scrollToIndex,\n scrollToItem: ({ item, viewPosition, animated }) => {\n const index = data.indexOf(item as T)\n if (index >= 0) {\n scrollToIndex({ index, viewPosition, animated })\n }\n },\n }))\n\n // Data changes move the window in BOTH directions: growth from an empty\n // list must extend the initial range, shrinking must clamp it.\n useLayoutEffect(() => {\n updateRange()\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [count])\n\n // Runs right after offsets rebuilt from new measurements. A pending\n // scrollToIndex supersedes anchoring: re-issue the (now refined) target\n // once and stop — this is the second and final correction.\n useLayoutEffect(() => {\n const pending = pendingScrollIndex.current\n if (pending) {\n pendingScrollIndex.current = null\n pendingAnchor.current = 0\n scrollToAxis(\n offsetForIndex(pending.index, pending.viewPosition),\n pending.animated,\n )\n return\n }\n // Anchor: apply the accumulated correction delta right after offsets\n // rebuilt, in the same frame — the viewport does not visually move.\n if (pendingAnchor.current !== 0) {\n const delta = pendingAnchor.current\n pendingAnchor.current = 0\n scrollToAxis(scrollY.current + delta)\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [version])\n\n const onItemLayout = (index: number, size: number): void => {\n if (getItemLayout) {\n return\n }\n const known = measured.current[index] ?? estimatedItemSize\n if (Math.abs(known - size) < 0.5) {\n return\n }\n measured.current[index] = size\n // A size change shifts every cell BEFORE the changed one in visual\n // order — for a normal list that is cells above the window (index <\n // first), compensated by the anchor. Inverted lists skip the anchor\n // entirely: their correction is the exposed-offset restore on the\n // content-size report, which re-pins the view to the far end exactly\n // like RN's flip keeps contentOffset counting from there.\n if (!inverted && index < range.first) {\n pendingAnchor.current += size - known\n }\n setVersion((value) => value + 1)\n }\n\n // VIEWABILITY. Pure math over the prefix sums — no widget queries. All\n // positions are visual (scroll-space): cellStart already folds in the\n // inverted mirror and scrollY/viewportH track the main axis, so the same\n // code serves normal, inverted, and horizontal lists.\n const recomputeViewability = (): void => {\n if (!onViewableItemsChanged) {\n return\n }\n const viewport = viewportH.current\n const extent = offsets[count] ?? 0\n // Items currently meeting the visibility criteria, in index order.\n const eligible = new Map<string, { item: T; index: number }>()\n if (count > 0 && viewport > 0 && extent > 0) {\n const windowStart = scrollY.current\n const windowEnd = windowStart + viewport\n // Visible data-index range: mirror the visual window into data-offset\n // space when inverted (same mapping as updateRange, zero overscan).\n let start = windowStart\n let end = windowEnd\n if (inverted) {\n ;[start, end] = [extent - end, extent - start]\n }\n const first = indexAt(offsets, Math.max(0, start))\n const last = Math.min(count - 1, indexAt(offsets, end))\n const areaThreshold =\n viewabilityConfig?.viewAreaCoveragePercentThreshold\n const itemThreshold = viewabilityConfig?.itemVisiblePercentThreshold\n for (let index = first; index <= last; index += 1) {\n const length = offsets[index + 1]! - offsets[index]!\n const startPos = cellStart(index)\n const visible =\n Math.min(startPos + length, windowEnd) -\n Math.max(startPos, windowStart)\n if (visible <= 0) {\n continue\n }\n let viewable: boolean\n if (visible >= length) {\n // A fully visible item always counts, even when it covers less\n // than the configured share (RN ViewabilityHelper).\n viewable = true\n } else if (areaThreshold !== undefined) {\n viewable = (100 * visible) / viewport >= areaThreshold\n } else if (itemThreshold !== undefined) {\n viewable = (100 * visible) / length >= itemThreshold\n } else {\n // RN default: any visible pixel counts.\n viewable = true\n }\n if (viewable) {\n const item = data[index]!\n eligible.set(keyOf(item, index), { item, index })\n }\n }\n }\n const minimumViewTime = viewabilityConfig?.minimumViewTime ?? 0\n // Leaving the viewport cancels a pending timer and resets maturity —\n // re-entering restarts the continuous-visibility clock.\n for (const [key, timer] of viewabilityTimers.current) {\n if (!eligible.has(key)) {\n clearTimeout(timer)\n viewabilityTimers.current.delete(key)\n }\n }\n for (const key of maturedKeys.current) {\n if (!eligible.has(key)) {\n maturedKeys.current.delete(key)\n }\n }\n const next = new Map<string, ViewToken<T>>()\n for (const [key, entry] of eligible) {\n if (\n minimumViewTime <= 0 ||\n viewableTokens.current.has(key) ||\n maturedKeys.current.has(key)\n ) {\n next.set(key, {\n item: entry.item,\n key,\n index: entry.index,\n isViewable: true,\n })\n } else if (!viewabilityTimers.current.has(key)) {\n const timer = setTimeout(() => {\n viewabilityTimers.current.delete(key)\n maturedKeys.current.add(key)\n recomputeViewabilityRef.current()\n }, minimumViewTime)\n viewabilityTimers.current.set(key, timer)\n }\n }\n // Emit only when the viewable KEY SET changed: newly-viewable tokens\n // first, then the ones that left (isViewable false), each index-ordered.\n const changed: ViewToken<T>[] = []\n for (const token of next.values()) {\n if (!viewableTokens.current.has(token.key)) {\n changed.push(token)\n }\n }\n for (const token of viewableTokens.current.values()) {\n if (!next.has(token.key)) {\n changed.push({ ...token, isViewable: false })\n }\n }\n // Keep tokens fresh (indices may shift under stable keys) but stay\n // silent while the key set is unchanged.\n viewableTokens.current = next\n if (changed.length === 0) {\n return\n }\n onViewableItemsChanged({ viewableItems: [...next.values()], changed })\n }\n useLayoutEffect(() => {\n recomputeViewabilityRef.current = recomputeViewability\n })\n\n const maybeFireEndReached = (): void => {\n // Before the first layout the viewport extent is unknown — every\n // trigger path below re-runs once it is.\n if (!onEndReached || viewportH.current <= 0) {\n return\n }\n const extent = offsets[count]!\n const threshold =\n viewportH.current * Math.max(0, onEndReachedThreshold ?? 0.1)\n // Distance from the viewport to the DATA end (RN semantics: the end\n // of `data`, not the visual bottom). Normal lists keep the data end\n // at raw position `extent`; the inverted projection places it at raw\n // position 0 (the visual top), so the distance is simply the raw\n // scroll offset — an inverted chat fires this while scrolling up\n // into its history, which is where \"load older\" belongs.\n // Content shorter than the viewport has a negative distance, so short\n // lists fire right after the first layout without any scrolling.\n const distance = inverted\n ? scrollY.current\n : extent - (scrollY.current + viewportH.current)\n if (extent > 0 && distance <= threshold) {\n if (endReachedForSize.current !== extent) {\n endReachedForSize.current = extent\n onEndReached()\n }\n }\n }\n\n const handleScroll = (event: ScrollEvent): void => {\n const raw = horizontal\n ? event.nativeEvent.contentOffset.x\n : event.nativeEvent.contentOffset.y\n scrollY.current = raw\n if (inverted) {\n exposedOffset.current = Math.max(0, maxRawScroll() - raw)\n // The caller sees RN-space offsets: contentOffset 0 is the far end\n // where the data starts (a chat's latest message).\n onScroll?.({\n nativeEvent: {\n ...event.nativeEvent,\n contentOffset: {\n x: horizontal\n ? exposedOffset.current\n : event.nativeEvent.contentOffset.x,\n y: horizontal\n ? event.nativeEvent.contentOffset.y\n : exposedOffset.current,\n },\n },\n })\n } else {\n onScroll?.(event)\n }\n updateRange()\n recomputeViewability()\n maybeFireEndReached()\n }\n\n const handleLayout = (event: LayoutEvent): void => {\n onLayout?.(event)\n viewportH.current = horizontal\n ? event.nativeEvent.layout.width\n : event.nativeEvent.layout.height\n if (inverted) {\n // The viewport changed under a pinned exposed offset: re-derive the\n // raw position and window against the value we are about to take.\n // Best effort — the adjustment may still clamp against the previous\n // page size; the next content-size report settles it.\n scrollY.current = toRaw(exposedOffset.current)\n scrollToAxis(scrollY.current)\n }\n updateRange()\n // First layout doubles as the initial viewability/end-reached pass.\n recomputeViewability()\n maybeFireEndReached()\n }\n\n const handleContentSizeChange = (width: number, height: number): void => {\n onContentSizeChange?.(width, height)\n contentMain.current = horizontal ? width : height\n if (!inverted) {\n return\n }\n // The raw scroll range changed under a pinned exposed offset: restore\n // the raw value from it (the adjustment is fresh — GTK emits \"changed\"\n // only after the allocation that resized it). Content prepended to an\n // inverted chat therefore appears WITHOUT the view moving, exactly\n // like RN's contentOffset staying put under the flip. This also\n // performs the initial positioning: exposed 0 = the data start.\n const raw = toRaw(exposedOffset.current)\n scrollY.current = raw\n scrollToAxis(raw)\n updateRange()\n }\n\n // Data or measurement changes move content under a static viewport (no\n // scroll event fires): refresh viewability and the end-reached trigger.\n useEffect(() => {\n recomputeViewability()\n maybeFireEndReached()\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [offsets])\n\n // Unmount: cancel every pending minimumViewTime timer.\n useEffect(() => {\n const timers = viewabilityTimers.current\n return () => {\n for (const timer of timers.values()) {\n clearTimeout(timer)\n }\n timers.clear()\n }\n }, [])\n\n // Sticky cells (vertical, non-inverted): the ACTIVE header must stay\n // mounted even when its own offset left the window — extend the mount\n // set with it; geometry comes from the registry offsets, pinning is the\n // ScrollView registry's job (same mechanism as plain sticky children).\n const stickySorted =\n stickyHeaderIndices && !horizontal && !inverted\n ? [...stickyHeaderIndices].sort((a, b) => a - b)\n : []\n let activeStickyIndex = -1\n for (const stickyIndex of stickySorted) {\n if (stickyIndex < count && cellStart(stickyIndex) <= scrollY.current) {\n activeStickyIndex = stickyIndex\n }\n }\n\n const renderCell = (index: number): ReactNode => {\n const item = data[index]!\n const key = keyOf(item, index)\n // Vertical cells stretch across the width and sit at their offset;\n // horizontal cells stretch across the height and take their own\n // width from content (so onLayout can measure it).\n const cellStyle: StyleProp = horizontal\n ? { position: \"absolute\", left: cellStart(index), top: 0, bottom: 0 }\n : { position: \"absolute\", left: 0, right: 0, top: cellStart(index) }\n const measure = (event: {\n nativeEvent: { layout: { width: number; height: number } }\n }): void =>\n onItemLayout(\n index,\n horizontal\n ? event.nativeEvent.layout.width\n : event.nativeEvent.layout.height,\n )\n const body = (\n <>\n {renderItem({ item, index })}\n {index < count - 1 && ItemSeparatorComponent ? (\n <ItemSeparatorComponent />\n ) : null}\n </>\n )\n if (stickySorted.includes(index)) {\n return (\n <StickySlot\n key={key}\n stickyKey={`cell-${key}`}\n top={cellStart(index)}\n style={cellStyle}\n onLayout={measure}\n >\n {body}\n </StickySlot>\n )\n }\n return (\n <View\n key={key}\n style={cellStyle}\n onLayout={measure}\n >\n {body}\n </View>\n )\n }\n\n const cells: ReactNode[] = []\n if (count > 0) {\n if (activeStickyIndex >= 0 && activeStickyIndex < range.first) {\n cells.push(renderCell(activeStickyIndex))\n }\n const last = Math.min(range.last, count - 1)\n for (let index = range.first; index <= last; index += 1) {\n cells.push(renderCell(index))\n }\n }\n\n // extraData participates in identity so memoized parents re-render rows.\n void extraData\n // Accepted for RN parity only; no desktop gesture ever calls it.\n void onRefresh\n\n return (\n <ScrollView\n {...scrollProps}\n horizontal={horizontal}\n ref={scrollRef}\n onScroll={handleScroll}\n onContentSizeChange={handleContentSizeChange}\n onLayout={handleLayout}\n >\n {refreshing ? (\n // Desktop RefreshControl: no pull gesture exists, so `refreshing`\n // simply shows an in-flow spinner row above the list content.\n <View style={{ alignItems: \"center\", padding: 8 }}>\n <ActivityIndicator />\n </View>\n ) : null}\n {/* RN's flip mirrors the chrome too: on an inverted list the footer\n sits at the visual top and the header at the visual bottom. */}\n {renderAux(inverted ? ListFooterComponent : ListHeaderComponent)}\n {count === 0 && renderAux(ListEmptyComponent)}\n {count > 0 && (\n <View\n style={\n horizontal\n ? { width: offsets[count]! }\n : { height: offsets[count]! }\n }\n >\n {cells}\n </View>\n )}\n {renderAux(inverted ? ListHeaderComponent : ListFooterComponent)}\n </ScrollView>\n )\n },\n)\nVirtualizedListInner.displayName = \"VirtualizedList\"\n\nexport const VirtualizedList = VirtualizedListInner as <T>(\n props: VirtualizedListProps<T> & { ref?: React.Ref<VirtualizedListHandle> },\n) => ReactElement\n"]}
1
+ {"version":3,"file":"virtualized-list.js","sourceRoot":"","sources":["../../src/components/virtualized-list.tsx"],"names":[],"mappings":";AAAA,2EAA2E;AAC3E,2EAA2E;AAC3E,sEAAsE;AACtE,+E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EAAE,OAAO,EAAE,CAAC,EAAE,YAC/C,KAAC,iBAAiB,KAAG,GAChB,CACR,CAAC,CAAC,CAAC,IAAI,EAGP,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,mBAAmB,CAAC,EAC/D,KAAK,KAAK,CAAC,IAAI,SAAS,CAAC,kBAAkB,CAAC,EAC5C,KAAK,GAAG,CAAC,IAAI,CACZ,KAAC,IAAI,IACH,KAAK,EACH,UAAU;oBACR,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,CAAE,EAAE;oBAC5B,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,KAAK,CAAE,EAAE,YAGhC,KAAK,GACD,CACR,EACA,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,mBAAmB,CAAC,IACrD,CACd,CAAA;AACH,CAAC,CACF,CAAA;AACD,oBAAoB,CAAC,WAAW,GAAG,iBAAiB,CAAA;AAEpD,MAAM,CAAC,MAAM,eAAe,GAAG,oBAEd,CAAA","sourcesContent":["// The windowed list core (RN VirtualizedList model, leaner): only the rows\n// around the viewport are mounted; the content View carries the prefix-sum\n// height so the ScrollView gets the full range; every mounted cell is\n// absolutely positioned at its offset. Heights come from getItemLayout (exact)\n// or estimatedItemSize refined by per-cell onLayout; corrections above the\n// first visible row are anchored by compensating the scroll offset in the\n// same commit (docs/research/list-window.md).\nimport {\n forwardRef,\n useEffect,\n useImperativeHandle,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n type ComponentType,\n type ReactElement,\n type ReactNode,\n} from \"react\"\nimport type { StyleProp } from \"../contracts\"\nimport {\n perfAddTime,\n perfBurst,\n perfCount,\n perfEnabled,\n perfNow,\n} from \"../perf\"\nimport { ActivityIndicator } from \"./activity-indicator\"\nimport {\n ScrollView,\n StickySlot,\n type ScrollEvent,\n type ScrollViewHandle,\n type ScrollViewProps,\n} from \"./scroll-view\"\nimport type { LayoutEvent } from \"./use-layout-child\"\nimport { View } from \"./view\"\n\nexport type ListRenderItemInfo<T> = { item: T; index: number }\n\nexport type ItemLayout = { length: number; offset: number; index: number }\n\n// RN ViewToken: one entry per item in the viewability report.\nexport type ViewToken<T = unknown> = {\n item: T\n key: string\n index: number\n isViewable: boolean\n}\n\nexport type ViewabilityConfig = {\n // Percent (0..100) of the ITEM that must be visible. A fully visible item\n // always counts, even when it covers less than the threshold.\n itemVisiblePercentThreshold?: number\n // Percent (0..100) of the VIEWPORT the item must cover. Takes precedence\n // over itemVisiblePercentThreshold when both are set (RN ViewabilityHelper).\n viewAreaCoveragePercentThreshold?: number\n // The item must stay continuously visible this many ms before it is\n // reported viewable; scrolling out before that cancels the report.\n minimumViewTime?: number\n}\n\n// RN FlatList scroll surface on top of ScrollViewHandle. The handle is not\n// generic: scrollToItem takes the item as unknown and resolves the index with\n// indexOf on the latest data.\nexport type VirtualizedListHandle = ScrollViewHandle & {\n scrollToIndex(params: {\n index: number\n viewPosition?: number\n animated?: boolean\n }): void\n scrollToItem(params: {\n item: unknown\n viewPosition?: number\n animated?: boolean\n }): void\n scrollToOffset(params: { offset: number; animated?: boolean }): void\n}\n\nexport type VirtualizedListProps<T> = Omit<ScrollViewProps, \"children\"> & {\n data: readonly T[]\n renderItem: (info: ListRenderItemInfo<T>) => ReactElement | null\n keyExtractor?: (item: T, index: number) => string\n estimatedItemSize?: number\n getItemLayout?: (data: readonly T[], index: number) => ItemLayout\n // Overscan in viewport multiples (RN semantics: `windowSize` viewports are\n // mounted, one of them visible). RN's mobile default is 5; the desktop\n // default is 11 — see the note on DEFAULT_WINDOW_SIZE.\n windowSize?: number\n initialNumToRender?: number\n // RN batching pair. Rows OUTSIDE the visible area are mounted at most\n // `maxToRenderPerBatch` per pass, one pass every `updateCellsBatchingPeriod`\n // ms, so a flick or a long jump spreads its mounts over frames instead of\n // stalling one. The visible rows never wait for a batch.\n maxToRenderPerBatch?: number\n updateCellsBatchingPeriod?: number\n extraData?: unknown\n // RN inverted semantics: the list opens at the START of the data (visually\n // at the far end — a chat's latest message sits at the bottom), and\n // contentOffset counts from that end. See the projection math below.\n inverted?: boolean\n // RefreshControl parity. Desktop has no pull gesture: `refreshing` renders\n // a spinner row above the content; `onRefresh` is accepted for RN API\n // compatibility but is never triggered by a gesture — app code must call\n // it itself (e.g. from a toolbar button or a keyboard shortcut).\n refreshing?: boolean\n onRefresh?: () => void\n ItemSeparatorComponent?: ComponentType | null\n ListHeaderComponent?: ComponentType | ReactElement | null\n ListFooterComponent?: ComponentType | ReactElement | null\n ListEmptyComponent?: ComponentType | ReactElement | null\n onEndReached?: () => void\n onEndReachedThreshold?: number\n onViewableItemsChanged?: (info: {\n viewableItems: ViewToken<T>[]\n changed: ViewToken<T>[]\n }) => void\n viewabilityConfig?: ViewabilityConfig\n style?: StyleProp\n}\n\nconst renderAux = (\n component: ComponentType | ReactElement | null | undefined,\n): ReactNode => {\n if (component === null || component === undefined) {\n return null\n }\n if (typeof component === \"function\") {\n const Aux = component\n return <Aux />\n }\n return component\n}\n\n// First index whose offset-end is past `target` (binary search over prefix\n// sums; offsets has count+1 entries).\nconst indexAt = (offsets: number[], target: number): number => {\n let low = 0\n let high = offsets.length - 2\n while (low < high) {\n const mid = (low + high) >> 1\n if (offsets[mid + 1]! <= target) {\n low = mid + 1\n } else {\n high = mid\n }\n }\n return low\n}\n\n// Overscan default. RN ships 5 because a phone pays for mounted rows in\n// memory; a desktop app does not, and here the mounted set is what costs\n// frames: every window boundary crossing is a mount + Yoga reflow + GTK\n// allocate burst, so a WIDER window means fewer crossings per scrolled pixel.\n// Measured (docs/research/scroll-performance.md): 11 instead of 5 cuts\n// mount/unmount churn by ~21% and late frames from ~10/s to ~7.7/s.\nconst DEFAULT_WINDOW_SIZE = 11\n\n// Perf: counts real React mounts/unmounts of windowed cells (rendered as a\n// null child inside each cell only when GTKX_PERF=1).\nconst CellMountProbe = (): null => {\n useLayoutEffect(() => {\n perfCount(\"vl.cellMount\")\n perfBurst(\"vl.mountsPerFrame\")\n return () => {\n perfCount(\"vl.cellUnmount\")\n }\n }, [])\n return null\n}\n\nconst VirtualizedListInner = forwardRef(\n <T,>(\n {\n data,\n renderItem,\n keyExtractor,\n estimatedItemSize = 44,\n getItemLayout,\n windowSize = DEFAULT_WINDOW_SIZE,\n initialNumToRender = 10,\n maxToRenderPerBatch = 10,\n updateCellsBatchingPeriod = 50,\n extraData,\n inverted = false,\n refreshing = false,\n onRefresh,\n ItemSeparatorComponent,\n ListHeaderComponent,\n ListFooterComponent,\n ListEmptyComponent,\n onEndReached,\n onEndReachedThreshold = 0.1,\n onViewableItemsChanged,\n viewabilityConfig,\n onScroll,\n onContentSizeChange,\n onLayout,\n horizontal = false,\n stickyHeaderIndices,\n ...scrollProps\n }: VirtualizedListProps<T>,\n ref: React.Ref<VirtualizedListHandle>,\n ) => {\n const count = data.length\n const scrollRef = useRef<ScrollViewHandle>(null)\n\n const measured = useRef<(number | undefined)[]>([])\n const [version, setVersion] = useState(0)\n // Scroll position along the main axis (contentOffset.x when horizontal).\n // Always in RAW adjustment space — all windowing math below is raw.\n const scrollY = useRef(0)\n // Viewport extent along the main axis (width when horizontal).\n const viewportH = useRef(0)\n // RN-space offset for inverted lists. RN's scaleY(-1) flip puts\n // contentOffset 0 at the far (raw) end of the content, so the exposed\n // offset counts from there: exposed = maxRaw - raw. It is the pinned\n // source of truth across content growth — restoring raw from it is what\n // keeps an inverted chat glued to its latest message on prepend.\n const exposedOffset = useRef(0)\n // Main-axis content size as GTK last reported it (the adjustment range).\n // The raw scroll maximum is contentMain - viewport; before the first\n // report it falls back to the list extent (header/footer not yet known).\n const contentMain = useRef(0)\n const pendingAnchor = useRef(0)\n // scrollToIndex issued while sizes were still estimates: re-run the\n // positioning once after the remount measures real sizes (≤2 scrollTo\n // corrections in total).\n const pendingScrollIndex = useRef<{\n index: number\n viewPosition: number\n animated?: boolean\n } | null>(null)\n const endReachedForSize = useRef(-1)\n // Currently reported viewable tokens keyed by item key (isViewable true).\n const viewableTokens = useRef(new Map<string, ViewToken<T>>())\n // Items meeting the viewability criteria but still waiting out\n // minimumViewTime; cancelled if they leave the viewport first.\n const viewabilityTimers = useRef(\n new Map<string, ReturnType<typeof setTimeout>>(),\n )\n // Keys whose minimumViewTime elapsed while continuously visible.\n const maturedKeys = useRef(new Set<string>())\n // Timers must call the LATEST closure (data may change while pending).\n const recomputeViewabilityRef = useRef<() => void>(() => {})\n\n // Prefix sums; rebuilt on any size correction (O(N) — cheap even at\n // 10k, see the spike). getItemLayout skips measuring entirely.\n const offsets = useMemo(() => {\n const out = new Array<number>(count + 1)\n out[0] = 0\n for (let index = 0; index < count; index += 1) {\n const size = getItemLayout\n ? getItemLayout(data, index).length\n : (measured.current[index] ?? estimatedItemSize)\n out[index + 1] = out[index]! + size\n }\n return out\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [count, version, estimatedItemSize, getItemLayout, data])\n\n // INVERTED PROJECTION. RN implements inverted as a scaleY(-1) flip of\n // the scroller and every cell; the net layout is the data mirrored\n // around the content extent C = offsets[count]: data index i occupies\n // [C - offsets[i+1], C - offsets[i]) in raw scroll space, so data index\n // 0 sits at the far end. The flip also reverses the scroll axis: RN's\n // contentOffset counts from that far end, so the raw GTK offset and the\n // exposed RN offset are complements (exposed = maxRaw - raw).\n const cellStart = (index: number): number =>\n inverted ? offsets[count]! - offsets[index + 1]! : offsets[index]!\n\n const keyOf = (item: T, index: number): string =>\n keyExtractor ? keyExtractor(item, index) : String(index)\n\n const [range, setRange] = useState(() => ({\n first: 0,\n last: Math.min(count, initialNumToRender) - 1,\n }))\n // Mirror of `range` for event-time math: several scroll events (and a\n // batch timer) can run before React re-renders, and each needs the range\n // the previous one asked for, not the one currently rendered.\n const rangeRef = useRef(range)\n const batchTimer = useRef<ReturnType<typeof setTimeout> | null>(null)\n // Mount allowance as a token bucket: maxToRenderPerBatch rows per\n // updateCellsBatchingPeriod, NOT per pass. One frame can run several passes\n // (scroll event, content-size report, measurement version bump) and a\n // per-pass cap would let them stack back into the burst we are avoiding.\n // A steady scroll needs about one row per frame, far under the refill, so\n // its window still follows the offset exactly.\n const batchTokens = useRef(0)\n const batchFilledAt = useRef(0)\n // The batch timer must call the LATEST closure (offsets/data may change).\n const updateRangeRef = useRef<() => void>(() => {})\n\n // Index range covering the visual window grown by `overscan` px on both\n // sides (0 → exactly the visible rows).\n const rangeFor = (overscan: number): { first: number; last: number } => {\n let start = scrollY.current - overscan\n let end = scrollY.current + viewportH.current + overscan\n if (inverted) {\n // Map the visual window back to data-offset space: visual position v\n // covers data offsets C - v (mirror around the extent), so the\n // visual window [start, end] covers data offsets [C - end, C - start].\n const extent = offsets[count]!\n ;[start, end] = [extent - end, extent - start]\n }\n return {\n first: indexAt(offsets, Math.max(0, start)),\n last: Math.min(count - 1, indexAt(offsets, end)),\n }\n }\n\n const updateRange = (): void => {\n perfCount(\"vl.updateRange\")\n const target = rangeFor(\n Math.max(1, (windowSize - 1) / 2) * viewportH.current,\n )\n const current = rangeRef.current\n // MOUNT BUDGET (RN maxToRenderPerBatch). A flick or a scrollToOffset\n // moves the offset by whole viewports in a single frame, so the target\n // window can be an almost entirely new set of rows — mounting it in one\n // go is a burst of cell mounts + Yoga reflow + GTK allocate that shows\n // up as a visible mid-flick stall (docs/research/scroll-performance.md).\n // The VISIBLE rows are always mounted at once (a blank row is worse than\n // a late one); the overscan beyond them fills in over the following\n // batches.\n const visible = rangeFor(0)\n // Reuse the mounted set only when it still covers what is on screen.\n // The mounted set is ONE contiguous range, so keeping a window that no\n // longer reaches the visible rows would mean mounting the whole gap\n // between them in this pass — the burst, by another route. Overlapping\n // the target window is not enough: with a wide windowSize a jump of\n // several viewports still overlaps it.\n const reusable =\n current.last >= visible.first && current.first <= visible.last\n // Keep what is both mounted and still wanted, always covering the\n // visible rows; after a teleport nothing is reusable and the visible\n // rows are the whole starting window.\n let first = reusable\n ? Math.min(Math.max(current.first, target.first), visible.first)\n : visible.first\n let last = reusable\n ? Math.max(Math.min(current.last, target.last), visible.last)\n : visible.last\n // Rows the visible set already costs this pass count against the batch:\n // after a teleport they ARE the batch.\n const kept = reusable\n ? Math.max(\n 0,\n Math.min(last, current.last) - Math.max(first, current.first) + 1,\n )\n : 0\n const now = Date.now()\n if (now - batchFilledAt.current >= updateCellsBatchingPeriod) {\n batchTokens.current = maxToRenderPerBatch\n batchFilledAt.current = now\n }\n let budget = Math.max(0, batchTokens.current - (last - first + 1 - kept))\n while (budget > 0 && (first > target.first || last < target.last)) {\n if (last < target.last) {\n last += 1\n budget -= 1\n }\n if (budget > 0 && first > target.first) {\n first -= 1\n budget -= 1\n }\n }\n batchTokens.current = budget\n if (first !== current.first || last !== current.last) {\n perfCount(\"vl.rangeChange\")\n rangeRef.current = { first, last }\n setRange({ first, last })\n }\n // Still short of the full window: continue on the next batch tick.\n if (first > target.first || last < target.last) {\n perfCount(\"vl.rangePending\")\n if (batchTimer.current === null) {\n batchTimer.current = setTimeout(() => {\n batchTimer.current = null\n updateRangeRef.current()\n }, updateCellsBatchingPeriod)\n }\n }\n }\n useLayoutEffect(() => {\n updateRangeRef.current = updateRange\n })\n\n useEffect(() => {\n return () => {\n if (batchTimer.current !== null) {\n clearTimeout(batchTimer.current)\n batchTimer.current = null\n }\n }\n }, [])\n\n // Clamp a scroll target to the valid range of the axis.\n const clampOffset = (target: number): number => {\n const max = Math.max(0, offsets[count]! - viewportH.current)\n return Math.min(max, Math.max(0, target))\n }\n\n // Raw scroll maximum along the main axis (adjustment upper - page).\n const maxRawScroll = (): number =>\n Math.max(0, (contentMain.current || offsets[count]!) - viewportH.current)\n\n // Translate an RN-space main-axis offset into raw adjustment space (and\n // back — the mapping is its own inverse).\n const toRaw = (offset: number): number =>\n Math.max(0, maxRawScroll() - offset)\n\n // Raw scroll offset that places `index` in the viewport: viewPosition 0\n // aligns the cell start with the viewport start, 0.5 centers it, 1\n // aligns the cell end with the viewport end. Inverted flips which edge\n // viewPosition 0 means: RN computes the target in data space and the\n // scaleY(-1) flip shows it from the other end, so 0 aligns the cell\n // with the visual BOTTOM — in mirrored raw coordinates that is the\n // complementary alignment.\n const offsetForIndex = (index: number, viewPosition: number): number => {\n const size = offsets[index + 1]! - offsets[index]!\n const align = inverted ? 1 - viewPosition : viewPosition\n return clampOffset(cellStart(index) - align * (viewportH.current - size))\n }\n\n const scrollToAxis = (offset: number, animated?: boolean): void => {\n scrollRef.current?.scrollTo(\n horizontal ? { x: offset, animated } : { y: offset, animated },\n )\n }\n\n const scrollToIndex = (params: {\n index: number\n viewPosition?: number\n animated?: boolean\n }): void => {\n if (count === 0) {\n return\n }\n const index = Math.min(count - 1, Math.max(0, Math.trunc(params.index)))\n const viewPosition = params.viewPosition ?? 0\n // Without getItemLayout the target may rest on estimates: remember the\n // request so the version effect can re-run the positioning once the\n // remounted cells have measured (the ≤2-corrections convergence).\n pendingScrollIndex.current = getItemLayout\n ? null\n : { index, viewPosition, animated: params.animated }\n scrollToAxis(offsetForIndex(index, viewPosition), params.animated)\n }\n\n useImperativeHandle(ref, () => ({\n // Any direct scroll cancels a pending scrollToIndex correction. The\n // caller always speaks RN-space offsets; inverted translates the main\n // axis into raw adjustment space.\n scrollTo: (options) => {\n pendingScrollIndex.current = null\n const main = horizontal ? options.x : options.y\n if (!inverted || main === undefined) {\n scrollRef.current?.scrollTo(options)\n return\n }\n scrollRef.current?.scrollTo({\n ...options,\n ...(horizontal ? { x: toRaw(main) } : { y: toRaw(main) }),\n })\n },\n scrollToEnd: (options) => {\n pendingScrollIndex.current = null\n // Inverted: the END of the data sits at raw offset 0 (visual top).\n if (inverted) {\n scrollToAxis(0, options?.animated)\n return\n }\n scrollRef.current?.scrollToEnd(options)\n },\n scrollToOffset: ({ offset, animated }) => {\n pendingScrollIndex.current = null\n scrollToAxis(inverted ? toRaw(offset) : offset, animated)\n },\n scrollToIndex,\n scrollToItem: ({ item, viewPosition, animated }) => {\n const index = data.indexOf(item as T)\n if (index >= 0) {\n scrollToIndex({ index, viewPosition, animated })\n }\n },\n }))\n\n // Data changes move the window in BOTH directions: growth from an empty\n // list must extend the initial range, shrinking must clamp it.\n useLayoutEffect(() => {\n updateRange()\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [count])\n\n // Runs right after offsets rebuilt from new measurements. A pending\n // scrollToIndex supersedes anchoring: re-issue the (now refined) target\n // once and stop — this is the second and final correction.\n useLayoutEffect(() => {\n const pending = pendingScrollIndex.current\n if (pending) {\n pendingScrollIndex.current = null\n pendingAnchor.current = 0\n scrollToAxis(\n offsetForIndex(pending.index, pending.viewPosition),\n pending.animated,\n )\n return\n }\n // Anchor: apply the accumulated correction delta right after offsets\n // rebuilt, in the same frame — the viewport does not visually move.\n if (pendingAnchor.current !== 0) {\n const delta = pendingAnchor.current\n pendingAnchor.current = 0\n scrollToAxis(scrollY.current + delta)\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [version])\n\n const onItemLayout = (index: number, size: number): void => {\n if (getItemLayout) {\n return\n }\n const known = measured.current[index] ?? estimatedItemSize\n if (Math.abs(known - size) < 0.5) {\n return\n }\n measured.current[index] = size\n perfCount(\"vl.versionBump\")\n perfBurst(\"vl.bumpsPerFrame\")\n // A size change shifts every cell BEFORE the changed one in visual\n // order — for a normal list that is cells above the window (index <\n // first), compensated by the anchor. Inverted lists skip the anchor\n // entirely: their correction is the exposed-offset restore on the\n // content-size report, which re-pins the view to the far end exactly\n // like RN's flip keeps contentOffset counting from there.\n if (!inverted && index < range.first) {\n pendingAnchor.current += size - known\n }\n setVersion((value) => value + 1)\n }\n\n // VIEWABILITY. Pure math over the prefix sums — no widget queries. All\n // positions are visual (scroll-space): cellStart already folds in the\n // inverted mirror and scrollY/viewportH track the main axis, so the same\n // code serves normal, inverted, and horizontal lists.\n const recomputeViewability = (): void => {\n if (!onViewableItemsChanged) {\n return\n }\n const viewport = viewportH.current\n const extent = offsets[count] ?? 0\n // Items currently meeting the visibility criteria, in index order.\n const eligible = new Map<string, { item: T; index: number }>()\n if (count > 0 && viewport > 0 && extent > 0) {\n const windowStart = scrollY.current\n const windowEnd = windowStart + viewport\n // Visible data-index range: mirror the visual window into data-offset\n // space when inverted (same mapping as updateRange, zero overscan).\n let start = windowStart\n let end = windowEnd\n if (inverted) {\n ;[start, end] = [extent - end, extent - start]\n }\n const first = indexAt(offsets, Math.max(0, start))\n const last = Math.min(count - 1, indexAt(offsets, end))\n const areaThreshold =\n viewabilityConfig?.viewAreaCoveragePercentThreshold\n const itemThreshold = viewabilityConfig?.itemVisiblePercentThreshold\n for (let index = first; index <= last; index += 1) {\n const length = offsets[index + 1]! - offsets[index]!\n const startPos = cellStart(index)\n const visible =\n Math.min(startPos + length, windowEnd) -\n Math.max(startPos, windowStart)\n if (visible <= 0) {\n continue\n }\n let viewable: boolean\n if (visible >= length) {\n // A fully visible item always counts, even when it covers less\n // than the configured share (RN ViewabilityHelper).\n viewable = true\n } else if (areaThreshold !== undefined) {\n viewable = (100 * visible) / viewport >= areaThreshold\n } else if (itemThreshold !== undefined) {\n viewable = (100 * visible) / length >= itemThreshold\n } else {\n // RN default: any visible pixel counts.\n viewable = true\n }\n if (viewable) {\n const item = data[index]!\n eligible.set(keyOf(item, index), { item, index })\n }\n }\n }\n const minimumViewTime = viewabilityConfig?.minimumViewTime ?? 0\n // Leaving the viewport cancels a pending timer and resets maturity —\n // re-entering restarts the continuous-visibility clock.\n for (const [key, timer] of viewabilityTimers.current) {\n if (!eligible.has(key)) {\n clearTimeout(timer)\n viewabilityTimers.current.delete(key)\n }\n }\n for (const key of maturedKeys.current) {\n if (!eligible.has(key)) {\n maturedKeys.current.delete(key)\n }\n }\n const next = new Map<string, ViewToken<T>>()\n for (const [key, entry] of eligible) {\n if (\n minimumViewTime <= 0 ||\n viewableTokens.current.has(key) ||\n maturedKeys.current.has(key)\n ) {\n next.set(key, {\n item: entry.item,\n key,\n index: entry.index,\n isViewable: true,\n })\n } else if (!viewabilityTimers.current.has(key)) {\n const timer = setTimeout(() => {\n viewabilityTimers.current.delete(key)\n maturedKeys.current.add(key)\n recomputeViewabilityRef.current()\n }, minimumViewTime)\n viewabilityTimers.current.set(key, timer)\n }\n }\n // Emit only when the viewable KEY SET changed: newly-viewable tokens\n // first, then the ones that left (isViewable false), each index-ordered.\n const changed: ViewToken<T>[] = []\n for (const token of next.values()) {\n if (!viewableTokens.current.has(token.key)) {\n changed.push(token)\n }\n }\n for (const token of viewableTokens.current.values()) {\n if (!next.has(token.key)) {\n changed.push({ ...token, isViewable: false })\n }\n }\n // Keep tokens fresh (indices may shift under stable keys) but stay\n // silent while the key set is unchanged.\n viewableTokens.current = next\n if (changed.length === 0) {\n return\n }\n onViewableItemsChanged({ viewableItems: [...next.values()], changed })\n }\n useLayoutEffect(() => {\n recomputeViewabilityRef.current = recomputeViewability\n })\n\n const maybeFireEndReached = (): void => {\n // Before the first layout the viewport extent is unknown — every\n // trigger path below re-runs once it is.\n if (!onEndReached || viewportH.current <= 0) {\n return\n }\n const extent = offsets[count]!\n const threshold =\n viewportH.current * Math.max(0, onEndReachedThreshold ?? 0.1)\n // Distance from the viewport to the DATA end (RN semantics: the end\n // of `data`, not the visual bottom). Normal lists keep the data end\n // at raw position `extent`; the inverted projection places it at raw\n // position 0 (the visual top), so the distance is simply the raw\n // scroll offset — an inverted chat fires this while scrolling up\n // into its history, which is where \"load older\" belongs.\n // Content shorter than the viewport has a negative distance, so short\n // lists fire right after the first layout without any scrolling.\n const distance = inverted\n ? scrollY.current\n : extent - (scrollY.current + viewportH.current)\n if (extent > 0 && distance <= threshold) {\n if (endReachedForSize.current !== extent) {\n endReachedForSize.current = extent\n onEndReached()\n }\n }\n }\n\n const handleScroll = (event: ScrollEvent): void => {\n const raw = horizontal\n ? event.nativeEvent.contentOffset.x\n : event.nativeEvent.contentOffset.y\n scrollY.current = raw\n if (inverted) {\n exposedOffset.current = Math.max(0, maxRawScroll() - raw)\n // The caller sees RN-space offsets: contentOffset 0 is the far end\n // where the data starts (a chat's latest message).\n onScroll?.({\n nativeEvent: {\n ...event.nativeEvent,\n contentOffset: {\n x: horizontal\n ? exposedOffset.current\n : event.nativeEvent.contentOffset.x,\n y: horizontal\n ? event.nativeEvent.contentOffset.y\n : exposedOffset.current,\n },\n },\n })\n } else {\n onScroll?.(event)\n }\n updateRange()\n recomputeViewability()\n maybeFireEndReached()\n }\n\n const handleLayout = (event: LayoutEvent): void => {\n onLayout?.(event)\n viewportH.current = horizontal\n ? event.nativeEvent.layout.width\n : event.nativeEvent.layout.height\n if (inverted) {\n // The viewport changed under a pinned exposed offset: re-derive the\n // raw position and window against the value we are about to take.\n // Best effort — the adjustment may still clamp against the previous\n // page size; the next content-size report settles it.\n scrollY.current = toRaw(exposedOffset.current)\n scrollToAxis(scrollY.current)\n }\n updateRange()\n // First layout doubles as the initial viewability/end-reached pass.\n recomputeViewability()\n maybeFireEndReached()\n }\n\n const handleContentSizeChange = (width: number, height: number): void => {\n onContentSizeChange?.(width, height)\n contentMain.current = horizontal ? width : height\n if (!inverted) {\n return\n }\n // The raw scroll range changed under a pinned exposed offset: restore\n // the raw value from it (the adjustment is fresh — GTK emits \"changed\"\n // only after the allocation that resized it). Content prepended to an\n // inverted chat therefore appears WITHOUT the view moving, exactly\n // like RN's contentOffset staying put under the flip. This also\n // performs the initial positioning: exposed 0 = the data start.\n const raw = toRaw(exposedOffset.current)\n scrollY.current = raw\n scrollToAxis(raw)\n updateRange()\n }\n\n // Data or measurement changes move content under a static viewport (no\n // scroll event fires): refresh viewability and the end-reached trigger.\n useEffect(() => {\n recomputeViewability()\n maybeFireEndReached()\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [offsets])\n\n // Unmount: cancel every pending minimumViewTime timer.\n useEffect(() => {\n const timers = viewabilityTimers.current\n return () => {\n for (const timer of timers.values()) {\n clearTimeout(timer)\n }\n timers.clear()\n }\n }, [])\n\n // Sticky cells (vertical, non-inverted): the ACTIVE header must stay\n // mounted even when its own offset left the window — extend the mount\n // set with it; geometry comes from the registry offsets, pinning is the\n // ScrollView registry's job (same mechanism as plain sticky children).\n const stickySorted =\n stickyHeaderIndices && !horizontal && !inverted\n ? [...stickyHeaderIndices].sort((a, b) => a - b)\n : []\n let activeStickyIndex = -1\n for (const stickyIndex of stickySorted) {\n if (stickyIndex < count && cellStart(stickyIndex) <= scrollY.current) {\n activeStickyIndex = stickyIndex\n }\n }\n\n const renderCell = (index: number): ReactNode => {\n const item = data[index]!\n const key = keyOf(item, index)\n // Vertical cells stretch across the width and sit at their offset;\n // horizontal cells stretch across the height and take their own\n // width from content (so onLayout can measure it).\n const cellStyle: StyleProp = horizontal\n ? { position: \"absolute\", left: cellStart(index), top: 0, bottom: 0 }\n : { position: \"absolute\", left: 0, right: 0, top: cellStart(index) }\n const measure = (event: {\n nativeEvent: { layout: { width: number; height: number } }\n }): void =>\n onItemLayout(\n index,\n horizontal\n ? event.nativeEvent.layout.width\n : event.nativeEvent.layout.height,\n )\n const body = (\n <>\n {perfEnabled ? <CellMountProbe /> : null}\n {renderItem({ item, index })}\n {index < count - 1 && ItemSeparatorComponent ? (\n <ItemSeparatorComponent />\n ) : null}\n </>\n )\n if (stickySorted.includes(index)) {\n return (\n <StickySlot\n key={key}\n stickyKey={`cell-${key}`}\n top={cellStart(index)}\n style={cellStyle}\n onLayout={measure}\n >\n {body}\n </StickySlot>\n )\n }\n return (\n <View\n key={key}\n style={cellStyle}\n onLayout={measure}\n >\n {body}\n </View>\n )\n }\n\n const cells: ReactNode[] = []\n const renderStart = perfEnabled ? perfNow() : 0\n if (count > 0) {\n if (activeStickyIndex >= 0 && activeStickyIndex < range.first) {\n cells.push(renderCell(activeStickyIndex))\n }\n const last = Math.min(range.last, count - 1)\n for (let index = range.first; index <= last; index += 1) {\n cells.push(renderCell(index))\n }\n }\n if (perfEnabled) {\n // Element construction only — reconciliation and host mutations happen\n // inside React afterwards; those are visible in engine.flush and the\n // mount counters instead.\n perfAddTime(\"vl.renderCells\", perfNow() - renderStart)\n perfCount(\"vl.render\")\n }\n\n // extraData participates in identity so memoized parents re-render rows.\n void extraData\n // Accepted for RN parity only; no desktop gesture ever calls it.\n void onRefresh\n\n return (\n <ScrollView\n {...scrollProps}\n horizontal={horizontal}\n ref={scrollRef}\n onScroll={handleScroll}\n onContentSizeChange={handleContentSizeChange}\n onLayout={handleLayout}\n >\n {refreshing ? (\n // Desktop RefreshControl: no pull gesture exists, so `refreshing`\n // simply shows an in-flow spinner row above the list content.\n <View style={{ alignItems: \"center\", padding: 8 }}>\n <ActivityIndicator />\n </View>\n ) : null}\n {/* RN's flip mirrors the chrome too: on an inverted list the footer\n sits at the visual top and the header at the visual bottom. */}\n {renderAux(inverted ? ListFooterComponent : ListHeaderComponent)}\n {count === 0 && renderAux(ListEmptyComponent)}\n {count > 0 && (\n <View\n style={\n horizontal\n ? { width: offsets[count]! }\n : { height: offsets[count]! }\n }\n >\n {cells}\n </View>\n )}\n {renderAux(inverted ? ListHeaderComponent : ListFooterComponent)}\n </ScrollView>\n )\n },\n)\nVirtualizedListInner.displayName = \"VirtualizedList\"\n\nexport const VirtualizedList = VirtualizedListInner as <T>(\n props: VirtualizedListProps<T> & { ref?: React.Ref<VirtualizedListHandle> },\n) => ReactElement\n"]}
package/dist/contracts.js CHANGED
@@ -1,5 +1,4 @@
1
- // Shared contracts between the layout engine (task 004), the style system
2
- // (task 005), the API modules (task 007) and components (task 006).
3
- // FROZEN during parallel development: changes go through the orchestrator only.
1
+ // Shared contracts between the layout engine, the style system, the API
2
+ // modules and the components the one module every layer may import.
4
3
  export {};
5
4
  //# sourceMappingURL=contracts.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"contracts.js","sourceRoot":"","sources":["../src/contracts.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,oEAAoE;AACpE,gFAAgF","sourcesContent":["// Shared contracts between the layout engine (task 004), the style system\n// (task 005), the API modules (task 007) and components (task 006).\n// FROZEN during parallel development: changes go through the orchestrator only.\n\n// --- style ------------------------------------------------------------------\n\nexport type DimensionValue = number | `${number}%` | \"auto\"\n\nexport type FlexAlignType =\n \"flex-start\" | \"flex-end\" | \"center\" | \"stretch\" | \"baseline\"\n\n// Layout-affecting props: classified by the style system (005), consumed by\n// the layout engine (004) which maps them onto Yoga node setters.\nexport type LayoutStyle = Partial<{\n alignContent:\n | \"flex-start\"\n | \"flex-end\"\n | \"center\"\n | \"stretch\"\n | \"space-between\"\n | \"space-around\"\n alignItems: FlexAlignType\n alignSelf: \"auto\" | FlexAlignType\n aspectRatio: number | string\n bottom: DimensionValue\n columnGap: number\n direction: \"inherit\" | \"ltr\" | \"rtl\"\n display: \"none\" | \"flex\"\n flex: number\n flexBasis: DimensionValue\n flexDirection: \"row\" | \"row-reverse\" | \"column\" | \"column-reverse\"\n flexGrow: number\n flexShrink: number\n flexWrap: \"wrap\" | \"nowrap\" | \"wrap-reverse\"\n gap: number\n height: DimensionValue\n justifyContent:\n | \"flex-start\"\n | \"flex-end\"\n | \"center\"\n | \"space-between\"\n | \"space-around\"\n | \"space-evenly\"\n left: DimensionValue\n margin: DimensionValue\n marginBottom: DimensionValue\n marginHorizontal: DimensionValue\n marginLeft: DimensionValue\n marginRight: DimensionValue\n marginTop: DimensionValue\n marginVertical: DimensionValue\n maxHeight: DimensionValue\n maxWidth: DimensionValue\n minHeight: DimensionValue\n minWidth: DimensionValue\n overflow: \"visible\" | \"hidden\" | \"scroll\"\n padding: DimensionValue\n paddingBottom: DimensionValue\n paddingHorizontal: DimensionValue\n paddingLeft: DimensionValue\n paddingRight: DimensionValue\n paddingTop: DimensionValue\n paddingVertical: DimensionValue\n position: \"absolute\" | \"relative\" | \"static\"\n right: DimensionValue\n rowGap: number\n top: DimensionValue\n width: DimensionValue\n}>\n\nexport type TransformPart =\n | { translateX: number }\n | { translateY: number }\n | { scale: number }\n | { scaleX: number }\n | { scaleY: number }\n | { rotate: `${number}deg` | `${number}rad` }\n\n// Visual props: classified by the style system (005), compiled into GTK CSS\n// classes via the bridge `css` helper. Text-specific props apply to <Text>.\nexport type VisualStyle = Partial<{\n backgroundColor: string\n borderBottomColor: string\n borderBottomLeftRadius: number\n borderBottomRightRadius: number\n borderBottomWidth: number\n borderColor: string\n borderLeftColor: string\n borderLeftWidth: number\n borderRadius: number\n borderRightColor: string\n borderRightWidth: number\n borderStyle: \"solid\" | \"dotted\" | \"dashed\"\n borderTopColor: string\n borderTopLeftRadius: number\n borderTopRightRadius: number\n borderTopWidth: number\n borderWidth: number\n color: string\n fontFamily: string\n fontSize: number\n fontStyle: \"normal\" | \"italic\"\n fontWeight:\n | \"normal\"\n | \"bold\"\n | \"100\"\n | \"200\"\n | \"300\"\n | \"400\"\n | \"500\"\n | \"600\"\n | \"700\"\n | \"800\"\n | \"900\"\n letterSpacing: number\n lineHeight: number\n opacity: number\n // NOT emitted to CSS (no such GTK CSS property): the Text component (006)\n // applies it via label props using the pure style/text-align helper.\n textAlign: \"auto\" | \"left\" | \"right\" | \"center\" | \"justify\"\n // NOT emitted to CSS: applied by the engine through the layout manager\n // layout-child transforms (Animated fast path).\n transform: TransformPart[]\n}>\n\n// RN pointerEvents (also allowed in styles since RN 0.71); behavioral, so\n// it belongs to neither the layout nor the visual bucket — splitStyle\n// ignores it and View reads it from the flattened style.\nexport type PointerEventsValue = \"auto\" | \"none\" | \"box-none\" | \"box-only\"\n\nexport type FlatStyle = LayoutStyle &\n VisualStyle & {\n pointerEvents?: PointerEventsValue\n }\n\n// Style prop as components accept it: single object, array (with falsy holes).\nexport type StyleProp<T = FlatStyle> =\n T | null | undefined | false | ReadonlyArray<StyleProp<T>>\n\n// Result of classifying a flattened style (produced by 005):\nexport type SplitStyle = {\n layout: LayoutStyle\n visual: VisualStyle\n}\n\n// --- layout engine ----------------------------------------------------------\n\nexport type Rect = {\n x: number\n y: number\n width: number\n height: number\n}\n\nexport type MeasureConstraintMode = \"undefined\" | \"exactly\" | \"at-most\"\n\nexport type MeasureSize = { width: number; height: number }\n\n// Measure callback for leaf nodes (text, images): implemented by components\n// using bridge probes; called by the engine during Yoga layout passes.\nexport type MeasureFn = (\n width: number,\n widthMode: MeasureConstraintMode,\n height: number,\n heightMode: MeasureConstraintMode,\n) => MeasureSize\n\n// Handle the engine gives every mounted component (004 implements, 006 consumes).\nexport interface LayoutNodeApi {\n setStyle(style: LayoutStyle): void\n setMeasureFn(measure: MeasureFn | null): void\n markDirty(): void\n getRect(): Rect | null\n setOnLayout(callback: ((rect: Rect) => void) | null): void\n}\n\n// --- subscriptions (007) ----------------------------------------------------\n\nexport type SubscriptionHandle = { remove(): void }\n"]}
1
+ {"version":3,"file":"contracts.js","sourceRoot":"","sources":["../src/contracts.ts"],"names":[],"mappings":"AAAA,wEAAwE;AACxE,sEAAsE","sourcesContent":["// Shared contracts between the layout engine, the style system, the API\n// modules and the components the one module every layer may import.\n\n// --- style ------------------------------------------------------------------\n\nexport type DimensionValue = number | `${number}%` | \"auto\"\n\nexport type FlexAlignType =\n \"flex-start\" | \"flex-end\" | \"center\" | \"stretch\" | \"baseline\"\n\n// Layout-affecting props: classified by the style system, consumed by the\n// layout engine, which maps them onto Yoga node setters.\nexport type LayoutStyle = Partial<{\n alignContent:\n | \"flex-start\"\n | \"flex-end\"\n | \"center\"\n | \"stretch\"\n | \"space-between\"\n | \"space-around\"\n alignItems: FlexAlignType\n alignSelf: \"auto\" | FlexAlignType\n aspectRatio: number | string\n bottom: DimensionValue\n columnGap: number\n direction: \"inherit\" | \"ltr\" | \"rtl\"\n display: \"none\" | \"flex\"\n flex: number\n flexBasis: DimensionValue\n flexDirection: \"row\" | \"row-reverse\" | \"column\" | \"column-reverse\"\n flexGrow: number\n flexShrink: number\n flexWrap: \"wrap\" | \"nowrap\" | \"wrap-reverse\"\n gap: number\n height: DimensionValue\n justifyContent:\n | \"flex-start\"\n | \"flex-end\"\n | \"center\"\n | \"space-between\"\n | \"space-around\"\n | \"space-evenly\"\n left: DimensionValue\n margin: DimensionValue\n marginBottom: DimensionValue\n marginHorizontal: DimensionValue\n marginLeft: DimensionValue\n marginRight: DimensionValue\n marginTop: DimensionValue\n marginVertical: DimensionValue\n maxHeight: DimensionValue\n maxWidth: DimensionValue\n minHeight: DimensionValue\n minWidth: DimensionValue\n overflow: \"visible\" | \"hidden\" | \"scroll\"\n padding: DimensionValue\n paddingBottom: DimensionValue\n paddingHorizontal: DimensionValue\n paddingLeft: DimensionValue\n paddingRight: DimensionValue\n paddingTop: DimensionValue\n paddingVertical: DimensionValue\n position: \"absolute\" | \"relative\" | \"static\"\n right: DimensionValue\n rowGap: number\n top: DimensionValue\n width: DimensionValue\n}>\n\nexport type TransformPart =\n | { translateX: number }\n | { translateY: number }\n | { scale: number }\n | { scaleX: number }\n | { scaleY: number }\n | { rotate: `${number}deg` | `${number}rad` }\n\n// Visual props: classified by the style system, compiled into GTK CSS\n// classes via the bridge `css` helper. Text-specific props apply to <Text>.\nexport type VisualStyle = Partial<{\n backgroundColor: string\n borderBottomColor: string\n borderBottomLeftRadius: number\n borderBottomRightRadius: number\n borderBottomWidth: number\n borderColor: string\n borderLeftColor: string\n borderLeftWidth: number\n borderRadius: number\n borderRightColor: string\n borderRightWidth: number\n borderStyle: \"solid\" | \"dotted\" | \"dashed\"\n borderTopColor: string\n borderTopLeftRadius: number\n borderTopRightRadius: number\n borderTopWidth: number\n borderWidth: number\n color: string\n fontFamily: string\n fontSize: number\n fontStyle: \"normal\" | \"italic\"\n fontWeight:\n | \"normal\"\n | \"bold\"\n | \"100\"\n | \"200\"\n | \"300\"\n | \"400\"\n | \"500\"\n | \"600\"\n | \"700\"\n | \"800\"\n | \"900\"\n letterSpacing: number\n lineHeight: number\n opacity: number\n // NOT emitted to CSS (no such GTK CSS property): the Text component applies\n // it via label props using the pure style/text-align helper.\n textAlign: \"auto\" | \"left\" | \"right\" | \"center\" | \"justify\"\n // NOT emitted to CSS: applied by the engine through the layout manager\n // layout-child transforms (Animated fast path).\n transform: TransformPart[]\n}>\n\n// RN pointerEvents (also allowed in styles since RN 0.71); behavioral, so\n// it belongs to neither the layout nor the visual bucket — splitStyle\n// ignores it and View reads it from the flattened style.\nexport type PointerEventsValue = \"auto\" | \"none\" | \"box-none\" | \"box-only\"\n\nexport type FlatStyle = LayoutStyle &\n VisualStyle & {\n pointerEvents?: PointerEventsValue\n }\n\n// Style prop as components accept it: single object, array (with falsy holes).\nexport type StyleProp<T = FlatStyle> =\n T | null | undefined | false | ReadonlyArray<StyleProp<T>>\n\n// Result of classifying a flattened style (produced by the style system):\nexport type SplitStyle = {\n layout: LayoutStyle\n visual: VisualStyle\n}\n\n// --- layout engine ----------------------------------------------------------\n\nexport type Rect = {\n x: number\n y: number\n width: number\n height: number\n}\n\nexport type MeasureConstraintMode = \"undefined\" | \"exactly\" | \"at-most\"\n\nexport type MeasureSize = { width: number; height: number }\n\n// Measure callback for leaf nodes (text, images): implemented by components\n// using bridge probes; called by the engine during Yoga layout passes.\nexport type MeasureFn = (\n width: number,\n widthMode: MeasureConstraintMode,\n height: number,\n heightMode: MeasureConstraintMode,\n) => MeasureSize\n\n// Handle the layout engine gives every mounted component.\nexport interface LayoutNodeApi {\n setStyle(style: LayoutStyle): void\n setMeasureFn(measure: MeasureFn | null): void\n markDirty(): void\n getRect(): Rect | null\n setOnLayout(callback: ((rect: Rect) => void) | null): void\n}\n\n// --- subscriptions ----------------------------------------------------------\n\nexport type SubscriptionHandle = { remove(): void }\n"]}
@@ -7,8 +7,10 @@ import * as Gsk from "@gtkx/gi/gsk";
7
7
  import * as Gtk from "@gtkx/gi/gtk";
8
8
  import * as Pango from "@gtkx/gi/pango";
9
9
  export { Adw, Gdk, Gio, GLib, Graphene, Gsk, Gtk, Pango };
10
- export { GtkApplication, GtkApplicationWindow, GtkBox, GtkEntry, GtkGestureClick, GtkLabel, GtkPicture, GtkScrolledWindow, GtkSpinner, GtkSwitch, GtkTextView, GtkWindow, } from "@gtkx/jsx/gtk";
11
- export { createPortal, createRoot, quit, useApplication, useParentWindow, useProperty, useSignal, type Root, } from "@gtkx/react";
10
+ export { AdwApplicationWindow, AdwHeaderBar, AdwNavigationPage, AdwNavigationSplitView, AdwNavigationView, AdwToolbarView, } from "@gtkx/jsx/adw";
11
+ export { GtkApplication, GtkApplicationWindow, GtkBox, GtkButton, GtkEntry, GtkGestureClick, GtkLabel, GtkListBox, GtkListBoxRow, GtkPicture, GtkScrolledWindow, GtkSpinner, GtkSwitch, GtkTextView, GtkWindow, } from "@gtkx/jsx/gtk";
12
+ export { createPortal, createRoot, quit, useApplication, useParentWindow, useProperty, type Root, } from "@gtkx/react";
13
+ export { useSignal } from "./use-signal";
12
14
  export { css, cx, injectGlobal } from "@gtkx/css";
13
15
  export { createTextProbe, measureWidget, toNumber } from "./measure";
14
16
  export { getViewBoxComponent, setBoxPassthrough } from "./view-box";
@@ -1,7 +1,7 @@
1
1
  // The ONLY module allowed to import @gtkx/* (enforced by eslint no-restricted-imports).
2
2
  // gtkx is an RC dependency: when its API moves, this bridge absorbs the change.
3
3
  //
4
- // rc.1 caveats baked into this surface (see docs/research/yoga-gtk-spike.md):
4
+ // Caveats baked into this surface (catalogued in docs/gtkx-rc2-notes.md):
5
5
  // - 64-bit FFI values arrive as BigInt → normalize with toNumber() at this boundary
6
6
  // import-then-export (not `export * as`): the latter is the one syntax the
7
7
  // stock @react-native/babel-preset cannot transform — this form keeps
@@ -15,8 +15,12 @@ import * as Gsk from "@gtkx/gi/gsk";
15
15
  import * as Gtk from "@gtkx/gi/gtk";
16
16
  import * as Pango from "@gtkx/gi/pango";
17
17
  export { Adw, Gdk, Gio, GLib, Graphene, Gsk, Gtk, Pango };
18
- export { GtkApplication, GtkApplicationWindow, GtkBox, GtkEntry, GtkGestureClick, GtkLabel, GtkPicture, GtkScrolledWindow, GtkSpinner, GtkSwitch, GtkTextView, GtkWindow, } from "@gtkx/jsx/gtk";
19
- export { createPortal, createRoot, quit, useApplication, useParentWindow, useProperty, useSignal, } from "@gtkx/react";
18
+ export { AdwApplicationWindow, AdwHeaderBar, AdwNavigationPage, AdwNavigationSplitView, AdwNavigationView, AdwToolbarView, } from "@gtkx/jsx/adw";
19
+ export { GtkApplication, GtkApplicationWindow, GtkBox, GtkButton, GtkEntry, GtkGestureClick, GtkLabel, GtkListBox, GtkListBoxRow, GtkPicture, GtkScrolledWindow, GtkSpinner, GtkSwitch, GtkTextView, GtkWindow, } from "@gtkx/jsx/gtk";
20
+ export { createPortal, createRoot, quit, useApplication, useParentWindow, useProperty, } from "@gtkx/react";
21
+ // useSignal comes from ./use-signal, not @gtkx/react — see the workaround note
22
+ // there (rc.2 delivers a stale handler).
23
+ export { useSignal } from "./use-signal";
20
24
  export { css, cx, injectGlobal } from "@gtkx/css";
21
25
  export { createTextProbe, measureWidget, toNumber } from "./measure";
22
26
  export { getViewBoxComponent, setBoxPassthrough } from "./view-box";
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/gtkx/bridge/index.ts"],"names":[],"mappings":"AAAA,wFAAwF;AACxF,gFAAgF;AAChF,EAAE;AACF,8EAA8E;AAC9E,oFAAoF;AAEpF,2EAA2E;AAC3E,sEAAsE;AACtE,qDAAqD;AACrD,OAAO,KAAK,GAAG,MAAM,cAAc,CAAA;AACnC,OAAO,KAAK,GAAG,MAAM,cAAc,CAAA;AACnC,OAAO,KAAK,GAAG,MAAM,cAAc,CAAA;AACnC,OAAO,KAAK,IAAI,MAAM,eAAe,CAAA;AACrC,OAAO,KAAK,QAAQ,MAAM,mBAAmB,CAAA;AAC7C,OAAO,KAAK,GAAG,MAAM,cAAc,CAAA;AACnC,OAAO,KAAK,GAAG,MAAM,cAAc,CAAA;AACnC,OAAO,KAAK,KAAK,MAAM,gBAAgB,CAAA;AAEvC,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,CAAA;AAEzD,OAAO,EACL,cAAc,EACd,oBAAoB,EACpB,MAAM,EACN,QAAQ,EACR,eAAe,EACf,QAAQ,EACR,UAAU,EACV,iBAAiB,EACjB,UAAU,EACV,SAAS,EACT,WAAW,EACX,SAAS,GACV,MAAM,eAAe,CAAA;AAEtB,OAAO,EACL,YAAY,EACZ,UAAU,EACV,IAAI,EACJ,cAAc,EACd,eAAe,EACf,WAAW,EACX,SAAS,GAEV,MAAM,aAAa,CAAA;AAEpB,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAEjD,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAA;AACpE,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAA;AACnE,OAAO,EACL,aAAa,EACb,cAAc,EACd,cAAc,EACd,aAAa,EACb,WAAW,GAGZ,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA","sourcesContent":["// The ONLY module allowed to import @gtkx/* (enforced by eslint no-restricted-imports).\n// gtkx is an RC dependency: when its API moves, this bridge absorbs the change.\n//\n// rc.1 caveats baked into this surface (see docs/research/yoga-gtk-spike.md):\n// - 64-bit FFI values arrive as BigInt → normalize with toNumber() at this boundary\n\n// import-then-export (not `export * as`): the latter is the one syntax the\n// stock @react-native/babel-preset cannot transform — this form keeps\n// consumer apps on their unmodified RN Babel config.\nimport * as Adw from \"@gtkx/gi/adw\"\nimport * as Gdk from \"@gtkx/gi/gdk\"\nimport * as Gio from \"@gtkx/gi/gio\"\nimport * as GLib from \"@gtkx/gi/glib\"\nimport * as Graphene from \"@gtkx/gi/graphene\"\nimport * as Gsk from \"@gtkx/gi/gsk\"\nimport * as Gtk from \"@gtkx/gi/gtk\"\nimport * as Pango from \"@gtkx/gi/pango\"\n\nexport { Adw, Gdk, Gio, GLib, Graphene, Gsk, Gtk, Pango }\n\nexport {\n GtkApplication,\n GtkApplicationWindow,\n GtkBox,\n GtkEntry,\n GtkGestureClick,\n GtkLabel,\n GtkPicture,\n GtkScrolledWindow,\n GtkSpinner,\n GtkSwitch,\n GtkTextView,\n GtkWindow,\n} from \"@gtkx/jsx/gtk\"\n\nexport {\n createPortal,\n createRoot,\n quit,\n useApplication,\n useParentWindow,\n useProperty,\n useSignal,\n type Root,\n} from \"@gtkx/react\"\n\nexport { css, cx, injectGlobal } from \"@gtkx/css\"\n\nexport { createTextProbe, measureWidget, toNumber } from \"./measure\"\nexport { getViewBoxComponent, setBoxPassthrough } from \"./view-box\"\nexport {\n allocateChild,\n attachRnLayout,\n detachRnLayout,\n queueAllocate,\n queueResize,\n type RnLayoutHooks,\n type RnLayoutOrientation,\n} from \"./layout-manager\"\nexport { colorScheme, styleManager } from \"./theme\"\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/gtkx/bridge/index.ts"],"names":[],"mappings":"AAAA,wFAAwF;AACxF,gFAAgF;AAChF,EAAE;AACF,0EAA0E;AAC1E,oFAAoF;AAEpF,2EAA2E;AAC3E,sEAAsE;AACtE,qDAAqD;AACrD,OAAO,KAAK,GAAG,MAAM,cAAc,CAAA;AACnC,OAAO,KAAK,GAAG,MAAM,cAAc,CAAA;AACnC,OAAO,KAAK,GAAG,MAAM,cAAc,CAAA;AACnC,OAAO,KAAK,IAAI,MAAM,eAAe,CAAA;AACrC,OAAO,KAAK,QAAQ,MAAM,mBAAmB,CAAA;AAC7C,OAAO,KAAK,GAAG,MAAM,cAAc,CAAA;AACnC,OAAO,KAAK,GAAG,MAAM,cAAc,CAAA;AACnC,OAAO,KAAK,KAAK,MAAM,gBAAgB,CAAA;AAEvC,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,CAAA;AAEzD,OAAO,EACL,oBAAoB,EACpB,YAAY,EACZ,iBAAiB,EACjB,sBAAsB,EACtB,iBAAiB,EACjB,cAAc,GACf,MAAM,eAAe,CAAA;AAEtB,OAAO,EACL,cAAc,EACd,oBAAoB,EACpB,MAAM,EACN,SAAS,EACT,QAAQ,EACR,eAAe,EACf,QAAQ,EACR,UAAU,EACV,aAAa,EACb,UAAU,EACV,iBAAiB,EACjB,UAAU,EACV,SAAS,EACT,WAAW,EACX,SAAS,GACV,MAAM,eAAe,CAAA;AAEtB,OAAO,EACL,YAAY,EACZ,UAAU,EACV,IAAI,EACJ,cAAc,EACd,eAAe,EACf,WAAW,GAEZ,MAAM,aAAa,CAAA;AAEpB,+EAA+E;AAC/E,yCAAyC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAExC,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAEjD,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAA;AACpE,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAA;AACnE,OAAO,EACL,aAAa,EACb,cAAc,EACd,cAAc,EACd,aAAa,EACb,WAAW,GAGZ,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA","sourcesContent":["// The ONLY module allowed to import @gtkx/* (enforced by eslint no-restricted-imports).\n// gtkx is an RC dependency: when its API moves, this bridge absorbs the change.\n//\n// Caveats baked into this surface (catalogued in docs/gtkx-rc2-notes.md):\n// - 64-bit FFI values arrive as BigInt → normalize with toNumber() at this boundary\n\n// import-then-export (not `export * as`): the latter is the one syntax the\n// stock @react-native/babel-preset cannot transform — this form keeps\n// consumer apps on their unmodified RN Babel config.\nimport * as Adw from \"@gtkx/gi/adw\"\nimport * as Gdk from \"@gtkx/gi/gdk\"\nimport * as Gio from \"@gtkx/gi/gio\"\nimport * as GLib from \"@gtkx/gi/glib\"\nimport * as Graphene from \"@gtkx/gi/graphene\"\nimport * as Gsk from \"@gtkx/gi/gsk\"\nimport * as Gtk from \"@gtkx/gi/gtk\"\nimport * as Pango from \"@gtkx/gi/pango\"\n\nexport { Adw, Gdk, Gio, GLib, Graphene, Gsk, Gtk, Pango }\n\nexport {\n AdwApplicationWindow,\n AdwHeaderBar,\n AdwNavigationPage,\n AdwNavigationSplitView,\n AdwNavigationView,\n AdwToolbarView,\n} from \"@gtkx/jsx/adw\"\n\nexport {\n GtkApplication,\n GtkApplicationWindow,\n GtkBox,\n GtkButton,\n GtkEntry,\n GtkGestureClick,\n GtkLabel,\n GtkListBox,\n GtkListBoxRow,\n GtkPicture,\n GtkScrolledWindow,\n GtkSpinner,\n GtkSwitch,\n GtkTextView,\n GtkWindow,\n} from \"@gtkx/jsx/gtk\"\n\nexport {\n createPortal,\n createRoot,\n quit,\n useApplication,\n useParentWindow,\n useProperty,\n type Root,\n} from \"@gtkx/react\"\n\n// useSignal comes from ./use-signal, not @gtkx/react — see the workaround note\n// there (rc.2 delivers a stale handler).\nexport { useSignal } from \"./use-signal\"\n\nexport { css, cx, injectGlobal } from \"@gtkx/css\"\n\nexport { createTextProbe, measureWidget, toNumber } from \"./measure\"\nexport { getViewBoxComponent, setBoxPassthrough } from \"./view-box\"\nexport {\n allocateChild,\n attachRnLayout,\n detachRnLayout,\n queueAllocate,\n queueResize,\n type RnLayoutHooks,\n type RnLayoutOrientation,\n} from \"./layout-manager\"\nexport { colorScheme, styleManager } from \"./theme\"\n"]}
@@ -1,4 +1,5 @@
1
1
  import * as Gtk from "@gtkx/gi/gtk";
2
+ import { perfAddTime, perfEnabled, perfNow } from "../../perf";
2
3
  // 64-bit FFI values cross the boundary as BigInt — normalize before doing math.
3
4
  export const toNumber = (value) => typeof value === "bigint" ? Number(value) : value;
4
5
  // Gtk.Widget.measure() works synchronously on unmapped widgets (request phase),
@@ -8,7 +9,11 @@ export const measureWidget = (widget, orientation, forSize = -1) => {
8
9
  ? Gtk.Orientation.HORIZONTAL
9
10
  : Gtk.Orientation.VERTICAL;
10
11
  const constraint = forSize > 0 ? Math.floor(forSize) : -1;
12
+ const start = perfEnabled ? perfNow() : 0;
11
13
  const [minimum, natural] = widget.measure(gtkOrientation, constraint);
14
+ if (perfEnabled) {
15
+ perfAddTime("gtk.measure", perfNow() - start);
16
+ }
12
17
  return { minimum: toNumber(minimum), natural: toNumber(natural) };
13
18
  };
14
19
  // Offscreen label used as a Pango-backed text measurer for Yoga text nodes.
@@ -1 +1 @@
1
- {"version":3,"file":"measure.js","sourceRoot":"","sources":["../../../src/gtkx/bridge/measure.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,cAAc,CAAA;AASnC,gFAAgF;AAChF,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,KAAsB,EAAU,EAAE,CACzD,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAA;AAEnD,gFAAgF;AAChF,gFAAgF;AAChF,MAAM,CAAC,MAAM,aAAa,GAAG,CAC3B,MAAkB,EAClB,WAA+B,EAC/B,OAAO,GAAG,CAAC,CAAC,EACG,EAAE;IACjB,MAAM,cAAc,GAClB,WAAW,KAAK,YAAY;QAC1B,CAAC,CAAC,GAAG,CAAC,WAAW,CAAC,UAAU;QAC5B,CAAC,CAAC,GAAG,CAAC,WAAW,CAAC,QAAQ,CAAA;IAC9B,MAAM,UAAU,GAAG,OAAO,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;IACzD,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,OAAO,CAAC,cAAc,EAAE,UAAU,CAAC,CAAA;IACrE,OAAO,EAAE,OAAO,EAAE,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAA;AACnE,CAAC,CAAA;AAED,4EAA4E;AAC5E,MAAM,CAAC,MAAM,eAAe,GAAG,GAAc,EAAE;IAC7C,MAAM,KAAK,GAAG,IAAI,GAAG,CAAC,KAAK,EAAE,CAAA;IAC7B,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;IACnB,OAAO,KAAK,CAAA;AACd,CAAC,CAAA","sourcesContent":["import * as Gtk from \"@gtkx/gi/gtk\"\n\nexport type MeasureOrientation = \"horizontal\" | \"vertical\"\n\nexport type MeasureResult = {\n minimum: number\n natural: number\n}\n\n// 64-bit FFI values cross the boundary as BigInt — normalize before doing math.\nexport const toNumber = (value: number | bigint): number =>\n typeof value === \"bigint\" ? Number(value) : value\n\n// Gtk.Widget.measure() works synchronously on unmapped widgets (request phase),\n// returns [min, nat, minBaseline, natBaseline]. This is the Yoga measure input.\nexport const measureWidget = (\n widget: Gtk.Widget,\n orientation: MeasureOrientation,\n forSize = -1,\n): MeasureResult => {\n const gtkOrientation =\n orientation === \"horizontal\"\n ? Gtk.Orientation.HORIZONTAL\n : Gtk.Orientation.VERTICAL\n const constraint = forSize > 0 ? Math.floor(forSize) : -1\n const [minimum, natural] = widget.measure(gtkOrientation, constraint)\n return { minimum: toNumber(minimum), natural: toNumber(natural) }\n}\n\n// Offscreen label used as a Pango-backed text measurer for Yoga text nodes.\nexport const createTextProbe = (): Gtk.Label => {\n const probe = new Gtk.Label()\n probe.setWrap(true)\n return probe\n}\n"]}
1
+ {"version":3,"file":"measure.js","sourceRoot":"","sources":["../../../src/gtkx/bridge/measure.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,cAAc,CAAA;AACnC,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AAS9D,gFAAgF;AAChF,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,KAAsB,EAAU,EAAE,CACzD,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAA;AAEnD,gFAAgF;AAChF,gFAAgF;AAChF,MAAM,CAAC,MAAM,aAAa,GAAG,CAC3B,MAAkB,EAClB,WAA+B,EAC/B,OAAO,GAAG,CAAC,CAAC,EACG,EAAE;IACjB,MAAM,cAAc,GAClB,WAAW,KAAK,YAAY;QAC1B,CAAC,CAAC,GAAG,CAAC,WAAW,CAAC,UAAU;QAC5B,CAAC,CAAC,GAAG,CAAC,WAAW,CAAC,QAAQ,CAAA;IAC9B,MAAM,UAAU,GAAG,OAAO,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;IACzD,MAAM,KAAK,GAAG,WAAW,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,CAAA;IACzC,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,OAAO,CAAC,cAAc,EAAE,UAAU,CAAC,CAAA;IACrE,IAAI,WAAW,EAAE,CAAC;QAChB,WAAW,CAAC,aAAa,EAAE,OAAO,EAAE,GAAG,KAAK,CAAC,CAAA;IAC/C,CAAC;IACD,OAAO,EAAE,OAAO,EAAE,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAA;AACnE,CAAC,CAAA;AAED,4EAA4E;AAC5E,MAAM,CAAC,MAAM,eAAe,GAAG,GAAc,EAAE;IAC7C,MAAM,KAAK,GAAG,IAAI,GAAG,CAAC,KAAK,EAAE,CAAA;IAC7B,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;IACnB,OAAO,KAAK,CAAA;AACd,CAAC,CAAA","sourcesContent":["import * as Gtk from \"@gtkx/gi/gtk\"\nimport { perfAddTime, perfEnabled, perfNow } from \"../../perf\"\n\nexport type MeasureOrientation = \"horizontal\" | \"vertical\"\n\nexport type MeasureResult = {\n minimum: number\n natural: number\n}\n\n// 64-bit FFI values cross the boundary as BigInt — normalize before doing math.\nexport const toNumber = (value: number | bigint): number =>\n typeof value === \"bigint\" ? Number(value) : value\n\n// Gtk.Widget.measure() works synchronously on unmapped widgets (request phase),\n// returns [min, nat, minBaseline, natBaseline]. This is the Yoga measure input.\nexport const measureWidget = (\n widget: Gtk.Widget,\n orientation: MeasureOrientation,\n forSize = -1,\n): MeasureResult => {\n const gtkOrientation =\n orientation === \"horizontal\"\n ? Gtk.Orientation.HORIZONTAL\n : Gtk.Orientation.VERTICAL\n const constraint = forSize > 0 ? Math.floor(forSize) : -1\n const start = perfEnabled ? perfNow() : 0\n const [minimum, natural] = widget.measure(gtkOrientation, constraint)\n if (perfEnabled) {\n perfAddTime(\"gtk.measure\", perfNow() - start)\n }\n return { minimum: toNumber(minimum), natural: toNumber(natural) }\n}\n\n// Offscreen label used as a Pango-backed text measurer for Yoga text nodes.\nexport const createTextProbe = (): Gtk.Label => {\n const probe = new Gtk.Label()\n probe.setWrap(true)\n return probe\n}\n"]}
@@ -1,5 +1,5 @@
1
1
  import * as Adw from "@gtkx/gi/adw";
2
2
  export const styleManager = () => Adw.StyleManager.getDefault();
3
- // Appearance API (task 007) subscribes to notify::dark on the style manager.
3
+ // The Appearance API subscribes to notify::dark on the style manager.
4
4
  export const colorScheme = () => styleManager().getDark() ? "dark" : "light";
5
5
  //# sourceMappingURL=theme.js.map