@septkit/ui 0.0.88 → 0.0.89

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 (34) hide show
  1. package/dist/dialecte/composables/change-id-window.js +14 -0
  2. package/dist/dialecte/composables/use-live-data.js +154 -31
  3. package/dist/dialecte/create-document-store.js +16 -7
  4. package/dist/external/.pnpm/@dialecte_core@0.12.1/node_modules/@dialecte/core/dist/dialecte-DHj8__Ch.js +7293 -0
  5. package/dist/external/.pnpm/@dialecte_core@0.12.1/node_modules/@dialecte/core/dist/helpers-Bfv2XDC-.js +351 -0
  6. package/dist/external/.pnpm/@dialecte_core@0.12.1/node_modules/@dialecte/core/dist/index.js +6 -0
  7. package/dist/external/.pnpm/{@dialecte_core@0.11.0/node_modules/@dialecte/core/dist/open-connections-D59wm6nb.js → @dialecte_core@0.12.1/node_modules/@dialecte/core/dist/open-connections-ClJo0-Af.js} +2 -2
  8. package/dist/external/.pnpm/@dialecte_core@0.12.1/node_modules/@dialecte/core/dist/project-key-DD8DyQ8-.js +1751 -0
  9. package/dist/external/.pnpm/@dialecte_core@0.12.1/node_modules/@dialecte/core/dist/qname-definition-C6GUFWL8.js +56 -0
  10. package/dist/external/.pnpm/{@dialecte_core@0.11.0 → @dialecte_core@0.12.1}/node_modules/@dialecte/core/dist/rolldown-runtime-CYdcPHCu.js +1 -1
  11. package/dist/external/.pnpm/{@dialecte_core@0.11.0/node_modules/@dialecte/core/dist/same-json-value-boJ4pSRe.js → @dialecte_core@0.12.1/node_modules/@dialecte/core/dist/same-json-value-DTtSsGUF.js} +491 -370
  12. package/dist/external/.pnpm/@dialecte_core@0.12.1/node_modules/@dialecte/core/dist/utils-Q5zsKl3Y.js +2449 -0
  13. package/dist/external/.pnpm/@dialecte_core@0.12.1/node_modules/@dialecte/core/dist/utils.js +2 -0
  14. package/dist/external/.pnpm/@tanstack_virtual-core@3.17.3/node_modules/@tanstack/virtual-core/dist/esm/index.js +627 -0
  15. package/dist/external/.pnpm/@tanstack_virtual-core@3.17.3/node_modules/@tanstack/virtual-core/dist/esm/lazy-measurements.js +31 -0
  16. package/dist/external/.pnpm/@tanstack_virtual-core@3.17.3/node_modules/@tanstack/virtual-core/dist/esm/utils.js +38 -0
  17. package/dist/external/.pnpm/@tanstack_vue-virtual@3.13.31_vue@3.5.39_typescript@5.8.3_/node_modules/@tanstack/vue-virtual/dist/esm/index.js +28 -0
  18. package/dist/external/.pnpm/@vueuse_core@14.3.0_vue@3.5.39_typescript@5.8.3_/node_modules/@vueuse/core/dist/index.js +24 -2
  19. package/dist/index.d.ts +266 -7
  20. package/dist/index.js +7 -1
  21. package/dist/ui.css +1 -1
  22. package/dist/virtual/grid-aria.js +16 -0
  23. package/dist/virtual/grid-navigation.js +84 -0
  24. package/dist/virtual/index.js +6 -0
  25. package/dist/virtual/kept-range.js +32 -0
  26. package/dist/virtual/use-virtual-scroller.js +180 -0
  27. package/dist/virtual/virtual.constants.js +7 -0
  28. package/package.json +6 -4
  29. package/dist/external/.pnpm/@dialecte_core@0.11.0/node_modules/@dialecte/core/dist/dialecte-Cs_XRP4I.js +0 -4426
  30. package/dist/external/.pnpm/@dialecte_core@0.11.0/node_modules/@dialecte/core/dist/helpers-D8p0KiJu.js +0 -130
  31. package/dist/external/.pnpm/@dialecte_core@0.11.0/node_modules/@dialecte/core/dist/index.js +0 -6
  32. package/dist/external/.pnpm/@dialecte_core@0.11.0/node_modules/@dialecte/core/dist/project-key-sr4wkl2Q.js +0 -1371
  33. package/dist/external/.pnpm/@dialecte_core@0.11.0/node_modules/@dialecte/core/dist/utils-Cv4oHia0.js +0 -865
  34. package/dist/external/.pnpm/@dialecte_core@0.11.0/node_modules/@dialecte/core/dist/utils.js +0 -2
