@aiquants/virtualscroll 3.10.0 → 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 +59 -0
- package/README.md +41 -12
- package/dist/ScrollBar.d.cts +7 -6
- package/dist/ScrollBar.d.ts +7 -6
- package/dist/ScrollBar.d.ts.map +1 -1
- package/dist/VirtualGrid.d.ts.map +1 -1
- package/dist/VirtualScroll.d.cts +119 -14
- package/dist/VirtualScroll.d.ts +119 -14
- package/dist/VirtualScroll.d.ts.map +1 -1
- package/dist/cli.js +26 -47
- package/dist/index.cjs +1 -1
- package/dist/index.js +2323 -2371
- package/dist/logger.d.cts +1 -16
- package/dist/logger.d.ts +1 -16
- package/dist/logger.d.ts.map +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/package.json +1 -1
- package/src/ScrollBar.tsx +28 -10
- package/src/VirtualGrid.tsx +21 -19
- package/src/VirtualScroll.tsx +402 -209
- package/src/logger.ts +1 -25
- package/src/useFenwickMapTree.ts +60 -98
- package/src/useLruCache.ts +14 -8
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;
|
|
@@ -428,12 +454,13 @@ export type VirtualScrollProps<T> = {
|
|
|
428
454
|
liveRegion?: VirtualScrollLiveRegionOptions;
|
|
429
455
|
/**
|
|
430
456
|
* UI chrome locale of the built-in strings (default `"en"`): the scrollbar's accessible names
|
|
431
|
-
* (the bar, its thumb and its arrows), the scroll-to-edge pills and the empty-state text
|
|
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
|
|
432
459
|
* {@link VirtualScrollLiveRegionOptions.format}). An unsupported value throws a RangeError at
|
|
433
460
|
* render; no language negotiation happens.
|
|
434
|
-
* 内蔵文言 (スクロールバーのアクセシブルネーム — バー・つまみ・矢印 —、端スクロールピル、空状態文言)
|
|
435
|
-
* (既定 `"en"`)。ライブリージョンの文言には影響しない
|
|
436
|
-
* 参照)。非対応値は描画時に RangeError、言語ネゴシエーションなし。
|
|
461
|
+
* 内蔵文言 (スクロールバーのアクセシブルネーム — バー・つまみ・矢印 —、端スクロールピル、空状態文言) と、バーとつまみが
|
|
462
|
+
* 値の文字として持つ百分率の UI クロームロケール (既定 `"en"`)。ライブリージョンの文言には影響しない
|
|
463
|
+
* ({@link VirtualScrollLiveRegionOptions.format} 参照)。非対応値は描画時に RangeError、言語ネゴシエーションなし。
|
|
437
464
|
*/
|
|
438
465
|
locale?: VirtualScrollLocale;
|
|
439
466
|
/**
|
|
@@ -625,6 +652,57 @@ export type AlignedEdge = {
|
|
|
625
652
|
/** Pane position (PANE coordinates) where the aligned row sits at that edge / 揃えた行がその端にあるペイン位置 (ペイン座標) */
|
|
626
653
|
readonly panePosition: number;
|
|
627
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;
|
|
628
706
|
/**
|
|
629
707
|
* Chooses the edge the items-wrapper translate keeps when it is snapped to the device-pixel grid
|
|
630
708
|
* (`snapToDevicePixelGrid`), so that aligned content never loses part of its edge gutter to the snap:
|
|
@@ -659,11 +737,6 @@ export type AlignedEdge = {
|
|
|
659
737
|
* @returns The edge the snapped translate keeps / 揃えた平行移動が守る端
|
|
660
738
|
*/
|
|
661
739
|
export declare const resolveItemsWrapperSnapEdge: (panePosition: number, maxPanePosition: number, alignedEdge: AlignedEdge | null) => DevicePixelSnapEdge;
|
|
662
|
-
/**
|
|
663
|
-
* Retrieves a high-resolution timestamp when available.
|
|
664
|
-
*
|
|
665
|
-
* 高精度タイムスタンプを可能なら取得。
|
|
666
|
-
*/
|
|
667
740
|
/**
|
|
668
741
|
* The first visible row at a logical scroll position (`resolveVisibleStartRow`).
|
|
669
742
|
*
|
|
@@ -683,7 +756,8 @@ export type VisibleStartRow = {
|
|
|
683
756
|
type VisibleStartRowTree = Pick<ReturnType<typeof useFenwickMapTree>, "findIndexAtOrAfter" | "prefixSum">;
|
|
684
757
|
/**
|
|
685
758
|
* Resolves the first visible row at a logical scroll position by the visible-start boundary rule — the one rule that
|
|
686
|
-
* `scrollTo` pins, `getScrollAnchor` reports, `updateItemSize` compensates above and `computeRenderingRanges` renders from
|
|
759
|
+
* `scrollTo` pins, `getScrollAnchor` reports, `updateItemSize` compensates above and `computeRenderingRanges` renders from
|
|
760
|
+
* (on both of its paths, `computeRenderingRangesHuge` included):
|
|
687
761
|
*
|
|
688
762
|
* - the row whose span contains the position: `top <= position < top + height`;
|
|
689
763
|
* - a row whose bottom equals the position lies entirely above the viewport, so the next row starts exactly there and is the
|
|
@@ -694,7 +768,8 @@ type VisibleStartRowTree = Pick<ReturnType<typeof useFenwickMapTree>, "findIndex
|
|
|
694
768
|
* Module-level export (NOT in the package barrel).
|
|
695
769
|
*
|
|
696
770
|
* 先頭の可視行を、可視の先頭の境界の規則で論理スクロール位置から解決する処理。`scrollTo` が留め、`getScrollAnchor` が知らせ、
|
|
697
|
-
* `updateItemSize` がその上の変化を補正し、`computeRenderingRanges`
|
|
771
|
+
* `updateItemSize` がその上の変化を補正し、`computeRenderingRanges` が (`computeRenderingRangesHuge` を含む両方の経路で) 描き
|
|
772
|
+
* 始める、ただ 1 つの規則。
|
|
698
773
|
*
|
|
699
774
|
* - 位置を含む行 (`上端 <= 位置 < 上端 + 高さ`)。
|
|
700
775
|
* - 下端が位置に一致する行は丸ごとビューポートの上にあるので、ちょうどそこから始まる次の行がオフセット 0 で先頭の可視行。
|
|
@@ -709,6 +784,36 @@ type VisibleStartRowTree = Pick<ReturnType<typeof useFenwickMapTree>, "findIndex
|
|
|
709
784
|
* @returns The first visible row and its logical top / 先頭の可視行とその論理上端
|
|
710
785
|
*/
|
|
711
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
|
+
};
|
|
712
817
|
/**
|
|
713
818
|
* Calculates rendering boundaries from current scroll metrics. The visible rows start at the row `resolveVisibleStartRow`
|
|
714
819
|
* resolves.
|
|
@@ -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;IAC5F,eAAe,EAAE,MAAM,CAAA;IACvB,qDAAqD;IACrD,cAAc,EAAE,MAAM,CAAA;IACtB,0DAA0D;IAC1D,WAAW,EAAE,MAAM,CAAA;CACtB,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,MAAM,4BAA4B,GAAG,aAAa,GAAG,gBAAgB,GAAG,OAAO,GAAG,UAAU,CAAA;AAElG;;;;GAIG;AACH,MAAM,MAAM,uBAAuB,GAAG;IAClC,yJAAyJ;IACzJ,QAAQ,CA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@ import { spawn as o } from "node:child_process";
|
|
|
3
3
|
import { realpathSync as a, existsSync as l } from "node:fs";
|
|
4
4
|
import n from "node:path";
|
|
5
5
|
import { fileURLToPath as c, pathToFileURL as m } from "node:url";
|
|
6
|
-
class
|
|
6
|
+
class r {
|
|
7
7
|
level;
|
|
8
8
|
prefix;
|
|
9
9
|
impl;
|
|
@@ -13,10 +13,10 @@ class i {
|
|
|
13
13
|
* @param {string} [prefix="[virtualscroll]"] - The prefix to add to all log messages.
|
|
14
14
|
* @param {ILogger} [impl=console] - The implementation to use for logging.
|
|
15
15
|
*/
|
|
16
|
-
constructor(e = 2, t = "[virtualscroll]",
|
|
17
|
-
this.level = e, this.prefix = t, this.impl =
|
|
16
|
+
constructor(e = 2, t = "[virtualscroll]", i = console) {
|
|
17
|
+
this.level = e, this.prefix = t, this.impl = i;
|
|
18
18
|
}
|
|
19
|
-
static instance = new
|
|
19
|
+
static instance = new r(2, "[virtualscroll]");
|
|
20
20
|
/**
|
|
21
21
|
* @method setLevel
|
|
22
22
|
* @description Updates the current log level for the static instance.
|
|
@@ -24,7 +24,7 @@ class i {
|
|
|
24
24
|
* @param {LogLevel} level - The new log level.
|
|
25
25
|
*/
|
|
26
26
|
static setLevel(e) {
|
|
27
|
-
|
|
27
|
+
r.instance.setLevel(e);
|
|
28
28
|
}
|
|
29
29
|
/**
|
|
30
30
|
* @method setLevel
|
|
@@ -42,7 +42,7 @@ class i {
|
|
|
42
42
|
* @param {ILogger} impl - The new logger implementation.
|
|
43
43
|
*/
|
|
44
44
|
static setImplementation(e) {
|
|
45
|
-
|
|
45
|
+
r.instance.setImplementation(e);
|
|
46
46
|
}
|
|
47
47
|
/**
|
|
48
48
|
* @method setImplementation
|
|
@@ -53,24 +53,6 @@ class i {
|
|
|
53
53
|
setImplementation(e) {
|
|
54
54
|
this.impl = e;
|
|
55
55
|
}
|
|
56
|
-
/**
|
|
57
|
-
* @method setPrefix
|
|
58
|
-
* @description Updates the log prefix for the static instance.
|
|
59
|
-
* @description 静的インスタンスのログのプレフィックスを更新します。
|
|
60
|
-
* @param {string} prefix - The new prefix.
|
|
61
|
-
*/
|
|
62
|
-
static setPrefix(e) {
|
|
63
|
-
i.instance.setPrefix(e);
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* @method setPrefix
|
|
67
|
-
* @description Updates the log prefix.
|
|
68
|
-
* @description ログのプレフィックスを更新します。
|
|
69
|
-
* @param {string} prefix - The new prefix.
|
|
70
|
-
*/
|
|
71
|
-
setPrefix(e) {
|
|
72
|
-
this.prefix = e;
|
|
73
|
-
}
|
|
74
56
|
/**
|
|
75
57
|
* @method isEnabled
|
|
76
58
|
* @description Returns whether the given level would be emitted at the current level (static instance).
|
|
@@ -79,7 +61,7 @@ class i {
|
|
|
79
61
|
* @returns {boolean} True if a message at `level` would be emitted. / `level` のメッセージが出力されるなら true。
|
|
80
62
|
*/
|
|
81
63
|
static isEnabled(e) {
|
|
82
|
-
return
|
|
64
|
+
return r.instance.isEnabled(e);
|
|
83
65
|
}
|
|
84
66
|
/**
|
|
85
67
|
* @method isEnabled
|
|
@@ -124,34 +106,31 @@ class i {
|
|
|
124
106
|
return typeof e == "string" ? [`${this.prefix} ${e}`] : [this.prefix, e];
|
|
125
107
|
}
|
|
126
108
|
static debug(e, ...t) {
|
|
127
|
-
|
|
109
|
+
r.instance.debug(e, ...t);
|
|
128
110
|
}
|
|
129
111
|
debug(e, ...t) {
|
|
130
|
-
this.level <= 0 && this.impl.debug(...this.formatMessage(
|
|
131
|
-
}
|
|
132
|
-
static info(e, ...t) {
|
|
133
|
-
i.instance.info(e, ...t);
|
|
112
|
+
this.level <= 0 && this.impl.debug(...this.formatMessage(r.resolveLazy(e)), ...t.map(r.resolveLazy));
|
|
134
113
|
}
|
|
135
114
|
info(e, ...t) {
|
|
136
|
-
this.level <= 1 && this.impl.info(...this.formatMessage(
|
|
115
|
+
this.level <= 1 && this.impl.info(...this.formatMessage(r.resolveLazy(e)), ...t.map(r.resolveLazy));
|
|
137
116
|
}
|
|
138
117
|
static warn(e, ...t) {
|
|
139
|
-
|
|
118
|
+
r.instance.warn(e, ...t);
|
|
140
119
|
}
|
|
141
120
|
warn(e, ...t) {
|
|
142
|
-
this.level <= 2 && this.impl.warn(...this.formatMessage(
|
|
121
|
+
this.level <= 2 && this.impl.warn(...this.formatMessage(r.resolveLazy(e)), ...t.map(r.resolveLazy));
|
|
143
122
|
}
|
|
144
123
|
static error(e, ...t) {
|
|
145
|
-
|
|
124
|
+
r.instance.error(e, ...t);
|
|
146
125
|
}
|
|
147
126
|
error(e, ...t) {
|
|
148
|
-
this.level <= 3 && this.impl.error(...this.formatMessage(
|
|
127
|
+
this.level <= 3 && this.impl.error(...this.formatMessage(r.resolveLazy(e)), ...t.map(r.resolveLazy));
|
|
149
128
|
}
|
|
150
129
|
}
|
|
151
|
-
const p = c(import.meta.url),
|
|
152
|
-
function d(
|
|
153
|
-
if (
|
|
154
|
-
const e = n.join(
|
|
130
|
+
const p = c(import.meta.url), h = n.dirname(p), f = "Usage: npx @aiquants/virtualscroll demo";
|
|
131
|
+
function d(s) {
|
|
132
|
+
if (s[0] === "demo") {
|
|
133
|
+
const e = n.join(h, "..", "demo");
|
|
155
134
|
l(e) || (console.error(
|
|
156
135
|
`The 'demo' command is only available in a source checkout of @aiquants/virtualscroll.
|
|
157
136
|
The demo app is not bundled in the published npm package.
|
|
@@ -163,20 +142,20 @@ To run it, clone the repository and inside the 'demo/' directory run:
|
|
|
163
142
|
stdio: "inherit",
|
|
164
143
|
shell: process.platform === "win32"
|
|
165
144
|
});
|
|
166
|
-
t.on("close", (
|
|
167
|
-
|
|
168
|
-
}), t.on("error", (
|
|
169
|
-
|
|
145
|
+
t.on("close", (i) => {
|
|
146
|
+
i !== 0 && (r.error(`Demo server process exited with code ${i}`), process.exitCode = i ?? 1);
|
|
147
|
+
}), t.on("error", (i) => {
|
|
148
|
+
r.error("Failed to start demo server:", i), process.exitCode = 1;
|
|
170
149
|
});
|
|
171
150
|
} else
|
|
172
|
-
|
|
151
|
+
s.length > 0 && console.error(`Unknown command: ${s[0]}`), console.error(f), process.exit(1);
|
|
173
152
|
}
|
|
174
153
|
function u() {
|
|
175
|
-
const
|
|
176
|
-
if (!
|
|
154
|
+
const s = process.argv[1];
|
|
155
|
+
if (!s)
|
|
177
156
|
return !1;
|
|
178
157
|
try {
|
|
179
|
-
return m(a(
|
|
158
|
+
return m(a(s)).href === import.meta.url;
|
|
180
159
|
} catch {
|
|
181
160
|
return !1;
|
|
182
161
|
}
|