@aiquants/period-slider 0.10.2 → 0.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.
@@ -0,0 +1,327 @@
1
+ /**
2
+ * @fileoverview Lazily derived option domain of a bounded or discrete day-resolution selector.
3
+ *
4
+ * Describes the option set of a date dropdown as an index space instead of an array: the count is
5
+ * computed from the bounds, and the date / machine value / human label of index `i` are derived on
6
+ * demand. A bound change therefore costs O(1) for a continuous range and O(log n) for a discrete
7
+ * one, never O(count), and nothing proportional to the option count is ever allocated.
8
+ *
9
+ * 日単位セレクタの選択肢集合を「配列」ではなく「添字空間」として記述するモジュール。
10
+ * 件数は境界から算出し、添字 i の日付・機械可読値・表示ラベルは要求時に導出する。
11
+ * 境界変更の費用は連続範囲で O(1)、離散集合で O(log n) であり、件数に比例した確保は一切行わない。
12
+ */
13
+
14
+ import { formatLabel } from "./PeriodSlider"
15
+
16
+ /** Milliseconds in one civil day, used only as the divisor of the UTC day serial / 暦日 1 日のミリ秒数 (UTC 日通番の除数としてのみ使用) */
17
+ const MS_PER_DAY = 86_400_000
18
+
19
+ /** Digits an ISO 8601 four-digit calendar year is zero-padded to / ISO 8601 の 4 桁暦年が 0 埋めされる桁数 */
20
+ const ISO_YEAR_DIGITS = 4
21
+
22
+ /** Digits an ISO 8601 expanded (negative) calendar year is zero-padded to / ISO 8601 の拡張表記 (負の暦年) が 0 埋めされる桁数 */
23
+ const ISO_EXPANDED_YEAR_DIGITS = 6
24
+
25
+ /** Digits the ISO 8601 month and day fields are zero-padded to / ISO 8601 の月・日フィールドが 0 埋めされる桁数 */
26
+ const ISO_MONTH_DAY_DIGITS = 2
27
+
28
+ /**
29
+ * Index returned for a date that is not a member of the option set.
30
+ * 選択肢集合に属さない日付に対して返される添字。
31
+ *
32
+ * Every consumer compares against this name rather than against a bare `-1`, so the sentinel has
33
+ * one definition and a caller cannot accidentally treat it as a usable index.
34
+ * 全ての利用側は裸の `-1` ではなく本名で比較する (番兵の定義を 1 箇所に保ち、使える添字として
35
+ * 誤って扱われることを防ぐため)。
36
+ */
37
+ export const NO_OPTION_INDEX = -1
38
+
39
+ /**
40
+ * Converts a calendar day to a civil day serial number.
41
+ * 暦日を「日通番」へ変換する関数。
42
+ *
43
+ * Counting days through `Date.UTC` of the *local* calendar parts makes the serial exact across DST
44
+ * transitions and across time zones whose offset is not a whole number of hours: a local day is
45
+ * never 23 or 25 hours long in the serial space, so `serial(a) - serial(b)` is the true number of
46
+ * calendar days between two dates.
47
+ * ローカル暦の構成要素を `Date.UTC` へ渡して数えるため、通番は夏時間の遷移や 30 分刻みの
48
+ * タイムゾーンでも厳密 (通番空間ではローカル日が 23 時間や 25 時間になることがない)。
49
+ *
50
+ * @param date - Date whose local calendar day is counted / ローカル暦日を数える対象の日付
51
+ * @returns Integer day serial, monotonically increasing by 1 per calendar day / 暦日ごとに 1 増える整数の日通番
52
+ */
53
+ export const toDaySerial = (date: Date): number => {
54
+ const year = date.getFullYear()
55
+ const utc = new Date(Date.UTC(year, date.getMonth(), date.getDate()))
56
+ // 0-99 年は Date.UTC がその年を 1900 年代へ写像するため、明示的に年を上書きする
57
+ utc.setUTCFullYear(year)
58
+ return Math.floor(utc.getTime() / MS_PER_DAY)
59
+ }
60
+
61
+ /**
62
+ * Rebuilds the local-midnight Date of a civil day serial number.
63
+ * 日通番からローカル 0 時の Date を復元する関数。
64
+ *
65
+ * @param serial - Integer day serial produced by {@link toDaySerial} / {@link toDaySerial} が返した整数の日通番
66
+ * @returns Date at 00:00:00.000 local time of that calendar day / その暦日のローカル 0 時を指す Date
67
+ */
68
+ export const fromDaySerial = (serial: number): Date => {
69
+ const utc = new Date(serial * MS_PER_DAY)
70
+ const date = new Date(utc.getUTCFullYear(), utc.getUTCMonth(), utc.getUTCDate())
71
+ // 0-99 年はコンストラクタが 1900 年代へ写像するため、明示的に年を上書きする
72
+ date.setFullYear(utc.getUTCFullYear())
73
+ date.setHours(0, 0, 0, 0)
74
+ return date
75
+ }
76
+
77
+ /**
78
+ * Renders a date as the machine-readable yyyy-MM-dd value of an option.
79
+ * 日付を選択肢の機械可読値 (yyyy-MM-dd) へ整形する関数。
80
+ *
81
+ * Built from the calendar parts rather than through a date library because this runs once per
82
+ * rendered row and per commit, and a token-driven formatter costs about 19x more for identical
83
+ * output. Output is byte-identical to `date-fns` `format(date, "yyyy-MM-dd")` for every year from 1
84
+ * to 275760; at and below year 0 it emits the ISO 8601 rendering (`0000-01-01`, `-000001-01-01`)
85
+ * rather than the era year the library reports (`0001-01-01`, `0002-01-01`), because ISO 8601 is
86
+ * what this package's value surface promises.
87
+ * 日付ライブラリを介さず暦の構成要素から組むのは、描画行ごと・確定ごとに走る経路であり、
88
+ * トークン解釈型の書式化は同一出力に約 19 倍の費用を要するため。
89
+ * 出力は 1〜275760 年で `date-fns` の `format(date, "yyyy-MM-dd")` とバイト一致。
90
+ * 0 年以下では紀元表記ではなく ISO 8601 の拡張表記を出す (本パッケージの値の面が約束するのは
91
+ * ISO 8601 であるため)。
92
+ *
93
+ * @param date - Date to render / 整形対象の日付
94
+ * @returns Zero-padded yyyy-MM-dd of the local calendar day / ローカル暦日の 0 埋め yyyy-MM-dd
95
+ */
96
+ export const formatIsoDay = (date: Date): string => {
97
+ const year = date.getFullYear()
98
+ const yearText = year >= 0 ? String(year).padStart(ISO_YEAR_DIGITS, "0") : `-${String(-year).padStart(ISO_EXPANDED_YEAR_DIGITS, "0")}`
99
+ return `${yearText}-${String(date.getMonth() + 1).padStart(ISO_MONTH_DAY_DIGITS, "0")}-${String(date.getDate()).padStart(ISO_MONTH_DAY_DIGITS, "0")}`
100
+ }
101
+
102
+ /**
103
+ * Index space of the option set a day-resolution dropdown presents, in descending date order.
104
+ * 日単位ドロップダウンが提示する選択肢集合の添字空間 (日付の降順)。
105
+ *
106
+ * Index 0 is the latest selectable day, matching the descending order the package has always
107
+ * presented. Every accessor is O(1) for a continuous range and O(1) for a discrete one once the
108
+ * index range is resolved; none of them allocates per option.
109
+ * 添字 0 は最新の選択可能日で、本パッケージが従来提示してきた降順と一致。
110
+ * 各アクセサは連続範囲で O(1)、離散集合でも添字範囲解決後は O(1) であり、選択肢ごとの確保を行わない。
111
+ */
112
+ export interface DateOptionDomain {
113
+ /** Number of selectable days; 0 means nothing is selectable / 選択可能日数 (0 は「選択可能日なし」) */
114
+ readonly count: number
115
+ /** Local-midnight Date of the option at `index` / 添字 index の選択肢が表す日付 (ローカル 0 時) */
116
+ dateAt(index: number): Date
117
+ /** Machine-readable yyyy-MM-dd of the option at `index` / 添字 index の選択肢の機械可読値 (yyyy-MM-dd) */
118
+ valueAt(index: number): string
119
+ /** Human-facing option text of the option at `index` / 添字 index の選択肢の表示テキスト */
120
+ labelAt(index: number): string
121
+ /** Index of a date inside the set, or {@link NO_OPTION_INDEX} when it is not selectable / 集合内での添字 (選択不可なら {@link NO_OPTION_INDEX}) */
122
+ indexOf(date: Date): number
123
+ }
124
+
125
+ /**
126
+ * Builds the option domain of a continuous, bounded day range without materializing it.
127
+ * 連続した境界付き日付範囲の選択肢領域を、実体化せずに構築する関数。
128
+ *
129
+ * @param minBound - Inclusive lower bound, normalized to local midnight / 下限 (ローカル 0 時に正規化済み・含む)
130
+ * @param maxBound - Inclusive upper bound, normalized to local midnight / 上限 (ローカル 0 時に正規化済み・含む)
131
+ * @param locale - BCP 47 language tag enabling Intl label formatting / Intl ラベル書式を有効化する BCP 47 言語タグ
132
+ * @returns Descending option domain of every calendar day in the range / 範囲内全暦日の降順選択肢領域
133
+ */
134
+ export const createContinuousDateOptionDomain = (minBound: Date, maxBound: Date, locale: string | undefined): DateOptionDomain => {
135
+ const minSerial = toDaySerial(minBound)
136
+ const maxSerial = toDaySerial(maxBound)
137
+ const count = maxSerial >= minSerial ? maxSerial - minSerial + 1 : 0
138
+ const dateAt = (index: number): Date => fromDaySerial(maxSerial - index)
139
+ return {
140
+ count,
141
+ dateAt,
142
+ valueAt: (index) => formatIsoDay(dateAt(index)),
143
+ labelAt: (index) => formatLabel("day", dateAt(index), undefined, locale),
144
+ indexOf: (date) => {
145
+ const serial = toDaySerial(date)
146
+ if (serial < minSerial || serial > maxSerial) return NO_OPTION_INDEX
147
+ return maxSerial - serial
148
+ },
149
+ }
150
+ }
151
+
152
+ /**
153
+ * Builds the option domain of a discrete date set, addressing the caller's own ascending array.
154
+ * 離散日付集合の選択肢領域を、呼び出し側の昇順配列をそのまま参照して構築する関数。
155
+ *
156
+ * The bounds are applied as an index window `[loIndex, hiIndex]` found by binary search, so a
157
+ * moving bound never copies, filters or re-sorts the array the host owns.
158
+ * 境界は二分探索で求めた添字窓 `[loIndex, hiIndex]` として適用するため、境界が動いても
159
+ * ホストが所有する配列の複製・絞り込み・再ソートは発生しない。
160
+ *
161
+ * @param ascending - Ascending, deduplicated, local-midnight dates owned by the caller / 呼び出し側が所有する昇順・重複排除済みのローカル 0 時日付
162
+ * @param loIndex - First in-bounds index, or a value greater than hiIndex when the window is empty / 境界内の先頭添字 (空窓時は hiIndex より大きい値)
163
+ * @param hiIndex - Last in-bounds index / 境界内の末尾添字
164
+ * @param locale - BCP 47 language tag enabling Intl label formatting / Intl ラベル書式を有効化する BCP 47 言語タグ
165
+ * @returns Descending option domain over the in-bounds window / 境界内の窓を降順に見せる選択肢領域
166
+ */
167
+ export const createDiscreteDateOptionDomain = (ascending: readonly Date[], loIndex: number, hiIndex: number, locale: string | undefined): DateOptionDomain => {
168
+ const count = hiIndex >= loIndex ? hiIndex - loIndex + 1 : 0
169
+ const dateAt = (index: number): Date => ascending[hiIndex - index]
170
+ return {
171
+ count,
172
+ dateAt,
173
+ valueAt: (index) => formatIsoDay(dateAt(index)),
174
+ labelAt: (index) => formatLabel("day", dateAt(index), undefined, locale),
175
+ indexOf: (date) => {
176
+ const time = date.getTime()
177
+ let low = loIndex
178
+ let high = hiIndex
179
+ while (low <= high) {
180
+ const mid = (low + high) >> 1
181
+ const midTime = ascending[mid].getTime()
182
+ if (midTime === time) return hiIndex - mid
183
+ if (midTime < time) low = mid + 1
184
+ else high = mid - 1
185
+ }
186
+ return NO_OPTION_INDEX
187
+ },
188
+ }
189
+ }
190
+
191
+ /**
192
+ * Option domain presented when no day is selectable at all.
193
+ * 選択可能な日が 1 つも無い場合に提示される選択肢領域。
194
+ *
195
+ * The three accessors throw rather than inventing a date, because an empty domain has no index to
196
+ * serve and a substituted value would propagate a day the user never chose.
197
+ * 3 つのアクセサは日付を捏造せず送出する (空領域には提供できる添字が無く、代替値は利用者が
198
+ * 選んでいない日を伝播させるため)。
199
+ */
200
+ export const EMPTY_DATE_OPTION_DOMAIN: DateOptionDomain = {
201
+ count: 0,
202
+ dateAt: (index) => {
203
+ throw new RangeError(`DateSelector: the option domain is empty (requested index ${String(index)})`)
204
+ },
205
+ valueAt: (index) => {
206
+ throw new RangeError(`DateSelector: the option domain is empty (requested index ${String(index)})`)
207
+ },
208
+ labelAt: (index) => {
209
+ throw new RangeError(`DateSelector: the option domain is empty (requested index ${String(index)})`)
210
+ },
211
+ indexOf: () => NO_OPTION_INDEX,
212
+ }
213
+
214
+ /**
215
+ * Index window of a discrete ascending date list that falls inside the resolved bounds.
216
+ * 昇順離散日付配列のうち、解決済み境界の内側に入る添字窓。
217
+ */
218
+ export interface DiscreteIndexWindow {
219
+ /** First in-bounds index / 境界内の先頭添字 */
220
+ readonly loIndex: number
221
+ /** Last in-bounds index; smaller than loIndex when the window is empty / 境界内の末尾添字 (空窓時は loIndex より小さい) */
222
+ readonly hiIndex: number
223
+ }
224
+
225
+ /**
226
+ * Finds the index window of a discrete ascending date list that falls inside the resolved bounds.
227
+ * 昇順離散日付配列のうち、解決済み境界の内側に入る添字窓を求める関数。
228
+ *
229
+ * @param ascending - Ascending, deduplicated dates / 昇順・重複排除済みの日付
230
+ * @param minBound - Inclusive lower bound, or null when unbounded / 下限 (無制限時は null・含む)
231
+ * @param maxBound - Inclusive upper bound, or null when unbounded / 上限 (無制限時は null・含む)
232
+ * @returns First and last in-bounds index; `loIndex > hiIndex` when the window is empty / 境界内の先頭・末尾添字 (空窓時は loIndex > hiIndex)
233
+ */
234
+ export const resolveDiscreteIndexWindow = (ascending: readonly Date[], minBound: Date | null, maxBound: Date | null): DiscreteIndexWindow => {
235
+ const lowerBound = (target: number): number => {
236
+ let low = 0
237
+ let high = ascending.length
238
+ while (low < high) {
239
+ const mid = (low + high) >> 1
240
+ if (ascending[mid].getTime() < target) low = mid + 1
241
+ else high = mid
242
+ }
243
+ return low
244
+ }
245
+ const upperBound = (target: number): number => {
246
+ let low = 0
247
+ let high = ascending.length
248
+ while (low < high) {
249
+ const mid = (low + high) >> 1
250
+ if (ascending[mid].getTime() <= target) low = mid + 1
251
+ else high = mid
252
+ }
253
+ return low
254
+ }
255
+ const loIndex = minBound === null ? 0 : lowerBound(minBound.getTime())
256
+ const hiIndex = (maxBound === null ? ascending.length : upperBound(maxBound.getTime())) - 1
257
+ return { loIndex, hiIndex }
258
+ }
259
+
260
+ /**
261
+ * Finds the nearest date of a discrete set strictly on one side of a reference time.
262
+ * 離散集合のうち、基準時刻の片側にある最も近い日付を求める関数。
263
+ *
264
+ * Binary search inside the in-bounds window replaces the linear scan a stepper button would
265
+ * otherwise run per render, which is what makes a discrete set of any size cost the same.
266
+ * 境界内の窓に対する二分探索が、ステッパーボタンが本来レンダーごとに行う線形走査を置き換える
267
+ * (これにより任意の大きさの離散集合が同一費用になる)。
268
+ *
269
+ * @param ascending - Ascending, deduplicated dates / 昇順・重複排除済みの日付
270
+ * @param loIndex - First in-bounds index / 境界内の先頭添字
271
+ * @param hiIndex - Last in-bounds index / 境界内の末尾添字
272
+ * @param time - Reference epoch milliseconds, excluded from the result / 基準のエポックミリ秒 (結果から除外)
273
+ * @param direction - -1 for the latest earlier date, 1 for the earliest later date / -1 で直前の日付、1 で直後の日付
274
+ * @returns Neighbouring date, or null when the window holds none on that side / 隣接日付 (その側に無い場合は null)
275
+ */
276
+ export const findDiscreteNeighbour = (ascending: readonly Date[], loIndex: number, hiIndex: number, time: number, direction: -1 | 1): Date | null => {
277
+ let low = loIndex
278
+ let high = hiIndex
279
+ let found: Date | null = null
280
+ while (low <= high) {
281
+ const mid = (low + high) >> 1
282
+ const midTime = ascending[mid].getTime()
283
+ if (direction === -1) {
284
+ if (midTime < time) {
285
+ found = ascending[mid]
286
+ low = mid + 1
287
+ } else {
288
+ high = mid - 1
289
+ }
290
+ } else {
291
+ if (midTime > time) {
292
+ found = ascending[mid]
293
+ high = mid - 1
294
+ } else {
295
+ low = mid + 1
296
+ }
297
+ }
298
+ }
299
+ return found
300
+ }
301
+
302
+ /**
303
+ * Normalizes, deduplicates and sorts the discrete allowed dates without applying the bounds.
304
+ * 離散日付配列を正規化・重複排除・昇順ソートする関数 (境界は適用しない)。
305
+ *
306
+ * Leaving the bounds out is what lets a moving bound cost O(log n): the array is derived once per
307
+ * `allowedDates` content, and the bounds are then an index window over it.
308
+ * 境界を含めないことが、動く境界の費用を O(log n) にする鍵
309
+ * (配列は `allowedDates` の内容ごとに 1 度導出し、境界はその上の添字窓になる)。
310
+ *
311
+ * @param allowedDates - Caller supplied discrete dates / 呼び出し側が指定した離散日付
312
+ * @param assertValid - Per-entry validator invoked with the entry index / 要素添字付きで呼ばれる要素検証関数
313
+ * @returns Ascending, deduplicated local-midnight dates / 昇順・重複排除済みのローカル 0 時日付
314
+ */
315
+ export const normalizeAllowedDates = (allowedDates: readonly Date[], assertValid: (index: number, entry: Date) => void): Date[] => {
316
+ const byTime = new Map<number, Date>()
317
+ allowedDates.forEach((entry, index) => {
318
+ assertValid(index, entry)
319
+ const normalized = new Date(entry)
320
+ normalized.setHours(0, 0, 0, 0)
321
+ const time = normalized.getTime()
322
+ if (!byTime.has(time)) byTime.set(time, normalized)
323
+ })
324
+ return Array.from(byTime.keys())
325
+ .sort((a, b) => a - b)
326
+ .map((time) => byTime.get(time) as Date)
327
+ }
@@ -1075,6 +1075,22 @@
1075
1075
  置き換えるため、再掲しなければノギスの目盛も離散レールの候補点も読み取りの針も消える。
