haori 0.41.2 → 0.41.4

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/haori.es.js CHANGED
@@ -30,12 +30,12 @@ const ae = class ae {
30
30
  };
31
31
  ae.devMode = !1;
32
32
  let j = ae;
33
- const Me = "embedded";
33
+ const Ce = "embedded";
34
34
  function Ye(g) {
35
35
  return g === "embedded" || g === "demo";
36
36
  }
37
37
  function pt(g) {
38
- return g === null ? null : Ye(g) ? g : Me;
38
+ return g === null ? null : Ye(g) ? g : Ce;
39
39
  }
40
40
  const Y = class Y {
41
41
  /**
@@ -73,7 +73,7 @@ const Y = class Y {
73
73
  * @return 戻り値はありません。
74
74
  */
75
75
  static setRuntime(e) {
76
- Y._runtime = Ye(e) ? e : Me;
76
+ Y._runtime = Ye(e) ? e : Ce;
77
77
  }
78
78
  /**
79
79
  * 実行環境からプレフィックスと開発モードかどうかを自動検出します。
@@ -116,7 +116,7 @@ const Y = class Y {
116
116
  return Y._prefix;
117
117
  }
118
118
  };
119
- Y._prefix = "data-", Y._runtime = Me, Y._strictBind = !1;
119
+ Y._prefix = "data-", Y._runtime = Ce, Y._strictBind = !1;
120
120
  let u = Y;
121
121
  typeof document < "u" && (document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", u.detect) : u.detect());
122
122
  class m {
@@ -794,7 +794,7 @@ const He = class He {
794
794
  };
795
795
  He.ASYNC_QUEUE = new Be();
796
796
  let W = He;
797
- const C = class C {
797
+ const M = class M {
798
798
  /**
799
799
  * ストレージを、参照が例外になる環境でも安全に読み出します。
800
800
  *
@@ -832,8 +832,8 @@ const C = class C {
832
832
  e.history,
833
833
  // 参照だけで例外になり得るのはこの 2 つのみ(他は同一オリジンの自 window
834
834
  // 由来で常に読める)。ホットパスなので、囲むのも必要な箇所だけに絞る。
835
- C.readStorageSafely(() => e.localStorage),
836
- C.readStorageSafely(() => e.sessionStorage),
835
+ M.readStorageSafely(() => e.localStorage),
836
+ M.readStorageSafely(() => e.sessionStorage),
837
837
  e.fetch,
838
838
  e.Function,
839
839
  e.setTimeout,
@@ -2024,9 +2024,9 @@ return (${y});${h}`;
2024
2024
  return this.forbiddenBindingValueCache.set(e, !1), !1;
2025
2025
  }
2026
2026
  };
2027
- C.MAX_IDENTIFIER_RECOVERY_COUNT = 8, C.BUILTIN_NAMESPACE = "haori", C.BUILTIN_HELPERS = {
2027
+ M.MAX_IDENTIFIER_RECOVERY_COUNT = 8, M.BUILTIN_NAMESPACE = "haori", M.BUILTIN_HELPERS = {
2028
2028
  ...vt
2029
- }, C.BUILTIN_REFERENCE_PATTERN = /(^|[^\w$.])haori(?![\w$])/, C.BUILTIN_DATA_PROPERTY = "data", C.BUILTIN_DATA_REFERENCE_PATTERN = /(^|[^\w$.])haori\s*(\.\s*data(?![\w$])|\[)/, C.IDENTIFIER_NAME_PATTERN = /^[\p{ID_Start}$_][\p{ID_Continue}$\u200C\u200D]*$/u, C.usableBindingKeyCache = /* @__PURE__ */ new Map(), C.loggedUnusableBindingKeys = /* @__PURE__ */ new Set(), C.compileFailedExpressions = /* @__PURE__ */ new Set(), C.forbiddenBindingValueCache = /* @__PURE__ */ new WeakMap(), C.forbiddenBindingValueCacheResetScheduled = !1, C.loggedForbiddenKeySignatures = /* @__PURE__ */ new Set(), C.loggedForbiddenKeyResetScheduled = !1, C.FORBIDDEN_NAMES = [
2029
+ }, M.BUILTIN_REFERENCE_PATTERN = /(^|[^\w$.])haori(?![\w$])/, M.BUILTIN_DATA_PROPERTY = "data", M.BUILTIN_DATA_REFERENCE_PATTERN = /(^|[^\w$.])haori\s*(\.\s*data(?![\w$])|\[)/, M.IDENTIFIER_NAME_PATTERN = /^[\p{ID_Start}$_][\p{ID_Continue}$\u200C\u200D]*$/u, M.usableBindingKeyCache = /* @__PURE__ */ new Map(), M.loggedUnusableBindingKeys = /* @__PURE__ */ new Set(), M.compileFailedExpressions = /* @__PURE__ */ new Set(), M.forbiddenBindingValueCache = /* @__PURE__ */ new WeakMap(), M.forbiddenBindingValueCacheResetScheduled = !1, M.loggedForbiddenKeySignatures = /* @__PURE__ */ new Set(), M.loggedForbiddenKeyResetScheduled = !1, M.FORBIDDEN_NAMES = [
2030
2030
  // グローバルオブジェクト
2031
2031
  "window",
2032
2032
  "self",
@@ -2058,7 +2058,7 @@ C.MAX_IDENTIFIER_RECOVERY_COUNT = 8, C.BUILTIN_NAMESPACE = "haori", C.BUILTIN_HE
2058
2058
  "sessionStorage",
2059
2059
  "IndexedDB",
2060
2060
  "history"
2061
- ], C.STRICT_FORBIDDEN_NAMES = ["eval", "arguments"], C.REBINDABLE_FORBIDDEN_NAMES = /* @__PURE__ */ new Set([
2061
+ ], M.STRICT_FORBIDDEN_NAMES = ["eval", "arguments"], M.REBINDABLE_FORBIDDEN_NAMES = /* @__PURE__ */ new Set([
2062
2062
  "location",
2063
2063
  "history",
2064
2064
  "document",
@@ -2066,23 +2066,23 @@ C.MAX_IDENTIFIER_RECOVERY_COUNT = 8, C.BUILTIN_NAMESPACE = "haori", C.BUILTIN_HE
2066
2066
  "localStorage",
2067
2067
  "sessionStorage",
2068
2068
  "IndexedDB"
2069
- ]), C.FORBIDDEN_BINDING_NAMES = /* @__PURE__ */ new Set([
2070
- ...C.FORBIDDEN_NAMES.filter(
2071
- (e) => !C.REBINDABLE_FORBIDDEN_NAMES.has(e)
2069
+ ]), M.FORBIDDEN_BINDING_NAMES = /* @__PURE__ */ new Set([
2070
+ ...M.FORBIDDEN_NAMES.filter(
2071
+ (e) => !M.REBINDABLE_FORBIDDEN_NAMES.has(e)
2072
2072
  ),
2073
2073
  "constructor",
2074
2074
  "__proto__",
2075
2075
  "prototype",
2076
- ...C.STRICT_FORBIDDEN_NAMES
2077
- ]), C.FORBIDDEN_PROPERTY_NAMES = /* @__PURE__ */ new Set([
2076
+ ...M.STRICT_FORBIDDEN_NAMES
2077
+ ]), M.FORBIDDEN_PROPERTY_NAMES = /* @__PURE__ */ new Set([
2078
2078
  "constructor",
2079
2079
  "__proto__",
2080
2080
  "prototype"
2081
- ]), C.OBJECT_PROPERTY_MODIFIERS = /* @__PURE__ */ new Set([
2081
+ ]), M.OBJECT_PROPERTY_MODIFIERS = /* @__PURE__ */ new Set([
2082
2082
  "get",
2083
2083
  "set",
2084
2084
  "async"
2085
- ]), C.DISALLOWED_KEYWORDS = /* @__PURE__ */ new Set([
2085
+ ]), M.DISALLOWED_KEYWORDS = /* @__PURE__ */ new Set([
2086
2086
  "await",
2087
2087
  "break",
2088
2088
  "case",
@@ -2116,7 +2116,7 @@ C.MAX_IDENTIFIER_RECOVERY_COUNT = 8, C.BUILTIN_NAMESPACE = "haori", C.BUILTIN_HE
2116
2116
  "while",
2117
2117
  "with",
2118
2118
  "yield"
2119
- ]), C.NON_SHADOWABLE_IDENTIFIERS = /* @__PURE__ */ new Set([
2119
+ ]), M.NON_SHADOWABLE_IDENTIFIERS = /* @__PURE__ */ new Set([
2120
2120
  // リテラル・グローバル定数
2121
2121
  "true",
2122
2122
  "false",
@@ -2134,7 +2134,7 @@ C.MAX_IDENTIFIER_RECOVERY_COUNT = 8, C.BUILTIN_NAMESPACE = "haori", C.BUILTIN_HE
2134
2134
  "public",
2135
2135
  "static",
2136
2136
  "super"
2137
- ]), C.ALLOWED_GLOBAL_IDENTIFIERS = /* @__PURE__ */ new Set([
2137
+ ]), M.ALLOWED_GLOBAL_IDENTIFIERS = /* @__PURE__ */ new Set([
2138
2138
  // 名前空間オブジェクト
2139
2139
  "Math",
2140
2140
  "JSON",
@@ -2190,11 +2190,11 @@ C.MAX_IDENTIFIER_RECOVERY_COUNT = 8, C.BUILTIN_NAMESPACE = "haori", C.BUILTIN_HE
2190
2190
  "encodeURIComponent",
2191
2191
  "decodeURI",
2192
2192
  "decodeURIComponent"
2193
- ]), C.EXPRESSION_CACHE = /* @__PURE__ */ new Map(), C.FREE_IDENTIFIER_CACHE = /* @__PURE__ */ new Map(), C.BOUND_IDENTIFIER_CACHE = /* @__PURE__ */ new Map(), C.OPTIONAL_CHAIN_CACHE = /* @__PURE__ */ new Map(), C.FORBIDDEN_NAME_PATTERNS = C.FORBIDDEN_NAMES.map((e) => ({
2193
+ ]), M.EXPRESSION_CACHE = /* @__PURE__ */ new Map(), M.FREE_IDENTIFIER_CACHE = /* @__PURE__ */ new Map(), M.BOUND_IDENTIFIER_CACHE = /* @__PURE__ */ new Map(), M.OPTIONAL_CHAIN_CACHE = /* @__PURE__ */ new Map(), M.FORBIDDEN_NAME_PATTERNS = M.FORBIDDEN_NAMES.map((e) => ({
2194
2194
  name: e,
2195
2195
  pattern: new RegExp(`(^|[^\\w$.])${e}(?![\\w$])`)
2196
- })), C.FORBIDDEN_IDENTIFIER_CACHE = /* @__PURE__ */ new Map(), C.pendingUnresolvedIdentifiers = /* @__PURE__ */ new Set(), C.unresolvedReportScheduled = !1, C.suppliedIdentifiers = /* @__PURE__ */ new Set(), C.pendingScopeMissingIdentifiers = /* @__PURE__ */ new Map(), C.scopeMissingReportScheduled = !1, C.rowScopeIdentifiers = /* @__PURE__ */ new Set(), C.loggedScopeMissingIdentifiers = /* @__PURE__ */ new Set(), C.loggedBlockedIdentifierExpressions = /* @__PURE__ */ new Set();
2197
- let J = C;
2196
+ })), M.FORBIDDEN_IDENTIFIER_CACHE = /* @__PURE__ */ new Map(), M.pendingUnresolvedIdentifiers = /* @__PURE__ */ new Set(), M.unresolvedReportScheduled = !1, M.suppliedIdentifiers = /* @__PURE__ */ new Set(), M.pendingScopeMissingIdentifiers = /* @__PURE__ */ new Map(), M.scopeMissingReportScheduled = !1, M.rowScopeIdentifiers = /* @__PURE__ */ new Set(), M.loggedScopeMissingIdentifiers = /* @__PURE__ */ new Set(), M.loggedBlockedIdentifierExpressions = /* @__PURE__ */ new Set();
2197
+ let J = M;
2198
2198
  const pe = "data-haori-if-disabled", je = "input, select, textarea, button, fieldset", q = class q {
2199
2199
  /**
2200
2200
  * 集計状態を初期化します。
@@ -2554,7 +2554,7 @@ const oe = class oe {
2554
2554
  };
2555
2555
  oe.FRAGMENT_CACHE = /* @__PURE__ */ new WeakMap();
2556
2556
  let N = oe;
2557
- const M = class M extends N {
2557
+ const C = class C extends N {
2558
2558
  /**
2559
2559
  * エレメントフラグメントのコンストラクタ。
2560
2560
  * アトリビュートや子フラグメントの作成も行います。
@@ -2588,7 +2588,7 @@ const M = class M extends N {
2588
2588
  */
2589
2589
  getChildElementFragments() {
2590
2590
  return this.children.filter(
2591
- (e) => e instanceof M
2591
+ (e) => e instanceof C
2592
2592
  );
2593
2593
  }
2594
2594
  /**
@@ -2620,7 +2620,7 @@ const M = class M extends N {
2620
2620
  * @returns クローンされたフラグメント
2621
2621
  */
2622
2622
  clone() {
2623
- const e = new M(
2623
+ const e = new C(
2624
2624
  this.target.cloneNode(!1)
2625
2625
  );
2626
2626
  return this.attributeMap.forEach((t, r) => {
@@ -2635,7 +2635,7 @@ const M = class M extends N {
2635
2635
  */
2636
2636
  normalizeClonedVisibilityState() {
2637
2637
  (this.visible === !1 || this.getTarget().style.display === "none" || this.getTarget().hasAttribute(`${u.prefix}if-false`)) && (this.visible = !0, this.display = null, this.displayPriority = null, this.getTarget().style.removeProperty("display"), this.getTarget().removeAttribute(`${u.prefix}if-false`), this.restoreFormControlsDisabledByIf()), this.children.forEach((e) => {
2638
- e instanceof M && e.normalizeClonedVisibilityState();
2638
+ e instanceof C && e.normalizeClonedVisibilityState();
2639
2639
  });
2640
2640
  }
2641
2641
  /**
@@ -2755,19 +2755,19 @@ const M = class M extends N {
2755
2755
  * @returns 実行中なら true
2756
2756
  */
2757
2757
  static isExecutingAnyBindingWork() {
2758
- return M.bindingWorkActiveCount > 0;
2758
+ return C.bindingWorkActiveCount > 0;
2759
2759
  }
2760
2760
  /**
2761
2761
  * バインドワークの実行開始を記録します(`Core.setBindingData` の work 開始時に呼ぶ)。
2762
2762
  */
2763
2763
  markBindingWorkStart() {
2764
- this.bindingWorkActive++, M.bindingWorkActiveCount++;
2764
+ this.bindingWorkActive++, C.bindingWorkActiveCount++;
2765
2765
  }
2766
2766
  /**
2767
2767
  * バインドワークの実行終了を記録します(work 完了時に呼ぶ)。
2768
2768
  */
2769
2769
  markBindingWorkEnd() {
2770
- this.bindingWorkActive > 0 && (this.bindingWorkActive--, M.bindingWorkActiveCount--);
2770
+ this.bindingWorkActive > 0 && (this.bindingWorkActive--, C.bindingWorkActiveCount--);
2771
2771
  }
2772
2772
  /**
2773
2773
  * このフラグメントへ供給が適用されたことを記録します。
@@ -2859,7 +2859,7 @@ const M = class M extends N {
2859
2859
  */
2860
2860
  clearBindingDataCache() {
2861
2861
  this.bindingDataCache = null, this.descendantBindingDataCache = null, this.children.forEach((e) => {
2862
- e instanceof M && e.clearBindingDataCache();
2862
+ e instanceof C && e.clearBindingDataCache();
2863
2863
  });
2864
2864
  }
2865
2865
  /**
@@ -3077,7 +3077,7 @@ const M = class M extends N {
3077
3077
  this.value = this.normalizeValueForElement(i, e);
3078
3078
  const s = this.userEditSequence;
3079
3079
  return this.enqueueValueWrite(() => {
3080
- this.isSupersededByUserEdit(s) || r && !this.canApplyValue(r) || (i.value = n, this.recordValueWriteResult(i.value === n), t && ((i instanceof HTMLInputElement && M.INPUT_EVENT_TYPES.includes(i.type) || i instanceof HTMLTextAreaElement) && i.dispatchEvent(new Event("input", { bubbles: !0 })), i.dispatchEvent(new Event("change", { bubbles: !0 }))));
3080
+ this.isSupersededByUserEdit(s) || r && !this.canApplyValue(r) || (i.value = n, this.recordValueWriteResult(i.value === n), t && ((i instanceof HTMLInputElement && C.INPUT_EVENT_TYPES.includes(i.type) || i instanceof HTMLTextAreaElement) && i.dispatchEvent(new Event("input", { bubbles: !0 })), i.dispatchEvent(new Event("change", { bubbles: !0 }))));
3081
3081
  });
3082
3082
  }
3083
3083
  /**
@@ -3158,10 +3158,10 @@ const M = class M extends N {
3158
3158
  * @returns 再試行の完了 Promise
3159
3159
  */
3160
3160
  static retryUnappliedValueWrites(e, t) {
3161
- if (M.UNAPPLIED_VALUE_WRITES.size === 0)
3161
+ if (C.UNAPPLIED_VALUE_WRITES.size === 0)
3162
3162
  return Promise.resolve();
3163
3163
  const r = [];
3164
- for (const i of Array.from(M.UNAPPLIED_VALUE_WRITES)) {
3164
+ for (const i of Array.from(C.UNAPPLIED_VALUE_WRITES)) {
3165
3165
  const n = i.getTarget();
3166
3166
  if (i.wasResetAfter(t)) {
3167
3167
  i.clearUnappliedValueWrite();
@@ -3203,7 +3203,7 @@ const M = class M extends N {
3203
3203
  * @returns 戻り値はありません。
3204
3204
  */
3205
3205
  clearUnappliedValueWrite() {
3206
- this.valueWriteUnapplied = !1, M.UNAPPLIED_VALUE_WRITES.delete(this);
3206
+ this.valueWriteUnapplied = !1, C.UNAPPLIED_VALUE_WRITES.delete(this);
3207
3207
  }
3208
3208
  /**
3209
3209
  * 入力エレメントの値を取得します。
@@ -3224,7 +3224,7 @@ const M = class M extends N {
3224
3224
  * @returns 直近に発番した通番(未発番なら 0)
3225
3225
  */
3226
3226
  static currentSequence() {
3227
- return M.sequenceCounter;
3227
+ return C.sequenceCounter;
3228
3228
  }
3229
3229
  /**
3230
3230
  * 新しい通番を発番します。
@@ -3237,7 +3237,7 @@ const M = class M extends N {
3237
3237
  * @returns 発番した通番
3238
3238
  */
3239
3239
  static nextSequence() {
3240
- return M.sequenceCounter += 1, M.sequenceCounter;
3240
+ return C.sequenceCounter += 1, C.sequenceCounter;
3241
3241
  }
3242
3242
  /**
3243
3243
  * 保留中の外部 DOM 変更を取り込む処理を登録します。
@@ -3246,7 +3246,7 @@ const M = class M extends N {
3246
3246
  * @returns 戻り値はありません。
3247
3247
  */
3248
3248
  static setPendingMutationFlusher(e) {
3249
- M.pendingMutationFlusher = e;
3249
+ C.pendingMutationFlusher = e;
3250
3250
  }
3251
3251
  /**
3252
3252
  * 利用者の操作を起点とする通番を発番します。
@@ -3267,7 +3267,7 @@ const M = class M extends N {
3267
3267
  * @returns 発番した通番
3268
3268
  */
3269
3269
  static nextOperationSequence() {
3270
- return M.pendingMutationFlusher && !M.isExecutingAnyBindingWork() && M.pendingMutationFlusher(), M.nextSequence();
3270
+ return C.pendingMutationFlusher && !C.isExecutingAnyBindingWork() && C.pendingMutationFlusher(), C.nextSequence();
3271
3271
  }
3272
3272
  /**
3273
3273
  * この入力欄へ値を適用してよいかを返します。
@@ -3288,7 +3288,7 @@ const M = class M extends N {
3288
3288
  * @returns 適用してよい場合は true
3289
3289
  */
3290
3290
  canApplyValue(e) {
3291
- return M.isApplicable(
3291
+ return C.isApplicable(
3292
3292
  { sequence: this.lastValueSequence, kind: this.lastValueKind },
3293
3293
  e
3294
3294
  );
@@ -3311,7 +3311,7 @@ const M = class M extends N {
3311
3311
  * @returns 適用してよい場合は true
3312
3312
  */
3313
3313
  canApplyPath(e, t) {
3314
- return M.isApplicable(
3314
+ return C.isApplicable(
3315
3315
  this.lastPathApplied.get(e) ?? null,
3316
3316
  t
3317
3317
  );
@@ -3349,15 +3349,18 @@ const M = class M extends N {
3349
3349
  /**
3350
3350
  * この入力欄がユーザーに編集されたことを記録します。
3351
3351
  *
3352
- * DOM で `change` / `input` が発火した時点(内部値を DOM から同期した直後)に
3353
- * 呼び出します。イベントを伴って値を反映した場合(`Form.setValues()` など)も、
3354
- * その発火を通じて呼ばれます。イベントを伴わない反映(`syncBindingValue()` や
3355
- * `Core.setBindingData()` 由来の書き戻し)では呼び出しません。
3352
+ * DOM で `change` / `input` が発火した時点に呼び出します。イベントを伴って値を
3353
+ * 反映した場合(`Form.setValues()` など)も、その発火を通じて呼ばれます。
3354
+ * イベントを伴わない反映(`syncBindingValue()` や `Core.setBindingData()` 由来の
3355
+ * 書き戻し)では呼び出しません。
3356
+ *
3357
+ * 内部値の同期(`syncValue()`)とは独立です。手続きを起動しない `input` では
3358
+ * 発番だけを行い、内部値は同期しません(`EventDispatcher.recordUserEdit()`)。
3356
3359
  *
3357
3360
  * @returns 発番した編集の通番
3358
3361
  */
3359
3362
  markUserEdit() {
3360
- return this.userEditSequence = M.nextSequence(), this.markValueApplied({ sequence: this.userEditSequence, kind: "edit" }), this.userEditSequence;
3363
+ return this.userEditSequence = C.nextSequence(), this.markValueApplied({ sequence: this.userEditSequence, kind: "edit" }), this.userEditSequence;
3361
3364
  }
3362
3365
  /**
3363
3366
  * この入力欄を最後にユーザーが編集したときの通し番号を返します。
@@ -3392,7 +3395,7 @@ const M = class M extends N {
3392
3395
  * @param upTo この通し番号までの編集を解除対象とする(既定は現在の最新)
3393
3396
  * @return 戻り値はありません。
3394
3397
  */
3395
- clearUserEditMark(e = M.currentSequence()) {
3398
+ clearUserEditMark(e = C.currentSequence()) {
3396
3399
  e > this.authoritativeValueSequence && (this.authoritativeValueSequence = e), this.lastValueKind === "edit" && this.lastValueSequence <= e && (this.lastValueKind = "supply");
3397
3400
  }
3398
3401
  /**
@@ -3413,7 +3416,7 @@ const M = class M extends N {
3413
3416
  if (!j.isEnabled())
3414
3417
  return;
3415
3418
  const n = `${e} ${r}`;
3416
- M.loggedUnresolvedAttributes.has(n) || (M.loggedUnresolvedAttributes.add(n), m.warn(
3419
+ C.loggedUnresolvedAttributes.has(n) || (C.loggedUnresolvedAttributes.add(n), m.warn(
3417
3420
  "[Haori]",
3418
3421
  `Attribute "${t}" was not applied because the expression has an unresolved reference; the attribute is removed and the synchronized value is emptied: ${e}="${r}"`,
3419
3422
  i
@@ -3435,7 +3438,7 @@ const M = class M extends N {
3435
3438
  if (!t)
3436
3439
  return !1;
3437
3440
  const r = N.get(t);
3438
- return r instanceof M ? r.hasPendingUserEdit() : !1;
3441
+ return r instanceof C ? r.hasPendingUserEdit() : !1;
3439
3442
  }
3440
3443
  /**
3441
3444
  * 内部の値をクリアします。エレメントのvalue値は変化しません。
@@ -3481,7 +3484,7 @@ const M = class M extends N {
3481
3484
  * @returns 同期対象の場合true
3482
3485
  */
3483
3486
  static isValuePropertyTarget(e) {
3484
- return e instanceof HTMLInputElement ? M.INPUT_EVENT_TYPES.includes(e.type) || e.type === "hidden" : e instanceof HTMLTextAreaElement || e instanceof HTMLSelectElement;
3487
+ return e instanceof HTMLInputElement ? C.INPUT_EVENT_TYPES.includes(e.type) || e.type === "hidden" : e instanceof HTMLTextAreaElement || e instanceof HTMLSelectElement;
3485
3488
  }
3486
3489
  /**
3487
3490
  * 内部の値をDOMの値と同期します。
@@ -3529,7 +3532,7 @@ const M = class M extends N {
3529
3532
  */
3530
3533
  recordValueWriteResult(e) {
3531
3534
  if (!e && this.value !== null && this.value !== "") {
3532
- this.valueWriteUnapplied = !0, M.UNAPPLIED_VALUE_WRITES.add(this);
3535
+ this.valueWriteUnapplied = !0, C.UNAPPLIED_VALUE_WRITES.add(this);
3533
3536
  return;
3534
3537
  }
3535
3538
  this.clearUnappliedValueWrite();
@@ -3559,7 +3562,7 @@ const M = class M extends N {
3559
3562
  * @returns 収集する値
3560
3563
  */
3561
3564
  getValueForCollection() {
3562
- return this.skipChangeValue || this.valueWriteUnapplied ? this.value : M.isValuePropertyTarget(this.getTarget()) ? this.readValueFromDom() : this.value;
3565
+ return this.skipChangeValue || this.valueWriteUnapplied ? this.value : C.isValuePropertyTarget(this.getTarget()) ? this.readValueFromDom() : this.value;
3563
3566
  }
3564
3567
  /**
3565
3568
  * チェック状態の DOM 反映に合わせて内部値を DOM から同期します。
@@ -3579,7 +3582,7 @@ const M = class M extends N {
3579
3582
  if (!t)
3580
3583
  return;
3581
3584
  const r = N.get(t);
3582
- r instanceof M && r.syncValue();
3585
+ r instanceof C && r.syncValue();
3583
3586
  }
3584
3587
  /**
3585
3588
  * 指定した属性のいずれかを自身が書き込み中なら、その完了 Promise を返します。
@@ -3695,8 +3698,8 @@ const M = class M extends N {
3695
3698
  return e === t ? this.removeAttribute(e) : this.removeAliasedAttribute(e, t);
3696
3699
  const o = new we(e, r);
3697
3700
  if (n) {
3698
- const ke = this.attributeMap.get(e);
3699
- if (ke && (ke.isEvaluate || ke.isForceEvaluation()) && !o.isEvaluate && !o.isForceEvaluation()) {
3701
+ const xe = this.attributeMap.get(e);
3702
+ if (xe && (xe.isEvaluate || xe.isForceEvaluation()) && !o.isEvaluate && !o.isForceEvaluation()) {
3700
3703
  const Ve = W.enqueue(() => {
3701
3704
  }).finally(() => {
3702
3705
  this.releaseSelfWritingAttributes(s);
@@ -3710,24 +3713,24 @@ const M = class M extends N {
3710
3713
  element: l,
3711
3714
  rawName: e,
3712
3715
  template: r
3713
- }), d = o.isEvaluate || o.isRawEvaluate, h = e === t && M.BOOLEAN_ATTRIBUTES.has(t.toLowerCase()), y = o.isSingleExpression(), A = ie.joinEvaluateResults(c.results), S = c.results.length === 1 ? c.results[0] : A, P = !o.isForceEvaluation() && (t !== e || h || y ? c.hasUnresolvedReference || S === null || S === void 0 || S === !1 : d && A === "");
3714
- P && c.hasUnresolvedReference && M.warnUnresolvedAttribute(
3716
+ }), d = o.isEvaluate || o.isRawEvaluate, h = e === t && C.BOOLEAN_ATTRIBUTES.has(t.toLowerCase()), y = o.isSingleExpression(), A = ie.joinEvaluateResults(c.results), S = c.results.length === 1 ? c.results[0] : A, P = !o.isForceEvaluation() && (t !== e || h || y ? c.hasUnresolvedReference || S === null || S === void 0 || S === !1 : d && A === "");
3717
+ P && c.hasUnresolvedReference && C.warnUnresolvedAttribute(
3715
3718
  e,
3716
3719
  t,
3717
3720
  r,
3718
3721
  l
3719
3722
  );
3720
- const D = o.isForceEvaluation() ? r : y ? S : A, L = i && o.isEvaluate && t === "value" && M.isValuePropertyTarget(l), E = l.getRootNode(), v = L && (l === E.activeElement || this.hasPendingUserEdit()), R = P || D === null || D === !1 ? null : String(D), k = e !== t && l.getAttribute(e) !== r, x = R === null ? l.hasAttribute(t) : l.getAttribute(t) !== R, V = R === null ? "" : R, G = L && !v && l.value !== V, _ = t === "checked" && l instanceof HTMLInputElement && (l.type === "checkbox" || l.type === "radio"), Z = t === "selected" && l instanceof HTMLOptionElement, Ne = E.activeElement, Fe = Ne !== null && (_ && l === Ne || Z && l.closest("select") === Ne) || (_ || Z) && this.hasPendingCheckableUserEdit(Z), be = R !== null, xe = _ && !Fe && l.checked !== be, ye = Z && !Fe && l.selected !== be;
3721
- if (!k && !x && !G && !xe && !ye)
3723
+ const D = o.isForceEvaluation() ? r : y ? S : A, L = i && o.isEvaluate && t === "value" && C.isValuePropertyTarget(l), E = l.getRootNode(), v = L && (l === E.activeElement || this.hasPendingUserEdit()), R = P || D === null || D === !1 ? null : String(D), x = e !== t && l.getAttribute(e) !== r, k = R === null ? l.hasAttribute(t) : l.getAttribute(t) !== R, V = R === null ? "" : R, G = L && !v && l.value !== V, _ = t === "checked" && l instanceof HTMLInputElement && (l.type === "checkbox" || l.type === "radio"), Z = t === "selected" && l instanceof HTMLOptionElement, Ne = E.activeElement, Fe = Ne !== null && (_ && l === Ne || Z && l.closest("select") === Ne) || (_ || Z) && this.hasPendingCheckableUserEdit(Z), be = R !== null, ke = _ && !Fe && l.checked !== be, ye = Z && !Fe && l.selected !== be;
3724
+ if (!x && !k && !G && !ke && !ye)
3722
3725
  return L && !v && (this.value = this.normalizeValueForElement(
3723
3726
  l,
3724
3727
  V
3725
3728
  ), this.clearUnappliedValueWrite()), (_ || Z) && !Fe && this.syncCheckableValueFromDom(Z), Promise.resolve();
3726
3729
  const Ue = W.enqueue(() => {
3727
- k && l.setAttribute(e, r), R === null ? l.removeAttribute(t) : x && (l.setAttribute(t, R), t === `${u.prefix}bind` && this.recordSelfWrittenBind(R)), L && !v && (this.value = this.normalizeValueForElement(
3730
+ x && l.setAttribute(e, r), R === null ? l.removeAttribute(t) : k && (l.setAttribute(t, R), t === `${u.prefix}bind` && this.recordSelfWrittenBind(R)), L && !v && (this.value = this.normalizeValueForElement(
3728
3731
  l,
3729
3732
  V
3730
- ), G && (l.value = V), this.recordValueWriteResult(l.value === V)), xe && (l.checked = be), ye && (l.selected = be), (xe || ye) && this.syncCheckableValueFromDom(ye);
3733
+ ), G && (l.value = V), this.recordValueWriteResult(l.value === V)), ke && (l.checked = be), ye && (l.selected = be), (ke || ye) && this.syncCheckableValueFromDom(ye);
3731
3734
  }).finally(() => {
3732
3735
  this.releaseSelfWritingAttributes(s);
3733
3736
  });
@@ -3964,7 +3967,7 @@ const M = class M extends N {
3964
3967
  return Promise.resolve();
3965
3968
  this.visible = !1;
3966
3969
  const e = this.getTarget();
3967
- return this.display = e.style.getPropertyValue("display"), this.displayPriority = e.style.getPropertyPriority("display"), e.style.setProperty("display", "none", "important"), e.setAttribute(`${u.prefix}if-false`, ""), M.disableFormControlsInBranch(e), Promise.resolve();
3970
+ return this.display = e.style.getPropertyValue("display"), this.displayPriority = e.style.getPropertyPriority("display"), e.style.setProperty("display", "none", "important"), e.setAttribute(`${u.prefix}if-false`, ""), C.disableFormControlsInBranch(e), Promise.resolve();
3968
3971
  }
3969
3972
  /**
3970
3973
  * 分岐配下のフォームコントロールを順に処理します。
@@ -4002,7 +4005,7 @@ const M = class M extends N {
4002
4005
  * @returns 戻り値はありません。
4003
4006
  */
4004
4007
  static disableFormControlsInBranch(e) {
4005
- M.forEachFormControlInBranch(e, (t) => {
4008
+ C.forEachFormControlInBranch(e, (t) => {
4006
4009
  t.hasAttribute("disabled") || (t.setAttribute(pe, ""), t.setAttribute("disabled", ""));
4007
4010
  });
4008
4011
  }
@@ -4016,7 +4019,7 @@ const M = class M extends N {
4016
4019
  * @returns 戻り値はありません。
4017
4020
  */
4018
4021
  restoreFormControlsDisabledByIf() {
4019
- M.forEachFormControlInBranch(this.getTarget(), (e) => {
4022
+ C.forEachFormControlInBranch(this.getTarget(), (e) => {
4020
4023
  e.hasAttribute(pe) && (e.removeAttribute(pe), e.removeAttribute("disabled"));
4021
4024
  });
4022
4025
  }
@@ -4049,7 +4052,7 @@ const M = class M extends N {
4049
4052
  return t === null ? null : t.closestByAttribute(e);
4050
4053
  }
4051
4054
  };
4052
- M.BOOLEAN_ATTRIBUTES = /* @__PURE__ */ new Set([
4055
+ C.BOOLEAN_ATTRIBUTES = /* @__PURE__ */ new Set([
4053
4056
  "allowfullscreen",
4054
4057
  "async",
4055
4058
  "autofocus",
@@ -4073,7 +4076,7 @@ M.BOOLEAN_ATTRIBUTES = /* @__PURE__ */ new Set([
4073
4076
  "required",
4074
4077
  "reversed",
4075
4078
  "selected"
4076
- ]), M.INPUT_EVENT_TYPES = [
4079
+ ]), C.INPUT_EVENT_TYPES = [
4077
4080
  "text",
4078
4081
  "password",
4079
4082
  "email",
@@ -4088,8 +4091,8 @@ M.BOOLEAN_ATTRIBUTES = /* @__PURE__ */ new Set([
4088
4091
  "month",
4089
4092
  "time",
4090
4093
  "week"
4091
- ], M.UNAPPLIED_VALUE_WRITES = /* @__PURE__ */ new Set(), M.sequenceCounter = 0, M.bindingWorkActiveCount = 0, M.pendingMutationFlusher = null, M.loggedUnresolvedAttributes = /* @__PURE__ */ new Set();
4092
- let T = M;
4094
+ ], C.UNAPPLIED_VALUE_WRITES = /* @__PURE__ */ new Set(), C.sequenceCounter = 0, C.bindingWorkActiveCount = 0, C.pendingMutationFlusher = null, C.loggedUnresolvedAttributes = /* @__PURE__ */ new Set();
4095
+ let T = C;
4093
4096
  class Q extends N {
4094
4097
  /**
4095
4098
  * テキストフラグメントのコンストラクタ。
@@ -6102,18 +6105,21 @@ const p = class p {
6102
6105
  p.clearMessages(e),
6103
6106
  p.clearEachClones(e)
6104
6107
  ]), await W.enqueue(() => {
6105
- const n = e.getTarget();
6106
- if (n instanceof HTMLFormElement)
6107
- n.reset();
6108
+ const n = p.collectEditsAfter(
6109
+ e,
6110
+ t
6111
+ ), s = e.getTarget();
6112
+ if (s instanceof HTMLFormElement)
6113
+ s.reset();
6108
6114
  else {
6109
- n.querySelectorAll("form").forEach((a) => a.reset());
6110
- const s = n.parentElement;
6111
- if (s) {
6112
- const a = n.nextElementSibling, o = document.createElement("form");
6113
- o.appendChild(n), o.reset(), s.insertBefore(n, a);
6115
+ s.querySelectorAll("form").forEach((o) => o.reset());
6116
+ const a = s.parentElement;
6117
+ if (a) {
6118
+ const o = s.nextElementSibling, l = document.createElement("form");
6119
+ l.appendChild(s), l.reset(), a.insertBefore(s, o);
6114
6120
  }
6115
6121
  }
6116
- p.clearDeclarativeStateFromDom(e);
6122
+ p.clearDeclarativeStateFromDom(e), p.restoreEdits(n);
6117
6123
  });
6118
6124
  const i = r;
6119
6125
  for (const n of i) {
@@ -6223,6 +6229,54 @@ const p = class p {
6223
6229
  for (const t of e.getChildElementFragments())
6224
6230
  p.clearValues(t);
6225
6231
  }
6232
+ /**
6233
+ * 指定した通番より後に編集された入力欄の DOM の状態を控えます。
6234
+ *
6235
+ * ネイティブの `form.reset()` は DOM を直接書き戻すため、入力欄ごとの保護判定
6236
+ * (`ElementFragment` の編集の通番)を経由しません。リセットを要求した後に行われた
6237
+ * 編集を残すために、リセットの直前に控えて直後に戻します
6238
+ * (仕様「反映待ちの間に起きた変化」)。
6239
+ *
6240
+ * @param fragment 対象フラグメント(配下も辿る)
6241
+ * @param operationSequence この通番より後の編集を控える
6242
+ * @param collected 控えの蓄積先(再帰用)
6243
+ * @returns 控えた状態の配列
6244
+ */
6245
+ static collectEditsAfter(e, t, r = []) {
6246
+ const i = e.getTarget();
6247
+ (i instanceof HTMLInputElement || i instanceof HTMLTextAreaElement || i instanceof HTMLSelectElement) && e.getUserEditSequence() > t && (i instanceof HTMLInputElement && (i.type === "checkbox" || i.type === "radio") ? r.push({ element: i, checked: i.checked }) : i instanceof HTMLSelectElement && i.multiple ? r.push({
6248
+ element: i,
6249
+ selected: Array.from(i.selectedOptions).map(
6250
+ (n) => n.value
6251
+ )
6252
+ }) : r.push({ element: i, value: i.value }));
6253
+ for (const n of e.getChildElementFragments())
6254
+ p.collectEditsAfter(n, t, r);
6255
+ return r;
6256
+ }
6257
+ /**
6258
+ * 控えた入力欄の状態を DOM へ戻します。
6259
+ *
6260
+ * 内部値は戻しません(`Form.reset()` の呼び出し箇所のコメントを参照)。
6261
+ *
6262
+ * @param snapshots `collectEditsAfter()` で控えた状態
6263
+ * @returns 戻り値はありません。
6264
+ */
6265
+ static restoreEdits(e) {
6266
+ for (const t of e) {
6267
+ const { element: r } = t;
6268
+ if (t.checked !== void 0 && r instanceof HTMLInputElement) {
6269
+ r.checked = t.checked;
6270
+ continue;
6271
+ }
6272
+ if (t.selected !== void 0 && r instanceof HTMLSelectElement) {
6273
+ for (const i of Array.from(r.options))
6274
+ i.selected = t.selected.includes(i.value);
6275
+ continue;
6276
+ }
6277
+ t.value !== void 0 && (r.value = t.value);
6278
+ }
6279
+ }
6226
6280
  /**
6227
6281
  * `data-form-arg` のキーを祖先が所有するフォームを、そのレコードの内容へ戻します。
6228
6282
  *
@@ -7193,18 +7247,18 @@ const Nt = [
7193
7247
  "dialog",
7194
7248
  "openDialog",
7195
7249
  "toast"
7196
- ], Ft = "__haoriHistoryState__", Ce = "data-haori-click-lock";
7250
+ ], Ft = "__haoriHistoryState__", Me = "data-haori-click-lock";
7197
7251
  function Ae() {
7198
7252
  const e = globalThis.window?.Haori;
7199
7253
  return Nt.every(
7200
7254
  (r) => typeof e?.[r] == "function"
7201
7255
  ) ? e : he;
7202
7256
  }
7203
- const xt = /* @__PURE__ */ new Set(["GET", "HEAD", "OPTIONS"]);
7257
+ const kt = /* @__PURE__ */ new Set(["GET", "HEAD", "OPTIONS"]);
7204
7258
  function Pe(g) {
7205
- return xt.has(g.toUpperCase());
7259
+ return kt.has(g.toUpperCase());
7206
7260
  }
7207
- function kt(g, e) {
7261
+ function xt(g, e) {
7208
7262
  for (const [t, r] of Object.entries(e))
7209
7263
  r !== void 0 && (Array.isArray(r) ? r.forEach((i) => {
7210
7264
  g.append(t, le(i));
@@ -7223,9 +7277,9 @@ function le(g) {
7223
7277
  }
7224
7278
  function ft(g, e) {
7225
7279
  const t = new URL(g, window.location.href), r = new URLSearchParams(t.search);
7226
- return kt(r, e), t.search = r.toString(), t.toString();
7280
+ return xt(r, e), t.search = r.toString(), t.toString();
7227
7281
  }
7228
- function Ct(g) {
7282
+ function Mt(g) {
7229
7283
  if (g == null)
7230
7284
  return { payload: {}, dropped: !1 };
7231
7285
  if (typeof g == "string") {
@@ -7290,7 +7344,7 @@ function ne(g, e) {
7290
7344
  }
7291
7345
  return e;
7292
7346
  }
7293
- function Mt(g) {
7347
+ function Ct(g) {
7294
7348
  const e = g?.body;
7295
7349
  return e == null ? !1 : typeof e == "string" ? e !== "" : !0;
7296
7350
  }
@@ -7304,7 +7358,7 @@ function Pt(g, e) {
7304
7358
  effectiveMethod: r,
7305
7359
  normalized: !1
7306
7360
  };
7307
- const { payload: i, dropped: n } = Ct(
7361
+ const { payload: i, dropped: n } = Mt(
7308
7362
  t.body
7309
7363
  );
7310
7364
  let s = g;
@@ -7648,8 +7702,8 @@ ${v}
7648
7702
  R = new Function("event", `"use strict";
7649
7703
  ${v}
7650
7704
  `);
7651
- } catch (k) {
7652
- m.error("Haori", `Invalid run script: ${k}`);
7705
+ } catch (x) {
7706
+ m.error("Haori", `Invalid run script: ${x}`);
7653
7707
  }
7654
7708
  }
7655
7709
  R && (r.runScript = R);
@@ -7753,8 +7807,8 @@ ${v}
7753
7807
  if (E) {
7754
7808
  const v = z.queryAll(E, o);
7755
7809
  v.length > 0 ? (r.bindFragments = [], v.forEach((R) => {
7756
- const k = N.get(R);
7757
- k && r.bindFragments.push(k);
7810
+ const x = N.get(R);
7811
+ x && r.bindFragments.push(x);
7758
7812
  })) : m.error(
7759
7813
  "Haori",
7760
7814
  `Bind element not found: ${E} (${o})`
@@ -7791,12 +7845,12 @@ ${v}
7791
7845
  b.attrName(t, "adjust")
7792
7846
  );
7793
7847
  if (R) {
7794
- const k = z.queryAll(
7848
+ const x = z.queryAll(
7795
7849
  R,
7796
7850
  b.attrName(t, "adjust")
7797
7851
  );
7798
- k.length > 0 ? (r.adjustFragments = [], k.forEach((x) => {
7799
- const V = N.get(x);
7852
+ x.length > 0 ? (r.adjustFragments = [], x.forEach((k) => {
7853
+ const V = N.get(k);
7800
7854
  V && r.adjustFragments.push(V);
7801
7855
  })) : m.error(
7802
7856
  "Haori",
@@ -7804,10 +7858,10 @@ ${v}
7804
7858
  );
7805
7859
  }
7806
7860
  if (e.hasAttribute(b.attrName(t, "adjust-value"))) {
7807
- const k = e.getRawAttribute(
7861
+ const x = e.getRawAttribute(
7808
7862
  b.attrName(t, "adjust-value")
7809
- ), x = Number(k);
7810
- isNaN(x) || (r.adjustValue = x);
7863
+ ), k = Number(x);
7864
+ isNaN(k) || (r.adjustValue = k);
7811
7865
  }
7812
7866
  }
7813
7867
  if (e.hasAttribute(b.attrName(t, "row-add")) && (r.rowAdd = !0), e.hasAttribute(b.attrName(t, "row-remove")) && (r.rowRemove = !0), e.hasAttribute(b.attrName(t, "row-prev")) && (r.rowMovePrev = !0), e.hasAttribute(b.attrName(t, "row-next")) && (r.rowMoveNext = !0), e.hasAttribute(`${u.prefix}${t}-after-run`)) {
@@ -7822,8 +7876,8 @@ ${v}
7822
7876
  ${R}
7823
7877
  `
7824
7878
  );
7825
- } catch (k) {
7826
- m.error("Haori", `Invalid after script: ${k}`);
7879
+ } catch (x) {
7880
+ m.error("Haori", `Invalid after script: ${x}`);
7827
7881
  }
7828
7882
  }
7829
7883
  if (e.hasAttribute(b.attrName(t, "dialog")) && (r.dialogMessage = b.unescapeNewlines(
@@ -7842,8 +7896,8 @@ ${R}
7842
7896
  );
7843
7897
  const R = e.getRawAttribute(
7844
7898
  b.attrName(t, "toast-level")
7845
- ), x = ["info", "warning", "error", "success"].includes(R);
7846
- r.toastLevel = x ? R : null;
7899
+ ), k = ["info", "warning", "error", "success"].includes(R);
7900
+ r.toastLevel = k ? R : null;
7847
7901
  }
7848
7902
  if (e.hasAttribute(b.attrName(t, "redirect"))) {
7849
7903
  r.redirectUrl = b.readLateAttribute(
@@ -7879,12 +7933,12 @@ ${R}
7879
7933
  b.attrName(t, "history-form")
7880
7934
  );
7881
7935
  if (R) {
7882
- const k = z.query(
7936
+ const x = z.query(
7883
7937
  R,
7884
7938
  b.attrName(t, "history-form")
7885
7939
  );
7886
- k !== null ? r.historyFormFragment = F.getFormFragment(
7887
- N.get(k)
7940
+ x !== null ? r.historyFormFragment = F.getFormFragment(
7941
+ N.get(x)
7888
7942
  ) : m.error(
7889
7943
  "Haori",
7890
7944
  `Form element not found: ${R} (${b.attrName(t, "history-form")})`
@@ -7901,18 +7955,18 @@ ${R}
7901
7955
  "open",
7902
7956
  "close"
7903
7957
  ].forEach((R) => {
7904
- const k = b.attrName(t, R);
7905
- if (!e.hasAttribute(k))
7958
+ const x = b.attrName(t, R);
7959
+ if (!e.hasAttribute(x))
7906
7960
  return;
7907
- const x = z.read(e, k), V = [];
7908
- if (x)
7909
- z.queryAll(x, k).forEach((_) => {
7961
+ const k = z.read(e, x), V = [];
7962
+ if (k)
7963
+ z.queryAll(k, x).forEach((_) => {
7910
7964
  const Z = N.get(_);
7911
7965
  Z && V.push(Z);
7912
- }), V.length === 0 && m.error("Haori", `Element not found: ${x} (${k})`);
7966
+ }), V.length === 0 && m.error("Haori", `Element not found: ${k} (${x})`);
7913
7967
  else if (R === "open" || R === "close") {
7914
7968
  const G = e.getTarget().closest("dialog");
7915
- G ? V.push(N.get(G)) : m.error("Haori", `Ancestor <dialog> not found (${k})`);
7969
+ G ? V.push(N.get(G)) : m.error("Haori", `Ancestor <dialog> not found (${x})`);
7916
7970
  } else
7917
7971
  V.push(e);
7918
7972
  if (V.length > 0)
@@ -7944,10 +7998,10 @@ ${R}
7944
7998
  if (e.hasAttribute(v)) {
7945
7999
  const R = z.read(e, v);
7946
8000
  if (R) {
7947
- const k = z.query(R, v);
7948
- if (k !== null) {
7949
- const x = N.get(k);
7950
- x ? r.copySourceFragment = x : m.error(
8001
+ const x = z.query(R, v);
8002
+ if (x !== null) {
8003
+ const k = N.get(x);
8004
+ k ? r.copySourceFragment = k : m.error(
7951
8005
  "Haori",
7952
8006
  `Element is not managed by Haori: ${R} (${v})`
7953
8007
  );
@@ -7982,9 +8036,9 @@ ${R}
7982
8036
  const D = t ? b.attrName(t, "fetch-state") : b.attrName(null, "state", !0);
7983
8037
  if (e.hasAttribute(D)) {
7984
8038
  const E = z.read(e, D), v = [];
7985
- E ? (z.queryAll(E, D).forEach((k) => {
7986
- const x = N.get(k);
7987
- x && v.push(x);
8039
+ E ? (z.queryAll(E, D).forEach((x) => {
8040
+ const k = N.get(x);
8041
+ k && v.push(k);
7988
8042
  }), v.length === 0 && m.error(
7989
8043
  "Haori",
7990
8044
  `Element not found: ${E} (${D})`
@@ -8002,10 +8056,10 @@ ${R}
8002
8056
  r.storeClearKey = v;
8003
8057
  const R = e.getRawAttribute(
8004
8058
  `${L}-type`
8005
- ), k = R === null ? "session" : R.trim();
8006
- k === "local" || k === "session" ? r.storeClearKind = k : (m.warn(
8059
+ ), x = R === null ? "session" : R.trim();
8060
+ x === "local" || x === "session" ? r.storeClearKind = x : (m.warn(
8007
8061
  "Haori",
8008
- `${L}-type は session または local を指定してください(session として扱います): ${k}`
8062
+ `${L}-type は session または local を指定してください(session として扱います): ${x}`
8009
8063
  ), r.storeClearKind = "session");
8010
8064
  }
8011
8065
  }
@@ -8146,7 +8200,7 @@ ${R}
8146
8200
  }
8147
8201
  const l = Object.keys(i).length > 0;
8148
8202
  if (n) {
8149
- const h = (s?.method || "GET").toUpperCase(), A = !a && o && r.transportMode === "query-get" && Mt(s) && !Pe(h) ? r.baseUrl ?? n : n, S = Pt(
8203
+ const h = (s?.method || "GET").toUpperCase(), A = !a && o && r.transportMode === "query-get" && Ct(s) && !Pe(h) ? r.baseUrl ?? n : n, S = Pt(
8150
8204
  A,
8151
8205
  s
8152
8206
  );
@@ -8161,7 +8215,7 @@ ${R}
8161
8215
  payload: l ? i : void 0,
8162
8216
  queryString: v
8163
8217
  }), this.options.targetFragment && n) {
8164
- const R = performance.now(), k = {
8218
+ const R = performance.now(), x = {
8165
8219
  runtime: u.runtime,
8166
8220
  requestedMethod: D,
8167
8221
  effectiveMethod: L,
@@ -8173,21 +8227,21 @@ ${R}
8173
8227
  n,
8174
8228
  P,
8175
8229
  l ? i : void 0,
8176
- k
8177
- ), await this.injectFetchState("loading"), fetch(n, P).then((x) => this.handleFetchResult(
8178
- x,
8230
+ x
8231
+ ), await this.injectFetchState("loading"), fetch(n, P).then((k) => this.handleFetchResult(
8232
+ k,
8179
8233
  n || void 0,
8180
8234
  R
8181
- )).catch(async (x) => {
8235
+ )).catch(async (k) => {
8182
8236
  throw n && H.fetchError(
8183
8237
  this.options.targetFragment.getTarget(),
8184
8238
  n,
8185
- x
8239
+ k
8186
8240
  ), await this.injectFetchState(
8187
8241
  "error",
8188
8242
  null,
8189
- x instanceof Error ? x.message : String(x)
8190
- ), x;
8243
+ k instanceof Error ? k.message : String(k)
8244
+ ), k;
8191
8245
  });
8192
8246
  }
8193
8247
  return fetch(n, P).then((R) => this.handleFetchResult(R, n || void 0));
@@ -8235,10 +8289,10 @@ ${R}
8235
8289
  if (this.eventType !== "click" || !this.options.targetFragment)
8236
8290
  return null;
8237
8291
  const t = this.options.targetFragment.getTarget();
8238
- if (b.RUNNING_CLICK_TARGETS.has(t) || t.matches(":disabled") || t.hasAttribute("disabled") || t.hasAttribute(Ce))
8292
+ if (b.RUNNING_CLICK_TARGETS.has(t) || t.matches(":disabled") || t.hasAttribute("disabled") || t.hasAttribute(Me))
8239
8293
  return !1;
8240
8294
  const r = t.hasAttribute(`${u.prefix}click-no-disabled`);
8241
- return b.RUNNING_CLICK_TARGETS.add(t), t.setAttribute(Ce, ""), r || t.setAttribute("disabled", ""), {
8295
+ return b.RUNNING_CLICK_TARGETS.add(t), t.setAttribute(Me, ""), r || t.setAttribute("disabled", ""), {
8242
8296
  target: t,
8243
8297
  appliedDisabledAttribute: !r
8244
8298
  };
@@ -8250,7 +8304,7 @@ ${R}
8250
8304
  * @returns 戻り値はありません。
8251
8305
  */
8252
8306
  releaseExecutionLock(e) {
8253
- e && (b.RUNNING_CLICK_TARGETS.delete(e.target), e.target.removeAttribute(Ce), e.appliedDisabledAttribute && e.target.removeAttribute("disabled"));
8307
+ e && (b.RUNNING_CLICK_TARGETS.delete(e.target), e.target.removeAttribute(Me), e.appliedDisabledAttribute && e.target.removeAttribute("disabled"));
8254
8308
  }
8255
8309
  /**
8256
8310
  * フェッチ後の処理を実行します。
@@ -11386,13 +11440,13 @@ ${r}
11386
11440
  );
11387
11441
  const h = d.map((E) => E.getListKey()), y = /* @__PURE__ */ new Set();
11388
11442
  d = d.filter((E, v) => {
11389
- const R = String(E.getListKey()), k = l.get(R) ?? 0;
11390
- if (k === 0) {
11443
+ const R = String(E.getListKey()), x = l.get(R) ?? 0;
11444
+ if (x === 0) {
11391
11445
  y.add(E);
11392
- const x = E.getListKey();
11393
- return x !== null && H.rowRemove(E.getTarget(), x, v), c.push(E.remove()), !1;
11446
+ const k = E.getListKey();
11447
+ return k !== null && H.rowRemove(E.getTarget(), k, v), c.push(E.remove()), !1;
11394
11448
  }
11395
- return l.set(R, k - 1), !0;
11449
+ return l.set(R, x - 1), !0;
11396
11450
  });
11397
11451
  const A = d.map((E) => E.getListKey()), S = /* @__PURE__ */ new Map();
11398
11452
  d.forEach((E) => {
@@ -11407,18 +11461,18 @@ ${r}
11407
11461
  ).length;
11408
11462
  let L = Promise.resolve();
11409
11463
  return a.forEach((E, v) => {
11410
- const R = t[v], k = v;
11411
- let x;
11464
+ const R = t[v], x = v;
11465
+ let k;
11412
11466
  const V = S.get(E)?.shift();
11413
11467
  if (V) {
11414
- x = V;
11468
+ k = V;
11415
11469
  const G = D + v;
11416
11470
  L = L.then(
11417
11471
  () => f.updateRowFragment(
11418
- x,
11472
+ k,
11419
11473
  R,
11420
11474
  i,
11421
- k,
11475
+ x,
11422
11476
  s ? String(s) : null,
11423
11477
  E
11424
11478
  ).then(
@@ -11428,40 +11482,40 @@ ${r}
11428
11482
  // される)で DOM の順序が古いまま残る。
11429
11483
  f.repositionEachRow(
11430
11484
  e,
11431
- x,
11485
+ k,
11432
11486
  P,
11433
11487
  G
11434
11488
  ).then((Z) => {
11435
11489
  if (Z !== null && H.rowMove(
11436
- x.getTarget(),
11490
+ k.getTarget(),
11437
11491
  E,
11438
11492
  Z - D,
11439
11493
  v
11440
11494
  ), !!_)
11441
- return f.clearUserEditMarks(x), f.evaluateAll(x).then(
11442
- () => f.applyRowFormValues(e, x, R)
11495
+ return f.clearUserEditMarks(k), f.evaluateAll(k).then(
11496
+ () => f.applyRowFormValues(e, k, R)
11443
11497
  );
11444
11498
  })
11445
11499
  )
11446
11500
  )
11447
11501
  );
11448
11502
  } else {
11449
- x = r.clone();
11503
+ k = r.clone();
11450
11504
  const G = D + v;
11451
11505
  L = L.then(
11452
11506
  () => f.updateRowFragment(
11453
- x,
11507
+ k,
11454
11508
  R,
11455
11509
  i,
11456
- k,
11510
+ x,
11457
11511
  s ? String(s) : null,
11458
11512
  E
11459
11513
  ).then(() => {
11460
11514
  const _ = P[G] ?? null;
11461
- return e.insertBefore(x, _).then(() => {
11462
- P.splice(G, 0, x);
11463
- }).then(() => f.initializeFreshEachRow(x)).then(() => f.applyRowFormValues(e, x, R)).then(() => {
11464
- H.rowAdd(x.getTarget(), E, k, R);
11515
+ return e.insertBefore(k, _).then(() => {
11516
+ P.splice(G, 0, k);
11517
+ }).then(() => f.initializeFreshEachRow(k)).then(() => f.applyRowFormValues(e, k, R)).then(() => {
11518
+ H.rowAdd(k.getTarget(), E, x, R);
11465
11519
  });
11466
11520
  })
11467
11521
  );
@@ -11471,14 +11525,14 @@ ${r}
11471
11525
  (G) => G !== null
11472
11526
  ), v = A.filter(
11473
11527
  (G) => G !== null
11474
- ), R = new Set(v), k = E.filter((G) => !R.has(G)), V = h.filter(
11528
+ ), R = new Set(v), x = E.filter((G) => !R.has(G)), V = h.filter(
11475
11529
  (G) => G !== null
11476
11530
  ).filter(
11477
11531
  (G) => !o.has(G)
11478
11532
  );
11479
11533
  H.eachUpdate(
11480
11534
  e.getTarget(),
11481
- k,
11535
+ x,
11482
11536
  V,
11483
11537
  E
11484
11538
  );
@@ -11964,13 +12018,23 @@ const fe = class fe {
11964
12018
  n();
11965
12019
  }
11966
12020
  /**
11967
- * 手続きを起動しない `input` について、ユーザー編集だけを記録します。
12021
+ * 手続きを起動しない `input` について、ユーザー編集の通番だけを発番します。
11968
12022
  *
11969
12023
  * `data-input-*` を宣言していない入力欄でも、打鍵は編集として記録しなければ
11970
12024
  * なりません(記録しないと、反映待ちの書き込みが打鍵の後に着弾して打った文字を
11971
12025
  * 消します)。初期化中は手続きと同じく保留し、フラグメントが確定した後に記録
11972
12026
  * します。
11973
12027
  *
12028
+ * **内部値は同期しません**(`syncUserEdit()` との違い)。内部値は「バインドデータへ
12029
+ * 載っている値」を表し、DOM が先に進むことは許されています(値収集は DOM を真として
12030
+ * 読みます。`ElementFragment.getValueForCollection()`)。ここで同期すると、まだ
12031
+ * バインドデータへ載っていない値が内部値だけに載った状態になり、次の逆方向同期
12032
+ * (`Form.syncValues()`)が古いバインドデータで入力欄を上書きして値を消します。
12033
+ * 反映待ちの書き込みからの保護は通番の発番だけで成立します。
12034
+ *
12035
+ * 内部値を DOM から取り込むのは、値がバインドデータへ載る機会(`change` の双方向
12036
+ * コミット、または `data-input-*` を宣言した要素の手続き)と同じ時点だけです。
12037
+ *
11974
12038
  * 対象は値を持つ入力要素だけです。`contenteditable` など値収集の対象でない要素で
11975
12039
  * `input` が発火しても、記録すべき編集はありません。
11976
12040
  *
@@ -11981,16 +12045,30 @@ const fe = class fe {
11981
12045
  if (!(!(e instanceof HTMLInputElement) && !(e instanceof HTMLSelectElement) && !(e instanceof HTMLTextAreaElement))) {
11982
12046
  if (this.deferred) {
11983
12047
  this.deferredProcedures.push(() => {
11984
- e.isConnected && this.syncUserEdit(e);
12048
+ e.isConnected && this.markUserEditOnly(e);
11985
12049
  });
11986
12050
  return;
11987
12051
  }
11988
- this.syncUserEdit(e);
12052
+ this.markUserEditOnly(e);
11989
12053
  }
11990
12054
  }
12055
+ /**
12056
+ * 内部値を同期せず、ユーザー編集の通番だけを発番します。
12057
+ *
12058
+ * @param element 編集された要素
12059
+ * @returns 戻り値はない。
12060
+ */
12061
+ markUserEditOnly(e) {
12062
+ const t = N.get(e);
12063
+ t instanceof T && t.markUserEdit();
12064
+ }
11991
12065
  /**
11992
12066
  * `change` / `input` の対象要素について、内部値の同期とユーザー編集の記録を行います。
11993
12067
  *
12068
+ * 呼び出すのは、値がバインドデータへ載る機会と同じ時点に限ります(`change` の
12069
+ * 双方向コミット、または `data-input-*` を宣言した要素の手続き)。手続きを
12070
+ * 起動しない `input` では内部値を同期してはいけません(`recordUserEdit()`)。
12071
+ *
11994
12072
  * @param element 編集された要素
11995
12073
  * @returns 戻り値はない。
11996
12074
  */
@@ -12728,7 +12806,7 @@ w.CONFIG_KEYS = /* @__PURE__ */ new Set([
12728
12806
  "state"
12729
12807
  ]), w.DEFAULT_INTERVAL_MS = 5e3, w.MIN_INTERVAL_MS = 100, w.registrations = /* @__PURE__ */ new Map(), w.visibilityListener = null;
12730
12808
  let ce = w;
12731
- const Ht = "0.41.2";
12809
+ const Ht = "0.41.4";
12732
12810
  function Ut(g) {
12733
12811
  typeof requestAnimationFrame == "function" ? requestAnimationFrame(() => g()) : Promise.resolve().then(g);
12734
12812
  }