haori 0.24.0 → 0.26.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/dist/index.d.ts CHANGED
@@ -68,6 +68,16 @@ export declare class Core {
68
68
  private static readonly DERIVE_SUBTREE_PROFILES;
69
69
  /** data-each の差分更新の再入制御状態 */
70
70
  private static readonly EACH_UPDATE_STATES;
71
+ /**
72
+ * data-each-rendered-change(既定の `once` モード)で change を発火済みの要素。
73
+ * 再帰的な発火ループを避けるため、要素ごとに一度だけ発火させるために使用します。
74
+ */
75
+ private static readonly EACH_RENDERED_CHANGE_FIRED;
76
+ /**
77
+ * data-each-rendered-change の不正な属性値を警告済みの要素。
78
+ * 描画確定ごとに同じ警告を出し続けないために使用します。
79
+ */
80
+ private static readonly EACH_RENDERED_CHANGE_WARNED;
71
81
  /**
72
82
  * 遅延属性かどうか(完全名で判定)を判定します。
73
83
  *
@@ -422,6 +432,40 @@ export declare class Core {
422
432
  * @param target data-each コンテナ要素
423
433
  */
424
434
  private static runEachRenderedScript;
435
+ /**
436
+ * data-each-rendered-change 属性に従い、描画確定後に対象要素へ `change`
437
+ * イベント(バブリングあり)を発火します。
438
+ *
439
+ * API から取得した候補を `data-each` で流し込んだ `<select>` について、
440
+ * 「既定選択を確定して初期データを取得する」パターンをインライン JS なしで
441
+ * 宣言できるようにするための属性です。`<select>` はブラウザが先頭 option を
442
+ * 自動選択するため、描画確定後の `change` がそのまま既定選択の確定になります。
443
+ *
444
+ * 描画行が 0 件のときは発火しません(確定すべき既定値が存在しないため)。
445
+ * この場合は初回発火の判定も消費しないため、行が入った最初の描画で発火します。
446
+ *
447
+ * 属性値による動作の違い:
448
+ * - 省略または `once`: 行が 1 件以上ある最初の描画確定時のみ発火する(既定)。
449
+ * - `always`: 描画確定ごとに毎回発火する。
450
+ *
451
+ * 既定を `once` にしているのは、`change` の手続きが `data-each` の取得元を
452
+ * 再バインドする構成(候補取得 → 選択確定 → 明細取得 → 再描画)で、毎回発火
453
+ * させると再帰的な発火ループになり得るためです。
454
+ *
455
+ * @param fragment data-each コンテナのフラグメント
456
+ */
457
+ private static runEachRenderedChange;
458
+ /**
459
+ * data-each コンテナに描画されている行数を返します。
460
+ *
461
+ * 行は差分更新で `data-row` 属性が付与されるため、それを数えます。
462
+ * `data-each-before` / `data-each-after` の固定要素や、テンプレート以外の
463
+ * 静的な子要素(`data-each-before` の付け忘れを含む)は行数に含めません。
464
+ *
465
+ * @param fragment data-each コンテナのフラグメント
466
+ * @returns 描画済みの行数
467
+ */
468
+ private static countEachRenderedRows;
425
469
  /**
426
470
  * data-each の差分更新本体を実行します(再入制御は呼び出し側で行います)。
427
471
  *
@@ -1150,6 +1194,25 @@ export declare class Form {
1150
1194
  * @param form フォームのElementFragment
1151
1195
  */
1152
1196
  static getValues(form: ElementFragment): Record<string, unknown>;
1197
+ /**
1198
+ * 入力エレメントから収集する値を解決します。
1199
+ *
1200
+ * `input[type=file]` は選択されたファイルを File オブジェクトとして返します
1201
+ * (内部値は `C:\fakepath\...` の擬似パス文字列にしかならず送信に使えないため、
1202
+ * DOM の `files` から直接取得する)。`multiple` 指定時は File の配列、単一選択時は
1203
+ * File または未選択を表す null を返します。それ以外の要素は内部値を返します。
1204
+ *
1205
+ * @param fragment 対象のElementFragment
1206
+ * @returns 収集する値
1207
+ */
1208
+ private static resolveCollectedValue;
1209
+ /**
1210
+ * `input[type=file]` かどうかを判定します。
1211
+ *
1212
+ * @param fragment 対象フラグメント
1213
+ * @returns `input[type=file]` の場合 true
1214
+ */
1215
+ private static isFileInput;
1153
1216
  /**
1154
1217
  * フォーム内の各入力エレメントから値を取得し、オブジェクトとして返します。
1155
1218
  * 入力エレメントのname属性、data-form-object属性、data-form-list属性に基づいて値を整理します。
@@ -1524,6 +1587,29 @@ declare class Haori {
1524
1587
  * @returns 整形済み文字列。整形できない場合は空文字
1525
1588
  */
1526
1589
  static date(value: string | number | Date | null | undefined, format?: string, timeZone?: string): string;
1590
+ /**
1591
+ * 現在日時を指定フォーマットの文字列へ整形します。
1592
+ *
1593
+ * テンプレート式中の `haori.now(...)` と同じ実装です。戻り値は呼び出し時刻に
1594
+ * 依存するため冪等ではありません。
1595
+ *
1596
+ * @param format フォーマット文字列(省略時は `yyyy/MM/dd HH:mm`)
1597
+ * @param timeZone IANA タイムゾーン名(例 `Asia/Tokyo`)。省略時はローカルタイムゾーン
1598
+ * @returns 整形済みの現在日時文字列
1599
+ */
1600
+ static now(format?: string, timeZone?: string): string;
1601
+ /**
1602
+ * 現在日付に日数を加減した日付を指定フォーマットの文字列へ整形します。
1603
+ *
1604
+ * テンプレート式中の `haori.today(...)` と同じ実装です。戻り値は呼び出し日に
1605
+ * 依存するため冪等ではありません。
1606
+ *
1607
+ * @param offsetDays 現在日付に加減する日数(負数で過去方向、省略時は 0)
1608
+ * @param format フォーマット文字列(省略時は `yyyy-MM-dd`)
1609
+ * @param timeZone IANA タイムゾーン名(例 `Asia/Tokyo`)。省略時はローカルタイムゾーン
1610
+ * @returns 整形済みの日付文字列。timeZone が不正な場合は空文字
1611
+ */
1612
+ static today(offsetDays?: number, format?: string, timeZone?: string): string;
1527
1613
  /**
1528
1614
  * 数値を桁区切り・小数桁付きの文字列へ整形します。
1529
1615
  *
@@ -1821,7 +1907,7 @@ declare class TextFragment extends Fragment {
1821
1907
  evaluate(): Promise<void>;
1822
1908
  }
1823
1909
 
1824
- export declare const version = "0.24.0";
1910
+ export declare const version = "0.26.0";
1825
1911
 
1826
1912
  /**
1827
1913
  * すべてのレンダリングタスク(追従投入分を含む)の完了を待ちます。
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "haori",
3
- "version": "0.24.0",
3
+ "version": "0.26.0",
4
4
  "description": "A lightweight HTML-first UI engine powered by declarative data bindings and expressions.",
5
5
  "scripts": {
6
6
  "dev": "vite",