1076
1076
  `!important` は詳細度の高い配色規則 (`.dark ...`) と、候補点の塗りを持つユーティリティ層の双方に勝つため。
1077
1077
  針は読み取りの縁そのものなので最も強いインク、目盛は同じ強さでは針と区別できないため一段弱いインク */
1078
+ /* ドロップダウンの行は背景色だけで「今どこにいるか」を示す。UA がその塗りを Canvas へ
1079
+ 置き換えると、キーボードで辿っている行とそれ以外の区別が消える */
1080
+ .period-slider-date-option[data-active="true"],
1081
+ .period-slider-date-option:hover,
1082
+ .dark .period-slider-date-option[data-active="true"],
1083
+ .dark .period-slider-date-option:hover {
1084
+ background-color: Highlight !important;
1085
+ color: HighlightText !important;
1086
+ }
1087
+
1088
+ /* ポップアップは body へポータルされ、ページの上に浮く。枠線を再掲しなければ強制カラーで
1089
+ 背景が Canvas へ揃い、ページとの境目そのものが消える */
1090
+ .period-slider-date-popup {
1091
+ border: 1px solid CanvasText;
1092
+ }
1093
+
1078
1094
  .period-slider-tick {
1079
1095
  background-color: GrayText !important;
1080
1096
  }
