@powerhousedao/connect 1.0.28-dev.1 → 1.0.28-staging.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{app-BDw8v6b_.css → app-Di6g_N6F.css} +97 -79
- package/dist/assets/{app-QOwargCw.js → app-fD71bJN5.js} +4821 -4136
- package/dist/assets/app-fD71bJN5.js.map +1 -0
- package/dist/assets/{app-loader-BBORG2Po.js → app-loader-BgVDAZzK.js} +831 -440
- package/dist/assets/app-loader-BgVDAZzK.js.map +1 -0
- package/dist/assets/{app-loader-CDW9U8zV.css → app-loader-b43YtazY.css} +22 -15
- package/dist/assets/{browser-lv7NZkGB.js → browser-BfKVilMY.js} +35 -45
- package/dist/assets/browser-BfKVilMY.js.map +1 -0
- package/dist/assets/{ccip-B1kfW0w7.js → ccip-DqNp5gVF.js} +4 -4
- package/dist/assets/ccip-DqNp5gVF.js.map +1 -0
- package/dist/assets/{content-DQPT3GJr.js → content-BnihK9ko.js} +69 -115
- package/dist/assets/content-BnihK9ko.js.map +1 -0
- package/dist/assets/{index-DMUsfibB.js → index-Bfinzr42.js} +4 -4
- package/dist/assets/{index-DMUsfibB.js.map → index-Bfinzr42.js.map} +1 -1
- package/dist/assets/{index-URwYidL1.js → index-Cteg8MEt.js} +4 -4
- package/dist/assets/index-Cteg8MEt.js.map +1 -0
- package/dist/assets/{index-DIYYguTp.js → index-D8ml-kF6.js} +3463 -61
- package/dist/assets/index-D8ml-kF6.js.map +1 -0
- package/dist/assets/{index-Bg8OsiIv.js → index-W1LZgOxg.js} +5 -5
- package/dist/assets/{index-Bg8OsiIv.js.map → index-W1LZgOxg.js.map} +1 -1
- package/dist/assets/{main.Dk-PL5ss.js → main.CU15VE0F.js} +2 -2
- package/dist/assets/{main.Dk-PL5ss.js.map → main.CU15VE0F.js.map} +1 -1
- package/dist/assets/{reactor-analytics-E2iziUB6.js → reactor-analytics-C1DnbKP-.js} +6 -6
- package/dist/assets/{reactor-analytics-E2iziUB6.js.map → reactor-analytics-C1DnbKP-.js.map} +1 -1
- package/dist/assets/{router-B8sa3ulC.js → router-D6f-fo9X.js} +8 -8
- package/dist/assets/{router-B8sa3ulC.js.map → router-D6f-fo9X.js.map} +1 -1
- package/dist/assets/{style-C0GVbPTL.css → style-CK8AY-7U.css} +12 -16
- package/dist/index.html +1 -1
- package/dist/vite-envs.sh +1 -1
- package/package.json +9 -9
- package/dist/assets/app-QOwargCw.js.map +0 -1
- package/dist/assets/app-loader-BBORG2Po.js.map +0 -1
- package/dist/assets/browser-lv7NZkGB.js.map +0 -1
- package/dist/assets/ccip-B1kfW0w7.js.map +0 -1
- package/dist/assets/content-DQPT3GJr.js.map +0 -1
- package/dist/assets/index-DIYYguTp.js.map +0 -1
- package/dist/assets/index-URwYidL1.js.map +0 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "./main.
|
|
1
|
+
import { aM as BaseError, aN as getUrl, aO as stringify, aP as decodeErrorResult, aQ as isAddressEqual, aR as localBatchGatewayUrl, aS as localBatchGatewayRequest, aT as call, aU as concat, aV as encodeAbiParameters, aW as HttpRequestError, aX as isHex } from "./app-fD71bJN5.js";
|
|
2
|
+
import "./main.CU15VE0F.js";
|
|
3
3
|
import "react/jsx-runtime";
|
|
4
4
|
import "react";
|
|
5
|
-
import "./app-loader-
|
|
5
|
+
import "./app-loader-BgVDAZzK.js";
|
|
6
6
|
import "react-dom";
|
|
7
7
|
class OffchainLookupError extends BaseError {
|
|
8
8
|
constructor({ callbackSelector, cause, data, extraData, sender, urls }) {
|
|
@@ -165,4 +165,4 @@ export {
|
|
|
165
165
|
offchainLookupAbiItem,
|
|
166
166
|
offchainLookupSignature
|
|
167
167
|
};
|
|
168
|
-
//# sourceMappingURL=ccip-
|
|
168
|
+
//# sourceMappingURL=ccip-DqNp5gVF.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ccip-DqNp5gVF.js","sources":["../../../../node_modules/.pnpm/viem@2.29.0_bufferutil@4.0.9_typescript@5.7.3_utf-8-validate@5.0.10_zod@3.24.4/node_modules/viem/_esm/errors/ccip.js","../../../../node_modules/.pnpm/viem@2.29.0_bufferutil@4.0.9_typescript@5.7.3_utf-8-validate@5.0.10_zod@3.24.4/node_modules/viem/_esm/utils/ccip.js"],"sourcesContent":["import { stringify } from '../utils/stringify.js';\nimport { BaseError } from './base.js';\nimport { getUrl } from './utils.js';\nexport class OffchainLookupError extends BaseError {\n constructor({ callbackSelector, cause, data, extraData, sender, urls, }) {\n super(cause.shortMessage ||\n 'An error occurred while fetching for an offchain result.', {\n cause,\n metaMessages: [\n ...(cause.metaMessages || []),\n cause.metaMessages?.length ? '' : [],\n 'Offchain Gateway Call:',\n urls && [\n ' Gateway URL(s):',\n ...urls.map((url) => ` ${getUrl(url)}`),\n ],\n ` Sender: ${sender}`,\n ` Data: ${data}`,\n ` Callback selector: ${callbackSelector}`,\n ` Extra data: ${extraData}`,\n ].flat(),\n name: 'OffchainLookupError',\n });\n }\n}\nexport class OffchainLookupResponseMalformedError extends BaseError {\n constructor({ result, url }) {\n super('Offchain gateway response is malformed. Response data must be a hex value.', {\n metaMessages: [\n `Gateway URL: ${getUrl(url)}`,\n `Response: ${stringify(result)}`,\n ],\n name: 'OffchainLookupResponseMalformedError',\n });\n }\n}\nexport class OffchainLookupSenderMismatchError extends BaseError {\n constructor({ sender, to }) {\n super('Reverted sender address does not match target contract address (`to`).', {\n metaMessages: [\n `Contract address: ${to}`,\n `OffchainLookup sender address: ${sender}`,\n ],\n name: 'OffchainLookupSenderMismatchError',\n });\n }\n}\n//# sourceMappingURL=ccip.js.map","import { call } from '../actions/public/call.js';\nimport { OffchainLookupError, OffchainLookupResponseMalformedError, OffchainLookupSenderMismatchError, } from '../errors/ccip.js';\nimport { HttpRequestError, } from '../errors/request.js';\nimport { decodeErrorResult } from './abi/decodeErrorResult.js';\nimport { encodeAbiParameters } from './abi/encodeAbiParameters.js';\nimport { isAddressEqual } from './address/isAddressEqual.js';\nimport { concat } from './data/concat.js';\nimport { isHex } from './data/isHex.js';\nimport { localBatchGatewayRequest, localBatchGatewayUrl, } from './ens/localBatchGatewayRequest.js';\nimport { stringify } from './stringify.js';\nexport const offchainLookupSignature = '0x556f1830';\nexport const offchainLookupAbiItem = {\n name: 'OffchainLookup',\n type: 'error',\n inputs: [\n {\n name: 'sender',\n type: 'address',\n },\n {\n name: 'urls',\n type: 'string[]',\n },\n {\n name: 'callData',\n type: 'bytes',\n },\n {\n name: 'callbackFunction',\n type: 'bytes4',\n },\n {\n name: 'extraData',\n type: 'bytes',\n },\n ],\n};\nexport async function offchainLookup(client, { blockNumber, blockTag, data, to, }) {\n const { args } = decodeErrorResult({\n data,\n abi: [offchainLookupAbiItem],\n });\n const [sender, urls, callData, callbackSelector, extraData] = args;\n const { ccipRead } = client;\n const ccipRequest_ = ccipRead && typeof ccipRead?.request === 'function'\n ? ccipRead.request\n : ccipRequest;\n try {\n if (!isAddressEqual(to, sender))\n throw new OffchainLookupSenderMismatchError({ sender, to });\n const result = urls.includes(localBatchGatewayUrl)\n ? await localBatchGatewayRequest({\n data: callData,\n ccipRequest: ccipRequest_,\n })\n : await ccipRequest_({ data: callData, sender, urls });\n const { data: data_ } = await call(client, {\n blockNumber,\n blockTag,\n data: concat([\n callbackSelector,\n encodeAbiParameters([{ type: 'bytes' }, { type: 'bytes' }], [result, extraData]),\n ]),\n to,\n });\n return data_;\n }\n catch (err) {\n throw new OffchainLookupError({\n callbackSelector,\n cause: err,\n data,\n extraData,\n sender,\n urls,\n });\n }\n}\nexport async function ccipRequest({ data, sender, urls, }) {\n let error = new Error('An unknown error occurred.');\n for (let i = 0; i < urls.length; i++) {\n const url = urls[i];\n const method = url.includes('{data}') ? 'GET' : 'POST';\n const body = method === 'POST' ? { data, sender } : undefined;\n const headers = method === 'POST' ? { 'Content-Type': 'application/json' } : {};\n try {\n const response = await fetch(url.replace('{sender}', sender.toLowerCase()).replace('{data}', data), {\n body: JSON.stringify(body),\n headers,\n method,\n });\n let result;\n if (response.headers.get('Content-Type')?.startsWith('application/json')) {\n result = (await response.json()).data;\n }\n else {\n result = (await response.text());\n }\n if (!response.ok) {\n error = new HttpRequestError({\n body,\n details: result?.error\n ? stringify(result.error)\n : response.statusText,\n headers: response.headers,\n status: response.status,\n url,\n });\n continue;\n }\n if (!isHex(result)) {\n error = new OffchainLookupResponseMalformedError({\n result,\n url,\n });\n continue;\n }\n return result;\n }\n catch (err) {\n error = new HttpRequestError({\n body,\n details: err.message,\n url,\n });\n }\n }\n throw error;\n}\n//# sourceMappingURL=ccip.js.map"],"names":[],"mappings":";;;;;;AAGO,MAAM,4BAA4B,UAAU;AAAA,EAC/C,YAAY,EAAE,kBAAkB,OAAO,MAAM,WAAW,QAAQ,QAAS;;AACrE,UAAM,MAAM,gBACR,4DAA4D;AAAA,MAC5D;AAAA,MACA,cAAc;AAAA,QACV,GAAI,MAAM,gBAAgB;UAC1B,WAAM,iBAAN,mBAAoB,UAAS,KAAK,CAAE;AAAA,QACpC;AAAA,QACA,QAAQ;AAAA,UACJ;AAAA,UACA,GAAG,KAAK,IAAI,CAAC,QAAQ,OAAO,OAAO,GAAG,CAAC,EAAE;AAAA,QAC5C;AAAA,QACD,aAAa,MAAM;AAAA,QACnB,WAAW,IAAI;AAAA,QACf,wBAAwB,gBAAgB;AAAA,QACxC,iBAAiB,SAAS;AAAA,MAC7B,EAAC,KAAM;AAAA,MACR,MAAM;AAAA,IAClB,CAAS;AAAA,EACT;AACA;AACO,MAAM,6CAA6C,UAAU;AAAA,EAChE,YAAY,EAAE,QAAQ,OAAO;AACzB,UAAM,8EAA8E;AAAA,MAChF,cAAc;AAAA,QACV,gBAAgB,OAAO,GAAG,CAAC;AAAA,QAC3B,aAAa,UAAU,MAAM,CAAC;AAAA,MACjC;AAAA,MACD,MAAM;AAAA,IAClB,CAAS;AAAA,EACT;AACA;AACO,MAAM,0CAA0C,UAAU;AAAA,EAC7D,YAAY,E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MAChB;AACY,UAAI,CAAC,MAAM,MAAM,GAAG;AAChB,gBAAQ,IAAI,qCAAqC;AAAA,UAC7C;AAAA,UACA;AAAA,QACpB,CAAiB;AACD;AAAA,MAChB;AACY,aAAO;AAAA,IACnB,SACe,KAAK;AACR,cAAQ,IAAI,iBAAiB;AAAA,QACzB;AAAA,QACA,SAAS,IAAI;AAAA,QACb;AAAA,MAChB,CAAa;AAAA,IACb;AAAA,EACA;AACI,QAAM;AACV;","x_google_ignoreList":[0,1]}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment as Fragment$1 } from "react/jsx-runtime";
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import React__default, { useState, useCallback, useMemo, useEffect, Fragment, useRef, useLayoutEffect, memo as memo$1, createElement, useSyncExternalStore, Suspense } from "react";
|
|
4
|
-
import { t as twMerge, B as Button,
|
|
5
|
-
import { ab as buildSignedOperation, am as generateId$1, aw as isFolderNode, aA as generateNodesCopy, aB as copyNode, az as moveNode, ay as updateNode, ax as deleteNode, ar as generateAddNodeAction, as as isFileNode, av as addFolder,
|
|
6
|
-
import { E as ENSAvatar, a as ErrorBoundary, t as toast } from "./router-
|
|
4
|
+
import { t as twMerge, B as Button, aY as mergeClassNameProps, I as Icon, aZ as getDimensions, a_ as useDocumentDrives, h as useUiNodesContext, a$ as useDriveContext, b0 as FILE, G as ERROR, b1 as MISSING, C as CONFLICT, S as SUCCESS, b2 as SYNCING, b3 as INITIAL_SYNC, b4 as READ, b5 as nodeOptionsMap, b6 as defaultFileOptions, b7 as ConnectDropdownMenu, b8 as DELETE, b9 as RENAME, ba as WRITE, bb as DUPLICATE, bc as defaultFolderOptions, bd as useOnClickOutside, be as useEventListener, bf as useCopyToClipboard, bg as Select, bh as Provider, bi as Root3, bj as Trigger, bk as Portal, bl as Content2, bm as UI_NODE, D as DRIVE, F as FILE$1, bn as validateInitialState, bo as validateStateSchemaName, bp as validateModules, e as useDocumentDriveServer, K as useUnwrappedReactor, bq as useConnectDid, br as useConnectCrypto, w as useTranslation, f as useModal, bs as useAtomValue, bt as themeAtom, bu as useUser, bv as useUserPermissions$1, bw as useFileNodeDocument, bx as useGetDocumentModelModule, by as exportFile, bz as addActionContext$1, bA as signOperation$1, bB as useHotkeys, bC as FOLDER, bD as DriveLayout, bE as DriveContextProvider, bF as SearchBar, V as useAnalyticsStore, bG as useQueryClient, u as useQuery, a8 as AnalyticsPath, bH as useAnalyticsEngine, a7 as DateTime, bI as AnalyticsGranularity, bJ as useGetEditor, bK as isSameDocument, v as useNavigate, z as useAsyncReactor, bL as useFilteredDocumentModels, bM as useDriveEditor, J as useParams, x as useDocumentDrives$1 } from "./app-fD71bJN5.js";
|
|
5
|
+
import { ab as buildSignedOperation, am as generateId$1, aw as isFolderNode, aA as generateNodesCopy, aB as copyNode, az as moveNode, ay as updateNode, ax as deleteNode, ar as generateAddNodeAction, as as isFileNode, av as addFolder, bN as garbageCollect, bO as sortOperations, bP as LZString, bQ as undo, bR as redo, _ as logger, bS as openUrl, bT as useDocumentDispatch$1, aj as module, af as connectConfig } from "./app-loader-BgVDAZzK.js";
|
|
6
|
+
import { E as ENSAvatar, a as ErrorBoundary, t as toast } from "./router-D6f-fo9X.js";
|
|
7
7
|
import { flushSync } from "react-dom";
|
|
8
|
-
import "./main.
|
|
8
|
+
import "./main.CU15VE0F.js";
|
|
9
9
|
const PaginationButton = ({ active = false, ...props }) => {
|
|
10
10
|
const className = twMerge("h-8 min-w-8 border border-solid border-gray-300 bg-white px-3 py-1 text-xs text-gray-900 hover:bg-gray-100", !active && "border-0");
|
|
11
11
|
return jsx(Button, { color: "light", size: "small", ...mergeClassNameProps(props, className), children: props.children });
|
|
@@ -2618,7 +2618,7 @@ function Header(props) {
|
|
|
2618
2618
|
function memo(getDeps, fn, opts) {
|
|
2619
2619
|
let deps = opts.initialDeps ?? [];
|
|
2620
2620
|
let result;
|
|
2621
|
-
|
|
2621
|
+
return () => {
|
|
2622
2622
|
var _a, _b, _c, _d;
|
|
2623
2623
|
let depTime;
|
|
2624
2624
|
if (opts.key && ((_a = opts.debug) == null ? void 0 : _a.call(opts))) depTime = Date.now();
|
|
@@ -2656,11 +2656,7 @@ function memo(getDeps, fn, opts) {
|
|
|
2656
2656
|
}
|
|
2657
2657
|
(_d = opts == null ? void 0 : opts.onChange) == null ? void 0 : _d.call(opts, result);
|
|
2658
2658
|
return result;
|
|
2659
|
-
}
|
|
2660
|
-
memoizedFunction.updateDeps = (newDeps) => {
|
|
2661
|
-
deps = newDeps;
|
|
2662
2659
|
};
|
|
2663
|
-
return memoizedFunction;
|
|
2664
2660
|
}
|
|
2665
2661
|
function notUndefined(value, msg) {
|
|
2666
2662
|
if (value === void 0) {
|
|
@@ -2669,7 +2665,7 @@ function notUndefined(value, msg) {
|
|
|
2669
2665
|
return value;
|
|
2670
2666
|
}
|
|
2671
2667
|
}
|
|
2672
|
-
const approxEqual = (a, b) => Math.abs(a - b)
|
|
2668
|
+
const approxEqual = (a, b) => Math.abs(a - b) < 1;
|
|
2673
2669
|
const debounce = (targetWindow, fn, ms) => {
|
|
2674
2670
|
let timeoutId;
|
|
2675
2671
|
return function(...args) {
|
|
@@ -2677,10 +2673,6 @@ const debounce = (targetWindow, fn, ms) => {
|
|
|
2677
2673
|
timeoutId = targetWindow.setTimeout(() => fn.apply(this, args), ms);
|
|
2678
2674
|
};
|
|
2679
2675
|
};
|
|
2680
|
-
const getRect = (element) => {
|
|
2681
|
-
const { offsetWidth, offsetHeight } = element;
|
|
2682
|
-
return { width: offsetWidth, height: offsetHeight };
|
|
2683
|
-
};
|
|
2684
2676
|
const defaultKeyExtractor = (index) => index;
|
|
2685
2677
|
const defaultRangeExtractor = (range) => {
|
|
2686
2678
|
const start = Math.max(range.startIndex - range.overscan, 0);
|
|
@@ -2704,24 +2696,21 @@ const observeElementRect = (instance, cb) => {
|
|
|
2704
2696
|
const { width, height } = rect;
|
|
2705
2697
|
cb({ width: Math.round(width), height: Math.round(height) });
|
|
2706
2698
|
};
|
|
2707
|
-
handler(
|
|
2699
|
+
handler(element.getBoundingClientRect());
|
|
2708
2700
|
if (!targetWindow.ResizeObserver) {
|
|
2709
2701
|
return () => {
|
|
2710
2702
|
};
|
|
2711
2703
|
}
|
|
2712
2704
|
const observer = new targetWindow.ResizeObserver((entries) => {
|
|
2713
|
-
const
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
|
|
2717
|
-
|
|
2718
|
-
|
|
2719
|
-
return;
|
|
2720
|
-
}
|
|
2705
|
+
const entry = entries[0];
|
|
2706
|
+
if (entry == null ? void 0 : entry.borderBoxSize) {
|
|
2707
|
+
const box = entry.borderBoxSize[0];
|
|
2708
|
+
if (box) {
|
|
2709
|
+
handler({ width: box.inlineSize, height: box.blockSize });
|
|
2710
|
+
return;
|
|
2721
2711
|
}
|
|
2722
|
-
|
|
2723
|
-
|
|
2724
|
-
instance.options.useAnimationFrameWithResizeObserver ? requestAnimationFrame(run) : run();
|
|
2712
|
+
}
|
|
2713
|
+
handler(element.getBoundingClientRect());
|
|
2725
2714
|
});
|
|
2726
2715
|
observer.observe(element, { box: "border-box" });
|
|
2727
2716
|
return () => {
|
|
@@ -2759,15 +2748,10 @@ const observeElementOffset = (instance, cb) => {
|
|
|
2759
2748
|
const endHandler = createHandler(false);
|
|
2760
2749
|
endHandler();
|
|
2761
2750
|
element.addEventListener("scroll", handler, addEventListenerOptions);
|
|
2762
|
-
|
|
2763
|
-
if (registerScrollendEvent) {
|
|
2764
|
-
element.addEventListener("scrollend", endHandler, addEventListenerOptions);
|
|
2765
|
-
}
|
|
2751
|
+
element.addEventListener("scrollend", endHandler, addEventListenerOptions);
|
|
2766
2752
|
return () => {
|
|
2767
2753
|
element.removeEventListener("scroll", handler);
|
|
2768
|
-
|
|
2769
|
-
element.removeEventListener("scrollend", endHandler);
|
|
2770
|
-
}
|
|
2754
|
+
element.removeEventListener("scrollend", endHandler);
|
|
2771
2755
|
};
|
|
2772
2756
|
};
|
|
2773
2757
|
const measureElement = (element, entry, instance) => {
|
|
@@ -2780,7 +2764,9 @@ const measureElement = (element, entry, instance) => {
|
|
|
2780
2764
|
return size;
|
|
2781
2765
|
}
|
|
2782
2766
|
}
|
|
2783
|
-
return
|
|
2767
|
+
return Math.round(
|
|
2768
|
+
element.getBoundingClientRect()[instance.options.horizontal ? "width" : "height"]
|
|
2769
|
+
);
|
|
2784
2770
|
};
|
|
2785
2771
|
const elementScroll = (offset, {
|
|
2786
2772
|
adjustments = 0,
|
|
@@ -2819,10 +2805,7 @@ class Virtualizer {
|
|
|
2819
2805
|
}
|
|
2820
2806
|
return _ro = new this.targetWindow.ResizeObserver((entries) => {
|
|
2821
2807
|
entries.forEach((entry) => {
|
|
2822
|
-
|
|
2823
|
-
this._measureElement(entry.target, entry);
|
|
2824
|
-
};
|
|
2825
|
-
this.options.useAnimationFrameWithResizeObserver ? requestAnimationFrame(run) : run();
|
|
2808
|
+
this._measureElement(entry.target, entry);
|
|
2826
2809
|
});
|
|
2827
2810
|
});
|
|
2828
2811
|
};
|
|
@@ -2870,8 +2853,7 @@ class Virtualizer {
|
|
|
2870
2853
|
isScrollingResetDelay: 150,
|
|
2871
2854
|
enabled: true,
|
|
2872
2855
|
isRtl: false,
|
|
2873
|
-
useScrollendEvent:
|
|
2874
|
-
useAnimationFrameWithResizeObserver: false,
|
|
2856
|
+
useScrollendEvent: true,
|
|
2875
2857
|
...opts2
|
|
2876
2858
|
};
|
|
2877
2859
|
};
|
|
@@ -3060,18 +3042,12 @@ class Virtualizer {
|
|
|
3060
3042
|
}
|
|
3061
3043
|
);
|
|
3062
3044
|
this.calculateRange = memo(
|
|
3063
|
-
() => [
|
|
3064
|
-
|
|
3065
|
-
this.getSize(),
|
|
3066
|
-
this.getScrollOffset(),
|
|
3067
|
-
this.options.lanes
|
|
3068
|
-
],
|
|
3069
|
-
(measurements, outerSize, scrollOffset, lanes) => {
|
|
3045
|
+
() => [this.getMeasurements(), this.getSize(), this.getScrollOffset()],
|
|
3046
|
+
(measurements, outerSize, scrollOffset) => {
|
|
3070
3047
|
return this.range = measurements.length > 0 && outerSize > 0 ? calculateRange({
|
|
3071
3048
|
measurements,
|
|
3072
3049
|
outerSize,
|
|
3073
|
-
scrollOffset
|
|
3074
|
-
lanes
|
|
3050
|
+
scrollOffset
|
|
3075
3051
|
}) : null;
|
|
3076
3052
|
},
|
|
3077
3053
|
{
|
|
@@ -3079,7 +3055,7 @@ class Virtualizer {
|
|
|
3079
3055
|
debug: () => this.options.debug
|
|
3080
3056
|
}
|
|
3081
3057
|
);
|
|
3082
|
-
this.
|
|
3058
|
+
this.getIndexes = memo(
|
|
3083
3059
|
() => {
|
|
3084
3060
|
let startIndex = null;
|
|
3085
3061
|
let endIndex = null;
|
|
@@ -3088,7 +3064,6 @@ class Virtualizer {
|
|
|
3088
3064
|
startIndex = range.startIndex;
|
|
3089
3065
|
endIndex = range.endIndex;
|
|
3090
3066
|
}
|
|
3091
|
-
this.maybeNotify.updateDeps([this.isScrolling, startIndex, endIndex]);
|
|
3092
3067
|
return [
|
|
3093
3068
|
this.options.rangeExtractor,
|
|
3094
3069
|
this.options.overscan,
|
|
@@ -3172,7 +3147,7 @@ class Virtualizer {
|
|
|
3172
3147
|
this._measureElement(node, void 0);
|
|
3173
3148
|
};
|
|
3174
3149
|
this.getVirtualItems = memo(
|
|
3175
|
-
() => [this.
|
|
3150
|
+
() => [this.getIndexes(), this.getMeasurements()],
|
|
3176
3151
|
(indexes, measurements) => {
|
|
3177
3152
|
const virtualItems = [];
|
|
3178
3153
|
for (let k = 0, len = indexes.length; k < len; k++) {
|
|
@@ -3201,18 +3176,20 @@ class Virtualizer {
|
|
|
3201
3176
|
)]
|
|
3202
3177
|
);
|
|
3203
3178
|
};
|
|
3204
|
-
this.getOffsetForAlignment = (toOffset, align
|
|
3179
|
+
this.getOffsetForAlignment = (toOffset, align) => {
|
|
3205
3180
|
const size = this.getSize();
|
|
3206
3181
|
const scrollOffset = this.getScrollOffset();
|
|
3207
3182
|
if (align === "auto") {
|
|
3208
|
-
|
|
3183
|
+
if (toOffset >= scrollOffset + size) {
|
|
3184
|
+
align = "end";
|
|
3185
|
+
}
|
|
3209
3186
|
}
|
|
3210
|
-
if (align === "
|
|
3211
|
-
toOffset += (itemSize - size) / 2;
|
|
3212
|
-
} else if (align === "end") {
|
|
3187
|
+
if (align === "end") {
|
|
3213
3188
|
toOffset -= size;
|
|
3214
3189
|
}
|
|
3215
|
-
const
|
|
3190
|
+
const scrollSizeProp = this.options.horizontal ? "scrollWidth" : "scrollHeight";
|
|
3191
|
+
const scrollSize = this.scrollElement ? "document" in this.scrollElement ? this.scrollElement.document.documentElement[scrollSizeProp] : this.scrollElement[scrollSizeProp] : 0;
|
|
3192
|
+
const maxOffset = scrollSize - size;
|
|
3216
3193
|
return Math.max(Math.min(maxOffset, toOffset), 0);
|
|
3217
3194
|
};
|
|
3218
3195
|
this.getOffsetForIndex = (index, align = "auto") => {
|
|
@@ -3232,11 +3209,27 @@ class Virtualizer {
|
|
|
3232
3209
|
return [scrollOffset, align];
|
|
3233
3210
|
}
|
|
3234
3211
|
}
|
|
3235
|
-
const
|
|
3236
|
-
|
|
3237
|
-
|
|
3238
|
-
|
|
3239
|
-
|
|
3212
|
+
const centerOffset = item.start - this.options.scrollPaddingStart + (item.size - size) / 2;
|
|
3213
|
+
switch (align) {
|
|
3214
|
+
case "center":
|
|
3215
|
+
return [this.getOffsetForAlignment(centerOffset, align), align];
|
|
3216
|
+
case "end":
|
|
3217
|
+
return [
|
|
3218
|
+
this.getOffsetForAlignment(
|
|
3219
|
+
item.end + this.options.scrollPaddingEnd,
|
|
3220
|
+
align
|
|
3221
|
+
),
|
|
3222
|
+
align
|
|
3223
|
+
];
|
|
3224
|
+
default:
|
|
3225
|
+
return [
|
|
3226
|
+
this.getOffsetForAlignment(
|
|
3227
|
+
item.start - this.options.scrollPaddingStart,
|
|
3228
|
+
align
|
|
3229
|
+
),
|
|
3230
|
+
align
|
|
3231
|
+
];
|
|
3232
|
+
}
|
|
3240
3233
|
};
|
|
3241
3234
|
this.isDynamicMode = () => this.elementsCache.size > 0;
|
|
3242
3235
|
this.cancelScrollToIndex = () => {
|
|
@@ -3276,11 +3269,10 @@ class Virtualizer {
|
|
|
3276
3269
|
this.options.getItemKey(index)
|
|
3277
3270
|
);
|
|
3278
3271
|
if (elementInDOM) {
|
|
3279
|
-
const
|
|
3280
|
-
|
|
3281
|
-
|
|
3282
|
-
|
|
3283
|
-
if (!approxEqual(latestOffset, currentScrollOffset)) {
|
|
3272
|
+
const [latestOffset] = notUndefined(
|
|
3273
|
+
this.getOffsetForIndex(index, align)
|
|
3274
|
+
);
|
|
3275
|
+
if (!approxEqual(latestOffset, this.getScrollOffset())) {
|
|
3284
3276
|
this.scrollToIndex(index, { align, behavior });
|
|
3285
3277
|
}
|
|
3286
3278
|
} else {
|
|
@@ -3307,19 +3299,10 @@ class Virtualizer {
|
|
|
3307
3299
|
let end;
|
|
3308
3300
|
if (measurements.length === 0) {
|
|
3309
3301
|
end = this.options.paddingStart;
|
|
3310
|
-
} else if (this.options.lanes === 1) {
|
|
3311
|
-
end = ((_a = measurements[measurements.length - 1]) == null ? void 0 : _a.end) ?? 0;
|
|
3312
3302
|
} else {
|
|
3313
|
-
|
|
3314
|
-
|
|
3315
|
-
|
|
3316
|
-
const item = measurements[endIndex];
|
|
3317
|
-
if (endByLane[item.lane] === null) {
|
|
3318
|
-
endByLane[item.lane] = item.end;
|
|
3319
|
-
}
|
|
3320
|
-
endIndex--;
|
|
3321
|
-
}
|
|
3322
|
-
end = Math.max(...endByLane.filter((val) => val !== null));
|
|
3303
|
+
end = this.options.lanes === 1 ? ((_a = measurements[measurements.length - 1]) == null ? void 0 : _a.end) ?? 0 : Math.max(
|
|
3304
|
+
...measurements.slice(-this.options.lanes).map((m) => m.end)
|
|
3305
|
+
);
|
|
3323
3306
|
}
|
|
3324
3307
|
return Math.max(
|
|
3325
3308
|
end - this.options.scrollMargin + this.options.paddingEnd,
|
|
@@ -3360,43 +3343,14 @@ const findNearestBinarySearch = (low, high, getCurrentValue, value) => {
|
|
|
3360
3343
|
function calculateRange({
|
|
3361
3344
|
measurements,
|
|
3362
3345
|
outerSize,
|
|
3363
|
-
scrollOffset
|
|
3364
|
-
lanes
|
|
3346
|
+
scrollOffset
|
|
3365
3347
|
}) {
|
|
3366
|
-
const
|
|
3348
|
+
const count = measurements.length - 1;
|
|
3367
3349
|
const getOffset = (index) => measurements[index].start;
|
|
3368
|
-
|
|
3369
|
-
return {
|
|
3370
|
-
startIndex: 0,
|
|
3371
|
-
endIndex: lastIndex
|
|
3372
|
-
};
|
|
3373
|
-
}
|
|
3374
|
-
let startIndex = findNearestBinarySearch(
|
|
3375
|
-
0,
|
|
3376
|
-
lastIndex,
|
|
3377
|
-
getOffset,
|
|
3378
|
-
scrollOffset
|
|
3379
|
-
);
|
|
3350
|
+
const startIndex = findNearestBinarySearch(0, count, getOffset, scrollOffset);
|
|
3380
3351
|
let endIndex = startIndex;
|
|
3381
|
-
|
|
3382
|
-
|
|
3383
|
-
endIndex++;
|
|
3384
|
-
}
|
|
3385
|
-
} else if (lanes > 1) {
|
|
3386
|
-
const endPerLane = Array(lanes).fill(0);
|
|
3387
|
-
while (endIndex < lastIndex && endPerLane.some((pos) => pos < scrollOffset + outerSize)) {
|
|
3388
|
-
const item = measurements[endIndex];
|
|
3389
|
-
endPerLane[item.lane] = item.end;
|
|
3390
|
-
endIndex++;
|
|
3391
|
-
}
|
|
3392
|
-
const startPerLane = Array(lanes).fill(scrollOffset + outerSize);
|
|
3393
|
-
while (startIndex >= 0 && startPerLane.some((pos) => pos >= scrollOffset)) {
|
|
3394
|
-
const item = measurements[startIndex];
|
|
3395
|
-
startPerLane[item.lane] = item.start;
|
|
3396
|
-
startIndex--;
|
|
3397
|
-
}
|
|
3398
|
-
startIndex = Math.max(0, startIndex - startIndex % lanes);
|
|
3399
|
-
endIndex = Math.min(lastIndex, endIndex + (lanes - 1 - endIndex % lanes));
|
|
3352
|
+
while (endIndex < count && measurements[endIndex].end < scrollOffset + outerSize) {
|
|
3353
|
+
endIndex++;
|
|
3400
3354
|
}
|
|
3401
3355
|
return { startIndex, endIndex };
|
|
3402
3356
|
}
|
|
@@ -5256,4 +5210,4 @@ function Content() {
|
|
|
5256
5210
|
export {
|
|
5257
5211
|
Content as default
|
|
5258
5212
|
};
|
|
5259
|
-
//# sourceMappingURL=content-
|
|
5213
|
+
//# sourceMappingURL=content-BnihK9ko.js.map
|