@aiquants/virtualscroll 3.6.0 → 3.7.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.
@@ -0,0 +1,125 @@
1
+ /**
2
+ * @module labels
3
+ * @description Built-in UI chrome label catalog of the package. Covers exactly the seven strings
4
+ * the components render on their own: the ScrollBar arrow aria-labels, the VirtualScroll
5
+ * scroll-to-edge pill texts and the empty-state text. Live-region wording stays consumer-owned
6
+ * (`liveRegion.format` / `liveRegion.buildMessage`) and is not part of this catalog. The default
7
+ * locale is `"en"`; `"ja"` is the second locale. No language negotiation happens here: hosts map
8
+ * `navigator.language` (or anything else) to a supported locale themselves.
9
+ *
10
+ * @description パッケージ内蔵の UI クローム文言カタログ。コンポーネント自身が描画する 7 文言
11
+ * (ScrollBar 矢印の aria-label、VirtualScroll の端スクロールピル文言、空状態文言) だけを対象とし、
12
+ * ライブリージョンの文言は利用側の所有 (`liveRegion.format` / `liveRegion.buildMessage`) で
13
+ * 本カタログの対象外。既定ロケールは `"en"`、第 2 ロケールは `"ja"`。言語ネゴシエーションは行わず、
14
+ * `navigator.language` 等から対応ロケールへの対応付けはホスト側の責務。
15
+ */
16
+ /**
17
+ * Supported UI chrome locales, in declaration order. The first entry is NOT implicitly the
18
+ * default — the default lives only in {@link resolveVirtualScrollLocale}.
19
+ * 対応する UI クロームロケールの一覧 (宣言順)。先頭要素が暗黙の既定値になるわけではなく、
20
+ * 既定値は {@link resolveVirtualScrollLocale} にのみ存在。
21
+ */
22
+ export declare const VIRTUAL_SCROLL_LOCALES: readonly ["en", "ja"];
23
+ /**
24
+ * A supported UI chrome locale (`"en"` | `"ja"`).
25
+ * 対応 UI クロームロケール (`"en"` | `"ja"`)。
26
+ */
27
+ export type VirtualScrollLocale = (typeof VIRTUAL_SCROLL_LOCALES)[number];
28
+ /**
29
+ * The complete set of built-in chrome strings, one value per rendered surface.
30
+ * 内蔵クローム文言の完全な集合 (描画面ごとに 1 値)。
31
+ */
32
+ export type VirtualScrollLabels = {
33
+ /**
34
+ * aria-label of the vertical ScrollBar start (up) arrow button.
35
+ * 縦 ScrollBar 始端 (上) 矢印ボタンの aria-label。
36
+ */
37
+ readonly scrollUp: string;
38
+ /**
39
+ * aria-label of the vertical ScrollBar end (down) arrow button.
40
+ * 縦 ScrollBar 終端 (下) 矢印ボタンの aria-label。
41
+ */
42
+ readonly scrollDown: string;
43
+ /**
44
+ * aria-label of the horizontal ScrollBar start (left) arrow button.
45
+ * 横 ScrollBar 始端 (左) 矢印ボタンの aria-label。
46
+ */
47
+ readonly scrollLeft: string;
48
+ /**
49
+ * aria-label of the horizontal ScrollBar end (right) arrow button.
50
+ * 横 ScrollBar 終端 (右) 矢印ボタンの aria-label。
51
+ */
52
+ readonly scrollRight: string;
53
+ /**
54
+ * Text of the VirtualScroll scroll-to-top pill, shown when
55
+ * `scrollBarOptions.enableScrollToTopBottomButtons` is on.
56
+ * `scrollBarOptions.enableScrollToTopBottomButtons` 有効時に表示される VirtualScroll 先頭移動ピルの文言。
57
+ */
58
+ readonly scrollToTop: string;
59
+ /**
60
+ * Text of the VirtualScroll scroll-to-bottom pill, shown when
61
+ * `scrollBarOptions.enableScrollToTopBottomButtons` is on.
62
+ * `scrollBarOptions.enableScrollToTopBottomButtons` 有効時に表示される VirtualScroll 末尾移動ピルの文言。
63
+ */
64
+ readonly scrollToBottom: string;
65
+ /**
66
+ * VirtualScroll empty-state text shown when `itemCount === 0`. VirtualGrid shows it too, for
67
+ * 0 rows, an all-frozen row set and degenerate bands (its embedded VirtualScroll gets 0 items).
68
+ * `itemCount === 0` 時の VirtualScroll 空状態文言。VirtualGrid も 0 行・全行固定・退化帯で表示
69
+ * (内蔵 VirtualScroll の項目数が 0 になるため)。
70
+ */
71
+ readonly noItems: string;
72
+ };
73
+ /**
74
+ * Partial per-key overrides laid over the catalog of the chosen locale. An `undefined` value keeps
75
+ * the catalog value; any present value must be a string with non-whitespace content.
76
+ * 選択ロケールのカタログへ重ねるキー単位の部分上書き。`undefined` 値はカタログ値を維持し、
77
+ * 値を与える場合は空白以外の文字を含む文字列であることが必須。
78
+ */
79
+ export type VirtualScrollLabelOverrides = {
80
+ readonly [K in keyof VirtualScrollLabels]?: VirtualScrollLabels[K];
81
+ };
82
+ /**
83
+ * Every key of {@link VirtualScrollLabels}, in catalog order. This is the closed key set that
84
+ * overrides are validated against.
85
+ * {@link VirtualScrollLabels} の全キー (カタログ順)。上書き検証に用いる閉じたキー集合。
86
+ */
87
+ export declare const VIRTUAL_SCROLL_LABEL_KEYS: readonly ["scrollUp", "scrollDown", "scrollLeft", "scrollRight", "scrollToTop", "scrollToBottom", "noItems"];
88
+ /**
89
+ * Frozen built-in catalogs per locale. `en` is the package's historical English wording.
90
+ * ロケールごとの凍結済み内蔵カタログ。`en` はパッケージ従来の英語文言。
91
+ */
92
+ export declare const VIRTUAL_SCROLL_LABEL_CATALOGS: Readonly<Record<VirtualScrollLocale, VirtualScrollLabels>>;
93
+ /**
94
+ * Resolves the UI chrome locale. `undefined` (an absent prop) maps to the default `"en"`; a member
95
+ * of {@link VIRTUAL_SCROLL_LOCALES} is returned as-is. This is the single place the default lives.
96
+ * UI クロームロケールの解決。`undefined` (prop 未指定) は既定の `"en"`、
97
+ * {@link VIRTUAL_SCROLL_LOCALES} の要素はそのまま返却。既定値を持つ唯一の場所。
98
+ *
99
+ * @param locale - Requested locale, or `undefined` for the default / 要求ロケール (`undefined` で既定)
100
+ * @returns The resolved supported locale / 解決済みの対応ロケール
101
+ * @throws {RangeError} When `locale` is neither `undefined` nor a supported locale (`null`, `""`,
102
+ * `"EN"`, `"ja-JP"`, `"fr"`, numbers, ...) — no language negotiation /
103
+ * `undefined` でも対応ロケールでもない場合 (`null`、`""`、`"EN"`、`"ja-JP"`、`"fr"`、数値など)。言語ネゴシエーションなし
104
+ */
105
+ export declare const resolveVirtualScrollLocale: (locale: VirtualScrollLocale | undefined) => VirtualScrollLocale;
106
+ /**
107
+ * Resolves the effective labels: the catalog of the resolved locale overlaid by `overrides`.
108
+ * Returns the frozen catalog itself (same identity) when `overrides` is `undefined`, otherwise a
109
+ * new frozen object. Inputs are never mutated.
110
+ * 実効ラベルの解決。解決済みロケールのカタログへ `overrides` を重ねた結果。`overrides` が
111
+ * `undefined` なら凍結カタログそのもの (同一参照)、それ以外は新しい凍結オブジェクトを返却。入力は不変。
112
+ *
113
+ * @param locale - Requested locale, or `undefined` for the default / 要求ロケール (`undefined` で既定)
114
+ * @param overrides - Per-key overrides, or `undefined` for none / キー単位の上書き (`undefined` で上書きなし)
115
+ * @returns The resolved, frozen labels / 解決済みの凍結ラベル
116
+ * @throws {RangeError} When the locale is unsupported, `overrides` is `null` or not an object,
117
+ * `overrides` is not a plain object (its prototype is neither `Object.prototype` nor `null`, e.g.
118
+ * an array or a class instance), an own key is not a label key, or a present own value is not a
119
+ * string with non-whitespace content. Only own properties are read /
120
+ * ロケールが非対応、`overrides` が `null` または非オブジェクト、`overrides` が素のオブジェクトでない
121
+ * (プロトタイプが `Object.prototype` でも `null` でもない。配列やクラスインスタンスなど)、自身のキーが
122
+ * ラベルキー外、または与えられた自身の値が空白以外の文字を含む文字列でない場合。読むのは自身の
123
+ * プロパティのみ
124
+ */
125
+ export declare const resolveVirtualScrollLabels: (locale: VirtualScrollLocale | undefined, overrides: VirtualScrollLabelOverrides | undefined) => VirtualScrollLabels;
@@ -0,0 +1,126 @@
1
+ /**
2
+ * @module labels
3
+ * @description Built-in UI chrome label catalog of the package. Covers exactly the seven strings
4
+ * the components render on their own: the ScrollBar arrow aria-labels, the VirtualScroll
5
+ * scroll-to-edge pill texts and the empty-state text. Live-region wording stays consumer-owned
6
+ * (`liveRegion.format` / `liveRegion.buildMessage`) and is not part of this catalog. The default
7
+ * locale is `"en"`; `"ja"` is the second locale. No language negotiation happens here: hosts map
8
+ * `navigator.language` (or anything else) to a supported locale themselves.
9
+ *
10
+ * @description パッケージ内蔵の UI クローム文言カタログ。コンポーネント自身が描画する 7 文言
11
+ * (ScrollBar 矢印の aria-label、VirtualScroll の端スクロールピル文言、空状態文言) だけを対象とし、
12
+ * ライブリージョンの文言は利用側の所有 (`liveRegion.format` / `liveRegion.buildMessage`) で
13
+ * 本カタログの対象外。既定ロケールは `"en"`、第 2 ロケールは `"ja"`。言語ネゴシエーションは行わず、
14
+ * `navigator.language` 等から対応ロケールへの対応付けはホスト側の責務。
15
+ */
16
+ /**
17
+ * Supported UI chrome locales, in declaration order. The first entry is NOT implicitly the
18
+ * default — the default lives only in {@link resolveVirtualScrollLocale}.
19
+ * 対応する UI クロームロケールの一覧 (宣言順)。先頭要素が暗黙の既定値になるわけではなく、
20
+ * 既定値は {@link resolveVirtualScrollLocale} にのみ存在。
21
+ */
22
+ export declare const VIRTUAL_SCROLL_LOCALES: readonly ["en", "ja"];
23
+ /**
24
+ * A supported UI chrome locale (`"en"` | `"ja"`).
25
+ * 対応 UI クロームロケール (`"en"` | `"ja"`)。
26
+ */
27
+ export type VirtualScrollLocale = (typeof VIRTUAL_SCROLL_LOCALES)[number];
28
+ /**
29
+ * The complete set of built-in chrome strings, one value per rendered surface.
30
+ * 内蔵クローム文言の完全な集合 (描画面ごとに 1 値)。
31
+ */
32
+ export type VirtualScrollLabels = {
33
+ /**
34
+ * aria-label of the vertical ScrollBar start (up) arrow button.
35
+ * 縦 ScrollBar 始端 (上) 矢印ボタンの aria-label。
36
+ */
37
+ readonly scrollUp: string;
38
+ /**
39
+ * aria-label of the vertical ScrollBar end (down) arrow button.
40
+ * 縦 ScrollBar 終端 (下) 矢印ボタンの aria-label。
41
+ */
42
+ readonly scrollDown: string;
43
+ /**
44
+ * aria-label of the horizontal ScrollBar start (left) arrow button.
45
+ * 横 ScrollBar 始端 (左) 矢印ボタンの aria-label。
46
+ */
47
+ readonly scrollLeft: string;
48
+ /**
49
+ * aria-label of the horizontal ScrollBar end (right) arrow button.
50
+ * 横 ScrollBar 終端 (右) 矢印ボタンの aria-label。
51
+ */
52
+ readonly scrollRight: string;
53
+ /**
54
+ * Text of the VirtualScroll scroll-to-top pill, shown when
55
+ * `scrollBarOptions.enableScrollToTopBottomButtons` is on.
56
+ * `scrollBarOptions.enableScrollToTopBottomButtons` 有効時に表示される VirtualScroll 先頭移動ピルの文言。
57
+ */
58
+ readonly scrollToTop: string;
59
+ /**
60
+ * Text of the VirtualScroll scroll-to-bottom pill, shown when
61
+ * `scrollBarOptions.enableScrollToTopBottomButtons` is on.
62
+ * `scrollBarOptions.enableScrollToTopBottomButtons` 有効時に表示される VirtualScroll 末尾移動ピルの文言。
63
+ */
64
+ readonly scrollToBottom: string;
65
+ /**
66
+ * VirtualScroll empty-state text shown when `itemCount === 0`. VirtualGrid shows it too, for
67
+ * 0 rows, an all-frozen row set and degenerate bands (its embedded VirtualScroll gets 0 items).
68
+ * `itemCount === 0` 時の VirtualScroll 空状態文言。VirtualGrid も 0 行・全行固定・退化帯で表示
69
+ * (内蔵 VirtualScroll の項目数が 0 になるため)。
70
+ */
71
+ readonly noItems: string;
72
+ };
73
+ /**
74
+ * Partial per-key overrides laid over the catalog of the chosen locale. An `undefined` value keeps
75
+ * the catalog value; any present value must be a string with non-whitespace content.
76
+ * 選択ロケールのカタログへ重ねるキー単位の部分上書き。`undefined` 値はカタログ値を維持し、
77
+ * 値を与える場合は空白以外の文字を含む文字列であることが必須。
78
+ */
79
+ export type VirtualScrollLabelOverrides = {
80
+ readonly [K in keyof VirtualScrollLabels]?: VirtualScrollLabels[K];
81
+ };
82
+ /**
83
+ * Every key of {@link VirtualScrollLabels}, in catalog order. This is the closed key set that
84
+ * overrides are validated against.
85
+ * {@link VirtualScrollLabels} の全キー (カタログ順)。上書き検証に用いる閉じたキー集合。
86
+ */
87
+ export declare const VIRTUAL_SCROLL_LABEL_KEYS: readonly ["scrollUp", "scrollDown", "scrollLeft", "scrollRight", "scrollToTop", "scrollToBottom", "noItems"];
88
+ /**
89
+ * Frozen built-in catalogs per locale. `en` is the package's historical English wording.
90
+ * ロケールごとの凍結済み内蔵カタログ。`en` はパッケージ従来の英語文言。
91
+ */
92
+ export declare const VIRTUAL_SCROLL_LABEL_CATALOGS: Readonly<Record<VirtualScrollLocale, VirtualScrollLabels>>;
93
+ /**
94
+ * Resolves the UI chrome locale. `undefined` (an absent prop) maps to the default `"en"`; a member
95
+ * of {@link VIRTUAL_SCROLL_LOCALES} is returned as-is. This is the single place the default lives.
96
+ * UI クロームロケールの解決。`undefined` (prop 未指定) は既定の `"en"`、
97
+ * {@link VIRTUAL_SCROLL_LOCALES} の要素はそのまま返却。既定値を持つ唯一の場所。
98
+ *
99
+ * @param locale - Requested locale, or `undefined` for the default / 要求ロケール (`undefined` で既定)
100
+ * @returns The resolved supported locale / 解決済みの対応ロケール
101
+ * @throws {RangeError} When `locale` is neither `undefined` nor a supported locale (`null`, `""`,
102
+ * `"EN"`, `"ja-JP"`, `"fr"`, numbers, ...) — no language negotiation /
103
+ * `undefined` でも対応ロケールでもない場合 (`null`、`""`、`"EN"`、`"ja-JP"`、`"fr"`、数値など)。言語ネゴシエーションなし
104
+ */
105
+ export declare const resolveVirtualScrollLocale: (locale: VirtualScrollLocale | undefined) => VirtualScrollLocale;
106
+ /**
107
+ * Resolves the effective labels: the catalog of the resolved locale overlaid by `overrides`.
108
+ * Returns the frozen catalog itself (same identity) when `overrides` is `undefined`, otherwise a
109
+ * new frozen object. Inputs are never mutated.
110
+ * 実効ラベルの解決。解決済みロケールのカタログへ `overrides` を重ねた結果。`overrides` が
111
+ * `undefined` なら凍結カタログそのもの (同一参照)、それ以外は新しい凍結オブジェクトを返却。入力は不変。
112
+ *
113
+ * @param locale - Requested locale, or `undefined` for the default / 要求ロケール (`undefined` で既定)
114
+ * @param overrides - Per-key overrides, or `undefined` for none / キー単位の上書き (`undefined` で上書きなし)
115
+ * @returns The resolved, frozen labels / 解決済みの凍結ラベル
116
+ * @throws {RangeError} When the locale is unsupported, `overrides` is `null` or not an object,
117
+ * `overrides` is not a plain object (its prototype is neither `Object.prototype` nor `null`, e.g.
118
+ * an array or a class instance), an own key is not a label key, or a present own value is not a
119
+ * string with non-whitespace content. Only own properties are read /
120
+ * ロケールが非対応、`overrides` が `null` または非オブジェクト、`overrides` が素のオブジェクトでない
121
+ * (プロトタイプが `Object.prototype` でも `null` でもない。配列やクラスインスタンスなど)、自身のキーが
122
+ * ラベルキー外、または与えられた自身の値が空白以外の文字を含む文字列でない場合。読むのは自身の
123
+ * プロパティのみ
124
+ */
125
+ export declare const resolveVirtualScrollLabels: (locale: VirtualScrollLocale | undefined, overrides: VirtualScrollLabelOverrides | undefined) => VirtualScrollLabels;
126
+ //# sourceMappingURL=labels.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"labels.d.ts","sourceRoot":"","sources":["../src/labels.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB,uBAAwB,CAAA;AAE3D;;;GAGG;AACH,MAAM,MAAM,mBAAmB,GAAG,CAAC,OAAO,sBAAsB,CAAC,CAAC,MAAM,CAAC,CAAA;AAEzE;;;GAGG;AACH,MAAM,MAAM,mBAAmB,GAAG;IAC9B;;;OAGG;IACH,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB;;;OAGG;IACH,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;IAC3B;;;OAGG;IACH,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;IAC3B;;;OAGG;IACH,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;IAC5B;;;;OAIG;IACH,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;IAC5B;;;;OAIG;IACH,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAA;IAC/B;;;;;OAKG;IACH,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;CAC3B,CAAA;AAED;;;;;GAKG;AACH,MAAM,MAAM,2BAA2B,GAAG;IAAE,QAAQ,EAAE,CAAC,IAAI,MAAM,mBAAmB,CAAC,CAAC,EAAE,mBAAmB,CAAC,CAAC,CAAC;CAAE,CAAA;AAEhH;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,8GAAgK,CAAA;AAMtM;;;GAGG;AACH,eAAO,MAAM,6BAA6B,EAAE,QAAQ,CAAC,MAAM,CAAC,mBAAmB,EAAE,mBAAmB,CAAC,CAmBnG,CAAA;AAiCF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,0BAA0B,GAAI,QAAQ,mBAAmB,GAAG,SAAS,KAAG,mBASpF,CAAA;AAWD;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,0BAA0B,GAAI,QAAQ,mBAAmB,GAAG,SAAS,EAAE,WAAW,2BAA2B,GAAG,SAAS,KAAG,mBAiCxI,CAAA"}
@@ -39,7 +39,7 @@ export type UseGridTapScrollParams = {
39
39
  getMaxHx: () => number;
40
40
  /** y apply seam: wraps `scrollBy(delta)` AND syncs `vyRef.current = applied` before returning (§3.5-8 — NOT a bare handle passthrough). / y 適用シーム: `scrollBy(delta)` をラップし `vyRef.current = applied` を同期してから返す (§3.5-8 — 素のハンドル素通しではない)。 */
41
41
  applyVy: (delta: number) => number;
42
- /** Synchronous-fresh vy read. / vy の同期・最新読み。 */
42
+ /** Synchronous-fresh vy read — MUST read the same authority `applyVy` resolves against (the embedded pane's position), never a notification mirror with a second writer (v3.6.1 — a lagging mirror base overstates `actualDelta` and drives the residual negative = yo-yo). / vy の同期・最新読み — `applyVy` が解決するのと同一権威 (埋め込みペイン位置) を読むこと。第 2 の書き手を持つ通知鏡像は禁止 (v3.6.1 — 遅延鏡像基準は `actualDelta` を過大化し残差を負へ落とすヨーヨー)。 */
43
43
  getVy: () => number;
44
44
  /** y extent read through the embedded handle's freshness channel (never re-derived). / 埋め込みハンドルの鮮度チャネル経由の y 延長 (再導出禁止)。 */
45
45
  getMaxVy: () => number;
@@ -39,7 +39,7 @@ export type UseGridTapScrollParams = {
39
39
  getMaxHx: () => number;
40
40
  /** y apply seam: wraps `scrollBy(delta)` AND syncs `vyRef.current = applied` before returning (§3.5-8 — NOT a bare handle passthrough). / y 適用シーム: `scrollBy(delta)` をラップし `vyRef.current = applied` を同期してから返す (§3.5-8 — 素のハンドル素通しではない)。 */
41
41
  applyVy: (delta: number) => number;
42
- /** Synchronous-fresh vy read. / vy の同期・最新読み。 */
42
+ /** Synchronous-fresh vy read — MUST read the same authority `applyVy` resolves against (the embedded pane's position), never a notification mirror with a second writer (v3.6.1 — a lagging mirror base overstates `actualDelta` and drives the residual negative = yo-yo). / vy の同期・最新読み — `applyVy` が解決するのと同一権威 (埋め込みペイン位置) を読むこと。第 2 の書き手を持つ通知鏡像は禁止 (v3.6.1 — 遅延鏡像基準は `actualDelta` を過大化し残差を負へ落とすヨーヨー)。 */
43
43
  getVy: () => number;
44
44
  /** y extent read through the embedded handle's freshness channel (never re-derived). / 埋め込みハンドルの鮮度チャネル経由の y 延長 (再導出禁止)。 */
45
45
  getMaxVy: () => number;
@@ -1 +1 @@
1
- {"version":3,"file":"useGridTapScroll.d.ts","sourceRoot":"","sources":["../src/useGridTapScroll.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,EAA4B,KAAK,wBAAwB,EAAE,MAAM,+BAA+B,CAAA;AAEvG,OAAO,KAAK,EAAE,wBAAwB,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAA;AAG5F;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,8BAA8B,OAAO,CAAA;AAalD,4MAA4M;AAC5M,MAAM,MAAM,sBAAsB,GAAG;IACjC,uIAAuI;IACvI,OAAO,EAAE,OAAO,CAAA;IAChB,mGAAmG;IACnG,WAAW,EAAE,MAAM,CAAA;IACnB,oEAAoE;IACpE,YAAY,EAAE,wBAAwB,CAAA;IACtC,oEAAoE;IACpE,YAAY,EAAE,wBAAwB,CAAA;IACtC,sHAAsH;IACtH,UAAU,EAAE;QAAE,QAAQ,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAA;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"version": "3.7.0",
4
4
  "description": "High-performance virtual scrolling component for React with variable item heights",
5
5
  "sideEffects": [
6
6
  "**/*.css"
package/src/ScrollBar.tsx CHANGED
@@ -6,6 +6,7 @@
6
6
  import type { CSSProperties, ReactNode } from "react"
7
7
  import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from "react"
8
8
  import { twMerge } from "tailwind-merge"
9
+ import { resolveVirtualScrollLabels, type VirtualScrollLabelOverrides, type VirtualScrollLocale } from "./labels.ts"
9
10
  import { Logger } from "./logger.ts"
10
11
  import { TapScrollCircle, type TapScrollCircleDragState, type TapScrollCircleHandle, type TapScrollCircleRenderProps } from "./TapScrollCircle.tsx"
11
12
  import { getAxisScale, minmax } from "./utils.ts"
@@ -21,7 +22,6 @@ type OrientationConfig = {
21
22
  positionKey: "left" | "top"
22
23
  selectDelta: (deltaX: number, deltaY: number) => number
23
24
  getPointerCoordinate: (point: { clientX: number; clientY: number }) => number
24
- arrowLabels: [string, string]
25
25
  arrowIcons: [string, string]
26
26
  directionClass: string
27
27
  orientation: "vertical" | "horizontal"
@@ -193,6 +193,21 @@ export type ScrollBarProps = {
193
193
  visibleStartIndex?: number
194
194
  /** The index of the last visible item. / 最後の可視アイテムのインデックス。 */
195
195
  visibleEndIndex?: number
196
+ /**
197
+ * UI chrome locale of the built-in arrow aria-labels (default `"en"`). An unsupported value
198
+ * throws a RangeError at render; no language negotiation happens.
199
+ * 内蔵矢印 aria-label の UI クロームロケール (既定 `"en"`)。非対応値は描画時に RangeError、
200
+ * 言語ネゴシエーションなし。
201
+ */
202
+ locale?: VirtualScrollLocale
203
+ /**
204
+ * Per-key overrides laid over the catalog of `locale`. This bar reads `scrollUp` / `scrollDown`
205
+ * (vertical) or `scrollLeft` / `scrollRight` (horizontal); unknown keys and blank values throw a
206
+ * RangeError at render.
207
+ * `locale` のカタログへ重ねるキー単位の上書き。本バーが読むのは縦なら `scrollUp` / `scrollDown`、
208
+ * 横なら `scrollLeft` / `scrollRight`。未知キーと空白値は描画時に RangeError。
209
+ */
210
+ labels?: VirtualScrollLabelOverrides
196
211
  }
197
212
 
198
213
  /** The minimum size of the scrollbar thumb. / スクロールバーのつまみの最小サイズ。 */
@@ -255,7 +270,6 @@ const createOrientationConfig = (horizontal: boolean): OrientationConfig => {
255
270
  positionKey: "left",
256
271
  selectDelta: (deltaX: number, _deltaY: number) => deltaX,
257
272
  getPointerCoordinate: ({ clientX }) => clientX,
258
- arrowLabels: ["Scroll left", "Scroll right"],
259
273
  arrowIcons: ["◀", "▶"],
260
274
  directionClass: "aqvs-scrollbar-horizontal",
261
275
  orientation: "horizontal",
@@ -268,7 +282,6 @@ const createOrientationConfig = (horizontal: boolean): OrientationConfig => {
268
282
  positionKey: "top",
269
283
  selectDelta: (_deltaX: number, deltaY: number) => deltaY,
270
284
  getPointerCoordinate: ({ clientY }) => clientY,
271
- arrowLabels: ["Scroll up", "Scroll down"],
272
285
  arrowIcons: ["▲", "▼"],
273
286
  directionClass: "aqvs-scrollbar-vertical",
274
287
  orientation: "vertical",
@@ -608,6 +621,8 @@ export const ScrollBar = ({
608
621
  renderThumbOverlay,
609
622
  visibleStartIndex,
610
623
  visibleEndIndex,
624
+ locale,
625
+ labels,
611
626
  }: ScrollBarProps) => {
612
627
  const [isDragging, setIsDragging] = useState(false)
613
628
  const [isThumbHovered, setIsThumbHovered] = useState(false)
@@ -635,6 +650,8 @@ export const ScrollBar = ({
635
650
  const autoScrollDirectionRef = useRef<0 | 1 | -1>(0)
636
651
  const resolvedTapScrollOptions = useMemo<ResolvedTapScrollCircleOptions>(() => resolveTapScrollCircleOptions(tapScrollCircleOptions, itemCount), [itemCount, tapScrollCircleOptions])
637
652
  const orientationConfig = useMemo(() => createOrientationConfig(horizontal), [horizontal])
653
+ const resolvedLabels = useMemo(() => resolveVirtualScrollLabels(locale, labels), [locale, labels])
654
+ const arrowLabels = horizontal ? ([resolvedLabels.scrollLeft, resolvedLabels.scrollRight] as const) : ([resolvedLabels.scrollUp, resolvedLabels.scrollDown] as const)
638
655
  const {
639
656
  enabled: tapCircleEnabled,
640
657
  size: tapCircleSize,
@@ -661,7 +678,7 @@ export const ScrollBar = ({
661
678
  onScroll,
662
679
  scrollPosition,
663
680
  })
664
- const { mainSizeKey, crossSizeKey, positionKey, selectDelta, getPointerCoordinate, arrowLabels, arrowIcons, directionClass, orientation } = orientationConfig
681
+ const { mainSizeKey, crossSizeKey, positionKey, selectDelta, getPointerCoordinate, arrowIcons, directionClass, orientation } = orientationConfig
665
682
  const effectiveTapMaxDistance = Math.max(tapCircleMaxDistance, 1)
666
683
  // 表示領域に対するコンテンツの比率
667
684
  const scrollRatio = viewportSize / contentSize
@@ -1,5 +1,6 @@
1
1
  import { forwardRef, useCallback, useEffect, useId, useImperativeHandle, useLayoutEffect, useMemo, useRef, useState } from "react"
2
2
  import { twMerge } from "tailwind-merge"
3
+ import type { VirtualScrollLabelOverrides, VirtualScrollLocale } from "./labels.ts"
3
4
  import { Logger } from "./logger.ts"
4
5
  import { ScrollBar, type ScrollBarTapCircleOptions, type ScrollBarThumbOverlayRenderProps, TAP_SCROLL_CANCEL_EVENT } from "./ScrollBar.tsx"
5
6
  import { getAxisScale, minmax } from "./utils.ts"
@@ -167,6 +168,20 @@ export type ScrollPaneProps = {
167
168
  * `className` / `style` / `ref` を表現できない型にしてあり、この口からレイアウトを壊せない。
168
169
  */
169
170
  contentProps?: React.AriaAttributes & { id?: string; role?: React.AriaRole }
171
+ /**
172
+ * UI chrome locale forwarded to the pane's ScrollBar (arrow aria-labels; default `"en"`).
173
+ * An unsupported value throws a RangeError at render.
174
+ * ペインの ScrollBar へ転送する UI クロームロケール (矢印の aria-label、既定 `"en"`)。
175
+ * 非対応値は描画時に RangeError。
176
+ */
177
+ locale?: VirtualScrollLocale
178
+ /**
179
+ * Per-key label overrides forwarded to the pane's ScrollBar, laid over the catalog of `locale`.
180
+ * Unknown keys and blank values throw a RangeError at render.
181
+ * ペインの ScrollBar へ転送するキー単位のラベル上書き (`locale` のカタログへ重ねる)。
182
+ * 未知キーと空白値は描画時に RangeError。
183
+ */
184
+ labels?: VirtualScrollLabelOverrides
170
185
  }
171
186
 
172
187
  export type ScrollPaneInertiaOptions = {
@@ -332,6 +347,8 @@ export const ScrollPane = forwardRef<ScrollPaneHandle, ScrollPaneProps>(
332
347
  renderOverlay,
333
348
  initialScrollPosition = 0,
334
349
  contentProps,
350
+ locale,
351
+ labels,
335
352
  },
336
353
  ref,
337
354
  ) => {
@@ -1638,6 +1655,8 @@ export const ScrollPane = forwardRef<ScrollPaneHandle, ScrollPaneProps>(
1638
1655
  renderThumbOverlay={renderThumbOverlay}
1639
1656
  visibleStartIndex={visibleStartIndex}
1640
1657
  visibleEndIndex={visibleEndIndex}
1658
+ locale={locale}
1659
+ labels={labels}
1641
1660
  />
1642
1661
  {renderOverlay?.()}
1643
1662
  </div>
@@ -24,6 +24,7 @@
24
24
  import { type CSSProperties, forwardRef, type HTMLAttributes, type ReactNode, useCallback, useEffect, useImperativeHandle, useLayoutEffect, useMemo, useRef, useState } from "react"
25
25
  import { twMerge } from "tailwind-merge"
26
26
  import type { TapScrollAxisSpeedParams } from "./computeTapScrollVelocity.ts"
27
+ import type { VirtualScrollLabelOverrides, VirtualScrollLocale } from "./labels.ts"
27
28
  import { Logger } from "./logger.ts"
28
29
  import { resolveTapScrollCircleOptions, ScrollBar, type ScrollBarTapCircleOptions } from "./ScrollBar.tsx"
29
30
  import type { ScrollPaneProps } from "./ScrollPane.tsx"
@@ -216,7 +217,7 @@ export type VirtualGridRange = {
216
217
  totalHeight: number
217
218
  }
218
219
 
219
- /** Live-region options: the consumer owns wording/locale (no built-in strings — row-parity). / liveRegion オプション: 文言とロケールは消費側所有 (内蔵文字列なし — 行側と同一方針)。 */
220
+ /** Live-region options: the consumer owns announcement wording/locale; the built-in catalog (`locale` / `labels`) covers only the seven chrome strings (arrows, pills, empty state) — row-parity. / liveRegion オプション: 読み上げの文言とロケールは消費側所有。内蔵カタログ (`locale` / `labels`) はクローム 7 文言 (矢印・ピル・空状態) のみ対象 — 行側と同一方針。 */
220
221
  export type VirtualGridLiveRegionOptions = {
221
222
  /** Builds the announcement (same string = no re-announce, "" clears). / 読み上げ文言の組み立て (同一文字列 = 再読み上げなし、"" でクリア)。 */
222
223
  buildMessage: (range: VirtualGridRange) => string
@@ -392,6 +393,21 @@ export type VirtualGridProps<T> = {
392
393
  behaviorOptions?: VirtualGridBehaviorOptions
393
394
  scrollBarOptions?: VirtualScrollScrollBarOptions
394
395
  liveRegion?: VirtualGridLiveRegionOptions
396
+ /**
397
+ * UI chrome locale (default `"en"`), forwarded to the embedded vertical VirtualScroll (its
398
+ * arrows and the 0-row / all-frozen / degenerate-band empty state) and the horizontal bar
399
+ * arrows. An unsupported value throws a RangeError at render.
400
+ * UI クロームロケール (既定 `"en"`)。内蔵の縦 VirtualScroll (矢印と 0 行・全行固定・退化帯の
401
+ * 空状態) と横バーの矢印へ転送。非対応値は描画時に RangeError。
402
+ */
403
+ locale?: VirtualScrollLocale
404
+ /**
405
+ * Per-key label overrides laid over the catalog of `locale`, forwarded to the same two
406
+ * surfaces as `locale`. Unknown keys and blank values throw a RangeError at render.
407
+ * `locale` のカタログへ重ねるキー単位のラベル上書き (`locale` と同じ 2 面へ転送)。
408
+ * 未知キーと空白値は描画時に RangeError。
409
+ */
410
+ labels?: VirtualScrollLabelOverrides
395
411
  className?: string
396
412
  testId?: string
397
413
  }
@@ -749,6 +765,8 @@ const VirtualGridInner = <T,>(
749
765
  behaviorOptions,
750
766
  scrollBarOptions,
751
767
  liveRegion,
768
+ locale,
769
+ labels,
752
770
  className,
753
771
  testId,
754
772
  }: VirtualGridProps<T>,
@@ -1349,7 +1367,33 @@ const VirtualGridInner = <T,>(
1349
1367
  curve: resolvedTapY.maxSpeedCurve,
1350
1368
  }
1351
1369
  const getHx = useCallback(() => hxRef.current, [])
1352
- const getVy = useCallback(() => vyRef.current, [])
1370
+ /**
1371
+ * Fresh y position through the embedded handle — the SAME authority `applyVy`'s `scrollBy`
1372
+ * resolves its updater against (the pane's internal position ref), symmetric with
1373
+ * `getMaxVy`'s freshness channel and with the x side, where `getHx` reads the very cell
1374
+ * `applyHx` writes. NEVER read `vyRef` here: that mirror has a second writer — the
1375
+ * throttled `onScroll` relay (`handleVerticalScroll`) — which regresses it by up to the
1376
+ * `callbackThrottleMs` window mid-drive; a driver base read from the mirror overstates
1377
+ * `actualDelta` by the staleness gap, drives the axis residual negative, and the driver
1378
+ * then issues REAL backward `scrollBy` writes (the 3.6.0 y-axis tap yo-yo — v3.6.1).
1379
+ * 埋め込みハンドル経由の鮮度 y 位置 — `applyVy` の `scrollBy` が updater を解決するのと
1380
+ * **同一の権威** (ペイン内部 ref)。`getMaxVy` の鮮度チャネル、および「`getHx` が `applyHx`
1381
+ * の書き先セルそのものを読む」x 側と対称。ここで `vyRef` を読んではならない: あの鏡像には
1382
+ * 第 2 の書き手 (スロットル済み `onScroll` 中継 = `handleVerticalScroll`) が居て、駆動中に
1383
+ * 最大 `callbackThrottleMs` 窓ぶん巻き戻す。鏡像基準の `actualDelta` は staleness ギャップ
1384
+ * ぶん過大になり、軸残差が負へ落ちて、ドライバ自身が**実後退**の `scrollBy` を発行する
1385
+ * (3.6.0 の y 軸タップヨーヨー — v3.6.1)。
1386
+ */
1387
+ const getVy = useCallback(() => {
1388
+ const inner = scrollHandleRef.current
1389
+ if (inner === null) {
1390
+ // ハンドル未接続時は applyVy と同じ「動かない」姿勢 — 同じ座標 (vyRef) を基準に返す
1391
+ return vyRef.current
1392
+ }
1393
+ const position = inner.getScrollPosition()
1394
+ // ペイン未接続の番兵 (-1) も applyVy の不動姿勢と同じ座標へ落とす (負位置は実在しない)
1395
+ return position < 0 ? vyRef.current : position
1396
+ }, [])
1353
1397
  /**
1354
1398
  * Fresh y extent through the embedded handle — the same freshness channel the vertical bar
1355
1399
  * uses (`contentSize − viewportSize` floored at 0). Never re-derived from grid-side trees.
@@ -1884,6 +1928,8 @@ const VirtualGridInner = <T,>(
1884
1928
  onRangeChange={handleRangeChangeWithLive}
1885
1929
  onWheelHorizontal={consumeHorizontalDelta}
1886
1930
  onPanHorizontal={consumeHorizontalDelta}
1931
+ locale={locale}
1932
+ labels={labels}
1887
1933
  testId={testId ? `${testId}-rows` : undefined}>
1888
1934
  {renderRow}
1889
1935
  </VirtualScroll>
@@ -1925,6 +1971,8 @@ const VirtualGridInner = <T,>(
1925
1971
  return applyHxRef.current(typeof request === "function" ? request(previous ?? hxRef.current) : request)
1926
1972
  }}
1927
1973
  scrollBarWidth={scrollBarWidth}
1974
+ locale={locale}
1975
+ labels={labels}
1928
1976
  />
1929
1977
  </div>
1930
1978
  {tapCircleEnabled && gridScrollable && (