haori 0.59.5 → 0.60.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/README.ja.md +4 -2
- package/README.md +4 -2
- package/dist/haori.cjs.js +13 -10
- package/dist/haori.es.js +341 -259
- package/dist/haori.iife.js +15 -12
- package/dist/index.d.ts +50 -7
- package/package.json +1 -1
package/dist/haori.es.js
CHANGED
|
@@ -1529,8 +1529,8 @@ ${t}`;
|
|
|
1529
1529
|
return { value: null, unresolvedReference: !1 };
|
|
1530
1530
|
try {
|
|
1531
1531
|
const y = [], E = this.wrapBoundValues(a);
|
|
1532
|
-
m.bindKeys.forEach((
|
|
1533
|
-
y.push(E[
|
|
1532
|
+
m.bindKeys.forEach((D) => {
|
|
1533
|
+
y.push(E[D]);
|
|
1534
1534
|
});
|
|
1535
1535
|
const A = this.withBlockedPropertyAccess(
|
|
1536
1536
|
() => m.evaluator(...y)
|
|
@@ -3016,7 +3016,7 @@ const de = class de {
|
|
|
3016
3016
|
};
|
|
3017
3017
|
de.FRAGMENT_CACHE = /* @__PURE__ */ new WeakMap();
|
|
3018
3018
|
let T = de;
|
|
3019
|
-
const
|
|
3019
|
+
const v = class v extends T {
|
|
3020
3020
|
/**
|
|
3021
3021
|
* エレメントフラグメントのコンストラクタ。
|
|
3022
3022
|
* アトリビュートや子フラグメントの作成も行います。
|
|
@@ -3024,7 +3024,7 @@ const w = class w extends T {
|
|
|
3024
3024
|
* @param target 対象エレメント
|
|
3025
3025
|
*/
|
|
3026
3026
|
constructor(e) {
|
|
3027
|
-
super(e), this.children = [], this.attributeMap = /* @__PURE__ */ new Map(), this.bindingData = null, this.bindingWorkChain = Promise.resolve(), this.bindingWorkActive = 0, this.lastSupplySequence = 0, this.lastResetSequence = 0, this.initialBindAttribute = null, this.derivedBindingData = null, this.bindingDataCache = null, this.descendantBindingDataCache = null, this.visible = !0, this.display = null, this.displayPriority = null, this.template = null, this.rowLocalTemplate = null, this.listKey = null, this.renderSignature = null, this.eachInputSignature = null, this.deriveSubtreeSignature = null, this.deriveInputSignature = null, this.freshInitializationSkippable = !1, this.initialized = !1, this.value = null, this.selfWritingAttributes = /* @__PURE__ */ new Map(), this.skipChangeValue = !1, this.valueWriteUnapplied = !1, this.pendingValueWrite = null, this.userEditSequence = 0, this.authoritativeValueSequence = 0, this.lastValueSequence = 0, this.lastValueKind = "nonSupply", this.selfWrittenBind = /* @__PURE__ */ new Map(), this.lastPathApplied = /* @__PURE__ */ new Map(), this.lastChangeSequence = 0,
|
|
3027
|
+
super(e), this.children = [], this.attributeMap = /* @__PURE__ */ new Map(), this.bindingData = null, this.bindingWorkChain = Promise.resolve(), this.bindingWorkActive = 0, this.lastSupplySequence = 0, this.lastResetSequence = 0, this.initialBindAttribute = null, this.derivedBindingData = null, this.bindingDataCache = null, this.descendantBindingDataCache = null, this.visible = !0, this.display = null, this.displayPriority = null, this.template = null, this.rowLocalTemplate = null, this.listKey = null, this.renderSignature = null, this.eachInputSignature = null, this.deriveSubtreeSignature = null, this.deriveInputSignature = null, this.freshInitializationSkippable = !1, this.initialized = !1, this.value = null, this.selfWritingAttributes = /* @__PURE__ */ new Map(), this.skipChangeValue = !1, this.valueWriteUnapplied = !1, this.pendingValueWrite = null, this.userEditSequence = 0, this.authoritativeValueSequence = 0, this.lastValueSequence = 0, this.lastValueKind = "nonSupply", this.selfWrittenBind = /* @__PURE__ */ new Map(), this.lastPathApplied = /* @__PURE__ */ new Map(), this.lastChangeSequence = 0, v.dropFollowUpArtifacts(e), this.syncValue(), this.initialBindAttribute = e.getAttribute(`${c.prefix}bind`), e.getAttributeNames().forEach((i) => {
|
|
3028
3028
|
const n = e.getAttribute(i);
|
|
3029
3029
|
if (n !== null && !this.attributeMap.has(i)) {
|
|
3030
3030
|
const s = new $e(i, n);
|
|
@@ -3034,7 +3034,7 @@ const w = class w extends T {
|
|
|
3034
3034
|
let t = null;
|
|
3035
3035
|
const r = [];
|
|
3036
3036
|
e.childNodes.forEach((i) => {
|
|
3037
|
-
if (
|
|
3037
|
+
if (v.isOwnedWithinExternal(i))
|
|
3038
3038
|
return;
|
|
3039
3039
|
const n = T.peek(i)?.getParent() ?? null, s = T.get(i);
|
|
3040
3040
|
n !== null && n !== this && (t = t ?? n, n === t && r.push(s)), s.setParent(this), this.children.push(s);
|
|
@@ -3097,7 +3097,7 @@ const w = class w extends T {
|
|
|
3097
3097
|
*/
|
|
3098
3098
|
getChildElementFragments() {
|
|
3099
3099
|
return this.children.filter(
|
|
3100
|
-
(e) => e instanceof
|
|
3100
|
+
(e) => e instanceof v
|
|
3101
3101
|
);
|
|
3102
3102
|
}
|
|
3103
3103
|
/**
|
|
@@ -3129,7 +3129,7 @@ const w = class w extends T {
|
|
|
3129
3129
|
* @returns クローンされたフラグメント
|
|
3130
3130
|
*/
|
|
3131
3131
|
clone() {
|
|
3132
|
-
const e = new
|
|
3132
|
+
const e = new v(
|
|
3133
3133
|
this.target.cloneNode(!1)
|
|
3134
3134
|
);
|
|
3135
3135
|
return this.attributeMap.forEach((t, r) => {
|
|
@@ -3153,7 +3153,7 @@ const w = class w extends T {
|
|
|
3153
3153
|
* @returns 戻り値はありません。
|
|
3154
3154
|
*/
|
|
3155
3155
|
static dropFollowUpArtifacts(e) {
|
|
3156
|
-
|
|
3156
|
+
v.dropIfVisibilityArtifacts(e), e.removeAttribute(`${c.prefix}each-done`), e.removeAttribute(`${c.prefix}importing`);
|
|
3157
3157
|
}
|
|
3158
3158
|
/**
|
|
3159
3159
|
* `data-if` の非表示化が DOM へ書いた追随結果を落とします。
|
|
@@ -3168,7 +3168,7 @@ const w = class w extends T {
|
|
|
3168
3168
|
* @returns 戻り値はありません。
|
|
3169
3169
|
*/
|
|
3170
3170
|
static dropIfVisibilityArtifacts(e) {
|
|
3171
|
-
e.hasAttribute(`${c.prefix}if-false`) && (e.style.removeProperty("display"), e.getAttribute("style")?.trim() === "" && e.removeAttribute("style"), e.removeAttribute(`${c.prefix}if-false`),
|
|
3171
|
+
e.hasAttribute(`${c.prefix}if-false`) && (e.style.removeProperty("display"), e.getAttribute("style")?.trim() === "" && e.removeAttribute("style"), e.removeAttribute(`${c.prefix}if-false`), v.forEachFormControlInBranch(e, (t) => {
|
|
3172
3172
|
t.hasAttribute(ge) && (t.removeAttribute(ge), t.removeAttribute("disabled"));
|
|
3173
3173
|
}));
|
|
3174
3174
|
}
|
|
@@ -3313,7 +3313,7 @@ const w = class w extends T {
|
|
|
3313
3313
|
return e;
|
|
3314
3314
|
const r = {};
|
|
3315
3315
|
for (const i of Object.keys(t))
|
|
3316
|
-
|
|
3316
|
+
v.isReservedBindingKey(i) && (r[i] = t[i]);
|
|
3317
3317
|
return { ...r, ...e };
|
|
3318
3318
|
}
|
|
3319
3319
|
/**
|
|
@@ -3363,19 +3363,19 @@ const w = class w extends T {
|
|
|
3363
3363
|
* @returns 実行中なら true
|
|
3364
3364
|
*/
|
|
3365
3365
|
static isExecutingAnyBindingWork() {
|
|
3366
|
-
return
|
|
3366
|
+
return v.bindingWorkActiveCount > 0;
|
|
3367
3367
|
}
|
|
3368
3368
|
/**
|
|
3369
3369
|
* バインドワークの実行開始を記録します(`Core.setBindingData` の work 開始時に呼ぶ)。
|
|
3370
3370
|
*/
|
|
3371
3371
|
markBindingWorkStart() {
|
|
3372
|
-
this.bindingWorkActive++,
|
|
3372
|
+
this.bindingWorkActive++, v.bindingWorkActiveCount++;
|
|
3373
3373
|
}
|
|
3374
3374
|
/**
|
|
3375
3375
|
* バインドワークの実行終了を記録します(work 完了時に呼ぶ)。
|
|
3376
3376
|
*/
|
|
3377
3377
|
markBindingWorkEnd() {
|
|
3378
|
-
this.bindingWorkActive > 0 && (this.bindingWorkActive--,
|
|
3378
|
+
this.bindingWorkActive > 0 && (this.bindingWorkActive--, v.bindingWorkActiveCount--);
|
|
3379
3379
|
}
|
|
3380
3380
|
/**
|
|
3381
3381
|
* このフラグメントへ供給が適用されたことを記録します。
|
|
@@ -3467,7 +3467,7 @@ const w = class w extends T {
|
|
|
3467
3467
|
*/
|
|
3468
3468
|
clearBindingDataCache() {
|
|
3469
3469
|
this.bindingDataCache = null, this.descendantBindingDataCache = null, this.children.forEach((e) => {
|
|
3470
|
-
e instanceof
|
|
3470
|
+
e instanceof v && e.clearBindingDataCache();
|
|
3471
3471
|
});
|
|
3472
3472
|
}
|
|
3473
3473
|
/**
|
|
@@ -3674,7 +3674,7 @@ const w = class w extends T {
|
|
|
3674
3674
|
} else if (i instanceof HTMLSelectElement && i.multiple) {
|
|
3675
3675
|
const n = (Array.isArray(e) ? e : e === null ? [] : [e]).map(String);
|
|
3676
3676
|
return this.writeSelectedValues(n, t, r);
|
|
3677
|
-
} else return i instanceof HTMLInputElement || i instanceof HTMLTextAreaElement || i instanceof HTMLSelectElement ? this.writeScalarValue(
|
|
3677
|
+
} else return this.collectsLines() ? this.writeLinesValue(e, t, r) : i instanceof HTMLInputElement || i instanceof HTMLTextAreaElement || i instanceof HTMLSelectElement ? this.writeScalarValue(
|
|
3678
3678
|
Array.isArray(e) ? e.join(",") : e,
|
|
3679
3679
|
t,
|
|
3680
3680
|
r
|
|
@@ -3684,6 +3684,34 @@ const w = class w extends T {
|
|
|
3684
3684
|
i
|
|
3685
3685
|
), Promise.resolve());
|
|
3686
3686
|
}
|
|
3687
|
+
/**
|
|
3688
|
+
* 値を行の配列で収集する入力欄(`data-value-type="lines"` の textarea)かどうかを
|
|
3689
|
+
* 判定します。
|
|
3690
|
+
*
|
|
3691
|
+
* @returns 行の配列で収集する場合 true
|
|
3692
|
+
*/
|
|
3693
|
+
collectsLines() {
|
|
3694
|
+
const e = this.getTarget();
|
|
3695
|
+
return e instanceof HTMLTextAreaElement && v.resolveDeclaredValueType(e) === "lines";
|
|
3696
|
+
}
|
|
3697
|
+
/**
|
|
3698
|
+
* `data-value-type="lines"` の textarea へ、行の配列を反映します。
|
|
3699
|
+
*
|
|
3700
|
+
* 改行でつないで書きます。DOM の内容が同じ行の配列を表している場合は書き換え
|
|
3701
|
+
* ません。利用者が書いた空の行や前後の空白を、コミットの書き戻しで消さない
|
|
3702
|
+
* ためです(仕様「`data-value-type`」)。
|
|
3703
|
+
*
|
|
3704
|
+
* @param value 反映する値(配列、または改行区切りの文字列)
|
|
3705
|
+
* @param dispatchEvents input/change イベントを発火するかどうか
|
|
3706
|
+
* @param origin 値の由来(通番と種別)
|
|
3707
|
+
* @returns 反映完了の Promise
|
|
3708
|
+
*/
|
|
3709
|
+
writeLinesValue(e, t, r) {
|
|
3710
|
+
const i = this.getTarget(), n = v.normalizeLinesValue(e), s = n.join(`
|
|
3711
|
+
`);
|
|
3712
|
+
return v.normalizeLinesValue(i.value).join(`
|
|
3713
|
+
`) === s ? (this.value = n, Promise.resolve()) : this.writeScalarValue(s, t, r);
|
|
3714
|
+
}
|
|
3687
3715
|
/**
|
|
3688
3716
|
* 値を持つ入力エレメント(テキスト系 / textarea / 単一選択 select)へ値を反映します。
|
|
3689
3717
|
*
|
|
@@ -3702,7 +3730,7 @@ const w = class w extends T {
|
|
|
3702
3730
|
if (this.isSupersededByUserEdit(s) || r && !this.canApplyValue(r))
|
|
3703
3731
|
return;
|
|
3704
3732
|
const a = i.value;
|
|
3705
|
-
i.value = n, this.recordValueWriteResult(i.value === n), i.value !== a &&
|
|
3733
|
+
i.value = n, this.recordValueWriteResult(i.value === n), i.value !== a && v.notifyValueToEnhancers(i), t && ((i instanceof HTMLInputElement && v.INPUT_EVENT_TYPES.includes(i.type) || i instanceof HTMLTextAreaElement) && i.dispatchEvent(new Event("input", { bubbles: !0 })), i.dispatchEvent(new Event("change", { bubbles: !0 })));
|
|
3706
3734
|
});
|
|
3707
3735
|
}
|
|
3708
3736
|
/**
|
|
@@ -3730,7 +3758,7 @@ const w = class w extends T {
|
|
|
3730
3758
|
o.selected !== l && (o.selected = l, s = !0), l && a.add(o.value);
|
|
3731
3759
|
}), this.recordValueWriteResult(
|
|
3732
3760
|
e.every((o) => a.has(o))
|
|
3733
|
-
), s &&
|
|
3761
|
+
), s && v.notifyValueToEnhancers(i), s && t && i.dispatchEvent(new Event("change", { bubbles: !0 }));
|
|
3734
3762
|
});
|
|
3735
3763
|
}
|
|
3736
3764
|
/**
|
|
@@ -3783,10 +3811,10 @@ const w = class w extends T {
|
|
|
3783
3811
|
* @returns 再試行の完了 Promise
|
|
3784
3812
|
*/
|
|
3785
3813
|
static retryUnappliedValueWrites(e, t) {
|
|
3786
|
-
if (
|
|
3814
|
+
if (v.UNAPPLIED_VALUE_WRITES.size === 0)
|
|
3787
3815
|
return Promise.resolve();
|
|
3788
3816
|
const r = [];
|
|
3789
|
-
for (const i of Array.from(
|
|
3817
|
+
for (const i of Array.from(v.UNAPPLIED_VALUE_WRITES)) {
|
|
3790
3818
|
const n = i.getTarget();
|
|
3791
3819
|
if (i.wasResetAfter(t)) {
|
|
3792
3820
|
i.clearUnappliedValueWrite();
|
|
@@ -3845,7 +3873,7 @@ const w = class w extends T {
|
|
|
3845
3873
|
* @returns 戻り値はありません。
|
|
3846
3874
|
*/
|
|
3847
3875
|
clearUnappliedValueWrite() {
|
|
3848
|
-
this.valueWriteUnapplied = !1,
|
|
3876
|
+
this.valueWriteUnapplied = !1, v.UNAPPLIED_VALUE_WRITES.delete(this);
|
|
3849
3877
|
}
|
|
3850
3878
|
/**
|
|
3851
3879
|
* 入力エレメントの値を取得します。
|
|
@@ -3866,7 +3894,7 @@ const w = class w extends T {
|
|
|
3866
3894
|
* @returns 直近に発番した通番(未発番なら 0)
|
|
3867
3895
|
*/
|
|
3868
3896
|
static currentSequence() {
|
|
3869
|
-
return
|
|
3897
|
+
return v.sequenceCounter;
|
|
3870
3898
|
}
|
|
3871
3899
|
/**
|
|
3872
3900
|
* 新しい通番を発番します。
|
|
@@ -3879,7 +3907,7 @@ const w = class w extends T {
|
|
|
3879
3907
|
* @returns 発番した通番
|
|
3880
3908
|
*/
|
|
3881
3909
|
static nextSequence() {
|
|
3882
|
-
return
|
|
3910
|
+
return v.sequenceCounter += 1, v.sequenceCounter;
|
|
3883
3911
|
}
|
|
3884
3912
|
/**
|
|
3885
3913
|
* 保留中の外部 DOM 変更を取り込む処理を登録します。
|
|
@@ -3888,7 +3916,7 @@ const w = class w extends T {
|
|
|
3888
3916
|
* @returns 戻り値はありません。
|
|
3889
3917
|
*/
|
|
3890
3918
|
static setPendingMutationFlusher(e) {
|
|
3891
|
-
|
|
3919
|
+
v.pendingMutationFlusher = e;
|
|
3892
3920
|
}
|
|
3893
3921
|
/**
|
|
3894
3922
|
* 利用者の操作を起点とする通番を発番します。
|
|
@@ -3909,7 +3937,7 @@ const w = class w extends T {
|
|
|
3909
3937
|
* @returns 発番した通番
|
|
3910
3938
|
*/
|
|
3911
3939
|
static nextOperationSequence() {
|
|
3912
|
-
return
|
|
3940
|
+
return v.pendingMutationFlusher && !v.isExecutingAnyBindingWork() && v.pendingMutationFlusher(), v.nextSequence();
|
|
3913
3941
|
}
|
|
3914
3942
|
/**
|
|
3915
3943
|
* この入力欄へ値を適用してよいかを返します。
|
|
@@ -3939,7 +3967,7 @@ const w = class w extends T {
|
|
|
3939
3967
|
* @returns 適用してよい場合は true
|
|
3940
3968
|
*/
|
|
3941
3969
|
canApplyValue(e) {
|
|
3942
|
-
return e.kind === "nonSupply" && e.editedPaths !== void 0 && this.userEditSequence > 0 && this.wasResetAfter(this.userEditSequence) ? !1 :
|
|
3970
|
+
return e.kind === "nonSupply" && e.editedPaths !== void 0 && this.userEditSequence > 0 && this.wasResetAfter(this.userEditSequence) ? !1 : v.isApplicable(
|
|
3943
3971
|
{ sequence: this.lastValueSequence, kind: this.lastValueKind },
|
|
3944
3972
|
e
|
|
3945
3973
|
);
|
|
@@ -3962,7 +3990,7 @@ const w = class w extends T {
|
|
|
3962
3990
|
* @returns 適用してよい場合は true
|
|
3963
3991
|
*/
|
|
3964
3992
|
canApplyPath(e, t) {
|
|
3965
|
-
return
|
|
3993
|
+
return v.isApplicable(
|
|
3966
3994
|
this.lastPathApplied.get(e) ?? null,
|
|
3967
3995
|
t
|
|
3968
3996
|
);
|
|
@@ -4011,7 +4039,7 @@ const w = class w extends T {
|
|
|
4011
4039
|
* @returns 発番した編集の通番
|
|
4012
4040
|
*/
|
|
4013
4041
|
markUserEdit() {
|
|
4014
|
-
return this.userEditSequence =
|
|
4042
|
+
return this.userEditSequence = v.nextSequence(), this.markValueApplied({ sequence: this.userEditSequence, kind: "edit" }), this.userEditSequence;
|
|
4015
4043
|
}
|
|
4016
4044
|
/**
|
|
4017
4045
|
* `change` によるユーザー編集を記録します。
|
|
@@ -4066,7 +4094,7 @@ const w = class w extends T {
|
|
|
4066
4094
|
* @param upTo この通し番号までの編集を解除対象とする(既定は現在の最新)
|
|
4067
4095
|
* @return 戻り値はありません。
|
|
4068
4096
|
*/
|
|
4069
|
-
clearUserEditMark(e =
|
|
4097
|
+
clearUserEditMark(e = v.currentSequence()) {
|
|
4070
4098
|
e > this.authoritativeValueSequence && (this.authoritativeValueSequence = e), this.lastValueKind === "edit" && this.lastValueSequence <= e && (this.lastValueKind = "supply");
|
|
4071
4099
|
}
|
|
4072
4100
|
/**
|
|
@@ -4087,7 +4115,7 @@ const w = class w extends T {
|
|
|
4087
4115
|
if (!V.isEnabled())
|
|
4088
4116
|
return;
|
|
4089
4117
|
const n = `${e} ${r}`;
|
|
4090
|
-
|
|
4118
|
+
v.loggedUnresolvedAttributes.has(n) || (v.loggedUnresolvedAttributes.add(n), g.warn(
|
|
4091
4119
|
"[Haori]",
|
|
4092
4120
|
`Attribute "${t}" was not applied because the expression has an unresolved reference; the attribute is removed and the synchronized value is emptied: ${e}="${r}"`,
|
|
4093
4121
|
i
|
|
@@ -4110,7 +4138,7 @@ const w = class w extends T {
|
|
|
4110
4138
|
*/
|
|
4111
4139
|
static warnTypeMismatchedComparison(e, t, r, i) {
|
|
4112
4140
|
const n = `${e} ${t}`;
|
|
4113
|
-
|
|
4141
|
+
v.loggedTypeMismatchedComparisons.has(n) || (v.loggedTypeMismatchedComparisons.add(n), g.warn(
|
|
4114
4142
|
"[Haori]",
|
|
4115
4143
|
`The strict comparison compares different types (${r.left} vs ${r.right}), so it is always false even though the values match. Align the types (for example with ${c.prefix}value-type) or compare converted values: ${e}="${t}"`,
|
|
4116
4144
|
i
|
|
@@ -4132,7 +4160,7 @@ const w = class w extends T {
|
|
|
4132
4160
|
if (!t)
|
|
4133
4161
|
return !1;
|
|
4134
4162
|
const r = T.get(t);
|
|
4135
|
-
return r instanceof
|
|
4163
|
+
return r instanceof v ? r.hasPendingUserEdit() : !1;
|
|
4136
4164
|
}
|
|
4137
4165
|
/**
|
|
4138
4166
|
* `<select>` の今の選択を控え、その状態へ戻す関数を返します。
|
|
@@ -4164,7 +4192,7 @@ const w = class w extends T {
|
|
|
4164
4192
|
const t = T.get(
|
|
4165
4193
|
this.getTarget().closest("select")
|
|
4166
4194
|
);
|
|
4167
|
-
return t instanceof
|
|
4195
|
+
return t instanceof v ? t.userEditSequence : null;
|
|
4168
4196
|
}
|
|
4169
4197
|
/**
|
|
4170
4198
|
* 内部の値をクリアします。エレメントのvalue値は変化しません。
|
|
@@ -4186,16 +4214,31 @@ const w = class w extends T {
|
|
|
4186
4214
|
*
|
|
4187
4215
|
* `data-value-type` を宣言した入力欄では、宣言した型へ正規化します(仕様
|
|
4188
4216
|
* 「`data-value-type`」)。宣言は `type` より優先するため、`type="number"` へ
|
|
4189
|
-
* `string`
|
|
4190
|
-
*
|
|
4217
|
+
* `string` を宣言した場合は文字列になります。`lines` を宣言した textarea では、
|
|
4218
|
+
* 行の配列になります。それ以外の要素では値をそのまま返します。
|
|
4191
4219
|
*
|
|
4192
4220
|
* @param element 対象の入力要素
|
|
4193
4221
|
* @param value 正規化する値
|
|
4194
4222
|
* @returns 正規化後の値(宣言または `type="number"` に従う)
|
|
4195
4223
|
*/
|
|
4196
4224
|
normalizeValueForElement(e, t) {
|
|
4197
|
-
const r =
|
|
4198
|
-
return r === "boolean" ?
|
|
4225
|
+
const r = v.resolveDeclaredValueType(e);
|
|
4226
|
+
return r === "lines" ? v.normalizeLinesValue(t) : r === "boolean" ? v.normalizeBooleanValue(t) : r === "string" ? t === null ? null : String(t) : r === "number" || r === null && e instanceof HTMLInputElement && e.type === "number" ? v.normalizeNumberValue(t) : t;
|
|
4227
|
+
}
|
|
4228
|
+
/**
|
|
4229
|
+
* 値を行の配列へ正規化します。
|
|
4230
|
+
*
|
|
4231
|
+
* 改行で分け、各行の前後の空白を除き、空の行は捨てます(`\r\n` の `\r` は
|
|
4232
|
+
* 前後の空白として除かれます)。配列が渡された場合は、各要素を行として同じ規則を
|
|
4233
|
+
* 適用します。`null` と、配列の `null` の要素は空として扱います(仕様
|
|
4234
|
+
* 「`data-value-type`」)。
|
|
4235
|
+
*
|
|
4236
|
+
* @param value 正規化する値
|
|
4237
|
+
* @returns 行の配列
|
|
4238
|
+
*/
|
|
4239
|
+
static normalizeLinesValue(e) {
|
|
4240
|
+
return (Array.isArray(e) ? e.filter((r) => r !== null).map(String) : e === null ? [] : String(e).split(`
|
|
4241
|
+
`)).map((r) => r.trim()).filter((r) => r !== "");
|
|
4199
4242
|
}
|
|
4200
4243
|
/**
|
|
4201
4244
|
* 値を数値へ正規化します。
|
|
@@ -4212,7 +4255,7 @@ const w = class w extends T {
|
|
|
4212
4255
|
return null;
|
|
4213
4256
|
if (typeof e == "number")
|
|
4214
4257
|
return Number.isFinite(e) ? e : null;
|
|
4215
|
-
if (typeof e != "string" || !
|
|
4258
|
+
if (typeof e != "string" || !v.NUMBER_INPUT_PATTERN.test(e))
|
|
4216
4259
|
return null;
|
|
4217
4260
|
const t = Number(e);
|
|
4218
4261
|
return Number.isFinite(t) ? t : null;
|
|
@@ -4240,10 +4283,10 @@ const w = class w extends T {
|
|
|
4240
4283
|
* 入力欄に宣言された収集値の型(`data-value-type`)を解決します。
|
|
4241
4284
|
*
|
|
4242
4285
|
* 宣言は静的なものとして扱い、DOM の属性から直接読みます。宣言できるのは
|
|
4243
|
-
* `boolean` / `number` / `string` で、対象は値を持つ入力(`<input>`
|
|
4244
|
-
* `checkbox` / `radio` / `file` を除くもの、`<textarea>`、単一選択の
|
|
4245
|
-
*
|
|
4246
|
-
*
|
|
4286
|
+
* `boolean` / `number` / `string` / `lines` で、対象は値を持つ入力(`<input>` の
|
|
4287
|
+
* うち `checkbox` / `radio` / `file` を除くもの、`<textarea>`、単一選択の
|
|
4288
|
+
* `<select>`)です。`lines` は `<textarea>` だけです。対象外の要素や未知の型は
|
|
4289
|
+
* 宣言が無いものとして扱い、開発モードで警告します(仕様「`data-value-type`」)。
|
|
4247
4290
|
*
|
|
4248
4291
|
* @param element 対象の要素
|
|
4249
4292
|
* @returns 宣言された型。宣言が無い場合と無視する場合は null
|
|
@@ -4253,14 +4296,18 @@ const w = class w extends T {
|
|
|
4253
4296
|
if (t === null)
|
|
4254
4297
|
return null;
|
|
4255
4298
|
const r = t.trim().toLowerCase();
|
|
4256
|
-
return
|
|
4299
|
+
return v.VALUE_TYPE_NAMES.has(r) ? r === "lines" && !(e instanceof HTMLTextAreaElement) ? (v.warnValueTypeDeclaration(
|
|
4300
|
+
e,
|
|
4301
|
+
t,
|
|
4302
|
+
"lines は <textarea> にのみ指定できます"
|
|
4303
|
+
), null) : v.acceptsDeclaredValueType(e) ? r : (v.warnValueTypeDeclaration(
|
|
4257
4304
|
e,
|
|
4258
4305
|
t,
|
|
4259
4306
|
"値を持つ入力(checkbox / radio / file と複数選択の select を除く)にのみ指定できます"
|
|
4260
|
-
), null) : (
|
|
4307
|
+
), null) : (v.warnValueTypeDeclaration(
|
|
4261
4308
|
e,
|
|
4262
4309
|
t,
|
|
4263
|
-
"boolean / number / string のいずれかを指定してください"
|
|
4310
|
+
"boolean / number / string / lines のいずれかを指定してください"
|
|
4264
4311
|
), null);
|
|
4265
4312
|
}
|
|
4266
4313
|
/**
|
|
@@ -4290,7 +4337,7 @@ const w = class w extends T {
|
|
|
4290
4337
|
if (!V.isEnabled())
|
|
4291
4338
|
return;
|
|
4292
4339
|
const i = e instanceof HTMLInputElement ? `[type=${e.type}]` : "", n = `${e.tagName}${i} ${t} ${r}`;
|
|
4293
|
-
|
|
4340
|
+
v.loggedValueTypeDeclarations.has(n) || (v.loggedValueTypeDeclarations.add(n), g.warn(
|
|
4294
4341
|
"Haori",
|
|
4295
4342
|
`${c.prefix}value-type="${t}" を無視しました(${r}):`,
|
|
4296
4343
|
e
|
|
@@ -4311,7 +4358,7 @@ const w = class w extends T {
|
|
|
4311
4358
|
* @returns 同期対象の場合true
|
|
4312
4359
|
*/
|
|
4313
4360
|
static isValuePropertyTarget(e) {
|
|
4314
|
-
return e instanceof HTMLInputElement ?
|
|
4361
|
+
return e instanceof HTMLInputElement ? v.INPUT_EVENT_TYPES.includes(e.type) || e.type === "hidden" : e instanceof HTMLTextAreaElement || e instanceof HTMLSelectElement;
|
|
4315
4362
|
}
|
|
4316
4363
|
/**
|
|
4317
4364
|
* 利用者が打鍵で値を変えられる入力欄かどうかを判定します。
|
|
@@ -4350,7 +4397,7 @@ const w = class w extends T {
|
|
|
4350
4397
|
*/
|
|
4351
4398
|
readValueFromDom() {
|
|
4352
4399
|
const e = this.getTarget();
|
|
4353
|
-
if (
|
|
4400
|
+
if (v.resolveDeclaredValueType(e), e instanceof HTMLInputElement) {
|
|
4354
4401
|
if (e.type === "checkbox" || e.type === "radio") {
|
|
4355
4402
|
const t = e.type === "checkbox" && e.value === "true", r = e.value;
|
|
4356
4403
|
return e.checked ? t ? !0 : r === "false" ? !1 : r : t ? !1 : r === "false" ? !0 : null;
|
|
@@ -4379,7 +4426,7 @@ const w = class w extends T {
|
|
|
4379
4426
|
*/
|
|
4380
4427
|
recordValueWriteResult(e) {
|
|
4381
4428
|
if (!e && this.value !== null && this.value !== "") {
|
|
4382
|
-
this.valueWriteUnapplied = !0,
|
|
4429
|
+
this.valueWriteUnapplied = !0, v.UNAPPLIED_VALUE_WRITES.add(this);
|
|
4383
4430
|
return;
|
|
4384
4431
|
}
|
|
4385
4432
|
this.clearUnappliedValueWrite();
|
|
@@ -4409,7 +4456,7 @@ const w = class w extends T {
|
|
|
4409
4456
|
* @returns 収集する値
|
|
4410
4457
|
*/
|
|
4411
4458
|
getValueForCollection() {
|
|
4412
|
-
return this.skipChangeValue || this.valueWriteUnapplied ? this.value :
|
|
4459
|
+
return this.skipChangeValue || this.valueWriteUnapplied ? this.value : v.isValuePropertyTarget(this.getTarget()) ? this.readValueFromDom() : this.value;
|
|
4413
4460
|
}
|
|
4414
4461
|
/**
|
|
4415
4462
|
* チェック状態の DOM 反映に合わせて内部値を DOM から同期します。
|
|
@@ -4429,7 +4476,7 @@ const w = class w extends T {
|
|
|
4429
4476
|
if (!t)
|
|
4430
4477
|
return;
|
|
4431
4478
|
const r = T.get(t);
|
|
4432
|
-
r instanceof
|
|
4479
|
+
r instanceof v && r.syncValue();
|
|
4433
4480
|
}
|
|
4434
4481
|
/**
|
|
4435
4482
|
* 指定した属性のいずれかを自身が書き込み中なら、その完了 Promise を返します。
|
|
@@ -4560,8 +4607,8 @@ const w = class w extends T {
|
|
|
4560
4607
|
element: l,
|
|
4561
4608
|
rawName: e,
|
|
4562
4609
|
template: r
|
|
4563
|
-
}), d = o.isEvaluate || o.isRawEvaluate, m = e === t &&
|
|
4564
|
-
if (q && u.hasUnresolvedReference &&
|
|
4610
|
+
}), d = o.isEvaluate || o.isRawEvaluate, m = e === t && v.BOOLEAN_ATTRIBUTES.has(t.toLowerCase()), y = o.isSingleExpression(), E = fe.joinEvaluateResults(u.results), A = u.results.length === 1 ? u.results[0] : E, D = t === "value" && v.resolveDeclaredValueType(l) === "boolean", M = A === !1 && !D, q = !o.isForceEvaluation() && (t !== e ? u.hasUnresolvedReference || A === null || A === void 0 || M : m ? u.hasUnresolvedReference || A === null || A === void 0 || A === !1 : y ? u.hasUnresolvedReference || A === null || A === void 0 || M : d && E === "");
|
|
4611
|
+
if (q && u.hasUnresolvedReference && v.warnUnresolvedAttribute(
|
|
4565
4612
|
e,
|
|
4566
4613
|
t,
|
|
4567
4614
|
r,
|
|
@@ -4571,27 +4618,27 @@ const w = class w extends T {
|
|
|
4571
4618
|
le,
|
|
4572
4619
|
this.getBindingData()
|
|
4573
4620
|
);
|
|
4574
|
-
he !== null &&
|
|
4621
|
+
he !== null && v.warnTypeMismatchedComparison(
|
|
4575
4622
|
e,
|
|
4576
4623
|
r,
|
|
4577
4624
|
he,
|
|
4578
4625
|
l
|
|
4579
4626
|
);
|
|
4580
4627
|
}
|
|
4581
|
-
const I = o.isForceEvaluation() ? r : y ? A : E, K = i && o.isEvaluate && t === "value" &&
|
|
4582
|
-
if (!G && !
|
|
4628
|
+
const I = o.isForceEvaluation() ? r : y ? A : E, K = i && o.isEvaluate && t === "value" && v.isValuePropertyTarget(l), J = l.getRootNode(), re = this.userEditSequence, H = K && v.isUserEditableValue(l) && (l === J.activeElement || this.hasPendingUserEdit()), _ = q || I === null || I === !1 && !D ? null : String(I), G = e !== t && l.getAttribute(e) !== r, F = _ === null ? l.hasAttribute(t) : l.getAttribute(t) !== _, $ = _ === null ? "" : _, Z = K && !H && l.value !== $, Q = t === "checked" && l instanceof HTMLInputElement && (l.type === "checkbox" || l.type === "radio"), se = t === "selected" && l instanceof HTMLOptionElement, ce = J.activeElement, W = ce !== null && (Q && l === ce || se && l.closest("select") === ce) || (Q || se) && this.hasPendingCheckableUserEdit(se), Y = this.getCheckableUserEditSequence(se), X = _ !== null, Ee = Q && o.isEvaluate && !W && l.checked !== X, Ie = se && o.isEvaluate && !W && l.selected !== X;
|
|
4629
|
+
if (!G && !F && !Z && !Ee && !Ie)
|
|
4583
4630
|
return K && !H && (this.value = this.normalizeValueForElement(
|
|
4584
4631
|
l,
|
|
4585
4632
|
$
|
|
4586
4633
|
), this.clearUnappliedValueWrite()), (Q || se) && !W && this.syncCheckableValueFromDom(se), Promise.resolve();
|
|
4587
4634
|
const ze = z.enqueue(() => {
|
|
4588
|
-
const le = this.getCheckableUserEditSequence(se) !== Y, he = se && (W || le) ?
|
|
4635
|
+
const le = this.getCheckableUserEditSequence(se) !== Y, he = se && (W || le) ? v.captureSelection(
|
|
4589
4636
|
// 守るべき選択があるのは所属する `<select>` があるときだけ。
|
|
4590
4637
|
l.closest(
|
|
4591
4638
|
"select"
|
|
4592
4639
|
)
|
|
4593
4640
|
) : null;
|
|
4594
|
-
G && l.setAttribute(e, r), _ === null ? l.removeAttribute(t) :
|
|
4641
|
+
G && l.setAttribute(e, r), _ === null ? l.removeAttribute(t) : F && (l.setAttribute(t, _), t === `${c.prefix}bind` && this.recordSelfWrittenBind(_)), t === "style" && this.captureAndHideDisplay(), he?.(), K && !H && !(v.isUserEditableValue(l) && this.isSupersededByUserEdit(re)) && (this.value = this.normalizeValueForElement(
|
|
4595
4642
|
l,
|
|
4596
4643
|
$
|
|
4597
4644
|
), Z && (l.value = $), this.recordValueWriteResult(l.value === $));
|
|
@@ -4943,7 +4990,7 @@ const w = class w extends T {
|
|
|
4943
4990
|
*/
|
|
4944
4991
|
static reassertHiddenDisplay(e) {
|
|
4945
4992
|
const t = T.get(e);
|
|
4946
|
-
t instanceof
|
|
4993
|
+
t instanceof v && t.hideDisplayWithoutCapture();
|
|
4947
4994
|
}
|
|
4948
4995
|
/**
|
|
4949
4996
|
* エレメントを非表示にします。
|
|
@@ -4955,7 +5002,7 @@ const w = class w extends T {
|
|
|
4955
5002
|
return Promise.resolve();
|
|
4956
5003
|
this.visible = !1;
|
|
4957
5004
|
const e = this.getTarget();
|
|
4958
|
-
return this.captureAndHideDisplay(), e.setAttribute(`${c.prefix}if-false`, ""),
|
|
5005
|
+
return this.captureAndHideDisplay(), e.setAttribute(`${c.prefix}if-false`, ""), v.disableFormControlsInBranch(e), Promise.resolve();
|
|
4959
5006
|
}
|
|
4960
5007
|
/**
|
|
4961
5008
|
* 分岐配下のフォームコントロールを順に処理します。
|
|
@@ -4993,7 +5040,7 @@ const w = class w extends T {
|
|
|
4993
5040
|
* @returns 戻り値はありません。
|
|
4994
5041
|
*/
|
|
4995
5042
|
static disableFormControlsInBranch(e) {
|
|
4996
|
-
|
|
5043
|
+
v.forEachFormControlInBranch(e, (t) => {
|
|
4997
5044
|
t.hasAttribute("disabled") || (t.setAttribute(ge, ""), t.setAttribute("disabled", ""));
|
|
4998
5045
|
});
|
|
4999
5046
|
}
|
|
@@ -5007,7 +5054,7 @@ const w = class w extends T {
|
|
|
5007
5054
|
* @returns 戻り値はありません。
|
|
5008
5055
|
*/
|
|
5009
5056
|
restoreFormControlsDisabledByIf() {
|
|
5010
|
-
|
|
5057
|
+
v.forEachFormControlInBranch(this.getTarget(), (e) => {
|
|
5011
5058
|
e.hasAttribute(ge) && (e.removeAttribute(ge), e.removeAttribute("disabled"));
|
|
5012
5059
|
});
|
|
5013
5060
|
}
|
|
@@ -5040,11 +5087,12 @@ const w = class w extends T {
|
|
|
5040
5087
|
return t === null ? null : t.closestByAttribute(e);
|
|
5041
5088
|
}
|
|
5042
5089
|
};
|
|
5043
|
-
|
|
5090
|
+
v.NUMBER_INPUT_PATTERN = /^-?(?:\d+(?:\.\d+)?|\.\d+)(?:[eE][+-]?\d+)?$/, v.VALUE_TYPE_NAMES = /* @__PURE__ */ new Set([
|
|
5044
5091
|
"boolean",
|
|
5045
5092
|
"number",
|
|
5046
|
-
"string"
|
|
5047
|
-
|
|
5093
|
+
"string",
|
|
5094
|
+
"lines"
|
|
5095
|
+
]), v.loggedValueTypeDeclarations = /* @__PURE__ */ new Set(), v.BOOLEAN_ATTRIBUTES = /* @__PURE__ */ new Set([
|
|
5048
5096
|
"allowfullscreen",
|
|
5049
5097
|
"async",
|
|
5050
5098
|
"autofocus",
|
|
@@ -5068,7 +5116,7 @@ w.NUMBER_INPUT_PATTERN = /^-?(?:\d+(?:\.\d+)?|\.\d+)(?:[eE][+-]?\d+)?$/, w.VALUE
|
|
|
5068
5116
|
"required",
|
|
5069
5117
|
"reversed",
|
|
5070
5118
|
"selected"
|
|
5071
|
-
]),
|
|
5119
|
+
]), v.INPUT_EVENT_TYPES = [
|
|
5072
5120
|
"text",
|
|
5073
5121
|
"password",
|
|
5074
5122
|
"email",
|
|
@@ -5083,8 +5131,8 @@ w.NUMBER_INPUT_PATTERN = /^-?(?:\d+(?:\.\d+)?|\.\d+)(?:[eE][+-]?\d+)?$/, w.VALUE
|
|
|
5083
5131
|
"month",
|
|
5084
5132
|
"time",
|
|
5085
5133
|
"week"
|
|
5086
|
-
],
|
|
5087
|
-
let S =
|
|
5134
|
+
], v.UNAPPLIED_VALUE_WRITES = /* @__PURE__ */ new Set(), v.sequenceCounter = 0, v.bindingWorkActiveCount = 0, v.pendingMutationFlusher = null, v.loggedUnresolvedAttributes = /* @__PURE__ */ new Set(), v.loggedTypeMismatchedComparisons = /* @__PURE__ */ new Set();
|
|
5135
|
+
let S = v;
|
|
5088
5136
|
class ae extends T {
|
|
5089
5137
|
/**
|
|
5090
5138
|
* テキストフラグメントのコンストラクタ。
|
|
@@ -7506,13 +7554,13 @@ const h = class h {
|
|
|
7506
7554
|
const l = h.resolveFieldName(e), u = e.getAttribute(`${c.prefix}form-object`), d = e.getAttribute(`${c.prefix}form-list`), m = e.hasAttribute(`${c.prefix}form-list`);
|
|
7507
7555
|
if (l) {
|
|
7508
7556
|
const y = t[String(l)], E = n && h.hasResolvedDeclarativeState(e), A = n && typeof y > "u" && !h.isDeclarativeStateBound(e);
|
|
7509
|
-
let
|
|
7510
|
-
if (E ?
|
|
7511
|
-
return (
|
|
7557
|
+
let D = y;
|
|
7558
|
+
if (E ? D = void 0 : A && (D = null), h.isFileInput(e))
|
|
7559
|
+
return (D === null || D === "") && o.push(
|
|
7512
7560
|
h.applyFragmentValue(e, null, i, a)
|
|
7513
7561
|
), Promise.all(o).then(() => {
|
|
7514
7562
|
});
|
|
7515
|
-
if (m && Array.isArray(
|
|
7563
|
+
if (m && Array.isArray(D) && // チェックボックスグループと複数選択 select は配列そのものを状態として
|
|
7516
7564
|
// 解釈する(後続の分岐)。位置で配ると選択状態を決められないため、
|
|
7517
7565
|
// `data-form-list` を併記していても従来どおりそちらへ渡す。
|
|
7518
7566
|
!h.isGroupedCheckable(e) && !h.isMultipleSelect(e)) {
|
|
@@ -7520,20 +7568,20 @@ const h = class h {
|
|
|
7520
7568
|
s.set(M, q + 1), o.push(
|
|
7521
7569
|
h.applyFragmentValue(
|
|
7522
7570
|
e,
|
|
7523
|
-
|
|
7571
|
+
D[q] ?? null,
|
|
7524
7572
|
i,
|
|
7525
7573
|
a
|
|
7526
7574
|
)
|
|
7527
7575
|
);
|
|
7528
|
-
} else typeof
|
|
7576
|
+
} else typeof D > "u" || (Array.isArray(D) && h.isGroupedCheckable(e) || Array.isArray(D) && h.isMultipleSelect(e) || typeof D == "string" || typeof D == "number" || typeof D == "boolean" || D === null || Array.isArray(D) && e.collectsLines() ? o.push(
|
|
7529
7577
|
h.applyFragmentValue(
|
|
7530
7578
|
e,
|
|
7531
|
-
|
|
7579
|
+
D,
|
|
7532
7580
|
i,
|
|
7533
7581
|
a
|
|
7534
7582
|
)
|
|
7535
7583
|
) : o.push(
|
|
7536
|
-
h.applyFragmentValue(e, String(
|
|
7584
|
+
h.applyFragmentValue(e, String(D), i, a)
|
|
7537
7585
|
));
|
|
7538
7586
|
} else if (u) {
|
|
7539
7587
|
const y = t[String(u)];
|
|
@@ -7555,13 +7603,13 @@ const h = class h {
|
|
|
7555
7603
|
} else if (d) {
|
|
7556
7604
|
const y = t[String(d)];
|
|
7557
7605
|
if (Array.isArray(y)) {
|
|
7558
|
-
const E = e.getChildElementFragments(), A = e.getAttribute(`${c.prefix}each-key`),
|
|
7606
|
+
const E = e.getChildElementFragments(), A = e.getAttribute(`${c.prefix}each-key`), D = h.isCollectedListFromEachSource(e) ? h.pairRowsWithItems(
|
|
7559
7607
|
E,
|
|
7560
7608
|
y,
|
|
7561
7609
|
A == null ? null : String(A)
|
|
7562
7610
|
) : null;
|
|
7563
7611
|
for (let M = 0; M < E.length; M++) {
|
|
7564
|
-
const q = E[M], I =
|
|
7612
|
+
const q = E[M], I = D ? D[M] : y.length > M ? y[M] : null;
|
|
7565
7613
|
o.push(
|
|
7566
7614
|
// 行ごとに values が切り替わるので出現位置も行単位で数える。
|
|
7567
7615
|
h.setPartValues(
|
|
@@ -7867,12 +7915,31 @@ const h = class h {
|
|
|
7867
7915
|
* @return Promise(メッセージの追加が完了したら解決される)
|
|
7868
7916
|
*/
|
|
7869
7917
|
static addMessage(e, t, r, i) {
|
|
7870
|
-
const n = [], s = Ze(), a = s.addMessage, o = (u) => typeof a == "function" ? a.call(s, u, r, i) : s.addErrorMessage(u, r), l = h.
|
|
7918
|
+
const n = [], s = Ze(), a = s.addMessage, o = (u) => typeof a == "function" ? a.call(s, u, r, i) : s.addErrorMessage(u, r), l = h.keepFirstRadio(
|
|
7919
|
+
h.findFragmentsByKey(e, t)
|
|
7920
|
+
);
|
|
7871
7921
|
return l.forEach((u) => {
|
|
7872
7922
|
n.push(o(u.getTarget()));
|
|
7873
7923
|
}), l.length === 0 && n.push(o(e.getTarget())), Promise.all(n).then(() => {
|
|
7874
7924
|
});
|
|
7875
7925
|
}
|
|
7926
|
+
/**
|
|
7927
|
+
* キーに一致したフラグメントから、2 つめ以降のラジオボタンを除きます。
|
|
7928
|
+
*
|
|
7929
|
+
* 同じキーで収集するラジオボタンは 1 つの値を表すため、メッセージは最初の
|
|
7930
|
+
* 1 つにだけ渡します(仕様「エラーハンドリング」)。ラジオの数だけ渡すと、
|
|
7931
|
+
* 同じ文がラジオの数だけ並びます。
|
|
7932
|
+
*
|
|
7933
|
+
* @param fragments キーに一致したフラグメント
|
|
7934
|
+
* @returns メッセージを渡すフラグメント
|
|
7935
|
+
*/
|
|
7936
|
+
static keepFirstRadio(e) {
|
|
7937
|
+
let t = !1;
|
|
7938
|
+
return e.filter((r) => {
|
|
7939
|
+
const i = r.getTarget();
|
|
7940
|
+
return !(i instanceof HTMLInputElement) || i.type !== "radio" ? !0 : t ? !1 : (t = !0, !0);
|
|
7941
|
+
});
|
|
7942
|
+
}
|
|
7876
7943
|
/**
|
|
7877
7944
|
* 指定されたキーに一致するフラグメントを検索します。
|
|
7878
7945
|
*
|
|
@@ -7945,7 +8012,7 @@ h.INITIAL_RESTORED_FORMS = /* @__PURE__ */ new WeakSet(), h.LAST_ANCESTOR_ARG_VA
|
|
|
7945
8012
|
"constructor",
|
|
7946
8013
|
"prototype"
|
|
7947
8014
|
]), h.COLLECTED_ROW_IDENTITY = /* @__PURE__ */ new WeakMap(), h.COMPLETE_SET_VALUES = /* @__PURE__ */ new WeakSet(), h.COLLECTED_EXCLUDED_KEYS = /* @__PURE__ */ new WeakMap(), h.warnedPositionalRowFallbacks = /* @__PURE__ */ new Set(), h.warnedDerivedRowsWithoutKey = /* @__PURE__ */ new Set(), h.LEADING_PATH_PATTERN = /^\s*([A-Za-z_$][\w$]*(?:\s*\.\s*[A-Za-z_$][\w$]*)*)\s*([\s\S]*)$/;
|
|
7948
|
-
let
|
|
8015
|
+
let k = h;
|
|
7949
8016
|
class O {
|
|
7950
8017
|
/**
|
|
7951
8018
|
* カスタムイベントを発火します。
|
|
@@ -8899,7 +8966,7 @@ function At(b, e, t) {
|
|
|
8899
8966
|
r === void 0 ? b[e] = t : Array.isArray(r) ? r.push(t) : b[e] = [r, t];
|
|
8900
8967
|
}
|
|
8901
8968
|
function me(b, e) {
|
|
8902
|
-
if (
|
|
8969
|
+
if (k.isCompleteSetValue(e))
|
|
8903
8970
|
return e;
|
|
8904
8971
|
if (Array.isArray(e)) {
|
|
8905
8972
|
const t = Array.isArray(b) ? b.slice() : [];
|
|
@@ -8974,7 +9041,7 @@ function Gt(b) {
|
|
|
8974
9041
|
) : ke(e));
|
|
8975
9042
|
}
|
|
8976
9043
|
function Me(b) {
|
|
8977
|
-
return Ve(
|
|
9044
|
+
return Ve(k.getValues(b));
|
|
8978
9045
|
}
|
|
8979
9046
|
function Ve(b) {
|
|
8980
9047
|
const e = (r) => {
|
|
@@ -8984,7 +9051,7 @@ function Ve(b) {
|
|
|
8984
9051
|
return "";
|
|
8985
9052
|
if (Array.isArray(r)) {
|
|
8986
9053
|
const i = r.map(e);
|
|
8987
|
-
return
|
|
9054
|
+
return k.carryCollectedRowIdentity(r, i), i;
|
|
8988
9055
|
}
|
|
8989
9056
|
if (r !== null && typeof r == "object") {
|
|
8990
9057
|
const i = {};
|
|
@@ -8992,13 +9059,13 @@ function Ve(b) {
|
|
|
8992
9059
|
r
|
|
8993
9060
|
))
|
|
8994
9061
|
i[n] = e(s);
|
|
8995
|
-
return
|
|
9062
|
+
return k.carryCollectedRowIdentity(r, i), i;
|
|
8996
9063
|
}
|
|
8997
9064
|
return r;
|
|
8998
9065
|
}, t = {};
|
|
8999
9066
|
for (const [r, i] of Object.entries(b))
|
|
9000
9067
|
t[r] = e(i);
|
|
9001
|
-
return
|
|
9068
|
+
return k.carryCollectedRowIdentity(b, t), t;
|
|
9002
9069
|
}
|
|
9003
9070
|
function Yt(b, e) {
|
|
9004
9071
|
const t = new Headers(
|
|
@@ -9528,8 +9595,8 @@ const p = class p {
|
|
|
9528
9595
|
targetFragment: e
|
|
9529
9596
|
}, i = t ? p.attrName(t, "if") : p.attrName(null, "if", !0);
|
|
9530
9597
|
if (e.hasAttribute(i)) {
|
|
9531
|
-
const
|
|
9532
|
-
typeof
|
|
9598
|
+
const F = e.getRawAttribute(i);
|
|
9599
|
+
typeof F == "string" && F.trim() !== "" ? (r.conditionExpression = k.unwrapConditionExpression(F), r.conditionAttributeName = i) : g.warn(
|
|
9533
9600
|
"Haori",
|
|
9534
9601
|
`${i} に条件式が指定されていません。`
|
|
9535
9602
|
);
|
|
@@ -9549,15 +9616,15 @@ const p = class p {
|
|
|
9549
9616
|
$,
|
|
9550
9617
|
p.attrName(t, "form")
|
|
9551
9618
|
);
|
|
9552
|
-
Z !== null ? r.formFragment =
|
|
9619
|
+
Z !== null ? r.formFragment = k.getFormFragment(
|
|
9553
9620
|
T.get(Z)
|
|
9554
9621
|
) : g.error(
|
|
9555
9622
|
"Haori",
|
|
9556
9623
|
`Form element not found: ${$} (${p.attrName(t, "form")})`
|
|
9557
9624
|
);
|
|
9558
9625
|
} else
|
|
9559
|
-
r.formFragment =
|
|
9560
|
-
} else (t === "change" || t === "input") && (r.formFragment =
|
|
9626
|
+
r.formFragment = k.getFormFragment(e);
|
|
9627
|
+
} else (t === "change" || t === "input") && (r.formFragment = k.getFormFragment(e), r.formFragment === null && p.isNamedInputFragment(e) && (r.selfValueFragment = e));
|
|
9561
9628
|
if (e.hasAttribute(`${c.prefix}${t}-before-run`)) {
|
|
9562
9629
|
const $ = e.getRawAttribute(
|
|
9563
9630
|
`${c.prefix}${t}-before-run`
|
|
@@ -9575,9 +9642,9 @@ ${$}
|
|
|
9575
9642
|
g.error("Haori", `Invalid before script: ${Z}`);
|
|
9576
9643
|
}
|
|
9577
9644
|
}
|
|
9578
|
-
const
|
|
9579
|
-
if (e.hasAttribute(
|
|
9580
|
-
const $ = String(e.getAttribute(
|
|
9645
|
+
const F = p.attrName(t, "run");
|
|
9646
|
+
if (e.hasAttribute(F)) {
|
|
9647
|
+
const $ = String(e.getAttribute(F) ?? "");
|
|
9581
9648
|
let Z = null;
|
|
9582
9649
|
try {
|
|
9583
9650
|
Z = new Function(
|
|
@@ -9600,13 +9667,13 @@ ${$}
|
|
|
9600
9667
|
}
|
|
9601
9668
|
const n = p.attrName(t, "fetch"), s = e.hasAttribute(n);
|
|
9602
9669
|
if (s) {
|
|
9603
|
-
const
|
|
9604
|
-
|
|
9670
|
+
const F = e.getAttributeEvaluation(n);
|
|
9671
|
+
F && (r.fetchHasUnresolvedReference = F.hasUnresolvedReference, r.fetchUrl = F.hasUnresolvedReference ? null : F.value);
|
|
9605
9672
|
}
|
|
9606
9673
|
const a = {}, o = t ? p.attrName(t, "fetch-method") : p.attrName(null, "method", !0);
|
|
9607
9674
|
if (e.hasAttribute(o)) {
|
|
9608
|
-
const
|
|
9609
|
-
|
|
9675
|
+
const F = e.getAttributeEvaluation(o);
|
|
9676
|
+
F?.hasUnresolvedReference ? r.fetchHasUnresolvedReference = !0 : a.method = p.normalizeAttributeText(F?.value) ?? void 0;
|
|
9610
9677
|
}
|
|
9611
9678
|
const l = t ? p.attrName(t, "fetch-headers") : p.attrName(null, "headers", !0), u = p.readFetchHeaders(
|
|
9612
9679
|
e,
|
|
@@ -9616,9 +9683,9 @@ ${$}
|
|
|
9616
9683
|
const d = t ? p.attrName(t, "fetch-content-type") : p.attrName(null, "content-type", !0);
|
|
9617
9684
|
let m = null;
|
|
9618
9685
|
if (e.hasAttribute(d)) {
|
|
9619
|
-
const
|
|
9620
|
-
|
|
9621
|
-
|
|
9686
|
+
const F = e.getAttributeEvaluation(d);
|
|
9687
|
+
F?.hasUnresolvedReference && (r.fetchHasUnresolvedReference = !0), m = p.normalizeAttributeText(
|
|
9688
|
+
F?.value
|
|
9622
9689
|
);
|
|
9623
9690
|
}
|
|
9624
9691
|
if (m !== null)
|
|
@@ -9627,10 +9694,10 @@ ${$}
|
|
|
9627
9694
|
m
|
|
9628
9695
|
);
|
|
9629
9696
|
else if (a.method && !p.hasDeclaredContentType(a.headers)) {
|
|
9630
|
-
const
|
|
9697
|
+
const F = a.method.toUpperCase();
|
|
9631
9698
|
a.headers = p.withContentType(
|
|
9632
9699
|
a.headers,
|
|
9633
|
-
|
|
9700
|
+
F === "GET" || F === "HEAD" || F === "OPTIONS" ? "application/x-www-form-urlencoded" : "application/json"
|
|
9634
9701
|
);
|
|
9635
9702
|
}
|
|
9636
9703
|
Object.keys(a).length > 0 && (r.fetchOptions = a);
|
|
@@ -9642,8 +9709,8 @@ ${$}
|
|
|
9642
9709
|
);
|
|
9643
9710
|
else if (e.hasAttribute(y)) {
|
|
9644
9711
|
r.download = !0;
|
|
9645
|
-
const
|
|
9646
|
-
r.downloadFileName =
|
|
9712
|
+
const F = e.getAttributeEvaluation(y);
|
|
9713
|
+
r.downloadFileName = F?.hasUnresolvedReference ? null : p.normalizeAttributeText(F?.value);
|
|
9647
9714
|
}
|
|
9648
9715
|
const E = t ? p.attrName(t, "fetch-download-folder") : p.attrName(null, "download-folder", !0);
|
|
9649
9716
|
e.hasAttribute(E) && (r.download ? r.downloadFolder = !0 : g.warn(
|
|
@@ -9652,31 +9719,31 @@ ${$}
|
|
|
9652
9719
|
));
|
|
9653
9720
|
const A = t ? p.attrName(t, "bind") : p.attrName(null, "bind", !0);
|
|
9654
9721
|
if (e.hasAttribute(A)) {
|
|
9655
|
-
const
|
|
9656
|
-
if (
|
|
9657
|
-
const $ = j.queryAll(
|
|
9722
|
+
const F = j.read(e, A);
|
|
9723
|
+
if (F) {
|
|
9724
|
+
const $ = j.queryAll(F, A);
|
|
9658
9725
|
$.length > 0 ? (r.bindFragments = [], $.forEach((Z) => {
|
|
9659
9726
|
const Q = T.get(Z);
|
|
9660
9727
|
Q && r.bindFragments.push(Q);
|
|
9661
9728
|
})) : g.error(
|
|
9662
9729
|
"Haori",
|
|
9663
|
-
`Bind element not found: ${
|
|
9730
|
+
`Bind element not found: ${F} (${A})`
|
|
9664
9731
|
);
|
|
9665
9732
|
}
|
|
9666
9733
|
}
|
|
9667
|
-
const
|
|
9668
|
-
t ? e.hasAttribute(
|
|
9734
|
+
const D = p.attrName(t, "bind-arg"), M = p.attrName(null, "arg", !0), q = p.attrName(null, "bind-arg", !0);
|
|
9735
|
+
t ? e.hasAttribute(D) && (r.bindArg = e.getRawAttribute(D)) : e.hasAttribute(M) ? r.bindArg = e.getRawAttribute(
|
|
9669
9736
|
M
|
|
9670
9737
|
) : e.hasAttribute(q) && (r.bindArg = e.getRawAttribute(q));
|
|
9671
9738
|
const I = t ? p.attrName(t, "bind-params") : p.attrName(null, "bind-params", !0);
|
|
9672
9739
|
if (e.hasAttribute(I)) {
|
|
9673
|
-
const
|
|
9674
|
-
r.bindParams =
|
|
9740
|
+
const F = e.getRawAttribute(I);
|
|
9741
|
+
r.bindParams = F.split("&").map(($) => $.trim());
|
|
9675
9742
|
}
|
|
9676
9743
|
const K = t ? p.attrName(t, "bind-append") : p.attrName(null, "bind-append", !0);
|
|
9677
9744
|
if (e.hasAttribute(K)) {
|
|
9678
|
-
const
|
|
9679
|
-
r.bindAppendParams =
|
|
9745
|
+
const F = e.getRawAttribute(K);
|
|
9746
|
+
r.bindAppendParams = F.split("&").map(($) => $.trim()).filter(Boolean);
|
|
9680
9747
|
}
|
|
9681
9748
|
const J = t ? p.attrName(t, "bind-merge") : p.attrName(null, "bind-merge", !0);
|
|
9682
9749
|
e.hasAttribute(J) && (r.bindMerge = !0);
|
|
@@ -9684,8 +9751,8 @@ ${$}
|
|
|
9684
9751
|
e.hasAttribute(re) && (r.bindTransform = e.getRawAttribute(re));
|
|
9685
9752
|
const H = t ? p.attrName(t, "copy-params") : null;
|
|
9686
9753
|
if (H && e.hasAttribute(H)) {
|
|
9687
|
-
const
|
|
9688
|
-
r.copyParams =
|
|
9754
|
+
const F = e.getRawAttribute(H);
|
|
9755
|
+
r.copyParams = F.split("&").map(($) => $.trim()).filter(Boolean);
|
|
9689
9756
|
}
|
|
9690
9757
|
if (t) {
|
|
9691
9758
|
if (e.hasAttribute(p.attrName(t, "adjust"))) {
|
|
@@ -9769,12 +9836,12 @@ ${W}
|
|
|
9769
9836
|
p.attrName(t, "error-bind")
|
|
9770
9837
|
);
|
|
9771
9838
|
}
|
|
9772
|
-
const
|
|
9839
|
+
const F = p.attrName(t, "redirect"), $ = p.attrName(t, "redirect-replace"), Z = e.hasAttribute(F), Q = e.hasAttribute($);
|
|
9773
9840
|
if (Z && (r.redirectUrl = p.readLateAttribute(
|
|
9774
9841
|
e,
|
|
9775
9842
|
r,
|
|
9776
9843
|
"redirect",
|
|
9777
|
-
|
|
9844
|
+
F
|
|
9778
9845
|
)), Q && (r.redirectReplaceUrl = p.readLateAttribute(
|
|
9779
9846
|
e,
|
|
9780
9847
|
r,
|
|
@@ -9792,7 +9859,7 @@ ${W}
|
|
|
9792
9859
|
W
|
|
9793
9860
|
));
|
|
9794
9861
|
}
|
|
9795
|
-
if (e.hasAttribute(p.attrName(t, "scroll-error")) && (r.scrollOnError = !0), e.hasAttribute(p.attrName(t, "scroll")) && (r.scrollTarget = p.readLateAttribute(
|
|
9862
|
+
if (e.hasAttribute(p.attrName(t, "scroll-error")) && (r.scrollOnError = !0), e.hasAttribute(p.attrName(t, "clear-messages")) && (r.clearMessagesOnSuccess = !0), e.hasAttribute(p.attrName(t, "scroll")) && (r.scrollTarget = p.readLateAttribute(
|
|
9796
9863
|
e,
|
|
9797
9864
|
r,
|
|
9798
9865
|
"scroll",
|
|
@@ -9812,14 +9879,14 @@ ${W}
|
|
|
9812
9879
|
W,
|
|
9813
9880
|
p.attrName(t, "history-form")
|
|
9814
9881
|
);
|
|
9815
|
-
Y !== null ? r.historyFormFragment =
|
|
9882
|
+
Y !== null ? r.historyFormFragment = k.getFormFragment(
|
|
9816
9883
|
T.get(Y)
|
|
9817
9884
|
) : g.error(
|
|
9818
9885
|
"Haori",
|
|
9819
9886
|
`Form element not found: ${W} (${p.attrName(t, "history-form")})`
|
|
9820
9887
|
);
|
|
9821
9888
|
} else
|
|
9822
|
-
r.historyFormFragment =
|
|
9889
|
+
r.historyFormFragment = k.getFormFragment(e);
|
|
9823
9890
|
}
|
|
9824
9891
|
[
|
|
9825
9892
|
"reset-before",
|
|
@@ -9900,39 +9967,39 @@ ${W}
|
|
|
9900
9967
|
}
|
|
9901
9968
|
}
|
|
9902
9969
|
if (!t && (e.hasAttribute(p.attrName(null, "data", !0)) && (r.dataAttrName = p.attrName(null, "data", !0)), e.hasAttribute(p.attrName(null, "form", !0)))) {
|
|
9903
|
-
const
|
|
9970
|
+
const F = j.read(
|
|
9904
9971
|
e,
|
|
9905
9972
|
p.attrName(null, "form", !0)
|
|
9906
9973
|
);
|
|
9907
|
-
if (
|
|
9974
|
+
if (F) {
|
|
9908
9975
|
const $ = j.query(
|
|
9909
|
-
|
|
9976
|
+
F,
|
|
9910
9977
|
p.attrName(null, "form", !0)
|
|
9911
9978
|
);
|
|
9912
|
-
$ !== null ? r.formFragment =
|
|
9979
|
+
$ !== null ? r.formFragment = k.getFormFragment(
|
|
9913
9980
|
T.get($)
|
|
9914
9981
|
) : g.error(
|
|
9915
9982
|
"Haori",
|
|
9916
|
-
`Form element not found: ${
|
|
9983
|
+
`Form element not found: ${F} (${p.attrName(null, "fetch-form", !0)})`
|
|
9917
9984
|
);
|
|
9918
9985
|
} else
|
|
9919
|
-
r.formFragment =
|
|
9986
|
+
r.formFragment = k.getFormFragment(e);
|
|
9920
9987
|
}
|
|
9921
9988
|
(!t || t === "poll") && p.readNoMessageDeclarations(e, r, t ?? "fetch");
|
|
9922
9989
|
const _ = t ? p.attrName(t, "fetch-state") : p.attrName(null, "state", !0);
|
|
9923
9990
|
if (e.hasAttribute(_)) {
|
|
9924
|
-
const
|
|
9925
|
-
|
|
9991
|
+
const F = j.read(e, _), $ = [];
|
|
9992
|
+
F ? (j.queryAll(F, _).forEach((Q) => {
|
|
9926
9993
|
const se = T.get(Q);
|
|
9927
9994
|
se && $.push(se);
|
|
9928
9995
|
}), $.length === 0 && g.error(
|
|
9929
9996
|
"Haori",
|
|
9930
|
-
`Element not found: ${
|
|
9997
|
+
`Element not found: ${F} (${_})`
|
|
9931
9998
|
)) : $.push(e), $.length > 0 && (r.fetchStateFragments = $);
|
|
9932
9999
|
}
|
|
9933
10000
|
const G = t ? p.attrName(t, "store-clear") : p.attrName(null, "store-clear", !0);
|
|
9934
10001
|
if (e.hasAttribute(G)) {
|
|
9935
|
-
const
|
|
10002
|
+
const F = e.getRawAttribute(G), $ = F === null ? "" : F.trim();
|
|
9936
10003
|
if ($ === "")
|
|
9937
10004
|
g.error(
|
|
9938
10005
|
"Haori",
|
|
@@ -10059,8 +10126,8 @@ ${W}
|
|
|
10059
10126
|
return this.skipped = !0, !1;
|
|
10060
10127
|
if (this.options.formFragment && this.validate(this.options.formFragment) === !1)
|
|
10061
10128
|
return await this.commitEditOnStop(), !1;
|
|
10062
|
-
if (!this.options.formFragment && this.options.targetFragment &&
|
|
10063
|
-
|
|
10129
|
+
if (!this.options.formFragment && this.options.targetFragment && k.warnUnvalidatedCustomValidity(
|
|
10130
|
+
k.getFormFragment(this.options.targetFragment),
|
|
10064
10131
|
`${c.prefix}${this.eventType ?? "fetch"}-form が解決できません`
|
|
10065
10132
|
), !this.evaluateExecutionCondition())
|
|
10066
10133
|
return this.skipped = !0, await this.commitEditOnStop(), !1;
|
|
@@ -10082,7 +10149,7 @@ ${W}
|
|
|
10082
10149
|
return !1;
|
|
10083
10150
|
this.options.resetBeforeFragments && this.options.resetBeforeFragments.length > 0 && (await Promise.all(
|
|
10084
10151
|
this.options.resetBeforeFragments.map(
|
|
10085
|
-
(m) =>
|
|
10152
|
+
(m) => k.reset(m, this.operationSequence)
|
|
10086
10153
|
)
|
|
10087
10154
|
), this.captureHistorySnapshots());
|
|
10088
10155
|
const r = this.prepareFetchRequest();
|
|
@@ -10112,7 +10179,7 @@ ${W}
|
|
|
10112
10179
|
s
|
|
10113
10180
|
);
|
|
10114
10181
|
n = A.url;
|
|
10115
|
-
const
|
|
10182
|
+
const D = { ...A.options }, M = A.normalized ? A.requestedMethod : r.requestedMethod, q = A.effectiveMethod, I = r.transportMode === "query-get" || A.normalized, K = A.queryString ?? r.queryString;
|
|
10116
10183
|
if (I && g.info("Haori demo fetch normalization", {
|
|
10117
10184
|
runtime: c.runtime,
|
|
10118
10185
|
requestedMethod: M,
|
|
@@ -10132,10 +10199,10 @@ ${W}
|
|
|
10132
10199
|
return O.fetchStart(
|
|
10133
10200
|
this.options.targetFragment.getTarget(),
|
|
10134
10201
|
n,
|
|
10135
|
-
|
|
10202
|
+
D,
|
|
10136
10203
|
l ? i : void 0,
|
|
10137
10204
|
re
|
|
10138
|
-
), await this.injectFetchState("loading"), await p.invokeFetch(n,
|
|
10205
|
+
), await this.injectFetchState("loading"), await p.invokeFetch(n, D).then((H) => this.handleFetchResult(
|
|
10139
10206
|
H,
|
|
10140
10207
|
n || void 0,
|
|
10141
10208
|
J
|
|
@@ -10151,7 +10218,7 @@ ${W}
|
|
|
10151
10218
|
), await this.runErrorActions(null), H;
|
|
10152
10219
|
});
|
|
10153
10220
|
}
|
|
10154
|
-
return await fetch(n,
|
|
10221
|
+
return await fetch(n, D).then((J) => this.handleFetchResult(J, n || void 0));
|
|
10155
10222
|
}
|
|
10156
10223
|
(!this.options.bindFragments || this.options.bindFragments.length === 0) && this.options.formFragment && l && await this.commitFormValues(
|
|
10157
10224
|
this.options.formFragment,
|
|
@@ -10215,22 +10282,22 @@ ${W}
|
|
|
10215
10282
|
let l;
|
|
10216
10283
|
if (o) {
|
|
10217
10284
|
l = { ...s ?? {} };
|
|
10218
|
-
const u = String(o), d =
|
|
10219
|
-
l[u] =
|
|
10285
|
+
const u = String(o), d = k.resolveAncestorArgOwner(e, u);
|
|
10286
|
+
l[u] = k.mergeCollectedValues(
|
|
10220
10287
|
(d ? d.value : l[u]) ?? null,
|
|
10221
10288
|
a
|
|
10222
10289
|
);
|
|
10223
10290
|
} else
|
|
10224
|
-
l =
|
|
10291
|
+
l = k.mergeCollectedValues(
|
|
10225
10292
|
s,
|
|
10226
10293
|
a,
|
|
10227
|
-
|
|
10294
|
+
k.ancestorBaseResolver(e)
|
|
10228
10295
|
);
|
|
10229
10296
|
await C.setBindingData(i, l, {
|
|
10230
10297
|
skipFragments: n,
|
|
10231
10298
|
kind: "nonSupply",
|
|
10232
10299
|
sequence: this.operationSequence,
|
|
10233
|
-
editedPaths:
|
|
10300
|
+
editedPaths: k.collectEditedPaths(
|
|
10234
10301
|
e,
|
|
10235
10302
|
this.operationSequence,
|
|
10236
10303
|
o ? String(o) : "",
|
|
@@ -10555,8 +10622,8 @@ ${W}
|
|
|
10555
10622
|
* @returns 表示の完了 Promise
|
|
10556
10623
|
*/
|
|
10557
10624
|
async showDownloadFailure(e) {
|
|
10558
|
-
const t = this.
|
|
10559
|
-
await
|
|
10625
|
+
const t = this.resolveMessageScope(), r = pe();
|
|
10626
|
+
await r.clearMessages(t), e && await r.addErrorMessage(t, Qe);
|
|
10560
10627
|
}
|
|
10561
10628
|
/**
|
|
10562
10629
|
* 保存するファイル名を決めます。
|
|
@@ -10650,7 +10717,7 @@ ${W}
|
|
|
10650
10717
|
e.status,
|
|
10651
10718
|
r
|
|
10652
10719
|
);
|
|
10653
|
-
const E = this.selectErrorActions(e.status), A = E?.bind === !0,
|
|
10720
|
+
const E = this.selectErrorActions(e.status), A = E?.bind === !0, D = await this.handleFetchError(
|
|
10654
10721
|
A ? e.clone() : e,
|
|
10655
10722
|
E?.noMessage !== !0 && !A
|
|
10656
10723
|
);
|
|
@@ -10660,7 +10727,7 @@ ${W}
|
|
|
10660
10727
|
"error",
|
|
10661
10728
|
e.status,
|
|
10662
10729
|
e.statusText || null,
|
|
10663
|
-
|
|
10730
|
+
D
|
|
10664
10731
|
), await this.runErrorActions(e.status), !1;
|
|
10665
10732
|
}
|
|
10666
10733
|
if (this.options.targetFragment && t && r && O.fetchEnd(
|
|
@@ -10689,10 +10756,11 @@ ${W}
|
|
|
10689
10756
|
), await this.runErrorActions(null), !1;
|
|
10690
10757
|
}
|
|
10691
10758
|
}
|
|
10759
|
+
this.options.clearMessagesOnSuccess && await i.clearMessages(this.resolveMessageScope());
|
|
10692
10760
|
const n = [];
|
|
10693
10761
|
n.push(this.bindResult(e)), n.push(this.adjust()), n.push(this.addRow()), n.push(this.removeRow()), n.push(this.movePrevRow()), n.push(this.moveNextRow()), await Promise.all(n), await this.injectFetchState("success", e.status, null), this.options.resetFragments && this.options.resetFragments.length > 0 && await Promise.all(
|
|
10694
10762
|
this.options.resetFragments.map(
|
|
10695
|
-
(E) =>
|
|
10763
|
+
(E) => k.reset(E, this.operationSequence)
|
|
10696
10764
|
)
|
|
10697
10765
|
), await this.copy();
|
|
10698
10766
|
const s = [];
|
|
@@ -10937,6 +11005,18 @@ ${W}
|
|
|
10937
11005
|
g.error("Haori", `history.pushState failed: ${a}`);
|
|
10938
11006
|
}
|
|
10939
11007
|
}
|
|
11008
|
+
/**
|
|
11009
|
+
* 失敗の表示先(メッセージのスコープ)を解決します。
|
|
11010
|
+
*
|
|
11011
|
+
* フォーム、無ければ対象要素(その祖先のフォームがあればフォーム)、それも
|
|
11012
|
+
* 無ければ `document.body` です(仕様「エラーハンドリング」)。
|
|
11013
|
+
*
|
|
11014
|
+
* @returns 失敗の表示先の要素
|
|
11015
|
+
*/
|
|
11016
|
+
resolveMessageScope() {
|
|
11017
|
+
const e = this.options.formFragment ?? (this.options.targetFragment ? k.getFormFragment(this.options.targetFragment) || this.options.targetFragment : null);
|
|
11018
|
+
return e ? e.getTarget() : document.body;
|
|
11019
|
+
}
|
|
10940
11020
|
/**
|
|
10941
11021
|
* フェッチエラー応答のメッセージを適切な要素へ伝播します。
|
|
10942
11022
|
*
|
|
@@ -10949,7 +11029,7 @@ ${W}
|
|
|
10949
11029
|
*/
|
|
10950
11030
|
async handleFetchError(e, t) {
|
|
10951
11031
|
let r = null;
|
|
10952
|
-
this.options.formFragment ? r = this.options.formFragment : this.options.targetFragment && (r =
|
|
11032
|
+
this.options.formFragment ? r = this.options.formFragment : this.options.targetFragment && (r = k.getFormFragment(this.options.targetFragment) || this.options.targetFragment);
|
|
10953
11033
|
const i = r ? r.getTarget() : document.body;
|
|
10954
11034
|
await pe().clearMessages(i);
|
|
10955
11035
|
const n = async (u) => {
|
|
@@ -10958,13 +11038,15 @@ ${W}
|
|
|
10958
11038
|
}, s = () => {
|
|
10959
11039
|
if (!this.options.scrollOnError)
|
|
10960
11040
|
return;
|
|
10961
|
-
const u = r ? r.getTarget() : document.body;
|
|
10962
|
-
(u.getAttribute("data-message-level") === "error" ? u : u.parentElement?.getAttribute("data-message-level") === "error" ? u.parentElement : u.querySelector(
|
|
11041
|
+
const u = r ? r.getTarget() : document.body, d = u.nextElementSibling;
|
|
11042
|
+
(u.getAttribute("data-message-level") === "error" ? u : u.parentElement?.getAttribute("data-message-level") === "error" ? u.parentElement : u.querySelector(
|
|
11043
|
+
'[data-message-level="error"]'
|
|
11044
|
+
) ?? (d?.getAttribute("data-message-level") === "error" ? d : null))?.scrollIntoView({ behavior: "smooth", block: "nearest" });
|
|
10963
11045
|
}, a = async (u) => {
|
|
10964
11046
|
if (t) {
|
|
10965
11047
|
u.length === 0 && await n(`${e.status} ${e.statusText}`);
|
|
10966
11048
|
for (const d of u)
|
|
10967
|
-
d.key && r ? await
|
|
11049
|
+
d.key && r ? await k.addErrorMessage(r, d.key, d.message) : await n(d.message);
|
|
10968
11050
|
s();
|
|
10969
11051
|
}
|
|
10970
11052
|
return u.length === 0 ? null : u.map((d) => d.message).join(`
|
|
@@ -10977,7 +11059,7 @@ ${W}
|
|
|
10977
11059
|
const m = /* @__PURE__ */ new Map(), y = [];
|
|
10978
11060
|
for (const E of u)
|
|
10979
11061
|
if (E && typeof E == "object" && !Array.isArray(E)) {
|
|
10980
|
-
const A = E.key,
|
|
11062
|
+
const A = E.key, D = E.message, M = typeof A == "string" && A.length > 0 ? A : null, q = typeof D == "string" ? D : D != null ? String(D) : "";
|
|
10981
11063
|
if (q.length === 0)
|
|
10982
11064
|
continue;
|
|
10983
11065
|
if (M !== null) {
|
|
@@ -11023,11 +11105,11 @@ ${W}
|
|
|
11023
11105
|
*/
|
|
11024
11106
|
validate(e) {
|
|
11025
11107
|
if (this.options.valid !== !0)
|
|
11026
|
-
return
|
|
11108
|
+
return k.warnUnvalidatedCustomValidity(
|
|
11027
11109
|
e,
|
|
11028
11110
|
`${c.prefix}${this.eventType ?? "fetch"}-validate の指定がありません`
|
|
11029
11111
|
), !0;
|
|
11030
|
-
|
|
11112
|
+
k.applyCustomValidity(e);
|
|
11031
11113
|
const t = this.findFirstInvalid(e);
|
|
11032
11114
|
if (t === null)
|
|
11033
11115
|
return !0;
|
|
@@ -11118,7 +11200,7 @@ ${W}
|
|
|
11118
11200
|
const r = this.options.targetFragment;
|
|
11119
11201
|
if (!r)
|
|
11120
11202
|
return !0;
|
|
11121
|
-
const i = this.options.conditionAttributeName ?? `${c.prefix}if`, n =
|
|
11203
|
+
const i = this.options.conditionAttributeName ?? `${c.prefix}if`, n = k.buildConditionScope(
|
|
11122
11204
|
r,
|
|
11123
11205
|
this.options.formFragment ?? null
|
|
11124
11206
|
), s = ne.evaluateDetailed(t, n);
|
|
@@ -11218,7 +11300,7 @@ ${W}
|
|
|
11218
11300
|
apply: (y) => {
|
|
11219
11301
|
const E = this.resolveCurrentRowItem(o, y), A = { ...E };
|
|
11220
11302
|
if (i && typeof i == "object" && !Array.isArray(i)) {
|
|
11221
|
-
const
|
|
11303
|
+
const D = E[m], M = D !== null && typeof D == "object" && !Array.isArray(D) ? D : {};
|
|
11222
11304
|
A[m] = this.mergeAppendBindingData(
|
|
11223
11305
|
o,
|
|
11224
11306
|
i,
|
|
@@ -11369,7 +11451,7 @@ ${W}
|
|
|
11369
11451
|
r,
|
|
11370
11452
|
n ? 0 : i
|
|
11371
11453
|
);
|
|
11372
|
-
const s =
|
|
11454
|
+
const s = k.getValuesEditedAfter(
|
|
11373
11455
|
e,
|
|
11374
11456
|
n ? 0 : i
|
|
11375
11457
|
);
|
|
@@ -11403,7 +11485,7 @@ ${W}
|
|
|
11403
11485
|
return t;
|
|
11404
11486
|
const i = this.eventType === "poll";
|
|
11405
11487
|
!i && !this.twoWayCommitBind && C.clearUserEditMarks(e, r);
|
|
11406
|
-
const n =
|
|
11488
|
+
const n = k.getValuesEditedAfter(
|
|
11407
11489
|
e,
|
|
11408
11490
|
i ? 0 : r
|
|
11409
11491
|
);
|
|
@@ -11426,10 +11508,10 @@ ${W}
|
|
|
11426
11508
|
*/
|
|
11427
11509
|
reconcileAncestorArgFormEdits(e, t, r, i) {
|
|
11428
11510
|
let n = t;
|
|
11429
|
-
for (const { form: s, key: a } of
|
|
11511
|
+
for (const { form: s, key: a } of k.collectArgForms(e)) {
|
|
11430
11512
|
if (!r.includes(a))
|
|
11431
11513
|
continue;
|
|
11432
|
-
const o =
|
|
11514
|
+
const o = k.getValuesEditedAfter(s, i);
|
|
11433
11515
|
if (Object.keys(o).length === 0)
|
|
11434
11516
|
continue;
|
|
11435
11517
|
const l = n[a], u = l && typeof l == "object" && !Array.isArray(l) ? l : {};
|
|
@@ -11509,7 +11591,7 @@ ${W}
|
|
|
11509
11591
|
* @returns 行の入力欄の状態を反映した要素データ
|
|
11510
11592
|
*/
|
|
11511
11593
|
resolveCurrentRowItem(e, t) {
|
|
11512
|
-
const r =
|
|
11594
|
+
const r = k.getValuesEditedAfter(e, 0);
|
|
11513
11595
|
return Object.keys(r).length === 0 ? t : me(t, r);
|
|
11514
11596
|
}
|
|
11515
11597
|
/**
|
|
@@ -11554,8 +11636,8 @@ ${W}
|
|
|
11554
11636
|
let t = !1;
|
|
11555
11637
|
const r = this.options.formFragment ?? this.options.selfValueFragment;
|
|
11556
11638
|
if (r) {
|
|
11557
|
-
const i =
|
|
11558
|
-
Object.assign(e, i),
|
|
11639
|
+
const i = k.getValues(r);
|
|
11640
|
+
Object.assign(e, i), k.carryCollectedRowIdentity(i, e);
|
|
11559
11641
|
}
|
|
11560
11642
|
if (this.options.data && typeof this.options.data == "object" && Object.assign(e, this.options.data), this.options.targetFragment && this.options.dataAttrName) {
|
|
11561
11643
|
const i = p.resolveDataAttributeDetailed(
|
|
@@ -12025,7 +12107,7 @@ ${W}
|
|
|
12025
12107
|
);
|
|
12026
12108
|
continue;
|
|
12027
12109
|
}
|
|
12028
|
-
a[d] = y, o = !0, u.syncWhenUnchanged === "supply" &&
|
|
12110
|
+
a[d] = y, o = !0, u.syncWhenUnchanged === "supply" && k.clearRowUserEditMarksForChangedKeys(u.row, y);
|
|
12029
12111
|
}
|
|
12030
12112
|
if (!o)
|
|
12031
12113
|
return;
|
|
@@ -12075,7 +12157,7 @@ ${W}
|
|
|
12075
12157
|
* @returns 反映完了の Promise
|
|
12076
12158
|
*/
|
|
12077
12159
|
static syncUnchangedRowValues(e, t, r) {
|
|
12078
|
-
return r === "supply" &&
|
|
12160
|
+
return r === "supply" && k.clearRowUserEditMarksForChangedKeys(e, t), k.syncRowValues(e, t);
|
|
12079
12161
|
}
|
|
12080
12162
|
/**
|
|
12081
12163
|
* 行の要素データが同じ内容かどうかを判定します。
|
|
@@ -12518,7 +12600,7 @@ const f = class f {
|
|
|
12518
12600
|
if (t.has(e) || !e.isInitialized())
|
|
12519
12601
|
return Promise.resolve();
|
|
12520
12602
|
const r = [];
|
|
12521
|
-
return e.hasAttribute(`${c.prefix}validity`) &&
|
|
12603
|
+
return e.hasAttribute(`${c.prefix}validity`) && k.applyCustomValidity(e), e.hasAttribute(`${c.prefix}fetch`) && r.push(f.executeManagedFetch(e)), e.hasAttribute(`${c.prefix}import`) && r.push(f.executeManagedImport(e)), e.isVisible() ? (e.getChildren().forEach((i) => {
|
|
12522
12604
|
i instanceof S && r.push(
|
|
12523
12605
|
f.reevaluateReactiveSpecialAttributes(i, t)
|
|
12524
12606
|
);
|
|
@@ -12636,7 +12718,7 @@ const f = class f {
|
|
|
12636
12718
|
if (!r)
|
|
12637
12719
|
return Promise.resolve();
|
|
12638
12720
|
const i = f.initializeElementFragment(r, !1).then(
|
|
12639
|
-
() =>
|
|
12721
|
+
() => k.restoreInitialValues(e)
|
|
12640
12722
|
);
|
|
12641
12723
|
return f.initialValueRestores.add(i), i.then(() => {
|
|
12642
12724
|
f.initialValueRestores.delete(i), t && te.applySubtree(e);
|
|
@@ -12750,7 +12832,7 @@ const f = class f {
|
|
|
12750
12832
|
e.getRawAttribute(n)
|
|
12751
12833
|
))), r.add(n));
|
|
12752
12834
|
}
|
|
12753
|
-
return t.then(() => (e.markInitialized(),
|
|
12835
|
+
return t.then(() => (e.markInitialized(), k.prepareFormName(e)));
|
|
12754
12836
|
}
|
|
12755
12837
|
/**
|
|
12756
12838
|
* 子孫初期化をスキップすべきかどうかを返します。
|
|
@@ -12853,7 +12935,7 @@ const f = class f {
|
|
|
12853
12935
|
break;
|
|
12854
12936
|
case `${c.prefix}validity`:
|
|
12855
12937
|
case `${c.prefix}validity-message`:
|
|
12856
|
-
return r !== null &&
|
|
12938
|
+
return r !== null && k.applyCustomValidity(s), Promise.all(o).then(() => {
|
|
12857
12939
|
});
|
|
12858
12940
|
case `${c.prefix}url-param`: {
|
|
12859
12941
|
const m = s.getAttribute(`${c.prefix}url-arg`), y = bt.readParams();
|
|
@@ -12925,23 +13007,23 @@ const f = class f {
|
|
|
12925
13007
|
i.setBindingData(E), a && (O.bindChange(e, y, E, "manual"), Fe.mirror(i));
|
|
12926
13008
|
const A = () => {
|
|
12927
13009
|
i.markBindingWorkStart();
|
|
12928
|
-
const
|
|
13010
|
+
const D = i.getRawBindingData() ?? E;
|
|
12929
13011
|
let M = a ? i.setAttribute(
|
|
12930
13012
|
`${c.prefix}bind`,
|
|
12931
|
-
JSON.stringify(f.withoutReservedBindingKeys(
|
|
13013
|
+
JSON.stringify(f.withoutReservedBindingKeys(D))
|
|
12932
13014
|
) : Promise.resolve();
|
|
12933
13015
|
return e.tagName === "FORM" && (M = M.then(() => {
|
|
12934
13016
|
if (i.wasResetAfter(m))
|
|
12935
13017
|
return;
|
|
12936
13018
|
const q = i.getRawBindingData() ?? E;
|
|
12937
|
-
return
|
|
13019
|
+
return k.syncValues(
|
|
12938
13020
|
i,
|
|
12939
|
-
|
|
13021
|
+
k.resolveSyncValues(i, q),
|
|
12940
13022
|
!1,
|
|
12941
13023
|
u
|
|
12942
13024
|
);
|
|
12943
13025
|
})), M = M.then(
|
|
12944
|
-
() =>
|
|
13026
|
+
() => k.syncAncestorArgForms(i, m, u, y)
|
|
12945
13027
|
), M = M.then(() => f.evaluateAll(i, n)), M = M.then(
|
|
12946
13028
|
() => S.retryUnappliedValueWrites(e, m)
|
|
12947
13029
|
), M = M.then(
|
|
@@ -13019,12 +13101,12 @@ const f = class f {
|
|
|
13019
13101
|
...Object.keys(d)
|
|
13020
13102
|
]);
|
|
13021
13103
|
for (const A of E) {
|
|
13022
|
-
const
|
|
13104
|
+
const D = n === "" ? A : `${n}.${A}`, M = f.mergePathAuthority(
|
|
13023
13105
|
e,
|
|
13024
13106
|
Object.prototype.hasOwnProperty.call(u, A) ? u[A] : f.ABSENT_PATH,
|
|
13025
13107
|
Object.prototype.hasOwnProperty.call(d, A) ? d[A] : f.ABSENT_PATH,
|
|
13026
13108
|
i,
|
|
13027
|
-
|
|
13109
|
+
D
|
|
13028
13110
|
);
|
|
13029
13111
|
M !== f.ABSENT_PATH && (m[A] = M), M !== (Object.prototype.hasOwnProperty.call(d, A) ? d[A] : f.ABSENT_PATH) && (y = !0);
|
|
13030
13112
|
}
|
|
@@ -13335,20 +13417,20 @@ const f = class f {
|
|
|
13335
13417
|
i.push(r.setValue(t));
|
|
13336
13418
|
const n = f.getFormFragment(r);
|
|
13337
13419
|
if (n) {
|
|
13338
|
-
const s =
|
|
13420
|
+
const s = k.getValues(n), a = n.getAttribute(`${c.prefix}form-arg`), o = n.getRawBindingData();
|
|
13339
13421
|
let l;
|
|
13340
13422
|
if (a) {
|
|
13341
13423
|
l = { ...o ?? {} };
|
|
13342
|
-
const u = String(a), d =
|
|
13343
|
-
l[u] =
|
|
13424
|
+
const u = String(a), d = k.resolveAncestorArgOwner(n, u);
|
|
13425
|
+
l[u] = k.mergeCollectedValues(
|
|
13344
13426
|
(d ? d.value : l[u]) ?? null,
|
|
13345
13427
|
s
|
|
13346
13428
|
);
|
|
13347
13429
|
} else
|
|
13348
|
-
l =
|
|
13430
|
+
l = k.mergeCollectedValues(
|
|
13349
13431
|
o,
|
|
13350
13432
|
s,
|
|
13351
|
-
|
|
13433
|
+
k.ancestorBaseResolver(n)
|
|
13352
13434
|
);
|
|
13353
13435
|
i.push(
|
|
13354
13436
|
// 値の設定に伴うコミットなので、値の供給ではない更新として扱う(権威を
|
|
@@ -14363,7 +14445,7 @@ ${r}
|
|
|
14363
14445
|
const J = A.get(K);
|
|
14364
14446
|
J ? J.push(I) : A.set(K, [I]);
|
|
14365
14447
|
});
|
|
14366
|
-
const
|
|
14448
|
+
const D = e.getChildElementFragments().filter((I) => !y.has(I)), M = D.filter(
|
|
14367
14449
|
(I) => I.hasAttribute(`${c.prefix}each-before`)
|
|
14368
14450
|
).length;
|
|
14369
14451
|
let q = Promise.resolve();
|
|
@@ -14383,14 +14465,14 @@ ${r}
|
|
|
14383
14465
|
s ? String(s) : null,
|
|
14384
14466
|
I
|
|
14385
14467
|
).then(
|
|
14386
|
-
(
|
|
14468
|
+
(F) => (
|
|
14387
14469
|
// 再利用行も新しい並び順の位置へ移動する。移動しないと、配列を並べ替え
|
|
14388
14470
|
// ただけの更新(data-each-key 指定時はキーが変わらないため全行が再利用
|
|
14389
14471
|
// される)で DOM の順序が古いまま残る。
|
|
14390
14472
|
f.repositionEachRow(
|
|
14391
14473
|
e,
|
|
14392
14474
|
H,
|
|
14393
|
-
|
|
14475
|
+
D,
|
|
14394
14476
|
G
|
|
14395
14477
|
).then(($) => {
|
|
14396
14478
|
if ($ !== null && O.rowMove(
|
|
@@ -14398,7 +14480,7 @@ ${r}
|
|
|
14398
14480
|
I,
|
|
14399
14481
|
$ - M,
|
|
14400
14482
|
K
|
|
14401
|
-
), !(!
|
|
14483
|
+
), !(!F && f.isRowLocalEachTemplate(e)))
|
|
14402
14484
|
return f.evaluateAll(H).then(
|
|
14403
14485
|
() => f.applyRowFormValues(e, H, J)
|
|
14404
14486
|
);
|
|
@@ -14418,9 +14500,9 @@ ${r}
|
|
|
14418
14500
|
s ? String(s) : null,
|
|
14419
14501
|
I
|
|
14420
14502
|
).then(() => {
|
|
14421
|
-
const
|
|
14422
|
-
return e.insertBefore(H,
|
|
14423
|
-
|
|
14503
|
+
const F = D[G] ?? null;
|
|
14504
|
+
return e.insertBefore(H, F).then(() => {
|
|
14505
|
+
D.splice(G, 0, H);
|
|
14424
14506
|
}).then(() => f.initializeFreshEachRow(H)).then(() => f.applyRowFormValues(e, H, J)).then(() => {
|
|
14425
14507
|
O.rowAdd(H.getTarget(), I, re, J);
|
|
14426
14508
|
});
|
|
@@ -14544,7 +14626,7 @@ ${r}
|
|
|
14544
14626
|
* @returns 反映完了の Promise
|
|
14545
14627
|
*/
|
|
14546
14628
|
static applyRowFormValues(e, t, r) {
|
|
14547
|
-
return !e.hasAttribute(`${c.prefix}form-list`) || !
|
|
14629
|
+
return !e.hasAttribute(`${c.prefix}form-list`) || !k.isCollectedListFromEachSource(e) || typeof r != "object" || r === null || Array.isArray(r) ? Promise.resolve() : k.syncRowValues(t, r);
|
|
14548
14630
|
}
|
|
14549
14631
|
/**
|
|
14550
14632
|
* リスト比較用のキーを生成します。
|
|
@@ -14741,7 +14823,7 @@ const Re = class Re {
|
|
|
14741
14823
|
*/
|
|
14742
14824
|
constructor(e = document) {
|
|
14743
14825
|
this.customEventHandlers = /* @__PURE__ */ new Map(), this.builtinListenersAdded = !1, this.deferred = !1, this.deferredProcedures = [], this.onClick = (t) => this.delegate(t, "click"), this.onReset = (t) => {
|
|
14744
|
-
if (t.defaultPrevented ||
|
|
14826
|
+
if (t.defaultPrevented || k.isResettingInternally())
|
|
14745
14827
|
return;
|
|
14746
14828
|
const r = t.target;
|
|
14747
14829
|
r instanceof HTMLElement && setTimeout(() => te.refreshSubtree(r), 0);
|
|
@@ -15309,7 +15391,7 @@ U.CONFIG_KEYS = /* @__PURE__ */ new Set([
|
|
|
15309
15391
|
"once"
|
|
15310
15392
|
]), U.registrations = /* @__PURE__ */ new Map();
|
|
15311
15393
|
let ve = U;
|
|
15312
|
-
const
|
|
15394
|
+
const w = class w {
|
|
15313
15395
|
/**
|
|
15314
15396
|
* 指定ノードとその子孫を走査し、`data-poll-*` の監視状態を同期します。
|
|
15315
15397
|
*
|
|
@@ -15317,8 +15399,8 @@ const v = class v {
|
|
|
15317
15399
|
* @returns 戻り値はありません。
|
|
15318
15400
|
*/
|
|
15319
15401
|
static syncTree(e) {
|
|
15320
|
-
(e instanceof Element || e instanceof DocumentFragment) && (
|
|
15321
|
-
|
|
15402
|
+
(e instanceof Element || e instanceof DocumentFragment) && (w.isHtmlElement(e) && w.syncElement(e), e.querySelectorAll("*").forEach((t) => {
|
|
15403
|
+
w.syncElement(t);
|
|
15322
15404
|
}));
|
|
15323
15405
|
}
|
|
15324
15406
|
/**
|
|
@@ -15331,23 +15413,23 @@ const v = class v {
|
|
|
15331
15413
|
* @returns 戻り値はありません。
|
|
15332
15414
|
*/
|
|
15333
15415
|
static syncElement(e) {
|
|
15334
|
-
const t =
|
|
15335
|
-
if (!t && !
|
|
15416
|
+
const t = w.registrations.get(e);
|
|
15417
|
+
if (!t && !w.hasPollAttribute(e))
|
|
15336
15418
|
return;
|
|
15337
15419
|
const r = T.get(e);
|
|
15338
|
-
if (!(r instanceof S) || !
|
|
15339
|
-
t &&
|
|
15420
|
+
if (!(r instanceof S) || !w.shouldObserve(r)) {
|
|
15421
|
+
t && w.teardown(e, t);
|
|
15340
15422
|
return;
|
|
15341
15423
|
}
|
|
15342
|
-
const i =
|
|
15424
|
+
const i = w.buildConfigKey(r);
|
|
15343
15425
|
if (t) {
|
|
15344
15426
|
if (t.configKey === i) {
|
|
15345
15427
|
t.fragment = r;
|
|
15346
15428
|
return;
|
|
15347
15429
|
}
|
|
15348
|
-
|
|
15430
|
+
w.teardown(e, t);
|
|
15349
15431
|
}
|
|
15350
|
-
|
|
15432
|
+
w.startPolling(e, r, i);
|
|
15351
15433
|
}
|
|
15352
15434
|
/**
|
|
15353
15435
|
* 指定ノードとその子孫の監視を解除します。
|
|
@@ -15359,13 +15441,13 @@ const v = class v {
|
|
|
15359
15441
|
* @returns 戻り値はありません。
|
|
15360
15442
|
*/
|
|
15361
15443
|
static cleanupTree(e) {
|
|
15362
|
-
if (
|
|
15363
|
-
const t =
|
|
15364
|
-
t &&
|
|
15444
|
+
if (w.isHtmlElement(e)) {
|
|
15445
|
+
const t = w.registrations.get(e);
|
|
15446
|
+
t && w.teardown(e, t);
|
|
15365
15447
|
}
|
|
15366
15448
|
(e instanceof Element || e instanceof DocumentFragment) && e.querySelectorAll("*").forEach((t) => {
|
|
15367
|
-
const r =
|
|
15368
|
-
r &&
|
|
15449
|
+
const r = w.registrations.get(t);
|
|
15450
|
+
r && w.teardown(t, r);
|
|
15369
15451
|
});
|
|
15370
15452
|
}
|
|
15371
15453
|
/**
|
|
@@ -15374,12 +15456,12 @@ const v = class v {
|
|
|
15374
15456
|
* @returns 戻り値はありません。
|
|
15375
15457
|
*/
|
|
15376
15458
|
static disconnectAll() {
|
|
15377
|
-
|
|
15378
|
-
|
|
15379
|
-
}),
|
|
15459
|
+
w.registrations.forEach((e) => {
|
|
15460
|
+
w.clearTimers(e);
|
|
15461
|
+
}), w.registrations.clear(), w.visibilityListener && typeof document < "u" && document.removeEventListener(
|
|
15380
15462
|
"visibilitychange",
|
|
15381
|
-
|
|
15382
|
-
),
|
|
15463
|
+
w.visibilityListener
|
|
15464
|
+
), w.visibilityListener = null;
|
|
15383
15465
|
}
|
|
15384
15466
|
/**
|
|
15385
15467
|
* ノードが現在の Window に属する HTMLElement かどうかを判定します。
|
|
@@ -15421,7 +15503,7 @@ const v = class v {
|
|
|
15421
15503
|
*/
|
|
15422
15504
|
static shouldObserve(e) {
|
|
15423
15505
|
const t = `${c.prefix}poll-`;
|
|
15424
|
-
return e.getAttributeNames().some((r) => r.startsWith(t) ? !
|
|
15506
|
+
return e.getAttributeNames().some((r) => r.startsWith(t) ? !w.CONFIG_KEYS.has(r.slice(t.length)) : !1);
|
|
15425
15507
|
}
|
|
15426
15508
|
/**
|
|
15427
15509
|
* 設定の同一性を判定するキーを組み立てます。
|
|
@@ -15453,9 +15535,9 @@ const v = class v {
|
|
|
15453
15535
|
const i = {
|
|
15454
15536
|
fragment: t,
|
|
15455
15537
|
configKey: r,
|
|
15456
|
-
intervalMs:
|
|
15457
|
-
timeoutMs:
|
|
15458
|
-
errorLimit:
|
|
15538
|
+
intervalMs: w.resolveInterval(t),
|
|
15539
|
+
timeoutMs: w.resolveTimeout(t),
|
|
15540
|
+
errorLimit: w.resolveErrorLimit(t),
|
|
15459
15541
|
startedAt: performance.now(),
|
|
15460
15542
|
intervalTimerId: null,
|
|
15461
15543
|
timeoutTimerId: null,
|
|
@@ -15467,9 +15549,9 @@ const v = class v {
|
|
|
15467
15549
|
count: 0,
|
|
15468
15550
|
consecutiveErrors: 0
|
|
15469
15551
|
};
|
|
15470
|
-
|
|
15471
|
-
|
|
15472
|
-
}, i.timeoutMs)),
|
|
15552
|
+
w.registrations.set(e, i), w.ensureVisibilityListener(), i.timeoutMs !== null && (i.timeoutTimerId = setTimeout(() => {
|
|
15553
|
+
w.handleTimeout(e);
|
|
15554
|
+
}, i.timeoutMs)), w.injectState(i), w.tick(e);
|
|
15473
15555
|
}
|
|
15474
15556
|
/**
|
|
15475
15557
|
* 1回分のポーリング処理を実行し、継続する場合は次回を予約します。
|
|
@@ -15478,20 +15560,20 @@ const v = class v {
|
|
|
15478
15560
|
* @returns 処理完了の Promise
|
|
15479
15561
|
*/
|
|
15480
15562
|
static async tick(e) {
|
|
15481
|
-
const t =
|
|
15563
|
+
const t = w.registrations.get(e);
|
|
15482
15564
|
if (!t || t.stopped || t.fetching)
|
|
15483
15565
|
return;
|
|
15484
15566
|
if (t.intervalTimerId = null, !e.isConnected) {
|
|
15485
|
-
await
|
|
15567
|
+
await w.stop(e, t, "detached");
|
|
15486
15568
|
return;
|
|
15487
15569
|
}
|
|
15488
|
-
const r =
|
|
15489
|
-
if (r !== t.paused && (t.paused = r, await
|
|
15490
|
-
|
|
15570
|
+
const r = w.isHidden(e) || w.isDisabled(t.fragment);
|
|
15571
|
+
if (r !== t.paused && (t.paused = r, await w.injectState(t)), r) {
|
|
15572
|
+
w.schedule(e, t);
|
|
15491
15573
|
return;
|
|
15492
15574
|
}
|
|
15493
|
-
if (
|
|
15494
|
-
await
|
|
15575
|
+
if (w.isUntilSatisfied(t.fragment)) {
|
|
15576
|
+
await w.stop(e, t, "until");
|
|
15495
15577
|
return;
|
|
15496
15578
|
}
|
|
15497
15579
|
t.fetching = !0, t.count += 1;
|
|
@@ -15506,18 +15588,18 @@ const v = class v {
|
|
|
15506
15588
|
} finally {
|
|
15507
15589
|
t.fetching = !1;
|
|
15508
15590
|
}
|
|
15509
|
-
if (!(
|
|
15591
|
+
if (!(w.registrations.get(e) !== t || t.stopped)) {
|
|
15510
15592
|
if (i)
|
|
15511
15593
|
t.consecutiveErrors = 0;
|
|
15512
15594
|
else if (t.consecutiveErrors += 1, t.errorLimit !== null && t.consecutiveErrors >= t.errorLimit) {
|
|
15513
|
-
await
|
|
15595
|
+
await w.stop(e, t, "error");
|
|
15514
15596
|
return;
|
|
15515
15597
|
}
|
|
15516
|
-
if (i &&
|
|
15517
|
-
await
|
|
15598
|
+
if (i && w.isUntilSatisfied(t.fragment)) {
|
|
15599
|
+
await w.stop(e, t, "until");
|
|
15518
15600
|
return;
|
|
15519
15601
|
}
|
|
15520
|
-
|
|
15602
|
+
w.schedule(e, t);
|
|
15521
15603
|
}
|
|
15522
15604
|
}
|
|
15523
15605
|
/**
|
|
@@ -15532,7 +15614,7 @@ const v = class v {
|
|
|
15532
15614
|
*/
|
|
15533
15615
|
static schedule(e, t) {
|
|
15534
15616
|
t.stopped || t.intervalTimerId !== null || (t.intervalTimerId = setTimeout(() => {
|
|
15535
|
-
|
|
15617
|
+
w.tick(e);
|
|
15536
15618
|
}, t.intervalMs));
|
|
15537
15619
|
}
|
|
15538
15620
|
/**
|
|
@@ -15542,12 +15624,12 @@ const v = class v {
|
|
|
15542
15624
|
* @returns 処理完了の Promise
|
|
15543
15625
|
*/
|
|
15544
15626
|
static async handleTimeout(e) {
|
|
15545
|
-
const t =
|
|
15627
|
+
const t = w.registrations.get(e);
|
|
15546
15628
|
!t || t.stopped || (t.timeoutTimerId = null, t.timedOut = !0, e.isConnected && O.pollTimeout(
|
|
15547
15629
|
e,
|
|
15548
15630
|
t.count,
|
|
15549
|
-
|
|
15550
|
-
), await
|
|
15631
|
+
w.elapsed(t)
|
|
15632
|
+
), await w.stop(e, t, "timeout"));
|
|
15551
15633
|
}
|
|
15552
15634
|
/**
|
|
15553
15635
|
* ポーリングを恒久停止します。
|
|
@@ -15559,15 +15641,15 @@ const v = class v {
|
|
|
15559
15641
|
*/
|
|
15560
15642
|
static async stop(e, t, r) {
|
|
15561
15643
|
if (!t.stopped) {
|
|
15562
|
-
if (t.stopped = !0, t.stopReason = r, t.paused = !1,
|
|
15563
|
-
|
|
15644
|
+
if (t.stopped = !0, t.stopReason = r, t.paused = !1, w.clearTimers(t), r === "detached") {
|
|
15645
|
+
w.registrations.delete(e);
|
|
15564
15646
|
return;
|
|
15565
15647
|
}
|
|
15566
|
-
await
|
|
15648
|
+
await w.injectState(t), e.isConnected && O.pollStop(
|
|
15567
15649
|
e,
|
|
15568
15650
|
r,
|
|
15569
15651
|
t.count,
|
|
15570
|
-
|
|
15652
|
+
w.elapsed(t)
|
|
15571
15653
|
);
|
|
15572
15654
|
}
|
|
15573
15655
|
}
|
|
@@ -15579,7 +15661,7 @@ const v = class v {
|
|
|
15579
15661
|
* @returns 戻り値はありません。
|
|
15580
15662
|
*/
|
|
15581
15663
|
static teardown(e, t) {
|
|
15582
|
-
|
|
15664
|
+
w.clearTimers(t), w.registrations.delete(e);
|
|
15583
15665
|
}
|
|
15584
15666
|
/**
|
|
15585
15667
|
* 登録情報が持つタイマーをすべて破棄します。
|
|
@@ -15608,16 +15690,16 @@ const v = class v {
|
|
|
15608
15690
|
* @returns 戻り値はありません。
|
|
15609
15691
|
*/
|
|
15610
15692
|
static ensureVisibilityListener() {
|
|
15611
|
-
if (
|
|
15693
|
+
if (w.visibilityListener || typeof document > "u")
|
|
15612
15694
|
return;
|
|
15613
15695
|
const e = () => {
|
|
15614
|
-
document.visibilityState === "visible" && Array.from(
|
|
15696
|
+
document.visibilityState === "visible" && Array.from(w.registrations.entries()).forEach(
|
|
15615
15697
|
([t, r]) => {
|
|
15616
|
-
r.stopped || r.fetching || (r.intervalTimerId !== null && (clearTimeout(r.intervalTimerId), r.intervalTimerId = null),
|
|
15698
|
+
r.stopped || r.fetching || (r.intervalTimerId !== null && (clearTimeout(r.intervalTimerId), r.intervalTimerId = null), w.tick(t));
|
|
15617
15699
|
}
|
|
15618
15700
|
);
|
|
15619
15701
|
};
|
|
15620
|
-
|
|
15702
|
+
w.visibilityListener = e, document.addEventListener("visibilitychange", e);
|
|
15621
15703
|
}
|
|
15622
15704
|
/**
|
|
15623
15705
|
* `_poll` 状態を注入先のバインディングデータへ反映します。
|
|
@@ -15631,7 +15713,7 @@ const v = class v {
|
|
|
15631
15713
|
* @returns 注入完了の Promise
|
|
15632
15714
|
*/
|
|
15633
15715
|
static injectState(e) {
|
|
15634
|
-
const t =
|
|
15716
|
+
const t = w.resolveStateFragments(e);
|
|
15635
15717
|
if (t.length === 0)
|
|
15636
15718
|
return Promise.resolve();
|
|
15637
15719
|
const r = {
|
|
@@ -15641,7 +15723,7 @@ const v = class v {
|
|
|
15641
15723
|
timedOut: e.timedOut,
|
|
15642
15724
|
stopReason: e.stopReason,
|
|
15643
15725
|
count: e.count,
|
|
15644
|
-
elapsedMs:
|
|
15726
|
+
elapsedMs: w.elapsed(e)
|
|
15645
15727
|
};
|
|
15646
15728
|
return Promise.all(
|
|
15647
15729
|
t.map((i) => {
|
|
@@ -15703,15 +15785,15 @@ const v = class v {
|
|
|
15703
15785
|
static resolveInterval(e) {
|
|
15704
15786
|
const t = `${c.prefix}poll-interval`;
|
|
15705
15787
|
if (!e.hasAttribute(t))
|
|
15706
|
-
return
|
|
15707
|
-
const r =
|
|
15788
|
+
return w.DEFAULT_INTERVAL_MS;
|
|
15789
|
+
const r = w.toNumber(e.getAttribute(t));
|
|
15708
15790
|
return r === null ? (g.warn(
|
|
15709
15791
|
"[Haori]",
|
|
15710
|
-
`${t} は数値で指定してください。既定値 ${
|
|
15711
|
-
),
|
|
15792
|
+
`${t} は数値で指定してください。既定値 ${w.DEFAULT_INTERVAL_MS}ms を使用します。`
|
|
15793
|
+
), w.DEFAULT_INTERVAL_MS) : r < w.MIN_INTERVAL_MS ? (g.warn(
|
|
15712
15794
|
"[Haori]",
|
|
15713
|
-
`${t} の下限は ${
|
|
15714
|
-
),
|
|
15795
|
+
`${t} の下限は ${w.MIN_INTERVAL_MS}ms です。${r}ms は下限へ切り上げます。`
|
|
15796
|
+
), w.MIN_INTERVAL_MS) : r;
|
|
15715
15797
|
}
|
|
15716
15798
|
/**
|
|
15717
15799
|
* `data-poll-timeout` を解決します。
|
|
@@ -15723,7 +15805,7 @@ const v = class v {
|
|
|
15723
15805
|
const t = `${c.prefix}poll-timeout`;
|
|
15724
15806
|
if (!e.hasAttribute(t))
|
|
15725
15807
|
return null;
|
|
15726
|
-
const r =
|
|
15808
|
+
const r = w.toNumber(e.getAttribute(t));
|
|
15727
15809
|
return r === null || r <= 0 ? (g.warn(
|
|
15728
15810
|
"[Haori]",
|
|
15729
15811
|
`${t} は正の数値で指定してください。無制限として扱います。`
|
|
@@ -15739,7 +15821,7 @@ const v = class v {
|
|
|
15739
15821
|
const t = `${c.prefix}poll-error-limit`;
|
|
15740
15822
|
if (!e.hasAttribute(t))
|
|
15741
15823
|
return null;
|
|
15742
|
-
const r =
|
|
15824
|
+
const r = w.toNumber(e.getAttribute(t));
|
|
15743
15825
|
return r === null || r < 1 ? (g.warn(
|
|
15744
15826
|
"[Haori]",
|
|
15745
15827
|
`${t} は 1 以上の数値で指定してください。無制限として扱います。`
|
|
@@ -15781,7 +15863,7 @@ const v = class v {
|
|
|
15781
15863
|
*/
|
|
15782
15864
|
static isDisabled(e) {
|
|
15783
15865
|
const t = `${c.prefix}poll-disabled`;
|
|
15784
|
-
return e.hasAttribute(t) ?
|
|
15866
|
+
return e.hasAttribute(t) ? w.isTruthy(e.getAttribute(t)) : !1;
|
|
15785
15867
|
}
|
|
15786
15868
|
/**
|
|
15787
15869
|
* `data-poll-until` の条件が成立したかどうかを判定します。
|
|
@@ -15804,7 +15886,7 @@ const v = class v {
|
|
|
15804
15886
|
`${t} に未解決の参照が含まれています(停止条件は成立扱いにしません):`,
|
|
15805
15887
|
e.getRawAttribute(t),
|
|
15806
15888
|
e.getTarget()
|
|
15807
|
-
), !1) :
|
|
15889
|
+
), !1) : w.isTruthy(r.value) : !1;
|
|
15808
15890
|
}
|
|
15809
15891
|
/**
|
|
15810
15892
|
* 属性の評価値を真偽値として解釈します。
|
|
@@ -15827,16 +15909,16 @@ const v = class v {
|
|
|
15827
15909
|
return !!e;
|
|
15828
15910
|
}
|
|
15829
15911
|
};
|
|
15830
|
-
|
|
15912
|
+
w.CONFIG_KEYS = /* @__PURE__ */ new Set([
|
|
15831
15913
|
"interval",
|
|
15832
15914
|
"timeout",
|
|
15833
15915
|
"until",
|
|
15834
15916
|
"error-limit",
|
|
15835
15917
|
"disabled",
|
|
15836
15918
|
"state"
|
|
15837
|
-
]),
|
|
15838
|
-
let we =
|
|
15839
|
-
const Jt = "0.
|
|
15919
|
+
]), w.DEFAULT_INTERVAL_MS = 5e3, w.MIN_INTERVAL_MS = 100, w.registrations = /* @__PURE__ */ new Map(), w.visibilityListener = null;
|
|
15920
|
+
let we = w;
|
|
15921
|
+
const Jt = "0.60.0";
|
|
15840
15922
|
function Zt(b) {
|
|
15841
15923
|
typeof requestAnimationFrame == "function" ? requestAnimationFrame(() => b()) : Promise.resolve().then(b);
|
|
15842
15924
|
}
|
|
@@ -16424,7 +16506,7 @@ export {
|
|
|
16424
16506
|
C as Core,
|
|
16425
16507
|
te as Enhance,
|
|
16426
16508
|
c as Env,
|
|
16427
|
-
|
|
16509
|
+
k as Form,
|
|
16428
16510
|
T as Fragment,
|
|
16429
16511
|
Te as Haori,
|
|
16430
16512
|
g as Log,
|