@aiquants/period-slider 0.12.0 → 0.14.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.
@@ -1,15 +1,4 @@
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
- */
1
+ import { PeriodOptionFormatter } from './PeriodSlider.js';
13
2
  /**
14
3
  * Index returned for a date that is not a member of the option set.
15
4
  * 選択肢集合に属さない日付に対して返される添字。
@@ -78,8 +67,6 @@ export interface DateOptionDomain {
78
67
  readonly count: number;
79
68
  /** Local-midnight Date of the option at `index` / 添字 index の選択肢が表す日付 (ローカル 0 時) */
80
69
  dateAt(index: number): Date;
81
- /** Machine-readable yyyy-MM-dd of the option at `index` / 添字 index の選択肢の機械可読値 (yyyy-MM-dd) */
82
- valueAt(index: number): string;
83
70
  /** Human-facing option text of the option at `index` / 添字 index の選択肢の表示テキスト */
84
71
  labelAt(index: number): string;
85
72
  /** Index of a date inside the set, or {@link NO_OPTION_INDEX} when it is not selectable / 集合内での添字 (選択不可なら {@link NO_OPTION_INDEX}) */
@@ -91,10 +78,11 @@ export interface DateOptionDomain {
91
78
  *
92
79
  * @param minBound - Inclusive lower bound, normalized to local midnight / 下限 (ローカル 0 時に正規化済み・含む)
93
80
  * @param maxBound - Inclusive upper bound, normalized to local midnight / 上限 (ローカル 0 時に正規化済み・含む)
94
- * @param locale - BCP 47 language tag enabling Intl label formatting / Intl ラベル書式を有効化する BCP 47 言語タグ
81
+ * @param formatLocale - BCP 47 language tag enabling Intl label formatting / Intl ラベル書式を有効化する BCP 47 言語タグ
82
+ * @param formatOption - Consumer formatter taking priority over `formatLocale`, passed straight through so no per-row closure is allocated / `formatLocale` より優先される利用側フォーマッタ (素通しのため行ごとのクロージャ確保は発生しない)
95
83
  * @returns Descending option domain of every calendar day in the range / 範囲内全暦日の降順選択肢領域
96
84
  */
97
- export declare const createContinuousDateOptionDomain: (minBound: Date, maxBound: Date, locale: string | undefined) => DateOptionDomain;
85
+ export declare const createContinuousDateOptionDomain: (minBound: Date, maxBound: Date, formatLocale: string | undefined, formatOption: PeriodOptionFormatter | undefined) => DateOptionDomain;
98
86
  /**
99
87
  * Builds the option domain of a discrete date set, addressing the caller's own ascending array.
100
88
  * 離散日付集合の選択肢領域を、呼び出し側の昇順配列をそのまま参照して構築する関数。
@@ -107,17 +95,18 @@ export declare const createContinuousDateOptionDomain: (minBound: Date, maxBound
107
95
  * @param ascending - Ascending, deduplicated, local-midnight dates owned by the caller / 呼び出し側が所有する昇順・重複排除済みのローカル 0 時日付
108
96
  * @param loIndex - First in-bounds index, or a value greater than hiIndex when the window is empty / 境界内の先頭添字 (空窓時は hiIndex より大きい値)
109
97
  * @param hiIndex - Last in-bounds index / 境界内の末尾添字
110
- * @param locale - BCP 47 language tag enabling Intl label formatting / Intl ラベル書式を有効化する BCP 47 言語タグ
98
+ * @param formatLocale - BCP 47 language tag enabling Intl label formatting / Intl ラベル書式を有効化する BCP 47 言語タグ
99
+ * @param formatOption - Consumer formatter taking priority over `formatLocale`, passed straight through so no per-row closure is allocated / `formatLocale` より優先される利用側フォーマッタ (素通しのため行ごとのクロージャ確保は発生しない)
111
100
  * @returns Descending option domain over the in-bounds window / 境界内の窓を降順に見せる選択肢領域
112
101
  */
113
- export declare const createDiscreteDateOptionDomain: (ascending: readonly Date[], loIndex: number, hiIndex: number, locale: string | undefined) => DateOptionDomain;
102
+ export declare const createDiscreteDateOptionDomain: (ascending: readonly Date[], loIndex: number, hiIndex: number, formatLocale: string | undefined, formatOption: PeriodOptionFormatter | undefined) => DateOptionDomain;
114
103
  /**
115
104
  * Option domain presented when no day is selectable at all.
116
105
  * 選択可能な日が 1 つも無い場合に提示される選択肢領域。
117
106
  *
118
- * The three accessors throw rather than inventing a date, because an empty domain has no index to
107
+ * The two index accessors throw rather than inventing a date, because an empty domain has no index to
119
108
  * serve and a substituted value would propagate a day the user never chose.
120
- * 3 つのアクセサは日付を捏造せず送出する (空領域には提供できる添字が無く、代替値は利用者が
109
+ * 添字を取る 2 つのアクセサは日付を捏造せず送出する (空領域には提供できる添字が無く、代替値は利用者が
121
110
  * 選んでいない日を伝播させるため)。
122
111
  */
123
112
  export declare const EMPTY_DATE_OPTION_DOMAIN: DateOptionDomain;
@@ -1 +1 @@
1
- {"version":3,"file":"dateOptionDomain.d.ts","sourceRoot":"","sources":["../src/dateOptionDomain.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAgBH;;;;;;;;GAQG;AACH,eAAO,MAAM,eAAe,KAAK,CAAA;AAEjC;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,WAAW,GAAI,MAAM,IAAI,KAAG,MAMxC,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,aAAa,GAAI,QAAQ,MAAM,KAAG,IAO9C,CAAA;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,YAAY,GAAI,MAAM,IAAI,KAAG,MAIzC,CAAA;AAED;;;;;;;;;GASG;AACH,MAAM,WAAW,gBAAgB;IAC7B,uFAAuF;IACvF,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,mFAAmF;IACnF,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;IAC3B,8FAA8F;IAC9F,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAA;IAC9B,+EAA+E;IAC/E,OAAO,CAAC,KAAK,EAA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