@@ -1202,3 +1218,98 @@
1202
1218
  transition: none;
1203
1219
  }
1204
1220
  }
1221
+
1222
+ /* ============================================================= */
1223
+ /* 日単位ドロップダウン (仮想化コンボボックス) */
1224
+ /* ============================================================= */
1225
+ /* 操作要素は読み取り専用テキスト入力。キャレットとテキスト選択を消して <select> と同じ
1226
+ 「押すと候補が開く」以外の操作が生まれないようにする */
1227
+ .period-slider-date-combobox-field {
1228
+ cursor: pointer;
1229
+ caret-color: transparent;
1230
+ user-select: none;
1231
+ }
1232
+
1233
+ /* ポップアップは body へポータルするため、枠線と影を自分で持つ。枠線の太さは
1234
+ `VirtualDateDropdown` の `POPUP_BORDER_TOTAL` と一致していなければならず、単体テストが両者を突き合わせる */
1235
+ .period-slider-date-popup {
1236
+ position: fixed;
1237
+ /* ポータル先が body 直下であるため、ホストの層と重なるのは本パッケージでこの要素だけ。
1238
+ 既定値 60 は他の公開層 (最上位 41) より上で、ホストのモーダルより下に置ける値 */
1239
+ z-index: var(--aqps-z-date-popup, 60);
1240
+ overflow: hidden;
1241
+ border: 1px solid #d1d5db;
1242
+ border-radius: 0.375rem;
1243
+ background-color: #ffffff;
1244
+ box-shadow:
1245
+ 0 10px 15px -3px rgba(0, 0, 0, 0.1),
1246
+ 0 4px 6px -4px rgba(0, 0, 0, 0.1);
1247
+ /* 端に達したホイールをページへ渡さない。ペイン外 (枠線・角) に落ちたホイールも塞ぐため、
1248
+ virtualscroll 側の overscrollBehavior: "contain" と二重に宣言する */
1249
+ overscroll-behavior: contain;
1250
+ }
1251
+
1252
+ /* ポップアップは body へポータルされるため、ホストが `.dark` を部分木へ限定していると
1253
+ (本パッケージの `@custom-variant dark (&:where(.dark, .dark *))` が明示的に許す形) 祖先経路の
1254
+ 規則は届かない。`VirtualDateDropdown` が開くたびに操作要素自身の位置で色モードを解決し
1255
+ `data-color-mode` として運ぶため、暗色の宣言は祖先経路と属性経路の 2 形を並べる */
1256
+ .dark .period-slider-date-popup,
1257
+ .period-slider-date-popup[data-color-mode="dark"] {
1258
+ border-color: #475569;
1259
+ background-color: #1e293b;
1260
+ }
1261
+
1262
+ /* 行高は当たり判定の一辺そのもの (WCAG 2.5.5)。仮想スクロール側へ渡す数値と一致させないと
1263
+ 行が重なるか空隙ができるため、高さは要素側のインラインスタイルが持ち、ここでは宣言しない */
1264
+ .period-slider-date-option {
1265
+ display: flex;
1266
+ align-items: center;
1267
+ justify-content: center;
1268
+ font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
1269
+ font-variant-numeric: tabular-nums;
1270
+ font-size: 0.75rem;
1271
+ color: #111827;
1272
+ cursor: pointer;
1273
+ }
1274
+
1275
+ .dark .period-slider-date-option,
1276
+ .period-slider-date-popup[data-color-mode="dark"] .period-slider-date-option {
1277
+ color: #f1f5f9;
1278
+ }
1279
+
1280
+ /* ポップアップは `.period-slider` の外 (body 直下) に立つため配色プリセットの変数は届かない。
1281
+ 届かない変数をフォールバック付きで書くと常にフォールバックが効くだけの見せかけになるので、
1282
+ ここは既定のアクセント色をそのまま書く */
1283
+ .period-slider-date-option[aria-selected="true"] {
1284
+ font-weight: 600;
1285
+ color: #0284c7;
1286
+ }
1287
+
1288
+ .dark .period-slider-date-option[aria-selected="true"],
1289
+ .period-slider-date-popup[data-color-mode="dark"] .period-slider-date-option[aria-selected="true"] {
1290
+ color: #38bdf8;
1291
+ }
1292
+
1293
+ /* アクティブ行 (キーボードの現在位置) の塗り。ホバーと同じ見え方にするのは、2 つが同時に
1294
+ 見えると「Enter が確定する行」がどちらか分からなくなるため */
1295
+ .period-slider-date-option[data-active="true"] {
1296
+ background-color: #e0f2fe;
1297
+ }
1298
+
1299
+ .dark .period-slider-date-option[data-active="true"],
1300
+ .period-slider-date-popup[data-color-mode="dark"] .period-slider-date-option[data-active="true"] {
1301
+ background-color: #334155;
1302
+ }
1303
+
1304
+ /* 粗いポインターの Chromium は最後に触れた要素へ `:hover` をラッチするため、条件を付けないと
1305
+ 指を離した後も行が塗られたままになる */
1306
+ @media (hover: hover) {
1307
+ .period-slider-date-option:hover {
1308
+ background-color: #e0f2fe;
1309
+ }
1310
+
1311
+ .dark .period-slider-date-option:hover,
1312
+ .period-slider-date-popup[data-color-mode="dark"] .period-slider-date-option:hover {
1313
+ background-color: #334155;
1314
+ }
1315
+ }