@@ -0,0 +1,2 @@
1
+ import { f as e } from "./utils-Q5zsKl3Y.js";
2
+ export { e as invariant };
@@ -0,0 +1,627 @@
1
+ import { createLazyMeasurementsView as e } from "./lazy-measurements.js";
2
+ import { approxEqual as t, debounce as n, memo as r, notUndefined as i } from "./utils.js";
3
+ //#region node_modules/.pnpm/@tanstack+virtual-core@3.17.3/node_modules/@tanstack/virtual-core/dist/esm/index.js
4
+ var a, o = () => {
5
+ if (a !== void 0) return a;
6
+ if (typeof navigator > "u") return a = !1;
7
+ if (/iP(hone|od|ad)/.test(navigator.userAgent)) return a = !0;
8
+ let e = navigator.maxTouchPoints;
9
+ return a = navigator.platform === "MacIntel" && e !== void 0 && e > 0;
10
+ }, s = (e) => {
11
+ let { offsetWidth: t, offsetHeight: n } = e;
12
+ return {
13
+ width: t,
14
+ height: n
15
+ };
16
+ }, c = (e) => e, l = (e) => {
17
+ let t = Math.max(e.startIndex - e.overscan, 0), n = Math.min(e.endIndex + e.overscan, e.count - 1) - t + 1, r = Array(n);
18
+ for (let e = 0; e < n; e++) r[e] = t + e;
19
+ return r;
20
+ }, u = (e, t) => {
21
+ let n = e.scrollElement;
22
+ if (!n) return;
23
+ let r = e.targetWindow;
24
+ if (!r) return;
25
+ let i = (e) => {
26
+ let { width: n, height: r } = e;
27
+ t({
28
+ width: Math.round(n),
29
+ height: Math.round(r)
30
+ });
31
+ };
32
+ if (i(s(n)), !r.ResizeObserver) return () => {};
33
+ let a = new r.ResizeObserver((t) => {
34
+ let r = () => {
35
+ let e = t[0];
36
+ if (e?.borderBoxSize) {
37
+ let t = e.borderBoxSize[0];
38
+ if (t) {
39
+ i({
40
+ width: t.inlineSize,
41
+ height: t.blockSize
42
+ });
43
+ return;
44
+ }
45
+ }
46
+ i(s(n));
47
+ };
48
+ e.options.useAnimationFrameWithResizeObserver ? requestAnimationFrame(r) : r();
49
+ });
50
+ return a.observe(n, { box: "border-box" }), () => {
51
+ a.unobserve(n);
52
+ };
53
+ }, d = { passive: !0 }, f = typeof window > "u" ? !0 : "onscrollend" in window, p = (e, t, r) => {
54
+ let i = e.scrollElement;
55
+ if (!i) return;
56
+ let a = e.targetWindow;
57
+ if (!a) return;
58
+ let o = e.options.useScrollendEvent && f, s = 0, c = o ? null : n(a, () => t(s, !1), e.options.isScrollingResetDelay), l = (e) => () => {
59
+ s = r(i), c?.(), t(s, e);
60
+ }, u = l(!0), p = l(!1);
61
+ return i.addEventListener("scroll", u, d), o && i.addEventListener("scrollend", p, d), () => {
62
+ i.removeEventListener("scroll", u), o && i.removeEventListener("scrollend", p);
63
+ };
64
+ }, m = (e, t) => p(e, t, (t) => {
65
+ let { horizontal: n, isRtl: r } = e.options;
66
+ return n ? t.scrollLeft * (r && -1 || 1) : t.scrollTop;
67
+ }), h = (e, t, n) => {
68
+ if (n.options.useCachedMeasurements) {
69
+ let t = n.indexFromElement(e), r = n.options.getItemKey(t);
70
+ return n.itemSizeCache.get(r) ?? n.options.estimateSize(t);
71
+ }
72
+ if (t?.borderBoxSize) {
73
+ let e = t.borderBoxSize[0];
74
+ if (e) return Math.round(e[n.options.horizontal ? "inlineSize" : "blockSize"]);
75
+ }
76
+ if (!t) {
77
+ let t = n.indexFromElement(e), r = n.options.getItemKey(t), i = n.itemSizeCache.get(r);
78
+ if (i !== void 0) return i;
79
+ }
80
+ return e[n.options.horizontal ? "offsetWidth" : "offsetHeight"];
81
+ }, g = (e, { adjustments: t = 0, behavior: n }, r) => {
82
+ var i, a;
83
+ (a = (i = r.scrollElement)?.scrollTo) == null || a.call(i, {
84
+ [r.options.horizontal ? "left" : "top"]: e + t,
85
+ behavior: n
86
+ });
87
+ }, _ = class {
88
+ constructor(t) {
89
+ this.unsubs = [], this.scrollElement = null, this.targetWindow = null, this.isScrolling = !1, this.scrollState = null, this.measurementsCache = [], this._flatMeasurements = null, this.itemSizeCache = /* @__PURE__ */ new Map(), this.itemSizeCacheVersion = 0, this.laneAssignments = /* @__PURE__ */ new Map(), this.pendingMin = null, this.prevLanes = void 0, this.lanesChangedFlag = !1, this.lanesSettling = !1, this.pendingScrollAnchor = null, this.scrollRect = null, this.scrollOffset = null, this.scrollDirection = null, this.scrollAdjustments = 0, this._iosDeferredAdjustment = 0, this._iosTouching = !1, this._iosJustTouchEnded = !1, this._iosTouchEndTimerId = null, this._intendedScrollOffset = null, this.elementsCache = /* @__PURE__ */ new Map(), this.now = () => {
90
+ var e;
91
+ return ((e = this.targetWindow?.performance)?.now)?.call(e) ?? Date.now();
92
+ }, this.observer = /* @__PURE__ */ (() => {
93
+ let e = null, t = () => e || (!this.targetWindow || !this.targetWindow.ResizeObserver ? null : e = new this.targetWindow.ResizeObserver((e) => {
94
+ e.forEach((e) => {
95
+ let t = () => {
96
+ let t = e.target, n = this.indexFromElement(t);
97
+ if (!t.isConnected) {
98
+ this.observer.unobserve(t);
99
+ for (let [e, n] of this.elementsCache) if (n === t) {
100
+ this.elementsCache.delete(e);
101
+ break;
102
+ }
103
+ return;
104
+ }
105
+ this.shouldMeasureDuringScroll(n) && this.resizeItem(n, this.options.measureElement(t, e, this));
106
+ };
107
+ this.options.useAnimationFrameWithResizeObserver ? requestAnimationFrame(t) : t();
108
+ });
109
+ }));
110
+ return {
111
+ disconnect: () => {
112
+ var n;
113
+ (n = t()) == null || n.disconnect(), e = null;
114
+ },
115
+ observe: (e) => t()?.observe(e, { box: "border-box" }),
116
+ unobserve: (e) => t()?.unobserve(e)
117
+ };
118
+ })(), this.range = null, this.setOptions = (e) => {
119
+ let t = {
120
+ debug: !1,
121
+ initialOffset: 0,
122
+ overscan: 1,
123
+ paddingStart: 0,
124
+ paddingEnd: 0,
125
+ scrollPaddingStart: 0,
126
+ scrollPaddingEnd: 0,
127
+ horizontal: !1,
128
+ getItemKey: c,
129
+ rangeExtractor: l,
130
+ onChange: () => {},
131
+ measureElement: h,
132
+ initialRect: {
133
+ width: 0,
134
+ height: 0
135
+ },
136
+ scrollMargin: 0,
137
+ gap: 0,
138
+ indexAttribute: "data-index",
139
+ initialMeasurementsCache: [],
140
+ lanes: 1,
141
+ anchorTo: "start",
142
+ followOnAppend: !1,
143
+ scrollEndThreshold: 1,
144
+ isScrollingResetDelay: 150,
145
+ enabled: !0,
146
+ isRtl: !1,
147
+ useScrollendEvent: !1,
148
+ useAnimationFrameWithResizeObserver: !1,
149
+ laneAssignmentMode: "estimate",
150
+ useCachedMeasurements: !1
151
+ };
152
+ for (let n in e) {
153
+ let r = e[n];
154
+ r !== void 0 && (t[n] = r);
155
+ }
156
+ let n = this.options, r = null, i = null, a = !1;
157
+ if (n !== void 0 && n.enabled && t.enabled && t.anchorTo === "end" && this.scrollElement !== null) {
158
+ let e = n.count, o = t.count, s = this.getMeasurements(), c = e > 0 ? s[0]?.key ?? n.getItemKey(0) : null, l = e > 0 ? s[e - 1]?.key ?? n.getItemKey(e - 1) : null;
159
+ if (o !== e || e > 0 && o > 0 && (t.getItemKey(0) !== c || t.getItemKey(o - 1) !== l)) {
160
+ a = !0;
161
+ let c = e > 0 ? this.getVirtualItemForOffset(this.getScrollOffset()) ?? s[0] : null;
162
+ c && (r = [c.key, this.getScrollOffset() - c.start]);
163
+ let u = t.followOnAppend === !0 ? "auto" : t.followOnAppend || null;
164
+ u && o > e && this.isAtEnd(n.scrollEndThreshold) && (e === 0 || t.getItemKey(o - 1) !== l) && (i = u);
165
+ }
166
+ }
167
+ this.options = t, a && (this.pendingMin = 0, this.itemSizeCacheVersion++);
168
+ let o = !1, s = 0;
169
+ if (r && this.scrollOffset !== null) {
170
+ let [e, t] = r, n = this.getMeasurements(), { count: i, getItemKey: a } = this.options, c = 0;
171
+ for (; c < i && a(c) !== e;) c++;
172
+ if (c < i) {
173
+ let e = n[c];
174
+ if (e) {
175
+ let n = e.start + t;
176
+ n !== this.scrollOffset && (s = n - this.scrollOffset, this.scrollOffset = n, o = !0);
177
+ }
178
+ }
179
+ }
180
+ (o || i) && (this.pendingScrollAnchor = [
181
+ o ? r[0] : null,
182
+ o ? r[1] : 0,
183
+ i,
184
+ s
185
+ ]);
186
+ }, this.notify = (e) => {
187
+ var t, n;
188
+ (n = (t = this.options).onChange) == null || n.call(t, this, e);
189
+ }, this.maybeNotify = r(() => (this.calculateRange(), [
190
+ this.isScrolling,
191
+ this.range ? this.range.startIndex : null,
192
+ this.range ? this.range.endIndex : null
193
+ ]), (e) => {
194
+ this.notify(e);
195
+ }, {
196
+ key: process.env.NODE_ENV !== "production" && "maybeNotify",
197
+ debug: () => this.options.debug,
198
+ initialDeps: [
199
+ this.isScrolling,
200
+ this.range ? this.range.startIndex : null,
201
+ this.range ? this.range.endIndex : null
202
+ ]
203
+ }), this.cleanup = () => {
204
+ this.unsubs.filter(Boolean).forEach((e) => e()), this.unsubs = [], this.observer.disconnect(), this.rafId != null && this.targetWindow && (this.targetWindow.cancelAnimationFrame(this.rafId), this.rafId = null), this.scrollState = null, this.scrollElement = null, this.targetWindow = null;
205
+ }, this._didMount = () => () => {
206
+ this.cleanup();
207
+ }, this._willUpdate = () => {
208
+ let e = this.options.enabled ? this.options.getScrollElement() : null;
209
+ if (this.scrollElement !== e) {
210
+ if (this.cleanup(), !e) {
211
+ this.maybeNotify();
212
+ return;
213
+ }
214
+ if (this.scrollElement = e, this.scrollElement && "ownerDocument" in this.scrollElement ? this.targetWindow = this.scrollElement.ownerDocument.defaultView : this.targetWindow = this.scrollElement?.window ?? null, this.elementsCache.forEach((e) => {
215
+ this.observer.observe(e);
216
+ }), this.unsubs.push(this.options.observeElementRect(this, (e) => {
217
+ this.scrollRect = e, this.maybeNotify();
218
+ })), this.unsubs.push(this.options.observeElementOffset(this, (e, t) => {
219
+ if (t && this._intendedScrollOffset === null && e === this.scrollOffset) return;
220
+ this._intendedScrollOffset !== null && Math.abs(e - this._intendedScrollOffset) < 1.5 && (e = this._intendedScrollOffset), this._intendedScrollOffset = null, this.scrollAdjustments = 0;
221
+ let n = this.getScrollOffset();
222
+ this.scrollDirection = t ? n === e ? this.scrollDirection : n < e ? "forward" : "backward" : null, this.scrollOffset = e, this.isScrolling = t, this._flushIosDeferredIfReady(), this.scrollState && this.scheduleScrollReconcile(), this.maybeNotify();
223
+ })), "addEventListener" in this.scrollElement) {
224
+ let e = this.scrollElement, t = () => {
225
+ this._iosTouching = !0, this._iosJustTouchEnded = !1, this._iosTouchEndTimerId !== null && this.targetWindow != null && (this.targetWindow.clearTimeout(this._iosTouchEndTimerId), this._iosTouchEndTimerId = null);
226
+ }, n = () => {
227
+ this._iosTouching = !1, !(!o() || this.targetWindow == null) && (this._iosJustTouchEnded = !0, this._iosTouchEndTimerId = this.targetWindow.setTimeout(() => {
228
+ this._iosJustTouchEnded = !1, this._iosTouchEndTimerId = null, this._flushIosDeferredIfReady();
229
+ }, 150));
230
+ };
231
+ e.addEventListener("touchstart", t, d), e.addEventListener("touchend", n, d), this.unsubs.push(() => {
232
+ e.removeEventListener("touchstart", t), e.removeEventListener("touchend", n), this._iosTouchEndTimerId !== null && this.targetWindow != null && (this.targetWindow.clearTimeout(this._iosTouchEndTimerId), this._iosTouchEndTimerId = null);
233
+ });
234
+ }
235
+ this._scrollToOffset(this.getScrollOffset(), {
236
+ adjustments: void 0,
237
+ behavior: void 0
238
+ });
239
+ }
240
+ let t = this.pendingScrollAnchor;
241
+ if (this.pendingScrollAnchor = null, t && this.scrollElement && this.options.enabled) {
242
+ let [e, n, r, i] = t;
243
+ e !== null && !r && (o() && (this.isScrolling || this._iosTouching || this._iosJustTouchEnded) ? i !== 0 && (this._iosDeferredAdjustment += i) : this._scrollToOffset(this.getScrollOffset(), {
244
+ adjustments: void 0,
245
+ behavior: void 0
246
+ })), r && this.scrollToEnd({ behavior: r });
247
+ }
248
+ }, this._flushIosDeferredIfReady = () => {
249
+ if (this._iosDeferredAdjustment === 0 || this.isScrolling || this._iosTouching || this._iosJustTouchEnded) return;
250
+ let e = this.getScrollOffset(), t = this.getMaxScrollOffset();
251
+ if (e < 0 || e > t) return;
252
+ let n = this._iosDeferredAdjustment;
253
+ this._iosDeferredAdjustment = 0, this._scrollToOffset(e, {
254
+ adjustments: this.scrollAdjustments += n,
255
+ behavior: void 0
256
+ });
257
+ }, this.rafId = null, this.getSize = () => this.options.enabled ? (this.scrollRect = this.scrollRect ?? this.options.initialRect, this.scrollRect[this.options.horizontal ? "width" : "height"]) : (this.scrollRect = null, 0), this.getScrollOffset = () => this.options.enabled ? (this.scrollOffset = this.scrollOffset ?? (typeof this.options.initialOffset == "function" ? this.options.initialOffset() : this.options.initialOffset), this.scrollOffset) : (this.scrollOffset = null, 0), this.getFurthestMeasurement = (e, t) => {
258
+ let n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map();
259
+ for (let i = t - 1; i >= 0; i--) {
260
+ let t = e[i];
261
+ if (n.has(t.lane)) continue;
262
+ let a = r.get(t.lane);
263
+ if (a == null || t.end > a.end ? r.set(t.lane, t) : t.end < a.end && n.set(t.lane, !0), n.size === this.options.lanes) break;
264
+ }
265
+ return r.size === this.options.lanes ? Array.from(r.values()).sort((e, t) => e.end === t.end ? e.index - t.index : e.end - t.end)[0] : void 0;
266
+ }, this.getMeasurementOptions = r(() => [
267
+ this.options.count,
268
+ this.options.paddingStart,
269
+ this.options.scrollMargin,
270
+ this.options.getItemKey,
271
+ this.options.enabled,
272
+ this.options.lanes,
273
+ this.options.laneAssignmentMode
274
+ ], (e, t, n, r, i, a, o) => (this.prevLanes !== void 0 && this.prevLanes !== a && (this.lanesChangedFlag = !0), this.prevLanes = a, this.pendingMin = null, {
275
+ count: e,
276
+ paddingStart: t,
277
+ scrollMargin: n,
278
+ getItemKey: r,
279
+ enabled: i,
280
+ lanes: a,
281
+ laneAssignmentMode: o
282
+ }), { key: !1 }), this.getMeasurements = r(() => [this.getMeasurementOptions(), this.itemSizeCacheVersion], ({ count: t, paddingStart: n, scrollMargin: r, getItemKey: i, enabled: a, lanes: o, laneAssignmentMode: s }, c) => {
283
+ let l = this.itemSizeCache;
284
+ if (!a) return this.measurementsCache = [], this.itemSizeCache.clear(), this.laneAssignments.clear(), [];
285
+ if (this.laneAssignments.size > t) for (let e of this.laneAssignments.keys()) e >= t && this.laneAssignments.delete(e);
286
+ this.lanesChangedFlag && (this.lanesChangedFlag = !1, this.lanesSettling = !0, this.measurementsCache = [], this.itemSizeCache.clear(), this.laneAssignments.clear(), this.pendingMin = null), this.measurementsCache.length === 0 && !this.lanesSettling && (this.measurementsCache = this.options.initialMeasurementsCache, this.measurementsCache.forEach((e) => {
287
+ this.itemSizeCache.set(e.key, e.size);
288
+ }));
289
+ let u = this.lanesSettling ? 0 : this.pendingMin ?? 0;
290
+ if (this.pendingMin = null, this.lanesSettling && this.measurementsCache.length === t && (this.lanesSettling = !1), o === 1) {
291
+ let a = this.options.gap, o = t * 2, s = this._flatMeasurements;
292
+ if (!s || s.length < o) {
293
+ let e = new Float64Array(o);
294
+ s && u > 0 && e.set(s.subarray(0, u * 2)), s = e, this._flatMeasurements = s;
295
+ }
296
+ let c;
297
+ if (u === 0) c = n + r;
298
+ else {
299
+ let e = u - 1;
300
+ c = s[e * 2] + s[e * 2 + 1] + a;
301
+ }
302
+ for (let e = u; e < t; e++) {
303
+ let t = i(e), n = l.get(t), r = typeof n == "number" ? n : this.options.estimateSize(e);
304
+ s[e * 2] = c, s[e * 2 + 1] = r, c += r + a;
305
+ }
306
+ let d = e(t, s, i);
307
+ return this.measurementsCache = d, d;
308
+ }
309
+ let d = this.measurementsCache.slice(0, u), f = Array(o).fill(void 0);
310
+ for (let e = 0; e < u; e++) {
311
+ let t = d[e];
312
+ t && (f[t.lane] = e);
313
+ }
314
+ for (let e = u; e < t; e++) {
315
+ let t = i(e), a = this.laneAssignments.get(e), o, c, u = s === "estimate" || l.has(t);
316
+ if (a !== void 0 && this.options.lanes > 1) {
317
+ o = a;
318
+ let e = f[o], t = e === void 0 ? void 0 : d[e];
319
+ c = t ? t.end + this.options.gap : n + r;
320
+ } else {
321
+ let t = this.options.lanes === 1 ? d[e - 1] : this.getFurthestMeasurement(d, e);
322
+ c = t ? t.end + this.options.gap : n + r, o = t ? t.lane : e % this.options.lanes, this.options.lanes > 1 && u && this.laneAssignments.set(e, o);
323
+ }
324
+ let p = l.get(t), m = typeof p == "number" ? p : this.options.estimateSize(e), h = c + m;
325
+ d[e] = {
326
+ index: e,
327
+ start: c,
328
+ size: m,
329
+ end: h,
330
+ key: t,
331
+ lane: o
332
+ }, f[o] = e;
333
+ }
334
+ return this.measurementsCache = d, d;
335
+ }, {
336
+ key: process.env.NODE_ENV !== "production" && "getMeasurements",
337
+ debug: () => this.options.debug
338
+ }), this.calculateRange = r(() => [
339
+ this.getMeasurements(),
340
+ this.getSize(),
341
+ this.getScrollOffset(),
342
+ this.options.lanes
343
+ ], (e, t, n, r) => e.length === 0 || t === 0 ? (this.range = null, null) : (this.range = b(e, t, n, r, r === 1 && this._flatMeasurements != null ? this._flatMeasurements : null), this.range), {
344
+ key: process.env.NODE_ENV !== "production" && "calculateRange",
345
+ debug: () => this.options.debug
346
+ }), this.getVirtualIndexes = r(() => {
347
+ let e = null, t = null, n = this.calculateRange();
348
+ return n && (e = n.startIndex, t = n.endIndex), this.maybeNotify.updateDeps([
349
+ this.isScrolling,
350
+ e,
351
+ t
352
+ ]), [
353
+ this.options.rangeExtractor,
354
+ this.options.overscan,
355
+ this.options.count,
356
+ e,
357
+ t
358
+ ];
359
+ }, (e, t, n, r, i) => r === null || i === null ? [] : e({
360
+ startIndex: r,
361
+ endIndex: i,
362
+ overscan: t,
363
+ count: n
364
+ }), {
365
+ key: process.env.NODE_ENV !== "production" && "getVirtualIndexes",
366
+ debug: () => this.options.debug
367
+ }), this.indexFromElement = (e) => {
368
+ let t = this.options.indexAttribute, n = e.getAttribute(t);
369
+ return n ? parseInt(n, 10) : (console.warn(`Missing attribute name '${t}={index}' on measured element.`), -1);
370
+ }, this.shouldMeasureDuringScroll = (e) => {
371
+ if (!this.scrollState || this.scrollState.behavior !== "smooth") return !0;
372
+ let t = this.scrollState.index ?? this.getVirtualItemForOffset(this.scrollState.lastTargetOffset)?.index;
373
+ if (t !== void 0 && this.range) {
374
+ let n = Math.max(this.options.overscan, Math.ceil((this.range.endIndex - this.range.startIndex) / 2)), r = Math.max(0, t - n), i = Math.min(this.options.count - 1, t + n);
375
+ return e >= r && e <= i;
376
+ }
377
+ return !0;
378
+ }, this.measureElement = (e) => {
379
+ if (!e) {
380
+ this.elementsCache.forEach((e, t) => {
381
+ e.isConnected || (this.observer.unobserve(e), this.elementsCache.delete(t));
382
+ });
383
+ return;
384
+ }
385
+ let t = this.indexFromElement(e), n = this.options.getItemKey(t), r = this.elementsCache.get(n);
386
+ r !== e && (r && this.observer.unobserve(r), this.observer.observe(e), this.elementsCache.set(n, e)), (!this.isScrolling || this.scrollState) && this.shouldMeasureDuringScroll(t) && this.resizeItem(t, this.options.measureElement(e, void 0, this));
387
+ }, this.resizeItem = (e, t) => {
388
+ if (e < 0 || e >= this.options.count) return;
389
+ let n, r, i, a = this._flatMeasurements;
390
+ if (this.options.lanes === 1 && a !== null) i = this.options.getItemKey(e), r = a[e * 2], n = a[e * 2 + 1];
391
+ else {
392
+ let t = this.measurementsCache[e];
393
+ if (!t) return;
394
+ i = t.key, r = t.start, n = t.size;
395
+ }
396
+ let o = t - (this.itemSizeCache.get(i) ?? n);
397
+ if (o !== 0) {
398
+ let a = this.options.anchorTo === "end" && this.scrollState?.behavior !== "smooth" && this.getVirtualDistanceFromEnd() <= this.options.scrollEndThreshold, s = a ? this.getTotalSize() : 0, c = this.scrollState?.behavior !== "smooth" && (this.shouldAdjustScrollPositionOnItemSizeChange === void 0 ? r < this.getScrollOffset() + this.scrollAdjustments && (!this.itemSizeCache.has(i) || this.scrollDirection !== "backward") : this.shouldAdjustScrollPositionOnItemSizeChange(this.measurementsCache[e] ?? {
399
+ index: e,
400
+ key: i,
401
+ start: r,
402
+ size: n,
403
+ end: r + n,
404
+ lane: 0
405
+ }, o, this));
406
+ (this.pendingMin === null || e < this.pendingMin) && (this.pendingMin = e), this.itemSizeCache.set(i, t), this.itemSizeCacheVersion++, a ? this.applyScrollAdjustment(this.getTotalSize() - s) : c && this.applyScrollAdjustment(o), this.notify(!1);
407
+ }
408
+ }, this.getVirtualItems = r(() => [this.getVirtualIndexes(), this.getMeasurements()], (e, t) => {
409
+ let n = [];
410
+ for (let r = 0, i = e.length; r < i; r++) {
411
+ let i = t[e[r]];
412
+ n.push(i);
413
+ }
414
+ return n;
415
+ }, {
416
+ key: process.env.NODE_ENV !== "production" && "getVirtualItems",
417
+ debug: () => this.options.debug
418
+ }), this.getVirtualItemForOffset = (e) => {
419
+ let t = this.getMeasurements();
420
+ if (t.length === 0) return;
421
+ let n = this._flatMeasurements, r = this.options.lanes === 1 && n != null;
422
+ return i(t[v(0, t.length - 1, r ? (e) => n[e * 2] : (e) => i(t[e]).start, e)]);
423
+ }, this.getMaxScrollOffset = () => {
424
+ if (!this.scrollElement) return 0;
425
+ if ("scrollHeight" in this.scrollElement) return this.options.horizontal ? this.scrollElement.scrollWidth - this.scrollElement.clientWidth : this.scrollElement.scrollHeight - this.scrollElement.clientHeight;
426
+ {
427
+ let e = this.scrollElement.document.documentElement;
428
+ return this.options.horizontal ? e.scrollWidth - this.scrollElement.innerWidth : e.scrollHeight - this.scrollElement.innerHeight;
429
+ }
430
+ }, this.getVirtualDistanceFromEnd = () => Math.max(this.getTotalSize() - this.getSize() - this.getScrollOffset(), 0), this.getDistanceFromEnd = () => Math.max(this.getMaxScrollOffset() - this.getScrollOffset(), 0), this.isAtEnd = (e = this.options.scrollEndThreshold) => this.getDistanceFromEnd() <= e, this.getOffsetForAlignment = (e, t, n = 0) => {
431
+ if (!this.scrollElement) return 0;
432
+ let r = this.getSize(), i = this.getScrollOffset();
433
+ t === "auto" && (t = e >= i + r ? "end" : "start"), t === "center" ? e += (n - r) / 2 : t === "end" && (e -= r);
434
+ let a = this.getMaxScrollOffset();
435
+ return Math.max(Math.min(a, e), 0);
436
+ }, this.getOffsetForIndex = (e, t = "auto") => {
437
+ e = Math.max(0, Math.min(e, this.options.count - 1));
438
+ let n = this.getSize(), r = this.getScrollOffset(), i = this.measurementsCache[e];
439
+ if (!i) return;
440
+ if (t === "auto") if (i.end >= r + n - this.options.scrollPaddingEnd) t = "end";
441
+ else if (i.start <= r + this.options.scrollPaddingStart) t = "start";
442
+ else return [r, t];
443
+ if (t === "end" && e === this.options.count - 1) return [this.getMaxScrollOffset(), t];
444
+ let a = t === "end" ? i.end + this.options.scrollPaddingEnd : i.start - this.options.scrollPaddingStart;
445
+ return [this.getOffsetForAlignment(a, t, i.size), t];
446
+ }, this.scrollToOffset = (e, { align: t = "start", behavior: n = "auto" } = {}) => {
447
+ let r = this.getOffsetForAlignment(e, t), i = this.now();
448
+ this.scrollState = {
449
+ index: null,
450
+ align: t,
451
+ behavior: n,
452
+ startedAt: i,
453
+ lastTargetOffset: r,
454
+ stableFrames: 0
455
+ }, this._scrollToOffset(r, {
456
+ adjustments: void 0,
457
+ behavior: n
458
+ }), this.scheduleScrollReconcile();
459
+ }, this.scrollToIndex = (e, { align: t = "auto", behavior: n = "auto" } = {}) => {
460
+ e = Math.max(0, Math.min(e, this.options.count - 1));
461
+ let r = this.getOffsetForIndex(e, t);
462
+ if (!r) return;
463
+ let [i, a] = r, o = this.now();
464
+ this.scrollState = {
465
+ index: e,
466
+ align: a,
467
+ behavior: n,
468
+ startedAt: o,
469
+ lastTargetOffset: i,
470
+ stableFrames: 0
471
+ }, this._scrollToOffset(i, {
472
+ adjustments: void 0,
473
+ behavior: n
474
+ }), this.scheduleScrollReconcile();
475
+ }, this.scrollBy = (e, { behavior: t = "auto" } = {}) => {
476
+ let n = this.getScrollOffset() + e, r = this.now();
477
+ this.scrollState = {
478
+ index: null,
479
+ align: "start",
480
+ behavior: t,
481
+ startedAt: r,
482
+ lastTargetOffset: n,
483
+ stableFrames: 0
484
+ }, this._scrollToOffset(n, {
485
+ adjustments: void 0,
486
+ behavior: t
487
+ }), this.scheduleScrollReconcile();
488
+ }, this.scrollToEnd = ({ behavior: e = "auto" } = {}) => {
489
+ if (this.options.count > 0) {
490
+ this.scrollToIndex(this.options.count - 1, {
491
+ align: "end",
492
+ behavior: e
493
+ });
494
+ return;
495
+ }
496
+ this.scrollToOffset(Math.max(this.getTotalSize() - this.getSize(), 0), { behavior: e });
497
+ }, this.getTotalSize = () => {
498
+ let e = this.getMeasurements(), t;
499
+ if (e.length === 0) t = this.options.paddingStart;
500
+ else if (this.options.lanes === 1) {
501
+ let n = e.length - 1, r = this._flatMeasurements;
502
+ t = r == null ? e[n]?.end ?? 0 : r[n * 2] + r[n * 2 + 1];
503
+ } else {
504
+ let n = Array(this.options.lanes).fill(null), r = e.length - 1;
505
+ for (; r >= 0 && n.some((e) => e === null);) {
506
+ let t = e[r];
507
+ n[t.lane] === null && (n[t.lane] = t.end), r--;
508
+ }
509
+ t = Math.max(...n.filter((e) => e !== null));
510
+ }
511
+ return Math.max(t - this.options.scrollMargin + this.options.paddingEnd, 0);
512
+ }, this.takeSnapshot = () => {
513
+ let e = [];
514
+ if (this.itemSizeCache.size === 0) return e;
515
+ let t = this.getMeasurements();
516
+ for (let n of t) n && this.itemSizeCache.has(n.key) && e.push({
517
+ index: n.index,
518
+ key: n.key,
519
+ start: n.start,
520
+ size: n.size,
521
+ end: n.end,
522
+ lane: n.lane
523
+ });
524
+ return e;
525
+ }, this._scrollToOffset = (e, { adjustments: t, behavior: n }) => {
526
+ this._intendedScrollOffset = e + (t ?? 0), this.options.scrollToFn(e, {
527
+ behavior: n,
528
+ adjustments: t
529
+ }, this);
530
+ }, this.measure = () => {
531
+ this.pendingMin = null, this.itemSizeCache.clear(), this.laneAssignments.clear(), this.itemSizeCacheVersion++, this.notify(!1);
532
+ }, this.setOptions(t);
533
+ }
534
+ applyScrollAdjustment(e, t) {
535
+ e !== 0 && (process.env.NODE_ENV !== "production" && this.options.debug && console.info("correction", e), o() && (this.isScrolling || this._iosTouching || this._iosJustTouchEnded) ? this._iosDeferredAdjustment += e : (this._scrollToOffset(this.getScrollOffset(), {
536
+ adjustments: this.scrollAdjustments += e,
537
+ behavior: t
538
+ }), this.scrollOffset !== null && (this.scrollOffset += this.scrollAdjustments, this.scrollAdjustments = 0)));
539
+ }
540
+ scheduleScrollReconcile() {
541
+ if (!this.targetWindow) {
542
+ this.scrollState = null;
543
+ return;
544
+ }
545
+ this.rafId ??= this.targetWindow.requestAnimationFrame(() => {
546
+ this.rafId = null, this.reconcileScroll();
547
+ });
548
+ }
549
+ reconcileScroll() {
550
+ if (!this.scrollState || !this.scrollElement) return;
551
+ if (this.now() - this.scrollState.startedAt > 5e3) {
552
+ this.scrollState = null;
553
+ return;
554
+ }
555
+ let e = this.scrollState.index == null ? void 0 : this.getOffsetForIndex(this.scrollState.index, this.scrollState.align), n = e ? e[0] : this.scrollState.lastTargetOffset, r = n !== this.scrollState.lastTargetOffset;
556
+ if (!r && t(n, this.getScrollOffset())) {
557
+ if (this.scrollState.stableFrames++, this.scrollState.stableFrames >= 1) {
558
+ this.getScrollOffset() !== n && this._scrollToOffset(n, {
559
+ adjustments: void 0,
560
+ behavior: "auto"
561
+ }), this.scrollState = null;
562
+ return;
563
+ }
564
+ } else if (this.scrollState.stableFrames = 0, r) {
565
+ let e = this.getSize() || 600, t = Math.abs(n - this.getScrollOffset()), r = this.scrollState.behavior === "smooth" && t > e;
566
+ this.scrollState.lastTargetOffset = n, r || (this.scrollState.behavior = "auto"), this._scrollToOffset(n, {
567
+ adjustments: void 0,
568
+ behavior: r ? "smooth" : "auto"
569
+ });
570
+ }
571
+ this.scheduleScrollReconcile();
572
+ }
573
+ }, v = (e, t, n, r) => {
574
+ for (; e <= t;) {
575
+ let i = (e + t) / 2 | 0, a = n(i);
576
+ if (a < r) e = i + 1;
577
+ else if (a > r) t = i - 1;
578
+ else return i;
579
+ }
580
+ return e > 0 ? e - 1 : 0;
581
+ };
582
+ function y(e, t, n) {
583
+ let r = 0;
584
+ for (; r <= t;) {
585
+ let i = (r + t) / 2 | 0, a = e[i * 2];
586
+ if (a < n) r = i + 1;
587
+ else if (a > n) t = i - 1;
588
+ else return i;
589
+ }
590
+ return r > 0 ? r - 1 : 0;
591
+ }
592
+ function b(e, t, n, r, i) {
593
+ let a = e.length - 1;
594
+ if (e.length <= r) return {
595
+ startIndex: 0,
596
+ endIndex: a
597
+ };
598
+ if (r === 1 && i !== null) {
599
+ let e = y(i, a, n), r = e, o = n + t;
600
+ for (; r < a && i[r * 2] + i[r * 2 + 1] < o;) r++;
601
+ return {
602
+ startIndex: e,
603
+ endIndex: r
604
+ };
605
+ }
606
+ let o = v(0, a, (t) => e[t].start, n), s = o;
607
+ if (r === 1) for (; s < a && e[s].end < n + t;) s++;
608
+ else if (r > 1) {
609
+ let i = Array(r).fill(0);
610
+ for (; s < a && i.some((e) => e < n + t);) {
611
+ let t = e[s];
612
+ i[t.lane] = t.end, s++;
613
+ }
614
+ let c = Array(r).fill(n + t);
615
+ for (; o >= 0 && c.some((e) => e >= n);) {
616
+ let t = e[o];
617
+ c[t.lane] = t.start, o--;
618
+ }
619
+ o = Math.max(0, o - o % r), s = Math.min(a, s + (r - 1 - s % r));
620
+ }
621
+ return {
622
+ startIndex: o,
623
+ endIndex: s
624
+ };
625
+ }
626
+ //#endregion
627
+ export { _ as Virtualizer, t as approxEqual, n as debounce, c as defaultKeyExtractor, l as defaultRangeExtractor, g as elementScroll, h as measureElement, r as memo, i as notUndefined, m as observeElementOffset, u as observeElementRect };
@@ -0,0 +1,31 @@
1
+ //#region node_modules/.pnpm/@tanstack+virtual-core@3.17.3/node_modules/@tanstack/virtual-core/dist/esm/lazy-measurements.js
2
+ function e(e, t, n) {
3
+ let r = Array(e);
4
+ return new Proxy(r, { get(r, i, a) {
5
+ if (typeof i == "string") {
6
+ let a = i.charCodeAt(0);
7
+ if (a >= 48 && a <= 57) {
8
+ let a = +i;
9
+ if (Number.isInteger(a) && a >= 0 && a < e) {
10
+ let e = r[a];
11
+ if (!e) {
12
+ let i = t[a * 2];
13
+ e = r[a] = {
14
+ index: a,
15
+ key: n(a),
16
+ start: i,
17
+ size: t[a * 2 + 1],
18
+ end: i + t[a * 2 + 1],
19
+ lane: 0
20
+ };
21
+ }
22
+ return e;
23
+ }
24
+ }
25
+ if (i === "length") return e;
26
+ }
27
+ return Reflect.get(r, i, a);
28
+ } });
29
+ }
30
+ //#endregion
31
+ export { e as createLazyMeasurementsView };