@aiquants/virtualscroll 3.9.2 → 3.11.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/CHANGELOG.md +149 -0
- package/README.md +135 -40
- package/dist/ScrollBar.d.cts +45 -38
- package/dist/ScrollBar.d.ts +45 -38
- package/dist/ScrollBar.d.ts.map +1 -1
- package/dist/ScrollPane.d.cts +12 -14
- package/dist/ScrollPane.d.ts +12 -14
- package/dist/ScrollPane.d.ts.map +1 -1
- package/dist/VirtualGrid.d.cts +6 -6
- package/dist/VirtualGrid.d.ts +6 -6
- package/dist/VirtualGrid.d.ts.map +1 -1
- package/dist/VirtualScroll.d.cts +184 -30
- package/dist/VirtualScroll.d.ts +184 -30
- package/dist/VirtualScroll.d.ts.map +1 -1
- package/dist/cli.js +26 -47
- package/dist/index.cjs +1 -1
- package/dist/index.js +2385 -2413
- package/dist/labels.d.cts +38 -7
- package/dist/labels.d.ts +38 -7
- package/dist/labels.d.ts.map +1 -1
- package/dist/logger.d.cts +1 -16
- package/dist/logger.d.ts +1 -16
- package/dist/logger.d.ts.map +1 -1
- package/dist/styles/virtualscroll.css +1 -1
- package/dist/styles/virtualscroll.standalone.css +1 -1
- package/dist/useFenwickMapTree.d.cts +21 -1
- package/dist/useFenwickMapTree.d.ts +21 -1
- package/dist/useFenwickMapTree.d.ts.map +1 -1
- package/dist/useLruCache.d.ts.map +1 -1
- package/dist/utils.d.cts +14 -0
- package/dist/utils.d.ts +14 -0
- package/dist/utils.d.ts.map +1 -1
- package/package.json +5 -2
- package/src/ScrollBar.tsx +115 -55
- package/src/ScrollPane.tsx +12 -14
- package/src/VirtualGrid.tsx +27 -25
- package/src/VirtualScroll.tsx +486 -234
- package/src/labels.ts +58 -7
- package/src/logger.ts +1 -25
- package/src/styles/virtualscroll.css +51 -3
- package/src/useFenwickMapTree.ts +60 -98
- package/src/useLruCache.ts +14 -8
- package/src/utils.ts +15 -0
package/dist/VirtualScroll.d.cts
CHANGED
|
@@ -134,21 +134,47 @@ export type VirtualScrollHandle = {
|
|
|
134
134
|
/**
|
|
135
135
|
* Scrolls to a specific item index, landing exactly on the aligned position (clamped to the content). A `"top"`
|
|
136
136
|
* (default) or `"bottom"` alignment is remembered at that position, so the device-pixel snap of the items wrapper
|
|
137
|
-
* keeps the aligned edge there (see the README's device-pixel snapping section).
|
|
137
|
+
* keeps the aligned edge there (see the README's device-pixel snapping section). `"top"`, `"bottom"` and `"center"`
|
|
138
|
+
* align to the viewport itself, and `offset` (px) is subtracted from the aligned position.
|
|
139
|
+
*
|
|
140
|
+
* `"nearest"` is the reveal, the rule focus moves and the row keyboard steps use too: it scrolls the least distance that
|
|
141
|
+
* brings the row wholly into the viewport, minus the edge a visible scroll-to-edge pill covers (from that edge to the
|
|
142
|
+
* pill's far side), and does nothing when the row already lies wholly inside. A row above lands with its top at the
|
|
143
|
+
* band's top, a row below with its bottom at the band's bottom, and a row taller than the band with its top at the
|
|
144
|
+
* band's top; the landing is kept like a `"top"` / `"bottom"` alignment, so a pill that hides later moves nothing.
|
|
145
|
+
* `"nearest"` takes no `offset`.
|
|
138
146
|
*
|
|
139
147
|
* 指定したアイテムインデックスへスクロールする処理。揃えた位置 (中身の範囲へクランプ) へ厳密に着地する。`"top"` (既定) と
|
|
140
148
|
* `"bottom"` の揃えはその位置で覚えるので、そこでは行ラッパーの装置の画素への揃えが揃えた端を守る (README の装置の画素への
|
|
141
|
-
* 揃えの節を参照)
|
|
149
|
+
* 揃えの節を参照)。`"top"`・`"bottom"`・`"center"` は表示域そのものに揃え、`offset` (px) を揃えた位置から引く。
|
|
150
|
+
*
|
|
151
|
+
* `"nearest"` は見せる操作で、フォーカスの移動と行のキー移動も同じ規則を使う。行が表示域から、見えている端へ戻るピルが覆う
|
|
152
|
+
* 端 (その端からピルの向こう側まで) を除いた帯にまるごと入る最短の距離だけスクロールし、既にまるごと入っていれば何もしない。
|
|
153
|
+
* 上の行は上端を帯の上端へ、下の行は下端を帯の下端へ、帯より高い行は上端を帯の上端へ着地させ、着地は `"top"` / `"bottom"`
|
|
154
|
+
* の揃えと同じく保つので、後でピルが隠れても何も動かない。`"nearest"` は `offset` を取らない。
|
|
155
|
+
*
|
|
156
|
+
* @throws {RangeError} When `"nearest"` comes with an `offset` / `"nearest"` に `offset` を渡したとき
|
|
142
157
|
*/
|
|
143
158
|
scrollToIndex: (index: number, options?: {
|
|
144
159
|
align?: "top" | "bottom" | "center";
|
|
145
160
|
offset?: number;
|
|
161
|
+
} | {
|
|
162
|
+
align: "nearest";
|
|
163
|
+
offset?: never;
|
|
146
164
|
}) => void;
|
|
147
165
|
/** Gets the total height managed by the Fenwick Tree / Fenwick Tree で管理されている総高さを取得 */
|
|
148
166
|
getFenwickTreeTotalHeight: () => number;
|
|
149
167
|
/** Gets the number of items in the Fenwick Tree / Fenwick Tree 内のアイテム数を取得 */
|
|
150
168
|
getFenwickSize: () => number;
|
|
151
|
-
/**
|
|
169
|
+
/**
|
|
170
|
+
* Focuses the row at the specified index (with `behaviorOptions.enableKeyboardNavigation`). With `ensureVisible` (default
|
|
171
|
+
* `true`) it first reveals the row like `scrollToIndex(index, { align: "nearest" })`, so a row a visible scroll-to-edge
|
|
172
|
+
* pill covers is brought out from under it; with `false` it focuses a rendered row without scrolling.
|
|
173
|
+
*
|
|
174
|
+
* 指定したインデックスの行へフォーカスする処理 (`behaviorOptions.enableKeyboardNavigation` のとき)。`ensureVisible` (既定
|
|
175
|
+
* `true`) では先に `scrollToIndex(index, { align: "nearest" })` と同じく行を見せるので、見えている端へ戻るピルが覆う行は
|
|
176
|
+
* その下から出る。`false` では描いてある行をスクロールせずにフォーカスする。
|
|
177
|
+
*/
|
|
152
178
|
focusItemAtIndex: (index: number, options?: {
|
|
153
179
|
ensureVisible?: boolean;
|
|
154
180
|
}) => void;
|
|
@@ -197,21 +223,23 @@ export type VirtualScrollScrollBarOptions = {
|
|
|
197
223
|
/** Whether the arrow buttons scroll (default `true`). / 矢印ボタンによるスクロールを許可するかどうか (既定 `true`)。 */
|
|
198
224
|
enableArrowButtons?: boolean;
|
|
199
225
|
/**
|
|
200
|
-
* Whether the
|
|
201
|
-
* the
|
|
202
|
-
* the
|
|
203
|
-
*
|
|
204
|
-
*
|
|
205
|
-
*
|
|
206
|
-
*
|
|
226
|
+
* Whether the scroll chrome is the keyboard user's scrolling control (default `true`), or pointer-only because the
|
|
227
|
+
* host scrolls the list by keyboard itself (`false`: roving row focus with Arrow / Page / Home / End).
|
|
228
|
+
* `true`: the scrollbar is a named `role="scrollbar"` with a named `role="slider"` thumb, and its arrows (and the
|
|
229
|
+
* visible scroll-to-edge pills) are Tab stops — the rows are not Tab stops, so without a host keyboard model they are
|
|
230
|
+
* the only scrolling controls a keyboard user can reach with Tab.
|
|
231
|
+
* `false`: the scrollbar and the scroll-to-edge pills become pointer-only, like a native scrollbar: both carry
|
|
232
|
+
* `aria-hidden="true"`, nothing in them is a Tab stop, and a press on them never moves focus (neither onto them nor
|
|
233
|
+
* away from where the host put it); pointer scrolling and the pills' clicks are unchanged. Full contract:
|
|
207
234
|
* `ScrollBarProps["enableArrowButtonTabStops"]`.
|
|
208
|
-
*
|
|
209
|
-
*
|
|
210
|
-
*
|
|
211
|
-
* Tab
|
|
212
|
-
*
|
|
213
|
-
*
|
|
214
|
-
*
|
|
235
|
+
* スクロールの部品がキーボード利用者のスクロール操作部品か (既定 `true`)、ホストが一覧のキーボードスクロールを
|
|
236
|
+
* 自分で持つためポインタ専用か (`false`: 行のロービングフォーカスと矢印 / Page / Home / End) の指定。
|
|
237
|
+
* `true`: スクロールバーは名前付きの `role="scrollbar"` で名前付きの `role="slider"` のつまみを持ち、矢印 (と見えている
|
|
238
|
+
* 端へ戻るピル) は Tab の止まり先 — 行は Tab の止まり先ではないため、ホストのキーボードモデルが無ければ Tab で届く
|
|
239
|
+
* 唯一のスクロール操作部品。
|
|
240
|
+
* `false`: スクロールバーと端へ戻るピルはネイティブのスクロールバーと同じくポインタ専用になる。どちらも
|
|
241
|
+
* `aria-hidden="true"` を持ち、中に Tab の止まり先は無く、押下はフォーカスを動かさない (部品へも、ホストが置いた
|
|
242
|
+
* 場所の外へも)。ポインタのスクロールとピルの click は変わらない。契約の全文は
|
|
215
243
|
* `ScrollBarProps["enableArrowButtonTabStops"]`。
|
|
216
244
|
*/
|
|
217
245
|
enableArrowButtonTabStops?: boolean;
|
|
@@ -312,12 +340,12 @@ export type VirtualScrollLiveRegionOptions = {
|
|
|
312
340
|
* Formats the announcement text. Called after the visible range settles; returning the same
|
|
313
341
|
* string as last time leaves the DOM untouched (no re-announcement), returning `""` clears
|
|
314
342
|
* the region. The live-region wording and its language are consumer-owned: the package's
|
|
315
|
-
* built-in catalog (`locale` / `labels`) covers only the
|
|
316
|
-
*
|
|
343
|
+
* built-in catalog (`locale` / `labels`) covers only the eleven chrome strings (the scrollbar's
|
|
344
|
+
* accessible names, the scroll-to-edge pills and the empty state), never announcements.
|
|
317
345
|
* 読み上げ文言を組み立てる。可視範囲が静定した後に呼ばれ、前回と同じ文字列なら DOM を
|
|
318
346
|
* 触らない (再読み上げしない)。`""` を返すとリージョンを空にする。読み上げの文面と言語は
|
|
319
|
-
* 消費側の所有物 — パッケージの内蔵カタログ (`locale` / `labels`) が扱うのはクローム
|
|
320
|
-
* (
|
|
347
|
+
* 消費側の所有物 — パッケージの内蔵カタログ (`locale` / `labels`) が扱うのはクローム 11 文言
|
|
348
|
+
* (スクロールバーのアクセシブルネーム、端スクロールピル、空状態) だけで、読み上げは対象外。
|
|
321
349
|
*
|
|
322
350
|
* @param range - The settled visible range / 静定した可視範囲
|
|
323
351
|
* @returns Announcement text / 読み上げ文言
|
|
@@ -425,13 +453,14 @@ export type VirtualScrollProps<T> = {
|
|
|
425
453
|
*/
|
|
426
454
|
liveRegion?: VirtualScrollLiveRegionOptions;
|
|
427
455
|
/**
|
|
428
|
-
* UI chrome locale of the built-in strings (default `"en"`): the scrollbar
|
|
429
|
-
* the scroll-to-edge pills and the empty-state text
|
|
456
|
+
* UI chrome locale of the built-in strings (default `"en"`): the scrollbar's accessible names
|
|
457
|
+
* (the bar, its thumb and its arrows), the scroll-to-edge pills and the empty-state text, and of the
|
|
458
|
+
* percentage the bar and its thumb carry as their value text. Live-region wording is not affected (see
|
|
430
459
|
* {@link VirtualScrollLiveRegionOptions.format}). An unsupported value throws a RangeError at
|
|
431
460
|
* render; no language negotiation happens.
|
|
432
|
-
* 内蔵文言 (
|
|
433
|
-
* (既定 `"en"`)。ライブリージョンの文言には影響しない
|
|
434
|
-
* 参照)。非対応値は描画時に RangeError、言語ネゴシエーションなし。
|
|
461
|
+
* 内蔵文言 (スクロールバーのアクセシブルネーム — バー・つまみ・矢印 —、端スクロールピル、空状態文言) と、バーとつまみが
|
|
462
|
+
* 値の文字として持つ百分率の UI クロームロケール (既定 `"en"`)。ライブリージョンの文言には影響しない
|
|
463
|
+
* ({@link VirtualScrollLiveRegionOptions.format} 参照)。非対応値は描画時に RangeError、言語ネゴシエーションなし。
|
|
435
464
|
*/
|
|
436
465
|
locale?: VirtualScrollLocale;
|
|
437
466
|
/**
|
|
@@ -623,6 +652,57 @@ export type AlignedEdge = {
|
|
|
623
652
|
/** Pane position (PANE coordinates) where the aligned row sits at that edge / 揃えた行がその端にあるペイン位置 (ペイン座標) */
|
|
624
653
|
readonly panePosition: number;
|
|
625
654
|
};
|
|
655
|
+
/**
|
|
656
|
+
* The parts of the viewport that something drawn over the rows covers — the visible scroll-to-edge pill — as px from each
|
|
657
|
+
* edge to the far side of what covers it. Module-level export (NOT in the package barrel), the parameter type of
|
|
658
|
+
* `resolveRevealAlignment`.
|
|
659
|
+
*
|
|
660
|
+
* 行の上に描いたもの (見えている端へ戻るピル) が覆う表示域の部分。各端から覆うものの向こう側までの px。モジュールレベル
|
|
661
|
+
* export (バレル非公開)。`resolveRevealAlignment` の引数の型。
|
|
662
|
+
*/
|
|
663
|
+
export type ObscuredInsets = {
|
|
664
|
+
/** Covered px from the top edge / 上端から覆われた px */
|
|
665
|
+
readonly top: number;
|
|
666
|
+
/** Covered px from the bottom edge / 下端から覆われた px */
|
|
667
|
+
readonly bottom: number;
|
|
668
|
+
};
|
|
669
|
+
/**
|
|
670
|
+
* How a reveal lands a row: with its top at the top of the band the obscured insets leave (`"top"`) or with its bottom at the
|
|
671
|
+
* band's bottom (`"bottom"`), as the alignment and the `offset` `scrollToIndex` subtracts from the position aligned to the
|
|
672
|
+
* viewport's edge. Module-level export (NOT in the package barrel), the return type of `resolveRevealAlignment`.
|
|
673
|
+
*
|
|
674
|
+
* 見せる操作が行を着地させる揃え。覆われた部分を除いた帯の上端へ行の上端を (`"top"`)、帯の下端へ行の下端を (`"bottom"`) 置く
|
|
675
|
+
* 揃えと、表示域の端に揃えた位置から `scrollToIndex` が引く `offset`。モジュールレベル export (バレル非公開)。
|
|
676
|
+
* `resolveRevealAlignment` の戻り値の型。
|
|
677
|
+
*/
|
|
678
|
+
export type RevealAlignment = {
|
|
679
|
+
/** The edge of the band the row lands at / 行が着地する帯の端 */
|
|
680
|
+
readonly align: "top" | "bottom";
|
|
681
|
+
/** Px subtracted from the position aligned to the viewport's edge (the covered px; negative at the bottom) / 表示域の端に揃えた位置から引く px (覆われた px。下端では負) */
|
|
682
|
+
readonly offset: number;
|
|
683
|
+
};
|
|
684
|
+
/**
|
|
685
|
+
* Resolves the reveal of a row — the one rule of `scrollToIndex` with `align: "nearest"`, of `focusItemAtIndex` and of the
|
|
686
|
+
* row keyboard steps: the least scroll that brings the row wholly into the band of the viewport the obscured insets leave.
|
|
687
|
+
* A row above the band lands with its top at the band's top, a row below with its bottom at the band's bottom, and a row
|
|
688
|
+
* taller than the band with its top at the band's top. A row within `EDGE_POSITION_TOLERANCE` of the band counts as inside.
|
|
689
|
+
* Module-level export (NOT in the package barrel).
|
|
690
|
+
*
|
|
691
|
+
* 行を見せる操作を解決する処理。`align: "nearest"` の `scrollToIndex`・`focusItemAtIndex`・行のキー移動に共通のただ 1 つの
|
|
692
|
+
* 規則で、覆われた部分を除いた表示域の帯へ行をまるごと入れる最短のスクロール。帯より上の行は上端を帯の上端へ、下の行は
|
|
693
|
+
* 下端を帯の下端へ、帯より高い行は上端を帯の上端へ着地させる。帯から `EDGE_POSITION_TOLERANCE` 以内の行は中にあるとみなす。
|
|
694
|
+
* モジュールレベル export (バレル非公開)。
|
|
695
|
+
*
|
|
696
|
+
* @param row - The row's logical top and bottom (px) / 行の論理上端と論理下端 (px)
|
|
697
|
+
* @param position - Logical scroll position (px) / 論理スクロール位置 (px)
|
|
698
|
+
* @param viewportSize - Viewport size (px) / 表示域の高さ (px)
|
|
699
|
+
* @param insets - The obscured insets / 覆われた部分
|
|
700
|
+
* @returns How to land the row, or `null` when it already lies wholly inside the band / 行の着地のさせ方 (既に帯にまるごと入っていれば `null`)
|
|
701
|
+
*/
|
|
702
|
+
export declare const resolveRevealAlignment: (row: {
|
|
703
|
+
readonly top: number;
|
|
704
|
+
readonly bottom: number;
|
|
705
|
+
}, position: number, viewportSize: number, insets: ObscuredInsets) => RevealAlignment | null;
|
|
626
706
|
/**
|
|
627
707
|
* Chooses the edge the items-wrapper translate keeps when it is snapped to the device-pixel grid
|
|
628
708
|
* (`snapToDevicePixelGrid`), so that aligned content never loses part of its edge gutter to the snap:
|
|
@@ -658,14 +738,87 @@ export type AlignedEdge = {
|
|
|
658
738
|
*/
|
|
659
739
|
export declare const resolveItemsWrapperSnapEdge: (panePosition: number, maxPanePosition: number, alignedEdge: AlignedEdge | null) => DevicePixelSnapEdge;
|
|
660
740
|
/**
|
|
661
|
-
*
|
|
741
|
+
* The first visible row at a logical scroll position (`resolveVisibleStartRow`).
|
|
662
742
|
*
|
|
663
|
-
*
|
|
743
|
+
* 論理スクロール位置での先頭の可視行 (`resolveVisibleStartRow`)。
|
|
664
744
|
*/
|
|
745
|
+
export type VisibleStartRow = {
|
|
746
|
+
/** Index of the first visible row / 先頭の可視行の index */
|
|
747
|
+
readonly index: number;
|
|
748
|
+
/** Logical top of that row (px); `position - top` is the part hidden above the viewport top / その行の論理上端 (px)。`position - top` がビューポートの上端より上に隠れた量 */
|
|
749
|
+
readonly top: number;
|
|
750
|
+
};
|
|
751
|
+
/**
|
|
752
|
+
* The part of the Fenwick tree `resolveVisibleStartRow` reads.
|
|
753
|
+
*
|
|
754
|
+
* `resolveVisibleStartRow` が読む Fenwick 木の部分。
|
|
755
|
+
*/
|
|
756
|
+
type VisibleStartRowTree = Pick<ReturnType<typeof useFenwickMapTree>, "findIndexAtOrAfter" | "prefixSum">;
|
|
757
|
+
/**
|
|
758
|
+
* Resolves the first visible row at a logical scroll position by the visible-start boundary rule — the one rule that
|
|
759
|
+
* `scrollTo` pins, `getScrollAnchor` reports, `updateItemSize` compensates above and `computeRenderingRanges` renders from
|
|
760
|
+
* (on both of its paths, `computeRenderingRangesHuge` included):
|
|
761
|
+
*
|
|
762
|
+
* - the row whose span contains the position: `top <= position < top + height`;
|
|
763
|
+
* - a row whose bottom equals the position lies entirely above the viewport, so the next row starts exactly there and is the
|
|
764
|
+
* first visible row, at offset 0;
|
|
765
|
+
* - at the end, the last row stays the first visible row (the end clamp): when the position equals its bottom, and when the
|
|
766
|
+
* position lies past the end of the content (a transient after the list shrinks, before the pane clamps).
|
|
767
|
+
*
|
|
768
|
+
* Module-level export (NOT in the package barrel).
|
|
769
|
+
*
|
|
770
|
+
* 先頭の可視行を、可視の先頭の境界の規則で論理スクロール位置から解決する処理。`scrollTo` が留め、`getScrollAnchor` が知らせ、
|
|
771
|
+
* `updateItemSize` がその上の変化を補正し、`computeRenderingRanges` が (`computeRenderingRangesHuge` を含む両方の経路で) 描き
|
|
772
|
+
* 始める、ただ 1 つの規則。
|
|
773
|
+
*
|
|
774
|
+
* - 位置を含む行 (`上端 <= 位置 < 上端 + 高さ`)。
|
|
775
|
+
* - 下端が位置に一致する行は丸ごとビューポートの上にあるので、ちょうどそこから始まる次の行がオフセット 0 で先頭の可視行。
|
|
776
|
+
* - 末尾では最後の行が先頭の可視行のまま (末尾のクランプ)。位置がその下端に一致するときと、位置が中身の末尾を越えるとき
|
|
777
|
+
* (一覧が縮んでからペインがクランプするまでの過渡状態)。
|
|
778
|
+
*
|
|
779
|
+
* モジュールレベル export (バレル非公開)。
|
|
780
|
+
*
|
|
781
|
+
* @param fenwickTree - The row-height tree / 行の高さの木
|
|
782
|
+
* @param position - Logical scroll position (px, 0 or more) / 論理スクロール位置 (px。0 以上)
|
|
783
|
+
* @param itemCount - Number of rows, 1 or more / 行の数 (1 以上)
|
|
784
|
+
* @returns The first visible row and its logical top / 先頭の可視行とその論理上端
|
|
785
|
+
*/
|
|
786
|
+
export declare const resolveVisibleStartRow: (fenwickTree: VisibleStartRowTree, position: number, itemCount: number) => VisibleStartRow;
|
|
787
|
+
/**
|
|
788
|
+
* Computes the rendering ranges of a list of `Number.MAX_SAFE_INTEGER` rows or more. The first visible row comes from the one
|
|
789
|
+
* visible-start boundary rule, `resolveVisibleStartRow`, exactly as in `computeRenderingRanges`, and the forward scan starts at
|
|
790
|
+
* that row's hidden offset as there; only then are the indices converted to `bigint`. The scans keep their own `bigint` loops
|
|
791
|
+
* because past 2^53 an index cannot be stepped by 1 in `number` (`x + 1 === x`, so a `number` loop over zero-height rows would
|
|
792
|
+
* never end); the tree's own lookups take `number` indices, so in that range the start row is as exact as the tree's answer.
|
|
793
|
+
* Below 2^53 both paths resolve every row boundary, zero-height rows at position 0 and the end clamp to the same ranges.
|
|
794
|
+
* Module-level export (NOT in the package barrel), for the spec that pins that agreement.
|
|
795
|
+
*
|
|
796
|
+
* `Number.MAX_SAFE_INTEGER` 行以上の一覧の描画範囲を求める処理。先頭の可視行は `computeRenderingRanges` とまったく同じく、ただ
|
|
797
|
+
* 1 つの可視の先頭の境界の規則 `resolveVisibleStartRow` から得て、前方の走査も同じくその行の隠れた量から始め、そのあとで添字を
|
|
798
|
+
* `bigint` へ変える。走査が `bigint` の繰り返しを持つのは、2^53 を越えると `number` では添字を 1 ずつ進められない
|
|
799
|
+
* (`x + 1 === x` なので、高さ 0 の行を `number` で走査すると終わらない) ため。木の引き当ては `number` の添字を取るので、その範囲の
|
|
800
|
+
* 先頭の行は木の答えと同じ精度。2^53 未満では、どちらの経路もどの行の境界・位置 0 の高さ 0 の行・末尾のクランプでも同じ範囲を
|
|
801
|
+
* 返す。モジュールレベル export (バレル非公開)。その一致を固定する spec のため。
|
|
802
|
+
*
|
|
803
|
+
* @param effectiveScrollPosition - Logical scroll position, clamped to the content (px) / 中身へクランプした論理スクロール位置 (px)
|
|
804
|
+
* @param viewportSize - Height of the viewport (px) / 表示域の高さ (px)
|
|
805
|
+
* @param overscanCount - Rows rendered beyond each edge / 端の外に描く行の数
|
|
806
|
+
* @param itemSize - Number of rows / 行の数
|
|
807
|
+
* @param getItemHeight - Height of a row / 行の高さ
|
|
808
|
+
* @param fenwickTree - The row-height tree / 行の高さの木
|
|
809
|
+
* @returns The rendering and visible ranges / 描画範囲と可視範囲
|
|
810
|
+
*/
|
|
811
|
+
export declare const computeRenderingRangesHuge: (effectiveScrollPosition: number, viewportSize: number, overscanCount: number, itemSize: number, getItemHeight: (index: number) => number, fenwickTree: ReturnType<typeof useFenwickMapTree>) => {
|
|
812
|
+
renderingStartIndex: number;
|
|
813
|
+
renderingEndIndex: number;
|
|
814
|
+
visibleStartIndex: number;
|
|
815
|
+
visibleEndIndex: number;
|
|
816
|
+
};
|
|
665
817
|
/**
|
|
666
|
-
* Calculates rendering boundaries from current scroll metrics.
|
|
818
|
+
* Calculates rendering boundaries from current scroll metrics. The visible rows start at the row `resolveVisibleStartRow`
|
|
819
|
+
* resolves.
|
|
667
820
|
*
|
|
668
|
-
*
|
|
821
|
+
* 現在のスクロール情報から描画範囲を算出。可視の行は `resolveVisibleStartRow` が解決する行から始まる。
|
|
669
822
|
*/
|
|
670
823
|
export declare const computeRenderingRanges: (scrollPosition: number, viewportSize: number, overscanCount: number, itemSize: number, getItemHeight: (index: number) => number, fenwickTree: ReturnType<typeof useFenwickMapTree>, totalHeight: number) => {
|
|
671
824
|
renderingStartIndex: number;
|
|
@@ -683,3 +836,4 @@ export declare const computeRenderingRanges: (scrollPosition: number, viewportSi
|
|
|
683
836
|
export declare const VirtualScroll: <T>(props: VirtualScrollProps<T> & {
|
|
684
837
|
ref?: React.Ref<VirtualScrollHandle>;
|
|
685
838
|
}) => React.ReactElement;
|
|
839
|
+
export {};
|
package/dist/VirtualScroll.d.ts
CHANGED
|
@@ -134,21 +134,47 @@ export type VirtualScrollHandle = {
|
|
|
134
134
|
/**
|
|
135
135
|
* Scrolls to a specific item index, landing exactly on the aligned position (clamped to the content). A `"top"`
|
|
136
136
|
* (default) or `"bottom"` alignment is remembered at that position, so the device-pixel snap of the items wrapper
|
|
137
|
-
* keeps the aligned edge there (see the README's device-pixel snapping section).
|
|
137
|
+
* keeps the aligned edge there (see the README's device-pixel snapping section). `"top"`, `"bottom"` and `"center"`
|
|
138
|
+
* align to the viewport itself, and `offset` (px) is subtracted from the aligned position.
|
|
139
|
+
*
|
|
140
|
+
* `"nearest"` is the reveal, the rule focus moves and the row keyboard steps use too: it scrolls the least distance that
|
|
141
|
+
* brings the row wholly into the viewport, minus the edge a visible scroll-to-edge pill covers (from that edge to the
|
|
142
|
+
* pill's far side), and does nothing when the row already lies wholly inside. A row above lands with its top at the
|
|
143
|
+
* band's top, a row below with its bottom at the band's bottom, and a row taller than the band with its top at the
|
|
144
|
+
* band's top; the landing is kept like a `"top"` / `"bottom"` alignment, so a pill that hides later moves nothing.
|
|
145
|
+
* `"nearest"` takes no `offset`.
|
|
138
146
|
*
|
|
139
147
|
* 指定したアイテムインデックスへスクロールする処理。揃えた位置 (中身の範囲へクランプ) へ厳密に着地する。`"top"` (既定) と
|
|
140
148
|
* `"bottom"` の揃えはその位置で覚えるので、そこでは行ラッパーの装置の画素への揃えが揃えた端を守る (README の装置の画素への
|
|
141
|
-
* 揃えの節を参照)
|
|
149
|
+
* 揃えの節を参照)。`"top"`・`"bottom"`・`"center"` は表示域そのものに揃え、`offset` (px) を揃えた位置から引く。
|
|
150
|
+
*
|
|
151
|
+
* `"nearest"` は見せる操作で、フォーカスの移動と行のキー移動も同じ規則を使う。行が表示域から、見えている端へ戻るピルが覆う
|
|
152
|
+
* 端 (その端からピルの向こう側まで) を除いた帯にまるごと入る最短の距離だけスクロールし、既にまるごと入っていれば何もしない。
|
|
153
|
+
* 上の行は上端を帯の上端へ、下の行は下端を帯の下端へ、帯より高い行は上端を帯の上端へ着地させ、着地は `"top"` / `"bottom"`
|
|
154
|
+
* の揃えと同じく保つので、後でピルが隠れても何も動かない。`"nearest"` は `offset` を取らない。
|
|
155
|
+
*
|
|
156
|
+
* @throws {RangeError} When `"nearest"` comes with an `offset` / `"nearest"` に `offset` を渡したとき
|
|
142
157
|
*/
|
|
143
158
|
scrollToIndex: (index: number, options?: {
|
|
144
159
|
align?: "top" | "bottom" | "center";
|
|
145
160
|
offset?: number;
|
|
161
|
+
} | {
|
|
162
|
+
align: "nearest";
|
|
163
|
+
offset?: never;
|
|
146
164
|
}) => void;
|
|
147
165
|
/** Gets the total height managed by the Fenwick Tree / Fenwick Tree で管理されている総高さを取得 */
|
|
148
166
|
getFenwickTreeTotalHeight: () => number;
|
|
149
167
|
/** Gets the number of items in the Fenwick Tree / Fenwick Tree 内のアイテム数を取得 */
|
|
150
168
|
getFenwickSize: () => number;
|
|
151
|
-
/**
|
|
169
|
+
/**
|
|
170
|
+
* Focuses the row at the specified index (with `behaviorOptions.enableKeyboardNavigation`). With `ensureVisible` (default
|
|
171
|
+
* `true`) it first reveals the row like `scrollToIndex(index, { align: "nearest" })`, so a row a visible scroll-to-edge
|
|
172
|
+
* pill covers is brought out from under it; with `false` it focuses a rendered row without scrolling.
|
|
173
|
+
*
|
|
174
|
+
* 指定したインデックスの行へフォーカスする処理 (`behaviorOptions.enableKeyboardNavigation` のとき)。`ensureVisible` (既定
|
|
175
|
+
* `true`) では先に `scrollToIndex(index, { align: "nearest" })` と同じく行を見せるので、見えている端へ戻るピルが覆う行は
|
|
176
|
+
* その下から出る。`false` では描いてある行をスクロールせずにフォーカスする。
|
|
177
|
+
*/
|
|
152
178
|
focusItemAtIndex: (index: number, options?: {
|
|
153
179
|
ensureVisible?: boolean;
|
|
154
180
|
}) => void;
|
|
@@ -197,21 +223,23 @@ export type VirtualScrollScrollBarOptions = {
|
|
|
197
223
|
/** Whether the arrow buttons scroll (default `true`). / 矢印ボタンによるスクロールを許可するかどうか (既定 `true`)。 */
|
|
198
224
|
enableArrowButtons?: boolean;
|
|
199
225
|
/**
|
|
200
|
-
* Whether the
|
|
201
|
-
* the
|
|
202
|
-
* the
|
|
203
|
-
*
|
|
204
|
-
*
|
|
205
|
-
*
|
|
206
|
-
*
|
|
226
|
+
* Whether the scroll chrome is the keyboard user's scrolling control (default `true`), or pointer-only because the
|
|
227
|
+
* host scrolls the list by keyboard itself (`false`: roving row focus with Arrow / Page / Home / End).
|
|
228
|
+
* `true`: the scrollbar is a named `role="scrollbar"` with a named `role="slider"` thumb, and its arrows (and the
|
|
229
|
+
* visible scroll-to-edge pills) are Tab stops — the rows are not Tab stops, so without a host keyboard model they are
|
|
230
|
+
* the only scrolling controls a keyboard user can reach with Tab.
|
|
231
|
+
* `false`: the scrollbar and the scroll-to-edge pills become pointer-only, like a native scrollbar: both carry
|
|
232
|
+
* `aria-hidden="true"`, nothing in them is a Tab stop, and a press on them never moves focus (neither onto them nor
|
|
233
|
+
* away from where the host put it); pointer scrolling and the pills' clicks are unchanged. Full contract:
|
|
207
234
|
* `ScrollBarProps["enableArrowButtonTabStops"]`.
|
|
208
|
-
*
|
|
209
|
-
*
|
|
210
|
-
*
|
|
211
|
-
* Tab
|
|
212
|
-
*
|
|
213
|
-
*
|
|
214
|
-
*
|
|
235
|
+
* スクロールの部品がキーボード利用者のスクロール操作部品か (既定 `true`)、ホストが一覧のキーボードスクロールを
|
|
236
|
+
* 自分で持つためポインタ専用か (`false`: 行のロービングフォーカスと矢印 / Page / Home / End) の指定。
|
|
237
|
+
* `true`: スクロールバーは名前付きの `role="scrollbar"` で名前付きの `role="slider"` のつまみを持ち、矢印 (と見えている
|
|
238
|
+
* 端へ戻るピル) は Tab の止まり先 — 行は Tab の止まり先ではないため、ホストのキーボードモデルが無ければ Tab で届く
|
|
239
|
+
* 唯一のスクロール操作部品。
|
|
240
|
+
* `false`: スクロールバーと端へ戻るピルはネイティブのスクロールバーと同じくポインタ専用になる。どちらも
|
|
241
|
+
* `aria-hidden="true"` を持ち、中に Tab の止まり先は無く、押下はフォーカスを動かさない (部品へも、ホストが置いた
|
|
242
|
+
* 場所の外へも)。ポインタのスクロールとピルの click は変わらない。契約の全文は
|
|
215
243
|
* `ScrollBarProps["enableArrowButtonTabStops"]`。
|
|
216
244
|
*/
|
|
217
245
|
enableArrowButtonTabStops?: boolean;
|
|
@@ -312,12 +340,12 @@ export type VirtualScrollLiveRegionOptions = {
|
|
|
312
340
|
* Formats the announcement text. Called after the visible range settles; returning the same
|
|
313
341
|
* string as last time leaves the DOM untouched (no re-announcement), returning `""` clears
|
|
314
342
|
* the region. The live-region wording and its language are consumer-owned: the package's
|
|
315
|
-
* built-in catalog (`locale` / `labels`) covers only the
|
|
316
|
-
*
|
|
343
|
+
* built-in catalog (`locale` / `labels`) covers only the eleven chrome strings (the scrollbar's
|
|
344
|
+
* accessible names, the scroll-to-edge pills and the empty state), never announcements.
|
|
317
345
|
* 読み上げ文言を組み立てる。可視範囲が静定した後に呼ばれ、前回と同じ文字列なら DOM を
|
|
318
346
|
* 触らない (再読み上げしない)。`""` を返すとリージョンを空にする。読み上げの文面と言語は
|
|
319
|
-
* 消費側の所有物 — パッケージの内蔵カタログ (`locale` / `labels`) が扱うのはクローム
|
|
320
|
-
* (
|
|
347
|
+
* 消費側の所有物 — パッケージの内蔵カタログ (`locale` / `labels`) が扱うのはクローム 11 文言
|
|
348
|
+
* (スクロールバーのアクセシブルネーム、端スクロールピル、空状態) だけで、読み上げは対象外。
|
|
321
349
|
*
|
|
322
350
|
* @param range - The settled visible range / 静定した可視範囲
|
|
323
351
|
* @returns Announcement text / 読み上げ文言
|
|
@@ -425,13 +453,14 @@ export type VirtualScrollProps<T> = {
|
|
|
425
453
|
*/
|
|
426
454
|
liveRegion?: VirtualScrollLiveRegionOptions;
|
|
427
455
|
/**
|
|
428
|
-
* UI chrome locale of the built-in strings (default `"en"`): the scrollbar
|
|
429
|
-
* the scroll-to-edge pills and the empty-state text
|
|
456
|
+
* UI chrome locale of the built-in strings (default `"en"`): the scrollbar's accessible names
|
|
457
|
+
* (the bar, its thumb and its arrows), the scroll-to-edge pills and the empty-state text, and of the
|
|
458
|
+
* percentage the bar and its thumb carry as their value text. Live-region wording is not affected (see
|
|
430
459
|
* {@link VirtualScrollLiveRegionOptions.format}). An unsupported value throws a RangeError at
|
|
431
460
|
* render; no language negotiation happens.
|
|
432
|
-
* 内蔵文言 (
|
|
433
|
-
* (既定 `"en"`)。ライブリージョンの文言には影響しない
|
|
434
|
-
* 参照)。非対応値は描画時に RangeError、言語ネゴシエーションなし。
|
|
461
|
+
* 内蔵文言 (スクロールバーのアクセシブルネーム — バー・つまみ・矢印 —、端スクロールピル、空状態文言) と、バーとつまみが
|
|
462
|
+
* 値の文字として持つ百分率の UI クロームロケール (既定 `"en"`)。ライブリージョンの文言には影響しない
|
|
463
|
+
* ({@link VirtualScrollLiveRegionOptions.format} 参照)。非対応値は描画時に RangeError、言語ネゴシエーションなし。
|
|
435
464
|
*/
|
|
436
465
|
locale?: VirtualScrollLocale;
|
|
437
466
|
/**
|
|
@@ -623,6 +652,57 @@ export type AlignedEdge = {
|
|
|
623
652
|
/** Pane position (PANE coordinates) where the aligned row sits at that edge / 揃えた行がその端にあるペイン位置 (ペイン座標) */
|
|
624
653
|
readonly panePosition: number;
|
|
625
654
|
};
|
|
655
|
+
/**
|
|
656
|
+
* The parts of the viewport that something drawn over the rows covers — the visible scroll-to-edge pill — as px from each
|
|
657
|
+
* edge to the far side of what covers it. Module-level export (NOT in the package barrel), the parameter type of
|
|
658
|
+
* `resolveRevealAlignment`.
|
|
659
|
+
*
|
|
660
|
+
* 行の上に描いたもの (見えている端へ戻るピル) が覆う表示域の部分。各端から覆うものの向こう側までの px。モジュールレベル
|
|
661
|
+
* export (バレル非公開)。`resolveRevealAlignment` の引数の型。
|
|
662
|
+
*/
|
|
663
|
+
export type ObscuredInsets = {
|
|
664
|
+
/** Covered px from the top edge / 上端から覆われた px */
|
|
665
|
+
readonly top: number;
|
|
666
|
+
/** Covered px from the bottom edge / 下端から覆われた px */
|
|
667
|
+
readonly bottom: number;
|
|
668
|
+
};
|
|
669
|
+
/**
|
|
670
|
+
* How a reveal lands a row: with its top at the top of the band the obscured insets leave (`"top"`) or with its bottom at the
|
|
671
|
+
* band's bottom (`"bottom"`), as the alignment and the `offset` `scrollToIndex` subtracts from the position aligned to the
|
|
672
|
+
* viewport's edge. Module-level export (NOT in the package barrel), the return type of `resolveRevealAlignment`.
|
|
673
|
+
*
|
|
674
|
+
* 見せる操作が行を着地させる揃え。覆われた部分を除いた帯の上端へ行の上端を (`"top"`)、帯の下端へ行の下端を (`"bottom"`) 置く
|
|
675
|
+
* 揃えと、表示域の端に揃えた位置から `scrollToIndex` が引く `offset`。モジュールレベル export (バレル非公開)。
|
|
676
|
+
* `resolveRevealAlignment` の戻り値の型。
|
|
677
|
+
*/
|
|
678
|
+
export type RevealAlignment = {
|
|
679
|
+
/** The edge of the band the row lands at / 行が着地する帯の端 */
|
|
680
|
+
readonly align: "top" | "bottom";
|
|
681
|
+
/** Px subtracted from the position aligned to the viewport's edge (the covered px; negative at the bottom) / 表示域の端に揃えた位置から引く px (覆われた px。下端では負) */
|
|
682
|
+
readonly offset: number;
|
|
683
|
+
};
|
|
684
|
+
/**
|
|
685
|
+
* Resolves the reveal of a row — the one rule of `scrollToIndex` with `align: "nearest"`, of `focusItemAtIndex` and of the
|
|
686
|
+
* row keyboard steps: the least scroll that brings the row wholly into the band of the viewport the obscured insets leave.
|
|
687
|
+
* A row above the band lands with its top at the band's top, a row below with its bottom at the band's bottom, and a row
|
|
688
|
+
* taller than the band with its top at the band's top. A row within `EDGE_POSITION_TOLERANCE` of the band counts as inside.
|
|
689
|
+
* Module-level export (NOT in the package barrel).
|
|
690
|
+
*
|
|
691
|
+
* 行を見せる操作を解決する処理。`align: "nearest"` の `scrollToIndex`・`focusItemAtIndex`・行のキー移動に共通のただ 1 つの
|
|
692
|
+
* 規則で、覆われた部分を除いた表示域の帯へ行をまるごと入れる最短のスクロール。帯より上の行は上端を帯の上端へ、下の行は
|
|
693
|
+
* 下端を帯の下端へ、帯より高い行は上端を帯の上端へ着地させる。帯から `EDGE_POSITION_TOLERANCE` 以内の行は中にあるとみなす。
|
|
694
|
+
* モジュールレベル export (バレル非公開)。
|
|
695
|
+
*
|
|
696
|
+
* @param row - The row's logical top and bottom (px) / 行の論理上端と論理下端 (px)
|
|
697
|
+
* @param position - Logical scroll position (px) / 論理スクロール位置 (px)
|
|
698
|
+
* @param viewportSize - Viewport size (px) / 表示域の高さ (px)
|
|
699
|
+
* @param insets - The obscured insets / 覆われた部分
|
|
700
|
+
* @returns How to land the row, or `null` when it already lies wholly inside the band / 行の着地のさせ方 (既に帯にまるごと入っていれば `null`)
|
|
701
|
+
*/
|
|
702
|
+
export declare const resolveRevealAlignment: (row: {
|
|
703
|
+
readonly top: number;
|
|
704
|
+
readonly bottom: number;
|
|
705
|
+
}, position: number, viewportSize: number, insets: ObscuredInsets) => RevealAlignment | null;
|
|
626
706
|
/**
|
|
627
707
|
* Chooses the edge the items-wrapper translate keeps when it is snapped to the device-pixel grid
|
|
628
708
|
* (`snapToDevicePixelGrid`), so that aligned content never loses part of its edge gutter to the snap:
|
|
@@ -658,14 +738,87 @@ export type AlignedEdge = {
|
|
|
658
738
|
*/
|
|
659
739
|
export declare const resolveItemsWrapperSnapEdge: (panePosition: number, maxPanePosition: number, alignedEdge: AlignedEdge | null) => DevicePixelSnapEdge;
|
|
660
740
|
/**
|
|
661
|
-
*
|
|
741
|
+
* The first visible row at a logical scroll position (`resolveVisibleStartRow`).
|
|
662
742
|
*
|
|
663
|
-
*
|
|
743
|
+
* 論理スクロール位置での先頭の可視行 (`resolveVisibleStartRow`)。
|
|
664
744
|
*/
|
|
745
|
+
export type VisibleStartRow = {
|
|
746
|
+
/** Index of the first visible row / 先頭の可視行の index */
|
|
747
|
+
readonly index: number;
|
|
748
|
+
/** Logical top of that row (px); `position - top` is the part hidden above the viewport top / その行の論理上端 (px)。`position - top` がビューポートの上端より上に隠れた量 */
|
|
749
|
+
readonly top: number;
|
|
750
|
+
};
|
|
751
|
+
/**
|
|
752
|
+
* The part of the Fenwick tree `resolveVisibleStartRow` reads.
|
|
753
|
+
*
|
|
754
|
+
* `resolveVisibleStartRow` が読む Fenwick 木の部分。
|
|
755
|
+
*/
|
|
756
|
+
type VisibleStartRowTree = Pick<ReturnType<typeof useFenwickMapTree>, "findIndexAtOrAfter" | "prefixSum">;
|
|
757
|
+
/**
|
|
758
|
+
* Resolves the first visible row at a logical scroll position by the visible-start boundary rule — the one rule that
|
|
759
|
+
* `scrollTo` pins, `getScrollAnchor` reports, `updateItemSize` compensates above and `computeRenderingRanges` renders from
|
|
760
|
+
* (on both of its paths, `computeRenderingRangesHuge` included):
|
|
761
|
+
*
|
|
762
|
+
* - the row whose span contains the position: `top <= position < top + height`;
|
|
763
|
+
* - a row whose bottom equals the position lies entirely above the viewport, so the next row starts exactly there and is the
|
|
764
|
+
* first visible row, at offset 0;
|
|
765
|
+
* - at the end, the last row stays the first visible row (the end clamp): when the position equals its bottom, and when the
|
|
766
|
+
* position lies past the end of the content (a transient after the list shrinks, before the pane clamps).
|
|
767
|
+
*
|
|
768
|
+
* Module-level export (NOT in the package barrel).
|
|
769
|
+
*
|
|
770
|
+
* 先頭の可視行を、可視の先頭の境界の規則で論理スクロール位置から解決する処理。`scrollTo` が留め、`getScrollAnchor` が知らせ、
|
|
771
|
+
* `updateItemSize` がその上の変化を補正し、`computeRenderingRanges` が (`computeRenderingRangesHuge` を含む両方の経路で) 描き
|
|
772
|
+
* 始める、ただ 1 つの規則。
|
|
773
|
+
*
|
|
774
|
+
* - 位置を含む行 (`上端 <= 位置 < 上端 + 高さ`)。
|
|
775
|
+
* - 下端が位置に一致する行は丸ごとビューポートの上にあるので、ちょうどそこから始まる次の行がオフセット 0 で先頭の可視行。
|
|
776
|
+
* - 末尾では最後の行が先頭の可視行のまま (末尾のクランプ)。位置がその下端に一致するときと、位置が中身の末尾を越えるとき
|
|
777
|
+
* (一覧が縮んでからペインがクランプするまでの過渡状態)。
|
|
778
|
+
*
|
|
779
|
+
* モジュールレベル export (バレル非公開)。
|
|
780
|
+
*
|
|
781
|
+
* @param fenwickTree - The row-height tree / 行の高さの木
|
|
782
|
+
* @param position - Logical scroll position (px, 0 or more) / 論理スクロール位置 (px。0 以上)
|
|
783
|
+
* @param itemCount - Number of rows, 1 or more / 行の数 (1 以上)
|
|
784
|
+
* @returns The first visible row and its logical top / 先頭の可視行とその論理上端
|
|
785
|
+
*/
|
|
786
|
+
export declare const resolveVisibleStartRow: (fenwickTree: VisibleStartRowTree, position: number, itemCount: number) => VisibleStartRow;
|
|
787
|
+
/**
|
|
788
|
+
* Computes the rendering ranges of a list of `Number.MAX_SAFE_INTEGER` rows or more. The first visible row comes from the one
|
|
789
|
+
* visible-start boundary rule, `resolveVisibleStartRow`, exactly as in `computeRenderingRanges`, and the forward scan starts at
|
|
790
|
+
* that row's hidden offset as there; only then are the indices converted to `bigint`. The scans keep their own `bigint` loops
|
|
791
|
+
* because past 2^53 an index cannot be stepped by 1 in `number` (`x + 1 === x`, so a `number` loop over zero-height rows would
|
|
792
|
+
* never end); the tree's own lookups take `number` indices, so in that range the start row is as exact as the tree's answer.
|
|
793
|
+
* Below 2^53 both paths resolve every row boundary, zero-height rows at position 0 and the end clamp to the same ranges.
|
|
794
|
+
* Module-level export (NOT in the package barrel), for the spec that pins that agreement.
|
|
795
|
+
*
|
|
796
|
+
* `Number.MAX_SAFE_INTEGER` 行以上の一覧の描画範囲を求める処理。先頭の可視行は `computeRenderingRanges` とまったく同じく、ただ
|
|
797
|
+
* 1 つの可視の先頭の境界の規則 `resolveVisibleStartRow` から得て、前方の走査も同じくその行の隠れた量から始め、そのあとで添字を
|
|
798
|
+
* `bigint` へ変える。走査が `bigint` の繰り返しを持つのは、2^53 を越えると `number` では添字を 1 ずつ進められない
|
|
799
|
+
* (`x + 1 === x` なので、高さ 0 の行を `number` で走査すると終わらない) ため。木の引き当ては `number` の添字を取るので、その範囲の
|
|
800
|
+
* 先頭の行は木の答えと同じ精度。2^53 未満では、どちらの経路もどの行の境界・位置 0 の高さ 0 の行・末尾のクランプでも同じ範囲を
|
|
801
|
+
* 返す。モジュールレベル export (バレル非公開)。その一致を固定する spec のため。
|
|
802
|
+
*
|
|
803
|
+
* @param effectiveScrollPosition - Logical scroll position, clamped to the content (px) / 中身へクランプした論理スクロール位置 (px)
|
|
804
|
+
* @param viewportSize - Height of the viewport (px) / 表示域の高さ (px)
|
|
805
|
+
* @param overscanCount - Rows rendered beyond each edge / 端の外に描く行の数
|
|
806
|
+
* @param itemSize - Number of rows / 行の数
|
|
807
|
+
* @param getItemHeight - Height of a row / 行の高さ
|
|
808
|
+
* @param fenwickTree - The row-height tree / 行の高さの木
|
|
809
|
+
* @returns The rendering and visible ranges / 描画範囲と可視範囲
|
|
810
|
+
*/
|
|
811
|
+
export declare const computeRenderingRangesHuge: (effectiveScrollPosition: number, viewportSize: number, overscanCount: number, itemSize: number, getItemHeight: (index: number) => number, fenwickTree: ReturnType<typeof useFenwickMapTree>) => {
|
|
812
|
+
renderingStartIndex: number;
|
|
813
|
+
renderingEndIndex: number;
|
|
814
|
+
visibleStartIndex: number;
|
|
815
|
+
visibleEndIndex: number;
|
|
816
|
+
};
|
|
665
817
|
/**
|
|
666
|
-
* Calculates rendering boundaries from current scroll metrics.
|
|
818
|
+
* Calculates rendering boundaries from current scroll metrics. The visible rows start at the row `resolveVisibleStartRow`
|
|
819
|
+
* resolves.
|
|
667
820
|
*
|
|
668
|
-
*
|
|
821
|
+
* 現在のスクロール情報から描画範囲を算出。可視の行は `resolveVisibleStartRow` が解決する行から始まる。
|
|
669
822
|
*/
|
|
670
823
|
export declare const computeRenderingRanges: (scrollPosition: number, viewportSize: number, overscanCount: number, itemSize: number, getItemHeight: (index: number) => number, fenwickTree: ReturnType<typeof useFenwickMapTree>, totalHeight: number) => {
|
|
671
824
|
renderingStartIndex: number;
|
|
@@ -683,4 +836,5 @@ export declare const computeRenderingRanges: (scrollPosition: number, viewportSi
|
|
|
683
836
|
export declare const VirtualScroll: <T>(props: VirtualScrollProps<T> & {
|
|
684
837
|
ref?: React.Ref<VirtualScrollHandle>;
|
|
685
838
|
}) => React.ReactElement;
|
|
839
|
+
export {};
|
|
686
840
|
//# sourceMappingURL=VirtualScroll.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VirtualScroll.d.ts","sourceRoot":"","sources":["../src/VirtualScroll.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAc,KAAK,SAAS,
|
|
1
|
+
{"version":3,"file":"VirtualScroll.d.ts","sourceRoot":"","sources":["../src/VirtualScroll.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAc,KAAK,SAAS,EAAuG,MAAM,OAAO,CAAA;AAC9J,OAAO,EAAE,KAAK,mBAAmB,EAAsD,MAAM,sBAAsB,CAAA;AACnH,OAAO,EAA8B,KAAK,2BAA2B,EAAE,KAAK,mBAAmB,EAAE,MAAM,aAAa,CAAA;AAEpH,OAAO,EAAmE,KAAK,eAAe,EAAE,MAAM,kBAAkB,CAAA;AACxH,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAG1D;;;;GAIG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAC7B,6EAA6E;IAC7E,mBAAmB,EAAE,MAAM,CAAA;IAC3B,2EAA2E;IAC3E,iBAAiB,EAAE,MAAM,CAAA;IACzB,6FAA6F;IAC7F,iBAAiB,EAAE,MAAM,CAAA;IACzB,4FAA4F;IA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