@legendapp/list 2.0.0-beta.2 → 2.0.0-beta.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.
- package/index.d.mts +10 -11
- package/index.d.ts +10 -11
- package/index.js +163 -690
- package/index.mjs +164 -691
- package/package.json +1 -1
- package/.DS_Store +0 -0
package/index.mjs
CHANGED
|
@@ -1,455 +1,9 @@
|
|
|
1
1
|
import * as React3 from 'react';
|
|
2
2
|
import React3__default, { useReducer, useEffect, createContext, useRef, useState, useMemo, useLayoutEffect, useCallback, useImperativeHandle, forwardRef, memo, useContext } from 'react';
|
|
3
|
-
import { View, Text, Platform, Animated, StyleSheet, Dimensions, RefreshControl } from 'react-native';
|
|
3
|
+
import { View, Text, Platform, Animated, StyleSheet, Dimensions, RefreshControl, unstable_batchedUpdates } from 'react-native';
|
|
4
4
|
import { useSyncExternalStore } from 'use-sync-external-store/shim';
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
var __defProp = Object.defineProperty;
|
|
8
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
9
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
10
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
11
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
12
|
-
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
13
|
-
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
14
|
-
}) : x)(function(x) {
|
|
15
|
-
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
16
|
-
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
17
|
-
});
|
|
18
|
-
var __commonJS = (cb, mod) => function __require2() {
|
|
19
|
-
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
20
|
-
};
|
|
21
|
-
var __copyProps = (to, from, except, desc) => {
|
|
22
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
23
|
-
for (let key of __getOwnPropNames(from))
|
|
24
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
25
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
26
|
-
}
|
|
27
|
-
return to;
|
|
28
|
-
};
|
|
29
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
30
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
31
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
32
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
33
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
34
|
-
!mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
35
|
-
mod
|
|
36
|
-
));
|
|
37
|
-
|
|
38
|
-
// node_modules/react-dom/cjs/react-dom.production.js
|
|
39
|
-
var require_react_dom_production = __commonJS({
|
|
40
|
-
"node_modules/react-dom/cjs/react-dom.production.js"(exports) {
|
|
41
|
-
var React13 = __require("react");
|
|
42
|
-
function formatProdErrorMessage(code) {
|
|
43
|
-
var url = "https://react.dev/errors/" + code;
|
|
44
|
-
if (1 < arguments.length) {
|
|
45
|
-
url += "?args[]=" + encodeURIComponent(arguments[1]);
|
|
46
|
-
for (var i = 2; i < arguments.length; i++)
|
|
47
|
-
url += "&args[]=" + encodeURIComponent(arguments[i]);
|
|
48
|
-
}
|
|
49
|
-
return "Minified React error #" + code + "; visit " + url + " for the full message or use the non-minified dev environment for full errors and additional helpful warnings.";
|
|
50
|
-
}
|
|
51
|
-
function noop2() {
|
|
52
|
-
}
|
|
53
|
-
var Internals = {
|
|
54
|
-
d: {
|
|
55
|
-
f: noop2,
|
|
56
|
-
r: function() {
|
|
57
|
-
throw Error(formatProdErrorMessage(522));
|
|
58
|
-
},
|
|
59
|
-
D: noop2,
|
|
60
|
-
C: noop2,
|
|
61
|
-
L: noop2,
|
|
62
|
-
m: noop2,
|
|
63
|
-
X: noop2,
|
|
64
|
-
S: noop2,
|
|
65
|
-
M: noop2
|
|
66
|
-
},
|
|
67
|
-
p: 0,
|
|
68
|
-
findDOMNode: null
|
|
69
|
-
};
|
|
70
|
-
var REACT_PORTAL_TYPE = Symbol.for("react.portal");
|
|
71
|
-
function createPortal$1(children, containerInfo, implementation) {
|
|
72
|
-
var key = 3 < arguments.length && void 0 !== arguments[3] ? arguments[3] : null;
|
|
73
|
-
return {
|
|
74
|
-
$$typeof: REACT_PORTAL_TYPE,
|
|
75
|
-
key: null == key ? null : "" + key,
|
|
76
|
-
children,
|
|
77
|
-
containerInfo,
|
|
78
|
-
implementation
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
var ReactSharedInternals = React13.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;
|
|
82
|
-
function getCrossOriginStringAs(as, input) {
|
|
83
|
-
if ("font" === as) return "";
|
|
84
|
-
if ("string" === typeof input)
|
|
85
|
-
return "use-credentials" === input ? input : "";
|
|
86
|
-
}
|
|
87
|
-
exports.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE = Internals;
|
|
88
|
-
exports.createPortal = function(children, container) {
|
|
89
|
-
var key = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : null;
|
|
90
|
-
if (!container || 1 !== container.nodeType && 9 !== container.nodeType && 11 !== container.nodeType)
|
|
91
|
-
throw Error(formatProdErrorMessage(299));
|
|
92
|
-
return createPortal$1(children, container, null, key);
|
|
93
|
-
};
|
|
94
|
-
exports.flushSync = function(fn) {
|
|
95
|
-
var previousTransition = ReactSharedInternals.T, previousUpdatePriority = Internals.p;
|
|
96
|
-
try {
|
|
97
|
-
if (ReactSharedInternals.T = null, Internals.p = 2, fn) return fn();
|
|
98
|
-
} finally {
|
|
99
|
-
ReactSharedInternals.T = previousTransition, Internals.p = previousUpdatePriority, Internals.d.f();
|
|
100
|
-
}
|
|
101
|
-
};
|
|
102
|
-
exports.preconnect = function(href, options) {
|
|
103
|
-
"string" === typeof href && (options ? (options = options.crossOrigin, options = "string" === typeof options ? "use-credentials" === options ? options : "" : void 0) : options = null, Internals.d.C(href, options));
|
|
104
|
-
};
|
|
105
|
-
exports.prefetchDNS = function(href) {
|
|
106
|
-
"string" === typeof href && Internals.d.D(href);
|
|
107
|
-
};
|
|
108
|
-
exports.preinit = function(href, options) {
|
|
109
|
-
if ("string" === typeof href && options && "string" === typeof options.as) {
|
|
110
|
-
var as = options.as, crossOrigin = getCrossOriginStringAs(as, options.crossOrigin), integrity = "string" === typeof options.integrity ? options.integrity : void 0, fetchPriority = "string" === typeof options.fetchPriority ? options.fetchPriority : void 0;
|
|
111
|
-
"style" === as ? Internals.d.S(
|
|
112
|
-
href,
|
|
113
|
-
"string" === typeof options.precedence ? options.precedence : void 0,
|
|
114
|
-
{
|
|
115
|
-
crossOrigin,
|
|
116
|
-
integrity,
|
|
117
|
-
fetchPriority
|
|
118
|
-
}
|
|
119
|
-
) : "script" === as && Internals.d.X(href, {
|
|
120
|
-
crossOrigin,
|
|
121
|
-
integrity,
|
|
122
|
-
fetchPriority,
|
|
123
|
-
nonce: "string" === typeof options.nonce ? options.nonce : void 0
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
|
-
};
|
|
127
|
-
exports.preinitModule = function(href, options) {
|
|
128
|
-
if ("string" === typeof href)
|
|
129
|
-
if ("object" === typeof options && null !== options) {
|
|
130
|
-
if (null == options.as || "script" === options.as) {
|
|
131
|
-
var crossOrigin = getCrossOriginStringAs(
|
|
132
|
-
options.as,
|
|
133
|
-
options.crossOrigin
|
|
134
|
-
);
|
|
135
|
-
Internals.d.M(href, {
|
|
136
|
-
crossOrigin,
|
|
137
|
-
integrity: "string" === typeof options.integrity ? options.integrity : void 0,
|
|
138
|
-
nonce: "string" === typeof options.nonce ? options.nonce : void 0
|
|
139
|
-
});
|
|
140
|
-
}
|
|
141
|
-
} else null == options && Internals.d.M(href);
|
|
142
|
-
};
|
|
143
|
-
exports.preload = function(href, options) {
|
|
144
|
-
if ("string" === typeof href && "object" === typeof options && null !== options && "string" === typeof options.as) {
|
|
145
|
-
var as = options.as, crossOrigin = getCrossOriginStringAs(as, options.crossOrigin);
|
|
146
|
-
Internals.d.L(href, as, {
|
|
147
|
-
crossOrigin,
|
|
148
|
-
integrity: "string" === typeof options.integrity ? options.integrity : void 0,
|
|
149
|
-
nonce: "string" === typeof options.nonce ? options.nonce : void 0,
|
|
150
|
-
type: "string" === typeof options.type ? options.type : void 0,
|
|
151
|
-
fetchPriority: "string" === typeof options.fetchPriority ? options.fetchPriority : void 0,
|
|
152
|
-
referrerPolicy: "string" === typeof options.referrerPolicy ? options.referrerPolicy : void 0,
|
|
153
|
-
imageSrcSet: "string" === typeof options.imageSrcSet ? options.imageSrcSet : void 0,
|
|
154
|
-
imageSizes: "string" === typeof options.imageSizes ? options.imageSizes : void 0,
|
|
155
|
-
media: "string" === typeof options.media ? options.media : void 0
|
|
156
|
-
});
|
|
157
|
-
}
|
|
158
|
-
};
|
|
159
|
-
exports.preloadModule = function(href, options) {
|
|
160
|
-
if ("string" === typeof href)
|
|
161
|
-
if (options) {
|
|
162
|
-
var crossOrigin = getCrossOriginStringAs(options.as, options.crossOrigin);
|
|
163
|
-
Internals.d.m(href, {
|
|
164
|
-
as: "string" === typeof options.as && "script" !== options.as ? options.as : void 0,
|
|
165
|
-
crossOrigin,
|
|
166
|
-
integrity: "string" === typeof options.integrity ? options.integrity : void 0
|
|
167
|
-
});
|
|
168
|
-
} else Internals.d.m(href);
|
|
169
|
-
};
|
|
170
|
-
exports.requestFormReset = function(form) {
|
|
171
|
-
Internals.d.r(form);
|
|
172
|
-
};
|
|
173
|
-
exports.unstable_batchedUpdates = function(fn, a) {
|
|
174
|
-
return fn(a);
|
|
175
|
-
};
|
|
176
|
-
exports.useFormState = function(action, initialState, permalink) {
|
|
177
|
-
return ReactSharedInternals.H.useFormState(action, initialState, permalink);
|
|
178
|
-
};
|
|
179
|
-
exports.useFormStatus = function() {
|
|
180
|
-
return ReactSharedInternals.H.useHostTransitionStatus();
|
|
181
|
-
};
|
|
182
|
-
exports.version = "19.1.1";
|
|
183
|
-
}
|
|
184
|
-
});
|
|
185
|
-
|
|
186
|
-
// node_modules/react-dom/cjs/react-dom.development.js
|
|
187
|
-
var require_react_dom_development = __commonJS({
|
|
188
|
-
"node_modules/react-dom/cjs/react-dom.development.js"(exports) {
|
|
189
|
-
"production" !== process.env.NODE_ENV && function() {
|
|
190
|
-
function noop2() {
|
|
191
|
-
}
|
|
192
|
-
function testStringCoercion(value) {
|
|
193
|
-
return "" + value;
|
|
194
|
-
}
|
|
195
|
-
function createPortal$1(children, containerInfo, implementation) {
|
|
196
|
-
var key = 3 < arguments.length && void 0 !== arguments[3] ? arguments[3] : null;
|
|
197
|
-
try {
|
|
198
|
-
testStringCoercion(key);
|
|
199
|
-
var JSCompiler_inline_result = false;
|
|
200
|
-
} catch (e) {
|
|
201
|
-
JSCompiler_inline_result = true;
|
|
202
|
-
}
|
|
203
|
-
JSCompiler_inline_result && (console.error(
|
|
204
|
-
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
|
|
205
|
-
"function" === typeof Symbol && Symbol.toStringTag && key[Symbol.toStringTag] || key.constructor.name || "Object"
|
|
206
|
-
), testStringCoercion(key));
|
|
207
|
-
return {
|
|
208
|
-
$$typeof: REACT_PORTAL_TYPE,
|
|
209
|
-
key: null == key ? null : "" + key,
|
|
210
|
-
children,
|
|
211
|
-
containerInfo,
|
|
212
|
-
implementation
|
|
213
|
-
};
|
|
214
|
-
}
|
|
215
|
-
function getCrossOriginStringAs(as, input) {
|
|
216
|
-
if ("font" === as) return "";
|
|
217
|
-
if ("string" === typeof input)
|
|
218
|
-
return "use-credentials" === input ? input : "";
|
|
219
|
-
}
|
|
220
|
-
function getValueDescriptorExpectingObjectForWarning(thing) {
|
|
221
|
-
return null === thing ? "`null`" : void 0 === thing ? "`undefined`" : "" === thing ? "an empty string" : 'something with type "' + typeof thing + '"';
|
|
222
|
-
}
|
|
223
|
-
function getValueDescriptorExpectingEnumForWarning(thing) {
|
|
224
|
-
return null === thing ? "`null`" : void 0 === thing ? "`undefined`" : "" === thing ? "an empty string" : "string" === typeof thing ? JSON.stringify(thing) : "number" === typeof thing ? "`" + thing + "`" : 'something with type "' + typeof thing + '"';
|
|
225
|
-
}
|
|
226
|
-
function resolveDispatcher() {
|
|
227
|
-
var dispatcher = ReactSharedInternals.H;
|
|
228
|
-
null === dispatcher && console.error(
|
|
229
|
-
"Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://react.dev/link/invalid-hook-call for tips about how to debug and fix this problem."
|
|
230
|
-
);
|
|
231
|
-
return dispatcher;
|
|
232
|
-
}
|
|
233
|
-
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
|
|
234
|
-
var React13 = __require("react"), Internals = {
|
|
235
|
-
d: {
|
|
236
|
-
f: noop2,
|
|
237
|
-
r: function() {
|
|
238
|
-
throw Error(
|
|
239
|
-
"Invalid form element. requestFormReset must be passed a form that was rendered by React."
|
|
240
|
-
);
|
|
241
|
-
},
|
|
242
|
-
D: noop2,
|
|
243
|
-
C: noop2,
|
|
244
|
-
L: noop2,
|
|
245
|
-
m: noop2,
|
|
246
|
-
X: noop2,
|
|
247
|
-
S: noop2,
|
|
248
|
-
M: noop2
|
|
249
|
-
},
|
|
250
|
-
p: 0,
|
|
251
|
-
findDOMNode: null
|
|
252
|
-
}, REACT_PORTAL_TYPE = Symbol.for("react.portal"), ReactSharedInternals = React13.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;
|
|
253
|
-
"function" === typeof Map && null != Map.prototype && "function" === typeof Map.prototype.forEach && "function" === typeof Set && null != Set.prototype && "function" === typeof Set.prototype.clear && "function" === typeof Set.prototype.forEach || console.error(
|
|
254
|
-
"React depends on Map and Set built-in types. Make sure that you load a polyfill in older browsers. https://reactjs.org/link/react-polyfills"
|
|
255
|
-
);
|
|
256
|
-
exports.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE = Internals;
|
|
257
|
-
exports.createPortal = function(children, container) {
|
|
258
|
-
var key = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : null;
|
|
259
|
-
if (!container || 1 !== container.nodeType && 9 !== container.nodeType && 11 !== container.nodeType)
|
|
260
|
-
throw Error("Target container is not a DOM element.");
|
|
261
|
-
return createPortal$1(children, container, null, key);
|
|
262
|
-
};
|
|
263
|
-
exports.flushSync = function(fn) {
|
|
264
|
-
var previousTransition = ReactSharedInternals.T, previousUpdatePriority = Internals.p;
|
|
265
|
-
try {
|
|
266
|
-
if (ReactSharedInternals.T = null, Internals.p = 2, fn)
|
|
267
|
-
return fn();
|
|
268
|
-
} finally {
|
|
269
|
-
ReactSharedInternals.T = previousTransition, Internals.p = previousUpdatePriority, Internals.d.f() && console.error(
|
|
270
|
-
"flushSync was called from inside a lifecycle method. React cannot flush when React is already rendering. Consider moving this call to a scheduler task or micro task."
|
|
271
|
-
);
|
|
272
|
-
}
|
|
273
|
-
};
|
|
274
|
-
exports.preconnect = function(href, options) {
|
|
275
|
-
"string" === typeof href && href ? null != options && "object" !== typeof options ? console.error(
|
|
276
|
-
"ReactDOM.preconnect(): Expected the `options` argument (second) to be an object but encountered %s instead. The only supported option at this time is `crossOrigin` which accepts a string.",
|
|
277
|
-
getValueDescriptorExpectingEnumForWarning(options)
|
|
278
|
-
) : null != options && "string" !== typeof options.crossOrigin && console.error(
|
|
279
|
-
"ReactDOM.preconnect(): Expected the `crossOrigin` option (second argument) to be a string but encountered %s instead. Try removing this option or passing a string value instead.",
|
|
280
|
-
getValueDescriptorExpectingObjectForWarning(options.crossOrigin)
|
|
281
|
-
) : console.error(
|
|
282
|
-
"ReactDOM.preconnect(): Expected the `href` argument (first) to be a non-empty string but encountered %s instead.",
|
|
283
|
-
getValueDescriptorExpectingObjectForWarning(href)
|
|
284
|
-
);
|
|
285
|
-
"string" === typeof href && (options ? (options = options.crossOrigin, options = "string" === typeof options ? "use-credentials" === options ? options : "" : void 0) : options = null, Internals.d.C(href, options));
|
|
286
|
-
};
|
|
287
|
-
exports.prefetchDNS = function(href) {
|
|
288
|
-
if ("string" !== typeof href || !href)
|
|
289
|
-
console.error(
|
|
290
|
-
"ReactDOM.prefetchDNS(): Expected the `href` argument (first) to be a non-empty string but encountered %s instead.",
|
|
291
|
-
getValueDescriptorExpectingObjectForWarning(href)
|
|
292
|
-
);
|
|
293
|
-
else if (1 < arguments.length) {
|
|
294
|
-
var options = arguments[1];
|
|
295
|
-
"object" === typeof options && options.hasOwnProperty("crossOrigin") ? console.error(
|
|
296
|
-
"ReactDOM.prefetchDNS(): Expected only one argument, `href`, but encountered %s as a second argument instead. This argument is reserved for future options and is currently disallowed. It looks like the you are attempting to set a crossOrigin property for this DNS lookup hint. Browsers do not perform DNS queries using CORS and setting this attribute on the resource hint has no effect. Try calling ReactDOM.prefetchDNS() with just a single string argument, `href`.",
|
|
297
|
-
getValueDescriptorExpectingEnumForWarning(options)
|
|
298
|
-
) : console.error(
|
|
299
|
-
"ReactDOM.prefetchDNS(): Expected only one argument, `href`, but encountered %s as a second argument instead. This argument is reserved for future options and is currently disallowed. Try calling ReactDOM.prefetchDNS() with just a single string argument, `href`.",
|
|
300
|
-
getValueDescriptorExpectingEnumForWarning(options)
|
|
301
|
-
);
|
|
302
|
-
}
|
|
303
|
-
"string" === typeof href && Internals.d.D(href);
|
|
304
|
-
};
|
|
305
|
-
exports.preinit = function(href, options) {
|
|
306
|
-
"string" === typeof href && href ? null == options || "object" !== typeof options ? console.error(
|
|
307
|
-
"ReactDOM.preinit(): Expected the `options` argument (second) to be an object with an `as` property describing the type of resource to be preinitialized but encountered %s instead.",
|
|
308
|
-
getValueDescriptorExpectingEnumForWarning(options)
|
|
309
|
-
) : "style" !== options.as && "script" !== options.as && console.error(
|
|
310
|
-
'ReactDOM.preinit(): Expected the `as` property in the `options` argument (second) to contain a valid value describing the type of resource to be preinitialized but encountered %s instead. Valid values for `as` are "style" and "script".',
|
|
311
|
-
getValueDescriptorExpectingEnumForWarning(options.as)
|
|
312
|
-
) : console.error(
|
|
313
|
-
"ReactDOM.preinit(): Expected the `href` argument (first) to be a non-empty string but encountered %s instead.",
|
|
314
|
-
getValueDescriptorExpectingObjectForWarning(href)
|
|
315
|
-
);
|
|
316
|
-
if ("string" === typeof href && options && "string" === typeof options.as) {
|
|
317
|
-
var as = options.as, crossOrigin = getCrossOriginStringAs(as, options.crossOrigin), integrity = "string" === typeof options.integrity ? options.integrity : void 0, fetchPriority = "string" === typeof options.fetchPriority ? options.fetchPriority : void 0;
|
|
318
|
-
"style" === as ? Internals.d.S(
|
|
319
|
-
href,
|
|
320
|
-
"string" === typeof options.precedence ? options.precedence : void 0,
|
|
321
|
-
{
|
|
322
|
-
crossOrigin,
|
|
323
|
-
integrity,
|
|
324
|
-
fetchPriority
|
|
325
|
-
}
|
|
326
|
-
) : "script" === as && Internals.d.X(href, {
|
|
327
|
-
crossOrigin,
|
|
328
|
-
integrity,
|
|
329
|
-
fetchPriority,
|
|
330
|
-
nonce: "string" === typeof options.nonce ? options.nonce : void 0
|
|
331
|
-
});
|
|
332
|
-
}
|
|
333
|
-
};
|
|
334
|
-
exports.preinitModule = function(href, options) {
|
|
335
|
-
var encountered = "";
|
|
336
|
-
"string" === typeof href && href || (encountered += " The `href` argument encountered was " + getValueDescriptorExpectingObjectForWarning(href) + ".");
|
|
337
|
-
void 0 !== options && "object" !== typeof options ? encountered += " The `options` argument encountered was " + getValueDescriptorExpectingObjectForWarning(options) + "." : options && "as" in options && "script" !== options.as && (encountered += " The `as` option encountered was " + getValueDescriptorExpectingEnumForWarning(options.as) + ".");
|
|
338
|
-
if (encountered)
|
|
339
|
-
console.error(
|
|
340
|
-
"ReactDOM.preinitModule(): Expected up to two arguments, a non-empty `href` string and, optionally, an `options` object with a valid `as` property.%s",
|
|
341
|
-
encountered
|
|
342
|
-
);
|
|
343
|
-
else
|
|
344
|
-
switch (encountered = options && "string" === typeof options.as ? options.as : "script", encountered) {
|
|
345
|
-
case "script":
|
|
346
|
-
break;
|
|
347
|
-
default:
|
|
348
|
-
encountered = getValueDescriptorExpectingEnumForWarning(encountered), console.error(
|
|
349
|
-
'ReactDOM.preinitModule(): Currently the only supported "as" type for this function is "script" but received "%s" instead. This warning was generated for `href` "%s". In the future other module types will be supported, aligning with the import-attributes proposal. Learn more here: (https://github.com/tc39/proposal-import-attributes)',
|
|
350
|
-
encountered,
|
|
351
|
-
href
|
|
352
|
-
);
|
|
353
|
-
}
|
|
354
|
-
if ("string" === typeof href)
|
|
355
|
-
if ("object" === typeof options && null !== options) {
|
|
356
|
-
if (null == options.as || "script" === options.as)
|
|
357
|
-
encountered = getCrossOriginStringAs(
|
|
358
|
-
options.as,
|
|
359
|
-
options.crossOrigin
|
|
360
|
-
), Internals.d.M(href, {
|
|
361
|
-
crossOrigin: encountered,
|
|
362
|
-
integrity: "string" === typeof options.integrity ? options.integrity : void 0,
|
|
363
|
-
nonce: "string" === typeof options.nonce ? options.nonce : void 0
|
|
364
|
-
});
|
|
365
|
-
} else null == options && Internals.d.M(href);
|
|
366
|
-
};
|
|
367
|
-
exports.preload = function(href, options) {
|
|
368
|
-
var encountered = "";
|
|
369
|
-
"string" === typeof href && href || (encountered += " The `href` argument encountered was " + getValueDescriptorExpectingObjectForWarning(href) + ".");
|
|
370
|
-
null == options || "object" !== typeof options ? encountered += " The `options` argument encountered was " + getValueDescriptorExpectingObjectForWarning(options) + "." : "string" === typeof options.as && options.as || (encountered += " The `as` option encountered was " + getValueDescriptorExpectingObjectForWarning(options.as) + ".");
|
|
371
|
-
encountered && console.error(
|
|
372
|
-
'ReactDOM.preload(): Expected two arguments, a non-empty `href` string and an `options` object with an `as` property valid for a `<link rel="preload" as="..." />` tag.%s',
|
|
373
|
-
encountered
|
|
374
|
-
);
|
|
375
|
-
if ("string" === typeof href && "object" === typeof options && null !== options && "string" === typeof options.as) {
|
|
376
|
-
encountered = options.as;
|
|
377
|
-
var crossOrigin = getCrossOriginStringAs(
|
|
378
|
-
encountered,
|
|
379
|
-
options.crossOrigin
|
|
380
|
-
);
|
|
381
|
-
Internals.d.L(href, encountered, {
|
|
382
|
-
crossOrigin,
|
|
383
|
-
integrity: "string" === typeof options.integrity ? options.integrity : void 0,
|
|
384
|
-
nonce: "string" === typeof options.nonce ? options.nonce : void 0,
|
|
385
|
-
type: "string" === typeof options.type ? options.type : void 0,
|
|
386
|
-
fetchPriority: "string" === typeof options.fetchPriority ? options.fetchPriority : void 0,
|
|
387
|
-
referrerPolicy: "string" === typeof options.referrerPolicy ? options.referrerPolicy : void 0,
|
|
388
|
-
imageSrcSet: "string" === typeof options.imageSrcSet ? options.imageSrcSet : void 0,
|
|
389
|
-
imageSizes: "string" === typeof options.imageSizes ? options.imageSizes : void 0,
|
|
390
|
-
media: "string" === typeof options.media ? options.media : void 0
|
|
391
|
-
});
|
|
392
|
-
}
|
|
393
|
-
};
|
|
394
|
-
exports.preloadModule = function(href, options) {
|
|
395
|
-
var encountered = "";
|
|
396
|
-
"string" === typeof href && href || (encountered += " The `href` argument encountered was " + getValueDescriptorExpectingObjectForWarning(href) + ".");
|
|
397
|
-
void 0 !== options && "object" !== typeof options ? encountered += " The `options` argument encountered was " + getValueDescriptorExpectingObjectForWarning(options) + "." : options && "as" in options && "string" !== typeof options.as && (encountered += " The `as` option encountered was " + getValueDescriptorExpectingObjectForWarning(options.as) + ".");
|
|
398
|
-
encountered && console.error(
|
|
399
|
-
'ReactDOM.preloadModule(): Expected two arguments, a non-empty `href` string and, optionally, an `options` object with an `as` property valid for a `<link rel="modulepreload" as="..." />` tag.%s',
|
|
400
|
-
encountered
|
|
401
|
-
);
|
|
402
|
-
"string" === typeof href && (options ? (encountered = getCrossOriginStringAs(
|
|
403
|
-
options.as,
|
|
404
|
-
options.crossOrigin
|
|
405
|
-
), Internals.d.m(href, {
|
|
406
|
-
as: "string" === typeof options.as && "script" !== options.as ? options.as : void 0,
|
|
407
|
-
crossOrigin: encountered,
|
|
408
|
-
integrity: "string" === typeof options.integrity ? options.integrity : void 0
|
|
409
|
-
})) : Internals.d.m(href));
|
|
410
|
-
};
|
|
411
|
-
exports.requestFormReset = function(form) {
|
|
412
|
-
Internals.d.r(form);
|
|
413
|
-
};
|
|
414
|
-
exports.unstable_batchedUpdates = function(fn, a) {
|
|
415
|
-
return fn(a);
|
|
416
|
-
};
|
|
417
|
-
exports.useFormState = function(action, initialState, permalink) {
|
|
418
|
-
return resolveDispatcher().useFormState(action, initialState, permalink);
|
|
419
|
-
};
|
|
420
|
-
exports.useFormStatus = function() {
|
|
421
|
-
return resolveDispatcher().useHostTransitionStatus();
|
|
422
|
-
};
|
|
423
|
-
exports.version = "19.1.1";
|
|
424
|
-
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
|
|
425
|
-
}();
|
|
426
|
-
}
|
|
427
|
-
});
|
|
428
|
-
|
|
429
|
-
// node_modules/react-dom/index.js
|
|
430
|
-
var require_react_dom = __commonJS({
|
|
431
|
-
"node_modules/react-dom/index.js"(exports, module) {
|
|
432
|
-
function checkDCE() {
|
|
433
|
-
if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === "undefined" || typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE !== "function") {
|
|
434
|
-
return;
|
|
435
|
-
}
|
|
436
|
-
if (process.env.NODE_ENV !== "production") {
|
|
437
|
-
throw new Error("^_^");
|
|
438
|
-
}
|
|
439
|
-
try {
|
|
440
|
-
__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(checkDCE);
|
|
441
|
-
} catch (err) {
|
|
442
|
-
console.error(err);
|
|
443
|
-
}
|
|
444
|
-
}
|
|
445
|
-
if (process.env.NODE_ENV === "production") {
|
|
446
|
-
checkDCE();
|
|
447
|
-
module.exports = require_react_dom_production();
|
|
448
|
-
} else {
|
|
449
|
-
module.exports = require_react_dom_development();
|
|
450
|
-
}
|
|
451
|
-
}
|
|
452
|
-
});
|
|
6
|
+
// src/components/LegendList.tsx
|
|
453
7
|
var ContextState = React3.createContext(null);
|
|
454
8
|
function StateProvider({ children }) {
|
|
455
9
|
const [value] = React3.useState(() => ({
|
|
@@ -1118,30 +672,33 @@ function useThrottleDebounce(mode) {
|
|
|
1118
672
|
timeoutRef.current = null;
|
|
1119
673
|
}
|
|
1120
674
|
};
|
|
1121
|
-
const execute = useCallback(
|
|
1122
|
-
{
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
lastCallTimeRef.current
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
675
|
+
const execute = useCallback(
|
|
676
|
+
(callback, delay, ...args) => {
|
|
677
|
+
{
|
|
678
|
+
const now = Date.now();
|
|
679
|
+
lastArgsRef.current = args;
|
|
680
|
+
if (now - lastCallTimeRef.current >= delay) {
|
|
681
|
+
lastCallTimeRef.current = now;
|
|
682
|
+
callback(...args);
|
|
683
|
+
clearTimeoutRef();
|
|
684
|
+
} else {
|
|
685
|
+
clearTimeoutRef();
|
|
686
|
+
timeoutRef.current = setTimeout(
|
|
687
|
+
() => {
|
|
688
|
+
if (lastArgsRef.current) {
|
|
689
|
+
lastCallTimeRef.current = Date.now();
|
|
690
|
+
callback(...lastArgsRef.current);
|
|
691
|
+
timeoutRef.current = null;
|
|
692
|
+
lastArgsRef.current = null;
|
|
693
|
+
}
|
|
694
|
+
},
|
|
695
|
+
delay - (now - lastCallTimeRef.current)
|
|
696
|
+
);
|
|
697
|
+
}
|
|
1142
698
|
}
|
|
1143
|
-
}
|
|
1144
|
-
|
|
699
|
+
},
|
|
700
|
+
[mode]
|
|
701
|
+
);
|
|
1145
702
|
return execute;
|
|
1146
703
|
}
|
|
1147
704
|
|
|
@@ -1337,7 +894,7 @@ function calculateOffsetForIndex(ctx, state, index) {
|
|
|
1337
894
|
}
|
|
1338
895
|
|
|
1339
896
|
// src/utils/getItemSize.ts
|
|
1340
|
-
function getItemSize(state, key, index, data, useAverageSize, defaultAverageSize
|
|
897
|
+
function getItemSize(state, key, index, data, useAverageSize, defaultAverageSize) {
|
|
1341
898
|
var _a, _b;
|
|
1342
899
|
const {
|
|
1343
900
|
sizesKnown,
|
|
@@ -1358,11 +915,7 @@ function getItemSize(state, key, index, data, useAverageSize, defaultAverageSize
|
|
|
1358
915
|
sizesKnown.set(key, size);
|
|
1359
916
|
}
|
|
1360
917
|
}
|
|
1361
|
-
|
|
1362
|
-
if (size === void 0 && preferRenderedCache && renderedSize !== void 0) {
|
|
1363
|
-
return renderedSize;
|
|
1364
|
-
}
|
|
1365
|
-
if (size === void 0 && useAverageSize && !scrollingTo) {
|
|
918
|
+
if (size === void 0 && useAverageSize && sizeKnown === void 0 && !scrollingTo) {
|
|
1366
919
|
if (itemType === "") {
|
|
1367
920
|
size = defaultAverageSize;
|
|
1368
921
|
} else {
|
|
@@ -1372,8 +925,11 @@ function getItemSize(state, key, index, data, useAverageSize, defaultAverageSize
|
|
|
1372
925
|
}
|
|
1373
926
|
}
|
|
1374
927
|
}
|
|
1375
|
-
if (size === void 0
|
|
1376
|
-
|
|
928
|
+
if (size === void 0) {
|
|
929
|
+
size = sizes.get(key);
|
|
930
|
+
if (size !== void 0) {
|
|
931
|
+
return size;
|
|
932
|
+
}
|
|
1377
933
|
}
|
|
1378
934
|
if (size === void 0) {
|
|
1379
935
|
size = getEstimatedItemSize ? getEstimatedItemSize(index, data, itemType) : estimatedItemSize;
|
|
@@ -1600,44 +1156,6 @@ function addTotalSize(ctx, state, key, add) {
|
|
|
1600
1156
|
}
|
|
1601
1157
|
}
|
|
1602
1158
|
|
|
1603
|
-
// src/utils/getScrollVelocity.ts
|
|
1604
|
-
var getScrollVelocity = (state) => {
|
|
1605
|
-
const { scrollHistory } = state;
|
|
1606
|
-
let velocity = 0;
|
|
1607
|
-
if (scrollHistory.length >= 1) {
|
|
1608
|
-
const newest = scrollHistory[scrollHistory.length - 1];
|
|
1609
|
-
let oldest;
|
|
1610
|
-
let start = 0;
|
|
1611
|
-
const now = Date.now();
|
|
1612
|
-
for (let i = 0; i < scrollHistory.length - 1; i++) {
|
|
1613
|
-
const entry = scrollHistory[i];
|
|
1614
|
-
const nextEntry = scrollHistory[i + 1];
|
|
1615
|
-
if (i > 0) {
|
|
1616
|
-
const prevEntry = scrollHistory[i - 1];
|
|
1617
|
-
const prevDirection = entry.scroll - prevEntry.scroll;
|
|
1618
|
-
const currentDirection = nextEntry.scroll - entry.scroll;
|
|
1619
|
-
if (prevDirection > 0 && currentDirection < 0 || prevDirection < 0 && currentDirection > 0) {
|
|
1620
|
-
start = i;
|
|
1621
|
-
break;
|
|
1622
|
-
}
|
|
1623
|
-
}
|
|
1624
|
-
}
|
|
1625
|
-
for (let i = start; i < scrollHistory.length - 1; i++) {
|
|
1626
|
-
const entry = scrollHistory[i];
|
|
1627
|
-
if (now - entry.time <= 1e3) {
|
|
1628
|
-
oldest = entry;
|
|
1629
|
-
break;
|
|
1630
|
-
}
|
|
1631
|
-
}
|
|
1632
|
-
if (oldest && oldest !== newest) {
|
|
1633
|
-
const scrollDiff = newest.scroll - oldest.scroll;
|
|
1634
|
-
const timeDiff = newest.time - oldest.time;
|
|
1635
|
-
velocity = timeDiff > 0 ? scrollDiff / timeDiff : 0;
|
|
1636
|
-
}
|
|
1637
|
-
}
|
|
1638
|
-
return velocity;
|
|
1639
|
-
};
|
|
1640
|
-
|
|
1641
1159
|
// src/utils/updateSnapToOffsets.ts
|
|
1642
1160
|
function updateSnapToOffsets(ctx, state) {
|
|
1643
1161
|
const {
|
|
@@ -1654,84 +1172,48 @@ function updateSnapToOffsets(ctx, state) {
|
|
|
1654
1172
|
}
|
|
1655
1173
|
|
|
1656
1174
|
// src/core/updateAllPositions.ts
|
|
1657
|
-
function updateAllPositions(ctx, state, dataChanged) {
|
|
1658
|
-
var _a, _b, _c, _d, _e;
|
|
1175
|
+
function updateAllPositions(ctx, state, dataChanged, startIndex = 0) {
|
|
1176
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
1659
1177
|
const {
|
|
1660
1178
|
averageSizes,
|
|
1661
1179
|
columns,
|
|
1662
1180
|
indexByKey,
|
|
1663
1181
|
positions,
|
|
1664
|
-
firstFullyOnScreenIndex,
|
|
1665
1182
|
idCache,
|
|
1666
1183
|
sizesKnown,
|
|
1667
|
-
props: { getEstimatedItemSize, snapToIndices }
|
|
1184
|
+
props: { getEstimatedItemSize, snapToIndices, enableAverages }
|
|
1668
1185
|
} = state;
|
|
1669
1186
|
const data = state.props.data;
|
|
1670
1187
|
const numColumns = peek$(ctx, "numColumns");
|
|
1671
1188
|
const indexByKeyForChecking = __DEV__ ? /* @__PURE__ */ new Map() : void 0;
|
|
1672
|
-
const
|
|
1673
|
-
const useAverageSize = !getEstimatedItemSize;
|
|
1189
|
+
const useAverageSize = enableAverages && !getEstimatedItemSize;
|
|
1674
1190
|
const itemType = "";
|
|
1675
1191
|
let averageSize = (_a = averageSizes[itemType]) == null ? void 0 : _a.avg;
|
|
1676
1192
|
if (averageSize !== void 0) {
|
|
1677
1193
|
averageSize = roundSize(averageSize);
|
|
1678
1194
|
}
|
|
1679
|
-
const shouldUseBackwards = !dataChanged && scrollVelocity < 0 && firstFullyOnScreenIndex > 5 && firstFullyOnScreenIndex < data.length;
|
|
1680
|
-
if (shouldUseBackwards && firstFullyOnScreenIndex !== void 0) {
|
|
1681
|
-
const anchorId = getId(state, firstFullyOnScreenIndex);
|
|
1682
|
-
const anchorPosition = positions.get(anchorId);
|
|
1683
|
-
if (anchorPosition !== void 0) {
|
|
1684
|
-
let currentRowTop2 = anchorPosition;
|
|
1685
|
-
let maxSizeInRow2 = 0;
|
|
1686
|
-
let bailout = false;
|
|
1687
|
-
for (let i = firstFullyOnScreenIndex - 1; i >= 0; i--) {
|
|
1688
|
-
const id = (_b = idCache.get(i)) != null ? _b : getId(state, i);
|
|
1689
|
-
const size = (_c = sizesKnown.get(id)) != null ? _c : getItemSize(
|
|
1690
|
-
state,
|
|
1691
|
-
id,
|
|
1692
|
-
i,
|
|
1693
|
-
data[i],
|
|
1694
|
-
useAverageSize,
|
|
1695
|
-
averageSize,
|
|
1696
|
-
/*preferRenderedCache*/
|
|
1697
|
-
!!dataChanged
|
|
1698
|
-
);
|
|
1699
|
-
const itemColumn = columns.get(id);
|
|
1700
|
-
maxSizeInRow2 = Math.max(maxSizeInRow2, size);
|
|
1701
|
-
if (itemColumn === 1) {
|
|
1702
|
-
currentRowTop2 -= maxSizeInRow2;
|
|
1703
|
-
maxSizeInRow2 = 0;
|
|
1704
|
-
}
|
|
1705
|
-
if (currentRowTop2 < -2e3) {
|
|
1706
|
-
bailout = true;
|
|
1707
|
-
break;
|
|
1708
|
-
}
|
|
1709
|
-
positions.set(id, currentRowTop2);
|
|
1710
|
-
}
|
|
1711
|
-
if (!bailout) {
|
|
1712
|
-
updateTotalSize(ctx, state);
|
|
1713
|
-
return;
|
|
1714
|
-
}
|
|
1715
|
-
}
|
|
1716
|
-
}
|
|
1717
1195
|
let currentRowTop = 0;
|
|
1718
1196
|
let column = 1;
|
|
1719
1197
|
let maxSizeInRow = 0;
|
|
1720
1198
|
const hasColumns = numColumns > 1;
|
|
1199
|
+
if (startIndex > 0) {
|
|
1200
|
+
const prevIndex = startIndex - 1;
|
|
1201
|
+
const prevId = (_b = idCache.get(prevIndex)) != null ? _b : getId(state, prevIndex);
|
|
1202
|
+
const prevPosition = (_c = positions.get(prevId)) != null ? _c : 0;
|
|
1203
|
+
if (hasColumns) {
|
|
1204
|
+
const prevColumn = (_d = columns.get(prevId)) != null ? _d : 1;
|
|
1205
|
+
currentRowTop = prevPosition;
|
|
1206
|
+
column = prevColumn % numColumns + 1;
|
|
1207
|
+
} else {
|
|
1208
|
+
const prevSize = (_e = sizesKnown.get(prevId)) != null ? _e : getItemSize(state, prevId, prevIndex, data[prevIndex], useAverageSize, averageSize);
|
|
1209
|
+
currentRowTop = prevPosition + prevSize;
|
|
1210
|
+
}
|
|
1211
|
+
}
|
|
1721
1212
|
const needsIndexByKey = dataChanged || indexByKey.size === 0;
|
|
1722
1213
|
const dataLength = data.length;
|
|
1723
|
-
for (let i =
|
|
1724
|
-
const id = (
|
|
1725
|
-
const size = (
|
|
1726
|
-
state,
|
|
1727
|
-
id,
|
|
1728
|
-
i,
|
|
1729
|
-
data[i],
|
|
1730
|
-
useAverageSize,
|
|
1731
|
-
averageSize,
|
|
1732
|
-
/*preferRenderedCache*/
|
|
1733
|
-
!!dataChanged
|
|
1734
|
-
);
|
|
1214
|
+
for (let i = startIndex; i < dataLength; i++) {
|
|
1215
|
+
const id = (_f = idCache.get(i)) != null ? _f : getId(state, i);
|
|
1216
|
+
const size = (_g = sizesKnown.get(id)) != null ? _g : getItemSize(state, id, i, data[i], useAverageSize, averageSize);
|
|
1735
1217
|
if (__DEV__ && needsIndexByKey) {
|
|
1736
1218
|
if (indexByKeyForChecking.has(id)) {
|
|
1737
1219
|
console.error(
|
|
@@ -2094,6 +1576,44 @@ function comparatorByDistance(a, b) {
|
|
|
2094
1576
|
return b.distance - a.distance;
|
|
2095
1577
|
}
|
|
2096
1578
|
|
|
1579
|
+
// src/utils/getScrollVelocity.ts
|
|
1580
|
+
var getScrollVelocity = (state) => {
|
|
1581
|
+
const { scrollHistory } = state;
|
|
1582
|
+
let velocity = 0;
|
|
1583
|
+
if (scrollHistory.length >= 1) {
|
|
1584
|
+
const newest = scrollHistory[scrollHistory.length - 1];
|
|
1585
|
+
let oldest;
|
|
1586
|
+
let start = 0;
|
|
1587
|
+
const now = Date.now();
|
|
1588
|
+
for (let i = 0; i < scrollHistory.length - 1; i++) {
|
|
1589
|
+
const entry = scrollHistory[i];
|
|
1590
|
+
const nextEntry = scrollHistory[i + 1];
|
|
1591
|
+
if (i > 0) {
|
|
1592
|
+
const prevEntry = scrollHistory[i - 1];
|
|
1593
|
+
const prevDirection = entry.scroll - prevEntry.scroll;
|
|
1594
|
+
const currentDirection = nextEntry.scroll - entry.scroll;
|
|
1595
|
+
if (prevDirection > 0 && currentDirection < 0 || prevDirection < 0 && currentDirection > 0) {
|
|
1596
|
+
start = i;
|
|
1597
|
+
break;
|
|
1598
|
+
}
|
|
1599
|
+
}
|
|
1600
|
+
}
|
|
1601
|
+
for (let i = start; i < scrollHistory.length - 1; i++) {
|
|
1602
|
+
const entry = scrollHistory[i];
|
|
1603
|
+
if (now - entry.time <= 1e3) {
|
|
1604
|
+
oldest = entry;
|
|
1605
|
+
break;
|
|
1606
|
+
}
|
|
1607
|
+
}
|
|
1608
|
+
if (oldest && oldest !== newest) {
|
|
1609
|
+
const scrollDiff = newest.scroll - oldest.scroll;
|
|
1610
|
+
const timeDiff = newest.time - oldest.time;
|
|
1611
|
+
velocity = timeDiff > 0 ? scrollDiff / timeDiff : 0;
|
|
1612
|
+
}
|
|
1613
|
+
}
|
|
1614
|
+
return velocity;
|
|
1615
|
+
};
|
|
1616
|
+
|
|
2097
1617
|
// src/core/scrollToIndex.ts
|
|
2098
1618
|
function scrollToIndex(ctx, state, { index, viewOffset = 0, animated = true, viewPosition }) {
|
|
2099
1619
|
if (index >= state.props.data.length) {
|
|
@@ -2204,9 +1724,6 @@ function setDidLayout(ctx, state) {
|
|
|
2204
1724
|
}
|
|
2205
1725
|
}
|
|
2206
1726
|
|
|
2207
|
-
// src/platform/BatchedUpdates.ts
|
|
2208
|
-
var import_react_dom = __toESM(require_react_dom());
|
|
2209
|
-
|
|
2210
1727
|
// src/core/calculateItemsInView.ts
|
|
2211
1728
|
function findCurrentStickyIndex(stickyArray, scroll, state) {
|
|
2212
1729
|
var _a;
|
|
@@ -2271,7 +1788,7 @@ function handleStickyRecycling(ctx, state, stickyArray, scroll, scrollBuffer, pe
|
|
|
2271
1788
|
}
|
|
2272
1789
|
}
|
|
2273
1790
|
function calculateItemsInView(ctx, state, params = {}) {
|
|
2274
|
-
|
|
1791
|
+
unstable_batchedUpdates(() => {
|
|
2275
1792
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
2276
1793
|
const {
|
|
2277
1794
|
columns,
|
|
@@ -2308,7 +1825,11 @@ function calculateItemsInView(ctx, state, params = {}) {
|
|
|
2308
1825
|
idCache.clear();
|
|
2309
1826
|
positions.clear();
|
|
2310
1827
|
}
|
|
2311
|
-
|
|
1828
|
+
const startIndex = dataChanged ? 0 : minIndexSizeChanged != null ? minIndexSizeChanged : 0;
|
|
1829
|
+
updateAllPositions(ctx, state, dataChanged, startIndex);
|
|
1830
|
+
if (minIndexSizeChanged !== void 0) {
|
|
1831
|
+
state.minIndexSizeChanged = void 0;
|
|
1832
|
+
}
|
|
2312
1833
|
checkMVCP == null ? void 0 : checkMVCP();
|
|
2313
1834
|
}
|
|
2314
1835
|
const scrollExtra = 0;
|
|
@@ -2355,10 +1876,6 @@ function calculateItemsInView(ctx, state, params = {}) {
|
|
|
2355
1876
|
let endNoBuffer = null;
|
|
2356
1877
|
let endBuffered = null;
|
|
2357
1878
|
let loopStart = startBufferedIdOrig ? indexByKey.get(startBufferedIdOrig) || 0 : 0;
|
|
2358
|
-
if (minIndexSizeChanged !== void 0) {
|
|
2359
|
-
loopStart = Math.min(minIndexSizeChanged, loopStart);
|
|
2360
|
-
state.minIndexSizeChanged = void 0;
|
|
2361
|
-
}
|
|
2362
1879
|
for (let i = loopStart; i >= 0; i--) {
|
|
2363
1880
|
const id = (_a = idCache.get(i)) != null ? _a : getId(state, i);
|
|
2364
1881
|
const top = positions.get(id);
|
|
@@ -2728,7 +2245,8 @@ function updateScroll(ctx, state, newScroll) {
|
|
|
2728
2245
|
state.lastBatchingAction = Date.now();
|
|
2729
2246
|
const currentTime = Date.now();
|
|
2730
2247
|
if (scrollingTo === void 0 && !(state.scrollHistory.length === 0 && newScroll === state.scroll)) {
|
|
2731
|
-
state.
|
|
2248
|
+
const adjust = state.scrollAdjustHandler.getAdjust();
|
|
2249
|
+
state.scrollHistory.push({ scroll: newScroll - adjust, time: currentTime });
|
|
2732
2250
|
}
|
|
2733
2251
|
if (state.scrollHistory.length > 5) {
|
|
2734
2252
|
state.scrollHistory.shift();
|
|
@@ -2764,13 +2282,19 @@ var ScrollAdjustHandler = class {
|
|
|
2764
2282
|
setMounted() {
|
|
2765
2283
|
this.mounted = true;
|
|
2766
2284
|
}
|
|
2285
|
+
getAdjust() {
|
|
2286
|
+
return this.appliedAdjust;
|
|
2287
|
+
}
|
|
2767
2288
|
};
|
|
2768
2289
|
|
|
2769
2290
|
// src/core/updateItemSize.ts
|
|
2770
|
-
function
|
|
2771
|
-
var _a;
|
|
2291
|
+
function updateItemSize(ctx, state, itemKey, sizeObj) {
|
|
2292
|
+
var _a, _b;
|
|
2772
2293
|
const {
|
|
2294
|
+
sizesKnown,
|
|
2773
2295
|
props: {
|
|
2296
|
+
getFixedItemSize,
|
|
2297
|
+
getItemType,
|
|
2774
2298
|
horizontal,
|
|
2775
2299
|
maintainVisibleContentPosition,
|
|
2776
2300
|
suggestEstimatedItemSize,
|
|
@@ -2780,47 +2304,60 @@ function updateItemSizes(ctx, state, itemUpdates) {
|
|
|
2780
2304
|
}
|
|
2781
2305
|
} = state;
|
|
2782
2306
|
if (!data) return;
|
|
2307
|
+
if (getFixedItemSize) {
|
|
2308
|
+
const index2 = state.indexByKey.get(itemKey);
|
|
2309
|
+
if (index2 === void 0) {
|
|
2310
|
+
return;
|
|
2311
|
+
}
|
|
2312
|
+
const itemData = state.props.data[index2];
|
|
2313
|
+
if (itemData === void 0) {
|
|
2314
|
+
return;
|
|
2315
|
+
}
|
|
2316
|
+
const type = getItemType ? (_a = getItemType(itemData, index2)) != null ? _a : "" : "";
|
|
2317
|
+
const size2 = getFixedItemSize(index2, itemData, type);
|
|
2318
|
+
if (size2 !== void 0 && size2 === sizesKnown.get(itemKey)) {
|
|
2319
|
+
return;
|
|
2320
|
+
}
|
|
2321
|
+
}
|
|
2783
2322
|
const containersDidLayout = peek$(ctx, "containersDidLayout");
|
|
2784
2323
|
let needsRecalculate = !containersDidLayout;
|
|
2785
2324
|
let shouldMaintainScrollAtEnd = false;
|
|
2786
2325
|
let minIndexSizeChanged;
|
|
2787
2326
|
let maxOtherAxisSize = peek$(ctx, "otherAxisSize") || 0;
|
|
2788
|
-
|
|
2789
|
-
|
|
2790
|
-
|
|
2791
|
-
|
|
2792
|
-
|
|
2793
|
-
|
|
2794
|
-
|
|
2795
|
-
|
|
2796
|
-
|
|
2797
|
-
|
|
2798
|
-
|
|
2799
|
-
|
|
2800
|
-
|
|
2801
|
-
|
|
2802
|
-
|
|
2803
|
-
|
|
2804
|
-
|
|
2805
|
-
break;
|
|
2806
|
-
}
|
|
2327
|
+
const index = state.indexByKey.get(itemKey);
|
|
2328
|
+
const prevSizeKnown = state.sizesKnown.get(itemKey);
|
|
2329
|
+
const diff = updateOneItemSize(state, itemKey, sizeObj);
|
|
2330
|
+
const size = Math.floor((horizontal ? sizeObj.width : sizeObj.height) * 8) / 8;
|
|
2331
|
+
if (diff !== 0) {
|
|
2332
|
+
minIndexSizeChanged = minIndexSizeChanged !== void 0 ? Math.min(minIndexSizeChanged, index) : index;
|
|
2333
|
+
if (((_b = state.scrollingTo) == null ? void 0 : _b.viewPosition) && maintainVisibleContentPosition && index === state.scrollingTo.index && diff > 0) {
|
|
2334
|
+
requestAdjust(ctx, state, diff * state.scrollingTo.viewPosition);
|
|
2335
|
+
}
|
|
2336
|
+
const { startBuffered, endBuffered } = state;
|
|
2337
|
+
needsRecalculate || (needsRecalculate = index >= startBuffered && index <= endBuffered);
|
|
2338
|
+
if (!needsRecalculate) {
|
|
2339
|
+
const numContainers = ctx.values.get("numContainers");
|
|
2340
|
+
for (let i = 0; i < numContainers; i++) {
|
|
2341
|
+
if (peek$(ctx, `containerItemKey${i}`) === itemKey) {
|
|
2342
|
+
needsRecalculate = true;
|
|
2343
|
+
break;
|
|
2807
2344
|
}
|
|
2808
2345
|
}
|
|
2809
|
-
if (state.needsOtherAxisSize) {
|
|
2810
|
-
const otherAxisSize = horizontal ? sizeObj.height : sizeObj.width;
|
|
2811
|
-
maxOtherAxisSize = Math.max(maxOtherAxisSize, otherAxisSize);
|
|
2812
|
-
}
|
|
2813
|
-
if (prevSizeKnown !== void 0 && Math.abs(prevSizeKnown - size) > 5) {
|
|
2814
|
-
shouldMaintainScrollAtEnd = true;
|
|
2815
|
-
}
|
|
2816
|
-
onItemSizeChanged == null ? void 0 : onItemSizeChanged({
|
|
2817
|
-
index,
|
|
2818
|
-
itemData: state.props.data[index],
|
|
2819
|
-
itemKey,
|
|
2820
|
-
previous: size - diff,
|
|
2821
|
-
size
|
|
2822
|
-
});
|
|
2823
2346
|
}
|
|
2347
|
+
if (state.needsOtherAxisSize) {
|
|
2348
|
+
const otherAxisSize = horizontal ? sizeObj.height : sizeObj.width;
|
|
2349
|
+
maxOtherAxisSize = Math.max(maxOtherAxisSize, otherAxisSize);
|
|
2350
|
+
}
|
|
2351
|
+
if (prevSizeKnown !== void 0 && Math.abs(prevSizeKnown - size) > 5) {
|
|
2352
|
+
shouldMaintainScrollAtEnd = true;
|
|
2353
|
+
}
|
|
2354
|
+
onItemSizeChanged == null ? void 0 : onItemSizeChanged({
|
|
2355
|
+
index,
|
|
2356
|
+
itemData: state.props.data[index],
|
|
2357
|
+
itemKey,
|
|
2358
|
+
previous: size - diff,
|
|
2359
|
+
size
|
|
2360
|
+
});
|
|
2824
2361
|
}
|
|
2825
2362
|
if (minIndexSizeChanged !== void 0) {
|
|
2826
2363
|
state.minIndexSizeChanged = state.minIndexSizeChanged !== void 0 ? Math.min(state.minIndexSizeChanged, minIndexSizeChanged) : minIndexSizeChanged;
|
|
@@ -2853,45 +2390,6 @@ function updateItemSizes(ctx, state, itemUpdates) {
|
|
|
2853
2390
|
}
|
|
2854
2391
|
}
|
|
2855
2392
|
}
|
|
2856
|
-
function updateItemSize(ctx, state, itemKey, sizeObj) {
|
|
2857
|
-
var _a;
|
|
2858
|
-
const {
|
|
2859
|
-
queuedItemSizeUpdates,
|
|
2860
|
-
queuedItemSizeUpdatesWaiting,
|
|
2861
|
-
sizesKnown,
|
|
2862
|
-
props: { getFixedItemSize, getItemType }
|
|
2863
|
-
} = state;
|
|
2864
|
-
if (getFixedItemSize) {
|
|
2865
|
-
const index = state.indexByKey.get(itemKey);
|
|
2866
|
-
if (index === void 0) {
|
|
2867
|
-
return;
|
|
2868
|
-
}
|
|
2869
|
-
const itemData = state.props.data[index];
|
|
2870
|
-
if (itemData === void 0) {
|
|
2871
|
-
return;
|
|
2872
|
-
}
|
|
2873
|
-
const type = getItemType ? (_a = getItemType(itemData, index)) != null ? _a : "" : "";
|
|
2874
|
-
const size = getFixedItemSize(index, itemData, type);
|
|
2875
|
-
if (size !== void 0 && size === sizesKnown.get(itemKey)) {
|
|
2876
|
-
return;
|
|
2877
|
-
}
|
|
2878
|
-
}
|
|
2879
|
-
const containersDidLayout = peek$(ctx, "containersDidLayout");
|
|
2880
|
-
const speed = getScrollVelocity(state);
|
|
2881
|
-
if (!containersDidLayout || !queuedItemSizeUpdatesWaiting || Math.abs(speed) < 1) {
|
|
2882
|
-
updateItemSizes(ctx, state, [{ itemKey, sizeObj }]);
|
|
2883
|
-
if (containersDidLayout) {
|
|
2884
|
-
state.queuedItemSizeUpdatesWaiting = true;
|
|
2885
|
-
requestAnimationFrame(() => {
|
|
2886
|
-
state.queuedItemSizeUpdatesWaiting = false;
|
|
2887
|
-
updateItemSizes(ctx, state, queuedItemSizeUpdates);
|
|
2888
|
-
queuedItemSizeUpdates.length = 0;
|
|
2889
|
-
});
|
|
2890
|
-
}
|
|
2891
|
-
} else {
|
|
2892
|
-
queuedItemSizeUpdates.push({ itemKey, sizeObj });
|
|
2893
|
-
}
|
|
2894
|
-
}
|
|
2895
2393
|
function updateOneItemSize(state, itemKey, sizeObj) {
|
|
2896
2394
|
var _a;
|
|
2897
2395
|
const {
|
|
@@ -2979,11 +2477,9 @@ function getRenderedItem(ctx, state, key) {
|
|
|
2979
2477
|
}
|
|
2980
2478
|
|
|
2981
2479
|
// src/utils/throttledOnScroll.ts
|
|
2982
|
-
function
|
|
2480
|
+
function useThrottledOnScroll(originalHandler, scrollEventThrottle) {
|
|
2983
2481
|
const throttle = useThrottleDebounce("throttle");
|
|
2984
|
-
return (event) => {
|
|
2985
|
-
throttle(originalHandler, scrollEventThrottle, event);
|
|
2986
|
-
};
|
|
2482
|
+
return (event) => throttle(originalHandler, scrollEventThrottle, { nativeEvent: event.nativeEvent });
|
|
2987
2483
|
}
|
|
2988
2484
|
|
|
2989
2485
|
// src/utils/updateAveragesOnDataChange.ts
|
|
@@ -3065,6 +2561,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
3065
2561
|
contentContainerStyle: contentContainerStyleProp,
|
|
3066
2562
|
data: dataProp = [],
|
|
3067
2563
|
drawDistance = 250,
|
|
2564
|
+
enableAverages = true,
|
|
3068
2565
|
estimatedItemSize: estimatedItemSizeProp,
|
|
3069
2566
|
estimatedListSize,
|
|
3070
2567
|
extraData,
|
|
@@ -3151,11 +2648,9 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
3151
2648
|
loadStartTime: Date.now(),
|
|
3152
2649
|
minIndexSizeChanged: 0,
|
|
3153
2650
|
nativeMarginTop: 0,
|
|
3154
|
-
pendingAdjust: 0,
|
|
3155
2651
|
positions: /* @__PURE__ */ new Map(),
|
|
3156
2652
|
props: {},
|
|
3157
2653
|
queuedCalculateItemsInView: 0,
|
|
3158
|
-
queuedItemSizeUpdates: [],
|
|
3159
2654
|
refScroller: void 0,
|
|
3160
2655
|
scroll: 0,
|
|
3161
2656
|
scrollAdjustHandler: new ScrollAdjustHandler(ctx),
|
|
@@ -3185,9 +2680,11 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
3185
2680
|
const state = refState.current;
|
|
3186
2681
|
const isFirst = !state.props.renderItem;
|
|
3187
2682
|
const didDataChange = state.props.data !== dataProp;
|
|
2683
|
+
const throttleScrollFn = scrollEventThrottle && onScrollProp ? useThrottledOnScroll(onScrollProp, scrollEventThrottle) : onScrollProp;
|
|
3188
2684
|
state.props = {
|
|
3189
2685
|
alignItemsAtEnd,
|
|
3190
2686
|
data: dataProp,
|
|
2687
|
+
enableAverages,
|
|
3191
2688
|
estimatedItemSize,
|
|
3192
2689
|
getEstimatedItemSize,
|
|
3193
2690
|
getFixedItemSize,
|
|
@@ -3205,7 +2702,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
3205
2702
|
onEndReachedThreshold,
|
|
3206
2703
|
onItemSizeChanged,
|
|
3207
2704
|
onLoad,
|
|
3208
|
-
onScroll:
|
|
2705
|
+
onScroll: throttleScrollFn,
|
|
3209
2706
|
onStartReached,
|
|
3210
2707
|
onStartReachedThreshold,
|
|
3211
2708
|
recycleItems: !!recycleItems,
|
|
@@ -3463,8 +2960,8 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
3463
2960
|
}),
|
|
3464
2961
|
[]
|
|
3465
2962
|
);
|
|
3466
|
-
const
|
|
3467
|
-
const onScrollFn =
|
|
2963
|
+
const onScrollHandler = useMemo(() => {
|
|
2964
|
+
const onScrollFn = fns.onScroll;
|
|
3468
2965
|
if (stickyIndices == null ? void 0 : stickyIndices.length) {
|
|
3469
2966
|
const { animatedScrollY } = ctx;
|
|
3470
2967
|
return Animated.event([{ nativeEvent: { contentOffset: { [horizontal ? "x" : "y"]: animatedScrollY } } }], {
|
|
@@ -3503,7 +3000,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
3503
3000
|
onMomentumScrollEnd(event);
|
|
3504
3001
|
}
|
|
3505
3002
|
},
|
|
3506
|
-
onScroll:
|
|
3003
|
+
onScroll: onScrollHandler,
|
|
3507
3004
|
recycleItems,
|
|
3508
3005
|
refreshControl: refreshControl ? stylePaddingTopState > 0 ? React3.cloneElement(refreshControl, {
|
|
3509
3006
|
progressViewOffset: (refreshControl.props.progressViewOffset || 0) + stylePaddingTopState
|
|
@@ -3526,29 +3023,5 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
3526
3023
|
}
|
|
3527
3024
|
), __DEV__ && ENABLE_DEBUG_VIEW && /* @__PURE__ */ React3.createElement(DebugView, { state: refState.current }));
|
|
3528
3025
|
});
|
|
3529
|
-
/*! Bundled license information:
|
|
3530
|
-
|
|
3531
|
-
react-dom/cjs/react-dom.production.js:
|
|
3532
|
-
(**
|
|
3533
|
-
* @license React
|
|
3534
|
-
* react-dom.production.js
|
|
3535
|
-
*
|
|
3536
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3537
|
-
*
|
|
3538
|
-
* This source code is licensed under the MIT license found in the
|
|
3539
|
-
* LICENSE file in the root directory of this source tree.
|
|
3540
|
-
*)
|
|
3541
|
-
|
|
3542
|
-
react-dom/cjs/react-dom.development.js:
|
|
3543
|
-
(**
|
|
3544
|
-
* @license React
|
|
3545
|
-
* react-dom.development.js
|
|
3546
|
-
*
|
|
3547
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3548
|
-
*
|
|
3549
|
-
* This source code is licensed under the MIT license found in the
|
|
3550
|
-
* LICENSE file in the root directory of this source tree.
|
|
3551
|
-
*)
|
|
3552
|
-
*/
|
|
3553
3026
|
|
|
3554
3027
|
export { LegendList, useIsLastItem, useListScrollSize, useRecyclingEffect, useRecyclingState, useSyncLayout, useViewability, useViewabilityAmount };
|