haori 0.62.1 → 0.62.3
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 +1 -1
- package/README.md +2 -2
- package/dist/haori.cjs.js +18 -18
- package/dist/haori.es.js +912 -790
- package/dist/haori.iife.js +20 -20
- package/dist/index.d.ts +2 -2
- package/package.json +1 -1
package/dist/haori.es.js
CHANGED
|
@@ -462,7 +462,7 @@ function ot(b, e) {
|
|
|
462
462
|
const i = Number(r.year), n = Number(r.month), s = Number(r.day), a = Number(r.hour), o = Number(r.minute), l = Number(r.second);
|
|
463
463
|
return !Number.isFinite(i) || !Number.isFinite(n) || !Number.isFinite(s) || !Number.isFinite(a) || !Number.isFinite(o) || !Number.isFinite(l) ? null : at(i, n, s, a, o, l);
|
|
464
464
|
}
|
|
465
|
-
function
|
|
465
|
+
function He(b, e = st, t) {
|
|
466
466
|
if (b == null || b === "")
|
|
467
467
|
return "";
|
|
468
468
|
const r = b instanceof Date ? b : new Date(b);
|
|
@@ -489,7 +489,7 @@ function Ue(b, e = st, t) {
|
|
|
489
489
|
}
|
|
490
490
|
const Ft = "yyyy-MM-dd";
|
|
491
491
|
function lt(b = st, e) {
|
|
492
|
-
return
|
|
492
|
+
return He(/* @__PURE__ */ new Date(), b, e);
|
|
493
493
|
}
|
|
494
494
|
function ct(b = 0, e = Ft, t) {
|
|
495
495
|
const r = Number.isFinite(b) ? Math.trunc(b) : 0, i = typeof t == "string" && t.trim() !== "" ? t.trim() : "";
|
|
@@ -504,7 +504,7 @@ function ct(b = 0, e = Ft, t) {
|
|
|
504
504
|
n = l.getFullYear(), s = l.getMonth() + 1, a = l.getDate();
|
|
505
505
|
}
|
|
506
506
|
const o = new Date(Date.UTC(n, s - 1, a + r));
|
|
507
|
-
return
|
|
507
|
+
return He(o, e, "UTC");
|
|
508
508
|
}
|
|
509
509
|
function ut(b, e) {
|
|
510
510
|
if (b == null)
|
|
@@ -541,7 +541,7 @@ function dt(b, e, t) {
|
|
|
541
541
|
s.push(a);
|
|
542
542
|
return s;
|
|
543
543
|
}
|
|
544
|
-
function
|
|
544
|
+
function ht(b, e, t = {}) {
|
|
545
545
|
const r = Math.trunc(Number(b));
|
|
546
546
|
if (!Number.isFinite(r) || r <= 0)
|
|
547
547
|
return [];
|
|
@@ -549,17 +549,17 @@ function ft(b, e, t = {}) {
|
|
|
549
549
|
Math.max(Math.trunc(Number(e)) || 0, 0),
|
|
550
550
|
r - 1
|
|
551
551
|
), n = Math.max(0, Math.trunc(t.window ?? 2)), s = Math.max(0, Math.trunc(t.boundary ?? 1)), a = /* @__PURE__ */ new Set();
|
|
552
|
-
for (let
|
|
553
|
-
a.add(
|
|
554
|
-
for (let
|
|
555
|
-
a.add(
|
|
556
|
-
for (let
|
|
557
|
-
a.add(
|
|
558
|
-
const o = Array.from(a).sort((
|
|
552
|
+
for (let f = 0; f < s && f < r; f += 1)
|
|
553
|
+
a.add(f);
|
|
554
|
+
for (let f = Math.max(0, r - s); f < r; f += 1)
|
|
555
|
+
a.add(f);
|
|
556
|
+
for (let f = Math.max(0, i - n); f <= Math.min(r - 1, i + n); f += 1)
|
|
557
|
+
a.add(f);
|
|
558
|
+
const o = Array.from(a).sort((f, m) => f - m), l = [];
|
|
559
559
|
let u = null;
|
|
560
|
-
for (const
|
|
561
|
-
if (u !== null &&
|
|
562
|
-
if (
|
|
560
|
+
for (const f of o) {
|
|
561
|
+
if (u !== null && f - u > 1)
|
|
562
|
+
if (f - u === 2) {
|
|
563
563
|
const m = u + 1;
|
|
564
564
|
l.push({
|
|
565
565
|
page: m,
|
|
@@ -570,20 +570,20 @@ function ft(b, e, t = {}) {
|
|
|
570
570
|
} else
|
|
571
571
|
l.push({ page: null, label: "…", active: !1, ellipsis: !0 });
|
|
572
572
|
l.push({
|
|
573
|
-
page:
|
|
574
|
-
label:
|
|
575
|
-
active:
|
|
573
|
+
page: f,
|
|
574
|
+
label: f + 1,
|
|
575
|
+
active: f === i,
|
|
576
576
|
ellipsis: !1
|
|
577
|
-
}), u =
|
|
577
|
+
}), u = f;
|
|
578
578
|
}
|
|
579
579
|
return l;
|
|
580
580
|
}
|
|
581
581
|
const kt = /^(\d{4})-(\d{1,2})$/, It = 1200;
|
|
582
|
-
function
|
|
582
|
+
function Me(b, e) {
|
|
583
583
|
const t = Number(b);
|
|
584
584
|
return Number.isFinite(t) ? Math.trunc(t) : e;
|
|
585
585
|
}
|
|
586
|
-
function
|
|
586
|
+
function Ue(b, e) {
|
|
587
587
|
if (typeof b != "string")
|
|
588
588
|
return "";
|
|
589
589
|
const t = kt.exec(b.trim());
|
|
@@ -597,11 +597,11 @@ function He(b, e) {
|
|
|
597
597
|
}
|
|
598
598
|
function xt(b) {
|
|
599
599
|
if (typeof b == "string" && b.trim() !== "")
|
|
600
|
-
return
|
|
600
|
+
return Ue(b, 0);
|
|
601
601
|
const e = /* @__PURE__ */ new Date();
|
|
602
602
|
return `${String(e.getFullYear()).padStart(4, "0")}-${ce(e.getMonth() + 1)}`;
|
|
603
603
|
}
|
|
604
|
-
function
|
|
604
|
+
function ft(b, e) {
|
|
605
605
|
const t = Math.trunc(Number(b));
|
|
606
606
|
if (!Number.isFinite(t) || t < 0)
|
|
607
607
|
return [];
|
|
@@ -610,7 +610,7 @@ function ht(b, e) {
|
|
|
610
610
|
return [];
|
|
611
611
|
const i = Math.min(t, It), n = [];
|
|
612
612
|
for (let s = 0; s <= i; s += 1) {
|
|
613
|
-
const a =
|
|
613
|
+
const a = Ue(r, -s);
|
|
614
614
|
n.push({ targetMonth: a, label: a.replace(/-/g, "/") });
|
|
615
615
|
}
|
|
616
616
|
return n;
|
|
@@ -619,16 +619,16 @@ function pt(b, e) {
|
|
|
619
619
|
const t = { start: 0, end: 0, total: 0, empty: !0 };
|
|
620
620
|
if (!b || typeof b != "object")
|
|
621
621
|
return t;
|
|
622
|
-
const r = b, i =
|
|
622
|
+
const r = b, i = Me(r.totalElements ?? r.totalCount, 0);
|
|
623
623
|
if (i <= 0)
|
|
624
624
|
return t;
|
|
625
|
-
const n = Math.max(0,
|
|
625
|
+
const n = Math.max(0, Me(r.number, 0)), s = Math.max(0, Me(r.size, 0)), a = n * s, o = Math.min(a + 1, i);
|
|
626
626
|
let l;
|
|
627
627
|
if (e !== void 0 && Number.isFinite(e))
|
|
628
628
|
l = Math.max(0, Math.trunc(e));
|
|
629
629
|
else {
|
|
630
|
-
const
|
|
631
|
-
l = Number.isFinite(
|
|
630
|
+
const f = Me(r.numberOfElements, NaN);
|
|
631
|
+
l = Number.isFinite(f) ? f : Math.min(s, i - a);
|
|
632
632
|
}
|
|
633
633
|
const u = Math.min(a + l, i);
|
|
634
634
|
return { start: o, end: Math.max(u, o), total: i, empty: !1 };
|
|
@@ -681,15 +681,15 @@ function Et(b, e) {
|
|
|
681
681
|
}
|
|
682
682
|
return r;
|
|
683
683
|
}
|
|
684
|
-
const
|
|
685
|
-
date:
|
|
684
|
+
const Ct = Object.freeze({
|
|
685
|
+
date: He,
|
|
686
686
|
now: lt,
|
|
687
687
|
today: ct,
|
|
688
688
|
number: ut,
|
|
689
|
-
pages:
|
|
689
|
+
pages: ht,
|
|
690
690
|
range: dt,
|
|
691
|
-
monthAdd:
|
|
692
|
-
monthRange:
|
|
691
|
+
monthAdd: Ue,
|
|
692
|
+
monthRange: ft,
|
|
693
693
|
pageSummary: pt,
|
|
694
694
|
findBy: gt,
|
|
695
695
|
sum: mt,
|
|
@@ -698,7 +698,7 @@ const Mt = Object.freeze({
|
|
|
698
698
|
});
|
|
699
699
|
class ze {
|
|
700
700
|
constructor() {
|
|
701
|
-
this.MAX_BUDGET = 8, this.queue = [], this.processing = !1;
|
|
701
|
+
this.MAX_BUDGET = 8, this.queue = [], this.processing = !1, this.channel = null;
|
|
702
702
|
}
|
|
703
703
|
/**
|
|
704
704
|
* 処理をキューに追加します
|
|
@@ -752,13 +752,35 @@ class ze {
|
|
|
752
752
|
}
|
|
753
753
|
/**
|
|
754
754
|
* 処理をスケジュールします。
|
|
755
|
+
*
|
|
756
|
+
* 処理は次のタスクで始めます(仕様「7. Queue (queue.ts)」の「処理は次のフレームを待たず、
|
|
757
|
+
* 次のタスクで始めます」)。1 回の更新の中でもキューは何度も空になってから
|
|
758
|
+
* 再開するため、再開のたびに次のフレームを待つと、その待ち時間が積み重なります。
|
|
759
|
+
* タスクの合間にはブラウザが入力の処理と描画を行えるため、8ms で区切って
|
|
760
|
+
* 譲る効果は変わりません。
|
|
755
761
|
*/
|
|
756
762
|
scheduleProcessing() {
|
|
757
|
-
this.processing
|
|
763
|
+
if (this.processing)
|
|
764
|
+
return;
|
|
765
|
+
const e = this.getChannel();
|
|
766
|
+
e !== null ? e.port2.postMessage(null) : setTimeout(() => {
|
|
758
767
|
this.processQueue();
|
|
759
|
-
}
|
|
768
|
+
}, 0);
|
|
769
|
+
}
|
|
770
|
+
/**
|
|
771
|
+
* 次のタスクで処理を始めるための `MessageChannel` を返します。
|
|
772
|
+
*
|
|
773
|
+
* `setTimeout(0)` は入れ子が深くなると 4ms 以上に引き延ばされ、背面のタブでは
|
|
774
|
+
* さらに間引かれるため、`MessageChannel` を使います。最初に処理を積んだときに
|
|
775
|
+
* 1 つだけ作って使い回します(仕様「7. Queue (queue.ts)」の「読み込んだだけでは
|
|
776
|
+
* 作りません」)。
|
|
777
|
+
*
|
|
778
|
+
* @returns 通知路。`MessageChannel` の無い環境では null
|
|
779
|
+
*/
|
|
780
|
+
getChannel() {
|
|
781
|
+
return this.channel === null && typeof MessageChannel < "u" && (this.channel = new MessageChannel(), this.channel.port1.onmessage = () => {
|
|
760
782
|
this.processQueue();
|
|
761
|
-
},
|
|
783
|
+
}), this.channel;
|
|
762
784
|
}
|
|
763
785
|
/**
|
|
764
786
|
* キューが空になるまで待機します。
|
|
@@ -828,7 +850,7 @@ const Ye = class Ye {
|
|
|
828
850
|
};
|
|
829
851
|
Ye.ASYNC_QUEUE = new ze();
|
|
830
852
|
let z = Ye;
|
|
831
|
-
const
|
|
853
|
+
const T = class T {
|
|
832
854
|
/**
|
|
833
855
|
* 明示バインド内に持ち込まれてはならない危険値を返します。
|
|
834
856
|
*
|
|
@@ -933,11 +955,10 @@ const D = class D {
|
|
|
933
955
|
/**
|
|
934
956
|
* バインドキーが関数の引数名として使えるかを返します。
|
|
935
957
|
*
|
|
936
|
-
*
|
|
958
|
+
* 評価器の引数は式が参照する名前(識別子の字句)から選ぶため、引数名にできない
|
|
937
959
|
* キー(`customer.email` のようにドットを含むもの、ハイフン、空白、先頭が数字、
|
|
938
|
-
*
|
|
939
|
-
*
|
|
940
|
-
* 例外も出さずに他のキーの値を壊します。
|
|
960
|
+
* 予約語など)は引数になりません。この判定は、そうしたキーを開発モードで報告
|
|
961
|
+
* するために使います(`reportUnusableBindingKeys()`)。
|
|
941
962
|
*
|
|
942
963
|
* 判定は 2 段で行います。実際に `new Function` へ通して予約語(`class` など)と
|
|
943
964
|
* 識別子として不正な文字を弾き、あわせて単一の識別子名かを検査して `a,b`
|
|
@@ -955,7 +976,7 @@ const D = class D {
|
|
|
955
976
|
let r = this.IDENTIFIER_NAME_PATTERN.test(e);
|
|
956
977
|
if (r)
|
|
957
978
|
try {
|
|
958
|
-
new Function(e, "");
|
|
979
|
+
new Function(e, '"use strict"');
|
|
959
980
|
} catch {
|
|
960
981
|
r = !1;
|
|
961
982
|
}
|
|
@@ -971,7 +992,7 @@ const D = class D {
|
|
|
971
992
|
* @returns 戻り値はありません。
|
|
972
993
|
*/
|
|
973
994
|
static reportUnusableBindingKeys(e) {
|
|
974
|
-
if (e.length === 0
|
|
995
|
+
if (e.length === 0)
|
|
975
996
|
return;
|
|
976
997
|
const t = e.filter(
|
|
977
998
|
(r) => !this.loggedUnusableBindingKeys.has(r)
|
|
@@ -991,6 +1012,24 @@ const D = class D {
|
|
|
991
1012
|
const t = new Set(e);
|
|
992
1013
|
return this.FORBIDDEN_NAMES.filter((r) => !t.has(r)).map((r) => `const ${r} = undefined`).join(`;
|
|
993
1014
|
`);
|
|
1015
|
+
}
|
|
1016
|
+
/**
|
|
1017
|
+
* 式が参照する標準組み込みを `const` として宣言するコードを生成します。
|
|
1018
|
+
*
|
|
1019
|
+
* `const` にした名前へ `++` / `--` を書くと `TypeError` になり、グローバルは
|
|
1020
|
+
* 書き換わりません。バインドのキーと同じ名前は引数が遮蔽するため宣言しません
|
|
1021
|
+
* (宣言すると引数と重複して構文エラーになります)。
|
|
1022
|
+
*
|
|
1023
|
+
* @param expression 評価対象の式
|
|
1024
|
+
* @param bindKeySet 現在の式で利用するバインド識別子
|
|
1025
|
+
* @returns 評価前に挿入する宣言。対象が無ければ空文字
|
|
1026
|
+
*/
|
|
1027
|
+
static buildBuiltinConstants(e, t) {
|
|
1028
|
+
const r = this.extractFreeIdentifiers(e).filter(
|
|
1029
|
+
(i) => this.ALLOWED_GLOBAL_IDENTIFIERS.has(i) && !t.has(i)
|
|
1030
|
+
);
|
|
1031
|
+
return r.length === 0 ? "" : `const ${r.map((i) => `${i} = this.${i}`).join(", ")};
|
|
1032
|
+
`;
|
|
994
1033
|
}
|
|
995
1034
|
/**
|
|
996
1035
|
* 式の中で「使用できない(ブロックされた)グローバル識別子」を参照しているものを
|
|
@@ -1075,13 +1114,13 @@ const D = class D {
|
|
|
1075
1114
|
continue;
|
|
1076
1115
|
let o = 0, l = 0;
|
|
1077
1116
|
for (let u = s - 1; u >= 0; u -= 1) {
|
|
1078
|
-
const
|
|
1079
|
-
if (
|
|
1080
|
-
o += 1,
|
|
1117
|
+
const f = i[u].value;
|
|
1118
|
+
if (f === ")" || f === "]" || f === "}") {
|
|
1119
|
+
o += 1, f === ")" && (l += 1);
|
|
1081
1120
|
continue;
|
|
1082
1121
|
}
|
|
1083
|
-
if (
|
|
1084
|
-
if (o -= 1,
|
|
1122
|
+
if (f === "(" || f === "[" || f === "{") {
|
|
1123
|
+
if (o -= 1, f === "(" && (l -= 1), o === 0)
|
|
1085
1124
|
break;
|
|
1086
1125
|
continue;
|
|
1087
1126
|
}
|
|
@@ -1138,6 +1177,27 @@ let ${e.join(", ")};`;
|
|
|
1138
1177
|
static startsCall(e) {
|
|
1139
1178
|
return e === null ? !1 : e.type === "identifier" ? !this.NON_SHADOWABLE_IDENTIFIERS.has(e.value) : e.value === ")" || e.value === "]";
|
|
1140
1179
|
}
|
|
1180
|
+
/**
|
|
1181
|
+
* `(` がアロー関数の引数リストの開始かどうかを判定します。
|
|
1182
|
+
*
|
|
1183
|
+
* `async (x) => x` の `(x)` は引数リストで、呼び出しではありません(仕様
|
|
1184
|
+
* 「暗黙のオプショナルチェーン」の「アロー関数の引数リストやグループ化の丸括弧は
|
|
1185
|
+
* 呼び出しとみなしません」)。呼び出しの位置(直前が識別子・`)`・`]`)にある
|
|
1186
|
+
* `(` のうち、対応する `)` の直後が `=>` のものだけを引数リストとみなします
|
|
1187
|
+
* (`async` 以外の名前の後では構文エラーの式で、どちらとみなしても結果は
|
|
1188
|
+
* 同じです)。引数の既定値は書けないため、引数リストの中に丸括弧は現れず、
|
|
1189
|
+
* 最初の `)` が対応する `)` です。
|
|
1190
|
+
*
|
|
1191
|
+
* @param tokens 式のトークン列
|
|
1192
|
+
* @param index `(` の位置
|
|
1193
|
+
* @returns 引数リストの開始であれば true
|
|
1194
|
+
*/
|
|
1195
|
+
static startsArrowParameters(e, t) {
|
|
1196
|
+
const r = e.findIndex(
|
|
1197
|
+
(i, n) => n > t && i.value === ")"
|
|
1198
|
+
);
|
|
1199
|
+
return e[r + 1]?.value === "=>";
|
|
1200
|
+
}
|
|
1141
1201
|
/**
|
|
1142
1202
|
* メンバーアクセスを暗黙のオプショナルチェーンへ変換します。
|
|
1143
1203
|
*
|
|
@@ -1161,16 +1221,18 @@ let ${e.join(", ")};`;
|
|
|
1161
1221
|
if (r !== null) {
|
|
1162
1222
|
const n = [];
|
|
1163
1223
|
let s = null;
|
|
1164
|
-
for (
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1224
|
+
for (let a = 0; a < r.length; a += 1) {
|
|
1225
|
+
const o = r[a];
|
|
1226
|
+
o.type === "operator" && s?.value !== "?." && (o.value === "." ? n.push({
|
|
1227
|
+
start: o.position,
|
|
1228
|
+
end: o.position + 1,
|
|
1168
1229
|
text: "?."
|
|
1169
|
-
}) : (
|
|
1170
|
-
start:
|
|
1171
|
-
end:
|
|
1230
|
+
}) : (o.value === "[" && this.startsMemberAccess(s) || o.value === "(" && this.startsCall(s) && !this.startsArrowParameters(r, a)) && n.push({
|
|
1231
|
+
start: o.position,
|
|
1232
|
+
end: o.position,
|
|
1172
1233
|
text: "?."
|
|
1173
|
-
})), s =
|
|
1234
|
+
})), s = o;
|
|
1235
|
+
}
|
|
1174
1236
|
for (let a = n.length - 1; a >= 0; a -= 1) {
|
|
1175
1237
|
const o = n[a];
|
|
1176
1238
|
i = i.slice(0, o.start) + o.text + i.slice(o.end);
|
|
@@ -1212,7 +1274,7 @@ let ${e.join(", ")};`;
|
|
|
1212
1274
|
s.push(l), l && n.push({
|
|
1213
1275
|
start: o.position + 1,
|
|
1214
1276
|
end: o.position + 1,
|
|
1215
|
-
text:
|
|
1277
|
+
text: T.MEMBER_KEY_GUARD_OPEN
|
|
1216
1278
|
});
|
|
1217
1279
|
} else o.value === "]" && s.pop() === !0 && n.push({
|
|
1218
1280
|
start: o.position,
|
|
@@ -1417,10 +1479,8 @@ ${t}`;
|
|
|
1417
1479
|
const n = this.prepareEvaluator(e, i);
|
|
1418
1480
|
if (!(n.compileFailed || n.evaluator === null))
|
|
1419
1481
|
try {
|
|
1420
|
-
const s = this.
|
|
1421
|
-
|
|
1422
|
-
);
|
|
1423
|
-
return typeof o == "boolean" ? o : void 0;
|
|
1482
|
+
const s = this.runEvaluator(e, n, i);
|
|
1483
|
+
return typeof s == "boolean" ? s : void 0;
|
|
1424
1484
|
} catch {
|
|
1425
1485
|
return;
|
|
1426
1486
|
}
|
|
@@ -1458,7 +1518,8 @@ ${t}`;
|
|
|
1458
1518
|
static evaluateDetailed(e, t = {}) {
|
|
1459
1519
|
if (this.scheduleForbiddenBindingValueCacheReset(), e.trim() === "")
|
|
1460
1520
|
return g.warn("[Haori]", e, "Expression is empty"), { value: null, unresolvedReference: !1 };
|
|
1461
|
-
|
|
1521
|
+
const r = this.getExpressionProfile(e);
|
|
1522
|
+
if (r.dangerous) {
|
|
1462
1523
|
const y = this.detectDisallowedKeywords(e);
|
|
1463
1524
|
if (y.length > 0) {
|
|
1464
1525
|
const E = y.some((A) => A === "function" || A === "return") ? " Statement keywords are not allowed in expressions; use an arrow function such as `x => ({key: value})` instead of `function(x){ return {key: value}; }`." : " These are statement keywords and cannot be used in expressions.";
|
|
@@ -1475,29 +1536,22 @@ ${t}`;
|
|
|
1475
1536
|
);
|
|
1476
1537
|
return { value: null, unresolvedReference: !1 };
|
|
1477
1538
|
}
|
|
1478
|
-
const
|
|
1479
|
-
if (
|
|
1480
|
-
const y =
|
|
1539
|
+
const i = this.collectForbiddenKeys(t);
|
|
1540
|
+
if (i.length > 0) {
|
|
1541
|
+
const y = i.join(",");
|
|
1481
1542
|
this.loggedForbiddenKeySignatures.has(y) || (this.loggedForbiddenKeySignatures.add(y), this.scheduleForbiddenKeyLogReset(), g.error(
|
|
1482
1543
|
"[Haori]",
|
|
1483
|
-
"Binding keys are reserved and ignored: " +
|
|
1544
|
+
"Binding keys are reserved and ignored: " + i.join(", ") + ". These collide with blocked global/prototype names and cannot be used as top-level binding keys; the remaining keys are still evaluated."
|
|
1484
1545
|
));
|
|
1485
1546
|
}
|
|
1486
|
-
const
|
|
1487
|
-
/'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"/g,
|
|
1488
|
-
""
|
|
1489
|
-
), n = this.BUILTIN_DATA_REFERENCE_PATTERN.test(
|
|
1490
|
-
i
|
|
1491
|
-
), s = n ? null : this.getReferencedNames(e);
|
|
1547
|
+
const n = r.referencesBuiltinData, s = n ? null : this.getReferencedNames(e);
|
|
1492
1548
|
if (this.containsForbiddenReferencedValues(t, s))
|
|
1493
1549
|
return g.warn(
|
|
1494
1550
|
"[Haori]",
|
|
1495
1551
|
t,
|
|
1496
1552
|
"Binded values contain forbidden values"
|
|
1497
1553
|
), { value: null, unresolvedReference: !1 };
|
|
1498
|
-
const a =
|
|
1499
|
-
i
|
|
1500
|
-
);
|
|
1554
|
+
const a = r.referencesBuiltins;
|
|
1501
1555
|
a && this.BUILTIN_NAMESPACE in t && g.warn(
|
|
1502
1556
|
"[Haori]",
|
|
1503
1557
|
`Binding key "${this.BUILTIN_NAMESPACE}" is reserved for built-in helpers; the bound value is ignored in expressions.`
|
|
@@ -1509,16 +1563,16 @@ ${t}`;
|
|
|
1509
1563
|
...this.BUILTIN_HELPERS,
|
|
1510
1564
|
[this.BUILTIN_DATA_PROPERTY]: { ...o }
|
|
1511
1565
|
} : o[this.BUILTIN_NAMESPACE] = this.BUILTIN_HELPERS), this.pruneResolvedIdentifiers(o), q.isEnabled() && this.recordSuppliedIdentifiers(o);
|
|
1512
|
-
const l =
|
|
1566
|
+
const l = r.allowMissingIdentifierRecovery, u = this.extractFreeIdentifiers(e).filter(
|
|
1513
1567
|
(y) => !(y in o) && // 禁止グローバルは buildAssignments が `const` で遮蔽するため対象外
|
|
1514
1568
|
// (二重宣言は構文エラーになる)。
|
|
1515
1569
|
!this.FORBIDDEN_NAMES.includes(y) && // 標準組み込み(`Math` など)は式から参照できる仕様のため遮蔽しない。
|
|
1516
1570
|
!this.ALLOWED_GLOBAL_IDENTIFIERS.has(y)
|
|
1517
1571
|
);
|
|
1518
|
-
let
|
|
1572
|
+
let f = null;
|
|
1519
1573
|
if (q.isEnabled()) {
|
|
1520
1574
|
const y = this.extractBoundIdentifiers(e);
|
|
1521
|
-
|
|
1575
|
+
f = y.size === 0 ? u : u.filter((E) => !y.has(E));
|
|
1522
1576
|
}
|
|
1523
1577
|
const m = this.evaluateWithShadowing(
|
|
1524
1578
|
e,
|
|
@@ -1526,12 +1580,12 @@ ${t}`;
|
|
|
1526
1580
|
u,
|
|
1527
1581
|
l
|
|
1528
1582
|
);
|
|
1529
|
-
return
|
|
1583
|
+
return f !== null && this.recordScopeMissingIdentifiers(
|
|
1530
1584
|
typeof m.value == "boolean" ? (
|
|
1531
1585
|
// 判定する式として結論が出た評価では、予約キーが無いのは正常
|
|
1532
1586
|
// (注入より前の状態)なので報告しない(仕様「未解決参照の診断」)。
|
|
1533
|
-
|
|
1534
|
-
) :
|
|
1587
|
+
f.filter((y) => !this.isReservedBindingKey(y))
|
|
1588
|
+
) : f,
|
|
1535
1589
|
e
|
|
1536
1590
|
), m;
|
|
1537
1591
|
}
|
|
@@ -1559,19 +1613,13 @@ ${t}`;
|
|
|
1559
1613
|
if (a.compileFailed || a.evaluator === null)
|
|
1560
1614
|
return { value: null, unresolvedReference: !1 };
|
|
1561
1615
|
try {
|
|
1562
|
-
const o =
|
|
1563
|
-
|
|
1564
|
-
o
|
|
1565
|
-
});
|
|
1566
|
-
const u = this.withBlockedPropertyAccess(
|
|
1567
|
-
() => a.evaluator(...o)
|
|
1568
|
-
);
|
|
1569
|
-
return u === void 0 && this.warnBlockedIdentifiers(e), {
|
|
1570
|
-
value: u,
|
|
1616
|
+
const o = this.runEvaluator(e, a, t);
|
|
1617
|
+
return o === void 0 && this.warnBlockedIdentifiers(e), {
|
|
1618
|
+
value: o,
|
|
1571
1619
|
// `undefined` になる参照は「値が無い」状態であり、未解決参照として扱う。
|
|
1572
1620
|
// 暗黙のオプショナルチェーンにより、`null` / `undefined` を経由した
|
|
1573
1621
|
// メンバーアクセスもここへ集約される。
|
|
1574
|
-
unresolvedReference:
|
|
1622
|
+
unresolvedReference: o === void 0
|
|
1575
1623
|
};
|
|
1576
1624
|
} catch (o) {
|
|
1577
1625
|
if (i && o instanceof ReferenceError) {
|
|
@@ -1602,6 +1650,78 @@ ${t}`;
|
|
|
1602
1650
|
t
|
|
1603
1651
|
), { value: void 0, unresolvedReference: !0 };
|
|
1604
1652
|
}
|
|
1653
|
+
/**
|
|
1654
|
+
* 式の文字列だけで決まる判定を返します(式ごとに一度だけ求めて控えます)。
|
|
1655
|
+
*
|
|
1656
|
+
* @param expression 評価する式
|
|
1657
|
+
* @returns 式の判定
|
|
1658
|
+
*/
|
|
1659
|
+
static getExpressionProfile(e) {
|
|
1660
|
+
const t = this.PROFILE_CACHE.get(e);
|
|
1661
|
+
if (t !== void 0)
|
|
1662
|
+
return t;
|
|
1663
|
+
const r = e.replace(
|
|
1664
|
+
/'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"/g,
|
|
1665
|
+
""
|
|
1666
|
+
), i = {
|
|
1667
|
+
dangerous: this.containsDangerousPatterns(e),
|
|
1668
|
+
referencesBuiltins: this.BUILTIN_REFERENCE_PATTERN.test(
|
|
1669
|
+
r
|
|
1670
|
+
),
|
|
1671
|
+
referencesBuiltinData: this.BUILTIN_DATA_REFERENCE_PATTERN.test(
|
|
1672
|
+
r
|
|
1673
|
+
),
|
|
1674
|
+
allowMissingIdentifierRecovery: this.canAttemptMissingIdentifierRecovery(e),
|
|
1675
|
+
needsPropertyBlocking: this.needsPropertyBlocking(e),
|
|
1676
|
+
parameterCandidates: [...new Set(this.getReferencedNames(e))]
|
|
1677
|
+
};
|
|
1678
|
+
return this.PROFILE_CACHE.set(e, i), i;
|
|
1679
|
+
}
|
|
1680
|
+
/**
|
|
1681
|
+
* 評価中に prototype 系プロパティの生アクセスを遮断する必要がある式かを返します。
|
|
1682
|
+
*
|
|
1683
|
+
* 遮断(`withBlockedPropertyAccess()`)が守るのは、式の外のコード(標準組み込みの
|
|
1684
|
+
* メソッドなど)が評価中に `constructor` や `__proto__` を読む経路です。式に書いた
|
|
1685
|
+
* メンバーアクセスは、構文の検証・Proxy・計算プロパティ名の検査が遮断します。
|
|
1686
|
+
* 式の外のコードが `constructor` などを読むのは、`map` などの標準組み込みの
|
|
1687
|
+
* メソッドを呼んだときです(`new` とテンプレートリテラルは書けません)。
|
|
1688
|
+
* スプレッドも反復のメソッドを呼ぶため含めます。どちらも無い式は遮断しても
|
|
1689
|
+
* 結果が変わらないため、評価のたびに `Object.prototype` と `Function.prototype`
|
|
1690
|
+
* を書き換えません。
|
|
1691
|
+
*
|
|
1692
|
+
* 呼び出しは、`(` の直前が識別子・`)`・`]`・`?.` のときとみなします。
|
|
1693
|
+
* `startsCall()` と違い `undefined` などの直後も呼び出しに数えます(同名の
|
|
1694
|
+
* バインドキーに関数を渡せるためです)。
|
|
1695
|
+
*
|
|
1696
|
+
* 字句に分けられない式は `false` を返しますが、そうした式は許可構文の検証
|
|
1697
|
+
* (`hasAllowedSyntax()`)で拒否されるため評価されません。
|
|
1698
|
+
*
|
|
1699
|
+
* @param expression 評価する式
|
|
1700
|
+
* @returns 遮断が必要であれば true
|
|
1701
|
+
*/
|
|
1702
|
+
static needsPropertyBlocking(e) {
|
|
1703
|
+
let t = null;
|
|
1704
|
+
for (const r of this.tokenizeExpression(e) ?? []) {
|
|
1705
|
+
if (r.value === "..." || r.value === "(" && t !== null && (t.type === "identifier" || [")", "]", "?."].includes(t.value)))
|
|
1706
|
+
return !0;
|
|
1707
|
+
t = r;
|
|
1708
|
+
}
|
|
1709
|
+
return !1;
|
|
1710
|
+
}
|
|
1711
|
+
/**
|
|
1712
|
+
* 引数の値を Proxy でラップし、評価関数を実行します。
|
|
1713
|
+
*
|
|
1714
|
+
* @param expression 評価する式
|
|
1715
|
+
* @param setup 評価関数の準備結果(評価関数があること)
|
|
1716
|
+
* @param bindings 評価に用いるバインド値
|
|
1717
|
+
* @returns 評価結果
|
|
1718
|
+
*/
|
|
1719
|
+
static runEvaluator(e, t, r) {
|
|
1720
|
+
const i = /* @__PURE__ */ new WeakMap(), n = t.bindKeys.map(
|
|
1721
|
+
(a) => this.wrapBoundValue(r[a], i)
|
|
1722
|
+
), s = () => t.evaluator.call(this.BUILTIN_HOLDER, ...n);
|
|
1723
|
+
return this.getExpressionProfile(e).needsPropertyBlocking ? this.withBlockedPropertyAccess(s) : s();
|
|
1724
|
+
}
|
|
1605
1725
|
/**
|
|
1606
1726
|
* 現在のバインド集合で evaluator を取得または生成します。
|
|
1607
1727
|
*
|
|
@@ -1611,41 +1731,42 @@ ${t}`;
|
|
|
1611
1731
|
* @returns evaluator 準備結果
|
|
1612
1732
|
*/
|
|
1613
1733
|
static prepareEvaluator(e, t, r = []) {
|
|
1614
|
-
const i =
|
|
1615
|
-
|
|
1616
|
-
)
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1734
|
+
const i = this.getExpressionProfile(
|
|
1735
|
+
e
|
|
1736
|
+
).parameterCandidates.filter(
|
|
1737
|
+
(E) => Object.prototype.propertyIsEnumerable.call(t, E) && !this.FORBIDDEN_BINDING_NAMES.has(E)
|
|
1738
|
+
);
|
|
1739
|
+
q.isEnabled() && this.reportUnusableBindingKeys(
|
|
1740
|
+
Object.keys(t).filter((E) => !this.isUsableBindingKey(E))
|
|
1741
|
+
);
|
|
1742
|
+
const n = new Set(i), s = r.filter((E) => !n.has(E)), a = `${e}:${i.join(",")}:${s.join(
|
|
1621
1743
|
","
|
|
1622
1744
|
)}`;
|
|
1623
|
-
let
|
|
1624
|
-
if (
|
|
1745
|
+
let o = this.EXPRESSION_CACHE.get(a) || null;
|
|
1746
|
+
if (o !== null)
|
|
1625
1747
|
return this.compileFailedExpressions.delete(e), {
|
|
1626
|
-
bindKeys:
|
|
1627
|
-
evaluator:
|
|
1748
|
+
bindKeys: i,
|
|
1749
|
+
evaluator: o,
|
|
1628
1750
|
compileFailed: !1
|
|
1629
1751
|
};
|
|
1630
|
-
const
|
|
1752
|
+
const l = this.buildAssignments(i), u = this.buildBuiltinConstants(e, n), f = this.buildShadowDeclarations(s), m = this.toGuardedMemberExpression(
|
|
1631
1753
|
this.toOptionalChainExpression(e)
|
|
1632
|
-
),
|
|
1633
|
-
${
|
|
1634
|
-
return (${
|
|
1635
|
-
return (${y});${m}`;
|
|
1754
|
+
), y = `"use strict";
|
|
1755
|
+
${l};
|
|
1756
|
+
${u}return (${m});` + f;
|
|
1636
1757
|
try {
|
|
1637
|
-
return
|
|
1638
|
-
bindKeys:
|
|
1639
|
-
evaluator:
|
|
1758
|
+
return o = new Function(...i, y), this.EXPRESSION_CACHE.set(a, o), this.compileFailedExpressions.delete(e), {
|
|
1759
|
+
bindKeys: i,
|
|
1760
|
+
evaluator: o,
|
|
1640
1761
|
compileFailed: !1
|
|
1641
1762
|
};
|
|
1642
|
-
} catch (
|
|
1643
|
-
return
|
|
1763
|
+
} catch (E) {
|
|
1764
|
+
return s.length > 0 ? (g.warn(
|
|
1644
1765
|
"[Haori]",
|
|
1645
|
-
"Failed to shadow undeclared identifier(s): " +
|
|
1766
|
+
"Failed to shadow undeclared identifier(s): " + s.join(", ") + ". Falling back to evaluation without shadowing.",
|
|
1646
1767
|
e
|
|
1647
|
-
), this.prepareEvaluator(e, t, [])) : (g.error("[Haori]", "Failed to compile expression:", e,
|
|
1648
|
-
bindKeys:
|
|
1768
|
+
), this.prepareEvaluator(e, t, [])) : (g.error("[Haori]", "Failed to compile expression:", e, E), this.compileFailedExpressions.add(e), {
|
|
1769
|
+
bindKeys: i,
|
|
1649
1770
|
evaluator: null,
|
|
1650
1771
|
compileFailed: !0
|
|
1651
1772
|
});
|
|
@@ -1760,8 +1881,8 @@ return (${y});${m}`;
|
|
|
1760
1881
|
break;
|
|
1761
1882
|
}
|
|
1762
1883
|
case "[": {
|
|
1763
|
-
const
|
|
1764
|
-
r.push(
|
|
1884
|
+
const f = this.startsMemberAccess(i) ? "member" : "array";
|
|
1885
|
+
r.push(f);
|
|
1765
1886
|
break;
|
|
1766
1887
|
}
|
|
1767
1888
|
case "{":
|
|
@@ -1806,20 +1927,20 @@ return (${y});${m}`;
|
|
|
1806
1927
|
* @returns 食い違っている場合は両辺の型。該当しない場合は null
|
|
1807
1928
|
*/
|
|
1808
1929
|
static diagnoseStrictComparison(e, t = {}) {
|
|
1809
|
-
const r =
|
|
1930
|
+
const r = T.splitStrictComparison(e);
|
|
1810
1931
|
if (r === null)
|
|
1811
1932
|
return null;
|
|
1812
|
-
|
|
1933
|
+
T.evaluatingForDiagnosis = !0;
|
|
1813
1934
|
let i, n;
|
|
1814
1935
|
try {
|
|
1815
|
-
i =
|
|
1936
|
+
i = T.evaluateDetailed(r.left, t), n = T.evaluateDetailed(r.right, t);
|
|
1816
1937
|
} finally {
|
|
1817
|
-
|
|
1938
|
+
T.evaluatingForDiagnosis = !1;
|
|
1818
1939
|
}
|
|
1819
1940
|
if (i.unresolvedReference || n.unresolvedReference)
|
|
1820
1941
|
return null;
|
|
1821
1942
|
const s = i.value, a = n.value;
|
|
1822
|
-
return typeof s == typeof a || !
|
|
1943
|
+
return typeof s == typeof a || !T.isLooselyEqual(s, a) ? null : { left: typeof s, right: typeof a };
|
|
1823
1944
|
}
|
|
1824
1945
|
/**
|
|
1825
1946
|
* 型をまたいだ緩い比較(`==`)を行います。
|
|
@@ -1846,11 +1967,11 @@ return (${y});${m}`;
|
|
|
1846
1967
|
* @returns 左辺と右辺。単一の厳密比較でない場合は null
|
|
1847
1968
|
*/
|
|
1848
1969
|
static splitStrictComparison(e) {
|
|
1849
|
-
const t =
|
|
1970
|
+
const t = T.strictComparisonSplits.get(e);
|
|
1850
1971
|
if (t !== void 0)
|
|
1851
1972
|
return t;
|
|
1852
|
-
const r =
|
|
1853
|
-
return
|
|
1973
|
+
const r = T.computeStrictComparisonSplit(e);
|
|
1974
|
+
return T.strictComparisonSplits.set(e, r), r;
|
|
1854
1975
|
}
|
|
1855
1976
|
/**
|
|
1856
1977
|
* 式を単一の厳密比較として分割します(記憶しない実体)。
|
|
@@ -1859,7 +1980,7 @@ return (${y});${m}`;
|
|
|
1859
1980
|
* @returns 左辺と右辺。単一の厳密比較でない場合は null
|
|
1860
1981
|
*/
|
|
1861
1982
|
static computeStrictComparisonSplit(e) {
|
|
1862
|
-
const t =
|
|
1983
|
+
const t = T.tokenizeExpression(e);
|
|
1863
1984
|
if (t === null)
|
|
1864
1985
|
return null;
|
|
1865
1986
|
let r = 0, i = null;
|
|
@@ -1875,7 +1996,7 @@ return (${y});${m}`;
|
|
|
1875
1996
|
}
|
|
1876
1997
|
if (r === 0) {
|
|
1877
1998
|
if (a.value === "&&")
|
|
1878
|
-
return
|
|
1999
|
+
return T.splitStrictComparison(
|
|
1879
2000
|
e.slice(0, a.position)
|
|
1880
2001
|
);
|
|
1881
2002
|
if (a.value === "===") {
|
|
@@ -1884,7 +2005,7 @@ return (${y});${m}`;
|
|
|
1884
2005
|
i = a;
|
|
1885
2006
|
continue;
|
|
1886
2007
|
}
|
|
1887
|
-
if (
|
|
2008
|
+
if (T.COMPOSING_OPERATORS.has(a.value))
|
|
1888
2009
|
return null;
|
|
1889
2010
|
}
|
|
1890
2011
|
}
|
|
@@ -2183,18 +2304,6 @@ return (${y});${m}`;
|
|
|
2183
2304
|
}
|
|
2184
2305
|
});
|
|
2185
2306
|
}
|
|
2186
|
-
/**
|
|
2187
|
-
* バインド値を安全なProxyでラップします。
|
|
2188
|
-
*
|
|
2189
|
-
* @param bindedValues バインド値
|
|
2190
|
-
* @returns ラップ済みのバインド値
|
|
2191
|
-
*/
|
|
2192
|
-
static wrapBoundValues(e) {
|
|
2193
|
-
const t = /* @__PURE__ */ new WeakMap(), r = {};
|
|
2194
|
-
return Object.entries(e).forEach(([i, n]) => {
|
|
2195
|
-
r[i] = this.wrapBoundValue(n, t);
|
|
2196
|
-
}), r;
|
|
2197
|
-
}
|
|
2198
2307
|
/**
|
|
2199
2308
|
* 危険なプロパティアクセスを防ぐために値を再帰的にラップします。
|
|
2200
2309
|
*
|
|
@@ -2427,9 +2536,9 @@ return (${y});${m}`;
|
|
|
2427
2536
|
return a.cut ? (i && (i.cut = !0), !1) : (this.forbiddenBindingValueCache.set(e, !1), !1);
|
|
2428
2537
|
}
|
|
2429
2538
|
};
|
|
2430
|
-
|
|
2431
|
-
...
|
|
2432
|
-
},
|
|
2539
|
+
T.MAX_IDENTIFIER_RECOVERY_COUNT = 8, T.BUILTIN_NAMESPACE = "haori", T.BUILTIN_HELPERS = {
|
|
2540
|
+
...Ct
|
|
2541
|
+
}, T.BUILTIN_REFERENCE_PATTERN = /(^|[^\w$.])haori(?![\w$])/, T.BUILTIN_DATA_PROPERTY = "data", T.BUILTIN_DATA_REFERENCE_PATTERN = /(^|[^\w$.])haori\s*(\.\s*data(?![\w$])|\[)/, T.IDENTIFIER_NAME_PATTERN = /^[\p{ID_Start}$_][\p{ID_Continue}$\u200C\u200D]*$/u, T.usableBindingKeyCache = /* @__PURE__ */ new Map(), T.loggedUnusableBindingKeys = /* @__PURE__ */ new Set(), T.compileFailedExpressions = /* @__PURE__ */ new Set(), T.forbiddenBindingValueCache = /* @__PURE__ */ new WeakMap(), T.forbiddenBindingValueSet = null, T.forbiddenBindingValueCacheResetScheduled = !1, T.loggedForbiddenKeySignatures = /* @__PURE__ */ new Set(), T.loggedForbiddenKeyResetScheduled = !1, T.FORBIDDEN_NAMES = [
|
|
2433
2542
|
// グローバルオブジェクト
|
|
2434
2543
|
"window",
|
|
2435
2544
|
"self",
|
|
@@ -2461,7 +2570,7 @@ D.MAX_IDENTIFIER_RECOVERY_COUNT = 8, D.BUILTIN_NAMESPACE = "haori", D.BUILTIN_HE
|
|
|
2461
2570
|
"sessionStorage",
|
|
2462
2571
|
"IndexedDB",
|
|
2463
2572
|
"history"
|
|
2464
|
-
],
|
|
2573
|
+
], T.STRICT_FORBIDDEN_NAMES = ["eval", "arguments"], T.REBINDABLE_FORBIDDEN_NAMES = /* @__PURE__ */ new Set([
|
|
2465
2574
|
"location",
|
|
2466
2575
|
"history",
|
|
2467
2576
|
"document",
|
|
@@ -2469,23 +2578,23 @@ D.MAX_IDENTIFIER_RECOVERY_COUNT = 8, D.BUILTIN_NAMESPACE = "haori", D.BUILTIN_HE
|
|
|
2469
2578
|
"localStorage",
|
|
2470
2579
|
"sessionStorage",
|
|
2471
2580
|
"IndexedDB"
|
|
2472
|
-
]),
|
|
2473
|
-
...
|
|
2474
|
-
(e) => !
|
|
2581
|
+
]), T.FORBIDDEN_BINDING_NAMES = /* @__PURE__ */ new Set([
|
|
2582
|
+
...T.FORBIDDEN_NAMES.filter(
|
|
2583
|
+
(e) => !T.REBINDABLE_FORBIDDEN_NAMES.has(e)
|
|
2475
2584
|
),
|
|
2476
2585
|
"constructor",
|
|
2477
2586
|
"__proto__",
|
|
2478
2587
|
"prototype",
|
|
2479
|
-
...
|
|
2480
|
-
]),
|
|
2588
|
+
...T.STRICT_FORBIDDEN_NAMES
|
|
2589
|
+
]), T.FORBIDDEN_PROPERTY_NAMES = /* @__PURE__ */ new Set([
|
|
2481
2590
|
"constructor",
|
|
2482
2591
|
"__proto__",
|
|
2483
2592
|
"prototype"
|
|
2484
|
-
]),
|
|
2593
|
+
]), T.OBJECT_PROPERTY_MODIFIERS = /* @__PURE__ */ new Set([
|
|
2485
2594
|
"get",
|
|
2486
2595
|
"set",
|
|
2487
2596
|
"async"
|
|
2488
|
-
]),
|
|
2597
|
+
]), T.DISALLOWED_KEYWORDS = /* @__PURE__ */ new Set([
|
|
2489
2598
|
"await",
|
|
2490
2599
|
"break",
|
|
2491
2600
|
"case",
|
|
@@ -2519,7 +2628,7 @@ D.MAX_IDENTIFIER_RECOVERY_COUNT = 8, D.BUILTIN_NAMESPACE = "haori", D.BUILTIN_HE
|
|
|
2519
2628
|
"while",
|
|
2520
2629
|
"with",
|
|
2521
2630
|
"yield"
|
|
2522
|
-
]),
|
|
2631
|
+
]), T.NON_SHADOWABLE_IDENTIFIERS = /* @__PURE__ */ new Set([
|
|
2523
2632
|
// リテラル・グローバル定数
|
|
2524
2633
|
"true",
|
|
2525
2634
|
"false",
|
|
@@ -2537,7 +2646,7 @@ D.MAX_IDENTIFIER_RECOVERY_COUNT = 8, D.BUILTIN_NAMESPACE = "haori", D.BUILTIN_HE
|
|
|
2537
2646
|
"public",
|
|
2538
2647
|
"static",
|
|
2539
2648
|
"super"
|
|
2540
|
-
]),
|
|
2649
|
+
]), T.ALLOWED_GLOBAL_IDENTIFIERS = /* @__PURE__ */ new Set([
|
|
2541
2650
|
// 名前空間オブジェクト
|
|
2542
2651
|
"Math",
|
|
2543
2652
|
"JSON",
|
|
@@ -2593,10 +2702,23 @@ D.MAX_IDENTIFIER_RECOVERY_COUNT = 8, D.BUILTIN_NAMESPACE = "haori", D.BUILTIN_HE
|
|
|
2593
2702
|
"encodeURIComponent",
|
|
2594
2703
|
"decodeURI",
|
|
2595
2704
|
"decodeURIComponent"
|
|
2596
|
-
]),
|
|
2705
|
+
]), T.BUILTIN_HOLDER = Object.freeze(
|
|
2706
|
+
Object.defineProperties(
|
|
2707
|
+
{},
|
|
2708
|
+
Object.fromEntries(
|
|
2709
|
+
[...T.ALLOWED_GLOBAL_IDENTIFIERS].map((e) => [
|
|
2710
|
+
e,
|
|
2711
|
+
{
|
|
2712
|
+
get: () => globalThis[e],
|
|
2713
|
+
enumerable: !0
|
|
2714
|
+
}
|
|
2715
|
+
])
|
|
2716
|
+
)
|
|
2717
|
+
)
|
|
2718
|
+
), T.EXPRESSION_CACHE = /* @__PURE__ */ new Map(), T.FREE_IDENTIFIER_CACHE = /* @__PURE__ */ new Map(), T.ALLOWED_SYNTAX_CACHE = /* @__PURE__ */ new Map(), T.REFERENCED_NAME_CACHE = /* @__PURE__ */ new Map(), T.PROFILE_CACHE = /* @__PURE__ */ new Map(), T.BOUND_IDENTIFIER_CACHE = /* @__PURE__ */ new Map(), T.OPTIONAL_CHAIN_CACHE = /* @__PURE__ */ new Map(), T.GUARDED_MEMBER_CACHE = /* @__PURE__ */ new Map(), T.MEMBER_KEY_GUARD_OPEN = "(_hk=>(_hk=typeof _hk==='symbol'?_hk:`${_hk}`)==='constructor'||_hk==='__proto__'||_hk==='prototype'?undefined:_hk)(", T.FORBIDDEN_NAME_PATTERNS = T.FORBIDDEN_NAMES.map((e) => ({
|
|
2597
2719
|
name: e,
|
|
2598
2720
|
pattern: new RegExp(`(^|[^\\w$.])${e}(?![\\w$])`)
|
|
2599
|
-
})),
|
|
2721
|
+
})), T.FORBIDDEN_IDENTIFIER_CACHE = /* @__PURE__ */ new Map(), T.pendingUnresolvedIdentifiers = /* @__PURE__ */ new Set(), T.evaluatingForDiagnosis = !1, T.unresolvedReportScheduled = !1, T.suppliedIdentifiers = /* @__PURE__ */ new Set(), T.pendingScopeMissingIdentifiers = /* @__PURE__ */ new Map(), T.scopeMissingReportScheduled = !1, T.rowScopeIdentifiers = /* @__PURE__ */ new Set(), T.loggedScopeMissingIdentifiers = /* @__PURE__ */ new Set(), T.loggedBlockedIdentifierExpressions = /* @__PURE__ */ new Set(), T.COMPOSING_OPERATORS = /* @__PURE__ */ new Set([
|
|
2600
2722
|
"||",
|
|
2601
2723
|
"?",
|
|
2602
2724
|
":",
|
|
@@ -2615,8 +2737,8 @@ D.MAX_IDENTIFIER_RECOVERY_COUNT = 8, D.BUILTIN_NAMESPACE = "haori", D.BUILTIN_HE
|
|
|
2615
2737
|
"/",
|
|
2616
2738
|
"%",
|
|
2617
2739
|
"..."
|
|
2618
|
-
]),
|
|
2619
|
-
let ie =
|
|
2740
|
+
]), T.strictComparisonSplits = /* @__PURE__ */ new Map(), T.WRAPPED_VALUES = /* @__PURE__ */ new WeakSet();
|
|
2741
|
+
let ie = T;
|
|
2620
2742
|
class De {
|
|
2621
2743
|
/**
|
|
2622
2744
|
* URLのクエリパラメータを取得します。
|
|
@@ -2781,26 +2903,26 @@ const pe = "data-haori-if-disabled", Qe = "input, select, textarea, button, fiel
|
|
|
2781
2903
|
static report(e = L.DEFAULT_REPORT_LIMIT) {
|
|
2782
2904
|
const t = /* @__PURE__ */ new Map();
|
|
2783
2905
|
let r = 0, i = 0;
|
|
2784
|
-
const n = (l, u,
|
|
2785
|
-
r +=
|
|
2906
|
+
const n = (l, u, f) => {
|
|
2907
|
+
r += f.totalDurationMs, i += f.calls;
|
|
2786
2908
|
const m = t.get(l);
|
|
2787
2909
|
if (m === void 0) {
|
|
2788
2910
|
t.set(l, {
|
|
2789
2911
|
where: u,
|
|
2790
|
-
template:
|
|
2912
|
+
template: f.template,
|
|
2791
2913
|
elements: 1,
|
|
2792
|
-
calls:
|
|
2793
|
-
totalDurationMs:
|
|
2794
|
-
maxDurationMs:
|
|
2914
|
+
calls: f.calls,
|
|
2915
|
+
totalDurationMs: f.totalDurationMs,
|
|
2916
|
+
maxDurationMs: f.maxDurationMs,
|
|
2795
2917
|
sharePercent: 0,
|
|
2796
|
-
representativeDurationMs:
|
|
2918
|
+
representativeDurationMs: f.totalDurationMs
|
|
2797
2919
|
});
|
|
2798
2920
|
return;
|
|
2799
2921
|
}
|
|
2800
|
-
m.elements += 1, m.calls +=
|
|
2922
|
+
m.elements += 1, m.calls += f.calls, m.totalDurationMs += f.totalDurationMs, m.maxDurationMs = Math.max(
|
|
2801
2923
|
m.maxDurationMs,
|
|
2802
|
-
|
|
2803
|
-
),
|
|
2924
|
+
f.maxDurationMs
|
|
2925
|
+
), f.totalDurationMs > m.representativeDurationMs && (m.where = u, m.representativeDurationMs = f.totalDurationMs);
|
|
2804
2926
|
};
|
|
2805
2927
|
L.snapshot().forEach((l) => {
|
|
2806
2928
|
l.attributes.forEach((u) => {
|
|
@@ -3061,7 +3183,7 @@ const ue = class ue {
|
|
|
3061
3183
|
let t;
|
|
3062
3184
|
switch (e.nodeType) {
|
|
3063
3185
|
case Node.ELEMENT_NODE:
|
|
3064
|
-
t = new
|
|
3186
|
+
t = new w(e);
|
|
3065
3187
|
break;
|
|
3066
3188
|
case Node.TEXT_NODE:
|
|
3067
3189
|
t = new ne(e);
|
|
@@ -4788,11 +4910,11 @@ const v = class v extends N {
|
|
|
4788
4910
|
if (n) {
|
|
4789
4911
|
const le = this.attributeMap.get(e);
|
|
4790
4912
|
if (le && (le.isEvaluate || le.isForceEvaluation()) && !o.isEvaluate && !o.isForceEvaluation()) {
|
|
4791
|
-
const
|
|
4913
|
+
const he = z.enqueue(() => {
|
|
4792
4914
|
}).finally(() => {
|
|
4793
4915
|
this.releaseSelfWritingAttributes(s);
|
|
4794
4916
|
});
|
|
4795
|
-
return this.holdSelfWritingAttributes(s,
|
|
4917
|
+
return this.holdSelfWritingAttributes(s, he), he;
|
|
4796
4918
|
}
|
|
4797
4919
|
}
|
|
4798
4920
|
this.attributeMap.set(e, o);
|
|
@@ -4801,49 +4923,49 @@ const v = class v extends N {
|
|
|
4801
4923
|
element: l,
|
|
4802
4924
|
rawName: e,
|
|
4803
4925
|
template: r
|
|
4804
|
-
}),
|
|
4926
|
+
}), f = o.isEvaluate || o.isRawEvaluate, m = e === t && v.BOOLEAN_ATTRIBUTES.has(t.toLowerCase()), y = o.isSingleExpression(), E = de.joinEvaluateResults(u.results), A = u.results.length === 1 ? u.results[0] : E, D = t === "value" && v.resolveDeclaredValueType(l) === "boolean", C = A === !1 && !D, P = !o.isForceEvaluation() && (t !== e ? u.hasUnresolvedReference || A === null || A === void 0 || C : m ? u.hasUnresolvedReference || A === null || A === void 0 || A === !1 : y ? u.hasUnresolvedReference || A === null || A === void 0 || C : f && E === "");
|
|
4805
4927
|
if (P && u.hasUnresolvedReference && v.warnUnresolvedAttribute(
|
|
4806
4928
|
e,
|
|
4807
4929
|
t,
|
|
4808
4930
|
r,
|
|
4809
4931
|
l
|
|
4810
4932
|
), q.isEnabled() && A === !1 && y) {
|
|
4811
|
-
const le = o.getSingleExpression(),
|
|
4933
|
+
const le = o.getSingleExpression(), he = le === null ? null : ie.diagnoseStrictComparison(
|
|
4812
4934
|
le,
|
|
4813
4935
|
this.getBindingData()
|
|
4814
4936
|
);
|
|
4815
|
-
|
|
4937
|
+
he !== null && v.warnTypeMismatchedComparison(
|
|
4816
4938
|
e,
|
|
4817
4939
|
r,
|
|
4818
|
-
|
|
4940
|
+
he,
|
|
4819
4941
|
l
|
|
4820
4942
|
);
|
|
4821
4943
|
}
|
|
4822
|
-
const ee = o.isForceEvaluation() ? r : y ? A : E, x = i && o.isEvaluate && t === "value" && v.isValuePropertyTarget(l), Y = l.getRootNode(), Q = this.userEditSequence, X = x && v.isUserEditableValue(l) && (l === Y.activeElement || this.hasPendingUserEdit()), j = P || ee === null || ee === !1 && !
|
|
4944
|
+
const ee = o.isForceEvaluation() ? r : y ? A : E, x = i && o.isEvaluate && t === "value" && v.isValuePropertyTarget(l), Y = l.getRootNode(), Q = this.userEditSequence, X = x && v.isUserEditableValue(l) && (l === Y.activeElement || this.hasPendingUserEdit()), j = P || ee === null || ee === !1 && !D ? null : String(ee), se = o.isEvaluate && j !== null && v.URL_ATTRIBUTES.has(t) && De.hasScriptScheme(j);
|
|
4823
4945
|
se && g.warn(
|
|
4824
4946
|
"[Haori]",
|
|
4825
4947
|
`Attribute "${t}" was removed because the evaluated URL uses a script scheme: ${e}="${r}" -> ${j}`,
|
|
4826
4948
|
l
|
|
4827
4949
|
);
|
|
4828
|
-
const R = se ? null : j, $ = e !== t && l.getAttribute(e) !== r, K = R === null ? l.hasAttribute(t) : l.getAttribute(t) !== R, _ = R === null ? "" : R, be = x && !X && l.value !== _, oe = t === "checked" && l instanceof HTMLInputElement && (l.type === "checkbox" || l.type === "radio"),
|
|
4829
|
-
if (!$ && !K && !be && !Ve && !
|
|
4950
|
+
const R = se ? null : j, $ = e !== t && l.getAttribute(e) !== r, K = R === null ? l.hasAttribute(t) : l.getAttribute(t) !== R, _ = R === null ? "" : R, be = x && !X && l.value !== _, oe = t === "checked" && l instanceof HTMLInputElement && (l.type === "checkbox" || l.type === "radio"), H = t === "selected" && l instanceof HTMLOptionElement, G = Y.activeElement, Z = G !== null && (oe && l === G || H && l.closest("select") === G) || (oe || H) && this.hasPendingCheckableUserEdit(H), Ie = this.getCheckableUserEditSequence(H), xe = R !== null, Ve = oe && o.isEvaluate && !Z && l.checked !== xe, Ce = H && o.isEvaluate && !Z && l.selected !== xe;
|
|
4951
|
+
if (!$ && !K && !be && !Ve && !Ce)
|
|
4830
4952
|
return x && !X && (this.value = this.normalizeValueForElement(
|
|
4831
4953
|
l,
|
|
4832
4954
|
_
|
|
4833
|
-
), this.clearUnappliedValueWrite()), (oe ||
|
|
4955
|
+
), this.clearUnappliedValueWrite()), (oe || H) && !Z && this.syncCheckableValueFromDom(H), Promise.resolve();
|
|
4834
4956
|
const Xe = z.enqueue(() => {
|
|
4835
|
-
const le = this.getCheckableUserEditSequence(
|
|
4957
|
+
const le = this.getCheckableUserEditSequence(H) !== Ie, he = H && (Z || le) ? v.captureSelection(
|
|
4836
4958
|
// 守るべき選択があるのは所属する `<select>` があるときだけ。
|
|
4837
4959
|
l.closest(
|
|
4838
4960
|
"select"
|
|
4839
4961
|
)
|
|
4840
4962
|
) : null;
|
|
4841
|
-
$ && l.setAttribute(e, r), R === null ? l.removeAttribute(t) : K && (l.setAttribute(t, R), t === `${c.prefix}bind` && this.recordSelfWrittenBind(R)), t === "style" && this.captureAndHideDisplay(),
|
|
4963
|
+
$ && l.setAttribute(e, r), R === null ? l.removeAttribute(t) : K && (l.setAttribute(t, R), t === `${c.prefix}bind` && this.recordSelfWrittenBind(R)), t === "style" && this.captureAndHideDisplay(), he?.(), x && !X && !(v.isUserEditableValue(l) && this.isSupersededByUserEdit(Q)) && (this.value = this.normalizeValueForElement(
|
|
4842
4964
|
l,
|
|
4843
4965
|
_
|
|
4844
4966
|
), be && (l.value = _), this.recordValueWriteResult(l.value === _));
|
|
4845
|
-
const
|
|
4846
|
-
|
|
4967
|
+
const wt = Ve && !le, Rt = Ce && !le;
|
|
4968
|
+
wt && (l.checked = xe), Rt && (l.selected = xe), (Ve || Ce) && this.syncCheckableValueFromDom(Ce);
|
|
4847
4969
|
}).finally(() => {
|
|
4848
4970
|
this.releaseSelfWritingAttributes(s);
|
|
4849
4971
|
});
|
|
@@ -5342,7 +5464,7 @@ v.NUMBER_INPUT_PATTERN = /^-?(?:\d+(?:\.\d+)?|\.\d+)(?:[eE][+-]?\d+)?$/, v.VALUE
|
|
|
5342
5464
|
"time",
|
|
5343
5465
|
"week"
|
|
5344
5466
|
], 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();
|
|
5345
|
-
let
|
|
5467
|
+
let w = v;
|
|
5346
5468
|
class ne extends N {
|
|
5347
5469
|
/**
|
|
5348
5470
|
* テキストフラグメントのコンストラクタ。
|
|
@@ -5591,11 +5713,11 @@ const Be = class Be {
|
|
|
5591
5713
|
if (r(l)) {
|
|
5592
5714
|
const u = Le.measure(
|
|
5593
5715
|
() => ie.evaluateDetailed(l.text, e)
|
|
5594
|
-
),
|
|
5716
|
+
), f = u.value;
|
|
5595
5717
|
a += u.durationMs, s.push({
|
|
5596
5718
|
expression: l.text,
|
|
5597
5719
|
durationMs: u.durationMs
|
|
5598
|
-
}), o = o ||
|
|
5720
|
+
}), o = o || f.unresolvedReference, n.push(f.value);
|
|
5599
5721
|
} else
|
|
5600
5722
|
n.push(l.text);
|
|
5601
5723
|
} catch (u) {
|
|
@@ -5766,7 +5888,7 @@ const J = class J extends de {
|
|
|
5766
5888
|
};
|
|
5767
5889
|
J.FORCE_EVALUATION_SUFFIXES = ["if", "each", "derive"], J.FORCE_EVALUATION_PREFIXES = ["data-", "hor-"], J.forceEvaluationNames = null, J.forceEvaluationPrefix = null, J.WARNED_EVENT_HANDLER_PLACEHOLDERS = /* @__PURE__ */ new Set(), J.WARNED_URL_PATH_VALUES = /* @__PURE__ */ new Set();
|
|
5768
5890
|
let Oe = J;
|
|
5769
|
-
const
|
|
5891
|
+
const Se = class Se {
|
|
5770
5892
|
/**
|
|
5771
5893
|
* 実行モードを取得します。
|
|
5772
5894
|
*
|
|
@@ -5842,7 +5964,7 @@ const we = class we {
|
|
|
5842
5964
|
*/
|
|
5843
5965
|
static openDialog(e) {
|
|
5844
5966
|
return z.enqueue(() => {
|
|
5845
|
-
e instanceof HTMLDialogElement ? (
|
|
5967
|
+
e instanceof HTMLDialogElement ? (Se.clearMessagesSync(e), e.showModal()) : g.error("[Haori]", "Element is not a dialog: ", e);
|
|
5846
5968
|
}, !0);
|
|
5847
5969
|
}
|
|
5848
5970
|
/**
|
|
@@ -5862,7 +5984,7 @@ const we = class we {
|
|
|
5862
5984
|
* @param message エラーメッセージ
|
|
5863
5985
|
*/
|
|
5864
5986
|
static addErrorMessage(e, t) {
|
|
5865
|
-
return
|
|
5987
|
+
return Se.addMessage(e, t, "error");
|
|
5866
5988
|
}
|
|
5867
5989
|
/**
|
|
5868
5990
|
* メッセージをレベル付きで追加します。
|
|
@@ -5887,7 +6009,7 @@ const we = class we {
|
|
|
5887
6009
|
*/
|
|
5888
6010
|
static clearMessages(e) {
|
|
5889
6011
|
return z.enqueue(() => {
|
|
5890
|
-
!(e instanceof HTMLFormElement) && e.parentElement && (e.parentElement.removeAttribute("data-message"), e.parentElement.removeAttribute("data-message-level")),
|
|
6012
|
+
!(e instanceof HTMLFormElement) && e.parentElement && (e.parentElement.removeAttribute("data-message"), e.parentElement.removeAttribute("data-message-level")), Se.clearMessagesSync(e);
|
|
5891
6013
|
}, !0);
|
|
5892
6014
|
}
|
|
5893
6015
|
/**
|
|
@@ -5914,7 +6036,7 @@ const we = class we {
|
|
|
5914
6036
|
* @returns 整形済み文字列。整形できない場合は空文字
|
|
5915
6037
|
*/
|
|
5916
6038
|
static date(e, t, r) {
|
|
5917
|
-
return
|
|
6039
|
+
return He(e, t, r);
|
|
5918
6040
|
}
|
|
5919
6041
|
/**
|
|
5920
6042
|
* 現在日時を指定フォーマットの文字列へ整形します。
|
|
@@ -5979,7 +6101,7 @@ const we = class we {
|
|
|
5979
6101
|
* @returns 表示要素の配列
|
|
5980
6102
|
*/
|
|
5981
6103
|
static pages(e, t, r) {
|
|
5982
|
-
return
|
|
6104
|
+
return ht(e, t, r);
|
|
5983
6105
|
}
|
|
5984
6106
|
/**
|
|
5985
6107
|
* `YYYY-MM` 形式の年月文字列に月数を加算します。
|
|
@@ -5991,7 +6113,7 @@ const we = class we {
|
|
|
5991
6113
|
* @returns 加算後の年月(`YYYY-MM` 形式)。不正な入力は空文字
|
|
5992
6114
|
*/
|
|
5993
6115
|
static monthAdd(e, t) {
|
|
5994
|
-
return
|
|
6116
|
+
return Ue(e, t);
|
|
5995
6117
|
}
|
|
5996
6118
|
/**
|
|
5997
6119
|
* 基準月から過去方向へ `count + 1` 個の年月配列を降順で返します。
|
|
@@ -6003,7 +6125,7 @@ const we = class we {
|
|
|
6003
6125
|
* @returns 年月情報の降順配列。不正な入力は空配列
|
|
6004
6126
|
*/
|
|
6005
6127
|
static monthRange(e, t) {
|
|
6006
|
-
return
|
|
6128
|
+
return ft(e, t);
|
|
6007
6129
|
}
|
|
6008
6130
|
/**
|
|
6009
6131
|
* ページレスポンスから表示用サマリーを作ります。
|
|
@@ -6071,7 +6193,7 @@ const we = class we {
|
|
|
6071
6193
|
return Et(e, t);
|
|
6072
6194
|
}
|
|
6073
6195
|
};
|
|
6074
|
-
|
|
6196
|
+
Se.enhancers = {
|
|
6075
6197
|
/**
|
|
6076
6198
|
* 外部ライブラリ連携を登録します。
|
|
6077
6199
|
*
|
|
@@ -6092,15 +6214,15 @@ we.enhancers = {
|
|
|
6092
6214
|
return re.has(e);
|
|
6093
6215
|
}
|
|
6094
6216
|
};
|
|
6095
|
-
let Re =
|
|
6096
|
-
const
|
|
6217
|
+
let Re = Se;
|
|
6218
|
+
const Mt = "入力内容を確認してください", $t = ["addErrorMessage", "clearMessages"], _e = "data-haori-group-name";
|
|
6097
6219
|
function et() {
|
|
6098
6220
|
const e = globalThis.window?.Haori;
|
|
6099
6221
|
return $t.every(
|
|
6100
6222
|
(r) => typeof e?.[r] == "function"
|
|
6101
6223
|
) ? e : Re;
|
|
6102
6224
|
}
|
|
6103
|
-
const
|
|
6225
|
+
const h = class h {
|
|
6104
6226
|
/**
|
|
6105
6227
|
* フォーム内にある入力エレメントの値をオブジェクトとして取得します。
|
|
6106
6228
|
* data-form-object属性があると、そのエレメント内の値はオブジェクトとして処理されます。
|
|
@@ -6111,7 +6233,7 @@ const f = class f {
|
|
|
6111
6233
|
*/
|
|
6112
6234
|
static getValues(e) {
|
|
6113
6235
|
const t = {}, r = /* @__PURE__ */ new Set();
|
|
6114
|
-
return
|
|
6236
|
+
return h.getPartValues(e, t, null, r), h.registerCollectedExcludedKeys(t, r), t;
|
|
6115
6237
|
}
|
|
6116
6238
|
/**
|
|
6117
6239
|
* 入力エレメントから収集する値を解決します。
|
|
@@ -6132,11 +6254,11 @@ const f = class f {
|
|
|
6132
6254
|
*/
|
|
6133
6255
|
static resolveCollectedValue(e) {
|
|
6134
6256
|
const t = e.getTarget();
|
|
6135
|
-
if (
|
|
6257
|
+
if (h.isFileInput(e)) {
|
|
6136
6258
|
const r = t, i = r.files ? Array.from(r.files) : [];
|
|
6137
6259
|
return r.multiple ? i : i.length > 0 ? i[0] : null;
|
|
6138
6260
|
}
|
|
6139
|
-
if (
|
|
6261
|
+
if (h.isBooleanCheckbox(e)) {
|
|
6140
6262
|
const r = t;
|
|
6141
6263
|
return r.value === "false" ? !r.checked : r.checked;
|
|
6142
6264
|
}
|
|
@@ -6189,13 +6311,13 @@ const f = class f {
|
|
|
6189
6311
|
* @returns 戻り値はありません。
|
|
6190
6312
|
*/
|
|
6191
6313
|
static clearRowUserEditMarksForChangedKeys(e, t) {
|
|
6192
|
-
const r =
|
|
6314
|
+
const r = h.getValues(e), i = /* @__PURE__ */ new Set();
|
|
6193
6315
|
for (const n of /* @__PURE__ */ new Set([
|
|
6194
6316
|
...Object.keys(r),
|
|
6195
6317
|
...Object.keys(t)
|
|
6196
6318
|
]))
|
|
6197
|
-
|
|
6198
|
-
i.size !== 0 &&
|
|
6319
|
+
h.isSameCollectedValue(r[n], t[n]) || i.add(n);
|
|
6320
|
+
i.size !== 0 && h.clearUserEditMarksForKeys(e, e, i);
|
|
6199
6321
|
}
|
|
6200
6322
|
/**
|
|
6201
6323
|
* 収集値と要素データの値が同じ内容かどうかを判定します。
|
|
@@ -6224,9 +6346,9 @@ const f = class f {
|
|
|
6224
6346
|
* @returns 戻り値はありません。
|
|
6225
6347
|
*/
|
|
6226
6348
|
static clearUserEditMarksForKeys(e, t, r) {
|
|
6227
|
-
const i =
|
|
6349
|
+
const i = h.resolveRowTopLevelKey(e, t);
|
|
6228
6350
|
i !== null && r.has(i) && e.clearUserEditMark(), e.getChildElementFragments().forEach((n) => {
|
|
6229
|
-
|
|
6351
|
+
h.clearUserEditMarksForKeys(n, t, r);
|
|
6230
6352
|
});
|
|
6231
6353
|
}
|
|
6232
6354
|
/**
|
|
@@ -6242,7 +6364,7 @@ const f = class f {
|
|
|
6242
6364
|
static resolveRowTopLevelKey(e, t) {
|
|
6243
6365
|
let r = null, i = e;
|
|
6244
6366
|
for (; i !== null && i !== t; ) {
|
|
6245
|
-
const n = i.getAttribute(`${c.prefix}form-object`) || i.getAttribute(`${c.prefix}form-list`) ||
|
|
6367
|
+
const n = i.getAttribute(`${c.prefix}form-object`) || i.getAttribute(`${c.prefix}form-list`) || h.resolveFieldName(i);
|
|
6246
6368
|
n != null && String(n) !== "" && (r = String(n)), i = i.getParent();
|
|
6247
6369
|
}
|
|
6248
6370
|
return r;
|
|
@@ -6283,7 +6405,7 @@ const f = class f {
|
|
|
6283
6405
|
const r = e.getTarget();
|
|
6284
6406
|
if (!(r instanceof HTMLInputElement) || r.type !== "radio" || r.hasAttribute("name") && !r.hasAttribute(_e))
|
|
6285
6407
|
return;
|
|
6286
|
-
const i =
|
|
6408
|
+
const i = h.resolveGroupScope(e), n = `${String(t)}--haori${h.resolveGroupScopeId(
|
|
6287
6409
|
i
|
|
6288
6410
|
)}`;
|
|
6289
6411
|
if (r.getAttribute("name") !== n)
|
|
@@ -6317,8 +6439,8 @@ const f = class f {
|
|
|
6317
6439
|
* @returns スコープの識別番号
|
|
6318
6440
|
*/
|
|
6319
6441
|
static resolveGroupScopeId(e) {
|
|
6320
|
-
const t =
|
|
6321
|
-
return t !== void 0 ? t : (
|
|
6442
|
+
const t = h.GROUP_SCOPE_IDS.get(e);
|
|
6443
|
+
return t !== void 0 ? t : (h.groupScopeSequence += 1, h.GROUP_SCOPE_IDS.set(e, h.groupScopeSequence), h.groupScopeSequence);
|
|
6322
6444
|
}
|
|
6323
6445
|
/**
|
|
6324
6446
|
* 宣言バインドで値・状態が決まり、その評価が解決している入力かどうかを判定します。
|
|
@@ -6336,17 +6458,17 @@ const f = class f {
|
|
|
6336
6458
|
* @returns 宣言バインドで値・状態が決まり、その評価が解決している場合 true
|
|
6337
6459
|
*/
|
|
6338
6460
|
static hasResolvedDeclarativeState(e) {
|
|
6339
|
-
if (!
|
|
6461
|
+
if (!h.isDeclarativeStateBound(e))
|
|
6340
6462
|
return !1;
|
|
6341
6463
|
const t = e.getTarget();
|
|
6342
6464
|
if (t instanceof HTMLInputElement && (t.type === "checkbox" || t.type === "radio"))
|
|
6343
|
-
return
|
|
6344
|
-
if (
|
|
6345
|
-
return
|
|
6465
|
+
return h.isDeclarationResolved(e, "checked");
|
|
6466
|
+
if (h.hasDeclarativeBinding(e, "value"))
|
|
6467
|
+
return h.isDeclarationResolved(e, "value");
|
|
6346
6468
|
if (t instanceof HTMLSelectElement) {
|
|
6347
6469
|
for (const r of Array.from(t.options)) {
|
|
6348
6470
|
const i = N.get(r);
|
|
6349
|
-
if (i instanceof
|
|
6471
|
+
if (i instanceof w && h.hasDeclarativeBinding(i, "selected") && !h.isDeclarationResolved(i, "selected"))
|
|
6350
6472
|
return !1;
|
|
6351
6473
|
}
|
|
6352
6474
|
return !0;
|
|
@@ -6389,7 +6511,7 @@ const f = class f {
|
|
|
6389
6511
|
*/
|
|
6390
6512
|
static isDeclarativeStateBound(e) {
|
|
6391
6513
|
const t = e.getTarget();
|
|
6392
|
-
return t instanceof HTMLInputElement && (t.type === "checkbox" || t.type === "radio") ?
|
|
6514
|
+
return t instanceof HTMLInputElement && (t.type === "checkbox" || t.type === "radio") ? h.hasDeclarativeBinding(e, "checked") : w.isValuePropertyTarget(t) ? h.hasDeclarativeBinding(e, "value") ? !0 : t instanceof HTMLSelectElement ? h.hasDeclarativeSelectedOption(t) : !1 : !1;
|
|
6393
6515
|
}
|
|
6394
6516
|
/**
|
|
6395
6517
|
* 対象の部分木にある入力欄を、ネイティブのフォームリセットと同じ既定値へ戻します。
|
|
@@ -6409,7 +6531,7 @@ const f = class f {
|
|
|
6409
6531
|
const t = "input, textarea, select", r = [];
|
|
6410
6532
|
e.matches(t) && r.push(e), r.push(...e.querySelectorAll(t));
|
|
6411
6533
|
for (const i of r)
|
|
6412
|
-
i instanceof HTMLInputElement ? i.type === "checkbox" || i.type === "radio" ? i.checked = i.defaultChecked : i.type === "file" ? i.value = "" : i.value = i.defaultValue : i instanceof HTMLTextAreaElement ? i.value = i.defaultValue : i instanceof HTMLSelectElement &&
|
|
6534
|
+
i instanceof HTMLInputElement ? i.type === "checkbox" || i.type === "radio" ? i.checked = i.defaultChecked : i.type === "file" ? i.value = "" : i.value = i.defaultValue : i instanceof HTMLTextAreaElement ? i.value = i.defaultValue : i instanceof HTMLSelectElement && h.restoreDefaultSelection(i);
|
|
6413
6535
|
}
|
|
6414
6536
|
/**
|
|
6415
6537
|
* `<select>` の選択状態を既定の選択(`defaultSelected`)へ戻します。
|
|
@@ -6439,14 +6561,14 @@ const f = class f {
|
|
|
6439
6561
|
* @return 戻り値はありません。
|
|
6440
6562
|
*/
|
|
6441
6563
|
static clearDeclarativeStateFromDom(e) {
|
|
6442
|
-
if (
|
|
6564
|
+
if (h.isDeclarativeStateBound(e)) {
|
|
6443
6565
|
const t = e.getTarget();
|
|
6444
6566
|
t instanceof HTMLInputElement && (t.type === "checkbox" || t.type === "radio") ? t.checked = !1 : t instanceof HTMLSelectElement ? (Array.from(t.options).forEach((r) => {
|
|
6445
6567
|
r.selected = !1;
|
|
6446
6568
|
}), t.selectedIndex = -1) : (t instanceof HTMLInputElement || t instanceof HTMLTextAreaElement) && (t.value = "");
|
|
6447
6569
|
}
|
|
6448
6570
|
e.getChildren().forEach((t) => {
|
|
6449
|
-
t instanceof
|
|
6571
|
+
t instanceof w && h.clearDeclarativeStateFromDom(t);
|
|
6450
6572
|
});
|
|
6451
6573
|
}
|
|
6452
6574
|
/**
|
|
@@ -6476,7 +6598,7 @@ const f = class f {
|
|
|
6476
6598
|
static hasDeclarativeSelectedOption(e) {
|
|
6477
6599
|
for (const t of Array.from(e.options)) {
|
|
6478
6600
|
const r = N.get(t);
|
|
6479
|
-
if (r instanceof
|
|
6601
|
+
if (r instanceof w && h.hasDeclarativeBinding(r, "selected"))
|
|
6480
6602
|
return !0;
|
|
6481
6603
|
}
|
|
6482
6604
|
return !1;
|
|
@@ -6507,7 +6629,7 @@ const f = class f {
|
|
|
6507
6629
|
* @returns 編集された入力欄だけを含む値のオブジェクト
|
|
6508
6630
|
*/
|
|
6509
6631
|
static getValuesEditedAfter(e, t) {
|
|
6510
|
-
return
|
|
6632
|
+
return h.getPartValues(e, {}, t);
|
|
6511
6633
|
}
|
|
6512
6634
|
/**
|
|
6513
6635
|
* 利用者が編集した入力欄に対応するバインドデータの経路を集めます。
|
|
@@ -6549,10 +6671,10 @@ const f = class f {
|
|
|
6549
6671
|
*/
|
|
6550
6672
|
static collectEditedPaths(e, t, r = "", i = null) {
|
|
6551
6673
|
const n = /* @__PURE__ */ new Map();
|
|
6552
|
-
for (const a of
|
|
6674
|
+
for (const a of h.collectUserEditSequences(e)) {
|
|
6553
6675
|
const o = /* @__PURE__ */ new Set();
|
|
6554
|
-
|
|
6555
|
-
|
|
6676
|
+
h.walkEditedPaths(
|
|
6677
|
+
h.getValuesEditedAfter(e, a - 1),
|
|
6556
6678
|
r,
|
|
6557
6679
|
o
|
|
6558
6680
|
);
|
|
@@ -6560,7 +6682,7 @@ const f = class f {
|
|
|
6560
6682
|
n.has(l) || n.set(l, a);
|
|
6561
6683
|
}
|
|
6562
6684
|
const s = /* @__PURE__ */ new Set();
|
|
6563
|
-
|
|
6685
|
+
h.walkExcludedPaths(i ?? h.getValues(e), r, s);
|
|
6564
6686
|
for (const a of s)
|
|
6565
6687
|
n.has(a) || n.set(a, t);
|
|
6566
6688
|
return n;
|
|
@@ -6573,7 +6695,7 @@ const f = class f {
|
|
|
6573
6695
|
*/
|
|
6574
6696
|
static collectUserEditSequences(e) {
|
|
6575
6697
|
const t = /* @__PURE__ */ new Set();
|
|
6576
|
-
return
|
|
6698
|
+
return h.walkUserEditSequences(e, t), [...t].sort((r, i) => i - r);
|
|
6577
6699
|
}
|
|
6578
6700
|
/**
|
|
6579
6701
|
* 部分木をたどってユーザー編集の通番を集めます。
|
|
@@ -6586,7 +6708,7 @@ const f = class f {
|
|
|
6586
6708
|
const r = e.getUserEditSequence();
|
|
6587
6709
|
r > 0 && t.add(r);
|
|
6588
6710
|
for (const i of e.getChildElementFragments())
|
|
6589
|
-
|
|
6711
|
+
h.walkUserEditSequences(i, t);
|
|
6590
6712
|
}
|
|
6591
6713
|
/**
|
|
6592
6714
|
* 収集値をたどって、除外されたキーの経路を集めます。
|
|
@@ -6601,15 +6723,15 @@ const f = class f {
|
|
|
6601
6723
|
static walkExcludedPaths(e, t, r) {
|
|
6602
6724
|
if (Array.isArray(e))
|
|
6603
6725
|
return;
|
|
6604
|
-
const i =
|
|
6726
|
+
const i = h.asPlainRecord(e);
|
|
6605
6727
|
if (i === null)
|
|
6606
6728
|
return;
|
|
6607
|
-
const n =
|
|
6729
|
+
const n = h.COLLECTED_EXCLUDED_KEYS.get(i);
|
|
6608
6730
|
if (n)
|
|
6609
6731
|
for (const s of n)
|
|
6610
6732
|
s in i || r.add(t === "" ? s : `${t}.${s}`);
|
|
6611
6733
|
for (const [s, a] of Object.entries(i))
|
|
6612
|
-
|
|
6734
|
+
h.walkExcludedPaths(
|
|
6613
6735
|
a,
|
|
6614
6736
|
t === "" ? s : `${t}.${s}`,
|
|
6615
6737
|
r
|
|
@@ -6625,10 +6747,10 @@ const f = class f {
|
|
|
6625
6747
|
static walkEditedPaths(e, t, r) {
|
|
6626
6748
|
if (Array.isArray(e))
|
|
6627
6749
|
return;
|
|
6628
|
-
const i =
|
|
6750
|
+
const i = h.asPlainRecord(e);
|
|
6629
6751
|
if (i !== null) {
|
|
6630
6752
|
for (const [n, s] of Object.entries(i))
|
|
6631
|
-
|
|
6753
|
+
h.walkEditedPaths(
|
|
6632
6754
|
s,
|
|
6633
6755
|
t === "" ? n : `${t}.${n}`,
|
|
6634
6756
|
r
|
|
@@ -6643,7 +6765,7 @@ const f = class f {
|
|
|
6643
6765
|
* @returns 最中なら true
|
|
6644
6766
|
*/
|
|
6645
6767
|
static isResettingInternally() {
|
|
6646
|
-
return
|
|
6768
|
+
return h.internalResetDepth > 0;
|
|
6647
6769
|
}
|
|
6648
6770
|
/**
|
|
6649
6771
|
* フォーム内の各入力エレメントから値を取得し、オブジェクトとして返します。
|
|
@@ -6662,75 +6784,75 @@ const f = class f {
|
|
|
6662
6784
|
return t;
|
|
6663
6785
|
if (e.getTarget().hasAttribute(`${c.prefix}if-false`)) {
|
|
6664
6786
|
if (i !== null)
|
|
6665
|
-
for (const u of
|
|
6787
|
+
for (const u of h.collectDeclaredKeysInFragment(e))
|
|
6666
6788
|
i.add(u);
|
|
6667
6789
|
return t;
|
|
6668
6790
|
}
|
|
6669
|
-
const n =
|
|
6791
|
+
const n = h.resolveFieldName(e), s = e.getAttribute(`${c.prefix}form-object`), a = e.getAttribute(`${c.prefix}form-list`), o = e.hasAttribute(`${c.prefix}form-list`), l = r !== null && e.getUserEditSequence() <= r;
|
|
6670
6792
|
if (n) {
|
|
6671
|
-
if (r !== null &&
|
|
6672
|
-
const u =
|
|
6793
|
+
if (r !== null && h.isGroupedCheckable(e)) {
|
|
6794
|
+
const u = h.collectGroupSelection(
|
|
6673
6795
|
e,
|
|
6674
6796
|
o,
|
|
6675
6797
|
r
|
|
6676
6798
|
);
|
|
6677
6799
|
u.edited && (t[String(n)] = u.value);
|
|
6678
|
-
} else if (o &&
|
|
6679
|
-
const u = String(n),
|
|
6680
|
-
r === null && !Array.isArray(t[u]) && (t[u] = []), !l &&
|
|
6800
|
+
} else if (o && h.isGroupedCheckable(e)) {
|
|
6801
|
+
const u = String(n), f = e.getTarget();
|
|
6802
|
+
r === null && !Array.isArray(t[u]) && (t[u] = []), !l && f.checked && (Array.isArray(t[u]) || (t[u] = []), t[u].push(f.value));
|
|
6681
6803
|
} else if (o && l)
|
|
6682
6804
|
Array.isArray(t[String(n)]) ? t[String(n)].push(null) : t[String(n)] = [null];
|
|
6683
6805
|
else if (!l) if (o) {
|
|
6684
|
-
const u =
|
|
6685
|
-
Array.isArray(t[String(n)]) ? t[String(n)].push(...
|
|
6686
|
-
} else if (
|
|
6687
|
-
const u = e.getTarget(),
|
|
6806
|
+
const u = h.resolveCollectedValue(e), f = h.isFileInput(e) && Array.isArray(u) ? u : [u];
|
|
6807
|
+
Array.isArray(t[String(n)]) ? t[String(n)].push(...f) : t[String(n)] = f;
|
|
6808
|
+
} else if (h.isGroupedCheckable(e)) {
|
|
6809
|
+
const u = e.getTarget(), f = u instanceof HTMLInputElement ? u.checked : !0, m = u instanceof HTMLInputElement ? u.value : e.getValue(), y = f ? m : null, E = String(n);
|
|
6688
6810
|
y === null ? E in t || (t[E] = null) : t[E] === null || t[E] === void 0 ? t[E] = y : Array.isArray(t[E]) ? t[E].push(y) : t[E] = [t[E], y];
|
|
6689
6811
|
} else
|
|
6690
|
-
t[String(n)] =
|
|
6812
|
+
t[String(n)] = h.resolveCollectedValue(e);
|
|
6691
6813
|
s && g.warn(
|
|
6692
6814
|
"Haori",
|
|
6693
6815
|
`Element cannot have both ${c.prefix}form-object and name attributes.`
|
|
6694
6816
|
);
|
|
6695
6817
|
for (const u of e.getChildElementFragments())
|
|
6696
|
-
|
|
6818
|
+
h.getPartValues(u, t, r, i);
|
|
6697
6819
|
} else if (s) {
|
|
6698
|
-
const u = {},
|
|
6820
|
+
const u = {}, f = i === null ? null : /* @__PURE__ */ new Set();
|
|
6699
6821
|
for (const m of e.getChildElementFragments())
|
|
6700
|
-
|
|
6822
|
+
h.getPartValues(
|
|
6701
6823
|
m,
|
|
6702
6824
|
u,
|
|
6703
6825
|
r,
|
|
6704
|
-
|
|
6826
|
+
f
|
|
6705
6827
|
);
|
|
6706
|
-
|
|
6828
|
+
f !== null && h.registerCollectedExcludedKeys(u, f), Object.keys(u).length > 0 ? t[String(s)] = u : i !== null && (f?.size ?? 0) > 0 && i.add(String(s)), a && g.warn(
|
|
6707
6829
|
"Haori",
|
|
6708
6830
|
`Element cannot have both ${c.prefix}form-list and ${c.prefix}form-object attributes.`
|
|
6709
6831
|
);
|
|
6710
6832
|
} else if (a) {
|
|
6711
|
-
const u = [],
|
|
6833
|
+
const u = [], f = [];
|
|
6712
6834
|
let m = !1;
|
|
6713
6835
|
for (const y of e.getChildElementFragments()) {
|
|
6714
6836
|
const E = {}, A = i === null ? null : /* @__PURE__ */ new Set();
|
|
6715
|
-
|
|
6837
|
+
h.getPartValues(
|
|
6716
6838
|
y,
|
|
6717
6839
|
E,
|
|
6718
6840
|
r,
|
|
6719
6841
|
A
|
|
6720
|
-
), A !== null &&
|
|
6842
|
+
), A !== null && h.registerCollectedExcludedKeys(E, A), Object.keys(E).length > 0 ? (m = !0, u.push(E), f.push(y.getListKey())) : r !== null && (u.push({}), f.push(y.getListKey()));
|
|
6721
6843
|
}
|
|
6722
6844
|
if (r === null) {
|
|
6723
6845
|
const y = e.getAttribute(`${c.prefix}each-key`);
|
|
6724
|
-
|
|
6846
|
+
h.registerCollectedRowIdentity(
|
|
6725
6847
|
u,
|
|
6726
6848
|
y == null ? null : String(y),
|
|
6727
|
-
|
|
6728
|
-
|
|
6729
|
-
),
|
|
6849
|
+
f,
|
|
6850
|
+
h.isCollectedListFromEachSource(e)
|
|
6851
|
+
), h.warnDerivedRowsWithoutKey(e), t[String(a)] = u;
|
|
6730
6852
|
} else m && (t[String(a)] = u);
|
|
6731
6853
|
} else
|
|
6732
6854
|
for (const u of e.getChildElementFragments())
|
|
6733
|
-
|
|
6855
|
+
h.getPartValues(u, t, r, i);
|
|
6734
6856
|
return t;
|
|
6735
6857
|
}
|
|
6736
6858
|
/**
|
|
@@ -6743,7 +6865,7 @@ const f = class f {
|
|
|
6743
6865
|
* @returns Promise(DOMの更新が完了したら解決される)
|
|
6744
6866
|
*/
|
|
6745
6867
|
static setValues(e, t, r = !1) {
|
|
6746
|
-
return
|
|
6868
|
+
return h.setPartValues(e, t, r, !0);
|
|
6747
6869
|
}
|
|
6748
6870
|
/**
|
|
6749
6871
|
* フォーム内にある入力エレメントに値をイベントなしで設定します。
|
|
@@ -6756,7 +6878,7 @@ const f = class f {
|
|
|
6756
6878
|
* @returns Promise(DOMの更新が完了したら解決される)
|
|
6757
6879
|
*/
|
|
6758
6880
|
static syncValues(e, t, r = !1, i = null) {
|
|
6759
|
-
return
|
|
6881
|
+
return h.setPartValues(
|
|
6760
6882
|
e,
|
|
6761
6883
|
t,
|
|
6762
6884
|
r,
|
|
@@ -6779,7 +6901,7 @@ const f = class f {
|
|
|
6779
6901
|
* @returns 反映完了の Promise
|
|
6780
6902
|
*/
|
|
6781
6903
|
static syncRowValues(e, t, r = null) {
|
|
6782
|
-
return
|
|
6904
|
+
return h.setPartValues(
|
|
6783
6905
|
e,
|
|
6784
6906
|
t,
|
|
6785
6907
|
!1,
|
|
@@ -6809,7 +6931,7 @@ const f = class f {
|
|
|
6809
6931
|
if (!r)
|
|
6810
6932
|
return t;
|
|
6811
6933
|
const i = String(r);
|
|
6812
|
-
return Object.prototype.hasOwnProperty.call(t, i) ?
|
|
6934
|
+
return Object.prototype.hasOwnProperty.call(t, i) ? h.asPlainRecord(t[i]) ?? {} : h.resolveAncestorArgOwner(e, i)?.value ?? {};
|
|
6813
6935
|
}
|
|
6814
6936
|
/**
|
|
6815
6937
|
* キーを所有する祖先を、値の型を問わず解決します。
|
|
@@ -6855,11 +6977,11 @@ const f = class f {
|
|
|
6855
6977
|
* @returns 所有する祖先フラグメントとその値。見つからない場合は null
|
|
6856
6978
|
*/
|
|
6857
6979
|
static resolveAncestorArgOwner(e, t) {
|
|
6858
|
-
const r =
|
|
6980
|
+
const r = h.resolveAncestorKeyOwner(e, t);
|
|
6859
6981
|
if (r === null)
|
|
6860
6982
|
return null;
|
|
6861
|
-
const i =
|
|
6862
|
-
return i === null ? (
|
|
6983
|
+
const i = h.asPlainRecord(r.value);
|
|
6984
|
+
return i === null ? (h.warnArgOwnerIsNotRecord(e, t, r.value), null) : { owner: r.owner, value: i };
|
|
6863
6985
|
}
|
|
6864
6986
|
/**
|
|
6865
6987
|
* 収集キーの土台を祖先から解決する関数を返します。
|
|
@@ -6873,7 +6995,7 @@ const f = class f {
|
|
|
6873
6995
|
* @returns キーを受け取り、祖先が所有する値を返す関数(所有者が無ければ undefined)
|
|
6874
6996
|
*/
|
|
6875
6997
|
static ancestorBaseResolver(e) {
|
|
6876
|
-
return (t) =>
|
|
6998
|
+
return (t) => h.resolveAncestorKeyOwner(e, t)?.value;
|
|
6877
6999
|
}
|
|
6878
7000
|
/**
|
|
6879
7001
|
* `data-form-arg` のキーをレコード以外で所有している構成を、開発モードで知らせます。
|
|
@@ -6885,8 +7007,8 @@ const f = class f {
|
|
|
6885
7007
|
static warnArgOwnerIsNotRecord(e, t, r) {
|
|
6886
7008
|
if (!q.isEnabled() || r == null)
|
|
6887
7009
|
return;
|
|
6888
|
-
const i = e.getTarget(), n =
|
|
6889
|
-
n?.has(t) || (n ? n.add(t) :
|
|
7010
|
+
const i = e.getTarget(), n = h.warnedArgOwnerNotRecord.get(i);
|
|
7011
|
+
n?.has(t) || (n ? n.add(t) : h.warnedArgOwnerNotRecord.set(i, /* @__PURE__ */ new Set([t])), g.warn(
|
|
6890
7012
|
"[Haori]",
|
|
6891
7013
|
`${c.prefix}form-arg="${t}" のキーを祖先が${Array.isArray(r) ? "配列" : `${typeof r} 型の値`}で持っています。${c.prefix}form-arg はそのキーの配下に入力欄が対応することを宣言するため、値はレコード(オブジェクト)である必要があります。このままでは収集値がそのキーへ直接入り、値の型が変わります。`
|
|
6892
7014
|
));
|
|
@@ -6908,18 +7030,18 @@ const f = class f {
|
|
|
6908
7030
|
static buildConditionScope(e, t = null) {
|
|
6909
7031
|
const r = { ...e.getBindingData() }, i = t ? {
|
|
6910
7032
|
source: t,
|
|
6911
|
-
argKey:
|
|
6912
|
-
} :
|
|
7033
|
+
argKey: h.resolveFormArgKey(t)
|
|
7034
|
+
} : h.resolveConditionValueSource(e);
|
|
6913
7035
|
if (!i)
|
|
6914
7036
|
return r;
|
|
6915
|
-
const n =
|
|
7037
|
+
const n = h.getValues(i.source), s = h.collectDeclaredFieldKeys(i.source);
|
|
6916
7038
|
if (i.argKey === null) {
|
|
6917
7039
|
for (const o of s)
|
|
6918
7040
|
r[o] = n[o];
|
|
6919
7041
|
return r;
|
|
6920
7042
|
}
|
|
6921
7043
|
const a = {
|
|
6922
|
-
...
|
|
7044
|
+
...h.asPlainRecord(r[i.argKey]) ?? {}
|
|
6923
7045
|
};
|
|
6924
7046
|
for (const o of s)
|
|
6925
7047
|
a[o] = n[o];
|
|
@@ -6949,8 +7071,8 @@ const f = class f {
|
|
|
6949
7071
|
}
|
|
6950
7072
|
t = i;
|
|
6951
7073
|
}
|
|
6952
|
-
const r =
|
|
6953
|
-
return r ? { source: r, argKey:
|
|
7074
|
+
const r = h.getFormFragment(e);
|
|
7075
|
+
return r ? { source: r, argKey: h.resolveFormArgKey(r) } : null;
|
|
6954
7076
|
}
|
|
6955
7077
|
/**
|
|
6956
7078
|
* フォームコンテナの `data-form-arg` のキー名を返します。
|
|
@@ -6982,7 +7104,7 @@ const f = class f {
|
|
|
6982
7104
|
* @returns 宣言されている最上位のキー名
|
|
6983
7105
|
*/
|
|
6984
7106
|
static collectDeclaredFieldKeys(e) {
|
|
6985
|
-
return
|
|
7107
|
+
return h.collectDeclaredKeysInFragment(e);
|
|
6986
7108
|
}
|
|
6987
7109
|
/**
|
|
6988
7110
|
* フラグメントの配下で収集対象として**宣言されている**最上位のキー名を列挙します。
|
|
@@ -6994,7 +7116,7 @@ const f = class f {
|
|
|
6994
7116
|
* @returns 宣言されている最上位のキー名
|
|
6995
7117
|
*/
|
|
6996
7118
|
static collectDeclaredKeysInFragment(e) {
|
|
6997
|
-
const t = /* @__PURE__ */ new Set(), r = e.getTarget(), i =
|
|
7119
|
+
const t = /* @__PURE__ */ new Set(), r = e.getTarget(), i = h.resolveFieldName(e);
|
|
6998
7120
|
i && t.add(String(i));
|
|
6999
7121
|
const n = `${c.prefix}form-object`, s = `${c.prefix}form-list`, a = r.getAttribute(n) ?? r.getAttribute(s);
|
|
7000
7122
|
if (a)
|
|
@@ -7003,10 +7125,10 @@ const f = class f {
|
|
|
7003
7125
|
return r.querySelectorAll(o).forEach((l) => {
|
|
7004
7126
|
if (!(l instanceof HTMLElement))
|
|
7005
7127
|
return;
|
|
7006
|
-
let u = null,
|
|
7128
|
+
let u = null, f = !1, m = l;
|
|
7007
7129
|
for (; m && m !== r; )
|
|
7008
|
-
m.hasAttribute(`${c.prefix}form-detach`) && (
|
|
7009
|
-
if (
|
|
7130
|
+
m.hasAttribute(`${c.prefix}form-detach`) && (f = !0), (m.hasAttribute(n) || m.hasAttribute(s)) && (u = m), m = m.parentElement;
|
|
7131
|
+
if (f)
|
|
7010
7132
|
return;
|
|
7011
7133
|
const y = u ?? l, E = y.getAttribute(n) || y.getAttribute(s) || y.getAttribute(`${c.prefix}form-name`) || y.getAttribute("name");
|
|
7012
7134
|
E && t.add(E);
|
|
@@ -7024,7 +7146,7 @@ const f = class f {
|
|
|
7024
7146
|
*/
|
|
7025
7147
|
static applyCustomValidity(e) {
|
|
7026
7148
|
const t = `${c.prefix}validity`, r = (i) => {
|
|
7027
|
-
i.hasAttribute(t) &&
|
|
7149
|
+
i.hasAttribute(t) && h.applyOneCustomValidity(i, t), i.getChildElementFragments().forEach(r);
|
|
7028
7150
|
};
|
|
7029
7151
|
r(e);
|
|
7030
7152
|
}
|
|
@@ -7049,19 +7171,19 @@ const f = class f {
|
|
|
7049
7171
|
r.setCustomValidity("");
|
|
7050
7172
|
return;
|
|
7051
7173
|
}
|
|
7052
|
-
const n =
|
|
7053
|
-
|
|
7174
|
+
const n = h.buildConditionScope(e), s = ie.evaluateDetailed(
|
|
7175
|
+
h.unwrapConditionExpression(i),
|
|
7054
7176
|
n
|
|
7055
7177
|
);
|
|
7056
7178
|
if (s.unresolvedReference) {
|
|
7057
7179
|
g.warn(
|
|
7058
7180
|
"Haori",
|
|
7059
7181
|
`${t} の参照が解決できないため無効として扱います: ${i}`
|
|
7060
|
-
), r.setCustomValidity(
|
|
7182
|
+
), r.setCustomValidity(h.resolveValidityMessage(e));
|
|
7061
7183
|
return;
|
|
7062
7184
|
}
|
|
7063
7185
|
r.setCustomValidity(
|
|
7064
|
-
s.value ? "" :
|
|
7186
|
+
s.value ? "" : h.resolveValidityMessage(e)
|
|
7065
7187
|
);
|
|
7066
7188
|
}
|
|
7067
7189
|
/**
|
|
@@ -7072,7 +7194,7 @@ const f = class f {
|
|
|
7072
7194
|
*/
|
|
7073
7195
|
static resolveValidityMessage(e) {
|
|
7074
7196
|
const t = e.getAttribute(`${c.prefix}validity-message`);
|
|
7075
|
-
return typeof t == "string" && t.trim() !== "" ? t :
|
|
7197
|
+
return typeof t == "string" && t.trim() !== "" ? t : Mt;
|
|
7076
7198
|
}
|
|
7077
7199
|
/**
|
|
7078
7200
|
* 条件属性の値から式を取り出します。
|
|
@@ -7123,7 +7245,7 @@ const f = class f {
|
|
|
7123
7245
|
* @param identifiesItems リストキーで収集先の配列要素を識別できるかどうか
|
|
7124
7246
|
*/
|
|
7125
7247
|
static registerCollectedRowIdentity(e, t, r, i) {
|
|
7126
|
-
|
|
7248
|
+
h.COLLECTED_ROW_IDENTITY.set(e, { keyArg: t, keys: r, identifiesItems: i });
|
|
7127
7249
|
}
|
|
7128
7250
|
/**
|
|
7129
7251
|
* 収集値の階層に、除外されたキーの集合を結び付けます。
|
|
@@ -7132,7 +7254,7 @@ const f = class f {
|
|
|
7132
7254
|
* @param keys 除外されたキー
|
|
7133
7255
|
*/
|
|
7134
7256
|
static registerCollectedExcludedKeys(e, t) {
|
|
7135
|
-
t.size > 0 &&
|
|
7257
|
+
t.size > 0 && h.COLLECTED_EXCLUDED_KEYS.set(e, t);
|
|
7136
7258
|
}
|
|
7137
7259
|
/**
|
|
7138
7260
|
* 収集値に控えた情報を、複製した値へ引き継ぎます。
|
|
@@ -7145,10 +7267,10 @@ const f = class f {
|
|
|
7145
7267
|
* @param to 複製した値
|
|
7146
7268
|
*/
|
|
7147
7269
|
static carryCollectedRowIdentity(e, t) {
|
|
7148
|
-
const r =
|
|
7149
|
-
r &&
|
|
7150
|
-
const i =
|
|
7151
|
-
i &&
|
|
7270
|
+
const r = h.COLLECTED_ROW_IDENTITY.get(e);
|
|
7271
|
+
r && h.COLLECTED_ROW_IDENTITY.set(t, r);
|
|
7272
|
+
const i = h.COLLECTED_EXCLUDED_KEYS.get(e);
|
|
7273
|
+
i && h.COLLECTED_EXCLUDED_KEYS.set(t, i);
|
|
7152
7274
|
}
|
|
7153
7275
|
/**
|
|
7154
7276
|
* 行の対応付けが出現順へ退いたことを、開発モードで一度だけ知らせます。
|
|
@@ -7160,7 +7282,7 @@ const f = class f {
|
|
|
7160
7282
|
* @param reason 退いた理由
|
|
7161
7283
|
*/
|
|
7162
7284
|
static warnPositionalRowFallback(e) {
|
|
7163
|
-
!q.isEnabled() ||
|
|
7285
|
+
!q.isEnabled() || h.warnedPositionalRowFallbacks.has(e) || (h.warnedPositionalRowFallbacks.add(e), g.warn(
|
|
7164
7286
|
"[Haori]",
|
|
7165
7287
|
`${c.prefix}form-list の行を出現順で対応付けます(${e})。配列と画面の行数・並びが一致していない場合、行の値を取り違えます。`
|
|
7166
7288
|
));
|
|
@@ -7183,7 +7305,7 @@ const f = class f {
|
|
|
7183
7305
|
if (!q.isEnabled() || e.getRawAttribute(`${c.prefix}each-key`) !== null)
|
|
7184
7306
|
return;
|
|
7185
7307
|
const t = e.getRawAttribute(`${c.prefix}each`);
|
|
7186
|
-
t === null ||
|
|
7308
|
+
t === null || h.resolveLeadingPath(t) !== null || h.warnedDerivedRowsWithoutKey.has(t) || (h.warnedDerivedRowsWithoutKey.add(t), g.warn(
|
|
7187
7309
|
"[Haori]",
|
|
7188
7310
|
`${c.prefix}each="${t}" の一覧を ${c.prefix}form-list で収集していますが、${c.prefix}each-key がありません。行と配列要素を出現順で対応付けるため、画面に出ていない要素があると行の値を取り違えます。${c.prefix}each-key を宣言してください。`
|
|
7189
7311
|
));
|
|
@@ -7230,12 +7352,12 @@ const f = class f {
|
|
|
7230
7352
|
static mergeCollectedValues(e, t, r = null) {
|
|
7231
7353
|
const i = { ...e ?? {} };
|
|
7232
7354
|
for (const [s, a] of Object.entries(t)) {
|
|
7233
|
-
if (
|
|
7355
|
+
if (h.UNSAFE_MERGE_KEYS.has(s))
|
|
7234
7356
|
continue;
|
|
7235
7357
|
const o = e && Object.prototype.hasOwnProperty.call(e, s) ? e[s] : r?.(s);
|
|
7236
|
-
i[s] =
|
|
7358
|
+
i[s] = h.overlayCollectedValue(o, a);
|
|
7237
7359
|
}
|
|
7238
|
-
const n =
|
|
7360
|
+
const n = h.COLLECTED_EXCLUDED_KEYS.get(t);
|
|
7239
7361
|
if (n)
|
|
7240
7362
|
for (const s of n)
|
|
7241
7363
|
s in t || delete i[s];
|
|
@@ -7252,13 +7374,13 @@ const f = class f {
|
|
|
7252
7374
|
if (Array.isArray(t)) {
|
|
7253
7375
|
if (!Array.isArray(e))
|
|
7254
7376
|
return t;
|
|
7255
|
-
const n =
|
|
7377
|
+
const n = h.overlayIdentifiedRows(e, t);
|
|
7256
7378
|
return n !== null ? n : t.map(
|
|
7257
|
-
(s, a) =>
|
|
7379
|
+
(s, a) => h.overlayCollectedValue(e[a], s)
|
|
7258
7380
|
);
|
|
7259
7381
|
}
|
|
7260
|
-
const r =
|
|
7261
|
-
return r === null || i === null ? t :
|
|
7382
|
+
const r = h.asPlainRecord(t), i = h.asPlainRecord(e);
|
|
7383
|
+
return r === null || i === null ? t : h.mergeCollectedValues(i, r);
|
|
7262
7384
|
}
|
|
7263
7385
|
/**
|
|
7264
7386
|
* 式の先頭にある素の経路を返します。
|
|
@@ -7276,7 +7398,7 @@ const f = class f {
|
|
|
7276
7398
|
* @returns 先頭の経路。経路として読めない場合は null
|
|
7277
7399
|
*/
|
|
7278
7400
|
static resolveLeadingPath(e) {
|
|
7279
|
-
const t =
|
|
7401
|
+
const t = h.LEADING_PATH_PATTERN.exec(e);
|
|
7280
7402
|
if (!t)
|
|
7281
7403
|
return null;
|
|
7282
7404
|
const r = t[2].trim();
|
|
@@ -7313,7 +7435,7 @@ const f = class f {
|
|
|
7313
7435
|
const r = e.getRawAttribute(`${c.prefix}each`);
|
|
7314
7436
|
if (typeof r != "string" || r.trim() === "")
|
|
7315
7437
|
return !0;
|
|
7316
|
-
const i =
|
|
7438
|
+
const i = h.resolveLeadingPath(r);
|
|
7317
7439
|
if (i === null)
|
|
7318
7440
|
return !0;
|
|
7319
7441
|
const n = i.split(".");
|
|
@@ -7337,7 +7459,7 @@ const f = class f {
|
|
|
7337
7459
|
static createRowKeyIndexes(e, t) {
|
|
7338
7460
|
const r = /* @__PURE__ */ new Map();
|
|
7339
7461
|
return e.forEach((i, n) => {
|
|
7340
|
-
const s =
|
|
7462
|
+
const s = M.createListKey(
|
|
7341
7463
|
i,
|
|
7342
7464
|
t,
|
|
7343
7465
|
n
|
|
@@ -7368,7 +7490,7 @@ const f = class f {
|
|
|
7368
7490
|
const i = e.map((s) => s.getListKey());
|
|
7369
7491
|
if (i.some((s) => s === null))
|
|
7370
7492
|
return null;
|
|
7371
|
-
const n =
|
|
7493
|
+
const n = h.createRowKeyIndexes(t, r);
|
|
7372
7494
|
return i.map((s) => {
|
|
7373
7495
|
const a = n.get(s);
|
|
7374
7496
|
return !a || a.length === 0 ? null : t[a.shift()];
|
|
@@ -7398,22 +7520,22 @@ const f = class f {
|
|
|
7398
7520
|
* @returns 重ね合わせた配列。対応付けができない場合は null(出現順へ退く)
|
|
7399
7521
|
*/
|
|
7400
7522
|
static overlayIdentifiedRows(e, t) {
|
|
7401
|
-
const r =
|
|
7523
|
+
const r = h.COLLECTED_ROW_IDENTITY.get(t);
|
|
7402
7524
|
if (r && !r.identifiesItems)
|
|
7403
7525
|
return null;
|
|
7404
7526
|
if (!r)
|
|
7405
|
-
return t.some((s) =>
|
|
7527
|
+
return t.some((s) => h.asPlainRecord(s) !== null) && h.warnPositionalRowFallback("識別情報が引き継がれていません"), null;
|
|
7406
7528
|
if (r.keys.length !== t.length)
|
|
7407
|
-
return
|
|
7529
|
+
return h.warnPositionalRowFallback("収集後に行の数が変わっています"), null;
|
|
7408
7530
|
if (r.keys.some((s) => s === null))
|
|
7409
7531
|
return null;
|
|
7410
|
-
const i =
|
|
7532
|
+
const i = h.createRowKeyIndexes(e, r.keyArg), n = e.slice();
|
|
7411
7533
|
for (let s = 0; s < t.length; s += 1) {
|
|
7412
7534
|
const a = r.keys[s], o = i.get(a);
|
|
7413
7535
|
if (!o || o.length === 0)
|
|
7414
7536
|
continue;
|
|
7415
7537
|
const l = o.shift();
|
|
7416
|
-
n[l] =
|
|
7538
|
+
n[l] = h.overlayCollectedValue(
|
|
7417
7539
|
e[l],
|
|
7418
7540
|
t[s]
|
|
7419
7541
|
);
|
|
@@ -7447,20 +7569,20 @@ const f = class f {
|
|
|
7447
7569
|
*/
|
|
7448
7570
|
static syncAncestorArgForms(e, t, r = null, i = null) {
|
|
7449
7571
|
const n = [];
|
|
7450
|
-
for (const { form: a, key: o } of
|
|
7572
|
+
for (const { form: a, key: o } of h.collectArgForms(e)) {
|
|
7451
7573
|
if (a.wasResetAfter(t))
|
|
7452
7574
|
continue;
|
|
7453
|
-
const l =
|
|
7454
|
-
!l || l.owner !== e || n.push(
|
|
7575
|
+
const l = h.resolveAncestorArgOwner(a, o);
|
|
7576
|
+
!l || l.owner !== e || n.push(h.pushAncestorArgValue(a, o, l.value, r));
|
|
7455
7577
|
}
|
|
7456
7578
|
const s = e.getRawBindingData();
|
|
7457
|
-
for (const { form: a, keys: o } of
|
|
7579
|
+
for (const { form: a, keys: o } of h.collectShadowingContainers(e)) {
|
|
7458
7580
|
if (a.wasResetAfter(t))
|
|
7459
7581
|
continue;
|
|
7460
7582
|
const l = o.filter(
|
|
7461
|
-
(u) =>
|
|
7583
|
+
(u) => h.createArgValueSignature(i?.[u]) !== h.createArgValueSignature(s?.[u])
|
|
7462
7584
|
);
|
|
7463
|
-
l.length !== 0 && n.push(
|
|
7585
|
+
l.length !== 0 && n.push(h.releaseOwnCopy(a, l, r));
|
|
7464
7586
|
}
|
|
7465
7587
|
return Promise.all(n).then(() => {
|
|
7466
7588
|
});
|
|
@@ -7489,12 +7611,12 @@ const f = class f {
|
|
|
7489
7611
|
const t = `${c.prefix}form-arg`, r = [];
|
|
7490
7612
|
return e.getTarget().querySelectorAll(`form:not([${t}]), [${c.prefix}form]`).forEach((i) => {
|
|
7491
7613
|
const n = N.get(i);
|
|
7492
|
-
if (!(n instanceof
|
|
7614
|
+
if (!(n instanceof w))
|
|
7493
7615
|
return;
|
|
7494
7616
|
const s = n.getRawBindingData();
|
|
7495
7617
|
if (s === null)
|
|
7496
7618
|
return;
|
|
7497
|
-
const a =
|
|
7619
|
+
const a = h.getInitialBindingData(n), o = Object.keys(s).filter((l) => Object.prototype.hasOwnProperty.call(a ?? {}, l) ? !1 : h.resolveAncestorKeyOwner(n, l)?.owner === e);
|
|
7498
7620
|
o.length > 0 && r.push({ form: n, keys: o });
|
|
7499
7621
|
}), r;
|
|
7500
7622
|
}
|
|
@@ -7517,9 +7639,9 @@ const f = class f {
|
|
|
7517
7639
|
const n = { ...i };
|
|
7518
7640
|
for (const s of t)
|
|
7519
7641
|
delete n[s];
|
|
7520
|
-
return
|
|
7642
|
+
return M.setBindingData(e.getTarget(), n, {
|
|
7521
7643
|
kind: r?.kind ?? "supply",
|
|
7522
|
-
sequence: r?.sequence ??
|
|
7644
|
+
sequence: r?.sequence ?? w.nextSequence()
|
|
7523
7645
|
});
|
|
7524
7646
|
}
|
|
7525
7647
|
/**
|
|
@@ -7532,7 +7654,7 @@ const f = class f {
|
|
|
7532
7654
|
const t = `${c.prefix}form-arg`, r = e.getTarget().querySelectorAll(`form[${t}]`), i = [];
|
|
7533
7655
|
return r.forEach((n) => {
|
|
7534
7656
|
const s = N.get(n);
|
|
7535
|
-
if (!(s instanceof
|
|
7657
|
+
if (!(s instanceof w))
|
|
7536
7658
|
return;
|
|
7537
7659
|
const a = s.getAttribute(t);
|
|
7538
7660
|
a && i.push({ form: s, key: String(a) });
|
|
@@ -7555,15 +7677,15 @@ const f = class f {
|
|
|
7555
7677
|
* @returns 反映完了の Promise
|
|
7556
7678
|
*/
|
|
7557
7679
|
static pushAncestorArgValue(e, t, r, i = null) {
|
|
7558
|
-
const n = e.getTarget(), s =
|
|
7680
|
+
const n = e.getTarget(), s = h.createArgValueSignature(r);
|
|
7559
7681
|
if (s !== null) {
|
|
7560
|
-
if (
|
|
7682
|
+
if (h.LAST_ANCESTOR_ARG_VALUES.get(n) === s)
|
|
7561
7683
|
return Promise.resolve();
|
|
7562
|
-
|
|
7684
|
+
h.LAST_ANCESTOR_ARG_VALUES.set(n, s);
|
|
7563
7685
|
} else
|
|
7564
|
-
|
|
7686
|
+
h.LAST_ANCESTOR_ARG_VALUES.delete(n);
|
|
7565
7687
|
const a = e.getRawBindingData();
|
|
7566
|
-
return a && Object.prototype.hasOwnProperty.call(a, t) ?
|
|
7688
|
+
return a && Object.prototype.hasOwnProperty.call(a, t) ? h.releaseOwnCopy(e, [t], i) : h.syncValues(e, r, !1, i);
|
|
7567
7689
|
}
|
|
7568
7690
|
/**
|
|
7569
7691
|
* 流し込み済み判定に使う値の署名を作ります。
|
|
@@ -7602,23 +7724,23 @@ const f = class f {
|
|
|
7602
7724
|
});
|
|
7603
7725
|
const r = [];
|
|
7604
7726
|
for (const i of t) {
|
|
7605
|
-
if (
|
|
7727
|
+
if (h.INITIAL_RESTORED_FORMS.has(i))
|
|
7606
7728
|
continue;
|
|
7607
7729
|
const n = N.get(i);
|
|
7608
|
-
if (!(n instanceof
|
|
7730
|
+
if (!(n instanceof w))
|
|
7609
7731
|
continue;
|
|
7610
|
-
const s = n.getRawBindingData(), a = n.getAttribute(`${c.prefix}form-arg`), o = a ? String(a) : null, l = o !== null && !(s && Object.prototype.hasOwnProperty.call(s, o)) ?
|
|
7732
|
+
const s = n.getRawBindingData(), a = n.getAttribute(`${c.prefix}form-arg`), o = a ? String(a) : null, l = o !== null && !(s && Object.prototype.hasOwnProperty.call(s, o)) ? h.resolveAncestorArgOwner(n, o) : null;
|
|
7611
7733
|
if (!(!s && !l)) {
|
|
7612
|
-
if (
|
|
7734
|
+
if (h.INITIAL_RESTORED_FORMS.add(i), l) {
|
|
7613
7735
|
r.push(
|
|
7614
|
-
|
|
7736
|
+
h.pushAncestorArgValue(n, o, l.value)
|
|
7615
7737
|
);
|
|
7616
7738
|
continue;
|
|
7617
7739
|
}
|
|
7618
7740
|
r.push(
|
|
7619
|
-
|
|
7741
|
+
h.syncValues(
|
|
7620
7742
|
n,
|
|
7621
|
-
|
|
7743
|
+
h.resolveSyncValues(n, s)
|
|
7622
7744
|
)
|
|
7623
7745
|
);
|
|
7624
7746
|
}
|
|
@@ -7653,9 +7775,9 @@ const f = class f {
|
|
|
7653
7775
|
*/
|
|
7654
7776
|
static collectGroupSelection(e, t, r) {
|
|
7655
7777
|
const i = [];
|
|
7656
|
-
|
|
7657
|
-
|
|
7658
|
-
String(
|
|
7778
|
+
h.collectGroupMembers(
|
|
7779
|
+
h.resolveCollectionScope(e),
|
|
7780
|
+
String(h.resolveFieldName(e)),
|
|
7659
7781
|
i
|
|
7660
7782
|
);
|
|
7661
7783
|
let n = !1;
|
|
@@ -7665,9 +7787,9 @@ const f = class f {
|
|
|
7665
7787
|
const o = a.getTarget();
|
|
7666
7788
|
o instanceof HTMLInputElement && o.checked && s.push(o.value);
|
|
7667
7789
|
}
|
|
7668
|
-
return t ? { edited: n, value:
|
|
7790
|
+
return t ? { edited: n, value: h.markCompleteSet(s) } : s.length === 0 ? { edited: n, value: null } : {
|
|
7669
7791
|
edited: n,
|
|
7670
|
-
value: s.length === 1 ? s[0] :
|
|
7792
|
+
value: s.length === 1 ? s[0] : h.markCompleteSet(s)
|
|
7671
7793
|
};
|
|
7672
7794
|
}
|
|
7673
7795
|
/**
|
|
@@ -7682,7 +7804,7 @@ const f = class f {
|
|
|
7682
7804
|
* @returns 新しい階層を始める場合は true
|
|
7683
7805
|
*/
|
|
7684
7806
|
static startsCollectionLevel(e) {
|
|
7685
|
-
return
|
|
7807
|
+
return h.resolveFieldName(e) ? !1 : !!(e.getAttribute(`${c.prefix}form-object`) || e.getAttribute(`${c.prefix}form-list`));
|
|
7686
7808
|
}
|
|
7687
7809
|
/**
|
|
7688
7810
|
* 収集値の階層(同じキーの集まる範囲)となるフラグメントを解決します。
|
|
@@ -7703,9 +7825,9 @@ const f = class f {
|
|
|
7703
7825
|
static resolveCollectionScope(e) {
|
|
7704
7826
|
let t = e, r = t.getParent();
|
|
7705
7827
|
for (; r !== null; ) {
|
|
7706
|
-
if (
|
|
7828
|
+
if (h.startsCollectionLevel(r))
|
|
7707
7829
|
return r.getAttribute(`${c.prefix}form-object`) ? r : t;
|
|
7708
|
-
if (
|
|
7830
|
+
if (h.isFormScopeRoot(r))
|
|
7709
7831
|
return r;
|
|
7710
7832
|
t = r, r = r.getParent();
|
|
7711
7833
|
}
|
|
@@ -7738,11 +7860,11 @@ const f = class f {
|
|
|
7738
7860
|
* @param members 集める先
|
|
7739
7861
|
*/
|
|
7740
7862
|
static collectGroupMembers(e, t, r) {
|
|
7741
|
-
|
|
7863
|
+
h.isGroupedCheckable(e) && String(h.resolveFieldName(e)) === t && r.push(e);
|
|
7742
7864
|
for (const i of e.getChildElementFragments())
|
|
7743
|
-
|
|
7865
|
+
h.startsCollectionLevel(i) || i.hasAttribute(`${c.prefix}form-detach`) || // `data-if-false` は hide() が DOM へ直接付与するため実 DOM 属性を見る
|
|
7744
7866
|
// (`getPartValues()` と同じ理由)。
|
|
7745
|
-
i.getTarget().hasAttribute(`${c.prefix}if-false`) ||
|
|
7867
|
+
i.getTarget().hasAttribute(`${c.prefix}if-false`) || h.collectGroupMembers(i, t, r);
|
|
7746
7868
|
}
|
|
7747
7869
|
/**
|
|
7748
7870
|
* 「集合として完結した値」として印を付けます。
|
|
@@ -7756,7 +7878,7 @@ const f = class f {
|
|
|
7756
7878
|
* @returns 同じ配列
|
|
7757
7879
|
*/
|
|
7758
7880
|
static markCompleteSet(e) {
|
|
7759
|
-
return
|
|
7881
|
+
return h.COMPLETE_SET_VALUES.add(e), e;
|
|
7760
7882
|
}
|
|
7761
7883
|
/**
|
|
7762
7884
|
* 「集合として完結した値」の印が付いているかを返します。
|
|
@@ -7769,7 +7891,7 @@ const f = class f {
|
|
|
7769
7891
|
* @returns 印が付いていれば true
|
|
7770
7892
|
*/
|
|
7771
7893
|
static isCompleteSetValue(e) {
|
|
7772
|
-
return e !== null && typeof e == "object" &&
|
|
7894
|
+
return e !== null && typeof e == "object" && h.COMPLETE_SET_VALUES.has(e);
|
|
7773
7895
|
}
|
|
7774
7896
|
/**
|
|
7775
7897
|
* 値による上書きをグループ単位で扱うべき入力要素(boolean 型でない
|
|
@@ -7821,44 +7943,44 @@ const f = class f {
|
|
|
7821
7943
|
const o = [];
|
|
7822
7944
|
if (e.hasAttribute(`${c.prefix}form-detach`) && !r)
|
|
7823
7945
|
return Promise.resolve();
|
|
7824
|
-
const l =
|
|
7946
|
+
const l = h.resolveFieldName(e), u = e.getAttribute(`${c.prefix}form-object`), f = e.getAttribute(`${c.prefix}form-list`), m = e.hasAttribute(`${c.prefix}form-list`);
|
|
7825
7947
|
if (l) {
|
|
7826
|
-
const y = t[String(l)], E = n &&
|
|
7827
|
-
let
|
|
7828
|
-
if (E ?
|
|
7829
|
-
return (
|
|
7830
|
-
|
|
7948
|
+
const y = t[String(l)], E = n && h.hasResolvedDeclarativeState(e), A = n && typeof y > "u" && !h.isDeclarativeStateBound(e);
|
|
7949
|
+
let D = y;
|
|
7950
|
+
if (E ? D = void 0 : A && (D = null), h.isFileInput(e))
|
|
7951
|
+
return (D === null || D === "") && o.push(
|
|
7952
|
+
h.applyFragmentValue(e, null, i, a)
|
|
7831
7953
|
), Promise.all(o).then(() => {
|
|
7832
7954
|
});
|
|
7833
|
-
if (m && Array.isArray(
|
|
7955
|
+
if (m && Array.isArray(D) && // チェックボックスグループと複数選択 select は配列そのものを状態として
|
|
7834
7956
|
// 解釈する(後続の分岐)。位置で配ると選択状態を決められないため、
|
|
7835
7957
|
// `data-form-list` を併記していても従来どおりそちらへ渡す。
|
|
7836
|
-
!
|
|
7837
|
-
const
|
|
7838
|
-
s.set(
|
|
7839
|
-
|
|
7958
|
+
!h.isGroupedCheckable(e) && !h.isMultipleSelect(e)) {
|
|
7959
|
+
const C = String(l), P = s.get(C) ?? 0;
|
|
7960
|
+
s.set(C, P + 1), o.push(
|
|
7961
|
+
h.applyFragmentValue(
|
|
7840
7962
|
e,
|
|
7841
|
-
|
|
7963
|
+
D[P] ?? null,
|
|
7842
7964
|
i,
|
|
7843
7965
|
a
|
|
7844
7966
|
)
|
|
7845
7967
|
);
|
|
7846
|
-
} else typeof
|
|
7847
|
-
|
|
7968
|
+
} 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(
|
|
7969
|
+
h.applyFragmentValue(
|
|
7848
7970
|
e,
|
|
7849
|
-
|
|
7971
|
+
D,
|
|
7850
7972
|
i,
|
|
7851
7973
|
a
|
|
7852
7974
|
)
|
|
7853
7975
|
) : o.push(
|
|
7854
|
-
|
|
7976
|
+
h.applyFragmentValue(e, String(D), i, a)
|
|
7855
7977
|
));
|
|
7856
7978
|
} else if (u) {
|
|
7857
7979
|
const y = t[String(u)], E = y && typeof y == "object" ? y : {}, A = /* @__PURE__ */ new Map();
|
|
7858
|
-
for (const
|
|
7980
|
+
for (const D of e.getChildElementFragments())
|
|
7859
7981
|
o.push(
|
|
7860
|
-
|
|
7861
|
-
|
|
7982
|
+
h.setPartValues(
|
|
7983
|
+
D,
|
|
7862
7984
|
E,
|
|
7863
7985
|
r,
|
|
7864
7986
|
i,
|
|
@@ -7867,19 +7989,19 @@ const f = class f {
|
|
|
7867
7989
|
a
|
|
7868
7990
|
)
|
|
7869
7991
|
);
|
|
7870
|
-
} else if (
|
|
7871
|
-
const y = t[String(
|
|
7992
|
+
} else if (f) {
|
|
7993
|
+
const y = t[String(f)], E = Array.isArray(y) ? y : [], A = e.getChildElementFragments(), D = e.getAttribute(`${c.prefix}each-key`), C = h.isCollectedListFromEachSource(e) ? h.pairRowsWithItems(
|
|
7872
7994
|
A,
|
|
7873
7995
|
E,
|
|
7874
|
-
|
|
7996
|
+
D == null ? null : String(D)
|
|
7875
7997
|
) : null;
|
|
7876
7998
|
for (let P = 0; P < A.length; P++) {
|
|
7877
|
-
const ee = A[P], x =
|
|
7999
|
+
const ee = A[P], x = C ? C[P] : E.length > P ? E[P] : null;
|
|
7878
8000
|
o.push(
|
|
7879
8001
|
// 行ごとに values が切り替わるので出現位置も行単位で数える。
|
|
7880
|
-
|
|
8002
|
+
h.setPartValues(
|
|
7881
8003
|
ee,
|
|
7882
|
-
|
|
8004
|
+
h.asPlainRecord(x) ?? {},
|
|
7883
8005
|
r,
|
|
7884
8006
|
i,
|
|
7885
8007
|
n,
|
|
@@ -7891,7 +8013,7 @@ const f = class f {
|
|
|
7891
8013
|
} else
|
|
7892
8014
|
for (const y of e.getChildElementFragments())
|
|
7893
8015
|
o.push(
|
|
7894
|
-
|
|
8016
|
+
h.setPartValues(
|
|
7895
8017
|
y,
|
|
7896
8018
|
t,
|
|
7897
8019
|
r,
|
|
@@ -7919,54 +8041,54 @@ const f = class f {
|
|
|
7919
8041
|
* 番号を持つことになり、後勝ちが逆転する
|
|
7920
8042
|
* @returns すべての初期化処理が完了するPromise
|
|
7921
8043
|
*/
|
|
7922
|
-
static async reset(e, t =
|
|
7923
|
-
const r =
|
|
8044
|
+
static async reset(e, t = w.nextSequence()) {
|
|
8045
|
+
const r = h.collectBindingTargetForms(e);
|
|
7924
8046
|
if (r.length > 0 && r.every((n) => n.isSupplyStale(t)))
|
|
7925
8047
|
return;
|
|
7926
|
-
|
|
7927
|
-
|
|
7928
|
-
|
|
8048
|
+
h.markResetSubtree(e, t), M.clearUserEditMarks(e, t), h.clearValues(e), await Promise.all([
|
|
8049
|
+
h.clearMessages(e),
|
|
8050
|
+
h.clearEachClones(e)
|
|
7929
8051
|
]), await z.enqueue(() => {
|
|
7930
|
-
const n =
|
|
8052
|
+
const n = h.collectEditsAfter(
|
|
7931
8053
|
e,
|
|
7932
8054
|
t
|
|
7933
8055
|
), s = e.getTarget();
|
|
7934
|
-
|
|
8056
|
+
h.internalResetDepth += 1;
|
|
7935
8057
|
try {
|
|
7936
|
-
s instanceof HTMLFormElement ? s.reset() : (s.querySelectorAll("form").forEach((a) => a.reset()),
|
|
8058
|
+
s instanceof HTMLFormElement ? s.reset() : (s.querySelectorAll("form").forEach((a) => a.reset()), h.restoreDefaultValues(s));
|
|
7937
8059
|
} finally {
|
|
7938
|
-
|
|
8060
|
+
h.internalResetDepth -= 1;
|
|
7939
8061
|
}
|
|
7940
|
-
|
|
8062
|
+
h.clearDeclarativeStateFromDom(e), M.invalidateDerivedSubtreeSignatures(e), h.restoreEdits(n);
|
|
7941
8063
|
});
|
|
7942
8064
|
const i = r;
|
|
7943
8065
|
for (const n of i) {
|
|
7944
|
-
const s =
|
|
7945
|
-
s === null && n.getRawBindingData() === null || await
|
|
8066
|
+
const s = h.getInitialBindingData(n);
|
|
8067
|
+
s === null && n.getRawBindingData() === null || await M.setBindingData(n.getTarget(), s ?? {}, {
|
|
7946
8068
|
sequence: t
|
|
7947
8069
|
});
|
|
7948
8070
|
}
|
|
7949
|
-
|
|
8071
|
+
h.syncValuesFromDom(e), await M.evaluateAll(e);
|
|
7950
8072
|
for (const n of i)
|
|
7951
|
-
|
|
8073
|
+
h.getInitialBindingData(n) !== null || n.getRawBindingData() !== null || await h.restoreAncestorArgValues(n, {
|
|
7952
8074
|
sequence: t,
|
|
7953
8075
|
kind: "supply"
|
|
7954
8076
|
});
|
|
7955
8077
|
for (const n of i) {
|
|
7956
|
-
const s =
|
|
8078
|
+
const s = h.getInitialBindingData(n);
|
|
7957
8079
|
if (n.getRawBindingData() === null && s === null)
|
|
7958
8080
|
continue;
|
|
7959
|
-
const a =
|
|
8081
|
+
const a = h.getValues(n), o = n.getAttribute(`${c.prefix}form-arg`);
|
|
7960
8082
|
let l = { ...s || {} };
|
|
7961
8083
|
if (o) {
|
|
7962
8084
|
const u = String(o);
|
|
7963
|
-
!Object.prototype.hasOwnProperty.call(s ?? {}, u) &&
|
|
8085
|
+
!Object.prototype.hasOwnProperty.call(s ?? {}, u) && h.resolveAncestorArgOwner(n, u) !== null || (l[u] = h.mergeCollectedValues(
|
|
7964
8086
|
l[u] ?? null,
|
|
7965
8087
|
a
|
|
7966
8088
|
));
|
|
7967
8089
|
} else
|
|
7968
|
-
l =
|
|
7969
|
-
await
|
|
8090
|
+
l = h.mergeCollectedValues(l, a), h.deleteAncestorOwnedKeys(n, s, l);
|
|
8091
|
+
await M.setBindingData(n.getTarget(), l, {
|
|
7970
8092
|
sequence: t
|
|
7971
8093
|
});
|
|
7972
8094
|
}
|
|
@@ -7984,7 +8106,7 @@ const f = class f {
|
|
|
7984
8106
|
*/
|
|
7985
8107
|
static deleteAncestorOwnedKeys(e, t, r) {
|
|
7986
8108
|
for (const i of Object.keys(r))
|
|
7987
|
-
Object.prototype.hasOwnProperty.call(t ?? {}, i) ||
|
|
8109
|
+
Object.prototype.hasOwnProperty.call(t ?? {}, i) || h.resolveAncestorKeyOwner(e, i) !== null && delete r[i];
|
|
7988
8110
|
}
|
|
7989
8111
|
/**
|
|
7990
8112
|
* data-bind 属性で宣言された初期バインドデータを取得します。
|
|
@@ -7994,7 +8116,7 @@ const f = class f {
|
|
|
7994
8116
|
*/
|
|
7995
8117
|
static getInitialBindingData(e) {
|
|
7996
8118
|
const t = e.getInitialBindAttribute();
|
|
7997
|
-
return t === null ? null :
|
|
8119
|
+
return t === null ? null : M.parseDataBind(t);
|
|
7998
8120
|
}
|
|
7999
8121
|
/**
|
|
8000
8122
|
* フラグメント配下の入力要素について、内部値を現在の DOM 値と再同期します。
|
|
@@ -8005,7 +8127,7 @@ const f = class f {
|
|
|
8005
8127
|
const t = e.getTarget();
|
|
8006
8128
|
(t instanceof HTMLInputElement || t instanceof HTMLTextAreaElement || t instanceof HTMLSelectElement) && e.syncValue();
|
|
8007
8129
|
for (const r of e.getChildElementFragments())
|
|
8008
|
-
|
|
8130
|
+
h.syncValuesFromDom(r);
|
|
8009
8131
|
}
|
|
8010
8132
|
/**
|
|
8011
8133
|
* リセット後にバインドデータを更新すべきフォームフラグメントを収集します。
|
|
@@ -8022,7 +8144,7 @@ const f = class f {
|
|
|
8022
8144
|
const i = [];
|
|
8023
8145
|
for (const n of r) {
|
|
8024
8146
|
const s = N.get(n);
|
|
8025
|
-
s instanceof
|
|
8147
|
+
s instanceof w && i.push(s);
|
|
8026
8148
|
}
|
|
8027
8149
|
return i;
|
|
8028
8150
|
}
|
|
@@ -8060,7 +8182,7 @@ const f = class f {
|
|
|
8060
8182
|
static clearValues(e) {
|
|
8061
8183
|
e.clearValue();
|
|
8062
8184
|
for (const t of e.getChildElementFragments())
|
|
8063
|
-
|
|
8185
|
+
h.clearValues(t);
|
|
8064
8186
|
}
|
|
8065
8187
|
/**
|
|
8066
8188
|
* 指定した通番より後に編集された入力欄の DOM の状態を控えます。
|
|
@@ -8084,7 +8206,7 @@ const f = class f {
|
|
|
8084
8206
|
)
|
|
8085
8207
|
}) : r.push({ element: i, value: i.value }));
|
|
8086
8208
|
for (const n of e.getChildElementFragments())
|
|
8087
|
-
|
|
8209
|
+
h.collectEditsAfter(n, t, r);
|
|
8088
8210
|
return r;
|
|
8089
8211
|
}
|
|
8090
8212
|
/**
|
|
@@ -8126,8 +8248,8 @@ const f = class f {
|
|
|
8126
8248
|
const r = e.getAttribute(`${c.prefix}form-arg`);
|
|
8127
8249
|
if (!r)
|
|
8128
8250
|
return;
|
|
8129
|
-
const i = String(r), n =
|
|
8130
|
-
n && (
|
|
8251
|
+
const i = String(r), n = h.resolveAncestorArgOwner(e, i);
|
|
8252
|
+
n && (h.LAST_ANCESTOR_ARG_VALUES.delete(e.getTarget()), await h.pushAncestorArgValue(e, i, n.value, t));
|
|
8131
8253
|
}
|
|
8132
8254
|
/**
|
|
8133
8255
|
* 初期化の通番を部分木のすべてのフラグメントへ記録します。
|
|
@@ -8143,7 +8265,7 @@ const f = class f {
|
|
|
8143
8265
|
static markResetSubtree(e, t) {
|
|
8144
8266
|
e.markResetAt(t), e.markSupplyApplied(t);
|
|
8145
8267
|
for (const r of e.getChildElementFragments())
|
|
8146
|
-
|
|
8268
|
+
h.markResetSubtree(r, t);
|
|
8147
8269
|
}
|
|
8148
8270
|
/**
|
|
8149
8271
|
* フラグメントとその子要素のメッセージをクリアします。
|
|
@@ -8166,7 +8288,7 @@ const f = class f {
|
|
|
8166
8288
|
* @return Promise(メッセージの追加が完了したら解決される)
|
|
8167
8289
|
*/
|
|
8168
8290
|
static addErrorMessage(e, t, r) {
|
|
8169
|
-
return
|
|
8291
|
+
return h.addMessage(e, t, r, "error");
|
|
8170
8292
|
}
|
|
8171
8293
|
/**
|
|
8172
8294
|
* キーに一致するフラグメントにレベル付きメッセージを追加します。
|
|
@@ -8179,8 +8301,8 @@ const f = class f {
|
|
|
8179
8301
|
* @return Promise(メッセージの追加が完了したら解決される)
|
|
8180
8302
|
*/
|
|
8181
8303
|
static addMessage(e, t, r, i) {
|
|
8182
|
-
const n = [], s = et(), a = s.addMessage, o = (u) => typeof a == "function" ? a.call(s, u, r, i) : s.addErrorMessage(u, r), l =
|
|
8183
|
-
|
|
8304
|
+
const n = [], s = et(), a = s.addMessage, o = (u) => typeof a == "function" ? a.call(s, u, r, i) : s.addErrorMessage(u, r), l = h.keepFirstRadio(
|
|
8305
|
+
h.findFragmentsByKey(e, t)
|
|
8184
8306
|
);
|
|
8185
8307
|
return l.forEach((u) => {
|
|
8186
8308
|
n.push(o(u.getTarget()));
|
|
@@ -8212,7 +8334,7 @@ const f = class f {
|
|
|
8212
8334
|
* @returns 一致するフラグメントの配列
|
|
8213
8335
|
*/
|
|
8214
8336
|
static findFragmentsByKey(e, t) {
|
|
8215
|
-
return
|
|
8337
|
+
return h.findFragmentByKeyParts(e, t.split("."));
|
|
8216
8338
|
}
|
|
8217
8339
|
/**
|
|
8218
8340
|
* 指定されたキーに一致するフラグメントを検索します。
|
|
@@ -8224,9 +8346,9 @@ const f = class f {
|
|
|
8224
8346
|
*/
|
|
8225
8347
|
static findFragmentByKeyParts(e, t) {
|
|
8226
8348
|
const r = [], i = t[0];
|
|
8227
|
-
if (t.length == 1 &&
|
|
8349
|
+
if (t.length == 1 && h.resolveFieldName(e) === i && r.push(e), e.hasAttribute(`${c.prefix}form-object`))
|
|
8228
8350
|
t.length > 1 && e.getAttribute(`${c.prefix}form-object`) === i && e.getChildElementFragments().forEach((s) => {
|
|
8229
|
-
r.push(...
|
|
8351
|
+
r.push(...h.findFragmentByKeyParts(s, t.slice(1)));
|
|
8230
8352
|
});
|
|
8231
8353
|
else if (e.hasAttribute(`${c.prefix}form-list`)) {
|
|
8232
8354
|
if (t.length > 1) {
|
|
@@ -8238,9 +8360,9 @@ const f = class f {
|
|
|
8238
8360
|
if (isNaN(u))
|
|
8239
8361
|
g.error("Haori", `Invalid index: ${i}`);
|
|
8240
8362
|
else {
|
|
8241
|
-
const
|
|
8242
|
-
u <
|
|
8243
|
-
...
|
|
8363
|
+
const f = e.getChildElementFragments().filter((m) => m.hasAttribute(`${c.prefix}row`));
|
|
8364
|
+
u < f.length && r.push(
|
|
8365
|
+
...h.findFragmentByKeyParts(f[u], t.slice(1))
|
|
8244
8366
|
);
|
|
8245
8367
|
}
|
|
8246
8368
|
}
|
|
@@ -8248,7 +8370,7 @@ const f = class f {
|
|
|
8248
8370
|
}
|
|
8249
8371
|
} else
|
|
8250
8372
|
e.getChildElementFragments().forEach((n) => {
|
|
8251
|
-
r.push(...
|
|
8373
|
+
r.push(...h.findFragmentByKeyParts(n, t));
|
|
8252
8374
|
});
|
|
8253
8375
|
return r;
|
|
8254
8376
|
}
|
|
@@ -8271,12 +8393,12 @@ const f = class f {
|
|
|
8271
8393
|
return r ? this.getFormFragment(r) : null;
|
|
8272
8394
|
}
|
|
8273
8395
|
};
|
|
8274
|
-
|
|
8396
|
+
h.INITIAL_RESTORED_FORMS = /* @__PURE__ */ new WeakSet(), h.LAST_ANCESTOR_ARG_VALUES = /* @__PURE__ */ new WeakMap(), h.GROUP_SCOPE_IDS = /* @__PURE__ */ new WeakMap(), h.groupScopeSequence = 0, h.internalResetDepth = 0, h.warnedArgOwnerNotRecord = /* @__PURE__ */ new WeakMap(), h.UNSAFE_MERGE_KEYS = /* @__PURE__ */ new Set([
|
|
8275
8397
|
"__proto__",
|
|
8276
8398
|
"constructor",
|
|
8277
8399
|
"prototype"
|
|
8278
|
-
]),
|
|
8279
|
-
let F =
|
|
8400
|
+
]), 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]*)$/;
|
|
8401
|
+
let F = h;
|
|
8280
8402
|
class B {
|
|
8281
8403
|
/**
|
|
8282
8404
|
* カスタムイベントを発火します。
|
|
@@ -8351,8 +8473,8 @@ class B {
|
|
|
8351
8473
|
static bindChange(e, t, r, i = "other") {
|
|
8352
8474
|
const n = [], s = new Set(Object.keys(t || {})), a = new Set(Object.keys(r)), o = /* @__PURE__ */ new Set([...s, ...a]);
|
|
8353
8475
|
for (const l of o) {
|
|
8354
|
-
const u = t?.[l],
|
|
8355
|
-
u !==
|
|
8476
|
+
const u = t?.[l], f = r[l];
|
|
8477
|
+
u !== f && n.push(l);
|
|
8356
8478
|
}
|
|
8357
8479
|
B.dispatch(e, "bindchange", {
|
|
8358
8480
|
previous: t || {},
|
|
@@ -8536,7 +8658,7 @@ function Ot(b, e) {
|
|
|
8536
8658
|
return null;
|
|
8537
8659
|
if (!t.includes("{{"))
|
|
8538
8660
|
return t;
|
|
8539
|
-
const r = N.get(b), i = r instanceof
|
|
8661
|
+
const r = N.get(b), i = r instanceof w ? r.getBindingData() : {}, n = Lt(t, i);
|
|
8540
8662
|
return n === "" ? null : n;
|
|
8541
8663
|
}
|
|
8542
8664
|
function Bt(b, e, t) {
|
|
@@ -8709,7 +8831,7 @@ const k = class k {
|
|
|
8709
8831
|
* @returns 予約キーなら true
|
|
8710
8832
|
*/
|
|
8711
8833
|
static isReservedKey(e) {
|
|
8712
|
-
return
|
|
8834
|
+
return w.isReservedBindingKey(e);
|
|
8713
8835
|
}
|
|
8714
8836
|
/**
|
|
8715
8837
|
* 素の JSON オブジェクト(配列でないオブジェクト)かどうかを判定します。
|
|
@@ -8780,18 +8902,18 @@ const k = class k {
|
|
|
8780
8902
|
const n = e.getRawAttribute(`${c.prefix}store-type`);
|
|
8781
8903
|
let s = "session";
|
|
8782
8904
|
if (n !== null) {
|
|
8783
|
-
const
|
|
8784
|
-
|
|
8905
|
+
const f = n.trim();
|
|
8906
|
+
f === "local" || f === "session" ? s = f : k.warnOnce(
|
|
8785
8907
|
t,
|
|
8786
8908
|
"type",
|
|
8787
|
-
`${c.prefix}store-type は session または local を指定してください(session として扱います): ${
|
|
8909
|
+
`${c.prefix}store-type は session または local を指定してください(session として扱います): ${f}`
|
|
8788
8910
|
);
|
|
8789
8911
|
}
|
|
8790
8912
|
const a = e.getRawAttribute(`${c.prefix}store-arg`), o = a === null || a.trim() === "" ? null : a.trim(), l = e.getRawAttribute(`${c.prefix}store-params`);
|
|
8791
8913
|
let u = null;
|
|
8792
8914
|
if (l !== null) {
|
|
8793
|
-
const
|
|
8794
|
-
m.length !==
|
|
8915
|
+
const f = l.split("&").map((y) => y.trim()).filter((y) => y !== ""), m = f.filter((y) => !k.isReservedKey(y));
|
|
8916
|
+
m.length !== f.length && k.warnOnce(
|
|
8795
8917
|
t,
|
|
8796
8918
|
"reserved",
|
|
8797
8919
|
`${c.prefix}store-params の予約キー(先頭が _ のキー)は対象外です。`
|
|
@@ -9003,10 +9125,10 @@ const k = class k {
|
|
|
9003
9125
|
), Promise.resolve();
|
|
9004
9126
|
k.RESTORED_ELEMENTS.add(r);
|
|
9005
9127
|
const i = k.readRecord(t), n = i ? k.extractFromRecord(t, i) : {}, s = { ...e.getRawBindingData() ?? {}, ...n };
|
|
9006
|
-
return k.seedSignature(r, k.selectFromData(t, s)), Object.keys(n).length === 0 ? Promise.resolve() :
|
|
9128
|
+
return k.seedSignature(r, k.selectFromData(t, s)), Object.keys(n).length === 0 ? Promise.resolve() : M.setBindingData(r, s, {
|
|
9007
9129
|
reentrant: !0,
|
|
9008
9130
|
kind: "nonSupply",
|
|
9009
|
-
sequence:
|
|
9131
|
+
sequence: w.nextSequence()
|
|
9010
9132
|
});
|
|
9011
9133
|
}
|
|
9012
9134
|
/**
|
|
@@ -9084,7 +9206,7 @@ const k = class k {
|
|
|
9084
9206
|
if (!k.RESTORED_ELEMENTS.has(i))
|
|
9085
9207
|
return;
|
|
9086
9208
|
const n = N.get(i);
|
|
9087
|
-
if (!(n instanceof
|
|
9209
|
+
if (!(n instanceof w))
|
|
9088
9210
|
return;
|
|
9089
9211
|
const s = k.readDeclaration(n);
|
|
9090
9212
|
if (!s || s.key !== e || s.kind !== t)
|
|
@@ -9099,7 +9221,7 @@ const k = class k {
|
|
|
9099
9221
|
};
|
|
9100
9222
|
k.SIGNATURES = /* @__PURE__ */ new WeakMap(), k.RESTORED_ELEMENTS = /* @__PURE__ */ new WeakSet(), k.WARNED_ELEMENTS = /* @__PURE__ */ new WeakMap(), k.WARNED_KINDS = /* @__PURE__ */ new Set();
|
|
9101
9223
|
let Ne = k;
|
|
9102
|
-
const
|
|
9224
|
+
const Ht = [
|
|
9103
9225
|
"addErrorMessage",
|
|
9104
9226
|
"clearMessages",
|
|
9105
9227
|
"closeDialog",
|
|
@@ -9107,12 +9229,12 @@ const Ut = [
|
|
|
9107
9229
|
"dialog",
|
|
9108
9230
|
"openDialog",
|
|
9109
9231
|
"toast"
|
|
9110
|
-
],
|
|
9232
|
+
], Ut = "__haoriHistoryState__", qe = "data-haori-click-lock", tt = "ファイルを保存できませんでした", Vt = 100;
|
|
9111
9233
|
let Te = null;
|
|
9112
9234
|
const qt = ["info", "warning", "error", "success"], rt = /^(\d{3})-(click|click-await|close|toast|toast-level|no-message|bind)$/;
|
|
9113
|
-
function
|
|
9235
|
+
function fe() {
|
|
9114
9236
|
const e = globalThis.window?.Haori;
|
|
9115
|
-
return
|
|
9237
|
+
return Ht.every(
|
|
9116
9238
|
(r) => typeof e?.[r] == "function"
|
|
9117
9239
|
) ? e : Re;
|
|
9118
9240
|
}
|
|
@@ -9172,7 +9294,7 @@ function Kt(b) {
|
|
|
9172
9294
|
t = !0;
|
|
9173
9295
|
continue;
|
|
9174
9296
|
}
|
|
9175
|
-
|
|
9297
|
+
St(e, r, i);
|
|
9176
9298
|
}
|
|
9177
9299
|
return { payload: e, dropped: t };
|
|
9178
9300
|
}
|
|
@@ -9181,10 +9303,10 @@ function Kt(b) {
|
|
|
9181
9303
|
function it(b) {
|
|
9182
9304
|
const e = {};
|
|
9183
9305
|
for (const [t, r] of b.entries())
|
|
9184
|
-
|
|
9306
|
+
St(e, t, r);
|
|
9185
9307
|
return e;
|
|
9186
9308
|
}
|
|
9187
|
-
function
|
|
9309
|
+
function St(b, e, t) {
|
|
9188
9310
|
const r = b[e];
|
|
9189
9311
|
r === void 0 ? b[e] = t : Array.isArray(r) ? r.push(t) : b[e] = [r, t];
|
|
9190
9312
|
}
|
|
@@ -9312,7 +9434,7 @@ const p = class p {
|
|
|
9312
9434
|
* @param domEvent 起点となった DOM イベント
|
|
9313
9435
|
*/
|
|
9314
9436
|
constructor(e, t = null, r = null) {
|
|
9315
|
-
this.reentrantBind = !1, this.suppressEmptyReplaceBind = !1, this.requestUserEditSequence = null, this.downloadReceivedBytes = 0, this.downloadTotalBytes = null, this.downloadFolder = null, this.twoWayCommitBind = !1, this.skipped = !1, this.operationSequence = r != null ?
|
|
9437
|
+
this.reentrantBind = !1, this.suppressEmptyReplaceBind = !1, this.requestUserEditSequence = null, this.downloadReceivedBytes = 0, this.downloadTotalBytes = null, this.downloadFolder = null, this.twoWayCommitBind = !1, this.skipped = !1, this.operationSequence = r != null ? w.nextOperationSequence() : w.nextSequence(), p.isElementFragment(e) ? (this.options = p.buildOptions(e, t), this.eventType = t) : (this.options = e, this.eventType = null), this.domEvent = r;
|
|
9316
9438
|
}
|
|
9317
9439
|
/**
|
|
9318
9440
|
* クリックで起動した手続きの結果を控えます。
|
|
@@ -9586,7 +9708,7 @@ const p = class p {
|
|
|
9586
9708
|
const r = e.getRawAttribute(t);
|
|
9587
9709
|
let i;
|
|
9588
9710
|
try {
|
|
9589
|
-
i =
|
|
9711
|
+
i = M.parseDataBind(r);
|
|
9590
9712
|
} catch (n) {
|
|
9591
9713
|
return g.error("Haori", `Invalid fetch headers: ${n}`), null;
|
|
9592
9714
|
}
|
|
@@ -9784,7 +9906,7 @@ const p = class p {
|
|
|
9784
9906
|
const a = r.trim();
|
|
9785
9907
|
if (p.SINGLE_PLACEHOLDER_REGEX.test(a))
|
|
9786
9908
|
return {
|
|
9787
|
-
value:
|
|
9909
|
+
value: M.parseDataBind(n),
|
|
9788
9910
|
hasUnresolvedReference: s
|
|
9789
9911
|
};
|
|
9790
9912
|
if (a.startsWith("{") || a.startsWith("[")) {
|
|
@@ -9793,7 +9915,7 @@ const p = class p {
|
|
|
9793
9915
|
e.getBindingData()
|
|
9794
9916
|
);
|
|
9795
9917
|
return {
|
|
9796
|
-
value:
|
|
9918
|
+
value: M.parseDataBind(l.value),
|
|
9797
9919
|
hasUnresolvedReference: s || l.hasUnresolvedReference
|
|
9798
9920
|
};
|
|
9799
9921
|
}
|
|
@@ -9802,7 +9924,7 @@ const p = class p {
|
|
|
9802
9924
|
e.getBindingData()
|
|
9803
9925
|
);
|
|
9804
9926
|
return {
|
|
9805
|
-
value:
|
|
9927
|
+
value: M.parseDataBind(o.value),
|
|
9806
9928
|
hasUnresolvedReference: s || o.hasUnresolvedReference
|
|
9807
9929
|
};
|
|
9808
9930
|
}
|
|
@@ -9907,10 +10029,10 @@ ${$}
|
|
|
9907
10029
|
l
|
|
9908
10030
|
);
|
|
9909
10031
|
u !== null && (a.headers = u);
|
|
9910
|
-
const
|
|
10032
|
+
const f = t ? p.attrName(t, "fetch-content-type") : p.attrName(null, "content-type", !0);
|
|
9911
10033
|
let m = null;
|
|
9912
|
-
if (e.hasAttribute(
|
|
9913
|
-
const R = e.getAttributeEvaluation(
|
|
10034
|
+
if (e.hasAttribute(f)) {
|
|
10035
|
+
const R = e.getAttributeEvaluation(f);
|
|
9914
10036
|
R?.hasUnresolvedReference && (r.fetchHasUnresolvedReference = !0), m = p.normalizeAttributeText(
|
|
9915
10037
|
R?.value
|
|
9916
10038
|
);
|
|
@@ -9958,9 +10080,9 @@ ${$}
|
|
|
9958
10080
|
);
|
|
9959
10081
|
}
|
|
9960
10082
|
}
|
|
9961
|
-
const
|
|
9962
|
-
t ? e.hasAttribute(
|
|
9963
|
-
|
|
10083
|
+
const D = p.attrName(t, "bind-arg"), C = p.attrName(null, "arg", !0), P = p.attrName(null, "bind-arg", !0);
|
|
10084
|
+
t ? e.hasAttribute(D) && (r.bindArg = e.getRawAttribute(D)) : e.hasAttribute(C) ? r.bindArg = e.getRawAttribute(
|
|
10085
|
+
C
|
|
9964
10086
|
) : e.hasAttribute(P) && (r.bindArg = e.getRawAttribute(P));
|
|
9965
10087
|
const ee = t ? p.attrName(t, "bind-params") : p.attrName(null, "bind-params", !0);
|
|
9966
10088
|
if (e.hasAttribute(ee)) {
|
|
@@ -9983,13 +10105,13 @@ ${$}
|
|
|
9983
10105
|
}
|
|
9984
10106
|
if (t) {
|
|
9985
10107
|
if (e.hasAttribute(p.attrName(t, "adjust"))) {
|
|
9986
|
-
const
|
|
10108
|
+
const H = W.read(
|
|
9987
10109
|
e,
|
|
9988
10110
|
p.attrName(t, "adjust")
|
|
9989
10111
|
);
|
|
9990
|
-
if (
|
|
10112
|
+
if (H) {
|
|
9991
10113
|
const G = W.queryAll(
|
|
9992
|
-
|
|
10114
|
+
H,
|
|
9993
10115
|
p.attrName(t, "adjust")
|
|
9994
10116
|
);
|
|
9995
10117
|
G.length > 0 ? (r.adjustFragments = [], G.forEach((Z) => {
|
|
@@ -9997,7 +10119,7 @@ ${$}
|
|
|
9997
10119
|
Ie && r.adjustFragments.push(Ie);
|
|
9998
10120
|
})) : g.error(
|
|
9999
10121
|
"Haori",
|
|
10000
|
-
`Adjust element not found: ${
|
|
10122
|
+
`Adjust element not found: ${H} (${p.attrName(t, "adjust")})`
|
|
10001
10123
|
);
|
|
10002
10124
|
}
|
|
10003
10125
|
if (e.hasAttribute(p.attrName(t, "adjust-value"))) {
|
|
@@ -10008,7 +10130,7 @@ ${$}
|
|
|
10008
10130
|
}
|
|
10009
10131
|
}
|
|
10010
10132
|
if (e.hasAttribute(p.attrName(t, "row-add")) && (r.rowAdd = !0), e.hasAttribute(p.attrName(t, "row-remove")) && (r.rowRemove = !0), e.hasAttribute(p.attrName(t, "row-prev")) && (r.rowMovePrev = !0), e.hasAttribute(p.attrName(t, "row-next")) && (r.rowMoveNext = !0), e.hasAttribute(`${c.prefix}${t}-after-run`)) {
|
|
10011
|
-
const
|
|
10133
|
+
const H = e.getRawAttribute(
|
|
10012
10134
|
`${c.prefix}${t}-after-run`
|
|
10013
10135
|
);
|
|
10014
10136
|
try {
|
|
@@ -10016,7 +10138,7 @@ ${$}
|
|
|
10016
10138
|
"response",
|
|
10017
10139
|
`
|
|
10018
10140
|
"use strict";
|
|
10019
|
-
${
|
|
10141
|
+
${H}
|
|
10020
10142
|
`
|
|
10021
10143
|
);
|
|
10022
10144
|
} catch (G) {
|
|
@@ -10041,12 +10163,12 @@ ${U}
|
|
|
10041
10163
|
"toast-level",
|
|
10042
10164
|
p.attrName(t, "toast-level")
|
|
10043
10165
|
)), t !== "poll") {
|
|
10044
|
-
const
|
|
10045
|
-
e.hasAttribute(
|
|
10166
|
+
const H = p.attrName(t, "error-toast");
|
|
10167
|
+
e.hasAttribute(H) && (r.errorToastMessage = p.readLateAttribute(
|
|
10046
10168
|
e,
|
|
10047
10169
|
r,
|
|
10048
10170
|
"error-toast",
|
|
10049
|
-
|
|
10171
|
+
H
|
|
10050
10172
|
), r.errorToastLevel = p.readToastLevel(
|
|
10051
10173
|
e,
|
|
10052
10174
|
r,
|
|
@@ -10075,15 +10197,15 @@ ${U}
|
|
|
10075
10197
|
"redirect-replace",
|
|
10076
10198
|
$
|
|
10077
10199
|
)), K || _) {
|
|
10078
|
-
const
|
|
10200
|
+
const H = p.attrName(
|
|
10079
10201
|
t,
|
|
10080
10202
|
"redirect-return-param"
|
|
10081
10203
|
);
|
|
10082
|
-
e.hasAttribute(
|
|
10204
|
+
e.hasAttribute(H) && (r.redirectReturnParam = p.readLateAttribute(
|
|
10083
10205
|
e,
|
|
10084
10206
|
r,
|
|
10085
10207
|
"redirect-return-param",
|
|
10086
|
-
|
|
10208
|
+
H
|
|
10087
10209
|
));
|
|
10088
10210
|
}
|
|
10089
10211
|
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(
|
|
@@ -10097,20 +10219,20 @@ ${U}
|
|
|
10097
10219
|
"history",
|
|
10098
10220
|
p.attrName(t, "history")
|
|
10099
10221
|
)), e.hasAttribute(p.attrName(t, "history-data")) && (r.historyDataAttrName = p.attrName(t, "history-data")), e.hasAttribute(p.attrName(t, "history-form"))) {
|
|
10100
|
-
const
|
|
10222
|
+
const H = W.read(
|
|
10101
10223
|
e,
|
|
10102
10224
|
p.attrName(t, "history-form")
|
|
10103
10225
|
);
|
|
10104
|
-
if (
|
|
10226
|
+
if (H) {
|
|
10105
10227
|
const G = W.query(
|
|
10106
|
-
|
|
10228
|
+
H,
|
|
10107
10229
|
p.attrName(t, "history-form")
|
|
10108
10230
|
);
|
|
10109
10231
|
G !== null ? r.historyFormFragment = F.getFormFragment(
|
|
10110
10232
|
N.get(G)
|
|
10111
10233
|
) : g.error(
|
|
10112
10234
|
"Haori",
|
|
10113
|
-
`Form element not found: ${
|
|
10235
|
+
`Form element not found: ${H} (${p.attrName(t, "history-form")})`
|
|
10114
10236
|
);
|
|
10115
10237
|
} else
|
|
10116
10238
|
r.historyFormFragment = F.getFormFragment(e);
|
|
@@ -10125,19 +10247,19 @@ ${U}
|
|
|
10125
10247
|
"close",
|
|
10126
10248
|
"error-click",
|
|
10127
10249
|
"error-close"
|
|
10128
|
-
].forEach((
|
|
10129
|
-
if (
|
|
10250
|
+
].forEach((H) => {
|
|
10251
|
+
if (H.startsWith("error-") && t === "poll")
|
|
10130
10252
|
return;
|
|
10131
|
-
const G = p.attrName(t,
|
|
10253
|
+
const G = p.attrName(t, H);
|
|
10132
10254
|
if (!e.hasAttribute(G))
|
|
10133
10255
|
return;
|
|
10134
10256
|
const Z = p.resolveSelectorTargets(
|
|
10135
10257
|
e,
|
|
10136
10258
|
G,
|
|
10137
|
-
|
|
10259
|
+
H
|
|
10138
10260
|
);
|
|
10139
10261
|
if (Z.length > 0)
|
|
10140
|
-
switch (
|
|
10262
|
+
switch (H) {
|
|
10141
10263
|
case "reset-before":
|
|
10142
10264
|
r.resetBeforeFragments = Z;
|
|
10143
10265
|
break;
|
|
@@ -10175,19 +10297,19 @@ ${U}
|
|
|
10175
10297
|
));
|
|
10176
10298
|
const oe = p.attrName(t, "copy-source");
|
|
10177
10299
|
if (e.hasAttribute(oe)) {
|
|
10178
|
-
const
|
|
10179
|
-
if (
|
|
10180
|
-
const G = W.query(
|
|
10300
|
+
const H = W.read(e, oe);
|
|
10301
|
+
if (H) {
|
|
10302
|
+
const G = W.query(H, oe);
|
|
10181
10303
|
if (G !== null) {
|
|
10182
10304
|
const Z = N.get(G);
|
|
10183
10305
|
Z ? r.copySourceFragment = Z : g.error(
|
|
10184
10306
|
"Haori",
|
|
10185
|
-
`Element is not managed by Haori: ${
|
|
10307
|
+
`Element is not managed by Haori: ${H} (${oe})`
|
|
10186
10308
|
);
|
|
10187
10309
|
} else
|
|
10188
10310
|
g.error(
|
|
10189
10311
|
"Haori",
|
|
10190
|
-
`Element not found: ${
|
|
10312
|
+
`Element not found: ${H} (${oe})`
|
|
10191
10313
|
);
|
|
10192
10314
|
} else
|
|
10193
10315
|
r.copySourceFragment = e;
|
|
@@ -10380,7 +10502,7 @@ ${U}
|
|
|
10380
10502
|
)
|
|
10381
10503
|
), this.captureHistorySnapshots());
|
|
10382
10504
|
const r = this.prepareFetchRequest();
|
|
10383
|
-
this.requestUserEditSequence =
|
|
10505
|
+
this.requestUserEditSequence = w.currentSequence();
|
|
10384
10506
|
const i = r.payload;
|
|
10385
10507
|
let n = r.url, s = r.options, a = !1, o = !1;
|
|
10386
10508
|
if (this.options.beforeCallback) {
|
|
@@ -10406,10 +10528,10 @@ ${U}
|
|
|
10406
10528
|
s
|
|
10407
10529
|
);
|
|
10408
10530
|
n = A.url;
|
|
10409
|
-
const
|
|
10531
|
+
const D = { ...A.options }, C = A.normalized ? A.requestedMethod : r.requestedMethod, P = A.effectiveMethod, ee = r.transportMode === "query-get" || A.normalized, x = A.queryString ?? r.queryString;
|
|
10410
10532
|
if (ee && g.info("Haori demo fetch normalization", {
|
|
10411
10533
|
runtime: c.runtime,
|
|
10412
|
-
requestedMethod:
|
|
10534
|
+
requestedMethod: C,
|
|
10413
10535
|
effectiveMethod: P,
|
|
10414
10536
|
transportMode: "query-get",
|
|
10415
10537
|
url: n,
|
|
@@ -10418,7 +10540,7 @@ ${U}
|
|
|
10418
10540
|
}), this.options.targetFragment && n) {
|
|
10419
10541
|
const Y = performance.now(), Q = {
|
|
10420
10542
|
runtime: c.runtime,
|
|
10421
|
-
requestedMethod:
|
|
10543
|
+
requestedMethod: C,
|
|
10422
10544
|
effectiveMethod: P,
|
|
10423
10545
|
transportMode: ee ? "query-get" : "http",
|
|
10424
10546
|
...ee ? { queryString: x } : {}
|
|
@@ -10426,10 +10548,10 @@ ${U}
|
|
|
10426
10548
|
return B.fetchStart(
|
|
10427
10549
|
this.options.targetFragment.getTarget(),
|
|
10428
10550
|
n,
|
|
10429
|
-
|
|
10551
|
+
D,
|
|
10430
10552
|
l ? i : void 0,
|
|
10431
10553
|
Q
|
|
10432
|
-
), await this.injectFetchState("loading"), await p.invokeFetch(n,
|
|
10554
|
+
), await this.injectFetchState("loading"), await p.invokeFetch(n, D).then((X) => this.handleFetchResult(
|
|
10433
10555
|
X,
|
|
10434
10556
|
n || void 0,
|
|
10435
10557
|
Y
|
|
@@ -10445,17 +10567,17 @@ ${U}
|
|
|
10445
10567
|
), await this.runErrorActions(null), X;
|
|
10446
10568
|
});
|
|
10447
10569
|
}
|
|
10448
|
-
return await fetch(n,
|
|
10570
|
+
return await fetch(n, D).then((Y) => this.handleFetchResult(Y, n || void 0));
|
|
10449
10571
|
}
|
|
10450
10572
|
(!this.options.bindFragments || this.options.bindFragments.length === 0) && this.options.formFragment && l && await this.commitFormValues(
|
|
10451
10573
|
this.options.formFragment,
|
|
10452
10574
|
i,
|
|
10453
10575
|
e
|
|
10454
10576
|
), this.suppressEmptyReplaceBind = !l && !this.options.formFragment && (this.eventType === "change" || this.eventType === "input"), this.twoWayCommitBind = this.eventType === "change" || this.eventType === "input";
|
|
10455
|
-
const u = l ? je(i) : {},
|
|
10577
|
+
const u = l ? je(i) : {}, f = new Response(JSON.stringify(u), {
|
|
10456
10578
|
headers: { "Content-Type": "application/json" }
|
|
10457
10579
|
});
|
|
10458
|
-
return await this.handleFetchResult(
|
|
10580
|
+
return await this.handleFetchResult(f);
|
|
10459
10581
|
} finally {
|
|
10460
10582
|
this.releaseExecutionLock(e);
|
|
10461
10583
|
}
|
|
@@ -10509,9 +10631,9 @@ ${U}
|
|
|
10509
10631
|
let l;
|
|
10510
10632
|
if (o) {
|
|
10511
10633
|
l = { ...s ?? {} };
|
|
10512
|
-
const u = String(o),
|
|
10634
|
+
const u = String(o), f = F.resolveAncestorArgOwner(e, u);
|
|
10513
10635
|
l[u] = F.mergeCollectedValues(
|
|
10514
|
-
(
|
|
10636
|
+
(f ? f.value : l[u]) ?? null,
|
|
10515
10637
|
a
|
|
10516
10638
|
);
|
|
10517
10639
|
} else
|
|
@@ -10520,7 +10642,7 @@ ${U}
|
|
|
10520
10642
|
a,
|
|
10521
10643
|
F.ancestorBaseResolver(e)
|
|
10522
10644
|
);
|
|
10523
|
-
await
|
|
10645
|
+
await M.setBindingData(i, l, {
|
|
10524
10646
|
skipFragments: n,
|
|
10525
10647
|
kind: "nonSupply",
|
|
10526
10648
|
sequence: this.operationSequence,
|
|
@@ -10595,7 +10717,7 @@ ${U}
|
|
|
10595
10717
|
t.removeAttribute("disabled");
|
|
10596
10718
|
return;
|
|
10597
10719
|
}
|
|
10598
|
-
|
|
10720
|
+
M.setAttribute(t, r.name, r.value).catch(
|
|
10599
10721
|
(i) => {
|
|
10600
10722
|
g.error(
|
|
10601
10723
|
"Haori",
|
|
@@ -10763,7 +10885,7 @@ ${U}
|
|
|
10763
10885
|
`保存先のフォルダを確かめられなかったため、今までどおり保存します: ${l}`
|
|
10764
10886
|
), "fallback";
|
|
10765
10887
|
}
|
|
10766
|
-
if (s && !await
|
|
10888
|
+
if (s && !await fe().confirm(
|
|
10767
10889
|
`${n} は既にあります。上書きしますか?`
|
|
10768
10890
|
))
|
|
10769
10891
|
return "cancelled";
|
|
@@ -10849,7 +10971,7 @@ ${U}
|
|
|
10849
10971
|
* @returns 表示の完了 Promise
|
|
10850
10972
|
*/
|
|
10851
10973
|
async showDownloadFailure(e) {
|
|
10852
|
-
const t = this.resolveMessageScope(), r =
|
|
10974
|
+
const t = this.resolveMessageScope(), r = fe();
|
|
10853
10975
|
await r.clearMessages(t), e && await r.addErrorMessage(t, tt);
|
|
10854
10976
|
}
|
|
10855
10977
|
/**
|
|
@@ -10933,7 +11055,7 @@ ${U}
|
|
|
10933
11055
|
* フェッチ後の処理を実行します。
|
|
10934
11056
|
*/
|
|
10935
11057
|
async handleFetchResult(e, t, r) {
|
|
10936
|
-
const i =
|
|
11058
|
+
const i = fe();
|
|
10937
11059
|
if (!e.ok) {
|
|
10938
11060
|
if (At(e.status))
|
|
10939
11061
|
return !1;
|
|
@@ -10944,17 +11066,17 @@ ${U}
|
|
|
10944
11066
|
e.status,
|
|
10945
11067
|
r
|
|
10946
11068
|
);
|
|
10947
|
-
const E = this.selectErrorActions(e.status), A = E?.bind === !0,
|
|
11069
|
+
const E = this.selectErrorActions(e.status), A = E?.bind === !0, D = await this.handleFetchError(
|
|
10948
11070
|
A ? e.clone() : e,
|
|
10949
11071
|
E?.noMessage !== !0 && !A
|
|
10950
11072
|
);
|
|
10951
|
-
return A && await this.bindResult(e).catch((
|
|
10952
|
-
g.error("Haori", "Failed to bind the error response:",
|
|
11073
|
+
return A && await this.bindResult(e).catch((C) => {
|
|
11074
|
+
g.error("Haori", "Failed to bind the error response:", C);
|
|
10953
11075
|
}), await this.injectFetchState(
|
|
10954
11076
|
"error",
|
|
10955
11077
|
e.status,
|
|
10956
11078
|
e.statusText || null,
|
|
10957
|
-
|
|
11079
|
+
D
|
|
10958
11080
|
), await this.runErrorActions(e.status), !1;
|
|
10959
11081
|
}
|
|
10960
11082
|
if (this.options.targetFragment && t && r && B.fetchEnd(
|
|
@@ -11032,18 +11154,18 @@ ${U}
|
|
|
11032
11154
|
p.attrName(this.eventType, "scroll"),
|
|
11033
11155
|
document
|
|
11034
11156
|
)?.scrollIntoView({ behavior: "smooth", block: "nearest" });
|
|
11035
|
-
const
|
|
11157
|
+
const f = this.resolveLateAttribute(
|
|
11036
11158
|
"redirect",
|
|
11037
11159
|
this.options.redirectUrl
|
|
11038
11160
|
), m = this.resolveLateAttribute(
|
|
11039
11161
|
"redirect-replace",
|
|
11040
11162
|
this.options.redirectReplaceUrl
|
|
11041
11163
|
);
|
|
11042
|
-
|
|
11164
|
+
f && m && g.warn(
|
|
11043
11165
|
"Haori",
|
|
11044
11166
|
`${p.attrName(this.eventType, "redirect")} と ${p.attrName(this.eventType, "redirect-replace")} の両方が指定されています。履歴を置き換える方を採用します。`
|
|
11045
11167
|
);
|
|
11046
|
-
const y = m ||
|
|
11168
|
+
const y = m || f;
|
|
11047
11169
|
if (y) {
|
|
11048
11170
|
let E = y;
|
|
11049
11171
|
const A = this.resolveLateAttribute(
|
|
@@ -11051,12 +11173,12 @@ ${U}
|
|
|
11051
11173
|
this.options.redirectReturnParam
|
|
11052
11174
|
);
|
|
11053
11175
|
if (A) {
|
|
11054
|
-
const
|
|
11055
|
-
if (
|
|
11056
|
-
const P =
|
|
11176
|
+
const C = new URLSearchParams(window.location.search).get(A);
|
|
11177
|
+
if (C !== null) {
|
|
11178
|
+
const P = C.trim();
|
|
11057
11179
|
De.isSafeLocalPath(P) ? E = P : g.warn(
|
|
11058
11180
|
"Haori",
|
|
11059
|
-
`戻り先パスが安全なローカルパスではないため、既定の遷移先へフォールバックします: ${
|
|
11181
|
+
`戻り先パスが安全なローカルパスではないため、既定の遷移先へフォールバックします: ${C}`
|
|
11060
11182
|
);
|
|
11061
11183
|
}
|
|
11062
11184
|
}
|
|
@@ -11093,7 +11215,7 @@ ${U}
|
|
|
11093
11215
|
if (!e || e.length === 0)
|
|
11094
11216
|
return !1;
|
|
11095
11217
|
for (const i of e) {
|
|
11096
|
-
await
|
|
11218
|
+
await M.evaluateAll(i);
|
|
11097
11219
|
const n = i.getTarget();
|
|
11098
11220
|
if (t && p.takeClickOutcome(n), typeof n.click == "function" ? n.click() : n.dispatchEvent(
|
|
11099
11221
|
new MouseEvent("click", { bubbles: !0, cancelable: !0 })
|
|
@@ -11129,7 +11251,7 @@ ${U}
|
|
|
11129
11251
|
`${t.key}-click-await`
|
|
11130
11252
|
))
|
|
11131
11253
|
return;
|
|
11132
|
-
const i =
|
|
11254
|
+
const i = fe(), n = [];
|
|
11133
11255
|
t.closeFragments?.forEach((a) => {
|
|
11134
11256
|
const o = a.getTarget();
|
|
11135
11257
|
o instanceof HTMLElement ? n.push(i.closeDialog(o)) : g.error("Haori", "Element is not an HTML element: ", o);
|
|
@@ -11223,14 +11345,14 @@ ${U}
|
|
|
11223
11345
|
return;
|
|
11224
11346
|
}
|
|
11225
11347
|
const l = (u) => {
|
|
11226
|
-
for (const [
|
|
11227
|
-
m != null && (Array.isArray(m) ? (o.searchParams.delete(
|
|
11348
|
+
for (const [f, m] of Object.entries(u))
|
|
11349
|
+
m != null && (Array.isArray(m) ? (o.searchParams.delete(f), m.forEach((y) => o.searchParams.append(f, String(y)))) : typeof m == "object" ? o.searchParams.set(f, JSON.stringify(m)) : o.searchParams.set(f, String(m)));
|
|
11228
11350
|
};
|
|
11229
11351
|
n && l(r), s && l(i), history.pushState(
|
|
11230
|
-
{ [
|
|
11352
|
+
{ [Ut]: !0 },
|
|
11231
11353
|
"",
|
|
11232
11354
|
o.toString()
|
|
11233
|
-
),
|
|
11355
|
+
), M.refreshUrlParams();
|
|
11234
11356
|
} catch (a) {
|
|
11235
11357
|
g.error("Haori", `history.pushState failed: ${a}`);
|
|
11236
11358
|
}
|
|
@@ -11261,62 +11383,62 @@ ${U}
|
|
|
11261
11383
|
let r = null;
|
|
11262
11384
|
this.options.formFragment ? r = this.options.formFragment : this.options.targetFragment && (r = F.getFormFragment(this.options.targetFragment) || this.options.targetFragment);
|
|
11263
11385
|
const i = r ? r.getTarget() : document.body;
|
|
11264
|
-
await
|
|
11386
|
+
await fe().clearMessages(i);
|
|
11265
11387
|
const n = async (u) => {
|
|
11266
|
-
const
|
|
11267
|
-
await
|
|
11388
|
+
const f = r ? r.getTarget() : document.body;
|
|
11389
|
+
await fe().addErrorMessage(f, u);
|
|
11268
11390
|
}, s = () => {
|
|
11269
11391
|
if (!this.options.scrollOnError)
|
|
11270
11392
|
return;
|
|
11271
|
-
const u = r ? r.getTarget() : document.body,
|
|
11393
|
+
const u = r ? r.getTarget() : document.body, f = u.nextElementSibling;
|
|
11272
11394
|
(u.getAttribute("data-message-level") === "error" ? u : u.parentElement?.getAttribute("data-message-level") === "error" ? u.parentElement : u.querySelector(
|
|
11273
11395
|
'[data-message-level="error"]'
|
|
11274
|
-
) ?? (
|
|
11396
|
+
) ?? (f?.getAttribute("data-message-level") === "error" ? f : null))?.scrollIntoView({ behavior: "smooth", block: "nearest" });
|
|
11275
11397
|
}, a = async (u) => {
|
|
11276
11398
|
if (t) {
|
|
11277
11399
|
u.length === 0 && await n(`${e.status} ${e.statusText}`);
|
|
11278
|
-
for (const
|
|
11279
|
-
|
|
11400
|
+
for (const f of u)
|
|
11401
|
+
f.key && r ? await F.addErrorMessage(r, f.key, f.message) : await n(f.message);
|
|
11280
11402
|
s();
|
|
11281
11403
|
}
|
|
11282
|
-
return u.length === 0 ? null : u.map((
|
|
11404
|
+
return u.length === 0 ? null : u.map((f) => f.message).join(`
|
|
11283
11405
|
`);
|
|
11284
11406
|
};
|
|
11285
11407
|
if ((e.headers.get("Content-Type") || "").includes("application/json"))
|
|
11286
11408
|
try {
|
|
11287
|
-
const u = await e.json(),
|
|
11409
|
+
const u = await e.json(), f = [];
|
|
11288
11410
|
if (Array.isArray(u)) {
|
|
11289
11411
|
const m = /* @__PURE__ */ new Map(), y = [];
|
|
11290
11412
|
for (const E of u)
|
|
11291
11413
|
if (E && typeof E == "object" && !Array.isArray(E)) {
|
|
11292
|
-
const A = E.key,
|
|
11414
|
+
const A = E.key, D = E.message, C = typeof A == "string" && A.length > 0 ? A : null, P = typeof D == "string" ? D : D != null ? String(D) : "";
|
|
11293
11415
|
if (P.length === 0)
|
|
11294
11416
|
continue;
|
|
11295
|
-
if (
|
|
11296
|
-
const ee = m.get(
|
|
11297
|
-
ee.push(P), m.set(
|
|
11417
|
+
if (C !== null) {
|
|
11418
|
+
const ee = m.get(C) ?? [];
|
|
11419
|
+
ee.push(P), m.set(C, ee);
|
|
11298
11420
|
} else
|
|
11299
11421
|
y.push(P);
|
|
11300
11422
|
} else typeof E == "string" && E.length > 0 && y.push(E);
|
|
11301
11423
|
for (const [E, A] of m)
|
|
11302
|
-
|
|
11424
|
+
f.push({ key: E, message: A.join(`
|
|
11303
11425
|
`) });
|
|
11304
11426
|
for (const E of y)
|
|
11305
|
-
|
|
11427
|
+
f.push({ message: E });
|
|
11306
11428
|
} else if (u && typeof u == "object") {
|
|
11307
|
-
if (typeof u.message == "string" &&
|
|
11429
|
+
if (typeof u.message == "string" && f.push({ message: u.message }), Array.isArray(u.messages))
|
|
11308
11430
|
for (const m of u.messages)
|
|
11309
|
-
typeof m == "string" &&
|
|
11431
|
+
typeof m == "string" && f.push({ message: m });
|
|
11310
11432
|
if (u.errors && typeof u.errors == "object")
|
|
11311
11433
|
for (const [m, y] of Object.entries(u.errors))
|
|
11312
|
-
Array.isArray(y) ?
|
|
11313
|
-
`) }) : typeof y == "string" ?
|
|
11314
|
-
if (
|
|
11434
|
+
Array.isArray(y) ? f.push({ key: m, message: y.join(`
|
|
11435
|
+
`) }) : typeof y == "string" ? f.push({ key: m, message: y }) : y != null && f.push({ key: m, message: String(y) });
|
|
11436
|
+
if (f.length === 0)
|
|
11315
11437
|
for (const [m, y] of Object.entries(u))
|
|
11316
|
-
m === "message" || m === "messages" || m === "errors" || (Array.isArray(y) ?
|
|
11317
|
-
`) }) : typeof y == "string" &&
|
|
11438
|
+
m === "message" || m === "messages" || m === "errors" || (Array.isArray(y) ? f.push({ key: m, message: y.join(`
|
|
11439
|
+
`) }) : typeof y == "string" && f.push({ key: m, message: y }));
|
|
11318
11440
|
}
|
|
11319
|
-
return await a(
|
|
11441
|
+
return await a(f);
|
|
11320
11442
|
} catch {
|
|
11321
11443
|
}
|
|
11322
11444
|
let l = "";
|
|
@@ -11478,7 +11600,7 @@ ${U}
|
|
|
11478
11600
|
*/
|
|
11479
11601
|
confirm() {
|
|
11480
11602
|
const e = this.options.confirmMessage;
|
|
11481
|
-
return e == null ? Promise.resolve(!0) :
|
|
11603
|
+
return e == null ? Promise.resolve(!0) : fe().confirm(e);
|
|
11482
11604
|
}
|
|
11483
11605
|
/**
|
|
11484
11606
|
* 結果データを対象のフラグメントにバインドします。
|
|
@@ -11530,11 +11652,11 @@ ${U}
|
|
|
11530
11652
|
apply: (y) => {
|
|
11531
11653
|
const E = this.resolveCurrentRowItem(o, y), A = { ...E };
|
|
11532
11654
|
if (i && typeof i == "object" && !Array.isArray(i)) {
|
|
11533
|
-
const
|
|
11655
|
+
const D = E[m], C = D !== null && typeof D == "object" && !Array.isArray(D) ? D : {};
|
|
11534
11656
|
A[m] = this.mergeAppendBindingData(
|
|
11535
11657
|
o,
|
|
11536
11658
|
i,
|
|
11537
|
-
|
|
11659
|
+
C
|
|
11538
11660
|
);
|
|
11539
11661
|
} else
|
|
11540
11662
|
A[m] = i;
|
|
@@ -11543,20 +11665,20 @@ ${U}
|
|
|
11543
11665
|
});
|
|
11544
11666
|
return;
|
|
11545
11667
|
}
|
|
11546
|
-
const u = { ...o.getRawBindingData() ?? {} },
|
|
11668
|
+
const u = { ...o.getRawBindingData() ?? {} }, f = this.options.bindArg;
|
|
11547
11669
|
if (i && typeof i == "object" && !Array.isArray(i)) {
|
|
11548
|
-
const m = u[
|
|
11549
|
-
u[
|
|
11670
|
+
const m = u[f], y = m && typeof m == "object" && !Array.isArray(m) ? m : {};
|
|
11671
|
+
u[f] = this.mergeAppendBindingData(
|
|
11550
11672
|
o,
|
|
11551
11673
|
i,
|
|
11552
11674
|
y
|
|
11553
11675
|
);
|
|
11554
11676
|
} else
|
|
11555
|
-
u[
|
|
11677
|
+
u[f] = i;
|
|
11556
11678
|
n.push(
|
|
11557
|
-
|
|
11679
|
+
M.setBindingData(
|
|
11558
11680
|
o.getTarget(),
|
|
11559
|
-
this.reconcileUserEditsForBind(o, u, [
|
|
11681
|
+
this.reconcileUserEditsForBind(o, u, [f]),
|
|
11560
11682
|
{
|
|
11561
11683
|
// マネージド fetch の bind かつ、bind 先が実行中のバインドワークを
|
|
11562
11684
|
// 持つ(= 自分自身を await している)ときだけ reentrant(即時実行)に
|
|
@@ -11610,13 +11732,13 @@ ${U}
|
|
|
11610
11732
|
const u = this.mergeAppendBindingData(
|
|
11611
11733
|
o,
|
|
11612
11734
|
i
|
|
11613
|
-
),
|
|
11735
|
+
), f = this.options.bindMerge ? { ...o.getRawBindingData() ?? {}, ...u } : u;
|
|
11614
11736
|
n.push(
|
|
11615
|
-
|
|
11737
|
+
M.setBindingData(
|
|
11616
11738
|
o.getTarget(),
|
|
11617
11739
|
this.reconcileUserEditsForBind(
|
|
11618
11740
|
o,
|
|
11619
|
-
|
|
11741
|
+
f,
|
|
11620
11742
|
Object.keys(u)
|
|
11621
11743
|
),
|
|
11622
11744
|
{
|
|
@@ -11674,7 +11796,7 @@ ${U}
|
|
|
11674
11796
|
if (i === null)
|
|
11675
11797
|
return t;
|
|
11676
11798
|
const n = this.eventType === "poll";
|
|
11677
|
-
if (!n && !this.twoWayCommitBind &&
|
|
11799
|
+
if (!n && !this.twoWayCommitBind && M.clearUserEditMarks(e, i), !(e.getTarget() instanceof HTMLFormElement))
|
|
11678
11800
|
return this.reconcileAncestorArgFormEdits(
|
|
11679
11801
|
e,
|
|
11680
11802
|
t,
|
|
@@ -11714,7 +11836,7 @@ ${U}
|
|
|
11714
11836
|
if (r === null)
|
|
11715
11837
|
return t;
|
|
11716
11838
|
const i = this.eventType === "poll";
|
|
11717
|
-
!i && !this.twoWayCommitBind &&
|
|
11839
|
+
!i && !this.twoWayCommitBind && M.clearUserEditMarks(e, r);
|
|
11718
11840
|
const n = F.getValuesEditedAfter(
|
|
11719
11841
|
e,
|
|
11720
11842
|
i ? 0 : r
|
|
@@ -11788,7 +11910,7 @@ ${U}
|
|
|
11788
11910
|
...t
|
|
11789
11911
|
};
|
|
11790
11912
|
n.push(
|
|
11791
|
-
|
|
11913
|
+
M.setBindingData(s.getTarget(), o, {
|
|
11792
11914
|
// 通番はコピーを起こした操作のもの(フェッチ応答の反映と同じ理由)。
|
|
11793
11915
|
sequence: this.operationSequence
|
|
11794
11916
|
})
|
|
@@ -11850,9 +11972,9 @@ ${U}
|
|
|
11850
11972
|
* @returns コピー元のデータ
|
|
11851
11973
|
*/
|
|
11852
11974
|
resolveCopySourceData() {
|
|
11853
|
-
return this.options.copySourceFragment ? this.options.copySourceFragment.getTarget().tagName === "FORM" ? $e(this.options.copySourceFragment) :
|
|
11975
|
+
return this.options.copySourceFragment ? this.options.copySourceFragment.getTarget().tagName === "FORM" ? $e(this.options.copySourceFragment) : M.withoutReservedBindingKeys(
|
|
11854
11976
|
this.options.copySourceFragment.getRawBindingData() ?? {}
|
|
11855
|
-
) : this.options.formFragment ? $e(this.options.formFragment) : this.options.targetFragment ?
|
|
11977
|
+
) : this.options.formFragment ? $e(this.options.formFragment) : this.options.targetFragment ? M.withoutReservedBindingKeys(
|
|
11856
11978
|
this.options.targetFragment.getRawBindingData() ?? {}
|
|
11857
11979
|
) : {};
|
|
11858
11980
|
}
|
|
@@ -11919,8 +12041,8 @@ ${U}
|
|
|
11919
12041
|
n.headers || void 0
|
|
11920
12042
|
), a = (n.method || "GET").toUpperCase(), o = c.runtime === "demo" && !Pe(a), l = o ? "GET" : a;
|
|
11921
12043
|
if (n.method = l, Object.keys(t).length > 0 && Fe(t)) {
|
|
11922
|
-
const
|
|
11923
|
-
!Pe(a) && /multipart\/form-data/i.test(
|
|
12044
|
+
const f = s.get("Content-Type") || "";
|
|
12045
|
+
!Pe(a) && /multipart\/form-data/i.test(f) ? Xt(t) && g.warn(
|
|
11924
12046
|
"Haori",
|
|
11925
12047
|
`A File value nested under ${c.prefix}form-object / ${c.prefix}form-list cannot be sent. Place file inputs at the top level of the collected form values.`
|
|
11926
12048
|
) : g.warn(
|
|
@@ -11931,8 +12053,8 @@ ${U}
|
|
|
11931
12053
|
if (l === "GET" || l === "HEAD" || l === "OPTIONS")
|
|
11932
12054
|
Object.keys(t).length > 0 && (i = vt(i, t));
|
|
11933
12055
|
else if (Object.keys(t).length > 0) {
|
|
11934
|
-
const
|
|
11935
|
-
if (/multipart\/form-data/i.test(
|
|
12056
|
+
const f = s.get("Content-Type") || "";
|
|
12057
|
+
if (/multipart\/form-data/i.test(f)) {
|
|
11936
12058
|
s.delete("Content-Type");
|
|
11937
12059
|
const m = new FormData();
|
|
11938
12060
|
for (const [y, E] of Object.entries(t))
|
|
@@ -11940,7 +12062,7 @@ ${U}
|
|
|
11940
12062
|
A instanceof Blob ? m.append(y, A) : m.append(y, Ee(A));
|
|
11941
12063
|
}) : m.append(y, Ee(E));
|
|
11942
12064
|
n.body = m;
|
|
11943
|
-
} else if (/application\/x-www-form-urlencoded/i.test(
|
|
12065
|
+
} else if (/application\/x-www-form-urlencoded/i.test(f)) {
|
|
11944
12066
|
const m = new URLSearchParams();
|
|
11945
12067
|
for (const [y, E] of Object.entries(t))
|
|
11946
12068
|
E !== void 0 && (Array.isArray(E) ? E.forEach((A) => m.append(y, Ee(A))) : m.append(y, Ee(E)));
|
|
@@ -12070,7 +12192,7 @@ ${U}
|
|
|
12070
12192
|
`Row container not found: ${i} (${r})`
|
|
12071
12193
|
), null;
|
|
12072
12194
|
const a = N.get(s);
|
|
12073
|
-
return a instanceof
|
|
12195
|
+
return a instanceof w ? a.hasAttribute(`${c.prefix}each`) ? a : (g.error(
|
|
12074
12196
|
"Haori",
|
|
12075
12197
|
`Row container must have ${c.prefix}each: ${i} (${r})`
|
|
12076
12198
|
), null) : (g.error(
|
|
@@ -12118,27 +12240,27 @@ ${U}
|
|
|
12118
12240
|
const u = p.resolveRowScopeBase(e, o[0]);
|
|
12119
12241
|
if (u === "unresolvable")
|
|
12120
12242
|
return null;
|
|
12121
|
-
let
|
|
12243
|
+
let f, m, y;
|
|
12122
12244
|
if (u)
|
|
12123
|
-
|
|
12245
|
+
f = u.owner, m = u.ownerData, y = [...u.path, ...o.slice(1)];
|
|
12124
12246
|
else {
|
|
12125
|
-
for (
|
|
12126
|
-
const A =
|
|
12127
|
-
if (A && o[0] in A && !p.isRowScopeKey(
|
|
12247
|
+
for (f = e, m = null; f; ) {
|
|
12248
|
+
const A = f.getRawBindingData();
|
|
12249
|
+
if (A && o[0] in A && !p.isRowScopeKey(f, o[0])) {
|
|
12128
12250
|
m = A;
|
|
12129
12251
|
break;
|
|
12130
12252
|
}
|
|
12131
|
-
|
|
12253
|
+
f = f.getParent();
|
|
12132
12254
|
}
|
|
12133
12255
|
y = o;
|
|
12134
12256
|
}
|
|
12135
|
-
if (!
|
|
12257
|
+
if (!f || !m)
|
|
12136
12258
|
return t || g.error(
|
|
12137
12259
|
"Haori",
|
|
12138
12260
|
`Binding data owner not found for ${s}="${a}".`
|
|
12139
12261
|
), null;
|
|
12140
12262
|
const E = p.readPathValue(m, y);
|
|
12141
|
-
return Array.isArray(E) ? { owner:
|
|
12263
|
+
return Array.isArray(E) ? { owner: f, ownerData: m, array: E, path: y, mapped: n } : (t || g.error(
|
|
12142
12264
|
"Haori",
|
|
12143
12265
|
`${s}="${a}" does not resolve to an array.`
|
|
12144
12266
|
), null);
|
|
@@ -12315,10 +12437,10 @@ ${U}
|
|
|
12315
12437
|
const a = s.array.slice();
|
|
12316
12438
|
let o = !1;
|
|
12317
12439
|
for (const u of i) {
|
|
12318
|
-
const
|
|
12319
|
-
if (
|
|
12440
|
+
const f = p.resolveRowArrayIndex(u, a);
|
|
12441
|
+
if (f === null)
|
|
12320
12442
|
continue;
|
|
12321
|
-
const m = a[
|
|
12443
|
+
const m = a[f];
|
|
12322
12444
|
if (m === null || typeof m != "object" || Array.isArray(m)) {
|
|
12323
12445
|
g.warn(
|
|
12324
12446
|
"Haori",
|
|
@@ -12337,11 +12459,11 @@ ${U}
|
|
|
12337
12459
|
);
|
|
12338
12460
|
continue;
|
|
12339
12461
|
}
|
|
12340
|
-
a[
|
|
12462
|
+
a[f] = y, o = !0, u.syncWhenUnchanged === "supply" && F.clearRowUserEditMarksForChangedKeys(u.row, y);
|
|
12341
12463
|
}
|
|
12342
12464
|
if (!o)
|
|
12343
12465
|
return;
|
|
12344
|
-
const l =
|
|
12466
|
+
const l = M.setBindingData(
|
|
12345
12467
|
s.owner.getTarget(),
|
|
12346
12468
|
p.withPathValue(s.ownerData, s.path, a),
|
|
12347
12469
|
{
|
|
@@ -12357,7 +12479,7 @@ ${U}
|
|
|
12357
12479
|
sequence: this.operationSequence
|
|
12358
12480
|
}
|
|
12359
12481
|
);
|
|
12360
|
-
if (
|
|
12482
|
+
if (M.isEachUpdateRunning(n)) {
|
|
12361
12483
|
l.catch((u) => {
|
|
12362
12484
|
g.error("Haori", "Failed to write row data.", u);
|
|
12363
12485
|
});
|
|
@@ -12453,17 +12575,17 @@ ${U}
|
|
|
12453
12575
|
if (a && o !== null) {
|
|
12454
12576
|
const l = [];
|
|
12455
12577
|
r.forEach((m, y) => {
|
|
12456
|
-
|
|
12578
|
+
M.createListKey(
|
|
12457
12579
|
m,
|
|
12458
12580
|
String(a),
|
|
12459
12581
|
y
|
|
12460
12582
|
) === o && l.push(y);
|
|
12461
12583
|
});
|
|
12462
|
-
const u = n.slice(0, s).filter((m) => m.getListKey() === o).length,
|
|
12463
|
-
return
|
|
12584
|
+
const u = n.slice(0, s).filter((m) => m.getListKey() === o).length, f = l[u] ?? -1;
|
|
12585
|
+
return f === -1 ? (g.warn(
|
|
12464
12586
|
"Haori",
|
|
12465
12587
|
`No array element corresponds to the target row (key "${o}"); the write was skipped (${i}).`
|
|
12466
|
-
), null) :
|
|
12588
|
+
), null) : f;
|
|
12467
12589
|
}
|
|
12468
12590
|
return s >= r.length ? (g.warn(
|
|
12469
12591
|
"Haori",
|
|
@@ -12556,9 +12678,9 @@ ${U}
|
|
|
12556
12678
|
) : y, u = o >= 0 ? l(o) : i.mapped ? i.array.length - 1 : o;
|
|
12557
12679
|
if (u === null)
|
|
12558
12680
|
return Promise.resolve();
|
|
12559
|
-
const
|
|
12681
|
+
const f = i.array.slice();
|
|
12560
12682
|
if (!t(
|
|
12561
|
-
|
|
12683
|
+
f,
|
|
12562
12684
|
u,
|
|
12563
12685
|
() => l(o - 1),
|
|
12564
12686
|
() => l(o + 1)
|
|
@@ -12568,20 +12690,20 @@ ${U}
|
|
|
12568
12690
|
return a.forEach((y) => {
|
|
12569
12691
|
const E = y.getListKey();
|
|
12570
12692
|
E !== null && !m.has(String(E)) && m.set(String(E), y);
|
|
12571
|
-
}),
|
|
12693
|
+
}), f.forEach((y, E) => {
|
|
12572
12694
|
if (p.isSameRowItem(i.array[E], y))
|
|
12573
12695
|
return;
|
|
12574
12696
|
const A = m.get(
|
|
12575
|
-
|
|
12697
|
+
M.createListKey(
|
|
12576
12698
|
y,
|
|
12577
12699
|
null,
|
|
12578
12700
|
E
|
|
12579
12701
|
)
|
|
12580
12702
|
);
|
|
12581
|
-
A &&
|
|
12582
|
-
}),
|
|
12703
|
+
A && M.clearUserEditMarks(A);
|
|
12704
|
+
}), M.setBindingData(
|
|
12583
12705
|
i.owner.getTarget(),
|
|
12584
|
-
p.withPathValue(i.ownerData, i.path,
|
|
12706
|
+
p.withPathValue(i.ownerData, i.path, f),
|
|
12585
12707
|
{
|
|
12586
12708
|
// 対象は配列の 1 要素だけなので、所有者の部分木を丸ごと供給の宛先にはしない
|
|
12587
12709
|
// (行の書き戻し `applyRowWrites()` と同じ扱い)。
|
|
@@ -12624,7 +12746,7 @@ ${U}
|
|
|
12624
12746
|
...a.getRawBindingData() ?? {},
|
|
12625
12747
|
_fetch: s
|
|
12626
12748
|
};
|
|
12627
|
-
return
|
|
12749
|
+
return M.setBindingData(o, l, {
|
|
12628
12750
|
reflectToAttribute: !1,
|
|
12629
12751
|
// 状態変数の注入は値の供給ではない(権威を持たず、ユーザー編集の印も
|
|
12630
12752
|
// 解除しない)。
|
|
@@ -12728,7 +12850,7 @@ const d = class d {
|
|
|
12728
12850
|
*/
|
|
12729
12851
|
static isAliasedAttributeReflection(e, t) {
|
|
12730
12852
|
const r = N.get(e);
|
|
12731
|
-
return r instanceof
|
|
12853
|
+
return r instanceof w ? r.hasAttribute(
|
|
12732
12854
|
`${c.prefix}${d.ATTRIBUTE_ALIAS_SUFFIX}${t}`
|
|
12733
12855
|
) : !1;
|
|
12734
12856
|
}
|
|
@@ -12759,7 +12881,7 @@ const d = class d {
|
|
|
12759
12881
|
static reevaluateChildren(e) {
|
|
12760
12882
|
const t = [];
|
|
12761
12883
|
return e.getChildren().forEach((r) => {
|
|
12762
|
-
r instanceof
|
|
12884
|
+
r instanceof w ? t.push(d.evaluateAll(r)) : r instanceof ne && t.push(d.evaluateText(r));
|
|
12763
12885
|
}), Promise.all(t).then(() => {
|
|
12764
12886
|
});
|
|
12765
12887
|
}
|
|
@@ -12780,9 +12902,9 @@ const d = class d {
|
|
|
12780
12902
|
* @param upTo この通し番号までの編集を解除対象とする(既定は現在の最新)
|
|
12781
12903
|
* @return 戻り値はありません。
|
|
12782
12904
|
*/
|
|
12783
|
-
static clearUserEditMarks(e, t =
|
|
12905
|
+
static clearUserEditMarks(e, t = w.currentSequence()) {
|
|
12784
12906
|
e.clearUserEditMark(t), e.getChildren().forEach((r) => {
|
|
12785
|
-
r instanceof
|
|
12907
|
+
r instanceof w && d.clearUserEditMarks(r, t);
|
|
12786
12908
|
});
|
|
12787
12909
|
}
|
|
12788
12910
|
/**
|
|
@@ -12831,7 +12953,7 @@ const d = class d {
|
|
|
12831
12953
|
return Promise.resolve();
|
|
12832
12954
|
const r = [];
|
|
12833
12955
|
return e.hasAttribute(`${c.prefix}validity`) && F.applyCustomValidity(e), e.hasAttribute(`${c.prefix}fetch`) && r.push(d.executeManagedFetch(e)), e.hasAttribute(`${c.prefix}import`) && r.push(d.executeManagedImport(e)), e.isVisible() ? (e.getChildren().forEach((i) => {
|
|
12834
|
-
i instanceof
|
|
12956
|
+
i instanceof w && r.push(
|
|
12835
12957
|
d.reevaluateReactiveSpecialAttributes(i, t)
|
|
12836
12958
|
);
|
|
12837
12959
|
}), Promise.all(r).then(() => {
|
|
@@ -12891,7 +13013,7 @@ const d = class d {
|
|
|
12891
13013
|
t.removeAttribute(`${c.prefix}importing`), B.importEnd(t, n, o, s), d.adoptImportedChildren(e);
|
|
12892
13014
|
const l = [];
|
|
12893
13015
|
return e.getChildren().forEach((u) => {
|
|
12894
|
-
u instanceof
|
|
13016
|
+
u instanceof w ? l.push(d.scan(u.getTarget())) : u instanceof ne && l.push(d.evaluateText(u));
|
|
12895
13017
|
}), Promise.all(l).then(() => {
|
|
12896
13018
|
});
|
|
12897
13019
|
});
|
|
@@ -12970,7 +13092,7 @@ const d = class d {
|
|
|
12970
13092
|
*/
|
|
12971
13093
|
static applyEnhancersOnShow(e, t) {
|
|
12972
13094
|
const r = e.getTarget();
|
|
12973
|
-
return
|
|
13095
|
+
return w.retryUnappliedValueWrites(r, t).then(
|
|
12974
13096
|
() => {
|
|
12975
13097
|
re.applySubtree(r);
|
|
12976
13098
|
}
|
|
@@ -13004,7 +13126,7 @@ const d = class d {
|
|
|
13004
13126
|
}
|
|
13005
13127
|
const r = t && e.hasAttribute(`${c.prefix}each`), i = [];
|
|
13006
13128
|
return e.getChildren().forEach((n) => {
|
|
13007
|
-
n instanceof
|
|
13129
|
+
n instanceof w ? (!r || d.isEachFixedChild(n)) && i.push(
|
|
13008
13130
|
d.initializeElementFragment(n, t)
|
|
13009
13131
|
) : n instanceof ne && i.push(d.evaluateText(n));
|
|
13010
13132
|
}), Promise.all(i).then(() => {
|
|
@@ -13101,14 +13223,14 @@ const d = class d {
|
|
|
13101
13223
|
i
|
|
13102
13224
|
);
|
|
13103
13225
|
const o = [];
|
|
13104
|
-
let l = null, u = null,
|
|
13226
|
+
let l = null, u = null, f = null;
|
|
13105
13227
|
switch (t) {
|
|
13106
13228
|
case `${c.prefix}bind`: {
|
|
13107
|
-
if (r !== null && i && s instanceof
|
|
13229
|
+
if (r !== null && i && s instanceof w && s.consumeSelfWrittenBind(r))
|
|
13108
13230
|
break;
|
|
13109
13231
|
const m = r === null ? {} : d.parseDataBind(r);
|
|
13110
13232
|
if (i) {
|
|
13111
|
-
const y = n ??
|
|
13233
|
+
const y = n ?? w.nextSequence();
|
|
13112
13234
|
return r === null ? (o.push(
|
|
13113
13235
|
d.setBindingData(e, m, {
|
|
13114
13236
|
reflectToAttribute: !1,
|
|
@@ -13149,16 +13271,16 @@ const d = class d {
|
|
|
13149
13271
|
}));
|
|
13150
13272
|
break;
|
|
13151
13273
|
case `${c.prefix}if`:
|
|
13152
|
-
|
|
13274
|
+
f = () => d.evaluateIfOnAttributeWrite(s);
|
|
13153
13275
|
break;
|
|
13154
13276
|
case `${c.prefix}each`:
|
|
13155
|
-
|
|
13277
|
+
f = () => d.evaluateEach(s);
|
|
13156
13278
|
break;
|
|
13157
13279
|
case `${c.prefix}fetch`:
|
|
13158
|
-
|
|
13280
|
+
f = () => d.executeManagedFetch(s);
|
|
13159
13281
|
break;
|
|
13160
13282
|
case `${c.prefix}import`:
|
|
13161
|
-
typeof r == "string" && (
|
|
13283
|
+
typeof r == "string" && (f = () => d.executeManagedImport(s));
|
|
13162
13284
|
break;
|
|
13163
13285
|
case `${c.prefix}store`:
|
|
13164
13286
|
r !== null && o.push(Ne.restore(s));
|
|
@@ -13176,7 +13298,7 @@ const d = class d {
|
|
|
13176
13298
|
const E = {
|
|
13177
13299
|
reentrant: !0,
|
|
13178
13300
|
kind: "nonSupply",
|
|
13179
|
-
sequence:
|
|
13301
|
+
sequence: w.nextSequence()
|
|
13180
13302
|
};
|
|
13181
13303
|
if (m === null)
|
|
13182
13304
|
o.push(d.setBindingData(e, y, E));
|
|
@@ -13188,7 +13310,7 @@ const d = class d {
|
|
|
13188
13310
|
}
|
|
13189
13311
|
}
|
|
13190
13312
|
return r === null ? o.push(s.removeAttribute(t)) : o.push(s.setAttribute(t, r, i)), Promise.all(o).then(
|
|
13191
|
-
() =>
|
|
13313
|
+
() => f === null ? void 0 : f()
|
|
13192
13314
|
).then(() => {
|
|
13193
13315
|
if (l !== null)
|
|
13194
13316
|
return s.setDeriveInputSignature(u), l.then((m) => {
|
|
@@ -13225,24 +13347,24 @@ const d = class d {
|
|
|
13225
13347
|
* @returns Promise (DOM操作が完了したときに解決される)
|
|
13226
13348
|
*/
|
|
13227
13349
|
static setBindingData(e, t, r = {}) {
|
|
13228
|
-
const i = N.get(e), n = r.skipFragments ?? /* @__PURE__ */ new Set(), s = r.reentrant ?? !1, a = r.reflectToAttribute ?? !0, o = r.kind ?? "supply", l = r.sequence ??
|
|
13350
|
+
const i = N.get(e), n = r.skipFragments ?? /* @__PURE__ */ new Set(), s = r.reentrant ?? !1, a = r.reflectToAttribute ?? !0, o = r.kind ?? "supply", l = r.sequence ?? w.nextOperationSequence(), u = {
|
|
13229
13351
|
sequence: l,
|
|
13230
13352
|
kind: o,
|
|
13231
13353
|
...r.editedPaths === void 0 ? {} : { editedPaths: r.editedPaths }
|
|
13232
|
-
},
|
|
13233
|
-
|
|
13234
|
-
const m =
|
|
13235
|
-
|
|
13354
|
+
}, f = o === "supply";
|
|
13355
|
+
f && i.markSupplyApplied(l);
|
|
13356
|
+
const m = w.currentSequence(), y = i.getRawBindingData();
|
|
13357
|
+
f && (r.clearUserEdits ?? !0) && d.clearUserEditMarks(i, l);
|
|
13236
13358
|
const E = a ? d.resolveByPathAuthority(i, y, t, u) : t;
|
|
13237
13359
|
i.setBindingData(E), a && (B.bindChange(e, y, E, "manual"), Ne.mirror(i));
|
|
13238
13360
|
const A = () => {
|
|
13239
13361
|
i.markBindingWorkStart();
|
|
13240
|
-
const
|
|
13241
|
-
let
|
|
13362
|
+
const D = i.getRawBindingData() ?? E;
|
|
13363
|
+
let C = a ? i.setAttribute(
|
|
13242
13364
|
`${c.prefix}bind`,
|
|
13243
|
-
JSON.stringify(d.withoutReservedBindingKeys(
|
|
13365
|
+
JSON.stringify(d.withoutReservedBindingKeys(D))
|
|
13244
13366
|
) : Promise.resolve();
|
|
13245
|
-
return e.tagName === "FORM" && (
|
|
13367
|
+
return e.tagName === "FORM" && (C = C.then(() => {
|
|
13246
13368
|
if (i.wasResetAfter(m))
|
|
13247
13369
|
return;
|
|
13248
13370
|
const P = i.getRawBindingData() ?? E;
|
|
@@ -13252,13 +13374,13 @@ const d = class d {
|
|
|
13252
13374
|
!1,
|
|
13253
13375
|
u
|
|
13254
13376
|
);
|
|
13255
|
-
})),
|
|
13377
|
+
})), C = C.then(
|
|
13256
13378
|
() => F.syncAncestorArgForms(i, m, u, y)
|
|
13257
|
-
),
|
|
13258
|
-
() =>
|
|
13259
|
-
),
|
|
13379
|
+
), C = C.then(() => d.evaluateAll(i, n)), C = C.then(
|
|
13380
|
+
() => w.retryUnappliedValueWrites(e, m)
|
|
13381
|
+
), C = C.then(
|
|
13260
13382
|
() => d.reevaluateReactiveSpecialAttributes(i, n)
|
|
13261
|
-
),
|
|
13383
|
+
), C.then(
|
|
13262
13384
|
() => i.markBindingWorkEnd(),
|
|
13263
13385
|
(P) => {
|
|
13264
13386
|
throw i.markBindingWorkEnd(), P;
|
|
@@ -13282,7 +13404,7 @@ const d = class d {
|
|
|
13282
13404
|
static withoutReservedBindingKeys(e) {
|
|
13283
13405
|
const t = {};
|
|
13284
13406
|
for (const r of Object.keys(e))
|
|
13285
|
-
|
|
13407
|
+
w.isReservedBindingKey(r) || (t[r] = e[r]);
|
|
13286
13408
|
return t;
|
|
13287
13409
|
}
|
|
13288
13410
|
/**
|
|
@@ -13325,24 +13447,24 @@ const d = class d {
|
|
|
13325
13447
|
*/
|
|
13326
13448
|
static mergePathAuthority(e, t, r, i, n, s) {
|
|
13327
13449
|
if (d.isPlainRecord(t) && d.isPlainRecord(r)) {
|
|
13328
|
-
const
|
|
13329
|
-
let E = Object.keys(
|
|
13330
|
-
(
|
|
13450
|
+
const f = t, m = r, y = {};
|
|
13451
|
+
let E = Object.keys(f).some(
|
|
13452
|
+
(D) => !Object.prototype.hasOwnProperty.call(m, D)
|
|
13331
13453
|
);
|
|
13332
13454
|
const A = /* @__PURE__ */ new Set([
|
|
13333
|
-
...Object.keys(
|
|
13455
|
+
...Object.keys(f),
|
|
13334
13456
|
...Object.keys(m)
|
|
13335
13457
|
]);
|
|
13336
|
-
for (const
|
|
13337
|
-
const
|
|
13458
|
+
for (const D of A) {
|
|
13459
|
+
const C = n === "" ? D : `${n}.${D}`, P = d.mergePathAuthority(
|
|
13338
13460
|
e,
|
|
13339
|
-
Object.prototype.hasOwnProperty.call(
|
|
13340
|
-
Object.prototype.hasOwnProperty.call(m,
|
|
13461
|
+
Object.prototype.hasOwnProperty.call(f, D) ? f[D] : d.ABSENT_PATH,
|
|
13462
|
+
Object.prototype.hasOwnProperty.call(m, D) ? m[D] : d.ABSENT_PATH,
|
|
13341
13463
|
i,
|
|
13342
|
-
|
|
13464
|
+
C,
|
|
13343
13465
|
s
|
|
13344
13466
|
);
|
|
13345
|
-
P !== d.ABSENT_PATH && (y[
|
|
13467
|
+
P !== d.ABSENT_PATH && (y[D] = P), P !== (Object.prototype.hasOwnProperty.call(m, D) ? m[D] : d.ABSENT_PATH) && (E = !0);
|
|
13346
13468
|
}
|
|
13347
13469
|
return E ? y : m;
|
|
13348
13470
|
}
|
|
@@ -13354,10 +13476,10 @@ const d = class d {
|
|
|
13354
13476
|
s
|
|
13355
13477
|
);
|
|
13356
13478
|
if (a !== null) {
|
|
13357
|
-
const
|
|
13479
|
+
const f = t, m = r, y = m.map(
|
|
13358
13480
|
(E, A) => d.mergePathAuthority(
|
|
13359
13481
|
e,
|
|
13360
|
-
|
|
13482
|
+
f[A],
|
|
13361
13483
|
E,
|
|
13362
13484
|
i,
|
|
13363
13485
|
`${n}[${a[A]}]`,
|
|
@@ -13541,7 +13663,7 @@ const d = class d {
|
|
|
13541
13663
|
*/
|
|
13542
13664
|
static getBindingData(e, t = {}) {
|
|
13543
13665
|
const r = N.get(e);
|
|
13544
|
-
return r instanceof
|
|
13666
|
+
return r instanceof w ? t.resolved ? r.getBindingData() : r.getRawBindingData() : null;
|
|
13545
13667
|
}
|
|
13546
13668
|
/**
|
|
13547
13669
|
* 指定要素の式評価で見えるバインディングスコープをダンプします(デバッグ用)。
|
|
@@ -13577,15 +13699,15 @@ const d = class d {
|
|
|
13577
13699
|
if (!t)
|
|
13578
13700
|
return { resolved: {}, sources: {} };
|
|
13579
13701
|
const r = t.getBindingData(), i = {}, n = (l) => {
|
|
13580
|
-
const u = l.getTarget(),
|
|
13581
|
-
return
|
|
13582
|
-
}, s = (l, u,
|
|
13702
|
+
const u = l.getTarget(), f = d.resolveElementId(u);
|
|
13703
|
+
return f !== "" ? `#${f}` : u.tagName.toLowerCase();
|
|
13704
|
+
}, s = (l, u, f, m) => {
|
|
13583
13705
|
if (l)
|
|
13584
13706
|
for (const y of Object.keys(l))
|
|
13585
13707
|
y in i || (i[y] = {
|
|
13586
13708
|
value: l[y],
|
|
13587
13709
|
source: n(u),
|
|
13588
|
-
kind:
|
|
13710
|
+
kind: f,
|
|
13589
13711
|
depth: m
|
|
13590
13712
|
});
|
|
13591
13713
|
};
|
|
@@ -13629,7 +13751,7 @@ const d = class d {
|
|
|
13629
13751
|
if (n) {
|
|
13630
13752
|
if (n.getParent() === r)
|
|
13631
13753
|
return Promise.resolve();
|
|
13632
|
-
if (r.attachObserved(n, i), n instanceof
|
|
13754
|
+
if (r.attachObserved(n, i), n instanceof w)
|
|
13633
13755
|
return d.scan(n.getTarget());
|
|
13634
13756
|
if (n instanceof ne)
|
|
13635
13757
|
return d.evaluateText(n);
|
|
@@ -13647,7 +13769,7 @@ const d = class d {
|
|
|
13647
13769
|
const r = t.getParent();
|
|
13648
13770
|
if (r && r.isSkipMutationNode(e))
|
|
13649
13771
|
return;
|
|
13650
|
-
if (t instanceof
|
|
13772
|
+
if (t instanceof w) {
|
|
13651
13773
|
t.detachObserved();
|
|
13652
13774
|
return;
|
|
13653
13775
|
}
|
|
@@ -13684,9 +13806,9 @@ const d = class d {
|
|
|
13684
13806
|
let l;
|
|
13685
13807
|
if (a) {
|
|
13686
13808
|
l = { ...o ?? {} };
|
|
13687
|
-
const u = String(a),
|
|
13809
|
+
const u = String(a), f = F.resolveAncestorArgOwner(n, u);
|
|
13688
13810
|
l[u] = F.mergeCollectedValues(
|
|
13689
|
-
(
|
|
13811
|
+
(f ? f.value : l[u]) ?? null,
|
|
13690
13812
|
s
|
|
13691
13813
|
);
|
|
13692
13814
|
} else
|
|
@@ -13700,7 +13822,7 @@ const d = class d {
|
|
|
13700
13822
|
// 持たず、ユーザー編集の印も解除しない)。
|
|
13701
13823
|
d.setBindingData(n.getTarget(), l, {
|
|
13702
13824
|
kind: "nonSupply",
|
|
13703
|
-
sequence:
|
|
13825
|
+
sequence: w.nextSequence()
|
|
13704
13826
|
})
|
|
13705
13827
|
);
|
|
13706
13828
|
}
|
|
@@ -13731,7 +13853,7 @@ const d = class d {
|
|
|
13731
13853
|
return Promise.resolve();
|
|
13732
13854
|
let r = d.reevaluateInterpolatedAttributes(e);
|
|
13733
13855
|
const i = e.hasAttribute(`${c.prefix}derive`), n = e.hasAttribute(`${c.prefix}if`), s = e.hasAttribute(`${c.prefix}each`), a = e.getRawAttribute(`${c.prefix}derive`), o = e.getRawAttribute(`${c.prefix}derive-name`);
|
|
13734
|
-
let l = !1, u = !1,
|
|
13856
|
+
let l = !1, u = !1, f = null;
|
|
13735
13857
|
if (!i && e.getDeriveSubtreeSignature() !== null && e.setDeriveSubtreeSignature(null), !i && e.getDeriveInputSignature() !== null && e.setDeriveInputSignature(null), i) {
|
|
13736
13858
|
const E = d.createDeriveInputSignature(
|
|
13737
13859
|
e,
|
|
@@ -13754,7 +13876,7 @@ const d = class d {
|
|
|
13754
13876
|
let m = !1, y = 0;
|
|
13755
13877
|
return n && (r = r.then(() => {
|
|
13756
13878
|
const E = e.isVisible();
|
|
13757
|
-
return y =
|
|
13879
|
+
return y = w.currentSequence(), d.evaluateIf(e, t).then(() => {
|
|
13758
13880
|
m = !E && e.isVisible();
|
|
13759
13881
|
});
|
|
13760
13882
|
})), s ? (e.getDeriveSubtreeSignature() !== null && e.setDeriveSubtreeSignature(null), r.then(() => d.evaluateEachFixedChildren(e)).then(() => d.evaluateEach(e)).then(() => {
|
|
@@ -13766,10 +13888,10 @@ const d = class d {
|
|
|
13766
13888
|
e.setDeriveSubtreeSignature(null), d.logDerivedSubtreeProfileSnapshot(e, "skip-ineligible");
|
|
13767
13889
|
return;
|
|
13768
13890
|
}
|
|
13769
|
-
|
|
13891
|
+
f = d.createDescendantBindingSignature(
|
|
13770
13892
|
e,
|
|
13771
13893
|
"evaluateAll"
|
|
13772
|
-
), u = !0, l = e.getDeriveSubtreeSignature() !== null && e.getDeriveSubtreeSignature() ===
|
|
13894
|
+
), u = !0, l = e.getDeriveSubtreeSignature() !== null && e.getDeriveSubtreeSignature() === f, d.logDerivedSubtreeProfileSnapshot(
|
|
13773
13895
|
e,
|
|
13774
13896
|
l ? "skip-hit" : "skip-miss"
|
|
13775
13897
|
);
|
|
@@ -13778,7 +13900,7 @@ const d = class d {
|
|
|
13778
13900
|
return;
|
|
13779
13901
|
const E = [];
|
|
13780
13902
|
return e.getChildren().forEach((A) => {
|
|
13781
|
-
if (A instanceof
|
|
13903
|
+
if (A instanceof w) {
|
|
13782
13904
|
if (d.canSkipUnchangedNestedEach(A))
|
|
13783
13905
|
return;
|
|
13784
13906
|
E.push(d.evaluateAll(A, t));
|
|
@@ -13786,7 +13908,7 @@ const d = class d {
|
|
|
13786
13908
|
}), Promise.all(E).then(() => {
|
|
13787
13909
|
});
|
|
13788
13910
|
}).then(() => {
|
|
13789
|
-
u &&
|
|
13911
|
+
u && f !== null && e.setDeriveSubtreeSignature(f);
|
|
13790
13912
|
}));
|
|
13791
13913
|
}
|
|
13792
13914
|
/**
|
|
@@ -13906,7 +14028,7 @@ const d = class d {
|
|
|
13906
14028
|
*/
|
|
13907
14029
|
static hasEachFixedChildren(e) {
|
|
13908
14030
|
return e.getChildren().some(
|
|
13909
|
-
(t) => t instanceof
|
|
14031
|
+
(t) => t instanceof w && d.isEachFixedChild(t)
|
|
13910
14032
|
);
|
|
13911
14033
|
}
|
|
13912
14034
|
/**
|
|
@@ -13928,7 +14050,7 @@ const d = class d {
|
|
|
13928
14050
|
static evaluateEachFixedChildren(e) {
|
|
13929
14051
|
const t = [];
|
|
13930
14052
|
return e.getChildren().forEach((r) => {
|
|
13931
|
-
r instanceof
|
|
14053
|
+
r instanceof w ? d.isEachFixedChild(r) && t.push(d.evaluateAll(r)) : r instanceof ne && t.push(d.evaluateText(r));
|
|
13932
14054
|
}), Promise.all(t).then(() => {
|
|
13933
14055
|
});
|
|
13934
14056
|
}
|
|
@@ -13947,7 +14069,7 @@ const d = class d {
|
|
|
13947
14069
|
static evaluateIfOnAttributeWrite(e) {
|
|
13948
14070
|
if (!e.hasAttribute(`${c.prefix}each`))
|
|
13949
14071
|
return d.evaluateIf(e);
|
|
13950
|
-
const t = e.isVisible(), r =
|
|
14072
|
+
const t = e.isVisible(), r = w.currentSequence();
|
|
13951
14073
|
return d.evaluateIf(e).then(() => {
|
|
13952
14074
|
if (!t)
|
|
13953
14075
|
return d.evaluateEach(e).then(() => d.reevaluateReactiveSpecialAttributes(e)).then(() => d.applyEnhancersOnShow(e, r));
|
|
@@ -13973,9 +14095,9 @@ const d = class d {
|
|
|
13973
14095
|
);
|
|
13974
14096
|
else {
|
|
13975
14097
|
e.restoreFormControlsDisabledByIf();
|
|
13976
|
-
const n = e.isVisible(), s =
|
|
14098
|
+
const n = e.isVisible(), s = w.currentSequence(), a = [], o = e.hasAttribute(`${c.prefix}each`);
|
|
13977
14099
|
e.getChildren().forEach((l) => {
|
|
13978
|
-
if (l instanceof
|
|
14100
|
+
if (l instanceof w) {
|
|
13979
14101
|
if (o && !d.isEachFixedChild(l))
|
|
13980
14102
|
return;
|
|
13981
14103
|
l.isMounted() ? n ? a.push(d.evaluateAll(l, t)) : a.push(
|
|
@@ -14211,7 +14333,7 @@ ${r}
|
|
|
14211
14333
|
if (r === null) {
|
|
14212
14334
|
let s = !1;
|
|
14213
14335
|
if (e.getChildren().forEach((a) => {
|
|
14214
|
-
if (!s && a instanceof
|
|
14336
|
+
if (!s && a instanceof w) {
|
|
14215
14337
|
if (a.hasAttribute(`${c.prefix}each-before`) || a.hasAttribute(`${c.prefix}each-after`))
|
|
14216
14338
|
return;
|
|
14217
14339
|
r = a.clone(), d.markFreshInitializationSkippable(r), e.setTemplate(r), s = !0, e.removeChild(a);
|
|
@@ -14224,11 +14346,11 @@ ${r}
|
|
|
14224
14346
|
(l) => !l.hasAttribute(`${c.prefix}each-before`) && !l.hasAttribute(`${c.prefix}each-after`)
|
|
14225
14347
|
).forEach((l) => {
|
|
14226
14348
|
if (!s) {
|
|
14227
|
-
const
|
|
14228
|
-
|
|
14349
|
+
const f = N.get(l);
|
|
14350
|
+
f instanceof w && (r = f.clone(), d.markFreshInitializationSkippable(r), e.setTemplate(r), s = !0);
|
|
14229
14351
|
}
|
|
14230
14352
|
const u = N.get(l);
|
|
14231
|
-
u instanceof
|
|
14353
|
+
u instanceof w && e.getChildren().includes(u) && (e.removeChild(u), u.setMounted(!1)), l.parentNode && l.parentNode.removeChild(l);
|
|
14232
14354
|
});
|
|
14233
14355
|
}
|
|
14234
14356
|
return this.updateDiff(e, t).then(() => {
|
|
@@ -14288,7 +14410,7 @@ ${r}
|
|
|
14288
14410
|
a instanceof ne ? d.areExpressionsRowLocal(
|
|
14289
14411
|
d.extractInterpolations(a.getRawText()),
|
|
14290
14412
|
i
|
|
14291
|
-
) && r.add(a) : a instanceof
|
|
14413
|
+
) && r.add(a) : a instanceof w && (d.isRowLocalSubtree(a, i) ? r.add(a) : n(a));
|
|
14292
14414
|
};
|
|
14293
14415
|
return n(t), r;
|
|
14294
14416
|
}
|
|
@@ -14424,7 +14546,7 @@ ${r}
|
|
|
14424
14546
|
typeof s == "string" && s !== "" && n.add(s), r = n;
|
|
14425
14547
|
}
|
|
14426
14548
|
for (const i of e.getChildren())
|
|
14427
|
-
if (i instanceof
|
|
14549
|
+
if (i instanceof w) {
|
|
14428
14550
|
if (!d.isRowLocalSubtree(i, r))
|
|
14429
14551
|
return !1;
|
|
14430
14552
|
} else if (i instanceof ne) {
|
|
@@ -14487,7 +14609,7 @@ ${r}
|
|
|
14487
14609
|
* @returns 含むなら true
|
|
14488
14610
|
*/
|
|
14489
14611
|
static hasDisallowedDerivedSubtreeDescendant(e) {
|
|
14490
|
-
return e.getChildren().some((t) => t instanceof
|
|
14612
|
+
return e.getChildren().some((t) => t instanceof w ? t.hasAttribute(`${c.prefix}derive`) || t.hasAttribute(`${c.prefix}derive-name`) || t.hasAttribute(`${c.prefix}fetch`) || t.hasAttribute(`${c.prefix}import`) ? !0 : d.hasDisallowedDerivedSubtreeDescendant(t) : !1);
|
|
14491
14613
|
}
|
|
14492
14614
|
/**
|
|
14493
14615
|
* data-derive host が子孫要素へ公開している binding の署名を返します。
|
|
@@ -14528,7 +14650,7 @@ ${r}
|
|
|
14528
14650
|
document.querySelectorAll(`[${e}]`)
|
|
14529
14651
|
).map((i) => {
|
|
14530
14652
|
const n = N.peek(i);
|
|
14531
|
-
return n instanceof
|
|
14653
|
+
return n instanceof w ? d.setAttribute(
|
|
14532
14654
|
i,
|
|
14533
14655
|
e,
|
|
14534
14656
|
n.getRawAttribute(e) ?? ""
|
|
@@ -14557,7 +14679,7 @@ ${r}
|
|
|
14557
14679
|
r.setDeriveSubtreeSignature(null);
|
|
14558
14680
|
const t = (r) => {
|
|
14559
14681
|
r.setDeriveSubtreeSignature(null), r.getChildren().forEach((i) => {
|
|
14560
|
-
i instanceof
|
|
14682
|
+
i instanceof w && t(i);
|
|
14561
14683
|
});
|
|
14562
14684
|
};
|
|
14563
14685
|
t(e);
|
|
@@ -14637,7 +14759,7 @@ ${r}
|
|
|
14637
14759
|
typeof a == "string" && a.trim() !== "" && (n += `[${c.prefix}derive-name="${a.trim()}"]`);
|
|
14638
14760
|
const o = r.getParent();
|
|
14639
14761
|
if (o) {
|
|
14640
|
-
const l = o.getChildren().filter((u) => u instanceof
|
|
14762
|
+
const l = o.getChildren().filter((u) => u instanceof w).findIndex((u) => u === r);
|
|
14641
14763
|
n += `:nth-child(${l + 1})`;
|
|
14642
14764
|
}
|
|
14643
14765
|
t.unshift(n), r = o;
|
|
@@ -14710,7 +14832,7 @@ ${r}
|
|
|
14710
14832
|
* @returns subtree 全体を省略可能なら true
|
|
14711
14833
|
*/
|
|
14712
14834
|
static markFreshInitializationSkippable(e) {
|
|
14713
|
-
const t = e.getAttributeNames().some((n) => d.isFreshInitializationDynamicAttribute(e, n)), r = e.getChildren().some((n) => n instanceof
|
|
14835
|
+
const t = e.getAttributeNames().some((n) => d.isFreshInitializationDynamicAttribute(e, n)), r = e.getChildren().some((n) => n instanceof w ? !d.markFreshInitializationSkippable(n) : n instanceof ne ? n.hasDynamicContent() : !1), i = !t && !r;
|
|
14714
14836
|
return e.setFreshInitializationSkippable(i), i;
|
|
14715
14837
|
}
|
|
14716
14838
|
/**
|
|
@@ -14749,11 +14871,11 @@ ${r}
|
|
|
14749
14871
|
l.set(x, (l.get(x) ?? 0) + 1);
|
|
14750
14872
|
}), n && o.size !== a.length && d.warnDuplicateEachKey(String(n));
|
|
14751
14873
|
const u = [];
|
|
14752
|
-
let
|
|
14874
|
+
let f = e.getChildren().filter((x) => x instanceof w).filter(
|
|
14753
14875
|
(x) => !x.hasAttribute(`${c.prefix}each-before`) && !x.hasAttribute(`${c.prefix}each-after`)
|
|
14754
14876
|
);
|
|
14755
|
-
const m =
|
|
14756
|
-
|
|
14877
|
+
const m = f.map((x) => x.getListKey()), y = /* @__PURE__ */ new Set();
|
|
14878
|
+
f = f.filter((x, Y) => {
|
|
14757
14879
|
const Q = String(x.getListKey()), X = l.get(Q) ?? 0;
|
|
14758
14880
|
if (X === 0) {
|
|
14759
14881
|
y.add(x);
|
|
@@ -14762,15 +14884,15 @@ ${r}
|
|
|
14762
14884
|
}
|
|
14763
14885
|
return l.set(Q, X - 1), !0;
|
|
14764
14886
|
});
|
|
14765
|
-
const E =
|
|
14766
|
-
|
|
14887
|
+
const E = f.map((x) => x.getListKey()), A = /* @__PURE__ */ new Map();
|
|
14888
|
+
f.forEach((x) => {
|
|
14767
14889
|
const Y = x.getListKey();
|
|
14768
14890
|
if (Y === null)
|
|
14769
14891
|
return;
|
|
14770
14892
|
const Q = A.get(Y);
|
|
14771
14893
|
Q ? Q.push(x) : A.set(Y, [x]);
|
|
14772
14894
|
});
|
|
14773
|
-
const
|
|
14895
|
+
const D = e.getChildElementFragments().filter((x) => !y.has(x)), C = D.filter(
|
|
14774
14896
|
(x) => x.hasAttribute(`${c.prefix}each-before`)
|
|
14775
14897
|
).length;
|
|
14776
14898
|
let P = Promise.resolve();
|
|
@@ -14781,7 +14903,7 @@ ${r}
|
|
|
14781
14903
|
const se = A.get(x)?.shift();
|
|
14782
14904
|
if (se) {
|
|
14783
14905
|
j = se;
|
|
14784
|
-
const R =
|
|
14906
|
+
const R = C + Y;
|
|
14785
14907
|
P = P.then(
|
|
14786
14908
|
() => d.updateRowFragment(
|
|
14787
14909
|
j,
|
|
@@ -14798,13 +14920,13 @@ ${r}
|
|
|
14798
14920
|
d.repositionEachRow(
|
|
14799
14921
|
e,
|
|
14800
14922
|
j,
|
|
14801
|
-
|
|
14923
|
+
D,
|
|
14802
14924
|
R
|
|
14803
14925
|
).then((K) => {
|
|
14804
14926
|
K !== null && B.rowMove(
|
|
14805
14927
|
j.getTarget(),
|
|
14806
14928
|
x,
|
|
14807
|
-
K -
|
|
14929
|
+
K - C,
|
|
14808
14930
|
Y
|
|
14809
14931
|
), !(!$ && d.isRowLocalEachTemplate(e)) && ee.push(
|
|
14810
14932
|
d.evaluateAll(
|
|
@@ -14818,7 +14940,7 @@ ${r}
|
|
|
14818
14940
|
);
|
|
14819
14941
|
} else {
|
|
14820
14942
|
j = r.clone();
|
|
14821
|
-
const R =
|
|
14943
|
+
const R = C + Y;
|
|
14822
14944
|
P = P.then(
|
|
14823
14945
|
() => d.updateRowFragment(
|
|
14824
14946
|
j,
|
|
@@ -14828,9 +14950,9 @@ ${r}
|
|
|
14828
14950
|
s ? String(s) : null,
|
|
14829
14951
|
x
|
|
14830
14952
|
).then(() => {
|
|
14831
|
-
const $ =
|
|
14953
|
+
const $ = D[R] ?? null;
|
|
14832
14954
|
return e.insertBefore(j, $).then(() => {
|
|
14833
|
-
|
|
14955
|
+
D.splice(R, 0, j);
|
|
14834
14956
|
}).then(() => d.initializeFreshEachRow(j)).then(() => d.applyRowFormValues(e, j, Q)).then(() => {
|
|
14835
14957
|
B.rowAdd(j.getTarget(), x, X, Q);
|
|
14836
14958
|
});
|
|
@@ -14880,7 +15002,7 @@ ${r}
|
|
|
14880
15002
|
*/
|
|
14881
15003
|
static warnExtraEachChildren(e) {
|
|
14882
15004
|
const t = e.getChildren().filter(
|
|
14883
|
-
(r) => r instanceof
|
|
15005
|
+
(r) => r instanceof w
|
|
14884
15006
|
).filter(
|
|
14885
15007
|
(r) => !r.hasAttribute(`${c.prefix}each-before`) && !r.hasAttribute(`${c.prefix}each-after`)
|
|
14886
15008
|
);
|
|
@@ -15142,8 +15264,8 @@ d.ATTRIBUTE_ALIAS_SUFFIX = "attr-", d.PRIORITY_ATTRIBUTE_SUFFIXES = [
|
|
|
15142
15264
|
"enhance",
|
|
15143
15265
|
"enhance-new"
|
|
15144
15266
|
]), d.ROW_LOCAL_ROW_OPERATIONS = /* @__PURE__ */ new Set(["row-add", "row-remove", "row-prev", "row-next"]), d.REACTIVE_FETCH_STATES = /* @__PURE__ */ new WeakMap(), d.REACTIVE_IMPORT_STATES = /* @__PURE__ */ new WeakMap(), d.DERIVE_SUBTREE_PROFILES = /* @__PURE__ */ new WeakMap(), d.EACH_UPDATE_STATES = /* @__PURE__ */ new WeakMap(), d.EACH_RENDERED_CHANGE_FIRED = /* @__PURE__ */ new WeakSet(), d.EACH_RENDERED_CHANGE_WARNED = /* @__PURE__ */ new WeakSet(), d.WARNED_DUPLICATE_EACH_KEYS = /* @__PURE__ */ new Set(), d.ABSENT_PATH = Symbol("absent");
|
|
15145
|
-
let
|
|
15146
|
-
const
|
|
15267
|
+
let M = d;
|
|
15268
|
+
const we = class we {
|
|
15147
15269
|
/**
|
|
15148
15270
|
* コンストラクタ。
|
|
15149
15271
|
*
|
|
@@ -15163,8 +15285,8 @@ const Se = class Se {
|
|
|
15163
15285
|
this.runWindowLoadProcedure();
|
|
15164
15286
|
}, this.onPopstate = (t) => {
|
|
15165
15287
|
const r = t.state;
|
|
15166
|
-
if (!r || r[
|
|
15167
|
-
|
|
15288
|
+
if (!r || r[we.HISTORY_STATE_KEY] !== !0) {
|
|
15289
|
+
M.refreshUrlParams();
|
|
15168
15290
|
return;
|
|
15169
15291
|
}
|
|
15170
15292
|
location.reload();
|
|
@@ -15271,7 +15393,7 @@ const Se = class Se {
|
|
|
15271
15393
|
subscribeCustomEvent(e) {
|
|
15272
15394
|
if (e === null || e === "")
|
|
15273
15395
|
return;
|
|
15274
|
-
if (
|
|
15396
|
+
if (we.BUILTIN_EVENT_NAMES.has(e)) {
|
|
15275
15397
|
g.warn(
|
|
15276
15398
|
"[Haori]",
|
|
15277
15399
|
`data-on="${e}" は組み込みイベントです。data-${e}-* を使用してください(data-on はカスタムイベント専用)。`
|
|
@@ -15301,7 +15423,7 @@ const Se = class Se {
|
|
|
15301
15423
|
if (i.getAttribute(this.onAttributeName) !== e)
|
|
15302
15424
|
return;
|
|
15303
15425
|
const n = N.get(i);
|
|
15304
|
-
n instanceof
|
|
15426
|
+
n instanceof w && this.isFromTarget(n, t) && new ae(n, "on", t).run().catch((s) => {
|
|
15305
15427
|
g.error("[Haori]", "Procedure execution error:", s);
|
|
15306
15428
|
});
|
|
15307
15429
|
});
|
|
@@ -15445,7 +15567,7 @@ const Se = class Se {
|
|
|
15445
15567
|
*/
|
|
15446
15568
|
markUserEditOnly(e) {
|
|
15447
15569
|
const t = N.get(e);
|
|
15448
|
-
t instanceof
|
|
15570
|
+
t instanceof w && t.markUserEdit();
|
|
15449
15571
|
}
|
|
15450
15572
|
/**
|
|
15451
15573
|
* `change` / `input` の対象要素について、内部値の同期とユーザー編集の記録を行います。
|
|
@@ -15461,13 +15583,13 @@ const Se = class Se {
|
|
|
15461
15583
|
*/
|
|
15462
15584
|
syncUserEdit(e, t) {
|
|
15463
15585
|
const r = N.get(e);
|
|
15464
|
-
if (r instanceof
|
|
15586
|
+
if (r instanceof w && (r.syncValue(), t ? r.markUserEditOnChange() : r.markUserEdit(), e instanceof HTMLInputElement && e.type === "radio" && e.name)) {
|
|
15465
15587
|
const i = document.getElementsByName(e.name);
|
|
15466
15588
|
for (const n of Array.from(i)) {
|
|
15467
15589
|
if (n === e || !(n instanceof HTMLInputElement) || n.type !== "radio" || n.form !== e.form)
|
|
15468
15590
|
continue;
|
|
15469
15591
|
const s = N.get(n);
|
|
15470
|
-
s instanceof
|
|
15592
|
+
s instanceof w && (s.syncValue(), s.markUserEdit());
|
|
15471
15593
|
}
|
|
15472
15594
|
}
|
|
15473
15595
|
}
|
|
@@ -15514,13 +15636,13 @@ const Se = class Se {
|
|
|
15514
15636
|
return null;
|
|
15515
15637
|
}
|
|
15516
15638
|
};
|
|
15517
|
-
|
|
15639
|
+
we.HISTORY_STATE_KEY = "__haoriHistoryState__", we.BUILTIN_EVENT_NAMES = /* @__PURE__ */ new Set([
|
|
15518
15640
|
"click",
|
|
15519
15641
|
"change",
|
|
15520
15642
|
"input",
|
|
15521
15643
|
"load"
|
|
15522
15644
|
]);
|
|
15523
|
-
let Ke =
|
|
15645
|
+
let Ke = we;
|
|
15524
15646
|
const V = class V {
|
|
15525
15647
|
/**
|
|
15526
15648
|
* ノードが現在の Window に属する HTMLElement かどうかを判定します。
|
|
@@ -15575,8 +15697,8 @@ const V = class V {
|
|
|
15575
15697
|
const o = new IntersectionObserver(
|
|
15576
15698
|
(l) => {
|
|
15577
15699
|
const u = V.registrations.get(e);
|
|
15578
|
-
u && l.forEach((
|
|
15579
|
-
if (u.intersecting =
|
|
15700
|
+
u && l.forEach((f) => {
|
|
15701
|
+
if (u.intersecting = f.isIntersecting, !!f.isIntersecting) {
|
|
15580
15702
|
if (u.running || V.isDisabled(u.fragment)) {
|
|
15581
15703
|
u.pending = !0;
|
|
15582
15704
|
return;
|
|
@@ -15719,7 +15841,7 @@ V.CONFIG_KEYS = /* @__PURE__ */ new Set([
|
|
|
15719
15841
|
"once"
|
|
15720
15842
|
]), V.registrations = /* @__PURE__ */ new Map();
|
|
15721
15843
|
let Ae = V;
|
|
15722
|
-
const
|
|
15844
|
+
const S = class S {
|
|
15723
15845
|
/**
|
|
15724
15846
|
* 指定ノードとその子孫を走査し、`data-poll-*` の監視状態を同期します。
|
|
15725
15847
|
*
|
|
@@ -15727,8 +15849,8 @@ const w = class w {
|
|
|
15727
15849
|
* @returns 戻り値はありません。
|
|
15728
15850
|
*/
|
|
15729
15851
|
static syncTree(e) {
|
|
15730
|
-
(e instanceof Element || e instanceof DocumentFragment) && (
|
|
15731
|
-
|
|
15852
|
+
(e instanceof Element || e instanceof DocumentFragment) && (S.isHtmlElement(e) && S.syncElement(e), e.querySelectorAll("*").forEach((t) => {
|
|
15853
|
+
S.syncElement(t);
|
|
15732
15854
|
}));
|
|
15733
15855
|
}
|
|
15734
15856
|
/**
|
|
@@ -15741,23 +15863,23 @@ const w = class w {
|
|
|
15741
15863
|
* @returns 戻り値はありません。
|
|
15742
15864
|
*/
|
|
15743
15865
|
static syncElement(e) {
|
|
15744
|
-
const t =
|
|
15745
|
-
if (!t && !
|
|
15866
|
+
const t = S.registrations.get(e);
|
|
15867
|
+
if (!t && !S.hasPollAttribute(e))
|
|
15746
15868
|
return;
|
|
15747
15869
|
const r = N.get(e);
|
|
15748
|
-
if (!(r instanceof
|
|
15749
|
-
t &&
|
|
15870
|
+
if (!(r instanceof w) || !S.shouldObserve(r)) {
|
|
15871
|
+
t && S.teardown(e, t);
|
|
15750
15872
|
return;
|
|
15751
15873
|
}
|
|
15752
|
-
const i =
|
|
15874
|
+
const i = S.buildConfigKey(r);
|
|
15753
15875
|
if (t) {
|
|
15754
15876
|
if (t.configKey === i) {
|
|
15755
15877
|
t.fragment = r;
|
|
15756
15878
|
return;
|
|
15757
15879
|
}
|
|
15758
|
-
|
|
15880
|
+
S.teardown(e, t);
|
|
15759
15881
|
}
|
|
15760
|
-
|
|
15882
|
+
S.startPolling(e, r, i);
|
|
15761
15883
|
}
|
|
15762
15884
|
/**
|
|
15763
15885
|
* 指定ノードとその子孫の監視を解除します。
|
|
@@ -15769,13 +15891,13 @@ const w = class w {
|
|
|
15769
15891
|
* @returns 戻り値はありません。
|
|
15770
15892
|
*/
|
|
15771
15893
|
static cleanupTree(e) {
|
|
15772
|
-
if (
|
|
15773
|
-
const t =
|
|
15774
|
-
t &&
|
|
15894
|
+
if (S.isHtmlElement(e)) {
|
|
15895
|
+
const t = S.registrations.get(e);
|
|
15896
|
+
t && S.teardown(e, t);
|
|
15775
15897
|
}
|
|
15776
15898
|
(e instanceof Element || e instanceof DocumentFragment) && e.querySelectorAll("*").forEach((t) => {
|
|
15777
|
-
const r =
|
|
15778
|
-
r &&
|
|
15899
|
+
const r = S.registrations.get(t);
|
|
15900
|
+
r && S.teardown(t, r);
|
|
15779
15901
|
});
|
|
15780
15902
|
}
|
|
15781
15903
|
/**
|
|
@@ -15784,12 +15906,12 @@ const w = class w {
|
|
|
15784
15906
|
* @returns 戻り値はありません。
|
|
15785
15907
|
*/
|
|
15786
15908
|
static disconnectAll() {
|
|
15787
|
-
|
|
15788
|
-
|
|
15789
|
-
}),
|
|
15909
|
+
S.registrations.forEach((e) => {
|
|
15910
|
+
S.clearTimers(e);
|
|
15911
|
+
}), S.registrations.clear(), S.visibilityListener && typeof document < "u" && document.removeEventListener(
|
|
15790
15912
|
"visibilitychange",
|
|
15791
|
-
|
|
15792
|
-
),
|
|
15913
|
+
S.visibilityListener
|
|
15914
|
+
), S.visibilityListener = null;
|
|
15793
15915
|
}
|
|
15794
15916
|
/**
|
|
15795
15917
|
* ノードが現在の Window に属する HTMLElement かどうかを判定します。
|
|
@@ -15831,7 +15953,7 @@ const w = class w {
|
|
|
15831
15953
|
*/
|
|
15832
15954
|
static shouldObserve(e) {
|
|
15833
15955
|
const t = `${c.prefix}poll-`;
|
|
15834
|
-
return e.getAttributeNames().some((r) => r.startsWith(t) ? !
|
|
15956
|
+
return e.getAttributeNames().some((r) => r.startsWith(t) ? !S.CONFIG_KEYS.has(r.slice(t.length)) : !1);
|
|
15835
15957
|
}
|
|
15836
15958
|
/**
|
|
15837
15959
|
* 設定の同一性を判定するキーを組み立てます。
|
|
@@ -15863,9 +15985,9 @@ const w = class w {
|
|
|
15863
15985
|
const i = {
|
|
15864
15986
|
fragment: t,
|
|
15865
15987
|
configKey: r,
|
|
15866
|
-
intervalMs:
|
|
15867
|
-
timeoutMs:
|
|
15868
|
-
errorLimit:
|
|
15988
|
+
intervalMs: S.resolveInterval(t),
|
|
15989
|
+
timeoutMs: S.resolveTimeout(t),
|
|
15990
|
+
errorLimit: S.resolveErrorLimit(t),
|
|
15869
15991
|
startedAt: performance.now(),
|
|
15870
15992
|
intervalTimerId: null,
|
|
15871
15993
|
timeoutTimerId: null,
|
|
@@ -15877,9 +15999,9 @@ const w = class w {
|
|
|
15877
15999
|
count: 0,
|
|
15878
16000
|
consecutiveErrors: 0
|
|
15879
16001
|
};
|
|
15880
|
-
|
|
15881
|
-
|
|
15882
|
-
}, i.timeoutMs)),
|
|
16002
|
+
S.registrations.set(e, i), S.ensureVisibilityListener(), i.timeoutMs !== null && (i.timeoutTimerId = setTimeout(() => {
|
|
16003
|
+
S.handleTimeout(e);
|
|
16004
|
+
}, i.timeoutMs)), S.injectState(i), S.tick(e);
|
|
15883
16005
|
}
|
|
15884
16006
|
/**
|
|
15885
16007
|
* 1回分のポーリング処理を実行し、継続する場合は次回を予約します。
|
|
@@ -15888,20 +16010,20 @@ const w = class w {
|
|
|
15888
16010
|
* @returns 処理完了の Promise
|
|
15889
16011
|
*/
|
|
15890
16012
|
static async tick(e) {
|
|
15891
|
-
const t =
|
|
16013
|
+
const t = S.registrations.get(e);
|
|
15892
16014
|
if (!t || t.stopped || t.fetching)
|
|
15893
16015
|
return;
|
|
15894
16016
|
if (t.intervalTimerId = null, !e.isConnected) {
|
|
15895
|
-
await
|
|
16017
|
+
await S.stop(e, t, "detached");
|
|
15896
16018
|
return;
|
|
15897
16019
|
}
|
|
15898
|
-
const r =
|
|
15899
|
-
if (r !== t.paused && (t.paused = r, await
|
|
15900
|
-
|
|
16020
|
+
const r = S.isHidden(e) || S.isDisabled(t.fragment);
|
|
16021
|
+
if (r !== t.paused && (t.paused = r, await S.injectState(t)), r) {
|
|
16022
|
+
S.schedule(e, t);
|
|
15901
16023
|
return;
|
|
15902
16024
|
}
|
|
15903
|
-
if (
|
|
15904
|
-
await
|
|
16025
|
+
if (S.isUntilSatisfied(t.fragment)) {
|
|
16026
|
+
await S.stop(e, t, "until");
|
|
15905
16027
|
return;
|
|
15906
16028
|
}
|
|
15907
16029
|
t.fetching = !0, t.count += 1;
|
|
@@ -15916,18 +16038,18 @@ const w = class w {
|
|
|
15916
16038
|
} finally {
|
|
15917
16039
|
t.fetching = !1;
|
|
15918
16040
|
}
|
|
15919
|
-
if (!(
|
|
16041
|
+
if (!(S.registrations.get(e) !== t || t.stopped)) {
|
|
15920
16042
|
if (i)
|
|
15921
16043
|
t.consecutiveErrors = 0;
|
|
15922
16044
|
else if (t.consecutiveErrors += 1, t.errorLimit !== null && t.consecutiveErrors >= t.errorLimit) {
|
|
15923
|
-
await
|
|
16045
|
+
await S.stop(e, t, "error");
|
|
15924
16046
|
return;
|
|
15925
16047
|
}
|
|
15926
|
-
if (i &&
|
|
15927
|
-
await
|
|
16048
|
+
if (i && S.isUntilSatisfied(t.fragment)) {
|
|
16049
|
+
await S.stop(e, t, "until");
|
|
15928
16050
|
return;
|
|
15929
16051
|
}
|
|
15930
|
-
|
|
16052
|
+
S.schedule(e, t);
|
|
15931
16053
|
}
|
|
15932
16054
|
}
|
|
15933
16055
|
/**
|
|
@@ -15942,7 +16064,7 @@ const w = class w {
|
|
|
15942
16064
|
*/
|
|
15943
16065
|
static schedule(e, t) {
|
|
15944
16066
|
t.stopped || t.intervalTimerId !== null || (t.intervalTimerId = setTimeout(() => {
|
|
15945
|
-
|
|
16067
|
+
S.tick(e);
|
|
15946
16068
|
}, t.intervalMs));
|
|
15947
16069
|
}
|
|
15948
16070
|
/**
|
|
@@ -15952,12 +16074,12 @@ const w = class w {
|
|
|
15952
16074
|
* @returns 処理完了の Promise
|
|
15953
16075
|
*/
|
|
15954
16076
|
static async handleTimeout(e) {
|
|
15955
|
-
const t =
|
|
16077
|
+
const t = S.registrations.get(e);
|
|
15956
16078
|
!t || t.stopped || (t.timeoutTimerId = null, t.timedOut = !0, e.isConnected && B.pollTimeout(
|
|
15957
16079
|
e,
|
|
15958
16080
|
t.count,
|
|
15959
|
-
|
|
15960
|
-
), await
|
|
16081
|
+
S.elapsed(t)
|
|
16082
|
+
), await S.stop(e, t, "timeout"));
|
|
15961
16083
|
}
|
|
15962
16084
|
/**
|
|
15963
16085
|
* ポーリングを恒久停止します。
|
|
@@ -15969,15 +16091,15 @@ const w = class w {
|
|
|
15969
16091
|
*/
|
|
15970
16092
|
static async stop(e, t, r) {
|
|
15971
16093
|
if (!t.stopped) {
|
|
15972
|
-
if (t.stopped = !0, t.stopReason = r, t.paused = !1,
|
|
15973
|
-
|
|
16094
|
+
if (t.stopped = !0, t.stopReason = r, t.paused = !1, S.clearTimers(t), r === "detached") {
|
|
16095
|
+
S.registrations.delete(e);
|
|
15974
16096
|
return;
|
|
15975
16097
|
}
|
|
15976
|
-
await
|
|
16098
|
+
await S.injectState(t), e.isConnected && B.pollStop(
|
|
15977
16099
|
e,
|
|
15978
16100
|
r,
|
|
15979
16101
|
t.count,
|
|
15980
|
-
|
|
16102
|
+
S.elapsed(t)
|
|
15981
16103
|
);
|
|
15982
16104
|
}
|
|
15983
16105
|
}
|
|
@@ -15989,7 +16111,7 @@ const w = class w {
|
|
|
15989
16111
|
* @returns 戻り値はありません。
|
|
15990
16112
|
*/
|
|
15991
16113
|
static teardown(e, t) {
|
|
15992
|
-
|
|
16114
|
+
S.clearTimers(t), S.registrations.delete(e);
|
|
15993
16115
|
}
|
|
15994
16116
|
/**
|
|
15995
16117
|
* 登録情報が持つタイマーをすべて破棄します。
|
|
@@ -16018,16 +16140,16 @@ const w = class w {
|
|
|
16018
16140
|
* @returns 戻り値はありません。
|
|
16019
16141
|
*/
|
|
16020
16142
|
static ensureVisibilityListener() {
|
|
16021
|
-
if (
|
|
16143
|
+
if (S.visibilityListener || typeof document > "u")
|
|
16022
16144
|
return;
|
|
16023
16145
|
const e = () => {
|
|
16024
|
-
document.visibilityState === "visible" && Array.from(
|
|
16146
|
+
document.visibilityState === "visible" && Array.from(S.registrations.entries()).forEach(
|
|
16025
16147
|
([t, r]) => {
|
|
16026
|
-
r.stopped || r.fetching || (r.intervalTimerId !== null && (clearTimeout(r.intervalTimerId), r.intervalTimerId = null),
|
|
16148
|
+
r.stopped || r.fetching || (r.intervalTimerId !== null && (clearTimeout(r.intervalTimerId), r.intervalTimerId = null), S.tick(t));
|
|
16027
16149
|
}
|
|
16028
16150
|
);
|
|
16029
16151
|
};
|
|
16030
|
-
|
|
16152
|
+
S.visibilityListener = e, document.addEventListener("visibilitychange", e);
|
|
16031
16153
|
}
|
|
16032
16154
|
/**
|
|
16033
16155
|
* `_poll` 状態を注入先のバインディングデータへ反映します。
|
|
@@ -16041,7 +16163,7 @@ const w = class w {
|
|
|
16041
16163
|
* @returns 注入完了の Promise
|
|
16042
16164
|
*/
|
|
16043
16165
|
static injectState(e) {
|
|
16044
|
-
const t =
|
|
16166
|
+
const t = S.resolveStateFragments(e);
|
|
16045
16167
|
if (t.length === 0)
|
|
16046
16168
|
return Promise.resolve();
|
|
16047
16169
|
const r = {
|
|
@@ -16051,7 +16173,7 @@ const w = class w {
|
|
|
16051
16173
|
timedOut: e.timedOut,
|
|
16052
16174
|
stopReason: e.stopReason,
|
|
16053
16175
|
count: e.count,
|
|
16054
|
-
elapsedMs:
|
|
16176
|
+
elapsedMs: S.elapsed(e)
|
|
16055
16177
|
};
|
|
16056
16178
|
return Promise.all(
|
|
16057
16179
|
t.map((i) => {
|
|
@@ -16059,12 +16181,12 @@ const w = class w {
|
|
|
16059
16181
|
...i.getRawBindingData() ?? {},
|
|
16060
16182
|
_poll: r
|
|
16061
16183
|
};
|
|
16062
|
-
return
|
|
16184
|
+
return M.setBindingData(n, s, {
|
|
16063
16185
|
reflectToAttribute: !1,
|
|
16064
16186
|
// 状態変数の注入は値の供給ではない(権威を持たず、ユーザー編集の印も
|
|
16065
16187
|
// 解除しない)。
|
|
16066
16188
|
kind: "nonSupply",
|
|
16067
|
-
sequence:
|
|
16189
|
+
sequence: w.nextSequence()
|
|
16068
16190
|
});
|
|
16069
16191
|
})
|
|
16070
16192
|
).then(() => {
|
|
@@ -16098,7 +16220,7 @@ const w = class w {
|
|
|
16098
16220
|
if (!a.isConnected)
|
|
16099
16221
|
return;
|
|
16100
16222
|
const o = N.get(a);
|
|
16101
|
-
o instanceof
|
|
16223
|
+
o instanceof w && s.push(o);
|
|
16102
16224
|
}), s;
|
|
16103
16225
|
}
|
|
16104
16226
|
/**
|
|
@@ -16113,15 +16235,15 @@ const w = class w {
|
|
|
16113
16235
|
static resolveInterval(e) {
|
|
16114
16236
|
const t = `${c.prefix}poll-interval`;
|
|
16115
16237
|
if (!e.hasAttribute(t))
|
|
16116
|
-
return
|
|
16117
|
-
const r =
|
|
16238
|
+
return S.DEFAULT_INTERVAL_MS;
|
|
16239
|
+
const r = S.toNumber(e.getAttribute(t));
|
|
16118
16240
|
return r === null ? (g.warn(
|
|
16119
16241
|
"[Haori]",
|
|
16120
|
-
`${t} は数値で指定してください。既定値 ${
|
|
16121
|
-
),
|
|
16242
|
+
`${t} は数値で指定してください。既定値 ${S.DEFAULT_INTERVAL_MS}ms を使用します。`
|
|
16243
|
+
), S.DEFAULT_INTERVAL_MS) : r < S.MIN_INTERVAL_MS ? (g.warn(
|
|
16122
16244
|
"[Haori]",
|
|
16123
|
-
`${t} の下限は ${
|
|
16124
|
-
),
|
|
16245
|
+
`${t} の下限は ${S.MIN_INTERVAL_MS}ms です。${r}ms は下限へ切り上げます。`
|
|
16246
|
+
), S.MIN_INTERVAL_MS) : r;
|
|
16125
16247
|
}
|
|
16126
16248
|
/**
|
|
16127
16249
|
* `data-poll-timeout` を解決します。
|
|
@@ -16133,7 +16255,7 @@ const w = class w {
|
|
|
16133
16255
|
const t = `${c.prefix}poll-timeout`;
|
|
16134
16256
|
if (!e.hasAttribute(t))
|
|
16135
16257
|
return null;
|
|
16136
|
-
const r =
|
|
16258
|
+
const r = S.toNumber(e.getAttribute(t));
|
|
16137
16259
|
return r === null || r <= 0 ? (g.warn(
|
|
16138
16260
|
"[Haori]",
|
|
16139
16261
|
`${t} は正の数値で指定してください。無制限として扱います。`
|
|
@@ -16149,7 +16271,7 @@ const w = class w {
|
|
|
16149
16271
|
const t = `${c.prefix}poll-error-limit`;
|
|
16150
16272
|
if (!e.hasAttribute(t))
|
|
16151
16273
|
return null;
|
|
16152
|
-
const r =
|
|
16274
|
+
const r = S.toNumber(e.getAttribute(t));
|
|
16153
16275
|
return r === null || r < 1 ? (g.warn(
|
|
16154
16276
|
"[Haori]",
|
|
16155
16277
|
`${t} は 1 以上の数値で指定してください。無制限として扱います。`
|
|
@@ -16191,7 +16313,7 @@ const w = class w {
|
|
|
16191
16313
|
*/
|
|
16192
16314
|
static isDisabled(e) {
|
|
16193
16315
|
const t = `${c.prefix}poll-disabled`;
|
|
16194
|
-
return e.hasAttribute(t) ?
|
|
16316
|
+
return e.hasAttribute(t) ? S.isTruthy(e.getAttribute(t)) : !1;
|
|
16195
16317
|
}
|
|
16196
16318
|
/**
|
|
16197
16319
|
* `data-poll-until` の条件が成立したかどうかを判定します。
|
|
@@ -16214,7 +16336,7 @@ const w = class w {
|
|
|
16214
16336
|
`${t} に未解決の参照が含まれています(停止条件は成立扱いにしません):`,
|
|
16215
16337
|
e.getRawAttribute(t),
|
|
16216
16338
|
e.getTarget()
|
|
16217
|
-
), !1) :
|
|
16339
|
+
), !1) : S.isTruthy(r.value) : !1;
|
|
16218
16340
|
}
|
|
16219
16341
|
/**
|
|
16220
16342
|
* 属性の評価値を真偽値として解釈します。
|
|
@@ -16237,16 +16359,16 @@ const w = class w {
|
|
|
16237
16359
|
return !!e;
|
|
16238
16360
|
}
|
|
16239
16361
|
};
|
|
16240
|
-
|
|
16362
|
+
S.CONFIG_KEYS = /* @__PURE__ */ new Set([
|
|
16241
16363
|
"interval",
|
|
16242
16364
|
"timeout",
|
|
16243
16365
|
"until",
|
|
16244
16366
|
"error-limit",
|
|
16245
16367
|
"disabled",
|
|
16246
16368
|
"state"
|
|
16247
|
-
]),
|
|
16248
|
-
let ve =
|
|
16249
|
-
const Qt = "0.62.
|
|
16369
|
+
]), S.DEFAULT_INTERVAL_MS = 5e3, S.MIN_INTERVAL_MS = 100, S.registrations = /* @__PURE__ */ new Map(), S.visibilityListener = null;
|
|
16370
|
+
let ve = S;
|
|
16371
|
+
const Qt = "0.62.3";
|
|
16250
16372
|
function _t(b) {
|
|
16251
16373
|
typeof requestAnimationFrame == "function" ? requestAnimationFrame(() => b()) : Promise.resolve().then(b);
|
|
16252
16374
|
}
|
|
@@ -16281,7 +16403,7 @@ const O = class O {
|
|
|
16281
16403
|
*/
|
|
16282
16404
|
static syncElement(e) {
|
|
16283
16405
|
const t = O.registrations.get(e), r = N.get(e);
|
|
16284
|
-
if (!(r instanceof
|
|
16406
|
+
if (!(r instanceof w) || !O.shouldObserve(r)) {
|
|
16285
16407
|
t && (t.observer.disconnect(), O.registrations.delete(e));
|
|
16286
16408
|
return;
|
|
16287
16409
|
}
|
|
@@ -16306,11 +16428,11 @@ const O = class O {
|
|
|
16306
16428
|
const u = O.registrations.get(e);
|
|
16307
16429
|
if (!u)
|
|
16308
16430
|
return;
|
|
16309
|
-
let
|
|
16431
|
+
let f = !1;
|
|
16310
16432
|
l.forEach((m) => {
|
|
16311
16433
|
const y = m.target;
|
|
16312
|
-
u.observedRows.has(y) && (m.isIntersecting ? u.visibleRows.has(y) || (u.visibleRows.add(y),
|
|
16313
|
-
}),
|
|
16434
|
+
u.observedRows.has(y) && (m.isIntersecting ? u.visibleRows.has(y) || (u.visibleRows.add(y), f = !0) : u.visibleRows.delete(y) && (f = !0));
|
|
16435
|
+
}), f && O.scheduleCompute(u);
|
|
16314
16436
|
},
|
|
16315
16437
|
{
|
|
16316
16438
|
root: n,
|
|
@@ -16406,7 +16528,7 @@ const O = class O {
|
|
|
16406
16528
|
*/
|
|
16407
16529
|
static realRowElements(e) {
|
|
16408
16530
|
return e.getChildren().filter(
|
|
16409
|
-
(t) => t instanceof
|
|
16531
|
+
(t) => t instanceof w && !t.hasAttribute(`${c.prefix}each-before`) && !t.hasAttribute(`${c.prefix}each-after`)
|
|
16410
16532
|
).map((t) => t.getTarget());
|
|
16411
16533
|
}
|
|
16412
16534
|
/**
|
|
@@ -16496,13 +16618,13 @@ const O = class O {
|
|
|
16496
16618
|
};
|
|
16497
16619
|
n[e.varName] = { ...t };
|
|
16498
16620
|
const s = e.fragment.getTarget(), a = i === s ? /* @__PURE__ */ new Set() : /* @__PURE__ */ new Set([e.fragment]);
|
|
16499
|
-
|
|
16621
|
+
M.setBindingData(i, n, {
|
|
16500
16622
|
skipFragments: a,
|
|
16501
16623
|
reflectToAttribute: !1,
|
|
16502
16624
|
// 可視範囲の公開は値の供給ではない(権威を持たず、ユーザー編集の印も
|
|
16503
16625
|
// 解除しない)。
|
|
16504
16626
|
kind: "nonSupply",
|
|
16505
|
-
sequence:
|
|
16627
|
+
sequence: w.nextSequence()
|
|
16506
16628
|
}).catch((o) => {
|
|
16507
16629
|
g.error("[Haori]", "Failed to publish visible range:", o);
|
|
16508
16630
|
});
|
|
@@ -16527,31 +16649,31 @@ const O = class O {
|
|
|
16527
16649
|
};
|
|
16528
16650
|
O.THRESHOLD = 0, O.DEFAULT_ROOT_MARGIN = "0px", O.registrations = /* @__PURE__ */ new Map();
|
|
16529
16651
|
let me = O;
|
|
16530
|
-
const
|
|
16652
|
+
const U = class U {
|
|
16531
16653
|
/**
|
|
16532
16654
|
* 既存の MutationObserver をすべて停止します。
|
|
16533
16655
|
*/
|
|
16534
16656
|
static disconnectMutationObservers() {
|
|
16535
|
-
|
|
16657
|
+
U._mutationObservers.forEach((e) => {
|
|
16536
16658
|
e.disconnect();
|
|
16537
|
-
}),
|
|
16659
|
+
}), U._mutationObservers.length = 0;
|
|
16538
16660
|
}
|
|
16539
16661
|
/**
|
|
16540
16662
|
* 初期化メソッド。
|
|
16541
16663
|
* ドキュメントのheadとbodyを監視対象として設定します。
|
|
16542
16664
|
*/
|
|
16543
16665
|
static async init() {
|
|
16544
|
-
if (
|
|
16666
|
+
if (U._initialized)
|
|
16545
16667
|
return;
|
|
16546
|
-
|
|
16547
|
-
|
|
16668
|
+
U._initialized = !0, U.disconnectMutationObservers(), w.setPendingMutationFlusher(() => {
|
|
16669
|
+
U.flushPendingMutations();
|
|
16548
16670
|
});
|
|
16549
16671
|
const e = new Ke();
|
|
16550
|
-
|
|
16672
|
+
U._dispatcher = e, e.startDeferred(), U._initialIntakes = [];
|
|
16551
16673
|
try {
|
|
16552
16674
|
const t = await Promise.allSettled([
|
|
16553
|
-
|
|
16554
|
-
|
|
16675
|
+
M.scan(document.head),
|
|
16676
|
+
M.scan(document.body)
|
|
16555
16677
|
]), [r, i] = t;
|
|
16556
16678
|
r.status !== "fulfilled" && g.error(
|
|
16557
16679
|
"[Haori]",
|
|
@@ -16561,9 +16683,9 @@ const H = class H {
|
|
|
16561
16683
|
"[Haori]",
|
|
16562
16684
|
"Failed to build body fragment:",
|
|
16563
16685
|
i.reason
|
|
16564
|
-
), await
|
|
16686
|
+
), await U.waitInitialIntakes(), await z.wait(), document.body.setAttribute("data-haori-ready", ""), U.observe(document.head), U.observe(document.body), Ae.syncTree(document.body), ve.syncTree(document.body), me.syncTree(document.body);
|
|
16565
16687
|
} finally {
|
|
16566
|
-
|
|
16688
|
+
U._initialIntakes = null, e.release();
|
|
16567
16689
|
}
|
|
16568
16690
|
B.ready(Qt);
|
|
16569
16691
|
}
|
|
@@ -16574,7 +16696,7 @@ const H = class H {
|
|
|
16574
16696
|
* @returns 稼働中の EventDispatcher。未初期化の場合は null。
|
|
16575
16697
|
*/
|
|
16576
16698
|
static getDispatcher() {
|
|
16577
|
-
return
|
|
16699
|
+
return U._dispatcher;
|
|
16578
16700
|
}
|
|
16579
16701
|
/**
|
|
16580
16702
|
* 初期化の途中で取り込んだ DOM 変更の処理を、すべて待ちます。
|
|
@@ -16587,7 +16709,7 @@ const H = class H {
|
|
|
16587
16709
|
* @returns 待機完了の Promise
|
|
16588
16710
|
*/
|
|
16589
16711
|
static async waitInitialIntakes() {
|
|
16590
|
-
const e =
|
|
16712
|
+
const e = U._initialIntakes;
|
|
16591
16713
|
for (; e !== null && e.length > 0; )
|
|
16592
16714
|
await Promise.allSettled(e.splice(0));
|
|
16593
16715
|
}
|
|
@@ -16607,7 +16729,7 @@ const H = class H {
|
|
|
16607
16729
|
* @returns 戻り値はありません。
|
|
16608
16730
|
*/
|
|
16609
16731
|
static captureMutations(e) {
|
|
16610
|
-
if (
|
|
16732
|
+
if (U._mutationObservers.length > 0) {
|
|
16611
16733
|
e();
|
|
16612
16734
|
return;
|
|
16613
16735
|
}
|
|
@@ -16622,8 +16744,8 @@ const H = class H {
|
|
|
16622
16744
|
try {
|
|
16623
16745
|
e();
|
|
16624
16746
|
} finally {
|
|
16625
|
-
const r = t.takeRecords().map((i) =>
|
|
16626
|
-
t.disconnect(),
|
|
16747
|
+
const r = t.takeRecords().map((i) => U.toCapturedRecord(i));
|
|
16748
|
+
t.disconnect(), U.processMutations(r);
|
|
16627
16749
|
}
|
|
16628
16750
|
}
|
|
16629
16751
|
/**
|
|
@@ -16648,7 +16770,7 @@ const H = class H {
|
|
|
16648
16770
|
type: e.type,
|
|
16649
16771
|
target: e.target,
|
|
16650
16772
|
addedNodes: Array.from(e.addedNodes).filter(
|
|
16651
|
-
(t) => !
|
|
16773
|
+
(t) => !U.hasKnownDescendant(t)
|
|
16652
16774
|
),
|
|
16653
16775
|
removedNodes: []
|
|
16654
16776
|
};
|
|
@@ -16666,7 +16788,7 @@ const H = class H {
|
|
|
16666
16788
|
*/
|
|
16667
16789
|
static hasKnownDescendant(e) {
|
|
16668
16790
|
return e instanceof Element && Array.from(e.querySelectorAll("*")).some(
|
|
16669
|
-
(t) =>
|
|
16791
|
+
(t) => w.peek(t) !== null
|
|
16670
16792
|
);
|
|
16671
16793
|
}
|
|
16672
16794
|
/**
|
|
@@ -16686,7 +16808,7 @@ const H = class H {
|
|
|
16686
16808
|
* @returns 捨てる場合 true
|
|
16687
16809
|
*/
|
|
16688
16810
|
static isStaleExternalRemoval(e, t) {
|
|
16689
|
-
const r =
|
|
16811
|
+
const r = w.peek(t)?.getParent() ?? null;
|
|
16690
16812
|
return r === null || r.getTarget() === e.target ? !1 : r.getTarget().closest(`[${c.prefix}external]`) !== null;
|
|
16691
16813
|
}
|
|
16692
16814
|
/**
|
|
@@ -16712,14 +16834,14 @@ const H = class H {
|
|
|
16712
16834
|
*/
|
|
16713
16835
|
static observe(e) {
|
|
16714
16836
|
const t = new MutationObserver((r) => {
|
|
16715
|
-
|
|
16837
|
+
U.processMutations(r);
|
|
16716
16838
|
});
|
|
16717
16839
|
t.observe(e, {
|
|
16718
16840
|
childList: !0,
|
|
16719
16841
|
subtree: !0,
|
|
16720
16842
|
attributes: !0,
|
|
16721
16843
|
characterData: !0
|
|
16722
|
-
}),
|
|
16844
|
+
}), U._mutationObservers.push(t);
|
|
16723
16845
|
}
|
|
16724
16846
|
/**
|
|
16725
16847
|
* 保留中の DOM 変更を同期的に引き取って処理へ載せます。
|
|
@@ -16742,15 +16864,15 @@ const H = class H {
|
|
|
16742
16864
|
* @returns 戻り値はありません。
|
|
16743
16865
|
*/
|
|
16744
16866
|
static flushPendingMutations() {
|
|
16745
|
-
for (const e of
|
|
16867
|
+
for (const e of U._mutationObservers) {
|
|
16746
16868
|
const t = e.takeRecords();
|
|
16747
16869
|
if (t.length === 0)
|
|
16748
16870
|
continue;
|
|
16749
|
-
const r = t.filter(
|
|
16750
|
-
(n) => !
|
|
16871
|
+
const r = t.filter(U.isBindAttributeRecord), i = t.filter(
|
|
16872
|
+
(n) => !U.isBindAttributeRecord(n)
|
|
16751
16873
|
);
|
|
16752
|
-
r.length > 0 &&
|
|
16753
|
-
|
|
16874
|
+
r.length > 0 && U.processMutations(r, w.nextSequence()), i.length > 0 && Promise.resolve().then(() => {
|
|
16875
|
+
U.processMutations(i);
|
|
16754
16876
|
});
|
|
16755
16877
|
}
|
|
16756
16878
|
}
|
|
@@ -16774,7 +16896,7 @@ const H = class H {
|
|
|
16774
16896
|
static processMutations(e, t) {
|
|
16775
16897
|
for (const r of e)
|
|
16776
16898
|
try {
|
|
16777
|
-
if (
|
|
16899
|
+
if (U.isExternallyManaged(r.target))
|
|
16778
16900
|
continue;
|
|
16779
16901
|
switch (r.type) {
|
|
16780
16902
|
case "attributes": {
|
|
@@ -16782,34 +16904,34 @@ const H = class H {
|
|
|
16782
16904
|
if (r.attributeName && i.hasAttribute("data-haori-click-lock") && (r.attributeName === "disabled" || r.attributeName === "data-haori-click-lock") || r.attributeName && i.hasAttribute(pe) && (r.attributeName === "disabled" || r.attributeName === pe))
|
|
16783
16905
|
break;
|
|
16784
16906
|
if (r.attributeName && (r.attributeName === `${c.prefix}if-false` || r.attributeName === "style" && i.hasAttribute(`${c.prefix}if-false`))) {
|
|
16785
|
-
r.attributeName === "style" &&
|
|
16907
|
+
r.attributeName === "style" && w.reassertHiddenDisplay(i);
|
|
16786
16908
|
break;
|
|
16787
16909
|
}
|
|
16788
|
-
if (r.attributeName &&
|
|
16910
|
+
if (r.attributeName && M.isAliasedAttributeReflection(i, r.attributeName))
|
|
16789
16911
|
break;
|
|
16790
|
-
const n =
|
|
16912
|
+
const n = M.setAttribute(
|
|
16791
16913
|
i,
|
|
16792
16914
|
r.attributeName,
|
|
16793
16915
|
i.getAttribute(r.attributeName),
|
|
16794
16916
|
!0,
|
|
16795
16917
|
t
|
|
16796
16918
|
);
|
|
16797
|
-
|
|
16919
|
+
U._initialIntakes?.push(n), Ae.syncElement(i), ve.syncElement(i), me.syncElement(i);
|
|
16798
16920
|
break;
|
|
16799
16921
|
}
|
|
16800
16922
|
case "childList": {
|
|
16801
16923
|
Array.from(r.removedNodes).forEach((i) => {
|
|
16802
|
-
|
|
16924
|
+
U.isStaleExternalRemoval(r, i) || (Ae.cleanupTree(i), ve.cleanupTree(i), me.cleanupTree(i), M.removeNode(i));
|
|
16803
16925
|
}), Array.from(r.addedNodes).forEach((i) => {
|
|
16804
16926
|
if (!(i.parentElement instanceof Element))
|
|
16805
16927
|
return;
|
|
16806
|
-
const n =
|
|
16807
|
-
|
|
16928
|
+
const n = M.addNode(i.parentElement, i);
|
|
16929
|
+
U._initialIntakes?.push(n), Ae.syncTree(i), ve.syncTree(i), me.syncTree(i);
|
|
16808
16930
|
}), r.target instanceof Element && me.syncElement(r.target);
|
|
16809
16931
|
break;
|
|
16810
16932
|
}
|
|
16811
16933
|
case "characterData": {
|
|
16812
|
-
r.target instanceof Text || r.target instanceof Comment ?
|
|
16934
|
+
r.target instanceof Text || r.target instanceof Comment ? M.changeText(r.target, r.target.textContent) : g.warn(
|
|
16813
16935
|
"[Haori]",
|
|
16814
16936
|
"Unsupported character data type:",
|
|
16815
16937
|
r.target
|
|
@@ -16825,13 +16947,13 @@ const H = class H {
|
|
|
16825
16947
|
}
|
|
16826
16948
|
}
|
|
16827
16949
|
};
|
|
16828
|
-
|
|
16829
|
-
let ke =
|
|
16950
|
+
U._initialized = !1, U._mutationObservers = [], U._dispatcher = null, U._initialIntakes = null;
|
|
16951
|
+
let ke = U;
|
|
16830
16952
|
re.setMutationCapture((b) => ke.captureMutations(b));
|
|
16831
16953
|
document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", ke.init) : ke.init();
|
|
16832
16954
|
const er = () => Re.waitForRenders(), tr = Re.enhancers;
|
|
16833
16955
|
export {
|
|
16834
|
-
|
|
16956
|
+
M as Core,
|
|
16835
16957
|
re as Enhance,
|
|
16836
16958
|
c as Env,
|
|
16837
16959
|
F as Form,
|